Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always run on-demand headers relay in complex relay #975

Merged
merged 2 commits into from
May 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion relays/bin-substrate/src/cli/relay_headers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ impl RelayHeaders {
Finality::new(target_client.clone(), target_sign),
source_client,
target_client,
false,
metrics_params,
)
.await
Expand Down
8 changes: 3 additions & 5 deletions relays/bin-substrate/src/finality_pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ use sp_core::Bytes;
use std::{fmt::Debug, marker::PhantomData, time::Duration};

/// Default synchronization loop timeout.
const STALL_TIMEOUT: Duration = Duration::from_secs(120);
pub(crate) const STALL_TIMEOUT: Duration = Duration::from_secs(120);
/// Default limit of recent finality proofs.
///
/// Finality delay of 4096 blocks is unlikely to happen in practice in
/// Substrate+GRANDPA based chains (good to know).
const RECENT_FINALITY_PROOFS_LIMIT: usize = 4096;
pub(crate) const RECENT_FINALITY_PROOFS_LIMIT: usize = 4096;

/// Headers sync pipeline for Substrate <-> Substrate relays.
pub trait SubstrateFinalitySyncPipeline: FinalitySyncPipeline {
Expand Down Expand Up @@ -119,7 +119,6 @@ pub async fn run<SourceChain, TargetChain, P>(
pipeline: P,
source_client: Client<SourceChain>,
target_client: Client<TargetChain>,
is_on_demand_task: bool,
metrics_params: MetricsParams,
) -> anyhow::Result<()>
where
Expand All @@ -142,10 +141,9 @@ where
);

finality_relay::run(
FinalitySource::new(source_client),
FinalitySource::new(source_client, None),
SubstrateFinalityTarget::new(target_client, pipeline),
FinalitySyncParams {
is_on_demand_task,
tick: std::cmp::max(SourceChain::AVERAGE_BLOCK_INTERVAL, TargetChain::AVERAGE_BLOCK_INTERVAL),
recent_finality_proofs_limit: RECENT_FINALITY_PROOFS_LIMIT,
stall_timeout: STALL_TIMEOUT,
Expand Down
2 changes: 1 addition & 1 deletion relays/bin-substrate/src/messages_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ where

async fn require_target_header_on_source(&self, id: TargetHeaderIdOf<P>) {
if let Some(ref target_to_source_headers_relay) = self.target_to_source_headers_relay {
target_to_source_headers_relay.require_finalized_header(id);
target_to_source_headers_relay.require_finalized_header(id).await;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion relays/bin-substrate/src/messages_target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ where

async fn require_source_header_on_target(&self, id: SourceHeaderIdOf<P>) {
if let Some(ref source_to_target_headers_relay) = self.source_to_target_headers_relay {
source_to_target_headers_relay.require_finalized_header(id);
source_to_target_headers_relay.require_finalized_header(id).await;
}
}
}
Loading