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§
Sourcetype Proof: Clone + Debug + Decode + Encode + PartialEq + TypeInfo
type Proof: Clone + Debug + Decode + Encode + PartialEq + TypeInfo
Type containing proved info about the canonical chain at a certain height.
Sourcetype ValidationContext
type ValidationContext
The data needed for validating the proof.
Required Methods§
Sourcefn generate_proof(
prev_block_number: Header::Number,
best_known_block_number: Option<Header::Number>,
) -> Option<Self::Proof>
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
.
Sourcefn is_proof_optimal(proof: &Self::Proof) -> bool
fn is_proof_optimal(proof: &Self::Proof) -> bool
Check if the proof is optimal.
Sourcefn extract_validation_context(header: Header) -> Option<Self::ValidationContext>
fn extract_validation_context(header: Header) -> Option<Self::ValidationContext>
Extract the validation context from the provided header.
Sourcefn is_non_canonical(
commitment: &Commitment<Header::Number>,
proof: Self::Proof,
context: Self::ValidationContext,
) -> bool
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.