Skip to content

Fix pre-staking quorum mask validation - #6

Open
Frozen wants to merge 1 commit into
devfrom
fix/cx-receipt-quorum-mask
Open

Fix pre-staking quorum mask validation#6
Frozen wants to merge 1 commit into
devfrom
fix/cx-receipt-quorum-mask

Conversation

@Frozen

@Frozen Frozen commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • count enabled signer bits instead of the full committee size when verifying pre-staking quorum masks
  • reject nil and empty signer masks before aggregate BLS verification
  • add mask-boundary coverage and an end-to-end engine regression test for an empty pre-staking quorum

The previous implementation used len(mask.Publics), which is the committee size regardless of the bitmap. As a result, a zero bitmap could satisfy the pre-staking quorum check.

This is the minimal exploit-closing change. It does not by itself establish that a supplied cross-shard source header is canonical or bind an attacker-controlled source epoch to its expected height.

[Test]

  • go test -mod=readonly ./consensus/quorum
  • go test -mod=readonly ./internal/chain
  • gofmt -d consensus/quorum/verifier.go consensus/quorum/quorom_test.go internal/chain/engine_test.go
  • goimports -d consensus/quorum/verifier.go consensus/quorum/quorom_test.go internal/chain/engine_test.go
  • git diff --check origin/dev...HEAD

…taking quorum

uniformVerifier.IsQuorumAchievedByMask compared the full committee size
(len(mask.Publics)) against the threshold instead of counting bits actually
set in the signer bitmap. An all-zero bitmap paired with an all-zero
(identity) aggregate BLS signature therefore satisfied quorum for any
pre-staking-epoch committee, since len(mask.Publics) always exceeds the
threshold regardless of how many signers were enabled.

Count enabled bits via mask.IndexEnabled and reject a nil mask outright.

Add regression coverage: a mask-level table test for zero/below-threshold/
at-threshold/padding-bit bitmaps, and an engine-level test asserting that
verifySignature rejects an empty pre-staking quorum end-to-end.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Your trial has ended. Reactivate Greptile to resume code reviews.

@Frozen Frozen changed the title fix(quorum): count enabled bitmap bits, not committee size, in pre-staking quorum check Fix pre-staking quorum mask validation Aug 12, 2026
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