Skip to content

feat(fastsync): verifying fast-sync client (pull + verify) (#116)#125

Merged
LiranCohen merged 1 commit into
mainfrom
feat/fastsync-verifying-client
Jun 9, 2026
Merged

feat(fastsync): verifying fast-sync client (pull + verify) (#116)#125
LiranCohen merged 1 commit into
mainfrom
feat/fastsync-verifying-client

Conversation

@LiranCohen

Copy link
Copy Markdown
Contributor

Summary

The consumer half of the fast-sync trust model (epic #111), pairing with the #115 HTTP gateway.

  • Client.FetchAnchors(ctx, from, to, RootSource) GETs /fastsync/anchors, reconstructs each bundle, and verifies its merkle proof against a RootSource — the caller's OWN PoW-verified header roots (HeaderChain.HeaderAt provides them). Bundles that fail the proof, or whose height the caller can't yet verify, are dropped and counted (rejected). The peer can only omit, never forge.
  • FetchCAS(ctx, cid) pulls a content blob (caller verifies multihash == cid). All response reads are size-bounded.

What's next in #116

This is the pull+verify primitive. The remaining half — writing verified anchors into the store as provisional, the background full-scan reconciliation that drops provisional once first-principles indexing catches up (and bans an omitting peer), and a bootstrap flow — is a larger store/resolution integration that follows (worth a short design note; it touches how "provisional" is represented in the projection).

Tests

A canned gateway serves single-tx bundles; the client verifies them against matching local roots (2/0), rejects them against wrong roots (0/2) and when the local header chain doesn't reach the height (0/2); FetchCAS round-trip + missing-cid error.

go test -race ./... green (28 packages).

Post-Deploy Monitoring & Validation

No additional operational monitoring required: the client isn't wired into a runtime path yet (no bootstrap command until the projection-integration slice); it's a verified building block consumed next.

Part of #111. Advances #116 (client slice; provisional projection + reconciliation to follow).

🤖 Generated with Claude Code

The consumer half of the trust model (epic #111), pairing with the #115 HTTP gateway.

- internal/fastsync/client.go: Client.FetchAnchors(ctx, from, to, RootSource) GETs
  /fastsync/anchors, reconstructs each bundle, and verifies its merkle proof against a
  RootSource — the CALLER'S OWN PoW-verified header roots (HeaderChain.HeaderAt gives
  them). Bundles that fail the proof, or whose height the caller can't yet verify, are
  dropped and counted (rejected); the peer can only omit, never forge. FetchCAS pulls
  a content blob (caller verifies multihash==cid). Response reads are size-bounded.

This is the pull+verify primitive. The remaining half of #116 — writing verified
anchors into the store as PROVISIONAL, the background full-scan reconciliation that
drops provisional once first-principles indexing catches up (and bans an omitting
peer), and a `bootstrap` flow — is a larger store/resolution integration that follows.

Tests: a canned gateway serves single-tx bundles; the client verifies them against
matching local roots (2/0), rejects them against wrong roots (0/2) and when the local
header chain doesn't reach the height (0/2); FetchCAS round-trip + missing-cid error.
go test -race ./... green.

Co-authored-by: Liran Cohen <liranlasvegas@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@LiranCohen LiranCohen merged commit fc4c75a into main Jun 9, 2026
1 check passed
@LiranCohen LiranCohen deleted the feat/fastsync-verifying-client branch June 9, 2026 14:26
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