Skip to content

Commit

Permalink
Removed priority list from migrations.go
Browse files Browse the repository at this point in the history
  • Loading branch information
kirdatatjana committed Oct 22, 2024
1 parent 837a078 commit 04e9c57
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 19 deletions.
2 changes: 1 addition & 1 deletion x/ccv/provider/keeper/power_shaping_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,7 @@ func TestFilterAndSortPriorityList(t *testing.T) {
}
}

// Helper function to check if validators are sorted by power in descending order
// Checks if validators are sorted by power in descending order
func checkSortedByPower(t *testing.T, validators []providertypes.ConsensusValidator) {
for i := 1; i < len(validators); i++ {
require.GreaterOrEqual(t, validators[i-1].Power, validators[i].Power, "Validators are not sorted by power in descending order")
Expand Down
8 changes: 0 additions & 8 deletions x/ccv/provider/migrations/v8/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,6 @@ func MigrateLaunchedConsumerChains(ctx sdk.Context, store storetypes.KVStore, pk
return err
}

// chainId -> Prioritylist
err = rekeyChainIdAndConsAddrKey(store, providertypes.PrioritylistKeyPrefix(), chainId, consumerId)
if err != nil {
return err
}

// chainId -> ConsumerRewardsAllocations
rekeyFromChainIdToConsumerId(store, ConsumerRewardsAllocationKeyPrefix, chainId, consumerId)

Expand Down Expand Up @@ -292,7 +286,6 @@ func MigrateLaunchedConsumerChains(ctx sdk.Context, store storetypes.KVStore, pk

allowlist := TransformConsAddressesToBech32Addresses(pk.GetAllowList(ctx, consumerId))
denylist := TransformConsAddressesToBech32Addresses(pk.GetDenyList(ctx, consumerId))
prioritylist := TransformConsAddressesToBech32Addresses(pk.GetPriorityList(ctx, consumerId))

powerShapingParameters := providertypes.PowerShapingParameters{
Top_N: topN,
Expand All @@ -303,7 +296,6 @@ func MigrateLaunchedConsumerChains(ctx sdk.Context, store storetypes.KVStore, pk
// do not set those since they do not exist in a previous interchain-security version and hence cannot be set
MinStake: 0,
AllowInactiveVals: false,
Prioritylist: prioritylist,
}
err = pk.SetConsumerPowerShapingParameters(ctx, consumerId, powerShapingParameters)
if err != nil {
Expand Down
10 changes: 0 additions & 10 deletions x/ccv/provider/migrations/v8/migrations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,6 @@ func StoreChainDataUsingChainIdAsKey(ctx sdk.Context, store storetypes.KVStore,

providerKeeper.AppendConsumerAddrsToPrune(ctx, data.ChainId, data.PruneTs, data.ConsumerAddr)

providerKeeper.SetPrioritylist(ctx, data.ChainId, data.ProviderAddr)

// set Top N
topNKey := providertypes.StringIdWithLenKey(LegacyTopNKeyPrefix, data.ChainId)
buf := make([]byte, 4)
Expand Down Expand Up @@ -291,14 +289,6 @@ func GetChainDataUsingStringId(ctx sdk.Context, providerKeeper providerkeeper.Ke
}
}

prioritylist := providerKeeper.GetPriorityList(ctx, id)
if len(prioritylist) > 0 {
tempProviderAddr := prioritylist[0]
if stopEarly && tempProviderAddr.String() != providerAddr.String() {
return ChainData{}, fmt.Errorf("retrieved providerAddr (%s) should be (%s)", tempProviderAddr.String(), providerAddr.String())
}
}

consumerCommissionRate, found := providerKeeper.GetConsumerCommissionRate(ctx, id, providerAddr)
if found {
data.ConsumerCommissionRate = consumerCommissionRate
Expand Down

0 comments on commit 04e9c57

Please sign in to comment.