Skip to content

Fix four cases where bad network data could stop a node (#311) - #311

Merged
minuszka merged 2 commits into
defcon-project:v22.1.xfrom
minuszka:fix/upstream-crash-group1
Oct 19, 2026
Merged

minuszka merged 2 commits into
defcon-project:v22.1.xfrom
minuszka:fix/upstream-crash-group1

Conversation

@minuszka

Copy link
Copy Markdown
Contributor

Issue being fixed or feature implemented

Upstream Dash fixed several cases where malformed input could stop a node instead of being rejected. Four of them were still missing from this branch: one in compact block relay and three in the LLMQ/DKG code. This backports them. The related fixes from Dash v23.1.8 are already here (#310).

What was done?

  • net: in the BLOCKTXN handler, a partially downloaded block whose header a previous FillBlock() already cleared is refused (the request is removed and the peer scored) instead of being reconstructed again. PartiallyDownloadedBlock::InitData(), IsTxAvailable() and FillBlock() return an error instead of asserting. These are the bitcoin#26898 and bitcoin#33296 parts of backport: compact block relay hardening (bitcoin#26898, #27626, #27743, #26969, #29412, #32646, #33296) dashpay/dash#7398; the rest of #7398 (parallel compact block downloads and related refactoring) is not part of this PR.
  • llmq: PreVerifyMessage() rejects DKG contributions, complaints and justifications whose signature is not a valid BLS object, and BatchVerifyMessageSigs() never aggregates an invalid signature. This is the remaining part of dashpay/dash@31142da9; its intake checks are already in this branch.
  • bls: AsyncVerifyContributionShare() treats a null verification vector as a failed check, like the plural variant (dashpay/dash@1132a25b).
  • llmq: a justification naming member index members.size() is rejected; index lookups go through the new GetMemberAtIndex() (dashpay/dash@590236a2).
  • Tests:
    • New blockencodings_fill_tests: a second fill of the same partial block, and a second InitData(). They are not in blockencodings_tests because CI excludes that suite for unrelated failures.
    • bls_tests: the upstream case for the null verification vector.
    • evo_dip3_activation_tests: dkg_justification_index_bound registers masternodes, builds a DKG session and checks that the last member index is accepted and members.size() and beyond are rejected.
    • llmq_quorum_base_tests: copy the LLMQ params by value; the test kept a reference to a temporary.

Not ported: the upstream functional case for compact blocks (p2p_compactblocks.py). That test does not run on this branch at all yet: the Python test framework does not decode the vchBlockSig field of this fork's cmpctblock message.

How Has This Been Tested?

  • The targeted unit cases were run with the new tests but without the source changes: all four fail (two assertion aborts in blockencodings.cpp, an invalid memory access in the BLS case, and the index case accepts members.size()). With the changes, they pass, as do the 13 affected unit suites, feature_llmq_dkgerrors.py and p2p_llmq_signing_vectors.py.
  • Local run of this workflow's build job in the pinned CI image on the exact content of this commit: depends, build, configure and no-wallet regressions, all CI unit suites, Qt tests with the leak check, the named functional gate, feature_llmq_dkgerrors.py and p2p_llmq_signing_vectors.py on both transports, and the two helper regression steps.
  • The exact patch had an independent review before this commit.

Breaking Changes

None. Honest peers and valid messages are handled as before; the new checks only reject inputs that previously stopped the process. Consensus rules, RPC, wallet, wire and data formats are unchanged.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone (for repository code-owners and collaborators only)

Backport four upstream fixes for inputs that could stop the node
instead of being rejected:

- net: a partially downloaded compact block that a failed
  reconstruction already used is refused instead of reaching an
  assert, and PartiallyDownloadedBlock returns an error instead of
  asserting (bitcoin#26898, bitcoin#33296, via dash#7398).
- llmq: DKG contributions, complaints and justifications with an
  invalid signature are rejected before batch verification, and the
  batch verifier never aggregates an invalid signature (the remaining
  part of dash 31142da9).
- bls: AsyncVerifyContributionShare() treats a missing verification
  vector as a failed check (dash 1132a25b).
- llmq: a justification naming the member index one past the end is
  rejected; member lookups by index go through GetMemberAtIndex()
  (dash 590236a2).

Tests: unit regressions for each fix. The compact block cases live in
a new blockencodings_fill_tests suite because CI excludes
blockencodings_tests. Also copy the LLMQ params by value in
llmq_quorum_base_tests, which kept a reference to a temporary.
@minuszka minuszka changed the title net, llmq, bls: backport four abort fixes from Dash Fix four cases where bad network data could stop a node (#311) Oct 19, 2026
Wait for each surviving node's current-epoch announcements and complete
verdict before entering the signing window. Keep mocktime moving while
waiting for signature recovery at a fixed height so share requests,
connection retries and recovery backoff can progress.

Keep the timeout and the mined-commitment and shadow-state assertions.
@minuszka
minuszka merged commit 588bac1 into defcon-project:v22.1.x Oct 19, 2026
4 checks passed
@minuszka
minuszka deleted the fix/upstream-crash-group1 branch October 19, 2026 08:33
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