Skip to content

Commit

Permalink
Simplify bootstrap function arguments with default-able options (#2078)
Browse files Browse the repository at this point in the history
* Refactor bootstrap chain and foreign client code

* Introduce BootstrapChannel/ConnectionOptions

* Use builder pattern for bootstrap option types
  • Loading branch information
soareschen committed Apr 22, 2022
1 parent 7fa70a0 commit dffe1cb
Show file tree
Hide file tree
Showing 10 changed files with 235 additions and 278 deletions.
28 changes: 12 additions & 16 deletions tools/integration-test/src/tests/client_expiration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ use std::thread::sleep;

use ibc::core::ics03_connection::connection::State as ConnectionState;
use ibc::core::ics04_channel::channel::State as ChannelState;
use ibc::core::ics04_channel::Version as ChannelVersion;
use ibc_relayer::config::default::connection_delay as default_connection_delay;
use ibc_relayer::config::{self, Config, ModeConfig};

use ibc_test_framework::bootstrap::binary::chain::ForeignClientBuilder;
use ibc_test_framework::bootstrap::binary::chain::bootstrap_foreign_client_pair;
use ibc_test_framework::bootstrap::binary::channel::{
bootstrap_channel_with_chains, bootstrap_channel_with_connection,
};
Expand Down Expand Up @@ -140,7 +138,7 @@ impl BinaryChainTest for ChannelExpirationTest {
let connection = {
let _refresh_tasks = spawn_refresh_client_tasks(&chains.foreign_clients)?;

bootstrap_connection(&chains.foreign_clients, default_connection_delay(), false)?
bootstrap_connection(&chains.foreign_clients, Default::default())?
};

wait_for_client_expiry();
Expand Down Expand Up @@ -214,9 +212,11 @@ impl BinaryChainTest for ChannelExpirationTest {
"Trying to create new channel and worker after previous connection worker failed"
);

let foreign_clients_2 = ForeignClientBuilder::new(&chains.handle_a, &chains.handle_b)
.pair()
.bootstrap()?;
let foreign_clients_2 = bootstrap_foreign_client_pair(
&chains.handle_a,
&chains.handle_b,
Default::default(),
)?;

// Need to spawn refresh client for new clients to make sure they don't expire

Expand Down Expand Up @@ -282,10 +282,8 @@ impl BinaryChainTest for PacketExpirationTest {
&chains,
&PortId::transfer(),
&PortId::transfer(),
Order::Unordered,
ChannelVersion::ics20(),
default_connection_delay(),
false,
Default::default(),
Default::default(),
)?
};

Expand Down Expand Up @@ -367,14 +365,14 @@ impl BinaryChainTest for CreateOnExpiredClientTest {
let connection = {
let _refresh_tasks = spawn_refresh_client_tasks(&chains.foreign_clients)?;

bootstrap_connection(&chains.foreign_clients, default_connection_delay(), false)?
bootstrap_connection(&chains.foreign_clients, Default::default())?
};

wait_for_client_expiry();

info!("trying to bootstrap connection after IBC client is expired");

let res = bootstrap_connection(&chains.foreign_clients, default_connection_delay(), false);
let res = bootstrap_connection(&chains.foreign_clients, Default::default());

match res {
Ok(_) => {
Expand All @@ -397,9 +395,7 @@ impl BinaryChainTest for CreateOnExpiredClientTest {
connection,
&DualTagged::new(&PortId::transfer()),
&DualTagged::new(&PortId::transfer()),
Order::Unordered,
ChannelVersion::ics20(),
false,
Default::default(),
);

match res {
Expand Down
Loading

0 comments on commit dffe1cb

Please sign in to comment.