Struct TypedRelayerOps

Source
pub struct TypedRelayerOps<A, B>(/* private fields */)
where
    A: TestHost,
    B: TestHost,
    HostClientState<A>: ClientStateValidation<DefaultIbcStore>,
    HostClientState<B>: ClientStateValidation<DefaultIbcStore>;
Expand description

Implements IBC relayer functions for a pair of TestHost implementations: A and B. Note that, all the implementations are in one direction: from A to B. This ensures that the variable namings are consistent with the IBC message fields, leading to a less error-prone implementation.

For the functions in the opposite direction, use TypedRelayerOps::<B, A> instead of TypedRelayerOps::<A, B>`.

Implementations§

Source§

impl<A, B> TypedRelayerOps<A, B>

Source

pub fn create_client_on_a( ctx_a: &mut TestContext<A>, ctx_b: &TestContext<B>, signer: Signer, ) -> ClientId

Creates a client on A with the state of B. Returns the client identifier on A.

Source

pub fn sync_clock_on_a(ctx_a: &mut TestContext<A>, ctx_b: &TestContext<B>)

Advances the block height on A until it catches up with the latest timestamp on B.

Source

pub fn update_client_on_a( ctx_a: &mut TestContext<A>, ctx_b: &TestContext<B>, client_id_on_a: ClientId, signer: Signer, )

Updates the client on A with the latest header from B.

Source

pub fn update_client_on_a_with_sync( ctx_a: &mut TestContext<A>, ctx_b: &mut TestContext<B>, client_id_on_a: ClientId, signer: Signer, )

Updates the client on A with the latest header from B after syncing the timestamps.

Timestamp sync is required, as IBC doesn’t allow client updates from the future beyond max clock drift.

Source

pub fn connection_open_init_on_a( ctx_a: &mut TestContext<A>, ctx_b: &TestContext<B>, client_id_on_a: ClientId, client_id_on_b: ClientId, signer: Signer, ) -> ConnectionId

A initiates a connection with the other end on B. Returns the connection identifier on A.

Source

pub fn connection_open_try_on_b( ctx_b: &mut TestContext<B>, ctx_a: &TestContext<A>, conn_id_on_a: ConnectionId, client_id_on_a: ClientId, client_id_on_b: ClientId, signer: Signer, ) -> ConnectionId

B receives the connection opening attempt by A after A initiates the connection. Returns the connection identifier on B.

Source

pub fn connection_open_ack_on_a( ctx_a: &mut TestContext<A>, ctx_b: &TestContext<B>, conn_id_on_a: ConnectionId, conn_id_on_b: ConnectionId, client_id_on_b: ClientId, signer: Signer, )

A receives B’s acknowledgement that B received the connection opening attempt by A. A starts processing the connection on its side.

Source

pub fn connection_open_confirm_on_b( ctx_b: &mut TestContext<B>, ctx_a: &TestContext<A>, conn_id_on_a: ConnectionId, conn_id_on_b: ConnectionId, signer: Signer, )

B receives the confirmation from A that the connection creation was successful. B also starts processing the connection on its side.

Source

pub fn create_connection_on_a( ctx_a: &mut TestContext<A>, ctx_b: &mut TestContext<B>, client_id_on_a: ClientId, client_id_on_b: ClientId, signer: Signer, ) -> (ConnectionId, ConnectionId)

A connection is created by A towards B using the IBC connection handshake protocol. Returns the connection identifiers of A and B.

Source

pub fn channel_open_init_on_a( ctx_a: &mut TestContext<A>, conn_id_on_a: ConnectionId, port_id_on_a: PortId, port_id_on_b: PortId, signer: Signer, ) -> ChannelId

A initiates a channel with port identifier with the other end on B. Returns the channel identifier of A.

Source

pub fn channel_open_try_on_b( ctx_b: &mut TestContext<B>, ctx_a: &TestContext<A>, conn_id_on_b: ConnectionId, chan_id_on_a: ChannelId, port_id_on_a: PortId, signer: Signer, ) -> ChannelId

B receives the channel opening attempt by A after A initiates the channel. Returns the channel identifier of B.

Source

pub fn channel_open_ack_on_a( ctx_a: &mut TestContext<A>, ctx_b: &TestContext<B>, chan_id_on_a: ChannelId, port_id_on_a: PortId, chan_id_on_b: ChannelId, port_id_on_b: PortId, signer: Signer, )

A receives B’s acknowledgement that B received the channel opening attempt by A. A starts processing the channel on its side.

Source

pub fn channel_open_confirm_on_b( ctx_b: &mut TestContext<B>, ctx_a: &TestContext<A>, chan_id_on_a: ChannelId, chan_id_on_b: ChannelId, port_id_on_b: PortId, signer: Signer, )

B receives the confirmation from A that the channel creation was successful. B also starts processing the channel on its side.

Source

pub fn channel_close_init_on_a( ctx_a: &mut TestContext<A>, chan_id_on_a: ChannelId, port_id_on_a: PortId, signer: Signer, )

A initiates the channel closing, with the other end on B. A stops processing the channel.

Source

pub fn channel_close_confirm_on_b( ctx_b: &mut TestContext<B>, ctx_a: &TestContext<A>, chan_id_on_b: ChannelId, port_id_on_b: PortId, signer: Signer, )

B receives the channel closing attempt by A after A initiates the channel closing. B also stops processing the channel.

Source

pub fn create_channel_on_a( ctx_a: &mut TestContext<A>, ctx_b: &mut TestContext<B>, client_id_on_a: ClientId, conn_id_on_a: ConnectionId, port_id_on_a: PortId, client_id_on_b: ClientId, conn_id_on_b: ConnectionId, port_id_on_b: PortId, signer: Signer, ) -> (ChannelId, ChannelId)

A channel is created by A towards B using the IBC channel handshake protocol. Returns the channel identifiers of A and B.

Source

pub fn close_channel_on_a( ctx_a: &mut TestContext<A>, ctx_b: &mut TestContext<B>, client_id_on_a: ClientId, chan_id_on_a: ChannelId, port_id_on_a: PortId, client_id_on_b: ClientId, chan_id_on_b: ChannelId, port_id_on_b: PortId, signer: Signer, )

A channel is closed by A towards B using the IBC channel handshake protocol.

Source

pub fn packet_recv_on_b( ctx_b: &mut TestContext<B>, ctx_a: &TestContext<A>, packet: Packet, signer: Signer, ) -> Acknowledgement

B receives a packet from an IBC module on A. Returns B’s acknowledgement of receipt.

Source

pub fn packet_ack_on_a( ctx_a: &mut TestContext<A>, ctx_b: &TestContext<B>, packet: Packet, acknowledgement: Acknowledgement, signer: Signer, )

A receives the acknowledgement from B that B received the packet from A.

Source

pub fn packet_timeout_on_a( ctx_a: &mut TestContext<A>, ctx_b: &TestContext<B>, packet: Packet, signer: Signer, )

A receives the timeout packet from B. That is, B has not received the packet from A within the timeout period.

Source

pub fn packet_timeout_on_close_on_a( ctx_a: &mut TestContext<A>, ctx_b: &TestContext<B>, packet: Packet, chan_id_on_b: ChannelId, port_id_on_b: PortId, signer: Signer, )

A receives the timeout packet from B after closing the channel. That is, B has not received the packet from A because the channel is closed.

Source

pub fn submit_packet_on_b( ctx_a: &mut TestContext<A>, ctx_b: &mut TestContext<B>, packet: Packet, client_id_on_a: ClientId, client_id_on_b: ClientId, signer: Signer, )

Sends a packet from an IBC application on A to B using the IBC packet relay protocol.

Source

pub fn timeout_packet_from_a( ctx_a: &mut TestContext<A>, ctx_b: &mut TestContext<B>, packet: Packet, client_id_on_a: ClientId, client_id_on_b: ClientId, signer: Signer, )

Times out a packet from an IBC application on A to B after waiting timeout period.

Source

pub fn timeout_packet_from_a_on_channel_close( ctx_a: &mut TestContext<A>, ctx_b: &mut TestContext<B>, packet: Packet, client_id_on_a: ClientId, client_id_on_b: ClientId, signer: Signer, )

Times out a packet from an IBC application on A to B after closing the channel.

Trait Implementations§

Auto Trait Implementations§

§

impl<A, B> Freeze for TypedRelayerOps<A, B>

§

impl<A, B> RefUnwindSafe for TypedRelayerOps<A, B>

§

impl<A, B> Send for TypedRelayerOps<A, B>
where <B as TestHost>::ClientState: Sized, <A as TestHost>::ClientState: Sized, A: Send, B: Send,

§

impl<A, B> Sync for TypedRelayerOps<A, B>
where <B as TestHost>::ClientState: Sized, <A as TestHost>::ClientState: Sized, A: Sync, B: Sync,

§

impl<A, B> Unpin for TypedRelayerOps<A, B>
where <B as TestHost>::ClientState: Sized, <A as TestHost>::ClientState: Sized, A: Unpin, B: Unpin,

§

impl<A, B> UnwindSafe for TypedRelayerOps<A, B>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<T, Raw> IntoResponse<Raw> for T
where T: Into<Raw>,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<A> Async for A
where A: Send + Sync + 'static,

Source§

impl<T, C> Convertible<C> for T
where T: TryFrom<C> + Into<C>,

Source§

impl<T> JsonSchemaMaybe for T