Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix integration tests and unit tests #20

Draft
wants to merge 2 commits into
base: astria
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cargo-doc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2023-07-13
toolchain: nightly-2024-09-15
override: true

- name: Build API documentation
Expand Down
4 changes: 3 additions & 1 deletion crates/relayer-cli/src/commands/clear.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ where
mod tests {
use std::str::FromStr;

use abscissa_core::clap::Parser;
use clap::Parser as _;
use ibc_relayer_types::core::{
ics04_channel::packet::Sequence,
ics24_host::identifier::{
Expand All @@ -239,6 +239,8 @@ mod tests {
},
};

use crate::commands::clear::ClearPacketsCmd;

#[test]
fn test_clear_packets_required_only() {
assert_eq!(
Expand Down
3 changes: 1 addition & 2 deletions crates/relayer-cli/src/commands/create/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ pub struct CreateChannelCommand {
#[clap(
long = "order",
value_name = "ORDER",
help = "The channel ordering, valid options 'unordered' (default) and 'ordered'",
default_value_t
help = "The channel ordering, valid options 'unordered' (default) and 'ordered'"
)]
order: Ordering,

Expand Down
7 changes: 0 additions & 7 deletions crates/relayer-cli/src/commands/query/packet/commitment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ use ibc_relayer_types::{
},
Height,
};
use serde::Serialize;
use subtle_encoding::{
Encoding,
Hex,
Expand All @@ -38,12 +37,6 @@ use crate::{
prelude::*,
};

#[derive(Serialize, Debug)]
struct PacketSeqs {
height: Height,
seqs: Vec<u64>,
}

#[derive(Clone, Command, Debug, Parser, PartialEq, Eq)]
pub struct QueryPacketCommitmentCmd {
#[clap(
Expand Down
1 change: 0 additions & 1 deletion crates/relayer-cli/src/commands/tx/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ pub struct TxChanOpenInitCmd {

#[clap(
long = "order",
default_value_t,
value_name = "ORDER",
help = "The channel ordering, valid options 'unordered' (default) and 'ordered'"
)]
Expand Down
2 changes: 0 additions & 2 deletions crates/relayer-cli/tests/acceptance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ use once_cell::sync::Lazy;
pub static RUNNER: Lazy<CmdRunner> = Lazy::new(CmdRunner::default);

/// Use `Config::default()` value if no config or args
#[cfg(not(tarpaulin))]
#[test]
fn start_no_args() {
let mut runner = RUNNER.clone();
Expand All @@ -46,7 +45,6 @@ fn start_no_args() {
cmd.wait().unwrap().expect_success();
}

#[cfg(not(tarpaulin))]
#[test]
fn example_configuration_is_valid() {
let mut runner = RUNNER.clone();
Expand Down
2 changes: 1 addition & 1 deletion crates/relayer/src/chain/cosmos/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub struct CosmosSdkConfig {
pub max_gas: Option<u64>,

// This field is only meant to be set via the `update client` command,
// for when we need to ugprade a client across a genesis restart and
// for when we need to upgrade a client across a genesis restart and
// therefore need and archive node to fetch blocks from.
pub genesis_restart: Option<GenesisRestart>,

Expand Down
10 changes: 3 additions & 7 deletions crates/relayer/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,14 +493,10 @@ mod tests {
};
use ibc_relayer_types::{
clients::ics07_tendermint::header::test_util::get_dummy_ics07_header,
core::{
ics02_client::header::{
decode_header,
AnyHeader,
},
ics04_channel::packet::Sequence,
core::ics02_client::header::{
decode_header,
AnyHeader,
},
timestamp::Timestamp,
};

use super::*;
Expand Down
1 change: 1 addition & 0 deletions tools/integration-test/src/tests/clear_packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ impl TestOverrides for ClearPacketOverrideTest {
match chain_config {
// Use a small clear interval in the chain configurations to override the global high interval
ChainConfig::CosmosSdk(chain_config) => chain_config.clear_interval = Some(10),
ChainConfig::Astria(chain_config) => chain_config.clear_interval = Some(10),
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions tools/integration-test/src/tests/client_expiration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ impl TestOverrides for ExpirationTestOverrides {
ChainConfig::CosmosSdk(chain_config) => {
chain_config.trusting_period = Some(CLIENT_EXPIRY);
}
ChainConfig::Astria(chain_config) => {
chain_config.trusting_period = Some(CLIENT_EXPIRY);
}
}
}
}
Expand Down
16 changes: 10 additions & 6 deletions tools/integration-test/src/tests/client_refresh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,16 @@ impl BinaryChainTest for ClientFailsTest {
let chains2 = override_connected_chains(
chains,
|config| {
{
let ChainConfig::CosmosSdk(config_chain_a) = &mut config.chains[0];
config_chain_a.gas_multiplier = Some(GasMultiplier::unsafe_new(0.8));
}

let ChainConfig::CosmosSdk(config_chain_b) = &mut config.chains[1];
let config_chain_a = match config.chains[0] {
ChainConfig::CosmosSdk(ref mut config) => config,
ChainConfig::Astria(ref mut config) => config,
};
config_chain_a.gas_multiplier = Some(GasMultiplier::unsafe_new(0.8));

let config_chain_b = match config.chains[1] {
ChainConfig::CosmosSdk(ref mut config) => config,
ChainConfig::Astria(ref mut config) => config,
};
config_chain_b.gas_multiplier = Some(GasMultiplier::unsafe_new(0.8));
},
config,
Expand Down
12 changes: 12 additions & 0 deletions tools/integration-test/src/tests/client_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ impl TestOverrides for ClientDefaultsTest {
chain_config_a.trusting_period = Some(Duration::from_secs(120_000));
chain_config_a.trust_threshold = TrustThreshold::new(13, 23).unwrap();
}
ChainConfig::Astria(chain_config_a) => {
chain_config_a.clock_drift = Duration::from_secs(3);
chain_config_a.max_block_time = Duration::from_secs(5);
chain_config_a.trusting_period = Some(Duration::from_secs(120_000));
chain_config_a.trust_threshold = TrustThreshold::new(13, 23).unwrap();
}
}

match &mut config.chains[1] {
Expand All @@ -50,6 +56,12 @@ impl TestOverrides for ClientDefaultsTest {
chain_config_b.trusting_period = Some(Duration::from_secs(340_000));
chain_config_b.trust_threshold = TrustThreshold::TWO_THIRDS;
}
ChainConfig::Astria(chain_config_b) => {
chain_config_b.clock_drift = Duration::from_secs(6);
chain_config_b.max_block_time = Duration::from_secs(15);
chain_config_b.trusting_period = Some(Duration::from_secs(340_000));
chain_config_b.trust_threshold = TrustThreshold::TWO_THIRDS;
}
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions tools/integration-test/src/tests/memo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ impl TestOverrides for MemoTest {
ChainConfig::CosmosSdk(chain_config) => {
chain_config.memo_prefix = self.memo.clone();
}
ChainConfig::Astria(chain_config) => {
chain_config.memo_prefix = self.memo.clone();
}
}
}
}
Expand Down
14 changes: 14 additions & 0 deletions tools/integration-test/src/tests/ordered_channel_clear.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ impl TestOverrides for OrderedChannelClearTest {
ChainConfig::CosmosSdk(chain_config) => {
chain_config.sequential_batch_tx = self.sequential_batch_tx;
}
ChainConfig::Astria(chain_config) => {
chain_config.sequential_batch_tx = self.sequential_batch_tx;
}
}
}

Expand All @@ -75,6 +78,9 @@ impl TestOverrides for OrderedChannelClearTest {
ChainConfig::CosmosSdk(chain_config) => {
chain_config.sequential_batch_tx = self.sequential_batch_tx;
}
ChainConfig::Astria(chain_config) => {
chain_config.sequential_batch_tx = self.sequential_batch_tx;
}
}
}

Expand Down Expand Up @@ -209,6 +215,10 @@ impl TestOverrides for OrderedChannelClearEqualCLITest {
chain_config.sequential_batch_tx = true;
chain_config.max_msg_num = MaxMsgNum::new(3).unwrap();
}
ChainConfig::Astria(chain_config) => {
chain_config.sequential_batch_tx = true;
chain_config.max_msg_num = MaxMsgNum::new(3).unwrap();
}
}
}

Expand All @@ -218,6 +228,10 @@ impl TestOverrides for OrderedChannelClearEqualCLITest {
chain_config.sequential_batch_tx = true;
chain_config.max_msg_num = MaxMsgNum::new(3).unwrap();
}
ChainConfig::Astria(chain_config) => {
chain_config.sequential_batch_tx = true;
chain_config.max_msg_num = MaxMsgNum::new(3).unwrap();
}
}
}

Expand Down
3 changes: 3 additions & 0 deletions tools/integration-test/src/tests/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ impl TestOverrides for PythonTest {
// with external relayer commands.
chain_config.key_store_type = Store::Test;
}
ChainConfig::Astria(chain_config) => {
chain_config.key_store_type = Store::Test;
}
}
}
}
Expand Down
Loading