Trait oasis_core_runtime::consensus::verifier::Verifier

source ·
pub trait Verifier: Send + Sync {
    // Required methods
    fn sync<'life0, 'async_trait>(
        &'life0 self,
        height: u64,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn verify<'life0, 'async_trait>(
        &'life0 self,
        consensus_block: LightBlock,
        runtime_header: Header,
        epoch: EpochTime,
    ) -> Pin<Box<dyn Future<Output = Result<ConsensusState, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn verify_for_query<'life0, 'async_trait>(
        &'life0 self,
        consensus_block: LightBlock,
        runtime_header: Header,
        epoch: EpochTime,
    ) -> Pin<Box<dyn Future<Output = Result<ConsensusState, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn unverified_state<'life0, 'async_trait>(
        &'life0 self,
        consensus_block: LightBlock,
    ) -> Pin<Box<dyn Future<Output = Result<ConsensusState, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn latest_state<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<ConsensusState, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn state_at<'life0, 'async_trait>(
        &'life0 self,
        height: u64,
    ) -> Pin<Box<dyn Future<Output = Result<ConsensusState, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn events_at<'life0, 'async_trait>(
        &'life0 self,
        height: u64,
        kind: EventKind,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Event>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn latest_height<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Verifier is the consensus layer state verifier trait.

Required Methods§

source

fn sync<'life0, 'async_trait>( &'life0 self, height: u64, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Synchronize the verifier state up to including the passed consensus height.

source

fn verify<'life0, 'async_trait>( &'life0 self, consensus_block: LightBlock, runtime_header: Header, epoch: EpochTime, ) -> Pin<Box<dyn Future<Output = Result<ConsensusState, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Verify that the given runtime header is valid at the given consensus layer block and return the consensus layer state accessor for that block.

This also verifies that the state is fresh.

source

fn verify_for_query<'life0, 'async_trait>( &'life0 self, consensus_block: LightBlock, runtime_header: Header, epoch: EpochTime, ) -> Pin<Box<dyn Future<Output = Result<ConsensusState, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Verify that the given runtime header is valid at the given consensus layer block and return the consensus layer state accessor for that block.

This is a relaxed version of the verify function that should be used for verifying state in queries.

source

fn unverified_state<'life0, 'async_trait>( &'life0 self, consensus_block: LightBlock, ) -> Pin<Box<dyn Future<Output = Result<ConsensusState, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return the consensus layer state accessor for the given consensus layer block WITHOUT performing any verification. This method should only be used for operations that do not require integrity guarantees.

source

fn latest_state<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<ConsensusState, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return the latest verified consensus layer state.

§Warning

The state is not verified to be fresh. Use verify_state_freshness to perform this verification manually if needed.

source

fn state_at<'life0, 'async_trait>( &'life0 self, height: u64, ) -> Pin<Box<dyn Future<Output = Result<ConsensusState, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return the verified consensus layer state for a given height.

§Warning

The state is not verified to be fresh. Use verify_state_freshness to perform this verification manually if needed.

source

fn events_at<'life0, 'async_trait>( &'life0 self, height: u64, kind: EventKind, ) -> Pin<Box<dyn Future<Output = Result<Vec<Event>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return the consensus layer events at the given height.

§Warning

Event integrity is currently not verified and it thus relies on replicated computation even when using a TEE-enabled runtime.

source

fn latest_height<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return the latest known consensus layer height.

Implementations on Foreign Types§

source§

impl<T: ?Sized + Verifier> Verifier for Arc<T>

source§

fn sync<'life0, 'async_trait>( &'life0 self, height: u64, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

fn verify<'life0, 'async_trait>( &'life0 self, consensus_block: LightBlock, runtime_header: Header, epoch: EpochTime, ) -> Pin<Box<dyn Future<Output = Result<ConsensusState, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

fn verify_for_query<'life0, 'async_trait>( &'life0 self, consensus_block: LightBlock, runtime_header: Header, epoch: EpochTime, ) -> Pin<Box<dyn Future<Output = Result<ConsensusState, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

fn unverified_state<'life0, 'async_trait>( &'life0 self, consensus_block: LightBlock, ) -> Pin<Box<dyn Future<Output = Result<ConsensusState, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

fn latest_state<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<ConsensusState, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

fn state_at<'life0, 'async_trait>( &'life0 self, height: u64, ) -> Pin<Box<dyn Future<Output = Result<ConsensusState, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

fn events_at<'life0, 'async_trait>( &'life0 self, height: u64, kind: EventKind, ) -> Pin<Box<dyn Future<Output = Result<Vec<Event>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

fn latest_height<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§