mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-02-23 03:38:21 +00:00
simplify doppelganger detection to boolean
This commit is contained in:
parent
c4c04197c5
commit
67e4a045a3
@ -51,11 +51,6 @@ type
|
||||
enabled # Always enabled
|
||||
disabled # Always disabled
|
||||
|
||||
DoppelgangerDetectionMode* {.pure.} = enum
|
||||
dontcheck
|
||||
warn
|
||||
stop
|
||||
|
||||
BeaconNodeConf* = object
|
||||
logLevel* {.
|
||||
defaultValue: "INFO"
|
||||
@ -266,10 +261,10 @@ type
|
||||
name: "dump" }: bool
|
||||
|
||||
doppelgangerDetection* {.
|
||||
defaultValue: DoppelgangerDetectionMode.stop
|
||||
desc: "[=stop*] What to do when another validator is detected to be running the same validator keys (default `stop`)"
|
||||
defaultValue: true
|
||||
desc: "Whether to detect whether another validator is be running the same validator keys (default true)"
|
||||
name: "doppelganger-detection"
|
||||
}: DoppelgangerDetectionMode
|
||||
}: bool
|
||||
|
||||
of createTestnet:
|
||||
testnetDepositsFile* {.
|
||||
|
@ -31,8 +31,8 @@ declareCounter beacon_proposer_slashings_received,
|
||||
declareCounter beacon_voluntary_exits_received,
|
||||
"Number of beacon chain voluntary exits received by this peer"
|
||||
|
||||
declareCounter beacon_duplicate_validator_protection_activated,
|
||||
"Number of times duplicate validator protection was activated"
|
||||
declareCounter doppelganger_detection_activated,
|
||||
"Number of times doppelganger detection was activated"
|
||||
|
||||
const delayBuckets = [2.0, 4.0, 6.0, 8.0, 10.0, 12.0, 14.0, Inf]
|
||||
|
||||
@ -307,15 +307,6 @@ proc blockValidator*(
|
||||
proc checkForPotentialDoppelganger(
|
||||
self: var Eth2Processor, attestationData: AttestationData,
|
||||
attesterIndices: IntSet, wallSlot: Slot) =
|
||||
# Attestations remain valid for 32 slots, so avoid confusing with one's own
|
||||
# reflections, for a ATTESTATION_PROPAGATION_SLOT_RANGE div SLOTS_PER_EPOCH
|
||||
# period after the attestation slot. For mainnet this can be one additional
|
||||
# epoch, and for minimal, four epochs. Unlike in the attestation validation
|
||||
# checks, use the spec version of the constant here.
|
||||
const
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/specs/phase0/p2p-interface.md#configuration
|
||||
ATTESTATION_PROPAGATION_SLOT_RANGE = 32
|
||||
|
||||
let epoch = wallSlot.epoch
|
||||
if epoch < self.doppelgangerDetection.broadcastStartEpoch:
|
||||
let tgtBlck = self.chainDag.getRef(attestationData.target.root)
|
||||
@ -330,8 +321,8 @@ proc checkForPotentialDoppelganger(
|
||||
warn "Duplicate validator detected; would be slashed",
|
||||
validatorIndex,
|
||||
validatorPubkey
|
||||
beacon_duplicate_validator_protection_activated.inc()
|
||||
if self.config.doppelgangerDetection == DoppelgangerDetectionMode.stop:
|
||||
doppelganger_detection_activated.inc()
|
||||
if self.config.doppelgangerDetection:
|
||||
warn "We believe you are currently running another instance of the same validator. We've disconnected you from the network as this presents a significant slashing risk. Possible next steps are (a) making sure you've disconnected your validator from your old machine before restarting the client; and (b) running the client again with the gossip-slashing-protection option disabled, only if you are absolutely sure this is the only instance of your validator running, and reporting the issue at https://github.com/status-im/nimbus-eth2/issues."
|
||||
quit QuitFailure
|
||||
|
||||
|
@ -615,14 +615,11 @@ proc handleValidatorDuties*(node: BeaconNode, lastSlot, slot: Slot) {.async.} =
|
||||
|
||||
var curSlot = lastSlot + 1
|
||||
|
||||
# The dontcheck option's a deliberately undocumented escape hatch for the
|
||||
# local testnets and similar development and testing use cases.
|
||||
#
|
||||
# If broadcastStartEpoch is 0, it hasn't had time to initialize yet, which
|
||||
# means that it'd be okay not to continue, but it won't gossip regardless.
|
||||
if curSlot.epoch <
|
||||
node.processor[].doppelgangerDetection.broadcastStartEpoch and
|
||||
node.config.doppelgangerDetection != DoppelgangerDetectionMode.dontcheck:
|
||||
node.config.doppelgangerDetection:
|
||||
debug "Waiting to gossip out to detect potential duplicate validators",
|
||||
broadcastStartEpoch =
|
||||
node.processor[].doppelgangerDetection.broadcastStartEpoch
|
||||
|
@ -391,7 +391,7 @@ for NUM_NODE in $(seq 0 $(( NUM_NODES - 1 ))); do
|
||||
--metrics \
|
||||
--metrics-address="127.0.0.1" \
|
||||
--metrics-port="$(( BASE_METRICS_PORT + NUM_NODE ))" \
|
||||
--doppelganger-detection=dontcheck \
|
||||
--doppelganger-detection=off \
|
||||
${EXTRA_ARGS} \
|
||||
> "${DATA_DIR}/log${NUM_NODE}.txt" 2>&1 &
|
||||
|
||||
|
@ -105,6 +105,6 @@ $BEACON_NODE_BIN \
|
||||
--metrics \
|
||||
--metrics-address="127.0.0.1" \
|
||||
--metrics-port="$(( $BASE_METRICS_PORT + $NODE_ID ))" \
|
||||
--doppelganger-detection=dontcheck \
|
||||
--doppelganger-detection=off \
|
||||
${ADDITIONAL_BEACON_NODE_ARGS} \
|
||||
"$@"
|
||||
|
Loading…
x
Reference in New Issue
Block a user