-
Notifications
You must be signed in to change notification settings - Fork 12
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
Conversation
441412f
to
ab6e9ed
Compare
ab6e9ed
to
9329c3d
Compare
There was a problem hiding this 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
anchor/network/src/network.rs
Outdated
// TODO handle gossipsub events | ||
}, | ||
// TODO handle other behaviour events | ||
_ => todo!() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
_ => 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
There was a problem hiding this comment.
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.
.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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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]) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the spec doesn't mention it https://github.com/ssvlabs/ssv-spec/blob/main/p2p/CONFIG.md#msg-id
Co-authored-by: João Oliveira <hello@jxs.pt>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
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
Outbound Queue Size
,Validation Queue Size
andValidation Throttle
defined in https://github.com/ssvlabs/ssv-spec/blob/main/p2p/CONFIG.md#pubsub-parameters don't have a clear equivalent to public Gossipsub parameters. They might be related to internal parameters and are ignored for now.Topic Message Validator
andSubscription Filter
are ignored for now.