From 45c5f10a09801b1e8284adb5ac1bc4fc2cbc662a Mon Sep 17 00:00:00 2001 From: insumity Date: Mon, 4 Mar 2024 16:56:14 +0100 Subject: [PATCH] cleaning up --- x/ccv/provider/keeper/key_assignment_test.go | 9 ++++----- x/ccv/provider/types/keys.go | 8 +++++--- x/ccv/provider/types/keys_test.go | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/x/ccv/provider/keeper/key_assignment_test.go b/x/ccv/provider/keeper/key_assignment_test.go index 02fc64f004..7cb222a3be 100644 --- a/x/ccv/provider/keeper/key_assignment_test.go +++ b/x/ccv/provider/keeper/key_assignment_test.go @@ -666,7 +666,7 @@ func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { assignableIDS = append(assignableIDS, cryptotestutil.NewCryptoIdentityFromIntSeed(i)) } - seed := int64(1) //time.Now().UnixNano() + seed := time.Now().UnixNano() rng := rand.New(rand.NewSource(seed)) // Helper: simulates creation of staking module EndBlock updates. @@ -711,7 +711,6 @@ func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { providerValset := CreateValSet(providerIDS) // NOTE: consumer must have space for provider identities because default key assignments are to provider keys consumerValset := CreateValSet(assignableIDS) - // For each validator on the consumer, record the corresponding provider // address as looked up on the provider using GetProviderAddrFromConsumerAddr // at a given vscid. @@ -754,7 +753,7 @@ func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { // Helper: apply some updates to both the provider and consumer valsets // and increment the provider vscid. - applyUpdatesAndIncrementVSCID := func(updates []abci.ValidatorUpdate, assignments []Assignment) { + applyUpdatesAndIncrementVSCID := func(updates []abci.ValidatorUpdate) { providerValset.apply(updates) var bondedValidators []stakingtypes.Validator @@ -792,7 +791,7 @@ func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { // be put into the consumer genesis. stakingUpdates := getStakingUpdates() - applyUpdatesAndIncrementVSCID(stakingUpdates, assignments) + applyUpdatesAndIncrementVSCID(stakingUpdates) // Register the consumer chain k.SetConsumerClientId(ctx, CHAINID, "") @@ -811,7 +810,7 @@ func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { // Generate and apply assignments and power updates applyAssignments(assignments) - applyUpdatesAndIncrementVSCID(stakingUpdates, assignments) + applyUpdatesAndIncrementVSCID(stakingUpdates) // Randomly fast forward the greatest pruned VSCID. This simulates // delivery of maturity packets from the consumer chain. diff --git a/x/ccv/provider/types/keys.go b/x/ccv/provider/types/keys.go index 27bf8cae74..b70a2f4cd8 100644 --- a/x/ccv/provider/types/keys.go +++ b/x/ccv/provider/types/keys.go @@ -120,8 +120,10 @@ const ( // on consumer chains to validator addresses on the provider chain ValidatorsByConsumerAddrBytePrefix - // DeprecatedKeyAssignmentReplacementsBytePrefix is the byte prefix that will store the key assignments that need to be replaced in the current block - DeprecatedKeyAssignmentReplacementsBytePrefix + // KeyAssignmentReplacementsBytePrefix was the byte prefix used to store the key assignments that needed to be replaced in the current block + // NOTE: This prefix is depreciated, but left in place to avoid consumer state migrations + // [DEPRECATED] + KeyAssignmentReplacementsBytePrefix // ConsumerAddrsToPruneBytePrefix is the byte prefix that will store the mapping from VSC ids // to consumer validators addresses needed for pruning @@ -368,7 +370,7 @@ func ValidatorsByConsumerAddrKey(chainID string, addr ConsumerConsAddress) []byt // DeprecatedKeyAssignmentReplacementsKey returns the key under which the // key assignments that need to be replaced in the current block are stored func DeprecatedKeyAssignmentReplacementsKey(chainID string, addr ProviderConsAddress) []byte { - return ChainIdAndConsAddrKey(DeprecatedKeyAssignmentReplacementsBytePrefix, chainID, addr.ToSdkConsAddr()) + return ChainIdAndConsAddrKey(KeyAssignmentReplacementsBytePrefix, chainID, addr.ToSdkConsAddr()) } // ConsumerAddrsToPruneKey returns the key under which the diff --git a/x/ccv/provider/types/keys_test.go b/x/ccv/provider/types/keys_test.go index 0a56f799e1..a772d61ccb 100644 --- a/x/ccv/provider/types/keys_test.go +++ b/x/ccv/provider/types/keys_test.go @@ -50,7 +50,7 @@ func getAllKeyPrefixes() []byte { providertypes.GlobalSlashEntryBytePrefix, providertypes.ConsumerValidatorsBytePrefix, providertypes.ValidatorsByConsumerAddrBytePrefix, - providertypes.DeprecatedKeyAssignmentReplacementsBytePrefix, + providertypes.KeyAssignmentReplacementsBytePrefix, providertypes.ConsumerAddrsToPruneBytePrefix, providertypes.SlashLogBytePrefix, providertypes.VSCMaturedHandledThisBlockBytePrefix,