Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unbreak unstable (std/random missing after dup validator protection) #2255

Merged
merged 1 commit into from
Jan 21, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion beacon_chain/nimbus_beacon_node.nim
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
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 @@ -655,6 +656,9 @@ 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?

# 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
Expand Down Expand Up @@ -1749,4 +1753,3 @@ programMain:
waitFor testWeb3Provider(config.web3TestUrl,
depositContractAddress,
depositContractDeployedAt)