Trait substrate_relay_helper::finality_base::engine::Engine
source · pub trait Engine<C: Chain>: Send {
type ConsensusLogReader: ConsensusLogReader;
type FinalityProof: FinalityProof<HashOf<C>, BlockNumberOf<C>> + Decode + Encode;
type FinalityVerificationContext: Debug + Send;
type EquivocationProof: Clone + Debug + Send + Sync;
type EquivocationsFinder: FindEquivocations<Self::FinalityProof, Self::FinalityVerificationContext, Self::EquivocationProof>;
type KeyOwnerProof: Send;
type InitializationData: Debug + Send + Sync + 'static;
type OperatingMode: OperatingMode + 'static;
const ID: ConsensusEngineId;
// Required methods
fn is_initialized_key() -> StorageKey;
fn pallet_operating_mode_key() -> StorageKey;
fn source_finality_proofs<'life0, 'async_trait>(
source_client: &'life0 (impl 'async_trait + Client<C>),
) -> Pin<Box<dyn Future<Output = Result<Subscription<Bytes>, SubstrateError>> + Send + 'async_trait>>
where 'life0: 'async_trait;
fn verify_and_optimize_proof<'life0, 'life1, 'life2, 'async_trait, TargetChain>(
target_client: &'life0 (impl 'async_trait + Client<TargetChain>),
header: &'life1 C::Header,
proof: &'life2 mut Self::FinalityProof,
) -> Pin<Box<dyn Future<Output = Result<Self::FinalityVerificationContext, SubstrateError>> + Send + 'async_trait>>
where TargetChain: 'async_trait + Chain,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn check_max_expected_call_limits(
header: &C::Header,
proof: &Self::FinalityProof,
) -> SubmitFinalityProofCallExtras;
fn prepare_initialization_data<'async_trait>(
client: impl 'async_trait + Client<C>,
) -> Pin<Box<dyn Future<Output = Result<Self::InitializationData, Error<HashOf<C>, BlockNumberOf<C>>>> + Send + 'async_trait>>
where Self: 'async_trait;
fn finality_verification_context<'life0, 'async_trait, TargetChain>(
target_client: &'life0 (impl 'async_trait + Client<TargetChain>),
at: HashOf<TargetChain>,
) -> Pin<Box<dyn Future<Output = Result<Self::FinalityVerificationContext, SubstrateError>> + Send + 'async_trait>>
where TargetChain: 'async_trait + Chain,
Self: 'async_trait,
'life0: 'async_trait;
fn synced_headers_finality_info<'life0, 'async_trait, TargetChain>(
target_client: &'life0 (impl 'async_trait + Client<TargetChain>),
at: TargetChain::Hash,
) -> Pin<Box<dyn Future<Output = Result<Vec<HeaderFinalityInfo<Self::FinalityProof, Self::FinalityVerificationContext>>, SubstrateError>> + Send + 'async_trait>>
where TargetChain: 'async_trait + Chain,
Self: 'async_trait,
'life0: 'async_trait;
fn generate_source_key_ownership_proof<'life0, 'life1, 'async_trait>(
source_client: &'life0 (impl 'async_trait + Client<C>),
at: C::Hash,
equivocation: &'life1 Self::EquivocationProof,
) -> Pin<Box<dyn Future<Output = Result<Self::KeyOwnerProof, SubstrateError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn is_initialized<'life0, 'async_trait, TargetChain>(
target_client: &'life0 (impl 'async_trait + Client<TargetChain>),
) -> Pin<Box<dyn Future<Output = Result<bool, SubstrateError>> + Send + 'async_trait>>
where TargetChain: 'async_trait + Chain,
Self: 'async_trait,
'life0: 'async_trait { ... }
fn is_halted<'life0, 'async_trait, TargetChain>(
target_client: &'life0 (impl 'async_trait + Client<TargetChain>),
) -> Pin<Box<dyn Future<Output = Result<bool, SubstrateError>> + Send + 'async_trait>>
where TargetChain: 'async_trait + Chain,
Self: 'async_trait,
'life0: 'async_trait { ... }
}
Expand description
Finality engine, used by the Substrate chain.
Required Associated Types§
sourcetype ConsensusLogReader: ConsensusLogReader
type ConsensusLogReader: ConsensusLogReader
A reader that can extract the consensus log from the header digest and interpret it.
sourcetype FinalityProof: FinalityProof<HashOf<C>, BlockNumberOf<C>> + Decode + Encode
type FinalityProof: FinalityProof<HashOf<C>, BlockNumberOf<C>> + Decode + Encode
Type of finality proofs, used by consensus engine.
sourcetype FinalityVerificationContext: Debug + Send
type FinalityVerificationContext: Debug + Send
The context needed for verifying finality proofs.
sourcetype EquivocationProof: Clone + Debug + Send + Sync
type EquivocationProof: Clone + Debug + Send + Sync
The type of the equivocation proof used by the consensus engine.
sourcetype EquivocationsFinder: FindEquivocations<Self::FinalityProof, Self::FinalityVerificationContext, Self::EquivocationProof>
type EquivocationsFinder: FindEquivocations<Self::FinalityProof, Self::FinalityVerificationContext, Self::EquivocationProof>
The equivocations finder.
sourcetype KeyOwnerProof: Send
type KeyOwnerProof: Send
The type of the key owner proof used by the consensus engine.
sourcetype InitializationData: Debug + Send + Sync + 'static
type InitializationData: Debug + Send + Sync + 'static
Type of bridge pallet initialization data.
sourcetype OperatingMode: OperatingMode + 'static
type OperatingMode: OperatingMode + 'static
Type of bridge pallet operating mode.
Required Associated Constants§
Required Methods§
sourcefn is_initialized_key() -> StorageKey
fn is_initialized_key() -> StorageKey
Returns storage at the bridged (target) chain that corresponds to some value that is missing from the storage until bridge pallet is initialized.
Note that we don’t care about type of the value - just if it present or not.
sourcefn pallet_operating_mode_key() -> StorageKey
fn pallet_operating_mode_key() -> StorageKey
Returns storage key at the bridged (target) chain that corresponds to the variable that holds the operating mode of the pallet.
sourcefn source_finality_proofs<'life0, 'async_trait>(
source_client: &'life0 (impl 'async_trait + Client<C>),
) -> Pin<Box<dyn Future<Output = Result<Subscription<Bytes>, SubstrateError>> + Send + 'async_trait>>where
'life0: 'async_trait,
fn source_finality_proofs<'life0, 'async_trait>(
source_client: &'life0 (impl 'async_trait + Client<C>),
) -> Pin<Box<dyn Future<Output = Result<Subscription<Bytes>, SubstrateError>> + Send + 'async_trait>>where
'life0: 'async_trait,
A method to subscribe to encoded finality proofs, given source client.
sourcefn verify_and_optimize_proof<'life0, 'life1, 'life2, 'async_trait, TargetChain>(
target_client: &'life0 (impl 'async_trait + Client<TargetChain>),
header: &'life1 C::Header,
proof: &'life2 mut Self::FinalityProof,
) -> Pin<Box<dyn Future<Output = Result<Self::FinalityVerificationContext, SubstrateError>> + Send + 'async_trait>>where
TargetChain: 'async_trait + Chain,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn verify_and_optimize_proof<'life0, 'life1, 'life2, 'async_trait, TargetChain>(
target_client: &'life0 (impl 'async_trait + Client<TargetChain>),
header: &'life1 C::Header,
proof: &'life2 mut Self::FinalityProof,
) -> Pin<Box<dyn Future<Output = Result<Self::FinalityVerificationContext, SubstrateError>> + Send + 'async_trait>>where
TargetChain: 'async_trait + Chain,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Verify and optimize finality proof before sending it to the target node.
Apart from optimization, we expect this method to perform all required checks
that the header
and proof
are valid at the current state of the target chain.
sourcefn check_max_expected_call_limits(
header: &C::Header,
proof: &Self::FinalityProof,
) -> SubmitFinalityProofCallExtras
fn check_max_expected_call_limits( header: &C::Header, proof: &Self::FinalityProof, ) -> SubmitFinalityProofCallExtras
Checks whether the given header
and its finality proof
fit the maximal expected
call limits (size and weight).
sourcefn prepare_initialization_data<'async_trait>(
client: impl 'async_trait + Client<C>,
) -> Pin<Box<dyn Future<Output = Result<Self::InitializationData, Error<HashOf<C>, BlockNumberOf<C>>>> + Send + 'async_trait>>where
Self: 'async_trait,
fn prepare_initialization_data<'async_trait>(
client: impl 'async_trait + Client<C>,
) -> Pin<Box<dyn Future<Output = Result<Self::InitializationData, Error<HashOf<C>, BlockNumberOf<C>>>> + Send + 'async_trait>>where
Self: 'async_trait,
Prepare initialization data for the finality bridge pallet.
sourcefn finality_verification_context<'life0, 'async_trait, TargetChain>(
target_client: &'life0 (impl 'async_trait + Client<TargetChain>),
at: HashOf<TargetChain>,
) -> Pin<Box<dyn Future<Output = Result<Self::FinalityVerificationContext, SubstrateError>> + Send + 'async_trait>>where
TargetChain: 'async_trait + Chain,
Self: 'async_trait,
'life0: 'async_trait,
fn finality_verification_context<'life0, 'async_trait, TargetChain>(
target_client: &'life0 (impl 'async_trait + Client<TargetChain>),
at: HashOf<TargetChain>,
) -> Pin<Box<dyn Future<Output = Result<Self::FinalityVerificationContext, SubstrateError>> + Send + 'async_trait>>where
TargetChain: 'async_trait + Chain,
Self: 'async_trait,
'life0: 'async_trait,
Get the context needed for validating a finality proof.
sourcefn synced_headers_finality_info<'life0, 'async_trait, TargetChain>(
target_client: &'life0 (impl 'async_trait + Client<TargetChain>),
at: TargetChain::Hash,
) -> Pin<Box<dyn Future<Output = Result<Vec<HeaderFinalityInfo<Self::FinalityProof, Self::FinalityVerificationContext>>, SubstrateError>> + Send + 'async_trait>>where
TargetChain: 'async_trait + Chain,
Self: 'async_trait,
'life0: 'async_trait,
fn synced_headers_finality_info<'life0, 'async_trait, TargetChain>(
target_client: &'life0 (impl 'async_trait + Client<TargetChain>),
at: TargetChain::Hash,
) -> Pin<Box<dyn Future<Output = Result<Vec<HeaderFinalityInfo<Self::FinalityProof, Self::FinalityVerificationContext>>, SubstrateError>> + Send + 'async_trait>>where
TargetChain: 'async_trait + Chain,
Self: 'async_trait,
'life0: 'async_trait,
Returns the finality info associated to the source headers synced with the target at the provided block.
sourcefn generate_source_key_ownership_proof<'life0, 'life1, 'async_trait>(
source_client: &'life0 (impl 'async_trait + Client<C>),
at: C::Hash,
equivocation: &'life1 Self::EquivocationProof,
) -> Pin<Box<dyn Future<Output = Result<Self::KeyOwnerProof, SubstrateError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn generate_source_key_ownership_proof<'life0, 'life1, 'async_trait>(
source_client: &'life0 (impl 'async_trait + Client<C>),
at: C::Hash,
equivocation: &'life1 Self::EquivocationProof,
) -> Pin<Box<dyn Future<Output = Result<Self::KeyOwnerProof, SubstrateError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Generate key ownership proof for the provided equivocation.
Provided Methods§
sourcefn is_initialized<'life0, 'async_trait, TargetChain>(
target_client: &'life0 (impl 'async_trait + Client<TargetChain>),
) -> Pin<Box<dyn Future<Output = Result<bool, SubstrateError>> + Send + 'async_trait>>where
TargetChain: 'async_trait + Chain,
Self: 'async_trait,
'life0: 'async_trait,
fn is_initialized<'life0, 'async_trait, TargetChain>(
target_client: &'life0 (impl 'async_trait + Client<TargetChain>),
) -> Pin<Box<dyn Future<Output = Result<bool, SubstrateError>> + Send + 'async_trait>>where
TargetChain: 'async_trait + Chain,
Self: 'async_trait,
'life0: 'async_trait,
Returns Ok(true)
if finality pallet at the bridged chain has already been initialized.
sourcefn is_halted<'life0, 'async_trait, TargetChain>(
target_client: &'life0 (impl 'async_trait + Client<TargetChain>),
) -> Pin<Box<dyn Future<Output = Result<bool, SubstrateError>> + Send + 'async_trait>>where
TargetChain: 'async_trait + Chain,
Self: 'async_trait,
'life0: 'async_trait,
fn is_halted<'life0, 'async_trait, TargetChain>(
target_client: &'life0 (impl 'async_trait + Client<TargetChain>),
) -> Pin<Box<dyn Future<Output = Result<bool, SubstrateError>> + Send + 'async_trait>>where
TargetChain: 'async_trait + Chain,
Self: 'async_trait,
'life0: 'async_trait,
Returns Ok(true)
if finality pallet at the bridged chain is halted.