Skip to content

Commit ec9e975

Browse files
authored
chore(eth/test): Added OEF spec for tests. Skip HighGasPrice (#261)
1 parent f462f9d commit ec9e975

File tree

5 files changed

+22
-3
lines changed

5 files changed

+22
-3
lines changed

bins/revme/src/statetest/models/spec.rs

+3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ pub enum SpecName {
2121
BerlinToLondonAt5, // done
2222
London, // done
2323
Merge, //done
24+
#[serde(alias = "Merge+3540+3670")]
25+
MergeEOF,
2426
}
2527

2628
impl SpecName {
@@ -38,6 +40,7 @@ impl SpecName {
3840
Self::Berlin => SpecId::BERLIN,
3941
Self::London | Self::BerlinToLondonAt5 => SpecId::LONDON,
4042
Self::Merge => SpecId::MERGE,
43+
Self::MergeEOF => SpecId::MERGE_EOF,
4144
Self::ByzantiumToConstantinopleAt5 | Self::Constantinople => {
4245
panic!("Overriden with PETERSBURG")
4346
} //_ => panic!("Conversion failed"),

bins/revme/src/statetest/runner.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ pub fn execute_test_suit(path: &Path, elapsed: &Arc<Mutex<Duration>>) -> Result<
6565
return Ok(());
6666
}
6767

68+
// Test check if gas price overflows, we handle this correctly but does not match tests specific exception.
69+
if path.file_name() == Some(OsStr::new("HighGasPrice.json")) {
70+
return Ok(());
71+
}
72+
6873
// Skip test where basefee/accesslist/diffuculty is present but it shouldn't be supported in London/Berlin/TheMerge.
6974
// https://github.com/ethereum/tests/blob/5b7e1ab3ffaf026d99d20b17bb30f533a2c80c8b/GeneralStateTests/stExample/eip1559.json#L130
7075
// It is expected to not execute these tests.
@@ -170,7 +175,9 @@ pub fn execute_test_suit(path: &Path, elapsed: &Arc<Mutex<Duration>>) -> Result<
170175
for (spec_name, tests) in unit.post {
171176
if matches!(
172177
spec_name,
173-
SpecName::ByzantiumToConstantinopleAt5 | SpecName::Constantinople
178+
SpecName::ByzantiumToConstantinopleAt5
179+
| SpecName::Constantinople
180+
| SpecName::MergeEOF
174181
) {
175182
continue;
176183
}

crates/revm/src/evm.rs

+1
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ pub fn evm_inner<'a, DB: Database, const INSPECT: bool>(
168168
create_evm!(LondonSpec, db, env, insp)
169169
}
170170
SpecId::MERGE => create_evm!(MergeSpec, db, env, insp),
171+
SpecId::MERGE_EOF => create_evm!(MergeSpec, db, env, insp),
171172
SpecId::LATEST => create_evm!(LatestSpec, db, env, insp),
172173
}
173174
}

crates/revm/src/instructions/opcode.rs

+4
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,10 @@ pub const fn spec_opcode_gas(spec_id: SpecId) -> &'static [OpInfo; 256] {
620620
gas_opcodee!(MERGE, SpecId::MERGE);
621621
MERGE
622622
}
623+
SpecId::MERGE_EOF => {
624+
gas_opcodee!(MERGE_EOF, SpecId::MERGE_EOF);
625+
MERGE_EOF
626+
}
623627
SpecId::LATEST => {
624628
gas_opcodee!(LATEST, SpecId::LATEST);
625629
LATEST

crates/revm/src/specification.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ pub enum SpecId {
2525
ARROW_GLACIER = 13, // Arrow Glacier 13773000
2626
GRAY_GLACIER = 14, // Gray Glacier 15050000
2727
MERGE = 15, // Paris/Merge TBD (Depends on difficulty)
28-
LATEST = 16,
28+
MERGE_EOF = 16, // Merge+EOF TBD
29+
LATEST = 17,
2930
}
3031

3132
impl SpecId {
@@ -36,7 +37,9 @@ impl SpecId {
3637
}
3738
BYZANTIUM | CONSTANTINOPLE | PETERSBURG => PrecompileId::BYZANTIUM,
3839
ISTANBUL | MUIR_GLACIER => PrecompileId::ISTANBUL,
39-
BERLIN | LONDON | ARROW_GLACIER | GRAY_GLACIER | MERGE | LATEST => PrecompileId::BERLIN,
40+
BERLIN | LONDON | ARROW_GLACIER | GRAY_GLACIER | MERGE | MERGE_EOF | LATEST => {
41+
PrecompileId::BERLIN
42+
}
4043
}
4144
}
4245

@@ -62,6 +65,7 @@ impl From<&str> for SpecId {
6265
"Berlin" => SpecId::BERLIN,
6366
"London" => SpecId::LONDON,
6467
"Merge" => SpecId::MERGE,
68+
"MergeEOF" => SpecId::MERGE_EOF,
6569
_ => SpecId::LATEST,
6670
}
6771
}

0 commit comments

Comments
 (0)