Repository navigation
fix(statesync): bound backfill backpressure, spare honest peers on extension-count mismatch, patch grpc CVE - #1451
Conversation
blockQueue.nextHeight allocated the next height to fetch without reference to how far verification had progressed, tracking only what had been fetched. Fetching a light block costs a round trip while verifying one costs a BLS commit check on a single serialized loop, so peers serving faster than this node verifies grew the fetched-but-unverified backlog in the unbounded pending map across the entire backfill span - a memory-exhaustion vector on the long backfill a new node joining an established chain performs. Bound the heights that may be allocated but not yet verified, scaled to the fetcher count so the pipeline still saturates its workers. Heights needing a re-fetch are exempt: they are already counted against the bound and the verify loop cannot advance past them, so withholding one would deadlock the run the bound exists to protect. Measured with the backpressure probe over spans of 200, 800 and 3200: peak fetch-ahead depth falls from 159 to 16 at span 200 and stays at 16 for every larger span, where it previously tracked the span. Run duration and blocks served over the span are unchanged, so the happy path pays nothing. Co-Authored-By: Claude Sonnet 5 <[email protected]>
…ismatch backfill treated every error from ValidatorSet.VerifyCommit as grounds to disconnect the peer that supplied the commit. types.ErrVoteExtensionCountMismatch does not deserve that: an honest peer relaying a commit whose vote-extension configuration differs from this node's reaches it, which is an application disagreement rather than a forged signature. verifyCommit already leaves that error untyped for exactly this reason, and internal/consensus evicts only on the typed ErrInvalidCommitSignature. Backfill is the error's only untrusted-input path, so disconnecting here defeated the whole carve-out. Score the peer down instead, matching the severity the neighbouring refusals already use for causes an honest peer can produce. The peer is still withdrawn from the run, which is what keeps the run healthy, and every other verification failure still costs the connection. Co-Authored-By: Claude Sonnet 5 <[email protected]>
v1.82.1 is affected by CVE-2026-84304: internal/transport stores each fragmented HTTP/2 DATA frame as a separate recvMsg, so an unauthenticated peer multiplexing streams of one-byte frames exhausts heap while staying inside the flow-control windows. This repo exposes gRPC servers in abci/server and privval/grpc, so the path is reachable. Fixed upstream in v1.83.1 by receive-buffer compaction; v1.83.2 is the latest patch of that minor and adds rejection of requests carrying neither :authority nor Host. Release notes for v1.83.0 through v1.83.2 record no breaking API changes, and this repo uses only NewServer, NewClient and generated stubs. Pulls in transitive updates to golang.org/x/crypto, x/net and x/text. Co-Authored-By: Claude Sonnet 5 <[email protected]>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
🕓 Queued for automated review — 22nd in line, estimated start in ~7 h (commit 4048065)
|
TL;DR: Fixes three security-hardening gaps found in an independent review: a new node backfilling history from peers could be pushed into unbounded memory growth, an honest peer could get needlessly disconnected during that same backfill, and the node's gRPC servers were running a version with a known remote-DoS vulnerability.
User story
As a node operator running or joining a Dash/Tenderdash network, I want backfill (the process a new or catching-up node uses to pull in historical blocks) to behave safely under adversarial or merely uneven peer conditions, and my node's gRPC servers to not carry known vulnerabilities, so that syncing a new node and running validator/signer infrastructure stays reliable and safe.
Scenario
Base flow
A node performing statesync backfill requests historical light blocks from peers, verifies each one (a real cryptographic cost), and persists it before advancing.
Actual behavior
google.golang.org/grpcv1.82.1, which is affected by CVE-2026-84304 (unauthenticated HTTP/2 DATA-frame-fragmentation heap exhaustion).Expected behavior
google.golang.org/grpcis updated past the patched version.Detailed discussion
What was done
internal/statesync/block_queue.go,reactor.go):blockQueuegained amaxFetchAheadbound (Fetchers × 4by default). A new internal_allocate()hands out a fresh height to fetch only whileverifyHeight - fetchHeight < maxFetchAhead; callers past the bound park on the existing waiter mechanism, woken by_resumeFetchers()as verification frees slots. Heights needing a re-fetch are deliberately exempt from the bound — every such height is one the verify loop is still waiting on, so withholding a re-fetch would deadlock the very run the bound protects.ErrVoteExtensionCountMismatch(internal/statesync/reactor.go): in backfill's commit-verification branch,errors.As(verr, &types.ErrVoteExtensionCountMismatch{})now selects the non-fatal "exclude from this run" outcome instead of disconnecting, matching the severity classification this error already gets elsewhere. Scoped to exactly this error type — no change to any other verification-failure's severity.google.golang.org/grpcv1.82.1 → v1.83.2 (go.mod/go.sum), patching CVE-2026-84304. v1.83.2 (latest patch on the same minor) was chosen over the minimum-patched v1.83.1 after confirming no breaking API changes reach this repo's usage across every gRPC-importing package.go.modalso shows large incidental churn unrelated to this PR's content: Go 1.27's toolchain restructures this repo'srequireblocks on anygo mod tidy/go get, independent of any dependency version change (verified: runninggo mod tidywith zero version bumps on the pristine base already produces the same reformatting). Only thego.sumdiff and the singlegrpcversion line reflect an actual change.Testing
TestBlockQueueBoundsFetchAheadandTestBlockQueueRetriesOutrankFetchAheadBound(the latter guards the re-fetch-exemption deadlock invariant above) — both written red-first.TestBackfillFetchVerifyBackpressurerewritten from documenting the unbounded gap to asserting the bound, plus asserting the happy path still completes and verifies every height (previously only logged). Measured over spans of 200/800/3200: peak fetch-ahead depth falls from tracking the span (159 at span 200) to a flat 16 regardless of span; run duration and blocks served on the happy path are unaffected.TestReactor_Backfill_ReportsRefusalsBySeverityreproduces the count-mismatch scenario with a real wire payload (an appendedVoteExtensionType_DEFAULTextension that passes validation but is excluded from threshold recovery) and asserts the peer is not disconnected, while the existing forged-signature row continues to prove other verification failures still are.internal/statesyncandtypes: full package tests pass, including with-race(no data races detected).google.golang.org/grpc-importing package (abci/...,privval/...,cmd/priv_val_server) builds, vets clean, and its tests pass under both normal and-raceruns.go mod verify: all modules verified.Breaking changes
None. All three changes are internal hardening / a dependency patch bump with no API or wire-protocol change.
Checklist
CHANGELOG.md)For repository code-owners and collaborators only
Prior work
None directly overlapping — PR #1426 (open,
fix/statesync-status-metrics) touches nearby statesync metrics wiring but a different concern (status reporting, not backfill backpressure or peer disconnection policy).Attribution
🤖 Generated with Claude Code