From d7e85496c5701fb7b92a5afd8fc9c9359e596c34 Mon Sep 17 00:00:00 2001
From: s0me0ne-unkn0wn <48632512+s0me0ne-unkn0wn@users.noreply.github.com>
Date: Sat, 4 May 2024 14:24:47 +0200
Subject: [PATCH] Bump `subxt` version (#203)

---
 Cargo.toml                                       |  6 +++---
 crates/configuration/src/network.rs              | 14 ++++++++------
 crates/orchestrator/src/generators/chain_spec.rs |  2 +-
 crates/orchestrator/src/lib.rs                   |  2 +-
 crates/orchestrator/src/network/node.rs          |  6 +++++-
 crates/provider/src/docker/client.rs             |  2 +-
 6 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/Cargo.toml b/Cargo.toml
index 3571a05..99bab16 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -43,10 +43,10 @@ pest_derive = "2.7"
 rand = "0.8"
 sha2 = { version = "0.10.2", default-features = false }
 hex = "0.4"
-sp-core = "22.0.0"
+sp-core = "31.0.0"
 libp2p = { version = "0.52" }
-subxt = "0.33.0"
-subxt-signer = { version = "0.33.0", features = ["subxt"] }
+subxt = { version = "0.35.3", features = ["substrate-compat"] }
+subxt-signer = { version = "0.35.3", features = ["subxt"] }
 tracing = "0.1.35"
 pjs-rs = "0.1.2"
 kube = "0.87.1"
diff --git a/crates/configuration/src/network.rs b/crates/configuration/src/network.rs
index 31b2ff6..1b13301 100644
--- a/crates/configuration/src/network.rs
+++ b/crates/configuration/src/network.rs
@@ -126,16 +126,16 @@ impl NetworkConfig {
             if relaychain_default_command.is_some() {
                 // we modify only nodes which don't already have a command
                 if node.command.is_none() {
-                    node.command = relaychain_default_command.clone();
+                    node.command.clone_from(&relaychain_default_command);
                 }
             }
 
             if relaychain_default_image.is_some() && node.image.is_none() {
-                node.image = relaychain_default_image.clone();
+                node.image.clone_from(&relaychain_default_image);
             }
 
             if relaychain_default_db_snapshot.is_some() && node.db_snapshot.is_none() {
-                node.db_snapshot = relaychain_default_db_snapshot.clone();
+                node.db_snapshot.clone_from(&relaychain_default_db_snapshot);
             }
 
             if !default_args.is_empty() && node.args().is_empty() {
@@ -160,16 +160,18 @@ impl NetworkConfig {
                 if parachain_default_command.is_some() {
                     // we modify only nodes which don't already have a command
                     if collator.command.is_none() {
-                        collator.command = parachain_default_command.clone();
+                        collator.command.clone_from(&parachain_default_command);
                     }
                 }
 
                 if parachain_default_image.is_some() && collator.image.is_none() {
-                    collator.image = parachain_default_image.clone();
+                    collator.image.clone_from(&parachain_default_image);
                 }
 
                 if parachain_default_db_snapshot.is_some() && collator.db_snapshot.is_none() {
-                    collator.db_snapshot = parachain_default_db_snapshot.clone();
+                    collator
+                        .db_snapshot
+                        .clone_from(&parachain_default_db_snapshot);
                 }
 
                 if !default_args.is_empty() && collator.args().is_empty() {
diff --git a/crates/orchestrator/src/generators/chain_spec.rs b/crates/orchestrator/src/generators/chain_spec.rs
index 5d44e47..777bd65 100644
--- a/crates/orchestrator/src/generators/chain_spec.rs
+++ b/crates/orchestrator/src/generators/chain_spec.rs
@@ -147,7 +147,7 @@ impl ChainSpec {
             let mut replacement_value = String::default();
             if let Some(chain_name) = self.chain_name.as_ref() {
                 if !chain_name.is_empty() {
-                    replacement_value = chain_name.clone();
+                    replacement_value.clone_from(chain_name);
                 }
             };
 
diff --git a/crates/orchestrator/src/lib.rs b/crates/orchestrator/src/lib.rs
index c7cab90..deebc4d 100644
--- a/crates/orchestrator/src/lib.rs
+++ b/crates/orchestrator/src/lib.rs
@@ -258,7 +258,7 @@ where
 
             // Is used in the register_para_options (We need to get this from the relay and not the collators)
             if node_ws_url.is_empty() {
-                node_ws_url = node.ws_uri.clone()
+                node_ws_url.clone_from(&node.ws_uri)
             }
 
             // Add the node to the `Network` instance
diff --git a/crates/orchestrator/src/network/node.rs b/crates/orchestrator/src/network/node.rs
index bc3bee8..caa60b0 100644
--- a/crates/orchestrator/src/network/node.rs
+++ b/crates/orchestrator/src/network/node.rs
@@ -66,7 +66,11 @@ impl NetworkNode {
     pub async fn client<Config: subxt::Config>(
         &self,
     ) -> Result<OnlineClient<Config>, subxt::Error> {
-        OnlineClient::from_url(&self.ws_uri).await
+        if subxt::utils::url_is_secure(&self.ws_uri)? {
+            OnlineClient::from_url(&self.ws_uri).await
+        } else {
+            OnlineClient::from_insecure_url(&self.ws_uri).await
+        }
     }
 
     /// Execute js/ts code inside [pjs_rs] custom runtime.
diff --git a/crates/provider/src/docker/client.rs b/crates/provider/src/docker/client.rs
index 2335a37..5fdc271 100644
--- a/crates/provider/src/docker/client.rs
+++ b/crates/provider/src/docker/client.rs
@@ -160,7 +160,7 @@ impl ContainerRunOptions {
     }
 
     pub fn port_mapping(mut self, port_mapping: &HashMap<Port, Port>) -> Self {
-        self.port_mapping = port_mapping.clone();
+        self.port_mapping.clone_from(port_mapping);
         self
     }
 
-- 
GitLab