Skip to content

Commit

Permalink
ignore client errors when calling recently added `*_free_headers_inte…
Browse files Browse the repository at this point in the history
…rval` methods: we need to support unupgraded chains in relay
  • Loading branch information
svyatonik committed May 2, 2024
1 parent e5a93fb commit 28ae5cb
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 28ae5cb

Please sign in to comment.