@@ -252,6 +252,7 @@ where
252252 vp_wasm_cache,
253253 tx_wasm_cache,
254254 GasMeterKind :: MutGlobal ,
255+ false ,
255256 )
256257 } else {
257258 // Governance proposal. We don't allow tx batches in this case,
@@ -270,6 +271,7 @@ where
270271 tx_wasm_cache,
271272 } ,
272273 GasMeterKind :: MutGlobal ,
274+ false ,
273275 )
274276 . map_err ( |e| Box :: new ( DispatchError :: from ( e) ) ) ?;
275277
@@ -328,6 +330,7 @@ where
328330 tx_gas_meter,
329331 & mut shell_params,
330332 Some ( block_proposer) ,
333+ false ,
331334 )
332335 . map_err ( |e| {
333336 Box :: new ( Error :: WrapperRunnerError ( e. to_string ( ) ) . into ( ) )
@@ -348,6 +351,7 @@ pub(crate) fn dispatch_inner_txs<'a, S, D, H, CA>(
348351 vp_wasm_cache : & ' a mut VpCache < CA > ,
349352 tx_wasm_cache : & ' a mut TxCache < CA > ,
350353 gas_meter_kind : GasMeterKind ,
354+ dry_run : bool ,
351355) -> std:: result:: Result < TxResult < Error > , Box < DispatchError > >
352356where
353357 S : ' static
@@ -384,6 +388,7 @@ where
384388 tx_wasm_cache,
385389 } ,
386390 gas_meter_kind,
391+ dry_run,
387392 ) {
388393 Err ( Error :: GasError ( msg) ) => {
389394 // Gas error aborts the execution of the entire batch
@@ -489,6 +494,7 @@ pub(crate) fn apply_wrapper_tx<S, D, H, CA>(
489494 tx_gas_meter : & RefCell < TxGasMeter > ,
490495 shell_params : & mut ShellParams < ' _ , S , D , H , CA > ,
491496 block_proposer : Option < & Address > ,
497+ dry_run : bool ,
492498) -> Result < TxResult < Error > >
493499where
494500 S : ' static
@@ -514,7 +520,7 @@ where
514520 Some ( block_proposer) => {
515521 transfer_fee ( shell_params, block_proposer, tx, wrapper, tx_index) ?
516522 }
517- None => check_fees ( shell_params, tx, wrapper) ?,
523+ None => check_fees ( shell_params, tx, wrapper, dry_run ) ?,
518524 } ;
519525
520526 // Commit tx to the block write log even in case of subsequent errors (if
@@ -627,7 +633,7 @@ where
627633 } else {
628634 // See if the first inner transaction of the batch pays the fees
629635 // with a masp unshield
630- match try_masp_fee_payment ( shell_params, tx, tx_index) {
636+ match try_masp_fee_payment ( shell_params, tx, tx_index, false ) {
631637 Ok ( valid_batched_tx_result) => {
632638 #[ cfg( not( fuzzing) ) ]
633639 let balance = token:: read_balance (
@@ -784,6 +790,7 @@ fn try_masp_fee_payment<S, D, H, CA>(
784790 } : & mut ShellParams < ' _ , S , D , H , CA > ,
785791 tx : & Tx ,
786792 tx_index : & TxIndex ,
793+ dry_run : bool ,
787794) -> std:: result:: Result < MaspTxResult , MaspFeeError >
788795where
789796 S : ' static
@@ -833,6 +840,7 @@ where
833840 tx_wasm_cache,
834841 } ,
835842 GasMeterKind :: MutGlobal ,
843+ dry_run,
836844 ) {
837845 Ok ( result) => {
838846 // NOTE: do not commit yet cause this could be exploited to get
@@ -958,6 +966,7 @@ pub fn check_fees<S, D, H, CA>(
958966 shell_params : & mut ShellParams < ' _ , S , D , H , CA > ,
959967 tx : & Tx ,
960968 wrapper : & WrapperTx ,
969+ dry_run : bool ,
961970) -> Result < Option < MaspTxResult > >
962971where
963972 S : ' static
@@ -994,6 +1003,7 @@ where
9941003 shell_params,
9951004 tx,
9961005 & TxIndex :: default ( ) ,
1006+ dry_run,
9971007 ) ?;
9981008 let balance = token:: read_balance (
9991009 shell_params. state ,
@@ -1030,6 +1040,7 @@ fn apply_wasm_tx<S, D, H, CA>(
10301040 tx_index : & TxIndex ,
10311041 shell_params : ShellParams < ' _ , S , D , H , CA > ,
10321042 gas_meter_kind : GasMeterKind ,
1043+ dry_run : bool ,
10331044) -> Result < BatchedTxResult >
10341045where
10351046 S : ' static + State < D = D , H = H > + ReadConversionState + Sync ,
@@ -1053,6 +1064,7 @@ where
10531064 vp_wasm_cache,
10541065 tx_wasm_cache,
10551066 gas_meter_kind,
1067+ dry_run,
10561068 ) ?;
10571069
10581070 let vps_result = check_vps ( CheckVps {
@@ -1063,6 +1075,7 @@ where
10631075 verifiers_from_tx : & verifiers,
10641076 vp_wasm_cache,
10651077 gas_meter_kind,
1078+ dry_run,
10661079 } ) ?;
10671080
10681081 let initialized_accounts = state. write_log ( ) . get_initialized_accounts ( ) ;
@@ -1172,6 +1185,7 @@ fn execute_tx<S, D, H, CA>(
11721185 vp_wasm_cache : & mut VpCache < CA > ,
11731186 tx_wasm_cache : & mut TxCache < CA > ,
11741187 gas_meter_kind : GasMeterKind ,
1188+ dry_run : bool ,
11751189) -> Result < BTreeSet < Address > >
11761190where
11771191 S : State < D = D , H = H > ,
@@ -1189,6 +1203,7 @@ where
11891203 vp_wasm_cache,
11901204 tx_wasm_cache,
11911205 gas_meter_kind,
1206+ dry_run,
11921207 )
11931208 . map_err ( |err| match err {
11941209 wasm:: run:: Error :: GasError ( msg) => Error :: GasError ( msg) ,
@@ -1210,6 +1225,7 @@ where
12101225 verifiers_from_tx : & ' a BTreeSet < Address > ,
12111226 vp_wasm_cache : & ' a mut VpCache < CA > ,
12121227 gas_meter_kind : GasMeterKind ,
1228+ dry_run : bool ,
12131229}
12141230
12151231/// Check the acceptance of a transaction by validity predicates
@@ -1222,6 +1238,7 @@ fn check_vps<S, CA>(
12221238 verifiers_from_tx,
12231239 vp_wasm_cache,
12241240 gas_meter_kind,
1241+ dry_run,
12251242 } : CheckVps < ' _ , S , CA > ,
12261243) -> Result < VpsResult >
12271244where
@@ -1241,6 +1258,7 @@ where
12411258 tx_gas_meter,
12421259 vp_wasm_cache,
12431260 gas_meter_kind,
1261+ dry_run,
12441262 ) ?;
12451263 tracing:: debug!( "Total VPs gas cost {:?}" , vps_gas) ;
12461264
@@ -1262,6 +1280,7 @@ fn execute_vps<S, CA>(
12621280 tx_gas_meter : & TxGasMeter ,
12631281 vp_wasm_cache : & mut VpCache < CA > ,
12641282 gas_meter_kind : GasMeterKind ,
1283+ dry_run : bool ,
12651284) -> Result < ( VpsResult , namada_sdk:: gas:: Gas ) >
12661285where
12671286 S : ' static + ReadConversionState + State + Sync ,
@@ -1298,6 +1317,7 @@ where
12981317 & verifiers,
12991318 vp_wasm_cache. clone ( ) ,
13001319 gas_meter_kind,
1320+ dry_run,
13011321 )
13021322 . map_err ( |err| match err {
13031323 wasm:: run:: Error :: GasError ( msg) => {
@@ -1755,6 +1775,7 @@ mod tests {
17551775 & gas_meter,
17561776 & mut vp_cache,
17571777 GasMeterKind :: MutGlobal ,
1778+ false ,
17581779 ) ;
17591780 assert ! ( matches!( result. unwrap_err( ) , Error :: GasError ( _) ) ) ;
17601781 }
@@ -1808,6 +1829,7 @@ mod tests {
18081829 & Default :: default ( ) ,
18091830 vp_cache. clone( ) ,
18101831 GasMeterKind :: MutGlobal ,
1832+ false ,
18111833 )
18121834 . is_ok( )
18131835 ) ;
@@ -1838,6 +1860,7 @@ mod tests {
18381860 & Default :: default ( ) ,
18391861 vp_cache. clone( ) ,
18401862 GasMeterKind :: MutGlobal ,
1863+ false ,
18411864 )
18421865 . is_err( )
18431866 ) ;
0 commit comments