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

Update Gaia, Stride, Neutron and Osmosis versions used in CI #3944

Merged
merged 10 commits into from
Apr 18, 2024
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Fix a bug where Hermes would only ever extract the first emitted ICS 031 CrossChain Query event, which would cause it to miss the other CCQ events.
([\#3954](https://github.com/informalsystems/hermes/issues/3954))
75 changes: 9 additions & 66 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,7 @@ jobs:
fail-fast: false
matrix:
chain:
- package: gaia13
command: gaiad
account_prefix: cosmos
native_token: stake
features: forward-packet,clean-workers
- package: gaia14
- package: gaia15
command: gaiad
account_prefix: cosmos
native_token: stake
Expand Down Expand Up @@ -170,63 +165,18 @@ jobs:
cargo nextest run -p ibc-integration-test --no-fail-fast --failure-output final --test-threads=2 \
--features ordered test_ordered_channel

interchain-security-no-ica:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
chain:
- package: .#gaia13 .#neutron
command: gaiad,neutrond
account_prefix: cosmos,neutron
- package: .#gaia14 .#neutron
command: gaiad,neutrond
account_prefix: cosmos,neutron
steps:
- uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
with:
extra-conf: |
substituters = https://cache.nixos.org
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
- name: Install Cachix
uses: cachix/cachix-action@v14
with:
name: cosmos-nix
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- uses: actions-rs/cargo@v1
with:
command: test
args: -p ibc-integration-test --features interchain-security --no-fail-fast --no-run
- name: Install cargo-nextest
run: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
- env:
RUST_LOG: trace
RUST_BACKTRACE: 1
NO_COLOR_LOG: 1
NEXTEST_RETRIES: 2
CHAIN_COMMAND_PATHS: ${{ matrix.chain.command }}
ACCOUNT_PREFIXES: ${{ matrix.chain.account_prefix }}
run: |
nix shell ${{ matrix.chain.package }} -c \
cargo nextest run -p ibc-integration-test --no-fail-fast --failure-output final --test-threads=2 \
--features interchain-security interchain_security::

interchain-security-ica:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
chain:
- package: .#gaia13 .#stride-consumer
command: gaiad,strided
account_prefix: cosmos,stride
- package: .#gaia14 .#stride-consumer
- package: .#gaia15 .#stride
command: gaiad,strided
account_prefix: cosmos,stride
- package: .#gaia15 .#neutron
command: gaiad,neutrond
account_prefix: cosmos,neutron
steps:
- uses: actions/checkout@v4
- name: Install Nix
Expand All @@ -245,7 +195,7 @@ jobs:
- uses: actions-rs/cargo@v1
with:
command: test
args: -p ibc-integration-test --features interchain-security --no-fail-fast --no-run
args: -p ibc-integration-test --features interchain-security,ica --no-fail-fast --no-run
- name: Install cargo-nextest
run: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
- env:
Expand All @@ -266,10 +216,7 @@ jobs:
fail-fast: false
matrix:
chain:
- package: .#gaia13 .#stride-consumer-no-admin
command: gaiad,strided
account_prefix: cosmos,stride
- package: .#gaia14 .#stride-consumer-no-admin
- package: .#gaia15 .#stride-no-admin
command: gaiad,strided
account_prefix: cosmos,stride
steps:
Expand Down Expand Up @@ -310,11 +257,7 @@ jobs:
fail-fast: false
matrix:
chain:
- package: .#celestia .#gaia13
command: celestia-appd,gaiad
account_prefix: celestia,cosmos
native_token: utia,stake
- package: .#celestia .#gaia14
- package: .#celestia .#gaia15
command: celestia-appd,gaiad
account_prefix: celestia,cosmos
native_token: utia,stake
Expand Down Expand Up @@ -343,7 +286,7 @@ jobs:
RUST_LOG: info
RUST_BACKTRACE: 1
NO_COLOR_LOG: 1
COMPAT_MODES: 0.34
COMPAT_MODES: 0.34,0.37
CHAIN_COMMAND_PATHS: ${{ matrix.chain.command }}
ACCOUNT_PREFIXES: ${{ matrix.chain.account_prefix }}
NATIVE_TOKENS: ${{ matrix.chain.native_token }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/misbehaviour.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
fail-fast: false
matrix:
chain:
- package: gaia14
- package: gaia15
command: gaiad
account_prefix: cosmos
steps:
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/multi-chains.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,7 @@ jobs:
fail-fast: false
matrix:
first-package:
- package: gaia13
command: gaiad
account_prefix: cosmos
- package: gaia14
- package: gaia15
command: gaiad
account_prefix: cosmos
- package: ibc-go-v7-simapp
Expand Down
4 changes: 2 additions & 2 deletions ci/misbehaviour/create_fork.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ sconfig data/ibc-1-f/config/config.toml "rpc.laddr=tcp://0.0.0.0:26457"
sconfig data/ibc-1-f/config/config.toml "p2p.laddr=tcp://0.0.0.0:26456"

info "Starting ibc-1..."
gaiad --home ./data/ibc-1 start --pruning=nothing --grpc.address=0.0.0.0:9091 --log_level error > data/ibc-1.log 2>&1 &
gaiad --home ./data/ibc-1 start --pruning=nothing --rpc.laddr="tcp://0.0.0.0:26557" --grpc.address=0.0.0.0:9091 --log_level error > data/ibc-1.log 2>&1 &

info "Starting ibc-1 fork..."
gaiad --home ./data/ibc-1-f start --pruning=nothing --grpc.address=0.0.0.0:9092 --log_level error > data/ibc-1-f.log 2>&1 &
gaiad --home ./data/ibc-1-f start --pruning=nothing --rpc.laddr="tcp://0.0.0.0:26457" --grpc.address=0.0.0.0:9092 --log_level error > data/ibc-1-f.log 2>&1 &
72 changes: 7 additions & 65 deletions crates/relayer-types/src/applications/ics31_icq/events.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::collections::BTreeMap;
use std::str::FromStr;

use serde::{Deserialize, Serialize};
Expand All @@ -9,7 +8,7 @@ use crate::events::IbcEvent;

use super::error::Error;

const EVENT_TYPE_PREFIX: &str = "query_request";
pub const EVENT_TYPE_PREFIX: &str = "query_request";

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
pub struct CrossChainQueryPacket {
Expand All @@ -23,6 +22,12 @@ pub struct CrossChainQueryPacket {
pub request: String,
}

impl From<CrossChainQueryPacket> for IbcEvent {
fn from(packet: CrossChainQueryPacket) -> Self {
IbcEvent::CrossChainQueryPacket(packet)
}
}

fn find_value<'a>(key: &str, entries: &'a [abci::EventAttribute]) -> Result<&'a str, Error> {
entries
.iter()
Expand Down Expand Up @@ -93,66 +98,3 @@ impl<'a> TryFrom<&'a [abci::EventAttribute]> for CrossChainQueryPacket {
})
}
}

fn fetch_first_element_from_events(
block_events: &BTreeMap<String, Vec<String>>,
key: &str,
) -> Result<String, Error> {
let res = block_events
.get(key)
.ok_or_else(|| Error::event(format!("attribute not found for key: {key}")))?
.first()
.ok_or_else(|| {
Error::event(format!(
"element at position 0, of attribute with key `{key}`, not found"
))
})?;

Ok(res.clone())
}

impl CrossChainQueryPacket {
pub fn extract_query_event(
block_events: &BTreeMap<String, Vec<String>>,
) -> Result<IbcEvent, Error> {
let chain_id_str = fetch_first_element_from_events(
block_events,
&format!("{}.{}", EVENT_TYPE_PREFIX, "chain_id"),
)?;
let connection_id_str = fetch_first_element_from_events(
block_events,
&format!("{}.{}", EVENT_TYPE_PREFIX, "connection_id"),
)?;
let query_type = fetch_first_element_from_events(
block_events,
&format!("{}.{}", EVENT_TYPE_PREFIX, "type"),
)?;
let height_str = fetch_first_element_from_events(
block_events,
&format!("{}.{}", EVENT_TYPE_PREFIX, "height"),
)?;

Ok(IbcEvent::CrossChainQueryPacket(CrossChainQueryPacket {
module: fetch_first_element_from_events(
block_events,
&format!("{}.{}", EVENT_TYPE_PREFIX, "module"),
)?,
action: fetch_first_element_from_events(
block_events,
&format!("{}.{}", EVENT_TYPE_PREFIX, "action"),
)?,
query_id: fetch_first_element_from_events(
block_events,
&format!("{}.{}", EVENT_TYPE_PREFIX, "query_id"),
)?,
chain_id: ChainId::from_string(&chain_id_str),
connection_id: ConnectionId::from_str(&connection_id_str)?,
query_type,
height: Height::from_str(&height_str)?,
request: fetch_first_element_from_events(
block_events,
&format!("{}.{}", EVENT_TYPE_PREFIX, "request"),
)?,
}))
}
}
24 changes: 24 additions & 0 deletions crates/relayer/src/chain/cosmos/types/events/channel.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use alloc::collections::btree_map::BTreeMap as HashMap;

use ibc_relayer_types::applications::ics31_icq::events::CrossChainQueryPacket;
use ibc_relayer_types::core::ics02_client::height::HeightErrorDetail;
use ibc_relayer_types::core::ics04_channel::error::Error;
use ibc_relayer_types::core::ics04_channel::events::{
Expand All @@ -12,6 +13,7 @@ use ibc_relayer_types::core::ics04_channel::events::{
use ibc_relayer_types::core::ics04_channel::events::{ReceivePacket, TimeoutOnClosePacket};
use ibc_relayer_types::core::ics04_channel::packet::Packet;
use ibc_relayer_types::core::ics04_channel::timeout::TimeoutHeight;
use ibc_relayer_types::core::ics24_host::identifier::ChainId;
use ibc_relayer_types::events::Error as EventError;
use ibc_relayer_types::Height;

Expand Down Expand Up @@ -176,6 +178,28 @@ impl TryFrom<RawObject<'_>> for Packet {
}
}

impl TryFrom<RawObject<'_>> for CrossChainQueryPacket {
type Error = EventError;

fn try_from(obj: RawObject<'_>) -> Result<Self, Self::Error> {
Ok(Self {
module: extract_attribute(&obj, &format!("{}.module", obj.action))?,
action: extract_attribute(&obj, &format!("{}.action", obj.action))?,
query_id: extract_attribute(&obj, &format!("{}.query_id", obj.action))?,
chain_id: extract_attribute(&obj, &format!("{}.chain_id", obj.action))
.map(|s| ChainId::from_string(&s))?,
connection_id: extract_attribute(&obj, &format!("{}.connection_id", obj.action))?
.parse()
.map_err(EventError::parse)?,
query_type: extract_attribute(&obj, &format!("{}.type", obj.action))?,
request: extract_attribute(&obj, &format!("{}.request", obj.action))?,
height: extract_attribute(&obj, &format!("{}.height", obj.action))?
.parse()
.map_err(|_| EventError::height())?,
})
}
}

#[derive(Debug, Clone)]
pub struct RawObject<'a> {
pub height: Height,
Expand Down
4 changes: 4 additions & 0 deletions crates/relayer/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,10 @@ define_error! {
{ address: String }
|e| { format!("Query/Account RPC returned an empty account for address: {}", e.address) },

EmptyProposal
{ proposal_id: String }
|e| { format!("Query/Proposal RPC returned an empty proposal for proposal id: {}", e.proposal_id) },

NoHistoricalEntries
{ chain_id: ChainId }
|e| {
Expand Down
2 changes: 1 addition & 1 deletion crates/relayer/src/event/source/rpc/extract.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use ibc_relayer_types::applications::ics29_fee::events::DistributionType;
use tendermint::abci;

use ibc_relayer_types::applications::ics29_fee::events::DistributionType;
use ibc_relayer_types::core::ics02_client::height::Height;
use ibc_relayer_types::core::ics24_host::identifier::ChainId;
use ibc_relayer_types::events::IbcEvent;
Expand Down
16 changes: 12 additions & 4 deletions crates/relayer/src/event/source/websocket/extract.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use alloc::collections::BTreeMap as HashMap;
use ibc_relayer_types::applications::ics29_fee::events::DistributionType;

use ibc_relayer_types::applications::ics31_icq;
use tendermint_rpc::{event::Event as RpcEvent, event::EventData as RpcEventData};

use ibc_relayer_types::applications::ics31_icq::events::CrossChainQueryPacket;
Expand Down Expand Up @@ -328,10 +329,17 @@ fn extract_block_events(
extract_events(height, block_events, "channel_close_confirm", "channel_id"),
height,
);
// extract cross chain query event from block_events
if let Ok(ccq) = CrossChainQueryPacket::extract_query_event(block_events) {
events.push(IbcEventWithHeight::new(ccq, height));
}

append_events::<CrossChainQueryPacket>(
&mut events,
extract_events(
height,
block_events,
ics31_icq::events::EVENT_TYPE_PREFIX,
"query_id",
),
height,
);

events
}
Loading
Loading