diff --git a/ibc-testkit/src/relayer/context.rs b/ibc-testkit/src/relayer/context.rs index b0c37b429a..a969dcb618 100644 --- a/ibc-testkit/src/relayer/context.rs +++ b/ibc-testkit/src/relayer/context.rs @@ -308,7 +308,7 @@ where /// Sends a packet from the first context to the second context. /// The IBC packet is created by an IBC application on the first context. - pub fn send_packet_on_a(&mut self, packet: Packet, signer: Signer) { + pub fn submit_packet_on_b(&mut self, packet: Packet, signer: Signer) { let conn_id_on_a = self .ctx_a .ibc_store() @@ -347,7 +347,7 @@ where .client_id() .clone(); - TypedRelayerOps::::send_packet_on_a( + TypedRelayerOps::::submit_packet_on_b( &mut self.ctx_a, &mut self.ctx_b, packet, @@ -357,9 +357,11 @@ where ) } - /// Timeouts a packet from the first context to the second context. + /// Times out a packet from the first context to the second context by + /// waiting for timeout period and then sending timeout packet on first context. + /// /// The IBC packet is created by an IBC application on the first context. - pub fn timeout_packet_on_a(&mut self, packet: Packet, signer: Signer) { + pub fn timeout_packet_from_a(&mut self, packet: Packet, signer: Signer) { let conn_id_on_a = self .ctx_a .ibc_store() @@ -398,7 +400,7 @@ where .client_id() .clone(); - TypedRelayerOps::::timeout_packet_on_a( + TypedRelayerOps::::timeout_packet_from_a( &mut self.ctx_a, &mut self.ctx_b, packet, @@ -408,9 +410,11 @@ where ) } - /// Timeouts a packet from the second context to the first context, - /// because of the channel is closed. - pub fn timeout_packet_on_channel_close_on_a(&mut self, packet: Packet, signer: Signer) { + /// Timeouts a packet from the first context on the second context by closing the + /// corresponding channel is closed and then sending a timeout packet on the first context. + /// + /// The IBC packet is created by an IBC application on the first context. + pub fn timeout_packet_from_a_on_channel_close(&mut self, packet: Packet, signer: Signer) { let conn_id_on_a = self .ctx_a .ibc_store() @@ -449,7 +453,7 @@ where .client_id() .clone(); - TypedRelayerOps::::timeout_packet_on_channel_close_on_a( + TypedRelayerOps::::timeout_packet_from_a_on_channel_close( &mut self.ctx_a, &mut self.ctx_b, packet, @@ -459,13 +463,13 @@ where ) } - /// Submit a packet via + /// Submit a /// [`DummyTransferModule`](crate::testapp::ibc::applications::transfer::types::DummyTransferModule) - /// on the first context. + /// packet on the first context. /// /// Requires `serde` feature because of [`ibc::apps::transfer::handler::send_transfer`]. #[cfg(feature = "serde")] - pub fn send_packet_via_dummy_transfer_module_on_a( + pub fn send_dummy_transfer_packet_on_a( &mut self, chan_id_on_a: ChannelId, signer: Signer, diff --git a/ibc-testkit/src/relayer/integration.rs b/ibc-testkit/src/relayer/integration.rs index 1c749af40a..145ed50044 100644 --- a/ibc-testkit/src/relayer/integration.rs +++ b/ibc-testkit/src/relayer/integration.rs @@ -93,11 +93,11 @@ where // send packet from A to B // ------------------------ - let packet = relayer - .send_packet_via_dummy_transfer_module_on_a(chan_id_on_a.clone(), signer.clone()); + let packet = + relayer.send_dummy_transfer_packet_on_a(chan_id_on_a.clone(), signer.clone()); - // continue packet relay starting from recv_packet at B - relayer.send_packet_on_a(packet, signer.clone()); + // continue packet relay; submitting recv_packet at B + relayer.submit_packet_on_b(packet, signer.clone()); // retrieve the ack_packet event let Some(IbcEvent::AcknowledgePacket(_)) = relayer @@ -117,11 +117,11 @@ where // timeout packet from A to B // -------------------------- - let packet = relayer - .send_packet_via_dummy_transfer_module_on_a(chan_id_on_a.clone(), signer.clone()); + let packet = + relayer.send_dummy_transfer_packet_on_a(chan_id_on_a.clone(), signer.clone()); - // timeout the packet on A; never relay the packet to B - relayer.timeout_packet_on_a(packet.clone(), signer.clone()); + // timeout the packet on B; by never submitting the packet to B + relayer.timeout_packet_from_a(packet.clone(), signer.clone()); // retrieve the timeout_packet event let Some(IbcEvent::TimeoutPacket(_)) = relayer @@ -141,11 +141,11 @@ where // timeout packet from A to B; using closed channel // ------------------------------------------------ - let packet = relayer - .send_packet_via_dummy_transfer_module_on_a(chan_id_on_a.clone(), signer.clone()); + let packet = + relayer.send_dummy_transfer_packet_on_a(chan_id_on_a.clone(), signer.clone()); - // timeout the packet on A; never relay the packet to B - relayer.timeout_packet_on_channel_close_on_a(packet.clone(), signer.clone()); + // timeout the packet on B; close the corresponding channel + relayer.timeout_packet_from_a_on_channel_close(packet.clone(), signer.clone()); // retrieve the timeout_packet event let Some(IbcEvent::TimeoutPacket(_)) = relayer diff --git a/ibc-testkit/src/relayer/utils.rs b/ibc-testkit/src/relayer/utils.rs index 368f341a48..7987f9ca30 100644 --- a/ibc-testkit/src/relayer/utils.rs +++ b/ibc-testkit/src/relayer/utils.rs @@ -957,7 +957,7 @@ where } /// Sends a packet from an IBC application on `A` to `B` using the IBC packet relay protocol. - pub fn send_packet_on_a( + pub fn submit_packet_on_b( ctx_a: &mut TestContext, ctx_b: &mut TestContext, packet: Packet, @@ -1000,8 +1000,8 @@ where ); } - /// Times out a packet from an IBC application on `A` to `B` using the IBC packet relay protocol. - pub fn timeout_packet_on_a( + /// Times out a packet from an IBC application on `A` to `B` after waiting timeout period. + pub fn timeout_packet_from_a( ctx_a: &mut TestContext, ctx_b: &mut TestContext, packet: Packet, @@ -1042,7 +1042,7 @@ where } /// Times out a packet from an IBC application on `A` to `B` after closing the channel. - pub fn timeout_packet_on_channel_close_on_a( + pub fn timeout_packet_from_a_on_channel_close( ctx_a: &mut TestContext, ctx_b: &mut TestContext, packet: Packet,