From 05fd5f37d923735e411edc5e02da027ae5efe706 Mon Sep 17 00:00:00 2001 From: insumity Date: Mon, 26 Aug 2024 11:02:15 +0200 Subject: [PATCH 01/17] 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 <43466467+bermuell@users.noreply.github.com> * 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 <116630536+kirdatatjana@users.noreply.github.com> * 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 <43466467+bermuell@users.noreply.github.com> * 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 <43466467+bermuell@users.noreply.github.com> Co-authored-by: Simon Noetzlin Co-authored-by: kirdatatjana <116630536+kirdatatjana@users.noreply.github.com> --- Makefile | 6 +- docs/docs/adrs/adr-019-permissionless-ics.md | 12 +- .../ccv/provider/v1/provider.proto | 102 + .../ccv/provider/v1/query.proto | 140 +- .../ccv/provider/v1/tx.proto | 139 +- tests/integration/common.go | 2 +- tests/integration/distribution.go | 50 +- tests/integration/double_vote.go | 55 +- tests/integration/expired_client.go | 10 +- tests/integration/key_assignment.go | 32 +- tests/integration/misbehaviour.go | 44 +- .../integration/partial_set_security_test.go | 5 +- tests/integration/provider_gov_hooks.go | 44 +- tests/integration/setup.go | 45 +- tests/integration/slashing.go | 10 +- tests/integration/stop_consumer.go | 26 +- tests/mbt/driver/core.go | 6 +- tests/mbt/driver/setup.go | 5 +- testutil/ibc_testing/generic_setup.go | 48 +- testutil/keeper/mocks.go | 14 + testutil/keeper/unit_test_helpers.go | 86 +- x/ccv/provider/client/cli/query.go | 42 +- x/ccv/provider/client/cli/tx.go | 207 ++ x/ccv/provider/handler.go | 9 + x/ccv/provider/handler_test.go | 62 +- x/ccv/provider/ibc_middleware.go | 6 +- x/ccv/provider/ibc_module_test.go | 27 +- .../provider/keeper/consumer_equivocation.go | 82 +- x/ccv/provider/keeper/distribution.go | 63 +- x/ccv/provider/keeper/distribution_test.go | 4 +- x/ccv/provider/keeper/genesis.go | 32 +- x/ccv/provider/keeper/genesis_test.go | 4 +- x/ccv/provider/keeper/grpc_query.go | 190 +- x/ccv/provider/keeper/grpc_query_test.go | 158 +- x/ccv/provider/keeper/hooks.go | 74 +- x/ccv/provider/keeper/hooks_test.go | 23 +- x/ccv/provider/keeper/keeper.go | 575 ++-- x/ccv/provider/keeper/keeper_test.go | 257 +- x/ccv/provider/keeper/key_assignment.go | 175 +- x/ccv/provider/keeper/key_assignment_test.go | 92 +- x/ccv/provider/keeper/legacy_proposal.go | 87 +- x/ccv/provider/keeper/legacy_proposal_test.go | 206 +- x/ccv/provider/keeper/msg_server.go | 220 +- x/ccv/provider/keeper/msg_server_test.go | 55 + x/ccv/provider/keeper/partial_set_security.go | 122 +- .../keeper/partial_set_security_test.go | 219 +- x/ccv/provider/keeper/permissionless.go | 747 +++++ x/ccv/provider/keeper/permissionless_test.go | 384 +++ x/ccv/provider/keeper/proposal.go | 423 ++- x/ccv/provider/keeper/proposal_test.go | 802 ++--- x/ccv/provider/keeper/relay.go | 104 +- x/ccv/provider/keeper/relay_test.go | 61 +- x/ccv/provider/keeper/validator_set_update.go | 56 +- .../keeper/validator_set_update_test.go | 29 +- .../provider/migrations/v5/migration_test.go | 6 +- x/ccv/provider/migrations/v5/migrations.go | 9 +- x/ccv/provider/migrations/v6/migrations.go | 9 +- x/ccv/provider/module.go | 5 +- x/ccv/provider/module_test.go | 4 +- x/ccv/provider/proposal_handler.go | 6 +- x/ccv/provider/proposal_handler_test.go | 52 +- x/ccv/provider/types/codec.go | 9 +- x/ccv/provider/types/errors.go | 67 +- x/ccv/provider/types/events.go | 2 +- x/ccv/provider/types/keys.go | 472 +-- x/ccv/provider/types/keys_test.go | 105 +- x/ccv/provider/types/legacy_proposal.go | 54 +- x/ccv/provider/types/legacy_proposal_test.go | 96 +- x/ccv/provider/types/msg.go | 459 ++- x/ccv/provider/types/msg_test.go | 21 + x/ccv/provider/types/provider.pb.go | 1906 +++++++++++- x/ccv/provider/types/query.pb.go | 1883 ++++++++++-- x/ccv/provider/types/query.pb.gw.go | 852 +++++- x/ccv/provider/types/throttle.go | 17 - x/ccv/provider/types/tx.pb.go | 2639 ++++++++++++++--- x/ccv/types/expected_keepers.go | 1 + 76 files changed, 11356 insertions(+), 3796 deletions(-) create mode 100644 x/ccv/provider/keeper/msg_server_test.go create mode 100644 x/ccv/provider/keeper/permissionless.go create mode 100644 x/ccv/provider/keeper/permissionless_test.go create mode 100644 x/ccv/provider/types/msg_test.go delete mode 100644 x/ccv/provider/types/throttle.go diff --git a/Makefile b/Makefile index 1e8eb8e5bc..ec2493c9b4 100644 --- a/Makefile +++ b/Makefile @@ -33,8 +33,8 @@ install: go.sum go install -ldflags "$(democracyFlags)" ./cmd/interchain-security-cdd go install -ldflags "$(standaloneFlags)" ./cmd/interchain-security-sd -# run all tests: unit, integration, diff, and E2E -test: test-unit test-integration test-mbt test-e2e +# run all tests: unit, integration, and E2E +test: test-unit test-integration test-e2e # shortcut for local development test-dev: test-unit test-integration test-mbt @@ -271,4 +271,4 @@ build-docs-local: ############################################################################### e2e-traces: - cd tests/e2e; go test -timeout 30s -run ^TestWriteExamples -v \ No newline at end of file + cd tests/e2e; go test -timeout 30s -run ^TestWriteExamples -v diff --git a/docs/docs/adrs/adr-019-permissionless-ics.md b/docs/docs/adrs/adr-019-permissionless-ics.md index 59b13659a4..70273ee2f3 100644 --- a/docs/docs/adrs/adr-019-permissionless-ics.md +++ b/docs/docs/adrs/adr-019-permissionless-ics.md @@ -95,8 +95,7 @@ consumer chains with the exact same `chainId`, and it is the responsibility of t to interact with by providing the right `consumerId`. Note that with Permissionless ICS, all interactions on a consumer chain have to use the `consumerId` instead of the `chainId`. -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 +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 takes place in the [`AfterProposalSubmission`](https://github.com/cosmos/cosmos-sdk/blob/v0.50.8/x/gov/types/hooks.go#L19) hook. Specifically, for the equivocation evidence, we update the `MsgSubmitConsumerMisbehaviour` and `MsgSubmitConsumerDoubleVoting` messages to include the `consumerId`, 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 ```protobuf message ConsumerRegistrationRecord { - // the title of the chain to-be-launched + // the title of the chain to-be-registered string title; - // the description of the chain to-be-launched + // the description of the chain to-be-registered string description; // the chain id of the new consumer chain string chain_id; @@ -183,7 +182,7 @@ To move an Opt In consumer chain to its initialized phase, we issue a `MsgInitia ```protobuf message MsgInitializeConsumer { - // consumer id of the to-be-updated consumer chain + // consumer id of the to-be-initialized consumer chain string consumer_id; // the initialization record that contains initialization parameters for the upcoming chain ConsumerInitializationRecord initialization_record; @@ -332,6 +331,9 @@ Because we only have two consumer chains at the moment, this is not going to be consumer chains that are being voted upon. Similarly, all the messages, queries, etc. would need to be changed to operate on a `consumerId` instead of a `chainId`. +To prevent a validator from accidentally opting in to a wrong chain, we disallow a validator from opting in to two or more +different chains (different `consumerId`) with the same `chainId`. + It is **important** to migrate any ongoing `ConsumerAdditionProposal`s when we upgrade before we actually deprecate `ConsumerAdditionProposal`s. ## Consequences diff --git a/proto/interchain_security/ccv/provider/v1/provider.proto b/proto/interchain_security/ccv/provider/v1/provider.proto index 7e1836cf38..7204d5754b 100644 --- a/proto/interchain_security/ccv/provider/v1/provider.proto +++ b/proto/interchain_security/ccv/provider/v1/provider.proto @@ -21,6 +21,7 @@ import "amino/amino.proto"; // These schemas can change with proper consideration of compatibility or migration. // +// WARNING: This message is deprecated in favor of `MsgCreateConsumer`. // ConsumerAdditionProposal is a governance proposal on the provider chain to // spawn a new consumer chain. If it passes, then all validators on the provider // chain are expected to validate the consumer chain at spawn time or get @@ -112,6 +113,7 @@ message ConsumerAdditionProposal { bool allow_inactive_vals = 21; } +// WARNING: This message is deprecated in favor of `MsgRemoveConsumer`. // ConsumerRemovalProposal is a governance proposal on the provider chain to // remove (and stop) a consumer chain. If it passes, all the consumer chain's // state is removed from the provider chain. The outstanding unbonding operation @@ -132,6 +134,7 @@ message ConsumerRemovalProposal { [ (gogoproto.stdtime) = true, (gogoproto.nullable) = false ]; } +// WARNING: This message is deprecated in favor of `MsgUpdateConsumer`. // ConsumerModificationProposal is a governance proposal on the provider chain to modify parameters of a running // consumer chain. If it passes, the consumer chain's state is updated to take into account the newest params. message ConsumerModificationProposal { @@ -285,6 +288,7 @@ message ConsumerRemovalProposals { // AddressList contains a list of consensus addresses message AddressList { repeated bytes addresses = 1; } +// WARNING: This message is deprecated and is not used. // ChannelToChain is used to map a CCV channel ID to the consumer chainID message ChannelToChain { string channel_id = 1; @@ -362,3 +366,101 @@ message ConsumerRewardsAllocation { (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins" ]; } + +// ConsumerMetadata contains general information about the registered chain +message ConsumerMetadata { + // the name of the chain + string name = 1; + // the description of the chain + string description = 2; + // the metadata (e.g., GitHub repository URL) of the chain + string metadata = 3; +} + +// ConsumerInitializationParameters are the parameters needed to launch a chain +message ConsumerInitializationParameters { + // ---------- ---------- ---------- + // Following fields are used when the consumer chain launches and are not needed by the provider afterwards. + // ---------- ---------- ---------- + + // the proposed initial height of new consumer chain. + // For a completely new chain, this will be {0,1}. However, it may be + // different if this is a chain that is converting to a consumer chain. + ibc.core.client.v1.Height initial_height = 1 [ (gogoproto.nullable) = false ]; + // The hash of the consumer chain genesis state without the consumer CCV + // module genesis params. It is used for off-chain confirmation of + // genesis.json validity by validators and other parties. + bytes genesis_hash = 2; + // The hash of the consumer chain binary that should be run by validators on + // chain initialization. It is used for off-chain confirmation of binary + // validity by validators and other parties. + bytes binary_hash = 3; + // spawn time is the time on the provider chain at which the consumer chain + // genesis is finalized and all validators will be responsible for starting + // their consumer chain validator node. + google.protobuf.Timestamp spawn_time = 4 [ (gogoproto.nullable) = false, (gogoproto.stdtime) = true ]; + // Unbonding period for the consumer, + // which should be smaller than that of the provider in general. + google.protobuf.Duration unbonding_period = 5 [ (gogoproto.nullable) = false, (gogoproto.stdduration) = true ]; + + + // ---------- ---------- ---------- + // Following fields are used to construct the consumer genesis of the to-be-launched consumer chain + // and are set up as params on the consumer chain. Those params can then be directly modified by the consumer chain. + // ---------- ---------- ---------- + + // Sent CCV related IBC packets will timeout after this duration + google.protobuf.Duration ccv_timeout_period = 6 [ (gogoproto.nullable) = false, (gogoproto.stdduration) = true ]; + // Sent transfer related IBC packets will timeout after this duration + google.protobuf.Duration transfer_timeout_period = 7 [ (gogoproto.nullable) = false, (gogoproto.stdduration) = true ]; + // The fraction of tokens allocated to the consumer redistribution address + // during distribution events. The fraction is a string representing a + // decimal number. For example "0.75" would represent 75%. + string consumer_redistribution_fraction = 8; + // BlocksPerDistributionTransmission is the number of blocks between + // ibc-token-transfers from the consumer chain to the provider chain. On + // sending transmission event, `consumer_redistribution_fraction` of the + // accumulated tokens are sent to the consumer redistribution address. + int64 blocks_per_distribution_transmission = 9; + // The number of historical info entries to persist in store. + // This param is a part of the cosmos sdk staking module. In the case of + // a ccv enabled consumer chain, the ccv module acts as the staking module. + int64 historical_entries = 10; + // The ID of a token transfer channel used for the Reward Distribution + // sub-protocol. If DistributionTransmissionChannel == "", a new transfer + // channel is created on top of the same connection as the CCV channel. + // Note that transfer_channel_id is the ID of the channel end on the consumer + // chain. it is most relevant for chains performing a sovereign to consumer + // changeover in order to maintain the existing ibc transfer channel + string distribution_transmission_channel = 11; +} + +// PowerShapingParameters contains parameters that shape the validator set that we send to the consumer chain +message PowerShapingParameters { + // Corresponds to the percentage of validators that have to validate the chain under the Top N case. + // For example, 53 corresponds to a Top 53% chain, meaning that the top 53% provider validators by voting power + // have to validate the proposed consumer chain. top_N can either be 0 or any value in [50, 100]. + // A chain can join with top_N == 0 as an Opt In chain, or with top_N ∈ [50, 100] as a Top N chain. + uint32 top_N = 1; + // Corresponds to the maximum power (percentage-wise) a validator can have on the consumer chain. For instance, if + // `validators_power_cap` is set to 32, it means that no validator can have more than 32% of the voting power on the + // consumer chain. Note that this might not be feasible. For example, think of a consumer chain with only + // 5 validators and with `validators_power_cap` set to 10%. In such a scenario, at least one validator would need + // to have more than 20% of the total voting power. Therefore, `validators_power_cap` operates on a best-effort basis. + uint32 validators_power_cap = 2; + // Corresponds to the maximum number of validators that can validate a consumer chain. + // Only applicable to Opt In chains. Setting `validator_set_cap` on a Top N chain is a no-op. + uint32 validator_set_cap = 3; + // corresponds to a list of provider consensus addresses of validators that are the ONLY ones that can validate the consumer chain + repeated string allowlist = 4; + // corresponds to a list of provider consensus addresses of validators that CANNOT validate the consumer chain + repeated string denylist = 5; + // Corresponds to the minimal amount of (provider chain) stake required to validate on the consumer chain. + uint64 min_stake = 6; + // Corresponds to whether inactive validators are allowed to validate the consumer chain. + bool allow_inactive_vals = 7; +} + +// ConsumerIds contains consumer ids of chains +// Used so we can easily (de)serialize slices of strings +message ConsumerIds { repeated string ids = 1; } diff --git a/proto/interchain_security/ccv/provider/v1/query.proto b/proto/interchain_security/ccv/provider/v1/query.proto index 9a8fbf7f42..c9536b8e16 100644 --- a/proto/interchain_security/ccv/provider/v1/query.proto +++ b/proto/interchain_security/ccv/provider/v1/query.proto @@ -11,14 +11,20 @@ import "interchain_security/ccv/v1/shared_consumer.proto"; import "interchain_security/ccv/v1/wire.proto"; import "tendermint/crypto/keys.proto"; import "cosmos_proto/cosmos.proto"; +import "cosmos/staking/v1beta1/staking.proto"; service Query { // ConsumerGenesis queries the genesis state needed to start a consumer chain // whose proposal has been accepted rpc QueryConsumerGenesis(QueryConsumerGenesisRequest) returns (QueryConsumerGenesisResponse) { - option (google.api.http).get = - "/interchain_security/ccv/provider/consumer_genesis/{chain_id}"; + option (google.api.http) = { + // [DEPRECATED] use the {consumer_id} endpoint instead. + get: "/interchain_security/ccv/provider/consumer_genesis/{chain_id}"; + additional_bindings { + get: "/interchain_security/ccv/provider/consumer_genesis/{consumer_id}"; + } + }; } // ConsumerChains queries active consumer chains supported by the provider @@ -90,8 +96,13 @@ service Query { rpc QueryAllPairsValConAddrByConsumerChainID ( QueryAllPairsValConAddrByConsumerChainIDRequest) returns (QueryAllPairsValConAddrByConsumerChainIDResponse) { - option (google.api.http).get = - "/interchain_security/ccv/provider/consumer_chain_id"; + option (google.api.http) = { + // [DEPRECATED] use the {consumer_id} endpoint instead. + get: "/interchain_security/ccv/provider/{chain_id}"; + additional_bindings { + get: "/interchain_security/ccv/provider/{consumer_id}"; + } + }; } // QueryParams returns all current values of provider parameters @@ -106,8 +117,13 @@ service Query { rpc QueryConsumerChainOptedInValidators( QueryConsumerChainOptedInValidatorsRequest) returns (QueryConsumerChainOptedInValidatorsResponse) { - option (google.api.http).get = - "/interchain_security/ccv/provider/opted_in_validators/{chain_id}"; + option (google.api.http) = { + // [DEPRECATED] use the {consumer_id} endpoint instead. + get: "/interchain_security/ccv/provider/opted_in_validators/{chain_id}"; + additional_bindings { + get: "/interchain_security/ccv/provider/opted_in_validators/{consumer_id}"; + } + }; } // QueryConsumerChainsValidatorHasToValidate returns a list of consumer chains @@ -124,8 +140,13 @@ service Query { rpc QueryValidatorConsumerCommissionRate( QueryValidatorConsumerCommissionRateRequest) returns (QueryValidatorConsumerCommissionRateResponse) { - option (google.api.http).get = - "/interchain_security/ccv/provider/consumer_commission_rate/{chain_id}/{provider_address}"; + option (google.api.http) = { + // [DEPRECATED] use the {consumer_id} endpoint instead. + get: "/interchain_security/ccv/provider/consumer_commission_rate/{chain_id}/{provider_address}"; + additional_bindings { + get: "/interchain_security/ccv/provider/consumer_commission_rate/{consumer_id}/{provider_address}"; + } + }; } // QueryConsumerValidators returns the latest set consumer-validator set for a given chainID @@ -133,8 +154,13 @@ service Query { // because a VSCPacket could be delayed to be delivered on the consumer chain. rpc QueryConsumerValidators(QueryConsumerValidatorsRequest) returns (QueryConsumerValidatorsResponse) { - option (google.api.http).get = - "/interchain_security/ccv/provider/consumer_validators/{chain_id}"; + option (google.api.http) = { + // [DEPRECATED] use the {consumer_id} endpoint instead. + get: "/interchain_security/ccv/provider/consumer_validators/{chain_id}"; + additional_bindings { + get: "/interchain_security/ccv/provider/consumer_validators/{consumer_id}"; + } + }; } // QueryBlocksUntilNextEpoch returns the number of blocks until the next epoch @@ -144,9 +170,21 @@ service Query { option (google.api.http).get = "/interchain_security/ccv/provider/blocks_until_next_epoch"; } + + // QueryConsumerIdFromClientId returns the consumer id of the chain + // associated with the provided client id + rpc QueryConsumerIdFromClientId(QueryConsumerIdFromClientIdRequest) + returns (QueryConsumerIdFromClientIdResponse) { + option (google.api.http).get = + "/interchain_security/ccv/provider/consumer_id/{client_id}"; + } } -message QueryConsumerGenesisRequest { string chain_id = 1; } +message QueryConsumerGenesisRequest { + // [DEPRECATED] use `consumer_id` instead + string chain_id = 1 [deprecated = true]; + string consumer_id = 2; +} message QueryConsumerGenesisResponse { interchain_security.ccv.v1.ConsumerGenesisState genesis_state = 1 @@ -192,10 +230,12 @@ message Chain { message QueryValidatorConsumerAddrRequest { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - // The id of the consumer chain - string chain_id = 1; + // [DEPRECATED] use `consumer_id` instead + string chain_id = 1 [deprecated = true]; // The consensus address of the validator on the provider chain string provider_address = 2 [ (gogoproto.moretags) = "yaml:\"address\"" ]; + // The id of the consumer chain + string consumer_id = 3; } message QueryValidatorConsumerAddrResponse { @@ -206,10 +246,12 @@ message QueryValidatorConsumerAddrResponse { message QueryValidatorProviderAddrRequest { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - // The id of the provider chain - string chain_id = 1; + // [DEPRECATED] use `consumer_id` instead + string chain_id = 1 [deprecated = true]; // The consensus address of the validator on the consumer chain string consumer_address = 2 [ (gogoproto.moretags) = "yaml:\"address\"" ]; + // The id of the consumer chain + string consumer_id = 3; } message QueryValidatorProviderAddrResponse { @@ -245,13 +287,17 @@ message QueryProposedChainIDsResponse { } message ProposedChain { - string chainID = 1; + // [DEPRECATED] use `consumer_id` instead + string chainID = 1 [deprecated = true]; uint64 proposalID = 2; + string consumer_id = 3; } message QueryAllPairsValConAddrByConsumerChainIDRequest { + // [DEPRECATED] use `consumer_id` instead + string chain_id = 1 [deprecated = true]; // The id of the consumer chain - string chain_id = 1; + string consumer_id = 2; } message QueryAllPairsValConAddrByConsumerChainIDResponse { @@ -273,7 +319,9 @@ message QueryParamsResponse { } message QueryConsumerChainOptedInValidatorsRequest { - string chain_id = 1; + // [DEPRECATED] use `consumer_id` instead + string chain_id = 1 [deprecated = true]; + string consumer_id = 2; } message QueryConsumerChainOptedInValidatorsResponse { @@ -282,7 +330,9 @@ message QueryConsumerChainOptedInValidatorsResponse { } message QueryConsumerValidatorsRequest { - string chain_id = 1; + // [DEPRECATED] use `consumer_id` instead + string chain_id = 1 [deprecated = true]; + string consumer_id = 2; } message QueryConsumerValidatorsValidator { @@ -290,13 +340,44 @@ message QueryConsumerValidatorsValidator { string provider_address = 1 [ (gogoproto.moretags) = "yaml:\"address\"" ]; // The consumer public key of the validator used on the consumer chain tendermint.crypto.PublicKey consumer_key = 2; + // [DEPRECATED] use `consumer_power` instead + int64 power = 3 [deprecated = true]; + + // [DEPRECATED] use `consumer_commission_rate` instead + string rate = 4 [ deprecated = true, + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; // The power of the validator used on the consumer chain - int64 power = 3; + int64 consumer_power = 5; // The rate to charge delegators on the consumer chain, as a fraction - string rate = 4 [ + string consumer_commission_rate = 6 [ + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + // The rate to charge delegators on the provider chain, as a fraction + string provider_commission_rate = 7 [ (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; + // description defines the description terms for the validator + cosmos.staking.v1beta1.Description description = 8 [(gogoproto.nullable) = false]; + // provider_operator_address defines the address of the validator's operator + string provider_operator_address = 9 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; + // jailed defined whether the validator has been jailed from bonded status or not. + bool jailed = 10; + // status is the validator status (bonded/unbonding/unbonded). + cosmos.staking.v1beta1.BondStatus status = 11; + // provider_tokens defines the delegated tokens (incl. self-delegation). + string provider_tokens = 12 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; + // The power of the validator used on the provider chain + int64 provider_power = 13; + // validates_current_epoch defines whether the validator has to validate for the current epoch or not + bool validates_current_epoch = 14; } message QueryConsumerValidatorsResponse { @@ -313,9 +394,11 @@ message QueryConsumerChainsValidatorHasToValidateResponse { } message QueryValidatorConsumerCommissionRateRequest { - string chain_id = 1; - // The consensus address of the validator on the provider chain + // [DEPRECATED] use `consumer_id` instead + string chain_id = 1 [deprecated = true]; + // The consensus address of the validator on the provider chain string provider_address = 2 [ (gogoproto.moretags) = "yaml:\"address\"" ]; + string consumer_id = 3; } message QueryValidatorConsumerCommissionRateResponse { @@ -332,3 +415,14 @@ message QueryBlocksUntilNextEpochResponse { // The number of blocks until the next epoch starts uint64 blocks_until_next_epoch = 1; } + +message QueryConsumerIdFromClientIdRequest { + // the client id (on the provider) that is tracking the consumer chain + // the client id can be found from the consumer chain by querying (i.e., `query ccvconsumer provider-info`) + string client_id = 1; +} + +message QueryConsumerIdFromClientIdResponse { + // the consumer id of the chain associated with this client id + string consumer_id = 1; +} diff --git a/proto/interchain_security/ccv/provider/v1/tx.proto b/proto/interchain_security/ccv/provider/v1/tx.proto index b0f3fc58c2..eb4d5ba5f0 100644 --- a/proto/interchain_security/ccv/provider/v1/tx.proto +++ b/proto/interchain_security/ccv/provider/v1/tx.proto @@ -23,13 +23,22 @@ service Msg { rpc AssignConsumerKey(MsgAssignConsumerKey) returns (MsgAssignConsumerKeyResponse); rpc SubmitConsumerMisbehaviour(MsgSubmitConsumerMisbehaviour) returns (MsgSubmitConsumerMisbehaviourResponse); rpc SubmitConsumerDoubleVoting(MsgSubmitConsumerDoubleVoting) returns (MsgSubmitConsumerDoubleVotingResponse); - rpc ConsumerAddition(MsgConsumerAddition) returns (MsgConsumerAdditionResponse); - rpc ConsumerRemoval(MsgConsumerRemoval) returns (MsgConsumerRemovalResponse); + rpc ConsumerAddition(MsgConsumerAddition) returns (MsgConsumerAdditionResponse) { + option deprecated = true; + }; + rpc ConsumerRemoval(MsgConsumerRemoval) returns (MsgConsumerRemovalResponse) { + option deprecated = true; + }; + rpc CreateConsumer(MsgCreateConsumer) returns (MsgCreateConsumerResponse); + rpc UpdateConsumer(MsgUpdateConsumer) returns (MsgUpdateConsumerResponse); + rpc RemoveConsumer(MsgRemoveConsumer) returns (MsgRemoveConsumerResponse); rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); rpc OptIn(MsgOptIn) returns (MsgOptInResponse); rpc OptOut(MsgOptOut) returns (MsgOptOutResponse); rpc SetConsumerCommissionRate(MsgSetConsumerCommissionRate) returns (MsgSetConsumerCommissionRateResponse); - rpc ConsumerModification(MsgConsumerModification) returns (MsgConsumerModificationResponse); + rpc ConsumerModification(MsgConsumerModification) returns (MsgConsumerModificationResponse) { + option deprecated = true; + } } @@ -39,8 +48,8 @@ message MsgAssignConsumerKey { option (gogoproto.goproto_getters) = false; - // The chain id of the consumer chain to assign a consensus public key to - string chain_id = 1; + // [DEPRECATED] use `consumer_id` instead + string chain_id = 1 [deprecated = true]; // The validator address on the provider string provider_addr = 2 [ (gogoproto.moretags) = "yaml:\"address\"" ]; // The consensus public key to use on the consumer. @@ -50,6 +59,9 @@ message MsgAssignConsumerKey { // Tx signer address string signer = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // the consumer id of the consumer chain to assign a consensus public key to + string consumer_id = 5; } message MsgAssignConsumerKeyResponse {} @@ -66,6 +78,8 @@ message MsgSubmitConsumerMisbehaviour { // The Misbehaviour of the consumer chain wrapping // two conflicting IBC headers ibc.lightclients.tendermint.v1.Misbehaviour misbehaviour = 2; + // the consumer id of the consumer chain where the misbehaviour occurred + string consumer_id = 3; } message MsgSubmitConsumerMisbehaviourResponse {} @@ -84,6 +98,8 @@ message MsgSubmitConsumerDoubleVoting { tendermint.types.DuplicateVoteEvidence duplicate_vote_evidence = 2; // The light client header of the infraction block ibc.lightclients.tendermint.v1.Header infraction_block_header = 3; + // the consumer id of the consumer chain where the double-voting took place + string consumer_id = 4; } message MsgSubmitConsumerDoubleVotingResponse {} @@ -101,13 +117,7 @@ message MsgUpdateParams { message MsgUpdateParamsResponse {} - -// MsgConsumerAddition defines the message used to spawn a new consumer chain using a v1 governance proposal. -// If it passes, then all validators on the provider chain are expected to validate -// the consumer chain at spawn time or get slashed. -// It is recommended that spawn time occurs after the proposal end time. -// -// Note: this replaces ConsumerAdditionProposal which is deprecated and will be removed soon +// [DEPRECATED] Use `MsgCreateConsumer` instead message MsgConsumerAddition { option (cosmos.msg.v1.signer) = "authority"; @@ -192,13 +202,7 @@ message MsgConsumerAddition { // MsgConsumerAdditionResponse defines response type for MsgConsumerAddition messages message MsgConsumerAdditionResponse {} - -// MsgConsumerRemoval message contains a governance proposal on the provider chain to -// remove (and stop) a consumer chain. If it passes, all the consumer chain's -// state is removed from the provider chain. The outstanding unbonding operation -// funds are released. -// -// Note: this replaces ConsumerRemovalProposal which is deprecated and will be removed soon +// [DEPRECATED] Use `MsgRemoveConsumer` instead message MsgConsumerRemoval { option (cosmos.msg.v1.signer) = "authority"; @@ -215,6 +219,25 @@ message MsgConsumerRemoval { // MsgConsumerRemovalResponse defines response type for MsgConsumerRemoval messages message MsgConsumerRemovalResponse {} + +// MsgRemoveConsumer defines the message used to remove (and stop) a consumer chain. +// If it passes, all the consumer chain's state is eventually removed from the provider chain. +message MsgRemoveConsumer { + option (cosmos.msg.v1.signer) = "authority"; + + // the consumer id of the consumer chain to be stopped + string consumer_id = 1; + // the time on the provider chain at which all validators are responsible to + // stop their consumer chain validator node + google.protobuf.Timestamp stop_time = 2 + [ (gogoproto.stdtime) = true, (gogoproto.nullable) = false ]; + // signer address + string authority = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + +// MsgRemoveConsumerResponse defines response type for MsgRemoveConsumer messages +message MsgRemoveConsumerResponse {} + // ChangeRewardDenomsProposal is a governance proposal on the provider chain to // mutate the set of denoms accepted by the provider as rewards. // @@ -238,8 +261,8 @@ message MsgOptIn { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; option (cosmos.msg.v1.signer) = "signer"; - // the chain id of the consumer chain to opt in to - string chain_id = 1; + // [DEPRECATED] use `consumer_id` instead + string chain_id = 1 [deprecated = true]; // the validator address on the provider string provider_addr = 2 [ (gogoproto.moretags) = "yaml:\"address\"" ]; // (optional) The consensus public key to use on the consumer in json string format corresponding to proto-any, @@ -249,7 +272,8 @@ message MsgOptIn { string consumer_key = 3; // signer address string signer = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - + // the consumer id of the consumer chain to opt in to + string consumer_id = 5; } message MsgOptInResponse {} @@ -258,13 +282,14 @@ message MsgOptOut { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; option (cosmos.msg.v1.signer) = "signer"; - // the chain id of the consumer chain to opt out from - string chain_id = 1; + // [DEPRECATED] use `consumer_id` instead + string chain_id = 1 [deprecated = true]; // the validator address on the provider string provider_addr = 2 [ (gogoproto.moretags) = "yaml:\"address\"" ]; // signer address string signer = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - + // the consumer id of the consumer chain to opt out from + string consumer_id = 4; } message MsgOptOutResponse {} @@ -276,10 +301,10 @@ message MsgSetConsumerCommissionRate { option (gogoproto.goproto_getters) = false; option (cosmos.msg.v1.signer) = "signer"; - // The validator address on the provider - string provider_addr = 1 [ (gogoproto.moretags) = "yaml:\"address\"" ]; - // The chain id of the consumer chain to set a commission rate - string chain_id = 2; + // The validator address on the provider + string provider_addr = 1 [ (gogoproto.moretags) = "yaml:\"address\"" ]; + // [DEPRECATED] use `consumer_id` instead + string chain_id = 2 [deprecated = true]; // The rate to charge delegators on the consumer chain, as a fraction // TODO: migrate rate from sdk.Dec to math.LegacyDec string rate = 3 [ @@ -289,16 +314,14 @@ message MsgSetConsumerCommissionRate { ]; // signer address string signer = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // the consumer id of the consumer chain to set the commission rate + string consumer_id = 5; } message MsgSetConsumerCommissionRateResponse {} -// MsgConsumerModification message contains a governance proposal on the provider chain to -// modify a running consumer chain. If it passes, the consumer chain's -// parameters are updated. -// -// Note: this replaces ConsumerModificationProposal which is deprecated and will be removed soon +// [DEPRECATED] Use `MsgUpdateConsumer` instead message MsgConsumerModification { option (cosmos.msg.v1.signer) = "authority"; @@ -336,3 +359,51 @@ message MsgConsumerModification { } message MsgConsumerModificationResponse {} + +// MsgCreateConsumer defines the message that creates a consumer chain +message MsgCreateConsumer { + option (cosmos.msg.v1.signer) = "signer"; + + // signer address + string signer = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // the chain id of the new consumer chain + string chain_id = 2; + + ConsumerMetadata metadata = 3 [ (gogoproto.nullable) = false ]; + + ConsumerInitializationParameters initialization_parameters = 4; + + PowerShapingParameters power_shaping_parameters = 5; +} + +// MsgCreateConsumerResponse defines response type for MsgCreateConsumer +message MsgCreateConsumerResponse { + string consumer_id = 1; +} + +// MsgUpdateConsumer defines the message used to modify a consumer chain. +message MsgUpdateConsumer { + option (cosmos.msg.v1.signer) = "signer"; + + // signer address + string signer = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // the consumer id of the consumer chain to be updated + string consumer_id = 2; + + // the new owner of the consumer when updated + string new_owner_address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // the metadata of the consumer when updated + ConsumerMetadata metadata = 4; + + // initialization parameters can only be updated before a chain has launched + ConsumerInitializationParameters initialization_parameters = 5; + + // the power-shaping parameters of the consumer when updated + PowerShapingParameters power_shaping_parameters = 6; +} + +// MsgUpdateConsumerResponse defines response type for MsgUpdateConsumer messages +message MsgUpdateConsumerResponse {} \ No newline at end of file diff --git a/tests/integration/common.go b/tests/integration/common.go index 46ef499d01..a2c5cd8d46 100644 --- a/tests/integration/common.go +++ b/tests/integration/common.go @@ -42,7 +42,7 @@ func (s *CCVTestSuite) getFirstBundle() icstestingutils.ConsumerBundle { } func (s *CCVTestSuite) getBundleByIdx(index int) icstestingutils.ConsumerBundle { - return *s.consumerBundles[ibctesting.GetChainID(2+index)] + return *s.consumerBundles[fmt.Sprintf("%d", 2+index)] } func (s *CCVTestSuite) providerCtx() sdk.Context { diff --git a/tests/integration/distribution.go b/tests/integration/distribution.go index 8fecaccfc8..316b343f0a 100644 --- a/tests/integration/distribution.go +++ b/tests/integration/distribution.go @@ -125,7 +125,7 @@ func (s *CCVTestSuite) TestRewardsDistribution() { // Save the consumer validators total outstanding rewards on the provider consumerValsOutstandingRewardsFunc := func(ctx sdk.Context) sdk.DecCoins { totalRewards := sdk.DecCoins{} - vals, err := providerKeeper.GetConsumerValSet(ctx, s.consumerChain.ChainID) + vals, err := providerKeeper.GetConsumerValSet(ctx, s.getFirstBundle().ConsumerId) s.Require().NoError(err) for _, v := range vals { @@ -160,7 +160,7 @@ func (s *CCVTestSuite) TestRewardsDistribution() { // Consumer allocations are distributed between the validators and the community pool. // The decimals resulting from the distribution are expected to remain in the consumer allocations. - rewardsAlloc := providerKeeper.GetConsumerRewardsAllocation(s.providerCtx(), s.consumerChain.ChainID) + rewardsAlloc := providerKeeper.GetConsumerRewardsAllocation(s.providerCtx(), s.getFirstBundle().ConsumerId) remainingAlloc := rewardsAlloc.Rewards.AmountOf(rewardsIBCdenom) s.Require().True(remainingAlloc.LTE(math.LegacyOneDec())) @@ -601,7 +601,7 @@ func (s *CCVTestSuite) TestIBCTransferMiddleware() { // update consumer allocation keeper.SetConsumerRewardsAllocation( ctx, - s.consumerChain.ChainID, + s.getFirstBundle().ConsumerId, providertypes.ConsumerRewardsAllocation{ Rewards: sdk.NewDecCoins(sdk.NewDecCoin(sdk.DefaultBondDenom, math.NewInt(100_000))), }, @@ -668,7 +668,7 @@ func (s *CCVTestSuite) TestIBCTransferMiddleware() { rewardsPoolBalance := bankKeeper.GetAllBalances(s.providerCtx(), sdk.MustAccAddressFromBech32(data.Receiver)) // save the consumer's rewards allocated - consumerRewardsAllocations := providerKeeper.GetConsumerRewardsAllocation(s.providerCtx(), s.consumerChain.ChainID) + consumerRewardsAllocations := providerKeeper.GetConsumerRewardsAllocation(s.providerCtx(), s.getFirstBundle().ConsumerId) // execute middleware OnRecvPacket logic ack := cbs.OnRecvPacket(s.providerCtx(), packet, sdk.AccAddress{}) @@ -682,7 +682,7 @@ func (s *CCVTestSuite) TestIBCTransferMiddleware() { // compute the balance and allocation difference rewardsTransferred := bankKeeper.GetAllBalances(s.providerCtx(), sdk.MustAccAddressFromBech32(data.Receiver)). Sub(rewardsPoolBalance...) - rewardsAllocated := providerKeeper.GetConsumerRewardsAllocation(s.providerCtx(), s.consumerChain.ChainID). + rewardsAllocated := providerKeeper.GetConsumerRewardsAllocation(s.providerCtx(), s.getFirstBundle().ConsumerId). Rewards.Sub(consumerRewardsAllocations.Rewards) if !tc.expErr { @@ -739,11 +739,11 @@ func (s *CCVTestSuite) TestAllocateTokens() { // Allocate rewards evenly between consumers rewardsPerChain := totalRewards.QuoInt(math.NewInt(int64(len(s.consumerBundles)))) - for chainID := range s.consumerBundles { + for consumerId := range s.consumerBundles { // update consumer allocation providerKeeper.SetConsumerRewardsAllocation( providerCtx, - chainID, + consumerId, providertypes.ConsumerRewardsAllocation{ Rewards: sdk.NewDecCoinsFromCoins(rewardsPerChain...), }, @@ -797,7 +797,7 @@ func (s *CCVTestSuite) TestAllocateTokens() { // check that the total expected rewards are transferred to the distribution module account // store the decimal remainders in the consumer reward allocations - allocRemainderPerChain := providerKeeper.GetConsumerRewardsAllocation(providerCtx, s.consumerChain.ChainID).Rewards + allocRemainderPerChain := providerKeeper.GetConsumerRewardsAllocation(providerCtx, s.getFirstBundle().ConsumerId).Rewards // compute the total rewards distributed to the distribution module balance (validator outstanding rewards + community pool tax), totalRewardsDistributed := sdk.NewDecCoinsFromCoins(totalRewards...).Sub(allocRemainderPerChain.MulDec(math.LegacyNewDec(int64(consNum)))) @@ -843,7 +843,7 @@ func (s *CCVTestSuite) TestAllocateTokensToConsumerValidators() { distributionKeeper := s.providerApp.GetTestDistributionKeeper() bankKeeper := s.providerApp.GetTestBankKeeper() - chainID := s.consumerChain.ChainID + consumerId := s.getFirstBundle().ConsumerId testCases := []struct { name string @@ -889,11 +889,11 @@ func (s *CCVTestSuite) TestAllocateTokensToConsumerValidators() { ctx.BlockHeight()) // change the consumer valset - consuVals, err := providerKeeper.GetConsumerValSet(ctx, chainID) + consuVals, err := providerKeeper.GetConsumerValSet(ctx, consumerId) s.Require().NoError(err) - providerKeeper.DeleteConsumerValSet(ctx, chainID) - providerKeeper.SetConsumerValSet(ctx, chainID, consuVals[0:tc.consuValLen]) - consuVals, err = providerKeeper.GetConsumerValSet(ctx, chainID) + providerKeeper.DeleteConsumerValSet(ctx, consumerId) + providerKeeper.SetConsumerValSet(ctx, consumerId, consuVals[0:tc.consuValLen]) + consuVals, err = providerKeeper.GetConsumerValSet(ctx, consumerId) s.Require().NoError(err) // set the same consumer commission rate for all consumer validators @@ -901,7 +901,7 @@ func (s *CCVTestSuite) TestAllocateTokensToConsumerValidators() { provAddr := providertypes.NewProviderConsAddress(sdk.ConsAddress(v.ProviderConsAddr)) err := providerKeeper.SetConsumerCommissionRate( ctx, - chainID, + consumerId, provAddr, tc.rate, ) @@ -911,7 +911,7 @@ func (s *CCVTestSuite) TestAllocateTokensToConsumerValidators() { // allocate tokens res := providerKeeper.AllocateTokensToConsumerValidators( ctx, - chainID, + consumerId, tc.tokens, ) @@ -981,7 +981,7 @@ func (s *CCVTestSuite) TestAllocateTokensToConsumerValidatorsWithDifferentValida distributionKeeper := s.providerApp.GetTestDistributionKeeper() bankKeeper := s.providerApp.GetTestBankKeeper() - chainID := s.consumerChain.ChainID + consumerId := s.getFirstBundle().ConsumerId tokens := sdk.DecCoins{sdk.NewDecCoinFromDec(sdk.DefaultBondDenom, math.LegacyNewDecFromIntWithPrec(math.NewInt(999), 2))} rate := math.LegacyOneDec() @@ -994,7 +994,7 @@ func (s *CCVTestSuite) TestAllocateTokensToConsumerValidatorsWithDifferentValida ctx = ctx.WithBlockHeight(providerKeeper.GetNumberOfEpochsToStartReceivingRewards(ctx)*providerKeeper.GetBlocksPerEpoch(ctx) + 1) // update the consumer validators - consuVals, err := providerKeeper.GetConsumerValSet(ctx, chainID) + consuVals, err := providerKeeper.GetConsumerValSet(ctx, consumerId) s.Require().NoError(err) // first 2 validators were consumer validators since block height 1 and hence get rewards consuVals[0].JoinHeight = 1 @@ -1003,11 +1003,11 @@ func (s *CCVTestSuite) TestAllocateTokensToConsumerValidatorsWithDifferentValida // have not been consumer validators for `GetNumberOfEpochsToStartReceivingRewards * GetBlocksPerEpoch` blocks consuVals[2].JoinHeight = 2 consuVals[3].JoinHeight = 2 - providerKeeper.SetConsumerValSet(ctx, chainID, consuVals) + providerKeeper.SetConsumerValSet(ctx, consumerId, consuVals) - providerKeeper.DeleteConsumerValSet(ctx, chainID) - providerKeeper.SetConsumerValSet(ctx, chainID, consuVals) - consuVals, err = providerKeeper.GetConsumerValSet(ctx, chainID) + providerKeeper.DeleteConsumerValSet(ctx, consumerId) + providerKeeper.SetConsumerValSet(ctx, consumerId, consuVals) + consuVals, err = providerKeeper.GetConsumerValSet(ctx, consumerId) s.Require().NoError(err) // set the same consumer commission rate for all consumer validators @@ -1015,7 +1015,7 @@ func (s *CCVTestSuite) TestAllocateTokensToConsumerValidatorsWithDifferentValida provAddr := providertypes.NewProviderConsAddress(sdk.ConsAddress(v.ProviderConsAddr)) err := providerKeeper.SetConsumerCommissionRate( ctx, - chainID, + consumerId, provAddr, rate, ) @@ -1025,7 +1025,7 @@ func (s *CCVTestSuite) TestAllocateTokensToConsumerValidatorsWithDifferentValida // allocate tokens res := providerKeeper.AllocateTokensToConsumerValidators( ctx, - chainID, + consumerId, tokens, ) @@ -1101,8 +1101,8 @@ func (s *CCVTestSuite) TestMultiConsumerRewardsDistribution() { // Iterate over the consumers and perform the reward distribution // to the provider - for chainID := range s.consumerBundles { - bundle := s.consumerBundles[chainID] + for consumerId := range s.consumerBundles { + bundle := s.consumerBundles[consumerId] consumerKeeper := bundle.App.GetConsumerKeeper() bankKeeper := bundle.App.GetTestBankKeeper() accountKeeper := bundle.App.GetTestAccountKeeper() diff --git a/tests/integration/double_vote.go b/tests/integration/double_vote.go index 2f275fd95c..b4c9f82c10 100644 --- a/tests/integration/double_vote.go +++ b/tests/integration/double_vote.go @@ -42,7 +42,7 @@ func (s *CCVTestSuite) TestHandleConsumerDoubleVoting() { equivocationEvidenceMinHeight := uint64(s.consumerCtx().BlockHeight() - 1) s.providerApp.GetProviderKeeper().SetEquivocationEvidenceMinHeight( s.providerCtx(), - s.consumerChain.ChainID, + s.getFirstBundle().ConsumerId, equivocationEvidenceMinHeight, ) @@ -56,7 +56,7 @@ func (s *CCVTestSuite) TestHandleConsumerDoubleVoting() { s.consumerCtx().BlockTime(), consuValSet, consuSigner, - s.consumerChain.ChainID, + s.getFirstBundle().Chain.ChainID, ) consuBadVote := testutil.MakeAndSignVote( @@ -65,7 +65,7 @@ func (s *CCVTestSuite) TestHandleConsumerDoubleVoting() { s.consumerCtx().BlockTime(), consuValSet, consuSigner, - s.consumerChain.ChainID, + s.getFirstBundle().Chain.ChainID, ) // create two votes using the provider validator key @@ -75,7 +75,7 @@ func (s *CCVTestSuite) TestHandleConsumerDoubleVoting() { s.consumerCtx().BlockTime(), provValSet, provSigner, - s.consumerChain.ChainID, + s.getFirstBundle().Chain.ChainID, ) provBadVote := testutil.MakeAndSignVote( @@ -84,7 +84,7 @@ func (s *CCVTestSuite) TestHandleConsumerDoubleVoting() { s.consumerCtx().BlockTime(), provValSet, provSigner, - s.consumerChain.ChainID, + s.getFirstBundle().Chain.ChainID, ) // create two votes using the consumer validator key that both have @@ -95,7 +95,7 @@ func (s *CCVTestSuite) TestHandleConsumerDoubleVoting() { s.consumerCtx().BlockTime(), consuValSet, consuSigner, - s.consumerChain.ChainID, + s.getFirstBundle().Chain.ChainID, ) consuVoteOld2 := testutil.MakeAndSignVote( @@ -104,15 +104,15 @@ func (s *CCVTestSuite) TestHandleConsumerDoubleVoting() { s.consumerCtx().BlockTime(), consuValSet, consuSigner, - s.consumerChain.ChainID, + s.getFirstBundle().Chain.ChainID, ) testCases := []struct { - name string - ev *tmtypes.DuplicateVoteEvidence - chainID string - pubkey tmcrypto.PubKey - expPass bool + name string + ev *tmtypes.DuplicateVoteEvidence + consumerId string + pubkey tmcrypto.PubKey + expPass bool }{ { "cannot find consumer chain for the given chain ID - shouldn't pass", @@ -123,7 +123,7 @@ func (s *CCVTestSuite) TestHandleConsumerDoubleVoting() { TotalVotingPower: consuVal.VotingPower, Timestamp: s.consumerCtx().BlockTime(), }, - "chainID", + "consumerId", consuVal.PubKey, false, }, @@ -136,7 +136,7 @@ func (s *CCVTestSuite) TestHandleConsumerDoubleVoting() { TotalVotingPower: consuVal.VotingPower, Timestamp: s.consumerCtx().BlockTime(), }, - s.consumerChain.ChainID, + s.getFirstBundle().ConsumerId, consuVal.PubKey, false, }, @@ -149,7 +149,7 @@ func (s *CCVTestSuite) TestHandleConsumerDoubleVoting() { TotalVotingPower: consuVal.VotingPower, Timestamp: s.consumerCtx().BlockTime(), }, - s.consumerChain.ChainID, + s.getFirstBundle().ConsumerId, consuVal.PubKey, false, }, @@ -162,7 +162,7 @@ func (s *CCVTestSuite) TestHandleConsumerDoubleVoting() { TotalVotingPower: consuVal.VotingPower, Timestamp: s.consumerCtx().BlockTime(), }, - s.consumerChain.ChainID, + s.getFirstBundle().ConsumerId, provVal.PubKey, false, }, @@ -176,7 +176,7 @@ func (s *CCVTestSuite) TestHandleConsumerDoubleVoting() { TotalVotingPower: consuVal.VotingPower, Timestamp: s.consumerCtx().BlockTime(), }, - s.consumerChain.ChainID, + s.getFirstBundle().ConsumerId, consuVal.PubKey, false, }, @@ -193,7 +193,7 @@ func (s *CCVTestSuite) TestHandleConsumerDoubleVoting() { TotalVotingPower: consuVal.VotingPower, Timestamp: s.consumerCtx().BlockTime(), }, - s.consumerChain.ChainID, + s.getFirstBundle().ConsumerId, consuVal.PubKey, true, }, @@ -207,7 +207,7 @@ func (s *CCVTestSuite) TestHandleConsumerDoubleVoting() { TotalVotingPower: consuVal.VotingPower, Timestamp: s.consumerCtx().BlockTime(), }, - s.consumerChain.ChainID, + s.getFirstBundle().ConsumerId, provVal.PubKey, true, }, @@ -216,7 +216,7 @@ func (s *CCVTestSuite) TestHandleConsumerDoubleVoting() { for _, tc := range testCases { s.Run(tc.name, func() { consuAddr := types.NewConsumerConsAddress(sdk.ConsAddress(tc.ev.VoteA.ValidatorAddress.Bytes())) - provAddr := s.providerApp.GetProviderKeeper().GetProviderAddrFromConsumerAddr(s.providerCtx(), s.consumerChain.ChainID, consuAddr) + provAddr := s.providerApp.GetProviderKeeper().GetProviderAddrFromConsumerAddr(s.providerCtx(), s.getFirstBundle().ConsumerId, consuAddr) validator, _ := s.providerApp.GetTestStakingKeeper().GetValidator(s.providerCtx(), provAddr.ToSdkConsAddr().Bytes()) initialTokens := math.LegacyNewDecFromInt(validator.GetTokens()) @@ -228,7 +228,7 @@ func (s *CCVTestSuite) TestHandleConsumerDoubleVoting() { // we remove the consumer key assigned to the validator otherwise // HandleConsumerDoubleVoting uses the consumer key to verify the signature if tc.ev.VoteA.ValidatorAddress.String() != consuVal.Address.String() { - s.providerApp.GetProviderKeeper().DeleteKeyAssignments(provCtx, s.consumerChain.ChainID) + s.providerApp.GetProviderKeeper().DeleteKeyAssignments(provCtx, s.getFirstBundle().ConsumerId) } // convert validator public key @@ -237,8 +237,8 @@ func (s *CCVTestSuite) TestHandleConsumerDoubleVoting() { err = s.providerApp.GetProviderKeeper().HandleConsumerDoubleVoting( provCtx, + tc.consumerId, tc.ev, - tc.chainID, pk, ) @@ -296,7 +296,7 @@ func (s *CCVTestSuite) TestHandleConsumerDoubleVotingSlashesUndelegationsAndRele s.consumerCtx().BlockTime(), consuValSet, consuSigner, - s.consumerChain.ChainID, + s.getFirstBundle().Chain.ChainID, ) consuBadVote := testutil.MakeAndSignVote( @@ -305,7 +305,7 @@ func (s *CCVTestSuite) TestHandleConsumerDoubleVotingSlashesUndelegationsAndRele s.consumerCtx().BlockTime(), consuValSet, consuSigner, - s.consumerChain.ChainID, + s.getFirstBundle().Chain.ChainID, ) // In order to create an evidence for a consumer chain, @@ -320,14 +320,13 @@ func (s *CCVTestSuite) TestHandleConsumerDoubleVotingSlashesUndelegationsAndRele Timestamp: s.consumerCtx().BlockTime(), } - chainID := s.consumerChain.ChainID pubKey := consuVal.PubKey consuAddr := types.NewConsumerConsAddress(sdk.ConsAddress(consuVal.Address.Bytes())) - provAddr := s.providerApp.GetProviderKeeper().GetProviderAddrFromConsumerAddr(s.providerCtx(), s.consumerChain.ChainID, consuAddr) + provAddr := s.providerApp.GetProviderKeeper().GetProviderAddrFromConsumerAddr(s.providerCtx(), s.getFirstBundle().ConsumerId, consuAddr) consuAddr2 := types.NewConsumerConsAddress(sdk.ConsAddress(consuVal2.Address.Bytes())) - provAddr2 := s.providerApp.GetProviderKeeper().GetProviderAddrFromConsumerAddr(s.providerCtx(), s.consumerChain.ChainID, consuAddr2) + provAddr2 := s.providerApp.GetProviderKeeper().GetProviderAddrFromConsumerAddr(s.providerCtx(), s.getFirstBundle().ConsumerId, consuAddr2) validator, err := s.providerApp.GetTestStakingKeeper().GetValidator(s.providerCtx(), provAddr.ToSdkConsAddr().Bytes()) s.Require().NoError(err) @@ -392,8 +391,8 @@ func (s *CCVTestSuite) TestHandleConsumerDoubleVotingSlashesUndelegationsAndRele // cause double voting err = s.providerApp.GetProviderKeeper().HandleConsumerDoubleVoting( s.providerCtx(), + s.getFirstBundle().ConsumerId, evidence, - chainID, pk, ) s.Require().NoError(err) diff --git a/tests/integration/expired_client.go b/tests/integration/expired_client.go index 5a55c75079..259979e351 100644 --- a/tests/integration/expired_client.go +++ b/tests/integration/expired_client.go @@ -36,7 +36,7 @@ func (s *CCVTestSuite) TestVSCPacketSendExpiredClient() { s.nextEpoch() // check that the packet was added to the list of pending VSC packets - packets := providerKeeper.GetPendingVSCPackets(s.providerCtx(), s.consumerChain.ChainID) + packets := providerKeeper.GetPendingVSCPackets(s.providerCtx(), s.getFirstBundle().ConsumerId) s.Require().NotEmpty(packets, "no pending VSC packets found") s.Require().Equal(1, len(packets), "unexpected number of pending VSC packets") @@ -44,7 +44,7 @@ func (s *CCVTestSuite) TestVSCPacketSendExpiredClient() { s.nextEpoch() // check that the packet is still in the list of pending VSC packets - packets = providerKeeper.GetPendingVSCPackets(s.providerCtx(), s.consumerChain.ChainID) + packets = providerKeeper.GetPendingVSCPackets(s.providerCtx(), s.getFirstBundle().ConsumerId) s.Require().NotEmpty(packets, "no pending VSC packets found") s.Require().Equal(1, len(packets), "unexpected number of pending VSC packets") @@ -55,7 +55,7 @@ func (s *CCVTestSuite) TestVSCPacketSendExpiredClient() { s.nextEpoch() // check that the packets are still in the list of pending VSC packets - packets = providerKeeper.GetPendingVSCPackets(s.providerCtx(), s.consumerChain.ChainID) + packets = providerKeeper.GetPendingVSCPackets(s.providerCtx(), s.getFirstBundle().ConsumerId) s.Require().NotEmpty(packets, "no pending VSC packets found") s.Require().Equal(2, len(packets), "unexpected number of pending VSC packets") @@ -66,7 +66,7 @@ func (s *CCVTestSuite) TestVSCPacketSendExpiredClient() { s.nextEpoch() // check that the packets are not in the list of pending VSC packets - packets = providerKeeper.GetPendingVSCPackets(s.providerCtx(), s.consumerChain.ChainID) + packets = providerKeeper.GetPendingVSCPackets(s.providerCtx(), s.getFirstBundle().ConsumerId) s.Require().Empty(packets, "unexpected pending VSC packets found") // check that validator updates work @@ -105,7 +105,7 @@ func (s *CCVTestSuite) TestConsumerPacketSendExpiredClient() { s.nextEpoch() // check that the packets are not in the list of pending VSC packets - providerPackets := providerKeeper.GetPendingVSCPackets(s.providerCtx(), s.consumerChain.ChainID) + providerPackets := providerKeeper.GetPendingVSCPackets(s.providerCtx(), s.getFirstBundle().ConsumerId) s.Require().Empty(providerPackets, "pending VSC packets found") // relay all VSC packet from provider to consumer diff --git a/tests/integration/key_assignment.go b/tests/integration/key_assignment.go index c6478d98ba..73defc1b57 100644 --- a/tests/integration/key_assignment.go +++ b/tests/integration/key_assignment.go @@ -24,14 +24,14 @@ func (s *CCVTestSuite) TestKeyAssignment() { "assignment during channel init", func(pk *providerkeeper.Keeper) error { // key assignment validator, consumerKey := generateNewConsumerKey(s, 0) - err := pk.AssignConsumerKey(s.providerCtx(), s.consumerChain.ChainID, validator, consumerKey) + err := pk.AssignConsumerKey(s.providerCtx(), s.getFirstBundle().ConsumerId, validator, consumerKey) if err != nil { return err } // check that a VSCPacket is queued s.nextEpoch() - pendingPackets := pk.GetPendingVSCPackets(s.providerCtx(), s.consumerChain.ChainID) + pendingPackets := pk.GetPendingVSCPackets(s.providerCtx(), s.getFirstBundle().ConsumerId) s.Require().Len(pendingPackets, 1) // establish CCV channel @@ -47,7 +47,7 @@ func (s *CCVTestSuite) TestKeyAssignment() { // key assignment validator, consumerKey := generateNewConsumerKey(s, 0) - err := pk.AssignConsumerKey(s.providerCtx(), s.consumerChain.ChainID, validator, consumerKey) + err := pk.AssignConsumerKey(s.providerCtx(), s.getFirstBundle().ConsumerId, validator, consumerKey) if err != nil { return err } @@ -63,7 +63,7 @@ func (s *CCVTestSuite) TestKeyAssignment() { // key assignment validator, consumerKey := generateNewConsumerKey(s, 0) - err := pk.AssignConsumerKey(s.providerCtx(), s.consumerChain.ChainID, validator, consumerKey) + err := pk.AssignConsumerKey(s.providerCtx(), s.getFirstBundle().ConsumerId, validator, consumerKey) if err != nil { return err } @@ -85,14 +85,14 @@ func (s *CCVTestSuite) TestKeyAssignment() { // key assignment validator, consumerKey := generateNewConsumerKey(s, 0) - err := pk.AssignConsumerKey(s.providerCtx(), s.consumerChain.ChainID, validator, consumerKey) + err := pk.AssignConsumerKey(s.providerCtx(), s.getFirstBundle().ConsumerId, validator, consumerKey) if err != nil { return err } // same key assignment, but different validator validator2, _ := generateNewConsumerKey(s, 1) - err = pk.AssignConsumerKey(s.providerCtx(), s.consumerChain.ChainID, validator2, consumerKey) + err = pk.AssignConsumerKey(s.providerCtx(), s.getFirstBundle().ConsumerId, validator2, consumerKey) if err != nil { return err } @@ -108,13 +108,13 @@ func (s *CCVTestSuite) TestKeyAssignment() { // key assignment validator, consumerKey := generateNewConsumerKey(s, 0) - err := pk.AssignConsumerKey(s.providerCtx(), s.consumerChain.ChainID, validator, consumerKey) + err := pk.AssignConsumerKey(s.providerCtx(), s.getFirstBundle().ConsumerId, validator, consumerKey) if err != nil { return err } // same key assignment, but different validator - err = pk.AssignConsumerKey(s.providerCtx(), s.consumerChain.ChainID, validator, consumerKey) + err = pk.AssignConsumerKey(s.providerCtx(), s.getFirstBundle().ConsumerId, validator, consumerKey) if err != nil { return err } @@ -130,14 +130,14 @@ func (s *CCVTestSuite) TestKeyAssignment() { // key assignment validator, consumerKey := generateNewConsumerKey(s, 0) - err := pk.AssignConsumerKey(s.providerCtx(), s.consumerChain.ChainID, validator, consumerKey) + err := pk.AssignConsumerKey(s.providerCtx(), s.getFirstBundle().ConsumerId, validator, consumerKey) if err != nil { return err } // same key assignment validator, consumerKey = generateNewConsumerKey(s, 0) - err = pk.AssignConsumerKey(s.providerCtx(), s.consumerChain.ChainID, validator, consumerKey) + err = pk.AssignConsumerKey(s.providerCtx(), s.getFirstBundle().ConsumerId, validator, consumerKey) if err != nil { return err } @@ -153,7 +153,7 @@ func (s *CCVTestSuite) TestKeyAssignment() { // key assignment validator, consumerKey := generateNewConsumerKey(s, 0) - err := pk.AssignConsumerKey(s.providerCtx(), s.consumerChain.ChainID, validator, consumerKey) + err := pk.AssignConsumerKey(s.providerCtx(), s.getFirstBundle().ConsumerId, validator, consumerKey) if err != nil { return err } @@ -161,7 +161,7 @@ func (s *CCVTestSuite) TestKeyAssignment() { // same key assignment validator2, _ := generateNewConsumerKey(s, 1) - err = pk.AssignConsumerKey(s.providerCtx(), s.consumerChain.ChainID, validator2, consumerKey) + err = pk.AssignConsumerKey(s.providerCtx(), s.getFirstBundle().ConsumerId, validator2, consumerKey) if err != nil { return err } @@ -177,14 +177,14 @@ func (s *CCVTestSuite) TestKeyAssignment() { // key assignment validator, consumerKey := generateNewConsumerKey(s, 0) - err := pk.AssignConsumerKey(s.providerCtx(), s.consumerChain.ChainID, validator, consumerKey) + err := pk.AssignConsumerKey(s.providerCtx(), s.getFirstBundle().ConsumerId, validator, consumerKey) if err != nil { return err } s.nextEpoch() // same key assignment - err = pk.AssignConsumerKey(s.providerCtx(), s.consumerChain.ChainID, validator, consumerKey) + err = pk.AssignConsumerKey(s.providerCtx(), s.getFirstBundle().ConsumerId, validator, consumerKey) if err != nil { return err } @@ -200,7 +200,7 @@ func (s *CCVTestSuite) TestKeyAssignment() { // key assignment validator, consumerKey := generateNewConsumerKey(s, 0) - err := pk.AssignConsumerKey(s.providerCtx(), s.consumerChain.ChainID, validator, consumerKey) + err := pk.AssignConsumerKey(s.providerCtx(), s.getFirstBundle().ConsumerId, validator, consumerKey) if err != nil { return err } @@ -208,7 +208,7 @@ func (s *CCVTestSuite) TestKeyAssignment() { // same key assignment validator, consumerKey = generateNewConsumerKey(s, 0) - err = pk.AssignConsumerKey(s.providerCtx(), s.consumerChain.ChainID, validator, consumerKey) + err = pk.AssignConsumerKey(s.providerCtx(), s.getFirstBundle().ConsumerId, validator, consumerKey) if err != nil { return err } diff --git a/tests/integration/misbehaviour.go b/tests/integration/misbehaviour.go index 5924c90df1..127b3a23a3 100644 --- a/tests/integration/misbehaviour.go +++ b/tests/integration/misbehaviour.go @@ -34,7 +34,7 @@ func (s *CCVTestSuite) TestHandleConsumerMisbehaviour() { misb := &ibctmtypes.Misbehaviour{ ClientId: s.path.EndpointA.ClientID, Header1: s.consumerChain.CreateTMClientHeader( - s.consumerChain.ChainID, + s.getFirstBundle().Chain.ChainID, int64(clientHeight.RevisionHeight+1), clientHeight, altTime, @@ -46,7 +46,7 @@ func (s *CCVTestSuite) TestHandleConsumerMisbehaviour() { // create a different header by changing the header timestamp only // in order to create an equivocation, i.e. both headers have the same deterministic states Header2: s.consumerChain.CreateTMClientHeader( - s.consumerChain.ChainID, + s.getFirstBundle().Chain.ChainID, int64(clientHeight.RevisionHeight+1), clientHeight, altTime.Add(10*time.Second), @@ -61,13 +61,13 @@ func (s *CCVTestSuite) TestHandleConsumerMisbehaviour() { validator, _ := s.getValByIdx(0) initialTokens := math.LegacyNewDecFromInt(validator.GetTokens()) - err := s.providerApp.GetProviderKeeper().HandleConsumerMisbehaviour(s.providerCtx(), *misb) + err := s.providerApp.GetProviderKeeper().HandleConsumerMisbehaviour(s.providerCtx(), s.getFirstBundle().ConsumerId, *misb) s.NoError(err) // verify that validators are jailed, tombstoned, and slashed for _, v := range clientTMValset.Validators { consuAddr := sdk.ConsAddress(v.Address.Bytes()) - provAddr := s.providerApp.GetProviderKeeper().GetProviderAddrFromConsumerAddr(s.providerCtx(), s.consumerChain.ChainID, types.NewConsumerConsAddress(consuAddr)) + provAddr := s.providerApp.GetProviderKeeper().GetProviderAddrFromConsumerAddr(s.providerCtx(), s.getFirstBundle().ConsumerId, types.NewConsumerConsAddress(consuAddr)) val, err := s.providerApp.GetTestStakingKeeper().GetValidatorByConsAddr(s.providerCtx(), provAddr.Address) s.Require().NoError(err) s.Require().True(val.Jailed) @@ -102,7 +102,7 @@ func (s *CCVTestSuite) TestGetByzantineValidators() { // create a consumer client header clientHeader := s.consumerChain.CreateTMClientHeader( - s.consumerChain.ChainID, + s.getFirstBundle().Chain.ChainID, int64(clientHeight.RevisionHeight+1), clientHeight, altTime, @@ -144,7 +144,7 @@ func (s *CCVTestSuite) TestGetByzantineValidators() { "incorrect valset - shouldn't pass", func() *ibctmtypes.Misbehaviour { clientHeader := s.consumerChain.CreateTMClientHeader( - s.consumerChain.ChainID, + s.getFirstBundle().Chain.ChainID, int64(clientHeight.RevisionHeight+1), clientHeight, altTime.Add(time.Minute), @@ -155,7 +155,7 @@ func (s *CCVTestSuite) TestGetByzantineValidators() { ) clientHeaderWithCorruptedValset := s.consumerChain.CreateTMClientHeader( - s.consumerChain.ChainID, + s.getFirstBundle().Chain.ChainID, int64(clientHeight.RevisionHeight+1), clientHeight, altTime.Add(time.Hour), @@ -181,7 +181,7 @@ func (s *CCVTestSuite) TestGetByzantineValidators() { "incorrect valset 2 - shouldn't pass", func() *ibctmtypes.Misbehaviour { clientHeader := s.consumerChain.CreateTMClientHeader( - s.consumerChain.ChainID, + s.getFirstBundle().Chain.ChainID, int64(clientHeight.RevisionHeight+1), clientHeight, altTime.Add(time.Minute), @@ -192,7 +192,7 @@ func (s *CCVTestSuite) TestGetByzantineValidators() { ) clientHeaderWithCorruptedSigs := s.consumerChain.CreateTMClientHeader( - s.consumerChain.ChainID, + s.getFirstBundle().Chain.ChainID, int64(clientHeight.RevisionHeight+1), clientHeight, altTime.Add(time.Hour), @@ -220,7 +220,7 @@ func (s *CCVTestSuite) TestGetByzantineValidators() { "incorrect signatures - shouldn't pass", func() *ibctmtypes.Misbehaviour { clientHeader := s.consumerChain.CreateTMClientHeader( - s.consumerChain.ChainID, + s.getFirstBundle().Chain.ChainID, int64(clientHeight.RevisionHeight+1), clientHeight, altTime.Add(time.Minute), @@ -231,7 +231,7 @@ func (s *CCVTestSuite) TestGetByzantineValidators() { ) clientHeaderWithCorruptedSigs := s.consumerChain.CreateTMClientHeader( - s.consumerChain.ChainID, + s.getFirstBundle().Chain.ChainID, int64(clientHeight.RevisionHeight+1), clientHeight, altTime.Add(time.Hour), @@ -262,7 +262,7 @@ func (s *CCVTestSuite) TestGetByzantineValidators() { // the resulting header contains invalid fields // i.e. ValidatorsHash, NextValidatorsHash. Header2: s.consumerChain.CreateTMClientHeader( - s.consumerChain.ChainID, + s.getFirstBundle().Chain.ChainID, int64(clientHeight.RevisionHeight+1), clientHeight, altTime, @@ -286,7 +286,7 @@ func (s *CCVTestSuite) TestGetByzantineValidators() { Header1: clientHeader, // the resulting header contains a different BlockID Header2: s.consumerChain.CreateTMClientHeader( - s.consumerChain.ChainID, + s.getFirstBundle().Chain.ChainID, int64(clientHeight.RevisionHeight+1), clientHeight, altTime.Add(time.Minute), @@ -308,7 +308,7 @@ func (s *CCVTestSuite) TestGetByzantineValidators() { // create a valid header with a different hash // and commit round amnesiaHeader := s.consumerChain.CreateTMClientHeader( - s.consumerChain.ChainID, + s.getFirstBundle().Chain.ChainID, int64(clientHeight.RevisionHeight+1), clientHeight, altTime.Add(time.Minute), @@ -383,7 +383,7 @@ func (s *CCVTestSuite) TestCheckMisbehaviour() { // create a valid client header clientHeader := s.consumerChain.CreateTMClientHeader( - s.consumerChain.ChainID, + s.getFirstBundle().Chain.ChainID, int64(clientHeight.RevisionHeight+1), clientHeight, headerTs, @@ -402,7 +402,7 @@ func (s *CCVTestSuite) TestCheckMisbehaviour() { // create a conflicting client with different block ID using // to alternative validator set clientHeaderWithDiffBlockID := s.consumerChain.CreateTMClientHeader( - s.consumerChain.ChainID, + s.getFirstBundle().Chain.ChainID, int64(clientHeight.RevisionHeight+1), clientHeight, headerTs, @@ -419,7 +419,7 @@ func (s *CCVTestSuite) TestCheckMisbehaviour() { // create a conflicting client header with insufficient voting power clientHeaderWithInsufficientVotingPower := s.consumerChain.CreateTMClientHeader( - s.consumerChain.ChainID, + s.getFirstBundle().Chain.ChainID, int64(clientHeight.RevisionHeight+1), clientHeight, // use a different block time to change the header BlockID @@ -434,7 +434,7 @@ func (s *CCVTestSuite) TestCheckMisbehaviour() { equivocationEvidenceMinHeight := clientHeight.RevisionHeight + 1 s.providerApp.GetProviderKeeper().SetEquivocationEvidenceMinHeight( s.providerCtx(), - s.consumerChain.ChainID, + s.getFirstBundle().ConsumerId, equivocationEvidenceMinHeight, ) @@ -485,7 +485,7 @@ func (s *CCVTestSuite) TestCheckMisbehaviour() { ClientId: s.path.EndpointA.ClientID, Header1: clientHeader, Header2: s.consumerChain.CreateTMClientHeader( - s.consumerChain.ChainID, + s.getFirstBundle().Chain.ChainID, int64(clientHeight.RevisionHeight+2), clientHeight, headerTs, @@ -502,7 +502,7 @@ func (s *CCVTestSuite) TestCheckMisbehaviour() { &ibctmtypes.Misbehaviour{ ClientId: s.path.EndpointA.ClientID, Header1: s.consumerChain.CreateTMClientHeader( - s.consumerChain.ChainID, + s.getFirstBundle().Chain.ChainID, int64(equivocationEvidenceMinHeight-1), clientHeight, headerTs, @@ -512,7 +512,7 @@ func (s *CCVTestSuite) TestCheckMisbehaviour() { altSigners, ), Header2: s.consumerChain.CreateTMClientHeader( - s.consumerChain.ChainID, + s.getFirstBundle().Chain.ChainID, int64(equivocationEvidenceMinHeight-1), clientHeight, headerTs, @@ -547,7 +547,7 @@ func (s *CCVTestSuite) TestCheckMisbehaviour() { for _, tc := range testCases { s.Run(tc.name, func() { - err := s.providerApp.GetProviderKeeper().CheckMisbehaviour(s.providerCtx(), *tc.misbehaviour) + err := s.providerApp.GetProviderKeeper().CheckMisbehaviour(s.providerCtx(), s.getFirstBundle().ConsumerId, *tc.misbehaviour) cs, ok := s.providerApp.GetIBCKeeper().ClientKeeper.GetClientState(s.providerCtx(), s.path.EndpointA.ClientID) s.Require().True(ok) // verify that the client wasn't frozen diff --git a/tests/integration/partial_set_security_test.go b/tests/integration/partial_set_security_test.go index ebc6336fee..e99ce6f44a 100644 --- a/tests/integration/partial_set_security_test.go +++ b/tests/integration/partial_set_security_test.go @@ -1,6 +1,7 @@ package integration import ( + "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" "slices" "sort" "testing" @@ -151,7 +152,9 @@ func TestMinStake(t *testing.T) { // adjust parameters // set the minStake according to the test case - providerKeeper.SetMinStake(s.providerChain.GetContext(), s.consumerChain.ChainID, tc.minStake) + providerKeeper.SetConsumerPowerShapingParameters(s.providerChain.GetContext(), s.getFirstBundle().ConsumerId, types.PowerShapingParameters{ + MinStake: tc.minStake, + }) // delegate and undelegate to trigger a vscupdate diff --git a/tests/integration/provider_gov_hooks.go b/tests/integration/provider_gov_hooks.go index 813a62a671..0890436781 100644 --- a/tests/integration/provider_gov_hooks.go +++ b/tests/integration/provider_gov_hooks.go @@ -13,33 +13,55 @@ import ( testkeeper "github.com/cosmos/interchain-security/v5/testutil/keeper" ) -// tests AfterProposalSubmission and AfterProposalVotingPeriodEnded hooks -// hooks require adding a proposal in the gov module and registering a consumer chain with the provider module +// TestAfterPropSubmissionAndVotingPeriodEnded tests AfterProposalSubmission and AfterProposalVotingPeriodEnded hooks +// require adding a proposal in the gov module and registering a consumer chain with the provider module func (s *CCVTestSuite) TestAfterPropSubmissionAndVotingPeriodEnded() { ctx := s.providerChain.GetContext() providerKeeper := s.providerApp.GetProviderKeeper() govKeeper := s.providerApp.GetTestGovKeeper() proposer := s.providerChain.SenderAccount - addConsumerProp := testkeeper.GetTestMsgConsumerAddition() + msgUpdateConsumer := testkeeper.GetTestMsgUpdateConsumer() - proposal, err := v1.NewProposal([]sdk.Msg{&addConsumerProp}, 1, time.Now(), time.Now().Add(1*time.Hour), "metadata", "title", "summary", proposer.GetAddress(), false) + proposal, err := v1.NewProposal([]sdk.Msg{&msgUpdateConsumer}, 1, time.Now(), time.Now().Add(1*time.Hour), "metadata", "title", "summary", proposer.GetAddress(), false) s.Require().NoError(err) err = govKeeper.SetProposal(ctx, proposal) s.Require().NoError(err) - providerKeeper.Hooks().AfterProposalSubmission(ctx, proposal.Id) + // the proposal can only be submitted if the owner of the chain is the gov module + providerKeeper.SetConsumerOwnerAddress(ctx, msgUpdateConsumer.ConsumerId, "some bogus address") - // verify that the proposal ID is created - proposalIdOnProvider, ok := providerKeeper.GetProposedConsumerChain(ctx, proposal.Id) + err = providerKeeper.Hooks().AfterProposalSubmission(ctx, proposal.Id) + s.Require().Error(err) + + // the proposal can only be submitted if the owner of the chain is the gov module + govModuleAddress := "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn" + providerKeeper.SetConsumerOwnerAddress(ctx, msgUpdateConsumer.ConsumerId, govModuleAddress) + + err = providerKeeper.Hooks().AfterProposalSubmission(ctx, proposal.Id) + s.Require().NoError(err) + + // verify that the proposal id is created + consumerIdOnProvider, ok := providerKeeper.GetProposalIdToConsumerId(ctx, proposal.Id) s.Require().True(ok) - s.Require().NotEmpty(proposalIdOnProvider) - s.Require().Equal(addConsumerProp.ChainId, proposalIdOnProvider) + s.Require().NotEmpty(consumerIdOnProvider) + s.Require().Equal(msgUpdateConsumer.ConsumerId, consumerIdOnProvider) providerKeeper.Hooks().AfterProposalVotingPeriodEnded(ctx, proposal.Id) - // verify that the proposal ID is deleted - s.Require().Empty(providerKeeper.GetProposedConsumerChain(ctx, proposal.Id)) + // verify that the proposal id is deleted + s.Require().Empty(providerKeeper.GetProposalIdToConsumerId(ctx, proposal.Id)) + + // assert that a proposal with more than one `MsgUpdateConsumer` messages fails + proposal, err = v1.NewProposal([]sdk.Msg{&msgUpdateConsumer, &msgUpdateConsumer}, 1, time.Now(), time.Now().Add(1*time.Hour), "metadata", "title", "summary", proposer.GetAddress(), false) + s.Require().NoError(err) + + err = govKeeper.SetProposal(ctx, proposal) + s.Require().NoError(err) + + err = providerKeeper.Hooks().AfterProposalSubmission(ctx, proposal.Id) + s.Require().Error(err) + } func (s *CCVTestSuite) TestGetConsumerAdditionFromProp() { diff --git a/tests/integration/setup.go b/tests/integration/setup.go index eeb980200f..20924e9b2e 100644 --- a/tests/integration/setup.go +++ b/tests/integration/setup.go @@ -3,6 +3,7 @@ package integration import ( "context" "fmt" + "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" "testing" transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" @@ -21,7 +22,6 @@ import ( icstestingutils "github.com/cosmos/interchain-security/v5/testutil/ibc_testing" testutil "github.com/cosmos/interchain-security/v5/testutil/integration" consumertypes "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" ) @@ -60,7 +60,7 @@ type CCVTestSuite struct { // The transfer path to the first consumer among multiple. transferPath *ibctesting.Path - // A map from consumer chain ID to its consumer bundle. + // A map from consumer id to its consumer bundle. // The preferred way to access chains, apps, and paths when designing tests around multiple consumers. consumerBundles map[string]*icstestingutils.ConsumerBundle skippedTests map[string]bool @@ -149,35 +149,28 @@ func (suite *CCVTestSuite) SetupTest() { // 1. the consumer chain is added to the coordinator // 2. MakeGenesis is called on the provider chain // 3. ibc/testing sets the tendermint header for the consumer chain app - providerKeeper.SetPendingConsumerAdditionProp(suite.providerCtx(), &types.ConsumerAdditionProposal{ - ChainId: icstestingutils.FirstConsumerChainID, - }) - ps := providerKeeper.GetAllPendingConsumerAdditionProps(suite.providerCtx()) - preProposalKeyAssignment(suite, icstestingutils.FirstConsumerChainID) - // remove props so they don't interfere with the rest of the setup - // if not removed here, setupConsumerCallback will have 2 proposals for adding the first consumer chain - providerKeeper.DeletePendingConsumerAdditionProps(suite.providerCtx(), ps...) + providerKeeper.SetConsumerPhase(suite.providerCtx(), icstestingutils.FirstConsumerId, keeper.Initialized) + preProposalKeyAssignment(suite, icstestingutils.FirstConsumerId) // start consumer chains suite.consumerBundles = make(map[string]*icstestingutils.ConsumerBundle) for i := 0; i < icstestingutils.NumConsumers; i++ { bundle := suite.setupConsumerCallback(&suite.Suite, suite.coordinator, i) - suite.consumerBundles[bundle.Chain.ChainID] = bundle + suite.consumerBundles[bundle.ConsumerId] = bundle suite.registerPacketSniffer(bundle.Chain) // check that TopN is correctly set for the consumer - topN, found := providerKeeper.GetTopN(suite.providerCtx(), bundle.Chain.ChainID) - suite.Require().True(found) + topN := providerKeeper.GetTopN(suite.providerCtx(), bundle.ConsumerId) suite.Require().Equal(bundle.TopN, topN) } // initialize each consumer chain with it's corresponding genesis state // stored on the provider. - for chainID := range suite.consumerBundles { + for consumerId := range suite.consumerBundles { consumerGenesisState, found := providerKeeper.GetConsumerGenesis( suite.providerCtx(), - chainID, + consumerId, ) suite.Require().True(found, "consumer genesis not found") @@ -186,7 +179,7 @@ func (suite *CCVTestSuite) SetupTest() { Provider: consumerGenesisState.Provider, NewChain: consumerGenesisState.NewChain, } - initConsumerChain(suite, chainID, &genesisState) + initConsumerChain(suite, consumerId, &genesisState) } // try updating all clients @@ -221,11 +214,11 @@ func (s *CCVTestSuite) getSentPacket(chain *ibctesting.TestChain, sequence uint6 // initConsumerChain initializes a consumer chain given a genesis state func initConsumerChain( s *CCVTestSuite, - chainID string, + consumerId string, genesisState *consumertypes.GenesisState, ) { providerKeeper := s.providerApp.GetProviderKeeper() - bundle := s.consumerBundles[chainID] + bundle := s.consumerBundles[consumerId] // run CCV module init genesis s.NotPanics(func() { @@ -249,7 +242,7 @@ func initConsumerChain( // Set provider endpoint's clientID for each consumer providerEndpointClientID, found := providerKeeper.GetConsumerClientId( s.providerCtx(), - chainID, + consumerId, ) s.Require().True(found, "provider endpoint clientID not found") bundle.Path.EndpointB.ClientID = providerEndpointClientID @@ -291,7 +284,7 @@ func initConsumerChain( err = bundle.Path.EndpointA.UpdateClient() s.Require().NoError(err) - if chainID == icstestingutils.FirstConsumerChainID { + if consumerId == "2" { // Support tests that were written before multiple consumers were supported. firstBundle := s.getFirstBundle() s.consumerApp = firstBundle.App @@ -379,14 +372,14 @@ func (suite *CCVTestSuite) SetupAllTransferChannels() { suite.SetupTransferChannel() // setup all the remaining consumers transfer channels - for chainID := range suite.consumerBundles { + for consumerId := range suite.consumerBundles { // skip fist consumer - if chainID == suite.consumerChain.ChainID { + if consumerId == suite.getFirstBundle().ConsumerId { continue } // get the bundle for the chain ID - bundle := suite.consumerBundles[chainID] + bundle := suite.consumerBundles[consumerId] // setup the transfer channel suite.setupTransferChannel( bundle.TransferPath, @@ -423,9 +416,9 @@ func (s CCVTestSuite) validateEndpointsClientConfig(consumerBundle icstestinguti } // preProposalKeyAssignment assigns keys to all provider validators for -// the consumer with chainID before the chain is registered, i.e., +// the consumer with consumerId before the chain is registered, i.e., // before a client to the consumer is created -func preProposalKeyAssignment(s *CCVTestSuite, chainID string) { +func preProposalKeyAssignment(s *CCVTestSuite, consumerId string) { providerKeeper := s.providerApp.GetProviderKeeper() for _, val := range s.providerChain.Vals.Validators { @@ -445,7 +438,7 @@ func preProposalKeyAssignment(s *CCVTestSuite, chainID string) { // as a result, NewTestChainWithValSet in AddConsumer uses providerChain.Signers s.providerChain.Signers[tmPubKey.Address().String()] = privVal - err = providerKeeper.AssignConsumerKey(s.providerCtx(), chainID, validator, consumerKey) + err = providerKeeper.AssignConsumerKey(s.providerCtx(), consumerId, validator, consumerKey) s.Require().NoError(err) } } diff --git a/tests/integration/slashing.go b/tests/integration/slashing.go index eab288deb3..8156672a0d 100644 --- a/tests/integration/slashing.go +++ b/tests/integration/slashing.go @@ -57,7 +57,7 @@ func (s *CCVTestSuite) TestRelayAndApplyDowntimePacket() { // map consumer consensus address to provider consensus address providerConsAddr, found := providerKeeper.GetValidatorByConsumerAddr( s.providerCtx(), - s.consumerChain.ChainID, + s.getFirstBundle().ConsumerId, consumerConsAddr, ) s.Require().True(found) @@ -188,7 +188,7 @@ func (s *CCVTestSuite) TestRelayAndApplyDoubleSignPacket() { // map consumer consensus address to provider consensus address providerConsAddr, found := providerKeeper.GetValidatorByConsumerAddr( s.providerCtx(), - s.consumerChain.ChainID, + s.getFirstBundle().ConsumerId, consumerConsAddr) s.Require().True(found) @@ -307,7 +307,7 @@ func (suite *CCVTestSuite) TestHandleSlashPacketDowntime() { suite.Require().Equal(stakingtypes.Bonded, validator.GetStatus()) // set init VSC id for chain0 - providerKeeper.SetInitChainHeight(suite.providerCtx(), suite.consumerChain.ChainID, uint64(suite.providerCtx().BlockHeight())) + providerKeeper.SetInitChainHeight(suite.providerCtx(), suite.getFirstBundle().ConsumerId, uint64(suite.providerCtx().BlockHeight())) // set validator signing-info providerSlashingKeeper.SetValidatorSigningInfo( @@ -316,7 +316,7 @@ func (suite *CCVTestSuite) TestHandleSlashPacketDowntime() { slashingtypes.ValidatorSigningInfo{Address: consAddr.String()}, ) - providerKeeper.HandleSlashPacket(suite.providerCtx(), suite.consumerChain.ChainID, + providerKeeper.HandleSlashPacket(suite.providerCtx(), suite.getFirstBundle().ConsumerId, *ccv.NewSlashPacketData( abci.Validator{Address: tmVal.Address, Power: 0}, uint64(0), @@ -413,7 +413,7 @@ func (suite *CCVTestSuite) TestOnRecvSlashPacketErrors() { suite.Require().NoError(err, "no error expected") suite.Require().Equal(ccv.SlashPacketHandledResult, ackResult, "expected successful ack") - providerKeeper.SetConsumerValidator(ctx, firstBundle.Chain.ChainID, providertypes.ConsensusValidator{ + providerKeeper.SetConsumerValidator(ctx, firstBundle.ConsumerId, providertypes.ConsensusValidator{ ProviderConsAddr: validAddress, }) diff --git a/tests/integration/stop_consumer.go b/tests/integration/stop_consumer.go index 839bd10771..c296026e0a 100644 --- a/tests/integration/stop_consumer.go +++ b/tests/integration/stop_consumer.go @@ -75,8 +75,8 @@ func (s *CCVTestSuite) TestStopConsumerChain() { }, { func(suite *CCVTestSuite) error { - providerKeeper.SetSlashAcks(s.providerCtx(), firstBundle.Chain.ChainID, []string{"validator-1", "validator-2", "validator-3"}) - providerKeeper.AppendPendingVSCPackets(s.providerCtx(), firstBundle.Chain.ChainID, ccv.ValidatorSetChangePacketData{ValsetUpdateId: 1}) + providerKeeper.SetSlashAcks(s.providerCtx(), firstBundle.ConsumerId, []string{"validator-1", "validator-2", "validator-3"}) + providerKeeper.AppendPendingVSCPackets(s.providerCtx(), firstBundle.ConsumerId, ccv.ValidatorSetChangePacketData{ValsetUpdateId: 1}) return nil }, }, @@ -88,11 +88,11 @@ func (s *CCVTestSuite) TestStopConsumerChain() { } // stop the consumer chain - err = providerKeeper.StopConsumerChain(s.providerCtx(), firstBundle.Chain.ChainID, true) + err = providerKeeper.StopConsumerChain(s.providerCtx(), firstBundle.ConsumerId, true) s.Require().NoError(err) // check all states are removed and the unbonding operation released - s.checkConsumerChainIsRemoved(firstBundle.Chain.ChainID, true) + s.checkConsumerChainIsRemoved(firstBundle.ConsumerId, true) } // TODO Simon: implement OnChanCloseConfirm in IBC-GO testing to close the consumer chain's channel end @@ -105,7 +105,7 @@ func (s *CCVTestSuite) TestStopConsumerOnChannelClosed() { providerKeeper := s.providerApp.GetProviderKeeper() // stop the consumer chain - err := providerKeeper.StopConsumerChain(s.providerCtx(), s.consumerChain.ChainID, true) + err := providerKeeper.StopConsumerChain(s.providerCtx(), s.getFirstBundle().ConsumerId, true) s.Require().NoError(err) err = s.path.EndpointA.UpdateClient() @@ -126,7 +126,7 @@ func (s *CCVTestSuite) TestStopConsumerOnChannelClosed() { // s.Require().False(found) } -func (s *CCVTestSuite) checkConsumerChainIsRemoved(chainID string, checkChannel bool) { +func (s *CCVTestSuite) checkConsumerChainIsRemoved(consumerId string, checkChannel bool) { channelID := s.path.EndpointB.ChannelID providerKeeper := s.providerApp.GetProviderKeeper() @@ -136,18 +136,18 @@ func (s *CCVTestSuite) checkConsumerChainIsRemoved(chainID string, checkChannel } // verify consumer chain's states are removed - _, found := providerKeeper.GetConsumerGenesis(s.providerCtx(), chainID) + _, found := providerKeeper.GetConsumerGenesis(s.providerCtx(), consumerId) s.Require().False(found) - _, found = providerKeeper.GetConsumerClientId(s.providerCtx(), chainID) + _, found = providerKeeper.GetConsumerClientId(s.providerCtx(), consumerId) s.Require().False(found) - _, found = providerKeeper.GetChainToChannel(s.providerCtx(), chainID) + _, found = providerKeeper.GetConsumerIdToChannelId(s.providerCtx(), consumerId) s.Require().False(found) - _, found = providerKeeper.GetChannelToChain(s.providerCtx(), channelID) + _, found = providerKeeper.GetChannelIdToConsumerId(s.providerCtx(), channelID) s.Require().False(found) - s.Require().Nil(providerKeeper.GetSlashAcks(s.providerCtx(), chainID)) - s.Require().Zero(providerKeeper.GetInitChainHeight(s.providerCtx(), chainID)) - s.Require().Empty(providerKeeper.GetPendingVSCPackets(s.providerCtx(), chainID)) + s.Require().Nil(providerKeeper.GetSlashAcks(s.providerCtx(), consumerId)) + s.Require().Zero(providerKeeper.GetInitChainHeight(s.providerCtx(), consumerId)) + s.Require().Empty(providerKeeper.GetPendingVSCPackets(s.providerCtx(), consumerId)) } diff --git a/tests/mbt/driver/core.go b/tests/mbt/driver/core.go index 2cd618096f..8d0332f504 100644 --- a/tests/mbt/driver/core.go +++ b/tests/mbt/driver/core.go @@ -220,7 +220,7 @@ func (s *Driver) getStateString() string { state.WriteString("\n") state.WriteString("Consumers Chains:\n") - chainIds := s.providerKeeper().GetAllRegisteredConsumerChainIDs(s.providerCtx()) + chainIds := s.providerKeeper().GetAllRegisteredConsumerIds(s.providerCtx()) state.WriteString(strings.Join(chainIds, ", ")) state.WriteString("\n\n") @@ -258,7 +258,7 @@ func (s *Driver) getChainStateString(chain ChainId) string { if !s.isProviderChain(chain) { // Check whether the chain is in the consumer chains on the provider - consumerChainIDs := s.providerKeeper().GetAllRegisteredConsumerChainIDs(s.providerCtx()) + consumerChainIDs := s.providerKeeper().GetAllRegisteredConsumerIds(s.providerCtx()) found := false for _, consumerChainID := range consumerChainIDs { @@ -366,7 +366,7 @@ func (s *Driver) endAndBeginBlock(chain ChainId, timeAdvancement time.Duration) } func (s *Driver) runningConsumerChainIDs() []ChainId { - consumerIDsOnProvider := s.providerKeeper().GetAllRegisteredConsumerChainIDs(s.providerCtx()) + consumerIDsOnProvider := s.providerKeeper().GetAllRegisteredConsumerIds(s.providerCtx()) consumersWithIntactChannel := make([]ChainId, 0) for _, consumerChainID := range consumerIDsOnProvider { diff --git a/tests/mbt/driver/setup.go b/tests/mbt/driver/setup.go index d9e658c030..adaa444167 100644 --- a/tests/mbt/driver/setup.go +++ b/tests/mbt/driver/setup.go @@ -12,6 +12,7 @@ import ( commitmenttypes "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types" ibctmtypes "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" ibctesting "github.com/cosmos/ibc-go/v8/testing" + "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" "github.com/stretchr/testify/require" @@ -388,7 +389,9 @@ func (s *Driver) ConfigureNewPath(consumerChain, providerChain *ibctesting.TestC require.NoError(s.t, err, "Error setting consumer genesis on provider for chain %v", consumerChain.ChainID) // set the top N percentage to 100 to simulate a full consumer - s.providerKeeper().SetTopN(providerChain.GetContext(), consumerChain.ChainID, 100) + s.providerKeeper().SetConsumerPowerShapingParameters(providerChain.GetContext(), consumerChain.ChainID, types.PowerShapingParameters{ + Top_N: 100, + }) // Client ID is set in InitGenesis and we treat it as a black box. So // must query it to use it with the endpoint. diff --git a/testutil/ibc_testing/generic_setup.go b/testutil/ibc_testing/generic_setup.go index 3aaae5702f..d9aa02d732 100644 --- a/testutil/ibc_testing/generic_setup.go +++ b/testutil/ibc_testing/generic_setup.go @@ -3,9 +3,10 @@ package ibc_testing import ( "encoding/json" "fmt" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" "testing" - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" ibctesting "github.com/cosmos/ibc-go/v8/testing" testkeeper "github.com/cosmos/interchain-security/v5/testutil/keeper" "github.com/stretchr/testify/require" @@ -37,7 +38,7 @@ const ( ) var ( - FirstConsumerChainID string + FirstConsumerId string provChainID string democConsumerChainID string consumerTopNParams [NumConsumers]uint32 @@ -46,7 +47,7 @@ var ( func init() { // Disable revision format ibctesting.ChainIDSuffix = "" - FirstConsumerChainID = ibctesting.GetChainID(2) + FirstConsumerId = "2" provChainID = ibctesting.GetChainID(1) democConsumerChainID = ibctesting.GetChainID(5000) // TopN parameter values per consumer chain initiated @@ -57,6 +58,7 @@ func init() { // ConsumerBundle serves as a way to store useful in-mem consumer app chain state // and relevant IBC paths in the context of CCV integration testing. type ConsumerBundle struct { + ConsumerId string Chain *ibctesting.TestChain App testutil.ConsumerApp Path *ibctesting.Path @@ -138,20 +140,26 @@ func AddConsumer[Tp testutil.ProviderApp, Tc testutil.ConsumerApp]( providerApp := providerChain.App.(Tp) providerKeeper := providerApp.GetProviderKeeper() - prop := testkeeper.GetTestConsumerAdditionProp() - prop.ChainId = chainID - prop.Top_N = consumerTopNParams[index] // isn't used in CreateConsumerClient + consumerMetadata := testkeeper.GetTestConsumerMetadata() + initializationParameters := testkeeper.GetTestInitializationParameters() // NOTE: we cannot use the time.Now() because the coordinator chooses a hardcoded start time // using time.Now() could set the spawn time to be too far in the past or too far in the future - prop.SpawnTime = coordinator.CurrentTime + initializationParameters.SpawnTime = coordinator.CurrentTime // NOTE: the initial height passed to CreateConsumerClient // must be the height on the consumer when InitGenesis is called - prop.InitialHeight = clienttypes.Height{RevisionNumber: 0, RevisionHeight: 2} + initializationParameters.InitialHeight = clienttypes.Height{RevisionNumber: 0, RevisionHeight: 2} + + powerShapingParameters := testkeeper.GetTestPowerShapingParameters() + powerShapingParameters.Top_N = consumerTopNParams[index] // isn't used in CreateConsumerClient - providerKeeper.SetPendingConsumerAdditionProp(providerChain.GetContext(), prop) - props := providerKeeper.GetAllPendingConsumerAdditionProps(providerChain.GetContext()) - s.Require().Len(props, 1, "unexpected len consumer addition proposals in AddConsumer") + consumerId := fmt.Sprintf("%d", index+2) + providerKeeper.SetConsumerChainId(providerChain.GetContext(), consumerId, chainID) + providerKeeper.SetConsumerMetadata(providerChain.GetContext(), consumerId, consumerMetadata) + providerKeeper.SetConsumerInitializationParameters(providerChain.GetContext(), consumerId, initializationParameters) + providerKeeper.SetConsumerPowerShapingParameters(providerChain.GetContext(), consumerId, powerShapingParameters) + providerKeeper.SetConsumerPhase(providerChain.GetContext(), consumerId, keeper.Initialized) + providerKeeper.AppendSpawnTimeForConsumerToBeLaunched(providerChain.GetContext(), consumerId, coordinator.CurrentTime) // opt-in all validators lastVals, err := providerApp.GetProviderKeeper().GetLastBondedValidators(providerChain.GetContext()) @@ -159,7 +167,8 @@ func AddConsumer[Tp testutil.ProviderApp, Tc testutil.ConsumerApp]( for _, v := range lastVals { consAddr, _ := v.GetConsAddr() - providerKeeper.SetOptedIn(providerChain.GetContext(), chainID, providertypes.NewProviderConsAddress(consAddr)) + providerKeeper.SetOptedIn(providerChain.GetContext(), consumerId, providertypes.NewProviderConsAddress(consAddr)) + providerKeeper.AppendOptedInConsumerId(providerChain.GetContext(), providertypes.NewProviderConsAddress(consAddr), consumerId) } // commit the state on the provider chain @@ -169,8 +178,14 @@ func AddConsumer[Tp testutil.ProviderApp, Tc testutil.ConsumerApp]( // get genesis state created by the provider consumerGenesisState, found := providerKeeper.GetConsumerGenesis( providerChain.GetContext(), - chainID, + consumerId, + ) + + foo, found := providerKeeper.GetConsumerClientId( + providerChain.GetContext(), + consumerId, ) + _ = foo s.Require().True(found, "consumer genesis not found in AddConsumer") @@ -201,8 +216,9 @@ func AddConsumer[Tp testutil.ProviderApp, Tc testutil.ConsumerApp]( } return &ConsumerBundle{ - Chain: testChain, - App: consumerToReturn, - TopN: prop.Top_N, + ConsumerId: consumerId, + Chain: testChain, + App: consumerToReturn, + TopN: powerShapingParameters.Top_N, } } diff --git a/testutil/keeper/mocks.go b/testutil/keeper/mocks.go index 1a1cd971d5..94ef8e1f98 100644 --- a/testutil/keeper/mocks.go +++ b/testutil/keeper/mocks.go @@ -1234,6 +1234,20 @@ func (m *MockAccountKeeper) EXPECT() *MockAccountKeeperMockRecorder { return m.recorder } +// AddressCodec mocks base method. +func (m *MockAccountKeeper) AddressCodec() address.Codec { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AddressCodec") + ret0, _ := ret[0].(address.Codec) + return ret0 +} + +// AddressCodec indicates an expected call of AddressCodec. +func (mr *MockAccountKeeperMockRecorder) AddressCodec() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddressCodec", reflect.TypeOf((*MockAccountKeeper)(nil).AddressCodec)) +} + // GetModuleAccount mocks base method. func (m *MockAccountKeeper) GetModuleAccount(ctx context.Context, name string) types1.ModuleAccountI { m.ctrl.T.Helper() diff --git a/testutil/keeper/unit_test_helpers.go b/testutil/keeper/unit_test_helpers.go index f458ac4c3b..ef8d3a747f 100644 --- a/testutil/keeper/unit_test_helpers.go +++ b/testutil/keeper/unit_test_helpers.go @@ -219,6 +219,7 @@ func GetNewSlashPacketData() types.SlashPacketData { // Also see `TestProviderStateIsCleanedAfterConsumerChainIsStopped`. func SetupForStoppingConsumerChain(t *testing.T, ctx sdk.Context, providerKeeper *providerkeeper.Keeper, mocks MockedKeepers, + consumerId string, ) { t.Helper() @@ -230,9 +231,15 @@ func SetupForStoppingConsumerChain(t *testing.T, ctx sdk.Context, gomock.InOrder(expectations...) - prop := GetTestConsumerAdditionProp() - err := providerKeeper.CreateConsumerClient(ctx, prop) + providerKeeper.SetConsumerChainId(ctx, consumerId, "chainID") + providerKeeper.SetConsumerMetadata(ctx, consumerId, GetTestConsumerMetadata()) + providerKeeper.SetConsumerInitializationParameters(ctx, consumerId, GetTestInitializationParameters()) + providerKeeper.SetConsumerPowerShapingParameters(ctx, consumerId, GetTestPowerShapingParameters()) + providerKeeper.SetConsumerPhase(ctx, consumerId, providerkeeper.Initialized) + + err := providerKeeper.CreateConsumerClient(ctx, consumerId) require.NoError(t, err) + providerKeeper.SetClientIdToConsumerId(ctx, "clientID", consumerId) err = providerKeeper.SetConsumerChain(ctx, "channelID") require.NoError(t, err) } @@ -240,30 +247,69 @@ func SetupForStoppingConsumerChain(t *testing.T, ctx sdk.Context, // TestProviderStateIsCleanedAfterConsumerChainIsStopped executes test assertions for the provider's state being cleaned // after a stopped consumer chain. func TestProviderStateIsCleanedAfterConsumerChainIsStopped(t *testing.T, ctx sdk.Context, providerKeeper providerkeeper.Keeper, - expectedChainID, expectedChannelID string, + consumerId, expectedChannelID string, ) { t.Helper() - _, found := providerKeeper.GetConsumerClientId(ctx, expectedChainID) + _, found := providerKeeper.GetConsumerClientId(ctx, consumerId) require.False(t, found) - _, found = providerKeeper.GetChainToChannel(ctx, expectedChainID) + _, found = providerKeeper.GetConsumerIdToChannelId(ctx, consumerId) require.False(t, found) - _, found = providerKeeper.GetChannelToChain(ctx, expectedChannelID) + _, found = providerKeeper.GetChannelIdToConsumerId(ctx, expectedChannelID) require.False(t, found) - _, found = providerKeeper.GetInitChainHeight(ctx, expectedChainID) + _, found = providerKeeper.GetInitChainHeight(ctx, consumerId) require.False(t, found) - acks := providerKeeper.GetSlashAcks(ctx, expectedChainID) + acks := providerKeeper.GetSlashAcks(ctx, consumerId) require.Empty(t, acks) // in case the chain was successfully stopped, it should not contain a Top N associated to it - _, found = providerKeeper.GetTopN(ctx, expectedChainID) - require.False(t, found) + topN := providerKeeper.GetTopN(ctx, consumerId) + require.Zero(t, topN) // test key assignment state is cleaned - require.Empty(t, providerKeeper.GetAllValidatorConsumerPubKeys(ctx, &expectedChainID)) - require.Empty(t, providerKeeper.GetAllValidatorsByConsumerAddr(ctx, &expectedChainID)) - require.Empty(t, providerKeeper.GetAllConsumerAddrsToPrune(ctx, expectedChainID)) - require.Empty(t, providerKeeper.GetAllCommissionRateValidators(ctx, expectedChainID)) - require.Zero(t, providerKeeper.GetEquivocationEvidenceMinHeight(ctx, expectedChainID)) + require.Empty(t, providerKeeper.GetAllValidatorConsumerPubKeys(ctx, &consumerId)) + require.Empty(t, providerKeeper.GetAllValidatorsByConsumerAddr(ctx, &consumerId)) + require.Empty(t, providerKeeper.GetAllConsumerAddrsToPrune(ctx, consumerId)) + require.Empty(t, providerKeeper.GetAllCommissionRateValidators(ctx, consumerId)) + require.Zero(t, providerKeeper.GetEquivocationEvidenceMinHeight(ctx, consumerId)) +} + +func GetTestConsumerMetadata() providertypes.ConsumerMetadata { + return providertypes.ConsumerMetadata{ + Name: "chain name", + Description: "description", + Metadata: "metadata", + } +} + +func GetTestInitializationParameters() providertypes.ConsumerInitializationParameters { + initialHeight := clienttypes.NewHeight(4, 5) + spawnTime := time.Now() + ccvTimeoutPeriod := types.DefaultCCVTimeoutPeriod + transferTimeoutPeriod := types.DefaultTransferTimeoutPeriod + unbondingPeriod := types.DefaultConsumerUnbondingPeriod + return providertypes.ConsumerInitializationParameters{ + InitialHeight: initialHeight, + GenesisHash: []byte("gen_hash"), + BinaryHash: []byte("bin_hash"), + SpawnTime: spawnTime, + ConsumerRedistributionFraction: types.DefaultConsumerRedistributeFrac, + BlocksPerDistributionTransmission: types.DefaultBlocksPerDistributionTransmission, + DistributionTransmissionChannel: "", + HistoricalEntries: types.DefaultHistoricalEntries, + CcvTimeoutPeriod: ccvTimeoutPeriod, + TransferTimeoutPeriod: transferTimeoutPeriod, + UnbondingPeriod: unbondingPeriod, + } +} + +func GetTestPowerShapingParameters() providertypes.PowerShapingParameters { + return providertypes.PowerShapingParameters{ + Top_N: 0, + ValidatorsPowerCap: 0, + ValidatorSetCap: 0, + Allowlist: nil, + Denylist: nil, + } } func GetTestConsumerAdditionProp() *providertypes.ConsumerAdditionProposal { @@ -294,9 +340,17 @@ func GetTestConsumerAdditionProp() *providertypes.ConsumerAdditionProposal { return prop } +func GetTestMsgUpdateConsumer() providertypes.MsgUpdateConsumer { + return providertypes.MsgUpdateConsumer{ + Signer: "signer", + ConsumerId: "consumerId", + NewOwnerAddress: "newOwnerAddress", + } +} + func GetTestMsgConsumerAddition() providertypes.MsgConsumerAddition { return providertypes.MsgConsumerAddition{ - ChainId: "a ChainID", + ChainId: "a ChainId", InitialHeight: clienttypes.NewHeight(4, 5), GenesisHash: []byte(base64.StdEncoding.EncodeToString([]byte("gen_hash"))), BinaryHash: []byte(base64.StdEncoding.EncodeToString([]byte("bin_hash"))), diff --git a/x/ccv/provider/client/cli/query.go b/x/ccv/provider/client/cli/query.go index 84fbff3fd0..34d715583c 100644 --- a/x/ccv/provider/client/cli/query.go +++ b/x/ccv/provider/client/cli/query.go @@ -40,6 +40,7 @@ func NewQueryCmd() *cobra.Command { cmd.AddCommand(CmdConsumerChainsValidatorHasToValidate()) cmd.AddCommand(CmdValidatorConsumerCommissionRate()) cmd.AddCommand(CmdBlocksUntilNextEpoch()) + cmd.AddCommand(CmdConsumerIdFromClientId()) return cmd } @@ -57,7 +58,7 @@ func CmdConsumerGenesis() *cobra.Command { } queryClient := types.NewQueryClient(clientCtx) - req := types.QueryConsumerGenesisRequest{ChainId: args[0]} + req := types.QueryConsumerGenesisRequest{ConsumerId: args[0]} res, err := queryClient.QueryConsumerGenesis(cmd.Context(), &req) if err != nil { return err @@ -211,7 +212,7 @@ $ %s query provider validator-consumer-key foochain %s1gghjut3ccd8ay0zduzj64hwre } queryClient := types.NewQueryClient(clientCtx) - consumerChainID := args[0] + consumerId := args[0] addr, err := sdk.ConsAddressFromBech32(args[1]) if err != nil { @@ -219,7 +220,7 @@ $ %s query provider validator-consumer-key foochain %s1gghjut3ccd8ay0zduzj64hwre } req := &types.QueryValidatorConsumerAddrRequest{ - ChainId: consumerChainID, + ConsumerId: consumerId, ProviderAddress: addr.String(), } res, err := queryClient.QueryValidatorConsumerAddr(cmd.Context(), req) @@ -366,7 +367,7 @@ func CmdAllPairsValConAddrByConsumerChainID() *cobra.Command { } queryClient := types.NewQueryClient(clientCtx) - req := types.QueryAllPairsValConAddrByConsumerChainIDRequest{ChainId: args[0]} + req := types.QueryAllPairsValConAddrByConsumerChainIDRequest{ConsumerId: args[0]} res, err := queryClient.QueryAllPairsValConAddrByConsumerChainID(cmd.Context(), &req) if err != nil { return err @@ -435,7 +436,7 @@ $ %s consumer-opted-in-validators foochain queryClient := types.NewQueryClient(clientCtx) res, err := queryClient.QueryConsumerChainOptedInValidators(cmd.Context(), - &types.QueryConsumerChainOptedInValidatorsRequest{ChainId: args[0]}) + &types.QueryConsumerChainOptedInValidatorsRequest{ConsumerId: args[0]}) if err != nil { return err } @@ -470,7 +471,7 @@ $ %s consumer-validators foochain queryClient := types.NewQueryClient(clientCtx) res, err := queryClient.QueryConsumerValidators(cmd.Context(), - &types.QueryConsumerValidatorsRequest{ChainId: args[0]}) + &types.QueryConsumerValidatorsRequest{ConsumerId: args[0]}) if err != nil { return err } @@ -554,7 +555,7 @@ $ %s validator-consumer-commission-rate foochain %s1gghjut3ccd8ay0zduzj64hwre2fx res, err := queryClient.QueryValidatorConsumerCommissionRate(cmd.Context(), &types.QueryValidatorConsumerCommissionRateRequest{ - ChainId: args[0], + ConsumerId: args[0], ProviderAddress: addr.String(), }) if err != nil { @@ -596,3 +597,30 @@ func CmdBlocksUntilNextEpoch() *cobra.Command { return cmd } + +func CmdConsumerIdFromClientId() *cobra.Command { + cmd := &cobra.Command{ + Use: "consumer-id-from-client-id [client-id]", + Short: "Query the consumer id of the chain associated with the provided client id", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + + req := &types.QueryConsumerIdFromClientIdRequest{ClientId: args[0]} + res, err := queryClient.QueryConsumerIdFromClientId(cmd.Context(), req) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/ccv/provider/client/cli/tx.go b/x/ccv/provider/client/cli/tx.go index 4011a36a79..4a7cef864f 100644 --- a/x/ccv/provider/client/cli/tx.go +++ b/x/ccv/provider/client/cli/tx.go @@ -5,6 +5,7 @@ import ( "fmt" "os" "strings" + "time" "cosmossdk.io/math" @@ -36,6 +37,9 @@ func GetTxCmd() *cobra.Command { cmd.AddCommand(NewAssignConsumerKeyCmd()) cmd.AddCommand(NewSubmitConsumerMisbehaviourCmd()) cmd.AddCommand(NewSubmitConsumerDoubleVotingCmd()) + cmd.AddCommand(NewCreateConsumerCmd()) + cmd.AddCommand(NewUpdateConsumerCmd()) + cmd.AddCommand(NewRemoveConsumerCmd()) cmd.AddCommand(NewOptInCmd()) cmd.AddCommand(NewOptOutCmd()) cmd.AddCommand(NewSetConsumerCommissionRateCmd()) @@ -209,6 +213,209 @@ Example: return cmd } +func NewCreateConsumerCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "create-consumer [chain-id] [metadata] [initialization-parameters] [power-shaping-parameters]", + Short: "create a consumer chain", + Long: strings.TrimSpace( + fmt.Sprintf(`Create a consumer chain and get the assigned consumer id of this chain. +Note that the one that signs this message is the owner of this consumer chain. The owner can be later +changed by updating the consumer chain. + +Example: +%s tx provider create-consumer [chain-id] [path/to/metadata.json] [path/to/initialization-parameters.json] [path/to/power-shaping-parameters.json] --from node0 --home ../node0 --chain-id $CID +`, version.AppName)), + Args: cobra.ExactArgs(4), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + txf, err := tx.NewFactoryCLI(clientCtx, cmd.Flags()) + if err != nil { + return err + } + txf = txf.WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) + + signer := clientCtx.GetFromAddress().String() + + chainId := args[0] + + metadata := types.ConsumerMetadata{} + metadataJson, err := os.ReadFile(args[1]) + if err != nil { + return err + } + if err = json.Unmarshal(metadataJson, &metadata); err != nil { + return fmt.Errorf("metadata unmarshalling failed: %w", err) + } + + initializationParameters := types.ConsumerInitializationParameters{} + initializationParametersJson, err := os.ReadFile(args[2]) + if err != nil { + return err + } + if err = json.Unmarshal(initializationParametersJson, &initializationParameters); err != nil { + return fmt.Errorf("initialization parameters unmarshalling failed: %w", err) + } + + powerShapingParameters := types.PowerShapingParameters{} + + powerShapingParametersJson, err := os.ReadFile(args[3]) + if err != nil { + return err + } + if err = json.Unmarshal(powerShapingParametersJson, &powerShapingParameters); err != nil { + return fmt.Errorf("power-shaping parameters unmarshalling failed: %w", err) + } + + msg, err := types.NewMsgCreateConsumer(signer, chainId, metadata, &initializationParameters, &powerShapingParameters) + if err != nil { + return err + } + if err = msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + _ = cmd.MarkFlagRequired(flags.FlagFrom) + + return cmd +} + +func NewUpdateConsumerCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "update-consumer [consumer-id] [owner-address] [metadata] [initialization-parameters] [power-shaping-parameters]", + Short: "update a consumer chain", + Long: strings.TrimSpace( + fmt.Sprintf(`Update a consumer chain to change its parameters (e.g., spawn time, allow list, etc.). +Note that only the owner of the chain can initialize it. + +Example: +%s tx provider update-consumer [consumer-id] [owner-address] [path/to/metadata.json] [path/to/initialization-parameters.json] [path/to/power-shaping-parameters.json] --from node0 --home ../node0 --chain-id $CID +`, version.AppName)), + Args: cobra.ExactArgs(5), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + txf, err := tx.NewFactoryCLI(clientCtx, cmd.Flags()) + if err != nil { + return err + } + txf = txf.WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) + + signer := clientCtx.GetFromAddress().String() + consumerId := args[0] + ownerAddress := args[1] + + metadata := types.ConsumerMetadata{} + metadataJson, err := os.ReadFile(args[2]) + if err != nil { + return err + } + if err = json.Unmarshal(metadataJson, &metadata); err != nil { + return fmt.Errorf("metadata unmarshalling failed: %w", err) + } + + initializationParameters := types.ConsumerInitializationParameters{} + initializationParametersJson, err := os.ReadFile(args[3]) + if err != nil { + return err + } + if err = json.Unmarshal(initializationParametersJson, &initializationParameters); err != nil { + return fmt.Errorf("initialization parameters unmarshalling failed: %w", err) + } + + powerShapingParameters := types.PowerShapingParameters{} + powerShapingParametersJson, err := os.ReadFile(args[4]) + if err != nil { + return err + } + if err = json.Unmarshal(powerShapingParametersJson, &powerShapingParameters); err != nil { + return fmt.Errorf("power-shaping parameters unmarshalling failed: %w", err) + } + + msg, err := types.NewMsgUpdateConsumer(signer, consumerId, ownerAddress, &metadata, &initializationParameters, &powerShapingParameters) + if err != nil { + return err + } + if err := msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + _ = cmd.MarkFlagRequired(flags.FlagFrom) + + return cmd +} + +func NewRemoveConsumerCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "remove-consumer [consumer-id] [stop-time-layout] [stop-time-value]", + Short: "remove a consumer chain", + Long: strings.TrimSpace( + fmt.Sprintf(`Removes (and stops) a consumer chain. Note that only the owner of the chain can remove it. +Stop time is parsed by using the layout and the value (see https://pkg.go.dev/time#Parse). + +Example: +%s tx provider remove-consumer [consumer-id] [stop-time-layout] [stop-time-value] --from node0 --home ../node0 --chain-id $CID +`, version.AppName)), + Args: cobra.ExactArgs(3), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + txf, err := tx.NewFactoryCLI(clientCtx, cmd.Flags()) + if err != nil { + return err + } + txf = txf.WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) + + signer := clientCtx.GetFromAddress().String() + consumerId := args[0] + stopTimeLayout := args[1] + stopTimeValue := args[2] + + stopTime, err := time.Parse(stopTimeLayout, stopTimeValue) + if err != nil { + return err + } + + msg, err := types.NewMsgRemoveConsumer(signer, consumerId, stopTime) + if err != nil { + return err + } + if err := msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + _ = cmd.MarkFlagRequired(flags.FlagFrom) + + return cmd +} + func NewOptInCmd() *cobra.Command { cmd := &cobra.Command{ Use: "opt-in [consumer-chain-id] [consumer-pubkey]", diff --git a/x/ccv/provider/handler.go b/x/ccv/provider/handler.go index 78e17257de..937fcb1805 100644 --- a/x/ccv/provider/handler.go +++ b/x/ccv/provider/handler.go @@ -36,6 +36,15 @@ func NewHandler(k *keeper.Keeper) baseapp.MsgServiceHandler { case *types.MsgSetConsumerCommissionRate: res, err := msgServer.SetConsumerCommissionRate(ctx, msg) return sdk.WrapServiceResult(ctx, res, err) + case *types.MsgCreateConsumer: + res, err := msgServer.CreateConsumer(ctx, msg) + return sdk.WrapServiceResult(ctx, res, err) + case *types.MsgUpdateConsumer: + res, err := msgServer.UpdateConsumer(ctx, msg) + return sdk.WrapServiceResult(ctx, res, err) + case *types.MsgRemoveConsumer: + res, err := msgServer.RemoveConsumer(ctx, msg) + return sdk.WrapServiceResult(ctx, res, err) default: return nil, errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized %s message type: %T", types.ModuleName, msg) } diff --git a/x/ccv/provider/handler_test.go b/x/ccv/provider/handler_test.go index 9c14efe91b..7ea306f47e 100644 --- a/x/ccv/provider/handler_test.go +++ b/x/ccv/provider/handler_test.go @@ -46,18 +46,16 @@ func TestAssignConsensusKeyMsgHandling(t *testing.T) { testCases := []struct { name string // State-mutating setup specific to this test case - setup func(sdk.Context, keeper.Keeper, testkeeper.MockedKeepers) - expError bool - chainID string + setup func(sdk.Context, keeper.Keeper, testkeeper.MockedKeepers) + expError bool + consumerId string }{ { name: "success", setup: func(ctx sdk.Context, k keeper.Keeper, mocks testkeeper.MockedKeepers, ) { - k.SetPendingConsumerAdditionProp(ctx, &providertypes.ConsumerAdditionProposal{ - ChainId: "chainid", - }) + k.SetConsumerPhase(ctx, "consumerId", keeper.Initialized) gomock.InOrder( mocks.MockStakingKeeper.EXPECT().GetValidator( ctx, providerCryptoId.SDKValOpAddress(), @@ -67,11 +65,11 @@ func TestAssignConsensusKeyMsgHandling(t *testing.T) { ).Return(stakingtypes.Validator{}, stakingtypes.ErrNoValidatorFound), ) }, - expError: false, - chainID: "chainid", + expError: false, + consumerId: "consumerId", }, { - name: "fail: chain ID not registered", + name: "fail: consumer id does not correspond to a registered chain", setup: func(ctx sdk.Context, k keeper.Keeper, mocks testkeeper.MockedKeepers, ) { @@ -82,36 +80,33 @@ func TestAssignConsensusKeyMsgHandling(t *testing.T) { ).Return(providerCryptoId.SDKStakingValidator(), nil).Times(1), ) }, - expError: true, - chainID: "chainid", + expError: true, + consumerId: "consumerId", }, { name: "fail: missing validator", setup: func(ctx sdk.Context, k keeper.Keeper, mocks testkeeper.MockedKeepers, ) { - k.SetPendingConsumerAdditionProp(ctx, &providertypes.ConsumerAdditionProposal{ - ChainId: "chainid", - }) + k.SetConsumerPhase(ctx, "consumerId", keeper.Initialized) gomock.InOrder( mocks.MockStakingKeeper.EXPECT().GetValidator( ctx, providerCryptoId.SDKValOpAddress(), ).Return(stakingtypes.Validator{}, stakingtypes.ErrNoValidatorFound).Times(1), ) }, - expError: true, - chainID: "chainid", + expError: true, + consumerId: "consumerId", }, { name: "fail: consumer key in use by other validator", setup: func(ctx sdk.Context, k keeper.Keeper, mocks testkeeper.MockedKeepers, ) { - k.SetPendingConsumerAdditionProp(ctx, &providertypes.ConsumerAdditionProposal{ - ChainId: "chainid", - }) + k.SetConsumerPhase(ctx, "consumerId", keeper.Initialized) + // Use the consumer key already used by some other validator - k.SetValidatorByConsumerAddr(ctx, "chainid", consumerConsAddr, providerConsAddr2) + k.SetValidatorByConsumerAddr(ctx, "consumerId", consumerConsAddr, providerConsAddr2) gomock.InOrder( mocks.MockStakingKeeper.EXPECT().GetValidator( @@ -124,19 +119,18 @@ func TestAssignConsensusKeyMsgHandling(t *testing.T) { ).Return(stakingtypes.Validator{}, nil), ) }, - expError: true, - chainID: "chainid", + expError: true, + consumerId: "consumerId", }, { name: "fail: consumer key in use by the same validator", setup: func(ctx sdk.Context, k keeper.Keeper, mocks testkeeper.MockedKeepers, ) { - k.SetPendingConsumerAdditionProp(ctx, &providertypes.ConsumerAdditionProposal{ - ChainId: "chainid", - }) + k.SetConsumerPhase(ctx, "consumerId", keeper.Initialized) + // Use the consumer key already - k.SetValidatorByConsumerAddr(ctx, "chainid", consumerConsAddr, providerConsAddr) + k.SetValidatorByConsumerAddr(ctx, "consumerId", consumerConsAddr, providerConsAddr) gomock.InOrder( mocks.MockStakingKeeper.EXPECT().GetValidator( @@ -147,20 +141,18 @@ func TestAssignConsensusKeyMsgHandling(t *testing.T) { ).Return(stakingtypes.Validator{}, stakingtypes.ErrNoValidatorFound), ) }, - expError: true, - chainID: "chainid", + expError: true, + consumerId: "consumerId", }, { name: "fail: consumer key in use by other validator", setup: func(ctx sdk.Context, k keeper.Keeper, mocks testkeeper.MockedKeepers, ) { - k.SetPendingConsumerAdditionProp(ctx, &providertypes.ConsumerAdditionProposal{ - ChainId: "chainid", - }) + k.SetConsumerPhase(ctx, "consumerId", keeper.Initialized) // Use the consumer key already used by some other validator - k.SetValidatorByConsumerAddr(ctx, "chainid", consumerConsAddr, providerConsAddr2) + k.SetValidatorByConsumerAddr(ctx, "consumerId", consumerConsAddr, providerConsAddr2) gomock.InOrder( mocks.MockStakingKeeper.EXPECT().GetValidator( @@ -173,8 +165,8 @@ func TestAssignConsensusKeyMsgHandling(t *testing.T) { ).Return(stakingtypes.Validator{}, stakingtypes.ErrNoValidatorFound), ) }, - expError: true, - chainID: "chainid", + expError: true, + consumerId: "consumerId", }, } @@ -184,7 +176,7 @@ func TestAssignConsensusKeyMsgHandling(t *testing.T) { tc.setup(ctx, k, mocks) - msg, err := providertypes.NewMsgAssignConsumerKey(tc.chainID, + msg, err := providertypes.NewMsgAssignConsumerKey(tc.consumerId, providerCryptoId.SDKValOpAddress(), consumerKey, providerCryptoId.SDKStakingValidator().OperatorAddress, ) diff --git a/x/ccv/provider/ibc_middleware.go b/x/ccv/provider/ibc_middleware.go index d9d816ab93..3872fd5fbe 100644 --- a/x/ccv/provider/ibc_middleware.go +++ b/x/ccv/provider/ibc_middleware.go @@ -122,7 +122,7 @@ func (im IBCMiddleware) OnRecvPacket( // deserialized without checking errors. if ack.Success() { // execute the middleware logic only if the sender is a consumer chain - consumerID, err := im.keeper.IdentifyConsumerChainIDFromIBCPacket(ctx, packet) + consumerId, err := im.keeper.IdentifyConsumerIdFromIBCPacket(ctx, packet) if err != nil { return ack } @@ -144,13 +144,13 @@ func (im IBCMiddleware) OnRecvPacket( // and if so, adds it to the consumer chain rewards allocation, // otherwise the prohibited coin just stays in the pool forever. if im.keeper.ConsumerRewardDenomExists(ctx, coinDenom) { - alloc := im.keeper.GetConsumerRewardsAllocation(ctx, consumerID) + alloc := im.keeper.GetConsumerRewardsAllocation(ctx, consumerId) alloc.Rewards = alloc.Rewards.Add( sdk.NewDecCoinsFromCoins(sdk.Coin{ Denom: coinDenom, Amount: coinAmt, })...) - im.keeper.SetConsumerRewardsAllocation(ctx, consumerID, alloc) + im.keeper.SetConsumerRewardsAllocation(ctx, consumerId, alloc) } } diff --git a/x/ccv/provider/ibc_module_test.go b/x/ccv/provider/ibc_module_test.go index 58573d3e3b..2d778daf00 100644 --- a/x/ccv/provider/ibc_module_test.go +++ b/x/ccv/provider/ibc_module_test.go @@ -96,17 +96,17 @@ func TestOnChanOpenTry(t *testing.T) { "unexpected client ID mapped to chain ID", func(params *params, keeper *providerkeeper.Keeper) { keeper.SetConsumerClientId( params.ctx, - "consumerChainID", - "invalidClientID", + "consumerId", + "invalidClientId", ) }, false, }, { "other CCV channel exists for this consumer chain", func(params *params, keeper *providerkeeper.Keeper) { - keeper.SetChainToChannel( + keeper.SetConsumerIdToChannelId( params.ctx, - "consumerChainID", + "consumerId", "some existing channel ID", ) }, false, @@ -122,7 +122,8 @@ func TestOnChanOpenTry(t *testing.T) { providerModule := provider.NewAppModule(&providerKeeper, *keeperParams.ParamsSubspace, keeperParams.StoreKey) providerKeeper.SetPort(ctx, ccv.ProviderPortID) - providerKeeper.SetConsumerClientId(ctx, "consumerChainID", "clientIDToConsumer") + providerKeeper.SetConsumerClientId(ctx, "consumerId", "clientIdToConsumer") + providerKeeper.SetClientIdToConsumerId(ctx, "clientIdToConsumer", "consumerId") // Instantiate valid params as default. Individual test cases mutate these as needed. params := params{ @@ -145,9 +146,9 @@ func TestOnChanOpenTry(t *testing.T) { mocks.MockScopedKeeper.EXPECT().ClaimCapability( params.ctx, params.chanCap, host.ChannelCapabilityPath(params.portID, params.channelID)).AnyTimes(), mocks.MockConnectionKeeper.EXPECT().GetConnection(ctx, "connectionIDToConsumer").Return( - conntypes.ConnectionEnd{ClientId: "clientIDToConsumer"}, true, + conntypes.ConnectionEnd{ClientId: "clientIdToConsumer"}, true, ).AnyTimes(), - mocks.MockClientKeeper.EXPECT().GetClientState(ctx, "clientIDToConsumer").Return( + mocks.MockClientKeeper.EXPECT().GetClientState(ctx, "clientIdToConsumer").Return( &ibctmtypes.ClientState{ChainId: "consumerChainID"}, true, ).AnyTimes(), mocks.MockAccountKeeper.EXPECT().GetModuleAccount(ctx, providertypes.ConsumerRewardsPool).Return(&moduleAcct).AnyTimes(), @@ -170,13 +171,13 @@ func TestOnChanOpenTry(t *testing.T) { require.NoError(t, err) md := &ccv.HandshakeMetadata{} err = md.Unmarshal([]byte(metadata)) - require.NoError(t, err) + require.NoError(t, err, tc.name) require.Equal(t, moduleAcct.BaseAccount.Address, md.ProviderFeePoolAddr, "returned dist account metadata must match expected") require.Equal(t, ccv.Version, md.Version, "returned ccv version metadata must match expected") ctrl.Finish() } else { - require.Error(t, err) + require.Error(t, err, tc.name) } } } @@ -309,9 +310,11 @@ func TestOnChanOpenConfirm(t *testing.T) { gomock.InOrder(tc.mockExpectations(ctx, mocks)...) if tc.setDuplicateChannel { - providerKeeper.SetChainToChannel(ctx, "consumerChainID", "existingChannelID") + providerKeeper.SetConsumerIdToChannelId(ctx, "consumerChainID", "existingChannelID") } + providerKeeper.SetClientIdToConsumerId(ctx, "clientID", "consumerChainID") + providerModule := provider.NewAppModule(&providerKeeper, *keeperParams.ParamsSubspace, keeperParams.StoreKey) err := providerModule.OnChanOpenConfirm(ctx, "providerPortID", "channelID") @@ -320,11 +323,11 @@ func TestOnChanOpenConfirm(t *testing.T) { require.NoError(t, err) // Validate channel mappings - channelID, found := providerKeeper.GetChainToChannel(ctx, "consumerChainID") + channelID, found := providerKeeper.GetConsumerIdToChannelId(ctx, "consumerChainID") require.True(t, found) require.Equal(t, "channelID", channelID) - chainID, found := providerKeeper.GetChannelToChain(ctx, "channelID") + chainID, found := providerKeeper.GetChannelIdToConsumerId(ctx, "channelID") require.True(t, found) require.Equal(t, "consumerChainID", chainID) diff --git a/x/ccv/provider/keeper/consumer_equivocation.go b/x/ccv/provider/keeper/consumer_equivocation.go index 8f4f59732a..c4c307b167 100644 --- a/x/ccv/provider/keeper/consumer_equivocation.go +++ b/x/ccv/provider/keeper/consumer_equivocation.go @@ -28,51 +28,57 @@ import ( // Double Voting section // -// HandleConsumerDoubleVoting verifies a double voting evidence for a given a consumer chain ID +// HandleConsumerDoubleVoting verifies a double voting evidence for a given a consumer id // and a public key and, if successful, executes the slashing, jailing, and tombstoning of the malicious validator. func (k Keeper) HandleConsumerDoubleVoting( ctx sdk.Context, + consumerId string, evidence *tmtypes.DuplicateVoteEvidence, - chainID string, pubkey cryptotypes.PubKey, ) error { // check that the evidence is for an ICS consumer chain - if _, found := k.GetConsumerClientId(ctx, chainID); !found { + if _, found := k.GetConsumerClientId(ctx, consumerId); !found { return errorsmod.Wrapf( ccvtypes.ErrInvalidDoubleVotingEvidence, "cannot find consumer chain %s", - chainID, + consumerId, ) } // check that the evidence is not too old - minHeight := k.GetEquivocationEvidenceMinHeight(ctx, chainID) + minHeight := k.GetEquivocationEvidenceMinHeight(ctx, consumerId) if uint64(evidence.VoteA.Height) < minHeight { return errorsmod.Wrapf( ccvtypes.ErrInvalidDoubleVotingEvidence, "evidence for consumer chain %s is too old - evidence height (%d), min (%d)", - chainID, + consumerId, evidence.VoteA.Height, minHeight, ) } + // get the chainId of this consumer chain to verify the double-voting evidence + chainId, err := k.GetConsumerChainId(ctx, consumerId) + if err != nil { + return err + } + // verifies the double voting evidence using the consumer chain public key - if err := k.VerifyDoubleVotingEvidence(*evidence, chainID, pubkey); err != nil { + if err = k.VerifyDoubleVotingEvidence(*evidence, chainId, pubkey); err != nil { return err } // get the validator's consensus address on the provider providerAddr := k.GetProviderAddrFromConsumerAddr( ctx, - chainID, + consumerId, types.NewConsumerConsAddress(sdk.ConsAddress(evidence.VoteA.ValidatorAddress.Bytes())), ) - if err := k.SlashValidator(ctx, providerAddr); err != nil { + if err = k.SlashValidator(ctx, providerAddr); err != nil { return err } - if err := k.JailAndTombstoneValidator(ctx, providerAddr); err != nil { + if err = k.JailAndTombstoneValidator(ctx, providerAddr); err != nil { return err } @@ -88,7 +94,7 @@ func (k Keeper) HandleConsumerDoubleVoting( // for a given chain id and a validator public key func (k Keeper) VerifyDoubleVotingEvidence( evidence tmtypes.DuplicateVoteEvidence, - chainID string, + chainId string, pubkey cryptotypes.PubKey, ) error { if pubkey == nil { @@ -140,10 +146,10 @@ func (k Keeper) VerifyDoubleVotingEvidence( vb := evidence.VoteB.ToProto() // signatures must be valid - if !pubkey.VerifySignature(tmtypes.VoteSignBytes(chainID, va), evidence.VoteA.Signature) { + if !pubkey.VerifySignature(tmtypes.VoteSignBytes(chainId, va), evidence.VoteA.Signature) { return fmt.Errorf("verifying VoteA: %w", tmtypes.ErrVoteInvalidSignature) } - if !pubkey.VerifySignature(tmtypes.VoteSignBytes(chainID, vb), evidence.VoteB.Signature) { + if !pubkey.VerifySignature(tmtypes.VoteSignBytes(chainId, vb), evidence.VoteB.Signature) { return fmt.Errorf("verifying VoteB: %w", tmtypes.ErrVoteInvalidSignature) } @@ -156,11 +162,11 @@ func (k Keeper) VerifyDoubleVotingEvidence( // HandleConsumerMisbehaviour checks if the given IBC misbehaviour corresponds to an equivocation light client attack, // and in this case, slashes, jails, and tombstones -func (k Keeper) HandleConsumerMisbehaviour(ctx sdk.Context, misbehaviour ibctmtypes.Misbehaviour) error { +func (k Keeper) HandleConsumerMisbehaviour(ctx sdk.Context, consumerId string, misbehaviour ibctmtypes.Misbehaviour) error { logger := k.Logger(ctx) // Check that the misbehaviour is valid and that the client consensus states at trusted heights are within trusting period - if err := k.CheckMisbehaviour(ctx, misbehaviour); err != nil { + if err := k.CheckMisbehaviour(ctx, consumerId, misbehaviour); err != nil { logger.Info("Misbehaviour rejected", err.Error()) return err @@ -182,7 +188,7 @@ func (k Keeper) HandleConsumerMisbehaviour(ctx sdk.Context, misbehaviour ibctmty for _, v := range byzantineValidators { providerAddr := k.GetProviderAddrFromConsumerAddr( ctx, - misbehaviour.Header1.Header.ChainID, + consumerId, types.NewConsumerConsAddress(sdk.ConsAddress(v.Address.Bytes())), ) err := k.SlashValidator(ctx, providerAddr) @@ -292,16 +298,26 @@ func headerToLightBlock(h ibctmtypes.Header) (*tmtypes.LightBlock, error) { // CheckMisbehaviour checks that headers in the given misbehaviour forms // a valid light client attack from an ICS consumer chain and that the light client isn't expired -func (k Keeper) CheckMisbehaviour(ctx sdk.Context, misbehaviour ibctmtypes.Misbehaviour) error { - consumerChainID := misbehaviour.Header1.Header.ChainID +func (k Keeper) CheckMisbehaviour(ctx sdk.Context, consumerId string, misbehaviour ibctmtypes.Misbehaviour) error { + chainId := misbehaviour.Header1.Header.ChainID + + consumerChainId, err := k.GetConsumerChainId(ctx, consumerId) + if err != nil { + return err + } else if consumerChainId != chainId { + return fmt.Errorf("incorrect misbehaviour for a different chain id (%s) than that of the consumer chain %s (consumerId: %s)", + chainId, + consumerChainId, + consumerId) + } // check that the misbehaviour is for an ICS consumer chain - clientId, found := k.GetConsumerClientId(ctx, consumerChainID) + clientId, found := k.GetConsumerClientId(ctx, consumerId) if !found { - return fmt.Errorf("incorrect misbehaviour with conflicting headers from a non-existent consumer chain: %s", consumerChainID) + return fmt.Errorf("incorrect misbehaviour with conflicting headers from a non-existent consumer chain (consumerId: %s)", consumerId) } else if misbehaviour.ClientId != clientId { - return fmt.Errorf("incorrect misbehaviour: expected client ID for consumer chain %s is %s got %s", - consumerChainID, + return fmt.Errorf("incorrect misbehaviour: expected client ID for consumer chain with id %s is %s got %s", + consumerId, clientId, misbehaviour.ClientId, ) @@ -315,7 +331,7 @@ func (k Keeper) CheckMisbehaviour(ctx sdk.Context, misbehaviour ibctmtypes.Misbe } // Check that the evidence is not too old - minHeight := k.GetEquivocationEvidenceMinHeight(ctx, consumerChainID) + minHeight := k.GetEquivocationEvidenceMinHeight(ctx, consumerId) evidenceHeight := misbehaviour.Header1.GetHeight().GetRevisionHeight() // Note that the revision number is not relevant for checking the age of evidence // as it's already part of the chain ID and the minimum height is mapped to chain IDs @@ -323,7 +339,7 @@ func (k Keeper) CheckMisbehaviour(ctx sdk.Context, misbehaviour ibctmtypes.Misbe return errorsmod.Wrapf( ccvtypes.ErrInvalidDoubleVotingEvidence, "evidence for consumer chain %s is too old - evidence height (%d), min (%d)", - consumerChainID, + consumerId, evidenceHeight, minHeight, ) @@ -517,20 +533,20 @@ func (k Keeper) SlashValidator(ctx sdk.Context, providerAddr types.ProviderConsA // // SetEquivocationEvidenceMinHeight sets the minimum height -// of a valid consumer equivocation evidence for a given consumer chain ID -func (k Keeper) SetEquivocationEvidenceMinHeight(ctx sdk.Context, chainID string, height uint64) { +// of a valid consumer equivocation evidence for a given consumer id +func (k Keeper) SetEquivocationEvidenceMinHeight(ctx sdk.Context, consumerId string, height uint64) { store := ctx.KVStore(k.storeKey) heightBytes := make([]byte, 8) binary.BigEndian.PutUint64(heightBytes, height) - store.Set(types.EquivocationEvidenceMinHeightKey(chainID), heightBytes) + store.Set(types.EquivocationEvidenceMinHeightKey(consumerId), heightBytes) } // GetEquivocationEvidenceMinHeight returns the minimum height -// of a valid consumer equivocation evidence for a given consumer chain ID -func (k Keeper) GetEquivocationEvidenceMinHeight(ctx sdk.Context, chainID string) uint64 { +// of a valid consumer equivocation evidence for a given consumer id +func (k Keeper) GetEquivocationEvidenceMinHeight(ctx sdk.Context, consumerId string) uint64 { store := ctx.KVStore(k.storeKey) - bz := store.Get(types.EquivocationEvidenceMinHeightKey(chainID)) + bz := store.Get(types.EquivocationEvidenceMinHeightKey(consumerId)) if bz == nil { return 0 } @@ -539,8 +555,8 @@ func (k Keeper) GetEquivocationEvidenceMinHeight(ctx sdk.Context, chainID string } // DeleteEquivocationEvidenceMinHeight deletes the minimum height -// of a valid consumer equivocation evidence for a given consumer chain ID -func (k Keeper) DeleteEquivocationEvidenceMinHeight(ctx sdk.Context, chainID string) { +// of a valid consumer equivocation evidence for a given consumer id +func (k Keeper) DeleteEquivocationEvidenceMinHeight(ctx sdk.Context, consumerId string) { store := ctx.KVStore(k.storeKey) - store.Delete(types.EquivocationEvidenceMinHeightKey(chainID)) + store.Delete(types.EquivocationEvidenceMinHeightKey(consumerId)) } diff --git a/x/ccv/provider/keeper/distribution.go b/x/ccv/provider/keeper/distribution.go index 7970a8c682..13698cde32 100644 --- a/x/ccv/provider/keeper/distribution.go +++ b/x/ccv/provider/keeper/distribution.go @@ -75,7 +75,7 @@ func (k Keeper) AllocateTokens(ctx sdk.Context) { } // Iterate over all registered consumer chains - for _, consumerChainID := range k.GetAllRegisteredConsumerChainIDs(ctx) { + for _, consumerChainID := range k.GetAllRegisteredConsumerIds(ctx) { // note that it's possible that no rewards are collected even though the // reward pool isn't empty. This can happen if the reward pool holds some tokens @@ -176,7 +176,7 @@ func (k Keeper) IsEligibleForConsumerRewards(ctx sdk.Context, consumerValidatorH // to the given consumer chain's validator set func (k Keeper) AllocateTokensToConsumerValidators( ctx sdk.Context, - chainID string, + consumerId string, tokens sdk.DecCoins, ) (allocated sdk.DecCoins) { // return early if the tokens are empty @@ -185,17 +185,17 @@ func (k Keeper) AllocateTokensToConsumerValidators( } // get the total voting power of the consumer valset - totalPower := math.LegacyNewDec(k.ComputeConsumerTotalVotingPower(ctx, chainID)) + totalPower := math.LegacyNewDec(k.ComputeConsumerTotalVotingPower(ctx, consumerId)) if totalPower.IsZero() { return allocated } // Allocate tokens by iterating over the consumer validators - consumerVals, err := k.GetConsumerValSet(ctx, chainID) + consumerVals, err := k.GetConsumerValSet(ctx, consumerId) if err != nil { k.Logger(ctx).Error( "cannot get consumer validator set while allocating rewards from consumer chain", - chainID, + consumerId, "error", err, ) @@ -220,7 +220,7 @@ func (k Keeper) AllocateTokensToConsumerValidators( "cannot find validator by consensus address", consAddr, "while allocating rewards from consumer chain", - chainID, + consumerId, "error", err, ) @@ -228,7 +228,7 @@ func (k Keeper) AllocateTokensToConsumerValidators( } // check if the validator set a custom commission rate for the consumer chain - if cr, found := k.GetConsumerCommissionRate(ctx, chainID, types.NewProviderConsAddress(consAddr)); found { + if cr, found := k.GetConsumerCommissionRate(ctx, consumerId, types.NewProviderConsAddress(consAddr)); found { // set the validator commission rate val.Commission.CommissionRates.Rate = cr } @@ -241,7 +241,7 @@ func (k Keeper) AllocateTokensToConsumerValidators( ) if err != nil { k.Logger(ctx).Error("fail to allocate tokens to validator :%s while allocating rewards from consumer chain: %s", - consAddr, chainID) + consAddr, consumerId) continue } @@ -254,19 +254,19 @@ func (k Keeper) AllocateTokensToConsumerValidators( // consumer reward pools getter and setter -// GetConsumerRewardsAllocation returns the consumer rewards allocation for the given chain ID -func (k Keeper) GetConsumerRewardsAllocation(ctx sdk.Context, chainID string) (pool types.ConsumerRewardsAllocation) { +// GetConsumerRewardsAllocation returns the consumer rewards allocation for the given consumer id +func (k Keeper) GetConsumerRewardsAllocation(ctx sdk.Context, consumerId string) (pool types.ConsumerRewardsAllocation) { store := ctx.KVStore(k.storeKey) - b := store.Get(types.ConsumerRewardsAllocationKey(chainID)) + b := store.Get(types.ConsumerRewardsAllocationKey(consumerId)) k.cdc.MustUnmarshal(b, &pool) return } -// SetConsumerRewardsAllocation sets the consumer rewards allocation for the given chain ID -func (k Keeper) SetConsumerRewardsAllocation(ctx sdk.Context, chainID string, pool types.ConsumerRewardsAllocation) { +// SetConsumerRewardsAllocation sets the consumer rewards allocation for the given consumer id +func (k Keeper) SetConsumerRewardsAllocation(ctx sdk.Context, consumerId string, pool types.ConsumerRewardsAllocation) { store := ctx.KVStore(k.storeKey) b := k.cdc.MustMarshal(&pool) - store.Set(types.ConsumerRewardsAllocationKey(chainID), b) + store.Set(types.ConsumerRewardsAllocationKey(consumerId), b) } // GetConsumerRewardsPool returns the balance @@ -280,20 +280,19 @@ func (k Keeper) GetConsumerRewardsPool(ctx sdk.Context) sdk.Coins { // ComputeConsumerTotalVotingPower returns the validator set total voting power // for the given consumer chain -func (k Keeper) ComputeConsumerTotalVotingPower(ctx sdk.Context, chainID string) (totalPower int64) { +func (k Keeper) ComputeConsumerTotalVotingPower(ctx sdk.Context, consumerId string) (totalPower int64) { // sum the consumer validators set voting powers - vals, err := k.GetConsumerValSet(ctx, chainID) + vals, err := k.GetConsumerValSet(ctx, consumerId) if err != nil { k.Logger(ctx).Error( "cannot get consumer validator set while computing total voting power for consumer chain", - chainID, + consumerId, "error", err, ) return } for _, v := range vals { - // only consider the voting power of a validator that would receive rewards (i.e., validator has been validating for a number of blocks) if !k.IsEligibleForConsumerRewards(ctx, v.JoinHeight) { continue @@ -305,9 +304,9 @@ func (k Keeper) ComputeConsumerTotalVotingPower(ctx sdk.Context, chainID string) return } -// IdentifyConsumerChainIDFromIBCPacket checks if the packet destination matches a registered consumer chain. +// IdentifyConsumerIdFromIBCPacket checks if the packet destination matches a registered consumer chain. // If so, it returns the consumer chain ID, otherwise an error. -func (k Keeper) IdentifyConsumerChainIDFromIBCPacket(ctx sdk.Context, packet channeltypes.Packet) (string, error) { +func (k Keeper) IdentifyConsumerIdFromIBCPacket(ctx sdk.Context, packet channeltypes.Packet) (string, error) { channel, ok := k.channelKeeper.GetChannel(ctx, packet.DestinationPort, packet.DestinationChannel) if !ok { return "", errorsmod.Wrapf(channeltypes.ErrChannelNotFound, "channel not found for channel ID: %s", packet.DestinationChannel) @@ -316,27 +315,31 @@ func (k Keeper) IdentifyConsumerChainIDFromIBCPacket(ctx sdk.Context, packet cha return "", errorsmod.Wrap(channeltypes.ErrTooManyConnectionHops, "must have direct connection to consumer chain") } connectionID := channel.ConnectionHops[0] - _, tmClient, err := k.getUnderlyingClient(ctx, connectionID) + clientId, _, err := k.getUnderlyingClient(ctx, connectionID) if err != nil { return "", err } - chainID := tmClient.ChainId - if _, ok := k.GetChainToChannel(ctx, chainID); !ok { - return "", errorsmod.Wrapf(types.ErrUnknownConsumerChannelId, "no CCV channel found for chain with ID: %s", chainID) + consumerId, found := k.GetClientIdToConsumerId(ctx, clientId) + if !found { + return "", errorsmod.Wrapf(types.ErrUnknownConsumerId, "no consumer id for client with id: %s", clientId) + } + + if _, ok := k.GetConsumerIdToChannelId(ctx, consumerId); !ok { + return "", errorsmod.Wrapf(types.ErrUnknownConsumerChannelId, "no CCV channel found for chain with ID: %s", consumerId) } - return chainID, nil + return consumerId, nil } // HandleSetConsumerCommissionRate sets a per-consumer chain commission rate for the given provider address // on the condition that the given consumer chain exists. -func (k Keeper) HandleSetConsumerCommissionRate(ctx sdk.Context, chainID string, providerAddr types.ProviderConsAddress, commissionRate math.LegacyDec) error { +func (k Keeper) HandleSetConsumerCommissionRate(ctx sdk.Context, consumerId string, providerAddr types.ProviderConsAddress, commissionRate math.LegacyDec) error { // check that the consumer chain exists - if !k.IsConsumerProposedOrRegistered(ctx, chainID) { + if !k.IsConsumerProposedOrRegistered(ctx, consumerId) { return errorsmod.Wrapf( - types.ErrUnknownConsumerChainId, - "unknown consumer chain, with id: %s", chainID) + types.ErrUnknownConsumerId, + "unknown consumer chain, with id: %s", consumerId) } // validate against the minimum commission rate @@ -353,7 +356,7 @@ func (k Keeper) HandleSetConsumerCommissionRate(ctx sdk.Context, chainID string, // set per-consumer chain commission rate for the validator address return k.SetConsumerCommissionRate( ctx, - chainID, + consumerId, providerAddr, commissionRate, ) diff --git a/x/ccv/provider/keeper/distribution_test.go b/x/ccv/provider/keeper/distribution_test.go index e8caeb7c36..57ff82bc95 100644 --- a/x/ccv/provider/keeper/distribution_test.go +++ b/x/ccv/provider/keeper/distribution_test.go @@ -225,13 +225,13 @@ func TestIdentifyConsumerChainIDFromIBCPacket(t *testing.T) { defer ctrl.Finish() tc.expectedCalls(ctx, mocks, tc.packet) - _, err := keeper.IdentifyConsumerChainIDFromIBCPacket( + _, err := keeper.IdentifyConsumerIdFromIBCPacket( ctx, tc.packet, ) if tc.expCCVChannel { - keeper.SetChainToChannel(ctx, chainID, ccvChannel) + keeper.SetConsumerIdToChannelId(ctx, chainID, ccvChannel) } if !tc.expErr { diff --git a/x/ccv/provider/keeper/genesis.go b/x/ccv/provider/keeper/genesis.go index 5b44227f90..0c01cef1e9 100644 --- a/x/ccv/provider/keeper/genesis.go +++ b/x/ccv/provider/keeper/genesis.go @@ -53,8 +53,8 @@ func (k Keeper) InitGenesis(ctx sdk.Context, genState *types.GenesisState) []abc } // check if the CCV channel was established if cs.ChannelId != "" { - k.SetChannelToChain(ctx, cs.ChannelId, chainID) - k.SetChainToChannel(ctx, chainID, cs.ChannelId) + k.SetChannelToConsumerId(ctx, cs.ChannelId, chainID) + k.SetConsumerIdToChannelId(ctx, chainID, cs.ChannelId) k.SetInitChainHeight(ctx, chainID, cs.InitialHeight) k.SetSlashAcks(ctx, cs.ChainId, cs.SlashDowntimeAck) } else { @@ -129,45 +129,45 @@ func (k Keeper) InitGenesisValUpdates(ctx sdk.Context) []abci.ValidatorUpdate { // ExportGenesis returns the CCV provider module's exported genesis func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { // get a list of all registered consumer chains - registeredChainIDs := k.GetAllRegisteredConsumerChainIDs(ctx) + registeredConsumerIds := k.GetAllRegisteredConsumerIds(ctx) // export states for each consumer chains var consumerStates []types.ConsumerState - for _, chainID := range registeredChainIDs { + for _, consumerId := range registeredConsumerIds { // no need for the second return value of GetConsumerClientId - // as GetAllRegisteredConsumerChainIDs already iterated through + // as GetAllRegisteredConsumerIds already iterated through // the entire prefix range - clientID, _ := k.GetConsumerClientId(ctx, chainID) - gen, found := k.GetConsumerGenesis(ctx, chainID) + clientId, _ := k.GetConsumerClientId(ctx, consumerId) + gen, found := k.GetConsumerGenesis(ctx, consumerId) if !found { - panic(fmt.Errorf("cannot find genesis for consumer chain %s with client %s", chainID, clientID)) + panic(fmt.Errorf("cannot find genesis for consumer chain %s with client %s", consumerId, clientId)) } // initial consumer chain states cs := types.ConsumerState{ - ChainId: chainID, - ClientId: clientID, + ChainId: consumerId, + ClientId: clientId, ConsumerGenesis: gen, } // try to find channel id for the current consumer chain - channelId, found := k.GetChainToChannel(ctx, chainID) + channelId, found := k.GetConsumerIdToChannelId(ctx, consumerId) if found { cs.ChannelId = channelId - cs.InitialHeight, found = k.GetInitChainHeight(ctx, chainID) + cs.InitialHeight, found = k.GetInitChainHeight(ctx, consumerId) if !found { - panic(fmt.Errorf("cannot find init height for consumer chain %s", chainID)) + panic(fmt.Errorf("cannot find init height for consumer chain %s", consumerId)) } - cs.SlashDowntimeAck = k.GetSlashAcks(ctx, chainID) + cs.SlashDowntimeAck = k.GetSlashAcks(ctx, consumerId) } - cs.PendingValsetChanges = k.GetPendingVSCPackets(ctx, chainID) + cs.PendingValsetChanges = k.GetPendingVSCPackets(ctx, consumerId) consumerStates = append(consumerStates, cs) } // ConsumerAddrsToPrune are added only for registered consumer chains consumerAddrsToPrune := []types.ConsumerAddrsToPruneV2{} - for _, chainID := range registeredChainIDs { + for _, chainID := range registeredConsumerIds { consumerAddrsToPrune = append(consumerAddrsToPrune, k.GetAllConsumerAddrsToPrune(ctx, chainID)...) } diff --git a/x/ccv/provider/keeper/genesis_test.go b/x/ccv/provider/keeper/genesis_test.go index 82069b4b8d..8f305f1197 100644 --- a/x/ccv/provider/keeper/genesis_test.go +++ b/x/ccv/provider/keeper/genesis_test.go @@ -132,7 +132,7 @@ func TestInitAndExportGenesis(t *testing.T) { require.Equal(t, expectedCandidate, pk.GetSlashMeterReplenishTimeCandidate(ctx)) // check local provider chain states - chainID, found := pk.GetChannelToChain(ctx, provGenesis.ConsumerStates[0].ChannelId) + chainID, found := pk.GetChannelIdToConsumerId(ctx, provGenesis.ConsumerStates[0].ChannelId) require.True(t, found) require.Equal(t, cChainIDs[0], chainID) require.Equal(t, vscID, pk.GetValidatorSetUpdateId(ctx)) @@ -189,7 +189,7 @@ func assertConsumerChainStates(t *testing.T, ctx sdk.Context, pk keeper.Keeper, require.Equal(t, cs.ClientId, clientID) if expChan := cs.ChannelId; expChan != "" { - gotChan, found := pk.GetChainToChannel(ctx, chainID) + gotChan, found := pk.GetConsumerIdToChannelId(ctx, chainID) require.True(t, found) require.Equal(t, expChan, gotChan) } diff --git a/x/ccv/provider/keeper/grpc_query.go b/x/ccv/provider/keeper/grpc_query.go index 415a181096..5408cc606a 100644 --- a/x/ccv/provider/keeper/grpc_query.go +++ b/x/ccv/provider/keeper/grpc_query.go @@ -8,7 +8,6 @@ import ( "google.golang.org/grpc/status" errorsmod "cosmossdk.io/errors" - "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" @@ -23,17 +22,20 @@ func (k Keeper) QueryConsumerGenesis(c context.Context, req *types.QueryConsumer if req == nil { return nil, status.Errorf(codes.InvalidArgument, "empty request") + } else if req.ChainId != "" { + return nil, status.Errorf(codes.InvalidArgument, "ChainId has been deprecated. Use ConsumerId instead.") } - if req.ChainId == "" { - return nil, status.Errorf(codes.InvalidArgument, "invalid request: chain id cannot be empty") + consumerId := req.ConsumerId + if err := types.ValidateConsumerId(consumerId); err != nil { + return nil, status.Error(codes.InvalidArgument, errorsmod.Wrap(types.ErrInvalidConsumerId, consumerId).Error()) } - gen, ok := k.GetConsumerGenesis(ctx, req.ChainId) + gen, ok := k.GetConsumerGenesis(ctx, consumerId) if !ok { return nil, status.Error( codes.NotFound, - errorsmod.Wrap(types.ErrUnknownConsumerChainId, req.ChainId).Error(), + errorsmod.Wrap(types.ErrUnknownConsumerId, consumerId).Error(), ) } @@ -48,7 +50,7 @@ func (k Keeper) QueryConsumerChains(goCtx context.Context, req *types.QueryConsu ctx := sdk.UnwrapSDKContext(goCtx) chains := []*types.Chain{} - for _, chainID := range k.GetAllRegisteredConsumerChainIDs(ctx) { + for _, chainID := range k.GetAllRegisteredConsumerIds(ctx) { c, err := k.GetConsumerChain(ctx, chainID) if err != nil { return nil, status.Error(codes.Internal, err.Error()) @@ -60,43 +62,39 @@ func (k Keeper) QueryConsumerChains(goCtx context.Context, req *types.QueryConsu } // GetConsumerChain returns a Chain data structure with all the necessary fields -func (k Keeper) GetConsumerChain(ctx sdk.Context, chainID string) (types.Chain, error) { - clientID, found := k.GetConsumerClientId(ctx, chainID) +func (k Keeper) GetConsumerChain(ctx sdk.Context, consumerId string) (types.Chain, error) { + clientID, found := k.GetConsumerClientId(ctx, consumerId) if !found { - return types.Chain{}, fmt.Errorf("cannot find clientID for consumer (%s)", chainID) + return types.Chain{}, fmt.Errorf("cannot find clientID for consumer (%s)", consumerId) } - topN, found := k.GetTopN(ctx, chainID) - if !found { - k.Logger(ctx).Error("failed to get top N, treating as 0", "chain", chainID) - topN = 0 - } + topN := k.GetTopN(ctx, consumerId) // Get the minimal power in the top N for the consumer chain - minPowerInTopN, found := k.GetMinimumPowerInTopN(ctx, chainID) + minPowerInTopN, found := k.GetMinimumPowerInTopN(ctx, consumerId) if !found { - k.Logger(ctx).Error("failed to get minimum power in top N, treating as -1", "chain", chainID) + k.Logger(ctx).Error("failed to get minimum power in top N, treating as -1", "chain", consumerId) minPowerInTopN = -1 } - validatorSetCap, _ := k.GetValidatorSetCap(ctx, chainID) + validatorSetCap := k.GetValidatorSetCap(ctx, consumerId) - validatorsPowerCap, _ := k.GetValidatorsPowerCap(ctx, chainID) + validatorsPowerCap := k.GetValidatorsPowerCap(ctx, consumerId) - allowlist := k.GetAllowList(ctx, chainID) + allowlist := k.GetAllowList(ctx, consumerId) strAllowlist := make([]string, len(allowlist)) for i, addr := range allowlist { strAllowlist[i] = addr.String() } - denylist := k.GetDenyList(ctx, chainID) + denylist := k.GetDenyList(ctx, consumerId) strDenylist := make([]string, len(denylist)) for i, addr := range denylist { strDenylist[i] = addr.String() } return types.Chain{ - ChainId: chainID, + ChainId: consumerId, ClientId: clientID, Top_N: topN, MinPowerInTop_N: minPowerInTopN, @@ -142,18 +140,25 @@ func (k Keeper) QueryConsumerChainStops(goCtx context.Context, req *types.QueryC func (k Keeper) QueryValidatorConsumerAddr(goCtx context.Context, req *types.QueryValidatorConsumerAddrRequest) (*types.QueryValidatorConsumerAddrResponse, error) { if req == nil { - return nil, status.Error(codes.InvalidArgument, "empty request") + return nil, status.Errorf(codes.InvalidArgument, "empty request") + } else if req.ChainId != "" { + return nil, status.Errorf(codes.InvalidArgument, "ChainId has been deprecated. Use ConsumerId instead.") } ctx := sdk.UnwrapSDKContext(goCtx) + consumerId := req.ConsumerId + if err := types.ValidateConsumerId(consumerId); err != nil { + return nil, status.Error(codes.InvalidArgument, errorsmod.Wrap(types.ErrInvalidConsumerId, consumerId).Error()) + } + providerAddrTmp, err := sdk.ConsAddressFromBech32(req.ProviderAddress) if err != nil { return nil, err } providerAddr := types.NewProviderConsAddress(providerAddrTmp) - consumerKey, found := k.GetValidatorConsumerPubKey(ctx, req.ChainId, providerAddr) + consumerKey, found := k.GetValidatorConsumerPubKey(ctx, consumerId, providerAddr) if !found { return &types.QueryValidatorConsumerAddrResponse{}, nil } @@ -170,7 +175,9 @@ func (k Keeper) QueryValidatorConsumerAddr(goCtx context.Context, req *types.Que func (k Keeper) QueryValidatorProviderAddr(goCtx context.Context, req *types.QueryValidatorProviderAddrRequest) (*types.QueryValidatorProviderAddrResponse, error) { if req == nil { - return nil, status.Error(codes.InvalidArgument, "empty request") + return nil, status.Errorf(codes.InvalidArgument, "empty request") + } else if req.ChainId != "" { + return nil, status.Errorf(codes.InvalidArgument, "ChainId has been deprecated. Use ConsumerId instead.") } ctx := sdk.UnwrapSDKContext(goCtx) @@ -239,18 +246,21 @@ func (k Keeper) QueryProposedConsumerChainIDs(goCtx context.Context, req *types. func (k Keeper) QueryAllPairsValConAddrByConsumerChainID(goCtx context.Context, req *types.QueryAllPairsValConAddrByConsumerChainIDRequest) (*types.QueryAllPairsValConAddrByConsumerChainIDResponse, error) { if req == nil { - return nil, status.Error(codes.InvalidArgument, "empty request") + return nil, status.Errorf(codes.InvalidArgument, "empty request") + } else if req.ChainId != "" { + return nil, status.Errorf(codes.InvalidArgument, "ChainId has been deprecated. Use ConsumerId instead.") } - if req.ChainId == "" { - return nil, status.Error(codes.InvalidArgument, "empty chainId") + consumerId := req.ConsumerId + if err := types.ValidateConsumerId(consumerId); err != nil { + return nil, status.Error(codes.InvalidArgument, errorsmod.Wrap(types.ErrInvalidConsumerId, consumerId).Error()) } // list of pairs valconsensus addr pairValConAddrs := []*types.PairValConAddrProviderAndConsumer{} ctx := sdk.UnwrapSDKContext(goCtx) - validatorConsumerPubKeys := k.GetAllValidatorConsumerPubKeys(ctx, &req.ChainId) + validatorConsumerPubKeys := k.GetAllValidatorConsumerPubKeys(ctx, &consumerId) for _, data := range validatorConsumerPubKeys { consumerAddr, err := ccvtypes.TMCryptoPublicKeyToConsAddr(*data.ConsumerKey) if err != nil { @@ -283,22 +293,24 @@ func (k Keeper) QueryParams(goCtx context.Context, req *types.QueryParamsRequest // QueryConsumerChainOptedInValidators returns all validators that opted-in to a given consumer chain func (k Keeper) QueryConsumerChainOptedInValidators(goCtx context.Context, req *types.QueryConsumerChainOptedInValidatorsRequest) (*types.QueryConsumerChainOptedInValidatorsResponse, error) { if req == nil { - return nil, status.Error(codes.InvalidArgument, "empty request") + return nil, status.Errorf(codes.InvalidArgument, "empty request") + } else if req.ChainId != "" { + return nil, status.Errorf(codes.InvalidArgument, "ChainId has been deprecated. Use ConsumerId instead.") } - consumerChainID := req.ChainId - if consumerChainID == "" { - return nil, status.Error(codes.InvalidArgument, "empty chainId") + consumerId := req.ConsumerId + if err := types.ValidateConsumerId(consumerId); err != nil { + return nil, status.Error(codes.InvalidArgument, errorsmod.Wrap(types.ErrInvalidConsumerId, consumerId).Error()) } optedInVals := []string{} ctx := sdk.UnwrapSDKContext(goCtx) - if !k.IsConsumerProposedOrRegistered(ctx, consumerChainID) { - return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("unknown consumer chain: %s", consumerChainID)) + if !k.IsConsumerProposedOrRegistered(ctx, consumerId) { + return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("unknown consumer chain: %s", consumerId)) } - for _, v := range k.GetAllOptedIn(ctx, consumerChainID) { + for _, v := range k.GetAllOptedIn(ctx, consumerId) { optedInVals = append(optedInVals, v.ToSdkConsAddr().String()) } @@ -310,52 +322,64 @@ func (k Keeper) QueryConsumerChainOptedInValidators(goCtx context.Context, req * // QueryConsumerValidators returns all validators that are consumer validators in a given consumer chain func (k Keeper) QueryConsumerValidators(goCtx context.Context, req *types.QueryConsumerValidatorsRequest) (*types.QueryConsumerValidatorsResponse, error) { if req == nil { - return nil, status.Error(codes.InvalidArgument, "empty request") + return nil, status.Errorf(codes.InvalidArgument, "empty request") + } else if req.ChainId != "" { + return nil, status.Errorf(codes.InvalidArgument, "ChainId has been deprecated. Use ConsumerId instead.") } - - consumerChainID := req.ChainId - if consumerChainID == "" { - return nil, status.Error(codes.InvalidArgument, "empty chainId") + consumerId := req.ConsumerId + if err := types.ValidateConsumerId(consumerId); err != nil { + return nil, status.Error(codes.InvalidArgument, errorsmod.Wrap(types.ErrInvalidConsumerId, consumerId).Error()) } ctx := sdk.UnwrapSDKContext(goCtx) - if _, found := k.GetConsumerClientId(ctx, consumerChainID); !found { + if _, found := k.GetConsumerClientId(ctx, consumerId); !found { // chain has to have started; consumer client id is set for a chain during the chain's spawn time - return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("no started consumer chain: %s", consumerChainID)) + return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("no started consumer chain: %s", consumerId)) } var validators []*types.QueryConsumerValidatorsValidator - consumerValSet, err := k.GetConsumerValSet(ctx, consumerChainID) + consumerValSet, err := k.GetConsumerValSet(ctx, consumerId) if err != nil { return nil, status.Error(codes.Internal, err.Error()) } - for _, v := range consumerValSet { + for _, consumerVal := range consumerValSet { + provAddr := types.ProviderConsAddress{Address: consumerVal.ProviderConsAddr} + consAddr := provAddr.ToSdkConsAddr() - consAddr, err := sdk.ConsAddressFromBech32(sdk.ConsAddress(v.ProviderConsAddr).String()) + providerVal, err := k.stakingKeeper.GetValidatorByConsAddr(ctx, consAddr) if err != nil { - return nil, status.Error(codes.InvalidArgument, "invalid provider address") + k.Logger(ctx).Error("cannot find consensus address for provider address:%s", provAddr.String()) + continue } - var rate math.LegacyDec - consumerRate, found := k.GetConsumerCommissionRate(ctx, consumerChainID, types.NewProviderConsAddress(consAddr)) - if found { - rate = consumerRate - } else { - v, err := k.stakingKeeper.GetValidatorByConsAddr(ctx, consAddr) - if err != nil { - return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("unknown validator: %s", consAddr.String())) - } - rate = v.Commission.Rate + hasToValidate, err := k.hasToValidate(ctx, provAddr, consumerId) + if err != nil { + k.Logger(ctx).Error("cannot define if validator %s has to validate for consumer %s for current epoch", + provAddr.String(), consumerId) + continue + } + + consumerRate, found := k.GetConsumerCommissionRate(ctx, consumerId, types.NewProviderConsAddress(consAddr)) + if !found { + consumerRate = providerVal.Commission.Rate } validators = append(validators, &types.QueryConsumerValidatorsValidator{ - ProviderAddress: sdk.ConsAddress(v.ProviderConsAddr).String(), - ConsumerKey: v.PublicKey, - Power: v.Power, - Rate: rate, + ProviderAddress: sdk.ConsAddress(consumerVal.ProviderConsAddr).String(), + ConsumerKey: consumerVal.PublicKey, + ConsumerPower: consumerVal.Power, + ConsumerCommissionRate: consumerRate, + Description: providerVal.Description, + ProviderOperatorAddress: providerVal.OperatorAddress, + Jailed: providerVal.Jailed, + Status: providerVal.Status, + ProviderTokens: providerVal.Tokens, + ProviderCommissionRate: providerVal.Commission.Rate, + ProviderPower: providerVal.GetConsensusPower(k.stakingKeeper.PowerReduction(ctx)), + ValidatesCurrentEpoch: hasToValidate, }) } return &types.QueryConsumerValidatorsResponse{ @@ -386,7 +410,7 @@ func (k Keeper) QueryConsumerChainsValidatorHasToValidate(goCtx context.Context, // get all the consumer chains for which the validator is either already // opted-in, currently a consumer validator or if its voting power is within the TopN validators consumersToValidate := []string{} - for _, consumerChainID := range k.GetAllRegisteredConsumerChainIDs(ctx) { + for _, consumerChainID := range k.GetAllRegisteredConsumerIds(ctx) { if hasToValidate, err := k.hasToValidate(ctx, provAddr, consumerChainID); err == nil && hasToValidate { consumersToValidate = append(consumersToValidate, consumerChainID) } @@ -401,10 +425,10 @@ func (k Keeper) QueryConsumerChainsValidatorHasToValidate(goCtx context.Context, func (k Keeper) hasToValidate( ctx sdk.Context, provAddr types.ProviderConsAddress, - chainID string, + consumerId string, ) (bool, error) { // if the validator was sent as part of the packet in the last epoch, it has to validate - if k.IsConsumerValidator(ctx, chainID, provAddr) { + if k.IsConsumerValidator(ctx, consumerId, provAddr) { return true, nil } @@ -413,24 +437,24 @@ func (k Keeper) hasToValidate( if err != nil { return false, nil } - if topN, found := k.GetTopN(ctx, chainID); found && topN > 0 { + if topN := k.GetTopN(ctx, consumerId); topN > 0 { // in a Top-N chain, we automatically opt in all validators that belong to the top N - minPower, found := k.GetMinimumPowerInTopN(ctx, chainID) + minPower, found := k.GetMinimumPowerInTopN(ctx, consumerId) if found { - k.OptInTopNValidators(ctx, chainID, activeValidators, minPower) + k.OptInTopNValidators(ctx, consumerId, activeValidators, minPower) } else { - k.Logger(ctx).Error("did not find min power in top N for chain", "chain", chainID) + k.Logger(ctx).Error("did not find min power in top N for chain", "chain", consumerId) } } // if the validator is opted in and belongs to the validators of the next epoch, then if nothing changes // the validator would have to validate in the next epoch - if k.IsOptedIn(ctx, chainID, provAddr) { + if k.IsOptedIn(ctx, consumerId, provAddr) { lastVals, err := k.GetLastBondedValidators(ctx) if err != nil { return false, err } - nextValidators := k.ComputeNextValidators(ctx, chainID, lastVals) + nextValidators := k.ComputeNextValidators(ctx, consumerId, lastVals) for _, v := range nextValidators { consAddr := sdk.ConsAddress(v.ProviderConsAddr) if provAddr.ToSdkConsAddr().Equals(consAddr) { @@ -446,12 +470,14 @@ func (k Keeper) hasToValidate( // validator charges on a given consumer chain func (k Keeper) QueryValidatorConsumerCommissionRate(goCtx context.Context, req *types.QueryValidatorConsumerCommissionRateRequest) (*types.QueryValidatorConsumerCommissionRateResponse, error) { if req == nil { - return nil, status.Error(codes.InvalidArgument, "empty request") + return nil, status.Errorf(codes.InvalidArgument, "empty request") + } else if req.ChainId != "" { + return nil, status.Errorf(codes.InvalidArgument, "ChainId has been deprecated. Use ConsumerId instead.") } - consumerChainID := req.ChainId - if consumerChainID == "" { - return nil, status.Error(codes.InvalidArgument, "empty chainId") + consumerId := req.ConsumerId + if err := types.ValidateConsumerId(consumerId); err != nil { + return nil, status.Error(codes.InvalidArgument, errorsmod.Wrap(types.ErrInvalidConsumerId, consumerId).Error()) } consAddr, err := sdk.ConsAddressFromBech32(req.ProviderAddress) @@ -461,15 +487,15 @@ func (k Keeper) QueryValidatorConsumerCommissionRate(goCtx context.Context, req ctx := sdk.UnwrapSDKContext(goCtx) - if !k.IsConsumerProposedOrRegistered(ctx, consumerChainID) { - return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("unknown consumer chain: %s", consumerChainID)) + if !k.IsConsumerProposedOrRegistered(ctx, consumerId) { + return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("unknown consumer chain: %s", consumerId)) } res := &types.QueryValidatorConsumerCommissionRateResponse{} // Check if the validator has a commission rate set for the consumer chain, // otherwise use the commission rate from the validator staking module struct - consumerRate, found := k.GetConsumerCommissionRate(ctx, consumerChainID, types.NewProviderConsAddress(consAddr)) + consumerRate, found := k.GetConsumerCommissionRate(ctx, consumerId, types.NewProviderConsAddress(consAddr)) if found { res.Rate = consumerRate } else { @@ -492,3 +518,15 @@ func (k Keeper) QueryBlocksUntilNextEpoch(goCtx context.Context, req *types.Quer return &types.QueryBlocksUntilNextEpochResponse{BlocksUntilNextEpoch: uint64(blocksUntilNextEpoch)}, nil } + +// QueryConsumerIdFromClientId returns the consumer id of the chain associated with this client id +func (k Keeper) QueryConsumerIdFromClientId(goCtx context.Context, req *types.QueryConsumerIdFromClientIdRequest) (*types.QueryConsumerIdFromClientIdResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + consumerId, found := k.GetClientIdToConsumerId(ctx, req.ClientId) + if !found { + return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("no known consumer chain for this client id: %s", req.ClientId)) + } + + return &types.QueryConsumerIdFromClientIdResponse{ConsumerId: consumerId}, nil +} diff --git a/x/ccv/provider/keeper/grpc_query_test.go b/x/ccv/provider/keeper/grpc_query_test.go index 27e6d00155..bbc61794d8 100644 --- a/x/ccv/provider/keeper/grpc_query_test.go +++ b/x/ccv/provider/keeper/grpc_query_test.go @@ -4,6 +4,8 @@ import ( "fmt" "testing" + "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" + "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" @@ -21,7 +23,7 @@ import ( ) func TestQueryAllPairsValConAddrByConsumerChainID(t *testing.T) { - chainID := consumer + consumerId := "0" providerConsAddress, err := sdk.ConsAddressFromBech32("cosmosvalcons1wpex7anfv3jhystyv3eq20r35a") require.NoError(t, err) @@ -34,9 +36,9 @@ func TestQueryAllPairsValConAddrByConsumerChainID(t *testing.T) { pk, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - pk.SetValidatorConsumerPubKey(ctx, chainID, providerAddr, consumerKey) + pk.SetValidatorConsumerPubKey(ctx, consumerId, providerAddr, consumerKey) - consumerPubKey, found := pk.GetValidatorConsumerPubKey(ctx, chainID, providerAddr) + consumerPubKey, found := pk.GetValidatorConsumerPubKey(ctx, consumerId, providerAddr) require.True(t, found, "consumer pubkey not found") require.NotEmpty(t, consumerPubKey, "consumer pubkey is empty") require.Equal(t, consumerPubKey, consumerKey) @@ -45,17 +47,16 @@ func TestQueryAllPairsValConAddrByConsumerChainID(t *testing.T) { _, err = pk.QueryAllPairsValConAddrByConsumerChainID(ctx, nil) require.Error(t, err) - // Request with chainId is empty + // Request with empty consumer id _, err = pk.QueryAllPairsValConAddrByConsumerChainID(ctx, &types.QueryAllPairsValConAddrByConsumerChainIDRequest{}) require.Error(t, err) - // Request with chainId is invalid - response, err := pk.QueryAllPairsValConAddrByConsumerChainID(ctx, &types.QueryAllPairsValConAddrByConsumerChainIDRequest{ChainId: "invalidChainId"}) - require.NoError(t, err) - require.Equal(t, []*types.PairValConAddrProviderAndConsumer{}, response.PairValConAddr) + // Request with invalid consumer id + response, err := pk.QueryAllPairsValConAddrByConsumerChainID(ctx, &types.QueryAllPairsValConAddrByConsumerChainIDRequest{ConsumerId: "invalidConsumerId"}) + require.Error(t, err) // Request is valid - response, err = pk.QueryAllPairsValConAddrByConsumerChainID(ctx, &types.QueryAllPairsValConAddrByConsumerChainIDRequest{ChainId: chainID}) + response, err = pk.QueryAllPairsValConAddrByConsumerChainID(ctx, &types.QueryAllPairsValConAddrByConsumerChainIDRequest{ConsumerId: consumerId}) require.NoError(t, err) expectedResult := types.PairValConAddrProviderAndConsumer{ @@ -68,20 +69,21 @@ func TestQueryAllPairsValConAddrByConsumerChainID(t *testing.T) { } func TestQueryConsumerChainOptedInValidators(t *testing.T) { - chainID := "chainID" - pk, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() + consumerId := "0" + req := types.QueryConsumerChainOptedInValidatorsRequest{ - ChainId: chainID, + ConsumerId: consumerId, } // error returned from not yet proposed or not yet registered chain _, err := pk.QueryConsumerChainOptedInValidators(ctx, &req) require.Error(t, err) - pk.SetProposedConsumerChain(ctx, chainID, 1) + pk.FetchAndIncrementConsumerId(ctx) + pk.SetConsumerPhase(ctx, consumerId, keeper.Initialized) providerAddr1 := types.NewProviderConsAddress([]byte("providerAddr1")) providerAddr2 := types.NewProviderConsAddress([]byte("providerAddr2")) @@ -89,63 +91,101 @@ func TestQueryConsumerChainOptedInValidators(t *testing.T) { ValidatorsProviderAddresses: []string{providerAddr1.String(), providerAddr2.String()}, } - pk.SetOptedIn(ctx, chainID, providerAddr1) - pk.SetOptedIn(ctx, chainID, providerAddr2) + pk.SetOptedIn(ctx, consumerId, providerAddr1) + pk.SetOptedIn(ctx, consumerId, providerAddr2) res, err := pk.QueryConsumerChainOptedInValidators(ctx, &req) require.NoError(t, err) require.Equal(t, &expectedResponse, res) } func TestQueryConsumerValidators(t *testing.T) { - chainID := "chainID" - pk, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() + consumerId := "0" + req := types.QueryConsumerValidatorsRequest{ - ChainId: chainID, + ConsumerId: consumerId, } // error returned from not-started chain _, err := pk.QueryConsumerValidators(ctx, &req) require.Error(t, err) - providerAddr1 := types.NewProviderConsAddress([]byte("providerAddr1")) - consumerKey1 := cryptotestutil.NewCryptoIdentityFromIntSeed(1).TMProtoCryptoPublicKey() - consumerValidator1 := types.ConsensusValidator{ProviderConsAddr: providerAddr1.ToSdkConsAddr(), Power: 1, PublicKey: &consumerKey1} - expectedCommissionRate1 := math.LegacyMustNewDecFromStr("0.123") - pk.SetConsumerCommissionRate(ctx, chainID, providerAddr1, expectedCommissionRate1) + val1 := createStakingValidator(ctx, mocks, 1, 1, 1) + valConsAddr1, _ := val1.GetConsAddr() + providerAddr1 := types.NewProviderConsAddress(valConsAddr1) + pk1, _ := val1.CmtConsPublicKey() + consumerValidator1 := types.ConsensusValidator{ProviderConsAddr: providerAddr1.ToSdkConsAddr(), Power: 1, PublicKey: &pk1} + val1.Tokens = sdk.TokensFromConsensusPower(1, sdk.DefaultPowerReduction) + val1.Description = stakingtypes.Description{Moniker: "ConsumerValidator1"} + val1.Commission.Rate = math.LegacyMustNewDecFromStr("0.123") + + val2 := createStakingValidator(ctx, mocks, 1, 2, 2) + valConsAddr2, _ := val2.GetConsAddr() + providerAddr2 := types.NewProviderConsAddress(valConsAddr2) + pk2, _ := val2.CmtConsPublicKey() + consumerValidator2 := types.ConsensusValidator{ProviderConsAddr: providerAddr2.ToSdkConsAddr(), Power: 2, PublicKey: &pk2} + val2.Tokens = sdk.TokensFromConsensusPower(2, sdk.DefaultPowerReduction) + val2.Description = stakingtypes.Description{Moniker: "ConsumerValidator2"} + val2.Commission.Rate = math.LegacyMustNewDecFromStr("0.123") - providerAddr2 := types.NewProviderConsAddress([]byte("providerAddr2")) - consumerKey2 := cryptotestutil.NewCryptoIdentityFromIntSeed(2).TMProtoCryptoPublicKey() - consumerValidator2 := types.ConsensusValidator{ProviderConsAddr: providerAddr2.ToSdkConsAddr(), Power: 2, PublicKey: &consumerKey2} - expectedCommissionRate2 := math.LegacyMustNewDecFromStr("0.123") - pk.SetConsumerCommissionRate(ctx, chainID, providerAddr2, expectedCommissionRate2) + // set up the client id so the chain looks like it "started" + pk.SetConsumerClientId(ctx, consumerId, "clientID") + pk.SetConsumerValSet(ctx, consumerId, []types.ConsensusValidator{consumerValidator1, consumerValidator2}) + // set a consumer commission rate for val1 + val1ConsComRate := math.LegacyMustNewDecFromStr("0.456") + pk.SetConsumerCommissionRate(ctx, consumerId, providerAddr1, val1ConsComRate) expectedResponse := types.QueryConsumerValidatorsResponse{ Validators: []*types.QueryConsumerValidatorsValidator{ - {ProviderAddress: providerAddr1.String(), ConsumerKey: &consumerKey1, Power: 1, Rate: expectedCommissionRate1}, - {ProviderAddress: providerAddr2.String(), ConsumerKey: &consumerKey2, Power: 2, Rate: expectedCommissionRate2}, + { + ProviderAddress: providerAddr1.String(), + ConsumerKey: &pk1, + ConsumerPower: 1, + ConsumerCommissionRate: val1ConsComRate, + Description: val1.Description, + ProviderOperatorAddress: val1.OperatorAddress, + Jailed: val1.Jailed, + Status: val1.Status, + ProviderTokens: val1.Tokens, + ProviderCommissionRate: val1.Commission.Rate, + ProviderPower: 1, + ValidatesCurrentEpoch: true, + }, + { + ProviderAddress: providerAddr2.String(), + ConsumerKey: &pk2, + ConsumerPower: 2, + ConsumerCommissionRate: val2.Commission.Rate, + Description: val2.Description, + ProviderOperatorAddress: val2.OperatorAddress, + Jailed: val2.Jailed, + Status: val2.Status, + ProviderTokens: val2.Tokens, + ProviderCommissionRate: val2.Commission.Rate, + ProviderPower: 2, + ValidatesCurrentEpoch: true, + }, }, } - // set up the client id so the chain looks like it "started" - pk.SetConsumerClientId(ctx, chainID, "clientID") - pk.SetConsumerValSet(ctx, chainID, []types.ConsensusValidator{consumerValidator1, consumerValidator2}) + mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, valConsAddr1).Return(val1, nil).AnyTimes() + mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, valConsAddr2).Return(val2, nil).AnyTimes() + mocks.MockStakingKeeper.EXPECT().PowerReduction(ctx).Return(sdk.DefaultPowerReduction).AnyTimes() + + testkeeper.SetupMocksForLastBondedValidatorsExpectation(mocks.MockStakingKeeper, 2, []stakingtypes.Validator{val1, val2}, -1) // -1 to allow the calls "AnyTimes" res, err := pk.QueryConsumerValidators(ctx, &req) require.NoError(t, err) require.Equal(t, &expectedResponse, res) // validator with no set consumer commission rate - pk.DeleteConsumerCommissionRate(ctx, chainID, providerAddr1) - expectedCommissionRate := math.LegacyMustNewDecFromStr("0.456") + pk.DeleteConsumerCommissionRate(ctx, consumerId, providerAddr1) // because no consumer commission rate is set, the validator's set commission rate on the provider is used - val := stakingtypes.Validator{Commission: stakingtypes.Commission{CommissionRates: stakingtypes.CommissionRates{Rate: expectedCommissionRate}}} - mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr( - ctx, providerAddr1.ToSdkConsAddr()).Return(val, nil).Times(1) - res, _ = pk.QueryConsumerValidators(ctx, &req) - require.Equal(t, expectedCommissionRate, res.Validators[0].Rate) + res, err = pk.QueryConsumerValidators(ctx, &req) + require.NoError(t, err) + require.Equal(t, val1.Commission.Rate, res.Validators[0].ConsumerCommissionRate) } func TestQueryConsumerChainsValidatorHasToValidate(t *testing.T) { @@ -197,14 +237,14 @@ func TestQueryConsumerChainsValidatorHasToValidate(t *testing.T) { } func TestQueryValidatorConsumerCommissionRate(t *testing.T) { - chainID := "chainID" + consumerId := "0" pk, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() providerAddr := types.NewProviderConsAddress([]byte("providerAddr")) req := types.QueryValidatorConsumerCommissionRateRequest{ - ChainId: chainID, + ConsumerId: consumerId, ProviderAddress: providerAddr.String(), } @@ -212,15 +252,17 @@ func TestQueryValidatorConsumerCommissionRate(t *testing.T) { _, err := pk.QueryValidatorConsumerCommissionRate(ctx, &req) require.Error(t, err) - pk.SetProposedConsumerChain(ctx, chainID, 1) + pk.FetchAndIncrementConsumerId(ctx) + pk.SetConsumerPhase(ctx, consumerId, keeper.Initialized) + // validator with set consumer commission rate expectedCommissionRate := math.LegacyMustNewDecFromStr("0.123") - pk.SetConsumerCommissionRate(ctx, chainID, providerAddr, expectedCommissionRate) + pk.SetConsumerCommissionRate(ctx, consumerId, providerAddr, expectedCommissionRate) res, _ := pk.QueryValidatorConsumerCommissionRate(ctx, &req) require.Equal(t, expectedCommissionRate, res.Rate) // validator with no set consumer commission rate - pk.DeleteConsumerCommissionRate(ctx, chainID, providerAddr) + pk.DeleteConsumerCommissionRate(ctx, consumerId, providerAddr) expectedCommissionRate = math.LegacyMustNewDecFromStr("0.456") // because no consumer commission rate is set, the validator's set commission rate on the provider is used @@ -285,9 +327,11 @@ func TestGetConsumerChain(t *testing.T) { clientID := fmt.Sprintf("client-%d", len(chainIDs)-i) topN := topNs[i] pk.SetConsumerClientId(ctx, chainID, clientID) - pk.SetTopN(ctx, chainID, topN) - pk.SetValidatorSetCap(ctx, chainID, validatorSetCaps[i]) - pk.SetValidatorsPowerCap(ctx, chainID, validatorPowerCaps[i]) + pk.SetConsumerPowerShapingParameters(ctx, chainID, types.PowerShapingParameters{ + Top_N: topN, + ValidatorSetCap: validatorSetCaps[i], + ValidatorsPowerCap: validatorPowerCaps[i], + }) pk.SetMinimumPowerInTopN(ctx, chainID, expectedMinPowerInTopNs[i]) for _, addr := range allowlists[i] { pk.SetAllowlist(ctx, chainID, addr) @@ -318,9 +362,25 @@ func TestGetConsumerChain(t *testing.T) { }) } - for i, chainID := range pk.GetAllRegisteredAndProposedChainIDs(ctx) { + for i, chainID := range pk.GetAllActiveConsumerIds(ctx) { c, err := pk.GetConsumerChain(ctx, chainID) require.NoError(t, err) require.Equal(t, expectedGetAllOrder[i], c) } } + +func TestQueryConsumerIdFromClientId(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + _, err := providerKeeper.QueryConsumerIdFromClientId(ctx, &types.QueryConsumerIdFromClientIdRequest{ClientId: "clientId"}) + require.Error(t, err) + require.ErrorContains(t, err, "no known consumer chain") + + expectedConsumerId := "consumerId" + providerKeeper.SetClientIdToConsumerId(ctx, "clientId", expectedConsumerId) + + res, err := providerKeeper.QueryConsumerIdFromClientId(ctx, &types.QueryConsumerIdFromClientIdRequest{ClientId: "clientId"}) + require.NoError(t, err) + require.Equal(t, expectedConsumerId, res.ConsumerId) +} diff --git a/x/ccv/provider/keeper/hooks.go b/x/ccv/provider/keeper/hooks.go index a72f60080f..841db8330e 100644 --- a/x/ccv/provider/keeper/hooks.go +++ b/x/ccv/provider/keeper/hooks.go @@ -2,8 +2,8 @@ package keeper import ( "context" - "cosmossdk.io/math" + "fmt" sdk "github.com/cosmos/cosmos-sdk/types" sdkgov "github.com/cosmos/cosmos-sdk/x/gov/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -106,26 +106,76 @@ func (h Hooks) BeforeTokenizeShareRecordRemoved(_ context.Context, _ uint64) err // // AfterProposalSubmission - call hook if registered -// After a consumerAddition proposal submission, a record is created -// that maps the proposal ID to the consumer chain ID. -func (h Hooks) AfterProposalSubmission(goCtx context.Context, proposalID uint64) error { +// If an update consumer message exists in the proposal, a record is created that maps the proposal id to the consumer id +func (h Hooks) AfterProposalSubmission(goCtx context.Context, proposalId uint64) error { ctx := sdk.UnwrapSDKContext(goCtx) - if p, ok := h.GetConsumerAdditionFromProp(ctx, proposalID); ok { - h.k.SetProposedConsumerChain(ctx, p.ChainId, proposalID) + + p, err := h.k.govKeeper.Proposals.Get(ctx, proposalId) + if err != nil { + return fmt.Errorf("cannot retrieve proposal with id: %d", proposalId) } + + hasUpdateConsumerMsg := false + for _, msg := range p.GetMessages() { + sdkMsg, isMsgUpdateConsumer := msg.GetCachedValue().(*providertypes.MsgUpdateConsumer) + if isMsgUpdateConsumer { + // A `MsgUpdateConsumer` can only succeed if the owner of the consumer chain is the gov module. + // If that's not the case, we immediately fail the proposal. + // Note that someone could potentially change the owner of a chain to be that of the gov module + // while a proposal is active and before the proposal is executed. Even then, we still do not allow + // `MsgUpdateConsumer` proposals if the owner of the chain is not the gov module to avoid someone forgetting + // to change the owner address while the proposal is active. + ownerAddress, err := h.k.GetConsumerOwnerAddress(ctx, sdkMsg.ConsumerId) + if err != nil { + return fmt.Errorf("cannot find owner address for consumer with consumer id (%s): %s", sdkMsg.ConsumerId, err.Error()) + } else if ownerAddress != h.k.GetAuthority() { + return fmt.Errorf("owner address (%s) is not the gov module (%s)", ownerAddress, h.k.GetAuthority()) + } + + if hasUpdateConsumerMsg { + return fmt.Errorf("proposal can contain at most one `MsgUpdateConsumer` message") + } + hasUpdateConsumerMsg = true + h.k.SetProposalIdToConsumerId(ctx, proposalId, sdkMsg.ConsumerId) + } + + // if the proposal contains a deprecated message, cancel the proposal + _, isMsgConsumerAddition := msg.GetCachedValue().(*providertypes.MsgConsumerAddition) + if isMsgConsumerAddition { + return fmt.Errorf("proposal cannot contain deprecated `MsgConsumerAddition`; use `MsgCreateConsumer` instead") + } + + _, isMsgConsumerModification := msg.GetCachedValue().(*providertypes.MsgConsumerModification) + if isMsgConsumerModification { + return fmt.Errorf("proposal cannot contain deprecated `MsgConsumerModification`; use `MsgUpdateConsumer` instead") + } + _, isMsgConsumerRemoval := msg.GetCachedValue().(*providertypes.MsgConsumerRemoval) + if isMsgConsumerRemoval { + return fmt.Errorf("proposal cannot contain deprecated `MsgConsumerRemoval`; use `MsgRemoveConsumer` instead") + } + } + return nil } // AfterProposalVotingPeriodEnded - call hook if registered -// After proposal voting ends, the consumer chainID in store is deleted. -// When a consumerAddition proposal passes, the consumer chainID is available in providerKeeper.GetAllPendingConsumerAdditionProps -// or providerKeeper.GetAllConsumerChains(ctx). -func (h Hooks) AfterProposalVotingPeriodEnded(goCtx context.Context, proposalID uint64) error { +// After proposal voting ends, the consumer to proposal id record in store is deleted. +func (h Hooks) AfterProposalVotingPeriodEnded(goCtx context.Context, proposalId uint64) error { ctx := sdk.UnwrapSDKContext(goCtx) - if _, ok := h.GetConsumerAdditionFromProp(ctx, proposalID); ok { - h.k.DeleteProposedConsumerChainInStore(ctx, proposalID) + p, err := h.k.govKeeper.Proposals.Get(ctx, proposalId) + if err != nil { + return fmt.Errorf("cannot retrieve proposal with id: %d", proposalId) } + + for _, msg := range p.GetMessages() { + _, isUpdateConsumer := msg.GetCachedValue().(*providertypes.MsgUpdateConsumer) + if isUpdateConsumer { + h.k.DeleteProposalIdToConsumerId(ctx, proposalId) + return nil + } + } + return nil } diff --git a/x/ccv/provider/keeper/hooks_test.go b/x/ccv/provider/keeper/hooks_test.go index 2447b5edf3..8f7f90c948 100644 --- a/x/ccv/provider/keeper/hooks_test.go +++ b/x/ccv/provider/keeper/hooks_test.go @@ -1,13 +1,12 @@ package keeper_test import ( - "testing" - sdk "github.com/cosmos/cosmos-sdk/types" cryptotestutil "github.com/cosmos/interchain-security/v5/testutil/crypto" testkeeper "github.com/cosmos/interchain-security/v5/testutil/keeper" providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" "github.com/golang/mock/gomock" + "testing" ) func TestValidatorConsensusKeyInUse(t *testing.T) { @@ -30,32 +29,40 @@ func TestValidatorConsensusKeyInUse(t *testing.T) { { name: "in use by another validator", setup: func(ctx sdk.Context, k providerkeeper.Keeper) { + k.FetchAndIncrementConsumerId(ctx) + k.SetConsumerPhase(ctx, "0", providerkeeper.Initialized) + // We are trying to add a new validator, but its address has already been used // by another validator - k.SetValidatorByConsumerAddr(ctx, "chainid", + k.SetValidatorByConsumerAddr(ctx, "0", newValidator.ConsumerConsAddress(), anotherValidator0.ProviderConsAddress(), ) - k.SetConsumerClientId(ctx, "chainid", "clientID") + k.SetConsumerClientId(ctx, "0", "clientId") }, expect: true, }, { name: "in use by one of several other validators", setup: func(ctx sdk.Context, k providerkeeper.Keeper) { + k.FetchAndIncrementConsumerId(ctx) + k.FetchAndIncrementConsumerId(ctx) + k.SetConsumerPhase(ctx, "0", providerkeeper.Initialized) + k.SetConsumerPhase(ctx, "1", providerkeeper.Initialized) + // We are trying to add a new validator, but its address has already been used // by another validator, of which there are several, across potentially several chains - k.SetValidatorByConsumerAddr(ctx, "chainid0", + k.SetValidatorByConsumerAddr(ctx, "0", newValidator.ConsumerConsAddress(), anotherValidator0.ProviderConsAddress(), ) - k.SetConsumerClientId(ctx, "chainid0", "clientID0") + k.SetConsumerClientId(ctx, "0", "clientId0") - k.SetValidatorByConsumerAddr(ctx, "chainid1", + k.SetValidatorByConsumerAddr(ctx, "1", anotherValidator1.ConsumerConsAddress(), anotherValidator1.ProviderConsAddress(), ) - k.SetConsumerClientId(ctx, "chainid1", "clientID1") + k.SetConsumerClientId(ctx, "1", "clientId1") }, expect: true, }, diff --git a/x/ccv/provider/keeper/keeper.go b/x/ccv/provider/keeper/keeper.go index 1125ae52c8..46f641f660 100644 --- a/x/ccv/provider/keeper/keeper.go +++ b/x/ccv/provider/keeper/keeper.go @@ -189,54 +189,53 @@ func (k Keeper) ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability return k.scopedKeeper.ClaimCapability(ctx, cap, name) } -// SetChainToChannel sets the mapping from a consumer chainID to the CCV channel ID for that consumer chain. -func (k Keeper) SetChainToChannel(ctx sdk.Context, chainID, channelID string) { +// SetConsumerIdToChannelId sets the mapping from a consumer id to the CCV channel id for that consumer chain. +func (k Keeper) SetConsumerIdToChannelId(ctx sdk.Context, consumerId, channelId string) { store := ctx.KVStore(k.storeKey) - store.Set(types.ChainToChannelKey(chainID), []byte(channelID)) + store.Set(types.ConsumerIdToChannelIdKey(consumerId), []byte(channelId)) } -// GetChainToChannel gets the CCV channelID for the given consumer chainID -func (k Keeper) GetChainToChannel(ctx sdk.Context, chainID string) (string, bool) { +// GetConsumerIdToChannelId gets the CCV channelId for the given consumer id +func (k Keeper) GetConsumerIdToChannelId(ctx sdk.Context, consumerId string) (string, bool) { store := ctx.KVStore(k.storeKey) - bz := store.Get(types.ChainToChannelKey(chainID)) + bz := store.Get(types.ConsumerIdToChannelIdKey(consumerId)) if bz == nil { return "", false } return string(bz), true } -// DeleteChainToChannel deletes the CCV channel ID for the given consumer chain ID -func (k Keeper) DeleteChainToChannel(ctx sdk.Context, chainID string) { +// DeleteConsumerIdToChannelId deletes the CCV channel id for the given consumer id +func (k Keeper) DeleteConsumerIdToChannelId(ctx sdk.Context, consumerId string) { store := ctx.KVStore(k.storeKey) - store.Delete(types.ChainToChannelKey(chainID)) + store.Delete(types.ConsumerIdToChannelIdKey(consumerId)) } -// SetProposedConsumerChain stores a consumer chainId corresponding to a submitted consumer addition proposal -// This consumer chainId is deleted once the voting period for the proposal ends. -func (k Keeper) SetProposedConsumerChain(ctx sdk.Context, chainID string, proposalID uint64) { +// SetProposalIdToConsumerId stores a consumer id corresponding to a proposal that contains a `MsgUpdateConsumer` mesage. +// This consumer id is deleted once the voting period for the proposal ends. +func (k Keeper) SetProposalIdToConsumerId(ctx sdk.Context, proposalId uint64, consumerId string) { store := ctx.KVStore(k.storeKey) - store.Set(types.ProposedConsumerChainKey(proposalID), []byte(chainID)) + store.Set(types.ProposedConsumerChainKey(proposalId), []byte(consumerId)) } -// GetProposedConsumerChain returns the proposed chainID for the given consumerAddition proposal ID. +// GetProposalIdToConsumerId returns the proposed consumer id for the given proposal id. // This method is only used for testing. -func (k Keeper) GetProposedConsumerChain(ctx sdk.Context, proposalID uint64) (string, bool) { +func (k Keeper) GetProposalIdToConsumerId(ctx sdk.Context, proposalId uint64) (string, bool) { store := ctx.KVStore(k.storeKey) - consumerChain := store.Get(types.ProposedConsumerChainKey(proposalID)) + consumerChain := store.Get(types.ProposedConsumerChainKey(proposalId)) if consumerChain != nil { return string(consumerChain), true } return "", false } -// DeleteProposedConsumerChainInStore deletes the consumer chainID from store -// which is in gov consumerAddition proposal -func (k Keeper) DeleteProposedConsumerChainInStore(ctx sdk.Context, proposalID uint64) { +// DeleteProposalIdToConsumerId deletes the proposal to consumer id record from store +func (k Keeper) DeleteProposalIdToConsumerId(ctx sdk.Context, proposalId uint64) { store := ctx.KVStore(k.storeKey) - store.Delete(types.ProposedConsumerChainKey(proposalID)) + store.Delete(types.ProposedConsumerChainKey(proposalId)) } -// GetAllProposedConsumerChainIDs returns the proposed chainID of all gov consumerAddition proposals that are still in the voting period. +// GetAllProposedConsumerChainIDs returns the proposed consumer ids of all gov proposals that are still in the voting period func (k Keeper) GetAllProposedConsumerChainIDs(ctx sdk.Context) []types.ProposedChain { store := ctx.KVStore(k.storeKey) iterator := storetypes.KVStorePrefixIterator(store, types.ProposedConsumerChainKeyPrefix()) @@ -250,7 +249,7 @@ func (k Keeper) GetAllProposedConsumerChainIDs(ctx sdk.Context) []types.Proposed } proposedChains = append(proposedChains, types.ProposedChain{ - ChainID: string(iterator.Value()), + ConsumerId: string(iterator.Value()), ProposalID: proposalID, }) @@ -270,90 +269,96 @@ func (k Keeper) GetAllPendingConsumerChainIDs(ctx sdk.Context) []string { return chainIDs } -// GetAllRegisteredConsumerChainIDs gets all of the consumer chain IDs, for which the provider module +// GetAllRegisteredConsumerIds gets all of the consumer chain IDs, for which the provider module // created IBC clients. Consumer chains with created clients are also referred to as registered. // // Note that the registered consumer chains are stored under keys with the following format: -// ChainToClientKeyPrefix | chainID +// ConsumerIdToClientIdKeyPrefix | consumerId // Thus, the returned array is in ascending order of chainIDs. -func (k Keeper) GetAllRegisteredConsumerChainIDs(ctx sdk.Context) []string { - chainIDs := []string{} +func (k Keeper) GetAllRegisteredConsumerIds(ctx sdk.Context) []string { + consumerIds := []string{} store := ctx.KVStore(k.storeKey) - iterator := storetypes.KVStorePrefixIterator(store, types.ChainToClientKeyPrefix()) + iterator := storetypes.KVStorePrefixIterator(store, types.ConsumerIdToClientIdKeyPrefix()) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - // remove 1 byte prefix from key to retrieve chainID - chainID := string(iterator.Key()[1:]) - chainIDs = append(chainIDs, chainID) + // remove 1 byte prefix from key to retrieve consumerId + consumerId := string(iterator.Key()[1:]) + consumerIds = append(consumerIds, consumerId) } - return chainIDs + return consumerIds } -// SetChannelToChain sets the mapping from the CCV channel ID to the consumer chainID. -func (k Keeper) SetChannelToChain(ctx sdk.Context, channelID, chainID string) { +// SetChannelToConsumerId sets the mapping from the CCV channel id to the consumer id. +func (k Keeper) SetChannelToConsumerId(ctx sdk.Context, channelId, consumerId string) { store := ctx.KVStore(k.storeKey) - store.Set(types.ChannelToChainKey(channelID), []byte(chainID)) + store.Set(types.ChannelToConsumerIdKey(channelId), []byte(consumerId)) } -// GetChannelToChain gets the consumer chainID for a given CCV channelID -func (k Keeper) GetChannelToChain(ctx sdk.Context, channelID string) (string, bool) { +// GetChannelIdToConsumerId gets the consumer id for a given CCV channel id +func (k Keeper) GetChannelIdToConsumerId(ctx sdk.Context, channelID string) (string, bool) { store := ctx.KVStore(k.storeKey) - bz := store.Get(types.ChannelToChainKey(channelID)) + bz := store.Get(types.ChannelToConsumerIdKey(channelID)) if bz == nil { return "", false } return string(bz), true } -// DeleteChannelToChain deletes the consumer chain ID for a given CCV channelID -func (k Keeper) DeleteChannelToChain(ctx sdk.Context, channelID string) { +// DeleteChannelIdToConsumerId deletes the consumer id for a given CCV channel id +func (k Keeper) DeleteChannelIdToConsumerId(ctx sdk.Context, channelId string) { store := ctx.KVStore(k.storeKey) - store.Delete(types.ChannelToChainKey(channelID)) + store.Delete(types.ChannelToConsumerIdKey(channelId)) } -// GetAllChannelToChains gets all channel to chain mappings. If a mapping exists, +// GetAllChannelToConsumers gets all channel to chain mappings. If a mapping exists, // then the CCV channel to that consumer chain is established. // -// Note that mapping from CCV channel IDs to consumer chainIDs +// Note that mapping from CCV channel IDs to consumer IDs // is stored under keys with the following format: -// ChannelToChainKeyPrefix | channelID +// ChannelIdToConsumerIdKeyPrefix | channelID // Thus, the returned array is in ascending order of channelIDs. -func (k Keeper) GetAllChannelToChains(ctx sdk.Context) (channels []types.ChannelToChain) { +func (k Keeper) GetAllChannelToConsumers(ctx sdk.Context) (channelsToConsumers []struct { + ChannelId string + ConsumerId string +}) { store := ctx.KVStore(k.storeKey) - iterator := storetypes.KVStorePrefixIterator(store, types.ChannelToChainKeyPrefix()) + iterator := storetypes.KVStorePrefixIterator(store, types.ChannelIdToConsumerIdKeyPrefix()) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { // remove prefix from key to retrieve channelID channelID := string(iterator.Key()[1:]) - chainID := string(iterator.Value()) - - channels = append(channels, types.ChannelToChain{ - ChannelId: channelID, - ChainId: chainID, + consumerId := string(iterator.Value()) + + channelsToConsumers = append(channelsToConsumers, struct { + ChannelId string + ConsumerId string + }{ + ChannelId: channelID, + ConsumerId: consumerId, }) } - return channels + return channelsToConsumers } -func (k Keeper) SetConsumerGenesis(ctx sdk.Context, chainID string, gen ccv.ConsumerGenesisState) error { +func (k Keeper) SetConsumerGenesis(ctx sdk.Context, consumerId string, gen ccv.ConsumerGenesisState) error { store := ctx.KVStore(k.storeKey) bz, err := gen.Marshal() if err != nil { return err } - store.Set(types.ConsumerGenesisKey(chainID), bz) + store.Set(types.ConsumerGenesisKey(consumerId), bz) return nil } -func (k Keeper) GetConsumerGenesis(ctx sdk.Context, chainID string) (ccv.ConsumerGenesisState, bool) { +func (k Keeper) GetConsumerGenesis(ctx sdk.Context, consumerId string) (ccv.ConsumerGenesisState, bool) { store := ctx.KVStore(k.storeKey) - bz := store.Get(types.ConsumerGenesisKey(chainID)) + bz := store.Get(types.ConsumerGenesisKey(consumerId)) if bz == nil { return ccv.ConsumerGenesisState{}, false } @@ -367,9 +372,9 @@ func (k Keeper) GetConsumerGenesis(ctx sdk.Context, chainID string) (ccv.Consume return data, true } -func (k Keeper) DeleteConsumerGenesis(ctx sdk.Context, chainID string) { +func (k Keeper) DeleteConsumerGenesis(ctx sdk.Context, consumerId string) { store := ctx.KVStore(k.storeKey) - store.Delete(types.ConsumerGenesisKey(chainID)) + store.Delete(types.ConsumerGenesisKey(consumerId)) } // VerifyConsumerChain verifies that the chain trying to connect on the channel handshake @@ -379,21 +384,26 @@ func (k Keeper) VerifyConsumerChain(ctx sdk.Context, channelID string, connectio return errorsmod.Wrap(channeltypes.ErrTooManyConnectionHops, "must have direct connection to provider chain") } connectionID := connectionHops[0] - clientID, tmClient, err := k.getUnderlyingClient(ctx, connectionID) + clientId, _, err := k.getUnderlyingClient(ctx, connectionID) if err != nil { return err } - ccvClientId, found := k.GetConsumerClientId(ctx, tmClient.ChainId) + + consumerId, found := k.GetClientIdToConsumerId(ctx, clientId) + if !found { + return errorsmod.Wrapf(ccv.ErrConsumerChainNotFound, "cannot find consumer id associated with client id: %s", clientId) + } + ccvClientId, found := k.GetConsumerClientId(ctx, consumerId) if !found { - return errorsmod.Wrapf(ccv.ErrClientNotFound, "cannot find client for consumer chain %s", tmClient.ChainId) + return errorsmod.Wrapf(ccv.ErrClientNotFound, "cannot find client for consumer chain %s", consumerId) } - if ccvClientId != clientID { - return errorsmod.Wrapf(types.ErrInvalidConsumerClient, "CCV channel must be built on top of CCV client. expected %s, got %s", ccvClientId, clientID) + if ccvClientId != clientId { + return errorsmod.Wrapf(types.ErrInvalidConsumerClient, "CCV channel must be built on top of CCV client. expected %s, got %s", ccvClientId, clientId) } // Verify that there isn't already a CCV channel for the consumer chain - if prevChannel, ok := k.GetChainToChannel(ctx, tmClient.ChainId); ok { - return errorsmod.Wrapf(ccv.ErrDuplicateChannel, "CCV channel with ID: %s already created for consumer chain %s", prevChannel, tmClient.ChainId) + if prevChannel, ok := k.GetConsumerIdToChannelId(ctx, consumerId); ok { + return errorsmod.Wrapf(ccv.ErrDuplicateChannel, "CCV channel with ID: %s already created for consumer chain %s", prevChannel, consumerId) } return nil } @@ -418,18 +428,22 @@ func (k Keeper) SetConsumerChain(ctx sdk.Context, channelID string) error { if err != nil { return err } + consumerId, found := k.GetClientIdToConsumerId(ctx, clientID) + if !found { + return errorsmod.Wrapf(types.ErrNoConsumerId, "cannot find a consumer chain associated for this client: %s", clientID) + } // Verify that there isn't already a CCV channel for the consumer chain chainID := tmClient.ChainId - if prevChannelID, ok := k.GetChainToChannel(ctx, chainID); ok { - return errorsmod.Wrapf(ccv.ErrDuplicateChannel, "CCV channel with ID: %s already created for consumer chain %s", prevChannelID, chainID) + if prevChannelID, ok := k.GetConsumerIdToChannelId(ctx, consumerId); ok { + return errorsmod.Wrapf(ccv.ErrDuplicateChannel, "CCV channel with ID: %s already created for consumer chain with id %s", prevChannelID, consumerId) } // the CCV channel is established: // - set channel mappings - k.SetChainToChannel(ctx, chainID, channelID) - k.SetChannelToChain(ctx, channelID, chainID) + k.SetConsumerIdToChannelId(ctx, consumerId, channelID) + k.SetChannelToConsumerId(ctx, channelID, consumerId) // - set current block height for the consumer chain initialization - k.SetInitChainHeight(ctx, chainID, uint64(ctx.BlockHeight())) + k.SetInitChainHeight(ctx, consumerId, uint64(ctx.BlockHeight())) // emit event on successful addition ctx.EventManager().EmitEvent( @@ -554,7 +568,7 @@ func (k Keeper) DeleteValsetUpdateBlockHeight(ctx sdk.Context, valsetUpdateId ui // // TODO: SlashAcks should be persisted as a list of ConsumerConsAddr types, not strings. // See https://github.com/cosmos/interchain-security/issues/728 -func (k Keeper) SetSlashAcks(ctx sdk.Context, chainID string, acks []string) { +func (k Keeper) SetSlashAcks(ctx sdk.Context, consumerId string, acks []string) { store := ctx.KVStore(k.storeKey) sa := types.SlashAcks{ @@ -566,16 +580,16 @@ func (k Keeper) SetSlashAcks(ctx sdk.Context, chainID string, acks []string) { // sa is instantiated in this method and should be able to be marshaled. panic(fmt.Errorf("failed to marshal SlashAcks: %w", err)) } - store.Set(types.SlashAcksKey(chainID), bz) + store.Set(types.SlashAcksKey(consumerId), bz) } -// GetSlashAcks returns the slash acks stored under the given chain ID +// GetSlashAcks returns the slash acks stored under the given consumer id // // TODO: SlashAcks should be persisted as a list of ConsumerConsAddr types, not strings. // See https://github.com/cosmos/interchain-security/issues/728 -func (k Keeper) GetSlashAcks(ctx sdk.Context, chainID string) []string { +func (k Keeper) GetSlashAcks(ctx sdk.Context, consumerId string) []string { store := ctx.KVStore(k.storeKey) - bz := store.Get(types.SlashAcksKey(chainID)) + bz := store.Get(types.SlashAcksKey(consumerId)) if bz == nil { return nil } @@ -589,45 +603,45 @@ func (k Keeper) GetSlashAcks(ctx sdk.Context, chainID string) []string { return acks.GetAddresses() } -// ConsumeSlashAcks empties and returns the slash acks for a given chain ID -func (k Keeper) ConsumeSlashAcks(ctx sdk.Context, chainID string) (acks []string) { - acks = k.GetSlashAcks(ctx, chainID) +// ConsumeSlashAcks empties and returns the slash acks for a given consumer id +func (k Keeper) ConsumeSlashAcks(ctx sdk.Context, consumerId string) (acks []string) { + acks = k.GetSlashAcks(ctx, consumerId) if len(acks) < 1 { return } store := ctx.KVStore(k.storeKey) - store.Delete(types.SlashAcksKey(chainID)) + store.Delete(types.SlashAcksKey(consumerId)) return } -// DeleteSlashAcks deletes the slash acks for a given chain ID -func (k Keeper) DeleteSlashAcks(ctx sdk.Context, chainID string) { +// DeleteSlashAcks deletes the slash acks for a given consumer id +func (k Keeper) DeleteSlashAcks(ctx sdk.Context, consumerId string) { store := ctx.KVStore(k.storeKey) - store.Delete(types.SlashAcksKey(chainID)) + store.Delete(types.SlashAcksKey(consumerId)) } -// AppendSlashAck appends the given slash ack to the given chain ID slash acks in store -func (k Keeper) AppendSlashAck(ctx sdk.Context, chainID, +// AppendSlashAck appends the given slash ack to the given consumer id slash acks in store +func (k Keeper) AppendSlashAck(ctx sdk.Context, consumerId, ack string, // TODO: consumer cons addr should be accepted here, see https://github.com/cosmos/interchain-security/issues/728 ) { - acks := k.GetSlashAcks(ctx, chainID) + acks := k.GetSlashAcks(ctx, consumerId) acks = append(acks, ack) - k.SetSlashAcks(ctx, chainID, acks) + k.SetSlashAcks(ctx, consumerId, acks) } // SetInitChainHeight sets the provider block height when the given consumer chain was initiated -func (k Keeper) SetInitChainHeight(ctx sdk.Context, chainID string, height uint64) { +func (k Keeper) SetInitChainHeight(ctx sdk.Context, consumerId string, height uint64) { store := ctx.KVStore(k.storeKey) heightBytes := make([]byte, 8) binary.BigEndian.PutUint64(heightBytes, height) - store.Set(types.InitChainHeightKey(chainID), heightBytes) + store.Set(types.InitChainHeightKey(consumerId), heightBytes) } // GetInitChainHeight returns the provider block height when the given consumer chain was initiated -func (k Keeper) GetInitChainHeight(ctx sdk.Context, chainID string) (uint64, bool) { +func (k Keeper) GetInitChainHeight(ctx sdk.Context, consumerId string) (uint64, bool) { store := ctx.KVStore(k.storeKey) - bz := store.Get(types.InitChainHeightKey(chainID)) + bz := store.Get(types.InitChainHeightKey(consumerId)) if bz == nil { return 0, false } @@ -636,17 +650,17 @@ func (k Keeper) GetInitChainHeight(ctx sdk.Context, chainID string) (uint64, boo } // DeleteInitChainHeight deletes the block height value for which the given consumer chain's channel was established -func (k Keeper) DeleteInitChainHeight(ctx sdk.Context, chainID string) { +func (k Keeper) DeleteInitChainHeight(ctx sdk.Context, consumerId string) { store := ctx.KVStore(k.storeKey) - store.Delete(types.InitChainHeightKey(chainID)) + store.Delete(types.InitChainHeightKey(consumerId)) } -// GetPendingVSCPackets returns the list of pending ValidatorSetChange packets stored under chain ID -func (k Keeper) GetPendingVSCPackets(ctx sdk.Context, chainID string) []ccv.ValidatorSetChangePacketData { +// GetPendingVSCPackets returns the list of pending ValidatorSetChange packets stored under consumer id +func (k Keeper) GetPendingVSCPackets(ctx sdk.Context, consumerId string) []ccv.ValidatorSetChangePacketData { var packets types.ValidatorSetChangePackets store := ctx.KVStore(k.storeKey) - bz := store.Get(types.PendingVSCsKey(chainID)) + bz := store.Get(types.PendingVSCsKey(consumerId)) if bz == nil { return []ccv.ValidatorSetChangePacketData{} } @@ -659,9 +673,9 @@ func (k Keeper) GetPendingVSCPackets(ctx sdk.Context, chainID string) []ccv.Vali } // AppendPendingVSCPackets adds the given ValidatorSetChange packet to the list -// of pending ValidatorSetChange packets stored under chain ID -func (k Keeper) AppendPendingVSCPackets(ctx sdk.Context, chainID string, newPackets ...ccv.ValidatorSetChangePacketData) { - pds := append(k.GetPendingVSCPackets(ctx, chainID), newPackets...) +// of pending ValidatorSetChange packets stored under consumer id +func (k Keeper) AppendPendingVSCPackets(ctx sdk.Context, consumerId string, newPackets ...ccv.ValidatorSetChangePacketData) { + pds := append(k.GetPendingVSCPackets(ctx, consumerId), newPackets...) store := ctx.KVStore(k.storeKey) packets := types.ValidatorSetChangePackets{List: pds} @@ -671,35 +685,35 @@ func (k Keeper) AppendPendingVSCPackets(ctx sdk.Context, chainID string, newPack // packets is instantiated in this method and should be able to be marshaled. panic(fmt.Errorf("cannot marshal pending validator set changes: %w", err)) } - store.Set(types.PendingVSCsKey(chainID), buf) + store.Set(types.PendingVSCsKey(consumerId), buf) } // DeletePendingVSCPackets deletes the list of pending ValidatorSetChange packets for chain ID -func (k Keeper) DeletePendingVSCPackets(ctx sdk.Context, chainID string) { +func (k Keeper) DeletePendingVSCPackets(ctx sdk.Context, consumerId string) { store := ctx.KVStore(k.storeKey) - store.Delete(types.PendingVSCsKey(chainID)) + store.Delete(types.PendingVSCsKey(consumerId)) } -// SetConsumerClientId sets the client ID for the given chain ID -func (k Keeper) SetConsumerClientId(ctx sdk.Context, chainID, clientID string) { +// SetConsumerClientId sets the client id for the given consumer id +func (k Keeper) SetConsumerClientId(ctx sdk.Context, consumerId, clientID string) { store := ctx.KVStore(k.storeKey) - store.Set(types.ChainToClientKey(chainID), []byte(clientID)) + store.Set(types.ConsumerIdToClientIdKey(consumerId), []byte(clientID)) } -// GetConsumerClientId returns the client ID for the given chain ID. -func (k Keeper) GetConsumerClientId(ctx sdk.Context, chainID string) (string, bool) { +// GetConsumerClientId returns the client id for the given consumer id. +func (k Keeper) GetConsumerClientId(ctx sdk.Context, consumerId string) (string, bool) { store := ctx.KVStore(k.storeKey) - clientIdBytes := store.Get(types.ChainToClientKey(chainID)) + clientIdBytes := store.Get(types.ConsumerIdToClientIdKey(consumerId)) if clientIdBytes == nil { return "", false } return string(clientIdBytes), true } -// DeleteConsumerClientId removes from the store the clientID for the given chainID. -func (k Keeper) DeleteConsumerClientId(ctx sdk.Context, chainID string) { +// DeleteConsumerClientId removes from the store the client id for the given consumer id. +func (k Keeper) DeleteConsumerClientId(ctx sdk.Context, consumerId string) { store := ctx.KVStore(k.storeKey) - store.Delete(types.ChainToClientKey(chainID)) + store.Delete(types.ConsumerIdToClientIdKey(consumerId)) } // SetSlashLog updates validator's slash log for a consumer chain @@ -728,101 +742,83 @@ func (k Keeper) BondDenom(ctx sdk.Context) (string, error) { return k.stakingKeeper.BondDenom(ctx) } -func (k Keeper) GetAllRegisteredAndProposedChainIDs(ctx sdk.Context) []string { - allConsumerChains := []string{} - allConsumerChains = append(allConsumerChains, k.GetAllRegisteredConsumerChainIDs(ctx)...) - proposedChains := k.GetAllProposedConsumerChainIDs(ctx) - for _, proposedChain := range proposedChains { - allConsumerChains = append(allConsumerChains, proposedChain.ChainID) +// GetAllActiveConsumerIds returns all the consumer ids of chains that are registered, initialized, or launched +func (k Keeper) GetAllActiveConsumerIds(ctx sdk.Context) []string { + latestConsumerId, found := k.GetConsumerId(ctx) + if !found { + return []string{} } - pendingChainIDs := k.GetAllPendingConsumerChainIDs(ctx) - allConsumerChains = append(allConsumerChains, pendingChainIDs...) - - return allConsumerChains -} -// SetTopN stores the N value associated to chain with `chainID` -func (k Keeper) SetTopN( - ctx sdk.Context, - chainID string, - N uint32, -) { - store := ctx.KVStore(k.storeKey) - - buf := make([]byte, 4) - binary.BigEndian.PutUint32(buf, N) - - store.Set(types.TopNKey(chainID), buf) -} + consumerIds := []string{} + for i := uint64(0); i <= latestConsumerId; i++ { + consumerId := fmt.Sprintf("%d", i) + phase, foundPhase := k.GetConsumerPhase(ctx, consumerId) + if !foundPhase || (phase != Registered && phase != Initialized && phase != Launched) { + continue + } + consumerIds = append(consumerIds, consumerId) + } -// DeleteTopN removes the N value associated to chain with `chainID` -func (k Keeper) DeleteTopN( - ctx sdk.Context, - chainID string, -) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.TopNKey(chainID)) + return consumerIds } -// GetTopN returns (N, true) if chain `chainID` has a top N associated, and (0, false) otherwise. +// GetTopN returns N if chain `consumerId` has a top N associated, and 0 otherwise. func (k Keeper) GetTopN( ctx sdk.Context, - chainID string, -) (uint32, bool) { - store := ctx.KVStore(k.storeKey) - buf := store.Get(types.TopNKey(chainID)) - if buf == nil { - return 0, false + consumerId string, +) uint32 { + powerShapingParameters, err := k.GetConsumerPowerShapingParameters(ctx, consumerId) + if err != nil { + k.Logger(ctx).Error("could not retrieve power shaping parameters", "error", err) } - return binary.BigEndian.Uint32(buf), true + + return powerShapingParameters.Top_N } -// IsTopN returns true if chain with `chainID` is a Top-N chain (i.e., enforces at least one validator to validate chain `chainID`) -func (k Keeper) IsTopN(ctx sdk.Context, chainID string) bool { - topN, found := k.GetTopN(ctx, chainID) - return found && topN > 0 +// IsTopN returns true if chain with `consumerId` is a Top-N chain (i.e., enforces at least one validator to validate chain `consumerId`) +func (k Keeper) IsTopN(ctx sdk.Context, consumerId string) bool { + return k.GetTopN(ctx, consumerId) > 0 } -// IsOptIn returns true if chain with `chainID` is an Opt-In chain (i.e., no validator is forced to validate chain `chainID`) -func (k Keeper) IsOptIn(ctx sdk.Context, chainID string) bool { - topN, found := k.GetTopN(ctx, chainID) - return !found || topN == 0 +// IsOptIn returns true if chain with `consumerId` is an Opt-In chain (i.e., no validator is forced to validate chain `consumerId`) +func (k Keeper) IsOptIn(ctx sdk.Context, consumerId string) bool { + return k.GetTopN(ctx, consumerId) == 0 } func (k Keeper) SetOptedIn( ctx sdk.Context, - chainID string, + consumerId string, providerConsAddress types.ProviderConsAddress, ) { store := ctx.KVStore(k.storeKey) - store.Set(types.OptedInKey(chainID, providerConsAddress), []byte{}) + store.Set(types.OptedInKey(consumerId, providerConsAddress), []byte{}) } func (k Keeper) DeleteOptedIn( ctx sdk.Context, - chainID string, + consumerId string, providerAddr types.ProviderConsAddress, ) { store := ctx.KVStore(k.storeKey) - store.Delete(types.OptedInKey(chainID, providerAddr)) + store.Delete(types.OptedInKey(consumerId, providerAddr)) } func (k Keeper) IsOptedIn( ctx sdk.Context, - chainID string, + consumerId string, providerAddr types.ProviderConsAddress, ) bool { store := ctx.KVStore(k.storeKey) - return store.Get(types.OptedInKey(chainID, providerAddr)) != nil + return store.Get(types.OptedInKey(consumerId, providerAddr)) != nil } -// GetAllOptedIn returns all the opted-in validators on chain `chainID` +// GetAllOptedIn returns all the opted-in validators on chain `consumerId` func (k Keeper) GetAllOptedIn( ctx sdk.Context, - chainID string, + consumerId string, ) (providerConsAddresses []types.ProviderConsAddress) { store := ctx.KVStore(k.storeKey) - key := types.ChainIdWithLenKey(types.OptedInKeyPrefix(), chainID) + key := types.ConsumerIdWithLenKey(types.OptedInKeyPrefix(), consumerId) iterator := storetypes.KVStorePrefixIterator(store, key) defer iterator.Close() @@ -833,13 +829,13 @@ func (k Keeper) GetAllOptedIn( return providerConsAddresses } -// DeleteAllOptedIn deletes all the opted-in validators for chain with `chainID` +// DeleteAllOptedIn deletes all the opted-in validators for chain with `consumerId` func (k Keeper) DeleteAllOptedIn( ctx sdk.Context, - chainID string, + consumerId string, ) { store := ctx.KVStore(k.storeKey) - key := types.ChainIdWithLenKey(types.OptedInKeyPrefix(), chainID) + key := types.ConsumerIdWithLenKey(types.OptedInKeyPrefix(), consumerId) iterator := storetypes.KVStorePrefixIterator(store, key) var keysToDel [][]byte @@ -856,7 +852,7 @@ func (k Keeper) DeleteAllOptedIn( // for the given validator address func (k Keeper) SetConsumerCommissionRate( ctx sdk.Context, - chainID string, + consumerId string, providerAddr types.ProviderConsAddress, commissionRate math.LegacyDec, ) error { @@ -868,7 +864,7 @@ func (k Keeper) SetConsumerCommissionRate( return err } - store.Set(types.ConsumerCommissionRateKey(chainID, providerAddr), bz) + store.Set(types.ConsumerCommissionRateKey(consumerId, providerAddr), bz) return nil } @@ -876,11 +872,11 @@ func (k Keeper) SetConsumerCommissionRate( // for the given validator address func (k Keeper) GetConsumerCommissionRate( ctx sdk.Context, - chainID string, + consumerId string, providerAddr types.ProviderConsAddress, ) (math.LegacyDec, bool) { store := ctx.KVStore(k.storeKey) - bz := store.Get(types.ConsumerCommissionRateKey(chainID, providerAddr)) + bz := store.Get(types.ConsumerCommissionRateKey(consumerId, providerAddr)) if bz == nil { return math.LegacyZeroDec(), false } @@ -896,13 +892,13 @@ func (k Keeper) GetConsumerCommissionRate( } // GetAllCommissionRateValidators returns all the validator address -// that set a commission rate for the given chain ID +// that set a commission rate for the given consumer id func (k Keeper) GetAllCommissionRateValidators( ctx sdk.Context, - chainID string, + consumerId string, ) (addresses []types.ProviderConsAddress) { store := ctx.KVStore(k.storeKey) - key := types.ChainIdWithLenKey(types.ConsumerCommissionRateKeyPrefix(), chainID) + key := types.ConsumerIdWithLenKey(types.ConsumerCommissionRateKeyPrefix(), consumerId) iterator := storetypes.KVStorePrefixIterator(store, key) defer iterator.Close() @@ -918,102 +914,54 @@ func (k Keeper) GetAllCommissionRateValidators( // associated to the given validator address func (k Keeper) DeleteConsumerCommissionRate( ctx sdk.Context, - chainID string, + consumerId string, providerAddr types.ProviderConsAddress, ) { store := ctx.KVStore(k.storeKey) - store.Delete(types.ConsumerCommissionRateKey(chainID, providerAddr)) -} - -// SetValidatorsPowerCap sets the power-cap value `p` associated to chain with `chainID` -func (k Keeper) SetValidatorsPowerCap( - ctx sdk.Context, - chainID string, - p uint32, -) { - store := ctx.KVStore(k.storeKey) - - buf := make([]byte, 4) - binary.BigEndian.PutUint32(buf, p) - - store.Set(types.ValidatorsPowerCapKey(chainID), buf) -} - -// DeleteValidatorsPowerCap removes the power-cap value associated to chain with `chainID` -func (k Keeper) DeleteValidatorsPowerCap( - ctx sdk.Context, - chainID string, -) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.ValidatorsPowerCapKey(chainID)) + store.Delete(types.ConsumerCommissionRateKey(consumerId, providerAddr)) } -// GetValidatorsPowerCap returns `(p, true)` if chain `chainID` has power cap `p` associated with it, and (0, false) otherwise +// GetValidatorsPowerCap returns the associated power cap of chain with `consumerId` and 0 if no power cap association is found func (k Keeper) GetValidatorsPowerCap( ctx sdk.Context, - chainID string, -) (uint32, bool) { - store := ctx.KVStore(k.storeKey) - buf := store.Get(types.ValidatorsPowerCapKey(chainID)) - if buf == nil { - return 0, false + consumerId string, +) uint32 { + powerShapingParameters, err := k.GetConsumerPowerShapingParameters(ctx, consumerId) + if err != nil { + k.Logger(ctx).Error("could not retrieve power shaping parameters", "error", err) } - return binary.BigEndian.Uint32(buf), true + return powerShapingParameters.ValidatorsPowerCap } -// SetValidatorSetCap stores the validator-set cap value `c` associated to chain with `chainID` -func (k Keeper) SetValidatorSetCap( - ctx sdk.Context, - chainID string, - c uint32, -) { - store := ctx.KVStore(k.storeKey) - - buf := make([]byte, 4) - binary.BigEndian.PutUint32(buf, c) - - store.Set(types.ValidatorSetCapKey(chainID), buf) -} - -// DeleteValidatorSetCap removes the validator-set cap value associated to chain with `chainID` -func (k Keeper) DeleteValidatorSetCap( - ctx sdk.Context, - chainID string, -) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.ValidatorSetCapKey(chainID)) -} - -// GetValidatorSetCap returns `(c, true)` if chain `chainID` has validator-set cap `c` associated with it, and (0, false) otherwise +// GetValidatorSetCap returns the associated validator set cap of chain with `consumerId` and 0 if no set cap association is found func (k Keeper) GetValidatorSetCap( ctx sdk.Context, - chainID string, -) (uint32, bool) { - store := ctx.KVStore(k.storeKey) - buf := store.Get(types.ValidatorSetCapKey(chainID)) - if buf == nil { - return 0, false + consumerId string, +) uint32 { + powerShapingParameters, err := k.GetConsumerPowerShapingParameters(ctx, consumerId) + if err != nil { + k.Logger(ctx).Error("could not retrieve power shaping parameters", "error", err) } - return binary.BigEndian.Uint32(buf), true + return powerShapingParameters.ValidatorSetCap } -// SetAllowlist allowlists validator with `providerAddr` address on chain `chainID` +// SetAllowlist allowlists validator with `providerAddr` address on chain `consumerId` func (k Keeper) SetAllowlist( ctx sdk.Context, - chainID string, + consumerId string, providerAddr types.ProviderConsAddress, ) { store := ctx.KVStore(k.storeKey) - store.Set(types.AllowlistKey(chainID, providerAddr), []byte{}) + store.Set(types.AllowlistKey(consumerId, providerAddr), []byte{}) } // GetAllowList returns all allowlisted validators func (k Keeper) GetAllowList( ctx sdk.Context, - chainID string, + consumerId string, ) (providerConsAddresses []types.ProviderConsAddress) { store := ctx.KVStore(k.storeKey) - key := types.ChainIdWithLenKey(types.AllowlistKeyPrefix(), chainID) + key := types.ConsumerIdWithLenKey(types.AllowlistKeyPrefix(), consumerId) iterator := storetypes.KVStorePrefixIterator(store, key) defer iterator.Close() @@ -1024,21 +972,21 @@ func (k Keeper) GetAllowList( return providerConsAddresses } -// IsAllowlisted returns `true` if validator with `providerAddr` has been allowlisted on chain `chainID` +// IsAllowlisted returns `true` if validator with `providerAddr` has been allowlisted on chain `consumerId` func (k Keeper) IsAllowlisted( ctx sdk.Context, - chainID string, + consumerId string, providerAddr types.ProviderConsAddress, ) bool { store := ctx.KVStore(k.storeKey) - bz := store.Get(types.AllowlistKey(chainID, providerAddr)) + bz := store.Get(types.AllowlistKey(consumerId, providerAddr)) return bz != nil } // DeleteAllowlist deletes all allowlisted validators -func (k Keeper) DeleteAllowlist(ctx sdk.Context, chainID string) { +func (k Keeper) DeleteAllowlist(ctx sdk.Context, consumerId string) { store := ctx.KVStore(k.storeKey) - iterator := storetypes.KVStorePrefixIterator(store, types.ChainIdWithLenKey(types.AllowlistKeyPrefix(), chainID)) + iterator := storetypes.KVStorePrefixIterator(store, types.ConsumerIdWithLenKey(types.AllowlistKeyPrefix(), consumerId)) defer iterator.Close() keysToDel := [][]byte{} @@ -1051,32 +999,32 @@ func (k Keeper) DeleteAllowlist(ctx sdk.Context, chainID string) { } } -// IsAllowlistEmpty returns `true` if no validator is allowlisted on chain `chainID` -func (k Keeper) IsAllowlistEmpty(ctx sdk.Context, chainID string) bool { +// IsAllowlistEmpty returns `true` if no validator is allowlisted on chain `consumerId` +func (k Keeper) IsAllowlistEmpty(ctx sdk.Context, consumerId string) bool { store := ctx.KVStore(k.storeKey) - iterator := storetypes.KVStorePrefixIterator(store, types.ChainIdWithLenKey(types.AllowlistKeyPrefix(), chainID)) + iterator := storetypes.KVStorePrefixIterator(store, types.ConsumerIdWithLenKey(types.AllowlistKeyPrefix(), consumerId)) defer iterator.Close() return !iterator.Valid() } -// SetDenylist denylists validator with `providerAddr` address on chain `chainID` +// SetDenylist denylists validator with `providerAddr` address on chain `consumerId` func (k Keeper) SetDenylist( ctx sdk.Context, - chainID string, + consumerId string, providerAddr types.ProviderConsAddress, ) { store := ctx.KVStore(k.storeKey) - store.Set(types.DenylistKey(chainID, providerAddr), []byte{}) + store.Set(types.DenylistKey(consumerId, providerAddr), []byte{}) } // GetDenyList returns all denylisted validators func (k Keeper) GetDenyList( ctx sdk.Context, - chainID string, + consumerId string, ) (providerConsAddresses []types.ProviderConsAddress) { store := ctx.KVStore(k.storeKey) - key := types.ChainIdWithLenKey(types.DenylistKeyPrefix(), chainID) + key := types.ConsumerIdWithLenKey(types.DenylistKeyPrefix(), consumerId) iterator := storetypes.KVStorePrefixIterator(store, key) defer iterator.Close() @@ -1087,21 +1035,21 @@ func (k Keeper) GetDenyList( return providerConsAddresses } -// IsDenylisted returns `true` if validator with `providerAddr` has been denylisted on chain `chainID` +// IsDenylisted returns `true` if validator with `providerAddr` has been denylisted on chain `consumerId` func (k Keeper) IsDenylisted( ctx sdk.Context, - chainID string, + consumerId string, providerAddr types.ProviderConsAddress, ) bool { store := ctx.KVStore(k.storeKey) - bz := store.Get(types.DenylistKey(chainID, providerAddr)) + bz := store.Get(types.DenylistKey(consumerId, providerAddr)) return bz != nil } // DeleteDenylist deletes all denylisted validators -func (k Keeper) DeleteDenylist(ctx sdk.Context, chainID string) { +func (k Keeper) DeleteDenylist(ctx sdk.Context, consumerId string) { store := ctx.KVStore(k.storeKey) - iterator := storetypes.KVStorePrefixIterator(store, types.ChainIdWithLenKey(types.DenylistKeyPrefix(), chainID)) + iterator := storetypes.KVStorePrefixIterator(store, types.ConsumerIdWithLenKey(types.DenylistKeyPrefix(), consumerId)) defer iterator.Close() keysToDel := [][]byte{} @@ -1114,10 +1062,10 @@ func (k Keeper) DeleteDenylist(ctx sdk.Context, chainID string) { } } -// IsDenylistEmpty returns `true` if no validator is denylisted on chain `chainID` -func (k Keeper) IsDenylistEmpty(ctx sdk.Context, chainID string) bool { +// IsDenylistEmpty returns `true` if no validator is denylisted on chain `consumerId` +func (k Keeper) IsDenylistEmpty(ctx sdk.Context, consumerId string) bool { store := ctx.KVStore(k.storeKey) - iterator := storetypes.KVStorePrefixIterator(store, types.ChainIdWithLenKey(types.DenylistKeyPrefix(), chainID)) + iterator := storetypes.KVStorePrefixIterator(store, types.ConsumerIdWithLenKey(types.DenylistKeyPrefix(), consumerId)) defer iterator.Close() return !iterator.Valid() @@ -1127,7 +1075,7 @@ func (k Keeper) IsDenylistEmpty(ctx sdk.Context, chainID string) bool { // for a given consumer chain. func (k Keeper) SetMinimumPowerInTopN( ctx sdk.Context, - chainID string, + consumerId string, power int64, ) { store := ctx.KVStore(k.storeKey) @@ -1135,17 +1083,17 @@ func (k Keeper) SetMinimumPowerInTopN( buf := make([]byte, 8) binary.BigEndian.PutUint64(buf, uint64(power)) - store.Set(types.MinimumPowerInTopNKey(chainID), buf) + store.Set(types.MinimumPowerInTopNKey(consumerId), buf) } // GetMinimumPowerInTopN returns the minimum power required for a validator to be in the top N // for a given consumer chain. func (k Keeper) GetMinimumPowerInTopN( ctx sdk.Context, - chainID string, + consumerId string, ) (int64, bool) { store := ctx.KVStore(k.storeKey) - buf := store.Get(types.MinimumPowerInTopNKey(chainID)) + buf := store.Get(types.MinimumPowerInTopNKey(consumerId)) if buf == nil { return 0, false } @@ -1156,93 +1104,36 @@ func (k Keeper) GetMinimumPowerInTopN( // for a given consumer chain. func (k Keeper) DeleteMinimumPowerInTopN( ctx sdk.Context, - chainID string, + consumerId string, ) { store := ctx.KVStore(k.storeKey) - store.Delete(types.MinimumPowerInTopNKey(chainID)) -} - -// SetMinStake sets the minimum stake required for a validator to validate -// a given consumer chain. -func (k Keeper) SetMinStake( - ctx sdk.Context, - chainID string, - minStake uint64, -) { - store := ctx.KVStore(k.storeKey) - - buf := make([]byte, 8) - binary.BigEndian.PutUint64(buf, minStake) - - store.Set(types.MinStakeKey(chainID), buf) + store.Delete(types.MinimumPowerInTopNKey(consumerId)) } // GetMinStake returns the minimum stake required for a validator to validate -// a given consumer chain. +// a given consumer chain. Returns 0 if min stake is not found for this consumer id. func (k Keeper) GetMinStake( ctx sdk.Context, - chainID string, -) (uint64, bool) { - store := ctx.KVStore(k.storeKey) - buf := store.Get(types.MinStakeKey(chainID)) - if buf == nil { - return 0, false - } - return binary.BigEndian.Uint64(buf), true -} - -// DeleteMinStake removes the minimum stake required for a validator to validate -// a given consumer chain. -func (k Keeper) DeleteMinStake( - ctx sdk.Context, - chainID string, -) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.MinStakeKey(chainID)) -} - -// SetInactiveValidatorsAllowed sets whether inactive validators are allowed to validate -// a given consumer chain. -func (k Keeper) SetInactiveValidatorsAllowed( - ctx sdk.Context, - chainID string, - allowed bool, -) { - if allowed { - k.EnableInactiveValidators(ctx, chainID) - } else { - k.DisableInactiveValidators(ctx, chainID) + consumerId string, +) uint64 { + powerShapingParameters, err := k.GetConsumerPowerShapingParameters(ctx, consumerId) + if err != nil { + k.Logger(ctx).Error("could not retrieve power shaping parameters", "error", err) } -} - -// EnableInactiveValidators sets the flag to signal that inactive validators are allowed to validate -// a given consumer chain. -func (k Keeper) EnableInactiveValidators( - ctx sdk.Context, - chainID string, -) { - store := ctx.KVStore(k.storeKey) - store.Set(types.AllowInactiveValidatorsKey(chainID), []byte{}) + return powerShapingParameters.MinStake } // AllowsInactiveValidators returns whether inactive validators are allowed to validate -// a given consumer chain. +// a given consumer chain. Returns false if flag on inactive validators is not found for this consumer id. func (k Keeper) AllowsInactiveValidators( ctx sdk.Context, - chainID string, + consumerId string, ) bool { - store := ctx.KVStore(k.storeKey) - return store.Has(types.AllowInactiveValidatorsKey(chainID)) -} - -// DisableInactiveValidators removes the flag of whether inactive validators are allowed to validate -// a given consumer chain. -func (k Keeper) DisableInactiveValidators( - ctx sdk.Context, - chainID string, -) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.AllowInactiveValidatorsKey(chainID)) + powerShapingParameters, err := k.GetConsumerPowerShapingParameters(ctx, consumerId) + if err != nil { + k.Logger(ctx).Error("could not retrieve power shaping parameters", "error", err) + } + return powerShapingParameters.AllowInactiveVals } func (k Keeper) UnbondingCanComplete(ctx sdk.Context, id uint64) error { diff --git a/x/ccv/provider/keeper/keeper_test.go b/x/ccv/provider/keeper/keeper_test.go index 442e86c09d..d781164e5b 100644 --- a/x/ccv/provider/keeper/keeper_test.go +++ b/x/ccv/provider/keeper/keeper_test.go @@ -229,7 +229,7 @@ func TestGetAllRegisteredConsumerChainIDs(t *testing.T) { defer ctrl.Finish() chainIDs := []string{"chain-2", "chain-1", "chain-4", "chain-3"} - // GetAllRegisteredConsumerChainIDs iterates over chainID in lexicographical order + // GetAllRegisteredConsumerIds iterates over consumerId in lexicographical order expectedChainIDs := []string{"chain-1", "chain-2", "chain-3", "chain-4"} for i, chainID := range chainIDs { @@ -237,30 +237,37 @@ func TestGetAllRegisteredConsumerChainIDs(t *testing.T) { pk.SetConsumerClientId(ctx, chainID, clientID) } - result := pk.GetAllRegisteredConsumerChainIDs(ctx) + result := pk.GetAllRegisteredConsumerIds(ctx) require.Len(t, result, len(chainIDs)) require.Equal(t, expectedChainIDs, result) } -// TestGetAllChannelToChains tests GetAllChannelToChains behaviour correctness +// TestGetAllChannelToChains tests GetAllChannelToConsumers behaviour correctness func TestGetAllChannelToChains(t *testing.T) { pk, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - chainIDs := []string{"chain-2", "chain-1", "chain-4", "chain-3"} - expectedGetAllOrder := []types.ChannelToChain{} - for i, chainID := range chainIDs { - channelID := fmt.Sprintf("client-%d", len(chainIDs)-i) - pk.SetChannelToChain(ctx, channelID, chainID) - expectedGetAllOrder = append(expectedGetAllOrder, types.ChannelToChain{ChainId: chainID, ChannelId: channelID}) + consumerIds := []string{"2", "1", "4", "3"} + var expectedGetAllOrder []struct { + ChannelId string + ConsumerId string + } + + for i, consumerId := range consumerIds { + channelID := fmt.Sprintf("client-%d", len(consumerIds)-i) + pk.SetChannelToConsumerId(ctx, channelID, consumerId) + expectedGetAllOrder = append(expectedGetAllOrder, struct { + ChannelId string + ConsumerId string + }{ConsumerId: consumerId, ChannelId: channelID}) } // sorting by channelID sort.Slice(expectedGetAllOrder, func(i, j int) bool { return expectedGetAllOrder[i].ChannelId < expectedGetAllOrder[j].ChannelId }) - result := pk.GetAllChannelToChains(ctx) - require.Len(t, result, len(chainIDs)) + result := pk.GetAllChannelToConsumers(ctx) + require.Len(t, result, len(consumerIds)) require.Equal(t, expectedGetAllOrder, result) } @@ -282,19 +289,19 @@ func TestSetProposedConsumerChains(t *testing.T) { defer ctrl.Finish() tests := []struct { - chainID string - proposalID uint64 + consumerId string + proposalId uint64 }{ - {chainID: "1", proposalID: 1}, - {chainID: "some other ID", proposalID: 12}, - {chainID: "some other other chain ID", proposalID: 123}, - {chainID: "", proposalID: 1234}, + {consumerId: "1", proposalId: 1}, + {consumerId: "some other ID", proposalId: 12}, + {consumerId: "some other other chain ID", proposalId: 123}, + {consumerId: "", proposalId: 1234}, } for _, test := range tests { - providerKeeper.SetProposedConsumerChain(ctx, test.chainID, test.proposalID) - cID, _ := providerKeeper.GetProposedConsumerChain(ctx, test.proposalID) - require.Equal(t, cID, test.chainID) + providerKeeper.SetProposalIdToConsumerId(ctx, test.proposalId, test.consumerId) + cID, _ := providerKeeper.GetProposalIdToConsumerId(ctx, test.proposalId) + require.Equal(t, cID, test.consumerId) } } @@ -303,23 +310,23 @@ func TestDeleteProposedConsumerChainInStore(t *testing.T) { defer ctrl.Finish() tests := []struct { - chainID string - proposalID uint64 - deleteProposalID uint64 + chainId string + proposalId uint64 + deleteProposalId uint64 ok bool }{ - {chainID: "1", proposalID: 1, deleteProposalID: 1, ok: true}, - {chainID: "", proposalID: 12, deleteProposalID: 12, ok: true}, - {chainID: "1", proposalID: 0, deleteProposalID: 1, ok: false}, + {chainId: "1", proposalId: 1, deleteProposalId: 1, ok: true}, + {chainId: "", proposalId: 12, deleteProposalId: 12, ok: true}, + {chainId: "1", proposalId: 0, deleteProposalId: 1, ok: false}, } for _, test := range tests { - providerKeeper.SetProposedConsumerChain(ctx, test.chainID, test.proposalID) - providerKeeper.DeleteProposedConsumerChainInStore(ctx, test.deleteProposalID) - cID, found := providerKeeper.GetProposedConsumerChain(ctx, test.proposalID) + providerKeeper.SetProposalIdToConsumerId(ctx, test.proposalId, test.chainId) + providerKeeper.DeleteProposalIdToConsumerId(ctx, test.deleteProposalId) + cID, found := providerKeeper.GetProposalIdToConsumerId(ctx, test.proposalId) if test.ok { require.False(t, found) } else { - require.Equal(t, cID, test.chainID) + require.Equal(t, cID, test.chainId) } } } @@ -331,21 +338,21 @@ func TestGetAllProposedConsumerChainIDs(t *testing.T) { {}, { { - ChainID: "1", + ConsumerId: "1", ProposalID: 1, }, }, { { - ChainID: "1", + ConsumerId: "1", ProposalID: 1, }, { - ChainID: "2", + ConsumerId: "2", ProposalID: 2, }, { - ChainID: "", + ConsumerId: "", ProposalID: 3, }, }, @@ -353,7 +360,7 @@ func TestGetAllProposedConsumerChainIDs(t *testing.T) { for _, test := range tests { for _, tc := range test { - providerKeeper.SetProposedConsumerChain(ctx, tc.ChainID, tc.ProposalID) + providerKeeper.SetProposalIdToConsumerId(ctx, tc.ProposalID, tc.ConsumerId) } chains := providerKeeper.GetAllProposedConsumerChainIDs(ctx) @@ -367,7 +374,7 @@ func TestGetAllProposedConsumerChainIDs(t *testing.T) { require.Equal(t, chains, test) for _, tc := range test { - providerKeeper.DeleteProposedConsumerChainInStore(ctx, tc.ProposalID) + providerKeeper.DeleteProposalIdToConsumerId(ctx, tc.ProposalID) } } } @@ -378,27 +385,28 @@ func TestTopN(t *testing.T) { defer ctrl.Finish() tests := []struct { - chainID string - N uint32 - isOptIn bool + consumerId string + N uint32 + isOptIn bool }{ - {chainID: "TopNChain1", N: 50, isOptIn: false}, - {chainID: "TopNChain2", N: 100, isOptIn: false}, - {chainID: "OptInChain", N: 0, isOptIn: true}, + {consumerId: "TopNChain1", N: 50, isOptIn: false}, + {consumerId: "TopNChain2", N: 100, isOptIn: false}, + {consumerId: "OptInChain", N: 0, isOptIn: true}, } for _, test := range tests { - providerKeeper.SetTopN(ctx, test.chainID, test.N) - topN, found := providerKeeper.GetTopN(ctx, test.chainID) + providerKeeper.SetConsumerPowerShapingParameters(ctx, test.consumerId, types.PowerShapingParameters{ + Top_N: test.N, + }) + topN := providerKeeper.GetTopN(ctx, test.consumerId) require.Equal(t, test.N, topN) - require.True(t, found) if test.isOptIn { - require.True(t, providerKeeper.IsOptIn(ctx, test.chainID)) - require.False(t, providerKeeper.IsTopN(ctx, test.chainID)) + require.True(t, providerKeeper.IsOptIn(ctx, test.consumerId)) + require.False(t, providerKeeper.IsTopN(ctx, test.consumerId)) } else { - require.False(t, providerKeeper.IsOptIn(ctx, test.chainID)) - require.True(t, providerKeeper.IsTopN(ctx, test.chainID)) + require.False(t, providerKeeper.IsOptIn(ctx, test.consumerId)) + require.True(t, providerKeeper.IsTopN(ctx, test.consumerId)) } } } @@ -414,10 +422,10 @@ func TestGetAllOptedIn(t *testing.T) { } for _, expectedOptedInValidator := range expectedOptedInValidators { - providerKeeper.SetOptedIn(ctx, "chainID", expectedOptedInValidator) + providerKeeper.SetOptedIn(ctx, "consumerId", expectedOptedInValidator) } - actualOptedInValidators := providerKeeper.GetAllOptedIn(ctx, "chainID") + actualOptedInValidators := providerKeeper.GetAllOptedIn(ctx, "consumerId") // sort validators first to be able to compare sortOptedInValidators := func(addresses []types.ProviderConsAddress) { @@ -438,19 +446,19 @@ func TestOptedIn(t *testing.T) { optedInValidator1 := types.NewProviderConsAddress([]byte("providerAddr1")) optedInValidator2 := types.NewProviderConsAddress([]byte("providerAddr2")) - require.False(t, providerKeeper.IsOptedIn(ctx, "chainID", optedInValidator1)) - providerKeeper.SetOptedIn(ctx, "chainID", optedInValidator1) - require.True(t, providerKeeper.IsOptedIn(ctx, "chainID", optedInValidator1)) - providerKeeper.DeleteOptedIn(ctx, "chainID", optedInValidator1) - require.False(t, providerKeeper.IsOptedIn(ctx, "chainID", optedInValidator1)) - - providerKeeper.SetOptedIn(ctx, "chainID", optedInValidator1) - providerKeeper.SetOptedIn(ctx, "chainID", optedInValidator2) - require.True(t, providerKeeper.IsOptedIn(ctx, "chainID", optedInValidator1)) - require.True(t, providerKeeper.IsOptedIn(ctx, "chainID", optedInValidator2)) - providerKeeper.DeleteAllOptedIn(ctx, "chainID") - require.False(t, providerKeeper.IsOptedIn(ctx, "chainID", optedInValidator1)) - require.False(t, providerKeeper.IsOptedIn(ctx, "chainID", optedInValidator2)) + require.False(t, providerKeeper.IsOptedIn(ctx, "consumerId", optedInValidator1)) + providerKeeper.SetOptedIn(ctx, "consumerId", optedInValidator1) + require.True(t, providerKeeper.IsOptedIn(ctx, "consumerId", optedInValidator1)) + providerKeeper.DeleteOptedIn(ctx, "consumerId", optedInValidator1) + require.False(t, providerKeeper.IsOptedIn(ctx, "consumerId", optedInValidator1)) + + providerKeeper.SetOptedIn(ctx, "consumerId", optedInValidator1) + providerKeeper.SetOptedIn(ctx, "consumerId", optedInValidator2) + require.True(t, providerKeeper.IsOptedIn(ctx, "consumerId", optedInValidator1)) + require.True(t, providerKeeper.IsOptedIn(ctx, "consumerId", optedInValidator2)) + providerKeeper.DeleteAllOptedIn(ctx, "consumerId") + require.False(t, providerKeeper.IsOptedIn(ctx, "consumerId", optedInValidator1)) + require.False(t, providerKeeper.IsOptedIn(ctx, "consumerId", optedInValidator2)) } // TestConsumerCommissionRate tests the `SetConsumerCommissionRate`, `GetConsumerCommissionRate`, and `DeleteConsumerCommissionRate` methods @@ -461,31 +469,31 @@ func TestConsumerCommissionRate(t *testing.T) { providerAddr1 := types.NewProviderConsAddress([]byte("providerAddr1")) providerAddr2 := types.NewProviderConsAddress([]byte("providerAddr2")) - cr, found := providerKeeper.GetConsumerCommissionRate(ctx, "chainID", providerAddr1) + cr, found := providerKeeper.GetConsumerCommissionRate(ctx, "consumerId", providerAddr1) require.False(t, found) require.Equal(t, math.LegacyZeroDec(), cr) - providerKeeper.SetConsumerCommissionRate(ctx, "chainID", providerAddr1, math.LegacyOneDec()) - cr, found = providerKeeper.GetConsumerCommissionRate(ctx, "chainID", providerAddr1) + providerKeeper.SetConsumerCommissionRate(ctx, "consumerId", providerAddr1, math.LegacyOneDec()) + cr, found = providerKeeper.GetConsumerCommissionRate(ctx, "consumerId", providerAddr1) require.True(t, found) require.Equal(t, math.LegacyOneDec(), cr) - providerKeeper.SetConsumerCommissionRate(ctx, "chainID", providerAddr2, math.LegacyZeroDec()) - cr, found = providerKeeper.GetConsumerCommissionRate(ctx, "chainID", providerAddr2) + providerKeeper.SetConsumerCommissionRate(ctx, "consumerId", providerAddr2, math.LegacyZeroDec()) + cr, found = providerKeeper.GetConsumerCommissionRate(ctx, "consumerId", providerAddr2) require.True(t, found) require.Equal(t, math.LegacyZeroDec(), cr) - provAddrs := providerKeeper.GetAllCommissionRateValidators(ctx, "chainID") + provAddrs := providerKeeper.GetAllCommissionRateValidators(ctx, "consumerId") require.Len(t, provAddrs, 2) for _, addr := range provAddrs { - providerKeeper.DeleteConsumerCommissionRate(ctx, "chainID", addr) + providerKeeper.DeleteConsumerCommissionRate(ctx, "consumerId", addr) } - _, found = providerKeeper.GetConsumerCommissionRate(ctx, "chainID", providerAddr1) + _, found = providerKeeper.GetConsumerCommissionRate(ctx, "consumerId", providerAddr1) require.False(t, found) - _, found = providerKeeper.GetConsumerCommissionRate(ctx, "chainID", providerAddr2) + _, found = providerKeeper.GetConsumerCommissionRate(ctx, "consumerId", providerAddr2) require.False(t, found) } @@ -494,7 +502,7 @@ func TestAllowlist(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - chainID := "chainID" + chainID := "consumerId" // no validator was allowlisted and hence the allowlist is empty require.True(t, providerKeeper.IsAllowlistEmpty(ctx, chainID)) @@ -522,7 +530,7 @@ func TestDenylist(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - chainID := "chainID" + chainID := "consumerId" // no validator was denylisted and hence the denylist is empty require.True(t, providerKeeper.IsDenylistEmpty(ctx, chainID)) @@ -549,22 +557,25 @@ func TestDenylist(t *testing.T) { func TestAllowInactiveValidators(t *testing.T) { k, ctx, _, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - chainID := "chainID" + consumerId := "consumerId" // check that by default, AllowsInactiveValidators returns false - require.False(t, k.AllowsInactiveValidators(ctx, chainID)) + require.False(t, k.AllowsInactiveValidators(ctx, consumerId)) // set the chain to allow inactive validators - k.SetInactiveValidatorsAllowed(ctx, chainID, true) - + k.SetConsumerPowerShapingParameters(ctx, consumerId, types.PowerShapingParameters{ + AllowInactiveVals: true, + }) // check that AllowsInactiveValidators returns true - require.True(t, k.AllowsInactiveValidators(ctx, chainID)) + require.True(t, k.AllowsInactiveValidators(ctx, consumerId)) // set the chain to not allow inactive validators - k.SetInactiveValidatorsAllowed(ctx, chainID, false) + k.SetConsumerPowerShapingParameters(ctx, consumerId, types.PowerShapingParameters{ + AllowInactiveVals: false, + }) // check that AllowsInactiveValidators returns false - require.False(t, k.AllowsInactiveValidators(ctx, chainID)) + require.False(t, k.AllowsInactiveValidators(ctx, consumerId)) } // Tests setting, getting and deleting parameters that are stored per-consumer chain. @@ -579,49 +590,65 @@ func TestKeeperConsumerParams(t *testing.T) { tests := []struct { name string settingFunc func(sdk.Context, string, int64) - getFunc func(sdk.Context, string) (int64, bool) + getFunc func(sdk.Context, string) int64 deleteFunc func(sdk.Context, string) initialValue int64 updatedValue int64 }{ { - name: "Minimum Power In Top N", - settingFunc: func(ctx sdk.Context, id string, val int64) { k.SetMinimumPowerInTopN(ctx, id, val) }, - getFunc: func(ctx sdk.Context, id string) (int64, bool) { return k.GetMinimumPowerInTopN(ctx, id) }, + name: "Minimum Power In Top N", + settingFunc: func(ctx sdk.Context, id string, val int64) { k.SetMinimumPowerInTopN(ctx, id, val) }, + getFunc: func(ctx sdk.Context, id string) int64 { + minimumPowerInTopN, _ := k.GetMinimumPowerInTopN(ctx, id) + return minimumPowerInTopN + }, deleteFunc: func(ctx sdk.Context, id string) { k.DeleteMinimumPowerInTopN(ctx, id) }, initialValue: 1000, updatedValue: 2000, }, { - name: "Minimum Stake", - settingFunc: func(ctx sdk.Context, id string, val int64) { k.SetMinStake(ctx, id, uint64(val)) }, - getFunc: func(ctx sdk.Context, id string) (int64, bool) { - val, found := k.GetMinStake(ctx, id) - return int64(val), found + name: "Minimum Stake", + settingFunc: func(ctx sdk.Context, id string, val int64) { + k.SetConsumerPowerShapingParameters(ctx, id, + types.PowerShapingParameters{ + MinStake: uint64(val), + }) }, - deleteFunc: func(ctx sdk.Context, id string) { k.DeleteMinStake(ctx, id) }, + getFunc: func(ctx sdk.Context, id string) int64 { + return int64(k.GetMinStake(ctx, id)) + }, + deleteFunc: func(ctx sdk.Context, id string) { k.DeleteConsumerPowerShapingParameters(ctx, id) }, initialValue: 1000, updatedValue: 2000, }, { - name: "Validator Set Cap", - settingFunc: func(ctx sdk.Context, id string, val int64) { k.SetValidatorSetCap(ctx, id, uint32(val)) }, - getFunc: func(ctx sdk.Context, id string) (int64, bool) { - val, found := k.GetValidatorSetCap(ctx, id) - return int64(val), found + name: "Validator Set Cap", + settingFunc: func(ctx sdk.Context, id string, val int64) { + k.SetConsumerPowerShapingParameters(ctx, id, + types.PowerShapingParameters{ + ValidatorSetCap: uint32(val), + }) + }, + getFunc: func(ctx sdk.Context, id string) int64 { + return int64(k.GetValidatorSetCap(ctx, id)) }, - deleteFunc: func(ctx sdk.Context, id string) { k.DeleteValidatorSetCap(ctx, id) }, + deleteFunc: func(ctx sdk.Context, id string) { k.DeleteConsumerPowerShapingParameters(ctx, id) }, initialValue: 10, updatedValue: 200, }, { - name: "Validator Powers Cap", - settingFunc: func(ctx sdk.Context, id string, val int64) { k.SetValidatorsPowerCap(ctx, id, uint32(val)) }, - getFunc: func(ctx sdk.Context, id string) (int64, bool) { - val, found := k.GetValidatorsPowerCap(ctx, id) - return int64(val), found + name: "Validator Powers Cap", + settingFunc: func(ctx sdk.Context, id string, val int64) { + k.SetConsumerPowerShapingParameters(ctx, id, + types.PowerShapingParameters{ + ValidatorsPowerCap: uint32(val), + }) }, - deleteFunc: func(ctx sdk.Context, id string) { k.DeleteValidatorsPowerCap(ctx, id) }, + getFunc: func(ctx sdk.Context, id string) int64 { + val := k.GetValidatorsPowerCap(ctx, id) + return int64(val) + }, + deleteFunc: func(ctx sdk.Context, id string) { k.DeleteConsumerPowerShapingParameters(ctx, id) }, initialValue: 10, updatedValue: 11, }, @@ -629,40 +656,38 @@ func TestKeeperConsumerParams(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - chainID := "chainID" + chainID := "consumerId" // Set initial value tt.settingFunc(ctx, chainID, int64(tt.initialValue)) // Retrieve and check initial value - actualValue, found := tt.getFunc(ctx, chainID) - require.True(t, found) + actualValue := tt.getFunc(ctx, chainID) require.EqualValues(t, tt.initialValue, actualValue) // Update value tt.settingFunc(ctx, chainID, int64(tt.updatedValue)) // Retrieve and check updated value - newActualValue, found := tt.getFunc(ctx, chainID) - require.True(t, found) + newActualValue := tt.getFunc(ctx, chainID) require.EqualValues(t, tt.updatedValue, newActualValue) - // Check non-existent chain ID - _, found = tt.getFunc(ctx, "not the chainID") - require.False(t, found) + // Check non-existent consumer id + res := tt.getFunc(ctx, "not the consumerId") + require.Zero(t, res) // Delete value tt.deleteFunc(ctx, chainID) // Check that value was deleted - _, found = tt.getFunc(ctx, chainID) - require.False(t, found) + res = tt.getFunc(ctx, chainID) + require.Zero(t, res) // Try deleting again tt.deleteFunc(ctx, chainID) // Check that the value is still deleted - _, found = tt.getFunc(ctx, chainID) - require.False(t, found) + res = tt.getFunc(ctx, chainID) + require.Zero(t, res) }) } } diff --git a/x/ccv/provider/keeper/key_assignment.go b/x/ccv/provider/keeper/key_assignment.go index 23dd20109d..2e3846feb4 100644 --- a/x/ccv/provider/keeper/key_assignment.go +++ b/x/ccv/provider/keeper/key_assignment.go @@ -67,11 +67,11 @@ func (k Keeper) ParseConsumerKey(consumerKey string) (tmprotocrypto.PublicKey, e // GetValidatorConsumerPubKey returns a validator's public key assigned for a consumer chain func (k Keeper) GetValidatorConsumerPubKey( ctx sdk.Context, - chainID string, + consumerId string, providerAddr types.ProviderConsAddress, ) (consumerKey tmprotocrypto.PublicKey, found bool) { store := ctx.KVStore(k.storeKey) - bz := store.Get(types.ConsumerValidatorsKey(chainID, providerAddr)) + bz := store.Get(types.ConsumerValidatorsKey(consumerId, providerAddr)) if bz == nil { return consumerKey, false } @@ -87,7 +87,7 @@ func (k Keeper) GetValidatorConsumerPubKey( // SetValidatorConsumerPubKey sets a validator's public key assigned for a consumer chain func (k Keeper) SetValidatorConsumerPubKey( ctx sdk.Context, - chainID string, + consumerId string, providerAddr types.ProviderConsAddress, consumerKey tmprotocrypto.PublicKey, ) { @@ -98,33 +98,33 @@ func (k Keeper) SetValidatorConsumerPubKey( // the consumer key is obtained from GetValidatorConsumerPubKey, called from panic(fmt.Sprintf("failed to marshal consumer key: %v", err)) } - store.Set(types.ConsumerValidatorsKey(chainID, providerAddr), bz) + store.Set(types.ConsumerValidatorsKey(consumerId, providerAddr), bz) } // GetAllValidatorConsumerPubKeys gets all the validators public keys assigned for a consumer chain -// If chainID is nil, it returns all the validators public keys assigned for all consumer chains +// If consumerId is nil, it returns all the validators public keys assigned for all consumer chains // // Note that the validators public keys assigned for a consumer chain are stored under keys -// with the following format: ConsumerValidatorsBytePrefix | len(chainID) | chainID | providerAddress +// with the following format: ConsumerValidatorsBytePrefix | len(consumerId) | consumerId | providerAddress // Thus, the returned array is -// - in ascending order of providerAddresses, if chainID is not nil; -// - in undetermined order, if chainID is nil. -func (k Keeper) GetAllValidatorConsumerPubKeys(ctx sdk.Context, chainID *string) (validatorConsumerPubKeys []types.ValidatorConsumerPubKey) { +// - in ascending order of providerAddresses, if consumerId is not nil; +// - in undetermined order, if consumerId is nil. +func (k Keeper) GetAllValidatorConsumerPubKeys(ctx sdk.Context, consumerId *string) (validatorConsumerPubKeys []types.ValidatorConsumerPubKey) { store := ctx.KVStore(k.storeKey) var prefix []byte consumerValidatorsKeyPrefix := types.ConsumerValidatorsKeyPrefix() - if chainID == nil { + if consumerId == nil { // iterate over the validators public keys assigned for all consumer chains prefix = []byte{consumerValidatorsKeyPrefix} } else { - // iterate over the validators public keys assigned for chainID - prefix = types.ChainIdWithLenKey(consumerValidatorsKeyPrefix, *chainID) + // iterate over the validators public keys assigned for consumerId + prefix = types.ConsumerIdWithLenKey(consumerValidatorsKeyPrefix, *consumerId) } iterator := storetypes.KVStorePrefixIterator(store, prefix) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - // TODO: store chainID and provider cons address in value bytes, marshaled as protobuf type - chainID, providerAddrTmp, err := types.ParseChainIdAndConsAddrKey(consumerValidatorsKeyPrefix, iterator.Key()) + // TODO: store consumerId and provider cons address in value bytes, marshaled as protobuf type + consumerId, providerAddrTmp, err := types.ParseChainIdAndConsAddrKey(consumerValidatorsKeyPrefix, iterator.Key()) if err != nil { // An error here would indicate something is very wrong, // the store key is assumed to be correctly serialized in SetValidatorConsumerPubKey. @@ -140,7 +140,7 @@ func (k Keeper) GetAllValidatorConsumerPubKeys(ctx sdk.Context, chainID *string) } validatorConsumerPubKeys = append(validatorConsumerPubKeys, types.ValidatorConsumerPubKey{ - ChainId: chainID, + ChainId: consumerId, ProviderAddr: providerAddr.ToSdkConsAddr(), ConsumerKey: &consumerKey, }) @@ -150,20 +150,20 @@ func (k Keeper) GetAllValidatorConsumerPubKeys(ctx sdk.Context, chainID *string) } // DeleteValidatorConsumerPubKey deletes a validator's public key assigned for a consumer chain -func (k Keeper) DeleteValidatorConsumerPubKey(ctx sdk.Context, chainID string, providerAddr types.ProviderConsAddress) { +func (k Keeper) DeleteValidatorConsumerPubKey(ctx sdk.Context, consumerId string, providerAddr types.ProviderConsAddress) { store := ctx.KVStore(k.storeKey) - store.Delete(types.ConsumerValidatorsKey(chainID, providerAddr)) + store.Delete(types.ConsumerValidatorsKey(consumerId, providerAddr)) } // GetValidatorByConsumerAddr returns a validator's consensus address on the provider // given the validator's consensus address on a consumer func (k Keeper) GetValidatorByConsumerAddr( ctx sdk.Context, - chainID string, + consumerId string, consumerAddr types.ConsumerConsAddress, ) (providerAddr types.ProviderConsAddress, found bool) { store := ctx.KVStore(k.storeKey) - bz := store.Get(types.ValidatorsByConsumerAddrKey(chainID, consumerAddr)) + bz := store.Get(types.ValidatorsByConsumerAddrKey(consumerId, consumerAddr)) if bz == nil { return providerAddr, false } @@ -175,45 +175,45 @@ func (k Keeper) GetValidatorByConsumerAddr( // to the validator's consensus address on the provider func (k Keeper) SetValidatorByConsumerAddr( ctx sdk.Context, - chainID string, + consumerId string, consumerAddr types.ConsumerConsAddress, providerAddr types.ProviderConsAddress, ) { store := ctx.KVStore(k.storeKey) // Cons address is a type alias for a byte string, no marshaling needed bz := providerAddr.ToSdkConsAddr() - store.Set(types.ValidatorsByConsumerAddrKey(chainID, consumerAddr), bz) + store.Set(types.ValidatorsByConsumerAddrKey(consumerId, consumerAddr), bz) } // GetValidatorsByConsumerAddrs gets all the mappings from consensus addresses // on a given consumer chain to consensus addresses on the provider chain. -// If chainID is nil, it returns all the mappings from consensus addresses on all consumer chains. +// If consumerId is nil, it returns all the mappings from consensus addresses on all consumer chains. // // Note that the mappings for a consumer chain are stored under keys with the following format: -// ValidatorsByConsumerAddrKeyPrefix | len(chainID) | chainID | consumerAddress +// ValidatorsByConsumerAddrKeyPrefix | len(consumerId) | consumerId | consumerAddress // Thus, the returned array is -// - in ascending order of consumerAddresses, if chainID is not nil; -// - in undetermined order, if chainID is nil. -func (k Keeper) GetAllValidatorsByConsumerAddr(ctx sdk.Context, chainID *string) (validatorConsumerAddrs []types.ValidatorByConsumerAddr) { +// - in ascending order of consumerAddresses, if consumerId is not nil; +// - in undetermined order, if consumerId is nil. +func (k Keeper) GetAllValidatorsByConsumerAddr(ctx sdk.Context, consumerId *string) (validatorConsumerAddrs []types.ValidatorByConsumerAddr) { store := ctx.KVStore(k.storeKey) var prefix []byte validatorsByConsumerAddrKeyPrefix := types.ValidatorsByConsumerAddrKeyPrefix() - if chainID == nil { + if consumerId == nil { // iterate over the mappings from consensus addresses on all consumer chains prefix = []byte{validatorsByConsumerAddrKeyPrefix} } else { - // iterate over the mappings from consensus addresses on chainID - prefix = types.ChainIdWithLenKey(validatorsByConsumerAddrKeyPrefix, *chainID) + // iterate over the mappings from consensus addresses on consumerId + prefix = types.ConsumerIdWithLenKey(validatorsByConsumerAddrKeyPrefix, *consumerId) } iterator := storetypes.KVStorePrefixIterator(store, prefix) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - // TODO: store chainID and consumer cons address in value bytes, marshaled as protobuf type - chainID, consumerAddrTmp, err := types.ParseChainIdAndConsAddrKey(validatorsByConsumerAddrKeyPrefix, iterator.Key()) + // TODO: store consumerId and consumer cons address in value bytes, marshaled as protobuf type + consumerId, consumerAddrTmp, err := types.ParseChainIdAndConsAddrKey(validatorsByConsumerAddrKeyPrefix, iterator.Key()) if err != nil { // An error here would indicate something is very wrong, // store keys are assumed to be correctly serialized in SetValidatorByConsumerAddr. - panic(fmt.Sprintf("failed to parse chainID and consumer address: %v", err)) + panic(fmt.Sprintf("failed to parse consumerId and consumer address: %v", err)) } consumerAddr := types.NewConsumerConsAddress(consumerAddrTmp) providerAddr := types.NewProviderConsAddress(iterator.Value()) @@ -221,7 +221,7 @@ func (k Keeper) GetAllValidatorsByConsumerAddr(ctx sdk.Context, chainID *string) validatorConsumerAddrs = append(validatorConsumerAddrs, types.ValidatorByConsumerAddr{ ConsumerAddr: consumerAddr.ToSdkConsAddr(), ProviderAddr: providerAddr.ToSdkConsAddr(), - ChainId: chainID, + ChainId: consumerId, }) } @@ -230,9 +230,9 @@ func (k Keeper) GetAllValidatorsByConsumerAddr(ctx sdk.Context, chainID *string) // DeleteValidatorByConsumerAddr deletes the mapping from a validator's consensus address on a consumer // to the validator's consensus address on the provider -func (k Keeper) DeleteValidatorByConsumerAddr(ctx sdk.Context, chainID string, consumerAddr types.ConsumerConsAddress) { +func (k Keeper) DeleteValidatorByConsumerAddr(ctx sdk.Context, consumerId string, consumerAddr types.ConsumerConsAddress) { store := ctx.KVStore(k.storeKey) - store.Delete(types.ValidatorsByConsumerAddrKey(chainID, consumerAddr)) + store.Delete(types.ValidatorsByConsumerAddrKey(consumerId, consumerAddr)) } // AppendConsumerAddrsToPrune appends a consumer validator address to the list of consumer addresses @@ -245,12 +245,12 @@ func (k Keeper) DeleteValidatorByConsumerAddr(ctx sdk.Context, chainID string, c // - or there exists a timestamp in ConsumerAddrsToPrune s.t. cAddr in ConsumerAddrsToPrune(timestamp) func (k Keeper) AppendConsumerAddrsToPrune( ctx sdk.Context, - chainID string, + consumerId string, pruneTs time.Time, consumerAddr types.ConsumerConsAddress, ) { store := ctx.KVStore(k.storeKey) - storeKey := types.ConsumerAddrsToPruneV2Key(chainID, pruneTs) + storeKey := types.ConsumerAddrsToPruneV2Key(consumerId, pruneTs) bz := store.Get(storeKey) var consumerAddrsToPrune types.AddressList if bz != nil { @@ -275,12 +275,12 @@ func (k Keeper) AppendConsumerAddrsToPrune( // Note that this method is only used in testing. func (k Keeper) GetConsumerAddrsToPrune( ctx sdk.Context, - chainID string, + consumerId string, ts time.Time, ) (consumerAddrsToPrune types.AddressList) { store := ctx.KVStore(k.storeKey) - bz := store.Get(types.ConsumerAddrsToPruneV2Key(chainID, ts)) + bz := store.Get(types.ConsumerAddrsToPruneV2Key(consumerId, ts)) if bz == nil { return } @@ -297,28 +297,28 @@ func (k Keeper) GetConsumerAddrsToPrune( // The returned addresses are removed from the store. // // Note that the list of all consumer addresses is stored under keys with the following format: -// ConsumerAddrsToPruneV2BytePrefix | len(chainID) | chainID | timestamp +// ConsumerAddrsToPruneV2BytePrefix | len(consumerId) | consumerId | timestamp // Thus, this method returns all the consumer addresses stored under keys in the following range: -// (ConsumerAddrsToPruneV2BytePrefix | len(chainID) | chainID | ts') where ts' <= ts +// (ConsumerAddrsToPruneV2BytePrefix | len(consumerId) | consumerId | ts') where ts' <= ts func (k Keeper) ConsumeConsumerAddrsToPrune( ctx sdk.Context, - chainID string, + consumerId string, ts time.Time, ) (consumerAddrsToPrune types.AddressList) { store := ctx.KVStore(k.storeKey) consumerAddrsToPruneKeyPrefix := types.ConsumerAddrsToPruneV2KeyPrefix() - startPrefix := types.ChainIdWithLenKey(consumerAddrsToPruneKeyPrefix, chainID) + startPrefix := types.ConsumerIdWithLenKey(consumerAddrsToPruneKeyPrefix, consumerId) iterator := store.Iterator(startPrefix, - storetypes.InclusiveEndBytes(types.ConsumerAddrsToPruneV2Key(chainID, ts))) + storetypes.InclusiveEndBytes(types.ConsumerAddrsToPruneV2Key(consumerId, ts))) defer iterator.Close() var keysToDel [][]byte for ; iterator.Valid(); iterator.Next() { // Sanity check - if _, pruneTs, err := types.ParseChainIdAndTsKey(consumerAddrsToPruneKeyPrefix, iterator.Key()); err != nil { + if _, pruneTs, err := types.ParseConsumerIdAndTsKey(consumerAddrsToPruneKeyPrefix, iterator.Key()); err != nil { // An error here would indicate something is very wrong, // store keys are assumed to be correctly serialized in AppendConsumerAddrsToPrune. - k.Logger(ctx).Error("ParseChainIdAndTsKey failed", + k.Logger(ctx).Error("ParseConsumerIdAndTsKey failed", "key", string(iterator.Key()), "error", err.Error(), ) @@ -352,19 +352,19 @@ func (k Keeper) ConsumeConsumerAddrsToPrune( return } -// GetAllConsumerAddrsToPrune gets all consumer addresses that can be eventually pruned for a given chainID. +// GetAllConsumerAddrsToPrune gets all consumer addresses that can be eventually pruned for a given consumerId. // // Note that the list of all consumer addresses is stored under keys with the following format: -// ConsumerAddrsToPruneV2BytePrefix | len(chainID) | chainID | timestamp +// ConsumerAddrsToPruneV2BytePrefix | len(consumerId) | consumerId | timestamp // Thus, the returned array is in ascending order of timestamps. -func (k Keeper) GetAllConsumerAddrsToPrune(ctx sdk.Context, chainID string) (consumerAddrsToPrune []types.ConsumerAddrsToPruneV2) { +func (k Keeper) GetAllConsumerAddrsToPrune(ctx sdk.Context, consumerId string) (consumerAddrsToPrune []types.ConsumerAddrsToPruneV2) { store := ctx.KVStore(k.storeKey) consumerAddrsToPruneKeyPrefix := types.ConsumerAddrsToPruneV2KeyPrefix() - iteratorPrefix := types.ChainIdWithLenKey(consumerAddrsToPruneKeyPrefix, chainID) + iteratorPrefix := types.ConsumerIdWithLenKey(consumerAddrsToPruneKeyPrefix, consumerId) iterator := storetypes.KVStorePrefixIterator(store, iteratorPrefix) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - _, ts, err := types.ParseChainIdAndTsKey(consumerAddrsToPruneKeyPrefix, iterator.Key()) + _, ts, err := types.ParseConsumerIdAndTsKey(consumerAddrsToPruneKeyPrefix, iterator.Key()) if err != nil { // An error here would indicate something is very wrong, // store keys are assumed to be correctly serialized in AppendConsumerAddrsToPrune. @@ -381,7 +381,7 @@ func (k Keeper) GetAllConsumerAddrsToPrune(ctx sdk.Context, chainID string) (con consumerAddrsToPrune = append(consumerAddrsToPrune, types.ConsumerAddrsToPruneV2{ PruneTs: ts, ConsumerAddrs: &addrs, - ChainId: chainID, + ChainId: consumerId, }) } @@ -389,25 +389,25 @@ func (k Keeper) GetAllConsumerAddrsToPrune(ctx sdk.Context, chainID string) (con } // DeleteConsumerAddrsToPruneV2 deletes the list of consumer addresses mapped to a timestamp -func (k Keeper) DeleteConsumerAddrsToPrune(ctx sdk.Context, chainID string, pruneTs time.Time) { +func (k Keeper) DeleteConsumerAddrsToPrune(ctx sdk.Context, consumerId string, pruneTs time.Time) { store := ctx.KVStore(k.storeKey) - store.Delete(types.ConsumerAddrsToPruneV2Key(chainID, pruneTs)) + store.Delete(types.ConsumerAddrsToPruneV2Key(consumerId, pruneTs)) } // AssignConsumerKey assigns the consumerKey to the validator with providerAddr -// on the consumer chain with ID chainID, if it is either registered or currently +// on the consumer chain with the given `consumerId`, if it is either registered or currently // voted on in a ConsumerAddition governance proposal func (k Keeper) AssignConsumerKey( ctx sdk.Context, - chainID string, + consumerId string, validator stakingtypes.Validator, consumerKey tmprotocrypto.PublicKey, ) error { - // check that the consumer chain is either registered or that - // a ConsumerAdditionProposal was submitted. - if !k.IsConsumerProposedOrRegistered(ctx, chainID) { + phase, found := k.GetConsumerPhase(ctx, consumerId) + if !found || phase == Stopped { + //check that the consumer chain is either registered, initialized, or launched return errorsmod.Wrapf( - types.ErrUnknownConsumerChainId, chainID, + types.ErrUnknownConsumerId, consumerId, ) } @@ -433,7 +433,7 @@ func (k Keeper) AssignConsumerKey( } // We prevent a validator from assigning the default provider key as a consumer key // if it has not already assigned a different consumer key - _, found := k.GetValidatorConsumerPubKey(ctx, chainID, providerAddr) + _, found := k.GetValidatorConsumerPubKey(ctx, consumerId, providerAddr) if !found { return errorsmod.Wrapf( types.ErrCannotAssignDefaultKeyAssignment, @@ -442,7 +442,7 @@ func (k Keeper) AssignConsumerKey( } } - if _, found := k.GetValidatorByConsumerAddr(ctx, chainID, consumerAddr); found { + if _, found := k.GetValidatorByConsumerAddr(ctx, consumerId, consumerAddr); found { // This consumer key is already in use, or it is to be pruned. With this check we prevent another validator // from assigning the same consumer key as some other validator. Additionally, we prevent a validator from // reusing a consumer key that it used in the past and is now to be pruned. @@ -452,16 +452,15 @@ func (k Keeper) AssignConsumerKey( } // get the previous key assigned for this validator on this consumer chain - if oldConsumerKey, found := k.GetValidatorConsumerPubKey(ctx, chainID, providerAddr); found { + if oldConsumerKey, found := k.GetValidatorConsumerPubKey(ctx, consumerId, providerAddr); found { oldConsumerAddrTmp, err := ccvtypes.TMCryptoPublicKeyToConsAddr(oldConsumerKey) if err != nil { return err } oldConsumerAddr := types.NewConsumerConsAddress(oldConsumerAddrTmp) - // check whether the consumer chain is already registered, - // i.e., a client to the consumer was already created - if _, consumerRegistered := k.GetConsumerClientId(ctx, chainID); consumerRegistered { + // check whether the consumer chain has already launched (i.e., a client to the consumer was already created) + if phase == Launched { // mark the old consumer address as prunable once UnbondingPeriod elapses; // note: this state is removed on EndBlock unbondingPeriod, err := k.stakingKeeper.UnbondingTime(ctx) @@ -470,26 +469,26 @@ func (k Keeper) AssignConsumerKey( } k.AppendConsumerAddrsToPrune( ctx, - chainID, + consumerId, ctx.BlockTime().Add(unbondingPeriod), oldConsumerAddr, ) } else { // if the consumer chain is not registered, then remove the mapping // from the old consumer address to the provider address - k.DeleteValidatorByConsumerAddr(ctx, chainID, oldConsumerAddr) + k.DeleteValidatorByConsumerAddr(ctx, consumerId, oldConsumerAddr) } } // set the mapping from this validator's provider address to the new consumer key; // overwrite if already exists // note: this state is deleted when the validator is removed from the staking module - k.SetValidatorConsumerPubKey(ctx, chainID, providerAddr, consumerKey) + k.SetValidatorConsumerPubKey(ctx, consumerId, providerAddr, consumerKey) // set the mapping from this validator's new consensus address on the consumer // to its consensus address on the provider; // note: this state must be deleted through the pruning mechanism - k.SetValidatorByConsumerAddr(ctx, chainID, consumerAddr, providerAddr) + k.SetValidatorByConsumerAddr(ctx, consumerId, consumerAddr, providerAddr) return nil } @@ -498,11 +497,11 @@ func (k Keeper) AssignConsumerKey( // consAddr set as the consensus address on a consumer chain func (k Keeper) GetProviderAddrFromConsumerAddr( ctx sdk.Context, - chainID string, + consumerId string, consumerAddr types.ConsumerConsAddress, ) types.ProviderConsAddress { // check if this address is known only to the consumer chain - if providerConsAddr, found := k.GetValidatorByConsumerAddr(ctx, chainID, consumerAddr); found { + if providerConsAddr, found := k.GetValidatorByConsumerAddr(ctx, consumerId, consumerAddr); found { return providerConsAddr } // If mapping from consumer -> provider addr is not found, there is no assigned key, @@ -512,46 +511,46 @@ func (k Keeper) GetProviderAddrFromConsumerAddr( // PruneKeyAssignments prunes the consumer addresses no longer needed // as they cannot be referenced in slash requests (by a correct consumer) -func (k Keeper) PruneKeyAssignments(ctx sdk.Context, chainID string) { +func (k Keeper) PruneKeyAssignments(ctx sdk.Context, consumerId string) { now := ctx.BlockTime() - consumerAddrs := k.ConsumeConsumerAddrsToPrune(ctx, chainID, now) + consumerAddrs := k.ConsumeConsumerAddrsToPrune(ctx, consumerId, now) for _, addrBz := range consumerAddrs.Addresses { consumerAddr := types.NewConsumerConsAddress(addrBz) - k.DeleteValidatorByConsumerAddr(ctx, chainID, consumerAddr) + k.DeleteValidatorByConsumerAddr(ctx, consumerId, consumerAddr) k.Logger(ctx).Info("consumer address was pruned", - "consumer chainID", chainID, + "consumer consumerId", consumerId, "consumer consensus addr", consumerAddr.String(), ) } } // DeleteKeyAssignments deletes all the state needed for key assignments on a consumer chain -func (k Keeper) DeleteKeyAssignments(ctx sdk.Context, chainID string) { +func (k Keeper) DeleteKeyAssignments(ctx sdk.Context, consumerId string) { // delete ValidatorConsumerPubKey - for _, validatorConsumerAddr := range k.GetAllValidatorConsumerPubKeys(ctx, &chainID) { + for _, validatorConsumerAddr := range k.GetAllValidatorConsumerPubKeys(ctx, &consumerId) { providerAddr := types.NewProviderConsAddress(validatorConsumerAddr.ProviderAddr) - k.DeleteValidatorConsumerPubKey(ctx, chainID, providerAddr) + k.DeleteValidatorConsumerPubKey(ctx, consumerId, providerAddr) } // delete ValidatorsByConsumerAddr - for _, validatorConsumerAddr := range k.GetAllValidatorsByConsumerAddr(ctx, &chainID) { + for _, validatorConsumerAddr := range k.GetAllValidatorsByConsumerAddr(ctx, &consumerId) { consumerAddr := types.NewConsumerConsAddress(validatorConsumerAddr.ConsumerAddr) - k.DeleteValidatorByConsumerAddr(ctx, chainID, consumerAddr) + k.DeleteValidatorByConsumerAddr(ctx, consumerId, consumerAddr) } // delete ValidatorConsumerPubKey - for _, consumerAddrsToPrune := range k.GetAllConsumerAddrsToPrune(ctx, chainID) { - k.DeleteConsumerAddrsToPrune(ctx, chainID, consumerAddrsToPrune.PruneTs) + for _, consumerAddrsToPrune := range k.GetAllConsumerAddrsToPrune(ctx, consumerId) { + k.DeleteConsumerAddrsToPrune(ctx, consumerId, consumerAddrsToPrune.PruneTs) } } // IsConsumerProposedOrRegistered checks if a consumer chain is either registered, meaning either already running // or will run soon, or proposed its ConsumerAdditionProposal was submitted but the chain was not yet added to ICS yet. -func (k Keeper) IsConsumerProposedOrRegistered(ctx sdk.Context, chainID string) bool { - allConsumerChains := k.GetAllRegisteredAndProposedChainIDs(ctx) +func (k Keeper) IsConsumerProposedOrRegistered(ctx sdk.Context, consumerId string) bool { + allConsumerChains := k.GetAllActiveConsumerIds(ctx) for _, c := range allConsumerChains { - if c == chainID { + if c == consumerId { return true } } @@ -578,8 +577,8 @@ func (k Keeper) ValidatorConsensusKeyInUse(ctx sdk.Context, valAddr sdk.ValAddre panic("could not get validator cons addr ") } - allConsumerChains := k.GetAllRegisteredAndProposedChainIDs(ctx) - for _, c := range allConsumerChains { + allConsumerIds := k.GetAllActiveConsumerIds(ctx) + for _, c := range allConsumerIds { if _, exist := k.GetValidatorByConsumerAddr(ctx, c, types.NewConsumerConsAddress(consensusAddr), diff --git a/x/ccv/provider/keeper/key_assignment_test.go b/x/ccv/provider/keeper/key_assignment_test.go index 7dbec09f40..290b8a6048 100644 --- a/x/ccv/provider/keeper/key_assignment_test.go +++ b/x/ccv/provider/keeper/key_assignment_test.go @@ -24,7 +24,7 @@ import ( ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" ) -const ChainID = "chainID" +const ChainID = "consumerId" func TestValidatorConsumerPubKeyCRUD(t *testing.T) { chainID := consumer @@ -69,7 +69,7 @@ func TestGetAllValidatorConsumerPubKey(t *testing.T) { }, ) } - // select a chainID with more than two assignments + // select a consumerId with more than two assignments var chainID string for i := range chainIDs { chainID = chainIDs[i] @@ -149,7 +149,7 @@ func TestGetAllValidatorsByConsumerAddr(t *testing.T) { }, ) } - // select a chainID with more than two assignments + // select a consumerId with more than two assignments var chainID string for i := range chainIDs { chainID = chainIDs[i] @@ -261,7 +261,7 @@ func TestGetAllConsumerAddrsToPrune(t *testing.T) { }, ) } - // select a chainID with more than two assignments + // select a consumerId with more than two assignments var chainID string for i := range chainIDs { chainID = chainIDs[i] @@ -342,7 +342,7 @@ func checkCorrectPruningProperty(ctx sdk.Context, k providerkeeper.Keeper, chain } func TestAssignConsensusKeyForConsumerChain(t *testing.T) { - chainID := ChainID + consumerId := "0" providerIdentities := []*cryptotestutil.CryptoIdentity{ cryptotestutil.NewCryptoIdentityFromIntSeed(0), cryptotestutil.NewCryptoIdentityFromIntSeed(1), @@ -359,26 +359,26 @@ func TestAssignConsensusKeyForConsumerChain(t *testing.T) { doActions func(sdk.Context, providerkeeper.Keeper) }{ /* - 0. Consumer not registered: Assign PK0->CK0 and error - 1. Consumer registered: Assign PK0->CK0 and retrieve PK0->CK0 - 2. Consumer registered: Assign PK0->CK0, PK0->CK1 and retrieve PK0->CK1 - 3. Consumer registered: Assign PK0->CK0, PK1->CK0 and error - 4. Consumer registered: Assign PK1->PK0 and error - 5. Consumer proposed: Assign Assign PK0->CK0 and retrieve PK0->CK0 - 6. Consumer proposed: Assign PK0->CK0, PK0->CK1 and retrieve PK0->CK1 - 7. Consumer proposed: Assign PK0->CK0, PK1->CK0 and error - 8. Consumer proposed: Assign PK1->PK0 and error + 0. Consumer not in the right phase: Assign PK0->CK0 and error + 1. Consumer launched: Assign PK0->CK0 and retrieve PK0->CK0 + 2. Consumer launched: Assign PK0->CK0, PK0->CK1 and retrieve PK0->CK1 + 3. Consumer launched: Assign PK0->CK0, PK1->CK0 and error + 4. Consumer launched: Assign PK1->PK0 and error + 5. Consumer registered: Assign PK0->CK0 and retrieve PK0->CK0 + 6. Consumer registered: Assign PK0->CK0, PK0->CK1 and retrieve PK0->CK1 + 7. Consumer registered: Assign PK0->CK0, PK1->CK0 and error + 8. Consumer registered: Assign PK1->PK0 and error */ { name: "0", mockSetup: func(ctx sdk.Context, k providerkeeper.Keeper, mocks testkeeper.MockedKeepers) {}, doActions: func(ctx sdk.Context, k providerkeeper.Keeper) { - err := k.AssignConsumerKey(ctx, chainID, + err := k.AssignConsumerKey(ctx, consumerId, providerIdentities[0].SDKStakingValidator(), consumerIdentities[0].TMProtoCryptoPublicKey(), ) require.Error(t, err) - _, found := k.GetValidatorByConsumerAddr(ctx, chainID, + _, found := k.GetValidatorByConsumerAddr(ctx, consumerId, consumerIdentities[0].ConsumerConsAddress()) require.False(t, found) }, @@ -393,13 +393,13 @@ func TestAssignConsensusKeyForConsumerChain(t *testing.T) { ) }, doActions: func(ctx sdk.Context, k providerkeeper.Keeper) { - k.SetConsumerClientId(ctx, chainID, "") - err := k.AssignConsumerKey(ctx, chainID, + k.SetConsumerPhase(ctx, consumerId, providerkeeper.Launched) + err := k.AssignConsumerKey(ctx, consumerId, providerIdentities[0].SDKStakingValidator(), consumerIdentities[0].TMProtoCryptoPublicKey(), ) require.NoError(t, err) - providerAddr, found := k.GetValidatorByConsumerAddr(ctx, chainID, + providerAddr, found := k.GetValidatorByConsumerAddr(ctx, consumerId, consumerIdentities[0].ConsumerConsAddress()) require.True(t, found) require.Equal(t, providerIdentities[0].ProviderConsAddress(), providerAddr) @@ -420,18 +420,18 @@ func TestAssignConsensusKeyForConsumerChain(t *testing.T) { ) }, doActions: func(sdkCtx sdk.Context, k providerkeeper.Keeper) { - k.SetConsumerClientId(sdkCtx, chainID, "") - err := k.AssignConsumerKey(sdkCtx, chainID, + k.SetConsumerPhase(sdkCtx, consumerId, providerkeeper.Launched) + err := k.AssignConsumerKey(sdkCtx, consumerId, providerIdentities[0].SDKStakingValidator(), consumerIdentities[0].TMProtoCryptoPublicKey(), ) require.NoError(t, err) - err = k.AssignConsumerKey(sdkCtx, chainID, + err = k.AssignConsumerKey(sdkCtx, consumerId, providerIdentities[0].SDKStakingValidator(), consumerIdentities[1].TMProtoCryptoPublicKey(), ) require.NoError(t, err) - providerAddr, found := k.GetValidatorByConsumerAddr(sdkCtx, chainID, + providerAddr, found := k.GetValidatorByConsumerAddr(sdkCtx, consumerId, consumerIdentities[1].ConsumerConsAddress()) require.True(t, found) require.Equal(t, providerIdentities[0].ProviderConsAddress(), providerAddr) @@ -450,18 +450,18 @@ func TestAssignConsensusKeyForConsumerChain(t *testing.T) { ) }, doActions: func(ctx sdk.Context, k providerkeeper.Keeper) { - k.SetConsumerClientId(ctx, chainID, "") - err := k.AssignConsumerKey(ctx, chainID, + k.SetConsumerPhase(ctx, consumerId, providerkeeper.Launched) + err := k.AssignConsumerKey(ctx, consumerId, providerIdentities[0].SDKStakingValidator(), consumerIdentities[0].TMProtoCryptoPublicKey(), ) require.NoError(t, err) - err = k.AssignConsumerKey(ctx, chainID, + err = k.AssignConsumerKey(ctx, consumerId, providerIdentities[1].SDKStakingValidator(), consumerIdentities[0].TMProtoCryptoPublicKey(), ) require.Error(t, err) - providerAddr, found := k.GetValidatorByConsumerAddr(ctx, chainID, + providerAddr, found := k.GetValidatorByConsumerAddr(ctx, consumerId, consumerIdentities[0].ConsumerConsAddress()) require.True(t, found) require.Equal(t, providerIdentities[0].ProviderConsAddress(), providerAddr) @@ -477,8 +477,8 @@ func TestAssignConsensusKeyForConsumerChain(t *testing.T) { ) }, doActions: func(ctx sdk.Context, k providerkeeper.Keeper) { - k.SetConsumerClientId(ctx, chainID, "") - err := k.AssignConsumerKey(ctx, chainID, + k.SetConsumerPhase(ctx, consumerId, providerkeeper.Launched) + err := k.AssignConsumerKey(ctx, consumerId, providerIdentities[1].SDKStakingValidator(), providerIdentities[0].TMProtoCryptoPublicKey(), ) @@ -495,13 +495,13 @@ func TestAssignConsensusKeyForConsumerChain(t *testing.T) { ) }, doActions: func(ctx sdk.Context, k providerkeeper.Keeper) { - k.SetProposedConsumerChain(ctx, chainID, 0) - err := k.AssignConsumerKey(ctx, chainID, + k.SetConsumerPhase(ctx, consumerId, providerkeeper.Initialized) + err := k.AssignConsumerKey(ctx, consumerId, providerIdentities[0].SDKStakingValidator(), consumerIdentities[0].TMProtoCryptoPublicKey(), ) require.NoError(t, err) - providerAddr, found := k.GetValidatorByConsumerAddr(ctx, chainID, + providerAddr, found := k.GetValidatorByConsumerAddr(ctx, consumerId, consumerIdentities[0].ConsumerConsAddress()) require.True(t, found) require.Equal(t, providerIdentities[0].ProviderConsAddress(), providerAddr) @@ -520,18 +520,18 @@ func TestAssignConsensusKeyForConsumerChain(t *testing.T) { ) }, doActions: func(ctx sdk.Context, k providerkeeper.Keeper) { - k.SetProposedConsumerChain(ctx, chainID, 0) - err := k.AssignConsumerKey(ctx, chainID, + k.SetConsumerPhase(ctx, consumerId, providerkeeper.Initialized) + err := k.AssignConsumerKey(ctx, consumerId, providerIdentities[0].SDKStakingValidator(), consumerIdentities[0].TMProtoCryptoPublicKey(), ) require.NoError(t, err) - err = k.AssignConsumerKey(ctx, chainID, + err = k.AssignConsumerKey(ctx, consumerId, providerIdentities[0].SDKStakingValidator(), consumerIdentities[1].TMProtoCryptoPublicKey(), ) require.NoError(t, err) - providerAddr, found := k.GetValidatorByConsumerAddr(ctx, chainID, + providerAddr, found := k.GetValidatorByConsumerAddr(ctx, consumerId, consumerIdentities[1].ConsumerConsAddress()) require.True(t, found) require.Equal(t, providerIdentities[0].ProviderConsAddress(), providerAddr) @@ -550,18 +550,18 @@ func TestAssignConsensusKeyForConsumerChain(t *testing.T) { ) }, doActions: func(ctx sdk.Context, k providerkeeper.Keeper) { - k.SetProposedConsumerChain(ctx, chainID, 0) - err := k.AssignConsumerKey(ctx, chainID, + k.SetConsumerPhase(ctx, consumerId, providerkeeper.Initialized) + err := k.AssignConsumerKey(ctx, consumerId, providerIdentities[0].SDKStakingValidator(), consumerIdentities[0].TMProtoCryptoPublicKey(), ) require.NoError(t, err) - err = k.AssignConsumerKey(ctx, chainID, + err = k.AssignConsumerKey(ctx, consumerId, providerIdentities[1].SDKStakingValidator(), consumerIdentities[0].TMProtoCryptoPublicKey(), ) require.Error(t, err) - providerAddr, found := k.GetValidatorByConsumerAddr(ctx, chainID, + providerAddr, found := k.GetValidatorByConsumerAddr(ctx, consumerId, consumerIdentities[0].ConsumerConsAddress()) require.True(t, found) require.Equal(t, providerIdentities[0].ProviderConsAddress(), providerAddr) @@ -577,8 +577,8 @@ func TestAssignConsensusKeyForConsumerChain(t *testing.T) { ) }, doActions: func(ctx sdk.Context, k providerkeeper.Keeper) { - k.SetProposedConsumerChain(ctx, chainID, 0) - err := k.AssignConsumerKey(ctx, chainID, + k.SetConsumerPhase(ctx, consumerId, providerkeeper.Initialized) + err := k.AssignConsumerKey(ctx, consumerId, providerIdentities[1].SDKStakingValidator(), providerIdentities[0].TMProtoCryptoPublicKey(), ) @@ -593,7 +593,7 @@ func TestAssignConsensusKeyForConsumerChain(t *testing.T) { tc.mockSetup(ctx, k, mocks) tc.doActions(ctx, k) - require.True(t, checkCorrectPruningProperty(ctx, k, chainID)) + require.True(t, checkCorrectPruningProperty(ctx, k, consumerId)) ctrl.Finish() }) @@ -613,9 +613,7 @@ func TestCannotReassignDefaultKeyAssignment(t *testing.T) { providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - providerKeeper.SetPendingConsumerAdditionProp(ctx, &types.ConsumerAdditionProposal{ - ChainId: "chain", - }) + providerKeeper.SetConsumerPhase(ctx, "consumerId", providerkeeper.Initialized) // Mock that the validator is validating with the single key, as confirmed by provider's staking keeper gomock.InOrder( @@ -625,7 +623,7 @@ func TestCannotReassignDefaultKeyAssignment(t *testing.T) { ) // AssignConsumerKey should return an error if we try to re-assign the already existing default key assignment - err := providerKeeper.AssignConsumerKey(ctx, "chain", cId.SDKStakingValidator(), cId.TMProtoCryptoPublicKey()) + err := providerKeeper.AssignConsumerKey(ctx, "consumerId", cId.SDKStakingValidator(), cId.TMProtoCryptoPublicKey()) require.Error(t, err) // Confirm we're not returning an error for some other reason diff --git a/x/ccv/provider/keeper/legacy_proposal.go b/x/ccv/provider/keeper/legacy_proposal.go index d14773e5ed..074b611e47 100644 --- a/x/ccv/provider/keeper/legacy_proposal.go +++ b/x/ccv/provider/keeper/legacy_proposal.go @@ -1,7 +1,6 @@ package keeper import ( - errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" @@ -35,30 +34,6 @@ func (k Keeper) HandleLegacyConsumerRewardDenomProposal(ctx sdk.Context, p *type return nil } -// HandleConsumerAdditionProposal will receive the consumer chain's client state from the proposal. -// If the client can be successfully created in a cached context, it stores the proposal as a pending proposal. -// -// Note: This method implements SpawnConsumerChainProposalHandler in spec. -// See: https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/methods.md#ccv-pcf-hcaprop1 -// Spec tag: [CCV-PCF-HCAPROP.1] -func (k Keeper) HandleLegacyConsumerAdditionProposal(ctx sdk.Context, p *types.ConsumerAdditionProposal) error { - // verify the consumer addition proposal execution - // in cached context and discard the cached writes - if _, _, err := k.CreateConsumerClientInCachedCtx(ctx, *p); err != nil { - return err - } - - k.SetPendingConsumerAdditionProp(ctx, p) - - k.Logger(ctx).Info("consumer addition proposal enqueued", - "chainID", p.ChainId, - "title", p.Title, - "spawn time", p.SpawnTime.UTC(), - ) - - return nil -} - // HandleConsumerRemovalProposal stops a consumer chain and released the outstanding unbonding operations. // If the consumer can be successfully stopped in a cached context, it stores the proposal as a pending proposal. // @@ -75,70 +50,10 @@ func (k Keeper) HandleLegacyConsumerRemovalProposal(ctx sdk.Context, p *types.Co k.SetPendingConsumerRemovalProp(ctx, p) k.Logger(ctx).Info("consumer removal proposal enqueued", - "chainID", p.ChainId, + "chain id", p.ChainId, "title", p.Title, "stop time", p.StopTime.UTC(), ) return nil } - -// HandleConsumerModificationProposal modifies a running consumer chain -func (k Keeper) HandleLegacyConsumerModificationProposal(ctx sdk.Context, p *types.ConsumerModificationProposal) error { - if _, found := k.GetConsumerClientId(ctx, p.ChainId); !found { - return errorsmod.Wrapf(types.ErrInvalidConsumerChainID, "consumer %s chain is not running", p.ChainId) - } - - k.SetTopN(ctx, p.ChainId, p.Top_N) - k.SetValidatorsPowerCap(ctx, p.ChainId, p.ValidatorsPowerCap) - k.SetValidatorSetCap(ctx, p.ChainId, p.ValidatorSetCap) - k.SetMinStake(ctx, p.ChainId, p.MinStake) - k.SetInactiveValidatorsAllowed(ctx, p.ChainId, p.AllowInactiveVals) - - k.DeleteAllowlist(ctx, p.ChainId) - for _, address := range p.Allowlist { - consAddr, err := sdk.ConsAddressFromBech32(address) - if err != nil { - continue - } - - k.SetAllowlist(ctx, p.ChainId, types.NewProviderConsAddress(consAddr)) - } - - k.DeleteDenylist(ctx, p.ChainId) - for _, address := range p.Denylist { - consAddr, err := sdk.ConsAddressFromBech32(address) - if err != nil { - continue - } - - k.SetDenylist(ctx, p.ChainId, types.NewProviderConsAddress(consAddr)) - } - - oldTopN, found := k.GetTopN(ctx, p.ChainId) - if !found { - oldTopN = 0 - k.Logger(ctx).Info("consumer chain top N not found, treating as 0", "chainID", p.ChainId) - } - - // if the top N changes, we need to update the new minimum power in top N - if p.Top_N != oldTopN { - if p.Top_N > 0 { - // if the chain receives a non-zero top N value, store the minimum power in the top N - activeValidators, err := k.GetLastProviderConsensusActiveValidators(ctx) - if err != nil { - return err - } - minPower, err := k.ComputeMinPowerInTopN(ctx, activeValidators, p.Top_N) - if err != nil { - return err - } - k.SetMinimumPowerInTopN(ctx, p.ChainId, minPower) - } else { - // if the chain receives a zero top N value, we delete the min power - k.DeleteMinimumPowerInTopN(ctx, p.ChainId) - } - } - - return nil -} diff --git a/x/ccv/provider/keeper/legacy_proposal_test.go b/x/ccv/provider/keeper/legacy_proposal_test.go index 23c2c6a948..7f8a08d90b 100644 --- a/x/ccv/provider/keeper/legacy_proposal_test.go +++ b/x/ccv/provider/keeper/legacy_proposal_test.go @@ -4,13 +4,10 @@ import ( "testing" "time" - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" sdk "github.com/cosmos/cosmos-sdk/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - testkeeper "github.com/cosmos/interchain-security/v5/testutil/keeper" providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" @@ -20,124 +17,6 @@ import ( // Initialization sub-protocol related tests of proposal.go // -// Tests the HandleConsumerAdditionProposal method against the SpawnConsumerChainProposalHandler spec. -// See: https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/methods.md#ccv-pcf-hcaprop1 -// Spec tag: [CCV-PCF-HCAPROP.1] -func TestHandleLegacyConsumerAdditionProposal(t *testing.T) { - type testCase struct { - description string - malleate func(ctx sdk.Context, k providerkeeper.Keeper, chainID string) - prop *providertypes.ConsumerAdditionProposal - // Time when prop is handled - blockTime time.Time - // Whether it's expected that the proposal is successfully verified - // and appended to the pending proposals - expAppendProp bool - } - - // Snapshot times asserted in tests - now := time.Now().UTC() - - tests := []testCase{ - { - description: "expect to append valid proposal", - malleate: func(ctx sdk.Context, k providerkeeper.Keeper, chainID string) {}, - prop: providertypes.NewConsumerAdditionProposal( - "title", - "description", - "chainID", - clienttypes.NewHeight(2, 3), - []byte("gen_hash"), - []byte("bin_hash"), - now, // Spawn time - "0.75", - 10, - "", - 10000, - 100000000000, - 100000000000, - 100000000000, - 0, - 0, - 0, - nil, - nil, - 0, - false, - ).(*providertypes.ConsumerAdditionProposal), - blockTime: now, - expAppendProp: true, - }, - { - description: "expect to not append invalid proposal using an already existing chain id", - malleate: func(ctx sdk.Context, k providerkeeper.Keeper, chainID string) { - k.SetConsumerClientId(ctx, chainID, "anyClientId") - }, - - prop: providertypes.NewConsumerAdditionProposal( - "title", - "description", - "chainID", - clienttypes.NewHeight(2, 3), - []byte("gen_hash"), - []byte("bin_hash"), - now, - "0.75", - 10, - "", - 10000, - 100000000000, - 100000000000, - 100000000000, - 0, - 0, - 0, - nil, - nil, - 0, - false, - ).(*providertypes.ConsumerAdditionProposal), - blockTime: now, - expAppendProp: false, - }, - } - - for _, tc := range tests { - // Common setup - keeperParams := testkeeper.NewInMemKeeperParams(t) - providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, keeperParams) - providerKeeper.SetParams(ctx, providertypes.DefaultParams()) - ctx = ctx.WithBlockTime(tc.blockTime) - - if tc.expAppendProp { - // Mock calls are only asserted if we expect a client to be created. - testkeeper.SetupMocksForLastBondedValidatorsExpectation(mocks.MockStakingKeeper, 1, []stakingtypes.Validator{}, 1) - gomock.InOrder( - testkeeper.GetMocksForCreateConsumerClient(ctx, &mocks, tc.prop.ChainId, clienttypes.NewHeight(2, 3))..., - ) - } - - tc.malleate(ctx, providerKeeper, tc.prop.ChainId) - - err := providerKeeper.HandleLegacyConsumerAdditionProposal(ctx, tc.prop) - - if tc.expAppendProp { - require.NoError(t, err) - // check that prop was added to the stored pending props - gotProposal, found := providerKeeper.GetPendingConsumerAdditionProp(ctx, tc.prop.SpawnTime, tc.prop.ChainId) - require.True(t, found) - require.Equal(t, *tc.prop, gotProposal) - } else { - require.Error(t, err) - // check that prop wasn't added to the stored pending props - _, found := providerKeeper.GetPendingConsumerAdditionProp(ctx, tc.prop.SpawnTime, tc.prop.ChainId) - require.False(t, found) - } - - ctrl.Finish() - } -} - // TestHandleConsumerRemovalProposal tests HandleConsumerRemovalProposal against its corresponding spec method. // // See: https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/methods.md#ccv-pcf-hcrprop1 @@ -155,7 +34,7 @@ func TestHandleLegacyConsumerRemovalProposal(t *testing.T) { // and appended to the pending proposals expAppendProp bool - // chainID of the consumer chain + // consumerId of the consumer chain // tests need to check that the CCV channel is not closed prematurely chainId string } @@ -174,12 +53,12 @@ func TestHandleLegacyConsumerRemovalProposal(t *testing.T) { prop: providertypes.NewConsumerRemovalProposal( "title", "description", - "chainID", + "consumerId", now, ).(*providertypes.ConsumerRemovalProposal), blockTime: hourAfterNow, // After stop time. expAppendProp: true, - chainId: "chainID", + chainId: "consumerId", }, { description: "valid proposal - stop_time in the past", @@ -189,12 +68,12 @@ func TestHandleLegacyConsumerRemovalProposal(t *testing.T) { prop: providertypes.NewConsumerRemovalProposal( "title", "description", - "chainID", + "consumerId", hourBeforeNow, ).(*providertypes.ConsumerRemovalProposal), blockTime: hourAfterNow, // After stop time. expAppendProp: true, - chainId: "chainID", + chainId: "consumerId", }, { description: "valid proposal - before stop_time in the future", @@ -204,12 +83,12 @@ func TestHandleLegacyConsumerRemovalProposal(t *testing.T) { prop: providertypes.NewConsumerRemovalProposal( "title", "description", - "chainID", + "consumerId", hourAfterNow, ).(*providertypes.ConsumerRemovalProposal), blockTime: now, expAppendProp: true, - chainId: "chainID", + chainId: "consumerId", }, { description: "rejected valid proposal - consumer chain does not exist", @@ -217,12 +96,12 @@ func TestHandleLegacyConsumerRemovalProposal(t *testing.T) { prop: providertypes.NewConsumerRemovalProposal( "title", "description", - "chainID-2", + "consumerId-2", hourAfterNow, ).(*providertypes.ConsumerRemovalProposal), blockTime: hourAfterNow, // After stop time. expAppendProp: false, - chainId: "chainID-2", + chainId: "consumerId-2", }, } @@ -238,7 +117,7 @@ func TestHandleLegacyConsumerRemovalProposal(t *testing.T) { // Note: when expAppendProp is false, no mocks are setup, // meaning no external keeper methods are allowed to be called. if tc.expAppendProp { - testkeeper.SetupForStoppingConsumerChain(t, ctx, &providerKeeper, mocks) + testkeeper.SetupForStoppingConsumerChain(t, ctx, &providerKeeper, mocks, tc.prop.ChainId) // Valid client creation is asserted with mock expectations here gomock.InOrder(testkeeper.GetMocksForStopConsumerChainWithCloseChannel(ctx, &mocks)...) } @@ -255,7 +134,7 @@ func TestHandleLegacyConsumerRemovalProposal(t *testing.T) { require.True(t, found) // confirm that the channel was not closed - _, found = providerKeeper.GetChainToChannel(ctx, tc.chainId) + _, found = providerKeeper.GetConsumerIdToChannelId(ctx, tc.chainId) require.True(t, found) } else { require.Error(t, err) @@ -269,66 +148,3 @@ func TestHandleLegacyConsumerRemovalProposal(t *testing.T) { ctrl.Finish() } } - -func TestHandleConsumerModificationProposal(t *testing.T) { - providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - defer ctrl.Finish() - - chainID := "chainID" - - // set up a consumer client, so it seems that "chainID" is running - providerKeeper.SetConsumerClientId(ctx, "chainID", "clientID") - - // set PSS-related fields to update them later on - providerKeeper.SetTopN(ctx, chainID, 50) - providerKeeper.SetValidatorSetCap(ctx, chainID, 10) - providerKeeper.SetValidatorsPowerCap(ctx, chainID, 34) - providerKeeper.SetAllowlist(ctx, chainID, providertypes.NewProviderConsAddress([]byte("allowlistedAddr1"))) - providerKeeper.SetAllowlist(ctx, chainID, providertypes.NewProviderConsAddress([]byte("allowlistedAddr2"))) - providerKeeper.SetDenylist(ctx, chainID, providertypes.NewProviderConsAddress([]byte("denylistedAddr1"))) - providerKeeper.SetMinStake(ctx, chainID, 1000) - providerKeeper.SetInactiveValidatorsAllowed(ctx, chainID, true) - - expectedTopN := uint32(75) - expectedValidatorsPowerCap := uint32(67) - expectedValidatorSetCap := uint32(20) - expectedAllowlistedValidator := "cosmosvalcons1wpex7anfv3jhystyv3eq20r35a" - expectedDenylistedValidator := "cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39" - expectedMinStake := uint64(0) - expectedAllowInactiveValidators := false - proposal := providertypes.NewConsumerModificationProposal("title", "description", chainID, - expectedTopN, - expectedValidatorsPowerCap, - expectedValidatorSetCap, - []string{expectedAllowlistedValidator}, - []string{expectedDenylistedValidator}, - expectedMinStake, - expectedAllowInactiveValidators, - ).(*providertypes.ConsumerModificationProposal) - - err := providerKeeper.HandleLegacyConsumerModificationProposal(ctx, proposal) - require.NoError(t, err) - - actualTopN, _ := providerKeeper.GetTopN(ctx, chainID) - require.Equal(t, expectedTopN, actualTopN) - actualValidatorsPowerCap, _ := providerKeeper.GetValidatorsPowerCap(ctx, chainID) - require.Equal(t, expectedValidatorsPowerCap, actualValidatorsPowerCap) - actualValidatorSetCap, _ := providerKeeper.GetValidatorSetCap(ctx, chainID) - require.Equal(t, expectedValidatorSetCap, actualValidatorSetCap) - - allowlistedValidator, err := sdk.ConsAddressFromBech32(expectedAllowlistedValidator) - require.NoError(t, err) - require.Equal(t, 1, len(providerKeeper.GetAllowList(ctx, chainID))) - require.Equal(t, providertypes.NewProviderConsAddress(allowlistedValidator), providerKeeper.GetAllowList(ctx, chainID)[0]) - - denylistedValidator, err := sdk.ConsAddressFromBech32(expectedDenylistedValidator) - require.NoError(t, err) - require.Equal(t, 1, len(providerKeeper.GetDenyList(ctx, chainID))) - require.Equal(t, providertypes.NewProviderConsAddress(denylistedValidator), providerKeeper.GetDenyList(ctx, chainID)[0]) - - actualMinStake, _ := providerKeeper.GetMinStake(ctx, chainID) - require.Equal(t, expectedMinStake, actualMinStake) - - actualAllowInactiveValidators := providerKeeper.AllowsInactiveValidators(ctx, chainID) - require.Equal(t, expectedAllowInactiveValidators, actualAllowInactiveValidators) -} diff --git a/x/ccv/provider/keeper/msg_server.go b/x/ccv/provider/keeper/msg_server.go index da6f63cf8a..9550b7d620 100644 --- a/x/ccv/provider/keeper/msg_server.go +++ b/x/ccv/provider/keeper/msg_server.go @@ -2,18 +2,17 @@ package keeper import ( "context" - errorsmod "cosmossdk.io/errors" - + "fmt" + tmtypes "github.com/cometbft/cometbft/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - - tmtypes "github.com/cometbft/cometbft/types" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + "strings" + "time" ) type msgServer struct { @@ -67,11 +66,11 @@ func (k msgServer) AssignConsumerKey(goCtx context.Context, msg *types.MsgAssign return nil, err } - if err := k.Keeper.AssignConsumerKey(ctx, msg.ChainId, validator, consumerTMPublicKey); err != nil { + if err := k.Keeper.AssignConsumerKey(ctx, msg.ConsumerId, validator, consumerTMPublicKey); err != nil { return nil, err } k.Logger(ctx).Info("assigned consumer key", - "consumer chainID", msg.ChainId, + "consumer id", msg.ConsumerId, "validator operator addr", msg.ProviderAddr, "consumer public key", msg.ConsumerKey, ) @@ -87,36 +86,33 @@ func (k msgServer) AssignConsumerKey(goCtx context.Context, msg *types.MsgAssign return &types.MsgAssignConsumerKeyResponse{}, nil } -// ConsumerAddition defines an RPC handler method for MsgConsumerAddition -func (k msgServer) ConsumerAddition(goCtx context.Context, msg *types.MsgConsumerAddition) (*types.MsgConsumerAdditionResponse, error) { +// RemoveConsumer defines an RPC handler method for MsgRemoveConsumer +func (k msgServer) RemoveConsumer( + goCtx context.Context, + msg *types.MsgRemoveConsumer) (*types.MsgRemoveConsumerResponse, error) { if k.GetAuthority() != msg.Authority { return nil, errorsmod.Wrapf(types.ErrUnauthorized, "expected %s, got %s", k.GetAuthority(), msg.Authority) } ctx := sdk.UnwrapSDKContext(goCtx) - err := k.Keeper.HandleConsumerAdditionProposal(ctx, msg) - if err != nil { - return nil, errorsmod.Wrapf(err, "failed handling ConsumerAddition proposal") - } - return &types.MsgConsumerAdditionResponse{}, nil -} -// ConsumerRemoval defines an RPC handler method for MsgConsumerRemoval -func (k msgServer) ConsumerRemoval( - goCtx context.Context, - msg *types.MsgConsumerRemoval, -) (*types.MsgConsumerRemovalResponse, error) { - if k.GetAuthority() != msg.Authority { - return nil, errorsmod.Wrapf(types.ErrUnauthorized, "expected %s, got %s", k.GetAuthority(), msg.Authority) + consumerId := msg.ConsumerId + + phase, found := k.Keeper.GetConsumerPhase(ctx, consumerId) + if !found || phase != Launched { + return nil, errorsmod.Wrapf(types.ErrInvalidPhase, + "chain with consumer id: %s has to be in its launched phase", consumerId) } - ctx := sdk.UnwrapSDKContext(goCtx) - err := k.Keeper.HandleConsumerRemovalProposal(ctx, msg) - if err != nil { - return nil, errorsmod.Wrapf(err, "failed handling ConsumerAddition proposal") + previousStopTime, err := k.Keeper.GetConsumerStopTime(ctx, consumerId) + if err == nil { + k.Keeper.RemoveConsumerFromToBeStoppedConsumers(ctx, consumerId, previousStopTime) } - return &types.MsgConsumerRemovalResponse{}, nil + k.Keeper.SetConsumerStopTime(ctx, consumerId, msg.StopTime) + k.Keeper.AppendStopTimeForConsumerToBeStopped(ctx, consumerId, msg.StopTime) + + return &types.MsgRemoveConsumerResponse{}, nil } // ChangeRewardDenoms defines a rpc handler method for MsgChangeRewardDenoms @@ -136,7 +132,7 @@ func (k msgServer) ChangeRewardDenoms(goCtx context.Context, msg *types.MsgChang func (k msgServer) SubmitConsumerMisbehaviour(goCtx context.Context, msg *types.MsgSubmitConsumerMisbehaviour) (*types.MsgSubmitConsumerMisbehaviourResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - if err := k.Keeper.HandleConsumerMisbehaviour(ctx, *msg.Misbehaviour); err != nil { + if err := k.Keeper.HandleConsumerMisbehaviour(ctx, msg.ConsumerId, *msg.Misbehaviour); err != nil { return nil, err } @@ -185,9 +181,9 @@ func (k msgServer) SubmitConsumerDoubleVoting(goCtx context.Context, msg *types. return nil, err } - // handle the double voting evidence using the chain ID of the infraction block header - // and the malicious validator's public key - if err := k.Keeper.HandleConsumerDoubleVoting(ctx, evidence, msg.InfractionBlockHeader.Header.ChainID, pubkey); err != nil { + // handle the double voting evidence using the malicious validator's public key + consumerId := msg.ConsumerId + if err := k.Keeper.HandleConsumerDoubleVoting(ctx, consumerId, evidence, pubkey); err != nil { return nil, err } @@ -223,7 +219,7 @@ func (k msgServer) OptIn(goCtx context.Context, msg *types.MsgOptIn) (*types.Msg } providerConsAddr := types.NewProviderConsAddress(consAddrTmp) - err = k.Keeper.HandleOptIn(ctx, msg.ChainId, providerConsAddr, msg.ConsumerKey) + err = k.Keeper.HandleOptIn(ctx, msg.ConsumerId, providerConsAddr, msg.ConsumerKey) if err != nil { return nil, err } @@ -259,7 +255,7 @@ func (k msgServer) OptOut(goCtx context.Context, msg *types.MsgOptOut) (*types.M } providerConsAddr := types.NewProviderConsAddress(consAddrTmp) - err = k.Keeper.HandleOptOut(ctx, msg.ChainId, providerConsAddr) + err = k.Keeper.HandleOptOut(ctx, msg.ConsumerId, providerConsAddr) if err != nil { return nil, err } @@ -293,14 +289,14 @@ func (k msgServer) SetConsumerCommissionRate(goCtx context.Context, msg *types.M return nil, err } - if err := k.HandleSetConsumerCommissionRate(ctx, msg.ChainId, types.NewProviderConsAddress(consAddr), msg.Rate); err != nil { + if err := k.HandleSetConsumerCommissionRate(ctx, msg.ConsumerId, types.NewProviderConsAddress(consAddr), msg.Rate); err != nil { return nil, err } ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeSetConsumerCommissionRate, - sdk.NewAttribute(types.AttributeConsumerChainID, msg.ChainId), + sdk.NewAttribute(types.AttributeConsumerId, msg.ConsumerId), sdk.NewAttribute(types.AttributeProviderValidatorAddress, msg.ProviderAddr), sdk.NewAttribute(types.AttributeConsumerCommissionRate, msg.Rate.String()), ), @@ -309,16 +305,158 @@ func (k msgServer) SetConsumerCommissionRate(goCtx context.Context, msg *types.M return &types.MsgSetConsumerCommissionRateResponse{}, nil } -func (k msgServer) ConsumerModification(goCtx context.Context, msg *types.MsgConsumerModification) (*types.MsgConsumerModificationResponse, error) { - if k.GetAuthority() != msg.Authority { - return nil, errorsmod.Wrapf(types.ErrUnauthorized, "expected %s, got %s", k.GetAuthority(), msg.Authority) +// CreateConsumer creates a consumer chain +func (k msgServer) CreateConsumer(goCtx context.Context, msg *types.MsgCreateConsumer) (*types.MsgCreateConsumerResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + consumerId := k.FetchAndIncrementConsumerId(ctx) + + k.SetConsumerOwnerAddress(ctx, consumerId, msg.Signer) + k.SetConsumerChainId(ctx, consumerId, msg.ChainId) + k.SetConsumerPhase(ctx, consumerId, Registered) + + if err := k.SetConsumerMetadata(ctx, consumerId, msg.Metadata); err != nil { + return &types.MsgCreateConsumerResponse{}, errorsmod.Wrapf(types.ErrInvalidConsumerMetadata, + "cannot set consumer metadata: %s", err.Error()) + } + + // initialization parameters are optional and hence could be nil + if msg.InitializationParameters != nil { + if err := k.SetConsumerInitializationParameters(ctx, consumerId, *msg.InitializationParameters); err != nil { + return &types.MsgCreateConsumerResponse{}, errorsmod.Wrapf(types.ErrInvalidConsumerInitializationParameters, + "cannot set consumer initialization parameters: %s", err.Error()) + } } + // power-shaping parameters are optional and hence could be null + if msg.PowerShapingParameters != nil { + if msg.PowerShapingParameters.Top_N != 0 { + return &types.MsgCreateConsumerResponse{}, errorsmod.Wrap(types.ErrCannotCreateTopNChain, + "cannot create a Top N chain using the `MsgCreateConsumer` message; use `MsgUpdateConsumer` instead") + } + if err := k.SetConsumerPowerShapingParameters(ctx, consumerId, *msg.PowerShapingParameters); err != nil { + return &types.MsgCreateConsumerResponse{}, errorsmod.Wrapf(types.ErrInvalidPowerShapingParameters, + "cannot set power shaping parameters") + } + } + + if spawnTime, canLaunch := k.CanLaunch(ctx, consumerId); canLaunch { + k.SetConsumerPhase(ctx, consumerId, Initialized) + k.PrepareConsumerForLaunch(ctx, consumerId, time.Time{}, spawnTime) + } + + return &types.MsgCreateConsumerResponse{ConsumerId: consumerId}, nil +} + +// UpdateConsumer updates the record of a consumer chain +func (k msgServer) UpdateConsumer(goCtx context.Context, msg *types.MsgUpdateConsumer) (*types.MsgUpdateConsumerResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - err := k.Keeper.HandleConsumerModificationProposal(ctx, msg) + consumerId := msg.ConsumerId + + phase, found := k.GetConsumerPhase(ctx, consumerId) + if found && phase == Stopped { + return &types.MsgUpdateConsumerResponse{}, errorsmod.Wrapf(types.ErrInvalidPhase, + "cannot update consumer chain that is in the stopped phase: %s", consumerId) + } + + // The new owner address can be empty, in which case the consumer chain does not change its owner. + // However, if the new owner address is not empty, we verify that it's a valid account address. + if strings.TrimSpace(msg.NewOwnerAddress) != "" { + if _, err := k.accountKeeper.AddressCodec().StringToBytes(msg.NewOwnerAddress); err != nil { + return &types.MsgUpdateConsumerResponse{}, errorsmod.Wrapf(types.ErrInvalidNewOwnerAddress, "invalid new owner address %s", msg.NewOwnerAddress) + } + } + + ownerAddress, err := k.Keeper.GetConsumerOwnerAddress(ctx, consumerId) if err != nil { - return nil, errorsmod.Wrapf(err, "failed handling ConsumerModification proposal") + return &types.MsgUpdateConsumerResponse{}, errorsmod.Wrapf(types.ErrNoOwnerAddress, "cannot retrieve owner address %s", ownerAddress) + } + + if msg.Signer != ownerAddress { + return &types.MsgUpdateConsumerResponse{}, errorsmod.Wrapf(types.ErrUnauthorized, "expected owner address %s, got %s", ownerAddress, msg.Signer) + } + + if strings.TrimSpace(msg.NewOwnerAddress) != "" { + k.Keeper.SetConsumerOwnerAddress(ctx, consumerId, msg.NewOwnerAddress) + } + + if msg.Metadata != nil { + if err := k.SetConsumerMetadata(ctx, consumerId, *msg.Metadata); err != nil { + return &types.MsgUpdateConsumerResponse{}, errorsmod.Wrapf(types.ErrInvalidConsumerMetadata, + "cannot set consumer metadata: %s", err.Error()) + } + } + + // get the previous spawn time so that we can use it in `PrepareConsumerForLaunch` + var previousSpawnTime time.Time + if previousInitializationParameters, err := k.Keeper.GetConsumerInitializationParameters(ctx, msg.ConsumerId); err != nil { + previousSpawnTime = previousInitializationParameters.SpawnTime + } + + if msg.InitializationParameters != nil { + if err = k.Keeper.SetConsumerInitializationParameters(ctx, msg.ConsumerId, *msg.InitializationParameters); err != nil { + return &types.MsgUpdateConsumerResponse{}, errorsmod.Wrapf(types.ErrInvalidConsumerInitializationParameters, + "cannot set consumer initialization parameters: %s", err.Error()) + } + } + + if msg.PowerShapingParameters != nil { + // A consumer chain can only become a Top N chain if the owner is the gov module. Because of this, to create a + // Top N chain, we need two `MsgUpdateConsumer` messages: i) one that would set the `ownerAddress` to the gov module + // and ii) one that would set the `Top_N` to something greater than 0. + if msg.PowerShapingParameters.Top_N > 0 && ownerAddress != k.GetAuthority() { + return &types.MsgUpdateConsumerResponse{}, errorsmod.Wrapf(types.ErrInvalidTransformToTopN, + "an update to a Top N chain can only be done if chain is owner is the gov module") + } + + oldTopN := k.Keeper.GetTopN(ctx, consumerId) + if err = k.SetConsumerPowerShapingParameters(ctx, consumerId, *msg.PowerShapingParameters); err != nil { + return &types.MsgUpdateConsumerResponse{}, errorsmod.Wrapf(types.ErrInvalidPowerShapingParameters, + "cannot set power shaping parameters") + } + + k.Keeper.UpdateAllowlist(ctx, consumerId, msg.PowerShapingParameters.Allowlist) + k.Keeper.UpdateDenylist(ctx, consumerId, msg.PowerShapingParameters.Denylist) + err = k.Keeper.UpdateMinimumPowerInTopN(ctx, consumerId, oldTopN, msg.PowerShapingParameters.Top_N) + if err != nil { + return &types.MsgUpdateConsumerResponse{}, errorsmod.Wrapf(types.ErrCannotUpdateMinimumPowerInTopN, + "could not update minimum power in top N, oldTopN: %d, newTopN: %d, error: %s", oldTopN, msg.PowerShapingParameters.Top_N, err.Error()) + } } - return &types.MsgConsumerModificationResponse{}, nil + // A Top N cannot change its owner address to something different from the gov module if the chain + // remains a Top N chain. + currentOwnerAddress, err := k.GetConsumerOwnerAddress(ctx, consumerId) + if err != nil { + return &types.MsgUpdateConsumerResponse{}, errorsmod.Wrapf(types.ErrNoOwnerAddress, "cannot retrieve owner address %s: %s", ownerAddress, err.Error()) + } + + currentPowerShapingParameters, err := k.GetConsumerPowerShapingParameters(ctx, consumerId) + if err != nil { + return &types.MsgUpdateConsumerResponse{}, errorsmod.Wrapf(types.ErrInvalidPowerShapingParameters, "cannot retrieve power shaping parameters: %s", err.Error()) + } + + if currentPowerShapingParameters.Top_N != 0 && currentOwnerAddress != k.GetAuthority() { + return &types.MsgUpdateConsumerResponse{}, errorsmod.Wrapf(types.ErrInvalidTransformToOptIn, + "a move to a new owner address that is not the gov module can only be done if `Top N` is set to 0") + } + + if spawnTime, canLaunch := k.CanLaunch(ctx, consumerId); canLaunch { + k.SetConsumerPhase(ctx, consumerId, Initialized) + k.PrepareConsumerForLaunch(ctx, consumerId, previousSpawnTime, spawnTime) + } + + return &types.MsgUpdateConsumerResponse{}, nil +} + +func (k msgServer) ConsumerAddition(_ context.Context, _ *types.MsgConsumerAddition) (*types.MsgConsumerAdditionResponse, error) { + return nil, fmt.Errorf("`MsgConsumerAddition` is deprecated. Use `MsgCreateConsumer`") +} + +func (k msgServer) ConsumerModification(_ context.Context, _ *types.MsgConsumerModification) (*types.MsgConsumerModificationResponse, error) { + return nil, fmt.Errorf("`MsgConsumerModification` is deprecated. Use `MsgUpdateConsumer` instead") +} + +func (k msgServer) ConsumerRemoval(_ context.Context, _ *types.MsgConsumerRemoval) (*types.MsgConsumerRemovalResponse, error) { + return nil, fmt.Errorf("`MsgConsumerRemoval` is deprecated. Use `MsgRemoveConsumer` instead") } diff --git a/x/ccv/provider/keeper/msg_server_test.go b/x/ccv/provider/keeper/msg_server_test.go new file mode 100644 index 0000000000..9dcf3942fe --- /dev/null +++ b/x/ccv/provider/keeper/msg_server_test.go @@ -0,0 +1,55 @@ +package keeper_test + +import ( + testkeeper "github.com/cosmos/interchain-security/v5/testutil/keeper" + providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" + providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + "github.com/stretchr/testify/require" + "testing" +) + +func TestCreateConsumer(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + msgServer := providerkeeper.NewMsgServerImpl(&providerKeeper) + + consumerMetadata := providertypes.ConsumerMetadata{ + Name: "chain name", + Description: "description", + } + response, err := msgServer.CreateConsumer(ctx, + &providertypes.MsgCreateConsumer{Signer: "signer", ChainId: "chainId", Metadata: consumerMetadata, + InitializationParameters: &providertypes.ConsumerInitializationParameters{}, + PowerShapingParameters: &providertypes.PowerShapingParameters{}}) + require.NoError(t, err) + require.Equal(t, "0", response.ConsumerId) + actualMetadata, err := providerKeeper.GetConsumerMetadata(ctx, "0") + require.NoError(t, err) + require.Equal(t, consumerMetadata, actualMetadata) + ownerAddress, err := providerKeeper.GetConsumerOwnerAddress(ctx, "0") + require.Equal(t, "signer", ownerAddress) + phase, found := providerKeeper.GetConsumerPhase(ctx, "0") + require.True(t, found) + require.Equal(t, providerkeeper.Registered, phase) + + consumerMetadata = providertypes.ConsumerMetadata{ + Name: "chain name", + Description: "description2", + } + response, err = msgServer.CreateConsumer(ctx, + &providertypes.MsgCreateConsumer{Signer: "signer2", ChainId: "chainId", Metadata: consumerMetadata, + InitializationParameters: &providertypes.ConsumerInitializationParameters{}, + PowerShapingParameters: &providertypes.PowerShapingParameters{}}) + require.NoError(t, err) + // assert that the consumer id is different from the previously registered chain + require.Equal(t, "1", response.ConsumerId) + actualMetadata, err = providerKeeper.GetConsumerMetadata(ctx, "1") + require.NoError(t, err) + require.Equal(t, consumerMetadata, actualMetadata) + ownerAddress, err = providerKeeper.GetConsumerOwnerAddress(ctx, "1") + require.Equal(t, "signer2", ownerAddress) + phase, found = providerKeeper.GetConsumerPhase(ctx, "1") + require.True(t, found) + require.Equal(t, providerkeeper.Registered, phase) +} diff --git a/x/ccv/provider/keeper/partial_set_security.go b/x/ccv/provider/keeper/partial_set_security.go index 3112124724..305f0f358b 100644 --- a/x/ccv/provider/keeper/partial_set_security.go +++ b/x/ccv/provider/keeper/partial_set_security.go @@ -13,16 +13,35 @@ import ( "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" ) -// HandleOptIn prepares validator `providerAddr` to opt in to `chainID` with an optional `consumerKey` consumer public key. +// HandleOptIn prepares validator `providerAddr` to opt in to `consumerId` with an optional `consumerKey` consumer public key. // Note that the validator only opts in at the end of an epoch. -func (k Keeper) HandleOptIn(ctx sdk.Context, chainID string, providerAddr types.ProviderConsAddress, consumerKey string) error { - if !k.IsConsumerProposedOrRegistered(ctx, chainID) { +func (k Keeper) HandleOptIn(ctx sdk.Context, consumerId string, providerAddr types.ProviderConsAddress, consumerKey string) error { + phase, found := k.GetConsumerPhase(ctx, consumerId) + if !found || phase == Stopped { return errorsmod.Wrapf( - types.ErrUnknownConsumerChainId, - "opting in to an unknown consumer chain, with id: %s", chainID) + types.ErrInvalidPhase, + "opting in to an unknown (or stopped) consumer chain, with id: %s", consumerId) } - k.SetOptedIn(ctx, chainID, providerAddr) + chainId, err := k.GetConsumerChainId(ctx, consumerId) + if err != nil { + // TODO (PERMISSIONLESS): fix error types + return errorsmod.Wrapf( + types.ErrUnknownConsumerId, + "opting in to an unknown consumer chain, with id (%s): %s", consumerId, err.Error()) + } + optedInToConsumerId, found := k.IsValidatorOptedInToChainId(ctx, providerAddr, chainId) + if found { + return errorsmod.Wrapf(types.ErrAlreadyOptedIn, + "validator is already opted in to a chain (%s) with this chain id (%s)", + optedInToConsumerId, chainId) + } + + k.SetOptedIn(ctx, consumerId, providerAddr) + err = k.AppendOptedInConsumerId(ctx, providerAddr, consumerId) + if err != nil { + return err + } if consumerKey != "" { consumerTMPublicKey, err := k.ParseConsumerKey(consumerKey) @@ -35,7 +54,7 @@ func (k Keeper) HandleOptIn(ctx sdk.Context, chainID string, providerAddr types. return err } - err = k.AssignConsumerKey(ctx, chainID, validator, consumerTMPublicKey) + err = k.AssignConsumerKey(ctx, consumerId, validator, consumerTMPublicKey) if err != nil { return err } @@ -44,18 +63,18 @@ func (k Keeper) HandleOptIn(ctx sdk.Context, chainID string, providerAddr types. return nil } -// HandleOptOut prepares validator `providerAddr` to opt out from running `chainID`. +// HandleOptOut prepares validator `providerAddr` to opt out from running `consumerId`. // Note that the validator only opts out at the end of an epoch. -func (k Keeper) HandleOptOut(ctx sdk.Context, chainID string, providerAddr types.ProviderConsAddress) error { - if _, found := k.GetConsumerClientId(ctx, chainID); !found { +func (k Keeper) HandleOptOut(ctx sdk.Context, consumerId string, providerAddr types.ProviderConsAddress) error { + if _, found := k.GetConsumerClientId(ctx, consumerId); !found { // A validator can only opt out from a running chain. We check this by checking the consumer client id, because // `SetConsumerClientId` is set when the chain starts in `CreateConsumerClientInCachedCtx` of `BeginBlockInit`. return errorsmod.Wrapf( - types.ErrUnknownConsumerChainId, - "opting out of an unknown or not running consumer chain, with id: %s", chainID) + types.ErrUnknownConsumerId, + "opting out of an unknown or not running consumer chain, with id: %s", consumerId) } - if topN, found := k.GetTopN(ctx, chainID); found && topN > 0 { + if topN := k.GetTopN(ctx, consumerId); topN > 0 { // a validator cannot opt out from a Top N chain if the validator is in the Top N validators validator, err := k.stakingKeeper.GetValidatorByConsAddr(ctx, providerAddr.ToSdkConsAddr()) if err != nil { @@ -69,27 +88,27 @@ func (k Keeper) HandleOptOut(ctx sdk.Context, chainID string, providerAddr types if err != nil { return err } - minPowerInTopN, found := k.GetMinimumPowerInTopN(ctx, chainID) + minPowerInTopN, found := k.GetMinimumPowerInTopN(ctx, consumerId) if !found { return errorsmod.Wrapf( - types.ErrUnknownConsumerChainId, - "Could not find minimum power in top N for chain with id: %s", chainID) + types.ErrUnknownConsumerId, + "Could not find minimum power in top N for chain with consumer id: %s", consumerId) } if power >= minPowerInTopN { return errorsmod.Wrapf( types.ErrCannotOptOutFromTopN, - "validator with power (%d) cannot opt out from Top N chain (%s) because all validators"+ - " with at least %d power have to validate", power, chainID, minPowerInTopN) + "validator with power (%d) cannot opt out from Top N chain with consumer id (%s) because all validators"+ + " with at least %d power have to validate", power, consumerId, minPowerInTopN) } } - k.DeleteOptedIn(ctx, chainID, providerAddr) - return nil + k.DeleteOptedIn(ctx, consumerId, providerAddr) + return k.RemoveOptedInConsumerId(ctx, providerAddr, consumerId) } -// OptInTopNValidators opts in to `chainID` all the `bondedValidators` that have at least `minPowerToOptIn` power -func (k Keeper) OptInTopNValidators(ctx sdk.Context, chainID string, bondedValidators []stakingtypes.Validator, minPowerToOptIn int64) { +// OptInTopNValidators opts in to `consumerId` all the `bondedValidators` that have at least `minPowerToOptIn` power +func (k Keeper) OptInTopNValidators(ctx sdk.Context, consumerId string, bondedValidators []stakingtypes.Validator, minPowerToOptIn int64) { for _, val := range bondedValidators { // log the validator k.Logger(ctx).Debug("Checking whether to opt in validator because of top N", "validator", val.GetOperator()) @@ -117,8 +136,9 @@ func (k Keeper) OptInTopNValidators(ctx sdk.Context, chainID string, bondedValid k.Logger(ctx).Debug("Opting in validator", "validator", val.GetOperator()) // if validator already exists it gets overwritten - k.SetOptedIn(ctx, chainID, types.NewProviderConsAddress(consAddr)) - } + k.SetOptedIn(ctx, consumerId, types.NewProviderConsAddress(consAddr)) + k.SetOptedIn(ctx, consumerId, types.NewProviderConsAddress(consAddr)) + } // else validators that do not belong to the top N validators but were opted in, remain opted in } } @@ -168,15 +188,15 @@ func (k Keeper) ComputeMinPowerInTopN(ctx sdk.Context, bondedValidators []stakin return 0, fmt.Errorf("should never reach this point with topN (%d), totalPower (%d), and powerSum (%d)", topN, totalPower, powerSum) } -// CapValidatorSet caps the provided `validators` if chain `chainID` is an Opt In chain with a validator-set cap. If cap -// is `k`, `CapValidatorSet` returns the first `k` validators from `validators` with the highest power. -func (k Keeper) CapValidatorSet(ctx sdk.Context, chainID string, validators []types.ConsensusValidator) []types.ConsensusValidator { - if topN, found := k.GetTopN(ctx, chainID); found && topN > 0 { +// CapValidatorSet caps the provided `validators` if chain with `consumerId` is an Opt In chain with a validator-set cap. +// If cap is `k`, `CapValidatorSet` returns the first `k` validators from `validators` with the highest power. +func (k Keeper) CapValidatorSet(ctx sdk.Context, consumerId string, validators []types.ConsensusValidator) []types.ConsensusValidator { + if k.GetTopN(ctx, consumerId) > 0 { // is a no-op if the chain is a Top N chain return validators } - if validatorSetCap, found := k.GetValidatorSetCap(ctx, chainID); found && validatorSetCap != 0 && int(validatorSetCap) < len(validators) { + if validatorSetCap := k.GetValidatorSetCap(ctx, consumerId); validatorSetCap != 0 && int(validatorSetCap) < len(validators) { sort.Slice(validators, func(i, j int) bool { return validators[i].Power > validators[j].Power }) @@ -187,15 +207,15 @@ func (k Keeper) CapValidatorSet(ctx sdk.Context, chainID string, validators []ty } } -// CapValidatorsPower caps the power of the validators on chain `chainID` and returns an updated slice of validators +// CapValidatorsPower caps the power of the validators on chain with `consumerId` and returns an updated slice of validators // with their new powers. Works on a best-basis effort because there are cases where we cannot guarantee that all validators // on the consumer chain have less power than the set validators-power cap. For example, if we have 10 validators and // the power cap is set to 5%, we need at least one validator to have more than 10% of the voting power on the consumer chain. -func (k Keeper) CapValidatorsPower(ctx sdk.Context, chainID string, validators []types.ConsensusValidator) []types.ConsensusValidator { - if p, found := k.GetValidatorsPowerCap(ctx, chainID); found && p > 0 { +func (k Keeper) CapValidatorsPower(ctx sdk.Context, consumerId string, validators []types.ConsensusValidator) []types.ConsensusValidator { + if p := k.GetValidatorsPowerCap(ctx, consumerId); p > 0 { return NoMoreThanPercentOfTheSum(validators, p) } else { - // is a no-op if power cap is not set for `chainID` + // is a no-op if power cap is not set for `consumerId` return validators } } @@ -300,24 +320,24 @@ func NoMoreThanPercentOfTheSum(validators []types.ConsensusValidator, percent ui return updatedValidators } -// CanValidateChain returns true if the validator `providerAddr` is opted-in to chain `chainID` and the allowlist and -// denylist do not prevent the validator from validating the chain. -func (k Keeper) CanValidateChain(ctx sdk.Context, chainID string, providerAddr types.ProviderConsAddress) bool { +// CanValidateChain returns true if the validator `providerAddr` is opted-in to chain with `consumerId` and the allowlist +// and denylist do not prevent the validator from validating the chain. +func (k Keeper) CanValidateChain(ctx sdk.Context, consumerId string, providerAddr types.ProviderConsAddress) bool { // only consider opted-in validators - return k.IsOptedIn(ctx, chainID, providerAddr) && + return k.IsOptedIn(ctx, consumerId, providerAddr) && // if an allowlist is declared, only consider allowlisted validators - (k.IsAllowlistEmpty(ctx, chainID) || - k.IsAllowlisted(ctx, chainID, providerAddr)) && + (k.IsAllowlistEmpty(ctx, consumerId) || + k.IsAllowlisted(ctx, consumerId, providerAddr)) && // if a denylist is declared, only consider denylisted validators - (k.IsDenylistEmpty(ctx, chainID) || - !k.IsDenylisted(ctx, chainID, providerAddr)) + (k.IsDenylistEmpty(ctx, consumerId) || + !k.IsDenylisted(ctx, consumerId, providerAddr)) } -// FulfillsMinStake returns true if the validator `providerAddr` has enough stake to validate chain `chainID` +// FulfillsMinStake returns true if the validator `providerAddr` has enough stake to validate chain with `consumerId` // by checking its staked tokens against the minimum stake required to validate the chain. -func (k Keeper) FulfillsMinStake(ctx sdk.Context, chainID string, providerAddr types.ProviderConsAddress) bool { - minStake, found := k.GetMinStake(ctx, chainID) - if !found { +func (k Keeper) FulfillsMinStake(ctx sdk.Context, consumerId string, providerAddr types.ProviderConsAddress) bool { + minStake := k.GetMinStake(ctx, consumerId) + if minStake == 0 { return true } @@ -332,7 +352,7 @@ func (k Keeper) FulfillsMinStake(ctx sdk.Context, chainID string, providerAddr t } // ComputeNextValidators computes the validators for the upcoming epoch based on the currently `bondedValidators`. -func (k Keeper) ComputeNextValidators(ctx sdk.Context, chainID string, bondedValidators []stakingtypes.Validator) []types.ConsensusValidator { +func (k Keeper) ComputeNextValidators(ctx sdk.Context, consumerId string, bondedValidators []stakingtypes.Validator) []types.ConsensusValidator { // sort the bonded validators by number of staked tokens in descending order sort.Slice(bondedValidators, func(i, j int) bool { return bondedValidators[i].GetBondedTokens().GT(bondedValidators[j].GetBondedTokens()) @@ -340,7 +360,7 @@ func (k Keeper) ComputeNextValidators(ctx sdk.Context, chainID string, bondedVal // if inactive validators are not allowed, only consider the first `MaxProviderConsensusValidators` validators // since those are the ones that participate in consensus - allowInactiveVals := k.AllowsInactiveValidators(ctx, chainID) + allowInactiveVals := k.AllowsInactiveValidators(ctx, consumerId) if !allowInactiveVals { // only leave the first MaxProviderConsensusValidators bonded validators maxProviderConsensusVals := k.GetMaxProviderConsensusValidators(ctx) @@ -349,11 +369,11 @@ func (k Keeper) ComputeNextValidators(ctx sdk.Context, chainID string, bondedVal } } - nextValidators := k.FilterValidators(ctx, chainID, bondedValidators, + nextValidators := k.FilterValidators(ctx, consumerId, bondedValidators, func(providerAddr types.ProviderConsAddress) bool { - return k.CanValidateChain(ctx, chainID, providerAddr) && k.FulfillsMinStake(ctx, chainID, providerAddr) + return k.CanValidateChain(ctx, consumerId, providerAddr) && k.FulfillsMinStake(ctx, consumerId, providerAddr) }) - nextValidators = k.CapValidatorSet(ctx, chainID, nextValidators) - return k.CapValidatorsPower(ctx, chainID, nextValidators) + nextValidators = k.CapValidatorSet(ctx, consumerId, nextValidators) + return k.CapValidatorsPower(ctx, consumerId, nextValidators) } diff --git a/x/ccv/provider/keeper/partial_set_security_test.go b/x/ccv/provider/keeper/partial_set_security_test.go index e180554239..c710e7f299 100644 --- a/x/ccv/provider/keeper/partial_set_security_test.go +++ b/x/ccv/provider/keeper/partial_set_security_test.go @@ -32,13 +32,26 @@ func TestHandleOptIn(t *testing.T) { providerAddr := types.NewProviderConsAddress([]byte("providerAddr")) - // trying to opt in to a non-proposed and non-registered chain returns an error - require.Error(t, providerKeeper.HandleOptIn(ctx, "unknownChainID", providerAddr, "")) + // trying to opt in to an unknown chain + require.Error(t, providerKeeper.HandleOptIn(ctx, "unknownConsumerId", providerAddr, "")) - providerKeeper.SetProposedConsumerChain(ctx, "chainID", 1) - require.False(t, providerKeeper.IsOptedIn(ctx, "chainID", providerAddr)) - providerKeeper.HandleOptIn(ctx, "chainID", providerAddr, "") - require.True(t, providerKeeper.IsOptedIn(ctx, "chainID", providerAddr)) + // trying to opt in to a stopped consumer chain + providerKeeper.SetConsumerPhase(ctx, "stoppedConsumerId", keeper.Stopped) + require.Error(t, providerKeeper.HandleOptIn(ctx, "stoppedConsumerId", providerAddr, "")) + + providerKeeper.SetConsumerPhase(ctx, "consumerId", keeper.Initialized) + providerKeeper.SetConsumerChainId(ctx, "consumerId", "chainId") + require.False(t, providerKeeper.IsOptedIn(ctx, "consumerId", providerAddr)) + err := providerKeeper.HandleOptIn(ctx, "consumerId", providerAddr, "") + require.NoError(t, err) + require.True(t, providerKeeper.IsOptedIn(ctx, "consumerId", providerAddr)) + + // validator tries to opt in to another chain with chain id ("chainId") while it is already opted in to + // a different chain with the same chain id + providerKeeper.SetConsumerPhase(ctx, "consumerId2", keeper.Initialized) + providerKeeper.SetConsumerChainId(ctx, "consumerId2", "chainId") + err = providerKeeper.HandleOptIn(ctx, "consumerId2", providerAddr, "") + require.ErrorContains(t, err, "validator is already opted in to a chain") } func TestHandleOptInWithConsumerKey(t *testing.T) { @@ -67,25 +80,27 @@ func TestHandleOptInWithConsumerKey(t *testing.T) { } gomock.InOrder(calls...) - providerKeeper.SetProposedConsumerChain(ctx, "chainID", 1) + providerKeeper.SetProposalIdToConsumerId(ctx, 1, "consumerId") // create a sample consumer key to assign to the `providerAddr` validator - // on the consumer chain with id `chainID` + // on the consumer chain with `consumerId` consumerKey := "{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}" expectedConsumerPubKey, err := providerKeeper.ParseConsumerKey(consumerKey) require.NoError(t, err) - err = providerKeeper.HandleOptIn(ctx, "chainID", providerAddr, consumerKey) + providerKeeper.SetConsumerPhase(ctx, "consumerId", keeper.Initialized) + providerKeeper.SetConsumerChainId(ctx, "consumerId", "consumerId") + err = providerKeeper.HandleOptIn(ctx, "consumerId", providerAddr, consumerKey) require.NoError(t, err) - // assert that the consumeKey was assigned to `providerAddr` validator on chain with id `chainID` - actualConsumerPubKey, found := providerKeeper.GetValidatorConsumerPubKey(ctx, "chainID", providerAddr) + // assert that the consumeKey was assigned to `providerAddr` validator on chain with `consumerId` + actualConsumerPubKey, found := providerKeeper.GetValidatorConsumerPubKey(ctx, "consumerId", providerAddr) require.True(t, found) require.Equal(t, expectedConsumerPubKey, actualConsumerPubKey) // assert that the `consumerAddr` to `providerAddr` association was set as well consumerAddr, _ := ccvtypes.TMCryptoPublicKeyToConsAddr(actualConsumerPubKey) - actualProviderConsAddr, found := providerKeeper.GetValidatorByConsumerAddr(ctx, "chainID", types.NewConsumerConsAddress(consumerAddr)) + actualProviderConsAddr, found := providerKeeper.GetValidatorByConsumerAddr(ctx, "consumerId", types.NewConsumerConsAddress(consumerAddr)) require.True(t, found) require.Equal(t, providerAddr, actualProviderConsAddr) } @@ -100,27 +115,29 @@ func TestHandleOptOut(t *testing.T) { require.Error(t, providerKeeper.HandleOptOut(ctx, "unknownChainID", providerAddr)) // set a consumer client so that the chain is considered running - providerKeeper.SetConsumerClientId(ctx, "chainID", "clientID") + providerKeeper.SetConsumerClientId(ctx, "consumerId", "clientID") // if validator (`providerAddr`) is already opted in, then an opt-out would remove this validator - providerKeeper.SetOptedIn(ctx, "chainID", providerAddr) - require.True(t, providerKeeper.IsOptedIn(ctx, "chainID", providerAddr)) - providerKeeper.HandleOptOut(ctx, "chainID", providerAddr) - require.False(t, providerKeeper.IsOptedIn(ctx, "chainID", providerAddr)) + providerKeeper.SetOptedIn(ctx, "consumerId", providerAddr) + require.True(t, providerKeeper.IsOptedIn(ctx, "consumerId", providerAddr)) + providerKeeper.HandleOptOut(ctx, "consumerId", providerAddr) + require.False(t, providerKeeper.IsOptedIn(ctx, "consumerId", providerAddr)) } func TestHandleOptOutFromTopNChain(t *testing.T) { providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - chainID := "chainID" + consumerId := "consumerId" // set a consumer client so that the chain is considered running - providerKeeper.SetConsumerClientId(ctx, chainID, "clientID") + providerKeeper.SetConsumerClientId(ctx, consumerId, "clientID") // set the chain as Top 50 and create 4 validators with 10%, 20%, 30%, and 40% of the total voting power // respectively - providerKeeper.SetTopN(ctx, "chainID", 50) + providerKeeper.SetConsumerPowerShapingParameters(ctx, consumerId, types.PowerShapingParameters{ + Top_N: 50, + }) valA := createStakingValidator(ctx, mocks, 1, 1, 1) // 10% of the total voting power (can opt out) valAConsAddr, _ := valA.GetConsAddr() mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, valAConsAddr).Return(valA, nil).AnyTimes() @@ -139,29 +156,33 @@ func TestHandleOptOutFromTopNChain(t *testing.T) { // initialize the minPowerInTopN correctly minPowerInTopN, err := providerKeeper.ComputeMinPowerInTopN(ctx, []stakingtypes.Validator{valA, valB, valC, valD}, 50) require.NoError(t, err) - providerKeeper.SetMinimumPowerInTopN(ctx, chainID, minPowerInTopN) + providerKeeper.SetMinimumPowerInTopN(ctx, consumerId, minPowerInTopN) // opt in all validators - providerKeeper.SetOptedIn(ctx, chainID, types.NewProviderConsAddress(valAConsAddr)) - providerKeeper.SetOptedIn(ctx, chainID, types.NewProviderConsAddress(valBConsAddr)) - providerKeeper.SetOptedIn(ctx, chainID, types.NewProviderConsAddress(valCConsAddr)) - providerKeeper.SetOptedIn(ctx, chainID, types.NewProviderConsAddress(valDConsAddr)) + providerKeeper.SetOptedIn(ctx, consumerId, types.NewProviderConsAddress(valAConsAddr)) + providerKeeper.AppendOptedInConsumerId(ctx, types.NewProviderConsAddress(valAConsAddr), consumerId) + providerKeeper.SetOptedIn(ctx, consumerId, types.NewProviderConsAddress(valBConsAddr)) + providerKeeper.AppendOptedInConsumerId(ctx, types.NewProviderConsAddress(valBConsAddr), consumerId) + providerKeeper.SetOptedIn(ctx, consumerId, types.NewProviderConsAddress(valCConsAddr)) + providerKeeper.AppendOptedInConsumerId(ctx, types.NewProviderConsAddress(valCConsAddr), consumerId) + providerKeeper.SetOptedIn(ctx, consumerId, types.NewProviderConsAddress(valDConsAddr)) + providerKeeper.AppendOptedInConsumerId(ctx, types.NewProviderConsAddress(valDConsAddr), consumerId) // validators A and B can opt out because they belong the bottom 30% of validators - require.NoError(t, providerKeeper.HandleOptOut(ctx, chainID, types.NewProviderConsAddress(valAConsAddr))) - require.NoError(t, providerKeeper.HandleOptOut(ctx, chainID, types.NewProviderConsAddress(valBConsAddr))) + require.NoError(t, providerKeeper.HandleOptOut(ctx, consumerId, types.NewProviderConsAddress(valAConsAddr))) + require.NoError(t, providerKeeper.HandleOptOut(ctx, consumerId, types.NewProviderConsAddress(valBConsAddr))) // validators C and D cannot opt out because C has 30% of the voting power and D has 40% of the voting power // and hence both are needed to keep validating a Top 50 chain - require.Error(t, providerKeeper.HandleOptOut(ctx, chainID, types.NewProviderConsAddress(valCConsAddr))) - require.Error(t, providerKeeper.HandleOptOut(ctx, chainID, types.NewProviderConsAddress(valDConsAddr))) + require.Error(t, providerKeeper.HandleOptOut(ctx, consumerId, types.NewProviderConsAddress(valCConsAddr))) + require.Error(t, providerKeeper.HandleOptOut(ctx, consumerId, types.NewProviderConsAddress(valDConsAddr))) // opting out a validator that cannot be found from a Top N chain should also return an error notFoundValidator := createStakingValidator(ctx, mocks, 5, 5, 5) notFoundValidatorConsAddr, _ := notFoundValidator.GetConsAddr() mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, notFoundValidatorConsAddr). Return(stakingtypes.Validator{}, stakingtypes.ErrNoValidatorFound) - require.Error(t, providerKeeper.HandleOptOut(ctx, chainID, types.NewProviderConsAddress(notFoundValidatorConsAddr))) + require.Error(t, providerKeeper.HandleOptOut(ctx, consumerId, types.NewProviderConsAddress(notFoundValidatorConsAddr))) } func TestHandleSetConsumerCommissionRate(t *testing.T) { @@ -174,18 +195,20 @@ func TestHandleSetConsumerCommissionRate(t *testing.T) { require.Error(t, providerKeeper.HandleSetConsumerCommissionRate(ctx, "unknownChainID", providerAddr, math.LegacyZeroDec())) // setup a pending consumer chain - chainID := "pendingChainID" - providerKeeper.SetPendingConsumerAdditionProp(ctx, &types.ConsumerAdditionProposal{ChainId: chainID}) + consumerId := "0" + providerKeeper.FetchAndIncrementConsumerId(ctx) + providerKeeper.SetConsumerPhase(ctx, consumerId, keeper.Initialized) + providerKeeper.SetPendingConsumerAdditionProp(ctx, &types.ConsumerAdditionProposal{ChainId: consumerId}) // check that there's no commission rate set for the validator yet - _, found := providerKeeper.GetConsumerCommissionRate(ctx, chainID, providerAddr) + _, found := providerKeeper.GetConsumerCommissionRate(ctx, consumerId, providerAddr) require.False(t, found) mocks.MockStakingKeeper.EXPECT().MinCommissionRate(ctx).Return(math.LegacyZeroDec(), nil).Times(1) - require.NoError(t, providerKeeper.HandleSetConsumerCommissionRate(ctx, chainID, providerAddr, math.LegacyOneDec())) + require.NoError(t, providerKeeper.HandleSetConsumerCommissionRate(ctx, consumerId, providerAddr, math.LegacyOneDec())) // check that the commission rate is now set - cr, found := providerKeeper.GetConsumerCommissionRate(ctx, chainID, providerAddr) + cr, found := providerKeeper.GetConsumerCommissionRate(ctx, consumerId, providerAddr) require.Equal(t, math.LegacyOneDec(), cr) require.True(t, found) @@ -196,16 +219,16 @@ func TestHandleSetConsumerCommissionRate(t *testing.T) { // try to set a rate slightly below the minimum require.Error(t, providerKeeper.HandleSetConsumerCommissionRate( ctx, - chainID, + consumerId, providerAddr, commissionRate.Sub(math.LegacyNewDec(1).Quo(math.LegacyNewDec(100)))), // 0.5 - 0.01 "commission rate should be rejected (below min), but is not", ) // set a valid commission equal to the minimum - require.NoError(t, providerKeeper.HandleSetConsumerCommissionRate(ctx, chainID, providerAddr, commissionRate)) + require.NoError(t, providerKeeper.HandleSetConsumerCommissionRate(ctx, consumerId, providerAddr, commissionRate)) // check that the rate was set - cr, found = providerKeeper.GetConsumerCommissionRate(ctx, chainID, providerAddr) + cr, found = providerKeeper.GetConsumerCommissionRate(ctx, consumerId, providerAddr) require.Equal(t, commissionRate, cr) require.True(t, found) } @@ -225,14 +248,14 @@ func TestOptInTopNValidators(t *testing.T) { valDConsAddr, _ := valD.GetConsAddr() // Start Test 1: opt in all validators with power >= 0 - providerKeeper.OptInTopNValidators(ctx, "chainID", []stakingtypes.Validator{valA, valB, valC, valD}, 0) + providerKeeper.OptInTopNValidators(ctx, "consumerId", []stakingtypes.Validator{valA, valB, valC, valD}, 0) expectedOptedInValidators := []types.ProviderConsAddress{ types.NewProviderConsAddress(valAConsAddr), types.NewProviderConsAddress(valBConsAddr), types.NewProviderConsAddress(valCConsAddr), types.NewProviderConsAddress(valDConsAddr), } - actualOptedInValidators := providerKeeper.GetAllOptedIn(ctx, "chainID") + actualOptedInValidators := providerKeeper.GetAllOptedIn(ctx, "consumerId") // sort validators first to be able to compare sortUpdates := func(addresses []types.ProviderConsAddress) { @@ -246,31 +269,31 @@ func TestOptInTopNValidators(t *testing.T) { require.Equal(t, expectedOptedInValidators, actualOptedInValidators) // reset state for the upcoming checks - providerKeeper.DeleteOptedIn(ctx, "chainID", types.NewProviderConsAddress(valAConsAddr)) - providerKeeper.DeleteOptedIn(ctx, "chainID", types.NewProviderConsAddress(valBConsAddr)) - providerKeeper.DeleteOptedIn(ctx, "chainID", types.NewProviderConsAddress(valCConsAddr)) - providerKeeper.DeleteOptedIn(ctx, "chainID", types.NewProviderConsAddress(valDConsAddr)) + providerKeeper.DeleteOptedIn(ctx, "consumerId", types.NewProviderConsAddress(valAConsAddr)) + providerKeeper.DeleteOptedIn(ctx, "consumerId", types.NewProviderConsAddress(valBConsAddr)) + providerKeeper.DeleteOptedIn(ctx, "consumerId", types.NewProviderConsAddress(valCConsAddr)) + providerKeeper.DeleteOptedIn(ctx, "consumerId", types.NewProviderConsAddress(valDConsAddr)) // Start Test 2: opt in all validators with power >= 1 // We expect the same `expectedOptedInValidators` as when we opted in all validators with power >= 0 because the // validators with the smallest power have power == 1 - providerKeeper.OptInTopNValidators(ctx, "chainID", []stakingtypes.Validator{valA, valB, valC, valD}, 0) - actualOptedInValidators = providerKeeper.GetAllOptedIn(ctx, "chainID") + providerKeeper.OptInTopNValidators(ctx, "consumerId", []stakingtypes.Validator{valA, valB, valC, valD}, 0) + actualOptedInValidators = providerKeeper.GetAllOptedIn(ctx, "consumerId") sortUpdates(actualOptedInValidators) require.Equal(t, expectedOptedInValidators, actualOptedInValidators) - providerKeeper.DeleteOptedIn(ctx, "chainID", types.NewProviderConsAddress(valAConsAddr)) - providerKeeper.DeleteOptedIn(ctx, "chainID", types.NewProviderConsAddress(valBConsAddr)) - providerKeeper.DeleteOptedIn(ctx, "chainID", types.NewProviderConsAddress(valCConsAddr)) - providerKeeper.DeleteOptedIn(ctx, "chainID", types.NewProviderConsAddress(valDConsAddr)) + providerKeeper.DeleteOptedIn(ctx, "consumerId", types.NewProviderConsAddress(valAConsAddr)) + providerKeeper.DeleteOptedIn(ctx, "consumerId", types.NewProviderConsAddress(valBConsAddr)) + providerKeeper.DeleteOptedIn(ctx, "consumerId", types.NewProviderConsAddress(valCConsAddr)) + providerKeeper.DeleteOptedIn(ctx, "consumerId", types.NewProviderConsAddress(valDConsAddr)) // Start Test 3: opt in all validators with power >= 2 and hence we do not expect to opt in validator A - providerKeeper.OptInTopNValidators(ctx, "chainID", []stakingtypes.Validator{valA, valB, valC, valD}, 2) + providerKeeper.OptInTopNValidators(ctx, "consumerId", []stakingtypes.Validator{valA, valB, valC, valD}, 2) expectedOptedInValidators = []types.ProviderConsAddress{ types.NewProviderConsAddress(valBConsAddr), types.NewProviderConsAddress(valCConsAddr), } - actualOptedInValidators = providerKeeper.GetAllOptedIn(ctx, "chainID") + actualOptedInValidators = providerKeeper.GetAllOptedIn(ctx, "consumerId") // sort validators first to be able to compare sortUpdates(expectedOptedInValidators) @@ -278,14 +301,14 @@ func TestOptInTopNValidators(t *testing.T) { require.Equal(t, expectedOptedInValidators, actualOptedInValidators) // reset state for the upcoming checks - providerKeeper.DeleteOptedIn(ctx, "chainID", types.NewProviderConsAddress(valAConsAddr)) - providerKeeper.DeleteOptedIn(ctx, "chainID", types.NewProviderConsAddress(valBConsAddr)) - providerKeeper.DeleteOptedIn(ctx, "chainID", types.NewProviderConsAddress(valCConsAddr)) - providerKeeper.DeleteOptedIn(ctx, "chainID", types.NewProviderConsAddress(valDConsAddr)) + providerKeeper.DeleteOptedIn(ctx, "consumerId", types.NewProviderConsAddress(valAConsAddr)) + providerKeeper.DeleteOptedIn(ctx, "consumerId", types.NewProviderConsAddress(valBConsAddr)) + providerKeeper.DeleteOptedIn(ctx, "consumerId", types.NewProviderConsAddress(valCConsAddr)) + providerKeeper.DeleteOptedIn(ctx, "consumerId", types.NewProviderConsAddress(valDConsAddr)) // Start Test 4: opt in all validators with power >= 4 and hence we do not expect any opted-in validators - providerKeeper.OptInTopNValidators(ctx, "chainID", []stakingtypes.Validator{valA, valB, valC, valD}, 4) - require.Empty(t, providerKeeper.GetAllOptedIn(ctx, "chainID")) + providerKeeper.OptInTopNValidators(ctx, "consumerId", []stakingtypes.Validator{valA, valB, valC, valD}, 4) + require.Empty(t, providerKeeper.GetAllOptedIn(ctx, "consumerId")) } func TestComputeMinPowerInTopN(t *testing.T) { @@ -356,7 +379,7 @@ func TestComputeMinPowerInTopN(t *testing.T) { require.Error(t, err) } -// TestCanValidateChain returns true if `validator` is opted in, in `chainID. +// TestCanValidateChain returns true if `validator` is opted in, in `consumerId. func TestCanValidateChain(t *testing.T) { providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() @@ -366,24 +389,24 @@ func TestCanValidateChain(t *testing.T) { providerAddr := types.NewProviderConsAddress(consAddr) // with no allowlist or denylist, the validator has to be opted in, in order to consider it - require.False(t, providerKeeper.CanValidateChain(ctx, "chainID", providerAddr)) - providerKeeper.SetOptedIn(ctx, "chainID", types.NewProviderConsAddress(consAddr)) - require.True(t, providerKeeper.CanValidateChain(ctx, "chainID", providerAddr)) + require.False(t, providerKeeper.CanValidateChain(ctx, "consumerId", providerAddr)) + providerKeeper.SetOptedIn(ctx, "consumerId", types.NewProviderConsAddress(consAddr)) + require.True(t, providerKeeper.CanValidateChain(ctx, "consumerId", providerAddr)) // create an allow list but do not add the validator `providerAddr` to it validatorA := createStakingValidator(ctx, mocks, 1, 1, 2) consAddrA, _ := validatorA.GetConsAddr() - providerKeeper.SetAllowlist(ctx, "chainID", types.NewProviderConsAddress(consAddrA)) - require.False(t, providerKeeper.CanValidateChain(ctx, "chainID", providerAddr)) - providerKeeper.SetAllowlist(ctx, "chainID", types.NewProviderConsAddress(consAddr)) - require.True(t, providerKeeper.CanValidateChain(ctx, "chainID", providerAddr)) + providerKeeper.SetAllowlist(ctx, "consumerId", types.NewProviderConsAddress(consAddrA)) + require.False(t, providerKeeper.CanValidateChain(ctx, "consumerId", providerAddr)) + providerKeeper.SetAllowlist(ctx, "consumerId", types.NewProviderConsAddress(consAddr)) + require.True(t, providerKeeper.CanValidateChain(ctx, "consumerId", providerAddr)) // create a denylist but do not add validator `providerAddr` to it - providerKeeper.SetDenylist(ctx, "chainID", types.NewProviderConsAddress(consAddrA)) - require.True(t, providerKeeper.CanValidateChain(ctx, "chainID", providerAddr)) + providerKeeper.SetDenylist(ctx, "consumerId", types.NewProviderConsAddress(consAddrA)) + require.True(t, providerKeeper.CanValidateChain(ctx, "consumerId", providerAddr)) // add validator `providerAddr` to the denylist - providerKeeper.SetDenylist(ctx, "chainID", types.NewProviderConsAddress(consAddr)) - require.False(t, providerKeeper.CanValidateChain(ctx, "chainID", providerAddr)) + providerKeeper.SetDenylist(ctx, "consumerId", types.NewProviderConsAddress(consAddr)) + require.False(t, providerKeeper.CanValidateChain(ctx, "consumerId", providerAddr)) } func TestCapValidatorSet(t *testing.T) { @@ -409,27 +432,37 @@ func TestCapValidatorSet(t *testing.T) { } validators := []types.ConsensusValidator{validatorA, validatorB, validatorC} - consumerValidators := providerKeeper.CapValidatorSet(ctx, "chainID", validators) + consumerValidators := providerKeeper.CapValidatorSet(ctx, "consumerId", validators) require.Equal(t, validators, consumerValidators) - providerKeeper.SetValidatorSetCap(ctx, "chainID", 0) - consumerValidators = providerKeeper.CapValidatorSet(ctx, "chainID", validators) + providerKeeper.SetConsumerPowerShapingParameters(ctx, "consumerId", types.PowerShapingParameters{ + ValidatorSetCap: 0, + }) + consumerValidators = providerKeeper.CapValidatorSet(ctx, "consumerId", validators) require.Equal(t, validators, consumerValidators) - providerKeeper.SetValidatorSetCap(ctx, "chainID", 100) - consumerValidators = providerKeeper.CapValidatorSet(ctx, "chainID", validators) + providerKeeper.SetConsumerPowerShapingParameters(ctx, "consumerId", types.PowerShapingParameters{ + ValidatorSetCap: 100, + }) + consumerValidators = providerKeeper.CapValidatorSet(ctx, "consumerId", validators) require.Equal(t, validators, consumerValidators) - providerKeeper.SetValidatorSetCap(ctx, "chainID", 1) - consumerValidators = providerKeeper.CapValidatorSet(ctx, "chainID", validators) + providerKeeper.SetConsumerPowerShapingParameters(ctx, "consumerId", types.PowerShapingParameters{ + ValidatorSetCap: 1, + }) + consumerValidators = providerKeeper.CapValidatorSet(ctx, "consumerId", validators) require.Equal(t, []types.ConsensusValidator{validatorC}, consumerValidators) - providerKeeper.SetValidatorSetCap(ctx, "chainID", 2) - consumerValidators = providerKeeper.CapValidatorSet(ctx, "chainID", validators) + providerKeeper.SetConsumerPowerShapingParameters(ctx, "consumerId", types.PowerShapingParameters{ + ValidatorSetCap: 2, + }) + consumerValidators = providerKeeper.CapValidatorSet(ctx, "consumerId", validators) require.Equal(t, []types.ConsensusValidator{validatorC, validatorB}, consumerValidators) - providerKeeper.SetValidatorSetCap(ctx, "chainID", 3) - consumerValidators = providerKeeper.CapValidatorSet(ctx, "chainID", validators) + providerKeeper.SetConsumerPowerShapingParameters(ctx, "consumerId", types.PowerShapingParameters{ + ValidatorSetCap: 3, + }) + consumerValidators = providerKeeper.CapValidatorSet(ctx, "consumerId", validators) require.Equal(t, []types.ConsensusValidator{validatorC, validatorB, validatorA}, consumerValidators) } @@ -477,13 +510,15 @@ func TestCapValidatorsPower(t *testing.T) { } // no capping takes place because validators power-cap is not set - cappedValidators := providerKeeper.CapValidatorsPower(ctx, "chainID", validators) + cappedValidators := providerKeeper.CapValidatorsPower(ctx, "consumerId", validators) sortValidators(validators) sortValidators(cappedValidators) require.Equal(t, validators, cappedValidators) - providerKeeper.SetValidatorsPowerCap(ctx, "chainID", 33) - cappedValidators = providerKeeper.CapValidatorsPower(ctx, "chainID", validators) + providerKeeper.SetConsumerPowerShapingParameters(ctx, "consumerId", types.PowerShapingParameters{ + ValidatorsPowerCap: 33, + }) + cappedValidators = providerKeeper.CapValidatorsPower(ctx, "consumerId", validators) sortValidators(expectedValidators) sortValidators(cappedValidators) require.Equal(t, expectedValidators, cappedValidators) @@ -742,9 +777,11 @@ func TestFulfillsMinStake(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - providerKeeper.SetMinStake(ctx, "chainID", tc.minStake) + providerKeeper.SetConsumerPowerShapingParameters(ctx, "consumerId", types.PowerShapingParameters{ + MinStake: tc.minStake, + }) for i, valAddr := range consAddrs { - result := providerKeeper.FulfillsMinStake(ctx, "chainID", valAddr) + result := providerKeeper.FulfillsMinStake(ctx, "consumerId", valAddr) require.Equal(t, tc.expectedFulfill[i], result) } }) @@ -764,7 +801,7 @@ func TestIfInactiveValsDisallowedProperty(t *testing.T) { // opt the validators in for _, valAddr := range consAddrs { - providerKeeper.SetOptedIn(ctx, "chainID", valAddr) + providerKeeper.SetOptedIn(ctx, "consumerId", valAddr) } // Randomly choose values for parameters @@ -774,14 +811,16 @@ func TestIfInactiveValsDisallowedProperty(t *testing.T) { // Set up the parameters in the provider keeper // do not allow inactive validators - providerKeeper.SetInactiveValidatorsAllowed(ctx, "chainID", false) - providerKeeper.SetMinStake(ctx, "chainID", minStake) + providerKeeper.SetConsumerPowerShapingParameters(ctx, "consumerId", types.PowerShapingParameters{ + MinStake: minStake, + AllowInactiveVals: false, + }) params := providerKeeper.GetParams(ctx) params.MaxProviderConsensusValidators = int64(maxProviderConsensusVals) providerKeeper.SetParams(ctx, params) // Compute the next validators - nextVals := providerKeeper.ComputeNextValidators(ctx, "chainID", vals) + nextVals := providerKeeper.ComputeNextValidators(ctx, "consumerId", vals) // Check that the length of nextVals is at most maxProviderConsensusVals require.LessOrEqual(r, len(nextVals), int(maxProviderConsensusVals), "The length of nextVals should be at most maxProviderConsensusVals") diff --git a/x/ccv/provider/keeper/permissionless.go b/x/ccv/provider/keeper/permissionless.go new file mode 100644 index 0000000000..b742485f6e --- /dev/null +++ b/x/ccv/provider/keeper/permissionless.go @@ -0,0 +1,747 @@ +package keeper + +import ( + "bytes" + errorsmod "cosmossdk.io/errors" + storetypes "cosmossdk.io/store/types" + "encoding/binary" + "encoding/gob" + "fmt" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + "strconv" + "time" +) + +// ConsumerPhase captures the phases of a consumer chain according to `docs/docs/adrs/adr-018-permissionless-ics.md` +type ConsumerPhase byte + +const ( + // Registered phase indicates the phase in which a consumer chain has been assigned a unique consumer id. This consumer + // id can be used to interact with the consumer chain (e.g., when a validator opts in to a chain). A chain in this + // phase cannot yet launch. It has to be initialized first. + Registered ConsumerPhase = iota + // Initialized phase indicates the phase in which a consumer chain has set all the needed parameters to launch but + // has not yet launched (e.g., because the `spawnTime` of the consumer chain has not yet been reached). + Initialized + // FailedToLaunch phase indicates that the chain attempted but failed to launch (e.g., due to no validator opting in). + FailedToLaunch + // Launched phase corresponds to the phase in which a consumer chain is running and consuming a subset of the validator + // set of the provider. + Launched + // Stopped phase corresponds to the phase in which a previously-launched chain has stopped. + Stopped +) + +// setConsumerId sets the provided consumerId +func (k Keeper) setConsumerId(ctx sdk.Context, consumerId uint64) { + store := ctx.KVStore(k.storeKey) + + buf := make([]byte, 8) + binary.BigEndian.PutUint64(buf, consumerId) + + store.Set(types.ConsumerIdKey(), buf) +} + +// GetConsumerId returns the last registered consumer id +func (k Keeper) GetConsumerId(ctx sdk.Context) (uint64, bool) { + store := ctx.KVStore(k.storeKey) + buf := store.Get(types.ConsumerIdKey()) + if buf == nil { + return 0, false + } + return binary.BigEndian.Uint64(buf), true +} + +// FetchAndIncrementConsumerId fetches the first consumer id that can be used and increments the +// underlying consumer id +func (k Keeper) FetchAndIncrementConsumerId(ctx sdk.Context) string { + consumerId, _ := k.GetConsumerId(ctx) + k.setConsumerId(ctx, consumerId+1) + return strconv.FormatUint(consumerId, 10) +} + +// GetConsumerChainId returns the chain id associated with this consumer id +func (k Keeper) GetConsumerChainId(ctx sdk.Context, consumerId string) (string, error) { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.ConsumerIdToChainIdKey(consumerId)) + if bz == nil { + return "", fmt.Errorf("failed to retrieve chain id for consumer id (%s)", consumerId) + } + return string(bz), nil +} + +// SetConsumerChainId sets the chain id associated with this consumer id +func (k Keeper) SetConsumerChainId(ctx sdk.Context, consumerId string, chainId string) { + store := ctx.KVStore(k.storeKey) + store.Set(types.ConsumerIdToChainIdKey(consumerId), []byte(chainId)) +} + +// DeleteConsumerChainId deletes the chain id associated with this consumer id +func (k Keeper) DeleteConsumerChainId(ctx sdk.Context, consumerId string) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.ConsumerIdToChainIdKey(consumerId)) +} + +// GetConsumerOwnerAddress returns the owner address associated with this consumer id +func (k Keeper) GetConsumerOwnerAddress(ctx sdk.Context, consumerId string) (string, error) { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.ConsumerIdToOwnerAddressKey(consumerId)) + if bz == nil { + return "", fmt.Errorf("failed to retrieve owner address for consumer id (%s)", consumerId) + } + return string(bz), nil +} + +// SetConsumerOwnerAddress sets the chain id associated with this consumer id +func (k Keeper) SetConsumerOwnerAddress(ctx sdk.Context, consumerId string, chainId string) { + store := ctx.KVStore(k.storeKey) + store.Set(types.ConsumerIdToOwnerAddressKey(consumerId), []byte(chainId)) +} + +// DeleteConsumerOwnerAddress deletes the owner address associated with this consumer id +func (k Keeper) DeleteConsumerOwnerAddress(ctx sdk.Context, consumerId string) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.ConsumerIdToOwnerAddressKey(consumerId)) +} + +// GetConsumerMetadata returns the registration record associated with this consumer id +func (k Keeper) GetConsumerMetadata(ctx sdk.Context, consumerId string) (types.ConsumerMetadata, error) { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.ConsumerIdToMetadataKey(consumerId)) + if bz == nil { + return types.ConsumerMetadata{}, fmt.Errorf("failed to retrieve metadata for consumer id (%s)", consumerId) + } + var metadata types.ConsumerMetadata + if err := metadata.Unmarshal(bz); err != nil { + return types.ConsumerMetadata{}, fmt.Errorf("failed to unmarshal metadata for consumer id (%s): %w", consumerId, err) + } + return metadata, nil +} + +// SetConsumerMetadata sets the registration record associated with this consumer id +func (k Keeper) SetConsumerMetadata(ctx sdk.Context, consumerId string, metadata types.ConsumerMetadata) error { + store := ctx.KVStore(k.storeKey) + bz, err := metadata.Marshal() + if err != nil { + return fmt.Errorf("failed to marshal registration metadata (%+v) for consumer id (%s): %w", metadata, consumerId, err) + } + store.Set(types.ConsumerIdToMetadataKey(consumerId), bz) + return nil +} + +// DeleteConsumerMetadata deletes the metadata associated with this consumer id +func (k Keeper) DeleteConsumerMetadata(ctx sdk.Context, consumerId string) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.ConsumerIdToMetadataKey(consumerId)) +} + +// GetConsumerInitializationParameters returns the initialization parameters associated with this consumer id +func (k Keeper) GetConsumerInitializationParameters(ctx sdk.Context, consumerId string) (types.ConsumerInitializationParameters, error) { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.ConsumerIdToInitializationParametersKey(consumerId)) + if bz == nil { + return types.ConsumerInitializationParameters{}, fmt.Errorf("failed to retrieve initialization parameters for consumer id (%s)", consumerId) + } + var record types.ConsumerInitializationParameters + if err := record.Unmarshal(bz); err != nil { + return types.ConsumerInitializationParameters{}, fmt.Errorf("failed to unmarshal stop time for consumer id (%s): %w", consumerId, err) + } + return record, nil +} + +// SetConsumerInitializationParameters sets the initialization parameters associated with this consumer id +func (k Keeper) SetConsumerInitializationParameters(ctx sdk.Context, consumerId string, record types.ConsumerInitializationParameters) error { + store := ctx.KVStore(k.storeKey) + bz, err := record.Marshal() + if err != nil { + return fmt.Errorf("failed to marshal initialization record (%+v) for consumer id (%s): %w", record, consumerId, err) + } + store.Set(types.ConsumerIdToInitializationParametersKey(consumerId), bz) + return nil +} + +// DeleteConsumerInitializationParameters deletes the initialization parameters associated with this consumer id +func (k Keeper) DeleteConsumerInitializationParameters(ctx sdk.Context, consumerId string) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.ConsumerIdToInitializationParametersKey(consumerId)) +} + +// GetConsumerPowerShapingParameters returns the power-shaping parameters associated with this consumer id +func (k Keeper) GetConsumerPowerShapingParameters(ctx sdk.Context, consumerId string) (types.PowerShapingParameters, error) { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.ConsumerIdToPowerShapingParametersKey(consumerId)) + if bz == nil { + return types.PowerShapingParameters{}, fmt.Errorf("failed to retrieve power-shaping parameters for consumer id (%s)", consumerId) + } + var record types.PowerShapingParameters + if err := record.Unmarshal(bz); err != nil { + return types.PowerShapingParameters{}, fmt.Errorf("failed to unmarshal power-shaping parameters for consumer id (%s): %w", consumerId, err) + } + return record, nil +} + +// SetConsumerPowerShapingParameters sets the power-shaping parameters associated with this consumer id +func (k Keeper) SetConsumerPowerShapingParameters(ctx sdk.Context, consumerId string, parameters types.PowerShapingParameters) error { + store := ctx.KVStore(k.storeKey) + bz, err := parameters.Marshal() + if err != nil { + return fmt.Errorf("failed to marshal power-shaping parameters (%+v) for consumer id (%s): %w", parameters, consumerId, err) + } + store.Set(types.ConsumerIdToPowerShapingParametersKey(consumerId), bz) + return nil +} + +// DeleteConsumerPowerShapingParameters deletes the power-shaping parameters associated with this consumer id +func (k Keeper) DeleteConsumerPowerShapingParameters(ctx sdk.Context, consumerId string) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.ConsumerIdToPowerShapingParametersKey(consumerId)) +} + +// GetConsumerPhase returns the phase associated with this consumer id +func (k Keeper) GetConsumerPhase(ctx sdk.Context, consumerId string) (ConsumerPhase, bool) { + store := ctx.KVStore(k.storeKey) + buf := store.Get(types.ConsumerIdToPhaseKey(consumerId)) + if buf == nil { + return ConsumerPhase(0), false + } + return ConsumerPhase(buf[0]), true +} + +// SetConsumerPhase sets the phase associated with this consumer id +// TODO (PERMISSIONLESS): use this method when launching and when stopping a chain +func (k Keeper) SetConsumerPhase(ctx sdk.Context, consumerId string, phase ConsumerPhase) { + store := ctx.KVStore(k.storeKey) + store.Set(types.ConsumerIdToPhaseKey(consumerId), []byte{byte(phase)}) +} + +// DeleteConsumerPhase deletes the phase associated with this consumer id +func (k Keeper) DeleteConsumerPhase(ctx sdk.Context, consumerId string) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.ConsumerIdToPhaseKey(consumerId)) +} + +// GetConsumerStopTime returns the stop time associated with the to-be-stopped chain with consumer id +func (k Keeper) GetConsumerStopTime(ctx sdk.Context, consumerId string) (time.Time, error) { + store := ctx.KVStore(k.storeKey) + buf := store.Get(types.ConsumerIdToStopTimeKey(consumerId)) + if buf == nil { + return time.Time{}, fmt.Errorf("failed to retrieve stop time for consumer id (%s)", consumerId) + } + var time time.Time + if err := time.UnmarshalBinary(buf); err != nil { + return time, fmt.Errorf("failed to unmarshal stop time for consumer id (%s): %w", consumerId, err) + } + return time, nil +} + +// SetConsumerStopTime sets the stop time associated with this consumer id +func (k Keeper) SetConsumerStopTime(ctx sdk.Context, consumerId string, stopTime time.Time) error { + store := ctx.KVStore(k.storeKey) + buf, err := stopTime.MarshalBinary() + if err != nil { + return fmt.Errorf("failed to marshal stop time (%+v) for consumer id (%s): %w", stopTime, consumerId, err) + } + store.Set(types.ConsumerIdToStopTimeKey(consumerId), buf) + return nil +} + +// DeleteConsumerStopTime deletes the stop time associated with this consumer id +func (k Keeper) DeleteConsumerStopTime(ctx sdk.Context, consumerId string) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.ConsumerIdToStopTimeKey(consumerId)) +} + +// GetConsumersToBeLaunched +func (k Keeper) GetConsumersToBeLaunched(ctx sdk.Context, spawnTime time.Time) (types.ConsumerIds, error) { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.SpawnTimeToConsumerIdsKey(spawnTime)) + if bz == nil { + return types.ConsumerIds{}, nil + } + + var consumerIds types.ConsumerIds + + if err := consumerIds.Unmarshal(bz); err != nil { + return types.ConsumerIds{}, fmt.Errorf("failed to unmarshal consumer ids: %w", err) + } + return consumerIds, nil +} + +// AppendSpawnTimeForConsumerToBeLaunched +func (k Keeper) AppendSpawnTimeForConsumerToBeLaunched(ctx sdk.Context, consumerId string, spawnTime time.Time) error { + store := ctx.KVStore(k.storeKey) + + consumerIdsSlice, err := k.GetConsumersToBeLaunched(ctx, spawnTime) + if err != nil { + return err + } + consumerIds := append(consumerIdsSlice.Ids, consumerId) + + appendedConsumerIdsStr := types.ConsumerIds{ + Ids: consumerIds, + } + + bz, err := appendedConsumerIdsStr.Marshal() + if err != nil { + return err + } + + store.Set(types.SpawnTimeToConsumerIdsKey(spawnTime), bz) + return nil +} + +// RemoveConsumerFromToBeLaunchedConsumers +func (k Keeper) RemoveConsumerFromToBeLaunchedConsumers(ctx sdk.Context, consumerId string, spawnTime time.Time) error { + store := ctx.KVStore(k.storeKey) + + consumerIds, err := k.GetConsumersToBeLaunched(ctx, spawnTime) + if err != nil { + return err + } + + if len(consumerIds.Ids) == 0 { + return fmt.Errorf("no consumer ids for spawn time: %s", spawnTime.String()) + } + + // find the index of the consumer we want to remove + index := 0 + for i := 0; i < len(consumerIds.Ids); i = i + 1 { + if consumerIds.Ids[i] == consumerId { + index = i + break + } + } + if consumerIds.Ids[index] != consumerId { + return fmt.Errorf("failed to find consumer id (%s) in the chains to be launched", consumerId) + } + + if len(consumerIds.Ids) == 1 { + store.Delete(types.SpawnTimeToConsumerIdsKey(spawnTime)) + return nil + } + + updatedConsumerIds := append(consumerIds.Ids[:index], consumerIds.Ids[index+1:]...) + + updatedConsumerIdsStr := types.ConsumerIds{ + Ids: updatedConsumerIds, + } + + bz, err := updatedConsumerIdsStr.Marshal() + if err != nil { + return err + } + + store.Set(types.SpawnTimeToConsumerIdsKey(spawnTime), bz) + return nil +} + +// TODO (PERMISSIONLESS) merge the functions, they practically do the same + +// GetConsumersToBeStopped +func (k Keeper) GetConsumersToBeStopped(ctx sdk.Context, stopTime time.Time) (types.ConsumerIds, error) { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.StopTimeToConsumerIdsKey(stopTime)) + if bz == nil { + return types.ConsumerIds{}, nil + } + + var consumerIds types.ConsumerIds + err := consumerIds.Unmarshal(bz) + if err != nil { + return types.ConsumerIds{}, err + } + return consumerIds, nil +} + +// AppendSpawnTimeForConsumerToBeStopped +func (k Keeper) AppendStopTimeForConsumerToBeStopped(ctx sdk.Context, consumerId string, stopTime time.Time) error { + store := ctx.KVStore(k.storeKey) + + consumerIdsStr, err := k.GetConsumersToBeStopped(ctx, stopTime) + if err != nil { + return err + } + consumerIds := append(consumerIdsStr.Ids, consumerId) + + consumerIdsNewStr := types.ConsumerIds{ + Ids: consumerIds, + } + + bz, err := consumerIdsNewStr.Marshal() + if err != nil { + return err + } + + store.Set(types.StopTimeToConsumerIdsKey(stopTime), bz) + return nil +} + +// RemoveConsumerFromToBeStoppedConsumers +func (k Keeper) RemoveConsumerFromToBeStoppedConsumers(ctx sdk.Context, consumerId string, stopTime time.Time) error { + store := ctx.KVStore(k.storeKey) + + consumerIds, err := k.GetConsumersToBeStopped(ctx, stopTime) + if err != nil { + return err + } + + if len(consumerIds.Ids) == 0 { + return fmt.Errorf("no consumer ids for stop time: %s", stopTime.String()) + } + + // find the index of the consumer we want to remove + index := 0 + for i := 0; i < len(consumerIds.Ids); i = i + 1 { + if consumerIds.Ids[i] == consumerId { + index = i + break + } + } + if consumerIds.Ids[index] != consumerId { + return fmt.Errorf("failed to find consumer id (%s) in the chains to be stopped", consumerId) + } + + if len(consumerIds.Ids) == 1 { + store.Delete(types.StopTimeToConsumerIdsKey(stopTime)) + return nil + } + + updatedConsumerIds := append(consumerIds.Ids[:index], consumerIds.Ids[index+1:]...) + updatedConsumerIdsStr := types.ConsumerIds{ + Ids: updatedConsumerIds, + } + bz, err := updatedConsumerIdsStr.Marshal() + if err != nil { + return err + } + + store.Set(types.StopTimeToConsumerIdsKey(stopTime), bz) + return nil +} + +// GetOptedInConsumerIds +func (k Keeper) GetOptedInConsumerIds(ctx sdk.Context, providerAddr types.ProviderConsAddress) ([]string, error) { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.ProviderConsAddrToOptedInConsumerIdsKey(providerAddr)) + if bz == nil { + return []string{}, nil + } + + var consumerIds []string + buf := bytes.NewBuffer(bz) + dec := gob.NewDecoder(buf) + err := dec.Decode(&consumerIds) + return consumerIds, err +} + +// AppendOptedInConsumerId +func (k Keeper) AppendOptedInConsumerId(ctx sdk.Context, providerAddr types.ProviderConsAddress, consumerId string) error { + store := ctx.KVStore(k.storeKey) + + consumerIds, err := k.GetOptedInConsumerIds(ctx, providerAddr) + if err != nil { + return err + } + consumerIds = append(consumerIds, consumerId) + + var buf bytes.Buffer + enc := gob.NewEncoder(&buf) + err = enc.Encode(consumerIds) + if err != nil { + return err + } + + store.Set(types.ProviderConsAddrToOptedInConsumerIdsKey(providerAddr), buf.Bytes()) + return nil +} + +// RemoveOptedInConsumerId +func (k Keeper) RemoveOptedInConsumerId(ctx sdk.Context, providerAddr types.ProviderConsAddress, consumerId string) error { + store := ctx.KVStore(k.storeKey) + + consumerIds, err := k.GetOptedInConsumerIds(ctx, providerAddr) + if err != nil { + return err + } + + if len(consumerIds) == 0 { + return fmt.Errorf("no consumer ids for provider consensus address: %s", providerAddr.String()) + } + + // find the index of the consumer we want to remove + index := 0 + for i := 0; i < len(consumerIds); i = i + 1 { + if consumerIds[i] == consumerId { + index = i + break + } + } + if consumerIds[index] != consumerId { + return fmt.Errorf("failed to find consumer id (%s) from the opted-in chains", consumerId) + } + + if len(consumerIds) == 1 { + store.Delete(types.ProviderConsAddrToOptedInConsumerIdsKey(providerAddr)) + return nil + } + + updatedConsumerIds := append(consumerIds[:index], consumerIds[index+1:]...) + var buf bytes.Buffer + enc := gob.NewEncoder(&buf) + err = enc.Encode(updatedConsumerIds) + if err != nil { + return err + } + + store.Set(types.ProviderConsAddrToOptedInConsumerIdsKey(providerAddr), buf.Bytes()) + return nil +} + +// GetClientIdToConsumerId returns the consumer id associated with this client id +func (k Keeper) GetClientIdToConsumerId(ctx sdk.Context, clientId string) (string, bool) { + store := ctx.KVStore(k.storeKey) + buf := store.Get(types.ClientIdToConsumerIdKey(clientId)) + if buf == nil { + return "", false + } + return string(buf), true +} + +// SetClientIdToConsumerId sets the client id associated with this consumer id +func (k Keeper) SetClientIdToConsumerId(ctx sdk.Context, clientId string, consumerId string) { + store := ctx.KVStore(k.storeKey) + store.Set(types.ClientIdToConsumerIdKey(clientId), []byte(consumerId)) +} + +// DeleteClientIdToConsumerId deletes the client id to consumer id association +func (k Keeper) DeleteClientIdToConsumerId(ctx sdk.Context, clientId string) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.ClientIdToConsumerIdKey(clientId)) +} + +// GetInitializedConsumersReadyToLaunch returns the consumer ids of the pending initialized consumer chains +// that are ready to launch, i.e., consumer clients to be created. +func (k Keeper) GetInitializedConsumersReadyToLaunch(ctx sdk.Context, limit uint32) []string { + store := ctx.KVStore(k.storeKey) + + spawnTimeToConsumerIdsKeyPrefix := types.SpawnTimeToConsumerIdsKeyPrefix() + iterator := storetypes.KVStorePrefixIterator(store, []byte{spawnTimeToConsumerIdsKeyPrefix}) + defer iterator.Close() + + result := []string{} + for ; iterator.Valid(); iterator.Next() { + spawnTime, err := types.ParseTime(types.SpawnTimeToConsumerIdsKeyPrefix(), iterator.Key()) + if err != nil { + k.Logger(ctx).Error("failed to parse spawn time", + "error", err) + continue + } + if spawnTime.After(ctx.BlockTime()) { + return result + } + + // if current block time is equal to or after spawnTime, and the chain is initialized, we can launch the chain + consumerIds, err := k.GetConsumersToBeLaunched(ctx, spawnTime) + if err != nil { + k.Logger(ctx).Error("failed to retrieve consumers to launch", + "spawn time", spawnTime, + "error", err) + continue + } + if len(result)+len(consumerIds.Ids) >= int(limit) { + remainingConsumerIds := len(result) + len(consumerIds.Ids) - int(limit) + if len(consumerIds.Ids[:len(consumerIds.Ids)-remainingConsumerIds]) == 0 { + return result + } + return append(result, consumerIds.Ids[:len(consumerIds.Ids)-remainingConsumerIds]...) + } else { + result = append(result, consumerIds.Ids...) + } + } + + return result +} + +// LaunchConsumer launches the chain with the provided consumer id by creating the consumer client and the respective +// consumer genesis file +func (k Keeper) LaunchConsumer(ctx sdk.Context, consumerId string) error { + err := k.CreateConsumerClient(ctx, consumerId) + if err != nil { + return err + } + + consumerGenesis, found := k.GetConsumerGenesis(ctx, consumerId) + if !found { + return errorsmod.Wrapf(types.ErrNoConsumerGenesis, "consumer genesis could not be found") + } + + if len(consumerGenesis.Provider.InitialValSet) == 0 { + return errorsmod.Wrapf(types.ErrInvalidConsumerGenesis, "consumer genesis initial validator set is empty - no validators opted in") + } + + // The cached context is created with a new EventManager so we merge the event + // into the original context + ctx.EventManager().EmitEvents(ctx.EventManager().Events()) + return nil +} + +// UpdateAllowlist populates the allowlist store for the consumer chain with this consumer id +func (k Keeper) UpdateAllowlist(ctx sdk.Context, consumerId string, allowlist []string) { + k.DeleteAllowlist(ctx, consumerId) + for _, address := range allowlist { + consAddr, err := sdk.ConsAddressFromBech32(address) + if err != nil { + continue + } + + k.SetAllowlist(ctx, consumerId, types.NewProviderConsAddress(consAddr)) + } +} + +// UpdateDenylist populates the denylist store for the consumer chain with this consumer id +func (k Keeper) UpdateDenylist(ctx sdk.Context, consumerId string, denylist []string) { + k.DeleteDenylist(ctx, consumerId) + for _, address := range denylist { + consAddr, err := sdk.ConsAddressFromBech32(address) + if err != nil { + continue + } + + k.SetDenylist(ctx, consumerId, types.NewProviderConsAddress(consAddr)) + } + +} + +// UpdateMinimumPowerInTopN populates the minimum power in Top N for the consumer chain with this consumer id +func (k Keeper) UpdateMinimumPowerInTopN(ctx sdk.Context, consumerId string, oldTopN uint32, newTopN uint32) error { + // if the top N changes, we need to update the new minimum power in top N + if newTopN != oldTopN { + if newTopN > 0 { + // if the chain receives a non-zero top N value, store the minimum power in the top N + bondedValidators, err := k.GetLastProviderConsensusActiveValidators(ctx) + if err != nil { + return err + } + minPower, err := k.ComputeMinPowerInTopN(ctx, bondedValidators, newTopN) + if err != nil { + return err + } + k.SetMinimumPowerInTopN(ctx, consumerId, minPower) + } else { + // if the chain receives a zero top N value, we delete the min power + k.DeleteMinimumPowerInTopN(ctx, consumerId) + } + } + + return nil +} + +// GetLaunchedConsumersReadyToStop returns the consumer ids of the pending launched consumer chains +// that are ready to stop +func (k Keeper) GetLaunchedConsumersReadyToStop(ctx sdk.Context, limit uint32) []string { + store := ctx.KVStore(k.storeKey) + + stopTimeToConsumerIdsKeyPrefix := types.StopTimeToConsumerIdsKeyPrefix() + iterator := storetypes.KVStorePrefixIterator(store, []byte{stopTimeToConsumerIdsKeyPrefix}) + defer iterator.Close() + + result := []string{} + for ; iterator.Valid(); iterator.Next() { + stopTime, err := types.ParseTime(types.StopTimeToConsumerIdsKeyPrefix(), iterator.Key()) + if err != nil { + k.Logger(ctx).Error("failed to parse stop time", + "error", err) + continue + } + if stopTime.After(ctx.BlockTime()) { + return result + } + + consumerIds, err := k.GetConsumersToBeStopped(ctx, stopTime) + if err != nil { + k.Logger(ctx).Error("failed to retrieve consumers to stop", + "stop time", stopTime, + "error", err) + continue + } + if len(result)+len(consumerIds.Ids) >= int(limit) { + remainingConsumerIds := len(result) + len(consumerIds.Ids) - int(limit) + if len(consumerIds.Ids[:len(consumerIds.Ids)-remainingConsumerIds]) == 0 { + return result + } + return append(result, consumerIds.Ids[:len(consumerIds.Ids)-remainingConsumerIds]...) + } else { + result = append(result, consumerIds.Ids...) + } + } + + return result +} + +// IsValidatorOptedInToChainId checks if the validator with `providerAddr` is opted into the chain with the specified `chainId`. +// It returns `found == true` and the corresponding chain's `consumerId` if the validator is opted in. Otherwise, it returns an empty string +// for `consumerId` and `found == false`. +func (k Keeper) IsValidatorOptedInToChainId(ctx sdk.Context, providerAddr types.ProviderConsAddress, chainId string) (string, bool) { + consumerIds, err := k.GetOptedInConsumerIds(ctx, providerAddr) + if err != nil { + k.Logger(ctx).Error("failed to retrieve the consumer ids this validator is opted in to", + "providerAddr", providerAddr, + "error", err) + return "", false + } + + for _, consumerId := range consumerIds { + consumerChainId, err := k.GetConsumerChainId(ctx, consumerId) + if err != nil { + k.Logger(ctx).Error("cannot find chain id", + "consumerId", consumerId, + "error", err) + continue + } + + if consumerChainId == chainId { + return consumerId, true + } + + } + return "", false +} + +func (k Keeper) PrepareConsumerForLaunch(ctx sdk.Context, consumerId string, previousSpawnTime time.Time, spawnTime time.Time) { + if !previousSpawnTime.Equal(time.Time{}) { + // if this is not the first initialization and hence `previousSpawnTime` does not contain the zero value of `Time` + // remove the consumer id from the old spawn time + k.RemoveConsumerFromToBeLaunchedConsumers(ctx, consumerId, previousSpawnTime) + } + k.AppendSpawnTimeForConsumerToBeLaunched(ctx, consumerId, spawnTime) +} + +// CanLaunch checks on whether the consumer with `consumerId` has set all the initialization parameters set and hence +// is ready to launch and at what spawn time +// TODO (PERMISSIONLESS): could remove, all fields should be there because we validate the initialization parameters +func (k Keeper) CanLaunch(ctx sdk.Context, consumerId string) (time.Time, bool) { + // a chain that is already launched or stopped cannot launch again + phase, found := k.GetConsumerPhase(ctx, consumerId) + if !found || phase == Launched || phase == Stopped { + return time.Time{}, false + } + + initializationParameters, err := k.GetConsumerInitializationParameters(ctx, consumerId) + if err != nil { + return time.Time{}, false + } + + // a chain can only launch if the spawn time is in the future + spawnTimeInTheFuture := initializationParameters.SpawnTime.After(ctx.BlockTime()) + + genesisHashSet := initializationParameters.GenesisHash != nil + binaryHashSet := initializationParameters.BinaryHash != nil + + consumerRedistributionFractionSet := initializationParameters.ConsumerRedistributionFraction != "" + blocksPerDistributionTransmissionSet := initializationParameters.BlocksPerDistributionTransmission > 0 + historicalEntriesSet := initializationParameters.HistoricalEntries > 0 + + return initializationParameters.SpawnTime, spawnTimeInTheFuture && genesisHashSet && binaryHashSet && consumerRedistributionFractionSet && + blocksPerDistributionTransmissionSet && historicalEntriesSet +} diff --git a/x/ccv/provider/keeper/permissionless_test.go b/x/ccv/provider/keeper/permissionless_test.go new file mode 100644 index 0000000000..5819e355d0 --- /dev/null +++ b/x/ccv/provider/keeper/permissionless_test.go @@ -0,0 +1,384 @@ +package keeper_test + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + testkeeper "github.com/cosmos/interchain-security/v5/testutil/keeper" + "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" + providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "testing" + "time" +) + +func TestFetchAndIncrementConsumerId(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + consumerId := providerKeeper.FetchAndIncrementConsumerId(ctx) + require.Equal(t, "0", consumerId) + + consumerId = providerKeeper.FetchAndIncrementConsumerId(ctx) + require.Equal(t, "1", consumerId) + + consumerId = providerKeeper.FetchAndIncrementConsumerId(ctx) + require.Equal(t, "2", consumerId) +} + +// TestClientIdToConsumerId tests the getter, setter, and deletion methods of the client id to consumer id methods +func TestClientIdToConsumerId(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + _, found := providerKeeper.GetClientIdToConsumerId(ctx, "clientId") + require.False(t, found) + + providerKeeper.SetClientIdToConsumerId(ctx, "clientId", "consumerId") + consumerId, found := providerKeeper.GetClientIdToConsumerId(ctx, "clientId") + require.True(t, found) + require.Equal(t, "consumerId", consumerId) + + // assert that overwriting the current consumer id record works + providerKeeper.SetClientIdToConsumerId(ctx, "clientId", "consumerId2") + consumerId, found = providerKeeper.GetClientIdToConsumerId(ctx, "clientId") + require.True(t, found) + require.Equal(t, "consumerId2", consumerId) + + providerKeeper.DeleteClientIdToConsumerId(ctx, "clientId") + consumerId, found = providerKeeper.GetClientIdToConsumerId(ctx, "clientId") + require.False(t, found) + require.Equal(t, "", consumerId) +} + +// TestConsumerIdToRegistrationRecord tests the getter, setter, and deletion methods of the consumer id to registration record methods +func TestConsumerIdToRegistrationRecord(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + _, err := providerKeeper.GetConsumerMetadata(ctx, "consumerId") + require.Error(t, err) + + expectedRecord := providertypes.ConsumerMetadata{ + Name: "name", + Description: "description", + Metadata: "metadata", + //ChainId: "chain_id", + } + providerKeeper.SetConsumerMetadata(ctx, "consumerId", expectedRecord) + actualRecord, err := providerKeeper.GetConsumerMetadata(ctx, "consumerId") + require.NoError(t, err) + require.Equal(t, expectedRecord, actualRecord) + + // assert that overwriting the current registration record works + expectedRecord = providertypes.ConsumerMetadata{ + Name: "name 2", + Description: "description 2", + Metadata: "metadata 2", + //ChainId: "chain_id2", + } + providerKeeper.SetConsumerMetadata(ctx, "consumerId", expectedRecord) + actualRecord, err = providerKeeper.GetConsumerMetadata(ctx, "consumerId") + require.NoError(t, err) + require.Equal(t, expectedRecord, actualRecord) + + providerKeeper.DeleteConsumerMetadata(ctx, "consumerId") + actualRecord, err = providerKeeper.GetConsumerMetadata(ctx, "consumerId") + require.Error(t, err) + require.Equal(t, providertypes.ConsumerMetadata{}, actualRecord) +} + +// TestConsumerIdToInitializationRecord tests the getter, setter, and deletion methods of the consumer id to initialization record methods +func TestConsumerIdToInitializationRecord(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + _, err := providerKeeper.GetConsumerInitializationParameters(ctx, "consumerId") + require.Error(t, err) + + spawnTime := time.Unix(1, 2).UTC() + unbondingPeriod := time.Duration(3456) + ccvTimeoutPeriod := time.Duration(789) + transferTimeoutPeriod := time.Duration(101112) + expectedRecord := providertypes.ConsumerInitializationParameters{ + InitialHeight: types.Height{RevisionNumber: 1, RevisionHeight: 2}, + GenesisHash: []byte{0, 1}, + BinaryHash: []byte{2, 3}, + SpawnTime: spawnTime, + UnbondingPeriod: unbondingPeriod, + CcvTimeoutPeriod: ccvTimeoutPeriod, + TransferTimeoutPeriod: transferTimeoutPeriod, + ConsumerRedistributionFraction: "consumer_redistribution_fraction", + BlocksPerDistributionTransmission: 123, + HistoricalEntries: 456, + DistributionTransmissionChannel: "distribution_transmission_channel", + } + providerKeeper.SetConsumerInitializationParameters(ctx, "consumerId", expectedRecord) + actualRecord, err := providerKeeper.GetConsumerInitializationParameters(ctx, "consumerId") + require.NoError(t, err) + require.Equal(t, expectedRecord, actualRecord) + + // assert that overwriting the current initialization record works + spawnTime = time.Unix(2, 3).UTC() + unbondingPeriod = time.Duration(789) + ccvTimeoutPeriod = time.Duration(101112) + transferTimeoutPeriod = time.Duration(131415) + expectedRecord = providertypes.ConsumerInitializationParameters{ + InitialHeight: types.Height{RevisionNumber: 2, RevisionHeight: 3}, + GenesisHash: []byte{2, 3}, + BinaryHash: []byte{4, 5}, + SpawnTime: spawnTime, + UnbondingPeriod: unbondingPeriod, + CcvTimeoutPeriod: ccvTimeoutPeriod, + TransferTimeoutPeriod: transferTimeoutPeriod, + ConsumerRedistributionFraction: "consumer_redistribution_fraction2", + BlocksPerDistributionTransmission: 456, + HistoricalEntries: 789, + DistributionTransmissionChannel: "distribution_transmission_channel2", + } + providerKeeper.SetConsumerInitializationParameters(ctx, "consumerId", expectedRecord) + actualRecord, err = providerKeeper.GetConsumerInitializationParameters(ctx, "consumerId") + require.NoError(t, err) + require.Equal(t, expectedRecord, actualRecord) + + providerKeeper.DeleteConsumerInitializationParameters(ctx, "consumerId") + actualRecord, err = providerKeeper.GetConsumerInitializationParameters(ctx, "consumerId") + require.Error(t, err) + require.Equal(t, providertypes.ConsumerInitializationParameters{}, actualRecord) +} + +// TestConsumerIdToOwnerAddress tests the getter, setter, and deletion methods of the owner address to registration record methods +func TestConsumerIdToOwnerAddress(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + providerKeeper.SetConsumerOwnerAddress(ctx, "consumerId", "owner_address") + address, err := providerKeeper.GetConsumerOwnerAddress(ctx, "consumerId") + require.NoError(t, err) + require.Equal(t, "owner_address", address) + + // assert that overwriting the current owner address works + providerKeeper.SetConsumerOwnerAddress(ctx, "consumerId", "owner_address2") + address, err = providerKeeper.GetConsumerOwnerAddress(ctx, "consumerId") + require.NoError(t, err) + require.Equal(t, "owner_address2", address) +} + +// TestConsumerIdToPhase tests the getter, setter, and deletion methods of the consumer id to phase methods +func TestConsumerIdToPhase(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + _, found := providerKeeper.GetConsumerPhase(ctx, "consumerId") + require.False(t, found) + + providerKeeper.SetConsumerPhase(ctx, "consumerId", keeper.Initialized) + phase, found := providerKeeper.GetConsumerPhase(ctx, "consumerId") + require.True(t, found) + require.Equal(t, keeper.Initialized, phase) + + providerKeeper.SetConsumerPhase(ctx, "consumerId", keeper.Launched) + phase, found = providerKeeper.GetConsumerPhase(ctx, "consumerId") + require.True(t, found) + require.Equal(t, keeper.Launched, phase) +} + +// TestConsumerIdToStopTime tests the getter, setter, and deletion methods of the consumer id to stop times +func TestConsumerIdToStopTime(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + _, err := providerKeeper.GetConsumerStopTime(ctx, "consumerId") + require.Error(t, err) + + expectedStopTime := time.Unix(1234, 56789) + providerKeeper.SetConsumerStopTime(ctx, "consumerId", expectedStopTime) + actualStopTime, err := providerKeeper.GetConsumerStopTime(ctx, "consumerId") + require.NoError(t, err) + require.Equal(t, actualStopTime, expectedStopTime) + + providerKeeper.DeleteConsumerStopTime(ctx, "consumerId") + _, err = providerKeeper.GetConsumerStopTime(ctx, "consumerId") + require.Error(t, err) +} + +// TestGetInitializedConsumersReadyToLaunch tests that the ready to-be-launched consumer chains are returned +func TestGetInitializedConsumersReadyToLaunch(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + // no chains to-be-launched exist + require.Empty(t, providerKeeper.GetInitializedConsumersReadyToLaunch(ctx, 5)) + + providerKeeper.AppendSpawnTimeForConsumerToBeLaunched(ctx, "consumerId1", time.Unix(10, 0)) + providerKeeper.AppendSpawnTimeForConsumerToBeLaunched(ctx, "consumerId2", time.Unix(20, 0)) + providerKeeper.AppendSpawnTimeForConsumerToBeLaunched(ctx, "consumerId3", time.Unix(30, 0)) + + // time has not yet reached the spawn time of "consumerId1" + ctx = ctx.WithBlockTime(time.Unix(9, 999999999)) + require.Empty(t, providerKeeper.GetInitializedConsumersReadyToLaunch(ctx, 3)) + + // time has reached the spawn time of "consumerId1" + ctx = ctx.WithBlockTime(time.Unix(10, 0)) + require.Equal(t, []string{"consumerId1"}, providerKeeper.GetInitializedConsumersReadyToLaunch(ctx, 3)) + + // time has reached the spawn time of "consumerId1" and "consumerId2" + ctx = ctx.WithBlockTime(time.Unix(20, 0)) + require.Equal(t, []string{"consumerId1", "consumerId2"}, providerKeeper.GetInitializedConsumersReadyToLaunch(ctx, 3)) + + // time has reached the spawn time of all chains + ctx = ctx.WithBlockTime(time.Unix(30, 0)) + require.Equal(t, []string{"consumerId1", "consumerId2", "consumerId3"}, providerKeeper.GetInitializedConsumersReadyToLaunch(ctx, 3)) + + // limit the number of returned consumer chains + require.Equal(t, []string{}, providerKeeper.GetInitializedConsumersReadyToLaunch(ctx, 0)) + require.Equal(t, []string{"consumerId1"}, providerKeeper.GetInitializedConsumersReadyToLaunch(ctx, 1)) + require.Equal(t, []string{"consumerId1", "consumerId2"}, providerKeeper.GetInitializedConsumersReadyToLaunch(ctx, 2)) +} + +func TestGetLaunchedConsumersReadyToStop(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + // no chains to-be-stopped exist + require.Empty(t, providerKeeper.GetLaunchedConsumersReadyToStop(ctx, 3)) + + providerKeeper.AppendStopTimeForConsumerToBeStopped(ctx, "consumerId1", time.Unix(10, 0)) + providerKeeper.AppendStopTimeForConsumerToBeStopped(ctx, "consumerId2", time.Unix(20, 0)) + providerKeeper.AppendStopTimeForConsumerToBeStopped(ctx, "consumerId3", time.Unix(30, 0)) + + // time has not yet reached the stop time of "consumerId1" + ctx = ctx.WithBlockTime(time.Unix(9, 999999999)) + require.Empty(t, providerKeeper.GetLaunchedConsumersReadyToStop(ctx, 3)) + + // time has reached the stop time of "consumerId1" + ctx = ctx.WithBlockTime(time.Unix(10, 0)) + require.Equal(t, []string{"consumerId1"}, providerKeeper.GetLaunchedConsumersReadyToStop(ctx, 3)) + + // time has reached the stop time of "consumerId1" and "consumerId2" + ctx = ctx.WithBlockTime(time.Unix(20, 0)) + require.Equal(t, []string{"consumerId1", "consumerId2"}, providerKeeper.GetLaunchedConsumersReadyToStop(ctx, 3)) + + // time has reached the stop time of all chains + ctx = ctx.WithBlockTime(time.Unix(30, 0)) + require.Equal(t, []string{"consumerId1", "consumerId2", "consumerId3"}, providerKeeper.GetLaunchedConsumersReadyToStop(ctx, 3)) +} + +func TestIsValidatorOptedInToChain(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + chainId := "chainId" + providerAddr := providertypes.NewProviderConsAddress([]byte("providerAddr")) + _, found := providerKeeper.IsValidatorOptedInToChainId(ctx, providerAddr, chainId) + require.False(t, found) + + expectedConsumerId := "consumerId" + providerKeeper.SetConsumerChainId(ctx, expectedConsumerId, chainId) + providerKeeper.SetOptedIn(ctx, expectedConsumerId, providerAddr) + providerKeeper.AppendOptedInConsumerId(ctx, providerAddr, expectedConsumerId) + actualConsumerId, found := providerKeeper.IsValidatorOptedInToChainId(ctx, providerAddr, chainId) + require.True(t, found) + require.Equal(t, expectedConsumerId, actualConsumerId) +} + +func TestUpdateAllowlist(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + consumerId := "0" + + providerConsAddr1 := "cosmosvalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7xw4mceq" + consAddr1, _ := sdk.ConsAddressFromBech32(providerConsAddr1) + providerConsAddr2 := "cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39" + consAddr2, _ := sdk.ConsAddressFromBech32(providerConsAddr2) + + providerKeeper.UpdateAllowlist(ctx, consumerId, []string{providerConsAddr1, providerConsAddr2}) + + expectedAllowlist := []providertypes.ProviderConsAddress{ + providertypes.NewProviderConsAddress(consAddr1), + providertypes.NewProviderConsAddress(consAddr2)} + require.Equal(t, expectedAllowlist, providerKeeper.GetAllowList(ctx, consumerId)) +} + +func TestPopulateDenylist(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + consumerId := "0" + + providerConsAddr1 := "cosmosvalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7xw4mceq" + consAddr1, _ := sdk.ConsAddressFromBech32(providerConsAddr1) + providerConsAddr2 := "cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39" + consAddr2, _ := sdk.ConsAddressFromBech32(providerConsAddr2) + + providerKeeper.UpdateDenylist(ctx, consumerId, []string{providerConsAddr1, providerConsAddr2}) + + expectedDenylist := []providertypes.ProviderConsAddress{ + providertypes.NewProviderConsAddress(consAddr1), + providertypes.NewProviderConsAddress(consAddr2)} + require.Equal(t, expectedDenylist, providerKeeper.GetDenyList(ctx, consumerId)) +} + +func TestPopulateMinimumPowerInTopN(t *testing.T) { + providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + consumerId := "0" + + // test case where Top N is 0 in which case there's no minimum power in top N + providerKeeper.SetConsumerPowerShapingParameters(ctx, consumerId, providertypes.PowerShapingParameters{ + Top_N: 0, + }) + + err := providerKeeper.UpdateMinimumPowerInTopN(ctx, consumerId, 0, 0) + require.NoError(t, err) + _, found := providerKeeper.GetMinimumPowerInTopN(ctx, consumerId) + require.False(t, found) + + // test cases where Top N > 0 and for this we mock some validators + powers := []int64{10, 20, 30} + validators := []stakingtypes.Validator{ + createStakingValidator(ctx, mocks, 1, powers[0], 1), // this validator has ~16 of the total voting power + createStakingValidator(ctx, mocks, 2, powers[1], 2), // this validator has ~33% of the total voting gpower + createStakingValidator(ctx, mocks, 3, powers[2], 3), // this validator has 50% of the total voting power + } + mocks.MockStakingKeeper.EXPECT().GetBondedValidatorsByPower(gomock.Any()).Return(validators, nil).AnyTimes() + + maxProviderConsensusValidators := int64(3) + params := providerKeeper.GetParams(ctx) + params.MaxProviderConsensusValidators = maxProviderConsensusValidators + providerKeeper.SetParams(ctx, params) + + // when top N is 50, the minimum power is 30 (because top validator has to validate) + providerKeeper.SetConsumerPowerShapingParameters(ctx, consumerId, providertypes.PowerShapingParameters{ + Top_N: 50, + }) + err = providerKeeper.UpdateMinimumPowerInTopN(ctx, consumerId, 0, 50) + require.NoError(t, err) + minimumPowerInTopN, found := providerKeeper.GetMinimumPowerInTopN(ctx, consumerId) + require.True(t, found) + require.Equal(t, int64(30), minimumPowerInTopN) + + // when top N is 51, the minimum power is 20 (because top 2 validators have to validate) + providerKeeper.SetConsumerPowerShapingParameters(ctx, consumerId, providertypes.PowerShapingParameters{ + Top_N: 51, + }) + err = providerKeeper.UpdateMinimumPowerInTopN(ctx, consumerId, 50, 51) + require.NoError(t, err) + minimumPowerInTopN, found = providerKeeper.GetMinimumPowerInTopN(ctx, consumerId) + require.True(t, found) + require.Equal(t, int64(20), minimumPowerInTopN) + + // when top N is 100, the minimum power is 10 (that of the validator with the lowest power) + providerKeeper.SetConsumerPowerShapingParameters(ctx, consumerId, providertypes.PowerShapingParameters{ + Top_N: 100, + }) + err = providerKeeper.UpdateMinimumPowerInTopN(ctx, consumerId, 51, 100) + require.NoError(t, err) + minimumPowerInTopN, found = providerKeeper.GetMinimumPowerInTopN(ctx, consumerId) + require.True(t, found) + require.Equal(t, int64(10), minimumPowerInTopN) + +} diff --git a/x/ccv/provider/keeper/proposal.go b/x/ccv/provider/keeper/proposal.go index 9c2f620636..d13ad3d2bd 100644 --- a/x/ccv/provider/keeper/proposal.go +++ b/x/ccv/provider/keeper/proposal.go @@ -23,43 +23,6 @@ import ( ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" ) -// Wrapper for the new proposal message MsgConsumerAddition -// Will replace legacy handler HandleLegacyConsumerAdditionProposal -func (k Keeper) HandleConsumerAdditionProposal(ctx sdk.Context, proposal *types.MsgConsumerAddition) error { - p := types.ConsumerAdditionProposal{ - ChainId: proposal.ChainId, - InitialHeight: proposal.InitialHeight, - GenesisHash: proposal.GenesisHash, - BinaryHash: proposal.BinaryHash, - SpawnTime: proposal.SpawnTime, - UnbondingPeriod: proposal.UnbondingPeriod, - CcvTimeoutPeriod: proposal.CcvTimeoutPeriod, - TransferTimeoutPeriod: proposal.TransferTimeoutPeriod, - ConsumerRedistributionFraction: proposal.ConsumerRedistributionFraction, - BlocksPerDistributionTransmission: proposal.BlocksPerDistributionTransmission, - HistoricalEntries: proposal.HistoricalEntries, - DistributionTransmissionChannel: proposal.DistributionTransmissionChannel, - Top_N: proposal.Top_N, - ValidatorsPowerCap: proposal.ValidatorsPowerCap, - ValidatorSetCap: proposal.ValidatorSetCap, - Allowlist: proposal.Allowlist, - Denylist: proposal.Denylist, - } - - return k.HandleLegacyConsumerAdditionProposal(ctx, &p) -} - -// Wrapper for the new proposal message MsgConsumerRemoval -// Will replace legacy handler HandleLegacyConsumerRemovalProposal -func (k Keeper) HandleConsumerRemovalProposal(ctx sdk.Context, proposal *types.MsgConsumerRemoval) error { - p := types.ConsumerRemovalProposal{ - ChainId: proposal.ChainId, - StopTime: proposal.StopTime, - } - - return k.HandleLegacyConsumerRemovalProposal(ctx, &p) -} - // Wrapper for the new proposal message MsgChangeRewardDenoms // Will replace legacy handler HandleLegacyConsumerRewardDenomProposal func (k Keeper) HandleConsumerRewardDenomProposal(ctx sdk.Context, proposal *types.MsgChangeRewardDenoms) error { @@ -71,47 +34,35 @@ func (k Keeper) HandleConsumerRewardDenomProposal(ctx sdk.Context, proposal *typ return k.HandleLegacyConsumerRewardDenomProposal(ctx, &p) } -// HandleConsumerModificationProposal modifies a running consumer chain -func (k Keeper) HandleConsumerModificationProposal(ctx sdk.Context, proposal *types.MsgConsumerModification) error { - p := types.ConsumerModificationProposal{ - Title: proposal.Title, - Description: proposal.Description, - ChainId: proposal.ChainId, - Top_N: proposal.Top_N, - ValidatorsPowerCap: proposal.ValidatorsPowerCap, - ValidatorSetCap: proposal.ValidatorSetCap, - Allowlist: proposal.Allowlist, - Denylist: proposal.Denylist, - MinStake: proposal.MinStake, - AllowInactiveVals: proposal.AllowInactiveVals, +// CreateConsumerClient will create the CCV client for the given consumer chain. The CCV channel must be built +// on top of the CCV client to ensure connection with the right consumer chain. +func (k Keeper) CreateConsumerClient(ctx sdk.Context, consumerId string) error { + initializationRecord, err := k.GetConsumerInitializationParameters(ctx, consumerId) + if err != nil { + return err } - return k.HandleLegacyConsumerModificationProposal(ctx, &p) -} + phase, found := k.GetConsumerPhase(ctx, consumerId) + if !found || phase != Initialized { + return errorsmod.Wrapf(types.ErrInvalidPhase, + "cannot create client for consumer chain that is not in the Initialized phase: %s", consumerId) + } -// CreateConsumerClient will create the CCV client for the given consumer chain. The CCV channel must be built -// on top of the CCV client to ensure connection with the right consumer chain. -// -// See: https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/methods.md#ccv-pcf-crclient1 -// Spec tag: [CCV-PCF-CRCLIENT.1] -func (k Keeper) CreateConsumerClient(ctx sdk.Context, prop *types.ConsumerAdditionProposal) error { - chainID := prop.ChainId - // check that a client for this chain does not exist - if _, found := k.GetConsumerClientId(ctx, chainID); found { - return errorsmod.Wrap(types.ErrDuplicateConsumerChain, - fmt.Sprintf("cannot create client for existent consumer chain: %s", chainID)) + chainId, err := k.GetConsumerChainId(ctx, consumerId) + if err != nil { + return err } // Set minimum height for equivocation evidence from this consumer chain - k.SetEquivocationEvidenceMinHeight(ctx, chainID, prop.InitialHeight.RevisionHeight) + k.SetEquivocationEvidenceMinHeight(ctx, consumerId, initializationRecord.InitialHeight.RevisionHeight) // Consumers start out with the unbonding period from the consumer addition prop - consumerUnbondingPeriod := prop.UnbondingPeriod + consumerUnbondingPeriod := initializationRecord.UnbondingPeriod // Create client state by getting template client from parameters and filling in zeroed fields from proposal. clientState := k.GetTemplateClient(ctx) - clientState.ChainId = chainID - clientState.LatestHeight = prop.InitialHeight + clientState.ChainId = chainId + clientState.LatestHeight = initializationRecord.InitialHeight trustPeriod, err := ccv.CalculateTrustPeriod(consumerUnbondingPeriod, k.GetTrustingPeriodFraction(ctx)) if err != nil { @@ -120,11 +71,11 @@ func (k Keeper) CreateConsumerClient(ctx sdk.Context, prop *types.ConsumerAdditi clientState.TrustingPeriod = trustPeriod clientState.UnbondingPeriod = consumerUnbondingPeriod - consumerGen, validatorSetHash, err := k.MakeConsumerGenesis(ctx, prop) + consumerGen, validatorSetHash, err := k.MakeConsumerGenesis(ctx, consumerId) if err != nil { return err } - err = k.SetConsumerGenesis(ctx, chainID, consumerGen) + err = k.SetConsumerGenesis(ctx, consumerId, consumerGen) if err != nil { return err } @@ -140,20 +91,21 @@ func (k Keeper) CreateConsumerClient(ctx sdk.Context, prop *types.ConsumerAdditi if err != nil { return err } - k.SetConsumerClientId(ctx, chainID, clientID) + k.SetConsumerClientId(ctx, consumerId, clientID) + k.SetClientIdToConsumerId(ctx, clientID, consumerId) k.Logger(ctx).Info("consumer chain registered (client created)", - "chainID", chainID, - "clientID", clientID, + "consumer id", consumerId, + "client id", clientID, ) ctx.EventManager().EmitEvent( sdk.NewEvent( types.EventTypeConsumerClientCreated, sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), - sdk.NewAttribute(ccv.AttributeChainID, chainID), + sdk.NewAttribute(ccv.AttributeChainID, consumerId), sdk.NewAttribute(clienttypes.AttributeKeyClientID, clientID), - sdk.NewAttribute(types.AttributeInitialHeight, prop.InitialHeight.String()), + sdk.NewAttribute(types.AttributeInitialHeight, initializationRecord.InitialHeight.String()), sdk.NewAttribute(types.AttributeTrustingPeriod, clientState.TrustingPeriod.String()), sdk.NewAttribute(types.AttributeUnbondingPeriod, clientState.UnbondingPeriod.String()), ), @@ -162,29 +114,25 @@ func (k Keeper) CreateConsumerClient(ctx sdk.Context, prop *types.ConsumerAdditi return nil } -// StopConsumerChain cleans up the states for the given consumer chain ID and -// completes the outstanding unbonding operations on the consumer chain. -// -// This method implements StopConsumerChain from spec. -// See: https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/methods.md#ccv-pcf-stcc1 -// Spec tag: [CCV-PCF-STCC.1] -func (k Keeper) StopConsumerChain(ctx sdk.Context, chainID string, closeChan bool) (err error) { - // check that a client for chainID exists - if _, found := k.GetConsumerClientId(ctx, chainID); !found { +// StopConsumerChain cleans up the states for the given consumer id +func (k Keeper) StopConsumerChain(ctx sdk.Context, consumerId string, closeChan bool) (err error) { + // check that a client for consumerId exists + // TODO (PERMISSIONLESS): change to use phases instead + if _, found := k.GetConsumerClientId(ctx, consumerId); !found { return errorsmod.Wrap(types.ErrConsumerChainNotFound, - fmt.Sprintf("cannot stop non-existent consumer chain: %s", chainID)) + fmt.Sprintf("cannot stop non-existent consumer chain: %s", consumerId)) } // clean up states - k.DeleteConsumerClientId(ctx, chainID) - k.DeleteConsumerGenesis(ctx, chainID) + k.DeleteConsumerClientId(ctx, consumerId) + k.DeleteConsumerGenesis(ctx, consumerId) // Note: this call panics if the key assignment state is invalid - k.DeleteKeyAssignments(ctx, chainID) - k.DeleteMinimumPowerInTopN(ctx, chainID) - k.DeleteEquivocationEvidenceMinHeight(ctx, chainID) + k.DeleteKeyAssignments(ctx, consumerId) + k.DeleteMinimumPowerInTopN(ctx, consumerId) + k.DeleteEquivocationEvidenceMinHeight(ctx, consumerId) // close channel and delete the mappings between chain ID and channel ID - if channelID, found := k.GetChainToChannel(ctx, chainID); found { + if channelID, found := k.GetConsumerIdToChannelId(ctx, consumerId); found { if closeChan { // Close the channel for the given channel ID on the condition // that the channel exists and isn't already in the CLOSED state @@ -193,49 +141,67 @@ func (k Keeper) StopConsumerChain(ctx sdk.Context, chainID string, closeChan boo err := k.chanCloseInit(ctx, channelID) if err != nil { k.Logger(ctx).Error("channel to consumer chain could not be closed", - "chainID", chainID, + "consumerId", consumerId, "channelID", channelID, "error", err.Error(), ) } } } - k.DeleteChainToChannel(ctx, chainID) - k.DeleteChannelToChain(ctx, channelID) + k.DeleteConsumerIdToChannelId(ctx, consumerId) + k.DeleteChannelIdToConsumerId(ctx, channelID) } // delete consumer commission rate - provAddrs := k.GetAllCommissionRateValidators(ctx, chainID) + provAddrs := k.GetAllCommissionRateValidators(ctx, consumerId) for _, addr := range provAddrs { - k.DeleteConsumerCommissionRate(ctx, chainID, addr) + k.DeleteConsumerCommissionRate(ctx, consumerId, addr) } - k.DeleteInitChainHeight(ctx, chainID) - k.DeleteSlashAcks(ctx, chainID) - k.DeletePendingVSCPackets(ctx, chainID) + k.DeleteInitChainHeight(ctx, consumerId) + k.DeleteSlashAcks(ctx, consumerId) + k.DeletePendingVSCPackets(ctx, consumerId) - k.DeleteTopN(ctx, chainID) - k.DeleteValidatorsPowerCap(ctx, chainID) - k.DeleteValidatorSetCap(ctx, chainID) - k.DeleteAllowlist(ctx, chainID) - k.DeleteDenylist(ctx, chainID) - k.DeleteMinStake(ctx, chainID) - k.DisableInactiveValidators(ctx, chainID) + k.DeleteConsumerMetadata(ctx, consumerId) + k.DeleteConsumerPowerShapingParameters(ctx, consumerId) + k.DeleteConsumerPowerShapingParameters(ctx, consumerId) + k.DeleteAllowlist(ctx, consumerId) + k.DeleteDenylist(ctx, consumerId) + k.DeleteAllOptedIn(ctx, consumerId) + k.DeleteConsumerValSet(ctx, consumerId) - k.DeleteAllOptedIn(ctx, chainID) - k.DeleteConsumerValSet(ctx, chainID) + // TODO (PERMISSIONLESS) add newly-added state to be deleted - k.Logger(ctx).Info("consumer chain removed from provider", "chainID", chainID) + k.Logger(ctx).Info("consumer chain removed from provider", "consumerId", consumerId) return nil } -// MakeConsumerGenesis constructs the consumer CCV module part of the genesis state. +// MakeConsumerGenesis returns the created consumer genesis state for consumer chain `consumerId`, +// as well as the validator hash of the initial validator set of the consumer chain func (k Keeper) MakeConsumerGenesis( ctx sdk.Context, - prop *types.ConsumerAdditionProposal, + consumerId string, ) (gen ccv.ConsumerGenesisState, nextValidatorsHash []byte, err error) { - chainID := prop.ChainId + initializationRecord, err := k.GetConsumerInitializationParameters(ctx, consumerId) + if err != nil { + return gen, nil, errorsmod.Wrapf(types.ErrInvalidConsumerInitializationParameters, + "initialization record for consumer id: %s is missing", consumerId) + + } + powerShapingParameters, err := k.GetConsumerPowerShapingParameters(ctx, consumerId) + if err != nil { + powerShapingParameters = types.PowerShapingParameters{ + Top_N: 0, + ValidatorsPowerCap: 0, + ValidatorSetCap: 0, + Allowlist: []string{}, + Denylist: []string{}, + MinStake: 0, + AllowInactiveVals: false, + } + } + providerUnbondingPeriod, err := k.stakingKeeper.UnbondingTime(ctx) if err != nil { return gen, nil, errorsmod.Wrapf(types.ErrNoUnbondingTime, "unbonding time not found: %s", err) @@ -266,7 +232,7 @@ func (k Keeper) MakeConsumerGenesis( return gen, nil, errorsmod.Wrapf(stakingtypes.ErrNoValidatorFound, "error getting last bonded validators: %s", err) } - if prop.Top_N > 0 { + if powerShapingParameters.Top_N > 0 { // get the consensus active validators // we do not want to base the power calculation for the top N // on inactive validators, too, since the top N will be a percentage of the active set power @@ -277,22 +243,21 @@ func (k Keeper) MakeConsumerGenesis( } // in a Top-N chain, we automatically opt in all validators that belong to the top N - minPower, err := k.ComputeMinPowerInTopN(ctx, activeValidators, prop.Top_N) + minPower, err := k.ComputeMinPowerInTopN(ctx, activeValidators, powerShapingParameters.Top_N) if err != nil { return gen, nil, err } // log the minimum power in top N k.Logger(ctx).Info("minimum power in top N at consumer genesis", - "chainID", chainID, + "consumerId", consumerId, "minPower", minPower, ) - k.OptInTopNValidators(ctx, chainID, activeValidators, minPower) - k.SetMinimumPowerInTopN(ctx, chainID, minPower) + k.OptInTopNValidators(ctx, consumerId, activeValidators, minPower) + k.SetMinimumPowerInTopN(ctx, consumerId, minPower) } // need to use the bondedValidators, not activeValidators, here since the chain might be opt-in and allow inactive vals - nextValidators := k.ComputeNextValidators(ctx, chainID, bondedValidators) - - k.SetConsumerValSet(ctx, chainID, nextValidators) + nextValidators := k.ComputeNextValidators(ctx, consumerId, bondedValidators) + k.SetConsumerValSet(ctx, consumerId, nextValidators) // get the initial updates with the latest set consumer public keys initialUpdatesWithConsumerKeys := DiffValidators([]types.ConsensusValidator{}, nextValidators) @@ -306,14 +271,14 @@ func (k Keeper) MakeConsumerGenesis( consumerGenesisParams := ccv.NewParams( true, - prop.BlocksPerDistributionTransmission, - prop.DistributionTransmissionChannel, + initializationRecord.BlocksPerDistributionTransmission, + initializationRecord.DistributionTransmissionChannel, "", // providerFeePoolAddrStr, - prop.CcvTimeoutPeriod, - prop.TransferTimeoutPeriod, - prop.ConsumerRedistributionFraction, - prop.HistoricalEntries, - prop.UnbondingPeriod, + initializationRecord.CcvTimeoutPeriod, + initializationRecord.TransferTimeoutPeriod, + initializationRecord.ConsumerRedistributionFraction, + initializationRecord.HistoricalEntries, + initializationRecord.UnbondingPeriod, []string{}, []string{}, ccv.DefaultRetryDelayPeriod, @@ -331,7 +296,7 @@ func (k Keeper) MakeConsumerGenesis( // SetPendingConsumerAdditionProp stores a pending consumer addition proposal. // // Note that the pending consumer addition proposals are stored under keys with -// the following format: PendingCAPKeyPrefix | spawnTime | chainID +// the following format: PendingCAPKeyPrefix | spawnTime | consumerId // Thus, if multiple consumer addition proposal for the same chain will pass at // the same time, then only the last one will be stored. func (k Keeper) SetPendingConsumerAdditionProp(ctx sdk.Context, prop *types.ConsumerAdditionProposal) { @@ -366,76 +331,34 @@ func (k Keeper) GetPendingConsumerAdditionProp(ctx sdk.Context, spawnTime time.T return prop, true } -// BeginBlockInit iterates over the pending consumer addition proposals in order, and creates -// clients for props in which the spawn time has passed. Executed proposals are deleted. -// -// See: https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/methods.md#ccv-pcf-bblock-init1 -// Spec tag:[CCV-PCF-BBLOCK-INIT.1] +// BeginBlockInit iterates over the initialized consumers chains and creates clients for chains +// in which the spawn time has passed func (k Keeper) BeginBlockInit(ctx sdk.Context) { - propsToExecute := k.GetConsumerAdditionPropsToExecute(ctx) - - for i, prop := range propsToExecute { - // create consumer client in a cached context to handle errors - cachedCtx, writeFn := ctx.CacheContext() - - k.SetTopN(cachedCtx, prop.ChainId, prop.Top_N) - k.SetValidatorSetCap(cachedCtx, prop.ChainId, prop.ValidatorSetCap) - k.SetValidatorsPowerCap(cachedCtx, prop.ChainId, prop.ValidatorsPowerCap) - k.SetMinStake(cachedCtx, prop.ChainId, prop.MinStake) - k.SetInactiveValidatorsAllowed(cachedCtx, prop.ChainId, prop.AllowInactiveVals) - - for _, address := range prop.Allowlist { - consAddr, err := sdk.ConsAddressFromBech32(address) - if err != nil { - continue - } - - k.SetAllowlist(cachedCtx, prop.ChainId, types.NewProviderConsAddress(consAddr)) - } - - for _, address := range prop.Denylist { - consAddr, err := sdk.ConsAddressFromBech32(address) - if err != nil { - continue - } - - k.SetDenylist(cachedCtx, prop.ChainId, types.NewProviderConsAddress(consAddr)) - } - - err := k.CreateConsumerClient(cachedCtx, &propsToExecute[i]) + // TODO (PERMISSIONLESS): we can parameterize the limit + for _, consumerId := range k.GetInitializedConsumersReadyToLaunch(ctx, 200) { + record, err := k.GetConsumerInitializationParameters(ctx, consumerId) if err != nil { - // drop the proposal - ctx.Logger().Info("consumer client could not be created: %w", err) + ctx.Logger().Error("could not retrieve initialization record", + "consumerId", consumerId, + "error", err) continue } + // Remove consumer to prevent re-trying launching this chain. + // We would only try to re-launch this chain if a new `MsgUpdateConsumer` message is sent. + k.RemoveConsumerFromToBeLaunchedConsumers(ctx, consumerId, record.SpawnTime) - consumerGenesis, found := k.GetConsumerGenesis(cachedCtx, prop.ChainId) - if !found { - // drop the proposal - ctx.Logger().Info("consumer genesis could not be created") - continue - } - - if len(consumerGenesis.Provider.InitialValSet) == 0 { - // drop the proposal - ctx.Logger().Info("consumer genesis initial validator set is empty - no validators opted in") + cachedCtx, writeFn := ctx.CacheContext() + err = k.LaunchConsumer(cachedCtx, consumerId) + if err != nil { + ctx.Logger().Error("could not launch chain", + "consumerId", consumerId, + "error", err) continue } + k.SetConsumerPhase(cachedCtx, consumerId, Launched) - // The cached context is created with a new EventManager so we merge the event - // into the original context - ctx.EventManager().EmitEvents(cachedCtx.EventManager().Events()) - // write cache writeFn() - - k.Logger(ctx).Info("executed consumer addition proposal", - "chainID", prop.ChainId, - "title", prop.Title, - "spawn time", prop.SpawnTime.UTC(), - ) } - // delete the executed proposals - k.DeletePendingConsumerAdditionProps(ctx, propsToExecute...) } // GetConsumerAdditionPropsToExecute returns the pending consumer addition proposals @@ -471,9 +394,9 @@ func (k Keeper) GetConsumerAdditionPropsToExecute(ctx sdk.Context) (propsToExecu // GetAllPendingConsumerAdditionProps gets all pending consumer addition proposals. // // Note that the pending consumer addition proposals are stored under keys with the following format: -// PendingCAPKeyPrefix | spawnTime.UnixNano() | chainID +// PendingCAPKeyPrefix | spawnTime.UnixNano() | consumerId // Thus, the returned array is in spawnTime order. If two proposals have the same spawnTime, -// then they are ordered by chainID. +// then they are ordered by consumerId. func (k Keeper) GetAllPendingConsumerAdditionProps(ctx sdk.Context) (props []types.ConsumerAdditionProposal) { store := ctx.KVStore(k.storeKey) iterator := storetypes.KVStorePrefixIterator(store, types.PendingCAPKeyPrefix()) @@ -507,7 +430,7 @@ func (k Keeper) DeletePendingConsumerAdditionProps(ctx sdk.Context, proposals .. // SetPendingConsumerRemovalProp stores a pending consumer removal proposal. // // Note that the pending removal addition proposals are stored under keys with -// the following format: PendingCRPKeyPrefix | stopTime | chainID +// the following format: PendingCRPKeyPrefix | stopTime | consumerId // Thus, if multiple removal addition proposal for the same chain will pass at // the same time, then only the last one will be stored. func (k Keeper) SetPendingConsumerRemovalProp(ctx sdk.Context, prop *types.ConsumerRemovalProposal) { @@ -541,78 +464,84 @@ func (k Keeper) DeletePendingConsumerRemovalProps(ctx sdk.Context, proposals ... } } -// BeginBlockCCR iterates over the pending consumer removal proposals -// in order and stop/removes the chain if the stop time has passed, -// otherwise it will break out of loop and return. Executed proposals are deleted. -// -// See: https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/methods.md#ccv-pcf-bblock-ccr1 -// Spec tag: [CCV-PCF-BBLOCK-CCR.1] +// BeginBlockCCR iterates over the pending consumer proposals and stop/removes the chain if the stop time has passed func (k Keeper) BeginBlockCCR(ctx sdk.Context) { - propsToExecute := k.GetConsumerRemovalPropsToExecute(ctx) - - for _, prop := range propsToExecute { + // TODO (PERMISSIONLESS): parameterize the limit + for _, consumerId := range k.GetLaunchedConsumersReadyToStop(ctx, 200) { // stop consumer chain in a cached context to handle errors - cachedCtx, writeFn, err := k.StopConsumerChainInCachedCtx(ctx, prop) + cachedCtx, writeFn := ctx.CacheContext() + + stopTime, err := k.GetConsumerStopTime(ctx, consumerId) + if err != nil { + k.Logger(ctx).Info("chain could not be stopped", + "consumerId", consumerId, + "err", err.Error()) + continue + } + + err = k.StopConsumerChain(cachedCtx, consumerId, true) if err != nil { - // drop the proposal - ctx.Logger().Info("consumer chain could not be stopped: %w", err) + k.Logger(ctx).Info("consumer chain could not be stopped", + "consumerId", consumerId, + "err", err.Error()) continue } // The cached context is created with a new EventManager so we merge the event // into the original context + // TODO (PERMISSIONLESS): verify this here and in the initialized chains to launch ctx.EventManager().EmitEvents(cachedCtx.EventManager().Events()) - // write cache + + k.SetConsumerPhase(cachedCtx, consumerId, Stopped) + k.RemoveConsumerFromToBeStoppedConsumers(ctx, consumerId, stopTime) writeFn() - k.Logger(ctx).Info("executed consumer removal proposal", - "chainID", prop.ChainId, - "title", prop.Title, - "stop time", prop.StopTime.UTC(), + k.Logger(ctx).Info("executed consumer removal", + "consumer id", consumerId, + "stop time", stopTime, ) } - // delete the executed proposals - k.DeletePendingConsumerRemovalProps(ctx, propsToExecute...) } -// GetConsumerRemovalPropsToExecute iterates over the pending consumer removal proposals -// and returns an ordered list of consumer removal proposals to be executed, -// ie. consumer chains to be stopped and removed from the provider chain. -// A prop is included in the returned list if its proposed stop time has passed. +// TODO (PERMISSIONLESS): leaving commented out because it might be used for migration +//// GetConsumerRemovalPropsToExecute iterates over the pending consumer removal proposals +//// and returns an ordered list of consumer removal proposals to be executed, +//// ie. consumer chains to be stopped and removed from the provider chain. +//// A prop is included in the returned list if its proposed stop time has passed. +//// +//// Note: this method is split out from BeginBlockCCR to be easily unit tested. +//func (k Keeper) GetConsumerRemovalPropsToExecute(ctx sdk.Context) []types.ConsumerRemovalProposal { +// // store the (to be) executed consumer removal proposals in order +// propsToExecute := []types.ConsumerRemovalProposal{} // -// Note: this method is split out from BeginBlockCCR to be easily unit tested. -func (k Keeper) GetConsumerRemovalPropsToExecute(ctx sdk.Context) []types.ConsumerRemovalProposal { - // store the (to be) executed consumer removal proposals in order - propsToExecute := []types.ConsumerRemovalProposal{} - - store := ctx.KVStore(k.storeKey) - iterator := storetypes.KVStorePrefixIterator(store, types.PendingCRPKeyPrefix()) - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - var prop types.ConsumerRemovalProposal - err := prop.Unmarshal(iterator.Value()) - if err != nil { - // An error here would indicate something is very wrong, - // the ConsumerRemovalProposal is assumed to be correctly serialized in SetPendingConsumerRemovalProp. - panic(fmt.Errorf("failed to unmarshal consumer removal proposal: %w", err)) - } - - // If current block time is equal to or after stop time, proposal is ready to be executed - if !ctx.BlockTime().Before(prop.StopTime) { - propsToExecute = append(propsToExecute, prop) - } else { - // No more proposals to check, since they're stored/ordered by timestamp. - break - } - } - - return propsToExecute -} +// store := ctx.KVStore(k.storeKey) +// iterator := storetypes.KVStorePrefixIterator(store, types.PendingCRPKeyPrefix()) +// defer iterator.Close() +// +// for ; iterator.Valid(); iterator.Next() { +// var prop types.ConsumerRemovalProposal +// err := prop.Unmarshal(iterator.Value()) +// if err != nil { +// // An error here would indicate something is very wrong, +// // the ConsumerRemovalProposal is assumed to be correctly serialized in SetPendingConsumerRemovalProp. +// panic(fmt.Errorf("failed to unmarshal consumer removal proposal: %w", err)) +// } +// +// // If current block time is equal to or after stop time, proposal is ready to be executed +// if !ctx.BlockTime().Before(prop.StopTime) { +// propsToExecute = append(propsToExecute, prop) +// } else { +// // No more proposals to check, since they're stored/ordered by timestamp. +// break +// } +// } +// +// return propsToExecute +//} // GetAllPendingConsumerRemovalProps iterates through the pending consumer removal proposals. // // Note that the pending consumer removal proposals are stored under keys with the following format: -// PendingCRPKeyPrefix | stopTime.UnixNano() | chainID +// PendingCRPKeyPrefix | stopTime.UnixNano() | consumerId // Thus, the returned array is in stopTime order. func (k Keeper) GetAllPendingConsumerRemovalProps(ctx sdk.Context) (props []types.ConsumerRemovalProposal) { store := ctx.KVStore(k.storeKey) @@ -634,14 +563,6 @@ func (k Keeper) GetAllPendingConsumerRemovalProps(ctx sdk.Context) (props []type return props } -// CreateConsumerClientInCachedCtx creates a consumer client -// from a given consumer addition proposal in a cached context -func (k Keeper) CreateConsumerClientInCachedCtx(ctx sdk.Context, p types.ConsumerAdditionProposal) (cc sdk.Context, writeCache func(), err error) { - cc, writeCache = ctx.CacheContext() - err = k.CreateConsumerClient(cc, &p) - return -} - // StopConsumerChainInCachedCtx stop a consumer chain // from a given consumer removal proposal in a cached context func (k Keeper) StopConsumerChainInCachedCtx(ctx sdk.Context, p types.ConsumerRemovalProposal) (cc sdk.Context, writeCache func(), err error) { diff --git a/x/ccv/provider/keeper/proposal_test.go b/x/ccv/provider/keeper/proposal_test.go index 472cb3c64c..1aef84957f 100644 --- a/x/ccv/provider/keeper/proposal_test.go +++ b/x/ccv/provider/keeper/proposal_test.go @@ -3,6 +3,8 @@ package keeper_test import ( "bytes" "encoding/json" + "fmt" + cryptotestutil "github.com/cosmos/interchain-security/v5/testutil/crypto" "sort" "testing" "time" @@ -19,7 +21,6 @@ import ( abci "github.com/cometbft/cometbft/abci/types" sdk "github.com/cosmos/cosmos-sdk/types" - cryptotestutil "github.com/cosmos/interchain-security/v5/testutil/crypto" testkeeper "github.com/cosmos/interchain-security/v5/testutil/keeper" providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" @@ -30,128 +31,8 @@ import ( // Initialization sub-protocol related tests of proposal.go // -// Tests the HandleConsumerAdditionProposal method against the SpawnConsumerChainProposalHandler spec. -// See: https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/methods.md#ccv-pcf-hcaprop1 -// Spec tag: [CCV-PCF-HCAPROP.1] -func TestHandleConsumerAdditionProposal(t *testing.T) { - type testCase struct { - description string - malleate func(ctx sdk.Context, k providerkeeper.Keeper, chainID string) - prop *providertypes.ConsumerAdditionProposal - // Time when prop is handled - blockTime time.Time - // Whether it's expected that the proposal is successfully verified - // and appended to the pending proposals - expAppendProp bool - } - - // Snapshot times asserted in tests - now := time.Now().UTC() - - tests := []testCase{ - { - description: "expect to append valid proposal", - malleate: func(ctx sdk.Context, k providerkeeper.Keeper, chainID string) {}, - prop: providertypes.NewConsumerAdditionProposal( - "title", - "description", - "chainID", - clienttypes.NewHeight(2, 3), - []byte("gen_hash"), - []byte("bin_hash"), - now, // Spawn time - "0.75", - 10, - "", - 10000, - 100000000000, - 100000000000, - 100000000000, - 0, - 0, - 0, - nil, - nil, - 0, - false, - ).(*providertypes.ConsumerAdditionProposal), - blockTime: now, - expAppendProp: true, - }, - { - description: "expect to not append invalid proposal using an already existing chain id", - malleate: func(ctx sdk.Context, k providerkeeper.Keeper, chainID string) { - k.SetConsumerClientId(ctx, chainID, "anyClientId") - }, - - prop: providertypes.NewConsumerAdditionProposal( - "title", - "description", - "chainID", - clienttypes.NewHeight(2, 3), - []byte("gen_hash"), - []byte("bin_hash"), - now, - "0.75", - 10, - "", - 10000, - 100000000000, - 100000000000, - 100000000000, - 0, - 0, - 0, - nil, - nil, - 0, - false, - ).(*providertypes.ConsumerAdditionProposal), - blockTime: now, - expAppendProp: false, - }, - } - - for _, tc := range tests { - // Common setup - keeperParams := testkeeper.NewInMemKeeperParams(t) - providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, keeperParams) - providerKeeper.SetParams(ctx, providertypes.DefaultParams()) - ctx = ctx.WithBlockTime(tc.blockTime) - - if tc.expAppendProp { - // Mock calls are only asserted if we expect a client to be created. - testkeeper.SetupMocksForLastBondedValidatorsExpectation(mocks.MockStakingKeeper, 0, []stakingtypes.Validator{}, 1) // returns empty validator set - gomock.InOrder( - testkeeper.GetMocksForCreateConsumerClient(ctx, &mocks, tc.prop.ChainId, clienttypes.NewHeight(2, 3))..., - ) - } - - tc.malleate(ctx, providerKeeper, tc.prop.ChainId) - - err := providerKeeper.HandleLegacyConsumerAdditionProposal(ctx, tc.prop) - - if tc.expAppendProp { - require.NoError(t, err) - // check that prop was added to the stored pending props - gotProposal, found := providerKeeper.GetPendingConsumerAdditionProp(ctx, tc.prop.SpawnTime, tc.prop.ChainId) - require.True(t, found) - require.Equal(t, *tc.prop, gotProposal) - } else { - require.Error(t, err) - // check that prop wasn't added to the stored pending props - _, found := providerKeeper.GetPendingConsumerAdditionProp(ctx, tc.prop.SpawnTime, tc.prop.ChainId) - require.False(t, found) - } - - ctrl.Finish() - } -} - // Tests the CreateConsumerClient method against the spec, // with more granularity than what's covered in TestHandleCreateConsumerChainProposal. -// See: https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/methods.md#ccv-pcf-crclient1 -// Spec tag: [CCV-PCF-CRCLIENT.1] func TestCreateConsumerClient(t *testing.T) { type testCase struct { description string @@ -164,6 +45,8 @@ func TestCreateConsumerClient(t *testing.T) { { description: "No state mutation, new client should be created", setup: func(providerKeeper *providerkeeper.Keeper, ctx sdk.Context, mocks *testkeeper.MockedKeepers) { + providerKeeper.SetConsumerPhase(ctx, "0", providerkeeper.Initialized) + // Valid client creation is asserted with mock expectations here testkeeper.SetupMocksForLastBondedValidatorsExpectation(mocks.MockStakingKeeper, 0, []stakingtypes.Validator{}, 1) // returns empty validator set gomock.InOrder( @@ -173,9 +56,9 @@ func TestCreateConsumerClient(t *testing.T) { expClientCreated: true, }, { - description: "client for this chain already exists, new one is not created", + description: "chain for this consumer id has already launched, and hence client was created, NO new one is created", setup: func(providerKeeper *providerkeeper.Keeper, ctx sdk.Context, mocks *testkeeper.MockedKeepers) { - providerKeeper.SetConsumerClientId(ctx, "chainID", "clientID") + providerKeeper.SetConsumerPhase(ctx, "0", providerkeeper.Launched) // Expect none of the client creation related calls to happen mocks.MockStakingKeeper.EXPECT().UnbondingTime(gomock.Any()).Times(0) @@ -197,11 +80,15 @@ func TestCreateConsumerClient(t *testing.T) { tc.setup(&providerKeeper, ctx, &mocks) // Call method with same arbitrary values as defined above in mock expectations. - err := providerKeeper.CreateConsumerClient(ctx, testkeeper.GetTestConsumerAdditionProp()) + providerKeeper.SetConsumerChainId(ctx, "0", "chainID") + providerKeeper.SetConsumerMetadata(ctx, "0", testkeeper.GetTestConsumerMetadata()) + providerKeeper.SetConsumerInitializationParameters(ctx, "0", testkeeper.GetTestInitializationParameters()) + providerKeeper.SetConsumerPowerShapingParameters(ctx, "0", testkeeper.GetTestPowerShapingParameters()) + err := providerKeeper.CreateConsumerClient(ctx, "0") if tc.expClientCreated { require.NoError(t, err) - testCreatedConsumerClient(t, ctx, providerKeeper, "chainID", "clientID") + testCreatedConsumerClient(t, ctx, providerKeeper, "0", "clientID") } else { require.Error(t, err) } @@ -215,17 +102,17 @@ func TestCreateConsumerClient(t *testing.T) { // // Note: Separated from TestCreateConsumerClient to also be called from TestCreateConsumerChainProposal. func testCreatedConsumerClient(t *testing.T, - ctx sdk.Context, providerKeeper providerkeeper.Keeper, expectedChainID, expectedClientID string, + ctx sdk.Context, providerKeeper providerkeeper.Keeper, consumerId, expectedClientID string, ) { t.Helper() // ClientID should be stored. - clientId, found := providerKeeper.GetConsumerClientId(ctx, expectedChainID) + clientId, found := providerKeeper.GetConsumerClientId(ctx, consumerId) require.True(t, found, "consumer client not found") require.Equal(t, expectedClientID, clientId) // Only assert that consumer genesis was set, // more granular tests on consumer genesis should be defined in TestMakeConsumerGenesis - _, ok := providerKeeper.GetConsumerGenesis(ctx, expectedChainID) + _, ok := providerKeeper.GetConsumerGenesis(ctx, consumerId) require.True(t, ok) } @@ -398,7 +285,7 @@ func TestStopConsumerChain(t *testing.T) { expErr bool } - consumerCID := "chainID" + consumerId := "0" tests := []testCase{ { @@ -411,10 +298,10 @@ func TestStopConsumerChain(t *testing.T) { { description: "valid stop of consumer chain, all mock calls hit", setup: func(ctx sdk.Context, providerKeeper *providerkeeper.Keeper, mocks testkeeper.MockedKeepers) { - testkeeper.SetupForStoppingConsumerChain(t, ctx, providerKeeper, mocks) + testkeeper.SetupForStoppingConsumerChain(t, ctx, providerKeeper, mocks, consumerId) // set consumer minimum equivocation height - providerKeeper.SetEquivocationEvidenceMinHeight(ctx, consumerCID, 1) + providerKeeper.SetEquivocationEvidenceMinHeight(ctx, consumerId, 1) // assert mocks for expected calls to `StopConsumerChain` when closing the underlying channel gomock.InOrder(testkeeper.GetMocksForStopConsumerChainWithCloseChannel(ctx, &mocks)...) @@ -433,134 +320,94 @@ func TestStopConsumerChain(t *testing.T) { // Setup specific to test case tc.setup(ctx, &providerKeeper, mocks) - err := providerKeeper.StopConsumerChain(ctx, consumerCID, true) + err := providerKeeper.StopConsumerChain(ctx, consumerId, true) if tc.expErr { - require.Error(t, err) + require.Error(t, err, t) } else { require.NoError(t, err) } - testkeeper.TestProviderStateIsCleanedAfterConsumerChainIsStopped(t, ctx, providerKeeper, consumerCID, "channelID") + testkeeper.TestProviderStateIsCleanedAfterConsumerChainIsStopped(t, ctx, providerKeeper, consumerId, "channelID") ctrl.Finish() } } -// TestPendingConsumerRemovalPropDeletion tests the getting/setting -// and deletion methods for pending consumer removal props -func TestPendingConsumerRemovalPropDeletion(t *testing.T) { - testCases := []struct { - providertypes.ConsumerRemovalProposal - ExpDeleted bool - }{ - { - ConsumerRemovalProposal: providertypes.ConsumerRemovalProposal{ChainId: "8", StopTime: time.Now().UTC()}, - ExpDeleted: true, - }, - { - ConsumerRemovalProposal: providertypes.ConsumerRemovalProposal{ChainId: "9", StopTime: time.Now().UTC().Add(time.Hour)}, - ExpDeleted: false, - }, - } - providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - defer ctrl.Finish() - - for _, tc := range testCases { - tc := tc - providerKeeper.SetPendingConsumerRemovalProp(ctx, &tc.ConsumerRemovalProposal) - } - - ctx = ctx.WithBlockTime(time.Now().UTC()) - - propsToExecute := providerKeeper.GetConsumerRemovalPropsToExecute(ctx) - // Delete consumer removal proposals, same as what would be done by BeginBlockCCR - providerKeeper.DeletePendingConsumerRemovalProps(ctx, propsToExecute...) - numDeleted := 0 - for _, tc := range testCases { - res := providerKeeper.PendingConsumerRemovalPropExists(ctx, tc.ChainId, tc.StopTime) - if !tc.ExpDeleted { - require.NotEmpty(t, res, "consumer removal prop was deleted: %s %s", tc.ChainId, tc.StopTime.String()) - continue - } - require.Empty(t, res, "consumer removal prop was not deleted %s %s", tc.ChainId, tc.StopTime.String()) - require.Equal(t, propsToExecute[numDeleted].ChainId, tc.ChainId) - numDeleted += 1 - } -} - +// TODO (PERMISSIONLESS) +// WE DO NOT go by order in permissionless (?) DO WE need to? // TestGetConsumerRemovalPropsToExecute tests that pending consumer removal proposals // that are ready to execute are accessed in order by timestamp via the iterator -func TestGetConsumerRemovalPropsToExecute(t *testing.T) { - now := time.Now().UTC() - sampleProp1 := providertypes.ConsumerRemovalProposal{ChainId: "chain-2", StopTime: now} - sampleProp2 := providertypes.ConsumerRemovalProposal{ChainId: "chain-1", StopTime: now.Add(time.Hour)} - sampleProp3 := providertypes.ConsumerRemovalProposal{ChainId: "chain-4", StopTime: now.Add(-time.Hour)} - sampleProp4 := providertypes.ConsumerRemovalProposal{ChainId: "chain-3", StopTime: now} - sampleProp5 := providertypes.ConsumerRemovalProposal{ChainId: "chain-1", StopTime: now.Add(2 * time.Hour)} - - getExpectedOrder := func(props []providertypes.ConsumerRemovalProposal, accessTime time.Time) []providertypes.ConsumerRemovalProposal { - expectedOrder := []providertypes.ConsumerRemovalProposal{} - for _, prop := range props { - if !accessTime.Before(prop.StopTime) { - expectedOrder = append(expectedOrder, prop) - } - } - // sorting by SpawnTime.UnixNano() - sort.Slice(expectedOrder, func(i, j int) bool { - if expectedOrder[i].StopTime.UTC() == expectedOrder[j].StopTime.UTC() { - // proposals with same StopTime - return expectedOrder[i].ChainId < expectedOrder[j].ChainId - } - return expectedOrder[i].StopTime.UTC().Before(expectedOrder[j].StopTime.UTC()) - }) - return expectedOrder - } - - testCases := []struct { - propSubmitOrder []providertypes.ConsumerRemovalProposal - accessTime time.Time - }{ - { - propSubmitOrder: []providertypes.ConsumerRemovalProposal{ - sampleProp1, sampleProp2, sampleProp3, sampleProp4, sampleProp5, - }, - accessTime: now, - }, - { - propSubmitOrder: []providertypes.ConsumerRemovalProposal{ - sampleProp3, sampleProp2, sampleProp1, sampleProp5, sampleProp4, - }, - accessTime: now.Add(time.Hour), - }, - { - propSubmitOrder: []providertypes.ConsumerRemovalProposal{ - sampleProp5, sampleProp4, sampleProp3, sampleProp2, sampleProp1, - }, - accessTime: now.Add(-2 * time.Hour), - }, - { - propSubmitOrder: []providertypes.ConsumerRemovalProposal{ - sampleProp5, sampleProp4, sampleProp3, sampleProp2, sampleProp1, - }, - accessTime: now.Add(3 * time.Hour), - }, - } - - for _, tc := range testCases { - providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - defer ctrl.Finish() - - expectedOrderedProps := getExpectedOrder(tc.propSubmitOrder, tc.accessTime) - - for _, prop := range tc.propSubmitOrder { - cpProp := prop - providerKeeper.SetPendingConsumerRemovalProp(ctx, &cpProp) - } - propsToExecute := providerKeeper.GetConsumerRemovalPropsToExecute(ctx.WithBlockTime(tc.accessTime)) - require.Equal(t, expectedOrderedProps, propsToExecute) - } -} +//func TestGetConsumerRemovalPropsToExecute(t *testing.T) { +// now := time.Now().UTC() +// sampleProp1 := providertypes.ConsumerRemovalProposal{ConsumerId: "chain-2", StopTime: now} +// sampleProp2 := providertypes.ConsumerRemovalProposal{ConsumerId: "chain-1", StopTime: now.Add(time.Hour)} +// sampleProp3 := providertypes.ConsumerRemovalProposal{ConsumerId: "chain-4", StopTime: now.Add(-time.Hour)} +// sampleProp4 := providertypes.ConsumerRemovalProposal{ConsumerId: "chain-3", StopTime: now} +// sampleProp5 := providertypes.ConsumerRemovalProposal{ConsumerId: "chain-1", StopTime: now.Add(2 * time.Hour)} +// +// getExpectedOrder := func(props []providertypes.ConsumerRemovalProposal, accessTime time.Time) []providertypes.ConsumerRemovalProposal { +// expectedOrder := []providertypes.ConsumerRemovalProposal{} +// for _, prop := range props { +// if !accessTime.Before(prop.StopTime) { +// expectedOrder = append(expectedOrder, prop) +// } +// } +// // sorting by SpawnTime.UnixNano() +// sort.Slice(expectedOrder, func(i, j int) bool { +// if expectedOrder[i].StopTime.UTC() == expectedOrder[j].StopTime.UTC() { +// // proposals with same StopTime +// return expectedOrder[i].ConsumerId < expectedOrder[j].ConsumerId +// } +// return expectedOrder[i].StopTime.UTC().Before(expectedOrder[j].StopTime.UTC()) +// }) +// return expectedOrder +// } +// +// testCases := []struct { +// propSubmitOrder []providertypes.ConsumerRemovalProposal +// accessTime time.Time +// }{ +// { +// propSubmitOrder: []providertypes.ConsumerRemovalProposal{ +// sampleProp1, sampleProp2, sampleProp3, sampleProp4, sampleProp5, +// }, +// accessTime: now, +// }, +// { +// propSubmitOrder: []providertypes.ConsumerRemovalProposal{ +// sampleProp3, sampleProp2, sampleProp1, sampleProp5, sampleProp4, +// }, +// accessTime: now.Add(time.Hour), +// }, +// { +// propSubmitOrder: []providertypes.ConsumerRemovalProposal{ +// sampleProp5, sampleProp4, sampleProp3, sampleProp2, sampleProp1, +// }, +// accessTime: now.Add(-2 * time.Hour), +// }, +// { +// propSubmitOrder: []providertypes.ConsumerRemovalProposal{ +// sampleProp5, sampleProp4, sampleProp3, sampleProp2, sampleProp1, +// }, +// accessTime: now.Add(3 * time.Hour), +// }, +// } +// +// for _, tc := range testCases { +// providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) +// defer ctrl.Finish() +// +// expectedOrderedProps := getExpectedOrder(tc.propSubmitOrder, tc.accessTime) +// +// for _, prop := range tc.propSubmitOrder { +// cpProp := prop +// providerKeeper.SetPendingConsumerRemovalProp(ctx, &cpProp) +// } +// propsToExecute := providerKeeper.GetConsumerRemovalPropsToExecute(ctx.WithBlockTime(tc.accessTime)) +// require.Equal(t, expectedOrderedProps, propsToExecute) +// } +//} // Test getting both matured and pending consumer removal proposals func TestGetAllConsumerRemovalProps(t *testing.T) { @@ -669,24 +516,33 @@ func TestMakeConsumerGenesis(t *testing.T) { // // Other setup not covered by custom template client state // - ctx = ctx.WithChainID("testchain1") // chainID is obtained from ctx + ctx = ctx.WithChainID("testchain1") // consumerId is obtained from ctx ctx = ctx.WithBlockHeight(5) // RevisionHeight obtained from ctx testkeeper.SetupMocksForLastBondedValidatorsExpectation(mocks.MockStakingKeeper, 0, []stakingtypes.Validator{}, 1) gomock.InOrder(testkeeper.GetMocksForMakeConsumerGenesis(ctx, &mocks, 1814400000000000)...) // matches params from jsonString - prop := providertypes.ConsumerAdditionProposal{ - Title: "title", - Description: "desc", - ChainId: "testchain1", + consumerMetadata := providertypes.ConsumerMetadata{ + Name: "name", + Description: "description", + } + + ccvTimeoutPeriod := time.Duration(2419200000000000) + transferTimeoutPeriod := time.Duration(3600000000000) + unbondingPeriod := time.Duration(1728000000000000) + initializationParameters := providertypes.ConsumerInitializationParameters{ BlocksPerDistributionTransmission: 1000, - CcvTimeoutPeriod: 2419200000000000, - TransferTimeoutPeriod: 3600000000000, + CcvTimeoutPeriod: ccvTimeoutPeriod, + TransferTimeoutPeriod: transferTimeoutPeriod, ConsumerRedistributionFraction: "0.75", HistoricalEntries: 10000, - UnbondingPeriod: 1728000000000000, + UnbondingPeriod: unbondingPeriod, } - actualGenesis, _, err := providerKeeper.MakeConsumerGenesis(ctx, &prop) + providerKeeper.SetConsumerChainId(ctx, "0", "testchain1") + providerKeeper.SetConsumerMetadata(ctx, "0", consumerMetadata) + providerKeeper.SetConsumerInitializationParameters(ctx, "0", initializationParameters) + + actualGenesis, _, err := providerKeeper.MakeConsumerGenesis(ctx, "0") require.NoError(t, err) // JSON string with tabs, newlines and spaces for readability @@ -788,9 +644,6 @@ func TestMakeConsumerGenesis(t *testing.T) { } // TestBeginBlockInit directly tests BeginBlockInit against the spec using helpers defined above. -// -// See: https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/methods.md#ccv-pcf-bblock-init1 -// Spec tag:[CCV-PCF-BBLOCK-INIT.1] func TestBeginBlockInit(t *testing.T) { now := time.Now().UTC() @@ -800,130 +653,162 @@ func TestBeginBlockInit(t *testing.T) { defer ctrl.Finish() ctx = ctx.WithBlockTime(now) - pendingProps := []*providertypes.ConsumerAdditionProposal{ - providertypes.NewConsumerAdditionProposal( - "title", "spawn time passed", "chain1", clienttypes.NewHeight(3, 4), []byte{}, []byte{}, - now.Add(-time.Hour*2).UTC(), - "0.75", - 10, - "", - 10000, - 100000000000, - 100000000000, - 100000000000, - 50, - 0, - 0, - nil, - nil, - 0, - false, - ).(*providertypes.ConsumerAdditionProposal), - providertypes.NewConsumerAdditionProposal( - "title", "spawn time passed", "chain2", clienttypes.NewHeight(3, 4), []byte{}, []byte{}, - now.Add(-time.Hour*1).UTC(), - "0.75", - 10, - "", - 10000, - 100000000000, - 100000000000, - 100000000000, - 50, - 0, - 0, - nil, - nil, - 0, - false, - ).(*providertypes.ConsumerAdditionProposal), - providertypes.NewConsumerAdditionProposal( - "title", "spawn time not passed", "chain3", clienttypes.NewHeight(3, 4), []byte{}, []byte{}, - now.Add(time.Hour).UTC(), - "0.75", - 10, - "", - 10000, - 100000000000, - 100000000000, - 100000000000, - 50, - 0, - 0, - nil, - nil, - 0, - false, - ).(*providertypes.ConsumerAdditionProposal), - providertypes.NewConsumerAdditionProposal( - "title", "invalid proposal: chain id already exists", "chain2", clienttypes.NewHeight(4, 5), []byte{}, []byte{}, - now.UTC(), - "0.75", - 10, - "", - 10000, - 100000000000, - 100000000000, - 100000000000, - 50, - 0, - 0, - nil, - nil, - 0, - false, - ).(*providertypes.ConsumerAdditionProposal), - providertypes.NewConsumerAdditionProposal( - "title", "opt-in chain with at least one validator opted in", "chain5", clienttypes.NewHeight(3, 4), []byte{}, []byte{}, - now.Add(-time.Hour*1).UTC(), - "0.75", - 10, - "", - 10000, - 100000000000, - 100000000000, - 100000000000, - 0, - 0, - 0, - nil, - nil, - 0, - false, - ).(*providertypes.ConsumerAdditionProposal), - providertypes.NewConsumerAdditionProposal( - "title", "opt-in chain with no validator opted in", "chain6", clienttypes.NewHeight(3, 4), []byte{}, []byte{}, - now.Add(-time.Minute).UTC(), - "0.75", - 10, - "", - 10000, - 100000000000, - 100000000000, - 100000000000, - 0, - 0, - 0, - nil, - nil, - 0, - false, - ).(*providertypes.ConsumerAdditionProposal), + // initialize registration, initialization, and update records + consumerMetadata := []providertypes.ConsumerMetadata{ + { + Name: "name", + Description: "spawn time passed", + }, + { + Name: "title", + Description: "spawn time passed", + }, + { + Name: "title", + Description: "spawn time not passed", + }, + { + Name: "title", + Description: "opt-in chain with at least one validator opted in", + }, + { + Name: "title", + Description: "opt-in chain with no validator opted in", + }, } + chainIds := []string{"chain0", "chain1", "chain2", "chain3", "chain4"} + + initializationParameters := []providertypes.ConsumerInitializationParameters{ + { + InitialHeight: clienttypes.NewHeight(3, 4), + GenesisHash: []byte{}, + BinaryHash: []byte{}, + SpawnTime: now.Add(-time.Hour * 2).UTC(), + UnbondingPeriod: time.Duration(100000000000), + CcvTimeoutPeriod: time.Duration(100000000000), + TransferTimeoutPeriod: time.Duration(100000000000), + ConsumerRedistributionFraction: "0.75", + BlocksPerDistributionTransmission: 10, + HistoricalEntries: 10000, + DistributionTransmissionChannel: "", + }, + { + InitialHeight: clienttypes.NewHeight(3, 4), + GenesisHash: []byte{}, + BinaryHash: []byte{}, + SpawnTime: now.Add(-time.Hour).UTC(), + UnbondingPeriod: time.Duration(100000000000), + CcvTimeoutPeriod: time.Duration(100000000000), + TransferTimeoutPeriod: time.Duration(100000000000), + ConsumerRedistributionFraction: "0.75", + BlocksPerDistributionTransmission: 10, + HistoricalEntries: 10000, + DistributionTransmissionChannel: "", + }, + { + InitialHeight: clienttypes.NewHeight(3, 4), + GenesisHash: []byte{}, + BinaryHash: []byte{}, + SpawnTime: now.Add(time.Hour).UTC(), + UnbondingPeriod: time.Duration(100000000000), + CcvTimeoutPeriod: time.Duration(100000000000), + TransferTimeoutPeriod: time.Duration(100000000000), + ConsumerRedistributionFraction: "0.75", + BlocksPerDistributionTransmission: 10, + HistoricalEntries: 10000, + DistributionTransmissionChannel: "", + }, + { + InitialHeight: clienttypes.NewHeight(3, 4), + GenesisHash: []byte{}, + BinaryHash: []byte{}, + SpawnTime: now.Add(-time.Hour).UTC(), + UnbondingPeriod: time.Duration(100000000000), + CcvTimeoutPeriod: time.Duration(100000000000), + TransferTimeoutPeriod: time.Duration(100000000000), + ConsumerRedistributionFraction: "0.75", + BlocksPerDistributionTransmission: 10, + HistoricalEntries: 10000, + DistributionTransmissionChannel: "", + }, + { + InitialHeight: clienttypes.NewHeight(3, 4), + GenesisHash: []byte{}, + BinaryHash: []byte{}, + SpawnTime: now.Add(-time.Minute).UTC(), + UnbondingPeriod: time.Duration(100000000000), + CcvTimeoutPeriod: time.Duration(100000000000), + TransferTimeoutPeriod: time.Duration(100000000000), + ConsumerRedistributionFraction: "0.75", + BlocksPerDistributionTransmission: 10, + HistoricalEntries: 10000, + DistributionTransmissionChannel: "", + }, + } + powerShapingParameters := []providertypes.PowerShapingParameters{ + { + Top_N: 50, + ValidatorsPowerCap: 0, + ValidatorSetCap: 0, + Allowlist: []string{}, + Denylist: []string{}, + }, + { + Top_N: 50, + ValidatorsPowerCap: 0, + ValidatorSetCap: 0, + Allowlist: []string{}, + Denylist: []string{}, + }, + { + Top_N: 50, + ValidatorsPowerCap: 0, + ValidatorSetCap: 0, + Allowlist: []string{}, + Denylist: []string{}, + }, + { + Top_N: 0, + ValidatorsPowerCap: 0, + ValidatorSetCap: 0, + Allowlist: []string{}, + Denylist: []string{}, + }, + { + Top_N: 0, + ValidatorsPowerCap: 0, + ValidatorSetCap: 0, + Allowlist: []string{}, + Denylist: []string{}, + }} // Expect client creation for only the first, second, and fifth proposals (spawn time already passed and valid) - expectedCalls := testkeeper.GetMocksForCreateConsumerClient(ctx, &mocks, "chain1", clienttypes.NewHeight(3, 4)) - expectedCalls = append(expectedCalls, testkeeper.GetMocksForCreateConsumerClient(ctx, &mocks, "chain2", clienttypes.NewHeight(3, 4))...) - expectedCalls = append(expectedCalls, testkeeper.GetMocksForCreateConsumerClient(ctx, &mocks, "chain5", clienttypes.NewHeight(3, 4))...) + expectedCalls := testkeeper.GetMocksForCreateConsumerClient(ctx, &mocks, "chain0", clienttypes.NewHeight(3, 4)) + expectedCalls = append(expectedCalls, testkeeper.GetMocksForCreateConsumerClient(ctx, &mocks, "chain1", clienttypes.NewHeight(3, 4))...) + expectedCalls = append(expectedCalls, testkeeper.GetMocksForCreateConsumerClient(ctx, &mocks, "chain3", clienttypes.NewHeight(3, 4))...) - // The sixth proposal would have spawn time passed and hence needs the mocks but the client will not be - // created because `chain6` is an Opt In chain and has no validator opted in - expectedCalls = append(expectedCalls, testkeeper.GetMocksForCreateConsumerClient(ctx, &mocks, "chain6", clienttypes.NewHeight(3, 4))...) + // The fifth chain would have spawn time passed and hence needs the mocks but the client will not be + // created because `chain4` is an Opt In chain and has no validator opted in + expectedCalls = append(expectedCalls, testkeeper.GetMocksForCreateConsumerClient(ctx, &mocks, "chain4", clienttypes.NewHeight(3, 4))...) gomock.InOrder(expectedCalls...) - for _, prop := range pendingProps { - providerKeeper.SetPendingConsumerAdditionProp(ctx, prop) + // set up all the records + for i, chainId := range chainIds { + providerKeeper.SetConsumerChainId(ctx, fmt.Sprintf("%d", i), chainId) + } + + for i, r := range consumerMetadata { + providerKeeper.SetConsumerMetadata(ctx, fmt.Sprintf("%d", i), r) + } + for i, r := range initializationParameters { + providerKeeper.SetConsumerInitializationParameters(ctx, fmt.Sprintf("%d", i), r) + // set up the chains in their initialized phase, hence they could launch + providerKeeper.SetConsumerPhase(ctx, fmt.Sprintf("%d", i), providerkeeper.Initialized) + providerKeeper.AppendSpawnTimeForConsumerToBeLaunched(ctx, fmt.Sprintf("%d", i), r.SpawnTime) + } + for i, r := range powerShapingParameters { + providerKeeper.SetConsumerPowerShapingParameters(ctx, fmt.Sprintf("%d", i), r) } // opt in a sample validator so the chain's proposal can successfully execute @@ -933,87 +818,51 @@ func TestBeginBlockInit(t *testing.T) { valAddr, _ := sdk.ValAddressFromBech32(validator.GetOperator()) mocks.MockStakingKeeper.EXPECT().GetLastValidatorPower(gomock.Any(), valAddr).Return(int64(1), nil).AnyTimes() - // for the validator, expect a call to GetValidatorByConsAddr with its consensus address mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(gomock.Any(), consAddr).Return(validator, nil).AnyTimes() - providerKeeper.SetOptedIn(ctx, pendingProps[4].ChainId, providertypes.NewProviderConsAddress(consAddr)) + providerKeeper.SetOptedIn(ctx, "3", providertypes.NewProviderConsAddress(consAddr)) providerKeeper.BeginBlockInit(ctx) - // first proposal is not pending anymore because its spawn time already passed and was executed - _, found := providerKeeper.GetPendingConsumerAdditionProp( - ctx, pendingProps[0].SpawnTime, pendingProps[0].ChainId) - require.False(t, found) - // first proposal was successfully executed and hence consumer genesis was created - _, found = providerKeeper.GetConsumerGenesis(ctx, pendingProps[0].ChainId) + // first chain was successfully launched + phase, found := providerKeeper.GetConsumerPhase(ctx, "0") require.True(t, found) - - // second proposal is not pending anymore because its spawn time already passed and was executed - _, found = providerKeeper.GetPendingConsumerAdditionProp( - ctx, pendingProps[1].SpawnTime, pendingProps[1].ChainId) - require.False(t, found) - // second proposal was successfully executed and hence consumer genesis was created - _, found = providerKeeper.GetConsumerGenesis(ctx, pendingProps[1].ChainId) + require.Equal(t, providerkeeper.Launched, phase) + _, found = providerKeeper.GetConsumerGenesis(ctx, "0") require.True(t, found) - // third proposal is still stored as pending because its spawn time has not passed - _, found = providerKeeper.GetPendingConsumerAdditionProp( - ctx, pendingProps[2].SpawnTime, pendingProps[2].ChainId) + // second chain was successfully launched + phase, found = providerKeeper.GetConsumerPhase(ctx, "1") + require.True(t, found) + require.Equal(t, providerkeeper.Launched, phase) + _, found = providerKeeper.GetConsumerGenesis(ctx, "1") require.True(t, found) - // because the proposal is still pending, no consumer genesis was created - _, found = providerKeeper.GetConsumerGenesis(ctx, pendingProps[2].ChainId) - require.False(t, found) - // check that the invalid proposals were dropped - _, found = providerKeeper.GetPendingConsumerAdditionProp( - ctx, pendingProps[3].SpawnTime, pendingProps[3].ChainId) + // third chain was not launched because its spawn time has not passed + phase, found = providerKeeper.GetConsumerPhase(ctx, "2") + require.True(t, found) + require.Equal(t, providerkeeper.Initialized, phase) + _, found = providerKeeper.GetConsumerGenesis(ctx, "2") require.False(t, found) - // Note that we do not check that `GetConsumerGenesis(ctx, pendingProps[3].ChainId)` returns `false` here because - // `pendingProps[3]` is an invalid proposal due to the chain id already existing so the consumer genesis also exists - // fifth proposal corresponds to an Opt-In chain with one opted-in validator and hence the proposal gets + // fourth chain corresponds to an Opt-In chain with one opted-in validator and hence the chain gets // successfully executed - _, found = providerKeeper.GetPendingConsumerAdditionProp( - ctx, pendingProps[4].SpawnTime, pendingProps[4].ChainId) - require.False(t, found) - // fifth proposal was successfully executed and hence consumer genesis was created - _, found = providerKeeper.GetConsumerGenesis(ctx, pendingProps[4].ChainId) + phase, found = providerKeeper.GetConsumerPhase(ctx, "3") require.True(t, found) - - // sixth proposal corresponds to an Opt-In chain with no opted-in validators and hence the - // proposal is not successful - _, found = providerKeeper.GetPendingConsumerAdditionProp( - ctx, pendingProps[5].SpawnTime, pendingProps[5].ChainId) - // the proposal was dropped and deleted - require.False(t, found) - // no consumer genesis is created - _, found = providerKeeper.GetConsumerGenesis(ctx, pendingProps[5].ChainId) - require.False(t, found) - // no consumer client is associated with this chain - _, found = providerKeeper.GetConsumerClientId(ctx, pendingProps[5].ChainId) - require.False(t, found) - // no fields should be set for this (check some of them) - _, found = providerKeeper.GetTopN(ctx, pendingProps[5].ChainId) - require.False(t, found) - _, found = providerKeeper.GetValidatorsPowerCap(ctx, pendingProps[5].ChainId) - require.False(t, found) - _, found = providerKeeper.GetValidatorSetCap(ctx, pendingProps[5].ChainId) - require.False(t, found) - - // test that Top N is set correctly - require.True(t, providerKeeper.IsTopN(ctx, "chain1")) - topN, found := providerKeeper.GetTopN(ctx, "chain1") + require.Equal(t, providerkeeper.Launched, phase) + _, found = providerKeeper.GetConsumerGenesis(ctx, "3") require.True(t, found) - require.Equal(t, uint32(50), topN) - require.True(t, providerKeeper.IsOptIn(ctx, "chain4")) + // fifth chain corresponds to an Opt-In chain with no opted-in validators and hence the + // chain launch is NOT successful + phase, found = providerKeeper.GetConsumerPhase(ctx, "4") + require.True(t, found) + require.Equal(t, providerkeeper.Initialized, phase) + _, found = providerKeeper.GetConsumerGenesis(ctx, "4") + require.False(t, found) } -// TestBeginBlockCCR tests BeginBlockCCR against the spec. -// -// See: https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/methods.md#ccv-pcf-bblock-ccr1 -// Spec tag: [CCV-PCF-BBLOCK-CCR.1] func TestBeginBlockCCR(t *testing.T) { now := time.Now().UTC() @@ -1023,28 +872,26 @@ func TestBeginBlockCCR(t *testing.T) { defer ctrl.Finish() ctx = ctx.WithBlockTime(now) - pendingProps := []*providertypes.ConsumerRemovalProposal{ - providertypes.NewConsumerRemovalProposal( - "title", "description", "chain1", now.Add(-time.Hour).UTC(), - ).(*providertypes.ConsumerRemovalProposal), - providertypes.NewConsumerRemovalProposal( - "title", "description", "chain2", now, - ).(*providertypes.ConsumerRemovalProposal), - providertypes.NewConsumerRemovalProposal( - "title", "description", "chain3", now.Add(time.Hour).UTC(), - ).(*providertypes.ConsumerRemovalProposal), - } + chainIds := []string{"chain1", "chain2", "chain3"} + consumerIds := []string{"consumerId1", "consumerId2", "consumerId3"} + providerKeeper.SetConsumerStopTime(ctx, consumerIds[0], now.Add(-time.Hour)) + providerKeeper.AppendStopTimeForConsumerToBeStopped(ctx, consumerIds[0], now.Add(-time.Hour)) + providerKeeper.SetConsumerStopTime(ctx, consumerIds[1], now) + providerKeeper.AppendStopTimeForConsumerToBeStopped(ctx, consumerIds[1], now) + providerKeeper.SetConsumerStopTime(ctx, consumerIds[2], now.Add(time.Hour)) + providerKeeper.AppendStopTimeForConsumerToBeStopped(ctx, consumerIds[2], now.Add(time.Hour)) // // Mock expectations // expectations := []*gomock.Call{} - for _, prop := range pendingProps { - // A consumer chain is setup corresponding to each prop, making these mocks necessary + for i, _ := range consumerIds { + chainId := chainIds[i] + // A consumer chain is setup corresponding to each consumerId, making these mocks necessary testkeeper.SetupMocksForLastBondedValidatorsExpectation(mocks.MockStakingKeeper, 0, []stakingtypes.Validator{}, 1) expectations = append(expectations, testkeeper.GetMocksForCreateConsumerClient(ctx, &mocks, - prop.ChainId, clienttypes.NewHeight(2, 3))...) - expectations = append(expectations, testkeeper.GetMocksForSetConsumerChain(ctx, &mocks, prop.ChainId)...) + chainId, clienttypes.NewHeight(2, 3))...) + expectations = append(expectations, testkeeper.GetMocksForSetConsumerChain(ctx, &mocks, chainId)...) } // Only first two consumer chains should be stopped expectations = append(expectations, testkeeper.GetMocksForStopConsumerChainWithCloseChannel(ctx, &mocks)...) @@ -1055,27 +902,28 @@ func TestBeginBlockCCR(t *testing.T) { // // Remaining setup // - for _, prop := range pendingProps { - // Setup a valid consumer chain for each prop - additionProp := testkeeper.GetTestConsumerAdditionProp() - additionProp.ChainId = prop.ChainId - additionProp.InitialHeight = clienttypes.NewHeight(2, 3) - - err := providerKeeper.CreateConsumerClient(ctx, additionProp) + for i, consumerId := range consumerIds { + // Setup a valid consumer chain for each consumerId + initializationRecord := testkeeper.GetTestInitializationParameters() + initializationRecord.InitialHeight = clienttypes.NewHeight(2, 3) + registrationRecord := testkeeper.GetTestConsumerMetadata() + + providerKeeper.SetConsumerChainId(ctx, consumerId, chainIds[i]) + providerKeeper.SetConsumerMetadata(ctx, consumerId, registrationRecord) + providerKeeper.SetConsumerInitializationParameters(ctx, consumerId, initializationRecord) + providerKeeper.SetConsumerPowerShapingParameters(ctx, consumerId, testkeeper.GetTestPowerShapingParameters()) + providerKeeper.SetConsumerPhase(ctx, consumerId, providerkeeper.Initialized) + providerKeeper.SetClientIdToConsumerId(ctx, "clientID", consumerId) + + err := providerKeeper.CreateConsumerClient(ctx, consumerId) require.NoError(t, err) err = providerKeeper.SetConsumerChain(ctx, "channelID") require.NoError(t, err) - // Set removal props for all consumer chains - providerKeeper.SetPendingConsumerRemovalProp(ctx, prop) + // after we have created the consumer client, the chain is considered launched and hence we could later stop the chain + providerKeeper.SetConsumerPhase(ctx, consumerId, providerkeeper.Launched) } - // Add an invalid prop to the store with an non-existing chain id - invalidProp := providertypes.NewConsumerRemovalProposal( - "title", "description", "chain4", now.Add(-time.Hour).UTC(), - ).(*providertypes.ConsumerRemovalProposal) - providerKeeper.SetPendingConsumerRemovalProp(ctx, invalidProp) - // // Test execution // @@ -1083,16 +931,14 @@ func TestBeginBlockCCR(t *testing.T) { providerKeeper.BeginBlockCCR(ctx) // Only the 3rd (final) proposal is still stored as pending - found := providerKeeper.PendingConsumerRemovalPropExists( - ctx, pendingProps[0].ChainId, pendingProps[0].StopTime) - require.False(t, found) - found = providerKeeper.PendingConsumerRemovalPropExists( - ctx, pendingProps[1].ChainId, pendingProps[1].StopTime) - require.False(t, found) - found = providerKeeper.PendingConsumerRemovalPropExists( - ctx, pendingProps[2].ChainId, pendingProps[2].StopTime) + phase, found := providerKeeper.GetConsumerPhase(ctx, consumerIds[0]) require.True(t, found) - found = providerKeeper.PendingConsumerRemovalPropExists( - ctx, invalidProp.ChainId, invalidProp.StopTime) - require.False(t, found) + require.Equal(t, providerkeeper.Stopped, phase) + phase, found = providerKeeper.GetConsumerPhase(ctx, consumerIds[1]) + require.True(t, found) + require.Equal(t, providerkeeper.Stopped, phase) + // third chain had a stopTime in the future and hence did not stop + phase, found = providerKeeper.GetConsumerPhase(ctx, consumerIds[2]) + require.True(t, found) + require.Equal(t, providerkeeper.Launched, phase) } diff --git a/x/ccv/provider/keeper/relay.go b/x/ccv/provider/keeper/relay.go index c95bd71079..b0e8bb4e83 100644 --- a/x/ccv/provider/keeper/relay.go +++ b/x/ccv/provider/keeper/relay.go @@ -30,9 +30,9 @@ func (k Keeper) OnAcknowledgementPacket(ctx sdk.Context, packet channeltypes.Pac "channelID", packet.SourceChannel, "error", err, ) - if chainID, ok := k.GetChannelToChain(ctx, packet.SourceChannel); ok { + if consumerId, ok := k.GetChannelIdToConsumerId(ctx, packet.SourceChannel); ok { // stop consumer chain and release unbonding - return k.StopConsumerChain(ctx, chainID, false) + return k.StopConsumerChain(ctx, consumerId, false) } return errorsmod.Wrapf(providertypes.ErrUnknownConsumerChannelId, "recv ErrorAcknowledgement on unknown channel %s", packet.SourceChannel) } @@ -42,7 +42,7 @@ func (k Keeper) OnAcknowledgementPacket(ctx sdk.Context, packet channeltypes.Pac // OnTimeoutPacket aborts the transaction if no chain exists for the destination channel, // otherwise it stops the chain func (k Keeper) OnTimeoutPacket(ctx sdk.Context, packet channeltypes.Packet) error { - chainID, found := k.GetChannelToChain(ctx, packet.SourceChannel) + consumerId, found := k.GetChannelIdToConsumerId(ctx, packet.SourceChannel) if !found { k.Logger(ctx).Error("packet timeout, unknown channel:", "channelID", packet.SourceChannel) // abort transaction @@ -51,9 +51,9 @@ func (k Keeper) OnTimeoutPacket(ctx sdk.Context, packet channeltypes.Packet) err packet.SourceChannel, ) } - k.Logger(ctx).Info("packet timeout, removing the consumer:", "chainID", chainID) + k.Logger(ctx).Info("packet timeout, removing the consumer:", "consumerId", consumerId) // stop consumer chain and release unbondings - return k.StopConsumerChain(ctx, chainID, false) + return k.StopConsumerChain(ctx, consumerId, false) } // EndBlockVSU contains the EndBlock logic needed for @@ -136,24 +136,24 @@ func (k Keeper) BlocksUntilNextEpoch(ctx sdk.Context) int64 { // If the CCV channel is not established for a consumer chain, // the updates will remain queued until the channel is established func (k Keeper) SendVSCPackets(ctx sdk.Context) { - for _, chainID := range k.GetAllRegisteredConsumerChainIDs(ctx) { + for _, consumerId := range k.GetAllRegisteredConsumerIds(ctx) { // check if CCV channel is established and send - if channelID, found := k.GetChainToChannel(ctx, chainID); found { - k.SendVSCPacketsToChain(ctx, chainID, channelID) + if channelID, found := k.GetConsumerIdToChannelId(ctx, consumerId); found { + k.SendVSCPacketsToChain(ctx, consumerId, channelID) } } } // SendVSCPacketsToChain sends all queued VSC packets to the specified chain -func (k Keeper) SendVSCPacketsToChain(ctx sdk.Context, chainID, channelID string) { - pendingPackets := k.GetPendingVSCPackets(ctx, chainID) +func (k Keeper) SendVSCPacketsToChain(ctx sdk.Context, consumerId, channelId string) { + pendingPackets := k.GetPendingVSCPackets(ctx, consumerId) for _, data := range pendingPackets { // send packet over IBC err := ccv.SendIBCPacket( ctx, k.scopedKeeper, k.channelKeeper, - channelID, // source channel id + channelId, // source channel id ccv.ProviderPortID, // source port id data.GetBytes(), k.GetCCVTimeoutPeriod(ctx), @@ -163,20 +163,20 @@ func (k Keeper) SendVSCPacketsToChain(ctx sdk.Context, chainID, channelID string // IBC client is expired! // leave the packet data stored to be sent once the client is upgraded // the client cannot expire during iteration (in the middle of a block) - k.Logger(ctx).Info("IBC client is expired, cannot send VSC, leaving packet data stored:", "chainID", chainID, "vscid", data.ValsetUpdateId) + k.Logger(ctx).Info("IBC client is expired, cannot send VSC, leaving packet data stored:", "consumerId", consumerId, "vscid", data.ValsetUpdateId) return } // Not able to send packet over IBC! - k.Logger(ctx).Error("cannot send VSC, removing consumer:", "chainID", chainID, "vscid", data.ValsetUpdateId, "err", err.Error()) + k.Logger(ctx).Error("cannot send VSC, removing consumer:", "consumerId", consumerId, "vscid", data.ValsetUpdateId, "err", err.Error()) // If this happens, most likely the consumer is malicious; remove it - err := k.StopConsumerChain(ctx, chainID, true) + err := k.StopConsumerChain(ctx, consumerId, true) if err != nil { panic(fmt.Errorf("consumer chain failed to stop: %w", err)) } return } } - k.DeletePendingVSCPackets(ctx, chainID) + k.DeletePendingVSCPackets(ctx, consumerId) } // QueueVSCPackets queues latest validator updates for every registered consumer chain @@ -192,12 +192,12 @@ func (k Keeper) QueueVSCPackets(ctx sdk.Context) { panic(fmt.Errorf("failed to get last validators: %w", err)) } - for _, chainID := range k.GetAllRegisteredConsumerChainIDs(ctx) { - currentValidators, err := k.GetConsumerValSet(ctx, chainID) + for _, consumerId := range k.GetAllRegisteredConsumerIds(ctx) { + currentValidators, err := k.GetConsumerValSet(ctx, consumerId) if err != nil { panic(fmt.Errorf("failed to get consumer validators: %w", err)) } - topN, _ := k.GetTopN(ctx, chainID) + topN := k.GetTopN(ctx, consumerId) if topN > 0 { // in a Top-N chain, we automatically opt in all validators that belong to the top N @@ -211,27 +211,27 @@ func (k Keeper) QueueVSCPackets(ctx sdk.Context) { minPower, err := k.ComputeMinPowerInTopN(ctx, activeValidators, topN) if err != nil { // we panic, since the only way to proceed would be to opt in all validators, which is not the intended behavior - panic(fmt.Errorf("failed to compute min power to opt in for chain %v: %w", chainID, err)) + panic(fmt.Errorf("failed to compute min power to opt in for chain %v: %w", consumerId, err)) } // set the minimal power of validators in the top N in the store - k.SetMinimumPowerInTopN(ctx, chainID, minPower) + k.SetMinimumPowerInTopN(ctx, consumerId, minPower) - k.OptInTopNValidators(ctx, chainID, activeValidators, minPower) + k.OptInTopNValidators(ctx, consumerId, activeValidators, minPower) } - nextValidators := k.ComputeNextValidators(ctx, chainID, bondedValidators) + nextValidators := k.ComputeNextValidators(ctx, consumerId, bondedValidators) valUpdates := DiffValidators(currentValidators, nextValidators) - k.SetConsumerValSet(ctx, chainID, nextValidators) + k.SetConsumerValSet(ctx, consumerId, nextValidators) // check whether there are changes in the validator set if len(valUpdates) != 0 { // construct validator set change packet data - packet := ccv.NewValidatorSetChangePacketData(valUpdates, valUpdateID, k.ConsumeSlashAcks(ctx, chainID)) - k.AppendPendingVSCPackets(ctx, chainID, packet) + packet := ccv.NewValidatorSetChangePacketData(valUpdates, valUpdateID, k.ConsumeSlashAcks(ctx, consumerId)) + k.AppendPendingVSCPackets(ctx, consumerId, packet) k.Logger(ctx).Info("VSCPacket enqueued:", - "chainID", chainID, + "consumerId", consumerId, "vscID", valUpdateID, "len updates", len(valUpdates), ) @@ -266,8 +266,8 @@ func (k Keeper) EndBlockCIS(ctx sdk.Context) { k.Logger(ctx).Debug("vscID was mapped to block height", "vscID", valUpdateID, "height", blockHeight) // prune previous consumer validator addresses that are no longer needed - for _, chainID := range k.GetAllRegisteredConsumerChainIDs(ctx) { - k.PruneKeyAssignments(ctx, chainID) + for _, consumerId := range k.GetAllRegisteredConsumerIds(ctx) { + k.PruneKeyAssignments(ctx, consumerId) } } @@ -279,7 +279,7 @@ func (k Keeper) OnRecvSlashPacket( data ccv.SlashPacketData, ) (ccv.PacketAckResult, error) { // check that the channel is established, panic if not - chainID, found := k.GetChannelToChain(ctx, packet.DestinationChannel) + consumerId, found := k.GetChannelIdToConsumerId(ctx, packet.DestinationChannel) if !found { // SlashPacket packet was sent on a channel different than any of the established CCV channels; // this should never happen @@ -294,10 +294,10 @@ func (k Keeper) OnRecvSlashPacket( return nil, errorsmod.Wrapf(err, "error validating SlashPacket data") } - if err := k.ValidateSlashPacket(ctx, chainID, packet, data); err != nil { + if err := k.ValidateSlashPacket(ctx, consumerId, packet, data); err != nil { k.Logger(ctx).Error("invalid slash packet", "error", err.Error(), - "chainID", chainID, + "consumerId", consumerId, "consumer cons addr", sdk.ConsAddress(data.Validator.Address).String(), "vscID", data.ValsetUpdateId, "infractionType", data.Infraction, @@ -308,15 +308,15 @@ func (k Keeper) OnRecvSlashPacket( // The slash packet validator address may be known only on the consumer chain, // in this case, it must be mapped back to the consensus address on the provider chain consumerConsAddr := providertypes.NewConsumerConsAddress(data.Validator.Address) - providerConsAddr := k.GetProviderAddrFromConsumerAddr(ctx, chainID, consumerConsAddr) + providerConsAddr := k.GetProviderAddrFromConsumerAddr(ctx, consumerId, consumerConsAddr) if data.Infraction == stakingtypes.Infraction_INFRACTION_DOUBLE_SIGN { // getMappedInfractionHeight is already checked in ValidateSlashPacket - infractionHeight, _ := k.getMappedInfractionHeight(ctx, chainID, data.ValsetUpdateId) + infractionHeight, _ := k.getMappedInfractionHeight(ctx, consumerId, data.ValsetUpdateId) k.SetSlashLog(ctx, providerConsAddr) k.Logger(ctx).Info("SlashPacket received for double-signing", - "chainID", chainID, + "consumerId", consumerId, "consumer cons addr", consumerConsAddr.String(), "provider cons addr", providerConsAddr.String(), "vscID", data.ValsetUpdateId, @@ -329,11 +329,11 @@ func (k Keeper) OnRecvSlashPacket( } // Check that the validator belongs to the consumer chain valset - if !k.IsConsumerValidator(ctx, chainID, providerConsAddr) { + if !k.IsConsumerValidator(ctx, consumerId, providerConsAddr) { k.Logger(ctx).Error("cannot jail validator %s that does not belong to consumer %s valset", - providerConsAddr.String(), chainID) + providerConsAddr.String(), consumerId) // drop packet but return a slash ack so that the consumer can send another slash packet - k.AppendSlashAck(ctx, chainID, consumerConsAddr.String()) + k.AppendSlashAck(ctx, consumerId, consumerConsAddr.String()) return ccv.SlashPacketHandledResult, nil } @@ -342,7 +342,7 @@ func (k Keeper) OnRecvSlashPacket( // Return bounce ack if meter is negative in value if meter.IsNegative() { k.Logger(ctx).Info("SlashPacket received, but meter is negative. Packet will be bounced", - "chainID", chainID, + "consumerId", consumerId, "consumer cons addr", consumerConsAddr.String(), "provider cons addr", providerConsAddr.String(), "vscID", data.ValsetUpdateId, @@ -356,10 +356,10 @@ func (k Keeper) OnRecvSlashPacket( meter = meter.Sub(k.GetEffectiveValPower(ctx, providerConsAddr)) k.SetSlashMeter(ctx, meter) - k.HandleSlashPacket(ctx, chainID, data) + k.HandleSlashPacket(ctx, consumerId, data) k.Logger(ctx).Info("slash packet received and handled", - "chainID", chainID, + "consumerId", consumerId, "consumer cons addr", consumerConsAddr.String(), "provider cons addr", providerConsAddr.String(), "vscID", data.ValsetUpdateId, @@ -373,14 +373,14 @@ func (k Keeper) OnRecvSlashPacket( // ValidateSlashPacket validates a recv slash packet before it is // handled or persisted in store. An error is returned if the packet is invalid, // and an error ack should be relayed to the sender. -func (k Keeper) ValidateSlashPacket(ctx sdk.Context, chainID string, +func (k Keeper) ValidateSlashPacket(ctx sdk.Context, consumerId string, packet channeltypes.Packet, data ccv.SlashPacketData, ) error { - _, found := k.getMappedInfractionHeight(ctx, chainID, data.ValsetUpdateId) + _, found := k.getMappedInfractionHeight(ctx, consumerId, data.ValsetUpdateId) // return error if we cannot find infraction height matching the validator update id if !found { return fmt.Errorf("cannot find infraction height matching "+ - "the validator update id %d for chain %s", data.ValsetUpdateId, chainID) + "the validator update id %d for chain %s", data.ValsetUpdateId, consumerId) } return nil @@ -388,13 +388,13 @@ func (k Keeper) ValidateSlashPacket(ctx sdk.Context, chainID string, // HandleSlashPacket potentially jails a misbehaving validator for a downtime infraction. // This method should NEVER be called with a double-sign infraction. -func (k Keeper) HandleSlashPacket(ctx sdk.Context, chainID string, data ccv.SlashPacketData) { +func (k Keeper) HandleSlashPacket(ctx sdk.Context, consumerId string, data ccv.SlashPacketData) { consumerConsAddr := providertypes.NewConsumerConsAddress(data.Validator.Address) // Obtain provider chain consensus address using the consumer chain consensus address - providerConsAddr := k.GetProviderAddrFromConsumerAddr(ctx, chainID, consumerConsAddr) + providerConsAddr := k.GetProviderAddrFromConsumerAddr(ctx, consumerId, consumerConsAddr) k.Logger(ctx).Debug("HandleSlashPacket", - "chainID", chainID, + "consumerId", consumerId, "consumer cons addr", consumerConsAddr.String(), "provider cons addr", providerConsAddr.String(), "vscID", data.ValsetUpdateId, @@ -429,7 +429,7 @@ func (k Keeper) HandleSlashPacket(ctx sdk.Context, chainID string, data ccv.Slas return } - infractionHeight, found := k.getMappedInfractionHeight(ctx, chainID, data.ValsetUpdateId) + infractionHeight, found := k.getMappedInfractionHeight(ctx, consumerId, data.ValsetUpdateId) if !found { k.Logger(ctx).Error( "HandleSlashPacket - infraction height not found. But was found during slash packet validation", @@ -442,9 +442,9 @@ func (k Keeper) HandleSlashPacket(ctx sdk.Context, chainID string, data ccv.Slas // Note: the SlashPacket is for downtime infraction, as SlashPackets // for double-signing infractions are already dropped when received - // append the validator address to the slash ack for its chain id + // append the validator address to the slash ack for its consumer id // TODO: consumer cons address should be accepted here - k.AppendSlashAck(ctx, chainID, consumerConsAddr.String()) + k.AppendSlashAck(ctx, consumerId, consumerConsAddr.String()) // jail validator if !validator.IsJailed() { @@ -479,12 +479,12 @@ func (k Keeper) HandleSlashPacket(ctx sdk.Context, chainID string, data ccv.Slas ) } -// getMappedInfractionHeight gets the infraction height mapped from val set ID for the given chain ID +// getMappedInfractionHeight gets the infraction height mapped from val set ID for the given consumer id func (k Keeper) getMappedInfractionHeight(ctx sdk.Context, - chainID string, valsetUpdateID uint64, + consumerId string, valsetUpdateID uint64, ) (height uint64, found bool) { if valsetUpdateID == 0 { - return k.GetInitChainHeight(ctx, chainID) + return k.GetInitChainHeight(ctx, consumerId) } else { return k.GetValsetUpdateBlockHeight(ctx, valsetUpdateID) } diff --git a/x/ccv/provider/keeper/relay_test.go b/x/ccv/provider/keeper/relay_test.go index 91de369851..db8c991d7f 100644 --- a/x/ccv/provider/keeper/relay_test.go +++ b/x/ccv/provider/keeper/relay_test.go @@ -104,31 +104,31 @@ func TestQueueVSCPacketsDoesNotResetConsumerValidatorsHeights(t *testing.T) { testkeeper.SetupMocksForLastBondedValidatorsExpectation(mocks.MockStakingKeeper, 2, []stakingtypes.Validator{valA, valB}, -1) // set a consumer client, so we have a consumer chain (i.e., `k.GetAllConsumerChains(ctx)` is non empty) - providerKeeper.SetConsumerClientId(ctx, "chainID", "clientID") + providerKeeper.SetConsumerClientId(ctx, "consumerId", "clientID") // opt in validator A and set as a consumer validator - providerKeeper.SetOptedIn(ctx, "chainID", providertypes.NewProviderConsAddress(valAConsAddr)) + providerKeeper.SetOptedIn(ctx, "consumerId", providertypes.NewProviderConsAddress(valAConsAddr)) consumerValidatorA := providertypes.ConsensusValidator{ ProviderConsAddr: valAConsAddr, Power: 1, PublicKey: &valAPubKey, JoinHeight: 123456789, } - providerKeeper.SetConsumerValidator(ctx, "chainID", consumerValidatorA) + providerKeeper.SetConsumerValidator(ctx, "consumerId", consumerValidatorA) // Opt in validator B. Note that validator B is not a consumer validator and hence would become a consumer // validator for the first time after the `QueueVSCPackets` call. - providerKeeper.SetOptedIn(ctx, "chainID", providertypes.NewProviderConsAddress(valBConsAddr)) + providerKeeper.SetOptedIn(ctx, "consumerId", providertypes.NewProviderConsAddress(valBConsAddr)) providerKeeper.QueueVSCPackets(ctx) // the height of consumer validator A should not be modified because A was already a consumer validator - cv, _ := providerKeeper.GetConsumerValidator(ctx, "chainID", providertypes.NewProviderConsAddress(valAConsAddr)) + cv, _ := providerKeeper.GetConsumerValidator(ctx, "consumerId", providertypes.NewProviderConsAddress(valAConsAddr)) require.Equal(t, consumerValidatorA.JoinHeight, cv.JoinHeight, "the consumer validator's height was erroneously modified") // the height of consumer validator B is set to be the same as the one of the current chain height because this // consumer validator becomes a consumer validator for the first time (i.e., was not a consumer validator in the previous epoch) - cv, _ = providerKeeper.GetConsumerValidator(ctx, "chainID", providertypes.NewProviderConsAddress(valBConsAddr)) + cv, _ = providerKeeper.GetConsumerValidator(ctx, "consumerId", providertypes.NewProviderConsAddress(valBConsAddr)) require.Equal(t, chainHeight, cv.JoinHeight, "the consumer validator's height was not correctly set") } @@ -139,8 +139,8 @@ func TestOnRecvDowntimeSlashPacket(t *testing.T) { providerKeeper.SetParams(ctx, providertypes.DefaultParams()) // Set channel to chain (faking multiple established channels) - providerKeeper.SetChannelToChain(ctx, "channel-1", "chain-1") - providerKeeper.SetChannelToChain(ctx, "channel-2", "chain-2") + providerKeeper.SetChannelToConsumerId(ctx, "channel-1", "chain-1") + providerKeeper.SetChannelToConsumerId(ctx, "channel-2", "chain-2") // Generate a new slash packet data instance with double sign infraction type packetData := testkeeper.GetNewSlashPacketData() @@ -212,8 +212,8 @@ func TestOnRecvDoubleSignSlashPacket(t *testing.T) { providerKeeper.SetParams(ctx, providertypes.DefaultParams()) // Set channel to chain (faking multiple established channels) - providerKeeper.SetChannelToChain(ctx, "channel-1", "chain-1") - providerKeeper.SetChannelToChain(ctx, "channel-2", "chain-2") + providerKeeper.SetChannelToConsumerId(ctx, "channel-1", "chain-1") + providerKeeper.SetChannelToConsumerId(ctx, "channel-2", "chain-2") // Generate a new slash packet data instance with double sign infraction type packetData := testkeeper.GetNewSlashPacketData() @@ -294,7 +294,7 @@ func TestValidateSlashPacket(t *testing.T) { packet := channeltypes.Packet{DestinationChannel: "channel-9"} // Pseudo setup ccv channel for channel ID specified in packet. - providerKeeper.SetChannelToChain(ctx, "channel-9", "consumer-chain-id") + providerKeeper.SetChannelToConsumerId(ctx, "channel-9", "consumer-chain-id") // Setup init chain height for consumer (allowing 0 vscID to be valid). providerKeeper.SetInitChainHeight(ctx, "consumer-chain-id", uint64(89)) @@ -497,6 +497,7 @@ func TestSendVSCPacketsToChainFailure(t *testing.T) { gomock.InOrder(mockCalls...) // Execute setup + providerKeeper.SetClientIdToConsumerId(ctx, "clientID", "consumerChainID") err := providerKeeper.SetConsumerChain(ctx, "channelID") require.NoError(t, err) providerKeeper.SetConsumerClientId(ctx, "consumerChainID", "clientID") @@ -514,7 +515,7 @@ func TestOnTimeoutPacketWithNoChainFound(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - // We do not `SetChannelToChain` for "channelID" and therefore `OnTimeoutPacket` fails + // We do not `SetChannelToConsumerId` for "channelID" and therefore `OnTimeoutPacket` fails packet := channeltypes.Packet{ SourceChannel: "channelID", } @@ -530,14 +531,14 @@ func TestOnTimeoutPacketStopsChain(t *testing.T) { defer ctrl.Finish() providerKeeper.SetParams(ctx, providertypes.DefaultParams()) - testkeeper.SetupForStoppingConsumerChain(t, ctx, &providerKeeper, mocks) + testkeeper.SetupForStoppingConsumerChain(t, ctx, &providerKeeper, mocks, "consumerId") packet := channeltypes.Packet{ SourceChannel: "channelID", } err := providerKeeper.OnTimeoutPacket(ctx, packet) - testkeeper.TestProviderStateIsCleanedAfterConsumerChainIsStopped(t, ctx, providerKeeper, "chainID", "channelID") + testkeeper.TestProviderStateIsCleanedAfterConsumerChainIsStopped(t, ctx, providerKeeper, "consumerId", "channelID") require.NoError(t, err) } @@ -566,14 +567,14 @@ func TestOnAcknowledgementPacketWithAckError(t *testing.T) { require.True(t, strings.Contains(err.Error(), providertypes.ErrUnknownConsumerChannelId.Error())) // test that we stop the consumer chain when `OnAcknowledgementPacket` returns an error and the chain is found - testkeeper.SetupForStoppingConsumerChain(t, ctx, &providerKeeper, mocks) + testkeeper.SetupForStoppingConsumerChain(t, ctx, &providerKeeper, mocks, "consumerId") packet := channeltypes.Packet{ SourceChannel: "channelID", } err = providerKeeper.OnAcknowledgementPacket(ctx, packet, ackError) - testkeeper.TestProviderStateIsCleanedAfterConsumerChainIsStopped(t, ctx, providerKeeper, "chainID", "channelID") + testkeeper.TestProviderStateIsCleanedAfterConsumerChainIsStopped(t, ctx, providerKeeper, "consumerId", "channelID") require.NoError(t, err) } @@ -582,9 +583,11 @@ func TestEndBlockVSU(t *testing.T) { providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - chainID := "chainID" + chainID := "consumerId" - providerKeeper.SetTopN(ctx, chainID, 100) + providerKeeper.SetConsumerPowerShapingParameters(ctx, "consumerId", providertypes.PowerShapingParameters{ + Top_N: 100, + }) // 10 blocks constitute an epoch params := providertypes.DefaultParams() @@ -735,21 +738,21 @@ func TestQueueVSCPacketsWithPowerCapping(t *testing.T) { testkeeper.SetupMocksForLastBondedValidatorsExpectation(mocks.MockStakingKeeper, 5, []stakingtypes.Validator{valA, valB, valC, valD, valE}, -1) // add a consumer chain - providerKeeper.SetConsumerClientId(ctx, "chainID", "clientID") + providerKeeper.SetConsumerClientId(ctx, "consumerId", "clientID") - providerKeeper.SetTopN(ctx, "chainID", 50) // would opt in E + providerKeeper.SetConsumerPowerShapingParameters(ctx, "consumerId", providertypes.PowerShapingParameters{ + Top_N: 50, // would opt in E + ValidatorsPowerCap: 40, // set a power-capping of 40% + }) // opt in all validators - providerKeeper.SetOptedIn(ctx, "chainID", providertypes.NewProviderConsAddress(valAConsAddr)) - providerKeeper.SetOptedIn(ctx, "chainID", providertypes.NewProviderConsAddress(valBConsAddr)) - providerKeeper.SetOptedIn(ctx, "chainID", providertypes.NewProviderConsAddress(valCConsAddr)) - providerKeeper.SetOptedIn(ctx, "chainID", providertypes.NewProviderConsAddress(valDConsAddr)) + providerKeeper.SetOptedIn(ctx, "consumerId", providertypes.NewProviderConsAddress(valAConsAddr)) + providerKeeper.SetOptedIn(ctx, "consumerId", providertypes.NewProviderConsAddress(valBConsAddr)) + providerKeeper.SetOptedIn(ctx, "consumerId", providertypes.NewProviderConsAddress(valCConsAddr)) + providerKeeper.SetOptedIn(ctx, "consumerId", providertypes.NewProviderConsAddress(valDConsAddr)) // denylist validator D - providerKeeper.SetDenylist(ctx, "chainID", providertypes.NewProviderConsAddress(valDConsAddr)) - - // set a power-capping of 40% - providerKeeper.SetValidatorsPowerCap(ctx, "chainID", 40) + providerKeeper.SetDenylist(ctx, "consumerId", providertypes.NewProviderConsAddress(valDConsAddr)) // set max provider consensus vals to include all validators params := providerKeeper.GetParams(ctx) @@ -758,7 +761,7 @@ func TestQueueVSCPacketsWithPowerCapping(t *testing.T) { providerKeeper.QueueVSCPackets(ctx) - actualQueuedVSCPackets := providerKeeper.GetPendingVSCPackets(ctx, "chainID") + actualQueuedVSCPackets := providerKeeper.GetPendingVSCPackets(ctx, "consumerId") expectedQueuedVSCPackets := []ccv.ValidatorSetChangePacketData{ ccv.NewValidatorSetChangePacketData( []abci.ValidatorUpdate{ diff --git a/x/ccv/provider/keeper/validator_set_update.go b/x/ccv/provider/keeper/validator_set_update.go index 1c55f26553..a0afc94ef9 100644 --- a/x/ccv/provider/keeper/validator_set_update.go +++ b/x/ccv/provider/keeper/validator_set_update.go @@ -12,53 +12,53 @@ import ( ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" ) -// GetConsumerChainConsensusValidatorsKey returns the store key for consumer validators of the consumer chain with `chainID` -func (k Keeper) GetConsumerChainConsensusValidatorsKey(ctx sdk.Context, chainID string) []byte { - return types.ChainIdWithLenKey(types.ConsumerValidatorKeyPrefix(), chainID) +// GetConsumerChainConsensusValidatorsKey returns the store key for consumer validators of the consumer chain with `consumerId` +func (k Keeper) GetConsumerChainConsensusValidatorsKey(ctx sdk.Context, consumerId string) []byte { + return types.ConsumerIdWithLenKey(types.ConsumerValidatorKeyPrefix(), consumerId) } -// SetConsumerValidator sets provided consumer `validator` on the consumer chain with `chainID` +// SetConsumerValidator sets provided consumer `validator` on the consumer chain with `consumerId` func (k Keeper) SetConsumerValidator( ctx sdk.Context, - chainID string, + consumerId string, validator types.ConsensusValidator, ) { - k.setValidator(ctx, k.GetConsumerChainConsensusValidatorsKey(ctx, chainID), validator) + k.setValidator(ctx, k.GetConsumerChainConsensusValidatorsKey(ctx, consumerId), validator) } // SetConsumerValSet resets the current consumer validators with the `nextValidators` computed by // `FilterValidators` and hence this method should only be called after `FilterValidators` has completed. -func (k Keeper) SetConsumerValSet(ctx sdk.Context, chainID string, nextValidators []types.ConsensusValidator) { - k.setValSet(ctx, k.GetConsumerChainConsensusValidatorsKey(ctx, chainID), nextValidators) +func (k Keeper) SetConsumerValSet(ctx sdk.Context, consumerId string, nextValidators []types.ConsensusValidator) { + k.setValSet(ctx, k.GetConsumerChainConsensusValidatorsKey(ctx, consumerId), nextValidators) } // DeleteConsumerValidator removes consumer validator with `providerAddr` address func (k Keeper) DeleteConsumerValidator( ctx sdk.Context, - chainID string, + consumerId string, providerConsAddr types.ProviderConsAddress, ) { - k.deleteValidator(ctx, k.GetConsumerChainConsensusValidatorsKey(ctx, chainID), providerConsAddr) + k.deleteValidator(ctx, k.GetConsumerChainConsensusValidatorsKey(ctx, consumerId), providerConsAddr) } -// DeleteConsumerValSet deletes all the stored consumer validators for chain `chainID` +// DeleteConsumerValSet deletes all the stored consumer validators for chain with `consumerId` func (k Keeper) DeleteConsumerValSet( ctx sdk.Context, - chainID string, + consumerId string, ) { - k.deleteValSet(ctx, k.GetConsumerChainConsensusValidatorsKey(ctx, chainID)) + k.deleteValSet(ctx, k.GetConsumerChainConsensusValidatorsKey(ctx, consumerId)) } -// IsConsumerValidator returns `true` if the consumer validator with `providerAddr` exists for chain `chainID` +// IsConsumerValidator returns `true` if the consumer validator with `providerAddr` exists for chain with `consumerId` // and `false` otherwise -func (k Keeper) IsConsumerValidator(ctx sdk.Context, chainID string, providerAddr types.ProviderConsAddress) bool { - return k.isValidator(ctx, k.GetConsumerChainConsensusValidatorsKey(ctx, chainID), providerAddr) +func (k Keeper) IsConsumerValidator(ctx sdk.Context, consumerId string, providerAddr types.ProviderConsAddress) bool { + return k.isValidator(ctx, k.GetConsumerChainConsensusValidatorsKey(ctx, consumerId), providerAddr) } -// GetConsumerValidator returns the consumer validator with `providerAddr` if it exists for chain `chainID` -func (k Keeper) GetConsumerValidator(ctx sdk.Context, chainID string, providerAddr types.ProviderConsAddress) (types.ConsensusValidator, bool) { +// GetConsumerValidator returns the consumer validator with `providerAddr` if it exists for chain with `consumerId` +func (k Keeper) GetConsumerValidator(ctx sdk.Context, consumerId string, providerAddr types.ProviderConsAddress) (types.ConsensusValidator, bool) { store := ctx.KVStore(k.storeKey) - marshalledConsumerValidator := store.Get(types.ConsumerValidatorKey(chainID, providerAddr.ToSdkConsAddr())) + marshalledConsumerValidator := store.Get(types.ConsumerValidatorKey(consumerId, providerAddr.ToSdkConsAddr())) if marshalledConsumerValidator == nil { return types.ConsensusValidator{}, false @@ -72,12 +72,12 @@ func (k Keeper) GetConsumerValidator(ctx sdk.Context, chainID string, providerAd return validator, true } -// GetConsumerValSet returns all the consumer validators for chain `chainID` +// GetConsumerValSet returns all the consumer validators for chain with `consumerId` func (k Keeper) GetConsumerValSet( ctx sdk.Context, - chainID string, + consumerId string, ) ([]types.ConsensusValidator, error) { - return k.getValSet(ctx, k.GetConsumerChainConsensusValidatorsKey(ctx, chainID)) + return k.getValSet(ctx, k.GetConsumerChainConsensusValidatorsKey(ctx, consumerId)) } // DiffValidators compares the current and the next epoch's consumer validators and returns the `ValidatorUpdate` diff @@ -121,8 +121,8 @@ func DiffValidators( return updates } -// CreateConsumerValidator creates a consumer validator for `chainID` from the given staking `validator` -func (k Keeper) CreateConsumerValidator(ctx sdk.Context, chainID string, validator stakingtypes.Validator) (types.ConsensusValidator, error) { +// CreateConsumerValidator creates a consumer validator for `consumerId` from the given staking `validator` +func (k Keeper) CreateConsumerValidator(ctx sdk.Context, consumerId string, validator stakingtypes.Validator) (types.ConsensusValidator, error) { valAddr, err := sdk.ValAddressFromBech32(validator.GetOperator()) if err != nil { return types.ConsensusValidator{}, err @@ -138,7 +138,7 @@ func (k Keeper) CreateConsumerValidator(ctx sdk.Context, chainID string, validat validator, err) } - consumerPublicKey, found := k.GetValidatorConsumerPubKey(ctx, chainID, types.NewProviderConsAddress(consAddr)) + consumerPublicKey, found := k.GetValidatorConsumerPubKey(ctx, consumerId, types.NewProviderConsAddress(consAddr)) if !found { consumerPublicKey, err = validator.TmConsPublicKey() if err != nil { @@ -147,7 +147,7 @@ func (k Keeper) CreateConsumerValidator(ctx sdk.Context, chainID string, validat } height := ctx.BlockHeight() - if v, found := k.GetConsumerValidator(ctx, chainID, types.ProviderConsAddress{Address: consAddr}); found { + if v, found := k.GetConsumerValidator(ctx, consumerId, types.ProviderConsAddress{Address: consAddr}); found { // if validator was already a consumer validator, then do not update the height set the first time // the validator became a consumer validator height = v.JoinHeight @@ -165,7 +165,7 @@ func (k Keeper) CreateConsumerValidator(ctx sdk.Context, chainID string, validat // the filtered set. func (k Keeper) FilterValidators( ctx sdk.Context, - chainID string, + consumerId string, bondedValidators []stakingtypes.Validator, predicate func(providerAddr types.ProviderConsAddress) bool, ) []types.ConsensusValidator { @@ -177,7 +177,7 @@ func (k Keeper) FilterValidators( } if predicate(types.NewProviderConsAddress(consAddr)) { - nextValidator, err := k.CreateConsumerValidator(ctx, chainID, val) + nextValidator, err := k.CreateConsumerValidator(ctx, consumerId, val) if err != nil { // this should never happen but is recoverable if we exclude this validator from the next validator set k.Logger(ctx).Error("could not create consumer validator", diff --git a/x/ccv/provider/keeper/validator_set_update_test.go b/x/ccv/provider/keeper/validator_set_update_test.go index e343093dad..58ef556aec 100644 --- a/x/ccv/provider/keeper/validator_set_update_test.go +++ b/x/ccv/provider/keeper/validator_set_update_test.go @@ -32,11 +32,11 @@ func TestConsumerValidator(t *testing.T) { PublicKey: &crypto.PublicKey{}, } - require.False(t, providerKeeper.IsConsumerValidator(ctx, "chainID", types.NewProviderConsAddress(validator.ProviderConsAddr))) - providerKeeper.SetConsumerValidator(ctx, "chainID", validator) - require.True(t, providerKeeper.IsConsumerValidator(ctx, "chainID", types.NewProviderConsAddress(validator.ProviderConsAddr))) - providerKeeper.DeleteConsumerValidator(ctx, "chainID", types.NewProviderConsAddress(validator.ProviderConsAddr)) - require.False(t, providerKeeper.IsConsumerValidator(ctx, "chainID", types.NewProviderConsAddress(validator.ProviderConsAddr))) + require.False(t, providerKeeper.IsConsumerValidator(ctx, "consumerId", types.NewProviderConsAddress(validator.ProviderConsAddr))) + providerKeeper.SetConsumerValidator(ctx, "consumerId", validator) + require.True(t, providerKeeper.IsConsumerValidator(ctx, "consumerId", types.NewProviderConsAddress(validator.ProviderConsAddr))) + providerKeeper.DeleteConsumerValidator(ctx, "consumerId", types.NewProviderConsAddress(validator.ProviderConsAddr)) + require.False(t, providerKeeper.IsConsumerValidator(ctx, "consumerId", types.NewProviderConsAddress(validator.ProviderConsAddr))) } func TestGetConsumerValSet(t *testing.T) { @@ -75,7 +75,7 @@ func TestGetConsumerValSet(t *testing.T) { } for _, expectedValidator := range expectedValidators { - providerKeeper.SetConsumerValidator(ctx, "chainID", + providerKeeper.SetConsumerValidator(ctx, "consumerId", types.ConsensusValidator{ ProviderConsAddr: expectedValidator.ProviderConsAddr, Power: expectedValidator.Power, @@ -83,7 +83,7 @@ func TestGetConsumerValSet(t *testing.T) { }) } - actualValidators, err := providerKeeper.GetConsumerValSet(ctx, "chainID") + actualValidators, err := providerKeeper.GetConsumerValSet(ctx, "consumerId") require.NoError(t, err) // sort validators first to be able to compare @@ -126,6 +126,7 @@ func createStakingValidator(ctx sdk.Context, mocks testkeeper.MockedKeepers, ind return stakingtypes.Validator{ OperatorAddress: providerValidatorAddr.String(), ConsensusPubkey: pkAny, + Status: stakingtypes.Bonded, } } @@ -253,7 +254,7 @@ func TestSetConsumerValSet(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - chainID := "chainID" + chainID := "consumerId" currentValidators := []types.ConsensusValidator{ { @@ -306,7 +307,7 @@ func TestSetConsumerValSet(t *testing.T) { }, } - // set the `currentValidators` for chain `chainID` + // set the `currentValidators` for chain `consumerId` valSet, err := providerKeeper.GetConsumerValSet(ctx, chainID) require.NoError(t, err) require.Empty(t, valSet) @@ -338,7 +339,7 @@ func TestFilterValidatorsConsiderAll(t *testing.T) { providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - chainID := "chainID" + chainID := "consumerId" // no consumer validators returned if we have no bonded validators considerAll := func(providerAddr types.ProviderConsAddress) bool { return true } @@ -378,7 +379,7 @@ func TestFilterValidatorsConsiderOnlyOptIn(t *testing.T) { providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - chainID := "chainID" + chainID := "consumerId" // no consumer validators returned if we have no opted-in validators require.Empty(t, providerKeeper.FilterValidators(ctx, chainID, []stakingtypes.Validator{}, @@ -419,7 +420,7 @@ func TestFilterValidatorsConsiderOnlyOptIn(t *testing.T) { // the expected actual validators are the opted-in validators but with the correct power and consumer public keys set bondedValidators := []stakingtypes.Validator{valA, valB} - actualValidators := providerKeeper.FilterValidators(ctx, "chainID", bondedValidators, + actualValidators := providerKeeper.FilterValidators(ctx, "consumerId", bondedValidators, func(providerAddr types.ProviderConsAddress) bool { return providerKeeper.IsOptedIn(ctx, chainID, providerAddr) }) @@ -438,7 +439,7 @@ func TestFilterValidatorsConsiderOnlyOptIn(t *testing.T) { // create a staking validator C that is not opted in, hence `expectedValidators` remains the same valC := createStakingValidator(ctx, mocks, 3, 3, 3) bondedValidators = []stakingtypes.Validator{valA, valB, valC} - actualValidators = providerKeeper.FilterValidators(ctx, "chainID", bondedValidators, + actualValidators = providerKeeper.FilterValidators(ctx, "consumerId", bondedValidators, func(providerAddr types.ProviderConsAddress) bool { return providerKeeper.IsOptedIn(ctx, chainID, providerAddr) }) @@ -452,7 +453,7 @@ func TestCreateConsumerValidator(t *testing.T) { providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - chainID := "chainID" + chainID := "consumerId" // create a validator which has set a consumer public key valA := createStakingValidator(ctx, mocks, 0, 1, 1) diff --git a/x/ccv/provider/migrations/v5/migration_test.go b/x/ccv/provider/migrations/v5/migration_test.go index 907aa1b019..dce390ad71 100644 --- a/x/ccv/provider/migrations/v5/migration_test.go +++ b/x/ccv/provider/migrations/v5/migration_test.go @@ -16,15 +16,13 @@ func TestMigrateParams(t *testing.T) { provKeeper.SetConsumerClientId(ctx, "chainID", "clientID") // initially top N should not exist - topN, found := provKeeper.GetTopN(ctx, "chainID") - require.False(t, found) + topN := provKeeper.GetTopN(ctx, "chainID") require.Zero(t, topN) // migrate MigrateTopNForRegisteredChains(ctx, provKeeper) // after migration, top N should be 95 - topN, found = provKeeper.GetTopN(ctx, "chainID") - require.True(t, found) + topN = provKeeper.GetTopN(ctx, "chainID") require.Equal(t, uint32(95), topN) } diff --git a/x/ccv/provider/migrations/v5/migrations.go b/x/ccv/provider/migrations/v5/migrations.go index 411efd49e1..1dca37bbae 100644 --- a/x/ccv/provider/migrations/v5/migrations.go +++ b/x/ccv/provider/migrations/v5/migrations.go @@ -2,6 +2,7 @@ package v5 import ( sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" ) @@ -11,8 +12,12 @@ import ( // and a migration to rewrite the proposal is needed. func MigrateTopNForRegisteredChains(ctx sdk.Context, providerKeeper providerkeeper.Keeper) { // Set the topN of each chain to 95 - for _, chainID := range providerKeeper.GetAllRegisteredConsumerChainIDs(ctx) { - providerKeeper.SetTopN(ctx, chainID, 95) + for _, consumerId := range providerKeeper.GetAllRegisteredConsumerIds(ctx) { + // TODO (PERMISSIONLESS): this migration already took place and does not make much sense in the Permissionless world + // living here for now and we should totally remove + providerKeeper.SetConsumerPowerShapingParameters(ctx, consumerId, types.PowerShapingParameters{ + Top_N: 95, + }) } } diff --git a/x/ccv/provider/migrations/v6/migrations.go b/x/ccv/provider/migrations/v6/migrations.go index 5829f29222..933c5b9853 100644 --- a/x/ccv/provider/migrations/v6/migrations.go +++ b/x/ccv/provider/migrations/v6/migrations.go @@ -19,15 +19,12 @@ func MigrateParams(ctx sdk.Context, paramsSubspace paramtypes.Subspace) { func MigrateMinPowerInTopN(ctx sdk.Context, providerKeeper providerkeeper.Keeper) { // we only get the registered consumer chains and not also the proposed consumer chains because // the minimal power is first set when the consumer chain addition proposal passes - registeredConsumerChains := providerKeeper.GetAllRegisteredConsumerChainIDs(ctx) + registeredConsumerChains := providerKeeper.GetAllRegisteredConsumerIds(ctx) for _, chain := range registeredConsumerChains { // get the top N - topN, found := providerKeeper.GetTopN(ctx, chain) - if !found { - providerKeeper.Logger(ctx).Error("failed to get top N", "chain", chain) - continue - } else if topN == 0 { + topN := providerKeeper.GetTopN(ctx, chain) + if topN == 0 { providerKeeper.Logger(ctx).Info("top N is 0, not setting minimal power", "chain", chain) } else { // set the minimal power in the top N diff --git a/x/ccv/provider/module.go b/x/ccv/provider/module.go index 320a135a69..65ced5f37e 100644 --- a/x/ccv/provider/module.go +++ b/x/ccv/provider/module.go @@ -171,10 +171,11 @@ func (AppModule) ConsensusVersion() uint64 { return 8 } // BeginBlock implements the AppModule interface func (am AppModule) BeginBlock(ctx context.Context) error { - sdkCtx := sdk.UnwrapSDKContext(ctx) // Create clients to consumer chains that are due to be spawned via pending consumer addition proposals + sdkCtx := sdk.UnwrapSDKContext(ctx) + // Create clients to consumer chains that are due to be spawned am.keeper.BeginBlockInit(sdkCtx) - // Stop and remove state for any consumer chains that are due to be stopped via pending consumer removal proposals + // Stop and remove state for any consumer chains that are due to be stopped am.keeper.BeginBlockCCR(sdkCtx) // Check for replenishing slash meter before any slash packets are processed for this block am.keeper.BeginBlockCIS(sdkCtx) diff --git a/x/ccv/provider/module_test.go b/x/ccv/provider/module_test.go index 2b2ac1c63f..a019eb162f 100644 --- a/x/ccv/provider/module_test.go +++ b/x/ccv/provider/module_test.go @@ -174,11 +174,11 @@ func TestInitGenesis(t *testing.T) { numStatesCounted := 0 for _, state := range tc.consumerStates { numStatesCounted += 1 - channelID, found := providerKeeper.GetChainToChannel(ctx, state.ChainId) + channelID, found := providerKeeper.GetConsumerIdToChannelId(ctx, state.ChainId) require.True(t, found) require.Equal(t, state.ChannelId, channelID) - chainID, found := providerKeeper.GetChannelToChain(ctx, state.ChannelId) + chainID, found := providerKeeper.GetChannelIdToConsumerId(ctx, state.ChannelId) require.True(t, found) require.Equal(t, state.ChainId, chainID) } diff --git a/x/ccv/provider/proposal_handler.go b/x/ccv/provider/proposal_handler.go index 40a551d185..01d92d3e9e 100644 --- a/x/ccv/provider/proposal_handler.go +++ b/x/ccv/provider/proposal_handler.go @@ -18,11 +18,9 @@ func NewProviderProposalHandler(k keeper.Keeper) govv1beta1.Handler { return func(ctx sdk.Context, content govv1beta1.Content) error { switch c := content.(type) { case *types.ConsumerAdditionProposal: - return k.HandleLegacyConsumerAdditionProposal(ctx, c) + return nil case *types.ConsumerRemovalProposal: - return k.HandleLegacyConsumerRemovalProposal(ctx, c) - case *types.ConsumerModificationProposal: - return k.HandleLegacyConsumerModificationProposal(ctx, c) + return nil case *types.ChangeRewardDenomsProposal: return k.HandleLegacyConsumerRewardDenomProposal(ctx, c) default: diff --git a/x/ccv/provider/proposal_handler_test.go b/x/ccv/provider/proposal_handler_test.go index 67bcad7d15..cf1e82284b 100644 --- a/x/ccv/provider/proposal_handler_test.go +++ b/x/ccv/provider/proposal_handler_test.go @@ -6,14 +6,10 @@ import ( "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - testkeeper "github.com/cosmos/interchain-security/v5/testutil/keeper" "github.com/cosmos/interchain-security/v5/x/ccv/provider" providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" @@ -30,40 +26,9 @@ func TestProviderProposalHandler(t *testing.T) { name string content govv1beta1.Content blockTime time.Time - expValidConsumerAddition bool expValidConsumerRemoval bool expValidChangeRewardDenom bool }{ - { - name: "valid consumer addition proposal", - content: providertypes.NewConsumerAdditionProposal( - "title", "description", "chainID", - clienttypes.NewHeight(2, 3), []byte("gen_hash"), []byte("bin_hash"), now, - "0.75", - 10, - "", - 10000, - 100000000000, - 100000000000, - 100000000000, - 0, - 0, - 0, - nil, - nil, - 0, - false, - ), - blockTime: hourFromNow, // ctx blocktime is after proposal's spawn time - expValidConsumerAddition: true, - }, - { - name: "valid consumer removal proposal", - content: providertypes.NewConsumerRemovalProposal( - "title", "description", "chainID", now), - blockTime: hourFromNow, - expValidConsumerRemoval: true, - }, { name: "valid change reward denoms proposal", content: providertypes.NewChangeRewardDenomsProposal( @@ -93,23 +58,12 @@ func TestProviderProposalHandler(t *testing.T) { // Setup keeperParams := testkeeper.NewInMemKeeperParams(t) - providerKeeper, ctx, _, mocks := testkeeper.GetProviderKeeperAndCtx(t, keeperParams) + providerKeeper, ctx, _, _ := testkeeper.GetProviderKeeperAndCtx(t, keeperParams) providerKeeper.SetParams(ctx, providertypes.DefaultParams()) ctx = ctx.WithBlockTime(tc.blockTime) // Mock expectations depending on expected outcome switch { - case tc.expValidConsumerAddition: - testkeeper.SetupMocksForLastBondedValidatorsExpectation(mocks.MockStakingKeeper, 1, []stakingtypes.Validator{}, 1) - gomock.InOrder(testkeeper.GetMocksForCreateConsumerClient( - ctx, &mocks, "chainID", clienttypes.NewHeight(2, 3), - )...) - - case tc.expValidConsumerRemoval: - testkeeper.SetupForStoppingConsumerChain(t, ctx, &providerKeeper, mocks) - - // assert mocks for expected calls to `StopConsumerChain` when closing the underlying channel - gomock.InOrder(testkeeper.GetMocksForStopConsumerChainWithCloseChannel(ctx, &mocks)...) case tc.expValidChangeRewardDenom: // Nothing to mock } @@ -117,9 +71,7 @@ func TestProviderProposalHandler(t *testing.T) { // Execution proposalHandler := provider.NewProviderProposalHandler(providerKeeper) err := proposalHandler(ctx, tc.content) - - if tc.expValidConsumerAddition || tc.expValidConsumerRemoval || - tc.expValidChangeRewardDenom { + if tc.expValidChangeRewardDenom { require.NoError(t, err) } else { require.Error(t, err) diff --git a/x/ccv/provider/types/codec.go b/x/ccv/provider/types/codec.go index a3593fb22f..18915de7e7 100644 --- a/x/ccv/provider/types/codec.go +++ b/x/ccv/provider/types/codec.go @@ -24,15 +24,12 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { (*govv1beta1.Content)(nil), &ConsumerRemovalProposal{}, ) - registry.RegisterImplementations( - (*govv1beta1.Content)(nil), - &ConsumerModificationProposal{}, - ) registry.RegisterImplementations( (*sdk.Msg)(nil), &MsgAssignConsumerKey{}, - &MsgConsumerAddition{}, - &MsgConsumerRemoval{}, + &MsgCreateConsumer{}, + &MsgUpdateConsumer{}, + &MsgRemoveConsumer{}, &MsgChangeRewardDenoms{}, &MsgUpdateParams{}, ) diff --git a/x/ccv/provider/types/errors.go b/x/ccv/provider/types/errors.go index 5109489d76..94e9e5669a 100644 --- a/x/ccv/provider/types/errors.go +++ b/x/ccv/provider/types/errors.go @@ -6,30 +6,45 @@ import ( // Provider sentinel errors var ( - ErrInvalidConsumerAdditionProposal = errorsmod.Register(ModuleName, 1, "invalid consumer addition proposal") - ErrInvalidConsumerRemovalProp = errorsmod.Register(ModuleName, 2, "invalid consumer removal proposal") - ErrUnknownConsumerChainId = errorsmod.Register(ModuleName, 3, "no consumer chain with this chain id") - ErrUnknownConsumerChannelId = errorsmod.Register(ModuleName, 4, "no consumer chain with this channel id") - ErrInvalidConsumerConsensusPubKey = errorsmod.Register(ModuleName, 5, "empty consumer consensus public key") - ErrInvalidConsumerChainID = errorsmod.Register(ModuleName, 6, "invalid consumer chain id") - ErrConsumerKeyNotFound = errorsmod.Register(ModuleName, 7, "consumer key not found") - ErrNoValidatorConsumerAddress = errorsmod.Register(ModuleName, 8, "error getting validator consumer address") - ErrNoValidatorProviderAddress = errorsmod.Register(ModuleName, 9, "error getting validator provider address") - ErrConsumerKeyInUse = errorsmod.Register(ModuleName, 10, "consumer key is already in use by a validator") - ErrCannotAssignDefaultKeyAssignment = errorsmod.Register(ModuleName, 11, "cannot re-assign default key assignment") - ErrInvalidConsumerParams = errorsmod.Register(ModuleName, 12, "invalid consumer params") - ErrInvalidProviderAddress = errorsmod.Register(ModuleName, 13, "invalid provider address") - ErrInvalidConsumerRewardDenom = errorsmod.Register(ModuleName, 14, "invalid consumer reward denom") - ErrInvalidDepositorAddress = errorsmod.Register(ModuleName, 15, "invalid depositor address") - ErrInvalidConsumerClient = errorsmod.Register(ModuleName, 16, "ccv channel is not built on correct client") - ErrDuplicateConsumerChain = errorsmod.Register(ModuleName, 17, "consumer chain already exists") - ErrConsumerChainNotFound = errorsmod.Register(ModuleName, 18, "consumer chain not found") - ErrInvalidConsumerCommissionRate = errorsmod.Register(ModuleName, 19, "consumer commission rate is invalid") - ErrCannotOptOutFromTopN = errorsmod.Register(ModuleName, 20, "cannot opt out from a Top N chain") - ErrNoUnconfirmedVSCPacket = errorsmod.Register(ModuleName, 21, "no unconfirmed vsc packet for this chain id") - ErrInvalidConsumerModificationProposal = errorsmod.Register(ModuleName, 22, "invalid consumer modification proposal") - ErrNoUnbondingTime = errorsmod.Register(ModuleName, 23, "provider unbonding time not found") - ErrInvalidAddress = errorsmod.Register(ModuleName, 24, "invalid address") - ErrUnauthorized = errorsmod.Register(ModuleName, 25, "unauthorized") - ErrBlankConsumerChainID = errorsmod.Register(ModuleName, 26, "consumer chain id must not be blank") + ErrInvalidConsumerAdditionProposal = errorsmod.Register(ModuleName, 1, "invalid consumer addition proposal") + ErrInvalidConsumerRemovalProp = errorsmod.Register(ModuleName, 2, "invalid consumer removal proposal") + ErrUnknownConsumerId = errorsmod.Register(ModuleName, 3, "no consumer chain with this consumer id") + ErrUnknownConsumerChannelId = errorsmod.Register(ModuleName, 4, "no consumer chain with this channel id") + ErrInvalidConsumerConsensusPubKey = errorsmod.Register(ModuleName, 5, "empty consumer consensus public key") + ErrInvalidConsumerId = errorsmod.Register(ModuleName, 6, "invalid consumer id") + ErrConsumerKeyNotFound = errorsmod.Register(ModuleName, 7, "consumer key not found") + ErrNoValidatorConsumerAddress = errorsmod.Register(ModuleName, 8, "error getting validator consumer address") + ErrNoValidatorProviderAddress = errorsmod.Register(ModuleName, 9, "error getting validator provider address") + ErrConsumerKeyInUse = errorsmod.Register(ModuleName, 10, "consumer key is already in use by a validator") + ErrCannotAssignDefaultKeyAssignment = errorsmod.Register(ModuleName, 11, "cannot re-assign default key assignment") + ErrInvalidConsumerParams = errorsmod.Register(ModuleName, 12, "invalid consumer params") + ErrInvalidProviderAddress = errorsmod.Register(ModuleName, 13, "invalid provider address") + ErrInvalidConsumerRewardDenom = errorsmod.Register(ModuleName, 14, "invalid consumer reward denom") + ErrInvalidDepositorAddress = errorsmod.Register(ModuleName, 15, "invalid depositor address") + ErrInvalidConsumerClient = errorsmod.Register(ModuleName, 16, "ccv channel is not built on correct client") + ErrDuplicateConsumerChain = errorsmod.Register(ModuleName, 17, "consumer chain already exists") + ErrConsumerChainNotFound = errorsmod.Register(ModuleName, 18, "consumer chain not found") + ErrInvalidConsumerCommissionRate = errorsmod.Register(ModuleName, 19, "consumer commission rate is invalid") + ErrCannotOptOutFromTopN = errorsmod.Register(ModuleName, 20, "cannot opt out from a Top N chain") + ErrNoUnconfirmedVSCPacket = errorsmod.Register(ModuleName, 21, "no unconfirmed vsc packet for this chain id") + ErrInvalidConsumerModificationProposal = errorsmod.Register(ModuleName, 22, "invalid consumer modification proposal") + ErrNoUnbondingTime = errorsmod.Register(ModuleName, 23, "provider unbonding time not found") + ErrInvalidAddress = errorsmod.Register(ModuleName, 24, "invalid address") + ErrUnauthorized = errorsmod.Register(ModuleName, 25, "unauthorized") + ErrBlankConsumerChainID = errorsmod.Register(ModuleName, 26, "consumer chain id must not be blank") + ErrInvalidPhase = errorsmod.Register(ModuleName, 27, "cannot perform action in the current phase of consumer chain") + ErrInvalidConsumerMetadata = errorsmod.Register(ModuleName, 28, "invalid consumer metadata") + ErrInvalidPowerShapingParameters = errorsmod.Register(ModuleName, 29, "invalid power shaping parameters") + ErrInvalidConsumerInitializationParameters = errorsmod.Register(ModuleName, 30, "invalid consumer initialization parameters") + ErrCannotUpdateMinimumPowerInTopN = errorsmod.Register(ModuleName, 31, "cannot update minimum power in Top N") + ErrNoChainId = errorsmod.Register(ModuleName, 32, "missing chain id for consumer chain") + ErrNoConsumerGenesis = errorsmod.Register(ModuleName, 33, "missing consumer genesis") + ErrInvalidConsumerGenesis = errorsmod.Register(ModuleName, 34, "invalid consumer genesis") + ErrNoConsumerId = errorsmod.Register(ModuleName, 35, "missing consumer id") + ErrAlreadyOptedIn = errorsmod.Register(ModuleName, 36, "already opted in to a chain with the same chain id") + ErrNoOwnerAddress = errorsmod.Register(ModuleName, 37, "missing owner address") + ErrInvalidNewOwnerAddress = errorsmod.Register(ModuleName, 38, "invalid new owner address") + ErrInvalidTransformToTopN = errorsmod.Register(ModuleName, 39, "invalid transform to Top N chain") + ErrInvalidTransformToOptIn = errorsmod.Register(ModuleName, 40, "invalid transform to Opt In chain") + ErrCannotCreateTopNChain = errorsmod.Register(ModuleName, 41, "cannot create Top N chain outside permissionlessly") ) diff --git a/x/ccv/provider/types/events.go b/x/ccv/provider/types/events.go index 9abcba7836..982b383f03 100644 --- a/x/ccv/provider/types/events.go +++ b/x/ccv/provider/types/events.go @@ -18,5 +18,5 @@ const ( AttributeConsumerConsensusPubKey = "consumer_consensus_pub_key" AttributeConsumerRewardDenom = "consumer_reward_denom" AttributeConsumerCommissionRate = "consumer_commission_rate" - AttributeConsumerChainID = "consumer_chain_id" + AttributeConsumerId = "consumer_chain_id" ) diff --git a/x/ccv/provider/types/keys.go b/x/ccv/provider/types/keys.go index bd9ccbd807..b9bf842a43 100644 --- a/x/ccv/provider/types/keys.go +++ b/x/ccv/provider/types/keys.go @@ -49,11 +49,11 @@ const ( SlashMeterReplenishTimeCandidateKeyName = "SlashMeterReplenishTimeCandidateKey" - ChainToChannelKeyName = "ChainToChannelKey" + ConsumerIdToChannelIdKeyName = "ConsumerIdToChannelIdKey" - ChannelToChainKeyName = "ChannelToChainKey" + ChannelIdToConsumerIdKeyName = "ChannelToConsumerIdKey" - ChainToClientKeyName = "ChainToClientKey" + ConsumerIdToClientIdKeyName = "ConsumerIdToClientIdKey" DeprecatedInitTimeoutTimestampKeyName = "DeprecatedInitTimeoutTimestampKey" @@ -81,7 +81,7 @@ const ( ThrottledPacketDataKeyName = "ThrottledPacketDataKey" - GlobalSlashEntryKeyName = "GlobalSlashEntryKey" + DeprecatedGlobalSlashEntryKeyName = "DeprecatedGlobalSlashEntryKey" ConsumerValidatorsKeyName = "ConsumerValidatorsKey" @@ -105,11 +105,11 @@ const ( OptedInKeyName = "OptedInKey" - TopNKeyName = "TopNKey" + DeprecatedTopNKeyName = "DeprecatedTopNKey" - ValidatorsPowerCapKeyName = "ValidatorsPowerCapKey" + DeprecatedValidatorsPowerCapKeyName = "DeprecatedValidatorsPowerCapKey" - ValidatorSetCapKeyName = "ValidatorSetCapKey" + DeprecatedValidatorSetCapKeyName = "DeprecatedValidatorSetCapKey" AllowlistKeyName = "AllowlistKey" @@ -123,11 +123,35 @@ const ( LastProviderConsensusValsKeyName = "LastProviderConsensusValsKey" - MinStakeKeyName = "MinStakeKey" + DeprecatedMinStakeKeyName = "DeprecatedMinStakeKey" - AllowInactiveValidatorsKeyName = "AllowInactiveValidatorsKey" + DeprecatedAllowInactiveValidatorsKeyName = "DeprecatedAllowInactiveValidatorsKey" ConsumerAddrsToPruneV2KeyName = "ConsumerAddrsToPruneV2Key" + + ConsumerIdKeyName = "ConsumerIdKey" + + ConsumerIdToChainIdKeyName = "ConsumerIdToChainIdKey" + + ConsumerIdToOwnerAddressKeyName = "ConsumerIdToOwnerAddress" + + ConsumerIdToConsumerMetadataKeyName = "ConsumerIdToMetadataKey" + + ConsumerIdToInitializationParametersKeyName = "ConsumerIdToInitializationParametersKey" + + ConsumerIdToPowerShapingParameters = "ConsumerIdToPowerShapingParametersKey" + + ConsumerIdToPhaseKeyName = "ConsumerIdToPhaseKey" + + ConsumerIdToStopTimeKeyName = "ConsumerIdToStopTimeKey" + + SpawnTimeToConsumerIdsKeyName = "SpawnTimeToConsumerIdsKeyName" + + StopTimeToConsumerIdsKeyName = "StopTimeToConsumerIdsKeyName" + + ProviderConsAddrToOptedInConsumerIdsKeyName = "ProviderConsAddrToOptedInConsumerIdsKeyName" + + ClientIdToConsumerIdKeyName = "ClientIdToConsumerIdKey" ) // getKeyPrefixes returns a constant map of all the byte prefixes for existing keys @@ -157,16 +181,16 @@ func getKeyPrefixes() map[string]byte { // SlashMeterReplenishTimeCandidateKey is the key for storing the slash meter replenish time candidate SlashMeterReplenishTimeCandidateKeyName: 4, - // ChainToChannelKey is the key for storing mapping + // ConsumerIdToChannelIdKey is the key for storing mapping // from chainID to the channel ID that is used to send over validator set changes. - ChainToChannelKeyName: 5, + ConsumerIdToChannelIdKeyName: 5, - // ChannelToChainKey is the key for storing mapping + // ChannelToConsumerIdKey is the key for storing mapping // from the CCV channel ID to the consumer chain ID. - ChannelToChainKeyName: 6, + ChannelIdToConsumerIdKeyName: 6, - // ChainToClientKey is the key for storing the client ID for a given consumer chainID. - ChainToClientKeyName: 7, + // ConsumerIdToClientIdKey is the key for storing the client ID for a given consumer chainID. + ConsumerIdToClientIdKeyName: 7, // InitTimeoutTimestampKey is the key for storing // the init timeout timestamp for a given consumer chainID. @@ -223,7 +247,8 @@ func getKeyPrefixes() map[string]byte { ThrottledPacketDataKeyName: 20, // GlobalSlashEntryKey is the key for storing global slash queue entries - GlobalSlashEntryKeyName: 21, + // [DEPRECATED] + DeprecatedGlobalSlashEntryKeyName: 21, // ConsumerValidatorsKey is the key for storing the validator assigned keys for every consumer chain ConsumerValidatorsKeyName: 22, @@ -270,18 +295,24 @@ func getKeyPrefixes() map[string]byte { // OptedInKey is the key for storing whether a validator is opted in to validate on a consumer chain OptedInKeyName: 32, - // TopNKey is the key for storing the mapping from a consumer chain to the N value of this chain, + // DeprecatedTopNKey is the key for storing the mapping from a consumer chain to the N value of this chain, // that corresponds to the N% of the top validators that have to validate this consumer chain - TopNKeyName: 33, + // NOTE: This prefix is deprecated, but left in place to avoid state migrations + // [DEPRECATED] + DeprecatedTopNKeyName: 33, - // ValidatorsPowerCapKey is the key for storing the mapping from a consumer chain to the power-cap value of this chain, + // DeprecatedValidatorsPowerCapKey is the key for storing the mapping from a consumer chain to the power-cap value of this chain, // that corresponds to p% such that no validator can have more than p% of the voting power on the consumer chain. // Operates on a best-effort basis. - ValidatorsPowerCapKeyName: 34, + // NOTE: This prefix is deprecated, but left in place to avoid state migrations + // [DEPRECATED] + DeprecatedValidatorsPowerCapKeyName: 34, - // ValidatorSetCapKey is the key for storing the mapping from a consumer chain to the validator-set cap value + // DeprecatedValidatorSetCapKey is the key for storing the mapping from a consumer chain to the validator-set cap value // of this chain. - ValidatorSetCapKeyName: 35, + // NOTE: This prefix is deprecated, but left in place to avoid state migrations + // [DEPRECATED] + DeprecatedValidatorSetCapKeyName: 35, // AllowlistKey is the key for storing the mapping from a consumer chain to the set of validators that are // allowlisted. @@ -311,14 +342,44 @@ func getKeyPrefixes() map[string]byte { // sent to the consensus engine of the provider chain LastProviderConsensusValsKeyName: 42, - // MinStakeKey is the byte prefix for storing the mapping from consumer chains to the minimum stake required to be a validator on the consumer chain - // The minimum stake must be stored on the provider chain, not on the consumer chain itself, since it filters out - // validators from the VSCPackets that we send to the consumer chain. - MinStakeKeyName: 43, + // ConsumerIdKeyName is the key for storing the consumer id for the next registered consumer chain + ConsumerIdKeyName: 43, + + // ConsumerIdToChainIdKeyName is the key for storing the chain id for the given consumer id + ConsumerIdToChainIdKeyName: 44, + + // ConsumerIdToOwnerAddressKeyName is the key for storing the owner address for the given consumer id + ConsumerIdToOwnerAddressKeyName: 45, + + // ConsumerIdToConsumerMetadataKeyName is the key for storing the metadata for the given consumer id + ConsumerIdToConsumerMetadataKeyName: 46, + + // ConsumerIdToInitializationParametersKeyName is the key for storing the initialization parameters for the given consumer id + ConsumerIdToInitializationParametersKeyName: 47, + + // ConsumerIdToPowerShapingParameters is the key for storing the power-shaping parameters for the given consumer id + ConsumerIdToPowerShapingParameters: 48, + + // ConsumerIdToPhaseKeyName is the key for storing the phase of a consumer chain with the given consumer id + ConsumerIdToPhaseKeyName: 49, + + // ConsumerIdToStopTimeKeyName is the key for storing the stop time of a consumer chain that is to be removed + ConsumerIdToStopTimeKeyName: 50, + + // SpawnTimeToConsumerIdKeyName is the key for storing pending initialized consumers that are to be launched. + // For a specific spawn time, it might store multiple consumer chain ids for chains that are to be launched. + SpawnTimeToConsumerIdsKeyName: 51, + + // StopTimeToConsumerIdKeyName is the key for storing pending launched consumers that are to be stopped. + // For a specific stop time, it might store multiple consumer chain ids for chains that are to be stopped. + StopTimeToConsumerIdsKeyName: 52, - // AllowInactiveValidatorsKey is the byte prefix for storing the mapping from consumer chains to the boolean value - // that determines whether inactive validators can validate on that chain - AllowInactiveValidatorsKeyName: 44, + // ProviderConsAddrToOptedInConsumerIdsKeyName is the key for storing all the consumer ids that a validator + // is currently opted in to. + ProviderConsAddrToOptedInConsumerIdsKeyName: 53, + + // ClientIdToConsumerIdKeyName is the key for storing the consumer id for the given client id + ClientIdToConsumerIdKeyName: 54, // NOTE: DO NOT ADD NEW BYTE PREFIXES HERE WITHOUT ADDING THEM TO TestPreserveBytePrefix() IN keys_test.go } @@ -392,29 +453,29 @@ func SlashMeterReplenishTimeCandidateKey() []byte { return []byte{mustGetKeyPrefix(SlashMeterReplenishTimeCandidateKeyName)} } -// ChainToChannelKey returns the key under which the CCV channel ID will be stored for the given consumer chain. -func ChainToChannelKey(chainID string) []byte { - return append([]byte{mustGetKeyPrefix(ChainToChannelKeyName)}, []byte(chainID)...) +// ConsumerIdToChannelIdKey returns the key under which the CCV channel ID will be stored for the given consumer chain. +func ConsumerIdToChannelIdKey(consumerId string) []byte { + return append([]byte{mustGetKeyPrefix(ConsumerIdToChannelIdKeyName)}, []byte(consumerId)...) } -// ChannelToChainKeyPrefix returns the key prefix for storing the consumer chain IDs. -func ChannelToChainKeyPrefix() []byte { - return []byte{mustGetKeyPrefix(ChannelToChainKeyName)} +// ChannelIdToConsumerIdKeyPrefix returns the key prefix for storing the consumer chain ids. +func ChannelIdToConsumerIdKeyPrefix() []byte { + return []byte{mustGetKeyPrefix(ChannelIdToConsumerIdKeyName)} } -// ChannelToChainKey returns the key under which the consumer chain ID will be stored for the given channelID. -func ChannelToChainKey(channelID string) []byte { - return append(ChannelToChainKeyPrefix(), []byte(channelID)...) +// ChannelToConsumerIdKey returns the key under which the consumer chain id will be stored for the given channelId. +func ChannelToConsumerIdKey(channelId string) []byte { + return append(ChannelIdToConsumerIdKeyPrefix(), []byte(channelId)...) } -// ChainToClientKeyPrefix returns the key prefix for storing the clientID for the given chainID. -func ChainToClientKeyPrefix() []byte { - return []byte{mustGetKeyPrefix(ChainToClientKeyName)} +// ConsumerIdToClientIdKeyPrefix returns the key prefix for storing the clientId for the given consumerId. +func ConsumerIdToClientIdKeyPrefix() []byte { + return []byte{mustGetKeyPrefix(ConsumerIdToClientIdKeyName)} } -// ChainToClientKey returns the key under which the clientID for the given chainID is stored. -func ChainToClientKey(chainID string) []byte { - return append(ChainToClientKeyPrefix(), []byte(chainID)...) +// ConsumerIdToClientIdKey returns the key under which the clientId for the given consumerId is stored. +func ConsumerIdToClientIdKey(consumerId string) []byte { + return append(ConsumerIdToClientIdKeyPrefix(), []byte(consumerId)...) } // PendingCAPKeyPrefix returns the key prefix for storing a pending consumer addition proposal @@ -468,25 +529,25 @@ func ValsetUpdateBlockHeightKey(valsetUpdateId uint64) []byte { } // ConsumerGenesisKey returns the key corresponding to consumer genesis state material -// (consensus state and client state) indexed by consumer chain id -func ConsumerGenesisKey(chainID string) []byte { - return append([]byte{mustGetKeyPrefix(ConsumerGenesisKeyName)}, []byte(chainID)...) +// (consensus state and client state) indexed by consumer id +func ConsumerGenesisKey(consumerId string) []byte { + return append([]byte{mustGetKeyPrefix(ConsumerGenesisKeyName)}, []byte(consumerId)...) } -// SlashAcksKey returns the key under which slashing acks are stored for a given chain ID -func SlashAcksKey(chainID string) []byte { - return append([]byte{mustGetKeyPrefix(SlashAcksKeyName)}, []byte(chainID)...) +// SlashAcksKey returns the key under which slashing acks are stored for a given consumer id +func SlashAcksKey(consumerId string) []byte { + return append([]byte{mustGetKeyPrefix(SlashAcksKeyName)}, []byte(consumerId)...) } -// InitChainHeightKey returns the key under which the block height for a given chain ID is stored -func InitChainHeightKey(chainID string) []byte { - return append([]byte{mustGetKeyPrefix(InitChainHeightKeyName)}, []byte(chainID)...) +// InitChainHeightKey returns the key under which the block height for a given consumer id is stored +func InitChainHeightKey(consumerId string) []byte { + return append([]byte{mustGetKeyPrefix(InitChainHeightKeyName)}, []byte(consumerId)...) } // PendingVSCsKey returns the key under which -// pending ValidatorSetChangePacket data is stored for a given chain ID -func PendingVSCsKey(chainID string) []byte { - return append([]byte{mustGetKeyPrefix(PendingVSCsKeyName)}, []byte(chainID)...) +// pending ValidatorSetChangePacket data is stored for a given consumer id +func PendingVSCsKey(consumerId string) []byte { + return append([]byte{mustGetKeyPrefix(PendingVSCsKeyName)}, []byte(consumerId)...) } // ThrottledPacketDataSizeKey returns the key storing the size of the throttled packet data queue for a given chain ID @@ -518,50 +579,6 @@ func ParseThrottledPacketDataKey(key []byte) (chainId string, ibcSeqNum uint64, return ParseChainIdAndUintIdKey(ThrottledPacketDataKeyPrefix(), key) } -// GlobalSlashEntryKeyPrefix returns the key for storing a global slash queue entry. -func GlobalSlashEntryKeyPrefix() []byte { - return []byte{mustGetKeyPrefix(GlobalSlashEntryKeyName)} -} - -// GlobalSlashEntryKey returns the key for storing a global slash queue entry. -func GlobalSlashEntryKey(entry GlobalSlashEntry) []byte { - recvTime := uint64(entry.RecvTime.UTC().UnixNano()) - return ccvtypes.AppendMany( - // Append byte prefix - GlobalSlashEntryKeyPrefix(), - // Append time bz - sdk.Uint64ToBigEndian(recvTime), - // Append ibc seq num - sdk.Uint64ToBigEndian(entry.IbcSeqNum), - // Append consumer chain id - []byte(entry.ConsumerChainID), - ) -} - -// MustParseGlobalSlashEntryKey returns the received time and chainID for a global slash queue entry key, -// or panics if the key is invalid. -func MustParseGlobalSlashEntryKey(bz []byte) ( - recvTime time.Time, consumerChainID string, ibcSeqNum uint64, -) { - // Prefix is in first byte - expectedPrefix := GlobalSlashEntryKeyPrefix() - if prefix := bz[:1]; !bytes.Equal(prefix, expectedPrefix) { - panic(fmt.Sprintf("invalid prefix; expected: %X, got: %X", expectedPrefix, prefix)) - } - - // 8 bytes for uint64 storing time bytes - timeBz := sdk.BigEndianToUint64(bz[1:9]) - recvTime = time.Unix(0, int64(timeBz)).UTC() - - // 8 bytes for uint64 storing ibc seq num - ibcSeqNum = sdk.BigEndianToUint64(bz[9:17]) - - // ChainID is stored after 8 byte ibc seq num - chainID := string(bz[17:]) - - return recvTime, chainID, ibcSeqNum -} - // ConsumerValidatorsKey returns the key for storing the validator assigned keys for every consumer chain func ConsumerValidatorsKeyPrefix() byte { return mustGetKeyPrefix(ConsumerValidatorsKeyName) @@ -569,8 +586,8 @@ func ConsumerValidatorsKeyPrefix() byte { // ConsumerValidatorsKey returns the key under which the // validator assigned keys for every consumer chain are stored -func ConsumerValidatorsKey(chainID string, addr ProviderConsAddress) []byte { - return ChainIdAndConsAddrKey(ConsumerValidatorsKeyPrefix(), chainID, addr.ToSdkConsAddr()) +func ConsumerValidatorsKey(consumerId string, addr ProviderConsAddress) []byte { + return ConsumerIdAndConsAddrKey(ConsumerValidatorsKeyPrefix(), consumerId, addr.ToSdkConsAddr()) } // ValidatorsByConsumerAddrKeyPrefix returns the key prefix for storing the mapping from validator addresses @@ -581,8 +598,8 @@ func ValidatorsByConsumerAddrKeyPrefix() byte { // ValidatorsByConsumerAddrKey returns the key for storing the mapping from validator addresses // on consumer chains to validator addresses on the provider chain -func ValidatorsByConsumerAddrKey(chainID string, addr ConsumerConsAddress) []byte { - return ChainIdAndConsAddrKey(ValidatorsByConsumerAddrKeyPrefix(), chainID, addr.ToSdkConsAddr()) +func ValidatorsByConsumerAddrKey(consumerId string, addr ConsumerConsAddress) []byte { + return ConsumerIdAndConsAddrKey(ValidatorsByConsumerAddrKeyPrefix(), consumerId, addr.ToSdkConsAddr()) } // SlashLogKey returns the key to a validator's slash log @@ -601,9 +618,9 @@ func ConsumerRewardDenomsKey(denom string) []byte { } // EquivocationEvidenceMinHeightKey returns the key storing the minimum height -// of a valid consumer equivocation evidence for a given consumer chain ID -func EquivocationEvidenceMinHeightKey(consumerChainID string) []byte { - return append([]byte{mustGetKeyPrefix(EquivocationEvidenceMinHeightKeyName)}, []byte(consumerChainID)...) +// of a valid consumer equivocation evidence for a given consumer id +func EquivocationEvidenceMinHeightKey(consumerId string) []byte { + return append([]byte{mustGetKeyPrefix(EquivocationEvidenceMinHeightKeyName)}, []byte(consumerId)...) } // ProposedConsumerChainKeyPrefix returns the key prefix for storing proposed consumer chainId @@ -638,37 +655,21 @@ func ConsumerValidatorKeyPrefix() byte { } // ConsumerValidatorKey returns the key for storing consumer validators -// for the given consumer chain `chainID` and validator with `providerAddr` -func ConsumerValidatorKey(chainID string, providerAddr []byte) []byte { - prefix := ChainIdWithLenKey(ConsumerValidatorKeyPrefix(), chainID) +// for the given consumer chain `consumerId` and validator with `providerAddr` +func ConsumerValidatorKey(consumerId string, providerAddr []byte) []byte { + prefix := ConsumerIdWithLenKey(ConsumerValidatorKeyPrefix(), consumerId) return append(prefix, providerAddr...) } -// TopNKey returns the key used to store the Top N value per consumer chain. -// This value corresponds to the N% of the top validators that have to validate the consumer chain. -func TopNKey(chainID string) []byte { - return ChainIdWithLenKey(mustGetKeyPrefix(TopNKeyName), chainID) -} - -// ValidatorSetPowerKey returns the key of consumer chain `chainID` -func ValidatorsPowerCapKey(chainID string) []byte { - return ChainIdWithLenKey(mustGetKeyPrefix(ValidatorsPowerCapKeyName), chainID) -} - -// ValidatorSetCapKey returns the key of consumer chain `chainID` -func ValidatorSetCapKey(chainID string) []byte { - return ChainIdWithLenKey(mustGetKeyPrefix(ValidatorSetCapKeyName), chainID) -} - // AllowlistKeyPrefix returns the key prefix for storing consumer chains allowlists func AllowlistKeyPrefix() byte { return mustGetKeyPrefix(AllowlistKeyName) } // AllowlistKey returns the key for storing consumer chains allowlists -func AllowlistKey(chainID string, providerAddr ProviderConsAddress) []byte { +func AllowlistKey(consumerId string, providerAddr ProviderConsAddress) []byte { return append( - ChainIdWithLenKey(AllowlistKeyPrefix(), chainID), + ConsumerIdWithLenKey(AllowlistKeyPrefix(), consumerId), providerAddr.ToSdkConsAddr().Bytes()..., ) } @@ -679,9 +680,9 @@ func DenylistKeyPrefix() byte { } // DenylistKey returns the key for storing consumer chains denylists -func DenylistKey(chainID string, providerAddr ProviderConsAddress) []byte { +func DenylistKey(consumerId string, providerAddr ProviderConsAddress) []byte { return append( - ChainIdWithLenKey(DenylistKeyPrefix(), chainID), + ConsumerIdWithLenKey(DenylistKeyPrefix(), consumerId), providerAddr.ToSdkConsAddr().Bytes()..., ) } @@ -692,14 +693,14 @@ func OptedInKeyPrefix() byte { } // OptedInKey returns the key used to store whether a validator is opted in on a consumer chain. -func OptedInKey(chainID string, providerAddr ProviderConsAddress) []byte { - prefix := ChainIdWithLenKey(OptedInKeyPrefix(), chainID) +func OptedInKey(consumerId string, providerAddr ProviderConsAddress) []byte { + prefix := ConsumerIdWithLenKey(OptedInKeyPrefix(), consumerId) return append(prefix, providerAddr.ToSdkConsAddr().Bytes()...) } // ConsumerRewardsAllocationKey returns the key used to store the ICS rewards per consumer chain -func ConsumerRewardsAllocationKey(chainID string) []byte { - return append([]byte{mustGetKeyPrefix(ConsumerRewardsAllocationKeyName)}, []byte(chainID)...) +func ConsumerRewardsAllocationKey(consumerId string) []byte { + return append([]byte{mustGetKeyPrefix(ConsumerRewardsAllocationKeyName)}, []byte(consumerId)...) } // ConsumerCommissionRateKeyPrefix returns the key prefix for storing the commission rate per validator per consumer chain. @@ -708,16 +709,16 @@ func ConsumerCommissionRateKeyPrefix() byte { } // ConsumerCommissionRateKey returns the key used to store the commission rate per validator per consumer chain. -func ConsumerCommissionRateKey(chainID string, providerAddr ProviderConsAddress) []byte { - return ChainIdAndConsAddrKey( +func ConsumerCommissionRateKey(consumerId string, providerAddr ProviderConsAddress) []byte { + return ConsumerIdAndConsAddrKey( ConsumerCommissionRateKeyPrefix(), - chainID, + consumerId, providerAddr.ToSdkConsAddr(), ) } -func MinimumPowerInTopNKey(chainID string) []byte { - return ChainIdWithLenKey(mustGetKeyPrefix(MinimumPowerInTopNKeyName), chainID) +func MinimumPowerInTopNKey(consumerId string) []byte { + return ConsumerIdWithLenKey(mustGetKeyPrefix(MinimumPowerInTopNKeyName), consumerId) } // ConsumerAddrsToPruneV2KeyPrefix returns the key prefix for storing the consumer validators @@ -730,8 +731,8 @@ func ConsumerAddrsToPruneV2KeyPrefix() byte { // ConsumerAddrsToPruneV2Key returns the key for storing the consumer validators // addresses that need to be pruned. -func ConsumerAddrsToPruneV2Key(chainID string, pruneTs time.Time) []byte { - return ChainIdAndTsKey(ConsumerAddrsToPruneV2KeyPrefix(), chainID, pruneTs) +func ConsumerAddrsToPruneV2Key(consumerId string, pruneTs time.Time) []byte { + return ConsumerIdAndTsKey(ConsumerAddrsToPruneV2KeyPrefix(), consumerId, pruneTs) } // LastProviderConsensusValsPrefix returns the key prefix for storing the last validator set sent to the consensus engine of the provider chain @@ -739,13 +740,125 @@ func LastProviderConsensusValsPrefix() []byte { return []byte{mustGetKeyPrefix(LastProviderConsensusValsKeyName)} } -// MinStakeKey returns the key used to store the minimum stake required to validate on consumer chain `chainID` -func MinStakeKey(chainID string) []byte { - return ChainIdWithLenKey(mustGetKeyPrefix(MinStakeKeyName), chainID) +// ConsumerIdKey returns the key used to store the consumerId of the next registered chain +func ConsumerIdKey() []byte { + return []byte{mustGetKeyPrefix(ConsumerIdKeyName)} +} + +// ConsumerIdToChainIdKey returns the key used to store the chain id of this consumer id +func ConsumerIdToChainIdKey(consumerId string) []byte { + return ConsumerIdWithLenKey(mustGetKeyPrefix(ConsumerIdToChainIdKeyName), consumerId) +} + +// ConsumerIdToOwnerAddressKey returns the owner address of this consumer id +func ConsumerIdToOwnerAddressKey(consumerId string) []byte { + return ConsumerIdWithLenKey(mustGetKeyPrefix(ConsumerIdToOwnerAddressKeyName), consumerId) +} + +// ConsumerIdToMetadataKeyPrefix returns the key prefix for storing consumer metadata +func ConsumerIdToMetadataKeyPrefix() byte { + return mustGetKeyPrefix(ConsumerIdToConsumerMetadataKeyName) +} + +// ConsumerIdToMetadataKey returns the key used to store the metadata that corresponds to this consumer id +func ConsumerIdToMetadataKey(consumerId string) []byte { + return ConsumerIdWithLenKey(ConsumerIdToMetadataKeyPrefix(), consumerId) +} + +// ConsumerIdToInitializationParametersKeyPrefix returns the key prefix for storing consumer initialization records +func ConsumerIdToInitializationParametersKeyPrefix() byte { + return mustGetKeyPrefix(ConsumerIdToInitializationParametersKeyName) +} + +// ConsumerIdToInitializationParametersKey returns the key used to store the initialization record that corresponds to this consumer id +func ConsumerIdToInitializationParametersKey(consumerId string) []byte { + return ConsumerIdWithLenKey(ConsumerIdToInitializationParametersKeyPrefix(), consumerId) +} + +// ConsumerIdToPowerShapingParametersKey returns the key used to store the update record that corresponds to this consumer id +func ConsumerIdToPowerShapingParametersKey(consumerId string) []byte { + return ConsumerIdWithLenKey(mustGetKeyPrefix(ConsumerIdToPowerShapingParameters), consumerId) +} + +// ConsumerIdToPhaseKey returns the key used to store the phase that corresponds to this consumer id +func ConsumerIdToPhaseKey(consumerId string) []byte { + return ConsumerIdWithLenKey(mustGetKeyPrefix(ConsumerIdToPhaseKeyName), consumerId) +} + +// ConsumerIdToStopTimeKey returns the key used to store the stop time that corresponds to a to-be-stopped chain with consumer id +func ConsumerIdToStopTimeKey(consumerId string) []byte { + return ConsumerIdWithLenKey(mustGetKeyPrefix(ConsumerIdToStopTimeKeyName), consumerId) +} + +// ConsumerIdToStopTimeKeyPrefix returns the key prefix for storing the stop times of consumer chains +// that are about to be stopped +func ConsumerIdToStopTimeKeyPrefix() byte { + return mustGetKeyPrefix(ConsumerIdToStopTimeKeyName) +} + +// SpawnTimeToConsumerIdsKeyPrefix returns the key prefix for storing pending chains that are to be launched +func SpawnTimeToConsumerIdsKeyPrefix() byte { + return mustGetKeyPrefix(SpawnTimeToConsumerIdsKeyName) +} + +// SpawnTimeToConsumerIdsKey returns the key prefix for storing the spawn times of consumer chains +// that are about to be launched +func SpawnTimeToConsumerIdsKey(spawnTime time.Time) []byte { + return ccvtypes.AppendMany( + // append the prefix + []byte{SpawnTimeToConsumerIdsKeyPrefix()}, + // append the time + sdk.FormatTimeBytes(spawnTime), + ) +} + +// StopTimeToConsumerIdsKeyPrefix returns the key prefix for storing pending chains that are to be stopped +func StopTimeToConsumerIdsKeyPrefix() byte { + return mustGetKeyPrefix(StopTimeToConsumerIdsKeyName) } -func AllowInactiveValidatorsKey(chainID string) []byte { - return ChainIdWithLenKey(mustGetKeyPrefix(AllowInactiveValidatorsKeyName), chainID) +// StopTimeToConsumerIdsKey returns the key prefix for storing the stop times of consumer chains +// that are about to be stopped +func StopTimeToConsumerIdsKey(spawnTime time.Time) []byte { + return ccvtypes.AppendMany( + // append the prefix + []byte{StopTimeToConsumerIdsKeyPrefix()}, + // append the time + sdk.FormatTimeBytes(spawnTime), + ) +} + +// ParseTime returns the marshalled time +func ParseTime(prefix byte, bz []byte) (time.Time, error) { + expectedPrefix := []byte{prefix} + prefixL := len(expectedPrefix) + if prefix := bz[:prefixL]; !bytes.Equal(prefix, expectedPrefix) { + return time.Time{}, fmt.Errorf("invalid prefix; expected: %X, got: %X", expectedPrefix, prefix) + } + timestamp, err := sdk.ParseTimeBytes(bz[prefixL:]) + if err != nil { + return time.Time{}, err + } + return timestamp, nil +} + +// ProviderConsAddrToOptedInConsumerIdsKey returns the key for storing all the consumer ids that `providerAddr` +// has opted-in to +func ProviderConsAddrToOptedInConsumerIdsKey(providerAddr ProviderConsAddress) []byte { + return append([]byte{mustGetKeyPrefix(ProviderConsAddrToOptedInConsumerIdsKeyName)}, providerAddr.ToSdkConsAddr().Bytes()...) +} + +// ClientIdToConsumerIdKey returns the consumer id that corresponds to this client id +func ClientIdToConsumerIdKey(clientId string) []byte { + clientIdLength := len(clientId) + return ccvtypes.AppendMany( + // Append the prefix + []byte{mustGetKeyPrefix(ClientIdToConsumerIdKeyName)}, + // Append the client id length + sdk.Uint64ToBigEndian(uint64(clientIdLength)), + // Append the client id + []byte(clientId), + ) } // NOTE: DO NOT ADD FULLY DEFINED KEY FUNCTIONS WITHOUT ADDING THEM TO getAllFullyDefinedKeys() IN keys_test.go @@ -758,10 +871,10 @@ func AllowInactiveValidatorsKey(chainID string) []byte { // Generic helpers section // -// ChainIdAndTsKey returns the key with the following format: -// bytePrefix | len(chainID) | chainID | timestamp -func ChainIdAndTsKey(prefix byte, chainID string, timestamp time.Time) []byte { - partialKey := ChainIdWithLenKey(prefix, chainID) +// ConsumerIdAndTsKey returns the key with the following format: +// bytePrefix | len(consumerId) | consumerId | timestamp +func ConsumerIdAndTsKey(prefix byte, consumerId string, timestamp time.Time) []byte { + partialKey := ConsumerIdWithLenKey(prefix, consumerId) timeBz := sdk.FormatTimeBytes(timestamp) return ccvtypes.AppendMany( // Append the partialKey @@ -771,40 +884,51 @@ func ChainIdAndTsKey(prefix byte, chainID string, timestamp time.Time) []byte { ) } -// ChainIdWithLenKey returns the key with the following format: -// bytePrefix | len(chainID) | chainID -func ChainIdWithLenKey(prefix byte, chainID string) []byte { - chainIdL := len(chainID) +// ParseConsumerIdAndTsKey returns the consumer id and time for a ConsumerIdIdAndTs key +func ParseConsumerIdAndTsKey(prefix byte, bz []byte) (string, time.Time, error) { + expectedPrefix := []byte{prefix} + prefixL := len(expectedPrefix) + if prefix := bz[:prefixL]; !bytes.Equal(prefix, expectedPrefix) { + return "", time.Time{}, fmt.Errorf("invalid prefix; expected: %X, got: %X", expectedPrefix, prefix) + } + consumerIdL := sdk.BigEndianToUint64(bz[prefixL : prefixL+8]) + consumerId := string(bz[prefixL+8 : prefixL+8+int(consumerIdL)]) + timestamp, err := sdk.ParseTimeBytes(bz[prefixL+8+int(consumerIdL):]) + if err != nil { + return "", time.Time{}, err + } + return consumerId, timestamp, nil +} + +// ConsumerIdWithLenKey returns the key with the following format: +// bytePrefix | len(consumerId) | consumerId +func ConsumerIdWithLenKey(prefix byte, consumerId string) []byte { return ccvtypes.AppendMany( // Append the prefix []byte{prefix}, - // Append the chainID length - sdk.Uint64ToBigEndian(uint64(chainIdL)), - // Append the chainID - []byte(chainID), + // Append the consumer id length + sdk.Uint64ToBigEndian(uint64(len(consumerId))), + // Append the consumer id + []byte(consumerId), ) } -// ParseChainIdAndTsKey returns the chain ID and time for a ChainIdAndTs key -func ParseChainIdAndTsKey(prefix byte, bz []byte) (string, time.Time, error) { +// ParseConsumerIdWithLenKey returns the consumer id ConsumerIdWithLen key +func ParseConsumerIdWithLenKey(prefix byte, bz []byte) (string, error) { expectedPrefix := []byte{prefix} prefixL := len(expectedPrefix) if prefix := bz[:prefixL]; !bytes.Equal(prefix, expectedPrefix) { - return "", time.Time{}, fmt.Errorf("invalid prefix; expected: %X, got: %X", expectedPrefix, prefix) - } - chainIdL := sdk.BigEndianToUint64(bz[prefixL : prefixL+8]) - chainID := string(bz[prefixL+8 : prefixL+8+int(chainIdL)]) - timestamp, err := sdk.ParseTimeBytes(bz[prefixL+8+int(chainIdL):]) - if err != nil { - return "", time.Time{}, err + return "", fmt.Errorf("invalid prefix; expected: %X, got: %X", expectedPrefix, prefix) } - return chainID, timestamp, nil + consumerIdL := sdk.BigEndianToUint64(bz[prefixL : prefixL+8]) + consumerId := string(bz[prefixL+8 : prefixL+8+int(consumerIdL)]) + return consumerId, nil } // ChainIdAndUintIdKey returns the key with the following format: // bytePrefix | len(chainID) | chainID | uint64(ID) func ChainIdAndUintIdKey(prefix byte, chainID string, uintId uint64) []byte { - partialKey := ChainIdWithLenKey(prefix, chainID) + partialKey := ConsumerIdWithLenKey(prefix, chainID) return ccvtypes.AppendMany( // Append the partialKey partialKey, @@ -826,10 +950,10 @@ func ParseChainIdAndUintIdKey(prefix byte, bz []byte) (string, uint64, error) { return chainID, uintID, nil } -// ChainIdAndConsAddrKey returns the key with the following format: -// bytePrefix | len(chainID) | chainID | ConsAddress -func ChainIdAndConsAddrKey(prefix byte, chainID string, addr sdk.ConsAddress) []byte { - partialKey := ChainIdWithLenKey(prefix, chainID) +// ConsumerIdAndConsAddrKey returns the key with the following format: +// bytePrefix | len(consumerId) | consumerId | ConsAddress +func ConsumerIdAndConsAddrKey(prefix byte, consumerId string, addr sdk.ConsAddress) []byte { + partialKey := ConsumerIdWithLenKey(prefix, consumerId) return ccvtypes.AppendMany( // Append the partialKey partialKey, @@ -838,7 +962,7 @@ func ChainIdAndConsAddrKey(prefix byte, chainID string, addr sdk.ConsAddress) [] ) } -// ParseChainIdAndConsAddrKey returns the chain ID and ConsAddress for a ChainIdAndConsAddrKey key +// ParseChainIdAndConsAddrKey returns the chain ID and ConsAddress for a ConsumerIdAndConsAddrKey key func ParseChainIdAndConsAddrKey(prefix byte, bz []byte) (string, sdk.ConsAddress, error) { expectedPrefix := []byte{prefix} prefixL := len(expectedPrefix) diff --git a/x/ccv/provider/types/keys_test.go b/x/ccv/provider/types/keys_test.go index 800b6ee669..f3ecb4da6c 100644 --- a/x/ccv/provider/types/keys_test.go +++ b/x/ccv/provider/types/keys_test.go @@ -41,11 +41,11 @@ func TestPreserveBytePrefix(t *testing.T) { i++ require.Equal(t, byte(4), providertypes.SlashMeterReplenishTimeCandidateKey()[0]) i++ - require.Equal(t, byte(5), providertypes.ChainToChannelKey("chainID")[0]) + require.Equal(t, byte(5), providertypes.ConsumerIdToChannelIdKey("chainID")[0]) i++ - require.Equal(t, byte(6), providertypes.ChannelToChainKeyPrefix()[0]) + require.Equal(t, byte(6), providertypes.ChannelIdToConsumerIdKeyPrefix()[0]) i++ - require.Equal(t, byte(7), providertypes.ChainToClientKeyPrefix()[0]) + require.Equal(t, byte(7), providertypes.ConsumerIdToClientIdKeyPrefix()[0]) i++ // reserve 8 as deprecated i++ @@ -73,7 +73,8 @@ func TestPreserveBytePrefix(t *testing.T) { i++ require.Equal(t, byte(20), providertypes.ThrottledPacketDataKeyPrefix()) i++ - require.Equal(t, byte(21), providertypes.GlobalSlashEntryKeyPrefix()[0]) + // DEPRECATED + // require.Equal(t, uint8(21), providertypes.GlobalSlashEntryKeyPrefix()[0]) i++ require.Equal(t, byte(22), providertypes.ConsumerValidatorsKeyPrefix()) i++ @@ -97,11 +98,14 @@ func TestPreserveBytePrefix(t *testing.T) { i++ require.Equal(t, byte(32), providertypes.OptedInKeyPrefix()) i++ - require.Equal(t, byte(33), providertypes.TopNKey("chainID")[0]) + // DEPRECATED + //require.Equal(t, byte(33), providertypes.TopNKey("chainID")[0]) i++ - require.Equal(t, byte(34), providertypes.ValidatorsPowerCapKey("chainID")[0]) + // DEPRECATED + //require.Equal(t, byte(34), providertypes.ValidatorsPowerCapKey("chainID")[0]) i++ - require.Equal(t, byte(35), providertypes.ValidatorSetCapKey("chainID")[0]) + // DEPRECATED + //require.Equal(t, byte(35), providertypes.ValidatorSetCapKey("chainID")[0]) i++ require.Equal(t, byte(36), providertypes.AllowlistKeyPrefix()) i++ @@ -117,9 +121,29 @@ func TestPreserveBytePrefix(t *testing.T) { i++ require.Equal(t, byte(42), providertypes.LastProviderConsensusValsPrefix()[0]) i++ - require.Equal(t, byte(43), providertypes.MinStakeKey("chainID")[0]) + require.Equal(t, byte(43), providertypes.ConsumerIdKey()[0]) i++ - require.Equal(t, byte(44), providertypes.AllowInactiveValidatorsKey("chainID")[0]) + require.Equal(t, byte(44), providertypes.ConsumerIdToChainIdKey("consumerId")[0]) + i++ + require.Equal(t, byte(45), providertypes.ConsumerIdToOwnerAddressKey("consumerId")[0]) + i++ + require.Equal(t, byte(46), providertypes.ConsumerIdToMetadataKeyPrefix()) + i++ + require.Equal(t, byte(47), providertypes.ConsumerIdToInitializationParametersKeyPrefix()) + i++ + require.Equal(t, byte(48), providertypes.ConsumerIdToPowerShapingParametersKey("consumerId")[0]) + i++ + require.Equal(t, byte(49), providertypes.ConsumerIdToPhaseKey("consumerId")[0]) + i++ + require.Equal(t, byte(50), providertypes.ConsumerIdToStopTimeKeyPrefix()) + i++ + require.Equal(t, byte(51), providertypes.SpawnTimeToConsumerIdsKeyPrefix()) + i++ + require.Equal(t, byte(52), providertypes.StopTimeToConsumerIdsKeyPrefix()) + i++ + require.Equal(t, byte(53), providertypes.ProviderConsAddrToOptedInConsumerIdsKey(providertypes.NewProviderConsAddress([]byte{0x05}))[0]) + i++ + require.Equal(t, byte(54), providertypes.ClientIdToConsumerIdKey("clientId")[0]) i++ prefixes := providertypes.GetAllKeyPrefixes() @@ -156,9 +180,9 @@ func getAllFullyDefinedKeys() [][]byte { providertypes.ValidatorSetUpdateIdKey(), providertypes.SlashMeterKey(), providertypes.SlashMeterReplenishTimeCandidateKey(), - providertypes.ChainToChannelKey("chainID"), - providertypes.ChannelToChainKey("channelID"), - providertypes.ChainToClientKey("chainID"), + providertypes.ConsumerIdToChannelIdKey("chainID"), + providertypes.ChannelToConsumerIdKey("channelID"), + providertypes.ConsumerIdToClientIdKey("chainID"), providertypes.PendingCAPKey(time.Time{}, "chainID"), providertypes.PendingCRPKey(time.Time{}, "chainID"), providertypes.ValsetUpdateBlockHeightKey(7), @@ -168,7 +192,6 @@ func getAllFullyDefinedKeys() [][]byte { providertypes.PendingVSCsKey("chainID"), providertypes.ThrottledPacketDataSizeKey("chainID"), providertypes.ThrottledPacketDataKey("chainID", 88), - providertypes.GlobalSlashEntryKey(providertypes.GlobalSlashEntry{}), providertypes.ConsumerValidatorsKey("chainID", providertypes.NewProviderConsAddress([]byte{0x05})), providertypes.ValidatorsByConsumerAddrKey("chainID", providertypes.NewConsumerConsAddress([]byte{0x05})), providertypes.SlashLogKey(providertypes.NewProviderConsAddress([]byte{0x05})), @@ -176,9 +199,6 @@ func getAllFullyDefinedKeys() [][]byte { providertypes.EquivocationEvidenceMinHeightKey("chainID"), providertypes.ProposedConsumerChainKey(1), providertypes.ConsumerValidatorKey("chainID", providertypes.NewProviderConsAddress([]byte{0x05}).Address.Bytes()), - providertypes.TopNKey("chainID"), - providertypes.ValidatorsPowerCapKey("chainID"), - providertypes.ValidatorSetCapKey("chainID"), providertypes.AllowlistKey("chainID", providertypes.NewProviderConsAddress([]byte{0x05})), providertypes.DenylistKey("chainID", providertypes.NewProviderConsAddress([]byte{0x05})), providertypes.OptedInKey("chainID", providertypes.NewProviderConsAddress([]byte{0x05})), @@ -186,9 +206,19 @@ func getAllFullyDefinedKeys() [][]byte { providertypes.ConsumerCommissionRateKey("chainID", providertypes.NewProviderConsAddress([]byte{0x05})), providertypes.MinimumPowerInTopNKey("chainID"), providertypes.ConsumerAddrsToPruneV2Key("chainID", time.Time{}), - providertypes.MinStakeKey("chainID"), - providertypes.AllowInactiveValidatorsKey("chainID"), providerkeeper.GetValidatorKey(types.LastProviderConsensusValsPrefix(), providertypes.NewProviderConsAddress([]byte{0x05})), + providertypes.ConsumerIdKey(), + providertypes.ConsumerIdToChainIdKey("consumerId"), + providertypes.ConsumerIdToOwnerAddressKey("consumerId"), + providertypes.ConsumerIdToMetadataKey("consumerId"), + providertypes.ConsumerIdToInitializationParametersKey("consumerId"), + providertypes.ConsumerIdToPowerShapingParametersKey("consumerId"), + providertypes.ConsumerIdToPhaseKey("consumerId"), + providertypes.ConsumerIdToStopTimeKey("consumerId"), + providertypes.SpawnTimeToConsumerIdsKey(time.Time{}), + providertypes.StopTimeToConsumerIdsKey(time.Time{}), + providertypes.ProviderConsAddrToOptedInConsumerIdsKey(providertypes.NewProviderConsAddress([]byte{0x05})), + providertypes.ClientIdToConsumerIdKey("clientId"), } } @@ -206,12 +236,12 @@ func TestChainIdAndTsKeyAndParse(t *testing.T) { } for _, test := range tests { - key := providertypes.ChainIdAndTsKey(test.prefix, test.chainID, test.timestamp) + key := providertypes.ConsumerIdAndTsKey(test.prefix, test.chainID, test.timestamp) require.NotEmpty(t, key) // Expected bytes = prefix + chainID length + chainID + time bytes expectedLen := 1 + 8 + len(test.chainID) + len(sdk.FormatTimeBytes(time.Time{})) require.Equal(t, expectedLen, len(key)) - parsedID, parsedTime, err := providertypes.ParseChainIdAndTsKey(test.prefix, key) + parsedID, parsedTime, err := providertypes.ParseConsumerIdAndTsKey(test.prefix, key) require.Equal(t, test.chainID, parsedID) require.Equal(t, test.timestamp.UTC(), parsedTime.UTC()) require.NoError(t, err) @@ -270,33 +300,6 @@ func TestThrottledPacketDataKeyAndParse(t *testing.T) { require.NotEqual(t, key1, key2) } -// Tests the construction and parsing of keys for global slash entries -func TestGlobalSlashEntryKeyAndParse(t *testing.T) { - now := time.Now() - - providerConsAddrs := []providertypes.ProviderConsAddress{ - cryptoutil.NewCryptoIdentityFromIntSeed(0).ProviderConsAddress(), - cryptoutil.NewCryptoIdentityFromIntSeed(1).ProviderConsAddress(), - cryptoutil.NewCryptoIdentityFromIntSeed(2).ProviderConsAddress(), - } - - entries := []providertypes.GlobalSlashEntry{} - entries = append(entries, providertypes.NewGlobalSlashEntry(now, "chain-0", 2, providerConsAddrs[0])) - entries = append(entries, providertypes.NewGlobalSlashEntry(now.Add(2*time.Hour), "chain-7896978", 3, providerConsAddrs[1])) - entries = append(entries, providertypes.NewGlobalSlashEntry(now.Add(3*time.Hour), "chain-1", 4723894, providerConsAddrs[2])) - - for _, entry := range entries { - key := providertypes.GlobalSlashEntryKey(entry) - require.NotEmpty(t, key) - // This key should be of set length: prefix + 8 + 8 + chainID - require.Equal(t, 1+8+8+len(entry.ConsumerChainID), len(key)) - parsedRecvTime, parsedChainID, parsedIBCSeqNum := providertypes.MustParseGlobalSlashEntryKey(key) - require.Equal(t, entry.RecvTime, parsedRecvTime) - require.Equal(t, entry.ConsumerChainID, parsedChainID) - require.Equal(t, entry.IbcSeqNum, parsedIBCSeqNum) - } -} - // Tests the construction and parsing of ChainIdAndConsAddr keys func TestChainIdAndConsAddrAndParse(t *testing.T) { cIds := []*cryptoutil.CryptoIdentity{ @@ -319,7 +322,7 @@ func TestChainIdAndConsAddrAndParse(t *testing.T) { } for _, test := range tests { - key := providertypes.ChainIdAndConsAddrKey(test.prefix, test.chainID, test.addr) + key := providertypes.ConsumerIdAndConsAddrKey(test.prefix, test.chainID, test.addr) require.NotEmpty(t, key) // Expected bytes = prefix + chainID length + chainID + consAddr bytes expectedLen := 1 + 8 + len(test.chainID) + len(test.addr) @@ -334,9 +337,9 @@ func TestChainIdAndConsAddrAndParse(t *testing.T) { // Test key packing functions with the format func TestKeysWithPrefixAndId(t *testing.T) { funcs := []func(string) []byte{ - providertypes.ChainToChannelKey, - providertypes.ChannelToChainKey, - providertypes.ChainToClientKey, + providertypes.ConsumerIdToChannelIdKey, + providertypes.ChannelToConsumerIdKey, + providertypes.ConsumerIdToClientIdKey, providertypes.ConsumerGenesisKey, providertypes.SlashAcksKey, providertypes.InitChainHeightKey, diff --git a/x/ccv/provider/types/legacy_proposal.go b/x/ccv/provider/types/legacy_proposal.go index 3124cc3d87..f29f3b6c07 100644 --- a/x/ccv/provider/types/legacy_proposal.go +++ b/x/ccv/provider/types/legacy_proposal.go @@ -20,8 +20,8 @@ import ( const ( ProposalTypeConsumerAddition = "ConsumerAddition" - ProposalTypeConsumerRemoval = "ConsumerRemoval" - ProposalTypeConsumerModification = "ConsumerModification" + ProposalTypeConsumerRemoval = "RemoveConsumer" + ProposalTypeConsumerModification = "UpdateConsumer" ProposalTypeEquivocation = "Equivocation" ProposalTypeChangeRewardDenoms = "ChangeRewardDenoms" ) @@ -29,7 +29,6 @@ const ( var ( _ govv1beta1.Content = &ConsumerAdditionProposal{} _ govv1beta1.Content = &ConsumerRemovalProposal{} - _ govv1beta1.Content = &ConsumerModificationProposal{} _ govv1beta1.Content = &ChangeRewardDenomsProposal{} _ govv1beta1.Content = &EquivocationProposal{} ) @@ -240,55 +239,6 @@ func (sccp *ConsumerRemovalProposal) ValidateBasic() error { return nil } -// NewConsumerModificationProposal creates a new consumer modification proposal. -func NewConsumerModificationProposal(title, description, chainID string, - topN uint32, - validatorsPowerCap uint32, - validatorSetCap uint32, - allowlist []string, - denylist []string, - minStake uint64, - allowInactiveVals bool, -) govv1beta1.Content { - return &ConsumerModificationProposal{ - Title: title, - Description: description, - ChainId: chainID, - Top_N: topN, - ValidatorsPowerCap: validatorsPowerCap, - ValidatorSetCap: validatorSetCap, - Allowlist: allowlist, - Denylist: denylist, - MinStake: minStake, - AllowInactiveVals: allowInactiveVals, - } -} - -// ProposalRoute returns the routing key of a consumer modification proposal. -func (cccp *ConsumerModificationProposal) ProposalRoute() string { return RouterKey } - -// ProposalType returns the type of the consumer modification proposal. -func (cccp *ConsumerModificationProposal) ProposalType() string { - return ProposalTypeConsumerModification -} - -// ValidateBasic runs basic stateless validity checks -func (cccp *ConsumerModificationProposal) ValidateBasic() error { - if err := govv1beta1.ValidateAbstract(cccp); err != nil { - return err - } - - if strings.TrimSpace(cccp.ChainId) == "" { - return errorsmod.Wrap(ErrInvalidConsumerModificationProposal, "consumer chain id must not be blank") - } - - err := ValidatePSSFeatures(cccp.Top_N, cccp.ValidatorsPowerCap) - if err != nil { - return errorsmod.Wrapf(ErrInvalidConsumerModificationProposal, "invalid PSS features: %s", err.Error()) - } - return nil -} - // NewEquivocationProposal creates a new equivocation proposal. // [DEPRECATED]: do not use because equivocations can be submitted // and verified automatically on the provider. diff --git a/x/ccv/provider/types/legacy_proposal_test.go b/x/ccv/provider/types/legacy_proposal_test.go index 02fdb5245e..180a4978bd 100644 --- a/x/ccv/provider/types/legacy_proposal_test.go +++ b/x/ccv/provider/types/legacy_proposal_test.go @@ -542,82 +542,68 @@ func TestChangeRewardDenomsProposalValidateBasic(t *testing.T) { } } -func TestConsumerModificationProposalValidateBasic(t *testing.T) { +func TestMsgUpdateConsumerValidateBasic(t *testing.T) { testCases := []struct { - name string - proposal govv1beta1.Content - expPass bool + name string + powerShapingParameters types.PowerShapingParameters + expPass bool }{ { "success", - types.NewConsumerModificationProposal("title", "description", "chainID", - 50, - 100, - 34, - []string{"addr1"}, - nil, - 0, - false, - ), + types.PowerShapingParameters{ + Top_N: 50, + ValidatorsPowerCap: 100, + ValidatorSetCap: 34, + Allowlist: []string{"addr1"}, + Denylist: nil, + MinStake: 0, + AllowInactiveVals: false, + }, true, }, - { - "invalid chain id", - types.NewConsumerModificationProposal("title", "description", " ", - 0, - 0, - 0, - nil, - nil, - 0, - false, - ), - false, - }, { "top N is invalid", - types.NewConsumerModificationProposal("title", "description", "chainID", - 10, - 0, - 0, - nil, - nil, - 0, - false, - ), + types.PowerShapingParameters{ + Top_N: 10, + ValidatorsPowerCap: 0, + ValidatorSetCap: 0, + Allowlist: nil, + Denylist: nil, + }, false, }, { "validators power cap is invalid", - types.NewConsumerModificationProposal("title", "description", "chainID", - 50, - 101, - 0, - nil, - nil, - 0, - false, - ), + types.PowerShapingParameters{ + Top_N: 50, + ValidatorsPowerCap: 101, + ValidatorSetCap: 0, + Allowlist: nil, + Denylist: nil, + MinStake: 0, + AllowInactiveVals: false, + }, false, }, { "valid proposal", - types.NewConsumerModificationProposal("title", "description", "chainID", - 0, - 34, - 101, - []string{"addr1"}, - []string{"addr2", "addr3"}, - 0, - false, - ), + types.PowerShapingParameters{ + Top_N: 54, + ValidatorsPowerCap: 92, + ValidatorSetCap: 0, + Allowlist: []string{"addr1"}, + Denylist: []string{"addr2", "addr3"}, + MinStake: 0, + AllowInactiveVals: false, + }, true, }, } for _, tc := range testCases { - - err := tc.proposal.ValidateBasic() + // TODO (PERMISSIONLESS) add more tests + msg, _ := types.NewMsgUpdateConsumer("", "0", "cosmos1p3ucd3ptpw902fluyjzhq3ffgq4ntddac9sa3s", nil, nil, &tc.powerShapingParameters) + err := msg.ValidateBasic() if tc.expPass { require.NoError(t, err, "valid case: %s should not return error. got %w", tc.name, err) } else { diff --git a/x/ccv/provider/types/msg.go b/x/ccv/provider/types/msg.go index c47c62e0a0..21b9173eca 100644 --- a/x/ccv/provider/types/msg.go +++ b/x/ccv/provider/types/msg.go @@ -3,7 +3,10 @@ package types import ( "encoding/json" "fmt" + cmttypes "github.com/cometbft/cometbft/types" + "strconv" "strings" + "time" ibctmtypes "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" @@ -23,6 +26,9 @@ const ( TypeMsgAssignConsumerKey = "assign_consumer_key" TypeMsgSubmitConsumerMisbehaviour = "submit_consumer_misbehaviour" TypeMsgSubmitConsumerDoubleVoting = "submit_consumer_double_vote" + TypeMsgCreateConsumer = "create_consumer" + TypeMsgUpdateConsumer = "update_consumer" + TypeMsgRemoveConsumer = "remove_consumer" TypeMsgOptIn = "opt_in" TypeMsgOptOut = "opt_out" TypeMsgSetConsumerCommissionRate = "set_consumer_commission_rate" @@ -30,23 +36,23 @@ const ( var ( _ sdk.Msg = (*MsgAssignConsumerKey)(nil) - _ sdk.Msg = (*MsgConsumerAddition)(nil) - _ sdk.Msg = (*MsgConsumerRemoval)(nil) - _ sdk.Msg = (*MsgConsumerModification)(nil) _ sdk.Msg = (*MsgChangeRewardDenoms)(nil) _ sdk.Msg = (*MsgSubmitConsumerMisbehaviour)(nil) _ sdk.Msg = (*MsgSubmitConsumerDoubleVoting)(nil) + _ sdk.Msg = (*MsgCreateConsumer)(nil) + _ sdk.Msg = (*MsgUpdateConsumer)(nil) + _ sdk.Msg = (*MsgRemoveConsumer)(nil) _ sdk.Msg = (*MsgOptIn)(nil) _ sdk.Msg = (*MsgOptOut)(nil) _ sdk.Msg = (*MsgSetConsumerCommissionRate)(nil) _ sdk.HasValidateBasic = (*MsgAssignConsumerKey)(nil) - _ sdk.HasValidateBasic = (*MsgConsumerAddition)(nil) - _ sdk.HasValidateBasic = (*MsgConsumerRemoval)(nil) - _ sdk.HasValidateBasic = (*MsgConsumerModification)(nil) _ sdk.HasValidateBasic = (*MsgChangeRewardDenoms)(nil) _ sdk.HasValidateBasic = (*MsgSubmitConsumerMisbehaviour)(nil) _ sdk.HasValidateBasic = (*MsgSubmitConsumerDoubleVoting)(nil) + _ sdk.HasValidateBasic = (*MsgCreateConsumer)(nil) + _ sdk.HasValidateBasic = (*MsgUpdateConsumer)(nil) + _ sdk.HasValidateBasic = (*MsgRemoveConsumer)(nil) _ sdk.HasValidateBasic = (*MsgOptIn)(nil) _ sdk.HasValidateBasic = (*MsgOptOut)(nil) _ sdk.HasValidateBasic = (*MsgSetConsumerCommissionRate)(nil) @@ -54,11 +60,11 @@ var ( // NewMsgAssignConsumerKey creates a new MsgAssignConsumerKey instance. // Delegator address and validator address are the same. -func NewMsgAssignConsumerKey(chainID string, providerValidatorAddress sdk.ValAddress, +func NewMsgAssignConsumerKey(consumerId string, providerValidatorAddress sdk.ValAddress, consumerConsensusPubKey, signer string, ) (*MsgAssignConsumerKey, error) { return &MsgAssignConsumerKey{ - ChainId: chainID, + ConsumerId: consumerId, ProviderAddr: providerValidatorAddress.String(), ConsumerKey: consumerConsensusPubKey, Signer: signer, @@ -94,14 +100,8 @@ func (msg MsgAssignConsumerKey) GetSignBytes() []byte { // ValidateBasic implements the sdk.Msg interface. func (msg MsgAssignConsumerKey) ValidateBasic() error { - if strings.TrimSpace(msg.ChainId) == "" { - return errorsmod.Wrapf(ErrInvalidConsumerChainID, "chainId cannot be blank") - } - // It is possible to assign keys for consumer chains that are not yet approved. - // This can only be done by a signing validator, but it is still sensible - // to limit the chainID size to prevent abuse. - if 128 < len(msg.ChainId) { - return errorsmod.Wrapf(ErrInvalidConsumerChainID, "chainId cannot exceed 128 length") + if err := ValidateConsumerId(msg.ConsumerId); err != nil { + return err } _, err := sdk.ValAddressFromBech32(msg.ProviderAddr) if err != nil { @@ -148,6 +148,9 @@ func (msg MsgSubmitConsumerMisbehaviour) ValidateBasic() error { if msg.Submitter == "" { return errorsmod.Wrap(sdkerrors.ErrInvalidAddress, msg.Submitter) } + if err := ValidateConsumerId(msg.ConsumerId); err != nil { + return err + } if err := msg.Misbehaviour.ValidateBasic(); err != nil { return err @@ -208,6 +211,10 @@ func (msg MsgSubmitConsumerDoubleVoting) ValidateBasic() error { return fmt.Errorf("invalid infraction block header, validator set is nil") } + if err := ValidateConsumerId(msg.ConsumerId); err != nil { + return err + } + return nil } @@ -227,11 +234,171 @@ func (msg MsgSubmitConsumerDoubleVoting) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{addr} } +// NewMsgCreateConsumer creates a new MsgCreateConsumer instance +func NewMsgCreateConsumer(signer string, chainId string, metadata ConsumerMetadata, + initializationParameters *ConsumerInitializationParameters, powerShapingParameters *PowerShapingParameters) (*MsgCreateConsumer, error) { + return &MsgCreateConsumer{ + Signer: signer, + ChainId: chainId, + Metadata: metadata, + InitializationParameters: initializationParameters, + PowerShapingParameters: powerShapingParameters, + }, nil +} + +// Type implements the sdk.Msg interface. +func (msg MsgCreateConsumer) Type() string { + return TypeMsgCreateConsumer +} + +// Route implements the sdk.Msg interface. +func (msg MsgCreateConsumer) Route() string { return RouterKey } + +// ValidateBasic implements the sdk.Msg interface. +func (msg MsgCreateConsumer) ValidateBasic() error { + if err := ValidateField("chain id", msg.ChainId, cmttypes.MaxChainIDLen); err != nil { + return err + } + + if err := ValidateConsumerMetadata(msg.Metadata); err != nil { + return err + } + + if msg.InitializationParameters != nil { + if err := ValidateInitializationParameters(*msg.InitializationParameters); err != nil { + return err + } + } + + if msg.PowerShapingParameters != nil { + if msg.PowerShapingParameters.Top_N != 0 { + return fmt.Errorf("cannot create a Top N chain through `MsgCreateConsumer`; " + + "first create the chain and then use `MsgUpdateConsumer` to make the chain Top N") + } + if err := ValidatePowerShapingParameters(*msg.PowerShapingParameters); err != nil { + return err + } + } + + return nil +} + +// Type implements the sdk.Msg interface. +func (msg MsgCreateConsumer) GetSignBytes() []byte { + bz := ccvtypes.ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + // GetSigners implements the sdk.Msg interface. It returns the address(es) that // must sign over msg.GetSignBytes(). -// If the validator address is not same as delegator's, then the validator must -// sign the msg as well. -func (msg *MsgConsumerAddition) GetSigners() []sdk.AccAddress { +func (msg MsgCreateConsumer) GetSigners() []sdk.AccAddress { + valAddr, err := sdk.ValAddressFromBech32(msg.Signer) + if err != nil { + // same behavior as in cosmos-sdk + panic(err) + } + return []sdk.AccAddress{valAddr.Bytes()} +} + +// NewMsgUpdateConsumer creates a new MsgUpdateConsumer instance +func NewMsgUpdateConsumer(signer string, consumerId string, ownerAddress string, metadata *ConsumerMetadata, + initializationParameters *ConsumerInitializationParameters, powerShapingParameters *PowerShapingParameters) (*MsgUpdateConsumer, error) { + return &MsgUpdateConsumer{ + Signer: signer, + ConsumerId: consumerId, + NewOwnerAddress: ownerAddress, + Metadata: metadata, + InitializationParameters: initializationParameters, + PowerShapingParameters: powerShapingParameters, + }, nil +} + +// Type implements the sdk.Msg interface. +func (msg MsgUpdateConsumer) Type() string { + return TypeMsgUpdateConsumer +} + +// Route implements the sdk.Msg interface. +func (msg MsgUpdateConsumer) Route() string { return RouterKey } + +// ValidateBasic implements the sdk.Msg interface. +func (msg MsgUpdateConsumer) ValidateBasic() error { + if err := ValidateConsumerId(msg.ConsumerId); err != nil { + return err + } + + if msg.Metadata != nil { + if err := ValidateConsumerMetadata(*msg.Metadata); err != nil { + return err + } + } + + if msg.InitializationParameters != nil { + if err := ValidateInitializationParameters(*msg.InitializationParameters); err != nil { + return err + } + } + + if msg.PowerShapingParameters != nil { + if err := ValidatePowerShapingParameters(*msg.PowerShapingParameters); err != nil { + return err + } + } + + return nil +} + +// Type implements the sdk.Msg interface. +func (msg MsgUpdateConsumer) GetSignBytes() []byte { + bz := ccvtypes.ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// GetSigners implements the sdk.Msg interface. It returns the address(es) that +// must sign over msg.GetSignBytes(). +func (msg MsgUpdateConsumer) GetSigners() []sdk.AccAddress { + valAddr, err := sdk.ValAddressFromBech32(msg.Signer) + if err != nil { + // same behavior as in cosmos-sdk + panic(err) + } + return []sdk.AccAddress{valAddr.Bytes()} +} + +// NewMsgRemoveConsumer creates a new MsgRemoveConsumer instance +func NewMsgRemoveConsumer(signer string, consumerId string, stopTime time.Time) (*MsgRemoveConsumer, error) { + return &MsgRemoveConsumer{ + Authority: signer, + ConsumerId: consumerId, + StopTime: stopTime, + }, nil +} + +// Type implements the sdk.Msg interface. +func (msg MsgRemoveConsumer) Type() string { + return TypeMsgRemoveConsumer +} + +// Route implements the sdk.Msg interface. +func (msg MsgRemoveConsumer) Route() string { return RouterKey } + +// ValidateBasic implements the sdk.Msg interface. +func (msg MsgRemoveConsumer) ValidateBasic() error { + if err := ValidateConsumerId(msg.ConsumerId); err != nil { + return err + } + return nil +} + +// Type implements the sdk.Msg interface. +func (msg MsgRemoveConsumer) GetSignBytes() []byte { + bz := ccvtypes.ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// GetSigners implements the sdk.Msg interface. It returns the address(es) that +// must sign over msg.GetSignBytes(). +func (msg MsgRemoveConsumer) GetSigners() []sdk.AccAddress { valAddr, err := sdk.ValAddressFromBech32(msg.Authority) if err != nil { // same behavior as in cosmos-sdk @@ -240,8 +407,11 @@ func (msg *MsgConsumerAddition) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{valAddr.Bytes()} } +// Route implements the sdk.Msg interface. +func (msg MsgConsumerAddition) Route() string { return RouterKey } + // ValidateBasic implements the sdk.Msg interface. -func (msg *MsgConsumerAddition) ValidateBasic() error { +func (msg MsgConsumerAddition) ValidateBasic() error { if strings.TrimSpace(msg.ChainId) == "" { return ErrBlankConsumerChainID } @@ -292,19 +462,28 @@ func (msg *MsgConsumerAddition) ValidateBasic() error { return nil } -func (msg *MsgConsumerRemoval) ValidateBasic() error { - if strings.TrimSpace(msg.ChainId) == "" { - return errorsmod.Wrap(ErrInvalidConsumerRemovalProp, "consumer chain id must not be blank") - } +// Type implements the sdk.Msg interface. +func (msg MsgConsumerAddition) GetSignBytes() []byte { + bz := ccvtypes.ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} - if msg.StopTime.IsZero() { - return errorsmod.Wrap(ErrInvalidConsumerRemovalProp, "spawn time cannot be zero") +// GetSigners implements the sdk.Msg interface. It returns the address(es) that +// must sign over msg.GetSignBytes(). +func (msg MsgConsumerAddition) GetSigners() []sdk.AccAddress { + valAddr, err := sdk.ValAddressFromBech32(msg.Authority) + if err != nil { + // same behavior as in cosmos-sdk + panic(err) } - return nil + return []sdk.AccAddress{valAddr.Bytes()} } +// Route implements the sdk.Msg interface. +func (msg MsgConsumerModification) Route() string { return RouterKey } + // ValidateBasic implements the sdk.Msg interface. -func (msg *MsgConsumerModification) ValidateBasic() error { +func (msg MsgConsumerModification) ValidateBasic() error { if strings.TrimSpace(msg.ChainId) == "" { return ErrBlankConsumerChainID } @@ -317,10 +496,59 @@ func (msg *MsgConsumerModification) ValidateBasic() error { return nil } +// Type implements the sdk.Msg interface. +func (msg MsgConsumerModification) GetSignBytes() []byte { + bz := ccvtypes.ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// GetSigners implements the sdk.Msg interface. It returns the address(es) that +// must sign over msg.GetSignBytes(). +func (msg MsgConsumerModification) GetSigners() []sdk.AccAddress { + valAddr, err := sdk.ValAddressFromBech32(msg.Authority) + if err != nil { + // same behavior as in cosmos-sdk + panic(err) + } + return []sdk.AccAddress{valAddr.Bytes()} +} + +// Route implements the sdk.Msg interface. +func (msg MsgConsumerRemoval) Route() string { return RouterKey } + +// ValidateBasic implements the sdk.Msg interface. +func (msg MsgConsumerRemoval) ValidateBasic() error { + if strings.TrimSpace(msg.ChainId) == "" { + return errorsmod.Wrap(ErrInvalidConsumerRemovalProp, "consumer chain id must not be blank") + } + + if msg.StopTime.IsZero() { + return errorsmod.Wrap(ErrInvalidConsumerRemovalProp, "spawn time cannot be zero") + } + return nil +} + +// Type implements the sdk.Msg interface. +func (msg MsgConsumerRemoval) GetSignBytes() []byte { + bz := ccvtypes.ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// GetSigners implements the sdk.Msg interface. It returns the address(es) that +// must sign over msg.GetSignBytes(). +func (msg MsgConsumerRemoval) GetSigners() []sdk.AccAddress { + valAddr, err := sdk.ValAddressFromBech32(msg.Authority) + if err != nil { + // same behavior as in cosmos-sdk + panic(err) + } + return []sdk.AccAddress{valAddr.Bytes()} +} + // NewMsgOptIn creates a new NewMsgOptIn instance. -func NewMsgOptIn(chainID string, providerValidatorAddress sdk.ValAddress, consumerConsensusPubKey, signer string) (*MsgOptIn, error) { +func NewMsgOptIn(consumerId string, providerValidatorAddress sdk.ValAddress, consumerConsensusPubKey, signer string) (*MsgOptIn, error) { return &MsgOptIn{ - ChainId: chainID, + ConsumerId: consumerId, ProviderAddr: providerValidatorAddress.String(), ConsumerKey: consumerConsensusPubKey, Signer: signer, @@ -348,14 +576,8 @@ func (msg MsgOptIn) GetSigners() []sdk.AccAddress { // ValidateBasic implements the sdk.Msg interface. func (msg MsgOptIn) ValidateBasic() error { - if strings.TrimSpace(msg.ChainId) == "" { - return errorsmod.Wrapf(ErrInvalidConsumerChainID, "chainId cannot be blank") - } - // It is possible to opt in to validate on consumer chains that are not yet approved. - // This can only be done by a signing validator, but it is still sensible - // to limit the chainID size to prevent abuse. - if 128 < len(msg.ChainId) { - return errorsmod.Wrapf(ErrInvalidConsumerChainID, "chainId cannot exceed 128 length") + if err := ValidateConsumerId(msg.ConsumerId); err != nil { + return err } _, err := sdk.ValAddressFromBech32(msg.ProviderAddr) if err != nil { @@ -371,9 +593,9 @@ func (msg MsgOptIn) ValidateBasic() error { } // NewMsgOptOut creates a new NewMsgOptIn instance. -func NewMsgOptOut(chainID string, providerValidatorAddress sdk.ValAddress, signer string) (*MsgOptOut, error) { +func NewMsgOptOut(consumerId string, providerValidatorAddress sdk.ValAddress, signer string) (*MsgOptOut, error) { return &MsgOptOut{ - ChainId: chainID, + ConsumerId: consumerId, ProviderAddr: providerValidatorAddress.String(), Signer: signer, }, nil @@ -406,14 +628,8 @@ func (msg MsgOptOut) GetSignBytes() []byte { // ValidateBasic implements the sdk.Msg interface. func (msg MsgOptOut) ValidateBasic() error { - if strings.TrimSpace(msg.ChainId) == "" { - return errorsmod.Wrapf(ErrInvalidConsumerChainID, "chainId cannot be blank") - } - // It is possible to assign keys for consumer chains that are not yet approved. - // This can only be done by a signing validator, but it is still sensible - // to limit the chainID size to prevent abuse. - if 128 < len(msg.ChainId) { - return errorsmod.Wrapf(ErrInvalidConsumerChainID, "chainId cannot exceed 128 length") + if err := ValidateConsumerId(msg.ConsumerId); err != nil { + return err } _, err := sdk.ValAddressFromBech32(msg.ProviderAddr) if err != nil { @@ -423,9 +639,9 @@ func (msg MsgOptOut) ValidateBasic() error { } // NewMsgSetConsumerCommissionRate creates a new MsgSetConsumerCommissionRate msg instance. -func NewMsgSetConsumerCommissionRate(chainID string, commission math.LegacyDec, providerValidatorAddress sdk.ValAddress, signer string) *MsgSetConsumerCommissionRate { +func NewMsgSetConsumerCommissionRate(consumerId string, commission math.LegacyDec, providerValidatorAddress sdk.ValAddress, signer string) *MsgSetConsumerCommissionRate { return &MsgSetConsumerCommissionRate{ - ChainId: chainID, + ConsumerId: consumerId, Rate: commission, ProviderAddr: providerValidatorAddress.String(), Signer: signer, @@ -441,12 +657,8 @@ func (msg MsgSetConsumerCommissionRate) Type() string { } func (msg MsgSetConsumerCommissionRate) ValidateBasic() error { - if strings.TrimSpace(msg.ChainId) == "" { - return errorsmod.Wrapf(ErrInvalidConsumerChainID, "chainId cannot be blank") - } - - if 128 < len(msg.ChainId) { - return errorsmod.Wrapf(ErrInvalidConsumerChainID, "chainId cannot exceed 128 length") + if err := ValidateConsumerId(msg.ConsumerId); err != nil { + return err } _, err := sdk.ValAddressFromBech32(msg.ProviderAddr) if err != nil { @@ -507,3 +719,138 @@ func (msg MsgSetConsumerCommissionRate) GetSignBytes() []byte { bz := ccvtypes.ModuleCdc.MustMarshalJSON(&msg) return sdk.MustSortJSON(bz) } + +// ValidateConsumerId validates the provided consumer id and returns an error if it is not valid +func ValidateConsumerId(consumerId string) error { + if strings.TrimSpace(consumerId) == "" { + return errorsmod.Wrapf(ErrInvalidConsumerId, "consumer id cannot be blank") + } + + // check that `consumerId` corresponds to a `uint64` + _, err := strconv.ParseUint(consumerId, 10, 64) + if err != nil { + return errorsmod.Wrapf(ErrInvalidConsumerId, "consumer id (%s) cannot be parsed: %s", consumerId, err.Error()) + } + + return nil +} + +// ValidateField validates that `field` is not empty and has at most `maxLength` characters +func ValidateField(nameOfTheField string, field string, maxLength int) error { + if strings.TrimSpace(field) == "" { + return fmt.Errorf("%s cannot be empty", nameOfTheField) + } else if len(field) > maxLength { + return fmt.Errorf("%s is too long; got: %d, max: %d", nameOfTheField, len(field), maxLength) + } + return nil +} + +// ValidateConsumerMetadata validates that all the provided metadata are in the expected range +func ValidateConsumerMetadata(metadata ConsumerMetadata) error { + const maxNameLength = 100 + const maxDescriptionLength = 50000 + const maxMetadataLength = 1000 + + if err := ValidateField("name", metadata.Name, maxNameLength); err != nil { + return err + } + + if err := ValidateField("description", metadata.Description, maxDescriptionLength); err != nil { + return err + } + + if err := ValidateField("metadata", metadata.Metadata, maxMetadataLength); err != nil { + return err + } + + return nil +} + +// ValidatePowerShapingParameters validates that all the provided power-shaping parameters are in the expected range +func ValidatePowerShapingParameters(powerShapingParameters PowerShapingParameters) error { + const maxAllowlistLength = 500 + const maxDenylistLength = 500 + + // Top N corresponds to the top N% of validators that have to validate the consumer chain and can only be 0 (for an + // Opt In chain) or in the range [50, 100] (for a Top N chain). + if powerShapingParameters.Top_N != 0 && (powerShapingParameters.Top_N < 50 || powerShapingParameters.Top_N > 100) { + return fmt.Errorf("parameter Top N can either be 0 or in the range [50, 100]") + } + + if powerShapingParameters.ValidatorsPowerCap != 0 && powerShapingParameters.ValidatorsPowerCap > 100 { + return fmt.Errorf("validators' power cap has to be in the range [1, 100]") + } + + if len(powerShapingParameters.Allowlist) > maxAllowlistLength { + return fmt.Errorf("allowlist cannot exceed length: %d", maxAllowlistLength) + } + + if len(powerShapingParameters.Denylist) > maxDenylistLength { + return fmt.Errorf("denylist cannot exceed length: %d", maxDenylistLength) + } + + return nil +} + +// ValidateInitializationParameters validates that all the provided parameters are in the expected range +func ValidateInitializationParameters(initializationParameters ConsumerInitializationParameters) error { + const maxGenesisHashLength = 1000 + const maxBinaryHashLength = 1000 + const maxConsumerRedistributionFractionLength = 50 + const maxDistributionTransmissionChannelLength = 1000 + + if initializationParameters.InitialHeight.IsZero() { + return errorsmod.Wrap(ErrInvalidConsumerInitializationParameters, "initial height cannot be zero") + } + + if len(initializationParameters.GenesisHash) == 0 { + return errorsmod.Wrap(ErrInvalidConsumerInitializationParameters, "genesis hash cannot be empty") + } else if len(initializationParameters.GenesisHash) > maxGenesisHashLength { + return errorsmod.Wrapf(ErrInvalidConsumerInitializationParameters, "genesis hash cannot exceed %d bytes", maxGenesisHashLength) + } + + if len(initializationParameters.BinaryHash) == 0 { + return errorsmod.Wrap(ErrInvalidConsumerInitializationParameters, "binary hash cannot be empty") + } else if len(initializationParameters.BinaryHash) > maxBinaryHashLength { + return errorsmod.Wrapf(ErrInvalidConsumerInitializationParameters, "binary hash cannot exceed %d bytes", maxBinaryHashLength) + } + + if initializationParameters.SpawnTime.IsZero() { + return errorsmod.Wrap(ErrInvalidConsumerInitializationParameters, "spawn time cannot be zero") + } + + if err := ccvtypes.ValidateStringFraction(initializationParameters.ConsumerRedistributionFraction); err != nil { + return errorsmod.Wrapf(ErrInvalidConsumerInitializationParameters, "consumer redistribution fraction is invalid: %s", err.Error()) + } else if err := ValidateField("consumer redistribution fraction", initializationParameters.ConsumerRedistributionFraction, maxConsumerRedistributionFractionLength); err != nil { + return errorsmod.Wrapf(ErrInvalidConsumerInitializationParameters, "consumer redistribution fraction is invalid: %s", err.Error()) + } + + if err := ccvtypes.ValidatePositiveInt64(initializationParameters.BlocksPerDistributionTransmission); err != nil { + return errorsmod.Wrap(ErrInvalidConsumerInitializationParameters, "blocks per distribution transmission has to be positive") + } + + if err := ccvtypes.ValidateDistributionTransmissionChannel(initializationParameters.DistributionTransmissionChannel); err != nil { + return errorsmod.Wrapf(ErrInvalidConsumerInitializationParameters, "distribution transmission channel is invalid: %s", err.Error()) + } else if len(initializationParameters.DistributionTransmissionChannel) > maxDistributionTransmissionChannelLength { + // note that the distribution transmission channel can be the empty string (i.e., "") and hence we only check its max length here + return errorsmod.Wrapf(ErrInvalidConsumerInitializationParameters, "distribution transmission channel exceeds %d length", maxDistributionTransmissionChannelLength) + } + + if err := ccvtypes.ValidatePositiveInt64(initializationParameters.HistoricalEntries); err != nil { + return errorsmod.Wrap(ErrInvalidConsumerInitializationParameters, "historical entries has to be positive") + } + + if err := ccvtypes.ValidateDuration(initializationParameters.CcvTimeoutPeriod); err != nil { + return errorsmod.Wrap(ErrInvalidConsumerInitializationParameters, "ccv timeout period cannot be zero") + } + + if err := ccvtypes.ValidateDuration(initializationParameters.TransferTimeoutPeriod); err != nil { + return errorsmod.Wrap(ErrInvalidConsumerInitializationParameters, "transfer timeout period cannot be zero") + } + + if err := ccvtypes.ValidateDuration(initializationParameters.UnbondingPeriod); err != nil { + return errorsmod.Wrapf(ErrInvalidConsumerInitializationParameters, "invalid unbonding period: %s", err.Error()) + } + + return nil +} diff --git a/x/ccv/provider/types/msg_test.go b/x/ccv/provider/types/msg_test.go new file mode 100644 index 0000000000..da6d24d793 --- /dev/null +++ b/x/ccv/provider/types/msg_test.go @@ -0,0 +1,21 @@ +package types_test + +import ( + "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + "github.com/stretchr/testify/require" + "testing" +) + +func TestValidateConsumerId(t *testing.T) { + // empty consumer id + require.Error(t, types.ValidateConsumerId("")) + + // not a `uint64` where `uint64` is in the range [0, 2^64) + require.Error(t, types.ValidateConsumerId("a")) + require.Error(t, types.ValidateConsumerId("-2545")) + require.Error(t, types.ValidateConsumerId("18446744073709551616")) // 2^64 + + // valid consumer id + require.NoError(t, types.ValidateConsumerId("0")) + require.NoError(t, types.ValidateConsumerId("18446744073709551615")) // 2^64 - 1 +} diff --git a/x/ccv/provider/types/provider.pb.go b/x/ccv/provider/types/provider.pb.go index 7c30781221..a0d0fa1dd8 100644 --- a/x/ccv/provider/types/provider.pb.go +++ b/x/ccv/provider/types/provider.pb.go @@ -37,6 +37,7 @@ var _ = time.Kitchen // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// WARNING: This message is deprecated in favor of `MsgCreateConsumer`. // ConsumerAdditionProposal is a governance proposal on the provider chain to // spawn a new consumer chain. If it passes, then all validators on the provider // chain are expected to validate the consumer chain at spawn time or get @@ -151,6 +152,7 @@ func (m *ConsumerAdditionProposal) XXX_DiscardUnknown() { var xxx_messageInfo_ConsumerAdditionProposal proto.InternalMessageInfo +// WARNING: This message is deprecated in favor of `MsgRemoveConsumer`. // ConsumerRemovalProposal is a governance proposal on the provider chain to // remove (and stop) a consumer chain. If it passes, all the consumer chain's // state is removed from the provider chain. The outstanding unbonding operation @@ -229,6 +231,7 @@ func (m *ConsumerRemovalProposal) GetStopTime() time.Time { return time.Time{} } +// WARNING: This message is deprecated in favor of `MsgUpdateConsumer`. // ConsumerModificationProposal is a governance proposal on the provider chain to modify parameters of a running // consumer chain. If it passes, the consumer chain's state is updated to take into account the newest params. type ConsumerModificationProposal struct { @@ -899,6 +902,7 @@ func (m *AddressList) GetAddresses() [][]byte { return nil } +// WARNING: This message is deprecated and is not used. // ChannelToChain is used to map a CCV channel ID to the consumer chainID type ChannelToChain struct { ChannelId string `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` @@ -1372,6 +1376,381 @@ func (m *ConsumerRewardsAllocation) GetRewards() github_com_cosmos_cosmos_sdk_ty return nil } +// ConsumerMetadata contains general information about the registered chain +type ConsumerMetadata struct { + // the name of the chain + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // the description of the chain + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + // the metadata (e.g., GitHub repository URL) of the chain + Metadata string `protobuf:"bytes,3,opt,name=metadata,proto3" json:"metadata,omitempty"` +} + +func (m *ConsumerMetadata) Reset() { *m = ConsumerMetadata{} } +func (m *ConsumerMetadata) String() string { return proto.CompactTextString(m) } +func (*ConsumerMetadata) ProtoMessage() {} +func (*ConsumerMetadata) Descriptor() ([]byte, []int) { + return fileDescriptor_f22ec409a72b7b72, []int{19} +} +func (m *ConsumerMetadata) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ConsumerMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ConsumerMetadata.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ConsumerMetadata) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConsumerMetadata.Merge(m, src) +} +func (m *ConsumerMetadata) XXX_Size() int { + return m.Size() +} +func (m *ConsumerMetadata) XXX_DiscardUnknown() { + xxx_messageInfo_ConsumerMetadata.DiscardUnknown(m) +} + +var xxx_messageInfo_ConsumerMetadata proto.InternalMessageInfo + +func (m *ConsumerMetadata) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *ConsumerMetadata) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *ConsumerMetadata) GetMetadata() string { + if m != nil { + return m.Metadata + } + return "" +} + +// ConsumerInitializationParameters are the parameters needed to launch a chain +type ConsumerInitializationParameters struct { + // the proposed initial height of new consumer chain. + // For a completely new chain, this will be {0,1}. However, it may be + // different if this is a chain that is converting to a consumer chain. + InitialHeight types.Height `protobuf:"bytes,1,opt,name=initial_height,json=initialHeight,proto3" json:"initial_height"` + // The hash of the consumer chain genesis state without the consumer CCV + // module genesis params. It is used for off-chain confirmation of + // genesis.json validity by validators and other parties. + GenesisHash []byte `protobuf:"bytes,2,opt,name=genesis_hash,json=genesisHash,proto3" json:"genesis_hash,omitempty"` + // The hash of the consumer chain binary that should be run by validators on + // chain initialization. It is used for off-chain confirmation of binary + // validity by validators and other parties. + BinaryHash []byte `protobuf:"bytes,3,opt,name=binary_hash,json=binaryHash,proto3" json:"binary_hash,omitempty"` + // spawn time is the time on the provider chain at which the consumer chain + // genesis is finalized and all validators will be responsible for starting + // their consumer chain validator node. + SpawnTime time.Time `protobuf:"bytes,4,opt,name=spawn_time,json=spawnTime,proto3,stdtime" json:"spawn_time"` + // Unbonding period for the consumer, + // which should be smaller than that of the provider in general. + UnbondingPeriod time.Duration `protobuf:"bytes,5,opt,name=unbonding_period,json=unbondingPeriod,proto3,stdduration" json:"unbonding_period"` + // Sent CCV related IBC packets will timeout after this duration + CcvTimeoutPeriod time.Duration `protobuf:"bytes,6,opt,name=ccv_timeout_period,json=ccvTimeoutPeriod,proto3,stdduration" json:"ccv_timeout_period"` + // Sent transfer related IBC packets will timeout after this duration + TransferTimeoutPeriod time.Duration `protobuf:"bytes,7,opt,name=transfer_timeout_period,json=transferTimeoutPeriod,proto3,stdduration" json:"transfer_timeout_period"` + // The fraction of tokens allocated to the consumer redistribution address + // during distribution events. The fraction is a string representing a + // decimal number. For example "0.75" would represent 75%. + ConsumerRedistributionFraction string `protobuf:"bytes,8,opt,name=consumer_redistribution_fraction,json=consumerRedistributionFraction,proto3" json:"consumer_redistribution_fraction,omitempty"` + // BlocksPerDistributionTransmission is the number of blocks between + // ibc-token-transfers from the consumer chain to the provider chain. On + // sending transmission event, `consumer_redistribution_fraction` of the + // accumulated tokens are sent to the consumer redistribution address. + BlocksPerDistributionTransmission int64 `protobuf:"varint,9,opt,name=blocks_per_distribution_transmission,json=blocksPerDistributionTransmission,proto3" json:"blocks_per_distribution_transmission,omitempty"` + // The number of historical info entries to persist in store. + // This param is a part of the cosmos sdk staking module. In the case of + // a ccv enabled consumer chain, the ccv module acts as the staking module. + HistoricalEntries int64 `protobuf:"varint,10,opt,name=historical_entries,json=historicalEntries,proto3" json:"historical_entries,omitempty"` + // The ID of a token transfer channel used for the Reward Distribution + // sub-protocol. If DistributionTransmissionChannel == "", a new transfer + // channel is created on top of the same connection as the CCV channel. + // Note that transfer_channel_id is the ID of the channel end on the consumer + // chain. it is most relevant for chains performing a sovereign to consumer + // changeover in order to maintain the existing ibc transfer channel + DistributionTransmissionChannel string `protobuf:"bytes,11,opt,name=distribution_transmission_channel,json=distributionTransmissionChannel,proto3" json:"distribution_transmission_channel,omitempty"` +} + +func (m *ConsumerInitializationParameters) Reset() { *m = ConsumerInitializationParameters{} } +func (m *ConsumerInitializationParameters) String() string { return proto.CompactTextString(m) } +func (*ConsumerInitializationParameters) ProtoMessage() {} +func (*ConsumerInitializationParameters) Descriptor() ([]byte, []int) { + return fileDescriptor_f22ec409a72b7b72, []int{20} +} +func (m *ConsumerInitializationParameters) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ConsumerInitializationParameters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ConsumerInitializationParameters.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ConsumerInitializationParameters) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConsumerInitializationParameters.Merge(m, src) +} +func (m *ConsumerInitializationParameters) XXX_Size() int { + return m.Size() +} +func (m *ConsumerInitializationParameters) XXX_DiscardUnknown() { + xxx_messageInfo_ConsumerInitializationParameters.DiscardUnknown(m) +} + +var xxx_messageInfo_ConsumerInitializationParameters proto.InternalMessageInfo + +func (m *ConsumerInitializationParameters) GetInitialHeight() types.Height { + if m != nil { + return m.InitialHeight + } + return types.Height{} +} + +func (m *ConsumerInitializationParameters) GetGenesisHash() []byte { + if m != nil { + return m.GenesisHash + } + return nil +} + +func (m *ConsumerInitializationParameters) GetBinaryHash() []byte { + if m != nil { + return m.BinaryHash + } + return nil +} + +func (m *ConsumerInitializationParameters) GetSpawnTime() time.Time { + if m != nil { + return m.SpawnTime + } + return time.Time{} +} + +func (m *ConsumerInitializationParameters) GetUnbondingPeriod() time.Duration { + if m != nil { + return m.UnbondingPeriod + } + return 0 +} + +func (m *ConsumerInitializationParameters) GetCcvTimeoutPeriod() time.Duration { + if m != nil { + return m.CcvTimeoutPeriod + } + return 0 +} + +func (m *ConsumerInitializationParameters) GetTransferTimeoutPeriod() time.Duration { + if m != nil { + return m.TransferTimeoutPeriod + } + return 0 +} + +func (m *ConsumerInitializationParameters) GetConsumerRedistributionFraction() string { + if m != nil { + return m.ConsumerRedistributionFraction + } + return "" +} + +func (m *ConsumerInitializationParameters) GetBlocksPerDistributionTransmission() int64 { + if m != nil { + return m.BlocksPerDistributionTransmission + } + return 0 +} + +func (m *ConsumerInitializationParameters) GetHistoricalEntries() int64 { + if m != nil { + return m.HistoricalEntries + } + return 0 +} + +func (m *ConsumerInitializationParameters) GetDistributionTransmissionChannel() string { + if m != nil { + return m.DistributionTransmissionChannel + } + return "" +} + +// PowerShapingParameters contains parameters that shape the validator set that we send to the consumer chain +type PowerShapingParameters struct { + // Corresponds to the percentage of validators that have to validate the chain under the Top N case. + // For example, 53 corresponds to a Top 53% chain, meaning that the top 53% provider validators by voting power + // have to validate the proposed consumer chain. top_N can either be 0 or any value in [50, 100]. + // A chain can join with top_N == 0 as an Opt In chain, or with top_N ∈ [50, 100] as a Top N chain. + Top_N uint32 `protobuf:"varint,1,opt,name=top_N,json=topN,proto3" json:"top_N,omitempty"` + // Corresponds to the maximum power (percentage-wise) a validator can have on the consumer chain. For instance, if + // `validators_power_cap` is set to 32, it means that no validator can have more than 32% of the voting power on the + // consumer chain. Note that this might not be feasible. For example, think of a consumer chain with only + // 5 validators and with `validators_power_cap` set to 10%. In such a scenario, at least one validator would need + // to have more than 20% of the total voting power. Therefore, `validators_power_cap` operates on a best-effort basis. + ValidatorsPowerCap uint32 `protobuf:"varint,2,opt,name=validators_power_cap,json=validatorsPowerCap,proto3" json:"validators_power_cap,omitempty"` + // Corresponds to the maximum number of validators that can validate a consumer chain. + // Only applicable to Opt In chains. Setting `validator_set_cap` on a Top N chain is a no-op. + ValidatorSetCap uint32 `protobuf:"varint,3,opt,name=validator_set_cap,json=validatorSetCap,proto3" json:"validator_set_cap,omitempty"` + // corresponds to a list of provider consensus addresses of validators that are the ONLY ones that can validate the consumer chain + Allowlist []string `protobuf:"bytes,4,rep,name=allowlist,proto3" json:"allowlist,omitempty"` + // corresponds to a list of provider consensus addresses of validators that CANNOT validate the consumer chain + Denylist []string `protobuf:"bytes,5,rep,name=denylist,proto3" json:"denylist,omitempty"` + // Corresponds to the minimal amount of (provider chain) stake required to validate on the consumer chain. + MinStake uint64 `protobuf:"varint,6,opt,name=min_stake,json=minStake,proto3" json:"min_stake,omitempty"` + // Corresponds to whether inactive validators are allowed to validate the consumer chain. + AllowInactiveVals bool `protobuf:"varint,7,opt,name=allow_inactive_vals,json=allowInactiveVals,proto3" json:"allow_inactive_vals,omitempty"` +} + +func (m *PowerShapingParameters) Reset() { *m = PowerShapingParameters{} } +func (m *PowerShapingParameters) String() string { return proto.CompactTextString(m) } +func (*PowerShapingParameters) ProtoMessage() {} +func (*PowerShapingParameters) Descriptor() ([]byte, []int) { + return fileDescriptor_f22ec409a72b7b72, []int{21} +} +func (m *PowerShapingParameters) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PowerShapingParameters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PowerShapingParameters.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PowerShapingParameters) XXX_Merge(src proto.Message) { + xxx_messageInfo_PowerShapingParameters.Merge(m, src) +} +func (m *PowerShapingParameters) XXX_Size() int { + return m.Size() +} +func (m *PowerShapingParameters) XXX_DiscardUnknown() { + xxx_messageInfo_PowerShapingParameters.DiscardUnknown(m) +} + +var xxx_messageInfo_PowerShapingParameters proto.InternalMessageInfo + +func (m *PowerShapingParameters) GetTop_N() uint32 { + if m != nil { + return m.Top_N + } + return 0 +} + +func (m *PowerShapingParameters) GetValidatorsPowerCap() uint32 { + if m != nil { + return m.ValidatorsPowerCap + } + return 0 +} + +func (m *PowerShapingParameters) GetValidatorSetCap() uint32 { + if m != nil { + return m.ValidatorSetCap + } + return 0 +} + +func (m *PowerShapingParameters) GetAllowlist() []string { + if m != nil { + return m.Allowlist + } + return nil +} + +func (m *PowerShapingParameters) GetDenylist() []string { + if m != nil { + return m.Denylist + } + return nil +} + +func (m *PowerShapingParameters) GetMinStake() uint64 { + if m != nil { + return m.MinStake + } + return 0 +} + +func (m *PowerShapingParameters) GetAllowInactiveVals() bool { + if m != nil { + return m.AllowInactiveVals + } + return false +} + +// ConsumerIds contains consumer ids of chains +// Used so we can easily (de)serialize slices of strings +type ConsumerIds struct { + Ids []string `protobuf:"bytes,1,rep,name=ids,proto3" json:"ids,omitempty"` +} + +func (m *ConsumerIds) Reset() { *m = ConsumerIds{} } +func (m *ConsumerIds) String() string { return proto.CompactTextString(m) } +func (*ConsumerIds) ProtoMessage() {} +func (*ConsumerIds) Descriptor() ([]byte, []int) { + return fileDescriptor_f22ec409a72b7b72, []int{22} +} +func (m *ConsumerIds) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ConsumerIds) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ConsumerIds.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ConsumerIds) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConsumerIds.Merge(m, src) +} +func (m *ConsumerIds) XXX_Size() int { + return m.Size() +} +func (m *ConsumerIds) XXX_DiscardUnknown() { + xxx_messageInfo_ConsumerIds.DiscardUnknown(m) +} + +var xxx_messageInfo_ConsumerIds proto.InternalMessageInfo + +func (m *ConsumerIds) GetIds() []string { + if m != nil { + return m.Ids + } + return nil +} + func init() { proto.RegisterType((*ConsumerAdditionProposal)(nil), "interchain_security.ccv.provider.v1.ConsumerAdditionProposal") proto.RegisterType((*ConsumerRemovalProposal)(nil), "interchain_security.ccv.provider.v1.ConsumerRemovalProposal") @@ -1392,6 +1771,10 @@ func init() { proto.RegisterType((*ConsumerAddrsToPruneV2)(nil), "interchain_security.ccv.provider.v1.ConsumerAddrsToPruneV2") proto.RegisterType((*ConsensusValidator)(nil), "interchain_security.ccv.provider.v1.ConsensusValidator") proto.RegisterType((*ConsumerRewardsAllocation)(nil), "interchain_security.ccv.provider.v1.ConsumerRewardsAllocation") + proto.RegisterType((*ConsumerMetadata)(nil), "interchain_security.ccv.provider.v1.ConsumerMetadata") + proto.RegisterType((*ConsumerInitializationParameters)(nil), "interchain_security.ccv.provider.v1.ConsumerInitializationParameters") + proto.RegisterType((*PowerShapingParameters)(nil), "interchain_security.ccv.provider.v1.PowerShapingParameters") + proto.RegisterType((*ConsumerIds)(nil), "interchain_security.ccv.provider.v1.ConsumerIds") } func init() { @@ -1399,129 +1782,140 @@ func init() { } var fileDescriptor_f22ec409a72b7b72 = []byte{ - // 1946 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcd, 0x6f, 0x1b, 0xc7, - 0x15, 0xd7, 0x8a, 0x94, 0x44, 0x0e, 0xf5, 0x39, 0x52, 0xec, 0x95, 0xa2, 0x92, 0x34, 0x53, 0x1b, - 0x6c, 0x5c, 0x2f, 0x23, 0x05, 0x05, 0x0c, 0xb7, 0x81, 0x21, 0x51, 0x4e, 0x6c, 0xa9, 0x71, 0xd8, - 0x15, 0xa1, 0x00, 0xe9, 0x61, 0x31, 0x9c, 0x1d, 0x91, 0x53, 0xed, 0xee, 0xac, 0x67, 0x86, 0x2b, - 0xf3, 0xd2, 0x73, 0x2f, 0x05, 0xd2, 0x5b, 0xd0, 0x4b, 0x73, 0x2c, 0x7a, 0xea, 0xa1, 0xe8, 0x1f, - 0xd0, 0x53, 0x50, 0xa0, 0x68, 0x8e, 0x3d, 0x25, 0x85, 0x7d, 0xe8, 0xa1, 0x40, 0xaf, 0xbd, 0x16, - 0x33, 0xfb, 0xc1, 0xa5, 0x3e, 0x1c, 0x1a, 0x69, 0x2e, 0xd2, 0xee, 0x7b, 0xbf, 0xf7, 0x9b, 0x37, - 0x33, 0xef, 0x8b, 0x0b, 0x76, 0x69, 0x20, 0x09, 0xc7, 0x03, 0x44, 0x03, 0x47, 0x10, 0x3c, 0xe4, - 0x54, 0x8e, 0x5a, 0x18, 0x47, 0xad, 0x90, 0xb3, 0x88, 0xba, 0x84, 0xb7, 0xa2, 0x9d, 0xec, 0xd9, - 0x0a, 0x39, 0x93, 0x0c, 0xbe, 0x75, 0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 0xa6, 0x98, 0x56, 0x32, 0xe3, 0x8e, 0xb6, 0x85, 0x3f, 0x03, 0x10, 0xe3, 0x48, 0xbb, - 0xc4, 0x86, 0x32, 0x65, 0x2c, 0x4f, 0xcf, 0xb8, 0x8a, 0x71, 0xd4, 0x8d, 0xad, 0x13, 0xca, 0x9f, - 0x83, 0x9b, 0x92, 0xa3, 0x40, 0x9c, 0x12, 0x7e, 0x91, 0x17, 0x4c, 0xcf, 0xfb, 0x46, 0xca, 0x31, - 0x49, 0xfe, 0x18, 0xd4, 0x71, 0x12, 0x40, 0x0e, 0x27, 0x2e, 0x15, 0x92, 0xd3, 0xde, 0x50, 0xd9, - 0x3a, 0xa7, 0x1c, 0x61, 0x1d, 0x23, 0x15, 0x1d, 0x04, 0xd5, 0x14, 0x67, 0x4f, 0xc0, 0xde, 0x4f, - 0x50, 0xf0, 0x23, 0xf0, 0xfd, 0x9e, 0xc7, 0xf0, 0x99, 0x50, 0xce, 0x39, 0x13, 0x4c, 0x7a, 0x69, - 0x9f, 0x0a, 0xa1, 0xd8, 0x16, 0xeb, 0x46, 0xb3, 0x60, 0xdf, 0x8a, 0xb1, 0x1d, 0xc2, 0x0f, 0x72, - 0xc8, 0x6e, 0x0e, 0x08, 0xef, 0x01, 0x38, 0xa0, 0x42, 0x32, 0x4e, 0x31, 0xf2, 0x1c, 0x12, 0x48, - 0x4e, 0x89, 0x30, 0x97, 0xb4, 0xf9, 0xda, 0x58, 0xf3, 0x28, 0x56, 0xc0, 0x43, 0x70, 0xeb, 0xda, - 0x45, 0x1d, 0x3c, 0x40, 0x41, 0x40, 0x3c, 0x73, 0x59, 0x6f, 0xa5, 0xe6, 0x5e, 0xb3, 0x66, 0x3b, - 0x86, 0xc1, 0x75, 0x30, 0x27, 0x59, 0xe8, 0x3c, 0x35, 0x57, 0xea, 0x46, 0x73, 0xc9, 0x2e, 0x4a, - 0x16, 0x3e, 0x85, 0xef, 0x80, 0x8d, 0x08, 0x79, 0xd4, 0x45, 0x92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x0e, 0xf5, 0x83, 0x1a, 0x3b, 0xf6, 0x4a, 0xd1, 0x97, 0xa4, 0x37, + 0x5f, 0x1b, 0x6c, 0x5c, 0x2f, 0x23, 0x05, 0x05, 0x0c, 0xb7, 0x81, 0x21, 0x51, 0x4e, 0x2c, 0xa9, + 0x71, 0xd8, 0x95, 0xa0, 0x00, 0xe9, 0x61, 0x31, 0xdc, 0x1d, 0x91, 0x53, 0xed, 0xee, 0xac, 0x67, + 0x86, 0x2b, 0xb3, 0x87, 0x9e, 0x8b, 0x02, 0x05, 0xd2, 0x9e, 0x82, 0x5e, 0x9a, 0x63, 0xd1, 0x53, + 0x0f, 0x45, 0xff, 0x80, 0x9e, 0x82, 0x02, 0x45, 0x73, 0xec, 0x29, 0x29, 0xec, 0x43, 0x0f, 0x05, + 0x7a, 0xed, 0xb5, 0x98, 0xd9, 0x1f, 0x5c, 0xea, 0x97, 0x69, 0x58, 0xee, 0x45, 0xda, 0x79, 0xef, + 0xf3, 0xde, 0xbc, 0x99, 0x79, 0xbf, 0x66, 0x08, 0x36, 0x48, 0x20, 0x30, 0x73, 0xfa, 0x88, 0x04, + 0x36, 0xc7, 0xce, 0x80, 0x11, 0x31, 0x6c, 0x39, 0x4e, 0xd4, 0x0a, 0x19, 0x8d, 0x88, 0x8b, 0x59, + 0x2b, 0x5a, 0xcf, 0xbe, 0xcd, 0x90, 0x51, 0x41, 0xe1, 0x3b, 0xe7, 0xc8, 0x98, 0x8e, 0x13, 0x99, + 0x19, 0x2e, 0x5a, 0x5f, 0xbd, 0x7d, 0x91, 0xe2, 0x68, 0xbd, 0x75, 0x42, 0x18, 0x8e, 0x75, 0xad, + 0x5e, 0xef, 0xd1, 0x1e, 0x55, 0x9f, 0x2d, 0xf9, 0x95, 0x50, 0xeb, 0x3d, 0x4a, 0x7b, 0x1e, 0x6e, + 0xa9, 0x51, 0x77, 0x70, 0xd4, 0x12, 0xc4, 0xc7, 0x5c, 0x20, 0x3f, 0x4c, 0x00, 0xb5, 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e, 0x76, 0x2d, + 0x9f, 0xbb, 0xe8, 0x5a, 0x5e, 0x07, 0x95, 0x2c, 0x41, 0xb8, 0x1c, 0x56, 0x41, 0x81, 0xb8, 0x69, + 0x33, 0x29, 0x3f, 0xb7, 0x3e, 0xfd, 0xea, 0x79, 0x4d, 0xfb, 0xfa, 0x79, 0x4d, 0xfb, 0xc7, 0xf3, + 0x9a, 0xf6, 0xf9, 0x8b, 0xda, 0xd4, 0xd7, 0x2f, 0x6a, 0x53, 0x7f, 0x7f, 0x51, 0x9b, 0xfa, 0xec, + 0x83, 0xb3, 0xd9, 0x6f, 0x54, 0x5d, 0xee, 0x65, 0xbf, 0x00, 0x44, 0xdf, 0x6b, 0x3d, 0x1b, 0xff, + 0x7d, 0x41, 0x25, 0xc6, 0xee, 0xac, 0x72, 0xec, 0xf7, 0xff, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x45, + 0xe0, 0x33, 0x4d, 0x90, 0x18, 0x00, 0x00, } func (m *ConsumerAdditionProposal) Marshal() (dAtA []byte, err error) { @@ -2589,14 +2983,264 @@ func (m *ConsumerRewardsAllocation) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } -func encodeVarintProvider(dAtA []byte, offset int, v uint64) int { - offset -= sovProvider(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } +func (m *ConsumerMetadata) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ConsumerMetadata) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ConsumerMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Metadata) > 0 { + i -= len(m.Metadata) + copy(dAtA[i:], m.Metadata) + i = encodeVarintProvider(dAtA, i, uint64(len(m.Metadata))) + i-- + dAtA[i] = 0x1a + } + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintProvider(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintProvider(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ConsumerInitializationParameters) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ConsumerInitializationParameters) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ConsumerInitializationParameters) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.DistributionTransmissionChannel) > 0 { + i -= len(m.DistributionTransmissionChannel) + copy(dAtA[i:], m.DistributionTransmissionChannel) + i = encodeVarintProvider(dAtA, i, uint64(len(m.DistributionTransmissionChannel))) + i-- + dAtA[i] = 0x5a + } + if m.HistoricalEntries != 0 { + i = encodeVarintProvider(dAtA, i, uint64(m.HistoricalEntries)) + i-- + dAtA[i] = 0x50 + } + if m.BlocksPerDistributionTransmission != 0 { + i = encodeVarintProvider(dAtA, i, uint64(m.BlocksPerDistributionTransmission)) + i-- + dAtA[i] = 0x48 + } + if len(m.ConsumerRedistributionFraction) > 0 { + i -= len(m.ConsumerRedistributionFraction) + copy(dAtA[i:], m.ConsumerRedistributionFraction) + i = encodeVarintProvider(dAtA, i, uint64(len(m.ConsumerRedistributionFraction))) + i-- + dAtA[i] = 0x42 + } + n17, err17 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.TransferTimeoutPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.TransferTimeoutPeriod):]) + if err17 != nil { + return 0, err17 + } + i -= n17 + i = encodeVarintProvider(dAtA, i, uint64(n17)) + i-- + dAtA[i] = 0x3a + n18, err18 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.CcvTimeoutPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.CcvTimeoutPeriod):]) + if err18 != nil { + return 0, err18 + } + i -= n18 + i = encodeVarintProvider(dAtA, i, uint64(n18)) + i-- + dAtA[i] = 0x32 + n19, err19 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.UnbondingPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.UnbondingPeriod):]) + if err19 != nil { + return 0, err19 + } + i -= n19 + i = encodeVarintProvider(dAtA, i, uint64(n19)) + i-- + dAtA[i] = 0x2a + n20, err20 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.SpawnTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.SpawnTime):]) + if err20 != nil { + return 0, err20 + } + i -= n20 + i = encodeVarintProvider(dAtA, i, uint64(n20)) + i-- + dAtA[i] = 0x22 + if len(m.BinaryHash) > 0 { + i -= len(m.BinaryHash) + copy(dAtA[i:], m.BinaryHash) + i = encodeVarintProvider(dAtA, i, uint64(len(m.BinaryHash))) + i-- + dAtA[i] = 0x1a + } + if len(m.GenesisHash) > 0 { + i -= len(m.GenesisHash) + copy(dAtA[i:], m.GenesisHash) + i = encodeVarintProvider(dAtA, i, uint64(len(m.GenesisHash))) + i-- + dAtA[i] = 0x12 + } + { + size, err := m.InitialHeight.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProvider(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *PowerShapingParameters) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PowerShapingParameters) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PowerShapingParameters) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.AllowInactiveVals { + i-- + if m.AllowInactiveVals { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x38 + } + if m.MinStake != 0 { + i = encodeVarintProvider(dAtA, i, uint64(m.MinStake)) + i-- + dAtA[i] = 0x30 + } + if len(m.Denylist) > 0 { + for iNdEx := len(m.Denylist) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Denylist[iNdEx]) + copy(dAtA[i:], m.Denylist[iNdEx]) + i = encodeVarintProvider(dAtA, i, uint64(len(m.Denylist[iNdEx]))) + i-- + dAtA[i] = 0x2a + } + } + if len(m.Allowlist) > 0 { + for iNdEx := len(m.Allowlist) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Allowlist[iNdEx]) + copy(dAtA[i:], m.Allowlist[iNdEx]) + i = encodeVarintProvider(dAtA, i, uint64(len(m.Allowlist[iNdEx]))) + i-- + dAtA[i] = 0x22 + } + } + if m.ValidatorSetCap != 0 { + i = encodeVarintProvider(dAtA, i, uint64(m.ValidatorSetCap)) + i-- + dAtA[i] = 0x18 + } + if m.ValidatorsPowerCap != 0 { + i = encodeVarintProvider(dAtA, i, uint64(m.ValidatorsPowerCap)) + i-- + dAtA[i] = 0x10 + } + if m.Top_N != 0 { + i = encodeVarintProvider(dAtA, i, uint64(m.Top_N)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *ConsumerIds) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ConsumerIds) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ConsumerIds) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Ids) > 0 { + for iNdEx := len(m.Ids) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Ids[iNdEx]) + copy(dAtA[i:], m.Ids[iNdEx]) + i = encodeVarintProvider(dAtA, i, uint64(len(m.Ids[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintProvider(dAtA []byte, offset int, v uint64) int { + offset -= sovProvider(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } dAtA[offset] = uint8(v) return base } @@ -3072,39 +3716,152 @@ func (m *ConsumerRewardsAllocation) Size() (n int) { return n } -func sovProvider(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozProvider(x uint64) (n int) { - return sovProvider(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +func (m *ConsumerMetadata) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovProvider(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovProvider(uint64(l)) + } + l = len(m.Metadata) + if l > 0 { + n += 1 + l + sovProvider(uint64(l)) + } + return n } -func (m *ConsumerAdditionProposal) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ConsumerAdditionProposal: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ConsumerAdditionProposal: illegal tag %d (wire type %d)", fieldNum, wire) + +func (m *ConsumerInitializationParameters) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.InitialHeight.Size() + n += 1 + l + sovProvider(uint64(l)) + l = len(m.GenesisHash) + if l > 0 { + n += 1 + l + sovProvider(uint64(l)) + } + l = len(m.BinaryHash) + if l > 0 { + n += 1 + l + sovProvider(uint64(l)) + } + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.SpawnTime) + n += 1 + l + sovProvider(uint64(l)) + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.UnbondingPeriod) + n += 1 + l + sovProvider(uint64(l)) + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.CcvTimeoutPeriod) + n += 1 + l + sovProvider(uint64(l)) + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.TransferTimeoutPeriod) + n += 1 + l + sovProvider(uint64(l)) + l = len(m.ConsumerRedistributionFraction) + if l > 0 { + n += 1 + l + sovProvider(uint64(l)) + } + if m.BlocksPerDistributionTransmission != 0 { + n += 1 + sovProvider(uint64(m.BlocksPerDistributionTransmission)) + } + if m.HistoricalEntries != 0 { + n += 1 + sovProvider(uint64(m.HistoricalEntries)) + } + l = len(m.DistributionTransmissionChannel) + if l > 0 { + n += 1 + l + sovProvider(uint64(l)) + } + return n +} + +func (m *PowerShapingParameters) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Top_N != 0 { + n += 1 + sovProvider(uint64(m.Top_N)) + } + if m.ValidatorsPowerCap != 0 { + n += 1 + sovProvider(uint64(m.ValidatorsPowerCap)) + } + if m.ValidatorSetCap != 0 { + n += 1 + sovProvider(uint64(m.ValidatorSetCap)) + } + if len(m.Allowlist) > 0 { + for _, s := range m.Allowlist { + l = len(s) + n += 1 + l + sovProvider(uint64(l)) + } + } + if len(m.Denylist) > 0 { + for _, s := range m.Denylist { + l = len(s) + n += 1 + l + sovProvider(uint64(l)) + } + } + if m.MinStake != 0 { + n += 1 + sovProvider(uint64(m.MinStake)) + } + if m.AllowInactiveVals { + n += 2 + } + return n +} + +func (m *ConsumerIds) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Ids) > 0 { + for _, s := range m.Ids { + l = len(s) + n += 1 + l + sovProvider(uint64(l)) + } + } + return n +} + +func sovProvider(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozProvider(x uint64) (n int) { + return sovProvider(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *ConsumerAdditionProposal) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ConsumerAdditionProposal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ConsumerAdditionProposal: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -6368,6 +7125,829 @@ func (m *ConsumerRewardsAllocation) Unmarshal(dAtA []byte) error { } return nil } +func (m *ConsumerMetadata) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ConsumerMetadata: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ConsumerMetadata: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Metadata = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipProvider(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthProvider + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ConsumerInitializationParameters) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ConsumerInitializationParameters: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ConsumerInitializationParameters: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InitialHeight", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.InitialHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GenesisHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GenesisHash = append(m.GenesisHash[:0], dAtA[iNdEx:postIndex]...) + if m.GenesisHash == nil { + m.GenesisHash = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BinaryHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BinaryHash = append(m.BinaryHash[:0], dAtA[iNdEx:postIndex]...) + if m.BinaryHash == nil { + m.BinaryHash = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SpawnTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.SpawnTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UnbondingPeriod", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(&m.UnbondingPeriod, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CcvTimeoutPeriod", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(&m.CcvTimeoutPeriod, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TransferTimeoutPeriod", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(&m.TransferTimeoutPeriod, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerRedistributionFraction", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConsumerRedistributionFraction = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlocksPerDistributionTransmission", wireType) + } + m.BlocksPerDistributionTransmission = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlocksPerDistributionTransmission |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HistoricalEntries", wireType) + } + m.HistoricalEntries = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.HistoricalEntries |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DistributionTransmissionChannel", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DistributionTransmissionChannel = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipProvider(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthProvider + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PowerShapingParameters) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PowerShapingParameters: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PowerShapingParameters: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Top_N", wireType) + } + m.Top_N = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Top_N |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorsPowerCap", wireType) + } + m.ValidatorsPowerCap = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ValidatorsPowerCap |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorSetCap", wireType) + } + m.ValidatorSetCap = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ValidatorSetCap |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Allowlist", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Allowlist = append(m.Allowlist, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denylist", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denylist = append(m.Denylist, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinStake", wireType) + } + m.MinStake = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinStake |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AllowInactiveVals", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.AllowInactiveVals = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipProvider(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthProvider + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ConsumerIds) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ConsumerIds: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ConsumerIds: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ids", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Ids = append(m.Ids, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipProvider(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthProvider + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipProvider(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/ccv/provider/types/query.pb.go b/x/ccv/provider/types/query.pb.go index bc7866140f..aee4e3d717 100644 --- a/x/ccv/provider/types/query.pb.go +++ b/x/ccv/provider/types/query.pb.go @@ -9,6 +9,7 @@ import ( fmt "fmt" crypto "github.com/cometbft/cometbft/proto/tendermint/crypto" _ "github.com/cosmos/cosmos-proto" + types1 "github.com/cosmos/cosmos-sdk/x/staking/types" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -38,7 +39,9 @@ var _ = time.Kitchen const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type QueryConsumerGenesisRequest struct { - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + // [DEPRECATED] use `consumer_id` instead + ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` // Deprecated: Do not use. + ConsumerId string `protobuf:"bytes,2,opt,name=consumer_id,json=consumerId,proto3" json:"consumer_id,omitempty"` } func (m *QueryConsumerGenesisRequest) Reset() { *m = QueryConsumerGenesisRequest{} } @@ -74,6 +77,7 @@ func (m *QueryConsumerGenesisRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryConsumerGenesisRequest proto.InternalMessageInfo +// Deprecated: Do not use. func (m *QueryConsumerGenesisRequest) GetChainId() string { if m != nil { return m.ChainId @@ -81,6 +85,13 @@ func (m *QueryConsumerGenesisRequest) GetChainId() string { return "" } +func (m *QueryConsumerGenesisRequest) GetConsumerId() string { + if m != nil { + return m.ConsumerId + } + return "" +} + type QueryConsumerGenesisResponse struct { GenesisState types.ConsumerGenesisState `protobuf:"bytes,1,opt,name=genesis_state,json=genesisState,proto3" json:"genesis_state"` } @@ -483,10 +494,12 @@ func (m *Chain) GetDenylist() []string { } type QueryValidatorConsumerAddrRequest struct { - // The id of the consumer chain - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + // [DEPRECATED] use `consumer_id` instead + ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` // Deprecated: Do not use. // The consensus address of the validator on the provider chain ProviderAddress string `protobuf:"bytes,2,opt,name=provider_address,json=providerAddress,proto3" json:"provider_address,omitempty" yaml:"address"` + // The id of the consumer chain + ConsumerId string `protobuf:"bytes,3,opt,name=consumer_id,json=consumerId,proto3" json:"consumer_id,omitempty"` } func (m *QueryValidatorConsumerAddrRequest) Reset() { *m = QueryValidatorConsumerAddrRequest{} } @@ -568,10 +581,12 @@ func (m *QueryValidatorConsumerAddrResponse) GetConsumerAddress() string { } type QueryValidatorProviderAddrRequest struct { - // The id of the provider chain - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + // [DEPRECATED] use `consumer_id` instead + ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` // Deprecated: Do not use. // The consensus address of the validator on the consumer chain ConsumerAddress string `protobuf:"bytes,2,opt,name=consumer_address,json=consumerAddress,proto3" json:"consumer_address,omitempty" yaml:"address"` + // The id of the consumer chain + ConsumerId string `protobuf:"bytes,3,opt,name=consumer_id,json=consumerId,proto3" json:"consumer_id,omitempty"` } func (m *QueryValidatorProviderAddrRequest) Reset() { *m = QueryValidatorProviderAddrRequest{} } @@ -922,8 +937,10 @@ func (m *QueryProposedChainIDsResponse) GetProposedChains() []ProposedChain { } type ProposedChain struct { - ChainID string `protobuf:"bytes,1,opt,name=chainID,proto3" json:"chainID,omitempty"` + // [DEPRECATED] use `consumer_id` instead + ChainID string `protobuf:"bytes,1,opt,name=chainID,proto3" json:"chainID,omitempty"` // Deprecated: Do not use. ProposalID uint64 `protobuf:"varint,2,opt,name=proposalID,proto3" json:"proposalID,omitempty"` + ConsumerId string `protobuf:"bytes,3,opt,name=consumer_id,json=consumerId,proto3" json:"consumer_id,omitempty"` } func (m *ProposedChain) Reset() { *m = ProposedChain{} } @@ -959,6 +976,7 @@ func (m *ProposedChain) XXX_DiscardUnknown() { var xxx_messageInfo_ProposedChain proto.InternalMessageInfo +// Deprecated: Do not use. func (m *ProposedChain) GetChainID() string { if m != nil { return m.ChainID @@ -973,9 +991,18 @@ func (m *ProposedChain) GetProposalID() uint64 { return 0 } +func (m *ProposedChain) GetConsumerId() string { + if m != nil { + return m.ConsumerId + } + return "" +} + type QueryAllPairsValConAddrByConsumerChainIDRequest struct { + // [DEPRECATED] use `consumer_id` instead + ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` // Deprecated: Do not use. // The id of the consumer chain - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + ConsumerId string `protobuf:"bytes,2,opt,name=consumer_id,json=consumerId,proto3" json:"consumer_id,omitempty"` } func (m *QueryAllPairsValConAddrByConsumerChainIDRequest) Reset() { @@ -1015,6 +1042,7 @@ func (m *QueryAllPairsValConAddrByConsumerChainIDRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryAllPairsValConAddrByConsumerChainIDRequest proto.InternalMessageInfo +// Deprecated: Do not use. func (m *QueryAllPairsValConAddrByConsumerChainIDRequest) GetChainId() string { if m != nil { return m.ChainId @@ -1022,6 +1050,13 @@ func (m *QueryAllPairsValConAddrByConsumerChainIDRequest) GetChainId() string { return "" } +func (m *QueryAllPairsValConAddrByConsumerChainIDRequest) GetConsumerId() string { + if m != nil { + return m.ConsumerId + } + return "" +} + type QueryAllPairsValConAddrByConsumerChainIDResponse struct { PairValConAddr []*PairValConAddrProviderAndConsumer `protobuf:"bytes,1,rep,name=pair_val_con_addr,json=pairValConAddr,proto3" json:"pair_val_con_addr,omitempty"` } @@ -1213,7 +1248,9 @@ func (m *QueryParamsResponse) GetParams() Params { } type QueryConsumerChainOptedInValidatorsRequest struct { - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + // [DEPRECATED] use `consumer_id` instead + ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` // Deprecated: Do not use. + ConsumerId string `protobuf:"bytes,2,opt,name=consumer_id,json=consumerId,proto3" json:"consumer_id,omitempty"` } func (m *QueryConsumerChainOptedInValidatorsRequest) Reset() { @@ -1253,6 +1290,7 @@ func (m *QueryConsumerChainOptedInValidatorsRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryConsumerChainOptedInValidatorsRequest proto.InternalMessageInfo +// Deprecated: Do not use. func (m *QueryConsumerChainOptedInValidatorsRequest) GetChainId() string { if m != nil { return m.ChainId @@ -1260,6 +1298,13 @@ func (m *QueryConsumerChainOptedInValidatorsRequest) GetChainId() string { return "" } +func (m *QueryConsumerChainOptedInValidatorsRequest) GetConsumerId() string { + if m != nil { + return m.ConsumerId + } + return "" +} + type QueryConsumerChainOptedInValidatorsResponse struct { // The consensus addresses of the validators on the provider chain ValidatorsProviderAddresses []string `protobuf:"bytes,1,rep,name=validators_provider_addresses,json=validatorsProviderAddresses,proto3" json:"validators_provider_addresses,omitempty"` @@ -1310,7 +1355,9 @@ func (m *QueryConsumerChainOptedInValidatorsResponse) GetValidatorsProviderAddre } type QueryConsumerValidatorsRequest struct { - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + // [DEPRECATED] use `consumer_id` instead + ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` // Deprecated: Do not use. + ConsumerId string `protobuf:"bytes,2,opt,name=consumer_id,json=consumerId,proto3" json:"consumer_id,omitempty"` } func (m *QueryConsumerValidatorsRequest) Reset() { *m = QueryConsumerValidatorsRequest{} } @@ -1346,6 +1393,7 @@ func (m *QueryConsumerValidatorsRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryConsumerValidatorsRequest proto.InternalMessageInfo +// Deprecated: Do not use. func (m *QueryConsumerValidatorsRequest) GetChainId() string { if m != nil { return m.ChainId @@ -1353,15 +1401,42 @@ func (m *QueryConsumerValidatorsRequest) GetChainId() string { return "" } +func (m *QueryConsumerValidatorsRequest) GetConsumerId() string { + if m != nil { + return m.ConsumerId + } + return "" +} + type QueryConsumerValidatorsValidator struct { // The consensus address of the validator on the provider chain ProviderAddress string `protobuf:"bytes,1,opt,name=provider_address,json=providerAddress,proto3" json:"provider_address,omitempty" yaml:"address"` // The consumer public key of the validator used on the consumer chain ConsumerKey *crypto.PublicKey `protobuf:"bytes,2,opt,name=consumer_key,json=consumerKey,proto3" json:"consumer_key,omitempty"` + // [DEPRECATED] use `consumer_power` instead + Power int64 `protobuf:"varint,3,opt,name=power,proto3" json:"power,omitempty"` // Deprecated: Do not use. + // [DEPRECATED] use `consumer_commission_rate` instead + Rate cosmossdk_io_math.LegacyDec `protobuf:"bytes,4,opt,name=rate,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"rate"` // Deprecated: Do not use. // The power of the validator used on the consumer chain - Power int64 `protobuf:"varint,3,opt,name=power,proto3" json:"power,omitempty"` + ConsumerPower int64 `protobuf:"varint,5,opt,name=consumer_power,json=consumerPower,proto3" json:"consumer_power,omitempty"` // The rate to charge delegators on the consumer chain, as a fraction - Rate cosmossdk_io_math.LegacyDec `protobuf:"bytes,4,opt,name=rate,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"rate"` + ConsumerCommissionRate cosmossdk_io_math.LegacyDec `protobuf:"bytes,6,opt,name=consumer_commission_rate,json=consumerCommissionRate,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"consumer_commission_rate"` + // The rate to charge delegators on the provider chain, as a fraction + ProviderCommissionRate cosmossdk_io_math.LegacyDec `protobuf:"bytes,7,opt,name=provider_commission_rate,json=providerCommissionRate,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"provider_commission_rate"` + // description defines the description terms for the validator + Description types1.Description `protobuf:"bytes,8,opt,name=description,proto3" json:"description"` + // provider_operator_address defines the address of the validator's operator + ProviderOperatorAddress string `protobuf:"bytes,9,opt,name=provider_operator_address,json=providerOperatorAddress,proto3" json:"provider_operator_address,omitempty"` + // jailed defined whether the validator has been jailed from bonded status or not. + Jailed bool `protobuf:"varint,10,opt,name=jailed,proto3" json:"jailed,omitempty"` + // status is the validator status (bonded/unbonding/unbonded). + Status types1.BondStatus `protobuf:"varint,11,opt,name=status,proto3,enum=cosmos.staking.v1beta1.BondStatus" json:"status,omitempty"` + // provider_tokens defines the delegated tokens (incl. self-delegation). + ProviderTokens cosmossdk_io_math.Int `protobuf:"bytes,12,opt,name=provider_tokens,json=providerTokens,proto3,customtype=cosmossdk.io/math.Int" json:"provider_tokens"` + // The power of the validator used on the provider chain + ProviderPower int64 `protobuf:"varint,13,opt,name=provider_power,json=providerPower,proto3" json:"provider_power,omitempty"` + // validates_current_epoch defines whether the validator has to validate for the current epoch or not + ValidatesCurrentEpoch bool `protobuf:"varint,14,opt,name=validates_current_epoch,json=validatesCurrentEpoch,proto3" json:"validates_current_epoch,omitempty"` } func (m *QueryConsumerValidatorsValidator) Reset() { *m = QueryConsumerValidatorsValidator{} } @@ -1411,6 +1486,7 @@ func (m *QueryConsumerValidatorsValidator) GetConsumerKey() *crypto.PublicKey { return nil } +// Deprecated: Do not use. func (m *QueryConsumerValidatorsValidator) GetPower() int64 { if m != nil { return m.Power @@ -1418,6 +1494,55 @@ func (m *QueryConsumerValidatorsValidator) GetPower() int64 { return 0 } +func (m *QueryConsumerValidatorsValidator) GetConsumerPower() int64 { + if m != nil { + return m.ConsumerPower + } + return 0 +} + +func (m *QueryConsumerValidatorsValidator) GetDescription() types1.Description { + if m != nil { + return m.Description + } + return types1.Description{} +} + +func (m *QueryConsumerValidatorsValidator) GetProviderOperatorAddress() string { + if m != nil { + return m.ProviderOperatorAddress + } + return "" +} + +func (m *QueryConsumerValidatorsValidator) GetJailed() bool { + if m != nil { + return m.Jailed + } + return false +} + +func (m *QueryConsumerValidatorsValidator) GetStatus() types1.BondStatus { + if m != nil { + return m.Status + } + return types1.Unspecified +} + +func (m *QueryConsumerValidatorsValidator) GetProviderPower() int64 { + if m != nil { + return m.ProviderPower + } + return 0 +} + +func (m *QueryConsumerValidatorsValidator) GetValidatesCurrentEpoch() bool { + if m != nil { + return m.ValidatesCurrentEpoch + } + return false +} + type QueryConsumerValidatorsResponse struct { Validators []*QueryConsumerValidatorsValidator `protobuf:"bytes,1,rep,name=validators,proto3" json:"validators,omitempty"` } @@ -1560,9 +1685,11 @@ func (m *QueryConsumerChainsValidatorHasToValidateResponse) GetConsumerChainIds( } type QueryValidatorConsumerCommissionRateRequest struct { - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + // [DEPRECATED] use `consumer_id` instead + ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` // Deprecated: Do not use. // The consensus address of the validator on the provider chain ProviderAddress string `protobuf:"bytes,2,opt,name=provider_address,json=providerAddress,proto3" json:"provider_address,omitempty" yaml:"address"` + ConsumerId string `protobuf:"bytes,3,opt,name=consumer_id,json=consumerId,proto3" json:"consumer_id,omitempty"` } func (m *QueryValidatorConsumerCommissionRateRequest) Reset() { @@ -1602,6 +1729,7 @@ func (m *QueryValidatorConsumerCommissionRateRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryValidatorConsumerCommissionRateRequest proto.InternalMessageInfo +// Deprecated: Do not use. func (m *QueryValidatorConsumerCommissionRateRequest) GetChainId() string { if m != nil { return m.ChainId @@ -1616,6 +1744,13 @@ func (m *QueryValidatorConsumerCommissionRateRequest) GetProviderAddress() strin return "" } +func (m *QueryValidatorConsumerCommissionRateRequest) GetConsumerId() string { + if m != nil { + return m.ConsumerId + } + return "" +} + type QueryValidatorConsumerCommissionRateResponse struct { // The rate to charge delegators on the consumer chain, as a fraction Rate cosmossdk_io_math.LegacyDec `protobuf:"bytes,1,opt,name=rate,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"rate"` @@ -1739,6 +1874,97 @@ func (m *QueryBlocksUntilNextEpochResponse) GetBlocksUntilNextEpoch() uint64 { return 0 } +type QueryConsumerIdFromClientIdRequest struct { + // the client id (on the provider) that is tracking the consumer chain + // the client id can be found from the consumer chain by querying (i.e., `query ccvconsumer provider-info`) + ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` +} + +func (m *QueryConsumerIdFromClientIdRequest) Reset() { *m = QueryConsumerIdFromClientIdRequest{} } +func (m *QueryConsumerIdFromClientIdRequest) String() string { return proto.CompactTextString(m) } +func (*QueryConsumerIdFromClientIdRequest) ProtoMessage() {} +func (*QueryConsumerIdFromClientIdRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_422512d7b7586cd7, []int{36} +} +func (m *QueryConsumerIdFromClientIdRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryConsumerIdFromClientIdRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryConsumerIdFromClientIdRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryConsumerIdFromClientIdRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryConsumerIdFromClientIdRequest.Merge(m, src) +} +func (m *QueryConsumerIdFromClientIdRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryConsumerIdFromClientIdRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryConsumerIdFromClientIdRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryConsumerIdFromClientIdRequest proto.InternalMessageInfo + +func (m *QueryConsumerIdFromClientIdRequest) GetClientId() string { + if m != nil { + return m.ClientId + } + return "" +} + +type QueryConsumerIdFromClientIdResponse struct { + // the consumer id of the chain associated with this client id + ConsumerId string `protobuf:"bytes,1,opt,name=consumer_id,json=consumerId,proto3" json:"consumer_id,omitempty"` +} + +func (m *QueryConsumerIdFromClientIdResponse) Reset() { *m = QueryConsumerIdFromClientIdResponse{} } +func (m *QueryConsumerIdFromClientIdResponse) String() string { return proto.CompactTextString(m) } +func (*QueryConsumerIdFromClientIdResponse) ProtoMessage() {} +func (*QueryConsumerIdFromClientIdResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_422512d7b7586cd7, []int{37} +} +func (m *QueryConsumerIdFromClientIdResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryConsumerIdFromClientIdResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryConsumerIdFromClientIdResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryConsumerIdFromClientIdResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryConsumerIdFromClientIdResponse.Merge(m, src) +} +func (m *QueryConsumerIdFromClientIdResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryConsumerIdFromClientIdResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryConsumerIdFromClientIdResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryConsumerIdFromClientIdResponse proto.InternalMessageInfo + +func (m *QueryConsumerIdFromClientIdResponse) GetConsumerId() string { + if m != nil { + return m.ConsumerId + } + return "" +} + func init() { proto.RegisterType((*QueryConsumerGenesisRequest)(nil), "interchain_security.ccv.provider.v1.QueryConsumerGenesisRequest") proto.RegisterType((*QueryConsumerGenesisResponse)(nil), "interchain_security.ccv.provider.v1.QueryConsumerGenesisResponse") @@ -1776,6 +2002,8 @@ func init() { proto.RegisterType((*QueryValidatorConsumerCommissionRateResponse)(nil), "interchain_security.ccv.provider.v1.QueryValidatorConsumerCommissionRateResponse") proto.RegisterType((*QueryBlocksUntilNextEpochRequest)(nil), "interchain_security.ccv.provider.v1.QueryBlocksUntilNextEpochRequest") proto.RegisterType((*QueryBlocksUntilNextEpochResponse)(nil), "interchain_security.ccv.provider.v1.QueryBlocksUntilNextEpochResponse") + proto.RegisterType((*QueryConsumerIdFromClientIdRequest)(nil), "interchain_security.ccv.provider.v1.QueryConsumerIdFromClientIdRequest") + proto.RegisterType((*QueryConsumerIdFromClientIdResponse)(nil), "interchain_security.ccv.provider.v1.QueryConsumerIdFromClientIdResponse") } func init() { @@ -1783,133 +2011,159 @@ func init() { } var fileDescriptor_422512d7b7586cd7 = []byte{ - // 2002 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x59, 0xcd, 0x6f, 0xdc, 0xc6, - 0x15, 0x17, 0x57, 0x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 0x3e, - 0x84, 0xbf, 0x29, 0x81, 0xaf, 0xe7, 0x61, 0x62, 0x70, 0x67, 0x84, 0xc6, 0x24, 0x93, 0x5d, 0xca, - 0x1f, 0x1c, 0x21, 0xa2, 0x88, 0xd4, 0x23, 0x1e, 0xa9, 0x87, 0xf0, 0x7b, 0x45, 0x22, 0x15, 0x43, - 0x19, 0x01, 0x63, 0x4c, 0x64, 0x55, 0x56, 0xbc, 0xfe, 0xd5, 0xd9, 0x06, 0x27, 0x4e, 0xdc, 0xe6, - 0x28, 0xef, 0x10, 0x51, 0x54, 0xb6, 0x46, 0x03, 0x19, 0xa1, 0xef, 0xcf, 0x3e, 0x59, 0xff, 0x94, - 0xc4, 0x9f, 0x07, 0x59, 0xec, 0x18, 0x16, 0x78, 0x7a, 0xe9, 0xc3, 0xc0, 0xe5, 0x1b, 0xa3, 0xc2, - 0x14, 0xef, 0x00, 0x7b, 0x90, 0xf9, 0xea, 0x77, 0x3f, 0x7b, 0x51, 0x96, 0x3e, 0x7f, 0x51, 0x96, - 0xfe, 0xfa, 0xa2, 0x2c, 0x7d, 0xf2, 0xb2, 0x3c, 0xf6, 0xf9, 0xcb, 0xf2, 0xd8, 0x9f, 0x5e, 0x96, - 0xc7, 0x1e, 0x5e, 0xab, 0xdb, 0x6c, 0xff, 0x70, 0x4f, 0x35, 0x49, 0x43, 0xfc, 0xa1, 0x9d, 0x58, - 0xe5, 0xdb, 0xf1, 0x2a, 0xcd, 0x4b, 0xda, 0xd3, 0x8e, 0x8e, 0xac, 0xe5, 0x61, 0xba, 0x37, 0xc9, - 0xff, 0xc9, 0xb8, 0xf8, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe2, 0x36, 0xa0, 0x9e, 0x70, 0x20, - 0x00, 0x00, + // 2427 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x5a, 0x4d, 0x6c, 0x1c, 0x49, + 0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e, 0x8a, 0x43, 0x36, 0x36, 0xef, 0xc2, 0x79, 0x00, 0x6b, 0x9a, 0x21, 0x99, 0xf8, + 0x91, 0x13, 0xdf, 0x86, 0xe4, 0x4a, 0x0c, 0xcd, 0x71, 0x85, 0x41, 0x71, 0xa2, 0xa6, 0x19, 0xeb, + 0xce, 0x44, 0xc5, 0xd8, 0x74, 0x64, 0x17, 0xc0, 0x64, 0x43, 0xd6, 0x35, 0x55, 0xb6, 0xb1, 0x45, + 0xd8, 0x12, 0x45, 0x36, 0xb3, 0xc3, 0x14, 0x0f, 0x06, 0x73, 0x74, 0x51, 0x59, 0x36, 0xe1, 0x3c, + 0x78, 0xcd, 0x1f, 0x95, 0x08, 0xb2, 0xa9, 0xf8, 0x08, 0x15, 0x3f, 0xe6, 0x4f, 0x6c, 0x20, 0xdb, + 0x91, 0x9d, 0x01, 0x63, 0xb2, 0xae, 0xe3, 0x47, 0xba, 0x46, 0xec, 0xec, 0x91, 0xb9, 0xc1, 0xc2, + 0x98, 0x18, 0x0c, 0xc0, 0x1c, 0x18, 0x55, 0x91, 0xd1, 0xa4, 0x93, 0xa3, 0x74, 0xd2, 0xff, 0xe6, + 0x7f, 0xc5, 0x81, 0x33, 0xf4, 0x8c, 0x1e, 0x78, 0x90, 0xa1, 0x20, 0xb0, 0x52, 0xde, 0xf3, 0x6b, + 0xe0, 0x55, 0xef, 0x48, 0x24, 0x59, 0x55, 0x2d, 0x44, 0x88, 0xeb, 0xc1, 0x12, 0xfc, 0xf2, 0x79, + 0x7e, 0xa2, 0x29, 0xd7, 0xf4, 0xab, 0x3c, 0x9b, 0xe0, 0xc5, 0x63, 0x9e, 0xec, 0xb2, 0x3b, 0x12, + 0x4f, 0x13, 0x83, 0xf1, 0x34, 0x71, 0x75, 0xf4, 0x83, 0x8f, 0xf2, 0x03, 0x7f, 0xff, 0x28, 0x3f, + 0xc0, 0xdf, 0x03, 0xfc, 0x41, 0xda, 0xb2, 0x60, 0xba, 0x00, 0x5e, 0xf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 0xe0, 0x1a, 0xfb, 0x27, 0xad, 0xd0, 0x2e, 0x97, 0xfd, 0x5d, 0x1a, 0x6f, 0x08, + 0x8f, 0x63, 0x65, 0x7a, 0xd3, 0x44, 0x64, 0x67, 0x84, 0xfe, 0x10, 0xfe, 0xfa, 0xff, 0x02, 0x00, + 0x00, 0xff, 0xff, 0x69, 0x3e, 0x82, 0x9f, 0x44, 0x27, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1970,6 +2224,9 @@ type QueryClient interface { // QueryBlocksUntilNextEpoch returns the number of blocks until the next epoch // starts and validator updates are sent to the consumer chains QueryBlocksUntilNextEpoch(ctx context.Context, in *QueryBlocksUntilNextEpochRequest, opts ...grpc.CallOption) (*QueryBlocksUntilNextEpochResponse, error) + // QueryConsumerIdFromClientId returns the consumer id of the chain + // associated with the provided client id + QueryConsumerIdFromClientId(ctx context.Context, in *QueryConsumerIdFromClientIdRequest, opts ...grpc.CallOption) (*QueryConsumerIdFromClientIdResponse, error) } type queryClient struct { @@ -2124,6 +2381,15 @@ func (c *queryClient) QueryBlocksUntilNextEpoch(ctx context.Context, in *QueryBl return out, nil } +func (c *queryClient) QueryConsumerIdFromClientId(ctx context.Context, in *QueryConsumerIdFromClientIdRequest, opts ...grpc.CallOption) (*QueryConsumerIdFromClientIdResponse, error) { + out := new(QueryConsumerIdFromClientIdResponse) + err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryConsumerIdFromClientId", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // ConsumerGenesis queries the genesis state needed to start a consumer chain @@ -2172,6 +2438,9 @@ type QueryServer interface { // QueryBlocksUntilNextEpoch returns the number of blocks until the next epoch // starts and validator updates are sent to the consumer chains QueryBlocksUntilNextEpoch(context.Context, *QueryBlocksUntilNextEpochRequest) (*QueryBlocksUntilNextEpochResponse, error) + // QueryConsumerIdFromClientId returns the consumer id of the chain + // associated with the provided client id + QueryConsumerIdFromClientId(context.Context, *QueryConsumerIdFromClientIdRequest) (*QueryConsumerIdFromClientIdResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -2226,6 +2495,9 @@ func (*UnimplementedQueryServer) QueryConsumerValidators(ctx context.Context, re func (*UnimplementedQueryServer) QueryBlocksUntilNextEpoch(ctx context.Context, req *QueryBlocksUntilNextEpochRequest) (*QueryBlocksUntilNextEpochResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method QueryBlocksUntilNextEpoch not implemented") } +func (*UnimplementedQueryServer) QueryConsumerIdFromClientId(ctx context.Context, req *QueryConsumerIdFromClientIdRequest) (*QueryConsumerIdFromClientIdResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryConsumerIdFromClientId not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -2519,6 +2791,24 @@ func _Query_QueryBlocksUntilNextEpoch_Handler(srv interface{}, ctx context.Conte return interceptor(ctx, in, info, handler) } +func _Query_QueryConsumerIdFromClientId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryConsumerIdFromClientIdRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).QueryConsumerIdFromClientId(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryConsumerIdFromClientId", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryConsumerIdFromClientId(ctx, req.(*QueryConsumerIdFromClientIdRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "interchain_security.ccv.provider.v1.Query", HandlerType: (*QueryServer)(nil), @@ -2587,6 +2877,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "QueryBlocksUntilNextEpoch", Handler: _Query_QueryBlocksUntilNextEpoch_Handler, }, + { + MethodName: "QueryConsumerIdFromClientId", + Handler: _Query_QueryConsumerIdFromClientId_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "interchain_security/ccv/provider/v1/query.proto", @@ -2612,6 +2906,13 @@ func (m *QueryConsumerGenesisRequest) MarshalToSizedBuffer(dAtA []byte) (int, er _ = i var l int _ = l + if len(m.ConsumerId) > 0 { + i -= len(m.ConsumerId) + copy(dAtA[i:], m.ConsumerId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ConsumerId))) + i-- + dAtA[i] = 0x12 + } if len(m.ChainId) > 0 { i -= len(m.ChainId) copy(dAtA[i:], m.ChainId) @@ -2926,6 +3227,13 @@ func (m *QueryValidatorConsumerAddrRequest) MarshalToSizedBuffer(dAtA []byte) (i _ = i var l int _ = l + if len(m.ConsumerId) > 0 { + i -= len(m.ConsumerId) + copy(dAtA[i:], m.ConsumerId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ConsumerId))) + i-- + dAtA[i] = 0x1a + } if len(m.ProviderAddress) > 0 { i -= len(m.ProviderAddress) copy(dAtA[i:], m.ProviderAddress) @@ -2993,6 +3301,13 @@ func (m *QueryValidatorProviderAddrRequest) MarshalToSizedBuffer(dAtA []byte) (i _ = i var l int _ = l + if len(m.ConsumerId) > 0 { + i -= len(m.ConsumerId) + copy(dAtA[i:], m.ConsumerId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ConsumerId))) + i-- + dAtA[i] = 0x1a + } if len(m.ConsumerAddress) > 0 { i -= len(m.ConsumerAddress) copy(dAtA[i:], m.ConsumerAddress) @@ -3239,6 +3554,13 @@ func (m *ProposedChain) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.ConsumerId) > 0 { + i -= len(m.ConsumerId) + copy(dAtA[i:], m.ConsumerId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ConsumerId))) + i-- + dAtA[i] = 0x1a + } if m.ProposalID != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.ProposalID)) i-- @@ -3274,6 +3596,13 @@ func (m *QueryAllPairsValConAddrByConsumerChainIDRequest) MarshalToSizedBuffer(d _ = i var l int _ = l + if len(m.ConsumerId) > 0 { + i -= len(m.ConsumerId) + copy(dAtA[i:], m.ConsumerId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ConsumerId))) + i-- + dAtA[i] = 0x12 + } if len(m.ChainId) > 0 { i -= len(m.ChainId) copy(dAtA[i:], m.ChainId) @@ -3446,6 +3775,13 @@ func (m *QueryConsumerChainOptedInValidatorsRequest) MarshalToSizedBuffer(dAtA [ _ = i var l int _ = l + if len(m.ConsumerId) > 0 { + i -= len(m.ConsumerId) + copy(dAtA[i:], m.ConsumerId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ConsumerId))) + i-- + dAtA[i] = 0x12 + } if len(m.ChainId) > 0 { i -= len(m.ChainId) copy(dAtA[i:], m.ChainId) @@ -3508,6 +3844,13 @@ func (m *QueryConsumerValidatorsRequest) MarshalToSizedBuffer(dAtA []byte) (int, _ = i var l int _ = l + if len(m.ConsumerId) > 0 { + i -= len(m.ConsumerId) + copy(dAtA[i:], m.ConsumerId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ConsumerId))) + i-- + dAtA[i] = 0x12 + } if len(m.ChainId) > 0 { i -= len(m.ChainId) copy(dAtA[i:], m.ChainId) @@ -3538,6 +3881,88 @@ func (m *QueryConsumerValidatorsValidator) MarshalToSizedBuffer(dAtA []byte) (in _ = i var l int _ = l + if m.ValidatesCurrentEpoch { + i-- + if m.ValidatesCurrentEpoch { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x70 + } + if m.ProviderPower != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ProviderPower)) + i-- + dAtA[i] = 0x68 + } + { + size := m.ProviderTokens.Size() + i -= size + if _, err := m.ProviderTokens.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x62 + if m.Status != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x58 + } + if m.Jailed { + i-- + if m.Jailed { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x50 + } + if len(m.ProviderOperatorAddress) > 0 { + i -= len(m.ProviderOperatorAddress) + copy(dAtA[i:], m.ProviderOperatorAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ProviderOperatorAddress))) + i-- + dAtA[i] = 0x4a + } + { + size, err := m.Description.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + { + size := m.ProviderCommissionRate.Size() + i -= size + if _, err := m.ProviderCommissionRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + { + size := m.ConsumerCommissionRate.Size() + i -= size + if _, err := m.ConsumerCommissionRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + if m.ConsumerPower != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ConsumerPower)) + i-- + dAtA[i] = 0x28 + } { size := m.Rate.Size() i -= size @@ -3694,6 +4119,13 @@ func (m *QueryValidatorConsumerCommissionRateRequest) MarshalToSizedBuffer(dAtA _ = i var l int _ = l + if len(m.ConsumerId) > 0 { + i -= len(m.ConsumerId) + copy(dAtA[i:], m.ConsumerId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ConsumerId))) + i-- + dAtA[i] = 0x1a + } if len(m.ProviderAddress) > 0 { i -= len(m.ProviderAddress) copy(dAtA[i:], m.ProviderAddress) @@ -3795,42 +4227,106 @@ func (m *QueryBlocksUntilNextEpochResponse) MarshalToSizedBuffer(dAtA []byte) (i return len(dAtA) - i, nil } -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *QueryConsumerIdFromClientIdRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *QueryConsumerGenesisRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n + +func (m *QueryConsumerIdFromClientIdRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryConsumerGenesisResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryConsumerIdFromClientIdRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = m.GenesisState.Size() - n += 1 + l + sovQuery(uint64(l)) - return n + if len(m.ClientId) > 0 { + i -= len(m.ClientId) + copy(dAtA[i:], m.ClientId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ClientId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } -func (m *QueryConsumerChainsRequest) Size() (n int) { +func (m *QueryConsumerIdFromClientIdResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryConsumerIdFromClientIdResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryConsumerIdFromClientIdResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ConsumerId) > 0 { + i -= len(m.ConsumerId) + copy(dAtA[i:], m.ConsumerId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ConsumerId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryConsumerGenesisRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ChainId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.ConsumerId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryConsumerGenesisResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.GenesisState.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryConsumerChainsRequest) Size() (n int) { if m == nil { return 0 } @@ -3953,6 +4449,10 @@ func (m *QueryValidatorConsumerAddrRequest) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } + l = len(m.ConsumerId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } return n } @@ -3983,6 +4483,10 @@ func (m *QueryValidatorProviderAddrRequest) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } + l = len(m.ConsumerId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } return n } @@ -4086,6 +4590,10 @@ func (m *ProposedChain) Size() (n int) { if m.ProposalID != 0 { n += 1 + sovQuery(uint64(m.ProposalID)) } + l = len(m.ConsumerId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } return n } @@ -4099,6 +4607,10 @@ func (m *QueryAllPairsValConAddrByConsumerChainIDRequest) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } + l = len(m.ConsumerId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } return n } @@ -4168,6 +4680,10 @@ func (m *QueryConsumerChainOptedInValidatorsRequest) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } + l = len(m.ConsumerId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } return n } @@ -4196,6 +4712,10 @@ func (m *QueryConsumerValidatorsRequest) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } + l = len(m.ConsumerId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } return n } @@ -4218,6 +4738,33 @@ func (m *QueryConsumerValidatorsValidator) Size() (n int) { } l = m.Rate.Size() n += 1 + l + sovQuery(uint64(l)) + if m.ConsumerPower != 0 { + n += 1 + sovQuery(uint64(m.ConsumerPower)) + } + l = m.ConsumerCommissionRate.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.ProviderCommissionRate.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.Description.Size() + n += 1 + l + sovQuery(uint64(l)) + l = len(m.ProviderOperatorAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Jailed { + n += 2 + } + if m.Status != 0 { + n += 1 + sovQuery(uint64(m.Status)) + } + l = m.ProviderTokens.Size() + n += 1 + l + sovQuery(uint64(l)) + if m.ProviderPower != 0 { + n += 1 + sovQuery(uint64(m.ProviderPower)) + } + if m.ValidatesCurrentEpoch { + n += 2 + } return n } @@ -4278,6 +4825,10 @@ func (m *QueryValidatorConsumerCommissionRateRequest) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } + l = len(m.ConsumerId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } return n } @@ -4313,6 +4864,32 @@ func (m *QueryBlocksUntilNextEpochResponse) Size() (n int) { return n } +func (m *QueryConsumerIdFromClientIdRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ClientId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryConsumerIdFromClientIdResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ConsumerId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -4380,6 +4957,38 @@ func (m *QueryConsumerGenesisRequest) Unmarshal(dAtA []byte) error { } m.ChainId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConsumerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -5237,6 +5846,38 @@ func (m *QueryValidatorConsumerAddrRequest) Unmarshal(dAtA []byte) error { } m.ProviderAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConsumerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -5433,6 +6074,38 @@ func (m *QueryValidatorProviderAddrRequest) Unmarshal(dAtA []byte) error { } m.ConsumerAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConsumerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -6053,6 +6726,38 @@ func (m *ProposedChain) Unmarshal(dAtA []byte) error { break } } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConsumerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -6135,23 +6840,55 @@ func (m *QueryAllPairsValConAddrByConsumerChainIDRequest) Unmarshal(dAtA []byte) } m.ChainId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerId", wireType) } - iNdEx += skippy - } - } - - if iNdEx > l { + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConsumerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { return io.ErrUnexpectedEOF } return nil @@ -6584,6 +7321,38 @@ func (m *QueryConsumerChainOptedInValidatorsRequest) Unmarshal(dAtA []byte) erro } m.ChainId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConsumerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -6748,6 +7517,38 @@ func (m *QueryConsumerValidatorsRequest) Unmarshal(dAtA []byte) error { } m.ChainId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConsumerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -6919,61 +7720,30 @@ func (m *QueryConsumerValidatorsValidator) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryConsumerValidatorsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerPower", wireType) } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break + m.ConsumerPower = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ConsumerPower |= int64(b&0x7F) << shift + if b < 0x80 { + break + } } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryConsumerValidatorsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryConsumerValidatorsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Validators", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerCommissionRate", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -6983,79 +7753,29 @@ func (m *QueryConsumerValidatorsResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Validators = append(m.Validators, &QueryConsumerValidatorsValidator{}) - if err := m.Validators[len(m.Validators)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.ConsumerCommissionRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryConsumerChainsValidatorHasToValidateRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryConsumerChainsValidatorHasToValidateRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryConsumerChainsValidatorHasToValidateRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + case 7: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProviderAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ProviderCommissionRate", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -7083,29 +7803,374 @@ func (m *QueryConsumerChainsValidatorHasToValidateRequest) Unmarshal(dAtA []byte if postIndex > l { return io.ErrUnexpectedEOF } - m.ProviderAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { + if err := m.ProviderCommissionRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Description.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProviderOperatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ProviderOperatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Jailed", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Jailed = bool(v != 0) + case 11: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= types1.BondStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProviderTokens", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ProviderTokens.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 13: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProviderPower", wireType) + } + m.ProviderPower = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProviderPower |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 14: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatesCurrentEpoch", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.ValidatesCurrentEpoch = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryConsumerValidatorsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryConsumerValidatorsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryConsumerValidatorsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Validators", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Validators = append(m.Validators, &QueryConsumerValidatorsValidator{}) + if err := m.Validators[len(m.Validators)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryConsumerChainsValidatorHasToValidateRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryConsumerChainsValidatorHasToValidateRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryConsumerChainsValidatorHasToValidateRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProviderAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ProviderAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *QueryConsumerChainsValidatorHasToValidateResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -7281,6 +8346,38 @@ func (m *QueryValidatorConsumerCommissionRateRequest) Unmarshal(dAtA []byte) err } m.ProviderAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConsumerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -7505,6 +8602,170 @@ func (m *QueryBlocksUntilNextEpochResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryConsumerIdFromClientIdRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryConsumerIdFromClientIdRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryConsumerIdFromClientIdRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClientId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClientId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryConsumerIdFromClientIdResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryConsumerIdFromClientIdResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryConsumerIdFromClientIdResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConsumerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/ccv/provider/types/query.pb.gw.go b/x/ccv/provider/types/query.pb.gw.go index a115ace156..a533712da9 100644 --- a/x/ccv/provider/types/query.pb.gw.go +++ b/x/ccv/provider/types/query.pb.gw.go @@ -33,6 +33,10 @@ var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage var _ = metadata.Join +var ( + filter_Query_QueryConsumerGenesis_0 = &utilities.DoubleArray{Encoding: map[string]int{"chain_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + func request_Query_QueryConsumerGenesis_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryConsumerGenesisRequest var metadata runtime.ServerMetadata @@ -55,6 +59,13 @@ func request_Query_QueryConsumerGenesis_0(ctx context.Context, marshaler runtime return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryConsumerGenesis_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := client.QueryConsumerGenesis(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err @@ -82,6 +93,85 @@ func local_request_Query_QueryConsumerGenesis_0(ctx context.Context, marshaler r return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryConsumerGenesis_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.QueryConsumerGenesis(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_QueryConsumerGenesis_1 = &utilities.DoubleArray{Encoding: map[string]int{"consumer_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_QueryConsumerGenesis_1(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryConsumerGenesisRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["consumer_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "consumer_id") + } + + protoReq.ConsumerId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "consumer_id", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryConsumerGenesis_1); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.QueryConsumerGenesis(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QueryConsumerGenesis_1(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryConsumerGenesisRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["consumer_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "consumer_id") + } + + protoReq.ConsumerId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "consumer_id", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryConsumerGenesis_1); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.QueryConsumerGenesis(ctx, &protoReq) return msg, metadata, err @@ -268,13 +358,31 @@ func local_request_Query_QueryProposedConsumerChainIDs_0(ctx context.Context, ma } var ( - filter_Query_QueryAllPairsValConAddrByConsumerChainID_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + filter_Query_QueryAllPairsValConAddrByConsumerChainID_0 = &utilities.DoubleArray{Encoding: map[string]int{"chain_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_Query_QueryAllPairsValConAddrByConsumerChainID_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryAllPairsValConAddrByConsumerChainIDRequest var metadata runtime.ServerMetadata + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["chain_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") + } + + protoReq.ChainId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) + } + if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -291,6 +399,24 @@ func local_request_Query_QueryAllPairsValConAddrByConsumerChainID_0(ctx context. var protoReq QueryAllPairsValConAddrByConsumerChainIDRequest var metadata runtime.ServerMetadata + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["chain_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") + } + + protoReq.ChainId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) + } + if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -303,6 +429,78 @@ func local_request_Query_QueryAllPairsValConAddrByConsumerChainID_0(ctx context. } +var ( + filter_Query_QueryAllPairsValConAddrByConsumerChainID_1 = &utilities.DoubleArray{Encoding: map[string]int{"consumer_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_QueryAllPairsValConAddrByConsumerChainID_1(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllPairsValConAddrByConsumerChainIDRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["consumer_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "consumer_id") + } + + protoReq.ConsumerId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "consumer_id", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryAllPairsValConAddrByConsumerChainID_1); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.QueryAllPairsValConAddrByConsumerChainID(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QueryAllPairsValConAddrByConsumerChainID_1(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllPairsValConAddrByConsumerChainIDRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["consumer_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "consumer_id") + } + + protoReq.ConsumerId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "consumer_id", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryAllPairsValConAddrByConsumerChainID_1); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.QueryAllPairsValConAddrByConsumerChainID(ctx, &protoReq) + return msg, metadata, err + +} + func request_Query_QueryParams_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryParamsRequest var metadata runtime.ServerMetadata @@ -321,6 +519,10 @@ func local_request_Query_QueryParams_0(ctx context.Context, marshaler runtime.Ma } +var ( + filter_Query_QueryConsumerChainOptedInValidators_0 = &utilities.DoubleArray{Encoding: map[string]int{"chain_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + func request_Query_QueryConsumerChainOptedInValidators_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryConsumerChainOptedInValidatorsRequest var metadata runtime.ServerMetadata @@ -343,6 +545,13 @@ func request_Query_QueryConsumerChainOptedInValidators_0(ctx context.Context, ma return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryConsumerChainOptedInValidators_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := client.QueryConsumerChainOptedInValidators(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err @@ -370,6 +579,85 @@ func local_request_Query_QueryConsumerChainOptedInValidators_0(ctx context.Conte return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryConsumerChainOptedInValidators_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.QueryConsumerChainOptedInValidators(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_QueryConsumerChainOptedInValidators_1 = &utilities.DoubleArray{Encoding: map[string]int{"consumer_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_QueryConsumerChainOptedInValidators_1(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryConsumerChainOptedInValidatorsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["consumer_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "consumer_id") + } + + protoReq.ConsumerId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "consumer_id", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryConsumerChainOptedInValidators_1); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.QueryConsumerChainOptedInValidators(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QueryConsumerChainOptedInValidators_1(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryConsumerChainOptedInValidatorsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["consumer_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "consumer_id") + } + + protoReq.ConsumerId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "consumer_id", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryConsumerChainOptedInValidators_1); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.QueryConsumerChainOptedInValidators(ctx, &protoReq) return msg, metadata, err @@ -429,6 +717,10 @@ func local_request_Query_QueryConsumerChainsValidatorHasToValidate_0(ctx context } +var ( + filter_Query_QueryValidatorConsumerCommissionRate_0 = &utilities.DoubleArray{Encoding: map[string]int{"chain_id": 0, "provider_address": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} +) + func request_Query_QueryValidatorConsumerCommissionRate_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryValidatorConsumerCommissionRateRequest var metadata runtime.ServerMetadata @@ -462,6 +754,13 @@ func request_Query_QueryValidatorConsumerCommissionRate_0(ctx context.Context, m return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "provider_address", err) } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryValidatorConsumerCommissionRate_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := client.QueryValidatorConsumerCommissionRate(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err @@ -500,11 +799,116 @@ func local_request_Query_QueryValidatorConsumerCommissionRate_0(ctx context.Cont return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "provider_address", err) } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryValidatorConsumerCommissionRate_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.QueryValidatorConsumerCommissionRate(ctx, &protoReq) return msg, metadata, err } +var ( + filter_Query_QueryValidatorConsumerCommissionRate_1 = &utilities.DoubleArray{Encoding: map[string]int{"consumer_id": 0, "provider_address": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} +) + +func request_Query_QueryValidatorConsumerCommissionRate_1(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryValidatorConsumerCommissionRateRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["consumer_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "consumer_id") + } + + protoReq.ConsumerId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "consumer_id", err) + } + + val, ok = pathParams["provider_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "provider_address") + } + + protoReq.ProviderAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "provider_address", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryValidatorConsumerCommissionRate_1); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.QueryValidatorConsumerCommissionRate(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QueryValidatorConsumerCommissionRate_1(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryValidatorConsumerCommissionRateRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["consumer_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "consumer_id") + } + + protoReq.ConsumerId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "consumer_id", err) + } + + val, ok = pathParams["provider_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "provider_address") + } + + protoReq.ProviderAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "provider_address", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryValidatorConsumerCommissionRate_1); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.QueryValidatorConsumerCommissionRate(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_QueryConsumerValidators_0 = &utilities.DoubleArray{Encoding: map[string]int{"chain_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + func request_Query_QueryConsumerValidators_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryConsumerValidatorsRequest var metadata runtime.ServerMetadata @@ -527,6 +931,13 @@ func request_Query_QueryConsumerValidators_0(ctx context.Context, marshaler runt return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryConsumerValidators_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := client.QueryConsumerValidators(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err @@ -551,28 +962,161 @@ func local_request_Query_QueryConsumerValidators_0(ctx context.Context, marshale protoReq.ChainId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryConsumerValidators_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.QueryConsumerValidators(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_QueryConsumerValidators_1 = &utilities.DoubleArray{Encoding: map[string]int{"consumer_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_QueryConsumerValidators_1(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryConsumerValidatorsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["consumer_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "consumer_id") + } + + protoReq.ConsumerId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "consumer_id", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryConsumerValidators_1); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.QueryConsumerValidators(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QueryConsumerValidators_1(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryConsumerValidatorsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["consumer_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "consumer_id") + } + + protoReq.ConsumerId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "consumer_id", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryConsumerValidators_1); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.QueryConsumerValidators(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_QueryBlocksUntilNextEpoch_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBlocksUntilNextEpochRequest + var metadata runtime.ServerMetadata + + msg, err := client.QueryBlocksUntilNextEpoch(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QueryBlocksUntilNextEpoch_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBlocksUntilNextEpochRequest + var metadata runtime.ServerMetadata + + msg, err := server.QueryBlocksUntilNextEpoch(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_QueryConsumerIdFromClientId_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryConsumerIdFromClientIdRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["client_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "client_id") + } + + protoReq.ClientId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "client_id", err) } - msg, err := server.QueryConsumerValidators(ctx, &protoReq) + msg, err := client.QueryConsumerIdFromClientId(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func request_Query_QueryBlocksUntilNextEpoch_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryBlocksUntilNextEpochRequest +func local_request_Query_QueryConsumerIdFromClientId_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryConsumerIdFromClientIdRequest var metadata runtime.ServerMetadata - msg, err := client.QueryBlocksUntilNextEpoch(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err + var ( + val string + ok bool + err error + _ = err + ) -} + val, ok = pathParams["client_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "client_id") + } -func local_request_Query_QueryBlocksUntilNextEpoch_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryBlocksUntilNextEpochRequest - var metadata runtime.ServerMetadata + protoReq.ClientId, err = runtime.String(val) - msg, err := server.QueryBlocksUntilNextEpoch(ctx, &protoReq) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "client_id", err) + } + + msg, err := server.QueryConsumerIdFromClientId(ctx, &protoReq) return msg, metadata, err } @@ -606,6 +1150,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_QueryConsumerGenesis_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_QueryConsumerGenesis_1(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryConsumerGenesis_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_QueryConsumerChains_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -813,6 +1380,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_QueryAllPairsValConAddrByConsumerChainID_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_QueryAllPairsValConAddrByConsumerChainID_1(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryAllPairsValConAddrByConsumerChainID_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_QueryParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -859,6 +1449,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_QueryConsumerChainOptedInValidators_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_QueryConsumerChainOptedInValidators_1(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryConsumerChainOptedInValidators_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_QueryConsumerChainsValidatorHasToValidate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -905,6 +1518,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_QueryValidatorConsumerCommissionRate_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_QueryValidatorConsumerCommissionRate_1(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryValidatorConsumerCommissionRate_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_QueryConsumerValidators_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -928,6 +1564,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_QueryConsumerValidators_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_QueryConsumerValidators_1(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryConsumerValidators_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_QueryBlocksUntilNextEpoch_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -951,6 +1610,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_QueryConsumerIdFromClientId_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_QueryConsumerIdFromClientId_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryConsumerIdFromClientId_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -1012,6 +1694,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_QueryConsumerGenesis_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_QueryConsumerGenesis_1(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryConsumerGenesis_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_QueryConsumerChains_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1192,6 +1894,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_QueryAllPairsValConAddrByConsumerChainID_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_QueryAllPairsValConAddrByConsumerChainID_1(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryAllPairsValConAddrByConsumerChainID_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_QueryParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1232,6 +1954,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_QueryConsumerChainOptedInValidators_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_QueryConsumerChainOptedInValidators_1(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryConsumerChainOptedInValidators_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_QueryConsumerChainsValidatorHasToValidate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1272,6 +2014,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_QueryValidatorConsumerCommissionRate_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_QueryValidatorConsumerCommissionRate_1(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryValidatorConsumerCommissionRate_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_QueryConsumerValidators_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1292,6 +2054,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_QueryConsumerValidators_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_QueryConsumerValidators_1(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryConsumerValidators_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_QueryBlocksUntilNextEpoch_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1312,12 +2094,34 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_QueryConsumerIdFromClientId_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_QueryConsumerIdFromClientId_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryConsumerIdFromClientId_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } var ( pattern_Query_QueryConsumerGenesis_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"interchain_security", "ccv", "provider", "consumer_genesis", "chain_id"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_QueryConsumerGenesis_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"interchain_security", "ccv", "provider", "consumer_genesis", "consumer_id"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_QueryConsumerChains_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"interchain_security", "ccv", "provider", "consumer_chains"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_QueryConsumerChainStarts_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"interchain_security", "ccv", "provider", "consumer_chain_start_proposals"}, "", runtime.AssumeColonVerbOpt(false))) @@ -1334,24 +2138,36 @@ var ( pattern_Query_QueryProposedConsumerChainIDs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"interchain_security", "ccv", "provider", "proposed_consumer_chains"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_QueryAllPairsValConAddrByConsumerChainID_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"interchain_security", "ccv", "provider", "consumer_chain_id"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_QueryAllPairsValConAddrByConsumerChainID_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"interchain_security", "ccv", "provider", "chain_id"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_QueryAllPairsValConAddrByConsumerChainID_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"interchain_security", "ccv", "provider", "consumer_id"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_QueryParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"interchain_security", "ccv", "provider", "params"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_QueryConsumerChainOptedInValidators_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"interchain_security", "ccv", "provider", "opted_in_validators", "chain_id"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_QueryConsumerChainOptedInValidators_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"interchain_security", "ccv", "provider", "opted_in_validators", "consumer_id"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_QueryConsumerChainsValidatorHasToValidate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"interchain_security", "ccv", "provider", "consumer_chains_per_validator", "provider_address"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_QueryValidatorConsumerCommissionRate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"interchain_security", "ccv", "provider", "consumer_commission_rate", "chain_id", "provider_address"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_QueryValidatorConsumerCommissionRate_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"interchain_security", "ccv", "provider", "consumer_commission_rate", "consumer_id", "provider_address"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_QueryConsumerValidators_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"interchain_security", "ccv", "provider", "consumer_validators", "chain_id"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_QueryConsumerValidators_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"interchain_security", "ccv", "provider", "consumer_validators", "consumer_id"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_QueryBlocksUntilNextEpoch_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"interchain_security", "ccv", "provider", "blocks_until_next_epoch"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_QueryConsumerIdFromClientId_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"interchain_security", "ccv", "provider", "consumer_id", "client_id"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( forward_Query_QueryConsumerGenesis_0 = runtime.ForwardResponseMessage + forward_Query_QueryConsumerGenesis_1 = runtime.ForwardResponseMessage + forward_Query_QueryConsumerChains_0 = runtime.ForwardResponseMessage forward_Query_QueryConsumerChainStarts_0 = runtime.ForwardResponseMessage @@ -1370,15 +2186,25 @@ var ( forward_Query_QueryAllPairsValConAddrByConsumerChainID_0 = runtime.ForwardResponseMessage + forward_Query_QueryAllPairsValConAddrByConsumerChainID_1 = runtime.ForwardResponseMessage + forward_Query_QueryParams_0 = runtime.ForwardResponseMessage forward_Query_QueryConsumerChainOptedInValidators_0 = runtime.ForwardResponseMessage + forward_Query_QueryConsumerChainOptedInValidators_1 = runtime.ForwardResponseMessage + forward_Query_QueryConsumerChainsValidatorHasToValidate_0 = runtime.ForwardResponseMessage forward_Query_QueryValidatorConsumerCommissionRate_0 = runtime.ForwardResponseMessage + forward_Query_QueryValidatorConsumerCommissionRate_1 = runtime.ForwardResponseMessage + forward_Query_QueryConsumerValidators_0 = runtime.ForwardResponseMessage + forward_Query_QueryConsumerValidators_1 = runtime.ForwardResponseMessage + forward_Query_QueryBlocksUntilNextEpoch_0 = runtime.ForwardResponseMessage + + forward_Query_QueryConsumerIdFromClientId_0 = runtime.ForwardResponseMessage ) diff --git a/x/ccv/provider/types/throttle.go b/x/ccv/provider/types/throttle.go deleted file mode 100644 index e41396eb3a..0000000000 --- a/x/ccv/provider/types/throttle.go +++ /dev/null @@ -1,17 +0,0 @@ -package types - -import ( - "time" -) - -// NewGlobalSlashEntry creates a new GlobalSlashEntry. -func NewGlobalSlashEntry(recvTime time.Time, consumerChainID string, - ibcSeqNum uint64, providerValConsAddr ProviderConsAddress, -) GlobalSlashEntry { - return GlobalSlashEntry{ - RecvTime: recvTime.UTC(), // UTC prevents serialization inconsistencies - ConsumerChainID: consumerChainID, - IbcSeqNum: ibcSeqNum, - ProviderValConsAddr: providerValConsAddr.ToSdkConsAddr(), - } -} diff --git a/x/ccv/provider/types/tx.pb.go b/x/ccv/provider/types/tx.pb.go index 146475a32d..08e7c4c278 100644 --- a/x/ccv/provider/types/tx.pb.go +++ b/x/ccv/provider/types/tx.pb.go @@ -43,8 +43,8 @@ var _ = time.Kitchen const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type MsgAssignConsumerKey struct { - // The chain id of the consumer chain to assign a consensus public key to - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + // [DEPRECATED] use `consumer_id` instead + ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` // Deprecated: Do not use. // The validator address on the provider ProviderAddr string `protobuf:"bytes,2,opt,name=provider_addr,json=providerAddr,proto3" json:"provider_addr,omitempty" yaml:"address"` // The consensus public key to use on the consumer. @@ -53,6 +53,8 @@ type MsgAssignConsumerKey struct { ConsumerKey string `protobuf:"bytes,3,opt,name=consumer_key,json=consumerKey,proto3" json:"consumer_key,omitempty"` // Tx signer address Signer string `protobuf:"bytes,4,opt,name=signer,proto3" json:"signer,omitempty"` + // the consumer id of the consumer chain to assign a consensus public key to + ConsumerId string `protobuf:"bytes,5,opt,name=consumer_id,json=consumerId,proto3" json:"consumer_id,omitempty"` } func (m *MsgAssignConsumerKey) Reset() { *m = MsgAssignConsumerKey{} } @@ -131,6 +133,8 @@ type MsgSubmitConsumerMisbehaviour struct { // The Misbehaviour of the consumer chain wrapping // two conflicting IBC headers Misbehaviour *_07_tendermint.Misbehaviour `protobuf:"bytes,2,opt,name=misbehaviour,proto3" json:"misbehaviour,omitempty"` + // the consumer id of the consumer chain where the misbehaviour occurred + ConsumerId string `protobuf:"bytes,3,opt,name=consumer_id,json=consumerId,proto3" json:"consumer_id,omitempty"` } func (m *MsgSubmitConsumerMisbehaviour) Reset() { *m = MsgSubmitConsumerMisbehaviour{} } @@ -211,6 +215,8 @@ type MsgSubmitConsumerDoubleVoting struct { DuplicateVoteEvidence *types.DuplicateVoteEvidence `protobuf:"bytes,2,opt,name=duplicate_vote_evidence,json=duplicateVoteEvidence,proto3" json:"duplicate_vote_evidence,omitempty"` // The light client header of the infraction block InfractionBlockHeader *_07_tendermint.Header `protobuf:"bytes,3,opt,name=infraction_block_header,json=infractionBlockHeader,proto3" json:"infraction_block_header,omitempty"` + // the consumer id of the consumer chain where the double-voting took place + ConsumerId string `protobuf:"bytes,4,opt,name=consumer_id,json=consumerId,proto3" json:"consumer_id,omitempty"` } func (m *MsgSubmitConsumerDoubleVoting) Reset() { *m = MsgSubmitConsumerDoubleVoting{} } @@ -373,12 +379,7 @@ func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo -// MsgConsumerAddition defines the message used to spawn a new consumer chain using a v1 governance proposal. -// If it passes, then all validators on the provider chain are expected to validate -// the consumer chain at spawn time or get slashed. -// It is recommended that spawn time occurs after the proposal end time. -// -// Note: this replaces ConsumerAdditionProposal which is deprecated and will be removed soon +// [DEPRECATED] Use `MsgCreateConsumer` instead type MsgConsumerAddition struct { // the proposed chain-id of the new consumer chain, must be different from all // other consumer chain ids of the executing provider chain. @@ -663,12 +664,7 @@ func (m *MsgConsumerAdditionResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgConsumerAdditionResponse proto.InternalMessageInfo -// MsgConsumerRemoval message contains a governance proposal on the provider chain to -// remove (and stop) a consumer chain. If it passes, all the consumer chain's -// state is removed from the provider chain. The outstanding unbonding operation -// funds are released. -// -// Note: this replaces ConsumerRemovalProposal which is deprecated and will be removed soon +// [DEPRECATED] Use `MsgRemoveConsumer` instead type MsgConsumerRemoval struct { // the chain-id of the consumer chain to be stopped ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` @@ -770,6 +766,109 @@ func (m *MsgConsumerRemovalResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgConsumerRemovalResponse proto.InternalMessageInfo +// MsgRemoveConsumer defines the message used to remove (and stop) a consumer chain. +// If it passes, all the consumer chain's state is eventually removed from the provider chain. +type MsgRemoveConsumer struct { + // the consumer id of the consumer chain to be stopped + ConsumerId string `protobuf:"bytes,1,opt,name=consumer_id,json=consumerId,proto3" json:"consumer_id,omitempty"` + // the time on the provider chain at which all validators are responsible to + // stop their consumer chain validator node + StopTime time.Time `protobuf:"bytes,2,opt,name=stop_time,json=stopTime,proto3,stdtime" json:"stop_time"` + // signer address + Authority string `protobuf:"bytes,3,opt,name=authority,proto3" json:"authority,omitempty"` +} + +func (m *MsgRemoveConsumer) Reset() { *m = MsgRemoveConsumer{} } +func (m *MsgRemoveConsumer) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveConsumer) ProtoMessage() {} +func (*MsgRemoveConsumer) Descriptor() ([]byte, []int) { + return fileDescriptor_43221a4391e9fbf4, []int{12} +} +func (m *MsgRemoveConsumer) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRemoveConsumer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRemoveConsumer.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRemoveConsumer) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveConsumer.Merge(m, src) +} +func (m *MsgRemoveConsumer) XXX_Size() int { + return m.Size() +} +func (m *MsgRemoveConsumer) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveConsumer.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRemoveConsumer proto.InternalMessageInfo + +func (m *MsgRemoveConsumer) GetConsumerId() string { + if m != nil { + return m.ConsumerId + } + return "" +} + +func (m *MsgRemoveConsumer) GetStopTime() time.Time { + if m != nil { + return m.StopTime + } + return time.Time{} +} + +func (m *MsgRemoveConsumer) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +// MsgRemoveConsumerResponse defines response type for MsgRemoveConsumer messages +type MsgRemoveConsumerResponse struct { +} + +func (m *MsgRemoveConsumerResponse) Reset() { *m = MsgRemoveConsumerResponse{} } +func (m *MsgRemoveConsumerResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveConsumerResponse) ProtoMessage() {} +func (*MsgRemoveConsumerResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_43221a4391e9fbf4, []int{13} +} +func (m *MsgRemoveConsumerResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRemoveConsumerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRemoveConsumerResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRemoveConsumerResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveConsumerResponse.Merge(m, src) +} +func (m *MsgRemoveConsumerResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRemoveConsumerResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveConsumerResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRemoveConsumerResponse proto.InternalMessageInfo + // ChangeRewardDenomsProposal is a governance proposal on the provider chain to // mutate the set of denoms accepted by the provider as rewards. // @@ -787,7 +886,7 @@ func (m *MsgChangeRewardDenoms) Reset() { *m = MsgChangeRewardDenoms{} } func (m *MsgChangeRewardDenoms) String() string { return proto.CompactTextString(m) } func (*MsgChangeRewardDenoms) ProtoMessage() {} func (*MsgChangeRewardDenoms) Descriptor() ([]byte, []int) { - return fileDescriptor_43221a4391e9fbf4, []int{12} + return fileDescriptor_43221a4391e9fbf4, []int{14} } func (m *MsgChangeRewardDenoms) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -845,7 +944,7 @@ func (m *MsgChangeRewardDenomsResponse) Reset() { *m = MsgChangeRewardDe func (m *MsgChangeRewardDenomsResponse) String() string { return proto.CompactTextString(m) } func (*MsgChangeRewardDenomsResponse) ProtoMessage() {} func (*MsgChangeRewardDenomsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_43221a4391e9fbf4, []int{13} + return fileDescriptor_43221a4391e9fbf4, []int{15} } func (m *MsgChangeRewardDenomsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -875,8 +974,8 @@ func (m *MsgChangeRewardDenomsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgChangeRewardDenomsResponse proto.InternalMessageInfo type MsgOptIn struct { - // the chain id of the consumer chain to opt in to - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + // [DEPRECATED] use `consumer_id` instead + ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` // Deprecated: Do not use. // the validator address on the provider ProviderAddr string `protobuf:"bytes,2,opt,name=provider_addr,json=providerAddr,proto3" json:"provider_addr,omitempty" yaml:"address"` // (optional) The consensus public key to use on the consumer in json string format corresponding to proto-any, @@ -886,13 +985,15 @@ type MsgOptIn struct { ConsumerKey string `protobuf:"bytes,3,opt,name=consumer_key,json=consumerKey,proto3" json:"consumer_key,omitempty"` // signer address Signer string `protobuf:"bytes,4,opt,name=signer,proto3" json:"signer,omitempty"` + // the consumer id of the consumer chain to opt in to + ConsumerId string `protobuf:"bytes,5,opt,name=consumer_id,json=consumerId,proto3" json:"consumer_id,omitempty"` } func (m *MsgOptIn) Reset() { *m = MsgOptIn{} } func (m *MsgOptIn) String() string { return proto.CompactTextString(m) } func (*MsgOptIn) ProtoMessage() {} func (*MsgOptIn) Descriptor() ([]byte, []int) { - return fileDescriptor_43221a4391e9fbf4, []int{14} + return fileDescriptor_43221a4391e9fbf4, []int{16} } func (m *MsgOptIn) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -928,7 +1029,7 @@ func (m *MsgOptInResponse) Reset() { *m = MsgOptInResponse{} } func (m *MsgOptInResponse) String() string { return proto.CompactTextString(m) } func (*MsgOptInResponse) ProtoMessage() {} func (*MsgOptInResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_43221a4391e9fbf4, []int{15} + return fileDescriptor_43221a4391e9fbf4, []int{17} } func (m *MsgOptInResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -958,19 +1059,21 @@ func (m *MsgOptInResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgOptInResponse proto.InternalMessageInfo type MsgOptOut struct { - // the chain id of the consumer chain to opt out from - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + // [DEPRECATED] use `consumer_id` instead + ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` // Deprecated: Do not use. // the validator address on the provider ProviderAddr string `protobuf:"bytes,2,opt,name=provider_addr,json=providerAddr,proto3" json:"provider_addr,omitempty" yaml:"address"` // signer address Signer string `protobuf:"bytes,3,opt,name=signer,proto3" json:"signer,omitempty"` + // the consumer id of the consumer chain to opt out from + ConsumerId string `protobuf:"bytes,4,opt,name=consumer_id,json=consumerId,proto3" json:"consumer_id,omitempty"` } func (m *MsgOptOut) Reset() { *m = MsgOptOut{} } func (m *MsgOptOut) String() string { return proto.CompactTextString(m) } func (*MsgOptOut) ProtoMessage() {} func (*MsgOptOut) Descriptor() ([]byte, []int) { - return fileDescriptor_43221a4391e9fbf4, []int{16} + return fileDescriptor_43221a4391e9fbf4, []int{18} } func (m *MsgOptOut) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1006,7 +1109,7 @@ func (m *MsgOptOutResponse) Reset() { *m = MsgOptOutResponse{} } func (m *MsgOptOutResponse) String() string { return proto.CompactTextString(m) } func (*MsgOptOutResponse) ProtoMessage() {} func (*MsgOptOutResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_43221a4391e9fbf4, []int{17} + return fileDescriptor_43221a4391e9fbf4, []int{19} } func (m *MsgOptOutResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1040,20 +1143,22 @@ var xxx_messageInfo_MsgOptOutResponse proto.InternalMessageInfo type MsgSetConsumerCommissionRate struct { // The validator address on the provider ProviderAddr string `protobuf:"bytes,1,opt,name=provider_addr,json=providerAddr,proto3" json:"provider_addr,omitempty" yaml:"address"` - // The chain id of the consumer chain to set a commission rate - ChainId string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + // [DEPRECATED] use `consumer_id` instead + ChainId string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` // Deprecated: Do not use. // The rate to charge delegators on the consumer chain, as a fraction // TODO: migrate rate from sdk.Dec to math.LegacyDec Rate cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=rate,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"rate"` // signer address Signer string `protobuf:"bytes,4,opt,name=signer,proto3" json:"signer,omitempty"` + // the consumer id of the consumer chain to set the commission rate + ConsumerId string `protobuf:"bytes,5,opt,name=consumer_id,json=consumerId,proto3" json:"consumer_id,omitempty"` } func (m *MsgSetConsumerCommissionRate) Reset() { *m = MsgSetConsumerCommissionRate{} } func (m *MsgSetConsumerCommissionRate) String() string { return proto.CompactTextString(m) } func (*MsgSetConsumerCommissionRate) ProtoMessage() {} func (*MsgSetConsumerCommissionRate) Descriptor() ([]byte, []int) { - return fileDescriptor_43221a4391e9fbf4, []int{18} + return fileDescriptor_43221a4391e9fbf4, []int{20} } func (m *MsgSetConsumerCommissionRate) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1089,7 +1194,7 @@ func (m *MsgSetConsumerCommissionRateResponse) Reset() { *m = MsgSetCons func (m *MsgSetConsumerCommissionRateResponse) String() string { return proto.CompactTextString(m) } func (*MsgSetConsumerCommissionRateResponse) ProtoMessage() {} func (*MsgSetConsumerCommissionRateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_43221a4391e9fbf4, []int{19} + return fileDescriptor_43221a4391e9fbf4, []int{21} } func (m *MsgSetConsumerCommissionRateResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1118,11 +1223,7 @@ func (m *MsgSetConsumerCommissionRateResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgSetConsumerCommissionRateResponse proto.InternalMessageInfo -// MsgConsumerModification message contains a governance proposal on the provider chain to -// modify a running consumer chain. If it passes, the consumer chain's -// parameters are updated. -// -// Note: this replaces ConsumerModificationProposal which is deprecated and will be removed soon +// [DEPRECATED] Use `MsgUpdateConsumer` instead type MsgConsumerModification struct { // the title of the proposal Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` @@ -1161,7 +1262,7 @@ func (m *MsgConsumerModification) Reset() { *m = MsgConsumerModification func (m *MsgConsumerModification) String() string { return proto.CompactTextString(m) } func (*MsgConsumerModification) ProtoMessage() {} func (*MsgConsumerModification) Descriptor() ([]byte, []int) { - return fileDescriptor_43221a4391e9fbf4, []int{20} + return fileDescriptor_43221a4391e9fbf4, []int{22} } func (m *MsgConsumerModification) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1274,7 +1375,7 @@ func (m *MsgConsumerModificationResponse) Reset() { *m = MsgConsumerModi func (m *MsgConsumerModificationResponse) String() string { return proto.CompactTextString(m) } func (*MsgConsumerModificationResponse) ProtoMessage() {} func (*MsgConsumerModificationResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_43221a4391e9fbf4, []int{21} + return fileDescriptor_43221a4391e9fbf4, []int{23} } func (m *MsgConsumerModificationResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1303,6 +1404,258 @@ func (m *MsgConsumerModificationResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgConsumerModificationResponse proto.InternalMessageInfo +// MsgCreateConsumer defines the message that creates a consumer chain +type MsgCreateConsumer struct { + // signer address + Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` + // the chain id of the new consumer chain + ChainId string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + Metadata ConsumerMetadata `protobuf:"bytes,3,opt,name=metadata,proto3" json:"metadata"` + InitializationParameters *ConsumerInitializationParameters `protobuf:"bytes,4,opt,name=initialization_parameters,json=initializationParameters,proto3" json:"initialization_parameters,omitempty"` + PowerShapingParameters *PowerShapingParameters `protobuf:"bytes,5,opt,name=power_shaping_parameters,json=powerShapingParameters,proto3" json:"power_shaping_parameters,omitempty"` +} + +func (m *MsgCreateConsumer) Reset() { *m = MsgCreateConsumer{} } +func (m *MsgCreateConsumer) String() string { return proto.CompactTextString(m) } +func (*MsgCreateConsumer) ProtoMessage() {} +func (*MsgCreateConsumer) Descriptor() ([]byte, []int) { + return fileDescriptor_43221a4391e9fbf4, []int{24} +} +func (m *MsgCreateConsumer) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateConsumer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateConsumer.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgCreateConsumer) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateConsumer.Merge(m, src) +} +func (m *MsgCreateConsumer) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateConsumer) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateConsumer.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateConsumer proto.InternalMessageInfo + +func (m *MsgCreateConsumer) GetSigner() string { + if m != nil { + return m.Signer + } + return "" +} + +func (m *MsgCreateConsumer) GetChainId() string { + if m != nil { + return m.ChainId + } + return "" +} + +func (m *MsgCreateConsumer) GetMetadata() ConsumerMetadata { + if m != nil { + return m.Metadata + } + return ConsumerMetadata{} +} + +func (m *MsgCreateConsumer) GetInitializationParameters() *ConsumerInitializationParameters { + if m != nil { + return m.InitializationParameters + } + return nil +} + +func (m *MsgCreateConsumer) GetPowerShapingParameters() *PowerShapingParameters { + if m != nil { + return m.PowerShapingParameters + } + return nil +} + +// MsgCreateConsumerResponse defines response type for MsgCreateConsumer +type MsgCreateConsumerResponse struct { + ConsumerId string `protobuf:"bytes,1,opt,name=consumer_id,json=consumerId,proto3" json:"consumer_id,omitempty"` +} + +func (m *MsgCreateConsumerResponse) Reset() { *m = MsgCreateConsumerResponse{} } +func (m *MsgCreateConsumerResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateConsumerResponse) ProtoMessage() {} +func (*MsgCreateConsumerResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_43221a4391e9fbf4, []int{25} +} +func (m *MsgCreateConsumerResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateConsumerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateConsumerResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgCreateConsumerResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateConsumerResponse.Merge(m, src) +} +func (m *MsgCreateConsumerResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateConsumerResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateConsumerResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateConsumerResponse proto.InternalMessageInfo + +func (m *MsgCreateConsumerResponse) GetConsumerId() string { + if m != nil { + return m.ConsumerId + } + return "" +} + +// MsgUpdateConsumer defines the message used to modify a consumer chain. +type MsgUpdateConsumer struct { + // signer address + Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` + // the consumer id of the consumer chain to be updated + ConsumerId string `protobuf:"bytes,2,opt,name=consumer_id,json=consumerId,proto3" json:"consumer_id,omitempty"` + // the new owner of the consumer when updated + NewOwnerAddress string `protobuf:"bytes,3,opt,name=new_owner_address,json=newOwnerAddress,proto3" json:"new_owner_address,omitempty"` + // the metadata of the consumer when updated + Metadata *ConsumerMetadata `protobuf:"bytes,4,opt,name=metadata,proto3" json:"metadata,omitempty"` + // initialization parameters can only be updated before a chain has launched + InitializationParameters *ConsumerInitializationParameters `protobuf:"bytes,5,opt,name=initialization_parameters,json=initializationParameters,proto3" json:"initialization_parameters,omitempty"` + // the power-shaping parameters of the consumer when updated + PowerShapingParameters *PowerShapingParameters `protobuf:"bytes,6,opt,name=power_shaping_parameters,json=powerShapingParameters,proto3" json:"power_shaping_parameters,omitempty"` +} + +func (m *MsgUpdateConsumer) Reset() { *m = MsgUpdateConsumer{} } +func (m *MsgUpdateConsumer) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateConsumer) ProtoMessage() {} +func (*MsgUpdateConsumer) Descriptor() ([]byte, []int) { + return fileDescriptor_43221a4391e9fbf4, []int{26} +} +func (m *MsgUpdateConsumer) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateConsumer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateConsumer.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateConsumer) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateConsumer.Merge(m, src) +} +func (m *MsgUpdateConsumer) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateConsumer) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateConsumer.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateConsumer proto.InternalMessageInfo + +func (m *MsgUpdateConsumer) GetSigner() string { + if m != nil { + return m.Signer + } + return "" +} + +func (m *MsgUpdateConsumer) GetConsumerId() string { + if m != nil { + return m.ConsumerId + } + return "" +} + +func (m *MsgUpdateConsumer) GetNewOwnerAddress() string { + if m != nil { + return m.NewOwnerAddress + } + return "" +} + +func (m *MsgUpdateConsumer) GetMetadata() *ConsumerMetadata { + if m != nil { + return m.Metadata + } + return nil +} + +func (m *MsgUpdateConsumer) GetInitializationParameters() *ConsumerInitializationParameters { + if m != nil { + return m.InitializationParameters + } + return nil +} + +func (m *MsgUpdateConsumer) GetPowerShapingParameters() *PowerShapingParameters { + if m != nil { + return m.PowerShapingParameters + } + return nil +} + +// MsgUpdateConsumerResponse defines response type for MsgUpdateConsumer messages +type MsgUpdateConsumerResponse struct { +} + +func (m *MsgUpdateConsumerResponse) Reset() { *m = MsgUpdateConsumerResponse{} } +func (m *MsgUpdateConsumerResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateConsumerResponse) ProtoMessage() {} +func (*MsgUpdateConsumerResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_43221a4391e9fbf4, []int{27} +} +func (m *MsgUpdateConsumerResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateConsumerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateConsumerResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateConsumerResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateConsumerResponse.Merge(m, src) +} +func (m *MsgUpdateConsumerResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateConsumerResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateConsumerResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateConsumerResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgAssignConsumerKey)(nil), "interchain_security.ccv.provider.v1.MsgAssignConsumerKey") proto.RegisterType((*MsgAssignConsumerKeyResponse)(nil), "interchain_security.ccv.provider.v1.MsgAssignConsumerKeyResponse") @@ -1316,6 +1669,8 @@ func init() { proto.RegisterType((*MsgConsumerAdditionResponse)(nil), "interchain_security.ccv.provider.v1.MsgConsumerAdditionResponse") proto.RegisterType((*MsgConsumerRemoval)(nil), "interchain_security.ccv.provider.v1.MsgConsumerRemoval") proto.RegisterType((*MsgConsumerRemovalResponse)(nil), "interchain_security.ccv.provider.v1.MsgConsumerRemovalResponse") + proto.RegisterType((*MsgRemoveConsumer)(nil), "interchain_security.ccv.provider.v1.MsgRemoveConsumer") + proto.RegisterType((*MsgRemoveConsumerResponse)(nil), "interchain_security.ccv.provider.v1.MsgRemoveConsumerResponse") proto.RegisterType((*MsgChangeRewardDenoms)(nil), "interchain_security.ccv.provider.v1.MsgChangeRewardDenoms") proto.RegisterType((*MsgChangeRewardDenomsResponse)(nil), "interchain_security.ccv.provider.v1.MsgChangeRewardDenomsResponse") proto.RegisterType((*MsgOptIn)(nil), "interchain_security.ccv.provider.v1.MsgOptIn") @@ -1326,6 +1681,10 @@ func init() { proto.RegisterType((*MsgSetConsumerCommissionRateResponse)(nil), "interchain_security.ccv.provider.v1.MsgSetConsumerCommissionRateResponse") proto.RegisterType((*MsgConsumerModification)(nil), "interchain_security.ccv.provider.v1.MsgConsumerModification") proto.RegisterType((*MsgConsumerModificationResponse)(nil), "interchain_security.ccv.provider.v1.MsgConsumerModificationResponse") + proto.RegisterType((*MsgCreateConsumer)(nil), "interchain_security.ccv.provider.v1.MsgCreateConsumer") + proto.RegisterType((*MsgCreateConsumerResponse)(nil), "interchain_security.ccv.provider.v1.MsgCreateConsumerResponse") + proto.RegisterType((*MsgUpdateConsumer)(nil), "interchain_security.ccv.provider.v1.MsgUpdateConsumer") + proto.RegisterType((*MsgUpdateConsumerResponse)(nil), "interchain_security.ccv.provider.v1.MsgUpdateConsumerResponse") } func init() { @@ -1333,117 +1692,136 @@ func init() { } var fileDescriptor_43221a4391e9fbf4 = []byte{ - // 1746 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x58, 0xcd, 0x8f, 0x1c, 0x47, - 0x15, 0xdf, 0xde, 0x2f, 0xcf, 0xbc, 0xd9, 0xcf, 0xde, 0x35, 0x3b, 0x3b, 0x76, 0x66, 0xd6, 0x4b, - 0x48, 0x56, 0x26, 0xdb, 0x1d, 0x1b, 0x92, 0x80, 0x15, 0x04, 0xfb, 0x61, 0xf0, 0x06, 0xd6, 0x5e, - 0xda, 0xc6, 0x48, 0x20, 0xd1, 0xaa, 0xe9, 0x2e, 0xf7, 0x94, 0xdc, 0xdd, 0xd5, 0xaa, 0xaa, 0x19, - 0x67, 0x6e, 0x51, 0x4e, 0x48, 0x48, 0x28, 0xdc, 0x10, 0xa7, 0x1c, 0x10, 0x12, 0x12, 0x20, 0x1f, - 0x72, 0xe2, 0xc6, 0xcd, 0x07, 0x0e, 0x51, 0xc4, 0x01, 0xe5, 0x60, 0x90, 0x7d, 0x08, 0x67, 0xfe, - 0x02, 0x54, 0xd5, 0xd5, 0x3d, 0x3d, 0xfb, 0x31, 0xe9, 0x1d, 0x87, 0x43, 0x2e, 0xa3, 0xe9, 0x7a, - 0xbf, 0xf7, 0xab, 0xdf, 0x7b, 0xd5, 0xf5, 0x5e, 0x55, 0xc3, 0x6b, 0x24, 0x16, 0x98, 0x79, 0x1d, - 0x44, 0x62, 0x97, 0x63, 0xaf, 0xcb, 0x88, 0xe8, 0xdb, 0x9e, 0xd7, 0xb3, 0x13, 0x46, 0x7b, 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, 0xb6, 0xcb, 0xd2, - 0x28, 0x78, 0xe3, 0x8d, 0x73, 0xc1, 0xf3, 0xe9, 0x12, 0x98, 0xd5, 0x5d, 0xdc, 0x3a, 0x07, 0xc1, - 0x9d, 0xae, 0x68, 0xbc, 0x79, 0x3e, 0x7c, 0x3e, 0xe3, 0x1f, 0x0d, 0x58, 0x3f, 0xbb, 0xf5, 0x96, - 0xae, 0x21, 0x67, 0x52, 0x34, 0x0e, 0x5e, 0x98, 0x22, 0xd7, 0xfa, 0x3b, 0x03, 0x56, 0x4f, 0xed, - 0x7d, 0x6f, 0x9f, 0xf7, 0x5d, 0x2b, 0x7a, 0x37, 0xf6, 0x5f, 0xc4, 0x3b, 0x13, 0xd7, 0x98, 0x79, - 0xef, 0xb3, 0xc7, 0x57, 0x8d, 0xdd, 0x9f, 0x3e, 0x79, 0xd6, 0x34, 0x3e, 0x7e, 0xd6, 0x34, 0xfe, - 0xfd, 0xac, 0x69, 0x7c, 0xf0, 0xbc, 0x39, 0xf1, 0xf1, 0xf3, 0xe6, 0xc4, 0x3f, 0x9f, 0x37, 0x27, - 0x7e, 0xf6, 0x9d, 0x80, 0x88, 0x4e, 0xb7, 0x6d, 0x79, 0x34, 0xd2, 0xdf, 0x61, 0xed, 0xc1, 0xbc, - 0xdb, 0xf9, 0x67, 0xd4, 0xde, 0x1b, 0xf6, 0xbb, 0xc3, 0xdf, 0x52, 0xd5, 0xb7, 0xa7, 0xf6, 0xac, - 0xba, 0x22, 0x7c, 0xe3, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x84, 0x6b, 0xca, 0xd4, 0xc7, 0x16, - 0x00, 0x00, + // 2061 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x59, 0x4d, 0x6c, 0x1c, 0x49, + 0xf5, 0x77, 0xcf, 0x8c, 0x9d, 0x99, 0x1a, 0x7f, 0xb6, 0x9d, 0x75, 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x27, 0xc2, 0xa1, 0x78, 0xab, 0x28, 0xc8, 0x23, 0x90, 0x5a, 0xca, 0xb4, 0xff, 0x62, + 0xb6, 0xfd, 0x27, 0x13, 0xb9, 0x94, 0x63, 0x22, 0x8f, 0x9f, 0x6d, 0x22, 0x4f, 0xe4, 0x98, 0xc8, + 0x17, 0x4e, 0x9b, 0xc8, 0xe5, 0xd3, 0x26, 0x72, 0x65, 0xc4, 0x89, 0x0c, 0xf2, 0x4d, 0xe4, 0x6a, + 0xde, 0x89, 0x7c, 0x15, 0xd4, 0x4f, 0xd8, 0xaf, 0x64, 0x4f, 0x7f, 0x57, 0x14, 0x27, 0x67, 0x3b, + 0x42, 0x90, 0xf5, 0x46, 0x57, 0xaf, 0xf2, 0xb4, 0x9c, 0x95, 0xb7, 0xd4, 0x7f, 0x22, 0x7a, 0xfb, + 0xf8, 0x36, 0x28, 0xfb, 0x88, 0x41, 0x17, 0x32, 0xa8, 0x6e, 0x7a, 0x37, 0x72, 0x5d, 0x76, 0x12, + 0xbf, 0x95, 0xb2, 0xba, 0x56, 0x24, 0x64, 0xfa, 0xbb, 0x1a, 0x58, 0x52, 0x77, 0x0c, 0xfc, 0x03, + 0x11, 0x96, 0x2d, 0xae, 0x44, 0x88, 0xa1, 0x88, 0x8a, 0xaa, 0xa9, 0x6e, 0xdc, 0x39, 0x93, 0xa9, + 0xdd, 0x0c, 0xdb, 0x41, 0x42, 0x66, 0x19, 0xf8, 0x04, 0x89, 0xde, 0x01, 0x86, 0xac, 0x42, 0xda, + 0x82, 0xa1, 0xb8, 0x51, 0xf4, 0x5c, 0x90, 0x17, 0x94, 0x2f, 0xe7, 0xbb, 0xda, 0x71, 0x92, 0x43, + 0xc9, 0x91, 0x32, 0xfc, 0x52, 0x38, 0x74, 0xfd, 0x56, 0x35, 0x7d, 0x80, 0x6f, 0x8b, 0xe9, 0x9d, + 0xdd, 0xc3, 0x78, 0x87, 0x5f, 0xf8, 0x1a, 0xb2, 0xfa, 0xb8, 0x24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 0x3b, 0xd9, 0xdf, 0x36, 0xc5, 0xaf, 0x38, 0xcd, 0x09, 0xf1, 0xad, 0xe9, 0xf3, 0xff, + 0x0c, 0x00, 0x00, 0xff, 0xff, 0x9e, 0x12, 0xb4, 0x8e, 0x57, 0x1e, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1463,6 +1841,9 @@ type MsgClient interface { SubmitConsumerDoubleVoting(ctx context.Context, in *MsgSubmitConsumerDoubleVoting, opts ...grpc.CallOption) (*MsgSubmitConsumerDoubleVotingResponse, error) ConsumerAddition(ctx context.Context, in *MsgConsumerAddition, opts ...grpc.CallOption) (*MsgConsumerAdditionResponse, error) ConsumerRemoval(ctx context.Context, in *MsgConsumerRemoval, opts ...grpc.CallOption) (*MsgConsumerRemovalResponse, error) + CreateConsumer(ctx context.Context, in *MsgCreateConsumer, opts ...grpc.CallOption) (*MsgCreateConsumerResponse, error) + UpdateConsumer(ctx context.Context, in *MsgUpdateConsumer, opts ...grpc.CallOption) (*MsgUpdateConsumerResponse, error) + RemoveConsumer(ctx context.Context, in *MsgRemoveConsumer, opts ...grpc.CallOption) (*MsgRemoveConsumerResponse, error) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) OptIn(ctx context.Context, in *MsgOptIn, opts ...grpc.CallOption) (*MsgOptInResponse, error) OptOut(ctx context.Context, in *MsgOptOut, opts ...grpc.CallOption) (*MsgOptOutResponse, error) @@ -1505,6 +1886,7 @@ func (c *msgClient) SubmitConsumerDoubleVoting(ctx context.Context, in *MsgSubmi return out, nil } +// Deprecated: Do not use. func (c *msgClient) ConsumerAddition(ctx context.Context, in *MsgConsumerAddition, opts ...grpc.CallOption) (*MsgConsumerAdditionResponse, error) { out := new(MsgConsumerAdditionResponse) err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Msg/ConsumerAddition", in, out, opts...) @@ -1514,6 +1896,7 @@ func (c *msgClient) ConsumerAddition(ctx context.Context, in *MsgConsumerAdditio return out, nil } +// Deprecated: Do not use. func (c *msgClient) ConsumerRemoval(ctx context.Context, in *MsgConsumerRemoval, opts ...grpc.CallOption) (*MsgConsumerRemovalResponse, error) { out := new(MsgConsumerRemovalResponse) err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Msg/ConsumerRemoval", in, out, opts...) @@ -1523,6 +1906,33 @@ func (c *msgClient) ConsumerRemoval(ctx context.Context, in *MsgConsumerRemoval, return out, nil } +func (c *msgClient) CreateConsumer(ctx context.Context, in *MsgCreateConsumer, opts ...grpc.CallOption) (*MsgCreateConsumerResponse, error) { + out := new(MsgCreateConsumerResponse) + err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Msg/CreateConsumer", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UpdateConsumer(ctx context.Context, in *MsgUpdateConsumer, opts ...grpc.CallOption) (*MsgUpdateConsumerResponse, error) { + out := new(MsgUpdateConsumerResponse) + err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Msg/UpdateConsumer", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) RemoveConsumer(ctx context.Context, in *MsgRemoveConsumer, opts ...grpc.CallOption) (*MsgRemoveConsumerResponse, error) { + out := new(MsgRemoveConsumerResponse) + err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Msg/RemoveConsumer", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { out := new(MsgUpdateParamsResponse) err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Msg/UpdateParams", in, out, opts...) @@ -1559,6 +1969,7 @@ func (c *msgClient) SetConsumerCommissionRate(ctx context.Context, in *MsgSetCon return out, nil } +// Deprecated: Do not use. func (c *msgClient) ConsumerModification(ctx context.Context, in *MsgConsumerModification, opts ...grpc.CallOption) (*MsgConsumerModificationResponse, error) { out := new(MsgConsumerModificationResponse) err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Msg/ConsumerModification", in, out, opts...) @@ -1575,6 +1986,9 @@ type MsgServer interface { SubmitConsumerDoubleVoting(context.Context, *MsgSubmitConsumerDoubleVoting) (*MsgSubmitConsumerDoubleVotingResponse, error) ConsumerAddition(context.Context, *MsgConsumerAddition) (*MsgConsumerAdditionResponse, error) ConsumerRemoval(context.Context, *MsgConsumerRemoval) (*MsgConsumerRemovalResponse, error) + CreateConsumer(context.Context, *MsgCreateConsumer) (*MsgCreateConsumerResponse, error) + UpdateConsumer(context.Context, *MsgUpdateConsumer) (*MsgUpdateConsumerResponse, error) + RemoveConsumer(context.Context, *MsgRemoveConsumer) (*MsgRemoveConsumerResponse, error) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) OptIn(context.Context, *MsgOptIn) (*MsgOptInResponse, error) OptOut(context.Context, *MsgOptOut) (*MsgOptOutResponse, error) @@ -1601,6 +2015,15 @@ func (*UnimplementedMsgServer) ConsumerAddition(ctx context.Context, req *MsgCon func (*UnimplementedMsgServer) ConsumerRemoval(ctx context.Context, req *MsgConsumerRemoval) (*MsgConsumerRemovalResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ConsumerRemoval not implemented") } +func (*UnimplementedMsgServer) CreateConsumer(ctx context.Context, req *MsgCreateConsumer) (*MsgCreateConsumerResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateConsumer not implemented") +} +func (*UnimplementedMsgServer) UpdateConsumer(ctx context.Context, req *MsgUpdateConsumer) (*MsgUpdateConsumerResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateConsumer not implemented") +} +func (*UnimplementedMsgServer) RemoveConsumer(ctx context.Context, req *MsgRemoveConsumer) (*MsgRemoveConsumerResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RemoveConsumer not implemented") +} func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") } @@ -1711,8 +2134,62 @@ func _Msg_ConsumerRemoval_Handler(srv interface{}, ctx context.Context, dec func return interceptor(ctx, in, info, handler) } -func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgUpdateParams) +func _Msg_CreateConsumer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateConsumer) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreateConsumer(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/interchain_security.ccv.provider.v1.Msg/CreateConsumer", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreateConsumer(ctx, req.(*MsgCreateConsumer)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UpdateConsumer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateConsumer) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateConsumer(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/interchain_security.ccv.provider.v1.Msg/UpdateConsumer", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateConsumer(ctx, req.(*MsgUpdateConsumer)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_RemoveConsumer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRemoveConsumer) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RemoveConsumer(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/interchain_security.ccv.provider.v1.Msg/RemoveConsumer", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RemoveConsumer(ctx, req.(*MsgRemoveConsumer)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) if err := dec(in); err != nil { return nil, err } @@ -1825,6 +2302,18 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "ConsumerRemoval", Handler: _Msg_ConsumerRemoval_Handler, }, + { + MethodName: "CreateConsumer", + Handler: _Msg_CreateConsumer_Handler, + }, + { + MethodName: "UpdateConsumer", + Handler: _Msg_UpdateConsumer_Handler, + }, + { + MethodName: "RemoveConsumer", + Handler: _Msg_RemoveConsumer_Handler, + }, { MethodName: "UpdateParams", Handler: _Msg_UpdateParams_Handler, @@ -1870,6 +2359,13 @@ func (m *MsgAssignConsumerKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.ConsumerId) > 0 { + i -= len(m.ConsumerId) + copy(dAtA[i:], m.ConsumerId) + i = encodeVarintTx(dAtA, i, uint64(len(m.ConsumerId))) + i-- + dAtA[i] = 0x2a + } if len(m.Signer) > 0 { i -= len(m.Signer) copy(dAtA[i:], m.Signer) @@ -1944,6 +2440,13 @@ func (m *MsgSubmitConsumerMisbehaviour) MarshalToSizedBuffer(dAtA []byte) (int, _ = i var l int _ = l + if len(m.ConsumerId) > 0 { + i -= len(m.ConsumerId) + copy(dAtA[i:], m.ConsumerId) + i = encodeVarintTx(dAtA, i, uint64(len(m.ConsumerId))) + i-- + dAtA[i] = 0x1a + } if m.Misbehaviour != nil { { size, err := m.Misbehaviour.MarshalToSizedBuffer(dAtA[:i]) @@ -2009,6 +2512,13 @@ func (m *MsgSubmitConsumerDoubleVoting) MarshalToSizedBuffer(dAtA []byte) (int, _ = i var l int _ = l + if len(m.ConsumerId) > 0 { + i -= len(m.ConsumerId) + copy(dAtA[i:], m.ConsumerId) + i = encodeVarintTx(dAtA, i, uint64(len(m.ConsumerId))) + i-- + dAtA[i] = 0x22 + } if m.InfractionBlockHeader != nil { { size, err := m.InfractionBlockHeader.MarshalToSizedBuffer(dAtA[:i]) @@ -2395,6 +2905,74 @@ func (m *MsgConsumerRemovalResponse) MarshalToSizedBuffer(dAtA []byte) (int, err return len(dAtA) - i, nil } +func (m *MsgRemoveConsumer) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRemoveConsumer) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRemoveConsumer) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0x1a + } + n11, err11 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.StopTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.StopTime):]) + if err11 != nil { + return 0, err11 + } + i -= n11 + i = encodeVarintTx(dAtA, i, uint64(n11)) + i-- + dAtA[i] = 0x12 + if len(m.ConsumerId) > 0 { + i -= len(m.ConsumerId) + copy(dAtA[i:], m.ConsumerId) + i = encodeVarintTx(dAtA, i, uint64(len(m.ConsumerId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRemoveConsumerResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRemoveConsumerResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRemoveConsumerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func (m *MsgChangeRewardDenoms) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2486,6 +3064,13 @@ func (m *MsgOptIn) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.ConsumerId) > 0 { + i -= len(m.ConsumerId) + copy(dAtA[i:], m.ConsumerId) + i = encodeVarintTx(dAtA, i, uint64(len(m.ConsumerId))) + i-- + dAtA[i] = 0x2a + } if len(m.Signer) > 0 { i -= len(m.Signer) copy(dAtA[i:], m.Signer) @@ -2560,6 +3145,13 @@ func (m *MsgOptOut) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.ConsumerId) > 0 { + i -= len(m.ConsumerId) + copy(dAtA[i:], m.ConsumerId) + i = encodeVarintTx(dAtA, i, uint64(len(m.ConsumerId))) + i-- + dAtA[i] = 0x22 + } if len(m.Signer) > 0 { i -= len(m.Signer) copy(dAtA[i:], m.Signer) @@ -2627,6 +3219,13 @@ func (m *MsgSetConsumerCommissionRate) MarshalToSizedBuffer(dAtA []byte) (int, e _ = i var l int _ = l + if len(m.ConsumerId) > 0 { + i -= len(m.ConsumerId) + copy(dAtA[i:], m.ConsumerId) + i = encodeVarintTx(dAtA, i, uint64(len(m.ConsumerId))) + i-- + dAtA[i] = 0x2a + } if len(m.Signer) > 0 { i -= len(m.Signer) copy(dAtA[i:], m.Signer) @@ -2806,95 +3405,311 @@ func (m *MsgConsumerModificationResponse) MarshalToSizedBuffer(dAtA []byte) (int return len(dAtA) - i, nil } -func encodeVarintTx(dAtA []byte, offset int, v uint64) int { - offset -= sovTx(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *MsgCreateConsumer) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *MsgAssignConsumerKey) Size() (n int) { - if m == nil { - return 0 - } + +func (m *MsgCreateConsumer) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateConsumer) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + if m.PowerShapingParameters != nil { + { + size, err := m.PowerShapingParameters.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a } - l = len(m.ProviderAddr) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + if m.InitializationParameters != nil { + { + size, err := m.InitializationParameters.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 } - l = len(m.ConsumerKey) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + { + size, err := m.Metadata.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) } - l = len(m.Signer) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + i-- + dAtA[i] = 0x1a + if len(m.ChainId) > 0 { + i -= len(m.ChainId) + copy(dAtA[i:], m.ChainId) + i = encodeVarintTx(dAtA, i, uint64(len(m.ChainId))) + i-- + dAtA[i] = 0x12 } - return n + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } -func (m *MsgAssignConsumerKeyResponse) Size() (n int) { - if m == nil { - return 0 +func (m *MsgCreateConsumerResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - var l int - _ = l - return n + return dAtA[:n], nil } -func (m *MsgSubmitConsumerMisbehaviour) Size() (n int) { - if m == nil { - return 0 - } +func (m *MsgCreateConsumerResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateConsumerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.Submitter) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.Misbehaviour != nil { - l = m.Misbehaviour.Size() - n += 1 + l + sovTx(uint64(l)) + if len(m.ConsumerId) > 0 { + i -= len(m.ConsumerId) + copy(dAtA[i:], m.ConsumerId) + i = encodeVarintTx(dAtA, i, uint64(len(m.ConsumerId))) + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *MsgSubmitConsumerMisbehaviourResponse) Size() (n int) { - if m == nil { - return 0 +func (m *MsgUpdateConsumer) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - var l int - _ = l - return n + return dAtA[:n], nil } -func (m *MsgSubmitConsumerDoubleVoting) Size() (n int) { - if m == nil { - return 0 - } +func (m *MsgUpdateConsumer) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateConsumer) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.Submitter) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.DuplicateVoteEvidence != nil { - l = m.DuplicateVoteEvidence.Size() - n += 1 + l + sovTx(uint64(l)) - } + if m.PowerShapingParameters != nil { + { + size, err := m.PowerShapingParameters.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + if m.InitializationParameters != nil { + { + size, err := m.InitializationParameters.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + if m.Metadata != nil { + { + size, err := m.Metadata.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if len(m.NewOwnerAddress) > 0 { + i -= len(m.NewOwnerAddress) + copy(dAtA[i:], m.NewOwnerAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.NewOwnerAddress))) + i-- + dAtA[i] = 0x1a + } + if len(m.ConsumerId) > 0 { + i -= len(m.ConsumerId) + copy(dAtA[i:], m.ConsumerId) + i = encodeVarintTx(dAtA, i, uint64(len(m.ConsumerId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateConsumerResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateConsumerResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateConsumerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgAssignConsumerKey) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ChainId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ProviderAddr) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ConsumerKey) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ConsumerId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgAssignConsumerKeyResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgSubmitConsumerMisbehaviour) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Submitter) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Misbehaviour != nil { + l = m.Misbehaviour.Size() + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ConsumerId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSubmitConsumerMisbehaviourResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgSubmitConsumerDoubleVoting) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Submitter) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.DuplicateVoteEvidence != nil { + l = m.DuplicateVoteEvidence.Size() + n += 1 + l + sovTx(uint64(l)) + } if m.InfractionBlockHeader != nil { l = m.InfractionBlockHeader.Size() n += 1 + l + sovTx(uint64(l)) } + l = len(m.ConsumerId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } return n } @@ -3044,6 +3859,34 @@ func (m *MsgConsumerRemovalResponse) Size() (n int) { return n } +func (m *MsgRemoveConsumer) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ConsumerId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.StopTime) + n += 1 + l + sovTx(uint64(l)) + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgRemoveConsumerResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func (m *MsgChangeRewardDenoms) Size() (n int) { if m == nil { return 0 @@ -3100,6 +3943,10 @@ func (m *MsgOptIn) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } + l = len(m.ConsumerId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } return n } @@ -3130,6 +3977,10 @@ func (m *MsgOptOut) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } + l = len(m.ConsumerId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } return n } @@ -3162,6 +4013,10 @@ func (m *MsgSetConsumerCommissionRate) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } + l = len(m.ConsumerId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } return n } @@ -3235,6 +4090,88 @@ func (m *MsgConsumerModificationResponse) Size() (n int) { return n } +func (m *MsgCreateConsumer) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ChainId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Metadata.Size() + n += 1 + l + sovTx(uint64(l)) + if m.InitializationParameters != nil { + l = m.InitializationParameters.Size() + n += 1 + l + sovTx(uint64(l)) + } + if m.PowerShapingParameters != nil { + l = m.PowerShapingParameters.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgCreateConsumerResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ConsumerId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgUpdateConsumer) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ConsumerId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.NewOwnerAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Metadata != nil { + l = m.Metadata.Size() + n += 1 + l + sovTx(uint64(l)) + } + if m.InitializationParameters != nil { + l = m.InitializationParameters.Size() + n += 1 + l + sovTx(uint64(l)) + } + if m.PowerShapingParameters != nil { + l = m.PowerShapingParameters.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgUpdateConsumerResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -3398,6 +4335,38 @@ func (m *MsgAssignConsumerKey) Unmarshal(dAtA []byte) error { } m.Signer = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConsumerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -3566,6 +4535,38 @@ func (m *MsgSubmitConsumerMisbehaviour) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConsumerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -3770,6 +4771,38 @@ func (m *MsgSubmitConsumerDoubleVoting) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConsumerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -4862,7 +5895,7 @@ func (m *MsgConsumerRemovalResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgChangeRewardDenoms) Unmarshal(dAtA []byte) error { +func (m *MsgRemoveConsumer) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4885,15 +5918,15 @@ func (m *MsgChangeRewardDenoms) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgChangeRewardDenoms: wiretype end group for non-group") + return fmt.Errorf("proto: MsgRemoveConsumer: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgChangeRewardDenoms: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgRemoveConsumer: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DenomsToAdd", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4921,13 +5954,13 @@ func (m *MsgChangeRewardDenoms) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.DenomsToAdd = append(m.DenomsToAdd, string(dAtA[iNdEx:postIndex])) + m.ConsumerId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DenomsToRemove", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field StopTime", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -4937,23 +5970,24 @@ func (m *MsgChangeRewardDenoms) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.DenomsToRemove = append(m.DenomsToRemove, string(dAtA[iNdEx:postIndex])) + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.StopTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 3: if wireType != 2 { @@ -5008,7 +6042,7 @@ func (m *MsgChangeRewardDenoms) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgChangeRewardDenomsResponse) Unmarshal(dAtA []byte) error { +func (m *MsgRemoveConsumerResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5031,10 +6065,10 @@ func (m *MsgChangeRewardDenomsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgChangeRewardDenomsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgRemoveConsumerResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgChangeRewardDenomsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgRemoveConsumerResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -5058,7 +6092,7 @@ func (m *MsgChangeRewardDenomsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgOptIn) Unmarshal(dAtA []byte) error { +func (m *MsgChangeRewardDenoms) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5081,15 +6115,15 @@ func (m *MsgOptIn) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgOptIn: wiretype end group for non-group") + return fmt.Errorf("proto: MsgChangeRewardDenoms: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgOptIn: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgChangeRewardDenoms: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DenomsToAdd", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5117,11 +6151,11 @@ func (m *MsgOptIn) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ChainId = string(dAtA[iNdEx:postIndex]) + m.DenomsToAdd = append(m.DenomsToAdd, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProviderAddr", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DenomsToRemove", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5149,43 +6183,11 @@ func (m *MsgOptIn) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ProviderAddr = string(dAtA[iNdEx:postIndex]) + m.DenomsToRemove = append(m.DenomsToRemove, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConsumerKey", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ConsumerKey = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5213,7 +6215,7 @@ func (m *MsgOptIn) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Signer = string(dAtA[iNdEx:postIndex]) + m.Authority = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -5236,7 +6238,7 @@ func (m *MsgOptIn) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgOptInResponse) Unmarshal(dAtA []byte) error { +func (m *MsgChangeRewardDenomsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5259,10 +6261,10 @@ func (m *MsgOptInResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgOptInResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgChangeRewardDenomsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgOptInResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgChangeRewardDenomsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -5286,7 +6288,7 @@ func (m *MsgOptInResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgOptOut) Unmarshal(dAtA []byte) error { +func (m *MsgOptIn) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5309,10 +6311,10 @@ func (m *MsgOptOut) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgOptOut: wiretype end group for non-group") + return fmt.Errorf("proto: MsgOptIn: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgOptOut: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgOptIn: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -5380,6 +6382,38 @@ func (m *MsgOptOut) Unmarshal(dAtA []byte) error { m.ProviderAddr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerKey", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConsumerKey = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) } @@ -5411,6 +6445,38 @@ func (m *MsgOptOut) Unmarshal(dAtA []byte) error { } m.Signer = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConsumerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -5432,7 +6498,7 @@ func (m *MsgOptOut) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgOptOutResponse) Unmarshal(dAtA []byte) error { +func (m *MsgOptInResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5455,10 +6521,10 @@ func (m *MsgOptOutResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgOptOutResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgOptInResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgOptOutResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgOptInResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -5482,7 +6548,7 @@ func (m *MsgOptOutResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgSetConsumerCommissionRate) Unmarshal(dAtA []byte) error { +func (m *MsgOptOut) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5505,15 +6571,15 @@ func (m *MsgSetConsumerCommissionRate) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgSetConsumerCommissionRate: wiretype end group for non-group") + return fmt.Errorf("proto: MsgOptOut: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSetConsumerCommissionRate: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgOptOut: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProviderAddr", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5541,11 +6607,11 @@ func (m *MsgSetConsumerCommissionRate) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ProviderAddr = string(dAtA[iNdEx:postIndex]) + m.ChainId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ProviderAddr", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5573,11 +6639,11 @@ func (m *MsgSetConsumerCommissionRate) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ChainId = string(dAtA[iNdEx:postIndex]) + m.ProviderAddr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Rate", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5605,13 +6671,11 @@ func (m *MsgSetConsumerCommissionRate) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Rate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Signer = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5639,7 +6703,7 @@ func (m *MsgSetConsumerCommissionRate) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Signer = string(dAtA[iNdEx:postIndex]) + m.ConsumerId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -5662,7 +6726,7 @@ func (m *MsgSetConsumerCommissionRate) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgSetConsumerCommissionRateResponse) Unmarshal(dAtA []byte) error { +func (m *MsgOptOutResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5685,10 +6749,10 @@ func (m *MsgSetConsumerCommissionRateResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgSetConsumerCommissionRateResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgOptOutResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSetConsumerCommissionRateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgOptOutResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -5712,7 +6776,7 @@ func (m *MsgSetConsumerCommissionRateResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgConsumerModification) Unmarshal(dAtA []byte) error { +func (m *MsgSetConsumerCommissionRate) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5735,15 +6799,15 @@ func (m *MsgConsumerModification) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgConsumerModification: wiretype end group for non-group") + return fmt.Errorf("proto: MsgSetConsumerCommissionRate: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgConsumerModification: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgSetConsumerCommissionRate: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ProviderAddr", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5771,11 +6835,11 @@ func (m *MsgConsumerModification) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Title = string(dAtA[iNdEx:postIndex]) + m.ProviderAddr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5803,11 +6867,11 @@ func (m *MsgConsumerModification) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Description = string(dAtA[iNdEx:postIndex]) + m.ChainId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Rate", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5835,13 +6899,15 @@ func (m *MsgConsumerModification) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ChainId = string(dAtA[iNdEx:postIndex]) + if err := m.Rate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Top_N", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) } - m.Top_N = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -5851,16 +6917,29 @@ func (m *MsgConsumerModification) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Top_N |= uint32(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorsPowerCap", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerId", wireType) } - m.ValidatorsPowerCap = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -5870,33 +6949,127 @@ func (m *MsgConsumerModification) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ValidatorsPowerCap |= uint32(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorSetCap", wireType) + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx } - m.ValidatorSetCap = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ValidatorSetCap |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx } - case 7: + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConsumerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgSetConsumerCommissionRateResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgSetConsumerCommissionRateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetConsumerCommissionRateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgConsumerModification) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgConsumerModification: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgConsumerModification: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Allowlist", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5924,11 +7097,11 @@ func (m *MsgConsumerModification) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Allowlist = append(m.Allowlist, string(dAtA[iNdEx:postIndex])) + m.Title = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 8: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denylist", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5956,11 +7129,11 @@ func (m *MsgConsumerModification) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Denylist = append(m.Denylist, string(dAtA[iNdEx:postIndex])) + m.Description = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 9: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5988,13 +7161,13 @@ func (m *MsgConsumerModification) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Authority = string(dAtA[iNdEx:postIndex]) + m.ChainId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 10: + case 4: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinStake", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Top_N", wireType) } - m.MinStake = 0 + m.Top_N = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -6004,16 +7177,16 @@ func (m *MsgConsumerModification) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MinStake |= uint64(b&0x7F) << shift + m.Top_N |= uint32(b&0x7F) << shift if b < 0x80 { break } } - case 11: + case 5: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AllowInactiveVals", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorsPowerCap", wireType) } - var v int + m.ValidatorsPowerCap = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -6023,26 +7196,179 @@ func (m *MsgConsumerModification) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int(b&0x7F) << shift + m.ValidatorsPowerCap |= uint32(b&0x7F) << shift if b < 0x80 { break } } - m.AllowInactiveVals = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorSetCap", wireType) } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx + m.ValidatorSetCap = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ValidatorSetCap |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Allowlist", wireType) } - iNdEx += skippy - } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Allowlist = append(m.Allowlist, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denylist", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denylist = append(m.Denylist, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinStake", wireType) + } + m.MinStake = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinStake |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 11: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AllowInactiveVals", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.AllowInactiveVals = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } } if iNdEx > l { @@ -6100,6 +7426,611 @@ func (m *MsgConsumerModificationResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgCreateConsumer) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCreateConsumer: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateConsumer: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChainId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Metadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InitializationParameters", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.InitializationParameters == nil { + m.InitializationParameters = &ConsumerInitializationParameters{} + } + if err := m.InitializationParameters.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PowerShapingParameters", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PowerShapingParameters == nil { + m.PowerShapingParameters = &PowerShapingParameters{} + } + if err := m.PowerShapingParameters.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgCreateConsumerResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCreateConsumerResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateConsumerResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConsumerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateConsumer) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateConsumer: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateConsumer: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConsumerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewOwnerAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NewOwnerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Metadata == nil { + m.Metadata = &ConsumerMetadata{} + } + if err := m.Metadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InitializationParameters", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.InitializationParameters == nil { + m.InitializationParameters = &ConsumerInitializationParameters{} + } + if err := m.InitializationParameters.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PowerShapingParameters", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PowerShapingParameters == nil { + m.PowerShapingParameters = &PowerShapingParameters{} + } + if err := m.PowerShapingParameters.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateConsumerResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateConsumerResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateConsumerResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/ccv/types/expected_keepers.go b/x/ccv/types/expected_keepers.go index 5773461c34..b643bb1a6d 100644 --- a/x/ccv/types/expected_keepers.go +++ b/x/ccv/types/expected_keepers.go @@ -143,6 +143,7 @@ type BankKeeper interface { // AccountKeeper defines the expected account keeper used for simulations type AccountKeeper interface { GetModuleAccount(ctx context.Context, name string) sdk.ModuleAccountI + AddressCodec() addresscodec.Codec } // IBCTransferKeeper defines the expected interface needed for distribution transfer From 6a1df54cae276e74086aa1bdccfa880db02b5a68 Mon Sep 17 00:00:00 2001 From: Simon Noetzlin Date: Mon, 26 Aug 2024 10:14:02 +0200 Subject: [PATCH 02/17] add phase + metadata --- .../ccv/provider/v1/query.proto | 4 + x/ccv/provider/keeper/grpc_query.go | 12 + x/ccv/provider/keeper/grpc_query_test.go | 36 +- x/ccv/provider/keeper/permissionless.go | 9 +- x/ccv/provider/types/query.pb.go | 408 +++++++++++------- 5 files changed, 298 insertions(+), 171 deletions(-) diff --git a/proto/interchain_security/ccv/provider/v1/query.proto b/proto/interchain_security/ccv/provider/v1/query.proto index c9536b8e16..39de15d244 100644 --- a/proto/interchain_security/ccv/provider/v1/query.proto +++ b/proto/interchain_security/ccv/provider/v1/query.proto @@ -225,6 +225,10 @@ message Chain { repeated string allowlist = 7; // Corresponds to a list of provider consensus addresses of validators that CANNOT validate the consumer chain. repeated string denylist = 8; + // The phase the consumer chain is (Registered=0|Initialized=1|FailedToLaunched=2|Launched=3|Stopped=4) + uint32 phase = 9; + // The consumer chain metadata + ConsumerMetadata metadata = 10 [(gogoproto.nullable) = false ]; } message QueryValidatorConsumerAddrRequest { diff --git a/x/ccv/provider/keeper/grpc_query.go b/x/ccv/provider/keeper/grpc_query.go index 5408cc606a..80900a6816 100644 --- a/x/ccv/provider/keeper/grpc_query.go +++ b/x/ccv/provider/keeper/grpc_query.go @@ -93,6 +93,16 @@ func (k Keeper) GetConsumerChain(ctx sdk.Context, consumerId string) (types.Chai strDenylist[i] = addr.String() } + phase, ok := k.GetConsumerPhase(ctx, consumerId) + if !ok { + return types.Chain{}, fmt.Errorf("cannot find phase for consumer (%s)", consumerId) + } + + metadata, err := k.GetConsumerMetadata(ctx, consumerId) + if err != nil { + return types.Chain{}, fmt.Errorf("cannot get metadata for consumer (%s): %w", consumerId, err) + } + return types.Chain{ ChainId: consumerId, ClientId: clientID, @@ -102,6 +112,8 @@ func (k Keeper) GetConsumerChain(ctx sdk.Context, consumerId string) (types.Chai ValidatorsPowerCap: validatorsPowerCap, Allowlist: strAllowlist, Denylist: strDenylist, + Phase: uint32(phase), + Metadata: metadata, }, nil } diff --git a/x/ccv/provider/keeper/grpc_query_test.go b/x/ccv/provider/keeper/grpc_query_test.go index bbc61794d8..81a9f4512a 100644 --- a/x/ccv/provider/keeper/grpc_query_test.go +++ b/x/ccv/provider/keeper/grpc_query_test.go @@ -2,6 +2,7 @@ package keeper_test import ( "fmt" + "strconv" "testing" "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" @@ -322,22 +323,31 @@ func TestGetConsumerChain(t *testing.T) { {}, } + metadataLists := make([]types.ConsumerMetadata, len(chainIDs)) + consumerIDs := make([]string, len(chainIDs)) + + // skip first consumerID + pk.FetchAndIncrementConsumerId(ctx) + expectedGetAllOrder := []types.Chain{} - for i, chainID := range chainIDs { + for i, _ := range chainIDs { + consumerID := pk.FetchAndIncrementConsumerId(ctx) + consumerIDs[i] = consumerID + clientID := fmt.Sprintf("client-%d", len(chainIDs)-i) topN := topNs[i] - pk.SetConsumerClientId(ctx, chainID, clientID) - pk.SetConsumerPowerShapingParameters(ctx, chainID, types.PowerShapingParameters{ + pk.SetConsumerClientId(ctx, consumerID, clientID) + pk.SetConsumerPowerShapingParameters(ctx, consumerID, types.PowerShapingParameters{ Top_N: topN, ValidatorSetCap: validatorSetCaps[i], ValidatorsPowerCap: validatorPowerCaps[i], }) - pk.SetMinimumPowerInTopN(ctx, chainID, expectedMinPowerInTopNs[i]) + pk.SetMinimumPowerInTopN(ctx, consumerID, expectedMinPowerInTopNs[i]) for _, addr := range allowlists[i] { - pk.SetAllowlist(ctx, chainID, addr) + pk.SetAllowlist(ctx, consumerID, addr) } for _, addr := range denylists[i] { - pk.SetDenylist(ctx, chainID, addr) + pk.SetDenylist(ctx, consumerID, addr) } strAllowlist := make([]string, len(allowlists[i])) for j, addr := range allowlists[i] { @@ -349,9 +359,15 @@ func TestGetConsumerChain(t *testing.T) { strDenylist[j] = addr.String() } + metadataLists[i] = types.ConsumerMetadata{Name: "consumer-" + strconv.Itoa(i)} + pk.SetConsumerMetadata(ctx, consumerID, metadataLists[i]) + + phase := uint32(i) + pk.SetConsumerPhase(ctx, consumerID, keeper.ConsumerPhase(byte(phase))) + expectedGetAllOrder = append(expectedGetAllOrder, types.Chain{ - ChainId: chainID, + ChainId: consumerID, ClientId: clientID, Top_N: topN, MinPowerInTop_N: expectedMinPowerInTopNs[i], @@ -359,11 +375,13 @@ func TestGetConsumerChain(t *testing.T) { ValidatorsPowerCap: validatorPowerCaps[i], Allowlist: strAllowlist, Denylist: strDenylist, + Phase: uint32(i), + Metadata: metadataLists[i], }) } - for i, chainID := range pk.GetAllActiveConsumerIds(ctx) { - c, err := pk.GetConsumerChain(ctx, chainID) + for i, cID := range consumerIDs { + c, err := pk.GetConsumerChain(ctx, cID) require.NoError(t, err) require.Equal(t, expectedGetAllOrder[i], c) } diff --git a/x/ccv/provider/keeper/permissionless.go b/x/ccv/provider/keeper/permissionless.go index b742485f6e..4b209d0358 100644 --- a/x/ccv/provider/keeper/permissionless.go +++ b/x/ccv/provider/keeper/permissionless.go @@ -2,15 +2,16 @@ package keeper import ( "bytes" - errorsmod "cosmossdk.io/errors" - storetypes "cosmossdk.io/store/types" "encoding/binary" "encoding/gob" "fmt" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" "strconv" "time" + + errorsmod "cosmossdk.io/errors" + storetypes "cosmossdk.io/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" ) // ConsumerPhase captures the phases of a consumer chain according to `docs/docs/adrs/adr-018-permissionless-ics.md` diff --git a/x/ccv/provider/types/query.pb.go b/x/ccv/provider/types/query.pb.go index aee4e3d717..c667a7c590 100644 --- a/x/ccv/provider/types/query.pb.go +++ b/x/ccv/provider/types/query.pb.go @@ -402,6 +402,10 @@ type Chain struct { Allowlist []string `protobuf:"bytes,7,rep,name=allowlist,proto3" json:"allowlist,omitempty"` // Corresponds to a list of provider consensus addresses of validators that CANNOT validate the consumer chain. Denylist []string `protobuf:"bytes,8,rep,name=denylist,proto3" json:"denylist,omitempty"` + // The phase the consumer chain is (Registered=0|Initialized=1|FailedToLaunched=2|Launched=3|Stopped=4) + Phase uint32 `protobuf:"varint,9,opt,name=phase,proto3" json:"phase,omitempty"` + // The consumer chain metadata + Metadata ConsumerMetadata `protobuf:"bytes,10,opt,name=metadata,proto3" json:"metadata"` } func (m *Chain) Reset() { *m = Chain{} } @@ -493,6 +497,20 @@ func (m *Chain) GetDenylist() []string { return nil } +func (m *Chain) GetPhase() uint32 { + if m != nil { + return m.Phase + } + return 0 +} + +func (m *Chain) GetMetadata() ConsumerMetadata { + if m != nil { + return m.Metadata + } + return ConsumerMetadata{} +} + type QueryValidatorConsumerAddrRequest struct { // [DEPRECATED] use `consumer_id` instead ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` // Deprecated: Do not use. @@ -2011,159 +2029,161 @@ func init() { } var fileDescriptor_422512d7b7586cd7 = []byte{ - // 2427 bytes of a gzipped FileDescript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 0x51, 0x77, 0xa0, 0xa2, 0xc2, 0xe3, 0x60, 0xd8, 0xc6, 0xa6, 0x74, 0x37, 0x3b, 0x38, - 0xc7, 0x15, 0x8e, 0x8a, 0x43, 0x36, 0x36, 0xef, 0xc2, 0x79, 0x00, 0x6b, 0x9a, 0x21, 0x99, 0xf8, - 0x91, 0x13, 0xdf, 0x86, 0xe4, 0x4a, 0x0c, 0xcd, 0x71, 0x85, 0x41, 0x71, 0xa2, 0xa6, 0x19, 0xeb, - 0xce, 0x44, 0xc5, 0xd8, 0x74, 0x64, 0x17, 0xc0, 0x64, 0x43, 0xd6, 0x35, 0x55, 0xb6, 0xb1, 0x45, - 0xd8, 0x12, 0x45, 0x36, 0xb3, 0xc3, 0x14, 0x0f, 0x06, 0x73, 0x74, 0x51, 0x59, 0x36, 0xe1, 0x3c, - 0x78, 0xcd, 0x1f, 0x95, 0x08, 0xb2, 0xa9, 0xf8, 0x08, 0x15, 0x3f, 0xe6, 0x4f, 0x6c, 0x20, 0xdb, - 0x91, 0x9d, 0x01, 0x63, 0xb2, 0xae, 0xe3, 0x47, 0xba, 0x46, 0xec, 0xec, 0x91, 0xb9, 0xc1, 0xc2, - 0x98, 0x18, 0x0c, 0xc0, 0x1c, 0x18, 0x55, 0x91, 0xd1, 0xa4, 0x93, 0xa3, 0x74, 0xd2, 0xff, 0xe6, - 0x7f, 0xc5, 0x81, 0x33, 0xf4, 0x8c, 0x1e, 0x78, 0x90, 0xa1, 0x20, 0xb0, 0x52, 0xde, 0xf3, 0x6b, - 0xe0, 0x55, 0xef, 0x48, 0x24, 0x59, 0x55, 0x2d, 0x44, 0x88, 0xeb, 0xc1, 0x12, 0xfc, 0xf2, 0x79, - 0x7e, 0xa2, 0x29, 0xd7, 0xf4, 0xab, 0x3c, 0x9b, 0xe0, 0xc5, 0x63, 0x9e, 0xec, 0xb2, 0x3b, 0x12, - 0x4f, 0x13, 0x83, 0xf1, 0x34, 0x71, 0x75, 0xf4, 0x83, 0x8f, 0xf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 0xe5, 0xec, 0xc0, 0x1f, 0x5f, 0xce, 0x0e, 0x6c, 0x5d, 0xab, 0x6a, 0xf6, 0x6e, - 0x7d, 0xa7, 0xa8, 0xe0, 0x1a, 0xfb, 0x27, 0xad, 0xd0, 0x2e, 0x97, 0xfd, 0x5d, 0x1a, 0x6f, 0x08, - 0x8f, 0x63, 0x65, 0x7a, 0xd3, 0x44, 0x64, 0x67, 0x84, 0xfe, 0x10, 0xfe, 0xfa, 0xff, 0x02, 0x00, - 0x00, 0xff, 0xff, 0x69, 0x3e, 0x82, 0x9f, 0x44, 0x27, 0x00, 0x00, + // 2460 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x5a, 0x4d, 0x6c, 0xdc, 0xc6, + 0x15, 0x16, 0x57, 0x3f, 0x96, 0x46, 0xb6, 0x9c, 0x8c, 0x65, 0x7b, 0xbd, 0x92, 0xb5, 0x32, 0x6d, + 0xb7, 0xf2, 0xdf, 0x52, 0x52, 0xe0, 0x26, 0x76, 0xeb, 0xd8, 0xda, 0x95, 0x65, 0x2f, 0xfc, 0xa7, + 0xd0, 0xb2, 0x53, 0x28, 0x55, 0xe9, 0x11, 0x39, 0x5d, 0xb1, 0xe2, 0x92, 0x14, 0x67, 0xb4, 0xf6, + 0xc2, 0xf0, 0x21, 0x2d, 0xd0, 0x26, 0x3d, 0x14, 0x2e, 0x8a, 0xde, 0x73, 0x29, 0xd0, 0x43, 0x4f, + 0x45, 0xd0, 0xa2, 0xb7, 0x1c, 0x73, 0x6b, 0x9a, 0x5c, 0x8a, 0x16, 0x70, 0x0b, 0xbb, 0x87, 0xa2, + 0x40, 0x81, 0x22, 0xed, 0xb5, 0x40, 0xc1, 0xe1, 0x90, 0x4b, 0x52, 0x5c, 0x2d, 0xb9, 0xab, 0x43, + 0x6e, 0xe2, 0xcc, 0x9b, 0x6f, 0xde, 0x7b, 0xf3, 0xe6, 0xcd,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, 0x14, 0xc1, + 0x28, 0x31, 0x10, 0xd9, 0x50, 0xea, 0x98, 0x62, 0x87, 0xed, 0xd0, 0x2f, 0x03, 0x36, 0x74, 0xc7, + 0x1d, 0x81, 0xf3, 0xe0, 0x70, 0x48, 0x40, 0x61, 0x17, 0x00, 0x99, 0x2a, 0x66, 0xce, 0xe9, 0x97, + 0x0f, 0xb5, 0x44, 0x17, 0xfc, 0x29, 0xf8, 0x5d, 0x90, 0x37, 0xf1, 0x13, 0xaa, 0x38, 0xd8, 0x36, + 0xb0, 0xa9, 0x93, 0x0d, 0x45, 0x45, 0xa6, 0xe6, 0x1a, 0x8b, 0x99, 0x67, 0x46, 0xe7, 0x0b, 0x25, + 0xaf, 0x20, 0x28, 0xf9, 0x05, 0x41, 0x69, 0xc5, 0x2f, 0x08, 0xca, 0xc3, 0x6e, 0x78, 0x3f, 0xff, + 0x6b, 0x51, 0x90, 0x8f, 0xb8, 0x28, 0xb2, 0x0f, 0x52, 0xf1, 0x31, 0xc4, 0xf3, 0xe0, 0x2c, 0x33, + 0x49, 0xc6, 0x35, 0x9d, 0x50, 0xec, 0x60, 0xad, 0x95, 0xb0, 0x1e, 0x23, 0x47, 0x5b, 0xc4, 0xa6, + 0x55, 0x0f, 0x32, 0xe6, 0x75, 0x70, 0x2e, 0x95, 0x34, 0xf7, 0xc8, 0x11, 0x30, 0xa4, 0xb1, 0x11, + 0xf6, 0x08, 0x8d, 0xc8, 0xfc, 0x4b, 0x9c, 0xe2, 0xcf, 0xaa, 0x97, 0x0c, 0xb1, 0xc6, 0x72, 0x5f, + 0x75, 0x31, 0xd8, 0xe6, 0x7d, 0x01, 0x1c, 0x6f, 0x23, 0xc0, 0x91, 0x1f, 0x81, 0x31, 0x3b, 0x3c, + 0xe7, 0x3f, 0x73, 0xf3, 0xa9, 0xd2, 0x40, 0x04, 0x96, 0xe7, 0x80, 0x18, 0x9e, 0x68, 0x82, 0x03, + 0x11, 0x31, 0x38, 0x09, 0x78, 0x80, 0x2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1, 0xdc, 0x50, 0xe9, 0x85, 0x53, 0xf2, 0xdd, 0xbe, 0xd8, 0x1b, 0x48, 0x77, 0x39, 0x20, + 0x70, 0x46, 0x2f, 0x39, 0x20, 0x19, 0x24, 0xc8, 0x01, 0xff, 0x12, 0xf8, 0xaf, 0xb0, 0x49, 0x6c, + 0x08, 0xcc, 0xc0, 0xc7, 0xed, 0xc2, 0xb8, 0x14, 0x96, 0x7a, 0x85, 0xc9, 0x5e, 0x20, 0xb7, 0x21, + 0x6f, 0xe0, 0x7f, 0x84, 0xd8, 0xff, 0xf2, 0x44, 0xe9, 0x15, 0x78, 0x23, 0xfb, 0x41, 0x27, 0x72, + 0x3c, 0x85, 0x9b, 0xbd, 0x03, 0x65, 0xb7, 0x3a, 0x14, 0x1c, 0xd2, 0xd3, 0x80, 0x62, 0x7a, 0x56, + 0x7e, 0xf7, 0xd3, 0x97, 0x53, 0xc2, 0x67, 0x2f, 0xa7, 0x84, 0xbf, 0xbd, 0x9c, 0x12, 0x9e, 0xbf, + 0x9a, 0xea, 0xfb, 0xec, 0xd5, 0x54, 0xdf, 0x9f, 0x5e, 0x4d, 0xf5, 0xad, 0x5e, 0xa9, 0xe9, 0x74, + 0x63, 0x7b, 0xbd, 0xa4, 0x5a, 0x75, 0xfe, 0x3f, 0x61, 0xa1, 0x5d, 0x2e, 0x04, 0xbb, 0x34, 0x2e, + 0x4a, 0x4f, 0x62, 0x65, 0x7a, 0xd3, 0xc6, 0x64, 0x7d, 0x88, 0xfd, 0x10, 0xfe, 0xc6, 0xff, 0x03, + 0x00, 0x00, 0xff, 0xff, 0xe0, 0x14, 0x63, 0x51, 0xb3, 0x27, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -3152,6 +3172,21 @@ func (m *Chain) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size, err := m.Metadata.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 + if m.Phase != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Phase)) + i-- + dAtA[i] = 0x48 + } if len(m.Denylist) > 0 { for iNdEx := len(m.Denylist) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.Denylist[iNdEx]) @@ -3398,12 +3433,12 @@ func (m *QueryThrottleStateResponse) MarshalToSizedBuffer(dAtA []byte) (int, err _ = i var l int _ = l - n4, err4 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.NextReplenishCandidate, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.NextReplenishCandidate):]) - if err4 != nil { - return 0, err4 + n5, err5 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.NextReplenishCandidate, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.NextReplenishCandidate):]) + if err5 != nil { + return 0, err5 } - i -= n4 - i = encodeVarintQuery(dAtA, i, uint64(n4)) + i -= n5 + i = encodeVarintQuery(dAtA, i, uint64(n5)) i-- dAtA[i] = 0x1a if m.SlashMeterAllowance != 0 { @@ -4432,6 +4467,11 @@ func (m *Chain) Size() (n int) { n += 1 + l + sovQuery(uint64(l)) } } + if m.Phase != 0 { + n += 1 + sovQuery(uint64(m.Phase)) + } + l = m.Metadata.Size() + n += 1 + l + sovQuery(uint64(l)) return n } @@ -5732,6 +5772,58 @@ func (m *Chain) Unmarshal(dAtA []byte) error { } m.Denylist = append(m.Denylist, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Phase", wireType) + } + m.Phase = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Phase |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Metadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) From 8a1e8492091416e5ee6c7c4ece74a39edbb71fce Mon Sep 17 00:00:00 2001 From: Simon Noetzlin Date: Mon, 26 Aug 2024 11:24:35 +0200 Subject: [PATCH 03/17] first logic draft --- .../ccv/provider/v1/query.proto | 5 +- x/ccv/provider/keeper/grpc_query.go | 43 +- x/ccv/provider/keeper/grpc_query_test.go | 5 +- x/ccv/provider/types/query.pb.go | 386 +++++++++++------- x/ccv/provider/types/query.pb.gw.go | 18 + 5 files changed, 295 insertions(+), 162 deletions(-) diff --git a/proto/interchain_security/ccv/provider/v1/query.proto b/proto/interchain_security/ccv/provider/v1/query.proto index 39de15d244..af687dbd5a 100644 --- a/proto/interchain_security/ccv/provider/v1/query.proto +++ b/proto/interchain_security/ccv/provider/v1/query.proto @@ -191,7 +191,10 @@ message QueryConsumerGenesisResponse { [ (gogoproto.nullable) = false ]; } -message QueryConsumerChainsRequest {} +message QueryConsumerChainsRequest { + bool filter_by_phase = 1; + uint32 phase = 2; +} message QueryConsumerChainsResponse { repeated Chain chains = 1; } diff --git a/x/ccv/provider/keeper/grpc_query.go b/x/ccv/provider/keeper/grpc_query.go index 80900a6816..5f5b7db945 100644 --- a/x/ccv/provider/keeper/grpc_query.go +++ b/x/ccv/provider/keeper/grpc_query.go @@ -3,6 +3,7 @@ package keeper import ( "context" "fmt" + "strconv" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -11,6 +12,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" ) @@ -49,13 +51,46 @@ func (k Keeper) QueryConsumerChains(goCtx context.Context, req *types.QueryConsu ctx := sdk.UnwrapSDKContext(goCtx) - chains := []*types.Chain{} - for _, chainID := range k.GetAllRegisteredConsumerIds(ctx) { - c, err := k.GetConsumerChain(ctx, chainID) + lastCID, err := strconv.Atoi(k.FetchAndIncrementConsumerId(ctx)) + if err != nil { + return nil, status.Error(codes.Internal, "failed to get last consumer ID") + } + + consumerIDs := []string{} + + if req.FilterByPhase { + switch phase := byte(req.Phase); phase { + case keeper.Launched: + for _, cID := range k.GetAllRegisteredConsumerIds(ctx) { + consumerIDs = append(consumerIDs, cID) + } + case keeper.Initialized: + consumerIDs = append(consumerIDs, k.GetInitializedConsumersReadyToLaunch(ctx, uint32(lastCID-1))...) + case keeper.Registered || keeper.FailedToLaunch || keeper.Stopped: + for i := 0; i < lastCID; i++ { + p, ok := k.GetConsumerPhase(ctx, strconv.Itoa(i)) + if !ok { + // log something + continue + } + if byte(p) == phase { + consumerIDs = append(consumerIDs, strconv.Itoa(i)) + } + } + + default: + return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("invalid consumer phase %s", phase)) + } + } + + chains := make([]*types.Chain, len(consumerIDs)) + for i, cID := range consumerIDs { + c, err := k.GetConsumerChain(ctx, cID) if err != nil { + // log something instead? return nil, status.Error(codes.Internal, err.Error()) } - chains = append(chains, &c) + chains[i] = &c } return &types.QueryConsumerChainsResponse{Chains: chains}, nil diff --git a/x/ccv/provider/keeper/grpc_query_test.go b/x/ccv/provider/keeper/grpc_query_test.go index 81a9f4512a..32b8e1bf28 100644 --- a/x/ccv/provider/keeper/grpc_query_test.go +++ b/x/ccv/provider/keeper/grpc_query_test.go @@ -2,7 +2,6 @@ package keeper_test import ( "fmt" - "strconv" "testing" "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" @@ -330,7 +329,7 @@ func TestGetConsumerChain(t *testing.T) { pk.FetchAndIncrementConsumerId(ctx) expectedGetAllOrder := []types.Chain{} - for i, _ := range chainIDs { + for i, chainID := range chainIDs { consumerID := pk.FetchAndIncrementConsumerId(ctx) consumerIDs[i] = consumerID @@ -359,7 +358,7 @@ func TestGetConsumerChain(t *testing.T) { strDenylist[j] = addr.String() } - metadataLists[i] = types.ConsumerMetadata{Name: "consumer-" + strconv.Itoa(i)} + metadataLists[i] = types.ConsumerMetadata{Name: chainID} pk.SetConsumerMetadata(ctx, consumerID, metadataLists[i]) phase := uint32(i) diff --git a/x/ccv/provider/types/query.pb.go b/x/ccv/provider/types/query.pb.go index c667a7c590..d8b10d21ee 100644 --- a/x/ccv/provider/types/query.pb.go +++ b/x/ccv/provider/types/query.pb.go @@ -137,6 +137,8 @@ func (m *QueryConsumerGenesisResponse) GetGenesisState() types.ConsumerGenesisSt } type QueryConsumerChainsRequest struct { + FilterByPhase bool `protobuf:"varint,1,opt,name=filter_by_phase,json=filterByPhase,proto3" json:"filter_by_phase,omitempty"` + Phase uint32 `protobuf:"varint,2,opt,name=phase,proto3" json:"phase,omitempty"` } func (m *QueryConsumerChainsRequest) Reset() { *m = QueryConsumerChainsRequest{} } @@ -172,6 +174,20 @@ func (m *QueryConsumerChainsRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryConsumerChainsRequest proto.InternalMessageInfo +func (m *QueryConsumerChainsRequest) GetFilterByPhase() bool { + if m != nil { + return m.FilterByPhase + } + return false +} + +func (m *QueryConsumerChainsRequest) GetPhase() uint32 { + if m != nil { + return m.Phase + } + return 0 +} + type QueryConsumerChainsResponse struct { Chains []*Chain `protobuf:"bytes,1,rep,name=chains,proto3" json:"chains,omitempty"` } @@ -2029,161 +2045,163 @@ func init() { } var fileDescriptor_422512d7b7586cd7 = []byte{ - // 2460 bytes of a gzipped FileDescriptorProto + // 2488 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x5a, 0x4d, 0x6c, 0xdc, 0xc6, - 0x15, 0x16, 0x57, 0x3f, 0x96, 0x46, 0xb6, 0x9c, 0x8c, 0x65, 0x7b, 0xbd, 0x92, 0xb5, 0x32, 0x6d, - 0xb7, 0xf2, 0xdf, 0x52, 0x52, 0xe0, 0x26, 0x76, 0xeb, 0xd8, 0xda, 0x95, 0x65, 0x2f, 0xfc, 0xa7, - 0xd0, 0xb2, 0x53, 0x28, 0x55, 0xe9, 0x11, 0x39, 0x5d, 0xb1, 0xe2, 0x92, 0x14, 0x67, 0xb4, 0xf6, - 0xc2, 0xf0, 0x21, 0x2d, 0xd0, 0x26, 0x3d, 0x14, 0x2e, 0x8a, 0xde, 0x73, 0x29, 0xd0, 0x43, 0x4f, - 0x45, 0xd0, 0xa2, 0xb7, 0x1c, 0x73, 0x6b, 0x9a, 0x5c, 0x8a, 0x16, 0x70, 0x0b, 0xbb, 0x87, 0xa2, - 0x40, 0x81, 0x22, 0xed, 0xb5, 0x40, 0xc1, 0xe1, 0x90, 0x4b, 0x52, 0x5c, 0x2d, 0xb9, 0xab, 0x43, - 0x6e, 0xe2, 0xcc, 0x9b, 0x6f, 0xde, 0x7b, 0xf3, 0xe6, 0xcd, 0x7b, 0xdf, 0x0a, 0x48, 0xba, 0x49, - 0xb1, 0xa3, 0x6e, 0x20, 0xdd, 0x54, 0x08, 0x56, 0xb7, 0x1d, 0x9d, 0x36, 0x25, 0x55, 0x6d, 0x48, - 0xb6, 0x63, 0x35, 0x74, 0x0d, 0x3b, 0x52, 0x63, 0x4e, 0xda, 0xda, 0xc6, 0x4e, 0xb3, 0x64, 0x3b, - 0x16, 0xb5, 0xe0, 0xc9, 0x84, 0x05, 0x25, 0x55, 0x6d, 0x94, 0xfc, 0x05,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x08, 0x5f, 0xa2, 0x22, 0x3b, 0x3f, 0xc8, 0xf0, 0x60, 0x38, 0xc7, 0x16, 0x55, 0x90, 0x0d, + 0xcf, 0x80, 0xd7, 0x83, 0x51, 0x85, 0x60, 0xca, 0xc4, 0x87, 0x98, 0xf8, 0x81, 0x60, 0xe2, 0x1e, + 0xa6, 0xae, 0xec, 0x14, 0x18, 0x41, 0x86, 0x61, 0x3d, 0x36, 0x74, 0x42, 0xf3, 0xfb, 0x66, 0xfa, + 0x67, 0x47, 0xe4, 0x70, 0x00, 0x16, 0xc0, 0xb0, 0x86, 0xcd, 0x26, 0x9b, 0x1c, 0x66, 0x93, 0xc1, + 0x77, 0x18, 0xfc, 0x23, 0x91, 0xe0, 0x87, 0xef, 0x81, 0xe1, 0x3a, 0xa6, 0x48, 0x43, 0x14, 0xe5, + 0x01, 0x3b, 0x8c, 0x0b, 0x1d, 0x1d, 0xc6, 0x6d, 0xbe, 0x98, 0xdf, 0xda, 0x00, 0x4c, 0xfc, 0xa5, + 0x00, 0x8e, 0xb3, 0x90, 0x78, 0xe0, 0x5b, 0x10, 0x89, 0x39, 0x27, 0x63, 0x52, 0xba, 0x0c, 0x5e, + 0xf3, 0x37, 0x55, 0x90, 0xa6, 0x39, 0x98, 0x10, 0xef, 0xc0, 0xca, 0xf0, 0xeb, 0x17, 0xc5, 0xf1, + 0x26, 0xaa, 0x1b, 0x97, 0x44, 0x3e, 0x21, 0xca, 0x07, 0x7c, 0xd9, 0x45, 0x6f, 0x24, 0x99, 0xd3, + 0xfa, 0x93, 0x39, 0xed, 0xd2, 0xf0, 0x47, 0x9f, 0x14, 0xfb, 0xfe, 0xf6, 0x49, 0xb1, 0x4f, 0xbc, + 0x0b, 0xc4, 0xdd, 0xb4, 0xe5, 0xb1, 0x7b, 0x1a, 0xbc, 0x16, 0x00, 0xfa, 0xfa, 0x78, 0xc1, 0x75, + 0x40, 0x8d, 0xc8, 0xbb, 0xda, 0xec, 0xb4, 0x7f, 0x25, 0xa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12, 0x65, + 0x7a, 0xd3, 0xc6, 0x64, 0x7d, 0x88, 0xfd, 0x10, 0xfe, 0xe6, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, + 0x3a, 0xd8, 0xf6, 0x19, 0xf1, 0x27, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2996,6 +3014,21 @@ func (m *QueryConsumerChainsRequest) MarshalToSizedBuffer(dAtA []byte) (int, err _ = i var l int _ = l + if m.Phase != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Phase)) + i-- + dAtA[i] = 0x10 + } + if m.FilterByPhase { + i-- + if m.FilterByPhase { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } return len(dAtA) - i, nil } @@ -4367,6 +4400,12 @@ func (m *QueryConsumerChainsRequest) Size() (n int) { } var l int _ = l + if m.FilterByPhase { + n += 2 + } + if m.Phase != 0 { + n += 1 + sovQuery(uint64(m.Phase)) + } return n } @@ -5162,6 +5201,45 @@ func (m *QueryConsumerChainsRequest) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: QueryConsumerChainsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FilterByPhase", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.FilterByPhase = bool(v != 0) + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Phase", wireType) + } + m.Phase = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Phase |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) diff --git a/x/ccv/provider/types/query.pb.gw.go b/x/ccv/provider/types/query.pb.gw.go index a533712da9..240e893285 100644 --- a/x/ccv/provider/types/query.pb.gw.go +++ b/x/ccv/provider/types/query.pb.gw.go @@ -177,10 +177,21 @@ func local_request_Query_QueryConsumerGenesis_1(ctx context.Context, marshaler r } +var ( + filter_Query_QueryConsumerChains_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + func request_Query_QueryConsumerChains_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryConsumerChainsRequest var metadata runtime.ServerMetadata + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryConsumerChains_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := client.QueryConsumerChains(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err @@ -190,6 +201,13 @@ func local_request_Query_QueryConsumerChains_0(ctx context.Context, marshaler ru var protoReq QueryConsumerChainsRequest var metadata runtime.ServerMetadata + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryConsumerChains_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.QueryConsumerChains(ctx, &protoReq) return msg, metadata, err From 4d72cf4f6576bbd8f8ea03a10febdad9ff751908 Mon Sep 17 00:00:00 2001 From: Simon Noetzlin Date: Mon, 26 Aug 2024 15:19:21 +0200 Subject: [PATCH 04/17] add filter --- .../ccv/provider/v1/query.proto | 8 +- x/ccv/provider/keeper/grpc_query.go | 51 +++++---- x/ccv/provider/keeper/grpc_query_test.go | 107 +++++++++++++++++- x/ccv/provider/keeper/permissionless.go | 32 ++++++ x/ccv/provider/types/query.pb.go | 10 +- 5 files changed, 177 insertions(+), 31 deletions(-) diff --git a/proto/interchain_security/ccv/provider/v1/query.proto b/proto/interchain_security/ccv/provider/v1/query.proto index af687dbd5a..8a74108d2a 100644 --- a/proto/interchain_security/ccv/provider/v1/query.proto +++ b/proto/interchain_security/ccv/provider/v1/query.proto @@ -192,8 +192,12 @@ message QueryConsumerGenesisResponse { } message QueryConsumerChainsRequest { + // filter_by_phase enable the filtering of the consumer chains + // returned by phase, default is "Launched" bool filter_by_phase = 1; - uint32 phase = 2; +// The phase of the consumer chains returned +// Registered=0|Initialized=1|FailedToLaunched=2|Launched=3|Stopped=4 +uint32 phase = 2; } message QueryConsumerChainsResponse { repeated Chain chains = 1; } @@ -228,7 +232,7 @@ message Chain { repeated string allowlist = 7; // Corresponds to a list of provider consensus addresses of validators that CANNOT validate the consumer chain. repeated string denylist = 8; - // The phase the consumer chain is (Registered=0|Initialized=1|FailedToLaunched=2|Launched=3|Stopped=4) + // The phase the consumer chain is in (Registered=0|Initialized=1|FailedToLaunched=2|Launched=3|Stopped=4) uint32 phase = 9; // The consumer chain metadata ConsumerMetadata metadata = 10 [(gogoproto.nullable) = false ]; diff --git a/x/ccv/provider/keeper/grpc_query.go b/x/ccv/provider/keeper/grpc_query.go index 5f5b7db945..4e0000c5fb 100644 --- a/x/ccv/provider/keeper/grpc_query.go +++ b/x/ccv/provider/keeper/grpc_query.go @@ -12,7 +12,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" ) @@ -58,29 +57,33 @@ func (k Keeper) QueryConsumerChains(goCtx context.Context, req *types.QueryConsu consumerIDs := []string{} + // return the consumer chains in the "Launched" phase by default + phase := Launched + + // update phase if filter flag is set if req.FilterByPhase { - switch phase := byte(req.Phase); phase { - case keeper.Launched: - for _, cID := range k.GetAllRegisteredConsumerIds(ctx) { - consumerIDs = append(consumerIDs, cID) + phase = ConsumerPhase(byte(req.Phase)) + } + + switch { + case phase == Launched: + consumerIDs = append(consumerIDs, k.GetAllRegisteredConsumerIds(ctx)...) + case phase == Initialized: + consumerIDs = append(consumerIDs, k.GetInitializedConsumers(ctx)...) + case phase == Registered || phase == FailedToLaunch || phase == Stopped: + for i := 0; i < lastCID; i++ { + p, ok := k.GetConsumerPhase(ctx, strconv.Itoa(i)) + if !ok { + // log something + continue } - case keeper.Initialized: - consumerIDs = append(consumerIDs, k.GetInitializedConsumersReadyToLaunch(ctx, uint32(lastCID-1))...) - case keeper.Registered || keeper.FailedToLaunch || keeper.Stopped: - for i := 0; i < lastCID; i++ { - p, ok := k.GetConsumerPhase(ctx, strconv.Itoa(i)) - if !ok { - // log something - continue - } - if byte(p) == phase { - consumerIDs = append(consumerIDs, strconv.Itoa(i)) - } + if p == phase { + consumerIDs = append(consumerIDs, strconv.Itoa(i)) } - - default: - return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("invalid consumer phase %s", phase)) } + + default: + return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("invalid consumer phase %v", phase)) } chains := make([]*types.Chain, len(consumerIDs)) @@ -98,10 +101,10 @@ func (k Keeper) QueryConsumerChains(goCtx context.Context, req *types.QueryConsu // GetConsumerChain returns a Chain data structure with all the necessary fields func (k Keeper) GetConsumerChain(ctx sdk.Context, consumerId string) (types.Chain, error) { - clientID, found := k.GetConsumerClientId(ctx, consumerId) - if !found { - return types.Chain{}, fmt.Errorf("cannot find clientID for consumer (%s)", consumerId) - } + clientID, _ := k.GetConsumerClientId(ctx, consumerId) + // if !found { + // return types.Chain{}, fmt.Errorf("cannot find clientID for consumer (%s)", consumerId) + // } topN := k.GetTopN(ctx, consumerId) diff --git a/x/ccv/provider/keeper/grpc_query_test.go b/x/ccv/provider/keeper/grpc_query_test.go index 32b8e1bf28..6f21554b37 100644 --- a/x/ccv/provider/keeper/grpc_query_test.go +++ b/x/ccv/provider/keeper/grpc_query_test.go @@ -2,9 +2,9 @@ package keeper_test import ( "fmt" + "strconv" "testing" - - "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" + "time" "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" @@ -18,6 +18,7 @@ import ( cryptotestutil "github.com/cosmos/interchain-security/v5/testutil/crypto" testkeeper "github.com/cosmos/interchain-security/v5/testutil/keeper" + "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" ) @@ -401,3 +402,105 @@ func TestQueryConsumerIdFromClientId(t *testing.T) { require.NoError(t, err) require.Equal(t, expectedConsumerId, res.ConsumerId) } + +// TestGetConsumerChain tests GetConsumerChain behaviour correctness +func TestGetConsumerChains(t *testing.T) { + pk, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + consumerNum := 4 + consumerIds := make([]string, consumerNum) + consumers := make([]*types.Chain, consumerNum) + + req := types.QueryConsumerChainsRequest{} + expectedResponse := types.QueryConsumerChainsResponse{ + Chains: []*types.Chain{}, + } + // expect to consumer + res, err := pk.QueryConsumerChains(ctx, &req) + require.NoError(t, err) + require.Equal(t, &expectedResponse, res) + + // create four consumer chains all in the "Registered" phase + for i := 0; i < consumerNum; i++ { + cID := pk.FetchAndIncrementConsumerId(ctx) + c := types.Chain{ + ChainId: cID, + MinPowerInTop_N: -1, + ValidatorsPowerCap: 0, + ValidatorSetCap: 0, + Allowlist: []string{}, + Denylist: []string{}, + Phase: uint32(keeper.Registered), + Metadata: types.ConsumerMetadata{Name: "consumer-" + strconv.Itoa(0)}, + } + pk.SetConsumerPhase(ctx, cID, keeper.ConsumerPhase(c.Phase)) + pk.SetConsumerMetadata(ctx, cID, c.Metadata) + + consumerIds[i] = cID + consumers[i] = &c + } + + // expect no consumers when phase filter isn't set + res, err = pk.QueryConsumerChains(ctx, &req) + require.NoError(t, err) + require.Equal(t, &expectedResponse, res) + + // expect all consumers when phase filter is enable and set to "Registered" + req.FilterByPhase = true + req.Phase = uint32(keeper.Registered) + expectedResponse.Chains = consumers + + res, err = pk.QueryConsumerChains(ctx, &req) + require.NoError(t, err) + require.Equal(t, &expectedResponse, res) + + // update a consumer to be perceived as "Launched" + consumers[0].ClientId = "clientID" + consumers[0].Phase = uint32(keeper.Launched) + pk.SetConsumerClientId(ctx, consumers[0].ChainId, "clientID") + pk.SetConsumerPhase(ctx, consumers[0].ChainId, keeper.Launched) + + // expect the updated consumers when phase filter is enable and set to "Registered" + req.FilterByPhase = true + req.Phase = uint32(keeper.Launched) + expectedResponse.Chains = consumers[0:1] + + res, err = pk.QueryConsumerChains(ctx, &req) + require.NoError(t, err) + require.Equal(t, &expectedResponse, res) + + // repeat the same test for the Initialized and FailedToLaunched and Stopped phase + // Initialized + req.Phase = uint32(keeper.Initialized) + consumers[1].Phase = uint32(keeper.Initialized) + + err = pk.AppendSpawnTimeForConsumerToBeLaunched(ctx, consumers[1].ChainId, time.Now()) + pk.SetConsumerPhase(ctx, consumers[1].ChainId, keeper.Initialized) + require.NoError(t, err) + expectedResponse.Chains = consumers[1:2] + + res, err = pk.QueryConsumerChains(ctx, &req) + require.NoError(t, err) + require.Equal(t, &expectedResponse, res) + + // Stopped + req.Phase = uint32(keeper.Stopped) + consumers[2].Phase = uint32(keeper.Stopped) + pk.SetConsumerPhase(ctx, consumers[2].ChainId, keeper.Stopped) + + expectedResponse.Chains = consumers[2:3] + res, err = pk.QueryConsumerChains(ctx, &req) + require.NoError(t, err) + require.Equal(t, &expectedResponse, res) + + // FailedToLaunch + req.Phase = uint32(keeper.FailedToLaunch) + consumers[3].Phase = uint32(keeper.FailedToLaunch) + pk.SetConsumerPhase(ctx, consumers[3].ChainId, keeper.FailedToLaunch) + + expectedResponse.Chains = consumers[3:] + res, err = pk.QueryConsumerChains(ctx, &req) + require.NoError(t, err) + require.Equal(t, &expectedResponse, res) +} diff --git a/x/ccv/provider/keeper/permissionless.go b/x/ccv/provider/keeper/permissionless.go index 4b209d0358..6553e9a209 100644 --- a/x/ccv/provider/keeper/permissionless.go +++ b/x/ccv/provider/keeper/permissionless.go @@ -564,6 +564,38 @@ func (k Keeper) GetInitializedConsumersReadyToLaunch(ctx sdk.Context, limit uint return result } +// TODO: @sainoe merge with func above +func (k Keeper) GetInitializedConsumers(ctx sdk.Context) []string { + store := ctx.KVStore(k.storeKey) + + spawnTimeToConsumerIdsKeyPrefix := types.SpawnTimeToConsumerIdsKeyPrefix() + iterator := storetypes.KVStorePrefixIterator(store, []byte{spawnTimeToConsumerIdsKeyPrefix}) + defer iterator.Close() + + result := []string{} + for ; iterator.Valid(); iterator.Next() { + spawnTime, err := types.ParseTime(types.SpawnTimeToConsumerIdsKeyPrefix(), iterator.Key()) + if err != nil { + k.Logger(ctx).Error("failed to parse spawn time", + "error", err) + continue + } + + // if current block time is equal to or after spawnTime, and the chain is initialized, we can launch the chain + consumerIds, err := k.GetConsumersToBeLaunched(ctx, spawnTime) + if err != nil { + k.Logger(ctx).Error("failed to retrieve consumers to launch", + "spawn time", spawnTime, + "error", err) + continue + } + + result = append(result, consumerIds.Ids...) + } + + return result +} + // LaunchConsumer launches the chain with the provided consumer id by creating the consumer client and the respective // consumer genesis file func (k Keeper) LaunchConsumer(ctx sdk.Context, consumerId string) error { diff --git a/x/ccv/provider/types/query.pb.go b/x/ccv/provider/types/query.pb.go index d8b10d21ee..1d05e0ecba 100644 --- a/x/ccv/provider/types/query.pb.go +++ b/x/ccv/provider/types/query.pb.go @@ -137,8 +137,12 @@ func (m *QueryConsumerGenesisResponse) GetGenesisState() types.ConsumerGenesisSt } type QueryConsumerChainsRequest struct { - FilterByPhase bool `protobuf:"varint,1,opt,name=filter_by_phase,json=filterByPhase,proto3" json:"filter_by_phase,omitempty"` - Phase uint32 `protobuf:"varint,2,opt,name=phase,proto3" json:"phase,omitempty"` + // filter_by_phase enable the filtering of the consumer chains + // returned by phase, default is "Launched" + FilterByPhase bool `protobuf:"varint,1,opt,name=filter_by_phase,json=filterByPhase,proto3" json:"filter_by_phase,omitempty"` + // The phase of the consumer chains returned + // Registered=0|Initialized=1|FailedToLaunched=2|Launched=3|Stopped=4 + Phase uint32 `protobuf:"varint,2,opt,name=phase,proto3" json:"phase,omitempty"` } func (m *QueryConsumerChainsRequest) Reset() { *m = QueryConsumerChainsRequest{} } @@ -418,7 +422,7 @@ type Chain struct { Allowlist []string `protobuf:"bytes,7,rep,name=allowlist,proto3" json:"allowlist,omitempty"` // Corresponds to a list of provider consensus addresses of validators that CANNOT validate the consumer chain. Denylist []string `protobuf:"bytes,8,rep,name=denylist,proto3" json:"denylist,omitempty"` - // The phase the consumer chain is (Registered=0|Initialized=1|FailedToLaunched=2|Launched=3|Stopped=4) + // The phase the consumer chain is in (Registered=0|Initialized=1|FailedToLaunched=2|Launched=3|Stopped=4) Phase uint32 `protobuf:"varint,9,opt,name=phase,proto3" json:"phase,omitempty"` // The consumer chain metadata Metadata ConsumerMetadata `protobuf:"bytes,10,opt,name=metadata,proto3" json:"metadata"` From d13ebffe591e8fbe86cb82ee3ddeeef35d1936fb Mon Sep 17 00:00:00 2001 From: Simon Noetzlin Date: Mon, 26 Aug 2024 15:45:38 +0200 Subject: [PATCH 05/17] reformat test --- x/ccv/provider/keeper/grpc_query_test.go | 142 +++++++++++------------ 1 file changed, 71 insertions(+), 71 deletions(-) diff --git a/x/ccv/provider/keeper/grpc_query_test.go b/x/ccv/provider/keeper/grpc_query_test.go index 6f21554b37..7c81f22fd4 100644 --- a/x/ccv/provider/keeper/grpc_query_test.go +++ b/x/ccv/provider/keeper/grpc_query_test.go @@ -408,19 +408,10 @@ func TestGetConsumerChains(t *testing.T) { pk, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - consumerNum := 4 + consumerNum := 5 consumerIds := make([]string, consumerNum) consumers := make([]*types.Chain, consumerNum) - req := types.QueryConsumerChainsRequest{} - expectedResponse := types.QueryConsumerChainsResponse{ - Chains: []*types.Chain{}, - } - // expect to consumer - res, err := pk.QueryConsumerChains(ctx, &req) - require.NoError(t, err) - require.Equal(t, &expectedResponse, res) - // create four consumer chains all in the "Registered" phase for i := 0; i < consumerNum; i++ { cID := pk.FetchAndIncrementConsumerId(ctx) @@ -441,66 +432,75 @@ func TestGetConsumerChains(t *testing.T) { consumers[i] = &c } - // expect no consumers when phase filter isn't set - res, err = pk.QueryConsumerChains(ctx, &req) - require.NoError(t, err) - require.Equal(t, &expectedResponse, res) - - // expect all consumers when phase filter is enable and set to "Registered" - req.FilterByPhase = true - req.Phase = uint32(keeper.Registered) - expectedResponse.Chains = consumers - - res, err = pk.QueryConsumerChains(ctx, &req) - require.NoError(t, err) - require.Equal(t, &expectedResponse, res) - - // update a consumer to be perceived as "Launched" - consumers[0].ClientId = "clientID" - consumers[0].Phase = uint32(keeper.Launched) - pk.SetConsumerClientId(ctx, consumers[0].ChainId, "clientID") - pk.SetConsumerPhase(ctx, consumers[0].ChainId, keeper.Launched) - - // expect the updated consumers when phase filter is enable and set to "Registered" - req.FilterByPhase = true - req.Phase = uint32(keeper.Launched) - expectedResponse.Chains = consumers[0:1] - - res, err = pk.QueryConsumerChains(ctx, &req) - require.NoError(t, err) - require.Equal(t, &expectedResponse, res) - - // repeat the same test for the Initialized and FailedToLaunched and Stopped phase - // Initialized - req.Phase = uint32(keeper.Initialized) - consumers[1].Phase = uint32(keeper.Initialized) - - err = pk.AppendSpawnTimeForConsumerToBeLaunched(ctx, consumers[1].ChainId, time.Now()) - pk.SetConsumerPhase(ctx, consumers[1].ChainId, keeper.Initialized) - require.NoError(t, err) - expectedResponse.Chains = consumers[1:2] - - res, err = pk.QueryConsumerChains(ctx, &req) - require.NoError(t, err) - require.Equal(t, &expectedResponse, res) - - // Stopped - req.Phase = uint32(keeper.Stopped) - consumers[2].Phase = uint32(keeper.Stopped) - pk.SetConsumerPhase(ctx, consumers[2].ChainId, keeper.Stopped) - - expectedResponse.Chains = consumers[2:3] - res, err = pk.QueryConsumerChains(ctx, &req) - require.NoError(t, err) - require.Equal(t, &expectedResponse, res) - - // FailedToLaunch - req.Phase = uint32(keeper.FailedToLaunch) - consumers[3].Phase = uint32(keeper.FailedToLaunch) - pk.SetConsumerPhase(ctx, consumers[3].ChainId, keeper.FailedToLaunch) + testCases := []struct { + name string + setup func(ctx sdk.Context, pk keeper.Keeper) + filterPhase bool + phase keeper.ConsumerPhase + expConsumers []*types.Chain + }{{ + name: "expect no consumers when phase filter isn't set", + setup: func(ctx sdk.Context, pk keeper.Keeper) {}, + expConsumers: []*types.Chain{}, + }, { + name: "expect all consumers when phase filter is enabled and set to Registered", + setup: func(ctx sdk.Context, pk keeper.Keeper) {}, + filterPhase: true, + phase: keeper.Registered, + expConsumers: consumers, + }, { + name: "expect launched consumers when phase filter is enabled and set to Launched", + setup: func(ctx sdk.Context, pk keeper.Keeper) { + consumers[1].ClientId = "clientID" + consumers[1].Phase = uint32(keeper.Launched) + pk.SetConsumerClientId(ctx, consumers[1].ChainId, "clientID") + pk.SetConsumerPhase(ctx, consumers[1].ChainId, keeper.Launched) + }, + filterPhase: true, + phase: keeper.Launched, + expConsumers: consumers[1:2], + }, { + name: "expect initialized consumers when phase filter is enabled and set to Initialized", + setup: func(ctx sdk.Context, pk keeper.Keeper) { + consumers[2].Phase = uint32(keeper.Initialized) + err := pk.AppendSpawnTimeForConsumerToBeLaunched(ctx, consumers[2].ChainId, time.Now()) + require.NoError(t, err) + pk.SetConsumerPhase(ctx, consumers[2].ChainId, keeper.Initialized) + }, + filterPhase: true, + phase: keeper.Initialized, + expConsumers: consumers[2:3], + }, { + name: "expect consumers that failed to launch when phase filter is enabled and set to FailToLaunch", + setup: func(ctx sdk.Context, pk keeper.Keeper) { + consumers[3].Phase = uint32(keeper.FailedToLaunch) + pk.SetConsumerPhase(ctx, consumers[3].ChainId, keeper.FailedToLaunch) + }, + filterPhase: true, + phase: keeper.FailedToLaunch, + expConsumers: consumers[3:4], + }, { + name: "expect stopped consumers when phase filter is enabled and set to Stopped", + setup: func(ctx sdk.Context, pk keeper.Keeper) { + consumers[4].Phase = uint32(keeper.Stopped) + pk.SetConsumerPhase(ctx, consumers[4].ChainId, keeper.Stopped) + }, + filterPhase: true, + phase: keeper.Stopped, + expConsumers: consumers[4:], + }, + } - expectedResponse.Chains = consumers[3:] - res, err = pk.QueryConsumerChains(ctx, &req) - require.NoError(t, err) - require.Equal(t, &expectedResponse, res) + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + tc.setup(ctx, pk) + req := types.QueryConsumerChainsRequest{tc.filterPhase, uint32(tc.phase)} + expectedResponse := types.QueryConsumerChainsResponse{ + Chains: tc.expConsumers, + } + res, err := pk.QueryConsumerChains(ctx, &req) + require.NoError(t, err) + require.Equal(t, &expectedResponse, res) + }) + } } From b9e26006018e46a15f04c72a5eb457c5a6276dc6 Mon Sep 17 00:00:00 2001 From: Simon Noetzlin Date: Mon, 26 Aug 2024 15:49:35 +0200 Subject: [PATCH 06/17] nits --- .../ccv/provider/v1/query.proto | 10 ++++----- x/ccv/provider/keeper/grpc_query.go | 21 ++++++++----------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/proto/interchain_security/ccv/provider/v1/query.proto b/proto/interchain_security/ccv/provider/v1/query.proto index 8a74108d2a..b5eac135d6 100644 --- a/proto/interchain_security/ccv/provider/v1/query.proto +++ b/proto/interchain_security/ccv/provider/v1/query.proto @@ -192,12 +192,12 @@ message QueryConsumerGenesisResponse { } message QueryConsumerChainsRequest { - // filter_by_phase enable the filtering of the consumer chains - // returned by phase, default is "Launched" + // filter_by_phase enables the filtering of the consumer chains + // returned by phase, default is "Launched" bool filter_by_phase = 1; -// The phase of the consumer chains returned -// Registered=0|Initialized=1|FailedToLaunched=2|Launched=3|Stopped=4 -uint32 phase = 2; + // The phase of the consumer chains returned + // Registered=0|Initialized=1|FailedToLaunched=2|Launched=3|Stopped=4 + uint32 phase = 2; } message QueryConsumerChainsResponse { repeated Chain chains = 1; } diff --git a/x/ccv/provider/keeper/grpc_query.go b/x/ccv/provider/keeper/grpc_query.go index 4e0000c5fb..09e009b647 100644 --- a/x/ccv/provider/keeper/grpc_query.go +++ b/x/ccv/provider/keeper/grpc_query.go @@ -50,9 +50,9 @@ func (k Keeper) QueryConsumerChains(goCtx context.Context, req *types.QueryConsu ctx := sdk.UnwrapSDKContext(goCtx) - lastCID, err := strconv.Atoi(k.FetchAndIncrementConsumerId(ctx)) - if err != nil { - return nil, status.Error(codes.Internal, "failed to get last consumer ID") + lastCID, ok := k.GetConsumerId(ctx) + if !ok { + return &types.QueryConsumerChainsResponse{}, nil } consumerIDs := []string{} @@ -71,14 +71,14 @@ func (k Keeper) QueryConsumerChains(goCtx context.Context, req *types.QueryConsu case phase == Initialized: consumerIDs = append(consumerIDs, k.GetInitializedConsumers(ctx)...) case phase == Registered || phase == FailedToLaunch || phase == Stopped: - for i := 0; i < lastCID; i++ { - p, ok := k.GetConsumerPhase(ctx, strconv.Itoa(i)) + for i := uint64(0); i <= lastCID; i++ { + p, ok := k.GetConsumerPhase(ctx, strconv.FormatInt(int64(i), 10)) if !ok { // log something continue } if p == phase { - consumerIDs = append(consumerIDs, strconv.Itoa(i)) + consumerIDs = append(consumerIDs, strconv.FormatInt(int64(i), 10)) } } @@ -101,12 +101,6 @@ func (k Keeper) QueryConsumerChains(goCtx context.Context, req *types.QueryConsu // GetConsumerChain returns a Chain data structure with all the necessary fields func (k Keeper) GetConsumerChain(ctx sdk.Context, consumerId string) (types.Chain, error) { - clientID, _ := k.GetConsumerClientId(ctx, consumerId) - // if !found { - // return types.Chain{}, fmt.Errorf("cannot find clientID for consumer (%s)", consumerId) - // } - - topN := k.GetTopN(ctx, consumerId) // Get the minimal power in the top N for the consumer chain minPowerInTopN, found := k.GetMinimumPowerInTopN(ctx, consumerId) @@ -141,6 +135,9 @@ func (k Keeper) GetConsumerChain(ctx sdk.Context, consumerId string) (types.Chai return types.Chain{}, fmt.Errorf("cannot get metadata for consumer (%s): %w", consumerId, err) } + clientID, _ := k.GetConsumerClientId(ctx, consumerId) + topN := k.GetTopN(ctx, consumerId) + return types.Chain{ ChainId: consumerId, ClientId: clientID, From 0dbfd70eb7835465d170a9cbcfa52854b9ae74fc Mon Sep 17 00:00:00 2001 From: Simon Noetzlin Date: Mon, 26 Aug 2024 15:59:10 +0200 Subject: [PATCH 07/17] nit --- proto/interchain_security/ccv/provider/v1/query.proto | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proto/interchain_security/ccv/provider/v1/query.proto b/proto/interchain_security/ccv/provider/v1/query.proto index b5eac135d6..e188f24265 100644 --- a/proto/interchain_security/ccv/provider/v1/query.proto +++ b/proto/interchain_security/ccv/provider/v1/query.proto @@ -232,9 +232,9 @@ message Chain { repeated string allowlist = 7; // Corresponds to a list of provider consensus addresses of validators that CANNOT validate the consumer chain. repeated string denylist = 8; - // The phase the consumer chain is in (Registered=0|Initialized=1|FailedToLaunched=2|Launched=3|Stopped=4) + // The phase the consumer chain (Registered=0|Initialized=1|FailedToLaunched=2|Launched=3|Stopped=4) uint32 phase = 9; - // The consumer chain metadata + // The metadata of the consumer chain ConsumerMetadata metadata = 10 [(gogoproto.nullable) = false ]; } From ddae30a3ceafd153c924543b92ecbbdfc8e94a95 Mon Sep 17 00:00:00 2001 From: Simon Noetzlin Date: Tue, 27 Aug 2024 15:00:17 +0200 Subject: [PATCH 08/17] address comments --- .../ccv/provider/v1/query.proto | 4 +- x/ccv/provider/keeper/grpc_query.go | 42 +++++++++---------- x/ccv/provider/keeper/grpc_query_test.go | 36 ++++++++-------- x/ccv/provider/keeper/permissionless.go | 1 + 4 files changed, 42 insertions(+), 41 deletions(-) diff --git a/proto/interchain_security/ccv/provider/v1/query.proto b/proto/interchain_security/ccv/provider/v1/query.proto index e188f24265..bd13c7003a 100644 --- a/proto/interchain_security/ccv/provider/v1/query.proto +++ b/proto/interchain_security/ccv/provider/v1/query.proto @@ -196,7 +196,7 @@ message QueryConsumerChainsRequest { // returned by phase, default is "Launched" bool filter_by_phase = 1; // The phase of the consumer chains returned - // Registered=0|Initialized=1|FailedToLaunched=2|Launched=3|Stopped=4 + // Registered=0|Initialized=1|FailedToLaunch=2|Launched=3|Stopped=4 uint32 phase = 2; } @@ -232,7 +232,7 @@ message Chain { repeated string allowlist = 7; // Corresponds to a list of provider consensus addresses of validators that CANNOT validate the consumer chain. repeated string denylist = 8; - // The phase the consumer chain (Registered=0|Initialized=1|FailedToLaunched=2|Launched=3|Stopped=4) + // The phase the consumer chain (Registered=0|Initialized=1|FailedToLaunch=2|Launched=3|Stopped=4) uint32 phase = 9; // The metadata of the consumer chain ConsumerMetadata metadata = 10 [(gogoproto.nullable) = false ]; diff --git a/x/ccv/provider/keeper/grpc_query.go b/x/ccv/provider/keeper/grpc_query.go index 09e009b647..3e6c97bf41 100644 --- a/x/ccv/provider/keeper/grpc_query.go +++ b/x/ccv/provider/keeper/grpc_query.go @@ -55,7 +55,7 @@ func (k Keeper) QueryConsumerChains(goCtx context.Context, req *types.QueryConsu return &types.QueryConsumerChainsResponse{}, nil } - consumerIDs := []string{} + consumerIds := []string{} // return the consumer chains in the "Launched" phase by default phase := Launched @@ -67,9 +67,9 @@ func (k Keeper) QueryConsumerChains(goCtx context.Context, req *types.QueryConsu switch { case phase == Launched: - consumerIDs = append(consumerIDs, k.GetAllRegisteredConsumerIds(ctx)...) + consumerIds = append(consumerIds, k.GetAllRegisteredConsumerIds(ctx)...) case phase == Initialized: - consumerIDs = append(consumerIDs, k.GetInitializedConsumers(ctx)...) + consumerIds = append(consumerIds, k.GetInitializedConsumers(ctx)...) case phase == Registered || phase == FailedToLaunch || phase == Stopped: for i := uint64(0); i <= lastCID; i++ { p, ok := k.GetConsumerPhase(ctx, strconv.FormatInt(int64(i), 10)) @@ -78,7 +78,7 @@ func (k Keeper) QueryConsumerChains(goCtx context.Context, req *types.QueryConsu continue } if p == phase { - consumerIDs = append(consumerIDs, strconv.FormatInt(int64(i), 10)) + consumerIds = append(consumerIds, strconv.FormatInt(int64(i), 10)) } } @@ -86,8 +86,8 @@ func (k Keeper) QueryConsumerChains(goCtx context.Context, req *types.QueryConsu return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("invalid consumer phase %v", phase)) } - chains := make([]*types.Chain, len(consumerIDs)) - for i, cID := range consumerIDs { + chains := make([]*types.Chain, len(consumerIds)) + for i, cID := range consumerIds { c, err := k.GetConsumerChain(ctx, cID) if err != nil { // log something instead? @@ -109,9 +109,17 @@ func (k Keeper) GetConsumerChain(ctx sdk.Context, consumerId string) (types.Chai minPowerInTopN = -1 } - validatorSetCap := k.GetValidatorSetCap(ctx, consumerId) + chainID, err := k.GetConsumerChainId(ctx, consumerId) + if err != nil { + return types.Chain{}, fmt.Errorf("cannot find chain ID for consumer (%s)", consumerId) + } - validatorsPowerCap := k.GetValidatorsPowerCap(ctx, consumerId) + clientId, _ := k.GetConsumerClientId(ctx, consumerId) + + phase, ok := k.GetConsumerPhase(ctx, consumerId) + if !ok { + return types.Chain{}, fmt.Errorf("cannot find phase for consumer (%s)", consumerId) + } allowlist := k.GetAllowList(ctx, consumerId) strAllowlist := make([]string, len(allowlist)) @@ -125,26 +133,18 @@ func (k Keeper) GetConsumerChain(ctx sdk.Context, consumerId string) (types.Chai strDenylist[i] = addr.String() } - phase, ok := k.GetConsumerPhase(ctx, consumerId) - if !ok { - return types.Chain{}, fmt.Errorf("cannot find phase for consumer (%s)", consumerId) - } - metadata, err := k.GetConsumerMetadata(ctx, consumerId) if err != nil { return types.Chain{}, fmt.Errorf("cannot get metadata for consumer (%s): %w", consumerId, err) } - clientID, _ := k.GetConsumerClientId(ctx, consumerId) - topN := k.GetTopN(ctx, consumerId) - return types.Chain{ - ChainId: consumerId, - ClientId: clientID, - Top_N: topN, + ChainId: chainID, + ClientId: clientId, + Top_N: k.GetTopN(ctx, consumerId), MinPowerInTop_N: minPowerInTopN, - ValidatorSetCap: validatorSetCap, - ValidatorsPowerCap: validatorsPowerCap, + ValidatorSetCap: k.GetValidatorSetCap(ctx, consumerId), + ValidatorsPowerCap: k.GetValidatorsPowerCap(ctx, consumerId), Allowlist: strAllowlist, Denylist: strDenylist, Phase: uint32(phase), diff --git a/x/ccv/provider/keeper/grpc_query_test.go b/x/ccv/provider/keeper/grpc_query_test.go index 7c81f22fd4..cca4ca83e5 100644 --- a/x/ccv/provider/keeper/grpc_query_test.go +++ b/x/ccv/provider/keeper/grpc_query_test.go @@ -279,7 +279,7 @@ func TestGetConsumerChain(t *testing.T) { pk, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - chainIDs := []string{"chain-1", "chain-2", "chain-3", "chain-4"} + chainIds := []string{"chain-1", "chain-2", "chain-3", "chain-4"} // mock the validator set vals := []stakingtypes.Validator{ @@ -323,31 +323,31 @@ func TestGetConsumerChain(t *testing.T) { {}, } - metadataLists := make([]types.ConsumerMetadata, len(chainIDs)) - consumerIDs := make([]string, len(chainIDs)) + metadataLists := make([]types.ConsumerMetadata, len(chainIds)) + consumerIds := make([]string, len(chainIds)) // skip first consumerID pk.FetchAndIncrementConsumerId(ctx) expectedGetAllOrder := []types.Chain{} - for i, chainID := range chainIDs { - consumerID := pk.FetchAndIncrementConsumerId(ctx) - consumerIDs[i] = consumerID + for i, chainID := range chainIds { + consumerId := pk.FetchAndIncrementConsumerId(ctx) + consumerIds[i] = consumerId - clientID := fmt.Sprintf("client-%d", len(chainIDs)-i) + clientID := fmt.Sprintf("client-%d", len(chainIds)-i) topN := topNs[i] - pk.SetConsumerClientId(ctx, consumerID, clientID) - pk.SetConsumerPowerShapingParameters(ctx, consumerID, types.PowerShapingParameters{ + pk.SetConsumerClientId(ctx, consumerId, clientID) + pk.SetConsumerPowerShapingParameters(ctx, consumerId, types.PowerShapingParameters{ Top_N: topN, ValidatorSetCap: validatorSetCaps[i], ValidatorsPowerCap: validatorPowerCaps[i], }) - pk.SetMinimumPowerInTopN(ctx, consumerID, expectedMinPowerInTopNs[i]) + pk.SetMinimumPowerInTopN(ctx, consumerId, expectedMinPowerInTopNs[i]) for _, addr := range allowlists[i] { - pk.SetAllowlist(ctx, consumerID, addr) + pk.SetAllowlist(ctx, consumerId, addr) } for _, addr := range denylists[i] { - pk.SetDenylist(ctx, consumerID, addr) + pk.SetDenylist(ctx, consumerId, addr) } strAllowlist := make([]string, len(allowlists[i])) for j, addr := range allowlists[i] { @@ -360,14 +360,14 @@ func TestGetConsumerChain(t *testing.T) { } metadataLists[i] = types.ConsumerMetadata{Name: chainID} - pk.SetConsumerMetadata(ctx, consumerID, metadataLists[i]) + pk.SetConsumerMetadata(ctx, consumerId, metadataLists[i]) phase := uint32(i) - pk.SetConsumerPhase(ctx, consumerID, keeper.ConsumerPhase(byte(phase))) + pk.SetConsumerPhase(ctx, consumerId, keeper.ConsumerPhase(byte(phase))) expectedGetAllOrder = append(expectedGetAllOrder, types.Chain{ - ChainId: consumerID, + ChainId: consumerId, ClientId: clientID, Top_N: topN, MinPowerInTop_N: expectedMinPowerInTopNs[i], @@ -380,8 +380,8 @@ func TestGetConsumerChain(t *testing.T) { }) } - for i, cID := range consumerIDs { - c, err := pk.GetConsumerChain(ctx, cID) + for i, cId := range consumerIds { + c, err := pk.GetConsumerChain(ctx, cId) require.NoError(t, err) require.Equal(t, expectedGetAllOrder[i], c) } @@ -412,7 +412,7 @@ func TestGetConsumerChains(t *testing.T) { consumerIds := make([]string, consumerNum) consumers := make([]*types.Chain, consumerNum) - // create four consumer chains all in the "Registered" phase + // create five consumer chains all in the "Registered" phase for i := 0; i < consumerNum; i++ { cID := pk.FetchAndIncrementConsumerId(ctx) c := types.Chain{ diff --git a/x/ccv/provider/keeper/permissionless.go b/x/ccv/provider/keeper/permissionless.go index 6553e9a209..7bf6a3e7cd 100644 --- a/x/ccv/provider/keeper/permissionless.go +++ b/x/ccv/provider/keeper/permissionless.go @@ -564,6 +564,7 @@ func (k Keeper) GetInitializedConsumersReadyToLaunch(ctx sdk.Context, limit uint return result } +// GetInitializedConsumers returns the initialized consumer chains // TODO: @sainoe merge with func above func (k Keeper) GetInitializedConsumers(ctx sdk.Context) []string { store := ctx.KVStore(k.storeKey) From 7133fb0d55d821b09df4dc448c0882c132b2a1cb Mon Sep 17 00:00:00 2001 From: Simon Noetzlin Date: Tue, 27 Aug 2024 15:46:19 +0200 Subject: [PATCH 09/17] update tests --- .../ccv/provider/v1/query.proto | 7 +- x/ccv/provider/keeper/grpc_query.go | 12 +- x/ccv/provider/keeper/grpc_query_test.go | 107 +++-- x/ccv/provider/types/query.pb.go | 365 ++++++++---------- 4 files changed, 214 insertions(+), 277 deletions(-) diff --git a/proto/interchain_security/ccv/provider/v1/query.proto b/proto/interchain_security/ccv/provider/v1/query.proto index bd13c7003a..79df866843 100644 --- a/proto/interchain_security/ccv/provider/v1/query.proto +++ b/proto/interchain_security/ccv/provider/v1/query.proto @@ -192,12 +192,9 @@ message QueryConsumerGenesisResponse { } message QueryConsumerChainsRequest { - // filter_by_phase enables the filtering of the consumer chains - // returned by phase, default is "Launched" - bool filter_by_phase = 1; - // The phase of the consumer chains returned + // The phase of the consumer chains returned, default is 0 i.e. "Registered" // Registered=0|Initialized=1|FailedToLaunch=2|Launched=3|Stopped=4 - uint32 phase = 2; + uint32 phase = 1; } message QueryConsumerChainsResponse { repeated Chain chains = 1; } diff --git a/x/ccv/provider/keeper/grpc_query.go b/x/ccv/provider/keeper/grpc_query.go index 3e6c97bf41..4c33bd1521 100644 --- a/x/ccv/provider/keeper/grpc_query.go +++ b/x/ccv/provider/keeper/grpc_query.go @@ -56,14 +56,7 @@ func (k Keeper) QueryConsumerChains(goCtx context.Context, req *types.QueryConsu } consumerIds := []string{} - - // return the consumer chains in the "Launched" phase by default - phase := Launched - - // update phase if filter flag is set - if req.FilterByPhase { - phase = ConsumerPhase(byte(req.Phase)) - } + phase := ConsumerPhase(byte(req.Phase)) switch { case phase == Launched: @@ -101,7 +94,6 @@ func (k Keeper) QueryConsumerChains(goCtx context.Context, req *types.QueryConsu // GetConsumerChain returns a Chain data structure with all the necessary fields func (k Keeper) GetConsumerChain(ctx sdk.Context, consumerId string) (types.Chain, error) { - // Get the minimal power in the top N for the consumer chain minPowerInTopN, found := k.GetMinimumPowerInTopN(ctx, consumerId) if !found { @@ -111,7 +103,7 @@ func (k Keeper) GetConsumerChain(ctx sdk.Context, consumerId string) (types.Chai chainID, err := k.GetConsumerChainId(ctx, consumerId) if err != nil { - return types.Chain{}, fmt.Errorf("cannot find chain ID for consumer (%s)", consumerId) + return types.Chain{}, fmt.Errorf("cannot find chain ID for consumer (%s):%s", consumerId, err) } clientId, _ := k.GetConsumerClientId(ctx, consumerId) diff --git a/x/ccv/provider/keeper/grpc_query_test.go b/x/ccv/provider/keeper/grpc_query_test.go index cca4ca83e5..258dd817e1 100644 --- a/x/ccv/provider/keeper/grpc_query_test.go +++ b/x/ccv/provider/keeper/grpc_query_test.go @@ -334,6 +334,7 @@ func TestGetConsumerChain(t *testing.T) { consumerId := pk.FetchAndIncrementConsumerId(ctx) consumerIds[i] = consumerId + pk.SetConsumerChainId(ctx, consumerId, chainID) clientID := fmt.Sprintf("client-%d", len(chainIds)-i) topN := topNs[i] pk.SetConsumerClientId(ctx, consumerId, clientID) @@ -367,7 +368,7 @@ func TestGetConsumerChain(t *testing.T) { expectedGetAllOrder = append(expectedGetAllOrder, types.Chain{ - ChainId: consumerId, + ChainId: chainID, ClientId: clientID, Top_N: topN, MinPowerInTop_N: expectedMinPowerInTopNs[i], @@ -403,8 +404,7 @@ func TestQueryConsumerIdFromClientId(t *testing.T) { require.Equal(t, expectedConsumerId, res.ConsumerId) } -// TestGetConsumerChain tests GetConsumerChain behaviour correctness -func TestGetConsumerChains(t *testing.T) { +func TestQueryConsumerChains(t *testing.T) { pk, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() @@ -415,18 +415,20 @@ func TestGetConsumerChains(t *testing.T) { // create five consumer chains all in the "Registered" phase for i := 0; i < consumerNum; i++ { cID := pk.FetchAndIncrementConsumerId(ctx) + chainID := "consumer-" + strconv.Itoa(i) c := types.Chain{ - ChainId: cID, + ChainId: chainID, MinPowerInTop_N: -1, ValidatorsPowerCap: 0, ValidatorSetCap: 0, Allowlist: []string{}, Denylist: []string{}, Phase: uint32(keeper.Registered), - Metadata: types.ConsumerMetadata{Name: "consumer-" + strconv.Itoa(0)}, + Metadata: types.ConsumerMetadata{Name: chainID}, } pk.SetConsumerPhase(ctx, cID, keeper.ConsumerPhase(c.Phase)) pk.SetConsumerMetadata(ctx, cID, c.Metadata) + pk.SetConsumerChainId(ctx, cID, chainID) consumerIds[i] = cID consumers[i] = &c @@ -435,66 +437,57 @@ func TestGetConsumerChains(t *testing.T) { testCases := []struct { name string setup func(ctx sdk.Context, pk keeper.Keeper) - filterPhase bool phase keeper.ConsumerPhase expConsumers []*types.Chain - }{{ - name: "expect no consumers when phase filter isn't set", - setup: func(ctx sdk.Context, pk keeper.Keeper) {}, - expConsumers: []*types.Chain{}, - }, { - name: "expect all consumers when phase filter is enabled and set to Registered", - setup: func(ctx sdk.Context, pk keeper.Keeper) {}, - filterPhase: true, - phase: keeper.Registered, - expConsumers: consumers, - }, { - name: "expect launched consumers when phase filter is enabled and set to Launched", - setup: func(ctx sdk.Context, pk keeper.Keeper) { - consumers[1].ClientId = "clientID" - consumers[1].Phase = uint32(keeper.Launched) - pk.SetConsumerClientId(ctx, consumers[1].ChainId, "clientID") - pk.SetConsumerPhase(ctx, consumers[1].ChainId, keeper.Launched) - }, - filterPhase: true, - phase: keeper.Launched, - expConsumers: consumers[1:2], - }, { - name: "expect initialized consumers when phase filter is enabled and set to Initialized", - setup: func(ctx sdk.Context, pk keeper.Keeper) { - consumers[2].Phase = uint32(keeper.Initialized) - err := pk.AppendSpawnTimeForConsumerToBeLaunched(ctx, consumers[2].ChainId, time.Now()) - require.NoError(t, err) - pk.SetConsumerPhase(ctx, consumers[2].ChainId, keeper.Initialized) - }, - filterPhase: true, - phase: keeper.Initialized, - expConsumers: consumers[2:3], - }, { - name: "expect consumers that failed to launch when phase filter is enabled and set to FailToLaunch", - setup: func(ctx sdk.Context, pk keeper.Keeper) { - consumers[3].Phase = uint32(keeper.FailedToLaunch) - pk.SetConsumerPhase(ctx, consumers[3].ChainId, keeper.FailedToLaunch) - }, - filterPhase: true, - phase: keeper.FailedToLaunch, - expConsumers: consumers[3:4], - }, { - name: "expect stopped consumers when phase filter is enabled and set to Stopped", - setup: func(ctx sdk.Context, pk keeper.Keeper) { - consumers[4].Phase = uint32(keeper.Stopped) - pk.SetConsumerPhase(ctx, consumers[4].ChainId, keeper.Stopped) + }{ + { + name: "expect all consumers when phase is set to default value 0 i.e. Registered", + setup: func(ctx sdk.Context, pk keeper.Keeper) {}, + phase: keeper.Registered, + expConsumers: consumers, + }, { + name: "expect launched consumers when phase is set to Launched", + setup: func(ctx sdk.Context, pk keeper.Keeper) { + consumers[1].ClientId = "clientID" + consumers[1].Phase = uint32(keeper.Launched) + pk.SetConsumerClientId(ctx, consumerIds[1], "clientID") + pk.SetConsumerPhase(ctx, consumerIds[1], keeper.Launched) + }, + phase: keeper.Launched, + expConsumers: consumers[1:2], + }, { + name: "expect initialized consumers when phase is set to Initialized", + setup: func(ctx sdk.Context, pk keeper.Keeper) { + consumers[2].Phase = uint32(keeper.Initialized) + err := pk.AppendSpawnTimeForConsumerToBeLaunched(ctx, consumerIds[2], time.Now()) + require.NoError(t, err) + pk.SetConsumerPhase(ctx, consumerIds[2], keeper.Initialized) + }, + phase: keeper.Initialized, + expConsumers: consumers[2:3], + }, { + name: "expect consumers that failed to launch when phase is set to FailToLaunch", + setup: func(ctx sdk.Context, pk keeper.Keeper) { + consumers[3].Phase = uint32(keeper.FailedToLaunch) + pk.SetConsumerPhase(ctx, consumerIds[3], keeper.FailedToLaunch) + }, + phase: keeper.FailedToLaunch, + expConsumers: consumers[3:4], + }, { + name: "expect stopped consumers when phase is set to Stopped", + setup: func(ctx sdk.Context, pk keeper.Keeper) { + consumers[4].Phase = uint32(keeper.Stopped) + pk.SetConsumerPhase(ctx, consumerIds[4], keeper.Stopped) + }, + phase: keeper.Stopped, + expConsumers: consumers[4:], }, - filterPhase: true, - phase: keeper.Stopped, - expConsumers: consumers[4:], - }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { tc.setup(ctx, pk) - req := types.QueryConsumerChainsRequest{tc.filterPhase, uint32(tc.phase)} + req := types.QueryConsumerChainsRequest{Phase: uint32(tc.phase)} expectedResponse := types.QueryConsumerChainsResponse{ Chains: tc.expConsumers, } diff --git a/x/ccv/provider/types/query.pb.go b/x/ccv/provider/types/query.pb.go index 1d05e0ecba..0ae52dc28e 100644 --- a/x/ccv/provider/types/query.pb.go +++ b/x/ccv/provider/types/query.pb.go @@ -137,12 +137,9 @@ func (m *QueryConsumerGenesisResponse) GetGenesisState() types.ConsumerGenesisSt } type QueryConsumerChainsRequest struct { - // filter_by_phase enable the filtering of the consumer chains - // returned by phase, default is "Launched" - FilterByPhase bool `protobuf:"varint,1,opt,name=filter_by_phase,json=filterByPhase,proto3" json:"filter_by_phase,omitempty"` - // The phase of the consumer chains returned - // Registered=0|Initialized=1|FailedToLaunched=2|Launched=3|Stopped=4 - Phase uint32 `protobuf:"varint,2,opt,name=phase,proto3" json:"phase,omitempty"` + // The phase of the consumer chains returned, default is 0 i.e. "Registered" + // Registered=0|Initialized=1|FailedToLaunch=2|Launched=3|Stopped=4 + Phase uint32 `protobuf:"varint,1,opt,name=phase,proto3" json:"phase,omitempty"` } func (m *QueryConsumerChainsRequest) Reset() { *m = QueryConsumerChainsRequest{} } @@ -178,13 +175,6 @@ func (m *QueryConsumerChainsRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryConsumerChainsRequest proto.InternalMessageInfo -func (m *QueryConsumerChainsRequest) GetFilterByPhase() bool { - if m != nil { - return m.FilterByPhase - } - return false -} - func (m *QueryConsumerChainsRequest) GetPhase() uint32 { if m != nil { return m.Phase @@ -422,9 +412,9 @@ type Chain struct { Allowlist []string `protobuf:"bytes,7,rep,name=allowlist,proto3" json:"allowlist,omitempty"` // Corresponds to a list of provider consensus addresses of validators that CANNOT validate the consumer chain. Denylist []string `protobuf:"bytes,8,rep,name=denylist,proto3" json:"denylist,omitempty"` - // The phase the consumer chain is in (Registered=0|Initialized=1|FailedToLaunched=2|Launched=3|Stopped=4) + // The phase the consumer chain (Registered=0|Initialized=1|FailedToLaunch=2|Launched=3|Stopped=4) Phase uint32 `protobuf:"varint,9,opt,name=phase,proto3" json:"phase,omitempty"` - // The consumer chain metadata + // The metadata of the consumer chain Metadata ConsumerMetadata `protobuf:"bytes,10,opt,name=metadata,proto3" json:"metadata"` } @@ -2049,163 +2039,161 @@ func init() { } var fileDescriptor_422512d7b7586cd7 = []byte{ - // 2488 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x5a, 0x4d, 0x6c, 0xdc, 0xc6, - 0xf5, 0x17, 0x57, 0x1f, 0x96, 0x46, 0x96, 0x9c, 0x8c, 0x65, 0x7b, 0xbd, 0x92, 0xb5, 0x32, 0x6d, - 0xe7, 0x2f, 0x7f, 0x2d, 0x25, 0x05, 0xfe, 0x27, 0x76, 0xeb, 0xd8, 0xda, 0x95, 0x65, 0x2f, 0xfc, - 0xa5, 0xd0, 0xb2, 0x53, 0x28, 0x75, 0xe9, 0x11, 0x39, 0x59, 0xb1, 0xe2, 0x92, 0x14, 0x67, 0xb4, - 0xf6, 0xc2, 0xf0, 0x21, 0x2d, 0xd0, 0x26, 0x3d, 0x14, 0x2e, 0x8a, 0xde, 0x73, 0x29, 0xd0, 0x43, - 0x4f, 0x45, 0xd0,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 0xba, 0xb2, 0x73, 0x60, 0xa2, 0x81, 0x0c, 0x5d, 0x43, 0xd4, - 0x72, 0x08, 0x5f, 0xa2, 0x22, 0x3b, 0x3f, 0xc8, 0xf0, 0x60, 0x38, 0xc7, 0x16, 0x55, 0x90, 0x0d, - 0xcf, 0x80, 0xd7, 0x83, 0x51, 0x85, 0x60, 0xca, 0xc4, 0x87, 0x98, 0xf8, 0x81, 0x60, 0xe2, 0x1e, - 0xa6, 0xae, 0xec, 0x14, 0x18, 0x41, 0x86, 0x61, 0x3d, 0x36, 0x74, 0x42, 0xf3, 0xfb, 0x66, 0xfa, - 0x67, 0x47, 0xe4, 0x70, 0x00, 0x16, 0xc0, 0xb0, 0x86, 0xcd, 0x26, 0x9b, 0x1c, 0x66, 0x93, 0xc1, - 0x77, 0x18, 0xfc, 0x23, 0x91, 0xe0, 0x87, 0xef, 0x81, 0xe1, 0x3a, 0xa6, 0x48, 0x43, 0x14, 0xe5, - 0x01, 0x3b, 0x8c, 0x0b, 0x1d, 0x1d, 0xc6, 0x6d, 0xbe, 0x98, 0xdf, 0xda, 0x00, 0x4c, 0xfc, 0xa5, - 0x00, 0x8e, 0xb3, 0x90, 0x78, 0xe0, 0x5b, 0x10, 0x89, 0x39, 0x27, 0x63, 0x52, 0xba, 0x0c, 0x5e, - 0xf3, 0x37, 0x55, 0x90, 0xa6, 0x39, 0x98, 0x10, 0xef, 0xc0, 0xca, 0xf0, 0xeb, 0x17, 0xc5, 0xf1, - 0x26, 0xaa, 0x1b, 0x97, 0x44, 0x3e, 0x21, 0xca, 0x07, 0x7c, 0xd9, 0x45, 0x6f, 0x24, 0x99, 0xd3, - 0xfa, 0x93, 0x39, 0xed, 0xd2, 0xf0, 0x47, 0x9f, 0x14, 0xfb, 0xfe, 0xf6, 0x49, 0xb1, 0x4f, 0xbc, - 0x0b, 0xc4, 0xdd, 0xb4, 0xe5, 0xb1, 0x7b, 0x1a, 0xbc, 0x16, 0x00, 0xfa, 0xfa, 0x78, 0x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 0x1f, 0x65, 0x91, 0x5d, 0xce, 0x07, 0xbb, 0x34, 0x2e, 0x48, 0x4f, 0x12, 0x65, - 0x7a, 0xd3, 0xc6, 0x64, 0x7d, 0x88, 0xfd, 0x10, 0xfe, 0xe6, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, - 0x3a, 0xd8, 0xf6, 0x19, 0xf1, 0x27, 0x00, 0x00, + // 2462 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x5a, 0x4d, 0x6c, 0x1c, 0x49, + 0x15, 0x76, 0x8f, 0x7f, 0x62, 0x97, 0x13, 0x67, 0xb7, 0xe2, 0x24, 0x93, 0xb1, 0xe3, 0x71, 0x3a, + 0x09, 0x38, 0x7f, 0xd3, 0xb6, 0x57, 0x61, 0x37, 0x81, 0x6c, 0xe2, 0x19, 0xc7, 0xc9, 0x28, 0x7f, + 0xde, 0x8e, 0x93, 0x45, 0x5e, 0x4c, 0xa7, 0xdc, 0x5d, 0x8c, 0x1b, 0xf7, 0x74, 0xb7, 0xbb, 0xca, + 0x93, 0x8c, 0xa2, 0x1c, 0x16, 0x24, 0xd8, 0xe5, 0x80, 0x82, 0x10, 0xf7, 0xbd, 0x20, 0x71, 0xe0, + 0x84, 0x56, 0x20, 0x6e, 0x7b, 0xdc, 0x1b, 0xcb, 0xee, 0x05, 0x81, 0x14, 0x50, 0xc2, 0x01, 0x21, + 0x21, 0xa1, 0x85, 0x2b, 0x12, 0xea, 0xea, 0xea, 0x5f, 0xf7, 0x78, 0x7a, 0x66, 0x7c, 0xd8, 0x9b, + 0xbb, 0xea, 0xd5, 0x57, 0xef, 0xbd, 0x7a, 0xf5, 0xea, 0xbd, 0x6f, 0x0c, 0x24, 0xdd, 0xa4, 0xd8, + 0x51, 0x37, 0x90, 0x6e, 0x2a, 0x04, 0xab, 0xdb, 0x8e, 0x4e, 0x9b, 0x92, 0xaa, 0x36, 0x24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0, 0x5f, 0x02, 0xff, 0x15, 0x36, + 0x8d, 0x0d, 0x81, 0x1d, 0xf0, 0x71, 0xbb, 0x30, 0x2e, 0x85, 0xa5, 0x5e, 0x61, 0x3a, 0x2f, 0x90, + 0x5b, 0x90, 0x37, 0xf0, 0x3f, 0x42, 0xe2, 0x7f, 0x79, 0xe2, 0xf4, 0x0a, 0xbc, 0xd1, 0xf9, 0x41, + 0xa7, 0x72, 0x3c, 0x85, 0x9b, 0xbd, 0x03, 0x75, 0x6e, 0x75, 0x24, 0x38, 0xa4, 0xa7, 0x01, 0xc5, + 0xf4, 0xac, 0xfc, 0xee, 0xa7, 0x2f, 0xa7, 0x84, 0xcf, 0x5e, 0x4e, 0x09, 0x7f, 0x7b, 0x39, 0x25, + 0x3c, 0x7f, 0x35, 0xd5, 0xf7, 0xd9, 0xab, 0xa9, 0xbe, 0x3f, 0xbd, 0x9a, 0xea, 0x5b, 0xbd, 0x52, + 0xd3, 0xe9, 0xc6, 0xf6, 0x7a, 0x49, 0xb5, 0xea, 0xfc, 0x3f, 0xc5, 0x22, 0xbb, 0x5c, 0x08, 0x76, + 0x69, 0x5c, 0x94, 0x9e, 0x24, 0xca, 0xf4, 0xa6, 0x8d, 0xc9, 0xfa, 0x10, 0xfb, 0x21, 0xfc, 0x8d, + 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, 0xf4, 0x4e, 0x31, 0xa1, 0xc9, 0x27, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -3021,16 +3009,6 @@ func (m *QueryConsumerChainsRequest) MarshalToSizedBuffer(dAtA []byte) (int, err if m.Phase != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.Phase)) i-- - dAtA[i] = 0x10 - } - if m.FilterByPhase { - i-- - if m.FilterByPhase { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil @@ -4404,9 +4382,6 @@ func (m *QueryConsumerChainsRequest) Size() (n int) { } var l int _ = l - if m.FilterByPhase { - n += 2 - } if m.Phase != 0 { n += 1 + sovQuery(uint64(m.Phase)) } @@ -5206,26 +5181,6 @@ func (m *QueryConsumerChainsRequest) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field FilterByPhase", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.FilterByPhase = bool(v != 0) - case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Phase", wireType) } From a0794fe9b5701fa945175fc203665e89a1f9cfb5 Mon Sep 17 00:00:00 2001 From: Simon Noetzlin Date: Wed, 28 Aug 2024 09:51:26 +0200 Subject: [PATCH 10/17] nits --- x/ccv/provider/keeper/grpc_query.go | 4 +--- x/ccv/provider/keeper/grpc_query_test.go | 3 --- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/x/ccv/provider/keeper/grpc_query.go b/x/ccv/provider/keeper/grpc_query.go index 4c33bd1521..6ae18ff832 100644 --- a/x/ccv/provider/keeper/grpc_query.go +++ b/x/ccv/provider/keeper/grpc_query.go @@ -67,8 +67,7 @@ func (k Keeper) QueryConsumerChains(goCtx context.Context, req *types.QueryConsu for i := uint64(0); i <= lastCID; i++ { p, ok := k.GetConsumerPhase(ctx, strconv.FormatInt(int64(i), 10)) if !ok { - // log something - continue + return nil, status.Error(codes.Internal, fmt.Sprintf("cannot retrieve phase for consumer id: %d", phase)) } if p == phase { consumerIds = append(consumerIds, strconv.FormatInt(int64(i), 10)) @@ -83,7 +82,6 @@ func (k Keeper) QueryConsumerChains(goCtx context.Context, req *types.QueryConsu for i, cID := range consumerIds { c, err := k.GetConsumerChain(ctx, cID) if err != nil { - // log something instead? return nil, status.Error(codes.Internal, err.Error()) } chains[i] = &c diff --git a/x/ccv/provider/keeper/grpc_query_test.go b/x/ccv/provider/keeper/grpc_query_test.go index 258dd817e1..71cda22728 100644 --- a/x/ccv/provider/keeper/grpc_query_test.go +++ b/x/ccv/provider/keeper/grpc_query_test.go @@ -326,9 +326,6 @@ func TestGetConsumerChain(t *testing.T) { metadataLists := make([]types.ConsumerMetadata, len(chainIds)) consumerIds := make([]string, len(chainIds)) - // skip first consumerID - pk.FetchAndIncrementConsumerId(ctx) - expectedGetAllOrder := []types.Chain{} for i, chainID := range chainIds { consumerId := pk.FetchAndIncrementConsumerId(ctx) From ef4a788807e8e9f397d2042dab4ec9e51fa81319 Mon Sep 17 00:00:00 2001 From: Simon Noetzlin Date: Wed, 28 Aug 2024 15:57:52 +0200 Subject: [PATCH 11/17] update logic --- .../ccv/provider/v1/query.proto | 10 +- x/ccv/provider/keeper/grpc_query.go | 53 ++- x/ccv/provider/keeper/grpc_query_test.go | 96 +++-- x/ccv/provider/keeper/keeper.go | 2 +- x/ccv/provider/keeper/permissionless.go | 33 -- x/ccv/provider/types/query.pb.go | 396 +++++++++++------- 6 files changed, 345 insertions(+), 245 deletions(-) diff --git a/proto/interchain_security/ccv/provider/v1/query.proto b/proto/interchain_security/ccv/provider/v1/query.proto index 79df866843..d0a78fe078 100644 --- a/proto/interchain_security/ccv/provider/v1/query.proto +++ b/proto/interchain_security/ccv/provider/v1/query.proto @@ -192,9 +192,15 @@ message QueryConsumerGenesisResponse { } message QueryConsumerChainsRequest { - // The phase of the consumer chains returned, default is 0 i.e. "Registered" + // filter_by_phase enables the filtering by phase of + // the returned consumer chains + bool filter_by_phase = 1; + // The phase of the consumer chains returned (optional) // Registered=0|Initialized=1|FailedToLaunch=2|Launched=3|Stopped=4 - uint32 phase = 1; + uint32 phase = 2; + // The limit of consumer chains returned (optional) + // default is 100 + uint32 limit = 3; } message QueryConsumerChainsResponse { repeated Chain chains = 1; } diff --git a/x/ccv/provider/keeper/grpc_query.go b/x/ccv/provider/keeper/grpc_query.go index 6ae18ff832..3a79d77df5 100644 --- a/x/ccv/provider/keeper/grpc_query.go +++ b/x/ccv/provider/keeper/grpc_query.go @@ -10,8 +10,8 @@ import ( errorsmod "cosmossdk.io/errors" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" ) @@ -50,36 +50,47 @@ func (k Keeper) QueryConsumerChains(goCtx context.Context, req *types.QueryConsu ctx := sdk.UnwrapSDKContext(goCtx) - lastCID, ok := k.GetConsumerId(ctx) - if !ok { - return &types.QueryConsumerChainsResponse{}, nil - } - consumerIds := []string{} + phase := ConsumerPhase(byte(req.Phase)) - switch { - case phase == Launched: + // if phase filter is set Launched get consumer from the state directly + if req.FilterByPhase && phase == Launched { consumerIds = append(consumerIds, k.GetAllRegisteredConsumerIds(ctx)...) - case phase == Initialized: - consumerIds = append(consumerIds, k.GetInitializedConsumers(ctx)...) - case phase == Registered || phase == FailedToLaunch || phase == Stopped: - for i := uint64(0); i <= lastCID; i++ { - p, ok := k.GetConsumerPhase(ctx, strconv.FormatInt(int64(i), 10)) - if !ok { - return nil, status.Error(codes.Internal, fmt.Sprintf("cannot retrieve phase for consumer id: %d", phase)) - } - if p == phase { - consumerIds = append(consumerIds, strconv.FormatInt(int64(i), 10)) + // otherwise iterate over all the consumer using the last unused consumer Id + } else { + firstUnusedConsumerId, ok := k.GetConsumerId(ctx) + if !ok { + return &types.QueryConsumerChainsResponse{}, nil + } + for i := uint64(0); i < firstUnusedConsumerId; i++ { + // if the filter is set, verify that the consumer has the same phase + if req.FilterByPhase { + p, ok := k.GetConsumerPhase(ctx, strconv.FormatInt(int64(i), 10)) + if !ok { + return nil, status.Error(codes.Internal, fmt.Sprintf("cannot retrieve phase for consumer id: %d", i)) + } + if p != phase { + continue + } } + + consumerIds = append(consumerIds, strconv.FormatInt(int64(i), 10)) } + } - default: - return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("invalid consumer phase %v", phase)) + // set limit to default value + limit := 100 + if req.Limit != 0 { + // update limit if specified + limit = int(req.Limit) } - chains := make([]*types.Chain, len(consumerIds)) + chains := make([]*types.Chain, math.Min(len(consumerIds), limit)) for i, cID := range consumerIds { + if i == limit { + break + } c, err := k.GetConsumerChain(ctx, cID) if err != nil { return nil, status.Error(codes.Internal, err.Error()) diff --git a/x/ccv/provider/keeper/grpc_query_test.go b/x/ccv/provider/keeper/grpc_query_test.go index 71cda22728..f0359b5ff6 100644 --- a/x/ccv/provider/keeper/grpc_query_test.go +++ b/x/ccv/provider/keeper/grpc_query_test.go @@ -409,7 +409,12 @@ func TestQueryConsumerChains(t *testing.T) { consumerIds := make([]string, consumerNum) consumers := make([]*types.Chain, consumerNum) - // create five consumer chains all in the "Registered" phase + // expect no error and returned chains + res, err := pk.QueryConsumerChains(ctx, &types.QueryConsumerChainsRequest{}) + require.NoError(t, err) + require.Len(t, res.Chains, 0) + + // create five consumer chains in different phase for i := 0; i < consumerNum; i++ { cID := pk.FetchAndIncrementConsumerId(ctx) chainID := "consumer-" + strconv.Itoa(i) @@ -420,7 +425,7 @@ func TestQueryConsumerChains(t *testing.T) { ValidatorSetCap: 0, Allowlist: []string{}, Denylist: []string{}, - Phase: uint32(keeper.Registered), + Phase: uint32(i), Metadata: types.ConsumerMetadata{Name: chainID}, } pk.SetConsumerPhase(ctx, cID, keeper.ConsumerPhase(c.Phase)) @@ -432,59 +437,88 @@ func TestQueryConsumerChains(t *testing.T) { } testCases := []struct { - name string - setup func(ctx sdk.Context, pk keeper.Keeper) - phase keeper.ConsumerPhase - expConsumers []*types.Chain + name string + setup func(ctx sdk.Context, pk keeper.Keeper) + filter_by_phase bool + phase_filter keeper.ConsumerPhase + limit uint32 + expConsumers []*types.Chain }{ { - name: "expect all consumers when phase is set to default value 0 i.e. Registered", + name: "expect all consumers when phase filter isn't set", setup: func(ctx sdk.Context, pk keeper.Keeper) {}, - phase: keeper.Registered, expConsumers: consumers, - }, { - name: "expect launched consumers when phase is set to Launched", + }, + { + name: "expect an amount of consumer equal to the limit", + setup: func(ctx sdk.Context, pk keeper.Keeper) {}, + expConsumers: consumers[:3], + limit: uint32(3), + }, + { + name: "expect registered consumers when phase filter is set to Registered", setup: func(ctx sdk.Context, pk keeper.Keeper) { - consumers[1].ClientId = "clientID" - consumers[1].Phase = uint32(keeper.Launched) - pk.SetConsumerClientId(ctx, consumerIds[1], "clientID") - pk.SetConsumerPhase(ctx, consumerIds[1], keeper.Launched) + consumers[0].Phase = uint32(keeper.Registered) + pk.SetConsumerPhase(ctx, consumerIds[0], keeper.Registered) }, - phase: keeper.Launched, - expConsumers: consumers[1:2], - }, { + filter_by_phase: true, + phase_filter: keeper.Registered, + expConsumers: consumers[0:1], + }, + { name: "expect initialized consumers when phase is set to Initialized", setup: func(ctx sdk.Context, pk keeper.Keeper) { - consumers[2].Phase = uint32(keeper.Initialized) - err := pk.AppendSpawnTimeForConsumerToBeLaunched(ctx, consumerIds[2], time.Now()) + consumers[1].Phase = uint32(keeper.Initialized) + err := pk.AppendSpawnTimeForConsumerToBeLaunched(ctx, consumerIds[1], time.Now()) require.NoError(t, err) - pk.SetConsumerPhase(ctx, consumerIds[2], keeper.Initialized) + pk.SetConsumerPhase(ctx, consumerIds[1], keeper.Initialized) }, - phase: keeper.Initialized, - expConsumers: consumers[2:3], - }, { + filter_by_phase: true, + phase_filter: keeper.Initialized, + expConsumers: consumers[1:2], + }, + { name: "expect consumers that failed to launch when phase is set to FailToLaunch", setup: func(ctx sdk.Context, pk keeper.Keeper) { - consumers[3].Phase = uint32(keeper.FailedToLaunch) - pk.SetConsumerPhase(ctx, consumerIds[3], keeper.FailedToLaunch) + consumers[2].Phase = uint32(keeper.FailedToLaunch) + pk.SetConsumerPhase(ctx, consumerIds[2], keeper.FailedToLaunch) + }, + filter_by_phase: true, + phase_filter: keeper.FailedToLaunch, + expConsumers: consumers[2:3], + }, + { + name: "expect launched consumers when phase is set to Launched", + setup: func(ctx sdk.Context, pk keeper.Keeper) { + consumers[3].Phase = uint32(keeper.Launched) + consumers[3].ClientId = "ClientID" + pk.SetConsumerClientId(ctx, consumerIds[3], consumers[3].ClientId) + pk.SetConsumerPhase(ctx, consumerIds[3], keeper.Launched) }, - phase: keeper.FailedToLaunch, - expConsumers: consumers[3:4], - }, { + filter_by_phase: true, + phase_filter: keeper.Launched, + expConsumers: consumers[3:4], + }, + { name: "expect stopped consumers when phase is set to Stopped", setup: func(ctx sdk.Context, pk keeper.Keeper) { consumers[4].Phase = uint32(keeper.Stopped) pk.SetConsumerPhase(ctx, consumerIds[4], keeper.Stopped) }, - phase: keeper.Stopped, - expConsumers: consumers[4:], + filter_by_phase: true, + phase_filter: keeper.Stopped, + expConsumers: consumers[4:], }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { tc.setup(ctx, pk) - req := types.QueryConsumerChainsRequest{Phase: uint32(tc.phase)} + req := types.QueryConsumerChainsRequest{ + FilterByPhase: tc.filter_by_phase, + Phase: uint32(tc.phase_filter), + Limit: tc.limit, + } expectedResponse := types.QueryConsumerChainsResponse{ Chains: tc.expConsumers, } diff --git a/x/ccv/provider/keeper/keeper.go b/x/ccv/provider/keeper/keeper.go index 46f641f660..66df230b09 100644 --- a/x/ccv/provider/keeper/keeper.go +++ b/x/ccv/provider/keeper/keeper.go @@ -750,7 +750,7 @@ func (k Keeper) GetAllActiveConsumerIds(ctx sdk.Context) []string { } consumerIds := []string{} - for i := uint64(0); i <= latestConsumerId; i++ { + for i := uint64(0); i < latestConsumerId; i++ { consumerId := fmt.Sprintf("%d", i) phase, foundPhase := k.GetConsumerPhase(ctx, consumerId) if !foundPhase || (phase != Registered && phase != Initialized && phase != Launched) { diff --git a/x/ccv/provider/keeper/permissionless.go b/x/ccv/provider/keeper/permissionless.go index 7bf6a3e7cd..4b209d0358 100644 --- a/x/ccv/provider/keeper/permissionless.go +++ b/x/ccv/provider/keeper/permissionless.go @@ -564,39 +564,6 @@ func (k Keeper) GetInitializedConsumersReadyToLaunch(ctx sdk.Context, limit uint return result } -// GetInitializedConsumers returns the initialized consumer chains -// TODO: @sainoe merge with func above -func (k Keeper) GetInitializedConsumers(ctx sdk.Context) []string { - store := ctx.KVStore(k.storeKey) - - spawnTimeToConsumerIdsKeyPrefix := types.SpawnTimeToConsumerIdsKeyPrefix() - iterator := storetypes.KVStorePrefixIterator(store, []byte{spawnTimeToConsumerIdsKeyPrefix}) - defer iterator.Close() - - result := []string{} - for ; iterator.Valid(); iterator.Next() { - spawnTime, err := types.ParseTime(types.SpawnTimeToConsumerIdsKeyPrefix(), iterator.Key()) - if err != nil { - k.Logger(ctx).Error("failed to parse spawn time", - "error", err) - continue - } - - // if current block time is equal to or after spawnTime, and the chain is initialized, we can launch the chain - consumerIds, err := k.GetConsumersToBeLaunched(ctx, spawnTime) - if err != nil { - k.Logger(ctx).Error("failed to retrieve consumers to launch", - "spawn time", spawnTime, - "error", err) - continue - } - - result = append(result, consumerIds.Ids...) - } - - return result -} - // LaunchConsumer launches the chain with the provided consumer id by creating the consumer client and the respective // consumer genesis file func (k Keeper) LaunchConsumer(ctx sdk.Context, consumerId string) error { diff --git a/x/ccv/provider/types/query.pb.go b/x/ccv/provider/types/query.pb.go index 0ae52dc28e..d2e06c125e 100644 --- a/x/ccv/provider/types/query.pb.go +++ b/x/ccv/provider/types/query.pb.go @@ -137,9 +137,15 @@ func (m *QueryConsumerGenesisResponse) GetGenesisState() types.ConsumerGenesisSt } type QueryConsumerChainsRequest struct { - // The phase of the consumer chains returned, default is 0 i.e. "Registered" + // filter_by_phase enables the filtering by phase of + // the returned consumer chains + FilterByPhase bool `protobuf:"varint,1,opt,name=filter_by_phase,json=filterByPhase,proto3" json:"filter_by_phase,omitempty"` + // The phase of the consumer chains returned (optional) // Registered=0|Initialized=1|FailedToLaunch=2|Launched=3|Stopped=4 - Phase uint32 `protobuf:"varint,1,opt,name=phase,proto3" json:"phase,omitempty"` + Phase uint32 `protobuf:"varint,2,opt,name=phase,proto3" json:"phase,omitempty"` + // The limit of consumer chains returned + // default is 100 + Limit uint32 `protobuf:"varint,3,opt,name=limit,proto3" json:"limit,omitempty"` } func (m *QueryConsumerChainsRequest) Reset() { *m = QueryConsumerChainsRequest{} } @@ -175,6 +181,13 @@ func (m *QueryConsumerChainsRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryConsumerChainsRequest proto.InternalMessageInfo +func (m *QueryConsumerChainsRequest) GetFilterByPhase() bool { + if m != nil { + return m.FilterByPhase + } + return false +} + func (m *QueryConsumerChainsRequest) GetPhase() uint32 { if m != nil { return m.Phase @@ -182,6 +195,13 @@ func (m *QueryConsumerChainsRequest) GetPhase() uint32 { return 0 } +func (m *QueryConsumerChainsRequest) GetLimit() uint32 { + if m != nil { + return m.Limit + } + return 0 +} + type QueryConsumerChainsResponse struct { Chains []*Chain `protobuf:"bytes,1,rep,name=chains,proto3" json:"chains,omitempty"` } @@ -2039,161 +2059,163 @@ func init() { } var fileDescriptor_422512d7b7586cd7 = []byte{ - // 2462 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x5a, 0x4d, 0x6c, 0x1c, 0x49, - 0x15, 0x76, 0x8f, 0x7f, 0x62, 0x97, 0x13, 0x67, 0xb7, 0xe2, 0x24, 0x93, 0xb1, 0xe3, 0x71, 0x3a, - 0x09, 0x38, 0x7f, 0xd3, 0xb6, 0x57, 0x61, 0x37, 0x81, 0x6c, 0xe2, 0x19, 0xc7, 0xc9, 0x28, 0x7f, - 0xde, 0x8e, 0x93, 0x45, 0x5e, 0x4c, 0xa7, 0xdc, 0x5d, 0x8c, 0x1b, 0xf7, 0x74, 0xb7, 0xbb, 0xca, - 0x93, 0x8c, 0xa2, 0x1c, 0x16, 0x24, 0xd8, 0xe5, 0x80, 0x82, 0x10, 0xf7, 0xbd, 0x20, 0x71, 0xe0, - 0x84, 0x56, 0x20, 0x6e, 0x7b, 0xdc, 0x1b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31, 0xa1, 0xc9, 0x27, 0x00, 0x00, + // 2495 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x5a, 0x4d, 0x6c, 0xdc, 0xc6, + 0xf5, 0x17, 0x57, 0x1f, 0x96, 0x46, 0x96, 0x9c, 0x8c, 0x65, 0x7b, 0xbd, 0x92, 0xb5, 0x32, 0x6d, + 0xe7, 0x2f, 0x7f, 0x2d, 0x25, 0x05, 0xfe, 0x27, 0x76, 0xeb, 0xd8, 0xda, 0x95, 0x65, 0x2f, 0xfc, + 0xa5, 0xd0, 0xb2, 0x53, 0x28, 0x75, 0x69, 0x8a, 0x9c, 0xac, 0x58, 0x71, 0x49, 0x8a, 0x33, 0x5a, + 0x7b, 0x61, 0xf8, 0x90, 0x16, 0x68, 0x93, 0x1e, 0x0a, 0x17, 0x45, 0xef, 0xb9, 0x14, 0xe8, 0xa1, + 0xa7, 0x22, 0x68, 0xd1, 0x5b, 0x8e, 0xb9, 0x35, 0x4d, 0x2e, 0x45, 0x0b, 0xb8, 0x85, 0xdd, 0x43, + 0x51, 0xa0, 0x40, 0x91, 0xf6, 0x5a, 0xa0, 0xe0, 0xcc, 0xf0, 0x53, 0x5c, 0x2d, 0x77, 0x57, 0x87, + 0xde, 0xc4, 0x99, 0x37, 0xbf, 0xf7, 0x31, 0xef, 0xbd, 0x79, 0xef, 0xad, 0x80, 0x64, 0x58, 0x04, + 0xb9, 0xda, 0x86, 0x6a, 0x58, 0x0a, 0x46, 0xda, 0xb6, 0x6b, 0x90, 0xa6, 0xa4, 0x69, 0x0d, 0xc9, + 0x71, 0xed, 0x86, 0xa1, 0x23, 0x57, 0x6a, 0xcc, 0x4b, 0x5b, 0xdb, 0xc8, 0x6d, 0x96, 0x1c, 0xd7, + 0x26, 0x36, 0x3c, 0x91, 0x72, 0xa0, 0xa4, 0x69, 0x8d, 0x92, 0x7f, 0xa0, 0xd4, 0x98, 0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, 0x0b, 0xde, 0x48, 0x93, 0xc4, + 0x76, 0x76, 0x08, 0xfd, 0x03, 0x21, 0x5d, 0xc1, 0x18, 0x69, 0xe0, 0x3d, 0x3b, 0x64, 0xbe, 0xdc, + 0x91, 0xcc, 0x32, 0xaa, 0xdb, 0x0d, 0xd5, 0x4c, 0x15, 0xf9, 0x87, 0xfd, 0x60, 0x90, 0xf2, 0x86, + 0x47, 0x93, 0x41, 0x10, 0x06, 0xc0, 0x24, 0x18, 0xd1, 0x4c, 0x03, 0x59, 0x24, 0x74, 0xff, 0x61, + 0xb6, 0x50, 0xd5, 0xe1, 0x41, 0x30, 0x48, 0x6c, 0x47, 0xb9, 0xc3, 0x7d, 0x64, 0x80, 0xd8, 0xce, + 0x1d, 0x78, 0x06, 0xc0, 0xba, 0x61, 0x29, 0x8e, 0xfd, 0xd8, 0x8b, 0x19, 0x4b, 0x61, 0x14, 0x03, + 0x33, 0xc2, 0x6c, 0xbf, 0x3c, 0x5e, 0x37, 0xac, 0x15, 0x6f, 0xa3, 0x6a, 0xad, 0x7a, 0xb4, 0x73, + 0x60, 0xa2, 0xa1, 0x9a, 0x86, 0xae, 0x12, 0xdb, 0xc5, 0xfc, 0x88, 0xa6, 0x3a, 0xf9, 0x41, 0x8a, + 0x07, 0xc3, 0x3d, 0x7a, 0xa8, 0xa2, 0x3a, 0xf0, 0x0c, 0x78, 0x3d, 0x58, 0x55, 0x30, 0x22, 0x94, + 0x7c, 0x88, 0x92, 0x1f, 0x08, 0x36, 0xee, 0x21, 0xe2, 0xd1, 0x4e, 0x81, 0x11, 0xd5, 0x34, 0xed, + 0xc7, 0xa6, 0x81, 0x49, 0x7e, 0xdf, 0x4c, 0xff, 0xec, 0x88, 0x1c, 0x2e, 0xc0, 0x02, 0x18, 0xd6, + 0x91, 0xd5, 0xa4, 0x9b, 0xc3, 0x74, 0x33, 0xf8, 0x0e, 0x43, 0x62, 0x24, 0x1a, 0x12, 0xef, 0x81, + 0xe1, 0x3a, 0x22, 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e3, 0x3a, 0x78, 0xb5, 0xf3, 0x70, 0x8b, 0x0f, 0x12, + 0x0b, 0x8b, 0x3d, 0x20, 0x30, 0x45, 0xc4, 0x1f, 0x09, 0xdf, 0xfb, 0xea, 0xaf, 0x3f, 0xcd, 0x7d, + 0x5f, 0x58, 0x2b, 0xc3, 0xab, 0xed, 0xc7, 0xc9, 0x81, 0xd2, 0x7c, 0x26, 0x28, 0x3d, 0x8d, 0x98, + 0xe1, 0x19, 0xbc, 0xdc, 0x15, 0x02, 0x0f, 0x8d, 0x67, 0xf0, 0x2b, 0x81, 0x97, 0x7c, 0xf1, 0xd8, + 0x85, 0x57, 0x3a, 0xd7, 0x33, 0x36, 0x96, 0x2c, 0x5c, 0xed, 0x1e, 0x80, 0xdb, 0xe9, 0x22, 0x35, + 0xd3, 0x9b, 0x70, 0xbe, 0x03, 0x0d, 0xd9, 0x70, 0x11, 0x7e, 0x98, 0x03, 0xf9, 0x16, 0x13, 0x43, + 0x0c, 0x6f, 0x75, 0x29, 0x59, 0xea, 0x70, 0xb2, 0x70, 0x7b, 0x8f, 0xd0, 0xb8, 0xd2, 0x37, 0xa8, + 0xd2, 0x9d, 0x39, 0x06, 0x27, 0xf2, 0x00, 0x95, 0x60, 0xee, 0x07, 0xff, 0x23, 0x80, 0x23, 0xe9, + 0x03, 0x48, 0x0c, 0x6f, 0x76, 0x2d, 0xf4, 0xce, 0x49, 0x67, 0xe1, 0xd6, 0xde, 0x80, 0x71, 0x03, + 0x5c, 0xa7, 0x06, 0x58, 0x84, 0x57, 0xba, 0x30, 0x80, 0xed, 0x44, 0xf4, 0xff, 0xa7, 0x3f, 0x50, + 0x49, 0x9d, 0x5f, 0xc1, 0xe5, 0xec, 0x52, 0xef, 0x36, 0xae, 0x2b, 0x5c, 0xef, 0x19, 0x87, 0x2b, + 0xbe, 0x48, 0x15, 0xff, 0x06, 0xbc, 0x98, 0xe1, 0x17, 0xa6, 0x60, 0x34, 0x1a, 0x6b, 0x15, 0x53, + 0x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xf8, 0x87, 0xc0, 0x7f, 0x85, + 0x4d, 0x9b, 0x86, 0xc0, 0x0e, 0xe6, 0x71, 0xbb, 0x4c, 0x5c, 0x0a, 0xcb, 0xbd, 0xc2, 0x74, 0x5e, + 0x20, 0xb7, 0x18, 0xde, 0xc0, 0x7f, 0x09, 0x89, 0xff, 0xe5, 0x89, 0x8f, 0x57, 0xe0, 0xf5, 0xce, + 0x2f, 0x3a, 0x75, 0xc6, 0x53, 0xb8, 0xd1, 0x3b, 0x50, 0xe7, 0x5a, 0x47, 0x9c, 0x43, 0x7a, 0x1a, + 0x8c, 0x98, 0x9e, 0x95, 0xdf, 0xfb, 0xfc, 0xe5, 0xb4, 0xf0, 0xc5, 0xcb, 0x69, 0xe1, 0x2f, 0x2f, + 0xa7, 0x85, 0xe7, 0xaf, 0xa6, 0xfb, 0xbe, 0x78, 0x35, 0xdd, 0xf7, 0x87, 0x57, 0xd3, 0x7d, 0x6b, + 0x97, 0x6b, 0x06, 0xd9, 0xd8, 0x5e, 0x2f, 0x69, 0x76, 0x9d, 0xff, 0x9f, 0x59, 0x84, 0xcb, 0xf9, + 0x80, 0x4b, 0xe3, 0x82, 0xf4, 0x24, 0x51, 0xa6, 0x37, 0x1d, 0x84, 0xd7, 0x87, 0xe8, 0x0f, 0xe1, + 0x6f, 0xfe, 0x37, 0x00, 0x00, 0xff, 0xff, 0xe9, 0xed, 0x8b, 0x5e, 0x07, 0x28, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -3006,9 +3028,24 @@ func (m *QueryConsumerChainsRequest) MarshalToSizedBuffer(dAtA []byte) (int, err _ = i var l int _ = l + if m.Limit != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Limit)) + i-- + dAtA[i] = 0x18 + } if m.Phase != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.Phase)) i-- + dAtA[i] = 0x10 + } + if m.FilterByPhase { + i-- + if m.FilterByPhase { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil @@ -4382,9 +4419,15 @@ func (m *QueryConsumerChainsRequest) Size() (n int) { } var l int _ = l + if m.FilterByPhase { + n += 2 + } if m.Phase != 0 { n += 1 + sovQuery(uint64(m.Phase)) } + if m.Limit != 0 { + n += 1 + sovQuery(uint64(m.Limit)) + } return n } @@ -5181,6 +5224,26 @@ func (m *QueryConsumerChainsRequest) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FilterByPhase", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.FilterByPhase = bool(v != 0) + case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Phase", wireType) } @@ -5199,6 +5262,25 @@ func (m *QueryConsumerChainsRequest) Unmarshal(dAtA []byte) error { break } } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Limit", wireType) + } + m.Limit = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Limit |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) From 3b4febacd878b5766625b778e3d4322945811716 Mon Sep 17 00:00:00 2001 From: Simon Noetzlin Date: Wed, 28 Aug 2024 16:08:49 +0200 Subject: [PATCH 12/17] update CLI --- x/ccv/provider/client/cli/query.go | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/x/ccv/provider/client/cli/query.go b/x/ccv/provider/client/cli/query.go index 34d715583c..84dae8d1da 100644 --- a/x/ccv/provider/client/cli/query.go +++ b/x/ccv/provider/client/cli/query.go @@ -2,6 +2,7 @@ package cli import ( "fmt" + "strconv" "strings" "github.com/spf13/cobra" @@ -75,9 +76,9 @@ func CmdConsumerGenesis() *cobra.Command { func CmdConsumerChains() *cobra.Command { cmd := &cobra.Command{ - Use: "list-consumer-chains", + Use: "list-consumer-chains [phase] [limit]", Short: "Query active consumer chains for provider chain.", - Args: cobra.ExactArgs(0), + Args: cobra.MaximumNArgs(2), RunE: func(cmd *cobra.Command, args []string) (err error) { clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { @@ -86,6 +87,24 @@ func CmdConsumerChains() *cobra.Command { queryClient := types.NewQueryClient(clientCtx) req := &types.QueryConsumerChainsRequest{} + + if args[0] != "" { + phase, err := strconv.Atoi(args[0]) + if err != nil { + return err + } + req.FilterByPhase = true + req.Phase = uint32(phase) + } + + if args[1] != "" { + limit, err := strconv.Atoi(args[1]) + if err != nil { + return err + } + req.Limit = uint32(limit) + } + res, err := queryClient.QueryConsumerChains(cmd.Context(), req) if err != nil { return err From 3e138212306f55a1561735fa247bdac0cc6d2f4f Mon Sep 17 00:00:00 2001 From: Simon Noetzlin Date: Wed, 28 Aug 2024 17:33:36 +0200 Subject: [PATCH 13/17] revert unwanted changes --- x/ccv/provider/types/legacy_proposal.go | 54 ++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/x/ccv/provider/types/legacy_proposal.go b/x/ccv/provider/types/legacy_proposal.go index f29f3b6c07..3124cc3d87 100644 --- a/x/ccv/provider/types/legacy_proposal.go +++ b/x/ccv/provider/types/legacy_proposal.go @@ -20,8 +20,8 @@ import ( const ( ProposalTypeConsumerAddition = "ConsumerAddition" - ProposalTypeConsumerRemoval = "RemoveConsumer" - ProposalTypeConsumerModification = "UpdateConsumer" + ProposalTypeConsumerRemoval = "ConsumerRemoval" + ProposalTypeConsumerModification = "ConsumerModification" ProposalTypeEquivocation = "Equivocation" ProposalTypeChangeRewardDenoms = "ChangeRewardDenoms" ) @@ -29,6 +29,7 @@ const ( var ( _ govv1beta1.Content = &ConsumerAdditionProposal{} _ govv1beta1.Content = &ConsumerRemovalProposal{} + _ govv1beta1.Content = &ConsumerModificationProposal{} _ govv1beta1.Content = &ChangeRewardDenomsProposal{} _ govv1beta1.Content = &EquivocationProposal{} ) @@ -239,6 +240,55 @@ func (sccp *ConsumerRemovalProposal) ValidateBasic() error { return nil } +// NewConsumerModificationProposal creates a new consumer modification proposal. +func NewConsumerModificationProposal(title, description, chainID string, + topN uint32, + validatorsPowerCap uint32, + validatorSetCap uint32, + allowlist []string, + denylist []string, + minStake uint64, + allowInactiveVals bool, +) govv1beta1.Content { + return &ConsumerModificationProposal{ + Title: title, + Description: description, + ChainId: chainID, + Top_N: topN, + ValidatorsPowerCap: validatorsPowerCap, + ValidatorSetCap: validatorSetCap, + Allowlist: allowlist, + Denylist: denylist, + MinStake: minStake, + AllowInactiveVals: allowInactiveVals, + } +} + +// ProposalRoute returns the routing key of a consumer modification proposal. +func (cccp *ConsumerModificationProposal) ProposalRoute() string { return RouterKey } + +// ProposalType returns the type of the consumer modification proposal. +func (cccp *ConsumerModificationProposal) ProposalType() string { + return ProposalTypeConsumerModification +} + +// ValidateBasic runs basic stateless validity checks +func (cccp *ConsumerModificationProposal) ValidateBasic() error { + if err := govv1beta1.ValidateAbstract(cccp); err != nil { + return err + } + + if strings.TrimSpace(cccp.ChainId) == "" { + return errorsmod.Wrap(ErrInvalidConsumerModificationProposal, "consumer chain id must not be blank") + } + + err := ValidatePSSFeatures(cccp.Top_N, cccp.ValidatorsPowerCap) + if err != nil { + return errorsmod.Wrapf(ErrInvalidConsumerModificationProposal, "invalid PSS features: %s", err.Error()) + } + return nil +} + // NewEquivocationProposal creates a new equivocation proposal. // [DEPRECATED]: do not use because equivocations can be submitted // and verified automatically on the provider. From bfd80702988c397f61dc2fbbcd669b8a38a3a501 Mon Sep 17 00:00:00 2001 From: Simon Noetzlin Date: Wed, 28 Aug 2024 17:42:30 +0200 Subject: [PATCH 14/17] remove filter field --- .../ccv/provider/v1/query.proto | 7 +- x/ccv/provider/client/cli/query.go | 1 - x/ccv/provider/keeper/grpc_query.go | 13 +- x/ccv/provider/keeper/grpc_query_test.go | 36 +- x/ccv/provider/types/query.pb.go | 366 ++++++++---------- 5 files changed, 184 insertions(+), 239 deletions(-) diff --git a/proto/interchain_security/ccv/provider/v1/query.proto b/proto/interchain_security/ccv/provider/v1/query.proto index 05c8ecc5c8..811d0db686 100644 --- a/proto/interchain_security/ccv/provider/v1/query.proto +++ b/proto/interchain_security/ccv/provider/v1/query.proto @@ -192,15 +192,12 @@ message QueryConsumerGenesisResponse { } message QueryConsumerChainsRequest { - // filter_by_phase enables the filtering by phase of - // the returned consumer chains - bool filter_by_phase = 1; // The phase of the consumer chains returned (optional) // Registered=1|Initialized=2|Launched=3|Stopped=4 - ConsumerPhase phase = 2; + ConsumerPhase phase = 1; // The limit of consumer chains returned (optional) // default is 100 - int32 limit = 3; + int32 limit = 2; } message QueryConsumerChainsResponse { repeated Chain chains = 1; } diff --git a/x/ccv/provider/client/cli/query.go b/x/ccv/provider/client/cli/query.go index dca9c0c032..0ae16395d5 100644 --- a/x/ccv/provider/client/cli/query.go +++ b/x/ccv/provider/client/cli/query.go @@ -93,7 +93,6 @@ func CmdConsumerChains() *cobra.Command { if err != nil { return err } - req.FilterByPhase = true req.Phase = types.ConsumerPhase(phase) } diff --git a/x/ccv/provider/keeper/grpc_query.go b/x/ccv/provider/keeper/grpc_query.go index 081a7bc6ea..c37e4df131 100644 --- a/x/ccv/provider/keeper/grpc_query.go +++ b/x/ccv/provider/keeper/grpc_query.go @@ -51,11 +51,10 @@ func (k Keeper) QueryConsumerChains(goCtx context.Context, req *types.QueryConsu ctx := sdk.UnwrapSDKContext(goCtx) consumerIds := []string{} + phaseFilter := req.Phase - phase := types.ConsumerPhase(req.Phase) - - // if phase filter is set Launched get consumer from the state directly - if req.FilterByPhase && phase == types.ConsumerPhase_CONSUMER_PHASE_LAUNCHED { + // if the phase filter is set Launched get consumer from the state directly + if phaseFilter == types.ConsumerPhase_CONSUMER_PHASE_LAUNCHED { consumerIds = append(consumerIds, k.GetAllRegisteredConsumerIds(ctx)...) // otherwise iterate over all the consumer using the last unused consumer Id } else { @@ -64,13 +63,13 @@ func (k Keeper) QueryConsumerChains(goCtx context.Context, req *types.QueryConsu return &types.QueryConsumerChainsResponse{}, nil } for i := uint64(0); i < firstUnusedConsumerId; i++ { - // if the filter is set, verify that the consumer has the same phase - if req.FilterByPhase { + // if the phase filter is set, verify that the consumer has the same phase + if phaseFilter != types.ConsumerPhase_CONSUMER_PHASE_UNSPECIFIED { p := k.GetConsumerPhase(ctx, strconv.FormatInt(int64(i), 10)) if p == types.ConsumerPhase_CONSUMER_PHASE_UNSPECIFIED { return nil, status.Error(codes.Internal, fmt.Sprintf("cannot retrieve phase for consumer id: %d", i)) } - if p != phase { + if p != phaseFilter { continue } } diff --git a/x/ccv/provider/keeper/grpc_query_test.go b/x/ccv/provider/keeper/grpc_query_test.go index 352a56c225..aba9efa618 100644 --- a/x/ccv/provider/keeper/grpc_query_test.go +++ b/x/ccv/provider/keeper/grpc_query_test.go @@ -438,12 +438,11 @@ func TestQueryConsumerChains(t *testing.T) { } testCases := []struct { - name string - setup func(ctx sdk.Context, pk keeper.Keeper) - filter_by_phase bool - phase_filter types.ConsumerPhase - limit int32 - expConsumers []*types.Chain + name string + setup func(ctx sdk.Context, pk keeper.Keeper) + phase_filter types.ConsumerPhase + limit int32 + expConsumers []*types.Chain }{ { name: "expect all consumers when phase filter isn't set", @@ -462,9 +461,8 @@ func TestQueryConsumerChains(t *testing.T) { consumers[0].Phase = types.ConsumerPhase_CONSUMER_PHASE_REGISTERED pk.SetConsumerPhase(ctx, consumerIds[0], types.ConsumerPhase_CONSUMER_PHASE_REGISTERED) }, - filter_by_phase: true, - phase_filter: types.ConsumerPhase_CONSUMER_PHASE_REGISTERED, - expConsumers: consumers[0:1], + phase_filter: types.ConsumerPhase_CONSUMER_PHASE_REGISTERED, + expConsumers: consumers[0:1], }, { name: "expect initialized consumers when phase is set to Initialized", @@ -474,9 +472,8 @@ func TestQueryConsumerChains(t *testing.T) { require.NoError(t, err) pk.SetConsumerPhase(ctx, consumerIds[1], types.ConsumerPhase_CONSUMER_PHASE_INITIALIZED) }, - filter_by_phase: true, - phase_filter: types.ConsumerPhase_CONSUMER_PHASE_INITIALIZED, - expConsumers: consumers[1:2], + phase_filter: types.ConsumerPhase_CONSUMER_PHASE_INITIALIZED, + expConsumers: consumers[1:2], }, { name: "expect launched consumers when phase is set to Launched", @@ -486,9 +483,8 @@ func TestQueryConsumerChains(t *testing.T) { pk.SetConsumerClientId(ctx, consumerIds[2], consumers[2].ClientId) pk.SetConsumerPhase(ctx, consumerIds[2], types.ConsumerPhase_CONSUMER_PHASE_LAUNCHED) }, - filter_by_phase: true, - phase_filter: types.ConsumerPhase_CONSUMER_PHASE_LAUNCHED, - expConsumers: consumers[2:3], + phase_filter: types.ConsumerPhase_CONSUMER_PHASE_LAUNCHED, + expConsumers: consumers[2:3], }, { name: "expect stopped consumers when phase is set to Stopped", @@ -496,9 +492,8 @@ func TestQueryConsumerChains(t *testing.T) { consumers[3].Phase = types.ConsumerPhase_CONSUMER_PHASE_STOPPED pk.SetConsumerPhase(ctx, consumerIds[3], types.ConsumerPhase_CONSUMER_PHASE_STOPPED) }, - filter_by_phase: true, - phase_filter: types.ConsumerPhase_CONSUMER_PHASE_STOPPED, - expConsumers: consumers[3:], + phase_filter: types.ConsumerPhase_CONSUMER_PHASE_STOPPED, + expConsumers: consumers[3:], }, } @@ -506,9 +501,8 @@ func TestQueryConsumerChains(t *testing.T) { t.Run(tc.name, func(t *testing.T) { tc.setup(ctx, pk) req := types.QueryConsumerChainsRequest{ - FilterByPhase: tc.filter_by_phase, - Phase: tc.phase_filter, - Limit: tc.limit, + Phase: tc.phase_filter, + Limit: tc.limit, } expectedResponse := types.QueryConsumerChainsResponse{ Chains: tc.expConsumers, diff --git a/x/ccv/provider/types/query.pb.go b/x/ccv/provider/types/query.pb.go index 7c2e1b4ef3..640f76b550 100644 --- a/x/ccv/provider/types/query.pb.go +++ b/x/ccv/provider/types/query.pb.go @@ -137,15 +137,12 @@ func (m *QueryConsumerGenesisResponse) GetGenesisState() types.ConsumerGenesisSt } type QueryConsumerChainsRequest struct { - // filter_by_phase enables the filtering by phase of - // the returned consumer chains - FilterByPhase bool `protobuf:"varint,1,opt,name=filter_by_phase,json=filterByPhase,proto3" json:"filter_by_phase,omitempty"` // The phase of the consumer chains returned (optional) // Registered=1|Initialized=2|Launched=3|Stopped=4 - Phase ConsumerPhase `protobuf:"varint,2,opt,name=phase,proto3,enum=interchain_security.ccv.provider.v1.ConsumerPhase" json:"phase,omitempty"` + Phase ConsumerPhase `protobuf:"varint,1,opt,name=phase,proto3,enum=interchain_security.ccv.provider.v1.ConsumerPhase" json:"phase,omitempty"` // The limit of consumer chains returned (optional) // default is 100 - Limit int32 `protobuf:"varint,3,opt,name=limit,proto3" json:"limit,omitempty"` + Limit int32 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` } func (m *QueryConsumerChainsRequest) Reset() { *m = QueryConsumerChainsRequest{} } @@ -181,13 +178,6 @@ func (m *QueryConsumerChainsRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryConsumerChainsRequest proto.InternalMessageInfo -func (m *QueryConsumerChainsRequest) GetFilterByPhase() bool { - if m != nil { - return m.FilterByPhase - } - return false -} - func (m *QueryConsumerChainsRequest) GetPhase() ConsumerPhase { if m != nil { return m.Phase @@ -2059,164 +2049,163 @@ func init() { } var fileDescriptor_422512d7b7586cd7 = []byte{ - // 2505 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x5a, 0x4d, 0x6c, 0xdc, 0xc6, - 0x15, 0x16, 0xf5, 0x67, 0x69, 0x14, 0xc9, 0xc9, 0x58, 0xb6, 0xd7, 0x2b, 0x59,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xe0, 0xbf, - 0x85, 0xc4, 0xff, 0xff, 0xc4, 0xc7, 0x2b, 0xf0, 0x5a, 0xfe, 0x8b, 0x4e, 0x9d, 0xf1, 0x14, 0xaf, - 0x77, 0x0f, 0x94, 0x5f, 0xeb, 0x88, 0x73, 0x48, 0x4f, 0x82, 0x11, 0xd3, 0xd3, 0xca, 0xbb, 0x9f, - 0xbd, 0x98, 0x12, 0x3e, 0x7f, 0x31, 0x25, 0xfc, 0xf5, 0xc5, 0x94, 0xf0, 0xec, 0xe5, 0x54, 0xcf, - 0xe7, 0x2f, 0xa7, 0x7a, 0xfe, 0xf8, 0x72, 0xaa, 0x67, 0xf5, 0x52, 0xdd, 0x20, 0xeb, 0x5b, 0x6b, - 0x65, 0xcd, 0x6e, 0xf0, 0x7f, 0x68, 0x8b, 0x70, 0x39, 0x17, 0x70, 0x69, 0x9e, 0x97, 0x1e, 0x27, - 0xca, 0xf4, 0x96, 0x83, 0xf0, 0xda, 0x20, 0xfd, 0x21, 0xfc, 0x8d, 0xff, 0x05, 0x00, 0x00, 0xff, - 0xff, 0x06, 0x2d, 0xfc, 0x01, 0x70, 0x28, 0x00, 0x00, + // 2481 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x5a, 0x4d, 0x6c, 0x1c, 0x49, + 0x15, 0x76, 0x8f, 0x7f, 0x62, 0x97, 0x37, 0xde, 0xdd, 0x8a, 0x93, 0x4c, 0xc6, 0x8e, 0xc7, 0xe9, + 0x24, 0xe0, 0xfc, 0x4d, 0xdb, 0x5e, 0x85, 0xdd, 0x04, 0xb2, 0x89, 0x67, 0x1c, 0x27, 0xa3, 0xfc, + 0x79, 0x3b, 0x4e, 0x16, 0x79, 0x09, 0x9d, 0x72, 0x77, 0x31, 0x6e, 0xdc, 0xd3, 0xdd, 0xee, 0x2a, + 0x4f, 0x32, 0x0a, 0x39, 0x2c, 0x48, 0x68, 0x97, 0x03, 0x0a, 0x42, 0xdc, 0xf7, 0x82, 0xc4, 0x81, + 0x13, 0x5a, 0x81, 0x10, 0x97, 0x3d, 0xee, 0x8d, 0x65, 0xf7, 0x82, 0x40, 0x0a, 0x28, 0xe1, 0x80, + 0x90, 0x90, 0xd0, 0xc2, 0x15, 0x09, 0x75, 0x75, 0xf5, 0xaf, 0x7b, 0xec, 0xee, 0x19, 0x1f, 0xb8, + 0xb9, 0xab, 0x5e, 0x7d, 0xef, 0xa7, 0xde, 0x7b, 0xf5, 0xde, 0x1b, 0x03, 0x49, 0x37, 0x29, 0x76, + 0xd4, 0x75, 0xa4, 0x9b, 0x0a, 0xc1, 0xea, 0x96, 0xa3, 0xd3, 0xb6, 0xa4, 0xaa, 0x2d, 0xc9, 0x76, + 0xac, 0x96, 0xae, 0x61, 0x47, 0x6a, 0xcd, 0x49, 0x9b, 0x5b, 0xd8, 0x69, 0x57, 0x6c, 0xc7, 0xa2, + 0x16, 0x3c, 0x9e, 0x72, 0xa0, 0xa2, 0xaa, 0xad, 0x8a, 0x7f, 0xa0, 0xd2, 0x9a, 0x2b, 0x4d, 0x36, + 0x2c, 0xab, 0x61, 0x60, 0x09, 0xd9, 0xba, 0x84, 0x4c, 0xd3, 0xa2, 0x88, 0xea, 0x96, 0x49, 0x3c, + 0x88, 0xd2, 0x78, 0xc3, 0x6a, 0x58, 0xec, 0x4f, 0xc9, 0xfd, 0x8b, 0xaf, 0x96, 0xf9, 0x19, 0xf6, + 0xb5, 0xb6, 0xf5, 0x1d, 0x89, 0xea, 0x4d, 0x4c, 0x28, 0x6a, 0xda, 0x9c, 0x60, 0x3e, 0x8b, 0xa8, + 0x81, 0x14, 0xde, 0x99, 0xd9, 0x4e, 0x67, 0x5a, 0x73, 0x12, 0x59, 0x47, 0x0e, 0xd6, 0x14, 0xd5, + 0x32, 0xc9, 0x56, 0x33, 0x38, 0x71, 0x72, 0x87, 0x13, 0x8f, 0x74, 0x07, 0x73, 0xb2, 0x49, 0x8a, +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x5a, 0x4d, 0xfe, 0x7f, 0x6a, 0x11, 0x2e, + 0xe7, 0x02, 0x2e, 0xad, 0xf3, 0xd2, 0xe3, 0x44, 0x99, 0xde, 0xb6, 0x31, 0x59, 0x1b, 0x62, 0x3f, + 0x84, 0xbf, 0xf1, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xbf, 0xe1, 0x9a, 0x77, 0x47, 0x28, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -3032,21 +3021,11 @@ func (m *QueryConsumerChainsRequest) MarshalToSizedBuffer(dAtA []byte) (int, err if m.Limit != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.Limit)) i-- - dAtA[i] = 0x18 + dAtA[i] = 0x10 } if m.Phase != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.Phase)) i-- - dAtA[i] = 0x10 - } - if m.FilterByPhase { - i-- - if m.FilterByPhase { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil @@ -4420,9 +4399,6 @@ func (m *QueryConsumerChainsRequest) Size() (n int) { } var l int _ = l - if m.FilterByPhase { - n += 2 - } if m.Phase != 0 { n += 1 + sovQuery(uint64(m.Phase)) } @@ -5225,26 +5201,6 @@ func (m *QueryConsumerChainsRequest) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field FilterByPhase", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.FilterByPhase = bool(v != 0) - case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Phase", wireType) } @@ -5263,7 +5219,7 @@ func (m *QueryConsumerChainsRequest) Unmarshal(dAtA []byte) error { break } } - case 3: + case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Limit", wireType) } From 0e391fba384ba7a4a54b052b567b665c75382d2f Mon Sep 17 00:00:00 2001 From: Simon Noetzlin Date: Wed, 28 Aug 2024 17:54:11 +0200 Subject: [PATCH 15/17] nit --- x/ccv/provider/keeper/grpc_query_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/x/ccv/provider/keeper/grpc_query_test.go b/x/ccv/provider/keeper/grpc_query_test.go index aba9efa618..b712050ba7 100644 --- a/x/ccv/provider/keeper/grpc_query_test.go +++ b/x/ccv/provider/keeper/grpc_query_test.go @@ -360,9 +360,9 @@ func TestGetConsumerChain(t *testing.T) { metadataLists[i] = types.ConsumerMetadata{Name: chainID} pk.SetConsumerMetadata(ctx, consumerId, metadataLists[i]) - phase := int32(i) + phase := types.ConsumerPhase(int32(i + 1)) - pk.SetConsumerPhase(ctx, consumerId, types.ConsumerPhase(phase)) + pk.SetConsumerPhase(ctx, consumerId, phase) expectedGetAllOrder = append(expectedGetAllOrder, types.Chain{ @@ -374,7 +374,7 @@ func TestGetConsumerChain(t *testing.T) { ValidatorsPowerCap: validatorPowerCaps[i], Allowlist: strAllowlist, Denylist: strDenylist, - Phase: types.ConsumerPhase(i), + Phase: phase, Metadata: metadataLists[i], }) } From f4c20704b9be5ec67b1c18cc593d00fd99cc02ff Mon Sep 17 00:00:00 2001 From: Simon Noetzlin Date: Wed, 28 Aug 2024 18:02:12 +0200 Subject: [PATCH 16/17] fix bad int conversion --- x/ccv/provider/client/cli/query.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/ccv/provider/client/cli/query.go b/x/ccv/provider/client/cli/query.go index 0ae16395d5..3139af678f 100644 --- a/x/ccv/provider/client/cli/query.go +++ b/x/ccv/provider/client/cli/query.go @@ -89,7 +89,7 @@ func CmdConsumerChains() *cobra.Command { req := &types.QueryConsumerChainsRequest{} if args[0] != "" { - phase, err := strconv.Atoi(args[0]) + phase, err := strconv.ParseInt(args[0], 10, 32) if err != nil { return err } @@ -97,7 +97,7 @@ func CmdConsumerChains() *cobra.Command { } if args[1] != "" { - limit, err := strconv.Atoi(args[1]) + limit, err := strconv.ParseInt(args[1], 10, 32) if err != nil { return err } From 2c8b7016373cde541fa3685331c7dbdb4c133410 Mon Sep 17 00:00:00 2001 From: Simon Noetzlin Date: Thu, 29 Aug 2024 10:29:13 +0200 Subject: [PATCH 17/17] update cli --- x/ccv/provider/client/cli/query.go | 7 +++++-- x/ccv/provider/keeper/grpc_query_test.go | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/x/ccv/provider/client/cli/query.go b/x/ccv/provider/client/cli/query.go index 3139af678f..53f81a90bf 100644 --- a/x/ccv/provider/client/cli/query.go +++ b/x/ccv/provider/client/cli/query.go @@ -77,8 +77,11 @@ func CmdConsumerGenesis() *cobra.Command { func CmdConsumerChains() *cobra.Command { cmd := &cobra.Command{ Use: "list-consumer-chains [phase] [limit]", - Short: "Query active consumer chains for provider chain.", - Args: cobra.MaximumNArgs(2), + Short: "Query consumer chains for provider chain.", + Long: `Query consumer chains for provider chain. An optional + integer parameter can be passed for phase filtering of consumer chains, + (Registered=1|Initialized=2|Launched=3|Stopped=4).`, + Args: cobra.MaximumNArgs(2), RunE: func(cmd *cobra.Command, args []string) (err error) { clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { diff --git a/x/ccv/provider/keeper/grpc_query_test.go b/x/ccv/provider/keeper/grpc_query_test.go index bc45834800..a618a66d84 100644 --- a/x/ccv/provider/keeper/grpc_query_test.go +++ b/x/ccv/provider/keeper/grpc_query_test.go @@ -442,6 +442,8 @@ func TestGetConsumerChain(t *testing.T) { Top_N: topN, ValidatorSetCap: validatorSetCaps[i], ValidatorsPowerCap: validatorPowerCaps[i], + MinStake: minStakes[i].Uint64(), + AllowInactiveVals: allowInactiveVals[i], }) pk.SetMinimumPowerInTopN(ctx, consumerID, expectedMinPowerInTopNs[i]) for _, addr := range allowlists[i] {