Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/interpreter/src/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ impl Interpreter {
bytecode,
None,
crate::primitives::Address::default(),
None,
crate::primitives::Address::default(),
U256::ZERO,
),
Expand Down
11 changes: 11 additions & 0 deletions crates/interpreter/src/interpreter/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ pub struct Contract {
pub hash: Option<B256>,
/// Target address of the account. Storage of this address is going to be modified.
pub target_address: Address,
/// Address of the account the bytecode was loaded from. This can be different from target_address
/// in the case of DELEGATECALL or CALLCODE
pub bytecode_address: Option<Address>,
/// Caller of the EVM.
pub caller: Address,
/// Value send to contract from transaction or from CALL opcodes.
Expand All @@ -33,6 +36,7 @@ impl Contract {
bytecode: Bytecode,
hash: Option<B256>,
target_address: Address,
bytecode_address: Option<Address>,
caller: Address,
call_value: U256,
) -> Self {
Expand All @@ -43,6 +47,7 @@ impl Contract {
bytecode,
hash,
target_address,
bytecode_address,
caller,
call_value,
}
Expand All @@ -55,11 +60,16 @@ impl Contract {
TxKind::Call(caller) => caller,
TxKind::Create => Address::ZERO,
};
let bytecode_address = match env.tx.transact_to {
TxKind::Call(caller) => Some(caller),
TxKind::Create => None,
};
Self::new(
env.tx.data.clone(),
bytecode,
hash,
contract_address,
bytecode_address,
env.tx.caller,
env.tx.value,
)
Expand All @@ -78,6 +88,7 @@ impl Contract {
bytecode,
hash,
call_context.target_address,
Some(call_context.bytecode_address),
call_context.caller,
call_context.call_value(),
)
Expand Down
2 changes: 2 additions & 0 deletions crates/revm/src/context/inner_evm_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ impl<DB: Database> InnerEvmContext<DB> {
Bytecode::Eof(Arc::new(initcode.clone())),
None,
created_address,
None,
inputs.caller,
inputs.value,
);
Expand Down Expand Up @@ -477,6 +478,7 @@ impl<DB: Database> InnerEvmContext<DB> {
bytecode,
Some(init_code_hash),
created_address,
None,
inputs.caller,
inputs.value,
);
Expand Down