Skip to content

Commit

Permalink
Merge branch 'master' into romac/permissionless-ics
Browse files Browse the repository at this point in the history
  • Loading branch information
ljoss17 committed Oct 16, 2024
2 parents 205fe35 + 789cecc commit 849a48d
Show file tree
Hide file tree
Showing 20 changed files with 179 additions and 104 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- Update the versions of the following `simd` running the integration tests in the CI:
* From `v6.3.0` to `v6.3.1`
* From `v7.4.0` to `v7.8.0`
* From `v8.3.1` to `v8.5.1`
* From `v9.0.0-beta.1` to `v9.0.0-rc.0`

([\#4202](https://github.com/informalsystems/hermes/issues/4202))
1 change: 1 addition & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ ______
- [ ] Added tests: integration (for Hermes) or unit/mock tests (for modules).
- [ ] Linked to GitHub issue.
- [ ] Updated code comments and documentation (e.g., `docs/`).
- [ ] If guide has been updated, tag GitHub user `mircea-c`
- [ ] Tagged *one* reviewer who will be the one responsible for shepherding this PR.

### Reviewer checklist:
Expand Down
30 changes: 15 additions & 15 deletions Cargo.lock

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

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ tendermint-testgen = { version = "0.39.1" }
abscissa_core = "=0.6.0"
anyhow = "1.0"
async-stream = "0.3.5"
async-trait = "0.1.82"
async-trait = "0.1.83"
axum = "0.6.18"
bech32 = "0.9.1"
bitcoin = "0.31.2"
bs58 = "0.5.1"
byte-unit = { version = "4.0.19", default-features = false }
bytes = "1.7.1"
bytes = "1.7.2"
clap = "3.2"
clap_complete = "3.2"
color-eyre = "0.6"
Expand Down Expand Up @@ -89,15 +89,15 @@ primitive-types = { version = "0.12.1", default-features = false }
prometheus = "0.13.4"
prost = "0.13"
rand = "0.8.5"
regex = "1.10.6"
regex = "1.11.0"
reqwest = { version = "0.11.27", default-features = false }
retry = { version = "2.0.0", default-features = false }
ripemd = "0.1.3"
secp256k1 = "0.28.2"
semver = "1.0.21"
serde = "1.0.209"
serde = "1.0.210"
serde_derive = "1.0.104"
serde_json = "1.0.127"
serde_json = "1.0.128"
serde_yaml = "0.9.34"
serial_test = "3.1.1"
sha2 = "0.10.6"
Expand All @@ -106,7 +106,7 @@ signature = "2.1.0"
strum = "0.25"
subtle-encoding = "0.5.1"
test-log = "0.2.14"
thiserror = "1.0.63"
thiserror = "1.0.64"
time = "0.3"
tiny-bip39 = "1.0.0"
tiny-keccak = { version = "2.0.2", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion crates/chain-registry/src/querier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ impl QueryContext for GrpcHealthCheckQuerier {

info!("Querying gRPC server at {tendermint_url}");

create_grpc_client(uri, QueryClient::new)
create_grpc_client(&uri, QueryClient::new)
.await
.map_err(|_| RegistryError::unable_to_connect_with_grpc())?;

Expand Down
44 changes: 34 additions & 10 deletions crates/relayer-cli/src/commands/query/packet/commitments.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
use abscissa_core::clap::Parser;

use ibc_relayer::chain::counterparty::commitments_on_chain;
use ibc_relayer::chain::requests::Paginate;
use ibc_relayer::chain::handle::ChainHandle;
use ibc_relayer::chain::requests::{Paginate, QueryHeight};
use ibc_relayer_types::core::ics02_client::height::Height;
use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ChannelId, PortId};

use crate::cli_utils::spawn_chain_runtime;
use crate::conclude::Output;
use crate::conclude::{exit_with_unrecoverable_error, Output};
use crate::error::Error;
use crate::prelude::*;

Expand Down Expand Up @@ -40,6 +42,13 @@ pub struct QueryPacketCommitmentsCmd {
help = "Identifier of the channel to query"
)]
channel_id: ChannelId,

#[clap(
long = "height",
value_name = "HEIGHT",
help = "Height of the state to query. Leave unspecified for latest height."
)]
height: Option<u64>,
}

impl QueryPacketCommitmentsCmd {
Expand All @@ -48,12 +57,25 @@ impl QueryPacketCommitmentsCmd {

let chain = spawn_chain_runtime(&config, &self.chain_id)?;

commitments_on_chain(&chain, &self.port_id, &self.channel_id, Paginate::All)
.map_err(Error::supervisor)
.map(|(seqs_vec, height)| PacketSeqs {
height,
seqs: seqs_vec,
})
let query_height = self.height.map_or(QueryHeight::Latest, |revision_height| {
QueryHeight::Specific(
Height::new(chain.id().version(), revision_height)
.unwrap_or_else(exit_with_unrecoverable_error),
)
});

commitments_on_chain(
&chain,
&query_height,
&self.port_id,
&self.channel_id,
Paginate::All,
)
.map_err(Error::supervisor)
.map(|(seqs_vec, height)| PacketSeqs {
height,
seqs: seqs_vec,
})
}
}

Expand Down Expand Up @@ -85,7 +107,8 @@ mod tests {
QueryPacketCommitmentsCmd {
chain_id: ChainId::from_string("chain_id"),
port_id: PortId::from_str("port_id").unwrap(),
channel_id: ChannelId::from_str("channel-07").unwrap()
channel_id: ChannelId::from_str("channel-07").unwrap(),
height: None,
},
QueryPacketCommitmentsCmd::parse_from([
"test",
Expand All @@ -105,7 +128,8 @@ mod tests {
QueryPacketCommitmentsCmd {
chain_id: ChainId::from_string("chain_id"),
port_id: PortId::from_str("port_id").unwrap(),
channel_id: ChannelId::from_str("channel-07").unwrap()
channel_id: ChannelId::from_str("channel-07").unwrap(),
height: None,
},
QueryPacketCommitmentsCmd::parse_from([
"test",
Expand Down
47 changes: 28 additions & 19 deletions crates/relayer/src/chain/cosmos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ impl CosmosSdkChain {
crate::telemetry!(query, self.id(), "query_ccv_consumer_chain_params");

let mut client = self.block_on(create_grpc_client(
self.grpc_addr.clone(),
&self.grpc_addr,
ibc_proto::interchain_security::ccv::consumer::v1::query_client::QueryClient::new,
))?;

Expand Down Expand Up @@ -1238,7 +1238,7 @@ impl ChainEndpoint for CosmosSdkChain {
crate::telemetry!(query, self.id(), "query_clients");

let mut client = self.block_on(create_grpc_client(
self.grpc_addr.clone(),
&self.grpc_addr,
ibc_proto::ibc::core::client::v1::query_client::QueryClient::new,
))?;

Expand Down Expand Up @@ -1426,7 +1426,7 @@ impl ChainEndpoint for CosmosSdkChain {
crate::telemetry!(query, self.id(), "query_client_connections");

let mut client = self.block_on(create_grpc_client(
self.grpc_addr.clone(),
&self.grpc_addr,
ibc_proto::ibc::core::connection::v1::query_client::QueryClient::new,
))?;

Expand Down Expand Up @@ -1469,7 +1469,7 @@ impl ChainEndpoint for CosmosSdkChain {
crate::telemetry!(query, self.id(), "query_connections");

let mut client = self.block_on(create_grpc_client(
self.grpc_addr.clone(),
&self.grpc_addr,
ibc_proto::ibc::core::connection::v1::query_client::QueryClient::new,
))?;

Expand Down Expand Up @@ -1523,11 +1523,9 @@ impl ChainEndpoint for CosmosSdkChain {
use ibc_proto::ibc::core::connection::v1 as connection;
use tonic::IntoRequest;

let mut client = create_grpc_client(
chain.grpc_addr.clone(),
connection::query_client::QueryClient::new,
)
.await?;
let mut client =
create_grpc_client(&chain.grpc_addr, connection::query_client::QueryClient::new)
.await?;

client = client.max_decoding_message_size(
chain.config().max_grpc_decoding_size.get_bytes() as usize,
Expand Down Expand Up @@ -1606,7 +1604,7 @@ impl ChainEndpoint for CosmosSdkChain {
crate::telemetry!(query, self.id(), "query_connection_channels");

let mut client = self.block_on(create_grpc_client(
self.grpc_addr.clone(),
&self.grpc_addr,
ibc_proto::ibc::core::channel::v1::query_client::QueryClient::new,
))?;

Expand Down Expand Up @@ -1675,7 +1673,7 @@ impl ChainEndpoint for CosmosSdkChain {
crate::telemetry!(query, self.id(), "query_channels");

let mut client = self.block_on(create_grpc_client(
self.grpc_addr.clone(),
&self.grpc_addr,
ibc_proto::ibc::core::channel::v1::query_client::QueryClient::new,
))?;

Expand Down Expand Up @@ -1796,7 +1794,7 @@ impl ChainEndpoint for CosmosSdkChain {
crate::telemetry!(query, self.id(), "query_channel_client_state");

let mut client = self.block_on(create_grpc_client(
self.grpc_addr.clone(),
&self.grpc_addr,
ibc_proto::ibc::core::channel::v1::query_client::QueryClient::new,
))?;

Expand Down Expand Up @@ -1864,7 +1862,7 @@ impl ChainEndpoint for CosmosSdkChain {

let mut client = self
.block_on(create_grpc_client(
self.grpc_addr.clone(),
&self.grpc_addr,
ibc_proto::ibc::core::channel::v1::query_client::QueryClient::new,
))
.map(|client| {
Expand All @@ -1873,6 +1871,8 @@ impl ChainEndpoint for CosmosSdkChain {
)
})?;

let height_param = AsciiMetadataValue::try_from(request.query_height)?;

if request.pagination.is_enabled() {
let mut results = Vec::new();
let mut page_key = Vec::new();
Expand Down Expand Up @@ -1900,6 +1900,10 @@ impl ChainEndpoint for CosmosSdkChain {
// TODO: This should either be configurable or inferred from the pagination
tonic_request.set_timeout(Duration::from_secs(10));

tonic_request
.metadata_mut()
.insert("x-cosmos-block-height", height_param.clone());

let response = self.rt.block_on(async {
client
.packet_commitments(tonic_request)
Expand Down Expand Up @@ -1956,9 +1960,14 @@ impl ChainEndpoint for CosmosSdkChain {

Ok((commitment_sequences, height))
} else {
let request = tonic::Request::new(request.into());
let mut tonic_request = tonic::Request::new(request.clone().into());

tonic_request
.metadata_mut()
.insert("x-cosmos-block-height", height_param);

let response = self
.block_on(client.packet_commitments(request))
.block_on(client.packet_commitments(tonic_request))
.map_err(|e| Error::grpc_status(e, "query_packet_commitments".to_owned()))?
.into_inner();

Expand Down Expand Up @@ -2024,7 +2033,7 @@ impl ChainEndpoint for CosmosSdkChain {
crate::telemetry!(query, self.id(), "query_unreceived_packets");

let mut client = self.block_on(create_grpc_client(
self.grpc_addr.clone(),
&self.grpc_addr,
ibc_proto::ibc::core::channel::v1::query_client::QueryClient::new,
))?;

Expand Down Expand Up @@ -2097,7 +2106,7 @@ impl ChainEndpoint for CosmosSdkChain {

let mut client = self
.block_on(create_grpc_client(
self.grpc_addr.clone(),
&self.grpc_addr,
ibc_proto::ibc::core::channel::v1::query_client::QueryClient::new,
))
.map(|client| {
Expand Down Expand Up @@ -2215,7 +2224,7 @@ impl ChainEndpoint for CosmosSdkChain {
crate::telemetry!(query, self.id(), "query_unreceived_acknowledgements");

let mut client = self.block_on(create_grpc_client(
self.grpc_addr.clone(),
&self.grpc_addr,
ibc_proto::ibc::core::channel::v1::query_client::QueryClient::new,
))?;

Expand Down Expand Up @@ -2556,7 +2565,7 @@ impl ChainEndpoint for CosmosSdkChain {
crate::telemetry!(query, self.id(), "query_consumer_chains");

let mut client = self.block_on(create_grpc_client(
self.grpc_addr.clone(),
&self.grpc_addr,
ibc_proto::interchain_security::ccv::provider::v1::query_client::QueryClient::new,
))?;

Expand Down
Loading

0 comments on commit 849a48d

Please sign in to comment.