Message transactions mortality (#1191)

* transactions mortality in message and complex relays

* logging + enable in test deployments

* spellcheck

* fmt
This commit is contained in:
Svyatoslav Nikolsky
2021-10-25 13:24:48 +03:00
committed by Bastian Köcher
parent e23266c7e6
commit 1ef41a59be
20 changed files with 253 additions and 64 deletions
@@ -16,7 +16,7 @@
//! Substrate-to-Substrate headers sync entrypoint.
use crate::finality_target::SubstrateFinalityTarget;
use crate::{finality_target::SubstrateFinalityTarget, STALL_TIMEOUT};
use bp_header_chain::justification::GrandpaJustification;
use bp_runtime::AccountIdOf;
@@ -26,16 +26,8 @@ use relay_substrate_client::{
};
use relay_utils::{metrics::MetricsParams, BlockNumberBase};
use sp_core::Bytes;
use std::{fmt::Debug, marker::PhantomData, time::Duration};
use std::{fmt::Debug, marker::PhantomData};
/// Default synchronization loop timeout. If transactions generated by relay are immortal, then
/// this timeout is used.
///
/// There are no any strict requirements on block time in Substrate. But we assume here that all
/// Substrate-based chains will be designed to produce relatively fast (compared to the slowest
/// blockchains) blocks. So 1 hour seems to be a good guess for (even congested) chains to mine
/// transaction, or remove it from the pool.
pub(crate) const STALL_TIMEOUT: Duration = Duration::from_secs(60 * 60);
/// Default limit of recent finality proofs.
///
/// Finality delay of 4096 blocks is unlikely to happen in practice in
@@ -165,8 +157,8 @@ where
stall_timeout: relay_substrate_client::transaction_stall_timeout(
transactions_mortality,
TargetChain::AVERAGE_BLOCK_INTERVAL,
)
.unwrap_or(STALL_TIMEOUT),
STALL_TIMEOUT,
),
only_mandatory_headers,
},
metrics_params,