test(entry): cover signature-share validation and message type#4196
Open
piotr-roslaniec wants to merge 1 commit into
Open
test(entry): cover signature-share validation and message type#4196piotr-roslaniec wants to merge 1 commit into
piotr-roslaniec wants to merge 1 commit into
Conversation
pkg/beacon/entry had only marshaling round-trip tests (~14% coverage). Add unit tests for the logic that can be exercised without a live broadcast channel or relay chain: - extractAndValidateShare, the gatekeeper that accepts or rejects a signature share received from another group member - all three rejection paths (unparseable share, unknown sender, share that does not verify) plus the accept path, built on real BLS sign/verify. - The SignatureShareMessage value object (constructor, SenderID) and its wire Type identifier, which must stay stable for cross-client network compatibility. - Unmarshal rejecting a member index that overflows the uint8 range. Raises package coverage from ~14% to ~27%. The remaining uncovered code (SignAndSubmit orchestration, relay entry submission) drives a broadcast channel and the beacon chain and is exercised by integration tests.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdded unit tests covering signature share validation and ChangesBeacon entry tests
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
pkg/beacon/entrypreviously had only marshaling round-trip tests (~14% coverage). This adds unit tests for the logic that can be exercised without a live broadcast channel or relay chain, raising coverage to ~27%.Covered:
extractAndValidateShare— the gatekeeper that accepts or rejects a signature share received from another group member. A member that accepted a bad share would contribute to a corrupt relay entry, so all three rejection paths (unparseable share bytes, unknown sender, share that does not verify) are tested alongside the accept path, built on realblssign/verify.SignatureShareMessagevalue object (NewSignatureShareMessage,SenderID) and its wireTypeidentifier, which must stay stable for cross-client network compatibility.Unmarshalrejecting a member index that overflows the uint8 range (the documented uint8/uint32 wire invariant).Not covered (by design)
SignAndSubmit(the signing orchestration loop),broadcastShare,completeSignature, and relay entry submission drive a broadcast channel and the beacon chain. Those are exercised by the beacon integration tests, not unit tests; forcing unit-level mocks there would be brittle and low-value.Verification
go test ./pkg/beacon/entry/passes;gofmt -l,go vet, andstaticcheck -SA1019clean.Summary by CodeRabbit