-
Notifications
You must be signed in to change notification settings - Fork 122
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!: enable standalone consumers to reuse existing clients for ICS #2400
base: main
Are you sure you want to change the base?
Changes from all commits
34409d7
d496224
29c8d9a
85e9a53
0540cbf
049dd9e
6c50702
fa189f5
81536d8
b07b3ab
940596d
5241586
bc51f31
1fa7866
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
- Enable existing (standalone) chains to use the existing client (and connection) | ||
to the provider chain when becoming a consumer chain. This feature introduces | ||
the following API-breaking changes. | ||
([\#2400](https://github.com/cosmos/interchain-security/pull/2400)) | ||
|
||
- Add `connection_id` and `preCCV` to `ConsumerGenesisState`, the consumer | ||
genesis state created by the provider chain. If the `connection_id` is not empty, | ||
`preCCV` is set to true and both `provider.client_state` and `provider.consensus_state` | ||
are set to nil (as the consumer doesn't need to create a new provider client). | ||
As a result, for older versions of consumers, the `connection_id` in | ||
`ConsumerInitializationParameters` must be empty and the resulting `ConsumerGenesisState` | ||
needs to be adapted, i.e., both `connection_id` and `preCCV` need to be removed. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
- Enable existing (standalone) chains to use the existing client (and connection) | ||
to the provider chain when becoming a consumer chain. This feature introduces | ||
the following changes. | ||
([\#2400](https://github.com/cosmos/interchain-security/pull/2400)) | ||
|
||
- Add `connection_id` to `ConsumerInitializationParameters`, the ID of | ||
the connection end _on the provider chain_ on top of which the CCV channel will | ||
be established. Consumer chain owners can set `connection_id` to a valid ID in | ||
order to reuse the underlying clients. | ||
- Add `connection_id` to the consumer genesis state, the ID of the connection | ||
end _on the consumer chain_ on top of which the CCV channel will be established. | ||
If `connection_id` is a valid ID, then the consumer chain will use the underlying | ||
client as the provider client and it will initiate the channel handshake. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
- Enable existing (standalone) chains to use the existing client (and connection) | ||
to the provider chain when becoming a consumer chain. | ||
([\#2400](https://github.com/cosmos/interchain-security/pull/2400)) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,16 +87,27 @@ message ConsumerParams { | |
message ConsumerGenesisState { | ||
ConsumerParams params = 1 [ (gogoproto.nullable) = false ]; | ||
ProviderInfo provider = 2 [ (gogoproto.nullable) = false ]; | ||
// true for new chain, false for chain restart. | ||
bool new_chain = 3; // TODO:Check if this is really needed | ||
// True for new chain, false for chain restart. | ||
// This is needed and always set to true; otherwise, new_chain in the consumer | ||
// genesis state will default to false | ||
bool new_chain = 3; | ||
// Flag indicating whether the consumer CCV module starts in pre-CCV state | ||
bool preCCV = 4; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A little problematic to understand why there's Not: Maybe consider uniform snakecase/camelcase usage. (I don't have strong feelings, feel free to ignore). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. preCCV is already a field in the consumer genesis, so I cannot change the name without breaking compatibility. |
||
// The ID of the connection end on the consumer chain on top of which the | ||
// CCV channel will be established. If connection_id == "", a new client of | ||
// the provider chain and a new connection on top of this client are created. | ||
// The new client is initialized using client_state and consensus_state. | ||
string connection_id = 5; | ||
} | ||
|
||
// ProviderInfo defines all information a consumer needs from a provider | ||
// Shared data type between provider and consumer | ||
message ProviderInfo { | ||
// ProviderClientState filled in on new chain, nil on restart. | ||
// The client state for the provider client filled in on new chain, nil on restart. | ||
// If connection_id != "", then client_state is ignored. | ||
ibc.lightclients.tendermint.v1.ClientState client_state = 1; | ||
// ProviderConsensusState filled in on new chain, nil on restart. | ||
// The consensus state for the provider client filled in on new chain, nil on restart. | ||
// If connection_id != "", then consensus_state is ignored. | ||
ibc.lightclients.tendermint.v1.ConsensusState consensus_state = 2; | ||
// InitialValset filled in on new chain and on restart. | ||
repeated .tendermint.abci.ValidatorUpdate initial_val_set = 3 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: is any of the code below needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's how the changeover is done. The chain needs to read the new validator set from somewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I understand. Why are we calling InitGenesis. This should be automatically called when adding a new module to the chain.