Skip to content

Commit

Permalink
Bridge: ignore client errors when calling recently added `*_free_head…
Browse files Browse the repository at this point in the history
…ers_interval` methods (paritytech#4350)

see paritytech/parity-bridges-common#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
  • Loading branch information
svyatonik authored and TarekkMA committed Aug 2, 2024
1 parent 1a7163a commit 30efd19
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
13 changes: 12 additions & 1 deletion bridges/relays/lib-substrate-relay/src/finality/target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,24 @@ impl<P: SubstrateFinalitySyncPipeline> TargetClient<FinalitySyncPipelineAdapter<
async fn free_source_headers_interval(
&self,
) -> Result<Option<BlockNumberOf<P::SourceChain>>, 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(
Expand Down
13 changes: 12 additions & 1 deletion bridges/relays/lib-substrate-relay/src/parachains/target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,20 @@ where
async fn free_source_relay_headers_interval(
&self,
) -> Result<Option<BlockNumberOf<P::SourceRelayChain>>, 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(
Expand Down

0 comments on commit 30efd19

Please sign in to comment.