diff --git a/bridges/relays/lib-substrate-relay/src/parachains/source.rs b/bridges/relays/lib-substrate-relay/src/parachains/source.rs index ba59171c8e01a..32d70cf425f0b 100644 --- a/bridges/relays/lib-substrate-relay/src/parachains/source.rs +++ b/bridges/relays/lib-substrate-relay/src/parachains/source.rs @@ -120,10 +120,15 @@ where // `max_header_id` is not set. There is no limit. AvailableHeader::Available(on_chain_para_head_id) }, - AvailableHeader::Available(max_head_id) => { + AvailableHeader::Available(max_head_id) if on_chain_para_head_id >= max_head_id => { // We report at most `max_header_id`. AvailableHeader::Available(std::cmp::min(on_chain_para_head_id, max_head_id)) }, + AvailableHeader::Available(_) => { + // the `max_head_id` is not yet available at the source chain => wait and avoid + // syncing extra headers + AvailableHeader::Unavailable + }, } } diff --git a/bridges/relays/parachains/src/parachains_loop.rs b/bridges/relays/parachains/src/parachains_loop.rs index 390b02b859459..41ebbf5aadede 100644 --- a/bridges/relays/parachains/src/parachains_loop.rs +++ b/bridges/relays/parachains/src/parachains_loop.rs @@ -256,7 +256,12 @@ where let head_at_source = read_head_at_source(&source_client, metrics.as_ref(), &best_finalized_relay_block) .await?; - let is_update_required = is_update_required::
(head_at_source, head_at_target); + let is_update_required = is_update_required::
(
+ head_at_source,
+ head_at_target,
+ best_finalized_relay_block,
+ best_target_block,
+ );
if is_update_required {
let (head_proof, head_hash) = source_client
@@ -274,10 +279,12 @@ where
})?;
log::info!(
target: "bridge",
- "Submitting {} parachain ParaId({}) head update transaction to {}",
+ "Submitting {} parachain ParaId({}) head update transaction to {}. Para hash at source relay {:?}: {:?}",
P::SourceRelayChain::NAME,
P::SourceParachain::PARACHAIN_ID,
P::TargetChain::NAME,
+ best_finalized_relay_block,
+ head_hash,
);
let transaction_tracker = target_client
@@ -304,6 +311,8 @@ where
fn is_update_required