-
Notifications
You must be signed in to change notification settings - Fork 744
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
authority-discovery: Ignore multi-addresses without IP from DHT records #6545
Open
lexnv
wants to merge
41
commits into
master
Choose a base branch
from
lexnv/authorit-empty-addr
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+312
−75
Open
Changes from 20 commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
a0fca05
authority-discovery: Filter out empty addresses after removing `/p2p/..`
lexnv 3e3e461
authority-discovery: Ignore empty addresses from DHT
lexnv 0724372
authority-discovery/tests: Add test for is empty address
lexnv 7e5aa7b
litep2p: Ignore empty addresses
lexnv 5e71861
litep2p/discovery: Validate empty / no-IP multiaddresses
lexnv f36d749
libp2p/peer_info: Confirm address only if it is valid
lexnv 9e7c867
Add PRdoc
lexnv 109bb1c
peer_info: Downgrade warn to debug logs
lexnv 281e1eb
network/types: Move verification of external addr
lexnv f09e25c
network/types: Ensure peerID functionality
lexnv 3906c57
Use crate::type::Multiaddr shared functionality
lexnv 9061359
authority-discovery: Use is_valid_external_address method
lexnv 52acb47
network/types: Enhance address validation by TCP / UDP protocols
lexnv 6389be9
network: Rename is_valid_external_address
lexnv d109dd7
types/tests: Check empty addresses
lexnv d6da5d4
types/tests: Extensive tests to check the address is valid
lexnv 6372b5f
litep2p: Use new multiaddr functionality
lexnv 0144119
Merge remote-tracking branch 'origin/master' into lexnv/authorit-empt…
lexnv 335e0e8
authority-discovery: Extra checks before publishing addresses
lexnv 19a3c4e
authority-discovery/tests: Test are moved to network/types
lexnv a0243b7
network/types: Move is_global directly on the multiaddr
lexnv 9fe8cff
Merge branch 'master' into lexnv/authorit-empty-addr
lexnv bb5653e
authorit-discovery: Add more logs
lexnv 36ff0c7
types: Do not check peerID implicitely
lexnv 457b4f1
types/tests: Adjust testing
lexnv 45b02e1
Update prdoc
lexnv 7fca2c4
Merge remote-tracking branch 'origin/master' into lexnv/authorit-empt…
lexnv 65ca987
Update PR doc
lexnv dd8e5ec
litep2p: Downgrade warns to debug
lexnv 7ea83f4
Merge branch 'master' into lexnv/authorit-empty-addr
lexnv a5e756d
Merge branch 'master' into lexnv/authorit-empty-addr
lexnv 86cab78
Merge branch 'master' into lexnv/authorit-empty-addr
lexnv 66d47b9
Merge branch 'master' into lexnv/authorit-empty-addr
lexnv 40ebbda
Update from lexnv running command 'prdoc --audience node_dev --bump p…
actions-user d075120
Force CI
lexnv fd1a4b4
Merge branch 'master' into lexnv/authorit-empty-addr
lexnv d22d23f
Merge branch 'master' into lexnv/authorit-empty-addr
lexnv 711f1c3
Merge branch 'master' into lexnv/authorit-empty-addr
bkchr e87378d
Update substrate/client/authority-discovery/Cargo.toml
bkchr b8285bc
Update substrate/client/network/src/litep2p/mod.rs
bkchr fa01496
Update substrate/client/network/src/litep2p/mod.rs
bkchr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
title: Ignore multi-addresses without IP from DHT records | ||
|
||
doc: | ||
- audience: [ Node Dev, Node Operator ] | ||
description: | | ||
This PR ensures that multiaddresses without an IP protocol are not published or utilized from DHT records. | ||
|
||
crates: | ||
- name: sc-network | ||
bump: patch | ||
- name: sc-authority-discovery | ||
bump: patch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -746,13 +746,21 @@ impl<B: BlockT + 'static, H: ExHashT> NetworkBackend<B, H> for Litep2pNetworkBac | |
}; | ||
} | ||
NetworkServiceCommand::AddKnownAddress { peer, address } => { | ||
let mut address: Multiaddr = address.into(); | ||
|
||
if !address.iter().any(|protocol| std::matches!(protocol, Protocol::P2p(_))) { | ||
address.push(Protocol::P2p(litep2p::PeerId::from(peer).into())); | ||
if !address.is_external_address_valid(peer) { | ||
log::warn!( | ||
target: LOG_TARGET, | ||
"ignoring invalid external address {address} for {peer:?}", | ||
); | ||
continue | ||
} | ||
|
||
if self.litep2p.add_known_address(peer.into(), iter::once(address.clone())) == 0usize { | ||
let Some(address) = address.clone().ensure_peer_id(peer) else { | ||
log::warn!( | ||
target: LOG_TARGET, | ||
"ignoring address ({address}) with different peer ID {peer:?}", | ||
); | ||
continue | ||
}; | ||
if self.litep2p.add_known_address(peer.into(), iter::once(address.clone().into())) == 0usize { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With this PR deployed, we receive the following warnings for adding addresses (only on Kusama validators):
All warnings coming from this are related to addresses pointing to the localhost. Will let this deployment run for a bit and then I believe its safe to turn these into debug |
||
log::warn!( | ||
target: LOG_TARGET, | ||
"couldn't add known address ({address}) for {peer:?}, unsupported transport" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will downgrade to debug after more testing, here and below