rename initialize_beacon_state{_from_eth1,}; suppress warnings when doppelganger detection disabled
This commit is contained in:
parent
18da0f8928
commit
7f42d38219
|
@ -35,7 +35,7 @@ OK: 9/9 Fail: 0/9 Skip: 0/9
|
|||
OK: 1/1 Fail: 0/1 Skip: 0/1
|
||||
## Beacon state [Preset: mainnet]
|
||||
```diff
|
||||
+ Smoke test initialize_beacon_state_from_eth1 [Preset: mainnet] OK
|
||||
+ Smoke test initialize_beacon_state [Preset: mainnet] OK
|
||||
```
|
||||
OK: 1/1 Fail: 0/1 Skip: 0/1
|
||||
## Block pool processing [Preset: mainnet]
|
||||
|
|
|
@ -195,7 +195,7 @@ when hasGenesisDetection:
|
|||
|
||||
var deposits = m.allGenesisDepositsUpTo(eth1Block.voteData.deposit_count)
|
||||
|
||||
result = initialize_beacon_state_from_eth1(
|
||||
result = initialize_beacon_state(
|
||||
m.preset,
|
||||
eth1Block.voteData.block_hash,
|
||||
eth1Block.timestamp.uint64,
|
||||
|
|
|
@ -33,9 +33,6 @@ declareCounter beacon_proposer_slashings_received,
|
|||
declareCounter beacon_voluntary_exits_received,
|
||||
"Number of beacon chain voluntary exits received by this peer"
|
||||
|
||||
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]
|
||||
|
||||
declareHistogram beacon_attestation_delay,
|
||||
|
@ -176,16 +173,14 @@ proc checkForPotentialDoppelganger(
|
|||
tgtBlck, attestationData.target.epoch)
|
||||
for validatorIndex in attesterIndices:
|
||||
let validatorPubkey = epochRef.validator_keys[validatorIndex]
|
||||
if self.validatorPool[].getValidator(validatorPubkey) !=
|
||||
default(AttachedValidator):
|
||||
warn "Duplicate validator detected; would be slashed",
|
||||
if self.doppelgangerDetectionEnabled and
|
||||
self.validatorPool[].getValidator(validatorPubkey) !=
|
||||
default(AttachedValidator):
|
||||
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.",
|
||||
validatorIndex,
|
||||
validatorPubkey,
|
||||
attestationSlot = attestationData.slot
|
||||
doppelganger_detection_activated.inc()
|
||||
if self.doppelgangerDetectionEnabled:
|
||||
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
|
||||
quit QuitFailure
|
||||
|
||||
{.pop.} # async can raise anything
|
||||
|
||||
|
|
|
@ -1748,7 +1748,7 @@ proc doCreateTestnet(config: BeaconNodeConf, rng: var BrHmacDrbgContext) {.raise
|
|||
else: (waitFor getEth1BlockHash(config.web3Urls[0], blockId("latest"))).asEth2Digest
|
||||
runtimePreset = getRuntimePresetForNetwork(config.eth2Network)
|
||||
var
|
||||
initialState = initialize_beacon_state_from_eth1(
|
||||
initialState = initialize_beacon_state(
|
||||
runtimePreset, eth1Hash, startTime, deposits, {skipBlsValidation})
|
||||
|
||||
# https://github.com/ethereum/eth2.0-pm/tree/6e41fcf383ebeb5125938850d8e9b4e9888389b4/interop/mocked_start#create-genesis-state
|
||||
|
|
|
@ -240,7 +240,7 @@ func genesis_time_from_eth1_timestamp*(preset: RuntimePreset, eth1_timestamp: ui
|
|||
eth1_timestamp + preset.GENESIS_DELAY
|
||||
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#genesis
|
||||
proc initialize_beacon_state_from_eth1*(
|
||||
proc initialize_beacon_state*(
|
||||
preset: RuntimePreset,
|
||||
eth1_block_hash: Eth2Digest,
|
||||
eth1_timestamp: uint64,
|
||||
|
@ -335,7 +335,7 @@ proc initialize_hashed_beacon_state_from_eth1*(
|
|||
eth1_timestamp: uint64,
|
||||
deposits: openArray[DepositData],
|
||||
flags: UpdateFlags = {}): HashedBeaconState =
|
||||
let genesisState = initialize_beacon_state_from_eth1(
|
||||
let genesisState = initialize_beacon_state(
|
||||
preset, eth1_block_hash, eth1_timestamp, deposits, flags)
|
||||
HashedBeaconState(data: genesisState[], root: hash_tree_root(genesisState[]))
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ proc loadGenesis*(validators: Natural, validate: bool):
|
|||
let contractSnapshot = DepositContractSnapshot(
|
||||
depositContractState: merkleizer.toDepositContractState)
|
||||
|
||||
res.data = initialize_beacon_state_from_eth1(
|
||||
res.data = initialize_beacon_state(
|
||||
defaultRuntimePreset,
|
||||
Eth2Digest(),
|
||||
0,
|
||||
|
|
|
@ -221,7 +221,7 @@ suiteReport "Beacon chain DB" & preset():
|
|||
db = BeaconChainDB.new(defaultRuntimePreset, "", inMemory = true)
|
||||
|
||||
let
|
||||
state = initialize_beacon_state_from_eth1(
|
||||
state = initialize_beacon_state(
|
||||
defaultRuntimePreset, eth1BlockHash, 0,
|
||||
makeInitialDeposits(SLOTS_PER_EPOCH), {skipBlsValidation})
|
||||
root = hash_tree_root(state[])
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# beacon_chain
|
||||
# Copyright (c) 2018-2020 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-2021 Status Research & Development GmbH
|
||||
# Licensed and distributed under either of
|
||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||
|
@ -13,7 +13,7 @@ import
|
|||
../beacon_chain/spec/[beaconstate, datatypes, digest, presets]
|
||||
|
||||
suiteReport "Beacon state" & preset():
|
||||
timedTest "Smoke test initialize_beacon_state_from_eth1" & preset():
|
||||
let state = initialize_beacon_state_from_eth1(
|
||||
timedTest "Smoke test initialize_beacon_state" & preset():
|
||||
let state = initialize_beacon_state(
|
||||
defaultRuntimePreset, Eth2Digest(), 0, makeInitialDeposits(SLOTS_PER_EPOCH, {}), {})
|
||||
check: state.validators.lenu64 == SLOTS_PER_EPOCH
|
||||
|
|
|
@ -150,7 +150,7 @@ suiteReport "Interop":
|
|||
|
||||
const genesis_time = 1570500000
|
||||
var
|
||||
initialState = initialize_beacon_state_from_eth1(
|
||||
initialState = initialize_beacon_state(
|
||||
defaultRuntimePreset, eth1BlockHash, genesis_time, deposits, {})
|
||||
|
||||
# https://github.com/ethereum/eth2.0-pm/tree/6e41fcf383ebeb5125938850d8e9b4e9888389b4/interop/mocked_start#create-genesis-state
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# beacon_chain
|
||||
# Copyright (c) 2018-2019 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-2021 Status Research & Development GmbH
|
||||
# Licensed and distributed under either of
|
||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||
|
@ -97,7 +97,7 @@ proc makeTestDB*(tailState: var BeaconState, tailBlock: SignedBeaconBlock): Beac
|
|||
|
||||
proc makeTestDB*(validators: Natural): BeaconChainDB =
|
||||
let
|
||||
genState = initialize_beacon_state_from_eth1(
|
||||
genState = initialize_beacon_state(
|
||||
defaultRuntimePreset,
|
||||
Eth2Digest(),
|
||||
0,
|
||||
|
|
Loading…
Reference in New Issue