Skip to content

Rust DKG/reshare orchestration over the new session runtime - #178

Merged
Mearman merged 4 commits into
mainfrom
feat/rust-dkg-reshare-orchestration
Sep 18, 2026
Merged

Mearman merged 4 commits into
mainfrom
feat/rust-dkg-reshare-orchestration

Conversation

@Mearman

@Mearman Mearman commented Sep 17, 2026

Copy link
Copy Markdown
Member

Builds the Rust equivalents of threshold-dkg.ts's runFreshThresholdDkg/computeReshareContribution/sendReshareContribution/joinThresholdReshare (wire_mesh_threshold::keygen_network), driving the crate's existing dkg/reshare round functions over real manage-request traffic via the same ManageRequestSender contract network.rs already uses for signing.

Since Session (wire-mesh#173) is scoped to one already-established connection rather than TS's single addressable mesh session, a device running a ceremony among N peers holds N per-peer collectors fed by plain handle_keygen_round1/round2/confirm functions; a caller's own ManageRequestHandler dispatches into them, exactly the pattern tests/session_runtime_network.rs already established for threshold signing. The collectors themselves are a hand-rolled Future over a std::sync::Mutex rather than tokio::sync::oneshot, keeping wire-mesh-threshold's [dependencies] runtime-free so wire-mesh-threshold-wasm's wasm32-unknown-unknown build stays unaffected.

Proven end to end exactly as #173 did for signing: tests/keygen_network_session.rs runs a fresh 2-of-3 DKG across three real TCP connections (A, B, C), reshares to a different 2-of-3 committee that drops C and adds a brand-new device D, then signs with B and D -- who never held a share together before the reshare -- and verifies the aggregate signature against the ORIGINAL group's public key.

Closes #177

Drive wire-mesh-threshold's existing dkg/reshare round functions over
real manage-request traffic, matching threshold-dkg.ts's own
choreography: round1 broadcast, round2 pairwise exchange, round3 local
computation, and an echo-broadcast confirm round; resharing's own
asymmetry where only survivors deal and every member of the new
participant set independently derives and confirms.

Since Session (wire-mesh#173) is scoped to one already-established
connection rather than TS's single addressable mesh session, this
orchestration layer holds one PerDeviceCollector per round (round1,
round2, confirm) keyed by peer device-id, fed by plain
handle_keygen_round1/round2/confirm functions a caller's own
ManageRequestHandler dispatches into. Those functions, and the
collectors themselves, stay free of any dependency on
wire_mesh_core::domain::session (a "net"-gated module) by implementing
PerDeviceCollector's async wait as a hand-rolled Future over a plain
std::sync::Mutex rather than a tokio::sync::oneshot -- keeping
wire-mesh-threshold's own [dependencies] runtime-free, matching the
existing constraint that wire-mesh-threshold-wasm's wasm32-unknown-unknown
build needs wire-mesh-core's "net" feature off to succeed at all.
…tion

Exercise run_fresh_threshold_dkg, compute/send_reshare_contribution, and
join_threshold_reshare over an in-process ManageRequestSender that
dispatches directly into a peer's own collectors, covering a 3-party
fresh DKG, a reshare to a different committee (one device dropped, one
added) verified by signing against the original group key, and a
tampered confirm digest aborting only the receiving device.

WIP: the reshare/tamper tests currently hang under cargo test and need
further debugging before this is safe to merge.
…ommittee

The reshare test previously modelled survivor 2 as leaving the new
committee (only running contribute_threshold_reshare) while also
listing it in new_participants, so survivor 1 and the new device would
send survivor 2 a keygen-confirm and then wait forever for a confirm
back that a non-joining device never sends. Both remaining survivors
now run compute_reshare_contribution + send_reshare_contribution +
join_threshold_reshare concurrently, matching the actual "one dropped,
one added" scenario wire-mesh#177 asks for, where neither retained
survivor ever leaves the committee.
…ssions

End-to-end proof that keygen_network's orchestration drives real
Session/HandlerRegistry dispatch, matching the discipline
session_runtime_network.rs already established for threshold signing:
a fresh 2-of-3 DKG across three real TCP connections (A, B, C), then a
reshare to a different 2-of-3 committee that drops C and adds a
brand-new device D, then signing with the reshared committee (B and D,
who never held a share together before the reshare) and verifying the
aggregate signature against the ORIGINAL group's public key.

Each phase establishes its own fresh connections rather than reusing
one across phases, since a Session's HandlerRegistry is fixed at
accept time and the signing phase's handler needs the post-reshare
KeyPackage, which does not exist yet when the reshare's own
connections are first accepted.
@Mearman
Mearman marked this pull request as ready for review September 18, 2026 01:36
@Mearman
Mearman merged commit 0b7e043 into main Sep 18, 2026
7 checks passed
@Mearman
Mearman deleted the feat/rust-dkg-reshare-orchestration branch September 18, 2026 01:36
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 18, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review Completed 2026-09-18T01:46:22.119165Z 35e3bf2 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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.

Rust DKG/reshare orchestration over the new session runtime

1 participant