Use 0.11 style domains

This commit is contained in:
Jim McDonald
2020-04-09 21:03:10 +01:00
parent afcbd177a3
commit be3fd8edd2
7 changed files with 82 additions and 47 deletions

View File

@@ -20,10 +20,10 @@ import (
"time"
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
ssz "github.com/prysmaticlabs/go-ssz"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/wealdtech/ethdo/grpc"
e2types "github.com/wealdtech/go-eth2-types/v2"
)
var validatorExitEpoch int64
@@ -78,16 +78,15 @@ In quiet mode this will return 0 if the transaction has been sent, otherwise 1.`
Epoch: currentEpoch,
ValidatorIndex: index,
}
root, err := ssz.HashTreeRoot(exit)
errCheck(err, "Failed to generate exit proposal root")
// TODO fetch current fork version from config (currently using genesis fork version)
// currentForkVersion := config["GenesisForkVersion"].([]byte)
// domain := types.Domain(types.DomainVoluntaryExit, currentForkVersion)
currentForkVersion := config["GenesisForkVersion"].([]byte)
// TODO fetch genesis validators root from somewhere.
//domain := e2types.Domain(e2types.DomainVoluntaryExit, currentForkVersion, genesisValidatorsRoot)
domain := e2types.Domain(e2types.DomainVoluntaryExit, currentForkVersion, e2types.ZeroGenesisValidatorsRoot)
err = account.Unlock([]byte(rootAccountPassphrase))
errCheck(err, "Failed to unlock account; please confirm passphrase is correct")
// TODO supply domain
signature, err := sign(account, root[:], []byte{})
signature, err := signStruct(account, exit, domain)
errCheck(err, "Failed to sign exit proposal")
proposal := &ethpb.SignedVoluntaryExit{