Skip to content

fix: support trusted warp sync checkpoints - #3113

Merged
UnArbosFive merged 11 commits into
release-v450from
fix/finney-light-sync-checkpoint
Aug 27, 2026
Merged

fix: support trusted warp sync checkpoints#3113
UnArbosFive merged 11 commits into
release-v450from
fix/finney-light-sync-checkpoint

Conversation

@UnArbosFive

@UnArbosFive UnArbosFive commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • register an explicit grandpaWarpSyncCheckpoint chain-spec extension containing a historical GRANDPA transition header and the authority set that signed it
  • feed that trusted transition into the existing GRANDPA warp-proof verifier, preserving Finney's one-time initial set-ID correction while allowing normal proof verification to continue to the peer's current finalized head
  • expose a compact grandpa_genWarpSyncCheckpoint response behind the opt-in --enable-warp-sync-checkpoint-rpc flag
  • preserve grandpaWarpSyncCheckpoint whenever the raw and plain chain specs are rebuilt

Addresses #3112.

Trust and safety

  • Finney remains Aura for block production and GRANDPA for finality. This change is GRANDPA-only; it does not use or modify BABE.
  • The checkpoint is trusted because it is distributed in the chain spec. It authenticates the historical GRANDPA signing boundary; later scheduled authority transitions are still verified normally.
  • State sync remains targeted at the proof's current finalized header. Clients do not need an archive peer serving state at the historical checkpoint.
  • A malformed populated checkpoint fails startup in warp mode instead of silently falling back to an untrusted or unintended path.
  • Full sync, sealing, existing databases, and chain specs without a checkpoint retain their existing behavior.
  • The generation RPC is disabled by default and returns only the chain-spec ID, genesis hash, and checkpoint object. Public deployments should use their normal RPC rate limits.
  • The generator does not require a genesis/full sync. It requires the latest GRANDPA transition record, header, justification, and parent state to remain available.

Rollout

The initial Finney checkpoint is populated from retained public archive history at block 8,867,448 (set ID 5, the signing set immediately before set ID 6). The public archive retains the transition header, GRANDPA justification, and historical parent state required by the generator. No automatic refresh path is included: a future checkpoint change must be an explicit, independently verified chain-spec diff. Normal scheduled authority rotations do not require such a refresh.

The end-to-end Finney regression is complete:

  1. A known-compatible archive proof provider restarted on its existing database at the current head; no database replacement or re-sync was required.
  2. A client with a wiped Finney database completed --sync=warp, then imported the current state and caught up through normal block sync.
  3. The client reported GRANDPA set ID 6 after state sync, reached isSyncing: false, and finalized new blocks normally.

The PR remains a draft intentionally after completing this validation.

The checkpoint is a historical proof-verification anchor, not a state-download target. Normal scheduled authority rotations do not invalidate it and do not require release-by-release refreshes or a hardcoded current set ID.

Proof generation is unchanged by this PR: the client still requests the normal proof sequence from genesis and uses the checkpoint when that proof reaches the trusted transition. Serving peers therefore do not need this PR image, but they do need the Finney GRANDPA set-ID fix first released in v446 and retained transition data. Until compatible provider adoption is sufficient, operators should use at least one known-compatible v446-or-newer provider.

Validation

  • cargo fmt --check --all
  • bash -n scripts/build_all_chainspecs.sh
  • git diff --check origin/release-v450...HEAD
  • SKIP_WASM_BUILD=1 cargo check -p node-subtensor --lib
  • SKIP_WASM_BUILD=1 cargo test -p node-subtensor service:: --lib
  • unit coverage for the typed chain-spec boundary, compact RPC serialization, and valid, missing, malformed, and trailing-data header/authority encodings
  • fresh-database Finney --sync=warp regression against a known-compatible provider, including current-state import, GRANDPA set ID 6, and advancing finality
  • archive-provider restart on the existing database, followed by immediate current-head import and finalization without re-sync

The ordinary local compile was blocked by this Mac's Clang lacking the wasm32-unknown-unknown C target; native node compilation and the targeted tests passed with runtime WASM generation skipped. CI builds the full runtime in its configured environment.

@vercel

vercel Bot commented Aug 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
subtensor Ready Ready Preview Aug 27, 2026 5:21pm

Request Review

@github-actions

github-actions Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

🛡️ AI Review — Skeptic (security review)

VERDICT: SAFE

VERY HIGH scrutiny: <90-day account with zero public repos, mitigated by repository admin access, substantial contributions, matching author/committer, and no known Gittensor association; fix/finney-light-sync-checkpoint -> release-v450.

Static analysis only; no PR-controlled code was executed. The previously identified automatic remote checkpoint-refresh path remains absent, and checkpoint changes are explicit chain-spec diffs.

Findings

No findings.

Conclusion

No malicious behavior or security vulnerability was found in the current diff. The historical checkpoint is treated as an explicit chain-spec trust anchor while subsequent GRANDPA transitions remain proof-verified.


🔍 AI Review — Auditor (domain review)

VERDICT: 👍

Established repository administrator with substantial prior contributions; gittensor association UNKNOWN. Overlapping PR #2989 is unrelated.

The trusted checkpoint implementation, transition validation, populated Finney data, generation RPC, and documented rollout evidence are internally consistent.

Quick checks passed: bash -n scripts/build_all_chainspecs.sh, raw/plain checkpoint equality, git diff --check, and clean git status --short. cargo fmt --check --all was skipped because rustup could not write to the locked environment. No spec-version check applies to the release-v450 base.

Findings

No findings.

Conclusion

No substantive correctness or domain issues remain. The PR is ready from the Auditor perspective.

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👎

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👎

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👎

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👎

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI review — see the sticky summary comment for the verdict and the inline comments below for specific findings.

curl "${curl_args[@]}" "$rpc_url" >"$rpc_response"

if jq -e '.error != null' "$rpc_response" >/dev/null; then
jq -r '"grandpa_genWarpSyncSpec failed: " + (.error | tostring)' "$rpc_response" >&2

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MEDIUM] Private RPC credentials are exposed in process arguments

Both $rpc_url and the optional --user user:password entry are expanded into curl's argv. On hosts where process arguments are visible to other users or monitoring agents, credentials can be recovered while this potentially five-minute request runs. Supply authentication through a permission-restricted curl config/netrc file, and reject secret-bearing URL components.

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: VULNERABLE

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👍

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👍

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👍

@UnArbosFive
UnArbosFive force-pushed the fix/finney-light-sync-checkpoint branch from 4b19dc3 to 431019a Compare August 25, 2026 17:49
@UnArbosFive
UnArbosFive changed the base branch from main to fix/root-basket August 25, 2026 17:49

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI review — see the sticky summary comment for the verdict and the inline comments below for specific findings.

Comment on lines +85 to +87

if ! jq -e --arg expected_genesis_hash "$expected_genesis_hash" \
'.result.genesisHash == $expected_genesis_hash' "$rpc_response" >/dev/null; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[HIGH] Remote endpoint self-authenticates the consensus checkpoint

The genesis hash is supplied by the same RPC response as the checkpoint, so this comparison proves only that the endpoint echoed the expected constant. A compromised or misconfigured endpoint can return that hash alongside an attacker-selected header and authority set; the script then writes those values into both chain specs as a trusted GRANDPA hard fork, allowing proofs rooted in attacker-controlled authorities to be accepted. Authenticate the checkpoint independently—for example, require an operator-provided expected transition block hash and authority-set digest, or cryptographically verify the transition and justification from an existing trusted anchor before replacing the specs.

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: VULNERABLE

@UnArbosFive
UnArbosFive force-pushed the fix/finney-light-sync-checkpoint branch from 431019a to a9608b1 Compare August 27, 2026 16:04
@UnArbosFive
UnArbosFive changed the base branch from fix/root-basket to release-v450 August 27, 2026 16:04

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI review — see the sticky summary comment for the verdict and the inline comments below for specific findings.

Comment on lines +86 to +87
if ! jq -e --arg expected_genesis_hash "$expected_genesis_hash" \
'.result.genesisHash == $expected_genesis_hash' "$rpc_response" >/dev/null; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[HIGH] Remote endpoint self-authenticates the consensus checkpoint

Matching the endpoint-reported genesis hash proves only that the response claims the expected chain; it does not authenticate the returned historical header or authority set. Because this same response is then written as a trusted GRANDPA hard fork, a compromised or misconfigured endpoint can supply attacker-controlled authorities. Verify the checkpoint against an independent immutable trust source (or cryptographically validate its ancestry and GRANDPA justification from an already trusted anchor) before updating either chain spec.

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: VULNERABLE

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI review — see the sticky summary comment for the verdict and the inline comments below for specific findings.

Comment on lines +86 to +87
if ! jq -e --arg expected_genesis_hash "$expected_genesis_hash" \
'.result.genesisHash == $expected_genesis_hash' "$rpc_response" >/dev/null; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[HIGH] Remote endpoint self-authenticates the consensus checkpoint

This compares the expected genesis hash with a value supplied by the same endpoint that supplies the checkpoint. The newly added server-side checks establish only internal consistency: a hostile endpoint can report the expected genesis hash while returning a transition header and authority set from an attacker-controlled fork. Because these values become a trusted GRANDPA hard fork, authenticate the checkpoint independently—for example, require a separately obtained expected transition hash and authority-set digest before updating either chain spec.

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: VULNERABLE

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👍

@UnArbosFive
UnArbosFive marked this pull request as ready for review August 27, 2026 17:22
@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👍

@UnArbosFive
UnArbosFive merged commit 9163d8c into release-v450 Aug 27, 2026
86 of 87 checks passed
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