beacon-chain: Reorganize flags in help text (#14959)

* Beacon flags: Comment on deprecated section

* Beacon flags: Organize flags relevant to logging, comment on logging section

* Beacon flags: Organize flags relevant to p2p, comment on p2p section

* Beacon flags: Introduce db flag section, organize flags relevant to db, comment on db section

* Beacon flags: Introduce builder flag section, organize flags relevant to builder, comment on builder section

* Beacon flags: Introduce sync flag section, organize flags relevant to sync, comment on sync section

* Beacon flags: Introduce execution layer flag section, organize flags relevant to execution layer, comment on execution layer section

* Beacon flags: Introduce monitoring flag section, organize flags relevant to monitoring, comment on monitoring section

* Beacon flags: Organizing remaining flags in cmd and beacon-chain sections

* Beacon flags: Introduce slasher flag section, organize flags relevant to slasher, comment on slasher section

* Move slasher flag from features to the slasher section

* Changelog fragment

* Beacon flags: Reorganize sections

* Move MaxGoroutines to debug section
This commit is contained in:
Preston Van Loon
2025-03-04 10:17:29 -06:00
committed by GitHub
parent d7efccf6a5
commit 0a8f947169
15 changed files with 198 additions and 148 deletions

View File

@@ -60,7 +60,6 @@ type Flags struct {
// Bug fixes related flags.
AttestTimely bool // AttestTimely fixes #8185. It is gated behind a flag to ensure beacon node's fix can safely roll out first. We'll invert this in v1.1.0.
EnableSlasher bool // Enable slasher in the beacon node runtime.
EnableSlashingProtectionPruning bool // Enable slashing protection pruning for the validator client.
EnableMinimalSlashingProtection bool // Enable minimal slashing protection database for the validator client.
@@ -211,10 +210,6 @@ func ConfigureBeaconChain(ctx *cli.Context) error {
logDisabled(disableBroadcastSlashingFlag)
cfg.DisableBroadcastSlashings = true
}
if ctx.Bool(enableSlasherFlag.Name) {
log.WithField(enableSlasherFlag.Name, enableSlasherFlag.Usage).Warn(enabledFeatureFlag)
cfg.EnableSlasher = true
}
if ctx.Bool(enableHistoricalSpaceRepresentation.Name) {
log.WithField(enableHistoricalSpaceRepresentation.Name, enableHistoricalSpaceRepresentation.Usage).Warn(enabledFeatureFlag)
cfg.EnableHistoricalSpaceRepresentation = true

View File

@@ -12,39 +12,39 @@ import (
func TestInitFeatureConfig(t *testing.T) {
defer Init(&Flags{})
cfg := &Flags{
EnableSlasher: true,
EnableDoppelGanger: true,
}
Init(cfg)
c := Get()
assert.Equal(t, true, c.EnableSlasher)
assert.Equal(t, true, c.EnableDoppelGanger)
}
func TestInitWithReset(t *testing.T) {
defer Init(&Flags{})
Init(&Flags{
EnableSlasher: true,
EnableDoppelGanger: true,
})
assert.Equal(t, true, Get().EnableSlasher)
assert.Equal(t, true, Get().EnableDoppelGanger)
// Overwrite previously set value (value that didn't come by default).
resetCfg := InitWithReset(&Flags{
EnableSlasher: false,
EnableDoppelGanger: false,
})
assert.Equal(t, false, Get().EnableSlasher)
assert.Equal(t, false, Get().EnableDoppelGanger)
// Reset must get to previously set configuration (not to default config values).
resetCfg()
assert.Equal(t, true, Get().EnableSlasher)
assert.Equal(t, true, Get().EnableDoppelGanger)
}
func TestConfigureBeaconConfig(t *testing.T) {
app := cli.App{}
set := flag.NewFlagSet("test", 0)
set.Bool(enableSlasherFlag.Name, true, "test")
set.Bool(saveInvalidBlockTempFlag.Name, true, "test")
context := cli.NewContext(&app, set, nil)
require.NoError(t, ConfigureBeaconChain(context))
c := Get()
assert.Equal(t, true, c.EnableSlasher)
assert.Equal(t, true, c.SaveInvalidBlock)
}
func TestValidateNetworkFlags(t *testing.T) {

View File

@@ -89,10 +89,6 @@ var (
Name: "attest-timely",
Usage: "Fixes validator can attest timely after current block processes. See #8185 for more details.",
}
enableSlasherFlag = &cli.BoolFlag{
Name: "slasher",
Usage: "Enables a slasher in the beacon node for detecting slashable offenses.",
}
enableSlashingProtectionPruning = &cli.BoolFlag{
Name: "enable-slashing-protection-history-pruning",
Usage: "Enables the pruning of the validator client's slashing protection database.",
@@ -217,7 +213,6 @@ var BeaconChainFlags = combinedFlags([]cli.Flag{
Mainnet,
disablePeerScorer,
disableBroadcastSlashingFlag,
enableSlasherFlag,
disableStakinContractCheck,
SaveFullExecutionPayloads,
enableStartupOptimistic,