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

Activate Osaka Fork #1838

Closed
wants to merge 2 commits into from
Closed
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 1 addition & 5 deletions .github/workflows/ethereum-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,10 @@ jobs:
ethtests/EIPTests/StateTests/stEIP1153-transientStorage/ \
ethtests/EIPTests/StateTests/stEIP4844-blobtransactions/ \
ethtests/EIPTests/StateTests/stEIP2537/ \
ethtests/EIPTests/StateTests/stEOF \
tests/eof_suite/eest/state_tests \
tests/eof_suite/evmone/state_tests \
tests/prague_suite/state_tests
- name: Run EOF validation tests
run: |
cross run --target ${{matrix.target}} --profile ${{ matrix.profile }} -p revme -- eof-validation \
ethtests/EOFTests \
tests/eof_suite/eest/eof_tests/prague \
tests/eof_suite/evmone/eof_tests
tests/eof_suite/eest/eof_tests/osaka

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
19 changes: 2 additions & 17 deletions bins/revme/src/cmd/statetest/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,6 @@ fn skip_test(path: &Path) -> bool {
| "static_Call50000_sha256.json"
| "loopMul.json"
| "CALLBlake2f_MaxRounds.json"

// evmone statetest
| "initcode_transaction_before_prague.json"
| "invalid_tx_non_existing_sender.json"
| "tx_non_existing_sender.json"
| "block_apply_withdrawal.json"
| "block_apply_ommers_reward.json"
| "known_block_hash.json"
| "eip7516_blob_base_fee.json"
| "create_tx_collision_storage.json"
| "create_collision_storage.json"
)
}

Expand Down Expand Up @@ -343,16 +332,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
17 changes: 13 additions & 4 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 Expand Up @@ -199,7 +203,14 @@ where
_ => {}
};

if let Some(result) = self.call_precompile(&inputs.bytecode_address, &inputs.input, gas)? {
let is_ext_delegate = inputs.scheme.is_ext_delegate_call();

if let Some(result) = self.call_precompile(
&inputs.bytecode_address,
&inputs.input,
gas,
is_ext_delegate,
)? {
if matches!(result.result, return_ok!()) {
self.journaled_state.checkpoint_commit();
} else {
Expand All @@ -220,9 +231,7 @@ where
let mut bytecode = account.info.code.clone().unwrap_or_default();

// ExtDelegateCall is not allowed to call non-EOF contracts.
if inputs.scheme.is_ext_delegate_call()
&& !bytecode.bytes_slice().starts_with(&EOF_MAGIC_BYTES)
{
if is_ext_delegate && !bytecode.bytes_slice().starts_with(&EOF_MAGIC_BYTES) {
return return_result(InstructionResult::InvalidExtDelegateCallTarget);
}

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
Loading
Loading