Trait sp_consensus::ProofRecording

source ·
pub trait ProofRecording: Send + Sync + Sealed + 'static {
    type Proof: Send + Sync + 'static;

    const ENABLED: bool;

    // Required method
    fn into_proof(
        storage_proof: Option<StorageProof>
    ) -> Result<Self::Proof, NoProofRecorded>;
}
Expand description

A trait to express the state of proof recording on type system level.

This is used by Proposer to signal if proof recording is enabled. This can be used by downstream users of the Proposer trait to enforce that proof recording is activated when required. The only two implementations of this trait are DisableProofRecording and EnableProofRecording.

This trait is sealed and can not be implemented outside of this crate!

Required Associated Types§

source

type Proof: Send + Sync + 'static

The proof type that will be used internally.

Required Associated Constants§

source

const ENABLED: bool

Is proof recording enabled?

Required Methods§

source

fn into_proof( storage_proof: Option<StorageProof> ) -> Result<Self::Proof, NoProofRecorded>

Convert the given storage_proof into Self::Proof.

Internally Substrate uses Option<StorageProof> to express the both states of proof recording (for now) and as Self::Proof is some different type, we need to provide a function to convert this value.

If the proof recording was requested, but None is given, this will return Err(NoProofRecorded).

Object Safety§

This trait is not object safe.

Implementors§