ethereum / ethereum/execution-specs

Account(storage={}) infinite loop-checks account storage over RPC

Open
#2,162 1 comment 0 reactions 0 assignees View on GitHub
A-test-execution C-bug stale
Dominant language
Python
Stars
1.2k
Forks
505
Avg merge
2d 8h
Merged PRs (30d)
106

Description

### What was wrong?

https://github.com/ethereum/execution-specs/blob/9959739d5cbfd90c1bd531e1be3510d373c3905e/packages/testing/src/execution_testing/execution/transaction_post.py#L197-L205

### How can it be fixed?

The tests written in the tooling often contain checks for storage which inspect specific fields. The other fields, by default, can have any value, and allows to write focused tests where it is clear what is actually being tested. This raises the question what `Account(storage={})` is supposed to be. If one key/value is added then only that key/value is checked to contain the correct value, the other storage keys do not matter. Therefore I think that `Account(storage={})` is therefore meaningless as it allows all key/values in the storage. If a test writer explicitly wants to test that the storage is empty, then I believe a specific flag for that should be added (just like `Account.NONEXISTENT` -> `Storage.EMPTY` for instance).

To test this over RPC (via `execute remote`) it is not feasible to verify all keys are empty. It is also not possible to directly get the state root of an account. However, via `eth_getProof` we can get the relevant fields. For empty storage we can check if the root of the account is indeed the empty storage root. Note that `getProof` is not available for all RPCs and the format also depends on the trie type, so it is not super steady, but I believe this is the only way to check for empty storage over the `eth_` RPC.

### Additional Context

Currently the empty storage account will fetch all storage keys (2^256 keys) over RPC to verify if they are empty, i.e. the test will never pass as this check stalls the process.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.