@@ -7,3 +7,56 @@ mod noop;
7
7
pub use noop:: { NoopBlock , NoopCfg } ;
8
8
9
9
mod zenith;
10
+
11
+ use revm:: primitives:: { CfgEnv , TxEnv } ;
12
+
13
+ /// A [`Cfg`] that disables gas-related checks and payment of the
14
+ /// beneficiary reward, while leaving other cfg options unchanged.
15
+ ///
16
+ /// ## Warning
17
+ ///
18
+ /// This filler relies on the following optional features:
19
+ /// - `optional_balance_check`
20
+ /// - `optional_beneficiary_reward`
21
+ /// - `optional_gas_refund`
22
+ /// - `optional_no_base_fee`
23
+ ///
24
+ ///
25
+ /// It will disable the corresponding checks if the features are enabled. **If
26
+ /// none of the features are enabled, this filler will do nothing.**
27
+ #[ derive( Debug , Clone , Copy , Default , PartialEq , Eq ) ]
28
+ pub struct DisableGasChecks ;
29
+
30
+ impl Cfg for DisableGasChecks {
31
+ #[ allow( unused_variables) ]
32
+ fn fill_cfg_env ( & self , cfg_env : & mut CfgEnv ) {
33
+ #[ cfg( feature = "optional_balance_check" ) ]
34
+ {
35
+ cfg_env. disable_balance_check = true ;
36
+ }
37
+ #[ cfg( feature = "optional_beneficiary_reward" ) ]
38
+ {
39
+ cfg_env. disable_beneficiary_reward = true ;
40
+ }
41
+ #[ cfg( feature = "optional_gas_refund" ) ]
42
+ {
43
+ cfg_env. disable_gas_refund = true ;
44
+ }
45
+ #[ cfg( feature = "optional_no_base_fee" ) ]
46
+ {
47
+ cfg_env. disable_base_fee = true ;
48
+ }
49
+ }
50
+ }
51
+
52
+ /// A [`Tx`] that disables the nonce check, while leaving other [`TxEnv`]
53
+ /// attributes untouched.
54
+ #[ derive( Debug , Clone , Copy , Default , PartialEq , Eq ) ]
55
+ pub struct DisableNonceCheck ;
56
+
57
+ impl Tx for DisableNonceCheck {
58
+ #[ allow( unused_variables) ]
59
+ fn fill_tx_env ( & self , tx_env : & mut TxEnv ) {
60
+ tx_env. nonce = None ;
61
+ }
62
+ }
0 commit comments