Skip to content

Commit

Permalink
Merge branch 'master' into luca_joss/test-provenance-v1-19-1
Browse files Browse the repository at this point in the history
  • Loading branch information
ljoss17 committed Aug 12, 2024
2 parents 57527d4 + 012bb8b commit 4ff8e60
Show file tree
Hide file tree
Showing 21 changed files with 519 additions and 95 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Paginate results of `query_packet_commitments` and `query_packet_acknowledgements`
queries to speed up the scanning phase.
([\#4101](https://github.com/informalsystems/hermes/issues/4101))
3 changes: 2 additions & 1 deletion crates/relayer-cli/src/commands/query/packet/commitments.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use abscissa_core::clap::Parser;

use ibc_relayer::chain::counterparty::commitments_on_chain;
use ibc_relayer::chain::requests::Paginate;
use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ChannelId, PortId};

use crate::cli_utils::spawn_chain_runtime;
Expand Down Expand Up @@ -47,7 +48,7 @@ impl QueryPacketCommitmentsCmd {

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

commitments_on_chain(&chain, &self.port_id, &self.channel_id)
commitments_on_chain(&chain, &self.port_id, &self.channel_id, Paginate::All)
.map_err(Error::supervisor)
.map(|(seqs_vec, height)| PacketSeqs {
height,
Expand Down
19 changes: 15 additions & 4 deletions crates/relayer-cli/src/commands/query/packet/pending.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use ibc_relayer::chain::counterparty::{
channel_on_destination, pending_packet_summary, PendingPackets,
};
use ibc_relayer::chain::handle::{BaseChainHandle, ChainHandle};
use ibc_relayer::chain::requests::Paginate;
use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ChannelId, PortId};

use crate::cli_utils::spawn_chain_counterparty;
Expand Down Expand Up @@ -130,8 +131,13 @@ impl QueryPendingPacketsCmd {
self.chain_id, chan_conn_cli.channel
);

let src_summary = pending_packet_summary(&chains.src, &chains.dst, &chan_conn_cli.channel)
.map_err(Error::supervisor)?;
let src_summary = pending_packet_summary(
&chains.src,
&chains.dst,
&chan_conn_cli.channel,
Paginate::All,
)
.map_err(Error::supervisor)?;

let counterparty_channel = channel_on_destination(
&chan_conn_cli.channel,
Expand All @@ -141,8 +147,13 @@ impl QueryPendingPacketsCmd {
.map_err(Error::supervisor)?
.ok_or_else(|| Error::missing_counterparty_channel_id(chan_conn_cli.channel))?;

let dst_summary = pending_packet_summary(&chains.dst, &chains.src, &counterparty_channel)
.map_err(Error::supervisor)?;
let dst_summary = pending_packet_summary(
&chains.dst,
&chains.src,
&counterparty_channel,
Paginate::All,
)
.map_err(Error::supervisor)?;

Ok(Summary {
src_chain: chains.src.id(),
Expand Down
6 changes: 4 additions & 2 deletions crates/relayer-cli/src/commands/query/packet/pending_acks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use abscissa_core::clap::Parser;

use ibc_relayer::chain::counterparty::unreceived_acknowledgements;
use ibc_relayer::chain::handle::BaseChainHandle;
use ibc_relayer::chain::requests::Paginate;
use ibc_relayer::path::PathIdentifiers;
use ibc_relayer::util::collate::CollatedIterExt;
use ibc_relayer_types::core::ics04_channel::packet::Sequence;
Expand Down Expand Up @@ -68,8 +69,9 @@ impl QueryPendingAcksCmd {
let path_identifiers = PathIdentifiers::from_channel_end(channel.clone())
.ok_or_else(|| Error::missing_counterparty_channel_id(channel))?;

let acks = unreceived_acknowledgements(&chains.src, &chains.dst, &path_identifiers)
.map_err(Error::supervisor)?;
let acks =
unreceived_acknowledgements(&chains.src, &chains.dst, &path_identifiers, Paginate::All)
.map_err(Error::supervisor)?;

Ok(acks.map_or(vec![], |(sns, _)| sns))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use abscissa_core::clap::Parser;

use ibc_relayer::chain::counterparty::unreceived_packets;
use ibc_relayer::chain::handle::BaseChainHandle;
use ibc_relayer::chain::requests::Paginate;
use ibc_relayer::path::PathIdentifiers;
use ibc_relayer::util::collate::CollatedIterExt;
use ibc_relayer_types::core::ics04_channel::packet::Sequence;
Expand Down Expand Up @@ -68,7 +69,7 @@ impl QueryPendingSendsCmd {
let path_identifiers = PathIdentifiers::from_channel_end(channel.clone())
.ok_or_else(|| Error::missing_counterparty_channel_id(channel))?;

unreceived_packets(&chains.src, &chains.dst, &path_identifiers)
unreceived_packets(&chains.src, &chains.dst, &path_identifiers, Paginate::All)
.map_err(Error::supervisor)
.map(|(seq, _)| seq)
}
Expand Down
Loading

0 comments on commit 4ff8e60

Please sign in to comment.