Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions rocketpool/node/stake-megapool-validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package node

import (
"math/big"
"strconv"

"github.com/docker/docker/client"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
Expand Down Expand Up @@ -202,6 +203,20 @@ func (t *stakeMegapoolValidator) stakeValidator(rp *rocketpool.RocketPool, beaco
return err
}

// Check if the validator is included in the finalized beacon state before attempting proof generation
validatorIndexStr, err := t.bc.GetValidatorIndex(validatorPubkey)
if err != nil {
return err
}
validatorIndex, err := strconv.ParseUint(validatorIndexStr, 10, 64)
if err != nil {
return err
}
if validatorIndex >= uint64(len(beaconState.GetValidators())) {
t.log.Printlnf("Validator id %d (beacon index %d) is not yet included in the finalized beacon state. Will retry on next cycle.", validatorId, validatorIndex)
return nil
}

t.log.Printlnf("Crafting a proof that the correct credentials were used on the first beacon chain deposit. This process can take several seconds and is CPU and memory intensive.")

validatorProof, slotTimestamp, slotProof, err := services.GetValidatorProof(t.c, 0, t.w, state.BeaconConfig, mp.GetAddress(), validatorPubkey, beaconState)
Expand Down
Loading