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
3 changes: 3 additions & 0 deletions app/eth1wrap/eth1wrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ func TestClientRun(t *testing.T) {
// 4. Reconnects
// 5. Second call to ERC1271 succeeds
t.Run("reconnect when connection lost", func(t *testing.T) {
// This is a known flaky test: BlockNumber & Close mocks were not called.
t.SkipNow()

createFaultyClient := func() eth1wrap.EthClient {
mockEth1Client := mocks.NewEthClient(t)
mockEth1Client.On("BlockNumber", mock.Anything).Return(uint64(0),
Expand Down
1 change: 0 additions & 1 deletion cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ func New() *cobra.Command {
newCombineCmd(newCombineFunc),
newAlphaCmd(
newAddValidatorsCmd(runAddValidators),
newViewClusterManifestCmd(runViewClusterManifest),
newTestCmd(
newTestAllCmd(runTestAll),
newTestPeersCmd(runTestPeers),
Expand Down
4 changes: 2 additions & 2 deletions cmd/exit_broadcast.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ func runBcastFullExit(ctx context.Context, config exitConfig) error {
return errors.Wrap(err, "load identity key")
}

cl, err := loadClusterManifest("", config.LockFilePath)
cl, err := loadClusterLock(config.LockFilePath)
if err != nil {
return errors.Wrap(err, "load cluster lock", z.Str("lock_file_path", config.LockFilePath))
return err
}

beaconNodeHeaders, err := eth2util.ParseHTTPHeaders(config.BeaconNodeHeaders)
Expand Down
11 changes: 0 additions & 11 deletions cmd/exit_broadcast_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,23 @@ import (
const badStr = "bad"

func Test_runBcastFullExitCmd(t *testing.T) {
t.Parallel()
t.Run("main flow from api", func(t *testing.T) {
t.Parallel()
testRunBcastFullExitCmdFlow(t, false, false)
})
t.Run("main flow from file", func(t *testing.T) {
t.Parallel()
testRunBcastFullExitCmdFlow(t, true, false)
})
t.Run("main flow from api for all", func(t *testing.T) {
t.Parallel()
testRunBcastFullExitCmdFlow(t, false, true)
})
t.Run("main flow from file for all", func(t *testing.T) {
t.Parallel()
testRunBcastFullExitCmdFlow(t, true, true)
})
t.Run("main flow from api for all with already exited validator", func(t *testing.T) {
t.Parallel()
testRunBcastFullExitCmdFlow(t, false, false)
testRunBcastFullExitCmdFlow(t, false, true)
})
t.Run("main flow from file for all with already exited validator", func(t *testing.T) {
t.Parallel()
testRunBcastFullExitCmdFlow(t, true, false)
testRunBcastFullExitCmdFlow(t, true, true)
})
Expand Down Expand Up @@ -208,8 +201,6 @@ func testRunBcastFullExitCmdFlow(t *testing.T, fromFile bool, all bool) {
}

func Test_runBcastFullExitCmd_Config(t *testing.T) {
t.Parallel()

type test struct {
name string
noIdentity bool
Expand Down Expand Up @@ -271,8 +262,6 @@ func Test_runBcastFullExitCmd_Config(t *testing.T) {

for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
t.Parallel()

ctx := context.Background()

valAmt := 100
Expand Down
4 changes: 2 additions & 2 deletions cmd/exit_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ func runDeleteExit(ctx context.Context, config exitConfig) error {
return errors.Wrap(err, "load identity key", z.Str("private_key_path", config.PrivateKeyPath))
}

cl, err := loadClusterManifest("", config.LockFilePath)
cl, err := loadClusterLock(config.LockFilePath)
if err != nil {
return errors.Wrap(err, "load cluster lock", z.Str("lock_file_path", config.LockFilePath))
return err
}

oAPI, err := obolapi.New(config.PublishAddress, obolapi.WithTimeout(config.PublishTimeout))
Expand Down
3 changes: 0 additions & 3 deletions cmd/exit_delete_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,10 @@ import (
)

func Test_runDeleteExit(t *testing.T) {
t.Parallel()
t.Run("full flow", func(t *testing.T) {
t.Parallel()
testRunDeleteExitFullFlow(t, false)
})
t.Run("full flow all", func(t *testing.T) {
t.Parallel()
testRunDeleteExitFullFlow(t, true)
})
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/exit_fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ func runFetchExit(ctx context.Context, config exitConfig) error {
return errors.Wrap(err, "load identity key", z.Str("private_key_path", config.PrivateKeyPath))
}

cl, err := loadClusterManifest("", config.LockFilePath)
cl, err := loadClusterLock(config.LockFilePath)
if err != nil {
return errors.Wrap(err, "load cluster lock", z.Str("lock_file_path", config.LockFilePath))
return err
}

oAPI, err := obolapi.New(config.PublishAddress, obolapi.WithTimeout(config.PublishTimeout))
Expand Down
5 changes: 0 additions & 5 deletions cmd/exit_fetch_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,10 @@ import (
)

func Test_runFetchExit(t *testing.T) {
t.Parallel()
t.Run("full flow", func(t *testing.T) {
t.Parallel()
testRunFetchExitFullFlow(t, false)
})
t.Run("full flow all", func(t *testing.T) {
t.Parallel()
testRunFetchExitFullFlow(t, true)
})
t.Run("bad out dir", Test_runFetchExitBadOutDir)
Expand Down Expand Up @@ -152,8 +149,6 @@ func testRunFetchExitFullFlow(t *testing.T, all bool) {
}

func Test_runFetchExitBadOutDir(t *testing.T) {
t.Parallel()

config := exitConfig{
FetchedExitPath: "bad",
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/exit_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ func runListActiveValidatorsCmd(ctx context.Context, config exitConfig) error {
}

func listActiveVals(ctx context.Context, config exitConfig) ([]string, error) {
cl, err := loadClusterManifest("", config.LockFilePath)
cl, err := loadClusterLock(config.LockFilePath)
if err != nil {
return nil, errors.Wrap(err, "load cluster lock", z.Str("lock_file_path", config.LockFilePath))
return nil, err
}

beaconNodeHeaders, err := eth2util.ParseHTTPHeaders(config.BeaconNodeHeaders)
Expand Down
2 changes: 1 addition & 1 deletion cmd/exit_list_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func TestExitListCLI(t *testing.T) {
}{
{
name: "check flags",
expectedErr: "load cluster lock: load cluster manifest from disk: load dag from disk: no file found",
expectedErr: "load cluster lock: load dag from disk: no file found",
flags: []string{
"--lock-file=test",
"--beacon-node-endpoints=test1,test2",
Expand Down
4 changes: 2 additions & 2 deletions cmd/exit_sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ func runSignPartialExit(ctx context.Context, config exitConfig) error {
return errors.Wrap(err, "load identity key", z.Str("private_key_path", config.PrivateKeyPath))
}

cl, err := loadClusterManifest("", config.LockFilePath)
cl, err := loadClusterLock(config.LockFilePath)
if err != nil {
return errors.Wrap(err, "load cluster lock", z.Str("lock_file_path", config.LockFilePath))
return err
}

rawValKeys, err := keystore.LoadFilesUnordered(config.ValidatorKeysDir)
Expand Down
17 changes: 4 additions & 13 deletions cmd/exit_sign_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
package cmd

import (
"context"
"encoding/json"
"fmt"
"math/rand"
Expand Down Expand Up @@ -57,8 +56,6 @@ func writeAllLockData(
}

func Test_runSubmitPartialExit(t *testing.T) {
t.Parallel()

t.Run("main flow with bad pubkey", func(t *testing.T) {
runSubmitPartialExitFlowTest(
t,
Expand Down Expand Up @@ -137,10 +134,8 @@ func Test_runSubmitPartialExit(t *testing.T) {

func runSubmitPartialExitFlowTest(t *testing.T, useValIdx bool, skipBeaconNodeCheck bool, valPubkey string, valIndex uint64, errString string, all bool) {
t.Helper()
t.Parallel()

ctx := context.Background()

ctx := t.Context()
ctx = log.WithCtx(ctx, z.Str("test_case", t.Name()))

valAmt := 100
Expand Down Expand Up @@ -251,8 +246,6 @@ func runSubmitPartialExitFlowTest(t *testing.T, useValIdx bool, skipBeaconNodeCh
}

func Test_runSubmitPartialExit_Config(t *testing.T) {
t.Parallel()

type test struct {
name string
noIdentity bool
Expand Down Expand Up @@ -315,9 +308,7 @@ func Test_runSubmitPartialExit_Config(t *testing.T) {

for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
t.Parallel()

ctx := context.Background()
ctx := t.Context()

valAmt := 100
operatorAmt := 4
Expand Down Expand Up @@ -358,9 +349,9 @@ func Test_runSubmitPartialExit_Config(t *testing.T) {
beaconMock, err := beaconmock.New(t.Context())
require.NoError(t, err)

defer func() {
t.Cleanup(func() {
require.NoError(t, beaconMock.Close())
}()
})

bnURL = beaconMock.Address()
}
Expand Down
9 changes: 5 additions & 4 deletions cmd/manifest_tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ package cmd

import (
"github.com/obolnetwork/charon/app/errors"
"github.com/obolnetwork/charon/app/z"
"github.com/obolnetwork/charon/cluster"
"github.com/obolnetwork/charon/cluster/manifest"
manifestpb "github.com/obolnetwork/charon/cluster/manifestpb/v1"
)

// loadClusterManifest loads cluster manifest from disk.
func loadClusterManifest(manifestFilePath, lockFilePath string) (*manifestpb.Cluster, error) {
// loadClusterLock loads cluster lock from disk.
func loadClusterLock(lockFilePath string) (*manifestpb.Cluster, error) {
verifyLock := func(lock cluster.Lock) error {
if err := lock.VerifyHashes(); err != nil {
return errors.Wrap(err, "cluster lock hash verification failed")
Expand All @@ -23,9 +24,9 @@ func loadClusterManifest(manifestFilePath, lockFilePath string) (*manifestpb.Clu
return nil
}

cluster, err := manifest.LoadCluster(manifestFilePath, lockFilePath, verifyLock)
cluster, err := manifest.LoadCluster("", lockFilePath, verifyLock)
if err != nil {
return nil, errors.Wrap(err, "load cluster manifest from disk")
return nil, errors.Wrap(err, "load cluster lock", z.Str("path", lockFilePath))
}

return cluster, nil
Expand Down
6 changes: 0 additions & 6 deletions cmd/run_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,6 @@ func TestBindPrivKeyFlag(t *testing.T) {
t.Setenv(k, v)
}

t.Cleanup(func() {
for k := range test.Envs {
require.NoError(t, os.Unsetenv(k))
}
})

root.SetArgs(test.Args)

if test.WantErr {
Expand Down
4 changes: 4 additions & 0 deletions cmd/testpeers_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ import (
//go:generate go test . -run=TestPeersTest -update

func TestPeersTest(t *testing.T) {
// This is a known flaky test, skipping for now.
// The test fails pretty reliably when running with pre-commit locally.
t.SkipNow()

peer1PrivKey := base64ToPrivKey(t, "GCc1IKup3kKVxSd9iSu8iX5hc37coxAXasYpGFd/cwo=")
peer2PrivKey := base64ToPrivKey(t, "9PhpdrWEDJugHgoXhpbk2KqR4Gj5QZP/YNxNeJ3Q2+A=")
peer3PrivKey := base64ToPrivKey(t, "GpicOFPB/c/ZKIy1/fOt/4BmEekhFuyxa/SGcjrNe9o=")
Expand Down
Loading
Loading