Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions resign.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package spec

import (
"bytes"
"fmt"

"github.com/attestantio/go-eth2-client/spec/phase0"
Expand All @@ -14,6 +15,9 @@ func ValidateResignMessage(
operator *Operator,
proof *SignedProof,
) error {
if !bytes.Equal(resign.Owner[:], proof.Proof.Owner[:]) {
return fmt.Errorf("invalid owner address")
}
if !ValidAmountSet(phase0.Gwei(resign.Amount)) {
return fmt.Errorf("amount should be in range between 32 ETH and 2048 ETH")
}
Expand Down
6 changes: 3 additions & 3 deletions testing/resign_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ func TestValidateResign(t *testing.T) {
))
})

t.Run("add owner address", func(t *testing.T) {
require.NoError(t, spec.ValidateResignMessage(&spec.Resign{
t.Run("invalid owner address", func(t *testing.T) {
require.EqualError(t, spec.ValidateResignMessage(&spec.Resign{
ValidatorPubKey: fixtures.ShareSK(fixtures.TestValidator4Operators).GetPublicKey().Serialize(),
WithdrawalCredentials: fixtures.TestWithdrawalCred,
Fork: fixtures.TestFork,
Expand All @@ -235,7 +235,7 @@ func TestValidateResign(t *testing.T) {
Amount: uint64(crypto.MAX_EFFECTIVE_BALANCE),
},
fixtures.GenerateOperators(4)[0],
&fixtures.TestOperator1Proof4Operators))
&fixtures.TestOperator1Proof4Operators), "invalid owner address")
})

t.Run("invalid proof", func(t *testing.T) {
Expand Down
Loading