Add flag for custom slasher database directory (#11890)

* Add slasher database directory flag

* Fix up some beacon chain flag uses

* fmt

Co-authored-by: rauljordan <raul@prysmaticlabs.com>
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
Sammy Rosso 2023-01-18 22:52:53 +01:00 committed by GitHub
parent 55f311eb73
commit 9f44d6e452
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 0 deletions

View File

@ -448,6 +448,11 @@ func (b *BeaconNode) startSlasherDB(cliCtx *cli.Context) error {
return nil
}
baseDir := cliCtx.String(cmd.DataDirFlag.Name)
if cliCtx.IsSet(flags.SlasherDirFlag.Name) {
baseDir = cliCtx.String(flags.SlasherDirFlag.Name)
}
dbPath := filepath.Join(baseDir, kv.BeaconNodeDbDirName)
clearDB := cliCtx.Bool(cmd.ClearDB.Name)
forceClearDB := cliCtx.Bool(cmd.ForceClearDB.Name)

View File

@ -5,6 +5,7 @@ package flags
import (
"strings"
"github.com/prysmaticlabs/prysm/v3/cmd"
"github.com/prysmaticlabs/prysm/v3/config/params"
"github.com/urfave/cli/v2"
)
@ -246,4 +247,10 @@ var (
"WARNING: This flag should be used only if you have a clear understanding that community has decided to override the terminal block hash activation epoch. " +
"Incorrect usage will result in your node experience consensus failure.",
}
// SlasherDirFlag defines a path on disk where the slasher database is stored.
SlasherDirFlag = &cli.StringFlag{
Name: "slasher-datadir",
Usage: "Directory for the slasher database",
Value: cmd.DefaultDataDir(),
}
)

View File

@ -130,6 +130,7 @@ var appFlags = []cli.Flag{
checkpoint.RemoteURL,
genesis.StatePath,
genesis.BeaconAPIURL,
flags.SlasherDirFlag,
}
func init() {

View File

@ -126,6 +126,7 @@ var appHelpFlagGroups = []flagGroup{
flags.MaxBuilderEpochMissedSlots,
flags.MaxBuilderConsecutiveMissedSlots,
flags.EngineEndpointTimeoutSeconds,
flags.SlasherDirFlag,
checkpoint.BlockPath,
checkpoint.StatePath,
checkpoint.RemoteURL,