From 8d3a3e865fbb739aaef68653e879b2e4178ea883 Mon Sep 17 00:00:00 2001 From: stringhandler Date: Fri, 5 May 2023 12:48:12 +0200 Subject: [PATCH 1/6] fix: fix panic when no public addresses --- base_layer/p2p/src/initialization.rs | 2 +- base_layer/wallet/src/error.rs | 2 ++ base_layer/wallet/src/wallet.rs | 7 ++++++- comms/core/src/builder/comms_node.rs | 19 ++++++++----------- comms/core/src/peer_manager/node_identity.rs | 4 ++-- integration_tests/src/chat_client.rs | 4 ++-- integration_tests/src/chat_ffi.rs | 4 ++-- integration_tests/src/lib.rs | 2 +- 8 files changed, 24 insertions(+), 20 deletions(-) diff --git a/base_layer/p2p/src/initialization.rs b/base_layer/p2p/src/initialization.rs index 5e7ba112a5..e4c3f9d667 100644 --- a/base_layer/p2p/src/initialization.rs +++ b/base_layer/p2p/src/initialization.rs @@ -155,7 +155,7 @@ pub async fn initialize_local_test_comms>( let comms = CommsBuilder::new() .allow_test_addresses() - .with_listener_address(node_identity.first_public_address()) + .with_listener_address(node_identity.first_public_address().unwrap()) .with_listener_liveness_max_sessions(1) .with_node_identity(node_identity) .with_user_agent(&"/test/1.0") diff --git a/base_layer/wallet/src/error.rs b/base_layer/wallet/src/error.rs index 101d6316ce..76d7b6e1a9 100644 --- a/base_layer/wallet/src/error.rs +++ b/base_layer/wallet/src/error.rs @@ -101,6 +101,8 @@ pub enum WalletError { TransportChannelError(#[from] TransportChannelError), #[error("Unexpected API Response while calling method `{method}` on `{api}`")] UnexpectedApiResponse { method: String, api: String }, + #[error("Public address not set for this wallet")] + PublicAddressNotSet, } pub const LOG_TARGET: &str = "tari::application"; diff --git a/base_layer/wallet/src/wallet.rs b/base_layer/wallet/src/wallet.rs index e16c78db68..b71623e5ec 100644 --- a/base_layer/wallet/src/wallet.rs +++ b/base_layer/wallet/src/wallet.rs @@ -273,7 +273,12 @@ where // Persist the comms node address and features after it has been spawned to capture any modifications made // during comms startup. In the case of a Tor Transport the public address could have been generated - wallet_database.set_node_address(comms.node_identity().first_public_address())?; + wallet_database.set_node_address( + comms + .node_identity() + .first_public_address() + .ok_or(WalletError::PublicAddressNotSet)?, + )?; wallet_database.set_node_features(comms.node_identity().features())?; let identity_sig = comms.node_identity().identity_signature_read().as_ref().cloned(); if let Some(identity_sig) = identity_sig { diff --git a/comms/core/src/builder/comms_node.rs b/comms/core/src/builder/comms_node.rs index a770af2202..ad5ff9a824 100644 --- a/comms/core/src/builder/comms_node.rs +++ b/comms/core/src/builder/comms_node.rs @@ -244,17 +244,14 @@ impl UnspawnedCommsNode { ); // Spawn liveness check now that we have the final address - let liveness_watch = connection_manager_config - .liveness_self_check_interval - .map(|interval| { - LivenessCheck::spawn( - transport, - node_identity.first_public_address(), - interval, - shutdown_signal.clone(), - ) - }) - .unwrap_or_else(|| watch::channel(LivenessStatus::Disabled).1); + let liveness_watch = if let Some(public_address) = node_identity.first_public_address() { + connection_manager_config + .liveness_self_check_interval + .map(|interval| LivenessCheck::spawn(transport, public_address, interval, shutdown_signal.clone())) + .unwrap_or_else(|| watch::channel(LivenessStatus::Disabled).1) + } else { + watch::channel(LivenessStatus::Disabled).1 + }; Ok(CommsNode { shutdown_signal, diff --git a/comms/core/src/peer_manager/node_identity.rs b/comms/core/src/peer_manager/node_identity.rs index 6c07146cc0..6f11ddbfea 100644 --- a/comms/core/src/peer_manager/node_identity.rs +++ b/comms/core/src/peer_manager/node_identity.rs @@ -126,8 +126,8 @@ impl NodeIdentity { acquire_read_lock!(self.public_addresses).clone() } - pub fn first_public_address(&self) -> Multiaddr { - acquire_read_lock!(self.public_addresses)[0].clone() + pub fn first_public_address(&self) -> Option { + acquire_read_lock!(self.public_addresses).get(0).cloned() } /// Modify the public address. diff --git a/integration_tests/src/chat_client.rs b/integration_tests/src/chat_client.rs index 8eab5c283e..03dcea44d6 100644 --- a/integration_tests/src/chat_client.rs +++ b/integration_tests/src/chat_client.rs @@ -69,11 +69,11 @@ fn test_config(name: &str, port: u64, identity: &NodeIdentity) -> P2pConfig { ..DhtConfig::default_local_test() }, transport: TransportConfig::new_tcp(TcpTransportConfig { - listener_address: identity.first_public_address(), + listener_address: identity.first_public_address().expect("No public address"), ..TcpTransportConfig::default() }), allow_test_addresses: true, - public_addresses: MultiaddrList::from(vec![identity.first_public_address()]), + public_addresses: MultiaddrList::from(vec![identity.first_public_address().expect("No public address")]), user_agent: "tari/chat-client/0.0.1".to_string(), ..P2pConfig::default() }; diff --git a/integration_tests/src/chat_ffi.rs b/integration_tests/src/chat_ffi.rs index e473f80b81..3ed3efd86b 100644 --- a/integration_tests/src/chat_ffi.rs +++ b/integration_tests/src/chat_ffi.rs @@ -194,11 +194,11 @@ fn test_config(base_dir: &PathBuf, identity: &NodeIdentity) -> P2pConfig { ..DhtConfig::default_local_test() }, transport: TransportConfig::new_tcp(TcpTransportConfig { - listener_address: identity.first_public_address(), + listener_address: identity.first_public_address().expect("No public address"), ..TcpTransportConfig::default() }), allow_test_addresses: true, - public_addresses: MultiaddrList::from(vec![identity.first_public_address()]), + public_addresses: MultiaddrList::from(vec![identity.first_public_address().expect("No public address")]), user_agent: "tari/chat-client/0.0.1".to_string(), ..P2pConfig::default() }; diff --git a/integration_tests/src/lib.rs b/integration_tests/src/lib.rs index 2e6c05e01b..fb04905d94 100644 --- a/integration_tests/src/lib.rs +++ b/integration_tests/src/lib.rs @@ -78,7 +78,7 @@ pub async fn get_peer_addresses(world: &TariWorld, peers: &Vec) -> Vec Date: Fri, 5 May 2023 12:57:20 +0200 Subject: [PATCH 2/6] allow better crate choosing with tari-crypto --- applications/tari_app_grpc/Cargo.toml | 2 +- applications/tari_base_node/Cargo.toml | 2 +- applications/tari_console_wallet/Cargo.toml | 2 +- applications/tari_miner/Cargo.toml | 2 +- base_layer/common_types/Cargo.toml | 2 +- base_layer/contacts/Cargo.toml | 2 +- base_layer/core/Cargo.toml | 2 +- base_layer/key_manager/Cargo.toml | 2 +- base_layer/mmr/Cargo.toml | 2 +- base_layer/p2p/Cargo.toml | 2 +- base_layer/tari_mining_helper_ffi/Cargo.toml | 2 +- base_layer/wallet/Cargo.toml | 2 +- base_layer/wallet_ffi/Cargo.toml | 2 +- common/Cargo.toml | 2 +- comms/core/Cargo.toml | 2 +- comms/dht/Cargo.toml | 2 +- infrastructure/tari_script/Cargo.toml | 2 +- integration_tests/Cargo.toml | 2 +- 18 files changed, 18 insertions(+), 18 deletions(-) diff --git a/applications/tari_app_grpc/Cargo.toml b/applications/tari_app_grpc/Cargo.toml index 4f869678ce..1e905d1dd4 100644 --- a/applications/tari_app_grpc/Cargo.toml +++ b/applications/tari_app_grpc/Cargo.toml @@ -11,7 +11,7 @@ edition = "2018" tari_common_types = { path = "../../base_layer/common_types" } tari_comms = { path = "../../comms/core" } tari_core = { path = "../../base_layer/core" } -tari_crypto = { version = "0.16.12"} +tari_crypto = { version = "0.16"} tari_script = { path = "../../infrastructure/tari_script" } tari_utilities = { version = "0.4.10"} diff --git a/applications/tari_base_node/Cargo.toml b/applications/tari_base_node/Cargo.toml index bb2ab0093a..af2f21ca06 100644 --- a/applications/tari_base_node/Cargo.toml +++ b/applications/tari_base_node/Cargo.toml @@ -15,7 +15,7 @@ tari_comms = { path = "../../comms/core", features = ["rpc"] } tari_common_types = { path = "../../base_layer/common_types" } tari_comms_dht = { path = "../../comms/dht" } tari_core = { path = "../../base_layer/core", default-features = false, features = ["transactions"] } -tari_crypto = { version = "0.16.12"} +tari_crypto = { version = "0.16"} tari_libtor = { path = "../../infrastructure/libtor", optional = true } tari_p2p = { path = "../../base_layer/p2p", features = ["auto-update"] } tari_storage = {path="../../infrastructure/storage"} diff --git a/applications/tari_console_wallet/Cargo.toml b/applications/tari_console_wallet/Cargo.toml index ba4637e0f1..423ae77772 100644 --- a/applications/tari_console_wallet/Cargo.toml +++ b/applications/tari_console_wallet/Cargo.toml @@ -13,7 +13,7 @@ tari_common_types = { path = "../../base_layer/common_types" } tari_comms = { path = "../../comms/core" } tari_comms_dht = { path = "../../comms/dht" } tari_contacts = { path = "../../base_layer/contacts" } -tari_crypto = { version = "0.16.12"} +tari_crypto = { version = "0.16"} tari_key_manager = { path = "../../base_layer/key_manager" } tari_libtor = { path = "../../infrastructure/libtor", optional = true } tari_p2p = { path = "../../base_layer/p2p", features = ["auto-update"] } diff --git a/applications/tari_miner/Cargo.toml b/applications/tari_miner/Cargo.toml index 5090d8c1d8..4b261af082 100644 --- a/applications/tari_miner/Cargo.toml +++ b/applications/tari_miner/Cargo.toml @@ -14,7 +14,7 @@ tari_common_types = { path = "../../base_layer/common_types" } tari_comms = { path = "../../comms/core" } tari_app_utilities = { path = "../tari_app_utilities" } tari_app_grpc = { path = "../tari_app_grpc" } -tari_crypto = { version = "0.16.12"} +tari_crypto = { version = "0.16"} tari_utilities = "0.4.10" borsh = "0.9.3" diff --git a/base_layer/common_types/Cargo.toml b/base_layer/common_types/Cargo.toml index cfc1b9af49..719d5350af 100644 --- a/base_layer/common_types/Cargo.toml +++ b/base_layer/common_types/Cargo.toml @@ -7,7 +7,7 @@ version = "0.50.0-pre.0" edition = "2018" [dependencies] -tari_crypto = { version = "0.16.12"} +tari_crypto = { version = "0.16"} tari_utilities = "0.4.10" # TODO: remove this dependency and move Network into tari_common_types tari_common = { path = "../../common" } diff --git a/base_layer/contacts/Cargo.toml b/base_layer/contacts/Cargo.toml index 057160537f..0ce5fb1590 100644 --- a/base_layer/contacts/Cargo.toml +++ b/base_layer/contacts/Cargo.toml @@ -12,7 +12,7 @@ tari_common_sqlite = { path = "../../common_sqlite" } tari_common_types = { path = "../../base_layer/common_types" } tari_comms = { path = "../../comms/core" } tari_comms_dht = { path = "../../comms/dht" } -tari_crypto = { version = "0.16.12"} +tari_crypto = { version = "0.16"} tari_p2p = { path = "../p2p", features = ["auto-update"] } tari_service_framework = { path = "../service_framework" } tari_shutdown = { path = "../../infrastructure/shutdown" } diff --git a/base_layer/core/Cargo.toml b/base_layer/core/Cargo.toml index e46727fc9b..22222818db 100644 --- a/base_layer/core/Cargo.toml +++ b/base_layer/core/Cargo.toml @@ -24,7 +24,7 @@ tari_common_types = { path = "../../base_layer/common_types" } tari_comms = { path = "../../comms/core" } tari_comms_dht = { path = "../../comms/dht" } tari_comms_rpc_macros = { path = "../../comms/rpc_macros" } -tari_crypto = { version = "0.16.12", features = ["borsh"] } +tari_crypto = { version = "0.16", features = ["borsh"] } tari_metrics = { path = "../../infrastructure/metrics" } tari_mmr = { path = "../../base_layer/mmr", optional = true, features = ["native_bitmap"] } tari_p2p = { path = "../../base_layer/p2p" } diff --git a/base_layer/key_manager/Cargo.toml b/base_layer/key_manager/Cargo.toml index ba430d2237..1d270e46e1 100644 --- a/base_layer/key_manager/Cargo.toml +++ b/base_layer/key_manager/Cargo.toml @@ -12,7 +12,7 @@ crate-type = ["lib", "cdylib"] # NB: All dependencies must support or be gated for the WASM target. [dependencies] -tari_crypto = {version = "0.16.12"} +tari_crypto = {version = "0.16"} tari_utilities = "0.4.10" tari_common_sqlite = { path = "../../common_sqlite" } tari_common_types = { path = "../../base_layer/common_types"} diff --git a/base_layer/mmr/Cargo.toml b/base_layer/mmr/Cargo.toml index 3c79ceeab1..16f8257600 100644 --- a/base_layer/mmr/Cargo.toml +++ b/base_layer/mmr/Cargo.toml @@ -14,7 +14,7 @@ benches = ["criterion"] [dependencies] tari_utilities = "0.4.10" -tari_crypto = { version = "0.16.12"} +tari_crypto = { version = "0.16"} tari_common = {path = "../../common"} thiserror = "1.0.26" borsh = "0.9.3" diff --git a/base_layer/p2p/Cargo.toml b/base_layer/p2p/Cargo.toml index 8851dec424..c717acebea 100644 --- a/base_layer/p2p/Cargo.toml +++ b/base_layer/p2p/Cargo.toml @@ -13,7 +13,7 @@ edition = "2018" tari_comms = { path = "../../comms/core" } tari_comms_dht = { path = "../../comms/dht" } tari_common = { path = "../../common" } -tari_crypto = { version = "0.16.12"} +tari_crypto = { version = "0.16"} tari_service_framework = { path = "../service_framework" } tari_shutdown = { path = "../../infrastructure/shutdown" } tari_storage = { path = "../../infrastructure/storage" } diff --git a/base_layer/tari_mining_helper_ffi/Cargo.toml b/base_layer/tari_mining_helper_ffi/Cargo.toml index 5ed1cde460..3bb4d19a0c 100644 --- a/base_layer/tari_mining_helper_ffi/Cargo.toml +++ b/base_layer/tari_mining_helper_ffi/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" [dependencies] tari_comms = { path = "../../comms/core" } -tari_crypto = { version = "0.16.12"} +tari_crypto = { version = "0.16"} tari_common = { path = "../../common" } tari_core = { path = "../core", default-features = false, features = ["transactions"]} tari_utilities = "0.4.10" diff --git a/base_layer/wallet/Cargo.toml b/base_layer/wallet/Cargo.toml index 16ccbd5430..9478f857c9 100644 --- a/base_layer/wallet/Cargo.toml +++ b/base_layer/wallet/Cargo.toml @@ -12,7 +12,7 @@ tari_common = { path = "../../common" } tari_common_types = { path = "../../base_layer/common_types" } tari_comms = { path = "../../comms/core" } tari_comms_dht = { path = "../../comms/dht" } -tari_crypto = { version = "0.16.12"} +tari_crypto = { version = "0.16"} tari_key_manager = { path = "../key_manager", features = ["key_manager_service"] } tari_p2p = { path = "../p2p", features = ["auto-update"] } tari_script = { path = "../../infrastructure/tari_script" } diff --git a/base_layer/wallet_ffi/Cargo.toml b/base_layer/wallet_ffi/Cargo.toml index e1a9e1f0ab..14151d01c5 100644 --- a/base_layer/wallet_ffi/Cargo.toml +++ b/base_layer/wallet_ffi/Cargo.toml @@ -12,7 +12,7 @@ tari_common = { path="../../common" } tari_common_types = { path="../common_types" } tari_comms = { path = "../../comms/core", features = ["c_integration"]} tari_comms_dht = { path = "../../comms/dht", default-features = false } -tari_crypto = { version = "0.16.12"} +tari_crypto = { version = "0.16"} tari_key_manager = { path = "../key_manager" } tari_p2p = { path = "../p2p" } tari_script = { path = "../../infrastructure/tari_script" } diff --git a/common/Cargo.toml b/common/Cargo.toml index 5ef99554ec..88dac8cf46 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -14,7 +14,7 @@ build = ["toml", "prost-build"] static-application-info = ["git2"] [dependencies] -tari_crypto = { version = "0.16.12"} +tari_crypto = { version = "0.16"} anyhow = "1.0.53" config = { version = "0.13.0", default_features = false, features = ["toml"] } diff --git a/comms/core/Cargo.toml b/comms/core/Cargo.toml index 6b714a0cd6..be6d120a42 100644 --- a/comms/core/Cargo.toml +++ b/comms/core/Cargo.toml @@ -10,7 +10,7 @@ version = "0.50.0-pre.0" edition = "2018" [dependencies] -tari_crypto = { version = "0.16.12"} +tari_crypto = { version = "0.16"} tari_metrics = { path = "../../infrastructure/metrics" } tari_storage = { path = "../../infrastructure/storage" } tari_shutdown = { path = "../../infrastructure/shutdown" } diff --git a/comms/dht/Cargo.toml b/comms/dht/Cargo.toml index 2c4b1cdd4f..a0ca7aea17 100644 --- a/comms/dht/Cargo.toml +++ b/comms/dht/Cargo.toml @@ -13,7 +13,7 @@ edition = "2018" tari_comms = { path = "../core", features = ["rpc"] } tari_common = { path = "../../common" } tari_comms_rpc_macros = { path = "../rpc_macros" } -tari_crypto = { version = "0.16.12"} +tari_crypto = { version = "0.16"} tari_utilities = "0.4.10" tari_shutdown = { path = "../../infrastructure/shutdown" } tari_storage = { path = "../../infrastructure/storage" } diff --git a/infrastructure/tari_script/Cargo.toml b/infrastructure/tari_script/Cargo.toml index c92b3f3bc9..e60811de67 100644 --- a/infrastructure/tari_script/Cargo.toml +++ b/infrastructure/tari_script/Cargo.toml @@ -11,7 +11,7 @@ readme = "README.md" license = "BSD-3-Clause" [dependencies] -tari_crypto = { version = "0.16.12"} +tari_crypto = { version = "0.16"} tari_utilities = "0.4.10" blake2 = "0.9" diff --git a/integration_tests/Cargo.toml b/integration_tests/Cargo.toml index 338788aef4..bf302cc370 100644 --- a/integration_tests/Cargo.toml +++ b/integration_tests/Cargo.toml @@ -13,7 +13,7 @@ tari_base_node = { path = "../applications/tari_base_node" } tari_base_node_grpc_client = { path = "../clients/rust/base_node_grpc_client" } tari_chat_client = { path = "../base_layer/contacts/examples/chat_client" } tari_chat_ffi = { path = "../base_layer/chat_ffi" } -tari_crypto = "0.16.12" +tari_crypto = "0.16" tari_common = { path = "../common" } tari_common_types = { path = "../base_layer/common_types" } tari_comms = { path = "../comms/core" } From 90120ea9a4199e4f71c36b9ec3406c86e51b147d Mon Sep 17 00:00:00 2001 From: stringhandler Date: Fri, 5 May 2023 13:13:06 +0200 Subject: [PATCH 3/6] loosen uuid dep --- base_layer/contacts/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base_layer/contacts/Cargo.toml b/base_layer/contacts/Cargo.toml index 0ce5fb1590..9d5909b61e 100644 --- a/base_layer/contacts/Cargo.toml +++ b/base_layer/contacts/Cargo.toml @@ -30,7 +30,7 @@ rand = "0.7.3" thiserror = "1.0.26" tokio = { version = "1.23", features = ["sync", "macros"] } tower = "0.4" -uuid = { version = "1.3.1", features = ["v4"] } +uuid = { version = "1.3", features = ["v4"] } [dev-dependencies] tari_comms_dht = { path = "../../comms/dht", features = ["test-mocks"] } From 2c76e80cefee7d0b0902580f9e7a16d9e3e0d2dc Mon Sep 17 00:00:00 2001 From: stringhandler Date: Fri, 5 May 2023 13:28:19 +0200 Subject: [PATCH 4/6] min tari-crypto version for comms/dht --- comms/dht/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comms/dht/Cargo.toml b/comms/dht/Cargo.toml index a0ca7aea17..1301e3eb69 100644 --- a/comms/dht/Cargo.toml +++ b/comms/dht/Cargo.toml @@ -13,7 +13,7 @@ edition = "2018" tari_comms = { path = "../core", features = ["rpc"] } tari_common = { path = "../../common" } tari_comms_rpc_macros = { path = "../rpc_macros" } -tari_crypto = { version = "0.16"} +tari_crypto = { version = "0.16.2"} tari_utilities = "0.4.10" tari_shutdown = { path = "../../infrastructure/shutdown" } tari_storage = { path = "../../infrastructure/storage" } From f2a5ba143fdff6cae3633bafda787ae0afeb99fa Mon Sep 17 00:00:00 2001 From: stringhandler Date: Fri, 5 May 2023 19:00:53 +0200 Subject: [PATCH 5/6] min tari-crypto version for comms/dht --- Cargo.lock | 15 ++------------- applications/tari_app_utilities/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7d1571f4dc..89075a07cc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -951,7 +951,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d379af7f68bfc21714c6c7dea883544201741d2ce8274bb12fa54f89507f52a7" dependencies = [ "async-trait", - "json5 0.4.1", + "json5", "lazy_static", "nom 7.1.3", "pathdiff", @@ -2730,17 +2730,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "json5" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eb2522ff59fbfefb955e9bd44d04d5e5c2d0e8865bfc2c3d1ab3916183ef5ee" -dependencies = [ - "pest", - "pest_derive", - "serde", -] - [[package]] name = "json5" version = "0.4.1" @@ -5142,7 +5131,7 @@ version = "0.50.0-pre.0" dependencies = [ "clap 3.2.23", "futures 0.3.26", - "json5 0.2.8", + "json5", "log", "rand 0.7.3", "serde", diff --git a/applications/tari_app_utilities/Cargo.toml b/applications/tari_app_utilities/Cargo.toml index 7f25447366..0cfe5a01ae 100644 --- a/applications/tari_app_utilities/Cargo.toml +++ b/applications/tari_app_utilities/Cargo.toml @@ -14,7 +14,7 @@ tari_utilities = { version = "0.4.10"} clap = { version = "3.2.0", features = ["derive", "env"] } futures = { version = "^0.3.16", default-features = false, features = ["alloc"] } -json5 = "0.2.2" +json5 = "0.4" log = { version = "0.4.8", features = ["std"] } rand = "0.7.3" tokio = { version = "1.23", features = ["signal"] } From 5964bbfb048a299fe604d73cd753ff6439185ada Mon Sep 17 00:00:00 2001 From: stringhandler Date: Wed, 10 May 2023 12:12:26 +0200 Subject: [PATCH 6/6] fix tests --- base_layer/contacts/tests/contacts_service.rs | 2 +- base_layer/wallet/tests/wallet.rs | 13 ++++++++----- base_layer/wallet_ffi/src/lib.rs | 2 +- .../core/src/protocol/rpc/test/comms_integration.rs | 4 ++-- comms/dht/examples/memory_net/utilities.rs | 2 +- comms/dht/tests/dht.rs | 2 +- integration_tests/tests/steps/wallet_ffi_steps.rs | 10 +++++----- 7 files changed, 19 insertions(+), 16 deletions(-) diff --git a/base_layer/contacts/tests/contacts_service.rs b/base_layer/contacts/tests/contacts_service.rs index 16f5f3d76c..34d2ac5661 100644 --- a/base_layer/contacts/tests/contacts_service.rs +++ b/base_layer/contacts/tests/contacts_service.rs @@ -72,7 +72,7 @@ pub fn setup_contacts_service( transport: TransportConfig { transport_type: TransportType::Memory, memory: MemoryTransportConfig { - listener_address: node_identity.first_public_address(), + listener_address: node_identity.first_public_address().unwrap(), }, ..Default::default() }, diff --git a/base_layer/wallet/tests/wallet.rs b/base_layer/wallet/tests/wallet.rs index 6a64d3d0f7..a1b5a22a66 100644 --- a/base_layer/wallet/tests/wallet.rs +++ b/base_layer/wallet/tests/wallet.rs @@ -130,7 +130,7 @@ async fn create_wallet( override_from: None, public_addresses: MultiaddrList::default(), transport: TransportConfig::new_memory(MemoryTransportConfig { - listener_address: node_identity.first_public_address(), + listener_address: node_identity.first_public_address().unwrap(), }), datastore_path: data_path.to_path_buf(), peer_database_name: random::string(8), @@ -255,7 +255,7 @@ async fn test_wallet() { .peer_manager() .add_peer(create_peer( bob_identity.public_key().clone(), - bob_identity.first_public_address(), + bob_identity.first_public_address().unwrap(), )) .await .unwrap(); @@ -265,7 +265,7 @@ async fn test_wallet() { .peer_manager() .add_peer(create_peer( alice_identity.public_key().clone(), - alice_identity.first_public_address(), + alice_identity.first_public_address().unwrap(), )) .await .unwrap(); @@ -273,7 +273,7 @@ async fn test_wallet() { alice_wallet .set_base_node_peer( (*base_node_identity.public_key()).clone(), - base_node_identity.first_public_address().clone(), + base_node_identity.first_public_address().unwrap(), ) .await .unwrap(); @@ -735,7 +735,10 @@ async fn test_import_utxo() { let expected_output_hash = output.hash(); let node_address = TariAddress::new(node_identity.public_key().clone(), network); alice_wallet - .set_base_node_peer(node_identity.public_key().clone(), node_identity.first_public_address()) + .set_base_node_peer( + node_identity.public_key().clone(), + node_identity.first_public_address().unwrap(), + ) .await .unwrap(); let tx_id = alice_wallet diff --git a/base_layer/wallet_ffi/src/lib.rs b/base_layer/wallet_ffi/src/lib.rs index fa7794b7fe..cae16defbb 100644 --- a/base_layer/wallet_ffi/src/lib.rs +++ b/base_layer/wallet_ffi/src/lib.rs @@ -10754,7 +10754,7 @@ mod test { NodeIdentity::random(&mut OsRng, get_next_memory_address(), PeerFeatures::COMMUNICATION_NODE); let base_node_peer_public_key_ptr = Box::into_raw(Box::new(node_identity.public_key().clone())); let base_node_peer_address_ptr = - CString::into_raw(CString::new(node_identity.first_public_address().to_string()).unwrap()) + CString::into_raw(CString::new(node_identity.first_public_address().unwrap().to_string()).unwrap()) as *const c_char; wallet_add_base_node_peer( wallet_ptr, diff --git a/comms/core/src/protocol/rpc/test/comms_integration.rs b/comms/core/src/protocol/rpc/test/comms_integration.rs index 27fdf4b1e5..f2d6f6dae5 100644 --- a/comms/core/src/protocol/rpc/test/comms_integration.rs +++ b/comms/core/src/protocol/rpc/test/comms_integration.rs @@ -44,7 +44,7 @@ async fn run_service() { let mock_state = rpc_service.shared_state(); let shutdown = Shutdown::new(); let comms1 = CommsBuilder::new() - .with_listener_address(node_identity1.first_public_address()) + .with_listener_address(node_identity1.first_public_address().unwrap()) .with_node_identity(node_identity1) .with_shutdown_signal(shutdown.to_signal()) .with_peer_storage(CommsDatabase::new(), None) @@ -57,7 +57,7 @@ async fn run_service() { let node_identity2 = build_node_identity(Default::default()); let comms2 = CommsBuilder::new() - .with_listener_address(node_identity2.first_public_address()) + .with_listener_address(node_identity2.first_public_address().unwrap()) .with_shutdown_signal(shutdown.to_signal()) .with_node_identity(node_identity2.clone()) .with_peer_storage(CommsDatabase::new(), None) diff --git a/comms/dht/examples/memory_net/utilities.rs b/comms/dht/examples/memory_net/utilities.rs index 0c578a14fd..a958136d47 100644 --- a/comms/dht/examples/memory_net/utilities.rs +++ b/comms/dht/examples/memory_net/utilities.rs @@ -903,7 +903,7 @@ async fn setup_comms_dht( let comms = CommsBuilder::new() .allow_test_addresses() // In this case the listener address and the public address are the same (/memory/...) - .with_listener_address(node_identity.first_public_address()) + .with_listener_address(node_identity.first_public_address().unwrap()) .with_shutdown_signal(shutdown_signal) .with_node_identity(node_identity) .with_min_connectivity(1) diff --git a/comms/dht/tests/dht.rs b/comms/dht/tests/dht.rs index 9eec7db933..2a4192fa83 100644 --- a/comms/dht/tests/dht.rs +++ b/comms/dht/tests/dht.rs @@ -172,7 +172,7 @@ async fn setup_comms_dht( let comms = CommsBuilder::new() .allow_test_addresses() // In this case the listener address and the public address are the same (/memory/...) - .with_listener_address(node_identity.first_public_address()) + .with_listener_address(node_identity.first_public_address().unwrap()) .with_shutdown_signal(shutdown_signal) .with_node_identity(node_identity) .with_peer_storage(storage,None) diff --git a/integration_tests/tests/steps/wallet_ffi_steps.rs b/integration_tests/tests/steps/wallet_ffi_steps.rs index 87f1f409c7..abce23e9a9 100644 --- a/integration_tests/tests/steps/wallet_ffi_steps.rs +++ b/integration_tests/tests/steps/wallet_ffi_steps.rs @@ -37,7 +37,7 @@ async fn ffi_start_wallet_connected_to_base_node(world: &mut TariWorld, wallet: let base_node = world.get_node(&base_node).unwrap(); world.get_ffi_wallet(&wallet).unwrap().add_base_node( base_node.identity.public_key().to_hex(), - base_node.identity.first_public_address().to_string(), + base_node.identity.first_public_address().unwrap().to_string(), ); } @@ -48,7 +48,7 @@ async fn ffi_start_wallet_connected_to_seed_node(world: &mut TariWorld, wallet: let seed_node = world.get_node(&seed_node).unwrap(); world.get_ffi_wallet(&wallet).unwrap().add_base_node( seed_node.identity.public_key().to_hex(), - seed_node.identity.first_public_address().to_string(), + seed_node.identity.first_public_address().unwrap().to_string(), ); } @@ -57,7 +57,7 @@ async fn ffi_set_base_node(world: &mut TariWorld, base_node: String, wallet: Str let base_node = world.get_node(&base_node).unwrap(); world.get_ffi_wallet(&wallet).unwrap().add_base_node( base_node.identity.public_key().to_hex(), - base_node.identity.first_public_address().to_string(), + base_node.identity.first_public_address().unwrap().to_string(), ); } @@ -469,7 +469,7 @@ async fn ffi_recover_wallet(world: &mut TariWorld, wallet_name: String, ffi_wall let base_node = world.get_node(&base_node).unwrap(); world.get_ffi_wallet(&ffi_wallet_name).unwrap().add_base_node( base_node.identity.public_key().to_hex(), - base_node.identity.first_public_address().to_string(), + base_node.identity.first_public_address().unwrap().to_string(), ); } @@ -481,7 +481,7 @@ async fn ffi_restart_wallet(world: &mut TariWorld, wallet: String, base_node: St let ffi_wallet = world.get_ffi_wallet(&wallet).unwrap(); ffi_wallet.add_base_node( base_node.identity.public_key().to_hex(), - base_node.identity.first_public_address().to_string(), + base_node.identity.first_public_address().unwrap().to_string(), ); }