Skip to content

Commit e4f0b93

Browse files
committed
Support of EIP-7044 in exit verify cmd
1 parent 25a5bd9 commit e4f0b93

1 file changed

Lines changed: 20 additions & 17 deletions

File tree

cmd/exitverify.go

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -72,32 +72,35 @@ In quiet mode this will return 0 if the exit is verified correctly, otherwise 1.
7272
errCheck(err, "Failed to obtain beacon chain genesis")
7373
genesis := genesisResponse.Data
7474

75-
response, err := eth2Client.(consensusclient.ForkProvider).Fork(ctx, &api.ForkOpts{State: "head"})
76-
errCheck(err, "Failed to obtain fork information")
75+
response, err := eth2Client.(consensusclient.SpecProvider).Spec(ctx, &api.SpecOpts{})
76+
errCheck(err, "Failed to obtain spec information")
7777

78-
// Check against current and prior fork versions.
78+
// Check against Capella fork version (EIP-7044)
7979
signatureBytes := make([]byte, 96)
8080
copy(signatureBytes, signedOp.Signature[:])
8181
sig, err := e2types.BLSSignatureFromBytes(signatureBytes)
8282
errCheck(err, "Invalid signature")
8383

84-
verified := false
85-
86-
// Try with the current fork.
8784
domain := phase0.Domain{}
88-
currentExitDomain, err := e2types.ComputeDomain(e2types.DomainVoluntaryExit, response.Data.CurrentVersion[:], genesis.GenesisValidatorsRoot[:])
85+
forkRaw, ok := response.Data["CAPELLA_FORK_VERSION"]
86+
if !ok {
87+
err = errors.New("failed to obtain Capella fork version")
88+
}
89+
errCheck(err, "Failed to obtain fork version")
90+
91+
fork, ok := forkRaw.(phase0.Version)
92+
if !ok {
93+
err = errors.New("fork version is not of a valid type")
94+
}
95+
errCheck(err, "Failed to obtain fork version")
96+
97+
exitDomain, err := e2types.ComputeDomain(e2types.DomainVoluntaryExit, fork[:], genesis.GenesisValidatorsRoot[:])
8998
errCheck(err, "Failed to compute domain")
90-
copy(domain[:], currentExitDomain)
91-
verified, err = util.VerifyRoot(account, opRoot, domain, sig)
99+
100+
copy(domain[:], exitDomain)
101+
verified, err := util.VerifyRoot(account, opRoot, domain, sig)
92102
errCheck(err, "Failed to verify voluntary exit")
93-
if !verified {
94-
// Try again with the previous fork.
95-
previousExitDomain, err := e2types.ComputeDomain(e2types.DomainVoluntaryExit, response.Data.PreviousVersion[:], genesis.GenesisValidatorsRoot[:])
96-
copy(domain[:], previousExitDomain)
97-
errCheck(err, "Failed to compute domain")
98-
verified, err = util.VerifyRoot(account, opRoot, domain, sig)
99-
errCheck(err, "Failed to verify voluntary exit")
100-
}
103+
101104
assert(verified, "Voluntary exit failed to verify against current and previous fork versions")
102105

103106
outputIf(viper.GetBool("verbose"), "Verified")

0 commit comments

Comments
 (0)