Skip to content
This repository was archived by the owner on Jul 5, 2024. It is now read-only.
Closed
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
5 changes: 5 additions & 0 deletions bus-mapping/src/circuit_input_builder/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ impl Call {
pub fn is_create(&self) -> bool {
self.kind.is_create()
}

/// This call is call with op DELEGATECALL
pub fn is_delegatecall(&self) -> bool {
matches!(self.kind, CallKind::DelegateCall)
}
}

/// Context of a [`Call`].
Expand Down
2 changes: 1 addition & 1 deletion bus-mapping/src/circuit_input_builder/input_state_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ impl<'a> CircuitInputStateRef<'a> {
step.stack.nth_last(2)?,
),
CallKind::CallCode => (caller.address, caller.address, step.stack.nth_last(2)?),
CallKind::DelegateCall => (caller.caller_address, caller.address, Word::zero()),
CallKind::DelegateCall => (caller.caller_address, caller.address, caller.value),
CallKind::StaticCall => (
caller.address,
step.stack.nth_last(1)?.to_address(),
Expand Down
2 changes: 1 addition & 1 deletion bus-mapping/src/evm/opcodes/callop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ impl<const N_ARGS: usize> Opcode for CallOpcode<N_ARGS> {
.max()
.unwrap();

let has_value = !call.value.is_zero();
let has_value = !call.value.is_zero() && !call.is_delegatecall();
let memory_expansion_gas_cost =
memory_expansion_gas_cost(curr_memory_word_size, next_memory_word_size);
let gas_cost = if is_warm {
Expand Down