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

Add gossipsub behaviour #70

Merged
merged 4 commits into from
Dec 17, 2024
Merged

Conversation

diegomrsantos
Copy link

@diegomrsantos diegomrsantos commented Dec 11, 2024

Issue Addressed

Adds the Gossipsub Behavior for #17.

Proposed Changes

Adds and configures Gossipsub Behavior according to the spec https://github.com/ssvlabs/ssv-spec/blob/main/p2p/CONFIG.md#pubsub-parameters.

Additional Info

@diegomrsantos diegomrsantos changed the title add gossipsub Add gossipsub behaviour Dec 11, 2024
@diegomrsantos diegomrsantos force-pushed the add-gossipsub branch 4 times, most recently from 441412f to ab6e9ed Compare December 12, 2024 11:20
Copy link
Member

@jxs jxs left a comment

Choose a reason for hiding this comment

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

Thanks for starting this Diego, left a couple comments. CC @AgeManning who probably knows more about the questions raised

// TODO handle gossipsub events
},
// TODO handle other behaviour events
_ => todo!()
Copy link
Member

Choose a reason for hiding this comment

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

nit:

Suggested change
_ => todo!()
_ => {}

otherwise this may panic as soon as it runs, as there will be other events. Same applies for the todo!() below for the other swarm events

Copy link
Author

Choose a reason for hiding this comment

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

Good catch. I had this problem when adding discv5 and I used a log. I applied it here.

Comment on lines +126 to +132
.mesh_n(8) //D
.mesh_n_low(6) // Dlo
.mesh_n_high(12) // Dhi
.mesh_outbound_min(4) // Dout
.heartbeat_interval(Duration::from_millis(700))
.history_length(6)
.history_gossip(4)
Copy link
Member

Choose a reason for hiding this comment

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

should we already introduce the NetworkLoad lighthouse uses?

Copy link
Member

Choose a reason for hiding this comment

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

The network load isn't necessary. It was a nice thing to have to tweak lighthouse (and go off-specification). We probably don't need it in Anchor, unless we are testing network parameters

let duplicate_cache_time = Duration::from_secs(slots_per_epoch * seconds_per_slot); // 6.4 min

let gossip_message_id = move |message: &gossipsub::Message| {
gossipsub::MessageId::from(&Sha256::digest(&message.data)[..20])
Copy link
Member

Choose a reason for hiding this comment

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

we should also have the network related prefixes right?

Copy link
Author

Choose a reason for hiding this comment

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

diegomrsantos and others added 2 commits December 16, 2024 19:00
Co-authored-by: João Oliveira <hello@jxs.pt>
Copy link
Contributor

@jking-aus jking-aus left a comment

Choose a reason for hiding this comment

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

lgtm

@jking-aus jking-aus merged commit 3e023ac into sigp:unstable Dec 17, 2024
9 checks passed
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.

4 participants