Skip to content

Commit e1d6df1

Browse files
committed
Continue using the V1 Slashing DB by default
1 parent ee3f466 commit e1d6df1

File tree

2 files changed

+26
-11
lines changed

2 files changed

+26
-11
lines changed

beacon_chain/conf.nim

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ type
5151
enabled # Always enabled
5252
disabled # Always disabled
5353

54+
SlashingDbKind* {.pure.} = enum
55+
v1
56+
v2
57+
both
58+
5459
BeaconNodeConf* = object
5560
logLevel* {.
5661
defaultValue: "INFO"
@@ -120,12 +125,11 @@ type
120125
desc: "Subscribe to all attestation subnet topics when gossiping"
121126
name: "subscribe-all-subnets" }: bool
122127

123-
# Can we use a set[enum]?
124-
testDualSlashingProtectionDBs* {.
128+
slashingDbKind* {.
125129
hidden
126-
defaultValue: false
127-
desc: "Use the the 2 slashing protection implementation at the same time to ensure no regression."
128-
name: "slashing-test-dual-db" }: bool
130+
defaultValue: SlashingDbKind.v1
131+
desc: "The slashing DB flavour to use (v1, v2 or both)"
132+
name: "slashing-db-kind" }: SlashingDbKind
129133

130134
case cmd* {.
131135
command

beacon_chain/nimbus_beacon_node.nim

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -320,24 +320,35 @@ proc init*(T: type BeaconNode,
320320
topics &= getAttestationTopic(enrForkId.forkDigest, subnet)
321321
topics)
322322

323-
if conf.testDualSlashingProtectionDBs:
324-
info "Loading slashing protection database (dual DB mode)", path = conf.validatorsDir()
323+
case conf.slashingDbKind
324+
of SlashingDbKind.v1:
325+
info "Loading slashing protection database", path = conf.validatorsDir()
325326
res.attachedValidators = ValidatorPool.init(
326327
SlashingProtectionDB.init(
327328
chainDag.headState.data.data.genesis_validators_root,
328329
conf.validatorsDir(), "slashing_protection",
329-
modes = {kCompleteArchiveV1, kCompleteArchiveV2},
330-
disagreementBehavior = kChooseV2
330+
modes = {kCompleteArchiveV1},
331+
disagreementBehavior = kChooseV1
331332
)
332333
)
333-
else:
334-
info "Loading slashing protection database", path = conf.validatorsDir()
334+
of SlashingDbKind.v2:
335+
info "Loading slashing protection database (v2)", path = conf.validatorsDir()
335336
res.attachedValidators = ValidatorPool.init(
336337
SlashingProtectionDB.init(
337338
chainDag.headState.data.data.genesis_validators_root,
338339
conf.validatorsDir(), "slashing_protection"
339340
)
340341
)
342+
of SlashingDbKind.both:
343+
info "Loading slashing protection database (dual DB mode)", path = conf.validatorsDir()
344+
res.attachedValidators = ValidatorPool.init(
345+
SlashingProtectionDB.init(
346+
chainDag.headState.data.data.genesis_validators_root,
347+
conf.validatorsDir(), "slashing_protection",
348+
modes = {kCompleteArchiveV1, kCompleteArchiveV2},
349+
disagreementBehavior = kChooseV2
350+
)
351+
)
341352

342353
proc getWallTime(): BeaconTime = res.beaconClock.now()
343354

0 commit comments

Comments
 (0)