prysm-pulse/slasher/usage.go

113 lines
2.5 KiB
Go
Raw Normal View History

// 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"
Refactor dependencies, make Prysm "go gettable" (#6053) * Fix a few deps to work with go.mod, check in generated files * Update Gossipsub to 1.1 (#5998) * update libs * add new validators * add new deps * new set of deps * tls * further fix gossip update * get everything to build * clean up * gaz * fix build * fix all tests * add deps to images * imports Co-authored-by: rauljordan <raul@prysmaticlabs.com> * Beacon chain builds with go build * fix bazel * fix dep * lint * Add github action for testing go * on PR for any branch * fix libp2p test failure * Fix TestProcessBlock_PassesProcessingConditions by updating the proposer index in test * Revert "Fix TestProcessBlock_PassesProcessingConditions by updating the proposer index in test" This reverts commit 43676894ab01f03fe90a9b8ee3ecfbc2ec1ec4e4. * Compute and set proposer index instead of hard code * Add back go mod/sum, fix deps * go build ./... * Temporarily skip two tests * Fix kafka confluent patch * Fix kafka confluent patch * fix kafka build * fix kafka * Add info in DEPENDENCIES. Added a stub link for Why Bazel? until https://github.com/prysmaticlabs/documentation/issues/138 * Update fuzz ssz files as well * Update fuzz ssz files as well * getting closer * rollback rules_go and gazelle * fix gogo protobuf * install librdkafka-dev as part of github actions * Update kafka to a recent version where librkafkfa is not required for go modules * clarify comment * fix kafka build * disable go tests * comment * Fix geth dependencies for end to end * rename word * lint * fix docker Co-authored-by: Nishant Das <nishdas93@gmail.com> Co-authored-by: rauljordan <raul@prysmaticlabs.com> Co-authored-by: terence tsao <terence@prysmaticlabs.com>
2020-05-31 06:44:34 +00:00
"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.VerbosityFlag,
cmd.DataDirFlag,
cmd.EnableTracingFlag,
cmd.TracingProcessNameFlag,
cmd.TracingEndpointFlag,
cmd.TraceSampleFractionFlag,
cmd.MonitoringHostFlag,
flags.MonitoringPortFlag,
cmd.LogFormat,
cmd.LogFileName,
cmd.ForceClearDB,
Slasher data update from archive (#4563) * first version * cli context * fix service * starting change to ccache * ristretto cache * added test * test on evict * remove evict test * test onevict * comment for exported flag * update all span maps on load * fix setup db * span cache added to help flags * start save cache on exit * save cache to db before close * comment fix * fix flags * setup db new * data update from archive node * gaz * slashing detection on old attestations * un-export * rename * nishant feedback * workspace cr * lint fix * fix calls * start db * fix test * Update slasher/db/db.go Co-Authored-By: Nishant Das <nishdas93@gmail.com> * add flag * fix fail to start beacon client * mock beacon service * fix imports * gaz * goimports * add clear db flag * print finalized epoch * better msg * Update slasher/db/attester_slashings.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * raul feedback * raul feedback * raul feedback * raul feedback * raul feedback * add detection in runtime * fix tests * raul feedbacks * raul feedback * raul feedback * goimports * Update beacon-chain/blockchain/process_attestation_helpers.go * Update beacon-chain/blockchain/receive_block.go * Update beacon-chain/core/blocks/block_operations_test.go * Update beacon-chain/core/blocks/block_operations.go * Update beacon-chain/core/epoch/epoch_processing.go * Update beacon-chain/sync/validate_aggregate_proof_test.go * Update shared/testutil/block.go * Update slasher/service/data_update.go * Update tools/blocktree/main.go * Update slasher/service/service.go * Update beacon-chain/core/epoch/precompute/attestation_test.go * Update beacon-chain/core/helpers/committee_test.go * Update beacon-chain/core/state/transition_test.go * Update beacon-chain/rpc/aggregator/server_test.go * Update beacon-chain/sync/validate_aggregate_proof.go * Update beacon-chain/rpc/validator/proposer_test.go * Update beacon-chain/blockchain/forkchoice/process_attestation.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/db/indexed_attestations.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/service/data_update.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * terence feedback * terence feedback * goimports Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com> Co-authored-by: Raul Jordan <raul@prysmaticlabs.com> Co-authored-by: Nishant Das <nish1993@hotmail.com> Co-authored-by: terence tsao <terence@prysmaticlabs.com>
2020-01-29 01:44:51 +00:00
cmd.ClearDB,
cmd.ConfigFileFlag,
},
},
{
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.RebuildSpanMapsFlag,
flags.BeaconRPCProviderFlag,
},
},
{
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)
}
}
}