Skip to content

Commit

Permalink
chore(eth/test): Added OEF spec for tests. Skip HighGasPrice (#261)
Browse files Browse the repository at this point in the history
  • Loading branch information
rakita authored Nov 12, 2022
1 parent f462f9d commit ec9e975
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 3 deletions.
3 changes: 3 additions & 0 deletions bins/revme/src/statetest/models/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ pub enum SpecName {
BerlinToLondonAt5, // done
London, // done
Merge, //done
#[serde(alias = "Merge+3540+3670")]
MergeEOF,
}

impl SpecName {
Expand All @@ -38,6 +40,7 @@ impl SpecName {
Self::Berlin => SpecId::BERLIN,
Self::London | Self::BerlinToLondonAt5 => SpecId::LONDON,
Self::Merge => SpecId::MERGE,
Self::MergeEOF => SpecId::MERGE_EOF,
Self::ByzantiumToConstantinopleAt5 | Self::Constantinople => {
panic!("Overriden with PETERSBURG")
} //_ => panic!("Conversion failed"),
Expand Down
9 changes: 8 additions & 1 deletion bins/revme/src/statetest/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ pub fn execute_test_suit(path: &Path, elapsed: &Arc<Mutex<Duration>>) -> Result<
return Ok(());
}

// Test check if gas price overflows, we handle this correctly but does not match tests specific exception.
if path.file_name() == Some(OsStr::new("HighGasPrice.json")) {
return Ok(());
}

// Skip test where basefee/accesslist/diffuculty is present but it shouldn't be supported in London/Berlin/TheMerge.
// https://github.com/ethereum/tests/blob/5b7e1ab3ffaf026d99d20b17bb30f533a2c80c8b/GeneralStateTests/stExample/eip1559.json#L130
// It is expected to not execute these tests.
Expand Down Expand Up @@ -170,7 +175,9 @@ pub fn execute_test_suit(path: &Path, elapsed: &Arc<Mutex<Duration>>) -> Result<
for (spec_name, tests) in unit.post {
if matches!(
spec_name,
SpecName::ByzantiumToConstantinopleAt5 | SpecName::Constantinople
SpecName::ByzantiumToConstantinopleAt5
| SpecName::Constantinople
| SpecName::MergeEOF
) {
continue;
}
Expand Down
1 change: 1 addition & 0 deletions crates/revm/src/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ pub fn evm_inner<'a, DB: Database, const INSPECT: bool>(
create_evm!(LondonSpec, db, env, insp)
}
SpecId::MERGE => create_evm!(MergeSpec, db, env, insp),
SpecId::MERGE_EOF => create_evm!(MergeSpec, db, env, insp),
SpecId::LATEST => create_evm!(LatestSpec, db, env, insp),
}
}
4 changes: 4 additions & 0 deletions crates/revm/src/instructions/opcode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,10 @@ pub const fn spec_opcode_gas(spec_id: SpecId) -> &'static [OpInfo; 256] {
gas_opcodee!(MERGE, SpecId::MERGE);
MERGE
}
SpecId::MERGE_EOF => {
gas_opcodee!(MERGE_EOF, SpecId::MERGE_EOF);
MERGE_EOF
}
SpecId::LATEST => {
gas_opcodee!(LATEST, SpecId::LATEST);
LATEST
Expand Down
8 changes: 6 additions & 2 deletions crates/revm/src/specification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ pub enum SpecId {
ARROW_GLACIER = 13, // Arrow Glacier 13773000
GRAY_GLACIER = 14, // Gray Glacier 15050000
MERGE = 15, // Paris/Merge TBD (Depends on difficulty)
LATEST = 16,
MERGE_EOF = 16, // Merge+EOF TBD
LATEST = 17,
}

impl SpecId {
Expand All @@ -36,7 +37,9 @@ impl SpecId {
}
BYZANTIUM | CONSTANTINOPLE | PETERSBURG => PrecompileId::BYZANTIUM,
ISTANBUL | MUIR_GLACIER => PrecompileId::ISTANBUL,
BERLIN | LONDON | ARROW_GLACIER | GRAY_GLACIER | MERGE | LATEST => PrecompileId::BERLIN,
BERLIN | LONDON | ARROW_GLACIER | GRAY_GLACIER | MERGE | MERGE_EOF | LATEST => {
PrecompileId::BERLIN
}
}
}

Expand All @@ -62,6 +65,7 @@ impl From<&str> for SpecId {
"Berlin" => SpecId::BERLIN,
"London" => SpecId::LONDON,
"Merge" => SpecId::MERGE,
"MergeEOF" => SpecId::MERGE_EOF,
_ => SpecId::LATEST,
}
}
Expand Down

0 comments on commit ec9e975

Please sign in to comment.