Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(eip7702): set delegated code on call #1706

Merged
merged 1 commit into from
Aug 15, 2024
Merged
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
13 changes: 12 additions & 1 deletion crates/revm/src/context/evm_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ impl<DB: Database> EvmContext<DB> {
.load_code(inputs.bytecode_address, &mut self.inner.db)?;

let code_hash = account.info.code_hash();
let bytecode = account.info.code.clone().unwrap_or_default();
let mut bytecode = account.info.code.clone().unwrap_or_default();

// ExtDelegateCall is not allowed to call non-EOF contracts.
if inputs.scheme.is_ext_delegate_call()
Expand All @@ -236,6 +236,17 @@ impl<DB: Database> EvmContext<DB> {
return return_result(InstructionResult::Stop);
}

if let Bytecode::Eip7702s(eip7702_bytecode) = bytecode {
bytecode = self
.inner
.journaled_state
.load_code(eip7702_bytecode.delegated_address, &mut self.inner.db)?
.info
.code
.clone()
.unwrap_or_default();
}

let contract =
Contract::new_with_context(inputs.input.clone(), bytecode, Some(code_hash), inputs);
// Create interpreter and executes call and push new CallStackFrame.
Expand Down