mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 15:37:56 -05:00
prysmctl: validator exit (#11515)
* moving voluntary exit command to prysmctl * fixing linting * fixing imports * removing unused import: * refactoring and adding a new unit test * rolling back some changes * fixing parameters * fixing tests * adding to main prysm ctl * refactoring how wallet function works and ux to validator exit * adding interop support * fixing bazel build * fixing if statement * fixing beaconcha.in printout * fixing web3signer bug, missing signing slot info * fixing deep source issues * fixing bazel package visibility for prysmctl * gaz Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
This commit is contained in:
@@ -21,6 +21,7 @@ import (
|
||||
validatorpb "github.com/prysmaticlabs/prysm/v3/proto/prysm/v1alpha1/validator-client"
|
||||
"github.com/prysmaticlabs/prysm/v3/runtime/version"
|
||||
prysmTime "github.com/prysmaticlabs/prysm/v3/time"
|
||||
"github.com/prysmaticlabs/prysm/v3/time/slots"
|
||||
"github.com/prysmaticlabs/prysm/v3/validator/client/iface"
|
||||
"github.com/sirupsen/logrus"
|
||||
"go.opencensus.io/trace"
|
||||
@@ -206,9 +207,9 @@ func ProposeExit(
|
||||
}
|
||||
totalSecondsPassed := prysmTime.Now().Unix() - genesisResponse.GenesisTime.Seconds
|
||||
currentEpoch := types.Epoch(uint64(totalSecondsPassed) / uint64(params.BeaconConfig().SlotsPerEpoch.Mul(params.BeaconConfig().SecondsPerSlot)))
|
||||
|
||||
currentSlot := slots.CurrentSlot(uint64(genesisResponse.GenesisTime.AsTime().Unix()))
|
||||
exit := ðpb.VoluntaryExit{Epoch: currentEpoch, ValidatorIndex: indexResponse.Index}
|
||||
sig, err := signVoluntaryExit(ctx, validatorClient, signer, pubKey, exit)
|
||||
sig, err := signVoluntaryExit(ctx, validatorClient, signer, pubKey, exit, currentSlot)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to sign voluntary exit")
|
||||
}
|
||||
@@ -294,6 +295,7 @@ func signVoluntaryExit(
|
||||
signer iface.SigningFunc,
|
||||
pubKey []byte,
|
||||
exit *ethpb.VoluntaryExit,
|
||||
slot types.Slot,
|
||||
) ([]byte, error) {
|
||||
req := ðpb.DomainRequest{
|
||||
Epoch: exit.Epoch,
|
||||
@@ -318,6 +320,7 @@ func signVoluntaryExit(
|
||||
SigningRoot: exitRoot[:],
|
||||
SignatureDomain: domain.SignatureDomain,
|
||||
Object: &validatorpb.SignRequest_Exit{Exit: exit},
|
||||
SigningSlot: slot,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, signExitErr)
|
||||
|
||||
Reference in New Issue
Block a user