pub trait ClientExecutionContext: ClientValidationContext<ClientStateRef = Self::ClientStateMut> {
type ClientStateMut: ClientStateExecution<Self>;
// Required methods
fn store_client_state(
&mut self,
client_state_path: ClientStatePath,
client_state: Self::ClientStateRef
) -> Result<(), ContextError>;
fn store_consensus_state(
&mut self,
consensus_state_path: ClientConsensusStatePath,
consensus_state: Self::ConsensusStateRef
) -> Result<(), ContextError>;
fn delete_consensus_state(
&mut self,
consensus_state_path: ClientConsensusStatePath
) -> Result<(), ContextError>;
fn store_update_meta(
&mut self,
client_id: ClientId,
height: Height,
host_timestamp: Timestamp,
host_height: Height
) -> Result<(), ContextError>;
fn delete_update_meta(
&mut self,
client_id: ClientId,
height: Height
) -> Result<(), ContextError>;
// Provided method
fn client_state_mut(
&self,
client_id: &ClientId
) -> Result<Self::ClientStateMut, ContextError> { ... }
}
Expand description
Defines the methods that all client ExecutionContext
s (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§
type ClientStateMut: ClientStateExecution<Self>
Required Methods§
sourcefn store_client_state(
&mut self,
client_state_path: ClientStatePath,
client_state: Self::ClientStateRef
) -> Result<(), ContextError>
fn store_client_state( &mut self, client_state_path: ClientStatePath, client_state: Self::ClientStateRef ) -> Result<(), ContextError>
Called upon successful client creation and update
sourcefn store_consensus_state(
&mut self,
consensus_state_path: ClientConsensusStatePath,
consensus_state: Self::ConsensusStateRef
) -> Result<(), ContextError>
fn store_consensus_state( &mut self, consensus_state_path: ClientConsensusStatePath, consensus_state: Self::ConsensusStateRef ) -> Result<(), ContextError>
Called upon successful client creation and update
sourcefn delete_consensus_state(
&mut self,
consensus_state_path: ClientConsensusStatePath
) -> Result<(), ContextError>
fn delete_consensus_state( &mut self, consensus_state_path: ClientConsensusStatePath ) -> Result<(), ContextError>
Delete the consensus state from the store located at the given ClientConsensusStatePath
sourcefn store_update_meta(
&mut self,
client_id: ClientId,
height: Height,
host_timestamp: Timestamp,
host_height: Height
) -> Result<(), ContextError>
fn store_update_meta( &mut self, client_id: ClientId, height: Height, host_timestamp: Timestamp, host_height: Height ) -> Result<(), ContextError>
Called upon successful client update.
Implementations are expected to use this to record the specified time and height as the time at which this update (or header) was processed.
sourcefn delete_update_meta(
&mut self,
client_id: ClientId,
height: Height
) -> Result<(), ContextError>
fn delete_update_meta( &mut self, client_id: ClientId, height: Height ) -> Result<(), ContextError>
Delete the update time and height 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.