Skip to content

dkg/pedersen: buffer channels to not drop early bundles - #4683

Open
KaloyanTanev wants to merge 2 commits into
mainfrom
kalo/dkg-buffer-early-bundles
Open

dkg/pedersen: buffer channels to not drop early bundles#4683
KaloyanTanev wants to merge 2 commits into
mainfrom
kalo/dkg-buffer-early-bundles

Conversation

@KaloyanTanev

Copy link
Copy Markdown
Collaborator

Bundles from peers ahead in the ceremony arrive before this node's kyber protocol starts reading the board channels; the unbuffered channels drop them once the 5s p2p request context expires, and they are never redelivered (SendAsync is fire-and-forget, and the dedup map records bundles before delivery). The node then evicts the affected dealers during justifications (Public polynomial missing) and aborts with only N/M valid deals, as seen in a real replace-operator ceremony.

Buffer the deal/response/justification channels to cluster size and forget dropped bundles in the dedup map so a redelivery is accepted.

category: bug
ticket: #4682

@KaloyanTanev KaloyanTanev self-assigned this Sep 4, 2026
@KaloyanTanev
KaloyanTanev requested a lite review from Copilot September 4, 2026 08:12
@KaloyanTanev KaloyanTanev changed the title dkg/pedersen: buffer bundle channels to avoid dropping early bundles dkg/pedersen: buffer channels to not drop early bundles Sep 4, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The change directly addresses the documented root cause with minimal surface-area impact and includes targeted regression tests for the primary failure mode.

Pull request overview

Fixes a Pedersen DKG reliability issue where p2p-delivered deal/response/justification bundles can arrive before Kyber starts reading board channels, causing unbuffered-channel delivery to block until the receive context expires and the bundle is dropped (and previously also permanently deduped).

Changes:

  • Buffer the incoming bundle channels (dealCh, responseCh, justificationCh) to config.Nodes() so early bundles queue until Kyber starts consuming them.
  • On context-expired drops, remove the bundle from the dedup “seen” set so a later redelivery isn’t rejected as a duplicate.
  • Add internal tests covering early deal buffering and acceptance of redelivery after an intentional drop.
File summaries
File Description
dkg/pedersen/board.go Buffers bundle channels and adds bundleDedup.forget to allow redelivery after context-expired drops.
dkg/pedersen/board_internal_test.go Adds focused regression tests for early deal buffering and redelivery after drop.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread dkg/pedersen/board.go
@sonarqubecloud

sonarqubecloud Bot commented Sep 4, 2026

Copy link
Copy Markdown

@codecov

codecov Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.38%. Comparing base (071b0d0) to head (c8ddc81).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4683      +/-   ##
==========================================
- Coverage   65.38%   65.38%   -0.01%     
==========================================
  Files         247      247              
  Lines       29983    29990       +7     
==========================================
+ Hits        19605    19609       +4     
- Misses      10377    10380       +3     
  Partials        1        1              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No unresolved issues were identified in the reviewed changes.

Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

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.

2 participants