mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 23:48:06 -05:00
QSP-9 Prevent Casting to Int if Possible (#6349)
* no cast to int * fix up significant casting issues * more casting * even more casting fixes * more casts * fix subnets * back to ints * final touches * broken test fix * add in blocks test fix * unskip * revert bytes fixes * casting fixes * Update beacon-chain/db/kv/state.go * Update beacon-chain/db/kv/blocks.go * fmt * slash: * fix val tests * fix up conf Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com> Co-authored-by: Victor Farazdagi <simple.square@gmail.com>
This commit is contained in:
@@ -53,18 +53,18 @@ func TestShuffleList_OK(t *testing.T) {
|
||||
|
||||
func TestSplitIndices_OK(t *testing.T) {
|
||||
var l []uint64
|
||||
validators := 64000
|
||||
for i := 0; i < validators; i++ {
|
||||
l = append(l, uint64(i))
|
||||
numValidators := uint64(64000)
|
||||
for i := uint64(0); i < numValidators; i++ {
|
||||
l = append(l, i)
|
||||
}
|
||||
split := SplitIndices(l, params.BeaconConfig().SlotsPerEpoch)
|
||||
if len(split) != int(params.BeaconConfig().SlotsPerEpoch) {
|
||||
if uint64(len(split)) != params.BeaconConfig().SlotsPerEpoch {
|
||||
t.Errorf("Split list failed due to incorrect length, wanted:%v, got:%v", params.BeaconConfig().SlotsPerEpoch, len(split))
|
||||
}
|
||||
|
||||
for _, s := range split {
|
||||
if len(s) != validators/int(params.BeaconConfig().SlotsPerEpoch) {
|
||||
t.Errorf("Split list failed due to incorrect length, wanted:%v, got:%v", validators/int(params.BeaconConfig().SlotsPerEpoch), len(s))
|
||||
if uint64(len(s)) != numValidators/params.BeaconConfig().SlotsPerEpoch {
|
||||
t.Errorf("Split list failed due to incorrect length, wanted:%v, got:%v", numValidators/params.BeaconConfig().SlotsPerEpoch, len(s))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user