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

Show 25 methods // Required methods fn get_client_validation_context(&self) -> &Self::V; fn client_state( &self, client_id: &ClientId ) -> Result<Self::AnyClientState, ContextError>; fn decode_client_state( &self, client_state: Any ) -> Result<Self::AnyClientState, ContextError>; fn consensus_state( &self, client_cons_state_path: &ClientConsensusStatePath ) -> Result<Self::AnyConsensusState, ContextError>; fn host_height(&self) -> Result<Height, ContextError>; fn host_timestamp(&self) -> Result<Timestamp, ContextError>; fn host_consensus_state( &self, height: &Height ) -> Result<Self::AnyConsensusState, ContextError>; fn client_counter(&self) -> Result<u64, ContextError>; fn connection_end( &self, conn_id: &ConnectionId ) -> Result<ConnectionEnd, ContextError>; fn validate_self_client( &self, client_state_of_host_on_counterparty: Any ) -> Result<(), ContextError>; fn commitment_prefix(&self) -> CommitmentPrefix; fn connection_counter(&self) -> Result<u64, ContextError>; fn channel_end( &self, channel_end_path: &ChannelEndPath ) -> Result<ChannelEnd, ContextError>; fn get_next_sequence_send( &self, seq_send_path: &SeqSendPath ) -> Result<Sequence, ContextError>; fn get_next_sequence_recv( &self, seq_recv_path: &SeqRecvPath ) -> Result<Sequence, ContextError>; fn get_next_sequence_ack( &self, seq_ack_path: &SeqAckPath ) -> Result<Sequence, ContextError>; fn get_packet_commitment( &self, commitment_path: &CommitmentPath ) -> Result<PacketCommitment, ContextError>; fn get_packet_receipt( &self, receipt_path: &ReceiptPath ) -> Result<Receipt, ContextError>; fn get_packet_acknowledgement( &self, ack_path: &AckPath ) -> Result<AcknowledgementCommitment, ContextError>; fn channel_counter(&self) -> Result<u64, ContextError>; fn max_expected_time_per_block(&self) -> Duration; fn validate_message_signer( &self, signer: &Signer ) -> Result<(), ContextError>; // Provided methods fn get_compatible_versions(&self) -> Vec<Version> { ... } fn pick_version( &self, counterparty_candidate_versions: &[Version] ) -> Result<Version, ContextError> { ... } fn block_delay(&self, delay_period_time: &Duration) -> u64 { ... }
}
Expand description

Context to be implemented by the host that provides all “read-only” methods.

Trait used for the top-level validate entrypoint in the ibc-core crate.

Required Associated Types§

Required Methods§

source

fn get_client_validation_context(&self) -> &Self::V

Retrieve the context that implements all clients’ ValidationContext.

source

fn client_state( &self, client_id: &ClientId ) -> Result<Self::AnyClientState, ContextError>

Returns the ClientState for the given identifier client_id.

Note: Clients have the responsibility to store client states on client creation and update.

source

fn decode_client_state( &self, client_state: Any ) -> Result<Self::AnyClientState, ContextError>

Tries to decode the given client_state into a concrete light client state.

source

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

Retrieve the consensus state for the given client ID at the specified height.

Returns an error if no such state exists.

Note: Clients have the responsibility to store consensus states on client creation and update.

source

fn host_height(&self) -> Result<Height, ContextError>

Returns the current height of the local chain.

source

fn host_timestamp(&self) -> Result<Timestamp, ContextError>

Returns the current timestamp of the local chain.

source

fn host_consensus_state( &self, height: &Height ) -> Result<Self::AnyConsensusState, ContextError>

Returns the ConsensusState of the host (local) chain at a specific height.

source

fn client_counter(&self) -> Result<u64, ContextError>

Returns a natural number, counting how many clients have been created thus far. The value of this counter should increase only via method ExecutionContext::increase_client_counter.

source

fn connection_end( &self, conn_id: &ConnectionId ) -> Result<ConnectionEnd, ContextError>

Returns the ConnectionEnd for the given identifier conn_id.

source

fn validate_self_client( &self, client_state_of_host_on_counterparty: Any ) -> Result<(), ContextError>

Validates the ClientState of the client (a client referring to host) stored on the counterparty chain against the host’s internal state.

For more information on the specific requirements for validating the client state of a host chain, please refer to the ICS24 host requirements

Additionally, implementations specific to individual chains can be found in the ibc-core-hostkit crate.

source

fn commitment_prefix(&self) -> CommitmentPrefix

Returns the prefix that the local chain uses in the KV store.

source

fn connection_counter(&self) -> Result<u64, ContextError>

Returns a counter on how many connections have been created thus far.

source

fn channel_end( &self, channel_end_path: &ChannelEndPath ) -> Result<ChannelEnd, ContextError>

Returns the ChannelEnd for the given port_id and chan_id.

source

fn get_next_sequence_send( &self, seq_send_path: &SeqSendPath ) -> Result<Sequence, ContextError>

Returns the sequence number for the next packet to be sent for the given store path

source

fn get_next_sequence_recv( &self, seq_recv_path: &SeqRecvPath ) -> Result<Sequence, ContextError>

Returns the sequence number for the next packet to be received for the given store path

source

fn get_next_sequence_ack( &self, seq_ack_path: &SeqAckPath ) -> Result<Sequence, ContextError>

Returns the sequence number for the next packet to be acknowledged for the given store path

source

fn get_packet_commitment( &self, commitment_path: &CommitmentPath ) -> Result<PacketCommitment, ContextError>

Returns the packet commitment for the given store path

source

fn get_packet_receipt( &self, receipt_path: &ReceiptPath ) -> Result<Receipt, ContextError>

Returns the packet receipt for the given store path

source

fn get_packet_acknowledgement( &self, ack_path: &AckPath ) -> Result<AcknowledgementCommitment, ContextError>

Returns the packet acknowledgement for the given store path

source

fn channel_counter(&self) -> Result<u64, ContextError>

Returns a counter on the number of channel ids have been created thus far. The value of this counter should increase only via method ExecutionContext::increase_channel_counter.

source

fn max_expected_time_per_block(&self) -> Duration

Returns the maximum expected time per block

source

fn validate_message_signer(&self, signer: &Signer) -> Result<(), ContextError>

Validates the signer field of IBC messages, which represents the address of the user/relayer that signed the given message.

Provided Methods§

source

fn get_compatible_versions(&self) -> Vec<Version>

Function required by ICS-03. Returns the list of all possible versions that the connection handshake protocol supports.

source

fn pick_version( &self, counterparty_candidate_versions: &[Version] ) -> Result<Version, ContextError>

Function required by ICS-03. Returns one version out of the supplied list of versions, which the connection handshake protocol prefers.

source

fn block_delay(&self, delay_period_time: &Duration) -> u64

Calculates the block delay period using the connection’s delay period and the maximum expected time per block.

Object Safety§

This trait is not object safe.

Implementors§