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: remove old version peer from peer store on fork #2849

Merged
merged 1 commit into from
Jul 30, 2021

Conversation

driftluo
Copy link
Collaborator

@driftluo driftluo commented Jul 20, 2021

  1. Remove the behavior of joining the peer store when the session is established, and now only operate the peer store after the identify or feeler is successfully established
  2. After the fork switch, the non-latest version of the node information will be slowly cleaned up, and no longer added to the peer store
  3. Remove unnecessary runtime judgment RefCell

@driftluo driftluo requested a review from a team July 20, 2021 10:03
@keroro520
Copy link
Contributor

Please add a test case to ensure that the staled peers are actually removed.

@keroro520
Copy link
Contributor

If we don't remove the old version peers, will there be security issues?

@driftluo
Copy link
Collaborator Author

driftluo commented Jul 20, 2021

Please add a test case to ensure that the staled peers are actually removed.

check_purge uses the same remove API, I don’t understand what you want to test

If we don't remove the old version peers, will there be security issues?

There are no safety issues, there are efficiency issues

@keroro520
Copy link
Contributor

Please add a test case to ensure that the staled peers are actually removed.

check_purge uses the same remove API, I don’t understand what you want to test

Okay, I see. Why do we not remove old version peers inside check_purge?

@driftluo
Copy link
Collaborator Author

Please add a test case to ensure that the staled peers are actually removed.

check_purge uses the same remove API, I don’t understand what you want to test

Okay, I see. Why do we not remove old version peers inside check_purge?

check_purge only judges the connectivity, not the version. During the fork switch, connectivity cannot filter out the nodes of the old client

@keroro520
Copy link
Contributor

Please add a test case to ensure that the staled peers are actually removed.

check_purge uses the same remove API, I don’t understand what you want to test

Okay, I see. Why do we not remove old version peers inside check_purge?

check_purge only judges the connectivity, not the version. During the fork switch, connectivity cannot filter out the nodes of the old client

Thanks, I do not have any additional questions about it.

keroro520
keroro520 previously approved these changes Jul 20, 2021
@doitian
Copy link
Member

doitian commented Jul 20, 2021

Not sure it is a good idea, since there's a very high probability that most the peers will switch to the fork.

@driftluo
Copy link
Collaborator Author

Not sure it is a good idea, since there's a very high probability that most the peers will switch to the fork.

This is just to clean up unnecessary node information so that it does not make meaningless broadcasts. There is no ban. If the node upgrades the client, it will be added back.

@quake
Copy link
Member

quake commented Jul 22, 2021

This PR title and commit msg is easily misunderstood, suggest remove old version peer from peer store on fork

@driftluo driftluo changed the title feat: remove peer store on fork feat: remove old version peer from peer store on fork Jul 22, 2021
@driftluo driftluo added the s:waiting-on-reviewers Status: Waiting for Review label Jul 23, 2021
@doitian
Copy link
Member

doitian commented Jul 27, 2021

Please add a test case to ensure that the staled peers are actually removed.

check_purge uses the same remove API, I don’t understand what you want to test

If we don't remove the old version peers, will there be security issues?

There are no safety issues, there are efficiency issues

Could you expand this with more details? What's the performance impact if we do not purge the peer store on fork?

@driftluo
Copy link
Collaborator Author

Could you expand this with more details? What's the performance impact if we do not purge the peer store on fork?

The existing peer store rules are based on the detection of whether the session connection is successful. If it succeeds, the node information will be kept in the peer store.

In the fork version, the old and new networks can establish a session, but the corresponding protocol cannot be opened, and the network is isolated through the protocol version.

Formally because the session can be established, there will be a large number of invalid old version node information in the peer store. These data cannot be deleted by the current methods, and the dissemination of these invalid information in the network will result in a significant drop in the efficiency of node discovery

@driftluo driftluo added s:hold Status: Put this issue on hold. and removed s:waiting-on-reviewers Status: Waiting for Review labels Jul 27, 2021
@driftluo driftluo force-pushed the remove-peer-store-on-fork branch from d3c0f26 to 19003f5 Compare July 28, 2021 01:31
@driftluo driftluo requested a review from a team as a code owner July 28, 2021 01:31
@driftluo driftluo force-pushed the remove-peer-store-on-fork branch from 19003f5 to ccada30 Compare July 28, 2021 01:36
@driftluo driftluo added s:waiting-on-reviewers Status: Waiting for Review u:ckb2021 Upgrade: Fork ckb2021 and removed s:hold Status: Put this issue on hold. labels Jul 28, 2021
@yangby-cryptape
Copy link
Collaborator

bors merge=quake,yangby-cryptape

@yangby-cryptape yangby-cryptape removed the s:waiting-on-reviewers Status: Waiting for Review label Jul 30, 2021
@bors
Copy link
Contributor

bors bot commented Jul 30, 2021

Build succeeded:

@bors bors bot merged commit 292921b into nervosnetwork:develop Jul 30, 2021
@driftluo driftluo deleted the remove-peer-store-on-fork branch July 30, 2021 06:33
@doitian doitian mentioned this pull request Aug 10, 2021
3 tasks
@doitian doitian mentioned this pull request Sep 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
u:ckb2021 Upgrade: Fork ckb2021
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants