Skip to content

Commit

Permalink
feat(EOF): Run EOF tests from eth/tests (#1690)
Browse files Browse the repository at this point in the history
  • Loading branch information
rakita authored Aug 8, 2024
1 parent 32aeae4 commit 8267ad5
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ethereum-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,14 @@ 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
29 changes: 29 additions & 0 deletions bins/revme/src/cmd/eofvalidation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,32 @@ impl Cmd {
}
}

fn skip_test(name: &str) -> bool {
// embedded containers rules changed
if name.starts_with("EOF1_embedded_container") {
return true;
}
matches!(
name,
"EOF1_undefined_opcodes_186"
| ""
// truncated data is only allowed in embedded containers
| "validInvalid_48"
| "validInvalid_1"
| "EOF1_truncated_section_3"
| "EOF1_truncated_section_4"
| "validInvalid_2"
| "validInvalid_3"
// Orphan containers are no longer allowed
| "EOF1_returncontract_valid_0"
| "EOF1_returncontract_valid_1"
| "EOF1_returncontract_valid_2"
| "EOF1_eofcreate_valid_1"
| "EOF1_eofcreate_valid_2"
| "EOF1_section_order_6"
)
}

pub fn run_test(path: &Path) -> Result<(), Error> {
let test_files = find_all_json_tests(path);
let mut test_sum = 0;
Expand All @@ -46,6 +72,9 @@ pub fn run_test(path: &Path) -> Result<(), Error> {
let suite: TestSuite = serde_json::from_str(&s).unwrap();
for (name, test_unit) in suite.0 {
for (vector_name, test_vector) in test_unit.vectors {
if skip_test(&vector_name) {
continue;
}
test_sum += 1;
let kind = if test_vector.container_kind.is_some() {
Some(CodeType::ReturnContract)
Expand Down
3 changes: 1 addition & 2 deletions bins/revme/src/cmd/statetest/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ pub fn find_all_json_tests(path: &Path) -> Vec<PathBuf> {
}

fn skip_test(path: &Path) -> bool {
let path_str = path.to_str().expect("Path is not valid UTF-8");
let name = path.file_name().unwrap().to_str().unwrap();

matches!(
Expand Down Expand Up @@ -133,7 +132,7 @@ fn skip_test(path: &Path) -> bool {
| "block_apply_ommers_reward.json"
| "known_block_hash.json"
| "eip7516_blob_base_fee.json"
) || path_str.contains("stEOF")
)
}

fn check_evm_execution<EXT>(
Expand Down

0 comments on commit 8267ad5

Please sign in to comment.