Trait ibc_relayer::chain::Chain[][src]

pub trait Chain: Sized {
    type LightBlock: Send + Sync;
    type Header: Header;
    type ConsensusState: ConsensusState;
    type ClientState: ClientState;
Show methods fn bootstrap(
        config: ChainConfig,
        rt: Arc<TokioRuntime>
    ) -> Result<Self, Error>;
fn init_light_client(&self) -> Result<Box<dyn LightClient<Self>>, Error>;
fn init_event_monitor(
        &self,
        rt: Arc<TokioRuntime>
    ) -> Result<(EventReceiver, Option<JoinHandle<()>>), Error>;
fn id(&self) -> &ChainId;
fn keybase(&self) -> &KeyRing;
fn keybase_mut(&mut self) -> &mut KeyRing;
fn send_msgs(
        &mut self,
        proto_msgs: Vec<Any>
    ) -> Result<Vec<IbcEvent>, Error>;
fn get_signer(&mut self) -> Result<Signer, Error>;
fn get_key(&mut self) -> Result<KeyEntry, Error>;
fn query_commitment_prefix(&self) -> Result<CommitmentPrefix, Error>;
fn query_latest_height(&self) -> Result<ICSHeight, Error>;
fn query_clients(
        &self,
        request: QueryClientStatesRequest
    ) -> Result<Vec<IdentifiedAnyClientState>, Error>;
fn query_client_state(
        &self,
        client_id: &ClientId,
        height: ICSHeight
    ) -> Result<Self::ClientState, Error>;
fn query_consensus_states(
        &self,
        request: QueryConsensusStatesRequest
    ) -> Result<Vec<AnyConsensusStateWithHeight>, Error>;
fn query_consensus_state(
        &self,
        client_id: ClientId,
        consensus_height: ICSHeight,
        query_height: ICSHeight
    ) -> Result<AnyConsensusState, Error>;
fn query_upgraded_client_state(
        &self,
        height: ICSHeight
    ) -> Result<(Self::ClientState, MerkleProof), Error>;
fn query_upgraded_consensus_state(
        &self,
        height: ICSHeight
    ) -> Result<(Self::ConsensusState, MerkleProof), Error>;
fn query_connections(
        &self,
        request: QueryConnectionsRequest
    ) -> Result<Vec<ConnectionId>, Error>;
fn query_client_connections(
        &self,
        request: QueryClientConnectionsRequest
    ) -> Result<Vec<ConnectionId>, Error>;
fn query_connection(
        &self,
        connection_id: &ConnectionId,
        height: ICSHeight
    ) -> Result<ConnectionEnd, Error>;
fn query_connection_channels(
        &self,
        request: QueryConnectionChannelsRequest
    ) -> Result<Vec<ChannelId>, Error>;
fn query_channels(
        &self,
        request: QueryChannelsRequest
    ) -> Result<Vec<IdentifiedChannelEnd>, Error>;
fn query_channel(
        &self,
        port_id: &PortId,
        channel_id: &ChannelId,
        height: ICSHeight
    ) -> Result<ChannelEnd, Error>;
fn query_packet_commitments(
        &self,
        request: QueryPacketCommitmentsRequest
    ) -> Result<(Vec<PacketState>, ICSHeight), Error>;
fn query_unreceived_packets(
        &self,
        request: QueryUnreceivedPacketsRequest
    ) -> Result<Vec<u64>, Error>;
fn query_packet_acknowledgements(
        &self,
        request: QueryPacketAcknowledgementsRequest
    ) -> Result<(Vec<PacketState>, ICSHeight), Error>;
fn query_unreceived_acknowledgements(
        &self,
        request: QueryUnreceivedAcksRequest
    ) -> Result<Vec<u64>, Error>;
fn query_next_sequence_receive(
        &self,
        request: QueryNextSequenceReceiveRequest
    ) -> Result<Sequence, Error>;
fn query_txs(&self, request: QueryTxRequest) -> Result<Vec<IbcEvent>, Error>;
fn proven_client_state(
        &self,
        client_id: &ClientId,
        height: ICSHeight
    ) -> Result<(Self::ClientState, MerkleProof), Error>;
fn proven_connection(
        &self,
        connection_id: &ConnectionId,
        height: ICSHeight
    ) -> Result<(ConnectionEnd, MerkleProof), Error>;
fn proven_client_consensus(
        &self,
        client_id: &ClientId,
        consensus_height: ICSHeight,
        height: ICSHeight
    ) -> Result<(Self::ConsensusState, MerkleProof), Error>;
fn proven_channel(
        &self,
        port_id: &PortId,
        channel_id: &ChannelId,
        height: ICSHeight
    ) -> Result<(ChannelEnd, MerkleProof), Error>;
fn proven_packet(
        &self,
        packet_type: PacketMsgType,
        port_id: PortId,
        channel_id: ChannelId,
        sequence: Sequence,
        height: ICSHeight
    ) -> Result<(Vec<u8>, MerkleProof), Error>;
fn build_client_state(
        &self,
        height: ICSHeight
    ) -> Result<Self::ClientState, Error>;
fn build_consensus_state(
        &self,
        light_block: Self::LightBlock
    ) -> Result<Self::ConsensusState, Error>;
fn build_header(
        &self,
        trusted_height: ICSHeight,
        trusted_light_block: Self::LightBlock,
        target_light_block: Self::LightBlock
    ) -> Result<Self::Header, Error>; fn query_compatible_versions(&self) -> Result<Vec<Version>, Error> { ... }
fn query_module_version(&self, port_id: &PortId) -> String { ... }
fn build_connection_proofs_and_client_state(
        &self,
        message_type: ConnectionMsgType,
        connection_id: &ConnectionId,
        client_id: &ClientId,
        height: ICSHeight
    ) -> Result<(Option<Self::ClientState>, Proofs), Error> { ... }
fn build_channel_proofs(
        &self,
        port_id: &PortId,
        channel_id: &ChannelId,
        height: ICSHeight
    ) -> Result<Proofs, Error> { ... }
fn build_packet_proofs(
        &self,
        packet_type: PacketMsgType,
        port_id: PortId,
        channel_id: ChannelId,
        sequence: Sequence,
        height: ICSHeight
    ) -> Result<(Vec<u8>, Proofs), Error> { ... }
}
Expand description

Defines a blockchain as understood by the relayer

Associated Types

type LightBlock: Send + Sync[src]

Type of light blocks for this chain

type Header: Header[src]

Type of headers for this chain

type ConsensusState: ConsensusState[src]

Type of consensus state for this chain

type ClientState: ClientState[src]

Type of the client state for this chain

Required methods

fn bootstrap(config: ChainConfig, rt: Arc<TokioRuntime>) -> Result<Self, Error>[src]

Constructs the chain

fn init_light_client(&self) -> Result<Box<dyn LightClient<Self>>, Error>[src]

Initializes and returns the light client (if any) associated with this chain.

fn init_event_monitor(
    &self,
    rt: Arc<TokioRuntime>
) -> Result<(EventReceiver, Option<JoinHandle<()>>), Error>
[src]

Initializes and returns the event monitor (if any) associated with this chain.

fn id(&self) -> &ChainId[src]

Returns the chain’s identifier

fn keybase(&self) -> &KeyRing[src]

Returns the chain’s keybase

fn keybase_mut(&mut self) -> &mut KeyRing[src]

Returns the chain’s keybase, mutably

fn send_msgs(&mut self, proto_msgs: Vec<Any>) -> Result<Vec<IbcEvent>, Error>[src]

Sends one or more transactions with msgs to chain.

fn get_signer(&mut self) -> Result<Signer, Error>[src]

fn get_key(&mut self) -> Result<KeyEntry, Error>[src]

fn query_commitment_prefix(&self) -> Result<CommitmentPrefix, Error>[src]

fn query_latest_height(&self) -> Result<ICSHeight, Error>[src]

Query the latest height the chain is at

fn query_clients(
    &self,
    request: QueryClientStatesRequest
) -> Result<Vec<IdentifiedAnyClientState>, Error>
[src]

Performs a query to retrieve the state of all clients that a chain hosts.

fn query_client_state(
    &self,
    client_id: &ClientId,
    height: ICSHeight
) -> Result<Self::ClientState, Error>
[src]

fn query_consensus_states(
    &self,
    request: QueryConsensusStatesRequest
) -> Result<Vec<AnyConsensusStateWithHeight>, Error>
[src]

fn query_consensus_state(
    &self,
    client_id: ClientId,
    consensus_height: ICSHeight,
    query_height: ICSHeight
) -> Result<AnyConsensusState, Error>
[src]

Performs a query to retrieve the consensus state (for a specific height consensus_height) that an on-chain client stores.

fn query_upgraded_client_state(
    &self,
    height: ICSHeight
) -> Result<(Self::ClientState, MerkleProof), Error>
[src]

fn query_upgraded_consensus_state(
    &self,
    height: ICSHeight
) -> Result<(Self::ConsensusState, MerkleProof), Error>
[src]

fn query_connections(
    &self,
    request: QueryConnectionsRequest
) -> Result<Vec<ConnectionId>, Error>
[src]

Performs a query to retrieve the identifiers of all connections.

fn query_client_connections(
    &self,
    request: QueryClientConnectionsRequest
) -> Result<Vec<ConnectionId>, Error>
[src]

Performs a query to retrieve the identifiers of all connections.

fn query_connection(
    &self,
    connection_id: &ConnectionId,
    height: ICSHeight
) -> Result<ConnectionEnd, Error>
[src]

fn query_connection_channels(
    &self,
    request: QueryConnectionChannelsRequest
) -> Result<Vec<ChannelId>, Error>
[src]

Performs a query to retrieve the identifiers of all channels associated with a connection.

fn query_channels(
    &self,
    request: QueryChannelsRequest
) -> Result<Vec<IdentifiedChannelEnd>, Error>
[src]

Performs a query to retrieve the identifiers of all channels.

fn query_channel(
    &self,
    port_id: &PortId,
    channel_id: &ChannelId,
    height: ICSHeight
) -> Result<ChannelEnd, Error>
[src]

fn query_packet_commitments(
    &self,
    request: QueryPacketCommitmentsRequest
) -> Result<(Vec<PacketState>, ICSHeight), Error>
[src]

fn query_unreceived_packets(
    &self,
    request: QueryUnreceivedPacketsRequest
) -> Result<Vec<u64>, Error>
[src]

fn query_packet_acknowledgements(
    &self,
    request: QueryPacketAcknowledgementsRequest
) -> Result<(Vec<PacketState>, ICSHeight), Error>
[src]

fn query_unreceived_acknowledgements(
    &self,
    request: QueryUnreceivedAcksRequest
) -> Result<Vec<u64>, Error>
[src]

fn query_next_sequence_receive(
    &self,
    request: QueryNextSequenceReceiveRequest
) -> Result<Sequence, Error>
[src]

fn query_txs(&self, request: QueryTxRequest) -> Result<Vec<IbcEvent>, Error>[src]

fn proven_client_state(
    &self,
    client_id: &ClientId,
    height: ICSHeight
) -> Result<(Self::ClientState, MerkleProof), Error>
[src]

fn proven_connection(
    &self,
    connection_id: &ConnectionId,
    height: ICSHeight
) -> Result<(ConnectionEnd, MerkleProof), Error>
[src]

fn proven_client_consensus(
    &self,
    client_id: &ClientId,
    consensus_height: ICSHeight,
    height: ICSHeight
) -> Result<(Self::ConsensusState, MerkleProof), Error>
[src]

fn proven_channel(
    &self,
    port_id: &PortId,
    channel_id: &ChannelId,
    height: ICSHeight
) -> Result<(ChannelEnd, MerkleProof), Error>
[src]

fn proven_packet(
    &self,
    packet_type: PacketMsgType,
    port_id: PortId,
    channel_id: ChannelId,
    sequence: Sequence,
    height: ICSHeight
) -> Result<(Vec<u8>, MerkleProof), Error>
[src]

fn build_client_state(
    &self,
    height: ICSHeight
) -> Result<Self::ClientState, Error>
[src]

fn build_consensus_state(
    &self,
    light_block: Self::LightBlock
) -> Result<Self::ConsensusState, Error>
[src]

fn build_header(
    &self,
    trusted_height: ICSHeight,
    trusted_light_block: Self::LightBlock,
    target_light_block: Self::LightBlock
) -> Result<Self::Header, Error>
[src]

Provided methods

fn query_compatible_versions(&self) -> Result<Vec<Version>, Error>[src]

fn query_module_version(&self, port_id: &PortId) -> String[src]

fn build_connection_proofs_and_client_state(
    &self,
    message_type: ConnectionMsgType,
    connection_id: &ConnectionId,
    client_id: &ClientId,
    height: ICSHeight
) -> Result<(Option<Self::ClientState>, Proofs), Error>
[src]

Builds the required proofs and the client state for connection handshake messages. The proofs and client state must be obtained from queries at same height.

fn build_channel_proofs(
    &self,
    port_id: &PortId,
    channel_id: &ChannelId,
    height: ICSHeight
) -> Result<Proofs, Error>
[src]

Builds the proof for channel handshake messages.

fn build_packet_proofs(
    &self,
    packet_type: PacketMsgType,
    port_id: PortId,
    channel_id: ChannelId,
    sequence: Sequence,
    height: ICSHeight
) -> Result<(Vec<u8>, Proofs), Error>
[src]

Builds the proof for packet messages.

Implementors

impl Chain for CosmosSdkChain[src]

fn send_msgs(&mut self, proto_msgs: Vec<Any>) -> Result<Vec<IbcEvent>, Error>[src]

Send one or more transactions that include all the specified messages

fn get_signer(&mut self) -> Result<Signer, Error>[src]

Get the account for the signer

fn get_key(&mut self) -> Result<KeyEntry, Error>[src]

Get the signing key

fn query_latest_height(&self) -> Result<ICSHeight, Error>[src]

Query the latest height the chain is at via a RPC query

fn query_consensus_states(
    &self,
    request: QueryConsensusStatesRequest
) -> Result<Vec<AnyConsensusStateWithHeight>, Error>
[src]

Performs a query to retrieve the identifiers of all connections.

fn query_packet_commitments(
    &self,
    request: QueryPacketCommitmentsRequest
) -> Result<(Vec<PacketState>, ICSHeight), Error>
[src]

Queries the packet commitment hashes associated with a channel.

fn query_unreceived_packets(
    &self,
    request: QueryUnreceivedPacketsRequest
) -> Result<Vec<u64>, Error>
[src]

Queries the unreceived packet sequences associated with a channel.

fn query_packet_acknowledgements(
    &self,
    request: QueryPacketAcknowledgementsRequest
) -> Result<(Vec<PacketState>, ICSHeight), Error>
[src]

Queries the packet acknowledgment hashes associated with a channel.

fn query_unreceived_acknowledgements(
    &self,
    request: QueryUnreceivedAcksRequest
) -> Result<Vec<u64>, Error>
[src]

Queries the unreceived acknowledgements sequences associated with a channel.

fn query_txs(&self, request: QueryTxRequest) -> Result<Vec<IbcEvent>, Error>[src]

This function queries transactions for events matching certain criteria.

  1. Client Update request - returns a vector with at most one update client event
  2. Packet event request - returns at most one packet event for each sequence specified in the request. Note - there is no way to format the packet query such that it asks for Tx-es with either sequence (the query conditions can only be AND-ed). There is a possibility to include “<=” and “>=” conditions but it doesn’t work with string attributes (sequence is emmitted as a string). Therefore, for packets we perform one tx_search for each sequence. Alternatively, a single query for all packets could be performed but it would return all packets ever sent.

type LightBlock = TMLightBlock

type Header = TmHeader

type ConsensusState = TMConsensusState

type ClientState = ClientState

fn bootstrap(config: ChainConfig, rt: Arc<TokioRuntime>) -> Result<Self, Error>[src]

fn init_light_client(&self) -> Result<Box<dyn LightClient<Self>>, Error>[src]

fn init_event_monitor(
    &self,
    rt: Arc<TokioRuntime>
) -> Result<(EventReceiver, Option<JoinHandle<()>>), Error>
[src]

fn id(&self) -> &ChainId[src]

fn keybase(&self) -> &KeyRing[src]

fn keybase_mut(&mut self) -> &mut KeyRing[src]

fn query_commitment_prefix(&self) -> Result<CommitmentPrefix, Error>[src]

fn query_clients(
    &self,
    request: QueryClientStatesRequest
) -> Result<Vec<IdentifiedAnyClientState>, Error>
[src]

fn query_client_state(
    &self,
    client_id: &ClientId,
    height: ICSHeight
) -> Result<Self::ClientState, Error>
[src]

fn query_upgraded_client_state(
    &self,
    height: ICSHeight
) -> Result<(Self::ClientState, MerkleProof), Error>
[src]

fn query_upgraded_consensus_state(
    &self,
    height: ICSHeight
) -> Result<(Self::ConsensusState, MerkleProof), Error>
[src]

fn query_consensus_state(
    &self,
    client_id: ClientId,
    consensus_height: ICSHeight,
    query_height: ICSHeight
) -> Result<AnyConsensusState, Error>
[src]

fn query_client_connections(
    &self,
    request: QueryClientConnectionsRequest
) -> Result<Vec<ConnectionId>, Error>
[src]

fn query_connections(
    &self,
    request: QueryConnectionsRequest
) -> Result<Vec<ConnectionId>, Error>
[src]

fn query_connection(
    &self,
    connection_id: &ConnectionId,
    height: ICSHeight
) -> Result<ConnectionEnd, Error>
[src]

fn query_connection_channels(
    &self,
    request: QueryConnectionChannelsRequest
) -> Result<Vec<ChannelId>, Error>
[src]

fn query_channels(
    &self,
    request: QueryChannelsRequest
) -> Result<Vec<IdentifiedChannelEnd>, Error>
[src]

fn query_channel(
    &self,
    port_id: &PortId,
    channel_id: &ChannelId,
    height: ICSHeight
) -> Result<ChannelEnd, Error>
[src]

fn query_next_sequence_receive(
    &self,
    request: QueryNextSequenceReceiveRequest
) -> Result<Sequence, Error>
[src]

fn proven_client_state(
    &self,
    client_id: &ClientId,
    height: ICSHeight
) -> Result<(Self::ClientState, MerkleProof), Error>
[src]

fn proven_client_consensus(
    &self,
    client_id: &ClientId,
    consensus_height: ICSHeight,
    height: ICSHeight
) -> Result<(Self::ConsensusState, MerkleProof), Error>
[src]

fn proven_connection(
    &self,
    connection_id: &ConnectionId,
    height: ICSHeight
) -> Result<(ConnectionEnd, MerkleProof), Error>
[src]

fn proven_channel(
    &self,
    port_id: &PortId,
    channel_id: &ChannelId,
    height: ICSHeight
) -> Result<(ChannelEnd, MerkleProof), Error>
[src]

fn proven_packet(
    &self,
    packet_type: PacketMsgType,
    port_id: PortId,
    channel_id: ChannelId,
    sequence: Sequence,
    height: ICSHeight
) -> Result<(Vec<u8>, MerkleProof), Error>
[src]

fn build_client_state(
    &self,
    height: ICSHeight
) -> Result<Self::ClientState, Error>
[src]

fn build_consensus_state(
    &self,
    light_block: Self::LightBlock
) -> Result<Self::ConsensusState, Error>
[src]

fn build_header(
    &self,
    trusted_height: ICSHeight,
    trusted_light_block: Self::LightBlock,
    target_light_block: Self::LightBlock
) -> Result<Self::Header, Error>
[src]