Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
eof magic bytes from array
  • Loading branch information
rakita committed Jun 10, 2024
commit f3e69bc2dca301029a4e2bc6cf3f437c8ffae1ef
2 changes: 1 addition & 1 deletion crates/primitives/src/bytecode.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub mod eof;
pub mod legacy;

pub use eof::{Eof, EOF_MAGIC, EOF_MAGIC_ARRAY, EOF_MAGIC_HASH};
pub use eof::{Eof, EOF_MAGIC, EOF_MAGIC_BYTES, EOF_MAGIC_HASH};
pub use legacy::{JumpTable, LegacyAnalyzedBytecode};

use crate::{keccak256, Bytes, B256, KECCAK_EMPTY};
Expand Down
4 changes: 2 additions & 2 deletions crates/primitives/src/bytecode/eof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub use body::EofBody;
pub use header::EofHeader;
pub use types_section::TypesSection;

use crate::{b256, Bytes, B256};
use crate::{b256, bytes, Bytes, B256};
use core::cmp::min;
use std::{vec, vec::Vec};

Expand All @@ -19,7 +19,7 @@ pub const EOF_MAGIC_HASH: B256 =
pub const EOF_MAGIC: u16 = 0xEF00;

/// EOF magic number in array form.
pub const EOF_MAGIC_ARRAY: [u8; 2] = EOF_MAGIC.to_be_bytes();
pub const EOF_MAGIC_BYTES: Bytes = bytes!("ef00");

/// EOF - Ethereum Object Format.
///
Expand Down
4 changes: 2 additions & 2 deletions crates/revm/src/context/inner_evm_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::{
keccak256, Account, Address, AnalysisKind, Bytecode, Bytes, CreateScheme, EVMError, Env,
Eof, HashSet, Spec,
SpecId::{self, *},
B256, EOF_MAGIC_ARRAY, EOF_MAGIC_HASH, U256,
B256, EOF_MAGIC_BYTES, EOF_MAGIC_HASH, U256,
},
FrameOrResult, JournalCheckpoint, CALL_STACK_LIMIT,
};
Expand Down Expand Up @@ -171,7 +171,7 @@ impl<DB: Database> InnerEvmContext<DB> {
// SAFETY: safe to unwrap as load_code will insert code if it is empty.
let code = a.info.code.as_ref().unwrap();
if code.is_eof() {
(EOF_MAGIC_ARRAY.into(), is_cold)
(EOF_MAGIC_BYTES.clone(), is_cold)
} else {
(code.original_bytes().clone(), is_cold)
}
Expand Down