Skip to content

Commit

Permalink
[types/network] Enforce canonical format for NetworkAddresses
Browse files Browse the repository at this point in the history
Enforcing a canonical structure for struct NetworkAddresses.
The following oredring is enforced:

1. Network - ipX/DNS/Memory
2. Transpot - TCP
3. Session - Noise
4. Presentation - Handshake

Closes: aptos-labs#1182
  • Loading branch information
Alex Markuze authored and aptos-bot committed Jun 7, 2022
1 parent 93f81c4 commit 4ce8545
Show file tree
Hide file tree
Showing 23 changed files with 249 additions and 184 deletions.
12 changes: 6 additions & 6 deletions config/management/src/validator_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ pub fn build_validator_config_transaction<S: KVStorage + CryptoStorage>(
.and_then(to_x25519)?;

// Build Validator address including protocols and encryption
// Append ln-noise-ik and ln-handshake protocols to base network addresses
// Append noise-ik and handshake protocols to base network addresses
// and encrypt the validator address.
let validator_address =
validator_address.append_prod_protos(validator_network_key, HANDSHAKE_VERSION);
Expand Down Expand Up @@ -226,18 +226,18 @@ mod tests {
#[test]
fn test_invalid_inputs() {
let no_port = NetworkAddress::from_str("/ip4/127.0.0.1").unwrap();
let no_ip = NetworkAddress::from_str("/tcp/1234").unwrap();
let _no_ip = NetworkAddress::from_str("/tcp/1234").unwrap_err();
let ipv6 = NetworkAddress::from_str("/dns6/localhost").unwrap();
let ipv4_and_ipv6 = NetworkAddress::from_str("/dns/localhost").unwrap();
let bad_protocol = NetworkAddress::from_str("/ln-handshake/0").unwrap();
let _bad_protocol = NetworkAddress::from_str("/handshake/0").unwrap_err();
let ip_in_dns = NetworkAddress::from_str("/dns4/127.0.0.1/tcp/1234").unwrap();

//The Network layer is the first in the stack -- address cration allows empty next layers
validate_address("no_port", &no_port).expect_err("Failed to check for port");
validate_address("no_ip", &no_ip).expect_err("Failed to check for no IP");
//Currently NetworkAddress doesnt disallow ipv6
validate_address("ipv6", &ipv6).expect_err("Failed to check for ipv6");
validate_address("ipv4_and_ipv6", &ipv4_and_ipv6).expect_err("Failed to check for ipv6");
validate_address("bad_protocol", &bad_protocol)
.expect_err("Failed to check for bad protocol");
//TODO: Add this check in NetworkAddress Creation
validate_address("ip_in_dns", &ip_in_dns).expect_err("Failed to check for ip in DNS");
}

Expand Down
2 changes: 1 addition & 1 deletion config/src/config/test_data/validator_full_node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ full_node_networks:
seeds:
00000000000000000000000000000000d58bc7bb154b38039bc9096ce04e1237:
addresses:
- "/ip4/127.0.0.1/tcp/6181/ln-noise-ik/f0274c2774519281a8332d0bb9d8101bd58bc7bb154b38039bc9096ce04e1237/ln-handshake/0"
- "/ip4/127.0.0.1/tcp/6181/noise-ik/f0274c2774519281a8332d0bb9d8101bd58bc7bb154b38039bc9096ce04e1237/handshake/0"
role: "Validator"
api:
enabled: true
2 changes: 1 addition & 1 deletion config/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pub fn get_available_port_in_multiaddr(is_ipv4: bool) -> NetworkAddress {
} else {
Protocol::Ip6("::1".parse().unwrap())
};
NetworkAddress::from(ip_proto).push(Protocol::Tcp(get_available_port()))
NetworkAddress::from_protocols(vec![ip_proto, Protocol::Tcp(get_available_port())]).unwrap()
}

pub fn get_genesis_txn(config: &NodeConfig) -> Option<&Transaction> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,12 @@ Share your FullNode static network identity in the following format in the Disco
<Peer_ID>:
addresses:
# with DNS
- "/dns4/<DNS_Name>/tcp/<Port_Number>/ln-noise-ik/<Public_Key>/ln-handshake/0"
- "/dns4/<DNS_Name>/tcp/<Port_Number>/noise-ik/<Public_Key>/handshake/0"
role: Upstream
<Peer_ID>:
addresses:
# with IP
- "/ip4/<IP_Address>/tcp/<Port_Number>/ln-noise-ik/<Public_Key>/ln-handshake/0"
- "/ip4/<IP_Address>/tcp/<Port_Number>/noise-ik/<Public_Key>/handshake/0"
role: Upstream
```

Expand All @@ -193,11 +193,11 @@ Share your FullNode static network identity in the following format in the Disco
```
B881EA2C174D8211C123E5A91D86227DB116A44BB345A6E66874F83D8993F813:
addresses:
- "/dns4/pfn0.node.devnet.aptoslabs.com/tcp/6182/ln-noise-ik/B881EA2C174D8211C123E5A91D86227DB116A44BB345A6E66874F83D8993F813/ln-handshake/0"
- "/dns4/pfn0.node.devnet.aptoslabs.com/tcp/6182/noise-ik/B881EA2C174D8211C123E5A91D86227DB116A44BB345A6E66874F83D8993F813/handshake/0"
role: "Upstream"
B881EA2C174D8211C123E5A91D86227DB116A44BB345A6E66874F83D8993F813:
addresses:
- "/ip4/100.20.221.187/tcp/6182/ln-noise-ik/B881EA2C174D8211C123E5A91D86227DB116A44BB345A6E66874F83D8993F813/ln-handshake/0"
- "/ip4/100.20.221.187/tcp/6182/noise-ik/B881EA2C174D8211C123E5A91D86227DB116A44BB345A6E66874F83D8993F813/handshake/0"
role: "Upstream"
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,15 +290,15 @@ full_node_networks:
seeds:
bb14af025d226288a3488b4433cf5cb54d6a710365a2d95ac6ffbd9b9198a86a:
addresses:
- "/dns4/pfn0.node.devnet.aptoslabs.com/tcp/6182/ln-noise-ik/bb14af025d226288a3488b4433cf5cb54d6a710365a2d95ac6ffbd9b9198a86a/ln-handshake/0"
- "/dns4/pfn0.node.devnet.aptoslabs.com/tcp/6182/noise-ik/bb14af025d226288a3488b4433cf5cb54d6a710365a2d95ac6ffbd9b9198a86a/handshake/0"
role: "Upstream"
7fe8523388084607cdf78ff40e3e717652173b436ae1809df4a5fcfc67f8fc61:
addresses:
- "/dns4/pfn1.node.devnet.aptoslabs.com/tcp/6182/ln-noise-ik/7fe8523388084607cdf78ff40e3e717652173b436ae1809df4a5fcfc67f8fc61/ln-handshake/0"
- "/dns4/pfn1.node.devnet.aptoslabs.com/tcp/6182/noise-ik/7fe8523388084607cdf78ff40e3e717652173b436ae1809df4a5fcfc67f8fc61/handshake/0"
role: "Upstream"
f6b135a59591677afc98168791551a0a476222516fdc55869d2b649c614d965b:
addresses:
- "/dns4/pfn2.node.devnet.aptoslabs.com/tcp/6182/ln-noise-ik/f6b135a59591677afc98168791551a0a476222516fdc55869d2b649c614d965b/ln-handshake/0"
- "/dns4/pfn2.node.devnet.aptoslabs.com/tcp/6182/noise-ik/f6b135a59591677afc98168791551a0a476222516fdc55869d2b649c614d965b/handshake/0"
role: "Upstream"
...
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ full_node_networks:
seeds:
bb14af025d226288a3488b4433cf5cb54d6a710365a2d95ac6ffbd9b9198a86a:
addresses:
- "/dns4/pfn0.node.devnet.aptoslabs.com/tcp/6182/ln-noise-ik/bb14af025d226288a3488b4433cf5cb54d6a710365a2d95ac6ffbd9b9198a86a/ln-handshake/0"
- "/dns4/pfn0.node.devnet.aptoslabs.com/tcp/6182/noise-ik/bb14af025d226288a3488b4433cf5cb54d6a710365a2d95ac6ffbd9b9198a86a/handshake/0"
role: "Upstream"
```
Expand Down
6 changes: 3 additions & 3 deletions developer-docs-site/docs/tutorials/run-a-fullnode-on-gcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,15 +254,15 @@ module "fullnode" {
devnet = {
seeds = {
"bb14af025d226288a3488b4433cf5cb54d6a710365a2d95ac6ffbd9b9198a86a" = {
addresses = ["/dns4/pfn0.node.devnet.aptoslabs.com/tcp/6182/ln-noise-ik/bb14af025d226288a3488b4433cf5cb54d6a710365a2d95ac6ffbd9b9198a86a/ln-handshake/0"]
addresses = ["/dns4/pfn0.node.devnet.aptoslabs.com/tcp/6182/noise-ik/bb14af025d226288a3488b4433cf5cb54d6a710365a2d95ac6ffbd9b9198a86a/handshake/0"]
role = "Upstream"
},
"7fe8523388084607cdf78ff40e3e717652173b436ae1809df4a5fcfc67f8fc61" = {
addresses = ["/dns4/pfn1.node.devnet.aptoslabs.com/tcp/6182/ln-noise-ik/7fe8523388084607cdf78ff40e3e717652173b436ae1809df4a5fcfc67f8fc61/ln-handshake/0"]
addresses = ["/dns4/pfn1.node.devnet.aptoslabs.com/tcp/6182/noise-ik/7fe8523388084607cdf78ff40e3e717652173b436ae1809df4a5fcfc67f8fc61/handshake/0"]
role = "Upstream"
},
"f6b135a59591677afc98168791551a0a476222516fdc55869d2b649c614d965b" = {
addresses = ["/dns4/pfn2.node.devnet.aptoslabs.com/tcp/6182/ln-noise-ik/f6b135a59591677afc98168791551a0a476222516fdc55869d2b649c614d965b/ln-handshake/0"]
addresses = ["/dns4/pfn2.node.devnet.aptoslabs.com/tcp/6182/noise-ik/f6b135a59591677afc98168791551a0a476222516fdc55869d2b649c614d965b/handshake/0"]
role = "Upstream"
}
}
Expand Down
2 changes: 1 addition & 1 deletion docker/compose/aptos-node/fullnode.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ full_node_networks:
seeds:
00000000000000000000000000000000d58bc7bb154b38039bc9096ce04e1237:
addresses:
- "/ip4/<Validator IP Address>/tcp/6181/ln-noise-ik/f0274c2774519281a8332d0bb9d8101bd58bc7bb154b38039bc9096ce04e1237/ln-handshake/0"
- "/ip4/<Validator IP Address>/tcp/6181/noise-ik/f0274c2774519281a8332d0bb9d8101bd58bc7bb154b38039bc9096ce04e1237/handshake/0"
role: "Validator"

- network_id: "public"
Expand Down
8 changes: 4 additions & 4 deletions documentation/specifications/network/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ AptosNet uses [`NetworkAddress`](network-address.md) to encapsulate the precise
* `"/dns4/<name>/tcp/<port>"`
* `"/dns6/<name>/tcp/<port>"`
2. Secure Transport Upgrade:
* `"/ln-noise-ik/<x25519-public-key>"`
* `"/noise-ik/<x25519-public-key>"`
3. AptosNet Handshake Upgrade:
* `"/ln-handshake/<version>"`
* `"/handshake/<version>"`

For example, a full AptosNet `NetworkAddress` in human-readable format:

```
"/ip4/10.0.0.61/tcp/6080/ln-noise-ik/080e287879c918794170e258bfaddd75acac5b3e350419044655e4983a487120/ln-handshake/0"
"/ip4/10.0.0.61/tcp/6080/noise-ik/080e287879c918794170e258bfaddd75acac5b3e350419044655e4983a487120/handshake/0"
```

AptosNet `NetworkAddress`es are advertised via the [onchain discovery protocol](onchain-discovery.md) or stored in local configurations.
Expand All @@ -111,7 +111,7 @@ An expanded view of the connection handshakes looks like:

```
server: TCP::bind [address]
client: discover server_address = "/ip4/[address]/ln-noise-ik/[public_key]/ln-handshake/[version]"
client: discover server_address = "/ip4/[address]/noise-ik/[public_key]/handshake/[version]"
...
Expand Down
4 changes: 2 additions & 2 deletions documentation/specifications/network/handshake-v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ The handshake protocol is used between two connecting peers during the initial c

## NetworkAddress Protocol

The handshake protocol version itself is "pre-negotiated" in peers' advertised or configured [`NetworkAddress`](network-address.md)es. Canonical AptosNet addresses will include the following `Protocol` after the `"/ln-noise-ik/<public-key>"` `Protocol`:
The handshake protocol version itself is "pre-negotiated" in peers' advertised or configured [`NetworkAddress`](network-address.md)es. Canonical AptosNet addresses will include the following `Protocol` after the `"/noise-ik/<public-key>"` `Protocol`:

```
human-readable format: "/ln-handshake/<version>"
human-readable format: "/handshake/<version>"
```

where supported `<version>` is currently only `0`.
Expand Down
16 changes: 8 additions & 8 deletions documentation/specifications/network/network-address.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ Dns6("example.com") => "/dns6/example.com",
Tcp(6080) => "/tcp/6080",
Memory(1234) => "/memory/1234",
NoiseIK(b"080e287879c918794170e258bfaddd75acac5b3e350419044655e4983a487120") =>
"/ln-noise-ik/080e287879c918794170e258bfaddd75acac5b3e350419044655e4983a487120",
Handshake(0) => "/ln-handshake/0",
"/noise-ik/080e287879c918794170e258bfaddd75acac5b3e350419044655e4983a487120",
Handshake(0) => "/handshake/0",
```

A `NetworkAddress` is then just a concatenation of these individually formatted `Protocol` segments:
Expand All @@ -86,7 +86,7 @@ NetworkAddress([
Tcp(6080),
NoiseIK(b"080e287879c918794170e258bfaddd75acac5b3e350419044655e4983a487120"),
Handshake(0),
]) => "/ip4/127.0.0.1/tcp/6080/ln-noise-ik/080e287879c918794170e258bfaddd75acac5b3e350419044655e4983a487120/ln-handshake/0"
]) => "/ip4/127.0.0.1/tcp/6080/noise-ik/080e287879c918794170e258bfaddd75acac5b3e350419044655e4983a487120/handshake/0"
```

A `NetworkAddress` as a concatenation of `Protocol` segments must have the following characteristics:
Expand All @@ -99,7 +99,7 @@ A `NetworkAddress` as a concatenation of `Protocol` segments must have the follo
Example possible combinations:
* `/ip4/127.0.0.1/tcp/6080`
* `/memory/6080`
* `/dns/novi.com/tcp/80/ln-noise-ik/080e287879c918794170e258bfaddd75acac5b3e350419044655e4983a487120/ln-handshake/0`
* `/dns/novi.com/tcp/80/noise-ik/080e287879c918794170e258bfaddd75acac5b3e350419044655e4983a487120/handshake/0`

## Network Protocol Upgradability

Expand All @@ -108,7 +108,7 @@ backwards-incompatible upgrades allows Aptos to evolve quickly and prevents prot

Each node advertises the full set of protocols needed to speak with a it using
[onchain discovery](onchain-discovery.md). In other words, a node that sees
`"/dns6/example.com/tcp/1234/ln-noise-ik/<pubkey>/ln-handshake/0"` knows unambiguously the precise set of protocols it
`"/dns6/example.com/tcp/1234/noise-ik/<pubkey>/handshake/0"` knows unambiguously the precise set of protocols it
must speak and in which order for the listening node to understand them.

By allowing several `NetworkAddress`es to be advertised at once, nodes can also facilitate backwards-incompatible
Expand All @@ -121,9 +121,9 @@ handshake protocol:
```
addrs := [
// new protocol
"/ip4/1.2.3.4/tcp/6181/ln-noise-ix/<pubkey>/ln-handshake/0",
"/ip4/1.2.3.4/tcp/6181/noise-ix/<pubkey>/handshake/0",
// old protocol
"/ip4/1.2.3.4/tcp/6180/ln-noise-ik/<pubkey>/ln-handshake/0",
"/ip4/1.2.3.4/tcp/6180/noise-ik/<pubkey>/handshake/0",
]
```

Expand All @@ -139,6 +139,6 @@ like:
```
// new protocol only
addrs := [
"/ip4/1.2.3.4/tcp/6181/ln-noise-ix/<pubkey>/ln-handshake/0",
"/ip4/1.2.3.4/tcp/6181/noise-ix/<pubkey>/handshake/0",
]
```
2 changes: 1 addition & 1 deletion documentation/specifications/network/noise.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This specification documents how we make use of Noise to encrypt communications
The Noise protocol is "pre-negotiated" in peers' advertised or configured [`NetworkAddress`](network-address.md)es. Canonical AptosNet addresses will include the following `Protocol` after the base transport `Protocol`s:

```
human-readable format: "/ln-noise-ik/<x25519-public-key>"
human-readable format: "/noise-ik/<x25519-public-key>"
```

where `<x25519-public-key>` is the advertising peer's remote static public key in Noise terminology.
Expand Down
4 changes: 2 additions & 2 deletions documentation/specifications/network/onchain-discovery.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ Ideally, routine key rotations are automated and don't require operator interven
Imagine a validator starts with a single advertised network address containing its network identity public key `<pubkey1>`:

```
addrs = ["/ip4/1.2.3.4/tcp/6180/ln-noise-ik/<pubkey1>/ln-handshake/0"]
addrs = ["/ip4/1.2.3.4/tcp/6180/noise-ik/<pubkey1>/handshake/0"]
```

The validator initiates a key rotation to a new network identity public key `<pubkey2>` by sending a transaction to set its addresses to a new list:

```
tx: set_validator_network_addresses(["/ip4/1.2.3.4/tcp/6180/ln-noise-ik/<pubkey2>/ln-handshake/0"])
tx: set_validator_network_addresses(["/ip4/1.2.3.4/tcp/6180/noise-ik/<pubkey2>/handshake/0"])
```

<!-- TODO(philiphayes): link to actual tx? -->
Expand Down
2 changes: 1 addition & 1 deletion network/discovery/src/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ mod tests {

// Try with a peer
let mut peers = PeerSet::new();
let addr = NetworkAddress::from_str("/ip4/1.2.3.4/tcp/6180/ln-noise-ik/080e287879c918794170e258bfaddd75acac5b3e350419044655e4983a487120/ln-handshake/0").unwrap();
let addr = NetworkAddress::from_str("/ip4/1.2.3.4/tcp/6180/noise-ik/080e287879c918794170e258bfaddd75acac5b3e350419044655e4983a487120/handshake/0").unwrap();
let key = addr.find_noise_proto().unwrap();
let addrs = vec![addr];
let mut keys = HashSet::new();
Expand Down
4 changes: 2 additions & 2 deletions network/src/transport/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ where
io::ErrorKind::InvalidInput,
format!(
"Unexpected dialing network address: '{}', expected: \
'/../ln-noise-ik/<pubkey>/ln-handshake/<version>'",
'/../noise-ik/<pubkey>/handshake/<version>'",
addr
),
)),
Expand All @@ -504,7 +504,7 @@ where
///
/// We parse the dial address like:
///
/// `/<base_transport>` + `/ln-noise-ik/<pubkey>/ln-handshake/<version>`
/// `/<base_transport>` + `/noise-ik/<pubkey>/handshake/<version>`
///
/// If the base transport is `MemoryTransport`, then `/<base_transport>` is:
///
Expand Down
4 changes: 2 additions & 2 deletions network/src/transport/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ async fn write_read_msg(socket: &mut impl TSocket, msg: &[u8]) -> Bytes {
}

/// Check that the network address matches the format
/// `"/memory/<port>/ln-noise-ik/<pubkey>/ln-handshake/<version>"`
/// `"/memory/<port>/noise-ik/<pubkey>/handshake/<version>"`
fn expect_memory_noise_addr(addr: &NetworkAddress) {
assert!(
matches!(addr.as_slice(), [Memory(_), NoiseIK(_), Handshake(_)]),
Expand All @@ -200,7 +200,7 @@ fn expect_memory_noise_addr(addr: &NetworkAddress) {
}

/// Check that the network address matches the format
/// `"/ip4/<ipaddr>/tcp/<port>/ln-noise-ik/<pubkey>/ln-handshake/<version>"`
/// `"/ip4/<ipaddr>/tcp/<port>/noise-ik/<pubkey>/handshake/<version>"`
fn expect_ip4_tcp_noise_addr(addr: &NetworkAddress) {
assert!(
matches!(addr.as_slice(), [Ip4(_), Tcp(_), NoiseIK(_), Handshake(_)]),
Expand Down
2 changes: 1 addition & 1 deletion terraform/fullnode/gcp/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fullnode_helm_values = {
devnet = {
seeds = {
"7fe8523388084607cdf78ff40e3e717652173b436ae1809df4a5fcfc67f8fc61" = {
addresses = ["/dns4/pfn1.node.devnet.aptoslabs.com/tcp/6182/ln-noise-ik/7fe8523388084607cdf78ff40e3e717652173b436ae1809df4a5fcfc67f8fc61/ln-handshake/0"]
addresses = ["/dns4/pfn1.node.devnet.aptoslabs.com/tcp/6182/noise-ik/7fe8523388084607cdf78ff40e3e717652173b436ae1809df4a5fcfc67f8fc61/handshake/0"]
role = "Upstream"
}
}
Expand Down
2 changes: 1 addition & 1 deletion terraform/helm/aptos-node/files/configs/fullnode.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ full_node_networks:
seeds:
00000000000000000000000000000000d58bc7bb154b38039bc9096ce04e1237:
addresses:
- "/dns4/{{ include "aptos-validator.fullname" . }}-validator/tcp/6181/ln-noise-ik/f0274c2774519281a8332d0bb9d8101bd58bc7bb154b38039bc9096ce04e1237/ln-handshake/0"
- "/dns4/{{ include "aptos-validator.fullname" . }}-validator/tcp/6181/noise-ik/f0274c2774519281a8332d0bb9d8101bd58bc7bb154b38039bc9096ce04e1237/handshake/0"
role: "Validator"

- network_id: "public"
Expand Down
2 changes: 1 addition & 1 deletion terraform/helm/validator/files/configs/fullnode.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ full_node_networks:
seeds:
00000000000000000000000000000000d58bc7bb154b38039bc9096ce04e1237:
addresses:
- "/dns4/{{ include "aptos-validator.fullname" . }}-validator/tcp/6181/ln-noise-ik/f0274c2774519281a8332d0bb9d8101bd58bc7bb154b38039bc9096ce04e1237/ln-handshake/0"
- "/dns4/{{ include "aptos-validator.fullname" . }}-validator/tcp/6181/noise-ik/f0274c2774519281a8332d0bb9d8101bd58bc7bb154b38039bc9096ce04e1237/handshake/0"
role: "Validator"

- network_id: "public"
Expand Down
11 changes: 7 additions & 4 deletions testsuite/smoke-test/src/full_nodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,10 +321,13 @@ fn add_node_to_seeds(
.iter()
.find(|protocol| matches!(protocol, Protocol::Tcp(_)))
.unwrap();
let address = NetworkAddress::from(Protocol::Ip4(Ipv4Addr::new(127, 0, 0, 1)))
.push(port_protocol.clone())
.push(Protocol::NoiseIK(seed_key))
.push(Protocol::Handshake(HANDSHAKE_VERSION));
let address = NetworkAddress::from_protocols(vec![
Protocol::Ip4(Ipv4Addr::new(127, 0, 0, 1)),
port_protocol.clone(),
Protocol::NoiseIK(seed_key),
Protocol::Handshake(HANDSHAKE_VERSION),
])
.unwrap();

Peer::new(vec![address], HashSet::new(), peer_role)
} else {
Expand Down
2 changes: 1 addition & 1 deletion testsuite/smoke-test/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ fn network_address(node_config: &NodeConfig, network_id: &NetworkId) -> NetworkA
.unwrap();
let key = network.identity_key().public_key();
NetworkAddress::from_str(&format!(
"/ip4/127.0.0.1/tcp/{}/ln-noise-ik/{}/ln-handshake/0",
"/ip4/127.0.0.1/tcp/{}/noise-ik/{}/handshake/0",
port, key
))
.unwrap()
Expand Down
Loading

0 comments on commit 4ce8545

Please sign in to comment.