-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: bound DKG contribution blob intake #7408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -82,14 +82,17 @@ size_t MaxDKGMessageSize(std::string_view msg_type, const Consensus::LLMQParams& | |
| bool CheckDKGMessageStructure(std::string_view msg_type, const CDataStream& vRecv, const Consensus::LLMQParams& params) | ||
| { | ||
| const size_t size = params.size > 0 ? static_cast<size_t>(params.size) : 0; | ||
| const size_t min_size = params.minSize > 0 ? static_cast<size_t>(params.minSize) : 0; | ||
| const size_t threshold = params.threshold > 0 ? static_cast<size_t>(params.threshold) : 0; | ||
| try { | ||
| CDataStream s(vRecv); // copy; deserialization does not advance the caller's stream | ||
| if (msg_type == NetMsgType::QCONTRIB) { | ||
| CDKGContribution qc; | ||
| s >> qc; | ||
| return qc.vvec != nullptr && qc.vvec->size() == threshold && | ||
| qc.contributions != nullptr && qc.contributions->blobs.size() <= size; | ||
| qc.contributions != nullptr && | ||
| qc.contributions->blobs.size() >= min_size && | ||
| qc.contributions->blobs.size() <= size; | ||
|
Comment on lines
92
to
+95
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💬 Nitpick: Cast of signed Lines 84-85 of the same function defensively clamp source: ['claude-general'] There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Resolved in this update — Cast of signed Auto-resolved by the review system based on the latest commit diff. If you believe this was closed in error, reopen the thread. |
||
| } else if (msg_type == NetMsgType::QCOMPLAINT) { | ||
| CDKGComplaint qc; | ||
| s >> qc; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Suggestion: Production min_size clamp is landing in a test-prefixed commit
Commit 439fb7d has subject
test: cover undersized DKG contribution intakebut its diff also editssrc/llmq/net_dkg.cpp: it introducesconst size_t min_size = params.minSize > 0 ? static_cast<size_t>(params.minSize) : 0;and rewrites the intake check to consume that local, replacing the rawstatic_cast<size_t>(params.minSize)that fix commit 35d4480 introduced. That is a defensive production behavior change (clamping negative/zeroparams.minSize) unrelated to the test being added. Because Dash keeps PR commits unsquashed on merge,git log --onelineandgit blameon this consensus-adjacent intake path will report atest:commit for a real code change — a bisect/blame hazard. Two clean options: squash thenet_dkg.cpphunk into 35d4480 so the fix commit is self-contained with its final clamped form, or split it into its own commit (e.g.fix: clamp negative params.minSize in DKG intake check) and leave thetest:commit touching onlytest/functional/feature_llmq_dkg_intake.py.source: ['claude', 'codex']