1
+ pub mod handler_cfg;
2
+
3
+ pub use handler_cfg:: { CfgEnvWithHandlerCfg , EnvWithHandlerCfg , HandlerCfg } ;
4
+
1
5
use crate :: {
2
6
alloc:: vec:: Vec , calc_blob_gasprice, Account , Address , Bytes , InvalidHeader ,
3
7
InvalidTransaction , Spec , SpecId , B256 , GAS_PER_BLOB , KECCAK_EMPTY , MAX_BLOB_NUMBER_PER_BLOCK ,
@@ -79,21 +83,6 @@ impl Env {
79
83
/// Return initial spend gas (Gas needed to execute transaction).
80
84
#[ inline]
81
85
pub fn validate_tx < SPEC : Spec > ( & self ) -> Result < ( ) , InvalidTransaction > {
82
- #[ cfg( feature = "optimism" ) ]
83
- if self . cfg . optimism {
84
- // Do not allow for a system transaction to be processed if Regolith is enabled.
85
- if self . tx . optimism . is_system_transaction . unwrap_or ( false )
86
- && SPEC :: enabled ( SpecId :: REGOLITH )
87
- {
88
- return Err ( InvalidTransaction :: DepositSystemTxPostRegolith ) ;
89
- }
90
-
91
- // Do not perform any extra validation for deposit transactions, they are pre-verified on L1.
92
- if self . tx . optimism . source_hash . is_some ( ) {
93
- return Ok ( ( ) ) ;
94
- }
95
- }
96
-
97
86
// BASEFEE tx check
98
87
if SPEC :: enabled ( SpecId :: LONDON ) {
99
88
if let Some ( priority_fee) = self . tx . gas_priority_fee {
@@ -204,13 +193,6 @@ impl Env {
204
193
return Err ( InvalidTransaction :: RejectCallerWithCode ) ;
205
194
}
206
195
207
- // On Optimism, deposit transactions do not have verification on the nonce
208
- // nor the balance of the account.
209
- #[ cfg( feature = "optimism" ) ]
210
- if self . cfg . optimism && self . tx . optimism . source_hash . is_some ( ) {
211
- return Ok ( ( ) ) ;
212
- }
213
-
214
196
// Check that the transaction's nonce is correct
215
197
if let Some ( tx) = self . tx . nonce {
216
198
let state = account. info . nonce ;
@@ -310,14 +292,6 @@ pub struct CfgEnv {
310
292
/// By default, it is set to `false`.
311
293
#[ cfg( feature = "optional_beneficiary_reward" ) ]
312
294
pub disable_beneficiary_reward : bool ,
313
- /// Enables Optimism's execution changes for deposit transactions and fee
314
- /// collection. Hot toggling the optimism field gives applications built
315
- /// on revm the ability to switch optimism execution on and off at runtime,
316
- /// allowing for features like multichain fork testing. Setting this field
317
- /// to false will disable all optimism execution changes regardless of
318
- /// compilation with the optimism feature flag.
319
- #[ cfg( feature = "optimism" ) ]
320
- pub optimism : bool ,
321
295
}
322
296
323
297
impl CfgEnv {
@@ -380,16 +354,6 @@ impl CfgEnv {
380
354
pub fn is_beneficiary_reward_disabled ( & self ) -> bool {
381
355
false
382
356
}
383
-
384
- #[ cfg( feature = "optimism" ) ]
385
- pub fn is_optimism ( & self ) -> bool {
386
- self . optimism
387
- }
388
-
389
- #[ cfg( not( feature = "optimism" ) ) ]
390
- pub fn is_optimism ( & self ) -> bool {
391
- false
392
- }
393
357
}
394
358
395
359
impl Default for CfgEnv {
@@ -414,8 +378,6 @@ impl Default for CfgEnv {
414
378
disable_base_fee : false ,
415
379
#[ cfg( feature = "optional_beneficiary_reward" ) ]
416
380
disable_beneficiary_reward : false ,
417
- #[ cfg( feature = "optimism" ) ]
418
- optimism : false ,
419
381
}
420
382
}
421
383
}
@@ -737,52 +699,6 @@ pub enum AnalysisKind {
737
699
Analyse ,
738
700
}
739
701
740
- #[ cfg( test) ]
741
- #[ cfg( feature = "optimism" ) ]
742
- mod op_tests {
743
- use super :: * ;
744
-
745
- #[ test]
746
- fn test_validate_sys_tx ( ) {
747
- // Set the optimism flag to true and mark
748
- // the tx as a system transaction.
749
- let mut env = Env :: default ( ) ;
750
- env. cfg . optimism = true ;
751
- env. tx . optimism . is_system_transaction = Some ( true ) ;
752
- assert_eq ! (
753
- env. validate_tx:: <crate :: RegolithSpec >( ) ,
754
- Err ( InvalidTransaction :: DepositSystemTxPostRegolith )
755
- ) ;
756
-
757
- // Pre-regolith system transactions should be allowed.
758
- assert ! ( env. validate_tx:: <crate :: BedrockSpec >( ) . is_ok( ) ) ;
759
- }
760
-
761
- #[ test]
762
- fn test_validate_deposit_tx ( ) {
763
- // Set the optimism flag and source hash.
764
- let mut env = Env :: default ( ) ;
765
- env. cfg . optimism = true ;
766
- env. tx . optimism . source_hash = Some ( B256 :: ZERO ) ;
767
- assert ! ( env. validate_tx:: <crate :: RegolithSpec >( ) . is_ok( ) ) ;
768
- }
769
-
770
- #[ test]
771
- fn test_validate_tx_against_state_deposit_tx ( ) {
772
- // Set the optimism flag and source hash.
773
-
774
- use crate :: LatestSpec ;
775
- let mut env = Env :: default ( ) ;
776
- env. cfg . optimism = true ;
777
- env. tx . optimism . source_hash = Some ( B256 :: ZERO ) ;
778
-
779
- // Nonce and balance checks should be skipped for deposit transactions.
780
- assert ! ( env
781
- . validate_tx_against_state:: <LatestSpec >( & mut Account :: default ( ) )
782
- . is_ok( ) ) ;
783
- }
784
- }
785
-
786
702
#[ cfg( test) ]
787
703
mod tests {
788
704
use super :: * ;
0 commit comments