feat: implement dkg/frost#366
Conversation
|
Claude finished @iamquang95's task in 3m 35s —— View job Code Review
The implementation is well-structured and closely mirrors the Go source in Critical — Interoperability Gap
In production, Go calls: defHash := fmt.Sprintf("%#x", def.DefinitionHash) // e.g. "0x3a7b..."
runFrostParallel(ctx, tp, ..., defHash)Go's kryptology library takes this string and uses Rust's implementation does: fn dkg_context_byte(dkg_ctx: &str) -> u8 {
dkg_ctx
.parse::<isize>()
.map(|value| value.to_le_bytes()[0])
.unwrap_or_default() // ← silently returns 0 for "0x3a7b..."
}For a real cluster The existing interop fixtures only cover Medium — Code Quality
The private function is identical to Unnecessary clone-then-remove in let mut bcasts = bcasts.clone();
let mut shares = shares.clone();
bcasts.remove(&self.id);
shares.remove(&self.id);The full maps are cloned just to filter out the node's own entry. Since Minor
All public-facing items are
fn point_to_pubkey(point: [u8; 48]) -> Result<PublicKey, FrostError> {
G1Projective::from_compressed(&point).ok_or(FrostError::InvalidPublicKeyPoint)?;
Ok(pubkey_from_bytes(&point)?)
}
Test: The integration test runs with Test: let source_id = bcast.keys().next()
.map(|key| key.source_id)
.ok_or(FrostError::MissingRoundState)?;All entries in OverallThe structure is solid and the port faithfully mirrors the Go implementation. The critical item around |
|
There is no |
varex83agent
left a comment
There was a problem hiding this comment.
This PR implements the FROST DKG orchestration layer (crates/dkg/src/frost.rs) that parallels Go's dkg/frost.go. The implementation is functionally correct and the end-to-end test validates cryptographic correctness via threshold signature aggregation. Two major concerns block merge: the module is not yet wired into dkg.rs and the file-level #![allow(dead_code)] masks this integration gap; and the test transport's Default derive creates a silently broken zero-node state. Several minor findings cover test coverage gaps (no partial-quorum test, degenerate get_round2_inputs test, no cancellation test) and design concerns (FrostError recursive boxing, undocumented invariant in round2). No bugs found in the crypto path; Go parity is confirmed.
| @@ -0,0 +1,691 @@ | |||
| #![allow(dead_code)] | |||
There was a problem hiding this comment.
Integration gap: run_frost_parallel is not yet called from dkg.rs. The Go equivalent is dispatched at dkg/dkg.go:286 inside case "default", "frost":. The module is declared mod frost (private) in lib.rs and #![allow(dead_code)] suppresses the compiler warning, masking this gap entirely. Until dkg.rs dispatches to frost::run_frost_parallel, the entire module is dead in production.
This attribute should be removed once the wiring is in place (or this PR should include the wiring). Landing #![allow(dead_code)] on hand-written code as a permanent state is against Pluto conventions.
There was a problem hiding this comment.
This is not included in this PR. Should be on other PR
varex83agent
left a comment
There was a problem hiding this comment.
The new commit addresses 13 of 14 original findings thoroughly. FTransport: Send + Sync fixed; TransportRound1/2 recursive boxing removed (direct ? propagation); round2 implicit contract documented with an explanatory comment and rewritten as a filter; dkg_context_byte annotated; FrostMemTransport::default() footgun removed; transport counters reset on reuse; partial-quorum test (2-of-3) added; get_round2_inputs test rewritten with realistic multi-source input; all nodes' outputs verified in make_shares test; cancellation test added; scalar_to_secret_share inlined; Round1Output type alias introduced.
One finding remains open: #![allow(dead_code)] is still at line 1 and run_frost_parallel is still not wired into dkg.rs. The module is dead in production. This must be removed before merge — either by wiring the call site or by tracking the gap with a // TODO: and a follow-up issue rather than a file-level lint suppression.
varex83
left a comment
There was a problem hiding this comment.
LGTM overall, few nits and comments
Fix: #254