Skip to content

Commit

Permalink
Add a --denom option to the tx raw upgrade-chain command to make …
Browse files Browse the repository at this point in the history
…the deposit denomination configurable (#1790)

* Normalize Cargo.lock

Apply changes automatically made by cargo 1.58.0.

* --denom option for hermes tx raw upgrade-chain

Make the denomination string configurable in the chain upgrade proposal
issued by the `tx raw upgrade-chain` command.

* Changelog entries for #1790

* Improve the changelog entry for #1662 (the relayer-cli part)

Co-authored-by: Romain Ruetschi <romain@informal.systems>

* Fix typo in the doc for --denom option

Co-authored-by: Romain Ruetschi <romain@informal.systems>

* Use Option::as_deref

Co-authored-by: Romain Ruetschi <romain@informal.systems>
  • Loading branch information
mzabaluev and romac committed Jan 19, 2022
1 parent 242a9ff commit 2a4bc36
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Added a `denom` member to `upgrade_chain::UpgradePlanOptions`.
([#1662](https://github.com/informalsystems/ibc-rs/issues/1662))
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Make the deposit denomination configurable in `tx raw upgrade-chain` via a new `--denom` flag.
([#1662](https://github.com/informalsystems/ibc-rs/issues/1662))
25 changes: 7 additions & 18 deletions Cargo.lock

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

8 changes: 8 additions & 0 deletions relayer-cli/src/commands/tx/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ pub struct TxIbcUpgradeChainCmd {
)]
upgrade_name: Option<String>,

#[clap(
short = 'd',
long,
help = "denomination for the deposit (default: 'stake')"
)]
denom: Option<String>,

#[clap(
short = 'l',
long,
Expand Down Expand Up @@ -93,6 +100,7 @@ impl TxIbcUpgradeChainCmd {
src_chain_config: src_chain_config.clone(),
src_client_id: self.src_client_id.clone(),
amount: self.amount,
denom: self.denom.as_deref().unwrap_or("stake").into(),
height_offset: self.height_offset,
upgraded_chain_id: self
.new_chain_id
Expand Down
3 changes: 2 additions & 1 deletion relayer/src/upgrade_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ pub struct UpgradePlanOptions {
pub dst_chain_config: ChainConfig,
pub src_client_id: ClientId,
pub amount: u64,
pub denom: String,
pub height_offset: u64,
pub upgraded_chain_id: ChainId,
pub upgraded_unbonding_period: Option<Duration>,
Expand Down Expand Up @@ -115,7 +116,7 @@ pub fn build_and_send_ibc_upgrade_proposal(
let proposer = dst_chain.get_signer().map_err(UpgradeChainError::key)?;

let coins = ibc_proto::cosmos::base::v1beta1::Coin {
denom: "stake".to_string(),
denom: opts.denom.clone(),
amount: opts.amount.to_string(),
};

Expand Down

0 comments on commit 2a4bc36

Please sign in to comment.