Skip to content

Commit 901b0a8

Browse files
committed
disable vm for trace_call
1 parent 8ef1b3a commit 901b0a8

File tree

5 files changed

+13
-9
lines changed

5 files changed

+13
-9
lines changed

modules/evm/src/runner/tracing.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ pub enum Event<'a> {
8888
}
8989

9090
pub struct Tracer {
91+
vm: bool,
9192
events: Vec<CallTrace>,
9293
stack: Vec<CallTrace>,
9394
steps: Vec<Step>,
@@ -96,8 +97,9 @@ pub struct Tracer {
9697
}
9798

9899
impl Tracer {
99-
pub fn new() -> Self {
100+
pub fn new(vm: bool) -> Self {
100101
Self {
102+
vm,
101103
events: Vec::new(),
102104
stack: Vec::new(),
103105
steps: Vec::new(),
@@ -135,6 +137,9 @@ impl Tracer {
135137
memory,
136138
} => {
137139
self.opcode = Some(opcode);
140+
if !self.vm {
141+
return;
142+
}
138143
self.steps.push(Step {
139144
op: opcode.stringify().as_bytes().to_vec(),
140145
pc: position.clone().unwrap_or_default() as u64,
@@ -542,7 +547,6 @@ impl Stringify for ExitError {
542547
ExitError::PCUnderflow => "PCUnderflow",
543548
ExitError::CreateEmpty => "CreateEmpty",
544549
ExitError::Other(msg) => msg,
545-
ExitError::MaxNonce => "MaxNonce",
546550
}
547551
}
548552
}

modules/evm/src/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3030,7 +3030,7 @@ fn tracer_works() {
30303030

30313031
let alice_account_id = <Runtime as Config>::AddressMapping::get_account_id(&alice());
30323032

3033-
let mut tracer = crate::runner::tracing::Tracer::new();
3033+
let mut tracer = crate::runner::tracing::Tracer::new(true);
30343034
crate::runner::tracing::using(&mut tracer, || {
30353035
assert_ok!(EVM::call(
30363036
RuntimeOrigin::signed(alice_account_id.clone()),

runtime/acala/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2189,7 +2189,7 @@ sp_api::impl_runtime_apis! {
21892189
storage_limit: u32,
21902190
access_list: Option<Vec<AccessListItem>>,
21912191
) -> 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);
21932193
module_evm::runner::tracing::using(&mut tracer, || {
21942194
if to == H160::zero() {
21952195
<Runtime as module_evm::Config>::Runner::rpc_create(
@@ -2228,7 +2228,7 @@ sp_api::impl_runtime_apis! {
22282228
) -> Result<module_evm::runner::tracing::VMTrace, sp_runtime::DispatchError> {
22292229
use sp_core::H256;
22302230
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);
22322232
module_evm::runner::tracing::using(&mut tracer, || {
22332233
if to == H160::zero() {
22342234
<Runtime as module_evm::Config>::Runner::rpc_create(

runtime/karura/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2203,7 +2203,7 @@ impl_runtime_apis! {
22032203
storage_limit: u32,
22042204
access_list: Option<Vec<AccessListItem>>,
22052205
) -> 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);
22072207
module_evm::runner::tracing::using(&mut tracer, || {
22082208
if to == H160::zero() {
22092209
<Runtime as module_evm::Config>::Runner::rpc_create(
@@ -2242,7 +2242,7 @@ impl_runtime_apis! {
22422242
) -> Result<module_evm::runner::tracing::VMTrace, sp_runtime::DispatchError> {
22432243
use sp_core::H256;
22442244
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);
22462246
module_evm::runner::tracing::using(&mut tracer, || {
22472247
if to == H160::zero() {
22482248
<Runtime as module_evm::Config>::Runner::rpc_create(

runtime/mandala/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2396,7 +2396,7 @@ impl_runtime_apis! {
23962396
storage_limit: u32,
23972397
access_list: Option<Vec<AccessListItem>>,
23982398
) -> 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);
24002400
module_evm::runner::tracing::using(&mut tracer, || {
24012401
if to == H160::zero() {
24022402
<Runtime as module_evm::Config>::Runner::rpc_create(
@@ -2435,7 +2435,7 @@ impl_runtime_apis! {
24352435
) -> Result<module_evm::runner::tracing::VMTrace, sp_runtime::DispatchError> {
24362436
use sp_core::H256;
24372437
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);
24392439
module_evm::runner::tracing::using(&mut tracer, || {
24402440
if to == H160::zero() {
24412441
<Runtime as module_evm::Config>::Runner::rpc_create(

0 commit comments

Comments
 (0)