Skip to content

Commit

Permalink
Osaka Activation
Browse files Browse the repository at this point in the history
Accept Osaka in unit tests and eof validation tests.
  • Loading branch information
shemnon committed Oct 24, 2024
1 parent 51d50f6 commit a1ce5c2
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 18 deletions.
7 changes: 4 additions & 3 deletions bins/revme/src/cmd/eofvalidation.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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
);
Expand Down
9 changes: 1 addition & 8 deletions bins/revme/src/cmd/eofvalidation/test_suite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,7 @@ pub struct TestUnit {
pub struct TestVector {
pub code: Bytes,
pub container_kind: Option<String>,
pub results: PragueTestResult,
}

#[derive(Debug, PartialEq, Eq, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct PragueTestResult {
#[serde(rename = "Prague")]
pub prague: TestResult,
pub results: BTreeMap<String, TestResult>,
}

#[derive(Debug, PartialEq, Eq, Deserialize)]
Expand Down
8 changes: 2 additions & 6 deletions bins/revme/src/cmd/statetest/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions crates/revm/src/context/evm_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@ where
address: &Address,
input_data: &Bytes,
gas: Gas,
is_ext_delegate: bool,
) -> EVMResultGeneric<Option<InterpreterResult>, EvmWiringT> {
if is_ext_delegate {
return Ok(None);
}
let Some(outcome) =
self.precompiles
.call(address, input_data, gas.limit(), &mut self.inner)
Expand Down
2 changes: 1 addition & 1 deletion crates/statetest-types/src/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
}
}
Expand Down

0 comments on commit a1ce5c2

Please sign in to comment.