1
1
use crate :: {
2
- driver:: DriveBlockResult , Block , BlockDriver , BundleDriver , Cfg , ChainDriver ,
3
- DriveBundleResult , DriveChainResult , ErroredState , EvmErrored , EvmExtUnchecked , EvmNeedsBlock ,
4
- EvmNeedsCfg , EvmNeedsTx , EvmReady , EvmTransacted , HasBlock , HasCfg , HasTx , NeedsCfg , NeedsTx ,
5
- TransactedState , Tx ,
2
+ db :: ConcurrentState , driver:: DriveBlockResult , Block , BlockDriver , BundleDriver , Cfg ,
3
+ ChainDriver , DriveBundleResult , DriveChainResult , ErroredState , EvmErrored , EvmExtUnchecked ,
4
+ EvmNeedsBlock , EvmNeedsCfg , EvmNeedsTx , EvmReady , EvmTransacted , HasBlock , HasCfg , HasTx ,
5
+ NeedsCfg , NeedsTx , TransactedState , Tx ,
6
6
} ;
7
7
use alloc:: { boxed:: Box , fmt} ;
8
8
use alloy_primitives:: { Address , Bytes , U256 } ;
@@ -440,7 +440,7 @@ impl<Ext, Db: Database<Error = Infallible> + DatabaseCommit, TrevmState>
440
440
}
441
441
}
442
442
443
- // --- ALL STATES, WITH STATE<DB >
443
+ // --- ALL STATES, WITH State<Db> or ConcurrentState<Db >
444
444
445
445
impl < Ext , Db : Database + DatabaseCommit , TrevmState > Trevm < ' _ , Ext , State < Db > , TrevmState > {
446
446
/// Set the [EIP-161] state clear flag, activated in the Spurious Dragon
@@ -450,6 +450,14 @@ impl<Ext, Db: Database + DatabaseCommit, TrevmState> Trevm<'_, Ext, State<Db>, T
450
450
}
451
451
}
452
452
453
+ impl < Ext , Db : DatabaseRef , TrevmState > Trevm < ' _ , Ext , ConcurrentState < Db > , TrevmState > {
454
+ /// Set the [EIP-161] state clear flag, activated in the Spurious Dragon
455
+ /// hardfork.
456
+ pub fn set_state_clear_flag ( & mut self , flag : bool ) {
457
+ self . inner . db_mut ( ) . set_state_clear_flag ( flag)
458
+ }
459
+ }
460
+
453
461
// --- NEEDS CFG
454
462
455
463
impl < ' a , Ext , Db : Database + DatabaseCommit > EvmNeedsCfg < ' a , Ext , Db > {
@@ -878,7 +886,7 @@ impl<'a, Ext, Db: Database + DatabaseCommit, TrevmState: HasBlock> Trevm<'a, Ext
878
886
}
879
887
}
880
888
881
- // --- Needs Block with State<Db>
889
+ // --- Needs Block with State<Db> or ConcurrentState<Db>
882
890
883
891
impl < Ext , Db : Database > EvmNeedsBlock < ' _ , Ext , State < Db > > {
884
892
/// Finish execution and return the outputs.
@@ -897,6 +905,23 @@ impl< Ext, Db: Database> EvmNeedsBlock<'_, Ext, State<Db>> {
897
905
}
898
906
}
899
907
908
+ impl < ' a , Ext , Db : DatabaseRef > EvmNeedsBlock < ' a , Ext , ConcurrentState < Db > > {
909
+ /// Finish execution and return the outputs.
910
+ ///
911
+ /// ## Panics
912
+ ///
913
+ /// If the State has not been built with StateBuilder::with_bundle_update.
914
+ ///
915
+ /// See [`State::merge_transitions`] and [`State::take_bundle`].
916
+ pub fn finish ( self ) -> BundleState {
917
+ let Self { inner : mut evm, .. } = self ;
918
+ evm. db_mut ( ) . merge_transitions ( BundleRetention :: Reverts ) ;
919
+ let bundle = evm. db_mut ( ) . take_bundle ( ) ;
920
+
921
+ bundle
922
+ }
923
+ }
924
+
900
925
// --- NEEDS TX
901
926
902
927
impl < ' a , Ext , Db : Database + DatabaseCommit > EvmNeedsTx < ' a , Ext , Db > {
0 commit comments