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

chore: saving peers enr capabilities #3127

Merged
merged 16 commits into from
Oct 24, 2024

Conversation

gabrielmer
Copy link
Contributor

@gabrielmer gabrielmer commented Oct 17, 2024

Description

When adding peers, we used to ignore the protocols advertised in the ENR and would fill the protocols in the Peer Store only after performing Identify.

We're now initializing the protocols with the advertised capabilities and will get updated once Identify is performed.
When mapping the ENR's capabilities to the supported protocols, we assume that the peers use the same version of the protocol as ours. If that's not the case, we'll find out during Identify, update the information and act accordingly.

In addition to that, started adding the Discv5 bootstrap nodes to the Peer Store.

I moved all the Waku protocols codec definitions to a separate file, as in the current state we had to import most of a protocol even if we only needed a codec, which caused circular dependency issues. Protocol codecs are public information, so it makes sense to be able to access them without having to import an entire protocol :)

Changes

  • created new file with Waku Protocols' codecs
  • reading ENRs' capabilities and using them to fill the supported protocols when building the RemotePeerInfo
  • only attempt Relay connections to bootstrap nodes when Relay is enabled
  • adding Discv5 bootstrap nodes to the Peer Store
  • including tests for the new functionalities

Copy link

github-actions bot commented Oct 17, 2024

You can find the image built from this PR at

quay.io/wakuorg/nwaku-pr:3127

Built from a8eb49e

@gabrielmer gabrielmer changed the title chore: saving pers enr capabilities chore: saving peers enr capabilities Oct 17, 2024
@gabrielmer gabrielmer force-pushed the chore-saving-pers-enr-capabilities branch from f642319 to 8b4f6f6 Compare October 18, 2024 08:32
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Had to move some variables around as many were unnecessary in a global scope and gave issues related to GC safety.

Also, changed the validEnr value because apparently that ENR was missing fields

Copy link
Collaborator

@Ivansete-status Ivansete-status left a comment

Choose a reason for hiding this comment

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

Outstanding one! Thanks :) !

tests/test_waku_enr.nim Outdated Show resolved Hide resolved
tests/waku_core/test_peers.nim Outdated Show resolved Hide resolved
waku/factory/node_factory.nim Outdated Show resolved Hide resolved
waku/factory/node_factory.nim Outdated Show resolved Hide resolved
@gabrielmer gabrielmer force-pushed the chore-saving-pers-enr-capabilities branch from eb1fa68 to cf24b36 Compare October 24, 2024 09:06
Copy link
Contributor

@NagyZoltanPeter NagyZoltanPeter left a comment

Choose a reason for hiding this comment

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

LGTM! Awesome, thank you.

@gabrielmer gabrielmer merged commit 69d9524 into master Oct 24, 2024
9 of 11 checks passed
@gabrielmer gabrielmer deleted the chore-saving-pers-enr-capabilities branch October 24, 2024 12:31
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.

3 participants