Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set voter to DA attestation #498

Merged
merged 4 commits into from
Nov 2, 2023
Merged

Set voter to DA attestation #498

merged 4 commits into from
Nov 2, 2023

Conversation

youngjoon-lee
Copy link
Contributor

To avoid the following error from libp2p gossipsub (especially with mixnet), we need to set voter to Attestation. In other words, all messages should be differentiated at the upper layer than the network layer, because the network layer (libp2p) doesn't publish/receive duplicate messages. For more details, please see discussions in #497.

2023-10-31T07:37:25.924036Z  WARN libp2p_gossipsub::behaviour: Not publishing a message that has already been published. Msg-id c9babb739f010ce091741e38afb4414f1c1db42b5c263df38eba6b235a596d65
2023-10-31T07:37:25.924072Z ERROR nomos_network::backends::libp2p::swarm: failed to broadcast message to topic: NomosDa Duplicate

I defined Voter under the FullReplication instead of making it generic, because it doesn't need to be used by other services, such as mempool or network. But, please let me know if you think it's better to make it generic.

@@ -69,6 +71,7 @@ impl<A, C> AbsoluteNumber<A, C> {

#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Settings {
pub private_key: [u8; 32],
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this a private key here?

Copy link
Collaborator

Choose a reason for hiding this comment

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

What I mean is that I am not really sure this is the right move. If we are not signing anything here. I think we are not. Just a public key should be enough. is this used to issue the Voter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right. I guessed we're gonna make voter sign on the attestation in the future (same as the consensus_engine::NodeId (== private_key)). But, if it's not (or if it's not determined yet), it may better to accept a voter: [u8; 32] (not even public_key).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll change it and ping you again when it's ready.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@danielSanchezQ Now, we don't involve any "key" concept: 765d5a2. We just accept a voter, which is a [u8; 32], as a parameter. I think this is the simplest approach for now since we don't know yet what we're gonna do with this voter.

Comment on lines 317 to 320
// Using private_key as a voter only for easy deployment.
// It doesn't mean that private_key will be used for anything like signing
// in the FullReplication.
voter: private_key,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we use the public key instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. This can mislead. But, it's not natural to derive a public key from this private key, because we're not assuming any key type for now.

Actually, this argument name should be id (not private_key) because the caller of this function deals with ids (not private_keys):

.

I renamed the argument name: ffc4054.

@@ -188,7 +193,10 @@ impl DaProtocol for FullReplication<AbsoluteNumber<Attestation, Certificate>> {
type Settings = Settings;

fn new(settings: Self::Settings) -> Self {
Self::new(AbsoluteNumber::new(settings.num_attestations))
Self::new(
Copy link
Contributor

Choose a reason for hiding this comment

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

one thing I was thinking is that authentication of the sender is probably orthogonal to the da protocol and we might want to keep them separate. Anyway, for now we don't do any real authentication so this is ok

@youngjoon-lee youngjoon-lee merged commit c3478cf into master Nov 2, 2023
7 checks passed
@youngjoon-lee youngjoon-lee deleted the da-attestation-voter branch February 15, 2024 03:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants