Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion crates/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub use constants::*;
pub use eip7702::{
Authorization, AuthorizationList, Eip7702Bytecode, Eip7702DecodeError, PrimitiveSignature,
RecoveredAuthority, RecoveredAuthorization, SignedAuthorization, EIP7702_MAGIC,
EIP7702_MAGIC_BYTES, EIP7702_MAGIC_HASH,
EIP7702_MAGIC_BYTES, EIP7702_MAGIC_HASH, EIP7702_VERSION,
};
pub use env::*;

Expand Down
13 changes: 10 additions & 3 deletions crates/revm/src/context/inner_evm_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ use crate::{
AccessListItem, Account, Address, AnalysisKind, Bytecode, Bytes, CfgEnv, EVMError, Env,
Eof, HashSet, Spec,
SpecId::{self, *},
B256, EIP7702_MAGIC_BYTES, EIP7702_MAGIC_HASH, EOF_MAGIC_BYTES, EOF_MAGIC_HASH, U256,
B256, EIP7702_MAGIC_BYTES, EIP7702_MAGIC_HASH, EIP7702_VERSION, EOF_MAGIC_BYTES,
EOF_MAGIC_HASH, U256,
},
JournalCheckpoint,
};
use std::{boxed::Box, sync::Arc};
use std::{boxed::Box, sync::Arc, vec::Vec};

/// EVM contexts contains data that EVM needs for execution.
#[derive(Debug)]
Expand Down Expand Up @@ -183,7 +184,13 @@ impl<DB: Database> InnerEvmContext<DB> {
let code = if code.is_eof() {
EOF_MAGIC_BYTES.clone()
} else if code.is_eip7702() {
EIP7702_MAGIC_BYTES.clone()
// Reserve 23 bytes for EIP7702_MAGIC_BYTES (2 bytes) + EIP7702_VERSION (1 byte)
// + address (20 bytes)
let mut bytes = Vec::with_capacity(23);
bytes.extend_from_slice(&EIP7702_MAGIC_BYTES);
bytes.push(EIP7702_VERSION);
bytes.extend_from_slice(address.as_slice());
bytes.into()
} else {
code.original_bytes()
};
Expand Down
Loading