pub trait ClientExecutionContext: Sized {
    type V: ClientValidationContext;
    type AnyClientState: ClientState<Self::V, Self>;
    type AnyConsensusState: ConsensusState;

    // Required methods
    fn store_client_state(
        &mut self,
        client_state_path: ClientStatePath,
        client_state: Self::AnyClientState
    ) -> Result<(), ContextError>;
    fn store_consensus_state(
        &mut self,
        consensus_state_path: ClientConsensusStatePath,
        consensus_state: Self::AnyConsensusState
    ) -> Result<(), ContextError>;
    fn delete_consensus_state(
        &mut self,
        consensus_state_path: ClientConsensusStatePath
    ) -> Result<(), ContextError>;
    fn store_update_time(
        &mut self,
        client_id: ClientId,
        height: Height,
        host_timestamp: Timestamp
    ) -> Result<(), ContextError>;
    fn store_update_height(
        &mut self,
        client_id: ClientId,
        height: Height,
        host_height: Height
    ) -> Result<(), ContextError>;
    fn delete_update_time(
        &mut self,
        client_id: ClientId,
        height: Height
    ) -> Result<(), ContextError>;
    fn delete_update_height(
        &mut self,
        client_id: ClientId,
        height: Height
    ) -> Result<(), ContextError>;
}
Expand description

Defines the methods that all client ExecutionContexts (precisely the generic parameter of crate::client_state::ClientStateExecution ) must implement.

Specifically, clients have the responsibility to store their client state and consensus states. This trait defines a uniform interface to do that for all clients.

Required Associated Types§

Required Methods§

fn store_client_state( &mut self, client_state_path: ClientStatePath, client_state: Self::AnyClientState ) -> Result<(), ContextError>

Called upon successful client creation and update

fn store_consensus_state( &mut self, consensus_state_path: ClientConsensusStatePath, consensus_state: Self::AnyConsensusState ) -> Result<(), ContextError>

Called upon successful client creation and update

fn delete_consensus_state( &mut self, consensus_state_path: ClientConsensusStatePath ) -> Result<(), ContextError>

Delete the consensus state from the store located at the given ClientConsensusStatePath

fn store_update_time( &mut self, client_id: ClientId, height: Height, host_timestamp: Timestamp ) -> Result<(), ContextError>

Called upon successful client update. Implementations are expected to use this to record the specified time as the time at which this update (or header) was processed.

fn store_update_height( &mut self, client_id: ClientId, height: Height, host_height: Height ) -> Result<(), ContextError>

Called upon successful client update. Implementations are expected to use this to record the specified height as the height at at which this update (or header) was processed.

fn delete_update_time( &mut self, client_id: ClientId, height: Height ) -> Result<(), ContextError>

Delete the update time associated with the client at the specified height. This update time should be associated with a consensus state through the specified height.

Note that this timestamp is determined by the host.

fn delete_update_height( &mut self, client_id: ClientId, height: Height ) -> Result<(), ContextError>

Delete the update height associated with the client at the specified height. This update time should be associated with a consensus state through the specified height.

Object Safety§

This trait is not object safe.

Implementors§