Trait ibc::core::ics04_channel::context::ChannelReader
source · pub trait ChannelReader {
Show 23 methods
fn channel_end(
&self,
port_id: &PortId,
channel_id: &ChannelId
) -> Result<ChannelEnd, Error>;
fn connection_end(
&self,
connection_id: &ConnectionId
) -> Result<ConnectionEnd, Error>;
fn connection_channels(
&self,
cid: &ConnectionId
) -> Result<Vec<(PortId, ChannelId)>, Error>;
fn client_state(
&self,
client_id: &ClientId
) -> Result<Box<dyn ClientState>, Error>;
fn client_consensus_state(
&self,
client_id: &ClientId,
height: Height
) -> Result<Box<dyn ConsensusState>, Error>;
fn get_next_sequence_send(
&self,
port_id: &PortId,
channel_id: &ChannelId
) -> Result<Sequence, Error>;
fn get_next_sequence_recv(
&self,
port_id: &PortId,
channel_id: &ChannelId
) -> Result<Sequence, Error>;
fn get_next_sequence_ack(
&self,
port_id: &PortId,
channel_id: &ChannelId
) -> Result<Sequence, Error>;
fn get_packet_commitment(
&self,
port_id: &PortId,
channel_id: &ChannelId,
sequence: Sequence
) -> Result<PacketCommitment, Error>;
fn get_packet_receipt(
&self,
port_id: &PortId,
channel_id: &ChannelId,
sequence: Sequence
) -> Result<Receipt, Error>;
fn get_packet_acknowledgement(
&self,
port_id: &PortId,
channel_id: &ChannelId,
sequence: Sequence
) -> Result<AcknowledgementCommitment, Error>;
fn hash(&self, value: Vec<u8>) -> Vec<u8> ⓘ;
fn host_height(&self) -> Height;
fn host_consensus_state(
&self,
height: Height
) -> Result<Box<dyn ConsensusState>, Error>;
fn pending_host_consensus_state(
&self
) -> Result<Box<dyn ConsensusState>, Error>;
fn client_update_time(
&self,
client_id: &ClientId,
height: Height
) -> Result<Timestamp, Error>;
fn client_update_height(
&self,
client_id: &ClientId,
height: Height
) -> Result<Height, Error>;
fn channel_counter(&self) -> Result<u64, Error>;
fn max_expected_time_per_block(&self) -> Duration;
fn packet_commitment(
&self,
packet_data: Vec<u8>,
timeout_height: TimeoutHeight,
timeout_timestamp: Timestamp
) -> PacketCommitment { ... }
fn ack_commitment(&self, ack: Acknowledgement) -> AcknowledgementCommitment { ... }
fn host_timestamp(&self) -> Timestamp { ... }
fn block_delay(&self, delay_period_time: Duration) -> u64 { ... }
}
Expand description
A context supplying all the necessary read-only dependencies for processing any ChannelMsg
.
Required Methods
sourcefn channel_end(
&self,
port_id: &PortId,
channel_id: &ChannelId
) -> Result<ChannelEnd, Error>
fn channel_end(
&self,
port_id: &PortId,
channel_id: &ChannelId
) -> Result<ChannelEnd, Error>
Returns the ChannelEnd for the given port_id
and chan_id
.
sourcefn connection_end(
&self,
connection_id: &ConnectionId
) -> Result<ConnectionEnd, Error>
fn connection_end(
&self,
connection_id: &ConnectionId
) -> Result<ConnectionEnd, Error>
Returns the ConnectionState for the given identifier connection_id
.
fn connection_channels(
&self,
cid: &ConnectionId
) -> Result<Vec<(PortId, ChannelId)>, Error>
sourcefn client_state(
&self,
client_id: &ClientId
) -> Result<Box<dyn ClientState>, Error>
fn client_state(
&self,
client_id: &ClientId
) -> Result<Box<dyn ClientState>, Error>
Returns the ClientState for the given identifier client_id
. Necessary dependency towards
proof verification.
fn client_consensus_state(
&self,
client_id: &ClientId,
height: Height
) -> Result<Box<dyn ConsensusState>, Error>
fn get_next_sequence_send(
&self,
port_id: &PortId,
channel_id: &ChannelId
) -> Result<Sequence, Error>
fn get_next_sequence_recv(
&self,
port_id: &PortId,
channel_id: &ChannelId
) -> Result<Sequence, Error>
fn get_next_sequence_ack(
&self,
port_id: &PortId,
channel_id: &ChannelId
) -> Result<Sequence, Error>
fn get_packet_commitment(
&self,
port_id: &PortId,
channel_id: &ChannelId,
sequence: Sequence
) -> Result<PacketCommitment, Error>
fn get_packet_receipt(
&self,
port_id: &PortId,
channel_id: &ChannelId,
sequence: Sequence
) -> Result<Receipt, Error>
fn get_packet_acknowledgement(
&self,
port_id: &PortId,
channel_id: &ChannelId,
sequence: Sequence
) -> Result<AcknowledgementCommitment, Error>
sourcefn host_height(&self) -> Height
fn host_height(&self) -> Height
Returns the current height of the local chain.
sourcefn host_consensus_state(
&self,
height: Height
) -> Result<Box<dyn ConsensusState>, Error>
fn host_consensus_state(
&self,
height: Height
) -> Result<Box<dyn ConsensusState>, Error>
Returns the ConsensusState
of the host (local) chain at a specific height.
sourcefn pending_host_consensus_state(&self) -> Result<Box<dyn ConsensusState>, Error>
fn pending_host_consensus_state(&self) -> Result<Box<dyn ConsensusState>, Error>
Returns the pending ConsensusState
of the host (local) chain.
sourcefn client_update_time(
&self,
client_id: &ClientId,
height: Height
) -> Result<Timestamp, Error>
fn client_update_time(
&self,
client_id: &ClientId,
height: Height
) -> Result<Timestamp, Error>
sourcefn client_update_height(
&self,
client_id: &ClientId,
height: Height
) -> Result<Height, Error>
fn client_update_height(
&self,
client_id: &ClientId,
height: Height
) -> Result<Height, Error>
sourcefn channel_counter(&self) -> Result<u64, Error>
fn channel_counter(&self) -> Result<u64, Error>
Returns a counter on the number of channel ids have been created thus far.
The value of this counter should increase only via method
ChannelKeeper::increase_channel_counter
.
sourcefn max_expected_time_per_block(&self) -> Duration
fn max_expected_time_per_block(&self) -> Duration
Returns the maximum expected time per block
Provided Methods
sourcefn packet_commitment(
&self,
packet_data: Vec<u8>,
timeout_height: TimeoutHeight,
timeout_timestamp: Timestamp
) -> PacketCommitment
fn packet_commitment(
&self,
packet_data: Vec<u8>,
timeout_height: TimeoutHeight,
timeout_timestamp: Timestamp
) -> PacketCommitment
Compute the commitment for a packet.
Note that the absence of timeout_height
is treated as
{revision_number: 0, revision_height: 0}
to be consistent with ibc-go,
where this value is used to mean “no timeout height”:
https://github.com/cosmos/ibc-go/blob/04791984b3d6c83f704c4f058e6ca0038d155d91/modules/core/04-channel/keeper/packet.go#L206
fn ack_commitment(&self, ack: Acknowledgement) -> AcknowledgementCommitment
sourcefn host_timestamp(&self) -> Timestamp
fn host_timestamp(&self) -> Timestamp
Returns the current timestamp of the local chain.
sourcefn block_delay(&self, delay_period_time: Duration) -> u64
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.