mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-08 18:51:19 +00:00
38f095d556
* adding unit test for withdrawal * updating to handle api changes * Update cmd/prysmctl/withdrawal/withdrawal.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update cmd/prysmctl/withdrawal/cmd.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update cmd/prysmctl/withdrawal/withdrawal.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update cmd/prysmctl/withdrawal/cmd.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update cmd/prysmctl/withdrawal/withdrawal.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update cmd/prysmctl/withdrawal/withdrawal.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update cmd/prysmctl/withdrawal/withdrawal.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * updating based on feedback * rewording prints * Update cmd/prysmctl/withdrawal/withdrawal.go Co-authored-by: Potuz <potuz@prysmaticlabs.com> * add error handling when status not ok * addressing some of the feedback, adding new tests * adding unit test with error return * adjusting based on review comments * addressing more comments and fixing unit test * updating prompts * migrating some functions to api/client * removing unused function * adding review feedback * removing unused functions * migrating command, old command under accounts still exist * reverting tos.go * fixing bazel lint * fixing build * resolving unused parameter caught by deepsource * fixing unit tests * Update cmd/prysmctl/validator/cmd.go Co-authored-by: Potuz <potuz@prysmaticlabs.com> * Update cmd/prysmctl/validator/cmd.go Co-authored-by: Potuz <potuz@prysmaticlabs.com> * adding in website * addressing review comment * adding new verify only flag * Update cmd/prysmctl/validator/withdraw.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update cmd/prysmctl/validator/withdraw.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update cmd/prysmctl/validator/withdraw.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update cmd/prysmctl/validator/withdraw.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update api/client/beacon/client.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update api/client/beacon/client.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update api/client/beacon/client.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update api/client/beacon/client.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update cmd/prysmctl/validator/withdraw.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * addressing comments * fixing unit test * Update cmd/prysmctl/validator/cmd.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update cmd/prysmctl/validator/cmd.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update cmd/prysmctl/validator/cmd.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update cmd/prysmctl/validator/cmd.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * address comments * Update cmd/prysmctl/validator/cmd.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * adjusting object for new provided format * adding omit empty * fixing unit test, and linting * adjusting based on cli changes * fixing test data and metadata property * addressing backwards compatability * reverting based on review comment Co-authored-by: Radosław Kapka <rkapka@wp.pl> Co-authored-by: Potuz <potuz@prysmaticlabs.com> Co-authored-by: Raul Jordan <raul@prysmaticlabs.com> Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
138 lines
5.0 KiB
Go
138 lines
5.0 KiB
Go
package validator
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/logrusorgru/aurora"
|
|
"github.com/prysmaticlabs/prysm/v3/cmd"
|
|
"github.com/prysmaticlabs/prysm/v3/cmd/validator/accounts"
|
|
"github.com/prysmaticlabs/prysm/v3/cmd/validator/flags"
|
|
"github.com/prysmaticlabs/prysm/v3/config/features"
|
|
"github.com/prysmaticlabs/prysm/v3/runtime/tos"
|
|
log "github.com/sirupsen/logrus"
|
|
"github.com/urfave/cli/v2"
|
|
)
|
|
|
|
var (
|
|
BeaconHostFlag = &cli.StringFlag{
|
|
Name: "beacon-node-host",
|
|
Usage: "host:port for beacon node to query",
|
|
Value: "127.0.0.1:3500",
|
|
}
|
|
PathFlag = &cli.StringFlag{
|
|
Name: "path",
|
|
Aliases: []string{"p"},
|
|
Usage: "path to the signed withdrawal messages JSON",
|
|
}
|
|
ConfirmFlag = &cli.BoolFlag{
|
|
Name: "confirm",
|
|
Aliases: []string{"c"},
|
|
Usage: "WARNING: User confirms and accepts responsibility of all input data provided and actions for setting their withdrawal address for their validator key. " +
|
|
"This action is not reversible and withdrawal addresses can not be changed once set.",
|
|
}
|
|
VerifyOnlyFlag = &cli.BoolFlag{
|
|
Name: "verify-only",
|
|
Aliases: []string{"vo"},
|
|
Usage: "overrides withdrawal command to only verify whether requests are in the pool and does not submit withdrawal requests",
|
|
}
|
|
)
|
|
|
|
var Commands = []*cli.Command{
|
|
{
|
|
Name: "validator",
|
|
Aliases: []string{"v", "sign"}, // remove sign command should be depreciated but having as backwards compatability.
|
|
Usage: "commands that affect the state of validators such as exiting or withdrawing",
|
|
Subcommands: []*cli.Command{
|
|
{
|
|
Name: "withdraw",
|
|
Aliases: []string{"w"},
|
|
Usage: "Assign Ethereum withdrawal addresses to validator keys. WARNING: once set values are included they can no longer be updated.",
|
|
Flags: []cli.Flag{
|
|
BeaconHostFlag,
|
|
PathFlag,
|
|
ConfirmFlag,
|
|
VerifyOnlyFlag,
|
|
cmd.ConfigFileFlag,
|
|
cmd.AcceptTosFlag,
|
|
},
|
|
Before: func(cliCtx *cli.Context) error {
|
|
if err := cmd.LoadFlagsFromConfig(cliCtx, cliCtx.Command.Flags); err != nil {
|
|
return err
|
|
}
|
|
au := aurora.NewAurora(true)
|
|
if !cliCtx.Bool(cmd.AcceptTosFlag.Name) || !cliCtx.Bool(ConfirmFlag.Name) {
|
|
fmt.Println(au.Red("===============IMPORTANT==============="))
|
|
fmt.Println(au.Red("Please read the following carefully"))
|
|
fmt.Print("This action will allow the partial withdrawal of amounts over the 32 staked ETH in your active validator balance. \n" +
|
|
"You will also be entitled to the full withdrawal of the entire validator balance if your validator has exited. \n" +
|
|
"Please navigate to our website (https://docs.prylabs.network/) and make sure you understand the full implications of setting your withdrawal address. \n")
|
|
fmt.Println(au.Red("THIS ACTION WILL NOT BE REVERSIBLE ONCE INCLUDED. "))
|
|
fmt.Println(au.Red("You will NOT be able to change the address again once changed. "))
|
|
return fmt.Errorf("both the `--%s` and `--%s` flags are required to run this command. \n"+
|
|
"By providing these flags the user has read and accepts the TERMS AND CONDITIONS: https://github.com/prysmaticlabs/prysm/blob/master/TERMS_OF_SERVICE.md "+
|
|
"and confirms the action of setting withdrawals addresses", cmd.AcceptTosFlag.Name, ConfirmFlag.Name)
|
|
} else {
|
|
return nil
|
|
}
|
|
},
|
|
Action: func(cliCtx *cli.Context) error {
|
|
if cliCtx.Bool(VerifyOnlyFlag.Name) {
|
|
if err := verifyWithdrawalsInPool(cliCtx); err != nil {
|
|
log.WithError(err).Fatal("Could not verify withdrawal addresses")
|
|
}
|
|
} else {
|
|
if err := setWithdrawalAddresses(cliCtx); err != nil {
|
|
log.WithError(err).Fatal("Could not set withdrawal addresses")
|
|
}
|
|
}
|
|
return nil
|
|
},
|
|
},
|
|
{
|
|
Name: "exit",
|
|
Aliases: []string{"e", "voluntary-exit"},
|
|
Usage: "Performs a voluntary exit on selected accounts",
|
|
Flags: cmd.WrapFlags([]cli.Flag{
|
|
flags.WalletDirFlag,
|
|
flags.WalletPasswordFileFlag,
|
|
flags.AccountPasswordFileFlag,
|
|
flags.VoluntaryExitPublicKeysFlag,
|
|
flags.BeaconRPCProviderFlag,
|
|
flags.Web3SignerURLFlag,
|
|
flags.Web3SignerPublicValidatorKeysFlag,
|
|
flags.InteropNumValidators,
|
|
flags.InteropStartIndex,
|
|
cmd.GrpcMaxCallRecvMsgSizeFlag,
|
|
flags.CertFlag,
|
|
flags.GrpcHeadersFlag,
|
|
flags.GrpcRetriesFlag,
|
|
flags.GrpcRetryDelayFlag,
|
|
flags.ExitAllFlag,
|
|
flags.ForceExitFlag,
|
|
features.Mainnet,
|
|
features.PraterTestnet,
|
|
features.RopstenTestnet,
|
|
features.SepoliaTestnet,
|
|
cmd.AcceptTosFlag,
|
|
}),
|
|
Before: func(cliCtx *cli.Context) error {
|
|
if err := cmd.LoadFlagsFromConfig(cliCtx, cliCtx.Command.Flags); err != nil {
|
|
return err
|
|
}
|
|
if err := tos.VerifyTosAcceptedOrPrompt(cliCtx); err != nil {
|
|
return err
|
|
}
|
|
return features.ConfigureValidator(cliCtx)
|
|
},
|
|
Action: func(cliCtx *cli.Context) error {
|
|
if err := accounts.AccountsExit(cliCtx, os.Stdin); err != nil {
|
|
log.WithError(err).Fatal("Could not perform voluntary exit")
|
|
}
|
|
return nil
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}
|