@@ -356,7 +356,7 @@ fn exec_system_call(system_menu: SystemMenu, initiator: Option<AccountHash>) {
356356 let initiator = initiator. unwrap_or ( DEFAULT_STABLE_VALIDATOR_PUBLIC_KEY . to_account_hash ( ) ) ;
357357
358358 let system_function_option: u32 = system_menu. into ( ) ;
359- let input_data = borsh:: to_vec ( & ( system_function_option, ) )
359+ let input_data = borsh:: to_vec ( & ( system_function_option, false ) )
360360 . map ( Bytes :: from)
361361 . unwrap ( ) ;
362362 let execute_request = make_execution_request (
@@ -423,7 +423,7 @@ fn should_revert_invalid_system_option() {
423423 let block_time = Timestamp :: now ( ) . into ( ) ;
424424
425425 let account_hash = DEFAULT_STABLE_VALIDATOR_PUBLIC_KEY . to_account_hash ( ) ;
426- let input_data = borsh:: to_vec ( & ( 9999 , ) ) . map ( Bytes :: from) . unwrap ( ) ;
426+ let input_data = borsh:: to_vec ( & ( 9999 , false ) ) . map ( Bytes :: from) . unwrap ( ) ;
427427
428428 let execute_request = make_execution_request (
429429 & chainspec_config,
@@ -543,7 +543,7 @@ fn should_handle_reservations() {
543543 // need to bump the delegator reservation limit up to allow add_reservation to work
544544 let bid_request = {
545545 let opt: u32 = SystemMenu :: Auction ( AuctionMethods :: Bid ) . into ( ) ;
546- let input_data = borsh:: to_vec ( & ( opt, ) ) . map ( Bytes :: from) . unwrap ( ) ;
546+ let input_data = borsh:: to_vec ( & ( opt, false ) ) . map ( Bytes :: from) . unwrap ( ) ;
547547 make_execution_request (
548548 & chainspec_config,
549549 Arc :: clone ( & address_generator) ,
@@ -579,9 +579,9 @@ fn should_handle_reservations() {
579579 }
580580
581581 // make a couple of reservations
582- let add_res_request = {
582+ let add_res_pubk_request = {
583583 let opt: u32 = SystemMenu :: Auction ( AuctionMethods :: AddReservation ) . into ( ) ;
584- let input_data = borsh:: to_vec ( & ( opt, ) ) . map ( Bytes :: from) . unwrap ( ) ;
584+ let input_data = borsh:: to_vec ( & ( opt, false ) ) . map ( Bytes :: from) . unwrap ( ) ;
585585 make_execution_request (
586586 & chainspec_config,
587587 Arc :: clone ( & address_generator) ,
@@ -594,16 +594,45 @@ fn should_handle_reservations() {
594594 )
595595 } ;
596596
597- state_root_hash =
598- match exec_and_commit ( & executor, & global_state, & state_root_hash, add_res_request) {
599- Ok ( post_state) => post_state,
600- Err ( err_str) => panic ! ( "{err_str}" ) ,
601- } ;
597+ state_root_hash = match exec_and_commit (
598+ & executor,
599+ & global_state,
600+ & state_root_hash,
601+ add_res_pubk_request,
602+ ) {
603+ Ok ( post_state) => post_state,
604+ Err ( err_str) => panic ! ( "{err_str}" ) ,
605+ } ;
606+
607+ let add_res_purse_request = {
608+ let opt: u32 = SystemMenu :: Auction ( AuctionMethods :: AddReservation ) . into ( ) ;
609+ let input_data = borsh:: to_vec ( & ( opt, true ) ) . map ( Bytes :: from) . unwrap ( ) ;
610+ make_execution_request (
611+ & chainspec_config,
612+ Arc :: clone ( & address_generator) ,
613+ ExecutionKind :: SessionBytes ( read_wasm ( VM2_SYSTEM_CALLER_WASM ) ) ,
614+ input_data,
615+ 0 ,
616+ Some ( account_hash) ,
617+ None ,
618+ Some ( block_time) ,
619+ )
620+ } ;
621+
622+ state_root_hash = match exec_and_commit (
623+ & executor,
624+ & global_state,
625+ & state_root_hash,
626+ add_res_purse_request,
627+ ) {
628+ Ok ( post_state) => post_state,
629+ Err ( err_str) => panic ! ( "{err_str}" ) ,
630+ } ;
602631
603632 // cancel those reservations
604- let cancel_request = {
633+ let cancel_pubk_request = {
605634 let opt: u32 = SystemMenu :: Auction ( AuctionMethods :: CancelReservation ) . into ( ) ;
606- let input_data = borsh:: to_vec ( & ( opt, ) ) . map ( Bytes :: from) . unwrap ( ) ;
635+ let input_data = borsh:: to_vec ( & ( opt, false ) ) . map ( Bytes :: from) . unwrap ( ) ;
607636 make_execution_request (
608637 & chainspec_config,
609638 Arc :: clone ( & address_generator) ,
@@ -616,7 +645,37 @@ fn should_handle_reservations() {
616645 )
617646 } ;
618647
619- match exec_and_commit ( & executor, & global_state, & state_root_hash, cancel_request) {
648+ match exec_and_commit (
649+ & executor,
650+ & global_state,
651+ & state_root_hash,
652+ cancel_pubk_request,
653+ ) {
654+ Ok ( post_state) => post_state,
655+ Err ( err_str) => panic ! ( "{err_str}" ) ,
656+ } ;
657+
658+ let cancel_purse_request = {
659+ let opt: u32 = SystemMenu :: Auction ( AuctionMethods :: CancelReservation ) . into ( ) ;
660+ let input_data = borsh:: to_vec ( & ( opt, true ) ) . map ( Bytes :: from) . unwrap ( ) ;
661+ make_execution_request (
662+ & chainspec_config,
663+ Arc :: clone ( & address_generator) ,
664+ ExecutionKind :: SessionBytes ( read_wasm ( VM2_SYSTEM_CALLER_WASM ) ) ,
665+ input_data,
666+ 0 ,
667+ Some ( account_hash) ,
668+ None ,
669+ Some ( block_time) ,
670+ )
671+ } ;
672+
673+ match exec_and_commit (
674+ & executor,
675+ & global_state,
676+ & state_root_hash,
677+ cancel_purse_request,
678+ ) {
620679 Ok ( post_state) => post_state,
621680 Err ( err_str) => panic ! ( "{err_str}" ) ,
622681 } ;
0 commit comments