From a1ce5c278515d93943c95f99f920ee628357b68e Mon Sep 17 00:00:00 2001 From: Danno Ferrin Date: Wed, 23 Oct 2024 14:40:28 -0600 Subject: [PATCH] Osaka Activation Accept Osaka in unit tests and eof validation tests. --- bins/revme/src/cmd/eofvalidation.rs | 7 ++++--- bins/revme/src/cmd/eofvalidation/test_suite.rs | 9 +-------- bins/revme/src/cmd/statetest/runner.rs | 8 ++------ crates/revm/src/context/evm_context.rs | 4 ++++ crates/statetest-types/src/spec.rs | 2 +- 5 files changed, 12 insertions(+), 18 deletions(-) diff --git a/bins/revme/src/cmd/eofvalidation.rs b/bins/revme/src/cmd/eofvalidation.rs index 40d0696225..47f9802f6d 100644 --- a/bins/revme/src/cmd/eofvalidation.rs +++ b/bins/revme/src/cmd/eofvalidation.rs @@ -1,6 +1,6 @@ mod test_suite; -pub use test_suite::{PragueTestResult, TestResult, TestSuite, TestUnit, TestVector}; +pub use test_suite::{TestResult, TestSuite, TestUnit, TestVector}; use crate::{cmd::Error, dir_utils::find_all_json_tests}; use clap::Parser; @@ -81,13 +81,14 @@ pub fn run_test(path: &Path) -> Result<(), Error> { } else { Some(CodeType::ReturnOrStop) }; + let test_result = test_vector.results.get("Osaka"); let res = validate_raw_eof_inner(test_vector.code.clone(), kind); - if res.is_ok() != test_vector.results.prague.result { + if test_result.map(|r| r.result).unwrap_or(res.is_ok()) != res.is_ok() { println!( "\nTest failed: {} - {}\nresult:{:?}\nrevm err_result:{:#?}\nbytes:{:?}\n", name, vector_name, - test_vector.results.prague, + test_result.unwrap().result, res.as_ref().err(), test_vector.code ); diff --git a/bins/revme/src/cmd/eofvalidation/test_suite.rs b/bins/revme/src/cmd/eofvalidation/test_suite.rs index 4fbb8fe676..de76123a37 100644 --- a/bins/revme/src/cmd/eofvalidation/test_suite.rs +++ b/bins/revme/src/cmd/eofvalidation/test_suite.rs @@ -19,14 +19,7 @@ pub struct TestUnit { pub struct TestVector { pub code: Bytes, pub container_kind: Option, - pub results: PragueTestResult, -} - -#[derive(Debug, PartialEq, Eq, Deserialize)] -#[serde(deny_unknown_fields)] -pub struct PragueTestResult { - #[serde(rename = "Prague")] - pub prague: TestResult, + pub results: BTreeMap, } #[derive(Debug, PartialEq, Eq, Deserialize)] diff --git a/bins/revme/src/cmd/statetest/runner.rs b/bins/revme/src/cmd/statetest/runner.rs index 9dc709ac41..cefdc6d700 100644 --- a/bins/revme/src/cmd/statetest/runner.rs +++ b/bins/revme/src/cmd/statetest/runner.rs @@ -343,16 +343,12 @@ pub fn execute_test_suite( // Constantinople was immediately extended by Petersburg. // There isn't any production Constantinople transaction // so we don't support it and skip right to Petersburg. - if spec_name == SpecName::Constantinople || spec_name == SpecName::Osaka { + if spec_name == SpecName::Constantinople { continue; } // Enable EOF in Prague tests. - let spec_id = if spec_name == SpecName::Prague { - SpecId::PRAGUE_EOF - } else { - spec_name.to_spec_id() - }; + let spec_id = spec_name.to_spec_id(); if spec_id.is_enabled_in(SpecId::MERGE) && env.block.prevrandao.is_none() { // if spec is merge and prevrandao is not set, set it to default diff --git a/crates/revm/src/context/evm_context.rs b/crates/revm/src/context/evm_context.rs index ce60aa07e7..19030dc017 100644 --- a/crates/revm/src/context/evm_context.rs +++ b/crates/revm/src/context/evm_context.rs @@ -101,7 +101,11 @@ where address: &Address, input_data: &Bytes, gas: Gas, + is_ext_delegate: bool, ) -> EVMResultGeneric, EvmWiringT> { + if is_ext_delegate { + return Ok(None); + } let Some(outcome) = self.precompiles .call(address, input_data, gas.limit(), &mut self.inner) diff --git a/crates/statetest-types/src/spec.rs b/crates/statetest-types/src/spec.rs index fd24c54167..dff9c09b8f 100644 --- a/crates/statetest-types/src/spec.rs +++ b/crates/statetest-types/src/spec.rs @@ -50,10 +50,10 @@ impl SpecName { Self::Shanghai => SpecId::SHANGHAI, Self::Cancun => SpecId::CANCUN, Self::Prague => SpecId::PRAGUE, + Self::Osaka => SpecId::OSAKA, Self::ByzantiumToConstantinopleAt5 | Self::Constantinople => { panic!("Overridden with PETERSBURG") } - Self::Osaka => panic!("Osaka is not implemented"), Self::Unknown => panic!("Unknown spec"), } }