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>where
A: TestHost,
B: TestHost,
HostClientState<A>: ClientStateValidation<DefaultIbcStore>,
HostClientState<B>: ClientStateValidation<DefaultIbcStore>,
impl<A, B> TypedRelayerOps<A, B>where
A: TestHost,
B: TestHost,
HostClientState<A>: ClientStateValidation<DefaultIbcStore>,
HostClientState<B>: ClientStateValidation<DefaultIbcStore>,
Sourcepub fn create_client_on_a(
ctx_a: &mut TestContext<A>,
ctx_b: &TestContext<B>,
signer: Signer,
) -> ClientId
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
.
Sourcepub fn sync_clock_on_a(ctx_a: &mut TestContext<A>, ctx_b: &TestContext<B>)
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
.
Sourcepub fn update_client_on_a(
ctx_a: &mut TestContext<A>,
ctx_b: &TestContext<B>,
client_id_on_a: ClientId,
signer: Signer,
)
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
.
Sourcepub fn update_client_on_a_with_sync(
ctx_a: &mut TestContext<A>,
ctx_b: &mut TestContext<B>,
client_id_on_a: ClientId,
signer: Signer,
)
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.
Sourcepub 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
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
.
Sourcepub 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
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
.
Sourcepub 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,
)
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.
Sourcepub 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,
)
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.
Sourcepub 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)
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
.
Sourcepub 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
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
.
Sourcepub 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
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
.
Sourcepub 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,
)
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.
Sourcepub 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,
)
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.
Sourcepub fn channel_close_init_on_a(
ctx_a: &mut TestContext<A>,
chan_id_on_a: ChannelId,
port_id_on_a: PortId,
signer: Signer,
)
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.
Sourcepub 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,
)
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.
Sourcepub 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)
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
.
Sourcepub 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,
)
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.
Sourcepub fn packet_recv_on_b(
ctx_b: &mut TestContext<B>,
ctx_a: &TestContext<A>,
packet: Packet,
signer: Signer,
) -> Acknowledgement
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.
Sourcepub fn packet_ack_on_a(
ctx_a: &mut TestContext<A>,
ctx_b: &TestContext<B>,
packet: Packet,
acknowledgement: Acknowledgement,
signer: Signer,
)
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
.
Sourcepub fn packet_timeout_on_a(
ctx_a: &mut TestContext<A>,
ctx_b: &TestContext<B>,
packet: Packet,
signer: Signer,
)
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.
Sourcepub 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,
)
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.
Sourcepub 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,
)
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.
Sourcepub 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,
)
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.
Sourcepub 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,
)
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§
Source§impl<A, B> Debug for TypedRelayerOps<A, B>where
A: TestHost + Debug,
B: TestHost + Debug,
HostClientState<A>: ClientStateValidation<DefaultIbcStore>,
HostClientState<B>: ClientStateValidation<DefaultIbcStore>,
impl<A, B> Debug for TypedRelayerOps<A, B>where
A: TestHost + Debug,
B: TestHost + Debug,
HostClientState<A>: ClientStateValidation<DefaultIbcStore>,
HostClientState<B>: ClientStateValidation<DefaultIbcStore>,
Source§impl<A, B> Default for TypedRelayerOps<A, B>where
A: TestHost + Default,
B: TestHost + Default,
HostClientState<A>: ClientStateValidation<DefaultIbcStore>,
HostClientState<B>: ClientStateValidation<DefaultIbcStore>,
impl<A, B> Default for TypedRelayerOps<A, B>where
A: TestHost + Default,
B: TestHost + Default,
HostClientState<A>: ClientStateValidation<DefaultIbcStore>,
HostClientState<B>: ClientStateValidation<DefaultIbcStore>,
Source§fn default() -> TypedRelayerOps<A, B>
fn default() -> TypedRelayerOps<A, B>
Auto Trait Implementations§
impl<A, B> Freeze for TypedRelayerOps<A, B>
impl<A, B> RefUnwindSafe for TypedRelayerOps<A, B>where
<B as TestHost>::ClientState: Sized,
<A as TestHost>::ClientState: Sized,
A: RefUnwindSafe,
B: RefUnwindSafe,
impl<A, B> Send for TypedRelayerOps<A, B>
impl<A, B> Sync for TypedRelayerOps<A, B>
impl<A, B> Unpin for TypedRelayerOps<A, B>
impl<A, B> UnwindSafe for TypedRelayerOps<A, B>where
<B as TestHost>::ClientState: Sized,
<A as TestHost>::ClientState: Sized,
A: UnwindSafe,
B: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request