Skip to content

Commit

Permalink
Improve ICA tests (#3415)
Browse files Browse the repository at this point in the history
* Update ICA tests to use 'simd' instead of 'interchain-accounts-demo'

* Remove 'ica' from flake.nix

* Minor improvements

* Add changelog entry

* Update 'ibc-proto-rs' to 'v0.32.0'

* Update Cargo.lock with 'ibc-proto-rs' v0.32.0

* Fix comment in ICA tests

* Fix from Github review
  • Loading branch information
ljoss17 authored Jun 15, 2023
1 parent 2732541 commit 2961796
Show file tree
Hide file tree
Showing 21 changed files with 494 additions and 183 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Update ICA tests to use ibc-go's `simd` instead of `interchain-accounts-demo`.
([#3353](https://github.com/informalsystems/hermes/issues/3353))
15 changes: 13 additions & 2 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,16 @@ jobs:
ica-filter-test:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
chain:
- package: ibc-go-v6-simapp
command: simd
account_prefix: cosmos
- package: ibc-go-v7-simapp
command: simd
account_prefix: cosmos
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v21
Expand All @@ -172,9 +182,10 @@ jobs:
RUST_LOG: info
RUST_BACKTRACE: 1
NO_COLOR_LOG: 1
CHAIN_COMMAND_PATHS: icad
CHAIN_COMMAND_PATHS: ${{ matrix.chain.command }}
ACCOUNT_PREFIXES: ${{ matrix.chain.account_prefix }}
run: |
nix shell .#python .#ica -c cargo \
nix shell .#${{ matrix.chain.package }} -c cargo \
test -p ibc-integration-test --features ica --no-fail-fast -- \
--nocapture --test-threads=1 test_ica_filter
Expand Down
76 changes: 38 additions & 38 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/chain-registry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ description = """
"""

[dependencies]
ibc-proto = { version = "0.31.0" }
ibc-proto = { version = "0.32.0" }
ibc-relayer-types = { version = "0.24.1", path = "../relayer-types" }
tendermint-rpc = { version = "0.32.0", features = ["http-client", "websocket-client"] }

Expand Down
2 changes: 1 addition & 1 deletion crates/relayer-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ mocks = ["tendermint-testgen", "clock"]

[dependencies]
# Proto definitions for all IBC-related interfaces, e.g., connections or channels.
ibc-proto = { version = "0.31.0" }
ibc-proto = { version = "0.32.0" }
ics23 = { version = "0.10.1", features = ["std", "host-functions"] }
time = { version = ">=0.3.0, <0.3.23" }
serde_derive = { version = "1.0.104" }
Expand Down
49 changes: 49 additions & 0 deletions crates/relayer-types/src/applications/ics27_ica/cosmos_tx.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
use ibc_proto::google::protobuf::Any;
use ibc_proto::ibc::applications::interchain_accounts::v1::CosmosTx as RawCosmosTx;
use ibc_proto::protobuf::Protobuf;
use serde_derive::Deserialize;
use serde_derive::Serialize;

use crate::applications::ics27_ica::error::Error;
use crate::core::ics24_host::error::ValidationError;
use crate::tx_msg::Msg;

pub const TYPE_URL: &str = "/ibc.applications.interchain_accounts.v1.CosmosTx";

#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct CosmosTx {
pub messages: Vec<Any>,
}

impl Msg for CosmosTx {
type ValidationError = ValidationError;
type Raw = RawCosmosTx;

fn route(&self) -> String {
crate::keys::ROUTER_KEY.to_string()
}

fn type_url(&self) -> String {
TYPE_URL.to_string()
}
}

impl Protobuf<RawCosmosTx> for CosmosTx {}

impl TryFrom<RawCosmosTx> for CosmosTx {
type Error = Error;

fn try_from(value: RawCosmosTx) -> Result<Self, Self::Error> {
Ok(CosmosTx {
messages: value.messages,
})
}
}

impl From<CosmosTx> for RawCosmosTx {
fn from(value: CosmosTx) -> Self {
RawCosmosTx {
messages: value.messages,
}
}
}
24 changes: 24 additions & 0 deletions crates/relayer-types/src/applications/ics27_ica/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
use crate::core::ics24_host::error::ValidationError;
use crate::signer::SignerError;

use flex_error::define_error;

define_error! {
#[derive(Debug, PartialEq, Eq)]
Error {
Owner
[ SignerError ]
| _ | { "failed to parse owner" },

InvalidConnectionIdentifier
[ ValidationError ]
| _ | { "connection identifier error" },

InvalidPacketData
| _ | { "packet data is None" },

InvalidRelativeTimeout
{ timestamp: u64 }
| e | { format_args!("invalid packet timeout timestamp value: `{}`", e.timestamp) },
}
}
4 changes: 4 additions & 0 deletions crates/relayer-types/src/applications/ics27_ica/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pub mod cosmos_tx;
pub mod error;
pub mod msgs;
pub mod packet_data;
2 changes: 2 additions & 0 deletions crates/relayer-types/src/applications/ics27_ica/msgs/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub mod register;
pub mod send_tx;
Loading

0 comments on commit 2961796

Please sign in to comment.