From 171bedc2b319e18d51a7b510d8bd4cfd2e645c31 Mon Sep 17 00:00:00 2001 From: Svyatoslav Nikolsky Date: Thu, 2 May 2024 13:02:59 +0300 Subject: [PATCH] Bridge: ignore client errors when calling recently added `*_free_headers_interval` methods (#4350) see https://github.com/paritytech/parity-bridges-common/issues/2974 : we still need to support unupgraded chains (BHK and BHP) in relay We may need to revert this change when all chains are upgraded --- .../lib-substrate-relay/src/finality/target.rs | 13 ++++++++++++- .../lib-substrate-relay/src/parachains/target.rs | 13 ++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/bridges/relays/lib-substrate-relay/src/finality/target.rs b/bridges/relays/lib-substrate-relay/src/finality/target.rs index adbcfe0096d5..0874fa53549c 100644 --- a/bridges/relays/lib-substrate-relay/src/finality/target.rs +++ b/bridges/relays/lib-substrate-relay/src/finality/target.rs @@ -107,13 +107,24 @@ impl TargetClient Result>, Self::Error> { - self.client + Ok(self + .client .typed_state_call( P::SourceChain::FREE_HEADERS_INTERVAL_METHOD.into(), (), Some(self.client.best_header().await?.hash()), ) .await + .unwrap_or_else(|e| { + log::info!( + target: "bridge", + "Call of {} at {} has failed with an error: {:?}. Treating as `None`", + P::SourceChain::FREE_HEADERS_INTERVAL_METHOD, + P::TargetChain::NAME, + e, + ); + None + })) } async fn submit_finality_proof( diff --git a/bridges/relays/lib-substrate-relay/src/parachains/target.rs b/bridges/relays/lib-substrate-relay/src/parachains/target.rs index e10d15b6edf6..531d55b53223 100644 --- a/bridges/relays/lib-substrate-relay/src/parachains/target.rs +++ b/bridges/relays/lib-substrate-relay/src/parachains/target.rs @@ -122,9 +122,20 @@ where async fn free_source_relay_headers_interval( &self, ) -> Result>, Self::Error> { - self.target_client + Ok(self + .target_client .typed_state_call(P::SourceRelayChain::FREE_HEADERS_INTERVAL_METHOD.into(), (), None) .await + .unwrap_or_else(|e| { + log::info!( + target: "bridge", + "Call of {} at {} has failed with an error: {:?}. Treating as `None`", + P::SourceRelayChain::FREE_HEADERS_INTERVAL_METHOD, + P::TargetChain::NAME, + e, + ); + None + })) } async fn parachain_head(