Skip to content

Commit 2ae3b64

Browse files
authoredMar 5, 2025··
feat(sequencer)!: implement RecoverClient action (#2008)
## Summary implement `RecoverClient` action which replaces an expired or otherwise inactive IBC client. this is based off `MsgRecoverClient` implemented in ibc-go v8: https://github.com/cosmos/ibc-go/blob/a71577cc1bf242f8c99360777106b1321503b17f/proto/ibc/core/client/v1/tx.proto#L126 ## Background there is no way to otherwise replace an expired IBC client without creating a new one and creating a governance proposal on the counterparty chain to change the client there, which is a lot more hassle than just being able to replace an expired client on one chain. ## Changes - implement `RecoverClient` action - the implementation is based off the following ibc-go implementation: - https://github.com/cosmos/ibc-go/blob/a71577cc1bf242f8c99360777106b1321503b17f/modules/core/02-client/keeper/client.go#L121 - https://github.com/cosmos/ibc-go/blob/a71577cc1bf242f8c99360777106b1321503b17f/modules/light-clients/07-tendermint/light_client_module.go#L179 - https://github.com/cosmos/ibc-go/blob/a71577cc1bf242f8c99360777106b1321503b17f/modules/light-clients/07-tendermint/proposal_handle.go#L29 - i had to export some types from penumbra (ConsensusStateWriteExt, ClientState) which is why it's on a different commit (commit is based off v0.80.7) ## Testing not yet, will be done on devnet ## Changelogs changelogs updated ## Breaking Changelist - a new action is added, which is a breaking change. ## Related Issues closes #2005
1 parent 71d63b8 commit 2ae3b64

39 files changed

+1846
-964
lines changed
 

‎Cargo.lock

+942-864
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml

+3-4
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,9 @@ itoa = "1.0.10"
8383
jsonrpsee = { version = "0.20" }
8484
pbjson-types = "0.6"
8585
# Note that when updating the penumbra versions, vendored types in `proto/sequencerapis/astria_vendored` may need to be updated as well.
86-
# can update to a tagged version when https://github.com/penumbra-zone/penumbra/commit/ac7abacc9bb09503d6fd6a396bc0b6850079084e is released
87-
penumbra-ibc = { git = "https://github.com/penumbra-zone/penumbra.git", rev = "ac7abacc9bb09503d6fd6a396bc0b6850079084e", default-features = false }
88-
penumbra-proto = { git = "https://github.com/penumbra-zone/penumbra.git", rev = "ac7abacc9bb09503d6fd6a396bc0b6850079084e" }
89-
penumbra-tower-trace = { git = "https://github.com/penumbra-zone/penumbra.git", rev = "ac7abacc9bb09503d6fd6a396bc0b6850079084e" }
86+
penumbra-ibc = { git = "https://github.com/penumbra-zone/penumbra.git", rev = "686fa5b53e8ad306736d2de61d1ffb6d11722e2b", default-features = false }
87+
penumbra-proto = { git = "https://github.com/penumbra-zone/penumbra.git", rev = "686fa5b53e8ad306736d2de61d1ffb6d11722e2b" }
88+
penumbra-tower-trace = { git = "https://github.com/penumbra-zone/penumbra.git", rev = "686fa5b53e8ad306736d2de61d1ffb6d11722e2b" }
9089
pin-project-lite = "0.2.13"
9190
prost = "0.12"
9291
rand = "0.8.5"

‎crates/astria-cli/src/sequencer/sudo/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use color_eyre::eyre;
33
mod fee_asset;
44
mod ibc_relayer;
55
mod ibc_sudo_change;
6+
mod recover_ibc_client;
67
mod sudo_address_change;
78
mod validator_update;
89

@@ -19,6 +20,7 @@ impl Command {
1920
SubCommand::FeeAsset(fee_asset) => fee_asset.run().await,
2021
SubCommand::SudoAddressChange(sudo_address_change) => sudo_address_change.run().await,
2122
SubCommand::ValidatorUpdate(validator_update) => validator_update.run().await,
23+
SubCommand::RecoverIbcClient(recover_ibc_client) => recover_ibc_client.run().await,
2224
SubCommand::IbcSudoAddressChange(ibc_sudo_address_change) => {
2325
ibc_sudo_address_change.run().await
2426
}
@@ -32,5 +34,6 @@ enum SubCommand {
3234
FeeAsset(fee_asset::Command),
3335
SudoAddressChange(sudo_address_change::Command),
3436
ValidatorUpdate(validator_update::Command),
37+
RecoverIbcClient(recover_ibc_client::Command),
3538
IbcSudoAddressChange(ibc_sudo_change::Command),
3639
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
use astria_core::protocol::transaction::v1::{
2+
action::RecoverIbcClient,
3+
Action,
4+
};
5+
use color_eyre::eyre::{
6+
self,
7+
WrapErr as _,
8+
};
9+
10+
use crate::utils::submit_transaction;
11+
12+
#[derive(Debug, clap::Args)]
13+
pub(super) struct Command {
14+
/// The bech32m prefix that will be used for constructing addresses using the private key
15+
#[arg(long, default_value = "astria")]
16+
prefix: String,
17+
// TODO: https://github.com/astriaorg/astria/issues/594
18+
// Don't use a plain text private, prefer wrapper like from
19+
// the secrecy crate with specialized `Debug` and `Drop` implementations
20+
// that overwrite the key on drop and don't reveal it when printing.
21+
#[arg(long, env = "SEQUENCER_PRIVATE_KEY")]
22+
private_key: String,
23+
/// The url of the Sequencer node
24+
#[arg(long, env = "SEQUENCER_URL")]
25+
sequencer_url: String,
26+
/// The chain id of the sequencing chain being used
27+
#[arg(long = "sequencer.chain-id", env = "ROLLUP_SEQUENCER_CHAIN_ID")]
28+
sequencer_chain_id: String,
29+
30+
/// The client id of the client to be replaced
31+
#[arg(long)]
32+
client_id: String,
33+
34+
/// The client id of the client to replace the subject client
35+
#[arg(long)]
36+
replacement_client_id: String,
37+
}
38+
39+
impl Command {
40+
pub(super) async fn run(self) -> eyre::Result<()> {
41+
let res = submit_transaction(
42+
self.sequencer_url.as_str(),
43+
self.sequencer_chain_id.clone(),
44+
&self.prefix,
45+
self.private_key.as_str(),
46+
Action::RecoverIbcClient(RecoverIbcClient {
47+
client_id: self.client_id.parse()?,
48+
replacement_client_id: self.replacement_client_id.parse()?,
49+
}),
50+
)
51+
.await
52+
.wrap_err("failed to submit RecoverIbcClient transaction")?;
53+
54+
println!("RecoverIbcClient completed!");
55+
println!("Included in block: {}", res.height);
56+
Ok(())
57+
}
58+
}

‎crates/astria-core/src/generated/astria.protocol.fees.v1.rs

+15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎crates/astria-core/src/generated/astria.protocol.fees.v1.serde.rs

+108
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎crates/astria-core/src/generated/astria.protocol.genesis.v1.rs

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎crates/astria-core/src/generated/astria.protocol.genesis.v1.serde.rs

+18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎crates/astria-core/src/generated/astria.protocol.transaction.v1.rs

+34-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
Please sign in to comment.