From 38320a2333c6c48ac4252e9106b7083172831b63 Mon Sep 17 00:00:00 2001 From: Marius Poke Date: Tue, 3 Sep 2024 17:04:31 +0200 Subject: [PATCH 01/28] fix!: handle some panics (#2205) * getTotalPower should not panic * return error from EndBlockVSU * fix UT * fix error message --- x/ccv/provider/keeper/relay.go | 68 +++++++++++-------- x/ccv/provider/keeper/relay_test.go | 31 ++++++--- .../provider/keeper/validator_set_storage.go | 2 +- 3 files changed, 61 insertions(+), 40 deletions(-) diff --git a/x/ccv/provider/keeper/relay.go b/x/ccv/provider/keeper/relay.go index c95bd71079..b008d79d54 100644 --- a/x/ccv/provider/keeper/relay.go +++ b/x/ccv/provider/keeper/relay.go @@ -60,18 +60,25 @@ func (k Keeper) OnTimeoutPacket(ctx sdk.Context, packet channeltypes.Packet) err // the Validator Set Update sub-protocol func (k Keeper) EndBlockVSU(ctx sdk.Context) ([]abci.ValidatorUpdate, error) { // logic to update the provider consensus validator set. - valUpdates := k.ProviderValidatorUpdates(ctx) + valUpdates, err := k.ProviderValidatorUpdates(ctx) + if err != nil { + return []abci.ValidatorUpdate{}, fmt.Errorf("computing the provider consensus validator set: %w", err) + } if k.BlocksUntilNextEpoch(ctx) == 0 { // only queue and send VSCPackets at the boundaries of an epoch // collect validator updates - k.QueueVSCPackets(ctx) + if err := k.QueueVSCPackets(ctx); err != nil { + return []abci.ValidatorUpdate{}, fmt.Errorf("queueing consumer validator updates: %w", err) + } // try sending VSC packets to all registered consumer chains; // if the CCV channel is not established for a consumer chain, // the updates will remain queued until the channel is established - k.SendVSCPackets(ctx) + if err := k.SendVSCPackets(ctx); err != nil { + return []abci.ValidatorUpdate{}, fmt.Errorf("sending consumer validator updates: %w", err) + } } return valUpdates, nil @@ -82,17 +89,17 @@ func (k Keeper) EndBlockVSU(ctx sdk.Context) ([]abci.ValidatorUpdate, error) { // It retrieves the bonded validators from the staking module and creates a `ConsumerValidator` object for each validator. // The maximum number of validators is determined by the `maxValidators` parameter. // The function returns the difference between the current validator set and the next validator set as a list of `abci.ValidatorUpdate` objects. -func (k Keeper) ProviderValidatorUpdates(ctx sdk.Context) []abci.ValidatorUpdate { +func (k Keeper) ProviderValidatorUpdates(ctx sdk.Context) ([]abci.ValidatorUpdate, error) { // get the bonded validators from the staking module bondedValidators, err := k.stakingKeeper.GetBondedValidatorsByPower(ctx) if err != nil { - panic(fmt.Errorf("failed to get bonded validators: %w", err)) + return []abci.ValidatorUpdate{}, fmt.Errorf("getting bonded validators: %w", err) } // get the last validator set sent to consensus currentValidators, err := k.GetLastProviderConsensusValSet(ctx) if err != nil { - panic(fmt.Errorf("failed to get last provider consensus validator set: %w", err)) + return []abci.ValidatorUpdate{}, fmt.Errorf("getting last provider consensus validator set: %w", err) } nextValidators := []types.ConsensusValidator{} @@ -104,8 +111,8 @@ func (k Keeper) ProviderValidatorUpdates(ctx sdk.Context) []abci.ValidatorUpdate for _, val := range bondedValidators[:maxValidators] { nextValidator, err := k.CreateProviderConsensusValidator(ctx, val) if err != nil { - k.Logger(ctx).Error("error when creating provider consensus validator", "error", err, "validator", val) - continue + return []abci.ValidatorUpdate{}, + fmt.Errorf("creating provider consensus validator(%s): %w", val.OperatorAddress, err) } nextValidators = append(nextValidators, nextValidator) } @@ -115,7 +122,7 @@ func (k Keeper) ProviderValidatorUpdates(ctx sdk.Context) []abci.ValidatorUpdate valUpdates := DiffValidators(currentValidators, nextValidators) - return valUpdates + return valUpdates, nil } // BlocksUntilNextEpoch returns the number of blocks until the next epoch starts @@ -135,17 +142,20 @@ func (k Keeper) BlocksUntilNextEpoch(ctx sdk.Context) int64 { // VSC packets to the chains with established CCV channels. // 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) { +func (k Keeper) SendVSCPackets(ctx sdk.Context) error { for _, chainID := range k.GetAllRegisteredConsumerChainIDs(ctx) { // check if CCV channel is established and send if channelID, found := k.GetChainToChannel(ctx, chainID); found { - k.SendVSCPacketsToChain(ctx, chainID, channelID) + if err := k.SendVSCPacketsToChain(ctx, chainID, channelID); err != nil { + return fmt.Errorf("sending VSCPacket to consumer, chainID(%s): %w", chainID, err) + } } } + return nil } // SendVSCPacketsToChain sends all queued VSC packets to the specified chain -func (k Keeper) SendVSCPacketsToChain(ctx sdk.Context, chainID, channelID string) { +func (k Keeper) SendVSCPacketsToChain(ctx sdk.Context, chainID, channelID string) error { pendingPackets := k.GetPendingVSCPackets(ctx, chainID) for _, data := range pendingPackets { // send packet over IBC @@ -164,54 +174,52 @@ func (k Keeper) SendVSCPacketsToChain(ctx sdk.Context, chainID, channelID string // 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) - return + return nil } // Not able to send packet over IBC! k.Logger(ctx).Error("cannot send VSC, removing consumer:", "chainID", chainID, "vscid", data.ValsetUpdateId, "err", err.Error()) // If this happens, most likely the consumer is malicious; remove it err := k.StopConsumerChain(ctx, chainID, true) if err != nil { - panic(fmt.Errorf("consumer chain failed to stop: %w", err)) + return fmt.Errorf("stopping consumer, chainID(%s): %w", chainID, err) } - return + return nil } } k.DeletePendingVSCPackets(ctx, chainID) + + return nil } // QueueVSCPackets queues latest validator updates for every registered consumer chain -// failing to GetLastBondedValidators will cause a panic in EndBlock - -// TODO: decide if this func shouldn't return an error to be propagated to BeginBlocker -func (k Keeper) QueueVSCPackets(ctx sdk.Context) { +func (k Keeper) QueueVSCPackets(ctx sdk.Context) error { valUpdateID := k.GetValidatorSetUpdateId(ctx) // current valset update ID // get the bonded validators from the staking module bondedValidators, err := k.GetLastBondedValidators(ctx) if err != nil { - panic(fmt.Errorf("failed to get last validators: %w", err)) + return fmt.Errorf("getting bonded validators: %w", err) + } + + // get the provider active validators + activeValidators, err := k.GetLastProviderConsensusActiveValidators(ctx) + if err != nil { + return fmt.Errorf("getting provider active validators: %w", err) } for _, chainID := range k.GetAllRegisteredConsumerChainIDs(ctx) { currentValidators, err := k.GetConsumerValSet(ctx, chainID) if err != nil { - panic(fmt.Errorf("failed to get consumer validators: %w", err)) + return fmt.Errorf("getting consumer validators, chainID(%s): %w", chainID, err) } topN, _ := k.GetTopN(ctx, chainID) if topN > 0 { // in a Top-N chain, we automatically opt in all validators that belong to the top N // of the active validators - activeValidators, err := k.GetLastProviderConsensusActiveValidators(ctx) - if err != nil { - // something must be broken in the bonded validators, so we have to panic since there is no realistic way to proceed - panic(fmt.Errorf("failed to get active validators: %w", err)) - } - 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)) + return fmt.Errorf("computing min power to opt in, chainID(%s): %w", chainID, err) } // set the minimal power of validators in the top N in the store @@ -239,6 +247,8 @@ func (k Keeper) QueueVSCPackets(ctx sdk.Context) { } k.IncrementValidatorSetUpdateId(ctx) + + return nil } // BeginBlockCIS contains the BeginBlock logic needed for the Consumer Initiated Slashing sub-protocol. diff --git a/x/ccv/provider/keeper/relay_test.go b/x/ccv/provider/keeper/relay_test.go index 91de369851..ad427ca6c7 100644 --- a/x/ccv/provider/keeper/relay_test.go +++ b/x/ccv/provider/keeper/relay_test.go @@ -68,11 +68,14 @@ func TestQueueVSCPackets(t *testing.T) { mocks := testkeeper.NewMockedKeepers(ctrl) testkeeper.SetupMocksForLastBondedValidatorsExpectation(mocks.MockStakingKeeper, 0, []stakingtypes.Validator{}, 1) + mocks.MockStakingKeeper.EXPECT().GetBondedValidatorsByPower(gomock.Any()).Return([]stakingtypes.Validator{}, nil).AnyTimes() + pk := testkeeper.NewInMemProviderKeeper(keeperParams, mocks) // no-op if tc.packets is empty pk.AppendPendingVSCPackets(ctx, chainID, tc.packets...) - pk.QueueVSCPackets(ctx) + err := pk.QueueVSCPackets(ctx) + require.NoError(t, err) pending := pk.GetPendingVSCPackets(ctx, chainID) require.Len(t, pending, tc.expectedQueueSize, "pending vsc queue mismatch (%v != %v) in case: '%s'", tc.expectedQueueSize, len(pending), tc.name) @@ -120,7 +123,8 @@ func TestQueueVSCPacketsDoesNotResetConsumerValidatorsHeights(t *testing.T) { // validator for the first time after the `QueueVSCPackets` call. providerKeeper.SetOptedIn(ctx, "chainID", providertypes.NewProviderConsAddress(valBConsAddr)) - providerKeeper.QueueVSCPackets(ctx) + err := providerKeeper.QueueVSCPackets(ctx) + require.NoError(t, err) // 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)) @@ -501,8 +505,9 @@ func TestSendVSCPacketsToChainFailure(t *testing.T) { require.NoError(t, err) providerKeeper.SetConsumerClientId(ctx, "consumerChainID", "clientID") - // No panic should occur, StopConsumerChain should be called - providerKeeper.SendVSCPacketsToChain(ctx, "consumerChainID", "CCVChannelID") + // No error should occur, StopConsumerChain should be called + err = providerKeeper.SendVSCPacketsToChain(ctx, "consumerChainID", "CCVChannelID") + require.NoError(t, err) // Pending VSC packets should be deleted in StopConsumerChain require.Empty(t, providerKeeper.GetPendingVSCPackets(ctx, "consumerChainID")) @@ -616,24 +621,28 @@ func TestEndBlockVSU(t *testing.T) { // with block height of 1 we do not expect any queueing of VSC packets ctx = ctx.WithBlockHeight(1) - providerKeeper.EndBlockVSU(ctx) + _, err := providerKeeper.EndBlockVSU(ctx) + require.NoError(t, err) require.Equal(t, 0, len(providerKeeper.GetPendingVSCPackets(ctx, chainID))) // with block height of 5 we do not expect any queueing of VSC packets ctx = ctx.WithBlockHeight(5) - providerKeeper.EndBlockVSU(ctx) + _, err = providerKeeper.EndBlockVSU(ctx) + require.NoError(t, err) require.Equal(t, 0, len(providerKeeper.GetPendingVSCPackets(ctx, chainID))) // with block height of 10 we expect the queueing of one VSC packet ctx = ctx.WithBlockHeight(10) - providerKeeper.EndBlockVSU(ctx) + _, err = providerKeeper.EndBlockVSU(ctx) + require.NoError(t, err) require.Equal(t, 1, len(providerKeeper.GetPendingVSCPackets(ctx, chainID))) // With block height of 15 we expect no additional queueing of a VSC packet. // Note that the pending VSC packet is still there because `SendVSCPackets` does not send the packet. We // need to mock channels, etc. for this to work, and it's out of scope for this test. ctx = ctx.WithBlockHeight(15) - providerKeeper.EndBlockVSU(ctx) + _, err = providerKeeper.EndBlockVSU(ctx) + require.NoError(t, err) require.Equal(t, 1, len(providerKeeper.GetPendingVSCPackets(ctx, chainID))) } @@ -699,7 +708,8 @@ func TestProviderValidatorUpdates(t *testing.T) { } // Execute the function - updates := providerKeeper.ProviderValidatorUpdates(ctx) + updates, err := providerKeeper.ProviderValidatorUpdates(ctx) + require.NoError(t, err) // Assertions require.ElementsMatch(t, expectedUpdates, updates, "The validator updates should match the expected updates") @@ -756,7 +766,8 @@ func TestQueueVSCPacketsWithPowerCapping(t *testing.T) { params.MaxProviderConsensusValidators = 180 providerKeeper.SetParams(ctx, params) - providerKeeper.QueueVSCPackets(ctx) + err := providerKeeper.QueueVSCPackets(ctx) + require.NoError(t, err) actualQueuedVSCPackets := providerKeeper.GetPendingVSCPackets(ctx, "chainID") expectedQueuedVSCPackets := []ccv.ValidatorSetChangePacketData{ diff --git a/x/ccv/provider/keeper/validator_set_storage.go b/x/ccv/provider/keeper/validator_set_storage.go index cad322ed6b..b829f2f743 100644 --- a/x/ccv/provider/keeper/validator_set_storage.go +++ b/x/ccv/provider/keeper/validator_set_storage.go @@ -112,7 +112,7 @@ func (k Keeper) getTotalPower(ctx sdk.Context, prefix []byte) (math.Int, error) totalPower := math.ZeroInt() validators, err := k.getValSet(ctx, prefix) if err != nil { - panic(fmt.Errorf("retrieving validator set: %w", err)) + return totalPower, err } for _, val := range validators { totalPower = totalPower.Add(math.NewInt(val.Power)) From ac22ba37313cb428eb65eeee4d7d698413c9252c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 4 Sep 2024 14:32:37 +0200 Subject: [PATCH 02/28] build(deps): bump github.com/cosmos/ibc-go/v8 from 8.4.0 to 8.5.0 (#2200) * build(deps): bump github.com/cosmos/ibc-go/v8 from 8.4.0 to 8.5.0 Bumps [github.com/cosmos/ibc-go/v8](https://github.com/cosmos/ibc-go) from 8.4.0 to 8.5.0. - [Release notes](https://github.com/cosmos/ibc-go/releases) - [Changelog](https://github.com/cosmos/ibc-go/blob/v8.5.0/CHANGELOG.md) - [Commits](https://github.com/cosmos/ibc-go/compare/v8.4.0...v8.5.0) --- updated-dependencies: - dependency-name: github.com/cosmos/ibc-go/v8 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * update changelog entry --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: mpoke --- .../unreleased/dependencies/2113-bump-ibc.md | 3 - .../unreleased/dependencies/2200-bump-ibc.md | 3 + go.mod | 75 ++++---- go.sum | 167 +++++++++--------- 4 files changed, 126 insertions(+), 122 deletions(-) delete mode 100644 .changelog/unreleased/dependencies/2113-bump-ibc.md create mode 100644 .changelog/unreleased/dependencies/2200-bump-ibc.md diff --git a/.changelog/unreleased/dependencies/2113-bump-ibc.md b/.changelog/unreleased/dependencies/2113-bump-ibc.md deleted file mode 100644 index 05104f8c46..0000000000 --- a/.changelog/unreleased/dependencies/2113-bump-ibc.md +++ /dev/null @@ -1,3 +0,0 @@ -- Bump [ibc-go](https://github.com/cosmos/ibc-go) to - [v8.4.0](https://github.com/cosmos/ibc-go/releases/tag/v8.4.0). - ([\#2113](https://github.com/cosmos/interchain-security/pull/2113)) \ No newline at end of file diff --git a/.changelog/unreleased/dependencies/2200-bump-ibc.md b/.changelog/unreleased/dependencies/2200-bump-ibc.md new file mode 100644 index 0000000000..93aafcafb0 --- /dev/null +++ b/.changelog/unreleased/dependencies/2200-bump-ibc.md @@ -0,0 +1,3 @@ +- Bump [ibc-go](https://github.com/cosmos/ibc-go) to + [v8.5.0](https://github.com/cosmos/ibc-go/releases/tag/v8.5.0). + ([\#2200](https://github.com/cosmos/interchain-security/pull/2200)) \ No newline at end of file diff --git a/go.mod b/go.mod index 4baefd82e8..18a5ac3492 100644 --- a/go.mod +++ b/go.mod @@ -5,11 +5,11 @@ go 1.22.2 require ( cosmossdk.io/errors v1.0.1 cosmossdk.io/math v1.3.0 - github.com/cometbft/cometbft v0.38.9 + github.com/cometbft/cometbft v0.38.11 github.com/cometbft/cometbft-db v0.12.0 // indirect - github.com/cosmos/cosmos-sdk v0.50.8 + github.com/cosmos/cosmos-sdk v0.50.9 github.com/cosmos/gogoproto v1.7.0 - github.com/cosmos/ics23/go v0.10.0 + github.com/cosmos/ics23/go v0.11.0 github.com/golang/mock v1.6.0 github.com/golang/protobuf v1.5.4 github.com/gorilla/mux v1.8.1 // indirect @@ -17,28 +17,28 @@ require ( github.com/kylelemons/godebug v1.1.0 github.com/oxyno-zeta/gomock-extra-matcher v1.2.0 github.com/spf13/cast v1.7.0 - github.com/spf13/cobra v1.8.0 + github.com/spf13/cobra v1.8.1 github.com/stretchr/testify v1.9.0 github.com/tidwall/gjson v1.17.3 - golang.org/x/crypto v0.23.0 // indirect - golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 - golang.org/x/net v0.25.0 // indirect - golang.org/x/sys v0.22.0 // indirect - google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect + golang.org/x/crypto v0.26.0 // indirect + golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 + golang.org/x/net v0.27.0 // indirect + golang.org/x/sys v0.24.0 // indirect + google.golang.org/genproto v0.0.0-20240701130421-f6361c86f094 // indirect google.golang.org/grpc v1.65.0 - google.golang.org/protobuf v1.34.1 + google.golang.org/protobuf v1.34.2 gopkg.in/yaml.v2 v2.4.0 ) require ( - cloud.google.com/go v0.112.0 // indirect + cloud.google.com/go v0.115.0 // indirect cloud.google.com/go/compute/metadata v0.3.0 // indirect - cloud.google.com/go/iam v1.1.6 // indirect - cloud.google.com/go/storage v1.36.0 // indirect + cloud.google.com/go/iam v1.1.9 // indirect + cloud.google.com/go/storage v1.41.0 // indirect cosmossdk.io/api v0.7.5 - cosmossdk.io/core v0.11.0 - cosmossdk.io/depinject v1.0.0-alpha.4 // indirect - filippo.io/edwards25519 v1.0.0 // indirect + cosmossdk.io/core v0.11.1 + cosmossdk.io/depinject v1.0.0 // indirect + filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect github.com/aws/aws-sdk-go v1.44.224 // indirect @@ -79,13 +79,13 @@ require ( github.com/google/orderedcode v0.0.1 // indirect github.com/google/uuid v1.6.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect - github.com/googleapis/gax-go/v2 v2.12.3 // indirect + github.com/googleapis/gax-go/v2 v2.12.5 // indirect github.com/gorilla/handlers v1.5.2 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-getter v1.7.3 // indirect + github.com/hashicorp/go-getter v1.7.4 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-safetemp v1.0.0 // indirect github.com/hashicorp/go-version v1.6.0 // indirect @@ -99,7 +99,6 @@ require ( github.com/jmhodges/levigo v1.0.0 // indirect github.com/klauspost/compress v1.17.7 // indirect github.com/lib/pq v1.10.7 // indirect - github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/linxGnu/grocksdb v1.8.14 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/manifoldco/promptui v0.9.0 // indirect @@ -109,7 +108,7 @@ require ( github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mtibben/percent v0.2.1 // indirect - github.com/pelletier/go-toml/v2 v2.1.0 // indirect + github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect @@ -133,10 +132,10 @@ require ( github.com/zondax/ledger-go v0.14.3 // indirect go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 // indirect go.opencensus.io v0.24.0 // indirect - golang.org/x/oauth2 v0.20.0 // indirect - golang.org/x/term v0.20.0 // indirect - golang.org/x/text v0.15.0 // indirect - google.golang.org/api v0.171.0 // indirect + golang.org/x/oauth2 v0.21.0 // indirect + golang.org/x/term v0.23.0 // indirect + golang.org/x/text v0.17.0 // indirect + google.golang.org/api v0.186.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect nhooyr.io/websocket v1.8.6 // indirect @@ -145,26 +144,28 @@ require ( ) require ( - cosmossdk.io/client/v2 v2.0.0-beta.1 + cosmossdk.io/client/v2 v2.0.0-beta.3 cosmossdk.io/collections v0.4.0 cosmossdk.io/log v1.4.1 cosmossdk.io/store v1.1.0 - cosmossdk.io/tools/confix v0.1.1 - cosmossdk.io/x/evidence v0.1.0 - cosmossdk.io/x/feegrant v0.1.0 + cosmossdk.io/tools/confix v0.1.2 + cosmossdk.io/x/evidence v0.1.1 + cosmossdk.io/x/feegrant v0.1.1 cosmossdk.io/x/tx v0.13.4 - cosmossdk.io/x/upgrade v0.1.1 + cosmossdk.io/x/upgrade v0.1.4 github.com/cosmos/cosmos-db v1.0.2 - github.com/cosmos/ibc-go/modules/capability v1.0.0 - github.com/cosmos/ibc-go/v8 v8.4.0 + github.com/cosmos/ibc-go/modules/capability v1.0.1 + github.com/cosmos/ibc-go/v8 v8.5.0 github.com/informalsystems/itf-go v0.0.1 - github.com/spf13/viper v1.18.2 + github.com/spf13/viper v1.19.0 golang.org/x/mod v0.20.0 - google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 + google.golang.org/genproto/googleapis/api v0.0.0-20240624140628-dc46fd24d27d ) require ( - cosmossdk.io/x/circuit v0.1.0 // indirect + cloud.google.com/go/auth v0.6.0 // indirect + cloud.google.com/go/auth/oauth2adapt v0.2.2 // indirect + cosmossdk.io/x/circuit v0.1.1 // indirect github.com/DataDog/datadog-go v3.2.0+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect github.com/bits-and-blooms/bitset v1.8.0 // indirect @@ -205,10 +206,10 @@ require ( go.opentelemetry.io/otel/metric v1.24.0 // indirect go.opentelemetry.io/otel/trace v1.24.0 // indirect go.uber.org/mock v0.2.0 // indirect - go.uber.org/multierr v1.10.0 // indirect - golang.org/x/sync v0.7.0 // indirect + go.uber.org/multierr v1.11.0 // indirect + golang.org/x/sync v0.8.0 // indirect golang.org/x/time v0.5.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5 // indirect gotest.tools/v3 v3.5.1 // indirect ) diff --git a/go.sum b/go.sum index c1fa7b772a..429368b809 100644 --- a/go.sum +++ b/go.sum @@ -30,8 +30,8 @@ cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w9 cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU= cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRYtA= -cloud.google.com/go v0.112.0 h1:tpFCD7hpHFlQ8yPwT3x+QeXqc2T6+n6T+hmABHfDUSM= -cloud.google.com/go v0.112.0/go.mod h1:3jEEVwZ/MHU4djK5t5RHuKOA/GbLddgTdVubX1qnPD4= +cloud.google.com/go v0.115.0 h1:CnFSK6Xo3lDYRoBKEcAtia6VSC837/ZkJuRduSFnr14= +cloud.google.com/go v0.115.0/go.mod h1:8jIM5vVgoAEoiVxQ/O4BFTfHqulPZgs/ufEzMcFMdWU= cloud.google.com/go/aiplatform v1.22.0/go.mod h1:ig5Nct50bZlzV6NvKaTwmplLLddFx0YReh9WfTO5jKw= cloud.google.com/go/aiplatform v1.24.0/go.mod h1:67UUvRBKG6GTayHKV8DBv2RtR1t93YRu5B1P3x99mYY= cloud.google.com/go/analytics v0.11.0/go.mod h1:DjEWCu41bVbYcKyvlws9Er60YE4a//bK6mnhWvQeFNI= @@ -46,6 +46,10 @@ cloud.google.com/go/asset v1.8.0/go.mod h1:mUNGKhiqIdbr8X7KNayoYvyc4HbbFO9URsjby cloud.google.com/go/assuredworkloads v1.5.0/go.mod h1:n8HOZ6pff6re5KYfBXcFvSViQjDwxFkAkmUFffJRbbY= cloud.google.com/go/assuredworkloads v1.6.0/go.mod h1:yo2YOk37Yc89Rsd5QMVECvjaMKymF9OP+QXWlKXUkXw= cloud.google.com/go/assuredworkloads v1.7.0/go.mod h1:z/736/oNmtGAyU47reJgGN+KVoYoxeLBoj4XkKYscNI= +cloud.google.com/go/auth v0.6.0 h1:5x+d6b5zdezZ7gmLWD1m/xNjnaQ2YDhmIz/HH3doy1g= +cloud.google.com/go/auth v0.6.0/go.mod h1:b4acV+jLQDyjwm4OXHYjNvRi4jvGBzHWJRtJcy+2P4g= +cloud.google.com/go/auth/oauth2adapt v0.2.2 h1:+TTV8aXpjeChS9M+aTtN/TjdQnzJvmzKFt//oWu7HX4= +cloud.google.com/go/auth/oauth2adapt v0.2.2/go.mod h1:wcYjgpZI9+Yu7LyYBg4pqSiaRkfEK3GQcpb7C/uyF1Q= cloud.google.com/go/automl v1.5.0/go.mod h1:34EjfoFGMZ5sgJ9EoLsRtdPSNZLcfflJR39VbVNS2M0= cloud.google.com/go/automl v1.6.0/go.mod h1:ugf8a6Fx+zP0D59WLhqgTDsQI9w07o64uf/Is3Nh5p8= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= @@ -107,8 +111,8 @@ cloud.google.com/go/gkehub v0.10.0/go.mod h1:UIPwxI0DsrpsVoWpLB0stwKCP+WFVG9+y97 cloud.google.com/go/grafeas v0.2.0/go.mod h1:KhxgtF2hb0P191HlY5besjYm6MqTSTj3LSI+M+ByZHc= cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= cloud.google.com/go/iam v0.5.0/go.mod h1:wPU9Vt0P4UmCux7mqtRu6jcpPAb74cP1fh50J3QpkUc= -cloud.google.com/go/iam v1.1.6 h1:bEa06k05IO4f4uJonbB5iAgKTPpABy1ayxaIZV/GHVc= -cloud.google.com/go/iam v1.1.6/go.mod h1:O0zxdPeGBoFdWW3HWmBxJsk0pfvNM/p/qa82rWOGTwI= +cloud.google.com/go/iam v1.1.9 h1:oSkYLVtVme29uGYrOcKcvJRht7cHJpYD09GM9JaR0TE= +cloud.google.com/go/iam v1.1.9/go.mod h1:Nt1eDWNYH9nGQg3d/mY7U1hvfGmsaG9o/kLGoLoLXjQ= cloud.google.com/go/language v1.4.0/go.mod h1:F9dRpNFQmJbkaop6g0JhSBXCNlO90e1KWx5iDdxbWic= cloud.google.com/go/language v1.6.0/go.mod h1:6dJ8t3B+lUYfStgls25GusK04NLh3eDLQnWM3mdEbhI= cloud.google.com/go/lifesciences v0.5.0/go.mod h1:3oIKy8ycWGPUyZDR/8RNnTOYevhaMLqh5vLUXs9zvT8= @@ -169,8 +173,8 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9 cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq6kuBTW58Y= cloud.google.com/go/storage v1.23.0/go.mod h1:vOEEDNFnciUMhBeT6hsJIn3ieU5cFRmzeLgDvXzfIXc= cloud.google.com/go/storage v1.27.0/go.mod h1:x9DOL8TK/ygDUMieqwfhdpQryTeEkhGKMi80i/iqR2s= -cloud.google.com/go/storage v1.36.0 h1:P0mOkAcaJxhCTvAkMhxMfrTKiNcub4YmmPBtlhAyTr8= -cloud.google.com/go/storage v1.36.0/go.mod h1:M6M/3V/D3KpzMTJyPOR/HU6n2Si5QdaXYEsng2xgOs8= +cloud.google.com/go/storage v1.41.0 h1:RusiwatSu6lHeEXe3kglxakAmAbfV+rhtPqA6i8RBx0= +cloud.google.com/go/storage v1.41.0/go.mod h1:J1WCa/Z2FcgdEDuPUY8DxT5I+d9mFKsCepp5vR6Sq80= cloud.google.com/go/talent v1.1.0/go.mod h1:Vl4pt9jiHKvOgF9KoZo6Kob9oV4lwd/ZD5Cto54zDRw= cloud.google.com/go/talent v1.2.0/go.mod h1:MoNF9bhFQbiJ6eFD3uSsg0uBALw4n4gaCaEjBw9zo8g= cloud.google.com/go/videointelligence v1.6.0/go.mod h1:w0DIDlVRKtwPCn/C4iwZIJdvC69yInhW0cfi+p546uU= @@ -184,14 +188,14 @@ cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1V cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= cosmossdk.io/api v0.7.5 h1:eMPTReoNmGUm8DeiQL9DyM8sYDjEhWzL1+nLbI9DqtQ= cosmossdk.io/api v0.7.5/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= -cosmossdk.io/client/v2 v2.0.0-beta.1 h1:XkHh1lhrLYIT9zKl7cIOXUXg2hdhtjTPBUfqERNA1/Q= -cosmossdk.io/client/v2 v2.0.0-beta.1/go.mod h1:JEUSu9moNZQ4kU3ir1DKD5eU4bllmAexrGWjmb9k8qU= +cosmossdk.io/client/v2 v2.0.0-beta.3 h1:+TTuH0DwQYsUq2JFAl3fDZzKq5gQG7nt3dAattkjFDU= +cosmossdk.io/client/v2 v2.0.0-beta.3/go.mod h1:CZcL41HpJPOOayTCO28j8weNBQprG+SRiKX39votypo= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= -cosmossdk.io/core v0.11.0 h1:vtIafqUi+1ZNAE/oxLOQQ7Oek2n4S48SWLG8h/+wdbo= -cosmossdk.io/core v0.11.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w= -cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98okJopc= -cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= +cosmossdk.io/core v0.11.1 h1:h9WfBey7NAiFfIcUhDVNS503I2P2HdZLebJlUIs8LPA= +cosmossdk.io/core v0.11.1/go.mod h1:OJzxcdC+RPrgGF8NJZR2uoQr56tc7gfBKhiKeDO7hH0= +cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= +cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= @@ -200,21 +204,21 @@ cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/store v1.1.0 h1:LnKwgYMc9BInn9PhpTFEQVbL9UK475G2H911CGGnWHk= cosmossdk.io/store v1.1.0/go.mod h1:oZfW/4Fc/zYqu3JmQcQdUJ3fqu5vnYTn3LZFFy8P8ng= -cosmossdk.io/tools/confix v0.1.1 h1:aexyRv9+y15veH3Qw16lxQwo+ki7r2I+g0yNTEFEQM8= -cosmossdk.io/tools/confix v0.1.1/go.mod h1:nQVvP1tHsGXS83PonPVWJtSbddIqyjEw99L4M3rPJyQ= -cosmossdk.io/x/circuit v0.1.0 h1:IAej8aRYeuOMritczqTlljbUVHq1E85CpBqaCTwYgXs= -cosmossdk.io/x/circuit v0.1.0/go.mod h1:YDzblVE8+E+urPYQq5kq5foRY/IzhXovSYXb4nwd39w= -cosmossdk.io/x/evidence v0.1.0 h1:J6OEyDl1rbykksdGynzPKG5R/zm6TacwW2fbLTW4nCk= -cosmossdk.io/x/evidence v0.1.0/go.mod h1:hTaiiXsoiJ3InMz1uptgF0BnGqROllAN8mwisOMMsfw= -cosmossdk.io/x/feegrant v0.1.0 h1:c7s3oAq/8/UO0EiN1H5BIjwVntujVTkYs35YPvvrdQk= -cosmossdk.io/x/feegrant v0.1.0/go.mod h1:4r+FsViJRpcZif/yhTn+E0E6OFfg4n0Lx+6cCtnZElU= +cosmossdk.io/tools/confix v0.1.2 h1:2hoM1oFCNisd0ltSAAZw2i4ponARPmlhuNu3yy0VwI4= +cosmossdk.io/tools/confix v0.1.2/go.mod h1:7XfcbK9sC/KNgVGxgLM0BrFbVcR/+6Dg7MFfpx7duYo= +cosmossdk.io/x/circuit v0.1.1 h1:KPJCnLChWrxD4jLwUiuQaf5mFD/1m7Omyo7oooefBVQ= +cosmossdk.io/x/circuit v0.1.1/go.mod h1:B6f/urRuQH8gjt4eLIXfZJucrbreuYrKh5CSjaOxr+Q= +cosmossdk.io/x/evidence v0.1.1 h1:Ks+BLTa3uftFpElLTDp9L76t2b58htjVbSZ86aoK/E4= +cosmossdk.io/x/evidence v0.1.1/go.mod h1:OoDsWlbtuyqS70LY51aX8FBTvguQqvFrt78qL7UzeNc= +cosmossdk.io/x/feegrant v0.1.1 h1:EKFWOeo/pup0yF0svDisWWKAA9Zags6Zd0P3nRvVvw8= +cosmossdk.io/x/feegrant v0.1.1/go.mod h1:2GjVVxX6G2fta8LWj7pC/ytHjryA6MHAJroBWHFNiEQ= cosmossdk.io/x/tx v0.13.4 h1:Eg0PbJgeO0gM8p5wx6xa0fKR7hIV6+8lC56UrsvSo0Y= cosmossdk.io/x/tx v0.13.4/go.mod h1:BkFqrnGGgW50Y6cwTy+JvgAhiffbGEKW6KF9ufcDpvk= -cosmossdk.io/x/upgrade v0.1.1 h1:aoPe2gNvH+Gwt/Pgq3dOxxQVU3j5P6Xf+DaUJTDZATc= -cosmossdk.io/x/upgrade v0.1.1/go.mod h1:MNLptLPcIFK9CWt7Ra//8WUZAxweyRDNcbs5nkOcQy0= +cosmossdk.io/x/upgrade v0.1.4 h1:/BWJim24QHoXde8Bc64/2BSEB6W4eTydq0X/2f8+g38= +cosmossdk.io/x/upgrade v0.1.4/go.mod h1:9v0Aj+fs97O+Ztw+tG3/tp5JSlrmT7IcFhAebQHmOPo= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek= -filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= +filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= +filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4= github.com/99designs/keyring v1.2.1 h1:tYLp1ULvO7i3fI5vE21ReQuj99QFSs7lGm0xWyJo87o= @@ -328,8 +332,8 @@ github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZ github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/cometbft/cometbft v0.38.9 h1:cJBJBG0mPKz+sqelCi/hlfZjadZQGdDNnu6YQ1ZsUHQ= -github.com/cometbft/cometbft v0.38.9/go.mod h1:xOoGZrtUT+A5izWfHSJgl0gYZUE7lu7Z2XIS1vWG/QQ= +github.com/cometbft/cometbft v0.38.11 h1:6bNDUB8/xq4uYonYwIfGc9OqK1ZH4NkdaMmR1LZIJqk= +github.com/cometbft/cometbft v0.38.11/go.mod h1:jHPx9vQpWzPHEAiYI/7EDKaB1NXhK6o3SArrrY8ExKc= github.com/cometbft/cometbft-db v0.12.0 h1:v77/z0VyfSU7k682IzZeZPFZrQAKiQwkqGN0QzAjMi0= github.com/cometbft/cometbft-db v0.12.0/go.mod h1:aX2NbCrjNVd2ZajYxt1BsiFf/Z+TQ2MN0VxdicheYuw= github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= @@ -344,8 +348,8 @@ github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAK github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= -github.com/cosmos/cosmos-sdk v0.50.8 h1:2UJHssUaGHTl4/dFp8xyREKAnfiRU6VVfqtKG9n8w5g= -github.com/cosmos/cosmos-sdk v0.50.8/go.mod h1:Zb+DgHtiByNwgj71IlJBXwOq6dLhtyAq3AgqpXm/jHo= +github.com/cosmos/cosmos-sdk v0.50.9 h1:gt2usjz0H0qW6KwAxWw7ZJ3XU8uDwmhN+hYG3nTLeSg= +github.com/cosmos/cosmos-sdk v0.50.9/go.mod h1:TMH6wpoYBcg7Cp5BEg8fneLr+8XloNQkf2MRNF9V6JE= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= @@ -355,16 +359,16 @@ github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fr github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= github.com/cosmos/iavl v1.1.2 h1:zL9FK7C4L/P4IF1Dm5fIwz0WXCnn7Bp1M2FxH0ayM7Y= github.com/cosmos/iavl v1.1.2/go.mod h1:jLeUvm6bGT1YutCaL2fIar/8vGUE8cPZvh/gXEWDaDM= -github.com/cosmos/ibc-go/modules/capability v1.0.0 h1:r/l++byFtn7jHYa09zlAdSeevo8ci1mVZNO9+V0xsLE= -github.com/cosmos/ibc-go/modules/capability v1.0.0/go.mod h1:D81ZxzjZAe0ZO5ambnvn1qedsFQ8lOwtqicG6liLBco= -github.com/cosmos/ibc-go/v8 v8.4.0 h1:K2PfX0AZ+1XKZytHGEMuSjQXG/MZshPb83RSTQt2+cE= -github.com/cosmos/ibc-go/v8 v8.4.0/go.mod h1:zh6x1osR0hNvEcFrC/lhGD08sMfQmr9wHVvZ/mRWMCs= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cosmos/ibc-go/modules/capability v1.0.1 h1:ibwhrpJ3SftEEZRxCRkH0fQZ9svjthrX2+oXdZvzgGI= +github.com/cosmos/ibc-go/modules/capability v1.0.1/go.mod h1:rquyOV262nGJplkumH+/LeYs04P3eV8oB7ZM4Ygqk4E= +github.com/cosmos/ibc-go/v8 v8.5.0 h1:OjaSXz480JT8ZuMrASxGgS7XzloZ2NuuJPwZB/fKDgE= +github.com/cosmos/ibc-go/v8 v8.5.0/go.mod h1:P5hkAvq0Qbg0h18uLxDVA9q1kOJ0l36htMsskiNwXbo= +github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= +github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creachadair/atomicfile v0.3.1 h1:yQORkHjSYySh/tv5th1dkKcn02NEW5JleB84sjt+W4Q= github.com/creachadair/atomicfile v0.3.1/go.mod h1:mwfrkRxFKwpNAflYZzytbSwxvbK6fdGRRlp0KEQc0qU= github.com/creachadair/tomledit v0.0.24 h1:5Xjr25R2esu1rKCbQEmjZYlrhFkDspoAbAKb6QKQDhQ= @@ -573,8 +577,8 @@ github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXi github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= -github.com/google/martian/v3 v3.3.2 h1:IqNFLAmvJOgVlpdEBiQbDc2EwKW77amAycfTuWKdfvw= -github.com/google/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= +github.com/google/martian/v3 v3.3.3 h1:DIhPTQrbPkgs2yJYdXU/eNACCG5DVQjySNRNlflZ9Fc= +github.com/google/martian/v3 v3.3.3/go.mod h1:iEPrYcgCF7jA9OtScMFQyAlZZ4YXTKEtJ1E6RWzmBA0= github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -613,8 +617,8 @@ github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99 github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c= github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEF02fYlzkUCyo= github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY= -github.com/googleapis/gax-go/v2 v2.12.3 h1:5/zPPDvw8Q1SuXjrqrZslrqT7dL/uJT2CQii/cLCKqA= -github.com/googleapis/gax-go/v2 v2.12.3/go.mod h1:AKloxT6GtNbaLm8QTNSidHUVsHYcBHwWRvkNFJUQcS4= +github.com/googleapis/gax-go/v2 v2.12.5 h1:8gw9KZK8TiVKB6q3zHY3SBzLnrGp6HQjyfYBYGmXdxA= +github.com/googleapis/gax-go/v2 v2.12.5/go.mod h1:BUDKcWo+RaKq5SC9vVYL0wLADa3VcfswbOMMRmB9H3E= github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= @@ -645,8 +649,8 @@ github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtng github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= -github.com/hashicorp/go-getter v1.7.3 h1:bN2+Fw9XPFvOCjB0UOevFIMICZ7G2XSQHzfvLUyOM5E= -github.com/hashicorp/go-getter v1.7.3/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= +github.com/hashicorp/go-getter v1.7.4 h1:3yQjWuxICvSpYwqSayAdKRFcvBl1y/vogCxczWSmix0= +github.com/hashicorp/go-getter v1.7.4/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c= github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= @@ -755,8 +759,6 @@ github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= -github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= github.com/linxGnu/grocksdb v1.8.14 h1:HTgyYalNwBSG/1qCQUIott44wU5b2Y9Kr3z7SK5OfGQ= @@ -864,8 +866,8 @@ github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FI github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= -github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= -github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= +github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= +github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67 h1:jik8PHtAIsPlCRJjJzl4udgEf7hawInF9texMeO2jrU= @@ -961,13 +963,13 @@ github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNo github.com/spf13/cast v1.7.0 h1:ntdiHjuueXFgm5nzDRdOS4yfT43P5Fnud6DH50rz/7w= github.com/spf13/cast v1.7.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= -github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= +github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= +github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ= -github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= +github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= +github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= @@ -1051,8 +1053,8 @@ go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo= go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo= go.opentelemetry.io/otel/metric v1.24.0 h1:6EhoGWWK28x1fbpA4tYTOWBkPefTDQnb8WSGXlc88kI= go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco= -go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8= -go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= +go.opentelemetry.io/otel/sdk v1.24.0 h1:YMPPDNymmQN3ZgczicBY3B6sf9n62Dlj9pWD3ucgoDw= +go.opentelemetry.io/otel/sdk v1.24.0/go.mod h1:KVrIYw6tEubO9E96HQpcmpTKDVn9gdv35HoYiQWGDFg= go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI= go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= @@ -1066,8 +1068,8 @@ go.uber.org/mock v0.2.0/go.mod h1:J0y0rp9L3xiff1+ZBfKxlC1fz2+aO16tw0tsDOixfuM= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= -go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ= -go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= @@ -1082,8 +1084,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI= -golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= +golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= +golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -1095,8 +1097,8 @@ golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= -golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 h1:985EYyeCOxTpcgOTJpflJUwOeEz0CQOdPt73OzpE9F8= -golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI= +golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 h1:yixxcjnhBmY0nkL253HFVIm0JsFHwrHdT3Yh6szTnfY= +golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -1186,8 +1188,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= -golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= +golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= +golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1213,8 +1215,8 @@ golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= -golang.org/x/oauth2 v0.20.0 h1:4mQdhULixXKP1rwYBW0vAijoXnkTG0BLCDRzfe1idMo= -golang.org/x/oauth2 v0.20.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= +golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1229,8 +1231,8 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1327,13 +1329,13 @@ golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw= -golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= +golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU= +golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1344,8 +1346,8 @@ golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= -golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= +golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1415,8 +1417,8 @@ golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.20.0 h1:hz/CVckiOxybQvFw6h7b/q80NTr9IUQb4s1IIzW7KNY= -golang.org/x/tools v0.20.0/go.mod h1:WvitBU7JJf6A4jOdg4S1tviW9bhUxkgeCui/0JHctQg= +golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= +golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1424,8 +1426,9 @@ golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= +golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU= +golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= @@ -1475,8 +1478,8 @@ google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ google.golang.org/api v0.97.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70= -google.golang.org/api v0.171.0 h1:w174hnBPqut76FzW5Qaupt7zY8Kql6fiVjgys4f58sU= -google.golang.org/api v0.171.0/go.mod h1:Hnq5AHm4OTMt2BUVjael2CWZFD6vksJdWCWiUAmjC9o= +google.golang.org/api v0.186.0 h1:n2OPp+PPXX0Axh4GuSsL5QL8xQCTb2oDwyzPnQvqUug= +google.golang.org/api v0.186.0/go.mod h1:hvRbBmgoje49RV3xqVXrmP6w93n6ehGgIVPYrGtBFFc= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -1591,12 +1594,12 @@ google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqw google.golang.org/genproto v0.0.0-20221014173430-6e2ab493f96b/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= -google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= -google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 h1:7whR9kGa5LUwFtpLm2ArCEejtnxlGeLbAyjFY8sGNFw= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 h1:Zy9XzmMEflZ/MAaA7vNcoebnRAld7FsPW1EeBB7V0m8= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= +google.golang.org/genproto v0.0.0-20240701130421-f6361c86f094 h1:6whtk83KtD3FkGrVb2hFXuQ+ZMbCNdakARIn/aHMmG8= +google.golang.org/genproto v0.0.0-20240701130421-f6361c86f094/go.mod h1:Zs4wYw8z1zr6RNF4cwYb31mvN/EGaKAdQjNCF3DW6K4= +google.golang.org/genproto/googleapis/api v0.0.0-20240624140628-dc46fd24d27d h1:Aqf0fiIdUQEj0Gn9mKFFXoQfTTEaNopWpfVyYADxiSg= +google.golang.org/genproto/googleapis/api v0.0.0-20240624140628-dc46fd24d27d/go.mod h1:Od4k8V1LQSizPRUK4OzZ7TBE/20k+jPczUDAEyvn69Y= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5 h1:SbSDUWW1PAO24TNpLdeheoYPd7kllICcLU52x6eD4kQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= @@ -1656,8 +1659,8 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= -google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From 5e583468b048539d923da18c7a4810b0f6617831 Mon Sep 17 00:00:00 2001 From: Marius Poke Date: Thu, 5 Sep 2024 07:44:25 +0200 Subject: [PATCH 03/28] docs: add missing changelog entries (#2210) add missing changelog entries --- .changelog/unreleased/dependencies/2200-bump-comet.md | 3 +++ .changelog/unreleased/dependencies/2200-bump-sdk.md | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 .changelog/unreleased/dependencies/2200-bump-comet.md create mode 100644 .changelog/unreleased/dependencies/2200-bump-sdk.md diff --git a/.changelog/unreleased/dependencies/2200-bump-comet.md b/.changelog/unreleased/dependencies/2200-bump-comet.md new file mode 100644 index 0000000000..881c5d88bd --- /dev/null +++ b/.changelog/unreleased/dependencies/2200-bump-comet.md @@ -0,0 +1,3 @@ +- Bump [CometBFT](https://github.com/cometbft/cometbft) to + [v0.38.11](https://github.com/cometbft/cometbft/releases/tag/v0.38.11). + ([\#2200](https://github.com/cosmos/interchain-security/pull/2200)) \ No newline at end of file diff --git a/.changelog/unreleased/dependencies/2200-bump-sdk.md b/.changelog/unreleased/dependencies/2200-bump-sdk.md new file mode 100644 index 0000000000..f72b918aea --- /dev/null +++ b/.changelog/unreleased/dependencies/2200-bump-sdk.md @@ -0,0 +1,3 @@ +- Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to +[v0.50.9](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.50.9) +([\#2200](https://github.com/cosmos/interchain-security/pull/2200)) \ No newline at end of file From 0349c45827957e0e5ae976f9a29bf44cacc78ba1 Mon Sep 17 00:00:00 2001 From: Marius Poke Date: Thu, 5 Sep 2024 09:33:25 +0200 Subject: [PATCH 04/28] fix!: add message validation of signers (bring fix to main) (#2216) Merge commit from fork * add fix * Revert "test: Fix use of hardcoded cosmos... address (backport #2122) (#2142)" This reverts commit d7af6722100309b4d277cf73491e3aef50d8f5b9. * add fix * revert nit * call validateBasic * Revert "call validateBasic" This reverts commit 463caea5ce267cb8e1f529ccd38dddbf7338a10f. Co-authored-by: Simon Noetzlin --- x/ccv/provider/types/msg.go | 28 +++++++--- x/ccv/provider/types/msg_test.go | 89 ++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+), 7 deletions(-) create mode 100644 x/ccv/provider/types/msg_test.go diff --git a/x/ccv/provider/types/msg.go b/x/ccv/provider/types/msg.go index c47c62e0a0..f9b84af0e4 100644 --- a/x/ccv/provider/types/msg.go +++ b/x/ccv/provider/types/msg.go @@ -103,10 +103,14 @@ func (msg MsgAssignConsumerKey) ValidateBasic() error { if 128 < len(msg.ChainId) { return errorsmod.Wrapf(ErrInvalidConsumerChainID, "chainId cannot exceed 128 length") } - _, err := sdk.ValAddressFromBech32(msg.ProviderAddr) + valAddr, err := sdk.ValAddressFromBech32(msg.ProviderAddr) if err != nil { return ErrInvalidProviderAddress } + // Check that the provider validator address and the signer address are the same + if sdk.AccAddress(valAddr.Bytes()).String() != msg.Signer { + return errorsmod.Wrapf(ErrInvalidProviderAddress, "provider validator address must be the same as the signer address") + } if msg.ConsumerKey == "" { return ErrInvalidConsumerConsensusPubKey } @@ -357,11 +361,14 @@ func (msg MsgOptIn) ValidateBasic() error { if 128 < len(msg.ChainId) { return errorsmod.Wrapf(ErrInvalidConsumerChainID, "chainId cannot exceed 128 length") } - _, err := sdk.ValAddressFromBech32(msg.ProviderAddr) + valAddr, err := sdk.ValAddressFromBech32(msg.ProviderAddr) if err != nil { return ErrInvalidProviderAddress } - + // Check that the provider validator address and the signer address are the same + if sdk.AccAddress(valAddr.Bytes()).String() != msg.Signer { + return errorsmod.Wrapf(ErrInvalidProviderAddress, "provider validator address must be the same as the signer address") + } if msg.ConsumerKey != "" { if _, _, err := ParseConsumerKeyFromJson(msg.ConsumerKey); err != nil { return ErrInvalidConsumerConsensusPubKey @@ -415,10 +422,15 @@ func (msg MsgOptOut) ValidateBasic() error { if 128 < len(msg.ChainId) { return errorsmod.Wrapf(ErrInvalidConsumerChainID, "chainId cannot exceed 128 length") } - _, err := sdk.ValAddressFromBech32(msg.ProviderAddr) + valAddr, err := sdk.ValAddressFromBech32(msg.ProviderAddr) if err != nil { return ErrInvalidProviderAddress } + // Check that the provider validator address and the signer address are the same + if sdk.AccAddress(valAddr.Bytes()).String() != msg.Signer { + return errorsmod.Wrapf(ErrInvalidProviderAddress, "provider validator address must be the same as the signer address") + } + return nil } @@ -444,15 +456,17 @@ 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") } - _, err := sdk.ValAddressFromBech32(msg.ProviderAddr) + valAddr, err := sdk.ValAddressFromBech32(msg.ProviderAddr) if err != nil { return ErrInvalidProviderAddress } - + // Check that the provider validator address and the signer address are the same + if sdk.AccAddress(valAddr.Bytes()).String() != msg.Signer { + return errorsmod.Wrapf(ErrInvalidProviderAddress, "provider validator address must be the same as the signer address") + } if msg.Rate.IsNegative() || msg.Rate.GT(math.LegacyOneDec()) { return errorsmod.Wrapf(ErrInvalidConsumerCommissionRate, "consumer commission rate should be in the range [0, 1]") } diff --git a/x/ccv/provider/types/msg_test.go b/x/ccv/provider/types/msg_test.go new file mode 100644 index 0000000000..4ef2a7efc8 --- /dev/null +++ b/x/ccv/provider/types/msg_test.go @@ -0,0 +1,89 @@ +package types_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + cryptoutil "github.com/cosmos/interchain-security/v5/testutil/crypto" + "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + "github.com/stretchr/testify/require" +) + +func TestMsgAssignConsumerKeyValidateBasic(t *testing.T) { + cId1 := cryptoutil.NewCryptoIdentityFromIntSeed(35443543534) + cId2 := cryptoutil.NewCryptoIdentityFromIntSeed(65465464564) + + valOpAddr1 := cId1.SDKValOpAddress() + acc1 := sdk.AccAddress(valOpAddr1.Bytes()).String() + acc2 := sdk.AccAddress(cId2.SDKValOpAddress().Bytes()).String() + + longChainId := "abcdefghijklmnopqrstuvwxyz" + for i := 0; i < 3; i++ { + longChainId += longChainId + } + + testCases := []struct { + name string + chainId string + providerAddr string + signer string + consumerKey string + expErr bool + }{ + { + name: "chain Id empty", + expErr: true, + }, + { + name: "chain Id too long", + chainId: longChainId, + expErr: true, + }, + { + name: "invalid provider address", + chainId: "chainId", + expErr: true, + }, + { + name: "invalid signer address: must be the same as the provider address", + chainId: "chainId", + providerAddr: valOpAddr1.String(), + signer: acc2, + expErr: true, + }, + { + name: "invalid consumer pubkey", + chainId: "chainId", + providerAddr: valOpAddr1.String(), + signer: acc1, + expErr: true, + }, + { + name: "valid assign consumer key msg", + chainId: "chainId", + providerAddr: valOpAddr1.String(), + consumerKey: "{\"@type\": \"/cosmos.crypto.ed25519.PubKey\", \"key\": \"e3BehnEIlGUAnJYn9V8gBXuMh4tXO8xxlxyXD1APGyk=\"}", + signer: acc1, + expErr: false, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + + msg := types.MsgAssignConsumerKey{ + ChainId: tc.chainId, + ConsumerKey: tc.consumerKey, + ProviderAddr: tc.providerAddr, + Signer: tc.signer, + } + + err := msg.ValidateBasic() + if tc.expErr { + require.Error(t, err) + } else { + require.NoError(t, err) + } + }) + } +} From 5583eaba1f6d09b48d4b10dfcba21c7aefe82965 Mon Sep 17 00:00:00 2001 From: Marius Poke Date: Thu, 5 Sep 2024 09:33:53 +0200 Subject: [PATCH 05/28] docs: bring v5.2.0 changelog to main (#2217) bring v5.2.0 changelog to main --- .../bug-fixes/provider/1dd3885-msg-validation.md | 2 ++ .../provider/1dd3885-msg-validation.md | 2 ++ .changelog/v5.2.0/summary.md | 1 + CHANGELOG.md | 16 ++++++++++++++++ 4 files changed, 21 insertions(+) create mode 100644 .changelog/v5.2.0/bug-fixes/provider/1dd3885-msg-validation.md create mode 100644 .changelog/v5.2.0/state-breaking/provider/1dd3885-msg-validation.md create mode 100644 .changelog/v5.2.0/summary.md diff --git a/.changelog/v5.2.0/bug-fixes/provider/1dd3885-msg-validation.md b/.changelog/v5.2.0/bug-fixes/provider/1dd3885-msg-validation.md new file mode 100644 index 0000000000..379e981ac0 --- /dev/null +++ b/.changelog/v5.2.0/bug-fixes/provider/1dd3885-msg-validation.md @@ -0,0 +1,2 @@ +- Improve provider message validation. + ([1dd3885](https://github.com/cosmos/interchain-security/commit/1dd38851dbb9e0d98c61bd11375ee7e140527833)) \ No newline at end of file diff --git a/.changelog/v5.2.0/state-breaking/provider/1dd3885-msg-validation.md b/.changelog/v5.2.0/state-breaking/provider/1dd3885-msg-validation.md new file mode 100644 index 0000000000..379e981ac0 --- /dev/null +++ b/.changelog/v5.2.0/state-breaking/provider/1dd3885-msg-validation.md @@ -0,0 +1,2 @@ +- Improve provider message validation. + ([1dd3885](https://github.com/cosmos/interchain-security/commit/1dd38851dbb9e0d98c61bd11375ee7e140527833)) \ No newline at end of file diff --git a/.changelog/v5.2.0/summary.md b/.changelog/v5.2.0/summary.md new file mode 100644 index 0000000000..9ef6348423 --- /dev/null +++ b/.changelog/v5.2.0/summary.md @@ -0,0 +1 @@ +*September 4, 2024* diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f9c8e1027..893c5b12e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # CHANGELOG +## v5.2.0 + +*September 4, 2024* + +### BUG FIXES + +- [Provider](x/ccv/provider) + - Improve provider message validation. + ([1dd3885](https://github.com/cosmos/interchain-security/commit/1dd38851dbb9e0d98c61bd11375ee7e140527833)) + +### STATE BREAKING + +- [Provider](x/ccv/provider) + - Improve provider message validation. + ([1dd3885](https://github.com/cosmos/interchain-security/commit/1dd38851dbb9e0d98c61bd11375ee7e140527833)) + ## v5.1.1 *July 26, 2024* From 50fa4cce0be996ff58072180cf5d0243ad44e72a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 5 Sep 2024 09:43:35 +0200 Subject: [PATCH 06/28] build(deps): bump bufbuild/buf-setup-action from 1.38.0 to 1.39.0 (#2202) Bumps [bufbuild/buf-setup-action](https://github.com/bufbuild/buf-setup-action) from 1.38.0 to 1.39.0. - [Release notes](https://github.com/bufbuild/buf-setup-action/releases) - [Commits](https://github.com/bufbuild/buf-setup-action/compare/v1.38.0...v1.39.0) --- updated-dependencies: - dependency-name: bufbuild/buf-setup-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/proto-registry.yml | 2 +- .github/workflows/proto.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/proto-registry.yml b/.github/workflows/proto-registry.yml index 4f817f987c..e00cb6709d 100644 --- a/.github/workflows/proto-registry.yml +++ b/.github/workflows/proto-registry.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: bufbuild/buf-setup-action@v1.38.0 + - uses: bufbuild/buf-setup-action@v1.39.0 - uses: bufbuild/buf-push-action@v1 with: input: "proto" diff --git a/.github/workflows/proto.yml b/.github/workflows/proto.yml index 66d12cf4d7..522a3ab546 100644 --- a/.github/workflows/proto.yml +++ b/.github/workflows/proto.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: bufbuild/buf-setup-action@v1.38.0 + - uses: bufbuild/buf-setup-action@v1.39.0 - uses: bufbuild/buf-breaking-action@v1 with: input: "proto" From f469211880d363dc3f39663b74a77c06d863573d Mon Sep 17 00:00:00 2001 From: Marius Poke Date: Thu, 5 Sep 2024 09:43:47 +0200 Subject: [PATCH 07/28] docs: update info on releases (#2218) * update info on releases * update supported_versions.json --- FEATURES.md | 32 ++++++++++++++++---------------- RELEASES.md | 27 ++++++++++++++------------- docs/supported_versions.json | 2 +- 3 files changed, 31 insertions(+), 30 deletions(-) diff --git a/FEATURES.md b/FEATURES.md index 291d60d896..3c33a715e1 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -2,19 +2,19 @@ The following table indicates the major ICS features available in the [currently active releases](./RELEASES.md#version-matrix): -| Feature | `v4.0.0` | `v4.3.1` | `v4.3.1-lsm` | `v4.4.0` | `v5.0.0` | -|---------|---------:|---------:|-------------:|---------:|---------:| -| [Channel initialization: new chains](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/overview_and_basic_concepts.md#channel-initialization-new-chains) | ✅ | ✅ | ✅ | ✅ | ✅ | -| [Validator set update](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/overview_and_basic_concepts.md#validator-set-update) | ✅ | ✅ | ✅ | ✅ | ✅ | -| [Completion of unbonding operations](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/overview_and_basic_concepts.md#completion-of-unbonding-operations) | ✅ | ✅ | ✅ | ✅ | ✅ | -| [Consumer initiated slashing](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/overview_and_basic_concepts.md#consumer-initiated-slashing) | ✅ | ✅ | ✅ | ✅ | ✅ | -| [Reward distribution](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/overview_and_basic_concepts.md#reward-distribution) | ✅ | ✅ | ✅ | ✅ | ✅ | -| [Consumer chain removal](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/methods.md#consumer-chain-removal) | ✅ | ✅ | ✅ | ✅ | ✅ | -| [Key assignment](https://github.com/cosmos/interchain-security/issues/26) | ✅ | ✅ | ✅ | ✅ | ✅ | -| [Jail throttling](https://github.com/cosmos/interchain-security/issues/404) | ✅ | ✅ | ✅ | ✅ | ✅ | -| [Soft opt-out](https://github.com/cosmos/interchain-security/issues/851) | ✅ | ✅ | ✅ | ❌ | ✅ | -| [Channel initialization: existing chains](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/overview_and_basic_concepts.md#channel-initialization-existing-chains) (aka [Standalone to consumer changeover](https://github.com/cosmos/interchain-security/issues/756)) | ✅ | ✅ | ✅ | ✅ | ✅ | -| [Cryptographic verification of equivocation](https://github.com/cosmos/interchain-security/issues/732) | ✅ | ✅ | ✅ | ✅ | ✅ | -| [Jail throttling with retries](https://github.com/cosmos/interchain-security/issues/713) | ✅ | ✅ | ✅ | ✅ | ✅ | -| [ICS epochs](https://cosmos.github.io/interchain-security/adrs/adr-014-epochs) | ❌ | ✅ | ✅ | ✅ | ✅ | -| [Partial Set Security](https://cosmos.github.io/interchain-security/adrs/adr-015-partial-set-security) | ❌ | ✅ | ✅ | ✅ | ❌ | +| Feature | `v4.0.0` | `v4.3.1` | `v4.3.1-lsm` | `v4.4.0` | `v5.0.0` | `v5.2.0` | +|---------|---------:|---------:|-------------:|---------:|---------:|---------:| +| [Channel initialization: new chains](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/overview_and_basic_concepts.md#channel-initialization-new-chains) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | +| [Validator set update](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/overview_and_basic_concepts.md#validator-set-update) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | +| [Completion of unbonding operations](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/overview_and_basic_concepts.md#completion-of-unbonding-operations) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | +| [Consumer initiated slashing](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/overview_and_basic_concepts.md#consumer-initiated-slashing) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | +| [Reward distribution](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/overview_and_basic_concepts.md#reward-distribution) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | +| [Consumer chain removal](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/methods.md#consumer-chain-removal) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | +| [Key assignment](https://github.com/cosmos/interchain-security/issues/26) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | +| [Jail throttling](https://github.com/cosmos/interchain-security/issues/404) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | +| [Soft opt-out](https://github.com/cosmos/interchain-security/issues/851) | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | +| [Channel initialization: existing chains](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/overview_and_basic_concepts.md#channel-initialization-existing-chains) (aka [Standalone to consumer changeover](https://github.com/cosmos/interchain-security/issues/756)) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | +| [Cryptographic verification of equivocation](https://github.com/cosmos/interchain-security/issues/732) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | +| [Jail throttling with retries](https://github.com/cosmos/interchain-security/issues/713) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | +| [ICS epochs](https://cosmos.github.io/interchain-security/adrs/adr-014-epochs) | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | +| [Partial Set Security](https://cosmos.github.io/interchain-security/adrs/adr-015-partial-set-security) | ❌ | ✅ | ✅ | ✅ | ❌ | ✅ | diff --git a/RELEASES.md b/RELEASES.md index 8dce09929f..de7b40c32a 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -62,13 +62,12 @@ All missing minor release versions have been discontinued. | `v4.3.x` | January 24, 2025 | | `v4.4.x` | January 24, 2025 | | `v5.0.x` | May 9, 2025 | +| `v5.2.x` | May 9, 2025 | -**Note**: As of [Gaia v17.2.0](https://github.com/cosmos/gaia/releases/tag/v17.2.0), -the Cosmos Hub uses a fork of Cosmos SDK ([v0.47.15-ics-lsm](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.15-ics-lsm)) -that contains the Liquid Staking Module (LSM). -This means the Cosmos Hub requires a fork of ICS. +**Note**: Gaia versions on SDK 0.47 (i.e., `v15.0.x` -- `v18.1.x`) use a fork of Cosmos SDK (i.e., `v0.47.x-ics-lsm`) that contains the Liquid Staking Module (LSM). +This means that these versions of Gaia require a fork of ICS. This fork is maintained by the development team and released using the `-lsm` prefix. -As soon as the Cosmos Hub uses mainline Cosmos SDK, the `-lsm` releases will reach end of life. +Starting with Gaia `v19.0.x` (that uses SDK 0.50), the fork of ICS is no longer needed. ## Version Matrix @@ -76,11 +75,12 @@ Versions of Golang, IBC, Cosmos SDK and CometBFT used by ICS in the currently ac | ICS | Golang | IBC | Cosmos SDK | CometBFT | Note | |-----|--------|-----|------------|----------|------| -| [v4.0.0](https://github.com/cosmos/interchain-security/releases/tag/v4.0.0) | 1.21 | v7.3.1 | v0.47.7 | v0.37.4 | Provider on >= v4.0.0 backwards compatible with consumers >= v3.2.0 | -| [v4.3.1](https://github.com/cosmos/interchain-security/releases/tag/v4.3.1) | 1.21 | v7.6.0 | v0.47.12 | v0.37.6 | +| [v4.0.0](https://github.com/cosmos/interchain-security/releases/tag/v4.0.0) | 1.21 | v7.3.1 | v0.47.7 | v0.37.4 | +| [v4.3.1](https://github.com/cosmos/interchain-security/releases/tag/v4.3.1) | 1.21 | v7.6.0 | v0.47.12 | v0.37.6 | | [v4.3.1-lsm](https://github.com/cosmos/interchain-security/releases/tag/v4.3.1-lsm) | 1.21 | v7.6.0 | v0.47.16-ics-lsm | v0.37.6 | Provider only (Cosmos Hub specific) | | [v4.4.0](https://github.com/cosmos/interchain-security/releases/tag/v4.4.0) | 1.21 | v7.6.0 | v0.47.12 | v0.37.6 | | [v5.0.0](https://github.com/cosmos/interchain-security/releases/tag/v5.0.0) | 1.21 | v8.1.0 | v0.50.4 | v0.38.5 | +| [v5.2.0](https://github.com/cosmos/interchain-security/releases/tag/v5.2.0) | 1.22 | v8.3.2 | v0.50.8 | v0.38.9 | **Note:** For a list of major ICS features available in the currently active releases, see [FEATURES.md](./FEATURES.md). @@ -90,9 +90,10 @@ A MAJOR version of ICS will always be backwards compatible with the previous MAJ The following table indicates the compatibility of currently active releases: -| Consumer | Provider | `v4.3.1-lsm` | -|----------|----------|--------------| -| `v4.0.0` || ✅ | -| `v4.3.1` || ✅ | -| `v4.4.0` || ✅ | -| `v5.0.0` || ✅ | +| Consumer | Provider | `v4.3.1-lsm` | `v5.2.0` | +|----------|----------|---------------|----------| +| `v4.0.0` || ✅ | ✅ | +| `v4.3.1` || ✅ | ✅ | +| `v4.4.0` || ✅ | ✅ | +| `v5.0.0` || ✅ | ✅ | +| `v5.2.0` || ✅ | ✅ | diff --git a/docs/supported_versions.json b/docs/supported_versions.json index 2609dbc8a1..5d08202e48 100644 --- a/docs/supported_versions.json +++ b/docs/supported_versions.json @@ -1,4 +1,4 @@ [ - "v5.1.0", + "v5.2.0", "v4.4.1" ] \ No newline at end of file From bcc1d3e5bd0c908181dc676a9bdd5e53f5a68b2d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 5 Sep 2024 09:44:27 +0200 Subject: [PATCH 08/28] build(deps): bump JamesIves/github-pages-deploy-action from 4.6.3 to 4.6.4 (#2204) build(deps): bump JamesIves/github-pages-deploy-action Bumps [JamesIves/github-pages-deploy-action](https://github.com/jamesives/github-pages-deploy-action) from 4.6.3 to 4.6.4. - [Release notes](https://github.com/jamesives/github-pages-deploy-action/releases) - [Commits](https://github.com/jamesives/github-pages-deploy-action/compare/v4.6.3...v4.6.4) --- updated-dependencies: - dependency-name: JamesIves/github-pages-deploy-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/deploy-docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index 55673036d7..ab01d1344d 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -42,7 +42,7 @@ jobs: ./build_deploy.sh - name: Deploy 🚀 - uses: JamesIves/github-pages-deploy-action@v4.6.3 + uses: JamesIves/github-pages-deploy-action@v4.6.4 with: branch: gh-pages folder: ~/output From ddde90f1d1f2a61565ca75b59390547d8b2af497 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 5 Sep 2024 09:44:47 +0200 Subject: [PATCH 09/28] build(deps): bump google.golang.org/grpc from 1.65.0 to 1.66.0 (#2199) Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.65.0 to 1.66.0. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](https://github.com/grpc/grpc-go/compare/v1.65.0...v1.66.0) --- updated-dependencies: - dependency-name: google.golang.org/grpc dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 18a5ac3492..351f9d0a53 100644 --- a/go.mod +++ b/go.mod @@ -25,7 +25,7 @@ require ( golang.org/x/net v0.27.0 // indirect golang.org/x/sys v0.24.0 // indirect google.golang.org/genproto v0.0.0-20240701130421-f6361c86f094 // indirect - google.golang.org/grpc v1.65.0 + google.golang.org/grpc v1.66.0 google.golang.org/protobuf v1.34.2 gopkg.in/yaml.v2 v2.4.0 ) diff --git a/go.sum b/go.sum index 429368b809..2a06a7ba35 100644 --- a/go.sum +++ b/go.sum @@ -1641,8 +1641,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= +google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= From 29ad7145914f2e5d11d5ef1a966630caf520ee0e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 5 Sep 2024 13:08:33 +0200 Subject: [PATCH 10/28] build(deps): bump slackapi/slack-github-action from 1.26.0 to 1.27.0 (#2203) Bumps [slackapi/slack-github-action](https://github.com/slackapi/slack-github-action) from 1.26.0 to 1.27.0. - [Release notes](https://github.com/slackapi/slack-github-action/releases) - [Commits](https://github.com/slackapi/slack-github-action/compare/v1.26.0...v1.27.0) --- updated-dependencies: - dependency-name: slackapi/slack-github-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/nightly-e2e.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nightly-e2e.yml b/.github/workflows/nightly-e2e.yml index 33a67ec00d..5058ed2dd5 100644 --- a/.github/workflows/nightly-e2e.yml +++ b/.github/workflows/nightly-e2e.yml @@ -350,7 +350,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Notify Slack on failure - uses: slackapi/slack-github-action@v1.26.0 + uses: slackapi/slack-github-action@v1.27.0 env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK From 7a22a17b82e8c1c470241f5f64e2130236702905 Mon Sep 17 00:00:00 2001 From: Marius Poke Date: Fri, 6 Sep 2024 12:50:49 +0200 Subject: [PATCH 11/28] feat!: Permissionless ICS (#2171) * feat: first iteration on Permissionless ICS (#2117) * (partially) renamed chain ids to consumer ids * renamed proposal messages * removed global slash entry * fixed unit tests * added new messages * introduced new state * added functionality for the register and initialize messages * renamed (partially) chainIds to consumerIds * set consumerId to chainId association during registration * added extra check in the initialization so unknokwn, launched, or stopped chains cannot re-initialize * added initial work on traversing initialized chains that are to-be-launched * fixed rebase issues after bringing the VSCMaturedPackets work in * made it so we traverse initialization records instead of addition proposals (+ additional changes so the unit tests pass) * renamed more chainIDs to consumerIds * removed ClientIdToChainId state because chainId already resides on the registration record * nit fixes in go docs * removed MsgConsumerAddition * added CLI commands for new messages * removed consumer modification proposal * removed (partially) consumer removal proposal * rebased to pick up the inactive-validators work (PR #2079) * introduced consumerId in the equivocation messages (and a useful query for Hermes to get the consumerId) * added safeguard so that a validator cannot opt-in to two different chains with the same chain id * renamed some chainIDs to consumerIds * updated based on comments Co-authored-by: bernd-m <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> * fixed bug on removing previous spawn time & added tests * added some additional tests * added tests on the hooks * removed check that spawn time is in the future * feat: refactor consumer validator set computation (#2175) * add UT * nits * address comments * Update x/ccv/provider/keeper/partial_set_security.go Co-authored-by: insumity * fix tests --------- Co-authored-by: insumity * fix!: ConsumerModificationProposal is needed in Gaia upgrade handler (#2176) ConsumerModificationProposal is needed in Gaia upgrade handler * fix: allow the owner of a chain to remove the chain (#2178) fixed access in RemoveConsumer * refactor: add proto enum for ConsumerPhase (#2182) * feat: extend `consumer_validators` query to return consumer valset before launch (#2164) * (partially) renamed chain ids to consumer ids * renamed proposal messages * removed global slash entry * fixed unit tests * added new messages * introduced new state * added functionality for the register and initialize messages * renamed (partially) chainIds to consumerIds * set consumerId to chainId association during registration * added extra check in the initialization so unknokwn, launched, or stopped chains cannot re-initialize * added initial work on traversing initialized chains that are to-be-launched * fixed rebase issues after bringing the VSCMaturedPackets work in * made it so we traverse initialization records instead of addition proposals (+ additional changes so the unit tests pass) * renamed more chainIDs to consumerIds * removed ClientIdToChainId state because chainId already resides on the registration record * nit fixes in go docs * removed MsgConsumerAddition * added CLI commands for new messages * removed consumer modification proposal * removed (partially) consumer removal proposal * rebased to pick up the inactive-validators work (PR #2079) * introduced consumerId in the equivocation messages (and a useful query for Hermes to get the consumerId) * added safeguard so that a validator cannot opt-in to two different chains with the same chain id * renamed some chainIDs to consumerIds * updated based on comments Co-authored-by: bernd-m <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 * pre-spawn query * rebase * nits * feat: extend consumer validator query to return commission rate (backport #2162) (#2165) * adapt #2162 changes for permissionless ICS * nits --------- Co-authored-by: kirdatatjana <116630536+kirdatatjana@users.noreply.github.com> * remove panics * renamed some chainIds to consumerIds * took into account comments and also added safeguard to reject new proposals that still use deprecated messages (e.g., MsgConsumerAddition, etc.) * Update x/ccv/provider/types/msg.go Co-authored-by: bernd-m <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) * update logic * took into account comments (using protos for marshalling string slice, fixed issues in the UpdateConsumer logic, added extra check to abort spurious proposals) * feat: add fields to consumer validators query (#2167) * extend consumer validators query * nit * nits * fix msg order * deprecate power for consumer_power * nits * feat: first iteration on Permissionless ICS (#2117) * (partially) renamed chain ids to consumer ids * renamed proposal messages * removed global slash entry * fixed unit tests * added new messages * introduced new state * added functionality for the register and initialize messages * renamed (partially) chainIds to consumerIds * set consumerId to chainId association during registration * added extra check in the initialization so unknokwn, launched, or stopped chains cannot re-initialize * added initial work on traversing initialized chains that are to-be-launched * fixed rebase issues after bringing the VSCMaturedPackets work in * made it so we traverse initialization records instead of addition proposals (+ additional changes so the unit tests pass) * renamed more chainIDs to consumerIds * removed ClientIdToChainId state because chainId already resides on the registration record * nit fixes in go docs * removed MsgConsumerAddition * added CLI commands for new messages * removed consumer modification proposal * removed (partially) consumer removal proposal * rebased to pick up the inactive-validators work (PR #2079) * introduced consumerId in the equivocation messages (and a useful query for Hermes to get the consumerId) * added safeguard so that a validator cannot opt-in to two different chains with the same chain id * renamed some chainIDs to consumerIds * updated based on comments Co-authored-by: bernd-m <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> * cover stopped phase case * fixed bug on removing previous spawn time & added tests * added some additional tests * added tests on the hooks * removed check that spawn time is in the future * feat: refactor consumer validator set computation (#2175) * add UT * nits * address comments * Update x/ccv/provider/keeper/partial_set_security.go Co-authored-by: insumity * fix tests --------- Co-authored-by: insumity * nit * nits * nit --------- Co-authored-by: insumity Co-authored-by: bernd-m <43466467+bermuell@users.noreply.github.com> Co-authored-by: kirdatatjana <116630536+kirdatatjana@users.noreply.github.com> * fix build * tests: fix integration test setup (#2183) * fix integration test setup * fix integration tests * feat: add consumer chain query (#2179) * feat: first iteration on Permissionless ICS (#2117) * (partially) renamed chain ids to consumer ids * renamed proposal messages * removed global slash entry * fixed unit tests * added new messages * introduced new state * added functionality for the register and initialize messages * renamed (partially) chainIds to consumerIds * set consumerId to chainId association during registration * added extra check in the initialization so unknokwn, launched, or stopped chains cannot re-initialize * added initial work on traversing initialized chains that are to-be-launched * fixed rebase issues after bringing the VSCMaturedPackets work in * made it so we traverse initialization records instead of addition proposals (+ additional changes so the unit tests pass) * renamed more chainIDs to consumerIds * removed ClientIdToChainId state because chainId already resides on the registration record * nit fixes in go docs * removed MsgConsumerAddition * added CLI commands for new messages * removed consumer modification proposal * removed (partially) consumer removal proposal * rebased to pick up the inactive-validators work (PR #2079) * introduced consumerId in the equivocation messages (and a useful query for Hermes to get the consumerId) * added safeguard so that a validator cannot opt-in to two different chains with the same chain id * renamed some chainIDs to consumerIds * updated based on comments Co-authored-by: bernd-m <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> * fixed bug on removing previous spawn time & added tests * added some additional tests * added tests on the hooks * removed check that spawn time is in the future * feat: refactor consumer validator set computation (#2175) * add UT * nits * address comments * Update x/ccv/provider/keeper/partial_set_security.go Co-authored-by: insumity * fix tests --------- Co-authored-by: insumity * add UT * nits * nits * revert legacy prop funcs * fix UT --------- Co-authored-by: insumity Co-authored-by: bernd-m <43466467+bermuell@users.noreply.github.com> Co-authored-by: kirdatatjana <116630536+kirdatatjana@users.noreply.github.com> * feat: extend consumer chains query (#2172) * feat: first iteration on Permissionless ICS (#2117) * (partially) renamed chain ids to consumer ids * renamed proposal messages * removed global slash entry * fixed unit tests * added new messages * introduced new state * added functionality for the register and initialize messages * renamed (partially) chainIds to consumerIds * set consumerId to chainId association during registration * added extra check in the initialization so unknokwn, launched, or stopped chains cannot re-initialize * added initial work on traversing initialized chains that are to-be-launched * fixed rebase issues after bringing the VSCMaturedPackets work in * made it so we traverse initialization records instead of addition proposals (+ additional changes so the unit tests pass) * renamed more chainIDs to consumerIds * removed ClientIdToChainId state because chainId already resides on the registration record * nit fixes in go docs * removed MsgConsumerAddition * added CLI commands for new messages * removed consumer modification proposal * removed (partially) consumer removal proposal * rebased to pick up the inactive-validators work (PR #2079) * introduced consumerId in the equivocation messages (and a useful query for Hermes to get the consumerId) * added safeguard so that a validator cannot opt-in to two different chains with the same chain id * renamed some chainIDs to consumerIds * updated based on comments Co-authored-by: bernd-m <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> * add phase + metadata * first logic draft * add filter * reformat test * nits * nit * address comments * update tests * nits * update logic * update CLI * revert unwanted changes * remove filter field * nit * fix bad int conversion * update cli --------- Co-authored-by: insumity Co-authored-by: bernd-m <43466467+bermuell@users.noreply.github.com> Co-authored-by: kirdatatjana <116630536+kirdatatjana@users.noreply.github.com> * feat!: migrations for permissionless (#2174) * migrations for permissionless -- wip * feat!: migrations for permissionless (#2177) * initial commit * took into account comments * removed deprecated queries * fix error due to rebase * remove fields from provider genesis * remove commented code --------- Co-authored-by: insumity * feat: update `consumer_chains` REST endpoint (#2188) update consumer chains REST endpoint * fix: permissionless added event + cli changes (#2185) * add consumer registration event * fix some queries, CLI and permissionless logic * cli changes * addressed review comments * fix!: several permissionless changes (#2189) * minor fixes in tests * replace IsConsumerProposedOrRegistered with IsConsumerActive * remove param from createStakingValidator * handle error in GetTopN * remove aux methods for getting PowerShapingParameters * remove default PowerShapingParameters * fix tests * handle error messages * fix: fix consumer chain query CLI (#2190) * fix consumer chains query cli * add consumer-chain cli command * fix consumer chains cli bug * fix!: fix store.set nil values (#2193) fix store.set nil values * fix!: msgs validation (#2195) * add testing for ValidateStringField * ValidateInitializationParameters * ValidatePowerShapingParameters * validate NewOwnerAddress * apply review suggestions * fix: fix queries' API REST endpoint path (#2196) * clean uw files * doc * Revert "doc" This reverts commit efc27181ee85499793d115ed28094abecf91474d. * Revert "clean uw files" This reverts commit 5773cf3b6ef0c98937c9aa03535f3eaf834cbe1f. * remove deprecated REST endpoints * update REST endpoint * fix broken UT by previous PR (#2195) * fix: permissionless query (#2191) * fix implementation * addressed comments * cleanup * keep metadata and powershaping data for stopped consumer chains * addressed comments * adapt unit-tests * refactor: mostly refactors (#2194) * handle errors * set the reverse index in SetConsumerClientId * rename method * create consumer_lifecycle.go with launch/stop logic * move methods around * move methods around * handle ChangeRewardDenoms * add TODOs * remove proposal_test * remove todos * apply review suggestions * apply review suggestions * fix UTs * fix!: provider msg validation (#2197) * validate MsgAssignConsumerKey * validate MsgSubmitConsumerMisbehaviour and MsgSubmitConsumerDoubleVoting * move RemoveConsumer * refactor: rearrange messages in msg.go * validate MsgOptIn and MsgOptOut * validate MsgSetConsumerCommissionRate * remove ValidateBasic for deprecated msgs * remove deprecated GetSigners * remove deprecated GetSignBytes * remove deprecated govv1beta1 validation * remove Route and Type * Update x/ccv/provider/keeper/msg_server.go Co-authored-by: insumity * apply review suggestions * apply review suggestions --------- Co-authored-by: insumity * test: fix e2e tests + PSS e2e tests use permissionless (#2192) Fix e2e tests + make PSS e2e tests use Permissionless ICS * refactor: power shaping (#2207) * update allowlist and denylist power shaping update * fix tests * refactor: move power shaping params to power_shaping.go * rename record to parameters * fix merge conflicts * feat: fix queries (#2209) * remove chain ID from all-pairs-valconsensus-address * add consumer_id to Chain * add GetAllLaunchedConsumerIds * fix UT * apply review suggestions * fix!: remove `stopTime` from `MsgRemoveConsumer` (#2208) * init commit * renamed stop time to removal time * fix errors in tests * add GetAllConsumerWithIBCClients * use GetAllConsumerWithIBCClients for efficiency * fix UTs * remove GetAllLaunchedConsumerIds as not needed * typo in GetAllConsumersWithIBCClients * improve comment * Apply suggestions from code review Co-authored-by: Marius Poke * took into account comments --------- Co-authored-by: mpoke * feat: remove provider migration for CV 3 to 6 (#2211) * remove migrations to CV < 7 * add changelog entry * fix version name * fix!: fix migration issue (#2214) * init commit * took into account comments * fix!: register `ConsumerModificationProposal` and others (#2215) init commit * fix: fix misbehaviour and equivocation evidence CLI commands (#2213) * silent errors in MBT driver * fix misbehaviour and double-signing CLI cmds + few nits * revert changes * nit: remove type prefix from consumer phase enum (#2220) remove type prefix in consumer phase enum * refactor: stop using signer field in messages (#2219) * remove error check * stop using signer field in messages * expand TODO comment * replace signer with submitter * fix UTs * chore: update TX CLI help (#2222) * update CLI help * apply review suggestions * feat!: add events for provider messages (#2221) * add events for CreateConsumer * add events for UpdateConsumer * add events for RemoveConsumer * add events for the rest of the messages * apply review suggestions * Id instead of ID * fix events * fix UT * remove duplicate AttributeSubmitterAddress * fix: fix queries' API endpoints (#2226) * endpoint fixes * Update proto/interchain_security/ccv/provider/v1/query.proto Co-authored-by: MSalopek * Update proto/interchain_security/ccv/provider/v1/query.proto Co-authored-by: MSalopek * generate proto --------- Co-authored-by: MSalopek * fix!: replace CanLaunch with InitializeConsumer (#2224) replace CanLaunch with InitializeConsumer * fix: improve commands' description (#2227) init commit --------- Co-authored-by: insumity 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> Co-authored-by: MSalopek --- .../provider/2211-deprecate-migration.md | 4 + Makefile | 6 +- docs/docs/adrs/adr-019-permissionless-ics.md | 12 +- .../ccv/provider/v1/genesis.proto | 14 +- .../ccv/provider/v1/provider.proto | 123 + .../ccv/provider/v1/query.proto | 216 +- .../ccv/provider/v1/tx.proto | 163 +- tests/e2e/action_rapid_test.go | 9 +- tests/e2e/actions.go | 681 ++- tests/e2e/config.go | 1 + tests/e2e/main.go | 7 + tests/e2e/state.go | 88 +- tests/e2e/state_rapid_test.go | 7 +- tests/e2e/steps_partial_set_security.go | 441 +- tests/e2e/steps_stop_chain.go | 50 +- tests/e2e/test_driver.go | 14 +- tests/e2e/testlib/types.go | 11 +- tests/e2e/testlib/utils.go | 49 + tests/e2e/trace_handlers_test.go | 14 +- tests/e2e/v4/state.go | 9 +- 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 | 11 +- tests/integration/provider_gov_hooks.go | 156 - tests/integration/setup.go | 49 +- tests/integration/slashing.go | 10 +- tests/integration/stop_consumer.go | 29 +- tests/mbt/driver/core.go | 54 +- tests/mbt/driver/mbt_test.go | 4 +- tests/mbt/driver/setup.go | 6 +- testutil/ibc_testing/generic_setup.go | 57 +- testutil/keeper/expectations.go | 5 +- testutil/keeper/mocks.go | 14 + testutil/keeper/unit_test_helpers.go | 135 +- x/ccv/provider/client/cli/query.go | 223 +- x/ccv/provider/client/cli/tx.go | 284 +- x/ccv/provider/handler.go | 9 + x/ccv/provider/handler_test.go | 63 +- x/ccv/provider/ibc_middleware.go | 6 +- x/ccv/provider/ibc_module_test.go | 26 +- .../provider/keeper/consumer_equivocation.go | 85 +- x/ccv/provider/keeper/consumer_lifecycle.go | 670 +++ .../keeper/consumer_lifecycle_test.go | 1012 +++++ x/ccv/provider/keeper/distribution.go | 130 +- x/ccv/provider/keeper/distribution_test.go | 36 +- x/ccv/provider/keeper/genesis.go | 48 +- x/ccv/provider/keeper/genesis_test.go | 18 +- x/ccv/provider/keeper/grpc_query.go | 410 +- x/ccv/provider/keeper/grpc_query_test.go | 548 ++- x/ccv/provider/keeper/hooks.go | 67 +- x/ccv/provider/keeper/hooks_test.go | 21 +- x/ccv/provider/keeper/keeper.go | 735 +-- x/ccv/provider/keeper/keeper_test.go | 457 +- x/ccv/provider/keeper/key_assignment.go | 184 +- x/ccv/provider/keeper/key_assignment_test.go | 92 +- x/ccv/provider/keeper/legacy_proposal.go | 144 - x/ccv/provider/keeper/legacy_proposal_test.go | 334 -- x/ccv/provider/keeper/msg_server.go | 474 +- x/ccv/provider/keeper/msg_server_test.go | 166 + x/ccv/provider/keeper/partial_set_security.go | 237 +- .../keeper/partial_set_security_test.go | 388 +- x/ccv/provider/keeper/permissionless.go | 289 ++ x/ccv/provider/keeper/permissionless_test.go | 269 ++ x/ccv/provider/keeper/power_shaping.go | 286 ++ x/ccv/provider/keeper/power_shaping_test.go | 313 ++ x/ccv/provider/keeper/proposal.go | 653 --- x/ccv/provider/keeper/proposal_test.go | 1098 ----- x/ccv/provider/keeper/relay.go | 150 +- x/ccv/provider/keeper/relay_test.go | 181 +- .../keeper/staking_keeper_interface_test.go | 3 +- x/ccv/provider/keeper/validator_set_update.go | 56 +- .../keeper/validator_set_update_test.go | 45 +- x/ccv/provider/migrations/migrator.go | 19 +- .../provider/migrations/v4/migration_test.go | 27 - x/ccv/provider/migrations/v4/migrations.go | 18 - .../provider/migrations/v5/migration_test.go | 30 - x/ccv/provider/migrations/v5/migrations.go | 21 - .../provider/migrations/v6/migration_test.go | 27 - x/ccv/provider/migrations/v6/migrations.go | 47 - x/ccv/provider/migrations/v8/migrations.go | 306 +- .../provider/migrations/v8/migrations_test.go | 4 +- x/ccv/provider/module.go | 9 +- x/ccv/provider/module_test.go | 6 +- x/ccv/provider/proposal_handler.go | 8 +- x/ccv/provider/proposal_handler_test.go | 52 +- x/ccv/provider/types/codec.go | 17 +- x/ccv/provider/types/consumer.go | 2 + x/ccv/provider/types/errors.go | 65 +- x/ccv/provider/types/events.go | 19 +- x/ccv/provider/types/genesis.go | 30 +- x/ccv/provider/types/genesis.pb.go | 262 +- x/ccv/provider/types/genesis_test.go | 40 - x/ccv/provider/types/keys.go | 636 +-- x/ccv/provider/types/keys_test.go | 284 +- x/ccv/provider/types/legacy_proposal.go | 152 +- x/ccv/provider/types/legacy_proposal_test.go | 641 --- x/ccv/provider/types/msg.go | 729 +-- x/ccv/provider/types/msg_test.go | 486 +- x/ccv/provider/types/provider.pb.go | 2213 +++++++-- x/ccv/provider/types/query.pb.go | 3968 ++++++++++------- x/ccv/provider/types/query.pb.gw.go | 687 +-- x/ccv/provider/types/throttle.go | 17 - x/ccv/provider/types/tx.pb.go | 2928 +++++++++--- x/ccv/types/errors.go | 2 + x/ccv/types/events.go | 1 - x/ccv/types/expected_keepers.go | 1 + x/ccv/types/shared_params.go | 2 +- 111 files changed, 16142 insertions(+), 10466 deletions(-) create mode 100644 .changelog/unreleased/features/provider/2211-deprecate-migration.md delete mode 100644 tests/integration/provider_gov_hooks.go create mode 100644 x/ccv/provider/keeper/consumer_lifecycle.go create mode 100644 x/ccv/provider/keeper/consumer_lifecycle_test.go delete mode 100644 x/ccv/provider/keeper/legacy_proposal.go delete mode 100644 x/ccv/provider/keeper/legacy_proposal_test.go 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/keeper/power_shaping.go create mode 100644 x/ccv/provider/keeper/power_shaping_test.go delete mode 100644 x/ccv/provider/keeper/proposal.go delete mode 100644 x/ccv/provider/keeper/proposal_test.go delete mode 100644 x/ccv/provider/migrations/v4/migration_test.go delete mode 100644 x/ccv/provider/migrations/v4/migrations.go delete mode 100644 x/ccv/provider/migrations/v5/migration_test.go delete mode 100644 x/ccv/provider/migrations/v5/migrations.go delete mode 100644 x/ccv/provider/migrations/v6/migration_test.go delete mode 100644 x/ccv/provider/migrations/v6/migrations.go delete mode 100644 x/ccv/provider/types/legacy_proposal_test.go delete mode 100644 x/ccv/provider/types/throttle.go diff --git a/.changelog/unreleased/features/provider/2211-deprecate-migration.md b/.changelog/unreleased/features/provider/2211-deprecate-migration.md new file mode 100644 index 0000000000..2363098b91 --- /dev/null +++ b/.changelog/unreleased/features/provider/2211-deprecate-migration.md @@ -0,0 +1,4 @@ +- Remove provider migrations to consensus versions lower than 7. + To migrate the provider module from consensus version 3, 4, or 5 to consensus version 7 or higher, + users should use v4.3.x in production to migrate to consensus version 6. + ([\#2211](https://github.com/cosmos/interchain-security/pull/2211)) \ No newline at end of file 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/genesis.proto b/proto/interchain_security/ccv/provider/v1/genesis.proto index 34c0daf633..0f212b0271 100644 --- a/proto/interchain_security/ccv/provider/v1/genesis.proto +++ b/proto/interchain_security/ccv/provider/v1/genesis.proto @@ -17,6 +17,12 @@ message GenesisState { // Reserve 4th slot for removed mature_unbonding_ops field reserved 4; + // Reserve 6th slot for removed consumer_addition_proposals field + reserved 6; + + // Reserve 7th slot for removed consumer_removal_proposals field + reserved 7; + // Reserve 11th slot for consumer_addrs_to_prune field reserved 11; @@ -36,12 +42,6 @@ message GenesisState { // empty for a new chain repeated ValsetUpdateIdToHeight valset_update_id_to_height = 5 [ (gogoproto.nullable) = false ]; - // empty for a new chain - repeated ConsumerAdditionProposal consumer_addition_proposals = 6 - [ (gogoproto.nullable) = false ]; - // empty for a new chain - repeated ConsumerRemovalProposal consumer_removal_proposals = 7 - [ (gogoproto.nullable) = false ]; Params params = 8 [ (gogoproto.nullable) = false ]; // empty for a new chain repeated ValidatorConsumerPubKey validator_consumer_pubkeys = 9 @@ -78,6 +78,8 @@ message ConsumerState { repeated interchain_security.ccv.v1.ValidatorSetChangePacketData pending_valset_changes = 6 [ (gogoproto.nullable) = false ]; repeated string slash_downtime_ack = 7; + // the phase of the consumer chain + ConsumerPhase phase = 9; } // ValsetUpdateIdToHeight defines the genesis information for the mapping diff --git a/proto/interchain_security/ccv/provider/v1/provider.proto b/proto/interchain_security/ccv/provider/v1/provider.proto index 7e1836cf38..f1af229759 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,122 @@ 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; } + +// ConsumerPhase indicates the phases of a consumer chain according to ADR 019 +enum ConsumerPhase { + option (gogoproto.goproto_enum_prefix) = false; + + // UNSPECIFIED defines an empty phase. + CONSUMER_PHASE_UNSPECIFIED = 0; + // REGISTERED defines the phase in which a consumer chain has been assigned a unique consumer id. + // A chain in this phase cannot yet launch. + CONSUMER_PHASE_REGISTERED = 1; + // INITIALIZED defines 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). + CONSUMER_PHASE_INITIALIZED = 2; + // LAUNCHED defines the phase in which a consumer chain is running and consuming a subset of the validator + // set of the provider. + CONSUMER_PHASE_LAUNCHED = 3; + // STOPPED defines the phase in which a previously-launched chain has stopped. + CONSUMER_PHASE_STOPPED = 4; + // DELETED defines the phase in which the state of a stopped chain has been deleted. + CONSUMER_PHASE_DELETED = 5; +} diff --git a/proto/interchain_security/ccv/provider/v1/query.proto b/proto/interchain_security/ccv/provider/v1/query.proto index 0ac1baa477..2b2b0dc60e 100644 --- a/proto/interchain_security/ccv/provider/v1/query.proto +++ b/proto/interchain_security/ccv/provider/v1/query.proto @@ -11,14 +11,16 @@ 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) = { + get: "/interchain_security/ccv/provider/consumer_genesis/{consumer_id}"; + }; } // ConsumerChains queries active consumer chains supported by the provider @@ -26,21 +28,7 @@ service Query { rpc QueryConsumerChains(QueryConsumerChainsRequest) returns (QueryConsumerChainsResponse) { option (google.api.http).get = - "/interchain_security/ccv/provider/consumer_chains"; - } - - // QueryConsumerChainStarts queries consumer chain start proposals. - rpc QueryConsumerChainStarts(QueryConsumerChainStartProposalsRequest) - returns (QueryConsumerChainStartProposalsResponse) { - option (google.api.http).get = - "/interchain_security/ccv/provider/consumer_chain_start_proposals"; - } - - // QueryConsumerChainStops queries consumer chain stop proposals. - rpc QueryConsumerChainStops(QueryConsumerChainStopProposalsRequest) - returns (QueryConsumerChainStopProposalsResponse) { - option (google.api.http).get = - "/interchain_security/ccv/provider/consumer_chain_stop_proposals"; + "/interchain_security/ccv/provider/consumer_chains/{phase}/{limit}"; } // QueryValidatorConsumerAddr queries the address @@ -48,7 +36,7 @@ service Query { rpc QueryValidatorConsumerAddr(QueryValidatorConsumerAddrRequest) returns (QueryValidatorConsumerAddrResponse) { option (google.api.http).get = - "/interchain_security/ccv/provider/validator_consumer_addr"; + "/interchain_security/ccv/provider/validator_consumer_addr/{consumer_id}/{provider_address}"; } // QueryProviderAddr returns the provider chain validator @@ -56,7 +44,7 @@ service Query { rpc QueryValidatorProviderAddr(QueryValidatorProviderAddrRequest) returns (QueryValidatorProviderAddrResponse) { option (google.api.http).get = - "/interchain_security/ccv/provider/validator_provider_addr"; + "/interchain_security/ccv/provider/validator_provider_addr/{consumer_id}/{consumer_address}"; } // QueryThrottleState returns the main on-chain state relevant to currently @@ -76,22 +64,14 @@ service Query { "/interchain_security/ccv/provider/registered_consumer_reward_denoms"; } - // QueryProposedConsumerChainIDs returns the chain IDs of the proposed consumer chain addition proposals - // that are still in the voting period - rpc QueryProposedConsumerChainIDs( - QueryProposedChainIDsRequest) - returns (QueryProposedChainIDsResponse) { - option (google.api.http).get = - "/interchain_security/ccv/provider/proposed_consumer_chains"; - } - - // QueryAllPairsValConAddrByConsumerChainID returns a list of pair valconsensus address + // QueryAllPairsValConsAddrByConsumer returns a list of pair valconsensus address // between provider and consumer chain - rpc QueryAllPairsValConAddrByConsumerChainID ( - QueryAllPairsValConAddrByConsumerChainIDRequest) - returns (QueryAllPairsValConAddrByConsumerChainIDResponse) { - option (google.api.http).get = - "/interchain_security/ccv/provider/consumer_chain_id"; + rpc QueryAllPairsValConsAddrByConsumer ( + QueryAllPairsValConsAddrByConsumerRequest) + returns (QueryAllPairsValConsAddrByConsumerResponse) { + option (google.api.http) = { + get: "/interchain_security/ccv/provider/address_pairs/{consumer_id}"; + }; } // QueryParams returns all current values of provider parameters @@ -106,8 +86,9 @@ 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) = { + get: "/interchain_security/ccv/provider/opted_in_validators/{consumer_id}"; + }; } // QueryConsumerChainsValidatorHasToValidate returns a list of consumer chains @@ -124,17 +105,19 @@ 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) = { + get: "/interchain_security/ccv/provider/consumer_commission_rate/{consumer_id}/{provider_address}"; + }; } - // QueryConsumerValidators returns the latest set consumer-validator set for a given chainID + // QueryConsumerValidators returns the latest set consumer-validator set for a given consumer ID // Note that this does not necessarily mean that the consumer chain is using this validator set at this exact moment // 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) = { + get: "/interchain_security/ccv/provider/consumer_validators/{consumer_id}"; + }; } // QueryBlocksUntilNextEpoch returns the number of blocks until the next epoch @@ -144,35 +127,47 @@ 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}"; + } + + // QueryConsumerChain returns the consumer chain + // associated with the provided consumer id + rpc QueryConsumerChain(QueryConsumerChainRequest) + returns (QueryConsumerChainResponse) { + option (google.api.http).get = + "/interchain_security/ccv/provider/consumer_chain/{consumer_id}"; + } } -message QueryConsumerGenesisRequest { string chain_id = 1; } +message QueryConsumerGenesisRequest { + string consumer_id = 1; +} message QueryConsumerGenesisResponse { interchain_security.ccv.v1.ConsumerGenesisState genesis_state = 1 [ (gogoproto.nullable) = false ]; } -message QueryConsumerChainsRequest {} - -message QueryConsumerChainsResponse { repeated Chain chains = 1; } - -message QueryConsumerChainStartProposalsRequest {} - -message QueryConsumerChainStartProposalsResponse { - ConsumerAdditionProposals proposals = 1; +message QueryConsumerChainsRequest { + // The phase of the consumer chains returned (optional) + // Registered=1|Initialized=2|Launched=3|Stopped=4|Deleted=5 + ConsumerPhase phase = 1; + // The limit of consumer chains returned (optional) + // default is 100 + int32 limit = 2; } -message QueryConsumerChainStopProposalsRequest {} - -message QueryConsumerChainStopProposalsResponse { - ConsumerRemovalProposals proposals = 1; -} +message QueryConsumerChainsResponse { repeated Chain chains = 1; } message Chain { string chain_id = 1; string client_id = 2; - // If chain with `chainID` is a Top-N chain, i.e., enforces at least one validator to validate chain `chainID` uint32 top_N = 3; // If the chain is a Top-N chain, this is the minimum power required to be in the top N. // Otherwise, this is -1. @@ -187,20 +182,24 @@ 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 + string phase = 9; + // The metadata of the consumer chain + ConsumerMetadata metadata = 10 [(gogoproto.nullable) = false ]; // Corresponds to the minimal amount of (provider chain) stake required to validate on the consumer chain. - uint64 min_stake = 9; + uint64 min_stake = 11; // Corresponds to whether inactive validators are allowed to validate the consumer chain. - bool allow_inactive_vals = 10; - + bool allow_inactive_vals = 12; + string consumer_id = 13; } message QueryValidatorConsumerAddrRequest { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - // The id of the consumer chain - string chain_id = 1; // The consensus address of the validator on the provider chain - string provider_address = 2 [ (gogoproto.moretags) = "yaml:\"address\"" ]; + string provider_address = 1 [ (gogoproto.moretags) = "yaml:\"address\"" ]; + // The id of the consumer chain + string consumer_id = 2; } message QueryValidatorConsumerAddrResponse { @@ -211,10 +210,10 @@ message QueryValidatorConsumerAddrResponse { message QueryValidatorProviderAddrRequest { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - // The id of the provider chain - string chain_id = 1; // The consensus address of the validator on the consumer chain - string consumer_address = 2 [ (gogoproto.moretags) = "yaml:\"address\"" ]; + string consumer_address = 1 [ (gogoproto.moretags) = "yaml:\"address\"" ]; + // The id of the consumer chain + string consumer_id = 2; } message QueryValidatorProviderAddrResponse { @@ -242,24 +241,12 @@ message QueryRegisteredConsumerRewardDenomsResponse { repeated string denoms = 1; } -message QueryProposedChainIDsRequest {} - -message QueryProposedChainIDsResponse { - repeated ProposedChain proposedChains = 1 - [ (gogoproto.nullable) = false ]; -} - -message ProposedChain { - string chainID = 1; - uint64 proposalID = 2; -} - -message QueryAllPairsValConAddrByConsumerChainIDRequest { +message QueryAllPairsValConsAddrByConsumerRequest { // The id of the consumer chain - string chain_id = 1; + string consumer_id = 1; } -message QueryAllPairsValConAddrByConsumerChainIDResponse { +message QueryAllPairsValConsAddrByConsumerResponse { repeated PairValConAddrProviderAndConsumer pair_val_con_addr = 1; } @@ -278,7 +265,7 @@ message QueryParamsResponse { } message QueryConsumerChainOptedInValidatorsRequest { - string chain_id = 1; + string consumer_id = 1; } message QueryConsumerChainOptedInValidatorsResponse { @@ -287,7 +274,7 @@ message QueryConsumerChainOptedInValidatorsResponse { } message QueryConsumerValidatorsRequest { - string chain_id = 1; + string consumer_id = 1; } message QueryConsumerValidatorsValidator { @@ -295,13 +282,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 { @@ -314,12 +332,12 @@ message QueryConsumerChainsValidatorHasToValidateRequest { } message QueryConsumerChainsValidatorHasToValidateResponse { - repeated string consumer_chain_ids = 1; + repeated string consumer_ids = 1; } message QueryValidatorConsumerCommissionRateRequest { - string chain_id = 1; - // The consensus address of the validator on the provider chain + string consumer_id = 1; + // The consensus address of the validator on the provider chain string provider_address = 2 [ (gogoproto.moretags) = "yaml:\"address\"" ]; } @@ -337,3 +355,27 @@ 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; +} + +message QueryConsumerChainRequest { + string consumer_id = 1; +} + +message QueryConsumerChainResponse { + string chain_id = 1; + string owner_address = 2; + string phase = 3; + ConsumerMetadata metadata = 4 [ (gogoproto.nullable) = false ]; + ConsumerInitializationParameters init_params = 5; + PowerShapingParameters power_shaping_params = 6; +} diff --git a/proto/interchain_security/ccv/provider/v1/tx.proto b/proto/interchain_security/ccv/provider/v1/tx.proto index 113923b11c..d4f4eace11 100644 --- a/proto/interchain_security/ccv/provider/v1/tx.proto +++ b/proto/interchain_security/ccv/provider/v1/tx.proto @@ -23,25 +23,34 @@ 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; + } rpc ChangeRewardDenoms(MsgChangeRewardDenoms) returns (MsgChangeRewardDenomsResponse); } message MsgAssignConsumerKey { - option (cosmos.msg.v1.signer) = "signer"; + option (cosmos.msg.v1.signer) = "submitter"; option (gogoproto.equal) = false; 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. @@ -49,8 +58,10 @@ message MsgAssignConsumerKey { // `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is="}` string consumer_key = 3; - // Tx signer address - string signer = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string submitter = 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 {} @@ -67,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 {} @@ -85,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 {} @@ -93,7 +108,7 @@ message MsgSubmitConsumerDoubleVotingResponse {} message MsgUpdateParams { option (cosmos.msg.v1.signer) = "authority"; - // signer is the address of the governance account. + // authority is the address of the governance account. string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // params defines the x/provider parameters to update. @@ -102,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"; @@ -193,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"; @@ -216,6 +219,21 @@ 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) = "owner"; + + // the consumer id of the consumer chain to be stopped + string consumer_id = 1; + // the address of the owner of the consumer chain to be stopped + string owner = 2 [(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. // @@ -227,7 +245,7 @@ message MsgChangeRewardDenoms { repeated string denoms_to_add = 1; // the list of consumer reward denoms to remove repeated string denoms_to_remove = 2; - // signer address + // authority is the address of the governance account string authority = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } @@ -238,9 +256,9 @@ message MsgChangeRewardDenomsResponse {} 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; + option (cosmos.msg.v1.signer) = "submitter"; + // [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, @@ -248,9 +266,10 @@ message MsgOptIn { // This field is optional and can remain empty (i.e., `consumer_key = ""`). A validator can always change the // consumer public key at a later stage by issuing a `MsgAssignConsumerKey` message. string consumer_key = 3; - // signer address - string signer = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - + // submitter address + string submitter = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // the consumer id of the consumer chain to opt in to + string consumer_id = 5; } message MsgOptInResponse {} @@ -258,14 +277,15 @@ message MsgOptInResponse {} 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; + option (cosmos.msg.v1.signer) = "submitter"; + // [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"]; - + // submitter address + string submitter = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // the consumer id of the consumer chain to opt out from + string consumer_id = 4; } message MsgOptOutResponse {} @@ -275,12 +295,12 @@ message MsgOptOutResponse {} message MsgSetConsumerCommissionRate { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - option (cosmos.msg.v1.signer) = "signer"; + option (cosmos.msg.v1.signer) = "submitter"; - // 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 [ @@ -288,18 +308,16 @@ message MsgSetConsumerCommissionRate { (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; - // signer address - string signer = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // submitter address + string submitter = 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"; @@ -337,3 +355,52 @@ message MsgConsumerModification { } message MsgConsumerModificationResponse {} + +// MsgCreateConsumer defines the message that creates a consumer chain +message MsgCreateConsumer { + option (cosmos.msg.v1.signer) = "submitter"; + + // Submitter address. If the message is successfully handled, the ownership of + // the consumer chain will given to this address. + string submitter = 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) = "owner"; + + // the address of the owner of the consumer chain to be updated + string owner = 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/e2e/action_rapid_test.go b/tests/e2e/action_rapid_test.go index 004eb30d95..d51cb64129 100644 --- a/tests/e2e/action_rapid_test.go +++ b/tests/e2e/action_rapid_test.go @@ -261,11 +261,10 @@ func GetSubmitConsumerAdditionProposalActionGen() *rapid.Generator[SubmitConsume func GetSubmitConsumerRemovalProposalActionGen() *rapid.Generator[SubmitConsumerRemovalProposalAction] { return rapid.Custom(func(t *rapid.T) SubmitConsumerRemovalProposalAction { return SubmitConsumerRemovalProposalAction{ - Chain: GetChainIDGen().Draw(t, "Chain"), - From: GetValidatorIDGen().Draw(t, "From"), - Deposit: rapid.Uint().Draw(t, "Deposit"), - ConsumerChain: GetChainIDGen().Draw(t, "ConsumerChain"), - StopTimeOffset: time.Duration(rapid.Int64().Draw(t, "StopTimeOffset")), + Chain: GetChainIDGen().Draw(t, "Chain"), + From: GetValidatorIDGen().Draw(t, "From"), + Deposit: rapid.Uint().Draw(t, "Deposit"), + ConsumerChain: GetChainIDGen().Draw(t, "ConsumerChain"), } }) } diff --git a/tests/e2e/actions.go b/tests/e2e/actions.go index 088ad19801..18f1c6de4a 100644 --- a/tests/e2e/actions.go +++ b/tests/e2e/actions.go @@ -2,7 +2,6 @@ package main import ( "bufio" - "encoding/base64" "encoding/json" "fmt" "log" @@ -16,10 +15,12 @@ import ( "sync" "time" + sdk "github.com/cosmos/cosmos-sdk/types" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" "github.com/tidwall/gjson" "golang.org/x/mod/semver" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" e2e "github.com/cosmos/interchain-security/v5/tests/e2e/testlib" "github.com/cosmos/interchain-security/v5/x/ccv/provider/client" "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" @@ -42,6 +43,13 @@ type SendTokensAction struct { Amount uint } +type TxResponse struct { + TxHash string `json:"txhash"` + Code int `json:"code"` + RawLog string `json:"raw_log"` + Events []sdk.Event `json:"events"` +} + func (tr Chain) sendTokens( action SendTokensAction, verbose bool, @@ -250,6 +258,121 @@ func (tr Chain) submitTextProposal( tr.waitBlocks(action.Chain, 1, 10*time.Second) } +type UpdateConsumerChainAction struct { + Chain ChainID + From ValidatorID + ConsumerChain ChainID + NewOwner string + InitialHeight clienttypes.Height + SpawnTime uint + DistributionChannel string + TopN uint32 + ValidatorsPowerCap uint32 + ValidatorSetCap uint32 + Allowlist []string + Denylist []string + MinStake uint64 + AllowInactiveVals bool +} + +func (tr Chain) updateConsumerChain(action UpdateConsumerChainAction, verbose bool) { + + spawnTime := tr.testConfig.containerConfig.Now.Add(time.Duration(action.SpawnTime) * time.Millisecond) + params := ccvtypes.DefaultParams() + initParams := types.ConsumerInitializationParameters{ + InitialHeight: action.InitialHeight, + GenesisHash: []byte("gen_hash"), + BinaryHash: []byte("bin_hash"), + SpawnTime: spawnTime, + + UnbondingPeriod: params.UnbondingPeriod, + CcvTimeoutPeriod: params.CcvTimeoutPeriod, + TransferTimeoutPeriod: params.TransferTimeoutPeriod, + ConsumerRedistributionFraction: params.ConsumerRedistributionFraction, + BlocksPerDistributionTransmission: params.BlocksPerDistributionTransmission, + HistoricalEntries: params.HistoricalEntries, + DistributionTransmissionChannel: action.DistributionChannel, + } + + powerShapingParams := types.PowerShapingParameters{ + Top_N: action.TopN, + ValidatorsPowerCap: action.ValidatorsPowerCap, + ValidatorSetCap: action.ValidatorSetCap, + Allowlist: action.Allowlist, + Denylist: action.Denylist, + MinStake: action.MinStake, + AllowInactiveVals: action.AllowInactiveVals, + } + + consumerId := tr.testConfig.chainConfigs[action.ConsumerChain].ConsumerId + msg := types.MsgUpdateConsumer{ + ConsumerId: string(consumerId), + NewOwnerAddress: action.NewOwner, + InitializationParameters: &initParams, + PowerShapingParameters: &powerShapingParams, + } + tr.UpdateConsumer(action.Chain, action.From, msg) +} + +type CreateConsumerChainAction struct { + Chain ChainID + From ValidatorID + ConsumerChain ChainID + InitialHeight clienttypes.Height + SpawnTime uint + DistributionChannel string + TopN uint32 + ValidatorsPowerCap uint32 + ValidatorSetCap uint32 + Allowlist []string + Denylist []string + MinStake uint64 + AllowInactiveVals bool +} + +// createConsumerChain creates and initializes a consumer chain +func (tr Chain) createConsumerChain(action CreateConsumerChainAction, verbose bool) { + + spawnTime := tr.testConfig.containerConfig.Now.Add(time.Duration(action.SpawnTime) * time.Millisecond) + params := ccvtypes.DefaultParams() + initParams := types.ConsumerInitializationParameters{ + InitialHeight: action.InitialHeight, + GenesisHash: []byte("gen_hash"), + BinaryHash: []byte("bin_hash"), + SpawnTime: spawnTime, + + UnbondingPeriod: params.UnbondingPeriod, + CcvTimeoutPeriod: params.CcvTimeoutPeriod, + TransferTimeoutPeriod: params.TransferTimeoutPeriod, + ConsumerRedistributionFraction: params.ConsumerRedistributionFraction, + BlocksPerDistributionTransmission: params.BlocksPerDistributionTransmission, + HistoricalEntries: params.HistoricalEntries, + DistributionTransmissionChannel: action.DistributionChannel, + } + + powerShapingParams := types.PowerShapingParameters{ + Top_N: action.TopN, + ValidatorsPowerCap: action.ValidatorsPowerCap, + ValidatorSetCap: action.ValidatorSetCap, + Allowlist: action.Allowlist, + Denylist: action.Denylist, + MinStake: action.MinStake, + AllowInactiveVals: action.AllowInactiveVals, + } + + metadata := types.ConsumerMetadata{ + Name: "chain name of " + string(action.Chain), + Description: "no description", + Metadata: "no metadata", + } + + // create consumer to get a consumer-id + consumerId := tr.CreateConsumer(action.Chain, action.ConsumerChain, action.From, metadata, &initParams, &powerShapingParams) + if verbose { + fmt.Println("Create consumer chain", string(action.ConsumerChain), " with consumer-id", string(consumerId)) + } +} + type SubmitConsumerAdditionProposalAction struct { PreCCV bool Chain ChainID @@ -268,73 +391,223 @@ type SubmitConsumerAdditionProposalAction struct { AllowInactiveVals bool } +func (tr Chain) UpdateConsumer(providerChain ChainID, validator ValidatorID, update types.MsgUpdateConsumer) { + content, err := json.Marshal(update) + if err != nil { + log.Fatal("failed marshalling MsgUpdateConsumer: ", err.Error()) + } + jsonFile := "/update-consumer.json" + bz, err := tr.target.ExecCommand( + "/bin/bash", "-c", fmt.Sprintf(`echo '%s' > %s`, content, jsonFile), + ).CombinedOutput() + if err != nil { + log.Fatal(err, "\n", string(bz)) + } + + // Send consumer chain update + cmd := tr.target.ExecCommand( + tr.testConfig.chainConfigs[providerChain].BinaryName, + "tx", "provider", "update-consumer", jsonFile, + `--from`, `validator`+fmt.Sprint(validator), + `--chain-id`, string(tr.testConfig.chainConfigs[providerChain].ChainId), + `--home`, tr.getValidatorHome(providerChain, validator), + `--gas`, `900000`, + `--node`, tr.getValidatorNode(providerChain, validator), + `--keyring-backend`, `test`, + "--output", "json", + `-y`, + ) + + bz, err = cmd.CombinedOutput() + if err != nil { + log.Fatal("update consumer failed ", "error: ", err, "output: ", string(bz)) + } + + // Check transaction + txResponse := &TxResponse{} + err = json.Unmarshal(bz, txResponse) + if err != nil { + log.Fatalf("unmarshalling tx response on update-consumer: %s, json: %s", err.Error(), string(bz)) + } + + if txResponse.Code != 0 { + log.Fatalf("sending update-consumer transaction failed with error code %d, Log:'%s'", txResponse.Code, txResponse.RawLog) + } + tr.waitBlocks(providerChain, 2, 10*time.Second) +} + +// CreateConsumer creates a consumer chain and returns its consumer-id +func (tr Chain) CreateConsumer(providerChain, consumerChain ChainID, validator ValidatorID, metadata types.ConsumerMetadata, initParams *types.ConsumerInitializationParameters, powerShapingParams *types.PowerShapingParameters) ConsumerID { + + chainID := string(tr.testConfig.chainConfigs[consumerChain].ChainId) + msg := types.MsgCreateConsumer{ + ChainId: chainID, + Metadata: metadata, + InitializationParameters: initParams, + PowerShapingParameters: powerShapingParams, + } + + content, err := json.Marshal(msg) + if err != nil { + log.Fatalf("failed marshalling MsgCreateConsumer: %s", err.Error()) + } + jsonFile := "/create-consumer.json" + bz, err := tr.target.ExecCommand( + "/bin/bash", "-c", fmt.Sprintf(`echo '%s' > %s`, content, jsonFile), + ).CombinedOutput() + if err != nil { + log.Fatal(err, "\n", string(bz)) + } + + // Send consumer chain creation + cmd := tr.target.ExecCommand( + tr.testConfig.chainConfigs[providerChain].BinaryName, + "tx", "provider", "create-consumer", jsonFile, + `--from`, `validator`+fmt.Sprint(validator), + `--chain-id`, string(tr.testConfig.chainConfigs[providerChain].ChainId), + `--home`, tr.getValidatorHome(providerChain, validator), + `--gas`, `900000`, + `--node`, tr.getValidatorNode(providerChain, validator), + `--keyring-backend`, `test`, + "--output", "json", + `-y`, + ) + + bz, err = cmd.CombinedOutput() + if err != nil { + log.Fatal("create consumer failed ", "error: ", err, "output: ", string(bz)) + } + + txResponse := &TxResponse{} + err = json.Unmarshal(bz, txResponse) + if err != nil { + log.Fatalf("unmarshalling tx response on create-consumer: %s, json: %s", err.Error(), string(bz)) + } + + if txResponse.Code != 0 { + log.Fatalf("sending transaction failed with error code %d, Log:'%s'", txResponse.Code, txResponse.RawLog) + } + + // TODO: introduce waitForTx (see issue #2198) + tr.waitBlocks(providerChain, 2, 10*time.Second) + + // Get Consumer ID from transaction + cmd = tr.target.ExecCommand( + tr.testConfig.chainConfigs[providerChain].BinaryName, + "query", "tx", txResponse.TxHash, + `--node`, tr.getValidatorNode(providerChain, validator), + "--output", "json", + ) + bz, err = cmd.CombinedOutput() + if err != nil { + log.Fatalf("not able to query tx containing creation-consumer: tx: %s, err: %s, out: %s", + txResponse.TxHash, err.Error(), string(bz)) + } + + err = json.Unmarshal(bz, txResponse) + if err != nil { + log.Fatalf("unmarshalling tx containing create-consumer: %s, json: %s", err.Error(), string(bz)) + } + + consumerId := "" + for _, event := range txResponse.Events { + if event.Type != "consumer_creation" { + continue + } + attr, exists := event.GetAttribute("consumer_id") + if !exists { + log.Fatalf("no event with consumer_id found in tx content of create-consumer: %v", event) + } + consumerId = attr.Value + } + if consumerId == "" { + log.Fatalf("no consumer-id found in consumer creation transaction events for chain '%s'. events: %v", consumerChain, txResponse.Events) + } + + cfg, exists := tr.testConfig.chainConfigs[e2e.ChainID(chainID)] + if !exists { + log.Fatal("no chain config found for consumer chain", chainID) + } + if cfg.ConsumerId != "" && cfg.ConsumerId != e2e.ConsumerID(consumerId) { + log.Fatalf("chain '%s'registered already with a different consumer ID '%s'", chainID, consumerId) + } + + // Set the new created consumer-id on the chain's config + cfg.ConsumerId = e2e.ConsumerID(consumerId) + tr.testConfig.chainConfigs[e2e.ChainID(chainID)] = cfg + + return e2e.ConsumerID(consumerId) +} + +// submitConsumerAdditionProposal initializes a consumer chain and submits a governance proposal func (tr Chain) submitConsumerAdditionProposal( action SubmitConsumerAdditionProposalAction, verbose bool, ) { - spawnTime := tr.testConfig.containerConfig.Now.Add(time.Duration(action.SpawnTime) * time.Millisecond) params := ccvtypes.DefaultParams() - template := ` - { - "messages": [ - { - "@type": "/interchain_security.ccv.provider.v1.MsgConsumerAddition", - "chain_id": "%s", - "initial_height": { - "revision_number": "%d", - "revision_height": "%d" - }, - "genesis_hash": "%s", - "binary_hash": "%s", - "spawn_time": "%s", - "unbonding_period": "%s", - "ccv_timeout_period": "%s", - "transfer_timeout_period": "%s", - "consumer_redistribution_fraction": "%s", - "blocks_per_distribution_transmission": "%d", - "historical_entries": "%d", - "distribution_transmission_channel": "%s", - "top_N": %d, - "validators_power_cap": %d, - "validator_set_cap": %d, - "allowlist": %s, - "denylist": %s, - "authority": "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn", - "allow_inactive_vals": %t, - "min_stake": "%d" - } - ], -"metadata": "ipfs://CID", -"deposit": "%dstake", -"title": "Propose the addition of a new chain", -"summary": "Gonna be a great chain", -"expedited": false -}` - jsonStr := fmt.Sprintf(template, - string(tr.testConfig.chainConfigs[action.ConsumerChain].ChainId), - action.InitialHeight.RevisionNumber, - action.InitialHeight.RevisionHeight, - base64.StdEncoding.EncodeToString([]byte("gen_hash")), - base64.StdEncoding.EncodeToString([]byte("bin_hash")), - spawnTime.Local().Format(time.RFC3339Nano), - params.UnbondingPeriod, - params.CcvTimeoutPeriod, - params.TransferTimeoutPeriod, - params.ConsumerRedistributionFraction, - params.BlocksPerDistributionTransmission, - params.HistoricalEntries, - action.DistributionChannel, - action.TopN, - action.ValidatorsPowerCap, - action.ValidatorSetCap, - action.Allowlist, - action.Denylist, - action.AllowInactiveVals, - action.MinStake, - action.Deposit) + spawnTime := tr.testConfig.containerConfig.Now.Add(time.Duration(action.SpawnTime) * time.Millisecond) - //#nosec G204 -- bypass unsafe quoting warning (no production code) - proposalFile := "/consumer-addition.proposal" + Metadata := types.ConsumerMetadata{ + Name: "chain " + string(action.Chain), + Description: "no description", + Metadata: "no metadata", + } + + initializationParameters := types.ConsumerInitializationParameters{ + InitialHeight: action.InitialHeight, + GenesisHash: []byte("gen_hash"), + BinaryHash: []byte("bin_hash"), + SpawnTime: spawnTime, + + UnbondingPeriod: params.UnbondingPeriod, + CcvTimeoutPeriod: params.CcvTimeoutPeriod, + TransferTimeoutPeriod: params.TransferTimeoutPeriod, + ConsumerRedistributionFraction: params.ConsumerRedistributionFraction, + BlocksPerDistributionTransmission: params.BlocksPerDistributionTransmission, + HistoricalEntries: params.HistoricalEntries, + DistributionTransmissionChannel: action.DistributionChannel, + } + + consumerId := tr.CreateConsumer(action.Chain, action.ConsumerChain, action.From, Metadata, nil, nil) + authority := "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn" + + // Update consumer to change owner to governance before submitting the proposal + update := &types.MsgUpdateConsumer{ + ConsumerId: string(consumerId), + NewOwnerAddress: authority, + } + // For the MsgUpdateConsumer sent in the proposal + powerShapingParameters := types.PowerShapingParameters{ + Top_N: 0, + ValidatorsPowerCap: action.ValidatorsPowerCap, + ValidatorSetCap: action.ValidatorSetCap, + Allowlist: action.Allowlist, + Denylist: action.Denylist, + MinStake: action.MinStake, + AllowInactiveVals: action.AllowInactiveVals, + } + update.PowerShapingParameters = &powerShapingParameters + tr.UpdateConsumer(action.Chain, action.From, *update) + + // - set PowerShaping params TopN > 0 for consumer chain + update.PowerShapingParameters.Top_N = action.TopN + update.Owner = authority + update.NewOwnerAddress = "" + update.InitializationParameters = &initializationParameters + update.InitializationParameters.SpawnTime = spawnTime + update.Metadata = &Metadata + + // Generate proposal content + title := "Propose the addition of a new chain" + description := "description of the consumer modification proposal" + summary := "Gonna be a great chain" + expedited := false + metadata := "ipfs://CID" + deposit := fmt.Sprintf("%dstake", action.Deposit) + jsonStr := e2e.GenerateGovProposalContent(title, summary, metadata, deposit, description, expedited, update) + + // #nosec G204 -- bypass unsafe quoting warning (no production code) + proposalFile := "/update-consumer-proposal.json" bz, err := tr.target.ExecCommand( "/bin/bash", "-c", fmt.Sprintf(`echo '%s' > %s`, jsonStr, proposalFile), ).CombinedOutput() @@ -352,6 +625,7 @@ func (tr Chain) submitConsumerAdditionProposal( `--gas`, `900000`, `--node`, tr.getValidatorNode(action.Chain, action.From), `--keyring-backend`, `test`, + `-o json`, `-y`, ) @@ -361,7 +635,17 @@ func (tr Chain) submitConsumerAdditionProposal( } bz, err = cmd.CombinedOutput() if err != nil { - log.Fatal("submit-proposal failed:", err, "\n", string(bz)) + log.Fatal("executing submit-proposal failed:", err, "\n", string(bz)) + } + + txResponse := &TxResponse{} + err = json.Unmarshal(bz, txResponse) + if err != nil { + log.Fatalf("failed unmarshalling tx response on submit consumer update: %s, json: %s", err.Error(), string(bz)) + } + + if txResponse.Code != 0 { + log.Fatalf("gov submit consumer update transaction failed with error code %d, Log:'%s'", txResponse.Code, txResponse.RawLog) } if verbose { @@ -456,45 +740,34 @@ func (tr Chain) submitConsumerAdditionLegacyProposal( } type SubmitConsumerRemovalProposalAction struct { - Chain ChainID - From ValidatorID - Deposit uint - ConsumerChain ChainID - StopTimeOffset time.Duration // offset from time.Now() + Chain ChainID + From ValidatorID + Deposit uint + ConsumerChain ChainID } func (tr Chain) submitConsumerRemovalProposal( action SubmitConsumerRemovalProposalAction, verbose bool, ) { - template := ` - { - "messages": [ - { - "@type": "/interchain_security.ccv.provider.v1.MsgConsumerRemoval", - "chain_id": "%s", - "stop_time": "%s", - "authority": "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn" - } - ], - "metadata": "ipfs://CID", - "deposit": "%dstake", - "title": "%s", - "summary": "It was a great chain", - "expedited": false - } -` + consumerId := string(tr.testConfig.chainConfigs[action.ConsumerChain].ConsumerId) title := fmt.Sprintf("Stop the %v chain", action.ConsumerChain) - stopTime := tr.testConfig.containerConfig.Now.Add(action.StopTimeOffset).Format(time.RFC3339Nano) + description := "stop consumer chain" + summary := "It was a great chain" + expedited := false + metadata := "ipfs://CID" + deposit := fmt.Sprintf("%dstake", action.Deposit) + authority := "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn" + + msg := types.MsgRemoveConsumer{ + ConsumerId: consumerId, + Owner: authority, + } - jsonStr := fmt.Sprintf(template, - string(tr.testConfig.chainConfigs[action.ConsumerChain].ChainId), - stopTime, - action.Deposit, - title) + jsonStr := e2e.GenerateGovProposalContent(title, summary, metadata, deposit, description, expedited, &msg) // #nosec G204 -- bypass unsafe quoting warning (no production code) - proposalFile := "/consumer-removal.proposal" + proposalFile := "/remove-consumer-proposal.json" bz, err := tr.target.ExecCommand( "/bin/bash", "-c", fmt.Sprintf(`echo '%s' > %s`, jsonStr, proposalFile), ).CombinedOutput() @@ -536,13 +809,11 @@ func (tr Chain) submitConsumerRemovalLegacyProposal( action SubmitConsumerRemovalProposalAction, verbose bool, ) { - stopTime := tr.testConfig.containerConfig.Now.Add(action.StopTimeOffset) prop := client.ConsumerRemovalProposalJSON{ - Title: fmt.Sprintf("Stop the %v chain", action.ConsumerChain), - Summary: "It was a great chain", - ChainId: string(tr.testConfig.chainConfigs[action.ConsumerChain].ChainId), - StopTime: stopTime, - Deposit: fmt.Sprint(action.Deposit) + `stake`, + Title: fmt.Sprintf("Stop the %v chain", action.ConsumerChain), + Summary: "It was a great chain", + ChainId: string(tr.testConfig.chainConfigs[action.ConsumerChain].ChainId), + Deposit: fmt.Sprint(action.Deposit) + `stake`, } bz, err := json.Marshal(prop) @@ -599,47 +870,31 @@ func (tr Chain) submitConsumerModificationProposal( action SubmitConsumerModificationProposalAction, verbose bool, ) { - template := ` -{ -"messages": [ - { - "@type": "/interchain_security.ccv.provider.v1.MsgConsumerModification", - "title": "Propose the modification of the PSS parameters of a chain", - "description": "description of the consumer modification proposal", - "chain_id": "%s", - "top_N": %d, - "validators_power_cap": %d, - "validator_set_cap": %d, - "allowlist": %s, - "denylist": %s, - "authority": "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn", - "min_stake": %d, - "allow_inactive_vals": %t - } - ], -"metadata": "ipfs://CID", -"deposit": "%sstake", -"title": "Propose the modification of the PSS parameters of a chain", -"summary": "summary of a modification proposal", -"expedited": false - } -` - - jsonStr := fmt.Sprintf(template, - string(tr.testConfig.chainConfigs[action.ConsumerChain].ChainId), - action.TopN, - action.ValidatorsPowerCap, - action.ValidatorSetCap, - action.Allowlist, - action.Denylist, - action.Deposit, - action.MinStake, - action.AllowInactiveVals, - ) + consumerId := string(tr.testConfig.chainConfigs[action.ConsumerChain].ConsumerId) + title := "Propose the modification of the PSS parameters of a chain" + description := "description of the consumer modification proposal" + summary := "summary of a modification proposal" + expedited := false + metadata := "ipfs://CID" + deposit := fmt.Sprintf("%dstake", action.Deposit) + authority := "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn" + + msg := types.MsgUpdateConsumer{ + Owner: authority, + ConsumerId: consumerId, + PowerShapingParameters: &types.PowerShapingParameters{ + Top_N: action.TopN, + ValidatorsPowerCap: action.ValidatorsPowerCap, + ValidatorSetCap: action.ValidatorSetCap, + Allowlist: action.Allowlist, + Denylist: action.Denylist, + }, + } + jsonStr := e2e.GenerateGovProposalContent(title, summary, metadata, deposit, description, expedited, &msg) // #nosec G204 -- bypass unsafe quoting warning (no production code) - proposalFile := "/consumer-mod.proposal" + proposalFile := "/update-consumer-proposal.json" bz, err := tr.target.ExecCommand( "/bin/bash", "-c", fmt.Sprintf(`echo '%s' > %s`, jsonStr, proposalFile), ).CombinedOutput() @@ -754,26 +1009,21 @@ func (tr Chain) submitEnableTransfersProposalAction( ) { // gov signed address got by checking the gov module acc address in the test container // interchain-security-cdd q auth module-account gov --node tcp://7.7.9.253:26658 - template := ` - { - "messages": [ - { - "@type": "/ibc.applications.transfer.v1.MsgUpdateParams", - "signer": "consumer10d07y265gmmuvt4z0w9aw880jnsr700jlh7295", - "params": { - "send_enabled": true, - "receive_enabled": true - } - } - ], - "metadata": "ipfs://CID", - "deposit": "%dstake", - "title": "%s", - "summary": "Enable transfer send", - "expedited": false - } - ` - jsonStr := fmt.Sprintf(template, action.Deposit, action.Title) + + msgUpdateParams := ibctransfertypes.MsgUpdateParams{ + Signer: "consumer10d07y265gmmuvt4z0w9aw880jnsr700jlh7295", + Params: ibctransfertypes.Params{ + SendEnabled: true, + ReceiveEnabled: true, + }, + } + // Generate proposal content + description := "update IBC params" + summary := "Enable transfer send/receive" + expedited := false + metadata := "ipfs://CID" + deposit := fmt.Sprintf("%dstake", action.Deposit) + jsonStr := e2e.GenerateGovProposalContent(action.Title, summary, metadata, deposit, description, expedited, &msgUpdateParams) //#nosec G204 -- bypass unsafe quoting warning (no production code) bz, err := tr.target.ExecCommand( @@ -880,23 +1130,34 @@ func (tr *Chain) startConsumerChain( func (tr *Chain) getConsumerGenesis(providerChain, consumerChain ChainID) string { fmt.Println("Exporting consumer genesis from provider") providerBinaryName := tr.testConfig.chainConfigs[providerChain].BinaryName + consumerId := string(tr.testConfig.chainConfigs[consumerChain].ConsumerId) - cmd := tr.target.ExecCommand( - providerBinaryName, + now := time.Now() + timeout := now.Add(30 * time.Second) + var bz []byte + var err error + for { + cmd := tr.target.ExecCommand( + providerBinaryName, - "query", "provider", "consumer-genesis", - string(tr.testConfig.chainConfigs[consumerChain].ChainId), + "query", "provider", "consumer-genesis", consumerId, - `--node`, tr.target.GetQueryNode(providerChain), - `-o`, `json`, - ) + `--node`, tr.target.GetQueryNode(providerChain), + `-o`, `json`, + ) + bz, err = cmd.CombinedOutput() + if err == nil { + break + } - bz, err := cmd.CombinedOutput() - if err != nil { - log.Fatal(err, "\n", string(bz)) + if time.Now().After(timeout) { + log.Print("Failed running command: ", cmd) + log.Fatal(err, "\n", string(bz)) + } + time.Sleep(2 * time.Second) } - if tr.testConfig.transformGenesis || needsGenesisTransform(tr.testConfig) { + if tr.testConfig.transformGenesis || needsGenesisTransform(*tr.testConfig) { return string(tr.transformConsumerGenesis(consumerChain, bz)) } else { fmt.Println("No genesis transformation performed") @@ -1071,28 +1332,9 @@ func (tr Chain) changeoverChain( action ChangeoverChainAction, verbose bool, ) { - // sleep until the consumer chain genesis is ready on consumer - time.Sleep(5 * time.Second) - cmd := tr.target.ExecCommand( - tr.testConfig.chainConfigs[action.ProviderChain].BinaryName, - - "query", "provider", "consumer-genesis", - string(tr.testConfig.chainConfigs[action.SovereignChain].ChainId), - - `--node`, tr.target.GetQueryNode(action.ProviderChain), - `-o`, `json`, - ) - - if verbose { - log.Println("changeoverChain cmd: ", cmd.String()) - } - bz, err := cmd.CombinedOutput() - if err != nil { - log.Fatal(err, "\n", string(bz)) - } + consumerGenesis := ".app_state.ccvconsumer = " + tr.getConsumerGenesis(action.ProviderChain, action.SovereignChain) - consumerGenesis := ".app_state.ccvconsumer = " + string(bz) consumerGenesisChanges := tr.testConfig.chainConfigs[action.SovereignChain].GenesisChanges if consumerGenesisChanges != "" { consumerGenesis = consumerGenesis + " | " + consumerGenesisChanges @@ -2229,32 +2471,24 @@ type SubmitChangeRewardDenomsProposalAction struct { } func (tr Chain) submitChangeRewardDenomsProposal(action SubmitChangeRewardDenomsProposalAction, verbose bool) { - template := ` -{ - "messages": [ - { - "@type": "/interchain_security.ccv.provider.v1.MsgChangeRewardDenoms", - "denoms_to_add": ["%s"], - "denoms_to_remove": ["%s"], - "authority": "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn" - } - ], - "metadata": "ipfs://CID", - "deposit": "%dstake", - "title": "change reward denoms", - "summary": "Proposal to change reward denoms", - "expedited": false -}` - denomsToAdd := action.Denom - denomsToRemove := "stake" - jsonStr := fmt.Sprintf(template, - denomsToAdd, - denomsToRemove, - action.Deposit) + changeRewMsg := types.MsgChangeRewardDenoms{ + DenomsToAdd: []string{action.Denom}, + DenomsToRemove: []string{"stake"}, + Authority: "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn", + } + + // Generate proposal content + title := "change reward denoms" + description := "change reward denoms" + summary := "Proposal to change reward denoms" + expedited := false + metadata := "ipfs://CID" + deposit := fmt.Sprintf("%dstake", action.Deposit) + jsonStr := e2e.GenerateGovProposalContent(title, summary, metadata, deposit, description, expedited, &changeRewMsg) //#nosec G204 -- bypass unsafe quoting warning (no production code) - proposalFile := "/change-reward.proposal" + proposalFile := "/change-rewards-proposal.json" bz, err := tr.target.ExecCommand( "/bin/bash", "-c", fmt.Sprintf(`echo '%s' > %s`, jsonStr, proposalFile), ).CombinedOutput() @@ -2480,10 +2714,11 @@ func (tr Chain) assignConsumerPubKey(action AssignConsumerPubKeyAction, verbose if tr.testConfig.useCometmock { gas = "9000000" } + assignKey := fmt.Sprintf( `%s tx provider assign-consensus-key %s '%s' --from validator%s --chain-id %s --home %s --node %s --gas %s --keyring-backend test -y -o json`, tr.testConfig.chainConfigs[ChainID("provi")].BinaryName, - string(tr.testConfig.chainConfigs[action.Chain].ChainId), + string(tr.testConfig.chainConfigs[action.Chain].ConsumerId), action.ConsumerPubkey, action.Validator, tr.testConfig.chainConfigs[ChainID("provi")].ChainId, @@ -2659,7 +2894,7 @@ type OptInAction struct { Validator ValidatorID } -func (tr Chain) optIn(action OptInAction, target ExecutionTarget, verbose bool) { +func (tr Chain) optIn(action OptInAction, verbose bool) { // Note: to get error response reported back from this command '--gas auto' needs to be set. gas := "auto" // Unfortunately, --gas auto does not work with CometMock. so when using CometMock, just use --gas 9000000 then @@ -2671,7 +2906,7 @@ func (tr Chain) optIn(action OptInAction, target ExecutionTarget, verbose bool) optIn := fmt.Sprintf( `%s tx provider opt-in %s --from validator%s --chain-id %s --home %s --node %s --gas %s --keyring-backend test -y -o json`, tr.testConfig.chainConfigs[ChainID("provi")].BinaryName, - string(tr.testConfig.chainConfigs[action.Chain].ChainId), + string(tr.testConfig.chainConfigs[action.Chain].ConsumerId), action.Validator, tr.testConfig.chainConfigs[ChainID("provi")].ChainId, tr.getValidatorHome(ChainID("provi"), action.Validator), @@ -2679,7 +2914,7 @@ func (tr Chain) optIn(action OptInAction, target ExecutionTarget, verbose bool) gas, ) - cmd := target.ExecCommand( + cmd := tr.target.ExecCommand( "/bin/bash", "-c", optIn, ) @@ -2709,7 +2944,7 @@ type OptOutAction struct { ExpectError bool } -func (tr Chain) optOut(action OptOutAction, target ExecutionTarget, verbose bool) { +func (tr Chain) optOut(action OptOutAction, verbose bool) { // Note: to get error response reported back from this command '--gas auto' needs to be set. gas := "auto" // Unfortunately, --gas auto does not work with CometMock. so when using CometMock, just use --gas 9000000 then @@ -2721,7 +2956,7 @@ func (tr Chain) optOut(action OptOutAction, target ExecutionTarget, verbose bool optOut := fmt.Sprintf( `%s tx provider opt-out %s --from validator%s --chain-id %s --home %s --node %s --gas %s --keyring-backend test -y -o json`, tr.testConfig.chainConfigs[ChainID("provi")].BinaryName, - string(tr.testConfig.chainConfigs[action.Chain].ChainId), + string(tr.testConfig.chainConfigs[action.Chain].ConsumerId), action.Validator, tr.testConfig.chainConfigs[ChainID("provi")].ChainId, tr.getValidatorHome(ChainID("provi"), action.Validator), @@ -2729,7 +2964,7 @@ func (tr Chain) optOut(action OptOutAction, target ExecutionTarget, verbose bool gas, ) - cmd := target.ExecCommand( + cmd := tr.target.ExecCommand( "/bin/bash", "-c", optOut, ) @@ -2759,6 +2994,7 @@ func (tr Chain) optOut(action OptOutAction, target ExecutionTarget, verbose bool type SetConsumerCommissionRateAction struct { Chain ChainID + ConsumerID ConsumerID Validator ValidatorID CommissionRate float64 @@ -2767,7 +3003,7 @@ type SetConsumerCommissionRateAction struct { ExpectedError string } -func (tr Chain) setConsumerCommissionRate(action SetConsumerCommissionRateAction, target ExecutionTarget, verbose bool) { +func (tr Chain) setConsumerCommissionRate(action SetConsumerCommissionRateAction, verbose bool) { // Note: to get error response reported back from this command '--gas auto' needs to be set. gas := "auto" // Unfortunately, --gas auto does not work with CometMock. so when using CometMock, just use --gas 9000000 then @@ -2775,11 +3011,16 @@ func (tr Chain) setConsumerCommissionRate(action SetConsumerCommissionRateAction gas = "9000000" } + consumerId := string(tr.testConfig.chainConfigs[action.Chain].ConsumerId) + if action.ConsumerID != "" { + consumerId = string(action.ConsumerID) + } + // Use: "set-consumer-commission-rate [consumer-chain-id] [commission-rate]" setCommissionRate := fmt.Sprintf( `%s tx provider set-consumer-commission-rate %s %f --from validator%s --chain-id %s --home %s --node %s --gas %s --keyring-backend test -y -o json`, tr.testConfig.chainConfigs[ChainID("provi")].BinaryName, - string(tr.testConfig.chainConfigs[action.Chain].ChainId), + consumerId, action.CommissionRate, action.Validator, tr.testConfig.chainConfigs[ChainID("provi")].ChainId, @@ -2788,7 +3029,7 @@ func (tr Chain) setConsumerCommissionRate(action SetConsumerCommissionRateAction gas, ) - cmd := target.ExecCommand( + cmd := tr.target.ExecCommand( "/bin/bash", "-c", setCommissionRate, ) diff --git a/tests/e2e/config.go b/tests/e2e/config.go index 4fa762b5f7..c3f8f712b1 100644 --- a/tests/e2e/config.go +++ b/tests/e2e/config.go @@ -74,6 +74,7 @@ var hermesTemplates = map[string]string{ // type aliases for shared types from e2e package type ( ChainID = e2e.ChainID + ConsumerID = e2e.ConsumerID ValidatorID = e2e.ValidatorID ValidatorConfig = e2e.ValidatorConfig ChainConfig = e2e.ChainConfig diff --git a/tests/e2e/main.go b/tests/e2e/main.go index 2864c9b413..e8ae6b2166 100644 --- a/tests/e2e/main.go +++ b/tests/e2e/main.go @@ -246,6 +246,13 @@ var stepChoices = map[string]StepChoice{ description: "test minting without inactive validators as a sanity check", testConfig: MintTestCfg, }, + // TODO PERMISSIONLESS: ADD NEW E2E TEST + /* "permissionless-ics": { + name: "permissionless-ics", + steps: stepsPermissionlessICS(), + description: "test permissionless ics", + testConfig: DefaultTestCfg, + }, */ "inactive-vals-outside-max-validators": { name: "inactive-vals-outside-max-validators", steps: stepsInactiveValsTopNReproduce(), diff --git a/tests/e2e/state.go b/tests/e2e/state.go index f29c8f59f0..f6cac89947 100644 --- a/tests/e2e/state.go +++ b/tests/e2e/state.go @@ -12,6 +12,7 @@ import ( clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" e2e "github.com/cosmos/interchain-security/v5/tests/e2e/testlib" + "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" "github.com/kylelemons/godebug/pretty" "github.com/tidwall/gjson" "gopkg.in/yaml.v2" @@ -38,7 +39,7 @@ type State map[ChainID]ChainState type Chain struct { target e2e.TargetDriver - testConfig TestConfig + testConfig *TestConfig } func (tr Chain) GetChainState(chain ChainID, modelState ChainState) ChainState { @@ -335,7 +336,7 @@ func intPtr(i int) *int { } type Commands struct { - containerConfig ContainerConfig // FIXME only needed for 'Now' time tracking + containerConfig *ContainerConfig validatorConfigs map[ValidatorID]ValidatorConfig chainConfigs map[ChainID]ChainConfig target e2e.PlatformDriver @@ -465,6 +466,30 @@ func (tr Commands) GetProposal(chain ChainID, proposal uint) Proposal { Title: title, Description: description, } + case "/interchain_security.ccv.provider.v1.MsgUpdateConsumer": + consumerId := rawContent.Get("consumer_id").String() + consumerChainId := ChainID("") + for _, chainCfg := range tr.chainConfigs { + if chainCfg.ConsumerId == e2e.ConsumerID(consumerId) { + consumerChainId = chainCfg.ChainId + break + } + } + + updateProposal := ConsumerAdditionProposal{ + Deposit: uint(deposit), + Chain: consumerChainId, + Status: status, + } + if rawContent.Get("initialization_parameters").Exists() { + spawnTime := rawContent.Get("initialization_parameters.spawn_time").Time().Sub(tr.containerConfig.Now) + updateProposal.SpawnTime = int(spawnTime.Milliseconds()) + updateProposal.InitialHeight = clienttypes.Height{ + RevisionNumber: rawContent.Get("initialization_parameters.initial_height.revision_number").Uint(), + RevisionHeight: rawContent.Get("initialization_parameters.initial_height.revision_height").Uint(), + } + } + return updateProposal case "/interchain_security.ccv.provider.v1.MsgConsumerAddition": chainId := rawContent.Get("chain_id").String() spawnTime := rawContent.Get("spawn_time").Time().Sub(tr.containerConfig.Now) @@ -498,23 +523,21 @@ func (tr Commands) GetProposal(chain ChainID, proposal uint) Proposal { Title: title, Type: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", } - case "/interchain_security.ccv.provider.v1.MsgConsumerRemoval": - chainId := rawContent.Get("chain_id").String() - stopTime := rawContent.Get("stop_time").Time().Sub(tr.containerConfig.Now) + case "/interchain_security.ccv.provider.v1.MsgRemoveConsumer": + consumerId := rawContent.Get("consumer_id").String() var chain ChainID for i, conf := range tr.chainConfigs { - if string(conf.ChainId) == chainId { + if string(conf.ConsumerId) == consumerId { chain = i break } } return ConsumerRemovalProposal{ - Deposit: uint(deposit), - Status: status, - Chain: chain, - StopTime: int(stopTime.Milliseconds()), + Deposit: uint(deposit), + Status: status, + Chain: chain, } case "/ibc.applications.transfer.v1.MsgUpdateParams": var params IBCTransferParams @@ -732,7 +755,6 @@ func (tr Commands) GetIBCTransferParams(chain ChainID) IBCTransferParams { func (tr Commands) GetConsumerChains(chain ChainID) map[ChainID]bool { binaryName := tr.chainConfigs[chain].BinaryName cmd := tr.target.ExecCommand(binaryName, - "query", "provider", "list-consumer-chains", `--node`, tr.GetQueryNode(chain), `-o`, `json`, @@ -746,8 +768,13 @@ func (tr Commands) GetConsumerChains(chain ChainID) map[ChainID]bool { arr := gjson.Get(string(bz), "chains").Array() chains := make(map[ChainID]bool) for _, c := range arr { - id := c.Get("chain_id").String() - chains[ChainID(id)] = true + phase := c.Get("phase").String() + if phase == types.ConsumerPhase_name[int32(types.CONSUMER_PHASE_INITIALIZED)] || + phase == types.ConsumerPhase_name[int32(types.CONSUMER_PHASE_REGISTERED)] || + phase == types.ConsumerPhase_name[int32(types.CONSUMER_PHASE_LAUNCHED)] { + id := c.Get("chain_id").String() + chains[ChainID(id)] = true + } } return chains @@ -755,10 +782,11 @@ func (tr Commands) GetConsumerChains(chain ChainID) map[ChainID]bool { func (tr Commands) GetConsumerAddress(consumerChain ChainID, validator ValidatorID) string { binaryName := tr.chainConfigs[ChainID("provi")].BinaryName + consumerId := tr.chainConfigs[ChainID(consumerChain)].ConsumerId cmd := tr.target.ExecCommand(binaryName, "query", "provider", "validator-consumer-key", - string(consumerChain), tr.validatorConfigs[validator].ValconsAddress, + string(consumerId), tr.validatorConfigs[validator].ValconsAddress, `--node`, tr.GetQueryNode(ChainID("provi")), `-o`, `json`, ) @@ -773,10 +801,12 @@ func (tr Commands) GetConsumerAddress(consumerChain ChainID, validator Validator func (tr Commands) GetProviderAddressFromConsumer(consumerChain ChainID, validator ValidatorID) string { binaryName := tr.chainConfigs[ChainID("provi")].BinaryName + consumerId := tr.chainConfigs[ChainID(consumerChain)].ConsumerId + cmd := tr.target.ExecCommand(binaryName, "query", "provider", "validator-provider-key", - string(consumerChain), tr.validatorConfigs[validator].ConsumerValconsAddressOnProvider, + string(consumerId), tr.validatorConfigs[validator].ConsumerValconsAddressOnProvider, `--node`, tr.GetQueryNode(ChainID("provi")), `-o`, `json`, ) @@ -898,7 +928,12 @@ func (tr Commands) GetHasToValidate( arr := gjson.Get(string(bz), "consumer_chain_ids").Array() chains := []ChainID{} for _, c := range arr { - chains = append(chains, ChainID(c.String())) + for _, chain := range tr.chainConfigs { + if chain.ConsumerId == ConsumerID(c.String()) { + chains = append(chains, chain.ChainId) + break + } + } } return chains @@ -969,20 +1004,25 @@ func (tr Commands) GetTrustedHeight( func (tr Commands) GetProposedConsumerChains(chain ChainID) []string { binaryName := tr.chainConfigs[chain].BinaryName - bz, err := tr.target.ExecCommand(binaryName, - "query", "provider", "list-proposed-consumer-chains", + cmd := tr.target.ExecCommand(binaryName, + "query", "provider", "list-consumer-chains", `--node`, tr.GetQueryNode(chain), `-o`, `json`, - ).CombinedOutput() + ) + bz, err := cmd.CombinedOutput() if err != nil { log.Fatal(err, "\n", string(bz)) } - arr := gjson.Get(string(bz), "proposedChains").Array() + arr := gjson.Get(string(bz), "chains").Array() chains := []string{} for _, c := range arr { - cid := c.Get("chainID").String() - chains = append(chains, cid) + cid := c.Get("chain_id").String() + phase := c.Get("phase").String() + if phase == types.ConsumerPhase_name[int32(types.CONSUMER_PHASE_INITIALIZED)] || + phase == types.ConsumerPhase_name[int32(types.CONSUMER_PHASE_REGISTERED)] { + chains = append(chains, cid) + } } return chains @@ -1013,9 +1053,11 @@ func (tr Commands) GetQueryNodeIP(chain ChainID) string { // GetConsumerCommissionRate returns the commission rate of the given validator on the given consumerChain func (tr Commands) GetConsumerCommissionRate(consumerChain ChainID, validator ValidatorID) float64 { binaryName := tr.chainConfigs[ChainID("provi")].BinaryName + consumerId := tr.chainConfigs[consumerChain].ConsumerId + cmd := tr.target.ExecCommand(binaryName, "query", "provider", "validator-consumer-commission-rate", - string(consumerChain), tr.validatorConfigs[validator].ValconsAddress, + string(consumerId), tr.validatorConfigs[validator].ValconsAddress, `--node`, tr.GetQueryNode(ChainID("provi")), `-o`, `json`, ) diff --git a/tests/e2e/state_rapid_test.go b/tests/e2e/state_rapid_test.go index 1ca36d5578..fc591d5db1 100644 --- a/tests/e2e/state_rapid_test.go +++ b/tests/e2e/state_rapid_test.go @@ -203,10 +203,9 @@ func GetConsumerAdditionProposalGen() *rapid.Generator[ConsumerAdditionProposal] func GetConsumerRemovalProposalGen() *rapid.Generator[ConsumerRemovalProposal] { return rapid.Custom(func(t *rapid.T) ConsumerRemovalProposal { return ConsumerRemovalProposal{ - Deposit: rapid.Uint().Draw(t, "Deposit"), - Chain: GetChainIDGen().Draw(t, "Chain"), - StopTime: rapid.Int().Draw(t, "StopTime"), - Status: rapid.String().Draw(t, "Status"), + Deposit: rapid.Uint().Draw(t, "Deposit"), + Chain: GetChainIDGen().Draw(t, "Chain"), + Status: rapid.String().Draw(t, "Status"), } }) } diff --git a/tests/e2e/steps_partial_set_security.go b/tests/e2e/steps_partial_set_security.go index 80eff1aedd..156457769b 100644 --- a/tests/e2e/steps_partial_set_security.go +++ b/tests/e2e/steps_partial_set_security.go @@ -2,6 +2,7 @@ package main import ( "strconv" + "time" gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" @@ -32,6 +33,7 @@ func stepsOptInChain() []Step { { Action: SetConsumerCommissionRateAction{ Chain: ChainID("consu"), + ConsumerID: "99999", Validator: ValidatorID("bob"), CommissionRate: 0.123, ExpectError: true, @@ -40,31 +42,17 @@ func stepsOptInChain() []Step { State: State{}, }, { - Action: SubmitConsumerAdditionProposalAction{ + Action: CreateConsumerChainAction{ Chain: ChainID("provi"), From: ValidatorID("alice"), - Deposit: 10000001, ConsumerChain: ChainID("consu"), - SpawnTime: 0, + SpawnTime: uint(time.Minute * 10), // set spawn-time far in the future InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, TopN: 0, }, State: State{ ChainID("provi"): ChainState{ - Proposals: &map[uint]Proposal{ - 1: ConsumerAdditionProposal{ - Deposit: 10000001, - Chain: ChainID("consu"), - SpawnTime: 0, - InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), - }, - }, - HasToValidate: &map[ValidatorID][]ChainID{ - ValidatorID("alice"): {}, - ValidatorID("bob"): {}, - ValidatorID("carol"): {}, - }, + ProposedConsumerChains: &[]string{"consu"}, }, }, }, @@ -127,25 +115,15 @@ func stepsOptInChain() []Step { }, }, { - Action: VoteGovProposalAction{ - Chain: ChainID("provi"), - From: []ValidatorID{ValidatorID("alice"), ValidatorID("bob")}, - Vote: []string{"yes", "yes"}, - PropNumber: 1, - }, - State: State{ - ChainID("provi"): ChainState{ - Proposals: &map[uint]Proposal{ - 1: ConsumerAdditionProposal{ - Deposit: 10000001, - Chain: ChainID("consu"), - SpawnTime: 0, - InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), - }, - }, - }, + Action: UpdateConsumerChainAction{ + Chain: ChainID("provi"), + From: ValidatorID("alice"), + ConsumerChain: ChainID("consu"), + SpawnTime: 0, // launch now + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + TopN: 0, }, + State: State{}, }, { // we start all the validators but only "alice" and "bob" have opted in and hence @@ -1052,33 +1030,18 @@ func stepsValidatorSetCappedChain() []Step { }, }, { - Action: SubmitConsumerAdditionProposalAction{ - Chain: ChainID("provi"), - From: ValidatorID("alice"), - Deposit: 10000001, - ConsumerChain: ChainID("consu"), - SpawnTime: 0, - InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - TopN: 0, - // we can have at most 2 validators validating the consumer chain + Action: CreateConsumerChainAction{ + Chain: ChainID("provi"), + From: ValidatorID("alice"), + ConsumerChain: ChainID("consu"), + SpawnTime: uint(time.Minute * 10), // set spawn-time far in the future + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + TopN: 0, ValidatorSetCap: 2, }, State: State{ ChainID("provi"): ChainState{ - Proposals: &map[uint]Proposal{ - 1: ConsumerAdditionProposal{ - Deposit: 10000001, - Chain: ChainID("consu"), - SpawnTime: 0, - InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), - }, - }, - HasToValidate: &map[ValidatorID][]ChainID{ - ValidatorID("alice"): {}, - ValidatorID("bob"): {}, - ValidatorID("carol"): {}, - }, + ProposedConsumerChains: &[]string{"consu"}, }, }, }, @@ -1143,25 +1106,17 @@ func stepsValidatorSetCappedChain() []Step { State: State{}, }, { - Action: VoteGovProposalAction{ - Chain: ChainID("provi"), - From: []ValidatorID{ValidatorID("alice"), ValidatorID("bob")}, - Vote: []string{"yes", "yes"}, - PropNumber: 1, - }, - State: State{ - ChainID("provi"): ChainState{ - Proposals: &map[uint]Proposal{ - 1: ConsumerAdditionProposal{ - Deposit: 10000001, - Chain: ChainID("consu"), - SpawnTime: 0, - InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), - }, - }, - }, + // Update with SpawnTime 0 will trigger launch of consumer chain + Action: UpdateConsumerChainAction{ + Chain: ChainID("provi"), + From: ValidatorID("alice"), + ConsumerChain: ChainID("consu"), + SpawnTime: 0, // launch now + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + TopN: 0, + ValidatorSetCap: 2, }, + State: State{}, }, { Action: StartConsumerChainAction{ @@ -1513,36 +1468,17 @@ func stepsValidatorsAllowlistedChain() []Step { }, }, { - Action: SubmitConsumerAdditionProposalAction{ + Action: CreateConsumerChainAction{ Chain: ChainID("provi"), From: ValidatorID("alice"), - Deposit: 10000001, ConsumerChain: ChainID("consu"), - SpawnTime: 0, + SpawnTime: uint(time.Minute * 10), // set spawn-time far in the future InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, TopN: 0, - // only "alice" and "bob" are allowlisted (see `getDefaultValidators` in `tests/e2e/config.go`) - Allowlist: []string{ - "cosmosvalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7xw4mceq", - "cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39", - }, }, State: State{ ChainID("provi"): ChainState{ - Proposals: &map[uint]Proposal{ - 1: ConsumerAdditionProposal{ - Deposit: 10000001, - Chain: ChainID("consu"), - SpawnTime: 0, - InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), - }, - }, - HasToValidate: &map[ValidatorID][]ChainID{ - ValidatorID("alice"): {}, - ValidatorID("bob"): {}, - ValidatorID("carol"): {}, - }, + ProposedConsumerChains: &[]string{"consu"}, }, }, }, @@ -1606,25 +1542,21 @@ func stepsValidatorsAllowlistedChain() []Step { State: State{}, }, { - Action: VoteGovProposalAction{ - Chain: ChainID("provi"), - From: []ValidatorID{ValidatorID("alice"), ValidatorID("bob")}, - Vote: []string{"yes", "yes"}, - PropNumber: 1, - }, - State: State{ - ChainID("provi"): ChainState{ - Proposals: &map[uint]Proposal{ - 1: ConsumerAdditionProposal{ - Deposit: 10000001, - Chain: ChainID("consu"), - SpawnTime: 0, - InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), - }, - }, + // Update with SpawnTime 0 will trigger launch of consumer chain + Action: UpdateConsumerChainAction{ + Chain: ChainID("provi"), + From: ValidatorID("alice"), + ConsumerChain: ChainID("consu"), + SpawnTime: 0, // launch now + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + TopN: 0, + // only "alice" and "bob" are allowlisted (see `getDefaultValidators` in `tests/e2e/config.go`) + Allowlist: []string{ + "cosmosvalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7xw4mceq", + "cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39", }, }, + State: State{}, }, { Action: StartConsumerChainAction{ @@ -1719,33 +1651,18 @@ func stepsValidatorsDenylistedChain() []Step { }, }, { - Action: SubmitConsumerAdditionProposalAction{ - Chain: ChainID("provi"), - From: ValidatorID("alice"), - Deposit: 10000001, - ConsumerChain: ChainID("consu"), - SpawnTime: 0, - InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - TopN: 0, - // only "bob" is denylisted (see `getDefaultValidators` in `tests/e2e/config.go`) - Denylist: []string{"cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39"}, + Action: CreateConsumerChainAction{ + Chain: ChainID("provi"), + From: ValidatorID("alice"), + ConsumerChain: ChainID("consu"), + SpawnTime: uint(time.Minute * 10), // set spawn-time far in the future + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + TopN: 0, + ValidatorSetCap: 2, }, State: State{ ChainID("provi"): ChainState{ - Proposals: &map[uint]Proposal{ - 1: ConsumerAdditionProposal{ - Deposit: 10000001, - Chain: ChainID("consu"), - SpawnTime: 0, - InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), - }, - }, - HasToValidate: &map[ValidatorID][]ChainID{ - ValidatorID("alice"): {}, - ValidatorID("bob"): {}, - ValidatorID("carol"): {}, - }, + ProposedConsumerChains: &[]string{"consu"}, }, }, }, @@ -1809,25 +1726,17 @@ func stepsValidatorsDenylistedChain() []Step { State: State{}, }, { - Action: VoteGovProposalAction{ - Chain: ChainID("provi"), - From: []ValidatorID{ValidatorID("alice"), ValidatorID("bob")}, - Vote: []string{"yes", "yes"}, - PropNumber: 1, - }, - State: State{ - ChainID("provi"): ChainState{ - Proposals: &map[uint]Proposal{ - 1: ConsumerAdditionProposal{ - Deposit: 10000001, - Chain: ChainID("consu"), - SpawnTime: 0, - InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), - }, - }, - }, + // Update with SpawnTime 0 will trigger launch of consumer chain + Action: UpdateConsumerChainAction{ + Chain: ChainID("provi"), + From: ValidatorID("alice"), + ConsumerChain: ChainID("consu"), + SpawnTime: 0, // launch now + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + TopN: 0, + Denylist: []string{"cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39"}, }, + State: State{}, }, { Action: StartConsumerChainAction{ @@ -1923,31 +1832,17 @@ func stepsModifyChain() []Step { }, }, { - Action: SubmitConsumerAdditionProposalAction{ + Action: CreateConsumerChainAction{ Chain: ChainID("provi"), From: ValidatorID("alice"), - Deposit: 10000001, ConsumerChain: ChainID("consu"), - SpawnTime: 0, + SpawnTime: uint(time.Minute * 10), // set spawn-time far in the future InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, TopN: 0, }, State: State{ ChainID("provi"): ChainState{ - Proposals: &map[uint]Proposal{ - 1: ConsumerAdditionProposal{ - Deposit: 10000001, - Chain: ChainID("consu"), - SpawnTime: 0, - InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), - }, - }, - HasToValidate: &map[ValidatorID][]ChainID{ - ValidatorID("alice"): {}, - ValidatorID("bob"): {}, - ValidatorID("carol"): {}, - }, + ProposedConsumerChains: &[]string{"consu"}, }, }, }, @@ -2011,25 +1906,16 @@ func stepsModifyChain() []Step { State: State{}, }, { - Action: VoteGovProposalAction{ - Chain: ChainID("provi"), - From: []ValidatorID{ValidatorID("alice"), ValidatorID("bob"), ValidatorID("carol")}, - Vote: []string{"yes", "yes", "yes"}, - PropNumber: 1, - }, - State: State{ - ChainID("provi"): ChainState{ - Proposals: &map[uint]Proposal{ - 1: ConsumerAdditionProposal{ - Deposit: 10000001, - Chain: ChainID("consu"), - SpawnTime: 0, - InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), - }, - }, - }, + // Update with SpawnTime 0 will trigger launch of consumer chain + Action: UpdateConsumerChainAction{ + Chain: ChainID("provi"), + From: ValidatorID("alice"), + ConsumerChain: ChainID("consu"), + SpawnTime: 0, // launch now + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + TopN: 0, }, + State: State{}, }, { Action: StartConsumerChainAction{ @@ -2105,43 +1991,16 @@ func stepsModifyChain() []Step { // 1. set `ValidatorsPowerCap` to 40% { - Action: SubmitConsumerModificationProposalAction{ + Action: UpdateConsumerChainAction{ Chain: ChainID("provi"), From: ValidatorID("alice"), - Deposit: 10000001, ConsumerChain: ChainID("consu"), + SpawnTime: 0, + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + TopN: 0, ValidatorsPowerCap: 40, }, - State: State{ - ChainID("provi"): ChainState{ - Proposals: &map[uint]Proposal{ - 2: ConsumerModificationProposal{ - Deposit: 10000001, - Chain: ChainID("consu"), - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), - }, - }, - }, - }, - }, - { - Action: VoteGovProposalAction{ - Chain: ChainID("provi"), - From: []ValidatorID{ValidatorID("alice"), ValidatorID("bob"), ValidatorID("carol")}, - Vote: []string{"yes", "yes", "yes"}, - PropNumber: 2, - }, - State: State{ - ChainID("provi"): ChainState{ - Proposals: &map[uint]Proposal{ - 2: ConsumerModificationProposal{ - Deposit: 10000001, - Chain: ChainID("consu"), - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), - }, - }, - }, - }, + State: State{}, }, { Action: RelayPacketsAction{ @@ -2171,43 +2030,16 @@ func stepsModifyChain() []Step { // 2. set the `ValidatorSetCap` to a maximum of 2 validators { - Action: SubmitConsumerModificationProposalAction{ + Action: UpdateConsumerChainAction{ Chain: ChainID("provi"), From: ValidatorID("alice"), - Deposit: 10000001, ConsumerChain: ChainID("consu"), + SpawnTime: 0, + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + TopN: 0, ValidatorSetCap: 2, }, - State: State{ - ChainID("provi"): ChainState{ - Proposals: &map[uint]Proposal{ - 3: ConsumerModificationProposal{ - Deposit: 10000001, - Chain: ChainID("consu"), - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), - }, - }, - }, - }, - }, - { - Action: VoteGovProposalAction{ - Chain: ChainID("provi"), - From: []ValidatorID{ValidatorID("alice"), ValidatorID("bob"), ValidatorID("carol")}, - Vote: []string{"yes", "yes", "yes"}, - PropNumber: 3, - }, - State: State{ - ChainID("provi"): ChainState{ - Proposals: &map[uint]Proposal{ - 3: ConsumerModificationProposal{ - Deposit: 10000001, - Chain: ChainID("consu"), - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), - }, - }, - }, - }, + State: State{}, }, { Action: RelayPacketsAction{ @@ -2235,50 +2067,21 @@ func stepsModifyChain() []Step { }, }, }, - // 3. set an allowlist with 2 validators { - Action: SubmitConsumerModificationProposalAction{ + Action: UpdateConsumerChainAction{ Chain: ChainID("provi"), From: ValidatorID("alice"), - Deposit: 10000001, ConsumerChain: ChainID("consu"), - // only "alice" and "carol" are allowlisted (see `getDefaultValidators` in `tests/e2e/config.go`) + SpawnTime: 0, + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + TopN: 0, Allowlist: []string{ "cosmosvalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7xw4mceq", "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6", }, }, - State: State{ - ChainID("provi"): ChainState{ - Proposals: &map[uint]Proposal{ - 4: ConsumerModificationProposal{ - Deposit: 10000001, - Chain: ChainID("consu"), - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), - }, - }, - }, - }, - }, - { - Action: VoteGovProposalAction{ - Chain: ChainID("provi"), - From: []ValidatorID{ValidatorID("alice"), ValidatorID("bob"), ValidatorID("carol")}, - Vote: []string{"yes", "yes", "yes"}, - PropNumber: 4, - }, - State: State{ - ChainID("provi"): ChainState{ - Proposals: &map[uint]Proposal{ - 4: ConsumerModificationProposal{ - Deposit: 10000001, - Chain: ChainID("consu"), - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), - }, - }, - }, - }, + State: State{}, }, { Action: RelayPacketsAction{ @@ -2304,47 +2107,19 @@ func stepsModifyChain() []Step { }, }, }, - // 4. set a denylist with 1 validator { - Action: SubmitConsumerModificationProposalAction{ + Action: UpdateConsumerChainAction{ Chain: ChainID("provi"), From: ValidatorID("alice"), - Deposit: 10000001, ConsumerChain: ChainID("consu"), + SpawnTime: 0, + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + TopN: 0, // only "alice" is denylisted (see `getDefaultValidators` in `tests/e2e/config.go`) Denylist: []string{"cosmosvalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7xw4mceq"}, }, - State: State{ - ChainID("provi"): ChainState{ - Proposals: &map[uint]Proposal{ - 5: ConsumerModificationProposal{ - Deposit: 10000001, - Chain: ChainID("consu"), - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), - }, - }, - }, - }, - }, - { - Action: VoteGovProposalAction{ - Chain: ChainID("provi"), - From: []ValidatorID{ValidatorID("alice"), ValidatorID("bob"), ValidatorID("carol")}, - Vote: []string{"yes", "yes", "yes"}, - PropNumber: 5, - }, - State: State{ - ChainID("provi"): ChainState{ - Proposals: &map[uint]Proposal{ - 5: ConsumerModificationProposal{ - Deposit: 10000001, - Chain: ChainID("consu"), - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), - }, - }, - }, - }, + State: State{}, }, { Action: RelayPacketsAction{ @@ -2370,8 +2145,20 @@ func stepsModifyChain() []Step { }, }, }, - // 5. modify the chain from Opt In to Top 100% + // -- Change the owner to governance authority + { + Action: UpdateConsumerChainAction{ + Chain: ChainID("provi"), + From: ValidatorID("alice"), + ConsumerChain: ChainID("consu"), + NewOwner: "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn", + SpawnTime: 0, + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + TopN: 0, + }, + State: State{}, + }, { Action: SubmitConsumerModificationProposalAction{ Chain: ChainID("provi"), @@ -2383,7 +2170,7 @@ func stepsModifyChain() []Step { State: State{ ChainID("provi"): ChainState{ Proposals: &map[uint]Proposal{ - 6: ConsumerModificationProposal{ + 1: ConsumerAdditionProposal{ Deposit: 10000001, Chain: ChainID("consu"), Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), @@ -2397,12 +2184,12 @@ func stepsModifyChain() []Step { Chain: ChainID("provi"), From: []ValidatorID{ValidatorID("alice"), ValidatorID("bob"), ValidatorID("carol")}, Vote: []string{"yes", "yes", "yes"}, - PropNumber: 6, + PropNumber: 1, }, State: State{ ChainID("provi"): ChainState{ Proposals: &map[uint]Proposal{ - 6: ConsumerModificationProposal{ + 1: ConsumerAdditionProposal{ Deposit: 10000001, Chain: ChainID("consu"), Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), diff --git a/tests/e2e/steps_stop_chain.go b/tests/e2e/steps_stop_chain.go index fbf86e4733..9efc240ee6 100644 --- a/tests/e2e/steps_stop_chain.go +++ b/tests/e2e/steps_stop_chain.go @@ -1,10 +1,8 @@ package main import ( - "strconv" - "time" - gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + "strconv" ) // start relayer so that all messages are relayed @@ -22,11 +20,10 @@ func stepsStopChain(consumerName string, propNumber uint) []Step { s := []Step{ { Action: SubmitConsumerRemovalProposalAction{ - Chain: ChainID("provi"), - From: ValidatorID("bob"), - Deposit: 10000001, - ConsumerChain: ChainID(consumerName), - StopTimeOffset: 0 * time.Millisecond, + Chain: ChainID("provi"), + From: ValidatorID("bob"), + Deposit: 10000001, + ConsumerChain: ChainID(consumerName), }, State: State{ ChainID("provi"): ChainState{ @@ -35,10 +32,9 @@ func stepsStopChain(consumerName string, propNumber uint) []Step { }, Proposals: &map[uint]Proposal{ propNumber: ConsumerRemovalProposal{ - Deposit: 10000001, - Chain: ChainID(consumerName), - StopTime: 0, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), + Deposit: 10000001, + Chain: ChainID(consumerName), + Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), }, }, ConsumerChains: &map[ChainID]bool{"consu": true}, // consumer chain not yet removed @@ -56,10 +52,9 @@ func stepsStopChain(consumerName string, propNumber uint) []Step { ChainID("provi"): ChainState{ Proposals: &map[uint]Proposal{ propNumber: ConsumerRemovalProposal{ - Deposit: 10000001, - Chain: ChainID(consumerName), - StopTime: 0, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), + Deposit: 10000001, + Chain: ChainID(consumerName), + Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), }, }, ValBalances: &map[ValidatorID]uint{ @@ -80,11 +75,10 @@ func stepsConsumerRemovalPropNotPassing(consumerName string, propNumber uint) [] s := []Step{ { Action: SubmitConsumerRemovalProposalAction{ - Chain: ChainID("provi"), - From: ValidatorID("bob"), - Deposit: 10000001, - ConsumerChain: ChainID(consumerName), - StopTimeOffset: 0 * time.Millisecond, + Chain: ChainID("provi"), + From: ValidatorID("bob"), + Deposit: 10000001, + ConsumerChain: ChainID(consumerName), }, State: State{ ChainID("provi"): ChainState{ @@ -93,10 +87,9 @@ func stepsConsumerRemovalPropNotPassing(consumerName string, propNumber uint) [] }, Proposals: &map[uint]Proposal{ propNumber: ConsumerRemovalProposal{ - Deposit: 10000001, - Chain: ChainID(consumerName), - StopTime: 0, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), + Deposit: 10000001, + Chain: ChainID(consumerName), + Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), }, }, ConsumerChains: &map[ChainID]bool{"consu": true}, // consumer chain not removed @@ -114,10 +107,9 @@ func stepsConsumerRemovalPropNotPassing(consumerName string, propNumber uint) [] ChainID("provi"): ChainState{ Proposals: &map[uint]Proposal{ propNumber: ConsumerRemovalProposal{ - Deposit: 10000001, - Chain: ChainID(consumerName), - StopTime: 0, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_REJECTED)), + Deposit: 10000001, + Chain: ChainID(consumerName), + Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_REJECTED)), }, }, ValBalances: &map[ValidatorID]uint{ diff --git a/tests/e2e/test_driver.go b/tests/e2e/test_driver.go index f65ddfe6ab..6c2bc35d77 100644 --- a/tests/e2e/test_driver.go +++ b/tests/e2e/test_driver.go @@ -79,7 +79,7 @@ func (td *DefaultDriver) getIcsVersion(chainID ChainID) string { func (td *DefaultDriver) getTargetDriver(chainID ChainID) Chain { target := Chain{ - testConfig: td.testCfg, + testConfig: &td.testCfg, } icsVersion := td.getIcsVersion(chainID) switch icsVersion { @@ -95,7 +95,7 @@ func (td *DefaultDriver) getTargetDriver(chainID ChainID) Chain { } default: target.target = Commands{ - containerConfig: td.testCfg.containerConfig, + containerConfig: &td.testCfg.containerConfig, validatorConfigs: td.testCfg.validatorConfigs, chainConfigs: td.testCfg.chainConfigs, target: td.target, @@ -227,12 +227,16 @@ func (td *DefaultDriver) runAction(action interface{}) error { } else { target.submitChangeRewardDenomsProposal(action, td.verbose) } + case CreateConsumerChainAction: + target.createConsumerChain(action, td.verbose) + case UpdateConsumerChainAction: + target.updateConsumerChain(action, td.verbose) case OptInAction: - target.optIn(action, td.target, td.verbose) + target.optIn(action, td.verbose) case OptOutAction: - target.optOut(action, td.target, td.verbose) + target.optOut(action, td.verbose) case SetConsumerCommissionRateAction: - target.setConsumerCommissionRate(action, td.target, td.verbose) + target.setConsumerCommissionRate(action, td.verbose) default: log.Fatalf("unknown action in testRun %s: %#v", td.testCfg.name, action) } diff --git a/tests/e2e/testlib/types.go b/tests/e2e/testlib/types.go index bd7996b988..0c10d8578d 100644 --- a/tests/e2e/testlib/types.go +++ b/tests/e2e/testlib/types.go @@ -12,6 +12,7 @@ import ( type ( ChainID string + ConsumerID string ValidatorID string ) @@ -124,7 +125,8 @@ type ValidatorConfig struct { // Attributes that are unique to a chain. Allows us to map (part of) // the set of strings defined above to a set of viable chains type ChainConfig struct { - ChainId ChainID + ChainId ChainID + ConsumerId ConsumerID // The account prefix configured on the chain. For example, on the Hub, this is "cosmos" AccountPrefix string // Must be unique per chain @@ -304,10 +306,9 @@ func (p UpgradeProposal) isProposal() {} func (p ConsumerAdditionProposal) isProposal() {} type ConsumerRemovalProposal struct { - Deposit uint - Chain ChainID - StopTime int - Status string + Deposit uint + Chain ChainID + Status string } func (p ConsumerRemovalProposal) isProposal() {} diff --git a/tests/e2e/testlib/utils.go b/tests/e2e/testlib/utils.go index 08f410269f..c9d663a3f5 100644 --- a/tests/e2e/testlib/utils.go +++ b/tests/e2e/testlib/utils.go @@ -2,11 +2,60 @@ package e2e import ( "bufio" + "encoding/json" "fmt" "log" "os/exec" + + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" ) +// GovernanceProposal is used to generate content to be used for `gov submit-proposal` command +type GovernanceProposal struct { + // Msgs defines an array of sdk.Msgs proto-JSON-encoded as Anys. + Messages []json.RawMessage `json:"messages,omitempty"` + Metadata string `json:"metadata"` + Deposit string `json:"deposit"` + Title string `json:"title"` + Summary string `json:"summary"` + Expedited bool `json:"expedited"` +} + +// GenerateGovProposalContent creates proposal content ready to be used by `gov submit-proposal` command +func GenerateGovProposalContent(title, summary, metadata, deposit, description string, expedited bool, msgs ...sdk.Msg) string { + + // Register the messages. Needed for correct type annotation in the resulting json + modcodec := codec.NewProtoCodec(codectypes.NewInterfaceRegistry()) + modcodec.InterfaceRegistry().RegisterImplementations( + (*sdk.Msg)(nil), + msgs..., + ) + + proposal := GovernanceProposal{ + Metadata: metadata, + Deposit: deposit, + Title: title, + Summary: summary, + Expedited: expedited, + } + + for _, msg := range msgs { + msgJson, err := modcodec.MarshalInterfaceJSON(msg) + if err != nil { + panic(fmt.Errorf("failed marshalling message '%v' for gov proposal: err=%s", msg, err)) + } + proposal.Messages = append(proposal.Messages, msgJson) + } + raw, err := json.MarshalIndent(proposal, "", " ") + if err != nil { + panic(fmt.Errorf("failed to marshal proposal: %w", err)) + } + + return string(raw) +} + func ExecuteCommand(cmd *exec.Cmd, cmdName string, verbose bool) { if verbose { fmt.Println(cmdName+" cmd:", cmd.String()) diff --git a/tests/e2e/trace_handlers_test.go b/tests/e2e/trace_handlers_test.go index e4f9e46f12..a773d00fe5 100644 --- a/tests/e2e/trace_handlers_test.go +++ b/tests/e2e/trace_handlers_test.go @@ -27,10 +27,9 @@ var proposalInStateSteps = []Step{ ChainID("provi"): ChainState{ Proposals: &map[uint]Proposal{ 1: ConsumerRemovalProposal{ - Deposit: 10000001, - Chain: ChainID("foo"), - StopTime: 0, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), + Deposit: 10000001, + Chain: ChainID("foo"), + Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), }, }, }, @@ -136,10 +135,9 @@ func TestMarshalAndUnmarshalChainState(t *testing.T) { "consumer removal proposal": {ChainState{ Proposals: &map[uint]Proposal{ 5: ConsumerRemovalProposal{ - Deposit: 10000001, - Chain: ChainID("test123"), - StopTime: 5000000000, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), + Deposit: 10000001, + Chain: ChainID("test123"), + Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), }, }, ValBalances: &map[ValidatorID]uint{ diff --git a/tests/e2e/v4/state.go b/tests/e2e/v4/state.go index 594004bc24..b4b7b70190 100644 --- a/tests/e2e/v4/state.go +++ b/tests/e2e/v4/state.go @@ -317,7 +317,6 @@ func (tr Commands) GetProposal(chain ChainID, proposal uint) Proposal { } case "/interchain_security.ccv.provider.v1.ConsumerRemovalProposal": chainId := gjson.Get(string(bz), `messages.0.content.chain_id`).String() - stopTime := gjson.Get(string(bz), `messages.0.content.stop_time`).Time().Sub(containerConfig.Now) var chain ChainID for i, conf := range chainConfigs { @@ -328,10 +327,9 @@ func (tr Commands) GetProposal(chain ChainID, proposal uint) Proposal { } return ConsumerRemovalProposal{ - Deposit: uint(deposit), - Status: status, - Chain: chain, - StopTime: int(stopTime.Milliseconds()), + Deposit: uint(deposit), + Status: status, + Chain: chain, } case "/cosmos.params.v1beta1.ParameterChangeProposal": return ParamsProposal{ @@ -391,7 +389,6 @@ func (tr Commands) GetParam(chain ChainID, param Param) string { func (tr Commands) GetConsumerChains(chain ChainID) map[ChainID]bool { binaryName := tr.ChainConfigs[chain].BinaryName cmd := tr.Target.ExecCommand(binaryName, - "query", "provider", "list-consumer-chains", `--node`, tr.GetQueryNode(chain), `-o`, `json`, diff --git a/tests/integration/common.go b/tests/integration/common.go index 46ef499d01..97cd3fbf29 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", 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 e5c6099203..3d662382e1 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..db628aaccd 100644 --- a/tests/integration/partial_set_security_test.go +++ b/tests/integration/partial_set_security_test.go @@ -5,6 +5,8 @@ import ( "sort" "testing" + "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + "cosmossdk.io/math" ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" "github.com/stretchr/testify/require" @@ -151,7 +153,14 @@ 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) + err = providerKeeper.SetConsumerPowerShapingParameters( + s.providerChain.GetContext(), + s.getFirstBundle().ConsumerId, + types.PowerShapingParameters{ + MinStake: tc.minStake, + }, + ) + s.Require().NoError(err) // delegate and undelegate to trigger a vscupdate diff --git a/tests/integration/provider_gov_hooks.go b/tests/integration/provider_gov_hooks.go deleted file mode 100644 index 813a62a671..0000000000 --- a/tests/integration/provider_gov_hooks.go +++ /dev/null @@ -1,156 +0,0 @@ -package integration - -import ( - "time" - - "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - - 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 -func (s *CCVTestSuite) TestAfterPropSubmissionAndVotingPeriodEnded() { - ctx := s.providerChain.GetContext() - providerKeeper := s.providerApp.GetProviderKeeper() - govKeeper := s.providerApp.GetTestGovKeeper() - proposer := s.providerChain.SenderAccount - - addConsumerProp := testkeeper.GetTestMsgConsumerAddition() - - proposal, err := v1.NewProposal([]sdk.Msg{&addConsumerProp}, 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) - - // verify that the proposal ID is created - proposalIdOnProvider, ok := providerKeeper.GetProposedConsumerChain(ctx, proposal.Id) - s.Require().True(ok) - s.Require().NotEmpty(proposalIdOnProvider) - s.Require().Equal(addConsumerProp.ChainId, proposalIdOnProvider) - - providerKeeper.Hooks().AfterProposalVotingPeriodEnded(ctx, proposal.Id) - // verify that the proposal ID is deleted - s.Require().Empty(providerKeeper.GetProposedConsumerChain(ctx, proposal.Id)) -} - -func (s *CCVTestSuite) TestGetConsumerAdditionFromProp() { - ctx := s.providerChain.GetContext() - proposer := s.providerChain.SenderAccount - - // create a dummy bank send message - dummyMsg := &banktypes.MsgSend{ - FromAddress: sdk.AccAddress(proposer.GetAddress()).String(), - ToAddress: sdk.AccAddress(proposer.GetAddress()).String(), - Amount: sdk.NewCoins(sdk.NewCoin("stake", math.OneInt())), - } - - // create a legacy proposal - textProp, err := v1.NewLegacyContent( - v1beta1.NewTextProposal("a title", "a legacy text prop"), - authtypes.NewModuleAddress("gov").String(), - ) - s.Require().NoError(err) - - // create a valid consumer addition message - msgConsumerAddition := testkeeper.GetTestMsgConsumerAddition() - - // create a legacy consumer addition proposal content - // (not supported anymore) - addConsumerPropLegacy, err := v1.NewLegacyContent( - testkeeper.GetTestConsumerAdditionProp(), - authtypes.NewModuleAddress("gov").String(), - ) - s.Require().NoError(err) - - testCases := []struct { - name string - propMsg sdk.Msg - expectConsumerPropFound bool - expPanic bool - }{ - { - name: "prop not found", - propMsg: nil, - expectConsumerPropFound: false, - expPanic: false, - }, - { - name: "msgs in prop contain no consumer addition props", - propMsg: dummyMsg, - expectConsumerPropFound: false, - expPanic: false, - }, - { - name: "msgs contain a legacy prop but not of ConsumerAdditionProposal type", - propMsg: textProp, - expectConsumerPropFound: false, - }, - { - name: "msgs contain an invalid legacy prop", - propMsg: &v1.MsgExecLegacyContent{}, - expectConsumerPropFound: false, - expPanic: false, - }, - { - name: "msg contains a prop of legacy ConsumerAdditionProposal type - hook should NOT create a new proposed chain", - propMsg: addConsumerPropLegacy, - expectConsumerPropFound: false, - expPanic: false, - }, - { - name: "msg contains a prop of MsgConsumerAddition type - hook should create a new proposed chain", - propMsg: &msgConsumerAddition, - expectConsumerPropFound: true, - expPanic: false, - }, - } - - for _, tc := range testCases { - s.Run(tc.name, func() { - providerKeeper := s.providerApp.GetProviderKeeper() - govKeeper := s.providerApp.GetTestGovKeeper() - - var proposal v1.Proposal - var err error - - if tc.propMsg == nil { - // cover edgecase where proposal has no messages - proposal, err = v1.NewProposal([]sdk.Msg{}, 1, time.Now(), time.Now().Add(1*time.Hour), "metadata", "title", "summary", proposer.GetAddress(), false) - s.Require().NoError(err) - } else { - // cover variolus cases where proposal has messages but only some are consumer addition proposals - proposal, err = v1.NewProposal([]sdk.Msg{tc.propMsg}, 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) - - if tc.expPanic { - s.Require().Panics(func() { - // this panics with a nil pointer dereference because the proposal is invalid and cannot be unmarshalled - providerKeeper.Hooks().GetConsumerAdditionFromProp(ctx, proposal.Id) - }) - return - } - - savedProp, found := providerKeeper.Hooks().GetConsumerAdditionFromProp(ctx, proposal.Id) - if tc.expectConsumerPropFound { - s.Require().True(found) - s.Require().NotEmpty(savedProp, savedProp) - } else { - s.Require().False(found) - s.Require().Empty(savedProp) - } - }) - } -} diff --git a/tests/integration/setup.go b/tests/integration/setup.go index eeb980200f..218f6febb0 100644 --- a/tests/integration/setup.go +++ b/tests/integration/setup.go @@ -21,7 +21,7 @@ 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" + providertypes "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, providertypes.CONSUMER_PHASE_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) - suite.Require().Equal(bundle.TopN, topN) + powerShapingParameters, err := providerKeeper.GetConsumerPowerShapingParameters(suite.providerCtx(), bundle.ConsumerId) + suite.Require().NoError(err) + suite.Require().Equal(bundle.TopN, powerShapingParameters.Top_N) } // 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 == icstestingutils.FirstConsumerID { // 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..8ce2e99cbf 100644 --- a/tests/integration/stop_consumer.go +++ b/tests/integration/stop_consumer.go @@ -3,6 +3,7 @@ package integration import ( "cosmossdk.io/math" channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -75,8 +76,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 +89,12 @@ func (s *CCVTestSuite) TestStopConsumerChain() { } // stop the consumer chain - err = providerKeeper.StopConsumerChain(s.providerCtx(), firstBundle.Chain.ChainID, true) + providerKeeper.SetConsumerPhase(s.providerCtx(), firstBundle.ConsumerId, types.CONSUMER_PHASE_STOPPED) + err = providerKeeper.DeleteConsumerChain(s.providerCtx(), firstBundle.ConsumerId) 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 +107,8 @@ func (s *CCVTestSuite) TestStopConsumerOnChannelClosed() { providerKeeper := s.providerApp.GetProviderKeeper() // stop the consumer chain - err := providerKeeper.StopConsumerChain(s.providerCtx(), s.consumerChain.ChainID, true) + providerKeeper.SetConsumerPhase(s.providerCtx(), s.getFirstBundle().ConsumerId, types.CONSUMER_PHASE_STOPPED) + err := providerKeeper.DeleteConsumerChain(s.providerCtx(), s.getFirstBundle().ConsumerId) s.Require().NoError(err) err = s.path.EndpointA.UpdateClient() @@ -126,7 +129,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 +139,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..897b713a42 100644 --- a/tests/mbt/driver/core.go +++ b/tests/mbt/driver/core.go @@ -10,7 +10,6 @@ import ( "cosmossdk.io/math" - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" tendermint "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" ibctesting "github.com/cosmos/ibc-go/v8/testing" "github.com/stretchr/testify/require" @@ -220,8 +219,8 @@ func (s *Driver) getStateString() string { state.WriteString("\n") state.WriteString("Consumers Chains:\n") - chainIds := s.providerKeeper().GetAllRegisteredConsumerChainIDs(s.providerCtx()) - state.WriteString(strings.Join(chainIds, ", ")) + // chainIds := s.providerKeeper().GetAllRegisteredConsumerIds(s.providerCtx()) + // state.WriteString(strings.Join(chainIds, ", ")) state.WriteString("\n\n") for chain := range s.simibcs { @@ -255,24 +254,24 @@ func (s *Driver) getChainStateString(chain ChainId) string { chainInfo.WriteString(fmt.Sprintf(" Running Time: %s\n", runningTime)) chainInfo.WriteString(fmt.Sprintf(" Last Time entered on chain: %s\n", lastTime)) - if !s.isProviderChain(chain) { - // Check whether the chain is in the consumer chains on the provider + // 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 { - if consumerChainID == string(chain) { - found = true - } - } + // found := false + // for _, consumerChainID := range consumerChainIDs { + // if consumerChainID == string(chain) { + // found = true + // } + // } - if found { - chainInfo.WriteString("...is currently a consumer chain") - } else { - chainInfo.WriteString("...is currently not a consumer chain") - } - } + // if found { + // chainInfo.WriteString("...is currently a consumer chain") + // } else { + // chainInfo.WriteString("...is currently not a consumer chain") + // } + // } // Build the validator info string var validatorInfo strings.Builder @@ -366,16 +365,16 @@ 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 { - if s.path(ChainId(consumerChainID)).Path.EndpointA.GetChannel().State == channeltypes.CLOSED || - s.path(ChainId(consumerChainID)).Path.EndpointB.GetChannel().State == channeltypes.CLOSED { - continue - } - consumersWithIntactChannel = append(consumersWithIntactChannel, ChainId(consumerChainID)) - } + // for _, consumerChainID := range consumerIDsOnProvider { + // if s.path(ChainId(consumerChainID)).Path.EndpointA.GetChannel().State == channeltypes.CLOSED || + // s.path(ChainId(consumerChainID)).Path.EndpointB.GetChannel().State == channeltypes.CLOSED { + // continue + // } + // consumersWithIntactChannel = append(consumersWithIntactChannel, ChainId(consumerChainID)) + // } return consumersWithIntactChannel } @@ -452,7 +451,8 @@ func (s *Driver) DeliverAcks() { // stopConsumer stops a given consumer chain. func (s *Driver) stopConsumer(chain ChainId) error { // stop the consumer chain on the provider - return s.providerKeeper().StopConsumerChain(s.providerCtx(), string(chain), true) + // return s.providerKeeper().StopConsumerChain(s.providerCtx(), string(chain), true) + return nil } // newDriver creates a new Driver object. diff --git a/tests/mbt/driver/mbt_test.go b/tests/mbt/driver/mbt_test.go index 35ea2f4e1f..278c276d82 100644 --- a/tests/mbt/driver/mbt_test.go +++ b/tests/mbt/driver/mbt_test.go @@ -404,7 +404,7 @@ func RunItfTrace(t *testing.T, path string) { driver.DeliverPacketToConsumer(ChainId(consumerChain), expectError) // stop the consumer chain - driver.providerKeeper().StopConsumerChain(driver.providerCtx(), consumerChain, expectError) + // driver.providerKeeper().StopConsumerChain(driver.providerCtx(), consumerChain, expectError) } else { expectError = false driver.DeliverPacketToConsumer(ChainId(consumerChain), expectError) @@ -421,7 +421,7 @@ func RunItfTrace(t *testing.T, path string) { driver.DeliverPacketFromConsumer(ChainId(consumerChain), expectError) // stop the consumer chain on the provider - driver.providerKeeper().StopConsumerChain(driver.providerCtx(), consumerChain, expectError) + // driver.providerKeeper().StopConsumerChain(driver.providerCtx(), consumerChain, expectError) } else { expectError = false driver.DeliverPacketFromConsumer(ChainId(consumerChain), expectError) diff --git a/tests/mbt/driver/setup.go b/tests/mbt/driver/setup.go index d9e658c030..97102960d6 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,10 @@ 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) + err = s.providerKeeper().SetConsumerPowerShapingParameters(providerChain.GetContext(), consumerChain.ChainID, types.PowerShapingParameters{ + Top_N: 100, + }) + require.NoError(s.t, err, "Error setting consumer top N for chain %v", consumerChain.ChainID) // 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..84ccf347f2 100644 --- a/testutil/ibc_testing/generic_setup.go +++ b/testutil/ibc_testing/generic_setup.go @@ -6,6 +6,7 @@ import ( "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,8 @@ const ( ) var ( - FirstConsumerChainID string + firstConsumerChainID string + FirstConsumerID string provChainID string democConsumerChainID string consumerTopNParams [NumConsumers]uint32 @@ -46,7 +48,8 @@ var ( func init() { // Disable revision format ibctesting.ChainIDSuffix = "" - FirstConsumerChainID = ibctesting.GetChainID(2) + firstConsumerChainID = ibctesting.GetChainID(2) + FirstConsumerID = "" provChainID = ibctesting.GetChainID(1) democConsumerChainID = ibctesting.GetChainID(5000) // TopN parameter values per consumer chain initiated @@ -57,6 +60,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 +142,33 @@ 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} - providerKeeper.SetPendingConsumerAdditionProp(providerChain.GetContext(), prop) - props := providerKeeper.GetAllPendingConsumerAdditionProps(providerChain.GetContext()) - s.Require().Len(props, 1, "unexpected len consumer addition proposals in AddConsumer") + powerShapingParameters := testkeeper.GetTestPowerShapingParameters() + powerShapingParameters.Top_N = consumerTopNParams[index] // isn't used in CreateConsumerClient + + consumerId := providerKeeper.FetchAndIncrementConsumerId(providerChain.GetContext()) + if chainID == firstConsumerChainID { + FirstConsumerID = consumerId + } + providerKeeper.SetConsumerChainId(providerChain.GetContext(), consumerId, chainID) + err := providerKeeper.SetConsumerMetadata(providerChain.GetContext(), consumerId, consumerMetadata) + s.Require().NoError(err) + err = providerKeeper.SetConsumerInitializationParameters(providerChain.GetContext(), consumerId, initializationParameters) + s.Require().NoError(err) + err = providerKeeper.SetConsumerPowerShapingParameters(providerChain.GetContext(), consumerId, powerShapingParameters) + s.Require().NoError(err) + providerKeeper.SetConsumerPhase(providerChain.GetContext(), consumerId, providertypes.CONSUMER_PHASE_INITIALIZED) + err = providerKeeper.AppendConsumerToBeLaunched(providerChain.GetContext(), consumerId, coordinator.CurrentTime) + s.Require().NoError(err) // opt-in all validators lastVals, err := providerApp.GetProviderKeeper().GetLastBondedValidators(providerChain.GetContext()) @@ -159,7 +176,9 @@ 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)) + err = providerKeeper.AppendOptedInConsumerId(providerChain.GetContext(), providertypes.NewProviderConsAddress(consAddr), consumerId) + s.Require().NoError(err) } // commit the state on the provider chain @@ -169,11 +188,16 @@ func AddConsumer[Tp testutil.ProviderApp, Tc testutil.ConsumerApp]( // get genesis state created by the provider consumerGenesisState, found := providerKeeper.GetConsumerGenesis( providerChain.GetContext(), - chainID, + consumerId, ) - s.Require().True(found, "consumer genesis not found in AddConsumer") + _, found = providerKeeper.GetConsumerClientId( + providerChain.GetContext(), + consumerId, + ) + s.Require().True(found, "clientID not found in AddConsumer") + // use InitialValSet as the valset on the consumer var valz []*tmtypes.Validator for _, update := range consumerGenesisState.Provider.InitialValSet { @@ -201,8 +225,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/expectations.go b/testutil/keeper/expectations.go index 3ceaf4fd2b..53d16a6581 100644 --- a/testutil/keeper/expectations.go +++ b/testutil/keeper/expectations.go @@ -80,9 +80,8 @@ func GetMocksForSetConsumerChain(ctx sdk.Context, mocks *MockedKeepers, } } -// GetMocksForStopConsumerChainWithCloseChannel returns mock expectations needed to call StopConsumerChain() when -// `closeChan` is true. -func GetMocksForStopConsumerChainWithCloseChannel(ctx sdk.Context, mocks *MockedKeepers) []*gomock.Call { +// GetMocksForDeleteConsumerChain returns mock expectations needed to call `DeleteConsumerChain` +func GetMocksForDeleteConsumerChain(ctx sdk.Context, mocks *MockedKeepers) []*gomock.Call { dummyCap := &capabilitytypes.Capability{} return []*gomock.Call{ mocks.MockChannelKeeper.EXPECT().GetChannel(gomock.Any(), types.ProviderPortID, "channelID").Return( 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..1c11c2c7e9 100644 --- a/testutil/keeper/unit_test_helpers.go +++ b/testutil/keeper/unit_test_helpers.go @@ -212,13 +212,14 @@ func GetNewSlashPacketData() types.SlashPacketData { } } -// SetupForStoppingConsumerChain registers expected mock calls and corresponding state setup -// which assert that a consumer chain was properly setup to be later stopped from `StopConsumerChain`. -// Note: This function only setups and tests that we correctly setup a consumer chain that we could later stop when -// calling `StopConsumerChain` -- this does NOT necessarily mean that the consumer chain is stopped. -// Also see `TestProviderStateIsCleanedAfterConsumerChainIsStopped`. -func SetupForStoppingConsumerChain(t *testing.T, ctx sdk.Context, +// SetupForDeleteConsumerChain registers expected mock calls and corresponding state setup +// which assert that a consumer chain was properly setup to be later deleted with `DeleteConsumerChain`. +// Note: This function only setups and tests that we correctly setup a consumer chain that we could later delete when +// calling `DeleteConsumerChain` -- this does NOT necessarily mean that the consumer chain is deleted. +// Also see `TestProviderStateIsCleanedAfterConsumerChainIsDeleted`. +func SetupForDeleteConsumerChain(t *testing.T, ctx sdk.Context, providerKeeper *providerkeeper.Keeper, mocks MockedKeepers, + consumerId string, ) { t.Helper() @@ -230,73 +231,101 @@ func SetupForStoppingConsumerChain(t *testing.T, ctx sdk.Context, gomock.InOrder(expectations...) - prop := GetTestConsumerAdditionProp() - err := providerKeeper.CreateConsumerClient(ctx, prop) + providerKeeper.SetConsumerChainId(ctx, consumerId, "chainID") + err := providerKeeper.SetConsumerMetadata(ctx, consumerId, GetTestConsumerMetadata()) require.NoError(t, err) + err = providerKeeper.SetConsumerInitializationParameters(ctx, consumerId, GetTestInitializationParameters()) + require.NoError(t, err) + err = providerKeeper.SetConsumerPowerShapingParameters(ctx, consumerId, GetTestPowerShapingParameters()) + require.NoError(t, err) + + // set the chain to initialized so that we can create a consumer client + providerKeeper.SetConsumerPhase(ctx, consumerId, providertypes.CONSUMER_PHASE_INITIALIZED) + + err = providerKeeper.CreateConsumerClient(ctx, consumerId) + require.NoError(t, err) + // set the mapping consumer ID <> client ID for the consumer chain + providerKeeper.SetConsumerClientId(ctx, consumerId, "clientID") + // set the channel ID for the consumer chain err = providerKeeper.SetConsumerChain(ctx, "channelID") require.NoError(t, err) + + // set the chain to stopped sto the chain can be deleted + providerKeeper.SetConsumerPhase(ctx, consumerId, providertypes.CONSUMER_PHASE_STOPPED) } -// 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, +// TestProviderStateIsCleanedAfterConsumerChainIsDeleted executes test assertions for the provider's state being cleaned +// after a deleted consumer chain. +func TestProviderStateIsCleanedAfterConsumerChainIsDeleted(t *testing.T, ctx sdk.Context, providerKeeper providerkeeper.Keeper, + consumerId, expectedChannelID string, expErr bool, ) { 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) - // 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 { + return providertypes.ConsumerInitializationParameters{ + InitialHeight: clienttypes.NewHeight(4, 5), + GenesisHash: []byte("gen_hash"), + BinaryHash: []byte("bin_hash"), + SpawnTime: time.Now().UTC(), + ConsumerRedistributionFraction: types.DefaultConsumerRedistributeFrac, + BlocksPerDistributionTransmission: types.DefaultBlocksPerDistributionTransmission, + DistributionTransmissionChannel: "", + HistoricalEntries: types.DefaultHistoricalEntries, + CcvTimeoutPeriod: types.DefaultCCVTimeoutPeriod, + TransferTimeoutPeriod: types.DefaultTransferTimeoutPeriod, + UnbondingPeriod: types.DefaultConsumerUnbondingPeriod, + } +} + +func GetTestPowerShapingParameters() providertypes.PowerShapingParameters { + return providertypes.PowerShapingParameters{ + Top_N: 0, + ValidatorsPowerCap: 0, + ValidatorSetCap: 0, + Allowlist: nil, + Denylist: nil, + MinStake: 0, + AllowInactiveVals: false, + } } -func GetTestConsumerAdditionProp() *providertypes.ConsumerAdditionProposal { - prop := providertypes.NewConsumerAdditionProposal( - "chainID", - "description", - "chainID", - clienttypes.NewHeight(4, 5), - []byte("gen_hash"), - []byte("bin_hash"), - time.Now(), - types.DefaultConsumerRedistributeFrac, - types.DefaultBlocksPerDistributionTransmission, - "", - types.DefaultHistoricalEntries, - types.DefaultCCVTimeoutPeriod, - types.DefaultTransferTimeoutPeriod, - types.DefaultConsumerUnbondingPeriod, - 0, - 0, - 0, - nil, - nil, - 0, - false, - ).(*providertypes.ConsumerAdditionProposal) - - return prop +func GetTestMsgUpdateConsumer() providertypes.MsgUpdateConsumer { + return providertypes.MsgUpdateConsumer{ + Owner: "owner", + 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..c6e0d53159 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" @@ -26,20 +27,19 @@ func NewQueryCmd() *cobra.Command { cmd.AddCommand(CmdConsumerGenesis()) cmd.AddCommand(CmdConsumerChains()) - cmd.AddCommand(CmdConsumerStartProposals()) - cmd.AddCommand(CmdConsumerStopProposals()) cmd.AddCommand(CmdConsumerValidatorKeyAssignment()) cmd.AddCommand(CmdProviderValidatorKey()) cmd.AddCommand(CmdThrottleState()) cmd.AddCommand(CmdRegisteredConsumerRewardDenoms()) - cmd.AddCommand(CmdProposedConsumerChains()) - cmd.AddCommand(CmdAllPairsValConAddrByConsumerChainID()) + cmd.AddCommand(CmdAllPairsValConsAddrByConsumer()) cmd.AddCommand(CmdProviderParameters()) cmd.AddCommand(CmdConsumerChainOptedInValidators()) cmd.AddCommand(CmdConsumerValidators()) cmd.AddCommand(CmdConsumerChainsValidatorHasToValidate()) cmd.AddCommand(CmdValidatorConsumerCommissionRate()) cmd.AddCommand(CmdBlocksUntilNextEpoch()) + cmd.AddCommand(CmdConsumerIdFromClientId()) + cmd.AddCommand(CmdConsumerChain()) return cmd } @@ -47,8 +47,8 @@ func NewQueryCmd() *cobra.Command { // parameters managed by the x/params module. func CmdConsumerGenesis() *cobra.Command { cmd := &cobra.Command{ - Use: "consumer-genesis [chainid]", - Short: "Query for consumer chain genesis state by chain id", + Use: "consumer-genesis [consumer-id]", + Short: "Query for consumer chain genesis state by consumer id", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) @@ -57,7 +57,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 @@ -74,9 +74,12 @@ func CmdConsumerGenesis() *cobra.Command { func CmdConsumerChains() *cobra.Command { cmd := &cobra.Command{ - Use: "list-consumer-chains", - Short: "Query active consumer chains for provider chain.", - Args: cobra.ExactArgs(0), + Use: "list-consumer-chains [phase] [limit]", + 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|Deleted=5).`, + Args: cobra.MaximumNArgs(2), RunE: func(cmd *cobra.Command, args []string) (err error) { clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { @@ -85,96 +88,24 @@ func CmdConsumerChains() *cobra.Command { queryClient := types.NewQueryClient(clientCtx) req := &types.QueryConsumerChainsRequest{} - res, err := queryClient.QueryConsumerChains(cmd.Context(), req) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func CmdProposedConsumerChains() *cobra.Command { - cmd := &cobra.Command{ - Use: "list-proposed-consumer-chains", - Short: "Query chainIDs in consumer addition proposal before voting finishes", - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, args []string) (err error) { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - queryClient := types.NewQueryClient(clientCtx) - - req := &types.QueryProposedChainIDsRequest{} - res, err := queryClient.QueryProposedConsumerChainIDs(cmd.Context(), req) - if err != nil { - return err - } - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func CmdConsumerStartProposals() *cobra.Command { - cmd := &cobra.Command{ - Use: "list-start-proposals", - Short: "Query consumer chains start proposals on provider chain.", - Long: `Query mature and pending consumer chains start proposals on provider chain. - Matured proposals will be executed on the next block - their spawn_time has passed - Pending proposals are waiting for their spawn_time to pass. - `, - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, args []string) (err error) { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err + if len(args) >= 1 && args[0] != "" { + phase, err := strconv.ParseInt(args[0], 10, 32) + if err != nil { + return err + } + req.Phase = types.ConsumerPhase(phase) } - queryClient := types.NewQueryClient(clientCtx) - - req := &types.QueryConsumerChainStartProposalsRequest{} - res, err := queryClient.QueryConsumerChainStarts(cmd.Context(), req) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} -func CmdConsumerStopProposals() *cobra.Command { - cmd := &cobra.Command{ - Use: "list-stop-proposals", - Short: "Query consumer chains stop proposals on provider chain.", - Long: `Query mature and pending consumer chains stop proposals on provider chain. - Matured proposals will be executed on the next block - their stop_time has passed - Pending proposals are waiting for their stop_time to pass. - `, - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, args []string) (err error) { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err + if len(args) == 2 && args[1] != "" { + limit, err := strconv.ParseInt(args[1], 10, 32) + if err != nil { + return err + } + req.Limit = int32(limit) } - queryClient := types.NewQueryClient(clientCtx) - req := &types.QueryConsumerChainStopProposalsRequest{} - res, err := queryClient.QueryConsumerChainStops(cmd.Context(), req) + res, err := queryClient.QueryConsumerChains(cmd.Context(), req) if err != nil { return err } @@ -192,13 +123,13 @@ func CmdConsumerStopProposals() *cobra.Command { func CmdConsumerValidatorKeyAssignment() *cobra.Command { bech32PrefixConsAddr := sdk.GetConfig().GetBech32ConsensusAddrPrefix() cmd := &cobra.Command{ - Use: "validator-consumer-key [chainid] [provider-validator-address]", + Use: "validator-consumer-key [consumerId] [provider-validator-address]", Short: "Query assigned validator consensus public key for a consumer chain", Long: strings.TrimSpace( fmt.Sprintf(`Returns the currently assigned validator consensus public key for a consumer chain, if one has been assigned. Example: -$ %s query provider validator-consumer-key foochain %s1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj +$ %s query provider validator-consumer-key 3 %s1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj `, version.AppName, bech32PrefixConsAddr, ), @@ -211,7 +142,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 +150,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) @@ -240,12 +171,12 @@ $ %s query provider validator-consumer-key foochain %s1gghjut3ccd8ay0zduzj64hwre func CmdProviderValidatorKey() *cobra.Command { bech32PrefixConsAddr := sdk.GetConfig().GetBech32ConsensusAddrPrefix() cmd := &cobra.Command{ - Use: "validator-provider-key [chainid] [consumer-validator-address]", + Use: "validator-provider-key [consumer-id] [consumer-validator-address]", Short: "Query validator consensus public key for the provider chain", Long: strings.TrimSpace( fmt.Sprintf(`Returns the currently assigned validator consensus public key for the provider chain. Example: -$ %s query provider validator-provider-key foochain %s1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj +$ %s query provider validator-provider-key 333 %s1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj `, version.AppName, bech32PrefixConsAddr, ), @@ -258,7 +189,7 @@ $ %s query provider validator-provider-key foochain %s1gghjut3ccd8ay0zduzj64hwre } queryClient := types.NewQueryClient(clientCtx) - consumerChainID := args[0] + consumerID := args[0] addr, err := sdk.ConsAddressFromBech32(args[1]) if err != nil { @@ -266,7 +197,7 @@ $ %s query provider validator-provider-key foochain %s1gghjut3ccd8ay0zduzj64hwre } req := &types.QueryValidatorProviderAddrRequest{ - ChainId: consumerChainID, + ConsumerId: consumerID, ConsumerAddress: addr.String(), } res, err := queryClient.QueryValidatorProviderAddr(cmd.Context(), req) @@ -354,10 +285,10 @@ $ %s query provider registered-consumer-reward-denoms return cmd } -func CmdAllPairsValConAddrByConsumerChainID() *cobra.Command { +func CmdAllPairsValConsAddrByConsumer() *cobra.Command { cmd := &cobra.Command{ - Use: "all-pairs-valconsensus-address [consumer-chain-id]", - Short: "Query all pairs of valconsensus address by consumer chainId.", + Use: "all-pairs-valconsensus-address [consumer-id]", + Short: "Query all pairs of valconsensus address by consumer ID.", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) @@ -366,8 +297,8 @@ func CmdAllPairsValConAddrByConsumerChainID() *cobra.Command { } queryClient := types.NewQueryClient(clientCtx) - req := types.QueryAllPairsValConAddrByConsumerChainIDRequest{ChainId: args[0]} - res, err := queryClient.QueryAllPairsValConAddrByConsumerChainID(cmd.Context(), &req) + req := types.QueryAllPairsValConsAddrByConsumerRequest{ConsumerId: args[0]} + res, err := queryClient.QueryAllPairsValConsAddrByConsumer(cmd.Context(), &req) if err != nil { return err } @@ -415,15 +346,15 @@ $ %s query provider params return cmd } -// Command to query opted-in validators by consumer chain ID +// Command to query opted-in validators by consumer ID func CmdConsumerChainOptedInValidators() *cobra.Command { cmd := &cobra.Command{ - Use: "consumer-opted-in-validators [chainid]", + Use: "consumer-opted-in-validators [consumer-id]", Short: "Query opted-in validators for a given consumer chain", Long: strings.TrimSpace( fmt.Sprintf(`Query opted-in validators for a given consumer chain. Example: -$ %s consumer-opted-in-validators foochain +$ %s consumer-opted-in-validators 3 `, version.AppName), ), Args: cobra.ExactArgs(1), @@ -435,7 +366,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 } @@ -449,16 +380,16 @@ $ %s consumer-opted-in-validators foochain return cmd } -// Command to query the consumer validators by consumer chain ID +// Command to query the consumer validators by consumer ID func CmdConsumerValidators() *cobra.Command { cmd := &cobra.Command{ - Use: "consumer-validators [chainid]", + Use: "consumer-validators [consumer-id]", Short: "Query the last set consumer-validator set for a given consumer chain", Long: strings.TrimSpace( fmt.Sprintf(`Query the last set consumer-validator set for a given consumer chain. Note that this does not necessarily mean that the consumer chain is currently using this validator set because a VSCPacket could be delayed, etc. Example: -$ %s consumer-validators foochain +$ %s consumer-validators 3 `, version.AppName), ), Args: cobra.ExactArgs(1), @@ -470,7 +401,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 } @@ -531,12 +462,12 @@ $ %s has-to-validate %s1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj func CmdValidatorConsumerCommissionRate() *cobra.Command { bech32PrefixConsAddr := sdk.GetConfig().GetBech32ConsensusAddrPrefix() cmd := &cobra.Command{ - Use: "validator-consumer-commission-rate [chainid] [provider-validator-address]", + Use: "validator-consumer-commission-rate [consumer-id] [provider-validator-address]", Short: "Query the consumer commission rate a validator charges on a consumer chain", Long: strings.TrimSpace( fmt.Sprintf(`Query the consumer commission rate a validator charges on a consumer chain. Example: -$ %s validator-consumer-commission-rate foochain %s1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj +$ %s validator-consumer-commission-rate 3 %s1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj `, version.AppName, bech32PrefixConsAddr), ), Args: cobra.ExactArgs(2), @@ -554,7 +485,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 +527,57 @@ 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 +} + +func CmdConsumerChain() *cobra.Command { + cmd := &cobra.Command{ + Use: "consumer-chain [consumer-id]", + Short: "Query the consumer chain associated with the consumer 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.QueryConsumerChainRequest{ConsumerId: args[0]} + res, err := queryClient.QueryConsumerChain(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..17414bc5ef 100644 --- a/x/ccv/provider/client/cli/tx.go +++ b/x/ccv/provider/client/cli/tx.go @@ -36,6 +36,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()) @@ -45,7 +48,7 @@ func GetTxCmd() *cobra.Command { func NewAssignConsumerKeyCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "assign-consensus-key [consumer-chain-id] [consumer-pubkey]", + Use: "assign-consensus-key [consumer-id] [consumer-pubkey]", Short: "assign a consensus public key to use for a consumer chain", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { @@ -54,7 +57,7 @@ func NewAssignConsumerKeyCmd() *cobra.Command { return err } - signer := clientCtx.GetFromAddress().String() + submitter := clientCtx.GetFromAddress().String() txf, err := tx.NewFactoryCLI(clientCtx, cmd.Flags()) if err != nil { return err @@ -63,7 +66,7 @@ func NewAssignConsumerKeyCmd() *cobra.Command { providerValAddr := clientCtx.GetFromAddress() - msg, err := types.NewMsgAssignConsumerKey(args[0], sdk.ValAddress(providerValAddr), args[1], signer) + msg, err := types.NewMsgAssignConsumerKey(args[0], sdk.ValAddress(providerValAddr), args[1], submitter) if err != nil { return err } @@ -84,7 +87,7 @@ func NewAssignConsumerKeyCmd() *cobra.Command { func NewSubmitConsumerMisbehaviourCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "submit-consumer-misbehaviour [misbehaviour]", + Use: "submit-consumer-misbehaviour [consumer-id] [misbehaviour]", Short: "submit an IBC misbehaviour for a consumer chain", Long: strings.TrimSpace( fmt.Sprintf(`Submit an IBC misbehaviour detected on a consumer chain. @@ -92,9 +95,9 @@ An IBC misbehaviour contains two conflicting IBC client headers, which are used The misbehaviour type definition can be found in the IBC client messages, see ibc-go/proto/ibc/core/client/v1/tx.proto. Example: -%s tx provider submit-consumer-misbehaviour [path/to/misbehaviour.json] --from node0 --home ../node0 --chain-id $CID +%s tx provider submit-consumer-misbehaviour [consumer-id] [path/to/misbehaviour.json] --from node0 --home ../node0 --chain-id $CID `, version.AppName)), - Args: cobra.ExactArgs(1), + Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) if err != nil { @@ -120,7 +123,7 @@ Example: return fmt.Errorf("misbehaviour unmarshalling failed: %s", err) } - msg, err := types.NewMsgSubmitConsumerMisbehaviour(submitter, &misbehaviour) + msg, err := types.NewMsgSubmitConsumerMisbehaviour(args[0], submitter, &misbehaviour) if err != nil { return err } @@ -141,7 +144,7 @@ Example: func NewSubmitConsumerDoubleVotingCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "submit-consumer-double-voting [evidence] [infraction_header]", + Use: "submit-consumer-double-voting [consumer-id] [evidence] [infraction_header]", Short: "submit a double voting evidence for a consumer chain", Long: strings.TrimSpace( fmt.Sprintf(`Submit a Tendermint duplicate vote evidence detected on a consumer chain with @@ -151,9 +154,9 @@ func NewSubmitConsumerDoubleVotingCmd() *cobra.Command { definition can be found in the IBC messages, see ibc-go/proto/ibc/lightclients/tendermint/v1/tendermint.proto. Example: -%s tx provider submit-consumer-double-voting [path/to/evidence.json] [path/to/infraction_header.json] --from node0 --home ../node0 --chain-id $CID +%s tx provider submit-consumer-double-voting [consumer-id] [path/to/evidence.json] [path/to/infraction_header.json] --from node0 --home ../node0 --chain-id $CID `, version.AppName)), - Args: cobra.ExactArgs(2), + Args: cobra.ExactArgs(3), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) if err != nil { @@ -190,7 +193,246 @@ Example: return fmt.Errorf("infraction IBC header unmarshalling failed: %s", err) } - msg, err := types.NewMsgSubmitConsumerDoubleVoting(submitter, &ev, &header) + msg, err := types.NewMsgSubmitConsumerDoubleVoting(args[0], submitter, &ev, &header) + 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 NewCreateConsumerCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "create-consumer [consumer-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 [path/to/create_consumer.json] --from node0 --home ../node0 --chain-id $CID + +where create_consumer.json has the following structure: +{ + "chain_id": "consu", + "metadata": { + "name": "chain consumer", + "description": "description", + "metadata": "metadata" + }, + "initialization_parameters": { + "initial_height": { + "revision_number": 0, + "revision_height": 1 + }, + "genesis_hash": "Z2VuX2hhc2g=", + "binary_hash": "YmluX2hhc2g=", + "spawn_time": "2024-08-29T12:26:16.529913Z", + "unbonding_period": 1728000000000000, + "ccv_timeout_period": 2419200000000000, + "transfer_timeout_period": 1800000000000, + "consumer_redistribution_fraction": "0.75", + "blocks_per_distribution_transmission": 1000, + "historical_entries": 10000, + "distribution_transmission_channel": "" + }, + "power_shaping_parameters": { + "top_N": 100, + "validators_power_cap": 0, + "validator_set_cap": 0, + "allowlist": [], + "denylist": [], + "min_stake": "0", + "allow_inactive_vals": false + } +} + +Note that both 'chain_id' and 'metadata' are mandatory; +and both 'initialization_parameters' and 'power_shaping_parameters' are optional. +The parameters not provided are set to their zero value. +`, version.AppName)), + Args: cobra.ExactArgs(1), + 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) + + submitter := clientCtx.GetFromAddress().String() + + consCreateJson, err := os.ReadFile(args[0]) + if err != nil { + return err + } + consCreate := types.MsgCreateConsumer{} + if err = json.Unmarshal(consCreateJson, &consCreate); err != nil { + return fmt.Errorf("consumer data unmarshalling failed: %w", err) + } + + msg, err := types.NewMsgCreateConsumer(submitter, consCreate.ChainId, consCreate.Metadata, consCreate.InitializationParameters, consCreate.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-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 [path/to/update_consumer.json] --from node0 --home ../node0 --chain-id $CID + +where update_consumer.json has the following structure: +{ + "consumer_id": "0", + "new_owner_address": "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn", + "metadata": { + "name": "chain consumer", + "description": "description", + "metadata": "metadata" + }, + "initialization_parameters": { + "initial_height": { + "revision_number": 0, + "revision_height": 1 + }, + "genesis_hash": "Z2VuX2hhc2g=", + "binary_hash": "YmluX2hhc2g=", + "spawn_time": "2024-08-29T12:26:16.529913Z", + "unbonding_period": 1728000000000000, + "ccv_timeout_period": 2419200000000000, + "transfer_timeout_period": 1800000000000, + "consumer_redistribution_fraction": "0.75", + "blocks_per_distribution_transmission": 1000, + "historical_entries": 10000, + "distribution_transmission_channel": "" + }, + "power_shaping_parameters": { + "top_N": 100, + "validators_power_cap": 0, + "validator_set_cap": 0, + "allowlist": [], + "denylist": [], + "min_stake": "0", + "allow_inactive_vals": false + } +} + +Note that only 'consumer_id' is mandatory. The others are optional. +Not providing one of them will leave the existing values unchanged. +Providing one of 'metadata', 'initialization_parameters' or 'power_shaping_parameters', +will update all the containing fields. +If one of the fields is missing, it will be set to its zero value. +`, version.AppName)), + Args: cobra.ExactArgs(1), + 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) + + owner := clientCtx.GetFromAddress().String() + + consUpdateJson, err := os.ReadFile(args[0]) + if err != nil { + return err + } + + consUpdate := types.MsgUpdateConsumer{} + if err = json.Unmarshal(consUpdateJson, &consUpdate); err != nil { + return fmt.Errorf("consumer data unmarshalling failed: %w", err) + } + + if strings.TrimSpace(consUpdate.ConsumerId) == "" { + return fmt.Errorf("consumer_id can't be empty") + } + + msg, err := types.NewMsgUpdateConsumer(owner, consUpdate.ConsumerId, consUpdate.NewOwnerAddress, consUpdate.Metadata, consUpdate.InitializationParameters, consUpdate.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]", + 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. +Example: +%s tx provider remove-consumer [consumer-id] --from node0 --home ../node0 --chain-id $CID +`, version.AppName)), + Args: cobra.ExactArgs(1), + 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) + + owner := clientCtx.GetFromAddress().String() + consumerId := args[0] + + msg, err := types.NewMsgRemoveConsumer(owner, consumerId) if err != nil { return err } @@ -211,7 +453,7 @@ Example: func NewOptInCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "opt-in [consumer-chain-id] [consumer-pubkey]", + Use: "opt-in [consumer-id] [consumer-pubkey]", Short: "opts in validator to the consumer chain, and if given uses the " + "provided consensus public key for this consumer chain", Args: cobra.RangeArgs(1, 2), @@ -237,8 +479,8 @@ func NewOptInCmd() *cobra.Command { consumerPubKey = "" } - signer := clientCtx.GetFromAddress().String() - msg, err := types.NewMsgOptIn(args[0], sdk.ValAddress(providerValAddr), consumerPubKey, signer) + submitter := clientCtx.GetFromAddress().String() + msg, err := types.NewMsgOptIn(args[0], sdk.ValAddress(providerValAddr), consumerPubKey, submitter) if err != nil { return err } @@ -259,7 +501,7 @@ func NewOptInCmd() *cobra.Command { func NewOptOutCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "opt-out [consumer-chain-id]", + Use: "opt-out [consumer-id]", Short: "opts out validator from this consumer chain", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { @@ -276,8 +518,8 @@ func NewOptOutCmd() *cobra.Command { providerValAddr := clientCtx.GetFromAddress() - signer := clientCtx.GetFromAddress().String() - msg, err := types.NewMsgOptOut(args[0], sdk.ValAddress(providerValAddr), signer) + submitter := clientCtx.GetFromAddress().String() + msg, err := types.NewMsgOptOut(args[0], sdk.ValAddress(providerValAddr), submitter) if err != nil { return err } @@ -298,12 +540,12 @@ func NewOptOutCmd() *cobra.Command { func NewSetConsumerCommissionRateCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "set-consumer-commission-rate [consumer-chain-id] [commission-rate]", + Use: "set-consumer-commission-rate [consumer-id] [commission-rate]", Short: "set a per-consumer chain commission", Long: strings.TrimSpace( fmt.Sprintf(`Note that the "commission-rate" argument is a fraction and should be in the range [0,1]. Example: - %s set-consumer-commission-rate consumer-1 0.5 --from node0 --home ../node0`, + %s set-consumer-commission-rate 123 0.5 --from node0 --home ../node0`, version.AppName), ), Args: cobra.ExactArgs(2), @@ -325,8 +567,8 @@ func NewSetConsumerCommissionRateCmd() *cobra.Command { if err != nil { return err } - signer := clientCtx.GetFromAddress().String() - msg := types.NewMsgSetConsumerCommissionRate(args[0], commission, sdk.ValAddress(providerValAddr), signer) + submitter := clientCtx.GetFromAddress().String() + msg := types.NewMsgSetConsumerCommissionRate(args[0], commission, sdk.ValAddress(providerValAddr), submitter) if err := msg.ValidateBasic(); err != nil { return err } 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..e8fa15d4d2 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", providertypes.CONSUMER_PHASE_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", providertypes.CONSUMER_PHASE_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", providertypes.CONSUMER_PHASE_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", providertypes.CONSUMER_PHASE_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", providertypes.CONSUMER_PHASE_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", }, } @@ -183,8 +175,9 @@ func TestAssignConsensusKeyMsgHandling(t *testing.T) { k, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) tc.setup(ctx, k, mocks) + k.SetConsumerChainId(ctx, tc.consumerId, tc.name) - 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..0a06bf6091 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,7 @@ 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") // Instantiate valid params as default. Individual test cases mutate these as needed. params := params{ @@ -145,9 +145,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 +170,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 +309,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.SetConsumerClientId(ctx, "consumerChainID", "clientID") + providerModule := provider.NewAppModule(&providerKeeper, *keeperParams.ParamsSubspace, keeperParams.StoreKey) err := providerModule.OnChanOpenConfirm(ctx, "providerPortID", "channelID") @@ -320,11 +322,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..7bd7bac45c 100644 --- a/x/ccv/provider/keeper/consumer_equivocation.go +++ b/x/ccv/provider/keeper/consumer_equivocation.go @@ -28,56 +28,64 @@ 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 } k.Logger(ctx).Info( "confirmed equivocation", + "consumerId", consumerId, + "chainId", chainId, "byzantine validator address", providerAddr.String(), ) @@ -88,7 +96,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 +148,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 +164,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 +190,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) @@ -208,6 +216,7 @@ func (k Keeper) HandleConsumerMisbehaviour(ctx sdk.Context, misbehaviour ibctmty logger.Info( "confirmed equivocation light client attack", + "consumerId", consumerId, "byzantine validators slashed, jailed and tombstoned", provAddrs, ) @@ -292,16 +301,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 +334,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 +342,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 +536,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 +558,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/consumer_lifecycle.go b/x/ccv/provider/keeper/consumer_lifecycle.go new file mode 100644 index 0000000000..20014c3c35 --- /dev/null +++ b/x/ccv/provider/keeper/consumer_lifecycle.go @@ -0,0 +1,670 @@ +package keeper + +import ( + "fmt" + "time" + + tmtypes "github.com/cometbft/cometbft/types" + + errorsmod "cosmossdk.io/errors" + storetypes "cosmossdk.io/store/types" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + commitmenttypes "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types" + ibctmtypes "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" + + "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" +) + +// PrepareConsumerForLaunch prepares to move the launch of a consumer chain from the previous spawn time to spawn time. +// Previous spawn time can correspond to its zero value if the validator was not previously set for launch. +func (k Keeper) PrepareConsumerForLaunch(ctx sdk.Context, consumerId string, previousSpawnTime time.Time, spawnTime time.Time) error { + 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 previous spawn time + err := k.RemoveConsumerToBeLaunched(ctx, consumerId, previousSpawnTime) + if err != nil { + return err + } + } + return k.AppendConsumerToBeLaunched(ctx, consumerId, spawnTime) +} + +// InitializeConsumer tries to move a consumer with `consumerId` to the initialized phase. +// If successfull, it returns the spawn time and true. +func (k Keeper) InitializeConsumer(ctx sdk.Context, consumerId string) (time.Time, bool) { + // a chain needs to be in the registered or initialized phase + phase := k.GetConsumerPhase(ctx, consumerId) + if phase != types.CONSUMER_PHASE_REGISTERED && phase != types.CONSUMER_PHASE_INITIALIZED { + return time.Time{}, false + } + + initializationParameters, err := k.GetConsumerInitializationParameters(ctx, consumerId) + if err != nil { + return time.Time{}, false + } + + // the spawn time needs to be positive + if initializationParameters.SpawnTime.IsZero() { + return time.Time{}, false + } + + k.SetConsumerPhase(ctx, consumerId, types.CONSUMER_PHASE_INITIALIZED) + + return initializationParameters.SpawnTime, true +} + +// BeginBlockLaunchConsumers launches initialized consumers that are ready to launch +func (k Keeper) BeginBlockLaunchConsumers(ctx sdk.Context) { + // TODO (PERMISSIONLESS): we can parameterize the limit + for _, consumerId := range k.GetConsumersReadyToLaunch(ctx, 200) { + initializationParameters, err := k.GetConsumerInitializationParameters(ctx, consumerId) + if err != nil { + 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. + err = k.RemoveConsumerToBeLaunched(ctx, consumerId, initializationParameters.SpawnTime) + if err != nil { + ctx.Logger().Error("could not remove consumer from to-be-launched queue", + "consumerId", consumerId, + "error", err) + continue + } + + cachedCtx, writeFn := ctx.CacheContext() + err = k.LaunchConsumer(cachedCtx, consumerId) + if err != nil { + ctx.Logger().Error("could not launch chain", + "consumerId", consumerId, + "error", err) + continue + } + + // the cached context is created with a new EventManager, so we merge the events into the original context + ctx.EventManager().EmitEvents(cachedCtx.EventManager().Events()) + writeFn() + } +} + +// GetConsumersReadyToLaunch 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) GetConsumersReadyToLaunch(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(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 for consumer id: %s", consumerId) + } + + if len(consumerGenesis.Provider.InitialValSet) == 0 { + return errorsmod.Wrapf(types.ErrInvalidConsumerGenesis, "consumer genesis initial validator set is empty - no validators opted in consumer id: %s", consumerId) + } + + k.SetConsumerPhase(ctx, consumerId, types.CONSUMER_PHASE_LAUNCHED) + + return nil +} + +// 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 + } + + phase := k.GetConsumerPhase(ctx, consumerId) + if phase != types.CONSUMER_PHASE_INITIALIZED { + return errorsmod.Wrapf(types.ErrInvalidPhase, + "cannot create client for consumer chain that is not in the Initialized phase but in phase %d: %s", phase, consumerId) + } + + chainId, err := k.GetConsumerChainId(ctx, consumerId) + if err != nil { + return err + } + + // Set minimum height for equivocation evidence from this consumer chain + k.SetEquivocationEvidenceMinHeight(ctx, consumerId, initializationRecord.InitialHeight.RevisionHeight) + + // Consumers start out with the unbonding period from the consumer addition prop + 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 = initializationRecord.InitialHeight + + trustPeriod, err := ccv.CalculateTrustPeriod(consumerUnbondingPeriod, k.GetTrustingPeriodFraction(ctx)) + if err != nil { + return err + } + clientState.TrustingPeriod = trustPeriod + clientState.UnbondingPeriod = consumerUnbondingPeriod + + consumerGen, validatorSetHash, err := k.MakeConsumerGenesis(ctx, consumerId) + if err != nil { + return err + } + err = k.SetConsumerGenesis(ctx, consumerId, consumerGen) + if err != nil { + return err + } + + // Create consensus state + consensusState := ibctmtypes.NewConsensusState( + ctx.BlockTime(), + commitmenttypes.NewMerkleRoot([]byte(ibctmtypes.SentinelRoot)), + validatorSetHash, // use the hash of the updated initial valset + ) + + clientID, err := k.clientKeeper.CreateClient(ctx, clientState, consensusState) + if err != nil { + return err + } + k.SetConsumerClientId(ctx, consumerId, clientID) + + k.Logger(ctx).Info("consumer chain launched (client created)", + "consumer id", consumerId, + "client id", clientID, + ) + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeConsumerClientCreated, + sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), + sdk.NewAttribute(types.AttributeConsumerId, consumerId), + sdk.NewAttribute(types.AttributeConsumerChainId, chainId), + sdk.NewAttribute(clienttypes.AttributeKeyClientID, clientID), + sdk.NewAttribute(types.AttributeInitialHeight, initializationRecord.InitialHeight.String()), + sdk.NewAttribute(types.AttributeTrustingPeriod, clientState.TrustingPeriod.String()), + sdk.NewAttribute(types.AttributeUnbondingPeriod, clientState.UnbondingPeriod.String()), + ), + ) + + return nil +} + +// 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, + consumerId string, +) (gen ccv.ConsumerGenesisState, nextValidatorsHash []byte, err error) { + initializationRecord, err := k.GetConsumerInitializationParameters(ctx, consumerId) + if err != nil { + return gen, nil, errorsmod.Wrapf(ccv.ErrInvalidConsumerState, + "cannot retrieve initialization parameters: %s", err.Error()) + } + powerShapingParameters, err := k.GetConsumerPowerShapingParameters(ctx, consumerId) + if err != nil { + return gen, nil, errorsmod.Wrapf(ccv.ErrInvalidConsumerState, + "cannot retrieve power shaping parameters: %s", err.Error()) + } + + providerUnbondingPeriod, err := k.stakingKeeper.UnbondingTime(ctx) + if err != nil { + return gen, nil, errorsmod.Wrapf(types.ErrNoUnbondingTime, "unbonding time not found: %s", err) + } + height := clienttypes.GetSelfHeight(ctx) + + clientState := k.GetTemplateClient(ctx) + // this is the counter party chain ID for the consumer + clientState.ChainId = ctx.ChainID() + // this is the latest height the client was updated at, i.e., + // the height of the latest consensus state (see below) + clientState.LatestHeight = height + trustPeriod, err := ccv.CalculateTrustPeriod(providerUnbondingPeriod, k.GetTrustingPeriodFraction(ctx)) + if err != nil { + return gen, nil, errorsmod.Wrapf(sdkerrors.ErrInvalidHeight, "error %s calculating trusting_period for: %s", err, height) + } + clientState.TrustingPeriod = trustPeriod + clientState.UnbondingPeriod = providerUnbondingPeriod + + consState, err := k.clientKeeper.GetSelfConsensusState(ctx, height) + if err != nil { + return gen, nil, errorsmod.Wrapf(clienttypes.ErrConsensusStateNotFound, "error %s getting self consensus state for: %s", err, height) + } + + // get the bonded validators from the staking module + bondedValidators, err := k.GetLastBondedValidators(ctx) + if err != nil { + return gen, nil, errorsmod.Wrapf(stakingtypes.ErrNoValidatorFound, "error getting last bonded validators: %s", err) + } + + minPower := int64(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 + // otherwise, it could be that inactive validators are forced to validate + activeValidators, err := k.GetLastProviderConsensusActiveValidators(ctx) + if err != nil { + return gen, nil, errorsmod.Wrapf(stakingtypes.ErrNoValidatorFound, "error getting last active bonded validators: %s", err) + } + + // in a Top-N chain, we automatically opt in all validators that belong to the 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", + "consumerId", consumerId, + "minPower", 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, consumerId, bondedValidators, powerShapingParameters, minPower) + k.SetConsumerValSet(ctx, consumerId, nextValidators) + + // get the initial updates with the latest set consumer public keys + initialUpdatesWithConsumerKeys := DiffValidators([]types.ConsensusValidator{}, nextValidators) + + // Get a hash of the consumer validator set from the update with applied consumer assigned keys + updatesAsValSet, err := tmtypes.PB2TM.ValidatorUpdates(initialUpdatesWithConsumerKeys) + if err != nil { + return gen, nil, fmt.Errorf("unable to create validator set from updates computed from key assignment in MakeConsumerGenesis: %s", err) + } + hash := tmtypes.NewValidatorSet(updatesAsValSet).Hash() + + consumerGenesisParams := ccv.NewParams( + true, + initializationRecord.BlocksPerDistributionTransmission, + initializationRecord.DistributionTransmissionChannel, + "", // providerFeePoolAddrStr, + initializationRecord.CcvTimeoutPeriod, + initializationRecord.TransferTimeoutPeriod, + initializationRecord.ConsumerRedistributionFraction, + initializationRecord.HistoricalEntries, + initializationRecord.UnbondingPeriod, + []string{}, + []string{}, + ccv.DefaultRetryDelayPeriod, + ) + + gen = *ccv.NewInitialConsumerGenesisState( + clientState, + consState.(*ibctmtypes.ConsensusState), + initialUpdatesWithConsumerKeys, + consumerGenesisParams, + ) + return gen, hash, nil +} + +// StopAndPrepareForConsumerRemoval sets the phase of the chain to stopped and prepares to get the state of the +// chain removed after unbonding period elapses +func (k Keeper) StopAndPrepareForConsumerRemoval(ctx sdk.Context, consumerId string) error { + // The phase of the chain is immediately set to stopped, albeit its state is removed later (see below). + // Setting the phase here helps in not considering this chain when we look at launched chains (e.g., in `QueueVSCPackets) + k.SetConsumerPhase(ctx, consumerId, types.CONSUMER_PHASE_STOPPED) + + // state of this chain is removed once UnbondingPeriod elapses + unbondingPeriod, err := k.stakingKeeper.UnbondingTime(ctx) + if err != nil { + return err + } + removalTime := ctx.BlockTime().Add(unbondingPeriod) + + if err := k.SetConsumerRemovalTime(ctx, consumerId, removalTime); err != nil { + return fmt.Errorf("cannot set removal time (%s): %s", removalTime.String(), err.Error()) + } + if err := k.AppendConsumerToBeRemoved(ctx, consumerId, removalTime); err != nil { + return errorsmod.Wrapf(ccv.ErrInvalidConsumerState, "cannot set consumer to be removed: %s", err.Error()) + } + + return nil +} + +// BeginBlockRemoveConsumers iterates over the pending consumer proposals and stop/removes the chain if the removal time has passed +func (k Keeper) BeginBlockRemoveConsumers(ctx sdk.Context) { + // TODO (PERMISSIONLESS): parameterize the limit + for _, consumerId := range k.GetConsumersReadyToStop(ctx, 200) { + removalTime, err := k.GetConsumerRemovalTime(ctx, consumerId) + if err != nil { + k.Logger(ctx).Error("chain could not be stopped", + "consumerId", consumerId, + "error", err.Error()) + continue + } + + // Remove consumer to prevent re-trying removing this chain. + err = k.RemoveConsumerToBeRemoved(ctx, consumerId, removalTime) + if err != nil { + ctx.Logger().Error("could not remove consumer from to-be-removed queue", + "consumerId", consumerId, + "error", err) + continue + } + + // delete consumer chain in a cached context to abort deletion in case of errors + cachedCtx, writeFn := ctx.CacheContext() + err = k.DeleteConsumerChain(cachedCtx, consumerId) + if err != nil { + k.Logger(ctx).Error("consumer chain could not be removed", + "consumerId", consumerId, + "error", err.Error()) + continue + } + + // The cached context is created with a new EventManager so we merge the event into the original context + ctx.EventManager().EmitEvents(cachedCtx.EventManager().Events()) + + writeFn() + + k.Logger(ctx).Info("executed consumer deletion", + "consumer id", consumerId, + "removal time", removalTime, + ) + } +} + +// GetConsumersReadyToStop returns the consumer ids of the pending launched consumer chains +// that are ready to stop +func (k Keeper) GetConsumersReadyToStop(ctx sdk.Context, limit uint32) []string { + store := ctx.KVStore(k.storeKey) + + removalTimeToConsumerIdsKeyPrefix := types.RemovalTimeToConsumerIdsKeyPrefix() + iterator := storetypes.KVStorePrefixIterator(store, []byte{removalTimeToConsumerIdsKeyPrefix}) + defer iterator.Close() + + result := []string{} + for ; iterator.Valid(); iterator.Next() { + removalTime, err := types.ParseTime(removalTimeToConsumerIdsKeyPrefix, iterator.Key()) + if err != nil { + k.Logger(ctx).Error("failed to parse removal time", + "error", err) + continue + } + if removalTime.After(ctx.BlockTime()) { + return result + } + + consumers, err := k.GetConsumersToBeRemoved(ctx, removalTime) + if err != nil { + k.Logger(ctx).Error("failed to retrieve consumers to remove", + "removal time", removalTime, + "error", err) + continue + } + if len(result)+len(consumers.Ids) >= int(limit) { + remainingConsumerIds := len(result) + len(consumers.Ids) - int(limit) + if len(consumers.Ids[:len(consumers.Ids)-remainingConsumerIds]) == 0 { + return result + } + return append(result, consumers.Ids[:len(consumers.Ids)-remainingConsumerIds]...) + } else { + result = append(result, consumers.Ids...) + } + } + + return result +} + +// DeleteConsumerChain cleans up the state of the given consumer chain +func (k Keeper) DeleteConsumerChain(ctx sdk.Context, consumerId string) (err error) { + phase := k.GetConsumerPhase(ctx, consumerId) + if phase != types.CONSUMER_PHASE_STOPPED { + return fmt.Errorf("cannot delete non-stopped chain: %s", consumerId) + } + + // clean up states + k.DeleteConsumerClientId(ctx, consumerId) + k.DeleteConsumerGenesis(ctx, consumerId) + // Note: this call panics if the key assignment state is invalid + 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.GetConsumerIdToChannelId(ctx, consumerId); found { + // Close the channel for the given channel ID on the condition + // that the channel exists and isn't already in the CLOSED state + channel, found := k.channelKeeper.GetChannel(ctx, ccv.ProviderPortID, channelID) + if found && channel.State != channeltypes.CLOSED { + err := k.chanCloseInit(ctx, channelID) + if err != nil { + k.Logger(ctx).Error("channel to consumer chain could not be closed", + "consumerId", consumerId, + "channelID", channelID, + "error", err.Error(), + ) + } + } + k.DeleteConsumerIdToChannelId(ctx, consumerId) + k.DeleteChannelIdToConsumerId(ctx, channelID) + } + + // delete consumer commission rate + provAddrs := k.GetAllCommissionRateValidators(ctx, consumerId) + for _, addr := range provAddrs { + k.DeleteConsumerCommissionRate(ctx, consumerId, addr) + } + + k.DeleteInitChainHeight(ctx, consumerId) + k.DeleteSlashAcks(ctx, consumerId) + k.DeletePendingVSCPackets(ctx, consumerId) + + k.DeleteAllowlist(ctx, consumerId) + k.DeleteDenylist(ctx, consumerId) + k.DeleteAllOptedIn(ctx, consumerId) + k.DeleteConsumerValSet(ctx, consumerId) + + k.DeleteConsumerRewardsAllocation(ctx, consumerId) + k.DeleteConsumerRemovalTime(ctx, consumerId) + + // TODO (PERMISSIONLESS) add newly-added state to be deleted + // Note that we do not delete ConsumerIdToChainIdKey and ConsumerIdToPhase, as well + // as consumer metadata, initialization and power-shaping parameters. + + k.SetConsumerPhase(ctx, consumerId, types.CONSUMER_PHASE_DELETED) + k.Logger(ctx).Info("consumer chain deleted from provider", "consumerId", consumerId) + + return nil +} + +// +// Setters and Getters +// + +// GetConsumerRemovalTime returns the removal time associated with the to-be-removed chain with consumer id +func (k Keeper) GetConsumerRemovalTime(ctx sdk.Context, consumerId string) (time.Time, error) { + store := ctx.KVStore(k.storeKey) + buf := store.Get(types.ConsumerIdToRemovalTimeKey(consumerId)) + if buf == nil { + return time.Time{}, fmt.Errorf("failed to retrieve removal time for consumer id (%s)", consumerId) + } + var time time.Time + if err := time.UnmarshalBinary(buf); err != nil { + return time, fmt.Errorf("failed to unmarshal removal time for consumer id (%s): %w", consumerId, err) + } + return time, nil +} + +// SetConsumerRemovalTime sets the removal time associated with this consumer id +func (k Keeper) SetConsumerRemovalTime(ctx sdk.Context, consumerId string, removalTime time.Time) error { + store := ctx.KVStore(k.storeKey) + buf, err := removalTime.MarshalBinary() + if err != nil { + return fmt.Errorf("failed to marshal removal time (%+v) for consumer id (%s): %w", removalTime, consumerId, err) + } + store.Set(types.ConsumerIdToRemovalTimeKey(consumerId), buf) + return nil +} + +// DeleteConsumerRemovalTime deletes the removal time associated with this consumer id +func (k Keeper) DeleteConsumerRemovalTime(ctx sdk.Context, consumerId string) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.ConsumerIdToRemovalTimeKey(consumerId)) +} + +// getConsumerIdsBasedOnTime returns all the consumer ids stored under this specific `key(time)` +func (k Keeper) getConsumerIdsBasedOnTime(ctx sdk.Context, key func(time.Time) []byte, time time.Time) (types.ConsumerIds, error) { + store := ctx.KVStore(k.storeKey) + bz := store.Get(key(time)) + 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 +} + +// appendConsumerIdOnTime appends the consumer id on all the other consumer ids under `key(time)` +func (k Keeper) appendConsumerIdOnTime(ctx sdk.Context, consumerId string, key func(time.Time) []byte, time time.Time) error { + store := ctx.KVStore(k.storeKey) + + consumers, err := k.getConsumerIdsBasedOnTime(ctx, key, time) + if err != nil { + return err + } + + consumersWithAppend := types.ConsumerIds{ + Ids: append(consumers.Ids, consumerId), + } + + bz, err := consumersWithAppend.Marshal() + if err != nil { + return err + } + + store.Set(key(time), bz) + return nil +} + +// removeConsumerIdFromTime removes consumer id stored under `key(time)` +func (k Keeper) removeConsumerIdFromTime(ctx sdk.Context, consumerId string, key func(time.Time) []byte, time time.Time) error { + store := ctx.KVStore(k.storeKey) + + consumers, err := k.getConsumerIdsBasedOnTime(ctx, key, time) + if err != nil { + return err + } + + if len(consumers.Ids) == 0 { + return fmt.Errorf("no consumer ids found for this time: %s", time.String()) + } + + // find the index of the consumer we want to remove + index := -1 + for i := 0; i < len(consumers.Ids); i = i + 1 { + if consumers.Ids[i] == consumerId { + index = i + break + } + } + + if index == -1 { + return fmt.Errorf("failed to find consumer id (%s)", consumerId) + } + + if len(consumers.Ids) == 1 { + store.Delete(key(time)) + return nil + } + + consumersWithRemoval := types.ConsumerIds{ + Ids: append(consumers.Ids[:index], consumers.Ids[index+1:]...), + } + + bz, err := consumersWithRemoval.Marshal() + if err != nil { + return err + } + + store.Set(key(time), bz) + return nil +} + +// GetConsumersToBeLaunched returns all the consumer ids of chains stored under this spawn time +func (k Keeper) GetConsumersToBeLaunched(ctx sdk.Context, spawnTime time.Time) (types.ConsumerIds, error) { + return k.getConsumerIdsBasedOnTime(ctx, types.SpawnTimeToConsumerIdsKey, spawnTime) +} + +// AppendConsumerToBeLaunched appends the provider consumer id for the given spawn time +func (k Keeper) AppendConsumerToBeLaunched(ctx sdk.Context, consumerId string, spawnTime time.Time) error { + return k.appendConsumerIdOnTime(ctx, consumerId, types.SpawnTimeToConsumerIdsKey, spawnTime) +} + +// RemoveConsumerToBeLaunched removes consumer id from if stored for this specific spawn time +func (k Keeper) RemoveConsumerToBeLaunched(ctx sdk.Context, consumerId string, spawnTime time.Time) error { + return k.removeConsumerIdFromTime(ctx, consumerId, types.SpawnTimeToConsumerIdsKey, spawnTime) +} + +// GetConsumersToBeRemoved returns all the consumer ids of chains stored under this removal time +func (k Keeper) GetConsumersToBeRemoved(ctx sdk.Context, removalTime time.Time) (types.ConsumerIds, error) { + return k.getConsumerIdsBasedOnTime(ctx, types.RemovalTimeToConsumerIdsKey, removalTime) +} + +// AppendConsumerToBeRemoved appends the provider consumer id for the given removal time +func (k Keeper) AppendConsumerToBeRemoved(ctx sdk.Context, consumerId string, removalTime time.Time) error { + return k.appendConsumerIdOnTime(ctx, consumerId, types.RemovalTimeToConsumerIdsKey, removalTime) +} + +// RemoveConsumerToBeRemoved removes consumer id from the given removal time +func (k Keeper) RemoveConsumerToBeRemoved(ctx sdk.Context, consumerId string, removalTime time.Time) error { + return k.removeConsumerIdFromTime(ctx, consumerId, types.RemovalTimeToConsumerIdsKey, removalTime) +} diff --git a/x/ccv/provider/keeper/consumer_lifecycle_test.go b/x/ccv/provider/keeper/consumer_lifecycle_test.go new file mode 100644 index 0000000000..76d654c0c3 --- /dev/null +++ b/x/ccv/provider/keeper/consumer_lifecycle_test.go @@ -0,0 +1,1012 @@ +package keeper_test + +import ( + "encoding/json" + "fmt" + "testing" + "time" + + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + + abci "github.com/cometbft/cometbft/abci/types" + + "cosmossdk.io/math" + + sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + ibctmtypes "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" + _go "github.com/cosmos/ics23/go" + + 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" + ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" +) + +func TestPrepareConsumerForLaunch(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + spawnTime := time.Now().UTC() + err := providerKeeper.PrepareConsumerForLaunch(ctx, "consumerId", time.Time{}, spawnTime) + require.NoError(t, err) + + consumers, err := providerKeeper.GetConsumersToBeLaunched(ctx, spawnTime) + require.NoError(t, err) + require.Equal(t, providertypes.ConsumerIds{Ids: []string{"consumerId"}}, consumers) + + nextSpawnTime := spawnTime.Add(time.Hour) + err = providerKeeper.PrepareConsumerForLaunch(ctx, "consumerId", spawnTime, nextSpawnTime) + require.NoError(t, err) + + consumers, err = providerKeeper.GetConsumersToBeLaunched(ctx, spawnTime) + require.NoError(t, err) + require.Empty(t, consumers) + + consumers, err = providerKeeper.GetConsumersToBeLaunched(ctx, nextSpawnTime) + require.NoError(t, err) + require.Equal(t, providertypes.ConsumerIds{Ids: []string{"consumerId"}}, consumers) +} + +func TestInitializeConsumer(t *testing.T) { + now := time.Now().UTC() + consumerId := "13" + + testCases := []struct { + name string + spawnTime time.Time + setup func(*providerkeeper.Keeper, sdk.Context, time.Time) + expInitialized bool + }{ + { + name: "valid", + spawnTime: now, + setup: func(pk *providerkeeper.Keeper, ctx sdk.Context, spawnTime time.Time) { + pk.SetConsumerPhase(ctx, consumerId, providertypes.CONSUMER_PHASE_REGISTERED) + err := pk.SetConsumerInitializationParameters(ctx, consumerId, + providertypes.ConsumerInitializationParameters{ + SpawnTime: spawnTime, + }) + require.NoError(t, err) + }, + expInitialized: true, + }, + { + name: "invalid: no phase", + spawnTime: now, + setup: func(pk *providerkeeper.Keeper, ctx sdk.Context, spawnTime time.Time) { + }, + expInitialized: false, + }, + { + name: "invalid: wrong phase", + spawnTime: now, + setup: func(pk *providerkeeper.Keeper, ctx sdk.Context, spawnTime time.Time) { + pk.SetConsumerPhase(ctx, consumerId, providertypes.CONSUMER_PHASE_LAUNCHED) + err := pk.SetConsumerInitializationParameters(ctx, consumerId, + providertypes.ConsumerInitializationParameters{ + SpawnTime: spawnTime, + }) + require.NoError(t, err) + }, + expInitialized: false, + }, + { + name: "invalid: no init params", + spawnTime: now, + setup: func(pk *providerkeeper.Keeper, ctx sdk.Context, spawnTime time.Time) { + pk.SetConsumerPhase(ctx, consumerId, providertypes.CONSUMER_PHASE_REGISTERED) + }, + expInitialized: false, + }, + { + name: "invalid: zero spawn time", + spawnTime: now, + setup: func(pk *providerkeeper.Keeper, ctx sdk.Context, spawnTime time.Time) { + pk.SetConsumerPhase(ctx, consumerId, providertypes.CONSUMER_PHASE_REGISTERED) + err := pk.SetConsumerInitializationParameters(ctx, consumerId, + providertypes.ConsumerInitializationParameters{ + SpawnTime: time.Time{}, + }) + require.NoError(t, err) + }, + expInitialized: false, + }, + } + + for _, tc := range testCases { + pk, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + tc.setup(&pk, ctx, tc.spawnTime) + + spawnTime, initialized := pk.InitializeConsumer(ctx, consumerId) + require.Equal(t, tc.expInitialized, initialized, tc.name) + if initialized { + require.Equal(t, tc.spawnTime, spawnTime, tc.name) + require.Equal(t, providertypes.CONSUMER_PHASE_INITIALIZED, pk.GetConsumerPhase(ctx, consumerId)) + } + } +} + +// TestBeginBlockInit directly tests BeginBlockLaunchConsumers against the spec using helpers defined above. +func TestBeginBlockLaunchConsumers(t *testing.T) { + now := time.Now().UTC() + + keeperParams := testkeeper.NewInMemKeeperParams(t) + providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, keeperParams) + providerKeeper.SetParams(ctx, providertypes.DefaultParams()) + defer ctrl.Finish() + ctx = ctx.WithBlockTime(now) + + // 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, "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 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...) + + // 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 { + err := providerKeeper.SetConsumerInitializationParameters(ctx, fmt.Sprintf("%d", i), r) + require.NoError(t, err) + // set up the chains in their initialized phase, hence they could launch + providerKeeper.SetConsumerPhase(ctx, fmt.Sprintf("%d", i), providertypes.CONSUMER_PHASE_INITIALIZED) + err = providerKeeper.AppendConsumerToBeLaunched(ctx, fmt.Sprintf("%d", i), r.SpawnTime) + require.NoError(t, err) + } + for i, r := range powerShapingParameters { + err := providerKeeper.SetConsumerPowerShapingParameters(ctx, fmt.Sprintf("%d", i), r) + require.NoError(t, err) + } + + // opt in a sample validator so the chain's proposal can successfully execute + validator := cryptotestutil.NewCryptoIdentityFromIntSeed(0).SDKStakingValidator() + consAddr, _ := validator.GetConsAddr() + testkeeper.SetupMocksForLastBondedValidatorsExpectation(mocks.MockStakingKeeper, 1, []stakingtypes.Validator{validator}, -1) // -1 to allow any number of calls + + 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, "3", providertypes.NewProviderConsAddress(consAddr)) + + providerKeeper.BeginBlockLaunchConsumers(ctx) + + // first chain was successfully launched + phase := providerKeeper.GetConsumerPhase(ctx, "0") + require.Equal(t, providertypes.CONSUMER_PHASE_LAUNCHED, phase) + _, found := providerKeeper.GetConsumerGenesis(ctx, "0") + require.True(t, found) + + // second chain was successfully launched + phase = providerKeeper.GetConsumerPhase(ctx, "1") + require.Equal(t, providertypes.CONSUMER_PHASE_LAUNCHED, phase) + _, found = providerKeeper.GetConsumerGenesis(ctx, "1") + require.True(t, found) + + // third chain was not launched because its spawn time has not passed + phase = providerKeeper.GetConsumerPhase(ctx, "2") + require.Equal(t, providertypes.CONSUMER_PHASE_INITIALIZED, phase) + _, found = providerKeeper.GetConsumerGenesis(ctx, "2") + require.False(t, found) + + // fourth chain corresponds to an Opt-In chain with one opted-in validator and hence the chain gets + // successfully executed + phase = providerKeeper.GetConsumerPhase(ctx, "3") + require.Equal(t, providertypes.CONSUMER_PHASE_LAUNCHED, phase) + _, found = providerKeeper.GetConsumerGenesis(ctx, "3") + require.True(t, found) + + // fifth chain corresponds to an Opt-In chain with no opted-in validators and hence the + // chain launch is NOT successful + phase = providerKeeper.GetConsumerPhase(ctx, "4") + require.Equal(t, providertypes.CONSUMER_PHASE_INITIALIZED, phase) + _, found = providerKeeper.GetConsumerGenesis(ctx, "4") + require.False(t, found) +} + +// TestGetConsumersReadyToLaunch tests that the ready to-be-launched consumer chains are returned +func TestGetConsumersReadyToLaunch(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.GetConsumersReadyToLaunch(ctx, 5)) + + err := providerKeeper.AppendConsumerToBeLaunched(ctx, "consumerId1", time.Unix(10, 0)) + require.NoError(t, err) + err = providerKeeper.AppendConsumerToBeLaunched(ctx, "consumerId2", time.Unix(20, 0)) + require.NoError(t, err) + err = providerKeeper.AppendConsumerToBeLaunched(ctx, "consumerId3", time.Unix(30, 0)) + require.NoError(t, err) + + // time has not yet reached the spawn time of "consumerId1" + ctx = ctx.WithBlockTime(time.Unix(9, 999999999)) + require.Empty(t, providerKeeper.GetConsumersReadyToLaunch(ctx, 3)) + + // time has reached the spawn time of "consumerId1" + ctx = ctx.WithBlockTime(time.Unix(10, 0)) + require.Equal(t, []string{"consumerId1"}, providerKeeper.GetConsumersReadyToLaunch(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.GetConsumersReadyToLaunch(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.GetConsumersReadyToLaunch(ctx, 3)) + + // limit the number of returned consumer chains + require.Equal(t, []string{}, providerKeeper.GetConsumersReadyToLaunch(ctx, 0)) + require.Equal(t, []string{"consumerId1"}, providerKeeper.GetConsumersReadyToLaunch(ctx, 1)) + require.Equal(t, []string{"consumerId1", "consumerId2"}, providerKeeper.GetConsumersReadyToLaunch(ctx, 2)) +} + +// Tests the CreateConsumerClient method against the spec, +// with more granularity than what's covered in TestHandleCreateConsumerChainProposal. +func TestCreateConsumerClient(t *testing.T) { + type testCase struct { + description string + // Any state-mutating setup on keeper and expected mock calls, specific to this test case + setup func(*providerkeeper.Keeper, sdk.Context, *testkeeper.MockedKeepers) + // Whether a client should be created + expClientCreated bool + } + tests := []testCase{ + { + description: "No state mutation, new client should be created", + setup: func(providerKeeper *providerkeeper.Keeper, ctx sdk.Context, mocks *testkeeper.MockedKeepers) { + providerKeeper.SetConsumerPhase(ctx, "0", providertypes.CONSUMER_PHASE_INITIALIZED) + + // Valid client creation is asserted with mock expectations here + testkeeper.SetupMocksForLastBondedValidatorsExpectation(mocks.MockStakingKeeper, 0, []stakingtypes.Validator{}, 1) // returns empty validator set + gomock.InOrder( + testkeeper.GetMocksForCreateConsumerClient(ctx, mocks, "chainID", clienttypes.NewHeight(4, 5))..., + ) + }, + expClientCreated: true, + }, + { + 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.SetConsumerPhase(ctx, "0", providertypes.CONSUMER_PHASE_LAUNCHED) + + // Expect none of the client creation related calls to happen + mocks.MockStakingKeeper.EXPECT().UnbondingTime(gomock.Any()).Times(0) + mocks.MockClientKeeper.EXPECT().CreateClient(gomock.Any(), gomock.Any(), gomock.Any()).Times(0) + mocks.MockClientKeeper.EXPECT().GetSelfConsensusState(gomock.Any(), gomock.Any()).Times(0) + testkeeper.SetupMocksForLastBondedValidatorsExpectation(mocks.MockStakingKeeper, 0, []stakingtypes.Validator{}, 0) // returns empty validator set + }, + expClientCreated: false, + }, + } + + for _, tc := range tests { + // Common setup + keeperParams := testkeeper.NewInMemKeeperParams(t) + providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, keeperParams) + providerKeeper.SetParams(ctx, providertypes.DefaultParams()) + + // Test specific setup + tc.setup(&providerKeeper, ctx, &mocks) + + // Call method with same arbitrary values as defined above in mock expectations. + providerKeeper.SetConsumerChainId(ctx, "0", "chainID") + err := providerKeeper.SetConsumerMetadata(ctx, "0", testkeeper.GetTestConsumerMetadata()) + require.NoError(t, err) + err = providerKeeper.SetConsumerInitializationParameters(ctx, "0", testkeeper.GetTestInitializationParameters()) + require.NoError(t, err) + err = providerKeeper.SetConsumerPowerShapingParameters(ctx, "0", testkeeper.GetTestPowerShapingParameters()) + require.NoError(t, err) + + err = providerKeeper.CreateConsumerClient(ctx, "0") + if tc.expClientCreated { + require.NoError(t, err) + testCreatedConsumerClient(t, ctx, providerKeeper, "0", "clientID") + } else { + require.Error(t, err) + } + + // Assert mock calls from setup functions + ctrl.Finish() + } +} + +// Executes test assertions for a created consumer client. +// +// Note: Separated from TestCreateConsumerClient to also be called from TestCreateConsumerChainProposal. +func testCreatedConsumerClient(t *testing.T, + ctx sdk.Context, providerKeeper providerkeeper.Keeper, consumerId, expectedClientID string, +) { + t.Helper() + // ClientID should be stored. + 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, consumerId) + require.True(t, ok) +} + +// TestMakeConsumerGenesis tests the MakeConsumerGenesis keeper method. +// An expected genesis state is hardcoded in json, unmarshaled, and compared +// against an actual consumer genesis state constructed by a provider keeper. +func TestMakeConsumerGenesis(t *testing.T) { + keeperParams := testkeeper.NewInMemKeeperParams(t) + providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, keeperParams) + moduleParams := providertypes.Params{ + TemplateClient: &ibctmtypes.ClientState{ + TrustLevel: ibctmtypes.DefaultTrustLevel, + MaxClockDrift: 10000000000, + ProofSpecs: []*_go.ProofSpec{ + { + LeafSpec: &_go.LeafOp{ + Hash: _go.HashOp_SHA256, + PrehashKey: _go.HashOp_NO_HASH, + PrehashValue: _go.HashOp_SHA256, + Length: _go.LengthOp_VAR_PROTO, + Prefix: []byte{0x00}, + }, + InnerSpec: &_go.InnerSpec{ + ChildOrder: []int32{0, 1}, + ChildSize: 33, + MinPrefixLength: 4, + MaxPrefixLength: 12, + Hash: _go.HashOp_SHA256, + }, + MaxDepth: 0, + MinDepth: 0, + }, + { + LeafSpec: &_go.LeafOp{ + Hash: _go.HashOp_SHA256, + PrehashKey: _go.HashOp_NO_HASH, + PrehashValue: _go.HashOp_SHA256, + Length: _go.LengthOp_VAR_PROTO, + Prefix: []byte{0x00}, + }, + InnerSpec: &_go.InnerSpec{ + ChildOrder: []int32{0, 1}, + ChildSize: 32, + MinPrefixLength: 1, + MaxPrefixLength: 1, + Hash: _go.HashOp_SHA256, + }, + MaxDepth: 0, + }, + }, + UpgradePath: []string{"upgrade", "upgradedIBCState"}, + AllowUpdateAfterExpiry: true, + AllowUpdateAfterMisbehaviour: true, + }, + // Note these are unused provider parameters for this test, and not actually asserted against + // They must be populated with reasonable values to satisfy SetParams though. + TrustingPeriodFraction: providertypes.DefaultTrustingPeriodFraction, + CcvTimeoutPeriod: ccvtypes.DefaultCCVTimeoutPeriod, + SlashMeterReplenishPeriod: providertypes.DefaultSlashMeterReplenishPeriod, + SlashMeterReplenishFraction: providertypes.DefaultSlashMeterReplenishFraction, + ConsumerRewardDenomRegistrationFee: sdk.Coin{ + Denom: "stake", + Amount: math.NewInt(1000000), + }, + BlocksPerEpoch: 600, + NumberOfEpochsToStartReceivingRewards: 24, + } + providerKeeper.SetParams(ctx, moduleParams) + defer ctrl.Finish() + + // + // Other setup not covered by custom template client state + // + 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 + 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: ccvTimeoutPeriod, + TransferTimeoutPeriod: transferTimeoutPeriod, + ConsumerRedistributionFraction: "0.75", + HistoricalEntries: 10000, + UnbondingPeriod: unbondingPeriod, + } + providerKeeper.SetConsumerChainId(ctx, "0", "testchain1") + err := providerKeeper.SetConsumerMetadata(ctx, "0", consumerMetadata) + require.NoError(t, err) + err = providerKeeper.SetConsumerInitializationParameters(ctx, "0", initializationParameters) + require.NoError(t, err) + err = providerKeeper.SetConsumerPowerShapingParameters(ctx, "0", providertypes.PowerShapingParameters{}) + require.NoError(t, err) + + actualGenesis, _, err := providerKeeper.MakeConsumerGenesis(ctx, "0") + require.NoError(t, err) + + // JSON string with tabs, newlines and spaces for readability + jsonString := `{ + "params": { + "enabled": true, + "blocks_per_distribution_transmission": 1000, + "ccv_timeout_period": 2419200000000000, + "transfer_timeout_period": 3600000000000, + "consumer_redistribution_fraction": "0.75", + "historical_entries": 10000, + "unbonding_period": 1728000000000000, + "soft_opt_out_threshold": "0", + "reward_denoms": [], + "provider_reward_denoms": [], + "retry_delay_period": 3600000000000 + }, + "new_chain": true, + "provider" : { + "client_state": { + "chain_id": "testchain1", + "trust_level": { + "numerator": 1, + "denominator": 3 + }, + "trusting_period": 1197504000000000, + "unbonding_period": 1814400000000000, + "max_clock_drift": 10000000000, + "frozen_height": {}, + "latest_height": { + "revision_height": 5 + }, + "proof_specs": [ + { + "leaf_spec": { + "hash": 1, + "prehash_value": 1, + "length": 1, + "prefix": "AA==" + }, + "inner_spec": { + "child_order": [0, 1], + "child_size": 33, + "min_prefix_length": 4, + "max_prefix_length": 12, + "hash": 1 + } + }, + { + "leaf_spec": { + "hash": 1, + "prehash_value": 1, + "length": 1, + "prefix": "AA==" + }, + "inner_spec": { + "child_order": [0, 1], + "child_size": 32, + "min_prefix_length": 1, + "max_prefix_length": 1, + "hash": 1 + } + } + ], + "upgrade_path": ["upgrade", "upgradedIBCState"], + "allow_update_after_expiry": true, + "allow_update_after_misbehaviour": true + }, + "consensus_state": { + "timestamp": "2020-01-02T00:00:10Z", + "root": { + "hash": "LpGpeyQVLUo9HpdsgJr12NP2eCICspcULiWa5u9udOA=" + }, + "next_validators_hash": "E30CE736441FB9101FADDAF7E578ABBE6DFDB67207112350A9A904D554E1F5BE" + }, + "initial_val_set": [ + { + "pub_key": { + "type": "tendermint/PubKeyEd25519", + "value": "dcASx5/LIKZqagJWN0frOlFtcvz91frYmj/zmoZRWro=" + }, + "power": 1 + } + ] + } + }` + + var expectedGenesis ccvtypes.ConsumerGenesisState + err = json.Unmarshal([]byte(jsonString), &expectedGenesis) // ignores tabs, newlines and spaces + require.NoError(t, err) + + // Zeroing out different fields that are challenging to mock + actualGenesis.Provider.InitialValSet = []abci.ValidatorUpdate{} + expectedGenesis.Provider.InitialValSet = []abci.ValidatorUpdate{} + actualGenesis.Provider.ConsensusState = &ibctmtypes.ConsensusState{} + expectedGenesis.Provider.ConsensusState = &ibctmtypes.ConsensusState{} + + require.Equal(t, expectedGenesis, actualGenesis, "consumer chain genesis created incorrectly") +} + +func TestBeginBlockStopConsumers(t *testing.T) { + now := time.Now().UTC() + + keeperParams := testkeeper.NewInMemKeeperParams(t) + providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, keeperParams) + providerKeeper.SetParams(ctx, providertypes.DefaultParams()) + defer ctrl.Finish() + ctx = ctx.WithBlockTime(now) + + chainIds := []string{"chain1", "chain2", "chain3"} + consumerIds := []string{"consumerId1", "consumerId2", "consumerId3"} + err := providerKeeper.SetConsumerRemovalTime(ctx, consumerIds[0], now.Add(-time.Hour)) + require.NoError(t, err) + err = providerKeeper.AppendConsumerToBeRemoved(ctx, consumerIds[0], now.Add(-time.Hour)) + require.NoError(t, err) + err = providerKeeper.SetConsumerRemovalTime(ctx, consumerIds[1], now) + require.NoError(t, err) + err = providerKeeper.AppendConsumerToBeRemoved(ctx, consumerIds[1], now) + require.NoError(t, err) + err = providerKeeper.SetConsumerRemovalTime(ctx, consumerIds[2], now.Add(time.Hour)) + require.NoError(t, err) + err = providerKeeper.AppendConsumerToBeRemoved(ctx, consumerIds[2], now.Add(time.Hour)) + require.NoError(t, err) + + // + // Mock expectations + // + expectations := []*gomock.Call{} + 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, + 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.GetMocksForDeleteConsumerChain(ctx, &mocks)...) + expectations = append(expectations, testkeeper.GetMocksForDeleteConsumerChain(ctx, &mocks)...) + + gomock.InOrder(expectations...) + + // + // Remaining setup + // + 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]) + err = providerKeeper.SetConsumerMetadata(ctx, consumerId, registrationRecord) + require.NoError(t, err) + err = providerKeeper.SetConsumerInitializationParameters(ctx, consumerId, initializationRecord) + require.NoError(t, err) + err = providerKeeper.SetConsumerPowerShapingParameters(ctx, consumerId, testkeeper.GetTestPowerShapingParameters()) + require.NoError(t, err) + providerKeeper.SetConsumerPhase(ctx, consumerId, providertypes.CONSUMER_PHASE_INITIALIZED) + providerKeeper.SetConsumerClientId(ctx, consumerId, "clientID") + + err = providerKeeper.CreateConsumerClient(ctx, consumerId) + require.NoError(t, err) + err = providerKeeper.SetConsumerChain(ctx, "channelID") + require.NoError(t, err) + + // the chain is considered to be stopped and ready for deletion (i.e., `StopAndPrepareForConsumerRemoval` is called) + providerKeeper.SetConsumerPhase(ctx, consumerId, providertypes.CONSUMER_PHASE_STOPPED) + } + + // + // Test execution + // + + providerKeeper.BeginBlockRemoveConsumers(ctx) + + // Only the 3rd (final) proposal is still stored as pending + phase := providerKeeper.GetConsumerPhase(ctx, consumerIds[0]) + require.Equal(t, providertypes.CONSUMER_PHASE_DELETED, phase) + phase = providerKeeper.GetConsumerPhase(ctx, consumerIds[1]) + require.Equal(t, providertypes.CONSUMER_PHASE_DELETED, phase) + // third chain had a removal time in the future and hence did not get deleted + phase = providerKeeper.GetConsumerPhase(ctx, consumerIds[2]) + require.Equal(t, providertypes.CONSUMER_PHASE_STOPPED, phase) +} + +func TestGetConsumersReadyToStop(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.GetConsumersReadyToStop(ctx, 3)) + + err := providerKeeper.AppendConsumerToBeRemoved(ctx, "consumerId1", time.Unix(10, 0)) + require.NoError(t, err) + err = providerKeeper.AppendConsumerToBeRemoved(ctx, "consumerId2", time.Unix(20, 0)) + require.NoError(t, err) + err = providerKeeper.AppendConsumerToBeRemoved(ctx, "consumerId3", time.Unix(30, 0)) + require.NoError(t, err) + + // time has not yet reached the removal time of "consumerId1" + ctx = ctx.WithBlockTime(time.Unix(9, 999999999)) + require.Empty(t, providerKeeper.GetConsumersReadyToStop(ctx, 3)) + + // time has reached the removal time of "consumerId1" + ctx = ctx.WithBlockTime(time.Unix(10, 0)) + require.Equal(t, []string{"consumerId1"}, providerKeeper.GetConsumersReadyToStop(ctx, 3)) + + // time has reached the removal time of "consumerId1" and "consumerId2" + ctx = ctx.WithBlockTime(time.Unix(20, 0)) + require.Equal(t, []string{"consumerId1", "consumerId2"}, providerKeeper.GetConsumersReadyToStop(ctx, 3)) + + // time has reached the removal time of all chains + ctx = ctx.WithBlockTime(time.Unix(30, 0)) + require.Equal(t, []string{"consumerId1", "consumerId2", "consumerId3"}, providerKeeper.GetConsumersReadyToStop(ctx, 3)) +} + +// Tests the DeleteConsumerChain method against the spec, +// with more granularity than what's covered in TestHandleLegacyConsumerRemovalProposal, or integration tests. +// 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 TestStopConsumerChain(t *testing.T) { + type testCase struct { + description string + // State-mutating setup specific to this test case + setup func(sdk.Context, *providerkeeper.Keeper, testkeeper.MockedKeepers) + // Whether we should expect the method to return an error + expErr bool + } + + consumerId := "0" + + tests := []testCase{ + { + description: "proposal dropped, client doesn't exist", + setup: func(ctx sdk.Context, providerKeeper *providerkeeper.Keeper, mocks testkeeper.MockedKeepers) { + // No mocks, meaning no external keeper methods are allowed to be called. + }, + expErr: true, + }, + { + description: "valid stop of consumer chain, all mock calls hit", + setup: func(ctx sdk.Context, providerKeeper *providerkeeper.Keeper, mocks testkeeper.MockedKeepers) { + testkeeper.SetupForDeleteConsumerChain(t, ctx, providerKeeper, mocks, consumerId) + + // set consumer minimum equivocation height + providerKeeper.SetEquivocationEvidenceMinHeight(ctx, consumerId, 1) + + // assert mocks for expected calls to `DeleteConsumerChain` when closing the underlying channel + gomock.InOrder(testkeeper.GetMocksForDeleteConsumerChain(ctx, &mocks)...) + }, + expErr: false, + }, + } + + for _, tc := range tests { + + // Common setup + keeperParams := testkeeper.NewInMemKeeperParams(t) + providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, keeperParams) + providerKeeper.SetParams(ctx, providertypes.DefaultParams()) + + // Setup specific to test case + tc.setup(ctx, &providerKeeper, mocks) + + err := providerKeeper.DeleteConsumerChain(ctx, consumerId) + + if tc.expErr { + require.Error(t, err, t) + } else { + require.NoError(t, err) + } + + testkeeper.TestProviderStateIsCleanedAfterConsumerChainIsDeleted(t, ctx, providerKeeper, consumerId, "channelID", tc.expErr) + + ctrl.Finish() + } +} + +// +// Setters and Getters +// + +// TestConsumerRemovalTime tests the getter, setter, and deletion of the consumer id to removal times methods +func TestConsumerRemovalTime(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + _, err := providerKeeper.GetConsumerRemovalTime(ctx, "consumerId") + require.Error(t, err) + + expectedRemovalTime := time.Unix(1234, 56789) + providerKeeper.SetConsumerRemovalTime(ctx, "consumerId", expectedRemovalTime) + actualRemovalTime, err := providerKeeper.GetConsumerRemovalTime(ctx, "consumerId") + require.NoError(t, err) + require.Equal(t, actualRemovalTime, expectedRemovalTime) + + providerKeeper.DeleteConsumerRemovalTime(ctx, "consumerId") + _, err = providerKeeper.GetConsumerRemovalTime(ctx, "consumerId") + require.Error(t, err) +} + +// TestConsumersToBeLaunched tests `AppendConsumerToBeLaunched`, `GetConsumersToBeLaunched`, and `RemoveConsumerToBeLaunched` +func TestConsumersToBeLaunched(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + spawnTime := time.Now() + err := providerKeeper.AppendConsumerToBeLaunched(ctx, "consumerId1", spawnTime) + require.NoError(t, err) + consumers, err := providerKeeper.GetConsumersToBeLaunched(ctx, spawnTime) + require.NoError(t, err) + require.Equal(t, []string{"consumerId1"}, consumers.Ids) + + err = providerKeeper.AppendConsumerToBeLaunched(ctx, "consumerId2", spawnTime) + require.NoError(t, err) + consumers, err = providerKeeper.GetConsumersToBeLaunched(ctx, spawnTime) + require.NoError(t, err) + require.Equal(t, []string{"consumerId1", "consumerId2"}, consumers.Ids) + + err = providerKeeper.AppendConsumerToBeLaunched(ctx, "consumerId3", spawnTime) + require.NoError(t, err) + consumers, err = providerKeeper.GetConsumersToBeLaunched(ctx, spawnTime) + require.NoError(t, err) + require.Equal(t, []string{"consumerId1", "consumerId2", "consumerId3"}, consumers.Ids) + + err = providerKeeper.RemoveConsumerToBeLaunched(ctx, "consumerId2", spawnTime) + require.NoError(t, err) + consumers, err = providerKeeper.GetConsumersToBeLaunched(ctx, spawnTime) + require.NoError(t, err) + require.Equal(t, []string{"consumerId1", "consumerId3"}, consumers.Ids) + + // also add consumer ids under a different spawn time and verify everything under the original spawn time is still there + spawnTimePlusOneHour := spawnTime.Add(time.Hour) + err = providerKeeper.AppendConsumerToBeLaunched(ctx, "consumerId4", spawnTimePlusOneHour) + require.NoError(t, err) + consumers, err = providerKeeper.GetConsumersToBeLaunched(ctx, spawnTimePlusOneHour) + require.NoError(t, err) + require.Equal(t, []string{"consumerId4"}, consumers.Ids) + + consumers, err = providerKeeper.GetConsumersToBeLaunched(ctx, spawnTime) + require.NoError(t, err) + require.Equal(t, []string{"consumerId1", "consumerId3"}, consumers.Ids) + + // start removing all consumers from `spawnTime` + err = providerKeeper.RemoveConsumerToBeLaunched(ctx, "consumerId3", spawnTime) + require.NoError(t, err) + err = providerKeeper.RemoveConsumerToBeLaunched(ctx, "consumerId1", spawnTime) + require.NoError(t, err) + consumers, err = providerKeeper.GetConsumersToBeLaunched(ctx, spawnTime) + require.NoError(t, err) + require.Empty(t, consumers.Ids) + + // remove from `spawnTimePlusOneHour` + err = providerKeeper.RemoveConsumerToBeLaunched(ctx, "consumerId4", spawnTimePlusOneHour) + require.NoError(t, err) + consumers, err = providerKeeper.GetConsumersToBeLaunched(ctx, spawnTimePlusOneHour) + require.NoError(t, err) + require.Empty(t, consumers.Ids) + + // add another consumer for `spawnTime` + err = providerKeeper.AppendConsumerToBeLaunched(ctx, "consumerId5", spawnTime) + require.NoError(t, err) + consumers, err = providerKeeper.GetConsumersToBeLaunched(ctx, spawnTime) + require.NoError(t, err) + require.Equal(t, []string{"consumerId5"}, consumers.Ids) +} + +// TestConsumersToBeRemoved tests `AppendConsumerToBeRemoved`, `GetConsumersToBeRemoved`, and `RemoveConsumerToBeRemoved` +func TestConsumersToBeRemoved(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + removalTime := time.Now() + err := providerKeeper.AppendConsumerToBeRemoved(ctx, "consumerId1", removalTime) + require.NoError(t, err) + consumers, err := providerKeeper.GetConsumersToBeRemoved(ctx, removalTime) + require.NoError(t, err) + require.Equal(t, []string{"consumerId1"}, consumers.Ids) + + err = providerKeeper.AppendConsumerToBeRemoved(ctx, "consumerId2", removalTime) + require.NoError(t, err) + consumers, err = providerKeeper.GetConsumersToBeRemoved(ctx, removalTime) + require.NoError(t, err) + require.Equal(t, []string{"consumerId1", "consumerId2"}, consumers.Ids) + + err = providerKeeper.AppendConsumerToBeRemoved(ctx, "consumerId3", removalTime) + require.NoError(t, err) + consumers, err = providerKeeper.GetConsumersToBeRemoved(ctx, removalTime) + require.NoError(t, err) + require.Equal(t, []string{"consumerId1", "consumerId2", "consumerId3"}, consumers.Ids) + + err = providerKeeper.RemoveConsumerToBeRemoved(ctx, "consumerId2", removalTime) + require.NoError(t, err) + consumers, err = providerKeeper.GetConsumersToBeRemoved(ctx, removalTime) + require.NoError(t, err) + require.Equal(t, []string{"consumerId1", "consumerId3"}, consumers.Ids) + + // also add consumer ids under a different removal time and verify everything under the original removal time is still there + removalTimePlusOneHour := removalTime.Add(time.Hour) + err = providerKeeper.AppendConsumerToBeRemoved(ctx, "consumerId4", removalTimePlusOneHour) + require.NoError(t, err) + consumers, err = providerKeeper.GetConsumersToBeRemoved(ctx, removalTimePlusOneHour) + require.NoError(t, err) + require.Equal(t, []string{"consumerId4"}, consumers.Ids) + + consumers, err = providerKeeper.GetConsumersToBeRemoved(ctx, removalTime) + require.NoError(t, err) + require.Equal(t, []string{"consumerId1", "consumerId3"}, consumers.Ids) + + // start removing all consumers from `removalTime` + err = providerKeeper.RemoveConsumerToBeRemoved(ctx, "consumerId3", removalTime) + require.NoError(t, err) + err = providerKeeper.RemoveConsumerToBeRemoved(ctx, "consumerId1", removalTime) + require.NoError(t, err) + consumers, err = providerKeeper.GetConsumersToBeRemoved(ctx, removalTime) + require.NoError(t, err) + require.Empty(t, consumers.Ids) + + // remove from `removalTimePlusOneHour` + err = providerKeeper.RemoveConsumerToBeRemoved(ctx, "consumerId4", removalTimePlusOneHour) + require.NoError(t, err) + consumers, err = providerKeeper.GetConsumersToBeRemoved(ctx, removalTimePlusOneHour) + require.NoError(t, err) + require.Empty(t, consumers.Ids) + + // add another consumer for `removalTime` + err = providerKeeper.AppendConsumerToBeRemoved(ctx, "consumerId5", removalTime) + require.NoError(t, err) + consumers, err = providerKeeper.GetConsumersToBeRemoved(ctx, removalTime) + require.NoError(t, err) + require.Equal(t, []string{"consumerId5"}, consumers.Ids) +} diff --git a/x/ccv/provider/keeper/distribution.go b/x/ccv/provider/keeper/distribution.go index 7970a8c682..db75ff9b6e 100644 --- a/x/ccv/provider/keeper/distribution.go +++ b/x/ccv/provider/keeper/distribution.go @@ -74,33 +74,35 @@ func (k Keeper) AllocateTokens(ctx sdk.Context) { return } - // Iterate over all registered consumer chains - for _, consumerChainID := range k.GetAllRegisteredConsumerChainIDs(ctx) { + // Iterate over all launched consumer chains. + // To avoid large iterations over all the consumer IDs, iterate only over + // chains with an IBC client created. + for _, consumerId := range k.GetAllConsumersWithIBCClients(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 // of non-whitelisted denominations. - alloc := k.GetConsumerRewardsAllocation(ctx, consumerChainID) + alloc := k.GetConsumerRewardsAllocation(ctx, consumerId) if alloc.Rewards.IsZero() { continue } // temporary workaround to keep CanWithdrawInvariant happy // general discussions here: https://github.com/cosmos/cosmos-sdk/issues/2906#issuecomment-441867634 - if k.ComputeConsumerTotalVotingPower(ctx, consumerChainID) == 0 { + if k.ComputeConsumerTotalVotingPower(ctx, consumerId) == 0 { rewardsToSend, rewardsChange := alloc.Rewards.TruncateDecimal() err := k.distributionKeeper.FundCommunityPool(context.Context(ctx), rewardsToSend, k.accountKeeper.GetModuleAccount(ctx, types.ConsumerRewardsPool).GetAddress()) if err != nil { k.Logger(ctx).Error( "fail to allocate rewards from consumer chain %s to community pool: %s", - consumerChainID, + consumerId, err, ) } // set the consumer allocation to the remaining reward decimals alloc.Rewards = rewardsChange - k.SetConsumerRewardsAllocation(ctx, consumerChainID, alloc) + k.SetConsumerRewardsAllocation(ctx, consumerId, alloc) return } @@ -112,7 +114,7 @@ func (k Keeper) AllocateTokens(ctx sdk.Context) { if err != nil { k.Logger(ctx).Error( "cannot get community tax while allocating rewards from consumer chain %s: %s", - consumerChainID, + consumerId, err, ) continue @@ -132,7 +134,7 @@ func (k Keeper) AllocateTokens(ctx sdk.Context) { if err != nil { k.Logger(ctx).Error( "cannot send rewards to distribution module account %s: %s", - consumerChainID, + consumerId, err, ) continue @@ -141,7 +143,7 @@ func (k Keeper) AllocateTokens(ctx sdk.Context) { // allocate tokens to consumer validators k.AllocateTokensToConsumerValidators( ctx, - consumerChainID, + consumerId, sdk.NewDecCoinsFromCoins(validatorsRewardsTrunc...), ) @@ -151,7 +153,7 @@ func (k Keeper) AllocateTokens(ctx sdk.Context) { if err != nil { k.Logger(ctx).Error( "fail to allocate rewards from consumer chain %s to community pool: %s", - consumerChainID, + consumerId, err, ) continue @@ -159,7 +161,7 @@ func (k Keeper) AllocateTokens(ctx sdk.Context) { // set consumer allocations to the remaining rewards decimals alloc.Rewards = validatorsRewardsChange.Add(remainingChanges...) - k.SetConsumerRewardsAllocation(ctx, consumerChainID, alloc) + k.SetConsumerRewardsAllocation(ctx, consumerId, alloc) } } @@ -176,7 +178,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 +187,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 +222,7 @@ func (k Keeper) AllocateTokensToConsumerValidators( "cannot find validator by consensus address", consAddr, "while allocating rewards from consumer chain", - chainID, + consumerId, "error", err, ) @@ -228,7 +230,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 +243,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 +256,25 @@ 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) +} + +// DeleteConsumerRewardsAllocation deletes the consumer rewards allocation for the given consumer id +func (k Keeper) DeleteConsumerRewardsAllocation(ctx sdk.Context, consumerId string) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.ConsumerRewardsAllocationKey(consumerId)) } // GetConsumerRewardsPool returns the balance @@ -280,20 +288,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 +312,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 +323,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 { - // check that the consumer chain exists - if !k.IsConsumerProposedOrRegistered(ctx, chainID) { +func (k Keeper) HandleSetConsumerCommissionRate(ctx sdk.Context, consumerId string, providerAddr types.ProviderConsAddress, commissionRate math.LegacyDec) error { + // check that the consumer chain is active -- registered, initialized, or launched + if !k.IsConsumerActive(ctx, consumerId) { return errorsmod.Wrapf( - types.ErrUnknownConsumerChainId, - "unknown consumer chain, with id: %s", chainID) + types.ErrInvalidPhase, + "unknown consumer chain, with id: %s", consumerId) } // validate against the minimum commission rate @@ -353,8 +364,45 @@ 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, ) } + +// TODO: this method needs to be tested +func (k Keeper) ChangeRewardDenoms(ctx sdk.Context, denomsToAdd, denomsToRemove []string) []sdk.Attribute { + // initialize an empty slice to store event attributes + eventAttributes := []sdk.Attribute{} + + // loop through denomsToAdd and add each denomination if it is not already registered + for _, denomToAdd := range denomsToAdd { + // Log error and move on if one of the denoms is already registered + if k.ConsumerRewardDenomExists(ctx, denomToAdd) { + k.Logger(ctx).Error("ChangeRewardDenoms: denom already registered", + "denomToAdd", denomToAdd, + ) + continue + } + k.SetConsumerRewardDenom(ctx, denomToAdd) + + eventAttributes = append(eventAttributes, sdk.NewAttribute(types.AttributeAddConsumerRewardDenom, denomToAdd)) + } + + // loop through denomsToRemove and remove each denomination if it is registered + for _, denomToRemove := range denomsToRemove { + // Log error and move on if one of the denoms is not registered + if !k.ConsumerRewardDenomExists(ctx, denomToRemove) { + k.Logger(ctx).Error("ChangeRewardDenoms: denom not registered", + "denomToRemove", denomToRemove, + ) + continue + } + k.DeleteConsumerRewardDenom(ctx, denomToRemove) + + eventAttributes = append(eventAttributes, sdk.NewAttribute(types.AttributeRemoveConsumerRewardDenom, denomToRemove)) + } + + // return the slice of event attributes + return eventAttributes +} diff --git a/x/ccv/provider/keeper/distribution_test.go b/x/ccv/provider/keeper/distribution_test.go index e8caeb7c36..c449b0149c 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 { @@ -296,3 +296,35 @@ func TestIsEligibleForConsumerRewards(t *testing.T) { require.True(t, keeper.IsEligibleForConsumerRewards(ctx.WithBlockHeight(numberOfBlocks+1), 1)) require.False(t, keeper.IsEligibleForConsumerRewards(ctx.WithBlockHeight(numberOfBlocks+1), 2)) } + +func TestChangeRewardDenoms(t *testing.T) { + keeper, ctx, _, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + + // Test adding a new denomination + denomsToAdd := []string{"denom1"} + denomsToRemove := []string{} + attributes := keeper.ChangeRewardDenoms(ctx, denomsToAdd, denomsToRemove) + + require.Len(t, attributes, 1) + require.Equal(t, providertypes.AttributeAddConsumerRewardDenom, attributes[0].Key) + require.Equal(t, "denom1", attributes[0].Value) + require.True(t, keeper.ConsumerRewardDenomExists(ctx, "denom1")) + + // Test adding a denomination that is already registered + attributes = keeper.ChangeRewardDenoms(ctx, denomsToAdd, denomsToRemove) + require.Len(t, attributes, 0) // No attributes should be returned since the denom is already registered + + // Test removing a registered denomination + denomsToAdd = []string{} + denomsToRemove = []string{"denom1"} + attributes = keeper.ChangeRewardDenoms(ctx, denomsToAdd, denomsToRemove) + + require.Len(t, attributes, 1) + require.Equal(t, providertypes.AttributeRemoveConsumerRewardDenom, attributes[0].Key) + require.Equal(t, "denom1", attributes[0].Value) + require.False(t, keeper.ConsumerRewardDenomExists(ctx, "denom1")) + + // Test removing a denomination that is not registered + attributes = keeper.ChangeRewardDenoms(ctx, denomsToAdd, denomsToRemove) + require.Len(t, attributes, 0) // No attributes should be returned since the denom is not registered +} diff --git a/x/ccv/provider/keeper/genesis.go b/x/ccv/provider/keeper/genesis.go index 5b44227f90..7e8fd4bb76 100644 --- a/x/ccv/provider/keeper/genesis.go +++ b/x/ccv/provider/keeper/genesis.go @@ -32,20 +32,11 @@ func (k Keeper) InitGenesis(ctx sdk.Context, genState *types.GenesisState) []abc k.SetValsetUpdateBlockHeight(ctx, v2h.ValsetUpdateId, v2h.Height) } - for _, prop := range genState.ConsumerAdditionProposals { - // prevent implicit memory aliasing - p := prop - k.SetPendingConsumerAdditionProp(ctx, &p) - } - for _, prop := range genState.ConsumerRemovalProposals { - p := prop - k.SetPendingConsumerRemovalProp(ctx, &p) - } - // Set initial state for each consumer chain for _, cs := range genState.ConsumerStates { chainID := cs.ChainId k.SetConsumerClientId(ctx, chainID, cs.ClientId) + k.SetConsumerPhase(ctx, chainID, cs.Phase) if err := k.SetConsumerGenesis(ctx, chainID, cs.ConsumerGenesis); err != nil { // An error here would indicate something is very wrong, // the ConsumerGenesis validated in ConsumerState.Validate(). @@ -53,8 +44,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 { @@ -128,57 +119,56 @@ 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) + launchedConsumerIds := k.GetAllConsumersWithIBCClients(ctx) // export states for each consumer chains var consumerStates []types.ConsumerState - for _, chainID := range registeredChainIDs { + for _, consumerId := range launchedConsumerIds { // no need for the second return value of GetConsumerClientId - // as GetAllRegisteredConsumerChainIDs already iterated through + // as GetAllConsumersWithIBCClients 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, + Phase: k.GetConsumerPhase(ctx, consumerId), } // 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 launchedConsumerIds { consumerAddrsToPrune = append(consumerAddrsToPrune, k.GetAllConsumerAddrsToPrune(ctx, chainID)...) } params := k.GetParams(ctx) + // TODO (PERMISSIONLESS) return types.NewGenesisState( k.GetValidatorSetUpdateId(ctx), k.GetAllValsetUpdateBlockHeights(ctx), consumerStates, - k.GetAllPendingConsumerAdditionProps(ctx), - k.GetAllPendingConsumerRemovalProps(ctx), params, k.GetAllValidatorConsumerPubKeys(ctx, nil), k.GetAllValidatorsByConsumerAddr(ctx, nil), diff --git a/x/ccv/provider/keeper/genesis_test.go b/x/ccv/provider/keeper/genesis_test.go index 82069b4b8d..af3e0ea843 100644 --- a/x/ccv/provider/keeper/genesis_test.go +++ b/x/ccv/provider/keeper/genesis_test.go @@ -51,6 +51,7 @@ func TestInitAndExportGenesis(t *testing.T) { *ccv.DefaultConsumerGenesisState(), []ccv.ValidatorSetChangePacketData{}, []string{"slashedValidatorConsAddress"}, + providertypes.CONSUMER_PHASE_LAUNCHED, ), providertypes.NewConsumerStates( cChainIDs[1], @@ -60,16 +61,9 @@ func TestInitAndExportGenesis(t *testing.T) { *ccv.DefaultConsumerGenesisState(), []ccv.ValidatorSetChangePacketData{{ValsetUpdateId: vscID}}, nil, + providertypes.CONSUMER_PHASE_LAUNCHED, ), }, - []providertypes.ConsumerAdditionProposal{{ - ChainId: cChainIDs[0], - SpawnTime: oneHourFromNow, - }}, - []providertypes.ConsumerRemovalProposal{{ - ChainId: cChainIDs[0], - StopTime: oneHourFromNow, - }}, params, []providertypes.ValidatorConsumerPubKey{ { @@ -132,17 +126,13 @@ 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)) height, found := pk.GetValsetUpdateBlockHeight(ctx, vscID) require.True(t, found) require.Equal(t, initHeight, height) - addProp, found := pk.GetPendingConsumerAdditionProp(ctx, oneHourFromNow, cChainIDs[0]) - require.True(t, found) - require.Equal(t, provGenesis.ConsumerAdditionProposals[0], addProp) - require.True(t, pk.PendingConsumerRemovalPropExists(ctx, cChainIDs[0], oneHourFromNow)) require.Equal(t, provGenesis.Params, pk.GetParams(ctx)) providerConsensusValSet, err := pk.GetLastProviderConsensusValSet(ctx) @@ -189,7 +179,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 2635648a6a..170b3ba29b 100644 --- a/x/ccv/provider/keeper/grpc_query.go +++ b/x/ccv/provider/keeper/grpc_query.go @@ -1,17 +1,17 @@ package keeper import ( + "bytes" "context" "fmt" + "sort" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" 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" ) @@ -25,15 +25,16 @@ func (k Keeper) QueryConsumerGenesis(c context.Context, req *types.QueryConsumer return nil, status.Errorf(codes.InvalidArgument, "empty request") } - 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(), ) } @@ -47,119 +48,108 @@ func (k Keeper) QueryConsumerChains(goCtx context.Context, req *types.QueryConsu ctx := sdk.UnwrapSDKContext(goCtx) - chains := []*types.Chain{} - for _, chainID := range k.GetAllRegisteredConsumerChainIDs(ctx) { - c, err := k.GetConsumerChain(ctx, chainID) + consumerIds := []string{} + for _, consumerID := range k.GetAllConsumerIds(ctx) { + phase := k.GetConsumerPhase(ctx, consumerID) + if req.Phase != types.CONSUMER_PHASE_UNSPECIFIED && req.Phase != phase { + // ignore consumer chain + continue + } + consumerIds = append(consumerIds, consumerID) + } + + // set limit to default value + limit := 100 + if req.Limit != 0 { + // update limit if specified + limit = int(req.Limit) + } + if len(consumerIds) > limit { + consumerIds = consumerIds[:limit] + } + + chains := make([]*types.Chain, len(consumerIds)) + for i, cID := range consumerIds { + c, err := k.GetConsumerChain(ctx, cID) if err != nil { return nil, status.Error(codes.Internal, err.Error()) } - chains = append(chains, &c) + chains[i] = &c } return &types.QueryConsumerChainsResponse{Chains: chains}, nil } // 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) - if !found { - return types.Chain{}, fmt.Errorf("cannot find clientID for consumer (%s)", chainID) +func (k Keeper) GetConsumerChain(ctx sdk.Context, consumerId string) (types.Chain, error) { + chainID, err := k.GetConsumerChainId(ctx, consumerId) + if err != nil { + return types.Chain{}, fmt.Errorf("cannot find chainID 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 + clientID, _ := k.GetConsumerClientId(ctx, consumerId) + + powerShapingParameters, err := k.GetConsumerPowerShapingParameters(ctx, consumerId) + if err != nil { + return types.Chain{}, fmt.Errorf("cannot find power shaping parameters for consumer (%s): %s", consumerId, err.Error()) } // 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) minPowerInTopN = -1 } - validatorSetCap, _ := k.GetValidatorSetCap(ctx, chainID) - - validatorsPowerCap, _ := k.GetValidatorsPowerCap(ctx, chainID) - - 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() } - allowInactiveVals := k.AllowsInactiveValidators(ctx, chainID) - - minStake, _ := k.GetMinStake(ctx, chainID) + metadata, _ := k.GetConsumerMetadata(ctx, consumerId) return types.Chain{ ChainId: chainID, ClientId: clientID, - Top_N: topN, + Top_N: powerShapingParameters.Top_N, MinPowerInTop_N: minPowerInTopN, - ValidatorSetCap: validatorSetCap, - ValidatorsPowerCap: validatorsPowerCap, + ValidatorSetCap: powerShapingParameters.ValidatorSetCap, + ValidatorsPowerCap: powerShapingParameters.ValidatorsPowerCap, Allowlist: strAllowlist, Denylist: strDenylist, - AllowInactiveVals: allowInactiveVals, - MinStake: minStake, + Phase: k.GetConsumerPhase(ctx, consumerId).String(), + Metadata: metadata, + AllowInactiveVals: powerShapingParameters.AllowInactiveVals, + MinStake: powerShapingParameters.MinStake, + ConsumerId: consumerId, }, nil } -func (k Keeper) QueryConsumerChainStarts(goCtx context.Context, req *types.QueryConsumerChainStartProposalsRequest) (*types.QueryConsumerChainStartProposalsResponse, error) { +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") } ctx := sdk.UnwrapSDKContext(goCtx) - var props []*types.ConsumerAdditionProposal - - for _, prop := range k.GetAllPendingConsumerAdditionProps(ctx) { - // prevent implicit memory aliasing - p := prop - props = append(props, &p) - } - return &types.QueryConsumerChainStartProposalsResponse{Proposals: &types.ConsumerAdditionProposals{Pending: props}}, nil -} - -func (k Keeper) QueryConsumerChainStops(goCtx context.Context, req *types.QueryConsumerChainStopProposalsRequest) (*types.QueryConsumerChainStopProposalsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "empty request") + 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) - var props []*types.ConsumerRemovalProposal - for _, prop := range k.GetAllPendingConsumerRemovalProps(ctx) { - // prevent implicit memory aliasing - p := prop - props = append(props, &p) - } - - return &types.QueryConsumerChainStopProposalsResponse{Proposals: &types.ConsumerRemovalProposals{Pending: props}}, nil -} - -func (k Keeper) QueryValidatorConsumerAddr(goCtx context.Context, req *types.QueryValidatorConsumerAddrRequest) (*types.QueryValidatorConsumerAddrResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "empty request") - } - - ctx := sdk.UnwrapSDKContext(goCtx) - 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 } @@ -176,7 +166,7 @@ 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") } ctx := sdk.UnwrapSDKContext(goCtx) @@ -187,7 +177,7 @@ func (k Keeper) QueryValidatorProviderAddr(goCtx context.Context, req *types.Que } consumerAddr := types.NewConsumerConsAddress(consumerAddrTmp) - providerAddr, found := k.GetValidatorByConsumerAddr(ctx, req.ChainId, consumerAddr) + providerAddr, found := k.GetValidatorByConsumerAddr(ctx, req.ConsumerId, consumerAddr) if !found { return &types.QueryValidatorProviderAddrResponse{}, nil } @@ -229,34 +219,24 @@ func (k Keeper) QueryRegisteredConsumerRewardDenoms(goCtx context.Context, req * }, nil } -func (k Keeper) QueryProposedConsumerChainIDs(goCtx context.Context, req *types.QueryProposedChainIDsRequest) (*types.QueryProposedChainIDsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "empty request") - } - - ctx := sdk.UnwrapSDKContext(goCtx) - - chains := k.GetAllProposedConsumerChainIDs(ctx) - - return &types.QueryProposedChainIDsResponse{ - ProposedChains: chains, - }, nil -} - -func (k Keeper) QueryAllPairsValConAddrByConsumerChainID(goCtx context.Context, req *types.QueryAllPairsValConAddrByConsumerChainIDRequest) (*types.QueryAllPairsValConAddrByConsumerChainIDResponse, error) { +func (k Keeper) QueryAllPairsValConsAddrByConsumer( + goCtx context.Context, + req *types.QueryAllPairsValConsAddrByConsumerRequest, +) (*types.QueryAllPairsValConsAddrByConsumerResponse, error) { if req == nil { - return nil, status.Error(codes.InvalidArgument, "empty request") + return nil, status.Errorf(codes.InvalidArgument, "empty request") } - 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 { @@ -269,7 +249,7 @@ func (k Keeper) QueryAllPairsValConAddrByConsumerChainID(goCtx context.Context, }) } - return &types.QueryAllPairsValConAddrByConsumerChainIDResponse{ + return &types.QueryAllPairsValConsAddrByConsumerResponse{ PairValConAddr: pairValConAddrs, }, nil } @@ -289,22 +269,22 @@ 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") } - 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.IsConsumerActive(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()) } @@ -316,52 +296,104 @@ 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") } - 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 { - // 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)) + // get the consumer phase + phase := k.GetConsumerPhase(ctx, consumerId) + if phase == types.CONSUMER_PHASE_UNSPECIFIED { + return nil, status.Errorf(codes.InvalidArgument, "cannot find a phase for consumer: %s", consumerId) } - var validators []*types.QueryConsumerValidatorsValidator - - consumerValSet, err := k.GetConsumerValSet(ctx, consumerChainID) - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } + // query consumer validator set - for _, v := range consumerValSet { + var consumerValSet []types.ConsensusValidator + var err error - consAddr, err := sdk.ConsAddressFromBech32(sdk.ConsAddress(v.ProviderConsAddr).String()) + // if the consumer launched, the consumer valset has been persisted + if phase == types.CONSUMER_PHASE_LAUNCHED { + consumerValSet, err = k.GetConsumerValSet(ctx, consumerId) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + // if the consumer hasn't been launched or stopped, compute the consumer validator set + } else if phase != types.CONSUMER_PHASE_STOPPED { + bondedValidators, err := k.GetLastBondedValidators(ctx) if err != nil { - return nil, status.Error(codes.InvalidArgument, "invalid provider address") + return nil, status.Error(codes.Internal, fmt.Sprintf("failed to get last validators: %s", err)) } + minPower := int64(0) + // for TopN chains, compute the minPower that will be automatically opted in + powerShapingParameters, err := k.GetConsumerPowerShapingParameters(ctx, consumerId) + if err != nil { + return nil, status.Error(codes.Internal, fmt.Sprintf("failed to get power shaping params: %s", err)) + } + if powerShapingParameters.Top_N > 0 { + activeValidators, err := k.GetLastProviderConsensusActiveValidators(ctx) + if err != nil { + return nil, status.Error(codes.Internal, fmt.Sprintf("failed to get active validators: %s", err)) + } - 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) + minPower, err = k.ComputeMinPowerInTopN(ctx, activeValidators, powerShapingParameters.Top_N) if err != nil { - return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("unknown validator: %s", consAddr.String())) + return nil, status.Error(codes.Internal, fmt.Sprintf("failed to compute min power to opt in for chain %s: %s", consumerId, err)) } - rate = v.Commission.Rate + } + + consumerValSet = k.ComputeNextValidators(ctx, consumerId, bondedValidators, powerShapingParameters, minPower) + + // sort the address of the validators by ascending lexical order as they were persisted to the store + sort.Slice(consumerValSet, func(i, j int) bool { + return bytes.Compare( + consumerValSet[i].ProviderConsAddr, + consumerValSet[j].ProviderConsAddr, + ) == -1 + }) + } + + var validators []*types.QueryConsumerValidatorsValidator + for _, consumerVal := range consumerValSet { + provAddr := types.ProviderConsAddress{Address: consumerVal.ProviderConsAddr} + consAddr := provAddr.ToSdkConsAddr() + + providerVal, err := k.stakingKeeper.GetValidatorByConsAddr(ctx, consAddr) + if err != nil { + k.Logger(ctx).Error("cannot find consensus address for provider address:%s", provAddr.String()) + continue + } + + 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{ @@ -392,14 +424,16 @@ 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) { - if hasToValidate, err := k.hasToValidate(ctx, provAddr, consumerChainID); err == nil && hasToValidate { - consumersToValidate = append(consumersToValidate, consumerChainID) + // To avoid large iterations over all the consumer IDs, iterate only over + // chains with an IBC client created. + for _, consumerId := range k.GetAllConsumersWithIBCClients(ctx) { + if hasToValidate, err := k.hasToValidate(ctx, provAddr, consumerId); err == nil && hasToValidate { + consumersToValidate = append(consumersToValidate, consumerId) } } return &types.QueryConsumerChainsValidatorHasToValidateResponse{ - ConsumerChainIds: consumersToValidate, + ConsumerIds: consumersToValidate, }, nil } @@ -407,10 +441,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 } @@ -419,29 +453,33 @@ func (k Keeper) hasToValidate( if err != nil { return false, nil } - if topN, found := k.GetTopN(ctx, chainID); found && 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) - if found { - k.OptInTopNValidators(ctx, chainID, activeValidators, minPower) - } else { - k.Logger(ctx).Error("did not find min power in top N for chain", "chain", chainID) - } - } - // 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) { - lastVals, err := k.GetLastBondedValidators(ctx) + minPowerToOptIn := int64(0) + // If the consumer is TopN compute the minimum power + powerShapingParameters, err := k.GetConsumerPowerShapingParameters(ctx, consumerId) + if err != nil { + return false, err + } + if powerShapingParameters.Top_N > 0 { + // compute the minimum power to opt-in since the one in the state is stale + // Note that the effective min power will be computed at the end of the epoch + minPowerToOptIn, err = k.ComputeMinPowerInTopN(ctx, activeValidators, powerShapingParameters.Top_N) if err != nil { return false, err } - nextValidators := k.ComputeNextValidators(ctx, chainID, lastVals) - for _, v := range nextValidators { - consAddr := sdk.ConsAddress(v.ProviderConsAddr) - if provAddr.ToSdkConsAddr().Equals(consAddr) { - return true, nil - } + } + + // if the validator belongs to the validators of the next epoch, then if nothing changes + // the validator would have to validate in the next epoch + lastVals, err := k.GetLastBondedValidators(ctx) + if err != nil { + return false, err + } + nextValidators := k.ComputeNextValidators(ctx, consumerId, lastVals, powerShapingParameters, minPowerToOptIn) + for _, v := range nextValidators { + consAddr := sdk.ConsAddress(v.ProviderConsAddr) + if provAddr.ToSdkConsAddr().Equals(consAddr) { + return true, nil } } @@ -452,12 +490,12 @@ 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") } - 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) @@ -467,15 +505,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.IsConsumerActive(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 { @@ -498,3 +536,61 @@ 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 +} + +// QueryConsumerChain returns the consumer chain associated with the consumer id +func (k Keeper) QueryConsumerChain(goCtx context.Context, req *types.QueryConsumerChainRequest) (*types.QueryConsumerChainResponse, error) { + if req == nil { + return nil, status.Errorf(codes.InvalidArgument, "empty request") + } + + 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) + + chainId, err := k.GetConsumerChainId(ctx, consumerId) + if err != nil { + return nil, status.Errorf(codes.InvalidArgument, "cannot retrieve chain id for consumer id: %s", consumerId) + } + + ownerAddress, err := k.GetConsumerOwnerAddress(ctx, consumerId) + if err != nil { + return nil, status.Errorf(codes.InvalidArgument, "cannot retrieve owner address for consumer id: %s", consumerId) + } + + phase := k.GetConsumerPhase(ctx, consumerId) + if phase == types.CONSUMER_PHASE_UNSPECIFIED { + return nil, status.Errorf(codes.InvalidArgument, "cannot retrieve phase for consumer id: %s", consumerId) + } + + metadata, err := k.GetConsumerMetadata(ctx, consumerId) + if err != nil { + return nil, status.Errorf(codes.InvalidArgument, "cannot retrieve metadata for consumer id: %s", consumerId) + } + + // neither the init nor the power shaping params are mandatory for consumers + initParams, _ := k.GetConsumerInitializationParameters(ctx, consumerId) + powerParams, _ := k.GetConsumerPowerShapingParameters(ctx, consumerId) + + return &types.QueryConsumerChainResponse{ + ChainId: chainId, + OwnerAddress: ownerAddress, + Phase: phase.String(), + Metadata: metadata, + InitParams: &initParams, + PowerShapingParams: &powerParams, + }, nil +} diff --git a/x/ccv/provider/keeper/grpc_query_test.go b/x/ccv/provider/keeper/grpc_query_test.go index d0ba94174a..3ba2cc9059 100644 --- a/x/ccv/provider/keeper/grpc_query_test.go +++ b/x/ccv/provider/keeper/grpc_query_test.go @@ -1,7 +1,10 @@ package keeper_test import ( + "bytes" "fmt" + "sort" + "strconv" "testing" "github.com/golang/mock/gomock" @@ -16,12 +19,13 @@ 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" ) -func TestQueryAllPairsValConAddrByConsumerChainID(t *testing.T) { - chainID := consumer +func TestQueryAllPairsValConsAddrByConsumer(t *testing.T) { + consumerId := "0" providerConsAddress, err := sdk.ConsAddressFromBech32("cosmosvalcons1wpex7anfv3jhystyv3eq20r35a") require.NoError(t, err) @@ -34,28 +38,27 @@ 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) // Request is nil - _, err = pk.QueryAllPairsValConAddrByConsumerChainID(ctx, nil) + _, err = pk.QueryAllPairsValConsAddrByConsumer(ctx, nil) require.Error(t, err) - // Request with chainId is empty - _, err = pk.QueryAllPairsValConAddrByConsumerChainID(ctx, &types.QueryAllPairsValConAddrByConsumerChainIDRequest{}) + // Request with empty consumer id + _, err = pk.QueryAllPairsValConsAddrByConsumer(ctx, &types.QueryAllPairsValConsAddrByConsumerRequest{}) 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 + _, err = pk.QueryAllPairsValConsAddrByConsumer(ctx, &types.QueryAllPairsValConsAddrByConsumerRequest{ConsumerId: "invalidConsumerId"}) + require.Error(t, err) // Request is valid - response, err = pk.QueryAllPairsValConAddrByConsumerChainID(ctx, &types.QueryAllPairsValConAddrByConsumerChainIDRequest{ChainId: chainID}) + response, err := pk.QueryAllPairsValConsAddrByConsumer(ctx, &types.QueryAllPairsValConsAddrByConsumerRequest{ConsumerId: consumerId}) require.NoError(t, err) expectedResult := types.PairValConAddrProviderAndConsumer{ @@ -68,20 +71,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, types.CONSUMER_PHASE_INITIALIZED) providerAddr1 := types.NewProviderConsAddress([]byte("providerAddr1")) providerAddr2 := types.NewProviderConsAddress([]byte("providerAddr2")) @@ -89,70 +93,207 @@ 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 + // error returned from not-existing 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) + // set the consumer to the "registered" phase + pk.SetConsumerPhase(ctx, consumerId, types.CONSUMER_PHASE_REGISTERED) - 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 power shaping params + err = pk.SetConsumerPowerShapingParameters(ctx, consumerId, types.PowerShapingParameters{}) + require.NoError(t, err) + + // expect empty valset + testkeeper.SetupMocksForLastBondedValidatorsExpectation(mocks.MockStakingKeeper, 0, []stakingtypes.Validator{}, 1) // -1 to allow the calls "AnyTimes" + res, err := pk.QueryConsumerValidators(ctx, &req) + require.NoError(t, err) + require.Len(t, res.Validators, 0) + + // create bonded validators + val1 := createStakingValidator(ctx, mocks, 1, 1) + pk1, _ := val1.CmtConsPublicKey() + valConsAddr1, _ := val1.GetConsAddr() + providerAddr1 := types.NewProviderConsAddress(valConsAddr1) + 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, 2, 2) + pk2, _ := val2.CmtConsPublicKey() + valConsAddr2, _ := val2.GetConsAddr() + providerAddr2 := types.NewProviderConsAddress(valConsAddr2) + 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.456") + + val3 := createStakingValidator(ctx, mocks, 3, 3) + pk3, _ := val3.CmtConsPublicKey() + valConsAddr3, _ := val3.GetConsAddr() + providerAddr3 := types.NewProviderConsAddress(valConsAddr3) + consumerValidator3 := types.ConsensusValidator{ProviderConsAddr: providerAddr3.ToSdkConsAddr(), Power: 3, PublicKey: &pk3} + val3.Tokens = sdk.TokensFromConsensusPower(3, sdk.DefaultPowerReduction) + val3.Description = stakingtypes.Description{Moniker: "ConsumerValidator3"} + + mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, valConsAddr1).Return(val1, nil).AnyTimes() + mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, valConsAddr2).Return(val2, nil).AnyTimes() + mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, valConsAddr3).Return(val3, 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" + + // set max provider consensus vals to include all validators + params := pk.GetParams(ctx) + params.MaxProviderConsensusValidators = 3 + pk.SetParams(ctx, params) - expectedResponse := types.QueryConsumerValidatorsResponse{ + // expect no validator to be returned since the consumer is Opt-In + res, err = pk.QueryConsumerValidators(ctx, &req) + require.NoError(t, err) + require.Len(t, res.Validators, 0) + + // opt in one validator + pk.SetOptedIn(ctx, consumerId, providerAddr1) + + // set a consumer commission rate for val1 + val1ConsComRate := math.LegacyMustNewDecFromStr("0.789") + pk.SetConsumerCommissionRate(ctx, consumerId, providerAddr1, val1ConsComRate) + + // expect opted-in validator + res, err = pk.QueryConsumerValidators(ctx, &req) + require.NoError(t, err) + require.Len(t, res.Validators, 1) + require.Equal(t, res.Validators[0].ProviderAddress, providerAddr1.String()) + + // update consumer TopN param + err = pk.SetConsumerPowerShapingParameters(ctx, consumerId, types.PowerShapingParameters{Top_N: 50}) + require.NoError(t, err) + + // expect both opted-in and topN validator + expRes := 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}) + // sort the address of the validators by ascending lexical order as they were persisted to the store + sort.Slice(expRes.Validators, func(i, j int) bool { + return bytes.Compare( + expRes.Validators[i].ConsumerKey.GetEd25519(), + expRes.Validators[j].ConsumerKey.GetEd25519(), + ) == -1 + }) - res, err := pk.QueryConsumerValidators(ctx, &req) + res, err = pk.QueryConsumerValidators(ctx, &req) require.NoError(t, err) - require.Equal(t, &expectedResponse, res) + require.Equal(t, &expRes, res) + + // expect same result when consumer is in "initialized" phase + pk.SetConsumerPhase(ctx, consumerId, types.CONSUMER_PHASE_INITIALIZED) + res, err = pk.QueryConsumerValidators(ctx, &req) + require.NoError(t, err) + require.Equal(t, &expRes, res) + + // set consumer to the "launched" phase + pk.SetConsumerPhase(ctx, consumerId, types.CONSUMER_PHASE_LAUNCHED) + + // expect an empty consumer valset + // since neither QueueVSCPackets or MakeConsumerGenesis was called at this point + res, err = pk.QueryConsumerValidators(ctx, &req) + require.NoError(t, err) + require.Empty(t, res) + + // set consumer valset + pk.SetConsumerValSet(ctx, consumerId, []types.ConsensusValidator{ + consumerValidator1, + consumerValidator2, + consumerValidator3, + }) + + expRes.Validators = append(expRes.Validators, &types.QueryConsumerValidatorsValidator{ + ProviderAddress: providerAddr3.String(), + ConsumerKey: &pk3, + ConsumerPower: 3, + ConsumerCommissionRate: val3.Commission.Rate, + Description: val3.Description, + ProviderOperatorAddress: val3.OperatorAddress, + Jailed: val3.Jailed, + Status: val3.Status, + ProviderTokens: val3.Tokens, + ProviderCommissionRate: val3.Commission.Rate, + ProviderPower: 3, + ValidatesCurrentEpoch: true, + }) + + // sort the address of the validators by ascending lexical order as they were persisted to the store + sort.Slice(expRes.Validators, func(i, j int) bool { + return bytes.Compare( + expRes.Validators[i].ConsumerKey.GetEd25519(), + expRes.Validators[j].ConsumerKey.GetEd25519(), + ) == -1 + }) + + res, err = pk.QueryConsumerValidators(ctx, &req) + require.NoError(t, err) + require.Equal(t, &expRes, 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) { pk, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - val := createStakingValidator(ctx, mocks, 1, 1, 1) + val := createStakingValidator(ctx, mocks, 1, 1) valConsAddr, _ := val.GetConsAddr() providerAddr := types.NewProviderConsAddress(valConsAddr) mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, valConsAddr).Return(val, nil).AnyTimes() @@ -162,14 +303,33 @@ func TestQueryConsumerChainsValidatorHasToValidate(t *testing.T) { ProviderAddress: providerAddr.String(), } + consumerNum := 4 + consumerIds := make([]string, consumerNum) + + msgServer := keeper.NewMsgServerImpl(&pk) + // set up some consumer chains - consumerChains := []string{"chain1", "chain2", "chain3", "chain4"} - for _, cc := range consumerChains { - pk.SetConsumerClientId(ctx, cc, "clientID") + for i := 0; i < consumerNum; i++ { + chainID := "consumer-" + strconv.Itoa(i) + metadata := types.ConsumerMetadata{Name: chainID} + msg := types.MsgCreateConsumer{ + ChainId: chainID, + Metadata: metadata, + } + resp, err := msgServer.CreateConsumer(ctx, &msg) + require.NoError(t, err) + consumerId := resp.ConsumerId + + // set a consumer client id, so that `GetAllConsumersWithIBCClients` is non-empty + clientID := "client-" + strconv.Itoa(i) + pk.SetConsumerClientId(ctx, consumerId, clientID) + + pk.SetConsumerPhase(ctx, consumerId, types.CONSUMER_PHASE_LAUNCHED) + consumerIds[i] = consumerId } - // set `providerAddr` as a consumer validator on "chain1" - pk.SetConsumerValidator(ctx, "chain1", types.ConsensusValidator{ + // set `providerAddr` as a consumer validator on first consumer chain + pk.SetConsumerValidator(ctx, consumerIds[0], types.ConsensusValidator{ ProviderConsAddr: providerAddr.ToSdkConsAddr(), Power: 1, PublicKey: &crypto.PublicKey{ @@ -179,32 +339,33 @@ func TestQueryConsumerChainsValidatorHasToValidate(t *testing.T) { }, }) - // set `providerAddr` as an opted-in validator on "chain3" - pk.SetOptedIn(ctx, "chain3", providerAddr) + // set `providerAddr` as an opted-in validator on third consumer chain + pk.SetOptedIn(ctx, consumerIds[2], providerAddr) // set max provider consensus vals to include all validators params := pk.GetParams(ctx) params.MaxProviderConsensusValidators = 3 pk.SetParams(ctx, params) - // `providerAddr` has to validate "chain1" because it is a consumer validator in this chain, as well as "chain3" - // because it opted in, in "chain3" and `providerAddr` belongs to the bonded validators - expectedChains := []string{"chain1", "chain3"} + // `providerAddr` has to validate + // - first consumer because it is a consumer validator in this chain, + // - third consumer because it opted in + expectedChains := []string{consumerIds[0], consumerIds[2]} res, err := pk.QueryConsumerChainsValidatorHasToValidate(ctx, &req) require.NoError(t, err) - require.Equal(t, expectedChains, res.ConsumerChainIds) + require.Equal(t, expectedChains, res.ConsumerIds) } 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 +373,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, types.CONSUMER_PHASE_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 @@ -236,6 +399,8 @@ func TestGetConsumerChain(t *testing.T) { pk, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() + consumerIDs := []string{"1", "23", "345", "6789"} + chainIDs := []string{"chain-1", "chain-2", "chain-3", "chain-4"} // mock the validator set @@ -289,22 +454,28 @@ func TestGetConsumerChain(t *testing.T) { math.NewInt(300), } + metadataLists := []types.ConsumerMetadata{} + expectedGetAllOrder := []types.Chain{} - for i, chainID := range chainIDs { - clientID := fmt.Sprintf("client-%d", len(chainIDs)-i) + for i, consumerID := range consumerIDs { + pk.SetConsumerChainId(ctx, consumerID, chainIDs[i]) + clientID := fmt.Sprintf("client-%d", len(consumerID)-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.SetMinimumPowerInTopN(ctx, chainID, expectedMinPowerInTopNs[i]) - pk.SetInactiveValidatorsAllowed(ctx, chainID, allowInactiveVals[i]) - pk.SetMinStake(ctx, chainID, minStakes[i].Uint64()) + pk.SetConsumerClientId(ctx, consumerID, clientID) + err := pk.SetConsumerPowerShapingParameters(ctx, consumerID, types.PowerShapingParameters{ + Top_N: topN, + ValidatorSetCap: validatorSetCaps[i], + ValidatorsPowerCap: validatorPowerCaps[i], + MinStake: minStakes[i].Uint64(), + AllowInactiveVals: allowInactiveVals[i], + }) + require.NoError(t, err) + 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] { @@ -316,9 +487,15 @@ func TestGetConsumerChain(t *testing.T) { strDenylist[j] = addr.String() } + metadataLists = append(metadataLists, types.ConsumerMetadata{Name: chainIDs[i]}) + pk.SetConsumerMetadata(ctx, consumerID, metadataLists[i]) + + phase := types.ConsumerPhase(int32(i + 1)) + pk.SetConsumerPhase(ctx, consumerID, phase) + expectedGetAllOrder = append(expectedGetAllOrder, types.Chain{ - ChainId: chainID, + ChainId: chainIDs[i], ClientId: clientID, Top_N: topN, MinPowerInTop_N: expectedMinPowerInTopNs[i], @@ -326,14 +503,229 @@ func TestGetConsumerChain(t *testing.T) { ValidatorsPowerCap: validatorPowerCaps[i], Allowlist: strAllowlist, Denylist: strDenylist, + Phase: phase.String(), + Metadata: metadataLists[i], AllowInactiveVals: allowInactiveVals[i], MinStake: minStakes[i].Uint64(), + ConsumerId: consumerIDs[i], }) } - for i, chainID := range pk.GetAllRegisteredAndProposedChainIDs(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) } } + +func TestQueryConsumerChain(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + consumerId := "0" + chainId := "consumer-1" + + req := types.QueryConsumerChainRequest{ + ConsumerId: consumerId, + } + + // expect error when consumer isn't associated with a chain id + _, err := providerKeeper.QueryConsumerChain(ctx, &req) + require.Error(t, err) + + providerKeeper.SetConsumerChainId(ctx, consumerId, chainId) + + // expect error when consumer doesn't have an owner address set + _, err = providerKeeper.QueryConsumerChain(ctx, &req) + require.Error(t, err) + + providerKeeper.SetConsumerOwnerAddress(ctx, consumerId, providerKeeper.GetAuthority()) + + // expect error when consumer doesn't have a valid phase + _, err = providerKeeper.QueryConsumerChain(ctx, &req) + require.Error(t, err) + + providerKeeper.SetConsumerPhase(ctx, consumerId, types.CONSUMER_PHASE_REGISTERED) + + // expect error when consumer doesn't have metadata + _, err = providerKeeper.QueryConsumerChain(ctx, &req) + require.Error(t, err) + + err = providerKeeper.SetConsumerMetadata(ctx, consumerId, types.ConsumerMetadata{Name: chainId}) + require.NoError(t, err) + + expRes := types.QueryConsumerChainResponse{ + ChainId: chainId, + OwnerAddress: providerKeeper.GetAuthority(), + Metadata: types.ConsumerMetadata{Name: chainId}, + Phase: types.CONSUMER_PHASE_REGISTERED.String(), + InitParams: &types.ConsumerInitializationParameters{}, + PowerShapingParams: &types.PowerShapingParameters{}, + } + + // expect no error when neither the consumer init and power shaping params are set + res, err := providerKeeper.QueryConsumerChain(ctx, &req) + require.NoError(t, err) + require.Equal(t, &expRes, res) + + err = providerKeeper.SetConsumerInitializationParameters( + ctx, + consumerId, + types.ConsumerInitializationParameters{SpawnTime: ctx.BlockTime()}, + ) + require.NoError(t, err) + + err = providerKeeper.SetConsumerPowerShapingParameters( + ctx, + consumerId, + types.PowerShapingParameters{Top_N: uint32(50)}, + ) + require.NoError(t, err) + + expRes.InitParams = &types.ConsumerInitializationParameters{SpawnTime: ctx.BlockTime()} + expRes.PowerShapingParams = &types.PowerShapingParameters{Top_N: uint32(50)} + + // expect no error + res, err = providerKeeper.QueryConsumerChain(ctx, &req) + require.NoError(t, err) + require.Equal(t, &expRes, res) +} + +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.SetConsumerClientId(ctx, expectedConsumerId, "clientId") + + res, err := providerKeeper.QueryConsumerIdFromClientId(ctx, &types.QueryConsumerIdFromClientIdRequest{ClientId: "clientId"}) + require.NoError(t, err) + require.Equal(t, expectedConsumerId, res.ConsumerId) +} + +func TestQueryConsumerChains(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) + + // expect no error and returned chains + res, err := pk.QueryConsumerChains(ctx, &types.QueryConsumerChainsRequest{}) + require.NoError(t, err) + require.Len(t, res.Chains, 0) + + msgServer := keeper.NewMsgServerImpl(&pk) + + phases := []types.ConsumerPhase{ + types.CONSUMER_PHASE_REGISTERED, + types.CONSUMER_PHASE_INITIALIZED, + types.CONSUMER_PHASE_LAUNCHED, + types.CONSUMER_PHASE_STOPPED, + } + + // create four consumer chains in different phase + for i := 0; i < consumerNum; i++ { + chainID := "consumer-" + strconv.Itoa(i) + metadata := types.ConsumerMetadata{Name: chainID} + msg := types.MsgCreateConsumer{ + ChainId: chainID, + Metadata: metadata, + } + resp, err := msgServer.CreateConsumer(ctx, &msg) + require.NoError(t, err) + consumerId := resp.ConsumerId + + pk.SetConsumerPhase(ctx, consumerId, phases[i]) + c := types.Chain{ + ChainId: chainID, + MinPowerInTop_N: -1, + ValidatorsPowerCap: 0, + ValidatorSetCap: 0, + Allowlist: []string{}, + Denylist: []string{}, + Phase: phases[i].String(), + Metadata: metadata, + ConsumerId: consumerId, + } + consumerIds[i] = consumerId + consumers[i] = &c + } + + testCases := []struct { + 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", + setup: func(ctx sdk.Context, pk keeper.Keeper) {}, + expConsumers: consumers, + }, + { + name: "expect an amount of consumer equal to the limit", + setup: func(ctx sdk.Context, pk keeper.Keeper) {}, + expConsumers: consumers[:3], + limit: int32(3), + }, + { + name: "expect registered consumers when phase filter is set to Registered", + setup: func(ctx sdk.Context, pk keeper.Keeper) { + consumers[0].Phase = types.CONSUMER_PHASE_REGISTERED.String() + pk.SetConsumerPhase(ctx, consumerIds[0], types.CONSUMER_PHASE_REGISTERED) + }, + phase_filter: types.CONSUMER_PHASE_REGISTERED, + expConsumers: consumers[0:1], + }, + { + name: "expect initialized consumers when phase is set to Initialized", + setup: func(ctx sdk.Context, pk keeper.Keeper) { + consumers[1].Phase = types.CONSUMER_PHASE_INITIALIZED.String() + pk.SetConsumerPhase(ctx, consumerIds[1], types.CONSUMER_PHASE_INITIALIZED) + }, + phase_filter: types.CONSUMER_PHASE_INITIALIZED, + expConsumers: consumers[1:2], + }, + { + name: "expect launched consumers when phase is set to Launched", + setup: func(ctx sdk.Context, pk keeper.Keeper) { + consumers[2].Phase = types.CONSUMER_PHASE_LAUNCHED.String() + pk.SetConsumerPhase(ctx, consumerIds[2], types.CONSUMER_PHASE_LAUNCHED) + }, + phase_filter: types.CONSUMER_PHASE_LAUNCHED, + expConsumers: consumers[2:3], + }, + { + name: "expect stopped consumers when phase is set to Stopped", + setup: func(ctx sdk.Context, pk keeper.Keeper) { + consumers[3].Phase = types.CONSUMER_PHASE_STOPPED.String() + pk.SetConsumerPhase(ctx, consumerIds[3], types.CONSUMER_PHASE_STOPPED) + }, + phase_filter: types.CONSUMER_PHASE_STOPPED, + expConsumers: consumers[3:], + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + tc.setup(ctx, pk) + req := types.QueryConsumerChainsRequest{ + Phase: tc.phase_filter, + Limit: tc.limit, + } + expectedResponse := types.QueryConsumerChainsResponse{ + Chains: tc.expConsumers, + } + res, err := pk.QueryConsumerChains(ctx, &req) + require.NoError(t, err) + require.Equal(t, &expectedResponse, res, tc.name) + }) + } +} diff --git a/x/ccv/provider/keeper/hooks.go b/x/ccv/provider/keeper/hooks.go index 3f7f9d21a9..f61facac50 100644 --- a/x/ccv/provider/keeper/hooks.go +++ b/x/ccv/provider/keeper/hooks.go @@ -105,27 +105,11 @@ func (h Hooks) BeforeTokenizeShareRecordRemoved(_ context.Context, _ uint64) err // gov hooks // -// 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 { - ctx := sdk.UnwrapSDKContext(goCtx) - if p, ok := h.GetConsumerAdditionFromProp(ctx, proposalID); ok { - h.k.SetProposedConsumerChain(ctx, p.ChainId, proposalID) - } +func (h Hooks) AfterProposalSubmission(goCtx context.Context, proposalId uint64) error { 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 { - ctx := sdk.UnwrapSDKContext(goCtx) - - if _, ok := h.GetConsumerAdditionFromProp(ctx, proposalID); ok { - h.k.DeleteProposedConsumerChainInStore(ctx, proposalID) - } +func (h Hooks) AfterProposalVotingPeriodEnded(goCtx context.Context, proposalId uint64) error { return nil } @@ -140,50 +124,3 @@ func (h Hooks) AfterProposalVote(ctx context.Context, proposalID uint64, voterAd func (h Hooks) AfterProposalFailedMinDeposit(ctx context.Context, proposalID uint64) error { return nil } - -// GetConsumerAdditionFromProp extracts a consumer addition proposal from -// the proposal with the given ID -func (h Hooks) GetConsumerAdditionFromProp( - ctx sdk.Context, - proposalID uint64, -) (providertypes.ConsumerAdditionProposal, bool) { - p, err := h.k.govKeeper.Proposals.Get(ctx, proposalID) - if err != nil { - return providertypes.ConsumerAdditionProposal{}, false - } - - // Iterate over the messages in the proposal - // Note that it's assumed that at most ONE message can contain a consumer addition proposal - for _, msg := range p.GetMessages() { - sdkMsg, isConsumerAddition := msg.GetCachedValue().(*providertypes.MsgConsumerAddition) - if !isConsumerAddition { - continue - } - - proposal := providertypes.ConsumerAdditionProposal{ - Title: p.Title, - Description: p.Summary, - ChainId: sdkMsg.ChainId, - InitialHeight: sdkMsg.InitialHeight, - GenesisHash: sdkMsg.GenesisHash, - BinaryHash: sdkMsg.BinaryHash, - SpawnTime: sdkMsg.SpawnTime, - UnbondingPeriod: sdkMsg.UnbondingPeriod, - CcvTimeoutPeriod: sdkMsg.CcvTimeoutPeriod, - TransferTimeoutPeriod: sdkMsg.TransferTimeoutPeriod, - ConsumerRedistributionFraction: sdkMsg.ConsumerRedistributionFraction, - BlocksPerDistributionTransmission: sdkMsg.BlocksPerDistributionTransmission, - HistoricalEntries: sdkMsg.HistoricalEntries, - DistributionTransmissionChannel: sdkMsg.DistributionTransmissionChannel, - Top_N: sdkMsg.Top_N, - ValidatorsPowerCap: sdkMsg.ValidatorsPowerCap, - ValidatorSetCap: sdkMsg.ValidatorSetCap, - Allowlist: sdkMsg.Allowlist, - Denylist: sdkMsg.Denylist, - MinStake: sdkMsg.MinStake, - AllowInactiveVals: sdkMsg.AllowInactiveVals, - } - return proposal, true - } - return providertypes.ConsumerAdditionProposal{}, false -} diff --git a/x/ccv/provider/keeper/hooks_test.go b/x/ccv/provider/keeper/hooks_test.go index 2447b5edf3..e76eece5ad 100644 --- a/x/ccv/provider/keeper/hooks_test.go +++ b/x/ccv/provider/keeper/hooks_test.go @@ -7,6 +7,7 @@ import ( 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/cosmos/interchain-security/v5/x/ccv/provider/types" "github.com/golang/mock/gomock" ) @@ -30,32 +31,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", types.CONSUMER_PHASE_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", types.CONSUMER_PHASE_INITIALIZED) + k.SetConsumerPhase(ctx, "1", types.CONSUMER_PHASE_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..3d624f10f3 100644 --- a/x/ccv/provider/keeper/keeper.go +++ b/x/ccv/provider/keeper/keeper.go @@ -189,171 +189,113 @@ 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) { - store := ctx.KVStore(k.storeKey) - store.Set(types.ProposedConsumerChainKey(proposalID), []byte(chainID)) -} - -// GetProposedConsumerChain returns the proposed chainID for the given consumerAddition proposal ID. -// This method is only used for testing. -func (k Keeper) GetProposedConsumerChain(ctx sdk.Context, proposalID uint64) (string, bool) { - store := ctx.KVStore(k.storeKey) - 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) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.ProposedConsumerChainKey(proposalID)) -} +// GetAllConsumersWithIBCClients returns the ids of all consumer chains that with IBC clients created. +func (k Keeper) GetAllConsumersWithIBCClients(ctx sdk.Context) []string { + consumerIds := []string{} -// GetAllProposedConsumerChainIDs returns the proposed chainID of all gov consumerAddition 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()) + iterator := storetypes.KVStorePrefixIterator(store, types.ConsumerIdToClientIdKeyPrefix()) defer iterator.Close() - proposedChains := []types.ProposedChain{} for ; iterator.Valid(); iterator.Next() { - proposalID, err := types.ParseProposedConsumerChainKey(iterator.Key()) - if err != nil { - panic(fmt.Errorf("proposed chains cannot be parsed: %w", err)) - } - - proposedChains = append(proposedChains, types.ProposedChain{ - ChainID: string(iterator.Value()), - ProposalID: proposalID, - }) - + // remove 1 byte prefix from key to retrieve consumerId + consumerId := string(iterator.Key()[1:]) + consumerIds = append(consumerIds, consumerId) } - return proposedChains + return consumerIds } -// GetAllPendingConsumerChainIDs gets pending consumer chains have not reach spawn time -func (k Keeper) GetAllPendingConsumerChainIDs(ctx sdk.Context) []string { - chainIDs := []string{} - props := k.GetAllPendingConsumerAdditionProps(ctx) - for _, prop := range props { - chainIDs = append(chainIDs, prop.ChainId) - } - - return chainIDs -} - -// GetAllRegisteredConsumerChainIDs 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 -// Thus, the returned array is in ascending order of chainIDs. -func (k Keeper) GetAllRegisteredConsumerChainIDs(ctx sdk.Context) []string { - chainIDs := []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) - iterator := storetypes.KVStorePrefixIterator(store, types.ChainToClientKeyPrefix()) - 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) - } - - return chainIDs + store.Set(types.ChannelToConsumerIdKey(channelId), []byte(consumerId)) } -// SetChannelToChain sets the mapping from the CCV channel ID to the consumer chainID. -func (k Keeper) SetChannelToChain(ctx sdk.Context, channelID, chainID string) { +// 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) - store.Set(types.ChannelToChainKey(channelID), []byte(chainID)) -} - -// GetChannelToChain gets the consumer chainID for a given CCV channelID -func (k Keeper) GetChannelToChain(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 +309,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 +321,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.ErrClientNotFound, "cannot find client for consumer chain %s", tmClient.ChainId) + return errorsmod.Wrapf(ccv.ErrConsumerChainNotFound, "cannot find consumer id associated with client id: %s", 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) + ccvClientId, found := k.GetConsumerClientId(ctx, consumerId) + if !found { + 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) } // 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,25 +365,30 @@ 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( sdk.NewEvent( ccv.EventTypeChannelEstablished, sdk.NewAttribute(sdk.AttributeKeyModule, consumertypes.ModuleName), - sdk.NewAttribute(ccv.AttributeChainID, chainID), + sdk.NewAttribute(types.AttributeConsumerId, consumerId), + sdk.NewAttribute(types.AttributeConsumerChainId, chainID), sdk.NewAttribute(conntypes.AttributeKeyClientID, clientID), sdk.NewAttribute(channeltypes.AttributeKeyChannelID, channelID), sdk.NewAttribute(conntypes.AttributeKeyConnectionID, connectionID), @@ -554,7 +506,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 +518,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 +541,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 +588,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 +611,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 +623,63 @@ 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. +// Note that the method also stores a reverse index that can be accessed +// by calling GetClientIdToConsumerId. +func (k Keeper) SetConsumerClientId(ctx sdk.Context, consumerId, clientId string) { store := ctx.KVStore(k.storeKey) - store.Set(types.ChainToClientKey(chainID), []byte(clientID)) + + if prevClientId, found := k.GetConsumerClientId(ctx, consumerId); found { + // delete reverse index + store.Delete(types.ClientIdToConsumerIdKey(prevClientId)) + } + + store.Set(types.ConsumerIdToClientIdKey(consumerId), []byte(clientId)) + + // set the reverse index + store.Set(types.ClientIdToConsumerIdKey(clientId), []byte(consumerId)) } -// 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) { +// 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) - store.Delete(types.ChainToClientKey(chainID)) + consumerIdBytes := store.Get(types.ClientIdToConsumerIdKey(clientId)) + if consumerIdBytes == nil { + return "", false + } + return string(consumerIdBytes), true +} + +// DeleteConsumerClientId removes from the store the client id for the given consumer id. +// Note that the method also removes the reverse index. +func (k Keeper) DeleteConsumerClientId(ctx sdk.Context, consumerId string) { + store := ctx.KVStore(k.storeKey) + + if clientId, found := k.GetConsumerClientId(ctx, consumerId); found { + // delete reverse index + store.Delete(types.ClientIdToConsumerIdKey(clientId)) + } + + store.Delete(types.ConsumerIdToClientIdKey(consumerId)) } // SetSlashLog updates validator's slash log for a consumer chain @@ -728,101 +708,68 @@ 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) +// GetAllConsumerIds returns all the existing consumer ids +func (k Keeper) GetAllConsumerIds(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) -} - -// 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)) -} -// GetTopN returns (N, true) if chain `chainID` has a top N associated, and (0, false) 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 + consumerIds := []string{} + for i := uint64(0); i < latestConsumerId; i++ { + consumerId := fmt.Sprintf("%d", i) + consumerIds = append(consumerIds, consumerId) } - return binary.BigEndian.Uint32(buf), true -} -// 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 + return consumerIds } -// 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 +// GetAllActiveConsumerIds returns all the consumer ids of chains that are registered, initialized, or launched +func (k Keeper) GetAllActiveConsumerIds(ctx sdk.Context) []string { + consumerIds := []string{} + for _, consumerId := range k.GetAllConsumerIds(ctx) { + if !k.IsConsumerActive(ctx, consumerId) { + continue + } + consumerIds = append(consumerIds, consumerId) + } + return consumerIds } 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.StringIdWithLenKey(types.OptedInKeyPrefix(), consumerId) iterator := storetypes.KVStorePrefixIterator(store, key) defer iterator.Close() @@ -833,13 +780,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.StringIdWithLenKey(types.OptedInKeyPrefix(), consumerId) iterator := storetypes.KVStorePrefixIterator(store, key) var keysToDel [][]byte @@ -856,7 +803,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 +815,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 +823,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 +843,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.StringIdWithLenKey(types.ConsumerCommissionRateKeyPrefix(), consumerId) iterator := storetypes.KVStorePrefixIterator(store, key) defer iterator.Close() @@ -918,331 +865,11 @@ func (k Keeper) GetAllCommissionRateValidators( // associated to the given validator address func (k Keeper) DeleteConsumerCommissionRate( ctx sdk.Context, - chainID 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)) -} - -// GetValidatorsPowerCap returns `(p, true)` if chain `chainID` has power cap `p` associated with it, and (0, false) otherwise -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 - } - return binary.BigEndian.Uint32(buf), true -} - -// 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 -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 - } - return binary.BigEndian.Uint32(buf), true -} - -// SetAllowlist allowlists validator with `providerAddr` address on chain `chainID` -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{}) -} - -// GetAllowList returns all allowlisted validators -func (k Keeper) GetAllowList( - ctx sdk.Context, - chainID string, -) (providerConsAddresses []types.ProviderConsAddress) { - store := ctx.KVStore(k.storeKey) - key := types.ChainIdWithLenKey(types.AllowlistKeyPrefix(), chainID) - iterator := storetypes.KVStorePrefixIterator(store, key) - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - providerConsAddresses = append(providerConsAddresses, types.NewProviderConsAddress(iterator.Key()[len(key):])) - } - - return providerConsAddresses -} - -// IsAllowlisted returns `true` if validator with `providerAddr` has been allowlisted on chain `chainID` -func (k Keeper) IsAllowlisted( - ctx sdk.Context, - chainID string, - providerAddr types.ProviderConsAddress, -) bool { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.AllowlistKey(chainID, providerAddr)) - return bz != nil -} - -// DeleteAllowlist deletes all allowlisted validators -func (k Keeper) DeleteAllowlist(ctx sdk.Context, chainID string) { - store := ctx.KVStore(k.storeKey) - iterator := storetypes.KVStorePrefixIterator(store, types.ChainIdWithLenKey(types.AllowlistKeyPrefix(), chainID)) - defer iterator.Close() - - keysToDel := [][]byte{} - for ; iterator.Valid(); iterator.Next() { - keysToDel = append(keysToDel, iterator.Key()) - } - - for _, key := range keysToDel { - store.Delete(key) - } -} - -// IsAllowlistEmpty returns `true` if no validator is allowlisted on chain `chainID` -func (k Keeper) IsAllowlistEmpty(ctx sdk.Context, chainID string) bool { - store := ctx.KVStore(k.storeKey) - iterator := storetypes.KVStorePrefixIterator(store, types.ChainIdWithLenKey(types.AllowlistKeyPrefix(), chainID)) - defer iterator.Close() - - return !iterator.Valid() -} - -// SetDenylist denylists validator with `providerAddr` address on chain `chainID` -func (k Keeper) SetDenylist( - ctx sdk.Context, - chainID string, - providerAddr types.ProviderConsAddress, -) { - store := ctx.KVStore(k.storeKey) - store.Set(types.DenylistKey(chainID, providerAddr), []byte{}) -} - -// GetDenyList returns all denylisted validators -func (k Keeper) GetDenyList( - ctx sdk.Context, - chainID string, -) (providerConsAddresses []types.ProviderConsAddress) { - store := ctx.KVStore(k.storeKey) - key := types.ChainIdWithLenKey(types.DenylistKeyPrefix(), chainID) - iterator := storetypes.KVStorePrefixIterator(store, key) - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - providerConsAddresses = append(providerConsAddresses, types.NewProviderConsAddress(iterator.Key()[len(key):])) - } - - return providerConsAddresses -} - -// IsDenylisted returns `true` if validator with `providerAddr` has been denylisted on chain `chainID` -func (k Keeper) IsDenylisted( - ctx sdk.Context, - chainID string, - providerAddr types.ProviderConsAddress, -) bool { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.DenylistKey(chainID, providerAddr)) - return bz != nil -} - -// DeleteDenylist deletes all denylisted validators -func (k Keeper) DeleteDenylist(ctx sdk.Context, chainID string) { - store := ctx.KVStore(k.storeKey) - iterator := storetypes.KVStorePrefixIterator(store, types.ChainIdWithLenKey(types.DenylistKeyPrefix(), chainID)) - defer iterator.Close() - - keysToDel := [][]byte{} - for ; iterator.Valid(); iterator.Next() { - keysToDel = append(keysToDel, iterator.Key()) - } - - for _, key := range keysToDel { - store.Delete(key) - } -} - -// IsDenylistEmpty returns `true` if no validator is denylisted on chain `chainID` -func (k Keeper) IsDenylistEmpty(ctx sdk.Context, chainID string) bool { - store := ctx.KVStore(k.storeKey) - iterator := storetypes.KVStorePrefixIterator(store, types.ChainIdWithLenKey(types.DenylistKeyPrefix(), chainID)) - defer iterator.Close() - - return !iterator.Valid() -} - -// SetMinimumPowerInTopN sets the minimum power required for a validator to be in the top N -// for a given consumer chain. -func (k Keeper) SetMinimumPowerInTopN( - ctx sdk.Context, - chainID string, - power int64, -) { - store := ctx.KVStore(k.storeKey) - - buf := make([]byte, 8) - binary.BigEndian.PutUint64(buf, uint64(power)) - - store.Set(types.MinimumPowerInTopNKey(chainID), 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, -) (int64, bool) { - store := ctx.KVStore(k.storeKey) - buf := store.Get(types.MinimumPowerInTopNKey(chainID)) - if buf == nil { - return 0, false - } - return int64(binary.BigEndian.Uint64(buf)), true -} - -// DeleteMinimumPowerInTopN removes the minimum power required for a validator to be in the top N -// for a given consumer chain. -func (k Keeper) DeleteMinimumPowerInTopN( - ctx sdk.Context, - chainID 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) -} - -// GetMinStake returns the minimum stake required for a validator to validate -// a given consumer chain. -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) - } -} - -// 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{}) -} - -// AllowsInactiveValidators returns whether inactive validators are allowed to validate -// a given consumer chain. -func (k Keeper) AllowsInactiveValidators( - ctx sdk.Context, - chainID 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)) + store.Delete(types.ConsumerCommissionRateKey(consumerId, providerAddr)) } 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..9485c9efd7 100644 --- a/x/ccv/provider/keeper/keeper_test.go +++ b/x/ccv/provider/keeper/keeper_test.go @@ -11,14 +11,13 @@ import ( "github.com/stretchr/testify/require" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" - sdk "github.com/cosmos/cosmos-sdk/types" abci "github.com/cometbft/cometbft/abci/types" tmprotocrypto "github.com/cometbft/cometbft/proto/tendermint/crypto" 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/types" + providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" ) @@ -55,7 +54,7 @@ func TestGetAllValsetUpdateBlockHeights(t *testing.T) { pk, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - cases := []types.ValsetUpdateIdToHeight{ + cases := []providertypes.ValsetUpdateIdToHeight{ { ValsetUpdateId: 2, Height: 22, @@ -224,43 +223,56 @@ func TestInitHeight(t *testing.T) { } } -func TestGetAllRegisteredConsumerChainIDs(t *testing.T) { +func TestGetAllConsumersWithIBCClients(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"} - // GetAllRegisteredConsumerChainIDs iterates over chainID in lexicographical order - expectedChainIDs := []string{"chain-1", "chain-2", "chain-3", "chain-4"} - - for i, chainID := range chainIDs { - clientID := fmt.Sprintf("client-%d", len(chainIDs)-i) - pk.SetConsumerClientId(ctx, chainID, clientID) + consumerIds := []string{"2", "1", "4", "3"} + for i, consumerId := range consumerIds { + clientId := fmt.Sprintf("client-%d", len(consumerIds)-i) + pk.SetConsumerClientId(ctx, consumerId, clientId) + pk.SetConsumerPhase(ctx, consumerId, providertypes.CONSUMER_PHASE_LAUNCHED) } - result := pk.GetAllRegisteredConsumerChainIDs(ctx) - require.Len(t, result, len(chainIDs)) - require.Equal(t, expectedChainIDs, result) + actualConsumerIds := pk.GetAllConsumersWithIBCClients(ctx) + require.Len(t, actualConsumerIds, len(consumerIds)) + + // sort the consumer ids before comparing they are equal + sort.Slice(consumerIds, func(i, j int) bool { + return consumerIds[i] < consumerIds[j] + }) + sort.Slice(actualConsumerIds, func(i, j int) bool { + return actualConsumerIds[i] < actualConsumerIds[j] + }) + require.Equal(t, consumerIds, actualConsumerIds) } -// 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) } @@ -277,150 +289,24 @@ func TestSetSlashLog(t *testing.T) { require.False(t, providerKeeper.GetSlashLog(ctx, addrWithoutDoubleSigns)) } -func TestSetProposedConsumerChains(t *testing.T) { - providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - defer ctrl.Finish() - - tests := []struct { - chainID string - proposalID uint64 - }{ - {chainID: "1", proposalID: 1}, - {chainID: "some other ID", proposalID: 12}, - {chainID: "some other other chain ID", proposalID: 123}, - {chainID: "", 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) - } -} - -func TestDeleteProposedConsumerChainInStore(t *testing.T) { - providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - defer ctrl.Finish() - - tests := []struct { - 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}, - } - for _, test := range tests { - providerKeeper.SetProposedConsumerChain(ctx, test.chainID, test.proposalID) - providerKeeper.DeleteProposedConsumerChainInStore(ctx, test.deleteProposalID) - cID, found := providerKeeper.GetProposedConsumerChain(ctx, test.proposalID) - if test.ok { - require.False(t, found) - } else { - require.Equal(t, cID, test.chainID) - } - } -} - -func TestGetAllProposedConsumerChainIDs(t *testing.T) { - providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - defer ctrl.Finish() - tests := [][]types.ProposedChain{ - {}, - { - { - ChainID: "1", - ProposalID: 1, - }, - }, - { - { - ChainID: "1", - ProposalID: 1, - }, - { - ChainID: "2", - ProposalID: 2, - }, - { - ChainID: "", - ProposalID: 3, - }, - }, - } - - for _, test := range tests { - for _, tc := range test { - providerKeeper.SetProposedConsumerChain(ctx, tc.ChainID, tc.ProposalID) - } - - chains := providerKeeper.GetAllProposedConsumerChainIDs(ctx) - - sort.Slice(chains, func(i, j int) bool { - return chains[i].ProposalID < chains[j].ProposalID - }) - sort.Slice(test, func(i, j int) bool { - return test[i].ProposalID < test[j].ProposalID - }) - require.Equal(t, chains, test) - - for _, tc := range test { - providerKeeper.DeleteProposedConsumerChainInStore(ctx, tc.ProposalID) - } - } -} - -// TestTopN tests the `SetTopN`, `GetTopN`, `IsTopN`, and `IsOptIn` methods -func TestTopN(t *testing.T) { - providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - defer ctrl.Finish() - - tests := []struct { - chainID string - N uint32 - isOptIn bool - }{ - {chainID: "TopNChain1", N: 50, isOptIn: false}, - {chainID: "TopNChain2", N: 100, isOptIn: false}, - {chainID: "OptInChain", N: 0, isOptIn: true}, - } - - for _, test := range tests { - providerKeeper.SetTopN(ctx, test.chainID, test.N) - topN, found := providerKeeper.GetTopN(ctx, test.chainID) - 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)) - } else { - require.False(t, providerKeeper.IsOptIn(ctx, test.chainID)) - require.True(t, providerKeeper.IsTopN(ctx, test.chainID)) - } - } -} - func TestGetAllOptedIn(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - expectedOptedInValidators := []types.ProviderConsAddress{ - types.NewProviderConsAddress([]byte("providerAddr1")), - types.NewProviderConsAddress([]byte("providerAddr2")), - types.NewProviderConsAddress([]byte("providerAddr3")), + expectedOptedInValidators := []providertypes.ProviderConsAddress{ + providertypes.NewProviderConsAddress([]byte("providerAddr1")), + providertypes.NewProviderConsAddress([]byte("providerAddr2")), + providertypes.NewProviderConsAddress([]byte("providerAddr3")), } 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) { + sortOptedInValidators := func(addresses []providertypes.ProviderConsAddress) { sort.Slice(addresses, func(i, j int) bool { return bytes.Compare(addresses[i].ToSdkConsAddr(), addresses[j].ToSdkConsAddr()) < 0 }) @@ -435,22 +321,22 @@ func TestOptedIn(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - 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)) + optedInValidator1 := providertypes.NewProviderConsAddress([]byte("providerAddr1")) + optedInValidator2 := providertypes.NewProviderConsAddress([]byte("providerAddr2")) + + 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 @@ -458,211 +344,78 @@ func TestConsumerCommissionRate(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - providerAddr1 := types.NewProviderConsAddress([]byte("providerAddr1")) - providerAddr2 := types.NewProviderConsAddress([]byte("providerAddr2")) + providerAddr1 := providertypes.NewProviderConsAddress([]byte("providerAddr1")) + providerAddr2 := providertypes.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) } -// TestAllowlist tests the `SetAllowlist`, `IsAllowlisted`, `DeleteAllowlist`, and `IsAllowlistEmpty` methods -func TestAllowlist(t *testing.T) { +// TestConsumerClientId tests the getter, setter, and deletion of the client id <> consumer id mappings +func TestConsumerClientId(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - chainID := "chainID" - - // no validator was allowlisted and hence the allowlist is empty - require.True(t, providerKeeper.IsAllowlistEmpty(ctx, chainID)) - - providerAddr1 := types.NewProviderConsAddress([]byte("providerAddr1")) - providerKeeper.SetAllowlist(ctx, chainID, providerAddr1) - require.True(t, providerKeeper.IsAllowlisted(ctx, chainID, providerAddr1)) - - // allowlist is not empty anymore - require.False(t, providerKeeper.IsAllowlistEmpty(ctx, chainID)) + consumerId := "123" + clientIds := []string{"clientId1", "clientId2"} - providerAddr2 := types.NewProviderConsAddress([]byte("providerAddr2")) - providerKeeper.SetAllowlist(ctx, chainID, providerAddr2) - require.True(t, providerKeeper.IsAllowlisted(ctx, chainID, providerAddr2)) - require.False(t, providerKeeper.IsAllowlistEmpty(ctx, chainID)) - - providerKeeper.DeleteAllowlist(ctx, chainID) - require.False(t, providerKeeper.IsAllowlisted(ctx, chainID, providerAddr1)) - require.False(t, providerKeeper.IsAllowlisted(ctx, chainID, providerAddr2)) - require.True(t, providerKeeper.IsAllowlistEmpty(ctx, chainID)) -} - -// TestDenylist tests the `SetDenylist`, `IsDenylisted`, `DeleteDenylist`, and `IsDenylistEmpty` methods -func TestDenylist(t *testing.T) { - providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - defer ctrl.Finish() - - chainID := "chainID" - - // no validator was denylisted and hence the denylist is empty - require.True(t, providerKeeper.IsDenylistEmpty(ctx, chainID)) - - providerAddr1 := types.NewProviderConsAddress([]byte("providerAddr1")) - providerKeeper.SetDenylist(ctx, chainID, providerAddr1) - require.True(t, providerKeeper.IsDenylisted(ctx, chainID, providerAddr1)) - - // denylist is not empty anymore - require.False(t, providerKeeper.IsDenylistEmpty(ctx, chainID)) - - providerAddr2 := types.NewProviderConsAddress([]byte("providerAddr2")) - providerKeeper.SetDenylist(ctx, chainID, providerAddr2) - require.True(t, providerKeeper.IsDenylisted(ctx, chainID, providerAddr2)) - require.False(t, providerKeeper.IsDenylistEmpty(ctx, chainID)) - - providerKeeper.DeleteDenylist(ctx, chainID) - require.False(t, providerKeeper.IsDenylisted(ctx, chainID, providerAddr1)) - require.False(t, providerKeeper.IsDenylisted(ctx, chainID, providerAddr2)) - require.True(t, providerKeeper.IsDenylistEmpty(ctx, chainID)) -} - -// TestAllowInactiveValidators tests the `SetAllowInactiveValidators` and `AllowsInactiveValidators` methods -func TestAllowInactiveValidators(t *testing.T) { - k, ctx, _, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - - chainID := "chainID" - - // check that by default, AllowsInactiveValidators returns false - require.False(t, k.AllowsInactiveValidators(ctx, chainID)) - - // set the chain to allow inactive validators - k.SetInactiveValidatorsAllowed(ctx, chainID, true) - - // check that AllowsInactiveValidators returns true - require.True(t, k.AllowsInactiveValidators(ctx, chainID)) - - // set the chain to not allow inactive validators - k.SetInactiveValidatorsAllowed(ctx, chainID, false) - - // check that AllowsInactiveValidators returns false - require.False(t, k.AllowsInactiveValidators(ctx, chainID)) -} - -// Tests setting, getting and deleting parameters that are stored per-consumer chain. -// The tests cover the following parameters: -// - MinimumPowerInTopN -// - MinStake -// - ValidatorSetCap -// - ValidatorPowersCap -func TestKeeperConsumerParams(t *testing.T) { - k, ctx, _, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - - tests := []struct { - name string - settingFunc func(sdk.Context, string, int64) - getFunc func(sdk.Context, string) (int64, bool) - 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) }, - 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 - }, - deleteFunc: func(ctx sdk.Context, id string) { k.DeleteMinStake(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 - }, - deleteFunc: func(ctx sdk.Context, id string) { k.DeleteValidatorSetCap(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 - }, - deleteFunc: func(ctx sdk.Context, id string) { k.DeleteValidatorsPowerCap(ctx, id) }, - initialValue: 10, - updatedValue: 11, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - chainID := "chainID" - // 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) - 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) - require.EqualValues(t, tt.updatedValue, newActualValue) - - // Check non-existent chain ID - _, found = tt.getFunc(ctx, "not the chainID") - require.False(t, found) - - // Delete value - tt.deleteFunc(ctx, chainID) + _, found := providerKeeper.GetConsumerClientId(ctx, consumerId) + require.False(t, found) + _, found = providerKeeper.GetClientIdToConsumerId(ctx, clientIds[0]) + require.False(t, found) + _, found = providerKeeper.GetClientIdToConsumerId(ctx, clientIds[1]) + require.False(t, found) - // Check that value was deleted - _, found = tt.getFunc(ctx, chainID) - require.False(t, found) + providerKeeper.SetConsumerClientId(ctx, consumerId, clientIds[0]) + res, found := providerKeeper.GetConsumerClientId(ctx, consumerId) + require.True(t, found) + require.Equal(t, clientIds[0], res) + res, found = providerKeeper.GetClientIdToConsumerId(ctx, clientIds[0]) + require.True(t, found) + require.Equal(t, consumerId, res) + _, found = providerKeeper.GetClientIdToConsumerId(ctx, clientIds[1]) + require.False(t, found) - // Try deleting again - tt.deleteFunc(ctx, chainID) + // overwrite the client ID + providerKeeper.SetConsumerClientId(ctx, consumerId, clientIds[1]) + res, found = providerKeeper.GetConsumerClientId(ctx, consumerId) + require.True(t, found) + require.Equal(t, clientIds[1], res) + res, found = providerKeeper.GetClientIdToConsumerId(ctx, clientIds[1]) + require.True(t, found) + require.Equal(t, consumerId, res) + _, found = providerKeeper.GetClientIdToConsumerId(ctx, clientIds[0]) + require.False(t, found) - // Check that the value is still deleted - _, found = tt.getFunc(ctx, chainID) - require.False(t, found) - }) - } + providerKeeper.DeleteConsumerClientId(ctx, consumerId) + _, found = providerKeeper.GetConsumerClientId(ctx, consumerId) + require.False(t, found) + _, found = providerKeeper.GetClientIdToConsumerId(ctx, clientIds[0]) + require.False(t, found) + _, found = providerKeeper.GetClientIdToConsumerId(ctx, clientIds[1]) + require.False(t, found) } diff --git a/x/ccv/provider/keeper/key_assignment.go b/x/ccv/provider/keeper/key_assignment.go index 23dd20109d..f2f10dd368 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.StringIdWithLenKey(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.ParseStringIdAndConsAddrKey(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.StringIdWithLenKey(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.ParseStringIdAndConsAddrKey(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.StringIdWithLenKey(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.ParseStringIdAndTsKey(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("ParseStringIdAndTsKey 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.StringIdWithLenKey(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.ParseStringIdAndTsKey(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,26 +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) { + if !k.IsConsumerActive(ctx, consumerId) { + // check that the consumer chain is either registered, initialized, or launched return errorsmod.Wrapf( - types.ErrUnknownConsumerChainId, chainID, - ) + types.ErrInvalidPhase, + "cannot assign a key to a consumer chain that is not in the registered, initialized, or launched phase: %s", consumerId) } consAddrTmp, err := ccvtypes.TMCryptoPublicKeyToConsAddr(consumerKey) @@ -433,7 +432,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 +441,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 +451,16 @@ 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) + phase := k.GetConsumerPhase(ctx, consumerId) + if phase == types.CONSUMER_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,51 +511,38 @@ 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) - } -} - -// 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) - for _, c := range allConsumerChains { - if c == chainID { - return true - } + for _, consumerAddrsToPrune := range k.GetAllConsumerAddrsToPrune(ctx, consumerId) { + k.DeleteConsumerAddrsToPrune(ctx, consumerId, consumerAddrsToPrune.PruneTs) } - - return false } // ValidatorConsensusKeyInUse checks if the given consensus key is already @@ -578,8 +564,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..fced8ad7a7 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, types.CONSUMER_PHASE_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, types.CONSUMER_PHASE_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, types.CONSUMER_PHASE_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, types.CONSUMER_PHASE_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, types.CONSUMER_PHASE_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, types.CONSUMER_PHASE_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, types.CONSUMER_PHASE_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, types.CONSUMER_PHASE_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", types.CONSUMER_PHASE_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 deleted file mode 100644 index d14773e5ed..0000000000 --- a/x/ccv/provider/keeper/legacy_proposal.go +++ /dev/null @@ -1,144 +0,0 @@ -package keeper - -import ( - errorsmod "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" -) - -func (k Keeper) HandleLegacyConsumerRewardDenomProposal(ctx sdk.Context, p *types.ChangeRewardDenomsProposal) error { - for _, denomToAdd := range p.DenomsToAdd { - // Log error and move on if one of the denoms is already registered - if k.ConsumerRewardDenomExists(ctx, denomToAdd) { - ctx.Logger().Error("denom %s already registered", denomToAdd) - continue - } - k.SetConsumerRewardDenom(ctx, denomToAdd) - ctx.EventManager().EmitEvent(sdk.NewEvent( - types.EventTypeAddConsumerRewardDenom, - sdk.NewAttribute(types.AttributeConsumerRewardDenom, denomToAdd), - )) - } - for _, denomToRemove := range p.DenomsToRemove { - // Log error and move on if one of the denoms is not registered - if !k.ConsumerRewardDenomExists(ctx, denomToRemove) { - ctx.Logger().Error("denom %s not registered", denomToRemove) - continue - } - k.DeleteConsumerRewardDenom(ctx, denomToRemove) - ctx.EventManager().EmitEvent(sdk.NewEvent( - types.EventTypeRemoveConsumerRewardDenom, - sdk.NewAttribute(types.AttributeConsumerRewardDenom, denomToRemove), - )) - } - 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. -// -// This method implements StopConsumerChainProposalHandler from spec. -// See: https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/methods.md#ccv-pcf-hcrprop1 -// Spec tag: [CCV-PCF-HCRPROP.1] -func (k Keeper) HandleLegacyConsumerRemovalProposal(ctx sdk.Context, p *types.ConsumerRemovalProposal) error { - // verify the consumer removal proposal execution - // in cached context and discard the cached writes - if _, _, err := k.StopConsumerChainInCachedCtx(ctx, *p); err != nil { - return err - } - - k.SetPendingConsumerRemovalProp(ctx, p) - - k.Logger(ctx).Info("consumer removal proposal enqueued", - "chainID", 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 deleted file mode 100644 index 23c2c6a948..0000000000 --- a/x/ccv/provider/keeper/legacy_proposal_test.go +++ /dev/null @@ -1,334 +0,0 @@ -package keeper_test - -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" -) - -// -// 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 -// Spec tag: [CCV-PCF-HCRPROP.1] -func TestHandleLegacyConsumerRemovalProposal(t *testing.T) { - type testCase struct { - description string - setupMocks func(ctx sdk.Context, k providerkeeper.Keeper, chainID string) - - // Consumer removal proposal to handle - prop *providertypes.ConsumerRemovalProposal - // 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 - - // chainID of the consumer chain - // tests need to check that the CCV channel is not closed prematurely - chainId string - } - - // Snapshot times asserted in tests - now := time.Now().UTC() - hourAfterNow := now.Add(time.Hour).UTC() - hourBeforeNow := now.Add(-time.Hour).UTC() - - tests := []testCase{ - { - description: "valid proposal", - setupMocks: func(ctx sdk.Context, k providerkeeper.Keeper, chainID string) { - k.SetConsumerClientId(ctx, chainID, "ClientID") - }, - prop: providertypes.NewConsumerRemovalProposal( - "title", - "description", - "chainID", - now, - ).(*providertypes.ConsumerRemovalProposal), - blockTime: hourAfterNow, // After stop time. - expAppendProp: true, - chainId: "chainID", - }, - { - description: "valid proposal - stop_time in the past", - setupMocks: func(ctx sdk.Context, k providerkeeper.Keeper, chainID string) { - k.SetConsumerClientId(ctx, chainID, "ClientID") - }, - prop: providertypes.NewConsumerRemovalProposal( - "title", - "description", - "chainID", - hourBeforeNow, - ).(*providertypes.ConsumerRemovalProposal), - blockTime: hourAfterNow, // After stop time. - expAppendProp: true, - chainId: "chainID", - }, - { - description: "valid proposal - before stop_time in the future", - setupMocks: func(ctx sdk.Context, k providerkeeper.Keeper, chainID string) { - k.SetConsumerClientId(ctx, chainID, "ClientID") - }, - prop: providertypes.NewConsumerRemovalProposal( - "title", - "description", - "chainID", - hourAfterNow, - ).(*providertypes.ConsumerRemovalProposal), - blockTime: now, - expAppendProp: true, - chainId: "chainID", - }, - { - description: "rejected valid proposal - consumer chain does not exist", - setupMocks: func(ctx sdk.Context, k providerkeeper.Keeper, chainID string) {}, - prop: providertypes.NewConsumerRemovalProposal( - "title", - "description", - "chainID-2", - hourAfterNow, - ).(*providertypes.ConsumerRemovalProposal), - blockTime: hourAfterNow, // After stop time. - expAppendProp: false, - chainId: "chainID-2", - }, - } - - 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) - - // Mock expectations and setup for stopping the consumer chain, if applicable - // 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) - // Valid client creation is asserted with mock expectations here - gomock.InOrder(testkeeper.GetMocksForStopConsumerChainWithCloseChannel(ctx, &mocks)...) - } - - tc.setupMocks(ctx, providerKeeper, tc.prop.ChainId) - - err := providerKeeper.HandleLegacyConsumerRemovalProposal(ctx, tc.prop) - - if tc.expAppendProp { - require.NoError(t, err) - - // Proposal should be stored as pending - found := providerKeeper.PendingConsumerRemovalPropExists(ctx, tc.prop.ChainId, tc.prop.StopTime) - require.True(t, found) - - // confirm that the channel was not closed - _, found = providerKeeper.GetChainToChannel(ctx, tc.chainId) - require.True(t, found) - } else { - require.Error(t, err) - - // Expect no pending proposal to exist - found := providerKeeper.PendingConsumerRemovalPropExists(ctx, tc.prop.ChainId, tc.prop.StopTime) - require.False(t, found) - } - - // Assert mock calls from setup function - 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..e5148b5a37 100644 --- a/x/ccv/provider/keeper/msg_server.go +++ b/x/ccv/provider/keeper/msg_server.go @@ -2,16 +2,16 @@ package keeper import ( "context" + "fmt" + "strings" + "time" errorsmod "cosmossdk.io/errors" - + 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" ) @@ -67,89 +67,76 @@ 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, + + chainId, err := k.GetConsumerChainId(ctx, msg.ConsumerId) + if err != nil { + return nil, errorsmod.Wrapf(ccvtypes.ErrInvalidConsumerState, "cannot get consumer chain ID: %s", err.Error()) + } + + k.Logger(ctx).Info("validator assigned consumer key", + "consumerId", msg.ConsumerId, + "chainId", chainId, "validator operator addr", msg.ProviderAddr, "consumer public key", msg.ConsumerKey, ) - ctx.EventManager().EmitEvents(sdk.Events{ + ctx.EventManager().EmitEvent( sdk.NewEvent( types.EventTypeAssignConsumerKey, + sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), + sdk.NewAttribute(types.AttributeConsumerId, msg.ConsumerId), + sdk.NewAttribute(types.AttributeConsumerChainId, chainId), sdk.NewAttribute(types.AttributeProviderValidatorAddress, msg.ProviderAddr), sdk.NewAttribute(types.AttributeConsumerConsensusPubKey, msg.ConsumerKey), + sdk.NewAttribute(types.AttributeSubmitterAddress, msg.Submitter), ), - }) + ) 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) { - if k.GetAuthority() != msg.Authority { - return nil, errorsmod.Wrapf(types.ErrUnauthorized, "expected %s, got %s", k.GetAuthority(), msg.Authority) - } - +// ChangeRewardDenoms defines a rpc handler method for MsgChangeRewardDenoms +func (k msgServer) ChangeRewardDenoms(goCtx context.Context, msg *types.MsgChangeRewardDenoms) (*types.MsgChangeRewardDenomsResponse, error) { 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) } - ctx := sdk.UnwrapSDKContext(goCtx) - err := k.Keeper.HandleConsumerRemovalProposal(ctx, msg) - if err != nil { - return nil, errorsmod.Wrapf(err, "failed handling ConsumerAddition proposal") - } - - return &types.MsgConsumerRemovalResponse{}, nil -} + eventAttributes := k.Keeper.ChangeRewardDenoms(ctx, msg.DenomsToAdd, msg.DenomsToRemove) -// ChangeRewardDenoms defines a rpc handler method for MsgChangeRewardDenoms -func (k msgServer) ChangeRewardDenoms(goCtx context.Context, msg *types.MsgChangeRewardDenoms) (*types.MsgChangeRewardDenomsResponse, error) { - if k.GetAuthority() != msg.Authority { - return nil, errorsmod.Wrapf(types.ErrUnauthorized, "expected %s, got %s", k.GetAuthority(), msg.Authority) - } - - sdkCtx := sdk.UnwrapSDKContext(goCtx) - err := k.Keeper.HandleConsumerRewardDenomProposal(sdkCtx, msg) - if err != nil { - return nil, errorsmod.Wrapf(err, "failed handling Change Reward Denoms proposal") - } + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeChangeConsumerRewardDenom, + eventAttributes..., + ), + ) return &types.MsgChangeRewardDenomsResponse{}, nil } 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 } - ctx.EventManager().EmitEvents(sdk.Events{ + ctx.EventManager().EmitEvent( sdk.NewEvent( ccvtypes.EventTypeSubmitConsumerMisbehaviour, + sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), + sdk.NewAttribute(types.AttributeConsumerId, msg.ConsumerId), + sdk.NewAttribute(types.AttributeConsumerChainId, msg.Misbehaviour.Header1.Header.ChainID), sdk.NewAttribute(ccvtypes.AttributeConsumerMisbehaviour, msg.Misbehaviour.String()), - sdk.NewAttribute(ccvtypes.AttributeSubmitterAddress, msg.Submitter), sdk.NewAttribute(ccvtypes.AttributeMisbehaviourClientId, msg.Misbehaviour.ClientId), sdk.NewAttribute(ccvtypes.AttributeMisbehaviourHeight1, msg.Misbehaviour.Header1.GetHeight().String()), sdk.NewAttribute(ccvtypes.AttributeMisbehaviourHeight2, msg.Misbehaviour.Header2.GetHeight().String()), + sdk.NewAttribute(types.AttributeSubmitterAddress, msg.Submitter), ), - }) + ) return &types.MsgSubmitConsumerMisbehaviourResponse{}, nil } @@ -185,20 +172,22 @@ 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 } - ctx.EventManager().EmitEvents(sdk.Events{ + ctx.EventManager().EmitEvent( sdk.NewEvent( ccvtypes.EventTypeSubmitConsumerDoubleVoting, + sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), + sdk.NewAttribute(types.AttributeConsumerId, msg.ConsumerId), + sdk.NewAttribute(types.AttributeConsumerChainId, msg.InfractionBlockHeader.Header.ChainID), sdk.NewAttribute(ccvtypes.AttributeConsumerDoubleVoting, msg.DuplicateVoteEvidence.String()), - sdk.NewAttribute(ccvtypes.AttributeChainID, msg.InfractionBlockHeader.Header.ChainID), - sdk.NewAttribute(ccvtypes.AttributeSubmitterAddress, msg.Submitter), + sdk.NewAttribute(types.AttributeSubmitterAddress, msg.Submitter), ), - }) + ) return &types.MsgSubmitConsumerDoubleVotingResponse{}, nil } @@ -223,18 +212,34 @@ 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 } - ctx.EventManager().EmitEvents(sdk.Events{ + chainId, err := k.GetConsumerChainId(ctx, msg.ConsumerId) + if err != nil { + return nil, errorsmod.Wrapf(ccvtypes.ErrInvalidConsumerState, "cannot get consumer chain ID: %s", err.Error()) + } + + k.Logger(ctx).Info("validator opted in", + "consumerId", msg.ConsumerId, + "chainId", chainId, + "validator operator addr", msg.ProviderAddr, + "consumer public key", msg.ConsumerKey, + ) + + ctx.EventManager().EmitEvent( sdk.NewEvent( types.EventTypeOptIn, + sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), + sdk.NewAttribute(types.AttributeConsumerId, msg.ConsumerId), + sdk.NewAttribute(types.AttributeConsumerChainId, chainId), sdk.NewAttribute(types.AttributeProviderValidatorAddress, msg.ProviderAddr), sdk.NewAttribute(types.AttributeConsumerConsensusPubKey, msg.ConsumerKey), + sdk.NewAttribute(types.AttributeSubmitterAddress, msg.Submitter), ), - }) + ) return &types.MsgOptInResponse{}, nil } @@ -259,17 +264,32 @@ 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 } - ctx.EventManager().EmitEvents(sdk.Events{ + chainId, err := k.GetConsumerChainId(ctx, msg.ConsumerId) + if err != nil { + return nil, errorsmod.Wrapf(ccvtypes.ErrInvalidConsumerState, "cannot get consumer chain ID: %s", err.Error()) + } + + k.Logger(ctx).Info("validator opted out", + "consumerId", msg.ConsumerId, + "chainId", chainId, + "validator operator addr", msg.ProviderAddr, + ) + + ctx.EventManager().EmitEvent( sdk.NewEvent( types.EventTypeOptOut, + sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), + sdk.NewAttribute(types.AttributeConsumerId, msg.ConsumerId), + sdk.NewAttribute(types.AttributeConsumerChainId, chainId), sdk.NewAttribute(types.AttributeProviderValidatorAddress, msg.ProviderAddr), + sdk.NewAttribute(types.AttributeSubmitterAddress, msg.Submitter), ), - }) + ) return &types.MsgOptOutResponse{}, nil } @@ -293,32 +313,342 @@ 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{ + chainId, err := k.GetConsumerChainId(ctx, msg.ConsumerId) + if err != nil { + return nil, errorsmod.Wrapf(ccvtypes.ErrInvalidConsumerState, "cannot get consumer chain ID: %s", err.Error()) + } + + k.Logger(ctx).Info("validator set commission rate on consumer", + "consumerId", msg.ConsumerId, + "chainId", chainId, + "validator operator addr", msg.ProviderAddr, + "rate", msg.Rate, + ) + + ctx.EventManager().EmitEvent( sdk.NewEvent( types.EventTypeSetConsumerCommissionRate, - sdk.NewAttribute(types.AttributeConsumerChainID, msg.ChainId), + sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), + sdk.NewAttribute(types.AttributeConsumerId, msg.ConsumerId), + sdk.NewAttribute(types.AttributeConsumerChainId, chainId), sdk.NewAttribute(types.AttributeProviderValidatorAddress, msg.ProviderAddr), sdk.NewAttribute(types.AttributeConsumerCommissionRate, msg.Rate.String()), + sdk.NewAttribute(types.AttributeSubmitterAddress, msg.Submitter), ), - }) + ) 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) + resp := types.MsgCreateConsumerResponse{} + + // initialize an empty slice to store event attributes + eventAttributes := []sdk.Attribute{} + + consumerId := k.Keeper.FetchAndIncrementConsumerId(ctx) + + k.Keeper.SetConsumerOwnerAddress(ctx, consumerId, msg.Submitter) + k.Keeper.SetConsumerChainId(ctx, consumerId, msg.ChainId) + k.Keeper.SetConsumerPhase(ctx, consumerId, types.CONSUMER_PHASE_REGISTERED) + + if err := k.Keeper.SetConsumerMetadata(ctx, consumerId, msg.Metadata); err != nil { + return &resp, errorsmod.Wrapf(types.ErrInvalidConsumerMetadata, + "cannot set consumer metadata: %s", err.Error()) + } + + // add event attributes + eventAttributes = append(eventAttributes, []sdk.Attribute{ + sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), + sdk.NewAttribute(types.AttributeConsumerId, consumerId), + sdk.NewAttribute(types.AttributeConsumerChainId, msg.ChainId), + sdk.NewAttribute(types.AttributeConsumerName, msg.Metadata.Name), + sdk.NewAttribute(types.AttributeSubmitterAddress, msg.Submitter), + sdk.NewAttribute(types.AttributeConsumerOwner, msg.Submitter), + }...) + + // initialization parameters are optional and hence could be nil; + // in that case, set the default + initializationParameters := types.ConsumerInitializationParameters{} // default params + if msg.InitializationParameters != nil { + initializationParameters = *msg.InitializationParameters + } + if err := k.Keeper.SetConsumerInitializationParameters(ctx, consumerId, initializationParameters); err != nil { + return &resp, errorsmod.Wrapf(types.ErrInvalidConsumerInitializationParameters, + "cannot set consumer initialization parameters: %s", err.Error()) + } + if !initializationParameters.SpawnTime.IsZero() { + // add SpawnTime event attribute + eventAttributes = append(eventAttributes, + sdk.NewAttribute(types.AttributeConsumerSpawnTime, initializationParameters.SpawnTime.String())) + } + + // power-shaping parameters are optional and hence could be nil; + // in that case, set the default + powerShapingParameters := types.PowerShapingParameters{} // default params + if msg.PowerShapingParameters != nil { + powerShapingParameters = *msg.PowerShapingParameters + + if powerShapingParameters.Top_N != 0 { + return &resp, errorsmod.Wrap(types.ErrCannotCreateTopNChain, + "cannot create a Top N chain using the `MsgCreateConsumer` message; use `MsgUpdateConsumer` instead") + } + } + if err := k.Keeper.SetConsumerPowerShapingParameters(ctx, consumerId, powerShapingParameters); err != nil { + return &resp, errorsmod.Wrapf(types.ErrInvalidPowerShapingParameters, + "cannot set power shaping parameters") } + if spawnTime, initialized := k.Keeper.InitializeConsumer(ctx, consumerId); initialized { + if err := k.Keeper.PrepareConsumerForLaunch(ctx, consumerId, time.Time{}, spawnTime); err != nil { + return &resp, errorsmod.Wrapf(ccvtypes.ErrInvalidConsumerState, + "cannot prepare chain with consumer id (%s) for launch", consumerId) + } + } + + // add Phase event attribute + phase := k.GetConsumerPhase(ctx, consumerId) + eventAttributes = append(eventAttributes, sdk.NewAttribute(types.AttributeConsumerPhase, phase.String())) + + k.Logger(ctx).Info("created consumer", + "consumerId", consumerId, + "chainId", msg.ChainId, + "owner", msg.Submitter, + "phase", phase, + "spawn time", initializationParameters.SpawnTime, + ) + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeCreateConsumer, + eventAttributes..., + ), + ) + + resp.ConsumerId = consumerId + return &resp, nil +} + +// UpdateConsumer updates the metadata, power-shaping or initialization parameters 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) + resp := types.MsgUpdateConsumerResponse{} + + // initialize an empty slice to store event attributes + eventAttributes := []sdk.Attribute{} + + consumerId := msg.ConsumerId + + if !k.Keeper.IsConsumerActive(ctx, consumerId) { + return &resp, errorsmod.Wrapf(types.ErrInvalidPhase, + "cannot update consumer chain that is not in the registered, initialized, or launched phase: %s", consumerId) + } + + ownerAddress, err := k.Keeper.GetConsumerOwnerAddress(ctx, consumerId) + if err != nil { + return &resp, errorsmod.Wrapf(types.ErrNoOwnerAddress, "cannot retrieve owner address %s", ownerAddress) + } + + if msg.Owner != ownerAddress { + return &resp, errorsmod.Wrapf(types.ErrUnauthorized, "expected owner address %s, got %s", ownerAddress, msg.Owner) + } + + chainId, err := k.GetConsumerChainId(ctx, consumerId) if err != nil { - return nil, errorsmod.Wrapf(err, "failed handling ConsumerModification proposal") + return &resp, errorsmod.Wrapf(ccvtypes.ErrInvalidConsumerState, "cannot get consumer chain ID: %s", err.Error()) + } + + // add event attributes + eventAttributes = append(eventAttributes, []sdk.Attribute{ + sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), + sdk.NewAttribute(types.AttributeConsumerId, consumerId), + sdk.NewAttribute(types.AttributeConsumerChainId, chainId), + sdk.NewAttribute(types.AttributeSubmitterAddress, msg.Owner), + }...) + + // 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 &resp, errorsmod.Wrapf(types.ErrInvalidNewOwnerAddress, "invalid new owner address %s", msg.NewOwnerAddress) + } + + k.Keeper.SetConsumerOwnerAddress(ctx, consumerId, msg.NewOwnerAddress) } - return &types.MsgConsumerModificationResponse{}, nil + if msg.Metadata != nil { + if err := k.Keeper.SetConsumerMetadata(ctx, consumerId, *msg.Metadata); err != nil { + return &resp, errorsmod.Wrapf(types.ErrInvalidConsumerMetadata, + "cannot set consumer metadata: %s", err.Error()) + } + + // add Name event attribute + eventAttributes = append(eventAttributes, sdk.NewAttribute(types.AttributeConsumerName, msg.Metadata.Name)) + } + + // get the previous spawn time so that we can use it in `PrepareConsumerForLaunch` + previousInitializationParameters, err := k.Keeper.GetConsumerInitializationParameters(ctx, consumerId) + if err != nil { + return &resp, errorsmod.Wrapf(ccvtypes.ErrInvalidConsumerState, + "cannot get consumer initialized parameters, consumerId(%s): %s", consumerId, err.Error()) + } + previousSpawnTime := previousInitializationParameters.SpawnTime + + if msg.InitializationParameters != nil { + if err = k.Keeper.SetConsumerInitializationParameters(ctx, msg.ConsumerId, *msg.InitializationParameters); err != nil { + return &resp, errorsmod.Wrapf(types.ErrInvalidConsumerInitializationParameters, + "cannot set consumer initialization parameters: %s", err.Error()) + } + + if !msg.InitializationParameters.SpawnTime.IsZero() { + // add SpawnTime event attribute + eventAttributes = append(eventAttributes, + sdk.NewAttribute(types.AttributeConsumerSpawnTime, msg.InitializationParameters.SpawnTime.String())) + } + } + + 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 &resp, errorsmod.Wrapf(types.ErrInvalidTransformToTopN, + "an update to a Top N chain can only be done if chain is owner is the gov module") + } + + oldPowerShapingParameters, err := k.Keeper.GetConsumerPowerShapingParameters(ctx, consumerId) + if err != nil { + return &resp, errorsmod.Wrapf(ccvtypes.ErrInvalidConsumerState, + "cannot get consumer previous power shaping parameters: %s", err.Error()) + } + oldTopN := oldPowerShapingParameters.Top_N + + if err = k.Keeper.SetConsumerPowerShapingParameters(ctx, consumerId, *msg.PowerShapingParameters); err != nil { + return &resp, errorsmod.Wrapf(types.ErrInvalidPowerShapingParameters, + "cannot set power shaping parameters") + } + err = k.Keeper.UpdateMinimumPowerInTopN(ctx, consumerId, oldTopN, msg.PowerShapingParameters.Top_N) + if err != nil { + return &resp, 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()) + } + + // add TopN event attribute + eventAttributes = append(eventAttributes, + sdk.NewAttribute(types.AttributeConsumerTopN, fmt.Sprintf("%v", msg.PowerShapingParameters.Top_N))) + } + + // 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.Keeper.GetConsumerOwnerAddress(ctx, consumerId) + if err != nil { + return &resp, errorsmod.Wrapf(ccvtypes.ErrInvalidConsumerState, "cannot retrieve owner address %s: %s", ownerAddress, err.Error()) + } + + currentPowerShapingParameters, err := k.Keeper.GetConsumerPowerShapingParameters(ctx, consumerId) + if err != nil { + return &resp, errorsmod.Wrapf(ccvtypes.ErrInvalidConsumerState, "cannot retrieve power shaping parameters: %s", err.Error()) + } + + if currentPowerShapingParameters.Top_N != 0 && currentOwnerAddress != k.GetAuthority() { + return &resp, 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, initialized := k.Keeper.InitializeConsumer(ctx, consumerId); initialized { + if err := k.Keeper.PrepareConsumerForLaunch(ctx, consumerId, previousSpawnTime, spawnTime); err != nil { + return &resp, errorsmod.Wrapf(ccvtypes.ErrInvalidConsumerState, + "cannot prepare chain with consumer id (%s) for launch", consumerId) + } + } + + // add Owner event attribute + eventAttributes = append(eventAttributes, sdk.NewAttribute(types.AttributeConsumerOwner, currentOwnerAddress)) + + // add Phase event attribute + phase := k.GetConsumerPhase(ctx, consumerId) + eventAttributes = append(eventAttributes, sdk.NewAttribute(types.AttributeConsumerPhase, phase.String())) + + k.Logger(ctx).Info("updated consumer", + "consumerId", consumerId, + "chainId", chainId, + "owner", currentOwnerAddress, + "phase", phase, + "topN", currentPowerShapingParameters.Top_N, + ) + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeUpdateConsumer, + eventAttributes..., + ), + ) + + return &resp, nil +} + +// RemoveConsumer defines an RPC handler method for MsgRemoveConsumer +func (k msgServer) RemoveConsumer(goCtx context.Context, msg *types.MsgRemoveConsumer) (*types.MsgRemoveConsumerResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + resp := types.MsgRemoveConsumerResponse{} + + consumerId := msg.ConsumerId + ownerAddress, err := k.Keeper.GetConsumerOwnerAddress(ctx, consumerId) + if err != nil { + return &resp, errorsmod.Wrapf(types.ErrNoOwnerAddress, "cannot retrieve owner address %s", ownerAddress) + } + + chainId, err := k.GetConsumerChainId(ctx, consumerId) + if err != nil { + return &resp, errorsmod.Wrapf(ccvtypes.ErrInvalidConsumerState, "cannot get consumer chain ID: %s", err.Error()) + } + + if msg.Owner != ownerAddress { + return &resp, errorsmod.Wrapf(types.ErrUnauthorized, "expected owner address %s, got %s", ownerAddress, msg.Owner) + } + + phase := k.Keeper.GetConsumerPhase(ctx, consumerId) + if phase != types.CONSUMER_PHASE_LAUNCHED { + return &resp, errorsmod.Wrapf(types.ErrInvalidPhase, + "chain with consumer id: %s has to be in its launched phase", consumerId) + } + + err = k.Keeper.StopAndPrepareForConsumerRemoval(ctx, consumerId) + + k.Logger(ctx).Info("stopped consumer", + "consumerId", consumerId, + "chainId", chainId, + "phase", phase, + ) + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeRemoveConsumer, + sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), + sdk.NewAttribute(types.AttributeConsumerId, consumerId), + sdk.NewAttribute(types.AttributeConsumerChainId, chainId), + sdk.NewAttribute(types.AttributeSubmitterAddress, msg.Owner), + ), + ) + + return &resp, err +} + +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..66ddaefff9 --- /dev/null +++ b/x/ccv/provider/keeper/msg_server_test.go @@ -0,0 +1,166 @@ +package keeper_test + +import ( + "testing" + "time" + + "github.com/cosmos/cosmos-sdk/codec/address" + 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" +) + +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{Submitter: "submitter", 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.NoError(t, err) + require.Equal(t, "submitter", ownerAddress) + phase := providerKeeper.GetConsumerPhase(ctx, "0") + require.Equal(t, providertypes.CONSUMER_PHASE_REGISTERED, phase) + + consumerMetadata = providertypes.ConsumerMetadata{ + Name: "chain name", + Description: "description2", + } + response, err = msgServer.CreateConsumer(ctx, + &providertypes.MsgCreateConsumer{Submitter: "submitter2", 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.NoError(t, err) + require.Equal(t, "submitter2", ownerAddress) + phase = providerKeeper.GetConsumerPhase(ctx, "1") + require.Equal(t, providertypes.CONSUMER_PHASE_REGISTERED, phase) +} + +func TestUpdateConsumer(t *testing.T) { + providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + msgServer := providerkeeper.NewMsgServerImpl(&providerKeeper) + + // try to update a non-existing (i.e., no consumer id exists) + _, err := msgServer.UpdateConsumer(ctx, + &providertypes.MsgUpdateConsumer{Owner: "owner", ConsumerId: "0", NewOwnerAddress: "cosmos1dkas8mu4kyhl5jrh4nzvm65qz588hy9qcz08la", + Metadata: nil, + InitializationParameters: nil, + PowerShapingParameters: nil, + }) + require.Error(t, err, "cannot update consumer chain") + + // create a chain before updating it + createConsumerResponse, err := msgServer.CreateConsumer(ctx, + &providertypes.MsgCreateConsumer{Submitter: "submitter", ChainId: "chainId", + Metadata: providertypes.ConsumerMetadata{ + Name: "name", + Description: "description", + Metadata: "metadata", + }, + InitializationParameters: nil, + PowerShapingParameters: nil, + }) + require.NoError(t, err) + consumerId := createConsumerResponse.ConsumerId + + mocks.MockAccountKeeper.EXPECT().AddressCodec().Return(address.NewBech32Codec("cosmos")).AnyTimes() + _, err = msgServer.UpdateConsumer(ctx, + &providertypes.MsgUpdateConsumer{Owner: "wrong owner", ConsumerId: consumerId, NewOwnerAddress: "cosmos1dkas8mu4kyhl5jrh4nzvm65qz588hy9qcz08la", + Metadata: nil, + InitializationParameters: nil, + PowerShapingParameters: nil, + }) + require.Error(t, err, "expected owner address") + + expectedConsumerMetadata := providertypes.ConsumerMetadata{ + Name: "name2", + Description: "description2", + Metadata: "metadata2", + } + + expectedInitializationParameters := testkeeper.GetTestInitializationParameters() + expectedPowerShapingParameters := testkeeper.GetTestPowerShapingParameters() + + expectedOwnerAddress := "cosmos1dkas8mu4kyhl5jrh4nzvm65qz588hy9qcz08la" + _, err = msgServer.UpdateConsumer(ctx, + &providertypes.MsgUpdateConsumer{Owner: "submitter", ConsumerId: consumerId, NewOwnerAddress: expectedOwnerAddress, + Metadata: &expectedConsumerMetadata, + InitializationParameters: &expectedInitializationParameters, + PowerShapingParameters: &expectedPowerShapingParameters}) + require.NoError(t, err) + + // assert that owner address was updated + ownerAddress, err := providerKeeper.GetConsumerOwnerAddress(ctx, consumerId) + require.NoError(t, err) + require.Equal(t, expectedOwnerAddress, ownerAddress) + + // assert that consumer metadata were updated + actualConsumerMetadata, err := providerKeeper.GetConsumerMetadata(ctx, consumerId) + require.NoError(t, err) + require.Equal(t, expectedConsumerMetadata, actualConsumerMetadata) + + // assert that initialization parameters were updated + actualInitializationParameters, err := providerKeeper.GetConsumerInitializationParameters(ctx, consumerId) + require.NoError(t, err) + require.Equal(t, expectedInitializationParameters, actualInitializationParameters) + + // assert that power-shaping parameters were updated + actualPowerShapingParameters, err := providerKeeper.GetConsumerPowerShapingParameters(ctx, consumerId) + require.NoError(t, err) + require.Equal(t, expectedPowerShapingParameters, actualPowerShapingParameters) + + // assert phase + phase := providerKeeper.GetConsumerPhase(ctx, consumerId) + require.Equal(t, providertypes.CONSUMER_PHASE_INITIALIZED, phase) + + // assert that chain is set to launch + consumerIds, err := providerKeeper.GetConsumersToBeLaunched(ctx, expectedInitializationParameters.SpawnTime) + require.NoError(t, err) + require.Equal(t, providertypes.ConsumerIds{ + Ids: []string{consumerId}, + }, consumerIds) + + // re-update (change spawnTime) and verify that the chain is still to be launched at the new spawn time + previousSpawnTime := expectedInitializationParameters.SpawnTime + updatedSpawnTime := expectedInitializationParameters.SpawnTime.Add(time.Hour) + expectedInitializationParameters.SpawnTime = updatedSpawnTime + _, err = msgServer.UpdateConsumer(ctx, + &providertypes.MsgUpdateConsumer{Owner: expectedOwnerAddress, ConsumerId: consumerId, + Metadata: &expectedConsumerMetadata, + InitializationParameters: &expectedInitializationParameters, + PowerShapingParameters: &expectedPowerShapingParameters}) + require.NoError(t, err) + + consumerIds, err = providerKeeper.GetConsumersToBeLaunched(ctx, previousSpawnTime) + require.NoError(t, err) + require.Empty(t, consumerIds) + + consumerIds, err = providerKeeper.GetConsumersToBeLaunched(ctx, updatedSpawnTime) + require.NoError(t, err) + require.Equal(t, providertypes.ConsumerIds{ + Ids: []string{consumerId}, + }, consumerIds) +} diff --git a/x/ccv/provider/keeper/partial_set_security.go b/x/ccv/provider/keeper/partial_set_security.go index 3112124724..5d654516ab 100644 --- a/x/ccv/provider/keeper/partial_set_security.go +++ b/x/ccv/provider/keeper/partial_set_security.go @@ -11,18 +11,37 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/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 { + if !k.IsConsumerActive(ctx, consumerId) { return errorsmod.Wrapf( - types.ErrUnknownConsumerChainId, - "opting in to an unknown consumer chain, with id: %s", chainID) + types.ErrInvalidPhase, + "cannot opt in to a consumer chain that is not in the registered, initialized, or launched phase: %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,31 @@ 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 { - // 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`. +func (k Keeper) HandleOptOut(ctx sdk.Context, consumerId string, providerAddr types.ProviderConsAddress) error { + phase := k.GetConsumerPhase(ctx, consumerId) + if phase == types.CONSUMER_PHASE_UNSPECIFIED { + return errorsmod.Wrapf( + types.ErrUnknownConsumerId, + "opting out of an unknown consumer chain, consumerId(%s)", consumerId, + ) + } + if phase != types.CONSUMER_PHASE_LAUNCHED { + // A validator can only opt out from a running chain return errorsmod.Wrapf( - types.ErrUnknownConsumerChainId, - "opting out of an unknown or not running consumer chain, with id: %s", chainID) + types.ErrInvalidPhase, + "opting out of a consumer chain not yet launched, consumerId(%s)", consumerId, + ) } - if topN, found := k.GetTopN(ctx, chainID); found && topN > 0 { + powerShapingParameters, err := k.GetConsumerPowerShapingParameters(ctx, consumerId) + if err != nil { + return errorsmod.Wrapf(ccvtypes.ErrInvalidConsumerState, + "cannot get consumer power shaping parameters: %s", err.Error(), + ) + } + if powerShapingParameters.Top_N > 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,56 +101,67 @@ 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()) valAddr, err := sdk.ValAddressFromBech32(val.GetOperator()) if err != nil { - k.Logger(ctx).Error("could not retrieve validator address: %s: %s", - val.GetOperator(), err) + k.Logger(ctx).Error("could not retrieve validator address from operator address", + "validator operator address", val.GetOperator(), + "error", err.Error()) continue } power, err := k.stakingKeeper.GetLastValidatorPower(ctx, valAddr) if err != nil { - k.Logger(ctx).Error("could not retrieve last power of validator address: %s: %s", - val.GetOperator(), err) + k.Logger(ctx).Error("could not retrieve last power of validator", + "validator operator address", val.GetOperator(), + "error", err.Error()) continue } if power >= minPowerToOptIn { consAddr, err := val.GetConsAddr() if err != nil { - k.Logger(ctx).Error("could not retrieve validators consensus address: %s: %s", - val, err) + k.Logger(ctx).Error("could not retrieve validator consensus address", + "validator operator address", val.GetOperator(), + "error", err.Error()) continue } k.Logger(ctx).Debug("Opting in validator", "validator", val.GetOperator()) // if validator already exists it gets overwritten - k.SetOptedIn(ctx, chainID, types.NewProviderConsAddress(consAddr)) - } + err = k.AppendOptedInConsumerId(ctx, types.NewProviderConsAddress(consAddr), consumerId) + if err != nil { + k.Logger(ctx).Error("could not append validator as opted-in validator for this consumer chain", + "validator operator address", val.GetOperator(), + "consumer id", consumerId, + "error", err.Error()) + continue + } + 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 +211,20 @@ 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, + powerShapingParameters types.PowerShapingParameters, + validators []types.ConsensusValidator, +) []types.ConsensusValidator { + if powerShapingParameters.Top_N > 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) { + validatorSetCap := powerShapingParameters.ValidatorSetCap + if validatorSetCap != 0 && int(validatorSetCap) < len(validators) { sort.Slice(validators, func(i, j int) bool { return validators[i].Power > validators[j].Power }) @@ -187,15 +235,19 @@ 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 { - return NoMoreThanPercentOfTheSum(validators, p) +func (k Keeper) CapValidatorsPower( + ctx sdk.Context, + validatorsPowerCap uint32, + validators []types.ConsensusValidator, +) []types.ConsensusValidator { + if validatorsPowerCap > 0 { + return NoMoreThanPercentOfTheSum(validators, validatorsPowerCap) } 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 +352,41 @@ 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, + topN uint32, + minPowerToOptIn int64, +) bool { + // check if the validator is already opted-in + optedIn := k.IsOptedIn(ctx, consumerId, providerAddr) + + // check if the validator is automatically opted-in for a topN chain + if !optedIn && topN > 0 { + optedIn = k.HasMinPower(ctx, providerAddr, minPowerToOptIn) + } + // only consider opted-in validators - return k.IsOptedIn(ctx, chainID, providerAddr) && + return optedIn && // 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, + minStake uint64, + providerAddr types.ProviderConsAddress, +) bool { + if minStake == 0 { return true } @@ -332,7 +401,13 @@ 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, + powerShapingParameters types.PowerShapingParameters, + minPowerToOptIn int64, +) []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,8 +415,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) - if !allowInactiveVals { + if !powerShapingParameters.AllowInactiveVals { // only leave the first MaxProviderConsensusValidators bonded validators maxProviderConsensusVals := k.GetMaxProviderConsensusValidators(ctx) if len(bondedValidators) > int(maxProviderConsensusVals) { @@ -349,11 +423,52 @@ 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, powerShapingParameters.Top_N, minPowerToOptIn) && + k.FulfillsMinStake(ctx, powerShapingParameters.MinStake, providerAddr) }) - nextValidators = k.CapValidatorSet(ctx, chainID, nextValidators) - return k.CapValidatorsPower(ctx, chainID, nextValidators) + nextValidators = k.CapValidatorSet(ctx, powerShapingParameters, nextValidators) + return k.CapValidatorsPower(ctx, powerShapingParameters.ValidatorsPowerCap, nextValidators) +} + +// HasMinPower returns true if the `providerAddr` voting power is GTE than the given minimum power +func (k Keeper) HasMinPower(ctx sdk.Context, providerAddr types.ProviderConsAddress, minPower int64) bool { + val, err := k.stakingKeeper.GetValidatorByConsAddr(ctx, providerAddr.Address) + if err != nil { + k.Logger(ctx).Error( + "cannot get last validator power", + "provider address", + providerAddr, + "error", + err, + ) + return false + } + + valAddr, err := sdk.ValAddressFromBech32(val.GetOperator()) + if err != nil { + k.Logger(ctx).Error( + "could not retrieve validator address", + "operator address", + val.GetOperator(), + "error", + err, + ) + return false + } + + power, err := k.stakingKeeper.GetLastValidatorPower(ctx, valAddr) + if err != nil { + k.Logger(ctx).Error("could not retrieve last power of validator address", + "operator address", + val.GetOperator(), + "error", + err, + ) + return false + } + + return power >= minPower } diff --git a/x/ccv/provider/keeper/partial_set_security_test.go b/x/ccv/provider/keeper/partial_set_security_test.go index e180554239..c9ef563914 100644 --- a/x/ccv/provider/keeper/partial_set_security_test.go +++ b/x/ccv/provider/keeper/partial_set_security_test.go @@ -2,6 +2,7 @@ package keeper_test import ( "bytes" + "fmt" "sort" "testing" @@ -32,13 +33,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", types.CONSUMER_PHASE_STOPPED) + require.Error(t, providerKeeper.HandleOptIn(ctx, "stoppedConsumerId", providerAddr, "")) + + providerKeeper.SetConsumerPhase(ctx, "consumerId", types.CONSUMER_PHASE_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", types.CONSUMER_PHASE_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 +81,26 @@ func TestHandleOptInWithConsumerKey(t *testing.T) { } gomock.InOrder(calls...) - providerKeeper.SetProposedConsumerChain(ctx, "chainID", 1) // 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", types.CONSUMER_PHASE_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) } @@ -94,43 +109,53 @@ func TestHandleOptOut(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() + consumerId := "consumerId" + providerAddr := types.NewProviderConsAddress([]byte("providerAddr")) // trying to opt out from a not running chain returns an error require.Error(t, providerKeeper.HandleOptOut(ctx, "unknownChainID", providerAddr)) - // set a consumer client so that the chain is considered running - providerKeeper.SetConsumerClientId(ctx, "chainID", "clientID") + // set the phase and power shaping params + providerKeeper.SetConsumerPhase(ctx, consumerId, types.CONSUMER_PHASE_LAUNCHED) + err := providerKeeper.SetConsumerPowerShapingParameters(ctx, consumerId, types.PowerShapingParameters{}) + require.NoError(t, err) // 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)) + err = providerKeeper.AppendOptedInConsumerId(ctx, providerAddr, consumerId) + require.NoError(t, err) + err = providerKeeper.HandleOptOut(ctx, consumerId, providerAddr) + require.NoError(t, err) + 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") + // set the phase + providerKeeper.SetConsumerPhase(ctx, consumerId, types.CONSUMER_PHASE_LAUNCHED) // 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) - valA := createStakingValidator(ctx, mocks, 1, 1, 1) // 10% of the total voting power (can opt out) + err := providerKeeper.SetConsumerPowerShapingParameters(ctx, consumerId, types.PowerShapingParameters{ + Top_N: 50, + }) + require.NoError(t, err) + valA := createStakingValidator(ctx, mocks, 1, 1) // 10% of the total voting power (can opt out) valAConsAddr, _ := valA.GetConsAddr() mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, valAConsAddr).Return(valA, nil).AnyTimes() - valB := createStakingValidator(ctx, mocks, 2, 2, 2) // 20% of the total voting power (can opt out) + valB := createStakingValidator(ctx, mocks, 2, 2) // 20% of the total voting power (can opt out) valBConsAddr, _ := valB.GetConsAddr() mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, valBConsAddr).Return(valB, nil).AnyTimes() - valC := createStakingValidator(ctx, mocks, 3, 3, 3) // 30% of the total voting power (cannot opt out) + valC := createStakingValidator(ctx, mocks, 3, 3) // 30% of the total voting power (cannot opt out) valCConsAddr, _ := valC.GetConsAddr() mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, valCConsAddr).Return(valC, nil).AnyTimes() - valD := createStakingValidator(ctx, mocks, 4, 4, 4) // 40% of the total voting power (cannot opt out) + valD := createStakingValidator(ctx, mocks, 4, 4) // 40% of the total voting power (cannot opt out) valDConsAddr, _ := valD.GetConsAddr() mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, valDConsAddr).Return(valD, nil).AnyTimes() @@ -139,29 +164,38 @@ 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)) + err = providerKeeper.AppendOptedInConsumerId(ctx, types.NewProviderConsAddress(valAConsAddr), consumerId) + require.NoError(t, err) + providerKeeper.SetOptedIn(ctx, consumerId, types.NewProviderConsAddress(valBConsAddr)) + err = providerKeeper.AppendOptedInConsumerId(ctx, types.NewProviderConsAddress(valBConsAddr), consumerId) + require.NoError(t, err) + providerKeeper.SetOptedIn(ctx, consumerId, types.NewProviderConsAddress(valCConsAddr)) + err = providerKeeper.AppendOptedInConsumerId(ctx, types.NewProviderConsAddress(valCConsAddr), consumerId) + require.NoError(t, err) + providerKeeper.SetOptedIn(ctx, consumerId, types.NewProviderConsAddress(valDConsAddr)) + err = providerKeeper.AppendOptedInConsumerId(ctx, types.NewProviderConsAddress(valDConsAddr), consumerId) + require.NoError(t, err) // 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() + notFoundValidator := createStakingValidator(ctx, mocks, 5, 5) + notFoundValidatorConsAddr, err := notFoundValidator.GetConsAddr() + require.NoError(t, err) 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 +208,19 @@ 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, types.CONSUMER_PHASE_INITIALIZED) // 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 +231,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) } @@ -215,24 +250,24 @@ func TestOptInTopNValidators(t *testing.T) { defer ctrl.Finish() // create 4 validators with powers 1, 2, 3, and 1 respectively - valA := createStakingValidator(ctx, mocks, 1, 1, 1) + valA := createStakingValidator(ctx, mocks, 1, 1) valAConsAddr, _ := valA.GetConsAddr() - valB := createStakingValidator(ctx, mocks, 2, 2, 2) + valB := createStakingValidator(ctx, mocks, 2, 2) valBConsAddr, _ := valB.GetConsAddr() - valC := createStakingValidator(ctx, mocks, 3, 3, 3) + valC := createStakingValidator(ctx, mocks, 3, 3) valCConsAddr, _ := valC.GetConsAddr() - valD := createStakingValidator(ctx, mocks, 4, 1, 4) + valD := createStakingValidator(ctx, mocks, 1, 4) 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 +281,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 +313,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) { @@ -302,11 +337,11 @@ func TestComputeMinPowerInTopN(t *testing.T) { // 1 => 100% bondedValidators := []stakingtypes.Validator{ - createStakingValidator(ctx, mocks, 1, 5, 1), - createStakingValidator(ctx, mocks, 2, 10, 2), - createStakingValidator(ctx, mocks, 3, 3, 3), - createStakingValidator(ctx, mocks, 4, 1, 4), - createStakingValidator(ctx, mocks, 5, 6, 5), + createStakingValidator(ctx, mocks, 5, 1), + createStakingValidator(ctx, mocks, 10, 2), + createStakingValidator(ctx, mocks, 3, 3), + createStakingValidator(ctx, mocks, 1, 4), + createStakingValidator(ctx, mocks, 6, 5), } m, err := providerKeeper.ComputeMinPowerInTopN(ctx, bondedValidators, 100) @@ -356,34 +391,58 @@ 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() - validator := createStakingValidator(ctx, mocks, 0, 1, 1) + consumerID := "0" + + validator := createStakingValidator(ctx, mocks, 1, 1) // adds GetLastValidatorPower expectation to mocks consAddr, _ := validator.GetConsAddr() 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)) + powerShapingParameters, err := providerKeeper.GetConsumerPowerShapingParameters(ctx, consumerID) + require.Error(t, err) + require.False(t, providerKeeper.CanValidateChain(ctx, consumerID, providerAddr, powerShapingParameters.Top_N, 0)) + + // with TopN chains, the validator can be considered, + mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(gomock.Any(), providerAddr.Address).Return(validator, nil).Times(2) + err = providerKeeper.SetConsumerPowerShapingParameters(ctx, consumerID, types.PowerShapingParameters{Top_N: 50}) + require.NoError(t, err) + powerShapingParameters, err = providerKeeper.GetConsumerPowerShapingParameters(ctx, consumerID) + require.NoError(t, err) + // validator's power is LT the min power + require.False(t, providerKeeper.CanValidateChain(ctx, consumerID, providerAddr, powerShapingParameters.Top_N, 2)) + // validator's power is GTE the min power + require.True(t, providerKeeper.CanValidateChain(ctx, consumerID, providerAddr, powerShapingParameters.Top_N, 1)) + + // when validator is opted-in it can validate regardless of its min power + providerKeeper.SetOptedIn(ctx, consumerID, types.NewProviderConsAddress(consAddr)) + require.True(t, providerKeeper.CanValidateChain(ctx, consumerID, providerAddr, powerShapingParameters.Top_N, 2)) + + // With OptIn chains, validator can validate only if it has already opted-in + err = providerKeeper.SetConsumerPowerShapingParameters(ctx, consumerID, types.PowerShapingParameters{Top_N: 0}) + require.NoError(t, err) + powerShapingParameters, err = providerKeeper.GetConsumerPowerShapingParameters(ctx, consumerID) + require.NoError(t, err) + require.True(t, providerKeeper.CanValidateChain(ctx, consumerID, providerAddr, powerShapingParameters.Top_N, 2)) // create an allow list but do not add the validator `providerAddr` to it - validatorA := createStakingValidator(ctx, mocks, 1, 1, 2) + validatorA := createStakingValidator(ctx, mocks, 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, powerShapingParameters.Top_N, 1)) + providerKeeper.SetAllowlist(ctx, consumerID, types.NewProviderConsAddress(consAddr)) + require.True(t, providerKeeper.CanValidateChain(ctx, consumerID, providerAddr, powerShapingParameters.Top_N, 1)) // 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, powerShapingParameters.Top_N, 1)) // 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, powerShapingParameters.Top_N, 1)) } func TestCapValidatorSet(t *testing.T) { @@ -409,27 +468,54 @@ func TestCapValidatorSet(t *testing.T) { } validators := []types.ConsensusValidator{validatorA, validatorB, validatorC} - consumerValidators := providerKeeper.CapValidatorSet(ctx, "chainID", validators) + powerShapingParameters, err := providerKeeper.GetConsumerPowerShapingParameters(ctx, "consumerId") + require.Error(t, err) + consumerValidators := providerKeeper.CapValidatorSet(ctx, powerShapingParameters, validators) require.Equal(t, validators, consumerValidators) - providerKeeper.SetValidatorSetCap(ctx, "chainID", 0) - consumerValidators = providerKeeper.CapValidatorSet(ctx, "chainID", validators) + err = providerKeeper.SetConsumerPowerShapingParameters(ctx, "consumerId", types.PowerShapingParameters{ + ValidatorSetCap: 0, + }) + require.NoError(t, err) + powerShapingParameters, err = providerKeeper.GetConsumerPowerShapingParameters(ctx, "consumerId") + require.NoError(t, err) + consumerValidators = providerKeeper.CapValidatorSet(ctx, powerShapingParameters, validators) require.Equal(t, validators, consumerValidators) - providerKeeper.SetValidatorSetCap(ctx, "chainID", 100) - consumerValidators = providerKeeper.CapValidatorSet(ctx, "chainID", validators) + err = providerKeeper.SetConsumerPowerShapingParameters(ctx, "consumerId", types.PowerShapingParameters{ + ValidatorSetCap: 100, + }) + require.NoError(t, err) + powerShapingParameters, err = providerKeeper.GetConsumerPowerShapingParameters(ctx, "consumerId") + require.NoError(t, err) + consumerValidators = providerKeeper.CapValidatorSet(ctx, powerShapingParameters, validators) require.Equal(t, validators, consumerValidators) - providerKeeper.SetValidatorSetCap(ctx, "chainID", 1) - consumerValidators = providerKeeper.CapValidatorSet(ctx, "chainID", validators) + err = providerKeeper.SetConsumerPowerShapingParameters(ctx, "consumerId", types.PowerShapingParameters{ + ValidatorSetCap: 1, + }) + require.NoError(t, err) + powerShapingParameters, err = providerKeeper.GetConsumerPowerShapingParameters(ctx, "consumerId") + require.NoError(t, err) + consumerValidators = providerKeeper.CapValidatorSet(ctx, powerShapingParameters, validators) require.Equal(t, []types.ConsensusValidator{validatorC}, consumerValidators) - providerKeeper.SetValidatorSetCap(ctx, "chainID", 2) - consumerValidators = providerKeeper.CapValidatorSet(ctx, "chainID", validators) + err = providerKeeper.SetConsumerPowerShapingParameters(ctx, "consumerId", types.PowerShapingParameters{ + ValidatorSetCap: 2, + }) + require.NoError(t, err) + powerShapingParameters, err = providerKeeper.GetConsumerPowerShapingParameters(ctx, "consumerId") + require.NoError(t, err) + consumerValidators = providerKeeper.CapValidatorSet(ctx, powerShapingParameters, validators) require.Equal(t, []types.ConsensusValidator{validatorC, validatorB}, consumerValidators) - providerKeeper.SetValidatorSetCap(ctx, "chainID", 3) - consumerValidators = providerKeeper.CapValidatorSet(ctx, "chainID", validators) + err = providerKeeper.SetConsumerPowerShapingParameters(ctx, "consumerId", types.PowerShapingParameters{ + ValidatorSetCap: 3, + }) + require.NoError(t, err) + powerShapingParameters, err = providerKeeper.GetConsumerPowerShapingParameters(ctx, "consumerId") + require.NoError(t, err) + consumerValidators = providerKeeper.CapValidatorSet(ctx, powerShapingParameters, validators) require.Equal(t, []types.ConsensusValidator{validatorC, validatorB, validatorA}, consumerValidators) } @@ -477,13 +563,20 @@ func TestCapValidatorsPower(t *testing.T) { } // no capping takes place because validators power-cap is not set - cappedValidators := providerKeeper.CapValidatorsPower(ctx, "chainID", validators) + powerShapingParameters, err := providerKeeper.GetConsumerPowerShapingParameters(ctx, "consumerId") + require.Error(t, err) + cappedValidators := providerKeeper.CapValidatorsPower(ctx, powerShapingParameters.ValidatorsPowerCap, validators) sortValidators(validators) sortValidators(cappedValidators) require.Equal(t, validators, cappedValidators) - providerKeeper.SetValidatorsPowerCap(ctx, "chainID", 33) - cappedValidators = providerKeeper.CapValidatorsPower(ctx, "chainID", validators) + err = providerKeeper.SetConsumerPowerShapingParameters(ctx, "consumerId", types.PowerShapingParameters{ + ValidatorsPowerCap: 33, + }) + require.NoError(t, err) + powerShapingParameters, err = providerKeeper.GetConsumerPowerShapingParameters(ctx, "consumerId") + require.NoError(t, err) + cappedValidators = providerKeeper.CapValidatorsPower(ctx, powerShapingParameters.ValidatorsPowerCap, validators) sortValidators(expectedValidators) sortValidators(cappedValidators) require.Equal(t, expectedValidators, cappedValidators) @@ -687,7 +780,7 @@ func findConsumerValidator(t *testing.T, v types.ConsensusValidator, valsAfter [ func createStakingValidatorsAndMocks(ctx sdk.Context, mocks testkeeper.MockedKeepers, powers ...int64) ([]stakingtypes.Validator, []types.ProviderConsAddress) { var validators []stakingtypes.Validator for i, power := range powers { - val := createStakingValidator(ctx, mocks, i, power, i) + val := createStakingValidator(ctx, mocks, power, i) val.Tokens = math.NewInt(power) val.Status = stakingtypes.Bonded validators = append(validators, val) @@ -742,9 +835,8 @@ func TestFulfillsMinStake(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - providerKeeper.SetMinStake(ctx, "chainID", tc.minStake) for i, valAddr := range consAddrs { - result := providerKeeper.FulfillsMinStake(ctx, "chainID", valAddr) + result := providerKeeper.FulfillsMinStake(ctx, tc.minStake, valAddr) require.Equal(t, tc.expectedFulfill[i], result) } }) @@ -764,7 +856,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 +866,20 @@ 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) + err := providerKeeper.SetConsumerPowerShapingParameters(ctx, "consumerId", types.PowerShapingParameters{ + MinStake: minStake, + AllowInactiveVals: false, + }) + require.NoError(t, err) params := providerKeeper.GetParams(ctx) params.MaxProviderConsensusValidators = int64(maxProviderConsensusVals) providerKeeper.SetParams(ctx, params) + powerShapingParameters, err := providerKeeper.GetConsumerPowerShapingParameters(ctx, "consumerId") + require.NoError(t, err) + // Compute the next validators - nextVals := providerKeeper.ComputeNextValidators(ctx, "chainID", vals) + nextVals := providerKeeper.ComputeNextValidators(ctx, "consumerId", vals, powerShapingParameters, 0) // 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") @@ -804,3 +902,73 @@ func TestIfInactiveValsDisallowedProperty(t *testing.T) { } }) } + +func TestHasMinPower(t *testing.T) { + pk, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + providerConsPubKey := ed25519.GenPrivKeyFromSecret([]byte{1}).PubKey() + consAddr := sdk.ConsAddress(providerConsPubKey.Address()) + providerAddr := types.NewProviderConsAddress(consAddr) + + testCases := []struct { + name string + minPower uint64 + expectation func(sdk.ConsAddress, testkeeper.MockedKeepers) + hasMinPower bool + }{ + { + name: "cannot find validator by cons address", + expectation: func(sdk.ConsAddress, testkeeper.MockedKeepers) { + mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(gomock.Any(), consAddr). + Return(stakingtypes.Validator{}, fmt.Errorf("validator not found")).Times(1) + }, + hasMinPower: false, + }, { + name: "cannot convert validator operator address", + expectation: func(consAddr sdk.ConsAddress, mocks testkeeper.MockedKeepers) { + mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(gomock.Any(), consAddr).Return(stakingtypes.Validator{OperatorAddress: "xxxx"}, nil).Times(1) + }, + hasMinPower: false, + }, { + name: "cannot find last validator power", + expectation: func(consAddr sdk.ConsAddress, mocks testkeeper.MockedKeepers) { + valAddr := sdk.ValAddress(providerAddr.Address.Bytes()) + mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(gomock.Any(), consAddr). + Return(stakingtypes.Validator{OperatorAddress: valAddr.String()}, nil) + mocks.MockStakingKeeper.EXPECT().GetLastValidatorPower(gomock.Any(), valAddr). + Return(int64(0), fmt.Errorf("last power not found")).Times(1) + }, + hasMinPower: false, + }, { + name: "validator power is LT min power", + expectation: func(consAddr sdk.ConsAddress, mocks testkeeper.MockedKeepers) { + valAddr := sdk.ValAddress(providerAddr.Address.Bytes()) + mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(gomock.Any(), consAddr). + Return(stakingtypes.Validator{OperatorAddress: valAddr.String()}, nil) + mocks.MockStakingKeeper.EXPECT().GetLastValidatorPower(gomock.Any(), valAddr). + Return(int64(5), nil).Times(1) + }, + hasMinPower: false, + }, { + name: "validator power is GTE min power", + expectation: func(consAddr sdk.ConsAddress, mocks testkeeper.MockedKeepers) { + valAddr := sdk.ValAddress(providerAddr.Address.Bytes()) + mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(gomock.Any(), consAddr). + Return(stakingtypes.Validator{OperatorAddress: valAddr.String()}, nil) + mocks.MockStakingKeeper.EXPECT().GetLastValidatorPower(gomock.Any(), valAddr). + Return(int64(10), nil).Times(1) + }, + hasMinPower: true, + }, + } + + minPower := int64(10) + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + tc.expectation(consAddr, mocks) + require.Equal(t, tc.hasMinPower, pk.HasMinPower(ctx, providerAddr, minPower)) + }) + } +} diff --git a/x/ccv/provider/keeper/permissionless.go b/x/ccv/provider/keeper/permissionless.go new file mode 100644 index 0000000000..aa32b496a4 --- /dev/null +++ b/x/ccv/provider/keeper/permissionless.go @@ -0,0 +1,289 @@ +package keeper + +import ( + "encoding/binary" + "fmt" + "strconv" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" +) + +// 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 next to-be-assigned 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 initializationParameters types.ConsumerInitializationParameters + if err := initializationParameters.Unmarshal(bz); err != nil { + return types.ConsumerInitializationParameters{}, fmt.Errorf("failed to unmarshal initialization parameters for consumer id (%s): %w", consumerId, err) + } + return initializationParameters, nil +} + +// SetConsumerInitializationParameters sets the initialization parameters associated with this consumer id +func (k Keeper) SetConsumerInitializationParameters(ctx sdk.Context, consumerId string, parameters types.ConsumerInitializationParameters) error { + store := ctx.KVStore(k.storeKey) + bz, err := parameters.Marshal() + if err != nil { + return fmt.Errorf("failed to marshal initialization parameters (%+v) for consumer id (%s): %w", parameters, 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)) +} + +// GetConsumerPhase returns the phase associated with this consumer id +func (k Keeper) GetConsumerPhase(ctx sdk.Context, consumerId string) types.ConsumerPhase { + store := ctx.KVStore(k.storeKey) + buf := store.Get(types.ConsumerIdToPhaseKey(consumerId)) + if buf == nil { + return types.CONSUMER_PHASE_UNSPECIFIED + } + phase := types.ConsumerPhase(binary.BigEndian.Uint32(buf)) + return phase +} + +// SetConsumerPhase sets the phase associated with this consumer id +func (k Keeper) SetConsumerPhase(ctx sdk.Context, consumerId string, phase types.ConsumerPhase) { + store := ctx.KVStore(k.storeKey) + phaseBytes := make([]byte, 8) + binary.BigEndian.PutUint32(phaseBytes, uint32(phase)) + store.Set(types.ConsumerIdToPhaseKey(consumerId), phaseBytes) +} + +// 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)) +} + +// IsConsumerActive checks if a consumer chain is either registered, initialized, or launched. +func (k Keeper) IsConsumerActive(ctx sdk.Context, consumerId string) bool { + phase := k.GetConsumerPhase(ctx, consumerId) + return phase == types.CONSUMER_PHASE_REGISTERED || + phase == types.CONSUMER_PHASE_INITIALIZED || + phase == types.CONSUMER_PHASE_LAUNCHED +} + +// GetOptedInConsumerIds returns all the consumer ids where the given validator is opted in +func (k Keeper) GetOptedInConsumerIds(ctx sdk.Context, providerAddr types.ProviderConsAddress) (types.ConsumerIds, error) { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.ProviderConsAddrToOptedInConsumerIdsKey(providerAddr)) + 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 +} + +// AppendOptedInConsumerId appends given consumer id to the list of consumers that validator has opted in +// TODO (PERMISSIONLESS) -- combine it with SetOptedIn +func (k Keeper) AppendOptedInConsumerId(ctx sdk.Context, providerAddr types.ProviderConsAddress, consumerId string) error { + store := ctx.KVStore(k.storeKey) + + consumers, err := k.GetOptedInConsumerIds(ctx, providerAddr) + if err != nil { + return err + } + + consumersWithAppend := types.ConsumerIds{ + Ids: append(consumers.Ids, consumerId), + } + + bz, err := consumersWithAppend.Marshal() + if err != nil { + return err + } + + store.Set(types.ProviderConsAddrToOptedInConsumerIdsKey(providerAddr), bz) + return nil +} + +// RemoveOptedInConsumerId removes the consumer id from this validator because it is not opted in anymore +func (k Keeper) RemoveOptedInConsumerId(ctx sdk.Context, providerAddr types.ProviderConsAddress, consumerId string) error { + store := ctx.KVStore(k.storeKey) + + consumers, err := k.GetOptedInConsumerIds(ctx, providerAddr) + if err != nil { + return err + } + + if len(consumers.Ids) == 0 { + return fmt.Errorf("no consumer ids found for this provviderAddr: %s", providerAddr.String()) + } + + // find the index of the consumer we want to remove + index := -1 + for i := 0; i < len(consumers.Ids); i = i + 1 { + if consumers.Ids[i] == consumerId { + index = i + break + } + } + + if index == -1 { + return fmt.Errorf("failed to find consumer id (%s)", consumerId) + } + + if len(consumers.Ids) == 1 { + store.Delete(types.ProviderConsAddrToOptedInConsumerIdsKey(providerAddr)) + return nil + } + + consumersWithRemoval := types.ConsumerIds{ + Ids: append(consumers.Ids[:index], consumers.Ids[index+1:]...), + } + + bz, err := consumersWithRemoval.Marshal() + if err != nil { + return err + } + + store.Set(types.ProviderConsAddrToOptedInConsumerIdsKey(providerAddr), bz) + return nil +} + +// 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) { + consumers, 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 consumers.Ids { + 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 +} diff --git a/x/ccv/provider/keeper/permissionless_test.go b/x/ccv/provider/keeper/permissionless_test.go new file mode 100644 index 0000000000..dbb86cb4d4 --- /dev/null +++ b/x/ccv/provider/keeper/permissionless_test.go @@ -0,0 +1,269 @@ +package keeper_test + +import ( + "testing" + "time" + + "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + testkeeper "github.com/cosmos/interchain-security/v5/testutil/keeper" + providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + "github.com/stretchr/testify/require" +) + +// TestConsumerId tests setters and getters of consumer id (i.e., `FetchAndIncrementConsumerId` and `GetConsumerId`) +func TestConsumerId(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + _, found := providerKeeper.GetConsumerId(ctx) + require.False(t, found) + + consumerId := providerKeeper.FetchAndIncrementConsumerId(ctx) + require.Equal(t, "0", consumerId) + consumerIdNum, found := providerKeeper.GetConsumerId(ctx) + require.Equal(t, uint64(1), consumerIdNum) + require.True(t, found) + + consumerId = providerKeeper.FetchAndIncrementConsumerId(ctx) + require.Equal(t, "1", consumerId) + consumerIdNum, found = providerKeeper.GetConsumerId(ctx) + require.Equal(t, uint64(2), consumerIdNum) + require.True(t, found) +} + +// TestConsumerChainId tests the getter, setter, and deletion of the consumer to chain id methods +func TestConsumerChainId(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + _, err := providerKeeper.GetConsumerChainId(ctx, "chainId") + require.Error(t, err, "failed to retrieve chain id") + + providerKeeper.SetConsumerChainId(ctx, "chainId", "chainId") + chainId, err := providerKeeper.GetConsumerChainId(ctx, "chainId") + require.NoError(t, err) + require.Equal(t, "chainId", chainId) + + // write under a different key + providerKeeper.SetConsumerChainId(ctx, "consumerId2", "chainId") + chainId, err = providerKeeper.GetConsumerChainId(ctx, "consumerId2") + require.NoError(t, err) + require.Equal(t, "chainId", chainId) + + // assert that overwriting the current key works + providerKeeper.SetConsumerChainId(ctx, "chainId", "chainId2") + chainId, err = providerKeeper.GetConsumerChainId(ctx, "chainId") + require.NoError(t, err) + require.Equal(t, "chainId2", chainId) + + providerKeeper.DeleteConsumerChainId(ctx, "chainId") + _, err = providerKeeper.GetConsumerChainId(ctx, "chainId") + require.Error(t, err, "failed to retrieve chain id") +} + +// TestConsumerOwnerAddress tests the getter, setter, and deletion of the consumer to owner address methods +func TestConsumerOwnerAddress(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + _, err := providerKeeper.GetConsumerOwnerAddress(ctx, "ownerAddress") + require.Error(t, err, "failed to retrieve owner address") + + providerKeeper.SetConsumerOwnerAddress(ctx, "consumerId", "owner address") + ownerAddress, err := providerKeeper.GetConsumerOwnerAddress(ctx, "consumerId") + require.NoError(t, err) + require.Equal(t, "owner address", ownerAddress) + + // write under a different key + providerKeeper.SetConsumerOwnerAddress(ctx, "consumerId2", "owner address") + ownerAddress, err = providerKeeper.GetConsumerOwnerAddress(ctx, "consumerId2") + require.NoError(t, err) + require.Equal(t, "owner address", ownerAddress) + + // assert that overwriting the current key works + providerKeeper.SetConsumerOwnerAddress(ctx, "consumerId", "owner address2") + ownerAddress, err = providerKeeper.GetConsumerOwnerAddress(ctx, "consumerId") + require.NoError(t, err) + require.Equal(t, "owner address2", ownerAddress) + + providerKeeper.DeleteConsumerOwnerAddress(ctx, "consumerId") + _, err = providerKeeper.GetConsumerChainId(ctx, "consumerId") + require.Error(t, err, "failed to retrieve owner address") +} + +// TestConsumerMetadata tests the getter, setter, and deletion of the consumer id to consumer metadata methods +func TestConsumerMetadata(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + _, err := providerKeeper.GetConsumerMetadata(ctx, "consumerId") + require.Error(t, err) + + expectedMetadata := providertypes.ConsumerMetadata{ + Name: "name", + Description: "description", + Metadata: "metadata", + //ChainId: "chain_id", + } + providerKeeper.SetConsumerMetadata(ctx, "consumerId", expectedMetadata) + actualMetadata, err := providerKeeper.GetConsumerMetadata(ctx, "consumerId") + require.NoError(t, err) + require.Equal(t, expectedMetadata, actualMetadata) + + // assert that overwriting the current registration record works + expectedMetadata = providertypes.ConsumerMetadata{ + Name: "name 2", + Description: "description 2", + Metadata: "metadata 2", + //ChainId: "chain_id2", + } + providerKeeper.SetConsumerMetadata(ctx, "consumerId", expectedMetadata) + actualMetadata, err = providerKeeper.GetConsumerMetadata(ctx, "consumerId") + require.NoError(t, err) + require.Equal(t, expectedMetadata, actualMetadata) + + providerKeeper.DeleteConsumerMetadata(ctx, "consumerId") + actualMetadata, err = providerKeeper.GetConsumerMetadata(ctx, "consumerId") + require.Error(t, err) + require.Equal(t, providertypes.ConsumerMetadata{}, actualMetadata) +} + +// TestConsumerInitializationParameters tests the getter, setter, and deletion of the consumer id to initialization parameters methods +func TestConsumerInitializationParameters(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + _, err := providerKeeper.GetConsumerInitializationParameters(ctx, "consumerId") + require.Error(t, err) + + expectedInitializationParameters := providertypes.ConsumerInitializationParameters{ + InitialHeight: types.Height{RevisionNumber: 1, RevisionHeight: 2}, + GenesisHash: []byte{0, 1}, + BinaryHash: []byte{2, 3}, + SpawnTime: time.Unix(1, 2).UTC(), + UnbondingPeriod: time.Duration(3456), + CcvTimeoutPeriod: time.Duration(789), + TransferTimeoutPeriod: time.Duration(101112), + ConsumerRedistributionFraction: "consumer_redistribution_fraction", + BlocksPerDistributionTransmission: 123, + HistoricalEntries: 456, + DistributionTransmissionChannel: "distribution_transmission_channel", + } + providerKeeper.SetConsumerInitializationParameters(ctx, "consumerId", expectedInitializationParameters) + actualInitializationParameters, err := providerKeeper.GetConsumerInitializationParameters(ctx, "consumerId") + require.NoError(t, err) + require.Equal(t, expectedInitializationParameters, actualInitializationParameters) + + // assert that overwriting the current initialization record works + expectedInitializationParameters = providertypes.ConsumerInitializationParameters{ + InitialHeight: types.Height{RevisionNumber: 2, RevisionHeight: 3}, + GenesisHash: []byte{2, 3}, + BinaryHash: []byte{4, 5}, + SpawnTime: time.Unix(2, 3).UTC(), + UnbondingPeriod: time.Duration(789), + CcvTimeoutPeriod: time.Duration(101112), + TransferTimeoutPeriod: time.Duration(131415), + ConsumerRedistributionFraction: "consumer_redistribution_fraction2", + BlocksPerDistributionTransmission: 456, + HistoricalEntries: 789, + DistributionTransmissionChannel: "distribution_transmission_channel2", + } + providerKeeper.SetConsumerInitializationParameters(ctx, "consumerId", expectedInitializationParameters) + actualInitializationParameters, err = providerKeeper.GetConsumerInitializationParameters(ctx, "consumerId") + require.NoError(t, err) + require.Equal(t, expectedInitializationParameters, actualInitializationParameters) + + providerKeeper.DeleteConsumerInitializationParameters(ctx, "consumerId") + actualInitializationParameters, err = providerKeeper.GetConsumerInitializationParameters(ctx, "consumerId") + require.Error(t, err) + require.Equal(t, providertypes.ConsumerInitializationParameters{}, actualInitializationParameters) +} + +// TestConsumerPhase tests the getter, setter, and deletion of the consumer id to phase methods +func TestConsumerPhase(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + phase := providerKeeper.GetConsumerPhase(ctx, "consumerId") + require.Equal(t, providertypes.CONSUMER_PHASE_UNSPECIFIED, phase) + + providerKeeper.SetConsumerPhase(ctx, "consumerId", providertypes.CONSUMER_PHASE_INITIALIZED) + phase = providerKeeper.GetConsumerPhase(ctx, "consumerId") + require.Equal(t, providertypes.CONSUMER_PHASE_INITIALIZED, phase) + + providerKeeper.SetConsumerPhase(ctx, "consumerId", providertypes.CONSUMER_PHASE_LAUNCHED) + phase = providerKeeper.GetConsumerPhase(ctx, "consumerId") + require.Equal(t, providertypes.CONSUMER_PHASE_LAUNCHED, phase) +} + +// TestOptedInConsumerIds tests the `GetOptedInConsumerIds`, `AppendOptedInConsumerId`, and `RemoveOptedInConsumerId` methods +func TestGetOptedInConsumerIds(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + providerAddr := providertypes.NewProviderConsAddress([]byte("providerAddr")) + consumers, err := providerKeeper.GetOptedInConsumerIds(ctx, providerAddr) + require.NoError(t, err) + require.Empty(t, consumers) + + err = providerKeeper.AppendOptedInConsumerId(ctx, providerAddr, "consumerId1") + require.NoError(t, err) + consumers, err = providerKeeper.GetOptedInConsumerIds(ctx, providerAddr) + require.NoError(t, err) + require.Equal(t, providertypes.ConsumerIds{ + Ids: []string{"consumerId1"}, + }, consumers) + + err = providerKeeper.AppendOptedInConsumerId(ctx, providerAddr, "consumerId2") + require.NoError(t, err) + consumers, err = providerKeeper.GetOptedInConsumerIds(ctx, providerAddr) + require.NoError(t, err) + require.Equal(t, providertypes.ConsumerIds{ + Ids: []string{"consumerId1", "consumerId2"}, + }, consumers) + + err = providerKeeper.AppendOptedInConsumerId(ctx, providerAddr, "consumerId3") + require.NoError(t, err) + consumers, err = providerKeeper.GetOptedInConsumerIds(ctx, providerAddr) + require.NoError(t, err) + require.Equal(t, providertypes.ConsumerIds{ + Ids: []string{"consumerId1", "consumerId2", "consumerId3"}, + }, consumers) + + // remove all the consumer ids + err = providerKeeper.RemoveOptedInConsumerId(ctx, providerAddr, "consumerId2") + require.NoError(t, err) + consumers, err = providerKeeper.GetOptedInConsumerIds(ctx, providerAddr) + require.NoError(t, err) + require.Equal(t, providertypes.ConsumerIds{ + Ids: []string{"consumerId1", "consumerId3"}, + }, consumers) + + err = providerKeeper.RemoveOptedInConsumerId(ctx, providerAddr, "consumerId3") + require.NoError(t, err) + + err = providerKeeper.RemoveOptedInConsumerId(ctx, providerAddr, "consumerId1") + require.NoError(t, err) + + consumers, err = providerKeeper.GetOptedInConsumerIds(ctx, providerAddr) + require.NoError(t, err) + require.Empty(t, consumers) +} + +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) +} diff --git a/x/ccv/provider/keeper/power_shaping.go b/x/ccv/provider/keeper/power_shaping.go new file mode 100644 index 0000000000..c54ca41e4e --- /dev/null +++ b/x/ccv/provider/keeper/power_shaping.go @@ -0,0 +1,286 @@ +package keeper + +import ( + "encoding/binary" + "errors" + "fmt" + + 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" + ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" +) + +// 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{}, errorsmod.Wrapf(ccvtypes.ErrStoreKeyNotFound, + "GetConsumerPowerShapingParameters, consumerId(%s)", consumerId) + } + var parameters types.PowerShapingParameters + if err := parameters.Unmarshal(bz); err != nil { + return types.PowerShapingParameters{}, errorsmod.Wrapf(ccvtypes.ErrStoreUnmarshal, + "GetConsumerPowerShapingParameters, consumerId(%s): %s", consumerId, err.Error()) + } + return parameters, nil +} + +// SetConsumerPowerShapingParameters sets the power-shaping parameters associated with this consumer id. +// Note that it also updates the allowlist and denylist indexes if they are different +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) + } + + // get old power shaping params + oldParameters, err := k.GetConsumerPowerShapingParameters(ctx, consumerId) + // ignore ErrStoreKeyNotFound errors as this might be the first time the power shaping params are set + if errors.Is(err, ccvtypes.ErrStoreUnmarshal) { + return fmt.Errorf("cannot get consumer previous power shaping parameters: %w", err) + } + + store.Set(types.ConsumerIdToPowerShapingParametersKey(consumerId), bz) + + // update allowlist and denylist indexes if needed + if !equalStringSlices(oldParameters.Allowlist, parameters.Allowlist) { + k.UpdateAllowlist(ctx, consumerId, parameters.Allowlist) + } + if !equalStringSlices(oldParameters.Denylist, parameters.Denylist) { + k.UpdateDenylist(ctx, consumerId, parameters.Denylist) + } + + return nil +} + +// equalStringSlices returns true if two string slices are equal +func equalStringSlices(a, b []string) bool { + if len(a) != len(b) { + return false + } + for i, v := range a { + if v != b[i] { + return false + } + } + return true +} + +// SetAllowlist allowlists validator with `providerAddr` address on chain `consumerId` +func (k Keeper) SetAllowlist( + ctx sdk.Context, + consumerId string, + providerAddr types.ProviderConsAddress, +) { + store := ctx.KVStore(k.storeKey) + store.Set(types.AllowlistKey(consumerId, providerAddr), []byte{}) +} + +// GetAllowList returns all allowlisted validators +func (k Keeper) GetAllowList( + ctx sdk.Context, + consumerId string, +) (providerConsAddresses []types.ProviderConsAddress) { + store := ctx.KVStore(k.storeKey) + key := types.StringIdWithLenKey(types.AllowlistKeyPrefix(), consumerId) + iterator := storetypes.KVStorePrefixIterator(store, key) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + providerConsAddresses = append(providerConsAddresses, types.NewProviderConsAddress(iterator.Key()[len(key):])) + } + + return providerConsAddresses +} + +// IsAllowlisted returns `true` if validator with `providerAddr` has been allowlisted on chain `consumerId` +func (k Keeper) IsAllowlisted( + ctx sdk.Context, + consumerId string, + providerAddr types.ProviderConsAddress, +) bool { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.AllowlistKey(consumerId, providerAddr)) + return bz != nil +} + +// DeleteAllowlist deletes all allowlisted validators +func (k Keeper) DeleteAllowlist(ctx sdk.Context, consumerId string) { + store := ctx.KVStore(k.storeKey) + iterator := storetypes.KVStorePrefixIterator(store, types.StringIdWithLenKey(types.AllowlistKeyPrefix(), consumerId)) + defer iterator.Close() + + keysToDel := [][]byte{} + for ; iterator.Valid(); iterator.Next() { + keysToDel = append(keysToDel, iterator.Key()) + } + + for _, key := range keysToDel { + store.Delete(key) + } +} + +// 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.StringIdWithLenKey(types.AllowlistKeyPrefix(), consumerId)) + defer iterator.Close() + + return !iterator.Valid() +} + +// 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)) + } +} + +// SetDenylist denylists validator with `providerAddr` address on chain `consumerId` +func (k Keeper) SetDenylist( + ctx sdk.Context, + consumerId string, + providerAddr types.ProviderConsAddress, +) { + store := ctx.KVStore(k.storeKey) + store.Set(types.DenylistKey(consumerId, providerAddr), []byte{}) +} + +// GetDenyList returns all denylisted validators +func (k Keeper) GetDenyList( + ctx sdk.Context, + consumerId string, +) (providerConsAddresses []types.ProviderConsAddress) { + store := ctx.KVStore(k.storeKey) + key := types.StringIdWithLenKey(types.DenylistKeyPrefix(), consumerId) + iterator := storetypes.KVStorePrefixIterator(store, key) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + providerConsAddresses = append(providerConsAddresses, types.NewProviderConsAddress(iterator.Key()[len(key):])) + } + + return providerConsAddresses +} + +// IsDenylisted returns `true` if validator with `providerAddr` has been denylisted on chain `consumerId` +func (k Keeper) IsDenylisted( + ctx sdk.Context, + consumerId string, + providerAddr types.ProviderConsAddress, +) bool { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.DenylistKey(consumerId, providerAddr)) + return bz != nil +} + +// DeleteDenylist deletes all denylisted validators +func (k Keeper) DeleteDenylist(ctx sdk.Context, consumerId string) { + store := ctx.KVStore(k.storeKey) + iterator := storetypes.KVStorePrefixIterator(store, types.StringIdWithLenKey(types.DenylistKeyPrefix(), consumerId)) + defer iterator.Close() + + keysToDel := [][]byte{} + for ; iterator.Valid(); iterator.Next() { + keysToDel = append(keysToDel, iterator.Key()) + } + + for _, key := range keysToDel { + store.Delete(key) + } +} + +// 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.StringIdWithLenKey(types.DenylistKeyPrefix(), consumerId)) + defer iterator.Close() + + return !iterator.Valid() +} + +// 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)) + } +} + +// SetMinimumPowerInTopN sets the minimum power required for a validator to be in the top N +// for a given consumer chain. +func (k Keeper) SetMinimumPowerInTopN( + ctx sdk.Context, + consumerId string, + power int64, +) { + store := ctx.KVStore(k.storeKey) + + buf := make([]byte, 8) + binary.BigEndian.PutUint64(buf, uint64(power)) + + 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, + consumerId string, +) (int64, bool) { + store := ctx.KVStore(k.storeKey) + buf := store.Get(types.MinimumPowerInTopNKey(consumerId)) + if buf == nil { + return 0, false + } + return int64(binary.BigEndian.Uint64(buf)), true +} + +// DeleteMinimumPowerInTopN removes the minimum power required for a validator to be in the top N +// for a given consumer chain. +func (k Keeper) DeleteMinimumPowerInTopN( + ctx sdk.Context, + consumerId string, +) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.MinimumPowerInTopNKey(consumerId)) +} + +// 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 +} diff --git a/x/ccv/provider/keeper/power_shaping_test.go b/x/ccv/provider/keeper/power_shaping_test.go new file mode 100644 index 0000000000..bcf49373c6 --- /dev/null +++ b/x/ccv/provider/keeper/power_shaping_test.go @@ -0,0 +1,313 @@ +package keeper_test + +import ( + "bytes" + "errors" + "sort" + "testing" + + 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" + providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" +) + +// TestConsumerPowerShapingParameters tests the getter and setter of the consumer id to power-shaping parameters methods +func TestConsumerPowerShapingParameters(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + consumerId := "consumerId" + consAddrs := []string{ + "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk", + "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6", + "cosmosvalcons1muys5jyqk4xd27e208nym85kn0t4zjcfeu63fe", + "cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39", + "cosmosvalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7xw4mceq", + "cosmosvalcons1uuec3cjxajv5te08p220usrjhkfhg9wyvqn0tm", + } + providerConsAddr := []providertypes.ProviderConsAddress{} + for _, addr := range consAddrs { + ca, _ := sdk.ConsAddressFromBech32(addr) + providerConsAddr = append(providerConsAddr, providertypes.NewProviderConsAddress(ca)) + } + sortProviderConsAddr := func(consAddrs []providertypes.ProviderConsAddress) { + sort.Slice(consAddrs, func(i, j int) bool { + return bytes.Compare(consAddrs[i].Address, consAddrs[j].Address) < 0 + }) + } + + _, err := providerKeeper.GetConsumerPowerShapingParameters(ctx, consumerId) + require.Error(t, err) + require.True(t, errors.Is(err, ccvtypes.ErrStoreKeyNotFound)) + + expectedPowerShapingParameters := providertypes.PowerShapingParameters{ + Top_N: 10, + ValidatorsPowerCap: 34, + ValidatorSetCap: 10, + Allowlist: []string{consAddrs[0], consAddrs[1]}, + Denylist: []string{consAddrs[2], consAddrs[3]}, + MinStake: 234, + AllowInactiveVals: true, + } + expectedAllowlist := []providertypes.ProviderConsAddress{providerConsAddr[0], providerConsAddr[1]} + sortProviderConsAddr(expectedAllowlist) + expectedDenylist := []providertypes.ProviderConsAddress{providerConsAddr[2], providerConsAddr[3]} + sortProviderConsAddr(expectedDenylist) + err = providerKeeper.SetConsumerPowerShapingParameters(ctx, consumerId, expectedPowerShapingParameters) + require.NoError(t, err) + actualPowerShapingParameters, err := providerKeeper.GetConsumerPowerShapingParameters(ctx, consumerId) + require.NoError(t, err) + require.Equal(t, expectedPowerShapingParameters, actualPowerShapingParameters) + require.Equal(t, expectedAllowlist, providerKeeper.GetAllowList(ctx, consumerId)) + require.Equal(t, expectedDenylist, providerKeeper.GetDenyList(ctx, consumerId)) + + // assert that overwriting the current initialization record works + expectedPowerShapingParameters = providertypes.PowerShapingParameters{ + Top_N: 12, + ValidatorsPowerCap: 67, + ValidatorSetCap: 20, + Allowlist: []string{consAddrs[4], consAddrs[5]}, + Denylist: []string{consAddrs[2], consAddrs[3]}, + MinStake: 567, + AllowInactiveVals: false, + } + expectedAllowlist = []providertypes.ProviderConsAddress{providerConsAddr[4], providerConsAddr[5]} + sortProviderConsAddr(expectedAllowlist) + expectedDenylist = []providertypes.ProviderConsAddress{providerConsAddr[2], providerConsAddr[3]} + sortProviderConsAddr(expectedDenylist) + err = providerKeeper.SetConsumerPowerShapingParameters(ctx, consumerId, expectedPowerShapingParameters) + require.NoError(t, err) + actualPowerShapingParameters, err = providerKeeper.GetConsumerPowerShapingParameters(ctx, consumerId) + require.NoError(t, err) + require.Equal(t, expectedPowerShapingParameters, actualPowerShapingParameters) + require.Equal(t, expectedAllowlist, providerKeeper.GetAllowList(ctx, consumerId)) + require.Equal(t, expectedDenylist, providerKeeper.GetDenyList(ctx, consumerId)) +} + +// TestAllowlist tests the `SetAllowlist`, `IsAllowlisted`, `DeleteAllowlist`, and `IsAllowlistEmpty` methods +func TestAllowlist(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + chainID := "consumerId" + + // no validator was allowlisted and hence the allowlist is empty + require.True(t, providerKeeper.IsAllowlistEmpty(ctx, chainID)) + + providerAddr1 := providertypes.NewProviderConsAddress([]byte("providerAddr1")) + providerKeeper.SetAllowlist(ctx, chainID, providerAddr1) + require.True(t, providerKeeper.IsAllowlisted(ctx, chainID, providerAddr1)) + + // allowlist is not empty anymore + require.False(t, providerKeeper.IsAllowlistEmpty(ctx, chainID)) + + providerAddr2 := providertypes.NewProviderConsAddress([]byte("providerAddr2")) + providerKeeper.SetAllowlist(ctx, chainID, providerAddr2) + require.True(t, providerKeeper.IsAllowlisted(ctx, chainID, providerAddr2)) + require.False(t, providerKeeper.IsAllowlistEmpty(ctx, chainID)) + + providerKeeper.DeleteAllowlist(ctx, chainID) + require.False(t, providerKeeper.IsAllowlisted(ctx, chainID, providerAddr1)) + require.False(t, providerKeeper.IsAllowlisted(ctx, chainID, providerAddr2)) + require.True(t, providerKeeper.IsAllowlistEmpty(ctx, chainID)) +} + +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)) +} + +// TestDenylist tests the `SetDenylist`, `IsDenylisted`, `DeleteDenylist`, and `IsDenylistEmpty` methods +func TestDenylist(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + chainID := "consumerId" + + // no validator was denylisted and hence the denylist is empty + require.True(t, providerKeeper.IsDenylistEmpty(ctx, chainID)) + + providerAddr1 := providertypes.NewProviderConsAddress([]byte("providerAddr1")) + providerKeeper.SetDenylist(ctx, chainID, providerAddr1) + require.True(t, providerKeeper.IsDenylisted(ctx, chainID, providerAddr1)) + + // denylist is not empty anymore + require.False(t, providerKeeper.IsDenylistEmpty(ctx, chainID)) + + providerAddr2 := providertypes.NewProviderConsAddress([]byte("providerAddr2")) + providerKeeper.SetDenylist(ctx, chainID, providerAddr2) + require.True(t, providerKeeper.IsDenylisted(ctx, chainID, providerAddr2)) + require.False(t, providerKeeper.IsDenylistEmpty(ctx, chainID)) + + providerKeeper.DeleteDenylist(ctx, chainID) + require.False(t, providerKeeper.IsDenylisted(ctx, chainID, providerAddr1)) + require.False(t, providerKeeper.IsDenylisted(ctx, chainID, providerAddr2)) + require.True(t, providerKeeper.IsDenylistEmpty(ctx, chainID)) +} + +func TestUpdateDenylist(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)) +} + +// Tests setting, getting and deleting parameters that are stored per-consumer chain. +// The tests cover the following parameters: +// - MinimumPowerInTopN +func TestKeeperConsumerParams(t *testing.T) { + k, ctx, _, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + + tests := []struct { + name string + settingFunc func(sdk.Context, string, int64) + 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 { + minimumPowerInTopN, _ := k.GetMinimumPowerInTopN(ctx, id) + return minimumPowerInTopN + }, + deleteFunc: func(ctx sdk.Context, id string) { k.DeleteMinimumPowerInTopN(ctx, id) }, + initialValue: 1000, + updatedValue: 2000, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + chainID := "consumerId" + // Set initial value + tt.settingFunc(ctx, chainID, int64(tt.initialValue)) + + // Retrieve and check initial value + 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 := tt.getFunc(ctx, chainID) + require.EqualValues(t, tt.updatedValue, newActualValue) + + // 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 + res = tt.getFunc(ctx, chainID) + require.Zero(t, res) + + // Try deleting again + tt.deleteFunc(ctx, chainID) + + // Check that the value is still deleted + res = tt.getFunc(ctx, chainID) + require.Zero(t, res) + }) + } +} + +func TestUpdateMinimumPowerInTopN(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 + err := providerKeeper.SetConsumerPowerShapingParameters(ctx, consumerId, providertypes.PowerShapingParameters{ + Top_N: 0, + }) + require.NoError(t, err) + + 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, powers[0], 1), // this validator has ~16 of the total voting power + createStakingValidator(ctx, mocks, powers[1], 2), // this validator has ~33% of the total voting gpower + createStakingValidator(ctx, mocks, 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) + err = providerKeeper.SetConsumerPowerShapingParameters(ctx, consumerId, providertypes.PowerShapingParameters{ + Top_N: 50, + }) + require.NoError(t, err) + 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) + err = providerKeeper.SetConsumerPowerShapingParameters(ctx, consumerId, providertypes.PowerShapingParameters{ + Top_N: 51, + }) + require.NoError(t, err) + 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) + err = providerKeeper.SetConsumerPowerShapingParameters(ctx, consumerId, providertypes.PowerShapingParameters{ + Top_N: 100, + }) + require.NoError(t, err) + 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 deleted file mode 100644 index f67f597370..0000000000 --- a/x/ccv/provider/keeper/proposal.go +++ /dev/null @@ -1,653 +0,0 @@ -package keeper - -import ( - "fmt" - "time" - - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" - commitmenttypes "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types" - ibctmtypes "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" - - errorsmod "cosmossdk.io/errors" - storetypes "cosmossdk.io/store/types" - - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - - tmtypes "github.com/cometbft/cometbft/types" - - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" - 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, - MinStake: proposal.MinStake, - AllowInactiveVals: proposal.AllowInactiveVals, - } - - 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 { - p := types.ChangeRewardDenomsProposal{ - DenomsToAdd: proposal.DenomsToAdd, - DenomsToRemove: proposal.DenomsToRemove, - } - - 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, - } - - return k.HandleLegacyConsumerModificationProposal(ctx, &p) -} - -// 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)) - } - - // Set minimum height for equivocation evidence from this consumer chain - k.SetEquivocationEvidenceMinHeight(ctx, chainID, prop.InitialHeight.RevisionHeight) - - // Consumers start out with the unbonding period from the consumer addition prop - consumerUnbondingPeriod := prop.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 - - trustPeriod, err := ccv.CalculateTrustPeriod(consumerUnbondingPeriod, k.GetTrustingPeriodFraction(ctx)) - if err != nil { - return err - } - clientState.TrustingPeriod = trustPeriod - clientState.UnbondingPeriod = consumerUnbondingPeriod - - consumerGen, validatorSetHash, err := k.MakeConsumerGenesis(ctx, prop) - if err != nil { - return err - } - err = k.SetConsumerGenesis(ctx, chainID, consumerGen) - if err != nil { - return err - } - - // Create consensus state - consensusState := ibctmtypes.NewConsensusState( - ctx.BlockTime(), - commitmenttypes.NewMerkleRoot([]byte(ibctmtypes.SentinelRoot)), - validatorSetHash, // use the hash of the updated initial valset - ) - - clientID, err := k.clientKeeper.CreateClient(ctx, clientState, consensusState) - if err != nil { - return err - } - k.SetConsumerClientId(ctx, chainID, clientID) - - k.Logger(ctx).Info("consumer chain registered (client created)", - "chainID", chainID, - "clientID", clientID, - ) - - ctx.EventManager().EmitEvent( - sdk.NewEvent( - types.EventTypeConsumerClientCreated, - sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), - sdk.NewAttribute(ccv.AttributeChainID, chainID), - sdk.NewAttribute(clienttypes.AttributeKeyClientID, clientID), - sdk.NewAttribute(types.AttributeInitialHeight, prop.InitialHeight.String()), - sdk.NewAttribute(types.AttributeTrustingPeriod, clientState.TrustingPeriod.String()), - sdk.NewAttribute(types.AttributeUnbondingPeriod, clientState.UnbondingPeriod.String()), - ), - ) - - 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 { - return errorsmod.Wrap(types.ErrConsumerChainNotFound, - fmt.Sprintf("cannot stop non-existent consumer chain: %s", chainID)) - } - - // clean up states - k.DeleteConsumerClientId(ctx, chainID) - k.DeleteConsumerGenesis(ctx, chainID) - // Note: this call panics if the key assignment state is invalid - k.DeleteKeyAssignments(ctx, chainID) - k.DeleteMinimumPowerInTopN(ctx, chainID) - k.DeleteEquivocationEvidenceMinHeight(ctx, chainID) - - // close channel and delete the mappings between chain ID and channel ID - if channelID, found := k.GetChainToChannel(ctx, chainID); 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 - channel, found := k.channelKeeper.GetChannel(ctx, ccv.ProviderPortID, channelID) - if found && channel.State != channeltypes.CLOSED { - err := k.chanCloseInit(ctx, channelID) - if err != nil { - k.Logger(ctx).Error("channel to consumer chain could not be closed", - "chainID", chainID, - "channelID", channelID, - "error", err.Error(), - ) - } - } - } - k.DeleteChainToChannel(ctx, chainID) - k.DeleteChannelToChain(ctx, channelID) - } - - // delete consumer commission rate - provAddrs := k.GetAllCommissionRateValidators(ctx, chainID) - for _, addr := range provAddrs { - k.DeleteConsumerCommissionRate(ctx, chainID, addr) - } - - k.DeleteInitChainHeight(ctx, chainID) - k.DeleteSlashAcks(ctx, chainID) - k.DeletePendingVSCPackets(ctx, chainID) - - 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.DeleteAllOptedIn(ctx, chainID) - k.DeleteConsumerValSet(ctx, chainID) - - k.Logger(ctx).Info("consumer chain removed from provider", "chainID", chainID) - - return nil -} - -// MakeConsumerGenesis constructs the consumer CCV module part of the genesis state. -func (k Keeper) MakeConsumerGenesis( - ctx sdk.Context, - prop *types.ConsumerAdditionProposal, -) (gen ccv.ConsumerGenesisState, nextValidatorsHash []byte, err error) { - chainID := prop.ChainId - providerUnbondingPeriod, err := k.stakingKeeper.UnbondingTime(ctx) - if err != nil { - return gen, nil, errorsmod.Wrapf(types.ErrNoUnbondingTime, "unbonding time not found: %s", err) - } - height := clienttypes.GetSelfHeight(ctx) - - clientState := k.GetTemplateClient(ctx) - // this is the counter party chain ID for the consumer - clientState.ChainId = ctx.ChainID() - // this is the latest height the client was updated at, i.e., - // the height of the latest consensus state (see below) - clientState.LatestHeight = height - trustPeriod, err := ccv.CalculateTrustPeriod(providerUnbondingPeriod, k.GetTrustingPeriodFraction(ctx)) - if err != nil { - return gen, nil, errorsmod.Wrapf(sdkerrors.ErrInvalidHeight, "error %s calculating trusting_period for: %s", err, height) - } - clientState.TrustingPeriod = trustPeriod - clientState.UnbondingPeriod = providerUnbondingPeriod - - consState, err := k.clientKeeper.GetSelfConsensusState(ctx, height) - if err != nil { - return gen, nil, errorsmod.Wrapf(clienttypes.ErrConsensusStateNotFound, "error %s getting self consensus state for: %s", err, height) - } - - // get the bonded validators from the staking module - bondedValidators, err := k.GetLastBondedValidators(ctx) - if err != nil { - return gen, nil, errorsmod.Wrapf(stakingtypes.ErrNoValidatorFound, "error getting last bonded validators: %s", err) - } - - if prop.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 - // otherwise, it could be that inactive validators are forced to validate - activeValidators, err := k.GetLastProviderConsensusActiveValidators(ctx) - if err != nil { - return gen, nil, errorsmod.Wrapf(stakingtypes.ErrNoValidatorFound, "error getting last active bonded validators: %s", err) - } - - // 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) - 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, - "minPower", minPower, - ) - k.OptInTopNValidators(ctx, chainID, activeValidators, minPower) - k.SetMinimumPowerInTopN(ctx, chainID, 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) - - // get the initial updates with the latest set consumer public keys - initialUpdatesWithConsumerKeys := DiffValidators([]types.ConsensusValidator{}, nextValidators) - - // Get a hash of the consumer validator set from the update with applied consumer assigned keys - updatesAsValSet, err := tmtypes.PB2TM.ValidatorUpdates(initialUpdatesWithConsumerKeys) - if err != nil { - return gen, nil, fmt.Errorf("unable to create validator set from updates computed from key assignment in MakeConsumerGenesis: %s", err) - } - hash := tmtypes.NewValidatorSet(updatesAsValSet).Hash() - - consumerGenesisParams := ccv.NewParams( - true, - prop.BlocksPerDistributionTransmission, - prop.DistributionTransmissionChannel, - "", // providerFeePoolAddrStr, - prop.CcvTimeoutPeriod, - prop.TransferTimeoutPeriod, - prop.ConsumerRedistributionFraction, - prop.HistoricalEntries, - prop.UnbondingPeriod, - []string{}, - []string{}, - ccv.DefaultRetryDelayPeriod, - ) - - gen = *ccv.NewInitialConsumerGenesisState( - clientState, - consState.(*ibctmtypes.ConsensusState), - initialUpdatesWithConsumerKeys, - consumerGenesisParams, - ) - return gen, hash, nil -} - -// 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 -// 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) { - store := ctx.KVStore(k.storeKey) - bz, err := prop.Marshal() - if err != nil { - // An error here would indicate something is very wrong - panic(fmt.Errorf("failed to marshal consumer addition proposal: %w", err)) - } - store.Set(types.PendingCAPKey(prop.SpawnTime, prop.ChainId), bz) -} - -// GetPendingConsumerAdditionProp retrieves a pending consumer addition proposal -// by spawn time and chain id. -// -// Note: this method is only used in testing -func (k Keeper) GetPendingConsumerAdditionProp(ctx sdk.Context, spawnTime time.Time, - chainID string, -) (prop types.ConsumerAdditionProposal, found bool) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.PendingCAPKey(spawnTime, chainID)) - if bz == nil { - return prop, false - } - err := prop.Unmarshal(bz) - if err != nil { - // An error here would indicate something is very wrong, - // the ConsumerAdditionProp is assumed to be correctly serialized in SetPendingConsumerAdditionProp. - panic(fmt.Errorf("failed to unmarshal consumer addition proposal: %w", err)) - } - - 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] -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]) - if err != nil { - // drop the proposal - ctx.Logger().Info("consumer client could not be created: %w", err) - continue - } - - 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") - continue - } - - // 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 -// that are ready to be executed, i.e., consumer clients to be created. -// A prop is included in the returned list if its proposed spawn time has passed. -// -// Note: this method is split out from BeginBlockInit to be easily unit tested. -func (k Keeper) GetConsumerAdditionPropsToExecute(ctx sdk.Context) (propsToExecute []types.ConsumerAdditionProposal) { - store := ctx.KVStore(k.storeKey) - iterator := storetypes.KVStorePrefixIterator(store, types.PendingCAPKeyPrefix()) - - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - var prop types.ConsumerAdditionProposal - err := prop.Unmarshal(iterator.Value()) - if err != nil { - // An error here would indicate something is very wrong, - // the ConsumerAdditionProp is assumed to be correctly serialized in SetPendingConsumerAdditionProp. - panic(fmt.Errorf("failed to unmarshal consumer addition proposal: %w", err)) - } - - if !ctx.BlockTime().Before(prop.SpawnTime) { - propsToExecute = append(propsToExecute, prop) - } else { - break - } - } - - return propsToExecute -} - -// 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 -// Thus, the returned array is in spawnTime order. If two proposals have the same spawnTime, -// then they are ordered by chainID. -func (k Keeper) GetAllPendingConsumerAdditionProps(ctx sdk.Context) (props []types.ConsumerAdditionProposal) { - store := ctx.KVStore(k.storeKey) - iterator := storetypes.KVStorePrefixIterator(store, types.PendingCAPKeyPrefix()) - - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - var prop types.ConsumerAdditionProposal - err := prop.Unmarshal(iterator.Value()) - if err != nil { - // An error here would indicate something is very wrong, - // the ConsumerAdditionProp is assumed to be correctly serialized in SetPendingConsumerAdditionProp. - panic(fmt.Errorf("failed to unmarshal consumer addition proposal: %w", err)) - } - - props = append(props, prop) - } - - return props -} - -// DeletePendingConsumerAdditionProps deletes the given consumer addition proposals -func (k Keeper) DeletePendingConsumerAdditionProps(ctx sdk.Context, proposals ...types.ConsumerAdditionProposal) { - store := ctx.KVStore(k.storeKey) - - for _, p := range proposals { - store.Delete(types.PendingCAPKey(p.SpawnTime, p.ChainId)) - } -} - -// 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 -// 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) { - store := ctx.KVStore(k.storeKey) - bz, err := prop.Marshal() - if err != nil { - // An error here would indicate something is very wrong - panic(fmt.Errorf("failed to marshal consumer removal proposal: %w", err)) - } - store.Set(types.PendingCRPKey(prop.StopTime, prop.ChainId), bz) -} - -// PendingConsumerRemovalPropExists checks whether a pending consumer removal proposal -// exists for the given consumer chain ID and stopTime -// -// Note: this method is only used in testing -func (k Keeper) PendingConsumerRemovalPropExists(ctx sdk.Context, chainID string, timestamp time.Time) bool { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.PendingCRPKey(timestamp, chainID)) - - return bz != nil -} - -// DeletePendingConsumerRemovalProps deletes the given pending consumer removal proposals. -// This method should be called once the proposal has been acted upon. -func (k Keeper) DeletePendingConsumerRemovalProps(ctx sdk.Context, proposals ...types.ConsumerRemovalProposal) { - store := ctx.KVStore(k.storeKey) - - for _, p := range proposals { - store.Delete(types.PendingCRPKey(p.StopTime, p.ChainId)) - } -} - -// 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] -func (k Keeper) BeginBlockCCR(ctx sdk.Context) { - propsToExecute := k.GetConsumerRemovalPropsToExecute(ctx) - - for _, prop := range propsToExecute { - // stop consumer chain in a cached context to handle errors - cachedCtx, writeFn, err := k.StopConsumerChainInCachedCtx(ctx, prop) - if err != nil { - // drop the proposal - ctx.Logger().Info("consumer chain could not be stopped: %w", err) - continue - } - // 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 removal proposal", - "chainID", prop.ChainId, - "title", prop.Title, - "stop time", prop.StopTime.UTC(), - ) - } - // 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. -// -// 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 -} - -// 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 -// Thus, the returned array is in stopTime order. -func (k Keeper) GetAllPendingConsumerRemovalProps(ctx sdk.Context) (props []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)) - } - - props = append(props, prop) - } - - 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) { - cc, writeCache = ctx.CacheContext() - err = k.StopConsumerChain(cc, p.ChainId, true) - return -} diff --git a/x/ccv/provider/keeper/proposal_test.go b/x/ccv/provider/keeper/proposal_test.go deleted file mode 100644 index 472cb3c64c..0000000000 --- a/x/ccv/provider/keeper/proposal_test.go +++ /dev/null @@ -1,1098 +0,0 @@ -package keeper_test - -import ( - "bytes" - "encoding/json" - "sort" - "testing" - "time" - - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - - "cosmossdk.io/math" - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - ibctmtypes "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" - _go "github.com/cosmos/ics23/go" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - - 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" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" -) - -// -// 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 - // Any state-mutating setup on keeper and expected mock calls, specific to this test case - setup func(*providerkeeper.Keeper, sdk.Context, *testkeeper.MockedKeepers) - // Whether a client should be created - expClientCreated bool - } - tests := []testCase{ - { - description: "No state mutation, new client should be created", - setup: func(providerKeeper *providerkeeper.Keeper, ctx sdk.Context, mocks *testkeeper.MockedKeepers) { - // Valid client creation is asserted with mock expectations here - testkeeper.SetupMocksForLastBondedValidatorsExpectation(mocks.MockStakingKeeper, 0, []stakingtypes.Validator{}, 1) // returns empty validator set - gomock.InOrder( - testkeeper.GetMocksForCreateConsumerClient(ctx, mocks, "chainID", clienttypes.NewHeight(4, 5))..., - ) - }, - expClientCreated: true, - }, - { - description: "client for this chain already exists, new one is not created", - setup: func(providerKeeper *providerkeeper.Keeper, ctx sdk.Context, mocks *testkeeper.MockedKeepers) { - providerKeeper.SetConsumerClientId(ctx, "chainID", "clientID") - - // Expect none of the client creation related calls to happen - mocks.MockStakingKeeper.EXPECT().UnbondingTime(gomock.Any()).Times(0) - mocks.MockClientKeeper.EXPECT().CreateClient(gomock.Any(), gomock.Any(), gomock.Any()).Times(0) - mocks.MockClientKeeper.EXPECT().GetSelfConsensusState(gomock.Any(), gomock.Any()).Times(0) - testkeeper.SetupMocksForLastBondedValidatorsExpectation(mocks.MockStakingKeeper, 0, []stakingtypes.Validator{}, 0) // returns empty validator set - }, - expClientCreated: false, - }, - } - - for _, tc := range tests { - // Common setup - keeperParams := testkeeper.NewInMemKeeperParams(t) - providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, keeperParams) - providerKeeper.SetParams(ctx, providertypes.DefaultParams()) - - // Test specific setup - tc.setup(&providerKeeper, ctx, &mocks) - - // Call method with same arbitrary values as defined above in mock expectations. - err := providerKeeper.CreateConsumerClient(ctx, testkeeper.GetTestConsumerAdditionProp()) - - if tc.expClientCreated { - require.NoError(t, err) - testCreatedConsumerClient(t, ctx, providerKeeper, "chainID", "clientID") - } else { - require.Error(t, err) - } - - // Assert mock calls from setup functions - ctrl.Finish() - } -} - -// Executes test assertions for a created consumer client. -// -// Note: Separated from TestCreateConsumerClient to also be called from TestCreateConsumerChainProposal. -func testCreatedConsumerClient(t *testing.T, - ctx sdk.Context, providerKeeper providerkeeper.Keeper, expectedChainID, expectedClientID string, -) { - t.Helper() - // ClientID should be stored. - clientId, found := providerKeeper.GetConsumerClientId(ctx, expectedChainID) - 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) - require.True(t, ok) -} - -// TestPendingConsumerAdditionPropDeletion tests the getting/setting -// and deletion keeper methods for pending consumer addition props -func TestPendingConsumerAdditionPropDeletion(t *testing.T) { - testCases := []struct { - providertypes.ConsumerAdditionProposal - ExpDeleted bool - }{ - { - ConsumerAdditionProposal: providertypes.ConsumerAdditionProposal{ChainId: "0", SpawnTime: time.Now().UTC()}, - ExpDeleted: true, - }, - { - ConsumerAdditionProposal: providertypes.ConsumerAdditionProposal{ChainId: "1", SpawnTime: 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.SetPendingConsumerAdditionProp(ctx, &tc.ConsumerAdditionProposal) - } - - ctx = ctx.WithBlockTime(time.Now().UTC()) - - propsToExecute := providerKeeper.GetConsumerAdditionPropsToExecute(ctx) - // Delete consumer addition proposals, same as what would be done by BeginBlockInit - providerKeeper.DeletePendingConsumerAdditionProps(ctx, propsToExecute...) - numDeleted := 0 - for _, tc := range testCases { - res, found := providerKeeper.GetPendingConsumerAdditionProp(ctx, tc.SpawnTime, tc.ChainId) - if !tc.ExpDeleted { - require.True(t, found) - require.NotEmpty(t, res, "consumer addition proposal was deleted: %s %s", tc.ChainId, tc.SpawnTime.String()) - continue - } - require.Empty(t, res, "consumer addition proposal was not deleted %s %s", tc.ChainId, tc.SpawnTime.String()) - require.Equal(t, propsToExecute[numDeleted].ChainId, tc.ChainId) - numDeleted += 1 - } -} - -// TestGetConsumerAdditionPropsToExecute tests that pending consumer addition proposals -// that are ready to execute are accessed in order by timestamp via the iterator -func TestGetConsumerAdditionPropsToExecute(t *testing.T) { - now := time.Now().UTC() - sampleProp1 := providertypes.ConsumerAdditionProposal{ChainId: "chain-2", SpawnTime: now} - sampleProp2 := providertypes.ConsumerAdditionProposal{ChainId: "chain-1", SpawnTime: now.Add(time.Hour)} - sampleProp3 := providertypes.ConsumerAdditionProposal{ChainId: "chain-4", SpawnTime: now.Add(-time.Hour)} - sampleProp4 := providertypes.ConsumerAdditionProposal{ChainId: "chain-3", SpawnTime: now} - sampleProp5 := providertypes.ConsumerAdditionProposal{ChainId: "chain-1", SpawnTime: now.Add(2 * time.Hour)} - - getExpectedOrder := func(props []providertypes.ConsumerAdditionProposal, accessTime time.Time) []providertypes.ConsumerAdditionProposal { - expectedOrder := []providertypes.ConsumerAdditionProposal{} - for _, prop := range props { - if !accessTime.Before(prop.SpawnTime) { - expectedOrder = append(expectedOrder, prop) - } - } - if len(expectedOrder) == 0 { - return nil - } - // sorting by SpawnTime.UnixNano() - sort.Slice(expectedOrder, func(i, j int) bool { - if expectedOrder[i].SpawnTime.UTC() == expectedOrder[j].SpawnTime.UTC() { - // proposals with same SpawnTime - return expectedOrder[i].ChainId < expectedOrder[j].ChainId - } - return expectedOrder[i].SpawnTime.UTC().Before(expectedOrder[j].SpawnTime.UTC()) - }) - return expectedOrder - } - - testCases := []struct { - propSubmitOrder []providertypes.ConsumerAdditionProposal - accessTime time.Time - }{ - { - propSubmitOrder: []providertypes.ConsumerAdditionProposal{ - sampleProp1, sampleProp2, sampleProp3, sampleProp4, sampleProp5, - }, - accessTime: now, - }, - { - propSubmitOrder: []providertypes.ConsumerAdditionProposal{ - sampleProp3, sampleProp2, sampleProp1, sampleProp5, sampleProp4, - }, - accessTime: now.Add(time.Hour), - }, - { - propSubmitOrder: []providertypes.ConsumerAdditionProposal{ - sampleProp5, sampleProp4, sampleProp3, sampleProp2, sampleProp1, - }, - accessTime: now.Add(-2 * time.Hour), - }, - { - propSubmitOrder: []providertypes.ConsumerAdditionProposal{ - 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.SetPendingConsumerAdditionProp(ctx, &cpProp) - } - propsToExecute := providerKeeper.GetConsumerAdditionPropsToExecute(ctx.WithBlockTime(tc.accessTime)) - require.Equal(t, expectedOrderedProps, propsToExecute) - } -} - -// Test getting both matured and pending consumer addition proposals -func TestGetAllConsumerAdditionProps(t *testing.T) { - pk, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - defer ctrl.Finish() - - now := time.Now().UTC() - props := []providertypes.ConsumerAdditionProposal{ - {ChainId: "chain-2", SpawnTime: now}, - {ChainId: "chain-1", SpawnTime: now.Add(2 * time.Hour)}, - {ChainId: "chain-4", SpawnTime: now.Add(-time.Hour)}, - {ChainId: "chain-3", SpawnTime: now.Add(4 * time.Hour)}, - {ChainId: "chain-1", SpawnTime: now}, - } - expectedGetAllOrder := props - // sorting by SpawnTime.UnixNano() - sort.Slice(expectedGetAllOrder, func(i, j int) bool { - tsi := uint64(expectedGetAllOrder[i].SpawnTime.UTC().UnixNano()) - tsj := uint64(expectedGetAllOrder[j].SpawnTime.UTC().UnixNano()) - cmpTimestamps := bytes.Compare(sdk.Uint64ToBigEndian(tsi), sdk.Uint64ToBigEndian(tsj)) - if cmpTimestamps == 0 { - // proposals with same SpawnTime - return expectedGetAllOrder[i].ChainId < expectedGetAllOrder[j].ChainId - } - return cmpTimestamps == -1 - }) - - for _, prop := range props { - cpProp := prop // bring into loop scope - avoids using iterator pointer instead of value pointer - pk.SetPendingConsumerAdditionProp(ctx, &cpProp) - } - - // iterate and check all results are returned in the expected order - result := pk.GetAllPendingConsumerAdditionProps(ctx.WithBlockTime(now)) - require.Len(t, result, len(props)) - require.Equal(t, expectedGetAllOrder, result) -} - -// Tests the StopConsumerChain method against the spec, -// with more granularity than what's covered in TestHandleLegacyConsumerRemovalProposal, or integration tests. -// 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 TestStopConsumerChain(t *testing.T) { - type testCase struct { - description string - // State-mutating setup specific to this test case - setup func(sdk.Context, *providerkeeper.Keeper, testkeeper.MockedKeepers) - // Whether we should expect the method to return an error - expErr bool - } - - consumerCID := "chainID" - - tests := []testCase{ - { - description: "proposal dropped, client doesn't exist", - setup: func(ctx sdk.Context, providerKeeper *providerkeeper.Keeper, mocks testkeeper.MockedKeepers) { - // No mocks, meaning no external keeper methods are allowed to be called. - }, - expErr: true, - }, - { - 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) - - // set consumer minimum equivocation height - providerKeeper.SetEquivocationEvidenceMinHeight(ctx, consumerCID, 1) - - // assert mocks for expected calls to `StopConsumerChain` when closing the underlying channel - gomock.InOrder(testkeeper.GetMocksForStopConsumerChainWithCloseChannel(ctx, &mocks)...) - }, - expErr: false, - }, - } - - for _, tc := range tests { - - // Common setup - keeperParams := testkeeper.NewInMemKeeperParams(t) - providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, keeperParams) - providerKeeper.SetParams(ctx, providertypes.DefaultParams()) - - // Setup specific to test case - tc.setup(ctx, &providerKeeper, mocks) - - err := providerKeeper.StopConsumerChain(ctx, consumerCID, true) - - if tc.expErr { - require.Error(t, err) - } else { - require.NoError(t, err) - } - - testkeeper.TestProviderStateIsCleanedAfterConsumerChainIsStopped(t, ctx, providerKeeper, consumerCID, "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 - } -} - -// 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) - } -} - -// Test getting both matured and pending consumer removal proposals -func TestGetAllConsumerRemovalProps(t *testing.T) { - pk, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - defer ctrl.Finish() - - now := time.Now().UTC() - props := []providertypes.ConsumerRemovalProposal{ - {ChainId: "chain-2", StopTime: now}, - {ChainId: "chain-1", StopTime: now.Add(2 * time.Hour)}, - {ChainId: "chain-4", StopTime: now.Add(-time.Hour)}, - {ChainId: "chain-3", StopTime: now.Add(4 * time.Hour)}, - {ChainId: "chain-1", StopTime: now}, - } - expectedGetAllOrder := props - // sorting by StopTime.UnixNano() - sort.Slice(expectedGetAllOrder, func(i, j int) bool { - tsi := uint64(expectedGetAllOrder[i].StopTime.UTC().UnixNano()) - tsj := uint64(expectedGetAllOrder[j].StopTime.UTC().UnixNano()) - cmpTimestamps := bytes.Compare(sdk.Uint64ToBigEndian(tsi), sdk.Uint64ToBigEndian(tsj)) - if cmpTimestamps == 0 { - // proposals with same StopTime - return expectedGetAllOrder[i].ChainId < expectedGetAllOrder[j].ChainId - } - return cmpTimestamps == -1 - }) - - for _, prop := range props { - cpProp := prop // bring into loop scope - avoids using iterator pointer instead of value pointer - pk.SetPendingConsumerRemovalProp(ctx, &cpProp) - } - - // iterate and check all results are returned in the expected order - result := pk.GetAllPendingConsumerRemovalProps(ctx.WithBlockTime(now)) - require.Len(t, result, len(props)) - require.Equal(t, expectedGetAllOrder, result) -} - -// TestMakeConsumerGenesis tests the MakeConsumerGenesis keeper method. -// An expected genesis state is hardcoded in json, unmarshaled, and compared -// against an actual consumer genesis state constructed by a provider keeper. -func TestMakeConsumerGenesis(t *testing.T) { - keeperParams := testkeeper.NewInMemKeeperParams(t) - providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, keeperParams) - moduleParams := providertypes.Params{ - TemplateClient: &ibctmtypes.ClientState{ - TrustLevel: ibctmtypes.DefaultTrustLevel, - MaxClockDrift: 10000000000, - ProofSpecs: []*_go.ProofSpec{ - { - LeafSpec: &_go.LeafOp{ - Hash: _go.HashOp_SHA256, - PrehashKey: _go.HashOp_NO_HASH, - PrehashValue: _go.HashOp_SHA256, - Length: _go.LengthOp_VAR_PROTO, - Prefix: []byte{0x00}, - }, - InnerSpec: &_go.InnerSpec{ - ChildOrder: []int32{0, 1}, - ChildSize: 33, - MinPrefixLength: 4, - MaxPrefixLength: 12, - Hash: _go.HashOp_SHA256, - }, - MaxDepth: 0, - MinDepth: 0, - }, - { - LeafSpec: &_go.LeafOp{ - Hash: _go.HashOp_SHA256, - PrehashKey: _go.HashOp_NO_HASH, - PrehashValue: _go.HashOp_SHA256, - Length: _go.LengthOp_VAR_PROTO, - Prefix: []byte{0x00}, - }, - InnerSpec: &_go.InnerSpec{ - ChildOrder: []int32{0, 1}, - ChildSize: 32, - MinPrefixLength: 1, - MaxPrefixLength: 1, - Hash: _go.HashOp_SHA256, - }, - MaxDepth: 0, - }, - }, - UpgradePath: []string{"upgrade", "upgradedIBCState"}, - AllowUpdateAfterExpiry: true, - AllowUpdateAfterMisbehaviour: true, - }, - // Note these are unused provider parameters for this test, and not actually asserted against - // They must be populated with reasonable values to satisfy SetParams though. - TrustingPeriodFraction: providertypes.DefaultTrustingPeriodFraction, - CcvTimeoutPeriod: ccvtypes.DefaultCCVTimeoutPeriod, - SlashMeterReplenishPeriod: providertypes.DefaultSlashMeterReplenishPeriod, - SlashMeterReplenishFraction: providertypes.DefaultSlashMeterReplenishFraction, - ConsumerRewardDenomRegistrationFee: sdk.Coin{ - Denom: "stake", - Amount: math.NewInt(1000000), - }, - BlocksPerEpoch: 600, - NumberOfEpochsToStartReceivingRewards: 24, - } - providerKeeper.SetParams(ctx, moduleParams) - defer ctrl.Finish() - - // - // Other setup not covered by custom template client state - // - ctx = ctx.WithChainID("testchain1") // chainID 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", - BlocksPerDistributionTransmission: 1000, - CcvTimeoutPeriod: 2419200000000000, - TransferTimeoutPeriod: 3600000000000, - ConsumerRedistributionFraction: "0.75", - HistoricalEntries: 10000, - UnbondingPeriod: 1728000000000000, - } - actualGenesis, _, err := providerKeeper.MakeConsumerGenesis(ctx, &prop) - require.NoError(t, err) - - // JSON string with tabs, newlines and spaces for readability - jsonString := `{ - "params": { - "enabled": true, - "blocks_per_distribution_transmission": 1000, - "ccv_timeout_period": 2419200000000000, - "transfer_timeout_period": 3600000000000, - "consumer_redistribution_fraction": "0.75", - "historical_entries": 10000, - "unbonding_period": 1728000000000000, - "soft_opt_out_threshold": "0", - "reward_denoms": [], - "provider_reward_denoms": [], - "retry_delay_period": 3600000000000 - }, - "new_chain": true, - "provider" : { - "client_state": { - "chain_id": "testchain1", - "trust_level": { - "numerator": 1, - "denominator": 3 - }, - "trusting_period": 1197504000000000, - "unbonding_period": 1814400000000000, - "max_clock_drift": 10000000000, - "frozen_height": {}, - "latest_height": { - "revision_height": 5 - }, - "proof_specs": [ - { - "leaf_spec": { - "hash": 1, - "prehash_value": 1, - "length": 1, - "prefix": "AA==" - }, - "inner_spec": { - "child_order": [0, 1], - "child_size": 33, - "min_prefix_length": 4, - "max_prefix_length": 12, - "hash": 1 - } - }, - { - "leaf_spec": { - "hash": 1, - "prehash_value": 1, - "length": 1, - "prefix": "AA==" - }, - "inner_spec": { - "child_order": [0, 1], - "child_size": 32, - "min_prefix_length": 1, - "max_prefix_length": 1, - "hash": 1 - } - } - ], - "upgrade_path": ["upgrade", "upgradedIBCState"], - "allow_update_after_expiry": true, - "allow_update_after_misbehaviour": true - }, - "consensus_state": { - "timestamp": "2020-01-02T00:00:10Z", - "root": { - "hash": "LpGpeyQVLUo9HpdsgJr12NP2eCICspcULiWa5u9udOA=" - }, - "next_validators_hash": "E30CE736441FB9101FADDAF7E578ABBE6DFDB67207112350A9A904D554E1F5BE" - }, - "initial_val_set": [ - { - "pub_key": { - "type": "tendermint/PubKeyEd25519", - "value": "dcASx5/LIKZqagJWN0frOlFtcvz91frYmj/zmoZRWro=" - }, - "power": 1 - } - ] - } - }` - - var expectedGenesis ccvtypes.ConsumerGenesisState - err = json.Unmarshal([]byte(jsonString), &expectedGenesis) // ignores tabs, newlines and spaces - require.NoError(t, err) - - // Zeroing out different fields that are challenging to mock - actualGenesis.Provider.InitialValSet = []abci.ValidatorUpdate{} - expectedGenesis.Provider.InitialValSet = []abci.ValidatorUpdate{} - actualGenesis.Provider.ConsensusState = &ibctmtypes.ConsensusState{} - expectedGenesis.Provider.ConsensusState = &ibctmtypes.ConsensusState{} - - require.Equal(t, expectedGenesis, actualGenesis, "consumer chain genesis created incorrectly") -} - -// 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() - - keeperParams := testkeeper.NewInMemKeeperParams(t) - providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, keeperParams) - providerKeeper.SetParams(ctx, providertypes.DefaultParams()) - 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), - } - - // 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))...) - - // 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))...) - - gomock.InOrder(expectedCalls...) - - for _, prop := range pendingProps { - providerKeeper.SetPendingConsumerAdditionProp(ctx, prop) - } - - // opt in a sample validator so the chain's proposal can successfully execute - validator := cryptotestutil.NewCryptoIdentityFromIntSeed(0).SDKStakingValidator() - consAddr, _ := validator.GetConsAddr() - testkeeper.SetupMocksForLastBondedValidatorsExpectation(mocks.MockStakingKeeper, 1, []stakingtypes.Validator{validator}, -1) // -1 to allow any number of calls - - 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.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) - 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.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) - 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) - 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 - // 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) - 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.True(t, found) - require.Equal(t, uint32(50), topN) - - require.True(t, providerKeeper.IsOptIn(ctx, "chain4")) -} - -// 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() - - keeperParams := testkeeper.NewInMemKeeperParams(t) - providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, keeperParams) - providerKeeper.SetParams(ctx, providertypes.DefaultParams()) - 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), - } - - // - // Mock expectations - // - expectations := []*gomock.Call{} - for _, prop := range pendingProps { - // A consumer chain is setup corresponding to each prop, 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)...) - } - // Only first two consumer chains should be stopped - expectations = append(expectations, testkeeper.GetMocksForStopConsumerChainWithCloseChannel(ctx, &mocks)...) - expectations = append(expectations, testkeeper.GetMocksForStopConsumerChainWithCloseChannel(ctx, &mocks)...) - - gomock.InOrder(expectations...) - - // - // 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) - require.NoError(t, err) - err = providerKeeper.SetConsumerChain(ctx, "channelID") - require.NoError(t, err) - - // Set removal props for all consumer chains - providerKeeper.SetPendingConsumerRemovalProp(ctx, prop) - } - - // 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 - // - - 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) - require.True(t, found) - found = providerKeeper.PendingConsumerRemovalPropExists( - ctx, invalidProp.ChainId, invalidProp.StopTime) - require.False(t, found) -} diff --git a/x/ccv/provider/keeper/relay.go b/x/ccv/provider/keeper/relay.go index b008d79d54..8fc0c08500 100644 --- a/x/ccv/provider/keeper/relay.go +++ b/x/ccv/provider/keeper/relay.go @@ -15,7 +15,6 @@ import ( abci "github.com/cometbft/cometbft/abci/types" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" ) @@ -30,9 +29,8 @@ func (k Keeper) OnAcknowledgementPacket(ctx sdk.Context, packet channeltypes.Pac "channelID", packet.SourceChannel, "error", err, ) - if chainID, ok := k.GetChannelToChain(ctx, packet.SourceChannel); ok { - // stop consumer chain and release unbonding - return k.StopConsumerChain(ctx, chainID, false) + if consumerId, ok := k.GetChannelIdToConsumerId(ctx, packet.SourceChannel); ok { + return k.StopAndPrepareForConsumerRemoval(ctx, consumerId) } return errorsmod.Wrapf(providertypes.ErrUnknownConsumerChannelId, "recv ErrorAcknowledgement on unknown channel %s", packet.SourceChannel) } @@ -42,7 +40,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 +49,8 @@ func (k Keeper) OnTimeoutPacket(ctx sdk.Context, packet channeltypes.Packet) err packet.SourceChannel, ) } - k.Logger(ctx).Info("packet timeout, removing the consumer:", "chainID", chainID) - // stop consumer chain and release unbondings - return k.StopConsumerChain(ctx, chainID, false) + k.Logger(ctx).Info("packet timeout, deleting the consumer:", "consumerId", consumerId) + return k.StopAndPrepareForConsumerRemoval(ctx, consumerId) } // EndBlockVSU contains the EndBlock logic needed for @@ -102,7 +99,7 @@ func (k Keeper) ProviderValidatorUpdates(ctx sdk.Context) ([]abci.ValidatorUpdat return []abci.ValidatorUpdate{}, fmt.Errorf("getting last provider consensus validator set: %w", err) } - nextValidators := []types.ConsensusValidator{} + nextValidators := []providertypes.ConsensusValidator{} maxValidators := k.GetMaxProviderConsensusValidators(ctx) // avoid out of range errors by bounding the max validators to the number of bonded validators if maxValidators > int64(len(bondedValidators)) { @@ -138,16 +135,23 @@ func (k Keeper) BlocksUntilNextEpoch(ctx sdk.Context) int64 { } } -// SendVSCPackets iterates over all registered consumers and sends pending -// VSC packets to the chains with established CCV channels. +// SendVSCPackets iterates over all consumers chains with created IBC clients +// and sends pending VSC packets to the chains with established CCV channels. // If the CCV channel is not established for a consumer chain, // the updates will remain queued until the channel is established +// +// TODO (mpoke): iterate only over consumers with established channel -- GetAllChannelToConsumers func (k Keeper) SendVSCPackets(ctx sdk.Context) error { - for _, chainID := range k.GetAllRegisteredConsumerChainIDs(ctx) { + for _, consumerId := range k.GetAllConsumersWithIBCClients(ctx) { + if k.GetConsumerPhase(ctx, consumerId) != providertypes.CONSUMER_PHASE_LAUNCHED { + // only send VSCPackets to launched chains + continue + } + // check if CCV channel is established and send - if channelID, found := k.GetChainToChannel(ctx, chainID); found { - if err := k.SendVSCPacketsToChain(ctx, chainID, channelID); err != nil { - return fmt.Errorf("sending VSCPacket to consumer, chainID(%s): %w", chainID, err) + if channelID, found := k.GetConsumerIdToChannelId(ctx, consumerId); found { + if err := k.SendVSCPacketsToChain(ctx, consumerId, channelID); err != nil { + return fmt.Errorf("sending VSCPacket to consumer, consumerId(%s): %w", consumerId, err) } } } @@ -155,15 +159,15 @@ func (k Keeper) SendVSCPackets(ctx sdk.Context) error { } // SendVSCPacketsToChain sends all queued VSC packets to the specified chain -func (k Keeper) SendVSCPacketsToChain(ctx sdk.Context, chainID, channelID string) error { - pendingPackets := k.GetPendingVSCPackets(ctx, chainID) +func (k Keeper) SendVSCPacketsToChain(ctx sdk.Context, consumerId, channelId string) error { + 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), @@ -173,25 +177,32 @@ 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 nil } // Not able to send packet over IBC! - k.Logger(ctx).Error("cannot send VSC, removing consumer:", "chainID", chainID, "vscid", data.ValsetUpdateId, "err", err.Error()) - // If this happens, most likely the consumer is malicious; remove it - err := k.StopConsumerChain(ctx, chainID, true) + k.Logger(ctx).Error("cannot send VSC, removing consumer:", "consumerId", consumerId, "vscid", data.ValsetUpdateId, "err", err.Error()) + + err := k.StopAndPrepareForConsumerRemoval(ctx, consumerId) if err != nil { - return fmt.Errorf("stopping consumer, chainID(%s): %w", chainID, err) + k.Logger(ctx).Info("consumer chain failed to stop:", "consumerId", consumerId, "error", err.Error()) + // return fmt.Errorf("stopping consumer, consumerId(%s): %w", consumerId, err) } return nil } } - k.DeletePendingVSCPackets(ctx, chainID) + k.DeletePendingVSCPackets(ctx, consumerId) return nil } -// QueueVSCPackets queues latest validator updates for every registered consumer chain +// QueueVSCPackets queues latest validator updates for every consumer chain +// with the IBC client created. +// +// TODO (mpoke): iterate only over consumers with established channel -- GetAllChannelToConsumers func (k Keeper) QueueVSCPackets(ctx sdk.Context) error { valUpdateID := k.GetValidatorSetUpdateId(ctx) // current valset update ID @@ -207,39 +218,48 @@ func (k Keeper) QueueVSCPackets(ctx sdk.Context) error { return fmt.Errorf("getting provider active validators: %w", err) } - for _, chainID := range k.GetAllRegisteredConsumerChainIDs(ctx) { - currentValidators, err := k.GetConsumerValSet(ctx, chainID) + for _, consumerId := range k.GetAllConsumersWithIBCClients(ctx) { + if k.GetConsumerPhase(ctx, consumerId) != providertypes.CONSUMER_PHASE_LAUNCHED { + // only queue VSCPackets to launched chains + continue + } + + currentValidators, err := k.GetConsumerValSet(ctx, consumerId) + if err != nil { + return fmt.Errorf("getting consumer validators, consumerId(%s): %w", consumerId, err) + } + powerShapingParameters, err := k.GetConsumerPowerShapingParameters(ctx, consumerId) if err != nil { - return fmt.Errorf("getting consumer validators, chainID(%s): %w", chainID, err) + return fmt.Errorf("getting consumer power shaping parameters, consumerId(%s): %w", consumerId, err) } - topN, _ := k.GetTopN(ctx, chainID) - if topN > 0 { + minPower := int64(0) + if powerShapingParameters.Top_N > 0 { // in a Top-N chain, we automatically opt in all validators that belong to the top N // of the active validators - minPower, err := k.ComputeMinPowerInTopN(ctx, activeValidators, topN) + minPower, err = k.ComputeMinPowerInTopN(ctx, activeValidators, powerShapingParameters.Top_N) if err != nil { - return fmt.Errorf("computing min power to opt in, chainID(%s): %w", chainID, err) + return fmt.Errorf("computing min power to opt in, consumerId(%s): %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, powerShapingParameters, minPower) 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), ) @@ -276,8 +296,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.GetAllConsumersWithIBCClients(ctx) { + k.PruneKeyAssignments(ctx, consumerId) } } @@ -289,7 +309,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 @@ -304,10 +324,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, @@ -318,15 +338,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, @@ -339,11 +359,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 } @@ -352,7 +372,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, @@ -366,10 +386,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, @@ -383,14 +403,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 @@ -398,13 +418,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, @@ -439,7 +459,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", @@ -452,9 +472,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() { @@ -489,12 +509,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 ad427ca6c7..753700214b 100644 --- a/x/ccv/provider/keeper/relay_test.go +++ b/x/ccv/provider/keeper/relay_test.go @@ -4,8 +4,10 @@ import ( "sort" "strings" "testing" + "time" "cosmossdk.io/math" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" ibctesting "github.com/cosmos/ibc-go/v8/testing" @@ -97,42 +99,47 @@ func TestQueueVSCPacketsDoesNotResetConsumerValidatorsHeights(t *testing.T) { providerKeeper.SetParams(ctx, providertypes.DefaultParams()) // mock 2 bonded validators - valA := createStakingValidator(ctx, mocks, 1, 1, 1) + valA := createStakingValidator(ctx, mocks, 1, 1) valAConsAddr, _ := valA.GetConsAddr() valAPubKey, _ := valA.TmConsPublicKey() mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, valAConsAddr).Return(valA, nil).AnyTimes() - valB := createStakingValidator(ctx, mocks, 2, 2, 2) + valB := createStakingValidator(ctx, mocks, 2, 2) valBConsAddr, _ := valB.GetConsAddr() mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, valBConsAddr).Return(valB, nil).AnyTimes() 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") + // set a consumer client id and its phase, so we have a consumer chain (i.e., `GetAllConsumersWithIBCClients` is non-empty) + providerKeeper.SetConsumerClientId(ctx, "consumerId", "clientID") + providerKeeper.SetConsumerPhase(ctx, "consumerId", providertypes.CONSUMER_PHASE_LAUNCHED) // 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)) - err := providerKeeper.QueueVSCPackets(ctx) + // set power shaping params + err := providerKeeper.SetConsumerPowerShapingParameters(ctx, "consumerId", providertypes.PowerShapingParameters{}) + require.NoError(t, err) + + err = providerKeeper.QueueVSCPackets(ctx) require.NoError(t, err) // 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") } @@ -143,8 +150,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() @@ -216,8 +223,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() @@ -298,7 +305,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)) @@ -483,10 +490,10 @@ func TestSendVSCPacketsToChainFailure(t *testing.T) { providerKeeper.SetParams(ctx, providertypes.DefaultParams()) // Append mocks for full consumer setup - mockCalls := testkeeper.GetMocksForSetConsumerChain(ctx, &mocks, "consumerChainID") + mockCalls := testkeeper.GetMocksForSetConsumerChain(ctx, &mocks, "consumerId") // Set 3 pending vsc packets - providerKeeper.AppendPendingVSCPackets(ctx, "consumerChainID", []ccv.ValidatorSetChangePacketData{{}, {}, {}}...) + providerKeeper.AppendPendingVSCPackets(ctx, "consumerId", []ccv.ValidatorSetChangePacketData{{}, {}, {}}...) // append mocks for the channel keeper to return an error mockCalls = append(mockCalls, @@ -494,23 +501,36 @@ func TestSendVSCPacketsToChainFailure(t *testing.T) { "CCVChannelID").Return(channeltypes.Channel{}, false).Times(1), ) - // Append mocks for expected call to StopConsumerChain - mockCalls = append(mockCalls, testkeeper.GetMocksForStopConsumerChainWithCloseChannel(ctx, &mocks)...) + // Append mocks for expected call to DeleteConsumerChain + mockCalls = append(mockCalls, testkeeper.GetMocksForDeleteConsumerChain(ctx, &mocks)...) // Assert mock calls hit gomock.InOrder(mockCalls...) // Execute setup + providerKeeper.SetConsumerClientId(ctx, "consumerId", "clientID") err := providerKeeper.SetConsumerChain(ctx, "channelID") require.NoError(t, err) - providerKeeper.SetConsumerClientId(ctx, "consumerChainID", "clientID") - // No error should occur, StopConsumerChain should be called - err = providerKeeper.SendVSCPacketsToChain(ctx, "consumerChainID", "CCVChannelID") + unbondingTime := 123 * time.Second + mocks.MockStakingKeeper.EXPECT().UnbondingTime(gomock.Any()).Return(unbondingTime, nil).AnyTimes() + + // No error should occur, DeleteConsumerChain should be called + err = providerKeeper.SendVSCPacketsToChain(ctx, "consumerId", "CCVChannelID") + require.NoError(t, err) + + // Verify the chain is about to be deleted + removalTime, err := providerKeeper.GetConsumerRemovalTime(ctx, "consumerId") require.NoError(t, err) + require.Equal(t, ctx.BlockTime().Add(unbondingTime), removalTime) - // Pending VSC packets should be deleted in StopConsumerChain - require.Empty(t, providerKeeper.GetPendingVSCPackets(ctx, "consumerChainID")) + // Increase the block time by `unbondingTime` so the chain actually gets deleted + ctx = ctx.WithBlockTime(ctx.BlockTime().Add(unbondingTime)) + providerKeeper.BeginBlockRemoveConsumers(ctx) + + // Pending VSC packets should be deleted in DeleteConsumerChain + require.Empty(t, providerKeeper.GetPendingVSCPackets(ctx, "consumerId")) + require.Equal(t, providertypes.CONSUMER_PHASE_DELETED, providerKeeper.GetConsumerPhase(ctx, "consumerId")) } // TestOnTimeoutPacketWithNoChainFound tests the `OnTimeoutPacket` method fails when no chain is found @@ -519,7 +539,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", } @@ -535,15 +555,30 @@ func TestOnTimeoutPacketStopsChain(t *testing.T) { defer ctrl.Finish() providerKeeper.SetParams(ctx, providertypes.DefaultParams()) - testkeeper.SetupForStoppingConsumerChain(t, ctx, &providerKeeper, mocks) + testkeeper.SetupForDeleteConsumerChain(t, ctx, &providerKeeper, mocks, "consumerId") + mocks.MockChannelKeeper.EXPECT().GetChannel(gomock.Any(), ccv.ProviderPortID, "channelID").Return( + channeltypes.Channel{State: channeltypes.OPEN, + ConnectionHops: []string{"connectionID"}, + }, true, + ).Times(1) + dummyCap := &capabilitytypes.Capability{} + mocks.MockScopedKeeper.EXPECT().GetCapability(gomock.Any(), gomock.Any()).Return(dummyCap, true).Times(1) + mocks.MockChannelKeeper.EXPECT().ChanCloseInit(gomock.Any(), ccv.ProviderPortID, "channelID", dummyCap).Times(1) + + unbondingTime := 123 * time.Second + mocks.MockStakingKeeper.EXPECT().UnbondingTime(gomock.Any()).Return(unbondingTime, nil).AnyTimes() packet := channeltypes.Packet{ SourceChannel: "channelID", } err := providerKeeper.OnTimeoutPacket(ctx, packet) - - testkeeper.TestProviderStateIsCleanedAfterConsumerChainIsStopped(t, ctx, providerKeeper, "chainID", "channelID") require.NoError(t, err) + + // increase the block time by `unbondingTime` so the chain actually gets deleted + ctx = ctx.WithBlockTime(ctx.BlockTime().Add(unbondingTime)) + providerKeeper.BeginBlockRemoveConsumers(ctx) + + testkeeper.TestProviderStateIsCleanedAfterConsumerChainIsDeleted(t, ctx, providerKeeper, "consumerId", "channelID", false) } // TestOnAcknowledgementPacketWithNoAckError tests `OnAcknowledgementPacket` when the underlying ack contains no error @@ -571,15 +606,30 @@ 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.SetupForDeleteConsumerChain(t, ctx, &providerKeeper, mocks, "consumerId") packet := channeltypes.Packet{ SourceChannel: "channelID", } - err = providerKeeper.OnAcknowledgementPacket(ctx, packet, ackError) + unbondingTime := 123 * time.Second + mocks.MockStakingKeeper.EXPECT().UnbondingTime(gomock.Any()).Return(unbondingTime, nil).AnyTimes() + mocks.MockChannelKeeper.EXPECT().GetChannel(gomock.Any(), ccv.ProviderPortID, "channelID").Return( + channeltypes.Channel{State: channeltypes.OPEN, + ConnectionHops: []string{"connectionID"}, + }, true, + ).Times(1) + dummyCap := &capabilitytypes.Capability{} + mocks.MockScopedKeeper.EXPECT().GetCapability(gomock.Any(), gomock.Any()).Return(dummyCap, true).Times(1) + mocks.MockChannelKeeper.EXPECT().ChanCloseInit(gomock.Any(), ccv.ProviderPortID, "channelID", dummyCap).Times(1) - testkeeper.TestProviderStateIsCleanedAfterConsumerChainIsStopped(t, ctx, providerKeeper, "chainID", "channelID") + err = providerKeeper.OnAcknowledgementPacket(ctx, packet, ackError) require.NoError(t, err) + + // increase the block time by `unbondingTime` so the chain actually gets deleted + ctx = ctx.WithBlockTime(ctx.BlockTime().Add(unbondingTime)) + providerKeeper.BeginBlockRemoveConsumers(ctx) + + testkeeper.TestProviderStateIsCleanedAfterConsumerChainIsDeleted(t, ctx, providerKeeper, "consumerId", "channelID", false) } // TestEndBlockVSU tests that during `EndBlockVSU`, we only queue VSC packets at the boundaries of an epoch @@ -587,9 +637,12 @@ func TestEndBlockVSU(t *testing.T) { providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - chainID := "chainID" + consumerId := "0" - providerKeeper.SetTopN(ctx, chainID, 100) + err := providerKeeper.SetConsumerPowerShapingParameters(ctx, "consumerId", providertypes.PowerShapingParameters{ + Top_N: 100, + }) + require.NoError(t, err) // 10 blocks constitute an epoch params := providertypes.DefaultParams() @@ -598,14 +651,12 @@ func TestEndBlockVSU(t *testing.T) { // create 4 sample lastValidators var lastValidators []stakingtypes.Validator - var powers []int64 for i := 0; i < 4; i++ { validator := cryptotestutil.NewCryptoIdentityFromIntSeed(i).SDKStakingValidator() lastValidators = append(lastValidators, validator) valAdrr, err := sdk.ValAddressFromBech32(validator.GetOperator()) require.NoError(t, err) mocks.MockStakingKeeper.EXPECT().GetLastValidatorPower(gomock.Any(), valAdrr).Return(int64(i+1), nil).AnyTimes() - powers = append(powers, int64(i+1)) } testkeeper.SetupMocksForLastBondedValidatorsExpectation(mocks.MockStakingKeeper, 5, lastValidators, -1) @@ -616,26 +667,28 @@ func TestEndBlockVSU(t *testing.T) { }) mocks.MockStakingKeeper.EXPECT().GetBondedValidatorsByPower(gomock.Any()).Return(lastValidators, nil).AnyTimes() - // set a sample client for a consumer chain so that `GetAllConsumerChains` in `QueueVSCPackets` iterates at least once - providerKeeper.SetConsumerClientId(ctx, chainID, "clientID") + // set a sample client for a launched consumer chain so that `GetAllConsumersWithIBCClients` in `QueueVSCPackets` iterates at least once + providerKeeper.SetConsumerClientId(ctx, consumerId, "clientId") + providerKeeper.SetConsumerPowerShapingParameters(ctx, consumerId, providertypes.PowerShapingParameters{Top_N: 100}) + providerKeeper.SetConsumerPhase(ctx, consumerId, providertypes.CONSUMER_PHASE_LAUNCHED) // with block height of 1 we do not expect any queueing of VSC packets ctx = ctx.WithBlockHeight(1) - _, err := providerKeeper.EndBlockVSU(ctx) + _, err = providerKeeper.EndBlockVSU(ctx) require.NoError(t, err) - require.Equal(t, 0, len(providerKeeper.GetPendingVSCPackets(ctx, chainID))) + require.Equal(t, 0, len(providerKeeper.GetPendingVSCPackets(ctx, consumerId))) // with block height of 5 we do not expect any queueing of VSC packets ctx = ctx.WithBlockHeight(5) _, err = providerKeeper.EndBlockVSU(ctx) require.NoError(t, err) - require.Equal(t, 0, len(providerKeeper.GetPendingVSCPackets(ctx, chainID))) + require.Equal(t, 0, len(providerKeeper.GetPendingVSCPackets(ctx, consumerId))) // with block height of 10 we expect the queueing of one VSC packet ctx = ctx.WithBlockHeight(10) _, err = providerKeeper.EndBlockVSU(ctx) require.NoError(t, err) - require.Equal(t, 1, len(providerKeeper.GetPendingVSCPackets(ctx, chainID))) + require.Equal(t, 1, len(providerKeeper.GetPendingVSCPackets(ctx, consumerId))) // With block height of 15 we expect no additional queueing of a VSC packet. // Note that the pending VSC packet is still there because `SendVSCPackets` does not send the packet. We @@ -643,7 +696,7 @@ func TestEndBlockVSU(t *testing.T) { ctx = ctx.WithBlockHeight(15) _, err = providerKeeper.EndBlockVSU(ctx) require.NoError(t, err) - require.Equal(t, 1, len(providerKeeper.GetPendingVSCPackets(ctx, chainID))) + require.Equal(t, 1, len(providerKeeper.GetPendingVSCPackets(ctx, consumerId))) } // TestProviderValidatorUpdates tests that the provider validator updates are correctly calculated, @@ -655,14 +708,14 @@ func TestProviderValidatorUpdates(t *testing.T) { // Mocking bonded validators in the staking keeper. // be aware that the powers need to be in descending order validators := []stakingtypes.Validator{ - createStakingValidator(ctx, mocks, 3, 30, 3), - createStakingValidator(ctx, mocks, 2, 20, 2), - createStakingValidator(ctx, mocks, 1, 10, 1), + createStakingValidator(ctx, mocks, 30, 3), + createStakingValidator(ctx, mocks, 20, 2), + createStakingValidator(ctx, mocks, 10, 1), } mocks.MockStakingKeeper.EXPECT().GetBondedValidatorsByPower(ctx).Return(validators, nil).Times(1) // set up a validator that we will only use for the last provider consensus validator set - removedValidator := createStakingValidator(ctx, mocks, 4, 40, 4) + removedValidator := createStakingValidator(ctx, mocks, 40, 4) // Set up the last provider consensus validators consensusVals := make([]providertypes.ConsensusValidator, 0, len(validators)) @@ -722,22 +775,22 @@ func TestQueueVSCPacketsWithPowerCapping(t *testing.T) { providerKeeper.SetValidatorSetUpdateId(ctx, 1) - valA := createStakingValidator(ctx, mocks, 1, 1, 1) // 3.125% of the total voting power + valA := createStakingValidator(ctx, mocks, 1, 1) // 3.125% of the total voting power valAConsAddr, _ := valA.GetConsAddr() valAPubKey, _ := valA.TmConsPublicKey() mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, valAConsAddr).Return(valA, nil).AnyTimes() - valB := createStakingValidator(ctx, mocks, 2, 3, 2) // 9.375% of the total voting power + valB := createStakingValidator(ctx, mocks, 3, 2) // 9.375% of the total voting power valBConsAddr, _ := valB.GetConsAddr() valBPubKey, _ := valB.TmConsPublicKey() mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, valBConsAddr).Return(valB, nil).AnyTimes() - valC := createStakingValidator(ctx, mocks, 3, 4, 3) // 12.5% of the total voting power + valC := createStakingValidator(ctx, mocks, 4, 3) // 12.5% of the total voting power valCConsAddr, _ := valC.GetConsAddr() valCPubKey, _ := valC.TmConsPublicKey() mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, valCConsAddr).Return(valC, nil).AnyTimes() - valD := createStakingValidator(ctx, mocks, 4, 8, 4) // 25% of the total voting power + valD := createStakingValidator(ctx, mocks, 8, 4) // 25% of the total voting power valDConsAddr, _ := valD.GetConsAddr() mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, valDConsAddr).Return(valD, nil).AnyTimes() - valE := createStakingValidator(ctx, mocks, 5, 16, 5) // 50% of the total voting power + valE := createStakingValidator(ctx, mocks, 16, 5) // 50% of the total voting power valEConsAddr, _ := valE.GetConsAddr() valEPubKey, _ := valE.TmConsPublicKey() mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, valEConsAddr).Return(valE, nil).AnyTimes() @@ -745,31 +798,33 @@ 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.SetConsumerPhase(ctx, "consumerId", providertypes.CONSUMER_PHASE_LAUNCHED) - providerKeeper.SetTopN(ctx, "chainID", 50) // would opt in E + err := providerKeeper.SetConsumerPowerShapingParameters(ctx, "consumerId", providertypes.PowerShapingParameters{ + Top_N: 50, // would opt in E + ValidatorsPowerCap: 40, // set a power-capping of 40% + }) + require.NoError(t, err) // 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) params.MaxProviderConsensusValidators = 180 providerKeeper.SetParams(ctx, params) - err := providerKeeper.QueueVSCPackets(ctx) + err = providerKeeper.QueueVSCPackets(ctx) require.NoError(t, err) - actualQueuedVSCPackets := providerKeeper.GetPendingVSCPackets(ctx, "chainID") + actualQueuedVSCPackets := providerKeeper.GetPendingVSCPackets(ctx, "consumerId") expectedQueuedVSCPackets := []ccv.ValidatorSetChangePacketData{ ccv.NewValidatorSetChangePacketData( []abci.ValidatorUpdate{ diff --git a/x/ccv/provider/keeper/staking_keeper_interface_test.go b/x/ccv/provider/keeper/staking_keeper_interface_test.go index 2eb9c9f1bd..40cfb5c0d7 100644 --- a/x/ccv/provider/keeper/staking_keeper_interface_test.go +++ b/x/ccv/provider/keeper/staking_keeper_interface_test.go @@ -6,7 +6,6 @@ import ( "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/staking/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" testkeeper "github.com/cosmos/interchain-security/v5/testutil/keeper" "github.com/golang/mock/gomock" @@ -107,7 +106,7 @@ func TestStakingKeeperInterface(t *testing.T) { return nil }).AnyTimes() actualValPowers := []int64{} - err := providerKeeper.IterateBondedValidatorsByPower(ctx, func(index int64, validator types.ValidatorI) (stop bool) { + err := providerKeeper.IterateBondedValidatorsByPower(ctx, func(index int64, validator stakingtypes.ValidatorI) (stop bool) { counter++ actualValPowers = append(actualValPowers, validator.GetTokens().Int64()) return false diff --git a/x/ccv/provider/keeper/validator_set_update.go b/x/ccv/provider/keeper/validator_set_update.go index 1c55f26553..95a8d5c9a7 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.StringIdWithLenKey(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..aa9ae6abba 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 @@ -111,7 +111,7 @@ func createConsumerValidator(index int, power int64, seed int) (types.ConsensusV } // createStakingValidator helper function to generate a validator with the given power and with a provider address based on index -func createStakingValidator(ctx sdk.Context, mocks testkeeper.MockedKeepers, index int, power int64, seed int) stakingtypes.Validator { +func createStakingValidator(ctx sdk.Context, mocks testkeeper.MockedKeepers, power int64, seed int) stakingtypes.Validator { providerConsPubKey := cryptotestutil.NewCryptoIdentityFromIntSeed(seed).TMProtoCryptoPublicKey() pk, _ := cryptocodec.FromCmtProtoPublicKey(providerConsPubKey) @@ -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 } @@ -347,7 +348,7 @@ func TestFilterValidatorsConsiderAll(t *testing.T) { var expectedValidators []types.ConsensusValidator // create a staking validator A that has not set a consumer public key - valA := createStakingValidator(ctx, mocks, 1, 1, 1) + valA := createStakingValidator(ctx, mocks, 1, 1) // because validator A has no consumer key set, the `PublicKey` we expect is the key on the provider chain valAConsAddr, _ := valA.GetConsAddr() valAPublicKey, _ := valA.TmConsPublicKey() @@ -358,7 +359,7 @@ func TestFilterValidatorsConsiderAll(t *testing.T) { }) // create a staking validator B that has set a consumer public key - valB := createStakingValidator(ctx, mocks, 2, 2, 2) + valB := createStakingValidator(ctx, mocks, 2, 2) // validator B has set a consumer key, the `PublicKey` we expect is the key set by `SetValidatorConsumerPubKey` valBConsumerKey := cryptotestutil.NewCryptoIdentityFromIntSeed(1).TMProtoCryptoPublicKey() valBConsAddr, _ := valB.GetConsAddr() @@ -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{}, @@ -389,7 +390,7 @@ func TestFilterValidatorsConsiderOnlyOptIn(t *testing.T) { var expectedValidators []types.ConsensusValidator // create a staking validator A that has not set a consumer public key - valA := createStakingValidator(ctx, mocks, 1, 1, 1) + valA := createStakingValidator(ctx, mocks, 1, 1) // because validator A has no consumer key set, the `PublicKey` we expect is the key on the provider chain valAConsAddr, _ := valA.GetConsAddr() valAPublicKey, _ := valA.TmConsPublicKey() @@ -401,7 +402,7 @@ func TestFilterValidatorsConsiderOnlyOptIn(t *testing.T) { expectedValidators = append(expectedValidators, expectedValAConsumerValidator) // create a staking validator B that has set a consumer public key - valB := createStakingValidator(ctx, mocks, 2, 2, 2) + valB := createStakingValidator(ctx, mocks, 2, 2) // validator B has set a consumer key, the `PublicKey` we expect is the key set by `SetValidatorConsumerPubKey` valBConsumerKey := cryptotestutil.NewCryptoIdentityFromIntSeed(1).TMProtoCryptoPublicKey() valBConsAddr, _ := valB.GetConsAddr() @@ -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) }) @@ -436,9 +437,9 @@ func TestFilterValidatorsConsiderOnlyOptIn(t *testing.T) { require.Equal(t, expectedValidators, actualValidators) // create a staking validator C that is not opted in, hence `expectedValidators` remains the same - valC := createStakingValidator(ctx, mocks, 3, 3, 3) + valC := createStakingValidator(ctx, mocks, 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,10 +453,10 @@ 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) + valA := createStakingValidator(ctx, mocks, 1, 1) valAConsumerKey := cryptotestutil.NewCryptoIdentityFromIntSeed(1).TMProtoCryptoPublicKey() valAConsAddr, _ := valA.GetConsAddr() valAProviderConsAddr := types.NewProviderConsAddress(valAConsAddr) @@ -470,7 +471,7 @@ func TestCreateConsumerValidator(t *testing.T) { require.NoError(t, err) // create a validator which has not set a consumer public key - valB := createStakingValidator(ctx, mocks, 1, 2, 2) + valB := createStakingValidator(ctx, mocks, 2, 2) valBConsAddr, _ := valB.GetConsAddr() valBProviderConsAddr := types.NewProviderConsAddress(valBConsAddr) valBPublicKey, _ := valB.TmConsPublicKey() diff --git a/x/ccv/provider/migrations/migrator.go b/x/ccv/provider/migrations/migrator.go index 4678fe83cd..edc80ef6ce 100644 --- a/x/ccv/provider/migrations/migrator.go +++ b/x/ccv/provider/migrations/migrator.go @@ -8,9 +8,6 @@ import ( paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" - v4 "github.com/cosmos/interchain-security/v5/x/ccv/provider/migrations/v4" - v5 "github.com/cosmos/interchain-security/v5/x/ccv/provider/migrations/v5" - v6 "github.com/cosmos/interchain-security/v5/x/ccv/provider/migrations/v6" v7 "github.com/cosmos/interchain-security/v5/x/ccv/provider/migrations/v7" v8 "github.com/cosmos/interchain-security/v5/x/ccv/provider/migrations/v8" ) @@ -55,24 +52,23 @@ func (m Migrator) Migrate2to3(ctx sdktypes.Context) error { // Migrate3to4 migrates x/ccvprovider state from consensus version 3 to 4. // The migration consists of provider chain params additions. func (m Migrator) Migrate3to4(ctx sdktypes.Context) error { - v4.MigrateParams(ctx, m.paramSpace) - return nil + return fmt.Errorf("state migration failed: " + + "first run provider@v4.3.x in production to migrate from consensus version 3 to 4") } // Migrate4to5 migrates x/ccvprovider state from consensus version 4 to 5. // The migration consists of setting a top N of 95 for all registered consumer chains. func (m Migrator) Migrate4to5(ctx sdktypes.Context) error { - v5.MigrateTopNForRegisteredChains(ctx, m.providerKeeper) - return nil + return fmt.Errorf("state migration failed: " + + "first run provider@v4.3.x in production to migrate from consensus version 4 to 5") } // Migrate5to6 migrates x/ccvprovider state from consensus version 5 to 6. // It consists of setting the `NumberOfEpochsToStartReceivingRewards` param, as well as // computing and storing the minimal power in the top N for all registered consumer chains. func (m Migrator) Migrate5to6(ctx sdktypes.Context) error { - v6.MigrateParams(ctx, m.paramSpace) - v6.MigrateMinPowerInTopN(ctx, m.providerKeeper) - return nil + return fmt.Errorf("state migration failed: " + + "first run provider@v4.3.x in production to migrate from consensus version 5 to 6") } // Migrate6to7 migrates x/ccvprovider state from consensus version 6 to 7. @@ -92,6 +88,9 @@ func (m Migrator) Migrate7to8(ctx sdktypes.Context) error { if err := v8.MigrateConsumerAddrsToPrune(ctx, store, m.providerKeeper); err != nil { return err } + if err := v8.MigrateLaunchedConsumerChains(ctx, store, m.providerKeeper); err != nil { + return err + } v8.CleanupState(store) return nil diff --git a/x/ccv/provider/migrations/v4/migration_test.go b/x/ccv/provider/migrations/v4/migration_test.go deleted file mode 100644 index 4423842149..0000000000 --- a/x/ccv/provider/migrations/v4/migration_test.go +++ /dev/null @@ -1,27 +0,0 @@ -package v4 - -import ( - "testing" - - "github.com/stretchr/testify/require" - - testutil "github.com/cosmos/interchain-security/v5/testutil/keeper" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" -) - -func TestMigrateParams(t *testing.T) { - inMemParams := testutil.NewInMemKeeperParams(t) - _, ctx, ctrl, _ := testutil.GetProviderKeeperAndCtx(t, inMemParams) - defer ctrl.Finish() - - // initially blocks per epoch param does not exist - require.False(t, inMemParams.ParamsSubspace.Has(ctx, providertypes.KeyBlocksPerEpoch)) - - MigrateParams(ctx, *inMemParams.ParamsSubspace) - - // after migration, blocks per epoch param should exist and be equal to default - require.True(t, inMemParams.ParamsSubspace.Has(ctx, providertypes.KeyBlocksPerEpoch)) - var blocksPerEpochParam int64 - inMemParams.ParamsSubspace.Get(ctx, providertypes.KeyBlocksPerEpoch, &blocksPerEpochParam) - require.Equal(t, providertypes.DefaultBlocksPerEpoch, blocksPerEpochParam) -} diff --git a/x/ccv/provider/migrations/v4/migrations.go b/x/ccv/provider/migrations/v4/migrations.go deleted file mode 100644 index e60c98700e..0000000000 --- a/x/ccv/provider/migrations/v4/migrations.go +++ /dev/null @@ -1,18 +0,0 @@ -package v4 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" -) - -// MigrateParams adds missing provider chain params to the param store. -func MigrateParams(ctx sdk.Context, paramsSubspace paramtypes.Subspace) { - if paramsSubspace.HasKeyTable() { - paramsSubspace.Set(ctx, providertypes.KeyBlocksPerEpoch, providertypes.DefaultBlocksPerEpoch) - } else { - paramsSubspace.WithKeyTable(providertypes.ParamKeyTable()) - paramsSubspace.Set(ctx, providertypes.KeyBlocksPerEpoch, providertypes.DefaultBlocksPerEpoch) - } -} diff --git a/x/ccv/provider/migrations/v5/migration_test.go b/x/ccv/provider/migrations/v5/migration_test.go deleted file mode 100644 index 907aa1b019..0000000000 --- a/x/ccv/provider/migrations/v5/migration_test.go +++ /dev/null @@ -1,30 +0,0 @@ -package v5 - -import ( - "testing" - - "github.com/stretchr/testify/require" - - testutil "github.com/cosmos/interchain-security/v5/testutil/keeper" -) - -func TestMigrateParams(t *testing.T) { - inMemParams := testutil.NewInMemKeeperParams(t) - provKeeper, ctx, ctrl, _ := testutil.GetProviderKeeperAndCtx(t, inMemParams) - defer ctrl.Finish() - - provKeeper.SetConsumerClientId(ctx, "chainID", "clientID") - - // initially top N should not exist - topN, found := provKeeper.GetTopN(ctx, "chainID") - require.False(t, found) - 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) - require.Equal(t, uint32(95), topN) -} diff --git a/x/ccv/provider/migrations/v5/migrations.go b/x/ccv/provider/migrations/v5/migrations.go deleted file mode 100644 index 411efd49e1..0000000000 --- a/x/ccv/provider/migrations/v5/migrations.go +++ /dev/null @@ -1,21 +0,0 @@ -package v5 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" -) - -// This migration only takes already registered chains into account. -// If a chain is in voting while the upgrade happens, this is not sufficient, -// 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) - } -} - -// // If there are consumer addition proposals in the voting period at the upgrade time, they may need the topN value updated. -// func MigrateTopNForVotingPeriodChains(ctx sdk.Context, govKeeper govkeeper.Keeper, providerKeeper providerkeeper.Keeper) { -// } diff --git a/x/ccv/provider/migrations/v6/migration_test.go b/x/ccv/provider/migrations/v6/migration_test.go deleted file mode 100644 index 9396a3e05d..0000000000 --- a/x/ccv/provider/migrations/v6/migration_test.go +++ /dev/null @@ -1,27 +0,0 @@ -package v6 - -import ( - "testing" - - "github.com/stretchr/testify/require" - - testutil "github.com/cosmos/interchain-security/v5/testutil/keeper" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" -) - -func TestMigrateParams(t *testing.T) { - inMemParams := testutil.NewInMemKeeperParams(t) - _, ctx, ctrl, _ := testutil.GetProviderKeeperAndCtx(t, inMemParams) - defer ctrl.Finish() - - // initially number of epochs param does not exist - require.False(t, inMemParams.ParamsSubspace.Has(ctx, providertypes.KeyNumberOfEpochsToStartReceivingRewards)) - - MigrateParams(ctx, *inMemParams.ParamsSubspace) - - // after migration, number of epochs to start receiving rewards param should exist and be equal to default - require.True(t, inMemParams.ParamsSubspace.Has(ctx, providertypes.KeyNumberOfEpochsToStartReceivingRewards)) - var numberOfEpochsParam int64 - inMemParams.ParamsSubspace.Get(ctx, providertypes.KeyNumberOfEpochsToStartReceivingRewards, &numberOfEpochsParam) - require.Equal(t, providertypes.DefaultNumberOfEpochsToStartReceivingRewards, numberOfEpochsParam) -} diff --git a/x/ccv/provider/migrations/v6/migrations.go b/x/ccv/provider/migrations/v6/migrations.go deleted file mode 100644 index 5829f29222..0000000000 --- a/x/ccv/provider/migrations/v6/migrations.go +++ /dev/null @@ -1,47 +0,0 @@ -package v6 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - - providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" -) - -// MigrateParams adds missing provider chain params to the param store. -func MigrateParams(ctx sdk.Context, paramsSubspace paramtypes.Subspace) { - if !paramsSubspace.HasKeyTable() { - paramsSubspace.WithKeyTable(providertypes.ParamKeyTable()) - } - paramsSubspace.Set(ctx, providertypes.KeyNumberOfEpochsToStartReceivingRewards, providertypes.DefaultNumberOfEpochsToStartReceivingRewards) -} - -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) - - 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 { - providerKeeper.Logger(ctx).Info("top N is 0, not setting minimal power", "chain", chain) - } else { - // set the minimal power in the top N - bondedValidators, err := providerKeeper.GetLastBondedValidators(ctx) - if err != nil { - providerKeeper.Logger(ctx).Error("failed to get last bonded validators", "chain", chain, "error", err) - continue - } - minPower, err := providerKeeper.ComputeMinPowerInTopN(ctx, bondedValidators, topN) - if err != nil { - providerKeeper.Logger(ctx).Error("failed to compute min power in top N", "chain", chain, "topN", topN, "error", err) - continue - } - providerKeeper.SetMinimumPowerInTopN(ctx, chain, minPower) - } - } -} diff --git a/x/ccv/provider/migrations/v8/migrations.go b/x/ccv/provider/migrations/v8/migrations.go index cdf299f91f..c7ace6eb3f 100644 --- a/x/ccv/provider/migrations/v8/migrations.go +++ b/x/ccv/provider/migrations/v8/migrations.go @@ -4,11 +4,15 @@ import ( "encoding/binary" "time" + "github.com/cosmos/cosmos-sdk/types/bech32" + + errorsmod "cosmossdk.io/errors" storetypes "cosmossdk.io/store/types" sdk "github.com/cosmos/cosmos-sdk/types" providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" ) const ( @@ -19,6 +23,30 @@ const ( LegacyInitTimeoutTimestampBytePrefix = byte(8) LegacyVscSendTimestampBytePrefix = byte(18) LegacyVSCMaturedHandledThisBlockBytePrefix = byte(28) + + LegacyPendingCAPKeyPrefix = byte(9) + LegacyPendingCRPKeyPrefix = byte(10) + LegacyProposedConsumerChainKeyPrefix = byte(30) + + LegacyThrottledPacketDataSizeKeyPrefix = byte(19) + LegacyThrottledPacketDataKeyPrefix = byte(20) + LegacyGlobalSlashEntryKeyPrefix = byte(21) + LegacyTopNKeyPrefix = byte(33) + LegacyValidatorsPowerCapKeyPrefix = byte(34) + LegacyValidatorSetCapKeyPrefix = byte(35) + + LegacyChainToChannelKeyPrefix = byte(5) + LegacyChannelToChainKeyPrefix = byte(6) + LegacyChainToClientKeyPrefix = byte(7) + + // needed for rekeying + ConsumerGenesisKeyPrefix = byte(14) + SlashAcksKeyPrefix = byte(15) + InitChainHeightKeyPrefix = byte(16) + PendingVSCsKeyPrefix = byte(17) + EquivocationEvidenceMinHeightKeyPrefix = byte(29) + ConsumerRewardsAllocationKeyPrefix = byte(38) + MinimumPowerInTopNKeyPrefix = byte(40) ) // CompleteUnbondingOps completes all unbonding operations. @@ -51,7 +79,7 @@ func MigrateConsumerAddrsToPrune(ctx sdk.Context, store storetypes.KVStore, pk p } for ; iterator.Valid(); iterator.Next() { - chainID, vscID, err := providertypes.ParseChainIdAndUintIdKey(LegacyConsumerAddrsToPruneBytePrefix, iterator.Key()) + chainID, vscID, err := providertypes.ParseStringIdAndUintIdKey(LegacyConsumerAddrsToPruneBytePrefix, iterator.Key()) if err != nil { pk.Logger(ctx).Error("ParseChainIdAndUintIdKey failed while migrating ConsumerAddrsToPrune", "key", string(iterator.Key()), @@ -60,7 +88,7 @@ func MigrateConsumerAddrsToPrune(ctx sdk.Context, store storetypes.KVStore, pk p continue } // use the VscSendTimestamp index to compute the timestamp after which this consumer address can be pruned - vscSendTimestampKey := providertypes.ChainIdAndUintIdKey(LegacyVscSendTimestampBytePrefix, chainID, vscID) + vscSendTimestampKey := providertypes.StringIdAndUintIdKey(LegacyVscSendTimestampBytePrefix, chainID, vscID) var sentTime time.Time if timeBz := store.Get(vscSendTimestampKey); timeBz != nil { if ts, err := sdk.ParseTimeBytes(timeBz); err == nil { @@ -95,6 +123,268 @@ func MigrateConsumerAddrsToPrune(ctx sdk.Context, store storetypes.KVStore, pk p return nil } +// MigrateLaunchedConsumerChains migrates all the state for consumer chains with an existing client +// Note that it must be executed before CleanupState. +func MigrateLaunchedConsumerChains(ctx sdk.Context, store storetypes.KVStore, pk providerkeeper.Keeper) error { + chainIds := []string{} + iterator := storetypes.KVStorePrefixIterator(store, []byte{LegacyChainToClientKeyPrefix}) + for ; iterator.Valid(); iterator.Next() { + // remove 1 byte prefix from key to retrieve chainId + chainId := string(iterator.Key()[1:]) + chainIds = append(chainIds, chainId) + } + err := iterator.Close() + if err != nil { + return err + } + + for _, chainId := range chainIds { + // create new consumerId + consumerId := pk.FetchAndIncrementConsumerId(ctx) + + // re-key store + + // channelId -> chainId + channelId, found := pk.GetConsumerIdToChannelId(ctx, chainId) + if !found { + return errorsmod.Wrapf(ccv.ErrInvalidConsumerState, "cannot find channel id associated with consumer id: %s", consumerId) + } + pk.SetChannelToConsumerId(ctx, channelId, consumerId) + + // chainId -> channelId + rekeyFromChainIdToConsumerId(store, LegacyChainToChannelKeyPrefix, chainId, consumerId) + + // chainId -> clientId + rekeyFromChainIdToConsumerId(store, LegacyChainToClientKeyPrefix, chainId, consumerId) + + // chainId -> consumer genesis + rekeyFromChainIdToConsumerId(store, ConsumerGenesisKeyPrefix, chainId, consumerId) + + // chainId -> SlashAcks + rekeyFromChainIdToConsumerId(store, SlashAcksKeyPrefix, chainId, consumerId) + + // chainId -> InitChainHeight + rekeyFromChainIdToConsumerId(store, InitChainHeightKeyPrefix, chainId, consumerId) + + // chainId -> PendingVSCs + rekeyFromChainIdToConsumerId(store, PendingVSCsKeyPrefix, chainId, consumerId) + + // chainId -> ConsumerValidators + rekeyChainIdAndConsAddrKey(store, providertypes.ConsumerValidatorsKeyPrefix(), chainId, consumerId) + + // chainId -> ValidatorsByConsumerAddr + rekeyChainIdAndConsAddrKey(store, providertypes.ValidatorsByConsumerAddrKeyPrefix(), chainId, consumerId) + + // chainId -> EquivocationEvidenceMinHeight + rekeyFromChainIdToConsumerId(store, EquivocationEvidenceMinHeightKeyPrefix, chainId, consumerId) + + // chainId -> ConsumerValidator + rekeyChainIdAndConsAddrKey(store, providertypes.ConsumerValidatorKeyPrefix(), chainId, consumerId) + + // chainId -> OptedIn + rekeyChainIdAndConsAddrKey(store, providertypes.OptedInKeyPrefix(), chainId, consumerId) + + // chainId -> Allowlist + rekeyChainIdAndConsAddrKey(store, providertypes.AllowlistKeyPrefix(), chainId, consumerId) + + // chainId -> Denylist + rekeyChainIdAndConsAddrKey(store, providertypes.DenylistKeyPrefix(), chainId, consumerId) + + // chainId -> ConsumerRewardsAllocations + rekeyFromChainIdToConsumerId(store, ConsumerRewardsAllocationKeyPrefix, chainId, consumerId) + + // chainId -> ConsumerCommissionRate + rekeyChainIdAndConsAddrKey(store, providertypes.ConsumerCommissionRateKeyPrefix(), chainId, consumerId) + + // chainId -> MinimumPowerInTopN + oldKey := providertypes.StringIdWithLenKey(MinimumPowerInTopNKeyPrefix, chainId) + value := store.Get(oldKey) + if value != nil { + newKey := providertypes.StringIdWithLenKey(MinimumPowerInTopNKeyPrefix, consumerId) + store.Set(newKey, value) + store.Delete(oldKey) + } + + // chainId -> ConsumerAddrsToPruneV2 + rekeyChainIdAndTsKey(store, providertypes.ConsumerAddrsToPruneV2KeyPrefix(), chainId, consumerId) + + pk.SetConsumerChainId(ctx, consumerId, chainId) + + // set ownership -- all existing chains are owned by gov + pk.SetConsumerOwnerAddress(ctx, consumerId, pk.GetAuthority()) + + // Note: ConsumerMetadata will be populated in the upgrade handler + // Note: InitializationParameters is not needed since the chain is already launched + + // migrate power shaping params + topNKey := providertypes.StringIdWithLenKey(LegacyTopNKeyPrefix, chainId) + var topN uint32 = 0 + buf := store.Get(topNKey) + if buf != nil { + topN = binary.BigEndian.Uint32(buf) + } + + validatorsPowerCapKey := providertypes.StringIdWithLenKey(LegacyValidatorsPowerCapKeyPrefix, chainId) + var validatorsPowerCap uint32 = 0 + buf = store.Get(validatorsPowerCapKey) + if buf != nil { + validatorsPowerCap = binary.BigEndian.Uint32(buf) + } + + validatorSetCapKey := providertypes.StringIdWithLenKey(LegacyValidatorSetCapKeyPrefix, chainId) + var validatorSetCap uint32 = 0 + buf = store.Get(validatorSetCapKey) + if buf != nil { + validatorSetCap = binary.BigEndian.Uint32(buf) + } + + bech32PrefixConsAddr := sdk.GetConfig().GetBech32ConsensusAddrPrefix() + var allowlist []string + for _, addr := range pk.GetAllowList(ctx, consumerId) { + bech32Addr, _ := bech32.ConvertAndEncode(bech32PrefixConsAddr, addr.ToSdkConsAddr().Bytes()) + allowlist = append(allowlist, bech32Addr) + } + + var denylist []string + for _, addr := range pk.GetDenyList(ctx, consumerId) { + bech32Addr, _ := bech32.ConvertAndEncode(bech32PrefixConsAddr, addr.ToSdkConsAddr().Bytes()) + allowlist = append(allowlist, bech32Addr) + } + + powerShapingParameters := providertypes.PowerShapingParameters{ + Top_N: topN, + ValidatorsPowerCap: validatorsPowerCap, + ValidatorSetCap: validatorSetCap, + Allowlist: allowlist, + Denylist: denylist, + // do not set those since they do not exist in a previous interchain-security version and hence cannot be set + MinStake: 0, + AllowInactiveVals: false, + } + err := pk.SetConsumerPowerShapingParameters(ctx, consumerId, powerShapingParameters) + if err != nil { + return err + } + + // set phase to launched + pk.SetConsumerPhase(ctx, consumerId, providertypes.CONSUMER_PHASE_LAUNCHED) + + // This is to migrate everything under `ProviderConsAddrToOptedInConsumerIdsKey` + // `OptedIn` was already re-keyed earlier (see above) and hence we can use `consumerId` here. + for _, providerConsAddr := range pk.GetAllOptedIn(ctx, consumerId) { + err := pk.AppendOptedInConsumerId(ctx, providerConsAddr, consumerId) + if err != nil { + return err + } + } + + // set clientId -> consumerId mapping + // consumer to client was already re-keyed so we can use `consumerId` here + // however, during the rekeying, the reverse index was not set + clientId, found := pk.GetConsumerClientId(ctx, consumerId) + if !found { + return errorsmod.Wrapf(ccv.ErrInvalidConsumerState, "cannot find client ID associated with consumer ID: %s", consumerId) + } + pk.SetConsumerClientId(ctx, consumerId, clientId) + } + + return nil +} + +// rekeyFromChainIdToConsumerId migrates store keys from `keyPrefix | chainId` +// to `keyPrefix | consumerId` leaving the value unchanged +func rekeyFromChainIdToConsumerId( + store storetypes.KVStore, + keyPrefix byte, + chainId, consumerId string, +) { + oldKey := append([]byte{keyPrefix}, []byte(chainId)...) + value := store.Get(oldKey) + if value != nil { + newKey := append([]byte{keyPrefix}, []byte(consumerId)...) + store.Set(newKey, value) + store.Delete(oldKey) + } +} + +// rekeyChainIdAndConsAddrKey migrates store keys +// from `keyPrefix | len(chainID) | chainID | ConsAddress` +// to `keyPrefix | len(consumerId) | consumerId | ConsAddress“ +// leaving the value unchanged +func rekeyChainIdAndConsAddrKey( + store storetypes.KVStore, + keyPrefix byte, + chainId, consumerId string, +) error { + oldPartialKey := providertypes.StringIdWithLenKey(keyPrefix, chainId) + addrs := []sdk.ConsAddress{} + iterator := storetypes.KVStorePrefixIterator(store, oldPartialKey) + for ; iterator.Valid(); iterator.Next() { + _, addr, err := providertypes.ParseStringIdAndConsAddrKey(keyPrefix, iterator.Key()) + if err != nil { + return err + } + addrs = append(addrs, addr) + } + err := iterator.Close() + if err != nil { + return err + } + + for _, addr := range addrs { + oldKey := providertypes.StringIdAndConsAddrKey(keyPrefix, chainId, addr) + value := store.Get(oldKey) + if value == nil { + // this should not happen, but just in case as Set will fail if value is nil + continue + } + newKey := providertypes.StringIdAndConsAddrKey(keyPrefix, consumerId, addr) + store.Set(newKey, value) + store.Delete(oldKey) + } + + return nil +} + +// rekeyChainIdAndTsKey migrates store keys +// from `keyPrefix | len(chainID) | chainID | timestamp` +// to `keyPrefix | len(consumerId) | consumerId | timestamp +// leaving the value unchanged +func rekeyChainIdAndTsKey( + store storetypes.KVStore, + keyPrefix byte, + chainId, consumerId string, +) error { + oldPartialKey := providertypes.StringIdWithLenKey(keyPrefix, chainId) + timestamps := []time.Time{} + iterator := storetypes.KVStorePrefixIterator(store, oldPartialKey) + for ; iterator.Valid(); iterator.Next() { + _, ts, err := providertypes.ParseStringIdAndTsKey(keyPrefix, iterator.Key()) + if err != nil { + return err + } + timestamps = append(timestamps, ts) + } + err := iterator.Close() + if err != nil { + return err + } + + for _, ts := range timestamps { + oldKey := providertypes.StringIdAndTsKey(keyPrefix, chainId, ts) + value := store.Get(oldKey) + if value == nil { + // this should not happen, but just in case as Set will fail if value is nil + continue + } + newKey := providertypes.StringIdAndTsKey(keyPrefix, consumerId, ts) + store.Set(newKey, value) + store.Delete(oldKey) + } + + return nil +} + // CleanupState removes deprecated state func CleanupState(store storetypes.KVStore) { removePrefix(store, LegacyMaturedUnbondingOpsByteKey) @@ -104,6 +394,18 @@ func CleanupState(store storetypes.KVStore) { removePrefix(store, LegacyVscSendTimestampBytePrefix) removePrefix(store, LegacyVSCMaturedHandledThisBlockBytePrefix) removePrefix(store, LegacyConsumerAddrsToPruneBytePrefix) + + removePrefix(store, LegacyPendingCAPKeyPrefix) + removePrefix(store, LegacyPendingCRPKeyPrefix) + removePrefix(store, LegacyProposedConsumerChainKeyPrefix) + + removePrefix(store, LegacyThrottledPacketDataSizeKeyPrefix) + removePrefix(store, LegacyThrottledPacketDataKeyPrefix) + removePrefix(store, LegacyGlobalSlashEntryKeyPrefix) + + removePrefix(store, LegacyTopNKeyPrefix) + removePrefix(store, LegacyValidatorsPowerCapKeyPrefix) + removePrefix(store, LegacyValidatorSetCapKeyPrefix) } func removePrefix(store storetypes.KVStore, prefix byte) { diff --git a/x/ccv/provider/migrations/v8/migrations_test.go b/x/ccv/provider/migrations/v8/migrations_test.go index 8c23fccc64..8f37f84d13 100644 --- a/x/ccv/provider/migrations/v8/migrations_test.go +++ b/x/ccv/provider/migrations/v8/migrations_test.go @@ -14,7 +14,7 @@ import ( ) func legacyConsumerAddrsToPruneKey(chainID string, vscID uint64) []byte { - return providertypes.ChainIdAndUintIdKey(LegacyConsumerAddrsToPruneBytePrefix, chainID, vscID) + return providertypes.StringIdAndUintIdKey(LegacyConsumerAddrsToPruneBytePrefix, chainID, vscID) } func legacyAppendConsumerAddrsToPrune( @@ -44,7 +44,7 @@ func legacyAppendConsumerAddrsToPrune( } func legacyVscSendingTimestampKey(chainID string, vscID uint64) []byte { - return providertypes.ChainIdAndUintIdKey(LegacyVscSendTimestampBytePrefix, chainID, vscID) + return providertypes.StringIdAndUintIdKey(LegacyVscSendTimestampBytePrefix, chainID, vscID) } func legacySetVscSendTimestamp( diff --git a/x/ccv/provider/module.go b/x/ccv/provider/module.go index 320a135a69..2f089509ee 100644 --- a/x/ccv/provider/module.go +++ b/x/ccv/provider/module.go @@ -171,11 +171,12 @@ 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) - am.keeper.BeginBlockInit(sdkCtx) - // Stop and remove state for any consumer chains that are due to be stopped via pending consumer removal proposals - am.keeper.BeginBlockCCR(sdkCtx) + // Create clients to consumer chains that are due to be spawned + am.keeper.BeginBlockLaunchConsumers(sdkCtx) + // Stop and remove state for any consumer chains that are due to be stopped + am.keeper.BeginBlockRemoveConsumers(sdkCtx) // Check for replenishing slash meter before any slash packets are processed for this block am.keeper.BeginBlockCIS(sdkCtx) // BeginBlock logic needed for the Reward Distribution sub-protocol diff --git a/x/ccv/provider/module_test.go b/x/ccv/provider/module_test.go index 2b2ac1c63f..9cbe5d6f4c 100644 --- a/x/ccv/provider/module_test.go +++ b/x/ccv/provider/module_test.go @@ -104,8 +104,6 @@ func TestInitGenesis(t *testing.T) { providerKeeper.GetValidatorSetUpdateId(ctx), nil, tc.consumerStates, - nil, - nil, types.DefaultParams(), nil, nil, @@ -174,11 +172,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..ea66146039 100644 --- a/x/ccv/provider/proposal_handler.go +++ b/x/ccv/provider/proposal_handler.go @@ -18,13 +18,11 @@ 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) + return nil default: return errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized ccv proposal content type: %T", c) } 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..bc2ec27fa2 100644 --- a/x/ccv/provider/types/codec.go +++ b/x/ccv/provider/types/codec.go @@ -19,20 +19,19 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { registry.RegisterImplementations( (*govv1beta1.Content)(nil), &ConsumerAdditionProposal{}, - ) - registry.RegisterImplementations( - (*govv1beta1.Content)(nil), &ConsumerRemovalProposal{}, - ) - registry.RegisterImplementations( - (*govv1beta1.Content)(nil), &ConsumerModificationProposal{}, + &ChangeRewardDenomsProposal{}, ) registry.RegisterImplementations( (*sdk.Msg)(nil), - &MsgAssignConsumerKey{}, &MsgConsumerAddition{}, &MsgConsumerRemoval{}, + &MsgConsumerModification{}, + &MsgAssignConsumerKey{}, + &MsgCreateConsumer{}, + &MsgUpdateConsumer{}, + &MsgRemoveConsumer{}, &MsgChangeRewardDenoms{}, &MsgUpdateParams{}, ) @@ -41,10 +40,6 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { (*govv1beta1.Content)(nil), &EquivocationProposal{}, ) - registry.RegisterImplementations( - (*govv1beta1.Content)(nil), - &ChangeRewardDenomsProposal{}, - ) registry.RegisterImplementations( (*sdk.Msg)(nil), &MsgSubmitConsumerMisbehaviour{}, diff --git a/x/ccv/provider/types/consumer.go b/x/ccv/provider/types/consumer.go index 37c286422f..ebc1bcbf30 100644 --- a/x/ccv/provider/types/consumer.go +++ b/x/ccv/provider/types/consumer.go @@ -12,6 +12,7 @@ func NewConsumerStates( genesis ccv.ConsumerGenesisState, pendingValsetChanges []ccv.ValidatorSetChangePacketData, slashDowntimeAck []string, + phase ConsumerPhase, ) ConsumerState { return ConsumerState{ ChainId: chainID, @@ -21,5 +22,6 @@ func NewConsumerStates( PendingValsetChanges: pendingValsetChanges, ConsumerGenesis: genesis, SlashDowntimeAck: slashDowntimeAck, + Phase: phase, } } diff --git a/x/ccv/provider/types/errors.go b/x/ccv/provider/types/errors.go index 5109489d76..2d87ee1345 100644 --- a/x/ccv/provider/types/errors.go +++ b/x/ccv/provider/types/errors.go @@ -6,30 +6,43 @@ 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") + ErrInvalidConsumerId = errorsmod.Register(ModuleName, 6, "invalid consumer id") + 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") + ErrInvalidConsumerRewardDenom = errorsmod.Register(ModuleName, 14, "invalid consumer reward denom") + ErrInvalidConsumerClient = errorsmod.Register(ModuleName, 16, "ccv channel is not built on correct client") + ErrConsumerChainNotFound = errorsmod.Register(ModuleName, 18, "consumer chain not found") + ErrCannotOptOutFromTopN = errorsmod.Register(ModuleName, 20, "cannot opt out from a Top N chain") + ErrInvalidConsumerModificationProposal = errorsmod.Register(ModuleName, 22, "invalid consumer modification proposal") + ErrNoUnbondingTime = errorsmod.Register(ModuleName, 23, "provider unbonding time not found") + 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") + 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") + ErrInvalidRemovalTime = errorsmod.Register(ModuleName, 43, "invalid removal time") + ErrInvalidMsgCreateConsumer = errorsmod.Register(ModuleName, 44, "invalid create consumer message") + ErrInvalidMsgUpdateConsumer = errorsmod.Register(ModuleName, 45, "invalid update consumer message") + ErrInvalidMsgAssignConsumerKey = errorsmod.Register(ModuleName, 46, "invalid assign consumer key message") + ErrInvalidMsgSubmitConsumerMisbehaviour = errorsmod.Register(ModuleName, 47, "invalid submit consumer misbehaviour message") + ErrInvalidMsgSubmitConsumerDoubleVoting = errorsmod.Register(ModuleName, 48, "invalid submit consumer double voting message") + ErrInvalidMsgOptIn = errorsmod.Register(ModuleName, 49, "invalid opt in message") + ErrInvalidMsgOptOut = errorsmod.Register(ModuleName, 50, "invalid opt out message") + ErrInvalidMsgSetConsumerCommissionRate = errorsmod.Register(ModuleName, 51, "invalid set consumer commission rate message") + ErrInvalidMsgChangeRewardDenoms = errorsmod.Register(ModuleName, 52, "invalid change reward denoms message") ) diff --git a/x/ccv/provider/types/events.go b/x/ccv/provider/types/events.go index 9abcba7836..77992a7e02 100644 --- a/x/ccv/provider/types/events.go +++ b/x/ccv/provider/types/events.go @@ -4,19 +4,30 @@ package types const ( EventTypeConsumerClientCreated = "consumer_client_created" EventTypeAssignConsumerKey = "assign_consumer_key" - EventTypeAddConsumerRewardDenom = "add_consumer_reward_denom" - EventTypeRemoveConsumerRewardDenom = "remove_consumer_reward_denom" + EventTypeChangeConsumerRewardDenom = "change_consumer_reward_denom" EventTypeExecuteConsumerChainSlash = "execute_consumer_chain_slash" EventTypeSetConsumerCommissionRate = "set_consumer_commission_rate" EventTypeOptIn = "opt_in" EventTypeOptOut = "opt_out" + EventTypeCreateConsumer = "create_consumer" + EventTypeUpdateConsumer = "update_consumer" + EventTypeRemoveConsumer = "remove_consumer" + AttributeInfractionHeight = "infraction_height" AttributeInitialHeight = "initial_height" AttributeTrustingPeriod = "trusting_period" AttributeUnbondingPeriod = "unbonding_period" AttributeProviderValidatorAddress = "provider_validator_address" AttributeConsumerConsensusPubKey = "consumer_consensus_pub_key" - AttributeConsumerRewardDenom = "consumer_reward_denom" + AttributeAddConsumerRewardDenom = "add_consumer_reward_denom" + AttributeRemoveConsumerRewardDenom = "remove_consumer_reward_denom" + AttributeSubmitterAddress = "submitter_address" AttributeConsumerCommissionRate = "consumer_commission_rate" - AttributeConsumerChainID = "consumer_chain_id" + AttributeConsumerId = "consumer_id" + AttributeConsumerChainId = "consumer_chain_id" + AttributeConsumerName = "consumer_name" + AttributeConsumerOwner = "consumer_owner" + AttributeConsumerSpawnTime = "consumer_spawn_time" + AttributeConsumerPhase = "consumer_phase" + AttributeConsumerTopN = "consumer_topn" ) diff --git a/x/ccv/provider/types/genesis.go b/x/ccv/provider/types/genesis.go index 5cd60982a6..be4b9d8934 100644 --- a/x/ccv/provider/types/genesis.go +++ b/x/ccv/provider/types/genesis.go @@ -16,23 +16,19 @@ func NewGenesisState( vscID uint64, vscIdToHeights []ValsetUpdateIdToHeight, consumerStates []ConsumerState, - additionProposals []ConsumerAdditionProposal, - removalProposals []ConsumerRemovalProposal, params Params, validatorConsumerPubkeys []ValidatorConsumerPubKey, validatorsByConsumerAddr []ValidatorByConsumerAddr, consumerAddrsToPrune []ConsumerAddrsToPruneV2, ) *GenesisState { return &GenesisState{ - ValsetUpdateId: vscID, - ValsetUpdateIdToHeight: vscIdToHeights, - ConsumerStates: consumerStates, - ConsumerAdditionProposals: additionProposals, - ConsumerRemovalProposals: removalProposals, - Params: params, - ValidatorConsumerPubkeys: validatorConsumerPubkeys, - ValidatorsByConsumerAddr: validatorsByConsumerAddr, - ConsumerAddrsToPruneV2: consumerAddrsToPrune, + ValsetUpdateId: vscID, + ValsetUpdateIdToHeight: vscIdToHeights, + ConsumerStates: consumerStates, + Params: params, + ValidatorConsumerPubkeys: validatorConsumerPubkeys, + ValidatorsByConsumerAddr: validatorsByConsumerAddr, + ConsumerAddrsToPruneV2: consumerAddrsToPrune, } } @@ -49,18 +45,6 @@ func (gs GenesisState) Validate() error { return errorsmod.Wrap(ccv.ErrInvalidGenesis, "valset update ID cannot be equal to zero") } - for _, prop := range gs.ConsumerAdditionProposals { - if err := prop.ValidateBasic(); err != nil { - return errorsmod.Wrap(ccv.ErrInvalidGenesis, err.Error()) - } - } - - for _, prop := range gs.ConsumerRemovalProposals { - if err := prop.ValidateBasic(); err != nil { - return errorsmod.Wrap(ccv.ErrInvalidGenesis, err.Error()) - } - } - if len(gs.ValsetUpdateIdToHeight) > 0 { // check only the first tuple of the list since it is ordered by VSC ID if gs.ValsetUpdateIdToHeight[0].ValsetUpdateId == 0 { diff --git a/x/ccv/provider/types/genesis.pb.go b/x/ccv/provider/types/genesis.pb.go index 7097cd1a2b..bbf069fec6 100644 --- a/x/ccv/provider/types/genesis.pb.go +++ b/x/ccv/provider/types/genesis.pb.go @@ -32,11 +32,7 @@ type GenesisState struct { ConsumerStates []ConsumerState `protobuf:"bytes,2,rep,name=consumer_states,json=consumerStates,proto3" json:"consumer_states" yaml:"consumer_states"` // empty for a new chain ValsetUpdateIdToHeight []ValsetUpdateIdToHeight `protobuf:"bytes,5,rep,name=valset_update_id_to_height,json=valsetUpdateIdToHeight,proto3" json:"valset_update_id_to_height"` - // empty for a new chain - ConsumerAdditionProposals []ConsumerAdditionProposal `protobuf:"bytes,6,rep,name=consumer_addition_proposals,json=consumerAdditionProposals,proto3" json:"consumer_addition_proposals"` - // empty for a new chain - ConsumerRemovalProposals []ConsumerRemovalProposal `protobuf:"bytes,7,rep,name=consumer_removal_proposals,json=consumerRemovalProposals,proto3" json:"consumer_removal_proposals"` - Params Params `protobuf:"bytes,8,opt,name=params,proto3" json:"params"` + Params Params `protobuf:"bytes,8,opt,name=params,proto3" json:"params"` // empty for a new chain ValidatorConsumerPubkeys []ValidatorConsumerPubKey `protobuf:"bytes,9,rep,name=validator_consumer_pubkeys,json=validatorConsumerPubkeys,proto3" json:"validator_consumer_pubkeys"` // empty for a new chain @@ -99,20 +95,6 @@ func (m *GenesisState) GetValsetUpdateIdToHeight() []ValsetUpdateIdToHeight { return nil } -func (m *GenesisState) GetConsumerAdditionProposals() []ConsumerAdditionProposal { - if m != nil { - return m.ConsumerAdditionProposals - } - return nil -} - -func (m *GenesisState) GetConsumerRemovalProposals() []ConsumerRemovalProposal { - if m != nil { - return m.ConsumerRemovalProposals - } - return nil -} - func (m *GenesisState) GetParams() Params { if m != nil { return m.Params @@ -159,6 +141,8 @@ type ConsumerState struct { // consumer chain PendingValsetChanges []types.ValidatorSetChangePacketData `protobuf:"bytes,6,rep,name=pending_valset_changes,json=pendingValsetChanges,proto3" json:"pending_valset_changes"` SlashDowntimeAck []string `protobuf:"bytes,7,rep,name=slash_downtime_ack,json=slashDowntimeAck,proto3" json:"slash_downtime_ack,omitempty"` + // the phase of the consumer chain + Phase ConsumerPhase `protobuf:"varint,9,opt,name=phase,proto3,enum=interchain_security.ccv.provider.v1.ConsumerPhase" json:"phase,omitempty"` } func (m *ConsumerState) Reset() { *m = ConsumerState{} } @@ -243,6 +227,13 @@ func (m *ConsumerState) GetSlashDowntimeAck() []string { return nil } +func (m *ConsumerState) GetPhase() ConsumerPhase { + if m != nil { + return m.Phase + } + return CONSUMER_PHASE_UNSPECIFIED +} + // ValsetUpdateIdToHeight defines the genesis information for the mapping // of each valset update id to a block height type ValsetUpdateIdToHeight struct { @@ -308,56 +299,54 @@ func init() { } var fileDescriptor_48411d9c7900d48e = []byte{ - // 782 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xd1, 0x6e, 0xda, 0x48, - 0x14, 0xc5, 0xc1, 0x21, 0x66, 0x12, 0x58, 0xcb, 0x8a, 0x90, 0x43, 0xb4, 0x24, 0x62, 0x15, 0x09, - 0x69, 0x77, 0x71, 0x60, 0xb5, 0xd2, 0x6a, 0x77, 0xf3, 0x10, 0x12, 0x69, 0x17, 0xfa, 0x82, 0x48, - 0x9a, 0x4a, 0x79, 0xb1, 0x86, 0xf1, 0x08, 0x46, 0x18, 0x8f, 0xe5, 0x19, 0x9c, 0xa2, 0xaa, 0x52, - 0xab, 0xfe, 0x40, 0x9f, 0xfb, 0x0d, 0xfd, 0x90, 0x3c, 0xe6, 0xb1, 0x4f, 0x51, 0x95, 0xfc, 0x41, - 0xbf, 0xa0, 0xf2, 0x78, 0xec, 0x42, 0x4a, 0x22, 0xe8, 0x1b, 0xcc, 0x99, 0x73, 0xee, 0xb9, 0xd7, - 0xf7, 0xde, 0x01, 0x0d, 0xe2, 0x71, 0x1c, 0xa0, 0x21, 0x24, 0x9e, 0xcd, 0x30, 0x9a, 0x04, 0x84, - 0x4f, 0x2d, 0x84, 0x42, 0xcb, 0x0f, 0x68, 0x48, 0x1c, 0x1c, 0x58, 0x61, 0xc3, 0x1a, 0x60, 0x0f, - 0x33, 0xc2, 0xea, 0x7e, 0x40, 0x39, 0x35, 0x7e, 0x59, 0x40, 0xa9, 0x23, 0x14, 0xd6, 0x13, 0x4a, - 0x3d, 0x6c, 0x94, 0xb7, 0x07, 0x74, 0x40, 0xc5, 0x7d, 0x2b, 0xfa, 0x15, 0x53, 0xcb, 0x87, 0x8f, - 0x45, 0x0b, 0x1b, 0x16, 0x1b, 0xc2, 0x00, 0x3b, 0x36, 0xa2, 0x1e, 0x9b, 0x8c, 0x71, 0x20, 0x19, - 0x07, 0x4f, 0x30, 0xae, 0x48, 0x80, 0xe5, 0xb5, 0xe6, 0x32, 0x69, 0xa4, 0xfe, 0x04, 0xa7, 0xfa, - 0x51, 0x03, 0x5b, 0xff, 0xc5, 0x99, 0x9d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32, 0xeb, 0x5b, 0x41, 0x7e, 0x4f, 0xdf, - 0xa1, 0xf0, 0x4f, 0xeb, 0xe5, 0xfc, 0x63, 0xc4, 0xa7, 0x3e, 0x66, 0xfd, 0x9c, 0x78, 0x87, 0xfe, - 0xf8, 0x1a, 0x00, 0x00, 0xff, 0xff, 0xa4, 0x95, 0x75, 0xdb, 0x84, 0x07, 0x00, 0x00, + // 750 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xdd, 0x6e, 0xda, 0x48, + 0x14, 0xc6, 0xc1, 0x80, 0x99, 0x04, 0xd6, 0xb2, 0x22, 0xe4, 0x4d, 0xb4, 0x04, 0xb1, 0x8a, 0x84, + 0xb4, 0xbb, 0x38, 0xb0, 0xaa, 0x54, 0xf5, 0xe7, 0x22, 0x24, 0x52, 0x83, 0x7b, 0x83, 0x48, 0x9a, + 0x4a, 0xb9, 0xb1, 0x86, 0x99, 0x11, 0x1e, 0x01, 0xb6, 0xe5, 0x19, 0x9c, 0xa2, 0xaa, 0x52, 0xfb, + 0x06, 0x7d, 0x93, 0xbe, 0x46, 0x2e, 0x73, 0xd9, 0xab, 0xa8, 0x4a, 0xfa, 0x04, 0x7d, 0x82, 0xca, + 0xe3, 0x81, 0x40, 0x4a, 0x22, 0xd2, 0x3b, 0xfb, 0x7c, 0xf3, 0x9d, 0xf3, 0x9d, 0x5f, 0xd0, 0xa0, + 0x1e, 0x27, 0x21, 0x72, 0x21, 0xf5, 0x1c, 0x46, 0xd0, 0x38, 0xa4, 0x7c, 0x62, 0x21, 0x14, 0x59, + 0x41, 0xe8, 0x47, 0x14, 0x93, 0xd0, 0x8a, 0x1a, 0x56, 0x9f, 0x78, 0x84, 0x51, 0x56, 0x0f, 0x42, + 0x9f, 0xfb, 0xc6, 0xdf, 0x4b, 0x28, 0x75, 0x84, 0xa2, 0xfa, 0x94, 0x52, 0x8f, 0x1a, 0x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8f, 0xc7, 0x68, 0x5a, 0xa0, + 0x5a, 0x62, 0x68, 0x63, 0x63, 0x17, 0x14, 0xa9, 0x47, 0x39, 0x85, 0xc3, 0xe9, 0x58, 0xab, 0x62, + 0x0f, 0x0b, 0xd2, 0x2a, 0x47, 0x11, 0x02, 0x7d, 0x56, 0x38, 0x79, 0xa3, 0xcc, 0x8c, 0x18, 0xca, + 0xbd, 0x7b, 0xcb, 0x35, 0x57, 0xa5, 0xf9, 0xe5, 0x97, 0x35, 0x9a, 0xad, 0xb5, 0xc4, 0x0c, 0x0e, + 0x4a, 0x01, 0xf1, 0x30, 0xf5, 0xfa, 0x8e, 0x5c, 0xba, 0x38, 0x85, 0x3e, 0x61, 0x66, 0x56, 0xf4, + 0xe5, 0xe9, 0x43, 0x81, 0x66, 0x03, 0x71, 0x4c, 0xf8, 0x81, 0xa0, 0x75, 0x20, 0x1a, 0x10, 0x7e, + 0x08, 0x39, 0x94, 0x01, 0x37, 0xa5, 0xf7, 0x64, 0x15, 0x93, 0x47, 0xcc, 0xf8, 0x17, 0x18, 0x6c, + 0x08, 0x99, 0xeb, 0x60, 0xff, 0xdc, 0xe3, 0x74, 0x44, 0x1c, 0x88, 0x06, 0x66, 0xae, 0x92, 0xae, + 0xe5, 0xbb, 0xba, 0x40, 0x0e, 0x25, 0xb0, 0x8f, 0x06, 0xc6, 0x11, 0xc8, 0x04, 0x2e, 0x64, 0xc4, + 0xcc, 0x57, 0x94, 0x5a, 0xf1, 0x91, 0x37, 0xa8, 0x13, 0x33, 0xbb, 0x89, 0x03, 0x5b, 0xd5, 0x34, + 0x3d, 0x5f, 0x3d, 0x03, 0xa5, 0xe5, 0x97, 0xe1, 0x11, 0x17, 0xb2, 0x04, 0xb2, 0xb2, 0x73, 0x6b, + 0x02, 0x97, 0x7f, 0xad, 0xb7, 0x17, 0xd7, 0x65, 0xe5, 0xf2, 0xba, 0xac, 0x7c, 0xbb, 0x2e, 0x2b, + 0x9f, 0x6f, 0xca, 0xa9, 0xcb, 0x9b, 0x72, 0xea, 0xeb, 0x4d, 0x39, 0x75, 0xf6, 0xb2, 0x4f, 0xb9, + 0x3b, 0xee, 0xd5, 0x91, 0x3f, 0xb2, 0x90, 0xcf, 0x46, 0x3e, 0xb3, 0x6e, 0xf3, 0xf8, 0x6f, 0x76, + 0xd4, 0xa3, 0x27, 0xd6, 0xbb, 0xc5, 0xcb, 0xce, 0x27, 0x01, 0x61, 0xbd, 0xac, 0x38, 0xea, 0xff, + 0xff, 0x0c, 0x00, 0x00, 0xff, 0xff, 0x1e, 0x1f, 0x55, 0x38, 0xd1, 0x06, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -432,34 +421,6 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { } i-- dAtA[i] = 0x42 - if len(m.ConsumerRemovalProposals) > 0 { - for iNdEx := len(m.ConsumerRemovalProposals) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ConsumerRemovalProposals[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - } - } - if len(m.ConsumerAdditionProposals) > 0 { - for iNdEx := len(m.ConsumerAdditionProposals) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ConsumerAdditionProposals[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - } if len(m.ValsetUpdateIdToHeight) > 0 { for iNdEx := len(m.ValsetUpdateIdToHeight) - 1; iNdEx >= 0; iNdEx-- { { @@ -516,6 +477,11 @@ func (m *ConsumerState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.Phase != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.Phase)) + i-- + dAtA[i] = 0x48 + } if len(m.SlashDowntimeAck) > 0 { for iNdEx := len(m.SlashDowntimeAck) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.SlashDowntimeAck[iNdEx]) @@ -643,18 +609,6 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } - if len(m.ConsumerAdditionProposals) > 0 { - for _, e := range m.ConsumerAdditionProposals { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if len(m.ConsumerRemovalProposals) > 0 { - for _, e := range m.ConsumerRemovalProposals { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } l = m.Params.Size() n += 1 + l + sovGenesis(uint64(l)) if len(m.ValidatorConsumerPubkeys) > 0 { @@ -713,6 +667,9 @@ func (m *ConsumerState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } + if m.Phase != 0 { + n += 1 + sovGenesis(uint64(m.Phase)) + } return n } @@ -853,74 +810,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConsumerAdditionProposals", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ConsumerAdditionProposals = append(m.ConsumerAdditionProposals, ConsumerAdditionProposal{}) - if err := m.ConsumerAdditionProposals[len(m.ConsumerAdditionProposals)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConsumerRemovalProposals", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ConsumerRemovalProposals = append(m.ConsumerRemovalProposals, ConsumerRemovalProposal{}) - if err := m.ConsumerRemovalProposals[len(m.ConsumerRemovalProposals)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex case 8: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) @@ -1320,6 +1209,25 @@ func (m *ConsumerState) Unmarshal(dAtA []byte) error { } m.SlashDowntimeAck = append(m.SlashDowntimeAck, 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 ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Phase |= ConsumerPhase(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/ccv/provider/types/genesis_test.go b/x/ccv/provider/types/genesis_test.go index c5472e07d5..09256a3cdd 100644 --- a/x/ccv/provider/types/genesis_test.go +++ b/x/ccv/provider/types/genesis_test.go @@ -33,8 +33,6 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultValsetUpdateID, nil, []types.ConsumerState{{ChainId: "chainid-1", ChannelId: "channelid", ClientId: "client-id", ConsumerGenesis: getInitialConsumerGenesis(t, "chainid-1")}}, - nil, - nil, types.DefaultParams(), nil, nil, @@ -53,8 +51,6 @@ func TestValidateGenesisState(t *testing.T) { {ChainId: "chainid-3", ChannelId: "channelid3", ClientId: "client-id", ConsumerGenesis: getInitialConsumerGenesis(t, "chainid-3")}, {ChainId: "chainid-4", ChannelId: "channelid4", ClientId: "client-id", ConsumerGenesis: getInitialConsumerGenesis(t, "chainid-4")}, }, - nil, - nil, types.DefaultParams(), nil, nil, @@ -68,8 +64,6 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultValsetUpdateID, nil, []types.ConsumerState{{ChainId: "chainid-1", ChannelId: "channelid", ClientId: "client-id", ConsumerGenesis: getInitialConsumerGenesis(t, "chainid-1")}}, - nil, - nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 600, 24, 180), @@ -85,8 +79,6 @@ func TestValidateGenesisState(t *testing.T) { 0, nil, nil, - nil, - nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 600, 24, 180), @@ -102,8 +94,6 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultValsetUpdateID, []types.ValsetUpdateIdToHeight{{ValsetUpdateId: 0}}, nil, - nil, - nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 600, 24, 180), @@ -119,8 +109,6 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultValsetUpdateID, nil, []types.ConsumerState{{ChainId: "chainid-1", ChannelId: "channelid", ClientId: "client-id"}}, - nil, - nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, 0, clienttypes.Height{}, nil, []string{"ibc", "upgradedIBCState"}), types.DefaultTrustingPeriodFraction, @@ -140,8 +128,6 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultValsetUpdateID, nil, []types.ConsumerState{{ChainId: "chainid-1", ChannelId: "channelid", ClientId: "client-id"}}, - nil, - nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), "0.0", // 0 trusting period fraction here @@ -161,8 +147,6 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultValsetUpdateID, nil, []types.ConsumerState{{ChainId: "chainid-1", ChannelId: "channelid", ClientId: "client-id"}}, - nil, - nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), types.DefaultTrustingPeriodFraction, @@ -182,8 +166,6 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultValsetUpdateID, nil, []types.ConsumerState{{ChainId: "chainid-1", ChannelId: "channelid", ClientId: "client-id"}}, - nil, - nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), types.DefaultTrustingPeriodFraction, @@ -203,8 +185,6 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultValsetUpdateID, nil, []types.ConsumerState{{ChainId: "chainid-1", ChannelId: "channelid", ClientId: "client-id"}}, - nil, - nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), types.DefaultTrustingPeriodFraction, @@ -224,8 +204,6 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultValsetUpdateID, nil, []types.ConsumerState{{ChainId: "", ChannelId: "channelid", ClientId: "client-id"}}, - nil, - nil, types.DefaultParams(), nil, nil, @@ -239,8 +217,6 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultValsetUpdateID, nil, []types.ConsumerState{{ChainId: "chainid", ChannelId: "ivnalidChannel{}", ClientId: "client-id"}}, - nil, - nil, types.DefaultParams(), nil, nil, @@ -254,8 +230,6 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultValsetUpdateID, nil, []types.ConsumerState{{ChainId: "chainid", ChannelId: "channel-0", ClientId: ""}}, - nil, - nil, types.DefaultParams(), nil, nil, @@ -269,8 +243,6 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultValsetUpdateID, nil, []types.ConsumerState{{ChainId: "chainid", ChannelId: "channel-0", ClientId: "abc", ConsumerGenesis: getInitialConsumerGenesis(t, "chainid")}}, - nil, - nil, types.DefaultParams(), nil, nil, @@ -287,8 +259,6 @@ func TestValidateGenesisState(t *testing.T) { ChainId: "chainid", ChannelId: "channel-0", ClientId: "client-id", ConsumerGenesis: ccv.ConsumerGenesisState{}, }}, - nil, - nil, types.DefaultParams(), nil, nil, @@ -306,8 +276,6 @@ func TestValidateGenesisState(t *testing.T) { ConsumerGenesis: getInitialConsumerGenesis(t, "chainid"), SlashDowntimeAck: []string{"cosmosvaloper1qlmk6r5w5taqrky4ycur4zq6jqxmuzr688htpp"}, }}, - nil, - nil, types.DefaultParams(), nil, nil, @@ -325,8 +293,6 @@ func TestValidateGenesisState(t *testing.T) { ConsumerGenesis: getInitialConsumerGenesis(t, "chainid"), PendingValsetChanges: []ccv.ValidatorSetChangePacketData{{}}, }}, - nil, - nil, types.DefaultParams(), nil, nil, @@ -348,8 +314,6 @@ func TestValidateGenesisState(t *testing.T) { ValidatorUpdates: []abci.ValidatorUpdate{{}}, }}, }}, - nil, - nil, types.DefaultParams(), nil, nil, @@ -363,8 +327,6 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultValsetUpdateID, nil, []types.ConsumerState{{ChainId: "chainid-1", ChannelId: "channelid", ClientId: "client-id", ConsumerGenesis: getInitialConsumerGenesis(t, "chainid-1")}}, - nil, - nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "st", Amount: math.NewInt(10000000)}, 600, 24, 180), @@ -380,8 +342,6 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultValsetUpdateID, nil, []types.ConsumerState{{ChainId: "chainid-1", ChannelId: "channelid", ClientId: "client-id", ConsumerGenesis: getInitialConsumerGenesis(t, "chainid-1")}}, - nil, - nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(-1000000)}, 600, 24, 180), diff --git a/x/ccv/provider/types/keys.go b/x/ccv/provider/types/keys.go index bd9ccbd807..ef7eae0172 100644 --- a/x/ccv/provider/types/keys.go +++ b/x/ccv/provider/types/keys.go @@ -49,17 +49,17 @@ const ( SlashMeterReplenishTimeCandidateKeyName = "SlashMeterReplenishTimeCandidateKey" - ChainToChannelKeyName = "ChainToChannelKey" + ConsumerIdToChannelIdKeyName = "ConsumerIdToChannelIdKey" - ChannelToChainKeyName = "ChannelToChainKey" + ChannelIdToConsumerIdKeyName = "ChannelToConsumerIdKey" - ChainToClientKeyName = "ChainToClientKey" + ConsumerIdToClientIdKeyName = "ConsumerIdToClientIdKey" DeprecatedInitTimeoutTimestampKeyName = "DeprecatedInitTimeoutTimestampKey" - PendingCAPKeyName = "PendingCAPKey" + DeprecatedPendingCAPKeyName = "DeprecatedPendingCAPKey" - PendingCRPKeyName = "PendingCRPKey" + DeprecatedPendingCRPKeyName = "DeprecatedPendingCRPKey" DeprecatedUnbondingOpKeyName = "DeprecatedUnbondingOpKey" @@ -77,11 +77,11 @@ const ( DeprecatedVscSendTimestampKeyName = "DeprecatedVscSendTimestampKey" - ThrottledPacketDataSizeKeyName = "ThrottledPacketDataSizeKey" + DeprecatedThrottledPacketDataSizeKeyName = "DeprecatedThrottledPacketDataSizeKey" - ThrottledPacketDataKeyName = "ThrottledPacketDataKey" + DeprecatedThrottledPacketDataKeyName = "DeprecatedThrottledPacketDataKey" - GlobalSlashEntryKeyName = "GlobalSlashEntryKey" + DeprecatedGlobalSlashEntryKeyName = "DeprecatedGlobalSlashEntryKey" ConsumerValidatorsKeyName = "ConsumerValidatorsKey" @@ -99,17 +99,17 @@ const ( EquivocationEvidenceMinHeightKeyName = "EquivocationEvidenceMinHeightKey" - ProposedConsumerChainKeyName = "ProposedConsumerChainKey" + DeprecatedProposedConsumerChainKeyName = "DeprecatedProposedConsumerChainKey" ConsumerValidatorKeyName = "ConsumerValidatorKey" OptedInKeyName = "OptedInKey" - TopNKeyName = "TopNKey" + DeprecatedTopNKeyName = "DeprecatedTopNKey" - ValidatorsPowerCapKeyName = "ValidatorsPowerCapKey" + DeprecatedValidatorsPowerCapKeyName = "DeprecatedValidatorsPowerCapKey" - ValidatorSetCapKeyName = "ValidatorSetCapKey" + DeprecatedValidatorSetCapKeyName = "DeprecatedValidatorSetCapKey" AllowlistKeyName = "AllowlistKey" @@ -123,11 +123,31 @@ const ( LastProviderConsensusValsKeyName = "LastProviderConsensusValsKey" - MinStakeKeyName = "MinStakeKey" + ConsumerAddrsToPruneV2KeyName = "ConsumerAddrsToPruneV2Key" - AllowInactiveValidatorsKeyName = "AllowInactiveValidatorsKey" + ConsumerIdKeyName = "ConsumerIdKey" - ConsumerAddrsToPruneV2KeyName = "ConsumerAddrsToPruneV2Key" + ConsumerIdToChainIdKeyName = "ConsumerIdToChainIdKey" + + ConsumerIdToOwnerAddressKeyName = "ConsumerIdToOwnerAddress" + + ConsumerIdToConsumerMetadataKeyName = "ConsumerIdToMetadataKey" + + ConsumerIdToInitializationParametersKeyName = "ConsumerIdToInitializationParametersKey" + + ConsumerIdToPowerShapingParameters = "ConsumerIdToPowerShapingParametersKey" + + ConsumerIdToPhaseKeyName = "ConsumerIdToPhaseKey" + + ConsumerIdToRemovalTimeKeyName = "ConsumerIdToRemovalTimeKey" + + SpawnTimeToConsumerIdsKeyName = "SpawnTimeToConsumerIdsKeyName" + + RemovalTimeToConsumerIdsKeyName = "RemovalTimeToConsumerIdsKeyName" + + ProviderConsAddrToOptedInConsumerIdsKeyName = "ProviderConsAddrToOptedInConsumerIdsKeyName" + + ClientIdToConsumerIdKeyName = "ClientIdToConsumerIdKey" ) // getKeyPrefixes returns a constant map of all the byte prefixes for existing keys @@ -157,16 +177,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. @@ -176,11 +196,13 @@ func getKeyPrefixes() map[string]byte { // PendingCAPKey is the key for storing pending consumer addition proposals before the spawn time occurs. // The key includes the BigEndian timestamp to allow for efficient chronological iteration - PendingCAPKeyName: 9, + // [DEPRECATED] + DeprecatedPendingCAPKeyName: 9, // PendingCRPKey is the key for storing pending consumer removal proposals before the stop time occurs. // The key includes the BigEndian timestamp to allow for efficient chronological iteration - PendingCRPKeyName: 10, + // [DEPRECATED] + DeprecatedPendingCRPKeyName: 10, // UnbondingOpKey is the key that stores a record of all the ids of consumer chains that // need to unbond before a given unbonding operation can unbond on this chain. @@ -217,13 +239,16 @@ func getKeyPrefixes() map[string]byte { DeprecatedVscSendTimestampKeyName: 18, // ThrottledPacketDataSizeKey is the key for storing the size of chain-specific throttled packet data queues - ThrottledPacketDataSizeKeyName: 19, + // [DEPRECATED] + DeprecatedThrottledPacketDataSizeKeyName: 19, // ThrottledPacketDataKey is the key for storing throttled packet data - ThrottledPacketDataKeyName: 20, + // [DEPRECATED] + DeprecatedThrottledPacketDataKeyName: 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, @@ -261,7 +286,8 @@ func getKeyPrefixes() map[string]byte { EquivocationEvidenceMinHeightKeyName: 29, // ProposedConsumerChainKey is the key for storing the consumer chainId in consumerAddition gov proposal submitted before voting finishes - ProposedConsumerChainKeyName: 30, + // [DEPRECATED] + DeprecatedProposedConsumerChainKeyName: 30, // ConsumerValidatorKey is the key for storing for each consumer chain all the consumer // validators in this epoch that are validating the consumer chain @@ -270,18 +296,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 +343,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, - // 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, + // ConsumerIdToPhaseKeyName is the key for storing the phase of a consumer chain with the given consumer id + ConsumerIdToPhaseKeyName: 49, + + // ConsumerIdToRemovalTimeKeyName is the key for storing the removal time of a consumer chain that is to be removed + ConsumerIdToRemovalTimeKeyName: 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, + + // RemovalTimeToConsumerIdsKeyName is the key for storing pending launched consumers that are to be removed. + // For a specific removal time, it might store multiple consumer chain ids for chains that are to be removed. + RemovalTimeToConsumerIdsKeyName: 52, + + // 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,67 +454,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)...) -} - -// ChannelToChainKeyPrefix returns the key prefix for storing the consumer chain IDs. -func ChannelToChainKeyPrefix() []byte { - return []byte{mustGetKeyPrefix(ChannelToChainKeyName)} -} - -// 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)...) +// 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)...) } -// ChainToClientKeyPrefix returns the key prefix for storing the clientID for the given chainID. -func ChainToClientKeyPrefix() []byte { - return []byte{mustGetKeyPrefix(ChainToClientKeyName)} +// ChannelIdToConsumerIdKeyPrefix returns the key prefix for storing the consumer chain ids. +func ChannelIdToConsumerIdKeyPrefix() []byte { + return []byte{mustGetKeyPrefix(ChannelIdToConsumerIdKeyName)} } -// ChainToClientKey returns the key under which the clientID for the given chainID is stored. -func ChainToClientKey(chainID string) []byte { - return append(ChainToClientKeyPrefix(), []byte(chainID)...) +// 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)...) } -// PendingCAPKeyPrefix returns the key prefix for storing a pending consumer addition proposal -func PendingCAPKeyPrefix() []byte { - return []byte{mustGetKeyPrefix(PendingCAPKeyName)} +// ConsumerIdToClientIdKeyPrefix returns the key prefix for storing the clientId for the given consumerId. +func ConsumerIdToClientIdKeyPrefix() []byte { + return []byte{mustGetKeyPrefix(ConsumerIdToClientIdKeyName)} } -// PendingCAPKey returns the key under which a pending consumer addition proposal is stored. -// The key has the following format: PendingCAPKeyPrefix | timestamp.UnixNano() | chainID -func PendingCAPKey(timestamp time.Time, chainID string) []byte { - ts := uint64(timestamp.UTC().UnixNano()) - return ccvtypes.AppendMany( - // Append the prefix - PendingCAPKeyPrefix(), - // Append the time - sdk.Uint64ToBigEndian(ts), - // Append the chainId - []byte(chainID), - ) -} - -// PendingCRPKeyPrefix returns the key prefix for storing pending consumer removal proposals. -func PendingCRPKeyPrefix() []byte { - return []byte{mustGetKeyPrefix(PendingCRPKeyName)} -} - -// PendingCRPKey returns the key under which pending consumer removal proposals are stored. -// The key has the following format: PendingCRPKeyPrefix | timestamp.UnixNano() | chainID -func PendingCRPKey(timestamp time.Time, chainID string) []byte { - ts := uint64(timestamp.UTC().UnixNano()) - return ccvtypes.AppendMany( - // Append the prefix - PendingCRPKeyPrefix(), - // Append the time - sdk.Uint64ToBigEndian(ts), - // Append the chainId - []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)...) } // ValsetUpdateBlockHeightKeyPrefix returns the key prefix that storing the mapping from valset update ID to block height @@ -468,98 +492,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)...) -} - -// ThrottledPacketDataSizeKey returns the key storing the size of the throttled packet data queue for a given chain ID -func ThrottledPacketDataSizeKey(consumerChainID string) []byte { - return append([]byte{mustGetKeyPrefix(ThrottledPacketDataSizeKeyName)}, []byte(consumerChainID)...) -} - -// ThrottledPacketDataKeyPrefix returns the key prefix for storing the throttled packet data queue -func ThrottledPacketDataKeyPrefix() byte { - return mustGetKeyPrefix(ThrottledPacketDataKeyName) -} - -// ThrottledPacketDataKey returns the key for storing the throttled packet data queue for a given chain ID and ibc seq num -func ThrottledPacketDataKey(consumerChainID string, ibcSeqNum uint64) []byte { - return ChainIdAndUintIdKey(ThrottledPacketDataKeyPrefix(), consumerChainID, ibcSeqNum) -} - -// MustParseThrottledPacketDataKey parses a throttled packet data key or panics upon failure -func MustParseThrottledPacketDataKey(key []byte) (string, uint64) { - chainId, ibcSeqNum, err := ParseThrottledPacketDataKey(key) - if err != nil { - panic(fmt.Sprintf("failed to parse throttled packet data key: %s", err.Error())) - } - return chainId, ibcSeqNum -} - -// ParseThrottledPacketDataKey parses a throttled packet data key -func ParseThrottledPacketDataKey(key []byte) (chainId string, ibcSeqNum uint64, err error) { - 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 +// pending ValidatorSetChangePacket data is stored for a given consumer id +func PendingVSCsKey(consumerId string) []byte { + return append([]byte{mustGetKeyPrefix(PendingVSCsKeyName)}, []byte(consumerId)...) } // ConsumerValidatorsKey returns the key for storing the validator assigned keys for every consumer chain @@ -569,8 +520,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 StringIdAndConsAddrKey(ConsumerValidatorsKeyPrefix(), consumerId, addr.ToSdkConsAddr()) } // ValidatorsByConsumerAddrKeyPrefix returns the key prefix for storing the mapping from validator addresses @@ -581,8 +532,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 StringIdAndConsAddrKey(ValidatorsByConsumerAddrKeyPrefix(), consumerId, addr.ToSdkConsAddr()) } // SlashLogKey returns the key to a validator's slash log @@ -601,35 +552,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)...) -} - -// ProposedConsumerChainKeyPrefix returns the key prefix for storing proposed consumer chainId -// in consumerAddition gov proposal before voting finishes -func ProposedConsumerChainKeyPrefix() []byte { - return []byte{mustGetKeyPrefix(ProposedConsumerChainKeyName)} -} - -// ProposedConsumerChainKey returns the key of proposed consumer chainId in consumerAddition gov proposal before voting finishes, the stored key format is prefix|proposalID, value is chainID -func ProposedConsumerChainKey(proposalID uint64) []byte { - return ccvtypes.AppendMany( - ProposedConsumerChainKeyPrefix(), - sdk.Uint64ToBigEndian(proposalID), - ) -} - -// ParseProposedConsumerChainKey get the proposalID in the key -func ParseProposedConsumerChainKey(bz []byte) (uint64, error) { - expectedPrefix := ProposedConsumerChainKeyPrefix() - prefixL := len(expectedPrefix) - if prefix := bz[:prefixL]; !bytes.Equal(prefix, expectedPrefix) { - return 0, fmt.Errorf("invalid prefix; expected: %X, got: %X", expectedPrefix, prefix) - } - proposalID := sdk.BigEndianToUint64(bz[prefixL:]) - - return proposalID, nil +// of a valid consumer equivocation evidence for a given consumer id +func EquivocationEvidenceMinHeightKey(consumerId string) []byte { + return append([]byte{mustGetKeyPrefix(EquivocationEvidenceMinHeightKeyName)}, []byte(consumerId)...) } // ConsumerValidatorKeyPrefix returns the key prefix for storing consumer validators @@ -638,26 +563,9 @@ 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) - 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) +// for the given consumer chain `consumerId` and validator with `providerAddr` +func ConsumerValidatorKey(consumerId string, providerAddr []byte) []byte { + return StringIdAndConsAddrKey(ConsumerValidatorKeyPrefix(), consumerId, sdk.ConsAddress(providerAddr)) } // AllowlistKeyPrefix returns the key prefix for storing consumer chains allowlists @@ -666,11 +574,8 @@ func AllowlistKeyPrefix() byte { } // AllowlistKey returns the key for storing consumer chains allowlists -func AllowlistKey(chainID string, providerAddr ProviderConsAddress) []byte { - return append( - ChainIdWithLenKey(AllowlistKeyPrefix(), chainID), - providerAddr.ToSdkConsAddr().Bytes()..., - ) +func AllowlistKey(consumerId string, providerAddr ProviderConsAddress) []byte { + return StringIdAndConsAddrKey(AllowlistKeyPrefix(), consumerId, providerAddr.ToSdkConsAddr()) } // DenylistKeyPrefix returns the key prefix for storing consumer chains denylists @@ -679,11 +584,8 @@ func DenylistKeyPrefix() byte { } // DenylistKey returns the key for storing consumer chains denylists -func DenylistKey(chainID string, providerAddr ProviderConsAddress) []byte { - return append( - ChainIdWithLenKey(DenylistKeyPrefix(), chainID), - providerAddr.ToSdkConsAddr().Bytes()..., - ) +func DenylistKey(consumerId string, providerAddr ProviderConsAddress) []byte { + return StringIdAndConsAddrKey(DenylistKeyPrefix(), consumerId, providerAddr.ToSdkConsAddr()) } // OptedInKeyPrefix returns the key prefix for storing whether a validator is opted in on a consumer chain. @@ -692,14 +594,13 @@ 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) - return append(prefix, providerAddr.ToSdkConsAddr().Bytes()...) +func OptedInKey(consumerId string, providerAddr ProviderConsAddress) []byte { + return StringIdAndConsAddrKey(OptedInKeyPrefix(), consumerId, providerAddr.ToSdkConsAddr()) } // 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 +609,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 StringIdAndConsAddrKey( ConsumerCommissionRateKeyPrefix(), - chainID, + consumerId, providerAddr.ToSdkConsAddr(), ) } -func MinimumPowerInTopNKey(chainID string) []byte { - return ChainIdWithLenKey(mustGetKeyPrefix(MinimumPowerInTopNKeyName), chainID) +func MinimumPowerInTopNKey(consumerId string) []byte { + return StringIdWithLenKey(mustGetKeyPrefix(MinimumPowerInTopNKeyName), consumerId) } // ConsumerAddrsToPruneV2KeyPrefix returns the key prefix for storing the consumer validators @@ -730,8 +631,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 StringIdAndTsKey(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 +640,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 StringIdWithLenKey(mustGetKeyPrefix(ConsumerIdToChainIdKeyName), consumerId) +} + +// ConsumerIdToOwnerAddressKey returns the owner address of this consumer id +func ConsumerIdToOwnerAddressKey(consumerId string) []byte { + return StringIdWithLenKey(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 StringIdWithLenKey(ConsumerIdToMetadataKeyPrefix(), consumerId) +} + +// ConsumerIdToInitializationParametersKeyPrefix returns the key prefix for storing consumer initialization parameters +func ConsumerIdToInitializationParametersKeyPrefix() byte { + return mustGetKeyPrefix(ConsumerIdToInitializationParametersKeyName) +} + +// ConsumerIdToInitializationParametersKey returns the key used to store the initialization parameters that corresponds to this consumer id +func ConsumerIdToInitializationParametersKey(consumerId string) []byte { + return StringIdWithLenKey(ConsumerIdToInitializationParametersKeyPrefix(), consumerId) +} + +// ConsumerIdToPowerShapingParametersKey returns the key used to store the power-shaping parameters that corresponds to this consumer id +func ConsumerIdToPowerShapingParametersKey(consumerId string) []byte { + return StringIdWithLenKey(mustGetKeyPrefix(ConsumerIdToPowerShapingParameters), consumerId) +} + +// ConsumerIdToPhaseKey returns the key used to store the phase that corresponds to this consumer id +func ConsumerIdToPhaseKey(consumerId string) []byte { + return StringIdWithLenKey(mustGetKeyPrefix(ConsumerIdToPhaseKeyName), consumerId) +} + +// ConsumerIdToRemovalTimeKeyPrefix returns the key prefix for storing the removal times of consumer chains +// that are about to be removed +func ConsumerIdToRemovalTimeKeyPrefix() byte { + return mustGetKeyPrefix(ConsumerIdToRemovalTimeKeyName) +} + +// ConsumerIdToRemovalTimeKey returns the key used to store the removal time that corresponds to a to-be-removed chain with consumer id +func ConsumerIdToRemovalTimeKey(consumerId string) []byte { + return StringIdWithLenKey(ConsumerIdToRemovalTimeKeyPrefix(), consumerId) +} + +// 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), + ) +} + +// RemovalTimeToConsumerIdsKeyPrefix returns the key prefix for storing pending chains that are to be removed +func RemovalTimeToConsumerIdsKeyPrefix() byte { + return mustGetKeyPrefix(RemovalTimeToConsumerIdsKeyName) +} + +// RemovalTimeToConsumerIdsKey returns the key prefix for storing the removal times of consumer chains +// that are about to be removed +func RemovalTimeToConsumerIdsKey(spawnTime time.Time) []byte { + return ccvtypes.AppendMany( + // append the prefix + []byte{RemovalTimeToConsumerIdsKeyPrefix()}, + // 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()...) } -func AllowInactiveValidatorsKey(chainID string) []byte { - return ChainIdWithLenKey(mustGetKeyPrefix(AllowInactiveValidatorsKeyName), chainID) +// 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,97 +771,98 @@ 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) - timeBz := sdk.FormatTimeBytes(timestamp) +// StringIdAndTsKey returns the key with the following format: +// bytePrefix | len(stringId) | stringId | timestamp +func StringIdAndTsKey(prefix byte, stringId string, timestamp time.Time) []byte { return ccvtypes.AppendMany( - // Append the partialKey - partialKey, - // Append the time bytes - timeBz, + StringIdWithLenKey(prefix, stringId), + sdk.FormatTimeBytes(timestamp), ) } -// ChainIdWithLenKey returns the key with the following format: -// bytePrefix | len(chainID) | chainID -func ChainIdWithLenKey(prefix byte, chainID string) []byte { - chainIdL := len(chainID) +// ParseStringIdAndTsKey returns the string id and time for a StringIdAndTs key +func ParseStringIdAndTsKey(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) + } + stringIdL := sdk.BigEndianToUint64(bz[prefixL : prefixL+8]) + stringId := string(bz[prefixL+8 : prefixL+8+int(stringIdL)]) + timestamp, err := sdk.ParseTimeBytes(bz[prefixL+8+int(stringIdL):]) + if err != nil { + return "", time.Time{}, err + } + return stringId, timestamp, nil +} + +// StringIdWithLenKey returns the key with the following format: +// bytePrefix | len(stringId) | stringId +func StringIdWithLenKey(prefix byte, stringId 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 string id length + sdk.Uint64ToBigEndian(uint64(len(stringId))), + // Append the string id + []byte(stringId), ) } -// ParseChainIdAndTsKey returns the chain ID and time for a ChainIdAndTs key -func ParseChainIdAndTsKey(prefix byte, bz []byte) (string, time.Time, error) { +// ParseStringIdWithLenKey returns the stringId of a StringIdWithLen key +func ParseStringIdWithLenKey(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 + stringIdL := sdk.BigEndianToUint64(bz[prefixL : prefixL+8]) + stringId := string(bz[prefixL+8 : prefixL+8+int(stringIdL)]) + return stringId, 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) +// StringIdAndUintIdKey returns the key with the following format: +// bytePrefix | len(stringId) | stringId | uint64(ID) +func StringIdAndUintIdKey(prefix byte, stringId string, uintId uint64) []byte { return ccvtypes.AppendMany( - // Append the partialKey - partialKey, - // Append the uint id bytes + StringIdWithLenKey(prefix, stringId), sdk.Uint64ToBigEndian(uintId), ) } -// ParseChainIdAndUintIdKey returns the chain ID and uint ID for a ChainIdAndUintId key -func ParseChainIdAndUintIdKey(prefix byte, bz []byte) (string, uint64, error) { +// ParseStringIdAndUintIdKey returns the string ID and uint ID for a StringIdAndUintId key +func ParseStringIdAndUintIdKey(prefix byte, bz []byte) (string, uint64, error) { expectedPrefix := []byte{prefix} prefixL := len(expectedPrefix) if prefix := bz[:prefixL]; !bytes.Equal(prefix, expectedPrefix) { return "", 0, 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)]) - uintID := sdk.BigEndianToUint64(bz[prefixL+8+int(chainIdL):]) - return chainID, uintID, nil + stringIdL := sdk.BigEndianToUint64(bz[prefixL : prefixL+8]) + stringId := string(bz[prefixL+8 : prefixL+8+int(stringIdL)]) + uintID := sdk.BigEndianToUint64(bz[prefixL+8+int(stringIdL):]) + return stringId, 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) +// StringIdAndConsAddrKey returns the key with the following format: +// bytePrefix | len(stringId) | stringId | ConsAddress +func StringIdAndConsAddrKey(prefix byte, stringId string, addr sdk.ConsAddress) []byte { return ccvtypes.AppendMany( - // Append the partialKey - partialKey, - // Append the addr bytes + StringIdWithLenKey(prefix, stringId), addr, ) } -// ParseChainIdAndConsAddrKey returns the chain ID and ConsAddress for a ChainIdAndConsAddrKey key -func ParseChainIdAndConsAddrKey(prefix byte, bz []byte) (string, sdk.ConsAddress, error) { +// ParseStringIdAndConsAddrKey returns the string ID and ConsAddress for a StringIdAndConsAddr key +func ParseStringIdAndConsAddrKey(prefix byte, bz []byte) (string, sdk.ConsAddress, error) { expectedPrefix := []byte{prefix} prefixL := len(expectedPrefix) if prefix := bz[:prefixL]; !bytes.Equal(prefix, expectedPrefix) { return "", nil, 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)]) - addr := bz[prefixL+8+int(chainIdL):] - return chainID, addr, nil + stringIdL := sdk.BigEndianToUint64(bz[prefixL : prefixL+8]) + stringId := string(bz[prefixL+8 : prefixL+8+int(stringIdL)]) + addr := bz[prefixL+8+int(stringIdL):] + return stringId, addr, nil } // diff --git a/x/ccv/provider/types/keys_test.go b/x/ccv/provider/types/keys_test.go index 800b6ee669..92ec762845 100644 --- a/x/ccv/provider/types/keys_test.go +++ b/x/ccv/provider/types/keys_test.go @@ -11,7 +11,6 @@ import ( cryptoutil "github.com/cosmos/interchain-security/v5/testutil/crypto" providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" ) @@ -41,17 +40,17 @@ 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("13")[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++ - require.Equal(t, byte(9), providertypes.PendingCAPKeyPrefix()[0]) + // reserve 9 as deprecated i++ - require.Equal(t, byte(10), providertypes.PendingCRPKeyPrefix()[0]) + // reserve 10 as deprecated i++ // reserve 11 as deprecated i++ @@ -59,21 +58,22 @@ func TestPreserveBytePrefix(t *testing.T) { i++ require.Equal(t, byte(13), providertypes.ValsetUpdateBlockHeightKeyPrefix()[0]) i++ - require.Equal(t, byte(14), providertypes.ConsumerGenesisKey("chainID")[0]) + require.Equal(t, byte(14), providertypes.ConsumerGenesisKey("13")[0]) i++ - require.Equal(t, byte(15), providertypes.SlashAcksKey("chainID")[0]) + require.Equal(t, byte(15), providertypes.SlashAcksKey("13")[0]) i++ - require.Equal(t, byte(16), providertypes.InitChainHeightKey("chainID")[0]) + require.Equal(t, byte(16), providertypes.InitChainHeightKey("13")[0]) i++ - require.Equal(t, byte(17), providertypes.PendingVSCsKey("chainID")[0]) + require.Equal(t, byte(17), providertypes.PendingVSCsKey("13")[0]) i++ // reserve 18 as deprecated i++ - require.Equal(t, byte(19), providertypes.ThrottledPacketDataSizeKey("chainID")[0]) + // reserve 19 as deprecated i++ - require.Equal(t, byte(20), providertypes.ThrottledPacketDataKeyPrefix()) + // reserve 20 as deprecated 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++ @@ -89,37 +89,60 @@ func TestPreserveBytePrefix(t *testing.T) { i++ // reserve 28 as deprecated i++ - require.Equal(t, byte(29), providertypes.EquivocationEvidenceMinHeightKey("chainID")[0]) + require.Equal(t, byte(29), providertypes.EquivocationEvidenceMinHeightKey("13")[0]) i++ - require.Equal(t, byte(30), providertypes.ProposedConsumerChainKeyPrefix()[0]) + // reserve 30 as deprecated i++ require.Equal(t, byte(31), providertypes.ConsumerValidatorKeyPrefix()) 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("13")[0]) i++ - require.Equal(t, byte(34), providertypes.ValidatorsPowerCapKey("chainID")[0]) + // DEPRECATED + //require.Equal(t, byte(34), providertypes.ValidatorsPowerCapKey("13")[0]) i++ - require.Equal(t, byte(35), providertypes.ValidatorSetCapKey("chainID")[0]) + // DEPRECATED + //require.Equal(t, byte(35), providertypes.ValidatorSetCapKey("13")[0]) i++ require.Equal(t, byte(36), providertypes.AllowlistKeyPrefix()) i++ require.Equal(t, byte(37), providertypes.DenylistKeyPrefix()) i++ - require.Equal(t, byte(38), providertypes.ConsumerRewardsAllocationKey("chainID")[0]) + require.Equal(t, byte(38), providertypes.ConsumerRewardsAllocationKey("13")[0]) i++ require.Equal(t, byte(39), providertypes.ConsumerCommissionRateKeyPrefix()) i++ - require.Equal(t, byte(40), providertypes.MinimumPowerInTopNKey("chainID")[0]) + require.Equal(t, byte(40), providertypes.MinimumPowerInTopNKey("13")[0]) i++ require.Equal(t, byte(41), providertypes.ConsumerAddrsToPruneV2KeyPrefix()) 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("13")[0]) + i++ + require.Equal(t, byte(45), providertypes.ConsumerIdToOwnerAddressKey("13")[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("13")[0]) + i++ + require.Equal(t, byte(49), providertypes.ConsumerIdToPhaseKey("13")[0]) + i++ + require.Equal(t, byte(50), providertypes.ConsumerIdToRemovalTimeKeyPrefix()) + i++ + require.Equal(t, byte(51), providertypes.SpawnTimeToConsumerIdsKeyPrefix()) + i++ + require.Equal(t, byte(52), providertypes.RemovalTimeToConsumerIdsKeyPrefix()) + 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,149 +179,96 @@ func getAllFullyDefinedKeys() [][]byte { providertypes.ValidatorSetUpdateIdKey(), providertypes.SlashMeterKey(), providertypes.SlashMeterReplenishTimeCandidateKey(), - providertypes.ChainToChannelKey("chainID"), - providertypes.ChannelToChainKey("channelID"), - providertypes.ChainToClientKey("chainID"), - providertypes.PendingCAPKey(time.Time{}, "chainID"), - providertypes.PendingCRPKey(time.Time{}, "chainID"), + providertypes.ConsumerIdToChannelIdKey("13"), + providertypes.ChannelToConsumerIdKey("channelID"), + providertypes.ConsumerIdToClientIdKey("13"), providertypes.ValsetUpdateBlockHeightKey(7), - providertypes.ConsumerGenesisKey("chainID"), - providertypes.SlashAcksKey("chainID"), - providertypes.InitChainHeightKey("chainID"), - 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.ConsumerGenesisKey("13"), + providertypes.SlashAcksKey("13"), + providertypes.InitChainHeightKey("13"), + providertypes.PendingVSCsKey("13"), + providertypes.ConsumerValidatorsKey("13", providertypes.NewProviderConsAddress([]byte{0x05})), + providertypes.ValidatorsByConsumerAddrKey("13", providertypes.NewConsumerConsAddress([]byte{0x05})), providertypes.SlashLogKey(providertypes.NewProviderConsAddress([]byte{0x05})), providertypes.ConsumerRewardDenomsKey("uatom"), - 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})), - providertypes.ConsumerRewardsAllocationKey("chainID"), - 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.EquivocationEvidenceMinHeightKey("13"), + providertypes.ConsumerValidatorKey("13", providertypes.NewProviderConsAddress([]byte{0x05}).Address.Bytes()), + providertypes.AllowlistKey("13", providertypes.NewProviderConsAddress([]byte{0x05})), + providertypes.DenylistKey("13", providertypes.NewProviderConsAddress([]byte{0x05})), + providertypes.OptedInKey("13", providertypes.NewProviderConsAddress([]byte{0x05})), + providertypes.ConsumerRewardsAllocationKey("13"), + providertypes.ConsumerCommissionRateKey("13", providertypes.NewProviderConsAddress([]byte{0x05})), + providertypes.MinimumPowerInTopNKey("13"), + providertypes.ConsumerAddrsToPruneV2Key("13", time.Time{}), + providerkeeper.GetValidatorKey(providertypes.LastProviderConsensusValsPrefix(), providertypes.NewProviderConsAddress([]byte{0x05})), + providertypes.ConsumerIdKey(), + providertypes.ConsumerIdToChainIdKey("13"), + providertypes.ConsumerIdToOwnerAddressKey("13"), + providertypes.ConsumerIdToMetadataKey("13"), + providertypes.ConsumerIdToInitializationParametersKey("13"), + providertypes.ConsumerIdToPowerShapingParametersKey("13"), + providertypes.ConsumerIdToPhaseKey("13"), + providertypes.ConsumerIdToRemovalTimeKey("13"), + providertypes.SpawnTimeToConsumerIdsKey(time.Time{}), + providertypes.RemovalTimeToConsumerIdsKey(time.Time{}), + providertypes.ProviderConsAddrToOptedInConsumerIdsKey(providertypes.NewProviderConsAddress([]byte{0x05})), + providertypes.ClientIdToConsumerIdKey("clientId"), } } -// Tests the construction and parsing of ChainIdAndTs keys -func TestChainIdAndTsKeyAndParse(t *testing.T) { +// Tests the construction and parsing of StringIdAndTs keys +func TestStringIdAndTsKeyAndParse(t *testing.T) { tests := []struct { - prefix byte - chainID string - timestamp time.Time + prefix byte + consumerID string + timestamp time.Time }{ - {prefix: 0x01, chainID: "1", timestamp: time.Now()}, - {prefix: 0x02, chainID: "some other ID", timestamp: time.Date( + {prefix: 0x01, consumerID: "1", timestamp: time.Now()}, + {prefix: 0x02, consumerID: "111", timestamp: time.Date( 2003, 11, 17, 20, 34, 58, 651387237, time.UTC)}, - {prefix: 0x03, chainID: "some other other chain ID", timestamp: time.Now().Add(5000 * time.Hour)}, + {prefix: 0x03, consumerID: "2000", timestamp: time.Now().Add(5000 * time.Hour)}, } for _, test := range tests { - key := providertypes.ChainIdAndTsKey(test.prefix, test.chainID, test.timestamp) + key := providertypes.StringIdAndTsKey(test.prefix, test.consumerID, 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{})) + // Expected bytes = prefix + consumerID length + consumerID + time bytes + expectedLen := 1 + 8 + len(test.consumerID) + len(sdk.FormatTimeBytes(time.Time{})) require.Equal(t, expectedLen, len(key)) - parsedID, parsedTime, err := providertypes.ParseChainIdAndTsKey(test.prefix, key) - require.Equal(t, test.chainID, parsedID) + parsedID, parsedTime, err := providertypes.ParseStringIdAndTsKey(test.prefix, key) + require.Equal(t, test.consumerID, parsedID) require.Equal(t, test.timestamp.UTC(), parsedTime.UTC()) require.NoError(t, err) } } -// Tests the construction and parsing of ChainIdAndUintId keys -func TestChainIdAndUintIdAndParse(t *testing.T) { +// Tests the construction and parsing of StringIdAndUintId keys +func TestStringIdAndUintIdAndParse(t *testing.T) { tests := []struct { - prefix byte - chainID string - uintID uint64 + prefix byte + consumerID string + uintID uint64 }{ - {prefix: 0x01, chainID: "1", uintID: 1}, - {prefix: 0x02, chainID: "some other ID", uintID: 2}, - {prefix: 0x03, chainID: "some other other chain ID", uintID: 3}, + {prefix: 0x01, consumerID: "1", uintID: 1}, + {prefix: 0x02, consumerID: "13", uintID: 2}, + {prefix: 0x03, consumerID: "245", uintID: 3}, } for _, test := range tests { - key := providertypes.ChainIdAndUintIdKey(test.prefix, test.chainID, test.uintID) + key := providertypes.StringIdAndUintIdKey(test.prefix, test.consumerID, test.uintID) require.NotEmpty(t, key) - // Expected bytes = prefix + chainID length + chainID + vscId bytes - expectedLen := 1 + 8 + len(test.chainID) + 8 + // Expected bytes = prefix + consumerID length + consumerID + vscId bytes + expectedLen := 1 + 8 + len(test.consumerID) + 8 require.Equal(t, expectedLen, len(key)) - parsedChainID, parsedUintID, err := providertypes.ParseChainIdAndUintIdKey(test.prefix, key) - require.Equal(t, test.chainID, parsedChainID) + parsedChainID, parsedUintID, err := providertypes.ParseStringIdAndUintIdKey(test.prefix, key) + require.Equal(t, test.consumerID, parsedChainID) require.Equal(t, test.uintID, parsedUintID) require.NoError(t, err) } } -// Tests the construction and parsing of keys for throttled packet data -func TestThrottledPacketDataKeyAndParse(t *testing.T) { - tests := []struct { - consumerChainID string - ibcSeqNum uint64 - }{ - {consumerChainID: "some chain id", ibcSeqNum: 45}, - {consumerChainID: "some chain id that is longer", ibcSeqNum: 54038}, - {consumerChainID: "some chain id that is longer-er ", ibcSeqNum: 9999999999999999999}, - } - - for _, test := range tests { - key := providertypes.ThrottledPacketDataKey(test.consumerChainID, test.ibcSeqNum) - require.NotEmpty(t, key) - // This key should be of len: prefix + chainID length + chainID + ibcSeqNum - require.Equal(t, 1+8+len(test.consumerChainID)+8, len(key)) - parsedChainID, parsedSeqNum := providertypes.MustParseThrottledPacketDataKey(key) - require.Equal(t, test.consumerChainID, parsedChainID) - require.Equal(t, test.ibcSeqNum, parsedSeqNum) - } - - // Sanity check that two keys with different chain ids but same seq num are different - key1 := providertypes.ThrottledPacketDataKey("chain-7", 45) - key2 := providertypes.ThrottledPacketDataKey("chain-8", 45) - 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) { +// Tests the construction and parsing of StringIdAndConsAddr keys +func TestStringIdAndConsAddrAndParse(t *testing.T) { cIds := []*cryptoutil.CryptoIdentity{ cryptoutil.NewCryptoIdentityFromIntSeed(99998), cryptoutil.NewCryptoIdentityFromIntSeed(99999), @@ -309,23 +279,23 @@ func TestChainIdAndConsAddrAndParse(t *testing.T) { pubKey3 := cIds[2].TMCryptoPubKey() tests := []struct { - prefix byte - chainID string - addr sdk.ConsAddress + prefix byte + consumerId string + addr sdk.ConsAddress }{ - {prefix: 0x01, chainID: "1", addr: sdk.ConsAddress(pubKey1.Address())}, - {prefix: 0x02, chainID: "some other ID", addr: sdk.ConsAddress(pubKey2.Address())}, - {prefix: 0x03, chainID: "some other other chain ID", addr: sdk.ConsAddress(pubKey3.Address())}, + {prefix: 0x01, consumerId: "1", addr: sdk.ConsAddress(pubKey1.Address())}, + {prefix: 0x02, consumerId: "23", addr: sdk.ConsAddress(pubKey2.Address())}, + {prefix: 0x03, consumerId: "456", addr: sdk.ConsAddress(pubKey3.Address())}, } for _, test := range tests { - key := providertypes.ChainIdAndConsAddrKey(test.prefix, test.chainID, test.addr) + key := providertypes.StringIdAndConsAddrKey(test.prefix, test.consumerId, test.addr) require.NotEmpty(t, key) - // Expected bytes = prefix + chainID length + chainID + consAddr bytes - expectedLen := 1 + 8 + len(test.chainID) + len(test.addr) + // Expected bytes = prefix + consumerID length + consumerID + consAddr bytes + expectedLen := 1 + 8 + len(test.consumerId) + len(test.addr) require.Equal(t, expectedLen, len(key)) - parsedID, parsedConsAddr, err := providertypes.ParseChainIdAndConsAddrKey(test.prefix, key) - require.Equal(t, test.chainID, parsedID) + parsedID, parsedConsAddr, err := providertypes.ParseStringIdAndConsAddrKey(test.prefix, key) + require.Equal(t, test.consumerId, parsedID) require.Equal(t, test.addr, parsedConsAddr) require.NoError(t, err) } @@ -334,9 +304,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, @@ -380,21 +350,3 @@ func TestKeysWithUint64Payload(t *testing.T) { } } } - -func TestParseProposedConsumerChainKey(t *testing.T) { - tests := []struct { - chainID string - proposalID uint64 - }{ - {chainID: "1", proposalID: 1}, - {chainID: "some other ID", proposalID: 12}, - {chainID: "some other other chain ID", proposalID: 123}, - } - - for _, test := range tests { - key := providertypes.ProposedConsumerChainKey(test.proposalID) - pID, err := providertypes.ParseProposedConsumerChainKey(key) - require.NoError(t, err) - require.Equal(t, pID, test.proposalID) - } -} diff --git a/x/ccv/provider/types/legacy_proposal.go b/x/ccv/provider/types/legacy_proposal.go index 3124cc3d87..9cc6ef2a77 100644 --- a/x/ccv/provider/types/legacy_proposal.go +++ b/x/ccv/provider/types/legacy_proposal.go @@ -1,21 +1,13 @@ package types import ( - "errors" "fmt" - "strings" time "time" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - errorsmod "cosmossdk.io/errors" - "cosmossdk.io/math" - evidencetypes "cosmossdk.io/x/evidence/types" - sdk "github.com/cosmos/cosmos-sdk/types" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" ) const ( @@ -100,79 +92,9 @@ func (cccp *ConsumerAdditionProposal) ProposalType() string { return ProposalTypeConsumerAddition } -// ValidatePSSFeatures returns an error if the `topN` and `validatorsPowerCap` parameters are no in the correct ranges -func ValidatePSSFeatures(topN, validatorsPowerCap uint32) error { - // 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 topN != 0 && (topN < 50 || topN > 100) { - return fmt.Errorf("Top N can either be 0 or in the range [50, 100]") - } - - if validatorsPowerCap != 0 && validatorsPowerCap > 100 { - return fmt.Errorf("validators' power cap has to be in the range [1, 100]") - } - - return nil -} - // ValidateBasic runs basic stateless validity checks func (cccp *ConsumerAdditionProposal) ValidateBasic() error { - if err := govv1beta1.ValidateAbstract(cccp); err != nil { - return err - } - - if strings.TrimSpace(cccp.ChainId) == "" { - return errorsmod.Wrap(ErrInvalidConsumerAdditionProposal, "consumer chain id must not be blank") - } - - if cccp.InitialHeight.IsZero() { - return errorsmod.Wrap(ErrInvalidConsumerAdditionProposal, "initial height cannot be zero") - } - - if len(cccp.GenesisHash) == 0 { - return errorsmod.Wrap(ErrInvalidConsumerAdditionProposal, "genesis hash cannot be empty") - } - if len(cccp.BinaryHash) == 0 { - return errorsmod.Wrap(ErrInvalidConsumerAdditionProposal, "binary hash cannot be empty") - } - - if cccp.SpawnTime.IsZero() { - return errorsmod.Wrap(ErrInvalidConsumerAdditionProposal, "spawn time cannot be zero") - } - - if err := ccvtypes.ValidateStringFraction(cccp.ConsumerRedistributionFraction); err != nil { - return errorsmod.Wrapf(ErrInvalidConsumerAdditionProposal, "consumer redistribution fraction is invalid: %s", err) - } - - if err := ccvtypes.ValidatePositiveInt64(cccp.BlocksPerDistributionTransmission); err != nil { - return errorsmod.Wrap(ErrInvalidConsumerAdditionProposal, "blocks per distribution transmission cannot be < 1") - } - - if err := ccvtypes.ValidateDistributionTransmissionChannel(cccp.DistributionTransmissionChannel); err != nil { - return errorsmod.Wrap(ErrInvalidConsumerAdditionProposal, "distribution transmission channel") - } - - if err := ccvtypes.ValidatePositiveInt64(cccp.HistoricalEntries); err != nil { - return errorsmod.Wrap(ErrInvalidConsumerAdditionProposal, "historical entries cannot be < 1") - } - - if err := ccvtypes.ValidateDuration(cccp.CcvTimeoutPeriod); err != nil { - return errorsmod.Wrap(ErrInvalidConsumerAdditionProposal, "ccv timeout period cannot be zero") - } - - if err := ccvtypes.ValidateDuration(cccp.TransferTimeoutPeriod); err != nil { - return errorsmod.Wrap(ErrInvalidConsumerAdditionProposal, "transfer timeout period cannot be zero") - } - - if err := ccvtypes.ValidateDuration(cccp.UnbondingPeriod); err != nil { - return errorsmod.Wrap(ErrInvalidConsumerAdditionProposal, "unbonding period cannot be zero") - } - - err := ValidatePSSFeatures(cccp.Top_N, cccp.ValidatorsPowerCap) - if err != nil { - return errorsmod.Wrapf(ErrInvalidConsumerAdditionProposal, "invalid PSS features: %s", err.Error()) - } - return nil + return fmt.Errorf("ConsumerAdditionProposal is deprecated") } // String returns the string representation of the ConsumerAdditionProposal. @@ -226,18 +148,7 @@ func (sccp *ConsumerRemovalProposal) ProposalType() string { return ProposalType // ValidateBasic runs basic stateless validity checks func (sccp *ConsumerRemovalProposal) ValidateBasic() error { - if err := govv1beta1.ValidateAbstract(sccp); err != nil { - return err - } - - if strings.TrimSpace(sccp.ChainId) == "" { - return errorsmod.Wrap(ErrInvalidConsumerRemovalProp, "consumer chain id must not be blank") - } - - if sccp.StopTime.IsZero() { - return errorsmod.Wrap(ErrInvalidConsumerRemovalProp, "spawn time cannot be zero") - } - return nil + return fmt.Errorf("ConsumerRemovalProposal is deprecated") } // NewConsumerModificationProposal creates a new consumer modification proposal. @@ -274,19 +185,7 @@ func (cccp *ConsumerModificationProposal) ProposalType() string { // 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 + return fmt.Errorf("ConsumerModificationProposal is deprecated") } // NewEquivocationProposal creates a new equivocation proposal. @@ -310,18 +209,7 @@ func (sp *EquivocationProposal) ProposalType() string { // ValidateBasic runs basic stateless validity checks func (sp *EquivocationProposal) ValidateBasic() error { - if err := govv1beta1.ValidateAbstract(sp); err != nil { - return err - } - if len(sp.Equivocations) == 0 { - return errors.New("invalid equivocation proposal: empty equivocations") - } - for i := 0; i < len(sp.Equivocations); i++ { - if err := sp.Equivocations[i].ValidateBasic(); err != nil { - return err - } - } - return nil + return fmt.Errorf("EquivocationProposal is deprecated") } func NewChangeRewardDenomsProposal(title, description string, @@ -345,35 +233,5 @@ func (crdp *ChangeRewardDenomsProposal) ProposalType() string { // ValidateBasic runs basic stateless validity checks on a ChangeRewardDenomsProposal. func (crdp *ChangeRewardDenomsProposal) ValidateBasic() error { - emptyDenomsToAdd := len(crdp.DenomsToAdd) == 0 - emptyDenomsToRemove := len(crdp.DenomsToRemove) == 0 - // Return error if both sets are empty or nil - if emptyDenomsToAdd && emptyDenomsToRemove { - return fmt.Errorf( - "invalid change reward denoms proposal: both denoms to add and denoms to remove are empty") - } - - // Return error if a denom is in both sets - for _, denomToAdd := range crdp.DenomsToAdd { - for _, denomToRemove := range crdp.DenomsToRemove { - if denomToAdd == denomToRemove { - return fmt.Errorf( - "invalid change reward denoms proposal: %s cannot be both added and removed", denomToAdd) - } - } - } - - // Return error if any denom is "invalid" - for _, denom := range crdp.DenomsToAdd { - if !sdk.NewCoin(denom, math.NewInt(1)).IsValid() { - return fmt.Errorf("invalid change reward denoms proposal: %s is not a valid denom", denom) - } - } - for _, denom := range crdp.DenomsToRemove { - if !sdk.NewCoin(denom, math.NewInt(1)).IsValid() { - return fmt.Errorf("invalid change reward denoms proposal: %s is not a valid denom", denom) - } - } - - return nil + return fmt.Errorf("ChangeRewardDenomsProposal is deprecated") } diff --git a/x/ccv/provider/types/legacy_proposal_test.go b/x/ccv/provider/types/legacy_proposal_test.go deleted file mode 100644 index 02fdb5245e..0000000000 --- a/x/ccv/provider/types/legacy_proposal_test.go +++ /dev/null @@ -1,641 +0,0 @@ -package types_test - -import ( - fmt "fmt" - "testing" - "time" - - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - ibctmtypes "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" - "github.com/golang/protobuf/proto" //nolint:staticcheck // see: https://github.com/cosmos/interchain-security/issues/236 - "github.com/stretchr/testify/require" - - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" -) - -func TestConsumerAdditionProposalValidateBasic(t *testing.T) { - initialHeight := clienttypes.NewHeight(2, 3) - - testCases := []struct { - name string - proposal govv1beta1.Content - expPass bool - }{ - { - "success", - types.NewConsumerAdditionProposal("title", "description", "chainID", initialHeight, []byte("gen_hash"), []byte("bin_hash"), time.Now(), - "0.75", - 10, - "", - 10000, - 100000000000, - 100000000000, - 100000000000, - 0, - 0, - 0, - nil, - nil, - 0, - false, - ), - true, - }, - { - "success with 0.0 fraction", - types.NewConsumerAdditionProposal("title", "description", "chainID", initialHeight, []byte("gen_hash"), []byte("bin_hash"), time.Now(), - "0.0", // fraction can be 0.0 but not empty - 10, - "", - 10000, - 100000000000, - 100000000000, - 100000000000, - 0, - 0, - 0, - nil, - nil, - 0, - false, - ), - true, - }, - { - "fails validate abstract - empty title", - types.NewConsumerAdditionProposal(" ", "description", "chainID", initialHeight, []byte("gen_hash"), []byte("bin_hash"), time.Now(), - "0.75", - 10, - "", - 10000, - 100000000000, - 100000000000, - 100000000000, - 0, - 0, - 0, - nil, - nil, - 0, - false, - ), - false, - }, - { - "chainID is empty", - types.NewConsumerAdditionProposal("title", "description", " ", initialHeight, []byte("gen_hash"), []byte("bin_hash"), time.Now(), - "0.75", - 10, - "", - 10000, - 100000000000, - 100000000000, - 100000000000, - 0, - 0, - 0, - nil, - nil, - 0, - false, - ), - false, - }, - { - "initial height is zero", - &types.ConsumerAdditionProposal{ - Title: "title", - Description: "description", - ChainId: "chainID", - InitialHeight: clienttypes.Height{}, - GenesisHash: []byte("gen_hash"), - BinaryHash: []byte("bin_hash"), - SpawnTime: time.Now(), - BlocksPerDistributionTransmission: 10, - CcvTimeoutPeriod: 100000000000, - TransferTimeoutPeriod: 100000000000, - ConsumerRedistributionFraction: "0.75", - DistributionTransmissionChannel: "", - HistoricalEntries: 10000, - UnbondingPeriod: 100000000000, - }, - false, - }, - { - "genesis hash is empty", - types.NewConsumerAdditionProposal("title", "description", "chainID", initialHeight, []byte(""), []byte("bin_hash"), time.Now(), - "0.75", - 10, - "", - 10000, - 100000000000, - 100000000000, - 100000000000, - 0, - 0, - 0, - nil, - nil, - 0, - false, - ), - false, - }, - { - "binary hash is empty", - types.NewConsumerAdditionProposal("title", "description", "chainID", initialHeight, []byte("gen_hash"), []byte(""), time.Now(), - "0.75", - 10, - "", - 10000, - 100000000000, - 100000000000, - 100000000000, - 0, - 0, - 0, - nil, - nil, - 0, - false, - ), - false, - }, - { - "spawn time is zero", - types.NewConsumerAdditionProposal("title", "description", "chainID", initialHeight, []byte("gen_hash"), []byte("bin_hash"), time.Time{}, - "0.75", - 10, - "", - 10000, - 100000000000, - 100000000000, - 100000000000, - 0, - 0, - 0, - nil, - nil, - 0, - false, - ), - false, - }, - { - "consumer redistribution fraction is invalid", - types.NewConsumerAdditionProposal("title", "description", "chainID", initialHeight, []byte("gen_hash"), []byte("bin_hash"), time.Now(), - "", // fraction can be 0.0 but not empty - 10, - "", - 10000, - 100000000000, - 100000000000, - 100000000000, - 0, - 0, - 0, - nil, - nil, - 0, - false, - ), - false, - }, - { - "blocks per distribution transmission is invalid", - types.NewConsumerAdditionProposal("title", "description", "chainID", initialHeight, []byte("gen_hash"), []byte("bin_hash"), time.Now(), - "0.75", - 0, - "", - 100000000000, - 10000, - 100000000000, - 100000000000, - 0, - 0, - 0, - nil, - nil, - 0, - false, - ), - false, - }, - { - "distribution transmission channel is invalid", - types.NewConsumerAdditionProposal("title", "description", "chainID", initialHeight, []byte("gen_hash"), []byte("bin_hash"), time.Now(), - "0.75", - 10, - "badchannel/", - 10000, - 100000000000, - 100000000000, - 100000000000, - 0, - 0, - 0, - nil, - nil, - 0, - false, - ), - false, - }, - { - "historical entries is invalid", - types.NewConsumerAdditionProposal("title", "description", "chainID", initialHeight, []byte("gen_hash"), []byte("bin_hash"), time.Now(), - "0.75", - 10, - "", - -2, - 100000000000, - 100000000000, - 100000000000, - 0, - 0, - 0, - nil, - nil, - 0, - false, - ), - false, - }, - { - "ccv timeout period is invalid", - types.NewConsumerAdditionProposal("title", "description", "chainID", initialHeight, []byte("gen_hash"), []byte("bin_hash"), time.Now(), - "0.75", - 10, - "", - 10000, - 0, - 100000000000, - 100000000000, - 0, - 0, - 0, - nil, - nil, - 0, - false, - ), - false, - }, - { - "transfer timeout period is invalid", - types.NewConsumerAdditionProposal("title", "description", "chainID", initialHeight, []byte("gen_hash"), []byte("bin_hash"), time.Now(), - "0.75", - 10, - "", - 10000, - 100000000000, - 0, - 100000000000, - 0, - 0, - 0, - nil, - nil, - 0, - false, - ), - false, - }, - { - "unbonding period is invalid", - types.NewConsumerAdditionProposal("title", "description", "chainID", initialHeight, []byte("gen_hash"), []byte("bin_hash"), time.Now(), - "0.75", - 10, - "", - 10000, - 100000000000, - 100000000000, - 0, - 0, - 0, - 0, - nil, - nil, - 0, - false, - ), - false, - }, - { - "top N is invalid", - types.NewConsumerAdditionProposal("title", "description", "chainID", initialHeight, []byte("gen_hash"), []byte("bin_hash"), time.Now(), - "0.75", - 10, - "", - 10000, - 100000000000, - 100000000000, - 100000000000, - 10, - 0, - 0, - nil, - nil, - 0, - false, - ), - false, - }, - { - "validators power cap is invalid", - types.NewConsumerAdditionProposal("title", "description", "chainID", initialHeight, []byte("gen_hash"), []byte("bin_hash"), time.Now(), - "0.75", - 10, - "", - 10000, - 100000000000, - 100000000000, - 100000000000, - 50, - 101, - 0, - nil, - nil, - 0, - false, - ), - false, - }, - { - "valid proposal with PSS features", - types.NewConsumerAdditionProposal("title", "description", "chainID", initialHeight, []byte("gen_hash"), []byte("bin_hash"), time.Now(), - "0.75", - 10, - "", - 10000, - 100000000000, - 100000000000, - 100000000000, - 0, - 34, - 101, - []string{"addr1"}, - []string{"addr2", "addr3"}, - 0, - false, - ), - true, - }, - } - - for _, tc := range testCases { - - err := tc.proposal.ValidateBasic() - if tc.expPass { - require.NoError(t, err, "valid case: %s should not return error. got %w", tc.name, err) - } else { - require.Error(t, err, "invalid case: '%s' must return error but got none", tc.name) - } - } -} - -func TestMarshalConsumerAdditionProposal(t *testing.T) { - content := types.NewConsumerAdditionProposal("title", "description", "chainID", clienttypes.NewHeight(0, 1), []byte("gen_hash"), []byte("bin_hash"), time.Now().UTC(), - "0.75", - 10, - "", - 10000, - 100000000000, - 100000000000, - 100000000000, - 0, - 0, - 0, - nil, - nil, - 0, - false, - ) - - cccp, ok := content.(*types.ConsumerAdditionProposal) - require.True(t, ok) - - // create codec - ir := codectypes.NewInterfaceRegistry() - types.RegisterInterfaces(ir) - govv1.RegisterInterfaces(ir) - clienttypes.RegisterInterfaces(ir) - ibctmtypes.RegisterInterfaces(ir) - cdc := codec.NewProtoCodec(ir) - - // marshal proposal - bz, err := cdc.MarshalJSON(cccp) - require.NoError(t, err) - - // unmarshal proposal - newCccp := &types.ConsumerAdditionProposal{} - err = cdc.UnmarshalJSON(bz, newCccp) - require.NoError(t, err) - - require.True(t, proto.Equal(cccp, newCccp), "unmarshalled proposal does not equal original proposal") -} - -func TestConsumerAdditionProposalString(t *testing.T) { - initialHeight := clienttypes.NewHeight(2, 3) - spawnTime := time.Now() - proposal := types.NewConsumerAdditionProposal( - "title", - "description", - "chainID", - initialHeight, - []byte("gen_hash"), - []byte("bin_hash"), - spawnTime, - "0.75", - 10001, - "", - 500000, - 100000000000, - 10000000000, - 100000000000, - 0, - 0, - 0, - []string{}, - []string{}, - 0, - false, - ) - - expect := fmt.Sprintf(`CreateConsumerChain Proposal - Title: title - Description: description - ChainID: chainID - InitialHeight: %s - GenesisHash: %s - BinaryHash: %s - SpawnTime: %s - ConsumerRedistributionFraction: %s - BlocksPerDistributionTransmission: %d - DistributionTransmissionChannel: %s - HistoricalEntries: %d - CcvTimeoutPeriod: %d - TransferTimeoutPeriod: %d - UnbondingPeriod: %d`, initialHeight, []byte("gen_hash"), []byte("bin_hash"), spawnTime, - "0.75", - 10001, - "", - 500000, - 100000000000, - 10000000000, - 100000000000) - - require.Equal(t, expect, proposal.String(), "string method for ConsumerAdditionProposal returned unexpected string") -} - -func TestChangeRewardDenomsProposalValidateBasic(t *testing.T) { - tcs := []struct { - name string - proposal govv1beta1.Content - expectError bool - expectPanic bool - }{ - { - name: "invalid change reward denoms proposal, none to add or remove", - proposal: types.NewChangeRewardDenomsProposal( - "title", "description", []string{}, []string{}), - expectError: true, - }, - { - name: "invalid change reward denoms proposal, same denom in both sets", - proposal: types.NewChangeRewardDenomsProposal( - "title", "description", []string{"denom1"}, []string{"denom1"}), - expectError: true, - }, - { - name: "valid change reward denoms proposal", - proposal: types.NewChangeRewardDenomsProposal( - "title", "description", []string{"denom1"}, []string{"denom2"}), - expectError: false, - }, - { - name: "invalid prop, invalid denom, will panic", - proposal: types.NewChangeRewardDenomsProposal( - "title", "description", []string{"!@blah"}, []string{"denom2"}), - expectPanic: true, - }, - } - - for _, tc := range tcs { - t.Run(tc.name, func(t *testing.T) { - if tc.expectPanic { - require.Panics(t, func() { tc.proposal.ValidateBasic() }) - return - } - err := tc.proposal.ValidateBasic() - if tc.expectError { - require.Error(t, err) - return - } - require.NoError(t, err) - }) - } -} - -func TestConsumerModificationProposalValidateBasic(t *testing.T) { - testCases := []struct { - name string - proposal govv1beta1.Content - expPass bool - }{ - { - "success", - types.NewConsumerModificationProposal("title", "description", "chainID", - 50, - 100, - 34, - []string{"addr1"}, - nil, - 0, - 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, - ), - false, - }, - { - "validators power cap is invalid", - types.NewConsumerModificationProposal("title", "description", "chainID", - 50, - 101, - 0, - nil, - nil, - 0, - false, - ), - false, - }, - { - "valid proposal", - types.NewConsumerModificationProposal("title", "description", "chainID", - 0, - 34, - 101, - []string{"addr1"}, - []string{"addr2", "addr3"}, - 0, - false, - ), - true, - }, - } - - for _, tc := range testCases { - - err := tc.proposal.ValidateBasic() - if tc.expPass { - require.NoError(t, err, "valid case: %s should not return error. got %w", tc.name, err) - } else { - require.Error(t, err, "invalid case: '%s' must return error but got none", tc.name) - } - } -} - -func TestValidatePSSFeatures(t *testing.T) { - require.NoError(t, types.ValidatePSSFeatures(0, 0)) - require.NoError(t, types.ValidatePSSFeatures(50, 0)) - require.NoError(t, types.ValidatePSSFeatures(100, 0)) - require.NoError(t, types.ValidatePSSFeatures(0, 10)) - require.NoError(t, types.ValidatePSSFeatures(0, 100)) - require.NoError(t, types.ValidatePSSFeatures(50, 100)) - - require.Error(t, types.ValidatePSSFeatures(10, 0)) - require.Error(t, types.ValidatePSSFeatures(49, 0)) - require.Error(t, types.ValidatePSSFeatures(101, 0)) - require.Error(t, types.ValidatePSSFeatures(50, 101)) -} diff --git a/x/ccv/provider/types/msg.go b/x/ccv/provider/types/msg.go index f9b84af0e4..f7ddd1ad4a 100644 --- a/x/ccv/provider/types/msg.go +++ b/x/ccv/provider/types/msg.go @@ -3,50 +3,55 @@ package types import ( "encoding/json" "fmt" + "strconv" "strings" + cmttypes "github.com/cometbft/cometbft/types" + ibctmtypes "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" errorsmod "cosmossdk.io/errors" "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" tmtypes "github.com/cometbft/cometbft/proto/tendermint/types" ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" ) -// provider message types const ( - TypeMsgAssignConsumerKey = "assign_consumer_key" - TypeMsgSubmitConsumerMisbehaviour = "submit_consumer_misbehaviour" - TypeMsgSubmitConsumerDoubleVoting = "submit_consumer_double_vote" - TypeMsgOptIn = "opt_in" - TypeMsgOptOut = "opt_out" - TypeMsgSetConsumerCommissionRate = "set_consumer_commission_rate" + // MaxNameLength defines the maximum consumer name length + MaxNameLength = 50 + // MaxDescriptionLength defines the maximum consumer description length + MaxDescriptionLength = 10000 + // MaxMetadataLength defines the maximum consumer metadata length + MaxMetadataLength = 255 + // MaxHashLength defines the maximum length of a hash + MaxHashLength = 64 + // MaxValidatorCount defines the maximum number of validators + MaxValidatorCount = 1000 ) 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,470 +59,538 @@ var ( // NewMsgAssignConsumerKey creates a new MsgAssignConsumerKey instance. // Delegator address and validator address are the same. -func NewMsgAssignConsumerKey(chainID string, providerValidatorAddress sdk.ValAddress, - consumerConsensusPubKey, signer string, +func NewMsgAssignConsumerKey(consumerId string, providerValidatorAddress sdk.ValAddress, + consumerConsensusPubKey, submitter string, ) (*MsgAssignConsumerKey, error) { return &MsgAssignConsumerKey{ - ChainId: chainID, + ConsumerId: consumerId, ProviderAddr: providerValidatorAddress.String(), ConsumerKey: consumerConsensusPubKey, - Signer: signer, + Submitter: submitter, }, nil } -// Route implements the sdk.Msg interface. -func (msg MsgAssignConsumerKey) Route() string { return RouterKey } - -// Type implements the sdk.Msg interface. -func (msg MsgAssignConsumerKey) Type() string { - return TypeMsgAssignConsumerKey -} - -// 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 MsgAssignConsumerKey) GetSigners() []sdk.AccAddress { - valAddr, err := sdk.ValAddressFromBech32(msg.ProviderAddr) - if err != nil { - // same behavior as in cosmos-sdk - panic(err) - } - return []sdk.AccAddress{valAddr.Bytes()} -} - -// GetSignBytes returns the message bytes to sign over. -func (msg MsgAssignConsumerKey) GetSignBytes() []byte { - bz := ccvtypes.ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -// ValidateBasic implements the sdk.Msg interface. +// ValidateBasic implements the sdk.HasValidateBasic 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 := validateDeprecatedChainId(msg.ChainId); err != nil { + return errorsmod.Wrapf(ErrInvalidMsgAssignConsumerKey, "ChainId: %s", err.Error()) } - valAddr, err := sdk.ValAddressFromBech32(msg.ProviderAddr) - if err != nil { - return ErrInvalidProviderAddress + + if err := ValidateConsumerId(msg.ConsumerId); err != nil { + return errorsmod.Wrapf(ErrInvalidMsgAssignConsumerKey, "ConsumerId: %s", err.Error()) } - // Check that the provider validator address and the signer address are the same - if sdk.AccAddress(valAddr.Bytes()).String() != msg.Signer { - return errorsmod.Wrapf(ErrInvalidProviderAddress, "provider validator address must be the same as the signer address") + + if err := validateProviderAddress(msg.ProviderAddr, msg.Submitter); err != nil { + return errorsmod.Wrapf(ErrInvalidMsgAssignConsumerKey, "ProviderAddr: %s", err.Error()) } + if msg.ConsumerKey == "" { - return ErrInvalidConsumerConsensusPubKey + return errorsmod.Wrapf(ErrInvalidMsgAssignConsumerKey, "ConsumerKey cannot be empty") } if _, _, err := ParseConsumerKeyFromJson(msg.ConsumerKey); err != nil { - return ErrInvalidConsumerConsensusPubKey + return errorsmod.Wrapf(ErrInvalidMsgAssignConsumerKey, "ConsumerKey: %s", err.Error()) } + return nil } -// ParseConsumerKeyFromJson parses the consumer key from a JSON string, -// this replaces deserializing a protobuf any. -func ParseConsumerKeyFromJson(jsonStr string) (pkType, key string, err error) { - type PubKey struct { - Type string `json:"@type"` - Key string `json:"key"` +// ValidateBasic implements the sdk.HasValidateBasic interface. +func (msg *MsgChangeRewardDenoms) ValidateBasic() error { + emptyDenomsToAdd := len(msg.DenomsToAdd) == 0 + emptyDenomsToRemove := len(msg.DenomsToRemove) == 0 + // Return error if both sets are empty or nil + if emptyDenomsToAdd && emptyDenomsToRemove { + return errorsmod.Wrapf(ErrInvalidMsgChangeRewardDenoms, "both DenomsToAdd and DenomsToRemove are empty") } - var pubKey PubKey - err = json.Unmarshal([]byte(jsonStr), &pubKey) - if err != nil { - return "", "", err + + denomMap := map[string]struct{}{} + for _, denom := range msg.DenomsToAdd { + // validate the denom + if !sdk.NewCoin(denom, math.NewInt(1)).IsValid() { + return errorsmod.Wrapf(ErrInvalidMsgChangeRewardDenoms, "DenomsToAdd: invalid denom(%s)", denom) + } + denomMap[denom] = struct{}{} + } + for _, denom := range msg.DenomsToRemove { + // validate the denom + if !sdk.NewCoin(denom, math.NewInt(1)).IsValid() { + return errorsmod.Wrapf(ErrInvalidMsgChangeRewardDenoms, "DenomsToRemove: invalid denom(%s)", denom) + } + // denom cannot be in both sets + if _, found := denomMap[denom]; found { + return errorsmod.Wrapf(ErrInvalidMsgChangeRewardDenoms, + "denom(%s) cannot be both added and removed", denom) + } } - return pubKey.Type, pubKey.Key, nil -} -func NewMsgSubmitConsumerMisbehaviour(submitter sdk.AccAddress, misbehaviour *ibctmtypes.Misbehaviour) (*MsgSubmitConsumerMisbehaviour, error) { - return &MsgSubmitConsumerMisbehaviour{Submitter: submitter.String(), Misbehaviour: misbehaviour}, nil + return nil } -// Route implements the sdk.Msg interface. -func (msg MsgSubmitConsumerMisbehaviour) Route() string { return RouterKey } - -// Type implements the sdk.Msg interface. -func (msg MsgSubmitConsumerMisbehaviour) Type() string { - return TypeMsgSubmitConsumerMisbehaviour +func NewMsgSubmitConsumerMisbehaviour( + consumerId string, + submitter sdk.AccAddress, + misbehaviour *ibctmtypes.Misbehaviour, +) (*MsgSubmitConsumerMisbehaviour, error) { + return &MsgSubmitConsumerMisbehaviour{ + Submitter: submitter.String(), + Misbehaviour: misbehaviour, + ConsumerId: consumerId, + }, nil } -// Type implements the sdk.Msg interface. +// ValidateBasic implements the sdk.HasValidateBasic interface. func (msg MsgSubmitConsumerMisbehaviour) ValidateBasic() error { - if msg.Submitter == "" { - return errorsmod.Wrap(sdkerrors.ErrInvalidAddress, msg.Submitter) + if err := ValidateConsumerId(msg.ConsumerId); err != nil { + return errorsmod.Wrapf(ErrInvalidMsgSubmitConsumerMisbehaviour, "ConsumerId: %s", err.Error()) } if err := msg.Misbehaviour.ValidateBasic(); err != nil { - return err + return errorsmod.Wrapf(ErrInvalidMsgSubmitConsumerMisbehaviour, "Misbehaviour: %s", err.Error()) } return nil } -// Type implements the sdk.Msg interface. -func (msg MsgSubmitConsumerMisbehaviour) GetSignBytes() []byte { - bz := ccvtypes.ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) +func NewMsgSubmitConsumerDoubleVoting( + consumerId string, + submitter sdk.AccAddress, + ev *tmtypes.DuplicateVoteEvidence, + header *ibctmtypes.Header, +) (*MsgSubmitConsumerDoubleVoting, error) { + return &MsgSubmitConsumerDoubleVoting{ + Submitter: submitter.String(), + DuplicateVoteEvidence: ev, + InfractionBlockHeader: header, + ConsumerId: consumerId, + }, nil } -// Type implements the sdk.Msg interface. -func (msg MsgSubmitConsumerMisbehaviour) GetSigners() []sdk.AccAddress { - addr, err := sdk.AccAddressFromBech32(msg.Submitter) - if err != nil { - // same behavior as in cosmos-sdk - panic(err) +// ValidateBasic implements the sdk.HasValidateBasic interface. +func (msg MsgSubmitConsumerDoubleVoting) ValidateBasic() error { + if dve, err := cmttypes.DuplicateVoteEvidenceFromProto(msg.DuplicateVoteEvidence); err != nil { + return errorsmod.Wrapf(ErrInvalidMsgSubmitConsumerDoubleVoting, "DuplicateVoteEvidence: %s", err.Error()) + } else { + if err = dve.ValidateBasic(); err != nil { + return errorsmod.Wrapf(ErrInvalidMsgSubmitConsumerDoubleVoting, "DuplicateVoteEvidence: %s", err.Error()) + } } - return []sdk.AccAddress{addr} -} -func NewMsgSubmitConsumerDoubleVoting(submitter sdk.AccAddress, ev *tmtypes.DuplicateVoteEvidence, header *ibctmtypes.Header) (*MsgSubmitConsumerDoubleVoting, error) { - return &MsgSubmitConsumerDoubleVoting{Submitter: submitter.String(), DuplicateVoteEvidence: ev, InfractionBlockHeader: header}, nil -} + if err := ValidateHeaderForConsumerDoubleVoting(msg.InfractionBlockHeader); err != nil { + return errorsmod.Wrapf(ErrInvalidMsgSubmitConsumerDoubleVoting, "ValidateTendermintHeader: %s", err.Error()) + } -// Route implements the sdk.Msg interface. -func (msg MsgSubmitConsumerDoubleVoting) Route() string { return RouterKey } + if err := ValidateConsumerId(msg.ConsumerId); err != nil { + return errorsmod.Wrapf(ErrInvalidMsgSubmitConsumerDoubleVoting, "ConsumerId: %s", err.Error()) + } -// Type implements the sdk.Msg interface. -func (msg MsgSubmitConsumerDoubleVoting) Type() string { - return TypeMsgSubmitConsumerDoubleVoting + return nil } -// Type implements the sdk.Msg interface. -func (msg MsgSubmitConsumerDoubleVoting) ValidateBasic() error { - if msg.Submitter == "" { - return errorsmod.Wrap(sdkerrors.ErrInvalidAddress, msg.Submitter) - } - if msg.DuplicateVoteEvidence == nil { - return fmt.Errorf("double voting evidence cannot be nil") - } +// NewMsgOptIn creates a new NewMsgOptIn instance. +func NewMsgOptIn(consumerId string, providerValidatorAddress sdk.ValAddress, consumerConsensusPubKey, submitter string) (*MsgOptIn, error) { + return &MsgOptIn{ + ConsumerId: consumerId, + ProviderAddr: providerValidatorAddress.String(), + ConsumerKey: consumerConsensusPubKey, + Submitter: submitter, + }, nil +} - if msg.InfractionBlockHeader == nil { - return fmt.Errorf("infraction block header cannot be nil") +// ValidateBasic implements the sdk.HasValidateBasic interface. +func (msg MsgOptIn) ValidateBasic() error { + if err := validateDeprecatedChainId(msg.ChainId); err != nil { + return errorsmod.Wrapf(ErrInvalidMsgOptIn, "ChainId: %s", err.Error()) } - if msg.InfractionBlockHeader.SignedHeader == nil { - return fmt.Errorf("signed header in infraction block header cannot be nil") + if err := ValidateConsumerId(msg.ConsumerId); err != nil { + return errorsmod.Wrapf(ErrInvalidMsgOptIn, "ConsumerId: %s", err.Error()) } - if msg.InfractionBlockHeader.SignedHeader.Header == nil { - return fmt.Errorf("invalid signed header in infraction block header, 'SignedHeader.Header' is nil") + if err := validateProviderAddress(msg.ProviderAddr, msg.Submitter); err != nil { + return errorsmod.Wrapf(ErrInvalidMsgOptIn, "ProviderAddr: %s", err.Error()) } - if msg.InfractionBlockHeader.ValidatorSet == nil { - return fmt.Errorf("invalid infraction block header, validator set is nil") + if msg.ConsumerKey != "" { + if _, _, err := ParseConsumerKeyFromJson(msg.ConsumerKey); err != nil { + return errorsmod.Wrapf(ErrInvalidMsgOptIn, "ConsumerKey: %s", err.Error()) + } } - return nil } -// Type implements the sdk.Msg interface. -func (msg MsgSubmitConsumerDoubleVoting) GetSignBytes() []byte { - bz := ccvtypes.ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) +// NewMsgOptOut creates a new NewMsgOptIn instance. +func NewMsgOptOut(consumerId string, providerValidatorAddress sdk.ValAddress, submitter string) (*MsgOptOut, error) { + return &MsgOptOut{ + ConsumerId: consumerId, + ProviderAddr: providerValidatorAddress.String(), + Submitter: submitter, + }, nil } -// Type implements the sdk.Msg interface. -func (msg MsgSubmitConsumerDoubleVoting) GetSigners() []sdk.AccAddress { - addr, err := sdk.AccAddressFromBech32(msg.Submitter) - if err != nil { - // same behavior as in cosmos-sdk - panic(err) +// ValidateBasic implements the sdk.HasValidateBasic interface. +func (msg MsgOptOut) ValidateBasic() error { + if err := validateDeprecatedChainId(msg.ChainId); err != nil { + return errorsmod.Wrapf(ErrInvalidMsgOptOut, "ChainId: %s", err.Error()) } - return []sdk.AccAddress{addr} -} -// 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 { - valAddr, err := sdk.ValAddressFromBech32(msg.Authority) - if err != nil { - // same behavior as in cosmos-sdk - panic(err) + if err := ValidateConsumerId(msg.ConsumerId); err != nil { + return errorsmod.Wrapf(ErrInvalidMsgOptOut, "ConsumerId: %s", err.Error()) } - return []sdk.AccAddress{valAddr.Bytes()} -} -// ValidateBasic implements the sdk.Msg interface. -func (msg *MsgConsumerAddition) ValidateBasic() error { - if strings.TrimSpace(msg.ChainId) == "" { - return ErrBlankConsumerChainID + if err := validateProviderAddress(msg.ProviderAddr, msg.Submitter); err != nil { + return errorsmod.Wrapf(ErrInvalidMsgOptOut, "ProviderAddr: %s", err.Error()) } - if msg.InitialHeight.IsZero() { - return errorsmod.Wrap(ErrInvalidConsumerAdditionProposal, "initial height cannot be zero") - } + return nil +} - if len(msg.GenesisHash) == 0 { - return errorsmod.Wrap(ErrInvalidConsumerAdditionProposal, "genesis hash cannot be empty") - } - if len(msg.BinaryHash) == 0 { - return errorsmod.Wrap(ErrInvalidConsumerAdditionProposal, "binary hash cannot be empty") +// NewMsgSetConsumerCommissionRate creates a new MsgSetConsumerCommissionRate msg instance. +func NewMsgSetConsumerCommissionRate( + consumerId string, + commission math.LegacyDec, + providerValidatorAddress sdk.ValAddress, + submitter string, +) *MsgSetConsumerCommissionRate { + return &MsgSetConsumerCommissionRate{ + ConsumerId: consumerId, + Rate: commission, + ProviderAddr: providerValidatorAddress.String(), + Submitter: submitter, } +} - if msg.SpawnTime.IsZero() { - return errorsmod.Wrap(ErrInvalidConsumerAdditionProposal, "spawn time cannot be zero") +// ValidateBasic implements the sdk.HasValidateBasic interface. +func (msg MsgSetConsumerCommissionRate) ValidateBasic() error { + if err := validateDeprecatedChainId(msg.ChainId); err != nil { + return errorsmod.Wrapf(ErrInvalidMsgSetConsumerCommissionRate, "ChainId: %s", err.Error()) } - if err := ccvtypes.ValidateStringFraction(msg.ConsumerRedistributionFraction); err != nil { - return errorsmod.Wrapf(ErrInvalidConsumerAdditionProposal, "consumer redistribution fraction is invalid: %s", err) + if err := ValidateConsumerId(msg.ConsumerId); err != nil { + return errorsmod.Wrapf(ErrInvalidMsgSetConsumerCommissionRate, "ConsumerId: %s", err.Error()) } - if err := ccvtypes.ValidatePositiveInt64(msg.BlocksPerDistributionTransmission); err != nil { - return errorsmod.Wrap(ErrInvalidConsumerAdditionProposal, "blocks per distribution transmission cannot be < 1") + if err := validateProviderAddress(msg.ProviderAddr, msg.Submitter); err != nil { + return errorsmod.Wrapf(ErrInvalidMsgSetConsumerCommissionRate, "ProviderAddr: %s", err.Error()) } - if err := ccvtypes.ValidateDistributionTransmissionChannel(msg.DistributionTransmissionChannel); err != nil { - return errorsmod.Wrap(ErrInvalidConsumerAdditionProposal, "distribution transmission channel") + if msg.Rate.IsNegative() || msg.Rate.GT(math.LegacyOneDec()) { + return errorsmod.Wrapf(ErrInvalidMsgSetConsumerCommissionRate, "consumer commission rate should be in the range [0, 1]") } - if err := ccvtypes.ValidatePositiveInt64(msg.HistoricalEntries); err != nil { - return errorsmod.Wrap(ErrInvalidConsumerAdditionProposal, "historical entries cannot be < 1") + return nil +} + +// NewMsgCreateConsumer creates a new MsgCreateConsumer instance +func NewMsgCreateConsumer(submitter string, chainId string, metadata ConsumerMetadata, + initializationParameters *ConsumerInitializationParameters, powerShapingParameters *PowerShapingParameters) (*MsgCreateConsumer, error) { + return &MsgCreateConsumer{ + Submitter: submitter, + ChainId: chainId, + Metadata: metadata, + InitializationParameters: initializationParameters, + PowerShapingParameters: powerShapingParameters, + }, nil +} + +// ValidateBasic implements the sdk.HasValidateBasic interface. +func (msg MsgCreateConsumer) ValidateBasic() error { + if err := ValidateStringField("ChainId", msg.ChainId, cmttypes.MaxChainIDLen); err != nil { + return errorsmod.Wrapf(ErrInvalidMsgCreateConsumer, "ChainId: %s", err.Error()) } - if err := ccvtypes.ValidateDuration(msg.CcvTimeoutPeriod); err != nil { - return errorsmod.Wrap(ErrInvalidConsumerAdditionProposal, "ccv timeout period cannot be zero") + if err := ValidateConsumerMetadata(msg.Metadata); err != nil { + return errorsmod.Wrapf(ErrInvalidMsgCreateConsumer, "Metadata: %s", err.Error()) } - if err := ccvtypes.ValidateDuration(msg.TransferTimeoutPeriod); err != nil { - return errorsmod.Wrap(ErrInvalidConsumerAdditionProposal, "transfer timeout period cannot be zero") + if msg.InitializationParameters != nil { + if err := ValidateInitializationParameters(*msg.InitializationParameters); err != nil { + return errorsmod.Wrapf(ErrInvalidMsgCreateConsumer, "InitializationParameters: %s", err.Error()) + } } - if err := ccvtypes.ValidateDuration(msg.UnbondingPeriod); err != nil { - return errorsmod.Wrap(ErrInvalidConsumerAdditionProposal, "unbonding period cannot be zero") + 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 errorsmod.Wrapf(ErrInvalidMsgCreateConsumer, "PowerShapingParameters: %s", err.Error()) + } } return nil } -func (msg *MsgConsumerRemoval) ValidateBasic() error { - if strings.TrimSpace(msg.ChainId) == "" { - return errorsmod.Wrap(ErrInvalidConsumerRemovalProp, "consumer chain id must not be blank") +// NewMsgUpdateConsumer creates a new MsgUpdateConsumer instance +func NewMsgUpdateConsumer(owner string, consumerId string, ownerAddress string, metadata *ConsumerMetadata, + initializationParameters *ConsumerInitializationParameters, powerShapingParameters *PowerShapingParameters) (*MsgUpdateConsumer, error) { + return &MsgUpdateConsumer{ + Owner: owner, + ConsumerId: consumerId, + NewOwnerAddress: ownerAddress, + Metadata: metadata, + InitializationParameters: initializationParameters, + PowerShapingParameters: powerShapingParameters, + }, nil +} + +// ValidateBasic implements the sdk.HasValidateBasic interface. +func (msg MsgUpdateConsumer) ValidateBasic() error { + if err := ValidateConsumerId(msg.ConsumerId); err != nil { + return errorsmod.Wrapf(ErrInvalidMsgUpdateConsumer, "ConsumerId: %s", err.Error()) } - if msg.StopTime.IsZero() { - return errorsmod.Wrap(ErrInvalidConsumerRemovalProp, "spawn time cannot be zero") + // Note that NewOwnerAddress is validated when handling the message in UpdateConsumer + + if msg.Metadata != nil { + if err := ValidateConsumerMetadata(*msg.Metadata); err != nil { + return errorsmod.Wrapf(ErrInvalidMsgUpdateConsumer, "Metadata: %s", err.Error()) + } } - return nil -} -// ValidateBasic implements the sdk.Msg interface. -func (msg *MsgConsumerModification) ValidateBasic() error { - if strings.TrimSpace(msg.ChainId) == "" { - return ErrBlankConsumerChainID + if msg.InitializationParameters != nil { + if err := ValidateInitializationParameters(*msg.InitializationParameters); err != nil { + return errorsmod.Wrapf(ErrInvalidMsgUpdateConsumer, "InitializationParameters: %s", err.Error()) + } } - err := ValidatePSSFeatures(msg.Top_N, msg.ValidatorsPowerCap) - if err != nil { - return errorsmod.Wrapf(ErrInvalidConsumerModificationProposal, "invalid PSS features: %s", err.Error()) + if msg.PowerShapingParameters != nil { + if err := ValidatePowerShapingParameters(*msg.PowerShapingParameters); err != nil { + return errorsmod.Wrapf(ErrInvalidMsgUpdateConsumer, "PowerShapingParameters: %s", err.Error()) + } } return nil } -// NewMsgOptIn creates a new NewMsgOptIn instance. -func NewMsgOptIn(chainID string, providerValidatorAddress sdk.ValAddress, consumerConsensusPubKey, signer string) (*MsgOptIn, error) { - return &MsgOptIn{ - ChainId: chainID, - ProviderAddr: providerValidatorAddress.String(), - ConsumerKey: consumerConsensusPubKey, - Signer: signer, +// NewMsgRemoveConsumer creates a new MsgRemoveConsumer instance +func NewMsgRemoveConsumer(owner string, consumerId string) (*MsgRemoveConsumer, error) { + return &MsgRemoveConsumer{ + Owner: owner, + ConsumerId: consumerId, }, nil } -// Type implements the sdk.Msg interface. -func (msg MsgOptIn) Type() string { - return TypeMsgOptIn +// ValidateBasic implements the sdk.HasValidateBasic interface. +func (msg MsgRemoveConsumer) ValidateBasic() error { + if err := ValidateConsumerId(msg.ConsumerId); err != nil { + return err + } + return nil } -// Route implements the sdk.Msg interface. -func (msg MsgOptIn) Route() string { return RouterKey } +// +// Validation methods +// -// GetSigners implements the sdk.Msg interface. It returns the address(es) that -// must sign over msg.GetSignBytes(). -func (msg MsgOptIn) GetSigners() []sdk.AccAddress { - valAddr, err := sdk.ValAddressFromBech32(msg.ProviderAddr) +// ParseConsumerKeyFromJson parses the consumer key from a JSON string, +// this replaces deserializing a protobuf any. +func ParseConsumerKeyFromJson(jsonStr string) (pkType, key string, err error) { + type PubKey struct { + Type string `json:"@type"` + Key string `json:"key"` + } + var pubKey PubKey + err = json.Unmarshal([]byte(jsonStr), &pubKey) if err != nil { - // same behavior as in cosmos-sdk - panic(err) + return "", "", err } - return []sdk.AccAddress{valAddr.Bytes()} + return pubKey.Type, pubKey.Key, nil } -// ValidateBasic implements the sdk.Msg interface. -func (msg MsgOptIn) ValidateBasic() error { - if strings.TrimSpace(msg.ChainId) == "" { - return errorsmod.Wrapf(ErrInvalidConsumerChainID, "chainId cannot be blank") +// ValidateHeaderForConsumerDoubleVoting validates Tendermint light client header +// for consumer double voting evidence. +// +// TODO create unit test +func ValidateHeaderForConsumerDoubleVoting(header *ibctmtypes.Header) error { + if header == nil { + return fmt.Errorf("infraction block header cannot be nil") } - // 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 header.SignedHeader == nil { + return fmt.Errorf("signed header in infraction block header cannot be nil") } - valAddr, err := sdk.ValAddressFromBech32(msg.ProviderAddr) - if err != nil { - return ErrInvalidProviderAddress + + if header.SignedHeader.Header == nil { + return fmt.Errorf("invalid signed header in infraction block header, 'SignedHeader.Header' is nil") } - // Check that the provider validator address and the signer address are the same - if sdk.AccAddress(valAddr.Bytes()).String() != msg.Signer { - return errorsmod.Wrapf(ErrInvalidProviderAddress, "provider validator address must be the same as the signer address") + + if header.ValidatorSet == nil { + return fmt.Errorf("invalid infraction block header, validator set is nil") } - if msg.ConsumerKey != "" { - if _, _, err := ParseConsumerKeyFromJson(msg.ConsumerKey); err != nil { - return ErrInvalidConsumerConsensusPubKey - } + + return nil +} + +// 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 } -// NewMsgOptOut creates a new NewMsgOptIn instance. -func NewMsgOptOut(chainID string, providerValidatorAddress sdk.ValAddress, signer string) (*MsgOptOut, error) { - return &MsgOptOut{ - ChainId: chainID, - ProviderAddr: providerValidatorAddress.String(), - Signer: signer, - }, nil +// ValidateStringField validates that a string `field` satisfies the following properties: +// - is not empty +// - has at most `maxLength` characters +func ValidateStringField(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 } -// Type implements the sdk.Msg interface. -func (msg MsgOptOut) Type() string { - return TypeMsgOptOut +// TruncateString truncates a string to maximum length characters +func TruncateString(str string, maxLength int) string { + if maxLength <= 0 { + return "" + } + + truncated := "" + count := 0 + for _, char := range str { + truncated += string(char) + count++ + if count >= maxLength { + break + } + } + return truncated } -// Route implements the sdk.Msg interface. -func (msg MsgOptOut) Route() string { return RouterKey } +// ValidateConsumerMetadata validates that all the provided metadata are in the expected range +func ValidateConsumerMetadata(metadata ConsumerMetadata) error { + if err := ValidateStringField("name", metadata.Name, MaxNameLength); err != nil { + return errorsmod.Wrapf(ErrInvalidConsumerMetadata, "Name: %s", err.Error()) + } -// GetSigners implements the sdk.Msg interface. It returns the address(es) that -// must sign over msg.GetSignBytes(). -func (msg MsgOptOut) GetSigners() []sdk.AccAddress { - valAddr, err := sdk.ValAddressFromBech32(msg.ProviderAddr) - if err != nil { - // same behavior as in cosmos-sdk - panic(err) + if err := ValidateStringField("description", metadata.Description, MaxDescriptionLength); err != nil { + return errorsmod.Wrapf(ErrInvalidConsumerMetadata, "Description: %s", err.Error()) + } + + if err := ValidateStringField("metadata", metadata.Metadata, MaxMetadataLength); err != nil { + return errorsmod.Wrapf(ErrInvalidConsumerMetadata, "Metadata: %s", err.Error()) } - return []sdk.AccAddress{valAddr.Bytes()} + + return nil } -// GetSignBytes returns the message bytes to sign over. -func (msg MsgOptOut) GetSignBytes() []byte { - bz := ccvtypes.ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) +// ValidateConsAddressList validates a list of consensus addresses +func ValidateConsAddressList(list []string, maxLength int) error { + if len(list) > maxLength { + return fmt.Errorf("consensus address list too long; got: %d, max: %d", len(list), maxLength) + } + for _, address := range list { + _, err := sdk.ConsAddressFromBech32(address) + if err != nil { + return fmt.Errorf("invalid address %s: %s", address, err.Error()) + } + } + return nil } -// ValidateBasic implements the sdk.Msg interface. -func (msg MsgOptOut) ValidateBasic() error { - if strings.TrimSpace(msg.ChainId) == "" { - return errorsmod.Wrapf(ErrInvalidConsumerChainID, "chainId cannot be blank") +// ValidatePowerShapingParameters validates that all the provided power-shaping parameters are in the expected range +func ValidatePowerShapingParameters(powerShapingParameters PowerShapingParameters) error { + // 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 errorsmod.Wrap(ErrInvalidPowerShapingParameters, "Top N can either be 0 or in the range [50, 100]") } - // 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 powerShapingParameters.ValidatorsPowerCap > 100 { + return errorsmod.Wrap(ErrInvalidPowerShapingParameters, "ValidatorsPowerCap has to be in the range [0, 100]") } - valAddr, err := sdk.ValAddressFromBech32(msg.ProviderAddr) - if err != nil { - return ErrInvalidProviderAddress + + if err := ValidateConsAddressList(powerShapingParameters.Allowlist, MaxValidatorCount); err != nil { + return errorsmod.Wrapf(ErrInvalidPowerShapingParameters, "Allowlist: %s", err.Error()) } - // Check that the provider validator address and the signer address are the same - if sdk.AccAddress(valAddr.Bytes()).String() != msg.Signer { - return errorsmod.Wrapf(ErrInvalidProviderAddress, "provider validator address must be the same as the signer address") + if err := ValidateConsAddressList(powerShapingParameters.Denylist, MaxValidatorCount); err != nil { + return errorsmod.Wrapf(ErrInvalidPowerShapingParameters, "Denylist: %s", err.Error()) } return nil } -// NewMsgSetConsumerCommissionRate creates a new MsgSetConsumerCommissionRate msg instance. -func NewMsgSetConsumerCommissionRate(chainID string, commission math.LegacyDec, providerValidatorAddress sdk.ValAddress, signer string) *MsgSetConsumerCommissionRate { - return &MsgSetConsumerCommissionRate{ - ChainId: chainID, - Rate: commission, - ProviderAddr: providerValidatorAddress.String(), - Signer: signer, +// ValidateInitializationParameters validates that all the provided parameters are in the expected range +func ValidateInitializationParameters(initializationParameters ConsumerInitializationParameters) error { + if initializationParameters.InitialHeight.IsZero() { + return errorsmod.Wrap(ErrInvalidConsumerInitializationParameters, "InitialHeight cannot be zero") } -} -func (msg MsgSetConsumerCommissionRate) Route() string { - return RouterKey -} - -func (msg MsgSetConsumerCommissionRate) Type() string { - return TypeMsgSetConsumerCommissionRate -} + if err := ValidateByteSlice(initializationParameters.GenesisHash, MaxHashLength); err != nil { + return errorsmod.Wrapf(ErrInvalidConsumerInitializationParameters, "GenesisHash: %s", err.Error()) + } -func (msg MsgSetConsumerCommissionRate) ValidateBasic() error { - if strings.TrimSpace(msg.ChainId) == "" { - return errorsmod.Wrapf(ErrInvalidConsumerChainID, "chainId cannot be blank") + if err := ValidateByteSlice(initializationParameters.BinaryHash, MaxHashLength); err != nil { + return errorsmod.Wrapf(ErrInvalidConsumerInitializationParameters, "BinaryHash: %s", err.Error()) } - if 128 < len(msg.ChainId) { - return errorsmod.Wrapf(ErrInvalidConsumerChainID, "chainId cannot exceed 128 length") + + if err := ccvtypes.ValidateStringFraction(initializationParameters.ConsumerRedistributionFraction); err != nil { + return errorsmod.Wrapf(ErrInvalidConsumerInitializationParameters, "ConsumerRedistributionFraction: %s", err.Error()) } - valAddr, err := sdk.ValAddressFromBech32(msg.ProviderAddr) - if err != nil { - return ErrInvalidProviderAddress + + if err := ccvtypes.ValidatePositiveInt64(initializationParameters.BlocksPerDistributionTransmission); err != nil { + return errorsmod.Wrapf(ErrInvalidConsumerInitializationParameters, "BlocksPerDistributionTransmission: %s", err.Error()) } - // Check that the provider validator address and the signer address are the same - if sdk.AccAddress(valAddr.Bytes()).String() != msg.Signer { - return errorsmod.Wrapf(ErrInvalidProviderAddress, "provider validator address must be the same as the signer address") + + if err := ccvtypes.ValidateDistributionTransmissionChannel(initializationParameters.DistributionTransmissionChannel); err != nil { + return errorsmod.Wrapf(ErrInvalidConsumerInitializationParameters, "DistributionTransmissionChannel: %s", err.Error()) } - if msg.Rate.IsNegative() || msg.Rate.GT(math.LegacyOneDec()) { - return errorsmod.Wrapf(ErrInvalidConsumerCommissionRate, "consumer commission rate should be in the range [0, 1]") + + if err := ccvtypes.ValidatePositiveInt64(initializationParameters.HistoricalEntries); err != nil { + return errorsmod.Wrapf(ErrInvalidConsumerInitializationParameters, "HistoricalEntries: %s", err.Error()) } - return nil -} + if err := ccvtypes.ValidateDuration(initializationParameters.CcvTimeoutPeriod); err != nil { + return errorsmod.Wrapf(ErrInvalidConsumerInitializationParameters, "CcvTimeoutPeriod: %s", err.Error()) + } -func (msg *MsgChangeRewardDenoms) ValidateBasic() error { - emptyDenomsToAdd := len(msg.DenomsToAdd) == 0 - emptyDenomsToRemove := len(msg.DenomsToRemove) == 0 - // Return error if both sets are empty or nil - if emptyDenomsToAdd && emptyDenomsToRemove { - return fmt.Errorf( - "invalid change reward denoms proposal: both denoms to add and denoms to remove are empty") + if err := ccvtypes.ValidateDuration(initializationParameters.TransferTimeoutPeriod); err != nil { + return errorsmod.Wrapf(ErrInvalidConsumerInitializationParameters, "TransferTimeoutPeriod: %s", err.Error()) } - // Return error if a denom is in both sets - for _, denomToAdd := range msg.DenomsToAdd { - for _, denomToRemove := range msg.DenomsToRemove { - if denomToAdd == denomToRemove { - return fmt.Errorf( - "invalid change reward denoms proposal: %s cannot be both added and removed", denomToAdd) - } - } + if err := ccvtypes.ValidateDuration(initializationParameters.UnbondingPeriod); err != nil { + return errorsmod.Wrapf(ErrInvalidConsumerInitializationParameters, "UnbondingPeriod: %s", err.Error()) } - // Return error if any denom is "invalid" - for _, denom := range msg.DenomsToAdd { - if !sdk.NewCoin(denom, math.NewInt(1)).IsValid() { - return fmt.Errorf("invalid change reward denoms proposal: %s is not a valid denom", denom) - } + return nil +} + +func ValidateByteSlice(hash []byte, maxLength int) error { + if len(hash) > maxLength { + return fmt.Errorf("hash is too long; got: %d, max: %d", len(hash), MaxHashLength) } - for _, denom := range msg.DenomsToRemove { - if !sdk.NewCoin(denom, math.NewInt(1)).IsValid() { - return fmt.Errorf("invalid change reward denoms proposal: %s is not a valid denom", denom) - } + return nil +} + +func validateDeprecatedChainId(chainId string) error { + if strings.TrimSpace(chainId) != "" { + return fmt.Errorf("found non-empty chainId(%s); chainId is deprecated, use consumerId instead", chainId) } return nil } -func (msg MsgSetConsumerCommissionRate) GetSigners() []sdk.AccAddress { - valAddr, err := sdk.ValAddressFromBech32(msg.ProviderAddr) +// validateProviderAddress validates that the address is a sdk.ValAddress in Bech32 string format +func validateProviderAddress(addr, signer string) error { + valAddr, err := sdk.ValAddressFromBech32(addr) if err != nil { - // same behavior as in cosmos-sdk - panic(err) + return fmt.Errorf("invalid ValAddress (%s)", addr) + } + + // Check that the provider validator address and the signer address are the same + accAddr := sdk.AccAddress(valAddr.Bytes()).String() + if accAddr != signer { + return fmt.Errorf("ValAddress converted to AccAddress (%s) must match the signer address (%s)", accAddr, signer) } - return []sdk.AccAddress{valAddr.Bytes()} -} -func (msg MsgSetConsumerCommissionRate) GetSignBytes() []byte { - bz := ccvtypes.ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) + return nil } diff --git a/x/ccv/provider/types/msg_test.go b/x/ccv/provider/types/msg_test.go index 4ef2a7efc8..c05a628ac4 100644 --- a/x/ccv/provider/types/msg_test.go +++ b/x/ccv/provider/types/msg_test.go @@ -2,13 +2,443 @@ package types_test import ( "testing" + "time" sdk "github.com/cosmos/cosmos-sdk/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" cryptoutil "github.com/cosmos/interchain-security/v5/testutil/crypto" "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" "github.com/stretchr/testify/require" ) +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 +} + +func TestValidateStringField(t *testing.T) { + testCases := []struct { + name string + field string + maxLength int + valid bool + }{ + { + name: "invalid: empty", + field: "", + maxLength: 5, + valid: false, + }, + { + name: "invalid: too long", + field: "this field is too long", + maxLength: 5, + valid: false, + }, + { + name: "valid", + field: "valid", + maxLength: 5, + valid: true, + }, + } + + for _, tc := range testCases { + err := types.ValidateStringField(tc.name, tc.field, tc.maxLength) + if tc.valid { + require.NoError(t, err, tc.name) + } else { + require.Error(t, err, tc.name) + } + } +} + +func TestTruncateString(t *testing.T) { + testCases := []struct { + str string + maxLength int + expStr string + }{ + {"drink", 3, "dri"}, + {"drink", 6, "drink"}, + {"drink", 0, ""}, + {"drink", -1, ""}, + {"drink", 100, "drink"}, + {"pub", 100, "pub"}, + {"こんにちは", 3, "こんに"}, + } + + for _, tc := range testCases { + truncated := types.TruncateString(tc.str, tc.maxLength) + require.Equal(t, tc.expStr, truncated) + } +} + +func TestValidateInitializationParameters(t *testing.T) { + now := time.Now().UTC() + coolStr := "Cosmos Hub is the best place to launch a chain. Interchain Security is awesome." + tooLongHash := []byte(coolStr) + + testCases := []struct { + name string + params types.ConsumerInitializationParameters + valid bool + }{ + { + name: "valid", + params: types.ConsumerInitializationParameters{ + InitialHeight: clienttypes.NewHeight(3, 4), + GenesisHash: []byte{0x01}, + BinaryHash: []byte{0x01}, + SpawnTime: now, + UnbondingPeriod: time.Duration(100000000000), + CcvTimeoutPeriod: time.Duration(100000000000), + TransferTimeoutPeriod: time.Duration(100000000000), + ConsumerRedistributionFraction: "0.75", + BlocksPerDistributionTransmission: 10, + HistoricalEntries: 10000, + DistributionTransmissionChannel: "", + }, + valid: true, + }, + { + name: "invalid - zero height", + params: types.ConsumerInitializationParameters{ + InitialHeight: clienttypes.ZeroHeight(), + GenesisHash: []byte{0x01}, + BinaryHash: []byte{0x01}, + SpawnTime: now, + UnbondingPeriod: time.Duration(100000000000), + CcvTimeoutPeriod: time.Duration(100000000000), + TransferTimeoutPeriod: time.Duration(100000000000), + ConsumerRedistributionFraction: "0.75", + BlocksPerDistributionTransmission: 10, + HistoricalEntries: 10000, + DistributionTransmissionChannel: "", + }, + valid: false, + }, + { + name: "invalid - hash too long", + params: types.ConsumerInitializationParameters{ + InitialHeight: clienttypes.NewHeight(3, 4), + GenesisHash: tooLongHash, + BinaryHash: []byte{0x01}, + SpawnTime: now, + UnbondingPeriod: time.Duration(100000000000), + CcvTimeoutPeriod: time.Duration(100000000000), + TransferTimeoutPeriod: time.Duration(100000000000), + ConsumerRedistributionFraction: "0.75", + BlocksPerDistributionTransmission: 10, + HistoricalEntries: 10000, + DistributionTransmissionChannel: "", + }, + valid: false, + }, + { + name: "invalid - zero spawn time", + params: types.ConsumerInitializationParameters{ + InitialHeight: clienttypes.NewHeight(3, 4), + GenesisHash: []byte{0x01}, + BinaryHash: []byte{0x01}, + SpawnTime: time.Time{}, + UnbondingPeriod: time.Duration(100000000000), + CcvTimeoutPeriod: time.Duration(100000000000), + TransferTimeoutPeriod: time.Duration(100000000000), + ConsumerRedistributionFraction: "0.75", + BlocksPerDistributionTransmission: 10, + HistoricalEntries: 10000, + DistributionTransmissionChannel: "", + }, + valid: true, + }, + { + name: "invalid - zero duration", + params: types.ConsumerInitializationParameters{ + InitialHeight: clienttypes.NewHeight(3, 4), + GenesisHash: []byte{0x01}, + BinaryHash: []byte{0x01}, + SpawnTime: now, + UnbondingPeriod: 0, + CcvTimeoutPeriod: time.Duration(100000000000), + TransferTimeoutPeriod: time.Duration(100000000000), + ConsumerRedistributionFraction: "0.75", + BlocksPerDistributionTransmission: 10, + HistoricalEntries: 10000, + DistributionTransmissionChannel: "", + }, + valid: false, + }, + { + name: "invalid -- ConsumerRedistributionFraction > 1", + params: types.ConsumerInitializationParameters{ + InitialHeight: clienttypes.NewHeight(3, 4), + GenesisHash: []byte{0x01}, + BinaryHash: []byte{0x01}, + SpawnTime: now, + UnbondingPeriod: time.Duration(100000000000), + CcvTimeoutPeriod: time.Duration(100000000000), + TransferTimeoutPeriod: time.Duration(100000000000), + ConsumerRedistributionFraction: "1.75", + BlocksPerDistributionTransmission: 10, + HistoricalEntries: 10000, + DistributionTransmissionChannel: "", + }, + valid: false, + }, + { + name: "invalid -- ConsumerRedistributionFraction wrong format", + params: types.ConsumerInitializationParameters{ + InitialHeight: clienttypes.NewHeight(3, 4), + GenesisHash: []byte{0x01}, + BinaryHash: []byte{0x01}, + SpawnTime: now, + UnbondingPeriod: time.Duration(100000000000), + CcvTimeoutPeriod: time.Duration(100000000000), + TransferTimeoutPeriod: time.Duration(100000000000), + ConsumerRedistributionFraction: coolStr, + BlocksPerDistributionTransmission: 10, + HistoricalEntries: 10000, + DistributionTransmissionChannel: "", + }, + valid: false, + }, + { + name: "invalid - BlocksPerDistributionTransmission zero", + params: types.ConsumerInitializationParameters{ + InitialHeight: clienttypes.NewHeight(3, 4), + GenesisHash: []byte{0x01}, + BinaryHash: []byte{0x01}, + SpawnTime: now, + UnbondingPeriod: time.Duration(100000000000), + CcvTimeoutPeriod: time.Duration(100000000000), + TransferTimeoutPeriod: time.Duration(100000000000), + ConsumerRedistributionFraction: "0.75", + BlocksPerDistributionTransmission: 0, + HistoricalEntries: 10000, + DistributionTransmissionChannel: "", + }, + valid: false, + }, + { + name: "invalid - HistoricalEntries zero", + params: types.ConsumerInitializationParameters{ + InitialHeight: clienttypes.NewHeight(3, 4), + GenesisHash: []byte{0x01}, + BinaryHash: []byte{0x01}, + SpawnTime: now, + UnbondingPeriod: time.Duration(100000000000), + CcvTimeoutPeriod: time.Duration(100000000000), + TransferTimeoutPeriod: time.Duration(100000000000), + ConsumerRedistributionFraction: "0.75", + BlocksPerDistributionTransmission: 10, + HistoricalEntries: 0, + DistributionTransmissionChannel: "", + }, + valid: false, + }, + { + name: "invalid - DistributionTransmissionChannel too long", + params: types.ConsumerInitializationParameters{ + InitialHeight: clienttypes.NewHeight(3, 4), + GenesisHash: []byte{0x01}, + BinaryHash: []byte{0x01}, + SpawnTime: now, + UnbondingPeriod: time.Duration(100000000000), + CcvTimeoutPeriod: time.Duration(100000000000), + TransferTimeoutPeriod: time.Duration(100000000000), + ConsumerRedistributionFraction: "0.75", + BlocksPerDistributionTransmission: 10, + HistoricalEntries: 10000, + DistributionTransmissionChannel: coolStr, + }, + valid: false, + }, + } + + for _, tc := range testCases { + err := types.ValidateInitializationParameters(tc.params) + if tc.valid { + require.NoError(t, err, tc.name) + } else { + require.Error(t, err, tc.name) + } + } +} + +func TestValidateConsAddressList(t *testing.T) { + consAddr1 := "cosmosvalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7xw4mceq" + consAddr2 := "cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39" + invalidConsAddr := "cosmosvalcons1nx7n5uh0ztxsynn4sje6ey" + + testCases := []struct { + name string + list []string + maxLength int + valid bool + }{ + { + name: "valid - empty list", + list: []string{}, + maxLength: 10, + valid: true, + }, + { + name: "valid - non-empty list", + list: []string{consAddr1, consAddr2}, + maxLength: 10, + valid: true, + }, + { + name: "invalid - address with wrong format", + list: []string{invalidConsAddr}, + maxLength: 10, + valid: false, + }, + { + name: "invalid - empty address", + list: []string{""}, + maxLength: 10, + valid: false, + }, + { + name: "invalid - list length", + list: []string{consAddr1, consAddr2}, + maxLength: 1, + valid: false, + }, + } + + for _, tc := range testCases { + err := types.ValidateConsAddressList(tc.list, tc.maxLength) + if tc.valid { + require.NoError(t, err, tc.name) + } else { + require.Error(t, err, tc.name) + } + } +} + +func TestValidateByteSlice(t *testing.T) { + testCases := []struct { + name string + slice []byte + maxLength int + valid bool + }{ + { + name: "valid: empty", + slice: []byte{}, + maxLength: 5, + valid: true, + }, + { + name: "invalid: too long", + slice: []byte{0x01, 0x02}, + maxLength: 1, + valid: false, + }, + { + name: "valid", + slice: []byte{0x01, 0x02}, + maxLength: 5, + valid: true, + }, + } + + for _, tc := range testCases { + err := types.ValidateByteSlice(tc.slice, tc.maxLength) + if tc.valid { + require.NoError(t, err, tc.name) + } else { + require.Error(t, err, tc.name) + } + } +} + +func TestMsgUpdateConsumerValidateBasic(t *testing.T) { + consAddr1 := "cosmosvalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7xw4mceq" + consAddr2 := "cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39" + consAddr3 := "cosmosvalcons1muys5jyqk4xd27e208nym85kn0t4zjcfeu63fe" + + testCases := []struct { + name string + powerShapingParameters types.PowerShapingParameters + expPass bool + }{ + { + "success", + types.PowerShapingParameters{ + Top_N: 50, + ValidatorsPowerCap: 100, + ValidatorSetCap: 34, + Allowlist: []string{consAddr1}, + Denylist: nil, + MinStake: 0, + AllowInactiveVals: false, + }, + true, + }, + { + "top N is invalid", + types.PowerShapingParameters{ + Top_N: 10, + ValidatorsPowerCap: 0, + ValidatorSetCap: 0, + Allowlist: nil, + Denylist: nil, + }, + false, + }, + { + "validators power cap is invalid", + types.PowerShapingParameters{ + Top_N: 50, + ValidatorsPowerCap: 101, + ValidatorSetCap: 0, + Allowlist: nil, + Denylist: nil, + MinStake: 0, + AllowInactiveVals: false, + }, + false, + }, + { + "valid proposal", + types.PowerShapingParameters{ + Top_N: 54, + ValidatorsPowerCap: 92, + ValidatorSetCap: 0, + Allowlist: []string{consAddr1}, + Denylist: []string{consAddr2, consAddr3}, + MinStake: 0, + AllowInactiveVals: false, + }, + true, + }, + } + + for _, tc := range testCases { + // 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 { + require.Error(t, err, "invalid case: '%s' must return error but got none", tc.name) + } + } +} + func TestMsgAssignConsumerKeyValidateBasic(t *testing.T) { cId1 := cryptoutil.NewCryptoIdentityFromIntSeed(35443543534) cId2 := cryptoutil.NewCryptoIdentityFromIntSeed(65465464564) @@ -26,44 +456,57 @@ func TestMsgAssignConsumerKeyValidateBasic(t *testing.T) { name string chainId string providerAddr string - signer string + submitter string consumerKey string + consumerId string expErr bool }{ { - name: "chain Id empty", - expErr: true, + name: "invalid: chainId non-empty", + chainId: "chainId", + expErr: true, }, { - name: "chain Id too long", - chainId: longChainId, - expErr: true, + name: "invalid: consumerId empty", + consumerId: "", + expErr: true, }, { - name: "invalid provider address", - chainId: "chainId", - expErr: true, + name: "invalid: consumerId is not a number", + consumerId: "consumerId", + expErr: true, + }, + { + name: "invalid: provider address is empty", + consumerId: "1", + expErr: true, + }, + { + name: "invalid: provider address is invalid", + consumerId: "1", + providerAddr: "some address", + expErr: true, }, { - name: "invalid signer address: must be the same as the provider address", - chainId: "chainId", + name: "invalid: provider address != submitter address", + consumerId: "1", providerAddr: valOpAddr1.String(), - signer: acc2, + submitter: acc2, expErr: true, }, { - name: "invalid consumer pubkey", - chainId: "chainId", + name: "invalid: consumer pubkey empty", + consumerId: "1", providerAddr: valOpAddr1.String(), - signer: acc1, + submitter: acc1, expErr: true, }, { - name: "valid assign consumer key msg", - chainId: "chainId", + name: "valid", + consumerId: "1", providerAddr: valOpAddr1.String(), + submitter: acc1, consumerKey: "{\"@type\": \"/cosmos.crypto.ed25519.PubKey\", \"key\": \"e3BehnEIlGUAnJYn9V8gBXuMh4tXO8xxlxyXD1APGyk=\"}", - signer: acc1, expErr: false, }, } @@ -75,14 +518,15 @@ func TestMsgAssignConsumerKeyValidateBasic(t *testing.T) { ChainId: tc.chainId, ConsumerKey: tc.consumerKey, ProviderAddr: tc.providerAddr, - Signer: tc.signer, + Submitter: tc.submitter, + ConsumerId: tc.consumerId, } err := msg.ValidateBasic() if tc.expErr { - require.Error(t, err) + require.Error(t, err, tc.name) } else { - require.NoError(t, err) + require.NoError(t, err, tc.name) } }) } diff --git a/x/ccv/provider/types/provider.pb.go b/x/ccv/provider/types/provider.pb.go index 7c30781221..77d0dc6d98 100644 --- a/x/ccv/provider/types/provider.pb.go +++ b/x/ccv/provider/types/provider.pb.go @@ -37,6 +37,54 @@ var _ = time.Kitchen // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// ConsumerPhase indicates the phases of a consumer chain according to ADR 019 +type ConsumerPhase int32 + +const ( + // UNSPECIFIED defines an empty phase. + CONSUMER_PHASE_UNSPECIFIED ConsumerPhase = 0 + // REGISTERED defines the phase in which a consumer chain has been assigned a unique consumer id. + // A chain in this phase cannot yet launch. + CONSUMER_PHASE_REGISTERED ConsumerPhase = 1 + // INITIALIZED defines 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). + CONSUMER_PHASE_INITIALIZED ConsumerPhase = 2 + // LAUNCHED defines the phase in which a consumer chain is running and consuming a subset of the validator + // set of the provider. + CONSUMER_PHASE_LAUNCHED ConsumerPhase = 3 + // STOPPED defines the phase in which a previously-launched chain has stopped. + CONSUMER_PHASE_STOPPED ConsumerPhase = 4 + // DELETED defines the phase in which the state of a stopped chain has been deleted. + CONSUMER_PHASE_DELETED ConsumerPhase = 5 +) + +var ConsumerPhase_name = map[int32]string{ + 0: "CONSUMER_PHASE_UNSPECIFIED", + 1: "CONSUMER_PHASE_REGISTERED", + 2: "CONSUMER_PHASE_INITIALIZED", + 3: "CONSUMER_PHASE_LAUNCHED", + 4: "CONSUMER_PHASE_STOPPED", + 5: "CONSUMER_PHASE_DELETED", +} + +var ConsumerPhase_value = map[string]int32{ + "CONSUMER_PHASE_UNSPECIFIED": 0, + "CONSUMER_PHASE_REGISTERED": 1, + "CONSUMER_PHASE_INITIALIZED": 2, + "CONSUMER_PHASE_LAUNCHED": 3, + "CONSUMER_PHASE_STOPPED": 4, + "CONSUMER_PHASE_DELETED": 5, +} + +func (x ConsumerPhase) String() string { + return proto.EnumName(ConsumerPhase_name, int32(x)) +} + +func (ConsumerPhase) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_f22ec409a72b7b72, []int{0} +} + +// 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 +199,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 +278,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 +949,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,279 +1423,677 @@ func (m *ConsumerRewardsAllocation) GetRewards() github_com_cosmos_cosmos_sdk_ty return nil } -func init() { - proto.RegisterType((*ConsumerAdditionProposal)(nil), "interchain_security.ccv.provider.v1.ConsumerAdditionProposal") - proto.RegisterType((*ConsumerRemovalProposal)(nil), "interchain_security.ccv.provider.v1.ConsumerRemovalProposal") - proto.RegisterType((*ConsumerModificationProposal)(nil), "interchain_security.ccv.provider.v1.ConsumerModificationProposal") - proto.RegisterType((*EquivocationProposal)(nil), "interchain_security.ccv.provider.v1.EquivocationProposal") - proto.RegisterType((*ChangeRewardDenomsProposal)(nil), "interchain_security.ccv.provider.v1.ChangeRewardDenomsProposal") - proto.RegisterType((*GlobalSlashEntry)(nil), "interchain_security.ccv.provider.v1.GlobalSlashEntry") - proto.RegisterType((*Params)(nil), "interchain_security.ccv.provider.v1.Params") - proto.RegisterType((*SlashAcks)(nil), "interchain_security.ccv.provider.v1.SlashAcks") - proto.RegisterType((*ConsumerAdditionProposals)(nil), "interchain_security.ccv.provider.v1.ConsumerAdditionProposals") - proto.RegisterType((*ConsumerRemovalProposals)(nil), "interchain_security.ccv.provider.v1.ConsumerRemovalProposals") - proto.RegisterType((*AddressList)(nil), "interchain_security.ccv.provider.v1.AddressList") - proto.RegisterType((*ChannelToChain)(nil), "interchain_security.ccv.provider.v1.ChannelToChain") - proto.RegisterType((*ValidatorSetChangePackets)(nil), "interchain_security.ccv.provider.v1.ValidatorSetChangePackets") - proto.RegisterType((*KeyAssignmentReplacement)(nil), "interchain_security.ccv.provider.v1.KeyAssignmentReplacement") - proto.RegisterType((*ValidatorConsumerPubKey)(nil), "interchain_security.ccv.provider.v1.ValidatorConsumerPubKey") - proto.RegisterType((*ValidatorByConsumerAddr)(nil), "interchain_security.ccv.provider.v1.ValidatorByConsumerAddr") - 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") +// 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 init() { - proto.RegisterFile("interchain_security/ccv/provider/v1/provider.proto", fileDescriptor_f22ec409a72b7b72) +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 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, -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xec, 0x62, 0x21, 0xbc, 0x05, - 0x16, 0xfb, 0x24, 0x20, 0x82, 0x0a, 0x67, 0x80, 0xc4, 0xc0, 0x9c, 0xab, 0x1b, 0xcd, 0x45, 0xbb, - 0x92, 0xc8, 0x1e, 0x23, 0x31, 0x80, 0x35, 0x50, 0xe9, 0xd1, 0x00, 0xf1, 0x51, 0x8c, 0x98, 0xd7, - 0x08, 0x10, 0x8b, 0x34, 0xa0, 0x0d, 0x80, 0x08, 0xd1, 0x79, 0xe0, 0xa8, 0xd8, 0x30, 0x17, 0x12, - 0x47, 0xe2, 0xb8, 0xb0, 0xd2, 0xb8, 0xb0, 0xba, 0x69, 0xe0, 0xec, 0x97, 0x94, 0x23, 0x9f, 0x7e, - 0x5d, 0x33, 0xec, 0xb2, 0xb6, 0x53, 0x1a, 0xf8, 0x14, 0xac, 0x0e, 0x83, 0x1e, 0x0b, 0x5c, 0x1a, - 0xf4, 0x9d, 0x90, 0x70, 0xca, 0x5c, 0xb3, 0xa4, 0xa9, 0x36, 0x2f, 0x51, 0x1d, 0x24, 0x21, 0x16, - 0x33, 0x7d, 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, 0x71, 0xe1, 0x84, 0xec, 0x9c, - 0x70, 0x07, 0xa3, 0xd0, 0x5c, 0xd5, 0x18, 0x38, 0xd6, 0x75, 0x94, 0xaa, 0x8d, 0x42, 0xf8, 0x36, - 0x58, 0xcb, 0xa4, 0x8e, 0x20, 0x52, 0xc3, 0xd7, 0x34, 0x7c, 0x25, 0x53, 0x1c, 0x13, 0xa9, 0xb0, - 0xdb, 0xa0, 0x8c, 0x3c, 0x8f, 0x9d, 0x7b, 0x54, 0x48, 0x13, 0xd6, 0x0b, 0xcd, 0xb2, 0x3d, 0x16, - 0xc0, 0x2d, 0x50, 0x72, 0x49, 0x30, 0xd2, 0xca, 0x75, 0xad, 0xcc, 0xde, 0xe1, 0x9b, 0xa0, 0xec, - 0xab, 0x1a, 0x2b, 0xd1, 0x19, 0x31, 0x37, 0xea, 0x46, 0xb3, 0x68, 0x97,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59, 0xd3, 0x68, 0xfc, 0xc5, 0x00, 0x5b, 0xaa, 0x1e, 0xf4, 0x89, 0x4d, 0xce, 0x11, 0x77, - 0x0f, 0x48, 0xc0, 0x7c, 0xf1, 0xad, 0xfd, 0x6c, 0x80, 0x25, 0x57, 0x33, 0x39, 0x92, 0x39, 0xc8, - 0x75, 0xb5, 0x9f, 0x1a, 0xa3, 0x84, 0x5d, 0xb6, 0xe7, 0xba, 0xb0, 0x09, 0x56, 0xc7, 0x18, 0xae, - 0xb2, 0x4b, 0x05, 0xbd, 0x82, 0x2d, 0xa7, 0x30, 0x9d, 0x73, 0x53, 0x04, 0xb5, 0x01, 0x56, 0x3f, - 0xf0, 0x58, 0x0f, 0x79, 0xc7, 0x1e, 0x12, 0x03, 0x55, 0x2b, 0x47, 0x2a, 0x99, 0x38, 0x49, 0x9a, - 0x94, 0x76, 0x7f, 0xea, 0x64, 0x52, 0x66, 0xba, 0x6d, 0x3e, 0x04, 0x6b, 0x59, 0xdb, 0xc8, 0x82, - 0x5b, 0xef, 0x76, 0x7f, 0xfd, 0xc5, 0x57, 0xb5, 0x95, 0x34, 0x91, 0xda, 0x3a, 0xd0, 0x0f, 0xec, - 0x15, 0x3c, 0x21, 0x70, 0x61, 0x15, 0x54, 0x68, 0x0f, 0x3b, 0x82, 0x3c, 0x73, 0x82, 0xa1, 0xaf, - 0xf3, 0xa2, 0x68, 0x97, 0x69, 0x0f, 0x1f, 0x93, 0x67, 0x4f, 0x87, 0x3e, 0x7c, 0x17, 0xdc, 0x48, - 0x87, 0x49, 0x15, 0x49, 0x8e, 0xb2, 0x57, 0xc7, 0xc5, 0x75, 0xaa, 0x2c, 0xda, 0xeb, 0xa9, 0xf6, - 0x04, 0x79, 0x6a, 0xb1, 0x3d, 0xd7, 0xe5, 0x8d, 0xff, 0xcc, 0x81, 0xf9, 0x0e, 0xe2, 0xc8, 0x17, - 0xb0, 0x0b, 0x56, 0x24, 0xf1, 0x43, 0x0f, 0x49, 0xe2, 0xc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xff, - 0xaf, 0x3f, 0xbe, 0x6d, 0xd8, 0xe9, 0x32, 0xfb, 0x1f, 0x7f, 0xf1, 0xa2, 0x6a, 0x7c, 0xf9, 0xa2, - 0x6a, 0xfc, 0xf3, 0x45, 0xd5, 0xf8, 0xf4, 0x65, 0x75, 0xe6, 0xcb, 0x97, 0xd5, 0x99, 0x7f, 0xbc, - 0xac, 0xce, 0x7c, 0xf2, 0xde, 0x65, 0xd2, 0xf1, 0xa5, 0xdd, 0xcb, 0x3e, 0xac, 0x45, 0x3f, 0x6a, - 0x3d, 0x9f, 0xfc, 0x6c, 0xa7, 0xd7, 0xeb, 0xcd, 0xeb, 0x08, 0x79, 0xf7, 0x7f, 0x01, 0x00, 0x00, - 0xff, 0xff, 0x8d, 0xfa, 0x87, 0x04, 0xe7, 0x13, 0x00, 0x00, +var xxx_messageInfo_ConsumerMetadata proto.InternalMessageInfo + +func (m *ConsumerMetadata) GetName() string { + if m != nil { + return m.Name + } + return "" } -func (m *ConsumerAdditionProposal) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *ConsumerMetadata) GetDescription() string { + if m != nil { + return m.Description } - return dAtA[:n], nil + return "" } -func (m *ConsumerAdditionProposal) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (m *ConsumerMetadata) GetMetadata() string { + if m != nil { + return m.Metadata + } + return "" } -func (m *ConsumerAdditionProposal) 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 +// 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 } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xa8 - } - if m.MinStake != 0 { - i = encodeVarintProvider(dAtA, i, uint64(m.MinStake)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xa0 + return b[:n], nil } - 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] = 0x1 - i-- - dAtA[i] = 0x9a - } +} +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 } - 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] = 0x1 - i-- - dAtA[i] = 0x92 - } + return types.Height{} +} + +func (m *ConsumerInitializationParameters) GetGenesisHash() []byte { + if m != nil { + return m.GenesisHash } - if m.ValidatorSetCap != 0 { - i = encodeVarintProvider(dAtA, i, uint64(m.ValidatorSetCap)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x88 + return nil +} + +func (m *ConsumerInitializationParameters) GetBinaryHash() []byte { + if m != nil { + return m.BinaryHash } - if m.ValidatorsPowerCap != 0 { - i = encodeVarintProvider(dAtA, i, uint64(m.ValidatorsPowerCap)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x80 + return nil +} + +func (m *ConsumerInitializationParameters) GetSpawnTime() time.Time { + if m != nil { + return m.SpawnTime } - if m.Top_N != 0 { - i = encodeVarintProvider(dAtA, i, uint64(m.Top_N)) - i-- - dAtA[i] = 0x78 + return time.Time{} +} + +func (m *ConsumerInitializationParameters) GetUnbondingPeriod() time.Duration { + if m != nil { + return m.UnbondingPeriod } - 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] = 0x72 + return 0 +} + +func (m *ConsumerInitializationParameters) GetCcvTimeoutPeriod() time.Duration { + if m != nil { + return m.CcvTimeoutPeriod } - if m.HistoricalEntries != 0 { - i = encodeVarintProvider(dAtA, i, uint64(m.HistoricalEntries)) - i-- - dAtA[i] = 0x68 + return 0 +} + +func (m *ConsumerInitializationParameters) GetTransferTimeoutPeriod() time.Duration { + if m != nil { + return m.TransferTimeoutPeriod } - if m.BlocksPerDistributionTransmission != 0 { - i = encodeVarintProvider(dAtA, i, uint64(m.BlocksPerDistributionTransmission)) - i-- - dAtA[i] = 0x60 + return 0 +} + +func (m *ConsumerInitializationParameters) GetConsumerRedistributionFraction() string { + if m != nil { + return m.ConsumerRedistributionFraction } - 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] = 0x5a + return "" +} + +func (m *ConsumerInitializationParameters) GetBlocksPerDistributionTransmission() int64 { + if m != nil { + return m.BlocksPerDistributionTransmission } - n1, err1 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.TransferTimeoutPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.TransferTimeoutPeriod):]) - if err1 != nil { - return 0, err1 + return 0 +} + +func (m *ConsumerInitializationParameters) GetHistoricalEntries() int64 { + if m != nil { + return m.HistoricalEntries } - i -= n1 - i = encodeVarintProvider(dAtA, i, uint64(n1)) - i-- - dAtA[i] = 0x52 - n2, err2 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.CcvTimeoutPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.CcvTimeoutPeriod):]) - if err2 != nil { - return 0, err2 + return 0 +} + +func (m *ConsumerInitializationParameters) GetDistributionTransmissionChannel() string { + if m != nil { + return m.DistributionTransmissionChannel } - i -= n2 - i = encodeVarintProvider(dAtA, i, uint64(n2)) - i-- - dAtA[i] = 0x4a - n3, err3 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.UnbondingPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.UnbondingPeriod):]) + 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.RegisterEnum("interchain_security.ccv.provider.v1.ConsumerPhase", ConsumerPhase_name, ConsumerPhase_value) + proto.RegisterType((*ConsumerAdditionProposal)(nil), "interchain_security.ccv.provider.v1.ConsumerAdditionProposal") + proto.RegisterType((*ConsumerRemovalProposal)(nil), "interchain_security.ccv.provider.v1.ConsumerRemovalProposal") + proto.RegisterType((*ConsumerModificationProposal)(nil), "interchain_security.ccv.provider.v1.ConsumerModificationProposal") + proto.RegisterType((*EquivocationProposal)(nil), "interchain_security.ccv.provider.v1.EquivocationProposal") + proto.RegisterType((*ChangeRewardDenomsProposal)(nil), "interchain_security.ccv.provider.v1.ChangeRewardDenomsProposal") + proto.RegisterType((*GlobalSlashEntry)(nil), "interchain_security.ccv.provider.v1.GlobalSlashEntry") + proto.RegisterType((*Params)(nil), "interchain_security.ccv.provider.v1.Params") + proto.RegisterType((*SlashAcks)(nil), "interchain_security.ccv.provider.v1.SlashAcks") + proto.RegisterType((*ConsumerAdditionProposals)(nil), "interchain_security.ccv.provider.v1.ConsumerAdditionProposals") + proto.RegisterType((*ConsumerRemovalProposals)(nil), "interchain_security.ccv.provider.v1.ConsumerRemovalProposals") + proto.RegisterType((*AddressList)(nil), "interchain_security.ccv.provider.v1.AddressList") + proto.RegisterType((*ChannelToChain)(nil), "interchain_security.ccv.provider.v1.ChannelToChain") + proto.RegisterType((*ValidatorSetChangePackets)(nil), "interchain_security.ccv.provider.v1.ValidatorSetChangePackets") + proto.RegisterType((*KeyAssignmentReplacement)(nil), "interchain_security.ccv.provider.v1.KeyAssignmentReplacement") + proto.RegisterType((*ValidatorConsumerPubKey)(nil), "interchain_security.ccv.provider.v1.ValidatorConsumerPubKey") + proto.RegisterType((*ValidatorByConsumerAddr)(nil), "interchain_security.ccv.provider.v1.ValidatorByConsumerAddr") + 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() { + proto.RegisterFile("interchain_security/ccv/provider/v1/provider.proto", fileDescriptor_f22ec409a72b7b72) +} + +var fileDescriptor_f22ec409a72b7b72 = []byte{ + // 2238 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x59, 0xbd, 0x6f, 0x1b, 0xc9, + 0x15, 0xd7, 0x8a, 0x94, 0x44, 0x3e, 0xea, 0x83, 0x1a, 0xfb, 0x6c, 0x4a, 0xa7, 0xa3, 0x68, 0x5e, + 0x6c, 0x28, 0x76, 0x4c, 0x9e, 0x74, 0x08, 0x60, 0x38, 0x39, 0x18, 0x32, 0x49, 0xdb, 0xf4, 0x87, + 0xcc, 0x2c, 0x69, 0x1d, 0xe0, 0x14, 0x8b, 0xe1, 0xee, 0x88, 0x9c, 0x68, 0x77, 0x67, 0xbd, 0x33, + 0xa4, 0xcd, 0x14, 0xa9, 0x0f, 0x01, 0x02, 0x5c, 0x52, 0x1d, 0xd2, 0xe4, 0x80, 0x34, 0x41, 0xaa, + 0x14, 0x41, 0xfe, 0x80, 0x54, 0x97, 0x00, 0x41, 0xae, 0x4c, 0x75, 0x17, 0xd8, 0x45, 0x8a, 0x00, + 0x69, 0xd3, 0x06, 0x33, 0xfb, 0xc1, 0xa5, 0x3e, 0x6c, 0x1a, 0xb6, 0xd3, 0x48, 0x3b, 0xef, 0xfd, + 0xde, 0x9b, 0x37, 0x33, 0xef, 0x6b, 0x86, 0xb0, 0x43, 0x5d, 0x41, 0x7c, 0xb3, 0x8f, 0xa9, 0x6b, + 0x70, 0x62, 0x0e, 0x7c, 0x2a, 0x46, 0x55, 0xd3, 0x1c, 0x56, 0x3d, 0x9f, 0x0d, 0xa9, 0x45, 0xfc, + 0xea, 0x70, 0x3b, 0xfe, 0xae, 0x78, 0x3e, 0x13, 0x0c, 0x7d, 0x78, 0x82, 0x4c, 0xc5, 0x34, 0x87, + 0x95, 0x18, 0x37, 0xdc, 0x5e, 0xbf, 0x78, 0x9a, 0xe2, 0xe1, 0x76, 0xf5, 0x29, 0xf5, 0x49, 0xa0, + 0x6b, 0xfd, 0x6c, 0x8f, 0xf5, 0x98, 0xfa, 0xac, 0xca, 0xaf, 0x90, 0xba, 0xd9, 0x63, 0xac, 0x67, + 0x93, 0xaa, 0x1a, 0x75, 0x07, 0x07, 0x55, 0x41, 0x1d, 0xc2, 0x05, 0x76, 0xbc, 0x10, 0x50, 0x3c, + 0x0a, 0xb0, 0x06, 0x3e, 0x16, 0x94, 0xb9, 0x91, 0x02, 0xda, 0x35, 0xab, 0x26, 0xf3, 0x49, 0xd5, + 0xb4, 0x29, 0x71, 0x85, 0x9c, 0x35, 0xf8, 0x0a, 0x01, 0x55, 0x09, 0xb0, 0x69, 0xaf, 0x2f, 0x02, + 0x32, 0xaf, 0x0a, 0xe2, 0x5a, 0xc4, 0x77, 0x68, 0x00, 0x1e, 0x8f, 0x42, 0x81, 0x8d, 0x04, 0xdf, + 0xf4, 0x47, 0x9e, 0x60, 0xd5, 0x43, 0x32, 0xe2, 0x21, 0xf7, 0x92, 0xc9, 0xb8, 0xc3, 0x78, 0x95, + 0xc8, 0xf5, 0xbb, 0x26, 0xa9, 0x0e, 0xb7, 0xbb, 0x44, 0xe0, 0xed, 0x98, 0x10, 0xd9, 0x1d, 0xe2, + 0xba, 0x98, 0x8f, 0x31, 0x26, 0xa3, 0x91, 0xdd, 0x6b, 0x01, 0xdf, 0x08, 0x76, 0x24, 0x18, 0x84, + 0xac, 0x55, 0xec, 0x50, 0x97, 0x55, 0xd5, 0xdf, 0x80, 0x54, 0xfe, 0x6f, 0x06, 0x0a, 0x35, 0xe6, + 0xf2, 0x81, 0x43, 0xfc, 0x5d, 0xcb, 0xa2, 0x72, 0x03, 0x5a, 0x3e, 0xf3, 0x18, 0xc7, 0x36, 0x3a, + 0x0b, 0x73, 0x82, 0x0a, 0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x62, 0xe7, 0x56, 0xab, 0xbd, + 0x79, 0xe6, 0xf9, 0x37, 0x9b, 0x2b, 0x51, 0x20, 0xd5, 0x94, 0xa3, 0xd7, 0xf5, 0x15, 0x73, 0x82, + 0x60, 0xa1, 0x22, 0xe4, 0x68, 0xd7, 0x34, 0x38, 0x79, 0x62, 0xb8, 0x03, 0x47, 0xc5, 0x45, 0x5a, + 0xcf, 0xd2, 0xae, 0xd9, 0x26, 0x4f, 0xf6, 0x06, 0x0e, 0xfa, 0x18, 0xce, 0x45, 0xcd, 0xa4, 0xf4, + 0x24, 0x43, 0xca, 0xcb, 0xed, 0xf2, 0x55, 0xa8, 0x2c, 0xea, 0x67, 0x22, 0xee, 0x3e, 0xb6, 0xe5, + 0x64, 0xbb, 0x96, 0xe5, 0x97, 0xff, 0x33, 0x07, 0xf3, 0x2d, 0xec, 0x63, 0x87, 0xa3, 0x0e, 0xac, + 0x08, 0xe2, 0x78, 0x36, 0x16, 0xc4, 0x08, 0x5a, 0x92, 0x70, 0xa5, 0x57, 0x54, 0xab, 0x92, 0x6c, + 0xfc, 0x2a, 0x89, 0x56, 0x6f, 0xb8, 0x5d, 0xa9, 0x29, 0x6a, 0x5b, 0x60, 0x41, 0xf4, 0xe5, 0x48, + 0x47, 0x40, 0x44, 0xd7, 0xa0, 0x20, 0xfc, 0x01, 0x17, 0xe3, 0x66, 0x61, 0x5c, 0x25, 0x83, 0xb3, + 0x3e, 0x17, 0xf1, 0x83, 0xfa, 0x1a, 0x57, 0xc7, 0x93, 0xfb, 0x82, 0xd4, 0x9b, 0xf4, 0x05, 0x16, + 0x6c, 0x70, 0x79, 0xa8, 0x86, 0x43, 0x84, 0xaa, 0xde, 0x9e, 0x4d, 0x5c, 0xca, 0xfb, 0x91, 0xf2, + 0xf9, 0xe9, 0x95, 0xaf, 0x29, 0x45, 0x0f, 0xa4, 0x1e, 0x3d, 0x52, 0x13, 0xce, 0x52, 0x83, 0xe2, + 0xc9, 0xb3, 0xc4, 0x0b,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 0xf5, 0xe4, 0x76, 0x36, 0x92, 0x09, 0x31, 0xb8, 0xe9, 0x56, 0x5a, 0x83, 0xae, 0x4d, 0xcd, + 0x7b, 0x64, 0xa4, 0x67, 0x24, 0xbe, 0x76, 0x8f, 0x8c, 0x64, 0x05, 0x54, 0xcd, 0x89, 0xca, 0x62, + 0x29, 0x3d, 0x18, 0x94, 0x7f, 0xad, 0xc1, 0xf9, 0x78, 0x01, 0xd1, 0x59, 0xb5, 0x06, 0x5d, 0x29, + 0x91, 0xdc, 0x3b, 0x6d, 0xb2, 0x13, 0x3a, 0x66, 0xed, 0xec, 0x09, 0xd6, 0xde, 0x80, 0xc5, 0x38, + 0x8d, 0x48, 0x7b, 0x53, 0x53, 0xd8, 0x9b, 0x8b, 0x24, 0xee, 0x91, 0x51, 0xf9, 0x67, 0x09, 0xdb, + 0x6e, 0x8e, 0x12, 0xee, 0xeb, 0xbf, 0xc2, 0xb6, 0x78, 0xda, 0xa4, 0x6d, 0x66, 0x52, 0xfe, 0xd8, + 0x02, 0x52, 0xc7, 0x17, 0x50, 0xfe, 0x9b, 0x06, 0xe7, 0x92, 0xb3, 0xf2, 0x0e, 0x6b, 0xf9, 0x03, + 0x97, 0xec, 0xef, 0xbc, 0x6c, 0xfe, 0x1b, 0x90, 0xf1, 0x24, 0xca, 0x10, 0x3c, 0x3c, 0xa2, 0xe9, + 0xca, 0xf5, 0x82, 0x92, 0xea, 0xc8, 0xf0, 0x5e, 0x9e, 0x58, 0x00, 0x0f, 0x77, 0xee, 0xa3, 0xa9, + 0x02, 0x2e, 0x11, 0x4c, 0xfa, 0x52, 0x72, 0xcd, 0xbc, 0xfc, 0x27, 0x0d, 0xd0, 0xf1, 0x4c, 0x85, + 0xbe, 0x07, 0x68, 0x22, 0xdf, 0x25, 0xfd, 0x2f, 0xef, 0x25, 0x32, 0x9c, 0xda, 0xb9, 0xd8, 0x8f, + 0x66, 0x13, 0x7e, 0x84, 0x7e, 0x00, 0xe0, 0xa9, 0x43, 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a, + 0x8d, 0x7a, 0x7e, 0x6e, 0x3d, 0xfd, 0xd9, 0x6f, 0x8b, 0x33, 0x37, 0x3f, 0xfd, 0xea, 0x79, 0x51, + 0xfb, 0xfa, 0x79, 0x51, 0xfb, 0xe7, 0xf3, 0xa2, 0xf6, 0xf9, 0x8b, 0xe2, 0xcc, 0xd7, 0x2f, 0x8a, + 0x33, 0xff, 0x78, 0x51, 0x9c, 0x79, 0xfc, 0xc9, 0xf1, 0x4c, 0x3e, 0xae, 0x94, 0x57, 0xe3, 0x5f, + 0x33, 0x86, 0xdf, 0xaf, 0x3e, 0x9b, 0xfc, 0xad, 0x44, 0x25, 0xf9, 0xee, 0xbc, 0x0a, 0xd2, 0x8f, + 0xff, 0x17, 0x00, 0x00, 0xff, 0xff, 0x79, 0x8b, 0xb8, 0x2d, 0x5c, 0x19, 0x00, 0x00, +} + +func (m *ConsumerAdditionProposal) 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 *ConsumerAdditionProposal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ConsumerAdditionProposal) 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] = 0x1 + i-- + dAtA[i] = 0xa8 + } + if m.MinStake != 0 { + i = encodeVarintProvider(dAtA, i, uint64(m.MinStake)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xa0 + } + 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] = 0x1 + i-- + dAtA[i] = 0x9a + } + } + 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] = 0x1 + i-- + dAtA[i] = 0x92 + } + } + if m.ValidatorSetCap != 0 { + i = encodeVarintProvider(dAtA, i, uint64(m.ValidatorSetCap)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x88 + } + if m.ValidatorsPowerCap != 0 { + i = encodeVarintProvider(dAtA, i, uint64(m.ValidatorsPowerCap)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x80 + } + if m.Top_N != 0 { + i = encodeVarintProvider(dAtA, i, uint64(m.Top_N)) + i-- + dAtA[i] = 0x78 + } + 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] = 0x72 + } + if m.HistoricalEntries != 0 { + i = encodeVarintProvider(dAtA, i, uint64(m.HistoricalEntries)) + i-- + dAtA[i] = 0x68 + } + if m.BlocksPerDistributionTransmission != 0 { + i = encodeVarintProvider(dAtA, i, uint64(m.BlocksPerDistributionTransmission)) + i-- + dAtA[i] = 0x60 + } + 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] = 0x5a + } + n1, err1 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.TransferTimeoutPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.TransferTimeoutPeriod):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintProvider(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x52 + n2, err2 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.CcvTimeoutPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.CcvTimeoutPeriod):]) + if err2 != nil { + return 0, err2 + } + i -= n2 + i = encodeVarintProvider(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0x4a + n3, err3 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.UnbondingPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.UnbondingPeriod):]) if err3 != nil { return 0, err3 } @@ -2589,7 +3038,257 @@ func (m *ConsumerRewardsAllocation) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } -func encodeVarintProvider(dAtA []byte, offset int, v uint64) int { +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 { @@ -3072,46 +3771,159 @@ 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) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) - } - var stringLen uint64 + +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: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) + } + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowProvider @@ -6368,6 +7180,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 10a78b00c7..fa0c569918 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,7 @@ 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"` + ConsumerId string `protobuf:"bytes,1,opt,name=consumer_id,json=consumerId,proto3" json:"consumer_id,omitempty"` } func (m *QueryConsumerGenesisRequest) Reset() { *m = QueryConsumerGenesisRequest{} } @@ -74,9 +75,9 @@ func (m *QueryConsumerGenesisRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryConsumerGenesisRequest proto.InternalMessageInfo -func (m *QueryConsumerGenesisRequest) GetChainId() string { +func (m *QueryConsumerGenesisRequest) GetConsumerId() string { if m != nil { - return m.ChainId + return m.ConsumerId } return "" } @@ -126,6 +127,12 @@ func (m *QueryConsumerGenesisResponse) GetGenesisState() types.ConsumerGenesisSt } type QueryConsumerChainsRequest struct { + // The phase of the consumer chains returned (optional) + // Registered=1|Initialized=2|Launched=3|Stopped=4|Deleted=5 + 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,2,opt,name=limit,proto3" json:"limit,omitempty"` } func (m *QueryConsumerChainsRequest) Reset() { *m = QueryConsumerChainsRequest{} } @@ -161,6 +168,20 @@ func (m *QueryConsumerChainsRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryConsumerChainsRequest proto.InternalMessageInfo +func (m *QueryConsumerChainsRequest) GetPhase() ConsumerPhase { + if m != nil { + return m.Phase + } + return CONSUMER_PHASE_UNSPECIFIED +} + +func (m *QueryConsumerChainsRequest) GetLimit() int32 { + if m != nil { + return m.Limit + } + return 0 +} + type QueryConsumerChainsResponse struct { Chains []*Chain `protobuf:"bytes,1,rep,name=chains,proto3" json:"chains,omitempty"` } @@ -205,179 +226,10 @@ func (m *QueryConsumerChainsResponse) GetChains() []*Chain { return nil } -type QueryConsumerChainStartProposalsRequest struct { -} - -func (m *QueryConsumerChainStartProposalsRequest) Reset() { - *m = QueryConsumerChainStartProposalsRequest{} -} -func (m *QueryConsumerChainStartProposalsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryConsumerChainStartProposalsRequest) ProtoMessage() {} -func (*QueryConsumerChainStartProposalsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_422512d7b7586cd7, []int{4} -} -func (m *QueryConsumerChainStartProposalsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryConsumerChainStartProposalsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryConsumerChainStartProposalsRequest.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 *QueryConsumerChainStartProposalsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryConsumerChainStartProposalsRequest.Merge(m, src) -} -func (m *QueryConsumerChainStartProposalsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryConsumerChainStartProposalsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryConsumerChainStartProposalsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryConsumerChainStartProposalsRequest proto.InternalMessageInfo - -type QueryConsumerChainStartProposalsResponse struct { - Proposals *ConsumerAdditionProposals `protobuf:"bytes,1,opt,name=proposals,proto3" json:"proposals,omitempty"` -} - -func (m *QueryConsumerChainStartProposalsResponse) Reset() { - *m = QueryConsumerChainStartProposalsResponse{} -} -func (m *QueryConsumerChainStartProposalsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryConsumerChainStartProposalsResponse) ProtoMessage() {} -func (*QueryConsumerChainStartProposalsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_422512d7b7586cd7, []int{5} -} -func (m *QueryConsumerChainStartProposalsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryConsumerChainStartProposalsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryConsumerChainStartProposalsResponse.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 *QueryConsumerChainStartProposalsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryConsumerChainStartProposalsResponse.Merge(m, src) -} -func (m *QueryConsumerChainStartProposalsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryConsumerChainStartProposalsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryConsumerChainStartProposalsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryConsumerChainStartProposalsResponse proto.InternalMessageInfo - -func (m *QueryConsumerChainStartProposalsResponse) GetProposals() *ConsumerAdditionProposals { - if m != nil { - return m.Proposals - } - return nil -} - -type QueryConsumerChainStopProposalsRequest struct { -} - -func (m *QueryConsumerChainStopProposalsRequest) Reset() { - *m = QueryConsumerChainStopProposalsRequest{} -} -func (m *QueryConsumerChainStopProposalsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryConsumerChainStopProposalsRequest) ProtoMessage() {} -func (*QueryConsumerChainStopProposalsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_422512d7b7586cd7, []int{6} -} -func (m *QueryConsumerChainStopProposalsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryConsumerChainStopProposalsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryConsumerChainStopProposalsRequest.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 *QueryConsumerChainStopProposalsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryConsumerChainStopProposalsRequest.Merge(m, src) -} -func (m *QueryConsumerChainStopProposalsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryConsumerChainStopProposalsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryConsumerChainStopProposalsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryConsumerChainStopProposalsRequest proto.InternalMessageInfo - -type QueryConsumerChainStopProposalsResponse struct { - Proposals *ConsumerRemovalProposals `protobuf:"bytes,1,opt,name=proposals,proto3" json:"proposals,omitempty"` -} - -func (m *QueryConsumerChainStopProposalsResponse) Reset() { - *m = QueryConsumerChainStopProposalsResponse{} -} -func (m *QueryConsumerChainStopProposalsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryConsumerChainStopProposalsResponse) ProtoMessage() {} -func (*QueryConsumerChainStopProposalsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_422512d7b7586cd7, []int{7} -} -func (m *QueryConsumerChainStopProposalsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryConsumerChainStopProposalsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryConsumerChainStopProposalsResponse.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 *QueryConsumerChainStopProposalsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryConsumerChainStopProposalsResponse.Merge(m, src) -} -func (m *QueryConsumerChainStopProposalsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryConsumerChainStopProposalsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryConsumerChainStopProposalsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryConsumerChainStopProposalsResponse proto.InternalMessageInfo - -func (m *QueryConsumerChainStopProposalsResponse) GetProposals() *ConsumerRemovalProposals { - if m != nil { - return m.Proposals - } - return nil -} - type Chain struct { ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` ClientId string `protobuf:"bytes,2,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` - // If chain with `chainID` is a Top-N chain, i.e., enforces at least one validator to validate chain `chainID` - Top_N uint32 `protobuf:"varint,3,opt,name=top_N,json=topN,proto3" json:"top_N,omitempty"` + Top_N uint32 `protobuf:"varint,3,opt,name=top_N,json=topN,proto3" json:"top_N,omitempty"` // If the chain is a Top-N chain, this is the minimum power required to be in the top N. // Otherwise, this is -1. MinPowerInTop_N int64 `protobuf:"varint,4,opt,name=min_power_in_top_N,json=minPowerInTopN,proto3" json:"min_power_in_top_N,omitempty"` @@ -391,17 +243,22 @@ 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 + Phase string `protobuf:"bytes,9,opt,name=phase,proto3" json:"phase,omitempty"` + // The metadata of the consumer chain + Metadata ConsumerMetadata `protobuf:"bytes,10,opt,name=metadata,proto3" json:"metadata"` // Corresponds to the minimal amount of (provider chain) stake required to validate on the consumer chain. - MinStake uint64 `protobuf:"varint,9,opt,name=min_stake,json=minStake,proto3" json:"min_stake,omitempty"` + MinStake uint64 `protobuf:"varint,11,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,10,opt,name=allow_inactive_vals,json=allowInactiveVals,proto3" json:"allow_inactive_vals,omitempty"` + AllowInactiveVals bool `protobuf:"varint,12,opt,name=allow_inactive_vals,json=allowInactiveVals,proto3" json:"allow_inactive_vals,omitempty"` + ConsumerId string `protobuf:"bytes,13,opt,name=consumer_id,json=consumerId,proto3" json:"consumer_id,omitempty"` } func (m *Chain) Reset() { *m = Chain{} } func (m *Chain) String() string { return proto.CompactTextString(m) } func (*Chain) ProtoMessage() {} func (*Chain) Descriptor() ([]byte, []int) { - return fileDescriptor_422512d7b7586cd7, []int{8} + return fileDescriptor_422512d7b7586cd7, []int{4} } func (m *Chain) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -486,6 +343,20 @@ func (m *Chain) GetDenylist() []string { return nil } +func (m *Chain) GetPhase() string { + if m != nil { + return m.Phase + } + return "" +} + +func (m *Chain) GetMetadata() ConsumerMetadata { + if m != nil { + return m.Metadata + } + return ConsumerMetadata{} +} + func (m *Chain) GetMinStake() uint64 { if m != nil { return m.MinStake @@ -500,18 +371,25 @@ func (m *Chain) GetAllowInactiveVals() bool { return false } +func (m *Chain) GetConsumerId() string { + if m != nil { + return m.ConsumerId + } + return "" +} + 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"` // 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"` + ProviderAddress string `protobuf:"bytes,1,opt,name=provider_address,json=providerAddress,proto3" json:"provider_address,omitempty" yaml:"address"` + // The id of the consumer chain + ConsumerId string `protobuf:"bytes,2,opt,name=consumer_id,json=consumerId,proto3" json:"consumer_id,omitempty"` } func (m *QueryValidatorConsumerAddrRequest) Reset() { *m = QueryValidatorConsumerAddrRequest{} } func (m *QueryValidatorConsumerAddrRequest) String() string { return proto.CompactTextString(m) } func (*QueryValidatorConsumerAddrRequest) ProtoMessage() {} func (*QueryValidatorConsumerAddrRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_422512d7b7586cd7, []int{9} + return fileDescriptor_422512d7b7586cd7, []int{5} } func (m *QueryValidatorConsumerAddrRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -549,7 +427,7 @@ func (m *QueryValidatorConsumerAddrResponse) Reset() { *m = QueryValidat func (m *QueryValidatorConsumerAddrResponse) String() string { return proto.CompactTextString(m) } func (*QueryValidatorConsumerAddrResponse) ProtoMessage() {} func (*QueryValidatorConsumerAddrResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_422512d7b7586cd7, []int{10} + return fileDescriptor_422512d7b7586cd7, []int{6} } func (m *QueryValidatorConsumerAddrResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -586,17 +464,17 @@ 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"` // 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"` + ConsumerAddress string `protobuf:"bytes,1,opt,name=consumer_address,json=consumerAddress,proto3" json:"consumer_address,omitempty" yaml:"address"` + // The id of the consumer chain + ConsumerId string `protobuf:"bytes,2,opt,name=consumer_id,json=consumerId,proto3" json:"consumer_id,omitempty"` } func (m *QueryValidatorProviderAddrRequest) Reset() { *m = QueryValidatorProviderAddrRequest{} } func (m *QueryValidatorProviderAddrRequest) String() string { return proto.CompactTextString(m) } func (*QueryValidatorProviderAddrRequest) ProtoMessage() {} func (*QueryValidatorProviderAddrRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_422512d7b7586cd7, []int{11} + return fileDescriptor_422512d7b7586cd7, []int{7} } func (m *QueryValidatorProviderAddrRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -634,7 +512,7 @@ func (m *QueryValidatorProviderAddrResponse) Reset() { *m = QueryValidat func (m *QueryValidatorProviderAddrResponse) String() string { return proto.CompactTextString(m) } func (*QueryValidatorProviderAddrResponse) ProtoMessage() {} func (*QueryValidatorProviderAddrResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_422512d7b7586cd7, []int{12} + return fileDescriptor_422512d7b7586cd7, []int{8} } func (m *QueryValidatorProviderAddrResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -677,7 +555,7 @@ func (m *QueryThrottleStateRequest) Reset() { *m = QueryThrottleStateReq func (m *QueryThrottleStateRequest) String() string { return proto.CompactTextString(m) } func (*QueryThrottleStateRequest) ProtoMessage() {} func (*QueryThrottleStateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_422512d7b7586cd7, []int{13} + return fileDescriptor_422512d7b7586cd7, []int{9} } func (m *QueryThrottleStateRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -721,7 +599,7 @@ func (m *QueryThrottleStateResponse) Reset() { *m = QueryThrottleStateRe func (m *QueryThrottleStateResponse) String() string { return proto.CompactTextString(m) } func (*QueryThrottleStateResponse) ProtoMessage() {} func (*QueryThrottleStateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_422512d7b7586cd7, []int{14} + return fileDescriptor_422512d7b7586cd7, []int{10} } func (m *QueryThrottleStateResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -782,7 +660,7 @@ func (m *QueryRegisteredConsumerRewardDenomsRequest) String() string { } func (*QueryRegisteredConsumerRewardDenomsRequest) ProtoMessage() {} func (*QueryRegisteredConsumerRewardDenomsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_422512d7b7586cd7, []int{15} + return fileDescriptor_422512d7b7586cd7, []int{11} } func (m *QueryRegisteredConsumerRewardDenomsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -823,7 +701,7 @@ func (m *QueryRegisteredConsumerRewardDenomsResponse) String() string { } func (*QueryRegisteredConsumerRewardDenomsResponse) ProtoMessage() {} func (*QueryRegisteredConsumerRewardDenomsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_422512d7b7586cd7, []int{16} + return fileDescriptor_422512d7b7586cd7, []int{12} } func (m *QueryRegisteredConsumerRewardDenomsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -859,159 +737,27 @@ func (m *QueryRegisteredConsumerRewardDenomsResponse) GetDenoms() []string { return nil } -type QueryProposedChainIDsRequest struct { -} - -func (m *QueryProposedChainIDsRequest) Reset() { *m = QueryProposedChainIDsRequest{} } -func (m *QueryProposedChainIDsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryProposedChainIDsRequest) ProtoMessage() {} -func (*QueryProposedChainIDsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_422512d7b7586cd7, []int{17} -} -func (m *QueryProposedChainIDsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryProposedChainIDsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryProposedChainIDsRequest.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 *QueryProposedChainIDsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryProposedChainIDsRequest.Merge(m, src) -} -func (m *QueryProposedChainIDsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryProposedChainIDsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryProposedChainIDsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryProposedChainIDsRequest proto.InternalMessageInfo - -type QueryProposedChainIDsResponse struct { - ProposedChains []ProposedChain `protobuf:"bytes,1,rep,name=proposedChains,proto3" json:"proposedChains"` -} - -func (m *QueryProposedChainIDsResponse) Reset() { *m = QueryProposedChainIDsResponse{} } -func (m *QueryProposedChainIDsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryProposedChainIDsResponse) ProtoMessage() {} -func (*QueryProposedChainIDsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_422512d7b7586cd7, []int{18} -} -func (m *QueryProposedChainIDsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryProposedChainIDsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryProposedChainIDsResponse.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 *QueryProposedChainIDsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryProposedChainIDsResponse.Merge(m, src) -} -func (m *QueryProposedChainIDsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryProposedChainIDsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryProposedChainIDsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryProposedChainIDsResponse proto.InternalMessageInfo - -func (m *QueryProposedChainIDsResponse) GetProposedChains() []ProposedChain { - if m != nil { - return m.ProposedChains - } - return nil -} - -type ProposedChain struct { - ChainID string `protobuf:"bytes,1,opt,name=chainID,proto3" json:"chainID,omitempty"` - ProposalID uint64 `protobuf:"varint,2,opt,name=proposalID,proto3" json:"proposalID,omitempty"` -} - -func (m *ProposedChain) Reset() { *m = ProposedChain{} } -func (m *ProposedChain) String() string { return proto.CompactTextString(m) } -func (*ProposedChain) ProtoMessage() {} -func (*ProposedChain) Descriptor() ([]byte, []int) { - return fileDescriptor_422512d7b7586cd7, []int{19} -} -func (m *ProposedChain) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ProposedChain) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ProposedChain.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 *ProposedChain) XXX_Merge(src proto.Message) { - xxx_messageInfo_ProposedChain.Merge(m, src) -} -func (m *ProposedChain) XXX_Size() int { - return m.Size() -} -func (m *ProposedChain) XXX_DiscardUnknown() { - xxx_messageInfo_ProposedChain.DiscardUnknown(m) -} - -var xxx_messageInfo_ProposedChain proto.InternalMessageInfo - -func (m *ProposedChain) GetChainID() string { - if m != nil { - return m.ChainID - } - return "" -} - -func (m *ProposedChain) GetProposalID() uint64 { - if m != nil { - return m.ProposalID - } - return 0 -} - -type QueryAllPairsValConAddrByConsumerChainIDRequest struct { +type QueryAllPairsValConsAddrByConsumerRequest struct { // 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,1,opt,name=consumer_id,json=consumerId,proto3" json:"consumer_id,omitempty"` } -func (m *QueryAllPairsValConAddrByConsumerChainIDRequest) Reset() { - *m = QueryAllPairsValConAddrByConsumerChainIDRequest{} +func (m *QueryAllPairsValConsAddrByConsumerRequest) Reset() { + *m = QueryAllPairsValConsAddrByConsumerRequest{} } -func (m *QueryAllPairsValConAddrByConsumerChainIDRequest) String() string { +func (m *QueryAllPairsValConsAddrByConsumerRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAllPairsValConAddrByConsumerChainIDRequest) ProtoMessage() {} -func (*QueryAllPairsValConAddrByConsumerChainIDRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_422512d7b7586cd7, []int{20} +func (*QueryAllPairsValConsAddrByConsumerRequest) ProtoMessage() {} +func (*QueryAllPairsValConsAddrByConsumerRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_422512d7b7586cd7, []int{13} } -func (m *QueryAllPairsValConAddrByConsumerChainIDRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryAllPairsValConsAddrByConsumerRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryAllPairsValConAddrByConsumerChainIDRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryAllPairsValConsAddrByConsumerRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryAllPairsValConAddrByConsumerChainIDRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryAllPairsValConsAddrByConsumerRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1021,45 +767,45 @@ func (m *QueryAllPairsValConAddrByConsumerChainIDRequest) XXX_Marshal(b []byte, return b[:n], nil } } -func (m *QueryAllPairsValConAddrByConsumerChainIDRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllPairsValConAddrByConsumerChainIDRequest.Merge(m, src) +func (m *QueryAllPairsValConsAddrByConsumerRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllPairsValConsAddrByConsumerRequest.Merge(m, src) } -func (m *QueryAllPairsValConAddrByConsumerChainIDRequest) XXX_Size() int { +func (m *QueryAllPairsValConsAddrByConsumerRequest) XXX_Size() int { return m.Size() } -func (m *QueryAllPairsValConAddrByConsumerChainIDRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllPairsValConAddrByConsumerChainIDRequest.DiscardUnknown(m) +func (m *QueryAllPairsValConsAddrByConsumerRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllPairsValConsAddrByConsumerRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryAllPairsValConAddrByConsumerChainIDRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryAllPairsValConsAddrByConsumerRequest proto.InternalMessageInfo -func (m *QueryAllPairsValConAddrByConsumerChainIDRequest) GetChainId() string { +func (m *QueryAllPairsValConsAddrByConsumerRequest) GetConsumerId() string { if m != nil { - return m.ChainId + return m.ConsumerId } return "" } -type QueryAllPairsValConAddrByConsumerChainIDResponse struct { +type QueryAllPairsValConsAddrByConsumerResponse struct { PairValConAddr []*PairValConAddrProviderAndConsumer `protobuf:"bytes,1,rep,name=pair_val_con_addr,json=pairValConAddr,proto3" json:"pair_val_con_addr,omitempty"` } -func (m *QueryAllPairsValConAddrByConsumerChainIDResponse) Reset() { - *m = QueryAllPairsValConAddrByConsumerChainIDResponse{} +func (m *QueryAllPairsValConsAddrByConsumerResponse) Reset() { + *m = QueryAllPairsValConsAddrByConsumerResponse{} } -func (m *QueryAllPairsValConAddrByConsumerChainIDResponse) String() string { +func (m *QueryAllPairsValConsAddrByConsumerResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAllPairsValConAddrByConsumerChainIDResponse) ProtoMessage() {} -func (*QueryAllPairsValConAddrByConsumerChainIDResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_422512d7b7586cd7, []int{21} +func (*QueryAllPairsValConsAddrByConsumerResponse) ProtoMessage() {} +func (*QueryAllPairsValConsAddrByConsumerResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_422512d7b7586cd7, []int{14} } -func (m *QueryAllPairsValConAddrByConsumerChainIDResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryAllPairsValConsAddrByConsumerResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryAllPairsValConAddrByConsumerChainIDResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryAllPairsValConsAddrByConsumerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryAllPairsValConAddrByConsumerChainIDResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryAllPairsValConsAddrByConsumerResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1069,19 +815,19 @@ func (m *QueryAllPairsValConAddrByConsumerChainIDResponse) XXX_Marshal(b []byte, return b[:n], nil } } -func (m *QueryAllPairsValConAddrByConsumerChainIDResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllPairsValConAddrByConsumerChainIDResponse.Merge(m, src) +func (m *QueryAllPairsValConsAddrByConsumerResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllPairsValConsAddrByConsumerResponse.Merge(m, src) } -func (m *QueryAllPairsValConAddrByConsumerChainIDResponse) XXX_Size() int { +func (m *QueryAllPairsValConsAddrByConsumerResponse) XXX_Size() int { return m.Size() } -func (m *QueryAllPairsValConAddrByConsumerChainIDResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllPairsValConAddrByConsumerChainIDResponse.DiscardUnknown(m) +func (m *QueryAllPairsValConsAddrByConsumerResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllPairsValConsAddrByConsumerResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryAllPairsValConAddrByConsumerChainIDResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryAllPairsValConsAddrByConsumerResponse proto.InternalMessageInfo -func (m *QueryAllPairsValConAddrByConsumerChainIDResponse) GetPairValConAddr() []*PairValConAddrProviderAndConsumer { +func (m *QueryAllPairsValConsAddrByConsumerResponse) GetPairValConAddr() []*PairValConAddrProviderAndConsumer { if m != nil { return m.PairValConAddr } @@ -1100,7 +846,7 @@ func (m *PairValConAddrProviderAndConsumer) Reset() { *m = PairValConAdd func (m *PairValConAddrProviderAndConsumer) String() string { return proto.CompactTextString(m) } func (*PairValConAddrProviderAndConsumer) ProtoMessage() {} func (*PairValConAddrProviderAndConsumer) Descriptor() ([]byte, []int) { - return fileDescriptor_422512d7b7586cd7, []int{22} + return fileDescriptor_422512d7b7586cd7, []int{15} } func (m *PairValConAddrProviderAndConsumer) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1157,7 +903,7 @@ func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } func (*QueryParamsRequest) ProtoMessage() {} func (*QueryParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_422512d7b7586cd7, []int{23} + return fileDescriptor_422512d7b7586cd7, []int{16} } func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1194,7 +940,7 @@ func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } func (*QueryParamsResponse) ProtoMessage() {} func (*QueryParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_422512d7b7586cd7, []int{24} + return fileDescriptor_422512d7b7586cd7, []int{17} } func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1231,7 +977,7 @@ func (m *QueryParamsResponse) GetParams() Params { } type QueryConsumerChainOptedInValidatorsRequest struct { - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + ConsumerId string `protobuf:"bytes,1,opt,name=consumer_id,json=consumerId,proto3" json:"consumer_id,omitempty"` } func (m *QueryConsumerChainOptedInValidatorsRequest) Reset() { @@ -1242,7 +988,7 @@ func (m *QueryConsumerChainOptedInValidatorsRequest) String() string { } func (*QueryConsumerChainOptedInValidatorsRequest) ProtoMessage() {} func (*QueryConsumerChainOptedInValidatorsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_422512d7b7586cd7, []int{25} + return fileDescriptor_422512d7b7586cd7, []int{18} } func (m *QueryConsumerChainOptedInValidatorsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1271,9 +1017,9 @@ func (m *QueryConsumerChainOptedInValidatorsRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryConsumerChainOptedInValidatorsRequest proto.InternalMessageInfo -func (m *QueryConsumerChainOptedInValidatorsRequest) GetChainId() string { +func (m *QueryConsumerChainOptedInValidatorsRequest) GetConsumerId() string { if m != nil { - return m.ChainId + return m.ConsumerId } return "" } @@ -1291,7 +1037,7 @@ func (m *QueryConsumerChainOptedInValidatorsResponse) String() string { } func (*QueryConsumerChainOptedInValidatorsResponse) ProtoMessage() {} func (*QueryConsumerChainOptedInValidatorsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_422512d7b7586cd7, []int{26} + return fileDescriptor_422512d7b7586cd7, []int{19} } func (m *QueryConsumerChainOptedInValidatorsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1328,14 +1074,14 @@ func (m *QueryConsumerChainOptedInValidatorsResponse) GetValidatorsProviderAddre } type QueryConsumerValidatorsRequest struct { - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + ConsumerId string `protobuf:"bytes,1,opt,name=consumer_id,json=consumerId,proto3" json:"consumer_id,omitempty"` } func (m *QueryConsumerValidatorsRequest) Reset() { *m = QueryConsumerValidatorsRequest{} } func (m *QueryConsumerValidatorsRequest) String() string { return proto.CompactTextString(m) } func (*QueryConsumerValidatorsRequest) ProtoMessage() {} func (*QueryConsumerValidatorsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_422512d7b7586cd7, []int{27} + return fileDescriptor_422512d7b7586cd7, []int{20} } func (m *QueryConsumerValidatorsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1364,9 +1110,9 @@ func (m *QueryConsumerValidatorsRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryConsumerValidatorsRequest proto.InternalMessageInfo -func (m *QueryConsumerValidatorsRequest) GetChainId() string { +func (m *QueryConsumerValidatorsRequest) GetConsumerId() string { if m != nil { - return m.ChainId + return m.ConsumerId } return "" } @@ -1376,17 +1122,37 @@ type QueryConsumerValidatorsValidator struct { 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{} } func (m *QueryConsumerValidatorsValidator) String() string { return proto.CompactTextString(m) } func (*QueryConsumerValidatorsValidator) ProtoMessage() {} func (*QueryConsumerValidatorsValidator) Descriptor() ([]byte, []int) { - return fileDescriptor_422512d7b7586cd7, []int{28} + return fileDescriptor_422512d7b7586cd7, []int{21} } func (m *QueryConsumerValidatorsValidator) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1429,6 +1195,7 @@ func (m *QueryConsumerValidatorsValidator) GetConsumerKey() *crypto.PublicKey { return nil } +// Deprecated: Do not use. func (m *QueryConsumerValidatorsValidator) GetPower() int64 { if m != nil { return m.Power @@ -1436,15 +1203,64 @@ func (m *QueryConsumerValidatorsValidator) GetPower() int64 { return 0 } -type QueryConsumerValidatorsResponse struct { - Validators []*QueryConsumerValidatorsValidator `protobuf:"bytes,1,rep,name=validators,proto3" json:"validators,omitempty"` +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"` } func (m *QueryConsumerValidatorsResponse) Reset() { *m = QueryConsumerValidatorsResponse{} } func (m *QueryConsumerValidatorsResponse) String() string { return proto.CompactTextString(m) } func (*QueryConsumerValidatorsResponse) ProtoMessage() {} func (*QueryConsumerValidatorsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_422512d7b7586cd7, []int{29} + return fileDescriptor_422512d7b7586cd7, []int{22} } func (m *QueryConsumerValidatorsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1493,7 +1309,7 @@ func (m *QueryConsumerChainsValidatorHasToValidateRequest) String() string { } func (*QueryConsumerChainsValidatorHasToValidateRequest) ProtoMessage() {} func (*QueryConsumerChainsValidatorHasToValidateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_422512d7b7586cd7, []int{30} + return fileDescriptor_422512d7b7586cd7, []int{23} } func (m *QueryConsumerChainsValidatorHasToValidateRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1530,7 +1346,7 @@ func (m *QueryConsumerChainsValidatorHasToValidateRequest) GetProviderAddress() } type QueryConsumerChainsValidatorHasToValidateResponse struct { - ConsumerChainIds []string `protobuf:"bytes,1,rep,name=consumer_chain_ids,json=consumerChainIds,proto3" json:"consumer_chain_ids,omitempty"` + ConsumerIds []string `protobuf:"bytes,1,rep,name=consumer_ids,json=consumerIds,proto3" json:"consumer_ids,omitempty"` } func (m *QueryConsumerChainsValidatorHasToValidateResponse) Reset() { @@ -1541,7 +1357,7 @@ func (m *QueryConsumerChainsValidatorHasToValidateResponse) String() string { } func (*QueryConsumerChainsValidatorHasToValidateResponse) ProtoMessage() {} func (*QueryConsumerChainsValidatorHasToValidateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_422512d7b7586cd7, []int{31} + return fileDescriptor_422512d7b7586cd7, []int{24} } func (m *QueryConsumerChainsValidatorHasToValidateResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1570,15 +1386,15 @@ func (m *QueryConsumerChainsValidatorHasToValidateResponse) XXX_DiscardUnknown() var xxx_messageInfo_QueryConsumerChainsValidatorHasToValidateResponse proto.InternalMessageInfo -func (m *QueryConsumerChainsValidatorHasToValidateResponse) GetConsumerChainIds() []string { +func (m *QueryConsumerChainsValidatorHasToValidateResponse) GetConsumerIds() []string { if m != nil { - return m.ConsumerChainIds + return m.ConsumerIds } return nil } type QueryValidatorConsumerCommissionRateRequest struct { - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + ConsumerId string `protobuf:"bytes,1,opt,name=consumer_id,json=consumerId,proto3" json:"consumer_id,omitempty"` // 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"` } @@ -1591,7 +1407,7 @@ func (m *QueryValidatorConsumerCommissionRateRequest) String() string { } func (*QueryValidatorConsumerCommissionRateRequest) ProtoMessage() {} func (*QueryValidatorConsumerCommissionRateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_422512d7b7586cd7, []int{32} + return fileDescriptor_422512d7b7586cd7, []int{25} } func (m *QueryValidatorConsumerCommissionRateRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1620,9 +1436,9 @@ func (m *QueryValidatorConsumerCommissionRateRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryValidatorConsumerCommissionRateRequest proto.InternalMessageInfo -func (m *QueryValidatorConsumerCommissionRateRequest) GetChainId() string { +func (m *QueryValidatorConsumerCommissionRateRequest) GetConsumerId() string { if m != nil { - return m.ChainId + return m.ConsumerId } return "" } @@ -1647,7 +1463,7 @@ func (m *QueryValidatorConsumerCommissionRateResponse) String() string { } func (*QueryValidatorConsumerCommissionRateResponse) ProtoMessage() {} func (*QueryValidatorConsumerCommissionRateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_422512d7b7586cd7, []int{33} + return fileDescriptor_422512d7b7586cd7, []int{26} } func (m *QueryValidatorConsumerCommissionRateResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1683,7 +1499,7 @@ func (m *QueryBlocksUntilNextEpochRequest) Reset() { *m = QueryBlocksUnt func (m *QueryBlocksUntilNextEpochRequest) String() string { return proto.CompactTextString(m) } func (*QueryBlocksUntilNextEpochRequest) ProtoMessage() {} func (*QueryBlocksUntilNextEpochRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_422512d7b7586cd7, []int{34} + return fileDescriptor_422512d7b7586cd7, []int{27} } func (m *QueryBlocksUntilNextEpochRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1721,7 +1537,7 @@ func (m *QueryBlocksUntilNextEpochResponse) Reset() { *m = QueryBlocksUn func (m *QueryBlocksUntilNextEpochResponse) String() string { return proto.CompactTextString(m) } func (*QueryBlocksUntilNextEpochResponse) ProtoMessage() {} func (*QueryBlocksUntilNextEpochResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_422512d7b7586cd7, []int{35} + return fileDescriptor_422512d7b7586cd7, []int{28} } func (m *QueryBlocksUntilNextEpochResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1757,15 +1573,230 @@ 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{29} +} +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{30} +} +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 "" +} + +type QueryConsumerChainRequest struct { + ConsumerId string `protobuf:"bytes,1,opt,name=consumer_id,json=consumerId,proto3" json:"consumer_id,omitempty"` +} + +func (m *QueryConsumerChainRequest) Reset() { *m = QueryConsumerChainRequest{} } +func (m *QueryConsumerChainRequest) String() string { return proto.CompactTextString(m) } +func (*QueryConsumerChainRequest) ProtoMessage() {} +func (*QueryConsumerChainRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_422512d7b7586cd7, []int{31} +} +func (m *QueryConsumerChainRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryConsumerChainRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryConsumerChainRequest.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 *QueryConsumerChainRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryConsumerChainRequest.Merge(m, src) +} +func (m *QueryConsumerChainRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryConsumerChainRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryConsumerChainRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryConsumerChainRequest proto.InternalMessageInfo + +func (m *QueryConsumerChainRequest) GetConsumerId() string { + if m != nil { + return m.ConsumerId + } + return "" +} + +type QueryConsumerChainResponse struct { + ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + OwnerAddress string `protobuf:"bytes,2,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty"` + Phase string `protobuf:"bytes,3,opt,name=phase,proto3" json:"phase,omitempty"` + Metadata ConsumerMetadata `protobuf:"bytes,4,opt,name=metadata,proto3" json:"metadata"` + InitParams *ConsumerInitializationParameters `protobuf:"bytes,5,opt,name=init_params,json=initParams,proto3" json:"init_params,omitempty"` + PowerShapingParams *PowerShapingParameters `protobuf:"bytes,6,opt,name=power_shaping_params,json=powerShapingParams,proto3" json:"power_shaping_params,omitempty"` +} + +func (m *QueryConsumerChainResponse) Reset() { *m = QueryConsumerChainResponse{} } +func (m *QueryConsumerChainResponse) String() string { return proto.CompactTextString(m) } +func (*QueryConsumerChainResponse) ProtoMessage() {} +func (*QueryConsumerChainResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_422512d7b7586cd7, []int{32} +} +func (m *QueryConsumerChainResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryConsumerChainResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryConsumerChainResponse.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 *QueryConsumerChainResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryConsumerChainResponse.Merge(m, src) +} +func (m *QueryConsumerChainResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryConsumerChainResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryConsumerChainResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryConsumerChainResponse proto.InternalMessageInfo + +func (m *QueryConsumerChainResponse) GetChainId() string { + if m != nil { + return m.ChainId + } + return "" +} + +func (m *QueryConsumerChainResponse) GetOwnerAddress() string { + if m != nil { + return m.OwnerAddress + } + return "" +} + +func (m *QueryConsumerChainResponse) GetPhase() string { + if m != nil { + return m.Phase + } + return "" +} + +func (m *QueryConsumerChainResponse) GetMetadata() ConsumerMetadata { + if m != nil { + return m.Metadata + } + return ConsumerMetadata{} +} + +func (m *QueryConsumerChainResponse) GetInitParams() *ConsumerInitializationParameters { + if m != nil { + return m.InitParams + } + return nil +} + +func (m *QueryConsumerChainResponse) GetPowerShapingParams() *PowerShapingParameters { + if m != nil { + return m.PowerShapingParams + } + return nil +} + func init() { proto.RegisterType((*QueryConsumerGenesisRequest)(nil), "interchain_security.ccv.provider.v1.QueryConsumerGenesisRequest") proto.RegisterType((*QueryConsumerGenesisResponse)(nil), "interchain_security.ccv.provider.v1.QueryConsumerGenesisResponse") proto.RegisterType((*QueryConsumerChainsRequest)(nil), "interchain_security.ccv.provider.v1.QueryConsumerChainsRequest") proto.RegisterType((*QueryConsumerChainsResponse)(nil), "interchain_security.ccv.provider.v1.QueryConsumerChainsResponse") - proto.RegisterType((*QueryConsumerChainStartProposalsRequest)(nil), "interchain_security.ccv.provider.v1.QueryConsumerChainStartProposalsRequest") - proto.RegisterType((*QueryConsumerChainStartProposalsResponse)(nil), "interchain_security.ccv.provider.v1.QueryConsumerChainStartProposalsResponse") - proto.RegisterType((*QueryConsumerChainStopProposalsRequest)(nil), "interchain_security.ccv.provider.v1.QueryConsumerChainStopProposalsRequest") - proto.RegisterType((*QueryConsumerChainStopProposalsResponse)(nil), "interchain_security.ccv.provider.v1.QueryConsumerChainStopProposalsResponse") proto.RegisterType((*Chain)(nil), "interchain_security.ccv.provider.v1.Chain") proto.RegisterType((*QueryValidatorConsumerAddrRequest)(nil), "interchain_security.ccv.provider.v1.QueryValidatorConsumerAddrRequest") proto.RegisterType((*QueryValidatorConsumerAddrResponse)(nil), "interchain_security.ccv.provider.v1.QueryValidatorConsumerAddrResponse") @@ -1775,11 +1806,8 @@ func init() { proto.RegisterType((*QueryThrottleStateResponse)(nil), "interchain_security.ccv.provider.v1.QueryThrottleStateResponse") proto.RegisterType((*QueryRegisteredConsumerRewardDenomsRequest)(nil), "interchain_security.ccv.provider.v1.QueryRegisteredConsumerRewardDenomsRequest") proto.RegisterType((*QueryRegisteredConsumerRewardDenomsResponse)(nil), "interchain_security.ccv.provider.v1.QueryRegisteredConsumerRewardDenomsResponse") - proto.RegisterType((*QueryProposedChainIDsRequest)(nil), "interchain_security.ccv.provider.v1.QueryProposedChainIDsRequest") - proto.RegisterType((*QueryProposedChainIDsResponse)(nil), "interchain_security.ccv.provider.v1.QueryProposedChainIDsResponse") - proto.RegisterType((*ProposedChain)(nil), "interchain_security.ccv.provider.v1.ProposedChain") - proto.RegisterType((*QueryAllPairsValConAddrByConsumerChainIDRequest)(nil), "interchain_security.ccv.provider.v1.QueryAllPairsValConAddrByConsumerChainIDRequest") - proto.RegisterType((*QueryAllPairsValConAddrByConsumerChainIDResponse)(nil), "interchain_security.ccv.provider.v1.QueryAllPairsValConAddrByConsumerChainIDResponse") + proto.RegisterType((*QueryAllPairsValConsAddrByConsumerRequest)(nil), "interchain_security.ccv.provider.v1.QueryAllPairsValConsAddrByConsumerRequest") + proto.RegisterType((*QueryAllPairsValConsAddrByConsumerResponse)(nil), "interchain_security.ccv.provider.v1.QueryAllPairsValConsAddrByConsumerResponse") proto.RegisterType((*PairValConAddrProviderAndConsumer)(nil), "interchain_security.ccv.provider.v1.PairValConAddrProviderAndConsumer") proto.RegisterType((*QueryParamsRequest)(nil), "interchain_security.ccv.provider.v1.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "interchain_security.ccv.provider.v1.QueryParamsResponse") @@ -1794,6 +1822,10 @@ 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") + proto.RegisterType((*QueryConsumerChainRequest)(nil), "interchain_security.ccv.provider.v1.QueryConsumerChainRequest") + proto.RegisterType((*QueryConsumerChainResponse)(nil), "interchain_security.ccv.provider.v1.QueryConsumerChainResponse") } func init() { @@ -1801,136 +1833,157 @@ func init() { } var fileDescriptor_422512d7b7586cd7 = []byte{ - // 2049 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x59, 0xcd, 0x6f, 0xdc, 0xc6, - 0x15, 0x17, 0x57, 0x1f, 0x91, 0x46, 0xb1, 0x1d, 0x8f, 0xd5, 0x78, 0x4d, 0x29, 0xbb, 0x0a, 0xdd, - 0x8f, 0xb5, 0xec, 0x92, 0x92, 0x0c, 0x23, 0x8e, 0x5d, 0x47, 0xd6, 0x4a, 0xb2, 0xb3, 0xb0, 0x63, - 0x2b, 0xb4, 0xec, 0x16, 0x6e, 0x51, 0x9a, 0x22, 0xa7, 0x2b, 0x42, 0x5c, 0x0e, 0xc5, 0x19, 0xad, - 0xbd, 0x30, 0x72, 0x48, 0x0f, 0x6d, 0x8e, 0x41, 0x3f, 0xee, 0xb9, 0xf4, 0xd8, 0x1e, 0x7a, 0xe8, - 0xdf, 0x90, 0x5b, 0x53, 0xe4, 0x52, 0xf4, 0xe0, 0x16, 0x72, 0x0b, 0x14, 0x05, 0x5a, 0xb4, 0x46, - 0xaf, 0x05, 0x0a, 0x0e, 0x87, 0x5c, 0x72, 0x97, 0xbb, 0x4b, 0xee, 0x2a, 0xb7, 0xe5, 0xcc, 0x7b, - 0xbf, 0x79, 0xef, 0xcd, 0x9b, 0x37, 0xef, 0x37, 0x0b, 0x14, 0xcb, 0xa1, 0xc8, 0x33, 0xf6, 0x74, - 0xcb, 0xd1, 0x08, 0x32, 0x0e, 0x3d, 0x8b, 0xb6, 0x14, 0xc3, 0x68, 0x2a, 0xae, 0x87, 0x9b, 0x96, - 0x89, 0x3c, 0xa5, 0xb9, 0xa2, 0x1c, 0x1c, 0x22, 0xaf, 0x25, 0xbb, 0x1e, 0xa6, 0x18, 0x9e, 0x4f, - 0x51, 0x90, 0x0d, 0xa3, 0x29, 0x87,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x14, - 0x35, 0x04, 0xd9, 0x08, 0x31, 0xa4, 0x4b, 0x60, 0x89, 0xb9, 0xa4, 0xa2, 0xba, 0x45, 0x28, 0xf2, - 0x90, 0xd9, 0x2e, 0x22, 0x4f, 0x75, 0xcf, 0xdc, 0x44, 0x0e, 0x6e, 0x44, 0x55, 0x6c, 0x0b, 0x5c, - 0xcc, 0x24, 0xcd, 0x23, 0xf2, 0x26, 0x98, 0x32, 0xd9, 0x08, 0xbb, 0x18, 0x66, 0x54, 0xfe, 0x25, - 0x95, 0xf8, 0x55, 0x17, 0x14, 0x28, 0x64, 0xb2, 0x7a, 0x54, 0xdb, 0x8c, 0x96, 0xf9, 0x58, 0x00, - 0x6f, 0xf5, 0x10, 0xe0, 0xc8, 0x4f, 0xc0, 0x49, 0x37, 0x3e, 0x17, 0x5e, 0x3d, 0xab, 0x99, 0xea, - 0x64, 0x02, 0x96, 0xdf, 0x87, 0x1d, 0x78, 0x52, 0x0d, 0x9c, 0x48, 0x88, 0xc1, 0x22, 0xe0, 0xf9, - 0xbb, 0x99, 0x4c, 0xe7, 0x4d, 0x58, 0x02, 0x20, 0xac, 0xaf, 0xb5, 0x4d, 0xb6, 0x99, 0x13, 0x6a, - 0x6c, 0x44, 0xba, 0x0b, 0x14, 0xe6, 0xcd, 0xba, 0x6d, 0x6f, 0xeb, 0x96, 0x47, 0x1e, 0xe9, 0xf6, - 0x06, 0x76, 0xfc, 0x94, 0xab, 0x26, 0xaf, 0x83, 0xda, 0x66, 0x86, 0x3e, 0xe1, 0x57, 0x02, 0x58, - 0xce, 0x0e, 0xc7, 0xe3, 0x75, 0x00, 0x4e, 0xbb, 0xba, 0xe5, 0xf9, 0x35, 0xcb, 0xef, 0x88, 0xd8, - 0x31, 0xe0, 0x21, 0xbb, 0x95, 0x2d, 0x64, 0xba, 0xe5, 0xb5, 0x17, 0x8a, 0x8e, 0x99, 0xd3, 0x4e, - 0x80, 0x93, 0x6e, 0x42, 0x44, 0xfa, 0xaf, 0x00,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xd3, 0x97, 0xa5, 0xb1, 0x2f, 0x5e, 0x96, 0xc6, 0xfe, 0xf8, 0xb2, 0x34, - 0xf6, 0xf8, 0x46, 0xdd, 0xa2, 0x7b, 0x87, 0xbb, 0xb2, 0x81, 0x1b, 0xfc, 0xdf, 0xf1, 0xd8, 0x2a, - 0xdf, 0x8e, 0x56, 0x69, 0x5e, 0x51, 0x9e, 0x75, 0x74, 0x64, 0x2d, 0x17, 0x91, 0xdd, 0x29, 0xf6, - 0x4f, 0xc6, 0xe5, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, 0x7d, 0x81, 0x96, 0x00, 0xbd, 0x20, 0x00, - 0x00, + // 2386 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x5a, 0xcd, 0x73, 0xdb, 0xc6, + 0x15, 0x17, 0xa8, 0x0f, 0x53, 0x2b, 0x4b, 0x8e, 0xd7, 0xb2, 0x4d, 0x53, 0xb6, 0x28, 0xc3, 0xf1, + 0x8c, 0x62, 0xc7, 0x84, 0xa4, 0x8e, 0x9b, 0xc4, 0xa9, 0x3f, 0x44, 0x5a, 0xb2, 0x39, 0x8e, 0x6d, + 0x05, 0x52, 0x9c, 0x19, 0xa7, 0x2e, 0x0a, 0x01, 0x1b, 0x72, 0x2b, 0x10, 0x80, 0xb1, 0x4b, 0xda, + 0xac, 0xea, 0x4b, 0x4f, 0x39, 0xb4, 0x33, 0xc9, 0x74, 0x7a, 0x6e, 0xa6, 0x7f, 0x41, 0xa7, 0x93, + 0xe9, 0xdf, 0x90, 0x5b, 0xd3, 0xf4, 0xd2, 0xe9, 0x4c, 0xdd, 0x8e, 0xdd, 0xce, 0xb4, 0x87, 0x1e, + 0x9a, 0xb6, 0xf7, 0xcc, 0x2e, 0x16, 0x20, 0x01, 0x83, 0x24, 0x20, 0xe9, 0x46, 0xec, 0xbe, 0xf7, + 0x7b, 0x1f, 0xfb, 0xf6,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8, 0x1a, 0xad, 0xe4, 0x0a, 0x92, 0xea, 0x2f, 0xc0, 0x77, + 0xc0, 0x98, 0xc7, 0x72, 0xdc, 0x18, 0xd7, 0xe6, 0x3c, 0x3b, 0xdf, 0x3f, 0x3f, 0x2f, 0xcd, 0xf9, + 0xc5, 0x31, 0x31, 0x77, 0xca, 0xd8, 0x51, 0x9a, 0x3a, 0x6d, 0x94, 0xdf, 0x43, 0x75, 0xdd, 0xe8, + 0xdc, 0x44, 0x46, 0x41, 0x52, 0x39, 0x0b, 0x3c, 0x0f, 0x66, 0x42, 0xad, 0x7c, 0xf4, 0x71, 0x9e, + 0x5f, 0xa7, 0x83, 0x55, 0x5e, 0xf2, 0xc0, 0x47, 0xa0, 0x10, 0x92, 0x19, 0x4e, 0xb3, 0x89, 0x09, + 0xc1, 0x8e, 0xad, 0x71, 0xa9, 0x13, 0x5c, 0xea, 0xb9, 0x14, 0x52, 0xd5, 0x13, 0x01, 0x48, 0x35, + 0xc4, 0x50, 0x99, 0x16, 0x8f, 0x40, 0x21, 0x74, 0x6d, 0x1c, 0xfe, 0x50, 0x06, 0xf8, 0x00, 0x24, + 0x06, 0x7f, 0x07, 0x4c, 0x99, 0x88, 0x18, 0x1e, 0x76, 0x59, 0xe7, 0x54, 0xc8, 0x73, 0xcf, 0x9f, + 0x2b, 0x8b, 0x56, 0x22, 0x68, 0x16, 0x44, 0xf3, 0x50, 0xbe, 0xd9, 0x25, 0x15, 0x77, 0xa5, 0x97, + 0x1b, 0x3e, 0x02, 0xa7, 0x42, 0x5d, 0x1d, 0x17, 0x79, 0xbc, 0x04, 0x0c, 0xe2, 0x81, 0x17, 0x6a, + 0x95, 0xb3, 0x5f, 0x7f, 0x71, 0xe9, 0x8c, 0x40, 0x0f, 0xe3, 0x47, 0xc4, 0xc1, 0x26, 0xf5, 0xb0, + 0x5d, 0x57, 0x4f, 0x06, 0x18, 0xf7, 0x05, 0x44, 0x10, 0x26, 0x27, 0xc0, 0xc4, 0x8f, 0x74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xd6, 0xb9, 0x69, 0x37, 0xe0, + 0xb5, 0xac, 0x09, 0x30, 0x1a, 0xc5, 0x95, 0x0f, 0xbf, 0x7c, 0x31, 0x2f, 0x7d, 0xf5, 0x62, 0x5e, + 0xfa, 0xdb, 0x8b, 0x79, 0xe9, 0xd3, 0x97, 0xf3, 0x23, 0x5f, 0xbd, 0x9c, 0x1f, 0xf9, 0xd3, 0xcb, + 0xf9, 0x91, 0x87, 0x57, 0xeb, 0x98, 0x36, 0x5a, 0xdb, 0x65, 0xc3, 0x69, 0x8a, 0xff, 0x1b, 0xe9, + 0x11, 0x75, 0x29, 0x14, 0xd5, 0xbe, 0xac, 0x3c, 0x8d, 0xd5, 0x9e, 0x1d, 0x17, 0x91, 0xed, 0x09, + 0xfe, 0x47, 0xc2, 0xef, 0x7c, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x64, 0xaa, 0xd9, 0x88, 0xd7, 0x23, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1951,10 +2004,6 @@ type QueryClient interface { // ConsumerChains queries active consumer chains supported by the provider // chain QueryConsumerChains(ctx context.Context, in *QueryConsumerChainsRequest, opts ...grpc.CallOption) (*QueryConsumerChainsResponse, error) - // QueryConsumerChainStarts queries consumer chain start proposals. - QueryConsumerChainStarts(ctx context.Context, in *QueryConsumerChainStartProposalsRequest, opts ...grpc.CallOption) (*QueryConsumerChainStartProposalsResponse, error) - // QueryConsumerChainStops queries consumer chain stop proposals. - QueryConsumerChainStops(ctx context.Context, in *QueryConsumerChainStopProposalsRequest, opts ...grpc.CallOption) (*QueryConsumerChainStopProposalsResponse, error) // QueryValidatorConsumerAddr queries the address // assigned by a validator for a consumer chain. QueryValidatorConsumerAddr(ctx context.Context, in *QueryValidatorConsumerAddrRequest, opts ...grpc.CallOption) (*QueryValidatorConsumerAddrResponse, error) @@ -1967,12 +2016,9 @@ type QueryClient interface { // QueryRegisteredConsumerRewardDenoms returns a list of consumer reward // denoms that are registered QueryRegisteredConsumerRewardDenoms(ctx context.Context, in *QueryRegisteredConsumerRewardDenomsRequest, opts ...grpc.CallOption) (*QueryRegisteredConsumerRewardDenomsResponse, error) - // QueryProposedConsumerChainIDs returns the chain IDs of the proposed consumer chain addition proposals - // that are still in the voting period - QueryProposedConsumerChainIDs(ctx context.Context, in *QueryProposedChainIDsRequest, opts ...grpc.CallOption) (*QueryProposedChainIDsResponse, error) - // QueryAllPairsValConAddrByConsumerChainID returns a list of pair valconsensus address + // QueryAllPairsValConsAddrByConsumer returns a list of pair valconsensus address // between provider and consumer chain - QueryAllPairsValConAddrByConsumerChainID(ctx context.Context, in *QueryAllPairsValConAddrByConsumerChainIDRequest, opts ...grpc.CallOption) (*QueryAllPairsValConAddrByConsumerChainIDResponse, error) + QueryAllPairsValConsAddrByConsumer(ctx context.Context, in *QueryAllPairsValConsAddrByConsumerRequest, opts ...grpc.CallOption) (*QueryAllPairsValConsAddrByConsumerResponse, error) // QueryParams returns all current values of provider parameters QueryParams(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) // QueryConsumerChainOptedInValidators returns a list of validators consensus addresses @@ -1984,13 +2030,19 @@ type QueryClient interface { // QueryValidatorConsumerCommissionRate returns the commission rate a given // validator charges on a given consumer chain QueryValidatorConsumerCommissionRate(ctx context.Context, in *QueryValidatorConsumerCommissionRateRequest, opts ...grpc.CallOption) (*QueryValidatorConsumerCommissionRateResponse, error) - // QueryConsumerValidators returns the latest set consumer-validator set for a given chainID + // QueryConsumerValidators returns the latest set consumer-validator set for a given consumer ID // Note that this does not necessarily mean that the consumer chain is using this validator set at this exact moment // because a VSCPacket could be delayed to be delivered on the consumer chain. QueryConsumerValidators(ctx context.Context, in *QueryConsumerValidatorsRequest, opts ...grpc.CallOption) (*QueryConsumerValidatorsResponse, error) // 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) + // QueryConsumerChain returns the consumer chain + // associated with the provided consumer id + QueryConsumerChain(ctx context.Context, in *QueryConsumerChainRequest, opts ...grpc.CallOption) (*QueryConsumerChainResponse, error) } type queryClient struct { @@ -2019,24 +2071,6 @@ func (c *queryClient) QueryConsumerChains(ctx context.Context, in *QueryConsumer return out, nil } -func (c *queryClient) QueryConsumerChainStarts(ctx context.Context, in *QueryConsumerChainStartProposalsRequest, opts ...grpc.CallOption) (*QueryConsumerChainStartProposalsResponse, error) { - out := new(QueryConsumerChainStartProposalsResponse) - err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryConsumerChainStarts", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) QueryConsumerChainStops(ctx context.Context, in *QueryConsumerChainStopProposalsRequest, opts ...grpc.CallOption) (*QueryConsumerChainStopProposalsResponse, error) { - out := new(QueryConsumerChainStopProposalsResponse) - err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryConsumerChainStops", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *queryClient) QueryValidatorConsumerAddr(ctx context.Context, in *QueryValidatorConsumerAddrRequest, opts ...grpc.CallOption) (*QueryValidatorConsumerAddrResponse, error) { out := new(QueryValidatorConsumerAddrResponse) err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryValidatorConsumerAddr", in, out, opts...) @@ -2073,18 +2107,9 @@ func (c *queryClient) QueryRegisteredConsumerRewardDenoms(ctx context.Context, i return out, nil } -func (c *queryClient) QueryProposedConsumerChainIDs(ctx context.Context, in *QueryProposedChainIDsRequest, opts ...grpc.CallOption) (*QueryProposedChainIDsResponse, error) { - out := new(QueryProposedChainIDsResponse) - err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryProposedConsumerChainIDs", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) QueryAllPairsValConAddrByConsumerChainID(ctx context.Context, in *QueryAllPairsValConAddrByConsumerChainIDRequest, opts ...grpc.CallOption) (*QueryAllPairsValConAddrByConsumerChainIDResponse, error) { - out := new(QueryAllPairsValConAddrByConsumerChainIDResponse) - err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryAllPairsValConAddrByConsumerChainID", in, out, opts...) +func (c *queryClient) QueryAllPairsValConsAddrByConsumer(ctx context.Context, in *QueryAllPairsValConsAddrByConsumerRequest, opts ...grpc.CallOption) (*QueryAllPairsValConsAddrByConsumerResponse, error) { + out := new(QueryAllPairsValConsAddrByConsumerResponse) + err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryAllPairsValConsAddrByConsumer", in, out, opts...) if err != nil { return nil, err } @@ -2145,6 +2170,24 @@ 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 +} + +func (c *queryClient) QueryConsumerChain(ctx context.Context, in *QueryConsumerChainRequest, opts ...grpc.CallOption) (*QueryConsumerChainResponse, error) { + out := new(QueryConsumerChainResponse) + err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryConsumerChain", 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 @@ -2153,10 +2196,6 @@ type QueryServer interface { // ConsumerChains queries active consumer chains supported by the provider // chain QueryConsumerChains(context.Context, *QueryConsumerChainsRequest) (*QueryConsumerChainsResponse, error) - // QueryConsumerChainStarts queries consumer chain start proposals. - QueryConsumerChainStarts(context.Context, *QueryConsumerChainStartProposalsRequest) (*QueryConsumerChainStartProposalsResponse, error) - // QueryConsumerChainStops queries consumer chain stop proposals. - QueryConsumerChainStops(context.Context, *QueryConsumerChainStopProposalsRequest) (*QueryConsumerChainStopProposalsResponse, error) // QueryValidatorConsumerAddr queries the address // assigned by a validator for a consumer chain. QueryValidatorConsumerAddr(context.Context, *QueryValidatorConsumerAddrRequest) (*QueryValidatorConsumerAddrResponse, error) @@ -2169,12 +2208,9 @@ type QueryServer interface { // QueryRegisteredConsumerRewardDenoms returns a list of consumer reward // denoms that are registered QueryRegisteredConsumerRewardDenoms(context.Context, *QueryRegisteredConsumerRewardDenomsRequest) (*QueryRegisteredConsumerRewardDenomsResponse, error) - // QueryProposedConsumerChainIDs returns the chain IDs of the proposed consumer chain addition proposals - // that are still in the voting period - QueryProposedConsumerChainIDs(context.Context, *QueryProposedChainIDsRequest) (*QueryProposedChainIDsResponse, error) - // QueryAllPairsValConAddrByConsumerChainID returns a list of pair valconsensus address + // QueryAllPairsValConsAddrByConsumer returns a list of pair valconsensus address // between provider and consumer chain - QueryAllPairsValConAddrByConsumerChainID(context.Context, *QueryAllPairsValConAddrByConsumerChainIDRequest) (*QueryAllPairsValConAddrByConsumerChainIDResponse, error) + QueryAllPairsValConsAddrByConsumer(context.Context, *QueryAllPairsValConsAddrByConsumerRequest) (*QueryAllPairsValConsAddrByConsumerResponse, error) // QueryParams returns all current values of provider parameters QueryParams(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) // QueryConsumerChainOptedInValidators returns a list of validators consensus addresses @@ -2186,13 +2222,19 @@ type QueryServer interface { // QueryValidatorConsumerCommissionRate returns the commission rate a given // validator charges on a given consumer chain QueryValidatorConsumerCommissionRate(context.Context, *QueryValidatorConsumerCommissionRateRequest) (*QueryValidatorConsumerCommissionRateResponse, error) - // QueryConsumerValidators returns the latest set consumer-validator set for a given chainID + // QueryConsumerValidators returns the latest set consumer-validator set for a given consumer ID // Note that this does not necessarily mean that the consumer chain is using this validator set at this exact moment // because a VSCPacket could be delayed to be delivered on the consumer chain. QueryConsumerValidators(context.Context, *QueryConsumerValidatorsRequest) (*QueryConsumerValidatorsResponse, error) // 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) + // QueryConsumerChain returns the consumer chain + // associated with the provided consumer id + QueryConsumerChain(context.Context, *QueryConsumerChainRequest) (*QueryConsumerChainResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -2205,12 +2247,6 @@ func (*UnimplementedQueryServer) QueryConsumerGenesis(ctx context.Context, req * func (*UnimplementedQueryServer) QueryConsumerChains(ctx context.Context, req *QueryConsumerChainsRequest) (*QueryConsumerChainsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method QueryConsumerChains not implemented") } -func (*UnimplementedQueryServer) QueryConsumerChainStarts(ctx context.Context, req *QueryConsumerChainStartProposalsRequest) (*QueryConsumerChainStartProposalsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method QueryConsumerChainStarts not implemented") -} -func (*UnimplementedQueryServer) QueryConsumerChainStops(ctx context.Context, req *QueryConsumerChainStopProposalsRequest) (*QueryConsumerChainStopProposalsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method QueryConsumerChainStops not implemented") -} func (*UnimplementedQueryServer) QueryValidatorConsumerAddr(ctx context.Context, req *QueryValidatorConsumerAddrRequest) (*QueryValidatorConsumerAddrResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method QueryValidatorConsumerAddr not implemented") } @@ -2223,11 +2259,8 @@ func (*UnimplementedQueryServer) QueryThrottleState(ctx context.Context, req *Qu func (*UnimplementedQueryServer) QueryRegisteredConsumerRewardDenoms(ctx context.Context, req *QueryRegisteredConsumerRewardDenomsRequest) (*QueryRegisteredConsumerRewardDenomsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method QueryRegisteredConsumerRewardDenoms not implemented") } -func (*UnimplementedQueryServer) QueryProposedConsumerChainIDs(ctx context.Context, req *QueryProposedChainIDsRequest) (*QueryProposedChainIDsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method QueryProposedConsumerChainIDs not implemented") -} -func (*UnimplementedQueryServer) QueryAllPairsValConAddrByConsumerChainID(ctx context.Context, req *QueryAllPairsValConAddrByConsumerChainIDRequest) (*QueryAllPairsValConAddrByConsumerChainIDResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method QueryAllPairsValConAddrByConsumerChainID not implemented") +func (*UnimplementedQueryServer) QueryAllPairsValConsAddrByConsumer(ctx context.Context, req *QueryAllPairsValConsAddrByConsumerRequest) (*QueryAllPairsValConsAddrByConsumerResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryAllPairsValConsAddrByConsumer not implemented") } func (*UnimplementedQueryServer) QueryParams(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method QueryParams not implemented") @@ -2247,6 +2280,12 @@ 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 (*UnimplementedQueryServer) QueryConsumerChain(ctx context.Context, req *QueryConsumerChainRequest) (*QueryConsumerChainResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryConsumerChain not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -2288,42 +2327,6 @@ func _Query_QueryConsumerChains_Handler(srv interface{}, ctx context.Context, de return interceptor(ctx, in, info, handler) } -func _Query_QueryConsumerChainStarts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryConsumerChainStartProposalsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).QueryConsumerChainStarts(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryConsumerChainStarts", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).QueryConsumerChainStarts(ctx, req.(*QueryConsumerChainStartProposalsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_QueryConsumerChainStops_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryConsumerChainStopProposalsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).QueryConsumerChainStops(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryConsumerChainStops", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).QueryConsumerChainStops(ctx, req.(*QueryConsumerChainStopProposalsRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _Query_QueryValidatorConsumerAddr_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryValidatorConsumerAddrRequest) if err := dec(in); err != nil { @@ -2396,38 +2399,20 @@ func _Query_QueryRegisteredConsumerRewardDenoms_Handler(srv interface{}, ctx con return interceptor(ctx, in, info, handler) } -func _Query_QueryProposedConsumerChainIDs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryProposedChainIDsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).QueryProposedConsumerChainIDs(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryProposedConsumerChainIDs", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).QueryProposedConsumerChainIDs(ctx, req.(*QueryProposedChainIDsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_QueryAllPairsValConAddrByConsumerChainID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAllPairsValConAddrByConsumerChainIDRequest) +func _Query_QueryAllPairsValConsAddrByConsumer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllPairsValConsAddrByConsumerRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).QueryAllPairsValConAddrByConsumerChainID(ctx, in) + return srv.(QueryServer).QueryAllPairsValConsAddrByConsumer(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryAllPairsValConAddrByConsumerChainID", + FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryAllPairsValConsAddrByConsumer", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).QueryAllPairsValConAddrByConsumerChainID(ctx, req.(*QueryAllPairsValConAddrByConsumerChainIDRequest)) + return srv.(QueryServer).QueryAllPairsValConsAddrByConsumer(ctx, req.(*QueryAllPairsValConsAddrByConsumerRequest)) } return interceptor(ctx, in, info, handler) } @@ -2540,10 +2525,46 @@ func _Query_QueryBlocksUntilNextEpoch_Handler(srv interface{}, ctx context.Conte return interceptor(ctx, in, info, handler) } -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "interchain_security.ccv.provider.v1.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ +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) +} + +func _Query_QueryConsumerChain_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryConsumerChainRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).QueryConsumerChain(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryConsumerChain", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryConsumerChain(ctx, req.(*QueryConsumerChainRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "interchain_security.ccv.provider.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ { MethodName: "QueryConsumerGenesis", Handler: _Query_QueryConsumerGenesis_Handler, @@ -2552,14 +2573,6 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "QueryConsumerChains", Handler: _Query_QueryConsumerChains_Handler, }, - { - MethodName: "QueryConsumerChainStarts", - Handler: _Query_QueryConsumerChainStarts_Handler, - }, - { - MethodName: "QueryConsumerChainStops", - Handler: _Query_QueryConsumerChainStops_Handler, - }, { MethodName: "QueryValidatorConsumerAddr", Handler: _Query_QueryValidatorConsumerAddr_Handler, @@ -2577,12 +2590,8 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Handler: _Query_QueryRegisteredConsumerRewardDenoms_Handler, }, { - MethodName: "QueryProposedConsumerChainIDs", - Handler: _Query_QueryProposedConsumerChainIDs_Handler, - }, - { - MethodName: "QueryAllPairsValConAddrByConsumerChainID", - Handler: _Query_QueryAllPairsValConAddrByConsumerChainID_Handler, + MethodName: "QueryAllPairsValConsAddrByConsumer", + Handler: _Query_QueryAllPairsValConsAddrByConsumer_Handler, }, { MethodName: "QueryParams", @@ -2608,6 +2617,14 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "QueryBlocksUntilNextEpoch", Handler: _Query_QueryBlocksUntilNextEpoch_Handler, }, + { + MethodName: "QueryConsumerIdFromClientId", + Handler: _Query_QueryConsumerIdFromClientId_Handler, + }, + { + MethodName: "QueryConsumerChain", + Handler: _Query_QueryConsumerChain_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "interchain_security/ccv/provider/v1/query.proto", @@ -2633,10 +2650,10 @@ func (m *QueryConsumerGenesisRequest) MarshalToSizedBuffer(dAtA []byte) (int, er _ = i var l int _ = l - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ChainId))) + 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 } @@ -2696,6 +2713,16 @@ 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] = 0x10 + } + if m.Phase != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Phase)) + i-- + dAtA[i] = 0x8 + } return len(dAtA) - i, nil } @@ -2736,122 +2763,6 @@ func (m *QueryConsumerChainsResponse) MarshalToSizedBuffer(dAtA []byte) (int, er return len(dAtA) - i, nil } -func (m *QueryConsumerChainStartProposalsRequest) 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 *QueryConsumerChainStartProposalsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryConsumerChainStartProposalsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryConsumerChainStartProposalsResponse) 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 *QueryConsumerChainStartProposalsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryConsumerChainStartProposalsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Proposals != nil { - { - size, err := m.Proposals.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryConsumerChainStopProposalsRequest) 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 *QueryConsumerChainStopProposalsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryConsumerChainStopProposalsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryConsumerChainStopProposalsResponse) 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 *QueryConsumerChainStopProposalsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryConsumerChainStopProposalsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Proposals != nil { - { - size, err := m.Proposals.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *Chain) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2872,6 +2783,13 @@ func (m *Chain) 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] = 0x6a + } if m.AllowInactiveVals { i-- if m.AllowInactiveVals { @@ -2880,12 +2798,29 @@ func (m *Chain) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0 } i-- - dAtA[i] = 0x50 + dAtA[i] = 0x60 } if m.MinStake != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.MinStake)) i-- - dAtA[i] = 0x48 + dAtA[i] = 0x58 + } + { + 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 len(m.Phase) > 0 { + i -= len(m.Phase) + copy(dAtA[i:], m.Phase) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Phase))) + i-- + dAtA[i] = 0x4a } if len(m.Denylist) > 0 { for iNdEx := len(m.Denylist) - 1; iNdEx >= 0; iNdEx-- { @@ -2962,18 +2897,18 @@ 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] = 0x12 + } if len(m.ProviderAddress) > 0 { i -= len(m.ProviderAddress) copy(dAtA[i:], m.ProviderAddress) i = encodeVarintQuery(dAtA, i, uint64(len(m.ProviderAddress))) i-- - dAtA[i] = 0x12 - } - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ChainId))) - i-- dAtA[i] = 0xa } return len(dAtA) - i, nil @@ -3029,18 +2964,18 @@ 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] = 0x12 + } if len(m.ConsumerAddress) > 0 { i -= len(m.ConsumerAddress) copy(dAtA[i:], m.ConsumerAddress) i = encodeVarintQuery(dAtA, i, uint64(len(m.ConsumerAddress))) i-- - dAtA[i] = 0x12 - } - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ChainId))) - i-- dAtA[i] = 0xa } return len(dAtA) - i, nil @@ -3119,12 +3054,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 + n3, err3 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.NextReplenishCandidate, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.NextReplenishCandidate):]) + if err3 != nil { + return 0, err3 } - i -= n4 - i = encodeVarintQuery(dAtA, i, uint64(n4)) + i -= n3 + i = encodeVarintQuery(dAtA, i, uint64(n3)) i-- dAtA[i] = 0x1a if m.SlashMeterAllowance != 0 { @@ -3195,7 +3130,7 @@ func (m *QueryRegisteredConsumerRewardDenomsResponse) MarshalToSizedBuffer(dAtA return len(dAtA) - i, nil } -func (m *QueryProposedChainIDsRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryAllPairsValConsAddrByConsumerRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3205,20 +3140,27 @@ func (m *QueryProposedChainIDsRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryProposedChainIDsRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryAllPairsValConsAddrByConsumerRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryProposedChainIDsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryAllPairsValConsAddrByConsumerRequest) 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 (m *QueryProposedChainIDsResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryAllPairsValConsAddrByConsumerResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3228,20 +3170,20 @@ func (m *QueryProposedChainIDsResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryProposedChainIDsResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryAllPairsValConsAddrByConsumerResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryProposedChainIDsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryAllPairsValConsAddrByConsumerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.ProposedChains) > 0 { - for iNdEx := len(m.ProposedChains) - 1; iNdEx >= 0; iNdEx-- { + if len(m.PairValConAddr) > 0 { + for iNdEx := len(m.PairValConAddr) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.ProposedChains[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.PairValConAddr[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -3255,7 +3197,7 @@ func (m *QueryProposedChainIDsResponse) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } -func (m *ProposedChain) Marshal() (dAtA []byte, err error) { +func (m *PairValConAddrProviderAndConsumer) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3265,32 +3207,46 @@ func (m *ProposedChain) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ProposedChain) MarshalTo(dAtA []byte) (int, error) { +func (m *PairValConAddrProviderAndConsumer) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ProposedChain) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *PairValConAddrProviderAndConsumer) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.ProposalID != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ProposalID)) + if m.ConsumerKey != nil { + { + size, err := m.ConsumerKey.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } i-- - dAtA[i] = 0x10 + dAtA[i] = 0x1a + } + if len(m.ConsumerAddress) > 0 { + i -= len(m.ConsumerAddress) + copy(dAtA[i:], m.ConsumerAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ConsumerAddress))) + i-- + dAtA[i] = 0x12 } - if len(m.ChainID) > 0 { - i -= len(m.ChainID) - copy(dAtA[i:], m.ChainID) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ChainID))) + if len(m.ProviderAddress) > 0 { + i -= len(m.ProviderAddress) + copy(dAtA[i:], m.ProviderAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ProviderAddress))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryAllPairsValConAddrByConsumerChainIDRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3300,27 +3256,20 @@ func (m *QueryAllPairsValConAddrByConsumerChainIDRequest) Marshal() (dAtA []byte return dAtA[:n], nil } -func (m *QueryAllPairsValConAddrByConsumerChainIDRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAllPairsValConAddrByConsumerChainIDRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ChainId))) - i-- - dAtA[i] = 0xa - } return len(dAtA) - i, nil } -func (m *QueryAllPairsValConAddrByConsumerChainIDResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3330,34 +3279,30 @@ func (m *QueryAllPairsValConAddrByConsumerChainIDResponse) Marshal() (dAtA []byt return dAtA[:n], nil } -func (m *QueryAllPairsValConAddrByConsumerChainIDResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAllPairsValConAddrByConsumerChainIDResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.PairValConAddr) > 0 { - for iNdEx := len(m.PairValConAddr) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.PairValConAddr[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *PairValConAddrProviderAndConsumer) Marshal() (dAtA []byte, err error) { +func (m *QueryConsumerChainOptedInValidatorsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3367,125 +3312,20 @@ func (m *PairValConAddrProviderAndConsumer) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *PairValConAddrProviderAndConsumer) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryConsumerChainOptedInValidatorsRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *PairValConAddrProviderAndConsumer) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryConsumerChainOptedInValidatorsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.ConsumerKey != nil { - { - size, err := m.ConsumerKey.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if len(m.ConsumerAddress) > 0 { - i -= len(m.ConsumerAddress) - copy(dAtA[i:], m.ConsumerAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ConsumerAddress))) - i-- - dAtA[i] = 0x12 - } - if len(m.ProviderAddress) > 0 { - i -= len(m.ProviderAddress) - copy(dAtA[i:], m.ProviderAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ProviderAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryParamsRequest) 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 *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryParamsResponse) 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 *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *QueryConsumerChainOptedInValidatorsRequest) 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 *QueryConsumerChainOptedInValidatorsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryConsumerChainOptedInValidatorsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ChainId))) + 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 } @@ -3544,10 +3384,10 @@ func (m *QueryConsumerValidatorsRequest) MarshalToSizedBuffer(dAtA []byte) (int, _ = i var l int _ = l - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ChainId))) + 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 } @@ -3574,6 +3414,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 @@ -3698,11 +3620,11 @@ func (m *QueryConsumerChainsValidatorHasToValidateResponse) MarshalToSizedBuffer _ = i var l int _ = l - if len(m.ConsumerChainIds) > 0 { - for iNdEx := len(m.ConsumerChainIds) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.ConsumerChainIds[iNdEx]) - copy(dAtA[i:], m.ConsumerChainIds[iNdEx]) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ConsumerChainIds[iNdEx]))) + if len(m.ConsumerIds) > 0 { + for iNdEx := len(m.ConsumerIds) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.ConsumerIds[iNdEx]) + copy(dAtA[i:], m.ConsumerIds[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ConsumerIds[iNdEx]))) i-- dAtA[i] = 0xa } @@ -3737,10 +3659,10 @@ func (m *QueryValidatorConsumerCommissionRateRequest) MarshalToSizedBuffer(dAtA i-- dAtA[i] = 0x12 } - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ChainId))) + 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 } @@ -3831,105 +3753,235 @@ 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 - } + +func (m *QueryConsumerIdFromClientIdRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryConsumerIdFromClientIdRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + 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 n + return len(dAtA) - i, nil } -func (m *QueryConsumerGenesisResponse) Size() (n int) { - if m == nil { - return 0 +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 } - var l int - _ = l - l = m.GenesisState.Size() - n += 1 + l + sovQuery(uint64(l)) - return n + return dAtA[:n], nil } -func (m *QueryConsumerChainsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n +func (m *QueryConsumerIdFromClientIdResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryConsumerChainsResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryConsumerIdFromClientIdResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m.Chains) > 0 { - for _, e := range m.Chains { - l = e.Size() - n += 1 + l + sovQuery(uint64(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 n + return len(dAtA) - i, nil } -func (m *QueryConsumerChainStartProposalsRequest) Size() (n int) { - if m == nil { - return 0 +func (m *QueryConsumerChainRequest) 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 *QueryConsumerChainStartProposalsResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryConsumerChainRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryConsumerChainRequest) 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 (m *QueryConsumerChainResponse) 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 *QueryConsumerChainResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryConsumerChainResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.PowerShapingParams != nil { + { + size, err := m.PowerShapingParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + if m.InitParams != nil { + { + size, err := m.InitParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + { + size, err := m.Metadata.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + if len(m.Phase) > 0 { + i -= len(m.Phase) + copy(dAtA[i:], m.Phase) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Phase))) + i-- + dAtA[i] = 0x1a + } + if len(m.OwnerAddress) > 0 { + i -= len(m.OwnerAddress) + copy(dAtA[i:], m.OwnerAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.OwnerAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.ChainId) > 0 { + i -= len(m.ChainId) + copy(dAtA[i:], m.ChainId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ChainId))) + 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 - if m.Proposals != nil { - l = m.Proposals.Size() + l = len(m.ConsumerId) + if l > 0 { n += 1 + l + sovQuery(uint64(l)) } return n } -func (m *QueryConsumerChainStopProposalsRequest) Size() (n int) { +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 *QueryConsumerChainStopProposalsResponse) Size() (n int) { +func (m *QueryConsumerChainsRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Proposals != nil { - l = m.Proposals.Size() - n += 1 + l + sovQuery(uint64(l)) + if m.Phase != 0 { + n += 1 + sovQuery(uint64(m.Phase)) + } + if m.Limit != 0 { + n += 1 + sovQuery(uint64(m.Limit)) + } + return n +} + +func (m *QueryConsumerChainsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Chains) > 0 { + for _, e := range m.Chains { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } } return n } @@ -3972,12 +4024,22 @@ func (m *Chain) Size() (n int) { n += 1 + l + sovQuery(uint64(l)) } } + l = len(m.Phase) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = m.Metadata.Size() + n += 1 + l + sovQuery(uint64(l)) if m.MinStake != 0 { n += 1 + sovQuery(uint64(m.MinStake)) } if m.AllowInactiveVals { n += 2 } + l = len(m.ConsumerId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } return n } @@ -3987,11 +4049,11 @@ func (m *QueryValidatorConsumerAddrRequest) Size() (n int) { } var l int _ = l - l = len(m.ChainId) + l = len(m.ProviderAddress) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } - l = len(m.ProviderAddress) + l = len(m.ConsumerId) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -4017,11 +4079,11 @@ func (m *QueryValidatorProviderAddrRequest) Size() (n int) { } var l int _ = l - l = len(m.ChainId) + l = len(m.ConsumerAddress) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } - l = len(m.ConsumerAddress) + l = len(m.ConsumerId) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -4091,60 +4153,20 @@ func (m *QueryRegisteredConsumerRewardDenomsResponse) Size() (n int) { return n } -func (m *QueryProposedChainIDsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryProposedChainIDsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.ProposedChains) > 0 { - for _, e := range m.ProposedChains { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *ProposedChain) Size() (n int) { +func (m *QueryAllPairsValConsAddrByConsumerRequest) 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)) - } - if m.ProposalID != 0 { - n += 1 + sovQuery(uint64(m.ProposalID)) - } - return n -} - -func (m *QueryAllPairsValConAddrByConsumerChainIDRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ChainId) + l = len(m.ConsumerId) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } return n } -func (m *QueryAllPairsValConAddrByConsumerChainIDResponse) Size() (n int) { +func (m *QueryAllPairsValConsAddrByConsumerResponse) Size() (n int) { if m == nil { return 0 } @@ -4206,7 +4228,7 @@ func (m *QueryConsumerChainOptedInValidatorsRequest) Size() (n int) { } var l int _ = l - l = len(m.ChainId) + l = len(m.ConsumerId) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -4234,7 +4256,7 @@ func (m *QueryConsumerValidatorsRequest) Size() (n int) { } var l int _ = l - l = len(m.ChainId) + l = len(m.ConsumerId) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -4260,6 +4282,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 } @@ -4297,8 +4346,8 @@ func (m *QueryConsumerChainsValidatorHasToValidateResponse) Size() (n int) { } var l int _ = l - if len(m.ConsumerChainIds) > 0 { - for _, s := range m.ConsumerChainIds { + if len(m.ConsumerIds) > 0 { + for _, s := range m.ConsumerIds { l = len(s) n += 1 + l + sovQuery(uint64(l)) } @@ -4312,7 +4361,7 @@ func (m *QueryValidatorConsumerCommissionRateRequest) Size() (n int) { } var l int _ = l - l = len(m.ChainId) + l = len(m.ConsumerId) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -4355,6 +4404,76 @@ 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 (m *QueryConsumerChainRequest) 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 (m *QueryConsumerChainResponse) 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.OwnerAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Phase) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = m.Metadata.Size() + n += 1 + l + sovQuery(uint64(l)) + if m.InitParams != nil { + l = m.InitParams.Size() + n += 1 + l + sovQuery(uint64(l)) + } + if m.PowerShapingParams != nil { + l = m.PowerShapingParams.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -4392,7 +4511,7 @@ func (m *QueryConsumerGenesisRequest) Unmarshal(dAtA []byte) error { 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 ConsumerId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4420,7 +4539,7 @@ func (m *QueryConsumerGenesisRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ChainId = string(dAtA[iNdEx:postIndex]) + m.ConsumerId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -4555,195 +4674,30 @@ func (m *QueryConsumerChainsRequest) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: QueryConsumerChainsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Phase", wireType) } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery + 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 |= ConsumerPhase(b&0x7F) << shift + if b < 0x80 { + break + } } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryConsumerChainsResponse) 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: QueryConsumerChainsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryConsumerChainsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Chains", 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.Chains = append(m.Chains, &Chain{}) - if err := m.Chains[len(m.Chains)-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 *QueryConsumerChainStartProposalsRequest) 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: QueryConsumerChainStartProposalsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryConsumerChainStartProposalsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - 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 *QueryConsumerChainStartProposalsResponse) 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: QueryConsumerChainStartProposalsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryConsumerChainStartProposalsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Proposals", wireType) + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Limit", wireType) } - var msglen int + m.Limit = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4753,78 +4707,11 @@ func (m *QueryConsumerChainStartProposalsResponse) Unmarshal(dAtA []byte) error } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + m.Limit |= int32(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 m.Proposals == nil { - m.Proposals = &ConsumerAdditionProposals{} - } - if err := m.Proposals.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 *QueryConsumerChainStopProposalsRequest) 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: QueryConsumerChainStopProposalsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryConsumerChainStopProposalsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -4846,7 +4733,7 @@ func (m *QueryConsumerChainStopProposalsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryConsumerChainStopProposalsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryConsumerChainsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4869,15 +4756,15 @@ func (m *QueryConsumerChainStopProposalsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryConsumerChainStopProposalsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryConsumerChainsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryConsumerChainStopProposalsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryConsumerChainsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Proposals", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Chains", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4904,10 +4791,8 @@ func (m *QueryConsumerChainStopProposalsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Proposals == nil { - m.Proposals = &ConsumerRemovalProposals{} - } - if err := m.Proposals.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Chains = append(m.Chains, &Chain{}) + if err := m.Chains[len(m.Chains)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -5166,10 +5051,10 @@ 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 MinStake", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Phase", wireType) } - m.MinStake = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -5179,17 +5064,82 @@ func (m *Chain) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MinStake |= uint64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - case 10: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AllowInactiveVals", wireType) + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery } - var v int - for shift := uint(0); ; shift += 7 { + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Phase = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + 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 + case 11: + 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 ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinStake |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 12: + 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 ErrIntOverflowQuery } @@ -5204,6 +5154,38 @@ func (m *Chain) Unmarshal(dAtA []byte) error { } } m.AllowInactiveVals = bool(v != 0) + case 13: + 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:]) @@ -5256,7 +5238,7 @@ func (m *QueryValidatorConsumerAddrRequest) Unmarshal(dAtA []byte) error { 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 ProviderAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5284,11 +5266,11 @@ func (m *QueryValidatorConsumerAddrRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ChainId = string(dAtA[iNdEx:postIndex]) + m.ProviderAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProviderAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5316,7 +5298,7 @@ func (m *QueryValidatorConsumerAddrRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ProviderAddress = string(dAtA[iNdEx:postIndex]) + m.ConsumerId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -5452,7 +5434,7 @@ func (m *QueryValidatorProviderAddrRequest) Unmarshal(dAtA []byte) error { 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 ConsumerAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5480,11 +5462,11 @@ func (m *QueryValidatorProviderAddrRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ChainId = string(dAtA[iNdEx:postIndex]) + m.ConsumerAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConsumerAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5512,7 +5494,7 @@ func (m *QueryValidatorProviderAddrRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ConsumerAddress = string(dAtA[iNdEx:postIndex]) + m.ConsumerId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -5920,7 +5902,7 @@ func (m *QueryRegisteredConsumerRewardDenomsResponse) Unmarshal(dAtA []byte) err } return nil } -func (m *QueryProposedChainIDsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryAllPairsValConsAddrByConsumerRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5943,12 +5925,44 @@ func (m *QueryProposedChainIDsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryProposedChainIDsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllPairsValConsAddrByConsumerRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryProposedChainIDsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllPairsValConsAddrByConsumerRequest: 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:]) @@ -5970,7 +5984,7 @@ func (m *QueryProposedChainIDsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryProposedChainIDsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryAllPairsValConsAddrByConsumerResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5993,15 +6007,15 @@ func (m *QueryProposedChainIDsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryProposedChainIDsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllPairsValConsAddrByConsumerResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryProposedChainIDsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllPairsValConsAddrByConsumerResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposedChains", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PairValConAddr", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -6028,8 +6042,8 @@ func (m *QueryProposedChainIDsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ProposedChains = append(m.ProposedChains, ProposedChain{}) - if err := m.ProposedChains[len(m.ProposedChains)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.PairValConAddr = append(m.PairValConAddr, &PairValConAddrProviderAndConsumer{}) + if err := m.PairValConAddr[len(m.PairValConAddr)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -6054,7 +6068,7 @@ func (m *QueryProposedChainIDsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *ProposedChain) Unmarshal(dAtA []byte) error { +func (m *PairValConAddrProviderAndConsumer) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6077,15 +6091,15 @@ func (m *ProposedChain) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ProposedChain: wiretype end group for non-group") + return fmt.Errorf("proto: PairValConAddrProviderAndConsumer: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ProposedChain: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: PairValConAddrProviderAndConsumer: 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 ProviderAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -6113,13 +6127,45 @@ func (m *ProposedChain) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ChainID = string(dAtA[iNdEx:postIndex]) + m.ProviderAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalID", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerAddress", 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.ConsumerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerKey", wireType) } - m.ProposalID = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -6129,11 +6175,28 @@ func (m *ProposedChain) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ProposalID |= uint64(b&0x7F) << shift + 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 m.ConsumerKey == nil { + m.ConsumerKey = &crypto.PublicKey{} + } + if err := m.ConsumerKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -6155,7 +6218,7 @@ func (m *ProposedChain) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllPairsValConAddrByConsumerChainIDRequest) Unmarshal(dAtA []byte) error { +func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6178,44 +6241,12 @@ func (m *QueryAllPairsValConAddrByConsumerChainIDRequest) Unmarshal(dAtA []byte) fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllPairsValConAddrByConsumerChainIDRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllPairsValConAddrByConsumerChainIDRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryParamsRequest: 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) - } - 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.ChainId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -6237,7 +6268,7 @@ func (m *QueryAllPairsValConAddrByConsumerChainIDRequest) Unmarshal(dAtA []byte) } return nil } -func (m *QueryAllPairsValConAddrByConsumerChainIDResponse) Unmarshal(dAtA []byte) error { +func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6260,15 +6291,15 @@ func (m *QueryAllPairsValConAddrByConsumerChainIDResponse) Unmarshal(dAtA []byte fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllPairsValConAddrByConsumerChainIDResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllPairsValConAddrByConsumerChainIDResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PairValConAddr", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -6295,8 +6326,7 @@ func (m *QueryAllPairsValConAddrByConsumerChainIDResponse) Unmarshal(dAtA []byte if postIndex > l { return io.ErrUnexpectedEOF } - m.PairValConAddr = append(m.PairValConAddr, &PairValConAddrProviderAndConsumer{}) - if err := m.PairValConAddr[len(m.PairValConAddr)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -6321,7 +6351,7 @@ func (m *QueryAllPairsValConAddrByConsumerChainIDResponse) Unmarshal(dAtA []byte } return nil } -func (m *PairValConAddrProviderAndConsumer) Unmarshal(dAtA []byte) error { +func (m *QueryConsumerChainOptedInValidatorsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6344,15 +6374,15 @@ func (m *PairValConAddrProviderAndConsumer) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: PairValConAddrProviderAndConsumer: wiretype end group for non-group") + return fmt.Errorf("proto: QueryConsumerChainOptedInValidatorsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: PairValConAddrProviderAndConsumer: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryConsumerChainOptedInValidatorsRequest: 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) + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -6380,14 +6410,64 @@ func (m *PairValConAddrProviderAndConsumer) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ProviderAddress = 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 ConsumerAddress", wireType) + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { + 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 *QueryConsumerChainOptedInValidatorsResponse) 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: QueryConsumerChainOptedInValidatorsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryConsumerChainOptedInValidatorsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorsProviderAddresses", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } @@ -6412,13 +6492,63 @@ func (m *PairValConAddrProviderAndConsumer) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ConsumerAddress = string(dAtA[iNdEx:postIndex]) + m.ValidatorsProviderAddresses = append(m.ValidatorsProviderAddresses, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex - case 3: + 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 *QueryConsumerValidatorsRequest) 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: QueryConsumerValidatorsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryConsumerValidatorsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConsumerKey", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerId", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -6428,27 +6558,23 @@ func (m *PairValConAddrProviderAndConsumer) 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 } - if m.ConsumerKey == nil { - m.ConsumerKey = &crypto.PublicKey{} - } - if err := m.ConsumerKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.ConsumerId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -6471,7 +6597,7 @@ func (m *PairValConAddrProviderAndConsumer) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryConsumerValidatorsValidator) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6490,16 +6616,401 @@ func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { if b < 0x80 { break } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryConsumerValidatorsValidator: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryConsumerValidatorsValidator: 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 + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerKey", 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 m.ConsumerKey == nil { + m.ConsumerKey = &crypto.PublicKey{} + } + if err := m.ConsumerKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Power", wireType) + } + m.Power = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Power |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Rate", 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.Rate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerPower", wireType) + } + 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 + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerCommissionRate", 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.ConsumerCommissionRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProviderCommissionRate", 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.ProviderCommissionRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", 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.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:]) @@ -6521,7 +7032,7 @@ func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryConsumerValidatorsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6544,15 +7055,15 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryConsumerValidatorsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + 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 Params", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Validators", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -6579,7 +7090,8 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Validators = append(m.Validators, &QueryConsumerValidatorsValidator{}) + if err := m.Validators[len(m.Validators)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -6604,7 +7116,7 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryConsumerChainOptedInValidatorsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryConsumerChainsValidatorHasToValidateRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6627,15 +7139,15 @@ func (m *QueryConsumerChainOptedInValidatorsRequest) Unmarshal(dAtA []byte) erro fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryConsumerChainOptedInValidatorsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryConsumerChainsValidatorHasToValidateRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryConsumerChainOptedInValidatorsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + 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 ChainId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ProviderAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -6663,7 +7175,7 @@ func (m *QueryConsumerChainOptedInValidatorsRequest) Unmarshal(dAtA []byte) erro if postIndex > l { return io.ErrUnexpectedEOF } - m.ChainId = string(dAtA[iNdEx:postIndex]) + m.ProviderAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -6686,7 +7198,7 @@ func (m *QueryConsumerChainOptedInValidatorsRequest) Unmarshal(dAtA []byte) erro } return nil } -func (m *QueryConsumerChainOptedInValidatorsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryConsumerChainsValidatorHasToValidateResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6709,15 +7221,15 @@ func (m *QueryConsumerChainOptedInValidatorsResponse) Unmarshal(dAtA []byte) err fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryConsumerChainOptedInValidatorsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryConsumerChainsValidatorHasToValidateResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryConsumerChainOptedInValidatorsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryConsumerChainsValidatorHasToValidateResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorsProviderAddresses", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerIds", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -6745,7 +7257,7 @@ func (m *QueryConsumerChainOptedInValidatorsResponse) Unmarshal(dAtA []byte) err if postIndex > l { return io.ErrUnexpectedEOF } - m.ValidatorsProviderAddresses = append(m.ValidatorsProviderAddresses, string(dAtA[iNdEx:postIndex])) + m.ConsumerIds = append(m.ConsumerIds, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex @@ -6768,7 +7280,7 @@ func (m *QueryConsumerChainOptedInValidatorsResponse) Unmarshal(dAtA []byte) err } return nil } -func (m *QueryConsumerValidatorsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryValidatorConsumerCommissionRateRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6791,15 +7303,15 @@ func (m *QueryConsumerValidatorsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryConsumerValidatorsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryValidatorConsumerCommissionRateRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryConsumerValidatorsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryValidatorConsumerCommissionRateRequest: 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 ConsumerId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -6827,7 +7339,39 @@ func (m *QueryConsumerValidatorsRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ChainId = 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 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 @@ -6850,7 +7394,7 @@ func (m *QueryConsumerValidatorsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryConsumerValidatorsValidator) Unmarshal(dAtA []byte) error { +func (m *QueryValidatorConsumerCommissionRateResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6873,15 +7417,15 @@ func (m *QueryConsumerValidatorsValidator) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryConsumerValidatorsValidator: wiretype end group for non-group") + return fmt.Errorf("proto: QueryValidatorConsumerCommissionRateResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryConsumerValidatorsValidator: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryValidatorConsumerCommissionRateResponse: 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) + return fmt.Errorf("proto: wrong wireType = %d for field Rate", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -6909,97 +7453,129 @@ func (m *QueryConsumerValidatorsValidator) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ProviderAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConsumerKey", wireType) + if err := m.Rate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - 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 - } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err } - if msglen < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF } - if postIndex > l { + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryBlocksUntilNextEpochRequest) 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 } - if m.ConsumerKey == nil { - m.ConsumerKey = &crypto.PublicKey{} + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break } - if err := m.ConsumerKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryBlocksUntilNextEpochRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBlocksUntilNextEpochRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { return err } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Power", wireType) - } - m.Power = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Power |= int64(b&0x7F) << shift - if b < 0x80 { - break - } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Rate", wireType) + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF } - 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 - } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryBlocksUntilNextEpochResponse) 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 } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery + if iNdEx >= l { + return io.ErrUnexpectedEOF } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break } - if postIndex > l { - return io.ErrUnexpectedEOF + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryBlocksUntilNextEpochResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBlocksUntilNextEpochResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlocksUntilNextEpoch", wireType) } - if err := m.Rate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + m.BlocksUntilNextEpoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlocksUntilNextEpoch |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -7021,7 +7597,7 @@ func (m *QueryConsumerValidatorsValidator) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryConsumerValidatorsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryConsumerIdFromClientIdRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -7044,17 +7620,17 @@ func (m *QueryConsumerValidatorsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryConsumerValidatorsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryConsumerIdFromClientIdRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryConsumerValidatorsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + 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 Validators", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ClientId", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -7064,25 +7640,23 @@ 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 { - return err - } + m.ClientId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -7105,7 +7679,7 @@ func (m *QueryConsumerValidatorsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryConsumerChainsValidatorHasToValidateRequest) Unmarshal(dAtA []byte) error { +func (m *QueryConsumerIdFromClientIdResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -7128,15 +7702,15 @@ func (m *QueryConsumerChainsValidatorHasToValidateRequest) Unmarshal(dAtA []byte fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryConsumerChainsValidatorHasToValidateRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryConsumerIdFromClientIdResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryConsumerChainsValidatorHasToValidateRequest: illegal tag %d (wire type %d)", fieldNum, wire) + 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 ProviderAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -7164,7 +7738,7 @@ func (m *QueryConsumerChainsValidatorHasToValidateRequest) Unmarshal(dAtA []byte if postIndex > l { return io.ErrUnexpectedEOF } - m.ProviderAddress = string(dAtA[iNdEx:postIndex]) + m.ConsumerId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -7187,7 +7761,7 @@ func (m *QueryConsumerChainsValidatorHasToValidateRequest) Unmarshal(dAtA []byte } return nil } -func (m *QueryConsumerChainsValidatorHasToValidateResponse) Unmarshal(dAtA []byte) error { +func (m *QueryConsumerChainRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -7210,15 +7784,15 @@ func (m *QueryConsumerChainsValidatorHasToValidateResponse) Unmarshal(dAtA []byt fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryConsumerChainsValidatorHasToValidateResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryConsumerChainRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryConsumerChainsValidatorHasToValidateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryConsumerChainRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConsumerChainIds", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -7246,7 +7820,7 @@ func (m *QueryConsumerChainsValidatorHasToValidateResponse) Unmarshal(dAtA []byt if postIndex > l { return io.ErrUnexpectedEOF } - m.ConsumerChainIds = append(m.ConsumerChainIds, string(dAtA[iNdEx:postIndex])) + m.ConsumerId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -7269,7 +7843,7 @@ func (m *QueryConsumerChainsValidatorHasToValidateResponse) Unmarshal(dAtA []byt } return nil } -func (m *QueryValidatorConsumerCommissionRateRequest) Unmarshal(dAtA []byte) error { +func (m *QueryConsumerChainResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -7292,10 +7866,10 @@ func (m *QueryValidatorConsumerCommissionRateRequest) Unmarshal(dAtA []byte) err fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryValidatorConsumerCommissionRateRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryConsumerChainResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryValidatorConsumerCommissionRateRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryConsumerChainResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -7332,7 +7906,7 @@ func (m *QueryValidatorConsumerCommissionRateRequest) Unmarshal(dAtA []byte) err iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProviderAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field OwnerAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -7360,61 +7934,11 @@ func (m *QueryValidatorConsumerCommissionRateRequest) Unmarshal(dAtA []byte) err if postIndex > l { return io.ErrUnexpectedEOF } - m.ProviderAddress = string(dAtA[iNdEx:postIndex]) + m.OwnerAddress = 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 *QueryValidatorConsumerCommissionRateResponse) 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: QueryValidatorConsumerCommissionRateResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryValidatorConsumerCommissionRateResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + 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 Phase", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -7442,115 +7966,82 @@ func (m *QueryValidatorConsumerCommissionRateResponse) Unmarshal(dAtA []byte) er if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Rate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Phase = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) } - if (skippy < 0) || (iNdEx+skippy) < 0 { + 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 } - if (iNdEx + skippy) > l { + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { return io.ErrUnexpectedEOF } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryBlocksUntilNextEpochRequest) 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 err := m.Metadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - if iNdEx >= l { - return io.ErrUnexpectedEOF + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InitParams", wireType) } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break + 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 + } } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryBlocksUntilNextEpochRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryBlocksUntilNextEpochRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err + if msglen < 0 { + return ErrInvalidLengthQuery } - if (skippy < 0) || (iNdEx+skippy) < 0 { + postIndex := iNdEx + msglen + if postIndex < 0 { return ErrInvalidLengthQuery } - if (iNdEx + skippy) > l { + if postIndex > l { return io.ErrUnexpectedEOF } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryBlocksUntilNextEpochResponse) 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 + if m.InitParams == nil { + m.InitParams = &ConsumerInitializationParameters{} } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break + if err := m.InitParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryBlocksUntilNextEpochResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryBlocksUntilNextEpochResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BlocksUntilNextEpoch", wireType) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PowerShapingParams", wireType) } - m.BlocksUntilNextEpoch = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -7560,11 +8051,28 @@ func (m *QueryBlocksUntilNextEpochResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.BlocksUntilNextEpoch |= uint64(b&0x7F) << shift + 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 m.PowerShapingParams == nil { + m.PowerShapingParams = &PowerShapingParameters{} + } + if err := m.PowerShapingParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex 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 a115ace156..e6fdfc5f76 100644 --- a/x/ccv/provider/types/query.pb.gw.go +++ b/x/ccv/provider/types/query.pb.gw.go @@ -44,15 +44,15 @@ func request_Query_QueryConsumerGenesis_0(ctx context.Context, marshaler runtime _ = err ) - val, ok = pathParams["chain_id"] + val, ok = pathParams["consumer_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "consumer_id") } - protoReq.ChainId, err = runtime.String(val) + protoReq.ConsumerId, 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", "consumer_id", err) } msg, err := client.QueryConsumerGenesis(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -71,15 +71,15 @@ func local_request_Query_QueryConsumerGenesis_0(ctx context.Context, marshaler r _ = err ) - val, ok = pathParams["chain_id"] + val, ok = pathParams["consumer_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "consumer_id") } - protoReq.ChainId, err = runtime.String(val) + protoReq.ConsumerId, 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", "consumer_id", err) } msg, err := server.QueryConsumerGenesis(ctx, &protoReq) @@ -91,6 +91,38 @@ func request_Query_QueryConsumerChains_0(ctx context.Context, marshaler runtime. var protoReq QueryConsumerChainsRequest var metadata runtime.ServerMetadata + var ( + val string + e int32 + ok bool + err error + _ = err + ) + + val, ok = pathParams["phase"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "phase") + } + + e, err = runtime.Enum(val, ConsumerPhase_value) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "phase", err) + } + + protoReq.Phase = ConsumerPhase(e) + + val, ok = pathParams["limit"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "limit") + } + + protoReq.Limit, err = runtime.Int32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "limit", err) + } + msg, err := client.QueryConsumerChains(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err @@ -100,60 +132,74 @@ func local_request_Query_QueryConsumerChains_0(ctx context.Context, marshaler ru var protoReq QueryConsumerChainsRequest var metadata runtime.ServerMetadata - msg, err := server.QueryConsumerChains(ctx, &protoReq) - return msg, metadata, err - -} + var ( + val string + e int32 + ok bool + err error + _ = err + ) -func request_Query_QueryConsumerChainStarts_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryConsumerChainStartProposalsRequest - var metadata runtime.ServerMetadata + val, ok = pathParams["phase"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "phase") + } - msg, err := client.QueryConsumerChainStarts(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err + e, err = runtime.Enum(val, ConsumerPhase_value) -} + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "phase", err) + } -func local_request_Query_QueryConsumerChainStarts_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryConsumerChainStartProposalsRequest - var metadata runtime.ServerMetadata + protoReq.Phase = ConsumerPhase(e) - msg, err := server.QueryConsumerChainStarts(ctx, &protoReq) - return msg, metadata, err + val, ok = pathParams["limit"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "limit") + } -} + protoReq.Limit, err = runtime.Int32(val) -func request_Query_QueryConsumerChainStops_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryConsumerChainStopProposalsRequest - var metadata runtime.ServerMetadata + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "limit", err) + } - msg, err := client.QueryConsumerChainStops(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := server.QueryConsumerChains(ctx, &protoReq) return msg, metadata, err } -func local_request_Query_QueryConsumerChainStops_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryConsumerChainStopProposalsRequest +func request_Query_QueryValidatorConsumerAddr_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryValidatorConsumerAddrRequest var metadata runtime.ServerMetadata - msg, err := server.QueryConsumerChainStops(ctx, &protoReq) - return msg, metadata, err + 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") + } -var ( - filter_Query_QueryValidatorConsumerAddr_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) + protoReq.ConsumerId, err = runtime.String(val) -func request_Query_QueryValidatorConsumerAddr_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryValidatorConsumerAddrRequest - var metadata runtime.ServerMetadata + 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) + val, ok = pathParams["provider_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "provider_address") } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryValidatorConsumerAddr_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + + 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) } msg, err := client.QueryValidatorConsumerAddr(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -165,11 +211,33 @@ func local_request_Query_QueryValidatorConsumerAddr_0(ctx context.Context, marsh var protoReq QueryValidatorConsumerAddrRequest var metadata runtime.ServerMetadata - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + 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") } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryValidatorConsumerAddr_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + + 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) } msg, err := server.QueryValidatorConsumerAddr(ctx, &protoReq) @@ -177,19 +245,37 @@ func local_request_Query_QueryValidatorConsumerAddr_0(ctx context.Context, marsh } -var ( - filter_Query_QueryValidatorProviderAddr_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - func request_Query_QueryValidatorProviderAddr_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryValidatorProviderAddrRequest var metadata runtime.ServerMetadata - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + 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") } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryValidatorProviderAddr_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + + 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["consumer_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "consumer_address") + } + + protoReq.ConsumerAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "consumer_address", err) } msg, err := client.QueryValidatorProviderAddr(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -201,11 +287,33 @@ func local_request_Query_QueryValidatorProviderAddr_0(ctx context.Context, marsh var protoReq QueryValidatorProviderAddrRequest var metadata runtime.ServerMetadata - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + 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["consumer_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "consumer_address") } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryValidatorProviderAddr_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + + protoReq.ConsumerAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "consumer_address", err) } msg, err := server.QueryValidatorProviderAddr(ctx, &protoReq) @@ -249,56 +357,56 @@ func local_request_Query_QueryRegisteredConsumerRewardDenoms_0(ctx context.Conte } -func request_Query_QueryProposedConsumerChainIDs_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryProposedChainIDsRequest +func request_Query_QueryAllPairsValConsAddrByConsumer_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllPairsValConsAddrByConsumerRequest var metadata runtime.ServerMetadata - msg, err := client.QueryProposedConsumerChainIDs(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_QueryProposedConsumerChainIDs_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryProposedChainIDsRequest - var metadata runtime.ServerMetadata - - msg, err := server.QueryProposedConsumerChainIDs(ctx, &protoReq) - return msg, metadata, err - -} + var ( + val string + ok bool + err error + _ = err + ) -var ( - filter_Query_QueryAllPairsValConAddrByConsumerChainID_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) + val, ok = pathParams["consumer_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "consumer_id") + } -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 + protoReq.ConsumerId, err = runtime.String(val) - 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_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "consumer_id", err) } - msg, err := client.QueryAllPairsValConAddrByConsumerChainID(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.QueryAllPairsValConsAddrByConsumer(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_QueryAllPairsValConAddrByConsumerChainID_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllPairsValConAddrByConsumerChainIDRequest +func local_request_Query_QueryAllPairsValConsAddrByConsumer_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllPairsValConsAddrByConsumerRequest var metadata runtime.ServerMetadata - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + 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") } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryAllPairsValConAddrByConsumerChainID_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + + 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) } - msg, err := server.QueryAllPairsValConAddrByConsumerChainID(ctx, &protoReq) + msg, err := server.QueryAllPairsValConsAddrByConsumer(ctx, &protoReq) return msg, metadata, err } @@ -332,15 +440,15 @@ func request_Query_QueryConsumerChainOptedInValidators_0(ctx context.Context, ma _ = err ) - val, ok = pathParams["chain_id"] + val, ok = pathParams["consumer_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "consumer_id") } - protoReq.ChainId, err = runtime.String(val) + protoReq.ConsumerId, 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", "consumer_id", err) } msg, err := client.QueryConsumerChainOptedInValidators(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -359,15 +467,15 @@ func local_request_Query_QueryConsumerChainOptedInValidators_0(ctx context.Conte _ = err ) - val, ok = pathParams["chain_id"] + val, ok = pathParams["consumer_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "consumer_id") } - protoReq.ChainId, err = runtime.String(val) + protoReq.ConsumerId, 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", "consumer_id", err) } msg, err := server.QueryConsumerChainOptedInValidators(ctx, &protoReq) @@ -440,15 +548,15 @@ func request_Query_QueryValidatorConsumerCommissionRate_0(ctx context.Context, m _ = err ) - val, ok = pathParams["chain_id"] + val, ok = pathParams["consumer_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "consumer_id") } - protoReq.ChainId, err = runtime.String(val) + protoReq.ConsumerId, 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", "consumer_id", err) } val, ok = pathParams["provider_address"] @@ -478,15 +586,15 @@ func local_request_Query_QueryValidatorConsumerCommissionRate_0(ctx context.Cont _ = err ) - val, ok = pathParams["chain_id"] + val, ok = pathParams["consumer_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "consumer_id") } - protoReq.ChainId, err = runtime.String(val) + protoReq.ConsumerId, 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", "consumer_id", err) } val, ok = pathParams["provider_address"] @@ -516,15 +624,15 @@ func request_Query_QueryConsumerValidators_0(ctx context.Context, marshaler runt _ = err ) - val, ok = pathParams["chain_id"] + val, ok = pathParams["consumer_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "consumer_id") } - protoReq.ChainId, err = runtime.String(val) + protoReq.ConsumerId, 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", "consumer_id", err) } msg, err := client.QueryConsumerValidators(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -543,15 +651,15 @@ func local_request_Query_QueryConsumerValidators_0(ctx context.Context, marshale _ = err ) - val, ok = pathParams["chain_id"] + val, ok = pathParams["consumer_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "consumer_id") } - protoReq.ChainId, err = runtime.String(val) + protoReq.ConsumerId, 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", "consumer_id", err) } msg, err := server.QueryConsumerValidators(ctx, &protoReq) @@ -577,6 +685,114 @@ func local_request_Query_QueryBlocksUntilNextEpoch_0(ctx context.Context, marsha } +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 := client.QueryConsumerIdFromClientId(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +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 + + 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.QueryConsumerIdFromClientId(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_QueryConsumerChain_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryConsumerChainRequest + 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) + } + + msg, err := client.QueryConsumerChain(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QueryConsumerChain_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryConsumerChainRequest + 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) + } + + msg, err := server.QueryConsumerChain(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -629,30 +845,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_QueryConsumerChainStarts_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_QueryConsumerChainStarts_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_QueryConsumerChainStarts_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_QueryConsumerChainStops_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_QueryValidatorConsumerAddr_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -663,7 +856,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_QueryConsumerChainStops_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_QueryValidatorConsumerAddr_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 { @@ -671,11 +864,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_QueryConsumerChainStops_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QueryValidatorConsumerAddr_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_QueryValidatorConsumerAddr_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_QueryValidatorProviderAddr_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -686,7 +879,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_QueryValidatorConsumerAddr_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_QueryValidatorProviderAddr_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 { @@ -694,11 +887,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_QueryValidatorConsumerAddr_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QueryValidatorProviderAddr_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_QueryValidatorProviderAddr_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_QueryThrottleState_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -709,7 +902,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_QueryValidatorProviderAddr_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_QueryThrottleState_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 { @@ -717,11 +910,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_QueryValidatorProviderAddr_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QueryThrottleState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_QueryThrottleState_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_QueryRegisteredConsumerRewardDenoms_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -732,7 +925,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_QueryThrottleState_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_QueryRegisteredConsumerRewardDenoms_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 { @@ -740,11 +933,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_QueryThrottleState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QueryRegisteredConsumerRewardDenoms_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_QueryRegisteredConsumerRewardDenoms_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_QueryAllPairsValConsAddrByConsumer_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -755,7 +948,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_QueryRegisteredConsumerRewardDenoms_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_QueryAllPairsValConsAddrByConsumer_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 { @@ -763,11 +956,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_QueryRegisteredConsumerRewardDenoms_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QueryAllPairsValConsAddrByConsumer_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_QueryProposedConsumerChainIDs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + 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() var stream runtime.ServerTransportStream @@ -778,7 +971,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_QueryProposedConsumerChainIDs_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_QueryParams_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 { @@ -786,11 +979,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_QueryProposedConsumerChainIDs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QueryParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_QueryAllPairsValConAddrByConsumerChainID_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_QueryConsumerChainOptedInValidators_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -801,7 +994,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_QueryAllPairsValConAddrByConsumerChainID_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_QueryConsumerChainOptedInValidators_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 { @@ -809,11 +1002,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_QueryAllPairsValConAddrByConsumerChainID_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QueryConsumerChainOptedInValidators_0(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) { + 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() var stream runtime.ServerTransportStream @@ -824,7 +1017,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_QueryParams_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_QueryConsumerChainsValidatorHasToValidate_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 { @@ -832,11 +1025,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_QueryParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QueryConsumerChainsValidatorHasToValidate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_QueryConsumerChainOptedInValidators_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_QueryValidatorConsumerCommissionRate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -847,7 +1040,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_QueryConsumerChainOptedInValidators_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_QueryValidatorConsumerCommissionRate_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 { @@ -855,11 +1048,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_QueryConsumerChainOptedInValidators_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QueryValidatorConsumerCommissionRate_0(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) { + 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() var stream runtime.ServerTransportStream @@ -870,7 +1063,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_QueryConsumerChainsValidatorHasToValidate_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_QueryConsumerValidators_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 { @@ -878,11 +1071,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_QueryConsumerChainsValidatorHasToValidate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QueryConsumerValidators_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_QueryValidatorConsumerCommissionRate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + 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() var stream runtime.ServerTransportStream @@ -893,7 +1086,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_QueryValidatorConsumerCommissionRate_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_QueryBlocksUntilNextEpoch_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 { @@ -901,11 +1094,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_QueryValidatorConsumerCommissionRate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QueryBlocksUntilNextEpoch_0(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) { + 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 @@ -916,7 +1109,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_QueryConsumerValidators_0(rctx, inboundMarshaler, server, req, pathParams) + 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 { @@ -924,11 +1117,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_QueryConsumerValidators_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QueryConsumerIdFromClientId_0(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) { + mux.Handle("GET", pattern_Query_QueryConsumerChain_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -939,7 +1132,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_QueryBlocksUntilNextEpoch_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_QueryConsumerChain_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 { @@ -947,7 +1140,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_QueryBlocksUntilNextEpoch_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QueryConsumerChain_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1032,27 +1225,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_QueryConsumerChainStarts_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_QueryConsumerChainStarts_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_QueryConsumerChainStarts_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_QueryConsumerChainStops_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_QueryValidatorConsumerAddr_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) @@ -1061,18 +1234,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_QueryConsumerChainStops_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_QueryValidatorConsumerAddr_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_QueryConsumerChainStops_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QueryValidatorConsumerAddr_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_QueryValidatorConsumerAddr_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_QueryValidatorProviderAddr_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) @@ -1081,18 +1254,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_QueryValidatorConsumerAddr_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_QueryValidatorProviderAddr_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_QueryValidatorConsumerAddr_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QueryValidatorProviderAddr_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_QueryValidatorProviderAddr_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_QueryThrottleState_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) @@ -1101,18 +1274,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_QueryValidatorProviderAddr_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_QueryThrottleState_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_QueryValidatorProviderAddr_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QueryThrottleState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_QueryThrottleState_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_QueryRegisteredConsumerRewardDenoms_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) @@ -1121,18 +1294,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_QueryThrottleState_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_QueryRegisteredConsumerRewardDenoms_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_QueryThrottleState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QueryRegisteredConsumerRewardDenoms_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_QueryRegisteredConsumerRewardDenoms_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_QueryAllPairsValConsAddrByConsumer_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) @@ -1141,18 +1314,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_QueryRegisteredConsumerRewardDenoms_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_QueryAllPairsValConsAddrByConsumer_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_QueryRegisteredConsumerRewardDenoms_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QueryAllPairsValConsAddrByConsumer_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_QueryProposedConsumerChainIDs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + 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() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -1161,18 +1334,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_QueryProposedConsumerChainIDs_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_QueryParams_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_QueryProposedConsumerChainIDs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QueryParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_QueryAllPairsValConAddrByConsumerChainID_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_QueryConsumerChainOptedInValidators_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) @@ -1181,18 +1354,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_QueryAllPairsValConAddrByConsumerChainID_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_QueryConsumerChainOptedInValidators_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_QueryAllPairsValConAddrByConsumerChainID_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QueryConsumerChainOptedInValidators_0(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) { + 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() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -1201,18 +1374,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_QueryParams_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_QueryConsumerChainsValidatorHasToValidate_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_QueryParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QueryConsumerChainsValidatorHasToValidate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_QueryConsumerChainOptedInValidators_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_QueryValidatorConsumerCommissionRate_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) @@ -1221,18 +1394,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_QueryConsumerChainOptedInValidators_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_QueryValidatorConsumerCommissionRate_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_QueryConsumerChainOptedInValidators_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QueryValidatorConsumerCommissionRate_0(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) { + 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() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -1241,18 +1414,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_QueryConsumerChainsValidatorHasToValidate_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_QueryConsumerValidators_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_QueryConsumerChainsValidatorHasToValidate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QueryConsumerValidators_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_QueryValidatorConsumerCommissionRate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + 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() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -1261,18 +1434,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_QueryValidatorConsumerCommissionRate_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_QueryBlocksUntilNextEpoch_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_QueryValidatorConsumerCommissionRate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QueryBlocksUntilNextEpoch_0(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) { + 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) @@ -1281,18 +1454,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_QueryConsumerValidators_0(rctx, inboundMarshaler, client, req, pathParams) + 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_QueryConsumerValidators_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QueryConsumerIdFromClientId_0(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) { + mux.Handle("GET", pattern_Query_QueryConsumerChain_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) @@ -1301,14 +1474,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_QueryBlocksUntilNextEpoch_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_QueryConsumerChain_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_QueryBlocksUntilNextEpoch_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QueryConsumerChain_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1316,37 +1489,35 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } 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_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_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", "consumer_id"}, "", 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))) + pattern_Query_QueryConsumerChains_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_chains", "phase", "limit"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_QueryConsumerChainStops_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"interchain_security", "ccv", "provider", "consumer_chain_stop_proposals"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_QueryValidatorConsumerAddr_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", "validator_consumer_addr", "consumer_id", "provider_address"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_QueryValidatorConsumerAddr_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"interchain_security", "ccv", "provider", "validator_consumer_addr"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_QueryValidatorProviderAddr_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"interchain_security", "ccv", "provider", "validator_provider_addr"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_QueryValidatorProviderAddr_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", "validator_provider_addr", "consumer_id", "consumer_address"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_QueryThrottleState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"interchain_security", "ccv", "provider", "throttle_state"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_QueryRegisteredConsumerRewardDenoms_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"interchain_security", "ccv", "provider", "registered_consumer_reward_denoms"}, "", runtime.AssumeColonVerbOpt(false))) - 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_QueryAllPairsValConsAddrByConsumer_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", "address_pairs", "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_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", "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_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", "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_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", "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))) + + pattern_Query_QueryConsumerChain_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_chain", "consumer_id"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -1354,10 +1525,6 @@ var ( forward_Query_QueryConsumerChains_0 = runtime.ForwardResponseMessage - forward_Query_QueryConsumerChainStarts_0 = runtime.ForwardResponseMessage - - forward_Query_QueryConsumerChainStops_0 = runtime.ForwardResponseMessage - forward_Query_QueryValidatorConsumerAddr_0 = runtime.ForwardResponseMessage forward_Query_QueryValidatorProviderAddr_0 = runtime.ForwardResponseMessage @@ -1366,9 +1533,7 @@ var ( forward_Query_QueryRegisteredConsumerRewardDenoms_0 = runtime.ForwardResponseMessage - forward_Query_QueryProposedConsumerChainIDs_0 = runtime.ForwardResponseMessage - - forward_Query_QueryAllPairsValConAddrByConsumerChainID_0 = runtime.ForwardResponseMessage + forward_Query_QueryAllPairsValConsAddrByConsumer_0 = runtime.ForwardResponseMessage forward_Query_QueryParams_0 = runtime.ForwardResponseMessage @@ -1381,4 +1546,8 @@ var ( forward_Query_QueryConsumerValidators_0 = runtime.ForwardResponseMessage forward_Query_QueryBlocksUntilNextEpoch_0 = runtime.ForwardResponseMessage + + forward_Query_QueryConsumerIdFromClientId_0 = runtime.ForwardResponseMessage + + forward_Query_QueryConsumerChain_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 292e870a9b..999fffef8a 100644 --- a/x/ccv/provider/types/tx.pb.go +++ b/x/ccv/provider/types/tx.pb.go @@ -43,16 +43,17 @@ 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. // in json string format corresponding to proto-any, ex: // `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is="}` 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"` + Submitter string `protobuf:"bytes,4,opt,name=submitter,proto3" json:"submitter,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 +132,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 +214,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{} } @@ -284,7 +289,7 @@ var xxx_messageInfo_MsgSubmitConsumerDoubleVotingResponse proto.InternalMessageI // MsgUpdateParams is the Msg/UpdateParams request type type MsgUpdateParams struct { - // signer is the address of the governance account. + // authority is the address of the governance account. Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` // params defines the x/provider parameters to update. Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` @@ -373,12 +378,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 +663,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 +765,99 @@ 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 address of the owner of the consumer chain to be stopped + Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,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) GetOwner() string { + if m != nil { + return m.Owner + } + 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. // @@ -779,7 +867,7 @@ type MsgChangeRewardDenoms struct { DenomsToAdd []string `protobuf:"bytes,1,rep,name=denoms_to_add,json=denomsToAdd,proto3" json:"denoms_to_add,omitempty"` // the list of consumer reward denoms to remove DenomsToRemove []string `protobuf:"bytes,2,rep,name=denoms_to_remove,json=denomsToRemove,proto3" json:"denoms_to_remove,omitempty"` - // signer address + // authority is the address of the governance account Authority string `protobuf:"bytes,3,opt,name=authority,proto3" json:"authority,omitempty"` } @@ -787,7 +875,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 +933,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 +963,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, @@ -884,15 +972,17 @@ type MsgOptIn struct { // This field is optional and can remain empty (i.e., `consumer_key = ""`). A validator can always change the // consumer public key at a later stage by issuing a `MsgAssignConsumerKey` message. 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"` + // submitter address + Submitter string `protobuf:"bytes,4,opt,name=submitter,proto3" json:"submitter,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 +1018,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 +1048,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"` + // submitter address + Submitter string `protobuf:"bytes,3,opt,name=submitter,proto3" json:"submitter,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 +1098,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 +1132,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"` + // submitter address + Submitter string `protobuf:"bytes,4,opt,name=submitter,proto3" json:"submitter,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 +1183,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 +1212,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 +1251,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 +1364,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 +1393,259 @@ func (m *MsgConsumerModificationResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgConsumerModificationResponse proto.InternalMessageInfo +// MsgCreateConsumer defines the message that creates a consumer chain +type MsgCreateConsumer struct { + // Submitter address. If the message is successfully handled, the ownership of + // the consumer chain will given to this address. + Submitter string `protobuf:"bytes,1,opt,name=submitter,proto3" json:"submitter,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) GetSubmitter() string { + if m != nil { + return m.Submitter + } + 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 { + // the address of the owner of the consumer chain to be updated + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,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) GetOwner() string { + if m != nil { + return m.Owner + } + 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 +1659,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 +1671,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,118 +1682,137 @@ func init() { } var fileDescriptor_43221a4391e9fbf4 = []byte{ - // 1764 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x58, 0xcd, 0x8f, 0x1c, 0x47, - 0x15, 0xdf, 0xf6, 0x7e, 0x78, 0xe6, 0xcd, 0x7e, 0xf6, 0xae, 0xd9, 0xd9, 0xb6, 0x33, 0xb3, 0x5e, - 0x42, 0xb2, 0x32, 0xd9, 0xee, 0xd8, 0x90, 0x04, 0x56, 0x41, 0xb0, 0x1f, 0x06, 0x6f, 0x60, 0xed, - 0xa5, 0x6d, 0x8c, 0x04, 0x12, 0xad, 0x9a, 0xee, 0x72, 0x4f, 0xc9, 0xdd, 0x5d, 0xad, 0xae, 0x9a, - 0x71, 0xe6, 0x16, 0xe5, 0x84, 0x84, 0x84, 0x82, 0xc4, 0x01, 0x71, 0xca, 0x01, 0x21, 0x21, 0x01, - 0xf2, 0x21, 0x27, 0x6e, 0xdc, 0x7c, 0x8c, 0x22, 0x0e, 0x28, 0x07, 0x83, 0xec, 0x43, 0x38, 0xf3, - 0x17, 0xa0, 0xaa, 0xae, 0xee, 0xe9, 0xd9, 0x99, 0x9d, 0xf4, 0x8e, 0xc3, 0x21, 0x97, 0xd1, 0x74, - 0xbd, 0xdf, 0xfb, 0xd5, 0xef, 0xbd, 0xea, 0x7a, 0xaf, 0xaa, 0xe1, 0x35, 0x12, 0x71, 0x9c, 0xb8, - 0x6d, 0x44, 0x22, 0x87, 0x61, 0xb7, 0x93, 0x10, 0xde, 0xb3, 0x5c, 0xb7, 0x6b, 0xc5, 0x09, 0xed, - 0x12, 0x0f, 0x27, 0x56, 0xf7, 0xba, 0xc5, 0xdf, 0x35, 0xe3, 0x84, 0x72, 0xaa, 0x7f, 0x75, 0x04, - 0xda, 0x74, 0xdd, 0xae, 0x99, 0xa1, 0xcd, 0xee, 0x75, 0x63, 0x05, 0x85, 0x24, 0xa2, 0x96, 0xfc, - 0x4d, 0xfd, 0x8c, 0x2b, 0x3e, 0xa5, 0x7e, 0x80, 0x2d, 0x14, 0x13, 0x0b, 0x45, 0x11, 0xe5, 0x88, - 0x13, 0x1a, 0x31, 0x65, 0x6d, 0x2a, 0xab, 0x7c, 0x6a, 0x75, 0x1e, 0x58, 0x9c, 0x84, 0x98, 0x71, - 0x14, 0xc6, 0x0a, 0xd0, 0x38, 0x0d, 0xf0, 0x3a, 0x89, 0x64, 0x50, 0xf6, 0x8d, 0xd3, 0x76, 0x14, - 0xf5, 0x94, 0x69, 0xcd, 0xa7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, 0x22, 0x66, 0x24, 0x02, 0xd2, 0x21, 0x09, 0x38, - 0x00, 0x60, 0x31, 0x7a, 0x14, 0x39, 0xa2, 0x0d, 0xd4, 0x67, 0x95, 0x90, 0xb4, 0xc4, 0x9b, 0x59, - 0x89, 0x37, 0xef, 0x65, 0x3d, 0x62, 0xbf, 0x22, 0x84, 0x7c, 0xf0, 0xaf, 0xa6, 0x66, 0x57, 0xa5, - 0x9f, 0xb0, 0xe8, 0xb7, 0x61, 0xb9, 0x13, 0xb5, 0x68, 0xe4, 0x91, 0xc8, 0x77, 0x62, 0x9c, 0x10, - 0xea, 0xd5, 0xe7, 0x24, 0xd5, 0xc6, 0x10, 0xd5, 0xa1, 0xea, 0x26, 0x29, 0xd3, 0xef, 0x04, 0xd3, - 0x52, 0xee, 0x7c, 0x22, 0x7d, 0xf5, 0x1f, 0x83, 0xee, 0xba, 0x5d, 0x29, 0x89, 0x76, 0x78, 0xc6, - 0x78, 0xb1, 0x3c, 0xe3, 0xb2, 0xeb, 0x76, 0xef, 0xa5, 0xde, 0x8a, 0xf2, 0xe7, 0xb0, 0xce, 0x13, - 0x14, 0xb1, 0x07, 0x38, 0x39, 0xcd, 0x5b, 0x29, 0xcf, 0x7b, 0x29, 0xe3, 0x18, 0x24, 0xbf, 0x05, - 0x9b, 0x79, 0x65, 0x4e, 0xb0, 0x47, 0x18, 0x4f, 0x48, 0xab, 0x23, 0x37, 0x5d, 0xb6, 0x6d, 0xea, - 0x55, 0xf9, 0x12, 0x34, 0x32, 0x9c, 0x3d, 0x00, 0xfb, 0xbe, 0x42, 0xe9, 0x77, 0xe0, 0x65, 0xb9, - 0x4d, 0x99, 0x10, 0xe7, 0x0c, 0x30, 0xc9, 0xa9, 0x43, 0xc2, 0x98, 0x60, 0x83, 0x4d, 0x6d, 0x7b, - 0xda, 0xbe, 0x9a, 0x62, 0x4f, 0x70, 0x72, 0x58, 0x40, 0xde, 0x2b, 0x00, 0xf5, 0x1d, 0xd0, 0xdb, - 0x84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xbe, 0xa6, 0xed, 0xff, 0xf4, 0xc9, 0xb3, 0x86, 0xf6, 0xf1, 0xb3, - 0x86, 0xf6, 0xef, 0x67, 0x0d, 0xed, 0x83, 0xe7, 0x8d, 0xa9, 0x8f, 0x9f, 0x37, 0xa6, 0xfe, 0xf9, - 0xbc, 0x31, 0xf5, 0xb3, 0xef, 0xf8, 0x84, 0xb7, 0x3b, 0x2d, 0xd3, 0xa5, 0xa1, 0xfa, 0x3c, 0x6c, - 0xf5, 0x67, 0xdd, 0xc9, 0xbf, 0xee, 0x76, 0xdf, 0xb0, 0xde, 0x1d, 0xfc, 0xc4, 0x2b, 0x3f, 0x89, - 0xb5, 0xe6, 0xe4, 0xcd, 0xe5, 0x1b, 0xff, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x88, 0x80, 0xb2, 0x2a, - 0x5e, 0x17, 0x00, 0x00, + // 2075 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x59, 0xcb, 0x6f, 0x1c, 0x49, + 0x19, 0x77, 0xcf, 0x8c, 0xbd, 0x33, 0xe5, 0x77, 0xdb, 0x59, 0xb7, 0x27, 0x89, 0xc7, 0x31, 0xcb, + 0xae, 0x15, 0xd6, 0x3d, 0xc4, 0x90, 0x5d, 0x30, 0xe1, 0xe1, 0x47, 0x20, 0x5e, 0x70, 0xec, 0x6d, + 0x87, 0xac, 0x04, 0x12, 0xad, 0x9a, 0xee, 0x4a, 0x4f, 0x29, 0xdd, 0x5d, 0xad, 0xae, 0x9a, 0xf1, + 0x9a, 0x13, 0x8a, 0x84, 0x94, 0x63, 0xd0, 0x72, 0xe0, 0xc6, 0x1e, 0xb8, 0x20, 0x01, 0xda, 0xc3, + 0x9e, 0xf8, 0x0b, 0x56, 0xe2, 0xb2, 0xac, 0x38, 0xa0, 0x3d, 0x04, 0x94, 0x1c, 0x96, 0x33, 0x07, + 0xce, 0xa8, 0x1e, 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 0x09, 0x75, + 0xfb, 0x33, 0x87, 0x20, 0x38, 0x6c, 0xb1, 0xea, 0x1b, 0xc3, 0xe1, 0x53, 0x8b, 0xbf, 0xd5, 0xc0, + 0xf2, 0xd9, 0x97, 0xb0, 0xdc, 0xe5, 0xfe, 0x4c, 0x8a, 0xea, 0xfe, 0x85, 0x29, 0x52, 0x5f, 0x7f, + 0xad, 0x81, 0xc5, 0x81, 0xf7, 0x9a, 0x5b, 0xc3, 0x56, 0x84, 0x6e, 0xed, 0xea, 0xde, 0x45, 0xb4, + 0xb3, 0x45, 0xe5, 0x97, 0x1a, 0xd0, 0x07, 0x7c, 0x9c, 0xd9, 0xca, 0x6d, 0xa1, 0x4f, 0xb7, 0xba, + 0x33, 0xba, 0x6e, 0xe2, 0x5b, 0x75, 0xfc, 0x67, 0x9f, 0x7d, 0x70, 0x5d, 0xdb, 0x79, 0xe7, 0xa3, + 0x67, 0x2b, 0xda, 0xc7, 0xcf, 0x56, 0xb4, 0xbf, 0x3f, 0x5b, 0xd1, 0x9e, 0x3c, 0x5f, 0x19, 0xfb, + 0xf8, 0xf9, 0xca, 0xd8, 0x5f, 0x9f, 0xaf, 0x8c, 0xfd, 0xe8, 0x9b, 0x1e, 0x66, 0xcd, 0x56, 0xc3, + 0x74, 0x48, 0xa0, 0xfe, 0x88, 0xad, 0x77, 0xac, 0x6e, 0xa4, 0xff, 0xa3, 0xb6, 0x6f, 0xd6, 0xdf, + 0xcd, 0xfe, 0x99, 0x2a, 0xfe, 0x2d, 0x6a, 0x4c, 0x88, 0x6f, 0x76, 0x5f, 0xf9, 0x77, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x72, 0x99, 0x09, 0x26, 0xc8, 0x1e, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1464,6 +1832,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) @@ -1507,6 +1878,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...) @@ -1516,6 +1888,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...) @@ -1525,6 +1898,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...) @@ -1561,6 +1961,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...) @@ -1586,6 +1987,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) @@ -1613,6 +2017,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") } @@ -1726,43 +2139,97 @@ 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).UpdateParams(ctx, in) + return srv.(MsgServer).CreateConsumer(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/interchain_security.ccv.provider.v1.Msg/UpdateParams", + FullMethod: "/interchain_security.ccv.provider.v1.Msg/CreateConsumer", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + return srv.(MsgServer).CreateConsumer(ctx, req.(*MsgCreateConsumer)) } return interceptor(ctx, in, info, handler) } -func _Msg_OptIn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgOptIn) +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).OptIn(ctx, in) + return srv.(MsgServer).UpdateConsumer(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/interchain_security.ccv.provider.v1.Msg/OptIn", + FullMethod: "/interchain_security.ccv.provider.v1.Msg/UpdateConsumer", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).OptIn(ctx, req.(*MsgOptIn)) + return srv.(MsgServer).UpdateConsumer(ctx, req.(*MsgUpdateConsumer)) } return interceptor(ctx, in, info, handler) } -func _Msg_OptOut_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +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 + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/interchain_security.ccv.provider.v1.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_OptIn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgOptIn) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).OptIn(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/interchain_security.ccv.provider.v1.Msg/OptIn", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).OptIn(ctx, req.(*MsgOptIn)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_OptOut_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgOptOut) if err := dec(in); err != nil { return nil, err @@ -1858,6 +2325,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, @@ -1907,10 +2386,17 @@ func (m *MsgAssignConsumerKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Signer) > 0 { - i -= len(m.Signer) - copy(dAtA[i:], m.Signer) - i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) + 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.Submitter) > 0 { + i -= len(m.Submitter) + copy(dAtA[i:], m.Submitter) + i = encodeVarintTx(dAtA, i, uint64(len(m.Submitter))) i-- dAtA[i] = 0x22 } @@ -1981,6 +2467,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]) @@ -2046,6 +2539,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]) @@ -2432,6 +2932,66 @@ 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.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintTx(dAtA, i, uint64(len(m.Owner))) + 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) @@ -2523,10 +3083,17 @@ func (m *MsgOptIn) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Signer) > 0 { - i -= len(m.Signer) - copy(dAtA[i:], m.Signer) - i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) + 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.Submitter) > 0 { + i -= len(m.Submitter) + copy(dAtA[i:], m.Submitter) + i = encodeVarintTx(dAtA, i, uint64(len(m.Submitter))) i-- dAtA[i] = 0x22 } @@ -2597,10 +3164,17 @@ func (m *MsgOptOut) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Signer) > 0 { - i -= len(m.Signer) - copy(dAtA[i:], m.Signer) - i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) + 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.Submitter) > 0 { + i -= len(m.Submitter) + copy(dAtA[i:], m.Submitter) + i = encodeVarintTx(dAtA, i, uint64(len(m.Submitter))) i-- dAtA[i] = 0x1a } @@ -2664,10 +3238,17 @@ func (m *MsgSetConsumerCommissionRate) MarshalToSizedBuffer(dAtA []byte) (int, e _ = i var l int _ = l - if len(m.Signer) > 0 { - i -= len(m.Signer) - copy(dAtA[i:], m.Signer) - i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) + 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.Submitter) > 0 { + i -= len(m.Submitter) + copy(dAtA[i:], m.Submitter) + i = encodeVarintTx(dAtA, i, uint64(len(m.Submitter))) i-- dAtA[i] = 0x22 } @@ -2843,78 +3424,290 @@ 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.Submitter) > 0 { + i -= len(m.Submitter) + copy(dAtA[i:], m.Submitter) + i = encodeVarintTx(dAtA, i, uint64(len(m.Submitter))) + 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) { +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 + 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.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintTx(dAtA, i, uint64(len(m.Owner))) + 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.Submitter) + 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 } @@ -2932,6 +3725,10 @@ func (m *MsgSubmitConsumerDoubleVoting) Size() (n int) { 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 } @@ -3081,6 +3878,32 @@ 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 = len(m.Owner) + 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 @@ -3133,7 +3956,11 @@ func (m *MsgOptIn) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.Signer) + l = len(m.Submitter) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ConsumerId) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -3163,7 +3990,11 @@ func (m *MsgOptOut) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.Signer) + l = len(m.Submitter) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ConsumerId) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -3195,7 +4026,11 @@ func (m *MsgSetConsumerCommissionRate) Size() (n int) { } l = m.Rate.Size() n += 1 + l + sovTx(uint64(l)) - l = len(m.Signer) + l = len(m.Submitter) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ConsumerId) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -3272,6 +4107,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.Submitter) + 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.Owner) + 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 } @@ -3405,7 +4322,7 @@ func (m *MsgAssignConsumerKey) Unmarshal(dAtA []byte) error { 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 Submitter", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3433,15 +4350,47 @@ func (m *MsgAssignConsumerKey) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Signer = string(dAtA[iNdEx:postIndex]) + m.Submitter = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerId", wireType) } - if (skippy < 0) || (iNdEx+skippy) < 0 { + 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 { @@ -3603,6 +4552,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:]) @@ -3807,6 +4788,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:]) @@ -4899,7 +5912,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 { @@ -4922,15 +5935,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 { @@ -4958,43 +5971,11 @@ 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) - } - 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.DenomsToRemove = append(m.DenomsToRemove, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - 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 Owner", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5022,7 +6003,7 @@ func (m *MsgChangeRewardDenoms) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Authority = string(dAtA[iNdEx:postIndex]) + m.Owner = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -5045,7 +6026,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 { @@ -5068,10 +6049,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: @@ -5095,7 +6076,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 { @@ -5118,15 +6099,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 { @@ -5154,11 +6135,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 { @@ -5186,43 +6167,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 { @@ -5250,7 +6199,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 @@ -5273,7 +6222,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 { @@ -5296,10 +6245,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: @@ -5323,7 +6272,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 { @@ -5346,10 +6295,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: @@ -5418,7 +6367,7 @@ func (m *MsgOptOut) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerKey", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5446,56 +6395,998 @@ func (m *MsgOptOut) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Signer = string(dAtA[iNdEx:postIndex]) + m.ConsumerKey = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Submitter", wireType) } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx + 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 + } } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgOptOutResponse) 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 + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx } - if iNdEx >= l { + if postIndex > l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + m.Submitter = 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:]) + 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 *MsgOptInResponse) 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: MsgOptInResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgOptInResponse: 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 *MsgOptOut) 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: MsgOptOut: wiretype end group for non-group") + } + if fieldNum <= 0 { + 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 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 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProviderAddr", 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.ProviderAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Submitter", 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.Submitter = string(dAtA[iNdEx:postIndex]) + 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:]) + 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 *MsgOptOutResponse) 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: MsgOptOutResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgOptOutResponse: 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 *MsgSetConsumerCommissionRate) 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: MsgSetConsumerCommissionRate: wiretype end group for non-group") + } + if fieldNum <= 0 { + 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 ProviderAddr", 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.ProviderAddr = 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 Rate", 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 + } + if err := m.Rate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Submitter", 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.Submitter = 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:]) + 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 Title", 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.Title = 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 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.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + 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 4: + 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 ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Top_N |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + 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 ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ValidatorsPowerCap |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + 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 ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ValidatorSetCap |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + 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 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 { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgConsumerModificationResponse) 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: MsgOptOutResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgConsumerModificationResponse: 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: MsgConsumerModificationResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -5519,7 +7410,7 @@ func (m *MsgOptOutResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgSetConsumerCommissionRate) Unmarshal(dAtA []byte) error { +func (m *MsgCreateConsumer) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5542,15 +7433,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: MsgCreateConsumer: 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: 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 ProviderAddr", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Submitter", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5578,7 +7469,7 @@ func (m *MsgSetConsumerCommissionRate) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ProviderAddr = string(dAtA[iNdEx:postIndex]) + m.Submitter = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -5614,9 +7505,9 @@ func (m *MsgSetConsumerCommissionRate) Unmarshal(dAtA []byte) error { 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 Metadata", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -5626,31 +7517,30 @@ func (m *MsgSetConsumerCommissionRate) 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 } - if err := m.Rate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + 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 Signer", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field InitializationParameters", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -5660,23 +7550,63 @@ func (m *MsgSetConsumerCommissionRate) 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 + } + 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 } - m.Signer = string(dAtA[iNdEx:postIndex]) + if m.PowerShapingParameters == nil { + m.PowerShapingParameters = &PowerShapingParameters{} + } + if err := m.PowerShapingParameters.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -5699,7 +7629,7 @@ func (m *MsgSetConsumerCommissionRate) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgSetConsumerCommissionRateResponse) Unmarshal(dAtA []byte) error { +func (m *MsgCreateConsumerResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5722,12 +7652,44 @@ 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: MsgCreateConsumerResponse: 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: 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:]) @@ -5749,7 +7711,7 @@ func (m *MsgSetConsumerCommissionRateResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgConsumerModification) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateConsumer) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5772,15 +7734,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: MsgUpdateConsumer: 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: 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 Title", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5808,11 +7770,11 @@ func (m *MsgConsumerModification) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Title = string(dAtA[iNdEx:postIndex]) + m.Owner = 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 ConsumerId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5840,11 +7802,11 @@ func (m *MsgConsumerModification) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Description = string(dAtA[iNdEx:postIndex]) + m.ConsumerId = 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 NewOwnerAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5872,70 +7834,13 @@ func (m *MsgConsumerModification) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ChainId = string(dAtA[iNdEx:postIndex]) + m.NewOwnerAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: - 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 ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Top_N |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - 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 ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ValidatorsPowerCap |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - 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 ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ValidatorSetCap |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 7: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Allowlist", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -5945,29 +7850,33 @@ func (m *MsgConsumerModification) 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.Allowlist = append(m.Allowlist, string(dAtA[iNdEx:postIndex])) + if m.Metadata == nil { + m.Metadata = &ConsumerMetadata{} + } + if err := m.Metadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 8: + case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denylist", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field InitializationParameters", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -5977,29 +7886,33 @@ func (m *MsgConsumerModification) 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.Denylist = append(m.Denylist, string(dAtA[iNdEx:postIndex])) + if m.InitializationParameters == nil { + m.InitializationParameters = &ConsumerInitializationParameters{} + } + if err := m.InitializationParameters.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 9: + case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PowerShapingParameters", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -6009,63 +7922,28 @@ func (m *MsgConsumerModification) 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.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) + if m.PowerShapingParameters == nil { + m.PowerShapingParameters = &PowerShapingParameters{} } - 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 - } + if err := m.PowerShapingParameters.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - m.AllowInactiveVals = bool(v != 0) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -6087,7 +7965,7 @@ func (m *MsgConsumerModification) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgConsumerModificationResponse) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateConsumerResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6110,10 +7988,10 @@ func (m *MsgConsumerModificationResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgConsumerModificationResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateConsumerResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgConsumerModificationResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateConsumerResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: diff --git a/x/ccv/types/errors.go b/x/ccv/types/errors.go index e492984e48..995d9905e8 100644 --- a/x/ccv/types/errors.go +++ b/x/ccv/types/errors.go @@ -22,4 +22,6 @@ var ( ErrDuplicateConsumerChain = errorsmod.Register(ModuleName, 14, "consumer chain already exists") ErrConsumerChainNotFound = errorsmod.Register(ModuleName, 15, "consumer chain not found") ErrInvalidDoubleVotingEvidence = errorsmod.Register(ModuleName, 16, "invalid consumer double voting evidence") + ErrStoreKeyNotFound = errorsmod.Register(ModuleName, 17, "store key not found") + ErrStoreUnmarshal = errorsmod.Register(ModuleName, 18, "cannot unmarshal value from store") ) diff --git a/x/ccv/types/events.go b/x/ccv/types/events.go index 3c63fd7954..8ee8388eb3 100644 --- a/x/ccv/types/events.go +++ b/x/ccv/types/events.go @@ -28,7 +28,6 @@ const ( AttributeUnbondingPeriod = "unbonding_period" AttributeProviderValidatorAddress = "provider_validator_address" AttributeConsumerConsensusPubKey = "consumer_consensus_pub_key" - AttributeSubmitterAddress = "submitter_address" AttributeConsumerMisbehaviour = "consumer_misbehaviour" AttributeMisbehaviourClientId = "misbehaviour_client_id" AttributeMisbehaviourHeight1 = "misbehaviour_height_1" 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 diff --git a/x/ccv/types/shared_params.go b/x/ccv/types/shared_params.go index fa2e28c81c..d1a82df576 100644 --- a/x/ccv/types/shared_params.go +++ b/x/ccv/types/shared_params.go @@ -77,7 +77,7 @@ func ValidateChannelIdentifier(i interface{}) error { return ibchost.ChannelIdentifierValidator(value) } -func ValidateBech32(i interface{}) error { +func ValidateAccAddress(i interface{}) error { value, ok := i.(string) if !ok { return fmt.Errorf("invalid parameter type: %T", i) From 5e8a22bc297d89990bde7d1929d556031bb27913 Mon Sep 17 00:00:00 2001 From: MSalopek Date: Fri, 6 Sep 2024 12:56:16 +0200 Subject: [PATCH 12/28] fix: update keyring; make install fix (#2228) --- cmd/interchain-security-cd/cmd/root.go | 11 ----------- cmd/interchain-security-cdd/cmd/root.go | 11 ----------- cmd/interchain-security-pd/cmd/root.go | 11 ----------- cmd/interchain-security-sd/cmd/root.go | 11 ----------- 4 files changed, 44 deletions(-) diff --git a/cmd/interchain-security-cd/cmd/root.go b/cmd/interchain-security-cd/cmd/root.go index 0a980f3452..5708d94b1b 100644 --- a/cmd/interchain-security-cd/cmd/root.go +++ b/cmd/interchain-security-cd/cmd/root.go @@ -18,7 +18,6 @@ import ( "github.com/cosmos/cosmos-sdk/client/pruning" "github.com/cosmos/cosmos-sdk/client/rpc" addresscodec "github.com/cosmos/cosmos-sdk/codec/address" - "github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/cosmos/cosmos-sdk/server" serverconfig "github.com/cosmos/cosmos-sdk/server/config" servertypes "github.com/cosmos/cosmos-sdk/server/types" @@ -106,17 +105,7 @@ func enrichAutoCliOpts(autoCliOpts autocli.AppOptions, clientCtx client.Context) autoCliOpts.ValidatorAddressCodec = addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()) autoCliOpts.ConsensusAddressCodec = addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix()) - var err error - clientCtx, err = config.ReadFromClientConfig(clientCtx) - if err != nil { - return autocli.AppOptions{}, err - } - autoCliOpts.ClientCtx = clientCtx - autoCliOpts.Keyring, err = keyring.NewAutoCLIKeyring(clientCtx.Keyring) - if err != nil { - return autocli.AppOptions{}, err - } return autoCliOpts, nil } diff --git a/cmd/interchain-security-cdd/cmd/root.go b/cmd/interchain-security-cdd/cmd/root.go index b71e1422c1..63f4dfec3b 100644 --- a/cmd/interchain-security-cdd/cmd/root.go +++ b/cmd/interchain-security-cdd/cmd/root.go @@ -19,7 +19,6 @@ import ( "github.com/cosmos/cosmos-sdk/client/rpc" "github.com/cosmos/cosmos-sdk/codec" addresscodec "github.com/cosmos/cosmos-sdk/codec/address" - "github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/cosmos/cosmos-sdk/server" serverconfig "github.com/cosmos/cosmos-sdk/server/config" servertypes "github.com/cosmos/cosmos-sdk/server/types" @@ -128,17 +127,7 @@ func enrichAutoCliOpts(autoCliOpts autocli.AppOptions, clientCtx client.Context) autoCliOpts.ValidatorAddressCodec = addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()) autoCliOpts.ConsensusAddressCodec = addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix()) - var err error - clientCtx, err = config.ReadFromClientConfig(clientCtx) - if err != nil { - return autocli.AppOptions{}, err - } - autoCliOpts.ClientCtx = clientCtx - autoCliOpts.Keyring, err = keyring.NewAutoCLIKeyring(clientCtx.Keyring) - if err != nil { - return autocli.AppOptions{}, err - } return autoCliOpts, nil } diff --git a/cmd/interchain-security-pd/cmd/root.go b/cmd/interchain-security-pd/cmd/root.go index da0d719981..8079c6b2b7 100644 --- a/cmd/interchain-security-pd/cmd/root.go +++ b/cmd/interchain-security-pd/cmd/root.go @@ -19,7 +19,6 @@ import ( "github.com/cosmos/cosmos-sdk/client/rpc" "github.com/cosmos/cosmos-sdk/codec" addresscodec "github.com/cosmos/cosmos-sdk/codec/address" - "github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/cosmos/cosmos-sdk/server" serverconfig "github.com/cosmos/cosmos-sdk/server/config" servertypes "github.com/cosmos/cosmos-sdk/server/types" @@ -129,17 +128,7 @@ func enrichAutoCliOpts(autoCliOpts autocli.AppOptions, clientCtx client.Context) autoCliOpts.ValidatorAddressCodec = addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()) autoCliOpts.ConsensusAddressCodec = addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix()) - var err error - clientCtx, err = config.ReadFromClientConfig(clientCtx) - if err != nil { - return autocli.AppOptions{}, err - } - autoCliOpts.ClientCtx = clientCtx - autoCliOpts.Keyring, err = keyring.NewAutoCLIKeyring(clientCtx.Keyring) - if err != nil { - return autocli.AppOptions{}, err - } return autoCliOpts, nil } diff --git a/cmd/interchain-security-sd/cmd/root.go b/cmd/interchain-security-sd/cmd/root.go index 5e65e536fb..97cba41bcf 100644 --- a/cmd/interchain-security-sd/cmd/root.go +++ b/cmd/interchain-security-sd/cmd/root.go @@ -19,7 +19,6 @@ import ( "github.com/cosmos/cosmos-sdk/client/rpc" "github.com/cosmos/cosmos-sdk/codec" addresscodec "github.com/cosmos/cosmos-sdk/codec/address" - "github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/cosmos/cosmos-sdk/server" serverconfig "github.com/cosmos/cosmos-sdk/server/config" servertypes "github.com/cosmos/cosmos-sdk/server/types" @@ -128,17 +127,7 @@ func enrichAutoCliOpts(autoCliOpts autocli.AppOptions, clientCtx client.Context) autoCliOpts.ValidatorAddressCodec = addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()) autoCliOpts.ConsensusAddressCodec = addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix()) - var err error - clientCtx, err = config.ReadFromClientConfig(clientCtx) - if err != nil { - return autocli.AppOptions{}, err - } - autoCliOpts.ClientCtx = clientCtx - autoCliOpts.Keyring, err = keyring.NewAutoCLIKeyring(clientCtx.Keyring) - if err != nil { - return autocli.AppOptions{}, err - } return autoCliOpts, nil } From 25eb3df1b4bf20dfec0699637367baf8a9c48e81 Mon Sep 17 00:00:00 2001 From: Marius Poke Date: Fri, 6 Sep 2024 13:51:21 +0200 Subject: [PATCH 13/28] chore: bump ics version to v6 (#2229) bump ics version to v6 --- .../ante/forbidden_proposals_ante_test.go | 4 +- app/consumer-democracy/ante_handler.go | 6 +- app/consumer-democracy/app.go | 16 +- .../ante/disabled_modules_ante_test.go | 4 +- app/consumer/ante/msg_filter_ante_test.go | 4 +- app/consumer/ante_handler.go | 4 +- app/consumer/app.go | 10 +- app/consumer/genesis.go | 4 +- app/consumer/genesis_test.go | 6 +- app/provider/app.go | 14 +- app/provider/sim_test.go | 2 +- app/sovereign/app.go | 4 +- cmd/interchain-security-cd/cmd/root.go | 4 +- cmd/interchain-security-cd/main.go | 6 +- cmd/interchain-security-cdd/cmd/root.go | 4 +- cmd/interchain-security-cdd/main.go | 6 +- cmd/interchain-security-pd/cmd/root.go | 4 +- cmd/interchain-security-pd/main.go | 6 +- cmd/interchain-security-sd/cmd/root.go | 4 +- cmd/interchain-security-sd/main.go | 6 +- go.mod | 2 +- .../ccv/consumer/v1/consumer.proto | 2 +- .../ccv/consumer/v1/genesis.proto | 2 +- .../ccv/consumer/v1/query.proto | 2 +- .../ccv/consumer/v1/tx.proto | 2 +- .../ccv/provider/v1/genesis.proto | 2 +- .../ccv/provider/v1/provider.proto | 2 +- .../ccv/provider/v1/query.proto | 2 +- .../ccv/provider/v1/tx.proto | 2 +- .../ccv/v1/shared_consumer.proto | 2 +- proto/interchain_security/ccv/v1/wire.proto | 2 +- scripts/protocgen.sh | 2 +- tests/e2e/actions.go | 8 +- tests/e2e/config.go | 2 +- tests/e2e/json_marshal_test.go | 2 +- tests/e2e/state.go | 4 +- tests/e2e/steps_compatibility.go | 2 +- tests/e2e/test_driver.go | 2 +- tests/e2e/v4/state.go | 2 +- tests/integration/common.go | 8 +- tests/integration/democracy.go | 6 +- tests/integration/distribution.go | 12 +- tests/integration/double_vote.go | 4 +- tests/integration/expired_client.go | 2 +- tests/integration/instance_test.go | 10 +- tests/integration/key_assignment.go | 4 +- tests/integration/misbehaviour.go | 4 +- tests/integration/normal_operations.go | 4 +- .../integration/partial_set_security_test.go | 10 +- tests/integration/setup.go | 10 +- tests/integration/slashing.go | 8 +- tests/integration/stop_consumer.go | 4 +- tests/integration/throttle.go | 8 +- tests/integration/throttle_retry.go | 2 +- tests/integration/valset_update.go | 2 +- tests/mbt/driver/core.go | 14 +- tests/mbt/driver/mbt_test.go | 6 +- tests/mbt/driver/setup.go | 14 +- testutil/crypto/crypto.go | 2 +- testutil/ibc_testing/generic_setup.go | 8 +- testutil/ibc_testing/specific_setup.go | 10 +- testutil/integration/debug_test.go | 10 +- testutil/integration/interfaces.go | 6 +- testutil/keeper/expectations.go | 4 +- testutil/keeper/unit_test_helpers.go | 10 +- x/ccv/consumer/client/cli/query.go | 2 +- x/ccv/consumer/ibc_module.go | 6 +- x/ccv/consumer/ibc_module_test.go | 8 +- x/ccv/consumer/keeper/changeover_test.go | 4 +- x/ccv/consumer/keeper/distribution.go | 4 +- x/ccv/consumer/keeper/distribution_test.go | 6 +- x/ccv/consumer/keeper/genesis.go | 4 +- x/ccv/consumer/keeper/genesis_test.go | 10 +- x/ccv/consumer/keeper/grpc_query.go | 4 +- x/ccv/consumer/keeper/hooks.go | 2 +- x/ccv/consumer/keeper/keeper.go | 4 +- x/ccv/consumer/keeper/keeper_test.go | 8 +- x/ccv/consumer/keeper/migrations.go | 4 +- x/ccv/consumer/keeper/msg_server.go | 2 +- x/ccv/consumer/keeper/params.go | 4 +- x/ccv/consumer/keeper/params_test.go | 4 +- x/ccv/consumer/keeper/provider_info.go | 4 +- x/ccv/consumer/keeper/relay.go | 4 +- x/ccv/consumer/keeper/relay_test.go | 10 +- x/ccv/consumer/keeper/throttle_retry.go | 2 +- x/ccv/consumer/keeper/throttle_retry_test.go | 6 +- x/ccv/consumer/keeper/validators.go | 2 +- x/ccv/consumer/keeper/validators_test.go | 8 +- x/ccv/consumer/migrations/v2/migration.go | 4 +- .../consumer/migrations/v2/migration_test.go | 8 +- x/ccv/consumer/migrations/v3/legacy_params.go | 2 +- x/ccv/consumer/migrations/v3/migration.go | 4 +- .../consumer/migrations/v3/migration_test.go | 6 +- x/ccv/consumer/module.go | 8 +- x/ccv/consumer/types/consumer.pb.go | 50 ++-- x/ccv/consumer/types/genesis.go | 2 +- x/ccv/consumer/types/genesis.pb.go | 48 ++-- x/ccv/consumer/types/genesis_test.go | 6 +- x/ccv/consumer/types/keys.go | 2 +- x/ccv/consumer/types/params_test.go | 2 +- x/ccv/consumer/types/query.pb.go | 6 +- x/ccv/consumer/types/tx.pb.go | 6 +- x/ccv/democracy/distribution/module.go | 2 +- x/ccv/provider/client/cli/query.go | 2 +- x/ccv/provider/client/cli/tx.go | 2 +- x/ccv/provider/client/legacy_proposals.go | 2 +- x/ccv/provider/handler.go | 4 +- x/ccv/provider/handler_test.go | 10 +- x/ccv/provider/ibc_middleware.go | 4 +- x/ccv/provider/ibc_middleware_test.go | 2 +- x/ccv/provider/ibc_module.go | 6 +- x/ccv/provider/ibc_module_test.go | 10 +- .../provider/keeper/consumer_equivocation.go | 4 +- .../keeper/consumer_equivocation_test.go | 6 +- x/ccv/provider/keeper/consumer_lifecycle.go | 4 +- .../keeper/consumer_lifecycle_test.go | 10 +- x/ccv/provider/keeper/distribution.go | 2 +- x/ccv/provider/keeper/distribution_test.go | 4 +- x/ccv/provider/keeper/genesis.go | 4 +- x/ccv/provider/keeper/genesis_test.go | 10 +- x/ccv/provider/keeper/grpc_query.go | 4 +- x/ccv/provider/keeper/grpc_query_test.go | 10 +- x/ccv/provider/keeper/hooks.go | 4 +- x/ccv/provider/keeper/hooks_test.go | 8 +- x/ccv/provider/keeper/invariants.go | 2 +- x/ccv/provider/keeper/keeper.go | 6 +- x/ccv/provider/keeper/keeper_test.go | 8 +- x/ccv/provider/keeper/key_assignment.go | 4 +- x/ccv/provider/keeper/key_assignment_test.go | 10 +- x/ccv/provider/keeper/msg_server.go | 4 +- x/ccv/provider/keeper/msg_server_test.go | 6 +- x/ccv/provider/keeper/params.go | 2 +- x/ccv/provider/keeper/params_test.go | 4 +- x/ccv/provider/keeper/partial_set_security.go | 4 +- .../keeper/partial_set_security_test.go | 8 +- x/ccv/provider/keeper/permissionless.go | 2 +- x/ccv/provider/keeper/permissionless_test.go | 4 +- x/ccv/provider/keeper/power_shaping.go | 4 +- x/ccv/provider/keeper/power_shaping_test.go | 6 +- x/ccv/provider/keeper/provider_consensus.go | 2 +- .../keeper/provider_consensus_test.go | 4 +- x/ccv/provider/keeper/relay.go | 4 +- x/ccv/provider/keeper/relay_test.go | 10 +- .../keeper/staking_keeper_interface_test.go | 2 +- x/ccv/provider/keeper/throttle.go | 2 +- x/ccv/provider/keeper/throttle_test.go | 4 +- .../provider/keeper/validator_set_storage.go | 2 +- x/ccv/provider/keeper/validator_set_update.go | 4 +- .../keeper/validator_set_update_test.go | 8 +- x/ccv/provider/migrations/migrator.go | 6 +- x/ccv/provider/migrations/v7/legacy_params.go | 4 +- x/ccv/provider/migrations/v7/migrations.go | 4 +- .../provider/migrations/v7/migrations_test.go | 6 +- x/ccv/provider/migrations/v8/migrations.go | 6 +- .../provider/migrations/v8/migrations_test.go | 4 +- x/ccv/provider/module.go | 10 +- x/ccv/provider/module_test.go | 10 +- x/ccv/provider/proposal_handler.go | 4 +- x/ccv/provider/proposal_handler_test.go | 6 +- x/ccv/provider/simulation/genesis.go | 2 +- x/ccv/provider/types/consumer.go | 2 +- x/ccv/provider/types/genesis.go | 2 +- x/ccv/provider/types/genesis.pb.go | 6 +- x/ccv/provider/types/genesis_test.go | 6 +- x/ccv/provider/types/key_assignment.go | 2 +- x/ccv/provider/types/keys.go | 2 +- x/ccv/provider/types/keys_test.go | 6 +- x/ccv/provider/types/msg.go | 2 +- x/ccv/provider/types/msg_test.go | 4 +- x/ccv/provider/types/params.go | 2 +- x/ccv/provider/types/params_test.go | 2 +- x/ccv/provider/types/provider.pb.go | 6 +- x/ccv/provider/types/query.pb.go | 266 +++++++++--------- x/ccv/provider/types/tx.pb.go | 156 +++++----- x/ccv/types/shared_consumer.pb.go | 4 +- x/ccv/types/utils_test.go | 2 +- x/ccv/types/wire.pb.go | 100 +++---- x/ccv/types/wire_test.go | 4 +- 178 files changed, 739 insertions(+), 739 deletions(-) diff --git a/app/consumer-democracy/ante/forbidden_proposals_ante_test.go b/app/consumer-democracy/ante/forbidden_proposals_ante_test.go index e1e1fda79b..58b8284b78 100644 --- a/app/consumer-democracy/ante/forbidden_proposals_ante_test.go +++ b/app/consumer-democracy/ante/forbidden_proposals_ante_test.go @@ -13,8 +13,8 @@ import ( minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" "github.com/cosmos/cosmos-sdk/x/params/types/proposal" - app "github.com/cosmos/interchain-security/v5/app/consumer-democracy" - "github.com/cosmos/interchain-security/v5/app/consumer-democracy/ante" + app "github.com/cosmos/interchain-security/v6/app/consumer-democracy" + "github.com/cosmos/interchain-security/v6/app/consumer-democracy/ante" ) // in SDKv47 parameter updates full params object is required diff --git a/app/consumer-democracy/ante_handler.go b/app/consumer-democracy/ante_handler.go index a8efdfffb3..42016627b7 100644 --- a/app/consumer-democracy/ante_handler.go +++ b/app/consumer-democracy/ante_handler.go @@ -10,9 +10,9 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/auth/ante" - democracyante "github.com/cosmos/interchain-security/v5/app/consumer-democracy/ante" - consumerante "github.com/cosmos/interchain-security/v5/app/consumer/ante" - ibcconsumerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/consumer/keeper" + democracyante "github.com/cosmos/interchain-security/v6/app/consumer-democracy/ante" + consumerante "github.com/cosmos/interchain-security/v6/app/consumer/ante" + ibcconsumerkeeper "github.com/cosmos/interchain-security/v6/x/ccv/consumer/keeper" ) // HandlerOptions extend the SDK's AnteHandler options by requiring the IBC diff --git a/app/consumer-democracy/app.go b/app/consumer-democracy/app.go index 6ceb8952e4..dbe2f8cb9e 100644 --- a/app/consumer-democracy/app.go +++ b/app/consumer-democracy/app.go @@ -109,14 +109,14 @@ import ( tmos "github.com/cometbft/cometbft/libs/os" dbm "github.com/cosmos/cosmos-db" - appencoding "github.com/cosmos/interchain-security/v5/app/encoding" - testutil "github.com/cosmos/interchain-security/v5/testutil/integration" - consumer "github.com/cosmos/interchain-security/v5/x/ccv/consumer" - consumerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/consumer/keeper" - consumertypes "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" - ccvdistr "github.com/cosmos/interchain-security/v5/x/ccv/democracy/distribution" - ccvgov "github.com/cosmos/interchain-security/v5/x/ccv/democracy/governance" - ccvstaking "github.com/cosmos/interchain-security/v5/x/ccv/democracy/staking" + appencoding "github.com/cosmos/interchain-security/v6/app/encoding" + testutil "github.com/cosmos/interchain-security/v6/testutil/integration" + consumer "github.com/cosmos/interchain-security/v6/x/ccv/consumer" + consumerkeeper "github.com/cosmos/interchain-security/v6/x/ccv/consumer/keeper" + consumertypes "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" + ccvdistr "github.com/cosmos/interchain-security/v6/x/ccv/democracy/distribution" + ccvgov "github.com/cosmos/interchain-security/v6/x/ccv/democracy/governance" + ccvstaking "github.com/cosmos/interchain-security/v6/x/ccv/democracy/staking" ) const ( diff --git a/app/consumer/ante/disabled_modules_ante_test.go b/app/consumer/ante/disabled_modules_ante_test.go index 187d8bc956..f68ae5a4b8 100644 --- a/app/consumer/ante/disabled_modules_ante_test.go +++ b/app/consumer/ante/disabled_modules_ante_test.go @@ -12,8 +12,8 @@ import ( banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" - "github.com/cosmos/interchain-security/v5/app/consumer/ante" - appencoding "github.com/cosmos/interchain-security/v5/app/encoding" + "github.com/cosmos/interchain-security/v6/app/consumer/ante" + appencoding "github.com/cosmos/interchain-security/v6/app/encoding" ) func TestDisabledModulesDecorator(t *testing.T) { diff --git a/app/consumer/ante/msg_filter_ante_test.go b/app/consumer/ante/msg_filter_ante_test.go index 9080844c03..4c33537223 100644 --- a/app/consumer/ante/msg_filter_ante_test.go +++ b/app/consumer/ante/msg_filter_ante_test.go @@ -9,8 +9,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/interchain-security/v5/app/consumer/ante" - appencoding "github.com/cosmos/interchain-security/v5/app/encoding" + "github.com/cosmos/interchain-security/v6/app/consumer/ante" + appencoding "github.com/cosmos/interchain-security/v6/app/encoding" ) type consumerKeeper struct { diff --git a/app/consumer/ante_handler.go b/app/consumer/ante_handler.go index 24dcfea0e9..4d7b788603 100644 --- a/app/consumer/ante_handler.go +++ b/app/consumer/ante_handler.go @@ -10,8 +10,8 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/auth/ante" - consumerante "github.com/cosmos/interchain-security/v5/app/consumer/ante" - ibcconsumerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/consumer/keeper" + consumerante "github.com/cosmos/interchain-security/v6/app/consumer/ante" + ibcconsumerkeeper "github.com/cosmos/interchain-security/v6/x/ccv/consumer/keeper" ) // HandlerOptions extend the SDK's AnteHandler options by requiring the IBC diff --git a/app/consumer/app.go b/app/consumer/app.go index 28e0e642e5..5c940f5a9d 100644 --- a/app/consumer/app.go +++ b/app/consumer/app.go @@ -93,11 +93,11 @@ import ( tmos "github.com/cometbft/cometbft/libs/os" dbm "github.com/cosmos/cosmos-db" - appencoding "github.com/cosmos/interchain-security/v5/app/encoding" - testutil "github.com/cosmos/interchain-security/v5/testutil/integration" - ibcconsumer "github.com/cosmos/interchain-security/v5/x/ccv/consumer" - ibcconsumerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/consumer/keeper" - ibcconsumertypes "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" + appencoding "github.com/cosmos/interchain-security/v6/app/encoding" + testutil "github.com/cosmos/interchain-security/v6/testutil/integration" + ibcconsumer "github.com/cosmos/interchain-security/v6/x/ccv/consumer" + ibcconsumerkeeper "github.com/cosmos/interchain-security/v6/x/ccv/consumer/keeper" + ibcconsumertypes "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" ) const ( diff --git a/app/consumer/genesis.go b/app/consumer/genesis.go index ed7e1e7831..501c31d3e2 100644 --- a/app/consumer/genesis.go +++ b/app/consumer/genesis.go @@ -15,8 +15,8 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" - consumerTypes "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" - "github.com/cosmos/interchain-security/v5/x/ccv/types" + consumerTypes "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" + "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // The genesis state of the blockchain is represented here as a map of raw json diff --git a/app/consumer/genesis_test.go b/app/consumer/genesis_test.go index e91c8a66d5..144dbd74c9 100644 --- a/app/consumer/genesis_test.go +++ b/app/consumer/genesis_test.go @@ -16,9 +16,9 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/x/auth/types" - app "github.com/cosmos/interchain-security/v5/app/consumer" - consumerTypes "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + app "github.com/cosmos/interchain-security/v6/app/consumer" + consumerTypes "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) const ( diff --git a/app/provider/app.go b/app/provider/app.go index 0e6e4b3b80..cdeb56003f 100644 --- a/app/provider/app.go +++ b/app/provider/app.go @@ -109,13 +109,13 @@ import ( tmjson "github.com/cometbft/cometbft/libs/json" tmos "github.com/cometbft/cometbft/libs/os" - appencoding "github.com/cosmos/interchain-security/v5/app/encoding" - testutil "github.com/cosmos/interchain-security/v5/testutil/integration" - no_valupdates_genutil "github.com/cosmos/interchain-security/v5/x/ccv/no_valupdates_genutil" - no_valupdates_staking "github.com/cosmos/interchain-security/v5/x/ccv/no_valupdates_staking" - ibcprovider "github.com/cosmos/interchain-security/v5/x/ccv/provider" - ibcproviderkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + appencoding "github.com/cosmos/interchain-security/v6/app/encoding" + testutil "github.com/cosmos/interchain-security/v6/testutil/integration" + no_valupdates_genutil "github.com/cosmos/interchain-security/v6/x/ccv/no_valupdates_genutil" + no_valupdates_staking "github.com/cosmos/interchain-security/v6/x/ccv/no_valupdates_staking" + ibcprovider "github.com/cosmos/interchain-security/v6/x/ccv/provider" + ibcproviderkeeper "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) const ( diff --git a/app/provider/sim_test.go b/app/provider/sim_test.go index ef938b0b53..cb82640a7b 100644 --- a/app/provider/sim_test.go +++ b/app/provider/sim_test.go @@ -18,7 +18,7 @@ import ( simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - providerapp "github.com/cosmos/interchain-security/v5/app/provider" + providerapp "github.com/cosmos/interchain-security/v6/app/provider" spew "github.com/davecgh/go-spew/spew" ) diff --git a/app/sovereign/app.go b/app/sovereign/app.go index b5653995b6..5e86e04ec4 100644 --- a/app/sovereign/app.go +++ b/app/sovereign/app.go @@ -109,8 +109,8 @@ import ( tmos "github.com/cometbft/cometbft/libs/os" dbm "github.com/cosmos/cosmos-db" - appencoding "github.com/cosmos/interchain-security/v5/app/encoding" - testutil "github.com/cosmos/interchain-security/v5/testutil/integration" + appencoding "github.com/cosmos/interchain-security/v6/app/encoding" + testutil "github.com/cosmos/interchain-security/v6/testutil/integration" ) const ( diff --git a/cmd/interchain-security-cd/cmd/root.go b/cmd/interchain-security-cd/cmd/root.go index 5708d94b1b..6462b31a7f 100644 --- a/cmd/interchain-security-cd/cmd/root.go +++ b/cmd/interchain-security-cd/cmd/root.go @@ -32,8 +32,8 @@ import ( tmcfg "github.com/cometbft/cometbft/config" dbm "github.com/cosmos/cosmos-db" - consumer "github.com/cosmos/interchain-security/v5/app/consumer" - appencoding "github.com/cosmos/interchain-security/v5/app/encoding" + consumer "github.com/cosmos/interchain-security/v6/app/consumer" + appencoding "github.com/cosmos/interchain-security/v6/app/encoding" ) // NewRootCmd creates a new root command for simd. It is called once in the diff --git a/cmd/interchain-security-cd/main.go b/cmd/interchain-security-cd/main.go index 6b36b93859..c59e7e1891 100644 --- a/cmd/interchain-security-cd/main.go +++ b/cmd/interchain-security-cd/main.go @@ -6,9 +6,9 @@ import ( svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" - app "github.com/cosmos/interchain-security/v5/app/consumer" - appparams "github.com/cosmos/interchain-security/v5/app/params" - "github.com/cosmos/interchain-security/v5/cmd/interchain-security-cd/cmd" + app "github.com/cosmos/interchain-security/v6/app/consumer" + appparams "github.com/cosmos/interchain-security/v6/app/params" + "github.com/cosmos/interchain-security/v6/cmd/interchain-security-cd/cmd" ) func main() { diff --git a/cmd/interchain-security-cdd/cmd/root.go b/cmd/interchain-security-cdd/cmd/root.go index 63f4dfec3b..a162943da1 100644 --- a/cmd/interchain-security-cdd/cmd/root.go +++ b/cmd/interchain-security-cdd/cmd/root.go @@ -36,8 +36,8 @@ import ( tmcfg "github.com/cometbft/cometbft/config" dbm "github.com/cosmos/cosmos-db" - cdd "github.com/cosmos/interchain-security/v5/app/consumer-democracy" - appencoding "github.com/cosmos/interchain-security/v5/app/encoding" + cdd "github.com/cosmos/interchain-security/v6/app/consumer-democracy" + appencoding "github.com/cosmos/interchain-security/v6/app/encoding" ) // NewRootCmd creates a new root command for simd. It is called once in the diff --git a/cmd/interchain-security-cdd/main.go b/cmd/interchain-security-cdd/main.go index d6a5d29d22..54f9334aed 100644 --- a/cmd/interchain-security-cdd/main.go +++ b/cmd/interchain-security-cdd/main.go @@ -6,9 +6,9 @@ import ( svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" - app "github.com/cosmos/interchain-security/v5/app/consumer-democracy" - appparams "github.com/cosmos/interchain-security/v5/app/params" - "github.com/cosmos/interchain-security/v5/cmd/interchain-security-cdd/cmd" + app "github.com/cosmos/interchain-security/v6/app/consumer-democracy" + appparams "github.com/cosmos/interchain-security/v6/app/params" + "github.com/cosmos/interchain-security/v6/cmd/interchain-security-cdd/cmd" ) func main() { diff --git a/cmd/interchain-security-pd/cmd/root.go b/cmd/interchain-security-pd/cmd/root.go index 8079c6b2b7..105233f8d5 100644 --- a/cmd/interchain-security-pd/cmd/root.go +++ b/cmd/interchain-security-pd/cmd/root.go @@ -36,8 +36,8 @@ import ( cmtcfg "github.com/cometbft/cometbft/config" dbm "github.com/cosmos/cosmos-db" - appEncoding "github.com/cosmos/interchain-security/v5/app/encoding" - providerApp "github.com/cosmos/interchain-security/v5/app/provider" + appEncoding "github.com/cosmos/interchain-security/v6/app/encoding" + providerApp "github.com/cosmos/interchain-security/v6/app/provider" ) // NewRootCmd creates a new root command for simd. It is called once in the diff --git a/cmd/interchain-security-pd/main.go b/cmd/interchain-security-pd/main.go index daf68d27d5..129afdaa33 100644 --- a/cmd/interchain-security-pd/main.go +++ b/cmd/interchain-security-pd/main.go @@ -6,9 +6,9 @@ import ( svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" - appparams "github.com/cosmos/interchain-security/v5/app/params" - app "github.com/cosmos/interchain-security/v5/app/provider" - "github.com/cosmos/interchain-security/v5/cmd/interchain-security-pd/cmd" + appparams "github.com/cosmos/interchain-security/v6/app/params" + app "github.com/cosmos/interchain-security/v6/app/provider" + "github.com/cosmos/interchain-security/v6/cmd/interchain-security-pd/cmd" ) func main() { diff --git a/cmd/interchain-security-sd/cmd/root.go b/cmd/interchain-security-sd/cmd/root.go index 97cba41bcf..a17d1ee3bf 100644 --- a/cmd/interchain-security-sd/cmd/root.go +++ b/cmd/interchain-security-sd/cmd/root.go @@ -36,8 +36,8 @@ import ( tmcfg "github.com/cometbft/cometbft/config" dbm "github.com/cosmos/cosmos-db" - appencoding "github.com/cosmos/interchain-security/v5/app/encoding" - sovereignApp "github.com/cosmos/interchain-security/v5/app/sovereign" + appencoding "github.com/cosmos/interchain-security/v6/app/encoding" + sovereignApp "github.com/cosmos/interchain-security/v6/app/sovereign" ) // NewRootCmd creates a new root command for simd. It is called once in the diff --git a/cmd/interchain-security-sd/main.go b/cmd/interchain-security-sd/main.go index dbd46acc60..6703ab3581 100644 --- a/cmd/interchain-security-sd/main.go +++ b/cmd/interchain-security-sd/main.go @@ -6,10 +6,10 @@ import ( svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" - appparams "github.com/cosmos/interchain-security/v5/app/params" - app "github.com/cosmos/interchain-security/v5/app/sovereign" + appparams "github.com/cosmos/interchain-security/v6/app/params" + app "github.com/cosmos/interchain-security/v6/app/sovereign" - "github.com/cosmos/interchain-security/v5/cmd/interchain-security-sd/cmd" + "github.com/cosmos/interchain-security/v6/cmd/interchain-security-sd/cmd" ) func main() { diff --git a/go.mod b/go.mod index 351f9d0a53..dc44019368 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/cosmos/interchain-security/v5 +module github.com/cosmos/interchain-security/v6 go 1.22.2 diff --git a/proto/interchain_security/ccv/consumer/v1/consumer.proto b/proto/interchain_security/ccv/consumer/v1/consumer.proto index e77b5c9a13..f582016461 100644 --- a/proto/interchain_security/ccv/consumer/v1/consumer.proto +++ b/proto/interchain_security/ccv/consumer/v1/consumer.proto @@ -1,7 +1,7 @@ syntax = "proto3"; package interchain_security.ccv.consumer.v1; -option go_package = "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types"; +option go_package = "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types"; import "google/protobuf/any.proto"; import "gogoproto/gogo.proto"; diff --git a/proto/interchain_security/ccv/consumer/v1/genesis.proto b/proto/interchain_security/ccv/consumer/v1/genesis.proto index 642b78451d..69a765b8e2 100644 --- a/proto/interchain_security/ccv/consumer/v1/genesis.proto +++ b/proto/interchain_security/ccv/consumer/v1/genesis.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package interchain_security.ccv.consumer.v1; -option go_package = "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types"; +option go_package = "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types"; import "interchain_security/ccv/v1/shared_consumer.proto"; import "ibc/lightclients/tendermint/v1/tendermint.proto"; diff --git a/proto/interchain_security/ccv/consumer/v1/query.proto b/proto/interchain_security/ccv/consumer/v1/query.proto index 0e9b088e1d..82530307af 100644 --- a/proto/interchain_security/ccv/consumer/v1/query.proto +++ b/proto/interchain_security/ccv/consumer/v1/query.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package interchain_security.ccv.consumer.v1; import "interchain_security/ccv/v1/shared_consumer.proto"; -option go_package = "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types"; +option go_package = "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; diff --git a/proto/interchain_security/ccv/consumer/v1/tx.proto b/proto/interchain_security/ccv/consumer/v1/tx.proto index e76b8dd3b9..4a256fe6f3 100644 --- a/proto/interchain_security/ccv/consumer/v1/tx.proto +++ b/proto/interchain_security/ccv/consumer/v1/tx.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package interchain_security.ccv.consumer.v1; -option go_package = "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types"; +option go_package = "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types"; import "amino/amino.proto"; import "google/api/annotations.proto"; diff --git a/proto/interchain_security/ccv/provider/v1/genesis.proto b/proto/interchain_security/ccv/provider/v1/genesis.proto index 0f212b0271..ff5c0c4725 100644 --- a/proto/interchain_security/ccv/provider/v1/genesis.proto +++ b/proto/interchain_security/ccv/provider/v1/genesis.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package interchain_security.ccv.provider.v1; -option go_package = "github.com/cosmos/interchain-security/v5/x/ccv/provider/types"; +option go_package = "github.com/cosmos/interchain-security/v6/x/ccv/provider/types"; import "gogoproto/gogo.proto"; import "interchain_security/ccv/v1/shared_consumer.proto"; diff --git a/proto/interchain_security/ccv/provider/v1/provider.proto b/proto/interchain_security/ccv/provider/v1/provider.proto index f1af229759..1cf26b7263 100644 --- a/proto/interchain_security/ccv/provider/v1/provider.proto +++ b/proto/interchain_security/ccv/provider/v1/provider.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package interchain_security.ccv.provider.v1; -option go_package = "github.com/cosmos/interchain-security/v5/x/ccv/provider/types"; +option go_package = "github.com/cosmos/interchain-security/v6/x/ccv/provider/types"; import "interchain_security/ccv/v1/wire.proto"; import "gogoproto/gogo.proto"; diff --git a/proto/interchain_security/ccv/provider/v1/query.proto b/proto/interchain_security/ccv/provider/v1/query.proto index 2b2b0dc60e..7b4ebcb080 100644 --- a/proto/interchain_security/ccv/provider/v1/query.proto +++ b/proto/interchain_security/ccv/provider/v1/query.proto @@ -1,7 +1,7 @@ syntax = "proto3"; package interchain_security.ccv.provider.v1; -option go_package = "github.com/cosmos/interchain-security/v5/x/ccv/provider/types"; +option go_package = "github.com/cosmos/interchain-security/v6/x/ccv/provider/types"; import "google/api/annotations.proto"; import "gogoproto/gogo.proto"; diff --git a/proto/interchain_security/ccv/provider/v1/tx.proto b/proto/interchain_security/ccv/provider/v1/tx.proto index d4f4eace11..84de528080 100644 --- a/proto/interchain_security/ccv/provider/v1/tx.proto +++ b/proto/interchain_security/ccv/provider/v1/tx.proto @@ -1,7 +1,7 @@ syntax = "proto3"; package interchain_security.ccv.provider.v1; -option go_package = "github.com/cosmos/interchain-security/v5/x/ccv/provider/types"; +option go_package = "github.com/cosmos/interchain-security/v6/x/ccv/provider/types"; import "amino/amino.proto"; import "google/api/annotations.proto"; diff --git a/proto/interchain_security/ccv/v1/shared_consumer.proto b/proto/interchain_security/ccv/v1/shared_consumer.proto index f1535df010..a89c8f3cd6 100644 --- a/proto/interchain_security/ccv/v1/shared_consumer.proto +++ b/proto/interchain_security/ccv/v1/shared_consumer.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package interchain_security.ccv.v1; -option go_package = "github.com/cosmos/interchain-security/v5/x/ccv/types"; +option go_package = "github.com/cosmos/interchain-security/v6/x/ccv/types"; import "tendermint/abci/types.proto"; import "ibc/lightclients/tendermint/v1/tendermint.proto"; diff --git a/proto/interchain_security/ccv/v1/wire.proto b/proto/interchain_security/ccv/v1/wire.proto index f0ba6ab41a..5a23280597 100644 --- a/proto/interchain_security/ccv/v1/wire.proto +++ b/proto/interchain_security/ccv/v1/wire.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package interchain_security.ccv.v1; -option go_package = "github.com/cosmos/interchain-security/v5/x/ccv/types"; +option go_package = "github.com/cosmos/interchain-security/v6/x/ccv/types"; import "cosmos/staking/v1beta1/staking.proto"; diff --git a/scripts/protocgen.sh b/scripts/protocgen.sh index fdf6a894c1..92f6004309 100755 --- a/scripts/protocgen.sh +++ b/scripts/protocgen.sh @@ -16,6 +16,6 @@ done cd .. # move proto files to the right places -cp -r github.com/cosmos/interchain-security/v5/* ./ +cp -r github.com/cosmos/interchain-security/v6/* ./ rm -rf github.com diff --git a/tests/e2e/actions.go b/tests/e2e/actions.go index 18f1c6de4a..8cafb2847a 100644 --- a/tests/e2e/actions.go +++ b/tests/e2e/actions.go @@ -21,10 +21,10 @@ import ( "golang.org/x/mod/semver" ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" - e2e "github.com/cosmos/interchain-security/v5/tests/e2e/testlib" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/client" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + e2e "github.com/cosmos/interchain-security/v6/tests/e2e/testlib" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/client" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) const ( diff --git a/tests/e2e/config.go b/tests/e2e/config.go index c3f8f712b1..9b0d24df3f 100644 --- a/tests/e2e/config.go +++ b/tests/e2e/config.go @@ -8,7 +8,7 @@ import ( "strings" "time" - e2e "github.com/cosmos/interchain-security/v5/tests/e2e/testlib" + e2e "github.com/cosmos/interchain-security/v6/tests/e2e/testlib" "golang.org/x/mod/semver" ) diff --git a/tests/e2e/json_marshal_test.go b/tests/e2e/json_marshal_test.go index 1265063e69..d4a41ad2fc 100644 --- a/tests/e2e/json_marshal_test.go +++ b/tests/e2e/json_marshal_test.go @@ -9,7 +9,7 @@ import ( gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - e2e "github.com/cosmos/interchain-security/v5/tests/e2e/testlib" + e2e "github.com/cosmos/interchain-security/v6/tests/e2e/testlib" "github.com/davecgh/go-spew/spew" ) diff --git a/tests/e2e/state.go b/tests/e2e/state.go index f6cac89947..4b43249af0 100644 --- a/tests/e2e/state.go +++ b/tests/e2e/state.go @@ -11,8 +11,8 @@ import ( "time" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - e2e "github.com/cosmos/interchain-security/v5/tests/e2e/testlib" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + e2e "github.com/cosmos/interchain-security/v6/tests/e2e/testlib" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" "github.com/kylelemons/godebug/pretty" "github.com/tidwall/gjson" "gopkg.in/yaml.v2" diff --git a/tests/e2e/steps_compatibility.go b/tests/e2e/steps_compatibility.go index ab6e9dbc47..9258d6ca6a 100644 --- a/tests/e2e/steps_compatibility.go +++ b/tests/e2e/steps_compatibility.go @@ -8,7 +8,7 @@ import ( gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) func compstepStartProviderChain() []Step { diff --git a/tests/e2e/test_driver.go b/tests/e2e/test_driver.go index 6c2bc35d77..8024b64b0f 100644 --- a/tests/e2e/test_driver.go +++ b/tests/e2e/test_driver.go @@ -5,7 +5,7 @@ import ( "log" "reflect" - v4 "github.com/cosmos/interchain-security/v5/tests/e2e/v4" + v4 "github.com/cosmos/interchain-security/v6/tests/e2e/v4" "github.com/kylelemons/godebug/pretty" "golang.org/x/mod/semver" ) diff --git a/tests/e2e/v4/state.go b/tests/e2e/v4/state.go index b4b7b70190..97ab7859ce 100644 --- a/tests/e2e/v4/state.go +++ b/tests/e2e/v4/state.go @@ -11,7 +11,7 @@ import ( gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - e2e "github.com/cosmos/interchain-security/v5/tests/e2e/testlib" + e2e "github.com/cosmos/interchain-security/v6/tests/e2e/testlib" "gopkg.in/yaml.v2" "github.com/kylelemons/godebug/pretty" diff --git a/tests/integration/common.go b/tests/integration/common.go index 97cd3fbf29..05e3dd5aff 100644 --- a/tests/integration/common.go +++ b/tests/integration/common.go @@ -22,10 +22,10 @@ import ( abci "github.com/cometbft/cometbft/abci/types" tmtypes "github.com/cometbft/cometbft/types" - icstestingutils "github.com/cosmos/interchain-security/v5/testutil/ibc_testing" - testutil "github.com/cosmos/interchain-security/v5/testutil/integration" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" - ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" + icstestingutils "github.com/cosmos/interchain-security/v6/testutil/ibc_testing" + testutil "github.com/cosmos/interchain-security/v6/testutil/integration" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // ChainType defines the type of chain (either provider or consumer) diff --git a/tests/integration/democracy.go b/tests/integration/democracy.go index 5fe7e9eb6d..db2947cad3 100644 --- a/tests/integration/democracy.go +++ b/tests/integration/democracy.go @@ -17,9 +17,9 @@ import ( minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - 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" + icstestingutils "github.com/cosmos/interchain-security/v6/testutil/ibc_testing" + testutil "github.com/cosmos/interchain-security/v6/testutil/integration" + consumertypes "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" ) type ConsumerDemocracyTestSuite struct { diff --git a/tests/integration/distribution.go b/tests/integration/distribution.go index 316b343f0a..dccd91bb22 100644 --- a/tests/integration/distribution.go +++ b/tests/integration/distribution.go @@ -12,12 +12,12 @@ import ( channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" sdk "github.com/cosmos/cosmos-sdk/types" - icstestingutils "github.com/cosmos/interchain-security/v5/testutil/integration" - consumerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/consumer/keeper" - consumertypes "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" - providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" - ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" + icstestingutils "github.com/cosmos/interchain-security/v6/testutil/integration" + consumerkeeper "github.com/cosmos/interchain-security/v6/x/ccv/consumer/keeper" + consumertypes "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" + providerkeeper "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // This test is valid for minimal viable consumer chain diff --git a/tests/integration/double_vote.go b/tests/integration/double_vote.go index b4c9f82c10..5df8d1dbda 100644 --- a/tests/integration/double_vote.go +++ b/tests/integration/double_vote.go @@ -8,8 +8,8 @@ import ( tmcrypto "github.com/cometbft/cometbft/crypto" tmtypes "github.com/cometbft/cometbft/types" - testutil "github.com/cosmos/interchain-security/v5/testutil/crypto" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + testutil "github.com/cosmos/interchain-security/v6/testutil/crypto" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) // TestHandleConsumerDoubleVoting verifies that handling a double voting evidence diff --git a/tests/integration/expired_client.go b/tests/integration/expired_client.go index 3d662382e1..6567cf8427 100644 --- a/tests/integration/expired_client.go +++ b/tests/integration/expired_client.go @@ -14,7 +14,7 @@ import ( abci "github.com/cometbft/cometbft/abci/types" - ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" + ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // TestVSCPacketSendExpiredClient tests queueing of VSCPackets when the consumer client is expired. diff --git a/tests/integration/instance_test.go b/tests/integration/instance_test.go index 424c6c85f5..0834ce57bd 100644 --- a/tests/integration/instance_test.go +++ b/tests/integration/instance_test.go @@ -5,11 +5,11 @@ import ( "github.com/stretchr/testify/suite" - appConsumer "github.com/cosmos/interchain-security/v5/app/consumer" - appConsumerDemocracy "github.com/cosmos/interchain-security/v5/app/consumer-democracy" - appProvider "github.com/cosmos/interchain-security/v5/app/provider" - intg "github.com/cosmos/interchain-security/v5/tests/integration" - icstestingutils "github.com/cosmos/interchain-security/v5/testutil/ibc_testing" + appConsumer "github.com/cosmos/interchain-security/v6/app/consumer" + appConsumerDemocracy "github.com/cosmos/interchain-security/v6/app/consumer-democracy" + appProvider "github.com/cosmos/interchain-security/v6/app/provider" + intg "github.com/cosmos/interchain-security/v6/tests/integration" + icstestingutils "github.com/cosmos/interchain-security/v6/testutil/ibc_testing" ) // This file can be used as an example integration testing instance for any provider/consumer applications. diff --git a/tests/integration/key_assignment.go b/tests/integration/key_assignment.go index 73defc1b57..d2420f8dc5 100644 --- a/tests/integration/key_assignment.go +++ b/tests/integration/key_assignment.go @@ -9,8 +9,8 @@ import ( tmencoding "github.com/cometbft/cometbft/crypto/encoding" tmprotocrypto "github.com/cometbft/cometbft/proto/tendermint/crypto" - providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" - ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" + providerkeeper "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" + ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" ) func (s *CCVTestSuite) TestKeyAssignment() { diff --git a/tests/integration/misbehaviour.go b/tests/integration/misbehaviour.go index 127b3a23a3..84edd0a979 100644 --- a/tests/integration/misbehaviour.go +++ b/tests/integration/misbehaviour.go @@ -10,8 +10,8 @@ import ( tmtypes "github.com/cometbft/cometbft/types" - testutil "github.com/cosmos/interchain-security/v5/testutil/crypto" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + testutil "github.com/cosmos/interchain-security/v6/testutil/crypto" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) // TestHandleConsumerMisbehaviour tests that handling a valid misbehaviour, diff --git a/tests/integration/normal_operations.go b/tests/integration/normal_operations.go index 155ac4f44d..bbd6b54856 100644 --- a/tests/integration/normal_operations.go +++ b/tests/integration/normal_operations.go @@ -5,8 +5,8 @@ import ( tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - consumertypes "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + consumertypes "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // Tests the tracking of historical info in the context of new blocks being committed diff --git a/tests/integration/partial_set_security_test.go b/tests/integration/partial_set_security_test.go index db628aaccd..3ad9c1c216 100644 --- a/tests/integration/partial_set_security_test.go +++ b/tests/integration/partial_set_security_test.go @@ -5,16 +5,16 @@ import ( "sort" "testing" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" "cosmossdk.io/math" - ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" + ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" "github.com/stretchr/testify/require" - icstestingutils "github.com/cosmos/interchain-security/v5/testutil/ibc_testing" + icstestingutils "github.com/cosmos/interchain-security/v6/testutil/ibc_testing" - appConsumer "github.com/cosmos/interchain-security/v5/app/consumer" - appProvider "github.com/cosmos/interchain-security/v5/app/provider" + appConsumer "github.com/cosmos/interchain-security/v6/app/consumer" + appProvider "github.com/cosmos/interchain-security/v6/app/provider" ) // we need a stake multiplier because tokens do not directly correspond to voting power diff --git a/tests/integration/setup.go b/tests/integration/setup.go index 218f6febb0..d8c037a77c 100644 --- a/tests/integration/setup.go +++ b/tests/integration/setup.go @@ -18,11 +18,11 @@ import ( abci "github.com/cometbft/cometbft/abci/types" tmencoding "github.com/cometbft/cometbft/crypto/encoding" - 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" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" - ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" + icstestingutils "github.com/cosmos/interchain-security/v6/testutil/ibc_testing" + testutil "github.com/cosmos/interchain-security/v6/testutil/integration" + consumertypes "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // Callback for instantiating a new coordinator with a provider test chains diff --git a/tests/integration/slashing.go b/tests/integration/slashing.go index 8156672a0d..b64ed76bfb 100644 --- a/tests/integration/slashing.go +++ b/tests/integration/slashing.go @@ -23,10 +23,10 @@ import ( "github.com/cometbft/cometbft/crypto/ed25519" tmtypes "github.com/cometbft/cometbft/types" - "github.com/cosmos/interchain-security/v5/testutil/integration" - keepertestutil "github.com/cosmos/interchain-security/v5/testutil/keeper" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" - ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" + "github.com/cosmos/interchain-security/v6/testutil/integration" + keepertestutil "github.com/cosmos/interchain-security/v6/testutil/keeper" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // TestRelayAndApplyDowntimePacket tests that downtime slash packets can be properly relayed diff --git a/tests/integration/stop_consumer.go b/tests/integration/stop_consumer.go index 8ce2e99cbf..682eb9b259 100644 --- a/tests/integration/stop_consumer.go +++ b/tests/integration/stop_consumer.go @@ -3,12 +3,12 @@ package integration import ( "cosmossdk.io/math" channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" + ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // Tests the functionality of stopping a consumer chain at a higher level than unit tests diff --git a/tests/integration/throttle.go b/tests/integration/throttle.go index f56228c56f..13201f67bc 100644 --- a/tests/integration/throttle.go +++ b/tests/integration/throttle.go @@ -11,10 +11,10 @@ import ( tmtypes "github.com/cometbft/cometbft/types" - icstestingutils "github.com/cosmos/interchain-security/v5/testutil/ibc_testing" - "github.com/cosmos/interchain-security/v5/x/ccv/provider" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + icstestingutils "github.com/cosmos/interchain-security/v6/testutil/ibc_testing" + "github.com/cosmos/interchain-security/v6/x/ccv/provider" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) const fullSlashMeterString = "1.0" diff --git a/tests/integration/throttle_retry.go b/tests/integration/throttle_retry.go index fcc795bb27..cacc7c8c12 100644 --- a/tests/integration/throttle_retry.go +++ b/tests/integration/throttle_retry.go @@ -7,7 +7,7 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // TestSlashRetries tests the throttling v2 retry logic at an integration level. diff --git a/tests/integration/valset_update.go b/tests/integration/valset_update.go index 994dfab4af..9b682823f4 100644 --- a/tests/integration/valset_update.go +++ b/tests/integration/valset_update.go @@ -10,7 +10,7 @@ import ( abci "github.com/cometbft/cometbft/abci/types" - ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" + ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // TestPacketRoundtrip tests a CCV packet roundtrip when tokens are bonded on provider diff --git a/tests/mbt/driver/core.go b/tests/mbt/driver/core.go index 897b713a42..cd487a7e98 100644 --- a/tests/mbt/driver/core.go +++ b/tests/mbt/driver/core.go @@ -25,13 +25,13 @@ import ( cmttypes "github.com/cometbft/cometbft/types" "github.com/cometbft/cometbft/proto/tendermint/crypto" - appConsumer "github.com/cosmos/interchain-security/v5/app/consumer" - appProvider "github.com/cosmos/interchain-security/v5/app/provider" - simibc "github.com/cosmos/interchain-security/v5/testutil/simibc" - consumerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/consumer/keeper" - consumertypes "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" - providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" - "github.com/cosmos/interchain-security/v5/x/ccv/types" + appConsumer "github.com/cosmos/interchain-security/v6/app/consumer" + appProvider "github.com/cosmos/interchain-security/v6/app/provider" + simibc "github.com/cosmos/interchain-security/v6/testutil/simibc" + consumerkeeper "github.com/cosmos/interchain-security/v6/x/ccv/consumer/keeper" + consumertypes "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" + providerkeeper "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" + "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // Define a new type for ChainIds to be more explicit diff --git a/tests/mbt/driver/mbt_test.go b/tests/mbt/driver/mbt_test.go index 278c276d82..4a5293f97d 100644 --- a/tests/mbt/driver/mbt_test.go +++ b/tests/mbt/driver/mbt_test.go @@ -21,10 +21,10 @@ import ( tmencoding "github.com/cometbft/cometbft/crypto/encoding" cmttypes "github.com/cometbft/cometbft/types" - "github.com/cosmos/interchain-security/v5/testutil/integration" + "github.com/cosmos/interchain-security/v6/testutil/integration" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" - "github.com/cosmos/interchain-security/v5/x/ccv/types" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + "github.com/cosmos/interchain-security/v6/x/ccv/types" ) const verbose = false diff --git a/tests/mbt/driver/setup.go b/tests/mbt/driver/setup.go index 97102960d6..e630434ea4 100644 --- a/tests/mbt/driver/setup.go +++ b/tests/mbt/driver/setup.go @@ -12,8 +12,8 @@ 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/cosmos/interchain-security/v6/x/ccv/provider/types" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" "github.com/stretchr/testify/require" "cosmossdk.io/math" @@ -32,11 +32,11 @@ import ( cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" cmttypes "github.com/cometbft/cometbft/types" - icstestingutils "github.com/cosmos/interchain-security/v5/testutil/ibc_testing" - "github.com/cosmos/interchain-security/v5/testutil/integration" - simibc "github.com/cosmos/interchain-security/v5/testutil/simibc" - consumertypes "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + icstestingutils "github.com/cosmos/interchain-security/v6/testutil/ibc_testing" + "github.com/cosmos/interchain-security/v6/testutil/integration" + simibc "github.com/cosmos/interchain-security/v6/testutil/simibc" + consumertypes "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) const ( diff --git a/testutil/crypto/crypto.go b/testutil/crypto/crypto.go index 88fc8c6c01..54f60c736f 100644 --- a/testutil/crypto/crypto.go +++ b/testutil/crypto/crypto.go @@ -15,7 +15,7 @@ import ( tmprotocrypto "github.com/cometbft/cometbft/proto/tendermint/crypto" tmtypes "github.com/cometbft/cometbft/types" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) // CryptoIdentity is a test helper for generating keys and addresses of diff --git a/testutil/ibc_testing/generic_setup.go b/testutil/ibc_testing/generic_setup.go index 84ccf347f2..c99970c718 100644 --- a/testutil/ibc_testing/generic_setup.go +++ b/testutil/ibc_testing/generic_setup.go @@ -8,7 +8,7 @@ import ( 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" + testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" @@ -18,9 +18,9 @@ import ( tmencoding "github.com/cometbft/cometbft/crypto/encoding" tmtypes "github.com/cometbft/cometbft/types" - testutil "github.com/cosmos/interchain-security/v5/testutil/integration" - consumerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/consumer/keeper" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + testutil "github.com/cosmos/interchain-security/v6/testutil/integration" + consumerkeeper "github.com/cosmos/interchain-security/v6/x/ccv/consumer/keeper" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) type ( diff --git a/testutil/ibc_testing/specific_setup.go b/testutil/ibc_testing/specific_setup.go index 2ff06ca757..16e21ce5ca 100644 --- a/testutil/ibc_testing/specific_setup.go +++ b/testutil/ibc_testing/specific_setup.go @@ -17,11 +17,11 @@ import ( "cosmossdk.io/log" "github.com/cometbft/cometbft/abci/types" - appConsumer "github.com/cosmos/interchain-security/v5/app/consumer" - appConsumerDemocracy "github.com/cosmos/interchain-security/v5/app/consumer-democracy" - appProvider "github.com/cosmos/interchain-security/v5/app/provider" - consumertypes "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + appConsumer "github.com/cosmos/interchain-security/v6/app/consumer" + appConsumerDemocracy "github.com/cosmos/interchain-security/v6/app/consumer-democracy" + appProvider "github.com/cosmos/interchain-security/v6/app/provider" + consumertypes "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) var ( diff --git a/testutil/integration/debug_test.go b/testutil/integration/debug_test.go index dedd937eaa..997df5c8c5 100644 --- a/testutil/integration/debug_test.go +++ b/testutil/integration/debug_test.go @@ -6,11 +6,11 @@ import ( "reflect" "testing" - appConsumer "github.com/cosmos/interchain-security/v5/app/consumer" - appConsumerDemocracy "github.com/cosmos/interchain-security/v5/app/consumer-democracy" - appProvider "github.com/cosmos/interchain-security/v5/app/provider" - integr "github.com/cosmos/interchain-security/v5/tests/integration" - icstestingutils "github.com/cosmos/interchain-security/v5/testutil/ibc_testing" + appConsumer "github.com/cosmos/interchain-security/v6/app/consumer" + appConsumerDemocracy "github.com/cosmos/interchain-security/v6/app/consumer-democracy" + appProvider "github.com/cosmos/interchain-security/v6/app/provider" + integr "github.com/cosmos/interchain-security/v6/tests/integration" + icstestingutils "github.com/cosmos/interchain-security/v6/testutil/ibc_testing" ) // runCCVTestByName runs a single CCV integration test by name, using a CCVTestSuite diff --git a/testutil/integration/interfaces.go b/testutil/integration/interfaces.go index de9c3a6b0d..7e8019a08a 100644 --- a/testutil/integration/interfaces.go +++ b/testutil/integration/interfaces.go @@ -22,9 +22,9 @@ import ( paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - consumerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/consumer/keeper" - providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + consumerkeeper "github.com/cosmos/interchain-security/v6/x/ccv/consumer/keeper" + providerkeeper "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // The interface that any provider app must implement to be compatible with ccv integration tests. diff --git a/testutil/keeper/expectations.go b/testutil/keeper/expectations.go index 53d16a6581..4996880c35 100644 --- a/testutil/keeper/expectations.go +++ b/testutil/keeper/expectations.go @@ -17,8 +17,8 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" - "github.com/cosmos/interchain-security/v5/x/ccv/types" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // diff --git a/testutil/keeper/unit_test_helpers.go b/testutil/keeper/unit_test_helpers.go index 1c11c2c7e9..57f0147ebf 100644 --- a/testutil/keeper/unit_test_helpers.go +++ b/testutil/keeper/unit_test_helpers.go @@ -31,12 +31,12 @@ import ( tmproto "github.com/cometbft/cometbft/proto/tendermint/types" govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" - consumerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/consumer/keeper" - consumertypes "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" - providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + consumerkeeper "github.com/cosmos/interchain-security/v6/x/ccv/consumer/keeper" + consumertypes "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" + providerkeeper "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" - "github.com/cosmos/interchain-security/v5/x/ccv/types" + "github.com/cosmos/interchain-security/v6/x/ccv/types" dbm "github.com/cosmos/cosmos-db" ) diff --git a/x/ccv/consumer/client/cli/query.go b/x/ccv/consumer/client/cli/query.go index c047ae775d..7e0afb759b 100644 --- a/x/ccv/consumer/client/cli/query.go +++ b/x/ccv/consumer/client/cli/query.go @@ -6,7 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" + "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" ) // NewQueryCmd returns a root CLI command handler for all x/ccv/provider query commands. diff --git a/x/ccv/consumer/ibc_module.go b/x/ccv/consumer/ibc_module.go index d9cbcd6bde..62df5ca6d5 100644 --- a/x/ccv/consumer/ibc_module.go +++ b/x/ccv/consumer/ibc_module.go @@ -17,9 +17,9 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - "github.com/cosmos/interchain-security/v5/x/ccv/consumer/keeper" - consumertypes "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" - "github.com/cosmos/interchain-security/v5/x/ccv/types" + "github.com/cosmos/interchain-security/v6/x/ccv/consumer/keeper" + consumertypes "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" + "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // OnChanOpenInit implements the IBCModule interface diff --git a/x/ccv/consumer/ibc_module_test.go b/x/ccv/consumer/ibc_module_test.go index 029a4accd5..8041f27dc2 100644 --- a/x/ccv/consumer/ibc_module_test.go +++ b/x/ccv/consumer/ibc_module_test.go @@ -13,10 +13,10 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - testkeeper "github.com/cosmos/interchain-security/v5/testutil/keeper" - "github.com/cosmos/interchain-security/v5/x/ccv/consumer" - consumerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/consumer/keeper" - ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" + testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" + "github.com/cosmos/interchain-security/v6/x/ccv/consumer" + consumerkeeper "github.com/cosmos/interchain-security/v6/x/ccv/consumer/keeper" + ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // TestOnChanOpenInit validates the consumer's OnChanOpenInit implementation against the spec. diff --git a/x/ccv/consumer/keeper/changeover_test.go b/x/ccv/consumer/keeper/changeover_test.go index ed76d956c0..27bf63484e 100644 --- a/x/ccv/consumer/keeper/changeover_test.go +++ b/x/ccv/consumer/keeper/changeover_test.go @@ -10,8 +10,8 @@ import ( abci "github.com/cometbft/cometbft/abci/types" - "github.com/cosmos/interchain-security/v5/testutil/crypto" - uthelpers "github.com/cosmos/interchain-security/v5/testutil/keeper" + "github.com/cosmos/interchain-security/v6/testutil/crypto" + uthelpers "github.com/cosmos/interchain-security/v6/testutil/keeper" ) func TestChangeoverToConsumer(t *testing.T) { diff --git a/x/ccv/consumer/keeper/distribution.go b/x/ccv/consumer/keeper/distribution.go index 5c9bbe4a24..d056b165b2 100644 --- a/x/ccv/consumer/keeper/distribution.go +++ b/x/ccv/consumer/keeper/distribution.go @@ -13,8 +13,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" - ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" + "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" + ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // EndBlockRD executes EndBlock logic for the Reward Distribution sub-protocol. diff --git a/x/ccv/consumer/keeper/distribution_test.go b/x/ccv/consumer/keeper/distribution_test.go index 5713361918..6f9b58c30a 100644 --- a/x/ccv/consumer/keeper/distribution_test.go +++ b/x/ccv/consumer/keeper/distribution_test.go @@ -11,9 +11,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" authTypes "github.com/cosmos/cosmos-sdk/x/auth/types" - testkeeper "github.com/cosmos/interchain-security/v5/testutil/keeper" - "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" + "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // TestGetEstimatedNextFeeDistribution tests next fee distribution parameters. diff --git a/x/ccv/consumer/keeper/genesis.go b/x/ccv/consumer/keeper/genesis.go index bdb8e35418..e45a5fa892 100644 --- a/x/ccv/consumer/keeper/genesis.go +++ b/x/ccv/consumer/keeper/genesis.go @@ -7,8 +7,8 @@ import ( abci "github.com/cometbft/cometbft/abci/types" - "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" - ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" + "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" + ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // InitGenesis initializes the CCV consumer state and binds to PortID. diff --git a/x/ccv/consumer/keeper/genesis_test.go b/x/ccv/consumer/keeper/genesis_test.go index 780b2ba34a..4ea693273a 100644 --- a/x/ccv/consumer/keeper/genesis_test.go +++ b/x/ccv/consumer/keeper/genesis_test.go @@ -18,11 +18,11 @@ import ( abci "github.com/cometbft/cometbft/abci/types" tmtypes "github.com/cometbft/cometbft/types" - "github.com/cosmos/interchain-security/v5/testutil/crypto" - testkeeper "github.com/cosmos/interchain-security/v5/testutil/keeper" - consumerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/consumer/keeper" - consumertypes "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" - ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" + "github.com/cosmos/interchain-security/v6/testutil/crypto" + testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" + consumerkeeper "github.com/cosmos/interchain-security/v6/x/ccv/consumer/keeper" + consumertypes "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" + ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // TestInitGenesis tests that a consumer chain is correctly initialised from genesis. diff --git a/x/ccv/consumer/keeper/grpc_query.go b/x/ccv/consumer/keeper/grpc_query.go index 2f1543071b..cd9eab6a76 100644 --- a/x/ccv/consumer/keeper/grpc_query.go +++ b/x/ccv/consumer/keeper/grpc_query.go @@ -8,8 +8,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) var _ types.QueryServer = Keeper{} //nolint:golint diff --git a/x/ccv/consumer/keeper/hooks.go b/x/ccv/consumer/keeper/hooks.go index 5e90129ed7..f129b0dc17 100644 --- a/x/ccv/consumer/keeper/hooks.go +++ b/x/ccv/consumer/keeper/hooks.go @@ -5,7 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" + ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" ) var _ ccv.ConsumerHooks = Keeper{} diff --git a/x/ccv/consumer/keeper/keeper.go b/x/ccv/consumer/keeper/keeper.go index 0edfa64d17..ec9a7ac105 100644 --- a/x/ccv/consumer/keeper/keeper.go +++ b/x/ccv/consumer/keeper/keeper.go @@ -25,8 +25,8 @@ import ( "cosmossdk.io/log" tmtypes "github.com/cometbft/cometbft/abci/types" - "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" - ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" + "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" + ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // Keeper defines the Cross-Chain Validation Consumer Keeper diff --git a/x/ccv/consumer/keeper/keeper_test.go b/x/ccv/consumer/keeper/keeper_test.go index 3857c38c25..89515033b5 100644 --- a/x/ccv/consumer/keeper/keeper_test.go +++ b/x/ccv/consumer/keeper/keeper_test.go @@ -17,10 +17,10 @@ import ( abci "github.com/cometbft/cometbft/abci/types" - "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/consumer/types" - ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" + "github.com/cosmos/interchain-security/v6/testutil/crypto" + testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" + "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" + ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // TestProviderClientID tests getter and setter functionality for the client ID stored on consumer keeper diff --git a/x/ccv/consumer/keeper/migrations.go b/x/ccv/consumer/keeper/migrations.go index 145d595087..ab3b45ffca 100644 --- a/x/ccv/consumer/keeper/migrations.go +++ b/x/ccv/consumer/keeper/migrations.go @@ -4,8 +4,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - v2 "github.com/cosmos/interchain-security/v5/x/ccv/consumer/migrations/v2" - v3 "github.com/cosmos/interchain-security/v5/x/ccv/consumer/migrations/v3" + v2 "github.com/cosmos/interchain-security/v6/x/ccv/consumer/migrations/v2" + v3 "github.com/cosmos/interchain-security/v6/x/ccv/consumer/migrations/v3" ) // Migrator is a struct for handling in-place store migrations. diff --git a/x/ccv/consumer/keeper/msg_server.go b/x/ccv/consumer/keeper/msg_server.go index ce3e67be5c..092878517b 100644 --- a/x/ccv/consumer/keeper/msg_server.go +++ b/x/ccv/consumer/keeper/msg_server.go @@ -8,7 +8,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" + "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" ) type msgServer struct { diff --git a/x/ccv/consumer/keeper/params.go b/x/ccv/consumer/keeper/params.go index 6a9f35dbfe..bdd020ed70 100644 --- a/x/ccv/consumer/keeper/params.go +++ b/x/ccv/consumer/keeper/params.go @@ -7,8 +7,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // GetParams returns the params for the consumer ccv module diff --git a/x/ccv/consumer/keeper/params_test.go b/x/ccv/consumer/keeper/params_test.go index a9f6cc10d9..b090feac43 100644 --- a/x/ccv/consumer/keeper/params_test.go +++ b/x/ccv/consumer/keeper/params_test.go @@ -6,8 +6,8 @@ import ( "github.com/stretchr/testify/require" - testkeeper "github.com/cosmos/interchain-security/v5/testutil/keeper" - ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" + testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" + ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // TestParams tests getters/setters for consumer params diff --git a/x/ccv/consumer/keeper/provider_info.go b/x/ccv/consumer/keeper/provider_info.go index 8dc5c0448d..27ae9ac5f3 100644 --- a/x/ccv/consumer/keeper/provider_info.go +++ b/x/ccv/consumer/keeper/provider_info.go @@ -5,8 +5,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) func (k Keeper) GetProviderInfo(ctx sdk.Context) (*types.QueryProviderInfoResponse, error) { //nolint:golint diff --git a/x/ccv/consumer/keeper/relay.go b/x/ccv/consumer/keeper/relay.go index e20a481cd6..bcccb57e34 100644 --- a/x/ccv/consumer/keeper/relay.go +++ b/x/ccv/consumer/keeper/relay.go @@ -15,8 +15,8 @@ import ( abci "github.com/cometbft/cometbft/abci/types" - "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" - ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" + "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" + ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // OnRecvVSCPacket sets the pending validator set changes that will be flushed to ABCI on Endblock diff --git a/x/ccv/consumer/keeper/relay_test.go b/x/ccv/consumer/keeper/relay_test.go index d3ab3778e1..e9863eeecd 100644 --- a/x/ccv/consumer/keeper/relay_test.go +++ b/x/ccv/consumer/keeper/relay_test.go @@ -21,11 +21,11 @@ import ( abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/libs/bytes" - "github.com/cosmos/interchain-security/v5/testutil/crypto" - testkeeper "github.com/cosmos/interchain-security/v5/testutil/keeper" - consumerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/consumer/keeper" - consumertypes "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" - "github.com/cosmos/interchain-security/v5/x/ccv/types" + "github.com/cosmos/interchain-security/v6/testutil/crypto" + testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" + consumerkeeper "github.com/cosmos/interchain-security/v6/x/ccv/consumer/keeper" + consumertypes "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" + "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // TestOnRecvVSCPacket tests the behavior of OnRecvVSCPacket over various packet scenarios diff --git a/x/ccv/consumer/keeper/throttle_retry.go b/x/ccv/consumer/keeper/throttle_retry.go index 4b6df3cc04..f0fa773423 100644 --- a/x/ccv/consumer/keeper/throttle_retry.go +++ b/x/ccv/consumer/keeper/throttle_retry.go @@ -5,7 +5,7 @@ import ( sdktypes "github.com/cosmos/cosmos-sdk/types" - consumertypes "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" + consumertypes "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" ) // diff --git a/x/ccv/consumer/keeper/throttle_retry_test.go b/x/ccv/consumer/keeper/throttle_retry_test.go index b979ebb51d..a60055ef4d 100644 --- a/x/ccv/consumer/keeper/throttle_retry_test.go +++ b/x/ccv/consumer/keeper/throttle_retry_test.go @@ -6,9 +6,9 @@ import ( "github.com/stretchr/testify/require" - testutil "github.com/cosmos/interchain-security/v5/testutil/keeper" - consumertypes "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + testutil "github.com/cosmos/interchain-security/v6/testutil/keeper" + consumertypes "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) func TestPacketSendingPermitted(t *testing.T) { diff --git a/x/ccv/consumer/keeper/validators.go b/x/ccv/consumer/keeper/validators.go index 3388edd5ae..4386bb7b86 100644 --- a/x/ccv/consumer/keeper/validators.go +++ b/x/ccv/consumer/keeper/validators.go @@ -13,7 +13,7 @@ import ( abci "github.com/cometbft/cometbft/abci/types" - "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" + "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" ) // diff --git a/x/ccv/consumer/keeper/validators_test.go b/x/ccv/consumer/keeper/validators_test.go index 0ab47eb21f..83a3ca338d 100644 --- a/x/ccv/consumer/keeper/validators_test.go +++ b/x/ccv/consumer/keeper/validators_test.go @@ -15,10 +15,10 @@ import ( tmrand "github.com/cometbft/cometbft/libs/rand" tmtypes "github.com/cometbft/cometbft/types" - "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/consumer/keeper" - "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" + "github.com/cosmos/interchain-security/v6/testutil/crypto" + testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" + "github.com/cosmos/interchain-security/v6/x/ccv/consumer/keeper" + "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" ) // TestApplyCCValidatorChanges tests the ApplyCCValidatorChanges method for a consumer keeper diff --git a/x/ccv/consumer/migrations/v2/migration.go b/x/ccv/consumer/migrations/v2/migration.go index a0b401188d..0238517f2f 100644 --- a/x/ccv/consumer/migrations/v2/migration.go +++ b/x/ccv/consumer/migrations/v2/migration.go @@ -6,8 +6,8 @@ import ( storetypes "cosmossdk.io/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - consumertypes "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + consumertypes "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // MigrateConsumerPacketData migrates consumer packet data according to diff --git a/x/ccv/consumer/migrations/v2/migration_test.go b/x/ccv/consumer/migrations/v2/migration_test.go index 0b3f24ec75..5f12adf2d7 100644 --- a/x/ccv/consumer/migrations/v2/migration_test.go +++ b/x/ccv/consumer/migrations/v2/migration_test.go @@ -8,10 +8,10 @@ import ( storetypes "cosmossdk.io/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - testutil "github.com/cosmos/interchain-security/v5/testutil/keeper" - v2 "github.com/cosmos/interchain-security/v5/x/ccv/consumer/migrations/v2" - consumertypes "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + testutil "github.com/cosmos/interchain-security/v6/testutil/keeper" + v2 "github.com/cosmos/interchain-security/v6/x/ccv/consumer/migrations/v2" + consumertypes "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) func TestMigrateConsumerPacketData(t *testing.T) { diff --git a/x/ccv/consumer/migrations/v3/legacy_params.go b/x/ccv/consumer/migrations/v3/legacy_params.go index 8734cb4266..b67bf9db0e 100644 --- a/x/ccv/consumer/migrations/v3/legacy_params.go +++ b/x/ccv/consumer/migrations/v3/legacy_params.go @@ -5,7 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // Legacy: used for migration only! diff --git a/x/ccv/consumer/migrations/v3/migration.go b/x/ccv/consumer/migrations/v3/migration.go index aadc94bc43..06fd8cc376 100644 --- a/x/ccv/consumer/migrations/v3/migration.go +++ b/x/ccv/consumer/migrations/v3/migration.go @@ -6,8 +6,8 @@ import ( storetypes "cosmossdk.io/store/types" - consumertypes "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + consumertypes "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // MigrateLegacyParams migrates the consumers module's parameters from the x/params subspace to the diff --git a/x/ccv/consumer/migrations/v3/migration_test.go b/x/ccv/consumer/migrations/v3/migration_test.go index 17d36e9745..5ca4fce25b 100644 --- a/x/ccv/consumer/migrations/v3/migration_test.go +++ b/x/ccv/consumer/migrations/v3/migration_test.go @@ -9,9 +9,9 @@ import ( "github.com/cosmos/cosmos-sdk/testutil" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/interchain-security/v5/app/encoding" - consumertypes "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + "github.com/cosmos/interchain-security/v6/app/encoding" + consumertypes "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" "github.com/stretchr/testify/require" ) diff --git a/x/ccv/consumer/module.go b/x/ccv/consumer/module.go index a162653abd..b1cfe7cabd 100644 --- a/x/ccv/consumer/module.go +++ b/x/ccv/consumer/module.go @@ -19,10 +19,10 @@ import ( abci "github.com/cometbft/cometbft/abci/types" - "github.com/cosmos/interchain-security/v5/x/ccv/consumer/client/cli" - "github.com/cosmos/interchain-security/v5/x/ccv/consumer/keeper" - consumertypes "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + "github.com/cosmos/interchain-security/v6/x/ccv/consumer/client/cli" + "github.com/cosmos/interchain-security/v6/x/ccv/consumer/keeper" + consumertypes "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) var ( diff --git a/x/ccv/consumer/types/consumer.pb.go b/x/ccv/consumer/types/consumer.pb.go index 5e0c9488ba..01c7bb5854 100644 --- a/x/ccv/consumer/types/consumer.pb.go +++ b/x/ccv/consumer/types/consumer.pb.go @@ -176,31 +176,31 @@ var fileDescriptor_5b27a82b276e7f93 = []byte{ // 436 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x52, 0xcd, 0x6e, 0xd3, 0x40, 0x10, 0xce, 0xb6, 0x50, 0xdc, 0x0d, 0x42, 0xc8, 0x44, 0xc2, 0xcd, 0xc1, 0x8e, 0xc2, 0xc5, 0x97, - 0xda, 0x6a, 0x2a, 0x2e, 0x48, 0x1c, 0x9a, 0x1e, 0x39, 0x14, 0x19, 0x04, 0x12, 0x17, 0x6b, 0xbd, - 0x5e, 0x1c, 0x0b, 0x7b, 0x67, 0xb5, 0x3f, 0x2e, 0xcb, 0x53, 0xf4, 0x61, 0x78, 0x88, 0xc2, 0xa9, - 0x47, 0x4e, 0x05, 0x25, 0x6f, 0xc0, 0x13, 0x20, 0xff, 0x24, 0x88, 0x9f, 0xdb, 0xcc, 0x37, 0xfb, - 0xcd, 0x7c, 0x33, 0xfb, 0xe1, 0x45, 0xc9, 0x35, 0x93, 0x74, 0x45, 0x4a, 0x9e, 0x2a, 0x46, 0x8d, - 0x2c, 0xb5, 0x8d, 0x29, 0x6d, 0x62, 0x0a, 0x5c, 0x99, 0x9a, 0xc9, 0xb8, 0x39, 0xd9, 0xc5, 0x91, - 0x90, 0xa0, 0xc1, 0x7d, 0xf2, 0x1f, 0x4e, 0x44, 0x69, 0x13, 0xed, 0xde, 0x35, 0x27, 0xd3, 0xa3, - 0x02, 0xa0, 0xa8, 0x58, 0xdc, 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d, 0x00, 0x1f, 0x82, 0xd0, 0x2c, 0x4f, 0xc1, 0x68, 0xef, 0xce, + 0x0c, 0x85, 0xce, 0x72, 0xcf, 0x43, 0x89, 0xd3, 0x81, 0x17, 0x46, 0xcf, 0x3f, 0xe1, 0xf1, 0xab, + 0x8a, 0xa8, 0x55, 0xc2, 0x28, 0xc8, 0xdc, 0x0d, 0xf1, 0xc3, 0x4b, 0x52, 0xea, 0x92, 0x17, 0x29, + 0xf0, 0x54, 0x32, 0x51, 0xd9, 0x6e, 0x17, 0x27, 0x79, 0x30, 0xe0, 0x17, 0x3c, 0x69, 0x51, 0xf7, + 0x0c, 0x1f, 0x2a, 0xc6, 0xf3, 0xb4, 0x3d, 0x4e, 0xb7, 0xd6, 0x78, 0x31, 0xfd, 0x47, 0xff, 0xeb, + 0xed, 0xe5, 0x96, 0xce, 0xf5, 0x6d, 0x30, 0xba, 0xfa, 0x1e, 0xa0, 0xc4, 0x69, 0x69, 0x6d, 0x61, + 0xf9, 0xf6, 0x7a, 0xed, 0xa3, 0x9b, 0xb5, 0x8f, 0x7e, 0xac, 0x7d, 0x74, 0xb5, 0xf1, 0x47, 0x37, + 0x1b, 0x7f, 0xf4, 0x6d, 0xe3, 0x8f, 0xde, 0x3d, 0x2f, 0x4a, 0xbd, 0x32, 0x59, 0x44, 0xa1, 0x1e, + 0xfe, 0x26, 0xfe, 0xed, 0x82, 0xe3, 0x9d, 0x73, 0x9a, 0xa7, 0xf1, 0xc7, 0x3f, 0xed, 0xa3, 0xad, + 0x60, 0x2a, 0x3b, 0xe8, 0x04, 0x9c, 0xfe, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x9b, 0xba, 0xf9, 0x06, 0x6f, 0x02, 0x00, 0x00, } diff --git a/x/ccv/consumer/types/genesis.go b/x/ccv/consumer/types/genesis.go index b75de5d46d..2a18846f6a 100644 --- a/x/ccv/consumer/types/genesis.go +++ b/x/ccv/consumer/types/genesis.go @@ -7,7 +7,7 @@ import ( abci "github.com/cometbft/cometbft/abci/types" - ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" + ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // NewRestartGenesisState returns a consumer GenesisState that has already been established. diff --git a/x/ccv/consumer/types/genesis.pb.go b/x/ccv/consumer/types/genesis.pb.go index 8b86b0b34c..34eeb43cfa 100644 --- a/x/ccv/consumer/types/genesis.pb.go +++ b/x/ccv/consumer/types/genesis.pb.go @@ -10,7 +10,7 @@ import ( proto "github.com/cosmos/gogoproto/proto" github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" _07_tendermint "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" - types "github.com/cosmos/interchain-security/v5/x/ccv/types" + types "github.com/cosmos/interchain-security/v6/x/ccv/types" _ "google.golang.org/protobuf/types/known/timestamppb" io "io" math "math" @@ -466,7 +466,7 @@ var fileDescriptor_2db73a6057a27482 = []byte{ // 912 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x56, 0xcf, 0x6f, 0x23, 0x35, 0x14, 0xee, 0xb4, 0xdd, 0x90, 0xb8, 0xed, 0x6e, 0xd7, 0x5d, 0xa2, 0xa1, 0x11, 0x69, 0x14, 0x84, - 0x14, 0xf1, 0xc3, 0x43, 0x8a, 0x16, 0x21, 0x21, 0x10, 0x24, 0x95, 0x68, 0x50, 0x11, 0x55, 0xda, + 0x14, 0xf1, 0xc3, 0x43, 0x8a, 0x58, 0x21, 0x21, 0x10, 0x24, 0x95, 0x68, 0x50, 0x11, 0x55, 0xda, 0x0d, 0xd2, 0x5e, 0x46, 0x8e, 0xc7, 0x3b, 0xb1, 0x76, 0xc6, 0x1e, 0x8d, 0x9d, 0x09, 0x15, 0xe2, 0xc2, 0x95, 0xcb, 0xfe, 0x59, 0x7b, 0xdc, 0x03, 0x07, 0x4e, 0x80, 0xda, 0x7f, 0x04, 0xd9, 0xe3, 0x99, 0x24, 0x34, 0xed, 0xe6, 0x16, 0xcf, 0x7b, 0xef, 0xfb, 0xde, 0xfb, 0xde, 0x7b, 0x76, 0x40, @@ -490,27 +490,27 @@ var fileDescriptor_2db73a6057a27482 = []byte{ 0x4d, 0xd7, 0x19, 0x1e, 0x2c, 0xa7, 0x9b, 0x2b, 0x15, 0x01, 0x77, 0x4e, 0x22, 0xb8, 0xa4, 0x5c, 0x4e, 0xa5, 0xe5, 0xa9, 0x18, 0x1e, 0xf4, 0x56, 0x9e, 0x22, 0x6c, 0x4e, 0x55, 0x2f, 0xa9, 0x96, 0x6c, 0x30, 0x04, 0xfb, 0x31, 0x56, 0xd3, 0x94, 0xf1, 0xd0, 0x4f, 0x30, 0x79, 0x49, 0x95, 0x74, - 0xdf, 0x69, 0x6d, 0x75, 0x76, 0x8e, 0xbf, 0x40, 0x6b, 0x8c, 0x31, 0xfa, 0xd1, 0x06, 0x8f, 0x2e, - 0xfa, 0xe7, 0x26, 0xdc, 0x76, 0xeb, 0x51, 0x81, 0x9a, 0x7f, 0x95, 0xf0, 0x1c, 0x3c, 0x62, 0x9c, - 0x29, 0x86, 0x23, 0x3f, 0xc3, 0x91, 0x2f, 0xa9, 0x72, 0xab, 0x86, 0xa7, 0xb5, 0x98, 0xbc, 0x1e, - 0x24, 0x34, 0xc2, 0x11, 0x0b, 0xb0, 0x12, 0xe9, 0xb3, 0x24, 0xd0, 0xf9, 0x57, 0x34, 0xa2, 0xeb, - 0x0c, 0xf7, 0x2c, 0xc0, 0x08, 0x47, 0x17, 0x54, 0xc1, 0xdf, 0xc0, 0xe1, 0x84, 0x6a, 0x11, 0x7c, - 0x25, 0x34, 0xa6, 0xa4, 0xca, 0x9f, 0x9a, 0x08, 0xdd, 0xe1, 0x9a, 0x01, 0xff, 0x6a, 0xad, 0x22, - 0x4e, 0x0d, 0xcc, 0xa5, 0x18, 0x19, 0x90, 0x9c, 0x75, 0x70, 0x62, 0x2b, 0xa9, 0x4f, 0x56, 0x59, - 0x03, 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xbd, 0xd2, 0xa5, 0x5c, 0xef, 0xef, 0x72, 0x87, 0xf6, 0x17, 0xa0, 0x71, 0x76, 0xbf, 0x6a, 0x0b, 0x79, 0x6f, 0x15, 0x79, 0xb7, 0x15, 0x78, 0x7c, 0x6b, 0xb5, 0xe1, 0x13, 0xf0, 0x20, 0x93, 0x64, 0x10, 0xd8, 0x1a, 0xf3, 0x03, 0x1c, 0x80, 0xbd, 0x7c, 0xd9, 0xd5, 0x95, 0xaf, 0x53, 0x36, 0xf5, 0xed, 0x1c, 0x1f, 0xa2, 0xfc, 0x05, 0x41, 0xc5, 0x0b, 0x82, 0x2e, 0x8b, 0x17, 0xa4, @@ -520,7 +520,7 @@ var fileDescriptor_2db73a6057a27482 = []byte{ 0x5e, 0x37, 0x9d, 0x57, 0x37, 0xcd, 0x8d, 0x37, 0x37, 0xcd, 0x8d, 0xbf, 0x6e, 0x9a, 0x1b, 0xcf, 0xbf, 0x0e, 0x99, 0x9a, 0x4c, 0xc7, 0x88, 0x88, 0xd8, 0x23, 0x42, 0xc6, 0x42, 0x7a, 0x73, 0x9a, 0x4f, 0xcb, 0xb7, 0x32, 0x7b, 0xea, 0xfd, 0xb2, 0xfc, 0x0f, 0xc0, 0xbc, 0x7c, 0xe3, 0x8a, 0x29, - 0xf4, 0xf3, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0xf9, 0x42, 0x21, 0x04, 0x32, 0x08, 0x00, 0x00, + 0xf4, 0xf3, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0xe1, 0x67, 0x80, 0x40, 0x32, 0x08, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/x/ccv/consumer/types/genesis_test.go b/x/ccv/consumer/types/genesis_test.go index d66bd924cb..2803c2686a 100644 --- a/x/ccv/consumer/types/genesis_test.go +++ b/x/ccv/consumer/types/genesis_test.go @@ -15,9 +15,9 @@ import ( abci "github.com/cometbft/cometbft/abci/types" tmtypes "github.com/cometbft/cometbft/types" - "github.com/cosmos/interchain-security/v5/testutil/crypto" - "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" - ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" + "github.com/cosmos/interchain-security/v6/testutil/crypto" + "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" + ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" ) const ( diff --git a/x/ccv/consumer/types/keys.go b/x/ccv/consumer/types/keys.go index e39eff088e..302b45883e 100644 --- a/x/ccv/consumer/types/keys.go +++ b/x/ccv/consumer/types/keys.go @@ -6,7 +6,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) const ( diff --git a/x/ccv/consumer/types/params_test.go b/x/ccv/consumer/types/params_test.go index a1cb9d651e..1e2a8e8cfe 100644 --- a/x/ccv/consumer/types/params_test.go +++ b/x/ccv/consumer/types/params_test.go @@ -6,7 +6,7 @@ import ( "github.com/stretchr/testify/require" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // Tests the validation of consumer params that happens at genesis diff --git a/x/ccv/consumer/types/query.pb.go b/x/ccv/consumer/types/query.pb.go index 3276f98197..be89b46fc1 100644 --- a/x/ccv/consumer/types/query.pb.go +++ b/x/ccv/consumer/types/query.pb.go @@ -9,7 +9,7 @@ import ( _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" - types "github.com/cosmos/interchain-security/v5/x/ccv/types" + types "github.com/cosmos/interchain-security/v6/x/ccv/types" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -561,7 +561,7 @@ var fileDescriptor_f627751d3cc10225 = []byte{ // 826 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4f, 0x6f, 0xe3, 0x44, 0x14, 0x8f, 0xd3, 0x36, 0xbb, 0x99, 0x2e, 0x42, 0x3b, 0x04, 0xc9, 0x78, 0x57, 0xa1, 0x32, 0x20, - 0xc2, 0x4a, 0xb1, 0x93, 0xac, 0x50, 0x97, 0xc3, 0xb2, 0xa8, 0x0d, 0x55, 0x23, 0x01, 0x6a, 0xdd, + 0xc2, 0x4a, 0xb1, 0x93, 0xac, 0x44, 0x97, 0xc3, 0xb2, 0xa8, 0x0d, 0x55, 0x23, 0x01, 0x6a, 0xdd, 0x4a, 0x08, 0x2e, 0x66, 0x3a, 0x99, 0x26, 0x16, 0x89, 0xc7, 0x9d, 0x19, 0x9b, 0xf6, 0x86, 0xe0, 0x8e, 0x90, 0xf8, 0x26, 0x7c, 0x01, 0xae, 0x95, 0x38, 0x50, 0x89, 0x03, 0x70, 0x41, 0xa8, 0xe5, 0x43, 0x70, 0x44, 0x33, 0x1e, 0xa7, 0x4e, 0x9b, 0x26, 0x6e, 0xe1, 0xe6, 0x79, 0x7f, 0x7e, 0xef, @@ -610,7 +610,7 @@ var fileDescriptor_f627751d3cc10225 = []byte{ 0x7a, 0xe9, 0xec, 0xa2, 0x5e, 0xfa, 0xfd, 0xa2, 0x5e, 0xfa, 0xfc, 0xf9, 0x20, 0x10, 0xc3, 0xf8, 0xc0, 0xc1, 0x74, 0xec, 0x62, 0xca, 0xc7, 0x94, 0xe7, 0xc0, 0x9b, 0x13, 0xf0, 0xe4, 0x5d, 0xf7, 0xf8, 0x4a, 0x85, 0x93, 0x88, 0xf0, 0x83, 0x8a, 0xfa, 0x33, 0xf1, 0xf4, 0xdf, 0x00, 0x00, 0x00, - 0xff, 0xff, 0x3e, 0x5e, 0x18, 0x20, 0x65, 0x09, 0x00, 0x00, + 0xff, 0xff, 0x26, 0x7b, 0xb9, 0x64, 0x65, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/ccv/consumer/types/tx.pb.go b/x/ccv/consumer/types/tx.pb.go index 4fde6e583d..3cf704b1b1 100644 --- a/x/ccv/consumer/types/tx.pb.go +++ b/x/ccv/consumer/types/tx.pb.go @@ -12,7 +12,7 @@ import ( _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" - types "github.com/cosmos/interchain-security/v5/x/ccv/types" + types "github.com/cosmos/interchain-security/v6/x/ccv/types" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -158,8 +158,8 @@ var fileDescriptor_9d7049279494b73f = []byte{ 0x83, 0x16, 0xa3, 0x53, 0xf8, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0xd9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0x42, 0xa3, 0x54, 0x1f, 0x61, 0x9f, - 0x2e, 0x3c, 0xca, 0xca, 0x4c, 0xf5, 0x2b, 0x50, 0x53, 0x61, 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, - 0x1b, 0x38, 0xd2, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xc4, 0xb3, 0xd4, 0x91, 0xb6, 0x02, + 0x2e, 0x3c, 0xca, 0xca, 0xcc, 0xf4, 0x2b, 0x50, 0x53, 0x61, 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, + 0x1b, 0x38, 0xd2, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xdc, 0x96, 0x75, 0xd5, 0xb6, 0x02, 0x00, 0x00, } diff --git a/x/ccv/democracy/distribution/module.go b/x/ccv/democracy/distribution/module.go index 95d1cef6cd..08517e6496 100644 --- a/x/ccv/democracy/distribution/module.go +++ b/x/ccv/democracy/distribution/module.go @@ -17,7 +17,7 @@ import ( stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - consumertypes "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" + consumertypes "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" ) var ( diff --git a/x/ccv/provider/client/cli/query.go b/x/ccv/provider/client/cli/query.go index c6e0d53159..143cbb6d4a 100644 --- a/x/ccv/provider/client/cli/query.go +++ b/x/ccv/provider/client/cli/query.go @@ -12,7 +12,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) // NewQueryCmd returns a root CLI command handler for all x/ccv/provider query commands. diff --git a/x/ccv/provider/client/cli/tx.go b/x/ccv/provider/client/cli/tx.go index 17414bc5ef..189a6cd576 100644 --- a/x/ccv/provider/client/cli/tx.go +++ b/x/ccv/provider/client/cli/tx.go @@ -20,7 +20,7 @@ import ( tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) // GetTxCmd returns the transaction commands for this module diff --git a/x/ccv/provider/client/legacy_proposals.go b/x/ccv/provider/client/legacy_proposals.go index ef9484540d..af96ec054b 100644 --- a/x/ccv/provider/client/legacy_proposals.go +++ b/x/ccv/provider/client/legacy_proposals.go @@ -14,7 +14,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) type ConsumerAdditionProposalJSON struct { diff --git a/x/ccv/provider/handler.go b/x/ccv/provider/handler.go index 937fcb1805..d8c6a05295 100644 --- a/x/ccv/provider/handler.go +++ b/x/ccv/provider/handler.go @@ -7,8 +7,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) func NewHandler(k *keeper.Keeper) baseapp.MsgServiceHandler { diff --git a/x/ccv/provider/handler_test.go b/x/ccv/provider/handler_test.go index e8fa15d4d2..a423485888 100644 --- a/x/ccv/provider/handler_test.go +++ b/x/ccv/provider/handler_test.go @@ -14,11 +14,11 @@ import ( tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - testcrypto "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/keeper" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + testcrypto "github.com/cosmos/interchain-security/v6/testutil/crypto" + testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" + "github.com/cosmos/interchain-security/v6/x/ccv/provider" + keeper "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) func TestInvalidMsg(t *testing.T) { diff --git a/x/ccv/provider/ibc_middleware.go b/x/ccv/provider/ibc_middleware.go index 3872fd5fbe..c522ce425c 100644 --- a/x/ccv/provider/ibc_middleware.go +++ b/x/ccv/provider/ibc_middleware.go @@ -12,8 +12,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) var _ porttypes.Middleware = &IBCMiddleware{} diff --git a/x/ccv/provider/ibc_middleware_test.go b/x/ccv/provider/ibc_middleware_test.go index 3148069bf2..9b57cb8fcd 100644 --- a/x/ccv/provider/ibc_middleware_test.go +++ b/x/ccv/provider/ibc_middleware_test.go @@ -7,7 +7,7 @@ import ( channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" "github.com/stretchr/testify/require" - "github.com/cosmos/interchain-security/v5/x/ccv/provider" + "github.com/cosmos/interchain-security/v6/x/ccv/provider" ) func TestGetProviderDenom(t *testing.T) { diff --git a/x/ccv/provider/ibc_module.go b/x/ccv/provider/ibc_module.go index b41512e98a..61618791df 100644 --- a/x/ccv/provider/ibc_module.go +++ b/x/ccv/provider/ibc_module.go @@ -15,9 +15,9 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" - ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // OnChanOpenInit implements the IBCModule interface diff --git a/x/ccv/provider/ibc_module_test.go b/x/ccv/provider/ibc_module_test.go index 0a06bf6091..42a550b8ae 100644 --- a/x/ccv/provider/ibc_module_test.go +++ b/x/ccv/provider/ibc_module_test.go @@ -15,11 +15,11 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - testkeeper "github.com/cosmos/interchain-security/v5/testutil/keeper" - "github.com/cosmos/interchain-security/v5/x/ccv/provider" - providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" - ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" + testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" + "github.com/cosmos/interchain-security/v6/x/ccv/provider" + providerkeeper "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // TestOnChanOpenInit tests the provider's OnChanOpenInit method against spec. diff --git a/x/ccv/provider/keeper/consumer_equivocation.go b/x/ccv/provider/keeper/consumer_equivocation.go index 7bd7bac45c..692af2470c 100644 --- a/x/ccv/provider/keeper/consumer_equivocation.go +++ b/x/ccv/provider/keeper/consumer_equivocation.go @@ -20,8 +20,8 @@ import ( 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" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // diff --git a/x/ccv/provider/keeper/consumer_equivocation_test.go b/x/ccv/provider/keeper/consumer_equivocation_test.go index cd0aba4f13..e427f769bf 100644 --- a/x/ccv/provider/keeper/consumer_equivocation_test.go +++ b/x/ccv/provider/keeper/consumer_equivocation_test.go @@ -18,9 +18,9 @@ import ( tmtypes "github.com/cometbft/cometbft/types" - 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/types" + cryptotestutil "github.com/cosmos/interchain-security/v6/testutil/crypto" + testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) func TestVerifyDoubleVotingEvidence(t *testing.T) { diff --git a/x/ccv/provider/keeper/consumer_lifecycle.go b/x/ccv/provider/keeper/consumer_lifecycle.go index 20014c3c35..0ef87a4b41 100644 --- a/x/ccv/provider/keeper/consumer_lifecycle.go +++ b/x/ccv/provider/keeper/consumer_lifecycle.go @@ -18,8 +18,8 @@ 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" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" - ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // PrepareConsumerForLaunch prepares to move the launch of a consumer chain from the previous spawn time to spawn time. diff --git a/x/ccv/provider/keeper/consumer_lifecycle_test.go b/x/ccv/provider/keeper/consumer_lifecycle_test.go index 76d654c0c3..66b0241c71 100644 --- a/x/ccv/provider/keeper/consumer_lifecycle_test.go +++ b/x/ccv/provider/keeper/consumer_lifecycle_test.go @@ -20,11 +20,11 @@ import ( ibctmtypes "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" _go "github.com/cosmos/ics23/go" - 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" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + cryptotestutil "github.com/cosmos/interchain-security/v6/testutil/crypto" + testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" + providerkeeper "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) func TestPrepareConsumerForLaunch(t *testing.T) { diff --git a/x/ccv/provider/keeper/distribution.go b/x/ccv/provider/keeper/distribution.go index db75ff9b6e..29500d2b9c 100644 --- a/x/ccv/provider/keeper/distribution.go +++ b/x/ccv/provider/keeper/distribution.go @@ -12,7 +12,7 @@ import ( distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) // BeginBlockRD executes BeginBlock logic for the Reward Distribution sub-protocol. diff --git a/x/ccv/provider/keeper/distribution_test.go b/x/ccv/provider/keeper/distribution_test.go index c449b0149c..8d981764d2 100644 --- a/x/ccv/provider/keeper/distribution_test.go +++ b/x/ccv/provider/keeper/distribution_test.go @@ -15,8 +15,8 @@ import ( tmtypes "github.com/cometbft/cometbft/types" - testkeeper "github.com/cosmos/interchain-security/v5/testutil/keeper" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) func TestComputeConsumerTotalVotingPower(t *testing.T) { diff --git a/x/ccv/provider/keeper/genesis.go b/x/ccv/provider/keeper/genesis.go index 7e8fd4bb76..d4c2a77246 100644 --- a/x/ccv/provider/keeper/genesis.go +++ b/x/ccv/provider/keeper/genesis.go @@ -7,8 +7,8 @@ import ( abci "github.com/cometbft/cometbft/abci/types" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" - ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // InitGenesis initializes the CCV provider state and binds to PortID. diff --git a/x/ccv/provider/keeper/genesis_test.go b/x/ccv/provider/keeper/genesis_test.go index af3e0ea843..c01b179b44 100644 --- a/x/ccv/provider/keeper/genesis_test.go +++ b/x/ccv/provider/keeper/genesis_test.go @@ -12,11 +12,11 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "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" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" - ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" + "github.com/cosmos/interchain-security/v6/testutil/crypto" + testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // TestInitAndExportGenesis tests the export and the initialisation of a provider chain genesis diff --git a/x/ccv/provider/keeper/grpc_query.go b/x/ccv/provider/keeper/grpc_query.go index 170b3ba29b..236fc6e7d7 100644 --- a/x/ccv/provider/keeper/grpc_query.go +++ b/x/ccv/provider/keeper/grpc_query.go @@ -12,8 +12,8 @@ import ( errorsmod "cosmossdk.io/errors" 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" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) var _ types.QueryServer = Keeper{} diff --git a/x/ccv/provider/keeper/grpc_query_test.go b/x/ccv/provider/keeper/grpc_query_test.go index 3ba2cc9059..c7efd50089 100644 --- a/x/ccv/provider/keeper/grpc_query_test.go +++ b/x/ccv/provider/keeper/grpc_query_test.go @@ -17,11 +17,11 @@ import ( "github.com/cometbft/cometbft/proto/tendermint/crypto" - 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" + cryptotestutil "github.com/cosmos/interchain-security/v6/testutil/crypto" + testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) func TestQueryAllPairsValConsAddrByConsumer(t *testing.T) { diff --git a/x/ccv/provider/keeper/hooks.go b/x/ccv/provider/keeper/hooks.go index f61facac50..257942ff5c 100644 --- a/x/ccv/provider/keeper/hooks.go +++ b/x/ccv/provider/keeper/hooks.go @@ -8,8 +8,8 @@ import ( sdkgov "github.com/cosmos/cosmos-sdk/x/gov/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // Wrapper struct diff --git a/x/ccv/provider/keeper/hooks_test.go b/x/ccv/provider/keeper/hooks_test.go index e76eece5ad..312d9be632 100644 --- a/x/ccv/provider/keeper/hooks_test.go +++ b/x/ccv/provider/keeper/hooks_test.go @@ -4,10 +4,10 @@ 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/cosmos/interchain-security/v5/x/ccv/provider/types" + cryptotestutil "github.com/cosmos/interchain-security/v6/testutil/crypto" + testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" + providerkeeper "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" "github.com/golang/mock/gomock" ) diff --git a/x/ccv/provider/keeper/invariants.go b/x/ccv/provider/keeper/invariants.go index a6dbf42c1d..8e736b8f7f 100644 --- a/x/ccv/provider/keeper/invariants.go +++ b/x/ccv/provider/keeper/invariants.go @@ -5,7 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - types "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + types "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) // RegisterInvariants registers all staking invariants diff --git a/x/ccv/provider/keeper/keeper.go b/x/ccv/provider/keeper/keeper.go index 3d624f10f3..86692f8c3e 100644 --- a/x/ccv/provider/keeper/keeper.go +++ b/x/ccv/provider/keeper/keeper.go @@ -28,9 +28,9 @@ import ( "cosmossdk.io/log" govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" - 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" + consumertypes "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // Keeper defines the Cross-Chain Validation Provider Keeper diff --git a/x/ccv/provider/keeper/keeper_test.go b/x/ccv/provider/keeper/keeper_test.go index 9485c9efd7..d36066b96a 100644 --- a/x/ccv/provider/keeper/keeper_test.go +++ b/x/ccv/provider/keeper/keeper_test.go @@ -15,10 +15,10 @@ import ( abci "github.com/cometbft/cometbft/abci/types" tmprotocrypto "github.com/cometbft/cometbft/proto/tendermint/crypto" - cryptotestutil "github.com/cosmos/interchain-security/v5/testutil/crypto" - testkeeper "github.com/cosmos/interchain-security/v5/testutil/keeper" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" - ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" + cryptotestutil "github.com/cosmos/interchain-security/v6/testutil/crypto" + testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" ) const consumer = "consumer" diff --git a/x/ccv/provider/keeper/key_assignment.go b/x/ccv/provider/keeper/key_assignment.go index f2f10dd368..1e6fd5de5a 100644 --- a/x/ccv/provider/keeper/key_assignment.go +++ b/x/ccv/provider/keeper/key_assignment.go @@ -13,8 +13,8 @@ import ( tmprotocrypto "github.com/cometbft/cometbft/proto/tendermint/crypto" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // ParseConsumerKey parses the ED25519 PubKey`consumerKey` from a JSON string diff --git a/x/ccv/provider/keeper/key_assignment_test.go b/x/ccv/provider/keeper/key_assignment_test.go index fced8ad7a7..223cfacd42 100644 --- a/x/ccv/provider/keeper/key_assignment_test.go +++ b/x/ccv/provider/keeper/key_assignment_test.go @@ -17,11 +17,11 @@ import ( abci "github.com/cometbft/cometbft/abci/types" tmprotocrypto "github.com/cometbft/cometbft/proto/tendermint/crypto" - 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/cosmos/interchain-security/v5/x/ccv/provider/types" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + cryptotestutil "github.com/cosmos/interchain-security/v6/testutil/crypto" + testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" + providerkeeper "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) const ChainID = "consumerId" diff --git a/x/ccv/provider/keeper/msg_server.go b/x/ccv/provider/keeper/msg_server.go index e5148b5a37..f899614e83 100644 --- a/x/ccv/provider/keeper/msg_server.go +++ b/x/ccv/provider/keeper/msg_server.go @@ -12,8 +12,8 @@ import ( 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" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) type msgServer struct { diff --git a/x/ccv/provider/keeper/msg_server_test.go b/x/ccv/provider/keeper/msg_server_test.go index 66ddaefff9..98b4675359 100644 --- a/x/ccv/provider/keeper/msg_server_test.go +++ b/x/ccv/provider/keeper/msg_server_test.go @@ -5,9 +5,9 @@ import ( "time" "github.com/cosmos/cosmos-sdk/codec/address" - 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" + testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" + providerkeeper "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" "github.com/stretchr/testify/require" ) diff --git a/x/ccv/provider/keeper/params.go b/x/ccv/provider/keeper/params.go index 9feb274189..3bdb419a0a 100644 --- a/x/ccv/provider/keeper/params.go +++ b/x/ccv/provider/keeper/params.go @@ -8,7 +8,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) // GetTemplateClient returns the template client for provider proposals diff --git a/x/ccv/provider/keeper/params_test.go b/x/ccv/provider/keeper/params_test.go index 947122b221..84ed685dfc 100644 --- a/x/ccv/provider/keeper/params_test.go +++ b/x/ccv/provider/keeper/params_test.go @@ -12,8 +12,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - testkeeper "github.com/cosmos/interchain-security/v5/testutil/keeper" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) // TestParams tests the getting/setting of provider ccv module params. diff --git a/x/ccv/provider/keeper/partial_set_security.go b/x/ccv/provider/keeper/partial_set_security.go index 5d654516ab..70e2e2efef 100644 --- a/x/ccv/provider/keeper/partial_set_security.go +++ b/x/ccv/provider/keeper/partial_set_security.go @@ -10,8 +10,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // HandleOptIn prepares validator `providerAddr` to opt in to `consumerId` with an optional `consumerKey` consumer public key. diff --git a/x/ccv/provider/keeper/partial_set_security_test.go b/x/ccv/provider/keeper/partial_set_security_test.go index c9ef563914..e6a3199038 100644 --- a/x/ccv/provider/keeper/partial_set_security_test.go +++ b/x/ccv/provider/keeper/partial_set_security_test.go @@ -21,10 +21,10 @@ import ( "github.com/cometbft/cometbft/proto/tendermint/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" + testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) func TestHandleOptIn(t *testing.T) { diff --git a/x/ccv/provider/keeper/permissionless.go b/x/ccv/provider/keeper/permissionless.go index aa32b496a4..8e8c53668a 100644 --- a/x/ccv/provider/keeper/permissionless.go +++ b/x/ccv/provider/keeper/permissionless.go @@ -6,7 +6,7 @@ import ( "strconv" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) // setConsumerId sets the provided consumerId diff --git a/x/ccv/provider/keeper/permissionless_test.go b/x/ccv/provider/keeper/permissionless_test.go index dbb86cb4d4..2f80e52312 100644 --- a/x/ccv/provider/keeper/permissionless_test.go +++ b/x/ccv/provider/keeper/permissionless_test.go @@ -5,8 +5,8 @@ import ( "time" "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - testkeeper "github.com/cosmos/interchain-security/v5/testutil/keeper" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" "github.com/stretchr/testify/require" ) diff --git a/x/ccv/provider/keeper/power_shaping.go b/x/ccv/provider/keeper/power_shaping.go index c54ca41e4e..afb3d04d18 100644 --- a/x/ccv/provider/keeper/power_shaping.go +++ b/x/ccv/provider/keeper/power_shaping.go @@ -8,8 +8,8 @@ import ( 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" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // GetConsumerPowerShapingParameters returns the power-shaping parameters associated with this consumer id diff --git a/x/ccv/provider/keeper/power_shaping_test.go b/x/ccv/provider/keeper/power_shaping_test.go index bcf49373c6..516c5c897f 100644 --- a/x/ccv/provider/keeper/power_shaping_test.go +++ b/x/ccv/provider/keeper/power_shaping_test.go @@ -8,9 +8,9 @@ import ( 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" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" ) diff --git a/x/ccv/provider/keeper/provider_consensus.go b/x/ccv/provider/keeper/provider_consensus.go index 7bd1e44576..9c377e6d91 100644 --- a/x/ccv/provider/keeper/provider_consensus.go +++ b/x/ccv/provider/keeper/provider_consensus.go @@ -8,7 +8,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) // SetLastProviderConsensusValidator sets the given validator to be stored diff --git a/x/ccv/provider/keeper/provider_consensus_test.go b/x/ccv/provider/keeper/provider_consensus_test.go index 93a5c6f0ba..76ffb1544b 100644 --- a/x/ccv/provider/keeper/provider_consensus_test.go +++ b/x/ccv/provider/keeper/provider_consensus_test.go @@ -7,8 +7,8 @@ import ( "github.com/cometbft/cometbft/proto/tendermint/crypto" "github.com/stretchr/testify/require" - testkeeper "github.com/cosmos/interchain-security/v5/testutil/keeper" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) func TestSetLastProviderConsensusValidator(t *testing.T) { diff --git a/x/ccv/provider/keeper/relay.go b/x/ccv/provider/keeper/relay.go index 8fc0c08500..3a392500c0 100644 --- a/x/ccv/provider/keeper/relay.go +++ b/x/ccv/provider/keeper/relay.go @@ -15,8 +15,8 @@ import ( abci "github.com/cometbft/cometbft/abci/types" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" - ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // OnAcknowledgementPacket handles acknowledgments for sent VSC packets diff --git a/x/ccv/provider/keeper/relay_test.go b/x/ccv/provider/keeper/relay_test.go index 753700214b..adee77836c 100644 --- a/x/ccv/provider/keeper/relay_test.go +++ b/x/ccv/provider/keeper/relay_test.go @@ -20,11 +20,11 @@ import ( abci "github.com/cometbft/cometbft/abci/types" - 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" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" - ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" + cryptotestutil "github.com/cosmos/interchain-security/v6/testutil/crypto" + testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // TestQueueVSCPackets tests queueing validator set updates. diff --git a/x/ccv/provider/keeper/staking_keeper_interface_test.go b/x/ccv/provider/keeper/staking_keeper_interface_test.go index 40cfb5c0d7..ab7c1681e3 100644 --- a/x/ccv/provider/keeper/staking_keeper_interface_test.go +++ b/x/ccv/provider/keeper/staking_keeper_interface_test.go @@ -7,7 +7,7 @@ import ( "cosmossdk.io/math" 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" + testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" ) diff --git a/x/ccv/provider/keeper/throttle.go b/x/ccv/provider/keeper/throttle.go index 7be82d4eaa..aa5a0fd854 100644 --- a/x/ccv/provider/keeper/throttle.go +++ b/x/ccv/provider/keeper/throttle.go @@ -10,7 +10,7 @@ import ( tmtypes "github.com/cometbft/cometbft/types" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) // Obtains the effective validator power relevant to a validator consensus address. diff --git a/x/ccv/provider/keeper/throttle_test.go b/x/ccv/provider/keeper/throttle_test.go index cb8e8804c4..e1686f5cb3 100644 --- a/x/ccv/provider/keeper/throttle_test.go +++ b/x/ccv/provider/keeper/throttle_test.go @@ -11,8 +11,8 @@ import ( tmtypes "github.com/cometbft/cometbft/types" - testkeeper "github.com/cosmos/interchain-security/v5/testutil/keeper" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) // TestSlashMeterReplenishment tests the CheckForSlashMeterReplenishment, ReplenishSlashMeter, diff --git a/x/ccv/provider/keeper/validator_set_storage.go b/x/ccv/provider/keeper/validator_set_storage.go index b829f2f743..8ac7c80f2d 100644 --- a/x/ccv/provider/keeper/validator_set_storage.go +++ b/x/ccv/provider/keeper/validator_set_storage.go @@ -7,7 +7,7 @@ import ( storetypes "cosmossdk.io/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) // The functions here are meant to provide a generic interface to a validator set that diff --git a/x/ccv/provider/keeper/validator_set_update.go b/x/ccv/provider/keeper/validator_set_update.go index 95a8d5c9a7..701fac648e 100644 --- a/x/ccv/provider/keeper/validator_set_update.go +++ b/x/ccv/provider/keeper/validator_set_update.go @@ -8,8 +8,8 @@ import ( abci "github.com/cometbft/cometbft/abci/types" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" - ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // GetConsumerChainConsensusValidatorsKey returns the store key for consumer validators of the consumer chain with `consumerId` diff --git a/x/ccv/provider/keeper/validator_set_update_test.go b/x/ccv/provider/keeper/validator_set_update_test.go index aa9ae6abba..2a63453021 100644 --- a/x/ccv/provider/keeper/validator_set_update_test.go +++ b/x/ccv/provider/keeper/validator_set_update_test.go @@ -15,10 +15,10 @@ import ( abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/proto/tendermint/crypto" - 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" + cryptotestutil "github.com/cosmos/interchain-security/v6/testutil/crypto" + testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) // TestConsumerValidator tests the `SetConsumerValidator`, `IsConsumerValidator`, and `DeleteConsumerValidator` methods diff --git a/x/ccv/provider/migrations/migrator.go b/x/ccv/provider/migrations/migrator.go index edc80ef6ce..9d17d27a06 100644 --- a/x/ccv/provider/migrations/migrator.go +++ b/x/ccv/provider/migrations/migrator.go @@ -7,9 +7,9 @@ import ( sdktypes "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" - v7 "github.com/cosmos/interchain-security/v5/x/ccv/provider/migrations/v7" - v8 "github.com/cosmos/interchain-security/v5/x/ccv/provider/migrations/v8" + providerkeeper "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" + v7 "github.com/cosmos/interchain-security/v6/x/ccv/provider/migrations/v7" + v8 "github.com/cosmos/interchain-security/v6/x/ccv/provider/migrations/v8" ) // Migrator is a struct for handling in-place store migrations. diff --git a/x/ccv/provider/migrations/v7/legacy_params.go b/x/ccv/provider/migrations/v7/legacy_params.go index 05e0cea59e..831eba7f17 100644 --- a/x/ccv/provider/migrations/v7/legacy_params.go +++ b/x/ccv/provider/migrations/v7/legacy_params.go @@ -5,9 +5,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ibctmtypes "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // getTemplateClient returns the template client for provider proposals diff --git a/x/ccv/provider/migrations/v7/migrations.go b/x/ccv/provider/migrations/v7/migrations.go index 3c2f171dac..b8947624f7 100644 --- a/x/ccv/provider/migrations/v7/migrations.go +++ b/x/ccv/provider/migrations/v7/migrations.go @@ -2,8 +2,8 @@ package v7 import ( sdk "github.com/cosmos/cosmos-sdk/types" - providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + providerkeeper "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // MigrateParams migrates the provider module's parameters from the x/params to self store. diff --git a/x/ccv/provider/migrations/v7/migrations_test.go b/x/ccv/provider/migrations/v7/migrations_test.go index 4b983205cc..0d8ed4542f 100644 --- a/x/ccv/provider/migrations/v7/migrations_test.go +++ b/x/ccv/provider/migrations/v7/migrations_test.go @@ -3,9 +3,9 @@ package v7 import ( "testing" - testutil "github.com/cosmos/interchain-security/v5/testutil/keeper" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + testutil "github.com/cosmos/interchain-security/v6/testutil/keeper" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" "github.com/stretchr/testify/require" ) diff --git a/x/ccv/provider/migrations/v8/migrations.go b/x/ccv/provider/migrations/v8/migrations.go index c7ace6eb3f..f819dd1d88 100644 --- a/x/ccv/provider/migrations/v8/migrations.go +++ b/x/ccv/provider/migrations/v8/migrations.go @@ -10,9 +10,9 @@ import ( storetypes "cosmossdk.io/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" - ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" + providerkeeper "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" ) const ( diff --git a/x/ccv/provider/migrations/v8/migrations_test.go b/x/ccv/provider/migrations/v8/migrations_test.go index 8f37f84d13..c687564364 100644 --- a/x/ccv/provider/migrations/v8/migrations_test.go +++ b/x/ccv/provider/migrations/v8/migrations_test.go @@ -8,8 +8,8 @@ import ( storetypes "cosmossdk.io/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - testutil "github.com/cosmos/interchain-security/v5/testutil/keeper" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + testutil "github.com/cosmos/interchain-security/v6/testutil/keeper" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" "github.com/stretchr/testify/require" ) diff --git a/x/ccv/provider/module.go b/x/ccv/provider/module.go index 2f089509ee..879393ed02 100644 --- a/x/ccv/provider/module.go +++ b/x/ccv/provider/module.go @@ -20,11 +20,11 @@ import ( abci "github.com/cometbft/cometbft/abci/types" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/client/cli" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/migrations" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/simulation" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/client/cli" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/migrations" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/simulation" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) var ( diff --git a/x/ccv/provider/module_test.go b/x/ccv/provider/module_test.go index 9cbe5d6f4c..480fba9260 100644 --- a/x/ccv/provider/module_test.go +++ b/x/ccv/provider/module_test.go @@ -14,11 +14,11 @@ import ( "cosmossdk.io/math" - "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" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" - ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" + "github.com/cosmos/interchain-security/v6/testutil/crypto" + testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" + "github.com/cosmos/interchain-security/v6/x/ccv/provider" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // Tests the provider's InitGenesis implementation against the spec. diff --git a/x/ccv/provider/proposal_handler.go b/x/ccv/provider/proposal_handler.go index ea66146039..03e1b2b96b 100644 --- a/x/ccv/provider/proposal_handler.go +++ b/x/ccv/provider/proposal_handler.go @@ -7,8 +7,8 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) // NewProviderProposalHandler defines the handler for consumer addition, diff --git a/x/ccv/provider/proposal_handler_test.go b/x/ccv/provider/proposal_handler_test.go index cf1e82284b..0d5c986e7b 100644 --- a/x/ccv/provider/proposal_handler_test.go +++ b/x/ccv/provider/proposal_handler_test.go @@ -10,9 +10,9 @@ import ( distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - 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" + testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" + "github.com/cosmos/interchain-security/v6/x/ccv/provider" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) // TestProviderProposalHandler tests the highest level handler for proposals diff --git a/x/ccv/provider/simulation/genesis.go b/x/ccv/provider/simulation/genesis.go index f27573cc7f..fc01d54209 100644 --- a/x/ccv/provider/simulation/genesis.go +++ b/x/ccv/provider/simulation/genesis.go @@ -6,7 +6,7 @@ import ( "math/rand" "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) // Simulation parameter constants diff --git a/x/ccv/provider/types/consumer.go b/x/ccv/provider/types/consumer.go index ebc1bcbf30..596d691aca 100644 --- a/x/ccv/provider/types/consumer.go +++ b/x/ccv/provider/types/consumer.go @@ -1,7 +1,7 @@ package types import ( - ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" + ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" ) func NewConsumerStates( diff --git a/x/ccv/provider/types/genesis.go b/x/ccv/provider/types/genesis.go index be4b9d8934..e3cc478e2e 100644 --- a/x/ccv/provider/types/genesis.go +++ b/x/ccv/provider/types/genesis.go @@ -9,7 +9,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" + ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" ) func NewGenesisState( diff --git a/x/ccv/provider/types/genesis.pb.go b/x/ccv/provider/types/genesis.pb.go index bbf069fec6..ac38de5c08 100644 --- a/x/ccv/provider/types/genesis.pb.go +++ b/x/ccv/provider/types/genesis.pb.go @@ -7,7 +7,7 @@ import ( fmt "fmt" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" - types "github.com/cosmos/interchain-security/v5/x/ccv/types" + types "github.com/cosmos/interchain-security/v6/x/ccv/types" io "io" math "math" math_bits "math/bits" @@ -302,7 +302,7 @@ var fileDescriptor_48411d9c7900d48e = []byte{ // 750 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xdd, 0x6e, 0xda, 0x48, 0x14, 0xc6, 0xc1, 0x80, 0x99, 0x04, 0xd6, 0xb2, 0x22, 0xe4, 0x4d, 0xb4, 0x04, 0xb1, 0x8a, 0x84, - 0xb4, 0xbb, 0x38, 0xb0, 0xaa, 0x54, 0xf5, 0xe7, 0x22, 0x24, 0x52, 0x83, 0x7b, 0x83, 0x48, 0x9a, + 0xb4, 0xbb, 0x38, 0xb0, 0x52, 0x55, 0xf5, 0xe7, 0x22, 0x24, 0x52, 0x83, 0x7b, 0x83, 0x48, 0x9a, 0x4a, 0xb9, 0xb1, 0x86, 0x99, 0x11, 0x1e, 0x01, 0xb6, 0xe5, 0x19, 0x9c, 0xa2, 0xaa, 0x52, 0xfb, 0x06, 0x7d, 0x93, 0xbe, 0x46, 0x2e, 0x73, 0xd9, 0xab, 0xa8, 0x4a, 0xfa, 0x04, 0x7d, 0x82, 0xca, 0xe3, 0x81, 0x40, 0x4a, 0x22, 0xd2, 0x3b, 0xfb, 0x7c, 0xf3, 0x9d, 0xf3, 0x9d, 0x5f, 0xd0, 0xa0, @@ -346,7 +346,7 @@ var fileDescriptor_48411d9c7900d48e = []byte{ 0x9f, 0x6f, 0xca, 0xa9, 0xcb, 0x9b, 0x72, 0xea, 0xeb, 0x4d, 0x39, 0x75, 0xf6, 0xb2, 0x4f, 0xb9, 0x3b, 0xee, 0xd5, 0x91, 0x3f, 0xb2, 0x90, 0xcf, 0x46, 0x3e, 0xb3, 0x6e, 0xf3, 0xf8, 0x6f, 0x76, 0xd4, 0xa3, 0x27, 0xd6, 0xbb, 0xc5, 0xcb, 0xce, 0x27, 0x01, 0x61, 0xbd, 0xac, 0x38, 0xea, 0xff, - 0xff, 0x0c, 0x00, 0x00, 0xff, 0xff, 0x1e, 0x1f, 0x55, 0x38, 0xd1, 0x06, 0x00, 0x00, + 0xff, 0x0c, 0x00, 0x00, 0xff, 0xff, 0x06, 0x3a, 0xf4, 0x7c, 0xd1, 0x06, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/x/ccv/provider/types/genesis_test.go b/x/ccv/provider/types/genesis_test.go index 09256a3cdd..6ae6179912 100644 --- a/x/ccv/provider/types/genesis_test.go +++ b/x/ccv/provider/types/genesis_test.go @@ -15,9 +15,9 @@ import ( abci "github.com/cometbft/cometbft/abci/types" tmtypes "github.com/cometbft/cometbft/types" - "github.com/cosmos/interchain-security/v5/testutil/crypto" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" - ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" + "github.com/cosmos/interchain-security/v6/testutil/crypto" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // Tests validation of consumer states and params within a provider genesis state diff --git a/x/ccv/provider/types/key_assignment.go b/x/ccv/provider/types/key_assignment.go index 7149ebc6cc..77ee1a4def 100644 --- a/x/ccv/provider/types/key_assignment.go +++ b/x/ccv/provider/types/key_assignment.go @@ -8,7 +8,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // A validator's consensus address on the provider chain. diff --git a/x/ccv/provider/types/keys.go b/x/ccv/provider/types/keys.go index ef7eae0172..c10f0a1cb9 100644 --- a/x/ccv/provider/types/keys.go +++ b/x/ccv/provider/types/keys.go @@ -9,7 +9,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) type Status int diff --git a/x/ccv/provider/types/keys_test.go b/x/ccv/provider/types/keys_test.go index 92ec762845..818596c2fc 100644 --- a/x/ccv/provider/types/keys_test.go +++ b/x/ccv/provider/types/keys_test.go @@ -9,9 +9,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - cryptoutil "github.com/cosmos/interchain-security/v5/testutil/crypto" - providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + cryptoutil "github.com/cosmos/interchain-security/v6/testutil/crypto" + providerkeeper "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) // Tests that all singular keys, or prefixes to fully resolves keys are non duplicate byte values. diff --git a/x/ccv/provider/types/msg.go b/x/ccv/provider/types/msg.go index f7ddd1ad4a..eb90e765f8 100644 --- a/x/ccv/provider/types/msg.go +++ b/x/ccv/provider/types/msg.go @@ -17,7 +17,7 @@ import ( tmtypes "github.com/cometbft/cometbft/proto/tendermint/types" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) const ( diff --git a/x/ccv/provider/types/msg_test.go b/x/ccv/provider/types/msg_test.go index c05a628ac4..fd7e094341 100644 --- a/x/ccv/provider/types/msg_test.go +++ b/x/ccv/provider/types/msg_test.go @@ -6,8 +6,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - cryptoutil "github.com/cosmos/interchain-security/v5/testutil/crypto" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + cryptoutil "github.com/cosmos/interchain-security/v6/testutil/crypto" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" "github.com/stretchr/testify/require" ) diff --git a/x/ccv/provider/types/params.go b/x/ccv/provider/types/params.go index 3fddd002a1..f66324ed5f 100644 --- a/x/ccv/provider/types/params.go +++ b/x/ccv/provider/types/params.go @@ -12,7 +12,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" + ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) const ( diff --git a/x/ccv/provider/types/params_test.go b/x/ccv/provider/types/params_test.go index 12bfee81a0..8001663c30 100644 --- a/x/ccv/provider/types/params_test.go +++ b/x/ccv/provider/types/params_test.go @@ -12,7 +12,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) func TestValidateParams(t *testing.T) { diff --git a/x/ccv/provider/types/provider.pb.go b/x/ccv/provider/types/provider.pb.go index 77d0dc6d98..418a9bdfb8 100644 --- a/x/ccv/provider/types/provider.pb.go +++ b/x/ccv/provider/types/provider.pb.go @@ -16,7 +16,7 @@ import ( github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" types "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" _07_tendermint "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" - types3 "github.com/cosmos/interchain-security/v5/x/ccv/types" + types3 "github.com/cosmos/interchain-security/v6/x/ccv/types" _ "google.golang.org/protobuf/types/known/durationpb" _ "google.golang.org/protobuf/types/known/timestamppb" io "io" @@ -1833,7 +1833,7 @@ var fileDescriptor_f22ec409a72b7b72 = []byte{ // 2238 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x59, 0xbd, 0x6f, 0x1b, 0xc9, 0x15, 0xd7, 0x8a, 0x94, 0x44, 0x3e, 0xea, 0x83, 0x1a, 0xfb, 0x6c, 0x4a, 0xa7, 0xa3, 0x68, 0x5e, - 0x6c, 0x28, 0x76, 0x4c, 0x9e, 0x74, 0x08, 0x60, 0x38, 0x39, 0x18, 0x32, 0x49, 0xdb, 0xf4, 0x87, + 0x6c, 0x28, 0x76, 0x4c, 0x9e, 0x74, 0x40, 0x60, 0x38, 0x39, 0x18, 0x32, 0x49, 0xdb, 0xf4, 0x87, 0xcc, 0x2c, 0x69, 0x1d, 0xe0, 0x14, 0x8b, 0xe1, 0xee, 0x88, 0x9c, 0x68, 0x77, 0x67, 0xbd, 0x33, 0xa4, 0xcd, 0x14, 0xa9, 0x0f, 0x01, 0x02, 0x5c, 0x52, 0x1d, 0xd2, 0xe4, 0x80, 0x34, 0x41, 0xaa, 0x14, 0x41, 0xfe, 0x80, 0x54, 0x97, 0x00, 0x41, 0xae, 0x4c, 0x75, 0x17, 0xd8, 0x45, 0x8a, 0x00, @@ -1970,7 +1970,7 @@ var fileDescriptor_f22ec409a72b7b72 = []byte{ 0xfb, 0xfa, 0x79, 0x51, 0xfb, 0xe7, 0xf3, 0xa2, 0xf6, 0xf9, 0x8b, 0xe2, 0xcc, 0xd7, 0x2f, 0x8a, 0x33, 0xff, 0x78, 0x51, 0x9c, 0x79, 0xfc, 0xc9, 0xf1, 0x4c, 0x3e, 0xae, 0x94, 0x57, 0xe3, 0x5f, 0x33, 0x86, 0xdf, 0xaf, 0x3e, 0x9b, 0xfc, 0xad, 0x44, 0x25, 0xf9, 0xee, 0xbc, 0x0a, 0xd2, 0x8f, - 0xff, 0x17, 0x00, 0x00, 0xff, 0xff, 0x79, 0x8b, 0xb8, 0x2d, 0x5c, 0x19, 0x00, 0x00, + 0xff, 0x17, 0x00, 0x00, 0xff, 0xff, 0x61, 0xae, 0x19, 0x69, 0x5c, 0x19, 0x00, 0x00, } func (m *ConsumerAdditionProposal) Marshal() (dAtA []byte, err error) { diff --git a/x/ccv/provider/types/query.pb.go b/x/ccv/provider/types/query.pb.go index fa0c569918..222aefabd0 100644 --- a/x/ccv/provider/types/query.pb.go +++ b/x/ccv/provider/types/query.pb.go @@ -14,7 +14,7 @@ import ( grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" - types "github.com/cosmos/interchain-security/v5/x/ccv/types" + types "github.com/cosmos/interchain-security/v6/x/ccv/types" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -1835,154 +1835,154 @@ func init() { var fileDescriptor_422512d7b7586cd7 = []byte{ // 2386 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x5a, 0xcd, 0x73, 0xdb, 0xc6, - 0x15, 0x17, 0xa8, 0x0f, 0x53, 0x2b, 0x4b, 0x8e, 0xd7, 0xb2, 0x4d, 0x53, 0xb6, 0x28, 0xc3, 0xf1, - 0x8c, 0x62, 0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x09, - 0xc1, 0x8e, 0xad, 0x71, 0xa9, 0x13, 0x5c, 0xea, 0xb9, 0x14, 0x52, 0xd5, 0x13, 0x01, 0x48, 0x35, - 0xc4, 0x50, 0x99, 0x16, 0x8f, 0x40, 0x21, 0x74, 0x6d, 0x1c, 0xfe, 0x50, 0x06, 0xf8, 0x00, 0x24, + 0xc1, 0x8e, 0xad, 0x71, 0xa9, 0x13, 0x5c, 0xea, 0xf9, 0x14, 0x52, 0xd5, 0x93, 0x01, 0x48, 0x35, + 0xc4, 0x50, 0x99, 0x16, 0x8f, 0x40, 0x21, 0x74, 0x6d, 0x1c, 0xfe, 0x48, 0x06, 0xf8, 0x00, 0x24, 0x06, 0x7f, 0x07, 0x4c, 0x99, 0x88, 0x18, 0x1e, 0x76, 0x59, 0xe7, 0x54, 0xc8, 0x73, 0xcf, 0x9f, - 0x2b, 0x8b, 0x56, 0x22, 0x68, 0x16, 0x44, 0xf3, 0x50, 0xbe, 0xd9, 0x25, 0x15, 0x77, 0xa5, 0x97, - 0x1b, 0x3e, 0x02, 0xa7, 0x42, 0x5d, 0x1d, 0x17, 0x79, 0xbc, 0x04, 0x0c, 0xe2, 0x81, 0x17, 0x6a, - 0x95, 0xb3, 0x5f, 0x7f, 0x71, 0xe9, 0x8c, 0x40, 0x0f, 0xe3, 0x47, 0xc4, 0xc1, 0x26, 0xf5, 0xb0, - 0x5d, 0x57, 0x4f, 0x06, 0x18, 0xf7, 0x05, 0x44, 0x10, 0x26, 0x27, 0xc0, 0xc4, 0x8f, 0x74, 0x6c, + 0x2f, 0x8b, 0x56, 0x22, 0x68, 0x16, 0x44, 0xf3, 0x50, 0xbe, 0xd9, 0x25, 0x15, 0x77, 0xa5, 0x97, + 0x1b, 0x3e, 0x02, 0xa7, 0x43, 0x5d, 0x1d, 0x17, 0x79, 0xbc, 0x04, 0x0c, 0xe2, 0x81, 0x17, 0x6a, + 0x95, 0x73, 0xdf, 0x7c, 0x79, 0xf9, 0xac, 0x40, 0x0f, 0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0x14, 0x14, 0xaf, 0xef, 0x9b, 0x5f, 0x98, 0xb6, 0xce, 0x4d, 0xbb, 0x01, 0xaf, + 0x65, 0x4d, 0x80, 0xd1, 0x28, 0xae, 0x7c, 0xf4, 0xd5, 0xf3, 0x79, 0xe9, 0xeb, 0xe7, 0xf3, 0xd2, + 0x5f, 0x9f, 0xcf, 0x4b, 0x9f, 0xbd, 0x98, 0x1f, 0xf9, 0xfa, 0xc5, 0xfc, 0xc8, 0x1f, 0x5f, 0xcc, + 0x8f, 0x3c, 0xbc, 0x5a, 0xc7, 0xb4, 0xd1, 0xda, 0x2e, 0x1b, 0x4e, 0x53, 0xfc, 0xdf, 0x48, 0x8f, + 0xa8, 0xcb, 0xa1, 0xa8, 0xf6, 0x5b, 0xca, 0xd3, 0x58, 0xed, 0xd9, 0x71, 0x11, 0xd9, 0x9e, 0xe0, + 0x7f, 0x24, 0xfc, 0xce, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, 0x7c, 0x8f, 0x78, 0xcc, 0xd7, 0x23, 0x00, 0x00, } diff --git a/x/ccv/provider/types/tx.pb.go b/x/ccv/provider/types/tx.pb.go index 999fffef8a..d208d725c3 100644 --- a/x/ccv/provider/types/tx.pb.go +++ b/x/ccv/provider/types/tx.pb.go @@ -1685,7 +1685,7 @@ var fileDescriptor_43221a4391e9fbf4 = []byte{ // 2075 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x59, 0xcb, 0x6f, 0x1c, 0x49, 0x19, 0x77, 0xcf, 0x8c, 0xbd, 0x33, 0xe5, 0x77, 0xdb, 0x59, 0xb7, 0x27, 0x89, 0xc7, 0x31, 0xcb, - 0xae, 0x15, 0xd6, 0x3d, 0xc4, 0x90, 0x5d, 0x30, 0xe1, 0xe1, 0x47, 0x20, 0x5e, 0x70, 0xec, 0x6d, + 0xae, 0x15, 0xd6, 0x3d, 0xc4, 0xb0, 0x59, 0x30, 0xe1, 0xe1, 0x47, 0x20, 0x5e, 0x70, 0xec, 0x6d, 0x87, 0xac, 0x04, 0x12, 0xad, 0x9a, 0xee, 0x4a, 0x4f, 0x29, 0xdd, 0x5d, 0xad, 0xae, 0x9a, 0xf1, 0x9a, 0x13, 0x8a, 0x84, 0x94, 0x63, 0xd0, 0x72, 0xe0, 0xc6, 0x1e, 0xb8, 0x20, 0x01, 0xda, 0xc3, 0x9e, 0xf8, 0x0b, 0x56, 0xe2, 0xb2, 0xac, 0x38, 0xa0, 0x3d, 0x04, 0x94, 0x1c, 0x96, 0x33, 0x07, @@ -1708,80 +1708,80 @@ var fileDescriptor_43221a4391e9fbf4 = []byte{ 0xb6, 0xef, 0xea, 0x6f, 0x82, 0xe9, 0xc4, 0x37, 0x1b, 0xba, 0x6e, 0x6c, 0x14, 0x04, 0x46, 0xff, 0xe7, 0xd3, 0xda, 0xcc, 0x29, 0x0c, 0xfc, 0xad, 0x35, 0x3e, 0x8a, 0x28, 0x5d, 0xb3, 0xa6, 0x12, 0xe0, 0xb6, 0xeb, 0xc6, 0xfa, 0x35, 0x30, 0xe5, 0x28, 0x33, 0xf6, 0x43, 0x74, 0x6a, 0x14, 0xb9, - 0x9e, 0x35, 0xe9, 0x74, 0x99, 0x7e, 0x03, 0x54, 0x68, 0xab, 0x11, 0x60, 0xc6, 0x50, 0x6c, 0x94, - 0x04, 0xaf, 0xf1, 0xc9, 0x87, 0x1b, 0x8b, 0x2a, 0xf1, 0xdb, 0x92, 0xf8, 0x98, 0xc5, 0x38, 0xf4, - 0xac, 0x0e, 0x54, 0xaf, 0x81, 0x94, 0x86, 0x7b, 0x3d, 0x2e, 0x98, 0x41, 0x32, 0xb4, 0xef, 0x6e, - 0xbd, 0xfc, 0xf8, 0xfd, 0xda, 0xd8, 0x3f, 0xde, 0xaf, 0x8d, 0x3d, 0xfa, 0xec, 0x83, 0xeb, 0x1d, - 0xc5, 0xb5, 0x15, 0x70, 0x65, 0x50, 0x0e, 0x2c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0x28, 0x87, 0xab, 0x62, 0xb6, 0x78, 0x91, 0x35, 0x55, + 0x69, 0x15, 0x33, 0xc4, 0x11, 0xca, 0xbf, 0x69, 0xa5, 0x27, 0x07, 0x79, 0xf1, 0xf1, 0x50, 0x88, + 0x28, 0xa6, 0x76, 0x13, 0xd2, 0xa6, 0x98, 0xf4, 0x29, 0x6b, 0x52, 0x8d, 0xdd, 0x81, 0xb4, 0xc9, + 0xa7, 0xb0, 0x81, 0x43, 0x18, 0x9f, 0x4a, 0x44, 0x49, 0x20, 0x80, 0x1c, 0x12, 0x80, 0x5d, 0x00, + 0x68, 0x04, 0x4f, 0x42, 0x9b, 0xb7, 0x1d, 0x51, 0x64, 0xb8, 0x23, 0xb2, 0xa5, 0x98, 0x49, 0x4b, + 0x31, 0xef, 0x25, 0x3d, 0x69, 0xa7, 0xcc, 0x1d, 0x79, 0xf2, 0xb7, 0x9a, 0x66, 0x55, 0x84, 0x1e, + 0x97, 0xe8, 0x77, 0xc1, 0x5c, 0x2b, 0x6c, 0x90, 0xd0, 0xc5, 0xa1, 0x67, 0x47, 0x28, 0xc6, 0xc4, + 0x35, 0x26, 0x04, 0xd5, 0x72, 0x1f, 0xd5, 0x9e, 0xea, 0x5e, 0x92, 0xe9, 0x57, 0x9c, 0x69, 0x36, + 0x55, 0x3e, 0x12, 0xba, 0xfa, 0xdb, 0x40, 0x77, 0x9c, 0xb6, 0x70, 0x89, 0xb4, 0x58, 0xc2, 0xf8, + 0x52, 0x7e, 0xc6, 0x39, 0xc7, 0x69, 0xdf, 0x93, 0xda, 0x8a, 0xf2, 0xc7, 0x60, 0x89, 0xc5, 0x30, + 0xa4, 0x0f, 0x50, 0xdc, 0xcb, 0x5b, 0xce, 0xcf, 0x7b, 0x29, 0xe1, 0xc8, 0x92, 0xdf, 0x01, 0xab, + 0xe9, 0x46, 0x89, 0x91, 0x8b, 0x29, 0x8b, 0x71, 0xa3, 0x25, 0x76, 0x65, 0xb2, 0xaf, 0x8c, 0x8a, + 0x58, 0x04, 0x2b, 0x09, 0xce, 0xca, 0xc0, 0xbe, 0xab, 0x50, 0xfa, 0x21, 0x78, 0x45, 0xec, 0x63, + 0xca, 0x9d, 0xb3, 0x33, 0x4c, 0xc2, 0x74, 0x80, 0x29, 0xe5, 0x6c, 0x60, 0x55, 0x5b, 0x2f, 0x5a, + 0xd7, 0x24, 0xf6, 0x08, 0xc5, 0x7b, 0x5d, 0xc8, 0x7b, 0x5d, 0x40, 0x7d, 0x03, 0xe8, 0x4d, 0x4c, + 0x19, 0x89, 0xb1, 0x03, 0x7d, 0x1b, 0x85, 0x2c, 0xc6, 0x88, 0x1a, 0x93, 0x42, 0x7d, 0xbe, 0x23, + 0xb9, 0x2d, 0x05, 0xfa, 0x5b, 0xe0, 0xda, 0x99, 0x46, 0x6d, 0xa7, 0x09, 0xc3, 0x10, 0xf9, 0xc6, + 0x94, 0x08, 0xa5, 0xe6, 0x9e, 0x61, 0x73, 0x57, 0xc2, 0xf4, 0x05, 0x30, 0xce, 0x48, 0x64, 0xdf, + 0x35, 0xa6, 0x57, 0xb5, 0xf5, 0x69, 0xab, 0xc4, 0x48, 0x74, 0x57, 0xff, 0x32, 0x58, 0x6c, 0x43, + 0x1f, 0xbb, 0x90, 0x91, 0x98, 0xda, 0x11, 0x39, 0x41, 0xb1, 0xed, 0xc0, 0xc8, 0x98, 0x11, 0x18, + 0xbd, 0x23, 0x3b, 0xe2, 0xa2, 0x5d, 0x18, 0xe9, 0xd7, 0xc1, 0x7c, 0x3a, 0x6a, 0x53, 0xc4, 0x04, + 0x7c, 0x56, 0xc0, 0x67, 0x53, 0xc1, 0x31, 0x62, 0x1c, 0x7b, 0x05, 0x54, 0xa0, 0xef, 0x93, 0x13, + 0x1f, 0x53, 0x66, 0xcc, 0xad, 0x16, 0xd7, 0x2b, 0x56, 0x67, 0x40, 0xaf, 0x82, 0xb2, 0x8b, 0xc2, + 0x53, 0x21, 0x9c, 0x17, 0xc2, 0xf4, 0x3d, 0x5b, 0x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xf4, 0x55, 0x30, 0xe9, 0x22, 0xea, 0xc4, 0x38, 0x12, 0x07, + 0x84, 0x82, 0xdc, 0x1d, 0x5d, 0x43, 0x99, 0x4a, 0x5e, 0xcc, 0x56, 0xf2, 0xb4, 0xb9, 0x96, 0x72, + 0x34, 0xd7, 0xf1, 0xe1, 0x9a, 0xeb, 0x44, 0x8e, 0xe6, 0xfa, 0xd2, 0x79, 0xcd, 0xb5, 0x7c, 0x5e, + 0x73, 0xad, 0x8c, 0xd8, 0x5c, 0x41, 0xbe, 0xe6, 0x3a, 0x99, 0xb7, 0xb9, 0x5e, 0x03, 0xb5, 0x33, + 0xe6, 0x2b, 0x9d, 0xd3, 0x3f, 0x15, 0xc5, 0x16, 0xda, 0x8d, 0x11, 0x64, 0x9d, 0x36, 0x34, 0xea, + 0x7d, 0x70, 0xb9, 0x77, 0x83, 0x74, 0x66, 0xf3, 0x1d, 0x50, 0x0e, 0x10, 0x83, 0x2e, 0x64, 0x50, + 0x5d, 0xdd, 0xde, 0xc8, 0x75, 0x7b, 0x49, 0xbd, 0x57, 0xca, 0xea, 0x9e, 0x90, 0x92, 0xe9, 0x8f, 0x34, 0xb0, 0xac, 0x2e, 0x0d, 0xf8, 0xa7, 0x22, 0x38, 0x5b, 0xdc, 0x71, 0x10, 0x43, 0x31, 0x15, 0x6b, 0x67, 0x72, 0xf3, 0xf6, 0x50, 0xa6, 0xf6, 0x33, 0x6c, 0x47, 0x29, 0x99, 0x65, 0xe0, 0x33, 0x24, 0x7a, 0x0b, 0x18, 0x72, 0x2d, 0xd2, 0x26, 0x8c, 0xc4, 0x15, 0xa1, 0xe3, 0x82, 0xbc, 0x71, @@ -1802,8 +1802,8 @@ var fileDescriptor_43221a4391e9fbf4 = []byte{ 0xa5, 0xa7, 0x9e, 0xe7, 0x76, 0x25, 0xab, 0x97, 0xdf, 0x95, 0xc1, 0x85, 0x43, 0xb8, 0xd2, 0x73, 0xdb, 0xcd, 0xed, 0x4a, 0x56, 0x2f, 0x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, 0x2d, 0x6a, 0x4c, 0x88, 0x6f, 0x76, 0x5f, 0xf9, 0x77, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x72, 0x99, 0x09, 0x26, 0xc8, 0x1e, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x6a, 0xbc, 0xa8, 0x62, 0xc8, 0x1e, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/ccv/types/shared_consumer.pb.go b/x/ccv/types/shared_consumer.pb.go index 92d0d82e6a..5ab076dbf2 100644 --- a/x/ccv/types/shared_consumer.pb.go +++ b/x/ccv/types/shared_consumer.pb.go @@ -344,7 +344,7 @@ var fileDescriptor_d0a8be0efc64dfbc = []byte{ // 817 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0x41, 0x73, 0xdc, 0x34, 0x14, 0x8e, 0xb3, 0x25, 0xdd, 0x68, 0x93, 0xa6, 0x88, 0x50, 0x4c, 0x3a, 0xb3, 0x71, 0x03, 0x87, - 0x1d, 0x98, 0xda, 0x24, 0x94, 0x61, 0x86, 0x1b, 0x49, 0x28, 0xa5, 0x87, 0x64, 0xeb, 0x84, 0x32, + 0x1d, 0x98, 0xda, 0x24, 0x74, 0x60, 0x86, 0x1b, 0x49, 0x28, 0xa5, 0x87, 0x64, 0xeb, 0x84, 0x32, 0x03, 0x07, 0x8d, 0x2c, 0xbd, 0x5d, 0x6b, 0xb0, 0x25, 0x8f, 0x24, 0x3b, 0xe4, 0x17, 0x70, 0xe5, 0xc8, 0x4f, 0x2a, 0xb7, 0x1e, 0x39, 0x01, 0x93, 0xfc, 0x11, 0xc6, 0xb2, 0x9d, 0x78, 0x19, 0x02, 0xe9, 0x4d, 0x4f, 0xef, 0xfb, 0x3e, 0xfb, 0x7b, 0xd2, 0x7b, 0x42, 0x9f, 0x08, 0x69, 0x41, 0xb3, @@ -392,7 +392,7 @@ var fileDescriptor_d0a8be0efc64dfbc = []byte{ 0xfe, 0xba, 0x18, 0x7b, 0xbf, 0x5c, 0x8e, 0x97, 0x5e, 0x5f, 0x8e, 0x97, 0x7e, 0xbf, 0x1c, 0x2f, 0x7d, 0xff, 0x64, 0x2e, 0x6c, 0x5a, 0x26, 0x21, 0x53, 0x79, 0xc4, 0x94, 0xc9, 0x95, 0x89, 0xae, 0xcf, 0xe2, 0xf1, 0xd5, 0xcb, 0x51, 0x7d, 0x16, 0xfd, 0xe4, 0x9e, 0x0f, 0x37, 0xf8, 0x93, 0x15, - 0x77, 0xa9, 0x3e, 0xfd, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x00, 0xe4, 0xb0, 0x69, 0x66, 0x06, 0x00, + 0x77, 0xa9, 0x3e, 0xfd, 0x3b, 0x00, 0x00, 0xff, 0xff, 0xe3, 0x66, 0xae, 0x12, 0x66, 0x06, 0x00, 0x00, } diff --git a/x/ccv/types/utils_test.go b/x/ccv/types/utils_test.go index 081570abf2..34509f8473 100644 --- a/x/ccv/types/utils_test.go +++ b/x/ccv/types/utils_test.go @@ -10,7 +10,7 @@ import ( abci "github.com/cometbft/cometbft/abci/types" - "github.com/cosmos/interchain-security/v5/x/ccv/types" + "github.com/cosmos/interchain-security/v6/x/ccv/types" ) func TestAccumulateChanges(t *testing.T) { diff --git a/x/ccv/types/wire.pb.go b/x/ccv/types/wire.pb.go index a0cdc795c2..5443f79771 100644 --- a/x/ccv/types/wire.pb.go +++ b/x/ccv/types/wire.pb.go @@ -596,56 +596,56 @@ var fileDescriptor_8fd0dc67df6b10ed = []byte{ // 834 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0xcd, 0x6e, 0xdb, 0x46, 0x10, 0x26, 0x65, 0x23, 0xad, 0x57, 0x85, 0x4c, 0x33, 0x6a, 0xc0, 0x32, 0xad, 0x42, 0x10, 0x2d, - 0x20, 0xb8, 0x08, 0x59, 0xc9, 0xe9, 0xa5, 0xbd, 0x54, 0x3f, 0x74, 0xcd, 0x36, 0x96, 0x05, 0x52, - 0x52, 0x90, 0x5e, 0x88, 0x15, 0xb9, 0x96, 0x16, 0x92, 0xb8, 0x04, 0x77, 0xc5, 0x54, 0x6f, 0x50, - 0xe8, 0xd4, 0x17, 0xd0, 0xa9, 0xe8, 0x21, 0x8f, 0xd1, 0x5b, 0x8e, 0x01, 0x7a, 0xc9, 0xa5, 0x41, - 0x61, 0xbf, 0x41, 0x9f, 0xa0, 0x20, 0xf5, 0x6b, 0x89, 0x36, 0x10, 0xa0, 0x40, 0x73, 0x23, 0x67, - 0xe7, 0xfb, 0x76, 0xe6, 0xfb, 0x66, 0x31, 0xe0, 0x0b, 0xec, 0x33, 0x14, 0xba, 0x7d, 0x88, 0x7d, - 0x87, 0x22, 0x77, 0x1c, 0x62, 0x36, 0xd1, 0x5d, 0x37, 0xd2, 0xa3, 0x92, 0xfe, 0x02, 0x87, 0x48, - 0x0b, 0x42, 0xc2, 0x88, 0x28, 0xa7, 0xa4, 0x69, 0xae, 0x1b, 0x69, 0x51, 0x49, 0xfe, 0xdc, 0x25, - 0x74, 0x44, 0xa8, 0x4e, 0x19, 0x1c, 0x60, 0xbf, 0xa7, 0x47, 0xa5, 0x2e, 0x62, 0xb0, 0xb4, 0xfc, - 0x9f, 0x33, 0xc8, 0xf9, 0x1e, 0xe9, 0x91, 0xe4, 0x53, 0x8f, 0xbf, 0x16, 0xd1, 0x87, 0x0c, 0xf9, - 0x1e, 0x0a, 0x47, 0xd8, 0x67, 0x3a, 0xec, 0xba, 0x58, 0x67, 0x93, 0x00, 0xd1, 0xf9, 0xa1, 0xfa, - 0x86, 0x07, 0x9f, 0x76, 0xe0, 0x10, 0x7b, 0x90, 0x91, 0xd0, 0x46, 0xac, 0xd6, 0x87, 0x7e, 0x0f, - 0x35, 0xa1, 0x3b, 0x40, 0xac, 0x0e, 0x19, 0x14, 0x09, 0x38, 0x8a, 0x96,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, 0xa0, 0xfe, 0xc9, 0x83, 0x43, 0x3b, 0xe6, + 0xdb, 0x40, 0x5b, 0xe0, 0x60, 0x55, 0x72, 0x02, 0xcb, 0x96, 0xe5, 0xdb, 0x75, 0xa8, 0x4a, 0x0b, + 0x05, 0x84, 0x2d, 0x05, 0x54, 0x6b, 0x4d, 0xf3, 0x0e, 0x2d, 0x57, 0x01, 0xc0, 0xfe, 0x65, 0x08, + 0x5d, 0x86, 0x89, 0x2f, 0xed, 0x29, 0x7c, 0x31, 0x57, 0x56, 0xb5, 0xf9, 0x70, 0x68, 0xcb, 0x61, + 0x58, 0x0c, 0x87, 0x66, 0xae, 0x32, 0xad, 0x0d, 0x94, 0xfa, 0x7b, 0x06, 0x88, 0x35, 0xe2, 0xd3, + 0xf1, 0x08, 0x85, 0x1b, 0x8d, 0x9d, 0x82, 0xfd, 0x78, 0x30, 0x92, 0x9e, 0x72, 0xe5, 0xb2, 0x76, + 0xfb, 0x34, 0x6a, 0xbb, 0xe8, 0xd6, 0x24, 0x40, 0x56, 0x82, 0x17, 0x9f, 0x81, 0x43, 0x7a, 0x53, + 0xb3, 0xa4, 0x97, 0x6c, 0xf9, 0xcb, 0xbb, 0x28, 0xb7, 0x64, 0x3e, 0xe3, 0xac, 0x6d, 0x16, 0xf1, + 0x12, 0xe4, 0x23, 0xea, 0xee, 0xf8, 0x99, 0xa8, 0x90, 0x2d, 0x7f, 0x75, 0x17, 0x7b, 0xda, 0x1c, + 0x9c, 0x71, 0x56, 0x2a, 0x5f, 0xf5, 0x1e, 0xd8, 0xf7, 0x20, 0x83, 0x6a, 0x17, 0x1c, 0x9d, 0x41, + 0xdf, 0xa3, 0x7d, 0x38, 0x40, 0xe7, 0x88, 0xc1, 0x38, 0x28, 0x9e, 0x80, 0x07, 0x41, 0x48, 0x22, + 0xec, 0xa1, 0xd0, 0xb9, 0x44, 0xc8, 0x09, 0x08, 0x19, 0x3a, 0xd0, 0xf3, 0xe6, 0xb3, 0x70, 0x60, + 0xd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, 0x96, 0x79, 0xd1, 0x48, 0x2b, 0xfb, 0xfe, 0x74, 0xa6, 0x1c, 0xae, + 0x41, 0xc6, 0x28, 0x60, 0x13, 0x51, 0xdf, 0x45, 0xd5, 0x2f, 0xda, 0xd5, 0xa7, 0x86, 0x63, 0x9b, + 0xdf, 0x37, 0x04, 0x5e, 0xce, 0x4d, 0x67, 0x0a, 0xa8, 0x93, 0x71, 0x77, 0x88, 0x6c, 0xdc, 0xf3, + 0xc5, 0x63, 0x20, 0xed, 0x02, 0x9e, 0x35, 0x5a, 0xe6, 0xb9, 0x21, 0x64, 0xe4, 0x8f, 0xa6, 0x33, + 0xe5, 0xc3, 0x3a, 0x79, 0xe1, 0x33, 0x3c, 0x42, 0xf3, 0x5a, 0xab, 0x8d, 0x57, 0x57, 0x05, 0xfe, + 0xf5, 0x55, 0x81, 0xff, 0xfb, 0xaa, 0xc0, 0xff, 0x7a, 0x5d, 0xe0, 0x5e, 0x5f, 0x17, 0xb8, 0x37, + 0xd7, 0x05, 0xee, 0xa7, 0x27, 0x3d, 0xcc, 0xfa, 0xe3, 0xae, 0xe6, 0x92, 0x91, 0xbe, 0x58, 0xbc, + 0x6b, 0x4b, 0x1f, 0xaf, 0x56, 0x78, 0xf4, 0xb5, 0xfe, 0x73, 0xb2, 0xc7, 0x93, 0x85, 0xda, 0xbd, + 0x97, 0x6c, 0xd4, 0x93, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x32, 0x02, 0xb3, 0xda, 0xef, 0x07, 0x00, 0x00, } diff --git a/x/ccv/types/wire_test.go b/x/ccv/types/wire_test.go index 300ed7071f..408221bc0e 100644 --- a/x/ccv/types/wire_test.go +++ b/x/ccv/types/wire_test.go @@ -12,8 +12,8 @@ import ( abci "github.com/cometbft/cometbft/abci/types" - "github.com/cosmos/interchain-security/v5/testutil/crypto" - "github.com/cosmos/interchain-security/v5/x/ccv/types" + "github.com/cosmos/interchain-security/v6/testutil/crypto" + "github.com/cosmos/interchain-security/v6/x/ccv/types" ) func TestPacketDataValidateBasic(t *testing.T) { From 7fa04b5f6728c0af52292170b2b1226570c1a164 Mon Sep 17 00:00:00 2001 From: Cosmos SDK <113218068+github-prbot@users.noreply.github.com> Date: Fri, 6 Sep 2024 14:18:39 +0200 Subject: [PATCH 14/28] chore: fix spelling errors (#2231) chore: spelling errors fixes Co-authored-by: github-merge-queue <118344674+github-merge-queue@users.noreply.github.com> --- x/ccv/provider/keeper/consumer_lifecycle.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/ccv/provider/keeper/consumer_lifecycle.go b/x/ccv/provider/keeper/consumer_lifecycle.go index 0ef87a4b41..da1fa29e02 100644 --- a/x/ccv/provider/keeper/consumer_lifecycle.go +++ b/x/ccv/provider/keeper/consumer_lifecycle.go @@ -37,7 +37,7 @@ func (k Keeper) PrepareConsumerForLaunch(ctx sdk.Context, consumerId string, pre } // InitializeConsumer tries to move a consumer with `consumerId` to the initialized phase. -// If successfull, it returns the spawn time and true. +// If successful, it returns the spawn time and true. func (k Keeper) InitializeConsumer(ctx sdk.Context, consumerId string) (time.Time, bool) { // a chain needs to be in the registered or initialized phase phase := k.GetConsumerPhase(ctx, consumerId) From a17a3851b5eb3cec515b711dceae0afe9c14c3f0 Mon Sep 17 00:00:00 2001 From: Marius Poke Date: Fri, 6 Sep 2024 14:18:52 +0200 Subject: [PATCH 15/28] chore: fix gosec (#2230) * handle errors * exclude G115 from gosec: integer overflow conversion int issues --- .github/workflows/gosec.yml | 2 +- tests/integration/distribution.go | 9 ++-- tests/integration/slashing.go | 13 +++--- tests/mbt/driver/setup.go | 3 +- x/ccv/provider/keeper/consumer_lifecycle.go | 5 ++- x/ccv/provider/keeper/distribution_test.go | 3 +- x/ccv/provider/keeper/genesis.go | 5 ++- x/ccv/provider/keeper/grpc_query_test.go | 6 ++- x/ccv/provider/keeper/key_assignment_test.go | 3 +- x/ccv/provider/keeper/provider_consensus.go | 8 ++-- .../keeper/provider_consensus_test.go | 15 ++++--- x/ccv/provider/keeper/relay.go | 10 ++++- x/ccv/provider/keeper/relay_test.go | 20 +++++---- .../keeper/staking_keeper_interface.go | 6 ++- x/ccv/provider/keeper/validator_set_update.go | 8 ++-- .../keeper/validator_set_update_test.go | 12 ++++-- x/ccv/provider/migrations/v8/migrations.go | 42 +++++++++++++++---- 17 files changed, 117 insertions(+), 53 deletions(-) diff --git a/.github/workflows/gosec.yml b/.github/workflows/gosec.yml index 6e23df8031..511370ebda 100644 --- a/.github/workflows/gosec.yml +++ b/.github/workflows/gosec.yml @@ -28,4 +28,4 @@ jobs: - name: Run Gosec Security Scanner uses: securego/gosec@master with: - args: -exclude-dir=tests -exclude-dir=app -exclude-generated ./... + args: "-exclude=G115 -exclude-dir=tests -exclude-dir=testutil -exclude-dir=app -exclude-generated ./..." diff --git a/tests/integration/distribution.go b/tests/integration/distribution.go index dccd91bb22..374238d33f 100644 --- a/tests/integration/distribution.go +++ b/tests/integration/distribution.go @@ -892,7 +892,8 @@ func (s *CCVTestSuite) TestAllocateTokensToConsumerValidators() { consuVals, err := providerKeeper.GetConsumerValSet(ctx, consumerId) s.Require().NoError(err) providerKeeper.DeleteConsumerValSet(ctx, consumerId) - providerKeeper.SetConsumerValSet(ctx, consumerId, consuVals[0:tc.consuValLen]) + err = providerKeeper.SetConsumerValSet(ctx, consumerId, consuVals[0:tc.consuValLen]) + s.Require().NoError(err) consuVals, err = providerKeeper.GetConsumerValSet(ctx, consumerId) s.Require().NoError(err) @@ -1003,10 +1004,12 @@ func (s *CCVTestSuite) TestAllocateTokensToConsumerValidatorsWithDifferentValida // have not been consumer validators for `GetNumberOfEpochsToStartReceivingRewards * GetBlocksPerEpoch` blocks consuVals[2].JoinHeight = 2 consuVals[3].JoinHeight = 2 - providerKeeper.SetConsumerValSet(ctx, consumerId, consuVals) + err = providerKeeper.SetConsumerValSet(ctx, consumerId, consuVals) + s.Require().NoError(err) providerKeeper.DeleteConsumerValSet(ctx, consumerId) - providerKeeper.SetConsumerValSet(ctx, consumerId, consuVals) + err = providerKeeper.SetConsumerValSet(ctx, consumerId, consuVals) + s.Require().NoError(err) consuVals, err = providerKeeper.GetConsumerValSet(ctx, consumerId) s.Require().NoError(err) diff --git a/tests/integration/slashing.go b/tests/integration/slashing.go index b64ed76bfb..dc73e106d3 100644 --- a/tests/integration/slashing.go +++ b/tests/integration/slashing.go @@ -397,12 +397,12 @@ func (suite *CCVTestSuite) TestOnRecvSlashPacketErrors() { // Expect no error if validator does not exist _, err = providerKeeper.OnRecvSlashPacket(ctx, packet, *slashPacketData) - suite.Require().NoError(err, "no error expected") + suite.Require().NoError(err) // Check expected behavior for handling SlashPackets for double signing infractions slashPacketData.Infraction = stakingtypes.Infraction_INFRACTION_DOUBLE_SIGN ackResult, err := providerKeeper.OnRecvSlashPacket(ctx, packet, *slashPacketData) - suite.Require().NoError(err, "no error expected") + suite.Require().NoError(err) suite.Require().Equal(ccv.V1Result, ackResult, "expected successful ack") // Check expected behavior for handling SlashPackets for downtime infractions @@ -410,23 +410,24 @@ func (suite *CCVTestSuite) TestOnRecvSlashPacketErrors() { // Expect packet to be handled if the validator didn't opt in ackResult, err = providerKeeper.OnRecvSlashPacket(ctx, packet, *slashPacketData) - suite.Require().NoError(err, "no error expected") + suite.Require().NoError(err) suite.Require().Equal(ccv.SlashPacketHandledResult, ackResult, "expected successful ack") - providerKeeper.SetConsumerValidator(ctx, firstBundle.ConsumerId, providertypes.ConsensusValidator{ + err = providerKeeper.SetConsumerValidator(ctx, firstBundle.ConsumerId, providertypes.ConsensusValidator{ ProviderConsAddr: validAddress, }) + suite.Require().NoError(err) // Expect the packet to bounce if the slash meter is negative providerKeeper.SetSlashMeter(ctx, math.NewInt(-1)) ackResult, err = providerKeeper.OnRecvSlashPacket(ctx, packet, *slashPacketData) - suite.Require().NoError(err, "no error expected") + suite.Require().NoError(err) suite.Require().Equal(ccv.SlashPacketBouncedResult, ackResult, "expected successful ack") // Expect the packet to be handled if the slash meter is positive providerKeeper.SetSlashMeter(ctx, math.NewInt(0)) ackResult, err = providerKeeper.OnRecvSlashPacket(ctx, packet, *slashPacketData) - suite.Require().NoError(err, "no error expected") + suite.Require().NoError(err) suite.Require().Equal(ccv.SlashPacketHandledResult, ackResult, "expected successful ack") } diff --git a/tests/mbt/driver/setup.go b/tests/mbt/driver/setup.go index e630434ea4..03b18d61f1 100644 --- a/tests/mbt/driver/setup.go +++ b/tests/mbt/driver/setup.go @@ -380,7 +380,8 @@ func (s *Driver) ConfigureNewPath(consumerChain, providerChain *ibctesting.TestC considerAll := func(providerAddr providertypes.ProviderConsAddress) bool { return true } nextValidators := s.providerKeeper().FilterValidators(s.providerCtx(), string(consumerChainId), stakingValidators, considerAll) - s.providerKeeper().SetConsumerValSet(s.providerCtx(), string(consumerChainId), nextValidators) + err = s.providerKeeper().SetConsumerValSet(s.providerCtx(), string(consumerChainId), nextValidators) + require.NoError(s.t, err) err = s.providerKeeper().SetConsumerGenesis( providerChain.GetContext(), diff --git a/x/ccv/provider/keeper/consumer_lifecycle.go b/x/ccv/provider/keeper/consumer_lifecycle.go index da1fa29e02..5896d2a2a6 100644 --- a/x/ccv/provider/keeper/consumer_lifecycle.go +++ b/x/ccv/provider/keeper/consumer_lifecycle.go @@ -315,7 +315,10 @@ func (k Keeper) MakeConsumerGenesis( // need to use the bondedValidators, not activeValidators, here since the chain might be opt-in and allow inactive vals nextValidators := k.ComputeNextValidators(ctx, consumerId, bondedValidators, powerShapingParameters, minPower) - k.SetConsumerValSet(ctx, consumerId, nextValidators) + err = k.SetConsumerValSet(ctx, consumerId, nextValidators) + if err != nil { + return gen, nil, fmt.Errorf("unable to set consumer validator set in MakeConsumerGenesis: %s", err) + } // get the initial updates with the latest set consumer public keys initialUpdatesWithConsumerKeys := DiffValidators([]types.ConsensusValidator{}, nextValidators) diff --git a/x/ccv/provider/keeper/distribution_test.go b/x/ccv/provider/keeper/distribution_test.go index 8d981764d2..c10b309eb7 100644 --- a/x/ccv/provider/keeper/distribution_test.go +++ b/x/ccv/provider/keeper/distribution_test.go @@ -50,7 +50,7 @@ func TestComputeConsumerTotalVotingPower(t *testing.T) { // set 5 validators to the consumer chain for i := 0; i < 5; i++ { val := createVal(int64(i)) - keeper.SetConsumerValidator( + err := keeper.SetConsumerValidator( ctx, chainID, providertypes.ConsensusValidator{ @@ -58,6 +58,7 @@ func TestComputeConsumerTotalVotingPower(t *testing.T) { Power: val.VotingPower, }, ) + require.NoError(t, err) expTotalPower += val.VotingPower } diff --git a/x/ccv/provider/keeper/genesis.go b/x/ccv/provider/keeper/genesis.go index d4c2a77246..310089082e 100644 --- a/x/ccv/provider/keeper/genesis.go +++ b/x/ccv/provider/keeper/genesis.go @@ -105,7 +105,10 @@ func (k Keeper) InitGenesisValUpdates(ctx sdk.Context) []abci.ValidatorUpdate { reducedValSet[i] = consensusVal } - k.SetLastProviderConsensusValSet(ctx, reducedValSet) + err = k.SetLastProviderConsensusValSet(ctx, reducedValSet) + if err != nil { + panic(fmt.Errorf("setting the provider consensus validator set: %w", err)) + } valUpdates := make([]abci.ValidatorUpdate, len(reducedValSet)) for i, val := range reducedValSet { diff --git a/x/ccv/provider/keeper/grpc_query_test.go b/x/ccv/provider/keeper/grpc_query_test.go index c7efd50089..4a6563ba41 100644 --- a/x/ccv/provider/keeper/grpc_query_test.go +++ b/x/ccv/provider/keeper/grpc_query_test.go @@ -248,11 +248,12 @@ func TestQueryConsumerValidators(t *testing.T) { require.Empty(t, res) // set consumer valset - pk.SetConsumerValSet(ctx, consumerId, []types.ConsensusValidator{ + err = pk.SetConsumerValSet(ctx, consumerId, []types.ConsensusValidator{ consumerValidator1, consumerValidator2, consumerValidator3, }) + require.NoError(t, err) expRes.Validators = append(expRes.Validators, &types.QueryConsumerValidatorsValidator{ ProviderAddress: providerAddr3.String(), @@ -329,7 +330,7 @@ func TestQueryConsumerChainsValidatorHasToValidate(t *testing.T) { } // set `providerAddr` as a consumer validator on first consumer chain - pk.SetConsumerValidator(ctx, consumerIds[0], types.ConsensusValidator{ + err := pk.SetConsumerValidator(ctx, consumerIds[0], types.ConsensusValidator{ ProviderConsAddr: providerAddr.ToSdkConsAddr(), Power: 1, PublicKey: &crypto.PublicKey{ @@ -338,6 +339,7 @@ func TestQueryConsumerChainsValidatorHasToValidate(t *testing.T) { }, }, }) + require.NoError(t, err) // set `providerAddr` as an opted-in validator on third consumer chain pk.SetOptedIn(ctx, consumerIds[2], providerAddr) diff --git a/x/ccv/provider/keeper/key_assignment_test.go b/x/ccv/provider/keeper/key_assignment_test.go index 223cfacd42..f261154bec 100644 --- a/x/ccv/provider/keeper/key_assignment_test.go +++ b/x/ccv/provider/keeper/key_assignment_test.go @@ -798,7 +798,8 @@ func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { valSet, error := k.GetConsumerValSet(ctx, CHAINID) require.NoError(t, error) updates = providerkeeper.DiffValidators(valSet, nextValidators) - k.SetConsumerValSet(ctx, CHAINID, nextValidators) + err := k.SetConsumerValSet(ctx, CHAINID, nextValidators) + require.NoError(t, err) consumerValset.apply(updates) // Simulate the VSCID update in EndBlock diff --git a/x/ccv/provider/keeper/provider_consensus.go b/x/ccv/provider/keeper/provider_consensus.go index 9c377e6d91..c99c2deae2 100644 --- a/x/ccv/provider/keeper/provider_consensus.go +++ b/x/ccv/provider/keeper/provider_consensus.go @@ -16,14 +16,14 @@ import ( func (k Keeper) SetLastProviderConsensusValidator( ctx sdk.Context, validator types.ConsensusValidator, -) { - k.setValidator(ctx, types.LastProviderConsensusValsPrefix(), validator) +) error { + return k.setValidator(ctx, types.LastProviderConsensusValsPrefix(), validator) } // SetLastProviderConsensusValSet resets the stored last validator set sent to the consensus engine on the provider // to the provided `nextValidators`. -func (k Keeper) SetLastProviderConsensusValSet(ctx sdk.Context, nextValidators []types.ConsensusValidator) { - k.setValSet(ctx, types.LastProviderConsensusValsPrefix(), nextValidators) +func (k Keeper) SetLastProviderConsensusValSet(ctx sdk.Context, nextValidators []types.ConsensusValidator) error { + return k.setValSet(ctx, types.LastProviderConsensusValsPrefix(), nextValidators) } // DeleteLastProviderConsensusValidator removes the validator with `providerConsAddr` address diff --git a/x/ccv/provider/keeper/provider_consensus_test.go b/x/ccv/provider/keeper/provider_consensus_test.go index 76ffb1544b..17ae11a4cd 100644 --- a/x/ccv/provider/keeper/provider_consensus_test.go +++ b/x/ccv/provider/keeper/provider_consensus_test.go @@ -21,7 +21,8 @@ func TestSetLastProviderConsensusValidator(t *testing.T) { PublicKey: &crypto.PublicKey{}, } - providerKeeper.SetLastProviderConsensusValidator(ctx, validator) + err := providerKeeper.SetLastProviderConsensusValidator(ctx, validator) + require.NoError(t, err) // Retrieve the stored validator vals, err := providerKeeper.GetLastProviderConsensusValSet(ctx) @@ -49,7 +50,8 @@ func TestSetLastProviderConsensusValSet(t *testing.T) { nextValidators := []types.ConsensusValidator{validator1, validator2} - providerKeeper.SetLastProviderConsensusValSet(ctx, nextValidators) + err := providerKeeper.SetLastProviderConsensusValSet(ctx, nextValidators) + require.NoError(t, err) // Retrieve the stored validator set storedValidators, err := providerKeeper.GetLastProviderConsensusValSet(ctx) @@ -67,7 +69,8 @@ func TestDeleteLastProviderConsensusValidator(t *testing.T) { PublicKey: &crypto.PublicKey{}, } - providerKeeper.SetLastProviderConsensusValidator(ctx, validator) + err := providerKeeper.SetLastProviderConsensusValidator(ctx, validator) + require.NoError(t, err) // Delete the stored validator providerKeeper.DeleteLastProviderConsensusValidator(ctx, types.NewProviderConsAddress(validator.ProviderConsAddr)) @@ -96,7 +99,8 @@ func TestDeleteLastProviderConsensusValSet(t *testing.T) { nextValidators := []types.ConsensusValidator{validator1, validator2} - providerKeeper.SetLastProviderConsensusValSet(ctx, nextValidators) + err := providerKeeper.SetLastProviderConsensusValSet(ctx, nextValidators) + require.NoError(t, err) // check that the set is not empty storedValidators, err := providerKeeper.GetLastProviderConsensusValSet(ctx) @@ -126,7 +130,8 @@ func TestGetLastTotalProviderConsensusPower(t *testing.T) { PublicKey: &crypto.PublicKey{}, } nextValidators := []types.ConsensusValidator{validator1, validator2} - providerKeeper.SetLastProviderConsensusValSet(ctx, nextValidators) + err := providerKeeper.SetLastProviderConsensusValSet(ctx, nextValidators) + require.NoError(t, err) // Get the total power of the last stored validator set totalPower, err := providerKeeper.GetLastTotalProviderConsensusPower(ctx) require.NoError(t, err, "failed to get total power") diff --git a/x/ccv/provider/keeper/relay.go b/x/ccv/provider/keeper/relay.go index 3a392500c0..00bf502a40 100644 --- a/x/ccv/provider/keeper/relay.go +++ b/x/ccv/provider/keeper/relay.go @@ -115,7 +115,10 @@ func (k Keeper) ProviderValidatorUpdates(ctx sdk.Context) ([]abci.ValidatorUpdat } // store the validator set we will send to consensus - k.SetLastProviderConsensusValSet(ctx, nextValidators) + err = k.SetLastProviderConsensusValSet(ctx, nextValidators) + if err != nil { + return []abci.ValidatorUpdate{}, fmt.Errorf("setting the last provider consensus validator set: %w", err) + } valUpdates := DiffValidators(currentValidators, nextValidators) @@ -251,7 +254,10 @@ func (k Keeper) QueueVSCPackets(ctx sdk.Context) error { nextValidators := k.ComputeNextValidators(ctx, consumerId, bondedValidators, powerShapingParameters, minPower) valUpdates := DiffValidators(currentValidators, nextValidators) - k.SetConsumerValSet(ctx, consumerId, nextValidators) + err = k.SetConsumerValSet(ctx, consumerId, nextValidators) + if err != nil { + return fmt.Errorf("setting consumer validator set, consumerId(%s): %w", consumerId, err) + } // check whether there are changes in the validator set if len(valUpdates) != 0 { diff --git a/x/ccv/provider/keeper/relay_test.go b/x/ccv/provider/keeper/relay_test.go index adee77836c..21443e4595 100644 --- a/x/ccv/provider/keeper/relay_test.go +++ b/x/ccv/provider/keeper/relay_test.go @@ -120,14 +120,15 @@ func TestQueueVSCPacketsDoesNotResetConsumerValidatorsHeights(t *testing.T) { PublicKey: &valAPubKey, JoinHeight: 123456789, } - providerKeeper.SetConsumerValidator(ctx, "consumerId", consumerValidatorA) + err := providerKeeper.SetConsumerValidator(ctx, "consumerId", consumerValidatorA) + require.NoError(t, err) // 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, "consumerId", providertypes.NewProviderConsAddress(valBConsAddr)) // set power shaping params - err := providerKeeper.SetConsumerPowerShapingParameters(ctx, "consumerId", providertypes.PowerShapingParameters{}) + err = providerKeeper.SetConsumerPowerShapingParameters(ctx, "consumerId", providertypes.PowerShapingParameters{}) require.NoError(t, err) err = providerKeeper.QueueVSCPackets(ctx) @@ -161,9 +162,10 @@ func TestOnRecvDowntimeSlashPacket(t *testing.T) { providerKeeper.SetValsetUpdateBlockHeight(ctx, packetData.ValsetUpdateId, uint64(15)) // Set consumer validator - providerKeeper.SetConsumerValidator(ctx, "chain-1", providertypes.ConsensusValidator{ + err := providerKeeper.SetConsumerValidator(ctx, "chain-1", providertypes.ConsensusValidator{ ProviderConsAddr: packetData.Validator.Address, }) + require.NoError(t, err) // Set slash meter to negative value and assert a bounce ack is returned providerKeeper.SetSlashMeter(ctx, math.NewInt(-5)) @@ -172,9 +174,10 @@ func TestOnRecvDowntimeSlashPacket(t *testing.T) { require.NoError(t, err) // Set consumer validator - providerKeeper.SetConsumerValidator(ctx, "chain-2", providertypes.ConsensusValidator{ + err = providerKeeper.SetConsumerValidator(ctx, "chain-2", providertypes.ConsensusValidator{ ProviderConsAddr: packetData.Validator.Address, }) + require.NoError(t, err) // Also bounced for chain-2 ackResult, err = executeOnRecvSlashPacket(t, &providerKeeper, ctx, "channel-2", 2, packetData) @@ -185,7 +188,8 @@ func TestOnRecvDowntimeSlashPacket(t *testing.T) { providerKeeper.SetSlashMeter(ctx, math.NewInt(5)) // Set the consumer validator - providerKeeper.SetConsumerValidator(ctx, "chain-1", providertypes.ConsensusValidator{ProviderConsAddr: packetData.Validator.Address}) + err = providerKeeper.SetConsumerValidator(ctx, "chain-1", providertypes.ConsensusValidator{ProviderConsAddr: packetData.Validator.Address}) + require.NoError(t, err) // Mock call to GetEffectiveValPower, so that it returns 2. providerAddr := providertypes.NewProviderConsAddress(packetData.Validator.Address) @@ -463,7 +467,8 @@ func TestHandleSlashPacket(t *testing.T) { // Setup consumer address to provider address mapping. require.NotEmpty(t, tc.packetData.Validator.Address) providerKeeper.SetValidatorByConsumerAddr(ctx, chainId, consumerConsAddr, providerConsAddr) - providerKeeper.SetConsumerValidator(ctx, chainId, providertypes.ConsensusValidator{ProviderConsAddr: providerConsAddr.Address.Bytes()}) + err := providerKeeper.SetConsumerValidator(ctx, chainId, providertypes.ConsensusValidator{ProviderConsAddr: providerConsAddr.Address.Bytes()}) + require.NoError(t, err) // Execute method and assert expected mock calls. providerKeeper.HandleSlashPacket(ctx, chainId, tc.packetData) @@ -731,7 +736,8 @@ func TestProviderValidatorUpdates(t *testing.T) { // consensusVals is now [removedValidator, validator 2, validator 1] // Set the last provider consensus validator set - providerKeeper.SetLastProviderConsensusValSet(ctx, consensusVals) + err = providerKeeper.SetLastProviderConsensusValSet(ctx, consensusVals) + require.NoError(t, err) // Set the max number of validators maxProviderConsensusValidators := int64(2) diff --git a/x/ccv/provider/keeper/staking_keeper_interface.go b/x/ccv/provider/keeper/staking_keeper_interface.go index a0b6e364c7..18fd49dc2f 100644 --- a/x/ccv/provider/keeper/staking_keeper_interface.go +++ b/x/ccv/provider/keeper/staking_keeper_interface.go @@ -2,6 +2,7 @@ package keeper import ( "context" + "fmt" "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" @@ -34,11 +35,14 @@ func (k Keeper) TotalBondedTokens(ctx context.Context) (math.Int, error) { // iterate through the bonded validators totalBondedTokens := math.ZeroInt() - k.IterateBondedValidatorsByPower(ctx, func(_ int64, validator stakingtypes.ValidatorI) (stop bool) { + err := k.IterateBondedValidatorsByPower(ctx, func(_ int64, validator stakingtypes.ValidatorI) (stop bool) { tokens := validator.GetBondedTokens() totalBondedTokens = totalBondedTokens.Add(tokens) return false }) + if err != nil { + return math.Int{}, fmt.Errorf("iteration inside TotalBondedTokens failed: %w", err) + } return totalBondedTokens, nil } diff --git a/x/ccv/provider/keeper/validator_set_update.go b/x/ccv/provider/keeper/validator_set_update.go index 701fac648e..8b9c314189 100644 --- a/x/ccv/provider/keeper/validator_set_update.go +++ b/x/ccv/provider/keeper/validator_set_update.go @@ -22,14 +22,14 @@ func (k Keeper) SetConsumerValidator( ctx sdk.Context, consumerId string, validator types.ConsensusValidator, -) { - k.setValidator(ctx, k.GetConsumerChainConsensusValidatorsKey(ctx, consumerId), validator) +) error { + return 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, consumerId string, nextValidators []types.ConsensusValidator) { - k.setValSet(ctx, k.GetConsumerChainConsensusValidatorsKey(ctx, consumerId), nextValidators) +func (k Keeper) SetConsumerValSet(ctx sdk.Context, consumerId string, nextValidators []types.ConsensusValidator) error { + return k.setValSet(ctx, k.GetConsumerChainConsensusValidatorsKey(ctx, consumerId), nextValidators) } // DeleteConsumerValidator removes consumer validator with `providerAddr` address diff --git a/x/ccv/provider/keeper/validator_set_update_test.go b/x/ccv/provider/keeper/validator_set_update_test.go index 2a63453021..19a7908933 100644 --- a/x/ccv/provider/keeper/validator_set_update_test.go +++ b/x/ccv/provider/keeper/validator_set_update_test.go @@ -33,7 +33,8 @@ func TestConsumerValidator(t *testing.T) { } require.False(t, providerKeeper.IsConsumerValidator(ctx, "consumerId", types.NewProviderConsAddress(validator.ProviderConsAddr))) - providerKeeper.SetConsumerValidator(ctx, "consumerId", validator) + err := providerKeeper.SetConsumerValidator(ctx, "consumerId", validator) + require.NoError(t, err) 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))) @@ -75,12 +76,13 @@ func TestGetConsumerValSet(t *testing.T) { } for _, expectedValidator := range expectedValidators { - providerKeeper.SetConsumerValidator(ctx, "consumerId", + err := providerKeeper.SetConsumerValidator(ctx, "consumerId", types.ConsensusValidator{ ProviderConsAddr: expectedValidator.ProviderConsAddr, Power: expectedValidator.Power, PublicKey: expectedValidator.PublicKey, }) + require.NoError(t, err) } actualValidators, err := providerKeeper.GetConsumerValSet(ctx, "consumerId") @@ -312,14 +314,16 @@ func TestSetConsumerValSet(t *testing.T) { require.NoError(t, err) require.Empty(t, valSet) for _, validator := range currentValidators { - providerKeeper.SetConsumerValidator(ctx, chainID, validator) + err := providerKeeper.SetConsumerValidator(ctx, chainID, validator) + require.NoError(t, err) } valSet, err = providerKeeper.GetConsumerValSet(ctx, chainID) require.NoError(t, err) require.NotEmpty(t, valSet) - providerKeeper.SetConsumerValSet(ctx, chainID, nextValidators) + err = providerKeeper.SetConsumerValSet(ctx, chainID, nextValidators) + require.NoError(t, err) nextCurrentValidators, err := providerKeeper.GetConsumerValSet(ctx, chainID) require.NoError(t, err) diff --git a/x/ccv/provider/migrations/v8/migrations.go b/x/ccv/provider/migrations/v8/migrations.go index f819dd1d88..816c85256e 100644 --- a/x/ccv/provider/migrations/v8/migrations.go +++ b/x/ccv/provider/migrations/v8/migrations.go @@ -170,31 +170,52 @@ func MigrateLaunchedConsumerChains(ctx sdk.Context, store storetypes.KVStore, pk rekeyFromChainIdToConsumerId(store, PendingVSCsKeyPrefix, chainId, consumerId) // chainId -> ConsumerValidators - rekeyChainIdAndConsAddrKey(store, providertypes.ConsumerValidatorsKeyPrefix(), chainId, consumerId) + err := rekeyChainIdAndConsAddrKey(store, providertypes.ConsumerValidatorsKeyPrefix(), chainId, consumerId) + if err != nil { + return err + } // chainId -> ValidatorsByConsumerAddr - rekeyChainIdAndConsAddrKey(store, providertypes.ValidatorsByConsumerAddrKeyPrefix(), chainId, consumerId) + err = rekeyChainIdAndConsAddrKey(store, providertypes.ValidatorsByConsumerAddrKeyPrefix(), chainId, consumerId) + if err != nil { + return err + } // chainId -> EquivocationEvidenceMinHeight rekeyFromChainIdToConsumerId(store, EquivocationEvidenceMinHeightKeyPrefix, chainId, consumerId) // chainId -> ConsumerValidator - rekeyChainIdAndConsAddrKey(store, providertypes.ConsumerValidatorKeyPrefix(), chainId, consumerId) + err = rekeyChainIdAndConsAddrKey(store, providertypes.ConsumerValidatorKeyPrefix(), chainId, consumerId) + if err != nil { + return err + } // chainId -> OptedIn - rekeyChainIdAndConsAddrKey(store, providertypes.OptedInKeyPrefix(), chainId, consumerId) + err = rekeyChainIdAndConsAddrKey(store, providertypes.OptedInKeyPrefix(), chainId, consumerId) + if err != nil { + return err + } // chainId -> Allowlist - rekeyChainIdAndConsAddrKey(store, providertypes.AllowlistKeyPrefix(), chainId, consumerId) + err = rekeyChainIdAndConsAddrKey(store, providertypes.AllowlistKeyPrefix(), chainId, consumerId) + if err != nil { + return err + } // chainId -> Denylist - rekeyChainIdAndConsAddrKey(store, providertypes.DenylistKeyPrefix(), chainId, consumerId) + err = rekeyChainIdAndConsAddrKey(store, providertypes.DenylistKeyPrefix(), chainId, consumerId) + if err != nil { + return err + } // chainId -> ConsumerRewardsAllocations rekeyFromChainIdToConsumerId(store, ConsumerRewardsAllocationKeyPrefix, chainId, consumerId) // chainId -> ConsumerCommissionRate - rekeyChainIdAndConsAddrKey(store, providertypes.ConsumerCommissionRateKeyPrefix(), chainId, consumerId) + err = rekeyChainIdAndConsAddrKey(store, providertypes.ConsumerCommissionRateKeyPrefix(), chainId, consumerId) + if err != nil { + return err + } // chainId -> MinimumPowerInTopN oldKey := providertypes.StringIdWithLenKey(MinimumPowerInTopNKeyPrefix, chainId) @@ -206,7 +227,10 @@ func MigrateLaunchedConsumerChains(ctx sdk.Context, store storetypes.KVStore, pk } // chainId -> ConsumerAddrsToPruneV2 - rekeyChainIdAndTsKey(store, providertypes.ConsumerAddrsToPruneV2KeyPrefix(), chainId, consumerId) + err = rekeyChainIdAndTsKey(store, providertypes.ConsumerAddrsToPruneV2KeyPrefix(), chainId, consumerId) + if err != nil { + return err + } pk.SetConsumerChainId(ctx, consumerId, chainId) @@ -261,7 +285,7 @@ func MigrateLaunchedConsumerChains(ctx sdk.Context, store storetypes.KVStore, pk MinStake: 0, AllowInactiveVals: false, } - err := pk.SetConsumerPowerShapingParameters(ctx, consumerId, powerShapingParameters) + err = pk.SetConsumerPowerShapingParameters(ctx, consumerId, powerShapingParameters) if err != nil { return err } From 974a54eea4d42e103ccf5ba7ab0db5c866611d01 Mon Sep 17 00:00:00 2001 From: insumity Date: Fri, 6 Sep 2024 16:19:59 +0200 Subject: [PATCH 16/28] test: introduce checks for the migration of launched chains (#2233) init commit --- x/ccv/provider/migrations/v8/migrations.go | 24 +- .../provider/migrations/v8/migrations_test.go | 290 ++++++++++++++++++ 2 files changed, 302 insertions(+), 12 deletions(-) diff --git a/x/ccv/provider/migrations/v8/migrations.go b/x/ccv/provider/migrations/v8/migrations.go index 816c85256e..64d821cb30 100644 --- a/x/ccv/provider/migrations/v8/migrations.go +++ b/x/ccv/provider/migrations/v8/migrations.go @@ -123,6 +123,16 @@ func MigrateConsumerAddrsToPrune(ctx sdk.Context, store storetypes.KVStore, pk p return nil } +func TransformConsAddressesToBech32Addresses(addresses []providertypes.ProviderConsAddress) []string { + bech32PrefixConsAddr := sdk.GetConfig().GetBech32ConsensusAddrPrefix() + var bech32Addresses []string + for _, addr := range addresses { + bech32Addr, _ := bech32.ConvertAndEncode(bech32PrefixConsAddr, addr.ToSdkConsAddr().Bytes()) + bech32Addresses = append(bech32Addresses, bech32Addr) + } + return bech32Addresses +} + // MigrateLaunchedConsumerChains migrates all the state for consumer chains with an existing client // Note that it must be executed before CleanupState. func MigrateLaunchedConsumerChains(ctx sdk.Context, store storetypes.KVStore, pk providerkeeper.Keeper) error { @@ -262,18 +272,8 @@ func MigrateLaunchedConsumerChains(ctx sdk.Context, store storetypes.KVStore, pk validatorSetCap = binary.BigEndian.Uint32(buf) } - bech32PrefixConsAddr := sdk.GetConfig().GetBech32ConsensusAddrPrefix() - var allowlist []string - for _, addr := range pk.GetAllowList(ctx, consumerId) { - bech32Addr, _ := bech32.ConvertAndEncode(bech32PrefixConsAddr, addr.ToSdkConsAddr().Bytes()) - allowlist = append(allowlist, bech32Addr) - } - - var denylist []string - for _, addr := range pk.GetDenyList(ctx, consumerId) { - bech32Addr, _ := bech32.ConvertAndEncode(bech32PrefixConsAddr, addr.ToSdkConsAddr().Bytes()) - allowlist = append(allowlist, bech32Addr) - } + allowlist := TransformConsAddressesToBech32Addresses(pk.GetAllowList(ctx, consumerId)) + denylist := TransformConsAddressesToBech32Addresses(pk.GetDenyList(ctx, consumerId)) powerShapingParameters := providertypes.PowerShapingParameters{ Top_N: topN, diff --git a/x/ccv/provider/migrations/v8/migrations_test.go b/x/ccv/provider/migrations/v8/migrations_test.go index c687564364..f6930b1f5a 100644 --- a/x/ccv/provider/migrations/v8/migrations_test.go +++ b/x/ccv/provider/migrations/v8/migrations_test.go @@ -1,6 +1,12 @@ package v8 import ( + "cosmossdk.io/math" + "encoding/binary" + "fmt" + "github.com/cometbft/cometbft/proto/tendermint/crypto" + providerkeeper "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" + "github.com/cosmos/interchain-security/v6/x/ccv/types" "testing" "time" @@ -136,5 +142,289 @@ func TestMigrateConsumerAddrsToPrune(t *testing.T) { require.Len(t, consumerAddrs[0].ConsumerAddrs.Addresses, 1) consumerAddr = providertypes.NewConsumerConsAddress(consumerAddrs[0].ConsumerAddrs.Addresses[0]) require.Equal(t, consumerAddrsToPrune[2].address, consumerAddr) +} + +// ChainData corresponds to some general data that a consumer chain states in store +type ChainData struct { + ChainId string + ClientId string + ChannelId string + ConsumerGenesis types.ConsumerGenesisState + SlashAcks []string + InitChainHeight uint64 + PendingVSCPackets []types.ValidatorSetChangePacketData + // A chain could contain multiple validators and hence provider addresses and multiple + // consumer keys and consumer addresses. For simplicity of testing here, we only consider a single + // provider and consumer address and a single consumer key. + ProviderAddr providertypes.ProviderConsAddress + ConsumerKey crypto.PublicKey + ConsumerAddr providertypes.ConsumerConsAddress + EquivocationMinHeight uint64 + ConsensusValidator providertypes.ConsensusValidator + ConsumerRewardsAllocation providertypes.ConsumerRewardsAllocation + ConsumerCommissionRate math.LegacyDec + MinimumPowerInTopN int64 + PruneTs time.Time + TopN uint32 + ValidatorsPowerCap uint32 + ValidatorSetCap uint32 +} + +func StoreChainDataUsingChainIdAsKey(ctx sdk.Context, store storetypes.KVStore, providerKeeper providerkeeper.Keeper, data ChainData) { + providerKeeper.SetConsumerClientId(ctx, data.ChainId, data.ClientId) + + providerKeeper.SetConsumerIdToChannelId(ctx, data.ChainId, data.ChannelId) + providerKeeper.SetChannelToConsumerId(ctx, data.ChannelId, data.ChainId) + + providerKeeper.SetConsumerGenesis(ctx, data.ChainId, data.ConsumerGenesis) + + providerKeeper.SetSlashAcks(ctx, data.ChainId, data.SlashAcks) + + providerKeeper.SetInitChainHeight(ctx, data.ChainId, data.InitChainHeight) + + for _, packet := range data.PendingVSCPackets { + providerKeeper.AppendPendingVSCPackets(ctx, data.ChainId, packet) + } + + providerKeeper.SetValidatorConsumerPubKey(ctx, data.ChainId, data.ProviderAddr, data.ConsumerKey) + + providerKeeper.SetValidatorByConsumerAddr(ctx, data.ChainId, data.ConsumerAddr, data.ProviderAddr) + + providerKeeper.SetEquivocationEvidenceMinHeight(ctx, data.ChainId, data.EquivocationMinHeight) + + providerKeeper.SetConsumerValidator(ctx, data.ChainId, data.ConsensusValidator) + + providerKeeper.SetOptedIn(ctx, data.ChainId, data.ProviderAddr) + + providerKeeper.SetAllowlist(ctx, data.ChainId, data.ProviderAddr) + + providerKeeper.SetDenylist(ctx, data.ChainId, data.ProviderAddr) + + providerKeeper.SetConsumerRewardsAllocation(ctx, data.ChainId, data.ConsumerRewardsAllocation) + + providerKeeper.SetConsumerCommissionRate(ctx, data.ChainId, data.ProviderAddr, data.ConsumerCommissionRate) + + providerKeeper.SetMinimumPowerInTopN(ctx, data.ChainId, data.MinimumPowerInTopN) + + providerKeeper.AppendConsumerAddrsToPrune(ctx, data.ChainId, data.PruneTs, data.ConsumerAddr) + + // set Top N + topNKey := providertypes.StringIdWithLenKey(LegacyTopNKeyPrefix, data.ChainId) + buf := make([]byte, 4) + binary.BigEndian.PutUint32(buf, data.TopN) + store.Set(topNKey, buf) + + // set validators power cap + validatorsPowerCapKey := providertypes.StringIdWithLenKey(LegacyValidatorsPowerCapKeyPrefix, data.ChainId) + buf = make([]byte, 4) + binary.BigEndian.PutUint32(buf, data.ValidatorsPowerCap) + store.Set(validatorsPowerCapKey, buf) + + // set validator set cap + validatorSetCapKey := providertypes.StringIdWithLenKey(LegacyValidatorSetCapKeyPrefix, data.ChainId) + buf = make([]byte, 4) + binary.BigEndian.PutUint32(buf, data.ValidatorSetCap) + store.Set(validatorSetCapKey, buf) +} + +// GetChainDataUsingStringId retrieves the store data under key `id` that can be either a `chainId` or a `consumerId`. +// If `stopEarly` is set, the code will return an error if it finds an inconsistency in the retrieved chain data. +func GetChainDataUsingStringId(ctx sdk.Context, providerKeeper providerkeeper.Keeper, id string, + providerAddr providertypes.ProviderConsAddress, consumerAddr providertypes.ConsumerConsAddress, stopEarly bool) (ChainData, error) { + data := ChainData{} + data.ChainId, _ = providerKeeper.GetConsumerChainId(ctx, id) + data.ClientId, _ = providerKeeper.GetConsumerClientId(ctx, id) + + data.ChannelId, _ = providerKeeper.GetConsumerIdToChannelId(ctx, id) + retrievedConsumerId, _ := providerKeeper.GetChannelIdToConsumerId(ctx, data.ChannelId) + if stopEarly && id != retrievedConsumerId { + return ChainData{}, + fmt.Errorf("retrieved consumer id (%s) should be (%s)", retrievedConsumerId, id) + } + + data.ConsumerGenesis, _ = providerKeeper.GetConsumerGenesis(ctx, id) + + data.SlashAcks = providerKeeper.GetSlashAcks(ctx, id) + + data.InitChainHeight, _ = providerKeeper.GetInitChainHeight(ctx, id) + + pendingVSCPackets := providerKeeper.GetPendingVSCPackets(ctx, id) + if len(pendingVSCPackets) > 0 { + data.PendingVSCPackets = pendingVSCPackets + } + + data.ConsumerKey, _ = providerKeeper.GetValidatorConsumerPubKey(ctx, id, providerAddr) + + data.ProviderAddr, _ = providerKeeper.GetValidatorByConsumerAddr(ctx, id, consumerAddr) + if stopEarly && data.ProviderAddr.String() != providerAddr.String() { + return ChainData{}, fmt.Errorf("retrieved providerAddr (%s) should be (%s)", data.ProviderAddr.String(), providerAddr.String()) + } + + data.EquivocationMinHeight = providerKeeper.GetEquivocationEvidenceMinHeight(ctx, id) + + data.ConsensusValidator, _ = providerKeeper.GetConsumerValidator(ctx, id, providerAddr) + + optedInValidators := providerKeeper.GetAllOptedIn(ctx, id) + if len(optedInValidators) > 0 { + tempProviderAddr := optedInValidators[0] + if stopEarly && tempProviderAddr.String() != providerAddr.String() { + return ChainData{}, fmt.Errorf("retrieved providerAddr (%s) should be (%s)", tempProviderAddr.String(), providerAddr.String()) + } + } + + allowlist := providerKeeper.GetAllowList(ctx, id) + if len(allowlist) > 0 { + tempProviderAddr := allowlist[0] + if stopEarly && tempProviderAddr.String() != providerAddr.String() { + return ChainData{}, fmt.Errorf("retrieved providerAddr (%s) should be (%s)", tempProviderAddr.String(), providerAddr.String()) + } + } + + denylist := providerKeeper.GetDenyList(ctx, id) + if len(denylist) > 0 { + tempProviderAddr := denylist[0] + if stopEarly && tempProviderAddr.String() != providerAddr.String() { + return ChainData{}, fmt.Errorf("retrieved providerAddr (%s) should be (%s)", tempProviderAddr.String(), providerAddr.String()) + } + } + + data.ConsumerRewardsAllocation = providerKeeper.GetConsumerRewardsAllocation(ctx, id) + + consumerCommissionRate, found := providerKeeper.GetConsumerCommissionRate(ctx, id, providerAddr) + if found { + data.ConsumerCommissionRate = consumerCommissionRate + } + + data.MinimumPowerInTopN, _ = providerKeeper.GetMinimumPowerInTopN(ctx, id) + + consumerAddressesToPruneV2 := providerKeeper.GetAllConsumerAddrsToPrune(ctx, id) + if len(consumerAddressesToPruneV2) > 0 { + consumerAddrToPruneV2 := consumerAddressesToPruneV2[0] + consumerAddrToPrune := consumerAddrToPruneV2.ConsumerAddrs.Addresses[0] + data.ConsumerAddr = providertypes.NewConsumerConsAddress(consumerAddrToPrune) + if stopEarly && data.ConsumerAddr.String() != consumerAddr.String() { + return ChainData{}, fmt.Errorf("retrieved consumerAddr (%s) should be (%s)", data.ConsumerAddr.String(), consumerAddr.String()) + } + data.PruneTs = consumerAddrToPruneV2.PruneTs + } + + powerShapingParameters, _ := providerKeeper.GetConsumerPowerShapingParameters(ctx, id) + data.TopN = powerShapingParameters.Top_N + data.ValidatorsPowerCap = powerShapingParameters.ValidatorsPowerCap + data.ValidatorSetCap = powerShapingParameters.ValidatorSetCap + + return data, nil +} + +func CreateTestChainData(chainId string, clientId string, channelId string) ChainData { + return ChainData{ + ChainId: chainId, + ClientId: clientId, + ChannelId: channelId, + ConsumerGenesis: types.ConsumerGenesisState{ + Params: types.ConsumerParams{ConsumerRedistributionFraction: "redistribution fraction"}, + NewChain: true, + }, + SlashAcks: []string{"slashAck1", "slashAck2"}, + InitChainHeight: uint64(123), + PendingVSCPackets: []types.ValidatorSetChangePacketData{{ValsetUpdateId: uint64(456)}}, + ProviderAddr: providertypes.NewProviderConsAddress([]byte("provider cons address")), + ConsumerKey: crypto.PublicKey{Sum: &crypto.PublicKey_Ed25519{Ed25519: []byte{4}}}, + ConsumerAddr: providertypes.NewConsumerConsAddress([]byte("consumer cons address")), + EquivocationMinHeight: uint64(789), + ConsensusValidator: providertypes.ConsensusValidator{}, + ConsumerRewardsAllocation: providertypes.ConsumerRewardsAllocation{Rewards: sdk.NewDecCoins(sdk.NewDecCoin("uatom", math.NewInt(1000)))}, + ConsumerCommissionRate: math.LegacyNewDec(1), + MinimumPowerInTopN: int64(123456789), + PruneTs: time.Now().UTC(), + TopN: uint32(67), + ValidatorsPowerCap: uint32(30), + ValidatorSetCap: uint32(100), + } +} + +func TestMigrateLaunchedConsumerChains(t *testing.T) { + t.Helper() + inMemParams := testutil.NewInMemKeeperParams(t) + providerKeeper, ctx, ctrl, _ := testutil.GetProviderKeeperAndCtx(t, inMemParams) + defer ctrl.Finish() + + store := ctx.KVStore(inMemParams.StoreKey) + + // create two sample chains with chain data + chainId1 := "chainId1" + chainData1 := CreateTestChainData(chainId1, "clientId1", "channelId1") + StoreChainDataUsingChainIdAsKey(ctx, store, providerKeeper, chainData1) + + chainId2 := "chainId2" + chainData2 := CreateTestChainData(chainId2, "clientId2", "channelId2") + StoreChainDataUsingChainIdAsKey(ctx, store, providerKeeper, chainData2) + + // migrate the launched chains + err := MigrateLaunchedConsumerChains(ctx, store, providerKeeper) + require.NoError(t, err) + + // assert that the launched chains do not reside under a `chainId`-key anymore + providerAddr := chainData1.ProviderAddr + consumerAddr := chainData2.ConsumerAddr + oldChainData1, err := GetChainDataUsingStringId(ctx, providerKeeper, chainId1, providerAddr, consumerAddr, false) + require.Equal(t, oldChainData1, ChainData{}) + + oldChainData2, err := GetChainDataUsingStringId(ctx, providerKeeper, chainId2, providerAddr, consumerAddr, false) + require.Equal(t, oldChainData2, ChainData{}) + + // assert that the launched chains have been transferred to reside under a `consumerId`-key + actualChainData1, err := GetChainDataUsingStringId(ctx, providerKeeper, "0", providerAddr, consumerAddr, true) + require.NoError(t, err) + require.Equal(t, chainData1, actualChainData1) + + actualChainData2, err := GetChainDataUsingStringId(ctx, providerKeeper, "1", providerAddr, consumerAddr, true) + require.NoError(t, err) + require.Equal(t, chainData2, actualChainData2) +} + +func TestTransformConsAddressesToBech32Addresses(t *testing.T) { + expectedBech32Addresses := []string{ + "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk", + "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6", + "cosmosvalcons1muys5jyqk4xd27e208nym85kn0t4zjcfeu63fe", + } + addresses := []providertypes.ProviderConsAddress{} + for _, addr := range expectedBech32Addresses { + ca, _ := sdk.ConsAddressFromBech32(addr) + addresses = append(addresses, providertypes.NewProviderConsAddress(ca)) + } + + actualBech32Addresses := TransformConsAddressesToBech32Addresses(addresses) + require.Equal(t, expectedBech32Addresses, actualBech32Addresses) +} + +// TestCleanupState asserts that a subset of the cleaning up indeed takes place +func TestCleanupState(t *testing.T) { + t.Helper() + inMemParams := testutil.NewInMemKeeperParams(t) + providerKeeper, ctx, ctrl, _ := testutil.GetProviderKeeperAndCtx(t, inMemParams) + defer ctrl.Finish() + + store := ctx.KVStore(inMemParams.StoreKey) + + containsData := func(prefix byte) bool { + iterator := storetypes.KVStorePrefixIterator(store, []byte{prefix}) + defer iterator.Close() + + return iterator.Valid() + } + + // create two sample chains with chain data + chainId1 := "chainId1" + chainData1 := CreateTestChainData(chainId1, "clientId1", "channelId1") + StoreChainDataUsingChainIdAsKey(ctx, store, providerKeeper, chainData1) + require.True(t, containsData(LegacyTopNKeyPrefix)) + require.True(t, containsData(LegacyValidatorsPowerCapKeyPrefix)) + require.True(t, containsData(LegacyValidatorSetCapKeyPrefix)) + CleanupState(store) + require.False(t, containsData(LegacyTopNKeyPrefix)) + require.False(t, containsData(LegacyValidatorsPowerCapKeyPrefix)) + require.False(t, containsData(LegacyValidatorSetCapKeyPrefix)) } From f93a9a55cde772a5f05b72e0912410c7c4c690dd Mon Sep 17 00:00:00 2001 From: Marius Poke Date: Fri, 6 Sep 2024 16:26:05 +0200 Subject: [PATCH 17/28] chore: fix linter (#2232) * bump linter version * make format * fix linter * fix linter --- Makefile | 2 +- app/consumer-democracy/abci.go | 4 +- app/consumer-democracy/app.go | 21 ++- app/consumer/abci.go | 4 +- .../ante/disabled_modules_ante_test.go | 1 + app/consumer/app.go | 23 ++-- app/consumer/genesis.go | 1 + app/encoding/encoding.go | 4 +- app/provider/abci.go | 4 +- app/provider/app.go | 5 - app/provider/export.go | 1 + app/provider/sim_test.go | 9 +- app/sovereign/abci.go | 4 +- app/sovereign/app.go | 21 ++- app/sovereign/export.go | 2 +- cmd/interchain-security-cd/cmd/root.go | 5 +- cmd/interchain-security-cdd/cmd/root.go | 5 +- cmd/interchain-security-pd/cmd/root.go | 5 +- cmd/interchain-security-sd/cmd/root.go | 5 +- cmd/interchain-security-sd/main.go | 1 - tests/e2e/actions.go | 13 +- tests/e2e/actions_sovereign_chain.go | 1 - tests/e2e/config.go | 3 +- tests/e2e/json_marshal_test.go | 6 +- tests/e2e/state.go | 11 +- tests/e2e/state_rapid_test.go | 1 - tests/e2e/steps.go | 3 +- tests/e2e/steps_active_set_changes.go | 3 +- tests/e2e/steps_compatibility.go | 6 +- tests/e2e/steps_consumer_misbehaviour.go | 3 +- tests/e2e/steps_inactive_vals.go | 3 +- tests/e2e/steps_partial_set_security.go | 3 +- tests/e2e/steps_sovereign_changeover.go | 3 +- tests/e2e/steps_start_chains.go | 3 +- tests/e2e/steps_stop_chain.go | 3 +- tests/e2e/test_driver.go | 3 +- tests/e2e/testlib/utils.go | 1 - tests/e2e/trace_handlers_test.go | 12 +- tests/e2e/v4/state.go | 42 ++---- tests/integration/common.go | 39 +----- tests/integration/democracy.go | 2 - tests/integration/distribution.go | 9 +- tests/integration/double_vote.go | 5 +- tests/integration/expired_client.go | 3 +- tests/integration/key_assignment.go | 3 +- tests/integration/misbehaviour.go | 3 +- .../integration/partial_set_security_test.go | 9 +- tests/integration/setup.go | 1 + tests/integration/slashing.go | 8 +- tests/integration/stop_consumer.go | 5 +- tests/integration/throttle.go | 3 +- tests/integration/throttle_retry.go | 2 + tests/integration/valset_update.go | 3 +- tests/mbt/driver/common.go | 1 + tests/mbt/driver/core.go | 16 +-- tests/mbt/driver/mbt_test.go | 5 +- tests/mbt/driver/setup.go | 7 +- testutil/crypto/crypto.go | 2 +- testutil/ibc_testing/generic_setup.go | 3 +- testutil/ibc_testing/specific_setup.go | 3 +- testutil/integration/interfaces.go | 8 +- testutil/keeper/expectations.go | 2 +- testutil/keeper/unit_test_helpers.go | 9 +- x/ccv/consumer/ibc_module.go | 2 +- x/ccv/consumer/ibc_module_test.go | 4 +- x/ccv/consumer/keeper/distribution.go | 2 +- x/ccv/consumer/keeper/distribution_test.go | 3 +- x/ccv/consumer/keeper/keeper.go | 10 +- x/ccv/consumer/keeper/relay_test.go | 2 +- x/ccv/consumer/keeper/validators_test.go | 2 +- x/ccv/consumer/migrations/v2/migration.go | 1 + .../consumer/migrations/v2/migration_test.go | 2 + x/ccv/consumer/migrations/v3/migration.go | 4 +- .../consumer/migrations/v3/migration_test.go | 5 +- x/ccv/consumer/module.go | 3 +- x/ccv/consumer/types/codec.go | 3 +- x/ccv/democracy/distribution/module.go | 1 + x/ccv/democracy/governance/module.go | 1 + x/ccv/no_valupdates_genutil/module.go | 1 + x/ccv/no_valupdates_staking/module.go | 1 + x/ccv/provider/client/cli/tx.go | 4 +- x/ccv/provider/ibc_middleware.go | 2 +- x/ccv/provider/ibc_module.go | 2 +- x/ccv/provider/ibc_module_test.go | 2 +- .../provider/keeper/consumer_equivocation.go | 4 +- .../keeper/consumer_equivocation_test.go | 14 +- x/ccv/provider/keeper/consumer_lifecycle.go | 14 +- .../keeper/consumer_lifecycle_test.go | 30 ++--- x/ccv/provider/keeper/distribution.go | 3 +- x/ccv/provider/keeper/distribution_test.go | 3 +- x/ccv/provider/keeper/genesis_test.go | 5 +- x/ccv/provider/keeper/grpc_query.go | 1 + x/ccv/provider/keeper/grpc_query_test.go | 2 +- x/ccv/provider/keeper/hooks.go | 1 + x/ccv/provider/keeper/hooks_test.go | 4 +- x/ccv/provider/keeper/invariants.go | 1 + x/ccv/provider/keeper/keeper.go | 17 ++- x/ccv/provider/keeper/keeper_test.go | 60 +++++---- x/ccv/provider/keeper/key_assignment.go | 2 +- x/ccv/provider/keeper/key_assignment_test.go | 37 +++--- x/ccv/provider/keeper/msg_server.go | 7 +- x/ccv/provider/keeper/msg_server_test.go | 37 ++++-- x/ccv/provider/keeper/params_test.go | 3 +- x/ccv/provider/keeper/partial_set_security.go | 8 +- .../keeper/partial_set_security_test.go | 121 +++++++++--------- x/ccv/provider/keeper/permissionless.go | 7 +- x/ccv/provider/keeper/permissionless_test.go | 59 ++++----- x/ccv/provider/keeper/power_shaping.go | 4 +- x/ccv/provider/keeper/power_shaping_test.go | 84 ++++++------ x/ccv/provider/keeper/provider_consensus.go | 2 +- .../keeper/provider_consensus_test.go | 4 +- x/ccv/provider/keeper/relay.go | 2 +- x/ccv/provider/keeper/relay_test.go | 79 ++++++------ .../keeper/staking_keeper_interface.go | 1 + .../keeper/staking_keeper_interface_test.go | 7 +- .../provider/keeper/validator_set_storage.go | 1 + x/ccv/provider/keeper/validator_set_update.go | 2 +- .../keeper/validator_set_update_test.go | 68 +++++----- x/ccv/provider/migrations/migrator.go | 1 + x/ccv/provider/migrations/v7/legacy_params.go | 5 +- x/ccv/provider/migrations/v7/migrations.go | 1 + .../provider/migrations/v7/migrations_test.go | 3 +- x/ccv/provider/migrations/v8/migrations.go | 4 +- .../provider/migrations/v8/migrations_test.go | 13 +- x/ccv/provider/module.go | 1 + x/ccv/provider/module_test.go | 6 +- x/ccv/provider/proposal_handler_test.go | 12 +- x/ccv/provider/simulation/genesis.go | 1 + x/ccv/provider/types/codec.go | 3 - x/ccv/provider/types/genesis_test.go | 3 +- x/ccv/provider/types/keys_test.go | 6 +- x/ccv/provider/types/legacy_proposal.go | 1 + x/ccv/provider/types/msg.go | 17 +-- x/ccv/provider/types/msg_test.go | 7 +- x/ccv/provider/types/params.go | 3 +- x/ccv/provider/types/params_test.go | 3 +- x/ccv/types/expected_keepers.go | 2 +- x/ccv/types/params.go | 1 + x/ccv/types/shared_params.go | 3 +- x/ccv/types/utils.go | 7 +- 140 files changed, 639 insertions(+), 616 deletions(-) diff --git a/Makefile b/Makefile index ec2493c9b4..d387e98696 100644 --- a/Makefile +++ b/Makefile @@ -163,7 +163,7 @@ sim-full-no-inactive-vals: ### Linting ### ############################################################################### golangci_lint_cmd=golangci-lint -golangci_version=v1.54.1 +golangci_version=v1.60.1 lint: @echo "--> Running linter" diff --git a/app/consumer-democracy/abci.go b/app/consumer-democracy/abci.go index 94b34cc3bb..f0020562aa 100644 --- a/app/consumer-democracy/abci.go +++ b/app/consumer-democracy/abci.go @@ -6,10 +6,10 @@ import ( "encoding/json" "fmt" - abci "github.com/cometbft/cometbft/abci/types" - "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" + + abci "github.com/cometbft/cometbft/abci/types" ) type ( diff --git a/app/consumer-democracy/app.go b/app/consumer-democracy/app.go index dbe2f8cb9e..cef5aa8f9c 100644 --- a/app/consumer-democracy/app.go +++ b/app/consumer-democracy/app.go @@ -8,7 +8,11 @@ import ( "os" "path/filepath" + dbm "github.com/cosmos/cosmos-db" "github.com/cosmos/gogoproto/proto" + "github.com/cosmos/ibc-go/modules/capability" + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" "github.com/cosmos/ibc-go/v8/modules/apps/transfer" ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" @@ -26,7 +30,7 @@ import ( reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" "cosmossdk.io/client/v2/autocli" "cosmossdk.io/core/appmodule" - + "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" "cosmossdk.io/x/evidence" evidencekeeper "cosmossdk.io/x/evidence/keeper" @@ -34,6 +38,11 @@ import ( "cosmossdk.io/x/feegrant" feegrantkeeper "cosmossdk.io/x/feegrant/keeper" feegrantmodule "cosmossdk.io/x/feegrant/module" + // add mint + "cosmossdk.io/x/upgrade" + upgradekeeper "cosmossdk.io/x/upgrade/keeper" + upgradetypes "cosmossdk.io/x/upgrade/types" + "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" @@ -81,14 +90,6 @@ import ( govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - "github.com/cosmos/ibc-go/modules/capability" - capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - - // add mint - "cosmossdk.io/x/upgrade" - upgradekeeper "cosmossdk.io/x/upgrade/keeper" - upgradetypes "cosmossdk.io/x/upgrade/types" mint "github.com/cosmos/cosmos-sdk/x/mint" mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" @@ -103,11 +104,9 @@ import ( stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "cosmossdk.io/log" abci "github.com/cometbft/cometbft/abci/types" tmjson "github.com/cometbft/cometbft/libs/json" tmos "github.com/cometbft/cometbft/libs/os" - dbm "github.com/cosmos/cosmos-db" appencoding "github.com/cosmos/interchain-security/v6/app/encoding" testutil "github.com/cosmos/interchain-security/v6/testutil/integration" diff --git a/app/consumer/abci.go b/app/consumer/abci.go index 94b34cc3bb..f0020562aa 100644 --- a/app/consumer/abci.go +++ b/app/consumer/abci.go @@ -6,10 +6,10 @@ import ( "encoding/json" "fmt" - abci "github.com/cometbft/cometbft/abci/types" - "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" + + abci "github.com/cometbft/cometbft/abci/types" ) type ( diff --git a/app/consumer/ante/disabled_modules_ante_test.go b/app/consumer/ante/disabled_modules_ante_test.go index f68ae5a4b8..5fbe82d94f 100644 --- a/app/consumer/ante/disabled_modules_ante_test.go +++ b/app/consumer/ante/disabled_modules_ante_test.go @@ -7,6 +7,7 @@ import ( "github.com/stretchr/testify/require" evidencetypes "cosmossdk.io/x/evidence/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/authz" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" diff --git a/app/consumer/app.go b/app/consumer/app.go index 5c940f5a9d..c3e7818157 100644 --- a/app/consumer/app.go +++ b/app/consumer/app.go @@ -8,12 +8,10 @@ import ( "os" "path/filepath" - autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" - reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" - "cosmossdk.io/client/v2/autocli" - "cosmossdk.io/core/appmodule" - "github.com/cosmos/cosmos-sdk/testutil/testdata/testpb" - + dbm "github.com/cosmos/cosmos-db" + "github.com/cosmos/ibc-go/modules/capability" + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" "github.com/cosmos/ibc-go/v8/modules/apps/transfer" ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" @@ -27,6 +25,11 @@ import ( ibctestingtypes "github.com/cosmos/ibc-go/v8/testing/types" "github.com/spf13/cast" + autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" + reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" + "cosmossdk.io/client/v2/autocli" + "cosmossdk.io/core/appmodule" + "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" "cosmossdk.io/x/evidence" evidencekeeper "cosmossdk.io/x/evidence/keeper" @@ -37,12 +40,12 @@ import ( "cosmossdk.io/x/upgrade" upgradekeeper "cosmossdk.io/x/upgrade/keeper" upgradetypes "cosmossdk.io/x/upgrade/types" + "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/grpc/cmtservice" nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node" - "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/runtime" @@ -52,6 +55,7 @@ import ( "github.com/cosmos/cosmos-sdk/server/config" servertypes "github.com/cosmos/cosmos-sdk/server/types" "github.com/cosmos/cosmos-sdk/std" + "github.com/cosmos/cosmos-sdk/testutil/testdata/testpb" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/version" @@ -83,15 +87,10 @@ import ( "github.com/cosmos/cosmos-sdk/x/slashing" slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" - "github.com/cosmos/ibc-go/modules/capability" - capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - "cosmossdk.io/log" abci "github.com/cometbft/cometbft/abci/types" tmjson "github.com/cometbft/cometbft/libs/json" tmos "github.com/cometbft/cometbft/libs/os" - dbm "github.com/cosmos/cosmos-db" appencoding "github.com/cosmos/interchain-security/v6/app/encoding" testutil "github.com/cosmos/interchain-security/v6/testutil/integration" diff --git a/app/consumer/genesis.go b/app/consumer/genesis.go index 501c31d3e2..be56824856 100644 --- a/app/consumer/genesis.go +++ b/app/consumer/genesis.go @@ -15,6 +15,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" + consumerTypes "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" "github.com/cosmos/interchain-security/v6/x/ccv/types" ) diff --git a/app/encoding/encoding.go b/app/encoding/encoding.go index 216adac79c..2f3b0ace5d 100644 --- a/app/encoding/encoding.go +++ b/app/encoding/encoding.go @@ -1,14 +1,16 @@ package encoding import ( + "github.com/cosmos/gogoproto/proto" + "cosmossdk.io/x/tx/signing" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/address" "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/tx" - "github.com/cosmos/gogoproto/proto" ) // EncodingConfig specifies the concrete encoding types to use for a given app. diff --git a/app/provider/abci.go b/app/provider/abci.go index 94b34cc3bb..f0020562aa 100644 --- a/app/provider/abci.go +++ b/app/provider/abci.go @@ -6,10 +6,10 @@ import ( "encoding/json" "fmt" - abci "github.com/cometbft/cometbft/abci/types" - "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" + + abci "github.com/cometbft/cometbft/abci/types" ) type ( diff --git a/app/provider/app.go b/app/provider/app.go index cdeb56003f..49308ab013 100644 --- a/app/provider/app.go +++ b/app/provider/app.go @@ -1078,8 +1078,3 @@ func MakeTestEncodingConfig() appencoding.EncodingConfig { ModuleBasics.RegisterInterfaces(encodingConfig.InterfaceRegistry) return encodingConfig } - -func makeEncodingConfig() appencoding.EncodingConfig { - encodingConfig := appencoding.MakeTestEncodingConfig() - return encodingConfig -} diff --git a/app/provider/export.go b/app/provider/export.go index 9fec37e3f2..bc2a7aba42 100644 --- a/app/provider/export.go +++ b/app/provider/export.go @@ -5,6 +5,7 @@ import ( "log" storetypes "cosmossdk.io/store/types" + servertypes "github.com/cosmos/cosmos-sdk/server/types" sdk "github.com/cosmos/cosmos-sdk/types" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" diff --git a/app/provider/sim_test.go b/app/provider/sim_test.go index cb82640a7b..5e8a3b0d5b 100644 --- a/app/provider/sim_test.go +++ b/app/provider/sim_test.go @@ -6,21 +6,20 @@ import ( "os" "testing" - "cosmossdk.io/store" + spew "github.com/davecgh/go-spew/spew" "github.com/stretchr/testify/require" + "cosmossdk.io/store" + "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/server" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/simulation" simcli "github.com/cosmos/cosmos-sdk/x/simulation/client/cli" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - providerapp "github.com/cosmos/interchain-security/v6/app/provider" - - spew "github.com/davecgh/go-spew/spew" ) func init() { diff --git a/app/sovereign/abci.go b/app/sovereign/abci.go index 94b34cc3bb..f0020562aa 100644 --- a/app/sovereign/abci.go +++ b/app/sovereign/abci.go @@ -6,10 +6,10 @@ import ( "encoding/json" "fmt" - abci "github.com/cometbft/cometbft/abci/types" - "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" + + abci "github.com/cometbft/cometbft/abci/types" ) type ( diff --git a/app/sovereign/app.go b/app/sovereign/app.go index 5e86e04ec4..ef8d50f8ea 100644 --- a/app/sovereign/app.go +++ b/app/sovereign/app.go @@ -8,6 +8,10 @@ import ( "os" "path/filepath" + dbm "github.com/cosmos/cosmos-db" + "github.com/cosmos/ibc-go/modules/capability" + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" "github.com/cosmos/ibc-go/v8/modules/apps/transfer" ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" @@ -25,7 +29,7 @@ import ( reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" "cosmossdk.io/client/v2/autocli" "cosmossdk.io/core/appmodule" - + "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" "cosmossdk.io/x/evidence" evidencekeeper "cosmossdk.io/x/evidence/keeper" @@ -33,6 +37,11 @@ import ( "cosmossdk.io/x/feegrant" feegrantkeeper "cosmossdk.io/x/feegrant/keeper" feegrantmodule "cosmossdk.io/x/feegrant/module" + // add mint + "cosmossdk.io/x/upgrade" + upgradekeeper "cosmossdk.io/x/upgrade/keeper" + upgradetypes "cosmossdk.io/x/upgrade/types" + "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" @@ -80,14 +89,6 @@ import ( govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - "github.com/cosmos/ibc-go/modules/capability" - capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - - // add mint - "cosmossdk.io/x/upgrade" - upgradekeeper "cosmossdk.io/x/upgrade/keeper" - upgradetypes "cosmossdk.io/x/upgrade/types" mint "github.com/cosmos/cosmos-sdk/x/mint" mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" @@ -103,11 +104,9 @@ import ( stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "cosmossdk.io/log" abci "github.com/cometbft/cometbft/abci/types" tmjson "github.com/cometbft/cometbft/libs/json" tmos "github.com/cometbft/cometbft/libs/os" - dbm "github.com/cosmos/cosmos-db" appencoding "github.com/cosmos/interchain-security/v6/app/encoding" testutil "github.com/cosmos/interchain-security/v6/testutil/integration" diff --git a/app/sovereign/export.go b/app/sovereign/export.go index 6c7750d4c2..8419e70c9e 100644 --- a/app/sovereign/export.go +++ b/app/sovereign/export.go @@ -6,9 +6,9 @@ import ( "log" storetypes "cosmossdk.io/store/types" + servertypes "github.com/cosmos/cosmos-sdk/server/types" sdk "github.com/cosmos/cosmos-sdk/types" - slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" "github.com/cosmos/cosmos-sdk/x/staking" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" diff --git a/cmd/interchain-security-cd/cmd/root.go b/cmd/interchain-security-cd/cmd/root.go index 6462b31a7f..42cd15c482 100644 --- a/cmd/interchain-security-cd/cmd/root.go +++ b/cmd/interchain-security-cd/cmd/root.go @@ -5,11 +5,14 @@ import ( "io" "os" + dbm "github.com/cosmos/cosmos-db" "github.com/spf13/cobra" "github.com/spf13/viper" "cosmossdk.io/client/v2/autocli" + "cosmossdk.io/log" confixcmd "cosmossdk.io/tools/confix/cmd" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/config" "github.com/cosmos/cosmos-sdk/client/debug" @@ -28,9 +31,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/crisis" genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" - "cosmossdk.io/log" tmcfg "github.com/cometbft/cometbft/config" - dbm "github.com/cosmos/cosmos-db" consumer "github.com/cosmos/interchain-security/v6/app/consumer" appencoding "github.com/cosmos/interchain-security/v6/app/encoding" diff --git a/cmd/interchain-security-cdd/cmd/root.go b/cmd/interchain-security-cdd/cmd/root.go index a162943da1..2a0115246a 100644 --- a/cmd/interchain-security-cdd/cmd/root.go +++ b/cmd/interchain-security-cdd/cmd/root.go @@ -5,11 +5,14 @@ import ( "io" "os" + dbm "github.com/cosmos/cosmos-db" "github.com/spf13/cobra" "github.com/spf13/viper" "cosmossdk.io/client/v2/autocli" + "cosmossdk.io/log" confixcmd "cosmossdk.io/tools/confix/cmd" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/config" "github.com/cosmos/cosmos-sdk/client/debug" @@ -32,9 +35,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/crisis" genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" - "cosmossdk.io/log" tmcfg "github.com/cometbft/cometbft/config" - dbm "github.com/cosmos/cosmos-db" cdd "github.com/cosmos/interchain-security/v6/app/consumer-democracy" appencoding "github.com/cosmos/interchain-security/v6/app/encoding" diff --git a/cmd/interchain-security-pd/cmd/root.go b/cmd/interchain-security-pd/cmd/root.go index 105233f8d5..c167d3feae 100644 --- a/cmd/interchain-security-pd/cmd/root.go +++ b/cmd/interchain-security-pd/cmd/root.go @@ -5,11 +5,14 @@ import ( "io" "os" + dbm "github.com/cosmos/cosmos-db" "github.com/spf13/cobra" "github.com/spf13/viper" "cosmossdk.io/client/v2/autocli" + "cosmossdk.io/log" confixcmd "cosmossdk.io/tools/confix/cmd" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/config" "github.com/cosmos/cosmos-sdk/client/debug" @@ -32,9 +35,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/crisis" genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" - "cosmossdk.io/log" cmtcfg "github.com/cometbft/cometbft/config" - dbm "github.com/cosmos/cosmos-db" appEncoding "github.com/cosmos/interchain-security/v6/app/encoding" providerApp "github.com/cosmos/interchain-security/v6/app/provider" diff --git a/cmd/interchain-security-sd/cmd/root.go b/cmd/interchain-security-sd/cmd/root.go index a17d1ee3bf..6004d2b3f8 100644 --- a/cmd/interchain-security-sd/cmd/root.go +++ b/cmd/interchain-security-sd/cmd/root.go @@ -5,11 +5,14 @@ import ( "io" "os" + dbm "github.com/cosmos/cosmos-db" "github.com/spf13/cobra" "github.com/spf13/viper" "cosmossdk.io/client/v2/autocli" + "cosmossdk.io/log" confixcmd "cosmossdk.io/tools/confix/cmd" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/config" "github.com/cosmos/cosmos-sdk/client/debug" @@ -32,9 +35,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/crisis" genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" - "cosmossdk.io/log" tmcfg "github.com/cometbft/cometbft/config" - dbm "github.com/cosmos/cosmos-db" appencoding "github.com/cosmos/interchain-security/v6/app/encoding" sovereignApp "github.com/cosmos/interchain-security/v6/app/sovereign" diff --git a/cmd/interchain-security-sd/main.go b/cmd/interchain-security-sd/main.go index 6703ab3581..5aaf766d2f 100644 --- a/cmd/interchain-security-sd/main.go +++ b/cmd/interchain-security-sd/main.go @@ -8,7 +8,6 @@ import ( appparams "github.com/cosmos/interchain-security/v6/app/params" app "github.com/cosmos/interchain-security/v6/app/sovereign" - "github.com/cosmos/interchain-security/v6/cmd/interchain-security-sd/cmd" ) diff --git a/tests/e2e/actions.go b/tests/e2e/actions.go index 8cafb2847a..3ef0a0bf9d 100644 --- a/tests/e2e/actions.go +++ b/tests/e2e/actions.go @@ -15,12 +15,13 @@ import ( "sync" "time" - sdk "github.com/cosmos/cosmos-sdk/types" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" "github.com/tidwall/gjson" "golang.org/x/mod/semver" - ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + sdk "github.com/cosmos/cosmos-sdk/types" + e2e "github.com/cosmos/interchain-security/v6/tests/e2e/testlib" "github.com/cosmos/interchain-security/v6/x/ccv/provider/client" "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" @@ -276,7 +277,6 @@ type UpdateConsumerChainAction struct { } func (tr Chain) updateConsumerChain(action UpdateConsumerChainAction, verbose bool) { - spawnTime := tr.testConfig.containerConfig.Now.Add(time.Duration(action.SpawnTime) * time.Millisecond) params := ccvtypes.DefaultParams() initParams := types.ConsumerInitializationParameters{ @@ -332,7 +332,6 @@ type CreateConsumerChainAction struct { // createConsumerChain creates and initializes a consumer chain func (tr Chain) createConsumerChain(action CreateConsumerChainAction, verbose bool) { - spawnTime := tr.testConfig.containerConfig.Now.Add(time.Duration(action.SpawnTime) * time.Millisecond) params := ccvtypes.DefaultParams() initParams := types.ConsumerInitializationParameters{ @@ -438,7 +437,6 @@ func (tr Chain) UpdateConsumer(providerChain ChainID, validator ValidatorID, upd // CreateConsumer creates a consumer chain and returns its consumer-id func (tr Chain) CreateConsumer(providerChain, consumerChain ChainID, validator ValidatorID, metadata types.ConsumerMetadata, initParams *types.ConsumerInitializationParameters, powerShapingParams *types.PowerShapingParameters) ConsumerID { - chainID := string(tr.testConfig.chainConfigs[consumerChain].ChainId) msg := types.MsgCreateConsumer{ ChainId: chainID, @@ -870,7 +868,6 @@ func (tr Chain) submitConsumerModificationProposal( action SubmitConsumerModificationProposalAction, verbose bool, ) { - consumerId := string(tr.testConfig.chainConfigs[action.ConsumerChain].ConsumerId) title := "Propose the modification of the PSS parameters of a chain" description := "description of the consumer modification proposal" @@ -1332,7 +1329,6 @@ func (tr Chain) changeoverChain( action ChangeoverChainAction, verbose bool, ) { - consumerGenesis := ".app_state.ccvconsumer = " + tr.getConsumerGenesis(action.ProviderChain, action.SovereignChain) consumerGenesisChanges := tr.testConfig.chainConfigs[action.SovereignChain].GenesisChanges @@ -2278,7 +2274,7 @@ func (tr Chain) invokeDowntimeSlash(action DowntimeSlashAction, verbose bool) { } // Sets validator downtime by setting the virtual ethernet interface of a node to "up" or "down" -func (tr Chain) setValidatorDowntime(chain ChainID, validator ValidatorID, down bool, verbose bool) { +func (tr Chain) setValidatorDowntime(chain ChainID, validator ValidatorID, down, verbose bool) { var lastArg string if down { lastArg = "down" @@ -2471,7 +2467,6 @@ type SubmitChangeRewardDenomsProposalAction struct { } func (tr Chain) submitChangeRewardDenomsProposal(action SubmitChangeRewardDenomsProposalAction, verbose bool) { - changeRewMsg := types.MsgChangeRewardDenoms{ DenomsToAdd: []string{action.Denom}, DenomsToRemove: []string{"stake"}, diff --git a/tests/e2e/actions_sovereign_chain.go b/tests/e2e/actions_sovereign_chain.go index 0c8ccfae56..c789f72ec5 100644 --- a/tests/e2e/actions_sovereign_chain.go +++ b/tests/e2e/actions_sovereign_chain.go @@ -112,7 +112,6 @@ type UpgradeProposalAction struct { } func (tr *Chain) submitUpgradeProposal(action UpgradeProposalAction, verbose bool) { - // Get authority address binary := tr.testConfig.chainConfigs[ChainID("sover")].BinaryName cmd := tr.target.ExecCommand(binary, diff --git a/tests/e2e/config.go b/tests/e2e/config.go index 9b0d24df3f..f97cfb5df9 100644 --- a/tests/e2e/config.go +++ b/tests/e2e/config.go @@ -8,8 +8,9 @@ import ( "strings" "time" - e2e "github.com/cosmos/interchain-security/v6/tests/e2e/testlib" "golang.org/x/mod/semver" + + e2e "github.com/cosmos/interchain-security/v6/tests/e2e/testlib" ) var ( diff --git a/tests/e2e/json_marshal_test.go b/tests/e2e/json_marshal_test.go index d4a41ad2fc..12ea80f718 100644 --- a/tests/e2e/json_marshal_test.go +++ b/tests/e2e/json_marshal_test.go @@ -7,10 +7,12 @@ import ( "strings" "testing" - gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - e2e "github.com/cosmos/interchain-security/v6/tests/e2e/testlib" "github.com/davecgh/go-spew/spew" + + gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + + e2e "github.com/cosmos/interchain-security/v6/tests/e2e/testlib" ) func TestProposalUnmarshal(t *testing.T) { diff --git a/tests/e2e/state.go b/tests/e2e/state.go index 4b43249af0..f03380be89 100644 --- a/tests/e2e/state.go +++ b/tests/e2e/state.go @@ -11,11 +11,12 @@ import ( "time" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - e2e "github.com/cosmos/interchain-security/v6/tests/e2e/testlib" - "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" "github.com/kylelemons/godebug/pretty" "github.com/tidwall/gjson" "gopkg.in/yaml.v2" + + e2e "github.com/cosmos/interchain-security/v6/tests/e2e/testlib" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) // type aliases @@ -208,7 +209,7 @@ func (tr Chain) GetBalances(chain ChainID, modelState map[ValidatorID]uint) map[ func (tr Chain) GetClientFrozenHeight(chain ChainID, clientID string) clienttypes.Height { revNumber, revHeight := tr.target.GetClientFrozenHeight(chain, clientID) - return clienttypes.Height{RevisionHeight: uint64(revHeight), RevisionNumber: uint64(revNumber)} + return clienttypes.Height{RevisionHeight: revHeight, RevisionNumber: revNumber} } func (tr Chain) GetProposedConsumerChains(chain ChainID) []string { @@ -782,7 +783,7 @@ func (tr Commands) GetConsumerChains(chain ChainID) map[ChainID]bool { func (tr Commands) GetConsumerAddress(consumerChain ChainID, validator ValidatorID) string { binaryName := tr.chainConfigs[ChainID("provi")].BinaryName - consumerId := tr.chainConfigs[ChainID(consumerChain)].ConsumerId + consumerId := tr.chainConfigs[consumerChain].ConsumerId cmd := tr.target.ExecCommand(binaryName, "query", "provider", "validator-consumer-key", @@ -801,7 +802,7 @@ func (tr Commands) GetConsumerAddress(consumerChain ChainID, validator Validator func (tr Commands) GetProviderAddressFromConsumer(consumerChain ChainID, validator ValidatorID) string { binaryName := tr.chainConfigs[ChainID("provi")].BinaryName - consumerId := tr.chainConfigs[ChainID(consumerChain)].ConsumerId + consumerId := tr.chainConfigs[consumerChain].ConsumerId cmd := tr.target.ExecCommand(binaryName, diff --git a/tests/e2e/state_rapid_test.go b/tests/e2e/state_rapid_test.go index fc591d5db1..2962e89571 100644 --- a/tests/e2e/state_rapid_test.go +++ b/tests/e2e/state_rapid_test.go @@ -117,7 +117,6 @@ func GetIBCTransferParamsGen() *rapid.Generator[IBCTransferParams] { ReceiveEnabled: rapid.Bool().Draw(t, "ReceiveEnabled"), } }) - } func GetIBCTransferParamsProposalGen() *rapid.Generator[IBCTransferParamsProposal] { diff --git a/tests/e2e/steps.go b/tests/e2e/steps.go index 279b312e7f..e2c64745fd 100644 --- a/tests/e2e/steps.go +++ b/tests/e2e/steps.go @@ -3,8 +3,9 @@ package main import ( "strconv" - gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + + gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" ) type Step struct { diff --git a/tests/e2e/steps_active_set_changes.go b/tests/e2e/steps_active_set_changes.go index a61009137e..8e4a1d5128 100644 --- a/tests/e2e/steps_active_set_changes.go +++ b/tests/e2e/steps_active_set_changes.go @@ -3,8 +3,9 @@ package main import ( "strconv" - gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + + gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" ) // stepsActiveSetChanges starts a top N provider chain and causes a change in the active set diff --git a/tests/e2e/steps_compatibility.go b/tests/e2e/steps_compatibility.go index 9258d6ca6a..8e23eca016 100644 --- a/tests/e2e/steps_compatibility.go +++ b/tests/e2e/steps_compatibility.go @@ -6,8 +6,10 @@ package main import ( "strconv" - gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + + gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) @@ -128,7 +130,7 @@ func compstepsStartConsumerChain(consumerName string, proposalIndex, chainIndex Chain: ChainID(consumerName), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), //TODO: CHECK if this is bug on SDK SIDE!!!: should be as before gov.ProposalStatus(gov.ProposalStatus_PROPOSAL_STATUS_PASSED).String(), + Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), // TODO: CHECK if this is bug on SDK SIDE!!!: should be as before gov.ProposalStatus(gov.ProposalStatus_PROPOSAL_STATUS_PASSED).String(), }, }, ValBalances: &map[ValidatorID]uint{ diff --git a/tests/e2e/steps_consumer_misbehaviour.go b/tests/e2e/steps_consumer_misbehaviour.go index bec4c61394..63d83382d1 100644 --- a/tests/e2e/steps_consumer_misbehaviour.go +++ b/tests/e2e/steps_consumer_misbehaviour.go @@ -3,8 +3,9 @@ package main import ( "strconv" - gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + + gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" ) // starts a provider chain and an Opt-In consumer chain with one validator diff --git a/tests/e2e/steps_inactive_vals.go b/tests/e2e/steps_inactive_vals.go index 64957cbfb9..1ec4c5b413 100644 --- a/tests/e2e/steps_inactive_vals.go +++ b/tests/e2e/steps_inactive_vals.go @@ -3,8 +3,9 @@ package main import ( "strconv" - gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + + gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" ) // stepsInactiveValidatorsOnConsumer tests situations where validators that are *not* in the active set on the diff --git a/tests/e2e/steps_partial_set_security.go b/tests/e2e/steps_partial_set_security.go index 156457769b..5a08ddda78 100644 --- a/tests/e2e/steps_partial_set_security.go +++ b/tests/e2e/steps_partial_set_security.go @@ -4,8 +4,9 @@ import ( "strconv" "time" - gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + + gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" ) // stepsOptInChain starts a provider chain and an Opt-In chain and opts in and out validators diff --git a/tests/e2e/steps_sovereign_changeover.go b/tests/e2e/steps_sovereign_changeover.go index ac6b7025cc..f66eb14dfe 100644 --- a/tests/e2e/steps_sovereign_changeover.go +++ b/tests/e2e/steps_sovereign_changeover.go @@ -3,8 +3,9 @@ package main import ( "strconv" - gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + + gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" ) // this creates new clients on both chains and a connection (connection-0) between them diff --git a/tests/e2e/steps_start_chains.go b/tests/e2e/steps_start_chains.go index c8cfdaf212..de468e75db 100644 --- a/tests/e2e/steps_start_chains.go +++ b/tests/e2e/steps_start_chains.go @@ -3,8 +3,9 @@ package main import ( "strconv" - gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + + gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" ) func stepStartProviderChain() []Step { diff --git a/tests/e2e/steps_stop_chain.go b/tests/e2e/steps_stop_chain.go index 9efc240ee6..a88d8288b7 100644 --- a/tests/e2e/steps_stop_chain.go +++ b/tests/e2e/steps_stop_chain.go @@ -1,8 +1,9 @@ package main import ( - gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" "strconv" + + gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" ) // start relayer so that all messages are relayed diff --git a/tests/e2e/test_driver.go b/tests/e2e/test_driver.go index 8024b64b0f..95550daa18 100644 --- a/tests/e2e/test_driver.go +++ b/tests/e2e/test_driver.go @@ -5,9 +5,10 @@ import ( "log" "reflect" - v4 "github.com/cosmos/interchain-security/v6/tests/e2e/v4" "github.com/kylelemons/godebug/pretty" "golang.org/x/mod/semver" + + v4 "github.com/cosmos/interchain-security/v6/tests/e2e/v4" ) // TestCaseDriver knows how different TC can be executed diff --git a/tests/e2e/testlib/utils.go b/tests/e2e/testlib/utils.go index c9d663a3f5..081142d5be 100644 --- a/tests/e2e/testlib/utils.go +++ b/tests/e2e/testlib/utils.go @@ -25,7 +25,6 @@ type GovernanceProposal struct { // GenerateGovProposalContent creates proposal content ready to be used by `gov submit-proposal` command func GenerateGovProposalContent(title, summary, metadata, deposit, description string, expedited bool, msgs ...sdk.Msg) string { - // Register the messages. Needed for correct type annotation in the resulting json modcodec := codec.NewProtoCodec(codectypes.NewInterfaceRegistry()) modcodec.InterfaceRegistry().RegisterImplementations( diff --git a/tests/e2e/trace_handlers_test.go b/tests/e2e/trace_handlers_test.go index a773d00fe5..35b2647ca4 100644 --- a/tests/e2e/trace_handlers_test.go +++ b/tests/e2e/trace_handlers_test.go @@ -9,9 +9,10 @@ import ( "strconv" "testing" - gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" "github.com/google/go-cmp/cmp" + + gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" ) // an isolated test case for a proposal submission @@ -128,7 +129,10 @@ func TestMarshalAndUnmarshalChainState(t *testing.T) { 1: IBCTransferParamsProposal{ Deposit: 10000001, Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), - Params: IBCTransferParams{true, true}, + Params: IBCTransferParams{ + SendEnabled: true, + ReceiveEnabled: true, + }, }, }, }}, @@ -165,7 +169,7 @@ func TestMarshalAndUnmarshalChainState(t *testing.T) { t.Run(name, func(t *testing.T) { err := MarshalAndUnmarshalChainState(tc.chainState) if err != nil { - t.Fatalf(err.Error()) + t.Fatalf("MarshalAndUnmarshalChainState: %s", err.Error()) } }) } @@ -186,7 +190,7 @@ func MarshalAndUnmarshalChainState(chainState ChainState) error { diff := cmp.Diff(chainState, *got) if diff != "" { log.Print(string(jsonobj)) - return fmt.Errorf(diff) + return fmt.Errorf("marshaled and unmarshaled ChainState don't match, diff=%s", diff) } return nil diff --git a/tests/e2e/v4/state.go b/tests/e2e/v4/state.go index 97ab7859ce..6343747d5d 100644 --- a/tests/e2e/v4/state.go +++ b/tests/e2e/v4/state.go @@ -7,15 +7,15 @@ import ( "os/exec" "regexp" "strconv" - "time" - gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - e2e "github.com/cosmos/interchain-security/v6/tests/e2e/testlib" - "gopkg.in/yaml.v2" - "github.com/kylelemons/godebug/pretty" "github.com/tidwall/gjson" + "gopkg.in/yaml.v2" + + gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + + e2e "github.com/cosmos/interchain-security/v6/tests/e2e/testlib" ) type ( @@ -80,20 +80,6 @@ func (tr Commands) GetBlockHeight(chain ChainID) uint { return uint(blockHeight) } -func (tr Commands) waitUntilBlock(chain ChainID, block uint, timeout time.Duration) { - start := time.Now() - for { - thisBlock := tr.GetBlockHeight(chain) - if thisBlock >= block { - return - } - if time.Since(start) > timeout { - panic(fmt.Sprintf("\n\n\nwaitBlocks method has timed out after: %s\n\n", timeout)) - } - time.Sleep(500 * time.Millisecond) - } -} - type ValPubKey struct { Value string `yaml:"value"` } @@ -531,19 +517,11 @@ func (tr Commands) GetQueryNodeIP(chain ChainID) string { return fmt.Sprintf("%s.253", tr.ChainConfigs[chain].IpPrefix) } -func (tr Commands) curlJsonRPCRequest(method, params, address string) { - cmd_template := `curl -H 'Content-Type: application/json' -H 'Accept:application/json' --data '{"jsonrpc":"2.0","method":"%s","params":%s,"id":1}' %s` - cmd := tr.Target.ExecCommand("bash", "-c", fmt.Sprintf(cmd_template, method, params, address)) - - verbosity := false - e2e.ExecuteCommand(cmd, "curlJsonRPCRequest", verbosity) -} - // GetClientFrozenHeight returns the frozen height for a client with the given client ID // by querying the hosting chain with the given chainID func (tr Commands) GetClientFrozenHeight(chain ChainID, clientID string) (uint64, uint64) { //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - //cmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[ChainID("provi")].BinaryName, + // cmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[ChainID("provi")].BinaryName, binaryName := tr.ChainConfigs[ChainID("provi")].BinaryName cmd := tr.Target.ExecCommand(binaryName, "query", "ibc", "client", "state", clientID, @@ -577,7 +555,7 @@ func (tr Commands) GetTrustedHeight( index int, ) (uint64, uint64) { //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - //configureNodeCmd := exec.Command("docker", "exec", tc.testConfig.containerConfig.InstanceName, "hermes", + // configureNodeCmd := exec.Command("docker", "exec", tc.testConfig.containerConfig.InstanceName, "hermes", configureNodeCmd := tr.Target.ExecCommand("hermes", "--json", "query", "client", "consensus", "--chain", string(chain), `--client`, clientID, @@ -621,7 +599,7 @@ func (tr Commands) GetTrustedHeight( func (tr Commands) GetProposedConsumerChains(chain ChainID) []string { //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - //bz, err := exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[chain].BinaryName, + // bz, err := exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[chain].BinaryName, binaryName := tr.ChainConfigs[chain].BinaryName bz, err := tr.Target.ExecCommand(binaryName, "query", "provider", "list-proposed-consumer-chains", @@ -655,10 +633,6 @@ func (tr Commands) GetConsumerCommissionRate(chain ChainID, validator ValidatorI panic("'GetConsumerCommissionRate' is not implemented in this version") } -func uintPtr(i uint) *uint { - return &i -} - func (tr Commands) GetInflationRate( chain ChainID, ) float64 { diff --git a/tests/integration/common.go b/tests/integration/common.go index 05e3dd5aff..a7c0c99783 100644 --- a/tests/integration/common.go +++ b/tests/integration/common.go @@ -67,7 +67,7 @@ func (s *CCVTestSuite) getValByIdx(index int) (validator stakingtypes.Validator, } func (s *CCVTestSuite) getVal(ctx sdk.Context, valAddr sdk.ValAddress) stakingtypes.Validator { - validator, err := s.providerApp.GetTestStakingKeeper().GetValidator(s.providerCtx(), valAddr) + validator, err := s.providerApp.GetTestStakingKeeper().GetValidator(ctx, valAddr) s.Require().NoError(err) return validator } @@ -75,7 +75,7 @@ func (s *CCVTestSuite) getVal(ctx sdk.Context, valAddr sdk.ValAddress) stakingty func (s *CCVTestSuite) getValConsAddr(tmVal tmtypes.Validator) sdk.ConsAddress { val, err := tmVal.ToProto() s.Require().NoError(err) - pubkey, err := cryptocodec.FromTmProtoPublicKey(val.GetPubKey()) + pubkey, err := cryptocodec.FromCmtProtoPublicKey(val.GetPubKey()) s.Require().Nil(err) return sdk.GetConsAddress(pubkey) } @@ -113,41 +113,6 @@ func delegateAndUndelegate(s *CCVTestSuite, delAddr sdk.AccAddress, bondAmt math return initBalance, valsetUpdateId } -// Delegates "amount" to a source validator, then redelegates that same amount to a dest validator, -// with related state assertions along the way. -// -// Note: This function advances blocks in-between operations, where validator powers are -// not checked, since they are checked in integration tests. -func delegateAndRedelegate(s *CCVTestSuite, delAddr sdk.AccAddress, - srcValAddr, dstValAddr sdk.ValAddress, amount math.Int, -) { - // Delegate to src validator - srcValTokensBefore := s.getVal(s.providerCtx(), srcValAddr).GetBondedTokens() - _, sharesDelegated, _ := delegate(s, delAddr, amount) - - // Assert expected amount was bonded to src validator - srcValTokensAfter := s.getVal(s.providerCtx(), srcValAddr).GetBondedTokens() - s.Require().Equal(srcValTokensAfter.Sub(srcValTokensBefore), amount) - - s.nextEpoch() - - dstValTokensBefore := s.getVal(s.providerCtx(), dstValAddr).GetBondedTokens() - - // redelegate shares from src to dst validators - redelegate(s, delAddr, - srcValAddr, - dstValAddr, - sharesDelegated, - ) - - // Assert expected amount was delegated to dst val - dstValTokensAfter := s.getVal(s.providerCtx(), dstValAddr).GetBondedTokens() - s.Require().Equal(dstValTokensAfter.Sub(dstValTokensBefore), amount) - - // Assert delegated tokens amount returned to original value for src validator - s.Require().Equal(srcValTokensBefore, s.getVal(s.providerCtx(), srcValAddr).GetBondedTokens()) -} - // delegate delegates bondAmt to the first validator func delegate(s *CCVTestSuite, delAddr sdk.AccAddress, bondAmt math.Int) (initBalance math.Int, shares math.LegacyDec, valAddr sdk.ValAddress) { return delegateByIdx(s, delAddr, bondAmt, 0) diff --git a/tests/integration/democracy.go b/tests/integration/democracy.go index db2947cad3..8f84f5ea32 100644 --- a/tests/integration/democracy.go +++ b/tests/integration/democracy.go @@ -14,7 +14,6 @@ import ( govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" icstestingutils "github.com/cosmos/interchain-security/v6/testutil/ibc_testing" @@ -316,7 +315,6 @@ func (s *ConsumerDemocracyTestSuite) TestDemocracyMsgUpdateParams() { // deposit is refunded s.Assert().Equal(votersOldBalances, getAccountsBalances(s.consumerCtx(), bankKeeper, bondDenom, votingAccounts)) - } func submitProposalWithDepositAndVote(govKeeper govkeeper.Keeper, ctx sdk.Context, msgs []sdk.Msg, diff --git a/tests/integration/distribution.go b/tests/integration/distribution.go index 374238d33f..71908e134b 100644 --- a/tests/integration/distribution.go +++ b/tests/integration/distribution.go @@ -3,15 +3,16 @@ package integration import ( "strings" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - - "cosmossdk.io/math" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + icstestingutils "github.com/cosmos/interchain-security/v6/testutil/integration" consumerkeeper "github.com/cosmos/interchain-security/v6/x/ccv/consumer/keeper" consumertypes "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" diff --git a/tests/integration/double_vote.go b/tests/integration/double_vote.go index 5df8d1dbda..100e82352d 100644 --- a/tests/integration/double_vote.go +++ b/tests/integration/double_vote.go @@ -2,6 +2,7 @@ package integration import ( "cosmossdk.io/math" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" @@ -232,7 +233,7 @@ func (s *CCVTestSuite) TestHandleConsumerDoubleVoting() { } // convert validator public key - pk, err := cryptocodec.FromTmPubKeyInterface(tc.pubkey) + pk, err := cryptocodec.FromCmtPubKeyInterface(tc.pubkey) s.Require().NoError(err) err = s.providerApp.GetProviderKeeper().HandleConsumerDoubleVoting( @@ -336,7 +337,7 @@ func (s *CCVTestSuite) TestHandleConsumerDoubleVotingSlashesUndelegationsAndRele s.Run("slash undelegations and redelegations when getting double voting evidence", func() { // convert validator public key - pk, err := cryptocodec.FromTmPubKeyInterface(pubKey) + pk, err := cryptocodec.FromCmtPubKeyInterface(pubKey) s.Require().NoError(err) // perform a delegation and an undelegation of the whole amount diff --git a/tests/integration/expired_client.go b/tests/integration/expired_client.go index 6567cf8427..34ad7e7eef 100644 --- a/tests/integration/expired_client.go +++ b/tests/integration/expired_client.go @@ -3,12 +3,13 @@ package integration import ( "time" - "cosmossdk.io/math" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" ibctesting "github.com/cosmos/ibc-go/v8/testing" + "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" diff --git a/tests/integration/key_assignment.go b/tests/integration/key_assignment.go index d2420f8dc5..aabd96fdec 100644 --- a/tests/integration/key_assignment.go +++ b/tests/integration/key_assignment.go @@ -1,9 +1,10 @@ package integration import ( - "cosmossdk.io/math" "github.com/cosmos/ibc-go/v8/testing/mock" + "cosmossdk.io/math" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" tmencoding "github.com/cometbft/cometbft/crypto/encoding" diff --git a/tests/integration/misbehaviour.go b/tests/integration/misbehaviour.go index 84edd0a979..14babf96e3 100644 --- a/tests/integration/misbehaviour.go +++ b/tests/integration/misbehaviour.go @@ -3,9 +3,10 @@ package integration import ( "time" - "cosmossdk.io/math" ibctmtypes "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" tmtypes "github.com/cometbft/cometbft/types" diff --git a/tests/integration/partial_set_security_test.go b/tests/integration/partial_set_security_test.go index 3ad9c1c216..0519a7462d 100644 --- a/tests/integration/partial_set_security_test.go +++ b/tests/integration/partial_set_security_test.go @@ -5,16 +5,15 @@ import ( "sort" "testing" - "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" - - "cosmossdk.io/math" - ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" "github.com/stretchr/testify/require" - icstestingutils "github.com/cosmos/interchain-security/v6/testutil/ibc_testing" + "cosmossdk.io/math" appConsumer "github.com/cosmos/interchain-security/v6/app/consumer" appProvider "github.com/cosmos/interchain-security/v6/app/provider" + icstestingutils "github.com/cosmos/interchain-security/v6/testutil/ibc_testing" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" ) // we need a stake multiplier because tokens do not directly correspond to voting power diff --git a/tests/integration/setup.go b/tests/integration/setup.go index d8c037a77c..2d92867e8e 100644 --- a/tests/integration/setup.go +++ b/tests/integration/setup.go @@ -13,6 +13,7 @@ import ( "github.com/stretchr/testify/suite" store "cosmossdk.io/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" abci "github.com/cometbft/cometbft/abci/types" diff --git a/tests/integration/slashing.go b/tests/integration/slashing.go index dc73e106d3..a60765563f 100644 --- a/tests/integration/slashing.go +++ b/tests/integration/slashing.go @@ -10,8 +10,8 @@ import ( "cosmossdk.io/core/comet" "cosmossdk.io/math" - "cosmossdk.io/x/evidence/types" evidencetypes "cosmossdk.io/x/evidence/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" sdkaddress "github.com/cosmos/cosmos-sdk/types/address" @@ -51,7 +51,7 @@ func (s *CCVTestSuite) TestRelayAndApplyDowntimePacket() { tmVal := s.consumerChain.Vals.Validators[0] val, err := tmVal.ToProto() s.Require().NoError(err) - pubkey, err := cryptocodec.FromTmProtoPublicKey(val.GetPubKey()) + pubkey, err := cryptocodec.FromCmtProtoPublicKey(val.GetPubKey()) s.Require().Nil(err) consumerConsAddr := providertypes.NewConsumerConsAddress(sdk.GetConsAddress(pubkey)) // map consumer consensus address to provider consensus address @@ -760,7 +760,7 @@ func (suite *CCVTestSuite) TestCISBeforeCCVEstablished() { // copy of the function from slashing/keeper.go // in cosmos-sdk v0.50.x the function HandleEquivocationEvidence is not exposed (it was exposed for versions <= v0.47.x) // https://github.com/cosmos/cosmos-sdk/blob/v0.50.4/x/evidence/keeper/infraction.go#L27 -func handleEquivocationEvidence(ctx context.Context, k integration.ConsumerApp, evidence *types.Equivocation) error { +func handleEquivocationEvidence(ctx context.Context, k integration.ConsumerApp, evidence *evidencetypes.Equivocation) error { sdkCtx := sdk.UnwrapSDKContext(ctx) slashingKeeper := k.GetTestSlashingKeeper().(slashingkeeper.Keeper) evidenceKeeper := k.GetTestEvidenceKeeper() @@ -831,7 +831,7 @@ func handleEquivocationEvidence(ctx context.Context, k integration.ConsumerApp, } } - err = slashingKeeper.JailUntil(ctx, consAddr, types.DoubleSignJailEndTime) + err = slashingKeeper.JailUntil(ctx, consAddr, evidencetypes.DoubleSignJailEndTime) if err != nil { return err } diff --git a/tests/integration/stop_consumer.go b/tests/integration/stop_consumer.go index 682eb9b259..2f7c97dceb 100644 --- a/tests/integration/stop_consumer.go +++ b/tests/integration/stop_consumer.go @@ -1,13 +1,14 @@ package integration import ( - "cosmossdk.io/math" channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" - "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" ) diff --git a/tests/integration/throttle.go b/tests/integration/throttle.go index 13201f67bc..010ba0c397 100644 --- a/tests/integration/throttle.go +++ b/tests/integration/throttle.go @@ -3,9 +3,10 @@ package integration import ( "time" - "cosmossdk.io/math" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" diff --git a/tests/integration/throttle_retry.go b/tests/integration/throttle_retry.go index cacc7c8c12..f388c65f1c 100644 --- a/tests/integration/throttle_retry.go +++ b/tests/integration/throttle_retry.go @@ -158,6 +158,7 @@ func (s *CCVTestSuite) TestSlashRetries() { stakingVal2Addr, err := providerKeeper.ValidatorAddressCodec().StringToBytes(stakingVal2.GetOperator()) s.Require().NoError(err) stakingVal2LastPower, err := providerStakingKeeper.GetLastValidatorPower(s.providerCtx(), stakingVal2Addr) + s.Require().NoError(err) s.Require().Equal(int64(1000), stakingVal2LastPower) // Apply ack on consumer @@ -212,6 +213,7 @@ func (s *CCVTestSuite) TestSlashRetries() { stakingVal2Addr, err = providerKeeper.ValidatorAddressCodec().StringToBytes(stakingVal2.GetOperator()) s.Require().NoError(err) stakingVal2LastPower, err = providerStakingKeeper.GetLastValidatorPower(s.providerCtx(), stakingVal2Addr) + s.Require().NoError(err) s.Require().Equal(int64(0), stakingVal2LastPower) // Apply ack on consumer diff --git a/tests/integration/valset_update.go b/tests/integration/valset_update.go index 9b682823f4..831b9b2ac9 100644 --- a/tests/integration/valset_update.go +++ b/tests/integration/valset_update.go @@ -3,9 +3,10 @@ package integration import ( "time" - "cosmossdk.io/math" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + "cosmossdk.io/math" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" abci "github.com/cometbft/cometbft/abci/types" diff --git a/tests/mbt/driver/common.go b/tests/mbt/driver/common.go index 51a3af0f45..045a2ff082 100644 --- a/tests/mbt/driver/common.go +++ b/tests/mbt/driver/common.go @@ -2,6 +2,7 @@ package main import ( "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/tests/mbt/driver/core.go b/tests/mbt/driver/core.go index cd487a7e98..e3aaabe613 100644 --- a/tests/mbt/driver/core.go +++ b/tests/mbt/driver/core.go @@ -8,23 +8,21 @@ import ( "testing" "time" - "cosmossdk.io/math" - tendermint "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" ibctesting "github.com/cosmos/ibc-go/v8/testing" "github.com/stretchr/testify/require" sdkmath "cosmossdk.io/math" - abcitypes "github.com/cometbft/cometbft/abci/types" sdk "github.com/cosmos/cosmos-sdk/types" slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + abcitypes "github.com/cometbft/cometbft/abci/types" + "github.com/cometbft/cometbft/proto/tendermint/crypto" cmttypes "github.com/cometbft/cometbft/types" - "github.com/cometbft/cometbft/proto/tendermint/crypto" appConsumer "github.com/cosmos/interchain-security/v6/app/consumer" appProvider "github.com/cosmos/interchain-security/v6/app/provider" simibc "github.com/cosmos/interchain-security/v6/testutil/simibc" @@ -166,11 +164,11 @@ func (s *Driver) consumerValidatorSet(chain ChainId) []consumertypes.CrossChainV func (s *Driver) delegate(val, amt int64) { providerStaking := s.providerStakingKeeper() server := stakingkeeper.NewMsgServerImpl(&providerStaking) - coin := sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(amt)) + coin := sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(amt)) d := s.delegator().String() v := s.validator(val).String() msg := stakingtypes.NewMsgDelegate(d, v, coin) - _, err := server.Delegate(sdk.WrapSDKContext(s.ctx(PROVIDER)), msg) + _, err := server.Delegate(s.ctx(PROVIDER), msg) if err != nil { log.Println("error when delegating (is this expected?): ", err) } @@ -180,11 +178,11 @@ func (s *Driver) delegate(val, amt int64) { func (s *Driver) undelegate(val, amt int64) { providerStaking := s.providerStakingKeeper() server := stakingkeeper.NewMsgServerImpl(&providerStaking) - coin := sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(amt)) + coin := sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(amt)) d := s.delegator().String() v := s.validator(val).String() msg := stakingtypes.NewMsgUndelegate(d, v, coin) - _, err := server.Undelegate(sdk.WrapSDKContext(s.ctx(PROVIDER)), msg) + _, err := server.Undelegate(s.ctx(PROVIDER), msg) if err != nil { log.Println("error when undelegating (is this expected?): ", err) } @@ -439,7 +437,7 @@ func (s *Driver) RequestSlash( } // DeliverAcks delivers, for each path, -// all possible acks (up to math.MaxInt many per path). +// all possible acks (up to sdkmath.MaxInt many per path). func (s *Driver) DeliverAcks() { for _, chainID := range s.runningConsumerChainIDs() { path := s.path(chainID) diff --git a/tests/mbt/driver/mbt_test.go b/tests/mbt/driver/mbt_test.go index 4a5293f97d..429a0e3583 100644 --- a/tests/mbt/driver/mbt_test.go +++ b/tests/mbt/driver/mbt_test.go @@ -10,19 +10,20 @@ import ( "testing" "time" - "cosmossdk.io/math" ibctesting "github.com/cosmos/ibc-go/v8/testing" "github.com/informalsystems/itf-go/itf" "github.com/kylelemons/godebug/pretty" "github.com/stretchr/testify/require" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" tmencoding "github.com/cometbft/cometbft/crypto/encoding" cmttypes "github.com/cometbft/cometbft/types" - "github.com/cosmos/interchain-security/v6/testutil/integration" + "github.com/cosmos/interchain-security/v6/testutil/integration" providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" "github.com/cosmos/interchain-security/v6/x/ccv/types" ) diff --git a/tests/mbt/driver/setup.go b/tests/mbt/driver/setup.go index 03b18d61f1..e157f4ce60 100644 --- a/tests/mbt/driver/setup.go +++ b/tests/mbt/driver/setup.go @@ -12,8 +12,6 @@ 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/v6/x/ccv/provider/types" - providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" "github.com/stretchr/testify/require" "cosmossdk.io/math" @@ -36,6 +34,7 @@ import ( "github.com/cosmos/interchain-security/v6/testutil/integration" simibc "github.com/cosmos/interchain-security/v6/testutil/simibc" consumertypes "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" + providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) @@ -157,7 +156,7 @@ func getAppBytesAndSenders( sumBonded = sumBonded.Add(tokens) - pk, err := cryptocodec.FromTmPubKeyInterface(val.PubKey) + pk, err := cryptocodec.FromCmtPubKeyInterface(val.PubKey) if err != nil { log.Panicf("error getting pubkey for val %v", val) } @@ -390,7 +389,7 @@ 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 - err = s.providerKeeper().SetConsumerPowerShapingParameters(providerChain.GetContext(), consumerChain.ChainID, types.PowerShapingParameters{ + err = s.providerKeeper().SetConsumerPowerShapingParameters(providerChain.GetContext(), consumerChain.ChainID, providertypes.PowerShapingParameters{ Top_N: 100, }) require.NoError(s.t, err, "Error setting consumer top N for chain %v", consumerChain.ChainID) diff --git a/testutil/crypto/crypto.go b/testutil/crypto/crypto.go index 54f60c736f..41b93733aa 100644 --- a/testutil/crypto/crypto.go +++ b/testutil/crypto/crypto.go @@ -31,7 +31,7 @@ type CryptoIdentity struct { func NewCryptoIdentityFromBytesSeed(seed []byte) *CryptoIdentity { //lint:ignore SA1019 We don't care because this is only a test. - consKey := &sdkcryptoEd25519.PrivKey{Key: cryptoEd25519.NewKeyFromSeed(seed)} //nolint:staticcheck // SA1019: sdkcryptoEd25519.PrivKey is deprecated: PrivKey defines a ed25519 private key. NOTE: ed25519 keys must not be used in SDK apps except in a tendermint validator context. + consKey := &sdkcryptoEd25519.PrivKey{Key: cryptoEd25519.NewKeyFromSeed(seed)} opKey := sdkcryptoSecp256k1.GenPrivKeyFromSecret(seed) return &CryptoIdentity{ diff --git a/testutil/ibc_testing/generic_setup.go b/testutil/ibc_testing/generic_setup.go index c99970c718..c0f1bfd7ba 100644 --- a/testutil/ibc_testing/generic_setup.go +++ b/testutil/ibc_testing/generic_setup.go @@ -6,9 +6,7 @@ import ( "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/v6/testutil/keeper" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" @@ -19,6 +17,7 @@ import ( tmtypes "github.com/cometbft/cometbft/types" testutil "github.com/cosmos/interchain-security/v6/testutil/integration" + testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" consumerkeeper "github.com/cosmos/interchain-security/v6/x/ccv/consumer/keeper" providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) diff --git a/testutil/ibc_testing/specific_setup.go b/testutil/ibc_testing/specific_setup.go index 16e21ce5ca..145989ce3a 100644 --- a/testutil/ibc_testing/specific_setup.go +++ b/testutil/ibc_testing/specific_setup.go @@ -10,11 +10,12 @@ import ( db "github.com/cosmos/cosmos-db" ibctesting "github.com/cosmos/ibc-go/v8/testing" + "cosmossdk.io/log" + simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "cosmossdk.io/log" "github.com/cometbft/cometbft/abci/types" appConsumer "github.com/cosmos/interchain-security/v6/app/consumer" diff --git a/testutil/integration/interfaces.go b/testutil/integration/interfaces.go index 7e8019a08a..0376f42eb8 100644 --- a/testutil/integration/interfaces.go +++ b/testutil/integration/interfaces.go @@ -4,24 +4,26 @@ import ( "context" "time" - abci "github.com/cometbft/cometbft/abci/types" ibctesting "github.com/cosmos/ibc-go/v8/testing" "cosmossdk.io/core/comet" "cosmossdk.io/math" - govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - evidencekeeper "cosmossdk.io/x/evidence/keeper" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" + govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + abci "github.com/cometbft/cometbft/abci/types" + consumerkeeper "github.com/cosmos/interchain-security/v6/x/ccv/consumer/keeper" providerkeeper "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" diff --git a/testutil/keeper/expectations.go b/testutil/keeper/expectations.go index 4996880c35..014c0d72a5 100644 --- a/testutil/keeper/expectations.go +++ b/testutil/keeper/expectations.go @@ -3,6 +3,7 @@ package keeper import ( time "time" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" conntypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" @@ -15,7 +16,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" "github.com/cosmos/interchain-security/v6/x/ccv/types" diff --git a/testutil/keeper/unit_test_helpers.go b/testutil/keeper/unit_test_helpers.go index 57f0147ebf..df7fa80920 100644 --- a/testutil/keeper/unit_test_helpers.go +++ b/testutil/keeper/unit_test_helpers.go @@ -7,13 +7,16 @@ import ( "testing" "time" + dbm "github.com/cosmos/cosmos-db" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "cosmossdk.io/log" "cosmossdk.io/store" "cosmossdk.io/store/metrics" storetypes "cosmossdk.io/store/types" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/address" codectypes "github.com/cosmos/cosmos-sdk/codec/types" @@ -22,23 +25,19 @@ import ( cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "cosmossdk.io/log" abci "github.com/cometbft/cometbft/abci/types" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" consumerkeeper "github.com/cosmos/interchain-security/v6/x/ccv/consumer/keeper" consumertypes "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" providerkeeper "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" - "github.com/cosmos/interchain-security/v6/x/ccv/types" - - dbm "github.com/cosmos/cosmos-db" ) // Parameters needed to instantiate an in-memory keeper diff --git a/x/ccv/consumer/ibc_module.go b/x/ccv/consumer/ibc_module.go index 62df5ca6d5..b446fe1554 100644 --- a/x/ccv/consumer/ibc_module.go +++ b/x/ccv/consumer/ibc_module.go @@ -5,6 +5,7 @@ import ( "strconv" "strings" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" @@ -15,7 +16,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" "github.com/cosmos/interchain-security/v6/x/ccv/consumer/keeper" consumertypes "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" diff --git a/x/ccv/consumer/ibc_module_test.go b/x/ccv/consumer/ibc_module_test.go index 8041f27dc2..d6a59dfc28 100644 --- a/x/ccv/consumer/ibc_module_test.go +++ b/x/ccv/consumer/ibc_module_test.go @@ -3,6 +3,7 @@ package consumer_test import ( "testing" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" conntypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" @@ -11,7 +12,6 @@ import ( "github.com/stretchr/testify/require" sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" "github.com/cosmos/interchain-security/v6/x/ccv/consumer" @@ -239,7 +239,7 @@ func TestOnChanOpenAck(t *testing.T) { ConnectionHops: []string{"connectionID"}, }, true).Times(1), mocks.MockIBCCoreKeeper.EXPECT().ChannelOpenInit( - sdk.WrapSDKContext(params.ctx), distrTransferMsg).Return( + params.ctx, distrTransferMsg).Return( &channeltypes.MsgChannelOpenInitResponse{}, nil, ).Times(1), ) diff --git a/x/ccv/consumer/keeper/distribution.go b/x/ccv/consumer/keeper/distribution.go index d056b165b2..84cc98b86b 100644 --- a/x/ccv/consumer/keeper/distribution.go +++ b/x/ccv/consumer/keeper/distribution.go @@ -227,7 +227,7 @@ func (k Keeper) SetLastTransmissionBlockHeight(ctx sdk.Context, ltbh types.LastT func (k Keeper) ChannelOpenInit(ctx sdk.Context, msg *channeltypes.MsgChannelOpenInit) ( *channeltypes.MsgChannelOpenInitResponse, error, ) { - return k.ibcCoreKeeper.ChannelOpenInit(sdk.WrapSDKContext(ctx), msg) + return k.ibcCoreKeeper.ChannelOpenInit(ctx, msg) } func (k Keeper) TransferChannelExists(ctx sdk.Context, channelID string) bool { diff --git a/x/ccv/consumer/keeper/distribution_test.go b/x/ccv/consumer/keeper/distribution_test.go index 6f9b58c30a..8c9f67d85c 100644 --- a/x/ccv/consumer/keeper/distribution_test.go +++ b/x/ccv/consumer/keeper/distribution_test.go @@ -4,10 +4,11 @@ import ( "strings" "testing" - "cosmossdk.io/math" "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" authTypes "github.com/cosmos/cosmos-sdk/x/auth/types" diff --git a/x/ccv/consumer/keeper/keeper.go b/x/ccv/consumer/keeper/keeper.go index ec9a7ac105..57896cb973 100644 --- a/x/ccv/consumer/keeper/keeper.go +++ b/x/ccv/consumer/keeper/keeper.go @@ -6,23 +6,23 @@ import ( "reflect" "time" - addresscodec "cosmossdk.io/core/address" - "cosmossdk.io/core/store" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" conntypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" host "github.com/cosmos/ibc-go/v8/modules/core/24-host" + addresscodec "cosmossdk.io/core/address" + "cosmossdk.io/core/store" errorsmod "cosmossdk.io/errors" - + "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - "cosmossdk.io/log" tmtypes "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" diff --git a/x/ccv/consumer/keeper/relay_test.go b/x/ccv/consumer/keeper/relay_test.go index e9863eeecd..f21fa9fd25 100644 --- a/x/ccv/consumer/keeper/relay_test.go +++ b/x/ccv/consumer/keeper/relay_test.go @@ -6,6 +6,7 @@ import ( "testing" "time" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" host "github.com/cosmos/ibc-go/v8/modules/core/24-host" @@ -16,7 +17,6 @@ import ( "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/libs/bytes" diff --git a/x/ccv/consumer/keeper/validators_test.go b/x/ccv/consumer/keeper/validators_test.go index 83a3ca338d..349a3b2b40 100644 --- a/x/ccv/consumer/keeper/validators_test.go +++ b/x/ccv/consumer/keeper/validators_test.go @@ -280,7 +280,7 @@ func SetCCValidators(tb testing.TB, consumerKeeper keeper.Keeper, ) { tb.Helper() for _, v := range validators { - publicKey, err := cryptocodec.FromTmPubKeyInterface(v.PubKey) + publicKey, err := cryptocodec.FromCmtPubKeyInterface(v.PubKey) require.NoError(tb, err) ccv, err := types.NewCCValidator(v.Address, v.VotingPower, publicKey) diff --git a/x/ccv/consumer/migrations/v2/migration.go b/x/ccv/consumer/migrations/v2/migration.go index 0238517f2f..353da75ef5 100644 --- a/x/ccv/consumer/migrations/v2/migration.go +++ b/x/ccv/consumer/migrations/v2/migration.go @@ -4,6 +4,7 @@ import ( "fmt" storetypes "cosmossdk.io/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" consumertypes "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" diff --git a/x/ccv/consumer/migrations/v2/migration_test.go b/x/ccv/consumer/migrations/v2/migration_test.go index 5f12adf2d7..500be893b6 100644 --- a/x/ccv/consumer/migrations/v2/migration_test.go +++ b/x/ccv/consumer/migrations/v2/migration_test.go @@ -7,7 +7,9 @@ import ( "github.com/stretchr/testify/require" storetypes "cosmossdk.io/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + testutil "github.com/cosmos/interchain-security/v6/testutil/keeper" v2 "github.com/cosmos/interchain-security/v6/x/ccv/consumer/migrations/v2" consumertypes "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" diff --git a/x/ccv/consumer/migrations/v3/migration.go b/x/ccv/consumer/migrations/v3/migration.go index 06fd8cc376..ab96129d75 100644 --- a/x/ccv/consumer/migrations/v3/migration.go +++ b/x/ccv/consumer/migrations/v3/migration.go @@ -1,11 +1,11 @@ package v3 import ( + storetypes "cosmossdk.io/store/types" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - storetypes "cosmossdk.io/store/types" - consumertypes "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) diff --git a/x/ccv/consumer/migrations/v3/migration_test.go b/x/ccv/consumer/migrations/v3/migration_test.go index 5ca4fce25b..aed3ce8436 100644 --- a/x/ccv/consumer/migrations/v3/migration_test.go +++ b/x/ccv/consumer/migrations/v3/migration_test.go @@ -5,15 +5,16 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + storetypes "cosmossdk.io/store/types" + "github.com/cosmos/cosmos-sdk/testutil" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/interchain-security/v6/app/encoding" consumertypes "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" - - "github.com/stretchr/testify/require" ) type testLegacyParamSubspace struct { diff --git a/x/ccv/consumer/module.go b/x/ccv/consumer/module.go index b1cfe7cabd..31e12ef380 100644 --- a/x/ccv/consumer/module.go +++ b/x/ccv/consumer/module.go @@ -5,10 +5,11 @@ import ( "encoding/json" "fmt" - "cosmossdk.io/core/appmodule" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" + "cosmossdk.io/core/appmodule" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" diff --git a/x/ccv/consumer/types/codec.go b/x/ccv/consumer/types/codec.go index 947fb4feb0..0f6d783218 100644 --- a/x/ccv/consumer/types/codec.go +++ b/x/ccv/consumer/types/codec.go @@ -1,9 +1,8 @@ package types import ( - sdk "github.com/cosmos/cosmos-sdk/types" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" ) diff --git a/x/ccv/democracy/distribution/module.go b/x/ccv/democracy/distribution/module.go index 08517e6496..2f9713fb29 100644 --- a/x/ccv/democracy/distribution/module.go +++ b/x/ccv/democracy/distribution/module.go @@ -6,6 +6,7 @@ import ( "cosmossdk.io/core/appmodule" "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/x/ccv/democracy/governance/module.go b/x/ccv/democracy/governance/module.go index f9312d7fa2..1ac1da886a 100644 --- a/x/ccv/democracy/governance/module.go +++ b/x/ccv/democracy/governance/module.go @@ -7,6 +7,7 @@ import ( "cosmossdk.io/collections" "cosmossdk.io/core/appmodule" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" diff --git a/x/ccv/no_valupdates_genutil/module.go b/x/ccv/no_valupdates_genutil/module.go index 9a7528c071..cd1ace0adb 100644 --- a/x/ccv/no_valupdates_genutil/module.go +++ b/x/ccv/no_valupdates_genutil/module.go @@ -4,6 +4,7 @@ import ( "encoding/json" "cosmossdk.io/core/genesis" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/x/ccv/no_valupdates_staking/module.go b/x/ccv/no_valupdates_staking/module.go index cda755621e..94b9b2ec08 100644 --- a/x/ccv/no_valupdates_staking/module.go +++ b/x/ccv/no_valupdates_staking/module.go @@ -5,6 +5,7 @@ import ( "encoding/json" "cosmossdk.io/core/appmodule" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" diff --git a/x/ccv/provider/client/cli/tx.go b/x/ccv/provider/client/cli/tx.go index 189a6cd576..2bd46f5cd3 100644 --- a/x/ccv/provider/client/cli/tx.go +++ b/x/ccv/provider/client/cli/tx.go @@ -6,11 +6,11 @@ import ( "os" "strings" - "cosmossdk.io/math" - ibctmtypes "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" "github.com/spf13/cobra" + "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" diff --git a/x/ccv/provider/ibc_middleware.go b/x/ccv/provider/ibc_middleware.go index c522ce425c..5ba56949aa 100644 --- a/x/ccv/provider/ibc_middleware.go +++ b/x/ccv/provider/ibc_middleware.go @@ -1,6 +1,7 @@ package provider import ( + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" @@ -10,7 +11,6 @@ import ( "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" diff --git a/x/ccv/provider/ibc_module.go b/x/ccv/provider/ibc_module.go index 61618791df..a1d812ff5f 100644 --- a/x/ccv/provider/ibc_module.go +++ b/x/ccv/provider/ibc_module.go @@ -4,6 +4,7 @@ import ( "fmt" "strconv" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" host "github.com/cosmos/ibc-go/v8/modules/core/24-host" @@ -13,7 +14,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" diff --git a/x/ccv/provider/ibc_module_test.go b/x/ccv/provider/ibc_module_test.go index 42a550b8ae..2270adf0ba 100644 --- a/x/ccv/provider/ibc_module_test.go +++ b/x/ccv/provider/ibc_module_test.go @@ -3,6 +3,7 @@ package provider_test import ( "testing" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" conntypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" @@ -13,7 +14,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" "github.com/cosmos/interchain-security/v6/x/ccv/provider" diff --git a/x/ccv/provider/keeper/consumer_equivocation.go b/x/ccv/provider/keeper/consumer_equivocation.go index 692af2470c..0fc95f639b 100644 --- a/x/ccv/provider/keeper/consumer_equivocation.go +++ b/x/ccv/provider/keeper/consumer_equivocation.go @@ -11,8 +11,8 @@ import ( errorsmod "cosmossdk.io/errors" "cosmossdk.io/math" - evidencetypes "cosmossdk.io/x/evidence/types" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" @@ -424,7 +424,7 @@ func (k Keeper) JailAndTombstoneValidator(ctx sdk.Context, providerAddr types.Pr } if k.slashingKeeper.IsTombstoned(ctx, providerAddr.ToSdkConsAddr()) { - return errorsmod.Wrapf(slashingtypes.ErrValidatorTombstoned, providerAddr.String()) + return errorsmod.Wrapf(slashingtypes.ErrValidatorTombstoned, "provider consensus address: %s", providerAddr.String()) } // jail validator if not already diff --git a/x/ccv/provider/keeper/consumer_equivocation_test.go b/x/ccv/provider/keeper/consumer_equivocation_test.go index e427f769bf..d85b963127 100644 --- a/x/ccv/provider/keeper/consumer_equivocation_test.go +++ b/x/ccv/provider/keeper/consumer_equivocation_test.go @@ -27,7 +27,7 @@ func TestVerifyDoubleVotingEvidence(t *testing.T) { keeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - chainID := "consumer" + chainID := CONSUMER_CHAIN_ID signer1 := tmtypes.NewMockPV() signer2 := tmtypes.NewMockPV() @@ -42,10 +42,10 @@ func TestVerifyDoubleVotingEvidence(t *testing.T) { ctx = ctx.WithBlockTime(time.Now()) - valPubkey1, err := cryptocodec.FromTmPubKeyInterface(val1.PubKey) + valPubkey1, err := cryptocodec.FromCmtPubKeyInterface(val1.PubKey) require.NoError(t, err) - valPubkey2, err := cryptocodec.FromTmPubKeyInterface(val2.PubKey) + valPubkey2, err := cryptocodec.FromCmtPubKeyInterface(val2.PubKey) require.NoError(t, err) testCases := []struct { @@ -596,7 +596,7 @@ func TestComputePowerToSlash(t *testing.T) { }, } - pubKey, _ := cryptocodec.FromTmPubKeyInterface(tmtypes.NewMockPV().PrivKey.PubKey()) + pubKey, _ := cryptocodec.FromCmtPubKeyInterface(tmtypes.NewMockPV().PrivKey.PubKey()) validator, _ := stakingtypes.NewValidator(pubKey.Address().String(), pubKey, stakingtypes.Description{}) for _, tc := range testCases { @@ -649,7 +649,7 @@ func TestSlashValidator(t *testing.T) { // undelegation or redelegation entries with completion time one hour in the future have not yet matured nowPlus1Hour := now.Add(time.Hour) - pubKey, _ := cryptocodec.FromTmPubKeyInterface(tmtypes.NewMockPV().PrivKey.PubKey()) + pubKey, _ := cryptocodec.FromCmtPubKeyInterface(tmtypes.NewMockPV().PrivKey.PubKey()) validator, err := stakingtypes.NewValidator( sdk.ValAddress(pubKey.Address()).String(), @@ -753,7 +753,7 @@ func TestSlashValidatorDoesNotSlashIfValidatorIsUnbonded(t *testing.T) { keeperParams := testkeeper.NewInMemKeeperParams(t) testkeeper.NewInMemProviderKeeper(keeperParams, mocks) - pubKey, _ := cryptocodec.FromTmPubKeyInterface(tmtypes.NewMockPV().PrivKey.PubKey()) + pubKey, _ := cryptocodec.FromCmtPubKeyInterface(tmtypes.NewMockPV().PrivKey.PubKey()) // validator is initially unbonded validator, _ := stakingtypes.NewValidator(pubKey.Address().String(), pubKey, stakingtypes.Description{}) @@ -772,7 +772,7 @@ func TestSlashValidatorDoesNotSlashIfValidatorIsUnbonded(t *testing.T) { } func TestEquivocationEvidenceMinHeightCRUD(t *testing.T) { - chainID := consumer + chainID := CONSUMER_CHAIN_ID expMinHeight := uint64(12) keeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() diff --git a/x/ccv/provider/keeper/consumer_lifecycle.go b/x/ccv/provider/keeper/consumer_lifecycle.go index 5896d2a2a6..19468c6294 100644 --- a/x/ccv/provider/keeper/consumer_lifecycle.go +++ b/x/ccv/provider/keeper/consumer_lifecycle.go @@ -4,7 +4,10 @@ import ( "fmt" "time" - tmtypes "github.com/cometbft/cometbft/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + commitmenttypes "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types" + ibctmtypes "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" errorsmod "cosmossdk.io/errors" storetypes "cosmossdk.io/store/types" @@ -13,10 +16,7 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" - commitmenttypes "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types" - ibctmtypes "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" + tmtypes "github.com/cometbft/cometbft/types" "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" @@ -24,7 +24,7 @@ import ( // PrepareConsumerForLaunch prepares to move the launch of a consumer chain from the previous spawn time to spawn time. // Previous spawn time can correspond to its zero value if the validator was not previously set for launch. -func (k Keeper) PrepareConsumerForLaunch(ctx sdk.Context, consumerId string, previousSpawnTime time.Time, spawnTime time.Time) error { +func (k Keeper) PrepareConsumerForLaunch(ctx sdk.Context, consumerId string, previousSpawnTime, spawnTime time.Time) error { 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 previous spawn time @@ -613,7 +613,7 @@ func (k Keeper) removeConsumerIdFromTime(ctx sdk.Context, consumerId string, key // find the index of the consumer we want to remove index := -1 - for i := 0; i < len(consumers.Ids); i = i + 1 { + for i := 0; i < len(consumers.Ids); i++ { if consumers.Ids[i] == consumerId { index = i break diff --git a/x/ccv/provider/keeper/consumer_lifecycle_test.go b/x/ccv/provider/keeper/consumer_lifecycle_test.go index 66b0241c71..cadedbf9df 100644 --- a/x/ccv/provider/keeper/consumer_lifecycle_test.go +++ b/x/ccv/provider/keeper/consumer_lifecycle_test.go @@ -6,19 +6,18 @@ import ( "testing" "time" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + ibctmtypes "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" + _go "github.com/cosmos/ics23/go" "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" - abci "github.com/cometbft/cometbft/abci/types" - "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - ibctmtypes "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" - _go "github.com/cosmos/ics23/go" + abci "github.com/cometbft/cometbft/abci/types" cryptotestutil "github.com/cosmos/interchain-security/v6/testutil/crypto" testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" @@ -32,15 +31,15 @@ func TestPrepareConsumerForLaunch(t *testing.T) { defer ctrl.Finish() spawnTime := time.Now().UTC() - err := providerKeeper.PrepareConsumerForLaunch(ctx, "consumerId", time.Time{}, spawnTime) + err := providerKeeper.PrepareConsumerForLaunch(ctx, CONSUMER_ID, time.Time{}, spawnTime) require.NoError(t, err) consumers, err := providerKeeper.GetConsumersToBeLaunched(ctx, spawnTime) require.NoError(t, err) - require.Equal(t, providertypes.ConsumerIds{Ids: []string{"consumerId"}}, consumers) + require.Equal(t, providertypes.ConsumerIds{Ids: []string{CONSUMER_ID}}, consumers) nextSpawnTime := spawnTime.Add(time.Hour) - err = providerKeeper.PrepareConsumerForLaunch(ctx, "consumerId", spawnTime, nextSpawnTime) + err = providerKeeper.PrepareConsumerForLaunch(ctx, CONSUMER_ID, spawnTime, nextSpawnTime) require.NoError(t, err) consumers, err = providerKeeper.GetConsumersToBeLaunched(ctx, spawnTime) @@ -49,7 +48,7 @@ func TestPrepareConsumerForLaunch(t *testing.T) { consumers, err = providerKeeper.GetConsumersToBeLaunched(ctx, nextSpawnTime) require.NoError(t, err) - require.Equal(t, providertypes.ConsumerIds{Ids: []string{"consumerId"}}, consumers) + require.Equal(t, providertypes.ConsumerIds{Ids: []string{CONSUMER_ID}}, consumers) } func TestInitializeConsumer(t *testing.T) { @@ -270,7 +269,8 @@ func TestBeginBlockLaunchConsumers(t *testing.T) { 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, "chain0", clienttypes.NewHeight(3, 4)) @@ -865,17 +865,17 @@ func TestConsumerRemovalTime(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - _, err := providerKeeper.GetConsumerRemovalTime(ctx, "consumerId") + _, err := providerKeeper.GetConsumerRemovalTime(ctx, CONSUMER_ID) require.Error(t, err) expectedRemovalTime := time.Unix(1234, 56789) - providerKeeper.SetConsumerRemovalTime(ctx, "consumerId", expectedRemovalTime) - actualRemovalTime, err := providerKeeper.GetConsumerRemovalTime(ctx, "consumerId") + providerKeeper.SetConsumerRemovalTime(ctx, CONSUMER_ID, expectedRemovalTime) + actualRemovalTime, err := providerKeeper.GetConsumerRemovalTime(ctx, CONSUMER_ID) require.NoError(t, err) require.Equal(t, actualRemovalTime, expectedRemovalTime) - providerKeeper.DeleteConsumerRemovalTime(ctx, "consumerId") - _, err = providerKeeper.GetConsumerRemovalTime(ctx, "consumerId") + providerKeeper.DeleteConsumerRemovalTime(ctx, CONSUMER_ID) + _, err = providerKeeper.GetConsumerRemovalTime(ctx, CONSUMER_ID) require.Error(t, err) } diff --git a/x/ccv/provider/keeper/distribution.go b/x/ccv/provider/keeper/distribution.go index 29500d2b9c..85241c794a 100644 --- a/x/ccv/provider/keeper/distribution.go +++ b/x/ccv/provider/keeper/distribution.go @@ -3,11 +3,12 @@ package keeper import ( "context" - storetypes "cosmossdk.io/store/types" channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" errorsmod "cosmossdk.io/errors" "cosmossdk.io/math" + storetypes "cosmossdk.io/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" diff --git a/x/ccv/provider/keeper/distribution_test.go b/x/ccv/provider/keeper/distribution_test.go index c10b309eb7..d9ff18ac75 100644 --- a/x/ccv/provider/keeper/distribution_test.go +++ b/x/ccv/provider/keeper/distribution_test.go @@ -3,7 +3,6 @@ package keeper_test import ( "testing" - "cosmossdk.io/math" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" conntypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" @@ -11,6 +10,8 @@ import ( "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" tmtypes "github.com/cometbft/cometbft/types" diff --git a/x/ccv/provider/keeper/genesis_test.go b/x/ccv/provider/keeper/genesis_test.go index c01b179b44..b3fb8420e5 100644 --- a/x/ccv/provider/keeper/genesis_test.go +++ b/x/ccv/provider/keeper/genesis_test.go @@ -4,11 +4,12 @@ import ( "testing" "time" - "cosmossdk.io/math" host "github.com/cosmos/ibc-go/v8/modules/core/24-host" "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -32,7 +33,7 @@ func TestInitAndExportGenesis(t *testing.T) { providerCryptoId := crypto.NewCryptoIdentityFromIntSeed(7896) provAddr := providerCryptoId.ProviderConsAddress() provVal := providerCryptoId.SDKStakingValidator() - provPubKey, err := provVal.TmConsPublicKey() + provPubKey, err := provVal.CmtConsPublicKey() require.NoError(t, err) consumerCryptoId := crypto.NewCryptoIdentityFromIntSeed(7897) diff --git a/x/ccv/provider/keeper/grpc_query.go b/x/ccv/provider/keeper/grpc_query.go index 236fc6e7d7..cebc952d60 100644 --- a/x/ccv/provider/keeper/grpc_query.go +++ b/x/ccv/provider/keeper/grpc_query.go @@ -12,6 +12,7 @@ import ( errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) diff --git a/x/ccv/provider/keeper/grpc_query_test.go b/x/ccv/provider/keeper/grpc_query_test.go index 4a6563ba41..c2cabfe8b1 100644 --- a/x/ccv/provider/keeper/grpc_query_test.go +++ b/x/ccv/provider/keeper/grpc_query_test.go @@ -601,7 +601,7 @@ func TestQueryConsumerIdFromClientId(t *testing.T) { require.Error(t, err) require.ErrorContains(t, err, "no known consumer chain") - expectedConsumerId := "consumerId" + expectedConsumerId := CONSUMER_ID providerKeeper.SetConsumerClientId(ctx, expectedConsumerId, "clientId") res, err := providerKeeper.QueryConsumerIdFromClientId(ctx, &types.QueryConsumerIdFromClientIdRequest{ClientId: "clientId"}) diff --git a/x/ccv/provider/keeper/hooks.go b/x/ccv/provider/keeper/hooks.go index 257942ff5c..514510e159 100644 --- a/x/ccv/provider/keeper/hooks.go +++ b/x/ccv/provider/keeper/hooks.go @@ -4,6 +4,7 @@ import ( "context" "cosmossdk.io/math" + 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" diff --git a/x/ccv/provider/keeper/hooks_test.go b/x/ccv/provider/keeper/hooks_test.go index 312d9be632..e1e7d88312 100644 --- a/x/ccv/provider/keeper/hooks_test.go +++ b/x/ccv/provider/keeper/hooks_test.go @@ -3,12 +3,14 @@ package keeper_test import ( "testing" + "github.com/golang/mock/gomock" + sdk "github.com/cosmos/cosmos-sdk/types" + cryptotestutil "github.com/cosmos/interchain-security/v6/testutil/crypto" testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" providerkeeper "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" - "github.com/golang/mock/gomock" ) func TestValidatorConsensusKeyInUse(t *testing.T) { diff --git a/x/ccv/provider/keeper/invariants.go b/x/ccv/provider/keeper/invariants.go index 8e736b8f7f..7d84212eea 100644 --- a/x/ccv/provider/keeper/invariants.go +++ b/x/ccv/provider/keeper/invariants.go @@ -5,6 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + types "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) diff --git a/x/ccv/provider/keeper/keeper.go b/x/ccv/provider/keeper/keeper.go index 86692f8c3e..ea2f3fc229 100644 --- a/x/ccv/provider/keeper/keeper.go +++ b/x/ccv/provider/keeper/keeper.go @@ -7,9 +7,7 @@ import ( "reflect" "time" - addresscodec "cosmossdk.io/core/address" - "cosmossdk.io/math" - + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" conntypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" @@ -17,16 +15,16 @@ import ( ibchost "github.com/cosmos/ibc-go/v8/modules/core/exported" ibctmtypes "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" + addresscodec "cosmossdk.io/core/address" errorsmod "cosmossdk.io/errors" - + "cosmossdk.io/log" + "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - - "cosmossdk.io/log" govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" consumertypes "github.com/cosmos/interchain-security/v6/x/ccv/consumer/types" "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" @@ -260,7 +258,8 @@ func (k Keeper) DeleteChannelIdToConsumerId(ctx sdk.Context, channelId string) { func (k Keeper) GetAllChannelToConsumers(ctx sdk.Context) (channelsToConsumers []struct { ChannelId string ConsumerId string -}) { +}, +) { store := ctx.KVStore(k.storeKey) iterator := storetypes.KVStorePrefixIterator(store, types.ChannelIdToConsumerIdKeyPrefix()) defer iterator.Close() diff --git a/x/ccv/provider/keeper/keeper_test.go b/x/ccv/provider/keeper/keeper_test.go index d36066b96a..df6e811d17 100644 --- a/x/ccv/provider/keeper/keeper_test.go +++ b/x/ccv/provider/keeper/keeper_test.go @@ -6,10 +6,11 @@ import ( "sort" "testing" - "cosmossdk.io/math" ibctesting "github.com/cosmos/ibc-go/v8/testing" "github.com/stretchr/testify/require" + "cosmossdk.io/math" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" abci "github.com/cometbft/cometbft/abci/types" @@ -21,7 +22,10 @@ import ( ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" ) -const consumer = "consumer" +const ( + CONSUMER_CHAIN_ID = "chain-id" + CONSUMER_ID = "13" +) // TestValsetUpdateBlockHeight tests the getter, setter, and deletion methods for valset updates mapped to block height func TestValsetUpdateBlockHeight(t *testing.T) { @@ -95,7 +99,7 @@ func TestSlashAcks(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - chainID := consumer + chainID := CONSUMER_CHAIN_ID acks := providerKeeper.GetSlashAcks(ctx, chainID) require.Nil(t, acks) @@ -152,7 +156,7 @@ func TestPendingVSCs(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - chainID := consumer + chainID := CONSUMER_CHAIN_ID pending := providerKeeper.GetPendingVSCPackets(ctx, chainID) require.Len(t, pending, 0) @@ -300,10 +304,10 @@ func TestGetAllOptedIn(t *testing.T) { } for _, expectedOptedInValidator := range expectedOptedInValidators { - providerKeeper.SetOptedIn(ctx, "consumerId", expectedOptedInValidator) + providerKeeper.SetOptedIn(ctx, CONSUMER_ID, expectedOptedInValidator) } - actualOptedInValidators := providerKeeper.GetAllOptedIn(ctx, "consumerId") + actualOptedInValidators := providerKeeper.GetAllOptedIn(ctx, CONSUMER_ID) // sort validators first to be able to compare sortOptedInValidators := func(addresses []providertypes.ProviderConsAddress) { @@ -324,19 +328,19 @@ func TestOptedIn(t *testing.T) { optedInValidator1 := providertypes.NewProviderConsAddress([]byte("providerAddr1")) optedInValidator2 := providertypes.NewProviderConsAddress([]byte("providerAddr2")) - 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)) + require.False(t, providerKeeper.IsOptedIn(ctx, CONSUMER_ID, optedInValidator1)) + providerKeeper.SetOptedIn(ctx, CONSUMER_ID, optedInValidator1) + require.True(t, providerKeeper.IsOptedIn(ctx, CONSUMER_ID, optedInValidator1)) + providerKeeper.DeleteOptedIn(ctx, CONSUMER_ID, optedInValidator1) + require.False(t, providerKeeper.IsOptedIn(ctx, CONSUMER_ID, optedInValidator1)) + + providerKeeper.SetOptedIn(ctx, CONSUMER_ID, optedInValidator1) + providerKeeper.SetOptedIn(ctx, CONSUMER_ID, optedInValidator2) + require.True(t, providerKeeper.IsOptedIn(ctx, CONSUMER_ID, optedInValidator1)) + require.True(t, providerKeeper.IsOptedIn(ctx, CONSUMER_ID, optedInValidator2)) + providerKeeper.DeleteAllOptedIn(ctx, CONSUMER_ID) + require.False(t, providerKeeper.IsOptedIn(ctx, CONSUMER_ID, optedInValidator1)) + require.False(t, providerKeeper.IsOptedIn(ctx, CONSUMER_ID, optedInValidator2)) } // TestConsumerCommissionRate tests the `SetConsumerCommissionRate`, `GetConsumerCommissionRate`, and `DeleteConsumerCommissionRate` methods @@ -347,31 +351,31 @@ func TestConsumerCommissionRate(t *testing.T) { providerAddr1 := providertypes.NewProviderConsAddress([]byte("providerAddr1")) providerAddr2 := providertypes.NewProviderConsAddress([]byte("providerAddr2")) - cr, found := providerKeeper.GetConsumerCommissionRate(ctx, "consumerId", providerAddr1) + cr, found := providerKeeper.GetConsumerCommissionRate(ctx, CONSUMER_ID, providerAddr1) require.False(t, found) require.Equal(t, math.LegacyZeroDec(), cr) - providerKeeper.SetConsumerCommissionRate(ctx, "consumerId", providerAddr1, math.LegacyOneDec()) - cr, found = providerKeeper.GetConsumerCommissionRate(ctx, "consumerId", providerAddr1) + providerKeeper.SetConsumerCommissionRate(ctx, CONSUMER_ID, providerAddr1, math.LegacyOneDec()) + cr, found = providerKeeper.GetConsumerCommissionRate(ctx, CONSUMER_ID, providerAddr1) require.True(t, found) require.Equal(t, math.LegacyOneDec(), cr) - providerKeeper.SetConsumerCommissionRate(ctx, "consumerId", providerAddr2, math.LegacyZeroDec()) - cr, found = providerKeeper.GetConsumerCommissionRate(ctx, "consumerId", providerAddr2) + providerKeeper.SetConsumerCommissionRate(ctx, CONSUMER_ID, providerAddr2, math.LegacyZeroDec()) + cr, found = providerKeeper.GetConsumerCommissionRate(ctx, CONSUMER_ID, providerAddr2) require.True(t, found) require.Equal(t, math.LegacyZeroDec(), cr) - provAddrs := providerKeeper.GetAllCommissionRateValidators(ctx, "consumerId") + provAddrs := providerKeeper.GetAllCommissionRateValidators(ctx, CONSUMER_ID) require.Len(t, provAddrs, 2) for _, addr := range provAddrs { - providerKeeper.DeleteConsumerCommissionRate(ctx, "consumerId", addr) + providerKeeper.DeleteConsumerCommissionRate(ctx, CONSUMER_ID, addr) } - _, found = providerKeeper.GetConsumerCommissionRate(ctx, "consumerId", providerAddr1) + _, found = providerKeeper.GetConsumerCommissionRate(ctx, CONSUMER_ID, providerAddr1) require.False(t, found) - _, found = providerKeeper.GetConsumerCommissionRate(ctx, "consumerId", providerAddr2) + _, found = providerKeeper.GetConsumerCommissionRate(ctx, CONSUMER_ID, providerAddr2) require.False(t, found) } diff --git a/x/ccv/provider/keeper/key_assignment.go b/x/ccv/provider/keeper/key_assignment.go index 1e6fd5de5a..29970d0b0f 100644 --- a/x/ccv/provider/keeper/key_assignment.go +++ b/x/ccv/provider/keeper/key_assignment.go @@ -349,7 +349,7 @@ func (k Keeper) ConsumeConsumerAddrsToPrune( store.Delete(delKey) } - return + return consumerAddrsToPrune } // GetAllConsumerAddrsToPrune gets all consumer addresses that can be eventually pruned for a given consumerId. diff --git a/x/ccv/provider/keeper/key_assignment_test.go b/x/ccv/provider/keeper/key_assignment_test.go index f261154bec..c4d07de990 100644 --- a/x/ccv/provider/keeper/key_assignment_test.go +++ b/x/ccv/provider/keeper/key_assignment_test.go @@ -24,10 +24,8 @@ import ( ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) -const ChainID = "consumerId" - func TestValidatorConsumerPubKeyCRUD(t *testing.T) { - chainID := consumer + chainID := CONSUMER_CHAIN_ID providerAddr := types.NewProviderConsAddress([]byte("providerAddr")) consumerKey := cryptotestutil.NewCryptoIdentityFromIntSeed(1).TMProtoCryptoPublicKey() @@ -107,7 +105,7 @@ func TestGetAllValidatorConsumerPubKey(t *testing.T) { } func TestValidatorByConsumerAddrCRUD(t *testing.T) { - chainID := consumer + chainID := CONSUMER_CHAIN_ID providerAddr := types.NewProviderConsAddress([]byte("providerAddr")) consumerAddr := types.NewConsumerConsAddress([]byte("consumerAddr")) @@ -188,7 +186,7 @@ func TestGetAllValidatorsByConsumerAddr(t *testing.T) { } func TestConsumerAddrsToPruneCRUD(t *testing.T) { - chainID := consumer + chainID := CONSUMER_CHAIN_ID consumerAddr1 := types.NewConsumerConsAddress([]byte("consumerAddr1")) consumerAddr2 := types.NewConsumerConsAddress([]byte("consumerAddr2")) @@ -407,8 +405,7 @@ func TestAssignConsensusKeyForConsumerChain(t *testing.T) { }, { name: "2", - mockSetup: func(sdkCtx sdk.Context, k providerkeeper.Keeper, mocks testkeeper.MockedKeepers) { - ctx := sdk.WrapSDKContext(sdkCtx) + mockSetup: func(ctx sdk.Context, k providerkeeper.Keeper, mocks testkeeper.MockedKeepers) { gomock.InOrder( mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, consumerIdentities[0].SDKValConsAddress(), @@ -613,7 +610,7 @@ func TestCannotReassignDefaultKeyAssignment(t *testing.T) { providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - providerKeeper.SetConsumerPhase(ctx, "consumerId", types.CONSUMER_PHASE_INITIALIZED) + providerKeeper.SetConsumerPhase(ctx, CONSUMER_ID, types.CONSUMER_PHASE_INITIALIZED) // Mock that the validator is validating with the single key, as confirmed by provider's staking keeper gomock.InOrder( @@ -623,7 +620,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, "consumerId", cId.SDKStakingValidator(), cId.TMProtoCryptoPublicKey()) + err := providerKeeper.AssignConsumerKey(ctx, CONSUMER_ID, cId.SDKStakingValidator(), cId.TMProtoCryptoPublicKey()) require.Error(t, err) // Confirm we're not returning an error for some other reason @@ -668,7 +665,7 @@ type Assignment struct { // of simulated scenarios where random key assignments and validator // set updates are generated. func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { - CHAINID := ChainID + CONSUMERID := CONSUMER_ID // The number of full test executions to run NUM_EXECUTIONS := 100 // Each test execution mimics the adding of a consumer chain and the @@ -791,14 +788,14 @@ func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { }) } - nextValidators := k.FilterValidators(ctx, CHAINID, bondedValidators, + nextValidators := k.FilterValidators(ctx, CONSUMERID, bondedValidators, func(providerAddr types.ProviderConsAddress) bool { return true }) - valSet, error := k.GetConsumerValSet(ctx, CHAINID) + valSet, error := k.GetConsumerValSet(ctx, CONSUMERID) require.NoError(t, error) updates = providerkeeper.DiffValidators(valSet, nextValidators) - err := k.SetConsumerValSet(ctx, CHAINID, nextValidators) + err := k.SetConsumerValSet(ctx, CONSUMERID, nextValidators) require.NoError(t, err) consumerValset.apply(updates) @@ -810,7 +807,7 @@ func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { applyAssignments := func(assignments []Assignment) { for _, a := range assignments { // ignore err return, it can be possible for an error to occur - _ = k.AssignConsumerKey(ctx, ChainID, a.val, a.ck) + _ = k.AssignConsumerKey(ctx, CONSUMERID, a.val, a.ck) } } @@ -830,7 +827,7 @@ func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { applyUpdatesAndIncrementVSCID(stakingUpdates) // Register the consumer chain - k.SetConsumerClientId(ctx, ChainID, "") + k.SetConsumerClientId(ctx, CONSUMER_ID, "") // Set the greatest block time up to which keys have been pruned. At the beginning, no pruning has taken // place, so we set `greatestPrunedBlockTime` to 0, and set the current block time to 1. @@ -850,7 +847,7 @@ func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { // prune all keys that can be pruned up to the current block time greatestPrunedBlockTime = ctx.BlockTime().UnixNano() - k.PruneKeyAssignments(ctx, ChainID) + k.PruneKeyAssignments(ctx, CONSUMER_ID) // Increase the block time by a small random amount up to UnbondingTime / 10. We do not increase the block time // by UnbondingTime so that in the upcoming iteration of this `for` loop (i.e., new block), not all the keys @@ -874,7 +871,7 @@ func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { // For each active validator on the provider chain if 0 < providerValset.power[i] { // Get the assigned key - ck, found := k.GetValidatorConsumerPubKey(ctx, ChainID, idP.ProviderConsAddress()) + ck, found := k.GetValidatorConsumerPubKey(ctx, CONSUMER_ID, idP.ProviderConsAddress()) if !found { // Use default if unassigned ck = idP.TMProtoCryptoPublicKey() @@ -896,7 +893,7 @@ func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { consC := consumerValset.identities[i].ConsumerConsAddress() if 0 < consumerValset.power[i] { // Get the provider who assigned the key - consP := k.GetProviderAddrFromConsumerAddr(ctx, ChainID, consC) + consP := k.GetProviderAddrFromConsumerAddr(ctx, CONSUMER_ID, consC) // Find the corresponding provider validator (must always be found) for j, idP := range providerValset.identities { if idP.SDKValConsAddress().Equals(consP.ToSdkConsAddr()) { @@ -911,7 +908,7 @@ func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { Property: Pruning (bounded storage) Check that all keys have been or will eventually be pruned. */ - require.True(t, checkCorrectPruningProperty(ctx, k, ChainID)) + require.True(t, checkCorrectPruningProperty(ctx, k, CONSUMER_ID)) /* Property: Correct Consumer Initiated Slash Lookup @@ -935,7 +932,7 @@ func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { consC := consumerValset.identities[i].ConsumerConsAddress() if 0 < consumerValset.power[i] { // Get the provider who assigned the key - consP := k.GetProviderAddrFromConsumerAddr(ctx, ChainID, consC) + consP := k.GetProviderAddrFromConsumerAddr(ctx, CONSUMER_ID, consC) if _, found := consumerAddrToBlockTimeToProviderAddr[consC.String()]; !found { consumerAddrToBlockTimeToProviderAddr[consC.String()] = map[uint64]string{} diff --git a/x/ccv/provider/keeper/msg_server.go b/x/ccv/provider/keeper/msg_server.go index f899614e83..7bb624edf7 100644 --- a/x/ccv/provider/keeper/msg_server.go +++ b/x/ccv/provider/keeper/msg_server.go @@ -7,11 +7,14 @@ import ( "time" errorsmod "cosmossdk.io/errors" - 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/v6/x/ccv/provider/types" ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) @@ -167,7 +170,7 @@ func (k msgServer) SubmitConsumerDoubleVoting(goCtx context.Context, msg *types. evidence.VoteA.ValidatorAddress) } - pubkey, err := cryptocodec.FromTmPubKeyInterface(validator.PubKey) + pubkey, err := cryptocodec.FromCmtPubKeyInterface(validator.PubKey) if err != nil { return nil, err } diff --git a/x/ccv/provider/keeper/msg_server_test.go b/x/ccv/provider/keeper/msg_server_test.go index 98b4675359..a2f9cb3aab 100644 --- a/x/ccv/provider/keeper/msg_server_test.go +++ b/x/ccv/provider/keeper/msg_server_test.go @@ -4,11 +4,13 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/cosmos/cosmos-sdk/codec/address" + testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" providerkeeper "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" - "github.com/stretchr/testify/require" ) func TestCreateConsumer(t *testing.T) { @@ -22,9 +24,11 @@ func TestCreateConsumer(t *testing.T) { Description: "description", } response, err := msgServer.CreateConsumer(ctx, - &providertypes.MsgCreateConsumer{Submitter: "submitter", ChainId: "chainId", Metadata: consumerMetadata, + &providertypes.MsgCreateConsumer{ + Submitter: "submitter", ChainId: "chainId", Metadata: consumerMetadata, InitializationParameters: &providertypes.ConsumerInitializationParameters{}, - PowerShapingParameters: &providertypes.PowerShapingParameters{}}) + PowerShapingParameters: &providertypes.PowerShapingParameters{}, + }) require.NoError(t, err) require.Equal(t, "0", response.ConsumerId) actualMetadata, err := providerKeeper.GetConsumerMetadata(ctx, "0") @@ -41,9 +45,11 @@ func TestCreateConsumer(t *testing.T) { Description: "description2", } response, err = msgServer.CreateConsumer(ctx, - &providertypes.MsgCreateConsumer{Submitter: "submitter2", ChainId: "chainId", Metadata: consumerMetadata, + &providertypes.MsgCreateConsumer{ + Submitter: "submitter2", ChainId: "chainId", Metadata: consumerMetadata, InitializationParameters: &providertypes.ConsumerInitializationParameters{}, - PowerShapingParameters: &providertypes.PowerShapingParameters{}}) + 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) @@ -65,7 +71,8 @@ func TestUpdateConsumer(t *testing.T) { // try to update a non-existing (i.e., no consumer id exists) _, err := msgServer.UpdateConsumer(ctx, - &providertypes.MsgUpdateConsumer{Owner: "owner", ConsumerId: "0", NewOwnerAddress: "cosmos1dkas8mu4kyhl5jrh4nzvm65qz588hy9qcz08la", + &providertypes.MsgUpdateConsumer{ + Owner: "owner", ConsumerId: "0", NewOwnerAddress: "cosmos1dkas8mu4kyhl5jrh4nzvm65qz588hy9qcz08la", Metadata: nil, InitializationParameters: nil, PowerShapingParameters: nil, @@ -74,7 +81,8 @@ func TestUpdateConsumer(t *testing.T) { // create a chain before updating it createConsumerResponse, err := msgServer.CreateConsumer(ctx, - &providertypes.MsgCreateConsumer{Submitter: "submitter", ChainId: "chainId", + &providertypes.MsgCreateConsumer{ + Submitter: "submitter", ChainId: "chainId", Metadata: providertypes.ConsumerMetadata{ Name: "name", Description: "description", @@ -88,7 +96,8 @@ func TestUpdateConsumer(t *testing.T) { mocks.MockAccountKeeper.EXPECT().AddressCodec().Return(address.NewBech32Codec("cosmos")).AnyTimes() _, err = msgServer.UpdateConsumer(ctx, - &providertypes.MsgUpdateConsumer{Owner: "wrong owner", ConsumerId: consumerId, NewOwnerAddress: "cosmos1dkas8mu4kyhl5jrh4nzvm65qz588hy9qcz08la", + &providertypes.MsgUpdateConsumer{ + Owner: "wrong owner", ConsumerId: consumerId, NewOwnerAddress: "cosmos1dkas8mu4kyhl5jrh4nzvm65qz588hy9qcz08la", Metadata: nil, InitializationParameters: nil, PowerShapingParameters: nil, @@ -106,10 +115,12 @@ func TestUpdateConsumer(t *testing.T) { expectedOwnerAddress := "cosmos1dkas8mu4kyhl5jrh4nzvm65qz588hy9qcz08la" _, err = msgServer.UpdateConsumer(ctx, - &providertypes.MsgUpdateConsumer{Owner: "submitter", ConsumerId: consumerId, NewOwnerAddress: expectedOwnerAddress, + &providertypes.MsgUpdateConsumer{ + Owner: "submitter", ConsumerId: consumerId, NewOwnerAddress: expectedOwnerAddress, Metadata: &expectedConsumerMetadata, InitializationParameters: &expectedInitializationParameters, - PowerShapingParameters: &expectedPowerShapingParameters}) + PowerShapingParameters: &expectedPowerShapingParameters, + }) require.NoError(t, err) // assert that owner address was updated @@ -148,10 +159,12 @@ func TestUpdateConsumer(t *testing.T) { updatedSpawnTime := expectedInitializationParameters.SpawnTime.Add(time.Hour) expectedInitializationParameters.SpawnTime = updatedSpawnTime _, err = msgServer.UpdateConsumer(ctx, - &providertypes.MsgUpdateConsumer{Owner: expectedOwnerAddress, ConsumerId: consumerId, + &providertypes.MsgUpdateConsumer{ + Owner: expectedOwnerAddress, ConsumerId: consumerId, Metadata: &expectedConsumerMetadata, InitializationParameters: &expectedInitializationParameters, - PowerShapingParameters: &expectedPowerShapingParameters}) + PowerShapingParameters: &expectedPowerShapingParameters, + }) require.NoError(t, err) consumerIds, err = providerKeeper.GetConsumersToBeLaunched(ctx, previousSpawnTime) diff --git a/x/ccv/provider/keeper/params_test.go b/x/ccv/provider/keeper/params_test.go index 84ed685dfc..9c22a73014 100644 --- a/x/ccv/provider/keeper/params_test.go +++ b/x/ccv/provider/keeper/params_test.go @@ -4,12 +4,13 @@ import ( "testing" "time" - "cosmossdk.io/math" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" commitmenttypes "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types" ibctmtypes "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" "github.com/stretchr/testify/require" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" diff --git a/x/ccv/provider/keeper/partial_set_security.go b/x/ccv/provider/keeper/partial_set_security.go index 70e2e2efef..ce024453d7 100644 --- a/x/ccv/provider/keeper/partial_set_security.go +++ b/x/ccv/provider/keeper/partial_set_security.go @@ -256,7 +256,7 @@ func (k Keeper) CapValidatorsPower( func sum(validators []types.ConsensusValidator) int64 { s := int64(0) for _, v := range validators { - s = s + v.Power + s += v.Power } return s } @@ -313,7 +313,7 @@ func NoMoreThanPercentOfTheSum(validators []types.ConsensusValidator, percent ui validatorsWithPowerLessThanMaxPower := 0 for _, v := range validators { if v.Power >= maxPower { - remainingPower = remainingPower + (v.Power - maxPower) + remainingPower += (v.Power - maxPower) } else { validatorsWithPowerLessThanMaxPower++ } @@ -335,12 +335,12 @@ func NoMoreThanPercentOfTheSum(validators []types.ConsensusValidator, percent ui } else if v.Power+powerPerValidator >= maxPower { updatedValidators[i] = validators[i] updatedValidators[i].Power = maxPower - remainingPower = remainingPower - (maxPower - v.Power) + remainingPower -= (maxPower - v.Power) remainingValidators-- } else { updatedValidators[i] = validators[i] updatedValidators[i].Power = v.Power + powerPerValidator - remainingPower = remainingPower - (updatedValidators[i].Power - validators[i].Power) + remainingPower -= (updatedValidators[i].Power - validators[i].Power) remainingValidators-- } if remainingValidators == 0 { diff --git a/x/ccv/provider/keeper/partial_set_security_test.go b/x/ccv/provider/keeper/partial_set_security_test.go index e6a3199038..c344a01ee1 100644 --- a/x/ccv/provider/keeper/partial_set_security_test.go +++ b/x/ccv/provider/keeper/partial_set_security_test.go @@ -3,17 +3,16 @@ package keeper_test import ( "bytes" "fmt" + gomath "math" "sort" "testing" - gomath "math" - - "cosmossdk.io/math" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" "pgregory.net/rapid" + "cosmossdk.io/math" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" sdk "github.com/cosmos/cosmos-sdk/types" @@ -40,12 +39,12 @@ func TestHandleOptIn(t *testing.T) { providerKeeper.SetConsumerPhase(ctx, "stoppedConsumerId", types.CONSUMER_PHASE_STOPPED) require.Error(t, providerKeeper.HandleOptIn(ctx, "stoppedConsumerId", providerAddr, "")) - providerKeeper.SetConsumerPhase(ctx, "consumerId", types.CONSUMER_PHASE_INITIALIZED) - providerKeeper.SetConsumerChainId(ctx, "consumerId", "chainId") - require.False(t, providerKeeper.IsOptedIn(ctx, "consumerId", providerAddr)) - err := providerKeeper.HandleOptIn(ctx, "consumerId", providerAddr, "") + providerKeeper.SetConsumerPhase(ctx, CONSUMER_ID, types.CONSUMER_PHASE_INITIALIZED) + providerKeeper.SetConsumerChainId(ctx, CONSUMER_ID, "chainId") + require.False(t, providerKeeper.IsOptedIn(ctx, CONSUMER_ID, providerAddr)) + err := providerKeeper.HandleOptIn(ctx, CONSUMER_ID, providerAddr, "") require.NoError(t, err) - require.True(t, providerKeeper.IsOptedIn(ctx, "consumerId", providerAddr)) + require.True(t, providerKeeper.IsOptedIn(ctx, CONSUMER_ID, 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 @@ -88,19 +87,19 @@ func TestHandleOptInWithConsumerKey(t *testing.T) { expectedConsumerPubKey, err := providerKeeper.ParseConsumerKey(consumerKey) require.NoError(t, err) - providerKeeper.SetConsumerPhase(ctx, "consumerId", types.CONSUMER_PHASE_INITIALIZED) - providerKeeper.SetConsumerChainId(ctx, "consumerId", "consumerId") - err = providerKeeper.HandleOptIn(ctx, "consumerId", providerAddr, consumerKey) + providerKeeper.SetConsumerPhase(ctx, CONSUMER_ID, types.CONSUMER_PHASE_INITIALIZED) + providerKeeper.SetConsumerChainId(ctx, CONSUMER_ID, CONSUMER_CHAIN_ID) + err = providerKeeper.HandleOptIn(ctx, CONSUMER_ID, providerAddr, consumerKey) require.NoError(t, err) // assert that the consumeKey was assigned to `providerAddr` validator on chain with `consumerId` - actualConsumerPubKey, found := providerKeeper.GetValidatorConsumerPubKey(ctx, "consumerId", providerAddr) + actualConsumerPubKey, found := providerKeeper.GetValidatorConsumerPubKey(ctx, CONSUMER_ID, 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, "consumerId", types.NewConsumerConsAddress(consumerAddr)) + actualProviderConsAddr, found := providerKeeper.GetValidatorByConsumerAddr(ctx, CONSUMER_ID, types.NewConsumerConsAddress(consumerAddr)) require.True(t, found) require.Equal(t, providerAddr, actualProviderConsAddr) } @@ -109,7 +108,7 @@ func TestHandleOptOut(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - consumerId := "consumerId" + consumerId := CONSUMER_ID providerAddr := types.NewProviderConsAddress([]byte("providerAddr")) @@ -135,7 +134,7 @@ func TestHandleOptOutFromTopNChain(t *testing.T) { providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - consumerId := "consumerId" + consumerId := CONSUMER_ID // set the phase providerKeeper.SetConsumerPhase(ctx, consumerId, types.CONSUMER_PHASE_LAUNCHED) @@ -260,14 +259,14 @@ func TestOptInTopNValidators(t *testing.T) { valDConsAddr, _ := valD.GetConsAddr() // Start Test 1: opt in all validators with power >= 0 - providerKeeper.OptInTopNValidators(ctx, "consumerId", []stakingtypes.Validator{valA, valB, valC, valD}, 0) + providerKeeper.OptInTopNValidators(ctx, CONSUMER_ID, []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, "consumerId") + actualOptedInValidators := providerKeeper.GetAllOptedIn(ctx, CONSUMER_ID) // sort validators first to be able to compare sortUpdates := func(addresses []types.ProviderConsAddress) { @@ -281,31 +280,31 @@ func TestOptInTopNValidators(t *testing.T) { require.Equal(t, expectedOptedInValidators, actualOptedInValidators) // reset state for the upcoming checks - 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)) + providerKeeper.DeleteOptedIn(ctx, CONSUMER_ID, types.NewProviderConsAddress(valAConsAddr)) + providerKeeper.DeleteOptedIn(ctx, CONSUMER_ID, types.NewProviderConsAddress(valBConsAddr)) + providerKeeper.DeleteOptedIn(ctx, CONSUMER_ID, types.NewProviderConsAddress(valCConsAddr)) + providerKeeper.DeleteOptedIn(ctx, CONSUMER_ID, 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, "consumerId", []stakingtypes.Validator{valA, valB, valC, valD}, 0) - actualOptedInValidators = providerKeeper.GetAllOptedIn(ctx, "consumerId") + providerKeeper.OptInTopNValidators(ctx, CONSUMER_ID, []stakingtypes.Validator{valA, valB, valC, valD}, 0) + actualOptedInValidators = providerKeeper.GetAllOptedIn(ctx, CONSUMER_ID) sortUpdates(actualOptedInValidators) require.Equal(t, expectedOptedInValidators, actualOptedInValidators) - 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)) + providerKeeper.DeleteOptedIn(ctx, CONSUMER_ID, types.NewProviderConsAddress(valAConsAddr)) + providerKeeper.DeleteOptedIn(ctx, CONSUMER_ID, types.NewProviderConsAddress(valBConsAddr)) + providerKeeper.DeleteOptedIn(ctx, CONSUMER_ID, types.NewProviderConsAddress(valCConsAddr)) + providerKeeper.DeleteOptedIn(ctx, CONSUMER_ID, 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, "consumerId", []stakingtypes.Validator{valA, valB, valC, valD}, 2) + providerKeeper.OptInTopNValidators(ctx, CONSUMER_ID, []stakingtypes.Validator{valA, valB, valC, valD}, 2) expectedOptedInValidators = []types.ProviderConsAddress{ types.NewProviderConsAddress(valBConsAddr), types.NewProviderConsAddress(valCConsAddr), } - actualOptedInValidators = providerKeeper.GetAllOptedIn(ctx, "consumerId") + actualOptedInValidators = providerKeeper.GetAllOptedIn(ctx, CONSUMER_ID) // sort validators first to be able to compare sortUpdates(expectedOptedInValidators) @@ -313,14 +312,14 @@ func TestOptInTopNValidators(t *testing.T) { require.Equal(t, expectedOptedInValidators, actualOptedInValidators) // reset state for the upcoming checks - 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)) + providerKeeper.DeleteOptedIn(ctx, CONSUMER_ID, types.NewProviderConsAddress(valAConsAddr)) + providerKeeper.DeleteOptedIn(ctx, CONSUMER_ID, types.NewProviderConsAddress(valBConsAddr)) + providerKeeper.DeleteOptedIn(ctx, CONSUMER_ID, types.NewProviderConsAddress(valCConsAddr)) + providerKeeper.DeleteOptedIn(ctx, CONSUMER_ID, 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, "consumerId", []stakingtypes.Validator{valA, valB, valC, valD}, 4) - require.Empty(t, providerKeeper.GetAllOptedIn(ctx, "consumerId")) + providerKeeper.OptInTopNValidators(ctx, CONSUMER_ID, []stakingtypes.Validator{valA, valB, valC, valD}, 4) + require.Empty(t, providerKeeper.GetAllOptedIn(ctx, CONSUMER_ID)) } func TestComputeMinPowerInTopN(t *testing.T) { @@ -468,52 +467,52 @@ func TestCapValidatorSet(t *testing.T) { } validators := []types.ConsensusValidator{validatorA, validatorB, validatorC} - powerShapingParameters, err := providerKeeper.GetConsumerPowerShapingParameters(ctx, "consumerId") + powerShapingParameters, err := providerKeeper.GetConsumerPowerShapingParameters(ctx, CONSUMER_ID) require.Error(t, err) consumerValidators := providerKeeper.CapValidatorSet(ctx, powerShapingParameters, validators) require.Equal(t, validators, consumerValidators) - err = providerKeeper.SetConsumerPowerShapingParameters(ctx, "consumerId", types.PowerShapingParameters{ + err = providerKeeper.SetConsumerPowerShapingParameters(ctx, CONSUMER_ID, types.PowerShapingParameters{ ValidatorSetCap: 0, }) require.NoError(t, err) - powerShapingParameters, err = providerKeeper.GetConsumerPowerShapingParameters(ctx, "consumerId") + powerShapingParameters, err = providerKeeper.GetConsumerPowerShapingParameters(ctx, CONSUMER_ID) require.NoError(t, err) consumerValidators = providerKeeper.CapValidatorSet(ctx, powerShapingParameters, validators) require.Equal(t, validators, consumerValidators) - err = providerKeeper.SetConsumerPowerShapingParameters(ctx, "consumerId", types.PowerShapingParameters{ + err = providerKeeper.SetConsumerPowerShapingParameters(ctx, CONSUMER_ID, types.PowerShapingParameters{ ValidatorSetCap: 100, }) require.NoError(t, err) - powerShapingParameters, err = providerKeeper.GetConsumerPowerShapingParameters(ctx, "consumerId") + powerShapingParameters, err = providerKeeper.GetConsumerPowerShapingParameters(ctx, CONSUMER_ID) require.NoError(t, err) consumerValidators = providerKeeper.CapValidatorSet(ctx, powerShapingParameters, validators) require.Equal(t, validators, consumerValidators) - err = providerKeeper.SetConsumerPowerShapingParameters(ctx, "consumerId", types.PowerShapingParameters{ + err = providerKeeper.SetConsumerPowerShapingParameters(ctx, CONSUMER_ID, types.PowerShapingParameters{ ValidatorSetCap: 1, }) require.NoError(t, err) - powerShapingParameters, err = providerKeeper.GetConsumerPowerShapingParameters(ctx, "consumerId") + powerShapingParameters, err = providerKeeper.GetConsumerPowerShapingParameters(ctx, CONSUMER_ID) require.NoError(t, err) consumerValidators = providerKeeper.CapValidatorSet(ctx, powerShapingParameters, validators) require.Equal(t, []types.ConsensusValidator{validatorC}, consumerValidators) - err = providerKeeper.SetConsumerPowerShapingParameters(ctx, "consumerId", types.PowerShapingParameters{ + err = providerKeeper.SetConsumerPowerShapingParameters(ctx, CONSUMER_ID, types.PowerShapingParameters{ ValidatorSetCap: 2, }) require.NoError(t, err) - powerShapingParameters, err = providerKeeper.GetConsumerPowerShapingParameters(ctx, "consumerId") + powerShapingParameters, err = providerKeeper.GetConsumerPowerShapingParameters(ctx, CONSUMER_ID) require.NoError(t, err) consumerValidators = providerKeeper.CapValidatorSet(ctx, powerShapingParameters, validators) require.Equal(t, []types.ConsensusValidator{validatorC, validatorB}, consumerValidators) - err = providerKeeper.SetConsumerPowerShapingParameters(ctx, "consumerId", types.PowerShapingParameters{ + err = providerKeeper.SetConsumerPowerShapingParameters(ctx, CONSUMER_ID, types.PowerShapingParameters{ ValidatorSetCap: 3, }) require.NoError(t, err) - powerShapingParameters, err = providerKeeper.GetConsumerPowerShapingParameters(ctx, "consumerId") + powerShapingParameters, err = providerKeeper.GetConsumerPowerShapingParameters(ctx, CONSUMER_ID) require.NoError(t, err) consumerValidators = providerKeeper.CapValidatorSet(ctx, powerShapingParameters, validators) require.Equal(t, []types.ConsensusValidator{validatorC, validatorB, validatorA}, consumerValidators) @@ -563,18 +562,18 @@ func TestCapValidatorsPower(t *testing.T) { } // no capping takes place because validators power-cap is not set - powerShapingParameters, err := providerKeeper.GetConsumerPowerShapingParameters(ctx, "consumerId") + powerShapingParameters, err := providerKeeper.GetConsumerPowerShapingParameters(ctx, CONSUMER_ID) require.Error(t, err) cappedValidators := providerKeeper.CapValidatorsPower(ctx, powerShapingParameters.ValidatorsPowerCap, validators) sortValidators(validators) sortValidators(cappedValidators) require.Equal(t, validators, cappedValidators) - err = providerKeeper.SetConsumerPowerShapingParameters(ctx, "consumerId", types.PowerShapingParameters{ + err = providerKeeper.SetConsumerPowerShapingParameters(ctx, CONSUMER_ID, types.PowerShapingParameters{ ValidatorsPowerCap: 33, }) require.NoError(t, err) - powerShapingParameters, err = providerKeeper.GetConsumerPowerShapingParameters(ctx, "consumerId") + powerShapingParameters, err = providerKeeper.GetConsumerPowerShapingParameters(ctx, CONSUMER_ID) require.NoError(t, err) cappedValidators = providerKeeper.CapValidatorsPower(ctx, powerShapingParameters.ValidatorsPowerCap, validators) sortValidators(expectedValidators) @@ -634,7 +633,7 @@ func createConsumerValidators(powers []int64) []types.ConsensusValidator { func noMoreThanPercent(validators []types.ConsensusValidator, percent uint32) bool { sum := int64(0) for _, v := range validators { - sum = sum + v.Power + sum += v.Power } for _, v := range validators { @@ -764,17 +763,19 @@ func TestNoMoreThanPercentOfTheSumProps(t *testing.T) { } func findConsumerValidator(t *testing.T, v types.ConsensusValidator, valsAfter []types.ConsensusValidator) *types.ConsensusValidator { - var vAfter *types.ConsensusValidator - for _, vA := range valsAfter { + t.Helper() + + index := -1 + for i, vA := range valsAfter { if bytes.Equal(v.ProviderConsAddr, vA.ProviderConsAddr) { - vAfter = &vA + index = i break } } - if vAfter == nil { + if index == -1 { t.Fatalf("could not find validator with address %v in validators after \n validators after capping: %v", v.ProviderConsAddr, valsAfter) } - return vAfter + return &valsAfter[index] } func createStakingValidatorsAndMocks(ctx sdk.Context, mocks testkeeper.MockedKeepers, powers ...int64) ([]stakingtypes.Validator, []types.ProviderConsAddress) { @@ -856,7 +857,7 @@ func TestIfInactiveValsDisallowedProperty(t *testing.T) { // opt the validators in for _, valAddr := range consAddrs { - providerKeeper.SetOptedIn(ctx, "consumerId", valAddr) + providerKeeper.SetOptedIn(ctx, CONSUMER_ID, valAddr) } // Randomly choose values for parameters @@ -866,7 +867,7 @@ func TestIfInactiveValsDisallowedProperty(t *testing.T) { // Set up the parameters in the provider keeper // do not allow inactive validators - err := providerKeeper.SetConsumerPowerShapingParameters(ctx, "consumerId", types.PowerShapingParameters{ + err := providerKeeper.SetConsumerPowerShapingParameters(ctx, CONSUMER_ID, types.PowerShapingParameters{ MinStake: minStake, AllowInactiveVals: false, }) @@ -875,11 +876,11 @@ func TestIfInactiveValsDisallowedProperty(t *testing.T) { params.MaxProviderConsensusValidators = int64(maxProviderConsensusVals) providerKeeper.SetParams(ctx, params) - powerShapingParameters, err := providerKeeper.GetConsumerPowerShapingParameters(ctx, "consumerId") + powerShapingParameters, err := providerKeeper.GetConsumerPowerShapingParameters(ctx, CONSUMER_ID) require.NoError(t, err) // Compute the next validators - nextVals := providerKeeper.ComputeNextValidators(ctx, "consumerId", vals, powerShapingParameters, 0) + nextVals := providerKeeper.ComputeNextValidators(ctx, CONSUMER_ID, vals, powerShapingParameters, 0) // 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 index 8e8c53668a..ee4272be1f 100644 --- a/x/ccv/provider/keeper/permissionless.go +++ b/x/ccv/provider/keeper/permissionless.go @@ -6,6 +6,7 @@ import ( "strconv" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) @@ -48,7 +49,7 @@ func (k Keeper) GetConsumerChainId(ctx sdk.Context, consumerId string) (string, } // SetConsumerChainId sets the chain id associated with this consumer id -func (k Keeper) SetConsumerChainId(ctx sdk.Context, consumerId string, chainId string) { +func (k Keeper) SetConsumerChainId(ctx sdk.Context, consumerId, chainId string) { store := ctx.KVStore(k.storeKey) store.Set(types.ConsumerIdToChainIdKey(consumerId), []byte(chainId)) } @@ -70,7 +71,7 @@ func (k Keeper) GetConsumerOwnerAddress(ctx sdk.Context, consumerId string) (str } // SetConsumerOwnerAddress sets the chain id associated with this consumer id -func (k Keeper) SetConsumerOwnerAddress(ctx sdk.Context, consumerId string, chainId string) { +func (k Keeper) SetConsumerOwnerAddress(ctx sdk.Context, consumerId, chainId string) { store := ctx.KVStore(k.storeKey) store.Set(types.ConsumerIdToOwnerAddressKey(consumerId), []byte(chainId)) } @@ -230,7 +231,7 @@ func (k Keeper) RemoveOptedInConsumerId(ctx sdk.Context, providerAddr types.Prov // find the index of the consumer we want to remove index := -1 - for i := 0; i < len(consumers.Ids); i = i + 1 { + for i := 0; i < len(consumers.Ids); i++ { if consumers.Ids[i] == consumerId { index = i break diff --git a/x/ccv/provider/keeper/permissionless_test.go b/x/ccv/provider/keeper/permissionless_test.go index 2f80e52312..195fdfa405 100644 --- a/x/ccv/provider/keeper/permissionless_test.go +++ b/x/ccv/provider/keeper/permissionless_test.go @@ -5,9 +5,10 @@ import ( "time" "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + "github.com/stretchr/testify/require" + testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" - "github.com/stretchr/testify/require" ) // TestConsumerId tests setters and getters of consumer id (i.e., `FetchAndIncrementConsumerId` and `GetConsumerId`) @@ -69,8 +70,8 @@ func TestConsumerOwnerAddress(t *testing.T) { _, err := providerKeeper.GetConsumerOwnerAddress(ctx, "ownerAddress") require.Error(t, err, "failed to retrieve owner address") - providerKeeper.SetConsumerOwnerAddress(ctx, "consumerId", "owner address") - ownerAddress, err := providerKeeper.GetConsumerOwnerAddress(ctx, "consumerId") + providerKeeper.SetConsumerOwnerAddress(ctx, CONSUMER_ID, "owner address") + ownerAddress, err := providerKeeper.GetConsumerOwnerAddress(ctx, CONSUMER_ID) require.NoError(t, err) require.Equal(t, "owner address", ownerAddress) @@ -81,13 +82,13 @@ func TestConsumerOwnerAddress(t *testing.T) { require.Equal(t, "owner address", ownerAddress) // assert that overwriting the current key works - providerKeeper.SetConsumerOwnerAddress(ctx, "consumerId", "owner address2") - ownerAddress, err = providerKeeper.GetConsumerOwnerAddress(ctx, "consumerId") + providerKeeper.SetConsumerOwnerAddress(ctx, CONSUMER_ID, "owner address2") + ownerAddress, err = providerKeeper.GetConsumerOwnerAddress(ctx, CONSUMER_ID) require.NoError(t, err) require.Equal(t, "owner address2", ownerAddress) - providerKeeper.DeleteConsumerOwnerAddress(ctx, "consumerId") - _, err = providerKeeper.GetConsumerChainId(ctx, "consumerId") + providerKeeper.DeleteConsumerOwnerAddress(ctx, CONSUMER_ID) + _, err = providerKeeper.GetConsumerChainId(ctx, CONSUMER_ID) require.Error(t, err, "failed to retrieve owner address") } @@ -96,17 +97,17 @@ func TestConsumerMetadata(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - _, err := providerKeeper.GetConsumerMetadata(ctx, "consumerId") + _, err := providerKeeper.GetConsumerMetadata(ctx, CONSUMER_ID) require.Error(t, err) expectedMetadata := providertypes.ConsumerMetadata{ Name: "name", Description: "description", Metadata: "metadata", - //ChainId: "chain_id", + // ChainId: "chain_id", } - providerKeeper.SetConsumerMetadata(ctx, "consumerId", expectedMetadata) - actualMetadata, err := providerKeeper.GetConsumerMetadata(ctx, "consumerId") + providerKeeper.SetConsumerMetadata(ctx, CONSUMER_ID, expectedMetadata) + actualMetadata, err := providerKeeper.GetConsumerMetadata(ctx, CONSUMER_ID) require.NoError(t, err) require.Equal(t, expectedMetadata, actualMetadata) @@ -115,15 +116,15 @@ func TestConsumerMetadata(t *testing.T) { Name: "name 2", Description: "description 2", Metadata: "metadata 2", - //ChainId: "chain_id2", + // ChainId: "chain_id2", } - providerKeeper.SetConsumerMetadata(ctx, "consumerId", expectedMetadata) - actualMetadata, err = providerKeeper.GetConsumerMetadata(ctx, "consumerId") + providerKeeper.SetConsumerMetadata(ctx, CONSUMER_ID, expectedMetadata) + actualMetadata, err = providerKeeper.GetConsumerMetadata(ctx, CONSUMER_ID) require.NoError(t, err) require.Equal(t, expectedMetadata, actualMetadata) - providerKeeper.DeleteConsumerMetadata(ctx, "consumerId") - actualMetadata, err = providerKeeper.GetConsumerMetadata(ctx, "consumerId") + providerKeeper.DeleteConsumerMetadata(ctx, CONSUMER_ID) + actualMetadata, err = providerKeeper.GetConsumerMetadata(ctx, CONSUMER_ID) require.Error(t, err) require.Equal(t, providertypes.ConsumerMetadata{}, actualMetadata) } @@ -133,7 +134,7 @@ func TestConsumerInitializationParameters(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - _, err := providerKeeper.GetConsumerInitializationParameters(ctx, "consumerId") + _, err := providerKeeper.GetConsumerInitializationParameters(ctx, CONSUMER_ID) require.Error(t, err) expectedInitializationParameters := providertypes.ConsumerInitializationParameters{ @@ -149,8 +150,8 @@ func TestConsumerInitializationParameters(t *testing.T) { HistoricalEntries: 456, DistributionTransmissionChannel: "distribution_transmission_channel", } - providerKeeper.SetConsumerInitializationParameters(ctx, "consumerId", expectedInitializationParameters) - actualInitializationParameters, err := providerKeeper.GetConsumerInitializationParameters(ctx, "consumerId") + providerKeeper.SetConsumerInitializationParameters(ctx, CONSUMER_ID, expectedInitializationParameters) + actualInitializationParameters, err := providerKeeper.GetConsumerInitializationParameters(ctx, CONSUMER_ID) require.NoError(t, err) require.Equal(t, expectedInitializationParameters, actualInitializationParameters) @@ -168,13 +169,13 @@ func TestConsumerInitializationParameters(t *testing.T) { HistoricalEntries: 789, DistributionTransmissionChannel: "distribution_transmission_channel2", } - providerKeeper.SetConsumerInitializationParameters(ctx, "consumerId", expectedInitializationParameters) - actualInitializationParameters, err = providerKeeper.GetConsumerInitializationParameters(ctx, "consumerId") + providerKeeper.SetConsumerInitializationParameters(ctx, CONSUMER_ID, expectedInitializationParameters) + actualInitializationParameters, err = providerKeeper.GetConsumerInitializationParameters(ctx, CONSUMER_ID) require.NoError(t, err) require.Equal(t, expectedInitializationParameters, actualInitializationParameters) - providerKeeper.DeleteConsumerInitializationParameters(ctx, "consumerId") - actualInitializationParameters, err = providerKeeper.GetConsumerInitializationParameters(ctx, "consumerId") + providerKeeper.DeleteConsumerInitializationParameters(ctx, CONSUMER_ID) + actualInitializationParameters, err = providerKeeper.GetConsumerInitializationParameters(ctx, CONSUMER_ID) require.Error(t, err) require.Equal(t, providertypes.ConsumerInitializationParameters{}, actualInitializationParameters) } @@ -184,15 +185,15 @@ func TestConsumerPhase(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - phase := providerKeeper.GetConsumerPhase(ctx, "consumerId") + phase := providerKeeper.GetConsumerPhase(ctx, CONSUMER_ID) require.Equal(t, providertypes.CONSUMER_PHASE_UNSPECIFIED, phase) - providerKeeper.SetConsumerPhase(ctx, "consumerId", providertypes.CONSUMER_PHASE_INITIALIZED) - phase = providerKeeper.GetConsumerPhase(ctx, "consumerId") + providerKeeper.SetConsumerPhase(ctx, CONSUMER_ID, providertypes.CONSUMER_PHASE_INITIALIZED) + phase = providerKeeper.GetConsumerPhase(ctx, CONSUMER_ID) require.Equal(t, providertypes.CONSUMER_PHASE_INITIALIZED, phase) - providerKeeper.SetConsumerPhase(ctx, "consumerId", providertypes.CONSUMER_PHASE_LAUNCHED) - phase = providerKeeper.GetConsumerPhase(ctx, "consumerId") + providerKeeper.SetConsumerPhase(ctx, CONSUMER_ID, providertypes.CONSUMER_PHASE_LAUNCHED) + phase = providerKeeper.GetConsumerPhase(ctx, CONSUMER_ID) require.Equal(t, providertypes.CONSUMER_PHASE_LAUNCHED, phase) } @@ -259,7 +260,7 @@ func TestIsValidatorOptedInToChain(t *testing.T) { _, found := providerKeeper.IsValidatorOptedInToChainId(ctx, providerAddr, chainId) require.False(t, found) - expectedConsumerId := "consumerId" + expectedConsumerId := CONSUMER_ID providerKeeper.SetConsumerChainId(ctx, expectedConsumerId, chainId) providerKeeper.SetOptedIn(ctx, expectedConsumerId, providerAddr) providerKeeper.AppendOptedInConsumerId(ctx, providerAddr, expectedConsumerId) diff --git a/x/ccv/provider/keeper/power_shaping.go b/x/ccv/provider/keeper/power_shaping.go index afb3d04d18..40aad77aa7 100644 --- a/x/ccv/provider/keeper/power_shaping.go +++ b/x/ccv/provider/keeper/power_shaping.go @@ -7,7 +7,9 @@ import ( errorsmod "cosmossdk.io/errors" storetypes "cosmossdk.io/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) @@ -262,7 +264,7 @@ func (k Keeper) DeleteMinimumPowerInTopN( } // 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 { +func (k Keeper) UpdateMinimumPowerInTopN(ctx sdk.Context, consumerId string, oldTopN, 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 { diff --git a/x/ccv/provider/keeper/power_shaping_test.go b/x/ccv/provider/keeper/power_shaping_test.go index 516c5c897f..faf72ce5a5 100644 --- a/x/ccv/provider/keeper/power_shaping_test.go +++ b/x/ccv/provider/keeper/power_shaping_test.go @@ -6,13 +6,15 @@ import ( "sort" "testing" + "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/v6/testutil/keeper" providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) // TestConsumerPowerShapingParameters tests the getter and setter of the consumer id to power-shaping parameters methods @@ -20,7 +22,7 @@ func TestConsumerPowerShapingParameters(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - consumerId := "consumerId" + consumerId := CONSUMER_ID consAddrs := []string{ "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk", "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6", @@ -93,27 +95,27 @@ func TestAllowlist(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - chainID := "consumerId" + consumerID := CONSUMER_ID // no validator was allowlisted and hence the allowlist is empty - require.True(t, providerKeeper.IsAllowlistEmpty(ctx, chainID)) + require.True(t, providerKeeper.IsAllowlistEmpty(ctx, consumerID)) providerAddr1 := providertypes.NewProviderConsAddress([]byte("providerAddr1")) - providerKeeper.SetAllowlist(ctx, chainID, providerAddr1) - require.True(t, providerKeeper.IsAllowlisted(ctx, chainID, providerAddr1)) + providerKeeper.SetAllowlist(ctx, consumerID, providerAddr1) + require.True(t, providerKeeper.IsAllowlisted(ctx, consumerID, providerAddr1)) // allowlist is not empty anymore - require.False(t, providerKeeper.IsAllowlistEmpty(ctx, chainID)) + require.False(t, providerKeeper.IsAllowlistEmpty(ctx, consumerID)) providerAddr2 := providertypes.NewProviderConsAddress([]byte("providerAddr2")) - providerKeeper.SetAllowlist(ctx, chainID, providerAddr2) - require.True(t, providerKeeper.IsAllowlisted(ctx, chainID, providerAddr2)) - require.False(t, providerKeeper.IsAllowlistEmpty(ctx, chainID)) - - providerKeeper.DeleteAllowlist(ctx, chainID) - require.False(t, providerKeeper.IsAllowlisted(ctx, chainID, providerAddr1)) - require.False(t, providerKeeper.IsAllowlisted(ctx, chainID, providerAddr2)) - require.True(t, providerKeeper.IsAllowlistEmpty(ctx, chainID)) + providerKeeper.SetAllowlist(ctx, consumerID, providerAddr2) + require.True(t, providerKeeper.IsAllowlisted(ctx, consumerID, providerAddr2)) + require.False(t, providerKeeper.IsAllowlistEmpty(ctx, consumerID)) + + providerKeeper.DeleteAllowlist(ctx, consumerID) + require.False(t, providerKeeper.IsAllowlisted(ctx, consumerID, providerAddr1)) + require.False(t, providerKeeper.IsAllowlisted(ctx, consumerID, providerAddr2)) + require.True(t, providerKeeper.IsAllowlistEmpty(ctx, consumerID)) } func TestUpdateAllowlist(t *testing.T) { @@ -131,7 +133,8 @@ func TestUpdateAllowlist(t *testing.T) { expectedAllowlist := []providertypes.ProviderConsAddress{ providertypes.NewProviderConsAddress(consAddr1), - providertypes.NewProviderConsAddress(consAddr2)} + providertypes.NewProviderConsAddress(consAddr2), + } require.Equal(t, expectedAllowlist, providerKeeper.GetAllowList(ctx, consumerId)) } @@ -140,27 +143,27 @@ func TestDenylist(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - chainID := "consumerId" + consumerID := CONSUMER_ID // no validator was denylisted and hence the denylist is empty - require.True(t, providerKeeper.IsDenylistEmpty(ctx, chainID)) + require.True(t, providerKeeper.IsDenylistEmpty(ctx, consumerID)) providerAddr1 := providertypes.NewProviderConsAddress([]byte("providerAddr1")) - providerKeeper.SetDenylist(ctx, chainID, providerAddr1) - require.True(t, providerKeeper.IsDenylisted(ctx, chainID, providerAddr1)) + providerKeeper.SetDenylist(ctx, consumerID, providerAddr1) + require.True(t, providerKeeper.IsDenylisted(ctx, consumerID, providerAddr1)) // denylist is not empty anymore - require.False(t, providerKeeper.IsDenylistEmpty(ctx, chainID)) + require.False(t, providerKeeper.IsDenylistEmpty(ctx, consumerID)) providerAddr2 := providertypes.NewProviderConsAddress([]byte("providerAddr2")) - providerKeeper.SetDenylist(ctx, chainID, providerAddr2) - require.True(t, providerKeeper.IsDenylisted(ctx, chainID, providerAddr2)) - require.False(t, providerKeeper.IsDenylistEmpty(ctx, chainID)) - - providerKeeper.DeleteDenylist(ctx, chainID) - require.False(t, providerKeeper.IsDenylisted(ctx, chainID, providerAddr1)) - require.False(t, providerKeeper.IsDenylisted(ctx, chainID, providerAddr2)) - require.True(t, providerKeeper.IsDenylistEmpty(ctx, chainID)) + providerKeeper.SetDenylist(ctx, consumerID, providerAddr2) + require.True(t, providerKeeper.IsDenylisted(ctx, consumerID, providerAddr2)) + require.False(t, providerKeeper.IsDenylistEmpty(ctx, consumerID)) + + providerKeeper.DeleteDenylist(ctx, consumerID) + require.False(t, providerKeeper.IsDenylisted(ctx, consumerID, providerAddr1)) + require.False(t, providerKeeper.IsDenylisted(ctx, consumerID, providerAddr2)) + require.True(t, providerKeeper.IsDenylistEmpty(ctx, consumerID)) } func TestUpdateDenylist(t *testing.T) { @@ -178,7 +181,8 @@ func TestUpdateDenylist(t *testing.T) { expectedDenylist := []providertypes.ProviderConsAddress{ providertypes.NewProviderConsAddress(consAddr1), - providertypes.NewProviderConsAddress(consAddr2)} + providertypes.NewProviderConsAddress(consAddr2), + } require.Equal(t, expectedDenylist, providerKeeper.GetDenyList(ctx, consumerId)) } @@ -211,19 +215,19 @@ func TestKeeperConsumerParams(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - chainID := "consumerId" + consumerID := CONSUMER_ID // Set initial value - tt.settingFunc(ctx, chainID, int64(tt.initialValue)) + tt.settingFunc(ctx, consumerID, tt.initialValue) // Retrieve and check initial value - actualValue := tt.getFunc(ctx, chainID) + actualValue := tt.getFunc(ctx, consumerID) require.EqualValues(t, tt.initialValue, actualValue) // Update value - tt.settingFunc(ctx, chainID, int64(tt.updatedValue)) + tt.settingFunc(ctx, consumerID, tt.updatedValue) // Retrieve and check updated value - newActualValue := tt.getFunc(ctx, chainID) + newActualValue := tt.getFunc(ctx, consumerID) require.EqualValues(t, tt.updatedValue, newActualValue) // Check non-existent consumer id @@ -231,17 +235,17 @@ func TestKeeperConsumerParams(t *testing.T) { require.Zero(t, res) // Delete value - tt.deleteFunc(ctx, chainID) + tt.deleteFunc(ctx, consumerID) // Check that value was deleted - res = tt.getFunc(ctx, chainID) + res = tt.getFunc(ctx, consumerID) require.Zero(t, res) // Try deleting again - tt.deleteFunc(ctx, chainID) + tt.deleteFunc(ctx, consumerID) // Check that the value is still deleted - res = tt.getFunc(ctx, chainID) + res = tt.getFunc(ctx, consumerID) require.Zero(t, res) }) } diff --git a/x/ccv/provider/keeper/provider_consensus.go b/x/ccv/provider/keeper/provider_consensus.go index c99c2deae2..7b9b9b446f 100644 --- a/x/ccv/provider/keeper/provider_consensus.go +++ b/x/ccv/provider/keeper/provider_consensus.go @@ -65,7 +65,7 @@ func (k Keeper) CreateProviderConsensusValidator(ctx sdk.Context, val stakingtyp if err != nil { return types.ConsensusValidator{}, fmt.Errorf("getting consensus address: %w", err) } - pubKey, err := val.TmConsPublicKey() + pubKey, err := val.CmtConsPublicKey() if err != nil { return types.ConsensusValidator{}, fmt.Errorf("getting consensus public key: %w", err) } diff --git a/x/ccv/provider/keeper/provider_consensus_test.go b/x/ccv/provider/keeper/provider_consensus_test.go index 17ae11a4cd..c7458cfca5 100644 --- a/x/ccv/provider/keeper/provider_consensus_test.go +++ b/x/ccv/provider/keeper/provider_consensus_test.go @@ -3,9 +3,11 @@ package keeper_test import ( "testing" + "github.com/stretchr/testify/require" + "cosmossdk.io/math" + "github.com/cometbft/cometbft/proto/tendermint/crypto" - "github.com/stretchr/testify/require" testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" diff --git a/x/ccv/provider/keeper/relay.go b/x/ccv/provider/keeper/relay.go index 00bf502a40..a1a639b275 100644 --- a/x/ccv/provider/keeper/relay.go +++ b/x/ccv/provider/keeper/relay.go @@ -134,7 +134,7 @@ func (k Keeper) BlocksUntilNextEpoch(ctx sdk.Context) int64 { if blocksSinceEpochStart == 0 { return 0 } else { - return int64(k.GetBlocksPerEpoch(ctx) - blocksSinceEpochStart) + return k.GetBlocksPerEpoch(ctx) - blocksSinceEpochStart } } diff --git a/x/ccv/provider/keeper/relay_test.go b/x/ccv/provider/keeper/relay_test.go index 21443e4595..3a6c1bc757 100644 --- a/x/ccv/provider/keeper/relay_test.go +++ b/x/ccv/provider/keeper/relay_test.go @@ -6,7 +6,6 @@ import ( "testing" "time" - "cosmossdk.io/math" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" @@ -14,6 +13,8 @@ import ( "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "cosmossdk.io/math" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -59,7 +60,7 @@ func TestQueueVSCPackets(t *testing.T) { }, } - chainID := "consumer" + chainID := CONSUMER_CHAIN_ID for _, tc := range testCases { keeperParams := testkeeper.NewInMemKeeperParams(t) @@ -101,7 +102,7 @@ func TestQueueVSCPacketsDoesNotResetConsumerValidatorsHeights(t *testing.T) { // mock 2 bonded validators valA := createStakingValidator(ctx, mocks, 1, 1) valAConsAddr, _ := valA.GetConsAddr() - valAPubKey, _ := valA.TmConsPublicKey() + valAPubKey, _ := valA.CmtConsPublicKey() mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, valAConsAddr).Return(valA, nil).AnyTimes() valB := createStakingValidator(ctx, mocks, 2, 2) valBConsAddr, _ := valB.GetConsAddr() @@ -109,38 +110,38 @@ func TestQueueVSCPacketsDoesNotResetConsumerValidatorsHeights(t *testing.T) { testkeeper.SetupMocksForLastBondedValidatorsExpectation(mocks.MockStakingKeeper, 2, []stakingtypes.Validator{valA, valB}, -1) // set a consumer client id and its phase, so we have a consumer chain (i.e., `GetAllConsumersWithIBCClients` is non-empty) - providerKeeper.SetConsumerClientId(ctx, "consumerId", "clientID") - providerKeeper.SetConsumerPhase(ctx, "consumerId", providertypes.CONSUMER_PHASE_LAUNCHED) + providerKeeper.SetConsumerClientId(ctx, CONSUMER_ID, "clientID") + providerKeeper.SetConsumerPhase(ctx, CONSUMER_ID, providertypes.CONSUMER_PHASE_LAUNCHED) // opt in validator A and set as a consumer validator - providerKeeper.SetOptedIn(ctx, "consumerId", providertypes.NewProviderConsAddress(valAConsAddr)) + providerKeeper.SetOptedIn(ctx, CONSUMER_ID, providertypes.NewProviderConsAddress(valAConsAddr)) consumerValidatorA := providertypes.ConsensusValidator{ ProviderConsAddr: valAConsAddr, Power: 1, PublicKey: &valAPubKey, JoinHeight: 123456789, } - err := providerKeeper.SetConsumerValidator(ctx, "consumerId", consumerValidatorA) + err := providerKeeper.SetConsumerValidator(ctx, CONSUMER_ID, consumerValidatorA) require.NoError(t, err) // 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, "consumerId", providertypes.NewProviderConsAddress(valBConsAddr)) + providerKeeper.SetOptedIn(ctx, CONSUMER_ID, providertypes.NewProviderConsAddress(valBConsAddr)) // set power shaping params - err = providerKeeper.SetConsumerPowerShapingParameters(ctx, "consumerId", providertypes.PowerShapingParameters{}) + err = providerKeeper.SetConsumerPowerShapingParameters(ctx, CONSUMER_ID, providertypes.PowerShapingParameters{}) require.NoError(t, err) err = providerKeeper.QueueVSCPackets(ctx) require.NoError(t, err) // the height of consumer validator A should not be modified because A was already a consumer validator - cv, _ := providerKeeper.GetConsumerValidator(ctx, "consumerId", providertypes.NewProviderConsAddress(valAConsAddr)) + cv, _ := providerKeeper.GetConsumerValidator(ctx, CONSUMER_ID, 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, "consumerId", providertypes.NewProviderConsAddress(valBConsAddr)) + cv, _ = providerKeeper.GetConsumerValidator(ctx, CONSUMER_ID, providertypes.NewProviderConsAddress(valBConsAddr)) require.Equal(t, chainHeight, cv.JoinHeight, "the consumer validator's height was not correctly set") } @@ -495,10 +496,10 @@ func TestSendVSCPacketsToChainFailure(t *testing.T) { providerKeeper.SetParams(ctx, providertypes.DefaultParams()) // Append mocks for full consumer setup - mockCalls := testkeeper.GetMocksForSetConsumerChain(ctx, &mocks, "consumerId") + mockCalls := testkeeper.GetMocksForSetConsumerChain(ctx, &mocks, CONSUMER_ID) // Set 3 pending vsc packets - providerKeeper.AppendPendingVSCPackets(ctx, "consumerId", []ccv.ValidatorSetChangePacketData{{}, {}, {}}...) + providerKeeper.AppendPendingVSCPackets(ctx, CONSUMER_ID, []ccv.ValidatorSetChangePacketData{{}, {}, {}}...) // append mocks for the channel keeper to return an error mockCalls = append(mockCalls, @@ -513,7 +514,7 @@ func TestSendVSCPacketsToChainFailure(t *testing.T) { gomock.InOrder(mockCalls...) // Execute setup - providerKeeper.SetConsumerClientId(ctx, "consumerId", "clientID") + providerKeeper.SetConsumerClientId(ctx, CONSUMER_ID, "clientID") err := providerKeeper.SetConsumerChain(ctx, "channelID") require.NoError(t, err) @@ -521,11 +522,11 @@ func TestSendVSCPacketsToChainFailure(t *testing.T) { mocks.MockStakingKeeper.EXPECT().UnbondingTime(gomock.Any()).Return(unbondingTime, nil).AnyTimes() // No error should occur, DeleteConsumerChain should be called - err = providerKeeper.SendVSCPacketsToChain(ctx, "consumerId", "CCVChannelID") + err = providerKeeper.SendVSCPacketsToChain(ctx, CONSUMER_ID, "CCVChannelID") require.NoError(t, err) // Verify the chain is about to be deleted - removalTime, err := providerKeeper.GetConsumerRemovalTime(ctx, "consumerId") + removalTime, err := providerKeeper.GetConsumerRemovalTime(ctx, CONSUMER_ID) require.NoError(t, err) require.Equal(t, ctx.BlockTime().Add(unbondingTime), removalTime) @@ -534,8 +535,8 @@ func TestSendVSCPacketsToChainFailure(t *testing.T) { providerKeeper.BeginBlockRemoveConsumers(ctx) // Pending VSC packets should be deleted in DeleteConsumerChain - require.Empty(t, providerKeeper.GetPendingVSCPackets(ctx, "consumerId")) - require.Equal(t, providertypes.CONSUMER_PHASE_DELETED, providerKeeper.GetConsumerPhase(ctx, "consumerId")) + require.Empty(t, providerKeeper.GetPendingVSCPackets(ctx, CONSUMER_ID)) + require.Equal(t, providertypes.CONSUMER_PHASE_DELETED, providerKeeper.GetConsumerPhase(ctx, CONSUMER_ID)) } // TestOnTimeoutPacketWithNoChainFound tests the `OnTimeoutPacket` method fails when no chain is found @@ -560,9 +561,10 @@ func TestOnTimeoutPacketStopsChain(t *testing.T) { defer ctrl.Finish() providerKeeper.SetParams(ctx, providertypes.DefaultParams()) - testkeeper.SetupForDeleteConsumerChain(t, ctx, &providerKeeper, mocks, "consumerId") + testkeeper.SetupForDeleteConsumerChain(t, ctx, &providerKeeper, mocks, CONSUMER_ID) mocks.MockChannelKeeper.EXPECT().GetChannel(gomock.Any(), ccv.ProviderPortID, "channelID").Return( - channeltypes.Channel{State: channeltypes.OPEN, + channeltypes.Channel{ + State: channeltypes.OPEN, ConnectionHops: []string{"connectionID"}, }, true, ).Times(1) @@ -583,7 +585,7 @@ func TestOnTimeoutPacketStopsChain(t *testing.T) { ctx = ctx.WithBlockTime(ctx.BlockTime().Add(unbondingTime)) providerKeeper.BeginBlockRemoveConsumers(ctx) - testkeeper.TestProviderStateIsCleanedAfterConsumerChainIsDeleted(t, ctx, providerKeeper, "consumerId", "channelID", false) + testkeeper.TestProviderStateIsCleanedAfterConsumerChainIsDeleted(t, ctx, providerKeeper, CONSUMER_ID, "channelID", false) } // TestOnAcknowledgementPacketWithNoAckError tests `OnAcknowledgementPacket` when the underlying ack contains no error @@ -611,7 +613,7 @@ 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.SetupForDeleteConsumerChain(t, ctx, &providerKeeper, mocks, "consumerId") + testkeeper.SetupForDeleteConsumerChain(t, ctx, &providerKeeper, mocks, CONSUMER_ID) packet := channeltypes.Packet{ SourceChannel: "channelID", } @@ -619,7 +621,8 @@ func TestOnAcknowledgementPacketWithAckError(t *testing.T) { unbondingTime := 123 * time.Second mocks.MockStakingKeeper.EXPECT().UnbondingTime(gomock.Any()).Return(unbondingTime, nil).AnyTimes() mocks.MockChannelKeeper.EXPECT().GetChannel(gomock.Any(), ccv.ProviderPortID, "channelID").Return( - channeltypes.Channel{State: channeltypes.OPEN, + channeltypes.Channel{ + State: channeltypes.OPEN, ConnectionHops: []string{"connectionID"}, }, true, ).Times(1) @@ -634,7 +637,7 @@ func TestOnAcknowledgementPacketWithAckError(t *testing.T) { ctx = ctx.WithBlockTime(ctx.BlockTime().Add(unbondingTime)) providerKeeper.BeginBlockRemoveConsumers(ctx) - testkeeper.TestProviderStateIsCleanedAfterConsumerChainIsDeleted(t, ctx, providerKeeper, "consumerId", "channelID", false) + testkeeper.TestProviderStateIsCleanedAfterConsumerChainIsDeleted(t, ctx, providerKeeper, CONSUMER_ID, "channelID", false) } // TestEndBlockVSU tests that during `EndBlockVSU`, we only queue VSC packets at the boundaries of an epoch @@ -644,7 +647,7 @@ func TestEndBlockVSU(t *testing.T) { consumerId := "0" - err := providerKeeper.SetConsumerPowerShapingParameters(ctx, "consumerId", providertypes.PowerShapingParameters{ + err := providerKeeper.SetConsumerPowerShapingParameters(ctx, CONSUMER_ID, providertypes.PowerShapingParameters{ Top_N: 100, }) require.NoError(t, err) @@ -783,44 +786,44 @@ func TestQueueVSCPacketsWithPowerCapping(t *testing.T) { valA := createStakingValidator(ctx, mocks, 1, 1) // 3.125% of the total voting power valAConsAddr, _ := valA.GetConsAddr() - valAPubKey, _ := valA.TmConsPublicKey() + valAPubKey, _ := valA.CmtConsPublicKey() mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, valAConsAddr).Return(valA, nil).AnyTimes() valB := createStakingValidator(ctx, mocks, 3, 2) // 9.375% of the total voting power valBConsAddr, _ := valB.GetConsAddr() - valBPubKey, _ := valB.TmConsPublicKey() + valBPubKey, _ := valB.CmtConsPublicKey() mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, valBConsAddr).Return(valB, nil).AnyTimes() valC := createStakingValidator(ctx, mocks, 4, 3) // 12.5% of the total voting power valCConsAddr, _ := valC.GetConsAddr() - valCPubKey, _ := valC.TmConsPublicKey() + valCPubKey, _ := valC.CmtConsPublicKey() mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, valCConsAddr).Return(valC, nil).AnyTimes() valD := createStakingValidator(ctx, mocks, 8, 4) // 25% of the total voting power valDConsAddr, _ := valD.GetConsAddr() mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, valDConsAddr).Return(valD, nil).AnyTimes() valE := createStakingValidator(ctx, mocks, 16, 5) // 50% of the total voting power valEConsAddr, _ := valE.GetConsAddr() - valEPubKey, _ := valE.TmConsPublicKey() + valEPubKey, _ := valE.CmtConsPublicKey() mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, valEConsAddr).Return(valE, nil).AnyTimes() testkeeper.SetupMocksForLastBondedValidatorsExpectation(mocks.MockStakingKeeper, 5, []stakingtypes.Validator{valA, valB, valC, valD, valE}, -1) // add a consumer chain - providerKeeper.SetConsumerClientId(ctx, "consumerId", "clientId") - providerKeeper.SetConsumerPhase(ctx, "consumerId", providertypes.CONSUMER_PHASE_LAUNCHED) + providerKeeper.SetConsumerClientId(ctx, CONSUMER_ID, "clientId") + providerKeeper.SetConsumerPhase(ctx, CONSUMER_ID, providertypes.CONSUMER_PHASE_LAUNCHED) - err := providerKeeper.SetConsumerPowerShapingParameters(ctx, "consumerId", providertypes.PowerShapingParameters{ + err := providerKeeper.SetConsumerPowerShapingParameters(ctx, CONSUMER_ID, providertypes.PowerShapingParameters{ Top_N: 50, // would opt in E ValidatorsPowerCap: 40, // set a power-capping of 40% }) require.NoError(t, err) // opt in all validators - 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)) + providerKeeper.SetOptedIn(ctx, CONSUMER_ID, providertypes.NewProviderConsAddress(valAConsAddr)) + providerKeeper.SetOptedIn(ctx, CONSUMER_ID, providertypes.NewProviderConsAddress(valBConsAddr)) + providerKeeper.SetOptedIn(ctx, CONSUMER_ID, providertypes.NewProviderConsAddress(valCConsAddr)) + providerKeeper.SetOptedIn(ctx, CONSUMER_ID, providertypes.NewProviderConsAddress(valDConsAddr)) // denylist validator D - providerKeeper.SetDenylist(ctx, "consumerId", providertypes.NewProviderConsAddress(valDConsAddr)) + providerKeeper.SetDenylist(ctx, CONSUMER_ID, providertypes.NewProviderConsAddress(valDConsAddr)) // set max provider consensus vals to include all validators params := providerKeeper.GetParams(ctx) @@ -830,7 +833,7 @@ func TestQueueVSCPacketsWithPowerCapping(t *testing.T) { err = providerKeeper.QueueVSCPackets(ctx) require.NoError(t, err) - actualQueuedVSCPackets := providerKeeper.GetPendingVSCPackets(ctx, "consumerId") + actualQueuedVSCPackets := providerKeeper.GetPendingVSCPackets(ctx, CONSUMER_ID) expectedQueuedVSCPackets := []ccv.ValidatorSetChangePacketData{ ccv.NewValidatorSetChangePacketData( []abci.ValidatorUpdate{ diff --git a/x/ccv/provider/keeper/staking_keeper_interface.go b/x/ccv/provider/keeper/staking_keeper_interface.go index 18fd49dc2f..aba82e9328 100644 --- a/x/ccv/provider/keeper/staking_keeper_interface.go +++ b/x/ccv/provider/keeper/staking_keeper_interface.go @@ -5,6 +5,7 @@ import ( "fmt" "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) diff --git a/x/ccv/provider/keeper/staking_keeper_interface_test.go b/x/ccv/provider/keeper/staking_keeper_interface_test.go index ab7c1681e3..4d3f52114a 100644 --- a/x/ccv/provider/keeper/staking_keeper_interface_test.go +++ b/x/ccv/provider/keeper/staking_keeper_interface_test.go @@ -4,12 +4,15 @@ import ( "sort" "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) // TestStakingKeeperInterface tests diff --git a/x/ccv/provider/keeper/validator_set_storage.go b/x/ccv/provider/keeper/validator_set_storage.go index 8ac7c80f2d..cf1d02dcae 100644 --- a/x/ccv/provider/keeper/validator_set_storage.go +++ b/x/ccv/provider/keeper/validator_set_storage.go @@ -5,6 +5,7 @@ import ( "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" diff --git a/x/ccv/provider/keeper/validator_set_update.go b/x/ccv/provider/keeper/validator_set_update.go index 8b9c314189..95e833da00 100644 --- a/x/ccv/provider/keeper/validator_set_update.go +++ b/x/ccv/provider/keeper/validator_set_update.go @@ -140,7 +140,7 @@ func (k Keeper) CreateConsumerValidator(ctx sdk.Context, consumerId string, vali consumerPublicKey, found := k.GetValidatorConsumerPubKey(ctx, consumerId, types.NewProviderConsAddress(consAddr)) if !found { - consumerPublicKey, err = validator.TmConsPublicKey() + consumerPublicKey, err = validator.CmtConsPublicKey() if err != nil { return types.ConsensusValidator{}, fmt.Errorf("could not retrieve validator's (%+v) public key: %w", validator, err) } diff --git a/x/ccv/provider/keeper/validator_set_update_test.go b/x/ccv/provider/keeper/validator_set_update_test.go index 19a7908933..1b939d08b5 100644 --- a/x/ccv/provider/keeper/validator_set_update_test.go +++ b/x/ccv/provider/keeper/validator_set_update_test.go @@ -32,12 +32,12 @@ func TestConsumerValidator(t *testing.T) { PublicKey: &crypto.PublicKey{}, } - require.False(t, providerKeeper.IsConsumerValidator(ctx, "consumerId", types.NewProviderConsAddress(validator.ProviderConsAddr))) - err := providerKeeper.SetConsumerValidator(ctx, "consumerId", validator) + require.False(t, providerKeeper.IsConsumerValidator(ctx, CONSUMER_ID, types.NewProviderConsAddress(validator.ProviderConsAddr))) + err := providerKeeper.SetConsumerValidator(ctx, CONSUMER_ID, validator) require.NoError(t, err) - 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))) + require.True(t, providerKeeper.IsConsumerValidator(ctx, CONSUMER_ID, types.NewProviderConsAddress(validator.ProviderConsAddr))) + providerKeeper.DeleteConsumerValidator(ctx, CONSUMER_ID, types.NewProviderConsAddress(validator.ProviderConsAddr)) + require.False(t, providerKeeper.IsConsumerValidator(ctx, CONSUMER_ID, types.NewProviderConsAddress(validator.ProviderConsAddr))) } func TestGetConsumerValSet(t *testing.T) { @@ -76,7 +76,7 @@ func TestGetConsumerValSet(t *testing.T) { } for _, expectedValidator := range expectedValidators { - err := providerKeeper.SetConsumerValidator(ctx, "consumerId", + err := providerKeeper.SetConsumerValidator(ctx, CONSUMER_ID, types.ConsensusValidator{ ProviderConsAddr: expectedValidator.ProviderConsAddr, Power: expectedValidator.Power, @@ -85,7 +85,7 @@ func TestGetConsumerValSet(t *testing.T) { require.NoError(t, err) } - actualValidators, err := providerKeeper.GetConsumerValSet(ctx, "consumerId") + actualValidators, err := providerKeeper.GetConsumerValSet(ctx, CONSUMER_ID) require.NoError(t, err) // sort validators first to be able to compare @@ -256,7 +256,7 @@ func TestSetConsumerValSet(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - chainID := "consumerId" + consumerID := CONSUMER_ID currentValidators := []types.ConsensusValidator{ { @@ -310,21 +310,21 @@ func TestSetConsumerValSet(t *testing.T) { } // set the `currentValidators` for chain `consumerId` - valSet, err := providerKeeper.GetConsumerValSet(ctx, chainID) + valSet, err := providerKeeper.GetConsumerValSet(ctx, consumerID) require.NoError(t, err) require.Empty(t, valSet) for _, validator := range currentValidators { - err := providerKeeper.SetConsumerValidator(ctx, chainID, validator) + err := providerKeeper.SetConsumerValidator(ctx, consumerID, validator) require.NoError(t, err) } - valSet, err = providerKeeper.GetConsumerValSet(ctx, chainID) + valSet, err = providerKeeper.GetConsumerValSet(ctx, consumerID) require.NoError(t, err) require.NotEmpty(t, valSet) - err = providerKeeper.SetConsumerValSet(ctx, chainID, nextValidators) + err = providerKeeper.SetConsumerValSet(ctx, consumerID, nextValidators) require.NoError(t, err) - nextCurrentValidators, err := providerKeeper.GetConsumerValSet(ctx, chainID) + nextCurrentValidators, err := providerKeeper.GetConsumerValSet(ctx, consumerID) require.NoError(t, err) // sort validators first to be able to compare @@ -343,11 +343,11 @@ func TestFilterValidatorsConsiderAll(t *testing.T) { providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - chainID := "consumerId" + consumerID := CONSUMER_ID // no consumer validators returned if we have no bonded validators considerAll := func(providerAddr types.ProviderConsAddress) bool { return true } - require.Empty(t, providerKeeper.FilterValidators(ctx, chainID, []stakingtypes.Validator{}, considerAll)) + require.Empty(t, providerKeeper.FilterValidators(ctx, consumerID, []stakingtypes.Validator{}, considerAll)) var expectedValidators []types.ConsensusValidator @@ -355,7 +355,7 @@ func TestFilterValidatorsConsiderAll(t *testing.T) { valA := createStakingValidator(ctx, mocks, 1, 1) // because validator A has no consumer key set, the `PublicKey` we expect is the key on the provider chain valAConsAddr, _ := valA.GetConsAddr() - valAPublicKey, _ := valA.TmConsPublicKey() + valAPublicKey, _ := valA.CmtConsPublicKey() expectedValidators = append(expectedValidators, types.ConsensusValidator{ ProviderConsAddr: types.NewProviderConsAddress(valAConsAddr).Address.Bytes(), Power: 1, @@ -367,7 +367,7 @@ func TestFilterValidatorsConsiderAll(t *testing.T) { // validator B has set a consumer key, the `PublicKey` we expect is the key set by `SetValidatorConsumerPubKey` valBConsumerKey := cryptotestutil.NewCryptoIdentityFromIntSeed(1).TMProtoCryptoPublicKey() valBConsAddr, _ := valB.GetConsAddr() - providerKeeper.SetValidatorConsumerPubKey(ctx, chainID, types.NewProviderConsAddress(valBConsAddr), valBConsumerKey) + providerKeeper.SetValidatorConsumerPubKey(ctx, consumerID, types.NewProviderConsAddress(valBConsAddr), valBConsumerKey) expectedValidators = append(expectedValidators, types.ConsensusValidator{ ProviderConsAddr: types.NewProviderConsAddress(valBConsAddr).Address.Bytes(), Power: 2, @@ -375,7 +375,7 @@ func TestFilterValidatorsConsiderAll(t *testing.T) { }) bondedValidators := []stakingtypes.Validator{valA, valB} - actualValidators := providerKeeper.FilterValidators(ctx, chainID, bondedValidators, considerAll) + actualValidators := providerKeeper.FilterValidators(ctx, consumerID, bondedValidators, considerAll) require.Equal(t, expectedValidators, actualValidators) } @@ -383,12 +383,12 @@ func TestFilterValidatorsConsiderOnlyOptIn(t *testing.T) { providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - chainID := "consumerId" + consumerID := CONSUMER_ID // no consumer validators returned if we have no opted-in validators - require.Empty(t, providerKeeper.FilterValidators(ctx, chainID, []stakingtypes.Validator{}, + require.Empty(t, providerKeeper.FilterValidators(ctx, consumerID, []stakingtypes.Validator{}, func(providerAddr types.ProviderConsAddress) bool { - return providerKeeper.IsOptedIn(ctx, chainID, providerAddr) + return providerKeeper.IsOptedIn(ctx, consumerID, providerAddr) })) var expectedValidators []types.ConsensusValidator @@ -397,7 +397,7 @@ func TestFilterValidatorsConsiderOnlyOptIn(t *testing.T) { valA := createStakingValidator(ctx, mocks, 1, 1) // because validator A has no consumer key set, the `PublicKey` we expect is the key on the provider chain valAConsAddr, _ := valA.GetConsAddr() - valAPublicKey, _ := valA.TmConsPublicKey() + valAPublicKey, _ := valA.CmtConsPublicKey() expectedValAConsumerValidator := types.ConsensusValidator{ ProviderConsAddr: types.NewProviderConsAddress(valAConsAddr).Address.Bytes(), Power: 1, @@ -410,7 +410,7 @@ func TestFilterValidatorsConsiderOnlyOptIn(t *testing.T) { // validator B has set a consumer key, the `PublicKey` we expect is the key set by `SetValidatorConsumerPubKey` valBConsumerKey := cryptotestutil.NewCryptoIdentityFromIntSeed(1).TMProtoCryptoPublicKey() valBConsAddr, _ := valB.GetConsAddr() - providerKeeper.SetValidatorConsumerPubKey(ctx, chainID, types.NewProviderConsAddress(valBConsAddr), valBConsumerKey) + providerKeeper.SetValidatorConsumerPubKey(ctx, consumerID, types.NewProviderConsAddress(valBConsAddr), valBConsumerKey) expectedValBConsumerValidator := types.ConsensusValidator{ ProviderConsAddr: types.NewProviderConsAddress(valBConsAddr).Address.Bytes(), Power: 2, @@ -419,14 +419,14 @@ func TestFilterValidatorsConsiderOnlyOptIn(t *testing.T) { expectedValidators = append(expectedValidators, expectedValBConsumerValidator) // opt in validators A and B with 0 power and no consumer public keys - providerKeeper.SetOptedIn(ctx, chainID, types.NewProviderConsAddress(valAConsAddr)) - providerKeeper.SetOptedIn(ctx, chainID, types.NewProviderConsAddress(valBConsAddr)) + providerKeeper.SetOptedIn(ctx, consumerID, types.NewProviderConsAddress(valAConsAddr)) + providerKeeper.SetOptedIn(ctx, consumerID, types.NewProviderConsAddress(valBConsAddr)) // 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, "consumerId", bondedValidators, + actualValidators := providerKeeper.FilterValidators(ctx, consumerID, bondedValidators, func(providerAddr types.ProviderConsAddress) bool { - return providerKeeper.IsOptedIn(ctx, chainID, providerAddr) + return providerKeeper.IsOptedIn(ctx, consumerID, providerAddr) }) // sort validators first to be able to compare @@ -443,9 +443,9 @@ 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) bondedValidators = []stakingtypes.Validator{valA, valB, valC} - actualValidators = providerKeeper.FilterValidators(ctx, "consumerId", bondedValidators, + actualValidators = providerKeeper.FilterValidators(ctx, consumerID, bondedValidators, func(providerAddr types.ProviderConsAddress) bool { - return providerKeeper.IsOptedIn(ctx, chainID, providerAddr) + return providerKeeper.IsOptedIn(ctx, consumerID, providerAddr) }) sortValidators(actualValidators) @@ -457,15 +457,15 @@ func TestCreateConsumerValidator(t *testing.T) { providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - chainID := "consumerId" + consumerID := CONSUMER_ID // create a validator which has set a consumer public key valA := createStakingValidator(ctx, mocks, 1, 1) valAConsumerKey := cryptotestutil.NewCryptoIdentityFromIntSeed(1).TMProtoCryptoPublicKey() valAConsAddr, _ := valA.GetConsAddr() valAProviderConsAddr := types.NewProviderConsAddress(valAConsAddr) - providerKeeper.SetValidatorConsumerPubKey(ctx, chainID, valAProviderConsAddr, valAConsumerKey) - actualConsumerValidatorA, err := providerKeeper.CreateConsumerValidator(ctx, chainID, valA) + providerKeeper.SetValidatorConsumerPubKey(ctx, consumerID, valAProviderConsAddr, valAConsumerKey) + actualConsumerValidatorA, err := providerKeeper.CreateConsumerValidator(ctx, consumerID, valA) expectedConsumerValidatorA := types.ConsensusValidator{ ProviderConsAddr: valAProviderConsAddr.ToSdkConsAddr(), Power: 1, @@ -478,8 +478,8 @@ func TestCreateConsumerValidator(t *testing.T) { valB := createStakingValidator(ctx, mocks, 2, 2) valBConsAddr, _ := valB.GetConsAddr() valBProviderConsAddr := types.NewProviderConsAddress(valBConsAddr) - valBPublicKey, _ := valB.TmConsPublicKey() - actualConsumerValidatorB, err := providerKeeper.CreateConsumerValidator(ctx, chainID, valB) + valBPublicKey, _ := valB.CmtConsPublicKey() + actualConsumerValidatorB, err := providerKeeper.CreateConsumerValidator(ctx, consumerID, valB) expectedConsumerValidatorB := types.ConsensusValidator{ ProviderConsAddr: valBProviderConsAddr.ToSdkConsAddr(), Power: 2, diff --git a/x/ccv/provider/migrations/migrator.go b/x/ccv/provider/migrations/migrator.go index 9d17d27a06..6f5a11f1d3 100644 --- a/x/ccv/provider/migrations/migrator.go +++ b/x/ccv/provider/migrations/migrator.go @@ -4,6 +4,7 @@ import ( "fmt" storetypes "cosmossdk.io/store/types" + sdktypes "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" diff --git a/x/ccv/provider/migrations/v7/legacy_params.go b/x/ccv/provider/migrations/v7/legacy_params.go index 831eba7f17..2bb09629d6 100644 --- a/x/ccv/provider/migrations/v7/legacy_params.go +++ b/x/ccv/provider/migrations/v7/legacy_params.go @@ -3,10 +3,11 @@ package v7 import ( "time" - sdk "github.com/cosmos/cosmos-sdk/types" ibctmtypes "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" - "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) diff --git a/x/ccv/provider/migrations/v7/migrations.go b/x/ccv/provider/migrations/v7/migrations.go index b8947624f7..371d6784d9 100644 --- a/x/ccv/provider/migrations/v7/migrations.go +++ b/x/ccv/provider/migrations/v7/migrations.go @@ -2,6 +2,7 @@ package v7 import ( sdk "github.com/cosmos/cosmos-sdk/types" + providerkeeper "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) diff --git a/x/ccv/provider/migrations/v7/migrations_test.go b/x/ccv/provider/migrations/v7/migrations_test.go index 0d8ed4542f..d49bc67d68 100644 --- a/x/ccv/provider/migrations/v7/migrations_test.go +++ b/x/ccv/provider/migrations/v7/migrations_test.go @@ -3,10 +3,11 @@ package v7 import ( "testing" + "github.com/stretchr/testify/require" + testutil "github.com/cosmos/interchain-security/v6/testutil/keeper" providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" - "github.com/stretchr/testify/require" ) func TestMigrateParams(t *testing.T) { diff --git a/x/ccv/provider/migrations/v8/migrations.go b/x/ccv/provider/migrations/v8/migrations.go index 64d821cb30..2977243e87 100644 --- a/x/ccv/provider/migrations/v8/migrations.go +++ b/x/ccv/provider/migrations/v8/migrations.go @@ -4,11 +4,11 @@ import ( "encoding/binary" "time" - "github.com/cosmos/cosmos-sdk/types/bech32" - errorsmod "cosmossdk.io/errors" storetypes "cosmossdk.io/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/bech32" providerkeeper "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" diff --git a/x/ccv/provider/migrations/v8/migrations_test.go b/x/ccv/provider/migrations/v8/migrations_test.go index f6930b1f5a..c8d98115dc 100644 --- a/x/ccv/provider/migrations/v8/migrations_test.go +++ b/x/ccv/provider/migrations/v8/migrations_test.go @@ -1,22 +1,25 @@ package v8 import ( - "cosmossdk.io/math" "encoding/binary" "fmt" + "testing" + "time" + + "cosmossdk.io/math" "github.com/cometbft/cometbft/proto/tendermint/crypto" providerkeeper "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" "github.com/cosmos/interchain-security/v6/x/ccv/types" - "testing" - "time" "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" storetypes "cosmossdk.io/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + testutil "github.com/cosmos/interchain-security/v6/testutil/keeper" providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" - "github.com/stretchr/testify/require" ) func legacyConsumerAddrsToPruneKey(chainID string, vscID uint64) []byte { @@ -368,9 +371,11 @@ func TestMigrateLaunchedConsumerChains(t *testing.T) { providerAddr := chainData1.ProviderAddr consumerAddr := chainData2.ConsumerAddr oldChainData1, err := GetChainDataUsingStringId(ctx, providerKeeper, chainId1, providerAddr, consumerAddr, false) + require.NoError(t, err) require.Equal(t, oldChainData1, ChainData{}) oldChainData2, err := GetChainDataUsingStringId(ctx, providerKeeper, chainId2, providerAddr, consumerAddr, false) + require.NoError(t, err) require.Equal(t, oldChainData2, ChainData{}) // assert that the launched chains have been transferred to reside under a `consumerId`-key diff --git a/x/ccv/provider/module.go b/x/ccv/provider/module.go index 879393ed02..487cffbefc 100644 --- a/x/ccv/provider/module.go +++ b/x/ccv/provider/module.go @@ -10,6 +10,7 @@ import ( "cosmossdk.io/core/appmodule" storetypes "cosmossdk.io/store/types" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" diff --git a/x/ccv/provider/module_test.go b/x/ccv/provider/module_test.go index 480fba9260..41b9201ebd 100644 --- a/x/ccv/provider/module_test.go +++ b/x/ccv/provider/module_test.go @@ -3,17 +3,17 @@ package provider_test import ( "testing" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" host "github.com/cosmos/ibc-go/v8/modules/core/24-host" "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - sdk "github.com/cosmos/cosmos-sdk/types" - "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/cosmos/interchain-security/v6/testutil/crypto" testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" "github.com/cosmos/interchain-security/v6/x/ccv/provider" diff --git a/x/ccv/provider/proposal_handler_test.go b/x/ccv/provider/proposal_handler_test.go index 0d5c986e7b..88c36bd2cd 100644 --- a/x/ccv/provider/proposal_handler_test.go +++ b/x/ccv/provider/proposal_handler_test.go @@ -4,12 +4,14 @@ import ( "testing" "time" - "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + "cosmossdk.io/math" + + sdk "github.com/cosmos/cosmos-sdk/types" distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" "github.com/cosmos/interchain-security/v6/x/ccv/provider" providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" @@ -62,12 +64,6 @@ func TestProviderProposalHandler(t *testing.T) { providerKeeper.SetParams(ctx, providertypes.DefaultParams()) ctx = ctx.WithBlockTime(tc.blockTime) - // Mock expectations depending on expected outcome - switch { - case tc.expValidChangeRewardDenom: - // Nothing to mock - } - // Execution proposalHandler := provider.NewProviderProposalHandler(providerKeeper) err := proposalHandler(ctx, tc.content) diff --git a/x/ccv/provider/simulation/genesis.go b/x/ccv/provider/simulation/genesis.go index fc01d54209..842a9a1837 100644 --- a/x/ccv/provider/simulation/genesis.go +++ b/x/ccv/provider/simulation/genesis.go @@ -6,6 +6,7 @@ import ( "math/rand" "github.com/cosmos/cosmos-sdk/types/module" + "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) diff --git a/x/ccv/provider/types/codec.go b/x/ccv/provider/types/codec.go index bc2ec27fa2..01e371807c 100644 --- a/x/ccv/provider/types/codec.go +++ b/x/ccv/provider/types/codec.go @@ -76,9 +76,6 @@ var ( // The actual codec used for serialization should be provided to x/ibc transfer and // defined at the application level. ModuleCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry()) - - // AminoCdc is a amino codec created to support amino json compatible msgs. - AminoCdc = codec.NewAminoCodec(amino) ) func init() { diff --git a/x/ccv/provider/types/genesis_test.go b/x/ccv/provider/types/genesis_test.go index 6ae6179912..1539d1a5fe 100644 --- a/x/ccv/provider/types/genesis_test.go +++ b/x/ccv/provider/types/genesis_test.go @@ -4,12 +4,13 @@ import ( "testing" "time" - "cosmossdk.io/math" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" commitmenttypes "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types" ibctmtypes "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" "github.com/stretchr/testify/require" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" abci "github.com/cometbft/cometbft/abci/types" diff --git a/x/ccv/provider/types/keys_test.go b/x/ccv/provider/types/keys_test.go index 818596c2fc..1fc000e081 100644 --- a/x/ccv/provider/types/keys_test.go +++ b/x/ccv/provider/types/keys_test.go @@ -98,13 +98,13 @@ func TestPreserveBytePrefix(t *testing.T) { require.Equal(t, byte(32), providertypes.OptedInKeyPrefix()) i++ // DEPRECATED - //require.Equal(t, byte(33), providertypes.TopNKey("13")[0]) + // require.Equal(t, byte(33), providertypes.TopNKey("13")[0]) i++ // DEPRECATED - //require.Equal(t, byte(34), providertypes.ValidatorsPowerCapKey("13")[0]) + // require.Equal(t, byte(34), providertypes.ValidatorsPowerCapKey("13")[0]) i++ // DEPRECATED - //require.Equal(t, byte(35), providertypes.ValidatorSetCapKey("13")[0]) + // require.Equal(t, byte(35), providertypes.ValidatorSetCapKey("13")[0]) i++ require.Equal(t, byte(36), providertypes.AllowlistKeyPrefix()) i++ diff --git a/x/ccv/provider/types/legacy_proposal.go b/x/ccv/provider/types/legacy_proposal.go index 9cc6ef2a77..87d1c707a7 100644 --- a/x/ccv/provider/types/legacy_proposal.go +++ b/x/ccv/provider/types/legacy_proposal.go @@ -7,6 +7,7 @@ import ( clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" evidencetypes "cosmossdk.io/x/evidence/types" + govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) diff --git a/x/ccv/provider/types/msg.go b/x/ccv/provider/types/msg.go index eb90e765f8..1fb2e58784 100644 --- a/x/ccv/provider/types/msg.go +++ b/x/ccv/provider/types/msg.go @@ -6,8 +6,6 @@ import ( "strconv" "strings" - cmttypes "github.com/cometbft/cometbft/types" - ibctmtypes "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" errorsmod "cosmossdk.io/errors" @@ -16,6 +14,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" tmtypes "github.com/cometbft/cometbft/proto/tendermint/types" + cmttypes "github.com/cometbft/cometbft/types" ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) @@ -280,8 +279,9 @@ func (msg MsgSetConsumerCommissionRate) ValidateBasic() error { } // NewMsgCreateConsumer creates a new MsgCreateConsumer instance -func NewMsgCreateConsumer(submitter string, chainId string, metadata ConsumerMetadata, - initializationParameters *ConsumerInitializationParameters, powerShapingParameters *PowerShapingParameters) (*MsgCreateConsumer, error) { +func NewMsgCreateConsumer(submitter, chainId string, metadata ConsumerMetadata, + initializationParameters *ConsumerInitializationParameters, powerShapingParameters *PowerShapingParameters, +) (*MsgCreateConsumer, error) { return &MsgCreateConsumer{ Submitter: submitter, ChainId: chainId, @@ -321,8 +321,9 @@ func (msg MsgCreateConsumer) ValidateBasic() error { } // NewMsgUpdateConsumer creates a new MsgUpdateConsumer instance -func NewMsgUpdateConsumer(owner string, consumerId string, ownerAddress string, metadata *ConsumerMetadata, - initializationParameters *ConsumerInitializationParameters, powerShapingParameters *PowerShapingParameters) (*MsgUpdateConsumer, error) { +func NewMsgUpdateConsumer(owner, consumerId, ownerAddress string, metadata *ConsumerMetadata, + initializationParameters *ConsumerInitializationParameters, powerShapingParameters *PowerShapingParameters, +) (*MsgUpdateConsumer, error) { return &MsgUpdateConsumer{ Owner: owner, ConsumerId: consumerId, @@ -363,7 +364,7 @@ func (msg MsgUpdateConsumer) ValidateBasic() error { } // NewMsgRemoveConsumer creates a new MsgRemoveConsumer instance -func NewMsgRemoveConsumer(owner string, consumerId string) (*MsgRemoveConsumer, error) { +func NewMsgRemoveConsumer(owner, consumerId string) (*MsgRemoveConsumer, error) { return &MsgRemoveConsumer{ Owner: owner, ConsumerId: consumerId, @@ -439,7 +440,7 @@ func ValidateConsumerId(consumerId string) error { // ValidateStringField validates that a string `field` satisfies the following properties: // - is not empty // - has at most `maxLength` characters -func ValidateStringField(nameOfTheField string, field string, maxLength int) error { +func ValidateStringField(nameOfTheField, field string, maxLength int) error { if strings.TrimSpace(field) == "" { return fmt.Errorf("%s cannot be empty", nameOfTheField) } else if len(field) > maxLength { diff --git a/x/ccv/provider/types/msg_test.go b/x/ccv/provider/types/msg_test.go index fd7e094341..f3fa5931d3 100644 --- a/x/ccv/provider/types/msg_test.go +++ b/x/ccv/provider/types/msg_test.go @@ -4,11 +4,13 @@ import ( "testing" "time" - sdk "github.com/cosmos/cosmos-sdk/types" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + "github.com/stretchr/testify/require" + + sdk "github.com/cosmos/cosmos-sdk/types" + cryptoutil "github.com/cosmos/interchain-security/v6/testutil/crypto" "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" - "github.com/stretchr/testify/require" ) func TestValidateConsumerId(t *testing.T) { @@ -513,7 +515,6 @@ func TestMsgAssignConsumerKeyValidateBasic(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - msg := types.MsgAssignConsumerKey{ ChainId: tc.chainId, ConsumerKey: tc.consumerKey, diff --git a/x/ccv/provider/types/params.go b/x/ccv/provider/types/params.go index f66324ed5f..2e144a5520 100644 --- a/x/ccv/provider/types/params.go +++ b/x/ccv/provider/types/params.go @@ -4,11 +4,12 @@ import ( "fmt" "time" - "cosmossdk.io/math" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" commitmenttypes "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types" ibctmtypes "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" diff --git a/x/ccv/provider/types/params_test.go b/x/ccv/provider/types/params_test.go index 8001663c30..29ece2f2c3 100644 --- a/x/ccv/provider/types/params_test.go +++ b/x/ccv/provider/types/params_test.go @@ -4,12 +4,13 @@ import ( "testing" "time" - "cosmossdk.io/math" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" commitmenttypes "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types" ibctmtypes "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" "github.com/stretchr/testify/require" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" diff --git a/x/ccv/types/expected_keepers.go b/x/ccv/types/expected_keepers.go index b643bb1a6d..1e8dfe9719 100644 --- a/x/ccv/types/expected_keepers.go +++ b/x/ccv/types/expected_keepers.go @@ -4,7 +4,6 @@ import ( context "context" "time" - addresscodec "cosmossdk.io/core/address" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" @@ -12,6 +11,7 @@ import ( channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" + addresscodec "cosmossdk.io/core/address" "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" diff --git a/x/ccv/types/params.go b/x/ccv/types/params.go index c5b2c800a0..99c58bd4df 100644 --- a/x/ccv/types/params.go +++ b/x/ccv/types/params.go @@ -5,6 +5,7 @@ import ( time "time" "cosmossdk.io/math" + sdktypes "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" diff --git a/x/ccv/types/shared_params.go b/x/ccv/types/shared_params.go index d1a82df576..118ef4d5c6 100644 --- a/x/ccv/types/shared_params.go +++ b/x/ccv/types/shared_params.go @@ -4,9 +4,10 @@ import ( fmt "fmt" "time" - "cosmossdk.io/math" ibchost "github.com/cosmos/ibc-go/v8/modules/core/24-host" + "cosmossdk.io/math" + sdktypes "github.com/cosmos/cosmos-sdk/types" ) diff --git a/x/ccv/types/utils.go b/x/ccv/types/utils.go index 05e2387eb8..15479f9c42 100644 --- a/x/ccv/types/utils.go +++ b/x/ccv/types/utils.go @@ -7,12 +7,13 @@ import ( "strings" "time" - errorsmod "cosmossdk.io/errors" - "cosmossdk.io/log" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" host "github.com/cosmos/ibc-go/v8/modules/core/24-host" + errorsmod "cosmossdk.io/errors" + "cosmossdk.io/log" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/bech32" @@ -54,7 +55,7 @@ func AccumulateChanges(currentChanges, newChanges []abci.ValidatorUpdate) []abci // TMCryptoPublicKeyToConsAddr converts a TM public key to an SDK public key // and returns the associated consensus address func TMCryptoPublicKeyToConsAddr(k tmprotocrypto.PublicKey) (sdk.ConsAddress, error) { - sdkK, err := cryptocodec.FromTmProtoPublicKey(k) + sdkK, err := cryptocodec.FromCmtProtoPublicKey(k) if err != nil { return nil, err } From 216f3958238591e1b4627919f3ea8fe5a02dfe1b Mon Sep 17 00:00:00 2001 From: Simon Noetzlin Date: Fri, 6 Sep 2024 18:47:25 +0200 Subject: [PATCH 18/28] test: fix e2e-tests (#2234) * fix event name + inccorect gov status * bump Hermes to from 1.10.0 to 1.10.2 fixing a parsing error when relaying VSC packets * remove rogue file * fix bash script to query block at height 1 instead of 0 --- Dockerfile | 2 +- Dockerfile.combined | 2 +- Dockerfile.gaia | 2 +- tests/e2e/actions.go | 4 ++-- tests/e2e/json_marshal_test.go | 5 ++--- tests/e2e/steps.go | 9 +++------ tests/e2e/steps_active_set_changes.go | 9 +++------ tests/e2e/steps_compatibility.go | 9 +++------ tests/e2e/steps_consumer_misbehaviour.go | 9 +++------ tests/e2e/steps_democracy.go | 6 ++---- tests/e2e/steps_inactive_vals.go | 25 +++++++++++------------- tests/e2e/steps_partial_set_security.go | 13 ++++++------ tests/e2e/steps_sovereign_changeover.go | 13 +++++------- tests/e2e/steps_start_chains.go | 9 +++------ tests/e2e/steps_stop_chain.go | 10 ++++------ tests/e2e/testnet-scripts/start-chain.sh | 5 +++-- tests/e2e/trace_handlers_test.go | 14 +++++-------- 17 files changed, 58 insertions(+), 88 deletions(-) diff --git a/Dockerfile b/Dockerfile index 84ae4d5285..adb9aff120 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,7 +29,7 @@ RUN go mod tidy RUN make install # Get Hermes build -FROM --platform=linux/amd64 ghcr.io/informalsystems/hermes:1.10.0 AS hermes-builder +FROM --platform=linux/amd64 ghcr.io/informalsystems/hermes:1.10.2 AS hermes-builder # Get CometMock FROM ghcr.io/informalsystems/cometmock:v0.38.x as cometmock-builder diff --git a/Dockerfile.combined b/Dockerfile.combined index 5335b3ee05..47a8fad86a 100644 --- a/Dockerfile.combined +++ b/Dockerfile.combined @@ -24,7 +24,7 @@ FROM --platform=linux/amd64 ${PROVIDER_IMAGE} AS provider FROM --platform=linux/amd64 ${CONSUMER_IMAGE} AS consumer # Get Hermes build -FROM --platform=linux/amd64 ghcr.io/informalsystems/hermes:1.10.0 AS hermes-builder +FROM --platform=linux/amd64 ghcr.io/informalsystems/hermes:1.10.2 AS hermes-builder # Get GoRelayer diff --git a/Dockerfile.gaia b/Dockerfile.gaia index 1681ecc8b1..314dc2881c 100644 --- a/Dockerfile.gaia +++ b/Dockerfile.gaia @@ -61,7 +61,7 @@ WORKDIR /interchain-security RUN make install # Get Hermes build -FROM --platform=linux/amd64 ghcr.io/informalsystems/hermes:1.10.0 AS hermes-builder +FROM --platform=linux/amd64 ghcr.io/informalsystems/hermes:1.10.2 AS hermes-builder FROM --platform=linux/amd64 fedora:39 RUN dnf update -y diff --git a/tests/e2e/actions.go b/tests/e2e/actions.go index 3ef0a0bf9d..a47219b5af 100644 --- a/tests/e2e/actions.go +++ b/tests/e2e/actions.go @@ -509,12 +509,12 @@ func (tr Chain) CreateConsumer(providerChain, consumerChain ChainID, validator V consumerId := "" for _, event := range txResponse.Events { - if event.Type != "consumer_creation" { + if event.Type != "create_consumer" { continue } attr, exists := event.GetAttribute("consumer_id") if !exists { - log.Fatalf("no event with consumer_id found in tx content of create-consumer: %v", event) + log.Fatalf("no event with consumer_id found in tx content of create_consumer: %v", event) } consumerId = attr.Value } diff --git a/tests/e2e/json_marshal_test.go b/tests/e2e/json_marshal_test.go index 12ea80f718..564df54e36 100644 --- a/tests/e2e/json_marshal_test.go +++ b/tests/e2e/json_marshal_test.go @@ -3,7 +3,6 @@ package main import ( "encoding/json" "reflect" - "strconv" "strings" "testing" @@ -34,7 +33,7 @@ func TestProposalUnmarshal(t *testing.T) { Chain: ChainID("consu"), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_PASSED.String(), } type ProposalAndType struct { @@ -101,7 +100,7 @@ var testCases = []ChainStateTestCase{ Chain: ChainID("consu"), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_PASSED.String(), }, }, }, diff --git a/tests/e2e/steps.go b/tests/e2e/steps.go index e2c64745fd..b9b635452f 100644 --- a/tests/e2e/steps.go +++ b/tests/e2e/steps.go @@ -1,11 +1,8 @@ package main import ( - "strconv" - - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" ) type Step struct { @@ -208,7 +205,7 @@ func stepsInactiveValsTopNReproduce() []Step { Chain: ChainID("consu"), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD.String(), }, }, }, @@ -229,7 +226,7 @@ func stepsInactiveValsTopNReproduce() []Step { Chain: ChainID("consu"), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_PASSED.String(), }, }, HasToValidate: &map[ValidatorID][]ChainID{ diff --git a/tests/e2e/steps_active_set_changes.go b/tests/e2e/steps_active_set_changes.go index 8e4a1d5128..dda2f3ae26 100644 --- a/tests/e2e/steps_active_set_changes.go +++ b/tests/e2e/steps_active_set_changes.go @@ -1,11 +1,8 @@ package main import ( - "strconv" - - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" ) // stepsActiveSetChanges starts a top N provider chain and causes a change in the active set @@ -49,7 +46,7 @@ func stepsActiveSetChanges() []Step { Chain: ChainID("consu"), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD.String(), }, }, HasToValidate: &map[ValidatorID][]ChainID{ @@ -75,7 +72,7 @@ func stepsActiveSetChanges() []Step { Chain: ChainID("consu"), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_PASSED.String(), }, }, }, diff --git a/tests/e2e/steps_compatibility.go b/tests/e2e/steps_compatibility.go index 8e23eca016..628fefafc3 100644 --- a/tests/e2e/steps_compatibility.go +++ b/tests/e2e/steps_compatibility.go @@ -4,11 +4,8 @@ package main // sanity checks across different ICS versions. import ( - "strconv" - - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) @@ -61,7 +58,7 @@ func compstepsStartConsumerChain(consumerName string, proposalIndex, chainIndex Chain: ChainID(consumerName), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), // breaking change in SDK: gov.ProposalStatus(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD).String(), + Status: gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD.String(), // breaking change in SDK: gov.ProposalStatus(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD).String(), }, }, // not supported across major versions @@ -130,7 +127,7 @@ func compstepsStartConsumerChain(consumerName string, proposalIndex, chainIndex Chain: ChainID(consumerName), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), // TODO: CHECK if this is bug on SDK SIDE!!!: should be as before gov.ProposalStatus(gov.ProposalStatus_PROPOSAL_STATUS_PASSED).String(), + Status: gov.ProposalStatus_PROPOSAL_STATUS_PASSED.String(), }, }, ValBalances: &map[ValidatorID]uint{ diff --git a/tests/e2e/steps_consumer_misbehaviour.go b/tests/e2e/steps_consumer_misbehaviour.go index 63d83382d1..0374e60256 100644 --- a/tests/e2e/steps_consumer_misbehaviour.go +++ b/tests/e2e/steps_consumer_misbehaviour.go @@ -1,11 +1,8 @@ package main import ( - "strconv" - - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" ) // starts a provider chain and an Opt-In consumer chain with one validator @@ -52,7 +49,7 @@ func stepsStartChainsForConsumerMisbehaviour(consumerName string) []Step { Chain: ChainID(consumerName), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD.String(), }, }, }, @@ -103,7 +100,7 @@ func stepsStartChainsForConsumerMisbehaviour(consumerName string) []Step { Chain: ChainID(consumerName), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_PASSED.String(), }, }, ValBalances: &map[ValidatorID]uint{ diff --git a/tests/e2e/steps_democracy.go b/tests/e2e/steps_democracy.go index ef9c3787f0..df506639e4 100644 --- a/tests/e2e/steps_democracy.go +++ b/tests/e2e/steps_democracy.go @@ -1,8 +1,6 @@ package main import ( - "strconv" - gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" ) @@ -91,7 +89,7 @@ func stepsDemocracy(consumerName string, expectRegisteredRewardDistribution bool Proposals: &map[uint]Proposal{ 1: IBCTransferParamsProposal{ Deposit: 10000001, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD.String(), Title: "Enable IBC Send", Params: IBCTransferParams{SendEnabled: true, ReceiveEnabled: true}, }, @@ -118,7 +116,7 @@ func stepsDemocracy(consumerName string, expectRegisteredRewardDistribution bool Proposals: &map[uint]Proposal{ 1: IBCTransferParamsProposal{ Deposit: 10000001, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_PASSED.String(), Title: "Enable IBC Send", Params: IBCTransferParams{SendEnabled: true, ReceiveEnabled: true}, }, diff --git a/tests/e2e/steps_inactive_vals.go b/tests/e2e/steps_inactive_vals.go index 1ec4c5b413..9cc397a362 100644 --- a/tests/e2e/steps_inactive_vals.go +++ b/tests/e2e/steps_inactive_vals.go @@ -1,11 +1,8 @@ package main import ( - "strconv" - - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" ) // stepsInactiveValidatorsOnConsumer tests situations where validators that are *not* in the active set on the @@ -373,7 +370,7 @@ func setupOptInChain() []Step { Chain: ChainID("consu"), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD.String(), }, }, HasToValidate: &map[ValidatorID][]ChainID{ @@ -402,7 +399,7 @@ func setupOptInChain() []Step { Chain: ChainID("consu"), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_PASSED.String(), }, }, }, @@ -531,7 +528,7 @@ func stepsInactiveProviderValidatorsGovernance() []Step { Chain: ChainID("consu"), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD.String(), }, }, }, @@ -555,7 +552,7 @@ func stepsInactiveProviderValidatorsGovernance() []Step { InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, // the proposal should have passed because carol voted for it. // carol alone is enough to pass the quorum, because stake of the other validators is not counted - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_PASSED.String(), }, }, }, @@ -618,7 +615,7 @@ func stepsInactiveProviderValidatorsGovernanceBasecase() []Step { Chain: ChainID("consu"), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD.String(), }, }, }, @@ -642,7 +639,7 @@ func stepsInactiveProviderValidatorsGovernanceBasecase() []Step { InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, // the proposal should *not* have passed because only carol voted for it, // and carol is not enough to pass the quorum - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_REJECTED)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_REJECTED.String(), }, }, }, @@ -703,7 +700,7 @@ func stepsMinStake() []Step { Chain: ChainID("consu"), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD.String(), }, }, }, @@ -727,7 +724,7 @@ func stepsMinStake() []Step { Chain: ChainID("consu"), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_PASSED.String(), }, }, }, @@ -821,7 +818,7 @@ func stepsInactiveValsWithTopN() []Step { Chain: ChainID("consu"), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD.String(), }, }, }, @@ -842,7 +839,7 @@ func stepsInactiveValsWithTopN() []Step { Chain: ChainID("consu"), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_PASSED.String(), }, }, HasToValidate: &map[ValidatorID][]ChainID{ diff --git a/tests/e2e/steps_partial_set_security.go b/tests/e2e/steps_partial_set_security.go index 5a08ddda78..f2646c5cd3 100644 --- a/tests/e2e/steps_partial_set_security.go +++ b/tests/e2e/steps_partial_set_security.go @@ -1,7 +1,6 @@ package main import ( - "strconv" "time" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" @@ -576,7 +575,7 @@ func stepsTopNChain() []Step { Chain: ChainID("consu"), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD.String(), }, }, }, @@ -609,7 +608,7 @@ func stepsTopNChain() []Step { Chain: ChainID("consu"), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_PASSED.String(), }, }, }, @@ -1258,7 +1257,7 @@ func stepsValidatorsPowerCappedChain() []Step { Chain: ChainID("consu"), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD.String(), }, }, HasToValidate: &map[ValidatorID][]ChainID{ @@ -1343,7 +1342,7 @@ func stepsValidatorsPowerCappedChain() []Step { Chain: ChainID("consu"), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_PASSED.String(), }, }, }, @@ -2174,7 +2173,7 @@ func stepsModifyChain() []Step { 1: ConsumerAdditionProposal{ Deposit: 10000001, Chain: ChainID("consu"), - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD.String(), }, }, }, @@ -2193,7 +2192,7 @@ func stepsModifyChain() []Step { 1: ConsumerAdditionProposal{ Deposit: 10000001, Chain: ChainID("consu"), - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_PASSED.String(), }, }, }, diff --git a/tests/e2e/steps_sovereign_changeover.go b/tests/e2e/steps_sovereign_changeover.go index f66eb14dfe..23d595b8d4 100644 --- a/tests/e2e/steps_sovereign_changeover.go +++ b/tests/e2e/steps_sovereign_changeover.go @@ -1,11 +1,8 @@ package main import ( - "strconv" - - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" ) // this creates new clients on both chains and a connection (connection-0) between them @@ -68,7 +65,7 @@ func stepsChangeoverToConsumer(consumerName string) []Step { Chain: ChainID(consumerName), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 111}, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD.String(), }, }, }, @@ -89,7 +86,7 @@ func stepsChangeoverToConsumer(consumerName string) []Step { Chain: ChainID(consumerName), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 111}, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_PASSED.String(), }, }, ValBalances: &map[ValidatorID]uint{ @@ -213,7 +210,7 @@ func stepsUpgradeChain() []Step { UpgradeHeight: 110, Type: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", Deposit: 10000000, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD.String(), }, }, }, @@ -234,7 +231,7 @@ func stepsUpgradeChain() []Step { UpgradeHeight: 110, Title: "sovereign-changeover", Type: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_PASSED.String(), }, }, }, diff --git a/tests/e2e/steps_start_chains.go b/tests/e2e/steps_start_chains.go index de468e75db..640816aaeb 100644 --- a/tests/e2e/steps_start_chains.go +++ b/tests/e2e/steps_start_chains.go @@ -1,11 +1,8 @@ package main import ( - "strconv" - - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" ) func stepStartProviderChain() []Step { @@ -56,7 +53,7 @@ func stepsStartConsumerChain(consumerName string, proposalIndex, chainIndex uint Chain: ChainID(consumerName), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD.String(), }, }, ProposedConsumerChains: &[]string{consumerName}, @@ -136,7 +133,7 @@ func stepsStartConsumerChain(consumerName string, proposalIndex, chainIndex uint Chain: ChainID(consumerName), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_PASSED.String(), }, }, ValBalances: &map[ValidatorID]uint{ diff --git a/tests/e2e/steps_stop_chain.go b/tests/e2e/steps_stop_chain.go index a88d8288b7..a5753e594b 100644 --- a/tests/e2e/steps_stop_chain.go +++ b/tests/e2e/steps_stop_chain.go @@ -1,8 +1,6 @@ package main import ( - "strconv" - gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" ) @@ -35,7 +33,7 @@ func stepsStopChain(consumerName string, propNumber uint) []Step { propNumber: ConsumerRemovalProposal{ Deposit: 10000001, Chain: ChainID(consumerName), - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD.String(), }, }, ConsumerChains: &map[ChainID]bool{"consu": true}, // consumer chain not yet removed @@ -55,7 +53,7 @@ func stepsStopChain(consumerName string, propNumber uint) []Step { propNumber: ConsumerRemovalProposal{ Deposit: 10000001, Chain: ChainID(consumerName), - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_PASSED.String(), }, }, ValBalances: &map[ValidatorID]uint{ @@ -90,7 +88,7 @@ func stepsConsumerRemovalPropNotPassing(consumerName string, propNumber uint) [] propNumber: ConsumerRemovalProposal{ Deposit: 10000001, Chain: ChainID(consumerName), - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD.String(), }, }, ConsumerChains: &map[ChainID]bool{"consu": true}, // consumer chain not removed @@ -110,7 +108,7 @@ func stepsConsumerRemovalPropNotPassing(consumerName string, propNumber uint) [] propNumber: ConsumerRemovalProposal{ Deposit: 10000001, Chain: ChainID(consumerName), - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_REJECTED)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_REJECTED.String(), }, }, ValBalances: &map[ValidatorID]uint{ diff --git a/tests/e2e/testnet-scripts/start-chain.sh b/tests/e2e/testnet-scripts/start-chain.sh index 29091d8b19..6ad97b3589 100644 --- a/tests/e2e/testnet-scripts/start-chain.sh +++ b/tests/e2e/testnet-scripts/start-chain.sh @@ -377,15 +377,16 @@ fi # poll for chain start if [[ "$USE_COMETMOCK" == "true" ]]; then set +e - until $BIN query block --type=height 0 --node "tcp://$CHAIN_IP_PREFIX.$QUERY_IP_SUFFIX:26658"; do sleep 0.3 ; done + until $BIN query block --type=height 1--node "tcp://$CHAIN_IP_PREFIX.$QUERY_IP_SUFFIX:26658"; do sleep 0.3 ; done set -e else set +e - until $BIN query block --type=height 0 --node "tcp://$CHAIN_IP_PREFIX.$QUERY_IP_SUFFIX:26658" | grep -q -v '{"block_id":{"hash":"","parts":{"total":0,"hash": + until $BIN query block --type=height 1 --node "tcp://$CHAIN_IP_PREFIX.$QUERY_IP_SUFFIX:26658" | grep -q -v '{"block_id":{"hash":"","parts":{"total":0,"hash": ""}},"block":null}'; do sleep 0.3 ; done set -e fi + echo "done!!!!!!!!" read -p "Press Return to Close..." diff --git a/tests/e2e/trace_handlers_test.go b/tests/e2e/trace_handlers_test.go index 35b2647ca4..fe15656545 100644 --- a/tests/e2e/trace_handlers_test.go +++ b/tests/e2e/trace_handlers_test.go @@ -6,7 +6,6 @@ import ( "log" "os" "path/filepath" - "strconv" "testing" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" @@ -30,7 +29,7 @@ var proposalInStateSteps = []Step{ 1: ConsumerRemovalProposal{ Deposit: 10000001, Chain: ChainID("foo"), - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD.String(), }, }, }, @@ -116,7 +115,7 @@ func TestMarshalAndUnmarshalChainState(t *testing.T) { Chain: ChainID("test"), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 5, RevisionHeight: 5}, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD.String(), }, }, }}, @@ -128,11 +127,8 @@ func TestMarshalAndUnmarshalChainState(t *testing.T) { Proposals: &map[uint]Proposal{ 1: IBCTransferParamsProposal{ Deposit: 10000001, - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), - Params: IBCTransferParams{ - SendEnabled: true, - ReceiveEnabled: true, - }, + Status: gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD.String(), + Params: IBCTransferParams{true, true}, }, }, }}, @@ -141,7 +137,7 @@ func TestMarshalAndUnmarshalChainState(t *testing.T) { 5: ConsumerRemovalProposal{ Deposit: 10000001, Chain: ChainID("test123"), - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), + Status: gov.ProposalStatus_PROPOSAL_STATUS_PASSED.String(), }, }, ValBalances: &map[ValidatorID]uint{ From 5b6252c7726809f0c56beb346de328a152f6d4fc Mon Sep 17 00:00:00 2001 From: MSalopek Date: Fri, 6 Sep 2024 18:53:00 +0200 Subject: [PATCH 19/28] fix!: revert compat breaks; cleanup (#2235) * fix!: revert compat breaks; cleanup * rm unused handlers --- app/provider/app.go | 3 +- .../ccv/provider/v1/provider.proto | 7 + .../ccv/provider/v1/tx.proto | 34 +- x/ccv/provider/handler.go | 52 -- x/ccv/provider/handler_test.go | 199 ----- x/ccv/provider/keeper/msg_server.go | 20 +- x/ccv/provider/proposal_handler.go | 30 - x/ccv/provider/proposal_handler_test.go | 76 -- x/ccv/provider/types/msg.go | 24 +- x/ccv/provider/types/msg_test.go | 10 +- x/ccv/provider/types/provider.pb.go | 291 +++---- x/ccv/provider/types/tx.pb.go | 714 +++++------------- 12 files changed, 373 insertions(+), 1087 deletions(-) delete mode 100644 x/ccv/provider/handler.go delete mode 100644 x/ccv/provider/handler_test.go delete mode 100644 x/ccv/provider/proposal_handler.go delete mode 100644 x/ccv/provider/proposal_handler_test.go diff --git a/app/provider/app.go b/app/provider/app.go index 49308ab013..1e611fc0aa 100644 --- a/app/provider/app.go +++ b/app/provider/app.go @@ -495,8 +495,7 @@ func New( govRouter := govv1beta1.NewRouter() govRouter. AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler). - AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)). - AddRoute(providertypes.RouterKey, ibcprovider.NewProviderProposalHandler(app.ProviderKeeper)) + AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)) // Set legacy router for backwards compatibility with gov v1beta1 app.GovKeeper.SetLegacyRouter(govRouter) diff --git a/proto/interchain_security/ccv/provider/v1/provider.proto b/proto/interchain_security/ccv/provider/v1/provider.proto index 1cf26b7263..25dfbf3d25 100644 --- a/proto/interchain_security/ccv/provider/v1/provider.proto +++ b/proto/interchain_security/ccv/provider/v1/provider.proto @@ -32,6 +32,7 @@ message ConsumerAdditionProposal { option (gogoproto.goproto_getters) = false; option (gogoproto.goproto_stringer) = false; option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; + option deprecated = true; // the title of the proposal string title = 1; @@ -121,6 +122,8 @@ message ConsumerAdditionProposal { // Use MsgConsumerRemoval to submit this proposal type. message ConsumerRemovalProposal { option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; + option deprecated = true; + // the title of the proposal string title = 1; @@ -138,6 +141,8 @@ message ConsumerRemovalProposal { // 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 { + option deprecated = true; + // the title of the proposal string title = 1; // the description of the proposal @@ -291,6 +296,8 @@ 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 { + option deprecated = true; + string channel_id = 1; string chain_id = 2; } diff --git a/proto/interchain_security/ccv/provider/v1/tx.proto b/proto/interchain_security/ccv/provider/v1/tx.proto index 84de528080..09e49213af 100644 --- a/proto/interchain_security/ccv/provider/v1/tx.proto +++ b/proto/interchain_security/ccv/provider/v1/tx.proto @@ -23,12 +23,6 @@ service Msg { rpc AssignConsumerKey(MsgAssignConsumerKey) returns (MsgAssignConsumerKeyResponse); rpc SubmitConsumerMisbehaviour(MsgSubmitConsumerMisbehaviour) returns (MsgSubmitConsumerMisbehaviourResponse); rpc SubmitConsumerDoubleVoting(MsgSubmitConsumerDoubleVoting) returns (MsgSubmitConsumerDoubleVotingResponse); - 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); @@ -36,15 +30,12 @@ service Msg { rpc OptIn(MsgOptIn) returns (MsgOptInResponse); rpc OptOut(MsgOptOut) returns (MsgOptOutResponse); rpc SetConsumerCommissionRate(MsgSetConsumerCommissionRate) returns (MsgSetConsumerCommissionRateResponse); - rpc ConsumerModification(MsgConsumerModification) returns (MsgConsumerModificationResponse) { - option deprecated = true; - } rpc ChangeRewardDenoms(MsgChangeRewardDenoms) returns (MsgChangeRewardDenomsResponse); } message MsgAssignConsumerKey { - option (cosmos.msg.v1.signer) = "submitter"; + option (cosmos.msg.v1.signer) = "signer"; option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; @@ -58,7 +49,7 @@ message MsgAssignConsumerKey { // `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is="}` string consumer_key = 3; - string submitter = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + 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; @@ -119,6 +110,7 @@ message MsgUpdateParamsResponse {} // [DEPRECATED] Use `MsgCreateConsumer` instead message MsgConsumerAddition { + option deprecated = true; option (cosmos.msg.v1.signer) = "authority"; // the proposed chain-id of the new consumer chain, must be different from all @@ -199,13 +191,11 @@ message MsgConsumerAddition { bool allow_inactive_vals = 20; } -// MsgConsumerAdditionResponse defines response type for MsgConsumerAddition messages -message MsgConsumerAdditionResponse {} // [DEPRECATED] Use `MsgRemoveConsumer` instead message MsgConsumerRemoval { + option deprecated = true; option (cosmos.msg.v1.signer) = "authority"; - // the chain-id of the consumer chain to be stopped string chain_id = 1; // the time on the provider chain at which all validators are responsible to @@ -216,9 +206,6 @@ message MsgConsumerRemoval { string authority = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } -// 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. @@ -256,7 +243,7 @@ message MsgChangeRewardDenomsResponse {} message MsgOptIn { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - option (cosmos.msg.v1.signer) = "submitter"; + option (cosmos.msg.v1.signer) = "signer"; // [DEPRECATED] use `consumer_id` instead string chain_id = 1 [deprecated = true]; // the validator address on the provider @@ -267,7 +254,7 @@ message MsgOptIn { // consumer public key at a later stage by issuing a `MsgAssignConsumerKey` message. string consumer_key = 3; // submitter address - string submitter = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string signer = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // the consumer id of the consumer chain to opt in to string consumer_id = 5; } @@ -277,13 +264,13 @@ message MsgOptInResponse {} message MsgOptOut { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - option (cosmos.msg.v1.signer) = "submitter"; + option (cosmos.msg.v1.signer) = "signer"; // [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\"" ]; // submitter address - string submitter = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string signer = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // the consumer id of the consumer chain to opt out from string consumer_id = 4; } @@ -295,7 +282,7 @@ message MsgOptOutResponse {} message MsgSetConsumerCommissionRate { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - option (cosmos.msg.v1.signer) = "submitter"; + option (cosmos.msg.v1.signer) = "signer"; // The validator address on the provider string provider_addr = 1 [ (gogoproto.moretags) = "yaml:\"address\"" ]; @@ -309,7 +296,7 @@ message MsgSetConsumerCommissionRate { (gogoproto.nullable) = false ]; // submitter address - string submitter = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string signer = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // the consumer id of the consumer chain to set the commission rate string consumer_id = 5; } @@ -320,6 +307,7 @@ message MsgSetConsumerCommissionRateResponse {} // [DEPRECATED] Use `MsgUpdateConsumer` instead message MsgConsumerModification { option (cosmos.msg.v1.signer) = "authority"; + option deprecated = true; // the title of the proposal string title = 1; diff --git a/x/ccv/provider/handler.go b/x/ccv/provider/handler.go deleted file mode 100644 index d8c6a05295..0000000000 --- a/x/ccv/provider/handler.go +++ /dev/null @@ -1,52 +0,0 @@ -package provider - -import ( - errorsmod "cosmossdk.io/errors" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - - "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" - "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" -) - -func NewHandler(k *keeper.Keeper) baseapp.MsgServiceHandler { - msgServer := keeper.NewMsgServerImpl(k) - - return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { - ctx = ctx.WithEventManager(sdk.NewEventManager()) - - switch msg := msg.(type) { - case *types.MsgAssignConsumerKey: - res, err := msgServer.AssignConsumerKey(ctx, msg) - return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgSubmitConsumerMisbehaviour: - res, err := msgServer.SubmitConsumerMisbehaviour(ctx, msg) - return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgSubmitConsumerDoubleVoting: - res, err := msgServer.SubmitConsumerDoubleVoting(ctx, msg) - return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgOptIn: - res, err := msgServer.OptIn(ctx, msg) - return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgOptOut: - res, err := msgServer.OptOut(ctx, msg) - return sdk.WrapServiceResult(ctx, res, err) - 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 deleted file mode 100644 index a423485888..0000000000 --- a/x/ccv/provider/handler_test.go +++ /dev/null @@ -1,199 +0,0 @@ -package provider_test - -import ( - "encoding/base64" - "strings" - "testing" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - - "github.com/cosmos/cosmos-sdk/testutil/testdata" - sdk "github.com/cosmos/cosmos-sdk/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - - testcrypto "github.com/cosmos/interchain-security/v6/testutil/crypto" - testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" - "github.com/cosmos/interchain-security/v6/x/ccv/provider" - keeper "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" - providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" -) - -func TestInvalidMsg(t *testing.T) { - k, _, _, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - handler := provider.NewHandler(&k) - res, err := handler(sdk.NewContext(nil, tmproto.Header{}, false, nil), testdata.NewTestMsg()) - require.Error(t, err) - require.Nil(t, res) - require.True(t, strings.Contains(err.Error(), "unrecognized provider message type")) -} - -func TestAssignConsensusKeyMsgHandling(t *testing.T) { - providerCryptoId := testcrypto.NewCryptoIdentityFromIntSeed(0) - providerConsAddr := providerCryptoId.ProviderConsAddress() - - // a different providerConsAddr, to simulate different validators having assigned keys - providerCryptoId2 := testcrypto.NewCryptoIdentityFromIntSeed(10) - providerConsAddr2 := providerCryptoId2.ProviderConsAddress() - - consumerCryptoId := testcrypto.NewCryptoIdentityFromIntSeed(1) - consumerConsAddr := consumerCryptoId.ConsumerConsAddress() - consumerKeyBz := base64.StdEncoding.EncodeToString(consumerCryptoId.ConsensusSDKPubKey().Bytes()) - consumerKey := `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"` + consumerKeyBz + `"}` - - testCases := []struct { - name string - // State-mutating setup specific to this test case - 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.SetConsumerPhase(ctx, "consumerId", providertypes.CONSUMER_PHASE_INITIALIZED) - gomock.InOrder( - mocks.MockStakingKeeper.EXPECT().GetValidator( - ctx, providerCryptoId.SDKValOpAddress(), - ).Return(providerCryptoId.SDKStakingValidator(), nil).Times(1), - mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, - consumerConsAddr.ToSdkConsAddr(), - ).Return(stakingtypes.Validator{}, stakingtypes.ErrNoValidatorFound), - ) - }, - expError: false, - consumerId: "consumerId", - }, - { - name: "fail: consumer id does not correspond to a registered chain", - setup: func(ctx sdk.Context, - k keeper.Keeper, mocks testkeeper.MockedKeepers, - ) { - gomock.InOrder( - mocks.MockStakingKeeper.EXPECT().GetValidator( - ctx, providerCryptoId.SDKValOpAddress(), - // Return a valid validator, found! - ).Return(providerCryptoId.SDKStakingValidator(), nil).Times(1), - ) - }, - expError: true, - consumerId: "consumerId", - }, - { - name: "fail: missing validator", - setup: func(ctx sdk.Context, - k keeper.Keeper, mocks testkeeper.MockedKeepers, - ) { - k.SetConsumerPhase(ctx, "consumerId", providertypes.CONSUMER_PHASE_INITIALIZED) - gomock.InOrder( - mocks.MockStakingKeeper.EXPECT().GetValidator( - ctx, providerCryptoId.SDKValOpAddress(), - ).Return(stakingtypes.Validator{}, stakingtypes.ErrNoValidatorFound).Times(1), - ) - }, - 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.SetConsumerPhase(ctx, "consumerId", providertypes.CONSUMER_PHASE_INITIALIZED) - - // Use the consumer key already used by some other validator - k.SetValidatorByConsumerAddr(ctx, "consumerId", consumerConsAddr, providerConsAddr2) - - gomock.InOrder( - mocks.MockStakingKeeper.EXPECT().GetValidator( - ctx, providerCryptoId.SDKValOpAddress(), - // validator should not be missing - ).Return(providerCryptoId.SDKStakingValidator(), nil).Times(1), - mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, - consumerConsAddr.ToSdkConsAddr(), - // return false - no other validator uses the consumer key to validate *on the provider* - ).Return(stakingtypes.Validator{}, nil), - ) - }, - 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.SetConsumerPhase(ctx, "consumerId", providertypes.CONSUMER_PHASE_INITIALIZED) - - // Use the consumer key already - k.SetValidatorByConsumerAddr(ctx, "consumerId", consumerConsAddr, providerConsAddr) - - gomock.InOrder( - mocks.MockStakingKeeper.EXPECT().GetValidator( - ctx, providerCryptoId.SDKValOpAddress(), - ).Return(providerCryptoId.SDKStakingValidator(), nil).Times(1), - mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, - consumerConsAddr.ToSdkConsAddr(), - ).Return(stakingtypes.Validator{}, stakingtypes.ErrNoValidatorFound), - ) - }, - 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.SetConsumerPhase(ctx, "consumerId", providertypes.CONSUMER_PHASE_INITIALIZED) - - // Use the consumer key already used by some other validator - k.SetValidatorByConsumerAddr(ctx, "consumerId", consumerConsAddr, providerConsAddr2) - - gomock.InOrder( - mocks.MockStakingKeeper.EXPECT().GetValidator( - ctx, providerCryptoId.SDKValOpAddress(), - // validator should not be missing - ).Return(providerCryptoId.SDKStakingValidator(), nil).Times(1), - mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, - consumerConsAddr.ToSdkConsAddr(), - // return false - no other validator uses the consumer key to validate *on the provider* - ).Return(stakingtypes.Validator{}, stakingtypes.ErrNoValidatorFound), - ) - }, - expError: true, - consumerId: "consumerId", - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - k, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - - tc.setup(ctx, k, mocks) - k.SetConsumerChainId(ctx, tc.consumerId, tc.name) - - msg, err := providertypes.NewMsgAssignConsumerKey(tc.consumerId, - providerCryptoId.SDKValOpAddress(), consumerKey, - providerCryptoId.SDKStakingValidator().OperatorAddress, - ) - - require.NoError(t, err) - - // Try to handle the message - _, err = provider.NewHandler(&k)(ctx, msg) - - if tc.expError { - require.Error(t, err, "invalid case did not return error") - } else { - require.NoError(t, err, "valid case returned error") - } - - ctrl.Finish() - }) - } -} diff --git a/x/ccv/provider/keeper/msg_server.go b/x/ccv/provider/keeper/msg_server.go index 7bb624edf7..89a4de03a6 100644 --- a/x/ccv/provider/keeper/msg_server.go +++ b/x/ccv/provider/keeper/msg_server.go @@ -94,7 +94,7 @@ func (k msgServer) AssignConsumerKey(goCtx context.Context, msg *types.MsgAssign sdk.NewAttribute(types.AttributeConsumerChainId, chainId), sdk.NewAttribute(types.AttributeProviderValidatorAddress, msg.ProviderAddr), sdk.NewAttribute(types.AttributeConsumerConsensusPubKey, msg.ConsumerKey), - sdk.NewAttribute(types.AttributeSubmitterAddress, msg.Submitter), + sdk.NewAttribute(types.AttributeSubmitterAddress, msg.Signer), ), ) @@ -240,7 +240,7 @@ func (k msgServer) OptIn(goCtx context.Context, msg *types.MsgOptIn) (*types.Msg sdk.NewAttribute(types.AttributeConsumerChainId, chainId), sdk.NewAttribute(types.AttributeProviderValidatorAddress, msg.ProviderAddr), sdk.NewAttribute(types.AttributeConsumerConsensusPubKey, msg.ConsumerKey), - sdk.NewAttribute(types.AttributeSubmitterAddress, msg.Submitter), + sdk.NewAttribute(types.AttributeSubmitterAddress, msg.Signer), ), ) @@ -290,7 +290,7 @@ func (k msgServer) OptOut(goCtx context.Context, msg *types.MsgOptOut) (*types.M sdk.NewAttribute(types.AttributeConsumerId, msg.ConsumerId), sdk.NewAttribute(types.AttributeConsumerChainId, chainId), sdk.NewAttribute(types.AttributeProviderValidatorAddress, msg.ProviderAddr), - sdk.NewAttribute(types.AttributeSubmitterAddress, msg.Submitter), + sdk.NewAttribute(types.AttributeSubmitterAddress, msg.Signer), ), ) @@ -340,7 +340,7 @@ func (k msgServer) SetConsumerCommissionRate(goCtx context.Context, msg *types.M sdk.NewAttribute(types.AttributeConsumerChainId, chainId), sdk.NewAttribute(types.AttributeProviderValidatorAddress, msg.ProviderAddr), sdk.NewAttribute(types.AttributeConsumerCommissionRate, msg.Rate.String()), - sdk.NewAttribute(types.AttributeSubmitterAddress, msg.Submitter), + sdk.NewAttribute(types.AttributeSubmitterAddress, msg.Signer), ), ) @@ -643,15 +643,3 @@ func (k msgServer) RemoveConsumer(goCtx context.Context, msg *types.MsgRemoveCon return &resp, err } - -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/proposal_handler.go b/x/ccv/provider/proposal_handler.go deleted file mode 100644 index 03e1b2b96b..0000000000 --- a/x/ccv/provider/proposal_handler.go +++ /dev/null @@ -1,30 +0,0 @@ -package provider - -import ( - errorsmod "cosmossdk.io/errors" - - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - - "github.com/cosmos/interchain-security/v6/x/ccv/provider/keeper" - "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" -) - -// NewProviderProposalHandler defines the handler for consumer addition, -// consumer removal, and consumer reward denom proposals. -// Passed proposals are executed during EndBlock. -func NewProviderProposalHandler(k keeper.Keeper) govv1beta1.Handler { - return func(ctx sdk.Context, content govv1beta1.Content) error { - switch c := content.(type) { - case *types.ConsumerAdditionProposal: - return nil - case *types.ConsumerRemovalProposal: - return nil - case *types.ChangeRewardDenomsProposal: - return nil - default: - return errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized ccv proposal content type: %T", c) - } - } -} diff --git a/x/ccv/provider/proposal_handler_test.go b/x/ccv/provider/proposal_handler_test.go deleted file mode 100644 index 88c36bd2cd..0000000000 --- a/x/ccv/provider/proposal_handler_test.go +++ /dev/null @@ -1,76 +0,0 @@ -package provider_test - -import ( - "testing" - "time" - - "github.com/stretchr/testify/require" - - "cosmossdk.io/math" - - sdk "github.com/cosmos/cosmos-sdk/types" - distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - - testkeeper "github.com/cosmos/interchain-security/v6/testutil/keeper" - "github.com/cosmos/interchain-security/v6/x/ccv/provider" - providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" -) - -// TestProviderProposalHandler tests the highest level handler for proposals -// concerning creating, stopping consumer chains and changing reward denom. -func TestProviderProposalHandler(t *testing.T) { - // Snapshot times asserted in tests - now := time.Now().UTC() - hourFromNow := now.Add(time.Hour).UTC() - - testCases := []struct { - name string - content govv1beta1.Content - blockTime time.Time - expValidConsumerRemoval bool - expValidChangeRewardDenom bool - }{ - { - name: "valid change reward denoms proposal", - content: providertypes.NewChangeRewardDenomsProposal( - "title", "description", []string{"denom1"}, []string{"denom2"}), - blockTime: hourFromNow, - expValidChangeRewardDenom: true, - }, - { - name: "nil proposal", - content: nil, - blockTime: hourFromNow, - }, - { - name: "unsupported proposal type", - // lint rule disabled because this is a test case for an unsupported proposal type - // nolint:staticcheck - content: &distributiontypes.CommunityPoolSpendProposal{ - Title: "title", - Description: "desc", - Recipient: "", - Amount: sdk.NewCoins(sdk.NewCoin("communityfunds", math.NewInt(10))), - }, - }, - } - - for _, tc := range testCases { - - // Setup - keeperParams := testkeeper.NewInMemKeeperParams(t) - providerKeeper, ctx, _, _ := testkeeper.GetProviderKeeperAndCtx(t, keeperParams) - providerKeeper.SetParams(ctx, providertypes.DefaultParams()) - ctx = ctx.WithBlockTime(tc.blockTime) - - // Execution - proposalHandler := provider.NewProviderProposalHandler(providerKeeper) - err := proposalHandler(ctx, tc.content) - if tc.expValidChangeRewardDenom { - require.NoError(t, err) - } else { - require.Error(t, err) - } - } -} diff --git a/x/ccv/provider/types/msg.go b/x/ccv/provider/types/msg.go index 1fb2e58784..4cf2af68b0 100644 --- a/x/ccv/provider/types/msg.go +++ b/x/ccv/provider/types/msg.go @@ -59,13 +59,13 @@ var ( // NewMsgAssignConsumerKey creates a new MsgAssignConsumerKey instance. // Delegator address and validator address are the same. func NewMsgAssignConsumerKey(consumerId string, providerValidatorAddress sdk.ValAddress, - consumerConsensusPubKey, submitter string, + consumerConsensusPubKey, signer string, ) (*MsgAssignConsumerKey, error) { return &MsgAssignConsumerKey{ ConsumerId: consumerId, ProviderAddr: providerValidatorAddress.String(), ConsumerKey: consumerConsensusPubKey, - Submitter: submitter, + Signer: signer, }, nil } @@ -79,7 +79,7 @@ func (msg MsgAssignConsumerKey) ValidateBasic() error { return errorsmod.Wrapf(ErrInvalidMsgAssignConsumerKey, "ConsumerId: %s", err.Error()) } - if err := validateProviderAddress(msg.ProviderAddr, msg.Submitter); err != nil { + if err := validateProviderAddress(msg.ProviderAddr, msg.Signer); err != nil { return errorsmod.Wrapf(ErrInvalidMsgAssignConsumerKey, "ProviderAddr: %s", err.Error()) } @@ -185,12 +185,12 @@ func (msg MsgSubmitConsumerDoubleVoting) ValidateBasic() error { } // NewMsgOptIn creates a new NewMsgOptIn instance. -func NewMsgOptIn(consumerId string, providerValidatorAddress sdk.ValAddress, consumerConsensusPubKey, submitter string) (*MsgOptIn, error) { +func NewMsgOptIn(consumerId string, providerValidatorAddress sdk.ValAddress, consumerConsensusPubKey, signer string) (*MsgOptIn, error) { return &MsgOptIn{ ConsumerId: consumerId, ProviderAddr: providerValidatorAddress.String(), ConsumerKey: consumerConsensusPubKey, - Submitter: submitter, + Signer: signer, }, nil } @@ -204,7 +204,7 @@ func (msg MsgOptIn) ValidateBasic() error { return errorsmod.Wrapf(ErrInvalidMsgOptIn, "ConsumerId: %s", err.Error()) } - if err := validateProviderAddress(msg.ProviderAddr, msg.Submitter); err != nil { + if err := validateProviderAddress(msg.ProviderAddr, msg.Signer); err != nil { return errorsmod.Wrapf(ErrInvalidMsgOptIn, "ProviderAddr: %s", err.Error()) } @@ -217,11 +217,11 @@ func (msg MsgOptIn) ValidateBasic() error { } // NewMsgOptOut creates a new NewMsgOptIn instance. -func NewMsgOptOut(consumerId string, providerValidatorAddress sdk.ValAddress, submitter string) (*MsgOptOut, error) { +func NewMsgOptOut(consumerId string, providerValidatorAddress sdk.ValAddress, signer string) (*MsgOptOut, error) { return &MsgOptOut{ ConsumerId: consumerId, ProviderAddr: providerValidatorAddress.String(), - Submitter: submitter, + Signer: signer, }, nil } @@ -235,7 +235,7 @@ func (msg MsgOptOut) ValidateBasic() error { return errorsmod.Wrapf(ErrInvalidMsgOptOut, "ConsumerId: %s", err.Error()) } - if err := validateProviderAddress(msg.ProviderAddr, msg.Submitter); err != nil { + if err := validateProviderAddress(msg.ProviderAddr, msg.Signer); err != nil { return errorsmod.Wrapf(ErrInvalidMsgOptOut, "ProviderAddr: %s", err.Error()) } @@ -247,13 +247,13 @@ func NewMsgSetConsumerCommissionRate( consumerId string, commission math.LegacyDec, providerValidatorAddress sdk.ValAddress, - submitter string, + signer string, ) *MsgSetConsumerCommissionRate { return &MsgSetConsumerCommissionRate{ ConsumerId: consumerId, Rate: commission, ProviderAddr: providerValidatorAddress.String(), - Submitter: submitter, + Signer: signer, } } @@ -267,7 +267,7 @@ func (msg MsgSetConsumerCommissionRate) ValidateBasic() error { return errorsmod.Wrapf(ErrInvalidMsgSetConsumerCommissionRate, "ConsumerId: %s", err.Error()) } - if err := validateProviderAddress(msg.ProviderAddr, msg.Submitter); err != nil { + if err := validateProviderAddress(msg.ProviderAddr, msg.Signer); err != nil { return errorsmod.Wrapf(ErrInvalidMsgSetConsumerCommissionRate, "ProviderAddr: %s", err.Error()) } diff --git a/x/ccv/provider/types/msg_test.go b/x/ccv/provider/types/msg_test.go index f3fa5931d3..6b0689be27 100644 --- a/x/ccv/provider/types/msg_test.go +++ b/x/ccv/provider/types/msg_test.go @@ -458,7 +458,7 @@ func TestMsgAssignConsumerKeyValidateBasic(t *testing.T) { name string chainId string providerAddr string - submitter string + signer string consumerKey string consumerId string expErr bool @@ -493,21 +493,21 @@ func TestMsgAssignConsumerKeyValidateBasic(t *testing.T) { name: "invalid: provider address != submitter address", consumerId: "1", providerAddr: valOpAddr1.String(), - submitter: acc2, + signer: acc2, expErr: true, }, { name: "invalid: consumer pubkey empty", consumerId: "1", providerAddr: valOpAddr1.String(), - submitter: acc1, + signer: acc1, expErr: true, }, { name: "valid", consumerId: "1", providerAddr: valOpAddr1.String(), - submitter: acc1, + signer: acc1, consumerKey: "{\"@type\": \"/cosmos.crypto.ed25519.PubKey\", \"key\": \"e3BehnEIlGUAnJYn9V8gBXuMh4tXO8xxlxyXD1APGyk=\"}", expErr: false, }, @@ -519,7 +519,7 @@ func TestMsgAssignConsumerKeyValidateBasic(t *testing.T) { ChainId: tc.chainId, ConsumerKey: tc.consumerKey, ProviderAddr: tc.providerAddr, - Submitter: tc.submitter, + Signer: tc.signer, ConsumerId: tc.consumerId, } diff --git a/x/ccv/provider/types/provider.pb.go b/x/ccv/provider/types/provider.pb.go index 418a9bdfb8..10cdbdd9c9 100644 --- a/x/ccv/provider/types/provider.pb.go +++ b/x/ccv/provider/types/provider.pb.go @@ -91,6 +91,8 @@ func (ConsumerPhase) EnumDescriptor() ([]byte, []int) { // slashed. It is recommended that spawn time occurs after the proposal end // time. // Use MsgConsumerAddition to submit this proposal type. +// +// Deprecated: Do not use. type ConsumerAdditionProposal struct { // the title of the proposal Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` @@ -205,6 +207,8 @@ var xxx_messageInfo_ConsumerAdditionProposal proto.InternalMessageInfo // state is removed from the provider chain. The outstanding unbonding operation // funds are released. // Use MsgConsumerRemoval to submit this proposal type. +// +// Deprecated: Do not use. type ConsumerRemovalProposal struct { // the title of the proposal Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` @@ -281,6 +285,8 @@ func (m *ConsumerRemovalProposal) GetStopTime() 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. +// +// Deprecated: Do not use. type ConsumerModificationProposal struct { // the title of the proposal Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` @@ -951,6 +957,8 @@ func (m *AddressList) GetAddresses() [][]byte { // WARNING: This message is deprecated and is not used. // ChannelToChain is used to map a CCV channel ID to the consumer chainID +// +// Deprecated: Do not use. type ChannelToChain struct { ChannelId string `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` ChainId string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` @@ -1830,147 +1838,148 @@ func init() { } var fileDescriptor_f22ec409a72b7b72 = []byte{ - // 2238 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x59, 0xbd, 0x6f, 0x1b, 0xc9, - 0x15, 0xd7, 0x8a, 0x94, 0x44, 0x3e, 0xea, 0x83, 0x1a, 0xfb, 0x6c, 0x4a, 0xa7, 0xa3, 0x68, 0x5e, - 0x6c, 0x28, 0x76, 0x4c, 0x9e, 0x74, 0x40, 0x60, 0x38, 0x39, 0x18, 0x32, 0x49, 0xdb, 0xf4, 0x87, - 0xcc, 0x2c, 0x69, 0x1d, 0xe0, 0x14, 0x8b, 0xe1, 0xee, 0x88, 0x9c, 0x68, 0x77, 0x67, 0xbd, 0x33, - 0xa4, 0xcd, 0x14, 0xa9, 0x0f, 0x01, 0x02, 0x5c, 0x52, 0x1d, 0xd2, 0xe4, 0x80, 0x34, 0x41, 0xaa, - 0x14, 0x41, 0xfe, 0x80, 0x54, 0x97, 0x00, 0x41, 0xae, 0x4c, 0x75, 0x17, 0xd8, 0x45, 0x8a, 0x00, - 0x69, 0xd3, 0x06, 0x33, 0xfb, 0xc1, 0xa5, 0x3e, 0x6c, 0x1a, 0xb6, 0xd3, 0x48, 0x3b, 0xef, 0xfd, - 0xde, 0x9b, 0x37, 0x33, 0xef, 0x6b, 0x86, 0xb0, 0x43, 0x5d, 0x41, 0x7c, 0xb3, 0x8f, 0xa9, 0x6b, - 0x70, 0x62, 0x0e, 0x7c, 0x2a, 0x46, 0x55, 0xd3, 0x1c, 0x56, 0x3d, 0x9f, 0x0d, 0xa9, 0x45, 0xfc, - 0xea, 0x70, 0x3b, 0xfe, 0xae, 0x78, 0x3e, 0x13, 0x0c, 0x7d, 0x78, 0x82, 0x4c, 0xc5, 0x34, 0x87, - 0x95, 0x18, 0x37, 0xdc, 0x5e, 0xbf, 0x78, 0x9a, 0xe2, 0xe1, 0x76, 0xf5, 0x29, 0xf5, 0x49, 0xa0, - 0x6b, 0xfd, 0x6c, 0x8f, 0xf5, 0x98, 0xfa, 0xac, 0xca, 0xaf, 0x90, 0xba, 0xd9, 0x63, 0xac, 0x67, - 0x93, 0xaa, 0x1a, 0x75, 0x07, 0x07, 0x55, 0x41, 0x1d, 0xc2, 0x05, 0x76, 0xbc, 0x10, 0x50, 0x3c, - 0x0a, 0xb0, 0x06, 0x3e, 0x16, 0x94, 0xb9, 0x91, 0x02, 0xda, 0x35, 0xab, 0x26, 0xf3, 0x49, 0xd5, - 0xb4, 0x29, 0x71, 0x85, 0x9c, 0x35, 0xf8, 0x0a, 0x01, 0x55, 0x09, 0xb0, 0x69, 0xaf, 0x2f, 0x02, - 0x32, 0xaf, 0x0a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 0x7b, 0xc4, 0x25, 0x9c, 0x72, 0xa3, - 0x8f, 0x79, 0xbf, 0x30, 0x57, 0xd2, 0xb6, 0x16, 0xf5, 0x5c, 0x48, 0xbb, 0x83, 0x79, 0x1f, 0x6d, - 0x42, 0xae, 0x4b, 0x5d, 0xec, 0x8f, 0x02, 0xc4, 0xbc, 0x42, 0x40, 0x40, 0x52, 0x80, 0x1a, 0x00, - 0xf7, 0xf0, 0x53, 0xd7, 0x90, 0xbe, 0x51, 0x58, 0x08, 0x0d, 0x09, 0xfc, 0xa2, 0x12, 0xf9, 0x45, - 0xa5, 0x13, 0x39, 0xce, 0xcd, 0x8c, 0x34, 0xe4, 0xf3, 0x6f, 0x37, 0x35, 0x3d, 0xab, 0xe4, 0x24, - 0x07, 0xed, 0x41, 0x7e, 0xe0, 0x76, 0x99, 0x6b, 0x51, 0xb7, 0x67, 0x78, 0xc4, 0xa7, 0xcc, 0x2a, - 0x64, 0x94, 0xaa, 0xb5, 0x63, 0xaa, 0xea, 0xa1, 0x8b, 0x05, 0x9a, 0xbe, 0x90, 0x9a, 0x56, 0x62, - 0xe1, 0x96, 0x92, 0x45, 0x3f, 0x02, 0x64, 0x9a, 0x43, 0x65, 0x12, 0x1b, 0x88, 0x48, 0x63, 0x76, - 0x7a, 0x8d, 0x79, 0xd3, 0x1c, 0x76, 0x02, 0xe9, 0x50, 0xe5, 0x8f, 0xe1, 0xbc, 0xf0, 0xb1, 0xcb, - 0x0f, 0x88, 0x7f, 0x54, 0x2f, 0x4c, 0xaf, 0xf7, 0xbd, 0x48, 0xc7, 0xa4, 0xf2, 0x3b, 0x50, 0x32, - 0x43, 0x07, 0x32, 0x7c, 0x62, 0x51, 0x2e, 0x7c, 0xda, 0x1d, 0x48, 0x59, 0xe3, 0xc0, 0xc7, 0xa6, - 0xf2, 0x91, 0x9c, 0x72, 0x82, 0x62, 0x84, 0xd3, 0x27, 0x60, 0xb7, 0x42, 0x14, 0x7a, 0x08, 0xdf, - 0xe9, 0xda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 0x5a, 0x90, 0xdd, 0xb3, 0x21, 0xa5, 0x69, 0x4d, 0x54, 0xf3, 0xd9, 0x89, 0x6a, 0x5e, 0x66, 0xb0, - 0xb6, 0x9f, 0xac, 0xb6, 0xaa, 0x78, 0xb4, 0xb0, 0x79, 0x48, 0x04, 0x47, 0x3a, 0xa4, 0x55, 0x55, - 0x0d, 0x96, 0x7a, 0xed, 0xd4, 0xa5, 0x0e, 0xb7, 0x2b, 0xa7, 0x29, 0xa9, 0x63, 0x81, 0x43, 0xff, - 0x57, 0xba, 0xca, 0xbf, 0xd4, 0xa0, 0x70, 0x8f, 0x8c, 0x76, 0x39, 0xa7, 0x3d, 0xd7, 0x21, 0xae, - 0x90, 0x91, 0x87, 0x4d, 0x22, 0x3f, 0xd1, 0x87, 0xb0, 0x14, 0x3b, 0x9d, 0x4a, 0x9c, 0x9a, 0x4a, - 0x9c, 0x8b, 0x11, 0x51, 0xee, 0x11, 0xba, 0x0e, 0xe0, 0xf9, 0x64, 0x68, 0x98, 0xc6, 0x21, 0x19, - 0xa9, 0xf5, 0xe4, 0x76, 0x36, 0x92, 0x09, 0x31, 0xb8, 0xe9, 0x56, 0x5a, 0x83, 0xae, 0x4d, 0xcd, - 0x7b, 0x64, 0xa4, 0x67, 0x24, 0xbe, 0x76, 0x8f, 0x8c, 0x64, 0x05, 0x54, 0xcd, 0x89, 0xca, 0x62, - 0x29, 0x3d, 0x18, 0x94, 0x7f, 0xad, 0xc1, 0xf9, 0x78, 0x01, 0xd1, 0x59, 0xb5, 0x06, 0x5d, 0x29, - 0x91, 0xdc, 0x3b, 0x6d, 0xb2, 0x13, 0x3a, 0x66, 0xed, 0xec, 0x09, 0xd6, 0xde, 0x80, 0xc5, 0x38, - 0x8d, 0x48, 0x7b, 0x53, 0x53, 0xd8, 0x9b, 0x8b, 0x24, 0xee, 0x91, 0x51, 0xf9, 0x67, 0x09, 0xdb, - 0x6e, 0x8e, 0x12, 0xee, 0xeb, 0xbf, 0xc2, 0xb6, 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9c, 0xa0, 0x22, 0xac, 0xd7, 0x1e, 0xee, 0xb5, 0x1f, 0x3d, 0x68, 0xe8, 0x46, 0xeb, 0xce, 0x6e, - 0xbb, 0x61, 0x3c, 0xda, 0x6b, 0xb7, 0x1a, 0xb5, 0xe6, 0xad, 0x66, 0xa3, 0x9e, 0x9f, 0x41, 0x1f, - 0xc0, 0xda, 0x11, 0xbe, 0xde, 0xb8, 0xdd, 0x6c, 0x77, 0x1a, 0x7a, 0xa3, 0x9e, 0xd7, 0x4e, 0x10, - 0x6f, 0xee, 0x35, 0x3b, 0xcd, 0xdd, 0xfb, 0xcd, 0xc7, 0x8d, 0x7a, 0x7e, 0x16, 0xbd, 0x0f, 0xe7, - 0x8f, 0xf0, 0xef, 0xef, 0x3e, 0xda, 0xab, 0xdd, 0x69, 0xd4, 0xf3, 0x29, 0xb4, 0x0e, 0xe7, 0x8e, - 0x30, 0xdb, 0x9d, 0x87, 0xad, 0x56, 0xa3, 0x9e, 0x4f, 0x9f, 0xc0, 0xab, 0x37, 0xee, 0x37, 0x3a, - 0x8d, 0x7a, 0x7e, 0x6e, 0x3d, 0xfd, 0xd9, 0x6f, 0x8b, 0x33, 0x37, 0x3f, 0xfd, 0xea, 0x79, 0x51, - 0xfb, 0xfa, 0x79, 0x51, 0xfb, 0xe7, 0xf3, 0xa2, 0xf6, 0xf9, 0x8b, 0xe2, 0xcc, 0xd7, 0x2f, 0x8a, - 0x33, 0xff, 0x78, 0x51, 0x9c, 0x79, 0xfc, 0xc9, 0xf1, 0x4c, 0x3e, 0xae, 0x94, 0x57, 0xe3, 0x5f, - 0x33, 0x86, 0xdf, 0xaf, 0x3e, 0x9b, 0xfc, 0xad, 0x44, 0x25, 0xf9, 0xee, 0xbc, 0x0a, 0xd2, 0x8f, - 0xff, 0x17, 0x00, 0x00, 0xff, 0xff, 0x61, 0xae, 0x19, 0x69, 0x5c, 0x19, 0x00, 0x00, + // 2249 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x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2, 0xb3, 0x26, 0xbe, 0x42, 0x6a, 0x71, 0x40, 0xe9, + 0xc0, 0xc2, 0x35, 0x39, 0xea, 0x8f, 0xf6, 0x6b, 0x9c, 0xd8, 0x98, 0x71, 0x64, 0xbb, 0x21, 0xa0, + 0x70, 0x18, 0x60, 0x8e, 0x3c, 0xc4, 0x09, 0x75, 0x22, 0x05, 0xa4, 0x6f, 0xd4, 0x0c, 0xea, 0xe1, + 0x9a, 0x61, 0x11, 0xec, 0x70, 0x31, 0x6b, 0xf0, 0x15, 0x02, 0x6a, 0x02, 0x60, 0x91, 0xc1, 0x90, + 0x07, 0x64, 0x56, 0xe3, 0xd8, 0x31, 0xb1, 0x67, 0x93, 0x00, 0x3c, 0x19, 0x85, 0x02, 0x5b, 0x09, + 0xbe, 0xe1, 0x8d, 0x5d, 0x4e, 0x6b, 0x07, 0x78, 0xcc, 0x42, 0xee, 0x87, 0x06, 0x65, 0x36, 0x65, + 0x35, 0x2c, 0xd6, 0xef, 0x18, 0xb8, 0xe6, 0x6f, 0xf7, 0x31, 0x47, 0xdb, 0x31, 0x21, 0xb2, 0x3b, + 0xc4, 0xf5, 0x11, 0x9b, 0x60, 0x0c, 0x4a, 0x22, 0xbb, 0x37, 0x02, 0xbe, 0x1e, 0xec, 0x48, 0x30, + 0x08, 0x59, 0xeb, 0xc8, 0x26, 0x0e, 0xad, 0xc9, 0xbf, 0x01, 0xa9, 0xfc, 0x9f, 0x0c, 0x50, 0x1b, + 0xd4, 0x61, 0x23, 0x1b, 0x7b, 0x75, 0xd3, 0x24, 0x62, 0x03, 0x3a, 0x1e, 0x75, 0x29, 0x43, 0x16, + 0x3c, 0x0f, 0x16, 0x38, 0xe1, 0x16, 0x56, 0x95, 0x92, 0x52, 0xc9, 0x6a, 0xc1, 0x00, 0x96, 0x40, + 0xce, 0xc4, 0xcc, 0xf0, 0x88, 0x2b, 0xc0, 0xea, 0xbc, 0xe4, 0x25, 0x49, 0x70, 0x03, 0x64, 0x82, + 0x53, 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x0b, 0xca, 0xdf, + 0x5f, 0x16, 0x94, 0xcf, 0x5f, 0x15, 0xe6, 0xbe, 0x7e, 0x55, 0x98, 0xfb, 0xdb, 0xab, 0xc2, 0xdc, + 0xd3, 0x4f, 0x8e, 0x66, 0xf2, 0x49, 0xa5, 0xbc, 0x1e, 0xff, 0xb2, 0xe1, 0x7f, 0xb7, 0xf6, 0x62, + 0xfa, 0x77, 0x13, 0x99, 0xe4, 0xfb, 0x8b, 0x32, 0x48, 0x3f, 0xfe, 0x6f, 0x00, 0x00, 0x00, 0xff, + 0xff, 0x4a, 0x0f, 0x93, 0x6a, 0x68, 0x19, 0x00, 0x00, } func (m *ConsumerAdditionProposal) Marshal() (dAtA []byte, err error) { diff --git a/x/ccv/provider/types/tx.pb.go b/x/ccv/provider/types/tx.pb.go index d208d725c3..6629e49ba1 100644 --- a/x/ccv/provider/types/tx.pb.go +++ b/x/ccv/provider/types/tx.pb.go @@ -51,7 +51,7 @@ type MsgAssignConsumerKey struct { // in json string format corresponding to proto-any, ex: // `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is="}` ConsumerKey string `protobuf:"bytes,3,opt,name=consumer_key,json=consumerKey,proto3" json:"consumer_key,omitempty"` - Submitter string `protobuf:"bytes,4,opt,name=submitter,proto3" json:"submitter,omitempty"` + 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"` } @@ -379,6 +379,8 @@ func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo // [DEPRECATED] Use `MsgCreateConsumer` instead +// +// Deprecated: Do not use. 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. @@ -626,44 +628,9 @@ func (m *MsgConsumerAddition) GetAllowInactiveVals() bool { return false } -// MsgConsumerAdditionResponse defines response type for MsgConsumerAddition messages -type MsgConsumerAdditionResponse struct { -} - -func (m *MsgConsumerAdditionResponse) Reset() { *m = MsgConsumerAdditionResponse{} } -func (m *MsgConsumerAdditionResponse) String() string { return proto.CompactTextString(m) } -func (*MsgConsumerAdditionResponse) ProtoMessage() {} -func (*MsgConsumerAdditionResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_43221a4391e9fbf4, []int{9} -} -func (m *MsgConsumerAdditionResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgConsumerAdditionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgConsumerAdditionResponse.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 *MsgConsumerAdditionResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgConsumerAdditionResponse.Merge(m, src) -} -func (m *MsgConsumerAdditionResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgConsumerAdditionResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgConsumerAdditionResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgConsumerAdditionResponse proto.InternalMessageInfo - // [DEPRECATED] Use `MsgRemoveConsumer` instead +// +// Deprecated: Do not use. 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"` @@ -678,7 +645,7 @@ func (m *MsgConsumerRemoval) Reset() { *m = MsgConsumerRemoval{} } func (m *MsgConsumerRemoval) String() string { return proto.CompactTextString(m) } func (*MsgConsumerRemoval) ProtoMessage() {} func (*MsgConsumerRemoval) Descriptor() ([]byte, []int) { - return fileDescriptor_43221a4391e9fbf4, []int{10} + return fileDescriptor_43221a4391e9fbf4, []int{9} } func (m *MsgConsumerRemoval) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -728,43 +695,6 @@ func (m *MsgConsumerRemoval) GetAuthority() string { return "" } -// MsgConsumerRemovalResponse defines response type for MsgConsumerRemoval messages -type MsgConsumerRemovalResponse struct { -} - -func (m *MsgConsumerRemovalResponse) Reset() { *m = MsgConsumerRemovalResponse{} } -func (m *MsgConsumerRemovalResponse) String() string { return proto.CompactTextString(m) } -func (*MsgConsumerRemovalResponse) ProtoMessage() {} -func (*MsgConsumerRemovalResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_43221a4391e9fbf4, []int{11} -} -func (m *MsgConsumerRemovalResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgConsumerRemovalResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgConsumerRemovalResponse.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 *MsgConsumerRemovalResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgConsumerRemovalResponse.Merge(m, src) -} -func (m *MsgConsumerRemovalResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgConsumerRemovalResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgConsumerRemovalResponse.DiscardUnknown(m) -} - -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 { @@ -778,7 +708,7 @@ 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} + return fileDescriptor_43221a4391e9fbf4, []int{10} } func (m *MsgRemoveConsumer) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -829,7 +759,7 @@ func (m *MsgRemoveConsumerResponse) Reset() { *m = MsgRemoveConsumerResp func (m *MsgRemoveConsumerResponse) String() string { return proto.CompactTextString(m) } func (*MsgRemoveConsumerResponse) ProtoMessage() {} func (*MsgRemoveConsumerResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_43221a4391e9fbf4, []int{13} + return fileDescriptor_43221a4391e9fbf4, []int{11} } func (m *MsgRemoveConsumerResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -875,7 +805,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{14} + return fileDescriptor_43221a4391e9fbf4, []int{12} } func (m *MsgChangeRewardDenoms) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -933,7 +863,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{15} + return fileDescriptor_43221a4391e9fbf4, []int{13} } func (m *MsgChangeRewardDenomsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -973,7 +903,7 @@ type MsgOptIn struct { // consumer public key at a later stage by issuing a `MsgAssignConsumerKey` message. ConsumerKey string `protobuf:"bytes,3,opt,name=consumer_key,json=consumerKey,proto3" json:"consumer_key,omitempty"` // submitter address - Submitter string `protobuf:"bytes,4,opt,name=submitter,proto3" json:"submitter,omitempty"` + 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"` } @@ -982,7 +912,7 @@ 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{16} + return fileDescriptor_43221a4391e9fbf4, []int{14} } func (m *MsgOptIn) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1018,7 +948,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{17} + return fileDescriptor_43221a4391e9fbf4, []int{15} } func (m *MsgOptInResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1053,7 +983,7 @@ type MsgOptOut struct { // the validator address on the provider ProviderAddr string `protobuf:"bytes,2,opt,name=provider_addr,json=providerAddr,proto3" json:"provider_addr,omitempty" yaml:"address"` // submitter address - Submitter string `protobuf:"bytes,3,opt,name=submitter,proto3" json:"submitter,omitempty"` + 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"` } @@ -1062,7 +992,7 @@ 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{18} + return fileDescriptor_43221a4391e9fbf4, []int{16} } func (m *MsgOptOut) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1098,7 +1028,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{19} + return fileDescriptor_43221a4391e9fbf4, []int{17} } func (m *MsgOptOutResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1138,7 +1068,7 @@ type MsgSetConsumerCommissionRate struct { // 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"` // submitter address - Submitter string `protobuf:"bytes,4,opt,name=submitter,proto3" json:"submitter,omitempty"` + 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"` } @@ -1147,7 +1077,7 @@ func (m *MsgSetConsumerCommissionRate) Reset() { *m = MsgSetConsumerComm func (m *MsgSetConsumerCommissionRate) String() string { return proto.CompactTextString(m) } func (*MsgSetConsumerCommissionRate) ProtoMessage() {} func (*MsgSetConsumerCommissionRate) Descriptor() ([]byte, []int) { - return fileDescriptor_43221a4391e9fbf4, []int{20} + return fileDescriptor_43221a4391e9fbf4, []int{18} } func (m *MsgSetConsumerCommissionRate) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1183,7 +1113,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{21} + return fileDescriptor_43221a4391e9fbf4, []int{19} } func (m *MsgSetConsumerCommissionRateResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1213,6 +1143,8 @@ func (m *MsgSetConsumerCommissionRateResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgSetConsumerCommissionRateResponse proto.InternalMessageInfo // [DEPRECATED] Use `MsgUpdateConsumer` instead +// +// Deprecated: Do not use. type MsgConsumerModification struct { // the title of the proposal Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` @@ -1251,7 +1183,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{22} + return fileDescriptor_43221a4391e9fbf4, []int{20} } func (m *MsgConsumerModification) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1364,7 +1296,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{23} + return fileDescriptor_43221a4391e9fbf4, []int{21} } func (m *MsgConsumerModificationResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1409,7 +1341,7 @@ 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} + return fileDescriptor_43221a4391e9fbf4, []int{22} } func (m *MsgCreateConsumer) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1482,7 +1414,7 @@ func (m *MsgCreateConsumerResponse) Reset() { *m = MsgCreateConsumerResp func (m *MsgCreateConsumerResponse) String() string { return proto.CompactTextString(m) } func (*MsgCreateConsumerResponse) ProtoMessage() {} func (*MsgCreateConsumerResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_43221a4391e9fbf4, []int{25} + return fileDescriptor_43221a4391e9fbf4, []int{23} } func (m *MsgCreateConsumerResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1538,7 +1470,7 @@ 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} + return fileDescriptor_43221a4391e9fbf4, []int{24} } func (m *MsgUpdateConsumer) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1617,7 +1549,7 @@ func (m *MsgUpdateConsumerResponse) Reset() { *m = MsgUpdateConsumerResp func (m *MsgUpdateConsumerResponse) String() string { return proto.CompactTextString(m) } func (*MsgUpdateConsumerResponse) ProtoMessage() {} func (*MsgUpdateConsumerResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_43221a4391e9fbf4, []int{27} + return fileDescriptor_43221a4391e9fbf4, []int{25} } func (m *MsgUpdateConsumerResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1656,9 +1588,7 @@ func init() { proto.RegisterType((*MsgUpdateParams)(nil), "interchain_security.ccv.provider.v1.MsgUpdateParams") proto.RegisterType((*MsgUpdateParamsResponse)(nil), "interchain_security.ccv.provider.v1.MsgUpdateParamsResponse") proto.RegisterType((*MsgConsumerAddition)(nil), "interchain_security.ccv.provider.v1.MsgConsumerAddition") - 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") @@ -1682,137 +1612,134 @@ func init() { } var fileDescriptor_43221a4391e9fbf4 = []byte{ - // 2075 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x59, 0xcb, 0x6f, 0x1c, 0x49, - 0x19, 0x77, 0xcf, 0x8c, 0xbd, 0x33, 0xe5, 0x77, 0xdb, 0x59, 0xb7, 0x27, 0x89, 0xc7, 0x31, 0xcb, - 0xae, 0x15, 0xd6, 0x3d, 0xc4, 0xb0, 0x59, 0x30, 0xe1, 0xe1, 0x47, 0x20, 0x5e, 0x70, 0xec, 0x6d, - 0x87, 0xac, 0x04, 0x12, 0xad, 0x9a, 0xee, 0x4a, 0x4f, 0x29, 0xdd, 0x5d, 0xad, 0xae, 0x9a, 0xf1, - 0x9a, 0x13, 0x8a, 0x84, 0x94, 0x63, 0xd0, 0x72, 0xe0, 0xc6, 0x1e, 0xb8, 0x20, 0x01, 0xda, 0xc3, - 0x9e, 0xf8, 0x0b, 0x56, 0xe2, 0xb2, 0xac, 0x38, 0xa0, 0x3d, 0x04, 0x94, 0x1c, 0x96, 0x33, 0x07, - 0xce, 0xa8, 0x1e, 0xdd, 0x33, 0x3d, 0x33, 0x76, 0x7a, 0xc6, 0x2c, 0x1c, 0xb8, 0x8c, 0xba, 0xeb, - 0xfb, 0x7d, 0xbf, 0xef, 0x51, 0x55, 0xdf, 0x57, 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x15, 0xe4, 0xc5, 0xe9, - 0x4e, 0xa1, 0xfa, 0x3e, 0x98, 0x88, 0x04, 0x83, 0xca, 0xee, 0x97, 0xcc, 0x1c, 0xf5, 0xda, 0x94, - 0x46, 0x77, 0x4a, 0x1f, 0x3d, 0xad, 0x8d, 0x59, 0x8a, 0x60, 0x6b, 0x46, 0xc4, 0x93, 0x52, 0xaf, - 0x2d, 0x83, 0xa5, 0x1e, 0x2f, 0xd3, 0x08, 0x3e, 0x2d, 0x83, 0x85, 0x03, 0xea, 0x25, 0x51, 0x6e, - 0xbb, 0x2e, 0xe6, 0x69, 0xd4, 0x97, 0x7b, 0x0b, 0x4e, 0xa7, 0xd8, 0x7c, 0x0f, 0xcc, 0xe0, 0x10, - 0x33, 0x0c, 0x7d, 0xbb, 0x89, 0xf8, 0xdc, 0x28, 0x87, 0xab, 0x62, 0xb6, 0x78, 0x91, 0x35, 0x55, - 0x69, 0x15, 0x33, 0xc4, 0x11, 0xca, 0xbf, 0x69, 0xa5, 0x27, 0x07, 0x79, 0xf1, 0xf1, 0x50, 0x88, - 0x28, 0xa6, 0x76, 0x13, 0xd2, 0xa6, 0x98, 0xf4, 0x29, 0x6b, 0x52, 0x8d, 0xdd, 0x81, 0xb4, 0xc9, - 0xa7, 0xb0, 0x81, 0x43, 0x18, 0x9f, 0x4a, 0x44, 0x49, 0x20, 0x80, 0x1c, 0x12, 0x80, 0x5d, 0x00, - 0x68, 0x04, 0x4f, 0x42, 0x9b, 0xb7, 0x1d, 0x51, 0x64, 0xb8, 0x23, 0xb2, 0xa5, 0x98, 0x49, 0x4b, - 0x31, 0xef, 0x25, 0x3d, 0x69, 0xa7, 0xcc, 0x1d, 0x79, 0xf2, 0xb7, 0x9a, 0x66, 0x55, 0x84, 0x1e, - 0x97, 0xe8, 0x77, 0xc1, 0x5c, 0x2b, 0x6c, 0x90, 0xd0, 0xc5, 0xa1, 0x67, 0x47, 0x28, 0xc6, 0xc4, - 0x35, 0x26, 0x04, 0xd5, 0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0x85, 0x29, 0x52, 0x5f, 0x7f, - 0xad, 0x81, 0xc5, 0x81, 0xf7, 0x9a, 0x5b, 0xc3, 0x56, 0x84, 0x6e, 0xed, 0xea, 0xde, 0x45, 0xb4, - 0xb3, 0x45, 0xe5, 0x97, 0x1a, 0xd0, 0x07, 0x7c, 0x9c, 0xd9, 0xca, 0x6d, 0xa1, 0x4f, 0xb7, 0xba, - 0x33, 0xba, 0x6e, 0xe2, 0x5b, 0x75, 0xfc, 0x67, 0x9f, 0x7d, 0x70, 0x5d, 0xdb, 0x79, 0xe7, 0xa3, - 0x67, 0x2b, 0xda, 0xc7, 0xcf, 0x56, 0xb4, 0xbf, 0x3f, 0x5b, 0xd1, 0x9e, 0x3c, 0x5f, 0x19, 0xfb, - 0xf8, 0xf9, 0xca, 0xd8, 0x5f, 0x9f, 0xaf, 0x8c, 0xfd, 0xe8, 0x9b, 0x1e, 0x66, 0xcd, 0x56, 0xc3, - 0x74, 0x48, 0xa0, 0xfe, 0x88, 0xad, 0x77, 0xac, 0x6e, 0xa4, 0xff, 0xa3, 0xb6, 0x6f, 0xd6, 0xdf, - 0xcd, 0xfe, 0x99, 0x2a, 0xfe, 0x2d, 0x6a, 0x4c, 0x88, 0x6f, 0x76, 0x5f, 0xf9, 0x77, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x6a, 0xbc, 0xa8, 0x62, 0xc8, 0x1e, 0x00, 0x00, + // 2021 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x59, 0xcd, 0x6f, 0x1b, 0xc7, + 0xd9, 0xd7, 0x92, 0x94, 0x4c, 0x8e, 0x64, 0x7d, 0x8c, 0xe4, 0x68, 0x45, 0x3b, 0xa2, 0xcc, 0x37, + 0x6f, 0x22, 0xb8, 0xd1, 0x32, 0x56, 0x1b, 0x17, 0x55, 0xd3, 0x02, 0xfa, 0x70, 0x6b, 0xa5, 0x95, + 0xa5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, + 0x23, 0x2f, 0x8d, 0x84, 0x57, 0xdf, 0xbe, 0x14, 0x3c, 0x35, 0x17, 0x81, 0x29, 0x7d, 0x89, 0xb1, + 0x2e, 0x41, 0x70, 0xd8, 0xe1, 0xd5, 0x3b, 0x97, 0xc3, 0xa7, 0x16, 0x7f, 0x63, 0x80, 0x95, 0xb3, + 0x2f, 0x15, 0xb9, 0xab, 0xd8, 0x99, 0x14, 0xd5, 0xfd, 0x97, 0xa6, 0x48, 0x7d, 0xfd, 0x85, 0x01, + 0xe0, 0x88, 0x8b, 0xfb, 0x56, 0xee, 0xed, 0x37, 0xa4, 0x5b, 0xdd, 0x19, 0x5f, 0x37, 0x71, 0xab, + 0x3a, 0xf9, 0xd3, 0x2f, 0x9e, 0xdc, 0x32, 0x76, 0xde, 0x7f, 0xfa, 0x7c, 0xd5, 0xf8, 0xec, 0xf9, + 0xaa, 0xf1, 0xb7, 0xe7, 0xab, 0xc6, 0xc7, 0x2f, 0x56, 0x27, 0x3e, 0x7b, 0xb1, 0x3a, 0xf1, 0xa7, + 0x17, 0xab, 0x13, 0x3f, 0xfc, 0x96, 0x4f, 0x78, 0xab, 0xd3, 0xb4, 0x5c, 0x1a, 0xe8, 0xbf, 0xd8, + 0x1a, 0x3d, 0xab, 0x1b, 0xe9, 0x3f, 0x64, 0xdd, 0x3b, 0x8d, 0x0f, 0xb2, 0x7f, 0x93, 0xc9, 0x3f, + 0x04, 0x9a, 0x53, 0xf2, 0x9b, 0xcd, 0x57, 0xff, 0x1d, 0x00, 0x00, 0xff, 0xff, 0xef, 0xbe, 0x07, + 0x52, 0xa2, 0x1c, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1830,8 +1757,6 @@ type MsgClient interface { AssignConsumerKey(ctx context.Context, in *MsgAssignConsumerKey, opts ...grpc.CallOption) (*MsgAssignConsumerKeyResponse, error) SubmitConsumerMisbehaviour(ctx context.Context, in *MsgSubmitConsumerMisbehaviour, opts ...grpc.CallOption) (*MsgSubmitConsumerMisbehaviourResponse, error) 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) @@ -1839,7 +1764,6 @@ type MsgClient interface { OptIn(ctx context.Context, in *MsgOptIn, opts ...grpc.CallOption) (*MsgOptInResponse, error) OptOut(ctx context.Context, in *MsgOptOut, opts ...grpc.CallOption) (*MsgOptOutResponse, error) SetConsumerCommissionRate(ctx context.Context, in *MsgSetConsumerCommissionRate, opts ...grpc.CallOption) (*MsgSetConsumerCommissionRateResponse, error) - ConsumerModification(ctx context.Context, in *MsgConsumerModification, opts ...grpc.CallOption) (*MsgConsumerModificationResponse, error) ChangeRewardDenoms(ctx context.Context, in *MsgChangeRewardDenoms, opts ...grpc.CallOption) (*MsgChangeRewardDenomsResponse, error) } @@ -1878,26 +1802,6 @@ 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...) - if err != nil { - return nil, err - } - 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...) - if err != nil { - return nil, err - } - 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...) @@ -1961,16 +1865,6 @@ 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...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *msgClient) ChangeRewardDenoms(ctx context.Context, in *MsgChangeRewardDenoms, opts ...grpc.CallOption) (*MsgChangeRewardDenomsResponse, error) { out := new(MsgChangeRewardDenomsResponse) err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Msg/ChangeRewardDenoms", in, out, opts...) @@ -1985,8 +1879,6 @@ type MsgServer interface { AssignConsumerKey(context.Context, *MsgAssignConsumerKey) (*MsgAssignConsumerKeyResponse, error) SubmitConsumerMisbehaviour(context.Context, *MsgSubmitConsumerMisbehaviour) (*MsgSubmitConsumerMisbehaviourResponse, error) 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) @@ -1994,7 +1886,6 @@ type MsgServer interface { OptIn(context.Context, *MsgOptIn) (*MsgOptInResponse, error) OptOut(context.Context, *MsgOptOut) (*MsgOptOutResponse, error) SetConsumerCommissionRate(context.Context, *MsgSetConsumerCommissionRate) (*MsgSetConsumerCommissionRateResponse, error) - ConsumerModification(context.Context, *MsgConsumerModification) (*MsgConsumerModificationResponse, error) ChangeRewardDenoms(context.Context, *MsgChangeRewardDenoms) (*MsgChangeRewardDenomsResponse, error) } @@ -2011,12 +1902,6 @@ func (*UnimplementedMsgServer) SubmitConsumerMisbehaviour(ctx context.Context, r func (*UnimplementedMsgServer) SubmitConsumerDoubleVoting(ctx context.Context, req *MsgSubmitConsumerDoubleVoting) (*MsgSubmitConsumerDoubleVotingResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SubmitConsumerDoubleVoting not implemented") } -func (*UnimplementedMsgServer) ConsumerAddition(ctx context.Context, req *MsgConsumerAddition) (*MsgConsumerAdditionResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ConsumerAddition not implemented") -} -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") } @@ -2038,9 +1923,6 @@ func (*UnimplementedMsgServer) OptOut(ctx context.Context, req *MsgOptOut) (*Msg func (*UnimplementedMsgServer) SetConsumerCommissionRate(ctx context.Context, req *MsgSetConsumerCommissionRate) (*MsgSetConsumerCommissionRateResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SetConsumerCommissionRate not implemented") } -func (*UnimplementedMsgServer) ConsumerModification(ctx context.Context, req *MsgConsumerModification) (*MsgConsumerModificationResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ConsumerModification not implemented") -} func (*UnimplementedMsgServer) ChangeRewardDenoms(ctx context.Context, req *MsgChangeRewardDenoms) (*MsgChangeRewardDenomsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ChangeRewardDenoms not implemented") } @@ -2103,42 +1985,6 @@ func _Msg_SubmitConsumerDoubleVoting_Handler(srv interface{}, ctx context.Contex return interceptor(ctx, in, info, handler) } -func _Msg_ConsumerAddition_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgConsumerAddition) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).ConsumerAddition(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/interchain_security.ccv.provider.v1.Msg/ConsumerAddition", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).ConsumerAddition(ctx, req.(*MsgConsumerAddition)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_ConsumerRemoval_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgConsumerRemoval) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).ConsumerRemoval(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/interchain_security.ccv.provider.v1.Msg/ConsumerRemoval", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).ConsumerRemoval(ctx, req.(*MsgConsumerRemoval)) - } - return interceptor(ctx, in, info, handler) -} - 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 { @@ -2265,24 +2111,6 @@ func _Msg_SetConsumerCommissionRate_Handler(srv interface{}, ctx context.Context return interceptor(ctx, in, info, handler) } -func _Msg_ConsumerModification_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgConsumerModification) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).ConsumerModification(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/interchain_security.ccv.provider.v1.Msg/ConsumerModification", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).ConsumerModification(ctx, req.(*MsgConsumerModification)) - } - return interceptor(ctx, in, info, handler) -} - func _Msg_ChangeRewardDenoms_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgChangeRewardDenoms) if err := dec(in); err != nil { @@ -2317,14 +2145,6 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "SubmitConsumerDoubleVoting", Handler: _Msg_SubmitConsumerDoubleVoting_Handler, }, - { - MethodName: "ConsumerAddition", - Handler: _Msg_ConsumerAddition_Handler, - }, - { - MethodName: "ConsumerRemoval", - Handler: _Msg_ConsumerRemoval_Handler, - }, { MethodName: "CreateConsumer", Handler: _Msg_CreateConsumer_Handler, @@ -2353,10 +2173,6 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "SetConsumerCommissionRate", Handler: _Msg_SetConsumerCommissionRate_Handler, }, - { - MethodName: "ConsumerModification", - Handler: _Msg_ConsumerModification_Handler, - }, { MethodName: "ChangeRewardDenoms", Handler: _Msg_ChangeRewardDenoms_Handler, @@ -2393,10 +2209,10 @@ func (m *MsgAssignConsumerKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x2a } - if len(m.Submitter) > 0 { - i -= len(m.Submitter) - copy(dAtA[i:], m.Submitter) - i = encodeVarintTx(dAtA, i, uint64(len(m.Submitter))) + 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] = 0x22 } @@ -2841,29 +2657,6 @@ func (m *MsgConsumerAddition) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgConsumerAdditionResponse) 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 *MsgConsumerAdditionResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgConsumerAdditionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - func (m *MsgConsumerRemoval) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2909,29 +2702,6 @@ func (m *MsgConsumerRemoval) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgConsumerRemovalResponse) 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 *MsgConsumerRemovalResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgConsumerRemovalResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - func (m *MsgRemoveConsumer) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -3090,10 +2860,10 @@ func (m *MsgOptIn) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x2a } - if len(m.Submitter) > 0 { - i -= len(m.Submitter) - copy(dAtA[i:], m.Submitter) - i = encodeVarintTx(dAtA, i, uint64(len(m.Submitter))) + 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] = 0x22 } @@ -3171,10 +2941,10 @@ func (m *MsgOptOut) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x22 } - if len(m.Submitter) > 0 { - i -= len(m.Submitter) - copy(dAtA[i:], m.Submitter) - i = encodeVarintTx(dAtA, i, uint64(len(m.Submitter))) + 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] = 0x1a } @@ -3245,10 +3015,10 @@ func (m *MsgSetConsumerCommissionRate) MarshalToSizedBuffer(dAtA []byte) (int, e i-- dAtA[i] = 0x2a } - if len(m.Submitter) > 0 { - i -= len(m.Submitter) - copy(dAtA[i:], m.Submitter) - i = encodeVarintTx(dAtA, i, uint64(len(m.Submitter))) + 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] = 0x22 } @@ -3657,7 +3427,7 @@ func (m *MsgAssignConsumerKey) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.Submitter) + l = len(m.Signer) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -3841,15 +3611,6 @@ func (m *MsgConsumerAddition) Size() (n int) { return n } -func (m *MsgConsumerAdditionResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - func (m *MsgConsumerRemoval) Size() (n int) { if m == nil { return 0 @@ -3869,15 +3630,6 @@ func (m *MsgConsumerRemoval) Size() (n int) { return n } -func (m *MsgConsumerRemovalResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - func (m *MsgRemoveConsumer) Size() (n int) { if m == nil { return 0 @@ -3956,7 +3708,7 @@ func (m *MsgOptIn) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.Submitter) + l = len(m.Signer) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -3990,7 +3742,7 @@ func (m *MsgOptOut) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.Submitter) + l = len(m.Signer) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -4026,7 +3778,7 @@ func (m *MsgSetConsumerCommissionRate) Size() (n int) { } l = m.Rate.Size() n += 1 + l + sovTx(uint64(l)) - l = len(m.Submitter) + l = len(m.Signer) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -4322,7 +4074,7 @@ func (m *MsgAssignConsumerKey) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Submitter", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4350,7 +4102,7 @@ func (m *MsgAssignConsumerKey) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Submitter = string(dAtA[iNdEx:postIndex]) + m.Signer = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 5: if wireType != 2 { @@ -5665,56 +5417,6 @@ func (m *MsgConsumerAddition) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgConsumerAdditionResponse) 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: MsgConsumerAdditionResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgConsumerAdditionResponse: 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 *MsgConsumerRemoval) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -5862,56 +5564,6 @@ func (m *MsgConsumerRemoval) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgConsumerRemovalResponse) 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: MsgConsumerRemovalResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgConsumerRemovalResponse: 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 *MsgRemoveConsumer) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -6399,7 +6051,7 @@ func (m *MsgOptIn) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Submitter", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -6427,7 +6079,7 @@ func (m *MsgOptIn) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Submitter = string(dAtA[iNdEx:postIndex]) + m.Signer = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 5: if wireType != 2 { @@ -6627,7 +6279,7 @@ func (m *MsgOptOut) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Submitter", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -6655,7 +6307,7 @@ func (m *MsgOptOut) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Submitter = string(dAtA[iNdEx:postIndex]) + m.Signer = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: if wireType != 2 { @@ -6889,7 +6541,7 @@ func (m *MsgSetConsumerCommissionRate) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Submitter", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -6917,7 +6569,7 @@ func (m *MsgSetConsumerCommissionRate) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Submitter = string(dAtA[iNdEx:postIndex]) + m.Signer = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 5: if wireType != 2 { From 50bbbfedeb82ee2f826569cf03bfb04d5e49e60b Mon Sep 17 00:00:00 2001 From: Marius Poke Date: Mon, 9 Sep 2024 15:11:29 +0200 Subject: [PATCH 20/28] fix!: add ConsumeIdsFromTimeQueue to handle consumers at a given time (#2236) * replace GetConsumersReadyToLaunch with ConsumeConsumersReadyToLaunch * add ConsumeIdsFromTimeQueue for both launch and remove * Update x/ccv/provider/keeper/consumer_lifecycle.go Co-authored-by: Simon Noetzlin --------- Co-authored-by: Simon Noetzlin --- x/ccv/provider/keeper/consumer_lifecycle.go | 211 ++++++++---------- .../keeper/consumer_lifecycle_test.go | 194 +++++++++++----- x/ccv/provider/keeper/distribution_test.go | 4 +- x/ccv/provider/keeper/relay_test.go | 9 +- x/ccv/provider/module.go | 8 +- x/ccv/provider/types/keys.go | 4 +- 6 files changed, 243 insertions(+), 187 deletions(-) diff --git a/x/ccv/provider/keeper/consumer_lifecycle.go b/x/ccv/provider/keeper/consumer_lifecycle.go index 19468c6294..bf09f7210f 100644 --- a/x/ccv/provider/keeper/consumer_lifecycle.go +++ b/x/ccv/provider/keeper/consumer_lifecycle.go @@ -61,26 +61,19 @@ func (k Keeper) InitializeConsumer(ctx sdk.Context, consumerId string) (time.Tim } // BeginBlockLaunchConsumers launches initialized consumers that are ready to launch -func (k Keeper) BeginBlockLaunchConsumers(ctx sdk.Context) { - // TODO (PERMISSIONLESS): we can parameterize the limit - for _, consumerId := range k.GetConsumersReadyToLaunch(ctx, 200) { - initializationParameters, err := k.GetConsumerInitializationParameters(ctx, consumerId) - if err != nil { - 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. - err = k.RemoveConsumerToBeLaunched(ctx, consumerId, initializationParameters.SpawnTime) - if err != nil { - ctx.Logger().Error("could not remove consumer from to-be-launched queue", - "consumerId", consumerId, - "error", err) - continue - } - +func (k Keeper) BeginBlockLaunchConsumers(ctx sdk.Context) error { + consumerIds, err := k.ConsumeIdsFromTimeQueue( + ctx, + types.SpawnTimeToConsumerIdsKeyPrefix(), + k.GetConsumersToBeLaunched, + k.DeleteAllConsumersToBeLaunched, + k.AppendConsumerToBeLaunched, + 200, + ) + if err != nil { + return errorsmod.Wrapf(ccv.ErrInvalidConsumerState, "getting consumers ready to laumch: %s", err.Error()) + } + for _, consumerId := range consumerIds { cachedCtx, writeFn := ctx.CacheContext() err = k.LaunchConsumer(cachedCtx, consumerId) if err != nil { @@ -94,49 +87,77 @@ func (k Keeper) BeginBlockLaunchConsumers(ctx sdk.Context) { ctx.EventManager().EmitEvents(cachedCtx.EventManager().Events()) writeFn() } + return nil } -// GetConsumersReadyToLaunch 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) GetConsumersReadyToLaunch(ctx sdk.Context, limit uint32) []string { +// ConsumeIdsFromTimeQueue returns from a time queue the consumer ids for which the associated time passed. +// The number of ids return is limited to 'limit'. The ids returned are removed from the time queue. +func (k Keeper) ConsumeIdsFromTimeQueue( + ctx sdk.Context, + timeQueueKeyPrefix byte, + getIds func(sdk.Context, time.Time) (types.ConsumerIds, error), + deleteAllIds func(sdk.Context, time.Time), + appendId func(sdk.Context, string, time.Time) error, + limit int, +) ([]string, error) { store := ctx.KVStore(k.storeKey) - spawnTimeToConsumerIdsKeyPrefix := types.SpawnTimeToConsumerIdsKeyPrefix() - iterator := storetypes.KVStorePrefixIterator(store, []byte{spawnTimeToConsumerIdsKeyPrefix}) - defer iterator.Close() - result := []string{} + nextTime := []string{} + timestampsToDelete := []time.Time{} + + iterator := storetypes.KVStorePrefixIterator(store, []byte{timeQueueKeyPrefix}) + defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - spawnTime, err := types.ParseTime(spawnTimeToConsumerIdsKeyPrefix, iterator.Key()) + if len(result) >= limit { + break + } + ts, err := types.ParseTime(timeQueueKeyPrefix, iterator.Key()) if err != nil { - k.Logger(ctx).Error("failed to parse spawn time", - "error", err) - continue + return result, fmt.Errorf("parsing removal time: %w", err) } - if spawnTime.After(ctx.BlockTime()) { - return result + if ts.After(ctx.BlockTime()) { + break } - // 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) + consumerIds, err := getIds(ctx, ts) if err != nil { - k.Logger(ctx).Error("failed to retrieve consumers to launch", - "spawn time", spawnTime, - "error", err) - continue + return result, + fmt.Errorf("getting consumers ids, ts(%s): %w", ts.String(), err) } - 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 { + + timestampsToDelete = append(timestampsToDelete, ts) + + availableSlots := limit - len(result) + if availableSlots >= len(consumerIds.Ids) { + // consumer all the ids result = append(result, consumerIds.Ids...) + } else { + // consume only availableSlots + result = append(result, consumerIds.Ids[:availableSlots]...) + // and leave the others for next time + nextTime = consumerIds.Ids[availableSlots:] + break } } - return result + // remove consumers to prevent handling them twice + for i, ts := range timestampsToDelete { + deleteAllIds(ctx, ts) + if i == len(timestampsToDelete)-1 { + // for the last ts consumed, store back the ids for later + for _, consumerId := range nextTime { + err := appendId(ctx, consumerId, ts) + if err != nil { + return result, + fmt.Errorf("failed to append consumer id, consumerId(%s), ts(%s): %w", + consumerId, ts.String(), err) + } + } + } + } + + return result, nil } // LaunchConsumer launches the chain with the provided consumer id by creating the consumer client and the respective @@ -379,26 +400,19 @@ func (k Keeper) StopAndPrepareForConsumerRemoval(ctx sdk.Context, consumerId str } // BeginBlockRemoveConsumers iterates over the pending consumer proposals and stop/removes the chain if the removal time has passed -func (k Keeper) BeginBlockRemoveConsumers(ctx sdk.Context) { - // TODO (PERMISSIONLESS): parameterize the limit - for _, consumerId := range k.GetConsumersReadyToStop(ctx, 200) { - removalTime, err := k.GetConsumerRemovalTime(ctx, consumerId) - if err != nil { - k.Logger(ctx).Error("chain could not be stopped", - "consumerId", consumerId, - "error", err.Error()) - continue - } - - // Remove consumer to prevent re-trying removing this chain. - err = k.RemoveConsumerToBeRemoved(ctx, consumerId, removalTime) - if err != nil { - ctx.Logger().Error("could not remove consumer from to-be-removed queue", - "consumerId", consumerId, - "error", err) - continue - } - +func (k Keeper) BeginBlockRemoveConsumers(ctx sdk.Context) error { + consumerIds, err := k.ConsumeIdsFromTimeQueue( + ctx, + types.RemovalTimeToConsumerIdsKeyPrefix(), + k.GetConsumersToBeRemoved, + k.DeleteAllConsumersToBeRemoved, + k.AppendConsumerToBeRemoved, + 200, + ) + if err != nil { + return errorsmod.Wrapf(ccv.ErrInvalidConsumerState, "getting consumers ready to stop: %s", err.Error()) + } + for _, consumerId := range consumerIds { // delete consumer chain in a cached context to abort deletion in case of errors cachedCtx, writeFn := ctx.CacheContext() err = k.DeleteConsumerChain(cachedCtx, consumerId) @@ -409,58 +423,11 @@ func (k Keeper) BeginBlockRemoveConsumers(ctx sdk.Context) { continue } - // The cached context is created with a new EventManager so we merge the event into the original context + // the cached context is created with a new EventManager so we merge the event into the original context ctx.EventManager().EmitEvents(cachedCtx.EventManager().Events()) - writeFn() - - k.Logger(ctx).Info("executed consumer deletion", - "consumer id", consumerId, - "removal time", removalTime, - ) - } -} - -// GetConsumersReadyToStop returns the consumer ids of the pending launched consumer chains -// that are ready to stop -func (k Keeper) GetConsumersReadyToStop(ctx sdk.Context, limit uint32) []string { - store := ctx.KVStore(k.storeKey) - - removalTimeToConsumerIdsKeyPrefix := types.RemovalTimeToConsumerIdsKeyPrefix() - iterator := storetypes.KVStorePrefixIterator(store, []byte{removalTimeToConsumerIdsKeyPrefix}) - defer iterator.Close() - - result := []string{} - for ; iterator.Valid(); iterator.Next() { - removalTime, err := types.ParseTime(removalTimeToConsumerIdsKeyPrefix, iterator.Key()) - if err != nil { - k.Logger(ctx).Error("failed to parse removal time", - "error", err) - continue - } - if removalTime.After(ctx.BlockTime()) { - return result - } - - consumers, err := k.GetConsumersToBeRemoved(ctx, removalTime) - if err != nil { - k.Logger(ctx).Error("failed to retrieve consumers to remove", - "removal time", removalTime, - "error", err) - continue - } - if len(result)+len(consumers.Ids) >= int(limit) { - remainingConsumerIds := len(result) + len(consumers.Ids) - int(limit) - if len(consumers.Ids[:len(consumers.Ids)-remainingConsumerIds]) == 0 { - return result - } - return append(result, consumers.Ids[:len(consumers.Ids)-remainingConsumerIds]...) - } else { - result = append(result, consumers.Ids...) - } } - - return result + return nil } // DeleteConsumerChain cleans up the state of the given consumer chain @@ -657,6 +624,12 @@ func (k Keeper) RemoveConsumerToBeLaunched(ctx sdk.Context, consumerId string, s return k.removeConsumerIdFromTime(ctx, consumerId, types.SpawnTimeToConsumerIdsKey, spawnTime) } +// DeleteAllConsumersToBeLaunched deletes all consumer to be launched at this specific spawn time +func (k Keeper) DeleteAllConsumersToBeLaunched(ctx sdk.Context, spawnTime time.Time) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.SpawnTimeToConsumerIdsKey(spawnTime)) +} + // GetConsumersToBeRemoved returns all the consumer ids of chains stored under this removal time func (k Keeper) GetConsumersToBeRemoved(ctx sdk.Context, removalTime time.Time) (types.ConsumerIds, error) { return k.getConsumerIdsBasedOnTime(ctx, types.RemovalTimeToConsumerIdsKey, removalTime) @@ -671,3 +644,9 @@ func (k Keeper) AppendConsumerToBeRemoved(ctx sdk.Context, consumerId string, re func (k Keeper) RemoveConsumerToBeRemoved(ctx sdk.Context, consumerId string, removalTime time.Time) error { return k.removeConsumerIdFromTime(ctx, consumerId, types.RemovalTimeToConsumerIdsKey, removalTime) } + +// DeleteAllConsumersToBeRemoved deletes all consumer to be removed at this specific removal time +func (k Keeper) DeleteAllConsumersToBeRemoved(ctx sdk.Context, removalTime time.Time) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.RemovalTimeToConsumerIdsKey(removalTime)) +} diff --git a/x/ccv/provider/keeper/consumer_lifecycle_test.go b/x/ccv/provider/keeper/consumer_lifecycle_test.go index cadedbf9df..a412b8826c 100644 --- a/x/ccv/provider/keeper/consumer_lifecycle_test.go +++ b/x/ccv/provider/keeper/consumer_lifecycle_test.go @@ -316,7 +316,8 @@ func TestBeginBlockLaunchConsumers(t *testing.T) { providerKeeper.SetOptedIn(ctx, "3", providertypes.NewProviderConsAddress(consAddr)) - providerKeeper.BeginBlockLaunchConsumers(ctx) + err := providerKeeper.BeginBlockLaunchConsumers(ctx) + require.NoError(t, err) // first chain was successfully launched phase := providerKeeper.GetConsumerPhase(ctx, "0") @@ -351,41 +352,140 @@ func TestBeginBlockLaunchConsumers(t *testing.T) { require.False(t, found) } -// TestGetConsumersReadyToLaunch tests that the ready to-be-launched consumer chains are returned -func TestGetConsumersReadyToLaunch(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.GetConsumersReadyToLaunch(ctx, 5)) +func TestConsumeIdsFromTimeQueue(t *testing.T) { + expectedConsumerIds := []string{"1", "2", "3", "4"} + timestamps := []time.Time{time.Unix(10, 0), time.Unix(20, 0), time.Unix(30, 0)} - err := providerKeeper.AppendConsumerToBeLaunched(ctx, "consumerId1", time.Unix(10, 0)) - require.NoError(t, err) - err = providerKeeper.AppendConsumerToBeLaunched(ctx, "consumerId2", time.Unix(20, 0)) - require.NoError(t, err) - err = providerKeeper.AppendConsumerToBeLaunched(ctx, "consumerId3", time.Unix(30, 0)) - require.NoError(t, err) + testCases := []struct { + name string + ts time.Time + limit int + expOutcome func(sdk.Context, []string, func(sdk.Context, time.Time) (providertypes.ConsumerIds, error)) + }{ + { + name: "timestamp too early", + ts: time.Unix(9, 999999999), + limit: 3, + expOutcome: func(ctx sdk.Context, ids []string, getIds func(sdk.Context, time.Time) (providertypes.ConsumerIds, error)) { + require.Empty(t, ids) + }, + }, + { + name: "first timestamp", + ts: timestamps[0], + limit: 2, + expOutcome: func(ctx sdk.Context, ids []string, getIds func(sdk.Context, time.Time) (providertypes.ConsumerIds, error)) { + require.Equal(t, expectedConsumerIds[0:2], ids) + + // check that all consumers where removed + consumerIds, err := getIds(ctx, timestamps[0]) + require.NoError(t, err) + require.Empty(t, consumerIds) + }, + }, + { + name: "first timestamp, with limit", + ts: timestamps[0], + limit: 1, + expOutcome: func(ctx sdk.Context, ids []string, getIds func(sdk.Context, time.Time) (providertypes.ConsumerIds, error)) { + require.Equal(t, expectedConsumerIds[0:1], ids) + + // second consumer remained + ret, err := getIds(ctx, timestamps[0]) + require.NoError(t, err) + require.Equal(t, providertypes.ConsumerIds{ + Ids: []string{expectedConsumerIds[1]}, + }, ret) + }, + }, + { + name: "second timestamp", + ts: timestamps[1], + limit: 3, + expOutcome: func(ctx sdk.Context, ids []string, getIds func(sdk.Context, time.Time) (providertypes.ConsumerIds, error)) { + require.Equal(t, expectedConsumerIds[0:3], ids) + + // check that all consumers where removed + ret, err := getIds(ctx, timestamps[0]) + require.NoError(t, err) + require.Empty(t, ret) + ret, err = getIds(ctx, timestamps[1]) + require.NoError(t, err) + require.Empty(t, ret) + }, + }, + { + name: "third timestamp, with limit", + ts: timestamps[1], + limit: 3, + expOutcome: func(ctx sdk.Context, ids []string, getIds func(sdk.Context, time.Time) (providertypes.ConsumerIds, error)) { + require.Equal(t, expectedConsumerIds[0:3], ids) + + // 4th consumer remained + ret, err := getIds(ctx, timestamps[0]) + require.NoError(t, err) + require.Empty(t, ret) + ret, err = getIds(ctx, timestamps[1]) + require.NoError(t, err) + require.Empty(t, ret) + ret, err = getIds(ctx, timestamps[2]) + require.NoError(t, err) + require.Equal(t, providertypes.ConsumerIds{ + Ids: []string{expectedConsumerIds[3]}, + }, ret) + }, + }, + } - // time has not yet reached the spawn time of "consumerId1" - ctx = ctx.WithBlockTime(time.Unix(9, 999999999)) - require.Empty(t, providerKeeper.GetConsumersReadyToLaunch(ctx, 3)) + // test for consumers to be launched + for _, tc := range testCases { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() - // time has reached the spawn time of "consumerId1" - ctx = ctx.WithBlockTime(time.Unix(10, 0)) - require.Equal(t, []string{"consumerId1"}, providerKeeper.GetConsumersReadyToLaunch(ctx, 3)) + callCases := []struct { + timeQueueKeyPrefix byte + getIds func(sdk.Context, time.Time) (providertypes.ConsumerIds, error) + deleteAllIds func(sdk.Context, time.Time) + appendId func(sdk.Context, string, time.Time) error + }{ + { + timeQueueKeyPrefix: providertypes.SpawnTimeToConsumerIdsKeyPrefix(), + getIds: providerKeeper.GetConsumersToBeLaunched, + deleteAllIds: providerKeeper.DeleteAllConsumersToBeLaunched, + appendId: providerKeeper.AppendConsumerToBeLaunched, + }, + { + timeQueueKeyPrefix: providertypes.RemovalTimeToConsumerIdsKeyPrefix(), + getIds: providerKeeper.GetConsumersToBeRemoved, + deleteAllIds: providerKeeper.DeleteAllConsumersToBeRemoved, + appendId: providerKeeper.AppendConsumerToBeRemoved, + }, + } + for _, cc := range callCases { + err := cc.appendId(ctx, expectedConsumerIds[0], timestamps[0]) + require.NoError(t, err) + err = cc.appendId(ctx, expectedConsumerIds[1], timestamps[0]) + require.NoError(t, err) + err = cc.appendId(ctx, expectedConsumerIds[2], timestamps[1]) + require.NoError(t, err) + err = cc.appendId(ctx, expectedConsumerIds[3], timestamps[2]) + require.NoError(t, err) - // time has reached the spawn time of "consumerId1" and "consumerId2" - ctx = ctx.WithBlockTime(time.Unix(20, 0)) - require.Equal(t, []string{"consumerId1", "consumerId2"}, providerKeeper.GetConsumersReadyToLaunch(ctx, 3)) + ctx = ctx.WithBlockTime(tc.ts) - // time has reached the spawn time of all chains - ctx = ctx.WithBlockTime(time.Unix(30, 0)) - require.Equal(t, []string{"consumerId1", "consumerId2", "consumerId3"}, providerKeeper.GetConsumersReadyToLaunch(ctx, 3)) + consumerIds, err := providerKeeper.ConsumeIdsFromTimeQueue( + ctx, + cc.timeQueueKeyPrefix, + cc.getIds, + cc.deleteAllIds, + cc.appendId, + tc.limit, + ) + require.NoError(t, err) - // limit the number of returned consumer chains - require.Equal(t, []string{}, providerKeeper.GetConsumersReadyToLaunch(ctx, 0)) - require.Equal(t, []string{"consumerId1"}, providerKeeper.GetConsumersReadyToLaunch(ctx, 1)) - require.Equal(t, []string{"consumerId1", "consumerId2"}, providerKeeper.GetConsumersReadyToLaunch(ctx, 2)) + tc.expOutcome(ctx, consumerIds, cc.getIds) + } + } } // Tests the CreateConsumerClient method against the spec, @@ -751,7 +851,8 @@ func TestBeginBlockStopConsumers(t *testing.T) { // Test execution // - providerKeeper.BeginBlockRemoveConsumers(ctx) + err = providerKeeper.BeginBlockRemoveConsumers(ctx) + require.NoError(t, err) // Only the 3rd (final) proposal is still stored as pending phase := providerKeeper.GetConsumerPhase(ctx, consumerIds[0]) @@ -763,37 +864,6 @@ func TestBeginBlockStopConsumers(t *testing.T) { require.Equal(t, providertypes.CONSUMER_PHASE_STOPPED, phase) } -func TestGetConsumersReadyToStop(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.GetConsumersReadyToStop(ctx, 3)) - - err := providerKeeper.AppendConsumerToBeRemoved(ctx, "consumerId1", time.Unix(10, 0)) - require.NoError(t, err) - err = providerKeeper.AppendConsumerToBeRemoved(ctx, "consumerId2", time.Unix(20, 0)) - require.NoError(t, err) - err = providerKeeper.AppendConsumerToBeRemoved(ctx, "consumerId3", time.Unix(30, 0)) - require.NoError(t, err) - - // time has not yet reached the removal time of "consumerId1" - ctx = ctx.WithBlockTime(time.Unix(9, 999999999)) - require.Empty(t, providerKeeper.GetConsumersReadyToStop(ctx, 3)) - - // time has reached the removal time of "consumerId1" - ctx = ctx.WithBlockTime(time.Unix(10, 0)) - require.Equal(t, []string{"consumerId1"}, providerKeeper.GetConsumersReadyToStop(ctx, 3)) - - // time has reached the removal time of "consumerId1" and "consumerId2" - ctx = ctx.WithBlockTime(time.Unix(20, 0)) - require.Equal(t, []string{"consumerId1", "consumerId2"}, providerKeeper.GetConsumersReadyToStop(ctx, 3)) - - // time has reached the removal time of all chains - ctx = ctx.WithBlockTime(time.Unix(30, 0)) - require.Equal(t, []string{"consumerId1", "consumerId2", "consumerId3"}, providerKeeper.GetConsumersReadyToStop(ctx, 3)) -} - // Tests the DeleteConsumerChain method against the spec, // with more granularity than what's covered in TestHandleLegacyConsumerRemovalProposal, or integration tests. // See: https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/methods.md#ccv-pcf-stcc1 diff --git a/x/ccv/provider/keeper/distribution_test.go b/x/ccv/provider/keeper/distribution_test.go index d9ff18ac75..1fa48eb49f 100644 --- a/x/ccv/provider/keeper/distribution_test.go +++ b/x/ccv/provider/keeper/distribution_test.go @@ -38,7 +38,7 @@ func TestComputeConsumerTotalVotingPower(t *testing.T) { return *val } - chainID := "consumer" + chainID := CONSUMER_CHAIN_ID expTotalPower := int64(0) // verify that the total power returned is equal to zero @@ -76,7 +76,7 @@ func TestComputeConsumerTotalVotingPower(t *testing.T) { func TestIdentifyConsumerChainIDFromIBCPacket(t *testing.T) { var ( - chainID = "consumer" + chainID = CONSUMER_CHAIN_ID ccvChannel = "channel-0" ) diff --git a/x/ccv/provider/keeper/relay_test.go b/x/ccv/provider/keeper/relay_test.go index 3a6c1bc757..7923056fe0 100644 --- a/x/ccv/provider/keeper/relay_test.go +++ b/x/ccv/provider/keeper/relay_test.go @@ -532,7 +532,8 @@ func TestSendVSCPacketsToChainFailure(t *testing.T) { // Increase the block time by `unbondingTime` so the chain actually gets deleted ctx = ctx.WithBlockTime(ctx.BlockTime().Add(unbondingTime)) - providerKeeper.BeginBlockRemoveConsumers(ctx) + err = providerKeeper.BeginBlockRemoveConsumers(ctx) + require.NoError(t, err) // Pending VSC packets should be deleted in DeleteConsumerChain require.Empty(t, providerKeeper.GetPendingVSCPackets(ctx, CONSUMER_ID)) @@ -583,7 +584,8 @@ func TestOnTimeoutPacketStopsChain(t *testing.T) { // increase the block time by `unbondingTime` so the chain actually gets deleted ctx = ctx.WithBlockTime(ctx.BlockTime().Add(unbondingTime)) - providerKeeper.BeginBlockRemoveConsumers(ctx) + err = providerKeeper.BeginBlockRemoveConsumers(ctx) + require.NoError(t, err) testkeeper.TestProviderStateIsCleanedAfterConsumerChainIsDeleted(t, ctx, providerKeeper, CONSUMER_ID, "channelID", false) } @@ -635,7 +637,8 @@ func TestOnAcknowledgementPacketWithAckError(t *testing.T) { // increase the block time by `unbondingTime` so the chain actually gets deleted ctx = ctx.WithBlockTime(ctx.BlockTime().Add(unbondingTime)) - providerKeeper.BeginBlockRemoveConsumers(ctx) + err = providerKeeper.BeginBlockRemoveConsumers(ctx) + require.NoError(t, err) testkeeper.TestProviderStateIsCleanedAfterConsumerChainIsDeleted(t, ctx, providerKeeper, CONSUMER_ID, "channelID", false) } diff --git a/x/ccv/provider/module.go b/x/ccv/provider/module.go index 487cffbefc..027fd2ac72 100644 --- a/x/ccv/provider/module.go +++ b/x/ccv/provider/module.go @@ -175,9 +175,13 @@ func (am AppModule) BeginBlock(ctx context.Context) error { sdkCtx := sdk.UnwrapSDKContext(ctx) // Create clients to consumer chains that are due to be spawned - am.keeper.BeginBlockLaunchConsumers(sdkCtx) + if err := am.keeper.BeginBlockLaunchConsumers(sdkCtx); err != nil { + return err + } // Stop and remove state for any consumer chains that are due to be stopped - am.keeper.BeginBlockRemoveConsumers(sdkCtx) + if err := am.keeper.BeginBlockRemoveConsumers(sdkCtx); err != nil { + return err + } // Check for replenishing slash meter before any slash packets are processed for this block am.keeper.BeginBlockCIS(sdkCtx) // BeginBlock logic needed for the Reward Distribution sub-protocol diff --git a/x/ccv/provider/types/keys.go b/x/ccv/provider/types/keys.go index c10f0a1cb9..62869dcebf 100644 --- a/x/ccv/provider/types/keys.go +++ b/x/ccv/provider/types/keys.go @@ -719,12 +719,12 @@ func RemovalTimeToConsumerIdsKeyPrefix() byte { // RemovalTimeToConsumerIdsKey returns the key prefix for storing the removal times of consumer chains // that are about to be removed -func RemovalTimeToConsumerIdsKey(spawnTime time.Time) []byte { +func RemovalTimeToConsumerIdsKey(removalTime time.Time) []byte { return ccvtypes.AppendMany( // append the prefix []byte{RemovalTimeToConsumerIdsKeyPrefix()}, // append the time - sdk.FormatTimeBytes(spawnTime), + sdk.FormatTimeBytes(removalTime), ) } From c7171b26e1723f7ab859c629c420ba6a4072dcf3 Mon Sep 17 00:00:00 2001 From: bernd-m <43466467+bermuell@users.noreply.github.com> Date: Mon, 9 Sep 2024 16:37:25 +0200 Subject: [PATCH 21/28] test: Add e2e tests for permissionless ICS (#2223) * Add e2e tests for permissionless ICS * addressed comments --- tests/e2e/actions.go | 83 +++++---- tests/e2e/config.go | 71 +++++++- tests/e2e/main.go | 21 +-- tests/e2e/state.go | 4 +- tests/e2e/steps_partial_set_security.go | 2 +- tests/e2e/steps_permissionless_ics.go | 211 +++++++++++++++++++++++ tests/e2e/steps_start_chains.go | 141 +++++++++++++++ tests/e2e/test_runner.go | 10 +- tests/e2e/testnet-scripts/start-chain.sh | 94 +++++----- 9 files changed, 533 insertions(+), 104 deletions(-) create mode 100644 tests/e2e/steps_permissionless_ics.go diff --git a/tests/e2e/actions.go b/tests/e2e/actions.go index a47219b5af..7cec626ec9 100644 --- a/tests/e2e/actions.go +++ b/tests/e2e/actions.go @@ -172,6 +172,7 @@ func (tr *Chain) startChain( cometmockArg = "false" } + chainHome := string(action.Chain) startChainScript := tr.target.GetTestScriptPath(action.IsConsumer, "start-chain.sh") cmd := tr.target.ExecCommand("/bin/bash", startChainScript, chainConfig.BinaryName, string(vals), @@ -183,6 +184,7 @@ func (tr *Chain) startChain( // with short timeout_commit (eg. timeout_commit = 1s) some nodes may miss blocks causing the test run to fail tr.testConfig.tendermintConfigOverride, cometmockArg, + chainHome, ) cmdReader, err := cmd.StdoutPipe() @@ -311,7 +313,7 @@ func (tr Chain) updateConsumerChain(action UpdateConsumerChainAction, verbose bo InitializationParameters: &initParams, PowerShapingParameters: &powerShapingParams, } - tr.UpdateConsumer(action.Chain, action.From, msg) + tr.UpdateConsumer(action.Chain, action.From, msg, verbose) } type CreateConsumerChainAction struct { @@ -333,6 +335,13 @@ type CreateConsumerChainAction struct { // createConsumerChain creates and initializes a consumer chain func (tr Chain) createConsumerChain(action CreateConsumerChainAction, verbose bool) { spawnTime := tr.testConfig.containerConfig.Now.Add(time.Duration(action.SpawnTime) * time.Millisecond) + consumerChainCfg := tr.testConfig.chainConfigs[action.ConsumerChain] + providerChainCfg := tr.testConfig.chainConfigs[action.Chain] + + if consumerChainCfg.ConsumerId != "" { + log.Fatalf("consumer chain already created for '%s'", action.ConsumerChain) + } + params := ccvtypes.DefaultParams() initParams := types.ConsumerInitializationParameters{ InitialHeight: action.InitialHeight, @@ -360,16 +369,20 @@ func (tr Chain) createConsumerChain(action CreateConsumerChainAction, verbose bo } metadata := types.ConsumerMetadata{ - Name: "chain name of " + string(action.Chain), + Name: "chain name of " + string(consumerChainCfg.ChainId), Description: "no description", Metadata: "no metadata", } // create consumer to get a consumer-id - consumerId := tr.CreateConsumer(action.Chain, action.ConsumerChain, action.From, metadata, &initParams, &powerShapingParams) + consumerId := tr.CreateConsumer(providerChainCfg.ChainId, consumerChainCfg.ChainId, action.From, metadata, &initParams, &powerShapingParams) if verbose { - fmt.Println("Create consumer chain", string(action.ConsumerChain), " with consumer-id", string(consumerId)) + fmt.Println("Created consumer chain", string(consumerChainCfg.ChainId), " with consumer-id", string(consumerId)) } + + // Set the new created consumer-id on the chain's config + consumerChainCfg.ConsumerId = consumerId + tr.testConfig.chainConfigs[action.ConsumerChain] = consumerChainCfg } type SubmitConsumerAdditionProposalAction struct { @@ -390,7 +403,7 @@ type SubmitConsumerAdditionProposalAction struct { AllowInactiveVals bool } -func (tr Chain) UpdateConsumer(providerChain ChainID, validator ValidatorID, update types.MsgUpdateConsumer) { +func (tr Chain) UpdateConsumer(providerChain ChainID, validator ValidatorID, update types.MsgUpdateConsumer, verbose bool) { content, err := json.Marshal(update) if err != nil { log.Fatal("failed marshalling MsgUpdateConsumer: ", err.Error()) @@ -419,7 +432,8 @@ func (tr Chain) UpdateConsumer(providerChain ChainID, validator ValidatorID, upd bz, err = cmd.CombinedOutput() if err != nil { - log.Fatal("update consumer failed ", "error: ", err, "output: ", string(bz)) + fmt.Println("command failed: ", cmd) + log.Fatal("update consumer failed error: %w, output: %s", err, string(bz)) } // Check transaction @@ -432,14 +446,19 @@ func (tr Chain) UpdateConsumer(providerChain ChainID, validator ValidatorID, upd if txResponse.Code != 0 { log.Fatalf("sending update-consumer transaction failed with error code %d, Log:'%s'", txResponse.Code, txResponse.RawLog) } + + if verbose { + fmt.Println("running 'update-consumer' returned: ", txResponse) + } + tr.waitBlocks(providerChain, 2, 10*time.Second) } // CreateConsumer creates a consumer chain and returns its consumer-id func (tr Chain) CreateConsumer(providerChain, consumerChain ChainID, validator ValidatorID, metadata types.ConsumerMetadata, initParams *types.ConsumerInitializationParameters, powerShapingParams *types.PowerShapingParameters) ConsumerID { - chainID := string(tr.testConfig.chainConfigs[consumerChain].ChainId) + msg := types.MsgCreateConsumer{ - ChainId: chainID, + ChainId: string(consumerChain), Metadata: metadata, InitializationParameters: initParams, PowerShapingParameters: powerShapingParams, @@ -522,19 +541,7 @@ func (tr Chain) CreateConsumer(providerChain, consumerChain ChainID, validator V log.Fatalf("no consumer-id found in consumer creation transaction events for chain '%s'. events: %v", consumerChain, txResponse.Events) } - cfg, exists := tr.testConfig.chainConfigs[e2e.ChainID(chainID)] - if !exists { - log.Fatal("no chain config found for consumer chain", chainID) - } - if cfg.ConsumerId != "" && cfg.ConsumerId != e2e.ConsumerID(consumerId) { - log.Fatalf("chain '%s'registered already with a different consumer ID '%s'", chainID, consumerId) - } - - // Set the new created consumer-id on the chain's config - cfg.ConsumerId = e2e.ConsumerID(consumerId) - tr.testConfig.chainConfigs[e2e.ChainID(chainID)] = cfg - - return e2e.ConsumerID(consumerId) + return ConsumerID(consumerId) } // submitConsumerAdditionProposal initializes a consumer chain and submits a governance proposal @@ -544,6 +551,8 @@ func (tr Chain) submitConsumerAdditionProposal( ) { params := ccvtypes.DefaultParams() spawnTime := tr.testConfig.containerConfig.Now.Add(time.Duration(action.SpawnTime) * time.Millisecond) + consumerChainCfg := tr.testConfig.chainConfigs[action.ConsumerChain] + providerChainCfg := tr.testConfig.chainConfigs[action.Chain] Metadata := types.ConsumerMetadata{ Name: "chain " + string(action.Chain), @@ -566,8 +575,11 @@ func (tr Chain) submitConsumerAdditionProposal( DistributionTransmissionChannel: action.DistributionChannel, } - consumerId := tr.CreateConsumer(action.Chain, action.ConsumerChain, action.From, Metadata, nil, nil) + consumerId := tr.CreateConsumer(providerChainCfg.ChainId, consumerChainCfg.ChainId, action.From, Metadata, nil, nil) authority := "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn" + // Set the new created consumer-id on the chain's config + consumerChainCfg.ConsumerId = consumerId + tr.testConfig.chainConfigs[action.ConsumerChain] = consumerChainCfg // Update consumer to change owner to governance before submitting the proposal update := &types.MsgUpdateConsumer{ @@ -585,7 +597,7 @@ func (tr Chain) submitConsumerAdditionProposal( AllowInactiveVals: action.AllowInactiveVals, } update.PowerShapingParameters = &powerShapingParameters - tr.UpdateConsumer(action.Chain, action.From, *update) + tr.UpdateConsumer(action.Chain, action.From, *update, verbose) // - set PowerShaping params TopN > 0 for consumer chain update.PowerShapingParameters.Top_N = action.TopN @@ -618,10 +630,10 @@ func (tr Chain) submitConsumerAdditionProposal( tr.testConfig.chainConfigs[action.Chain].BinaryName, "tx", "gov", "submit-proposal", proposalFile, `--from`, `validator`+fmt.Sprint(action.From), - `--chain-id`, string(tr.testConfig.chainConfigs[action.Chain].ChainId), - `--home`, tr.getValidatorHome(action.Chain, action.From), + `--chain-id`, string(providerChainCfg.ChainId), + `--home`, tr.getValidatorHome(providerChainCfg.ChainId, action.From), `--gas`, `900000`, - `--node`, tr.getValidatorNode(action.Chain, action.From), + `--node`, tr.getValidatorNode(providerChainCfg.ChainId, action.From), `--keyring-backend`, `test`, `-o json`, `-y`, @@ -651,7 +663,7 @@ func (tr Chain) submitConsumerAdditionProposal( } // wait for inclusion in a block -> '--broadcast-mode block' is deprecated - tr.waitBlocks(action.Chain, 2, 10*time.Second) + tr.waitBlocks(providerChainCfg.ChainId, 2, 10*time.Second) } func (tr Chain) submitConsumerAdditionLegacyProposal( @@ -2885,8 +2897,10 @@ func (tr Chain) startConsumerEvidenceDetector( } type OptInAction struct { - Chain ChainID - Validator ValidatorID + Chain ChainID + Validator ValidatorID + ExpectError bool + ExpectedError string } func (tr Chain) optIn(action OptInAction, verbose bool) { @@ -2919,14 +2933,21 @@ func (tr Chain) optIn(action OptInAction, verbose bool) { } bz, err := cmd.CombinedOutput() - if err != nil { + if err != nil && !action.ExpectError { log.Fatal(err, "\n", string(bz)) } - if !tr.testConfig.useCometmock { // error report only works with --gas auto, which does not work with CometMock, so ignore + if action.ExpectError && !tr.testConfig.useCometmock { // error report only works with --gas auto, which does not work with CometMock, so ignore if err != nil && verbose { fmt.Printf("got error during opt in | err: %s | output: %s \n", err, string(bz)) } + if err == nil || !strings.Contains(string(bz), action.ExpectedError) { + log.Fatalf("expected error not raised: expected: '%s', got '%s'", action.ExpectedError, (bz)) + } + + if verbose { + fmt.Printf("got expected error during key assignment | err: %s | output: %s \n", err, string(bz)) + } } // wait for inclusion in a block -> '--broadcast-mode block' is deprecated diff --git a/tests/e2e/config.go b/tests/e2e/config.go index f97cfb5df9..65ffab74b7 100644 --- a/tests/e2e/config.go +++ b/tests/e2e/config.go @@ -101,6 +101,7 @@ const ( InactiveValsMintTestCfg TestConfigType = "inactive-vals-mint" MintTestCfg TestConfigType = "mint" InactiveValsExtraValsTestCfg TestConfigType = "inactive-vals-extra-vals" + PermissionlessTestCfg TestConfigType = "permissionless-ics" ) type TestConfig struct { @@ -109,6 +110,7 @@ type TestConfig struct { containerConfig ContainerConfig validatorConfigs map[ValidatorID]ValidatorConfig chainConfigs map[ChainID]ChainConfig + consumerChains map[ConsumerID]ChainConfig providerVersion string consumerVersion string // override config.toml parameters @@ -210,6 +212,8 @@ func GetTestConfig(cfgType TestConfigType, providerVersion, consumerVersion stri testCfg = MintTestConfig() case InactiveValsExtraValsTestCfg: testCfg = InactiveValsExtraValsTestConfig() + case PermissionlessTestCfg: + testCfg = PermissionlessTestConfig() default: panic(fmt.Sprintf("Invalid test config: %s", cfgType)) } @@ -594,6 +598,68 @@ func DemocracyTestConfig(allowReward bool) TestConfig { return tr } +// PermissionlessTestConfig contains a provider chain and 2 cosumer chains with the same chain identifier +func PermissionlessTestConfig() TestConfig { + tr := TestConfig{ + name: string(PermissionlessTestCfg), + containerConfig: e2e.ContainerConfig{ + ContainerName: "interchain-security-container", + InstanceName: "interchain-security-instance", + CcvVersion: "1", + Now: time.Now(), + }, + validatorConfigs: getDefaultValidators(), + chainConfigs: map[ChainID]e2e.ChainConfig{ + "provi": { + ChainId: ChainID("provi"), + AccountPrefix: ProviderAccountPrefix, + BinaryName: "interchain-security-pd", + IpPrefix: "7.7.7", + VotingWaitTime: 20, + GenesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " + + ".app_state.gov.params.expedited_voting_period = \"10s\" | " + + // Custom slashing parameters for testing validator downtime functionality + // See https://docs.cosmos.network/main/modules/slashing/04_begin_block.html#uptime-tracking + ".app_state.slashing.params.signed_blocks_window = \"10\" | " + + ".app_state.slashing.params.min_signed_per_window = \"0.500000000000000000\" | " + + ".app_state.slashing.params.downtime_jail_duration = \"60s\" | " + + ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " + + ".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\" | " + // This disables slash packet throttling + ".app_state.provider.params.slash_meter_replenish_period = \"3s\" | " + + ".app_state.provider.params.blocks_per_epoch = 3", + }, + "cons1": { + ChainId: ChainID("consu"), + AccountPrefix: ConsumerAccountPrefix, + BinaryName: "interchain-security-cd", + IpPrefix: "7.7.8", + VotingWaitTime: 20, + GenesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " + + ".app_state.slashing.params.signed_blocks_window = \"20\" | " + + ".app_state.slashing.params.min_signed_per_window = \"0.500000000000000000\" | " + + ".app_state.slashing.params.downtime_jail_duration = \"60s\" | " + + ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\"", + }, + // ChainID needs to be "consu" as previous consumer chain + "cons2": { + ChainId: ChainID("consu"), + AccountPrefix: ConsumerAccountPrefix, + BinaryName: "interchain-security-cd", + IpPrefix: "7.7.9", + VotingWaitTime: 20, + GenesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " + + ".app_state.slashing.params.signed_blocks_window = \"20\" | " + + ".app_state.slashing.params.min_signed_per_window = \"0.500000000000000000\" | " + + ".app_state.slashing.params.downtime_jail_duration = \"60s\" | " + + ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\"", + }, + }, + tendermintConfigOverride: `s/timeout_commit = "5s"/timeout_commit = "1s"/;` + + `s/peer_gossip_sleep_duration = "100ms"/peer_gossip_sleep_duration = "50ms"/;`, + } + tr.Initialize() + return tr +} func InactiveProviderValsTestConfig() TestConfig { tr := DefaultTestConfig() tr.name = "InactiveValsConfig" @@ -958,11 +1024,11 @@ func (s *TestConfig) validateStringLiterals() { for chainID, chainConfig := range s.chainConfigs { if len(chainID) > 5 { - panic("chain id string literal must be 5 char or less") + panic(fmt.Sprintf("chain id string literal must be 5 char or less: %s", chainID)) } if chainID != chainConfig.ChainId { - panic("chain config is mapped to a chain id that is different than what's stored in the config") + log.Println("chain config is mapped to a chain id that is different than what's stored in the config") } } } @@ -1266,6 +1332,7 @@ func getValidatorConfigFromVersion(providerVersion, consumerVersion string) map[ // If provided version is before v1.6.0 then a configuration based on template for v1.4.x is returned // otherwise the returned configuration is based on template v1.4. func GetHermesConfig(hermesVersion, queryNodeIP string, chainCfg ChainConfig, isConsumer bool) string { + ChainId := chainCfg.ChainId keyName := "query" rpcAddr := "http://" + queryNodeIP + ":26658" diff --git a/tests/e2e/main.go b/tests/e2e/main.go index e8ae6b2166..3a834a482a 100644 --- a/tests/e2e/main.go +++ b/tests/e2e/main.go @@ -246,13 +246,12 @@ var stepChoices = map[string]StepChoice{ description: "test minting without inactive validators as a sanity check", testConfig: MintTestCfg, }, - // TODO PERMISSIONLESS: ADD NEW E2E TEST - /* "permissionless-ics": { + "permissionless-ics": { name: "permissionless-ics", steps: stepsPermissionlessICS(), description: "test permissionless ics", - testConfig: DefaultTestCfg, - }, */ + testConfig: PermissionlessTestCfg, + }, "inactive-vals-outside-max-validators": { name: "inactive-vals-outside-max-validators", steps: stepsInactiveValsTopNReproduce(), @@ -540,6 +539,7 @@ func printReport(runners []TestRunner, duration time.Duration) { } numTotalTests := len(runners) report := ` + ================================================= TEST RESULTS ------------------------------------------------- @@ -577,19 +577,6 @@ Summary: len(remainingTests), numTotalTests, ) - report += fmt.Sprintln("\nFAILED TESTS:") - for _, t := range failedTests { - report += t.Report() - } - report += fmt.Sprintln("\n\nPASSED TESTS:") - for _, t := range passedTests { - report += t.Report() - } - - report += fmt.Sprintln("\n\nREMAINING TESTS:") - for _, t := range remainingTests { - report += t.Report() - } report += "==================================================" fmt.Print(report) } diff --git a/tests/e2e/state.go b/tests/e2e/state.go index f03380be89..4ca4a41f09 100644 --- a/tests/e2e/state.go +++ b/tests/e2e/state.go @@ -316,7 +316,7 @@ func (tr Chain) getValidatorIP(chain ChainID, validator ValidatorID) string { } func (tr Chain) getValidatorHome(chain ChainID, validator ValidatorID) string { - return `/` + string(tr.testConfig.chainConfigs[chain].ChainId) + `/validator` + fmt.Sprint(validator) + return `/` + string(chain) + `/validator` + fmt.Sprint(validator) } func (tr Chain) curlJsonRPCRequest(method, params, address string) { @@ -926,7 +926,7 @@ func (tr Commands) GetHasToValidate( log.Fatal(err, "\n", string(bz)) } - arr := gjson.Get(string(bz), "consumer_chain_ids").Array() + arr := gjson.Get(string(bz), "consumer_ids").Array() chains := []ChainID{} for _, c := range arr { for _, chain := range tr.chainConfigs { diff --git a/tests/e2e/steps_partial_set_security.go b/tests/e2e/steps_partial_set_security.go index f2646c5cd3..dbe32fc26d 100644 --- a/tests/e2e/steps_partial_set_security.go +++ b/tests/e2e/steps_partial_set_security.go @@ -1752,7 +1752,7 @@ func stepsValidatorsDenylistedChain() []Step { ChainID("consu"): ChainState{ ValPowers: &map[ValidatorID]uint{ ValidatorID("alice"): 100, - // "bob" is denylisted and hence does not valiate the consumer chain + // "bob" is denylisted and hence does not validate the consumer chain ValidatorID("bob"): 0, ValidatorID("carol"): 300, }, diff --git a/tests/e2e/steps_permissionless_ics.go b/tests/e2e/steps_permissionless_ics.go new file mode 100644 index 0000000000..1da18cb2e0 --- /dev/null +++ b/tests/e2e/steps_permissionless_ics.go @@ -0,0 +1,211 @@ +package main + +import ( + "time" + + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + e2e "github.com/cosmos/interchain-security/v6/tests/e2e/testlib" +) + +// stepsPermissionlessICS tests +// - starting multiple permissionless consumer chains with the same chain ID +// - that a validator CANNOT opt-in on two different chains with the same chain ID +// - taking ownership of a consumer chain +func stepsPermissionlessICS() []Step { + s := concatSteps( + []Step{ + // Start the provider chain + { + Action: StartChainAction{ + Chain: ChainID("provi"), + Validators: []StartChainValidator{ + {Id: ValidatorID("alice"), Stake: 100000000, Allocation: 10000000000}, + {Id: ValidatorID("bob"), Stake: 200000000, Allocation: 10000000000}, + {Id: ValidatorID("carol"), Stake: 300000000, Allocation: 10000000000}, + }, + }, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 100, + ValidatorID("bob"): 200, + ValidatorID("carol"): 300, + }, + }, + }, + }, + + // Initialize a permissionless chain with ChainID `consu` + // - create the consumer chain + // - opt-in a validator + // - launch the chain + { + Action: CreateConsumerChainAction{ + Chain: ChainID("provi"), + From: ValidatorID("alice"), + ConsumerChain: ChainID("cons2"), // test chain "cons2" is configured with ChainID "consu" + SpawnTime: uint(time.Minute * 3), + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + TopN: 0, + }, + State: State{}, + }, + { + Action: OptInAction{ + Chain: ChainID("cons2"), + Validator: ValidatorID("alice"), + }, + State: State{ + ChainID("provi"): ChainState{ + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {}, + ValidatorID("bob"): {}, + ValidatorID("carol"): {}, + }, + }, + }, + }, + }, + // Start another permissionless chain with ChainID `consu` + // test chain "cons1" is configured with ChainID "consu" + stepsStartPermissionlessChain( + "cons1", "consu", + []string{"consu", "consu"}, // show up both consumer chains "consu" as proposed chains + []ValidatorID{ValidatorID("bob")}, 0), + + []Step{ + { + Action: RelayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID("cons1"), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID("cons1"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 0, + ValidatorID("bob"): 200, + ValidatorID("carol"): 0, + }, + }, + ChainID("provi"): e2e.ChainState{ + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {}, + ValidatorID("bob"): {"consu"}, + ValidatorID("carol"): {}, + }, + }, + }, + }, + }, + + // Test that a validator CANNOT opt-in on a chain with the same ChainID it is already validating + []Step{ + { + Action: OptInAction{ + Chain: ChainID("cons2"), + Validator: ValidatorID("alice"), + ExpectError: true, + ExpectedError: "already opted in to a chain with the same chain id", + }, + State: State{ + ChainID("provi"): ChainState{ + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {}, + ValidatorID("bob"): {"consu"}, + ValidatorID("carol"): {}, + }, + }, + ChainID("cons1"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 0, // alice refused to opt in + ValidatorID("bob"): 200, + ValidatorID("carol"): 0, + }, + }, + }, + }, + }, + []Step{ + { + Action: RelayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID("cons1"), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID("cons1"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 0, + ValidatorID("bob"): 200, + ValidatorID("carol"): 0, + }, + }, + ChainID("provi"): e2e.ChainState{ + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {}, + ValidatorID("bob"): {"consu"}, + ValidatorID("carol"): {}, + }, + }, + }, + }, + }, + // test chain hijacking prevention + []Step{ + // Try to change owner of chain and change deny-/allowlist + { + Action: UpdateConsumerChainAction{ + Chain: ChainID("provi"), + From: ValidatorID("bob"), + ConsumerChain: ChainID("cons1"), + NewOwner: getDefaultValidators()[ValidatorID("carol")].ValconsAddress, + SpawnTime: 0, // launch now + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + TopN: 0, + }, + State: State{}, + }, + { + Action: UpdateConsumerChainAction{ + Chain: ChainID("provi"), + From: ValidatorID("carol"), + ConsumerChain: ChainID("cons1"), + SpawnTime: 0, + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + TopN: 0, + Allowlist: []string{getDefaultValidators()[ValidatorID("carol")].ValconsAddress}, + Denylist: []string{getDefaultValidators()[ValidatorID("bob")].ValconsAddress}, + }, + State: State{}, + }, + { + Action: RelayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID("cons1"), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID("cons1"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 0, + ValidatorID("bob"): 200, // bob is not 'denylisted' + ValidatorID("carol"): 0, + }, + }, + ChainID("provi"): e2e.ChainState{ + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {}, + ValidatorID("bob"): {"consu"}, // bob is still a validator on consu chain + ValidatorID("carol"): {}, + }, + }, + }, + }, + }, + ) + return s +} diff --git a/tests/e2e/steps_start_chains.go b/tests/e2e/steps_start_chains.go index 640816aaeb..7f84d5fa37 100644 --- a/tests/e2e/steps_start_chains.go +++ b/tests/e2e/steps_start_chains.go @@ -1,8 +1,11 @@ package main import ( + "time" + gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + e2e "github.com/cosmos/interchain-security/v6/tests/e2e/testlib" ) func stepStartProviderChain() []Step { @@ -29,6 +32,144 @@ func stepStartProviderChain() []Step { } } +func stepsStartPermissionlessChain(consumerName, consumerChainId string, proposedChains []string, validators []ValidatorID, chainIndex uint) []Step { + s := []Step{ + { + Action: CreateConsumerChainAction{ + Chain: ChainID("provi"), + From: ValidatorID("alice"), + ConsumerChain: ChainID(consumerName), + SpawnTime: uint(time.Minute * 3), + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + TopN: 0, + }, + State: State{ + ChainID("provi"): e2e.ChainState{ + ProposedConsumerChains: &proposedChains, + }, + }, + }, + } + + // Assign validator keys + // add a consumer key before the chain starts + // the key will be present in the consumer genesis initial_val_set + for _, valId := range validators { + valCfg := getDefaultValidators()[valId] + // no consumer-key assignment needed for validators using provider's public key + if !valCfg.UseConsumerKey { + continue + } + step := Step{ + Action: AssignConsumerPubKeyAction{ + Chain: ChainID(consumerName), + Validator: valId, + ConsumerPubkey: valCfg.ConsumerValPubKey, + // consumer chain has not started + // we don't need to reconfigure the node + // since it will start with consumer key + ReconfigureNode: false, + }, + State: State{ + ChainID(consumerName): ChainState{ + AssignedKeys: &map[ValidatorID]string{ + valId: valCfg.ConsumerValconsAddressOnProvider, + }, + ProviderKeys: &map[ValidatorID]string{ + valId: valCfg.ValconsAddress, + }, + }, + }, + } + s = append(s, step) + } + + // Opt-in Validators + for _, valId := range validators { + step := Step{ + Action: OptInAction{ + Chain: ChainID(consumerName), + Validator: valId, + }, + State: State{}, + } + s = append(s, step) + } + + // Launch chain + step := Step{ + Action: UpdateConsumerChainAction{ + Chain: ChainID("provi"), + From: ValidatorID("alice"), + ConsumerChain: ChainID(consumerName), + SpawnTime: 0, // launch now + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + TopN: 0, + }, + State: State{}, + } + s = append(s, step) + + // Setup validators for chain + startChainVals := []StartChainValidator{} + valBalance := map[ValidatorID]uint{ + ValidatorID("alice"): 0, + ValidatorID("bob"): 0, + ValidatorID("carol"): 0, + } + + for idx, val := range validators { + startChainVals = append(startChainVals, + StartChainValidator{ + Id: val, + Stake: uint(100000000 * (idx + 1)), + Allocation: 10000000000, + }) + valBalance[val] = 10000000000 + } + + // Start the chain + step = Step{ + Action: StartConsumerChainAction{ + ConsumerChain: ChainID(consumerName), + ProviderChain: ChainID("provi"), + Validators: startChainVals, + }, + State: State{ + ChainID(consumerName): ChainState{ + ValBalances: &valBalance, + }, + }, + } + s = append(s, step) + + // Establish IBC connection + steps := []Step{ + { + Action: AddIbcConnectionAction{ + ChainA: ChainID(consumerName), + ChainB: ChainID("provi"), + ClientA: 0, + ClientB: chainIndex, + }, + State: State{}, + }, + { + Action: AddIbcChannelAction{ + ChainA: ChainID(consumerName), + ChainB: ChainID("provi"), + ConnectionA: 0, + PortA: "consumer", + PortB: "provider", + Order: "ordered", + }, + State: State{}, + }, + } + s = append(s, steps...) + return s +} + func stepsStartConsumerChain(consumerName string, proposalIndex, chainIndex uint, setupTransferChans bool) []Step { s := []Step{ { diff --git a/tests/e2e/test_runner.go b/tests/e2e/test_runner.go index c3ced5ab61..e07360954e 100644 --- a/tests/e2e/test_runner.go +++ b/tests/e2e/test_runner.go @@ -72,7 +72,7 @@ func (res *TestResult) Error() { func (tr *TestRunner) Run() error { tr.result = TestResult{} tr.result.Started() - fmt.Printf("\n\n=============== running %s ===============\n", tr.config.name) + fmt.Printf("\n\n=============== running %s ===============\n", tr.stepChoice.name) fmt.Println(tr.Info()) err := tr.checkConfig() if err != nil { @@ -131,11 +131,11 @@ func CreateTestRunner(config TestConfig, stepChoice StepChoice, target Execution // Info returns a header string containing useful information about the test runner func (tr *TestRunner) Info() string { return fmt.Sprintf(` ------------------------------------------- +------------------------------------------------- Test name : %s Config: %s Target: %s -------------------------------------------`, +-------------------------------------------------`, tr.stepChoice.name, tr.config.name, tr.target.Info(), @@ -144,7 +144,7 @@ Target: %s func (tr *TestRunner) Report() string { return fmt.Sprintf(` ------------------------------------------- +------------------------------------------------- Test name : %s Config: %s Target: %s @@ -152,7 +152,7 @@ Target: %s - Result: %s - Duration: %s - StartTime: %s -------------------------------------------`, +-------------------------------------------------`, tr.stepChoice.name, tr.config.name, tr.target.Info(), diff --git a/tests/e2e/testnet-scripts/start-chain.sh b/tests/e2e/testnet-scripts/start-chain.sh index 6ad97b3589..23a5ca3c94 100644 --- a/tests/e2e/testnet-scripts/start-chain.sh +++ b/tests/e2e/testnet-scripts/start-chain.sh @@ -36,6 +36,8 @@ TENDERMINT_CONFIG_TRANSFORM=$7 # whether to use CometMock USE_COMETMOCK=$8 +CHAIN_HOME=$9 + # stores a comma separated list of nodes addresses # needed for CometMock - these are the addresses that the ABCI servers of the apps are listening on NODE_LISTEN_ADDR_STR="" # example value: 7.7.8.6:26655,7.7.8.4:26655,7.7.8.5:26655 @@ -55,18 +57,18 @@ NODES=$(echo "$VALIDATORS" | jq '. | length') # SETUP NETWORK NAMESPACES, see: https://adil.medium.com/container-networking-under-the-hood-network-namespaces-6b2b8fe8dc2a # Create virtual bridge device (acts like a switch) -ip link add name virtual-bridge type bridge || true +ip link add name virtual-bridge type bridge || true for i in $(seq 0 $(($NODES - 1))); do VAL_ID=$(echo "$VALIDATORS" | jq -r ".[$i].val_id") VAL_IP_SUFFIX=$(echo "$VALIDATORS" | jq -r ".[$i].ip_suffix") NET_NAMESPACE_NAME="$CHAIN_ID-$VAL_ID" - IP_ADDR="$CHAIN_IP_PREFIX.$VAL_IP_SUFFIX/24" + IP_ADDR="$CHAIN_IP_PREFIX.$VAL_IP_SUFFIX/24" - # Create network namespace + # Create network namespace ip netns add $NET_NAMESPACE_NAME - # Create virtual ethernet device to connect with bridge + # Create virtual ethernet device to connect with bridge ip link add $NET_NAMESPACE_NAME-in type veth peer name $NET_NAMESPACE_NAME-out # Connect input end of virtual ethernet device to namespace ip link set $NET_NAMESPACE_NAME-in netns $NET_NAMESPACE_NAME @@ -84,14 +86,14 @@ do VAL_ID=$(echo "$VALIDATORS" | jq -r ".[$i].val_id") NET_NAMESPACE_NAME="$CHAIN_ID-$VAL_ID" - # Enable in/out interfaces for the namespace + # Enable in/out interfaces for the namespace ip link set $NET_NAMESPACE_NAME-out up ip netns exec $NET_NAMESPACE_NAME ip link set dev $NET_NAMESPACE_NAME-in up # Enable loopback device ip netns exec $NET_NAMESPACE_NAME ip link set dev lo up done -# Assign IP for bridge, to route between default network namespace and bridge +# Assign IP for bridge, to route between default network namespace and bridge BRIDGE_IP="$CHAIN_IP_PREFIX.254/24" ip addr add $BRIDGE_IP dev virtual-bridge @@ -99,11 +101,11 @@ ip addr add $BRIDGE_IP dev virtual-bridge # the first validator will also collect the gentx's once generated FIRST_VAL_ID=$(echo "$VALIDATORS" | jq -r ".[0].val_id") FIRST_VAL_IP_SUFFIX=$(echo "$VALIDATORS" | jq -r ".[0].ip_suffix") -echo "$VALIDATORS" | jq -r ".[0].mnemonic" | $BIN init --home /$CHAIN_ID/validator$FIRST_VAL_ID --chain-id=$CHAIN_ID validator$FIRST_VAL_ID --recover > /dev/null +echo "$VALIDATORS" | jq -r ".[0].mnemonic" | $BIN init --home /$CHAIN_HOME/validator$FIRST_VAL_ID --chain-id=$CHAIN_ID validator$FIRST_VAL_ID --recover > /dev/null # Apply jq transformations to genesis file -jq "$GENESIS_TRANSFORM" /$CHAIN_ID/validator$FIRST_VAL_ID/config/genesis.json > /$CHAIN_ID/edited-genesis.json -mv /$CHAIN_ID/edited-genesis.json /$CHAIN_ID/genesis.json +jq "$GENESIS_TRANSFORM" /$CHAIN_HOME/validator$FIRST_VAL_ID/config/genesis.json > /$CHAIN_HOME/edited-genesis.json +mv /$CHAIN_HOME/edited-genesis.json /$CHAIN_HOME/genesis.json @@ -120,28 +122,28 @@ do # optionally start validator with a key different from provider chain key if [[ "$CHAIN_ID" != "provi" && "$START_WITH_CONSUMER_KEY" = "true" ]]; then echo "$VALIDATORS" | jq -r ".[$i].consumer_mnemonic" | $BIN keys add validator$VAL_ID \ - --home /$CHAIN_ID/validator$VAL_ID \ + --home /$CHAIN_HOME/validator$VAL_ID \ --keyring-backend test \ --recover > /dev/null else echo "$VALIDATORS" | jq -r ".[$i].mnemonic" | $BIN keys add validator$VAL_ID \ - --home /$CHAIN_ID/validator$VAL_ID \ + --home /$CHAIN_HOME/validator$VAL_ID \ --keyring-backend test \ --recover > /dev/null fi - + # Give validators their initial token allocations # move the genesis in - mv /$CHAIN_ID/genesis.json /$CHAIN_ID/validator$VAL_ID/config/genesis.json - + mv /$CHAIN_HOME/genesis.json /$CHAIN_HOME/validator$VAL_ID/config/genesis.json + # give this validator some money ALLOCATION=$(echo "$VALIDATORS" | jq -r ".[$i].allocation") $BIN genesis add-genesis-account validator$VAL_ID $ALLOCATION \ - --home /$CHAIN_ID/validator$VAL_ID \ + --home /$CHAIN_HOME/validator$VAL_ID \ --keyring-backend test # move the genesis back out - mv /$CHAIN_ID/validator$VAL_ID/config/genesis.json /$CHAIN_ID/genesis.json + mv /$CHAIN_HOME/validator$VAL_ID/config/genesis.json /$CHAIN_HOME/genesis.json done @@ -153,50 +155,50 @@ do VAL_ID=$(echo "$VALIDATORS" | jq -r ".[$i].val_id") # Copy in the genesis.json - cp /$CHAIN_ID/genesis.json /$CHAIN_ID/validator$VAL_ID/config/genesis.json + cp /$CHAIN_HOME/genesis.json /$CHAIN_HOME/validator$VAL_ID/config/genesis.json # Copy in validator state file - echo '{"height": "0","round": 0,"step": 0}' > /$CHAIN_ID/validator$VAL_ID/data/priv_validator_state.json + echo '{"height": "0","round": 0,"step": 0}' > /$CHAIN_HOME/validator$VAL_ID/data/priv_validator_state.json START_WITH_CONSUMER_KEY=$(echo "$VALIDATORS" | jq -r ".[$i].start_with_consumer_key") if [[ "$CHAIN_ID" != "provi" && "$START_WITH_CONSUMER_KEY" = "true" ]]; then # start with assigned consumer key PRIV_VALIDATOR_KEY=$(echo "$VALIDATORS" | jq -r ".[$i].consumer_priv_validator_key") if [[ "$PRIV_VALIDATOR_KEY" ]]; then - echo "$PRIV_VALIDATOR_KEY" > /$CHAIN_ID/validator$VAL_ID/config/priv_validator_key.json + echo "$PRIV_VALIDATOR_KEY" > /$CHAIN_HOME/validator$VAL_ID/config/priv_validator_key.json fi else PRIV_VALIDATOR_KEY=$(echo "$VALIDATORS" | jq -r ".[$i].priv_validator_key") if [[ "$PRIV_VALIDATOR_KEY" ]]; then - echo "$PRIV_VALIDATOR_KEY" > /$CHAIN_ID/validator$VAL_ID/config/priv_validator_key.json + echo "$PRIV_VALIDATOR_KEY" > /$CHAIN_HOME/validator$VAL_ID/config/priv_validator_key.json fi fi NODE_KEY=$(echo "$VALIDATORS" | jq -r ".[$i].node_key") if [[ "$NODE_KEY" ]]; then - echo "$NODE_KEY" > /$CHAIN_ID/validator$VAL_ID/config/node_key.json + echo "$NODE_KEY" > /$CHAIN_HOME/validator$VAL_ID/config/node_key.json fi # Make a gentx (this command also sets up validator state on disk even if we are not going to use the gentx for anything) - if [ "$SKIP_GENTX" = "false" ] ; then + if [ "$SKIP_GENTX" = "false" ] ; then STAKE_AMOUNT=$(echo "$VALIDATORS" | jq -r ".[$i].stake") $BIN genesis gentx validator$VAL_ID "$STAKE_AMOUNT" \ - --home /$CHAIN_ID/validator$VAL_ID \ + --home /$CHAIN_HOME/validator$VAL_ID \ --keyring-backend test \ --moniker validator$VAL_ID \ --chain-id=$CHAIN_ID - # Copy gentxs to the first validator for possible future collection. + # Copy gentxs to the first validator for possible future collection. # Obviously we don't need to copy the first validator's gentx to itself if [ $VAL_ID != $FIRST_VAL_ID ]; then - cp /$CHAIN_ID/validator$VAL_ID/config/gentx/* /$CHAIN_ID/validator$FIRST_VAL_ID/config/gentx/ + cp /$CHAIN_HOME/validator$VAL_ID/config/gentx/* /$CHAIN_HOME/validator$FIRST_VAL_ID/config/gentx/ fi fi # Modify tendermint configs of validator - if [ "$TENDERMINT_CONFIG_TRANSFORM" != "" ] ; then + if [ "$TENDERMINT_CONFIG_TRANSFORM" != "" ] ; then #'s/foo/bar/;s/abc/def/' - sed -i "$TENDERMINT_CONFIG_TRANSFORM" $CHAIN_ID/validator$VAL_ID/config/config.toml + sed -i "$TENDERMINT_CONFIG_TRANSFORM" /$CHAIN_HOME/validator$VAL_ID/config/config.toml fi done @@ -207,16 +209,16 @@ done if [ "$SKIP_GENTX" = "false" ] ; then # make the final genesis.json - $BIN genesis collect-gentxs --home /$CHAIN_ID/validator$FIRST_VAL_ID + $BIN genesis collect-gentxs --home /$CHAIN_HOME/validator$FIRST_VAL_ID - # and copy it to the root - cp /$CHAIN_ID/validator$FIRST_VAL_ID/config/genesis.json /$CHAIN_ID/genesis.json + # and copy it to the root + cp /$CHAIN_HOME/validator$FIRST_VAL_ID/config/genesis.json /$CHAIN_HOME/genesis.json # put the now final genesis.json into the correct folders for i in $(seq 1 $(($NODES - 1))); do VAL_ID=$(echo "$VALIDATORS" | jq -r ".[$i].val_id") - cp /$CHAIN_ID/genesis.json /$CHAIN_ID/validator$VAL_ID/config/genesis.json + cp /$CHAIN_HOME/genesis.json /$CHAIN_HOME/validator$VAL_ID/config/genesis.json done fi @@ -231,7 +233,7 @@ do VAL_IP_SUFFIX=$(echo "$VALIDATORS" | jq -r ".[$i].ip_suffix") NET_NAMESPACE_NAME="$CHAIN_ID-$VAL_ID" - NODE_HOME="/$CHAIN_ID/validator$VAL_ID" + NODE_HOME="/$CHAIN_HOME/validator$VAL_ID" GAIA_HOME="--home $NODE_HOME" NODE_HOMES="$NODE_HOME,$NODE_HOMES" RPC_ADDRESS="--rpc.laddr tcp://$CHAIN_IP_PREFIX.$VAL_IP_SUFFIX:26658" @@ -249,27 +251,27 @@ do do if [ $i -ne $j ]; then PEER_VAL_ID=$(echo "$VALIDATORS" | jq -r ".[$j].val_id") - PEER_VAL_IP_SUFFIX=$(echo "$VALIDATORS" | jq -r ".[$j].ip_suffix") - NODE_ID=$($BIN tendermint show-node-id --home /$CHAIN_ID/validator$PEER_VAL_ID) + PEER_VAL_IP_SUFFIX=$(echo "$VALIDATORS" | jq -r ".[$j].ip_suffix") + NODE_ID=$($BIN tendermint show-node-id --home /$CHAIN_HOME/validator$PEER_VAL_ID) ADDRESS="$NODE_ID@$CHAIN_IP_PREFIX.$PEER_VAL_IP_SUFFIX:26656" - # (jq -r '.body.memo' /$CHAIN_ID/validator$j/config/gentx/*) # Getting the address from the gentx should also work + # (jq -r '.body.memo' /$CHAIN_HOME/validator$j/config/gentx/*) # Getting the address from the gentx should also work PERSISTENT_PEERS="$PERSISTENT_PEERS,$ADDRESS" fi done - + if [ "$PERSISTENT_PEERS" != "" ]; then # Remove leading comma and concat to flag PERSISTENT_PEERS="--p2p.persistent_peers ${PERSISTENT_PEERS:1}" fi - + ARGS="$GAIA_HOME $LISTEN_ADDRESS $RPC_ADDRESS $GRPC_ADDRESS $LOG_LEVEL $P2P_ADDRESS $ENABLE_WEBGRPC $PERSISTENT_PEERS" if [[ "$USE_COMETMOCK" == "true" ]]; then # to start with CometMock, ensure ABCI server uses grpc (--transport=grpc) and the app is started without in-process CometBFT (--with-tendermint=false) - ip netns exec $NET_NAMESPACE_NAME $BIN $ARGS start --transport=grpc --with-tendermint=false &> /$CHAIN_ID/validator$VAL_ID/logs & + ip netns exec $NET_NAMESPACE_NAME $BIN $ARGS start --transport=grpc --with-tendermint=false &> /$CHAIN_HOME/validator$VAL_ID/logs & else - ip netns exec $NET_NAMESPACE_NAME $BIN $ARGS start &> /$CHAIN_ID/validator$VAL_ID/logs & + ip netns exec $NET_NAMESPACE_NAME $BIN $ARGS start &> /$CHAIN_HOME/validator$VAL_ID/logs & fi done @@ -314,13 +316,13 @@ ip netns exec $QUERY_NET_NAMESPACE_NAME ip link set dev lo up ## DONE QUERY NODE ENABLE DEVICE ## INIT QUERY NODE -$BIN init --home /$CHAIN_ID/$QUERY_NODE_ID --chain-id=$CHAIN_ID $QUERY_NODE_ID > /dev/null -cp /$CHAIN_ID/genesis.json /$CHAIN_ID/$QUERY_NODE_ID/config/genesis.json +$BIN init --home /$CHAIN_HOME/$QUERY_NODE_ID --chain-id=$CHAIN_ID $QUERY_NODE_ID > /dev/null +cp /$CHAIN_HOME/genesis.json /$CHAIN_HOME/$QUERY_NODE_ID/config/genesis.json ## DONE INIT QUERY NODE ## START QUERY NODE -QUERY_GAIA_HOME="--home /$CHAIN_ID/$QUERY_NODE_ID" +QUERY_GAIA_HOME="--home /$CHAIN_HOME/$QUERY_NODE_ID" QUERY_RPC_ADDRESS="--rpc.laddr tcp://$CHAIN_IP_PREFIX.$QUERY_IP_SUFFIX:26658" QUERY_GRPC_ADDRESS="--grpc.address $CHAIN_IP_PREFIX.$QUERY_IP_SUFFIX:9091" QUERY_LISTEN_ADDRESS="--address tcp://$CHAIN_IP_PREFIX.$QUERY_IP_SUFFIX:26655" @@ -336,7 +338,7 @@ for j in $(seq 0 $(($NODES - 1))); do PEER_VAL_ID=$(echo "$VALIDATORS" | jq -r ".[$j].val_id") PEER_VAL_IP_SUFFIX=$(echo "$VALIDATORS" | jq -r ".[$j].ip_suffix") - NODE_ID=$($BIN tendermint show-node-id --home /$CHAIN_ID/validator$PEER_VAL_ID) + NODE_ID=$($BIN tendermint show-node-id --home /$CHAIN_HOME/validator$PEER_VAL_ID) ADDRESS="$NODE_ID@$CHAIN_IP_PREFIX.$PEER_VAL_IP_SUFFIX:26656" QUERY_PERSISTENT_PEERS="$QUERY_PERSISTENT_PEERS,$ADDRESS" done @@ -349,7 +351,7 @@ ARGS="$QUERY_GAIA_HOME $QUERY_LISTEN_ADDRESS $QUERY_RPC_ADDRESS $QUERY_GRPC_ADDR # Query node is only started if CometMock is not used - with CometMock, it takes the role of the query node if [[ "$USE_COMETMOCK" != "true" ]]; then - ip netns exec $QUERY_NET_NAMESPACE_NAME $BIN $ARGS start &> /$CHAIN_ID/$QUERY_NODE_ID/logs & + ip netns exec $QUERY_NET_NAMESPACE_NAME $BIN $ARGS start &> /$CHAIN_HOME/$QUERY_NODE_ID/logs & fi ## DONE START NODE @@ -366,7 +368,7 @@ NODE_HOMES=${NODE_HOMES%?} # CometMock takes the role of the query node if [[ "$USE_COMETMOCK" == "true" ]]; then sleep 2 - ip netns exec $QUERY_NET_NAMESPACE_NAME cometmock $NODE_LISTEN_ADDR_STR /$CHAIN_ID/genesis.json tcp://$CHAIN_IP_PREFIX.$QUERY_IP_SUFFIX:26658 $NODE_HOMES grpc &> cometmock_${CHAIN_ID}_out.log & + ip netns exec $QUERY_NET_NAMESPACE_NAME cometmock $NODE_LISTEN_ADDR_STR /$CHAIN_HOME/genesis.json tcp://$CHAIN_IP_PREFIX.$QUERY_IP_SUFFIX:26658 $NODE_HOMES grpc &> cometmock_${CHAIN_ID}_out.log & sleep 3 fi @@ -377,7 +379,7 @@ fi # poll for chain start if [[ "$USE_COMETMOCK" == "true" ]]; then set +e - until $BIN query block --type=height 1--node "tcp://$CHAIN_IP_PREFIX.$QUERY_IP_SUFFIX:26658"; do sleep 0.3 ; done + until $BIN query block --type=height 1 --node "tcp://$CHAIN_IP_PREFIX.$QUERY_IP_SUFFIX:26658"; do sleep 0.3 ; done set -e else set +e From 1799d79a74410bc5a27525d8ee695dd381ad20f0 Mon Sep 17 00:00:00 2001 From: Simon Noetzlin Date: Mon, 9 Sep 2024 17:07:05 +0200 Subject: [PATCH 22/28] docs: update changelog for Permissionless ICS (#2225) * add changelog for ICS Permissionless * Update .changelog/unreleased/api-breaking/provider/2171-permissionless-ICS.md.md Co-authored-by: Marius Poke * fix formating * fix link * fix nits * fix links * fix links * add deprecated txs * fix list --------- Co-authored-by: Marius Poke --- .../provider/2171-permissionless-ICS.md.md | 60 +++++++++++++++++++ .../provider/2171-permissionless-ICS.md.md | 33 ++++++++++ 2 files changed, 93 insertions(+) create mode 100644 .changelog/unreleased/api-breaking/provider/2171-permissionless-ICS.md.md create mode 100644 .changelog/unreleased/features/provider/2171-permissionless-ICS.md.md diff --git a/.changelog/unreleased/api-breaking/provider/2171-permissionless-ICS.md.md b/.changelog/unreleased/api-breaking/provider/2171-permissionless-ICS.md.md new file mode 100644 index 0000000000..e674b4cb0c --- /dev/null +++ b/.changelog/unreleased/api-breaking/provider/2171-permissionless-ICS.md.md @@ -0,0 +1,60 @@ +- Add the Permissionless ICS feature on the provider (as per + [ADR-019](https://cosmos.github.io/interchain-security/adrs/adr-019-permissionless-ics)), + which entails the following api-breaking changes on the provider. + ([\#2171](https://github.com/cosmos/interchain-security/pull/2171)) + + - Deprecate the `chain-id` parameter in favour of `consumer-id` for all transactions and queries targeting a unique consumer chain. Below is a list highlighting the changes in the CLI commands. All commands assume the prefix `interchain-security-pd tx|q provider`. + - **Transactions:** + - `assign-consensus-key [consumer-id] [consumer-pubkey]` + -- submit a [MsgAssignConsensusKey](https://github.com/cosmos/interchain-security/blob/a17a3851b5eb3cec515b711dceae0afe9c14c3f0/proto/interchain_security/ccv/provider/v1/tx.proto#L46) + - `opt-in [consumer-id] [consumer-pubkey]` + -- submit a [MsgOptIn](https://github.com/cosmos/interchain-security/blob/a17a3851b5eb3cec515b711dceae0afe9c14c3f0/proto/interchain_security/ccv/provider/v1/tx.proto#L256) + - `opt-out [consumer-id]` + -- submit a [MsgOptOut](https://github.com/cosmos/interchain-security/blob/a17a3851b5eb3cec515b711dceae0afe9c14c3f0/proto/interchain_security/ccv/provider/v1/tx.proto#L277) + - `set-consumer-commission-rate [consumer-id] [commission-rate]` + -- submit a [MsgSetConsumerCommissionRate](https://github.com/cosmos/interchain-security/blob/a17a3851b5eb3cec515b711dceae0afe9c14c3f0/proto/interchain_security/ccv/provider/v1/tx.proto#L295) + + - **Queries:** + - `consumer-genesis [consumer-id]` -- query for consumer chain genesis state by consumer id. + - REST:`/interchain_security/ccv/provider/consumer_genesis/{consumer_id}` + + - `validator-consumer-key [consumer-id] [provider-validator-address]` -- query assigned validator consensus public key for a consumer chain. + - REST: `/interchain_security/ccv/provider/validator_consumer_addr/{consumer_id}/{provider_address}` + + - `validator-provider-key [consumer-id] [consumer-validator-address]` -- query assigned validator consensus public key for the provider chain. + - REST: `/interchain_security/ccv/provider/validator_provider_addr/{consumer_id}/{consumer_address}` + + - `consumer-opted-in-validators [consumer-id]` -- query opted-in validators for a given consumer chain. + - REST: `/interchain_security/ccv/provider/opted_in_validators/{consumer_id}` + + - `consumer-validators [consumer-id]` -- query the last set consumer-validator set for a given consumer chain. + - REST: `/interchain_security/ccv/provider/consumer_validators/{consumer_id}` + + - `validator-consumer-commission-rate [consumer-id]` -- query the consumer commission rate a validator charges on a consumer chain. + - REST: `/interchain_security/ccv/provider/consumer_commission_rate/{consumer_id}/{provider_address}` + + - `all-pairs-valconsensus-address [consumer-id]` -- query all pairs of valconsensus address by consumer id. + - REST: `/interchain_security/ccv/provider/address_pairs/{consumer_id}` + + - Deprecate the following queries, proposals and all legacy governance proposals: + + - **Queries:** + - `list-start-proposals` -- query consumer chains start proposals on provider chain. + - REST: `/interchain_security/ccv/provider/consumer_chain_start_proposals` + + - `list-stop-proposals` -- consumer chains stop proposals on provider chain. + - REST: `/interchain_security/ccv/provider/consumer_chain_stop_proposals` + + - `list-proposed-consumer-chains` -- query chain ids in consumer addition proposal before voting finishes. + - REST: `/interchain_security/ccv/provider/proposed_consumer_chains` + + - **Proposals:** + - [MsgConsumerAddition](https://github.com/cosmos/interchain-security/blob/a17a3851b5eb3cec515b711dceae0afe9c14c3f0/proto/interchain_security/ccv/provider/v1/tx.proto#L121) -- deprecated in favor of [MsgCreateConsumer](https://github.com/cosmos/interchain-security/blob/a17a3851b5eb3cec515b711dceae0afe9c14c3f0/proto/interchain_security/ccv/provider/v1/tx.proto#L360) + - [MsgConsumerRemoval](https://github.com/cosmos/interchain-security/blob/a17a3851b5eb3cec515b711dceae0afe9c14c3f0/proto/interchain_security/ccv/provider/v1/tx.proto#L206) -- deprecated in favor of [MsgRemoveConsumer](https://github.com/cosmos/interchain-security/blob/a17a3851b5eb3cec515b711dceae0afe9c14c3f0/proto/interchain_security/ccv/provider/v1/tx.proto#L225) + - [MsgConsumerModification](https://github.com/cosmos/interchain-security/blob/a17a3851b5eb3cec515b711dceae0afe9c14c3f0/proto/interchain_security/ccv/provider/v1/tx.proto#L321) -- deprecated in favor of [MsgUpdateConsumer](https://github.com/cosmos/interchain-security/blob/a17a3851b5eb3cec515b711dceae0afe9c14c3f0/proto/interchain_security/ccv/provider/v1/tx.proto#L383) + + - **Legacy Proposals:** + - [ConsumerAdditionProposal](https://github.com/cosmos/interchain-security/blob/a17a3851b5eb3cec515b711dceae0afe9c14c3f0/proto/interchain_security/ccv/provider/v1/provider.proto#L31) + - [ConsumerModificationProposal](https://github.com/cosmos/interchain-security/blob/a17a3851b5eb3cec515b711dceae0afe9c14c3f0/proto/interchain_security/ccv/provider/v1/provider.proto#L140) + - [ConsumerRemovalProposal](https://github.com/cosmos/interchain-security/blob/a17a3851b5eb3cec515b711dceae0afe9c14c3f0/proto/interchain_security/ccv/provider/v1/provider.proto#L122) + - [ChangeRewardDenomsProposal](https://github.com/cosmos/interchain-security/blob/a17a3851b5eb3cec515b711dceae0afe9c14c3f0/proto/interchain_security/ccv/provider/v1/provider.proto#L192) diff --git a/.changelog/unreleased/features/provider/2171-permissionless-ICS.md.md b/.changelog/unreleased/features/provider/2171-permissionless-ICS.md.md new file mode 100644 index 0000000000..a125e9802e --- /dev/null +++ b/.changelog/unreleased/features/provider/2171-permissionless-ICS.md.md @@ -0,0 +1,33 @@ +- Add the Permissionless ICS feature on the provider (as per + [ADR-019](https://cosmos.github.io/interchain-security/adrs/adr-019-permissionless-ics)), + which entails the following CLI and API enhancements on the provider. + ([\#2171](https://github.com/cosmos/interchain-security/pull/2171)) + + - Introduce new CLI commands and gRPC endpoints to manage consumer chains. All commands listed below assume the prefix `interchain-security-pd tx|q provider`. + + - **Transactions:** + - `create-consumer [consumer-parameters]` + -- submit a [MsgCreateConsumer](https://github.com/cosmos/interchain-security/blob/a17a3851b5eb3cec515b711dceae0afe9c14c3f0/proto/interchain_security/ccv/provider/v1/tx.proto#L360) + -- replace [ConsumerAdditionProposal](https://github.com/cosmos/interchain-security/blob/a17a3851b5eb3cec515b711dceae0afe9c14c3f0/proto/interchain_security/ccv/provider/v1/provider.proto#L31) + + - `update-consumer [consumer-parameters]` + -- submit a [MsgUpdateConsumer](https://github.com/cosmos/interchain-security/blob/a17a3851b5eb3cec515b711dceae0afe9c14c3f0/proto/interchain_security/ccv/provider/v1/tx.proto#L383) + -- replace [ConsumerModificationProposal](https://github.com/cosmos/interchain-security/blob/a17a3851b5eb3cec515b711dceae0afe9c14c3f0/proto/interchain_security/ccv/provider/v1/provider.proto#L140) + + - `remove-consumer [consumer-id]` + -- submit a [MsgRemoveConsumer](https://github.com/cosmos/interchain-security/blob/a17a3851b5eb3cec515b711dceae0afe9c14c3f0/proto/interchain_security/ccv/provider/v1/tx.proto#L225) + -- replace [ConsumerRemovalProposal](https://github.com/cosmos/interchain-security/blob/a17a3851b5eb3cec515b711dceae0afe9c14c3f0/proto/interchain_security/ccv/provider/v1/provider.proto#L122) + + > These new TX commands should be used instead of their corresponding deprecated proposals. To update consumer chains owned by the governance module, a proposal containing a `MsgUpdateConsumer` message must be submitted. + + - **Queries:** + - `consumer-chain [consumer-id]`-- query details of a consumer chain associated with the consumer id. + - REST: `interchain-security/ccv/provider/consumer_chain/{consumer_id}` + - `consumer-id-from-client-id [client-id]` -- get the consumer id of a chain from a client id. + - REST: `interchain-security/ccv/provider/consumer_id/{client_id}` + - `blocks-until-next-epoch` -- query number of blocks remaining until the next epoch begins. + - REST: `interchain-security/ccv/provider/blocks_until_next_epoch` + + - Improve the `list-consumer-chains` query to accept optional parameters `[phase]` and `[limit]`: + - `[phase]`: Filters returned consumer chains by their phase. + - `[limit]`: Limits the number of consumer chains returned. \ No newline at end of file From 4dac95bfabb1ea723adb82aceb33d7a46c044a74 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2024 09:53:49 +0200 Subject: [PATCH 23/28] build(deps): bump bufbuild/buf-setup-action from 1.39.0 to 1.40.1 (#2241) Bumps [bufbuild/buf-setup-action](https://github.com/bufbuild/buf-setup-action) from 1.39.0 to 1.40.1. - [Release notes](https://github.com/bufbuild/buf-setup-action/releases) - [Commits](https://github.com/bufbuild/buf-setup-action/compare/v1.39.0...v1.40.1) --- updated-dependencies: - dependency-name: bufbuild/buf-setup-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/proto-registry.yml | 2 +- .github/workflows/proto.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/proto-registry.yml b/.github/workflows/proto-registry.yml index e00cb6709d..978a70bb33 100644 --- a/.github/workflows/proto-registry.yml +++ b/.github/workflows/proto-registry.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: bufbuild/buf-setup-action@v1.39.0 + - uses: bufbuild/buf-setup-action@v1.40.1 - uses: bufbuild/buf-push-action@v1 with: input: "proto" diff --git a/.github/workflows/proto.yml b/.github/workflows/proto.yml index 522a3ab546..70333fa632 100644 --- a/.github/workflows/proto.yml +++ b/.github/workflows/proto.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: bufbuild/buf-setup-action@v1.39.0 + - uses: bufbuild/buf-setup-action@v1.40.1 - uses: bufbuild/buf-breaking-action@v1 with: input: "proto" From f03d5372ee3df01fb5060dbbe58b8fe21cacbe10 Mon Sep 17 00:00:00 2001 From: Marius Poke Date: Tue, 10 Sep 2024 12:19:34 +0200 Subject: [PATCH 24/28] fix!: add metadata and init params default during permissionless migration (#2243) * add default metadata during migration * update upgrading instr. --- UPGRADING.md | 170 +++++++++++++-------- x/ccv/provider/migrations/v8/migrations.go | 16 +- 2 files changed, 121 insertions(+), 65 deletions(-) diff --git a/UPGRADING.md b/UPGRADING.md index a3f2d5e84d..e56e283fe2 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -7,94 +7,138 @@ Upgrading a provider from v5.1.x requires state migrations. The following migrators should be added to the upgrade handler of the provider chain: ```go -// InitializeMaxValidatorsForExistingConsumers initializes the max validators -// parameter for existing consumers to the MaxProviderConsensusValidators parameter. -// This is necessary to avoid those consumer chains having an excessive amount of validators. -func InitializeMaxValidatorsForExistingConsumers(ctx sdk.Context, providerKeeper providerkeeper.Keeper) { - maxVals := providerKeeper.GetParams(ctx).MaxProviderConsensusValidators - for _, chainID := range providerKeeper.GetAllRegisteredConsumerChainIDs(ctx) { - providerKeeper.SetValidatorSetCap(ctx, chainID, uint32(maxVals)) - } -} - // InitializeMaxProviderConsensusParam initializes the MaxProviderConsensusValidators parameter. +// It is set to 180, which is the current number of validators participating in consensus on the Cosmos Hub. +// This parameter will be used to govern the number of validators participating in consensus on the Cosmos Hub, +// and takes over this role from the MaxValidators parameter in the staking module. func InitializeMaxProviderConsensusParam(ctx sdk.Context, providerKeeper providerkeeper.Keeper) { params := providerKeeper.GetParams(ctx) - if params.MaxProviderConsensusValidators == 0 { - params.MaxProviderConsensusValidators = 180 - providerKeeper.SetParams(ctx, params) - } + params.MaxProviderConsensusValidators = NewMaxProviderConsensusValidators + providerKeeper.SetParams(ctx, params) } ``` -### Governance Proposals - -Legacy proposals are not supported anymore by the current version of the provider. Legacy proposals which are still active (voting period or deposit period) and contain one of the following messages that need to be migrated as described below: -- `ConsumerAdditionProposal` needs to be converted to `MsgConsumerAddition` -- `ConsumerModificationProposal` needs to be converted to `MsgConsumerModification` -- `ConsumerRemovalProposal` needs to be converted to `MsgConsumerRemoval` -- `ChangeRewardDenomsProposal` needs to be converted to `MsgChangeRewardDenoms` - -The following shows an example on how to migrate a proposal containing a legacy consumer addition proposal message. -Migration for the other messages aobve follows the same pattern. The resulting migration code has to be added to the upgrade handler of the provider chain. - -#### Migrate Legacy Proposal Content +```go +// SetMaxValidators sets the MaxValidators parameter in the staking module to 200, +// which is the current number of 180 plus 20. +// This is done in concert with the introduction of the inactive-validators feature +// in Interchain Security, after which the number of validators +// participating in consensus on the Cosmos Hub will be governed by the +// MaxProviderConsensusValidators parameter in the provider module. +func SetMaxValidators(ctx sdk.Context, stakingKeeper stakingkeeper.Keeper) error { + params, err := stakingKeeper.GetParams(ctx) + if err != nil { + return err + } + params.MaxValidators = NewMaxValidators + return stakingKeeper.SetParams(ctx, params) +} +``` ```go +// InitializeLastProviderConsensusValidatorSet initializes the last provider consensus validator set +// by setting it to the first 180 validators from the current validator set of the staking module. +func InitializeLastProviderConsensusValidatorSet(ctx sdk.Context, providerKeeper providerkeeper.Keeper, stakingKeeper stakingkeeper.Keeper) error { + vals, err := stakingKeeper.GetBondedValidatorsByPower(ctx) + if err != nil { + return err + } + // cut the validator set to the first 180 validators + if len(vals) > NewMaxProviderConsensusValidators { + vals = vals[:NewMaxProviderConsensusValidators] + } + // create consensus validators for the staking validators + lastValidators := []providertypes.ConsensusValidator{} + for _, val := range vals { + consensusVal, err := providerKeeper.CreateProviderConsensusValidator(ctx, val) + if err != nil { + return err + } -// MigrateLegacyConsumerAddition converts a ConsumerAdditionProposal to a MsgConsumerAdditionProposal -// and returns it as `Any` suitable to replace the legacy message. -// `authority` contains the signer address -func MigrateLegacyConsumerAddition(msg providertypes.ConsumerAdditionProposal, authority string) (*codec.Any, error) { - sdkMsg := providertypes.MsgConsumerAddition{ - ChainId: msg.ChainId, - InitialHeight: msg.InitialHeight, - GenesisHash: msg.GenesisHash, - BinaryHash: msg.BinaryHash, - SpawnTime: msg.SpawnTime, - UnbondingPeriod: msg.UnbondingPeriod, - CcvTimeoutPeriod: msg.CcvTimeoutPeriod, - TransferTimeoutPeriod: msg.TransferTimeoutPeriod, - ConsumerRedistributionFraction: msg.ConsumerRedistributionFraction, - BlocksPerDistributionTransmission: msg.BlocksPerDistributionTransmission, - HistoricalEntries: msg.HistoricalEntries, - DistributionTransmissionChannel: msg.DistributionTransmissionChannel, - Top_N: msg.Top_N, - ValidatorsPowerCap: msg.ValidatorsPowerCap, - ValidatorSetCap: msg.ValidatorSetCap, - Allowlist: msg.Allowlist, - Denylist: msg.Denylist, - Authority: authority, - MinStake: msg.MinStake, - AllowInactiveVals: msg.AllowInactiveVals, + lastValidators = append(lastValidators, consensusVal) } - return codec.NewAnyWithValue(&sdkMsg) + return providerKeeper.SetLastProviderConsensusValSet(ctx, lastValidators) } +``` -func MigrateProposal(proposal proposal govtypes.Proposal) err { - for idx, msg := range proposal.GetMessages() { - sdkLegacyMsg, isLegacyProposal := msg.GetCachedValue().(*govtypes.MsgExecLegacyContent) - if !isLegacyProposal { +```go +// SetICSConsumerMetadata sets the metadata for launched consumer chains +func SetICSConsumerMetadata(ctx sdk.Context, providerKeeper providerkeeper.Keeper) error { + for _, consumerID := range providerKeeper.GetAllActiveConsumerIds(ctx) { + phase := providerKeeper.GetConsumerPhase(ctx, consumerID) + if phase != providertypes.CONSUMER_PHASE_LAUNCHED { continue } - content, err := govtypes.LegacyContentFromMessage(sdkLegacyMsg) + chainID, err := providerKeeper.GetConsumerChainId(ctx, consumerID) if err != nil { + ctx.Logger().Error( + fmt.Sprintf("cannot get chain ID for consumer chain, consumerID(%s)", consumerID), + ) continue } - msgAdd, ok := content.(*providertypes.ConsumerAdditionProposal) - if ok { - anyMsg, err := migrateLegacyConsumerAddition(*msgAdd, govKeeper.GetAuthority()) + // example of setting the metadata for Stride + if chainID == "stride-1" { + metadata := providertypes.ConsumerMetadata{ + Name: "Stride", + Description: "Description", + Metadata: "Metadata", + } + err = providerKeeper.SetConsumerMetadata(ctx, consumerID, metadata) if err != nil { - return err + ctx.Logger().Error( + fmt.Sprintf("cannot set consumer metadata, consumerID(%s), chainID(%s): %s", consumerID, chainID, err.Error()), + ) + continue } - proposal.Messages[idx] = anyMsg } } - return govKeeper.SetProposal(ctx, proposal) } ``` +```go +// MigrateICSProposals migrates deprecated proposals +func MigrateICSProposals(ctx sdk.Context, msgServer providertypes.MsgServer, providerKeeper providerkeeper.Keeper, govKeeper govkeeper.Keeper) error { + proposals := []govtypesv1.Proposal{} + err := govKeeper.Proposals.Walk(ctx, nil, func(key uint64, proposal govtypesv1.Proposal) (stop bool, err error) { + proposals = append(proposals, proposal) + return false, nil // go through the entire collection + }) + if err != nil { + return errorsmod.Wrapf(err, "iterating through proposals") + } + for _, proposal := range proposals { + err := MigrateICSLegacyProposal(ctx, msgServer, providerKeeper, govKeeper, proposal) + if err != nil { + return errorsmod.Wrapf(err, "migrating legacy proposal %d", proposal.Id) + } + + err = MigrateICSProposal(ctx, msgServer, providerKeeper, govKeeper, proposal) + if err != nil { + return errorsmod.Wrapf(err, "migrating proposal %d", proposal.Id) + } + } + return nil +} + +// MigrateICSLegacyProposal migrates the following proposals +// - ConsumerAdditionProposal +// - ConsumerRemovalProposal +// - ConsumerModificationProposal +// - ChangeRewardDenomsProposal + +// MigrateICSProposal migrates the following proposals +// - MsgConsumerAddition +// - MsgConsumerRemoval +// - MsgConsumerModification +``` + +For an example, see the [Gaia v20 upgrade handler](https://github.com/cosmos/gaia/blob/e4656093955578b2efa6e8c2ea8dd8823008bba3/app/upgrades/v20/upgrades.go#L43). + +### Consumer + +Upgrading the consumer from `v5.0.0` or `v5.2.0` will not require state migration. + ## [v5.1.x](https://github.com/cosmos/interchain-security/releases/tag/v5.1.0) ### Provider diff --git a/x/ccv/provider/migrations/v8/migrations.go b/x/ccv/provider/migrations/v8/migrations.go index 2977243e87..6afd1888c6 100644 --- a/x/ccv/provider/migrations/v8/migrations.go +++ b/x/ccv/provider/migrations/v8/migrations.go @@ -247,8 +247,20 @@ func MigrateLaunchedConsumerChains(ctx sdk.Context, store storetypes.KVStore, pk // set ownership -- all existing chains are owned by gov pk.SetConsumerOwnerAddress(ctx, consumerId, pk.GetAuthority()) - // Note: ConsumerMetadata will be populated in the upgrade handler - // Note: InitializationParameters is not needed since the chain is already launched + // Note: ConsumerMetadata will be populated in the upgrade handler. + // Still, add some default values as every chain should have the metadata set. + if err := pk.SetConsumerMetadata(ctx, consumerId, providertypes.ConsumerMetadata{ + Name: chainId, + Description: "TBA", + Metadata: "TBA", + }); err != nil { + return err + } + // Note: InitializationParameters are not needed since the chain is already launched. + // Just add the default values. + if err := pk.SetConsumerInitializationParameters(ctx, consumerId, providertypes.ConsumerInitializationParameters{}); err != nil { + return err + } // migrate power shaping params topNKey := providertypes.StringIdWithLenKey(LegacyTopNKeyPrefix, chainId) From 26a8d81008caeea6e24fb9a24536efe89cc18b28 Mon Sep 17 00:00:00 2001 From: insumity Date: Tue, 10 Sep 2024 13:54:38 +0200 Subject: [PATCH 25/28] fix: disallow the creation of chains that use chain ids of existing running chains (#2244) init commit --- x/ccv/provider/types/msg.go | 10 +++ x/ccv/provider/types/msg_test.go | 129 +++++++++++++++++++++++++++++++ 2 files changed, 139 insertions(+) diff --git a/x/ccv/provider/types/msg.go b/x/ccv/provider/types/msg.go index 4cf2af68b0..0d0ea89c75 100644 --- a/x/ccv/provider/types/msg.go +++ b/x/ccv/provider/types/msg.go @@ -297,6 +297,16 @@ func (msg MsgCreateConsumer) ValidateBasic() error { return errorsmod.Wrapf(ErrInvalidMsgCreateConsumer, "ChainId: %s", err.Error()) } + // With permissionless ICS, we can have multiple consumer chains with the exact same chain id. + // However, as we already have the Neutron and Stride Top N chains running, as a first step we would like to + // prevent permissionless chains from re-using the chain ids of Neutron and Stride. Note that this is just a + // preliminary measure that will be removed later on as part of: + // TODO (#2242): find a better way of ignoring past misbehaviors + if msg.ChainId == "neutron-1" || msg.ChainId == "stride-1" { + return errorsmod.Wrapf(ErrInvalidMsgCreateConsumer, + "cannot reuse chain ids of existing Neutron and Stride Top N consumer chains") + } + if err := ValidateConsumerMetadata(msg.Metadata); err != nil { return errorsmod.Wrapf(ErrInvalidMsgCreateConsumer, "Metadata: %s", err.Error()) } diff --git a/x/ccv/provider/types/msg_test.go b/x/ccv/provider/types/msg_test.go index 6b0689be27..b2a522fba6 100644 --- a/x/ccv/provider/types/msg_test.go +++ b/x/ccv/provider/types/msg_test.go @@ -85,6 +85,77 @@ func TestTruncateString(t *testing.T) { } } +func TestValidateConsumerMetadata(t *testing.T) { + generateLongString := func(length int) string { + result := make([]byte, length) + for i := range result { + result[i] = byte('a') + } + return string(result) + } + + testCases := []struct { + name string + metadata types.ConsumerMetadata + valid bool + }{ + { + name: "valid", + metadata: types.ConsumerMetadata{ + Name: "name", + Description: "description", + Metadata: "metadata", + }, + valid: true, + }, + { + name: "valid with long strings", + metadata: types.ConsumerMetadata{ + Name: generateLongString(types.MaxNameLength), + Description: generateLongString(types.MaxDescriptionLength), + Metadata: generateLongString(types.MaxMetadataLength), + }, + valid: true, + }, + { + name: "invalid name", + metadata: types.ConsumerMetadata{ + Name: generateLongString(types.MaxNameLength + 1), + Description: "description", + Metadata: "metadata", + }, + valid: false, + }, + { + name: "invalid description", + metadata: types.ConsumerMetadata{ + Name: "name", + Description: generateLongString(types.MaxDescriptionLength + 1), + Metadata: "metadata", + }, + valid: false, + }, + { + name: "invalid metadata", + metadata: types.ConsumerMetadata{ + Name: "name", + Description: "description", + Metadata: generateLongString(types.MaxMetadataLength + 1), + }, + valid: false, + }, + } + + for _, tc := range testCases { + err := types.ValidateConsumerMetadata(tc.metadata) + if tc.valid { + require.NoError(t, err, tc.name) + } else { + require.Error(t, err, tc.name) + } + } +} + func TestValidateInitializationParameters(t *testing.T) { now := time.Now().UTC() coolStr := "Cosmos Hub is the best place to launch a chain. Interchain Security is awesome." @@ -367,6 +438,64 @@ func TestValidateByteSlice(t *testing.T) { } } +func TestMsgCreateConsumerValidateBasic(t *testing.T) { + testCases := []struct { + name string + chainId string + powerShapingParameters *types.PowerShapingParameters + expPass bool + }{ + { + "empty chain id", + "", + nil, // no power-shaping parameters + false, + }, + { + "empty chain id after trimming", + " ", + nil, // no power-shaping parameters + false, + }, + { + "neutron chain id that cannot be reused", + "neutron-1", + nil, // no power-shaping parameters + false, + }, + { + "stride chain id that cannot be reused", + "stride-1", + nil, // no power-shaping parameters + false, + }, + { + "valid chain id", + "somechain-1", + nil, // no power-shaping parameters + true, + }, + { + "valid chain id and invalid power-shaping parameters", + "somechain-1", + &types.PowerShapingParameters{Top_N: 51}, // TopN cannot be > 0 in MsgCreateConsumer + false, + }, + } + + for _, tc := range testCases { + validConsumerMetadata := types.ConsumerMetadata{Name: "name", Description: "description", Metadata: "metadata"} + msg, err := types.NewMsgCreateConsumer("submitter", tc.chainId, validConsumerMetadata, nil, tc.powerShapingParameters) + require.NoError(t, err) + err = msg.ValidateBasic() + if tc.expPass { + require.NoError(t, err, "valid case: %s should not return error. got %w", tc.name, err) + } else { + require.Error(t, err, "invalid case: '%s' must return error but got none", tc.name) + } + } +} + func TestMsgUpdateConsumerValidateBasic(t *testing.T) { consAddr1 := "cosmosvalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7xw4mceq" consAddr2 := "cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39" From 7f99da330279d04898d284e47fc39450af49e70b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2024 11:55:18 +0000 Subject: [PATCH 26/28] build(deps): bump peter-evans/create-pull-request from 6 to 7 (#2240) Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 6 to 7. - [Release notes](https://github.com/peter-evans/create-pull-request/releases) - [Commits](https://github.com/peter-evans/create-pull-request/compare/v6...v7) --- updated-dependencies: - dependency-name: peter-evans/create-pull-request dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/codespell.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml index 4445e59805..35d4fbac87 100644 --- a/.github/workflows/codespell.yml +++ b/.github/workflows/codespell.yml @@ -15,7 +15,7 @@ jobs: run: | sudo apt-get install codespell -y codespell -w --skip="*.pb.go,*.pb.gw.go,*.json,*.git,*.js" --ignore-words=.github/.codespellignore - - uses: peter-evans/create-pull-request@v6 + - uses: peter-evans/create-pull-request@v7 with: token: ${{ secrets.PRBOT_PAT }} commit-message: "chore: spelling errors fixes" From 97daa925a9443f890a1243d25468a0138332ac76 Mon Sep 17 00:00:00 2001 From: Marius Poke Date: Tue, 10 Sep 2024 14:04:31 +0200 Subject: [PATCH 27/28] fix: address comments from permissionless review (#2237) * AttributeConsumerSpawnTime only on InitializeConsumer * fix error message for ValidateByteSlice * remove unnecessary errors * fix comments * add comment for consumer genesis creation * adding comment on why not removing all consumer state * improve comments --- x/ccv/provider/keeper/consumer_lifecycle.go | 13 +++++++++---- x/ccv/provider/keeper/msg_server.go | 19 ++++++++----------- x/ccv/provider/keeper/params.go | 2 +- x/ccv/provider/types/errors.go | 5 ----- x/ccv/provider/types/msg.go | 2 +- 5 files changed, 19 insertions(+), 22 deletions(-) diff --git a/x/ccv/provider/keeper/consumer_lifecycle.go b/x/ccv/provider/keeper/consumer_lifecycle.go index bf09f7210f..609cca108e 100644 --- a/x/ccv/provider/keeper/consumer_lifecycle.go +++ b/x/ccv/provider/keeper/consumer_lifecycle.go @@ -60,7 +60,7 @@ func (k Keeper) InitializeConsumer(ctx sdk.Context, consumerId string) (time.Tim return initializationParameters.SpawnTime, true } -// BeginBlockLaunchConsumers launches initialized consumers that are ready to launch +// BeginBlockLaunchConsumers launches initialized consumers chains for which the spawn time has passed func (k Keeper) BeginBlockLaunchConsumers(ctx sdk.Context) error { consumerIds, err := k.ConsumeIdsFromTimeQueue( ctx, @@ -204,10 +204,10 @@ func (k Keeper) CreateConsumerClient(ctx sdk.Context, consumerId string) error { // Set minimum height for equivocation evidence from this consumer chain k.SetEquivocationEvidenceMinHeight(ctx, consumerId, initializationRecord.InitialHeight.RevisionHeight) - // Consumers start out with the unbonding period from the consumer addition prop + // Consumers start out with the unbonding period from the initialization parameters consumerUnbondingPeriod := initializationRecord.UnbondingPeriod - // Create client state by getting template client from parameters and filling in zeroed fields from proposal. + // Create client state by getting template client from initialization parameters clientState := k.GetTemplateClient(ctx) clientState.ChainId = chainId clientState.LatestHeight = initializationRecord.InitialHeight @@ -351,6 +351,8 @@ func (k Keeper) MakeConsumerGenesis( } hash := tmtypes.NewValidatorSet(updatesAsValSet).Hash() + // note that providerFeePoolAddrStr is sent to the consumer during the IBC Channel handshake; + // see HandshakeMetadata in OnChanOpenTry on the provider-side, and OnChanOpenAck on the consumer-side consumerGenesisParams := ccv.NewParams( true, initializationRecord.BlocksPerDistributionTransmission, @@ -399,7 +401,7 @@ func (k Keeper) StopAndPrepareForConsumerRemoval(ctx sdk.Context, consumerId str return nil } -// BeginBlockRemoveConsumers iterates over the pending consumer proposals and stop/removes the chain if the removal time has passed +// BeginBlockRemoveConsumers removes stopped consumer chain for which the removal time has passed func (k Keeper) BeginBlockRemoveConsumers(ctx sdk.Context) error { consumerIds, err := k.ConsumeIdsFromTimeQueue( ctx, @@ -483,8 +485,11 @@ func (k Keeper) DeleteConsumerChain(ctx sdk.Context, consumerId string) (err err k.DeleteConsumerRemovalTime(ctx, consumerId) // TODO (PERMISSIONLESS) add newly-added state to be deleted + // Note that we do not delete ConsumerIdToChainIdKey and ConsumerIdToPhase, as well // as consumer metadata, initialization and power-shaping parameters. + // This is to enable block explorers and front ends to show information of + // consumer chains that were removed without needing an archive node. k.SetConsumerPhase(ctx, consumerId, types.CONSUMER_PHASE_DELETED) k.Logger(ctx).Info("consumer chain deleted from provider", "consumerId", consumerId) diff --git a/x/ccv/provider/keeper/msg_server.go b/x/ccv/provider/keeper/msg_server.go index 89a4de03a6..45fad0f7d7 100644 --- a/x/ccv/provider/keeper/msg_server.go +++ b/x/ccv/provider/keeper/msg_server.go @@ -386,11 +386,6 @@ func (k msgServer) CreateConsumer(goCtx context.Context, msg *types.MsgCreateCon return &resp, errorsmod.Wrapf(types.ErrInvalidConsumerInitializationParameters, "cannot set consumer initialization parameters: %s", err.Error()) } - if !initializationParameters.SpawnTime.IsZero() { - // add SpawnTime event attribute - eventAttributes = append(eventAttributes, - sdk.NewAttribute(types.AttributeConsumerSpawnTime, initializationParameters.SpawnTime.String())) - } // power-shaping parameters are optional and hence could be nil; // in that case, set the default @@ -413,6 +408,10 @@ func (k msgServer) CreateConsumer(goCtx context.Context, msg *types.MsgCreateCon return &resp, errorsmod.Wrapf(ccvtypes.ErrInvalidConsumerState, "cannot prepare chain with consumer id (%s) for launch", consumerId) } + + // add SpawnTime event attribute + eventAttributes = append(eventAttributes, + sdk.NewAttribute(types.AttributeConsumerSpawnTime, initializationParameters.SpawnTime.String())) } // add Phase event attribute @@ -508,12 +507,6 @@ func (k msgServer) UpdateConsumer(goCtx context.Context, msg *types.MsgUpdateCon return &resp, errorsmod.Wrapf(types.ErrInvalidConsumerInitializationParameters, "cannot set consumer initialization parameters: %s", err.Error()) } - - if !msg.InitializationParameters.SpawnTime.IsZero() { - // add SpawnTime event attribute - eventAttributes = append(eventAttributes, - sdk.NewAttribute(types.AttributeConsumerSpawnTime, msg.InitializationParameters.SpawnTime.String())) - } } if msg.PowerShapingParameters != nil { @@ -569,6 +562,10 @@ func (k msgServer) UpdateConsumer(goCtx context.Context, msg *types.MsgUpdateCon return &resp, errorsmod.Wrapf(ccvtypes.ErrInvalidConsumerState, "cannot prepare chain with consumer id (%s) for launch", consumerId) } + + // add SpawnTime event attribute + eventAttributes = append(eventAttributes, + sdk.NewAttribute(types.AttributeConsumerSpawnTime, msg.InitializationParameters.SpawnTime.String())) } // add Owner event attribute diff --git a/x/ccv/provider/keeper/params.go b/x/ccv/provider/keeper/params.go index 3bdb419a0a..aa3a306301 100644 --- a/x/ccv/provider/keeper/params.go +++ b/x/ccv/provider/keeper/params.go @@ -11,7 +11,7 @@ import ( "github.com/cosmos/interchain-security/v6/x/ccv/provider/types" ) -// GetTemplateClient returns the template client for provider proposals +// GetTemplateClient returns the template consumer client func (k Keeper) GetTemplateClient(ctx sdk.Context) *ibctmtypes.ClientState { params := k.GetParams(ctx) return params.TemplateClient diff --git a/x/ccv/provider/types/errors.go b/x/ccv/provider/types/errors.go index 2d87ee1345..dd2a6ea4c6 100644 --- a/x/ccv/provider/types/errors.go +++ b/x/ccv/provider/types/errors.go @@ -6,8 +6,6 @@ import ( // Provider sentinel errors var ( - 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") ErrInvalidConsumerId = errorsmod.Register(ModuleName, 6, "invalid consumer id") @@ -15,12 +13,9 @@ var ( ErrCannotAssignDefaultKeyAssignment = errorsmod.Register(ModuleName, 11, "cannot re-assign default key assignment") ErrInvalidConsumerRewardDenom = errorsmod.Register(ModuleName, 14, "invalid consumer reward denom") ErrInvalidConsumerClient = errorsmod.Register(ModuleName, 16, "ccv channel is not built on correct client") - ErrConsumerChainNotFound = errorsmod.Register(ModuleName, 18, "consumer chain not found") ErrCannotOptOutFromTopN = errorsmod.Register(ModuleName, 20, "cannot opt out from a Top N chain") - ErrInvalidConsumerModificationProposal = errorsmod.Register(ModuleName, 22, "invalid consumer modification proposal") ErrNoUnbondingTime = errorsmod.Register(ModuleName, 23, "provider unbonding time not found") 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") diff --git a/x/ccv/provider/types/msg.go b/x/ccv/provider/types/msg.go index 0d0ea89c75..63a868ad8a 100644 --- a/x/ccv/provider/types/msg.go +++ b/x/ccv/provider/types/msg.go @@ -577,7 +577,7 @@ func ValidateInitializationParameters(initializationParameters ConsumerInitializ func ValidateByteSlice(hash []byte, maxLength int) error { if len(hash) > maxLength { - return fmt.Errorf("hash is too long; got: %d, max: %d", len(hash), MaxHashLength) + return fmt.Errorf("hash is too long; got: %d, max: %d", len(hash), maxLength) } return nil } From 0600f7f098f19e151312108b373903f93ecbfd3e Mon Sep 17 00:00:00 2001 From: insumity Date: Tue, 10 Sep 2024 17:17:07 +0200 Subject: [PATCH 28/28] fix: do not allow the update of initialization parameters of launched chains and stop a chain from launching if (#2245) * init commit * took into account comments --- x/ccv/provider/keeper/consumer_lifecycle.go | 2 +- x/ccv/provider/keeper/msg_server.go | 30 ++++++-- x/ccv/provider/keeper/msg_server_test.go | 81 +++++++++++++++++++++ 3 files changed, 107 insertions(+), 6 deletions(-) diff --git a/x/ccv/provider/keeper/consumer_lifecycle.go b/x/ccv/provider/keeper/consumer_lifecycle.go index 609cca108e..adda4902d1 100644 --- a/x/ccv/provider/keeper/consumer_lifecycle.go +++ b/x/ccv/provider/keeper/consumer_lifecycle.go @@ -25,7 +25,7 @@ import ( // PrepareConsumerForLaunch prepares to move the launch of a consumer chain from the previous spawn time to spawn time. // Previous spawn time can correspond to its zero value if the validator was not previously set for launch. func (k Keeper) PrepareConsumerForLaunch(ctx sdk.Context, consumerId string, previousSpawnTime, spawnTime time.Time) error { - if !previousSpawnTime.Equal(time.Time{}) { + if !previousSpawnTime.IsZero() { // if this is not the first initialization and hence `previousSpawnTime` does not contain the zero value of `Time` // remove the consumer id from the previous spawn time err := k.RemoveConsumerToBeLaunched(ctx, consumerId, previousSpawnTime) diff --git a/x/ccv/provider/keeper/msg_server.go b/x/ccv/provider/keeper/msg_server.go index 45fad0f7d7..a1f057b3ee 100644 --- a/x/ccv/provider/keeper/msg_server.go +++ b/x/ccv/provider/keeper/msg_server.go @@ -494,7 +494,7 @@ func (k msgServer) UpdateConsumer(goCtx context.Context, msg *types.MsgUpdateCon eventAttributes = append(eventAttributes, sdk.NewAttribute(types.AttributeConsumerName, msg.Metadata.Name)) } - // get the previous spawn time so that we can use it in `PrepareConsumerForLaunch` + // get the previous spawn time so that we can remove its previously planned spawn time if a new spawn time is provided previousInitializationParameters, err := k.Keeper.GetConsumerInitializationParameters(ctx, consumerId) if err != nil { return &resp, errorsmod.Wrapf(ccvtypes.ErrInvalidConsumerState, @@ -503,6 +503,30 @@ func (k msgServer) UpdateConsumer(goCtx context.Context, msg *types.MsgUpdateCon previousSpawnTime := previousInitializationParameters.SpawnTime if msg.InitializationParameters != nil { + phase := k.GetConsumerPhase(ctx, consumerId) + + if phase == types.CONSUMER_PHASE_LAUNCHED { + return &resp, errorsmod.Wrap(types.ErrInvalidMsgUpdateConsumer, + "cannot update the initialization parameters of an an already launched chain; "+ + "do not provide any initialization parameters when updating a launched chain") + } + + if msg.InitializationParameters.SpawnTime.IsZero() { + if phase == types.CONSUMER_PHASE_INITIALIZED { + // chain was previously ready to launch at `previousSpawnTime` so we remove the + // consumer from getting launched and move it back to the Registered phase + err = k.RemoveConsumerToBeLaunched(ctx, consumerId, previousSpawnTime) + if err != nil { + return &resp, errorsmod.Wrapf(types.ErrInvalidMsgUpdateConsumer, + "cannot remove the consumer from being launched: %s", err.Error()) + } + k.SetConsumerPhase(ctx, consumerId, types.CONSUMER_PHASE_REGISTERED) + } + } + // add SpawnTime event attribute + eventAttributes = append(eventAttributes, + sdk.NewAttribute(types.AttributeConsumerSpawnTime, msg.InitializationParameters.SpawnTime.String())) + if err = k.Keeper.SetConsumerInitializationParameters(ctx, msg.ConsumerId, *msg.InitializationParameters); err != nil { return &resp, errorsmod.Wrapf(types.ErrInvalidConsumerInitializationParameters, "cannot set consumer initialization parameters: %s", err.Error()) @@ -562,10 +586,6 @@ func (k msgServer) UpdateConsumer(goCtx context.Context, msg *types.MsgUpdateCon return &resp, errorsmod.Wrapf(ccvtypes.ErrInvalidConsumerState, "cannot prepare chain with consumer id (%s) for launch", consumerId) } - - // add SpawnTime event attribute - eventAttributes = append(eventAttributes, - sdk.NewAttribute(types.AttributeConsumerSpawnTime, msg.InitializationParameters.SpawnTime.String())) } // add Owner event attribute diff --git a/x/ccv/provider/keeper/msg_server_test.go b/x/ccv/provider/keeper/msg_server_test.go index a2f9cb3aab..e9689eb943 100644 --- a/x/ccv/provider/keeper/msg_server_test.go +++ b/x/ccv/provider/keeper/msg_server_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" "testing" "time" @@ -176,4 +177,84 @@ func TestUpdateConsumer(t *testing.T) { require.Equal(t, providertypes.ConsumerIds{ Ids: []string{consumerId}, }, consumerIds) + + // assert that we CANNOT update the initialization parameters of a launched chain + providerKeeper.SetConsumerPhase(ctx, consumerId, providertypes.CONSUMER_PHASE_LAUNCHED) + _, err = msgServer.UpdateConsumer(ctx, + &providertypes.MsgUpdateConsumer{ + Owner: expectedOwnerAddress, ConsumerId: consumerId, + Metadata: nil, + InitializationParameters: &expectedInitializationParameters, + PowerShapingParameters: nil, + }) + require.ErrorContains(t, err, "cannot update the initialization parameters of an an already launched chain") + + // assert that we can update the consumer metadata of a launched chain + providerKeeper.SetConsumerPhase(ctx, consumerId, providertypes.CONSUMER_PHASE_LAUNCHED) + expectedConsumerMetadata.Name = "name of a launched chain" + _, err = msgServer.UpdateConsumer(ctx, + &providertypes.MsgUpdateConsumer{ + Owner: expectedOwnerAddress, ConsumerId: consumerId, + Metadata: &expectedConsumerMetadata, + InitializationParameters: nil, + PowerShapingParameters: nil, + }) + require.NoError(t, err) + actualConsumerMetadata, err = providerKeeper.GetConsumerMetadata(ctx, consumerId) + require.NoError(t, err) + require.Equal(t, expectedConsumerMetadata, actualConsumerMetadata) + + // assert that we can update the power-shaping parameters of a launched chain + providerKeeper.SetConsumerPhase(ctx, consumerId, providertypes.CONSUMER_PHASE_LAUNCHED) + expectedPowerShapingParameters.ValidatorSetCap = 123 + _, err = msgServer.UpdateConsumer(ctx, + &providertypes.MsgUpdateConsumer{ + Owner: expectedOwnerAddress, ConsumerId: consumerId, + Metadata: nil, + InitializationParameters: nil, + PowerShapingParameters: &expectedPowerShapingParameters, + }) + require.NoError(t, err) + actualPowerShapingParameters, err = providerKeeper.GetConsumerPowerShapingParameters(ctx, consumerId) + require.NoError(t, err) + require.Equal(t, expectedPowerShapingParameters, actualPowerShapingParameters) + + // assert that if we call `MsgUpdateConsumer` with a spawn time of zero on an initialized chain, the chain + // will not be scheduled to launch and will move back to its Registered phase + providerKeeper.SetConsumerPhase(ctx, consumerId, providertypes.CONSUMER_PHASE_INITIALIZED) + // first assert that the chain is scheduled to launch + previousSpawnTime = expectedInitializationParameters.SpawnTime + consumerIds, err = providerKeeper.GetConsumersToBeLaunched(ctx, previousSpawnTime) + require.NoError(t, err) + require.Equal(t, providertypes.ConsumerIds{ + Ids: []string{consumerId}, + }, consumerIds) + + // then, update with a spawn time of zero to prevent the chain from launching + expectedInitializationParameters.SpawnTime = time.Time{} + // also update an arbitrary field of the initialization parameters + // to verify that the parameters of the chain get updated + expectedInitializationParameters.InitialHeight = types.NewHeight(1, 123456) + _, err = msgServer.UpdateConsumer(ctx, + &providertypes.MsgUpdateConsumer{ + Owner: expectedOwnerAddress, ConsumerId: consumerId, + Metadata: nil, + InitializationParameters: &expectedInitializationParameters, + PowerShapingParameters: nil, + }) + // assert the chain is not scheduled to launch + consumerIds, err = providerKeeper.GetConsumersToBeLaunched(ctx, previousSpawnTime) + require.NoError(t, err) + require.Empty(t, consumerIds) + // also assert that no chain is scheduled to launch at zero time + consumerIds, err = providerKeeper.GetConsumersToBeLaunched(ctx, time.Time{}) + require.NoError(t, err) + require.Empty(t, consumerIds) + // assert that the chain has moved to the registered phase because it is not ready to launch + phase = providerKeeper.GetConsumerPhase(ctx, consumerId) + require.Equal(t, providertypes.CONSUMER_PHASE_REGISTERED, phase) + // assert that the initialization parameters of the chain were nevertheless updated + actualInitializationParameters, err = providerKeeper.GetConsumerInitializationParameters(ctx, consumerId) + require.NoError(t, err) + require.Equal(t, expectedInitializationParameters, actualInitializationParameters) }