Skip to content

Commit 7a22a17

Browse files
mpokeinsumitybermuellsainoekirdatatjana
authored
feat!: Permissionless ICS (#2171)
* feat: first iteration on Permissionless ICS (#2117) * (partially) renamed chain ids to consumer ids * renamed proposal messages * removed global slash entry * fixed unit tests * added new messages * introduced new state * added functionality for the register and initialize messages * renamed (partially) chainIds to consumerIds * set consumerId to chainId association during registration * added extra check in the initialization so unknokwn, launched, or stopped chains cannot re-initialize * added initial work on traversing initialized chains that are to-be-launched * fixed rebase issues after bringing the VSCMaturedPackets work in * made it so we traverse initialization records instead of addition proposals (+ additional changes so the unit tests pass) * renamed more chainIDs to consumerIds * removed ClientIdToChainId state because chainId already resides on the registration record * nit fixes in go docs * removed MsgConsumerAddition * added CLI commands for new messages * removed consumer modification proposal * removed (partially) consumer removal proposal * rebased to pick up the inactive-validators work (PR #2079) * introduced consumerId in the equivocation messages (and a useful query for Hermes to get the consumerId) * added safeguard so that a validator cannot opt-in to two different chains with the same chain id * renamed some chainIDs to consumerIds * updated based on comments Co-authored-by: bernd-m <[email protected]> * fixed integration tests * rebased to pick up the removal of legacy proposals (#2130) and re-introduced old messages so that existing proposals can deserialize * changes messages to only have MsgCreateConsumer and MsgUpdateConsumer and modified protos so that we are backward-compatible * cleaned up slightly a few things (mostly committing & pushing) so people can pick up the latest changes * fixed the CreateConsumer and UpdateConsumer logic and made most of the fields optional * fixed hooks and the code around proposalId to consumerId * feat: extend consumer validator query to return commission rate (backport #2162) (#2165) * adapt #2162 changes for permissionless ICS * nits --------- Co-authored-by: kirdatatjana <[email protected]> * renamed some chainIds to consumerIds * took into account comments and also added safeguard to reject new proposals that still use deprecated messages (e.g., MsgConsumerAddition, etc.) * Update x/ccv/provider/types/msg.go Co-authored-by: bernd-m <[email protected]> * removed double-gas charge on MsgCreateConsumer and imroved the logic of MsgUpdateConsumer * added PopulateMinimumPowerInTopN tested * took into account comments (using protos for marshalling string slice, fixed issues in the UpdateConsumer logic, added extra check to abort spurious proposals) * feat: add fields to consumer validators query (#2167) * extend consumer validators query * nit * nits * fix msg order * deprecate power for consumer_power * modified the way we verify the new owner address, as well as nit refactoring on the ConsumerIds * fixed some rebase issues and changed a proto to be backward-compatible --------- Co-authored-by: bernd-m <[email protected]> Co-authored-by: Simon Noetzlin <[email protected]> Co-authored-by: kirdatatjana <[email protected]> * fixed bug on removing previous spawn time & added tests * added some additional tests * added tests on the hooks * removed check that spawn time is in the future * feat: refactor consumer validator set computation (#2175) * add UT * nits * address comments * Update x/ccv/provider/keeper/partial_set_security.go Co-authored-by: insumity <[email protected]> * fix tests --------- Co-authored-by: insumity <[email protected]> * fix!: ConsumerModificationProposal is needed in Gaia upgrade handler (#2176) ConsumerModificationProposal is needed in Gaia upgrade handler * fix: allow the owner of a chain to remove the chain (#2178) fixed access in RemoveConsumer * refactor: add proto enum for ConsumerPhase (#2182) * feat: extend `consumer_validators` query to return consumer valset before launch (#2164) * (partially) renamed chain ids to consumer ids * renamed proposal messages * removed global slash entry * fixed unit tests * added new messages * introduced new state * added functionality for the register and initialize messages * renamed (partially) chainIds to consumerIds * set consumerId to chainId association during registration * added extra check in the initialization so unknokwn, launched, or stopped chains cannot re-initialize * added initial work on traversing initialized chains that are to-be-launched * fixed rebase issues after bringing the VSCMaturedPackets work in * made it so we traverse initialization records instead of addition proposals (+ additional changes so the unit tests pass) * renamed more chainIDs to consumerIds * removed ClientIdToChainId state because chainId already resides on the registration record * nit fixes in go docs * removed MsgConsumerAddition * added CLI commands for new messages * removed consumer modification proposal * removed (partially) consumer removal proposal * rebased to pick up the inactive-validators work (PR #2079) * introduced consumerId in the equivocation messages (and a useful query for Hermes to get the consumerId) * added safeguard so that a validator cannot opt-in to two different chains with the same chain id * renamed some chainIDs to consumerIds * updated based on comments Co-authored-by: bernd-m <[email protected]> * fixed integration tests * rebased to pick up the removal of legacy proposals (#2130) and re-introduced old messages so that existing proposals can deserialize * changes messages to only have MsgCreateConsumer and MsgUpdateConsumer and modified protos so that we are backward-compatible * cleaned up slightly a few things (mostly committing & pushing) so people can pick up the latest changes * fixed the CreateConsumer and UpdateConsumer logic and made most of the fields optional * fixed hooks and the code around proposalId to consumerId * pre-spawn query * rebase * nits * feat: extend consumer validator query to return commission rate (backport #2162) (#2165) * adapt #2162 changes for permissionless ICS * nits --------- Co-authored-by: kirdatatjana <[email protected]> * remove panics * renamed some chainIds to consumerIds * took into account comments and also added safeguard to reject new proposals that still use deprecated messages (e.g., MsgConsumerAddition, etc.) * Update x/ccv/provider/types/msg.go Co-authored-by: bernd-m <[email protected]> * removed double-gas charge on MsgCreateConsumer and imroved the logic of MsgUpdateConsumer * added PopulateMinimumPowerInTopN tested * took into account comments (using protos for marshalling string slice, fixed issues in the UpdateConsumer logic, added extra check to abort spurious proposals) * update logic * took into account comments (using protos for marshalling string slice, fixed issues in the UpdateConsumer logic, added extra check to abort spurious proposals) * feat: add fields to consumer validators query (#2167) * extend consumer validators query * nit * nits * fix msg order * deprecate power for consumer_power * nits * feat: first iteration on Permissionless ICS (#2117) * (partially) renamed chain ids to consumer ids * renamed proposal messages * removed global slash entry * fixed unit tests * added new messages * introduced new state * added functionality for the register and initialize messages * renamed (partially) chainIds to consumerIds * set consumerId to chainId association during registration * added extra check in the initialization so unknokwn, launched, or stopped chains cannot re-initialize * added initial work on traversing initialized chains that are to-be-launched * fixed rebase issues after bringing the VSCMaturedPackets work in * made it so we traverse initialization records instead of addition proposals (+ additional changes so the unit tests pass) * renamed more chainIDs to consumerIds * removed ClientIdToChainId state because chainId already resides on the registration record * nit fixes in go docs * removed MsgConsumerAddition * added CLI commands for new messages * removed consumer modification proposal * removed (partially) consumer removal proposal * rebased to pick up the inactive-validators work (PR #2079) * introduced consumerId in the equivocation messages (and a useful query for Hermes to get the consumerId) * added safeguard so that a validator cannot opt-in to two different chains with the same chain id * renamed some chainIDs to consumerIds * updated based on comments Co-authored-by: bernd-m <[email protected]> * fixed integration tests * rebased to pick up the removal of legacy proposals (#2130) and re-introduced old messages so that existing proposals can deserialize * changes messages to only have MsgCreateConsumer and MsgUpdateConsumer and modified protos so that we are backward-compatible * cleaned up slightly a few things (mostly committing & pushing) so people can pick up the latest changes * fixed the CreateConsumer and UpdateConsumer logic and made most of the fields optional * fixed hooks and the code around proposalId to consumerId * feat: extend consumer validator query to return commission rate (backport #2162) (#2165) * adapt #2162 changes for permissionless ICS * nits --------- Co-authored-by: kirdatatjana <[email protected]> * renamed some chainIds to consumerIds * took into account comments and also added safeguard to reject new proposals that still use deprecated messages (e.g., MsgConsumerAddition, etc.) * Update x/ccv/provider/types/msg.go Co-authored-by: bernd-m <[email protected]> * removed double-gas charge on MsgCreateConsumer and imroved the logic of MsgUpdateConsumer * added PopulateMinimumPowerInTopN tested * took into account comments (using protos for marshalling string slice, fixed issues in the UpdateConsumer logic, added extra check to abort spurious proposals) * feat: add fields to consumer validators query (#2167) * extend consumer validators query * nit * nits * fix msg order * deprecate power for consumer_power * modified the way we verify the new owner address, as well as nit refactoring on the ConsumerIds * fixed some rebase issues and changed a proto to be backward-compatible --------- Co-authored-by: bernd-m <[email protected]> Co-authored-by: Simon Noetzlin <[email protected]> Co-authored-by: kirdatatjana <[email protected]> * cover stopped phase case * fixed bug on removing previous spawn time & added tests * added some additional tests * added tests on the hooks * removed check that spawn time is in the future * feat: refactor consumer validator set computation (#2175) * add UT * nits * address comments * Update x/ccv/provider/keeper/partial_set_security.go Co-authored-by: insumity <[email protected]> * fix tests --------- Co-authored-by: insumity <[email protected]> * nit * nits * nit --------- Co-authored-by: insumity <[email protected]> Co-authored-by: bernd-m <[email protected]> Co-authored-by: kirdatatjana <[email protected]> * fix build * tests: fix integration test setup (#2183) * fix integration test setup * fix integration tests * feat: add consumer chain query (#2179) * feat: first iteration on Permissionless ICS (#2117) * (partially) renamed chain ids to consumer ids * renamed proposal messages * removed global slash entry * fixed unit tests * added new messages * introduced new state * added functionality for the register and initialize messages * renamed (partially) chainIds to consumerIds * set consumerId to chainId association during registration * added extra check in the initialization so unknokwn, launched, or stopped chains cannot re-initialize * added initial work on traversing initialized chains that are to-be-launched * fixed rebase issues after bringing the VSCMaturedPackets work in * made it so we traverse initialization records instead of addition proposals (+ additional changes so the unit tests pass) * renamed more chainIDs to consumerIds * removed ClientIdToChainId state because chainId already resides on the registration record * nit fixes in go docs * removed MsgConsumerAddition * added CLI commands for new messages * removed consumer modification proposal * removed (partially) consumer removal proposal * rebased to pick up the inactive-validators work (PR #2079) * introduced consumerId in the equivocation messages (and a useful query for Hermes to get the consumerId) * added safeguard so that a validator cannot opt-in to two different chains with the same chain id * renamed some chainIDs to consumerIds * updated based on comments Co-authored-by: bernd-m <[email protected]> * fixed integration tests * rebased to pick up the removal of legacy proposals (#2130) and re-introduced old messages so that existing proposals can deserialize * changes messages to only have MsgCreateConsumer and MsgUpdateConsumer and modified protos so that we are backward-compatible * cleaned up slightly a few things (mostly committing & pushing) so people can pick up the latest changes * fixed the CreateConsumer and UpdateConsumer logic and made most of the fields optional * fixed hooks and the code around proposalId to consumerId * feat: extend consumer validator query to return commission rate (backport #2162) (#2165) * adapt #2162 changes for permissionless ICS * nits --------- Co-authored-by: kirdatatjana <[email protected]> * renamed some chainIds to consumerIds * took into account comments and also added safeguard to reject new proposals that still use deprecated messages (e.g., MsgConsumerAddition, etc.) * Update x/ccv/provider/types/msg.go Co-authored-by: bernd-m <[email protected]> * removed double-gas charge on MsgCreateConsumer and imroved the logic of MsgUpdateConsumer * added PopulateMinimumPowerInTopN tested * took into account comments (using protos for marshalling string slice, fixed issues in the UpdateConsumer logic, added extra check to abort spurious proposals) * feat: add fields to consumer validators query (#2167) * extend consumer validators query * nit * nits * fix msg order * deprecate power for consumer_power * modified the way we verify the new owner address, as well as nit refactoring on the ConsumerIds * fixed some rebase issues and changed a proto to be backward-compatible --------- Co-authored-by: bernd-m <[email protected]> Co-authored-by: Simon Noetzlin <[email protected]> Co-authored-by: kirdatatjana <[email protected]> * fixed bug on removing previous spawn time & added tests * added some additional tests * added tests on the hooks * removed check that spawn time is in the future * feat: refactor consumer validator set computation (#2175) * add UT * nits * address comments * Update x/ccv/provider/keeper/partial_set_security.go Co-authored-by: insumity <[email protected]> * fix tests --------- Co-authored-by: insumity <[email protected]> * add UT * nits * nits * revert legacy prop funcs * fix UT --------- Co-authored-by: insumity <[email protected]> Co-authored-by: bernd-m <[email protected]> Co-authored-by: kirdatatjana <[email protected]> * feat: extend consumer chains query (#2172) * feat: first iteration on Permissionless ICS (#2117) * (partially) renamed chain ids to consumer ids * renamed proposal messages * removed global slash entry * fixed unit tests * added new messages * introduced new state * added functionality for the register and initialize messages * renamed (partially) chainIds to consumerIds * set consumerId to chainId association during registration * added extra check in the initialization so unknokwn, launched, or stopped chains cannot re-initialize * added initial work on traversing initialized chains that are to-be-launched * fixed rebase issues after bringing the VSCMaturedPackets work in * made it so we traverse initialization records instead of addition proposals (+ additional changes so the unit tests pass) * renamed more chainIDs to consumerIds * removed ClientIdToChainId state because chainId already resides on the registration record * nit fixes in go docs * removed MsgConsumerAddition * added CLI commands for new messages * removed consumer modification proposal * removed (partially) consumer removal proposal * rebased to pick up the inactive-validators work (PR #2079) * introduced consumerId in the equivocation messages (and a useful query for Hermes to get the consumerId) * added safeguard so that a validator cannot opt-in to two different chains with the same chain id * renamed some chainIDs to consumerIds * updated based on comments Co-authored-by: bernd-m <[email protected]> * fixed integration tests * rebased to pick up the removal of legacy proposals (#2130) and re-introduced old messages so that existing proposals can deserialize * changes messages to only have MsgCreateConsumer and MsgUpdateConsumer and modified protos so that we are backward-compatible * cleaned up slightly a few things (mostly committing & pushing) so people can pick up the latest changes * fixed the CreateConsumer and UpdateConsumer logic and made most of the fields optional * fixed hooks and the code around proposalId to consumerId * feat: extend consumer validator query to return commission rate (backport #2162) (#2165) * adapt #2162 changes for permissionless ICS * nits --------- Co-authored-by: kirdatatjana <[email protected]> * renamed some chainIds to consumerIds * took into account comments and also added safeguard to reject new proposals that still use deprecated messages (e.g., MsgConsumerAddition, etc.) * Update x/ccv/provider/types/msg.go Co-authored-by: bernd-m <[email protected]> * removed double-gas charge on MsgCreateConsumer and imroved the logic of MsgUpdateConsumer * added PopulateMinimumPowerInTopN tested * took into account comments (using protos for marshalling string slice, fixed issues in the UpdateConsumer logic, added extra check to abort spurious proposals) * feat: add fields to consumer validators query (#2167) * extend consumer validators query * nit * nits * fix msg order * deprecate power for consumer_power * modified the way we verify the new owner address, as well as nit refactoring on the ConsumerIds * fixed some rebase issues and changed a proto to be backward-compatible --------- Co-authored-by: bernd-m <[email protected]> Co-authored-by: Simon Noetzlin <[email protected]> Co-authored-by: kirdatatjana <[email protected]> * add phase + metadata * first logic draft * add filter * reformat test * nits * nit * address comments * update tests * nits * update logic * update CLI * revert unwanted changes * remove filter field * nit * fix bad int conversion * update cli --------- Co-authored-by: insumity <[email protected]> Co-authored-by: bernd-m <[email protected]> Co-authored-by: kirdatatjana <[email protected]> * feat!: migrations for permissionless (#2174) * migrations for permissionless -- wip * feat!: migrations for permissionless (#2177) * initial commit * took into account comments * removed deprecated queries * fix error due to rebase * remove fields from provider genesis * remove commented code --------- Co-authored-by: insumity <[email protected]> * feat: update `consumer_chains` REST endpoint (#2188) update consumer chains REST endpoint * fix: permissionless added event + cli changes (#2185) * add consumer registration event * fix some queries, CLI and permissionless logic * cli changes * addressed review comments * fix!: several permissionless changes (#2189) * minor fixes in tests * replace IsConsumerProposedOrRegistered with IsConsumerActive * remove param from createStakingValidator * handle error in GetTopN * remove aux methods for getting PowerShapingParameters * remove default PowerShapingParameters * fix tests * handle error messages * fix: fix consumer chain query CLI (#2190) * fix consumer chains query cli * add consumer-chain cli command * fix consumer chains cli bug * fix!: fix store.set nil values (#2193) fix store.set nil values * fix!: msgs validation (#2195) * add testing for ValidateStringField * ValidateInitializationParameters * ValidatePowerShapingParameters * validate NewOwnerAddress * apply review suggestions * fix: fix queries' API REST endpoint path (#2196) * clean uw files * doc * Revert "doc" This reverts commit efc2718. * Revert "clean uw files" This reverts commit 5773cf3. * remove deprecated REST endpoints * update REST endpoint * fix broken UT by previous PR (#2195) * fix: permissionless query (#2191) * fix implementation * addressed comments * cleanup * keep metadata and powershaping data for stopped consumer chains * addressed comments * adapt unit-tests * refactor: mostly refactors (#2194) * handle errors * set the reverse index in SetConsumerClientId * rename method * create consumer_lifecycle.go with launch/stop logic * move methods around * move methods around * handle ChangeRewardDenoms * add TODOs * remove proposal_test * remove todos * apply review suggestions * apply review suggestions * fix UTs * fix!: provider msg validation (#2197) * validate MsgAssignConsumerKey * validate MsgSubmitConsumerMisbehaviour and MsgSubmitConsumerDoubleVoting * move RemoveConsumer * refactor: rearrange messages in msg.go * validate MsgOptIn and MsgOptOut * validate MsgSetConsumerCommissionRate * remove ValidateBasic for deprecated msgs * remove deprecated GetSigners * remove deprecated GetSignBytes * remove deprecated govv1beta1 validation * remove Route and Type * Update x/ccv/provider/keeper/msg_server.go Co-authored-by: insumity <[email protected]> * apply review suggestions * apply review suggestions --------- Co-authored-by: insumity <[email protected]> * test: fix e2e tests + PSS e2e tests use permissionless (#2192) Fix e2e tests + make PSS e2e tests use Permissionless ICS * refactor: power shaping (#2207) * update allowlist and denylist power shaping update * fix tests * refactor: move power shaping params to power_shaping.go * rename record to parameters * fix merge conflicts * feat: fix queries (#2209) * remove chain ID from all-pairs-valconsensus-address * add consumer_id to Chain * add GetAllLaunchedConsumerIds * fix UT * apply review suggestions * fix!: remove `stopTime` from `MsgRemoveConsumer` (#2208) * init commit * renamed stop time to removal time * fix errors in tests * add GetAllConsumerWithIBCClients * use GetAllConsumerWithIBCClients for efficiency * fix UTs * remove GetAllLaunchedConsumerIds as not needed * typo in GetAllConsumersWithIBCClients * improve comment * Apply suggestions from code review Co-authored-by: Marius Poke <[email protected]> * took into account comments --------- Co-authored-by: mpoke <[email protected]> * feat: remove provider migration for CV 3 to 6 (#2211) * remove migrations to CV < 7 * add changelog entry * fix version name * fix!: fix migration issue (#2214) * init commit * took into account comments * fix!: register `ConsumerModificationProposal` and others (#2215) init commit * fix: fix misbehaviour and equivocation evidence CLI commands (#2213) * silent errors in MBT driver * fix misbehaviour and double-signing CLI cmds + few nits * revert changes * nit: remove type prefix from consumer phase enum (#2220) remove type prefix in consumer phase enum * refactor: stop using signer field in messages (#2219) * remove error check * stop using signer field in messages * expand TODO comment * replace signer with submitter * fix UTs * chore: update TX CLI help (#2222) * update CLI help * apply review suggestions * feat!: add events for provider messages (#2221) * add events for CreateConsumer * add events for UpdateConsumer * add events for RemoveConsumer * add events for the rest of the messages * apply review suggestions * Id instead of ID * fix events * fix UT * remove duplicate AttributeSubmitterAddress * fix: fix queries' API endpoints (#2226) * endpoint fixes * Update proto/interchain_security/ccv/provider/v1/query.proto Co-authored-by: MSalopek <[email protected]> * Update proto/interchain_security/ccv/provider/v1/query.proto Co-authored-by: MSalopek <[email protected]> * generate proto --------- Co-authored-by: MSalopek <[email protected]> * fix!: replace CanLaunch with InitializeConsumer (#2224) replace CanLaunch with InitializeConsumer * fix: improve commands' description (#2227) init commit --------- Co-authored-by: insumity <[email protected]> Co-authored-by: bernd-m <[email protected]> Co-authored-by: Simon Noetzlin <[email protected]> Co-authored-by: kirdatatjana <[email protected]> Co-authored-by: MSalopek <[email protected]>
1 parent 29ad714 commit 7a22a17

File tree

111 files changed

+16142
-10466
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+16142
-10466
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- Remove provider migrations to consensus versions lower than 7.
2+
To migrate the provider module from consensus version 3, 4, or 5 to consensus version 7 or higher,
3+
users should use v4.3.x in production to migrate to consensus version 6.
4+
([\#2211](https://github.com/cosmos/interchain-security/pull/2211))

Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ install: go.sum
3333
go install -ldflags "$(democracyFlags)" ./cmd/interchain-security-cdd
3434
go install -ldflags "$(standaloneFlags)" ./cmd/interchain-security-sd
3535

36-
# run all tests: unit, integration, diff, and E2E
37-
test: test-unit test-integration test-mbt test-e2e
36+
# run all tests: unit, integration, and E2E
37+
test: test-unit test-integration test-e2e
3838

3939
# shortcut for local development
4040
test-dev: test-unit test-integration test-mbt
@@ -271,4 +271,4 @@ build-docs-local:
271271
###############################################################################
272272

273273
e2e-traces:
274-
cd tests/e2e; go test -timeout 30s -run ^TestWriteExamples -v
274+
cd tests/e2e; go test -timeout 30s -run ^TestWriteExamples -v

docs/docs/adrs/adr-019-permissionless-ics.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ consumer chains with the exact same `chainId`, and it is the responsibility of t
9595
to interact with by providing the right `consumerId`.
9696

9797
Note that with Permissionless ICS, all interactions on a consumer chain have to use the `consumerId` instead of the `chainId`.
98-
For example, if a validator opts in on a chain using `MsgOptIn`, the validator has to provide the `consumerId`. To also
99-
provide the `consumerId` for Top N consumers chains, we store a mapping between `proposalID` to `consumerId`. This storing
98+
For example, if a validator opts in on a chain using `MsgOptIn`, the validator has to provide the `consumerId`. To also provide the `consumerId` for Top N consumers chains, we store a mapping between `proposalID` to `consumerId`. This storing
10099
takes place in the [`AfterProposalSubmission`](https://github.com/cosmos/cosmos-sdk/blob/v0.50.8/x/gov/types/hooks.go#L19) hook.
101100
Specifically, for the equivocation evidence, we update the `MsgSubmitConsumerMisbehaviour` and `MsgSubmitConsumerDoubleVoting` messages to include the `consumerId`,
102101
and change [Hermes](https://github.com/informalsystems/hermes) to include `consumerId` in those constructed messages as well.
@@ -161,9 +160,9 @@ where `ConsumerRegistrationRecord` contains information about the to-be-launched
161160

162161
```protobuf
163162
message ConsumerRegistrationRecord {
164-
// the title of the chain to-be-launched
163+
// the title of the chain to-be-registered
165164
string title;
166-
// the description of the chain to-be-launched
165+
// the description of the chain to-be-registered
167166
string description;
168167
// the chain id of the new consumer chain
169168
string chain_id;
@@ -183,7 +182,7 @@ To move an Opt In consumer chain to its initialized phase, we issue a `MsgInitia
183182

184183
```protobuf
185184
message MsgInitializeConsumer {
186-
// consumer id of the to-be-updated consumer chain
185+
// consumer id of the to-be-initialized consumer chain
187186
string consumer_id;
188187
// the initialization record that contains initialization parameters for the upcoming chain
189188
ConsumerInitializationRecord initialization_record;
@@ -332,6 +331,9 @@ Because we only have two consumer chains at the moment, this is not going to be
332331
consumer chains that are being voted upon. Similarly, all the messages, queries, etc. would need to be changed to operate on a `consumerId`
333332
instead of a `chainId`.
334333

334+
To prevent a validator from accidentally opting in to a wrong chain, we disallow a validator from opting in to two or more
335+
different chains (different `consumerId`) with the same `chainId`.
336+
335337
It is **important** to migrate any ongoing `ConsumerAdditionProposal`s when we upgrade before we actually deprecate `ConsumerAdditionProposal`s.
336338

337339
## Consequences

proto/interchain_security/ccv/provider/v1/genesis.proto

+8-6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ message GenesisState {
1717
// Reserve 4th slot for removed mature_unbonding_ops field
1818
reserved 4;
1919

20+
// Reserve 6th slot for removed consumer_addition_proposals field
21+
reserved 6;
22+
23+
// Reserve 7th slot for removed consumer_removal_proposals field
24+
reserved 7;
25+
2026
// Reserve 11th slot for consumer_addrs_to_prune field
2127
reserved 11;
2228

@@ -36,12 +42,6 @@ message GenesisState {
3642
// empty for a new chain
3743
repeated ValsetUpdateIdToHeight valset_update_id_to_height = 5
3844
[ (gogoproto.nullable) = false ];
39-
// empty for a new chain
40-
repeated ConsumerAdditionProposal consumer_addition_proposals = 6
41-
[ (gogoproto.nullable) = false ];
42-
// empty for a new chain
43-
repeated ConsumerRemovalProposal consumer_removal_proposals = 7
44-
[ (gogoproto.nullable) = false ];
4545
Params params = 8 [ (gogoproto.nullable) = false ];
4646
// empty for a new chain
4747
repeated ValidatorConsumerPubKey validator_consumer_pubkeys = 9
@@ -78,6 +78,8 @@ message ConsumerState {
7878
repeated interchain_security.ccv.v1.ValidatorSetChangePacketData
7979
pending_valset_changes = 6 [ (gogoproto.nullable) = false ];
8080
repeated string slash_downtime_ack = 7;
81+
// the phase of the consumer chain
82+
ConsumerPhase phase = 9;
8183
}
8284

8385
// ValsetUpdateIdToHeight defines the genesis information for the mapping

proto/interchain_security/ccv/provider/v1/provider.proto

+123
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import "amino/amino.proto";
2121
// These schemas can change with proper consideration of compatibility or migration.
2222
//
2323

24+
// WARNING: This message is deprecated in favor of `MsgCreateConsumer`.
2425
// ConsumerAdditionProposal is a governance proposal on the provider chain to
2526
// spawn a new consumer chain. If it passes, then all validators on the provider
2627
// chain are expected to validate the consumer chain at spawn time or get
@@ -112,6 +113,7 @@ message ConsumerAdditionProposal {
112113
bool allow_inactive_vals = 21;
113114
}
114115

116+
// WARNING: This message is deprecated in favor of `MsgRemoveConsumer`.
115117
// ConsumerRemovalProposal is a governance proposal on the provider chain to
116118
// remove (and stop) a consumer chain. If it passes, all the consumer chain's
117119
// state is removed from the provider chain. The outstanding unbonding operation
@@ -132,6 +134,7 @@ message ConsumerRemovalProposal {
132134
[ (gogoproto.stdtime) = true, (gogoproto.nullable) = false ];
133135
}
134136

137+
// WARNING: This message is deprecated in favor of `MsgUpdateConsumer`.
135138
// ConsumerModificationProposal is a governance proposal on the provider chain to modify parameters of a running
136139
// consumer chain. If it passes, the consumer chain's state is updated to take into account the newest params.
137140
message ConsumerModificationProposal {
@@ -285,6 +288,7 @@ message ConsumerRemovalProposals {
285288
// AddressList contains a list of consensus addresses
286289
message AddressList { repeated bytes addresses = 1; }
287290

291+
// WARNING: This message is deprecated and is not used.
288292
// ChannelToChain is used to map a CCV channel ID to the consumer chainID
289293
message ChannelToChain {
290294
string channel_id = 1;
@@ -362,3 +366,122 @@ message ConsumerRewardsAllocation {
362366
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins"
363367
];
364368
}
369+
370+
// ConsumerMetadata contains general information about the registered chain
371+
message ConsumerMetadata {
372+
// the name of the chain
373+
string name = 1;
374+
// the description of the chain
375+
string description = 2;
376+
// the metadata (e.g., GitHub repository URL) of the chain
377+
string metadata = 3;
378+
}
379+
380+
// ConsumerInitializationParameters are the parameters needed to launch a chain
381+
message ConsumerInitializationParameters {
382+
// ---------- ---------- ----------
383+
// Following fields are used when the consumer chain launches and are not needed by the provider afterwards.
384+
// ---------- ---------- ----------
385+
386+
// the proposed initial height of new consumer chain.
387+
// For a completely new chain, this will be {0,1}. However, it may be
388+
// different if this is a chain that is converting to a consumer chain.
389+
ibc.core.client.v1.Height initial_height = 1 [ (gogoproto.nullable) = false ];
390+
// The hash of the consumer chain genesis state without the consumer CCV
391+
// module genesis params. It is used for off-chain confirmation of
392+
// genesis.json validity by validators and other parties.
393+
bytes genesis_hash = 2;
394+
// The hash of the consumer chain binary that should be run by validators on
395+
// chain initialization. It is used for off-chain confirmation of binary
396+
// validity by validators and other parties.
397+
bytes binary_hash = 3;
398+
// spawn time is the time on the provider chain at which the consumer chain
399+
// genesis is finalized and all validators will be responsible for starting
400+
// their consumer chain validator node.
401+
google.protobuf.Timestamp spawn_time = 4 [ (gogoproto.nullable) = false, (gogoproto.stdtime) = true ];
402+
// Unbonding period for the consumer,
403+
// which should be smaller than that of the provider in general.
404+
google.protobuf.Duration unbonding_period = 5 [ (gogoproto.nullable) = false, (gogoproto.stdduration) = true ];
405+
406+
407+
// ---------- ---------- ----------
408+
// Following fields are used to construct the consumer genesis of the to-be-launched consumer chain
409+
// and are set up as params on the consumer chain. Those params can then be directly modified by the consumer chain.
410+
// ---------- ---------- ----------
411+
412+
// Sent CCV related IBC packets will timeout after this duration
413+
google.protobuf.Duration ccv_timeout_period = 6 [ (gogoproto.nullable) = false, (gogoproto.stdduration) = true ];
414+
// Sent transfer related IBC packets will timeout after this duration
415+
google.protobuf.Duration transfer_timeout_period = 7 [ (gogoproto.nullable) = false, (gogoproto.stdduration) = true ];
416+
// The fraction of tokens allocated to the consumer redistribution address
417+
// during distribution events. The fraction is a string representing a
418+
// decimal number. For example "0.75" would represent 75%.
419+
string consumer_redistribution_fraction = 8;
420+
// BlocksPerDistributionTransmission is the number of blocks between
421+
// ibc-token-transfers from the consumer chain to the provider chain. On
422+
// sending transmission event, `consumer_redistribution_fraction` of the
423+
// accumulated tokens are sent to the consumer redistribution address.
424+
int64 blocks_per_distribution_transmission = 9;
425+
// The number of historical info entries to persist in store.
426+
// This param is a part of the cosmos sdk staking module. In the case of
427+
// a ccv enabled consumer chain, the ccv module acts as the staking module.
428+
int64 historical_entries = 10;
429+
// The ID of a token transfer channel used for the Reward Distribution
430+
// sub-protocol. If DistributionTransmissionChannel == "", a new transfer
431+
// channel is created on top of the same connection as the CCV channel.
432+
// Note that transfer_channel_id is the ID of the channel end on the consumer
433+
// chain. it is most relevant for chains performing a sovereign to consumer
434+
// changeover in order to maintain the existing ibc transfer channel
435+
string distribution_transmission_channel = 11;
436+
}
437+
438+
// PowerShapingParameters contains parameters that shape the validator set that we send to the consumer chain
439+
message PowerShapingParameters {
440+
// Corresponds to the percentage of validators that have to validate the chain under the Top N case.
441+
// For example, 53 corresponds to a Top 53% chain, meaning that the top 53% provider validators by voting power
442+
// have to validate the proposed consumer chain. top_N can either be 0 or any value in [50, 100].
443+
// A chain can join with top_N == 0 as an Opt In chain, or with top_N ∈ [50, 100] as a Top N chain.
444+
uint32 top_N = 1;
445+
// Corresponds to the maximum power (percentage-wise) a validator can have on the consumer chain. For instance, if
446+
// `validators_power_cap` is set to 32, it means that no validator can have more than 32% of the voting power on the
447+
// consumer chain. Note that this might not be feasible. For example, think of a consumer chain with only
448+
// 5 validators and with `validators_power_cap` set to 10%. In such a scenario, at least one validator would need
449+
// to have more than 20% of the total voting power. Therefore, `validators_power_cap` operates on a best-effort basis.
450+
uint32 validators_power_cap = 2;
451+
// Corresponds to the maximum number of validators that can validate a consumer chain.
452+
// Only applicable to Opt In chains. Setting `validator_set_cap` on a Top N chain is a no-op.
453+
uint32 validator_set_cap = 3;
454+
// corresponds to a list of provider consensus addresses of validators that are the ONLY ones that can validate the consumer chain
455+
repeated string allowlist = 4;
456+
// corresponds to a list of provider consensus addresses of validators that CANNOT validate the consumer chain
457+
repeated string denylist = 5;
458+
// Corresponds to the minimal amount of (provider chain) stake required to validate on the consumer chain.
459+
uint64 min_stake = 6;
460+
// Corresponds to whether inactive validators are allowed to validate the consumer chain.
461+
bool allow_inactive_vals = 7;
462+
}
463+
464+
// ConsumerIds contains consumer ids of chains
465+
// Used so we can easily (de)serialize slices of strings
466+
message ConsumerIds { repeated string ids = 1; }
467+
468+
// ConsumerPhase indicates the phases of a consumer chain according to ADR 019
469+
enum ConsumerPhase {
470+
option (gogoproto.goproto_enum_prefix) = false;
471+
472+
// UNSPECIFIED defines an empty phase.
473+
CONSUMER_PHASE_UNSPECIFIED = 0;
474+
// REGISTERED defines the phase in which a consumer chain has been assigned a unique consumer id.
475+
// A chain in this phase cannot yet launch.
476+
CONSUMER_PHASE_REGISTERED = 1;
477+
// INITIALIZED defines the phase in which a consumer chain has set all the needed parameters to launch but
478+
// has not yet launched (e.g., because the `spawnTime` of the consumer chain has not yet been reached).
479+
CONSUMER_PHASE_INITIALIZED = 2;
480+
// LAUNCHED defines the phase in which a consumer chain is running and consuming a subset of the validator
481+
// set of the provider.
482+
CONSUMER_PHASE_LAUNCHED = 3;
483+
// STOPPED defines the phase in which a previously-launched chain has stopped.
484+
CONSUMER_PHASE_STOPPED = 4;
485+
// DELETED defines the phase in which the state of a stopped chain has been deleted.
486+
CONSUMER_PHASE_DELETED = 5;
487+
}

0 commit comments

Comments
 (0)