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

feat(sequencer)!: implement RecoverClient action based on sequencer-v1.0.0 #2001

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

noot
Copy link
Collaborator

@noot noot commented Feb 26, 2025

Summary

implement RecoverClient action which replaces an expired or otherwise inactive IBC client.

this PR is based off the sequencer-v1.0.0 release tag.

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

Testing

not yet, will be done on devnet

Changelogs

Ensure all relevant changelog files are updated as necessary. See
keepachangelog for change
categories. Replace this text with e.g. "Changelogs updated." or "No updates
required." to acknowledge changelogs have been considered.

Breaking Changelist

  • a new action is added, which is a breaking change.

@noot noot requested review from SuperFluffy, Fraser999, a team and joroshiba as code owners February 26, 2025 04:41
@github-actions github-actions bot added proto pertaining to the Astria Protobuf spec sequencer pertaining to the astria-sequencer crate labels Feb 26, 2025
@noot noot added the docker-build used to trigger docker builds on PRs label Feb 26, 2025
@@ -22,6 +22,7 @@ message Action {
// IBC user actions are defined on 21-30
astria_vendored.penumbra.core.component.ibc.v1.IbcRelay ibc = 21;
Ics20Withdrawal ics20_withdrawal = 22;
RecoverClient recover_client = 23;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be under the POA sudo actions?

.address_bytes();
ensure!(
from == state
.get_sudo_address()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe utilize the ibc_sudo instead of the overall sudo? The authority that controls ibc access gates this as well?

}
}

message IbcSudoChange {
astria.primitive.v1.Address new_address = 1;
}

message RecoverClient {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we note this is IBC client call ie RecoverIbcClient?

Can we add a note above on what the exepcted outcome of the action is?

Comment on lines +241 to +242
// the client identifier for the client to be updated
string subject_client_id = 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know we copied this from cosmos, but their wording seems odd to me?

Propose we make this fieldclient_id to matches every other message in the client space which utilizes this as the field which action modifies.

Suggested change
// the client identifier for the client to be updated
string subject_client_id = 1;
// the client which action is applying to, and is being recovered
string client_id = 1;

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't really like just client_id as it's too ambiguous imo and will be more confusing reading the code. could do client_id_to_replace and substitute_client_id, or subject_client_id and replacement_client_id?

string subject_client_id = 1;
// the substitute client identifier for the client which will replace the subject
// client
string substitute_client_id = 2;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also change this to replacement_client_id? But I'm not super opinionated on this.

Main thing I find subject substitute requires to much brain thought for which is which. (Both start with sub, in other conversation you might say sub[stituted] out vs sub in ).

I think the client_id is the thing being recovered the replacement is very clearly the thing which is being put in its place.

.get_block_timestamp()
.await
.wrap_err("failed to get timestamp")?;
let subject_client_status = state
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similar nits as in proto on naming here just too many things starting with sub makes it a slower read?

let subject_client_status = state
.get_client_status(&self.subject_client_id, timestamp)
.await;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe new line not needed between the fetch/verification of object

let substitute_client_status = state
.get_client_status(&self.substitute_client_id, timestamp)
.await;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: same as above

)?;

subject_client_state.latest_height = substitute_client_state.latest_height;
subject_client_state.chain_id = substitute_client_state.chain_id;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we actually have an ensure block on this? To make it so that recovery can never change the chain being acted on?

I suppose there may be a usecase here were there was a hardfork in chain and client expired but assets are considered the same?

Chain id changing hardforks are rare, nearly all the time we probably want to replace with a client of the same chain id and not doing so would be a safety failure? I'd be ok just not supporting that usecase at this time, and having to evaluate what to do if it does come up?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the spec allows the chain ID to be changed - https://ibc.cosmos.network/architecture/adr-026-ibc-client-recovery-mechanisms/ although i'm not sure exactly why. this might be for the case you said where the counterparty forks and changes their chain ID, but we didn't do a client upgrade in time, which would invalidate the client.

@noot noot changed the title feat(sequencer)!: implement RecoverClient action feat(sequencer)!: implement RecoverClient action based on sequencer-v1.0.0 Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docker-build used to trigger docker builds on PRs proto pertaining to the Astria Protobuf spec sequencer pertaining to the astria-sequencer crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants