@@ -4,7 +4,7 @@ use core::marker::PhantomData;
44use casper_types:: {
55 account:: AccountHash ,
66 bytesrepr:: FromBytes ,
7- system:: auction:: { Reservation , ARG_VALIDATOR } ,
7+ system:: auction:: { DelegatorKind , Reservation , ARG_VALIDATOR } ,
88 CLType , CLTyped , CLValue , CLValueError , InvalidTransactionV1 , PublicKey , RuntimeArgs ,
99 TransactionArgs , URef , U512 ,
1010} ;
@@ -53,7 +53,7 @@ const ADD_RESERVATIONS_ARG_RESERVATIONS: RequiredArg<Vec<Reservation>> =
5353 RequiredArg :: new ( "reservations" ) ;
5454
5555const CANCEL_RESERVATIONS_ARG_VALIDATOR : RequiredArg < PublicKey > = RequiredArg :: new ( "validator" ) ;
56- const CANCEL_RESERVATIONS_ARG_DELEGATORS : RequiredArg < Vec < PublicKey > > =
56+ const CANCEL_RESERVATIONS_ARG_DELEGATORS : RequiredArg < Vec < DelegatorKind > > =
5757 RequiredArg :: new ( "delegators" ) ;
5858
5959struct RequiredArg < T > {
@@ -428,7 +428,7 @@ pub fn has_valid_add_reservations_args(args: &TransactionArgs) -> Result<(), Inv
428428#[ cfg( test) ]
429429pub fn new_cancel_reservations_args (
430430 validator : PublicKey ,
431- delegators : Vec < PublicKey > ,
431+ delegators : Vec < DelegatorKind > ,
432432) -> Result < RuntimeArgs , CLValueError > {
433433 let mut args = RuntimeArgs :: new ( ) ;
434434 CANCEL_RESERVATIONS_ARG_VALIDATOR . insert ( & mut args, validator) ?;
@@ -1169,7 +1169,7 @@ mod tests {
11691169
11701170 // Missing "validator".
11711171 let args = runtime_args ! {
1172- CANCEL_RESERVATIONS_ARG_DELEGATORS . name => rng. random_vec:: <Range <usize >, PublicKey >( 0 ..100 ) ,
1172+ CANCEL_RESERVATIONS_ARG_DELEGATORS . name => rng. random_vec:: <Range <usize >, DelegatorKind >( 0 ..100 ) ,
11731173 } ;
11741174 let expected_error = InvalidTransactionV1 :: MissingArg {
11751175 arg_name : CANCEL_RESERVATIONS_ARG_VALIDATOR . name . to_string ( ) ,
@@ -1199,7 +1199,7 @@ mod tests {
11991199 // Wrong "validator" type.
12001200 let args = runtime_args ! {
12011201 CANCEL_RESERVATIONS_ARG_VALIDATOR . name => rng. random_vec:: <Range <usize >, PublicKey >( 0 ..100 ) ,
1202- CANCEL_RESERVATIONS_ARG_DELEGATORS . name => rng. random_vec:: <Range <usize >, PublicKey >( 0 ..100 ) ,
1202+ CANCEL_RESERVATIONS_ARG_DELEGATORS . name => rng. random_vec:: <Range <usize >, DelegatorKind >( 0 ..100 ) ,
12031203 } ;
12041204 let expected_error = InvalidTransactionV1 :: UnexpectedArgType {
12051205 arg_name : CANCEL_RESERVATIONS_ARG_VALIDATOR . name . to_string ( ) ,
@@ -1218,7 +1218,7 @@ mod tests {
12181218 } ;
12191219 let expected_error = InvalidTransactionV1 :: UnexpectedArgType {
12201220 arg_name : CANCEL_RESERVATIONS_ARG_DELEGATORS . name . to_string ( ) ,
1221- expected : vec ! [ CLType :: List ( Box :: new( CLType :: PublicKey ) ) ] ,
1221+ expected : vec ! [ CLType :: List ( Box :: new( CLType :: Any ) ) ] ,
12221222 got : CLType :: U8 ,
12231223 } ;
12241224 assert_eq ! (
@@ -1252,5 +1252,13 @@ mod tests {
12521252 has_valid_redelegate_args( & args) . as_ref( ) ,
12531253 Err ( & expected_error)
12541254 ) ;
1255+ assert_eq ! (
1256+ has_valid_add_reservations_args( & args) . as_ref( ) ,
1257+ Err ( & expected_error)
1258+ ) ;
1259+ assert_eq ! (
1260+ has_valid_cancel_reservations_args( & args) . as_ref( ) ,
1261+ Err ( & expected_error)
1262+ ) ;
12551263 }
12561264}
0 commit comments