Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Purge addresses that fail to reach a peer #8843

Merged
merged 3 commits into from
Sep 13, 2021
Merged

Conversation

tomaka
Copy link
Contributor

@tomaka tomaka commented May 18, 2021

So far, the add_known_address method of the networking was meant to be used to inject addresses that are permanent. In other words, addresses for reserved nodes or bootnodes that the user has explicitly configured.

However, Polkadot now uses this method to add the addresses reported by the authority-discovery system. In other words, addresses reported by the nodes themselves.
Before this PR, these addresses would never be purged. After this PR, addresses that fail to connect to someone will be removed and not tried again until they are re-added.

cc paritytech/polkadot-sdk#540

This PR is sub-optimal, so I don't think we should be closing paritytech/polkadot-sdk#540. I'm doing this change to try to quickly improve the situation with parachains.
Ideally, we would have a proper story for addresses management, including properly documenting the behaviour, and removing addresses for peers whose reputation drops to 0, but these are way bigger changes.

@tomaka tomaka added A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. labels May 18, 2021
@tomaka tomaka added this to the polkadot v0.9.2 milestone May 18, 2021
@tomaka tomaka requested a review from kpp May 18, 2021 07:24
@@ -287,12 +291,14 @@ impl DiscoveryBehaviour {
///
/// If we didn't know this address before, also generates a `Discovered` event.
pub fn add_known_address(&mut self, peer_id: PeerId, addr: Multiaddr) {
if self.user_defined.iter().all(|(p, a)| *p != peer_id && *a != addr) {
let addrs_list = self.ephemeral_addresses.entry(peer_id).or_default();
if !addrs_list.iter().any(|a| *a == addr) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why you don't check in permanent_addresses too?

Copy link
Contributor

Choose a reason for hiding this comment

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

@tomaka ping

@tomaka tomaka removed this from the polkadot v0.9.2 milestone May 19, 2021
@stale
Copy link

stale bot commented Jul 7, 2021

Hey, is anyone still working on this? Due to the inactivity this issue has been automatically marked as stale. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the A5-stale Pull request did not receive any updates in a long time. No review needed at this stage. Close it. label Jul 7, 2021
@tomaka
Copy link
Contributor Author

tomaka commented Jul 8, 2021

Yeah, this was just waiting to be merged.

@stale stale bot removed the A5-stale Pull request did not receive any updates in a long time. No review needed at this stage. Close it. label Jul 8, 2021
@tomaka
Copy link
Contributor Author

tomaka commented Jul 8, 2021

bot merge

@ghost
Copy link

ghost commented Jul 8, 2021

Waiting for commit status.

@ghost
Copy link

ghost commented Jul 8, 2021

Merge failed: Could not recover from: "At least 2 approving reviews are required by reviewers with write access." due to: Requester's approval is not enough to make the PR mergeable

Copy link
Contributor

@0x7CFE 0x7CFE left a comment

Choose a reason for hiding this comment

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

LGTM

client/network/src/discovery.rs Show resolved Hide resolved
@stale
Copy link

stale bot commented Aug 29, 2021

Hey, is anyone still working on this? Due to the inactivity this issue has been automatically marked as stale. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the A5-stale Pull request did not receive any updates in a long time. No review needed at this stage. Close it. label Aug 29, 2021
@gilescope gilescope removed the A5-stale Pull request did not receive any updates in a long time. No review needed at this stage. Close it. label Aug 29, 2021
@kpp
Copy link
Contributor

kpp commented Aug 30, 2021

Yes

@bkchr
Copy link
Member

bkchr commented Sep 8, 2021

@kpp could you merge master so that we can merge this pr?

@kpp
Copy link
Contributor

kpp commented Sep 9, 2021

Yes. In an hour

@bkchr
Copy link
Member

bkchr commented Sep 9, 2021

bot merge

@ghost
Copy link

ghost commented Sep 9, 2021

Waiting for commit status.

@bkchr
Copy link
Member

bkchr commented Sep 9, 2021

ty @kpp

@ghost
Copy link

ghost commented Sep 9, 2021

Merge aborted: Checks failed for 9dba155

@bkchr
Copy link
Member

bkchr commented Sep 9, 2021

bot merge

@ghost
Copy link

ghost commented Sep 9, 2021

Waiting for commit status.

@ghost
Copy link

ghost commented Sep 9, 2021

Merge aborted: Checks failed for 9dba155

@bkchr bkchr merged commit 6120eda into paritytech:master Sep 13, 2021
@tomaka tomaka deleted the purge-addrs branch September 13, 2021 11:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants