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

feat(revme): add prague spec #1506

Merged
merged 1 commit into from
Jun 11, 2024
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
2 changes: 2 additions & 0 deletions bins/revme/src/cmd/statetest/models/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pub enum SpecName {
Merge,
Shanghai,
Cancun,
Prague,
#[serde(other)]
Unknown,
}
Expand All @@ -44,6 +45,7 @@ impl SpecName {
Self::Merge => SpecId::MERGE,
Self::Shanghai => SpecId::SHANGHAI,
Self::Cancun => SpecId::CANCUN,
Self::Prague => SpecId::PRAGUE,
Self::ByzantiumToConstantinopleAt5 | Self::Constantinople => {
panic!("Overridden with PETERSBURG")
}
Expand Down
15 changes: 11 additions & 4 deletions bins/revme/src/cmd/statetest/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use revm::{
inspector_handle_register,
inspectors::TracerEip3155,
primitives::{
calc_excess_blob_gas, keccak256, Bytecode, Bytes, EVMResultGeneric, Env, ExecutionResult,
SpecId, TransactTo, B256, U256,
calc_excess_blob_gas, keccak256, Bytecode, Bytes, EVMResultGeneric, Env, Eof,
ExecutionResult, SpecId, TransactTo, B256, EOF_MAGIC_BYTES, U256,
},
Evm, State,
};
Expand Down Expand Up @@ -257,10 +257,17 @@ pub fn execute_test_suite(
// Create database and insert cache
let mut cache_state = revm::CacheState::new(false);
for (address, info) in unit.pre {
let code_hash = keccak256(&info.code);
let bytecode = match info.code.get(..2) {
Some(magic) if magic == &EOF_MAGIC_BYTES => {
Bytecode::Eof(Eof::decode(info.code.clone()).unwrap())
}
_ => Bytecode::new_raw(info.code),
};
let acc_info = revm::primitives::AccountInfo {
balance: info.balance,
code_hash: keccak256(&info.code),
code: Some(Bytecode::new_raw(info.code)),
code_hash,
code: Some(bytecode),
nonce: info.nonce,
};
cache_state.insert_account_with_storage(address, acc_info, info.storage);
Expand Down
Loading