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

feat(gossipsub): support version 1.2.0 #1106

Merged
merged 7 commits into from
Jun 12, 2024
Merged

feat(gossipsub): support version 1.2.0 #1106

merged 7 commits into from
Jun 12, 2024

Conversation

diegomrsantos
Copy link
Collaborator

@diegomrsantos diegomrsantos commented May 27, 2024

  • Support GossipSub 1.2 in the code
  • Add utility template template exclIfIt*[T](set: var HashSet[T], condition: untyped)
  • Renaming

closes #1102

@kaiserd kaiserd mentioned this pull request Jun 3, 2024
@kaiserd
Copy link
Collaborator

kaiserd commented Jun 3, 2024

addresses issue #1102

@diegomrsantos diegomrsantos force-pushed the gossipsub12 branch 4 times, most recently from dd65502 to 64f7ad8 Compare June 4, 2024 18:42
@diegomrsantos diegomrsantos marked this pull request as ready for review June 4, 2024 18:46
@diegomrsantos diegomrsantos changed the title Gossipsub12 feat(gossipsub): support version 1.2.0 Jun 4, 2024
@diegomrsantos
Copy link
Collaborator Author

diegomrsantos commented Jun 5, 2024

This PR depends on this being fixed #1115, if we want to send idontwant only to peers that support 1.2.

@diegomrsantos
Copy link
Collaborator Author

diegomrsantos commented Jun 5, 2024

  • Send idontwant only to peers that support GossipSub 1.2

This will be moved to a new PR cause of #1115.

@diegomrsantos diegomrsantos force-pushed the gossipsub12 branch 3 times, most recently from c44a9ea to dbfbc65 Compare June 5, 2024 11:49
@lchenut
Copy link
Collaborator

lchenut commented Jun 6, 2024

I'm not an expert on GS by any means, but I'm expecting something like if GossipSubCodec_12 in g.codecs: # do something GS1.2 related. From what I understand, we just add the codecs (which needed to be done) but there's no difference between GossipSubCodec_10, GossipSubCodec_11 and GossipSubCodec_12.

@diegomrsantos
Copy link
Collaborator Author

I'm not an expert on GS by any means, but I'm expecting something like if GossipSubCodec_12 in g.codecs: # do something GS1.2 related. From what I understand, we just add the codecs (which needed to be done) but there's no difference between GossipSubCodec_10, GossipSubCodec_11 and GossipSubCodec_12.

I believe g.codecs are the versions supported by the current code, instead of the one negotiated with the peer - pubsubpeer.codec. Behaving like 1.2 - sending idontwant - will be implemented in a new PR as mentioned here: #1106 (comment).

It seems that our current code can negotiate 1.0 but will still behave like 1.1, as there's no check on how the protocol should behave depending on the version negotiated with a remote peer.

@@ -26,9 +26,9 @@ type

proc getPubSubPeer*(p: TestGossipSub, peerId: PeerId): PubSubPeer =
proc getConn(): Future[Connection] =
p.switch.dial(peerId, GossipSubCodec)
p.switch.dial(peerId, GossipSubCodec_12)
Copy link
Collaborator

Choose a reason for hiding this comment

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

What happens if dialing 1.2.0 fails? Should we attempt to dial with a lower version?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is only for tests. Production code tries all versions.

@diegomrsantos diegomrsantos merged commit 96bfefc into master Jun 12, 2024
10 checks passed
@diegomrsantos diegomrsantos deleted the gossipsub12 branch June 12, 2024 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: done
Development

Successfully merging this pull request may close these issues.

Support gossipsub 1.2.0
4 participants