Skip to content

Commit

Permalink
Remove std/random again
Browse files Browse the repository at this point in the history
  • Loading branch information
zah committed Jan 21, 2021
1 parent 718feef commit 960666d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions beacon_chain/nimbus_beacon_node.nim
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import
# Standard library
std/[math, os, strformat, strutils, tables, times,
random, # TODO: review usage of Nim RNG
terminal, osproc],
system/ansi_c,

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

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

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

Expand Down

0 comments on commit 960666d

Please sign in to comment.