Skip to content

Commit

Permalink
Merge branch 'feat/evm-tests' into fix/eip-4844
Browse files Browse the repository at this point in the history
  • Loading branch information
mrLSD committed Jun 3, 2024
2 parents bc21670 + 9deee5f commit 23c1c4f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 28 deletions.
6 changes: 3 additions & 3 deletions evm-tests/jsontests/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ const SKIPPED_CASES: &[&str] = &[
"stTransactionTest/ValueOverflow",
"stTransactionTest/ValueOverflowParis",
// These tests are passing, but they take a lot of time to execute so can going to skip them.
"stTimeConsuming/static_Call50000_sha256",
"vmPerformance/loopMul",
"stTimeConsuming/CALLBlake2f_MaxRounds",
// "stTimeConsuming/static_Call50000_sha256",
// "vmPerformance/loopMul",
// "stTimeConsuming/CALLBlake2f_MaxRounds",
];

/// Check is path should be skip.
Expand Down
40 changes: 16 additions & 24 deletions evm-tests/jsontests/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,7 @@ impl Test {
} else {
None
};

#[allow(clippy::map_clone)]
let blob_hashes = tx.blob_versioned_hashes.iter().map(|v| *v).collect();
let blob_hashes = tx.blob_versioned_hashes.clone();

Ok(MemoryVicinity {
gas_price,
Expand Down Expand Up @@ -518,14 +516,14 @@ fn check_validate_exit_reason(
|| exception == "TransactionException.INSUFFICIENT_MAX_FEE_PER_BLOB_GAS";
assert!(
check_result,
"unexpected exception {exception:?} for OutOfFund for test: {name}"
"unexpected exception {exception:?} for OutOfFund for test: {name}"
);
}
InvalidTxReason::GasLimitReached => {
let check_result = exception == "TR_GasLimitReached";
assert!(
check_result,
"unexpected exception {exception:?} for GasLimitReached for test: {name}"
"unexpected exception {exception:?} for GasLimitReached for test: {name}"
);
}
InvalidTxReason::IntrinsicGas => {
Expand All @@ -536,7 +534,7 @@ fn check_validate_exit_reason(
|| exception == "TR_TypeNotSupported";
assert!(
check_result,
"unexpected exception {exception:?} for IntrinsicGas for test: {name}"
"unexpected exception {exception:?} for IntrinsicGas for test: {name}"
);
}
InvalidTxReason::BlobVersionNotSupported => {
Expand All @@ -545,53 +543,53 @@ fn check_validate_exit_reason(
|| exception == "TR_BLOBVERSION_INVALID";
assert!(
check_result,
"unexpected exception {exception:?} for BlobVersionNotSupported for test: {name}"
"unexpected exception {exception:?} for BlobVersionNotSupported for test: {name}"
);
}
InvalidTxReason::BlobCreateTransaction => {
let check_result = exception == "TR_BLOBCREATE";
assert!(
check_result,
"unexpected exception {exception:?} for BlobCreateTransaction for test: {name}"
"unexpected exception {exception:?} for BlobCreateTransaction for test: {name}"
);
}
InvalidTxReason::BlobGasPriceGreaterThanMax => {
let check_result =
exception == "TransactionException.INSUFFICIENT_MAX_FEE_PER_BLOB_GAS";
assert!(
check_result,
"unexpected exception {exception:?} for BlobGasPriceGreaterThanMax for test: {name}"
"unexpected exception {exception:?} for BlobGasPriceGreaterThanMax for test: {name}"
);
}
InvalidTxReason::TooManyBlobs => {
let check_result = exception == "TR_BLOBLIST_OVERSIZE"
|| exception == "TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED";
assert!(
check_result,
"unexpected exception {exception:?} for TooManyBlobs for test: {name}"
"unexpected exception {exception:?} for TooManyBlobs for test: {name}"
);
}
InvalidTxReason::EmptyBlobs => {
let check_result = exception == "TransactionException.TYPE_3_TX_ZERO_BLOBS"
|| exception == "TR_EMPTYBLOB";
assert!(
check_result,
"unexpected exception {exception:?} for EmptyBlobs for test: {name}"
"unexpected exception {exception:?} for EmptyBlobs for test: {name}"
);
}
InvalidTxReason::MaxFeePerBlobGasNotSupported => {
let check_result =
exception == "TransactionException.TYPE_3_TX_PRE_FORK|TransactionException.TYPE_3_TX_ZERO_BLOBS";
assert!(
check_result,
"unexpected exception {exception:?} for MaxFeePerBlobGasNotSupported for test: {name}"
"unexpected exception {exception:?} for MaxFeePerBlobGasNotSupported for test: {name}"
);
}
InvalidTxReason::BlobVersionedHashesNotSupported => {
let check_result = exception == "TransactionException.TYPE_3_TX_PRE_FORK";
assert!(
check_result,
"unexpected exception {exception:?} for BlobVersionedHashesNotSupported for test: {name}"
"unexpected exception {exception:?} for BlobVersionedHashesNotSupported for test: {name}"
);
}
_ => {
Expand All @@ -615,9 +613,6 @@ fn test_run(
let mut tests_result = TestExecutionResult::new();
let test_tx = &test.0.transaction;
for (spec, states) in &test.0.post_states {
// if name != "create2collisionSelfdestructedOOG" {
// continue;
// }
// Run tests for specific SPEC (Hard fork)
if let Some(s) = specific_spec.as_ref() {
if s != spec {
Expand Down Expand Up @@ -690,7 +685,7 @@ fn test_run(
});

if verbose_output.verbose_failed {
println!(" [{spec:?}] {name}: {tx_err:?} ... validation failed\t<----");
println!(" [{spec:?}] {name}: {tx_err:?} ... validation failed\t<----");
}
tests_result.failed += 1;
}
Expand Down Expand Up @@ -819,7 +814,6 @@ fn test_run(
}
}
} else {
// TODOFEE
assert_empty_create_caller(&state.expect_exception, name);
}

Expand Down Expand Up @@ -858,12 +852,10 @@ fn test_run(

backend.apply(values, logs, delete_empty);
} else {
// TODOFEE
if let Some(_e) = state.expect_exception.as_ref() {
// println!("==> expect_exception: {e}");
} else {
panic!("{name}-{i}")
if let Some(e) = state.expect_exception.as_ref() {
panic!("unexpected exception: {e} for test {name}-{i}");
}
panic!("unexpected validation for test {name}-{i}")
}
let (is_valid_hash, actual_hash) =
crate::utils::assert_valid_hash(&state.hash.0, backend.state());
Expand All @@ -880,7 +872,7 @@ fn test_run(
tests_result.failed += 1;

if verbose_output.verbose_failed {
println!(" [{:?}] {}:{} ... failed\t<----", spec, name, i);
println!(" [{spec:?}] {name}:{i} ... failed\t<----");
}
if verbose_output.print_state {
// Print detailed state data
Expand Down
1 change: 0 additions & 1 deletion evm-tests/jsontests/tests/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ const SKIPPED_CASES: &[&str] = &[
];

fn should_skip(path: &Path) -> bool {
println!("{path:?}");
let matches = |case: &str| {
let file_stem = path.file_stem().unwrap();
let dir_path = path.parent().unwrap();
Expand Down

0 comments on commit 23c1c4f

Please sign in to comment.