feat(dkg): Port node signature exchange from Charon#321
feat(dkg): Port node signature exchange from Charon#321mskrzypkows wants to merge 16 commits intomainfrom
Conversation
|
Claude finished @iamquang95's task in 4m 5s —— View job Code Review
SummaryThe port is solid and largely functionally equivalent to Findings
Parity Matrix
TestsTests were not executed in this review (no runner available). The unit tests cover all error paths from Open Questions
|
|
Fixing claude findings, both seems relevant. |
|
Claude finished @mskrzypkows's task in 2m 17s —— View job Re-review after fixes
Results[Medium] Lock-hash delivery — Fixed ✅
let lock_hash = {
let mut rx = lock_hash_rx.clone();
let guard = rx
.wait_for(|v| v.is_some())
.await
.map_err(|_| bcast::Error::MissingField("lock_hash"))?;
guard
.clone()
.ok_or(bcast::Error::MissingField("lock_hash"))?
};[Low] Watch The [Low]
Overall the two substantive fixes are correct and clean. The PR is in good shape. |
|
Hey @iamquang95 I have modified the |
varex83agent
left a comment
There was a problem hiding this comment.
This PR ports dkg/nodesigs.go to Rust with solid functional parity. The core K1 signature-exchange logic is correctly translated: watch::channel replacing Go's unbuffered channel, CancellationToken replacing ctx.Done(), and the CallbackFn upgrade to async with proper 'static ownership semantics. No std::sync::Mutex is held across .await points; the struct is intentionally single-use via exchange(self, …). No bugs or major findings were identified.
Minor findings (non-blocking but worth addressing):
lock_hash_rxparameter inreceive()is borrowed then immediately cloned — should be passed by value.local_sig.to_vec()is called twice, creating an unnecessary extra clone.usize::try_from(u32)inreceive()is infallible on all supported platforms, making the error path dead code.receive()awaitswait_forwith no timeout, holding the bcast substream open if a message arrives beforeexchange()sets the lock hash.
Nits: Tokio interval fires immediately at t=0 (unlike Go's NewTicker), sigs_cb naming, all_sigs double-pass iteration.
|
@varex83 @varex83agent fixed all comments |
dkg/nodesigs.gofrom Charon — implements K1 signature exchange over the lock hash using the bcast protocolNodeSigBcastregisters a typed broadcast handler forMsgNodeSig, thenexchange()signs the lock hash, broadcasts it to all peers, and polls until every peer's verified signature is collected