Skip to content

Commit c66d736

Browse files
committed
fix delegatecall callTracer addresses
1 parent 2eb4350 commit c66d736

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

substrate/frame/revive/src/exec.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,9 +1232,22 @@ where
12321232
let is_pvm = executable.is_pvm();
12331233

12341234
if_tracing(|tracer| {
1235+
// For DELEGATECALL, `from` is the contract making the delegatecall and
1236+
// `to` is the target contract whose code is being executed.
1237+
let (from, to) = match frame.delegate.as_ref() {
1238+
Some(delegate) =>
1239+
(T::AddressMapper::to_address(&frame.account_id), delegate.callee),
1240+
None => (
1241+
self.caller()
1242+
.account_id()
1243+
.map(T::AddressMapper::to_address)
1244+
.unwrap_or_default(),
1245+
T::AddressMapper::to_address(&frame.account_id),
1246+
),
1247+
};
12351248
tracer.enter_child_span(
1236-
self.caller().account_id().map(T::AddressMapper::to_address).unwrap_or_default(),
1237-
T::AddressMapper::to_address(&frame.account_id),
1249+
from,
1250+
to,
12381251
frame.delegate.as_ref().map(|delegate| delegate.callee),
12391252
frame.read_only,
12401253
frame.value_transferred,

0 commit comments

Comments
 (0)