referrerpolicy=no-referrer-when-downgrade

Trait AncestryHelper

Source
pub trait AncestryHelper<Header: HeaderT> {
    type Proof: Clone + Debug + Decode + Encode + PartialEq + TypeInfo;
    type ValidationContext;

    // Required methods
    fn generate_proof(
        prev_block_number: Header::Number,
        best_known_block_number: Option<Header::Number>,
    ) -> Option<Self::Proof>;
    fn is_proof_optimal(proof: &Self::Proof) -> bool;
    fn extract_validation_context(
        header: Header,
    ) -> Option<Self::ValidationContext>;
    fn is_non_canonical(
        commitment: &Commitment<Header::Number>,
        proof: Self::Proof,
        context: Self::ValidationContext,
    ) -> bool;
}
Expand description

Hook containing helper methods for proving/checking commitment canonicity.

Required Associated Types§

Source

type Proof: Clone + Debug + Decode + Encode + PartialEq + TypeInfo

Type containing proved info about the canonical chain at a certain height.

Source

type ValidationContext

The data needed for validating the proof.

Required Methods§

Source

fn generate_proof( prev_block_number: Header::Number, best_known_block_number: Option<Header::Number>, ) -> Option<Self::Proof>

Generates a proof that the prev_block_number is part of the canonical chain at best_known_block_number.

Source

fn is_proof_optimal(proof: &Self::Proof) -> bool

Check if the proof is optimal.

Source

fn extract_validation_context(header: Header) -> Option<Self::ValidationContext>

Extract the validation context from the provided header.

Source

fn is_non_canonical( commitment: &Commitment<Header::Number>, proof: Self::Proof, context: Self::ValidationContext, ) -> bool

Check if a commitment is pointing to a header on a non-canonical chain against a canonicity proof generated at the same header height.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§