Skip to content

Commit

Permalink
cleaning up
Browse files Browse the repository at this point in the history
  • Loading branch information
insumity committed Mar 4, 2024
1 parent 48d596a commit 45c5f10
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
9 changes: 4 additions & 5 deletions x/ccv/provider/keeper/key_assignment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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, "")
Expand All @@ -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.
Expand Down
8 changes: 5 additions & 3 deletions x/ccv/provider/types/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion x/ccv/provider/types/keys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func getAllKeyPrefixes() []byte {
providertypes.GlobalSlashEntryBytePrefix,
providertypes.ConsumerValidatorsBytePrefix,
providertypes.ValidatorsByConsumerAddrBytePrefix,
providertypes.DeprecatedKeyAssignmentReplacementsBytePrefix,
providertypes.KeyAssignmentReplacementsBytePrefix,
providertypes.ConsumerAddrsToPruneBytePrefix,
providertypes.SlashLogBytePrefix,
providertypes.VSCMaturedHandledThisBlockBytePrefix,
Expand Down

0 comments on commit 45c5f10

Please sign in to comment.