|
|
|
@ -2574,6 +2574,23 @@ func (bc *BlockChain) UpdateValidatorVotingPower( |
|
|
|
|
spread = numeric.NewDecFromBigInt(wrapper.TotalDelegation()). |
|
|
|
|
QuoInt64(int64(len(wrapper.SlotPubKeys))) |
|
|
|
|
} |
|
|
|
|
instance := shard.Schedule.InstanceForEpoch(newEpochSuperCommittee.Epoch) |
|
|
|
|
limitedSlotsCount := 0 // limited slots count for HIP16
|
|
|
|
|
slotsLimit := instance.SlotsLimit() |
|
|
|
|
if slotsLimit > 0 { |
|
|
|
|
shardCount := big.NewInt(int64(instance.NumShards())) |
|
|
|
|
shardSlotsCount := make([]int, shardCount.Uint64()) // number slots keys on each shard
|
|
|
|
|
for _, pubkey := range wrapper.SlotPubKeys { |
|
|
|
|
shardIndex := new(big.Int).Mod(pubkey.Big(), shardCount).Uint64() |
|
|
|
|
shardSlotsCount[shardIndex] += 1 |
|
|
|
|
if shardSlotsCount[shardIndex] > slotsLimit { |
|
|
|
|
continue |
|
|
|
|
} |
|
|
|
|
limitedSlotsCount += 1 |
|
|
|
|
} |
|
|
|
|
spread = numeric.NewDecFromBigInt(wrapper.TotalDelegation()). |
|
|
|
|
QuoInt64(int64(limitedSlotsCount)) |
|
|
|
|
} |
|
|
|
|
for i := range stats.MetricsPerShard { |
|
|
|
|
stats.MetricsPerShard[i].Vote.RawStake = spread |
|
|
|
|
} |
|
|
|
|