mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-26 05:17:22 +00:00
a04b7c2e4f
* WIP - slasher highest attestation start * fixed previous * highest source and target * highest attestation cache * cleanup * persist + fixes * PR fixes and cleanup * slashing proto * highest att. api * cleanup + tests * increased highest att. cache to 300K * removed highest att. api (for a separate PR) * fixed linting * bazel build fix * highest att. kv test * slasher highest att. test + purge + fix on eviction persist performance * cleanup + linting * linting + test fixes * bazel gazelle run * PR fixes * run goimports * go mod tidy * ineffectual assignment fix * run gazelle * bazel gazelle run * test fixes * linter fix * Apply suggestions from code review Co-authored-by: Shay Zluf <thezluf@gmail.com> * goimports run * cache tests * A bunch of small fixes * gazelle fix + gofmt * merge fixes * kv ordering fix * small typos and text fixes * capital letter fix Co-authored-by: Shay Zluf <thezluf@gmail.com>
118 lines
2.6 KiB
Go
118 lines
2.6 KiB
Go
// This code was adapted from https://github.com/ethereum/go-ethereum/blob/master/cmd/geth/usage.go
|
|
package main
|
|
|
|
import (
|
|
"io"
|
|
"sort"
|
|
|
|
"github.com/prysmaticlabs/prysm/shared/cmd"
|
|
"github.com/prysmaticlabs/prysm/shared/debug"
|
|
"github.com/prysmaticlabs/prysm/shared/featureconfig"
|
|
"github.com/prysmaticlabs/prysm/slasher/flags"
|
|
"github.com/urfave/cli/v2"
|
|
)
|
|
|
|
var appHelpTemplate = `NAME:
|
|
{{.App.Name}} - {{.App.Usage}}
|
|
USAGE:
|
|
{{.App.HelpName}} [options]{{if .App.Commands}} command [command options]{{end}} {{if .App.ArgsUsage}}{{.App.ArgsUsage}}{{else}}[arguments...]{{end}}
|
|
{{if .App.Version}}
|
|
AUTHOR:
|
|
{{range .App.Authors}}{{ . }}{{end}}
|
|
{{end}}{{if .App.Commands}}
|
|
GLOBAL OPTIONS:
|
|
{{range .App.Commands}}{{join .Names ", "}}{{ "\t" }}{{.Usage}}
|
|
{{end}}{{end}}{{if .FlagGroups}}
|
|
{{range .FlagGroups}}{{.Name}} OPTIONS:
|
|
{{range .Flags}}{{.}}
|
|
{{end}}
|
|
{{end}}{{end}}{{if .App.Copyright }}
|
|
COPYRIGHT:
|
|
{{.App.Copyright}}
|
|
VERSION:
|
|
{{.App.Version}}
|
|
{{end}}{{if len .App.Authors}}
|
|
{{end}}
|
|
`
|
|
|
|
type flagGroup struct {
|
|
Name string
|
|
Flags []cli.Flag
|
|
}
|
|
|
|
var appHelpFlagGroups = []flagGroup{
|
|
{
|
|
Name: "cmd",
|
|
Flags: []cli.Flag{
|
|
cmd.MinimalConfigFlag,
|
|
cmd.E2EConfigFlag,
|
|
cmd.RPCMaxPageSizeFlag,
|
|
cmd.VerbosityFlag,
|
|
cmd.DataDirFlag,
|
|
cmd.EnableTracingFlag,
|
|
cmd.TracingProcessNameFlag,
|
|
cmd.TracingEndpointFlag,
|
|
cmd.TraceSampleFractionFlag,
|
|
cmd.MonitoringHostFlag,
|
|
flags.MonitoringPortFlag,
|
|
cmd.DisableMonitoringFlag,
|
|
cmd.LogFormat,
|
|
cmd.LogFileName,
|
|
cmd.ForceClearDB,
|
|
cmd.ClearDB,
|
|
cmd.ConfigFileFlag,
|
|
cmd.AcceptTosFlag,
|
|
},
|
|
},
|
|
{
|
|
Name: "debug",
|
|
Flags: []cli.Flag{
|
|
debug.PProfFlag,
|
|
debug.PProfAddrFlag,
|
|
debug.PProfPortFlag,
|
|
debug.MemProfileRateFlag,
|
|
debug.CPUProfileFlag,
|
|
debug.TraceFlag,
|
|
},
|
|
},
|
|
{
|
|
Name: "slasher",
|
|
Flags: []cli.Flag{
|
|
flags.BeaconCertFlag,
|
|
flags.CertFlag,
|
|
flags.KeyFlag,
|
|
flags.RPCPort,
|
|
flags.RPCHost,
|
|
flags.BeaconRPCProviderFlag,
|
|
flags.EnableHistoricalDetectionFlag,
|
|
flags.SpanCacheSize,
|
|
flags.HighestAttCacheSize,
|
|
},
|
|
},
|
|
{
|
|
Name: "features",
|
|
Flags: featureconfig.ActiveFlags(featureconfig.SlasherFlags),
|
|
},
|
|
}
|
|
|
|
func init() {
|
|
cli.AppHelpTemplate = appHelpTemplate
|
|
|
|
type helpData struct {
|
|
App interface{}
|
|
FlagGroups []flagGroup
|
|
}
|
|
|
|
originalHelpPrinter := cli.HelpPrinter
|
|
cli.HelpPrinter = func(w io.Writer, tmpl string, data interface{}) {
|
|
if tmpl == appHelpTemplate {
|
|
for _, group := range appHelpFlagGroups {
|
|
sort.Sort(cli.FlagsByName(group.Flags))
|
|
}
|
|
originalHelpPrinter(w, tmpl, helpData{data, appHelpFlagGroups})
|
|
} else {
|
|
originalHelpPrinter(w, tmpl, data)
|
|
}
|
|
}
|
|
}
|