Skip to content

refactor(test-fill): use the shared sync-payload builder for sync fixtures - #3405

Draft
danceratopz wants to merge 1 commit into
ethereum:experiments/wirex-fillfrom
danceratopz:sync-payload-alignment-2
Draft

refactor(test-fill): use the shared sync-payload builder for sync fixtures#3405
danceratopz wants to merge 1 commit into
ethereum:experiments/wirex-fillfrom
danceratopz:sync-payload-alignment-2

Conversation

@danceratopz

Copy link
Copy Markdown
Member

Description

Note

This PR is stacked on #3364. Until #3364 lands, please review only this PR's final commit. Once #3364 merges, this PR will be retargeted to forks/amsterdam.

The blockchain_test_engine_x and blockchain_test_sync formats now build their framework-generated sync payloads through the same build_sync_payload helper. The sync format previously built its singular syncPayload inline, without the per-test salt or the checks and defined failure behavior introduced for EngineX by #3364.

For the sync format's valid linear chains:

G → T₁ … Tₙ → S*

G is genesis, T₁…Tₙ are test payloads, S is the empty sync payload, and * marks the payload announced to the sync client. The sync payload is appended above the test-chain head and stored separately in the singular syncPayload field. The test's engineNewPayloads, lastblockhash, and post-state assertion remain unchanged.

Behavioral consequences for blockchain_test_sync fixtures:

  1. The sync payload's extraData now carries a 16-byte digest of the test ID, giving it a test-specific blockHash. All nine existing fixtures of this format therefore change in extraData, the resulting blockHash, and fixture metadata; their parent, state root, and fee fields remain unchanged.
  2. The singular syncPayload remains mandatory. --no-sync-block and a test's sync_block=False affect only the EngineX format's optional syncPayloads list.
  3. If the framework cannot represent or evaluate a child above the test-chain head, the sync-format fill fails with an error naming the conflict. An EngineX fixture can omit one optional sync payload; the sync format cannot serve its consumer without its required one.
  4. The format continues to support only valid linear chains. The fill now rejects both expected-invalid test payloads and Engine API error-code assertions anywhere in the sequence, including cases where a later payload gives the filler a valid head.

For implementation and format details, read Sync Payloads first, followed by the blockchain_test_sync format reference.

Validation:

  • just static passes.
  • The testing-package suite passes: 2,097 passed, 29 skipped, 4 xfailed, and 2 xpassed.
  • A before/after corpus comparison confirms that all nine existing sync fixtures differ only in the salted extraData, its resulting blockHash, and fixture metadata.
  • A consume sync smoke test using geth as both clients passes all 9 fixtures in 33 seconds; each sync client progresses from SYNCING to VALID, and the head state is verified through eth_getBlockByHash.

Related Issues or PRs

Depends on #3364.

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

One builder, one branch.

A beaver busy at work carrying a branch

The blockchain_test_sync format built its syncPayload inline: an unsalted empty block, no guard for heads no payload can be built above, and no defined failure. The engine_x format's syncPayloads entries already have all of that in build_sync_payload. Build the sync format's payload there too.

The sync format supports only valid linear chains. Their payload graph has exactly one leaf—the final test payload—and the format's single syncPayload field announces it. No leaf selection is involved; the payload is built above the chain's final built block.

Consequences, all deliberate:

- Every blockchain_test_sync fixture changes its published bytes: the payload's extra_data now carries the 16-byte per-test salt digest, which changes the payload's block hash and the fixture's _info hash. The whole corpus today is the EIP-7934 max-RLP family (5 verify_sync marks, 9 fixtures). The salt buys this format nothing functionally right now, because consume sync boots two fresh clients per fixture, so no head is ever announced twice; the win is one builder instead of two, the guard and the defined failure for free, and fixtures that behave identically if the simulator ever reuses clients.

- A head the filler cannot build above now fails the fill, naming the reason and the conflict. An engine_x fixture omits that chain head's sync payload in this case, but a sync fixture could not serve its consumer without its mandatory payload.

- The payload is built regardless of --no-sync-block and of a test's sync_block=False setting: those govern the engine_x format's optional list, and this format's payload is its defining field.

- Payload rejection cases stay unsupported. The assertion now rejects both expected-invalid payloads and Engine API error-code assertions anywhere in the sequence, including cases where a later payload gives the filler a valid head. Such sequences do not form the all-accepted linear chain represented by the single syncPayload field.

Verified by filling the corpus before and after: every fixture is field-for-field identical except extra_data (empty to digest, 9 distinct values) and the block hash it implies. A consume sync smoke of the salted corpus via hive --dev (geth as both client under test and sync client) passes 9 of 9.
@danceratopz danceratopz added C-refactor Category: refactor A-test-consume Area: execution_testing.cli.pytest_commands.plugins.consume labels Aug 20, 2026
@codecov

codecov Bot commented Aug 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.53%. Comparing base (707458c) to head (e4bd1bb).

Additional details and impacted files
@@                   Coverage Diff                   @@
##           experiments/wirex-fill    #3405   +/-   ##
=======================================================
  Coverage                   93.53%   93.53%           
=======================================================
  Files                         624      624           
  Lines                       37074    37074           
  Branches                     3394     3394           
=======================================================
  Hits                        34679    34679           
  Misses                       1645     1645           
  Partials                      750      750           
Flag Coverage Δ
unittests 93.53% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@danceratopz danceratopz changed the title refactor(test-fill): one sync-payload builder, not two refactor(test-fill): use the shared sync-payload builder for sync fixtures Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-test-consume Area: execution_testing.cli.pytest_commands.plugins.consume C-refactor Category: refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant