Skip to content

feat(specs,test-types): add binary tree state provider behind a --state-trie flag - #41

Closed
spencer-tb wants to merge 4 commits into
forks/amsterdamfrom
stb/binary-state-trie
Closed

feat(specs,test-types): add binary tree state provider behind a --state-trie flag#41
spencer-tb wants to merge 4 commits into
forks/amsterdamfrom
stb/binary-state-trie

Conversation

@spencer-tb

Copy link
Copy Markdown
Owner

Description

Upstreams the commitment-neutral infrastructure of projects/binary-trie — and deliberately nothing the EIP process governs.

The pain of long-lived project branches is rebasing shared framework and tooling churn and running a separate release pipeline — not carrying the spec content, which is small and stable. This PR moves exactly that shared tier, and keeps the line the EIP process draws:

  • Zero changes under src/ethereum/forks/. No fork copy, no pseudo-fork, no EIP-8297 semantics in any fork. The spec's fork lineage (and its rendered docs) remains exactly the set of scheduled forks; a binary_tree fork materializes if and when the EIP process schedules 8297, so repo structure keeps tracking governance rather than front-running it.
  • The tree is shared infrastructure beside the MPT — partitioned_binary_tree.pymerkle_patricia_trie.py, state_pbt.pystate_mpt.py — selected per session by a testing flag. A tooling property, not a protocol claim: every fork defaults to MPT.
  • Release integration is a bonus tarball beside existing release assets that can never block a release.

What stays on projects/binary-trie because the EIP process owns it: the fork copy and its parity test, the tests/binary_tree/ EIP-8297 fixture suite, test_spec_constants.py, and the cross-client conformance-vectors tooling.

Contents by commit

  • feat(specs,test-types): ethereum/partitioned_binary_tree.py (structure + embedding, one module) and ethereum/state_pbt.py (PreState provider mirroring state_mpt.py); error contracts documented on the PreState protocol (get_code raises UnknownCodeHashError on malformed pre-state — state_mpt updated to match; compute_state_root raises InvalidBlock for state the commitment cannot encode, which the t8n reports as a rejected block with the pre-state root); StateCommitment.PBT + Alloc routing; blake3 dep; tests/binary_trie/ unit suites (fill-ignored) incl. a differential-vs-MPT suite and a test driving Amsterdam's unmodified execute_block against a binary-tree state (call sites type-ignored until the pre_state annotation is loosened; projects/zkevm carries that loosening). 100% line and branch coverage of both new modules.
  • feat(test-forks) (carried from feat(test-forks): add --state-trie state-commitment override flag marioevz/execution-specs#9): --state-trie {mpt,pbt} session override of Fork.state_commitment(); pytest_unconfigure restores the default so in-process pytester sessions cannot leak it; fork-agnostic tests for defaults, override incl. transition forks, option wiring, and genesis/pre-alloc-group behavior under the override.
  • feat(ci): binary-trie job — unit suites with coverage plus a full-tree PBT-mode fill (just fill-state-trie-pbt); the fill lane doubles as the enumeration of EIP-8297-incompatible tests (balances ≥ 2^128) until those are curated.
  • feat(ci): release variants — tests@ and <feat>-devnet@ releases attach <tarball>_binary.tar.gz, filled Amsterdam-only in PBT mode on its own runner through the standard build/combine pipeline (variants: in feature.yaml); a failed variant fill never blocks the release. A follow-up PR adds a zkevm variant on the same mechanism.

Verified: default fills byte-identical to base (modulo the _info.url commit pin); fill --fork Amsterdam --state-trie pbt produces binary state roots end to end; just static clean.

Related Issues or PRs

N/A.

Checklist

  • Ran fast static checks to avoid CI fails, see Code Standards & Verifying Changes: just static
  • PR title has the form <type>(<area>): <title>, where <type> and <area> come from an appropriate C-<type>, respectively A-<area>, label. The title should match the target squash commit message.

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

@spencer-tb spencer-tb closed this Aug 7, 2026
@spencer-tb
spencer-tb deleted the stb/binary-state-trie branch August 7, 2026 16:23
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