Trait ValidationContext

Source
pub trait ValidationContext {
    type V: ClientValidationContext;
    type HostClientState: ClientStateValidation<Self::V>;
    type HostConsensusState: ConsensusState;

Show 22 methods // Required methods fn get_client_validation_context(&self) -> &Self::V; fn host_height(&self) -> Result<Height, HostError>; fn host_timestamp(&self) -> Result<Timestamp, HostError>; fn host_consensus_state( &self, height: &Height, ) -> Result<Self::HostConsensusState, HostError>; fn client_counter(&self) -> Result<u64, HostError>; fn connection_end( &self, conn_id: &ConnectionId, ) -> Result<ConnectionEnd, HostError>; fn validate_self_client( &self, client_state_of_host_on_counterparty: Self::HostClientState, ) -> Result<(), HostError>; fn commitment_prefix(&self) -> CommitmentPrefix; fn connection_counter(&self) -> Result<u64, HostError>; fn channel_end( &self, channel_end_path: &ChannelEndPath, ) -> Result<ChannelEnd, HostError>; fn get_next_sequence_send( &self, seq_send_path: &SeqSendPath, ) -> Result<Sequence, HostError>; fn get_next_sequence_recv( &self, seq_recv_path: &SeqRecvPath, ) -> Result<Sequence, HostError>; fn get_next_sequence_ack( &self, seq_ack_path: &SeqAckPath, ) -> Result<Sequence, HostError>; fn get_packet_commitment( &self, commitment_path: &CommitmentPath, ) -> Result<PacketCommitment, HostError>; fn get_packet_receipt( &self, receipt_path: &ReceiptPath, ) -> Result<Receipt, HostError>; fn get_packet_acknowledgement( &self, ack_path: &AckPath, ) -> Result<AcknowledgementCommitment, HostError>; fn channel_counter(&self) -> Result<u64, HostError>; fn max_expected_time_per_block(&self) -> Duration; fn validate_message_signer(&self, signer: &Signer) -> Result<(), HostError>; // Provided methods fn get_compatible_versions(&self) -> Vec<Version> { ... } fn pick_version( &self, counterparty_candidate_versions: &[Version], ) -> Result<Version, HostError> { ... } 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§

Source

type V: ClientValidationContext

Source

type HostClientState: ClientStateValidation<Self::V>

The client state type for the host chain.

Source

type HostConsensusState: ConsensusState

The consensus state type for the host chain.

Required Methods§

Source

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

Retrieve the context that implements all clients’ ValidationContext.

Source

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

Returns the current height of the local chain.

Source

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

Returns the current timestamp of the local chain.

Source

fn host_consensus_state( &self, height: &Height, ) -> Result<Self::HostConsensusState, HostError>

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

Source

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

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, HostError>

Returns the ConnectionEnd for the given identifier conn_id.

Source

fn validate_self_client( &self, client_state_of_host_on_counterparty: Self::HostClientState, ) -> Result<(), HostError>

Validates the ClientState of the host chain 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/ics24-host module.

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, HostError>

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

Source

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

Returns the ChannelEnd for the given port_id and chan_id.

Source

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

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, HostError>

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, HostError>

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, HostError>

Returns the packet commitment for the given store path

Source

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

Returns the packet receipt for the given store path. This receipt is used to acknowledge the successful processing of a received packet, and must not be pruned.

If the receipt is present in the host’s state, return Receipt::Ok, indicating the packet has already been processed. If the receipt is absent, return Receipt::None, indicating the packet has not been received.

Source

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

Returns the packet acknowledgement for the given store path

Source

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

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<(), HostError>

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, HostError>

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.

Implementors§