Skip to content

fix(quorum): count enabled bitmap bits, not committee size, in pre-staking quorum check - #7

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

fix(quorum): count enabled bitmap bits, not committee size, in pre-staking quorum check#7
Frozen wants to merge 1 commit into
mainfrom
fix/cx-receipt-quorum-mask-main

Conversation

@Frozen

@Frozen Frozen commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Summary

Same fix as #6, cherry-picked (91ebee0) onto `main` for deployment there.

  • `uniformVerifier.IsQuorumAchievedByMask` (pre-staking epochs) compared the entire committee size (`len(mask.Publics)`) against the quorum threshold instead of counting bits actually set in the signer bitmap.
  • Net effect: an all-zero commit bitmap combined with an all-zero (identity) aggregate BLS signature satisfied quorum for any pre-staking-epoch committee, regardless of how many signers were actually enabled.
  • `stakeVerifier` (post-staking, used for current-era committees) was not affected.

Fix

Count enabled bits via `mask.IndexEnabled`, reject a `nil` mask outright, before comparing against the threshold.

Test plan

  • Cherry-pick applied cleanly onto `main`; `consensus/quorum/verifier.go` diff is byte-identical to the version already tested against `dev` in Fix pre-staking quorum mask validation #6 (only import-line differences in test files, auto-merged).
  • Same logic already covered by `TestUniformVerifierQuorumByMask` and `TestVerifySignatureRejectsEmptyPreStakingQuorum`, both passing on `dev`.
  • `main`'s native mcl/bls cgo deps aren't built in this sandbox, so `go test` couldn't be re-run here directly on `main` — please confirm green in CI before merge/deploy.

🤖 Generated with Claude Code

…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.

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