Skip to content

Commit

Permalink
fix method names and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rnbguy committed May 10, 2024
1 parent 47e982f commit 3abc78e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 28 deletions.
28 changes: 16 additions & 12 deletions ibc-testkit/src/relayer/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -347,7 +347,7 @@ where
.client_id()
.clone();

TypedRelayerOps::<A, B>::send_packet_on_a(
TypedRelayerOps::<A, B>::submit_packet_on_b(
&mut self.ctx_a,
&mut self.ctx_b,
packet,
Expand All @@ -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()
Expand Down Expand Up @@ -398,7 +400,7 @@ where
.client_id()
.clone();

TypedRelayerOps::<A, B>::timeout_packet_on_a(
TypedRelayerOps::<A, B>::timeout_packet_from_a(
&mut self.ctx_a,
&mut self.ctx_b,
packet,
Expand All @@ -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()
Expand Down Expand Up @@ -449,7 +453,7 @@ where
.client_id()
.clone();

TypedRelayerOps::<A, B>::timeout_packet_on_channel_close_on_a(
TypedRelayerOps::<A, B>::timeout_packet_from_a_on_channel_close(
&mut self.ctx_a,
&mut self.ctx_b,
packet,
Expand All @@ -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,
Expand Down
24 changes: 12 additions & 12 deletions ibc-testkit/src/relayer/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions ibc-testkit/src/relayer/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<A>,
ctx_b: &mut TestContext<B>,
packet: Packet,
Expand Down Expand Up @@ -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<A>,
ctx_b: &mut TestContext<B>,
packet: Packet,
Expand Down Expand Up @@ -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<A>,
ctx_b: &mut TestContext<B>,
packet: Packet,
Expand Down

0 comments on commit 3abc78e

Please sign in to comment.