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

QUIC address translation #2245

Merged
merged 2 commits into from
Nov 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
454 changes: 250 additions & 204 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion crates/sc-consensus-subspace/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ subspace-core-primitives = { version = "0.1.0", path = "../subspace-core-primiti
subspace-proof-of-space = { version = "0.1.0", path = "../subspace-proof-of-space" }
subspace-verification = { version = "0.1.0", path = "../subspace-verification" }
thiserror = "1.0.48"
tokio = { version = "1.32.0", features = ["sync"] }
tokio = { version = "1.34.0", features = ["sync"] }

[dev-dependencies]
# TODO: Restore in the future, currently tests are mostly broken and useless
Expand Down
2 changes: 1 addition & 1 deletion crates/sp-domains-fraud-proof/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ subspace-test-service = { version = "0.1.0", path = "../../test/subspace-test-se
subspace-runtime-primitives = { version = "0.1.0", path = "../../crates/subspace-runtime-primitives" }
substrate-test-runtime-client = { version = "2.0.0", git = "https://github.com/subspace/polkadot-sdk", rev = "892bf8e938c6bd2b893d3827d1093cd81baa59a1" }
tempfile = "3.8.0"
tokio = "1.32.0"
tokio = "1.34.0"

[features]
default = ["std"]
Expand Down
2 changes: 1 addition & 1 deletion crates/subspace-farmer-components/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ subspace-erasure-coding = { version = "0.1.0", path = "../subspace-erasure-codin
subspace-proof-of-space = { version = "0.1.0", path = "../subspace-proof-of-space", features = ["parallel"] }
subspace-verification = { version = "0.1.0", path = "../subspace-verification" }
thiserror = "1.0.48"
tokio = { version = "1.32.0", features = ["macros", "parking_lot", "rt-multi-thread", "signal", "sync"] }
tokio = { version = "1.34.0", features = ["macros", "parking_lot", "rt-multi-thread", "signal", "sync"] }
tracing = "0.1.37"

[target.'cfg(windows)'.dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/subspace-farmer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ substrate-bip39 = "0.4.4"
supports-color = "2.0.0"
tempfile = "3.8.0"
thiserror = "1.0.48"
tokio = { version = "1.32.0", features = ["macros", "parking_lot", "rt-multi-thread", "signal"] }
tokio = { version = "1.34.0", features = ["macros", "parking_lot", "rt-multi-thread", "signal"] }
tracing = "0.1.37"
tracing-subscriber = { version = "0.3.16", features = ["env-filter"] }
ulid = { version = "1.0.0", features = ["serde"] }
Expand Down
8 changes: 5 additions & 3 deletions crates/subspace-networking/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,16 @@ serde_json = "1.0.106"
subspace-core-primitives = { version = "0.1.0", path = "../subspace-core-primitives" }
subspace-metrics = { version = "0.1.0", path = "../../shared/subspace-metrics" }
thiserror = "1.0.48"
tokio = { version = "1.32.0", features = ["macros", "parking_lot", "rt-multi-thread", "sync", "time"] }
tokio = { version = "1.34.0", features = ["macros", "parking_lot", "rt-multi-thread", "sync", "time"] }
tracing = "0.1.37"
tracing-subscriber = { version = "0.3.17", features = ["env-filter"]}
unsigned-varint = { version = "0.7.1", features = ["futures", "asynchronous_codec"] }
void = "1.0.2"

[dependencies.libp2p]
version = "0.53.1"
# TODO: Replace with official release that includes https://github.com/libp2p/rust-libp2p/pull/4896
git = "https://github.com/subspace/rust-libp2p"
rev = "d6339da35589d86bae6ecb25a5121c02f2e5b90e"
default-features = false
features = [
"autonat",
Expand All @@ -72,4 +74,4 @@ features = [

[dev-dependencies]
rand = "0.8.5"
libp2p-swarm-test = "0.3.0"
libp2p-swarm-test = { git = "https://github.com/subspace/rust-libp2p", rev = "d6339da35589d86bae6ecb25a5121c02f2e5b90e" }
2 changes: 0 additions & 2 deletions crates/subspace-networking/src/node_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,6 @@ where
}
};

debug!("Bootstrap started.");
ParthDesai marked this conversation as resolved.
Show resolved Hide resolved

let mut bootstrap_step = 0;
loop {
futures::select! {
Expand Down
15 changes: 7 additions & 8 deletions crates/subspace-networking/src/protocols/autonat_wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,13 @@ impl Behaviour {
}

fn address_corresponds_to_listening_addresses(&self, addr: &Multiaddr) -> bool {
let candidate_protocol = addr
.iter()
.find_map(|protocol| match protocol {
udp @ Protocol::Udp(_) => Some(udp),
tcp @ Protocol::Tcp(_) => Some(tcp),
_ => None,
})
.expect("Either TCP or UDP protocol should be enabled.");
let Some(candidate_protocol) = addr.iter().find_map(|protocol| match protocol {
udp @ Protocol::Udp(_) => Some(udp),
tcp @ Protocol::Tcp(_) => Some(tcp),
_ => None,
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we capture QuicV1 or Quic here now that its properly translated ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not really, quic is the only UDP protocol we use, so the only thing we care about here are TCP/UDP ports to avoid mismatches. If we were pedantic about it we could check the rest, but dealing with a single protocol rather than a list makes code much shorter.

}) else {
return false;
};

let address_result = self
.listen_addresses
Expand Down
2 changes: 1 addition & 1 deletion crates/subspace-node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ subspace-runtime = { version = "0.1.0", path = "../subspace-runtime" }
subspace-runtime-primitives = { version = "0.1.0", path = "../subspace-runtime-primitives" }
subspace-service = { version = "0.1.0", path = "../subspace-service" }
thiserror = "1.0.48"
tokio = "1.32.0"
tokio = "1.34.0"

[build-dependencies]
substrate-build-script-utils = { version = "3.0.0", git = "https://github.com/subspace/polkadot-sdk", rev = "892bf8e938c6bd2b893d3827d1093cd81baa59a1" }
Expand Down
2 changes: 1 addition & 1 deletion crates/subspace-service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ subspace-runtime-primitives = { version = "0.1.0", path = "../subspace-runtime-p
substrate-frame-rpc-system = { version = "4.0.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "892bf8e938c6bd2b893d3827d1093cd81baa59a1" }
substrate-prometheus-endpoint = { git = "https://github.com/subspace/polkadot-sdk", rev = "892bf8e938c6bd2b893d3827d1093cd81baa59a1" }
thiserror = "1.0.48"
tokio = { version = "1.32.0", features = ["sync"] }
tokio = { version = "1.34.0", features = ["sync"] }
tracing = "0.1.37"

sp-session = { version = "4.0.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "892bf8e938c6bd2b893d3827d1093cd81baa59a1" }
Expand Down
2 changes: 1 addition & 1 deletion domains/client/domain-operator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ subspace-core-primitives = { version = "0.1.0", path = "../../../crates/subspace
subspace-runtime-primitives = { version = "0.1.0", path = "../../../crates/subspace-runtime-primitives" }
tracing = "0.1.37"
thiserror = "1.0.48"
tokio = { version = "1.32.0", features = ["macros"] }
tokio = { version = "1.34.0", features = ["macros"] }

[dev-dependencies]
domain-test-service = { version = "0.1.0", path = "../../test/service" }
Expand Down
2 changes: 1 addition & 1 deletion domains/test/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ subspace-test-client = { version = "0.1.0", path = "../../../test/subspace-test-
subspace-test-service = { version = "0.1.0", path = "../../../test/subspace-test-service" }
substrate-frame-rpc-system = { version = "4.0.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "892bf8e938c6bd2b893d3827d1093cd81baa59a1" }
substrate-test-client = { version = "2.0.0", git = "https://github.com/subspace/polkadot-sdk", rev = "892bf8e938c6bd2b893d3827d1093cd81baa59a1" }
tokio = { version = "1.32.0", features = ["macros"] }
tokio = { version = "1.34.0", features = ["macros"] }
tracing = "0.1.37"
2 changes: 1 addition & 1 deletion test/subspace-test-service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ subspace-runtime-primitives = { path = "../../crates/subspace-runtime-primitives
subspace-service = { path = "../../crates/subspace-service" }
subspace-test-client = { path = "../subspace-test-client" }
subspace-test-runtime = { version = "0.1.0", path = "../subspace-test-runtime" }
tokio = "1.32.0"
tokio = "1.34.0"
tracing = "0.1.37"

[dev-dependencies]
Expand Down
Loading