Skip to content

dkg/bcast: bind broadcast signatures to cluster session - #4638

Merged
pinebit merged 2 commits into
mainfrom
pinebit/dkg-bcast-session-binding
Aug 12, 2026
Merged

dkg/bcast: bind broadcast signatures to cluster session#4638
pinebit merged 2 commits into
mainfrom
pinebit/dkg-bcast-session-binding

Conversation

@pinebit

@pinebit pinebit commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Bind reliable-broadcast signatures to the cluster session and message ID. Previously the signed hash covered only the protobuf type URL and value, so signatures stayed valid across DKG sessions and message IDs, allowing replay of captured messages into other ceremonies of the same cluster.

The signed hash is now the length-prefixed sha256 of (session hash, message ID, type URL, value). The initial DKG binds the definition hash; the add/remove/replace-operator and reshare protocols bind the lock hash, which changes with every cluster mutation, so messages from earlier ceremonies of the same cluster fail verification. The bcast libp2p protocol ID is bumped to 2.0.0 so mixed-version peers fail at stream negotiation instead of at signature verification.

category: bug
ticket: none

Bind reliable-broadcast signatures to the cluster session and message
ID. Previously the signed hash covered only the protobuf type URL and
value, so signatures remained valid across DKG sessions and message
IDs, allowing replay of captured messages into other ceremonies.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@pinebit
pinebit requested a review from KaloyanTanev August 10, 2026 16:16
@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 79.16667% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.17%. Comparing base (aea5631) to head (8129606).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
dkg/bcast/impl.go 75.00% 2 Missing and 2 partials ⚠️
dkg/dkg.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4638      +/-   ##
==========================================
+ Coverage   58.16%   58.17%   +0.01%     
==========================================
  Files         247      247              
  Lines       34056    34087      +31     
==========================================
+ Hits        19807    19829      +22     
- Misses      11779    11784       +5     
- Partials     2470     2474       +4     

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

Pull request overview

This PR hardens the DKG reliable-broadcast (bcast) signing scheme by binding signatures to a cluster session identifier and the message ID, preventing replay of captured bcast messages across DKG ceremonies within the same cluster.

Changes:

  • Bind bcast hashes/signatures to (session_hash, msg_id, type_url, value) using length-prefixing to avoid concatenation ambiguity.
  • Thread the session hash into all DKG bcast instantiations (definition hash for initial DKG; lock hash for mutation ceremonies).
  • Bump the libp2p bcast protocol ID to /charon/dkg/bcast/2.0.0 and add tests for session-hash mismatch and hashing behavior.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
dkg/protocolsteps_internal_test.go Updates test bcast construction to pass the session hash.
dkg/protocol_reshare.go Binds reshare bcast signatures to the lock hash (session).
dkg/protocol_replaceoperator.go Binds replace-operator bcast signatures to the lock hash (session).
dkg/protocol_removeoperators.go Binds remove-operators bcast signatures to the lock hash (session).
dkg/protocol_addoperators.go Binds add-operators bcast signatures to the lock hash (session).
dkg/pedersen/testutils.go Passes the session into bcast for pedersen test boards.
dkg/nodesigs_internal_test.go Updates node signature exchange tests to provide a session hash.
dkg/dkg.go Passes definition hash as the initial DKG session hash to bcast.
dkg/bcast/server.go Includes message ID in hashing during signature request handling.
dkg/bcast/impl.go Adds session-bound hashing and plumbs hash function through signing/verification.
dkg/bcast/impl_test.go Updates tests for new constructor signature and adds session mismatch coverage.
dkg/bcast/impl_internal_test.go Adds internal unit test for new session/message-id bound hashing behavior.
dkg/bcast/helpers.go Bumps bcast protocol ID to v2.0.0 and updates hashFunc signature.
dkg/bcast/client.go Includes message ID in the client-side hashing for signing/verification.

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

Comment thread dkg/bcast/impl.go
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@pinebit
pinebit enabled auto-merge (squash) August 12, 2026 11:46
@pinebit
pinebit merged commit 4a69578 into main Aug 12, 2026
10 checks passed
@pinebit
pinebit deleted the pinebit/dkg-bcast-session-binding branch August 12, 2026 11:59
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.

3 participants