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

bug: peerStore should update ENRs of existing peers in case they change #2817

Closed
gabrielmer opened this issue Jun 18, 2024 · 0 comments · Fixed by #2818
Closed

bug: peerStore should update ENRs of existing peers in case they change #2817

gabrielmer opened this issue Jun 18, 2024 · 0 comments · Fixed by #2818
Assignees
Labels
bug Something isn't working effort/hours Estimated to be completed in a few hours good first issue Good for newcomers

Comments

@gabrielmer
Copy link
Contributor

Problem

If a peer is added to the peer store and it dynamically changes its ENR, our peer store won't update it. It will currently check that the multiaddress and public key are matched to the peerId and that some ENR is saved. If so, we exit early.

This happens in the following lines in addPeer():

if pm.peerStore[AddressBook][remotePeerInfo.peerId] == remotePeerInfo.addrs and
pm.peerStore[KeyBook][remotePeerInfo.peerId] == remotePeerInfo.publicKey and
pm.peerStore[ENRBook][remotePeerInfo.peerId].raw.len > 0:
trace "peer already managed and ENR info is already saved",
remote_peer_id = $remotePeerInfo.peerId
return

But if ENR changed, we won't update it and still exit early.

We should check if the ENR has changed and if so, update it in the peer store.

@gabrielmer gabrielmer added the bug Something isn't working label Jun 18, 2024
@gabrielmer gabrielmer added effort/hours Estimated to be completed in a few hours good first issue Good for newcomers labels Jun 18, 2024
@gabrielmer gabrielmer self-assigned this Jun 18, 2024
@gabrielmer gabrielmer moved this to In Progress in Waku Jun 18, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in Waku Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working effort/hours Estimated to be completed in a few hours good first issue Good for newcomers
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant