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

Fix clear packets CLI bug where counterparty_channel_id cannot be found #3890

Merged
merged 2 commits into from
Mar 12, 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,3 @@
- Correctly use the counterparty channel and port IDs when clearing the packets
from the destination chain to the source chain in the `packet clear` command
([\#3889](https://github.com/informalsystems/hermes/issues/3889))
15 changes: 13 additions & 2 deletions crates/relayer-cli/src/commands/clear.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use eyre::eyre;
use std::ops::RangeInclusive;

use abscissa_core::clap::Parser;
Expand Down Expand Up @@ -187,10 +188,20 @@ impl Runnable for ClearPacketsCmd {
exclude_src_sequences,
};

let counterparty_channel_id = match channel.counterparty().channel_id() {
Some(channel_id) => channel_id.clone(),
None => Output::error(eyre!(
"Channel `{}` and port `{}` does not have a counterparty channel id",
self.channel_id,
self.port_id
))
.exit(),
};

// Construct links in both directions.
let reverse_opts = LinkParameters {
src_port_id: self.port_id.clone(),
src_channel_id: self.channel_id.clone(),
src_port_id: channel.counterparty().port_id().clone(),
src_channel_id: counterparty_channel_id,
max_memo_size: config.mode.packets.ics20_max_memo_size,
max_receiver_size: config.mode.packets.ics20_max_receiver_size,
exclude_src_sequences: exclude_dst_sequences,
Expand Down
Loading