Skip to content

framework: add sync fixture format with checkpoint verification KATs#666

Merged
tcoratger merged 1 commit intoleanEthereum:mainfrom
tcoratger:framework/sync-format
Apr 22, 2026
Merged

framework: add sync fixture format with checkpoint verification KATs#666
tcoratger merged 1 commit intoleanEthereum:mainfrom
tcoratger:framework/sync-format

Conversation

@tcoratger
Copy link
Copy Markdown
Collaborator

🗒️ Description

Introduces a new consensus fixture format for sync-layer helpers clients must reproduce and lands the first batch of known-answer vectors for the checkpoint-state verifier.

`sync` format

  • Dispatches by operation name.
  • Initial operation `verify_checkpoint` builds a genesis state for a given validator count and reports both the verdict and the SSZ-encoded state so clients can deserialize and run their own `verify_checkpoint_state` for bit-for-bit comparison.

Initial vectors (3 KATs)

Under `tests/consensus/devnet/sync/`, covering the verdict branches of `verify_checkpoint_state`:

  • Zero validators → rejected (state cannot produce blocks).
  • Four validators → accepted (baseline suite size).
  • Eight validators → accepted (upper end of the test envelope).

The verification check is defence-in-depth applied by a client after downloading an anchor state from a checkpoint provider. Agreement on the verdict is required to catch misconfigured or corrupted anchors consistently across implementations.

🔗 Related Issues or PRs

First content PR for the `sync` format. Follow-ups can add vectors for peer-scoring, backfill-depth, and head-sync state transitions as those helpers stabilise in the spec.

✅ Checklist

  • Ran `tox` checks to avoid unnecessary CI fails:
    ```console
    uvx tox -e all-checks
    ```
  • Considered adding appropriate tests for the changes.
  • N/A for docs — test-vector and fixture-format-only PR; the new format is documented inline.

🤖 Generated with Claude Code

Introduces a new consensus fixture format for sync-layer helpers
clients must reproduce and lands the first batch of known-answer
vectors for the checkpoint-state verifier.

sync format

- Dispatches by operation name.
- Initial operation verify_checkpoint builds a genesis state for a
  given validator count and reports both the verdict and the
  SSZ-encoded state so clients can deserialize and run their own
  verify_checkpoint_state for bit-for-bit comparison.

Initial vectors

Three KATs under tests/consensus/devnet/sync covering the verdict
branches of verify_checkpoint_state:

- Zero validators -> rejected (state cannot produce blocks)
- Four validators -> accepted (baseline suite size)
- Eight validators -> accepted (upper end of test envelope)

The verification check is defence-in-depth applied by a client after
downloading an anchor state from a checkpoint provider; agreement on
the verdict is required to catch misconfigured or corrupted anchors
consistently across implementations.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@tcoratger tcoratger force-pushed the framework/sync-format branch from a3935c5 to 8bac250 Compare April 21, 2026 21:04
@tcoratger tcoratger merged commit b5b315c into leanEthereum:main Apr 22, 2026
13 checks passed
tcoratger added a commit to tcoratger/leanSpec that referenced this pull request Apr 22, 2026
Integrates the metrics→observability split (leanEthereum#667) with the multi-fork layout:

- fork code (forks/devnet4/store.py, forks/devnet4/containers/state/state.py)
  imports only the vendor-neutral observe_on_attestation / observe_on_block /
  observe_state_transition hooks; no Prometheus-specific metrics land inside
  forks/, keeping the fork folder consensus-critical by construction
- BlockLookup is now the plain dict[Bytes32, Block] alias from leanEthereum#667, so the
  former dict-subclass imports (Iterator, GetCoreSchemaHandler, ZERO_HASH)
  and the node's BlockLookup({...}) wrap are dropped
- reorg-depth telemetry moves to sync/service.py's default_block_processor
  and stays off the spec side
- consensus tests and fixture builders added in leanEthereum#663, leanEthereum#664, leanEthereum#665, leanEthereum#666 retarget
  lean_spec.subspecs.containers.* → lean_spec.forks.devnet4.containers.*; the
  verify_signatures tamper hook's in-function imports are pulled up to the top
- drops tests/lean_spec/subspecs/containers/block/test_block_lookup.py
  (BlockLookup no longer has ancestors / reorg_depth methods to test)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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