Skip to content

Commit

Permalink
Minor touch up
Browse files Browse the repository at this point in the history
  • Loading branch information
soareschen committed Jul 10, 2023
1 parent d0f3fec commit 6d3db18
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub trait HasInitChannelOptionsType<Counterparty>: HasIbcChainTypes<Counterparty

/**
Payload that contains necessary counterparty information such as proofs and parameters
in order for a self chain to build a connection handshake message.
in order for a self chain to build a channel handshake message.
*/
pub trait HasChannelHandshakePayloads<Counterparty>: HasIbcChainTypes<Counterparty> {
type ChannelOpenTryPayload: Async;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use crate::std_prelude::*;
This implements the `ChanOpenAck` step of the IBC channel handshake protocol.
Note that this implementation does not check that the connection exists on
Note that this implementation does not check that the channel exists on
the destination chain. It also doesn't check that the channel end at the
destination chain is really in the `OPEN_TRY` state. This will be implemented
as a separate wrapper component. (TODO)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use crate::std_prelude::*;
This implements the `ChanOpenConfirm` step of the IBC channel handshake protocol.
Note that this implementation does not check that the connection exists on
Note that this implementation does not check that the channel exists on
the destination chain, that a channel exists on the source chain, and that the
channel end at the source chain is really in the `OPEN` state. This will be implemented
as a separate wrapper component. (TODO)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::relay::traits::channel::open_try::CanRelayChannelOpenTry;
use crate::std_prelude::*;

/**
Relays a connection open handshake using a channel ID that has been
Relays a channel open handshake using a channel ID that has been
initialized at the source chain, and the port IDs used.
Specifically, the `ChanOpenTry`, `ChanOpenAck`, and `ChanOpenConfirm` steps of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub trait InjectMissingChannelTryEventError: HasRelayChains {
This implements the `ChanOpenTry` step of the IBC channel handshake protocol.
Note that this implementation does not check that the connection exists on
Note that this implementation does not check that the channel exists on
the destination chain. It also doesn't check that the channel end at the
source chain is really in the `OPEN_INIT` state. This will be implemented as
a separate wrapper component. (TODO)
Expand Down
38 changes: 23 additions & 15 deletions tools/integration-test/src/tests/next/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,25 @@ use ibc_relayer_components::relay::impls::channel::bootstrap::CanBootstrapChanne
use ibc_relayer_components::relay::impls::connection::bootstrap::CanBootstrapConnection;
use ibc_relayer_components::relay::traits::two_way::HasTwoWayRelay;
use ibc_relayer_cosmos::types::channel::CosmosInitChannelOptions;
use ibc_relayer_cosmos::types::error::Error as CosmosError;
use ibc_test_framework::prelude::*;

use crate::tests::next::context::new_cosmos_builder;

#[test]
fn test_connection_handshake_next() -> Result<(), Error> {
run_binary_chain_test(&ConnectionHandshakeTest)
fn test_connection_and_channel_handshake_next() -> Result<(), Error> {
run_binary_chain_test(&ConnectionAndChannelHandshakeTest)
}

pub struct ConnectionHandshakeTest;
pub struct ConnectionAndChannelHandshakeTest;

impl TestOverrides for ConnectionHandshakeTest {
impl TestOverrides for ConnectionAndChannelHandshakeTest {
fn should_spawn_supervisor(&self) -> bool {
false
}
}

impl BinaryChainTest for ConnectionHandshakeTest {
impl BinaryChainTest for ConnectionAndChannelHandshakeTest {
fn run<ChainA: ChainHandle, ChainB: ChainHandle>(
&self,
_config: &TestConfig,
Expand All @@ -47,39 +48,46 @@ impl BinaryChainTest for ConnectionHandshakeTest {
trusting_period: None,
});

let (connection_id_a, connection_id_b) = runtime
runtime
.block_on(async move {
let birelay = builder
.bootstrap_birelay(&chain_id_a, &chain_id_b, &client_settings, &client_settings)
.await?;

let (src_connection_id, _dst_connection_id) = birelay
let (connection_id_a, connection_id_b) = birelay
.relay_a_to_b()
.bootstrap_connection(&Default::default())
.await?;

info!(
"bootstrapped new IBC connections with ID {} and {}",
connection_id_a, connection_id_b
);

let channel_init_options = CosmosInitChannelOptions {
ordering: Ordering::Unordered,
connection_hops: vec![src_connection_id],
connection_hops: vec![connection_id_a],
channel_version: Version::ics20(),
};

birelay
let (channel_id_a, channel_id_b) = birelay
.relay_a_to_b()
.bootstrap_channel(
&PortId::transfer(),
&PortId::transfer(),
&channel_init_options,
)
.await
.await?;

info!(
"bootstrapped new IBC channel with ID {} and {}",
channel_id_a, channel_id_b
);

<Result<(), CosmosError>>::Ok(())
})
.unwrap();

info!(
"bootstrapped new IBC connections with ID {} and {}",
connection_id_a, connection_id_b
);

Ok(())
}
}

0 comments on commit 6d3db18

Please sign in to comment.