mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 14:01:02 +00:00
Fix full spellcheck (#1076)
* fix(spellcheck): test of fixing * fix(hunspell): improved many typos etc. * fix(hunspell): all errors solved * fix(hunspell): extended scope of files - the build should fail * Return error code. * Fix spelling, sort dictionary. * fix(hunspell): added fix to gitlabs check * fix(typo): one typo and test of verification on github * fix(typo): one typo Co-authored-by: Tomasz Drwięga <tomasz@parity.io>
This commit is contained in:
committed by
Bastian Köcher
parent
562fac801d
commit
f86d101d7c
@@ -29,7 +29,7 @@ pub struct Cli {
|
|||||||
/// Possible subcommands of the main binary.
|
/// Possible subcommands of the main binary.
|
||||||
#[derive(Debug, StructOpt)]
|
#[derive(Debug, StructOpt)]
|
||||||
pub enum Subcommand {
|
pub enum Subcommand {
|
||||||
/// Key management cli utilities
|
/// Key management CLI utilities
|
||||||
Key(sc_cli::KeySubcommand),
|
Key(sc_cli::KeySubcommand),
|
||||||
|
|
||||||
/// Verify a signature for a message, provided on STDIN, with a given (public or secret) key.
|
/// Verify a signature for a message, provided on STDIN, with a given (public or secret) key.
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ parameter_types! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_timestamp::Config for Runtime {
|
impl pallet_timestamp::Config for Runtime {
|
||||||
/// A timestamp: milliseconds since the unix epoch.
|
/// A timestamp: milliseconds since the UNIX epoch.
|
||||||
type Moment = u64;
|
type Moment = u64;
|
||||||
type OnTimestampSet = Aura;
|
type OnTimestampSet = Aura;
|
||||||
type MinimumPeriod = MinimumPeriod;
|
type MinimumPeriod = MinimumPeriod;
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ pub struct Cli {
|
|||||||
/// Possible subcommands of the main binary.
|
/// Possible subcommands of the main binary.
|
||||||
#[derive(Debug, StructOpt)]
|
#[derive(Debug, StructOpt)]
|
||||||
pub enum Subcommand {
|
pub enum Subcommand {
|
||||||
/// Key management cli utilities
|
/// Key management CLI utilities
|
||||||
Key(sc_cli::KeySubcommand),
|
Key(sc_cli::KeySubcommand),
|
||||||
|
|
||||||
/// Verify a signature for a message, provided on STDIN, with a given (public or secret) key.
|
/// Verify a signature for a message, provided on STDIN, with a given (public or secret) key.
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ pub struct EthereumTransactionInclusionProof {
|
|||||||
///
|
///
|
||||||
/// The assumption is that this pair will never appear more than once in
|
/// The assumption is that this pair will never appear more than once in
|
||||||
/// transactions included into finalized blocks. This is obviously true
|
/// transactions included into finalized blocks. This is obviously true
|
||||||
/// for any existing eth-like chain (that keep current tx format), because
|
/// for any existing eth-like chain (that keep current TX format), because
|
||||||
/// otherwise transaction can be replayed over and over.
|
/// otherwise transaction can be replayed over and over.
|
||||||
#[derive(Encode, Decode, PartialEq, RuntimeDebug)]
|
#[derive(Encode, Decode, PartialEq, RuntimeDebug)]
|
||||||
pub struct EthereumTransactionTag {
|
pub struct EthereumTransactionTag {
|
||||||
@@ -65,7 +65,7 @@ pub struct EthereumTransactionTag {
|
|||||||
pub nonce: sp_core::U256,
|
pub nonce: sp_core::U256,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Eth transaction from runtime perspective.
|
/// Ethereum transaction from runtime perspective.
|
||||||
pub struct EthTransaction;
|
pub struct EthTransaction;
|
||||||
|
|
||||||
impl MaybeLockFundsTransaction for EthTransaction {
|
impl MaybeLockFundsTransaction for EthTransaction {
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ frame_support::parameter_types! {
|
|||||||
kovan_validators_configuration();
|
kovan_validators_configuration();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Max number of finalized headers to keep. It is equivalent of ~24 hours of
|
/// Max number of finalized headers to keep. It is equivalent of around 24 hours of
|
||||||
/// finalized blocks on current Kovan chain.
|
/// finalized blocks on current Kovan chain.
|
||||||
const FINALIZED_HEADERS_TO_KEEP: u64 = 20_000;
|
const FINALIZED_HEADERS_TO_KEEP: u64 = 20_000;
|
||||||
|
|
||||||
|
|||||||
@@ -370,7 +370,7 @@ parameter_types! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_timestamp::Config for Runtime {
|
impl pallet_timestamp::Config for Runtime {
|
||||||
/// A timestamp: milliseconds since the unix epoch.
|
/// A timestamp: milliseconds since the UNIX epoch.
|
||||||
type Moment = bp_rialto::Moment;
|
type Moment = bp_rialto::Moment;
|
||||||
type OnTimestampSet = Babe;
|
type OnTimestampSet = Babe;
|
||||||
type MinimumPeriod = MinimumPeriod;
|
type MinimumPeriod = MinimumPeriod;
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ Referer to the [pallet documentation](../modules/substrate/src/lib.rs) for more
|
|||||||
|
|
||||||
There is currently no reward strategy for the relayers at all. They also are not required to be
|
There is currently no reward strategy for the relayers at all. They also are not required to be
|
||||||
staked or registered on-chain, unlike in other bridge designs. We consider the header sync to be
|
staked or registered on-chain, unlike in other bridge designs. We consider the header sync to be
|
||||||
an essential part of the bridge and the incentivisation should be happening on the higher layers.
|
an essential part of the bridge and the incentivization should be happening on the higher layers.
|
||||||
|
|
||||||
At the moment, signed transactions are the only way to submit headers to the header sync pallet.
|
At the moment, signed transactions are the only way to submit headers to the header sync pallet.
|
||||||
However, in the future we would like to use unsigned transactions for headers delivery. This will
|
However, in the future we would like to use unsigned transactions for headers delivery. This will
|
||||||
@@ -110,7 +110,7 @@ Users of the pallet add their messages to an "outbound lane" on the source chain
|
|||||||
finalized message relayers are responsible for reading the current queue of messages and submitting
|
finalized message relayers are responsible for reading the current queue of messages and submitting
|
||||||
some (or all) of them to the "inbound lane" of the target chain. Each message has a `nonce`
|
some (or all) of them to the "inbound lane" of the target chain. Each message has a `nonce`
|
||||||
associated with it, which serves as the ordering of messages. The inbound lane stores the last
|
associated with it, which serves as the ordering of messages. The inbound lane stores the last
|
||||||
delivered nonce to prevent replaying messages. To succesfuly deliver the message to the inbound lane
|
delivered nonce to prevent replaying messages. To successfully deliver the message to the inbound lane
|
||||||
on target chain the relayer has to present present a storage proof which shows that the message was
|
on target chain the relayer has to present present a storage proof which shows that the message was
|
||||||
part of the outbound lane on the source chain.
|
part of the outbound lane on the source chain.
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
//! The messages are interpreted directly as runtime `Call`. We attempt to decode
|
//! The messages are interpreted directly as runtime `Call`. We attempt to decode
|
||||||
//! them and then dispatch as usual. To prevent compatibility issues, the Calls have
|
//! them and then dispatch as usual. To prevent compatibility issues, the Calls have
|
||||||
//! to include a `spec_version`. This will be checked before dispatch. In the case of
|
//! to include a `spec_version`. This will be checked before dispatch. In the case of
|
||||||
//! a succesful dispatch an event is emitted.
|
//! a successful dispatch an event is emitted.
|
||||||
|
|
||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
#![warn(missing_docs)]
|
#![warn(missing_docs)]
|
||||||
|
|||||||
@@ -28,9 +28,9 @@ pub enum Error {
|
|||||||
BlockNumberDecode,
|
BlockNumberDecode,
|
||||||
/// Failed to decode Substrate header.
|
/// Failed to decode Substrate header.
|
||||||
HeaderDecode(codec::Error),
|
HeaderDecode(codec::Error),
|
||||||
/// Failed to decode best voters set.
|
/// Failed to decode the best voters set.
|
||||||
BestSetDecode(codec::Error),
|
BestSetDecode(codec::Error),
|
||||||
/// Best voters set is invalid.
|
/// The best voters set is invalid.
|
||||||
InvalidBestSet,
|
InvalidBestSet,
|
||||||
/// Failed to decode finality proof.
|
/// Failed to decode finality proof.
|
||||||
FinalityProofDecode(codec::Error),
|
FinalityProofDecode(codec::Error),
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ pub struct CachedFinalityVotes<Submitter> {
|
|||||||
/// best finalized.
|
/// best finalized.
|
||||||
pub stopped_at_finalized_sibling: bool,
|
pub stopped_at_finalized_sibling: bool,
|
||||||
/// Header ancestors that were read while we have been searching for
|
/// Header ancestors that were read while we have been searching for
|
||||||
/// cached votes entry. Newest header has index 0.
|
/// cached votes entry. The newest header has index 0.
|
||||||
pub unaccounted_ancestry: VecDeque<(HeaderId, Option<Submitter>, AuraHeader)>,
|
pub unaccounted_ancestry: VecDeque<(HeaderId, Option<Submitter>, AuraHeader)>,
|
||||||
/// Cached finality votes, if they have been found. The associated
|
/// Cached finality votes, if they have been found. The associated
|
||||||
/// header is not included into `unaccounted_ancestry`.
|
/// header is not included into `unaccounted_ancestry`.
|
||||||
@@ -59,7 +59,7 @@ pub struct FinalityEffects<Submitter> {
|
|||||||
pub struct FinalityVotes<Submitter> {
|
pub struct FinalityVotes<Submitter> {
|
||||||
/// Number of votes per each validator.
|
/// Number of votes per each validator.
|
||||||
pub votes: BTreeMap<Address, u64>,
|
pub votes: BTreeMap<Address, u64>,
|
||||||
/// Ancestry blocks with oldest ancestors at the beginning and newest at the
|
/// Ancestry blocks with the oldest ancestors at the beginning and newest at the
|
||||||
/// end of the queue.
|
/// end of the queue.
|
||||||
pub ancestry: VecDeque<FinalityAncestor<Submitter>>,
|
pub ancestry: VecDeque<FinalityAncestor<Submitter>>,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ use crate::{AuraConfiguration, ChainTime, ChangeToEnact, PruningStrategy, Storag
|
|||||||
use bp_eth_poa::{AuraHeader, HeaderId, Receipt};
|
use bp_eth_poa::{AuraHeader, HeaderId, Receipt};
|
||||||
use sp_std::{collections::btree_map::BTreeMap, prelude::*};
|
use sp_std::{collections::btree_map::BTreeMap, prelude::*};
|
||||||
|
|
||||||
/// Imports bunch of headers and updates blocks finality.
|
/// Imports a bunch of headers and updates blocks finality.
|
||||||
///
|
///
|
||||||
/// Transactions receipts must be provided if `header_import_requires_receipts()`
|
/// Transactions receipts must be provided if `header_import_requires_receipts()`
|
||||||
/// has returned true.
|
/// has returned true.
|
||||||
|
|||||||
@@ -169,8 +169,8 @@ struct PruningRange {
|
|||||||
/// were unable to prune for whatever reason (i.e. if it isn't finalized yet and has
|
/// were unable to prune for whatever reason (i.e. if it isn't finalized yet and has
|
||||||
/// scheduled validators set change).
|
/// scheduled validators set change).
|
||||||
pub oldest_unpruned_block: u64,
|
pub oldest_unpruned_block: u64,
|
||||||
/// Number of oldest block(s) that we want to keep. We want to prune blocks in range
|
/// Number of the oldest block(s) that we want to keep. We want to prune blocks in range
|
||||||
/// [`oldest_unpruned_block`; `oldest_block_to_keep`).
|
/// [ `oldest_unpruned_block`; `oldest_block_to_keep` ).
|
||||||
pub oldest_block_to_keep: u64,
|
pub oldest_block_to_keep: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -316,10 +316,10 @@ pub trait PruningStrategy: Default {
|
|||||||
/// Pallet may prune both finalized and unfinalized blocks. But it can't give any
|
/// Pallet may prune both finalized and unfinalized blocks. But it can't give any
|
||||||
/// guarantees on when it will happen. Example: if some unfinalized block at height N
|
/// guarantees on when it will happen. Example: if some unfinalized block at height N
|
||||||
/// has scheduled validators set change, then the module won't prune any blocks with
|
/// has scheduled validators set change, then the module won't prune any blocks with
|
||||||
/// number >= N even if strategy allows that.
|
/// number greater than or equal to N even if strategy allows that.
|
||||||
///
|
///
|
||||||
/// If your strategy allows pruning unfinalized blocks, this could lead to switch
|
/// If your strategy allows pruning unfinalized blocks, this could lead to switch
|
||||||
/// between finalized forks (only if authorities are misbehaving). But since 50%+1 (or 2/3)
|
/// between finalized forks (only if authorities are misbehaving). But since 50 percent plus one (or 2/3)
|
||||||
/// authorities are able to do whatever they want with the chain, this isn't considered
|
/// authorities are able to do whatever they want with the chain, this isn't considered
|
||||||
/// fatal. If your strategy only prunes finalized blocks, we'll never be able to finalize
|
/// fatal. If your strategy only prunes finalized blocks, we'll never be able to finalize
|
||||||
/// header that isn't descendant of current best finalized block.
|
/// header that isn't descendant of current best finalized block.
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
//! Although the name implies that it is used by tests, it shouldn't be be used _directly_ by tests.
|
//! Although the name implies that it is used by tests, it shouldn't be be used _directly_ by tests.
|
||||||
//! Instead these utilities should be used by the Mock runtime, which in turn is used by tests.
|
//! Instead these utilities should be used by the Mock runtime, which in turn is used by tests.
|
||||||
//!
|
//!
|
||||||
//! On the other hand, they may be used directly by the bechmarking module.
|
//! On the other hand, they may be used directly by the benchmark module.
|
||||||
|
|
||||||
// Since this is test code it's fine that not everything is used
|
// Since this is test code it's fine that not everything is used
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ pub fn is_importable_header<S: Storage>(storage: &S, header: &AuraHeader) -> Res
|
|||||||
Ok((id, finalized_id))
|
Ok((id, finalized_id))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Try accept unsigned aura header into transaction pool.
|
/// Try to accept unsigned aura header into transaction pool.
|
||||||
///
|
///
|
||||||
/// Returns required and provided tags.
|
/// Returns required and provided tags.
|
||||||
pub fn accept_aura_header_into_pool<S: Storage, CT: ChainTime>(
|
pub fn accept_aura_header_into_pool<S: Storage, CT: ChainTime>(
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
//! 2. The number of `pre-commits` in the justification
|
//! 2. The number of `pre-commits` in the justification
|
||||||
//!
|
//!
|
||||||
//! Vote ancestries are the headers between (`finality_target`, `head_of_chain`], where
|
//! Vote ancestries are the headers between (`finality_target`, `head_of_chain`], where
|
||||||
//! `header_of_chain` is a decendant of `finality_target`.
|
//! `header_of_chain` is a descendant of `finality_target`.
|
||||||
//!
|
//!
|
||||||
//! Pre-commits are messages which are signed by validators at the head of the chain they think is
|
//! Pre-commits are messages which are signed by validators at the head of the chain they think is
|
||||||
//! the best.
|
//! the best.
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
//! [A] <- [B] <- [C]
|
//! [A] <- [B] <- [C]
|
||||||
//!
|
//!
|
||||||
//! The common ancestor of both forks is block A, so this is what GRANDPA will finalize. In order to
|
//! The common ancestor of both forks is block A, so this is what GRANDPA will finalize. In order to
|
||||||
//! verify this we will have vote ancestries of [B, C, B', C'] and pre-commits [C, C'].
|
//! verify this we will have vote ancestries of `[B, C, B', C']` and pre-commits `[C, C']`.
|
||||||
//!
|
//!
|
||||||
//! Note that the worst case scenario here would be a justification where each validator has it's
|
//! Note that the worst case scenario here would be a justification where each validator has it's
|
||||||
//! own fork which is `SESSION_LENGTH` blocks long.
|
//! own fork which is `SESSION_LENGTH` blocks long.
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
//!
|
//!
|
||||||
//! Since this pallet only tracks finalized headers it does not deal with forks. Forks can only
|
//! Since this pallet only tracks finalized headers it does not deal with forks. Forks can only
|
||||||
//! occur if the GRANDPA validator set on the bridged chain is either colluding or there is a severe
|
//! occur if the GRANDPA validator set on the bridged chain is either colluding or there is a severe
|
||||||
//! bug causing resulting in an equivocation. Such events are outside of the scope of this pallet.
|
//! bug causing resulting in an equivocation. Such events are outside the scope of this pallet.
|
||||||
//! Shall the fork occur on the bridged chain governance intervention will be required to
|
//! Shall the fork occur on the bridged chain governance intervention will be required to
|
||||||
//! re-initialize the bridge and track the right fork.
|
//! re-initialize the bridge and track the right fork.
|
||||||
|
|
||||||
@@ -175,7 +175,7 @@ pub mod pallet {
|
|||||||
/// Bootstrap the bridge pallet with an initial header and authority set from which to sync.
|
/// Bootstrap the bridge pallet with an initial header and authority set from which to sync.
|
||||||
///
|
///
|
||||||
/// The initial configuration provided does not need to be the genesis header of the bridged
|
/// The initial configuration provided does not need to be the genesis header of the bridged
|
||||||
/// chain, it can be any arbirary header. You can also provide the next scheduled set change
|
/// chain, it can be any arbitrary header. You can also provide the next scheduled set change
|
||||||
/// if it is already know.
|
/// if it is already know.
|
||||||
///
|
///
|
||||||
/// This function is only allowed to be called from a trusted origin and writes to storage
|
/// This function is only allowed to be called from a trusted origin and writes to storage
|
||||||
@@ -355,7 +355,7 @@ pub mod pallet {
|
|||||||
/// is found it will be enacted immediately.
|
/// is found it will be enacted immediately.
|
||||||
///
|
///
|
||||||
/// This function does not support forced changes, or scheduled changes with delays
|
/// This function does not support forced changes, or scheduled changes with delays
|
||||||
/// since these types of changes are indicitive of abnormal behaviour from GRANDPA.
|
/// since these types of changes are indicative of abnormal behavior from GRANDPA.
|
||||||
///
|
///
|
||||||
/// Returned value will indicate if a change was enacted or not.
|
/// Returned value will indicate if a change was enacted or not.
|
||||||
pub(crate) fn try_enact_authority_change<T: Config<I>, I: 'static>(
|
pub(crate) fn try_enact_authority_change<T: Config<I>, I: 'static>(
|
||||||
@@ -401,7 +401,7 @@ pub mod pallet {
|
|||||||
///
|
///
|
||||||
/// Will use the GRANDPA current authorities known to the pallet.
|
/// Will use the GRANDPA current authorities known to the pallet.
|
||||||
///
|
///
|
||||||
/// If succesful it returns the decoded GRANDPA justification so we can refund any weight which
|
/// If successful it returns the decoded GRANDPA justification so we can refund any weight which
|
||||||
/// was overcharged in the initial call.
|
/// was overcharged in the initial call.
|
||||||
pub(crate) fn verify_justification<T: Config<I>, I: 'static>(
|
pub(crate) fn verify_justification<T: Config<I>, I: 'static>(
|
||||||
justification: &GrandpaJustification<BridgedHeader<T, I>>,
|
justification: &GrandpaJustification<BridgedHeader<T, I>>,
|
||||||
@@ -432,7 +432,7 @@ pub mod pallet {
|
|||||||
/// Import a previously verified header to the storage.
|
/// Import a previously verified header to the storage.
|
||||||
///
|
///
|
||||||
/// Note this function solely takes care of updating the storage and pruning old entries,
|
/// Note this function solely takes care of updating the storage and pruning old entries,
|
||||||
/// but does not verify the validaty of such import.
|
/// but does not verify the validity of such import.
|
||||||
pub(crate) fn insert_header<T: Config<I>, I: 'static>(header: BridgedHeader<T, I>, hash: BridgedBlockHash<T, I>) {
|
pub(crate) fn insert_header<T: Config<I>, I: 'static>(header: BridgedHeader<T, I>, hash: BridgedBlockHash<T, I>) {
|
||||||
let index = <ImportedHashesPointer<T, I>>::get();
|
let index = <ImportedHashesPointer<T, I>>::get();
|
||||||
let pruning = <ImportedHashes<T, I>>::try_get(index);
|
let pruning = <ImportedHashes<T, I>>::try_get(index);
|
||||||
|
|||||||
@@ -31,14 +31,14 @@ use sp_std::fmt::Debug;
|
|||||||
|
|
||||||
/// Instant message payments made in given currency.
|
/// Instant message payments made in given currency.
|
||||||
///
|
///
|
||||||
/// The balance is initally reserved in a special `relayers-fund` account, and transferred
|
/// The balance is initially reserved in a special `relayers-fund` account, and transferred
|
||||||
/// to the relayer when message delivery is confirmed.
|
/// to the relayer when message delivery is confirmed.
|
||||||
///
|
///
|
||||||
/// Additionaly, confirmation transaction submitter (`confirmation_relayer`) is reimbursed
|
/// Additionally, confirmation transaction submitter (`confirmation_relayer`) is reimbursed
|
||||||
/// with the confirmation rewards (part of message fee, reserved to pay for delivery confirmation).
|
/// with the confirmation rewards (part of message fee, reserved to pay for delivery confirmation).
|
||||||
///
|
///
|
||||||
/// NOTE The `relayers-fund` account must always exist i.e. be over Existential Deposit (ED; the
|
/// NOTE The `relayers-fund` account must always exist i.e. be over Existential Deposit (ED; the
|
||||||
/// pallet enforces that) to make sure that even if the message cost is below ED it is still payed
|
/// pallet enforces that) to make sure that even if the message cost is below ED it is still paid
|
||||||
/// to the relayer account.
|
/// to the relayer account.
|
||||||
/// NOTE It's within relayer's interest to keep their balance above ED as well, to make sure they
|
/// NOTE It's within relayer's interest to keep their balance above ED as well, to make sure they
|
||||||
/// can receive the payment.
|
/// can receive the payment.
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ mod mock;
|
|||||||
pub trait Config<I = DefaultInstance>: frame_system::Config {
|
pub trait Config<I = DefaultInstance>: frame_system::Config {
|
||||||
// General types
|
// General types
|
||||||
|
|
||||||
/// They overarching event type.
|
/// They are overarching event type.
|
||||||
type Event: From<Event<Self, I>> + Into<<Self as frame_system::Config>::Event>;
|
type Event: From<Event<Self, I>> + Into<<Self as frame_system::Config>::Event>;
|
||||||
/// Benchmarks results from runtime we're plugged into.
|
/// Benchmarks results from runtime we're plugged into.
|
||||||
type WeightInfo: WeightInfoExt;
|
type WeightInfo: WeightInfoExt;
|
||||||
@@ -786,22 +786,22 @@ impl<T: Config<I>, I: Instance> Pallet<T, I> {
|
|||||||
OutboundMessages::<T, I>::get(MessageKey { lane_id: lane, nonce })
|
OutboundMessages::<T, I>::get(MessageKey { lane_id: lane, nonce })
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get nonce of latest generated message at given outbound lane.
|
/// Get nonce of the latest generated message at given outbound lane.
|
||||||
pub fn outbound_latest_generated_nonce(lane: LaneId) -> MessageNonce {
|
pub fn outbound_latest_generated_nonce(lane: LaneId) -> MessageNonce {
|
||||||
OutboundLanes::<I>::get(&lane).latest_generated_nonce
|
OutboundLanes::<I>::get(&lane).latest_generated_nonce
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get nonce of latest confirmed message at given outbound lane.
|
/// Get nonce of the latest confirmed message at given outbound lane.
|
||||||
pub fn outbound_latest_received_nonce(lane: LaneId) -> MessageNonce {
|
pub fn outbound_latest_received_nonce(lane: LaneId) -> MessageNonce {
|
||||||
OutboundLanes::<I>::get(&lane).latest_received_nonce
|
OutboundLanes::<I>::get(&lane).latest_received_nonce
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get nonce of latest received message at given inbound lane.
|
/// Get nonce of the latest received message at given inbound lane.
|
||||||
pub fn inbound_latest_received_nonce(lane: LaneId) -> MessageNonce {
|
pub fn inbound_latest_received_nonce(lane: LaneId) -> MessageNonce {
|
||||||
InboundLanes::<T, I>::get(&lane).last_delivered_nonce()
|
InboundLanes::<T, I>::get(&lane).last_delivered_nonce()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get nonce of latest confirmed message at given inbound lane.
|
/// Get nonce of the latest confirmed message at given inbound lane.
|
||||||
pub fn inbound_latest_confirmed_nonce(lane: LaneId) -> MessageNonce {
|
pub fn inbound_latest_confirmed_nonce(lane: LaneId) -> MessageNonce {
|
||||||
InboundLanes::<T, I>::get(&lane).last_confirmed_nonce
|
InboundLanes::<T, I>::get(&lane).last_confirmed_nonce
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -386,7 +386,7 @@ impl OnDeliveryConfirmed for TestOnDeliveryConfirmed1 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Seconde on-messages-delivered callback.
|
/// Second on-messages-delivered callback.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct TestOnDeliveryConfirmed2;
|
pub struct TestOnDeliveryConfirmed2;
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ pub enum ReceivalConfirmationResult {
|
|||||||
/// New messages have been confirmed by the confirmation transaction.
|
/// New messages have been confirmed by the confirmation transaction.
|
||||||
ConfirmedMessages(DeliveredMessages),
|
ConfirmedMessages(DeliveredMessages),
|
||||||
/// Confirmation transaction brings no new confirmation. This may be a result of relayer
|
/// Confirmation transaction brings no new confirmation. This may be a result of relayer
|
||||||
/// error or several relayers runnng.
|
/// error or several relayers running.
|
||||||
NoNewConfirmations,
|
NoNewConfirmations,
|
||||||
/// Bridged chain is trying to confirm more messages than we have generated. May be a result
|
/// Bridged chain is trying to confirm more messages than we have generated. May be a result
|
||||||
/// of invalid bridged chain storage.
|
/// of invalid bridged chain storage.
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ pub trait WeightInfoExt: WeightInfo {
|
|||||||
weight_of_two_messages_and_two_tx_overheads.saturating_sub(weight_of_two_messages_and_single_tx_overhead)
|
weight_of_two_messages_and_two_tx_overheads.saturating_sub(weight_of_two_messages_and_single_tx_overhead)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns weight that needs to be accounted when receiving given number of messages with message
|
/// Returns weight that needs to be accounted when receiving given a number of messages with message
|
||||||
/// delivery transaction (`receive_messages_proof`).
|
/// delivery transaction (`receive_messages_proof`).
|
||||||
fn receive_messages_proof_messages_overhead(messages: MessageNonce) -> Weight {
|
fn receive_messages_proof_messages_overhead(messages: MessageNonce) -> Weight {
|
||||||
let weight_of_two_messages_and_single_tx_overhead = Self::receive_two_messages_proof();
|
let weight_of_two_messages_and_single_tx_overhead = Self::receive_two_messages_proof();
|
||||||
@@ -293,7 +293,7 @@ pub trait WeightInfoExt: WeightInfo {
|
|||||||
weight_of_two_messages_and_two_tx_overheads.saturating_sub(weight_of_two_messages_and_single_tx_overhead)
|
weight_of_two_messages_and_two_tx_overheads.saturating_sub(weight_of_two_messages_and_single_tx_overhead)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns weight that needs to be accounted when receiving confirmations for given number of
|
/// Returns weight that needs to be accounted when receiving confirmations for given a number of
|
||||||
/// messages with delivery confirmation transaction (`receive_messages_delivery_proof`).
|
/// messages with delivery confirmation transaction (`receive_messages_delivery_proof`).
|
||||||
fn receive_messages_delivery_proof_messages_overhead(messages: MessageNonce) -> Weight {
|
fn receive_messages_delivery_proof_messages_overhead(messages: MessageNonce) -> Weight {
|
||||||
let weight_of_two_messages = Self::receive_delivery_proof_for_two_messages_by_single_relayer();
|
let weight_of_two_messages = Self::receive_delivery_proof_for_two_messages_by_single_relayer();
|
||||||
@@ -303,7 +303,7 @@ pub trait WeightInfoExt: WeightInfo {
|
|||||||
.saturating_mul(messages as Weight)
|
.saturating_mul(messages as Weight)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns weight that needs to be accounted when receiving confirmations for given number of
|
/// Returns weight that needs to be accounted when receiving confirmations for given a number of
|
||||||
/// relayers entries with delivery confirmation transaction (`receive_messages_delivery_proof`).
|
/// relayers entries with delivery confirmation transaction (`receive_messages_delivery_proof`).
|
||||||
fn receive_messages_delivery_proof_relayers_overhead(relayers: MessageNonce) -> Weight {
|
fn receive_messages_delivery_proof_relayers_overhead(relayers: MessageNonce) -> Weight {
|
||||||
let weight_of_two_messages_by_two_relayers = Self::receive_delivery_proof_for_two_messages_by_two_relayers();
|
let weight_of_two_messages_by_two_relayers = Self::receive_delivery_proof_for_two_messages_by_two_relayers();
|
||||||
@@ -314,7 +314,7 @@ pub trait WeightInfoExt: WeightInfo {
|
|||||||
.saturating_mul(relayers as Weight)
|
.saturating_mul(relayers as Weight)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns weight that needs to be accounted when storage proof of given size is recieved (either in
|
/// Returns weight that needs to be accounted when storage proof of given size is received (either in
|
||||||
/// `receive_messages_proof` or `receive_messages_delivery_proof`).
|
/// `receive_messages_proof` or `receive_messages_delivery_proof`).
|
||||||
///
|
///
|
||||||
/// **IMPORTANT**: this overhead is already included in the 'base' transaction cost - e.g. proof
|
/// **IMPORTANT**: this overhead is already included in the 'base' transaction cost - e.g. proof
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ sp_api::decl_runtime_apis! {
|
|||||||
///
|
///
|
||||||
/// Returns `None` if message is too expensive to be sent to Kusama from this chain.
|
/// Returns `None` if message is too expensive to be sent to Kusama from this chain.
|
||||||
///
|
///
|
||||||
/// Please keep in mind that this method returns lowest message fee required for message
|
/// Please keep in mind that this method returns the lowest message fee required for message
|
||||||
/// to be accepted to the lane. It may be good idea to pay a bit over this price to account
|
/// to be accepted to the lane. It may be good idea to pay a bit over this price to account
|
||||||
/// future exchange rate changes and guarantee that relayer would deliver your message
|
/// future exchange rate changes and guarantee that relayer would deliver your message
|
||||||
/// to the target chain.
|
/// to the target chain.
|
||||||
@@ -110,7 +110,7 @@ sp_api::decl_runtime_apis! {
|
|||||||
pub trait FromKusamaInboundLaneApi {
|
pub trait FromKusamaInboundLaneApi {
|
||||||
/// Returns nonce of the latest message, received by given lane.
|
/// Returns nonce of the latest message, received by given lane.
|
||||||
fn latest_received_nonce(lane: LaneId) -> MessageNonce;
|
fn latest_received_nonce(lane: LaneId) -> MessageNonce;
|
||||||
/// Nonce of latest message that has been confirmed to the bridged chain.
|
/// Nonce of the latest message that has been confirmed to the bridged chain.
|
||||||
fn latest_confirmed_nonce(lane: LaneId) -> MessageNonce;
|
fn latest_confirmed_nonce(lane: LaneId) -> MessageNonce;
|
||||||
/// State of the unrewarded relayers set at given lane.
|
/// State of the unrewarded relayers set at given lane.
|
||||||
fn unrewarded_relayers_state(lane: LaneId) -> UnrewardedRelayersState;
|
fn unrewarded_relayers_state(lane: LaneId) -> UnrewardedRelayersState;
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ pub type BlockNumber = u64;
|
|||||||
/// Hash type used in Millau.
|
/// Hash type used in Millau.
|
||||||
pub type Hash = <BlakeTwoAndKeccak256 as HasherT>::Out;
|
pub type Hash = <BlakeTwoAndKeccak256 as HasherT>::Out;
|
||||||
|
|
||||||
/// The type of an object that can produce hashes on Millau.
|
/// Type of object that can produce hashes on Millau.
|
||||||
pub type Hasher = BlakeTwoAndKeccak256;
|
pub type Hasher = BlakeTwoAndKeccak256;
|
||||||
|
|
||||||
/// The header type used by Millau.
|
/// The header type used by Millau.
|
||||||
@@ -287,7 +287,7 @@ sp_api::decl_runtime_apis! {
|
|||||||
///
|
///
|
||||||
/// Returns `None` if message is too expensive to be sent to Millau from this chain.
|
/// Returns `None` if message is too expensive to be sent to Millau from this chain.
|
||||||
///
|
///
|
||||||
/// Please keep in mind that this method returns lowest message fee required for message
|
/// Please keep in mind that this method returns the lowest message fee required for message
|
||||||
/// to be accepted to the lane. It may be good idea to pay a bit over this price to account
|
/// to be accepted to the lane. It may be good idea to pay a bit over this price to account
|
||||||
/// future exchange rate changes and guarantee that relayer would deliver your message
|
/// future exchange rate changes and guarantee that relayer would deliver your message
|
||||||
/// to the target chain.
|
/// to the target chain.
|
||||||
@@ -318,7 +318,7 @@ sp_api::decl_runtime_apis! {
|
|||||||
pub trait FromMillauInboundLaneApi {
|
pub trait FromMillauInboundLaneApi {
|
||||||
/// Returns nonce of the latest message, received by given lane.
|
/// Returns nonce of the latest message, received by given lane.
|
||||||
fn latest_received_nonce(lane: LaneId) -> MessageNonce;
|
fn latest_received_nonce(lane: LaneId) -> MessageNonce;
|
||||||
/// Nonce of latest message that has been confirmed to the bridged chain.
|
/// Nonce of the latest message that has been confirmed to the bridged chain.
|
||||||
fn latest_confirmed_nonce(lane: LaneId) -> MessageNonce;
|
fn latest_confirmed_nonce(lane: LaneId) -> MessageNonce;
|
||||||
/// State of the unrewarded relayers set at given lane.
|
/// State of the unrewarded relayers set at given lane.
|
||||||
fn unrewarded_relayers_state(lane: LaneId) -> UnrewardedRelayersState;
|
fn unrewarded_relayers_state(lane: LaneId) -> UnrewardedRelayersState;
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ sp_api::decl_runtime_apis! {
|
|||||||
///
|
///
|
||||||
/// Returns `None` if message is too expensive to be sent to Polkadot from this chain.
|
/// Returns `None` if message is too expensive to be sent to Polkadot from this chain.
|
||||||
///
|
///
|
||||||
/// Please keep in mind that this method returns lowest message fee required for message
|
/// Please keep in mind that this method returns the lowest message fee required for message
|
||||||
/// to be accepted to the lane. It may be good idea to pay a bit over this price to account
|
/// to be accepted to the lane. It may be good idea to pay a bit over this price to account
|
||||||
/// future exchange rate changes and guarantee that relayer would deliver your message
|
/// future exchange rate changes and guarantee that relayer would deliver your message
|
||||||
/// to the target chain.
|
/// to the target chain.
|
||||||
@@ -110,7 +110,7 @@ sp_api::decl_runtime_apis! {
|
|||||||
pub trait FromPolkadotInboundLaneApi {
|
pub trait FromPolkadotInboundLaneApi {
|
||||||
/// Returns nonce of the latest message, received by given lane.
|
/// Returns nonce of the latest message, received by given lane.
|
||||||
fn latest_received_nonce(lane: LaneId) -> MessageNonce;
|
fn latest_received_nonce(lane: LaneId) -> MessageNonce;
|
||||||
/// Nonce of latest message that has been confirmed to the bridged chain.
|
/// Nonce of the latest message that has been confirmed to the bridged chain.
|
||||||
fn latest_confirmed_nonce(lane: LaneId) -> MessageNonce;
|
fn latest_confirmed_nonce(lane: LaneId) -> MessageNonce;
|
||||||
/// State of the unrewarded relayers set at given lane.
|
/// State of the unrewarded relayers set at given lane.
|
||||||
fn unrewarded_relayers_state(lane: LaneId) -> UnrewardedRelayersState;
|
fn unrewarded_relayers_state(lane: LaneId) -> UnrewardedRelayersState;
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ pub type BlockNumber = u32;
|
|||||||
/// Hash type used in Rialto.
|
/// Hash type used in Rialto.
|
||||||
pub type Hash = <BlakeTwo256 as HasherT>::Out;
|
pub type Hash = <BlakeTwo256 as HasherT>::Out;
|
||||||
|
|
||||||
/// The type of an object that can produce hashes on Rialto.
|
/// The type of object that can produce hashes on Rialto.
|
||||||
pub type Hasher = BlakeTwo256;
|
pub type Hasher = BlakeTwo256;
|
||||||
|
|
||||||
/// The header type used by Rialto.
|
/// The header type used by Rialto.
|
||||||
@@ -256,7 +256,7 @@ sp_api::decl_runtime_apis! {
|
|||||||
///
|
///
|
||||||
/// Returns `None` if message is too expensive to be sent to Rialto from this chain.
|
/// Returns `None` if message is too expensive to be sent to Rialto from this chain.
|
||||||
///
|
///
|
||||||
/// Please keep in mind that this method returns lowest message fee required for message
|
/// Please keep in mind that this method returns the lowest message fee required for message
|
||||||
/// to be accepted to the lane. It may be good idea to pay a bit over this price to account
|
/// to be accepted to the lane. It may be good idea to pay a bit over this price to account
|
||||||
/// future exchange rate changes and guarantee that relayer would deliver your message
|
/// future exchange rate changes and guarantee that relayer would deliver your message
|
||||||
/// to the target chain.
|
/// to the target chain.
|
||||||
@@ -287,7 +287,7 @@ sp_api::decl_runtime_apis! {
|
|||||||
pub trait FromRialtoInboundLaneApi {
|
pub trait FromRialtoInboundLaneApi {
|
||||||
/// Returns nonce of the latest message, received by given lane.
|
/// Returns nonce of the latest message, received by given lane.
|
||||||
fn latest_received_nonce(lane: LaneId) -> MessageNonce;
|
fn latest_received_nonce(lane: LaneId) -> MessageNonce;
|
||||||
/// Nonce of latest message that has been confirmed to the bridged chain.
|
/// Nonce of the latest message that has been confirmed to the bridged chain.
|
||||||
fn latest_confirmed_nonce(lane: LaneId) -> MessageNonce;
|
fn latest_confirmed_nonce(lane: LaneId) -> MessageNonce;
|
||||||
/// State of the unrewarded relayers set at given lane.
|
/// State of the unrewarded relayers set at given lane.
|
||||||
fn unrewarded_relayers_state(lane: LaneId) -> UnrewardedRelayersState;
|
fn unrewarded_relayers_state(lane: LaneId) -> UnrewardedRelayersState;
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ sp_api::decl_runtime_apis! {
|
|||||||
///
|
///
|
||||||
/// Returns `None` if message is too expensive to be sent to Rococo from this chain.
|
/// Returns `None` if message is too expensive to be sent to Rococo from this chain.
|
||||||
///
|
///
|
||||||
/// Please keep in mind that this method returns lowest message fee required for message
|
/// Please keep in mind that this method returns the lowest message fee required for message
|
||||||
/// to be accepted to the lane. It may be good idea to pay a bit over this price to account
|
/// to be accepted to the lane. It may be good idea to pay a bit over this price to account
|
||||||
/// future exchange rate changes and guarantee that relayer would deliver your message
|
/// future exchange rate changes and guarantee that relayer would deliver your message
|
||||||
/// to the target chain.
|
/// to the target chain.
|
||||||
@@ -147,7 +147,7 @@ sp_api::decl_runtime_apis! {
|
|||||||
pub trait FromRococoInboundLaneApi {
|
pub trait FromRococoInboundLaneApi {
|
||||||
/// Returns nonce of the latest message, received by given lane.
|
/// Returns nonce of the latest message, received by given lane.
|
||||||
fn latest_received_nonce(lane: LaneId) -> MessageNonce;
|
fn latest_received_nonce(lane: LaneId) -> MessageNonce;
|
||||||
/// Nonce of latest message that has been confirmed to the bridged chain.
|
/// Nonce of the latest message that has been confirmed to the bridged chain.
|
||||||
fn latest_confirmed_nonce(lane: LaneId) -> MessageNonce;
|
fn latest_confirmed_nonce(lane: LaneId) -> MessageNonce;
|
||||||
/// State of the unrewarded relayers set at given lane.
|
/// State of the unrewarded relayers set at given lane.
|
||||||
fn unrewarded_relayers_state(lane: LaneId) -> UnrewardedRelayersState;
|
fn unrewarded_relayers_state(lane: LaneId) -> UnrewardedRelayersState;
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
|
|||||||
/// All entries here (like pretty much in the entire file) must be kept in sync with Westend
|
/// All entries here (like pretty much in the entire file) must be kept in sync with Westend
|
||||||
/// `construct_runtime`, so that we maintain SCALE-compatibility.
|
/// `construct_runtime`, so that we maintain SCALE-compatibility.
|
||||||
///
|
///
|
||||||
/// See: https://github.com/paritytech/polkadot/blob/master/runtime/westend/src/lib.rs
|
/// See: [link](https://github.com/paritytech/polkadot/blob/master/runtime/westend/src/lib.rs)
|
||||||
#[derive(parity_scale_codec::Encode, parity_scale_codec::Decode, Debug, PartialEq, Eq, Clone)]
|
#[derive(parity_scale_codec::Encode, parity_scale_codec::Decode, Debug, PartialEq, Eq, Clone)]
|
||||||
pub enum Call {
|
pub enum Call {
|
||||||
/// Rococo bridge pallet.
|
/// Rococo bridge pallet.
|
||||||
@@ -141,7 +141,7 @@ sp_api::decl_runtime_apis! {
|
|||||||
///
|
///
|
||||||
/// Returns `None` if message is too expensive to be sent to Westend from this chain.
|
/// Returns `None` if message is too expensive to be sent to Westend from this chain.
|
||||||
///
|
///
|
||||||
/// Please keep in mind that this method returns lowest message fee required for message
|
/// Please keep in mind that this method returns the lowest message fee required for message
|
||||||
/// to be accepted to the lane. It may be good idea to pay a bit over this price to account
|
/// to be accepted to the lane. It may be good idea to pay a bit over this price to account
|
||||||
/// future exchange rate changes and guarantee that relayer would deliver your message
|
/// future exchange rate changes and guarantee that relayer would deliver your message
|
||||||
/// to the target chain.
|
/// to the target chain.
|
||||||
@@ -172,7 +172,7 @@ sp_api::decl_runtime_apis! {
|
|||||||
pub trait FromWestendInboundLaneApi {
|
pub trait FromWestendInboundLaneApi {
|
||||||
/// Returns nonce of the latest message, received by given lane.
|
/// Returns nonce of the latest message, received by given lane.
|
||||||
fn latest_received_nonce(lane: LaneId) -> MessageNonce;
|
fn latest_received_nonce(lane: LaneId) -> MessageNonce;
|
||||||
/// Nonce of latest message that has been confirmed to the bridged chain.
|
/// Nonce of the latest message that has been confirmed to the bridged chain.
|
||||||
fn latest_confirmed_nonce(lane: LaneId) -> MessageNonce;
|
fn latest_confirmed_nonce(lane: LaneId) -> MessageNonce;
|
||||||
/// State of the unrewarded relayers set at given lane.
|
/// State of the unrewarded relayers set at given lane.
|
||||||
fn unrewarded_relayers_state(lane: LaneId) -> UnrewardedRelayersState;
|
fn unrewarded_relayers_state(lane: LaneId) -> UnrewardedRelayersState;
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ sp_api::decl_runtime_apis! {
|
|||||||
///
|
///
|
||||||
/// Returns `None` if message is too expensive to be sent to Wococo from this chain.
|
/// Returns `None` if message is too expensive to be sent to Wococo from this chain.
|
||||||
///
|
///
|
||||||
/// Please keep in mind that this method returns lowest message fee required for message
|
/// Please keep in mind that this method returns the lowest message fee required for message
|
||||||
/// to be accepted to the lane. It may be good idea to pay a bit over this price to account
|
/// to be accepted to the lane. It may be good idea to pay a bit over this price to account
|
||||||
/// future exchange rate changes and guarantee that relayer would deliver your message
|
/// future exchange rate changes and guarantee that relayer would deliver your message
|
||||||
/// to the target chain.
|
/// to the target chain.
|
||||||
@@ -112,7 +112,7 @@ sp_api::decl_runtime_apis! {
|
|||||||
pub trait FromWococoInboundLaneApi {
|
pub trait FromWococoInboundLaneApi {
|
||||||
/// Returns nonce of the latest message, received by given lane.
|
/// Returns nonce of the latest message, received by given lane.
|
||||||
fn latest_received_nonce(lane: LaneId) -> MessageNonce;
|
fn latest_received_nonce(lane: LaneId) -> MessageNonce;
|
||||||
/// Nonce of latest message that has been confirmed to the bridged chain.
|
/// Nonce of the latest message that has been confirmed to the bridged chain.
|
||||||
fn latest_confirmed_nonce(lane: LaneId) -> MessageNonce;
|
fn latest_confirmed_nonce(lane: LaneId) -> MessageNonce;
|
||||||
/// State of the unrewarded relayers set at given lane.
|
/// State of the unrewarded relayers set at given lane.
|
||||||
fn unrewarded_relayers_state(lane: LaneId) -> UnrewardedRelayersState;
|
fn unrewarded_relayers_state(lane: LaneId) -> UnrewardedRelayersState;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ pub enum Error {
|
|||||||
InvalidRecipient,
|
InvalidRecipient,
|
||||||
/// Cannot map from peer recipient to this blockchain recipient.
|
/// Cannot map from peer recipient to this blockchain recipient.
|
||||||
FailedToMapRecipients,
|
FailedToMapRecipients,
|
||||||
/// Failed to convert from peer blockchain currency to this blockhain currency.
|
/// Failed to convert from peer blockchain currency to this blockchain currency.
|
||||||
FailedToConvertCurrency,
|
FailedToConvertCurrency,
|
||||||
/// Deposit has failed.
|
/// Deposit has failed.
|
||||||
DepositFailed,
|
DepositFailed,
|
||||||
|
|||||||
@@ -323,7 +323,7 @@ impl UnsignedTransaction {
|
|||||||
stream.out().to_vec()
|
stream.out().to_vec()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Encode to given rlp stream.
|
/// Encode to given RLP stream.
|
||||||
pub fn rlp_to(&self, chain_id: Option<u64>, stream: &mut RlpStream) {
|
pub fn rlp_to(&self, chain_id: Option<u64>, stream: &mut RlpStream) {
|
||||||
stream.append(&self.nonce);
|
stream.append(&self.nonce);
|
||||||
stream.append(&self.gas_price);
|
stream.append(&self.gas_price);
|
||||||
@@ -405,7 +405,7 @@ impl SealedEmptyStep {
|
|||||||
keccak_256(&message.out()).into()
|
keccak_256(&message.out()).into()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns rlp for the vector of empty steps (we only do encoding in tests).
|
/// Returns RLP for the vector of empty steps (we only do encoding in tests).
|
||||||
pub fn rlp_of(empty_steps: &[SealedEmptyStep]) -> Bytes {
|
pub fn rlp_of(empty_steps: &[SealedEmptyStep]) -> Bytes {
|
||||||
let mut s = RlpStream::new();
|
let mut s = RlpStream::new();
|
||||||
s.begin_list(empty_steps.len());
|
s.begin_list(empty_steps.len());
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ where
|
|||||||
pub struct AncestryChain<Header: HeaderT> {
|
pub struct AncestryChain<Header: HeaderT> {
|
||||||
/// Header hash => parent header hash mapping.
|
/// Header hash => parent header hash mapping.
|
||||||
pub parents: BTreeMap<Header::Hash, Header::Hash>,
|
pub parents: BTreeMap<Header::Hash, Header::Hash>,
|
||||||
/// Hashes of headers that weren't visited by `is_ancestor` method.
|
/// Hashes of headers that were not visited by `is_ancestor` method.
|
||||||
pub unvisited: BTreeSet<Header::Hash>,
|
pub unvisited: BTreeSet<Header::Hash>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ pub enum CallOrigin<SourceChainAccountId, TargetChainAccountPublic, TargetChainS
|
|||||||
/// from a derived account.
|
/// from a derived account.
|
||||||
///
|
///
|
||||||
/// The derived account represents the source Root account on the target chain. This is useful
|
/// The derived account represents the source Root account on the target chain. This is useful
|
||||||
/// if the target chain needs some way of knowing that a call came from a priviledged origin on
|
/// if the target chain needs some way of knowing that a call came from a privileged origin on
|
||||||
/// the source chain (maybe to allow a configuration change for example).
|
/// the source chain (maybe to allow a configuration change for example).
|
||||||
SourceRoot,
|
SourceRoot,
|
||||||
|
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ pub struct InboundLaneData<RelayerId> {
|
|||||||
/// Identifiers of relayers and messages that they have delivered to this lane (ordered by message nonce).
|
/// Identifiers of relayers and messages that they have delivered to this lane (ordered by message nonce).
|
||||||
///
|
///
|
||||||
/// This serves as a helper storage item, to allow the source chain to easily pay rewards
|
/// This serves as a helper storage item, to allow the source chain to easily pay rewards
|
||||||
/// to the relayers who succesfuly delivered messages to the target chain (inbound lane).
|
/// to the relayers who successfully delivered messages to the target chain (inbound lane).
|
||||||
///
|
///
|
||||||
/// It is guaranteed to have at most N entries, where N is configured at the module level.
|
/// It is guaranteed to have at most N entries, where N is configured at the module level.
|
||||||
/// If there are N entries in this vec, then:
|
/// If there are N entries in this vec, then:
|
||||||
@@ -149,7 +149,7 @@ impl<RelayerId> Default for InboundLaneData<RelayerId> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<RelayerId> InboundLaneData<RelayerId> {
|
impl<RelayerId> InboundLaneData<RelayerId> {
|
||||||
/// Returns approximate size of the struct, given number of entries in the `relayers` set and
|
/// Returns approximate size of the struct, given a number of entries in the `relayers` set and
|
||||||
/// size of each entry.
|
/// size of each entry.
|
||||||
///
|
///
|
||||||
/// Returns `None` if size overflows `u32` limits.
|
/// Returns `None` if size overflows `u32` limits.
|
||||||
@@ -277,12 +277,12 @@ pub struct UnrewardedRelayersState {
|
|||||||
/// Outbound lane data.
|
/// Outbound lane data.
|
||||||
#[derive(Encode, Decode, Clone, RuntimeDebug, PartialEq, Eq)]
|
#[derive(Encode, Decode, Clone, RuntimeDebug, PartialEq, Eq)]
|
||||||
pub struct OutboundLaneData {
|
pub struct OutboundLaneData {
|
||||||
/// Nonce of oldest message that we haven't yet pruned. May point to not-yet-generated message if
|
/// Nonce of the oldest message that we haven't yet pruned. May point to not-yet-generated message if
|
||||||
/// all sent messages are already pruned.
|
/// all sent messages are already pruned.
|
||||||
pub oldest_unpruned_nonce: MessageNonce,
|
pub oldest_unpruned_nonce: MessageNonce,
|
||||||
/// Nonce of latest message, received by bridged chain.
|
/// Nonce of the latest message, received by bridged chain.
|
||||||
pub latest_received_nonce: MessageNonce,
|
pub latest_received_nonce: MessageNonce,
|
||||||
/// Nonce of latest message, generated by us.
|
/// Nonce of the latest message, generated by us.
|
||||||
pub latest_generated_nonce: MessageNonce,
|
pub latest_generated_nonce: MessageNonce,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,14 +56,14 @@ pub trait TargetHeaderChain<Payload, AccountId> {
|
|||||||
///
|
///
|
||||||
/// The proper implementation must ensure that the delivery-transaction with this
|
/// The proper implementation must ensure that the delivery-transaction with this
|
||||||
/// payload would (at least) be accepted into target chain transaction pool AND
|
/// payload would (at least) be accepted into target chain transaction pool AND
|
||||||
/// eventually will be successfully 'mined'. The most obvious incorrect implementation
|
/// eventually will be successfully mined. The most obvious incorrect implementation
|
||||||
/// example would be implementation for BTC chain that accepts payloads larger than
|
/// example would be implementation for BTC chain that accepts payloads larger than
|
||||||
/// 1MB. BTC nodes aren't accepting transactions that are larger than 1MB, so relayer
|
/// 1MB. BTC nodes aren't accepting transactions that are larger than 1MB, so relayer
|
||||||
/// will be unable to craft valid transaction => this (and all subsequent) messages will
|
/// will be unable to craft valid transaction => this (and all subsequent) messages will
|
||||||
/// never be delivered.
|
/// never be delivered.
|
||||||
fn verify_message(payload: &Payload) -> Result<(), Self::Error>;
|
fn verify_message(payload: &Payload) -> Result<(), Self::Error>;
|
||||||
|
|
||||||
/// Verify messages delivery proof and return lane && nonce of the latest recevied message.
|
/// Verify messages delivery proof and return lane && nonce of the latest received message.
|
||||||
fn verify_messages_delivery_proof(
|
fn verify_messages_delivery_proof(
|
||||||
proof: Self::MessagesDeliveryProof,
|
proof: Self::MessagesDeliveryProof,
|
||||||
) -> Result<(LaneId, InboundLaneData<AccountId>), Self::Error>;
|
) -> Result<(LaneId, InboundLaneData<AccountId>), Self::Error>;
|
||||||
@@ -102,7 +102,7 @@ pub trait LaneMessageVerifier<Submitter, Payload, Fee> {
|
|||||||
/// by relayer.
|
/// by relayer.
|
||||||
///
|
///
|
||||||
/// So to be sure that any non-altruist relayer would agree to deliver message, submitter
|
/// So to be sure that any non-altruist relayer would agree to deliver message, submitter
|
||||||
/// should set `delivery_and_dispatch_fee` to at least (equialent of): sum of fees from (2)
|
/// should set `delivery_and_dispatch_fee` to at least (equivalent of): sum of fees from (2)
|
||||||
/// to (4) above, plus some interest for the relayer.
|
/// to (4) above, plus some interest for the relayer.
|
||||||
pub trait MessageDeliveryAndDispatchPayment<AccountId, Balance> {
|
pub trait MessageDeliveryAndDispatchPayment<AccountId, Balance> {
|
||||||
/// Error type.
|
/// Error type.
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ pub trait SourceHeaderChain<Fee> {
|
|||||||
/// messages will be rejected.
|
/// messages will be rejected.
|
||||||
///
|
///
|
||||||
/// The `messages_count` argument verification (sane limits) is supposed to be made
|
/// The `messages_count` argument verification (sane limits) is supposed to be made
|
||||||
/// outside of this function. This function only verifies that the proof declares exactly
|
/// outside this function. This function only verifies that the proof declares exactly
|
||||||
/// `messages_count` messages.
|
/// `messages_count` messages.
|
||||||
fn verify_messages_proof(
|
fn verify_messages_proof(
|
||||||
proof: Self::MessagesProof,
|
proof: Self::MessagesProof,
|
||||||
|
|||||||
@@ -66,18 +66,18 @@ pub const EXTRA_STORAGE_PROOF_SIZE: u32 = 1024;
|
|||||||
/// All polkadot-like chains are using same crypto.
|
/// All polkadot-like chains are using same crypto.
|
||||||
pub const MAXIMAL_ENCODED_ACCOUNT_ID_SIZE: u32 = 32;
|
pub const MAXIMAL_ENCODED_ACCOUNT_ID_SIZE: u32 = 32;
|
||||||
|
|
||||||
/// All Polkadot-like chains allow normal extrinsics to fill block up to 75%.
|
/// All Polkadot-like chains allow normal extrinsics to fill block up to 75 percent.
|
||||||
///
|
///
|
||||||
/// This is a copy-paste from the Polkadot repo's `polkadot-runtime-common` crate.
|
/// This is a copy-paste from the Polkadot repo's `polkadot-runtime-common` crate.
|
||||||
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
|
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
|
||||||
|
|
||||||
/// All Polkadot-like chains allow 2 seconds of compute with a 6 second average block time.
|
/// All Polkadot-like chains allow 2 seconds of compute with a 6-second average block time.
|
||||||
///
|
///
|
||||||
/// This is a copy-paste from the Polkadot repo's `polkadot-runtime-common` crate.
|
/// This is a copy-paste from the Polkadot repo's `polkadot-runtime-common` crate.
|
||||||
pub const MAXIMUM_BLOCK_WEIGHT: Weight = 2 * WEIGHT_PER_SECOND;
|
pub const MAXIMUM_BLOCK_WEIGHT: Weight = 2 * WEIGHT_PER_SECOND;
|
||||||
|
|
||||||
/// All Polkadot-like chains assume that an on-initialize consumes 1% of the weight on average,
|
/// All Polkadot-like chains assume that an on-initialize consumes 1 percent of the weight on average,
|
||||||
/// hence a single extrinsic will not be allowed to consume more than `AvailableBlockRatio - 1%`.
|
/// hence a single extrinsic will not be allowed to consume more than `AvailableBlockRatio - 1 percent`.
|
||||||
///
|
///
|
||||||
/// This is a copy-paste from the Polkadot repo's `polkadot-runtime-common` crate.
|
/// This is a copy-paste from the Polkadot repo's `polkadot-runtime-common` crate.
|
||||||
pub const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(1);
|
pub const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(1);
|
||||||
@@ -165,7 +165,7 @@ pub type Index = u32;
|
|||||||
/// Hashing type.
|
/// Hashing type.
|
||||||
pub type Hashing = BlakeTwo256;
|
pub type Hashing = BlakeTwo256;
|
||||||
|
|
||||||
/// The type of an object that can produce hashes on Polkadot-like chains.
|
/// The type of object that can produce hashes on Polkadot-like chains.
|
||||||
pub type Hasher = BlakeTwo256;
|
pub type Hasher = BlakeTwo256;
|
||||||
|
|
||||||
/// The header type used by Polkadot-like chains.
|
/// The header type used by Polkadot-like chains.
|
||||||
@@ -304,7 +304,7 @@ impl Convert<sp_core::H256, AccountId> for AccountIdConverter {
|
|||||||
/// Return a storage key for account data.
|
/// Return a storage key for account data.
|
||||||
///
|
///
|
||||||
/// This is based on FRAME storage-generation code from Substrate:
|
/// This is based on FRAME storage-generation code from Substrate:
|
||||||
/// https://github.com/paritytech/substrate/blob/c939ceba381b6313462d47334f775e128ea4e95d/frame/support/src/storage/generator/map.rs#L74
|
/// [link](https://github.com/paritytech/substrate/blob/c939ceba381b6313462d47334f775e128ea4e95d/frame/support/src/storage/generator/map.rs#L74)
|
||||||
/// The equivalent command to invoke in case full `Runtime` is known is this:
|
/// The equivalent command to invoke in case full `Runtime` is known is this:
|
||||||
/// `let key = frame_system::Account::<Runtime>::storage_map_final_key(&account_id);`
|
/// `let key = frame_system::Account::<Runtime>::storage_map_final_key(&account_id);`
|
||||||
pub fn account_info_storage_key(id: &AccountId) -> Vec<u8> {
|
pub fn account_info_storage_key(id: &AccountId) -> Vec<u8> {
|
||||||
|
|||||||
@@ -74,9 +74,9 @@ pub type ChainId = [u8; 4];
|
|||||||
|
|
||||||
/// Type of accounts on the source chain.
|
/// Type of accounts on the source chain.
|
||||||
pub enum SourceAccount<T> {
|
pub enum SourceAccount<T> {
|
||||||
/// An account that belongs to Root (priviledged origin).
|
/// An account that belongs to Root (privileged origin).
|
||||||
Root,
|
Root,
|
||||||
/// A non-priviledged account.
|
/// A non-privileged account.
|
||||||
///
|
///
|
||||||
/// The embedded account ID may or may not have a private key depending on the "owner" of the
|
/// The embedded account ID may or may not have a private key depending on the "owner" of the
|
||||||
/// account (private key, pallet, proxy, etc.).
|
/// account (private key, pallet, proxy, etc.).
|
||||||
@@ -86,7 +86,7 @@ pub enum SourceAccount<T> {
|
|||||||
/// Derive an account ID from a foreign account ID.
|
/// Derive an account ID from a foreign account ID.
|
||||||
///
|
///
|
||||||
/// This function returns an encoded Blake2 hash. It is the responsibility of the caller to ensure
|
/// This function returns an encoded Blake2 hash. It is the responsibility of the caller to ensure
|
||||||
/// this can be succesfully decoded into an AccountId.
|
/// this can be successfully decoded into an AccountId.
|
||||||
///
|
///
|
||||||
/// The `bridge_id` is used to provide extra entropy when producing account IDs. This helps prevent
|
/// The `bridge_id` is used to provide extra entropy when producing account IDs. This helps prevent
|
||||||
/// AccountId collisions between different bridges on a single target chain.
|
/// AccountId collisions between different bridges on a single target chain.
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ use frame_support::{weights::Weight, RuntimeDebug};
|
|||||||
/// Where message dispatch fee is paid?
|
/// Where message dispatch fee is paid?
|
||||||
#[derive(Encode, Decode, RuntimeDebug, Clone, Copy, PartialEq, Eq)]
|
#[derive(Encode, Decode, RuntimeDebug, Clone, Copy, PartialEq, Eq)]
|
||||||
pub enum DispatchFeePayment {
|
pub enum DispatchFeePayment {
|
||||||
/// The dispacth fee is paid at the source chain.
|
/// The dispatch fee is paid at the source chain.
|
||||||
AtSourceChain,
|
AtSourceChain,
|
||||||
/// The dispatch fee is paid at the target chain.
|
/// The dispatch fee is paid at the target chain.
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ pub struct JustificationGeneratorParams<H> {
|
|||||||
pub authorities: Vec<(Account, AuthorityWeight)>,
|
pub authorities: Vec<(Account, AuthorityWeight)>,
|
||||||
/// The total number of precommit ancestors in the `votes_ancestries` field our justification.
|
/// The total number of precommit ancestors in the `votes_ancestries` field our justification.
|
||||||
///
|
///
|
||||||
/// These may be distributed among many different forks.
|
/// These may be distributed among many forks.
|
||||||
pub ancestors: u32,
|
pub ancestors: u32,
|
||||||
/// The number of forks.
|
/// The number of forks.
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ type RpcResult<T> = std::result::Result<T, RpcError>;
|
|||||||
/// interactions involving, for example, an Ethereum contract.
|
/// interactions involving, for example, an Ethereum contract.
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
pub trait EthereumHighLevelRpc {
|
pub trait EthereumHighLevelRpc {
|
||||||
/// Returns best Substrate block that PoA chain knows of.
|
/// Returns the best Substrate block that PoA chain knows of.
|
||||||
async fn best_substrate_block(&self, contract_address: Address) -> RpcResult<RialtoHeaderId>;
|
async fn best_substrate_block(&self, contract_address: Address) -> RpcResult<RialtoHeaderId>;
|
||||||
|
|
||||||
/// Returns true if Substrate header is known to Ethereum node.
|
/// Returns true if Substrate header is known to Ethereum node.
|
||||||
|
|||||||
@@ -41,13 +41,13 @@ type RpcResult<T> = std::result::Result<T, RpcError>;
|
|||||||
/// interactions involving, for example, an Ethereum bridge module.
|
/// interactions involving, for example, an Ethereum bridge module.
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
pub trait SubstrateHighLevelRpc {
|
pub trait SubstrateHighLevelRpc {
|
||||||
/// Returns best Ethereum block that Substrate runtime knows of.
|
/// Returns the best Ethereum block that Substrate runtime knows of.
|
||||||
async fn best_ethereum_block(&self) -> RpcResult<EthereumHeaderId>;
|
async fn best_ethereum_block(&self) -> RpcResult<EthereumHeaderId>;
|
||||||
/// Returns best finalized Ethereum block that Substrate runtime knows of.
|
/// Returns best finalized Ethereum block that Substrate runtime knows of.
|
||||||
async fn best_ethereum_finalized_block(&self) -> RpcResult<EthereumHeaderId>;
|
async fn best_ethereum_finalized_block(&self) -> RpcResult<EthereumHeaderId>;
|
||||||
/// Returns whether or not transactions receipts are required for Ethereum header submission.
|
/// Returns whether transactions receipts are required for Ethereum header submission.
|
||||||
async fn ethereum_receipts_required(&self, header: SubstrateEthereumHeader) -> RpcResult<bool>;
|
async fn ethereum_receipts_required(&self, header: SubstrateEthereumHeader) -> RpcResult<bool>;
|
||||||
/// Returns whether or not the given Ethereum header is known to the Substrate runtime.
|
/// Returns whether the given Ethereum header is known to the Substrate runtime.
|
||||||
async fn ethereum_header_known(&self, header_id: EthereumHeaderId) -> RpcResult<bool>;
|
async fn ethereum_header_known(&self, header_id: EthereumHeaderId) -> RpcResult<bool>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ use crate::cli::{
|
|||||||
|
|
||||||
/// Weight of the `system::remark` call at Rococo.
|
/// Weight of the `system::remark` call at Rococo.
|
||||||
///
|
///
|
||||||
/// This weight is larger (x2) than actual weight at current Rooco runtime to avoid unsuccessful
|
/// This weight is larger (x2) than actual weight at current Rococo runtime to avoid unsuccessful
|
||||||
/// calls in the future. But since it is used only in tests (and on test chains), this is ok.
|
/// calls in the future. But since it is used only in tests (and on test chains), this is ok.
|
||||||
pub(crate) const SYSTEM_REMARK_CALL_WEIGHT: Weight = 2 * 1_345_000;
|
pub(crate) const SYSTEM_REMARK_CALL_WEIGHT: Weight = 2 * 1_345_000;
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ use strum::VariantNames;
|
|||||||
/// since messages sent over the bridge will be able to spend these.
|
/// since messages sent over the bridge will be able to spend these.
|
||||||
#[derive(StructOpt)]
|
#[derive(StructOpt)]
|
||||||
pub struct DeriveAccount {
|
pub struct DeriveAccount {
|
||||||
/// A bridge instance to initalize.
|
/// A bridge instance to initialize.
|
||||||
#[structopt(possible_values = FullBridge::VARIANTS, case_insensitive = true)]
|
#[structopt(possible_values = FullBridge::VARIANTS, case_insensitive = true)]
|
||||||
bridge: FullBridge,
|
bridge: FullBridge,
|
||||||
/// Source-chain address to derive Target-chain address from.
|
/// Source-chain address to derive Target-chain address from.
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ pub enum MessagePayload {
|
|||||||
/// A `MessagePayload` to encode.
|
/// A `MessagePayload` to encode.
|
||||||
#[derive(StructOpt)]
|
#[derive(StructOpt)]
|
||||||
pub struct EncodeMessage {
|
pub struct EncodeMessage {
|
||||||
/// A bridge instance to initalize.
|
/// A bridge instance to initialize.
|
||||||
#[structopt(possible_values = FullBridge::VARIANTS, case_insensitive = true)]
|
#[structopt(possible_values = FullBridge::VARIANTS, case_insensitive = true)]
|
||||||
bridge: FullBridge,
|
bridge: FullBridge,
|
||||||
#[structopt(flatten)]
|
#[structopt(flatten)]
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ use strum::{EnumString, EnumVariantNames, VariantNames};
|
|||||||
/// Initialize bridge pallet.
|
/// Initialize bridge pallet.
|
||||||
#[derive(StructOpt)]
|
#[derive(StructOpt)]
|
||||||
pub struct InitBridge {
|
pub struct InitBridge {
|
||||||
/// A bridge instance to initalize.
|
/// A bridge instance to initialize.
|
||||||
#[structopt(possible_values = InitBridgeName::VARIANTS, case_insensitive = true)]
|
#[structopt(possible_values = InitBridgeName::VARIANTS, case_insensitive = true)]
|
||||||
bridge: InitBridgeName,
|
bridge: InitBridgeName,
|
||||||
#[structopt(flatten)]
|
#[structopt(flatten)]
|
||||||
|
|||||||
@@ -235,7 +235,7 @@ pub trait CliChain: relay_substrate_client::Chain {
|
|||||||
|
|
||||||
/// Bridge Message Payload type.
|
/// Bridge Message Payload type.
|
||||||
///
|
///
|
||||||
/// TODO [#854] This should be removed in favour of target-specifc types.
|
/// TODO [#854] This should be removed in favor of target-specifc types.
|
||||||
type MessagePayload;
|
type MessagePayload;
|
||||||
|
|
||||||
/// Numeric value of SS58 format.
|
/// Numeric value of SS58 format.
|
||||||
@@ -354,7 +354,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Create chain-specific set of configuration objects: connection parameters,
|
/// Create chain-specific set of configuration objects: connection parameters,
|
||||||
/// signing parameters and bridge initialisation parameters.
|
/// signing parameters and bridge initialization parameters.
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! declare_chain_options {
|
macro_rules! declare_chain_options {
|
||||||
($chain:ident, $chain_prefix:ident) => {
|
($chain:ident, $chain_prefix:ident) => {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ use strum::{EnumString, EnumVariantNames, VariantNames};
|
|||||||
#[derive(Debug, EnumString, EnumVariantNames, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, EnumString, EnumVariantNames, Clone, Copy, PartialEq, Eq)]
|
||||||
#[strum(serialize_all = "kebab_case")]
|
#[strum(serialize_all = "kebab_case")]
|
||||||
pub enum DispatchFeePayment {
|
pub enum DispatchFeePayment {
|
||||||
/// The dispacth fee is paid at the source chain.
|
/// The dispatch fee is paid at the source chain.
|
||||||
AtSourceChain,
|
AtSourceChain,
|
||||||
/// The dispatch fee is paid at the target chain.
|
/// The dispatch fee is paid at the target chain.
|
||||||
AtTargetChain,
|
AtTargetChain,
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ pub trait SubstrateFinalitySyncPipeline: FinalitySyncPipeline {
|
|||||||
/// Start finality relay guards.
|
/// Start finality relay guards.
|
||||||
///
|
///
|
||||||
/// Different finality bridges may have different set of guards - e.g. on ephemeral chains we
|
/// Different finality bridges may have different set of guards - e.g. on ephemeral chains we
|
||||||
/// don't need version guards, on test chains we don't care that much about relayer account
|
/// don't need a version guards, on test chains we don't care that much about relayer account
|
||||||
/// balance, ... So the implementation is left to the specific bridges.
|
/// balance, ... So the implementation is left to the specific bridges.
|
||||||
fn start_relay_guards(&self) {}
|
fn start_relay_guards(&self) {}
|
||||||
|
|
||||||
|
|||||||
@@ -66,9 +66,9 @@ pub trait SubstrateMessageLane: MessageLane {
|
|||||||
|
|
||||||
/// Name of the runtime method that returns latest received nonce at the target chain.
|
/// Name of the runtime method that returns latest received nonce at the target chain.
|
||||||
const INBOUND_LANE_LATEST_RECEIVED_NONCE_METHOD: &'static str;
|
const INBOUND_LANE_LATEST_RECEIVED_NONCE_METHOD: &'static str;
|
||||||
/// Name of the runtime method that returns latest confirmed (reward-paid) nonce at the target chain.
|
/// Name of the runtime method that returns the latest confirmed (reward-paid) nonce at the target chain.
|
||||||
const INBOUND_LANE_LATEST_CONFIRMED_NONCE_METHOD: &'static str;
|
const INBOUND_LANE_LATEST_CONFIRMED_NONCE_METHOD: &'static str;
|
||||||
/// Numebr of the runtime method that returns state of "unrewarded relayers" set at the target chain.
|
/// Number of the runtime method that returns state of "unrewarded relayers" set at the target chain.
|
||||||
const INBOUND_LANE_UNREWARDED_RELAYERS_STATE: &'static str;
|
const INBOUND_LANE_UNREWARDED_RELAYERS_STATE: &'static str;
|
||||||
|
|
||||||
/// Name of the runtime method that returns id of best finalized source header at target chain.
|
/// Name of the runtime method that returns id of best finalized source header at target chain.
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ async fn background_task<SourceChain, TargetChain, TargetSign>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns `Some()` with inclusive range of headers which must be scanned for manadatory headers
|
/// Returns `Some()` with inclusive range of headers which must be scanned for mandatory headers
|
||||||
/// and the first of such headers must be submitted to the target node.
|
/// and the first of such headers must be submitted to the target node.
|
||||||
async fn mandatory_headers_scan_range<C: Chain>(
|
async fn mandatory_headers_scan_range<C: Chain>(
|
||||||
best_finalized_source_header_at_source: Option<C::BlockNumber>,
|
best_finalized_source_header_at_source: Option<C::BlockNumber>,
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ impl Default for SigningParams {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sign and submit tranaction using given Ethereum client.
|
/// Sign and submit transaction using given Ethereum client.
|
||||||
pub async fn sign_and_submit_transaction(
|
pub async fn sign_and_submit_transaction(
|
||||||
client: &Client,
|
client: &Client,
|
||||||
params: &SigningParams,
|
params: &SigningParams,
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ where
|
|||||||
/// All entries here (like pretty much in the entire file) must be kept in sync with Rococo
|
/// All entries here (like pretty much in the entire file) must be kept in sync with Rococo
|
||||||
/// `construct_runtime`, so that we maintain SCALE-compatibility.
|
/// `construct_runtime`, so that we maintain SCALE-compatibility.
|
||||||
///
|
///
|
||||||
/// See: https://github.com/paritytech/polkadot/blob/master/runtime/rococo/src/lib.rs
|
/// See: [link](https://github.com/paritytech/polkadot/blob/master/runtime/rococo/src/lib.rs)
|
||||||
#[allow(clippy::large_enum_variant)]
|
#[allow(clippy::large_enum_variant)]
|
||||||
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone)]
|
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone)]
|
||||||
pub enum Call {
|
pub enum Call {
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ pub trait Chain: ChainBase + Clone {
|
|||||||
type Call: Dispatchable + Debug;
|
type Call: Dispatchable + Debug;
|
||||||
/// Balance of an account in native tokens.
|
/// Balance of an account in native tokens.
|
||||||
///
|
///
|
||||||
/// The chain may suport multiple tokens, but this particular type is for token that is used
|
/// The chain may support multiple tokens, but this particular type is for token that is used
|
||||||
/// to pay for transaction dispatch, to reward different relayers (headers, messages), etc.
|
/// to pay for transaction dispatch, to reward different relayers (headers, messages), etc.
|
||||||
type Balance: AtLeast32BitUnsigned
|
type Balance: AtLeast32BitUnsigned
|
||||||
+ FixedPointOperand
|
+ FixedPointOperand
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ impl<C: Chain> std::fmt::Debug for Client<C> {
|
|||||||
impl<C: Chain> Client<C> {
|
impl<C: Chain> Client<C> {
|
||||||
/// Returns client that is able to call RPCs on Substrate node over websocket connection.
|
/// Returns client that is able to call RPCs on Substrate node over websocket connection.
|
||||||
///
|
///
|
||||||
/// This function will keep connecting to given Sustrate node until connection is established
|
/// This function will keep connecting to given Substrate node until connection is established
|
||||||
/// and is functional. If attempt fail, it will wait for `RECONNECT_DELAY` and retry again.
|
/// and is functional. If attempt fail, it will wait for `RECONNECT_DELAY` and retry again.
|
||||||
pub async fn new(params: ConnectionParams) -> Self {
|
pub async fn new(params: ConnectionParams) -> Self {
|
||||||
loop {
|
loop {
|
||||||
@@ -263,7 +263,7 @@ impl<C: Chain> Client<C> {
|
|||||||
|
|
||||||
/// Get the nonce of the given Substrate account.
|
/// Get the nonce of the given Substrate account.
|
||||||
///
|
///
|
||||||
/// Note: It's the caller's responsibility to make sure `account` is a valid ss58 address.
|
/// Note: It's the caller's responsibility to make sure `account` is a valid SS58 address.
|
||||||
pub async fn next_account_index(&self, account: C::AccountId) -> Result<C::Index> {
|
pub async fn next_account_index(&self, account: C::AccountId) -> Result<C::Index> {
|
||||||
self.jsonrpsee_execute(move |client| async move {
|
self.jsonrpsee_execute(move |client| async move {
|
||||||
Ok(Substrate::<C>::system_account_next_index(&*client, account).await?)
|
Ok(Substrate::<C>::system_account_next_index(&*client, account).await?)
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ pub fn abort_on_spec_version_change<C: ChainWithBalances>(mut env: impl Environm
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Abort if, during a 24 hours, free balance of given account is decreased at least by given value.
|
/// Abort if, during 24 hours, free balance of given account is decreased at least by given value.
|
||||||
/// Other components may increase (or decrease) balance of account and it WILL affect logic of the guard.
|
/// Other components may increase (or decrease) balance of account and it WILL affect logic of the guard.
|
||||||
pub fn abort_when_account_balance_decreased<C: ChainWithBalances>(
|
pub fn abort_when_account_balance_decreased<C: ChainWithBalances>(
|
||||||
mut env: impl Environment<C>,
|
mut env: impl Environment<C>,
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ where
|
|||||||
/// All entries here (like pretty much in the entire file) must be kept in sync with Rococo
|
/// All entries here (like pretty much in the entire file) must be kept in sync with Rococo
|
||||||
/// `construct_runtime`, so that we maintain SCALE-compatibility.
|
/// `construct_runtime`, so that we maintain SCALE-compatibility.
|
||||||
///
|
///
|
||||||
/// See: https://github.com/paritytech/polkadot/blob/master/runtime/rococo/src/lib.rs
|
/// See: [link](https://github.com/paritytech/polkadot/blob/master/runtime/rococo/src/lib.rs)
|
||||||
#[allow(clippy::large_enum_variant)]
|
#[allow(clippy::large_enum_variant)]
|
||||||
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone)]
|
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone)]
|
||||||
pub enum Call {
|
pub enum Call {
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ pub struct QueuedHeaders<P: HeadersSyncPipeline> {
|
|||||||
/// Headers that are (we believe) currently submitted to target node by our,
|
/// Headers that are (we believe) currently submitted to target node by our,
|
||||||
/// not-yet mined transactions.
|
/// not-yet mined transactions.
|
||||||
submitted: HeadersQueue<P>,
|
submitted: HeadersQueue<P>,
|
||||||
/// Synced headers childrens. We need it to support case when header is synced, but some of
|
/// Synced headers children. We need it to support case when header is synced, but some of
|
||||||
/// its parents are incomplete.
|
/// its parents are incomplete.
|
||||||
synced_children: SyncedChildren<P>,
|
synced_children: SyncedChildren<P>,
|
||||||
/// Pointers to all headers that we ever seen and we believe we can touch in the future.
|
/// Pointers to all headers that we ever seen and we believe we can touch in the future.
|
||||||
@@ -191,7 +191,7 @@ impl<P: HeadersSyncPipeline> QueuedHeaders<P> {
|
|||||||
.unwrap_or(HeaderStatus::Unknown)
|
.unwrap_or(HeaderStatus::Unknown)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get oldest header from given queue.
|
/// Get the oldest header from given queue.
|
||||||
pub fn header(&self, status: HeaderStatus) -> Option<&QueuedHeader<P>> {
|
pub fn header(&self, status: HeaderStatus) -> Option<&QueuedHeader<P>> {
|
||||||
match status {
|
match status {
|
||||||
HeaderStatus::Unknown | HeaderStatus::Synced => None,
|
HeaderStatus::Unknown | HeaderStatus::Synced => None,
|
||||||
@@ -205,7 +205,7 @@ impl<P: HeadersSyncPipeline> QueuedHeaders<P> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get oldest headers from given queue until functor will return false.
|
/// Get the oldest headers from given queue until functor will return false.
|
||||||
pub fn headers(
|
pub fn headers(
|
||||||
&self,
|
&self,
|
||||||
status: HeaderStatus,
|
status: HeaderStatus,
|
||||||
@@ -282,7 +282,7 @@ impl<P: HeadersSyncPipeline> QueuedHeaders<P> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Receive best header from the target node.
|
/// Receive the best header from the target node.
|
||||||
pub fn target_best_header_response(&mut self, id: &HeaderIdOf<P>) {
|
pub fn target_best_header_response(&mut self, id: &HeaderIdOf<P>) {
|
||||||
self.header_synced(id)
|
self.header_synced(id)
|
||||||
}
|
}
|
||||||
@@ -453,7 +453,7 @@ impl<P: HeadersSyncPipeline> QueuedHeaders<P> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// When incomplete headers ids are receved from target node.
|
/// When incomplete headers ids are received from target node.
|
||||||
pub fn incomplete_headers_response(&mut self, ids: HashSet<HeaderIdOf<P>>) {
|
pub fn incomplete_headers_response(&mut self, ids: HashSet<HeaderIdOf<P>>) {
|
||||||
// all new incomplete headers are marked Synced and all their descendants
|
// all new incomplete headers are marked Synced and all their descendants
|
||||||
// are moved from Ready/Submitted to Incomplete queue
|
// are moved from Ready/Submitted to Incomplete queue
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ pub struct HeadersSyncParams {
|
|||||||
/// Maximal total headers size in single submit request.
|
/// Maximal total headers size in single submit request.
|
||||||
pub max_headers_size_in_single_submit: usize,
|
pub max_headers_size_in_single_submit: usize,
|
||||||
/// We only may store and accept (from Ethereum node) headers that have
|
/// We only may store and accept (from Ethereum node) headers that have
|
||||||
/// number >= than best_substrate_header.number - prune_depth.
|
/// number >= than "best_substrate_header.number" - "prune_depth".
|
||||||
pub prune_depth: u32,
|
pub prune_depth: u32,
|
||||||
/// Target transactions mode.
|
/// Target transactions mode.
|
||||||
pub target_tx_mode: TargetTransactionMode,
|
pub target_tx_mode: TargetTransactionMode,
|
||||||
@@ -58,9 +58,9 @@ pub enum TargetTransactionMode {
|
|||||||
pub struct HeadersSync<P: HeadersSyncPipeline> {
|
pub struct HeadersSync<P: HeadersSyncPipeline> {
|
||||||
/// Synchronization parameters.
|
/// Synchronization parameters.
|
||||||
params: HeadersSyncParams,
|
params: HeadersSyncParams,
|
||||||
/// Best header number known to source node.
|
/// The best header number known to source node.
|
||||||
source_best_number: Option<P::Number>,
|
source_best_number: Option<P::Number>,
|
||||||
/// Best header known to target node.
|
/// The best header known to target node.
|
||||||
target_best_header: Option<HeaderIdOf<P>>,
|
target_best_header: Option<HeaderIdOf<P>>,
|
||||||
/// Headers queue.
|
/// Headers queue.
|
||||||
headers: QueuedHeaders<P>,
|
headers: QueuedHeaders<P>,
|
||||||
@@ -85,7 +85,7 @@ impl<P: HeadersSyncPipeline> HeadersSync<P> {
|
|||||||
self.source_best_number
|
self.source_best_number
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Best header known to target node.
|
/// The best header known to target node.
|
||||||
pub fn target_best_header(&self) -> Option<HeaderIdOf<P>> {
|
pub fn target_best_header(&self) -> Option<HeaderIdOf<P>> {
|
||||||
self.target_best_header
|
self.target_best_header
|
||||||
}
|
}
|
||||||
@@ -150,7 +150,7 @@ impl<P: HeadersSyncPipeline> HeadersSync<P> {
|
|||||||
Some(best_downloaded_number + One::one())
|
Some(best_downloaded_number + One::one())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Selech orphan header to downoload.
|
/// Selech orphan header to download.
|
||||||
pub fn select_orphan_header_to_download(&self) -> Option<&QueuedHeader<P>> {
|
pub fn select_orphan_header_to_download(&self) -> Option<&QueuedHeader<P>> {
|
||||||
let orphan_header = self.headers.header(HeaderStatus::Orphan)?;
|
let orphan_header = self.headers.header(HeaderStatus::Orphan)?;
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ pub trait SourceClient<P: HeadersSyncPipeline>: RelayClient {
|
|||||||
/// Target client trait.
|
/// Target client trait.
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
pub trait TargetClient<P: HeadersSyncPipeline>: RelayClient {
|
pub trait TargetClient<P: HeadersSyncPipeline>: RelayClient {
|
||||||
/// Returns ID of best header known to the target node.
|
/// Returns ID of the best header known to the target node.
|
||||||
async fn best_header_id(&self) -> Result<HeaderIdOf<P>, Self::Error>;
|
async fn best_header_id(&self) -> Result<HeaderIdOf<P>, Self::Error>;
|
||||||
|
|
||||||
/// Returns true if header is known to the target node.
|
/// Returns true if header is known to the target node.
|
||||||
|
|||||||
@@ -156,8 +156,8 @@ pub struct SubmittedHeaders<Id, Error> {
|
|||||||
/// IDs of incomplete headers. These headers were submitted (so this id is also in `submitted` vec),
|
/// IDs of incomplete headers. These headers were submitted (so this id is also in `submitted` vec),
|
||||||
/// but all descendants are not.
|
/// but all descendants are not.
|
||||||
pub incomplete: Vec<Id>,
|
pub incomplete: Vec<Id>,
|
||||||
/// IDs of ignored headers that we have decided not to submit (they're either rejected by
|
/// IDs of ignored headers that we have decided not to submit (they are either rejected by
|
||||||
/// target node immediately, or they're descendants of incomplete headers).
|
/// target node immediately, or their descendants of incomplete headers).
|
||||||
pub rejected: Vec<Id>,
|
pub rejected: Vec<Id>,
|
||||||
/// Fatal target node error, if it has occured during submission.
|
/// Fatal target node error, if it has occured during submission.
|
||||||
pub fatal_error: Option<Error>,
|
pub fatal_error: Option<Error>,
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
//! data. Message lane allows sending arbitrary messages between bridged chains. This
|
//! data. Message lane allows sending arbitrary messages between bridged chains. This
|
||||||
//! module provides entrypoint that starts reading messages from given message lane
|
//! module provides entrypoint that starts reading messages from given message lane
|
||||||
//! of source chain and submits proof-of-message-at-source-chain transactions to the
|
//! of source chain and submits proof-of-message-at-source-chain transactions to the
|
||||||
//! target chain. Additionaly, proofs-of-messages-delivery are sent back from the
|
//! target chain. Additionally, proofs-of-messages-delivery are sent back from the
|
||||||
//! target chain to the source chain.
|
//! target chain to the source chain.
|
||||||
|
|
||||||
// required for futures::select!
|
// required for futures::select!
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ pub trait TargetClient<P: MessageLane>: RelayClient {
|
|||||||
id: TargetHeaderIdOf<P>,
|
id: TargetHeaderIdOf<P>,
|
||||||
) -> Result<(TargetHeaderIdOf<P>, MessageNonce), Self::Error>;
|
) -> Result<(TargetHeaderIdOf<P>, MessageNonce), Self::Error>;
|
||||||
|
|
||||||
/// Get nonce of latest confirmed message.
|
/// Get nonce of the latest confirmed message.
|
||||||
async fn latest_confirmed_received_nonce(
|
async fn latest_confirmed_received_nonce(
|
||||||
&self,
|
&self,
|
||||||
id: TargetHeaderIdOf<P>,
|
id: TargetHeaderIdOf<P>,
|
||||||
@@ -218,7 +218,7 @@ pub trait TargetClient<P: MessageLane>: RelayClient {
|
|||||||
/// State of the client.
|
/// State of the client.
|
||||||
#[derive(Clone, Debug, Default, PartialEq)]
|
#[derive(Clone, Debug, Default, PartialEq)]
|
||||||
pub struct ClientState<SelfHeaderId, PeerHeaderId> {
|
pub struct ClientState<SelfHeaderId, PeerHeaderId> {
|
||||||
/// Best header id of this chain.
|
/// The best header id of this chain.
|
||||||
pub best_self: SelfHeaderId,
|
pub best_self: SelfHeaderId,
|
||||||
/// Best finalized header id of this chain.
|
/// Best finalized header id of this chain.
|
||||||
pub best_finalized_self: SelfHeaderId,
|
pub best_finalized_self: SelfHeaderId,
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
//! Message delivery race delivers proof-of-messages from lane.source to lane.target.
|
//! Message delivery race delivers proof-of-messages from "lane.source" to "lane.target".
|
||||||
|
|
||||||
use crate::message_lane::{MessageLane, SourceHeaderIdOf, TargetHeaderIdOf};
|
use crate::message_lane::{MessageLane, SourceHeaderIdOf, TargetHeaderIdOf};
|
||||||
use crate::message_lane_loop::{
|
use crate::message_lane_loop::{
|
||||||
@@ -219,7 +219,7 @@ where
|
|||||||
/// Additional nonces data from the target client used by message delivery race.
|
/// Additional nonces data from the target client used by message delivery race.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
struct DeliveryRaceTargetNoncesData {
|
struct DeliveryRaceTargetNoncesData {
|
||||||
/// Latest nonce that we know: (1) has been delivered to us (2) has been confirmed
|
/// The latest nonce that we know: (1) has been delivered to us (2) has been confirmed
|
||||||
/// back to the source node (by confirmations race) and (3) relayer has received
|
/// back to the source node (by confirmations race) and (3) relayer has received
|
||||||
/// reward for (and this has been confirmed by the message delivery race).
|
/// reward for (and this has been confirmed by the message delivery race).
|
||||||
confirmed_nonce: MessageNonce,
|
confirmed_nonce: MessageNonce,
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ pub struct SourceClientNonces<NoncesRange> {
|
|||||||
/// New nonces range known to the client. `New` here means all nonces generated after
|
/// New nonces range known to the client. `New` here means all nonces generated after
|
||||||
/// `prev_latest_nonce` passed to the `SourceClient::nonces` method.
|
/// `prev_latest_nonce` passed to the `SourceClient::nonces` method.
|
||||||
pub new_nonces: NoncesRange,
|
pub new_nonces: NoncesRange,
|
||||||
/// Latest nonce that is confirmed to the bridged client. This nonce only makes
|
/// The latest nonce that is confirmed to the bridged client. This nonce only makes
|
||||||
/// sense in some races. In other races it is `None`.
|
/// sense in some races. In other races it is `None`.
|
||||||
pub confirmed_nonce: Option<MessageNonce>,
|
pub confirmed_nonce: Option<MessageNonce>,
|
||||||
}
|
}
|
||||||
@@ -84,7 +84,7 @@ pub struct SourceClientNonces<NoncesRange> {
|
|||||||
/// Nonces on the race target client.
|
/// Nonces on the race target client.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct TargetClientNonces<TargetNoncesData> {
|
pub struct TargetClientNonces<TargetNoncesData> {
|
||||||
/// Latest nonce that is known to the target client.
|
/// The latest nonce that is known to the target client.
|
||||||
pub latest_nonce: MessageNonce,
|
pub latest_nonce: MessageNonce,
|
||||||
/// Additional data from target node that may be used by the race.
|
/// Additional data from target node that may be used by the race.
|
||||||
pub nonces_data: TargetNoncesData,
|
pub nonces_data: TargetNoncesData,
|
||||||
@@ -93,7 +93,7 @@ pub struct TargetClientNonces<TargetNoncesData> {
|
|||||||
/// One of message lane clients, which is source client for the race.
|
/// One of message lane clients, which is source client for the race.
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
pub trait SourceClient<P: MessageRace> {
|
pub trait SourceClient<P: MessageRace> {
|
||||||
/// Type of error this clients returns.
|
/// Type of error these clients returns.
|
||||||
type Error: std::fmt::Debug + MaybeConnectionError;
|
type Error: std::fmt::Debug + MaybeConnectionError;
|
||||||
/// Type of nonces range returned by the source client.
|
/// Type of nonces range returned by the source client.
|
||||||
type NoncesRange: NoncesRange;
|
type NoncesRange: NoncesRange;
|
||||||
@@ -118,7 +118,7 @@ pub trait SourceClient<P: MessageRace> {
|
|||||||
/// One of message lane clients, which is target client for the race.
|
/// One of message lane clients, which is target client for the race.
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
pub trait TargetClient<P: MessageRace> {
|
pub trait TargetClient<P: MessageRace> {
|
||||||
/// Type of error this clients returns.
|
/// Type of error these clients returns.
|
||||||
type Error: std::fmt::Debug + MaybeConnectionError;
|
type Error: std::fmt::Debug + MaybeConnectionError;
|
||||||
/// Type of the additional data from the target client, used by the race.
|
/// Type of the additional data from the target client, used by the race.
|
||||||
type TargetNoncesData: std::fmt::Debug;
|
type TargetNoncesData: std::fmt::Debug;
|
||||||
@@ -156,12 +156,12 @@ pub trait RaceStrategy<SourceHeaderId, TargetHeaderId, Proof>: Debug {
|
|||||||
fn is_empty(&self) -> bool;
|
fn is_empty(&self) -> bool;
|
||||||
/// Return id of source header that is required to be on target to continue synchronization.
|
/// Return id of source header that is required to be on target to continue synchronization.
|
||||||
fn required_source_header_at_target(&self, current_best: &SourceHeaderId) -> Option<SourceHeaderId>;
|
fn required_source_header_at_target(&self, current_best: &SourceHeaderId) -> Option<SourceHeaderId>;
|
||||||
/// Return best nonce at source node.
|
/// Return the best nonce at source node.
|
||||||
///
|
///
|
||||||
/// `Some` is returned only if we are sure that the value is greater or equal
|
/// `Some` is returned only if we are sure that the value is greater or equal
|
||||||
/// than the result of `best_at_target`.
|
/// than the result of `best_at_target`.
|
||||||
fn best_at_source(&self) -> Option<MessageNonce>;
|
fn best_at_source(&self) -> Option<MessageNonce>;
|
||||||
/// Return best nonce at target node.
|
/// Return the best nonce at target node.
|
||||||
///
|
///
|
||||||
/// May return `None` if value is yet unknown.
|
/// May return `None` if value is yet unknown.
|
||||||
fn best_at_target(&self) -> Option<MessageNonce>;
|
fn best_at_target(&self) -> Option<MessageNonce>;
|
||||||
@@ -197,7 +197,7 @@ pub struct RaceState<SourceHeaderId, TargetHeaderId, Proof> {
|
|||||||
/// Best finalized source header id at the best block on the target
|
/// Best finalized source header id at the best block on the target
|
||||||
/// client (at the `best_finalized_source_header_id_at_best_target`).
|
/// client (at the `best_finalized_source_header_id_at_best_target`).
|
||||||
pub best_finalized_source_header_id_at_best_target: Option<SourceHeaderId>,
|
pub best_finalized_source_header_id_at_best_target: Option<SourceHeaderId>,
|
||||||
/// Best header id at the target client.
|
/// The best header id at the target client.
|
||||||
pub best_target_header_id: Option<TargetHeaderId>,
|
pub best_target_header_id: Option<TargetHeaderId>,
|
||||||
/// Best finalized header id at the target client.
|
/// Best finalized header id at the target client.
|
||||||
pub best_finalized_target_header_id: Option<TargetHeaderId>,
|
pub best_finalized_target_header_id: Option<TargetHeaderId>,
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
//! Message receiving race delivers proof-of-messages-delivery from lane.target to lane.source.
|
//! Message receiving race delivers proof-of-messages-delivery from "lane.target" to "lane.source".
|
||||||
|
|
||||||
use crate::message_lane::{MessageLane, SourceHeaderIdOf, TargetHeaderIdOf};
|
use crate::message_lane::{MessageLane, SourceHeaderIdOf, TargetHeaderIdOf};
|
||||||
use crate::message_lane_loop::{
|
use crate::message_lane_loop::{
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ pub struct BasicStrategy<
|
|||||||
> {
|
> {
|
||||||
/// All queued nonces.
|
/// All queued nonces.
|
||||||
source_queue: SourceRangesQueue<SourceHeaderHash, SourceHeaderNumber, SourceNoncesRange>,
|
source_queue: SourceRangesQueue<SourceHeaderHash, SourceHeaderNumber, SourceNoncesRange>,
|
||||||
/// Best nonce known to target node (at its best block). `None` if it has not been received yet.
|
/// The best nonce known to target node (at its best block). `None` if it has not been received yet.
|
||||||
best_target_nonce: Option<MessageNonce>,
|
best_target_nonce: Option<MessageNonce>,
|
||||||
/// Unused generic types dump.
|
/// Unused generic types dump.
|
||||||
_phantom: PhantomData<(TargetHeaderNumber, TargetHeaderHash, Proof)>,
|
_phantom: PhantomData<(TargetHeaderNumber, TargetHeaderHash, Proof)>,
|
||||||
|
|||||||
@@ -87,21 +87,21 @@ impl MessageLaneLoopMetrics {
|
|||||||
.set(source_latest_generated_nonce);
|
.set(source_latest_generated_nonce);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Update latest confirmed nonce at source.
|
/// Update the latest confirmed nonce at source.
|
||||||
pub fn update_source_latest_confirmed_nonce<P: MessageLane>(&self, source_latest_confirmed_nonce: MessageNonce) {
|
pub fn update_source_latest_confirmed_nonce<P: MessageLane>(&self, source_latest_confirmed_nonce: MessageNonce) {
|
||||||
self.lane_state_nonces
|
self.lane_state_nonces
|
||||||
.with_label_values(&["source_latest_confirmed"])
|
.with_label_values(&["source_latest_confirmed"])
|
||||||
.set(source_latest_confirmed_nonce);
|
.set(source_latest_confirmed_nonce);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Update latest received nonce at target.
|
/// Update the latest received nonce at target.
|
||||||
pub fn update_target_latest_received_nonce<P: MessageLane>(&self, target_latest_generated_nonce: MessageNonce) {
|
pub fn update_target_latest_received_nonce<P: MessageLane>(&self, target_latest_generated_nonce: MessageNonce) {
|
||||||
self.lane_state_nonces
|
self.lane_state_nonces
|
||||||
.with_label_values(&["target_latest_received"])
|
.with_label_values(&["target_latest_received"])
|
||||||
.set(target_latest_generated_nonce);
|
.set(target_latest_generated_nonce);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Update latest confirmed nonce at target.
|
/// Update the latest confirmed nonce at target.
|
||||||
pub fn update_target_latest_confirmed_nonce<P: MessageLane>(&self, target_latest_confirmed_nonce: MessageNonce) {
|
pub fn update_target_latest_confirmed_nonce<P: MessageLane>(&self, target_latest_confirmed_nonce: MessageNonce) {
|
||||||
self.lane_state_nonces
|
self.lane_state_nonces
|
||||||
.with_label_values(&["target_latest_confirmed"])
|
.with_label_values(&["target_latest_confirmed"])
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ pub const RECONNECT_DELAY: Duration = Duration::from_secs(10);
|
|||||||
/// Basic blockchain client from relay perspective.
|
/// Basic blockchain client from relay perspective.
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
pub trait Client: 'static + Clone + Send + Sync {
|
pub trait Client: 'static + Clone + Send + Sync {
|
||||||
/// Type of error this clients returns.
|
/// Type of error these clients returns.
|
||||||
type Error: 'static + Debug + MaybeConnectionError + Send + Sync;
|
type Error: 'static + Debug + MaybeConnectionError + Send + Sync;
|
||||||
|
|
||||||
/// Try to reconnect to source node.
|
/// Try to reconnect to source node.
|
||||||
|
|||||||
Reference in New Issue
Block a user