Continue using the V1 Slashing DB by default

This commit is contained in:
Zahary Karadjov 2021-02-19 20:39:18 +02:00 committed by zah
parent ee3f466dfe
commit e1d6df1e5d
2 changed files with 29 additions and 14 deletions

View File

@ -51,6 +51,11 @@ type
enabled # Always enabled
disabled # Always disabled
SlashingDbKind* {.pure.} = enum
v1
v2
both
BeaconNodeConf* = object
logLevel* {.
defaultValue: "INFO"
@ -120,12 +125,11 @@ type
desc: "Subscribe to all attestation subnet topics when gossiping"
name: "subscribe-all-subnets" }: bool
# Can we use a set[enum]?
testDualSlashingProtectionDBs* {.
slashingDbKind* {.
hidden
defaultValue: false
desc: "Use the the 2 slashing protection implementation at the same time to ensure no regression."
name: "slashing-test-dual-db" }: bool
defaultValue: SlashingDbKind.v1
desc: "The slashing DB flavour to use (v1, v2 or both)"
name: "slashing-db-kind" }: SlashingDbKind
case cmd* {.
command

View File

@ -320,7 +320,26 @@ proc init*(T: type BeaconNode,
topics &= getAttestationTopic(enrForkId.forkDigest, subnet)
topics)
if conf.testDualSlashingProtectionDBs:
case conf.slashingDbKind
of SlashingDbKind.v1:
info "Loading slashing protection database", path = conf.validatorsDir()
res.attachedValidators = ValidatorPool.init(
SlashingProtectionDB.init(
chainDag.headState.data.data.genesis_validators_root,
conf.validatorsDir(), "slashing_protection",
modes = {kCompleteArchiveV1},
disagreementBehavior = kChooseV1
)
)
of SlashingDbKind.v2:
info "Loading slashing protection database (v2)", path = conf.validatorsDir()
res.attachedValidators = ValidatorPool.init(
SlashingProtectionDB.init(
chainDag.headState.data.data.genesis_validators_root,
conf.validatorsDir(), "slashing_protection"
)
)
of SlashingDbKind.both:
info "Loading slashing protection database (dual DB mode)", path = conf.validatorsDir()
res.attachedValidators = ValidatorPool.init(
SlashingProtectionDB.init(
@ -330,14 +349,6 @@ proc init*(T: type BeaconNode,
disagreementBehavior = kChooseV2
)
)
else:
info "Loading slashing protection database", path = conf.validatorsDir()
res.attachedValidators = ValidatorPool.init(
SlashingProtectionDB.init(
chainDag.headState.data.data.genesis_validators_root,
conf.validatorsDir(), "slashing_protection"
)
)
proc getWallTime(): BeaconTime = res.beaconClock.now()