diff --git a/bridges/relays/client-millau/src/lib.rs b/bridges/relays/client-millau/src/lib.rs index 08bd1d76324d8..36b7cb792b436 100644 --- a/bridges/relays/client-millau/src/lib.rs +++ b/bridges/relays/client-millau/src/lib.rs @@ -104,7 +104,7 @@ impl TransactionSignScheme for Millau { fn sign_transaction(param: SignParam) -> Result { let raw_payload = SignedPayload::from_raw( - param.unsigned.call.clone(), + param.unsigned.call, ( frame_system::CheckNonZeroSender::::new(), frame_system::CheckSpecVersion::::new(), diff --git a/bridges/relays/client-rialto/src/lib.rs b/bridges/relays/client-rialto/src/lib.rs index 67b96563817e3..733ca9d146570 100644 --- a/bridges/relays/client-rialto/src/lib.rs +++ b/bridges/relays/client-rialto/src/lib.rs @@ -111,7 +111,7 @@ impl TransactionSignScheme for Rialto { fn sign_transaction(param: SignParam) -> Result { let raw_payload = SignedPayload::from_raw( - param.unsigned.call.clone(), + param.unsigned.call, ( frame_system::CheckNonZeroSender::::new(), frame_system::CheckSpecVersion::::new(), diff --git a/bridges/relays/client-substrate/src/client.rs b/bridges/relays/client-substrate/src/client.rs index 53ebe81e8604d..c6fd07c5ae599 100644 --- a/bridges/relays/client-substrate/src/client.rs +++ b/bridges/relays/client-substrate/src/client.rs @@ -80,7 +80,7 @@ pub struct Client { /// Tokio runtime handle. tokio: Arc, /// Client connection params. - params: ConnectionParams, + params: Arc, /// Substrate RPC client. client: Arc, /// Genesis block hash. @@ -99,7 +99,7 @@ impl relay_utils::relay_loop::Client for Client { type Error = Error; async fn reconnect(&mut self) -> Result<()> { - let (tokio, client) = Self::build_client(self.params.clone()).await?; + let (tokio, client) = Self::build_client(&self.params).await?; self.tokio = tokio; self.client = client; Ok(()) @@ -131,6 +131,7 @@ impl Client { /// This function will keep connecting to given Substrate node until connection is established /// and is functional. If attempt fail, it will wait for `RECONNECT_DELAY` and retry again. pub async fn new(params: ConnectionParams) -> Self { + let params = Arc::new(params); loop { match Self::try_connect(params.clone()).await { Ok(client) => return client, @@ -149,8 +150,8 @@ impl Client { /// Try to connect to Substrate node over websocket. Returns Substrate RPC client if connection /// has been established or error otherwise. - pub async fn try_connect(params: ConnectionParams) -> Result { - let (tokio, client) = Self::build_client(params.clone()).await?; + pub async fn try_connect(params: Arc) -> Result { + let (tokio, client) = Self::build_client(¶ms).await?; let number: C::BlockNumber = Zero::zero(); let genesis_hash_client = client.clone(); @@ -173,7 +174,7 @@ impl Client { /// Build client to use in connection. async fn build_client( - params: ConnectionParams, + params: &ConnectionParams, ) -> Result<(Arc, Arc)> { let tokio = tokio::runtime::Runtime::new()?; let uri = format!( diff --git a/bridges/relays/lib-substrate-relay/src/error.rs b/bridges/relays/lib-substrate-relay/src/error.rs index 5accba4fc7ce5..64ed3a4fd49c6 100644 --- a/bridges/relays/lib-substrate-relay/src/error.rs +++ b/bridges/relays/lib-substrate-relay/src/error.rs @@ -55,9 +55,6 @@ pub enum Error { /// Failed to retrieve header by the hash from the source chain. #[error("Failed to retrieve {0} header with hash {1}: {:?}")] RetrieveHeader(&'static str, Hash, client::Error), - /// Failed to retrieve best finalized source header hash from the target chain. - #[error("Failed to retrieve best finalized {0} header from the target chain: {1}")] - RetrieveBestFinalizedHeaderHash(&'static str, client::Error), /// Failed to submit signed extrinsic from to the target chain. #[error( "Failed to retrieve `is_initialized` flag of the with-{0} finality pallet at {1}: {2:?}"