2021-11-09 16:49:28 +00:00
|
|
|
package historycmd
|
2021-01-22 23:12:22 +00:00
|
|
|
|
|
|
|
import (
|
2023-03-17 18:52:56 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/v4/cmd"
|
|
|
|
"github.com/prysmaticlabs/prysm/v4/cmd/validator/flags"
|
|
|
|
"github.com/prysmaticlabs/prysm/v4/config/features"
|
|
|
|
"github.com/prysmaticlabs/prysm/v4/runtime/tos"
|
2021-08-11 17:24:24 +00:00
|
|
|
"github.com/sirupsen/logrus"
|
2021-01-22 23:12:22 +00:00
|
|
|
"github.com/urfave/cli/v2"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Commands for slashing protection.
|
|
|
|
var Commands = &cli.Command{
|
2021-11-09 16:49:28 +00:00
|
|
|
Name: "slashing-protection-history",
|
|
|
|
Category: "slashing-protection-history",
|
2021-01-22 23:12:22 +00:00
|
|
|
Usage: "defines commands for interacting your validator's slashing protection history",
|
|
|
|
Subcommands: []*cli.Command{
|
|
|
|
{
|
|
|
|
Name: "export",
|
|
|
|
Description: `exports your validator slashing protection history into an EIP-3076 compliant JSON`,
|
|
|
|
Flags: cmd.WrapFlags([]cli.Flag{
|
|
|
|
cmd.DataDirFlag,
|
|
|
|
flags.SlashingProtectionExportDirFlag,
|
2021-11-15 19:21:54 +00:00
|
|
|
features.Mainnet,
|
|
|
|
features.PraterTestnet,
|
2022-06-15 15:05:44 +00:00
|
|
|
features.SepoliaTestnet,
|
2023-08-29 14:27:50 +00:00
|
|
|
features.HoleskyTestnet,
|
2021-11-15 19:21:54 +00:00
|
|
|
cmd.AcceptTosFlag,
|
2021-01-22 23:12:22 +00:00
|
|
|
}),
|
|
|
|
Before: func(cliCtx *cli.Context) error {
|
|
|
|
if err := cmd.LoadFlagsFromConfig(cliCtx, cliCtx.Command.Flags); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return tos.VerifyTosAcceptedOrPrompt(cliCtx)
|
|
|
|
},
|
|
|
|
Action: func(cliCtx *cli.Context) error {
|
2022-05-20 07:16:53 +00:00
|
|
|
if err := features.ConfigureValidator(cliCtx); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2021-11-09 16:49:28 +00:00
|
|
|
if err := exportSlashingProtectionJSON(cliCtx); err != nil {
|
2021-08-11 17:24:24 +00:00
|
|
|
logrus.Fatalf("Could not export slashing protection file: %v", err)
|
|
|
|
}
|
|
|
|
return nil
|
2021-01-22 23:12:22 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "import",
|
|
|
|
Description: `imports a selected EIP-3076 compliant slashing protection JSON to the validator database`,
|
|
|
|
Flags: cmd.WrapFlags([]cli.Flag{
|
|
|
|
cmd.DataDirFlag,
|
|
|
|
flags.SlashingProtectionJSONFileFlag,
|
2021-09-15 01:18:39 +00:00
|
|
|
features.Mainnet,
|
|
|
|
features.PraterTestnet,
|
2022-06-15 15:05:44 +00:00
|
|
|
features.SepoliaTestnet,
|
2023-08-29 14:27:50 +00:00
|
|
|
features.HoleskyTestnet,
|
2021-01-22 23:12:22 +00:00
|
|
|
cmd.AcceptTosFlag,
|
|
|
|
}),
|
|
|
|
Before: func(cliCtx *cli.Context) error {
|
|
|
|
if err := cmd.LoadFlagsFromConfig(cliCtx, cliCtx.Command.Flags); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return tos.VerifyTosAcceptedOrPrompt(cliCtx)
|
|
|
|
},
|
|
|
|
Action: func(cliCtx *cli.Context) error {
|
2022-05-20 07:16:53 +00:00
|
|
|
if err := features.ConfigureValidator(cliCtx); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2021-11-09 16:49:28 +00:00
|
|
|
err := importSlashingProtectionJSON(cliCtx)
|
2021-08-11 17:24:24 +00:00
|
|
|
if err != nil {
|
|
|
|
logrus.Fatalf("Could not import slashing protection cli: %v", err)
|
|
|
|
}
|
|
|
|
return nil
|
2021-01-22 23:12:22 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|