File tree Expand file tree Collapse file tree 5 files changed +13
-9
lines changed Expand file tree Collapse file tree 5 files changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,7 @@ pub enum Event<'a> {
88
88
}
89
89
90
90
pub struct Tracer {
91
+ vm : bool ,
91
92
events : Vec < CallTrace > ,
92
93
stack : Vec < CallTrace > ,
93
94
steps : Vec < Step > ,
@@ -96,8 +97,9 @@ pub struct Tracer {
96
97
}
97
98
98
99
impl Tracer {
99
- pub fn new ( ) -> Self {
100
+ pub fn new ( vm : bool ) -> Self {
100
101
Self {
102
+ vm,
101
103
events : Vec :: new ( ) ,
102
104
stack : Vec :: new ( ) ,
103
105
steps : Vec :: new ( ) ,
@@ -135,6 +137,9 @@ impl Tracer {
135
137
memory,
136
138
} => {
137
139
self . opcode = Some ( opcode) ;
140
+ if !self . vm {
141
+ return ;
142
+ }
138
143
self . steps . push ( Step {
139
144
op : opcode. stringify ( ) . as_bytes ( ) . to_vec ( ) ,
140
145
pc : position. clone ( ) . unwrap_or_default ( ) as u64 ,
@@ -542,7 +547,6 @@ impl Stringify for ExitError {
542
547
ExitError :: PCUnderflow => "PCUnderflow" ,
543
548
ExitError :: CreateEmpty => "CreateEmpty" ,
544
549
ExitError :: Other ( msg) => msg,
545
- ExitError :: MaxNonce => "MaxNonce" ,
546
550
}
547
551
}
548
552
}
Original file line number Diff line number Diff line change @@ -3030,7 +3030,7 @@ fn tracer_works() {
3030
3030
3031
3031
let alice_account_id = <Runtime as Config >:: AddressMapping :: get_account_id ( & alice ( ) ) ;
3032
3032
3033
- let mut tracer = crate :: runner:: tracing:: Tracer :: new ( ) ;
3033
+ let mut tracer = crate :: runner:: tracing:: Tracer :: new ( true ) ;
3034
3034
crate :: runner:: tracing:: using ( & mut tracer, || {
3035
3035
assert_ok ! ( EVM :: call(
3036
3036
RuntimeOrigin :: signed( alice_account_id. clone( ) ) ,
Original file line number Diff line number Diff line change @@ -2189,7 +2189,7 @@ sp_api::impl_runtime_apis! {
2189
2189
storage_limit: u32 ,
2190
2190
access_list: Option <Vec <AccessListItem >>,
2191
2191
) -> Result <Vec <module_evm:: runner:: tracing:: CallTrace >, sp_runtime:: DispatchError > {
2192
- let mut tracer = module_evm:: runner:: tracing:: Tracer :: new( ) ;
2192
+ let mut tracer = module_evm:: runner:: tracing:: Tracer :: new( false ) ;
2193
2193
module_evm:: runner:: tracing:: using( & mut tracer, || {
2194
2194
if to == H160 :: zero( ) {
2195
2195
<Runtime as module_evm:: Config >:: Runner :: rpc_create(
@@ -2228,7 +2228,7 @@ sp_api::impl_runtime_apis! {
2228
2228
) -> Result <module_evm:: runner:: tracing:: VMTrace , sp_runtime:: DispatchError > {
2229
2229
use sp_core:: H256 ;
2230
2230
use sp_runtime:: traits:: UniqueSaturatedInto ;
2231
- let mut tracer = module_evm:: runner:: tracing:: Tracer :: new( ) ;
2231
+ let mut tracer = module_evm:: runner:: tracing:: Tracer :: new( true ) ;
2232
2232
module_evm:: runner:: tracing:: using( & mut tracer, || {
2233
2233
if to == H160 :: zero( ) {
2234
2234
<Runtime as module_evm:: Config >:: Runner :: rpc_create(
Original file line number Diff line number Diff line change @@ -2203,7 +2203,7 @@ impl_runtime_apis! {
2203
2203
storage_limit: u32 ,
2204
2204
access_list: Option <Vec <AccessListItem >>,
2205
2205
) -> Result <Vec <module_evm:: runner:: tracing:: CallTrace >, sp_runtime:: DispatchError > {
2206
- let mut tracer = module_evm:: runner:: tracing:: Tracer :: new( ) ;
2206
+ let mut tracer = module_evm:: runner:: tracing:: Tracer :: new( false ) ;
2207
2207
module_evm:: runner:: tracing:: using( & mut tracer, || {
2208
2208
if to == H160 :: zero( ) {
2209
2209
<Runtime as module_evm:: Config >:: Runner :: rpc_create(
@@ -2242,7 +2242,7 @@ impl_runtime_apis! {
2242
2242
) -> Result <module_evm:: runner:: tracing:: VMTrace , sp_runtime:: DispatchError > {
2243
2243
use sp_core:: H256 ;
2244
2244
use sp_runtime:: traits:: UniqueSaturatedInto ;
2245
- let mut tracer = module_evm:: runner:: tracing:: Tracer :: new( ) ;
2245
+ let mut tracer = module_evm:: runner:: tracing:: Tracer :: new( true ) ;
2246
2246
module_evm:: runner:: tracing:: using( & mut tracer, || {
2247
2247
if to == H160 :: zero( ) {
2248
2248
<Runtime as module_evm:: Config >:: Runner :: rpc_create(
Original file line number Diff line number Diff line change @@ -2396,7 +2396,7 @@ impl_runtime_apis! {
2396
2396
storage_limit: u32 ,
2397
2397
access_list: Option <Vec <AccessListItem >>,
2398
2398
) -> Result <Vec <module_evm:: runner:: tracing:: CallTrace >, sp_runtime:: DispatchError > {
2399
- let mut tracer = module_evm:: runner:: tracing:: Tracer :: new( ) ;
2399
+ let mut tracer = module_evm:: runner:: tracing:: Tracer :: new( false ) ;
2400
2400
module_evm:: runner:: tracing:: using( & mut tracer, || {
2401
2401
if to == H160 :: zero( ) {
2402
2402
<Runtime as module_evm:: Config >:: Runner :: rpc_create(
@@ -2435,7 +2435,7 @@ impl_runtime_apis! {
2435
2435
) -> Result <module_evm:: runner:: tracing:: VMTrace , sp_runtime:: DispatchError > {
2436
2436
use sp_core:: H256 ;
2437
2437
use sp_runtime:: traits:: UniqueSaturatedInto ;
2438
- let mut tracer = module_evm:: runner:: tracing:: Tracer :: new( ) ;
2438
+ let mut tracer = module_evm:: runner:: tracing:: Tracer :: new( true ) ;
2439
2439
module_evm:: runner:: tracing:: using( & mut tracer, || {
2440
2440
if to == H160 :: zero( ) {
2441
2441
<Runtime as module_evm:: Config >:: Runner :: rpc_create(
You can’t perform that action at this time.
0 commit comments