From fc34aa8cc9a2e276d4a47331991f321e26e64c83 Mon Sep 17 00:00:00 2001 From: insumity Date: Tue, 6 Aug 2024 13:24:31 +0300 Subject: [PATCH] rebased to pick up the inactive-validators work (PR #2079) --- x/ccv/provider/keeper/legacy_proposal_test.go | 2 ++ x/ccv/provider/keeper/permissionless.go | 3 +++ x/ccv/provider/keeper/validator_set_update.go | 2 +- x/ccv/provider/types/keys_test.go | 10 ++++++---- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/x/ccv/provider/keeper/legacy_proposal_test.go b/x/ccv/provider/keeper/legacy_proposal_test.go index c5bb596681..346be55d07 100644 --- a/x/ccv/provider/keeper/legacy_proposal_test.go +++ b/x/ccv/provider/keeper/legacy_proposal_test.go @@ -182,6 +182,8 @@ func TestUpdateConsumer(t *testing.T) { ValidatorSetCap: expectedValidatorSetCap, Allowlist: []string{expectedAllowlistedValidator}, Denylist: []string{expectedDenylistedValidator}, + MinStake: expectedMinStake, + AllowInactiveVals: expectedAllowInactiveValidators, } providerKeeper.SetConsumerIdToPhase(ctx, consumerId, providerkeeper.Initialized) diff --git a/x/ccv/provider/keeper/permissionless.go b/x/ccv/provider/keeper/permissionless.go index 120bdc9a84..b106183308 100644 --- a/x/ccv/provider/keeper/permissionless.go +++ b/x/ccv/provider/keeper/permissionless.go @@ -377,6 +377,9 @@ func (k Keeper) UpdateConsumer(ctx sdk.Context, consumerId string) error { } } + k.SetMinStake(ctx, consumerId, updateRecord.MinStake) + k.SetInactiveValidatorsAllowed(ctx, consumerId, updateRecord.AllowInactiveVals) + return nil } diff --git a/x/ccv/provider/keeper/validator_set_update.go b/x/ccv/provider/keeper/validator_set_update.go index 1c55f26553..b4ed48f4e1 100644 --- a/x/ccv/provider/keeper/validator_set_update.go +++ b/x/ccv/provider/keeper/validator_set_update.go @@ -14,7 +14,7 @@ import ( // GetConsumerChainConsensusValidatorsKey returns the store key for consumer validators of the consumer chain with `chainID` func (k Keeper) GetConsumerChainConsensusValidatorsKey(ctx sdk.Context, chainID string) []byte { - return types.ChainIdWithLenKey(types.ConsumerValidatorKeyPrefix(), chainID) + return types.ConsumerIdWithLenKey(types.ConsumerValidatorKeyPrefix(), chainID) } // SetConsumerValidator sets provided consumer `validator` on the consumer chain with `chainID` diff --git a/x/ccv/provider/types/keys_test.go b/x/ccv/provider/types/keys_test.go index 7c79c507f7..e0a4da3b49 100644 --- a/x/ccv/provider/types/keys_test.go +++ b/x/ccv/provider/types/keys_test.go @@ -124,17 +124,19 @@ func TestPreserveBytePrefix(t *testing.T) { i++ require.Equal(t, uint8(45), providertypes.ConsumerIdKey()[0]) i++ - require.Equal(t, uint8(47), providertypes.ConsumerIdToRegistrationRecordKey("consumerId")[0]) + require.Equal(t, uint8(46), providertypes.ConsumerIdToRegistrationRecordKey("consumerId")[0]) i++ - require.Equal(t, uint8(48), providertypes.ConsumerIdToInitializationRecordKey("consumerId")[0]) + require.Equal(t, uint8(47), providertypes.ConsumerIdToInitializationRecordKey("consumerId")[0]) + i++ + require.Equal(t, uint8(48), providertypes.ConsumerIdToUpdateRecordKey("consumerId")[0]) i++ require.Equal(t, uint8(49), providertypes.ConsumerIdToOwnerAddressKey("consumerId")[0]) i++ require.Equal(t, uint8(50), providertypes.ConsumerIdToPhaseKey("consumerId")[0]) i++ - require.Equal(t, uint8(52), providertypes.ConsumerIdToStopTimeKey("consumerId")[0]) + require.Equal(t, uint8(51), providertypes.ConsumerIdToStopTimeKey("consumerId")[0]) i++ - require.Equal(t, uint8(53), providertypes.ClientIdToConsumerIdKey("clientId")[0]) + require.Equal(t, uint8(52), providertypes.ClientIdToConsumerIdKey("clientId")[0]) i++ prefixes := providertypes.GetAllKeyPrefixes()