Skip to content

Commit

Permalink
rebased to pick up the inactive-validators work (PR #2079)
Browse files Browse the repository at this point in the history
  • Loading branch information
insumity committed Aug 14, 2024
1 parent d6f890a commit 64ed6e7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
2 changes: 2 additions & 0 deletions x/ccv/provider/keeper/legacy_proposal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions x/ccv/provider/keeper/permissionless.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion x/ccv/provider/keeper/validator_set_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
10 changes: 6 additions & 4 deletions x/ccv/provider/types/keys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 64ed6e7

Please sign in to comment.