Skip to content

feat: add dkg/exchanger #350

Open
varex83 wants to merge 32 commits intomainfrom
bohdan/dkg-exchanger
Open

feat: add dkg/exchanger #350
varex83 wants to merge 32 commits intomainfrom
bohdan/dkg-exchanger

Conversation

@varex83
Copy link
Copy Markdown
Collaborator

@varex83 varex83 commented Apr 23, 2026

No description provided.

@emlautarom1 emlautarom1 self-requested a review April 23, 2026 11:58
Copy link
Copy Markdown
Collaborator

@emlautarom1 emlautarom1 left a comment

Choose a reason for hiding this comment

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

LGTM, some small comments on some improvements to the tests.

Comment thread crates/dkg/src/exchanger.rs Outdated
Comment on lines +169 to +170
let sig_types = sig_types.clone();
let st = st.clone();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: This matches Charon but I don't understand why we need the same data as Vec and HashSet (we do a contains in both cases).

Comment thread crates/dkg/src/exchanger.rs Outdated
.await
.subscribe_internal(sub)
.await
.expect("subscribe_internal is infallible");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why did we make subscribe_internal return a Result if it's infallible? Can we update its definition?

Comment thread crates/dkg/src/exchanger.rs Outdated
Comment thread crates/dkg/src/exchanger.rs Outdated
@emlautarom1 emlautarom1 linked an issue Apr 23, 2026 that may be closed by this pull request
Comment on lines +260 to +262
if !self.sig_types.contains(&sig_type) {
return Err(ExchangerError::UnrecognisedSigType(sig_type));
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This check seems not correct.
As dkg.go they will call SIG_DEPOSIT_DATA + i (https://github.com/ObolNetwork/charon/blob/v1.7.1/dkg/dkg.go#L701)

peerSigs, err := ex.exchange(ctx, sigType(int(sigDepositData)+i), parSig)

But the newExchanger, they only register the sigDepositData
https://github.com/ObolNetwork/charon/blob/v1.7.1/dkg/dkg.go#L242-L246

ex := newExchanger(p2pNode, nodeIdx.PeerIdx, peerIDs, []sigType{
		sigLock,
		sigDepositData,
		sigValidatorRegistration,
	}, conf.Timeout)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Also golang doesn't have that check

Comment on lines +260 to +262
if !self.sig_types.contains(&sig_type) {
return Err(ExchangerError::UnrecognisedSigType(sig_type));
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Also golang doesn't have that check

let handle = handle_clone.clone();
async move {
if let Err(e) = handle.broadcast(duty, set).await {
warn!(error = %e, "Failed to broadcast partial signatures during DKG");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

One thing I worry about with the rust libp2p design is how we can manage to handle "enough" fail events at the swarm level.

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.

Implement dkg/exchanger

4 participants