From 39e50607c67b5c3125c5f8568c22d84caf24c395 Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Tue, 25 Jun 2024 12:40:08 +0200 Subject: [PATCH 01/32] Refactor validator set storage --- .../provider/keeper/validator_set_storage.go | 105 ++++++++++++++++++ x/ccv/provider/keeper/validator_set_update.go | 56 ++-------- 2 files changed, 117 insertions(+), 44 deletions(-) create mode 100644 x/ccv/provider/keeper/validator_set_storage.go diff --git a/x/ccv/provider/keeper/validator_set_storage.go b/x/ccv/provider/keeper/validator_set_storage.go new file mode 100644 index 0000000000..deece1bb3f --- /dev/null +++ b/x/ccv/provider/keeper/validator_set_storage.go @@ -0,0 +1,105 @@ +package keeper + +import ( + "fmt" + + "cosmossdk.io/math" + storetypes "cosmossdk.io/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" +) + +// getValidatorKey constructs the key to access a given validator, stored under a given prefix. +func (k Keeper) getValidatorKey(prefix []byte, providerAddr types.ProviderConsAddress) []byte { + return append(prefix, providerAddr.ToSdkConsAddr()...) +} + +// setValidator stores the given `validator` in the validator set stored under the given prefix. +func (k Keeper) setValidator( + ctx sdk.Context, + prefix []byte, + validator types.ConsumerValidator, +) { + store := ctx.KVStore(k.storeKey) + bz, err := validator.Marshal() + if err != nil { + panic(fmt.Errorf("failed to marshal ConsumerValidator: %w", err)) + } + + store.Set(k.getValidatorKey(prefix, types.NewProviderConsAddress(validator.ProviderConsAddr)), bz) +} + +// setValSet resets the validator set stored under the given prefix to the provided `nextValidators`. +func (k Keeper) setValSet(ctx sdk.Context, prefix []byte, nextValidators []types.ConsumerValidator) { + k.deleteValSet(ctx, prefix) + for _, val := range nextValidators { + k.setValidator(ctx, prefix, val) + } +} + +// deleteValidator removes validator with `providerAddr` address from the +// validator set stored under the given prefix. +func (k Keeper) deleteValidator( + ctx sdk.Context, + prefix []byte, + providerConsAddr types.ProviderConsAddress, +) { + store := ctx.KVStore(k.storeKey) + store.Delete(k.getValidatorKey(prefix, providerConsAddr)) +} + +// deleteValSet deletes all the stored consumer validators under the given prefix. +func (k Keeper) deleteValSet( + ctx sdk.Context, + prefix []byte, +) { + store := ctx.KVStore(k.storeKey) + iterator := storetypes.KVStorePrefixIterator(store, prefix) + + var keysToDel [][]byte + defer iterator.Close() + for ; iterator.Valid(); iterator.Next() { + keysToDel = append(keysToDel, iterator.Key()) + } + for _, delKey := range keysToDel { + store.Delete(delKey) + } +} + +// isValidator returns `true` if the validator with `providerAddr` exists +// in the validator set stored under the given prefix. +func (k Keeper) isValidator(ctx sdk.Context, prefix []byte, providerAddr types.ProviderConsAddress) bool { + store := ctx.KVStore(k.storeKey) + return store.Get(k.getValidatorKey(prefix, providerAddr)) != nil +} + +// getValSet returns all the validators stored under the given prefix. +func (k Keeper) getValSet( + ctx sdk.Context, + key []byte, +) (validators []types.ConsumerValidator) { + store := ctx.KVStore(k.storeKey) + iterator := storetypes.KVStorePrefixIterator(store, key) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + iterator.Value() + var validator types.ConsumerValidator + if err := validator.Unmarshal(iterator.Value()); err != nil { + panic(fmt.Errorf("failed to unmarshal ConsumerValidator: %w", err)) + } + validators = append(validators, validator) + } + + return validators +} + +func (k Keeper) getTotalPower(ctx sdk.Context, prefix []byte) math.Int { + totalPower := math.ZeroInt() + validators := k.getValSet(ctx, prefix) + for _, val := range validators { + totalPower = totalPower.Add(math.NewInt(val.Power)) + } + return totalPower +} diff --git a/x/ccv/provider/keeper/validator_set_update.go b/x/ccv/provider/keeper/validator_set_update.go index 4f8a127884..1bf12748ae 100644 --- a/x/ccv/provider/keeper/validator_set_update.go +++ b/x/ccv/provider/keeper/validator_set_update.go @@ -3,7 +3,6 @@ package keeper import ( "fmt" - storetypes "cosmossdk.io/store/types" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -13,28 +12,24 @@ import ( ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" ) +// GetConsumerChainKey returns the store key for consumer validators of the consumer chain with `chainID` +func (k Keeper) GetConsumerChainKey(ctx sdk.Context, chainID string) []byte { + return types.ChainIdWithLenKey(types.ConsumerValidatorBytePrefix, chainID) +} + // SetConsumerValidator sets provided consumer `validator` on the consumer chain with `chainID` func (k Keeper) SetConsumerValidator( ctx sdk.Context, chainID string, validator types.ConsumerValidator, ) { - store := ctx.KVStore(k.storeKey) - bz, err := validator.Marshal() - if err != nil { - panic(fmt.Errorf("failed to marshal ConsumerValidator: %w", err)) - } - - store.Set(types.ConsumerValidatorKey(chainID, validator.ProviderConsAddr), bz) + k.setValidator(ctx, k.GetConsumerChainKey(ctx, chainID), 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.ConsumerValidator) { - k.DeleteConsumerValSet(ctx, chainID) - for _, val := range nextValidators { - k.SetConsumerValidator(ctx, chainID, val) - } + k.setValSet(ctx, k.GetConsumerChainKey(ctx, chainID), nextValidators) } // DeleteConsumerValidator removes consumer validator with `providerAddr` address @@ -43,8 +38,7 @@ func (k Keeper) DeleteConsumerValidator( chainID string, providerConsAddr types.ProviderConsAddress, ) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.ConsumerValidatorKey(chainID, providerConsAddr.ToSdkConsAddr())) + k.deleteValidator(ctx, k.GetConsumerChainKey(ctx, chainID), providerConsAddr) } // DeleteConsumerValSet deletes all the stored consumer validators for chain `chainID` @@ -52,47 +46,21 @@ func (k Keeper) DeleteConsumerValSet( ctx sdk.Context, chainID string, ) { - store := ctx.KVStore(k.storeKey) - key := types.ChainIdWithLenKey(types.ConsumerValidatorBytePrefix, chainID) - iterator := storetypes.KVStorePrefixIterator(store, key) - - var keysToDel [][]byte - defer iterator.Close() - for ; iterator.Valid(); iterator.Next() { - keysToDel = append(keysToDel, iterator.Key()) - } - for _, delKey := range keysToDel { - store.Delete(delKey) - } + k.deleteValSet(ctx, k.GetConsumerChainKey(ctx, chainID)) } // IsConsumerValidator returns `true` if the consumer validator with `providerAddr` exists for chain `chainID` // and `false` otherwise func (k Keeper) IsConsumerValidator(ctx sdk.Context, chainID string, providerAddr types.ProviderConsAddress) bool { - store := ctx.KVStore(k.storeKey) - return store.Get(types.ConsumerValidatorKey(chainID, providerAddr.ToSdkConsAddr())) != nil + return k.isValidator(ctx, k.GetConsumerChainKey(ctx, chainID), providerAddr) } // GetConsumerValSet returns all the consumer validators for chain `chainID` func (k Keeper) GetConsumerValSet( ctx sdk.Context, chainID string, -) (validators []types.ConsumerValidator) { - store := ctx.KVStore(k.storeKey) - key := types.ChainIdWithLenKey(types.ConsumerValidatorBytePrefix, chainID) - iterator := storetypes.KVStorePrefixIterator(store, key) - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - iterator.Value() - var validator types.ConsumerValidator - if err := validator.Unmarshal(iterator.Value()); err != nil { - panic(fmt.Errorf("failed to unmarshal ConsumerValidator: %w", err)) - } - validators = append(validators, validator) - } - - return validators +) []types.ConsumerValidator { + return k.getValSet(ctx, k.GetConsumerChainKey(ctx, chainID)) } // DiffValidators compares the current and the next epoch's consumer validators and returns the `ValidatorUpdate` diff From 7441fe00547a31524a7e5f2b4413aa63067c7d33 Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Tue, 25 Jun 2024 12:41:22 +0200 Subject: [PATCH 02/32] Add comment for getTotalPower --- x/ccv/provider/keeper/validator_set_storage.go | 1 + 1 file changed, 1 insertion(+) diff --git a/x/ccv/provider/keeper/validator_set_storage.go b/x/ccv/provider/keeper/validator_set_storage.go index deece1bb3f..71be6cca5a 100644 --- a/x/ccv/provider/keeper/validator_set_storage.go +++ b/x/ccv/provider/keeper/validator_set_storage.go @@ -95,6 +95,7 @@ func (k Keeper) getValSet( return validators } +// getTotalPower computes the total power of all the consumer validators stored under the given prefix. func (k Keeper) getTotalPower(ctx sdk.Context, prefix []byte) math.Int { totalPower := math.ZeroInt() validators := k.getValSet(ctx, prefix) From d9a51fb00a7e6587a1f96857ca947b88accefb94 Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Tue, 25 Jun 2024 12:50:55 +0200 Subject: [PATCH 03/32] Add provider consensus validator set storage --- x/ccv/provider/keeper/provider_consensus.go | 56 ++++++++++ .../keeper/provider_consensus_test.go | 102 ++++++++++++++++++ x/ccv/provider/types/keys.go | 10 ++ 3 files changed, 168 insertions(+) create mode 100644 x/ccv/provider/keeper/provider_consensus.go create mode 100644 x/ccv/provider/keeper/provider_consensus_test.go diff --git a/x/ccv/provider/keeper/provider_consensus.go b/x/ccv/provider/keeper/provider_consensus.go new file mode 100644 index 0000000000..7212842411 --- /dev/null +++ b/x/ccv/provider/keeper/provider_consensus.go @@ -0,0 +1,56 @@ +package keeper + +import ( + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" +) + +// SetLastProviderConsensusValidator sets the given validator to be stored +// as part of the last provider consensus validator set +func (k Keeper) SetLastProviderConsensusValidator( + ctx sdk.Context, + validator types.ConsumerValidator, +) { + k.setValidator(ctx, []byte{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.ConsumerValidator) { + k.setValSet(ctx, []byte{types.LastProviderConsensusValsPrefix}, nextValidators) +} + +// DeleteLastProviderConsensusValidator removes the validator with `providerConsAddr` address +// from the stored last provider consensus validator set +func (k Keeper) DeleteLastProviderConsensusValidator( + ctx sdk.Context, + providerConsAddr types.ProviderConsAddress, +) { + k.deleteValidator(ctx, []byte{types.LastProviderConsensusValsPrefix}, providerConsAddr) +} + +// DeleteLastProviderConsensusValSet deletes all the stored validators from the +// last provider consensus validator set +func (k Keeper) DeleteLastProviderConsensusValSet( + ctx sdk.Context, +) { + k.deleteValSet(ctx, []byte{types.LastProviderConsensusValsPrefix}) +} + +// GetLastProviderConsensusValSet returns the last stored +// validator set sent to the consensus engine on the provider +func (k Keeper) GetLastProviderConsensusValSet( + ctx sdk.Context, +) []types.ConsumerValidator { + return k.getValSet(ctx, []byte{types.LastProviderConsensusValsPrefix}) +} + +// GetLastTotalProviderConsensusPower returns the total power of the last stored +// validator set sent to the consensus engine on the provider +func (k Keeper) GetLastTotalProviderConsensusPower( + ctx sdk.Context, +) math.Int { + return k.getTotalPower(ctx, []byte{types.LastProviderConsensusValsPrefix}) +} diff --git a/x/ccv/provider/keeper/provider_consensus_test.go b/x/ccv/provider/keeper/provider_consensus_test.go new file mode 100644 index 0000000000..3f6a84b453 --- /dev/null +++ b/x/ccv/provider/keeper/provider_consensus_test.go @@ -0,0 +1,102 @@ +package keeper_test + +import ( + "testing" + + "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" +) + +func TestSetLastProviderConsensusValidator(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + validator := types.ConsumerValidator{ + ProviderConsAddr: []byte("providerConsAddr"), + Power: 2, + ConsumerPublicKey: &crypto.PublicKey{}, + } + + providerKeeper.SetLastProviderConsensusValidator(ctx, validator) + + // Retrieve the stored validator + storedValidator := providerKeeper.GetLastProviderConsensusValSet(ctx)[0] + + require.Equal(t, validator, storedValidator, "stored validator does not match") +} + +func TestSetLastProviderConsensusValSet(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + validator1 := types.ConsumerValidator{ + ProviderConsAddr: []byte("providerConsAddr1"), + Power: 2, + ConsumerPublicKey: &crypto.PublicKey{}, + } + + validator2 := types.ConsumerValidator{ + ProviderConsAddr: []byte("providerConsAddr2"), + Power: 3, + ConsumerPublicKey: &crypto.PublicKey{}, + } + + nextValidators := []types.ConsumerValidator{validator1, validator2} + + providerKeeper.SetLastProviderConsensusValSet(ctx, nextValidators) + + // Retrieve the stored validator set + storedValidators := providerKeeper.GetLastProviderConsensusValSet(ctx) + require.Equal(t, nextValidators, storedValidators, "stored validator set does not match") +} + +func TestDeleteLastProviderConsensusValidator(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + validator := types.ConsumerValidator{ + ProviderConsAddr: []byte("providerConsAddr"), + Power: 2, + ConsumerPublicKey: &crypto.PublicKey{}, + } + + providerKeeper.SetLastProviderConsensusValidator(ctx, validator) + + // Delete the stored validator + providerKeeper.DeleteLastProviderConsensusValidator(ctx, types.NewProviderConsAddress(validator.ProviderConsAddr)) + + // Ensure the validator is deleted + storedValidators := providerKeeper.GetLastProviderConsensusValSet(ctx) + require.Empty(t, storedValidators, "validator set should be empty") +} + +func TestDeleteLastProviderConsensusValSet(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + validator1 := types.ConsumerValidator{ + ProviderConsAddr: []byte("providerConsAddr1"), + Power: 2, + ConsumerPublicKey: &crypto.PublicKey{}, + } + + validator2 := types.ConsumerValidator{ + ProviderConsAddr: []byte("providerConsAddr2"), + Power: 3, + ConsumerPublicKey: &crypto.PublicKey{}, + } + + nextValidators := []types.ConsumerValidator{validator1, validator2} + + providerKeeper.SetLastProviderConsensusValSet(ctx, nextValidators) + + // Delete the stored validator set + providerKeeper.DeleteLastProviderConsensusValSet(ctx) + + // Ensure the validator set is empty + storedValidators := providerKeeper.GetLastProviderConsensusValSet(ctx) + require.Empty(t, storedValidators, "validator set should be empty") +} diff --git a/x/ccv/provider/types/keys.go b/x/ccv/provider/types/keys.go index 47231c219f..2e1315ff93 100644 --- a/x/ccv/provider/types/keys.go +++ b/x/ccv/provider/types/keys.go @@ -187,6 +187,10 @@ const ( // minimum power required to be in the top N per consumer chain. MinimumPowerInTopNBytePrefix + // LastProviderConsensusValsPrefix is byte prefix for storing the last validator set + // sent to the consensus engine of the provider chain + LastProviderConsensusValsPrefix + // NOTE: DO NOT ADD NEW BYTE PREFIXES HERE WITHOUT ADDING THEM TO getAllKeyPrefixes() IN keys_test.go ) @@ -621,6 +625,12 @@ func MinimumPowerInTopNKey(chainID string) []byte { return ChainIdWithLenKey(MinimumPowerInTopNBytePrefix, chainID) } +// LastProviderConsensusValidatorKey returns the key of the validator with `providerAddr` +// in the last validator set sent to the consensus engine of the provider chain +func LastProviderConsensusValidatorKey(providerAddr []byte) []byte { + return append([]byte{LastProviderConsensusValsPrefix}, providerAddr...) +} + // // End of generic helpers section // From 96a47d718d10a199702f5774c75d349ecf72adb7 Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Tue, 25 Jun 2024 13:58:22 +0200 Subject: [PATCH 04/32] Add new MaxProviderConsensusValidators param --- .../ccv/provider/v1/provider.proto | 4 + x/ccv/provider/keeper/params_test.go | 1 + x/ccv/provider/migrations/v6/legacy_params.go | 2 + x/ccv/provider/types/genesis_test.go | 26 +- x/ccv/provider/types/params.go | 8 + x/ccv/provider/types/params_test.go | 28 +- x/ccv/provider/types/provider.pb.go | 291 ++++++++++-------- 7 files changed, 209 insertions(+), 151 deletions(-) diff --git a/proto/interchain_security/ccv/provider/v1/provider.proto b/proto/interchain_security/ccv/provider/v1/provider.proto index 339d94a833..bcb61418cf 100644 --- a/proto/interchain_security/ccv/provider/v1/provider.proto +++ b/proto/interchain_security/ccv/provider/v1/provider.proto @@ -251,6 +251,10 @@ message Params { // The number of blocks that comprise an epoch. int64 blocks_per_epoch = 10; + + // The maximal number of validators that will be passed + // to the consensus engine on the provider. + int64 max_provider_consensus_validators = 11; } // SlashAcks contains cons addresses of consumer chain validators diff --git a/x/ccv/provider/keeper/params_test.go b/x/ccv/provider/keeper/params_test.go index 6450102c2a..e6a9db59bf 100644 --- a/x/ccv/provider/keeper/params_test.go +++ b/x/ccv/provider/keeper/params_test.go @@ -50,6 +50,7 @@ func TestParams(t *testing.T) { Amount: math.NewInt(10000000), }, 600, + 10, ) providerKeeper.SetParams(ctx, newParams) params = providerKeeper.GetParams(ctx) diff --git a/x/ccv/provider/migrations/v6/legacy_params.go b/x/ccv/provider/migrations/v6/legacy_params.go index 1841497bce..b1e0d0ed05 100644 --- a/x/ccv/provider/migrations/v6/legacy_params.go +++ b/x/ccv/provider/migrations/v6/legacy_params.go @@ -88,5 +88,7 @@ func GetParamsLegacy(ctx sdk.Context, paramspace ccvtypes.LegacyParamSubspace) t getSlashMeterReplenishFraction(ctx, paramspace), getConsumerRewardDenomRegistrationFee(ctx, paramspace), getBlocksPerEpoch(ctx, paramspace), + // this parameter is new so it doesn't need to be migrated, just initialized + types.DefaultMaxProviderConsensusValidators, ) } diff --git a/x/ccv/provider/types/genesis_test.go b/x/ccv/provider/types/genesis_test.go index f040a2ee08..f2177a3000 100644 --- a/x/ccv/provider/types/genesis_test.go +++ b/x/ccv/provider/types/genesis_test.go @@ -82,7 +82,7 @@ func TestValidateGenesisState(t *testing.T) { 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, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 600), + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 600, 180), nil, nil, nil, @@ -103,7 +103,7 @@ func TestValidateGenesisState(t *testing.T) { 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, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 600), + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 600, 180), nil, nil, nil, @@ -124,7 +124,7 @@ func TestValidateGenesisState(t *testing.T) { 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, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 600), + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 600, 180), nil, nil, nil, @@ -145,7 +145,7 @@ func TestValidateGenesisState(t *testing.T) { 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, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 600), + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 600, 180), nil, nil, nil, @@ -172,7 +172,7 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultVscTimeoutPeriod, types.DefaultSlashMeterReplenishPeriod, types.DefaultSlashMeterReplenishFraction, - sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 600), + sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 600, 180), nil, nil, nil, @@ -199,7 +199,7 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultVscTimeoutPeriod, types.DefaultSlashMeterReplenishPeriod, types.DefaultSlashMeterReplenishFraction, - sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 600), + sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 600, 180), nil, nil, nil, @@ -226,7 +226,7 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultVscTimeoutPeriod, types.DefaultSlashMeterReplenishPeriod, types.DefaultSlashMeterReplenishFraction, - sdk.Coin{Denom: "stake", Amount: math.NewInt(1000000)}, 600), + sdk.Coin{Denom: "stake", Amount: math.NewInt(1000000)}, 600, 180), nil, nil, nil, @@ -253,7 +253,7 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultVscTimeoutPeriod, types.DefaultSlashMeterReplenishPeriod, types.DefaultSlashMeterReplenishFraction, - sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 600), + sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 600, 180), nil, nil, nil, @@ -280,7 +280,7 @@ func TestValidateGenesisState(t *testing.T) { 0, // 0 vsc timeout here types.DefaultSlashMeterReplenishPeriod, types.DefaultSlashMeterReplenishFraction, - sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 600), + sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 600, 180), nil, nil, nil, @@ -307,7 +307,7 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultVscTimeoutPeriod, 0, // 0 slash meter replenish period here types.DefaultSlashMeterReplenishFraction, - sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 600), + sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 600, 180), nil, nil, nil, @@ -334,7 +334,7 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultVscTimeoutPeriod, types.DefaultSlashMeterReplenishPeriod, "1.15", - sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 600), + sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 600, 180), nil, nil, nil, @@ -686,7 +686,7 @@ func TestValidateGenesisState(t *testing.T) { 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, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "st", Amount: math.NewInt(10000000)}, 600), + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "st", Amount: math.NewInt(10000000)}, 600, 180), nil, nil, nil, @@ -707,7 +707,7 @@ func TestValidateGenesisState(t *testing.T) { 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, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(-1000000)}, 600), + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(-1000000)}, 600, 180), nil, nil, nil, diff --git a/x/ccv/provider/types/params.go b/x/ccv/provider/types/params.go index ac677004bc..23b9927890 100644 --- a/x/ccv/provider/types/params.go +++ b/x/ccv/provider/types/params.go @@ -42,6 +42,10 @@ const ( // an epoch corresponds to 1 hour (6 * 600 = 3600 seconds). // forcing int64 as the Params KeyTable expects an int64 and not int. DefaultBlocksPerEpoch = int64(600) + + // DefaultMaxProviderConsensusValidators is the default maximum number of validators that will + // be passed on from the staking module to the consensus engine on the provider. + DefaultMaxProviderConsensusValidators = 180 ) // Reflection based keys for params subspace @@ -57,6 +61,7 @@ var ( KeySlashMeterReplenishFraction = []byte("SlashMeterReplenishFraction") KeyConsumerRewardDenomRegistrationFee = []byte("ConsumerRewardDenomRegistrationFee") KeyBlocksPerEpoch = []byte("BlocksPerEpoch") + KeyMaxProviderConsensusValidators = []byte("MaxProviderConsensusValidators") ) // ParamKeyTable returns a key table with the necessary registered provider params @@ -75,6 +80,7 @@ func NewParams( slashMeterReplenishFraction string, consumerRewardDenomRegistrationFee sdk.Coin, blocksPerEpoch int64, + maxProviderConsensusValidators int64, ) Params { return Params{ TemplateClient: cs, @@ -86,6 +92,7 @@ func NewParams( SlashMeterReplenishFraction: slashMeterReplenishFraction, ConsumerRewardDenomRegistrationFee: consumerRewardDenomRegistrationFee, BlocksPerEpoch: blocksPerEpoch, + MaxProviderConsensusValidators: maxProviderConsensusValidators, } } @@ -117,6 +124,7 @@ func DefaultParams() Params { Amount: math.NewInt(10000000), }, DefaultBlocksPerEpoch, + DefaultMaxProviderConsensusValidators, ) } diff --git a/x/ccv/provider/types/params_test.go b/x/ccv/provider/types/params_test.go index 675ddd0bc5..e4996557c5 100644 --- a/x/ccv/provider/types/params_test.go +++ b/x/ccv/provider/types/params_test.go @@ -25,39 +25,43 @@ func TestValidateParams(t *testing.T) { {"custom valid params", types.NewParams( ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - "0.33", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 1000), true}, + "0.33", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 1000, 180), true}, {"custom invalid params", types.NewParams( ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, 0, clienttypes.Height{}, nil, []string{"ibc", "upgradedIBCState"}), - "0.33", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 1000), false}, + "0.33", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 1000, 180), false}, {"blank client", types.NewParams(&ibctmtypes.ClientState{}, - "0.33", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 1000), false}, - {"nil client", types.NewParams(nil, "0.33", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 1000), false}, + "0.33", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 1000, 180), false}, + {"nil client", types.NewParams(nil, "0.33", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 1000, 180), false}, // Check if "0.00" is valid or if a zero dec TrustFraction needs to return an error {"0 trusting period fraction", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - "0.00", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 1000), true}, + "0.00", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 1000, 180), true}, {"0 ccv timeout period", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - "0.33", 0, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 1000), false}, + "0.33", 0, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 1000, 180), false}, {"0 init timeout period", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - "0.33", time.Hour, 0, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 1000), false}, + "0.33", time.Hour, 0, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 1000, 180), false}, {"0 vsc timeout period", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - "0.33", time.Hour, time.Hour, 0, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 1000), false}, + "0.33", time.Hour, time.Hour, 0, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 1000, 180), false}, {"0 slash meter replenish period", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - "0.33", time.Hour, time.Hour, 24*time.Hour, 0, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 1000), false}, + "0.33", time.Hour, time.Hour, 24*time.Hour, 0, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 1000, 180), false}, {"slash meter replenish fraction over 1", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - "0.33", time.Hour, time.Hour, 24*time.Hour, time.Hour, "1.5", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 1000), false}, + "0.33", time.Hour, time.Hour, 24*time.Hour, time.Hour, "1.5", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 1000, 180), false}, {"invalid consumer reward denom registration fee denom", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - "0.33", time.Hour, time.Hour, 24*time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "st", Amount: math.NewInt(10000000)}, 1000), false}, + "0.33", time.Hour, time.Hour, 24*time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "st", Amount: math.NewInt(10000000)}, 1000, 180), false}, {"invalid consumer reward denom registration fee amount", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - "0.33", time.Hour, time.Hour, 24*time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(-10000000)}, 1000), false}, + "0.33", time.Hour, time.Hour, 24*time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(-10000000)}, 1000, 180), false}, + {"0 max provider consensus validators", types.NewParams( + ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, + time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), + "0.33", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 1000, 0), false}, } for _, tc := range testCases { diff --git a/x/ccv/provider/types/provider.pb.go b/x/ccv/provider/types/provider.pb.go index dbada484bc..c6be692b69 100644 --- a/x/ccv/provider/types/provider.pb.go +++ b/x/ccv/provider/types/provider.pb.go @@ -597,6 +597,9 @@ type Params struct { ConsumerRewardDenomRegistrationFee types2.Coin `protobuf:"bytes,9,opt,name=consumer_reward_denom_registration_fee,json=consumerRewardDenomRegistrationFee,proto3" json:"consumer_reward_denom_registration_fee"` // The number of blocks that comprise an epoch. BlocksPerEpoch int64 `protobuf:"varint,10,opt,name=blocks_per_epoch,json=blocksPerEpoch,proto3" json:"blocks_per_epoch,omitempty"` + // The maximal number of validators that will be passed + // to the consensus engine on the provider. + MaxProviderConsensusValidators int64 `protobuf:"varint,11,opt,name=max_provider_consensus_validators,json=maxProviderConsensusValidators,proto3" json:"max_provider_consensus_validators,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -695,6 +698,13 @@ func (m *Params) GetBlocksPerEpoch() int64 { return 0 } +func (m *Params) GetMaxProviderConsensusValidators() int64 { + if m != nil { + return m.MaxProviderConsensusValidators + } + return 0 +} + // SlashAcks contains cons addresses of consumer chain validators // successfully slashed on the provider chain. type SlashAcks struct { @@ -1683,132 +1693,134 @@ func init() { } var fileDescriptor_f22ec409a72b7b72 = []byte{ - // 1988 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcb, 0x6f, 0x1b, 0xc7, - 0x19, 0xd7, 0x92, 0x94, 0x44, 0x0e, 0xf5, 0x1c, 0x29, 0xf1, 0x4a, 0x55, 0x29, 0x7a, 0xd3, 0xb8, - 0x6a, 0x5c, 0x2f, 0x23, 0x07, 0x01, 0x0c, 0xa1, 0x41, 0x20, 0x51, 0x4e, 0x2c, 0x2b, 0xb6, 0x95, - 0x95, 0x2a, 0xa3, 0xed, 0x61, 0x31, 0x9c, 0x1d, 0x93, 0x03, 0x2d, 0x77, 0xd6, 0x33, 0xc3, 0x55, - 0x78, 0xe9, 0xb9, 0x97, 0x02, 0xe9, 0x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 0x07, 0x37, 0x41, 0xbd, 0x43, 0x03, 0xc4, 0x87, 0xb1, 0xc4, 0x8c, 0x96, - 0x00, 0x31, 0x49, 0x0b, 0xb4, 0x01, 0x10, 0x21, 0x3a, 0x0f, 0x5c, 0x95, 0x1b, 0xe6, 0x6c, 0xe2, - 0x48, 0x9c, 0x17, 0x76, 0x9a, 0x17, 0xf6, 0x49, 0x9a, 0x38, 0x7b, 0x55, 0xe5, 0xc8, 0xa7, 0xdf, - 0x6c, 0x1a, 0x4e, 0x4d, 0xeb, 0x29, 0x0e, 0x7c, 0x08, 0x96, 0x06, 0x41, 0x87, 0x05, 0x1e, 0x0d, - 0xba, 0x6e, 0x48, 0x38, 0x65, 0x9e, 0x59, 0xd5, 0x50, 0x6b, 0x17, 0xa0, 0xf6, 0x93, 0x14, 0x8b, - 0x91, 0x3e, 0x53, 0x48, 0x8b, 0x99, 0xf2, 0x91, 0xd6, 0x85, 0x1f, 0x03, 0x88, 0x71, 0xa4, 0x5d, - 0x62, 0x03, 0x99, 0x22, 0xd6, 0x26, 0x47, 0x5c, 0xc2, 0x38, 0x3a, 0x89, 0xb5, 0x13, 0xc8, 0x5f, - 0x81, 0x6b, 0x92, 0xa3, 0x40, 0x3c, 0x21, 0x7c, 0x1c, 0x17, 0x4c, 0x8e, 0xfb, 0x5a, 0x8a, 0x31, - 0x0a, 0x7e, 0x0f, 0x34, 0x71, 0x92, 0x40, 0x2e, 0x27, 0x1e, 0x15, 0x92, 0xd3, 0xce, 0x40, 0xe9, - 0xba, 0x4f, 0x38, 0xc2, 0x3a, 0x47, 0xea, 0x3a, 0x09, 0x1a, 0xa9, 0x9c, 0x33, 0x22, 0xf6, 0x41, - 0x22, 0x05, 0x1f, 0x81, 0x1f, 0x75, 0x7c, 0x86, 0xcf, 0x84, 0x72, 0xce, 0x1d, 0x41, 0xd2, 0xa6, - 0xfb, 0x54, 0x08, 0x85, 0x36, 0xd7, 0x34, 0xb6, 0xca, 0xce, 0xf5, 0x58, 0xf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x7e, 0xf2, 0x51, 0x2c, 0xf9, 0x77, 0x4b, - 0x78, 0x67, 0x2d, 0x39, 0x0c, 0x89, 0x48, 0x75, 0xc4, 0x5f, 0xff, 0xfb, 0xb7, 0xb7, 0x0c, 0x27, - 0x35, 0xb3, 0xf7, 0xf8, 0xcb, 0x67, 0x0d, 0xe3, 0xab, 0x67, 0x0d, 0xe3, 0x3f, 0xcf, 0x1a, 0xc6, - 0xa7, 0xcf, 0x1b, 0x53, 0x5f, 0x3d, 0x6f, 0x4c, 0xfd, 0xfb, 0x79, 0x63, 0xea, 0x97, 0xef, 0x5d, - 0x04, 0xcd, 0x63, 0x74, 0x2b, 0xfb, 0x66, 0x19, 0xbd, 0xdb, 0xfa, 0x64, 0xf4, 0x8b, 0xa8, 0xb6, - 0xd7, 0x99, 0xd1, 0xdd, 0xf4, 0x9d, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, 0x62, 0x6f, 0xc0, 0x43, - 0x42, 0x15, 0x00, 0x00, + // 2023 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcd, 0x6f, 0x1b, 0xc7, + 0x15, 0xd7, 0x92, 0x94, 0x44, 0x0e, 0xf5, 0x39, 0x52, 0xe2, 0x95, 0xaa, 0x52, 0xf4, 0xa6, 0x71, + 0xd5, 0xb8, 0x26, 0x23, 0x05, 0x01, 0x0c, 0xa1, 0x41, 0x20, 0x51, 0x4e, 0x2c, 0x2b, 0xb6, 0x99, + 0x95, 0x2a, 0xa3, 0xed, 0x61, 0x31, 0x9c, 0x1d, 0x93, 0x03, 0x2d, 0x77, 0xd6, 0x33, 0xc3, 0x95, + 0x79, 0xe9, 0xb9, 0x97, 0x02, 0xe9, 0x2d, 0xe8, 0xa1, 0x4d, 0x0b, 0x14, 0x28, 0x72, 0x28, 0x7a, + 0xe8, 0x5f, 0xd0, 0x53, 0xd0, 0x4b, 0x73, 0xec,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, 0x1a, 0x13, 0x7c, 0x88, 0x35, 0xae, 0x02, 0xb4, 0x13, + 0x34, 0x8b, 0x67, 0x5f, 0x11, 0x63, 0x8b, 0x81, 0x80, 0xa7, 0xe3, 0x4a, 0x7f, 0xf2, 0x4a, 0x4a, + 0xc7, 0xf0, 0x32, 0x9d, 0x37, 0x41, 0x75, 0x2f, 0xba, 0xf6, 0x27, 0x6a, 0x8a, 0x5d, 0x70, 0xcb, + 0x5c, 0xde, 0x2d, 0xf7, 0xc0, 0x42, 0xbc, 0x9a, 0x9d, 0x30, 0xdd, 0xdb, 0xe0, 0xf7, 0x01, 0x88, + 0x77, 0x3a, 0xd5, 0x13, 0xa3, 0xe9, 0x50, 0x89, 0x29, 0x87, 0xee, 0xc8, 0x00, 0x2f, 0x8c, 0x0c, + 0x70, 0xcb, 0x06, 0x8b, 0xa7, 0x02, 0xff, 0x34, 0xd9, 0xdb, 0x1f, 0x06, 0x02, 0xbe, 0x01, 0x66, + 0x54, 0x39, 0xc6, 0x40, 0x25, 0x7b, 0x3a, 0x14, 0xf8, 0x50, 0x0f, 0x88, 0xec, 0xdb, 0x80, 0x05, + 0x0e, 0x75, 0x85, 0x59, 0xa8, 0x17, 0xb7, 0x4a, 0xf6, 0xc2, 0x20, 0x13, 0x3f, 0x74, 0x85, 0xf5, + 0x33, 0x50, 0xcd, 0x01, 0xc2, 0x05, 0x50, 0x48, 0xb1, 0x0a, 0xd4, 0x85, 0xbb, 0x60, 0x2d, 0x03, + 0x1a, 0xed, 0xe8, 0x11, 0x62, 0xc5, 0xbe, 0x96, 0x32, 0x8c, 0x34, 0x75, 0x61, 0x3d, 0x04, 0xab, + 0x87, 0x59, 0xff, 0x48, 0xe7, 0xc5, 0xc8, 0x0d, 0x8d, 0xd1, 0x15, 0x65, 0x03, 0x54, 0xd2, 0xcf, + 0x65, 0x7d, 0xfb, 0x92, 0x9d, 0x11, 0xac, 0x3e, 0x58, 0x3a, 0x15, 0xf8, 0x98, 0xf8, 0x6e, 0x06, + 0x76, 0x85, 0x03, 0xf6, 0xc7, 0x81, 0x26, 0xfe, 0xc0, 0xca, 0xd4, 0x31, 0xb0, 0x76, 0x9a, 0xdf, + 0x67, 0xf4, 0xac, 0x6f, 0x23, 0x7c, 0x46, 0xa4, 0x80, 0x36, 0x28, 0xe9, 0xbd, 0x25, 0xca, 0xac, + 0xdb, 0x57, 0x66, 0x56, 0xb8, 0xdd, 0xb8, 0x0a, 0xe4, 0x00, 0x49, 0x14, 0xb7, 0x01, 0x8d, 0x65, + 0xfd, 0x10, 0xac, 0xdc, 0x47, 0x72, 0xc0, 0x89, 0x3b, 0x12, 0xe3, 0x25, 0x50, 0x54, 0xf1, 0x33, + 0x74, 0xfc, 0xd4, 0xa3, 0xf5, 0x47, 0x03, 0x98, 0x77, 0x9e, 0x06, 0x8c, 0x4b, 0xe2, 0x5e, 0xf0, + 0xc8, 0x0b, 0xdc, 0x7b, 0x06, 0x56, 0x94, 0xb3, 0x04, 0xf1, 0x5d, 0x27, 0xbd, 0x67, 0x14, 0xc7, + 0xea, 0xce, 0xfb, 0x13, 0x55, 0xc7, 0xb8, 0xba, 0xf8, 0x02, 0xcb, 0xe1, 0x18, 0x5d, 0x58, 0xbf, + 0x31, 0x80, 0x79, 0x44, 0x86, 0x7b, 0x42, 0xd0, 0xae, 0xdf, 0x27, 0xbe, 0x54, 0xed, 0x14, 0x61, + 0xa2, 0x1e, 0xe1, 0x5b, 0x60, 0x3e, 0xed, 0x52, 0x7a, 0x6a, 0x1b, 0x7a, 0x6a, 0xcf, 0x25, 0x44, + 0x55, 0x60, 0x70, 0x17, 0x80, 0x80, 0x93, 0xd0, 0xc1, 0xce, 0x19, 0x19, 0xc6, 0x51, 0xdc, 0xc8, + 0x4f, 0xe3, 0xe8, 0xc7, 0x8c, 0x46, 0x7b, 0xd0, 0xf1, 0x28, 0x3e, 0x22, 0x43, 0xbb, 0xac, 0xf8, + 0x5b, 0x47, 0x64, 0xa8, 0xd6, 0x2f, 0xbd, 0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 0x55, 0x89, + 0x7d, 0xf9, 0xed, 0xe6, 0xcd, 0x2e, 0x95, 0xbd, 0x41, 0xa7, 0x81, 0x59, 0x3f, 0xfe, 0x7d, 0x2d, + 0xfe, 0x77, 0x4b, 0xb8, 0x67, 0x4d, 0x39, 0x0c, 0x88, 0x48, 0x64, 0xc4, 0x9f, 0xff, 0xf3, 0xd7, + 0x77, 0x0c, 0x3b, 0x51, 0xb3, 0xff, 0xe8, 0xab, 0x67, 0x35, 0xe3, 0xeb, 0x67, 0x35, 0xe3, 0xdf, + 0xcf, 0x6a, 0xc6, 0x67, 0xcf, 0x6b, 0x53, 0x5f, 0x3f, 0xaf, 0x4d, 0xfd, 0xeb, 0x79, 0x6d, 0xea, + 0xe7, 0x1f, 0x5c, 0x04, 0xcd, 0x62, 0x74, 0x2b, 0xfd, 0xf9, 0x33, 0x7c, 0xbf, 0xf9, 0x74, 0xf4, + 0xc7, 0x55, 0xad, 0xaf, 0x33, 0xa3, 0xbb, 0xe9, 0x7b, 0xff, 0x0b, 0x00, 0x00, 0xff, 0xff, 0xb8, + 0x1b, 0xd4, 0xa4, 0x8d, 0x15, 0x00, 0x00, } func (m *ConsumerAdditionProposal) Marshal() (dAtA []byte, err error) { @@ -2281,6 +2293,11 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.MaxProviderConsensusValidators != 0 { + i = encodeVarintProvider(dAtA, i, uint64(m.MaxProviderConsensusValidators)) + i-- + dAtA[i] = 0x58 + } if m.BlocksPerEpoch != 0 { i = encodeVarintProvider(dAtA, i, uint64(m.BlocksPerEpoch)) i-- @@ -3334,6 +3351,9 @@ func (m *Params) Size() (n int) { if m.BlocksPerEpoch != 0 { n += 1 + sovProvider(uint64(m.BlocksPerEpoch)) } + if m.MaxProviderConsensusValidators != 0 { + n += 1 + sovProvider(uint64(m.MaxProviderConsensusValidators)) + } return n } @@ -5509,6 +5529,25 @@ func (m *Params) Unmarshal(dAtA []byte) error { break } } + case 11: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxProviderConsensusValidators", wireType) + } + m.MaxProviderConsensusValidators = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxProviderConsensusValidators |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipProvider(dAtA[iNdEx:]) From 884a3560fc285f497c0f5ec16b697a427e6f6729 Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Tue, 25 Jun 2024 14:01:33 +0200 Subject: [PATCH 05/32] Add validation for MaxProviderConsensusValidators --- x/ccv/provider/types/params.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/x/ccv/provider/types/params.go b/x/ccv/provider/types/params.go index 23b9927890..5ca0c4e44d 100644 --- a/x/ccv/provider/types/params.go +++ b/x/ccv/provider/types/params.go @@ -160,6 +160,9 @@ func (p Params) Validate() error { if err := ccvtypes.ValidateInt64(p.BlocksPerEpoch); err != nil { return fmt.Errorf("blocks per epoch is invalid: %s", err) } + if err := ccvtypes.ValidatePositiveInt64(p.MaxProviderConsensusValidators); err != nil { + return fmt.Errorf("max provider consensus validators is invalid: %s", err) + } return nil } From 356e6e8ad6e4d2d9670cee3856c033071251ac3c Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Tue, 25 Jun 2024 17:02:29 +0200 Subject: [PATCH 06/32] Add no_valupdates_staking module --- x/ccv/no_valupdates_staking/doc.go | 8 ++++ x/ccv/no_valupdates_staking/module.go | 68 +++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 x/ccv/no_valupdates_staking/doc.go create mode 100644 x/ccv/no_valupdates_staking/module.go diff --git a/x/ccv/no_valupdates_staking/doc.go b/x/ccv/no_valupdates_staking/doc.go new file mode 100644 index 0000000000..0cd53a9166 --- /dev/null +++ b/x/ccv/no_valupdates_staking/doc.go @@ -0,0 +1,8 @@ +/* +Package staking defines a "wrapper" module around the Cosmos SDK's native +x/staking module. In other words, it provides the exact same functionality as +the native module in that it simply embeds the native module. However, it +overrides `EndBlock` which will return no validator set updates. Instead, +it is assumed that some other module will provide the validator set updates. +*/ +package staking diff --git a/x/ccv/no_valupdates_staking/module.go b/x/ccv/no_valupdates_staking/module.go new file mode 100644 index 0000000000..78e148c5b4 --- /dev/null +++ b/x/ccv/no_valupdates_staking/module.go @@ -0,0 +1,68 @@ +package staking + +import ( + "encoding/json" + + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/cosmos/cosmos-sdk/x/staking" + "github.com/cosmos/cosmos-sdk/x/staking/exported" + "github.com/cosmos/cosmos-sdk/x/staking/keeper" + "github.com/cosmos/cosmos-sdk/x/staking/types" + + abci "github.com/cometbft/cometbft/abci/types" +) + +var ( + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} + _ module.AppModuleSimulation = AppModule{} +) + +// AppModule embeds the Cosmos SDK's x/staking AppModuleBasic. +type AppModuleBasic struct { + staking.AppModuleBasic +} + +// AppModule embeds the Cosmos SDK's x/staking AppModule where we only override +// specific methods. +type AppModule struct { + // embed the Cosmos SDK's x/staking AppModule + staking.AppModule + + keeper keeper.Keeper + accKeeper types.AccountKeeper + bankKeeper types.BankKeeper +} + +// NewAppModule creates a new AppModule object using the native x/staking module +// AppModule constructor. +func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, ak types.AccountKeeper, bk types.BankKeeper, subspace exported.Subspace) AppModule { + stakingAppMod := staking.NewAppModule(cdc, &keeper, ak, bk, subspace) + return AppModule{ + AppModule: stakingAppMod, + keeper: keeper, + accKeeper: ak, + bankKeeper: bk, + } +} + +// InitGenesis delegates the InitGenesis call to the underlying x/staking module, +// however, it returns no validator updates as validator updates will be provided by the provider module. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { + var genesisState types.GenesisState + + cdc.MustUnmarshalJSON(data, &genesisState) + _ = am.keeper.InitGenesis(ctx, &genesisState) + + return []abci.ValidatorUpdate{} +} + +// EndBlock delegates the EndBlock call to the underlying x/staking module, +// however, it returns no validator updates as validator updates will be provided by the provider module. +func (am AppModule) EndBlock(ctx sdk.Context) ([]abci.ValidatorUpdate, error) { + _, err := am.keeper.EndBlocker(ctx) + // return the error, but no validator updates + return []abci.ValidatorUpdate{}, err +} From b0d3ce0fcae466788ff7f69c05bf220c0464f5a4 Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Wed, 26 Jun 2024 09:49:39 +0200 Subject: [PATCH 07/32] Add function to get MaxProviderConsensusValidators param --- x/ccv/provider/keeper/params.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/x/ccv/provider/keeper/params.go b/x/ccv/provider/keeper/params.go index 9c1d276d4f..4b7cb8ee0d 100644 --- a/x/ccv/provider/keeper/params.go +++ b/x/ccv/provider/keeper/params.go @@ -78,6 +78,13 @@ func (k Keeper) GetBlocksPerEpoch(ctx sdk.Context) int64 { return params.BlocksPerEpoch } +// GetMaxProviderConsensusValidators returns the number of validators that will be passed on from the staking module +// to the consensus engine on the provider +func (k Keeper) GetMaxProviderConsensusValidators(ctx sdk.Context) int64 { + params := k.GetParams(ctx) + return params.MaxProviderConsensusValidators +} + // GetParams returns the paramset for the provider module func (k Keeper) GetParams(ctx sdk.Context) types.Params { store := ctx.KVStore(k.storeKey) From 5f53dc3d77eaf8d6d760414d2ec65fafffcf3c37 Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Wed, 26 Jun 2024 09:49:51 +0200 Subject: [PATCH 08/32] Start returning validators in EndBlock --- app/provider/app.go | 4 +- testutil/keeper/mocks.go | 14 ++++++ x/ccv/no_valupdates_staking/module.go | 12 +++-- x/ccv/provider/keeper/relay.go | 66 +++++++++++++++++++++++++++ x/ccv/provider/module.go | 4 +- x/ccv/types/expected_keepers.go | 1 + 6 files changed, 94 insertions(+), 7 deletions(-) diff --git a/app/provider/app.go b/app/provider/app.go index 4c998bdc13..5fd87cd893 100644 --- a/app/provider/app.go +++ b/app/provider/app.go @@ -116,6 +116,8 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/testdata/testpb" sigtypes "github.com/cosmos/cosmos-sdk/types/tx/signing" txmodule "github.com/cosmos/cosmos-sdk/x/auth/tx/config" + + no_valupdates_staking "github.com/cosmos/interchain-security/v5/x/ccv/no_valupdates_staking" ) const ( @@ -552,7 +554,7 @@ func New( mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)), slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName), app.interfaceRegistry), distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)), - staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)), + no_valupdates_staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)), upgrade.NewAppModule(&app.UpgradeKeeper, app.AccountKeeper.AddressCodec()), evidence.NewAppModule(app.EvidenceKeeper), diff --git a/testutil/keeper/mocks.go b/testutil/keeper/mocks.go index 8e2c552c95..c93ee16040 100644 --- a/testutil/keeper/mocks.go +++ b/testutil/keeper/mocks.go @@ -77,6 +77,20 @@ func (mr *MockStakingKeeperMockRecorder) Delegation(ctx, addr, valAddr interface return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delegation", reflect.TypeOf((*MockStakingKeeper)(nil).Delegation), ctx, addr, valAddr) } +// GetBondedValidatorsByPower mocks base method. +func (m *MockStakingKeeper) GetBondedValidatorsByPower(ctx types1.Context) []types3.Validator { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetBondedValidatorsByPower", ctx) + ret0, _ := ret[0].([]types3.Validator) + return ret0 +} + +// GetBondedValidatorsByPower indicates an expected call of GetBondedValidatorsByPower. +func (mr *MockStakingKeeperMockRecorder) GetBondedValidatorsByPower(ctx interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBondedValidatorsByPower", reflect.TypeOf((*MockStakingKeeper)(nil).GetBondedValidatorsByPower), ctx) +} + // GetLastTotalPower mocks base method. func (m *MockStakingKeeper) GetLastTotalPower(ctx context.Context) (math.Int, error) { m.ctrl.T.Helper() diff --git a/x/ccv/no_valupdates_staking/module.go b/x/ccv/no_valupdates_staking/module.go index 78e148c5b4..c17ef3141a 100644 --- a/x/ccv/no_valupdates_staking/module.go +++ b/x/ccv/no_valupdates_staking/module.go @@ -38,11 +38,17 @@ type AppModule struct { // NewAppModule creates a new AppModule object using the native x/staking module // AppModule constructor. -func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, ak types.AccountKeeper, bk types.BankKeeper, subspace exported.Subspace) AppModule { - stakingAppMod := staking.NewAppModule(cdc, &keeper, ak, bk, subspace) +func NewAppModule( + cdc codec.Codec, + keeper *keeper.Keeper, + ak types.AccountKeeper, + bk types.BankKeeper, + ls exported.Subspace, +) AppModule { + stakingAppMod := staking.NewAppModule(cdc, keeper, ak, bk, ls) return AppModule{ AppModule: stakingAppMod, - keeper: keeper, + keeper: *keeper, accKeeper: ak, bankKeeper: bk, } diff --git a/x/ccv/provider/keeper/relay.go b/x/ccv/provider/keeper/relay.go index 6373e6a7ce..c8c40fa0d1 100644 --- a/x/ccv/provider/keeper/relay.go +++ b/x/ccv/provider/keeper/relay.go @@ -5,6 +5,7 @@ import ( "fmt" "strconv" + abci "github.com/cometbft/cometbft/abci/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" @@ -13,6 +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" providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" ) @@ -162,6 +164,70 @@ func (k Keeper) EndBlockVSU(ctx sdk.Context) { } } +func (k Keeper) ProviderValidatorUpdates(ctx sdk.Context) []abci.ValidatorUpdate { + // get the bonded validators from the staking module + bondedValidators := k.stakingKeeper.GetBondedValidatorsByPower(ctx) + + // get the last validator set sent to consensus + currentValidators := k.GetLastProviderConsensusValSet(ctx) + + nextValidators := []types.ConsumerValidator{} + 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)) { + maxValidators = int64(len(bondedValidators)) + } + for _, val := range bondedValidators[:maxValidators] { + // create the validator from the staking validator + consAddr, err := val.GetConsAddr() + if err != nil { + k.Logger(ctx).Error("getting consensus address", + "validator", val.GetOperator(), + "error", err) + continue + } + + pubKey, err := val.TmConsPublicKey() + if err != nil { + k.Logger(ctx).Error("getting consensus public key", + "validator", val.GetOperator(), + "error", err) + continue + } + + valAddr, err := sdk.ValAddressFromBech32(val.GetOperator()) + if err != nil { + k.Logger(ctx).Error("creating validator address", + "validator", val.GetOperator(), + "error", err) + continue + } + + power, err := k.stakingKeeper.GetLastValidatorPower(ctx, valAddr) + if err != nil { + k.Logger(ctx).Error("getting last validator power", + "validator", val.GetOperator(), + "error", err) + continue + } + + nextValidator := types.ConsumerValidator{ + ProviderConsAddr: consAddr, + ConsumerPublicKey: &pubKey, + Power: power, + } + + nextValidators = append(nextValidators, nextValidator) + } + + // store the validator set we will send to consensus + k.SetLastProviderConsensusValSet(ctx, nextValidators) + + valUpdates := DiffValidators(currentValidators, nextValidators) + + return valUpdates +} + // SendVSCPackets iterates over all registered consumers and sends pending // VSC packets to the chains with established CCV channels. // If the CCV channel is not established for a consumer chain, diff --git a/x/ccv/provider/module.go b/x/ccv/provider/module.go index d670ee2828..a1da7e71e9 100644 --- a/x/ccv/provider/module.go +++ b/x/ccv/provider/module.go @@ -181,9 +181,7 @@ func (am AppModule) EndBlock(ctx context.Context) error { // EndBlock logic needed for the Consumer Chain Removal sub-protocol am.keeper.EndBlockCCR(sdkCtx) // EndBlock logic needed for the Validator Set Update sub-protocol - am.keeper.EndBlockVSU(sdkCtx) - - return nil + return am.keeper.EndBlockVSU(sdkCtx) } // AppModuleSimulation functions diff --git a/x/ccv/types/expected_keepers.go b/x/ccv/types/expected_keepers.go index a25cfe467e..9b8a93e330 100644 --- a/x/ccv/types/expected_keepers.go +++ b/x/ccv/types/expected_keepers.go @@ -56,6 +56,7 @@ type StakingKeeper interface { GetUnbondingDelegationByUnbondingID(ctx context.Context, id uint64) (stakingtypes.UnbondingDelegation, error) GetRedelegationByUnbondingID(ctx context.Context, id uint64) (stakingtypes.Redelegation, error) GetValidatorByUnbondingID(ctx context.Context, id uint64) (stakingtypes.Validator, error) + GetBondedValidatorsByPower(ctx sdk.Context) (validators []stakingtypes.Validator) } // SlashingKeeper defines the contract expected to perform ccv slashing From 463e370e12694c2f2a55297a40d762ae3179ad1c Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Wed, 26 Jun 2024 14:23:30 +0200 Subject: [PATCH 09/32] Fix tests --- app/consumer-democracy/abci.go | 4 +- app/consumer-democracy/app.go | 21 +- .../proposals_whitelisting.go | 2 +- 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 | 22 +- app/provider/export.go | 1 + app/sovereign/abci.go | 4 +- app/sovereign/app.go | 21 +- app/sovereign/export.go | 3 +- 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 +- .../ccv/provider/v1/genesis.proto | 3 + .../ccv/provider/v1/provider.proto | 13 +- tests/e2e/actions.go | 7 +- tests/e2e/config.go | 5 +- tests/e2e/json_marshal_test.go | 6 +- tests/e2e/state.go | 6 +- tests/e2e/state_rapid_test.go | 1 - tests/e2e/steps_active_set_changes.go | 3 +- tests/e2e/steps_compatibility.go | 5 +- tests/e2e/steps_consumer_misbehaviour.go | 3 +- tests/e2e/steps_partial_set_security.go | 18 +- tests/e2e/steps_sovereign_changeover.go | 3 +- tests/e2e/steps_start_chains.go | 3 +- tests/e2e/test_driver.go | 3 +- tests/e2e/testlib/utils.go | 2 +- tests/e2e/trace_handlers_test.go | 3 +- tests/e2e/v4/state.go | 18 +- tests/integration/democracy.go | 2 - tests/integration/distribution.go | 9 +- tests/integration/double_vote.go | 1 + tests/integration/expired_client.go | 3 +- tests/integration/key_assignment.go | 3 +- tests/integration/misbehaviour.go | 3 +- tests/integration/normal_operations.go | 2 +- tests/integration/provider_gov_hooks.go | 1 + tests/integration/setup.go | 1 + tests/integration/slashing.go | 5 +- tests/integration/soft_opt_out.go | 8 +- tests/integration/stop_consumer.go | 3 +- tests/integration/throttle.go | 3 +- tests/integration/unbonding.go | 2 + tests/integration/valset_update.go | 3 +- tests/mbt/driver/common.go | 1 + tests/mbt/driver/core.go | 7 +- tests/mbt/driver/mbt_test.go | 5 +- tests/mbt/driver/setup.go | 2 +- testutil/crypto/crypto.go | 2 +- testutil/ibc_testing/generic_setup.go | 2 +- testutil/ibc_testing/specific_setup.go | 3 +- testutil/integration/interfaces.go | 8 +- testutil/keeper/expectations.go | 2 +- testutil/keeper/mocks.go | 5 +- testutil/keeper/unit_test_helpers.go | 9 +- x/ccv/consumer/ibc_module.go | 2 +- x/ccv/consumer/ibc_module_test.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/soft_opt_out.go | 1 + 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 | 4 +- x/ccv/democracy/distribution/module.go | 1 + x/ccv/democracy/governance/module.go | 2 +- 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 | 6 +- x/ccv/provider/keeper/distribution.go | 7 +- x/ccv/provider/keeper/distribution_test.go | 5 +- x/ccv/provider/keeper/genesis.go | 49 ++- x/ccv/provider/keeper/genesis_test.go | 36 +- x/ccv/provider/keeper/grpc_query.go | 2 +- x/ccv/provider/keeper/grpc_query_test.go | 21 +- x/ccv/provider/keeper/hooks.go | 1 + x/ccv/provider/keeper/hooks_test.go | 4 +- x/ccv/provider/keeper/keeper.go | 14 +- x/ccv/provider/keeper/keeper_test.go | 3 +- x/ccv/provider/keeper/legacy_proposal.go | 1 + x/ccv/provider/keeper/msg_server.go | 3 +- x/ccv/provider/keeper/params_test.go | 3 +- x/ccv/provider/keeper/partial_set_security.go | 12 +- .../keeper/partial_set_security_test.go | 111 +++--- x/ccv/provider/keeper/proposal.go | 5 +- x/ccv/provider/keeper/proposal_test.go | 6 +- x/ccv/provider/keeper/provider_consensus.go | 36 +- .../keeper/provider_consensus_test.go | 55 +-- x/ccv/provider/keeper/relay.go | 63 ++-- x/ccv/provider/keeper/relay_test.go | 24 +- x/ccv/provider/keeper/throttle_legacy.go | 1 + .../provider/keeper/validator_set_storage.go | 9 +- x/ccv/provider/keeper/validator_set_update.go | 52 +-- .../keeper/validator_set_update_test.go | 126 +++---- x/ccv/provider/migrations/migrator.go | 1 + x/ccv/provider/migrations/v6/legacy_params.go | 5 +- x/ccv/provider/migrations/v6/migrations.go | 1 + x/ccv/provider/module.go | 15 +- x/ccv/provider/module_test.go | 19 +- x/ccv/provider/proposal_handler_test.go | 5 +- x/ccv/provider/types/codec.go | 5 +- x/ccv/provider/types/genesis.go | 28 +- x/ccv/provider/types/genesis.pb.go | 187 ++++++---- x/ccv/provider/types/genesis_test.go | 31 +- x/ccv/provider/types/legacy_proposal.go | 4 +- x/ccv/provider/types/msg.go | 1 - x/ccv/provider/types/params.go | 4 +- x/ccv/provider/types/params_test.go | 3 +- x/ccv/provider/types/provider.pb.go | 329 +++++++++--------- x/ccv/types/expected_keepers.go | 6 +- x/ccv/types/params.go | 1 + x/ccv/types/shared_params.go | 3 +- x/ccv/types/utils.go | 6 +- 124 files changed, 989 insertions(+), 704 deletions(-) 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 b7506eb0c7..580c47aa8f 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/v5/app/encoding" testutil "github.com/cosmos/interchain-security/v5/testutil/integration" diff --git a/app/consumer-democracy/proposals_whitelisting.go b/app/consumer-democracy/proposals_whitelisting.go index fb333dc014..56f514c0b8 100644 --- a/app/consumer-democracy/proposals_whitelisting.go +++ b/app/consumer-democracy/proposals_whitelisting.go @@ -32,7 +32,7 @@ type legacyParamChangeKey struct { // these parameters don't exist in the consumer app -- keeping them as an var LegacyWhitelistedParams = map[legacyParamChangeKey]struct{}{ // add whitlisted legacy parameters here [cosmos-sdk <= 0.47] - // commented parameters are just an example - most params have been moved to their respecitve modules + // commented parameters are just an example - most params have been moved to their respective modules // and they cannot be changed through legacy governance proposals {Subspace: banktypes.ModuleName, Key: "SendEnabled"}: {}, } 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 187d8bc956..8bb60791e8 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 3bf468b22f..300d2ff35b 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/v5/app/encoding" testutil "github.com/cosmos/interchain-security/v5/testutil/integration" diff --git a/app/consumer/genesis.go b/app/consumer/genesis.go index 466c9df753..da55a0334e 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/v5/x/ccv/consumer/types" "github.com/cosmos/interchain-security/v5/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 5fd87cd893..7cd5375b2d 100644 --- a/app/provider/app.go +++ b/app/provider/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" @@ -35,6 +39,7 @@ 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" @@ -50,9 +55,11 @@ 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/types/msgservice" + sigtypes "github.com/cosmos/cosmos-sdk/types/tx/signing" "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/auth/ante" @@ -60,6 +67,7 @@ import ( authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" "github.com/cosmos/cosmos-sdk/x/auth/posthandler" authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" + txmodule "github.com/cosmos/cosmos-sdk/x/auth/tx/config" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/auth/vesting" vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" @@ -96,28 +104,18 @@ import ( "github.com/cosmos/cosmos-sdk/x/staking" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/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/v5/app/encoding" testutil "github.com/cosmos/interchain-security/v5/testutil/integration" + no_valupdates_staking "github.com/cosmos/interchain-security/v5/x/ccv/no_valupdates_staking" ibcprovider "github.com/cosmos/interchain-security/v5/x/ccv/provider" ibcproviderclient "github.com/cosmos/interchain-security/v5/x/ccv/provider/client" ibcproviderkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" - - "github.com/cosmos/cosmos-sdk/testutil/testdata/testpb" - sigtypes "github.com/cosmos/cosmos-sdk/types/tx/signing" - txmodule "github.com/cosmos/cosmos-sdk/x/auth/tx/config" - - no_valupdates_staking "github.com/cosmos/interchain-security/v5/x/ccv/no_valupdates_staking" ) const ( 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/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 67386cc70a..8957b6f73a 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/v5/app/encoding" testutil "github.com/cosmos/interchain-security/v5/testutil/integration" diff --git a/app/sovereign/export.go b/app/sovereign/export.go index 53e9f6fee1..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" @@ -81,7 +81,6 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str // withdraw all validator commission app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { valBz, err := app.StakingKeeper.ValidatorAddressCodec().StringToBytes(val.GetOperator()) - if err != nil { panic(err) } diff --git a/cmd/interchain-security-cd/cmd/root.go b/cmd/interchain-security-cd/cmd/root.go index 0a980f3452..cd551056ff 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" @@ -29,9 +32,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/v5/app/consumer" appencoding "github.com/cosmos/interchain-security/v5/app/encoding" diff --git a/cmd/interchain-security-cdd/cmd/root.go b/cmd/interchain-security-cdd/cmd/root.go index b71e1422c1..a21c696244 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" @@ -33,9 +36,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/v5/app/consumer-democracy" appencoding "github.com/cosmos/interchain-security/v5/app/encoding" diff --git a/cmd/interchain-security-pd/cmd/root.go b/cmd/interchain-security-pd/cmd/root.go index da0d719981..0ee7bdc06f 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" @@ -33,9 +36,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/v5/app/encoding" providerApp "github.com/cosmos/interchain-security/v5/app/provider" diff --git a/cmd/interchain-security-sd/cmd/root.go b/cmd/interchain-security-sd/cmd/root.go index 5e65e536fb..68a9c5a421 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" @@ -33,9 +36,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/v5/app/encoding" sovereignApp "github.com/cosmos/interchain-security/v5/app/sovereign" diff --git a/proto/interchain_security/ccv/provider/v1/genesis.proto b/proto/interchain_security/ccv/provider/v1/genesis.proto index 269743721e..80e9ee0cf8 100644 --- a/proto/interchain_security/ccv/provider/v1/genesis.proto +++ b/proto/interchain_security/ccv/provider/v1/genesis.proto @@ -48,6 +48,9 @@ message GenesisState { repeated interchain_security.ccv.provider.v1.ExportedVscSendTimestamp exported_vsc_send_timestamps = 13 [ (gogoproto.nullable) = false ]; + + repeated ConsensusValidator last_provider_consensus_validators = 14 + [ (gogoproto.nullable) = false ]; } // The provider CCV module's knowledge of consumer state. diff --git a/proto/interchain_security/ccv/provider/v1/provider.proto b/proto/interchain_security/ccv/provider/v1/provider.proto index bcb61418cf..cddd2019c9 100644 --- a/proto/interchain_security/ccv/provider/v1/provider.proto +++ b/proto/interchain_security/ccv/provider/v1/provider.proto @@ -363,15 +363,18 @@ message ConsumerAddrsToPrune { AddressList consumer_addrs = 3; } -// ConsumerValidator is used to facilitate epoch-based transitions. It contains relevant info for -// a validator that is expected to validate on a consumer chain during an epoch. -message ConsumerValidator { +// ConsensusValidator is used to express a validator that +// should be validating on a chain. +// It contains relevant info for +// a validator that is expected to validate on +// either the provider or a consumer chain. +message ConsensusValidator { // validator's consensus address on the provider chain bytes provider_cons_addr = 1; // voting power the validator has during this epoch int64 power = 2; - // public key the validator uses on the consumer chain during this epoch - tendermint.crypto.PublicKey consumer_public_key = 3; + // public key the validator uses on the chain it is validating on + tendermint.crypto.PublicKey public_key = 3; } // ConsumerRewardsAllocation stores the rewards allocated by a consumer chain // to the consumer rewards pool. It is used to allocate the tokens to the consumer diff --git a/tests/e2e/actions.go b/tests/e2e/actions.go index f50f23b41a..e00653967a 100644 --- a/tests/e2e/actions.go +++ b/tests/e2e/actions.go @@ -334,7 +334,6 @@ func (tr Chain) submitConsumerAdditionProposal( fmt.Println("submitConsumerAdditionProposal json:", jsonStr) } bz, err = cmd.CombinedOutput() - if err != nil { log.Fatal(err, "\n", string(bz)) } @@ -468,7 +467,6 @@ func (tr Chain) submitConsumerModificationProposal( } bz, err = cmd.CombinedOutput() - if err != nil { log.Fatal(err, "\n", string(bz)) } @@ -1005,7 +1003,6 @@ func (tr Chain) addChainToHermes( action AddChainToRelayerAction, verbose bool, ) { - bz, err := tr.target.ExecCommand("bash", "-c", "hermes", "version").CombinedOutput() if err != nil { log.Fatal(err, "\n error getting hermes version", string(bz)) @@ -1771,7 +1768,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" @@ -1911,7 +1908,7 @@ func (tr Chain) registerRepresentative( panic(fmt.Sprintf("failed writing ccv consumer file : %v", err)) } defer file.Close() - err = os.WriteFile(file.Name(), []byte(fileContent), 0600) + err = os.WriteFile(file.Name(), []byte(fileContent), 0o600) if err != nil { log.Fatalf("Failed writing consumer genesis to file: %v", err) } diff --git a/tests/e2e/config.go b/tests/e2e/config.go index bbfe7a4d0b..d33e39b0c4 100644 --- a/tests/e2e/config.go +++ b/tests/e2e/config.go @@ -7,8 +7,9 @@ import ( "strconv" "time" - e2e "github.com/cosmos/interchain-security/v5/tests/e2e/testlib" "golang.org/x/mod/semver" + + e2e "github.com/cosmos/interchain-security/v5/tests/e2e/testlib" ) var ( @@ -417,7 +418,7 @@ func CompatibilityTestConfig(providerVersion, consumerVersion string) TestConfig ".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\" | " + // This disables slash packet throttling ".app_state.provider.params.slash_meter_replenish_period = \"3s\"", } - } else if semver.Compare(providerVersion, "v5.0.0-alpha1") < 0 { //TODO: MOV THIS BACK TO "v5.0.0" + } else if semver.Compare(providerVersion, "v5.0.0-alpha1") < 0 { // TODO: MOV THIS BACK TO "v5.0.0" fmt.Println("Using provider chain config for v4.1.x") providerConfig = ChainConfig{ ChainId: ChainID("provi"), diff --git a/tests/e2e/json_marshal_test.go b/tests/e2e/json_marshal_test.go index 1265063e69..eaa0bfb2c9 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/v5/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/v5/tests/e2e/testlib" ) func TestProposalUnmarshal(t *testing.T) { diff --git a/tests/e2e/state.go b/tests/e2e/state.go index 1c1be7e95a..8c15d936d8 100644 --- a/tests/e2e/state.go +++ b/tests/e2e/state.go @@ -11,10 +11,11 @@ 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/kylelemons/godebug/pretty" "github.com/tidwall/gjson" "gopkg.in/yaml.v2" + + e2e "github.com/cosmos/interchain-security/v5/tests/e2e/testlib" ) // type aliases @@ -365,7 +366,6 @@ func (tr Commands) GetReward(chain ChainID, validator ValidatorID, blockHeight u ) bz, err := cmd.CombinedOutput() - if err != nil { log.Fatal("failed getting rewards: ", err, "\n", string(bz)) } @@ -380,7 +380,7 @@ func (tr Commands) GetReward(chain ChainID, validator ValidatorID, blockHeight u // interchain-securityd query gov proposals func (tr Commands) GetProposal(chain ChainID, proposal uint) Proposal { - var noProposalRegex = regexp.MustCompile(`doesn't exist: key not found`) + noProposalRegex := regexp.MustCompile(`doesn't exist: key not found`) binaryName := tr.chainConfigs[chain].BinaryName bz, err := tr.target.ExecCommand(binaryName, diff --git a/tests/e2e/state_rapid_test.go b/tests/e2e/state_rapid_test.go index 1ca36d5578..3ed52a5c16 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_active_set_changes.go b/tests/e2e/steps_active_set_changes.go index 1fc06a73b6..d8cf367404 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 a51a34fed3..4997d21c27 100644 --- a/tests/e2e/steps_compatibility.go +++ b/tests/e2e/steps_compatibility.go @@ -6,8 +6,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 compstepStartProviderChain() []Step { @@ -127,7 +128,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 56e093e668..56c582c6e0 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 a consumer chain with two validators, diff --git a/tests/e2e/steps_partial_set_security.go b/tests/e2e/steps_partial_set_security.go index 9a0daa5acf..9c4c379da1 100644 --- a/tests/e2e/steps_partial_set_security.go +++ b/tests/e2e/steps_partial_set_security.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" ) // stepsOptInChain starts a provider chain and an Opt-In chain and opts in and out validators @@ -1511,8 +1512,10 @@ func stepsValidatorsAllowlistedChain() []Step { 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"}, + Allowlist: []string{ + "cosmosvalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7xw4mceq", + "cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39", + }, }, State: State{ ChainID("provi"): ChainState{ @@ -2249,8 +2252,10 @@ func stepsModifyChain() []Step { Deposit: 10000001, ConsumerChain: ChainID("consu"), // only "alice" and "carol" are allowlisted (see `getDefaultValidators` in `tests/e2e/config.go`) - Allowlist: []string{"cosmosvalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7xw4mceq", - "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6"}, + Allowlist: []string{ + "cosmosvalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7xw4mceq", + "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6", + }, }, State: State{ ChainID("provi"): ChainState{ @@ -2437,7 +2442,8 @@ func stepsModifyChain() []Step { ExpectError: true, // because this chain is now Top 100%, no validator can opt out }, State: State{}, - }} + }, + } return s } diff --git a/tests/e2e/steps_sovereign_changeover.go b/tests/e2e/steps_sovereign_changeover.go index 68ed5c8505..be2effabcd 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 e358862590..f76a695941 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/test_driver.go b/tests/e2e/test_driver.go index 9c59411ac7..c4b2874d65 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/v5/tests/e2e/v4" "github.com/kylelemons/godebug/pretty" "golang.org/x/mod/semver" + + v4 "github.com/cosmos/interchain-security/v5/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 8b68c25947..4e59a93436 100644 --- a/tests/e2e/testlib/utils.go +++ b/tests/e2e/testlib/utils.go @@ -7,7 +7,7 @@ import ( "os/exec" ) -var verbose *bool //TODO: remove hack +var verbose *bool // TODO: remove hack func ExecuteCommandWithVerbosity(cmd *exec.Cmd, cmdName string, verbose bool) { if verbose { diff --git a/tests/e2e/trace_handlers_test.go b/tests/e2e/trace_handlers_test.go index 8fcbb60c67..5fb3da3da7 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 diff --git a/tests/e2e/v4/state.go b/tests/e2e/v4/state.go index 70ca8afe7c..d4e98cf86a 100644 --- a/tests/e2e/v4/state.go +++ b/tests/e2e/v4/state.go @@ -9,13 +9,14 @@ 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" - e2e "github.com/cosmos/interchain-security/v5/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/v5/tests/e2e/testlib" ) type ( @@ -236,7 +237,7 @@ func (tr Commands) GetBalance(chain ChainID, validator ValidatorID) uint { // interchain-securityd query gov proposals func (tr Commands) GetProposal(chain ChainID, proposal uint) Proposal { - var noProposalRegex = regexp.MustCompile(`doesn't exist: key not found`) + noProposalRegex := regexp.MustCompile(`doesn't exist: key not found`) binaryName := tr.ChainConfigs[chain].BinaryName bz, err := tr.Target.ExecCommand(binaryName, @@ -411,6 +412,7 @@ func (tr Commands) GetConsumerChains(chain ChainID) map[ChainID]bool { return chains } + func (tr Commands) GetConsumerAddress(consumerChain ChainID, validator ValidatorID) string { binaryName := tr.ChainConfigs[ChainID("provi")].BinaryName cmd := tr.Target.ExecCommand(binaryName, @@ -545,7 +547,7 @@ func (tr Commands) curlJsonRPCRequest(method, params, address string) { // 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, @@ -579,7 +581,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, @@ -623,7 +625,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", diff --git a/tests/integration/democracy.go b/tests/integration/democracy.go index 5fe7e9eb6d..bf3dfc0157 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/v5/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 acff226828..9b19cbe547 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/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" diff --git a/tests/integration/double_vote.go b/tests/integration/double_vote.go index f8a0f7f25d..9e793292b0 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" diff --git a/tests/integration/expired_client.go b/tests/integration/expired_client.go index 5a55c75079..6e735d0fd0 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 8d8826daf9..9aa0843279 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 912f8c71d7..77fa3171f9 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/normal_operations.go b/tests/integration/normal_operations.go index fc71fec247..155ac4f44d 100644 --- a/tests/integration/normal_operations.go +++ b/tests/integration/normal_operations.go @@ -37,7 +37,7 @@ func (k CCVTestSuite) TestHistoricalInfo() { //nolint:govet // this is a test so // increased by HistoricalEntries in order to prune the historical info less or equal to the current block height // Note that historical info containing the created validators were stored during the BeginBlocker of the current block // at the moment of creation and thus are indexed with the respective block heights InitHeight and InitHeight+1 - // Last saved historical info was in the last commited block k.consumerChain.GetContext().BlockHeight(), meaning that + // Last saved historical info was in the last committed block k.consumerChain.GetContext().BlockHeight(), meaning that // if we want to prune old entries we need to start from the last saved historical info which is k.consumerChain.GetContext().BlockHeight() - 1 testSetup := []func(CCVTestSuite){ createVal, diff --git a/tests/integration/provider_gov_hooks.go b/tests/integration/provider_gov_hooks.go index 6c99f17c64..d63867f1e3 100644 --- a/tests/integration/provider_gov_hooks.go +++ b/tests/integration/provider_gov_hooks.go @@ -4,6 +4,7 @@ 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" diff --git a/tests/integration/setup.go b/tests/integration/setup.go index eeb980200f..1b784056ed 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 9f29c2806c..c7ebb972c1 100644 --- a/tests/integration/slashing.go +++ b/tests/integration/slashing.go @@ -12,6 +12,7 @@ import ( "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" @@ -129,7 +130,7 @@ func (s *CCVTestSuite) TestRelayAndApplyDowntimePacket() { relayAllCommittedPackets(s, s.providerChain, bundle.Path, ccv.ProviderPortID, bundle.Path.EndpointB.ChannelID, 1) - // check that each consumer updated its VSC ID for the subsequent not commited block ctx.BlockHeight() + // check that each consumer updated its VSC ID for the subsequent not committed block ctx.BlockHeight() consumerKeeper := bundle.GetKeeper() ctx := bundle.GetCtx() actualValsetUpdateID := consumerKeeper.GetHeightValsetUpdateID( @@ -419,7 +420,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.ConsumerValidator{ + providerKeeper.SetConsumerValidator(ctx, firstBundle.Chain.ChainID, providertypes.ConsensusValidator{ ProviderConsAddr: validAddress, }) diff --git a/tests/integration/soft_opt_out.go b/tests/integration/soft_opt_out.go index 4af1f79c94..9ed4a1dc7c 100644 --- a/tests/integration/soft_opt_out.go +++ b/tests/integration/soft_opt_out.go @@ -6,14 +6,16 @@ import ( "cosmossdk.io/core/comet" "cosmossdk.io/math" - abci "github.com/cometbft/cometbft/abci/types" + sdk "github.com/cosmos/cosmos-sdk/types" slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - consumerKeeper "github.com/cosmos/interchain-security/v5/x/ccv/consumer/keeper" - ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" + abci "github.com/cometbft/cometbft/abci/types" cmttypes "github.com/cometbft/cometbft/proto/tendermint/types" + + consumerKeeper "github.com/cosmos/interchain-security/v5/x/ccv/consumer/keeper" + ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" ) // TestSoftOptOut tests the soft opt-out feature diff --git a/tests/integration/stop_consumer.go b/tests/integration/stop_consumer.go index f7b2d6ef96..40664c634b 100644 --- a/tests/integration/stop_consumer.go +++ b/tests/integration/stop_consumer.go @@ -1,9 +1,10 @@ package integration import ( - "cosmossdk.io/math" channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/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.go b/tests/integration/throttle.go index f56228c56f..7dd20dde5f 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/unbonding.go b/tests/integration/unbonding.go index 6f027c3616..4e18f4a1d9 100644 --- a/tests/integration/unbonding.go +++ b/tests/integration/unbonding.go @@ -4,8 +4,10 @@ import ( "time" "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" ) diff --git a/tests/integration/valset_update.go b/tests/integration/valset_update.go index 994dfab4af..bdfe088ca9 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 2cd618096f..7e47b45bb5 100644 --- a/tests/mbt/driver/core.go +++ b/tests/mbt/driver/core.go @@ -8,24 +8,23 @@ import ( "testing" "time" - "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" + "cosmossdk.io/math" 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/v5/app/consumer" appProvider "github.com/cosmos/interchain-security/v5/app/provider" simibc "github.com/cosmos/interchain-security/v5/testutil/simibc" diff --git a/tests/mbt/driver/mbt_test.go b/tests/mbt/driver/mbt_test.go index 70fded614a..a487f14bbe 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/v5/testutil/integration" + "github.com/cosmos/interchain-security/v5/testutil/integration" providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" "github.com/cosmos/interchain-security/v5/x/ccv/types" ) diff --git a/tests/mbt/driver/setup.go b/tests/mbt/driver/setup.go index 81d39d5e70..759b381b5f 100644 --- a/tests/mbt/driver/setup.go +++ b/tests/mbt/driver/setup.go @@ -12,7 +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" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" "github.com/stretchr/testify/require" "cosmossdk.io/math" @@ -35,6 +34,7 @@ import ( "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" + providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" ) diff --git a/testutil/crypto/crypto.go b/testutil/crypto/crypto.go index 88fc8c6c01..3533604f96 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 3aaae5702f..676cb0beab 100644 --- a/testutil/ibc_testing/generic_setup.go +++ b/testutil/ibc_testing/generic_setup.go @@ -7,7 +7,6 @@ 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" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" @@ -18,6 +17,7 @@ import ( tmtypes "github.com/cometbft/cometbft/types" testutil "github.com/cosmos/interchain-security/v5/testutil/integration" + testkeeper "github.com/cosmos/interchain-security/v5/testutil/keeper" consumerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/consumer/keeper" providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" ) diff --git a/testutil/ibc_testing/specific_setup.go b/testutil/ibc_testing/specific_setup.go index 2ff06ca757..b0d4300bba 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/v5/app/consumer" diff --git a/testutil/integration/interfaces.go b/testutil/integration/interfaces.go index de9c3a6b0d..bd86140b40 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/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" diff --git a/testutil/keeper/expectations.go b/testutil/keeper/expectations.go index 49ffe51ace..e2c695b0a3 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/v5/x/ccv/provider/types" "github.com/cosmos/interchain-security/v5/x/ccv/types" diff --git a/testutil/keeper/mocks.go b/testutil/keeper/mocks.go index c93ee16040..7424e8bc63 100644 --- a/testutil/keeper/mocks.go +++ b/testutil/keeper/mocks.go @@ -78,11 +78,12 @@ func (mr *MockStakingKeeperMockRecorder) Delegation(ctx, addr, valAddr interface } // GetBondedValidatorsByPower mocks base method. -func (m *MockStakingKeeper) GetBondedValidatorsByPower(ctx types1.Context) []types3.Validator { +func (m *MockStakingKeeper) GetBondedValidatorsByPower(ctx context.Context) ([]types3.Validator, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetBondedValidatorsByPower", ctx) ret0, _ := ret[0].([]types3.Validator) - return ret0 + ret1, _ := ret[1].(error) + return ret0, ret1 } // GetBondedValidatorsByPower indicates an expected call of GetBondedValidatorsByPower. diff --git a/testutil/keeper/unit_test_helpers.go b/testutil/keeper/unit_test_helpers.go index a80138551a..120236c9db 100644 --- a/testutil/keeper/unit_test_helpers.go +++ b/testutil/keeper/unit_test_helpers.go @@ -6,13 +6,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" @@ -21,23 +24,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/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" - "github.com/cosmos/interchain-security/v5/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 d9cbcd6bde..f4f00016d5 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/v5/x/ccv/consumer/keeper" consumertypes "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" diff --git a/x/ccv/consumer/ibc_module_test.go b/x/ccv/consumer/ibc_module_test.go index 029a4accd5..9196377754 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/v5/testutil/keeper" "github.com/cosmos/interchain-security/v5/x/ccv/consumer" diff --git a/x/ccv/consumer/keeper/distribution_test.go b/x/ccv/consumer/keeper/distribution_test.go index 5713361918..cbb11f1a60 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 644cfc33a7..943a60c183 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/v5/x/ccv/consumer/types" diff --git a/x/ccv/consumer/keeper/relay_test.go b/x/ccv/consumer/keeper/relay_test.go index d3ab3778e1..e50e12008a 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/soft_opt_out.go b/x/ccv/consumer/keeper/soft_opt_out.go index 39b5bc22bc..54d7efcefd 100644 --- a/x/ccv/consumer/keeper/soft_opt_out.go +++ b/x/ccv/consumer/keeper/soft_opt_out.go @@ -7,6 +7,7 @@ import ( "sort" "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" diff --git a/x/ccv/consumer/migrations/v2/migration.go b/x/ccv/consumer/migrations/v2/migration.go index a0b401188d..6d56c03a48 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/v5/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 0b3f24ec75..02827af15e 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/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" diff --git a/x/ccv/consumer/migrations/v3/migration.go b/x/ccv/consumer/migrations/v3/migration.go index aadc94bc43..e8c404417c 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/v5/x/ccv/consumer/types" ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" ) diff --git a/x/ccv/consumer/migrations/v3/migration_test.go b/x/ccv/consumer/migrations/v3/migration_test.go index bdc3f59f70..ba84aaa4d3 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/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/stretchr/testify/require" ) type testLegacyParamSubspace struct { diff --git a/x/ccv/consumer/module.go b/x/ccv/consumer/module.go index 49e19542be..b61a3a50ee 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 243fc63f46..0f6d783218 100644 --- a/x/ccv/consumer/types/codec.go +++ b/x/ccv/consumer/types/codec.go @@ -1,15 +1,13 @@ 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" ) // RegisterInterfaces registers the consumer Tx message types to the interface registry func RegisterInterfaces(registry codectypes.InterfaceRegistry) { - registry.RegisterImplementations( (*sdk.Msg)(nil), &MsgUpdateParams{}, diff --git a/x/ccv/democracy/distribution/module.go b/x/ccv/democracy/distribution/module.go index 9e0bdacbb6..803e0e1e79 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 c4bf930066..e16ebc7bfb 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" @@ -74,7 +75,6 @@ func (am AppModule) EndBlock(c context.Context) error { deleteForbiddenProposal(ctx, am, proposal) return false, nil }) - if err != nil { return err } diff --git a/x/ccv/provider/client/cli/tx.go b/x/ccv/provider/client/cli/tx.go index eadb3a7e57..e3b6d4c7ff 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 f4128260e1..eb5775aa7b 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/v5/x/ccv/provider/keeper" "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" diff --git a/x/ccv/provider/ibc_module.go b/x/ccv/provider/ibc_module.go index f91f69e618..ca78344a47 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/v5/x/ccv/provider/keeper" providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" diff --git a/x/ccv/provider/ibc_module_test.go b/x/ccv/provider/ibc_module_test.go index fdae2a03ba..0df627ee80 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/v5/testutil/keeper" "github.com/cosmos/interchain-security/v5/x/ccv/provider" diff --git a/x/ccv/provider/keeper/consumer_equivocation.go b/x/ccv/provider/keeper/consumer_equivocation.go index 12f964ebd4..a8cee86e7a 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" @@ -359,7 +359,7 @@ func (k Keeper) JailAndTombstoneValidator(ctx sdk.Context, providerAddr types.Pr if err != nil && errors.Is(err, stakingtypes.ErrNoValidatorFound) { return errorsmod.Wrapf(slashingtypes.ErrNoValidatorForAddress, "provider consensus address: %s", providerAddr.String()) } else if err != nil { - return errorsmod.Wrapf(slashingtypes.ErrBadValidatorAddr, "unkown error looking for provider consensus address: %s", providerAddr.String()) + return errorsmod.Wrapf(slashingtypes.ErrBadValidatorAddr, "unknown error looking for provider consensus address: %s", providerAddr.String()) } if validator.IsUnbonded() { @@ -429,7 +429,7 @@ func (k Keeper) SlashValidator(ctx sdk.Context, providerAddr types.ProviderConsA if err != nil && errors.Is(err, stakingtypes.ErrNoValidatorFound) { return errorsmod.Wrapf(slashingtypes.ErrNoValidatorForAddress, "provider consensus address: %s", providerAddr.String()) } else if err != nil { - return errorsmod.Wrapf(slashingtypes.ErrBadValidatorAddr, "unkown error looking for provider consensus address: %s", providerAddr.String()) + return errorsmod.Wrapf(slashingtypes.ErrBadValidatorAddr, "unknown error looking for provider consensus address: %s", providerAddr.String()) } if validator.IsUnbonded() { diff --git a/x/ccv/provider/keeper/distribution.go b/x/ccv/provider/keeper/distribution.go index 9ac016abbc..5b39edc244 100644 --- a/x/ccv/provider/keeper/distribution.go +++ b/x/ccv/provider/keeper/distribution.go @@ -1,13 +1,14 @@ package keeper import ( - storetypes "cosmossdk.io/store/types" - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" - "context" + 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 0b22260a2b..14e36eee02 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" @@ -46,7 +47,7 @@ func TestComputeConsumerTotalVotingPower(t *testing.T) { keeper.SetConsumerValidator( ctx, chainID, - types.ConsumerValidator{ + types.ConsensusValidator{ ProviderConsAddr: val.Address, Power: val.VotingPower, }, diff --git a/x/ccv/provider/keeper/genesis.go b/x/ccv/provider/keeper/genesis.go index b8d6d179fc..f96ec7eb2f 100644 --- a/x/ccv/provider/keeper/genesis.go +++ b/x/ccv/provider/keeper/genesis.go @@ -5,12 +5,14 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" + 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" ) // InitGenesis initializes the CCV provider state and binds to PortID. -func (k Keeper) InitGenesis(ctx sdk.Context, genState *types.GenesisState) { +func (k Keeper) InitGenesis(ctx sdk.Context, genState *types.GenesisState) []abci.ValidatorUpdate { k.SetPort(ctx, ccv.ProviderPortID) // Only try to bind to port if it is not already bound, since we may already own @@ -103,6 +105,50 @@ func (k Keeper) InitGenesis(ctx sdk.Context, genState *types.GenesisState) { k.SetParams(ctx, genState.Params) k.InitializeSlashMeter(ctx) + + // Set the last provider consensus validator set + k.SetLastProviderConsensusValSet(ctx, genState.LastProviderConsensusValidators) + + return k.GetGenesisValUpdates(ctx) +} + +// GetGenesisValUpdates returns the genesis validator set updates +// for the provider module by selecting the first MaxProviderConsensusValidators +// from the staking module's validator set. +func (k Keeper) GetGenesisValUpdates(ctx sdk.Context) []abci.ValidatorUpdate { + // get the staking validator set + valSet, err := k.stakingKeeper.GetBondedValidatorsByPower(ctx) + if err != nil { + panic(fmt.Errorf("retrieving validator set: %w", err)) + } + + // restrict the set to the first MaxProviderConsensusValidators + maxVals := k.GetParams(ctx).MaxProviderConsensusValidators + if int64(len(valSet)) > maxVals { + k.Logger(ctx).Info(fmt.Sprintf("reducing validator set from %d to %d", len(valSet), maxVals)) + valSet = valSet[:maxVals] + } + + reducedValSet := make([]types.ConsensusValidator, len(valSet)) + for i, val := range valSet { + consensusVal, err := k.CreateProviderConsensusValidator(ctx, val) + if err != nil { + k.Logger(ctx).Error(fmt.Sprintf("failed to create provider consensus validator: %v", err)) + continue + } + reducedValSet[i] = consensusVal + } + + k.SetLastProviderConsensusValSet(ctx, reducedValSet) + + valUpdates := make([]abci.ValidatorUpdate, len(reducedValSet)) + for i, val := range reducedValSet { + valUpdates[i] = abci.ValidatorUpdate{ + PubKey: *val.PublicKey, + Power: val.Power, + } + } + return valUpdates } // ExportGenesis returns the CCV provider module's exported genesis @@ -171,5 +217,6 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { consumerAddrsToPrune, k.GetAllInitTimeoutTimestamps(ctx), exportedVscSendTimestamps, + k.GetLastProviderConsensusValSet(ctx), ) } diff --git a/x/ccv/provider/keeper/genesis_test.go b/x/ccv/provider/keeper/genesis_test.go index 8fd22824ef..62a4d3a440 100644 --- a/x/ccv/provider/keeper/genesis_test.go +++ b/x/ccv/provider/keeper/genesis_test.go @@ -5,12 +5,14 @@ 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" "github.com/cosmos/interchain-security/v5/testutil/crypto" testkeeper "github.com/cosmos/interchain-security/v5/testutil/keeper" @@ -32,6 +34,9 @@ func TestInitAndExportGenesis(t *testing.T) { // create validator keys and addresses for key assignment providerCryptoId := crypto.NewCryptoIdentityFromIntSeed(7896) provAddr := providerCryptoId.ProviderConsAddress() + provVal := providerCryptoId.SDKStakingValidator() + provPubKey, err := provVal.TmConsPublicKey() + require.NoError(t, err) consumerCryptoId := crypto.NewCryptoIdentityFromIntSeed(7897) consumerTmPubKey := consumerCryptoId.TMProtoCryptoPublicKey() @@ -63,6 +68,13 @@ func TestInitAndExportGenesis(t *testing.T) { exportedVscSendTimeStampsAll = append(exportedVscSendTimeStampsAll, exportedVscSendTimeStampsC0) exportedVscSendTimeStampsAll = append(exportedVscSendTimeStampsAll, exportedVscSendTimeStampsC1) + // at genesis, the validator has 100 power + lastProviderConsensusValidators := []providertypes.ConsensusValidator{{ + ProviderConsAddr: provAddr.Address, + Power: 100, + PublicKey: &provPubKey, + }} + // create genesis struct provGenesis := providertypes.NewGenesisState(vscID, []providertypes.ValsetUpdateIdToHeight{{ValsetUpdateId: vscID, Height: initHeight}}, @@ -127,6 +139,7 @@ func TestInitAndExportGenesis(t *testing.T) { }, initTimeoutTimeStamps, exportedVscSendTimeStampsAll, + lastProviderConsensusValidators, ) // Instantiate in-mem provider keeper with mocks @@ -141,6 +154,17 @@ func TestInitAndExportGenesis(t *testing.T) { ctx).Return(math.NewInt(100), nil).Times(1), // Return total voting power as 100 ) + mocks.MockStakingKeeper.EXPECT().GetBondedValidatorsByPower(gomock.Any()).Return( + // return an empty set of validators, since they are not tested against here + []stakingtypes.Validator{ + provVal, + }, nil).AnyTimes() + + valAddr, err := sdk.ValAddressFromBech32(provVal.GetOperator()) + require.NoError(t, err) + mocks.MockStakingKeeper.EXPECT().GetLastValidatorPower(gomock.Any(), valAddr). + Return(int64(100), nil).AnyTimes() + // init provider chain pk.InitGenesis(ctx, provGenesis) @@ -175,6 +199,16 @@ func TestInitAndExportGenesis(t *testing.T) { require.True(t, pk.PendingConsumerRemovalPropExists(ctx, cChainIDs[0], oneHourFromNow)) require.Equal(t, provGenesis.Params, pk.GetParams(ctx)) + providerConsensusValSet := pk.GetLastProviderConsensusValSet(ctx) + require.Equal(t, + []providertypes.ConsensusValidator{{ + ProviderConsAddr: provAddr.Address, + Power: 100, + PublicKey: &provPubKey, + }}, + providerConsensusValSet, + ) + gotConsTmPubKey, found := pk.GetValidatorConsumerPubKey(ctx, cChainIDs[0], provAddr) require.True(t, found) require.Equal(t, consumerTmPubKey, gotConsTmPubKey) diff --git a/x/ccv/provider/keeper/grpc_query.go b/x/ccv/provider/keeper/grpc_query.go index d2a36c686d..27c9450afb 100644 --- a/x/ccv/provider/keeper/grpc_query.go +++ b/x/ccv/provider/keeper/grpc_query.go @@ -328,7 +328,7 @@ func (k Keeper) QueryConsumerValidators(goCtx context.Context, req *types.QueryC for _, v := range k.GetConsumerValSet(ctx, consumerChainID) { validators = append(validators, &types.QueryConsumerValidatorsValidator{ ProviderAddress: sdk.ConsAddress(v.ProviderConsAddr).String(), - ConsumerKey: v.ConsumerPublicKey, + ConsumerKey: v.PublicKey, Power: v.Power, }) } diff --git a/x/ccv/provider/keeper/grpc_query_test.go b/x/ccv/provider/keeper/grpc_query_test.go index 3d9f9ee86d..55bc0cca91 100644 --- a/x/ccv/provider/keeper/grpc_query_test.go +++ b/x/ccv/provider/keeper/grpc_query_test.go @@ -5,18 +5,21 @@ import ( "testing" "time" - "cosmossdk.io/math" - "github.com/cometbft/cometbft/proto/tendermint/crypto" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" sdktypes "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/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/types" ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" - "github.com/stretchr/testify/require" ) func TestQueryAllPairsValConAddrByConsumerChainID(t *testing.T) { @@ -154,11 +157,11 @@ func TestQueryConsumerValidators(t *testing.T) { providerAddr1 := types.NewProviderConsAddress([]byte("providerAddr1")) consumerKey1 := cryptotestutil.NewCryptoIdentityFromIntSeed(1).TMProtoCryptoPublicKey() - consumerValidator1 := types.ConsumerValidator{ProviderConsAddr: providerAddr1.ToSdkConsAddr(), Power: 1, ConsumerPublicKey: &consumerKey1} + consumerValidator1 := types.ConsensusValidator{ProviderConsAddr: providerAddr1.ToSdkConsAddr(), Power: 1, PublicKey: &consumerKey1} providerAddr2 := types.NewProviderConsAddress([]byte("providerAddr2")) consumerKey2 := cryptotestutil.NewCryptoIdentityFromIntSeed(2).TMProtoCryptoPublicKey() - consumerValidator2 := types.ConsumerValidator{ProviderConsAddr: providerAddr2.ToSdkConsAddr(), Power: 2, ConsumerPublicKey: &consumerKey2} + consumerValidator2 := types.ConsensusValidator{ProviderConsAddr: providerAddr2.ToSdkConsAddr(), Power: 2, PublicKey: &consumerKey2} expectedResponse := types.QueryConsumerValidatorsResponse{ Validators: []*types.QueryConsumerValidatorsValidator{ @@ -169,7 +172,7 @@ func TestQueryConsumerValidators(t *testing.T) { // set up the client id so the chain looks like it "started" pk.SetConsumerClientId(ctx, chainID, "clientID") - pk.SetConsumerValSet(ctx, chainID, []types.ConsumerValidator{consumerValidator1, consumerValidator2}) + pk.SetConsumerValSet(ctx, chainID, []types.ConsensusValidator{consumerValidator1, consumerValidator2}) res, err := pk.QueryConsumerValidators(ctx, &req) require.NoError(t, err) @@ -197,10 +200,10 @@ func TestQueryConsumerChainsValidatorHasToValidate(t *testing.T) { } // set `providerAddr` as a consumer validator on "chain1" - pk.SetConsumerValidator(ctx, "chain1", types.ConsumerValidator{ + pk.SetConsumerValidator(ctx, "chain1", types.ConsensusValidator{ ProviderConsAddr: providerAddr.ToSdkConsAddr(), Power: 1, - ConsumerPublicKey: &crypto.PublicKey{ + PublicKey: &crypto.PublicKey{ Sum: &crypto.PublicKey_Ed25519{ Ed25519: []byte{1}, }, diff --git a/x/ccv/provider/keeper/hooks.go b/x/ccv/provider/keeper/hooks.go index 81226a2bdf..36a54154fb 100644 --- a/x/ccv/provider/keeper/hooks.go +++ b/x/ccv/provider/keeper/hooks.go @@ -5,6 +5,7 @@ import ( "fmt" "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" sdkgov "github.com/cosmos/cosmos-sdk/x/gov/types" v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" diff --git a/x/ccv/provider/keeper/hooks_test.go b/x/ccv/provider/keeper/hooks_test.go index 2447b5edf3..2a6d60db85 100644 --- a/x/ccv/provider/keeper/hooks_test.go +++ b/x/ccv/provider/keeper/hooks_test.go @@ -3,11 +3,13 @@ package keeper_test import ( "testing" + "github.com/golang/mock/gomock" + sdk "github.com/cosmos/cosmos-sdk/types" + cryptotestutil "github.com/cosmos/interchain-security/v5/testutil/crypto" testkeeper "github.com/cosmos/interchain-security/v5/testutil/keeper" providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" - "github.com/golang/mock/gomock" ) func TestValidatorConsensusKeyInUse(t *testing.T) { diff --git a/x/ccv/provider/keeper/keeper.go b/x/ccv/provider/keeper/keeper.go index 22f5f33626..0959358ffb 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/v5/x/ccv/consumer/types" "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" diff --git a/x/ccv/provider/keeper/keeper_test.go b/x/ccv/provider/keeper/keeper_test.go index e61a93cda1..faf253529e 100644 --- a/x/ccv/provider/keeper/keeper_test.go +++ b/x/ccv/provider/keeper/keeper_test.go @@ -7,10 +7,11 @@ import ( "testing" "time" - "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" diff --git a/x/ccv/provider/keeper/legacy_proposal.go b/x/ccv/provider/keeper/legacy_proposal.go index 19ad553038..b2648822c6 100644 --- a/x/ccv/provider/keeper/legacy_proposal.go +++ b/x/ccv/provider/keeper/legacy_proposal.go @@ -2,6 +2,7 @@ package keeper import ( errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" diff --git a/x/ccv/provider/keeper/msg_server.go b/x/ccv/provider/keeper/msg_server.go index 4239a7cf41..b97ebdb235 100644 --- a/x/ccv/provider/keeper/msg_server.go +++ b/x/ccv/provider/keeper/msg_server.go @@ -100,7 +100,8 @@ func (k msgServer) ConsumerAddition(goCtx context.Context, msg *types.MsgConsume // ConsumerRemoval defines a rpc handler method for MsgConsumerRemoval func (k msgServer) ConsumerRemoval( goCtx context.Context, - msg *types.MsgConsumerRemoval) (*types.MsgConsumerRemovalResponse, error) { + 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) } diff --git a/x/ccv/provider/keeper/params_test.go b/x/ccv/provider/keeper/params_test.go index e6a9db59bf..fe694b02f3 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/v5/testutil/keeper" diff --git a/x/ccv/provider/keeper/partial_set_security.go b/x/ccv/provider/keeper/partial_set_security.go index 069eb219dc..5fdedc2352 100644 --- a/x/ccv/provider/keeper/partial_set_security.go +++ b/x/ccv/provider/keeper/partial_set_security.go @@ -165,7 +165,7 @@ func (k Keeper) ComputeMinPowerInTopN(ctx sdk.Context, bondedValidators []stakin // 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.ConsumerValidator) []types.ConsumerValidator { +func (k Keeper) CapValidatorSet(ctx sdk.Context, chainID string, validators []types.ConsensusValidator) []types.ConsensusValidator { if topN, found := k.GetTopN(ctx, chainID); found && topN > 0 { // is a no-op if the chain is a Top N chain return validators @@ -186,7 +186,7 @@ func (k Keeper) CapValidatorSet(ctx sdk.Context, chainID string, validators []ty // 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.ConsumerValidator) []types.ConsumerValidator { +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) } else { @@ -196,7 +196,7 @@ func (k Keeper) CapValidatorsPower(ctx sdk.Context, chainID string, validators [ } // sum is a helper function to sum all the validators' power -func sum(validators []types.ConsumerValidator) int64 { +func sum(validators []types.ConsensusValidator) int64 { s := int64(0) for _, v := range validators { s = s + v.Power @@ -206,7 +206,7 @@ func sum(validators []types.ConsumerValidator) int64 { // NoMoreThanPercentOfTheSum returns a set of validators with updated powers such that no validator has more than the // provided `percent` of the sum of all validators' powers. Operates on a best-effort basis. -func NoMoreThanPercentOfTheSum(validators []types.ConsumerValidator, percent uint32) []types.ConsumerValidator { +func NoMoreThanPercentOfTheSum(validators []types.ConsensusValidator, percent uint32) []types.ConsensusValidator { // Algorithm's idea // ---------------- // Consider the validators' powers to be `a_1, a_2, ... a_n` and `p` to be the percent in [1, 100]. Now, consider @@ -262,7 +262,7 @@ func NoMoreThanPercentOfTheSum(validators []types.ConsumerValidator, percent uin } } - updatedValidators := make([]types.ConsumerValidator, len(validators)) + updatedValidators := make([]types.ConsensusValidator, len(validators)) powerPerValidator := int64(0) remainingValidators := int64(validatorsWithPowerLessThanMaxPower) @@ -309,7 +309,7 @@ func (k Keeper) CanValidateChain(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.ConsumerValidator { +func (k Keeper) ComputeNextValidators(ctx sdk.Context, chainID string, bondedValidators []stakingtypes.Validator) []types.ConsensusValidator { nextValidators := k.FilterValidators(ctx, chainID, bondedValidators, func(providerAddr types.ProviderConsAddress) bool { return k.CanValidateChain(ctx, chainID, providerAddr) diff --git a/x/ccv/provider/keeper/partial_set_security_test.go b/x/ccv/provider/keeper/partial_set_security_test.go index 2dfbfd3b82..9999d15d4d 100644 --- a/x/ccv/provider/keeper/partial_set_security_test.go +++ b/x/ccv/provider/keeper/partial_set_security_test.go @@ -2,17 +2,16 @@ package keeper_test import ( "bytes" + 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" @@ -389,24 +388,24 @@ func TestCapValidatorSet(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - validatorA := types.ConsumerValidator{ - ProviderConsAddr: []byte("providerConsAddrA"), - Power: 1, - ConsumerPublicKey: &crypto.PublicKey{}, + validatorA := types.ConsensusValidator{ + ProviderConsAddr: []byte("providerConsAddrA"), + Power: 1, + PublicKey: &crypto.PublicKey{}, } - validatorB := types.ConsumerValidator{ - ProviderConsAddr: []byte("providerConsAddrB"), - Power: 2, - ConsumerPublicKey: &crypto.PublicKey{}, + validatorB := types.ConsensusValidator{ + ProviderConsAddr: []byte("providerConsAddrB"), + Power: 2, + PublicKey: &crypto.PublicKey{}, } - validatorC := types.ConsumerValidator{ - ProviderConsAddr: []byte("providerConsAddrC"), - Power: 3, - ConsumerPublicKey: &crypto.PublicKey{}, + validatorC := types.ConsensusValidator{ + ProviderConsAddr: []byte("providerConsAddrC"), + Power: 3, + PublicKey: &crypto.PublicKey{}, } - validators := []types.ConsumerValidator{validatorA, validatorB, validatorC} + validators := []types.ConsensusValidator{validatorA, validatorB, validatorC} consumerValidators := providerKeeper.CapValidatorSet(ctx, "chainID", validators) require.Equal(t, validators, consumerValidators) @@ -421,55 +420,55 @@ func TestCapValidatorSet(t *testing.T) { providerKeeper.SetValidatorSetCap(ctx, "chainID", 1) consumerValidators = providerKeeper.CapValidatorSet(ctx, "chainID", validators) - require.Equal(t, []types.ConsumerValidator{validatorC}, consumerValidators) + require.Equal(t, []types.ConsensusValidator{validatorC}, consumerValidators) providerKeeper.SetValidatorSetCap(ctx, "chainID", 2) consumerValidators = providerKeeper.CapValidatorSet(ctx, "chainID", validators) - require.Equal(t, []types.ConsumerValidator{validatorC, validatorB}, consumerValidators) + require.Equal(t, []types.ConsensusValidator{validatorC, validatorB}, consumerValidators) providerKeeper.SetValidatorSetCap(ctx, "chainID", 3) consumerValidators = providerKeeper.CapValidatorSet(ctx, "chainID", validators) - require.Equal(t, []types.ConsumerValidator{validatorC, validatorB, validatorA}, consumerValidators) + require.Equal(t, []types.ConsensusValidator{validatorC, validatorB, validatorA}, consumerValidators) } func TestCapValidatorsPower(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - validatorA := types.ConsumerValidator{ - ProviderConsAddr: []byte("providerConsAddrA"), - Power: 1, - ConsumerPublicKey: &crypto.PublicKey{}, + validatorA := types.ConsensusValidator{ + ProviderConsAddr: []byte("providerConsAddrA"), + Power: 1, + PublicKey: &crypto.PublicKey{}, } - validatorB := types.ConsumerValidator{ - ProviderConsAddr: []byte("providerConsAddrB"), - Power: 2, - ConsumerPublicKey: &crypto.PublicKey{}, + validatorB := types.ConsensusValidator{ + ProviderConsAddr: []byte("providerConsAddrB"), + Power: 2, + PublicKey: &crypto.PublicKey{}, } - validatorC := types.ConsumerValidator{ - ProviderConsAddr: []byte("providerConsAddrC"), - Power: 3, - ConsumerPublicKey: &crypto.PublicKey{}, + validatorC := types.ConsensusValidator{ + ProviderConsAddr: []byte("providerConsAddrC"), + Power: 3, + PublicKey: &crypto.PublicKey{}, } - validatorD := types.ConsumerValidator{ - ProviderConsAddr: []byte("providerConsAddrD"), - Power: 4, - ConsumerPublicKey: &crypto.PublicKey{}, + validatorD := types.ConsensusValidator{ + ProviderConsAddr: []byte("providerConsAddrD"), + Power: 4, + PublicKey: &crypto.PublicKey{}, } - validators := []types.ConsumerValidator{validatorA, validatorB, validatorC, validatorD} + validators := []types.ConsensusValidator{validatorA, validatorB, validatorC, validatorD} - expectedValidators := make([]types.ConsumerValidator, len(validators)) + expectedValidators := make([]types.ConsensusValidator, len(validators)) copy(expectedValidators, validators) expectedValidators[0].Power = 2 expectedValidators[1].Power = 2 expectedValidators[2].Power = 3 expectedValidators[3].Power = 3 - sortValidators := func(validators []types.ConsumerValidator) { + sortValidators := func(validators []types.ConsensusValidator) { sort.Slice(validators, func(i, j int) bool { return bytes.Compare(validators[i].ProviderConsAddr, validators[j].ProviderConsAddr) < 0 }) @@ -523,13 +522,13 @@ func TestNoMoreThanPercentOfTheSum(t *testing.T) { require.True(t, noMoreThanPercent(keeper.NoMoreThanPercentOfTheSum(createConsumerValidators(powers), percent), percent)) } -func createConsumerValidators(powers []int64) []types.ConsumerValidator { - var validators []types.ConsumerValidator +func createConsumerValidators(powers []int64) []types.ConsensusValidator { + var validators []types.ConsensusValidator for _, p := range powers { - validators = append(validators, types.ConsumerValidator{ - ProviderConsAddr: []byte("providerConsAddr"), - Power: p, - ConsumerPublicKey: &crypto.PublicKey{}, + validators = append(validators, types.ConsensusValidator{ + ProviderConsAddr: []byte("providerConsAddr"), + Power: p, + PublicKey: &crypto.PublicKey{}, }) } return validators @@ -537,7 +536,7 @@ func createConsumerValidators(powers []int64) []types.ConsumerValidator { // returns `true` if no validator in `validators` corresponds to more than `percent` of the total sum of all // validators' powers -func noMoreThanPercent(validators []types.ConsumerValidator, percent uint32) bool { +func noMoreThanPercent(validators []types.ConsensusValidator, percent uint32) bool { sum := int64(0) for _, v := range validators { sum = sum + v.Power @@ -551,7 +550,7 @@ func noMoreThanPercent(validators []types.ConsumerValidator, percent uint32) boo return true } -func sumPowers(vals []types.ConsumerValidator) int64 { +func sumPowers(vals []types.ConsensusValidator) int64 { sum := int64(0) for _, v := range vals { sum += v.Power @@ -559,7 +558,7 @@ func sumPowers(vals []types.ConsumerValidator) int64 { return sum } -func CapSatisfiable(vals []types.ConsumerValidator, percent uint32) bool { +func CapSatisfiable(vals []types.ConsensusValidator, percent uint32) bool { // 100 / len(vals) is what each validator gets if each has the same power. // if this is more than the cap, it cannot be satisfied. return float64(100)/float64(len(vals)) < float64(percent) @@ -569,14 +568,14 @@ func TestNoMoreThanPercentOfTheSumProps(t *testing.T) { // define properties to test // capRespectedIfSatisfiable: if the cap can be respected, then it will be respected - capRespectedIfSatisfiable := func(valsBefore, valsAfter []types.ConsumerValidator, percent uint32) bool { + capRespectedIfSatisfiable := func(valsBefore, valsAfter []types.ConsensusValidator, percent uint32) bool { if CapSatisfiable(valsBefore, percent) { return noMoreThanPercent(valsAfter, percent) } return true } - evenPowersIfCapCannotBeSatisfied := func(valsBefore, valsAfter []types.ConsumerValidator, percent uint32) bool { + evenPowersIfCapCannotBeSatisfied := func(valsBefore, valsAfter []types.ConsensusValidator, percent uint32) bool { if !CapSatisfiable(valsBefore, percent) { // if the cap cannot be satisfied, each validator should have the same power for _, valAfter := range valsAfter { @@ -590,7 +589,7 @@ func TestNoMoreThanPercentOfTheSumProps(t *testing.T) { // fairness: if before, v1 has more power than v2, then afterwards v1 will not have less power than v2 // (they might get the same power if they are both capped) - fairness := func(valsBefore, valsAfter []types.ConsumerValidator) bool { + fairness := func(valsBefore, valsAfter []types.ConsensusValidator) bool { for i, v := range valsBefore { // find the validator after with the same address vAfter := findConsumerValidator(t, v, valsAfter) @@ -619,7 +618,7 @@ func TestNoMoreThanPercentOfTheSumProps(t *testing.T) { } // non-zero: v has non-zero power before IFF it has non-zero power after - nonZero := func(valsBefore, valsAfter []types.ConsumerValidator) bool { + nonZero := func(valsBefore, valsAfter []types.ConsensusValidator) bool { for _, v := range valsBefore { vAfter := findConsumerValidator(t, v, valsAfter) if (v.Power == 0) != (vAfter.Power == 0) { @@ -631,7 +630,7 @@ func TestNoMoreThanPercentOfTheSumProps(t *testing.T) { // equalSumIfCapSatisfiable: the sum of the powers of the validators will not change if the cap can be satisfied // (except for small changes by rounding errors) - equalSumIfCapSatisfiable := func(valsBefore, valsAfter []types.ConsumerValidator, percent uint32) bool { + equalSumIfCapSatisfiable := func(valsBefore, valsAfter []types.ConsensusValidator, percent uint32) bool { if CapSatisfiable(valsBefore, percent) { difference := gomath.Abs(float64(sumPowers(valsBefore) - sumPowers(valsAfter))) if difference > 1 { @@ -643,7 +642,7 @@ func TestNoMoreThanPercentOfTheSumProps(t *testing.T) { } // num validators: the number of validators will not change - equalNumVals := func(valsBefore, valsAfter []types.ConsumerValidator) bool { + equalNumVals := func(valsBefore, valsAfter []types.ConsensusValidator) bool { return len(valsBefore) == len(valsAfter) } @@ -669,8 +668,8 @@ func TestNoMoreThanPercentOfTheSumProps(t *testing.T) { }) } -func findConsumerValidator(t *testing.T, v types.ConsumerValidator, valsAfter []types.ConsumerValidator) *types.ConsumerValidator { - var vAfter *types.ConsumerValidator +func findConsumerValidator(t *testing.T, v types.ConsensusValidator, valsAfter []types.ConsensusValidator) *types.ConsensusValidator { + var vAfter *types.ConsensusValidator for _, vA := range valsAfter { if bytes.Equal(v.ProviderConsAddr, vA.ProviderConsAddr) { vAfter = &vA diff --git a/x/ccv/provider/keeper/proposal.go b/x/ccv/provider/keeper/proposal.go index 887251c87a..e34f6ecdf2 100644 --- a/x/ccv/provider/keeper/proposal.go +++ b/x/ccv/provider/keeper/proposal.go @@ -5,8 +5,6 @@ import ( "strconv" "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" @@ -17,6 +15,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" tmtypes "github.com/cometbft/cometbft/types" @@ -297,7 +296,7 @@ func (k Keeper) MakeConsumerGenesis( k.SetConsumerValSet(ctx, chainID, nextValidators) // get the initial updates with the latest set consumer public keys - initialUpdatesWithConsumerKeys := DiffValidators([]types.ConsumerValidator{}, nextValidators) + 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) diff --git a/x/ccv/provider/keeper/proposal_test.go b/x/ccv/provider/keeper/proposal_test.go index 650179c274..a68cb35bc9 100644 --- a/x/ccv/provider/keeper/proposal_test.go +++ b/x/ccv/provider/keeper/proposal_test.go @@ -7,16 +7,16 @@ import ( "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" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" abci "github.com/cometbft/cometbft/abci/types" diff --git a/x/ccv/provider/keeper/provider_consensus.go b/x/ccv/provider/keeper/provider_consensus.go index 7212842411..ffccd19ed1 100644 --- a/x/ccv/provider/keeper/provider_consensus.go +++ b/x/ccv/provider/keeper/provider_consensus.go @@ -1,8 +1,12 @@ package keeper import ( + "fmt" + "cosmossdk.io/math" + 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" ) @@ -11,14 +15,14 @@ import ( // as part of the last provider consensus validator set func (k Keeper) SetLastProviderConsensusValidator( ctx sdk.Context, - validator types.ConsumerValidator, + validator types.ConsensusValidator, ) { k.setValidator(ctx, []byte{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.ConsumerValidator) { +func (k Keeper) SetLastProviderConsensusValSet(ctx sdk.Context, nextValidators []types.ConsensusValidator) { k.setValSet(ctx, []byte{types.LastProviderConsensusValsPrefix}, nextValidators) } @@ -43,7 +47,7 @@ func (k Keeper) DeleteLastProviderConsensusValSet( // validator set sent to the consensus engine on the provider func (k Keeper) GetLastProviderConsensusValSet( ctx sdk.Context, -) []types.ConsumerValidator { +) []types.ConsensusValidator { return k.getValSet(ctx, []byte{types.LastProviderConsensusValsPrefix}) } @@ -54,3 +58,29 @@ func (k Keeper) GetLastTotalProviderConsensusPower( ) math.Int { return k.getTotalPower(ctx, []byte{types.LastProviderConsensusValsPrefix}) } + +func (k Keeper) CreateProviderConsensusValidator(ctx sdk.Context, val stakingtypes.Validator) (types.ConsensusValidator, error) { + consAddr, err := val.GetConsAddr() + if err != nil { + return types.ConsensusValidator{}, fmt.Errorf("getting consensus address: %w", err) + } + pubKey, err := val.TmConsPublicKey() + if err != nil { + return types.ConsensusValidator{}, fmt.Errorf("getting consensus public key: %w", err) + } + valAddr, err := sdk.ValAddressFromBech32(val.GetOperator()) + if err != nil { + return types.ConsensusValidator{}, fmt.Errorf("getting validator address: %w", err) + } + + power, err := k.stakingKeeper.GetLastValidatorPower(ctx, valAddr) + if err != nil { + return types.ConsensusValidator{}, fmt.Errorf("getting validator power: %w", err) + } + + return types.ConsensusValidator{ + ProviderConsAddr: consAddr, + PublicKey: &pubKey, + Power: power, + }, nil +} diff --git a/x/ccv/provider/keeper/provider_consensus_test.go b/x/ccv/provider/keeper/provider_consensus_test.go index 3f6a84b453..bdc00743e7 100644 --- a/x/ccv/provider/keeper/provider_consensus_test.go +++ b/x/ccv/provider/keeper/provider_consensus_test.go @@ -3,9 +3,10 @@ package keeper_test import ( "testing" - "github.com/cometbft/cometbft/proto/tendermint/crypto" "github.com/stretchr/testify/require" + "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/types" ) @@ -14,10 +15,10 @@ func TestSetLastProviderConsensusValidator(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - validator := types.ConsumerValidator{ - ProviderConsAddr: []byte("providerConsAddr"), - Power: 2, - ConsumerPublicKey: &crypto.PublicKey{}, + validator := types.ConsensusValidator{ + ProviderConsAddr: []byte("providerConsAddr"), + Power: 2, + PublicKey: &crypto.PublicKey{}, } providerKeeper.SetLastProviderConsensusValidator(ctx, validator) @@ -32,19 +33,19 @@ func TestSetLastProviderConsensusValSet(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - validator1 := types.ConsumerValidator{ - ProviderConsAddr: []byte("providerConsAddr1"), - Power: 2, - ConsumerPublicKey: &crypto.PublicKey{}, + validator1 := types.ConsensusValidator{ + ProviderConsAddr: []byte("providerConsAddr1"), + Power: 2, + PublicKey: &crypto.PublicKey{}, } - validator2 := types.ConsumerValidator{ - ProviderConsAddr: []byte("providerConsAddr2"), - Power: 3, - ConsumerPublicKey: &crypto.PublicKey{}, + validator2 := types.ConsensusValidator{ + ProviderConsAddr: []byte("providerConsAddr2"), + Power: 3, + PublicKey: &crypto.PublicKey{}, } - nextValidators := []types.ConsumerValidator{validator1, validator2} + nextValidators := []types.ConsensusValidator{validator1, validator2} providerKeeper.SetLastProviderConsensusValSet(ctx, nextValidators) @@ -57,10 +58,10 @@ func TestDeleteLastProviderConsensusValidator(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - validator := types.ConsumerValidator{ - ProviderConsAddr: []byte("providerConsAddr"), - Power: 2, - ConsumerPublicKey: &crypto.PublicKey{}, + validator := types.ConsensusValidator{ + ProviderConsAddr: []byte("providerConsAddr"), + Power: 2, + PublicKey: &crypto.PublicKey{}, } providerKeeper.SetLastProviderConsensusValidator(ctx, validator) @@ -77,19 +78,19 @@ func TestDeleteLastProviderConsensusValSet(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - validator1 := types.ConsumerValidator{ - ProviderConsAddr: []byte("providerConsAddr1"), - Power: 2, - ConsumerPublicKey: &crypto.PublicKey{}, + validator1 := types.ConsensusValidator{ + ProviderConsAddr: []byte("providerConsAddr1"), + Power: 2, + PublicKey: &crypto.PublicKey{}, } - validator2 := types.ConsumerValidator{ - ProviderConsAddr: []byte("providerConsAddr2"), - Power: 3, - ConsumerPublicKey: &crypto.PublicKey{}, + validator2 := types.ConsensusValidator{ + ProviderConsAddr: []byte("providerConsAddr2"), + Power: 3, + PublicKey: &crypto.PublicKey{}, } - nextValidators := []types.ConsumerValidator{validator1, validator2} + nextValidators := []types.ConsensusValidator{validator1, validator2} providerKeeper.SetLastProviderConsensusValSet(ctx, nextValidators) diff --git a/x/ccv/provider/keeper/relay.go b/x/ccv/provider/keeper/relay.go index c8c40fa0d1..2ae796adfa 100644 --- a/x/ccv/provider/keeper/relay.go +++ b/x/ccv/provider/keeper/relay.go @@ -5,7 +5,6 @@ import ( "fmt" "strconv" - abci "github.com/cometbft/cometbft/abci/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 ( sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + 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" @@ -147,7 +148,13 @@ func (k Keeper) OnTimeoutPacket(ctx sdk.Context, packet channeltypes.Packet) err // EndBlockVSU contains the EndBlock logic needed for // the Validator Set Update sub-protocol -func (k Keeper) EndBlockVSU(ctx sdk.Context) { +func (k Keeper) EndBlockVSU(ctx sdk.Context) ([]abci.ValidatorUpdate, error) { + // logic to update the provider consensus validator set. + // Important: must be called before the rest of EndBlockVSU, because + // we need to know the updated provider validator set + // to compute the minimum power in the top N + valUpdates := k.ProviderValidatorUpdates(ctx) + // notify the staking module to complete all matured unbonding ops k.completeMaturedUnbondingOps(ctx) @@ -162,61 +169,37 @@ func (k Keeper) EndBlockVSU(ctx sdk.Context) { // the updates will remain queued until the channel is established k.SendVSCPackets(ctx) } + + return valUpdates, nil } +// ProviderValidatorUpdates returns changes in the provider consensus validator set +// from the last block to the current one. +// 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 { // get the bonded validators from the staking module - bondedValidators := k.stakingKeeper.GetBondedValidatorsByPower(ctx) + bondedValidators, error := k.stakingKeeper.GetBondedValidatorsByPower(ctx) + if error != nil { + panic(fmt.Errorf("failed to get bonded validators: %w", error)) + } // get the last validator set sent to consensus currentValidators := k.GetLastProviderConsensusValSet(ctx) - nextValidators := []types.ConsumerValidator{} + nextValidators := []types.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)) { maxValidators = int64(len(bondedValidators)) } for _, val := range bondedValidators[:maxValidators] { - // create the validator from the staking validator - consAddr, err := val.GetConsAddr() + nextValidator, err := k.CreateProviderConsensusValidator(ctx, val) if err != nil { - k.Logger(ctx).Error("getting consensus address", - "validator", val.GetOperator(), - "error", err) + k.Logger(ctx).Error("error when creating provider consensus validator", "error", err) continue } - - pubKey, err := val.TmConsPublicKey() - if err != nil { - k.Logger(ctx).Error("getting consensus public key", - "validator", val.GetOperator(), - "error", err) - continue - } - - valAddr, err := sdk.ValAddressFromBech32(val.GetOperator()) - if err != nil { - k.Logger(ctx).Error("creating validator address", - "validator", val.GetOperator(), - "error", err) - continue - } - - power, err := k.stakingKeeper.GetLastValidatorPower(ctx, valAddr) - if err != nil { - k.Logger(ctx).Error("getting last validator power", - "validator", val.GetOperator(), - "error", err) - continue - } - - nextValidator := types.ConsumerValidator{ - ProviderConsAddr: consAddr, - ConsumerPublicKey: &pubKey, - Power: power, - } - nextValidators = append(nextValidators, nextValidator) } diff --git a/x/ccv/provider/keeper/relay_test.go b/x/ccv/provider/keeper/relay_test.go index 59626f7038..5cdc413770 100644 --- a/x/ccv/provider/keeper/relay_test.go +++ b/x/ccv/provider/keeper/relay_test.go @@ -1,16 +1,18 @@ package keeper_test import ( + "sort" "strings" "testing" - "cosmossdk.io/math" 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" "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "cosmossdk.io/math" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" @@ -124,7 +126,7 @@ func TestOnRecvDowntimeSlashPacket(t *testing.T) { providerKeeper.SetValsetUpdateBlockHeight(ctx, packetData.ValsetUpdateId, uint64(15)) // Set consumer validator - providerKeeper.SetConsumerValidator(ctx, "chain-1", providertypes.ConsumerValidator{ + providerKeeper.SetConsumerValidator(ctx, "chain-1", providertypes.ConsensusValidator{ ProviderConsAddr: packetData.Validator.Address, }) @@ -135,7 +137,7 @@ func TestOnRecvDowntimeSlashPacket(t *testing.T) { require.NoError(t, err) // Set consumer validator - providerKeeper.SetConsumerValidator(ctx, "chain-2", providertypes.ConsumerValidator{ + providerKeeper.SetConsumerValidator(ctx, "chain-2", providertypes.ConsensusValidator{ ProviderConsAddr: packetData.Validator.Address, }) @@ -148,7 +150,7 @@ func TestOnRecvDowntimeSlashPacket(t *testing.T) { providerKeeper.SetSlashMeter(ctx, math.NewInt(5)) // Set the consumer validator - providerKeeper.SetConsumerValidator(ctx, "chain-1", providertypes.ConsumerValidator{ProviderConsAddr: packetData.Validator.Address}) + providerKeeper.SetConsumerValidator(ctx, "chain-1", providertypes.ConsensusValidator{ProviderConsAddr: packetData.Validator.Address}) // Mock call to GetEffectiveValPower, so that it returns 2. providerAddr := providertypes.NewProviderConsAddress(packetData.Validator.Address) @@ -442,7 +444,7 @@ 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.ConsumerValidator{ProviderConsAddr: providerConsAddr.Address.Bytes()}) + providerKeeper.SetConsumerValidator(ctx, chainId, providertypes.ConsensusValidator{ProviderConsAddr: providerConsAddr.Address.Bytes()}) // Execute method and assert expected mock calls. providerKeeper.HandleSlashPacket(ctx, chainId, tc.packetData) @@ -502,7 +504,7 @@ func TestHandleVSCMaturedPacket(t *testing.T) { } // Opt-in one validator to consumer - pk.SetConsumerValidator(ctx, "chain-1", providertypes.ConsumerValidator{ProviderConsAddr: valsPk[0].Address()}) + pk.SetConsumerValidator(ctx, "chain-1", providertypes.ConsensusValidator{ProviderConsAddr: valsPk[0].Address()}) // Start second unbonding unbondingOpId = 2 @@ -538,8 +540,8 @@ func TestHandleVSCMaturedPacket(t *testing.T) { pk.SetConsumerClientId(ctx, "chain-2", "client-2") // Opt-in both validators to second consumer - pk.SetConsumerValidator(ctx, "chain-2", providertypes.ConsumerValidator{ProviderConsAddr: valsPk[0].Address()}) - pk.SetConsumerValidator(ctx, "chain-2", providertypes.ConsumerValidator{ProviderConsAddr: valsPk[1].Address()}) + pk.SetConsumerValidator(ctx, "chain-2", providertypes.ConsensusValidator{ProviderConsAddr: valsPk[0].Address()}) + pk.SetConsumerValidator(ctx, "chain-2", providertypes.ConsensusValidator{ProviderConsAddr: valsPk[1].Address()}) // Start third and fourth unbonding unbondingOpIds := []uint64{3, 4} @@ -773,6 +775,12 @@ func TestEndBlockVSU(t *testing.T) { testkeeper.SetupMocksForLastBondedValidatorsExpectation(mocks.MockStakingKeeper, 5, lastValidators, powers, -1) + sort.Slice(lastValidators, func(i, j int) bool { + return lastValidators[i].ConsensusPower(sdk.DefaultPowerReduction) > + lastValidators[j].GetConsensusPower(sdk.DefaultPowerReduction) + }) + 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") diff --git a/x/ccv/provider/keeper/throttle_legacy.go b/x/ccv/provider/keeper/throttle_legacy.go index 53c6f39c72..d08e6b7f40 100644 --- a/x/ccv/provider/keeper/throttle_legacy.go +++ b/x/ccv/provider/keeper/throttle_legacy.go @@ -4,6 +4,7 @@ import ( "fmt" storetypes "cosmossdk.io/store/types" + sdktypes "github.com/cosmos/cosmos-sdk/types" providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" diff --git a/x/ccv/provider/keeper/validator_set_storage.go b/x/ccv/provider/keeper/validator_set_storage.go index 71be6cca5a..f09a612c89 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/v5/x/ccv/provider/types" @@ -19,7 +20,7 @@ func (k Keeper) getValidatorKey(prefix []byte, providerAddr types.ProviderConsAd func (k Keeper) setValidator( ctx sdk.Context, prefix []byte, - validator types.ConsumerValidator, + validator types.ConsensusValidator, ) { store := ctx.KVStore(k.storeKey) bz, err := validator.Marshal() @@ -31,7 +32,7 @@ func (k Keeper) setValidator( } // setValSet resets the validator set stored under the given prefix to the provided `nextValidators`. -func (k Keeper) setValSet(ctx sdk.Context, prefix []byte, nextValidators []types.ConsumerValidator) { +func (k Keeper) setValSet(ctx sdk.Context, prefix []byte, nextValidators []types.ConsensusValidator) { k.deleteValSet(ctx, prefix) for _, val := range nextValidators { k.setValidator(ctx, prefix, val) @@ -78,14 +79,14 @@ func (k Keeper) isValidator(ctx sdk.Context, prefix []byte, providerAddr types.P func (k Keeper) getValSet( ctx sdk.Context, key []byte, -) (validators []types.ConsumerValidator) { +) (validators []types.ConsensusValidator) { store := ctx.KVStore(k.storeKey) iterator := storetypes.KVStorePrefixIterator(store, key) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { iterator.Value() - var validator types.ConsumerValidator + var validator types.ConsensusValidator if err := validator.Unmarshal(iterator.Value()); err != nil { panic(fmt.Errorf("failed to unmarshal ConsumerValidator: %w", err)) } diff --git a/x/ccv/provider/keeper/validator_set_update.go b/x/ccv/provider/keeper/validator_set_update.go index 1bf12748ae..c3a866fd42 100644 --- a/x/ccv/provider/keeper/validator_set_update.go +++ b/x/ccv/provider/keeper/validator_set_update.go @@ -21,14 +21,14 @@ func (k Keeper) GetConsumerChainKey(ctx sdk.Context, chainID string) []byte { func (k Keeper) SetConsumerValidator( ctx sdk.Context, chainID string, - validator types.ConsumerValidator, + validator types.ConsensusValidator, ) { k.setValidator(ctx, k.GetConsumerChainKey(ctx, chainID), 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.ConsumerValidator) { +func (k Keeper) SetConsumerValSet(ctx sdk.Context, chainID string, nextValidators []types.ConsensusValidator) { k.setValSet(ctx, k.GetConsumerChainKey(ctx, chainID), nextValidators) } @@ -59,45 +59,45 @@ func (k Keeper) IsConsumerValidator(ctx sdk.Context, chainID string, providerAdd func (k Keeper) GetConsumerValSet( ctx sdk.Context, chainID string, -) []types.ConsumerValidator { +) []types.ConsensusValidator { return k.getValSet(ctx, k.GetConsumerChainKey(ctx, chainID)) } // DiffValidators compares the current and the next epoch's consumer validators and returns the `ValidatorUpdate` diff // needed by CometBFT to update the validator set on a chain. func DiffValidators( - currentValidators []types.ConsumerValidator, - nextValidators []types.ConsumerValidator, + currentValidators []types.ConsensusValidator, + nextValidators []types.ConsensusValidator, ) []abci.ValidatorUpdate { var updates []abci.ValidatorUpdate - isCurrentValidator := make(map[string]types.ConsumerValidator, len(currentValidators)) + isCurrentValidator := make(map[string]types.ConsensusValidator, len(currentValidators)) for _, val := range currentValidators { - isCurrentValidator[val.ConsumerPublicKey.String()] = val + isCurrentValidator[val.PublicKey.String()] = val } - isNextValidator := make(map[string]types.ConsumerValidator, len(nextValidators)) + isNextValidator := make(map[string]types.ConsensusValidator, len(nextValidators)) for _, val := range nextValidators { - isNextValidator[val.ConsumerPublicKey.String()] = val + isNextValidator[val.PublicKey.String()] = val } for _, currentVal := range currentValidators { - if nextVal, found := isNextValidator[currentVal.ConsumerPublicKey.String()]; !found { + if nextVal, found := isNextValidator[currentVal.PublicKey.String()]; !found { // this consumer public key does not appear in the next validators and hence we remove the validator // with that consumer public key by creating an update with 0 power - updates = append(updates, abci.ValidatorUpdate{PubKey: *currentVal.ConsumerPublicKey, Power: 0}) + updates = append(updates, abci.ValidatorUpdate{PubKey: *currentVal.PublicKey, Power: 0}) } else if currentVal.Power != nextVal.Power { // validator did not modify its consumer public key but has changed its voting power, so we // have to create an update with the new power - updates = append(updates, abci.ValidatorUpdate{PubKey: *nextVal.ConsumerPublicKey, Power: nextVal.Power}) + updates = append(updates, abci.ValidatorUpdate{PubKey: *nextVal.PublicKey, Power: nextVal.Power}) } // else no update is needed because neither the consumer public key changed, nor the power of the validator } for _, nextVal := range nextValidators { - if _, found := isCurrentValidator[nextVal.ConsumerPublicKey.String()]; !found { + if _, found := isCurrentValidator[nextVal.PublicKey.String()]; !found { // this consumer public key does not exist in the current validators and hence we introduce this validator - updates = append(updates, abci.ValidatorUpdate{PubKey: *nextVal.ConsumerPublicKey, Power: nextVal.Power}) + updates = append(updates, abci.ValidatorUpdate{PubKey: *nextVal.PublicKey, Power: nextVal.Power}) } } @@ -105,30 +105,30 @@ func DiffValidators( } // 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.ConsumerValidator, error) { +func (k Keeper) CreateConsumerValidator(ctx sdk.Context, chainID string, validator stakingtypes.Validator) (types.ConsensusValidator, error) { valAddr, err := sdk.ValAddressFromBech32(validator.GetOperator()) if err != nil { - return types.ConsumerValidator{}, err + return types.ConsensusValidator{}, err } power, err := k.stakingKeeper.GetLastValidatorPower(ctx, valAddr) consAddr, err := validator.GetConsAddr() if err != nil { - return types.ConsumerValidator{}, fmt.Errorf("could not retrieve validator's (%+v) consensus address: %w", + return types.ConsensusValidator{}, fmt.Errorf("could not retrieve validator's (%+v) consensus address: %w", validator, err) } - consumerPublicKey, foundConsumerPublicKey := k.GetValidatorConsumerPubKey(ctx, chainID, types.NewProviderConsAddress(consAddr)) - if !foundConsumerPublicKey { + consumerPublicKey, found := k.GetValidatorConsumerPubKey(ctx, chainID, types.NewProviderConsAddress(consAddr)) + if !found { consumerPublicKey, err = validator.TmConsPublicKey() if err != nil { - return types.ConsumerValidator{}, fmt.Errorf("could not retrieve validator's (%+v) public key: %w", validator, err) + return types.ConsensusValidator{}, fmt.Errorf("could not retrieve validator's (%+v) public key: %w", validator, err) } } - return types.ConsumerValidator{ - ProviderConsAddr: consAddr, - Power: power, - ConsumerPublicKey: &consumerPublicKey, + return types.ConsensusValidator{ + ProviderConsAddr: consAddr, + Power: power, + PublicKey: &consumerPublicKey, }, nil } @@ -139,8 +139,8 @@ func (k Keeper) FilterValidators( chainID string, bondedValidators []stakingtypes.Validator, predicate func(providerAddr types.ProviderConsAddress) bool, -) []types.ConsumerValidator { - var nextValidators []types.ConsumerValidator +) []types.ConsensusValidator { + var nextValidators []types.ConsensusValidator for _, val := range bondedValidators { consAddr, err := val.GetConsAddr() if err != nil { diff --git a/x/ccv/provider/keeper/validator_set_update_test.go b/x/ccv/provider/keeper/validator_set_update_test.go index 43bc5a0370..b4de4ba416 100644 --- a/x/ccv/provider/keeper/validator_set_update_test.go +++ b/x/ccv/provider/keeper/validator_set_update_test.go @@ -26,10 +26,10 @@ func TestConsumerValidator(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - validator := types.ConsumerValidator{ - ProviderConsAddr: []byte("providerConsAddr"), - Power: 2, - ConsumerPublicKey: &crypto.PublicKey{}, + validator := types.ConsensusValidator{ + ProviderConsAddr: []byte("providerConsAddr"), + Power: 2, + PublicKey: &crypto.PublicKey{}, } require.False(t, providerKeeper.IsConsumerValidator(ctx, "chainID", types.NewProviderConsAddress(validator.ProviderConsAddr))) @@ -44,11 +44,11 @@ func TestGetConsumerValSet(t *testing.T) { defer ctrl.Finish() // create 3 validators and set them as current validators - expectedValidators := []types.ConsumerValidator{ + expectedValidators := []types.ConsensusValidator{ { ProviderConsAddr: []byte("providerConsAddr1"), Power: 1, - ConsumerPublicKey: &crypto.PublicKey{ + PublicKey: &crypto.PublicKey{ Sum: &crypto.PublicKey_Ed25519{ Ed25519: []byte{1}, }, @@ -57,7 +57,7 @@ func TestGetConsumerValSet(t *testing.T) { { ProviderConsAddr: []byte("providerConsAddr2"), Power: 2, - ConsumerPublicKey: &crypto.PublicKey{ + PublicKey: &crypto.PublicKey{ Sum: &crypto.PublicKey_Ed25519{ Ed25519: []byte{2}, }, @@ -66,7 +66,7 @@ func TestGetConsumerValSet(t *testing.T) { { ProviderConsAddr: []byte("providerConsAddr3"), Power: 3, - ConsumerPublicKey: &crypto.PublicKey{ + PublicKey: &crypto.PublicKey{ Sum: &crypto.PublicKey_Ed25519{ Ed25519: []byte{3}, }, @@ -76,17 +76,17 @@ func TestGetConsumerValSet(t *testing.T) { for _, expectedValidator := range expectedValidators { providerKeeper.SetConsumerValidator(ctx, "chainID", - types.ConsumerValidator{ - ProviderConsAddr: expectedValidator.ProviderConsAddr, - Power: expectedValidator.Power, - ConsumerPublicKey: expectedValidator.ConsumerPublicKey, + types.ConsensusValidator{ + ProviderConsAddr: expectedValidator.ProviderConsAddr, + Power: expectedValidator.Power, + PublicKey: expectedValidator.PublicKey, }) } actualValidators := providerKeeper.GetConsumerValSet(ctx, "chainID") // sort validators first to be able to compare - sortValidators := func(validators []types.ConsumerValidator) { + sortValidators := func(validators []types.ConsensusValidator) { sort.Slice(validators, func(i, j int) bool { return bytes.Compare(validators[i].ProviderConsAddr, validators[j].ProviderConsAddr) < 0 }) @@ -99,13 +99,13 @@ func TestGetConsumerValSet(t *testing.T) { // createConsumerValidator is a helper function to create a consumer validator with the given `power`. It uses `index` as // the `ProviderConsAddr` of the validator, and the `seed` to generate the consumer public key. Returns the validator // and its consumer public key. -func createConsumerValidator(index int, power int64, seed int) (types.ConsumerValidator, crypto.PublicKey) { +func createConsumerValidator(index int, power int64, seed int) (types.ConsensusValidator, crypto.PublicKey) { publicKey := cryptotestutil.NewCryptoIdentityFromIntSeed(seed).TMProtoCryptoPublicKey() - return types.ConsumerValidator{ - ProviderConsAddr: []byte{byte(index)}, - Power: power, - ConsumerPublicKey: &publicKey, + return types.ConsensusValidator{ + ProviderConsAddr: []byte{byte(index)}, + Power: power, + PublicKey: &publicKey, }, publicKey } @@ -173,8 +173,8 @@ func TestDiff(t *testing.T) { nextF, nextPublicKeyF := createConsumerValidator(6, 1, 8) expectedUpdates = append(expectedUpdates, abci.ValidatorUpdate{PubKey: nextPublicKeyF, Power: 1}) - currentValidators := []types.ConsumerValidator{currentA, currentB, currentC, currentD, currentE} - nextValidators := []types.ConsumerValidator{nextB, nextC, nextD, nextE, nextF} + currentValidators := []types.ConsensusValidator{currentA, currentB, currentC, currentD, currentE} + nextValidators := []types.ConsensusValidator{nextB, nextC, nextD, nextE, nextF} actualUpdates := keeper.DiffValidators(currentValidators, nextValidators) @@ -194,12 +194,12 @@ func TestDiff(t *testing.T) { } func TestDiffEdgeCases(t *testing.T) { - require.Empty(t, len(keeper.DiffValidators([]types.ConsumerValidator{}, []types.ConsumerValidator{}))) + require.Empty(t, len(keeper.DiffValidators([]types.ConsensusValidator{}, []types.ConsensusValidator{}))) valA, publicKeyA := createConsumerValidator(1, 1, 1) valB, publicKeyB := createConsumerValidator(2, 2, 2) valC, publicKeyC := createConsumerValidator(3, 3, 3) - validators := []types.ConsumerValidator{valA, valB, valC} + validators := []types.ConsensusValidator{valA, valB, valC} // we do not expect any validator updates if the `currentValidators` are the same with the `nextValidators` require.Empty(t, len(keeper.DiffValidators(validators, validators))) @@ -210,7 +210,7 @@ func TestDiffEdgeCases(t *testing.T) { {PubKey: publicKeyB, Power: 2}, {PubKey: publicKeyC, Power: 3}, } - actualUpdates := keeper.DiffValidators([]types.ConsumerValidator{}, validators) + actualUpdates := keeper.DiffValidators([]types.ConsensusValidator{}, validators) // sort validators first to be able to compare sortUpdates := func(updates []abci.ValidatorUpdate) { sort.Slice(updates, func(i, j int) bool { @@ -231,7 +231,7 @@ func TestDiffEdgeCases(t *testing.T) { {PubKey: publicKeyB, Power: 0}, {PubKey: publicKeyC, Power: 0}, } - actualUpdates = keeper.DiffValidators(validators, []types.ConsumerValidator{}) + actualUpdates = keeper.DiffValidators(validators, []types.ConsensusValidator{}) sortUpdates(expectedUpdates) sortUpdates(actualUpdates) require.Equal(t, expectedUpdates, actualUpdates) @@ -254,11 +254,11 @@ func TestSetConsumerValSet(t *testing.T) { chainID := "chainID" - currentValidators := []types.ConsumerValidator{ + currentValidators := []types.ConsensusValidator{ { ProviderConsAddr: []byte("currentProviderConsAddr1"), Power: 2, - ConsumerPublicKey: &crypto.PublicKey{ + PublicKey: &crypto.PublicKey{ Sum: &crypto.PublicKey_Ed25519{ Ed25519: []byte{2}, }, @@ -267,7 +267,7 @@ func TestSetConsumerValSet(t *testing.T) { { ProviderConsAddr: []byte("currentProviderConsAddr2"), Power: 3, - ConsumerPublicKey: &crypto.PublicKey{ + PublicKey: &crypto.PublicKey{ Sum: &crypto.PublicKey_Ed25519{ Ed25519: []byte{3}, }, @@ -276,7 +276,7 @@ func TestSetConsumerValSet(t *testing.T) { { ProviderConsAddr: []byte("currentProviderConsAddr3"), Power: 4, - ConsumerPublicKey: &crypto.PublicKey{ + PublicKey: &crypto.PublicKey{ Sum: &crypto.PublicKey_Ed25519{ Ed25519: []byte{4}, }, @@ -284,11 +284,11 @@ func TestSetConsumerValSet(t *testing.T) { }, } - nextValidators := []types.ConsumerValidator{ + nextValidators := []types.ConsensusValidator{ { ProviderConsAddr: []byte("nextProviderConsAddr1"), Power: 2, - ConsumerPublicKey: &crypto.PublicKey{ + PublicKey: &crypto.PublicKey{ Sum: &crypto.PublicKey_Ed25519{ Ed25519: []byte{2}, }, @@ -297,7 +297,7 @@ func TestSetConsumerValSet(t *testing.T) { { ProviderConsAddr: []byte("nextProviderConsAddr2"), Power: 3, - ConsumerPublicKey: &crypto.PublicKey{ + PublicKey: &crypto.PublicKey{ Sum: &crypto.PublicKey_Ed25519{ Ed25519: []byte{3}, }, @@ -316,7 +316,7 @@ func TestSetConsumerValSet(t *testing.T) { nextCurrentValidators := providerKeeper.GetConsumerValSet(ctx, chainID) // sort validators first to be able to compare - sortValidators := func(validators []types.ConsumerValidator) { + sortValidators := func(validators []types.ConsensusValidator) { sort.Slice(validators, func(i, j int) bool { return bytes.Compare(validators[i].ProviderConsAddr, validators[j].ProviderConsAddr) < 0 }) @@ -337,29 +337,29 @@ func TestFilterValidatorsConsiderAll(t *testing.T) { considerAll := func(providerAddr types.ProviderConsAddress) bool { return true } require.Empty(t, providerKeeper.FilterValidators(ctx, chainID, []stakingtypes.Validator{}, considerAll)) - var expectedValidators []types.ConsumerValidator + var expectedValidators []types.ConsensusValidator // create a staking validator A that has not set a consumer public key valA := createStakingValidator(ctx, mocks, 1, 1, 1) - // because validator A has no consumer key set, the `ConsumerPublicKey` we expect is the key on the provider chain + // 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() - expectedValidators = append(expectedValidators, types.ConsumerValidator{ - ProviderConsAddr: types.NewProviderConsAddress(valAConsAddr).Address.Bytes(), - Power: 1, - ConsumerPublicKey: &valAPublicKey, + expectedValidators = append(expectedValidators, types.ConsensusValidator{ + ProviderConsAddr: types.NewProviderConsAddress(valAConsAddr).Address.Bytes(), + Power: 1, + PublicKey: &valAPublicKey, }) // create a staking validator B that has set a consumer public key valB := createStakingValidator(ctx, mocks, 2, 2, 2) - // validator B has set a consumer key, the `ConsumerPublicKey` we expect is the key set by `SetValidatorConsumerPubKey` + // 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) - expectedValidators = append(expectedValidators, types.ConsumerValidator{ - ProviderConsAddr: types.NewProviderConsAddress(valBConsAddr).Address.Bytes(), - Power: 2, - ConsumerPublicKey: &valBConsumerKey, + expectedValidators = append(expectedValidators, types.ConsensusValidator{ + ProviderConsAddr: types.NewProviderConsAddress(valBConsAddr).Address.Bytes(), + Power: 2, + PublicKey: &valBConsumerKey, }) bondedValidators := []stakingtypes.Validator{valA, valB} @@ -379,30 +379,30 @@ func TestFilterValidatorsConsiderOnlyOptIn(t *testing.T) { return providerKeeper.IsOptedIn(ctx, chainID, providerAddr) })) - var expectedValidators []types.ConsumerValidator + var expectedValidators []types.ConsensusValidator // create a staking validator A that has not set a consumer public key valA := createStakingValidator(ctx, mocks, 1, 1, 1) - // because validator A has no consumer key set, the `ConsumerPublicKey` we expect is the key on the provider chain + // 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() - expectedValAConsumerValidator := types.ConsumerValidator{ - ProviderConsAddr: types.NewProviderConsAddress(valAConsAddr).Address.Bytes(), - Power: 1, - ConsumerPublicKey: &valAPublicKey, + expectedValAConsumerValidator := types.ConsensusValidator{ + ProviderConsAddr: types.NewProviderConsAddress(valAConsAddr).Address.Bytes(), + Power: 1, + PublicKey: &valAPublicKey, } expectedValidators = append(expectedValidators, expectedValAConsumerValidator) // create a staking validator B that has set a consumer public key valB := createStakingValidator(ctx, mocks, 2, 2, 2) - // validator B has set a consumer key, the `ConsumerPublicKey` we expect is the key set by `SetValidatorConsumerPubKey` + // 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) - expectedValBConsumerValidator := types.ConsumerValidator{ - ProviderConsAddr: types.NewProviderConsAddress(valBConsAddr).Address.Bytes(), - Power: 2, - ConsumerPublicKey: &valBConsumerKey, + expectedValBConsumerValidator := types.ConsensusValidator{ + ProviderConsAddr: types.NewProviderConsAddress(valBConsAddr).Address.Bytes(), + Power: 2, + PublicKey: &valBConsumerKey, } expectedValidators = append(expectedValidators, expectedValBConsumerValidator) @@ -418,7 +418,7 @@ func TestFilterValidatorsConsiderOnlyOptIn(t *testing.T) { }) // sort validators first to be able to compare - sortValidators := func(validators []types.ConsumerValidator) { + sortValidators := func(validators []types.ConsensusValidator) { sort.Slice(validators, func(i, j int) bool { return bytes.Compare(validators[i].ProviderConsAddr, validators[j].ProviderConsAddr) < 0 }) @@ -454,10 +454,10 @@ func TestCreateConsumerValidator(t *testing.T) { valAProviderConsAddr := types.NewProviderConsAddress(valAConsAddr) providerKeeper.SetValidatorConsumerPubKey(ctx, chainID, valAProviderConsAddr, valAConsumerKey) actualConsumerValidatorA, err := providerKeeper.CreateConsumerValidator(ctx, chainID, valA) - expectedConsumerValidatorA := types.ConsumerValidator{ - ProviderConsAddr: valAProviderConsAddr.ToSdkConsAddr(), - Power: 1, - ConsumerPublicKey: &valAConsumerKey, + expectedConsumerValidatorA := types.ConsensusValidator{ + ProviderConsAddr: valAProviderConsAddr.ToSdkConsAddr(), + Power: 1, + PublicKey: &valAConsumerKey, } require.Equal(t, expectedConsumerValidatorA, actualConsumerValidatorA) require.NoError(t, err) @@ -468,10 +468,10 @@ func TestCreateConsumerValidator(t *testing.T) { valBProviderConsAddr := types.NewProviderConsAddress(valBConsAddr) valBPublicKey, _ := valB.TmConsPublicKey() actualConsumerValidatorB, err := providerKeeper.CreateConsumerValidator(ctx, chainID, valB) - expectedConsumerValidatorB := types.ConsumerValidator{ - ProviderConsAddr: valBProviderConsAddr.ToSdkConsAddr(), - Power: 2, - ConsumerPublicKey: &valBPublicKey, + expectedConsumerValidatorB := types.ConsensusValidator{ + ProviderConsAddr: valBProviderConsAddr.ToSdkConsAddr(), + Power: 2, + PublicKey: &valBPublicKey, } require.Equal(t, expectedConsumerValidatorB, actualConsumerValidatorB) require.NoError(t, err) diff --git a/x/ccv/provider/migrations/migrator.go b/x/ccv/provider/migrations/migrator.go index b0812549d1..17ce676e0f 100644 --- a/x/ccv/provider/migrations/migrator.go +++ b/x/ccv/provider/migrations/migrator.go @@ -2,6 +2,7 @@ package migrations import ( storetypes "cosmossdk.io/store/types" + "github.com/cosmos/cosmos-sdk/codec" sdktypes "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" diff --git a/x/ccv/provider/migrations/v6/legacy_params.go b/x/ccv/provider/migrations/v6/legacy_params.go index b1e0d0ed05..1447f79752 100644 --- a/x/ccv/provider/migrations/v6/legacy_params.go +++ b/x/ccv/provider/migrations/v6/legacy_params.go @@ -3,10 +3,11 @@ package v6 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/v5/x/ccv/provider/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" ) diff --git a/x/ccv/provider/migrations/v6/migrations.go b/x/ccv/provider/migrations/v6/migrations.go index 87977870c4..af93f9cae2 100644 --- a/x/ccv/provider/migrations/v6/migrations.go +++ b/x/ccv/provider/migrations/v6/migrations.go @@ -2,6 +2,7 @@ package v6 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" ) diff --git a/x/ccv/provider/module.go b/x/ccv/provider/module.go index a1da7e71e9..84388eb831 100644 --- a/x/ccv/provider/module.go +++ b/x/ccv/provider/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" @@ -17,6 +18,8 @@ import ( simtypes "github.com/cosmos/cosmos-sdk/types/simulation" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + 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" @@ -27,14 +30,14 @@ var ( _ module.AppModule = (*AppModule)(nil) _ module.AppModuleBasic = (*AppModuleBasic)(nil) _ module.AppModuleSimulation = (*AppModule)(nil) - _ module.HasGenesis = (*AppModule)(nil) _ module.HasName = (*AppModule)(nil) _ module.HasConsensusVersion = (*AppModule)(nil) _ module.HasInvariants = (*AppModule)(nil) _ module.HasServices = (*AppModule)(nil) + _ module.HasABCIGenesis = (*AppModule)(nil) + _ module.HasABCIEndBlock = (*AppModule)(nil) _ appmodule.AppModule = (*AppModule)(nil) _ appmodule.HasBeginBlocker = (*AppModule)(nil) - _ appmodule.HasEndBlocker = (*AppModule)(nil) ) // AppModuleBasic is the IBC Provider AppModuleBasic @@ -139,11 +142,11 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { // InitGenesis performs genesis initialization for the provider module. It returns no validator updates. // Note: This method along with ValidateGenesis satisfies the CCV spec: // https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/methods.md#ccv-pcf-initg1 -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) { +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { var genesisState providertypes.GenesisState cdc.MustUnmarshalJSON(data, &genesisState) - am.keeper.InitGenesis(ctx, &genesisState) + return am.keeper.InitGenesis(ctx, &genesisState) } // ExportGenesis returns the exported genesis state as raw bytes for the provider @@ -172,7 +175,7 @@ func (am AppModule) BeginBlock(ctx context.Context) error { } // EndBlock implements the AppModule interface -func (am AppModule) EndBlock(ctx context.Context) error { +func (am AppModule) EndBlock(ctx context.Context) ([]abci.ValidatorUpdate, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) // EndBlock logic needed for the Consumer Initiated Slashing sub-protocol. diff --git a/x/ccv/provider/module_test.go b/x/ccv/provider/module_test.go index b37c34d1da..5e8584f15b 100644 --- a/x/ccv/provider/module_test.go +++ b/x/ccv/provider/module_test.go @@ -3,14 +3,18 @@ package provider_test import ( "testing" - "cosmossdk.io/math" + 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" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "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" @@ -110,6 +114,7 @@ func TestInitGenesis(t *testing.T) { nil, nil, nil, + nil, ) cdc := keeperParams.Cdc @@ -141,9 +146,19 @@ func TestInitGenesis(t *testing.T) { // Last total power is queried in InitGenesis, only if method has not // already panicked from unowned capability. if !tc.expPanic { + // create a mock validator + cId := crypto.NewCryptoIdentityFromIntSeed(234234) + validator := cId.SDKStakingValidator() + valAddr, err := sdk.ValAddressFromBech32(validator.GetOperator()) + require.NoError(t, err) + orderedCalls = append(orderedCalls, mocks.MockStakingKeeper.EXPECT().GetLastTotalPower( ctx).Return(math.NewInt(100), nil).Times(1), // Return total voting power as 100 + mocks.MockStakingKeeper.EXPECT().GetBondedValidatorsByPower( + ctx).Return([]stakingtypes.Validator{validator}, nil).Times(1), // Return a single validator + mocks.MockStakingKeeper.EXPECT().GetLastValidatorPower( + ctx, valAddr).Return(int64(100), nil).Times(1), // Return total power as power of the single validator ) } diff --git a/x/ccv/provider/proposal_handler_test.go b/x/ccv/provider/proposal_handler_test.go index 2494da8c60..512e6ac08d 100644 --- a/x/ccv/provider/proposal_handler_test.go +++ b/x/ccv/provider/proposal_handler_test.go @@ -4,12 +4,13 @@ import ( "testing" "time" - "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" + "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" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" diff --git a/x/ccv/provider/types/codec.go b/x/ccv/provider/types/codec.go index 1d75778bb1..a3593fb22f 100644 --- a/x/ccv/provider/types/codec.go +++ b/x/ccv/provider/types/codec.go @@ -1,13 +1,14 @@ package types import ( + "github.com/cosmos/ibc-go/v8/modules/core/exported" + tendermint "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" + "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - "github.com/cosmos/ibc-go/v8/modules/core/exported" - tendermint "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" ) func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { diff --git a/x/ccv/provider/types/genesis.go b/x/ccv/provider/types/genesis.go index 7ef643970b..345bd20537 100644 --- a/x/ccv/provider/types/genesis.go +++ b/x/ccv/provider/types/genesis.go @@ -26,21 +26,23 @@ func NewGenesisState( consumerAddrsToPrune []ConsumerAddrsToPrune, initTimeoutTimestamps []InitTimeoutTimestamp, exportedVscSendTimestamps []ExportedVscSendTimestamp, + lastProviderConsensusValidators []ConsensusValidator, ) *GenesisState { return &GenesisState{ - ValsetUpdateId: vscID, - ValsetUpdateIdToHeight: vscIdToHeights, - ConsumerStates: consumerStates, - UnbondingOps: unbondingOps, - MatureUnbondingOps: matureUbdOps, - ConsumerAdditionProposals: additionProposals, - ConsumerRemovalProposals: removalProposals, - Params: params, - ValidatorConsumerPubkeys: validatorConsumerPubkeys, - ValidatorsByConsumerAddr: validatorsByConsumerAddr, - ConsumerAddrsToPrune: consumerAddrsToPrune, - InitTimeoutTimestamps: initTimeoutTimestamps, - ExportedVscSendTimestamps: exportedVscSendTimestamps, + ValsetUpdateId: vscID, + ValsetUpdateIdToHeight: vscIdToHeights, + ConsumerStates: consumerStates, + UnbondingOps: unbondingOps, + MatureUnbondingOps: matureUbdOps, + ConsumerAdditionProposals: additionProposals, + ConsumerRemovalProposals: removalProposals, + Params: params, + ValidatorConsumerPubkeys: validatorConsumerPubkeys, + ValidatorsByConsumerAddr: validatorsByConsumerAddr, + ConsumerAddrsToPrune: consumerAddrsToPrune, + InitTimeoutTimestamps: initTimeoutTimestamps, + ExportedVscSendTimestamps: exportedVscSendTimestamps, + LastProviderConsensusValidators: lastProviderConsensusValidators, } } diff --git a/x/ccv/provider/types/genesis.pb.go b/x/ccv/provider/types/genesis.pb.go index d885dbc667..78d2aec6fb 100644 --- a/x/ccv/provider/types/genesis.pb.go +++ b/x/ccv/provider/types/genesis.pb.go @@ -46,9 +46,10 @@ type GenesisState struct { // empty for a new chain ValidatorsByConsumerAddr []ValidatorByConsumerAddr `protobuf:"bytes,10,rep,name=validators_by_consumer_addr,json=validatorsByConsumerAddr,proto3" json:"validators_by_consumer_addr"` // empty for a new chain - ConsumerAddrsToPrune []ConsumerAddrsToPrune `protobuf:"bytes,11,rep,name=consumer_addrs_to_prune,json=consumerAddrsToPrune,proto3" json:"consumer_addrs_to_prune"` - InitTimeoutTimestamps []InitTimeoutTimestamp `protobuf:"bytes,12,rep,name=init_timeout_timestamps,json=initTimeoutTimestamps,proto3" json:"init_timeout_timestamps"` - ExportedVscSendTimestamps []ExportedVscSendTimestamp `protobuf:"bytes,13,rep,name=exported_vsc_send_timestamps,json=exportedVscSendTimestamps,proto3" json:"exported_vsc_send_timestamps"` + ConsumerAddrsToPrune []ConsumerAddrsToPrune `protobuf:"bytes,11,rep,name=consumer_addrs_to_prune,json=consumerAddrsToPrune,proto3" json:"consumer_addrs_to_prune"` + InitTimeoutTimestamps []InitTimeoutTimestamp `protobuf:"bytes,12,rep,name=init_timeout_timestamps,json=initTimeoutTimestamps,proto3" json:"init_timeout_timestamps"` + ExportedVscSendTimestamps []ExportedVscSendTimestamp `protobuf:"bytes,13,rep,name=exported_vsc_send_timestamps,json=exportedVscSendTimestamps,proto3" json:"exported_vsc_send_timestamps"` + LastProviderConsensusValidators []ConsensusValidator `protobuf:"bytes,14,rep,name=last_provider_consensus_validators,json=lastProviderConsensusValidators,proto3" json:"last_provider_consensus_validators"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -175,6 +176,13 @@ func (m *GenesisState) GetExportedVscSendTimestamps() []ExportedVscSendTimestamp return nil } +func (m *GenesisState) GetLastProviderConsensusValidators() []ConsensusValidator { + if m != nil { + return m.LastProviderConsensusValidators + } + return nil +} + // The provider CCV module's knowledge of consumer state. // // Note this type is only used internally to the provider CCV module. @@ -352,64 +360,67 @@ func init() { } var fileDescriptor_48411d9c7900d48e = []byte{ - // 908 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xdd, 0x6e, 0x1b, 0x45, - 0x14, 0xce, 0x26, 0x69, 0x1a, 0x4f, 0x7e, 0x08, 0x43, 0x70, 0x37, 0x09, 0xb8, 0x91, 0x51, 0xa5, - 0x48, 0x80, 0xdd, 0x04, 0x90, 0xca, 0x4f, 0x2f, 0x9a, 0x16, 0x81, 0x85, 0x10, 0x96, 0x93, 0x06, - 0xa9, 0x5c, 0x8c, 0xc6, 0x33, 0x23, 0x7b, 0x1a, 0x7b, 0x66, 0x35, 0x67, 0x76, 0x13, 0x0b, 0x21, - 0x15, 0xc1, 0x03, 0xf0, 0x58, 0xbd, 0xcc, 0x25, 0x57, 0x15, 0x4a, 0xde, 0x80, 0x27, 0x40, 0x3b, - 0x3b, 0xbb, 0x5d, 0x07, 0xa7, 0xb2, 0x7b, 0x95, 0x78, 0xbe, 0x39, 0xdf, 0xf7, 0x9d, 0x39, 0x33, - 0xe7, 0x2c, 0xda, 0x97, 0xca, 0x0a, 0xc3, 0xfa, 0x54, 0x2a, 0x02, 0x82, 0xc5, 0x46, 0xda, 0x51, - 0x93, 0xb1, 0xa4, 0x19, 0x19, 0x9d, 0x48, 0x2e, 0x4c, 0x33, 0xd9, 0x6f, 0xf6, 0x84, 0x12, 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 0xcd, 0x3d, 0x7b, 0xd8, 0x93, 0xb6, 0x1f, 0x77, 0x1b, - 0x4c, 0x0f, 0x9b, 0x4c, 0xc3, 0x50, 0x43, 0xf3, 0x75, 0x56, 0x9f, 0x16, 0x5f, 0x24, 0xc9, 0x17, - 0xcd, 0xf3, 0xf1, 0xcf, 0x12, 0x3b, 0x8a, 0x04, 0x74, 0x97, 0xdc, 0x17, 0xc9, 0x67, 0xff, 0x05, - 0x00, 0x00, 0xff, 0xff, 0xae, 0xb1, 0x22, 0x59, 0x8e, 0x09, 0x00, 0x00, + // 951 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0x5f, 0x6f, 0x1b, 0xc5, + 0x17, 0xcd, 0x26, 0x6e, 0x1a, 0x4f, 0xfe, 0xfc, 0xf2, 0x1b, 0x82, 0xbb, 0x49, 0xc0, 0x89, 0x8c, + 0x2a, 0x45, 0x02, 0xec, 0x26, 0x80, 0x28, 0x7f, 0xfa, 0xd0, 0xb4, 0x08, 0x2c, 0x84, 0xb0, 0x9c, + 0x34, 0x48, 0xe5, 0x61, 0x34, 0x9e, 0x1d, 0xd9, 0xd3, 0xac, 0x67, 0x56, 0x73, 0x67, 0x37, 0xb1, + 0x10, 0x52, 0x11, 0x3c, 0xf1, 0xc4, 0xc7, 0xea, 0x63, 0x1f, 0x79, 0xa1, 0x42, 0xc9, 0x37, 0xe0, + 0x13, 0xa0, 0x9d, 0x9d, 0xdd, 0xac, 0x53, 0xa7, 0xb2, 0x79, 0x4a, 0x3c, 0x67, 0xee, 0x39, 0xe7, + 0xce, 0x9d, 0xbd, 0x77, 0xd0, 0xbe, 0x90, 0x86, 0x6b, 0x36, 0xa0, 0x42, 0x12, 0xe0, 0x2c, 0xd6, + 0xc2, 0x8c, 0x5a, 0x8c, 0x25, 0xad, 0x48, 0xab, 0x44, 0x04, 0x5c, 0xb7, 0x92, 0xfd, 0x56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99, 0x9a, 0x1b, 0x2c, 0xd5, 0xee, 0x6d, 0xfb, 0xbb, 0x1d, 0xe0, 0x77, 0x11, 0x62, 0x03, + 0x2a, 0x25, 0x0f, 0x53, 0x70, 0xde, 0x82, 0x55, 0xb7, 0xd2, 0x0e, 0xf0, 0x36, 0xaa, 0xb2, 0x50, + 0x70, 0x69, 0x52, 0x74, 0xc1, 0xa2, 0x4b, 0xd9, 0x42, 0x3b, 0xc0, 0x77, 0xd1, 0x5a, 0x5a, 0x15, + 0x41, 0xc3, 0xbc, 0x77, 0x56, 0xec, 0xd4, 0x5a, 0x75, 0xab, 0xae, 0xdf, 0x51, 0xb4, 0x5e, 0x5c, + 0x4a, 0x37, 0xd1, 0xfd, 0x5b, 0xf6, 0x83, 0xbf, 0x79, 0x74, 0x94, 0x2e, 0x61, 0x79, 0x54, 0xba, + 0x23, 0x28, 0x86, 0xa0, 0xc3, 0xb0, 0x41, 0xb5, 0x88, 0x67, 0x43, 0xc3, 0x75, 0xf6, 0x34, 0x85, + 0x3e, 0xcf, 0x9b, 0xe9, 0xfd, 0x37, 0x09, 0x15, 0x47, 0x77, 0xc4, 0xcd, 0x23, 0x1b, 0xd6, 0xa1, + 0xec, 0x94, 0x9b, 0xc7, 0xd4, 0xd0, 0xfc, 0xd6, 0x3b, 0xf6, 0xac, 0xdf, 0x67, 0x9b, 0x00, 0x7f, + 0x80, 0x30, 0x84, 0x14, 0x06, 0x24, 0x50, 0x67, 0x32, 0xbd, 0x73, 0x84, 0xb2, 0x53, 0xdb, 0x39, + 0xab, 0xdd, 0x75, 0x8b, 0x3c, 0x76, 0xc0, 0x43, 0x76, 0x8a, 0x9f, 0xa1, 0xb7, 0xc6, 0x46, 0x1b, + 0x11, 0x32, 0xe0, 0xe7, 0xfe, 0x92, 0x35, 0xf8, 0xf1, 0x74, 0x6d, 0x01, 0x58, 0x79, 0x90, 0x39, + 0x73, 0xff, 0x2f, 0x0f, 0xd2, 0x76, 0x4a, 0xda, 0x78, 0x8a, 0x6a, 0x93, 0x47, 0xd3, 0x0c, 0x6f, + 0x8d, 0x1a, 0x5a, 0x74, 0x55, 0x9d, 0xb7, 0xb8, 0xfb, 0x75, 0xf8, 0xc3, 0x8b, 0x8b, 0xba, 0xf7, + 0xf2, 0xa2, 0xee, 0xfd, 0x7d, 0x51, 0xf7, 0xfe, 0xb8, 0xac, 0xcf, 0xbd, 0xbc, 0xac, 0xcf, 0xfd, + 0x79, 0x59, 0x9f, 0x7b, 0xfa, 0xa0, 0x2f, 0xcc, 0x20, 0xee, 0x35, 0x99, 0x1a, 0xb6, 0x98, 0x82, + 0xa1, 0x82, 0xd6, 0x55, 0x56, 0x1f, 0x16, 0xcf, 0xa3, 0xe4, 0x93, 0xd6, 0xf9, 0xf8, 0x1b, 0xc9, + 0x8c, 0x22, 0x0e, 0xbd, 0x45, 0xfb, 0x3c, 0xfa, 0xe8, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x54, + 0xf5, 0x38, 0x0c, 0x1b, 0x0a, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -432,6 +443,20 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.LastProviderConsensusValidators) > 0 { + for iNdEx := len(m.LastProviderConsensusValidators) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.LastProviderConsensusValidators[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x72 + } + } if len(m.ExportedVscSendTimestamps) > 0 { for iNdEx := len(m.ExportedVscSendTimestamps) - 1; iNdEx >= 0; iNdEx-- { { @@ -817,6 +842,12 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } + if len(m.LastProviderConsensusValidators) > 0 { + for _, e := range m.LastProviderConsensusValidators { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } return n } @@ -1342,6 +1373,40 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 14: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastProviderConsensusValidators", 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.LastProviderConsensusValidators = append(m.LastProviderConsensusValidators, ConsensusValidator{}) + if err := m.LastProviderConsensusValidators[len(m.LastProviderConsensusValidators)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex 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 f2177a3000..1e2af3c419 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" @@ -43,6 +44,7 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, + nil, ), true, }, @@ -67,6 +69,7 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, + nil, ), true, }, @@ -88,6 +91,7 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, + nil, ), true, }, @@ -109,6 +113,7 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, + nil, ), false, }, @@ -130,6 +135,7 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, + nil, ), false, }, @@ -151,6 +157,7 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, + nil, ), false, }, @@ -178,6 +185,7 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, + nil, ), false, }, @@ -205,6 +213,7 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, + nil, ), false, }, @@ -232,6 +241,7 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, + nil, ), false, }, @@ -259,6 +269,7 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, + nil, ), false, }, @@ -286,6 +297,7 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, + nil, ), false, }, @@ -313,6 +325,7 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, + nil, ), false, }, @@ -340,6 +353,7 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, + nil, ), false, }, @@ -359,6 +373,7 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, + nil, ), false, }, @@ -378,6 +393,7 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, + nil, ), false, }, @@ -397,6 +413,7 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, + nil, ), false, }, @@ -416,6 +433,7 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, + nil, ), false, }, @@ -438,6 +456,7 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, + nil, ), false, }, @@ -461,6 +480,7 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, + nil, ), false, }, @@ -484,6 +504,7 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, + nil, ), false, }, @@ -511,6 +532,7 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, + nil, ), false, }, @@ -538,6 +560,7 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, + nil, ), false, }, @@ -565,6 +588,7 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, + nil, ), false, }, @@ -601,6 +625,7 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, + nil, ), false, }, @@ -649,6 +674,7 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, + nil, ), false, }, @@ -671,6 +697,7 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, + nil, ), false, }, @@ -692,6 +719,7 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, + nil, ), false, }, @@ -713,6 +741,7 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, + nil, ), false, }, diff --git a/x/ccv/provider/types/legacy_proposal.go b/x/ccv/provider/types/legacy_proposal.go index 37c068e1c2..9e23fa3980 100644 --- a/x/ccv/provider/types/legacy_proposal.go +++ b/x/ccv/provider/types/legacy_proposal.go @@ -10,8 +10,8 @@ import ( 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" @@ -97,7 +97,7 @@ func (cccp *ConsumerAdditionProposal) ProposalType() string { } // ValidatePSSFeatures returns an error if the `topN` and `validatorsPowerCap` parameters are no in the correct ranges -func ValidatePSSFeatures(topN uint32, validatorsPowerCap uint32) error { +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) { diff --git a/x/ccv/provider/types/msg.go b/x/ccv/provider/types/msg.go index 058ee1d2e5..98d17f7474 100644 --- a/x/ccv/provider/types/msg.go +++ b/x/ccv/provider/types/msg.go @@ -295,7 +295,6 @@ func (msg *MsgConsumerAddition) ValidateBasic() error { } func (msg *MsgConsumerRemoval) ValidateBasic() error { - if strings.TrimSpace(msg.ChainId) == "" { return errorsmod.Wrap(ErrInvalidConsumerRemovalProp, "consumer chain id must not be blank") } diff --git a/x/ccv/provider/types/params.go b/x/ccv/provider/types/params.go index 5ca0c4e44d..980f79ce20 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" @@ -178,6 +179,7 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { paramtypes.NewParamSetPair(KeySlashMeterReplenishFraction, p.SlashMeterReplenishFraction, ccvtypes.ValidateStringFraction), paramtypes.NewParamSetPair(KeyConsumerRewardDenomRegistrationFee, p.ConsumerRewardDenomRegistrationFee, ValidateCoin), paramtypes.NewParamSetPair(KeyBlocksPerEpoch, p.BlocksPerEpoch, ccvtypes.ValidatePositiveInt64), + paramtypes.NewParamSetPair(KeyMaxProviderConsensusValidators, p.MaxProviderConsensusValidators, ccvtypes.ValidatePositiveInt64), } } diff --git a/x/ccv/provider/types/params_test.go b/x/ccv/provider/types/params_test.go index e4996557c5..76feddec6d 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/v5/x/ccv/provider/types" diff --git a/x/ccv/provider/types/provider.pb.go b/x/ccv/provider/types/provider.pb.go index c6be692b69..1ffe374d43 100644 --- a/x/ccv/provider/types/provider.pb.go +++ b/x/ccv/provider/types/provider.pb.go @@ -1548,29 +1548,32 @@ func (m *ConsumerAddrsToPrune) GetConsumerAddrs() *AddressList { return nil } -// ConsumerValidator is used to facilitate epoch-based transitions. It contains relevant info for -// a validator that is expected to validate on a consumer chain during an epoch. -type ConsumerValidator struct { +// ConsensusValidator is used to express a validator that +// should be validating on a chain. +// It contains relevant info for +// a validator that is expected to validate on +// either the provider or a consumer chain. +type ConsensusValidator struct { // validator's consensus address on the provider chain ProviderConsAddr []byte `protobuf:"bytes,1,opt,name=provider_cons_addr,json=providerConsAddr,proto3" json:"provider_cons_addr,omitempty"` // voting power the validator has during this epoch Power int64 `protobuf:"varint,2,opt,name=power,proto3" json:"power,omitempty"` - // public key the validator uses on the consumer chain during this epoch - ConsumerPublicKey *crypto.PublicKey `protobuf:"bytes,3,opt,name=consumer_public_key,json=consumerPublicKey,proto3" json:"consumer_public_key,omitempty"` + // public key the validator uses on the chain it is validating on + PublicKey *crypto.PublicKey `protobuf:"bytes,3,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` } -func (m *ConsumerValidator) Reset() { *m = ConsumerValidator{} } -func (m *ConsumerValidator) String() string { return proto.CompactTextString(m) } -func (*ConsumerValidator) ProtoMessage() {} -func (*ConsumerValidator) Descriptor() ([]byte, []int) { +func (m *ConsensusValidator) Reset() { *m = ConsensusValidator{} } +func (m *ConsensusValidator) String() string { return proto.CompactTextString(m) } +func (*ConsensusValidator) ProtoMessage() {} +func (*ConsensusValidator) Descriptor() ([]byte, []int) { return fileDescriptor_f22ec409a72b7b72, []int{23} } -func (m *ConsumerValidator) XXX_Unmarshal(b []byte) error { +func (m *ConsensusValidator) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ConsumerValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ConsensusValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ConsumerValidator.Marshal(b, m, deterministic) + return xxx_messageInfo_ConsensusValidator.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1580,35 +1583,35 @@ func (m *ConsumerValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return b[:n], nil } } -func (m *ConsumerValidator) XXX_Merge(src proto.Message) { - xxx_messageInfo_ConsumerValidator.Merge(m, src) +func (m *ConsensusValidator) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConsensusValidator.Merge(m, src) } -func (m *ConsumerValidator) XXX_Size() int { +func (m *ConsensusValidator) XXX_Size() int { return m.Size() } -func (m *ConsumerValidator) XXX_DiscardUnknown() { - xxx_messageInfo_ConsumerValidator.DiscardUnknown(m) +func (m *ConsensusValidator) XXX_DiscardUnknown() { + xxx_messageInfo_ConsensusValidator.DiscardUnknown(m) } -var xxx_messageInfo_ConsumerValidator proto.InternalMessageInfo +var xxx_messageInfo_ConsensusValidator proto.InternalMessageInfo -func (m *ConsumerValidator) GetProviderConsAddr() []byte { +func (m *ConsensusValidator) GetProviderConsAddr() []byte { if m != nil { return m.ProviderConsAddr } return nil } -func (m *ConsumerValidator) GetPower() int64 { +func (m *ConsensusValidator) GetPower() int64 { if m != nil { return m.Power } return 0 } -func (m *ConsumerValidator) GetConsumerPublicKey() *crypto.PublicKey { +func (m *ConsensusValidator) GetPublicKey() *crypto.PublicKey { if m != nil { - return m.ConsumerPublicKey + return m.PublicKey } return nil } @@ -1684,7 +1687,7 @@ func init() { proto.RegisterType((*ValidatorConsumerPubKey)(nil), "interchain_security.ccv.provider.v1.ValidatorConsumerPubKey") proto.RegisterType((*ValidatorByConsumerAddr)(nil), "interchain_security.ccv.provider.v1.ValidatorByConsumerAddr") proto.RegisterType((*ConsumerAddrsToPrune)(nil), "interchain_security.ccv.provider.v1.ConsumerAddrsToPrune") - proto.RegisterType((*ConsumerValidator)(nil), "interchain_security.ccv.provider.v1.ConsumerValidator") + proto.RegisterType((*ConsensusValidator)(nil), "interchain_security.ccv.provider.v1.ConsensusValidator") proto.RegisterType((*ConsumerRewardsAllocation)(nil), "interchain_security.ccv.provider.v1.ConsumerRewardsAllocation") } @@ -1693,134 +1696,134 @@ func init() { } var fileDescriptor_f22ec409a72b7b72 = []byte{ - // 2023 bytes of a gzipped FileDescriptorProto + // 2019 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcd, 0x6f, 0x1b, 0xc7, 0x15, 0xd7, 0x92, 0x94, 0x44, 0x0e, 0xf5, 0x39, 0x52, 0xe2, 0x95, 0xaa, 0x52, 0xf4, 0xa6, 0x71, - 0xd5, 0xb8, 0x26, 0x23, 0x05, 0x01, 0x0c, 0xa1, 0x41, 0x20, 0x51, 0x4e, 0x2c, 0x2b, 0xb6, 0x99, + 0xd5, 0xb8, 0x26, 0x23, 0x05, 0x01, 0x0c, 0xb5, 0x41, 0x20, 0x51, 0x4e, 0x2c, 0xab, 0xb6, 0x99, 0x95, 0x2a, 0xa3, 0xed, 0x61, 0x31, 0x9c, 0x1d, 0x93, 0x03, 0x2d, 0x77, 0xd6, 0x33, 0xc3, 0x95, - 0x79, 0xe9, 0xb9, 0x97, 0x02, 0xe9, 0x2d, 0xe8, 0xa1, 0x4d, 0x0b, 0x14, 0x28, 0x72, 0x28, 0x7a, - 0xe8, 0x5f, 0xd0, 0x53, 0xd0, 0x4b, 0x73, 0xec, 0x29, 0x29, 0xec, 0x43, 0x0f, 0xfd, 0x27, 0x8a, - 0x99, 0xfd, 0x24, 0x25, 0xd9, 0x34, 0x52, 0x5f, 0xa4, 0xdd, 0x37, 0xef, 0xfd, 0xde, 0x9b, 0xf7, - 0xbd, 0x04, 0x3b, 0xd4, 0x97, 0x84, 0xe3, 0x1e, 0xa2, 0xbe, 0x23, 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 0xf5, 0x65, 0x19, 0x98, 0x2d, 0xe6, 0x8b, 0x41, 0x9f, 0xf0, 0x3d, 0xd7, 0xa5, 0xca, - 0x01, 0x6d, 0xce, 0x02, 0x26, 0x90, 0x07, 0x57, 0xc1, 0xb4, 0xa4, 0xd2, 0x23, 0xa6, 0x51, 0x37, - 0xb6, 0x2a, 0x76, 0xf4, 0x02, 0xeb, 0xa0, 0xea, 0x12, 0x81, 0x39, 0x0d, 0x14, 0xb3, 0x59, 0xd0, - 0x67, 0x79, 0x12, 0x5c, 0x03, 0xe5, 0x28, 0x6a, 0xd4, 0x35, 0x8b, 0xfa, 0x78, 0x56, 0xbf, 0x1f, - 0xba, 0xf0, 0x63, 0xb0, 0x40, 0x7d, 0x2a, 0x29, 0xf2, 0x9c, 0x1e, 0x51, 0xbe, 0x33, 0x4b, 0x75, - 0x63, 0xab, 0xba, 0xb3, 0xde, 0xa0, 0x1d, 0xdc, 0x50, 0xee, 0x6e, 0xc4, 0x4e, 0x0e, 0xb7, 0x1b, - 0x77, 0x35, 0xc7, 0x7e, 0xe9, 0xab, 0x6f, 0x36, 0xa7, 0xec, 0xf9, 0x58, 0x2e, 0x22, 0xc2, 0xeb, - 0x60, 0xae, 0x4b, 0x7c, 0x22, 0xa8, 0x70, 0x7a, 0x48, 0xf4, 0xcc, 0xe9, 0xba, 0xb1, 0x35, 0x67, - 0x57, 0x63, 0xda, 0x5d, 0x24, 0x7a, 0x70, 0x13, 0x54, 0x3b, 0xd4, 0x47, 0x7c, 0x18, 0x71, 0xcc, - 0x68, 0x0e, 0x10, 0x91, 0x34, 0x43, 0x0b, 0x00, 0x11, 0xa0, 0x73, 0xdf, 0x51, 0xb9, 0x61, 0xce, - 0xc6, 0x86, 0x44, 0x79, 0xd1, 0x48, 0xf2, 0xa2, 0x71, 0x92, 0x24, 0xce, 0x7e, 0x59, 0x19, 0xf2, - 0xd9, 0xb7, 0x9b, 0x86, 0x5d, 0xd1, 0x72, 0xea, 0x04, 0x3e, 0x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 0x27, 0x6a, 0x8a, 0x5d, 0x70, 0xcb, - 0x5c, 0xde, 0x2d, 0xf7, 0xc0, 0x42, 0xbc, 0x9a, 0x9d, 0x30, 0xdd, 0xdb, 0xe0, 0xf7, 0x01, 0x88, - 0x77, 0x3a, 0xd5, 0x13, 0xa3, 0xe9, 0x50, 0x89, 0x29, 0x87, 0xee, 0xc8, 0x00, 0x2f, 0x8c, 0x0c, - 0x70, 0xcb, 0x06, 0x8b, 0xa7, 0x02, 0xff, 0x34, 0xd9, 0xdb, 0x1f, 0x06, 0x02, 0xbe, 0x01, 0x66, - 0x54, 0x39, 0xc6, 0x40, 0x25, 0x7b, 0x3a, 0x14, 0xf8, 0x50, 0x0f, 0x88, 0xec, 0xdb, 0x80, 0x05, - 0x0e, 0x75, 0x85, 0x59, 0xa8, 0x17, 0xb7, 0x4a, 0xf6, 0xc2, 0x20, 0x13, 0x3f, 0x74, 0x85, 0xf5, - 0x33, 0x50, 0xcd, 0x01, 0xc2, 0x05, 0x50, 0x48, 0xb1, 0x0a, 0xd4, 0x85, 0xbb, 0x60, 0x2d, 0x03, - 0x1a, 0xed, 0xe8, 0x11, 0x62, 0xc5, 0xbe, 0x96, 0x32, 0x8c, 0x34, 0x75, 0x61, 0x3d, 0x04, 0xab, - 0x87, 0x59, 0xff, 0x48, 0xe7, 0xc5, 0xc8, 0x0d, 0x8d, 0xd1, 0x15, 0x65, 0x03, 0x54, 0xd2, 0xcf, - 0x65, 0x7d, 0xfb, 0x92, 0x9d, 0x11, 0xac, 0x3e, 0x58, 0x3a, 0x15, 0xf8, 0x98, 0xf8, 0x6e, 0x06, - 0x76, 0x85, 0x03, 0xf6, 0xc7, 0x81, 0x26, 0xfe, 0xc0, 0xca, 0xd4, 0x31, 0xb0, 0x76, 0x9a, 0xdf, - 0x67, 0xf4, 0xac, 0x6f, 0x23, 0x7c, 0x46, 0xa4, 0x80, 0x36, 0x28, 0xe9, 0xbd, 0x25, 0xca, 0xac, - 0xdb, 0x57, 0x66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13, + 0xb0, 0x28, 0x49, 0x3f, 0xf0, 0x90, 0x24, 0x4e, 0x34, 0xf8, 0xe3, 0x9b, 0xde, 0xd4, 0x0b, 0x41, + 0x7e, 0xbd, 0x6a, 0xe4, 0x16, 0xaa, 0x70, 0xbb, 0xd1, 0xd2, 0xd4, 0x63, 0x89, 0x24, 0xb1, 0x17, + 0x12, 0x8c, 0x88, 0x08, 0x6f, 0x03, 0x53, 0xf2, 0x81, 0x90, 0xd9, 0x48, 0xce, 0x66, 0x51, 0x14, + 0xeb, 0x37, 0x93, 0xf3, 0x68, 0x8a, 0xa5, 0x33, 0xe8, 0xf2, 0xe9, 0x5b, 0xfc, 0x36, 0xd3, 0xf7, + 0x18, 0xac, 0xa8, 0xd5, 0x65, 0x1c, 0xb3, 0x34, 0x39, 0xe6, 0xb2, 0x92, 0x1f, 0x05, 0xfd, 0x04, + 0xc0, 0x50, 0xe0, 0x71, 0xcc, 0xe9, 0x57, 0xb0, 0x33, 0x14, 0x78, 0x14, 0xd2, 0x05, 0x1b, 0x42, + 0x25, 0x9f, 0xd3, 0x27, 0x52, 0xcf, 0xf2, 0xc0, 0x23, 0x3e, 0x15, 0xbd, 0x04, 0x7c, 0x66, 0x72, + 0xf0, 0x35, 0x0d, 0x74, 0x5f, 0xe1, 0xd8, 0x09, 0x4c, 0xac, 0xa5, 0x05, 0x6a, 0x97, 0x6b, 0x49, + 0x03, 0x34, 0xab, 0x03, 0xf4, 0x9d, 0x4b, 0x20, 0xd2, 0x28, 0x09, 0x70, 0x23, 0xb7, 0x73, 0xa8, + 0xaa, 0x77, 0x74, 0xc1, 0x39, 0x9c, 0x74, 0xd5, 0x60, 0x46, 0xd1, 0xfa, 0x41, 0x48, 0xba, 0x37, + 0xc5, 0xb5, 0xa7, 0x96, 0xe6, 0x5c, 0xf1, 0x51, 0x3f, 0x5e, 0x2e, 0xad, 0x6c, 0x35, 0x49, 0x7b, + 0x88, 0x9d, 0xc3, 0xfa, 0x88, 0x10, 0x55, 0x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8, 0x06, 0x98, + 0x51, 0xe5, 0x18, 0x03, 0x95, 0xec, 0xe9, 0x50, 0xe0, 0x43, 0x3d, 0x20, 0xb2, 0x6f, 0x03, 0x16, + 0x38, 0xd4, 0x15, 0x66, 0xa1, 0x5e, 0xdc, 0x2a, 0xd9, 0x0b, 0x83, 0x4c, 0xfc, 0xd0, 0x15, 0xd6, + 0xcf, 0x40, 0x35, 0x07, 0x08, 0x17, 0x40, 0x21, 0xc5, 0x2a, 0x50, 0x17, 0xee, 0x82, 0xb5, 0x0c, + 0x68, 0xb4, 0xa3, 0x47, 0x88, 0x15, 0xfb, 0x5a, 0xca, 0x30, 0xd2, 0xd4, 0x85, 0xf5, 0x10, 0xac, + 0x1e, 0x66, 0xfd, 0x23, 0x9d, 0x17, 0x23, 0x37, 0x34, 0x46, 0x57, 0x94, 0x0d, 0x50, 0x49, 0x3f, + 0x97, 0xf5, 0xed, 0x4b, 0x76, 0x46, 0xb0, 0xfa, 0x60, 0xe9, 0x54, 0xe0, 0x63, 0xe2, 0xbb, 0x19, + 0xd8, 0x15, 0x0e, 0xd8, 0x1f, 0x07, 0x9a, 0xf8, 0x03, 0x2b, 0x53, 0xc7, 0xc0, 0xda, 0x69, 0x7e, + 0x9f, 0xd1, 0xb3, 0xbe, 0x8d, 0xf0, 0x19, 0x91, 0x02, 0xda, 0xa0, 0xa4, 0xf7, 0x96, 0x28, 0xb3, + 0x6e, 0x5f, 0x99, 0x59, 0xe1, 0x76, 0xe3, 0x2a, 0x90, 0x03, 0x24, 0x51, 0xdc, 0x06, 0x34, 0x96, + 0xf5, 0x7d, 0xb0, 0x72, 0x1f, 0xc9, 0x01, 0x27, 0xee, 0x48, 0x8c, 0x97, 0x40, 0x51, 0xc5, 0xcf, + 0xd0, 0xf1, 0x53, 0x8f, 0xd6, 0x9f, 0x0c, 0x60, 0xde, 0x79, 0x1a, 0x30, 0x2e, 0x89, 0x7b, 0xc1, + 0x23, 0x2f, 0x70, 0xef, 0x19, 0x58, 0x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x33, 0xba, 0x7b, 0xbe, 0xf7, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb7, 0x66, 0x98, 0xf1, 0x7d, + 0x15, 0x00, 0x00, } func (m *ConsumerAdditionProposal) Marshal() (dAtA []byte, err error) { @@ -3012,7 +3015,7 @@ func (m *ConsumerAddrsToPrune) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *ConsumerValidator) Marshal() (dAtA []byte, err error) { +func (m *ConsensusValidator) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3022,19 +3025,19 @@ func (m *ConsumerValidator) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ConsumerValidator) MarshalTo(dAtA []byte) (int, error) { +func (m *ConsensusValidator) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ConsumerValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ConsensusValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.ConsumerPublicKey != nil { + if m.PublicKey != nil { { - size, err := m.ConsumerPublicKey.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.PublicKey.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -3633,7 +3636,7 @@ func (m *ConsumerAddrsToPrune) Size() (n int) { return n } -func (m *ConsumerValidator) Size() (n int) { +func (m *ConsensusValidator) Size() (n int) { if m == nil { return 0 } @@ -3646,8 +3649,8 @@ func (m *ConsumerValidator) Size() (n int) { if m.Power != 0 { n += 1 + sovProvider(uint64(m.Power)) } - if m.ConsumerPublicKey != nil { - l = m.ConsumerPublicKey.Size() + if m.PublicKey != nil { + l = m.PublicKey.Size() n += 1 + l + sovProvider(uint64(l)) } return n @@ -7368,7 +7371,7 @@ func (m *ConsumerAddrsToPrune) Unmarshal(dAtA []byte) error { } return nil } -func (m *ConsumerValidator) Unmarshal(dAtA []byte) error { +func (m *ConsensusValidator) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -7391,10 +7394,10 @@ func (m *ConsumerValidator) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ConsumerValidator: wiretype end group for non-group") + return fmt.Errorf("proto: ConsensusValidator: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ConsumerValidator: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ConsensusValidator: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -7452,7 +7455,7 @@ func (m *ConsumerValidator) Unmarshal(dAtA []byte) error { } case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConsumerPublicKey", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -7479,10 +7482,10 @@ func (m *ConsumerValidator) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.ConsumerPublicKey == nil { - m.ConsumerPublicKey = &crypto.PublicKey{} + if m.PublicKey == nil { + m.PublicKey = &crypto.PublicKey{} } - if err := m.ConsumerPublicKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.PublicKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/ccv/types/expected_keepers.go b/x/ccv/types/expected_keepers.go index 9b8a93e330..e57487df5f 100644 --- a/x/ccv/types/expected_keepers.go +++ b/x/ccv/types/expected_keepers.go @@ -4,6 +4,7 @@ import ( context "context" "time" + 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" conntypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" @@ -12,12 +13,11 @@ import ( "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/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" ) @@ -56,7 +56,7 @@ type StakingKeeper interface { GetUnbondingDelegationByUnbondingID(ctx context.Context, id uint64) (stakingtypes.UnbondingDelegation, error) GetRedelegationByUnbondingID(ctx context.Context, id uint64) (stakingtypes.Redelegation, error) GetValidatorByUnbondingID(ctx context.Context, id uint64) (stakingtypes.Validator, error) - GetBondedValidatorsByPower(ctx sdk.Context) (validators []stakingtypes.Validator) + GetBondedValidatorsByPower(ctx context.Context) ([]stakingtypes.Validator, error) } // SlashingKeeper defines the contract expected to perform ccv slashing diff --git a/x/ccv/types/params.go b/x/ccv/types/params.go index 72a95ae7dd..d16cbdc63e 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 fa2e28c81c..4492ef5bd8 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 cb174168e8..b1bd510196 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" @@ -139,7 +140,6 @@ func GetLastBondedValidatorsUtil(ctx sdk.Context, stakingKeeper StakingKeeper, l i++ return i >= int(maxVals) // stop iteration if true }) - if err != nil { return nil, err } From 23b4c4605a2470766e6b9a6f2f67df184a43977c Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Wed, 26 Jun 2024 14:25:28 +0200 Subject: [PATCH 10/32] Revert cosmetic change --- app/consumer/ante/disabled_modules_ante_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/app/consumer/ante/disabled_modules_ante_test.go b/app/consumer/ante/disabled_modules_ante_test.go index 8bb60791e8..187d8bc956 100644 --- a/app/consumer/ante/disabled_modules_ante_test.go +++ b/app/consumer/ante/disabled_modules_ante_test.go @@ -7,7 +7,6 @@ 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" From 8b57495a28f31c6659a6757cc3b3b6713eb46c50 Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Wed, 26 Jun 2024 14:27:26 +0200 Subject: [PATCH 11/32] Revert cosmetic changes --- app/consumer/abci.go | 4 ++-- app/consumer/app.go | 23 ++++++++++++----------- app/consumer/genesis.go | 1 - 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/consumer/abci.go b/app/consumer/abci.go index f0020562aa..94b34cc3bb 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/app.go b/app/consumer/app.go index 300d2ff35b..3bf468b22f 100644 --- a/app/consumer/app.go +++ b/app/consumer/app.go @@ -8,10 +8,12 @@ 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" + 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" + "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,11 +27,6 @@ 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" @@ -40,12 +37,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" @@ -55,7 +52,6 @@ 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" @@ -87,10 +83,15 @@ 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/v5/app/encoding" testutil "github.com/cosmos/interchain-security/v5/testutil/integration" diff --git a/app/consumer/genesis.go b/app/consumer/genesis.go index da55a0334e..466c9df753 100644 --- a/app/consumer/genesis.go +++ b/app/consumer/genesis.go @@ -15,7 +15,6 @@ 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" ) From b4ed21a49065bd1939a98067db56688c92ea89b4 Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Wed, 26 Jun 2024 14:28:42 +0200 Subject: [PATCH 12/32] Revert formatting --- x/ccv/provider/types/params.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/x/ccv/provider/types/params.go b/x/ccv/provider/types/params.go index 980f79ce20..16fb112bf7 100644 --- a/x/ccv/provider/types/params.go +++ b/x/ccv/provider/types/params.go @@ -4,12 +4,11 @@ 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" From bc69f20a673b66bf59d26bd80c523a255d6a22ea Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Wed, 26 Jun 2024 15:50:08 +0200 Subject: [PATCH 13/32] Add genutil replacer module --- app/provider/app.go | 6 +-- x/ccv/no_valupdates_genutil/doc.go | 8 ++++ x/ccv/no_valupdates_genutil/module.go | 58 +++++++++++++++++++++++++++ x/ccv/provider/keeper/genesis.go | 6 +-- 4 files changed, 72 insertions(+), 6 deletions(-) create mode 100644 x/ccv/no_valupdates_genutil/doc.go create mode 100644 x/ccv/no_valupdates_genutil/module.go diff --git a/app/provider/app.go b/app/provider/app.go index 7cd5375b2d..c1ef7818f2 100644 --- a/app/provider/app.go +++ b/app/provider/app.go @@ -101,7 +101,6 @@ 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/cosmos-sdk/x/staking" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -111,6 +110,7 @@ import ( 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" ibcproviderclient "github.com/cosmos/interchain-security/v5/x/ccv/provider/client" @@ -152,7 +152,7 @@ var ( mint.AppModuleBasic{}, slashing.AppModuleBasic{}, distr.AppModuleBasic{}, - staking.AppModuleBasic{}, + no_valupdates_staking.AppModuleBasic{}, upgrade.AppModuleBasic{}, evidence.AppModuleBasic{}, @@ -536,7 +536,7 @@ func New( // NOTE: Any module instantiated in the module manager that is later modified // must be passed by reference here. app.MM = module.NewManager( - genutil.NewAppModule( + no_valupdates_genutil.NewAppModule( app.AccountKeeper, app.StakingKeeper, app, diff --git a/x/ccv/no_valupdates_genutil/doc.go b/x/ccv/no_valupdates_genutil/doc.go new file mode 100644 index 0000000000..466804b6cc --- /dev/null +++ b/x/ccv/no_valupdates_genutil/doc.go @@ -0,0 +1,8 @@ +/* +Package staking defines a "wrapper" module around the Cosmos SDK's native +x/staking module. In other words, it provides the exact same functionality as +the native module in that it simply embeds the native module. However, it +overrides `EndBlock` which will return no validator set updates. Instead, +it is assumed that some other module will provide the validator set updates. +*/ +package genutil diff --git a/x/ccv/no_valupdates_genutil/module.go b/x/ccv/no_valupdates_genutil/module.go new file mode 100644 index 0000000000..9a7528c071 --- /dev/null +++ b/x/ccv/no_valupdates_genutil/module.go @@ -0,0 +1,58 @@ +package genutil + +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" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/cosmos/cosmos-sdk/x/genutil" + "github.com/cosmos/cosmos-sdk/x/genutil/types" + + abci "github.com/cometbft/cometbft/abci/types" +) + +var ( + _ module.AppModuleGenesis = AppModule{} + _ module.AppModuleBasic = genutil.AppModuleBasic{} +) + +// AppModule implements an application module for the genutil module. +type AppModule struct { + genutil.AppModule + + stakingKeeper types.StakingKeeper + deliverTx genesis.TxHandler + txEncodingConfig client.TxEncodingConfig +} + +// NewAppModule creates a new AppModule object +func NewAppModule(accountKeeper types.AccountKeeper, + stakingKeeper types.StakingKeeper, deliverTx genesis.TxHandler, + txEncodingConfig client.TxEncodingConfig, +) module.GenesisOnlyAppModule { + genutilAppModule := genutil.NewAppModule(accountKeeper, stakingKeeper, deliverTx, txEncodingConfig) + genutilAppModule.AppModuleGenesis = AppModule{ + AppModule: genutilAppModule.AppModuleGenesis.(genutil.AppModule), + stakingKeeper: stakingKeeper, + deliverTx: deliverTx, + txEncodingConfig: txEncodingConfig, + } + return genutilAppModule +} + +// InitGenesis delegates the InitGenesis call to the underlying x/genutil module, +// however, it returns no validator updates as validator updates will be provided by the provider module. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { + var genesisState types.GenesisState + + cdc.MustUnmarshalJSON(data, &genesisState) + _, err := genutil.InitGenesis(ctx, am.stakingKeeper, am.deliverTx, genesisState, am.txEncodingConfig) + if err != nil { + panic(err) + } + + return []abci.ValidatorUpdate{} +} diff --git a/x/ccv/provider/keeper/genesis.go b/x/ccv/provider/keeper/genesis.go index f96ec7eb2f..3804e405f2 100644 --- a/x/ccv/provider/keeper/genesis.go +++ b/x/ccv/provider/keeper/genesis.go @@ -109,13 +109,13 @@ func (k Keeper) InitGenesis(ctx sdk.Context, genState *types.GenesisState) []abc // Set the last provider consensus validator set k.SetLastProviderConsensusValSet(ctx, genState.LastProviderConsensusValidators) - return k.GetGenesisValUpdates(ctx) + return k.InitGenesisValUpdates(ctx) } -// GetGenesisValUpdates returns the genesis validator set updates +// InitGenesisValUpdates returns the genesis validator set updates // for the provider module by selecting the first MaxProviderConsensusValidators // from the staking module's validator set. -func (k Keeper) GetGenesisValUpdates(ctx sdk.Context) []abci.ValidatorUpdate { +func (k Keeper) InitGenesisValUpdates(ctx sdk.Context) []abci.ValidatorUpdate { // get the staking validator set valSet, err := k.stakingKeeper.GetBondedValidatorsByPower(ctx) if err != nil { From ca84368445970ac979aae5ec2625121a30f5ba61 Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Wed, 26 Jun 2024 15:52:54 +0200 Subject: [PATCH 14/32] Revert formatting --- app/provider/export.go | 1 - app/sovereign/abci.go | 4 ++-- app/sovereign/app.go | 21 +++++++++++---------- app/sovereign/export.go | 2 +- tests/e2e/actions.go | 7 +++++-- tests/e2e/config.go | 5 ++--- tests/e2e/json_marshal_test.go | 6 ++---- tests/e2e/state.go | 6 +++--- tests/e2e/state_rapid_test.go | 1 + tests/e2e/steps_active_set_changes.go | 3 +-- tests/e2e/steps_compatibility.go | 5 ++--- tests/e2e/steps_consumer_misbehaviour.go | 3 +-- tests/e2e/steps_partial_set_security.go | 18 ++++++------------ tests/e2e/steps_sovereign_changeover.go | 3 +-- tests/e2e/steps_start_chains.go | 3 +-- tests/e2e/test_driver.go | 3 +-- tests/e2e/testlib/utils.go | 2 +- tests/e2e/trace_handlers_test.go | 3 +-- tests/e2e/v4/state.go | 18 ++++++++---------- 19 files changed, 50 insertions(+), 64 deletions(-) diff --git a/app/provider/export.go b/app/provider/export.go index bc2a7aba42..9fec37e3f2 100644 --- a/app/provider/export.go +++ b/app/provider/export.go @@ -5,7 +5,6 @@ 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/sovereign/abci.go b/app/sovereign/abci.go index f0020562aa..94b34cc3bb 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 8957b6f73a..67386cc70a 100644 --- a/app/sovereign/app.go +++ b/app/sovereign/app.go @@ -8,10 +8,6 @@ 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" @@ -29,7 +25,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" @@ -37,11 +33,6 @@ 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" @@ -89,6 +80,14 @@ 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" @@ -104,9 +103,11 @@ 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/v5/app/encoding" testutil "github.com/cosmos/interchain-security/v5/testutil/integration" diff --git a/app/sovereign/export.go b/app/sovereign/export.go index 8419e70c9e..6c7750d4c2 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/tests/e2e/actions.go b/tests/e2e/actions.go index e00653967a..f50f23b41a 100644 --- a/tests/e2e/actions.go +++ b/tests/e2e/actions.go @@ -334,6 +334,7 @@ func (tr Chain) submitConsumerAdditionProposal( fmt.Println("submitConsumerAdditionProposal json:", jsonStr) } bz, err = cmd.CombinedOutput() + if err != nil { log.Fatal(err, "\n", string(bz)) } @@ -467,6 +468,7 @@ func (tr Chain) submitConsumerModificationProposal( } bz, err = cmd.CombinedOutput() + if err != nil { log.Fatal(err, "\n", string(bz)) } @@ -1003,6 +1005,7 @@ func (tr Chain) addChainToHermes( action AddChainToRelayerAction, verbose bool, ) { + bz, err := tr.target.ExecCommand("bash", "-c", "hermes", "version").CombinedOutput() if err != nil { log.Fatal(err, "\n error getting hermes version", string(bz)) @@ -1768,7 +1771,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, verbose bool) { +func (tr Chain) setValidatorDowntime(chain ChainID, validator ValidatorID, down bool, verbose bool) { var lastArg string if down { lastArg = "down" @@ -1908,7 +1911,7 @@ func (tr Chain) registerRepresentative( panic(fmt.Sprintf("failed writing ccv consumer file : %v", err)) } defer file.Close() - err = os.WriteFile(file.Name(), []byte(fileContent), 0o600) + err = os.WriteFile(file.Name(), []byte(fileContent), 0600) if err != nil { log.Fatalf("Failed writing consumer genesis to file: %v", err) } diff --git a/tests/e2e/config.go b/tests/e2e/config.go index d33e39b0c4..bbfe7a4d0b 100644 --- a/tests/e2e/config.go +++ b/tests/e2e/config.go @@ -7,9 +7,8 @@ import ( "strconv" "time" - "golang.org/x/mod/semver" - e2e "github.com/cosmos/interchain-security/v5/tests/e2e/testlib" + "golang.org/x/mod/semver" ) var ( @@ -418,7 +417,7 @@ func CompatibilityTestConfig(providerVersion, consumerVersion string) TestConfig ".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\" | " + // This disables slash packet throttling ".app_state.provider.params.slash_meter_replenish_period = \"3s\"", } - } else if semver.Compare(providerVersion, "v5.0.0-alpha1") < 0 { // TODO: MOV THIS BACK TO "v5.0.0" + } else if semver.Compare(providerVersion, "v5.0.0-alpha1") < 0 { //TODO: MOV THIS BACK TO "v5.0.0" fmt.Println("Using provider chain config for v4.1.x") providerConfig = ChainConfig{ ChainId: ChainID("provi"), diff --git a/tests/e2e/json_marshal_test.go b/tests/e2e/json_marshal_test.go index eaa0bfb2c9..1265063e69 100644 --- a/tests/e2e/json_marshal_test.go +++ b/tests/e2e/json_marshal_test.go @@ -7,12 +7,10 @@ import ( "strings" "testing" - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - "github.com/davecgh/go-spew/spew" - 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" + "github.com/davecgh/go-spew/spew" ) func TestProposalUnmarshal(t *testing.T) { diff --git a/tests/e2e/state.go b/tests/e2e/state.go index 8c15d936d8..1c1be7e95a 100644 --- a/tests/e2e/state.go +++ b/tests/e2e/state.go @@ -11,11 +11,10 @@ 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/kylelemons/godebug/pretty" "github.com/tidwall/gjson" "gopkg.in/yaml.v2" - - e2e "github.com/cosmos/interchain-security/v5/tests/e2e/testlib" ) // type aliases @@ -366,6 +365,7 @@ func (tr Commands) GetReward(chain ChainID, validator ValidatorID, blockHeight u ) bz, err := cmd.CombinedOutput() + if err != nil { log.Fatal("failed getting rewards: ", err, "\n", string(bz)) } @@ -380,7 +380,7 @@ func (tr Commands) GetReward(chain ChainID, validator ValidatorID, blockHeight u // interchain-securityd query gov proposals func (tr Commands) GetProposal(chain ChainID, proposal uint) Proposal { - noProposalRegex := regexp.MustCompile(`doesn't exist: key not found`) + var noProposalRegex = regexp.MustCompile(`doesn't exist: key not found`) binaryName := tr.chainConfigs[chain].BinaryName bz, err := tr.target.ExecCommand(binaryName, diff --git a/tests/e2e/state_rapid_test.go b/tests/e2e/state_rapid_test.go index 3ed52a5c16..1ca36d5578 100644 --- a/tests/e2e/state_rapid_test.go +++ b/tests/e2e/state_rapid_test.go @@ -117,6 +117,7 @@ func GetIBCTransferParamsGen() *rapid.Generator[IBCTransferParams] { ReceiveEnabled: rapid.Bool().Draw(t, "ReceiveEnabled"), } }) + } func GetIBCTransferParamsProposalGen() *rapid.Generator[IBCTransferParamsProposal] { diff --git a/tests/e2e/steps_active_set_changes.go b/tests/e2e/steps_active_set_changes.go index d8cf367404..1fc06a73b6 100644 --- a/tests/e2e/steps_active_set_changes.go +++ b/tests/e2e/steps_active_set_changes.go @@ -3,9 +3,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 diff --git a/tests/e2e/steps_compatibility.go b/tests/e2e/steps_compatibility.go index 4997d21c27..a51a34fed3 100644 --- a/tests/e2e/steps_compatibility.go +++ b/tests/e2e/steps_compatibility.go @@ -6,9 +6,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 compstepStartProviderChain() []Step { @@ -128,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: 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 56c582c6e0..56e093e668 100644 --- a/tests/e2e/steps_consumer_misbehaviour.go +++ b/tests/e2e/steps_consumer_misbehaviour.go @@ -3,9 +3,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 a consumer chain with two validators, diff --git a/tests/e2e/steps_partial_set_security.go b/tests/e2e/steps_partial_set_security.go index 9c4c379da1..9a0daa5acf 100644 --- a/tests/e2e/steps_partial_set_security.go +++ b/tests/e2e/steps_partial_set_security.go @@ -3,9 +3,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" ) // stepsOptInChain starts a provider chain and an Opt-In chain and opts in and out validators @@ -1512,10 +1511,8 @@ func stepsValidatorsAllowlistedChain() []Step { 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", - }, + Allowlist: []string{"cosmosvalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7xw4mceq", + "cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39"}, }, State: State{ ChainID("provi"): ChainState{ @@ -2252,10 +2249,8 @@ func stepsModifyChain() []Step { Deposit: 10000001, ConsumerChain: ChainID("consu"), // only "alice" and "carol" are allowlisted (see `getDefaultValidators` in `tests/e2e/config.go`) - Allowlist: []string{ - "cosmosvalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7xw4mceq", - "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6", - }, + Allowlist: []string{"cosmosvalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7xw4mceq", + "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6"}, }, State: State{ ChainID("provi"): ChainState{ @@ -2442,8 +2437,7 @@ func stepsModifyChain() []Step { ExpectError: true, // because this chain is now Top 100%, no validator can opt out }, State: State{}, - }, - } + }} return s } diff --git a/tests/e2e/steps_sovereign_changeover.go b/tests/e2e/steps_sovereign_changeover.go index be2effabcd..68ed5c8505 100644 --- a/tests/e2e/steps_sovereign_changeover.go +++ b/tests/e2e/steps_sovereign_changeover.go @@ -3,9 +3,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 diff --git a/tests/e2e/steps_start_chains.go b/tests/e2e/steps_start_chains.go index f76a695941..e358862590 100644 --- a/tests/e2e/steps_start_chains.go +++ b/tests/e2e/steps_start_chains.go @@ -3,9 +3,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 { diff --git a/tests/e2e/test_driver.go b/tests/e2e/test_driver.go index c4b2874d65..9c59411ac7 100644 --- a/tests/e2e/test_driver.go +++ b/tests/e2e/test_driver.go @@ -5,10 +5,9 @@ import ( "log" "reflect" + v4 "github.com/cosmos/interchain-security/v5/tests/e2e/v4" "github.com/kylelemons/godebug/pretty" "golang.org/x/mod/semver" - - v4 "github.com/cosmos/interchain-security/v5/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 4e59a93436..8b68c25947 100644 --- a/tests/e2e/testlib/utils.go +++ b/tests/e2e/testlib/utils.go @@ -7,7 +7,7 @@ import ( "os/exec" ) -var verbose *bool // TODO: remove hack +var verbose *bool //TODO: remove hack func ExecuteCommandWithVerbosity(cmd *exec.Cmd, cmdName string, verbose bool) { if verbose { diff --git a/tests/e2e/trace_handlers_test.go b/tests/e2e/trace_handlers_test.go index 5fb3da3da7..8fcbb60c67 100644 --- a/tests/e2e/trace_handlers_test.go +++ b/tests/e2e/trace_handlers_test.go @@ -9,10 +9,9 @@ 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 diff --git a/tests/e2e/v4/state.go b/tests/e2e/v4/state.go index d4e98cf86a..70ca8afe7c 100644 --- a/tests/e2e/v4/state.go +++ b/tests/e2e/v4/state.go @@ -9,14 +9,13 @@ 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" - "github.com/kylelemons/godebug/pretty" - "github.com/tidwall/gjson" + e2e "github.com/cosmos/interchain-security/v5/tests/e2e/testlib" "gopkg.in/yaml.v2" - gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - - e2e "github.com/cosmos/interchain-security/v5/tests/e2e/testlib" + "github.com/kylelemons/godebug/pretty" + "github.com/tidwall/gjson" ) type ( @@ -237,7 +236,7 @@ func (tr Commands) GetBalance(chain ChainID, validator ValidatorID) uint { // interchain-securityd query gov proposals func (tr Commands) GetProposal(chain ChainID, proposal uint) Proposal { - noProposalRegex := regexp.MustCompile(`doesn't exist: key not found`) + var noProposalRegex = regexp.MustCompile(`doesn't exist: key not found`) binaryName := tr.ChainConfigs[chain].BinaryName bz, err := tr.Target.ExecCommand(binaryName, @@ -412,7 +411,6 @@ func (tr Commands) GetConsumerChains(chain ChainID) map[ChainID]bool { return chains } - func (tr Commands) GetConsumerAddress(consumerChain ChainID, validator ValidatorID) string { binaryName := tr.ChainConfigs[ChainID("provi")].BinaryName cmd := tr.Target.ExecCommand(binaryName, @@ -547,7 +545,7 @@ func (tr Commands) curlJsonRPCRequest(method, params, address string) { // 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, @@ -581,7 +579,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, @@ -625,7 +623,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", From eb6f00fa52680ea8182a1968b5099fa5ff90f7b5 Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Wed, 26 Jun 2024 15:53:32 +0200 Subject: [PATCH 15/32] Revert formatting in tests/integration --- tests/integration/democracy.go | 2 ++ tests/integration/distribution.go | 9 ++++----- tests/integration/double_vote.go | 1 - tests/integration/expired_client.go | 3 +-- tests/integration/key_assignment.go | 3 +-- tests/integration/misbehaviour.go | 3 +-- tests/integration/normal_operations.go | 2 +- tests/integration/provider_gov_hooks.go | 1 - tests/integration/setup.go | 1 - tests/integration/slashing.go | 5 ++--- tests/integration/soft_opt_out.go | 8 +++----- tests/integration/stop_consumer.go | 3 +-- tests/integration/throttle.go | 3 +-- tests/integration/unbonding.go | 2 -- tests/integration/valset_update.go | 3 +-- 15 files changed, 18 insertions(+), 31 deletions(-) diff --git a/tests/integration/democracy.go b/tests/integration/democracy.go index bf3dfc0157..5fe7e9eb6d 100644 --- a/tests/integration/democracy.go +++ b/tests/integration/democracy.go @@ -14,6 +14,7 @@ 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/v5/testutil/ibc_testing" @@ -315,6 +316,7 @@ 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 9b19cbe547..acff226828 100644 --- a/tests/integration/distribution.go +++ b/tests/integration/distribution.go @@ -3,16 +3,15 @@ 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/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" diff --git a/tests/integration/double_vote.go b/tests/integration/double_vote.go index 9e793292b0..f8a0f7f25d 100644 --- a/tests/integration/double_vote.go +++ b/tests/integration/double_vote.go @@ -2,7 +2,6 @@ package integration import ( "cosmossdk.io/math" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/tests/integration/expired_client.go b/tests/integration/expired_client.go index 6e735d0fd0..5a55c75079 100644 --- a/tests/integration/expired_client.go +++ b/tests/integration/expired_client.go @@ -3,13 +3,12 @@ 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 9aa0843279..8d8826daf9 100644 --- a/tests/integration/key_assignment.go +++ b/tests/integration/key_assignment.go @@ -1,9 +1,8 @@ package integration import ( - "github.com/cosmos/ibc-go/v8/testing/mock" - "cosmossdk.io/math" + "github.com/cosmos/ibc-go/v8/testing/mock" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" diff --git a/tests/integration/misbehaviour.go b/tests/integration/misbehaviour.go index 77fa3171f9..912f8c71d7 100644 --- a/tests/integration/misbehaviour.go +++ b/tests/integration/misbehaviour.go @@ -3,9 +3,8 @@ package integration import ( "time" - ibctmtypes "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" - "cosmossdk.io/math" + ibctmtypes "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/tests/integration/normal_operations.go b/tests/integration/normal_operations.go index 155ac4f44d..fc71fec247 100644 --- a/tests/integration/normal_operations.go +++ b/tests/integration/normal_operations.go @@ -37,7 +37,7 @@ func (k CCVTestSuite) TestHistoricalInfo() { //nolint:govet // this is a test so // increased by HistoricalEntries in order to prune the historical info less or equal to the current block height // Note that historical info containing the created validators were stored during the BeginBlocker of the current block // at the moment of creation and thus are indexed with the respective block heights InitHeight and InitHeight+1 - // Last saved historical info was in the last committed block k.consumerChain.GetContext().BlockHeight(), meaning that + // Last saved historical info was in the last commited block k.consumerChain.GetContext().BlockHeight(), meaning that // if we want to prune old entries we need to start from the last saved historical info which is k.consumerChain.GetContext().BlockHeight() - 1 testSetup := []func(CCVTestSuite){ createVal, diff --git a/tests/integration/provider_gov_hooks.go b/tests/integration/provider_gov_hooks.go index d63867f1e3..6c99f17c64 100644 --- a/tests/integration/provider_gov_hooks.go +++ b/tests/integration/provider_gov_hooks.go @@ -4,7 +4,6 @@ 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" diff --git a/tests/integration/setup.go b/tests/integration/setup.go index 1b784056ed..eeb980200f 100644 --- a/tests/integration/setup.go +++ b/tests/integration/setup.go @@ -13,7 +13,6 @@ 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 c7ebb972c1..9f29c2806c 100644 --- a/tests/integration/slashing.go +++ b/tests/integration/slashing.go @@ -12,7 +12,6 @@ import ( "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" @@ -130,7 +129,7 @@ func (s *CCVTestSuite) TestRelayAndApplyDowntimePacket() { relayAllCommittedPackets(s, s.providerChain, bundle.Path, ccv.ProviderPortID, bundle.Path.EndpointB.ChannelID, 1) - // check that each consumer updated its VSC ID for the subsequent not committed block ctx.BlockHeight() + // check that each consumer updated its VSC ID for the subsequent not commited block ctx.BlockHeight() consumerKeeper := bundle.GetKeeper() ctx := bundle.GetCtx() actualValsetUpdateID := consumerKeeper.GetHeightValsetUpdateID( @@ -420,7 +419,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.Chain.ChainID, providertypes.ConsumerValidator{ ProviderConsAddr: validAddress, }) diff --git a/tests/integration/soft_opt_out.go b/tests/integration/soft_opt_out.go index 9ed4a1dc7c..4af1f79c94 100644 --- a/tests/integration/soft_opt_out.go +++ b/tests/integration/soft_opt_out.go @@ -6,16 +6,14 @@ import ( "cosmossdk.io/core/comet" "cosmossdk.io/math" - + abci "github.com/cometbft/cometbft/abci/types" sdk "github.com/cosmos/cosmos-sdk/types" slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - - abci "github.com/cometbft/cometbft/abci/types" - cmttypes "github.com/cometbft/cometbft/proto/tendermint/types" - consumerKeeper "github.com/cosmos/interchain-security/v5/x/ccv/consumer/keeper" ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" + + cmttypes "github.com/cometbft/cometbft/proto/tendermint/types" ) // TestSoftOptOut tests the soft opt-out feature diff --git a/tests/integration/stop_consumer.go b/tests/integration/stop_consumer.go index 40664c634b..f7b2d6ef96 100644 --- a/tests/integration/stop_consumer.go +++ b/tests/integration/stop_consumer.go @@ -1,9 +1,8 @@ package integration import ( - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" - "cosmossdk.io/math" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" diff --git a/tests/integration/throttle.go b/tests/integration/throttle.go index 7dd20dde5f..f56228c56f 100644 --- a/tests/integration/throttle.go +++ b/tests/integration/throttle.go @@ -3,9 +3,8 @@ package integration import ( "time" - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - "cosmossdk.io/math" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" diff --git a/tests/integration/unbonding.go b/tests/integration/unbonding.go index 4e18f4a1d9..6f027c3616 100644 --- a/tests/integration/unbonding.go +++ b/tests/integration/unbonding.go @@ -4,10 +4,8 @@ import ( "time" "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" ) diff --git a/tests/integration/valset_update.go b/tests/integration/valset_update.go index bdfe088ca9..994dfab4af 100644 --- a/tests/integration/valset_update.go +++ b/tests/integration/valset_update.go @@ -3,9 +3,8 @@ package integration import ( "time" - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - "cosmossdk.io/math" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" From 8f8ff967b4e0bd8d0e8ddd1b8e2a86929bc1641b Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Wed, 26 Jun 2024 15:59:03 +0200 Subject: [PATCH 16/32] Revert minor formatting --- 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 +- x/ccv/provider/keeper/consumer_equivocation.go | 2 +- x/ccv/provider/keeper/distribution.go | 3 +-- x/ccv/provider/keeper/distribution_test.go | 3 +-- x/ccv/provider/keeper/genesis_test.go | 3 +-- x/ccv/provider/keeper/hooks.go | 1 - x/ccv/provider/keeper/hooks_test.go | 4 +--- x/ccv/provider/keeper/keeper_test.go | 3 +-- x/ccv/provider/keeper/legacy_proposal.go | 1 - x/ccv/provider/keeper/params_test.go | 3 +-- x/ccv/provider/keeper/partial_set_security_test.go | 7 ++++--- x/ccv/provider/keeper/proposal.go | 3 ++- x/ccv/provider/keeper/proposal_test.go | 6 +++--- x/ccv/provider/keeper/provider_consensus_test.go | 3 +-- x/ccv/provider/keeper/relay_test.go | 3 +-- x/ccv/provider/keeper/throttle_legacy.go | 1 - x/ccv/provider/keeper/validator_set_storage.go | 1 - x/ccv/provider/migrations/migrator.go | 1 - x/ccv/provider/migrations/v6/legacy_params.go | 5 ++--- x/ccv/provider/migrations/v6/migrations.go | 1 - x/ccv/provider/proposal_handler_test.go | 5 ++--- x/ccv/provider/types/genesis_test.go | 3 +-- x/ccv/provider/types/legacy_proposal.go | 4 ++-- x/ccv/provider/types/params_test.go | 3 +-- 27 files changed, 31 insertions(+), 48 deletions(-) diff --git a/x/ccv/provider/client/cli/tx.go b/x/ccv/provider/client/cli/tx.go index e3b6d4c7ff..eadb3a7e57 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 eb5775aa7b..f4128260e1 100644 --- a/x/ccv/provider/ibc_middleware.go +++ b/x/ccv/provider/ibc_middleware.go @@ -1,7 +1,6 @@ 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" @@ -11,6 +10,7 @@ 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/v5/x/ccv/provider/keeper" "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" diff --git a/x/ccv/provider/ibc_module.go b/x/ccv/provider/ibc_module.go index ca78344a47..f91f69e618 100644 --- a/x/ccv/provider/ibc_module.go +++ b/x/ccv/provider/ibc_module.go @@ -4,7 +4,6 @@ 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" @@ -14,6 +13,7 @@ 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/v5/x/ccv/provider/keeper" providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" diff --git a/x/ccv/provider/ibc_module_test.go b/x/ccv/provider/ibc_module_test.go index 0df627ee80..fdae2a03ba 100644 --- a/x/ccv/provider/ibc_module_test.go +++ b/x/ccv/provider/ibc_module_test.go @@ -3,7 +3,6 @@ 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" @@ -14,6 +13,7 @@ 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/v5/testutil/keeper" "github.com/cosmos/interchain-security/v5/x/ccv/provider" diff --git a/x/ccv/provider/keeper/consumer_equivocation.go b/x/ccv/provider/keeper/consumer_equivocation.go index a8cee86e7a..023ec00219 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" + 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" diff --git a/x/ccv/provider/keeper/distribution.go b/x/ccv/provider/keeper/distribution.go index 5b39edc244..d2505e7dbe 100644 --- a/x/ccv/provider/keeper/distribution.go +++ b/x/ccv/provider/keeper/distribution.go @@ -3,12 +3,11 @@ 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 14e36eee02..2b09beb4fb 100644 --- a/x/ccv/provider/keeper/distribution_test.go +++ b/x/ccv/provider/keeper/distribution_test.go @@ -3,6 +3,7 @@ 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" @@ -10,8 +11,6 @@ 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 62a4d3a440..179c741959 100644 --- a/x/ccv/provider/keeper/genesis_test.go +++ b/x/ccv/provider/keeper/genesis_test.go @@ -5,12 +5,11 @@ 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" diff --git a/x/ccv/provider/keeper/hooks.go b/x/ccv/provider/keeper/hooks.go index 36a54154fb..81226a2bdf 100644 --- a/x/ccv/provider/keeper/hooks.go +++ b/x/ccv/provider/keeper/hooks.go @@ -5,7 +5,6 @@ import ( "fmt" "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" sdkgov "github.com/cosmos/cosmos-sdk/x/gov/types" v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" diff --git a/x/ccv/provider/keeper/hooks_test.go b/x/ccv/provider/keeper/hooks_test.go index 2a6d60db85..2447b5edf3 100644 --- a/x/ccv/provider/keeper/hooks_test.go +++ b/x/ccv/provider/keeper/hooks_test.go @@ -3,13 +3,11 @@ package keeper_test import ( "testing" - "github.com/golang/mock/gomock" - sdk "github.com/cosmos/cosmos-sdk/types" - cryptotestutil "github.com/cosmos/interchain-security/v5/testutil/crypto" testkeeper "github.com/cosmos/interchain-security/v5/testutil/keeper" providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" + "github.com/golang/mock/gomock" ) func TestValidatorConsensusKeyInUse(t *testing.T) { diff --git a/x/ccv/provider/keeper/keeper_test.go b/x/ccv/provider/keeper/keeper_test.go index faf253529e..e61a93cda1 100644 --- a/x/ccv/provider/keeper/keeper_test.go +++ b/x/ccv/provider/keeper/keeper_test.go @@ -7,11 +7,10 @@ import ( "testing" "time" + "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" diff --git a/x/ccv/provider/keeper/legacy_proposal.go b/x/ccv/provider/keeper/legacy_proposal.go index b2648822c6..19ad553038 100644 --- a/x/ccv/provider/keeper/legacy_proposal.go +++ b/x/ccv/provider/keeper/legacy_proposal.go @@ -2,7 +2,6 @@ package keeper import ( errorsmod "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" diff --git a/x/ccv/provider/keeper/params_test.go b/x/ccv/provider/keeper/params_test.go index fe694b02f3..e6a9db59bf 100644 --- a/x/ccv/provider/keeper/params_test.go +++ b/x/ccv/provider/keeper/params_test.go @@ -4,13 +4,12 @@ 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/v5/testutil/keeper" diff --git a/x/ccv/provider/keeper/partial_set_security_test.go b/x/ccv/provider/keeper/partial_set_security_test.go index 9999d15d4d..82f94304db 100644 --- a/x/ccv/provider/keeper/partial_set_security_test.go +++ b/x/ccv/provider/keeper/partial_set_security_test.go @@ -2,16 +2,17 @@ package keeper_test import ( "bytes" - 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" diff --git a/x/ccv/provider/keeper/proposal.go b/x/ccv/provider/keeper/proposal.go index e34f6ecdf2..f117d14d37 100644 --- a/x/ccv/provider/keeper/proposal.go +++ b/x/ccv/provider/keeper/proposal.go @@ -5,6 +5,8 @@ import ( "strconv" "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" @@ -15,7 +17,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" tmtypes "github.com/cometbft/cometbft/types" diff --git a/x/ccv/provider/keeper/proposal_test.go b/x/ccv/provider/keeper/proposal_test.go index a68cb35bc9..650179c274 100644 --- a/x/ccv/provider/keeper/proposal_test.go +++ b/x/ccv/provider/keeper/proposal_test.go @@ -7,16 +7,16 @@ import ( "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" - "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" abci "github.com/cometbft/cometbft/abci/types" diff --git a/x/ccv/provider/keeper/provider_consensus_test.go b/x/ccv/provider/keeper/provider_consensus_test.go index bdc00743e7..389aa53981 100644 --- a/x/ccv/provider/keeper/provider_consensus_test.go +++ b/x/ccv/provider/keeper/provider_consensus_test.go @@ -3,9 +3,8 @@ package keeper_test import ( "testing" - "github.com/stretchr/testify/require" - "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" diff --git a/x/ccv/provider/keeper/relay_test.go b/x/ccv/provider/keeper/relay_test.go index 5cdc413770..3d4e2ca7a5 100644 --- a/x/ccv/provider/keeper/relay_test.go +++ b/x/ccv/provider/keeper/relay_test.go @@ -5,14 +5,13 @@ import ( "strings" "testing" + "cosmossdk.io/math" 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" "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" - "cosmossdk.io/math" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" diff --git a/x/ccv/provider/keeper/throttle_legacy.go b/x/ccv/provider/keeper/throttle_legacy.go index d08e6b7f40..53c6f39c72 100644 --- a/x/ccv/provider/keeper/throttle_legacy.go +++ b/x/ccv/provider/keeper/throttle_legacy.go @@ -4,7 +4,6 @@ import ( "fmt" storetypes "cosmossdk.io/store/types" - sdktypes "github.com/cosmos/cosmos-sdk/types" providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" diff --git a/x/ccv/provider/keeper/validator_set_storage.go b/x/ccv/provider/keeper/validator_set_storage.go index f09a612c89..31c3235419 100644 --- a/x/ccv/provider/keeper/validator_set_storage.go +++ b/x/ccv/provider/keeper/validator_set_storage.go @@ -5,7 +5,6 @@ import ( "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" diff --git a/x/ccv/provider/migrations/migrator.go b/x/ccv/provider/migrations/migrator.go index 17ce676e0f..b0812549d1 100644 --- a/x/ccv/provider/migrations/migrator.go +++ b/x/ccv/provider/migrations/migrator.go @@ -2,7 +2,6 @@ package migrations import ( storetypes "cosmossdk.io/store/types" - "github.com/cosmos/cosmos-sdk/codec" sdktypes "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" diff --git a/x/ccv/provider/migrations/v6/legacy_params.go b/x/ccv/provider/migrations/v6/legacy_params.go index 1447f79752..b1e0d0ed05 100644 --- a/x/ccv/provider/migrations/v6/legacy_params.go +++ b/x/ccv/provider/migrations/v6/legacy_params.go @@ -3,11 +3,10 @@ package v6 import ( "time" - ibctmtypes "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" - 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" + ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" ) diff --git a/x/ccv/provider/migrations/v6/migrations.go b/x/ccv/provider/migrations/v6/migrations.go index af93f9cae2..87977870c4 100644 --- a/x/ccv/provider/migrations/v6/migrations.go +++ b/x/ccv/provider/migrations/v6/migrations.go @@ -2,7 +2,6 @@ package v6 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" ) diff --git a/x/ccv/provider/proposal_handler_test.go b/x/ccv/provider/proposal_handler_test.go index 512e6ac08d..2494da8c60 100644 --- a/x/ccv/provider/proposal_handler_test.go +++ b/x/ccv/provider/proposal_handler_test.go @@ -4,13 +4,12 @@ import ( "testing" "time" + "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" - "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" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" diff --git a/x/ccv/provider/types/genesis_test.go b/x/ccv/provider/types/genesis_test.go index 1e2af3c419..23671723ae 100644 --- a/x/ccv/provider/types/genesis_test.go +++ b/x/ccv/provider/types/genesis_test.go @@ -4,13 +4,12 @@ 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/legacy_proposal.go b/x/ccv/provider/types/legacy_proposal.go index 9e23fa3980..37c068e1c2 100644 --- a/x/ccv/provider/types/legacy_proposal.go +++ b/x/ccv/provider/types/legacy_proposal.go @@ -10,8 +10,8 @@ import ( errorsmod "cosmossdk.io/errors" "cosmossdk.io/math" - evidencetypes "cosmossdk.io/x/evidence/types" + evidencetypes "cosmossdk.io/x/evidence/types" sdk "github.com/cosmos/cosmos-sdk/types" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" @@ -97,7 +97,7 @@ func (cccp *ConsumerAdditionProposal) ProposalType() string { } // ValidatePSSFeatures returns an error if the `topN` and `validatorsPowerCap` parameters are no in the correct ranges -func ValidatePSSFeatures(topN, validatorsPowerCap uint32) error { +func ValidatePSSFeatures(topN uint32, 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) { diff --git a/x/ccv/provider/types/params_test.go b/x/ccv/provider/types/params_test.go index 76feddec6d..e4996557c5 100644 --- a/x/ccv/provider/types/params_test.go +++ b/x/ccv/provider/types/params_test.go @@ -4,13 +4,12 @@ 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/v5/x/ccv/provider/types" From 4e8b917b71909c4dd36e6b1f5e5406e574e6079d Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Thu, 27 Jun 2024 09:44:55 +0200 Subject: [PATCH 17/32] Fix type --- tests/integration/slashing.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/slashing.go b/tests/integration/slashing.go index 9f29c2806c..f2eebd5ef5 100644 --- a/tests/integration/slashing.go +++ b/tests/integration/slashing.go @@ -419,7 +419,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.ConsumerValidator{ + providerKeeper.SetConsumerValidator(ctx, firstBundle.Chain.ChainID, providertypes.ConsensusValidator{ ProviderConsAddr: validAddress, }) From af1b7d40b1941b3ecc43042124b55e31161faa6f Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Thu, 27 Jun 2024 09:45:14 +0200 Subject: [PATCH 18/32] Change wrapped staking to conform to EndBlocker interface --- x/ccv/no_valupdates_staking/module.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/x/ccv/no_valupdates_staking/module.go b/x/ccv/no_valupdates_staking/module.go index c17ef3141a..cda755621e 100644 --- a/x/ccv/no_valupdates_staking/module.go +++ b/x/ccv/no_valupdates_staking/module.go @@ -1,8 +1,10 @@ package staking import ( + "context" "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" @@ -18,6 +20,14 @@ var ( _ module.AppModule = AppModule{} _ module.AppModuleBasic = AppModuleBasic{} _ module.AppModuleSimulation = AppModule{} + + _ module.HasServices = AppModule{} + _ module.HasInvariants = AppModule{} + _ module.HasABCIGenesis = AppModule{} + _ module.HasABCIEndBlock = AppModule{} + + _ appmodule.AppModule = AppModule{} + _ appmodule.HasBeginBlocker = AppModule{} ) // AppModule embeds the Cosmos SDK's x/staking AppModuleBasic. @@ -67,7 +77,7 @@ func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json. // EndBlock delegates the EndBlock call to the underlying x/staking module, // however, it returns no validator updates as validator updates will be provided by the provider module. -func (am AppModule) EndBlock(ctx sdk.Context) ([]abci.ValidatorUpdate, error) { +func (am AppModule) EndBlock(ctx context.Context) ([]abci.ValidatorUpdate, error) { _, err := am.keeper.EndBlocker(ctx) // return the error, but no validator updates return []abci.ValidatorUpdate{}, err From 62dfd1e96a42e8f3a87c67377d1418175d5af3de Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Thu, 27 Jun 2024 09:50:36 +0200 Subject: [PATCH 19/32] Fix typo --- tests/e2e/state.go | 11 +++++------ tests/e2e/v4/state.go | 11 ++++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/e2e/state.go b/tests/e2e/state.go index 1c1be7e95a..cf8b813521 100644 --- a/tests/e2e/state.go +++ b/tests/e2e/state.go @@ -344,28 +344,27 @@ func (tr Commands) GetBlockHeight(chain ChainID) uint { func (tr Commands) GetReward(chain ChainID, validator ValidatorID, blockHeight uint, isNativeDenom bool) float64 { valCfg := tr.validatorConfigs[validator] - delAddresss := valCfg.DelAddress + delAddress := valCfg.DelAddress if chain != ChainID("provi") { // use binary with Bech32Prefix set to ConsumerAccountPrefix if valCfg.UseConsumerKey { - delAddresss = valCfg.ConsumerDelAddress + delAddress = valCfg.ConsumerDelAddress } else { // use the same address as on the provider but with different prefix - delAddresss = valCfg.DelAddressOnConsumer + delAddress = valCfg.DelAddressOnConsumer } } binaryName := tr.chainConfigs[chain].BinaryName cmd := tr.target.ExecCommand(binaryName, "query", "distribution", "delegation-total-rewards", - "--delegator-address", delAddresss, + "--delegator-address", delAddress, `--height`, fmt.Sprint(blockHeight), `--node`, tr.GetQueryNode(chain), `-o`, `json`, ) bz, err := cmd.CombinedOutput() - if err != nil { log.Fatal("failed getting rewards: ", err, "\n", string(bz)) } @@ -380,7 +379,7 @@ func (tr Commands) GetReward(chain ChainID, validator ValidatorID, blockHeight u // interchain-securityd query gov proposals func (tr Commands) GetProposal(chain ChainID, proposal uint) Proposal { - var noProposalRegex = regexp.MustCompile(`doesn't exist: key not found`) + noProposalRegex := regexp.MustCompile(`doesn't exist: key not found`) binaryName := tr.chainConfigs[chain].BinaryName bz, err := tr.target.ExecCommand(binaryName, diff --git a/tests/e2e/v4/state.go b/tests/e2e/v4/state.go index 70ca8afe7c..5302f2067b 100644 --- a/tests/e2e/v4/state.go +++ b/tests/e2e/v4/state.go @@ -169,14 +169,14 @@ func (tr Commands) GetValPower(chain ChainID, validator ValidatorID) uint { func (tr Commands) GetReward(chain ChainID, validator ValidatorID, blockHeight uint, isNativeDenom bool) float64 { valCfg := tr.ValidatorConfigs[validator] - delAddresss := valCfg.DelAddress + delAddress := valCfg.DelAddress if chain != ChainID("provi") { // use binary with Bech32Prefix set to ConsumerAccountPrefix if valCfg.UseConsumerKey { - delAddresss = valCfg.ConsumerDelAddress + delAddress = valCfg.ConsumerDelAddress } else { // use the same address as on the provider but with different prefix - delAddresss = valCfg.DelAddressOnConsumer + delAddress = valCfg.DelAddressOnConsumer } } @@ -184,7 +184,7 @@ func (tr Commands) GetReward(chain ChainID, validator ValidatorID, blockHeight u bz, err := tr.Target.ExecCommand(binaryName, "query", "distribution", "rewards", - delAddresss, + delAddress, `--height`, fmt.Sprint(blockHeight), `--node`, tr.GetQueryNode(chain), @@ -236,7 +236,7 @@ func (tr Commands) GetBalance(chain ChainID, validator ValidatorID) uint { // interchain-securityd query gov proposals func (tr Commands) GetProposal(chain ChainID, proposal uint) Proposal { - var noProposalRegex = regexp.MustCompile(`doesn't exist: key not found`) + noProposalRegex := regexp.MustCompile(`doesn't exist: key not found`) binaryName := tr.ChainConfigs[chain].BinaryName bz, err := tr.Target.ExecCommand(binaryName, @@ -411,6 +411,7 @@ func (tr Commands) GetConsumerChains(chain ChainID) map[ChainID]bool { return chains } + func (tr Commands) GetConsumerAddress(consumerChain ChainID, validator ValidatorID) string { binaryName := tr.ChainConfigs[ChainID("provi")].BinaryName cmd := tr.Target.ExecCommand(binaryName, From 49a6e0466dddbf18a0cc48caf16b69e2ffab4d7d Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Thu, 27 Jun 2024 09:56:29 +0200 Subject: [PATCH 20/32] Revert "Fix typo" This reverts commit 62dfd1e96a42e8f3a87c67377d1418175d5af3de. --- tests/e2e/state.go | 11 ++++++----- tests/e2e/v4/state.go | 11 +++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/e2e/state.go b/tests/e2e/state.go index cf8b813521..1c1be7e95a 100644 --- a/tests/e2e/state.go +++ b/tests/e2e/state.go @@ -344,27 +344,28 @@ func (tr Commands) GetBlockHeight(chain ChainID) uint { func (tr Commands) GetReward(chain ChainID, validator ValidatorID, blockHeight uint, isNativeDenom bool) float64 { valCfg := tr.validatorConfigs[validator] - delAddress := valCfg.DelAddress + delAddresss := valCfg.DelAddress if chain != ChainID("provi") { // use binary with Bech32Prefix set to ConsumerAccountPrefix if valCfg.UseConsumerKey { - delAddress = valCfg.ConsumerDelAddress + delAddresss = valCfg.ConsumerDelAddress } else { // use the same address as on the provider but with different prefix - delAddress = valCfg.DelAddressOnConsumer + delAddresss = valCfg.DelAddressOnConsumer } } binaryName := tr.chainConfigs[chain].BinaryName cmd := tr.target.ExecCommand(binaryName, "query", "distribution", "delegation-total-rewards", - "--delegator-address", delAddress, + "--delegator-address", delAddresss, `--height`, fmt.Sprint(blockHeight), `--node`, tr.GetQueryNode(chain), `-o`, `json`, ) bz, err := cmd.CombinedOutput() + if err != nil { log.Fatal("failed getting rewards: ", err, "\n", string(bz)) } @@ -379,7 +380,7 @@ func (tr Commands) GetReward(chain ChainID, validator ValidatorID, blockHeight u // interchain-securityd query gov proposals func (tr Commands) GetProposal(chain ChainID, proposal uint) Proposal { - noProposalRegex := regexp.MustCompile(`doesn't exist: key not found`) + var noProposalRegex = regexp.MustCompile(`doesn't exist: key not found`) binaryName := tr.chainConfigs[chain].BinaryName bz, err := tr.target.ExecCommand(binaryName, diff --git a/tests/e2e/v4/state.go b/tests/e2e/v4/state.go index 5302f2067b..70ca8afe7c 100644 --- a/tests/e2e/v4/state.go +++ b/tests/e2e/v4/state.go @@ -169,14 +169,14 @@ func (tr Commands) GetValPower(chain ChainID, validator ValidatorID) uint { func (tr Commands) GetReward(chain ChainID, validator ValidatorID, blockHeight uint, isNativeDenom bool) float64 { valCfg := tr.ValidatorConfigs[validator] - delAddress := valCfg.DelAddress + delAddresss := valCfg.DelAddress if chain != ChainID("provi") { // use binary with Bech32Prefix set to ConsumerAccountPrefix if valCfg.UseConsumerKey { - delAddress = valCfg.ConsumerDelAddress + delAddresss = valCfg.ConsumerDelAddress } else { // use the same address as on the provider but with different prefix - delAddress = valCfg.DelAddressOnConsumer + delAddresss = valCfg.DelAddressOnConsumer } } @@ -184,7 +184,7 @@ func (tr Commands) GetReward(chain ChainID, validator ValidatorID, blockHeight u bz, err := tr.Target.ExecCommand(binaryName, "query", "distribution", "rewards", - delAddress, + delAddresss, `--height`, fmt.Sprint(blockHeight), `--node`, tr.GetQueryNode(chain), @@ -236,7 +236,7 @@ func (tr Commands) GetBalance(chain ChainID, validator ValidatorID) uint { // interchain-securityd query gov proposals func (tr Commands) GetProposal(chain ChainID, proposal uint) Proposal { - noProposalRegex := regexp.MustCompile(`doesn't exist: key not found`) + var noProposalRegex = regexp.MustCompile(`doesn't exist: key not found`) binaryName := tr.ChainConfigs[chain].BinaryName bz, err := tr.Target.ExecCommand(binaryName, @@ -411,7 +411,6 @@ func (tr Commands) GetConsumerChains(chain ChainID) map[ChainID]bool { return chains } - func (tr Commands) GetConsumerAddress(consumerChain ChainID, validator ValidatorID) string { binaryName := tr.ChainConfigs[ChainID("provi")].BinaryName cmd := tr.Target.ExecCommand(binaryName, From cc1185d9a3463c96e61c3b1f281cd20a5ef1c288 Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Thu, 27 Jun 2024 10:22:58 +0200 Subject: [PATCH 21/32] Add e2e test for inactive vals --- tests/e2e/config.go | 26 +- tests/e2e/main.go | 6 + tests/e2e/state.go | 10 +- tests/e2e/steps_inactive_vals.go | 507 +++++++++++++++++++++++++++++++ 4 files changed, 545 insertions(+), 4 deletions(-) create mode 100644 tests/e2e/steps_inactive_vals.go diff --git a/tests/e2e/config.go b/tests/e2e/config.go index bbfe7a4d0b..19fca5da88 100644 --- a/tests/e2e/config.go +++ b/tests/e2e/config.go @@ -92,6 +92,7 @@ const ( ConsumerMisbehaviourTestCfg TestConfigType = "consumer-misbehaviour" CompatibilityTestCfg TestConfigType = "compatibility" SmallMaxValidatorsTestCfg TestConfigType = "small-max-validators" + InactiveProviderValsTestCfg TestConfigType = "inactive-provider-vals" ) type TestConfig struct { @@ -180,6 +181,8 @@ func GetTestConfig(cfgType TestConfigType, providerVersion, consumerVersion stri testCfg = CompatibilityTestConfig(pv, cv) case SmallMaxValidatorsTestCfg: testCfg = SmallMaxValidatorsTestConfig() + case InactiveProviderValsTestCfg: + testCfg = InactiveProviderValsTestConfig() default: panic(fmt.Sprintf("Invalid test config: %s", cfgType)) } @@ -417,7 +420,7 @@ func CompatibilityTestConfig(providerVersion, consumerVersion string) TestConfig ".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\" | " + // This disables slash packet throttling ".app_state.provider.params.slash_meter_replenish_period = \"3s\"", } - } else if semver.Compare(providerVersion, "v5.0.0-alpha1") < 0 { //TODO: MOV THIS BACK TO "v5.0.0" + } else if semver.Compare(providerVersion, "v5.0.0-alpha1") < 0 { // TODO: MOV THIS BACK TO "v5.0.0" fmt.Println("Using provider chain config for v4.1.x") providerConfig = ChainConfig{ ChainId: ChainID("provi"), @@ -557,6 +560,27 @@ func DemocracyTestConfig(allowReward bool) TestConfig { return tr } +func InactiveProviderValsTestConfig() TestConfig { + tr := DefaultTestConfig() + tr.name = "InactiveValsConfig" + // set the MaxProviderConsensusValidators param to 2 + proviConfig := tr.chainConfigs[ChainID("provi")] + proviConfig.GenesisChanges += " | .app_state.provider.params.max_provider_consensus_validators = \"2\"" + + consuConfig := tr.chainConfigs[ChainID("consu")] + // set the soft_opt_out threshold to 0% to make sure all validators are slashed for downtime + consuConfig.GenesisChanges += " | .app_state.ccvconsumer.params.soft_opt_out_threshold = \"0.0\"" + tr.chainConfigs[ChainID("provi")] = proviConfig + tr.chainConfigs[ChainID("consu")] = consuConfig + + // make is to that carol does not use a consumer key + carolConfig := tr.validatorConfigs[ValidatorID("carol")] + carolConfig.UseConsumerKey = false + tr.validatorConfigs[ValidatorID("carol")] = carolConfig + + return tr +} + func SmallMaxValidatorsTestConfig() TestConfig { cfg := DefaultTestConfig() diff --git a/tests/e2e/main.go b/tests/e2e/main.go index cf8fe70d89..f1dd891751 100644 --- a/tests/e2e/main.go +++ b/tests/e2e/main.go @@ -204,6 +204,12 @@ var stepChoices = map[string]StepChoice{ description: "This is a regression test related to the issue discussed here: https://forum.cosmos.network/t/cosmos-hub-v17-1-chain-halt-post-mortem/13899. The test ensures that the protocol works as expected when MaxValidators is smaller than the number of potential validators.", testConfig: SmallMaxValidatorsTestCfg, }, + "inactive-provider-validators-on-consumer": { + name: "inactive-provider-validators-on-consumer", + steps: stepsInactiveProviderValidators(), + description: "test inactive validators on consumer", + testConfig: InactiveProviderValsTestCfg, + }, } func getTestCaseUsageString() string { diff --git a/tests/e2e/state.go b/tests/e2e/state.go index 1c1be7e95a..b9e2055f7f 100644 --- a/tests/e2e/state.go +++ b/tests/e2e/state.go @@ -358,14 +358,18 @@ func (tr Commands) GetReward(chain ChainID, validator ValidatorID, blockHeight u binaryName := tr.chainConfigs[chain].BinaryName cmd := tr.target.ExecCommand(binaryName, "query", "distribution", "delegation-total-rewards", - "--delegator-address", delAddresss, + delAddresss, `--height`, fmt.Sprint(blockHeight), `--node`, tr.GetQueryNode(chain), `-o`, `json`, ) - bz, err := cmd.CombinedOutput() + if *verbose { + log.Println("getting rewards for chain: ", chain, " validator: ", validator, " blockHeight: ", blockHeight) + log.Println(cmd) + } + bz, err := cmd.CombinedOutput() if err != nil { log.Fatal("failed getting rewards: ", err, "\n", string(bz)) } @@ -380,7 +384,7 @@ func (tr Commands) GetReward(chain ChainID, validator ValidatorID, blockHeight u // interchain-securityd query gov proposals func (tr Commands) GetProposal(chain ChainID, proposal uint) Proposal { - var noProposalRegex = regexp.MustCompile(`doesn't exist: key not found`) + noProposalRegex := regexp.MustCompile(`doesn't exist: key not found`) binaryName := tr.chainConfigs[chain].BinaryName bz, err := tr.target.ExecCommand(binaryName, diff --git a/tests/e2e/steps_inactive_vals.go b/tests/e2e/steps_inactive_vals.go new file mode 100644 index 0000000000..f19d383111 --- /dev/null +++ b/tests/e2e/steps_inactive_vals.go @@ -0,0 +1,507 @@ +package main + +import 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 +// provider chain validate on the consumer chain. +// The provider chain is set to have at most *2* validators active in consensus, and there are 3 validators in total. +// high-level, this test does: +// - start the provider chain +// - start a consumer chain +// - check that non-consensus validators do not get slashed for downtime; and that they don't get rewards +// - check that active validators *do* get slashed for downtime, and don't get rewards while they are down +// - check that non-consensus validators *do* get jailed for downtime on consumer chains +// - check that non-consensus validators *become* consensus validators when they have enough power +func stepsInactiveProviderValidators() []Step { + s := concatSteps( + []Step{ + { + 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"): 0, // max consensus validators is 2, so alice should not be in power + ValidatorID("bob"): 200, + ValidatorID("carol"): 300, + }, + StakedTokens: &map[ValidatorID]uint{ + ValidatorID("alice"): 100000000, + ValidatorID("bob"): 200000000, + ValidatorID("carol"): 300000000, + }, + Rewards: &Rewards{ + IsNativeDenom: true, // check for rewards in the provider denom + IsIncrementalReward: true, // check current rewards, because alice gets one block of rewards due to being in the genesis + IsRewarded: map[ValidatorID]bool{ + ValidatorID("alice"): false, + ValidatorID("bob"): true, + ValidatorID("carol"): true, + }, + }, + }, + }, + }, + }, + setupOptInChain(), + []Step{ + // check that active-but-not-consensus validators do not get slashed for downtime + { + // alices provider node goes offline + Action: DowntimeSlashAction{ + Chain: ChainID("provi"), + Validator: ValidatorID("alice"), + }, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 0, // still 0 consensus power + ValidatorID("bob"): 200, + ValidatorID("carol"): 300, + }, + StakedTokens: &map[ValidatorID]uint{ + ValidatorID("alice"): 100000000, // but alice does not get jailed or slashed + ValidatorID("bob"): 200000000, + ValidatorID("carol"): 300000000, + }, + }, + }, + }, + // give carol more power so that she has enough power to validate if bob goes down + { + Action: DelegateTokensAction{ + Chain: ChainID("provi"), + From: ValidatorID("carol"), + To: ValidatorID("carol"), + Amount: 1000000000, // carol needs to have more than 2/3rds of power(alice) + power(carol) + power(bob) to run both chains alone, so we stake some more to her + }, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 0, + ValidatorID("bob"): 200, + ValidatorID("carol"): 1000, + }, + StakedTokens: &map[ValidatorID]uint{ + ValidatorID("alice"): 100000000, + ValidatorID("bob"): 200000000, + ValidatorID("carol"): 1000000000, + }, + // check that bob and carol get rewards, but alice does not + Rewards: &Rewards{ + IsNativeDenom: true, // check for rewards in the provider denom + IsIncrementalReward: true, // check rewards since block 1 + IsRewarded: map[ValidatorID]bool{ + ValidatorID("alice"): false, + ValidatorID("bob"): true, + ValidatorID("carol"): true, + }, + }, + }, + }, + }, + // bob goes offline + { + Action: DowntimeSlashAction{ + Chain: ChainID("provi"), + Validator: ValidatorID("bob"), + }, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 100, // alice gets into the active set + ValidatorID("bob"): 0, // bob is jailed + ValidatorID("carol"): 1000, + }, + StakedTokens: &map[ValidatorID]uint{ + ValidatorID("alice"): 100000000, + ValidatorID("bob"): 198000000, // 1% slash + ValidatorID("carol"): 1000000000, + }, + }, + }, + }, + { + // relay packets so that the consumer gets up to date with the provider + Action: RelayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID("consu"), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID("provi"): ChainState{ + // check that now every validator got rewarded since the first block + Rewards: &Rewards{ + IsNativeDenom: true, // check for rewards in the provider denom + IsIncrementalReward: true, // check rewards for currently produced blocks only + IsRewarded: map[ValidatorID]bool{ + ValidatorID("alice"): true, // alice is participating right now, so gets rewards + ValidatorID("bob"): false, // bob does not get rewards since he is not participating in consensus + ValidatorID("carol"): true, + }, + }, + }, + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 100, + ValidatorID("bob"): 0, + ValidatorID("carol"): 1000, + }, + }, + }, + }, + // unjail bob + { + Action: UnjailValidatorAction{ + Provider: ChainID("provi"), + Validator: ValidatorID("bob"), + }, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 0, // alice is back out because only 2 validators can be active in consensus + ValidatorID("bob"): 198, // bob was slashed 1% + ValidatorID("carol"): 1000, + }, + // check that between two blocks now, alice does not get rewarded with the native denom + Rewards: &Rewards{ + IsNativeDenom: true, // check for rewards in the provider denom + IsIncrementalReward: true, // check rewards for currently produced blocks only + IsRewarded: map[ValidatorID]bool{ + ValidatorID("alice"): false, + ValidatorID("bob"): true, + ValidatorID("carol"): true, + }, + }, + }, + // bob is still at 0 power on the consumer chain + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 100, + ValidatorID("bob"): 0, + ValidatorID("carol"): 500, + }, + }, + }, + }, + // relay packets so that the consumer gets up to date with the provider + { + Action: RelayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID("consu"), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 100, + ValidatorID("bob"): 198, + ValidatorID("carol"): 1000, + }, + }, + }, + }, + // alice goes offline on the consumer chain + { + Action: DowntimeSlashAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("alice"), + }, + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 100, // power not affected yet + ValidatorID("bob"): 198, + ValidatorID("carol"): 1000, + }, + }, + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 0, // alice is not consensus-active anyways, since we allow two vals at maximum + ValidatorID("bob"): 198, + ValidatorID("carol"): 1000, + }, + }, + }, + }, + // relay the packets so that the provider chain knows about alice's downtime + { + Action: RelayPacketsAction{ + ChainA: ChainID("consu"), + ChainB: ChainID("provi"), + Port: "consumer", + Channel: 0, + }, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 0, // alice is still not in the active set, and should now be jailed too. + // we cannot test directly whether alice is jailed, but we will test this below + ValidatorID("bob"): 198, + ValidatorID("carol"): 1000, + }, + }, + }, + }, + // we need to double-check that alice is actually jailed, so we get bob jailed, too, which usually would mean alice gets into power + { + Action: DowntimeSlashAction{ + Chain: ChainID("provi"), + Validator: ValidatorID("bob"), + }, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 0, // alice is jailed + ValidatorID("bob"): 0, // bob is jailed + ValidatorID("carol"): 1000, + }, + }, + }, + }, + // relay the packets so that the consumer chain is in sync again + { + Action: RelayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID("consu"), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 0, // alice is jailed + ValidatorID("bob"): 0, // bob is jailed + ValidatorID("carol"): 1000, + }, + }, + ChainID("provi"): ChainState{ + // check that alice and bob don't get consumer rewards + Rewards: &Rewards{ + IsNativeDenom: false, // check for rewards from consumer + IsIncrementalReward: true, // check rewards for currently produced blocks only + IsRewarded: map[ValidatorID]bool{ + ValidatorID("alice"): false, + ValidatorID("bob"): false, + ValidatorID("carol"): true, + }, + }, + }, + }, + }, + // unjail alice + { + Action: UnjailValidatorAction{ + Provider: ChainID("provi"), + Validator: ValidatorID("alice"), + }, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + // alice was not slashed because consumer downtime just jails without slashing tokens + ValidatorID("alice"): 100, // alice is back as an active consensus validator. + ValidatorID("bob"): 0, // bob is still jailed + ValidatorID("carol"): 1000, + }, + }, + }, + }, + // unjail bob + { + Action: UnjailValidatorAction{ + Provider: ChainID("provi"), + Validator: ValidatorID("bob"), + }, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 0, // alice is back out because only 2 validators can be active in consensus + ValidatorID("bob"): 196, // bob is back as an active consensus validator and lost 2 more power due to the second downtime + ValidatorID("carol"): 1000, + }, + }, + }, + }, + // relay the packets so that the consumer chain is in sync again + { + Action: RelayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID("consu"), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 100, // both alice and bob are validating the consumer + ValidatorID("bob"): 196, + ValidatorID("carol"): 1000, + }, + }, + }, + }, + }, + ) + + return s +} + +// Precondition: The provider chain is running. +// Postcondition: A consumer chain with Top N = 0 is running, including an up-and-running IBC connection to the provider. +// "alice", "bob", "carol" have opted in and are validating. +func setupOptInChain() []Step { + return []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, + }, + 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: "PROPOSAL_STATUS_VOTING_PERIOD", + }, + }, + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {}, + ValidatorID("bob"): {}, + ValidatorID("carol"): {}, + }, + }, + }, + }, + // Οpt in all validators + { + Action: OptInAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("alice"), + }, + State: State{ + ChainID("provi"): ChainState{ + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {}, // chain is not running yet + ValidatorID("bob"): {}, + ValidatorID("carol"): {}, + }, + }, + }, + }, + { + Action: OptInAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("bob"), + }, + State: State{ + ChainID("provi"): ChainState{ + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {}, + ValidatorID("bob"): {}, + ValidatorID("carol"): {}, + }, + }, + }, + }, + { + Action: OptInAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("carol"), + }, + State: State{ + ChainID("provi"): ChainState{ + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {}, + ValidatorID("bob"): {}, + ValidatorID("carol"): {}, + }, + }, + }, + }, + { + 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: "PROPOSAL_STATUS_PASSED", + }, + }, + }, + }, + }, + { + // we start all the validators but only "alice" and "bob" have opted in and hence + // only "alice" and "bob" are validating blocks + Action: StartConsumerChainAction{ + ConsumerChain: ChainID("consu"), + ProviderChain: 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}, + }, + // For consumers that're launching with the provider being on an earlier version + // of ICS before the soft opt-out threshold was introduced, we need to set the + // soft opt-out threshold to 0.05 in the consumer genesis to ensure that the + // consumer binary doesn't panic. Sdk requires that all params are set to valid + // values from the genesis file. + GenesisChanges: ".app_state.ccvconsumer.params.soft_opt_out_threshold = \"0.05\"", + }, + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 100, + ValidatorID("bob"): 200, + ValidatorID("carol"): 300, + }, + }, + }, + }, + { + Action: AddIbcConnectionAction{ + ChainA: ChainID("consu"), + ChainB: ChainID("provi"), + ClientA: 0, + ClientB: 0, + }, + State: State{}, + }, + { + Action: AddIbcChannelAction{ + ChainA: ChainID("consu"), + ChainB: ChainID("provi"), + ConnectionA: 0, + PortA: "consumer", + PortB: "provider", + Order: "ordered", + }, + State: State{}, + }, + } +} From 732e35d74aee3e6573b06ca4bd3e6a8fe025eaa4 Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Thu, 27 Jun 2024 13:56:55 +0200 Subject: [PATCH 22/32] Start fixing e2e test --- tests/e2e/state.go | 2 +- tests/e2e/steps_inactive_vals.go | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/tests/e2e/state.go b/tests/e2e/state.go index b9e2055f7f..4e5959898c 100644 --- a/tests/e2e/state.go +++ b/tests/e2e/state.go @@ -357,7 +357,7 @@ func (tr Commands) GetReward(chain ChainID, validator ValidatorID, blockHeight u binaryName := tr.chainConfigs[chain].BinaryName cmd := tr.target.ExecCommand(binaryName, - "query", "distribution", "delegation-total-rewards", + "query", "distribution", "rewards", delAddresss, `--height`, fmt.Sprint(blockHeight), `--node`, tr.GetQueryNode(chain), diff --git a/tests/e2e/steps_inactive_vals.go b/tests/e2e/steps_inactive_vals.go index f19d383111..b657dda8a7 100644 --- a/tests/e2e/steps_inactive_vals.go +++ b/tests/e2e/steps_inactive_vals.go @@ -1,6 +1,11 @@ package main -import clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" +import ( + "strconv" + + 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 // provider chain validate on the consumer chain. @@ -79,7 +84,7 @@ func stepsInactiveProviderValidators() []Step { Chain: ChainID("provi"), From: ValidatorID("carol"), To: ValidatorID("carol"), - Amount: 1000000000, // carol needs to have more than 2/3rds of power(alice) + power(carol) + power(bob) to run both chains alone, so we stake some more to her + Amount: 700000000, // carol needs to have more than 2/3rds of power(alice) + power(carol) + power(bob) to run both chains alone, so we stake some more to her }, State: State{ ChainID("provi"): ChainState{ @@ -186,7 +191,7 @@ func stepsInactiveProviderValidators() []Step { ValPowers: &map[ValidatorID]uint{ ValidatorID("alice"): 100, ValidatorID("bob"): 0, - ValidatorID("carol"): 500, + ValidatorID("carol"): 1000, }, }, }, @@ -377,7 +382,7 @@ func setupOptInChain() []Step { Chain: ChainID("consu"), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: "PROPOSAL_STATUS_VOTING_PERIOD", + Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), }, }, HasToValidate: &map[ValidatorID][]ChainID{ @@ -449,7 +454,7 @@ func setupOptInChain() []Step { Chain: ChainID("consu"), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: "PROPOSAL_STATUS_PASSED", + Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), }, }, }, From c07a765ab6df4fd61f88d6b8733375d71083cf66 Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Tue, 2 Jul 2024 10:45:47 +0200 Subject: [PATCH 23/32] Revert formatting changes --- tests/mbt/driver/common.go | 1 - tests/mbt/driver/core.go | 7 ++++--- tests/mbt/driver/mbt_test.go | 5 ++--- tests/mbt/driver/setup.go | 2 +- testutil/crypto/crypto.go | 2 +- testutil/ibc_testing/generic_setup.go | 2 +- 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/keeper/distribution_test.go | 3 +-- x/ccv/consumer/keeper/keeper.go | 10 +++++----- x/ccv/consumer/keeper/relay_test.go | 2 +- x/ccv/consumer/keeper/soft_opt_out.go | 1 - x/ccv/consumer/migrations/v2/migration.go | 1 - x/ccv/consumer/migrations/v2/migration_test.go | 2 -- x/ccv/consumer/migrations/v3/migration.go | 4 ++-- x/ccv/consumer/migrations/v3/migration_test.go | 5 ++--- 18 files changed, 30 insertions(+), 39 deletions(-) diff --git a/tests/mbt/driver/common.go b/tests/mbt/driver/common.go index 045a2ff082..51a3af0f45 100644 --- a/tests/mbt/driver/common.go +++ b/tests/mbt/driver/common.go @@ -2,7 +2,6 @@ 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 7e47b45bb5..2cd618096f 100644 --- a/tests/mbt/driver/core.go +++ b/tests/mbt/driver/core.go @@ -8,23 +8,24 @@ import ( "testing" "time" + "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" - "cosmossdk.io/math" 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/v5/app/consumer" appProvider "github.com/cosmos/interchain-security/v5/app/provider" simibc "github.com/cosmos/interchain-security/v5/testutil/simibc" diff --git a/tests/mbt/driver/mbt_test.go b/tests/mbt/driver/mbt_test.go index a487f14bbe..70fded614a 100644 --- a/tests/mbt/driver/mbt_test.go +++ b/tests/mbt/driver/mbt_test.go @@ -10,20 +10,19 @@ 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/v5/testutil/integration" + providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" "github.com/cosmos/interchain-security/v5/x/ccv/types" ) diff --git a/tests/mbt/driver/setup.go b/tests/mbt/driver/setup.go index 759b381b5f..81d39d5e70 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" + providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" "github.com/stretchr/testify/require" "cosmossdk.io/math" @@ -34,7 +35,6 @@ import ( "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" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" ) diff --git a/testutil/crypto/crypto.go b/testutil/crypto/crypto.go index 3533604f96..88fc8c6c01 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)} + 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. opKey := sdkcryptoSecp256k1.GenPrivKeyFromSecret(seed) return &CryptoIdentity{ diff --git a/testutil/ibc_testing/generic_setup.go b/testutil/ibc_testing/generic_setup.go index 676cb0beab..3aaae5702f 100644 --- a/testutil/ibc_testing/generic_setup.go +++ b/testutil/ibc_testing/generic_setup.go @@ -7,6 +7,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" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" @@ -17,7 +18,6 @@ import ( tmtypes "github.com/cometbft/cometbft/types" testutil "github.com/cosmos/interchain-security/v5/testutil/integration" - testkeeper "github.com/cosmos/interchain-security/v5/testutil/keeper" consumerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/consumer/keeper" providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" ) diff --git a/testutil/ibc_testing/specific_setup.go b/testutil/ibc_testing/specific_setup.go index b0d4300bba..2ff06ca757 100644 --- a/testutil/ibc_testing/specific_setup.go +++ b/testutil/ibc_testing/specific_setup.go @@ -10,12 +10,11 @@ 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/v5/app/consumer" diff --git a/testutil/integration/interfaces.go b/testutil/integration/interfaces.go index bd86140b40..de9c3a6b0d 100644 --- a/testutil/integration/interfaces.go +++ b/testutil/integration/interfaces.go @@ -4,26 +4,24 @@ 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" - evidencekeeper "cosmossdk.io/x/evidence/keeper" + 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/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" diff --git a/testutil/keeper/expectations.go b/testutil/keeper/expectations.go index e2c695b0a3..49ffe51ace 100644 --- a/testutil/keeper/expectations.go +++ b/testutil/keeper/expectations.go @@ -3,7 +3,6 @@ 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" @@ -16,6 +15,7 @@ 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/v5/x/ccv/provider/types" "github.com/cosmos/interchain-security/v5/x/ccv/types" diff --git a/testutil/keeper/unit_test_helpers.go b/testutil/keeper/unit_test_helpers.go index 120236c9db..a80138551a 100644 --- a/testutil/keeper/unit_test_helpers.go +++ b/testutil/keeper/unit_test_helpers.go @@ -6,16 +6,13 @@ 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" @@ -24,19 +21,23 @@ 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/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" + "github.com/cosmos/interchain-security/v5/x/ccv/types" + + dbm "github.com/cosmos/cosmos-db" ) // Parameters needed to instantiate an in-memory keeper diff --git a/x/ccv/consumer/keeper/distribution_test.go b/x/ccv/consumer/keeper/distribution_test.go index cbb11f1a60..5713361918 100644 --- a/x/ccv/consumer/keeper/distribution_test.go +++ b/x/ccv/consumer/keeper/distribution_test.go @@ -4,11 +4,10 @@ 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 943a60c183..644cfc33a7 100644 --- a/x/ccv/consumer/keeper/keeper.go +++ b/x/ccv/consumer/keeper/keeper.go @@ -6,23 +6,23 @@ import ( "reflect" "time" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + addresscodec "cosmossdk.io/core/address" + "cosmossdk.io/core/store" 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" + 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/v5/x/ccv/consumer/types" diff --git a/x/ccv/consumer/keeper/relay_test.go b/x/ccv/consumer/keeper/relay_test.go index e50e12008a..d3ab3778e1 100644 --- a/x/ccv/consumer/keeper/relay_test.go +++ b/x/ccv/consumer/keeper/relay_test.go @@ -6,7 +6,6 @@ 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" @@ -17,6 +16,7 @@ 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/soft_opt_out.go b/x/ccv/consumer/keeper/soft_opt_out.go index 54d7efcefd..39b5bc22bc 100644 --- a/x/ccv/consumer/keeper/soft_opt_out.go +++ b/x/ccv/consumer/keeper/soft_opt_out.go @@ -7,7 +7,6 @@ import ( "sort" "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" diff --git a/x/ccv/consumer/migrations/v2/migration.go b/x/ccv/consumer/migrations/v2/migration.go index 6d56c03a48..a0b401188d 100644 --- a/x/ccv/consumer/migrations/v2/migration.go +++ b/x/ccv/consumer/migrations/v2/migration.go @@ -4,7 +4,6 @@ import ( "fmt" storetypes "cosmossdk.io/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" consumertypes "github.com/cosmos/interchain-security/v5/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 02827af15e..0b3f24ec75 100644 --- a/x/ccv/consumer/migrations/v2/migration_test.go +++ b/x/ccv/consumer/migrations/v2/migration_test.go @@ -7,9 +7,7 @@ import ( "github.com/stretchr/testify/require" 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" diff --git a/x/ccv/consumer/migrations/v3/migration.go b/x/ccv/consumer/migrations/v3/migration.go index e8c404417c..aadc94bc43 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/v5/x/ccv/consumer/types" ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" ) diff --git a/x/ccv/consumer/migrations/v3/migration_test.go b/x/ccv/consumer/migrations/v3/migration_test.go index ba84aaa4d3..bdc3f59f70 100644 --- a/x/ccv/consumer/migrations/v3/migration_test.go +++ b/x/ccv/consumer/migrations/v3/migration_test.go @@ -5,16 +5,15 @@ 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/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/stretchr/testify/require" ) type testLegacyParamSubspace struct { From 1cf874dc2add2db100dd1b8d991cdd9bd03daf47 Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Tue, 2 Jul 2024 10:49:35 +0200 Subject: [PATCH 24/32] Remove more formatting --- app/consumer-democracy/abci.go | 4 ++-- app/consumer-democracy/app.go | 21 ++++++++++--------- app/encoding/encoding.go | 4 +--- app/provider/abci.go | 4 ++-- app/provider/app.go | 28 ++++++++++++------------- 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 ++--- x/ccv/consumer/ibc_module.go | 2 +- x/ccv/consumer/ibc_module_test.go | 2 +- 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/provider/keeper/keeper.go | 14 +++++++------ 16 files changed, 51 insertions(+), 56 deletions(-) diff --git a/app/consumer-democracy/abci.go b/app/consumer-democracy/abci.go index f0020562aa..94b34cc3bb 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 580c47aa8f..b7506eb0c7 100644 --- a/app/consumer-democracy/app.go +++ b/app/consumer-democracy/app.go @@ -8,11 +8,7 @@ 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" @@ -30,7 +26,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" @@ -38,11 +34,6 @@ 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" @@ -90,6 +81,14 @@ 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" @@ -104,9 +103,11 @@ 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/v5/app/encoding" testutil "github.com/cosmos/interchain-security/v5/testutil/integration" diff --git a/app/encoding/encoding.go b/app/encoding/encoding.go index 2f3b0ace5d..216adac79c 100644 --- a/app/encoding/encoding.go +++ b/app/encoding/encoding.go @@ -1,16 +1,14 @@ 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 f0020562aa..94b34cc3bb 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 c1ef7818f2..4c998bdc13 100644 --- a/app/provider/app.go +++ b/app/provider/app.go @@ -8,11 +8,7 @@ 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" @@ -30,7 +26,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" @@ -39,7 +35,6 @@ 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" @@ -55,11 +50,9 @@ 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/types/msgservice" - sigtypes "github.com/cosmos/cosmos-sdk/types/tx/signing" "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/auth/ante" @@ -67,7 +60,6 @@ import ( authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" "github.com/cosmos/cosmos-sdk/x/auth/posthandler" authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" - txmodule "github.com/cosmos/cosmos-sdk/x/auth/tx/config" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/auth/vesting" vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" @@ -101,21 +93,29 @@ 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/cosmos-sdk/x/staking" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/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/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" ibcproviderclient "github.com/cosmos/interchain-security/v5/x/ccv/provider/client" ibcproviderkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + + "github.com/cosmos/cosmos-sdk/testutil/testdata/testpb" + sigtypes "github.com/cosmos/cosmos-sdk/types/tx/signing" + txmodule "github.com/cosmos/cosmos-sdk/x/auth/tx/config" ) const ( @@ -152,7 +152,7 @@ var ( mint.AppModuleBasic{}, slashing.AppModuleBasic{}, distr.AppModuleBasic{}, - no_valupdates_staking.AppModuleBasic{}, + staking.AppModuleBasic{}, upgrade.AppModuleBasic{}, evidence.AppModuleBasic{}, @@ -536,7 +536,7 @@ func New( // NOTE: Any module instantiated in the module manager that is later modified // must be passed by reference here. app.MM = module.NewManager( - no_valupdates_genutil.NewAppModule( + genutil.NewAppModule( app.AccountKeeper, app.StakingKeeper, app, @@ -552,7 +552,7 @@ func New( mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)), slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName), app.interfaceRegistry), distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)), - no_valupdates_staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)), + staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)), upgrade.NewAppModule(&app.UpgradeKeeper, app.AccountKeeper.AddressCodec()), evidence.NewAppModule(app.EvidenceKeeper), diff --git a/cmd/interchain-security-cd/cmd/root.go b/cmd/interchain-security-cd/cmd/root.go index cd551056ff..0a980f3452 100644 --- a/cmd/interchain-security-cd/cmd/root.go +++ b/cmd/interchain-security-cd/cmd/root.go @@ -5,14 +5,11 @@ 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,7 +29,9 @@ 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/v5/app/consumer" appencoding "github.com/cosmos/interchain-security/v5/app/encoding" diff --git a/cmd/interchain-security-cdd/cmd/root.go b/cmd/interchain-security-cdd/cmd/root.go index a21c696244..b71e1422c1 100644 --- a/cmd/interchain-security-cdd/cmd/root.go +++ b/cmd/interchain-security-cdd/cmd/root.go @@ -5,14 +5,11 @@ 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" @@ -36,7 +33,9 @@ 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/v5/app/consumer-democracy" appencoding "github.com/cosmos/interchain-security/v5/app/encoding" diff --git a/cmd/interchain-security-pd/cmd/root.go b/cmd/interchain-security-pd/cmd/root.go index 0ee7bdc06f..da0d719981 100644 --- a/cmd/interchain-security-pd/cmd/root.go +++ b/cmd/interchain-security-pd/cmd/root.go @@ -5,14 +5,11 @@ 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" @@ -36,7 +33,9 @@ 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/v5/app/encoding" providerApp "github.com/cosmos/interchain-security/v5/app/provider" diff --git a/cmd/interchain-security-sd/cmd/root.go b/cmd/interchain-security-sd/cmd/root.go index 68a9c5a421..5e65e536fb 100644 --- a/cmd/interchain-security-sd/cmd/root.go +++ b/cmd/interchain-security-sd/cmd/root.go @@ -5,14 +5,11 @@ 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" @@ -36,7 +33,9 @@ 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/v5/app/encoding" sovereignApp "github.com/cosmos/interchain-security/v5/app/sovereign" diff --git a/x/ccv/consumer/ibc_module.go b/x/ccv/consumer/ibc_module.go index f4f00016d5..d9cbcd6bde 100644 --- a/x/ccv/consumer/ibc_module.go +++ b/x/ccv/consumer/ibc_module.go @@ -5,7 +5,6 @@ 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" @@ -16,6 +15,7 @@ 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/v5/x/ccv/consumer/keeper" consumertypes "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" diff --git a/x/ccv/consumer/ibc_module_test.go b/x/ccv/consumer/ibc_module_test.go index 9196377754..029a4accd5 100644 --- a/x/ccv/consumer/ibc_module_test.go +++ b/x/ccv/consumer/ibc_module_test.go @@ -3,7 +3,6 @@ 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" @@ -12,6 +11,7 @@ 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/v5/testutil/keeper" "github.com/cosmos/interchain-security/v5/x/ccv/consumer" diff --git a/x/ccv/consumer/module.go b/x/ccv/consumer/module.go index b61a3a50ee..49e19542be 100644 --- a/x/ccv/consumer/module.go +++ b/x/ccv/consumer/module.go @@ -5,11 +5,10 @@ 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 0f6d783218..947fb4feb0 100644 --- a/x/ccv/consumer/types/codec.go +++ b/x/ccv/consumer/types/codec.go @@ -1,8 +1,9 @@ package types import ( - codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" + + codectypes "github.com/cosmos/cosmos-sdk/codec/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 803e0e1e79..9e0bdacbb6 100644 --- a/x/ccv/democracy/distribution/module.go +++ b/x/ccv/democracy/distribution/module.go @@ -6,7 +6,6 @@ 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 e16ebc7bfb..57f243822f 100644 --- a/x/ccv/democracy/governance/module.go +++ b/x/ccv/democracy/governance/module.go @@ -7,7 +7,6 @@ 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/provider/keeper/keeper.go b/x/ccv/provider/keeper/keeper.go index 0959358ffb..22f5f33626 100644 --- a/x/ccv/provider/keeper/keeper.go +++ b/x/ccv/provider/keeper/keeper.go @@ -7,7 +7,9 @@ import ( "reflect" "time" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + addresscodec "cosmossdk.io/core/address" + "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" @@ -15,16 +17,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" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" 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" consumertypes "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" From 9d0c9b70e4e2c8b9e5462b2c0859bdd96900e680 Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Tue, 2 Jul 2024 10:50:10 +0200 Subject: [PATCH 25/32] Revert extra formatting --- x/ccv/types/params.go | 1 - x/ccv/types/shared_params.go | 3 +-- x/ccv/types/utils.go | 5 ++--- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/x/ccv/types/params.go b/x/ccv/types/params.go index d16cbdc63e..72a95ae7dd 100644 --- a/x/ccv/types/params.go +++ b/x/ccv/types/params.go @@ -5,7 +5,6 @@ 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 4492ef5bd8..fa2e28c81c 100644 --- a/x/ccv/types/shared_params.go +++ b/x/ccv/types/shared_params.go @@ -4,9 +4,8 @@ import ( fmt "fmt" "time" - ibchost "github.com/cosmos/ibc-go/v8/modules/core/24-host" - "cosmossdk.io/math" + ibchost "github.com/cosmos/ibc-go/v8/modules/core/24-host" sdktypes "github.com/cosmos/cosmos-sdk/types" ) diff --git a/x/ccv/types/utils.go b/x/ccv/types/utils.go index b1bd510196..3f69de50ad 100644 --- a/x/ccv/types/utils.go +++ b/x/ccv/types/utils.go @@ -7,13 +7,12 @@ 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" From 4a5b80c137719378146811e4083df3354217c0b4 Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Tue, 2 Jul 2024 10:58:48 +0200 Subject: [PATCH 26/32] Re-wire provider/app.go to use wrapped modules --- app/provider/app.go | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/app/provider/app.go b/app/provider/app.go index 4c998bdc13..c1ef7818f2 100644 --- a/app/provider/app.go +++ b/app/provider/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" @@ -35,6 +39,7 @@ 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" @@ -50,9 +55,11 @@ 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/types/msgservice" + sigtypes "github.com/cosmos/cosmos-sdk/types/tx/signing" "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/auth/ante" @@ -60,6 +67,7 @@ import ( authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" "github.com/cosmos/cosmos-sdk/x/auth/posthandler" authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" + txmodule "github.com/cosmos/cosmos-sdk/x/auth/tx/config" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/auth/vesting" vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" @@ -93,29 +101,21 @@ 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/cosmos-sdk/x/staking" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/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/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" ibcproviderclient "github.com/cosmos/interchain-security/v5/x/ccv/provider/client" ibcproviderkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" - - "github.com/cosmos/cosmos-sdk/testutil/testdata/testpb" - sigtypes "github.com/cosmos/cosmos-sdk/types/tx/signing" - txmodule "github.com/cosmos/cosmos-sdk/x/auth/tx/config" ) const ( @@ -152,7 +152,7 @@ var ( mint.AppModuleBasic{}, slashing.AppModuleBasic{}, distr.AppModuleBasic{}, - staking.AppModuleBasic{}, + no_valupdates_staking.AppModuleBasic{}, upgrade.AppModuleBasic{}, evidence.AppModuleBasic{}, @@ -536,7 +536,7 @@ func New( // NOTE: Any module instantiated in the module manager that is later modified // must be passed by reference here. app.MM = module.NewManager( - genutil.NewAppModule( + no_valupdates_genutil.NewAppModule( app.AccountKeeper, app.StakingKeeper, app, @@ -552,7 +552,7 @@ func New( mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)), slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName), app.interfaceRegistry), distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)), - staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)), + no_valupdates_staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)), upgrade.NewAppModule(&app.UpgradeKeeper, app.AccountKeeper.AddressCodec()), evidence.NewAppModule(app.EvidenceKeeper), From 96fbd4eef2a2480b09a16b7dfcd73791d3ed48bb Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Tue, 2 Jul 2024 16:33:21 +0200 Subject: [PATCH 27/32] Remove consumer rewards check --- tests/e2e/steps_inactive_vals.go | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/tests/e2e/steps_inactive_vals.go b/tests/e2e/steps_inactive_vals.go index b657dda8a7..3fbdbe19d0 100644 --- a/tests/e2e/steps_inactive_vals.go +++ b/tests/e2e/steps_inactive_vals.go @@ -288,18 +288,6 @@ func stepsInactiveProviderValidators() []Step { ValidatorID("carol"): 1000, }, }, - ChainID("provi"): ChainState{ - // check that alice and bob don't get consumer rewards - Rewards: &Rewards{ - IsNativeDenom: false, // check for rewards from consumer - IsIncrementalReward: true, // check rewards for currently produced blocks only - IsRewarded: map[ValidatorID]bool{ - ValidatorID("alice"): false, - ValidatorID("bob"): false, - ValidatorID("carol"): true, - }, - }, - }, }, }, // unjail alice From 2ee5c6d93f27a375eb93fb18c3dc848738415770 Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Wed, 3 Jul 2024 13:42:35 +0200 Subject: [PATCH 28/32] Add inactive provider vals testcase to nightly --- .github/workflows/nightly-e2e.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/nightly-e2e.yml b/.github/workflows/nightly-e2e.yml index b279c59714..0cf3b7e80b 100644 --- a/.github/workflows/nightly-e2e.yml +++ b/.github/workflows/nightly-e2e.yml @@ -310,6 +310,23 @@ jobs: - name: E2E active set changes run: go run ./tests/e2e/... --tc active-set-changes + inactive-provider-validators-on-consumer-test: + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/setup-go@v5 + with: + go-version: "1.22" + - uses: actions/checkout@v4 + - name: Checkout LFS objects + run: git lfs checkout + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: "1.22" # The Go version to download (if necessary) and use. + - name: E2E active set changes + run: go run ./tests/e2e/... --tc inactive-provider-validators-on-consumer + nightly-test-fail: needs: - happy-path-test From ed93ba0ceaabed0cdbfb4535be74a98e3d6ddc8a Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Wed, 3 Jul 2024 13:44:27 +0200 Subject: [PATCH 29/32] Adjust comment --- tests/e2e/steps_inactive_vals.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/e2e/steps_inactive_vals.go b/tests/e2e/steps_inactive_vals.go index 3fbdbe19d0..81b511ce51 100644 --- a/tests/e2e/steps_inactive_vals.go +++ b/tests/e2e/steps_inactive_vals.go @@ -43,7 +43,9 @@ func stepsInactiveProviderValidators() []Step { }, Rewards: &Rewards{ IsNativeDenom: true, // check for rewards in the provider denom - IsIncrementalReward: true, // check current rewards, because alice gets one block of rewards due to being in the genesis + IsIncrementalReward: true, // we need to get incremental rewards + // if we would look at total rewards, alice would trivially also get rewards, + // because she gets rewards in the first block due to being in the genesis IsRewarded: map[ValidatorID]bool{ ValidatorID("alice"): false, ValidatorID("bob"): true, From 5ff56e8714b25396d269b4fcf794c2c1db23f2c2 Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Wed, 3 Jul 2024 14:54:24 +0200 Subject: [PATCH 30/32] Address comments --- tests/e2e/steps_inactive_vals.go | 5 ++--- x/ccv/no_valupdates_genutil/doc.go | 4 ++-- x/ccv/provider/keeper/genesis_test.go | 1 - x/ccv/provider/keeper/relay.go | 6 +++--- x/ccv/provider/keeper/relay_test.go | 2 +- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/tests/e2e/steps_inactive_vals.go b/tests/e2e/steps_inactive_vals.go index 81b511ce51..7e6f7a3b4a 100644 --- a/tests/e2e/steps_inactive_vals.go +++ b/tests/e2e/steps_inactive_vals.go @@ -13,8 +13,8 @@ import ( // high-level, this test does: // - start the provider chain // - start a consumer chain -// - check that non-consensus validators do not get slashed for downtime; and that they don't get rewards -// - check that active validators *do* get slashed for downtime, and don't get rewards while they are down +// - check that non-consensus validators do not get slashed for downtime on the provider; and that they don't get rewards +// - check that active validators *do* get slashed for downtime on the provider, and don't get rewards while they are down // - check that non-consensus validators *do* get jailed for downtime on consumer chains // - check that non-consensus validators *become* consensus validators when they have enough power func stepsInactiveProviderValidators() []Step { @@ -144,7 +144,6 @@ func stepsInactiveProviderValidators() []Step { }, State: State{ ChainID("provi"): ChainState{ - // check that now every validator got rewarded since the first block Rewards: &Rewards{ IsNativeDenom: true, // check for rewards in the provider denom IsIncrementalReward: true, // check rewards for currently produced blocks only diff --git a/x/ccv/no_valupdates_genutil/doc.go b/x/ccv/no_valupdates_genutil/doc.go index 466804b6cc..08ad53a8cb 100644 --- a/x/ccv/no_valupdates_genutil/doc.go +++ b/x/ccv/no_valupdates_genutil/doc.go @@ -1,8 +1,8 @@ /* Package staking defines a "wrapper" module around the Cosmos SDK's native -x/staking module. In other words, it provides the exact same functionality as +x/genutil module. In other words, it provides the exact same functionality as the native module in that it simply embeds the native module. However, it -overrides `EndBlock` which will return no validator set updates. Instead, +overrides `InitGenesis` which will return no validator set updates. Instead, it is assumed that some other module will provide the validator set updates. */ package genutil diff --git a/x/ccv/provider/keeper/genesis_test.go b/x/ccv/provider/keeper/genesis_test.go index 179c741959..07fd2ba229 100644 --- a/x/ccv/provider/keeper/genesis_test.go +++ b/x/ccv/provider/keeper/genesis_test.go @@ -154,7 +154,6 @@ func TestInitAndExportGenesis(t *testing.T) { ) mocks.MockStakingKeeper.EXPECT().GetBondedValidatorsByPower(gomock.Any()).Return( - // return an empty set of validators, since they are not tested against here []stakingtypes.Validator{ provVal, }, nil).AnyTimes() diff --git a/x/ccv/provider/keeper/relay.go b/x/ccv/provider/keeper/relay.go index 2ae796adfa..9254347c3d 100644 --- a/x/ccv/provider/keeper/relay.go +++ b/x/ccv/provider/keeper/relay.go @@ -180,9 +180,9 @@ func (k Keeper) EndBlockVSU(ctx sdk.Context) ([]abci.ValidatorUpdate, error) { // 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 { // get the bonded validators from the staking module - bondedValidators, error := k.stakingKeeper.GetBondedValidatorsByPower(ctx) - if error != nil { - panic(fmt.Errorf("failed to get bonded validators: %w", error)) + bondedValidators, err := k.stakingKeeper.GetBondedValidatorsByPower(ctx) + if err != nil { + panic(fmt.Errorf("failed to get bonded validators: %w", err)) } // get the last validator set sent to consensus diff --git a/x/ccv/provider/keeper/relay_test.go b/x/ccv/provider/keeper/relay_test.go index 3d4e2ca7a5..98ddaab3fe 100644 --- a/x/ccv/provider/keeper/relay_test.go +++ b/x/ccv/provider/keeper/relay_test.go @@ -775,7 +775,7 @@ func TestEndBlockVSU(t *testing.T) { testkeeper.SetupMocksForLastBondedValidatorsExpectation(mocks.MockStakingKeeper, 5, lastValidators, powers, -1) sort.Slice(lastValidators, func(i, j int) bool { - return lastValidators[i].ConsensusPower(sdk.DefaultPowerReduction) > + return lastValidators[i].GetConsensusPower(sdk.DefaultPowerReduction) > lastValidators[j].GetConsensusPower(sdk.DefaultPowerReduction) }) mocks.MockStakingKeeper.EXPECT().GetBondedValidatorsByPower(gomock.Any()).Return(lastValidators, nil).AnyTimes() From 9c5028b928da06d1b2fd9750736a0946877dc830 Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Wed, 3 Jul 2024 14:55:43 +0200 Subject: [PATCH 31/32] Fix nightly test name --- .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 0cf3b7e80b..ffc8ff363f 100644 --- a/.github/workflows/nightly-e2e.yml +++ b/.github/workflows/nightly-e2e.yml @@ -324,7 +324,7 @@ jobs: uses: actions/setup-go@v5 with: go-version: "1.22" # The Go version to download (if necessary) and use. - - name: E2E active set changes + - name: E2E inactive provider validators on consumer run: go run ./tests/e2e/... --tc inactive-provider-validators-on-consumer nightly-test-fail: From 60e9e7f3dbded180d8d08d18586cf8de891c2c64 Mon Sep 17 00:00:00 2001 From: Philip Offtermatt <57488781+p-offtermatt@users.noreply.github.com> Date: Mon, 15 Jul 2024 13:30:03 +0200 Subject: [PATCH 32/32] feat: Initialize the max validators parameter for existing consumers (#2012) * Add initialization for validator cap * Remove migration test * Fix inconsistent naming --- x/ccv/provider/migrations/vX/migrations.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 x/ccv/provider/migrations/vX/migrations.go diff --git a/x/ccv/provider/migrations/vX/migrations.go b/x/ccv/provider/migrations/vX/migrations.go new file mode 100644 index 0000000000..9040c82ee2 --- /dev/null +++ b/x/ccv/provider/migrations/vX/migrations.go @@ -0,0 +1,16 @@ +package v6 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" +) + +// 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)) + } +}