-
Notifications
You must be signed in to change notification settings - Fork 74
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
[WIP] feat(fw): verkle t8n post state verification #485
[WIP] feat(fw): verkle t8n post state verification #485
Conversation
# TODO: how to determine what is unexpected, i.e TestAddress is expected but not in post state | ||
unexpected_keys = [key for key in got_vkt if key not in expected_vkt] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not check for unexpected keys within the vkt. For example, as we don't specify the TestAddress account in the post state (and another account added during the test) we don't have a way of determining whether those additions within the tree are unexpected even though they are expected. This is something we don't check currently, so its a questions of if we need to be this granular when checking the post state vkt
Whatever option we choose to finalize with, we need to determine how we check for unexpected keys in the vkt. The previous solution involved using Account.NON_EXISTENT
: https://github.com/ethereum/execution-spec-tests/blob/main/src/ethereum_test_tools/spec/base/base_test.py#L61-L63
Can we do something similar here?
The question now that pops up - how do we best optimize this?
If the long term plan is to use the pedersen hash in python within EEST, then the current implementation style would be the way forward. Although, 1) or 2) using the latter in EELS seems more optimal. After more discussion, option 1) seems to be the viable option. This is implemented now in the same geth branch linked above. |
To allow for checking specific erroneous key/values in the post vkt on our end, essentially using our post state alloc expectation (the one we will now pass to the
The potential mismatch verification flow on our end could now be:
|
CIFO: #507 All relavent changes are included there. Most code is however removed, as we are going to verify the post state vkt slightly differently. |
🗒️ Description
Creating a draft PR here for visibility and discussion.
This implements a method for checking the post state of the verkle tree after t8n execution.
Currently it calls an additonal subcommand:
evm t8n verkle
, responsible for generating the verkle tree keys for account addresses and storage slots. These can be used for each account to generate an expected verkle post state using our existing post alloc, and compared against the actual vkt from t8n execution.For example, once we have the account address key:
We can create the account balance, nonce and code hash keys, by adding 0x01, 0x02 and 0x03 respectively to get their keys for the vkt:
For account storage keys we simply add the storage slot to the sub-command:
Using these keys we can create our own vkt representation, adding there appropriate values from the post alloc. Note the address value is
Hash32(0)
. Numerical values are in little endian (balance/nonce). The code hash value is the keccak256 of the account code bytes.Currently this method is not ideal - but it does work. As we call the subcommand around 260 times it takes around 120s to fill a single test. One proposed solution is update the subcommand, passing the entire post alloc to the subcommand - expecting an entire vkt conversion back. More comments are below.
Usage
Use the following geth branch: gballet/t8n-merge-from-shanghai-to-prague
Run with:
Check the output folders with
vkt.json
for any debugging.Note it takes around 2 mins to fill the test.
🔗 Related Issues
N/A
✅ Checklist
mkdocs serve
locally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.