Skip to content

Commit 960666d

Browse files
committed
Remove std/random again
1 parent 718feef commit 960666d

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

beacon_chain/nimbus_beacon_node.nim

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import
99
# Standard library
1010
std/[math, os, strformat, strutils, tables, times,
11-
random, # TODO: review usage of Nim RNG
1211
terminal, osproc],
1312
system/ansi_c,
1413

@@ -656,12 +655,11 @@ proc setupSelfSlashingProtection(node: BeaconNode, slot: Slot) =
656655
# 2 epochs is dangerous because it'll guarantee colliding probes in the
657656
# overlapping case.
658657

659-
# TODO: is a pseudo-random RNG enough here?
660-
# If so, should we store the state explicitly?
658+
let rng = node.network.rng
661659

662660
# So dPE == 2 -> epoch + 1, always; dPE == 3 -> epoch + (1 or 2), etc.
663661
node.processor.gossipSlashingProtection.probeEpoch =
664-
slot.epoch + 1 + rand(duplicateValidatorEpochs.int - 2).uint64
662+
slot.epoch + 1 + rng[].rand(duplicateValidatorEpochs.int - 2).uint64
665663
doAssert node.processor.gossipSlashingProtection.probeEpoch <
666664
node.processor.gossipSlashingProtection.broadcastStartEpoch
667665

0 commit comments

Comments
 (0)