github.com/prysmaticlabs/prysm@v1.4.4/cmd/validator/slashing-protection/slashing-protection.go (about)

     1  package slashing_protection
     2  
     3  import (
     4  	"github.com/prysmaticlabs/prysm/cmd/validator/flags"
     5  	"github.com/prysmaticlabs/prysm/shared/cmd"
     6  	"github.com/prysmaticlabs/prysm/shared/featureconfig"
     7  	"github.com/prysmaticlabs/prysm/shared/tos"
     8  	slashingprotection "github.com/prysmaticlabs/prysm/validator/slashing-protection"
     9  	"github.com/urfave/cli/v2"
    10  )
    11  
    12  // Commands for slashing protection.
    13  var Commands = &cli.Command{
    14  	Name:     "slashing-protection",
    15  	Category: "slashing-protection",
    16  	Usage:    "defines commands for interacting your validator's slashing protection history",
    17  	Subcommands: []*cli.Command{
    18  		{
    19  			Name:        "export",
    20  			Description: `exports your validator slashing protection history into an EIP-3076 compliant JSON`,
    21  			Flags: cmd.WrapFlags([]cli.Flag{
    22  				cmd.DataDirFlag,
    23  				flags.SlashingProtectionExportDirFlag,
    24  			}),
    25  			Before: func(cliCtx *cli.Context) error {
    26  				if err := cmd.LoadFlagsFromConfig(cliCtx, cliCtx.Command.Flags); err != nil {
    27  					return err
    28  				}
    29  				return tos.VerifyTosAcceptedOrPrompt(cliCtx)
    30  			},
    31  			Action: func(cliCtx *cli.Context) error {
    32  				featureconfig.ConfigureValidator(cliCtx)
    33  				return slashingprotection.ExportSlashingProtectionJSONCli(cliCtx)
    34  			},
    35  		},
    36  		{
    37  			Name:        "import",
    38  			Description: `imports a selected EIP-3076 compliant slashing protection JSON to the validator database`,
    39  			Flags: cmd.WrapFlags([]cli.Flag{
    40  				cmd.DataDirFlag,
    41  				flags.SlashingProtectionJSONFileFlag,
    42  				featureconfig.Mainnet,
    43  				featureconfig.PyrmontTestnet,
    44  				featureconfig.ToledoTestnet,
    45  				featureconfig.PraterTestnet,
    46  				cmd.AcceptTosFlag,
    47  			}),
    48  			Before: func(cliCtx *cli.Context) error {
    49  				if err := cmd.LoadFlagsFromConfig(cliCtx, cliCtx.Command.Flags); err != nil {
    50  					return err
    51  				}
    52  				return tos.VerifyTosAcceptedOrPrompt(cliCtx)
    53  			},
    54  			Action: func(cliCtx *cli.Context) error {
    55  				featureconfig.ConfigureValidator(cliCtx)
    56  				return slashingprotection.ImportSlashingProtectionCLI(cliCtx)
    57  			},
    58  		},
    59  	},
    60  }