Fix unstable after #2244 (#2255)

This commit is contained in:
Mamy Ratsimbazafy 2021-01-21 18:27:24 +01:00 committed by GitHub
parent 69d6ffd990
commit 718feef802
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -8,6 +8,7 @@
import import
# Standard library # Standard library
std/[math, os, strformat, strutils, tables, times, std/[math, os, strformat, strutils, tables, times,
random, # TODO: review usage of Nim RNG
terminal, osproc], terminal, osproc],
system/ansi_c, system/ansi_c,
@ -655,6 +656,9 @@ proc setupSelfSlashingProtection(node: BeaconNode, slot: Slot) =
# 2 epochs is dangerous because it'll guarantee colliding probes in the # 2 epochs is dangerous because it'll guarantee colliding probes in the
# overlapping case. # 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. # So dPE == 2 -> epoch + 1, always; dPE == 3 -> epoch + (1 or 2), etc.
node.processor.gossipSlashingProtection.probeEpoch = node.processor.gossipSlashingProtection.probeEpoch =
slot.epoch + 1 + rand(duplicateValidatorEpochs.int - 2).uint64 slot.epoch + 1 + rand(duplicateValidatorEpochs.int - 2).uint64
@ -1749,4 +1753,3 @@ programMain:
waitFor testWeb3Provider(config.web3TestUrl, waitFor testWeb3Provider(config.web3TestUrl,
depositContractAddress, depositContractAddress,
depositContractDeployedAt) depositContractDeployedAt)