Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix amount check at deposit validate lost after merges #145

Merged
merged 5 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
12 changes: 6 additions & 6 deletions integration_test/reshare_bulk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ func TestBulkReshareHappyFlows13Ops(t *testing.T) {
"--withdrawAddress", "0x81592c3de184a3e2c0dcb5a261bc107bfa91f494",
"--operatorIDs", "11,22,33,44,55,66,77,88,99,100,111,122,133",
"--nonce", "1",
"--amount", "32000000000"}
"--amount", "2048000000000"}
RootCmd.SetArgs(args)
err := RootCmd.Execute()
require.NoError(t, err)
Expand All @@ -602,7 +602,7 @@ func TestBulkReshareHappyFlows13Ops(t *testing.T) {
"--withdrawAddress", "0x81592c3de184a3e2c0dcb5a261bc107bfa91f494",
"--operatorIDs", "11,22,33,44,55,66,77,88,99,100,111,122,133",
"--nonce", "1",
"--amount", "32000000000"}
"--amount", "2048000000000"}
RootCmd.SetArgs(args)
err := RootCmd.Execute()
require.NoError(t, err)
Expand Down Expand Up @@ -633,7 +633,7 @@ func TestBulkReshareHappyFlows13Ops(t *testing.T) {
"--withdrawAddress", "0x81592c3de184a3e2c0dcb5a261bc107bfa91f494",
"--owner", "0xDCc846fA10C7CfCE9e6Eb37e06eD93b666cFC5E9",
"--nonce", strconv.Itoa(1),
"--amount", "32000000000"}
"--amount", "2048000000000"}
RootCmd.SetArgs(args)
err := RootCmd.Execute()
require.NoError(t, err)
Expand All @@ -658,7 +658,7 @@ func TestBulkReshareHappyFlows13Ops(t *testing.T) {
"--operatorIDs", "11,22,33,44,55,66,77,88,99,100,111,122,133",
"--newOperatorIDs", "11,22,33,44",
"--nonce", "10",
"--amount", "32000000000"}
"--amount", "2048000000000"}
RootCmd.SetArgs(generateReshareMsgArgs)
err = RootCmd.Execute()
require.NoError(t, err)
Expand Down Expand Up @@ -688,7 +688,7 @@ func TestBulkReshareHappyFlows13Ops(t *testing.T) {
"--operatorIDs", "11,22,33,44,55,66,77,88,99,100,111,122,133",
"--newOperatorIDs", "11,22,33,44",
"--nonce", "10",
"--amount", "32000000000",
"--amount", "2048000000000",
"--signatures", signature}
RootCmd.SetArgs(args)
err = RootCmd.Execute()
Expand All @@ -714,7 +714,7 @@ func TestBulkReshareHappyFlows13Ops(t *testing.T) {
"--withdrawAddress", "0x81592c3de184a3e2c0dcb5a261bc107bfa91f494",
"--owner", "0xDCc846fA10C7CfCE9e6Eb37e06eD93b666cFC5E9",
"--nonce", strconv.Itoa(10),
"--amount", "32000000000"}
"--amount", "2048000000000"}
RootCmd.SetArgs(args)
err := RootCmd.Execute()
require.NoError(t, err)
Expand Down
12 changes: 6 additions & 6 deletions integration_test/resign_bulk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -577,14 +577,14 @@ func TestBulkResingHappyFlows13Ops(t *testing.T) {
cli_initiator.StartResigning.Version = version
cli_verify.Verify.Version = version
t.Run("test 13 operators 1 validator bulk happy flow", func(t *testing.T) {
args := []string{"init", "--validators", "1", "--operatorsInfo", string(operators), "--owner", "0xDCc846fA10C7CfCE9e6Eb37e06eD93b666cFC5E9", "--withdrawAddress", "0x81592c3de184a3e2c0dcb5a261bc107bfa91f494", "--operatorIDs", "11,22,33,44,55,66,77,88,99,100,111,122,133", "--nonce", "1", "--amount", "32000000000"}
args := []string{"init", "--validators", "1", "--operatorsInfo", string(operators), "--owner", "0xDCc846fA10C7CfCE9e6Eb37e06eD93b666cFC5E9", "--withdrawAddress", "0x81592c3de184a3e2c0dcb5a261bc107bfa91f494", "--operatorIDs", "11,22,33,44,55,66,77,88,99,100,111,122,133", "--nonce", "1", "--amount", "2048000000000"}
RootCmd.SetArgs(args)
err := RootCmd.Execute()
require.NoError(t, err)
resetFlags(RootCmd)
})
t.Run("test 13 operators 10 validators bulk happy flow", func(t *testing.T) {
args := []string{"init", "--validators", "10", "--operatorsInfo", string(operators), "--owner", "0xDCc846fA10C7CfCE9e6Eb37e06eD93b666cFC5E9", "--withdrawAddress", "0x81592c3de184a3e2c0dcb5a261bc107bfa91f494", "--operatorIDs", "11,22,33,44,55,66,77,88,99,100,111,122,133", "--nonce", "1", "--amount", "32000000000", "--clientCACertPath", "./certs/rootCA.crt"}
args := []string{"init", "--validators", "10", "--operatorsInfo", string(operators), "--owner", "0xDCc846fA10C7CfCE9e6Eb37e06eD93b666cFC5E9", "--withdrawAddress", "0x81592c3de184a3e2c0dcb5a261bc107bfa91f494", "--operatorIDs", "11,22,33,44,55,66,77,88,99,100,111,122,133", "--nonce", "1", "--amount", "2048000000000", "--clientCACertPath", "./certs/rootCA.crt"}
RootCmd.SetArgs(args)
err := RootCmd.Execute()
require.NoError(t, err)
Expand All @@ -602,7 +602,7 @@ func TestBulkResingHappyFlows13Ops(t *testing.T) {
require.NoError(t, err)
validators := []int{1, 10, 100}
for i, c := range initCeremonies {
args := []string{"verify", "--ceremonyDir", "./output/" + c.Name(), "--validators", strconv.Itoa(validators[i]), "--withdrawAddress", "0x81592c3de184a3e2c0dcb5a261bc107bfa91f494", "--owner", "0xDCc846fA10C7CfCE9e6Eb37e06eD93b666cFC5E9", "--nonce", strconv.Itoa(1), "--amount", "32000000000"}
args := []string{"verify", "--ceremonyDir", "./output/" + c.Name(), "--validators", strconv.Itoa(validators[i]), "--withdrawAddress", "0x81592c3de184a3e2c0dcb5a261bc107bfa91f494", "--owner", "0xDCc846fA10C7CfCE9e6Eb37e06eD93b666cFC5E9", "--nonce", strconv.Itoa(1), "--amount", "2048000000000"}
RootCmd.SetArgs(args)
err := RootCmd.Execute()
require.NoError(t, err)
Expand All @@ -626,7 +626,7 @@ func TestBulkResingHappyFlows13Ops(t *testing.T) {
"--withdrawAddress", "0x81592c3de184a3e2c0dcb5a261bc107bfa91f494",
"--operatorIDs", "11,22,33,44,55,66,77,88,99,100,111,122,133",
"--nonce", "10",
"--amount", "32000000000"}
"--amount", "2048000000000"}
RootCmd.SetArgs(generateResignMsgArgs)
err = RootCmd.Execute()
require.NoError(t, err)
Expand Down Expand Up @@ -655,7 +655,7 @@ func TestBulkResingHappyFlows13Ops(t *testing.T) {
"--withdrawAddress", "0x81592c3de184a3e2c0dcb5a261bc107bfa91f494",
"--operatorIDs", "11,22,33,44,55,66,77,88,99,100,111,122,133",
"--nonce", "10",
"--amount", "32000000000",
"--amount", "2048000000000",
"--signatures", signature}
RootCmd.SetArgs(args)
err = RootCmd.Execute()
Expand All @@ -681,7 +681,7 @@ func TestBulkResingHappyFlows13Ops(t *testing.T) {
"--withdrawAddress", "0x81592c3de184a3e2c0dcb5a261bc107bfa91f494",
"--owner", "0xDCc846fA10C7CfCE9e6Eb37e06eD93b666cFC5E9",
"--nonce", strconv.Itoa(10),
"--amount", "32000000000"}
"--amount", "2048000000000"}
RootCmd.SetArgs(args)
err := RootCmd.Execute()
require.NoError(t, err)
Expand Down
6 changes: 3 additions & 3 deletions pkgs/crypto/deposit_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (
"github.com/bloxapp/eth2-key-manager/core"
"github.com/ethereum/go-ethereum/common"
"github.com/hashicorp/go-version"
spec "github.com/ssvlabs/dkg-spec"
"github.com/ssvlabs/ssv-dkg/pkgs/wire"

spec "github.com/ssvlabs/dkg-spec"
spec_crypto "github.com/ssvlabs/dkg-spec/crypto"
"github.com/ssvlabs/ssv-dkg/pkgs/wire"
)

func BuildDepositDataCLI(network core.Network, depositData *phase0.DepositData, depositCLIVersion string) (*wire.DepositDataCLI, error) {
Expand Down Expand Up @@ -122,7 +122,7 @@ func validateFieldFormatting(d *wire.DepositDataCLI) error {
return fmt.Errorf("resulting deposit data json has wrong fields length")
}
// check the deposit amount
if d.Amount != 32000000000 {
if !spec.ValidAmountSet(phase0.Gwei(d.Amount)) {
return fmt.Errorf("resulting deposit data json has wrong amount")
}
v, err := version.NewVersion(d.DepositCliVersion)
Expand Down
Loading