Skip to content

Commit

Permalink
fix(katana): add missing contract address in CallInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
kariy committed Mar 25, 2024
1 parent 4e855a5 commit 7fff40c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@ fn to_call_info(call_info: CallInfo) -> katana_primitives::trace::CallInfo {
};

katana_primitives::trace::CallInfo {
contract_address: to_address(call_info.call.storage_address),
caller_address: to_address(call_info.call.caller_address),
call_type: match call_info.call.call_type {
CallType::Call => katana_primitives::trace::CallType::Call,
Expand Down
1 change: 1 addition & 0 deletions crates/katana/executor/src/implementation/sir/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,7 @@ fn from_sir_call_info(call_info: CallInfo) -> katana_primitives::trace::CallInfo
};

katana_primitives::trace::CallInfo {
contract_address: to_address(&call_info.contract_address),
caller_address: to_address(&call_info.caller_address),
call_type: match call_info.call_type {
Some(CallType::Call) => katana_primitives::trace::CallType::Call,
Expand Down
2 changes: 2 additions & 0 deletions crates/katana/primitives/src/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ pub struct CallInfo {
pub caller_address: ContractAddress,
/// The call type.
pub call_type: CallType,
/// The contract address.
pub contract_address: ContractAddress,
/// The address where the code is being executed.
/// Optional, since there is no address to the code implementation in a delegate call.
pub code_address: Option<ContractAddress>,
Expand Down
6 changes: 2 additions & 4 deletions crates/katana/rpc/rpc-types/src/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ impl From<CallInfo> for FunctionInvocation {
order: m.order,
payload: m.payload,
to_address: m.to_address,
// TODO: fix missing storage address in `TxExecInfo`
from_address: Default::default(),
from_address: m.from_address.into(),
})
.collect();

Expand Down Expand Up @@ -65,9 +64,8 @@ impl From<CallInfo> for FunctionInvocation {
execution_resources,
result: info.retdata,
calldata: info.calldata,
// TODO: fix missing storage address in `CallInfo`
contract_address: Default::default(),
caller_address: info.caller_address.into(),
contract_address: info.contract_address.into(),
entry_point_selector: info.entry_point_selector,
// See <https://github.com/starkware-libs/blockifier/blob/cb464f5ac2ada88f2844d9f7d62bd6732ceb5b2c/crates/blockifier/src/execution/call_info.rs#L220>
class_hash: info.class_hash.expect("Class hash mut be set after execution"),
Expand Down

0 comments on commit 7fff40c

Please sign in to comment.