feat(state): activate VCT fast checkpoint sync in the committer#416
Conversation
And one more auto-invalidated finding. Analyzed 13 files, diff |
56b5162 to
60b8ca4
Compare
60b8ca4 to
806321d
Compare
|
F-95300 is obsolete, no probe anymore |
806321d to
4df6516
Compare
ValarDragon
left a comment
There was a problem hiding this comment.
Took me awhile! Thank you, this looks good to me!
We still need to validate the full header before persisting later, which removes a lot more risk frontier/complexity as well.
Longer term we should think through more type safety here as well.
Great work here!
Motivation
Next slice of the verified-commitment-trees (VCT) fast-sync split series, stacked on #414 (
split/vct-runtime). It makes the runtime live: the committer fast path, the fail-closed reopen, and the property-test suite. This is the slice that removes the#[allow(dead_code)]frommod vct;, so the compiler proves the whole state layer is wired.Extracted from the #408 reference draft / #409, adapted to #414's final APIs (DB-only
PeerSource, mandatory handoff frontier, no eviction seam).Solution
finalized_state.rs): below the checkpoint, when the source has a block's roots, the committer verifies them against the node's own header commitments (via feat(state): verify supplied commitment roots against header commitments #411's verify-core), folds them into the anchor set and history leaf, and skips the per-block note-commitment frontier recompute. At the handoff height the embedded final frontier is verified against that block's proven root and written as the tip treestate. Untrusted peer roots at or above Heartwood are only committed once a buffered successor confirms them; the write loop keeps a one-block look-ahead for this.write.rs): a missing/rejected root or an absent successor parks and retries the same block in place (with the feat(state): add VCT runtime, embedded frontier, and commitment-root source seam #414 error variants) instead of resetting the checkpoint queue; a stall persisting past 30s escalates to an error log and astate.vct.root.stalled.heightgauge, since a node that can't obtain a verifiable root will not — by design — recompute against the frozen frontier.VCT_SYNC_METADATA; reopening one below the handoff refuses to run in configurations that would misuse the frozen frontier, and the genesis-root cache upgrade treats an absent genesis tree as a mid-flight fast sync instead of panicking.zebra_db/*,disk_format/*): fast-anchor-root writes, the fast-sync marker, staged-root rollback, and retention interaction with pruning.tests/prop.rs, ~1,800 lines): legacy-vs-fast consensus-state equivalence (anchors + history root digests), producer→consumer round-trip from a real DB throughproduce_block_roots, poisoned-root rejection + refetch un-poisoning, await-successor deferral, frozen-frontier restart safety, and handoff treestate writes. Peer-source tests fill roots through the sameinsert_zakura_header_commitment_rootswrite path production header sync uses, against the fast state's own database.Activation note
State config defaults (
checkpoint_sync = true,vct_fast_sync = true, both serde-skipped mirrors) mean the fast path is active by default on Mainnet once this merges. The user-facingconsensus.vct_fast_syncopt-out and zebrad plumbing land in the next slice — if the series should stay dormant until then, flip the state-config defaults here and restore them in that PR.