File tree Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ pub trait CheatcodesExecutor {
9999 ccx : & mut CheatsCtxt ,
100100 ) -> Result < CreateOutcome , EVMError < DatabaseError > > {
101101 with_evm ( self , ccx, |evm| {
102- evm. inner . ctx . journaled_state . depth += 1 ;
102+ evm. journaled_state . depth += 1 ;
103103
104104 let frame = FrameInput :: Create ( Box :: new ( inputs) ) ;
105105
@@ -108,7 +108,7 @@ pub trait CheatcodesExecutor {
108108 FrameResult :: Create ( create) => create,
109109 } ;
110110
111- evm. inner . ctx . journaled_state . depth -= 1 ;
111+ evm. journaled_state . depth -= 1 ;
112112
113113 Ok ( outcome)
114114 } )
@@ -156,11 +156,12 @@ where
156156
157157 let res = f ( & mut evm) ?;
158158
159- ccx. ecx . journaled_state . inner = evm. inner . ctx . journaled_state . inner ;
160- ccx. ecx . block = evm. inner . ctx . block ;
161- ccx. ecx . tx = evm. inner . ctx . tx ;
162- ccx. ecx . cfg = evm. inner . ctx . cfg ;
163- ccx. ecx . error = evm. inner . ctx . error ;
159+ let ctx = evm. into_context ( ) ;
160+ ccx. ecx . journaled_state . inner = ctx. journaled_state . inner ;
161+ ccx. ecx . block = ctx. block ;
162+ ccx. ecx . tx = ctx. tx ;
163+ ccx. ecx . cfg = ctx. cfg ;
164+ ccx. ecx . error = ctx. error ;
164165
165166 Ok ( res)
166167}
Original file line number Diff line number Diff line change @@ -117,15 +117,20 @@ fn get_create2_factory_call_inputs(
117117
118118pub struct FoundryEvm < ' db , I : InspectorExt > {
119119 #[ allow( clippy:: type_complexity) ]
120- pub inner : RevmEvm <
120+ inner : RevmEvm <
121121 EthEvmContext < & ' db mut dyn DatabaseExt > ,
122122 I ,
123123 EthInstructions < EthInterpreter , EthEvmContext < & ' db mut dyn DatabaseExt > > ,
124124 PrecompilesMap ,
125125 EthFrame < EthInterpreter > ,
126126 > ,
127127}
128- impl < I : InspectorExt > FoundryEvm < ' _ , I > {
128+ impl < ' db , I : InspectorExt > FoundryEvm < ' db , I > {
129+ /// Consumes the EVM and returns the inner context.
130+ pub fn into_context ( self ) -> EthEvmContext < & ' db mut dyn DatabaseExt > {
131+ self . inner . ctx
132+ }
133+
129134 pub fn run_execution (
130135 & mut self ,
131136 frame : FrameInput ,
You can’t perform that action at this time.
0 commit comments