1
- use crate :: database :: DB ;
2
- use crate :: utils :: pyerr ;
1
+ use std :: mem :: replace ;
2
+
3
3
use pyo3:: exceptions:: PyRuntimeError ;
4
4
use pyo3:: PyResult ;
5
5
use revm:: inspectors:: TracerEip3155 ;
@@ -12,18 +12,20 @@ use revm::{
12
12
} ;
13
13
use revm_interpreter:: primitives:: HandlerCfg ;
14
14
use revm_interpreter:: { gas, CallInputs , CreateInputs , SuccessOrHalt } ;
15
- use std:: mem:: replace;
15
+
16
+ use crate :: database:: DB ;
17
+ use crate :: utils:: pyerr;
16
18
17
19
/// Calls the EVM with the given context and handler configuration.
18
20
pub ( crate ) fn call_evm (
19
21
evm_context : EvmContext < DB > ,
20
22
handler_cfg : HandlerCfg ,
21
23
tracing : bool ,
22
24
is_static : bool ,
23
- ) -> PyResult < ( ExecutionResult , EvmContext < DB > ) > {
25
+ ) -> ( PyResult < ExecutionResult > , EvmContext < DB > ) {
24
26
if tracing {
25
27
let tracer = TracerEip3155 :: new ( Box :: new ( crate :: pystdout:: PySysStdout { } ) ) ;
26
- let evm = Evm :: builder ( )
28
+ let mut evm = Evm :: builder ( )
27
29
. with_context_with_handler_cfg ( ContextWithHandlerCfg {
28
30
cfg : handler_cfg,
29
31
context : Context {
@@ -33,9 +35,9 @@ pub(crate) fn call_evm(
33
35
} )
34
36
. append_handler_register ( inspector_handle_register)
35
37
. build ( ) ;
36
- run_evm ( evm, is_static)
38
+ ( run_evm ( & mut evm, is_static) , evm . context . evm )
37
39
} else {
38
- let evm = Evm :: builder ( )
40
+ let mut evm = Evm :: builder ( )
39
41
. with_context_with_handler_cfg ( ContextWithHandlerCfg {
40
42
cfg : handler_cfg,
41
43
context : Context {
@@ -44,15 +46,12 @@ pub(crate) fn call_evm(
44
46
} ,
45
47
} )
46
48
. build ( ) ;
47
- run_evm ( evm, is_static)
49
+ ( run_evm ( & mut evm, is_static) , evm . context . evm )
48
50
}
49
51
}
50
52
51
53
/// Calls the given evm. This is originally a copy of revm::Evm::transact, but it calls our own output function
52
- fn run_evm < EXT > (
53
- mut evm : Evm < ' _ , EXT , DB > ,
54
- is_static : bool ,
55
- ) -> PyResult < ( ExecutionResult , EvmContext < DB > ) > {
54
+ fn run_evm < EXT > ( evm : & mut Evm < ' _ , EXT , DB > , is_static : bool ) -> PyResult < ExecutionResult > {
56
55
let logs_i = evm. context . evm . journaled_state . logs . len ( ) ;
57
56
58
57
evm. handler
@@ -137,7 +136,7 @@ fn run_evm<EXT>(
137
136
let logs = ctx. evm . journaled_state . logs [ logs_i..] . to_vec ( ) ;
138
137
139
138
// Returns output of transaction.
140
- Ok ( ( output ( ctx, result, logs) ? , evm . context . evm ) )
139
+ output ( ctx, result, logs)
141
140
}
142
141
143
142
fn call_inputs < EXT > (
0 commit comments