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

Ethereum tests failures when upgrading from revm 9 to 14 #1803

Open
ufoscout opened this issue Sep 25, 2024 · 3 comments
Open

Ethereum tests failures when upgrading from revm 9 to 14 #1803

ufoscout opened this issue Sep 25, 2024 · 3 comments

Comments

@ufoscout
Copy link
Contributor

When upgrading our project from revm 9 to 14, the following tests from the Ethereum suite fail with invalid state root:

ethereum_tests/12.2/BlockchainTests/GeneralStateTests/stRevertTest/RevertPrefoundEmptyCallOOG.json
ethereum_tests/12.2/BlockchainTests/GeneralStateTests/stRevertTest/RevertPrefoundEmptyOOG.json
ethereum_tests/12.2/BlockchainTests/GeneralStateTests/stRevertTest/TouchToEmptyAccountRevert.json
ethereum_tests/12.2/BlockchainTests/GeneralStateTests/stSStoreTest/InitCollision.json
ethereum_tests/12.2/BlockchainTests/GeneralStateTests/stStaticCall/static_call_OOG_additionalGasCosts2.json
ethereum_tests/12.2/BlockchainTests/GeneralStateTests/stZeroCallsRevert/ZeroValue_CALLCODE_ToEmpty_OOGRevert.json
ethereum_tests/12.2/BlockchainTests/GeneralStateTests/stZeroCallsRevert/ZeroValue_CALLCODE_ToOneStorageKey_OOGRevert.json
ethereum_tests/12.2/BlockchainTests/GeneralStateTests/stZeroCallsRevert/ZeroValue_CALL_ToEmpty_OOGRevert.json
ethereum_tests/12.2/BlockchainTests/GeneralStateTests/stZeroCallsRevert/ZeroValue_CALL_ToOneStorageKey_OOGRevert.json
ethereum_tests/12.2/BlockchainTests/GeneralStateTests/stZeroCallsRevert/ZeroValue_DELEGATECALL_ToEmpty_OOGRevert.json
ethereum_tests/12.2/BlockchainTests/GeneralStateTests/stZeroCallsRevert/ZeroValue_DELEGATECALL_ToOneStorageKey_OOGRevert.json
ethereum_tests/12.2/BlockchainTests/GeneralStateTests/stZeroCallsRevert/ZeroValue_SUICIDE_ToEmpty_OOGRevert.json
ethereum_tests/12.2/BlockchainTests/GeneralStateTests/stZeroCallsRevert/ZeroValue_SUICIDE_ToOneStorageKey_OOGRevert.json

This is the function that executes the transactions:

pub(crate) fn transact_commit_with_inspect<DB>(
    env: Env,
    db: DB,
) -> ExecutionResult
where
    DB: Database + DatabaseCommit,
{
    let mut evm = revm::Evm::builder()
        .with_db(db)
        .with_env_with_handler_cfg(EnvWithHandlerCfg::new_with_spec_id(
            env.into(),
            FORK_SPEC_ID, // Paris fork
        ))
        .append_handler_register(revm::inspector_handle_register)
        .build();

    evm.transact_commit().unwrap() // error handling omitted
}

revm dependency is declared as:

# Using "9.0" works as expected
revm = { version = "14.0", default-features = false, features = [
    "optional_eip3607",
    "serde",
] }

Would you happen to have any clue? Is there anything we should look into? It seems that all failing tests are somehow related to a tx revert

@mattsse
Copy link
Collaborator

mattsse commented Sep 25, 2024

could be a feature thing, blst, c-kzg

@ufoscout
Copy link
Contributor Author

Same issue with:

revm = { version = "14.0", default-features = true, features = [
    "serde",
    "arbitrary",
    "asm-keccak",
    "dev",
    "kzg-rs",
] }

@rakita
Copy link
Member

rakita commented Sep 25, 2024

There is EIP (https://eips.ethereum.org/EIPS/eip-7610) that changed how an Account is considered empty, in essence, it requires storage to be empty.

In Revm we don't have that check as it is close to impossible to trigger on mainnet as there are only few empty accounts with storage and you would need to get a hash collision to trigger it.

Statetest are handmade with some storage, there is list in Revm here:

// Test with some storage check.
| "RevertInCreateInInit_Paris.json"
| "RevertInCreateInInit.json"
| "dynamicAccountOverwriteEmpty.json"
| "dynamicAccountOverwriteEmpty_Paris.json"
| "RevertInCreateInInitCreate2Paris.json"
| "create2collisionStorage.json"
| "RevertInCreateInInitCreate2.json"
| "create2collisionStorageParis.json"
| "InitCollision.json"
| "InitCollisionParis.json"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants