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] Re-registered peer not reflected until restart #5286

Open
s8sato opened this issue Jan 20, 2025 · 4 comments
Open

[BUG] Re-registered peer not reflected until restart #5286

s8sato opened this issue Jan 20, 2025 · 4 comments
Assignees
Labels
Bug Something isn't working

Comments

@s8sato
Copy link
Contributor

s8sato commented Jan 20, 2025

When a peer is registered, unregistered, and registered again to a network, the peer has to restart for the network to update.

OS and Environment

Linux, Docker Hub

GIT commit hash

27d9f85

Minimum working example / Steps to reproduce

See description on the test branch

Actual result

See description on the test branch

Expected result

See description on the test branch

Logs

See description on the test branch

Who can help to reproduce?

@s8sato

Notes

@s8sato s8sato added the Bug Something isn't working label Jan 20, 2025
@aoyako aoyako self-assigned this Jan 24, 2025
@aoyako
Copy link
Contributor

aoyako commented Jan 27, 2025

Issue:

It seems that after unregistering, a peer is removed from the online_peers list, causing a loss of connection.
Peer restart helps because, during setup, the peer requests the genesis block from trusted peers.

Potential Solutions:

  1. Add the peer to online_peers when it is registered.
    • This might break invariants on online_peers and cause delays if the registered peer is offline.
  2. If a peer is not connected to anything, it should attempt to connect to trusted peers.
    • However, if trusted peers are also offline, the peer will remain unconnected.
  3. Ignore this case.

My Opinion:
This issue may occur if a peer is mistakenly removed and then re-added.
Therefore, I find the first approach more favorable despite its risks.

@s8sato
Copy link
Contributor Author

s8sato commented Jan 28, 2025

after unregistering, a peer is removed from the online_peers list, causing a loss of connection

I think this is an expected behavior. The issue would be the difference between the first and subsequent registrations

  1. Add the peer to online_peers when it is registered.

I think p2p already tries to do this according to the world having the new peer

@aoyako
Copy link
Contributor

aoyako commented Jan 29, 2025

I was wrong originally. Method 1 won't apply because peer registration takes only a key, not the actual address of the peer. In that case, option 2 is viable.

@s8sato
Copy link
Contributor Author

s8sato commented Jan 30, 2025

option 2 is viable

After being unregistered and loosing online peers, I expect, the peer should try to connect to other peers stored in the world, and after being re-registered it should restore connections. But the actual behavior doesn't seem to be that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants