diff --git a/.github/workflows/tests-evm.yml b/.github/workflows/tests-evm.yml index 754dddbbaf805..2168775482568 100644 --- a/.github/workflows/tests-evm.yml +++ b/.github/workflows/tests-evm.yml @@ -75,7 +75,7 @@ jobs: uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 with: repository: paritytech/evm-test-suite - ref: f3a2e98620adfc233166728230247d479a159e76 + ref: 72598a9f47438dd1a515775265949d64a85e4e3f path: evm-test-suite - uses: denoland/setup-deno@v2 diff --git a/prdoc/pr_10918.prdoc b/prdoc/pr_10918.prdoc new file mode 100644 index 0000000000000..e7f5b60cce930 --- /dev/null +++ b/prdoc/pr_10918.prdoc @@ -0,0 +1,16 @@ +title: Fix delegatecall callTracer addresses +doc: +- audience: Runtime Dev + description: |- + ## Summary + - Fix address tracking in delegatecall operations for callTracer + + ## Changes + - Update callTracer to correctly track addresses during delegatecall operations + + ## Test plan + - Existing tests should pass + - Verify callTracer correctly reports addresses for delegatecall operations +crates: +- name: pallet-revive + bump: patch diff --git a/substrate/frame/revive/src/exec.rs b/substrate/frame/revive/src/exec.rs index f4ec66eb3bc17..5ea5b64d8fb01 100644 --- a/substrate/frame/revive/src/exec.rs +++ b/substrate/frame/revive/src/exec.rs @@ -1232,9 +1232,22 @@ where let is_pvm = executable.is_pvm(); if_tracing(|tracer| { + // For DELEGATECALL, `from` is the contract making the delegatecall and + // `to` is the target contract whose code is being executed. + let (from, to) = match frame.delegate.as_ref() { + Some(delegate) => + (T::AddressMapper::to_address(&frame.account_id), delegate.callee), + None => ( + self.caller() + .account_id() + .map(T::AddressMapper::to_address) + .unwrap_or_default(), + T::AddressMapper::to_address(&frame.account_id), + ), + }; tracer.enter_child_span( - self.caller().account_id().map(T::AddressMapper::to_address).unwrap_or_default(), - T::AddressMapper::to_address(&frame.account_id), + from, + to, frame.delegate.as_ref().map(|delegate| delegate.callee), frame.read_only, frame.value_transferred,