diff --git a/crates/chain-registry/src/formatter.rs b/crates/chain-registry/src/formatter.rs index 877f5ce86e..fe520fac0e 100644 --- a/crates/chain-registry/src/formatter.rs +++ b/crates/chain-registry/src/formatter.rs @@ -99,7 +99,7 @@ impl UriFormatter for SimpleGrpcFormatter { #[cfg(test)] mod tests { - use std::{cmp::PartialEq, fmt::Debug}; + use super::*; use std::fmt::Debug; diff --git a/crates/relayer-cli/src/commands/clear.rs b/crates/relayer-cli/src/commands/clear.rs index 35be5f9f03..14868011a2 100644 --- a/crates/relayer-cli/src/commands/clear.rs +++ b/crates/relayer-cli/src/commands/clear.rs @@ -1,20 +1,9 @@ use eyre::eyre; use std::ops::RangeInclusive; -use abscissa_core::{clap::Parser, config::Override, Command, FrameworkErrorKind, Runnable}; -use ibc_relayer::{ - chain::handle::{BaseChainHandle, ChainHandle}, - config::Config, - link::{error::LinkError, Link, LinkParameters}, - util::seq_range::parse_seq_range, -}; -use ibc_relayer_types::{ - core::{ - ics04_channel::packet::Sequence, - ics24_host::identifier::{ChainId, ChannelId, PortId}, - }, - events::IbcEvent, -}; +use abscissa_core::clap::Parser; +use abscissa_core::config::Override; +use abscissa_core::{Command, FrameworkErrorKind, Runnable}; use ibc_relayer::chain::handle::{BaseChainHandle, ChainHandle}; use ibc_relayer::chain::requests::{IncludeProof, QueryChannelRequest, QueryHeight}; @@ -276,13 +265,13 @@ where #[cfg(test)] mod tests { + use super::ClearPacketsCmd; + use std::str::FromStr; use abscissa_core::clap::Parser; - use ibc_relayer_types::core::{ - ics04_channel::packet::Sequence, - ics24_host::identifier::{ChainId, ChannelId, PortId}, - }; + use ibc_relayer_types::core::ics04_channel::packet::Sequence; + use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ChannelId, PortId}; #[test] fn test_clear_packets_required_only() { diff --git a/crates/relayer-cli/src/commands/config/auto.rs b/crates/relayer-cli/src/commands/config/auto.rs index 2669f928d5..2e837c801e 100644 --- a/crates/relayer-cli/src/commands/config/auto.rs +++ b/crates/relayer-cli/src/commands/config/auto.rs @@ -5,15 +5,12 @@ use itertools::Itertools; use crate::conclude::Output; -use abscissa_core::{clap::Parser, Command, Runnable}; use ibc_relayer::config::{store, ChainConfig, Config}; use std::collections::HashSet; use std::path::PathBuf; use tracing::{error, info, warn}; -use crate::{chain_registry::get_configs, conclude::Output}; - fn find_key(chain_config: &ChainConfig) -> Option { let keys = chain_config.list_keys().ok()?; keys.into_iter().next().map(|(name, _)| name) diff --git a/crates/relayer-cli/src/commands/create/channel.rs b/crates/relayer-cli/src/commands/create/channel.rs index 3029cab3df..30e306dbee 100644 --- a/crates/relayer-cli/src/commands/create/channel.rs +++ b/crates/relayer-cli/src/commands/create/channel.rs @@ -2,29 +2,19 @@ use abscissa_core::clap::Parser; use console::style; use dialoguer::Confirm; + +use ibc_relayer::chain::handle::ChainHandle; +use ibc_relayer::chain::requests::{ + IncludeProof, QueryClientStateRequest, QueryConnectionRequest, QueryHeight, +}; use ibc_relayer::channel::Channel; use ibc_relayer::config::default::connection_delay; use ibc_relayer::connection::Connection; use ibc_relayer::foreign_client::ForeignClient; -use ibc_relayer::{ - chain::{ - handle::ChainHandle, - requests::{IncludeProof, QueryClientStateRequest, QueryConnectionRequest, QueryHeight}, - }, - channel::Channel, - config::default::connection_delay, - connection::Connection, - foreign_client::ForeignClient, -}; use ibc_relayer_types::core::ics03_connection::connection::IdentifiedConnectionEnd; use ibc_relayer_types::core::ics04_channel::channel::Ordering; use ibc_relayer_types::core::ics04_channel::version::Version; use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ConnectionId, PortId}; -use ibc_relayer_types::core::{ - ics03_connection::connection::IdentifiedConnectionEnd, - ics04_channel::{channel::Ordering, version::Version}, - ics24_host::identifier::{ChainId, ConnectionId, PortId}, -}; use crate::cli_utils::{spawn_chain_runtime, ChainHandlePair}; use crate::conclude::{exit_with_unrecoverable_error, Output}; diff --git a/crates/relayer-cli/src/commands/evidence.rs b/crates/relayer-cli/src/commands/evidence.rs index e15010ce99..3c4fb15877 100644 --- a/crates/relayer-cli/src/commands/evidence.rs +++ b/crates/relayer-cli/src/commands/evidence.rs @@ -1,16 +1,37 @@ -use std::{ - collections::HashMap, - ops::{ControlFlow, Deref}, - sync::Arc, - thread::sleep, - time::Duration, -}; +use std::collections::HashMap; +use std::ops::{ControlFlow, Deref}; +use std::sync::Arc; +use std::thread::sleep; +use std::time::Duration; use abscissa_core::clap::Parser; use ibc_relayer::config::{ChainConfig, Config}; use tokio::runtime::Runtime as TokioRuntime; -use crate::{conclude::Output, prelude::*}; +use tendermint::block::Height as TendermintHeight; +use tendermint::evidence::{DuplicateVoteEvidence, LightClientAttackEvidence}; +use tendermint::validator; +use tendermint_rpc::{Client, Paging}; + +use ibc_relayer::chain::cosmos::CosmosSdkChain; +use ibc_relayer::chain::endpoint::ChainEndpoint; +use ibc_relayer::chain::handle::{BaseChainHandle, ChainHandle}; +use ibc_relayer::chain::requests::{IncludeProof, PageRequest, QueryHeight}; +use ibc_relayer::chain::tracking::TrackedMsgs; +use ibc_relayer::foreign_client::ForeignClient; +use ibc_relayer::spawn::spawn_chain_runtime_with_modified_config; +use ibc_relayer_types::applications::ics28_ccv::msgs::ccv_double_voting::MsgSubmitIcsConsumerDoubleVoting; +use ibc_relayer_types::applications::ics28_ccv::msgs::ccv_misbehaviour::MsgSubmitIcsConsumerMisbehaviour; +use ibc_relayer_types::clients::ics07_tendermint::header::Header as TendermintHeader; +use ibc_relayer_types::clients::ics07_tendermint::misbehaviour::Misbehaviour as TendermintMisbehaviour; +use ibc_relayer_types::core::ics02_client::height::Height; +use ibc_relayer_types::core::ics02_client::msgs::misbehaviour::MsgSubmitMisbehaviour; +use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ClientId}; +use ibc_relayer_types::events::IbcEvent; +use ibc_relayer_types::tx_msg::Msg; + +use crate::conclude::Output; +use crate::prelude::*; #[derive(Clone, Command, Debug, Parser, PartialEq, Eq)] pub struct EvidenceCmd { diff --git a/crates/relayer-cli/src/commands/health.rs b/crates/relayer-cli/src/commands/health.rs index 375797eff7..6ecdd588dd 100644 --- a/crates/relayer-cli/src/commands/health.rs +++ b/crates/relayer-cli/src/commands/health.rs @@ -1,10 +1,11 @@ use abscissa_core::clap::Parser; -use crate::{ - cli_utils::spawn_chain_runtime, - conclude::{exit_with_unrecoverable_error, Output}, - prelude::*, -}; +use ibc_relayer::chain::endpoint::HealthCheck::*; +use ibc_relayer::chain::handle::ChainHandle; + +use crate::cli_utils::spawn_chain_runtime; +use crate::conclude::{exit_with_unrecoverable_error, Output}; +use crate::prelude::*; #[derive(Clone, Command, Debug, Parser)] pub struct HealthCheckCmd {} diff --git a/crates/relayer-cli/src/commands/misbehaviour.rs b/crates/relayer-cli/src/commands/misbehaviour.rs index b7a71bb3a4..e6e40e0cda 100644 --- a/crates/relayer-cli/src/commands/misbehaviour.rs +++ b/crates/relayer-cli/src/commands/misbehaviour.rs @@ -10,30 +10,11 @@ use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ClientId}; use ibc_relayer_types::events::IbcEvent; use std::ops::Deref; -use abscissa_core::{clap::Parser, Command, Runnable}; +use crate::cli_utils::{spawn_chain_runtime, spawn_chain_runtime_generic}; +use crate::conclude::Output; +use crate::prelude::*; use eyre::eyre; -use ibc_relayer::{ - chain::{ - handle::ChainHandle, - requests::{IncludeProof, QueryClientStateRequest, QueryHeight}, - }, - config::Config, - foreign_client::{ForeignClient, MisbehaviourResults}, - util::pretty::PrettySlice, -}; -use ibc_relayer_types::{ - core::{ - ics02_client::{client_state::ClientState, events::UpdateClient}, - ics24_host::identifier::{ChainId, ClientId}, - }, - events::IbcEvent, -}; - -use crate::{ - cli_utils::{spawn_chain_runtime, spawn_chain_runtime_generic}, - conclude::Output, - prelude::*, -}; +use ibc_relayer_types::core::ics02_client::client_state::ClientState; #[derive(Clone, Command, Debug, Parser, PartialEq, Eq)] pub struct MisbehaviourCmd { diff --git a/crates/relayer-cli/src/commands/query/channel.rs b/crates/relayer-cli/src/commands/query/channel.rs index 22c60a5b13..87f2012d29 100644 --- a/crates/relayer-cli/src/commands/query/channel.rs +++ b/crates/relayer-cli/src/commands/query/channel.rs @@ -1,11 +1,15 @@ use abscissa_core::clap::Parser; use ibc_relayer::chain::handle::ChainHandle; -use crate::{ - cli_utils::spawn_chain_runtime, - conclude::{exit_with_unrecoverable_error, Output}, - prelude::*, -}; +use ibc_relayer::chain::requests::{IncludeProof, QueryChannelRequest, QueryHeight}; +use ibc_relayer_types::core::ics24_host::identifier::ChainId; +use ibc_relayer_types::core::ics24_host::identifier::{ChannelId, PortId}; + +use crate::cli_utils::spawn_chain_runtime; +use crate::conclude::{exit_with_unrecoverable_error, Output}; +use crate::prelude::*; +use ibc_relayer_types::core::ics04_channel::channel::State; +use ibc_relayer_types::Height; #[derive(Clone, Command, Debug, Parser, PartialEq, Eq)] pub struct QueryChannelEndCmd { diff --git a/crates/relayer-cli/src/commands/query/channel_ends.rs b/crates/relayer-cli/src/commands/query/channel_ends.rs index 1096adb85e..6ea357facf 100644 --- a/crates/relayer-cli/src/commands/query/channel_ends.rs +++ b/crates/relayer-cli/src/commands/query/channel_ends.rs @@ -1,10 +1,21 @@ use abscissa_core::clap::Parser; use serde::{Deserialize, Serialize}; -use crate::{ - conclude::{exit_with_unrecoverable_error, Output}, - prelude::*, +use eyre::eyre; +use ibc_relayer::chain::handle::{BaseChainHandle, ChainHandle}; +use ibc_relayer::chain::requests::{ + IncludeProof, QueryChannelRequest, QueryClientStateRequest, QueryConnectionRequest, QueryHeight, }; +use ibc_relayer::client_state::AnyClientState; +use ibc_relayer::registry::Registry; +use ibc_relayer_types::core::ics03_connection::connection::ConnectionEnd; +use ibc_relayer_types::core::ics04_channel::channel::{ChannelEnd, State}; +use ibc_relayer_types::core::ics24_host::identifier::ChainId; +use ibc_relayer_types::core::ics24_host::identifier::{ChannelId, ClientId, ConnectionId, PortId}; +use ibc_relayer_types::Height; + +use crate::conclude::{exit_with_unrecoverable_error, Output}; +use crate::prelude::*; #[derive(Clone, Command, Debug, Parser, PartialEq, Eq)] pub struct QueryChannelEndsCmd { diff --git a/crates/relayer-cli/src/commands/query/channels.rs b/crates/relayer-cli/src/commands/query/channels.rs index 3722ff7d32..3091537784 100644 --- a/crates/relayer-cli/src/commands/query/channels.rs +++ b/crates/relayer-cli/src/commands/query/channels.rs @@ -3,7 +3,21 @@ use core::fmt::{Debug, Error, Formatter}; use abscissa_core::clap::Parser; use serde::Serialize; -use crate::{commands::query::channel_ends::ChannelEnds, conclude::Output, prelude::*}; +use eyre::eyre; +use ibc_relayer::chain::handle::{BaseChainHandle, ChainHandle}; +use ibc_relayer::chain::requests::{ + IncludeProof, PageRequest, QueryChannelRequest, QueryChannelsRequest, QueryClientStateRequest, + QueryConnectionRequest, QueryHeight, +}; +use ibc_relayer::registry::Registry; +use ibc_relayer_types::core::ics04_channel::channel::{ChannelEnd, State}; +use ibc_relayer_types::core::ics24_host::identifier::{ + ChainId, ChannelId, ConnectionId, PortChannelId, PortId, +}; + +use crate::commands::query::channel_ends::ChannelEnds; +use crate::conclude::Output; +use crate::prelude::*; #[derive(Clone, Command, Debug, Parser, PartialEq, Eq)] pub struct QueryChannelsCmd { diff --git a/crates/relayer-cli/src/commands/query/client.rs b/crates/relayer-cli/src/commands/query/client.rs index 45045b00d4..ad5ffd0fd9 100644 --- a/crates/relayer-cli/src/commands/query/client.rs +++ b/crates/relayer-cli/src/commands/query/client.rs @@ -8,11 +8,15 @@ use ibc_relayer::chain::requests::{ QueryHeight, QueryTxRequest, }; -use crate::{ - application::app_config, - cli_utils::spawn_chain_runtime, - conclude::{exit_with_unrecoverable_error, Output}, -}; +use ibc_relayer_types::core::ics02_client::client_state::ClientState; +use ibc_relayer_types::core::ics24_host::identifier::ChainId; +use ibc_relayer_types::core::ics24_host::identifier::ClientId; +use ibc_relayer_types::events::WithBlockDataType; +use ibc_relayer_types::Height; + +use crate::application::app_config; +use crate::cli_utils::spawn_chain_runtime; +use crate::conclude::{exit_with_unrecoverable_error, Output}; /// Query client state command #[derive(Clone, Command, Debug, Parser, PartialEq, Eq)] diff --git a/crates/relayer-cli/src/commands/query/clients.rs b/crates/relayer-cli/src/commands/query/clients.rs index eb902f3c13..94cdff3e49 100644 --- a/crates/relayer-cli/src/commands/query/clients.rs +++ b/crates/relayer-cli/src/commands/query/clients.rs @@ -2,12 +2,13 @@ use abscissa_core::clap::Parser; use ibc_relayer::chain::handle::ChainHandle; use serde::Serialize; -use crate::{ - cli_utils::spawn_chain_runtime, - conclude::{exit_with_unrecoverable_error, Output}, - error::Error, - prelude::*, -}; +use ibc_relayer::chain::requests::{PageRequest, QueryClientStatesRequest}; +use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ClientId}; + +use crate::cli_utils::spawn_chain_runtime; +use crate::conclude::{exit_with_unrecoverable_error, Output}; +use crate::error::Error; +use crate::prelude::*; /// Query clients command #[derive(Clone, Command, Debug, Parser, PartialEq, Eq)] diff --git a/crates/relayer-cli/src/commands/query/connection.rs b/crates/relayer-cli/src/commands/query/connection.rs index db3d72851c..4dff3f9e85 100644 --- a/crates/relayer-cli/src/commands/query/connection.rs +++ b/crates/relayer-cli/src/commands/query/connection.rs @@ -4,12 +4,17 @@ use ibc_relayer::chain::requests::{ IncludeProof, PageRequest, QueryConnectionChannelsRequest, QueryConnectionRequest, QueryHeight, }; -use crate::{ - cli_utils::spawn_chain_runtime, - conclude::{exit_with_unrecoverable_error, Output}, - error::Error, - prelude::*, +use ibc_relayer_types::core::{ + ics03_connection::connection::State, + ics24_host::identifier::ConnectionId, + ics24_host::identifier::{ChainId, PortChannelId}, }; +use ibc_relayer_types::Height; + +use crate::cli_utils::spawn_chain_runtime; +use crate::conclude::{exit_with_unrecoverable_error, Output}; +use crate::error::Error; +use crate::prelude::*; #[derive(Clone, Command, Debug, Parser, PartialEq, Eq)] pub struct QueryConnectionEndCmd { diff --git a/crates/relayer-cli/src/commands/query/packet/ack.rs b/crates/relayer-cli/src/commands/query/packet/ack.rs index 0f162a79da..5efe178ca8 100644 --- a/crates/relayer-cli/src/commands/query/packet/ack.rs +++ b/crates/relayer-cli/src/commands/query/packet/ack.rs @@ -2,12 +2,15 @@ use abscissa_core::clap::Parser; use ibc_relayer::chain::requests::{IncludeProof, QueryHeight, QueryPacketAcknowledgementRequest}; use subtle_encoding::{Encoding, Hex}; -use crate::{ - cli_utils::spawn_chain_runtime, - conclude::{exit_with_unrecoverable_error, Output}, - error::Error, - prelude::*, -}; +use ibc_relayer::chain::handle::ChainHandle; +use ibc_relayer_types::core::ics04_channel::packet::Sequence; +use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ChannelId, PortId}; +use ibc_relayer_types::Height; + +use crate::cli_utils::spawn_chain_runtime; +use crate::conclude::{exit_with_unrecoverable_error, Output}; +use crate::error::Error; +use crate::prelude::*; #[derive(Clone, Command, Debug, Parser, PartialEq, Eq)] pub struct QueryPacketAcknowledgmentCmd { diff --git a/crates/relayer-cli/src/commands/query/packet/pending.rs b/crates/relayer-cli/src/commands/query/packet/pending.rs index 36bbb59e90..3974d7935d 100644 --- a/crates/relayer-cli/src/commands/query/packet/pending.rs +++ b/crates/relayer-cli/src/commands/query/packet/pending.rs @@ -16,7 +16,6 @@ use crate::error::Error; use crate::prelude::*; use super::util::CollatedPendingPackets; -use crate::{cli_utils::spawn_chain_counterparty, conclude::Output, error::Error, prelude::*}; /// A structure to display pending packet commitment sequence IDs /// at both ends of a channel. diff --git a/crates/relayer-cli/src/commands/tx/channel.rs b/crates/relayer-cli/src/commands/tx/channel.rs index 03e16ae9c4..7db47011e7 100644 --- a/crates/relayer-cli/src/commands/tx/channel.rs +++ b/crates/relayer-cli/src/commands/tx/channel.rs @@ -11,8 +11,12 @@ use ibc_relayer_types::core::ics04_channel::channel::Ordering; use ibc_relayer_types::core::ics24_host::identifier::{ ChainId, ChannelId, ClientId, ConnectionId, PortId, }; +use ibc_relayer_types::events::IbcEvent; -use crate::{cli_utils::ChainHandlePair, conclude::Output, error::Error, prelude::*}; +use crate::cli_utils::ChainHandlePair; +use crate::conclude::Output; +use crate::error::Error; +use crate::prelude::*; /// Macro that generates the `Runnable::run` implementation for a /// `tx channel` subcommand. diff --git a/crates/relayer-cli/src/commands/tx/packet.rs b/crates/relayer-cli/src/commands/tx/packet.rs index 0752093847..f2b437cfad 100644 --- a/crates/relayer-cli/src/commands/tx/packet.rs +++ b/crates/relayer-cli/src/commands/tx/packet.rs @@ -2,22 +2,17 @@ use abscissa_core::clap::Parser; use ibc_relayer_types::core::ics02_client::height::Height; use std::ops::RangeInclusive; -use abscissa_core::{clap::Parser, Command, Runnable}; -use ibc_relayer::{ - chain::handle::ChainHandle, - link::{Link, LinkParameters}, - util::seq_range::parse_seq_range, -}; -use ibc_relayer_types::{ - core::{ - ics02_client::height::Height, - ics04_channel::packet::Sequence, - ics24_host::identifier::{ChainId, ChannelId, PortId}, - }, - events::IbcEvent, -}; - -use crate::{cli_utils::ChainHandlePair, conclude::Output, error::Error, prelude::*}; +use ibc_relayer::chain::handle::ChainHandle; +use ibc_relayer::link::{Link, LinkParameters}; +use ibc_relayer::util::seq_range::parse_seq_range; +use ibc_relayer_types::core::ics04_channel::packet::Sequence; +use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ChannelId, PortId}; +use ibc_relayer_types::events::IbcEvent; + +use crate::cli_utils::ChainHandlePair; +use crate::conclude::Output; +use crate::error::Error; +use crate::prelude::*; #[derive(Clone, Command, Debug, Parser, PartialEq, Eq)] pub struct TxPacketRecvCmd { diff --git a/crates/relayer/src/config.rs b/crates/relayer/src/config.rs index 968a45001e..02ce0ebb06 100644 --- a/crates/relayer/src/config.rs +++ b/crates/relayer/src/config.rs @@ -989,6 +989,7 @@ mod tests { super::ChainConfig::CosmosSdk(_) => { // all good } + super::ChainConfig::Astria(_) => panic!("expected CosmosSdk chain type"), } } @@ -1016,10 +1017,12 @@ mod tests { let excluded_sequences1 = match config.chains.first().unwrap() { ChainConfig::CosmosSdk(chain_config) => chain_config.excluded_sequences.clone(), + ChainConfig::Astria(chain_config) => chain_config.excluded_sequences.clone(), }; let excluded_sequences2 = match config.chains.last().unwrap() { ChainConfig::CosmosSdk(chain_config) => chain_config.excluded_sequences.clone(), + ChainConfig::Astria(chain_config) => chain_config.excluded_sequences.clone(), }; assert_eq!(excluded_sequences1, excluded_sequences2); diff --git a/crates/relayer/src/event.rs b/crates/relayer/src/event.rs index 9bed20d852..f5219f4750 100644 --- a/crates/relayer/src/event.rs +++ b/crates/relayer/src/event.rs @@ -660,15 +660,7 @@ pub fn parse_timeout_height(s: &str) -> Result { #[cfg(test)] mod tests { - use ibc_proto::{google::protobuf::Any, Protobuf}; - 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, - }, - timestamp::Timestamp, - }; + use super::*; #[test] fn connection_event_to_abci_event() { diff --git a/tools/test-framework/src/util/interchain_security.rs b/tools/test-framework/src/util/interchain_security.rs index ea66e12f4f..f2bf9fef2c 100644 --- a/tools/test-framework/src/util/interchain_security.rs +++ b/tools/test-framework/src/util/interchain_security.rs @@ -36,6 +36,7 @@ pub fn update_relayer_config_for_consumer_chain(config: &mut Config) { chain_config.trusting_period = Some(Duration::from_secs(99)); } ChainConfig::CosmosSdk(_) => {} + ChainConfig::Astria(_) => {} } } }