Skip to content

Stateless: Create ExecutionWitness type and implement encoding/decoding #3440

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

Merged
merged 7 commits into from
Jul 2, 2025

Conversation

bhartnett
Copy link
Contributor

@bhartnett bhartnett commented Jul 2, 2025

This ExecutionWitness type follows the structure used by Ress and also Geth, see here:
https://github.com/ethereum/go-ethereum/blob/bc67e7dd487189b828d63927b453f4af2e67f2ff/core/stateless/witness.go#L38
https://docs.rs/alloy-rpc-types-debug/latest/alloy_rpc_types_debug/struct.ExecutionWitness.html

Here is write up on the topic from the Geth team: https://gist.github.com/karalabe/47c906f0ab4fdc5b8b791b74f084e5f9

This structure is different to the prior block witness structure used and this version is actually much simpler to understand and implement. The state is simply a list of MPT nodes (both account and storage tries together). The codes field is the list of bytecodes used/executed by the block. The keys is the ordered list of addresses or storage slot keys accessed while executing the block and the headers contains the list of headers required to prove that the witness is correct. Before the recent Prague hardfork this would have contained all the headers required to support the BLOCKHASH opcode but now since this opcode is implemented using a system contract this field should only need to contain the parent header which is required to validate the witness against the parent state root before starting stateless execution.

This ExecutionWitness type will also be used to implement the debug_executionWitness and debug_executionWitnessByBlockHash RPC endpoints.

@bhartnett bhartnett merged commit 1796fe7 into master Jul 2, 2025
5 checks passed
@bhartnett bhartnett deleted the stateless-provider-generate-witness branch July 2, 2025 12:02
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

Successfully merging this pull request may close these issues.

1 participant