diff --git a/api/gateway/BUILD.bazel b/api/gateway/BUILD.bazel index a6eb625a6..b81980498 100644 --- a/api/gateway/BUILD.bazel +++ b/api/gateway/BUILD.bazel @@ -43,8 +43,8 @@ go_test( deps = [ "//api/grpc:go_default_library", "//cmd/beacon-chain/flags:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "@com_github_gorilla_mux//:go_default_library", "@com_github_sirupsen_logrus//hooks/test:go_default_library", "@com_github_urfave_cli_v2//:go_default_library", diff --git a/api/gateway/api_middleware_processing_test.go b/api/gateway/api_middleware_processing_test.go index 99b8a2bec..bf39e838e 100644 --- a/api/gateway/api_middleware_processing_test.go +++ b/api/gateway/api_middleware_processing_test.go @@ -9,8 +9,8 @@ import ( "testing" "github.com/prysmaticlabs/prysm/api/grpc" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/sirupsen/logrus/hooks/test" ) diff --git a/api/gateway/gateway_test.go b/api/gateway/gateway_test.go index b81c1f45a..d26b669b8 100644 --- a/api/gateway/gateway_test.go +++ b/api/gateway/gateway_test.go @@ -11,8 +11,8 @@ import ( "github.com/gorilla/mux" "github.com/prysmaticlabs/prysm/cmd/beacon-chain/flags" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" logTest "github.com/sirupsen/logrus/hooks/test" "github.com/urfave/cli/v2" ) diff --git a/api/gateway/param_handling_test.go b/api/gateway/param_handling_test.go index 1c7114183..bad6d7297 100644 --- a/api/gateway/param_handling_test.go +++ b/api/gateway/param_handling_test.go @@ -6,8 +6,8 @@ import ( "testing" "github.com/gorilla/mux" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestHandleURLParameters(t *testing.T) { diff --git a/api/grpc/BUILD.bazel b/api/grpc/BUILD.bazel index 932215111..30190a21d 100644 --- a/api/grpc/BUILD.bazel +++ b/api/grpc/BUILD.bazel @@ -20,8 +20,8 @@ go_test( srcs = ["grpcutils_test.go"], embed = [":go_default_library"], deps = [ - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "@com_github_grpc_ecosystem_grpc_gateway_v2//runtime:go_default_library", "@com_github_sirupsen_logrus//hooks/test:go_default_library", "@org_golang_google_grpc//:go_default_library", diff --git a/api/grpc/grpcutils_test.go b/api/grpc/grpcutils_test.go index f8cf4a535..ab2e3c718 100644 --- a/api/grpc/grpcutils_test.go +++ b/api/grpc/grpcutils_test.go @@ -7,8 +7,8 @@ import ( "testing" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" logTest "github.com/sirupsen/logrus/hooks/test" "google.golang.org/grpc" "google.golang.org/grpc/metadata" diff --git a/api/pagination/BUILD.bazel b/api/pagination/BUILD.bazel index 113721684..c700c3f76 100644 --- a/api/pagination/BUILD.bazel +++ b/api/pagination/BUILD.bazel @@ -16,7 +16,7 @@ go_test( srcs = ["pagination_test.go"], deps = [ ":go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", ], ) diff --git a/api/pagination/pagination_test.go b/api/pagination/pagination_test.go index 7f33f8743..cf9b6956a 100644 --- a/api/pagination/pagination_test.go +++ b/api/pagination/pagination_test.go @@ -4,8 +4,8 @@ import ( "testing" "github.com/prysmaticlabs/prysm/api/pagination" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestStartAndEndPage(t *testing.T) { diff --git a/async/BUILD.bazel b/async/BUILD.bazel index 292f2cc6f..d63e431bd 100644 --- a/async/BUILD.bazel +++ b/async/BUILD.bazel @@ -24,9 +24,9 @@ go_test( ], embed = [":go_default_library"], deps = [ - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", "@com_github_stretchr_testify//assert:go_default_library", ], diff --git a/async/benchmark_test.go b/async/benchmark_test.go index 477c2a4be..509935bfb 100644 --- a/async/benchmark_test.go +++ b/async/benchmark_test.go @@ -7,7 +7,7 @@ import ( "testing" "github.com/prysmaticlabs/prysm/async" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" log "github.com/sirupsen/logrus" ) diff --git a/async/debounce_test.go b/async/debounce_test.go index a7578ccab..3f597ddb0 100644 --- a/async/debounce_test.go +++ b/async/debounce_test.go @@ -7,9 +7,9 @@ import ( "time" "github.com/prysmaticlabs/prysm/async" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestDebounce_NoEvents(t *testing.T) { @@ -30,7 +30,7 @@ func TestDebounce_NoEvents(t *testing.T) { }) wg.Done() }() - if testutil.WaitTimeout(wg, interval*2) { + if util.WaitTimeout(wg, interval*2) { t.Fatalf("Test should have exited by now, timed out") } assert.Equal(t, 0, timesHandled, "Wrong number of handled calls") @@ -66,7 +66,7 @@ func TestDebounce_CtxClosing(t *testing.T) { }) wg.Done() }() - if testutil.WaitTimeout(wg, interval*2) { + if util.WaitTimeout(wg, interval*2) { t.Fatalf("Test should have exited by now, timed out") } assert.Equal(t, 0, timesHandled, "Wrong number of handled calls") diff --git a/async/event/BUILD.bazel b/async/event/BUILD.bazel index a9d067272..fb8ac225d 100644 --- a/async/event/BUILD.bazel +++ b/async/event/BUILD.bazel @@ -23,7 +23,7 @@ go_test( ], embed = [":go_default_library"], deps = [ - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", ], ) diff --git a/async/event/feed_test.go b/async/event/feed_test.go index b66a1acec..52f6e3ed9 100644 --- a/async/event/feed_test.go +++ b/async/event/feed_test.go @@ -23,7 +23,7 @@ import ( "testing" "time" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" ) func TestFeedPanics(t *testing.T) { diff --git a/async/event/subscription_test.go b/async/event/subscription_test.go index fef86571d..0b9f28212 100644 --- a/async/event/subscription_test.go +++ b/async/event/subscription_test.go @@ -23,7 +23,7 @@ import ( "testing" "time" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) var errInts = errors.New("error in subscribeInts") diff --git a/async/scatter_test.go b/async/scatter_test.go index 3c9424e1a..5eabefe83 100644 --- a/async/scatter_test.go +++ b/async/scatter_test.go @@ -6,8 +6,8 @@ import ( "testing" "github.com/prysmaticlabs/prysm/async" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestDouble(t *testing.T) { diff --git a/beacon-chain/blockchain/BUILD.bazel b/beacon-chain/blockchain/BUILD.bazel index 429818134..61a308b8f 100644 --- a/beacon-chain/blockchain/BUILD.bazel +++ b/beacon-chain/blockchain/BUILD.bazel @@ -116,9 +116,9 @@ go_test( "//encoding/bytesutil:go_default_library", "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/wrapper:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "@com_github_ethereum_go_ethereum//:go_default_library", "@com_github_ethereum_go_ethereum//common:go_default_library", "@com_github_ethereum_go_ethereum//core/types:go_default_library", @@ -165,9 +165,9 @@ go_test( "//encoding/bytesutil:go_default_library", "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/wrapper:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "@com_github_ethereum_go_ethereum//:go_default_library", "@com_github_ethereum_go_ethereum//common:go_default_library", "@com_github_ethereum_go_ethereum//core/types:go_default_library", diff --git a/beacon-chain/blockchain/chain_info_norace_test.go b/beacon-chain/blockchain/chain_info_norace_test.go index 7e2948119..0e6c05d85 100644 --- a/beacon-chain/blockchain/chain_info_norace_test.go +++ b/beacon-chain/blockchain/chain_info_norace_test.go @@ -8,7 +8,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/state/stategen" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestHeadSlot_DataRace(t *testing.T) { diff --git a/beacon-chain/blockchain/chain_info_test.go b/beacon-chain/blockchain/chain_info_test.go index 7fb63d3a7..6d09abe3f 100644 --- a/beacon-chain/blockchain/chain_info_test.go +++ b/beacon-chain/blockchain/chain_info_test.go @@ -14,9 +14,9 @@ import ( "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/protobuf/proto" ) @@ -122,7 +122,7 @@ func TestHeadRoot_UseDB(t *testing.T) { beaconDB := testDB.SetupDB(t) c := &Service{cfg: &Config{BeaconDB: beaconDB}} c.head = &head{root: params.BeaconConfig().ZeroHash} - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() br, err := b.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, beaconDB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(b))) @@ -134,7 +134,7 @@ func TestHeadRoot_UseDB(t *testing.T) { } func TestHeadBlock_CanRetrieve(t *testing.T) { - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = 1 s, err := v1.InitializeFromProto(ðpb.BeaconState{}) require.NoError(t, err) @@ -217,7 +217,7 @@ func TestIsCanonical_Ok(t *testing.T) { beaconDB := testDB.SetupDB(t) c := setupBeaconChain(t, beaconDB) - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.Slot = 0 root, err := blk.Block.HashTreeRoot() require.NoError(t, err) @@ -233,7 +233,7 @@ func TestIsCanonical_Ok(t *testing.T) { } func TestService_HeadValidatorsIndices(t *testing.T) { - s, _ := testutil.DeterministicGenesisState(t, 10) + s, _ := util.DeterministicGenesisState(t, 10) c := &Service{} c.head = &head{} @@ -248,7 +248,7 @@ func TestService_HeadValidatorsIndices(t *testing.T) { } func TestService_HeadSeed(t *testing.T) { - s, _ := testutil.DeterministicGenesisState(t, 1) + s, _ := util.DeterministicGenesisState(t, 1) c := &Service{} seed, err := helpers.Seed(s, 0, params.BeaconConfig().DomainBeaconAttester) require.NoError(t, err) @@ -265,7 +265,7 @@ func TestService_HeadSeed(t *testing.T) { } func TestService_HeadGenesisValidatorRoot(t *testing.T) { - s, _ := testutil.DeterministicGenesisState(t, 1) + s, _ := util.DeterministicGenesisState(t, 1) c := &Service{} c.head = &head{} @@ -298,7 +298,7 @@ func TestService_ChainHeads(t *testing.T) { } func TestService_HeadPublicKeyToValidatorIndex(t *testing.T) { - s, _ := testutil.DeterministicGenesisState(t, 10) + s, _ := util.DeterministicGenesisState(t, 10) c := &Service{} c.head = &head{state: s} @@ -314,7 +314,7 @@ func TestService_HeadPublicKeyToValidatorIndex(t *testing.T) { } func TestService_HeadValidatorIndexToPublicKey(t *testing.T) { - s, _ := testutil.DeterministicGenesisState(t, 10) + s, _ := util.DeterministicGenesisState(t, 10) c := &Service{} c.head = &head{state: s} diff --git a/beacon-chain/blockchain/head_sync_committee_info_test.go b/beacon-chain/blockchain/head_sync_committee_info_test.go index e230785e6..7e4dd2b7a 100644 --- a/beacon-chain/blockchain/head_sync_committee_info_test.go +++ b/beacon-chain/blockchain/head_sync_committee_info_test.go @@ -11,8 +11,8 @@ import ( dbtest "github.com/prysmaticlabs/prysm/beacon-chain/db/testing" "github.com/prysmaticlabs/prysm/beacon-chain/state/stategen" "github.com/prysmaticlabs/prysm/config/params" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestService_headSyncCommitteeFetcher_Errors(t *testing.T) { @@ -52,7 +52,7 @@ func TestService_HeadDomainFetcher_Errors(t *testing.T) { } func TestService_HeadSyncCommitteeIndices(t *testing.T) { - s, _ := testutil.DeterministicGenesisStateAltair(t, params.BeaconConfig().TargetCommitteeSize) + s, _ := util.DeterministicGenesisStateAltair(t, params.BeaconConfig().TargetCommitteeSize) c := &Service{} c.head = &head{state: s} @@ -75,7 +75,7 @@ func TestService_HeadSyncCommitteeIndices(t *testing.T) { } func TestService_headCurrentSyncCommitteeIndices(t *testing.T) { - s, _ := testutil.DeterministicGenesisStateAltair(t, params.BeaconConfig().TargetCommitteeSize) + s, _ := util.DeterministicGenesisStateAltair(t, params.BeaconConfig().TargetCommitteeSize) c := &Service{} c.head = &head{state: s} @@ -89,7 +89,7 @@ func TestService_headCurrentSyncCommitteeIndices(t *testing.T) { } func TestService_headNextSyncCommitteeIndices(t *testing.T) { - s, _ := testutil.DeterministicGenesisStateAltair(t, params.BeaconConfig().TargetCommitteeSize) + s, _ := util.DeterministicGenesisStateAltair(t, params.BeaconConfig().TargetCommitteeSize) c := &Service{} c.head = &head{state: s} @@ -103,7 +103,7 @@ func TestService_headNextSyncCommitteeIndices(t *testing.T) { } func TestService_HeadSyncCommitteePubKeys(t *testing.T) { - s, _ := testutil.DeterministicGenesisStateAltair(t, params.BeaconConfig().TargetCommitteeSize) + s, _ := util.DeterministicGenesisStateAltair(t, params.BeaconConfig().TargetCommitteeSize) c := &Service{} c.head = &head{state: s} @@ -118,7 +118,7 @@ func TestService_HeadSyncCommitteePubKeys(t *testing.T) { } func TestService_HeadSyncCommitteeDomain(t *testing.T) { - s, _ := testutil.DeterministicGenesisStateAltair(t, params.BeaconConfig().TargetCommitteeSize) + s, _ := util.DeterministicGenesisStateAltair(t, params.BeaconConfig().TargetCommitteeSize) c := &Service{} c.head = &head{state: s} @@ -132,7 +132,7 @@ func TestService_HeadSyncCommitteeDomain(t *testing.T) { } func TestService_HeadSyncContributionProofDomain(t *testing.T) { - s, _ := testutil.DeterministicGenesisStateAltair(t, params.BeaconConfig().TargetCommitteeSize) + s, _ := util.DeterministicGenesisStateAltair(t, params.BeaconConfig().TargetCommitteeSize) c := &Service{} c.head = &head{state: s} @@ -146,7 +146,7 @@ func TestService_HeadSyncContributionProofDomain(t *testing.T) { } func TestService_HeadSyncSelectionProofDomain(t *testing.T) { - s, _ := testutil.DeterministicGenesisStateAltair(t, params.BeaconConfig().TargetCommitteeSize) + s, _ := util.DeterministicGenesisStateAltair(t, params.BeaconConfig().TargetCommitteeSize) c := &Service{} c.head = &head{state: s} @@ -164,7 +164,7 @@ func TestSyncCommitteeHeadStateCache_RoundTrip(t *testing.T) { t.Cleanup(func() { syncCommitteeHeadStateCache = cache.NewSyncCommitteeHeadState() }) - beaconState, _ := testutil.DeterministicGenesisStateAltair(t, 100) + beaconState, _ := util.DeterministicGenesisStateAltair(t, 100) require.NoError(t, beaconState.SetSlot(100)) cachedState, err := c.Get(101) require.ErrorContains(t, cache.ErrNotFound.Error(), err) diff --git a/beacon-chain/blockchain/head_test.go b/beacon-chain/blockchain/head_test.go index 7cab0bb76..7e268109f 100644 --- a/beacon-chain/blockchain/head_test.go +++ b/beacon-chain/blockchain/head_test.go @@ -15,9 +15,9 @@ import ( ethpbv1 "github.com/prysmaticlabs/prysm/proto/eth/v1" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" logTest "github.com/sirupsen/logrus/hooks/test" ) @@ -38,9 +38,9 @@ func TestSaveHead_Different(t *testing.T) { beaconDB := testDB.SetupDB(t) service := setupBeaconChain(t, beaconDB) - testutil.NewBeaconBlock() + util.NewBeaconBlock() oldBlock := wrapper.WrappedPhase0SignedBeaconBlock( - testutil.NewBeaconBlock(), + util.NewBeaconBlock(), ) require.NoError(t, service.cfg.BeaconDB.SaveBlock(context.Background(), oldBlock)) oldRoot, err := oldBlock.Block().HashTreeRoot() @@ -51,14 +51,14 @@ func TestSaveHead_Different(t *testing.T) { block: oldBlock, } - newHeadSignedBlock := testutil.NewBeaconBlock() + newHeadSignedBlock := util.NewBeaconBlock() newHeadSignedBlock.Block.Slot = 1 newHeadBlock := newHeadSignedBlock.Block require.NoError(t, service.cfg.BeaconDB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(newHeadSignedBlock))) newRoot, err := newHeadBlock.HashTreeRoot() require.NoError(t, err) - headState, err := testutil.NewBeaconState() + headState, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, headState.SetSlot(1)) require.NoError(t, service.cfg.BeaconDB.SaveStateSummary(context.Background(), ðpb.StateSummary{Slot: 1, Root: newRoot[:]})) @@ -81,7 +81,7 @@ func TestSaveHead_Different_Reorg(t *testing.T) { service := setupBeaconChain(t, beaconDB) oldBlock := wrapper.WrappedPhase0SignedBeaconBlock( - testutil.NewBeaconBlock(), + util.NewBeaconBlock(), ) require.NoError(t, service.cfg.BeaconDB.SaveBlock(context.Background(), oldBlock)) oldRoot, err := oldBlock.Block().HashTreeRoot() @@ -93,7 +93,7 @@ func TestSaveHead_Different_Reorg(t *testing.T) { } reorgChainParent := [32]byte{'B'} - newHeadSignedBlock := testutil.NewBeaconBlock() + newHeadSignedBlock := util.NewBeaconBlock() newHeadSignedBlock.Block.Slot = 1 newHeadSignedBlock.Block.ParentRoot = reorgChainParent[:] newHeadBlock := newHeadSignedBlock.Block @@ -101,7 +101,7 @@ func TestSaveHead_Different_Reorg(t *testing.T) { require.NoError(t, service.cfg.BeaconDB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(newHeadSignedBlock))) newRoot, err := newHeadBlock.HashTreeRoot() require.NoError(t, err) - headState, err := testutil.NewBeaconState() + headState, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, headState.SetSlot(1)) require.NoError(t, service.cfg.BeaconDB.SaveStateSummary(context.Background(), ðpb.StateSummary{Slot: 1, Root: newRoot[:]})) @@ -124,7 +124,7 @@ func TestCacheJustifiedStateBalances_CanCache(t *testing.T) { beaconDB := testDB.SetupDB(t) service := setupBeaconChain(t, beaconDB) - state, _ := testutil.DeterministicGenesisState(t, 100) + state, _ := util.DeterministicGenesisState(t, 100) r := [32]byte{'a'} require.NoError(t, service.cfg.BeaconDB.SaveStateSummary(context.Background(), ðpb.StateSummary{Root: r[:]})) require.NoError(t, service.cfg.BeaconDB.SaveState(context.Background(), state, r)) @@ -136,7 +136,7 @@ func TestUpdateHead_MissingJustifiedRoot(t *testing.T) { beaconDB := testDB.SetupDB(t) service := setupBeaconChain(t, beaconDB) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() require.NoError(t, service.cfg.BeaconDB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(b))) r, err := b.Block.HashTreeRoot() require.NoError(t, err) @@ -150,7 +150,7 @@ func TestUpdateHead_MissingJustifiedRoot(t *testing.T) { func Test_notifyNewHeadEvent(t *testing.T) { t.Run("genesis_state_root", func(t *testing.T) { - bState, _ := testutil.DeterministicGenesisState(t, 10) + bState, _ := util.DeterministicGenesisState(t, 10) notifier := &mock.MockStateNotifier{RecordEvents: true} srv := &Service{ cfg: &Config{ @@ -178,7 +178,7 @@ func Test_notifyNewHeadEvent(t *testing.T) { require.DeepSSZEqual(t, wanted, eventHead) }) t.Run("non_genesis_values", func(t *testing.T) { - bState, _ := testutil.DeterministicGenesisState(t, 10) + bState, _ := util.DeterministicGenesisState(t, 10) notifier := &mock.MockStateNotifier{RecordEvents: true} genesisRoot := [32]byte{1} srv := &Service{ @@ -220,8 +220,8 @@ func TestSaveOrphanedAtts(t *testing.T) { }) defer resetCfg() - genesis, keys := testutil.DeterministicGenesisState(t, 64) - b, err := testutil.GenerateFullBlock(genesis, keys, testutil.DefaultBlockGenConfig(), 1) + genesis, keys := util.DeterministicGenesisState(t, 64) + b, err := util.GenerateFullBlock(genesis, keys, util.DefaultBlockGenConfig(), 1) assert.NoError(t, err) r, err := b.Block.HashTreeRoot() require.NoError(t, err) @@ -246,8 +246,8 @@ func TestSaveOrphanedAtts_CanFilter(t *testing.T) { }) defer resetCfg() - genesis, keys := testutil.DeterministicGenesisState(t, 64) - b, err := testutil.GenerateFullBlock(genesis, keys, testutil.DefaultBlockGenConfig(), 1) + genesis, keys := util.DeterministicGenesisState(t, 64) + b, err := util.GenerateFullBlock(genesis, keys, util.DefaultBlockGenConfig(), 1) assert.NoError(t, err) r, err := b.Block.HashTreeRoot() require.NoError(t, err) diff --git a/beacon-chain/blockchain/info_test.go b/beacon-chain/blockchain/info_test.go index 83cd6db6c..1e8181f47 100644 --- a/beacon-chain/blockchain/info_test.go +++ b/beacon-chain/blockchain/info_test.go @@ -11,9 +11,9 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/state/stategen" "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestService_TreeHandler(t *testing.T) { @@ -22,7 +22,7 @@ func TestService_TreeHandler(t *testing.T) { ctx := context.Background() beaconDB := testDB.SetupDB(t) - headState, err := testutil.NewBeaconState() + headState, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, headState.SetBalances([]uint64{params.BeaconConfig().GweiPerEth})) cfg := &Config{ @@ -38,7 +38,7 @@ func TestService_TreeHandler(t *testing.T) { require.NoError(t, err) require.NoError(t, s.cfg.ForkChoiceStore.ProcessBlock(ctx, 0, [32]byte{'a'}, [32]byte{'g'}, [32]byte{'c'}, 0, 0)) require.NoError(t, s.cfg.ForkChoiceStore.ProcessBlock(ctx, 1, [32]byte{'b'}, [32]byte{'a'}, [32]byte{'c'}, 0, 0)) - s.setHead([32]byte{'a'}, wrapper.WrappedPhase0SignedBeaconBlock(testutil.NewBeaconBlock()), headState) + s.setHead([32]byte{'a'}, wrapper.WrappedPhase0SignedBeaconBlock(util.NewBeaconBlock()), headState) rr := httptest.NewRecorder() handler := http.HandlerFunc(s.TreeHandler) diff --git a/beacon-chain/blockchain/log_test.go b/beacon-chain/blockchain/log_test.go index b3b1562d5..9b4dcbeb5 100644 --- a/beacon-chain/blockchain/log_test.go +++ b/beacon-chain/blockchain/log_test.go @@ -6,7 +6,7 @@ import ( ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" logTest "github.com/sirupsen/logrus/hooks/test" ) diff --git a/beacon-chain/blockchain/metrics_test.go b/beacon-chain/blockchain/metrics_test.go index dda5f8272..f7e58ed8d 100644 --- a/beacon-chain/blockchain/metrics_test.go +++ b/beacon-chain/blockchain/metrics_test.go @@ -5,14 +5,14 @@ import ( "testing" eth "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestReportEpochMetrics_BadHeadState(t *testing.T) { - s, err := testutil.NewBeaconState() + s, err := util.NewBeaconState() require.NoError(t, err) - h, err := testutil.NewBeaconState() + h, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, h.SetValidators(nil)) err = reportEpochMetrics(context.Background(), s, h) @@ -20,9 +20,9 @@ func TestReportEpochMetrics_BadHeadState(t *testing.T) { } func TestReportEpochMetrics_BadAttestation(t *testing.T) { - s, err := testutil.NewBeaconState() + s, err := util.NewBeaconState() require.NoError(t, err) - h, err := testutil.NewBeaconState() + h, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, h.AppendCurrentEpochAttestations(ð.PendingAttestation{InclusionDelay: 0})) err = reportEpochMetrics(context.Background(), s, h) @@ -30,12 +30,12 @@ func TestReportEpochMetrics_BadAttestation(t *testing.T) { } func TestReportEpochMetrics_SlashedValidatorOutOfBound(t *testing.T) { - h, _ := testutil.DeterministicGenesisState(t, 1) + h, _ := util.DeterministicGenesisState(t, 1) v, err := h.ValidatorAtIndex(0) require.NoError(t, err) v.Slashed = true require.NoError(t, h.UpdateValidatorAtIndex(0, v)) - require.NoError(t, h.AppendCurrentEpochAttestations(ð.PendingAttestation{InclusionDelay: 1, Data: testutil.HydrateAttestationData(ð.AttestationData{})})) + require.NoError(t, h.AppendCurrentEpochAttestations(ð.PendingAttestation{InclusionDelay: 1, Data: util.HydrateAttestationData(ð.AttestationData{})})) err = reportEpochMetrics(context.Background(), h, h) require.ErrorContains(t, "slot 0 out of bounds", err) } diff --git a/beacon-chain/blockchain/process_attestation_test.go b/beacon-chain/blockchain/process_attestation_test.go index 986a5047d..bcd85eef8 100644 --- a/beacon-chain/blockchain/process_attestation_test.go +++ b/beacon-chain/blockchain/process_attestation_test.go @@ -14,9 +14,9 @@ import ( "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" "github.com/prysmaticlabs/prysm/time" ) @@ -35,30 +35,30 @@ func TestStore_OnAttestation_ErrorConditions(t *testing.T) { _, err = blockTree1(t, beaconDB, []byte{'g'}) require.NoError(t, err) - BlkWithOutState := testutil.NewBeaconBlock() + BlkWithOutState := util.NewBeaconBlock() BlkWithOutState.Block.Slot = 0 require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(BlkWithOutState))) BlkWithOutStateRoot, err := BlkWithOutState.Block.HashTreeRoot() require.NoError(t, err) - BlkWithStateBadAtt := testutil.NewBeaconBlock() + BlkWithStateBadAtt := util.NewBeaconBlock() BlkWithStateBadAtt.Block.Slot = 1 require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(BlkWithStateBadAtt))) BlkWithStateBadAttRoot, err := BlkWithStateBadAtt.Block.HashTreeRoot() require.NoError(t, err) - s, err := testutil.NewBeaconState() + s, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, s.SetSlot(100*params.BeaconConfig().SlotsPerEpoch)) require.NoError(t, service.cfg.BeaconDB.SaveState(ctx, s, BlkWithStateBadAttRoot)) - BlkWithValidState := testutil.NewBeaconBlock() + BlkWithValidState := util.NewBeaconBlock() BlkWithValidState.Block.Slot = 2 require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(BlkWithValidState))) BlkWithValidStateRoot, err := BlkWithValidState.Block.HashTreeRoot() require.NoError(t, err) - s, err = testutil.NewBeaconState() + s, err = util.NewBeaconState() require.NoError(t, err) err = s.SetFork(ðpb.Fork{ Epoch: 0, @@ -75,17 +75,17 @@ func TestStore_OnAttestation_ErrorConditions(t *testing.T) { }{ { name: "attestation's data slot not aligned with target vote", - a: testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: params.BeaconConfig().SlotsPerEpoch, Target: ðpb.Checkpoint{Root: make([]byte, 32)}}}), + a: util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: params.BeaconConfig().SlotsPerEpoch, Target: ðpb.Checkpoint{Root: make([]byte, 32)}}}), wantedErr: "slot 32 does not match target epoch 0", }, { name: "no pre state for attestations's target block", - a: testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Target: ðpb.Checkpoint{Root: BlkWithOutStateRoot[:]}}}), + a: util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Target: ðpb.Checkpoint{Root: BlkWithOutStateRoot[:]}}}), wantedErr: "could not get pre state for epoch 0", }, { name: "process attestation doesn't match current epoch", - a: testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 100 * params.BeaconConfig().SlotsPerEpoch, Target: ðpb.Checkpoint{Epoch: 100, + a: util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 100 * params.BeaconConfig().SlotsPerEpoch, Target: ðpb.Checkpoint{Epoch: 100, Root: BlkWithStateBadAttRoot[:]}}}), wantedErr: "target epoch 100 does not match current epoch", }, @@ -137,10 +137,10 @@ func TestStore_OnAttestation_Ok(t *testing.T) { } service, err := NewService(ctx, cfg) require.NoError(t, err) - genesisState, pks := testutil.DeterministicGenesisState(t, 64) + genesisState, pks := util.DeterministicGenesisState(t, 64) require.NoError(t, genesisState.SetGenesisTime(uint64(time.Now().Unix())-params.BeaconConfig().SecondsPerSlot)) require.NoError(t, service.saveGenesisData(ctx, genesisState)) - att, err := testutil.GenerateAttestations(genesisState, pks, 1, 0, false) + att, err := util.GenerateAttestations(genesisState, pks, 1, 0, false) require.NoError(t, err) tRoot := bytesutil.ToBytes32(att[0].Data.Target.Root) copied := genesisState.Copy() @@ -162,7 +162,7 @@ func TestStore_SaveCheckpointState(t *testing.T) { service, err := NewService(ctx, cfg) require.NoError(t, err) - s, err := testutil.NewBeaconState() + s, err := util.NewBeaconState() require.NoError(t, err) err = s.SetFinalizedCheckpoint(ðpb.Checkpoint{Root: bytesutil.PadTo([]byte{'A'}, 32)}) require.NoError(t, err) @@ -235,7 +235,7 @@ func TestStore_UpdateCheckpointState(t *testing.T) { require.NoError(t, err) epoch := types.Epoch(1) - baseState, _ := testutil.DeterministicGenesisState(t, 1) + baseState, _ := util.DeterministicGenesisState(t, 1) checkpoint := ðpb.Checkpoint{Epoch: epoch, Root: bytesutil.PadTo([]byte("hi"), 32)} require.NoError(t, service.cfg.BeaconDB.SaveState(ctx, baseState, bytesutil.ToBytes32(checkpoint.Root))) returned, err := service.getAttPreState(ctx, checkpoint) @@ -307,7 +307,7 @@ func TestVerifyBeaconBlock_NoBlock(t *testing.T) { service, err := NewService(ctx, cfg) require.NoError(t, err) - d := testutil.HydrateAttestationData(ðpb.AttestationData{}) + d := util.HydrateAttestationData(ðpb.AttestationData{}) assert.ErrorContains(t, "signed beacon block can't be nil", service.verifyBeaconBlock(ctx, d)) } @@ -319,7 +319,7 @@ func TestVerifyBeaconBlock_futureBlock(t *testing.T) { service, err := NewService(ctx, cfg) require.NoError(t, err) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = 2 require.NoError(t, service.cfg.BeaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b))) r, err := b.Block.HashTreeRoot() @@ -337,7 +337,7 @@ func TestVerifyBeaconBlock_OK(t *testing.T) { service, err := NewService(ctx, cfg) require.NoError(t, err) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = 2 require.NoError(t, service.cfg.BeaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b))) r, err := b.Block.HashTreeRoot() @@ -355,7 +355,7 @@ func TestVerifyFinalizedConsistency_InconsistentRoot(t *testing.T) { service, err := NewService(ctx, cfg) require.NoError(t, err) - b32 := testutil.NewBeaconBlock() + b32 := util.NewBeaconBlock() b32.Block.Slot = 32 require.NoError(t, service.cfg.BeaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b32))) r32, err := b32.Block.HashTreeRoot() @@ -363,7 +363,7 @@ func TestVerifyFinalizedConsistency_InconsistentRoot(t *testing.T) { service.finalizedCheckpt = ðpb.Checkpoint{Epoch: 1} - b33 := testutil.NewBeaconBlock() + b33 := util.NewBeaconBlock() b33.Block.Slot = 33 b33.Block.ParentRoot = r32[:] require.NoError(t, service.cfg.BeaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b33))) @@ -382,7 +382,7 @@ func TestVerifyFinalizedConsistency_OK(t *testing.T) { service, err := NewService(ctx, cfg) require.NoError(t, err) - b32 := testutil.NewBeaconBlock() + b32 := util.NewBeaconBlock() b32.Block.Slot = 32 require.NoError(t, service.cfg.BeaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b32))) r32, err := b32.Block.HashTreeRoot() @@ -390,7 +390,7 @@ func TestVerifyFinalizedConsistency_OK(t *testing.T) { service.finalizedCheckpt = ðpb.Checkpoint{Epoch: 1, Root: r32[:]} - b33 := testutil.NewBeaconBlock() + b33 := util.NewBeaconBlock() b33.Block.Slot = 33 b33.Block.ParentRoot = r32[:] require.NoError(t, service.cfg.BeaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b33))) @@ -409,14 +409,14 @@ func TestVerifyFinalizedConsistency_IsCanonical(t *testing.T) { service, err := NewService(ctx, cfg) require.NoError(t, err) - b32 := testutil.NewBeaconBlock() + b32 := util.NewBeaconBlock() b32.Block.Slot = 32 r32, err := b32.Block.HashTreeRoot() require.NoError(t, err) service.finalizedCheckpt = ðpb.Checkpoint{Epoch: 1, Root: r32[:]} - b33 := testutil.NewBeaconBlock() + b33 := util.NewBeaconBlock() b33.Block.Slot = 33 b33.Block.ParentRoot = r32[:] r33, err := b33.Block.HashTreeRoot() diff --git a/beacon-chain/blockchain/process_block_test.go b/beacon-chain/blockchain/process_block_test.go index 7f33a4193..90a4ad0ec 100644 --- a/beacon-chain/blockchain/process_block_test.go +++ b/beacon-chain/blockchain/process_block_test.go @@ -27,9 +27,9 @@ import ( "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/attestation" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" prysmTime "github.com/prysmaticlabs/prysm/time" ) @@ -49,12 +49,12 @@ func TestStore_OnBlock(t *testing.T) { assert.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(genesis))) validGenesisRoot, err := genesis.Block.HashTreeRoot() require.NoError(t, err) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, service.cfg.BeaconDB.SaveState(ctx, st.Copy(), validGenesisRoot)) roots, err := blockTree1(t, beaconDB, validGenesisRoot[:]) require.NoError(t, err) - random := testutil.NewBeaconBlock() + random := util.NewBeaconBlock() random.Block.Slot = 1 random.Block.ParentRoot = validGenesisRoot[:] assert.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(random))) @@ -75,14 +75,14 @@ func TestStore_OnBlock(t *testing.T) { }{ { name: "parent block root does not have a state", - blk: testutil.NewBeaconBlock(), + blk: util.NewBeaconBlock(), s: st.Copy(), wantErrString: "could not reconstruct parent state", }, { name: "block is from the future", blk: func() *ethpb.SignedBeaconBlock { - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.ParentRoot = randomParentRoot2 b.Block.Slot = params.BeaconConfig().FarFutureSlot return b @@ -93,7 +93,7 @@ func TestStore_OnBlock(t *testing.T) { { name: "could not get finalized block", blk: func() *ethpb.SignedBeaconBlock { - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.ParentRoot = randomParentRoot[:] return b }(), @@ -103,7 +103,7 @@ func TestStore_OnBlock(t *testing.T) { { name: "same slot as finalized block", blk: func() *ethpb.SignedBeaconBlock { - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = 0 b.Block.ParentRoot = randomParentRoot2 return b @@ -151,7 +151,7 @@ func TestStore_OnBlockBatch(t *testing.T) { service.cfg.ForkChoiceStore = protoarray.New(0, 0, [32]byte{}) service.saveInitSyncBlock(gRoot, wrapper.WrappedPhase0SignedBeaconBlock(genesis)) - st, keys := testutil.DeterministicGenesisState(t, 64) + st, keys := util.DeterministicGenesisState(t, 64) bState := st.Copy() @@ -159,7 +159,7 @@ func TestStore_OnBlockBatch(t *testing.T) { var blkRoots [][32]byte var firstState state.BeaconState for i := 1; i < 10; i++ { - b, err := testutil.GenerateFullBlock(bState, keys, testutil.DefaultBlockGenConfig(), types.Slot(i)) + b, err := util.GenerateFullBlock(bState, keys, util.DefaultBlockGenConfig(), types.Slot(i)) require.NoError(t, err) bState, err = transition.ExecuteStateTransition(ctx, bState, wrapper.WrappedPhase0SignedBeaconBlock(b)) require.NoError(t, err) @@ -196,11 +196,11 @@ func TestRemoveStateSinceLastFinalized_EmptyStartSlot(t *testing.T) { update, err := service.shouldUpdateCurrentJustified(ctx, ðpb.Checkpoint{Root: make([]byte, 32)}) require.NoError(t, err) assert.Equal(t, true, update, "Should be able to update justified") - lastJustifiedBlk := testutil.NewBeaconBlock() + lastJustifiedBlk := util.NewBeaconBlock() lastJustifiedBlk.Block.ParentRoot = bytesutil.PadTo([]byte{'G'}, 32) lastJustifiedRoot, err := lastJustifiedBlk.Block.HashTreeRoot() require.NoError(t, err) - newJustifiedBlk := testutil.NewBeaconBlock() + newJustifiedBlk := util.NewBeaconBlock() newJustifiedBlk.Block.Slot = 1 newJustifiedBlk.Block.ParentRoot = bytesutil.PadTo(lastJustifiedRoot[:], 32) newJustifiedRoot, err := newJustifiedBlk.Block.HashTreeRoot() @@ -225,11 +225,11 @@ func TestShouldUpdateJustified_ReturnFalse(t *testing.T) { cfg := &Config{BeaconDB: beaconDB} service, err := NewService(ctx, cfg) require.NoError(t, err) - lastJustifiedBlk := testutil.NewBeaconBlock() + lastJustifiedBlk := util.NewBeaconBlock() lastJustifiedBlk.Block.ParentRoot = bytesutil.PadTo([]byte{'G'}, 32) lastJustifiedRoot, err := lastJustifiedBlk.Block.HashTreeRoot() require.NoError(t, err) - newJustifiedBlk := testutil.NewBeaconBlock() + newJustifiedBlk := util.NewBeaconBlock() newJustifiedBlk.Block.ParentRoot = bytesutil.PadTo(lastJustifiedRoot[:], 32) newJustifiedRoot, err := newJustifiedBlk.Block.HashTreeRoot() require.NoError(t, err) @@ -270,7 +270,7 @@ func TestCachedPreState_CanGetFromStateSummary(t *testing.T) { service.cfg.ForkChoiceStore = protoarray.New(0, 0, [32]byte{}) service.saveInitSyncBlock(gRoot, wrapper.WrappedPhase0SignedBeaconBlock(genesis)) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = 1 b.Block.ParentRoot = gRoot[:] require.NoError(t, service.cfg.BeaconDB.SaveStateSummary(ctx, ðpb.StateSummary{Slot: 1, Root: gRoot[:]})) @@ -300,7 +300,7 @@ func TestCachedPreState_CanGetFromDB(t *testing.T) { service.cfg.ForkChoiceStore = protoarray.New(0, 0, [32]byte{}) service.saveInitSyncBlock(gRoot, wrapper.WrappedPhase0SignedBeaconBlock(genesis)) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = 1 service.finalizedCheckpt = ðpb.Checkpoint{Root: gRoot[:]} err = service.verifyBlkPreState(ctx, wrapper.WrappedPhase0BeaconBlock(b.Block)) @@ -323,18 +323,18 @@ func TestUpdateJustified_CouldUpdateBest(t *testing.T) { service, err := NewService(ctx, cfg) require.NoError(t, err) - signedBlock := testutil.NewBeaconBlock() + signedBlock := util.NewBeaconBlock() require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(signedBlock))) r, err := signedBlock.Block.HashTreeRoot() require.NoError(t, err) service.justifiedCheckpt = ðpb.Checkpoint{Root: []byte{'A'}} service.bestJustifiedCheckpt = ðpb.Checkpoint{Root: []byte{'A'}} - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, beaconDB.SaveState(ctx, st.Copy(), r)) // Could update - s, err := testutil.NewBeaconState() + s, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, s.SetCurrentJustifiedCheckpoint(ðpb.Checkpoint{Epoch: 1, Root: r[:]})) require.NoError(t, service.updateJustified(context.Background(), s)) @@ -363,15 +363,15 @@ func TestFillForkChoiceMissingBlocks_CanSave(t *testing.T) { require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(genesis))) validGenesisRoot, err := genesis.Block.HashTreeRoot() require.NoError(t, err) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, service.cfg.BeaconDB.SaveState(ctx, st.Copy(), validGenesisRoot)) roots, err := blockTree1(t, beaconDB, validGenesisRoot[:]) require.NoError(t, err) - beaconState, _ := testutil.DeterministicGenesisState(t, 32) - block := testutil.NewBeaconBlock() + beaconState, _ := util.DeterministicGenesisState(t, 32) + block := util.NewBeaconBlock() block.Block.Slot = 9 block.Block.ParentRoot = roots[8] @@ -401,15 +401,15 @@ func TestFillForkChoiceMissingBlocks_RootsMatch(t *testing.T) { require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(genesis))) validGenesisRoot, err := genesis.Block.HashTreeRoot() require.NoError(t, err) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, service.cfg.BeaconDB.SaveState(ctx, st.Copy(), validGenesisRoot)) roots, err := blockTree1(t, beaconDB, validGenesisRoot[:]) require.NoError(t, err) - beaconState, _ := testutil.DeterministicGenesisState(t, 32) - block := testutil.NewBeaconBlock() + beaconState, _ := util.DeterministicGenesisState(t, 32) + block := util.NewBeaconBlock() block.Block.Slot = 9 block.Block.ParentRoot = roots[8] @@ -443,29 +443,29 @@ func TestFillForkChoiceMissingBlocks_FilterFinalized(t *testing.T) { assert.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(genesis))) validGenesisRoot, err := genesis.Block.HashTreeRoot() assert.NoError(t, err) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, service.cfg.BeaconDB.SaveState(ctx, st.Copy(), validGenesisRoot)) // Define a tree branch, slot 63 <- 64 <- 65 - b63 := testutil.NewBeaconBlock() + b63 := util.NewBeaconBlock() b63.Block.Slot = 63 require.NoError(t, service.cfg.BeaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b63))) r63, err := b63.Block.HashTreeRoot() require.NoError(t, err) - b64 := testutil.NewBeaconBlock() + b64 := util.NewBeaconBlock() b64.Block.Slot = 64 b64.Block.ParentRoot = r63[:] require.NoError(t, service.cfg.BeaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b64))) r64, err := b64.Block.HashTreeRoot() require.NoError(t, err) - b65 := testutil.NewBeaconBlock() + b65 := util.NewBeaconBlock() b65.Block.Slot = 65 b65.Block.ParentRoot = r64[:] require.NoError(t, service.cfg.BeaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b65))) - beaconState, _ := testutil.DeterministicGenesisState(t, 32) + beaconState, _ := util.DeterministicGenesisState(t, 32) err = service.fillInForkChoiceMissingBlocks( context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(b65).Block(), beaconState.FinalizedCheckpoint(), beaconState.CurrentJustifiedCheckpoint()) require.NoError(t, err) @@ -484,67 +484,67 @@ func TestFillForkChoiceMissingBlocks_FilterFinalized(t *testing.T) { // (B1, and B3 are all from the same slots) func blockTree1(t *testing.T, beaconDB db.Database, genesisRoot []byte) ([][]byte, error) { genesisRoot = bytesutil.PadTo(genesisRoot, 32) - b0 := testutil.NewBeaconBlock() + b0 := util.NewBeaconBlock() b0.Block.Slot = 0 b0.Block.ParentRoot = genesisRoot r0, err := b0.Block.HashTreeRoot() if err != nil { return nil, err } - b1 := testutil.NewBeaconBlock() + b1 := util.NewBeaconBlock() b1.Block.Slot = 1 b1.Block.ParentRoot = r0[:] r1, err := b1.Block.HashTreeRoot() if err != nil { return nil, err } - b3 := testutil.NewBeaconBlock() + b3 := util.NewBeaconBlock() b3.Block.Slot = 3 b3.Block.ParentRoot = r0[:] r3, err := b3.Block.HashTreeRoot() if err != nil { return nil, err } - b4 := testutil.NewBeaconBlock() + b4 := util.NewBeaconBlock() b4.Block.Slot = 4 b4.Block.ParentRoot = r3[:] r4, err := b4.Block.HashTreeRoot() if err != nil { return nil, err } - b5 := testutil.NewBeaconBlock() + b5 := util.NewBeaconBlock() b5.Block.Slot = 5 b5.Block.ParentRoot = r4[:] r5, err := b5.Block.HashTreeRoot() if err != nil { return nil, err } - b6 := testutil.NewBeaconBlock() + b6 := util.NewBeaconBlock() b6.Block.Slot = 6 b6.Block.ParentRoot = r4[:] r6, err := b6.Block.HashTreeRoot() if err != nil { return nil, err } - b7 := testutil.NewBeaconBlock() + b7 := util.NewBeaconBlock() b7.Block.Slot = 7 b7.Block.ParentRoot = r5[:] r7, err := b7.Block.HashTreeRoot() if err != nil { return nil, err } - b8 := testutil.NewBeaconBlock() + b8 := util.NewBeaconBlock() b8.Block.Slot = 8 b8.Block.ParentRoot = r6[:] r8, err := b8.Block.HashTreeRoot() if err != nil { return nil, err } - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) for _, b := range []*ethpb.SignedBeaconBlock{b0, b1, b3, b4, b5, b6, b7, b8} { - beaconBlock := testutil.NewBeaconBlock() + beaconBlock := util.NewBeaconBlock() beaconBlock.Block.Slot = b.Block.Slot beaconBlock.Block.ParentRoot = bytesutil.PadTo(b.Block.ParentRoot, 32) if err := beaconDB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(beaconBlock)); err != nil { @@ -590,23 +590,23 @@ func TestAncestor_HandleSkipSlot(t *testing.T) { service, err := NewService(ctx, cfg) require.NoError(t, err) - b1 := testutil.NewBeaconBlock() + b1 := util.NewBeaconBlock() b1.Block.Slot = 1 b1.Block.ParentRoot = bytesutil.PadTo([]byte{'a'}, 32) r1, err := b1.Block.HashTreeRoot() require.NoError(t, err) - b100 := testutil.NewBeaconBlock() + b100 := util.NewBeaconBlock() b100.Block.Slot = 100 b100.Block.ParentRoot = r1[:] r100, err := b100.Block.HashTreeRoot() require.NoError(t, err) - b200 := testutil.NewBeaconBlock() + b200 := util.NewBeaconBlock() b200.Block.Slot = 200 b200.Block.ParentRoot = r100[:] r200, err := b200.Block.HashTreeRoot() require.NoError(t, err) for _, b := range []*ethpb.SignedBeaconBlock{b1, b100, b200} { - beaconBlock := testutil.NewBeaconBlock() + beaconBlock := util.NewBeaconBlock() beaconBlock.Block.Slot = b.Block.Slot beaconBlock.Block.ParentRoot = bytesutil.PadTo(b.Block.ParentRoot, 32) require.NoError(t, beaconDB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(beaconBlock))) @@ -633,23 +633,23 @@ func TestAncestor_CanUseForkchoice(t *testing.T) { service, err := NewService(ctx, cfg) require.NoError(t, err) - b1 := testutil.NewBeaconBlock() + b1 := util.NewBeaconBlock() b1.Block.Slot = 1 b1.Block.ParentRoot = bytesutil.PadTo([]byte{'a'}, 32) r1, err := b1.Block.HashTreeRoot() require.NoError(t, err) - b100 := testutil.NewBeaconBlock() + b100 := util.NewBeaconBlock() b100.Block.Slot = 100 b100.Block.ParentRoot = r1[:] r100, err := b100.Block.HashTreeRoot() require.NoError(t, err) - b200 := testutil.NewBeaconBlock() + b200 := util.NewBeaconBlock() b200.Block.Slot = 200 b200.Block.ParentRoot = r100[:] r200, err := b200.Block.HashTreeRoot() require.NoError(t, err) for _, b := range []*ethpb.SignedBeaconBlock{b1, b100, b200} { - beaconBlock := testutil.NewBeaconBlock() + beaconBlock := util.NewBeaconBlock() beaconBlock.Block.Slot = b.Block.Slot beaconBlock.Block.ParentRoot = bytesutil.PadTo(b.Block.ParentRoot, 32) r, err := b.Block.HashTreeRoot() @@ -672,23 +672,23 @@ func TestAncestor_CanUseDB(t *testing.T) { service, err := NewService(ctx, cfg) require.NoError(t, err) - b1 := testutil.NewBeaconBlock() + b1 := util.NewBeaconBlock() b1.Block.Slot = 1 b1.Block.ParentRoot = bytesutil.PadTo([]byte{'a'}, 32) r1, err := b1.Block.HashTreeRoot() require.NoError(t, err) - b100 := testutil.NewBeaconBlock() + b100 := util.NewBeaconBlock() b100.Block.Slot = 100 b100.Block.ParentRoot = r1[:] r100, err := b100.Block.HashTreeRoot() require.NoError(t, err) - b200 := testutil.NewBeaconBlock() + b200 := util.NewBeaconBlock() b200.Block.Slot = 200 b200.Block.ParentRoot = r100[:] r200, err := b200.Block.HashTreeRoot() require.NoError(t, err) for _, b := range []*ethpb.SignedBeaconBlock{b1, b100, b200} { - beaconBlock := testutil.NewBeaconBlock() + beaconBlock := util.NewBeaconBlock() beaconBlock.Block.Slot = b.Block.Slot beaconBlock.Block.ParentRoot = bytesutil.PadTo(b.Block.ParentRoot, 32) require.NoError(t, beaconDB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(beaconBlock))) // Saves blocks to DB. @@ -757,30 +757,30 @@ func TestFinalizedImpliesNewJustified(t *testing.T) { }, } for _, test := range tests { - beaconState, err := testutil.NewBeaconState() + beaconState, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, beaconState.SetCurrentJustifiedCheckpoint(test.args.stateCheckPoint)) service, err := NewService(ctx, &Config{BeaconDB: beaconDB, StateGen: stategen.New(beaconDB), ForkChoiceStore: protoarray.New(0, 0, [32]byte{})}) require.NoError(t, err) service.justifiedCheckpt = test.args.cachedCheckPoint require.NoError(t, service.cfg.BeaconDB.SaveStateSummary(ctx, ðpb.StateSummary{Root: bytesutil.PadTo(test.want.Root, 32)})) - genesisState, err := testutil.NewBeaconState() + genesisState, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, service.cfg.BeaconDB.SaveState(ctx, genesisState, bytesutil.ToBytes32(test.want.Root))) if test.args.diffFinalizedCheckPoint { - b1 := testutil.NewBeaconBlock() + b1 := util.NewBeaconBlock() b1.Block.Slot = 1 b1.Block.ParentRoot = bytesutil.PadTo([]byte{'a'}, 32) r1, err := b1.Block.HashTreeRoot() require.NoError(t, err) - b100 := testutil.NewBeaconBlock() + b100 := util.NewBeaconBlock() b100.Block.Slot = 100 b100.Block.ParentRoot = r1[:] r100, err := b100.Block.HashTreeRoot() require.NoError(t, err) for _, b := range []*ethpb.SignedBeaconBlock{b1, b100} { - beaconBlock := testutil.NewBeaconBlock() + beaconBlock := util.NewBeaconBlock() beaconBlock.Block.Slot = b.Block.Slot beaconBlock.Block.ParentRoot = bytesutil.PadTo(b.Block.ParentRoot, 32) require.NoError(t, service.cfg.BeaconDB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(beaconBlock))) @@ -798,13 +798,13 @@ func TestVerifyBlkDescendant(t *testing.T) { beaconDB := testDB.SetupDB(t) ctx := context.Background() - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = 1 r, err := b.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b))) - b1 := testutil.NewBeaconBlock() + b1 := util.NewBeaconBlock() b1.Block.Slot = 1 b1.Block.Body.Graffiti = bytesutil.PadTo([]byte{'a'}, 32) r1, err := b1.Block.HashTreeRoot() @@ -873,13 +873,13 @@ func TestUpdateJustifiedInitSync(t *testing.T) { service, err := NewService(ctx, cfg) require.NoError(t, err) - gBlk := testutil.NewBeaconBlock() + gBlk := util.NewBeaconBlock() gRoot, err := gBlk.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, service.cfg.BeaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(gBlk))) require.NoError(t, service.cfg.BeaconDB.SaveGenesisBlockRoot(ctx, gRoot)) require.NoError(t, service.cfg.BeaconDB.SaveStateSummary(ctx, ðpb.StateSummary{Root: gRoot[:]})) - beaconState, _ := testutil.DeterministicGenesisState(t, 32) + beaconState, _ := util.DeterministicGenesisState(t, 32) require.NoError(t, service.cfg.BeaconDB.SaveState(ctx, beaconState, gRoot)) service.genesisRoot = gRoot currentCp := ðpb.Checkpoint{Epoch: 1} @@ -901,7 +901,7 @@ func TestHandleEpochBoundary_BadMetrics(t *testing.T) { service, err := NewService(ctx, cfg) require.NoError(t, err) - s, err := testutil.NewBeaconState() + s, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, s.SetSlot(1)) service.head = &head{state: (*v1.BeaconState)(nil)} @@ -915,7 +915,7 @@ func TestHandleEpochBoundary_UpdateFirstSlot(t *testing.T) { service, err := NewService(ctx, cfg) require.NoError(t, err) - s, _ := testutil.DeterministicGenesisState(t, 1024) + s, _ := util.DeterministicGenesisState(t, 1024) service.head = &head{state: s} require.NoError(t, s.SetSlot(2*params.BeaconConfig().SlotsPerEpoch)) require.NoError(t, service.handleEpochBoundary(ctx, s)) @@ -937,7 +937,7 @@ func TestOnBlock_CanFinalize(t *testing.T) { service, err := NewService(ctx, cfg) require.NoError(t, err) - gs, keys := testutil.DeterministicGenesisState(t, 32) + gs, keys := util.DeterministicGenesisState(t, 32) require.NoError(t, service.saveGenesisData(ctx, gs)) gBlk, err := service.cfg.BeaconDB.GenesisBlock(ctx) require.NoError(t, err) @@ -947,7 +947,7 @@ func TestOnBlock_CanFinalize(t *testing.T) { testState := gs.Copy() for i := types.Slot(1); i <= 4*params.BeaconConfig().SlotsPerEpoch; i++ { - blk, err := testutil.GenerateFullBlock(testState, keys, testutil.DefaultBlockGenConfig(), i) + blk, err := util.GenerateFullBlock(testState, keys, util.DefaultBlockGenConfig(), i) require.NoError(t, err) r, err := blk.Block.HashTreeRoot() require.NoError(t, err) @@ -973,7 +973,7 @@ func TestInsertFinalizedDeposits(t *testing.T) { service, err := NewService(ctx, cfg) require.NoError(t, err) - gs, _ := testutil.DeterministicGenesisState(t, 32) + gs, _ := util.DeterministicGenesisState(t, 32) require.NoError(t, service.saveGenesisData(ctx, gs)) gBlk, err := service.cfg.BeaconDB.GenesisBlock(ctx) require.NoError(t, err) @@ -1008,8 +1008,8 @@ func TestRemoveBlockAttestationsInPool_Canonical(t *testing.T) { }) defer resetCfg() - genesis, keys := testutil.DeterministicGenesisState(t, 64) - b, err := testutil.GenerateFullBlock(genesis, keys, testutil.DefaultBlockGenConfig(), 1) + genesis, keys := util.DeterministicGenesisState(t, 64) + b, err := util.GenerateFullBlock(genesis, keys, util.DefaultBlockGenConfig(), 1) assert.NoError(t, err) r, err := b.Block.HashTreeRoot() require.NoError(t, err) @@ -1032,8 +1032,8 @@ func TestRemoveBlockAttestationsInPool_NonCanonical(t *testing.T) { }) defer resetCfg() - genesis, keys := testutil.DeterministicGenesisState(t, 64) - b, err := testutil.GenerateFullBlock(genesis, keys, testutil.DefaultBlockGenConfig(), 1) + genesis, keys := util.DeterministicGenesisState(t, 64) + b, err := util.GenerateFullBlock(genesis, keys, util.DefaultBlockGenConfig(), 1) assert.NoError(t, err) r, err := b.Block.HashTreeRoot() require.NoError(t, err) diff --git a/beacon-chain/blockchain/receive_attestation_test.go b/beacon-chain/blockchain/receive_attestation_test.go index b268c60d3..59b9f6a4d 100644 --- a/beacon-chain/blockchain/receive_attestation_test.go +++ b/beacon-chain/blockchain/receive_attestation_test.go @@ -17,8 +17,8 @@ import ( "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" prysmTime "github.com/prysmaticlabs/prysm/time" logTest "github.com/sirupsen/logrus/hooks/test" ) @@ -43,12 +43,12 @@ func TestVerifyLMDFFGConsistent_NotOK(t *testing.T) { service, err := NewService(ctx, cfg) require.NoError(t, err) - b32 := testutil.NewBeaconBlock() + b32 := util.NewBeaconBlock() b32.Block.Slot = 32 require.NoError(t, service.cfg.BeaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b32))) r32, err := b32.Block.HashTreeRoot() require.NoError(t, err) - b33 := testutil.NewBeaconBlock() + b33 := util.NewBeaconBlock() b33.Block.Slot = 33 b33.Block.ParentRoot = r32[:] require.NoError(t, service.cfg.BeaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b33))) @@ -56,7 +56,7 @@ func TestVerifyLMDFFGConsistent_NotOK(t *testing.T) { require.NoError(t, err) wanted := "FFG and LMD votes are not consistent" - a := testutil.NewAttestation() + a := util.NewAttestation() a.Data.Target.Epoch = 1 a.Data.Target.Root = []byte{'a'} a.Data.BeaconBlockRoot = r33[:] @@ -71,19 +71,19 @@ func TestVerifyLMDFFGConsistent_OK(t *testing.T) { service, err := NewService(ctx, cfg) require.NoError(t, err) - b32 := testutil.NewBeaconBlock() + b32 := util.NewBeaconBlock() b32.Block.Slot = 32 require.NoError(t, service.cfg.BeaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b32))) r32, err := b32.Block.HashTreeRoot() require.NoError(t, err) - b33 := testutil.NewBeaconBlock() + b33 := util.NewBeaconBlock() b33.Block.Slot = 33 b33.Block.ParentRoot = r32[:] require.NoError(t, service.cfg.BeaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b33))) r33, err := b33.Block.HashTreeRoot() require.NoError(t, err) - a := testutil.NewAttestation() + a := util.NewAttestation() a.Data.Target.Epoch = 1 a.Data.Target.Root = r32[:] a.Data.BeaconBlockRoot = r33[:] @@ -105,10 +105,10 @@ func TestProcessAttestations_Ok(t *testing.T) { service, err := NewService(ctx, cfg) service.genesisTime = prysmTime.Now().Add(-1 * time.Duration(params.BeaconConfig().SecondsPerSlot) * time.Second) require.NoError(t, err) - genesisState, pks := testutil.DeterministicGenesisState(t, 64) + genesisState, pks := util.DeterministicGenesisState(t, 64) require.NoError(t, genesisState.SetGenesisTime(uint64(prysmTime.Now().Unix())-params.BeaconConfig().SecondsPerSlot)) require.NoError(t, service.saveGenesisData(ctx, genesisState)) - atts, err := testutil.GenerateAttestations(genesisState, pks, 1, 0, false) + atts, err := util.GenerateAttestations(genesisState, pks, 1, 0, false) require.NoError(t, err) tRoot := bytesutil.ToBytes32(atts[0].Data.Target.Root) copied := genesisState.Copy() diff --git a/beacon-chain/blockchain/receive_block_test.go b/beacon-chain/blockchain/receive_block_test.go index cf671b2f7..ba1107aba 100644 --- a/beacon-chain/blockchain/receive_block_test.go +++ b/beacon-chain/blockchain/receive_block_test.go @@ -18,18 +18,18 @@ import ( ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" logTest "github.com/sirupsen/logrus/hooks/test" ) func TestService_ReceiveBlock(t *testing.T) { ctx := context.Background() - genesis, keys := testutil.DeterministicGenesisState(t, 64) - genFullBlock := func(t *testing.T, conf *testutil.BlockGenConfig, slot types.Slot) *ethpb.SignedBeaconBlock { - blk, err := testutil.GenerateFullBlock(genesis, keys, conf, slot) + genesis, keys := util.DeterministicGenesisState(t, 64) + genFullBlock := func(t *testing.T, conf *util.BlockGenConfig, slot types.Slot) *ethpb.SignedBeaconBlock { + blk, err := util.GenerateFullBlock(genesis, keys, conf, slot) assert.NoError(t, err) return blk } @@ -49,7 +49,7 @@ func TestService_ReceiveBlock(t *testing.T) { { name: "applies block with state transition", args: args{ - block: genFullBlock(t, testutil.DefaultBlockGenConfig(), 2 /*slot*/), + block: genFullBlock(t, util.DefaultBlockGenConfig(), 2 /*slot*/), }, check: func(t *testing.T, s *Service) { if hs := s.head.state.Slot(); hs != 2 { @@ -64,7 +64,7 @@ func TestService_ReceiveBlock(t *testing.T) { name: "saves attestations to pool", args: args{ block: genFullBlock(t, - &testutil.BlockGenConfig{ + &util.BlockGenConfig{ NumProposerSlashings: 0, NumAttesterSlashings: 0, NumAttestations: 2, @@ -84,7 +84,7 @@ func TestService_ReceiveBlock(t *testing.T) { { name: "updates exit pool", args: args{ - block: genFullBlock(t, &testutil.BlockGenConfig{ + block: genFullBlock(t, &util.BlockGenConfig{ NumProposerSlashings: 0, NumAttesterSlashings: 0, NumAttestations: 0, @@ -108,7 +108,7 @@ func TestService_ReceiveBlock(t *testing.T) { { name: "notifies block processed on state feed", args: args{ - block: genFullBlock(t, testutil.DefaultBlockGenConfig(), 1 /*slot*/), + block: genFullBlock(t, util.DefaultBlockGenConfig(), 1 /*slot*/), }, check: func(t *testing.T, s *Service) { if recvd := len(s.cfg.StateNotifier.(*blockchainTesting.MockStateNotifier).ReceivedEvents()); recvd < 1 { @@ -159,8 +159,8 @@ func TestService_ReceiveBlock(t *testing.T) { func TestService_ReceiveBlockUpdateHead(t *testing.T) { ctx := context.Background() - genesis, keys := testutil.DeterministicGenesisState(t, 64) - b, err := testutil.GenerateFullBlock(genesis, keys, testutil.DefaultBlockGenConfig(), 1) + genesis, keys := util.DeterministicGenesisState(t, 64) + b, err := util.GenerateFullBlock(genesis, keys, util.DefaultBlockGenConfig(), 1) assert.NoError(t, err) beaconDB := testDB.SetupDB(t) genesisBlockRoot := bytesutil.ToBytes32(nil) @@ -204,9 +204,9 @@ func TestService_ReceiveBlockUpdateHead(t *testing.T) { func TestService_ReceiveBlockBatch(t *testing.T) { ctx := context.Background() - genesis, keys := testutil.DeterministicGenesisState(t, 64) - genFullBlock := func(t *testing.T, conf *testutil.BlockGenConfig, slot types.Slot) *ethpb.SignedBeaconBlock { - blk, err := testutil.GenerateFullBlock(genesis, keys, conf, slot) + genesis, keys := util.DeterministicGenesisState(t, 64) + genFullBlock := func(t *testing.T, conf *util.BlockGenConfig, slot types.Slot) *ethpb.SignedBeaconBlock { + blk, err := util.GenerateFullBlock(genesis, keys, conf, slot) assert.NoError(t, err) return blk } @@ -223,7 +223,7 @@ func TestService_ReceiveBlockBatch(t *testing.T) { { name: "applies block with state transition", args: args{ - block: genFullBlock(t, testutil.DefaultBlockGenConfig(), 2 /*slot*/), + block: genFullBlock(t, util.DefaultBlockGenConfig(), 2 /*slot*/), }, check: func(t *testing.T, s *Service) { assert.Equal(t, types.Slot(2), s.head.state.Slot(), "Incorrect head state slot") @@ -233,7 +233,7 @@ func TestService_ReceiveBlockBatch(t *testing.T) { { name: "notifies block processed on state feed", args: args{ - block: genFullBlock(t, testutil.DefaultBlockGenConfig(), 1 /*slot*/), + block: genFullBlock(t, util.DefaultBlockGenConfig(), 1 /*slot*/), }, check: func(t *testing.T, s *Service) { if recvd := len(s.cfg.StateNotifier.(*blockchainTesting.MockStateNotifier).ReceivedEvents()); recvd < 1 { @@ -290,7 +290,7 @@ func TestService_HasInitSyncBlock(t *testing.T) { if s.HasInitSyncBlock(r) { t.Error("Should not have block") } - s.saveInitSyncBlock(r, wrapper.WrappedPhase0SignedBeaconBlock(testutil.NewBeaconBlock())) + s.saveInitSyncBlock(r, wrapper.WrappedPhase0SignedBeaconBlock(util.NewBeaconBlock())) if !s.HasInitSyncBlock(r) { t.Error("Should have block") } diff --git a/beacon-chain/blockchain/service_norace_test.go b/beacon-chain/blockchain/service_norace_test.go index bdbad86c4..44bbe2343 100644 --- a/beacon-chain/blockchain/service_norace_test.go +++ b/beacon-chain/blockchain/service_norace_test.go @@ -6,7 +6,7 @@ import ( "testing" testDB "github.com/prysmaticlabs/prysm/beacon-chain/db/testing" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/sirupsen/logrus" ) diff --git a/beacon-chain/blockchain/service_test.go b/beacon-chain/blockchain/service_test.go index e89be2e3b..8f065cc0f 100644 --- a/beacon-chain/blockchain/service_test.go +++ b/beacon-chain/blockchain/service_test.go @@ -30,9 +30,9 @@ import ( ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" logTest "github.com/sirupsen/logrus/hooks/test" "google.golang.org/protobuf/proto" ) @@ -75,7 +75,7 @@ func setupBeaconChain(t *testing.T, beaconDB db.Database) *Service { ctx := context.Background() var web3Service *powchain.Service var err error - bState, _ := testutil.DeterministicGenesisState(t, 10) + bState, _ := util.DeterministicGenesisState(t, 10) pbState, err := v1.ProtobufBeaconState(bState.InnerStateUnsafe()) require.NoError(t, err) err = beaconDB.SavePowchainData(ctx, ðpb.ETH1ChainData{ @@ -137,11 +137,11 @@ func TestChainStartStop_Initialized(t *testing.T) { chainService := setupBeaconChain(t, beaconDB) - genesisBlk := testutil.NewBeaconBlock() + genesisBlk := util.NewBeaconBlock() blkRoot, err := genesisBlk.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(genesisBlk))) - s, err := testutil.NewBeaconState() + s, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, s.SetSlot(1)) require.NoError(t, beaconDB.SaveState(ctx, s, blkRoot)) @@ -167,11 +167,11 @@ func TestChainStartStop_GenesisZeroHashes(t *testing.T) { chainService := setupBeaconChain(t, beaconDB) - genesisBlk := testutil.NewBeaconBlock() + genesisBlk := util.NewBeaconBlock() blkRoot, err := genesisBlk.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(genesisBlk))) - s, err := testutil.NewBeaconState() + s, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, beaconDB.SaveState(ctx, s, blkRoot)) require.NoError(t, beaconDB.SaveGenesisBlockRoot(ctx, blkRoot)) @@ -197,9 +197,9 @@ func TestChainService_InitializeBeaconChain(t *testing.T) { // Set up 10 deposits pre chain start for validators to register count := uint64(10) - deposits, _, err := testutil.DeterministicDepositsAndKeys(count) + deposits, _, err := util.DeterministicDepositsAndKeys(count) require.NoError(t, err) - trie, _, err := testutil.DepositTrieFromDeposits(deposits) + trie, _, err := util.DepositTrieFromDeposits(deposits) require.NoError(t, err) hashTreeRoot := trie.HashTreeRoot() genState, err := transition.EmptyGenesisState() @@ -236,11 +236,11 @@ func TestChainService_CorrectGenesisRoots(t *testing.T) { chainService := setupBeaconChain(t, beaconDB) - genesisBlk := testutil.NewBeaconBlock() + genesisBlk := util.NewBeaconBlock() blkRoot, err := genesisBlk.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(genesisBlk))) - s, err := testutil.NewBeaconState() + s, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, s.SetSlot(0)) require.NoError(t, beaconDB.SaveState(ctx, s, blkRoot)) @@ -262,17 +262,17 @@ func TestChainService_InitializeChainInfo(t *testing.T) { beaconDB := testDB.SetupDB(t) ctx := context.Background() - genesis := testutil.NewBeaconBlock() + genesis := util.NewBeaconBlock() genesisRoot, err := genesis.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, beaconDB.SaveGenesisBlockRoot(ctx, genesisRoot)) require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(genesis))) finalizedSlot := params.BeaconConfig().SlotsPerEpoch*2 + 1 - headBlock := testutil.NewBeaconBlock() + headBlock := util.NewBeaconBlock() headBlock.Block.Slot = finalizedSlot headBlock.Block.ParentRoot = bytesutil.PadTo(genesisRoot[:], 32) - headState, err := testutil.NewBeaconState() + headState, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, headState.SetSlot(finalizedSlot)) require.NoError(t, headState.SetGenesisValidatorRoot(params.BeaconConfig().ZeroHash[:])) @@ -303,17 +303,17 @@ func TestChainService_InitializeChainInfo_SetHeadAtGenesis(t *testing.T) { beaconDB := testDB.SetupDB(t) ctx := context.Background() - genesis := testutil.NewBeaconBlock() + genesis := util.NewBeaconBlock() genesisRoot, err := genesis.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, beaconDB.SaveGenesisBlockRoot(ctx, genesisRoot)) require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(genesis))) finalizedSlot := params.BeaconConfig().SlotsPerEpoch*2 + 1 - headBlock := testutil.NewBeaconBlock() + headBlock := util.NewBeaconBlock() headBlock.Block.Slot = finalizedSlot headBlock.Block.ParentRoot = bytesutil.PadTo(genesisRoot[:], 32) - headState, err := testutil.NewBeaconState() + headState, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, headState.SetSlot(finalizedSlot)) require.NoError(t, headState.SetGenesisValidatorRoot(params.BeaconConfig().ZeroHash[:])) @@ -345,13 +345,13 @@ func TestChainService_InitializeChainInfo_HeadSync(t *testing.T) { beaconDB := testDB.SetupDB(t) ctx := context.Background() - genesisBlock := testutil.NewBeaconBlock() + genesisBlock := util.NewBeaconBlock() genesisRoot, err := genesisBlock.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, beaconDB.SaveGenesisBlockRoot(ctx, genesisRoot)) require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(genesisBlock))) - finalizedBlock := testutil.NewBeaconBlock() + finalizedBlock := util.NewBeaconBlock() finalizedBlock.Block.Slot = finalizedSlot finalizedBlock.Block.ParentRoot = genesisRoot[:] finalizedRoot, err := finalizedBlock.Block.HashTreeRoot() @@ -359,14 +359,14 @@ func TestChainService_InitializeChainInfo_HeadSync(t *testing.T) { require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(finalizedBlock))) // Set head slot close to the finalization point, no head sync is triggered. - headBlock := testutil.NewBeaconBlock() + headBlock := util.NewBeaconBlock() headBlock.Block.Slot = finalizedSlot + params.BeaconConfig().SlotsPerEpoch*5 headBlock.Block.ParentRoot = finalizedRoot[:] headRoot, err := headBlock.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(headBlock))) - headState, err := testutil.NewBeaconState() + headState, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, headState.SetSlot(headBlock.Block.Slot)) require.NoError(t, headState.SetGenesisValidatorRoot(params.BeaconConfig().ZeroHash[:])) @@ -392,7 +392,7 @@ func TestChainService_InitializeChainInfo_HeadSync(t *testing.T) { assert.LogsDoNotContain(t, hook, "Regenerating state from the last checkpoint at slot") // Set head slot far beyond the finalization point, head sync should be triggered. - headBlock = testutil.NewBeaconBlock() + headBlock = util.NewBeaconBlock() headBlock.Block.Slot = finalizedSlot + params.BeaconConfig().SlotsPerEpoch*headSyncMinEpochsAfterCheckpoint headBlock.Block.ParentRoot = finalizedRoot[:] headRoot, err = headBlock.Block.HashTreeRoot() @@ -419,11 +419,11 @@ func TestChainService_SaveHeadNoDB(t *testing.T) { s := &Service{ cfg: &Config{BeaconDB: beaconDB, StateGen: stategen.New(beaconDB)}, } - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.Slot = 1 r, err := blk.HashTreeRoot() require.NoError(t, err) - newState, err := testutil.NewBeaconState() + newState, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, s.cfg.StateGen.SaveState(ctx, r, newState)) require.NoError(t, s.saveHeadNoDB(ctx, wrapper.WrappedPhase0SignedBeaconBlock(blk), r, newState)) @@ -442,10 +442,10 @@ func TestHasBlock_ForkChoiceAndDB(t *testing.T) { cfg: &Config{ForkChoiceStore: protoarray.New(0, 0, [32]byte{}), BeaconDB: beaconDB}, finalizedCheckpt: ðpb.Checkpoint{Root: make([]byte, 32)}, } - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() r, err := block.Block.HashTreeRoot() require.NoError(t, err) - beaconState, err := testutil.NewBeaconState() + beaconState, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, s.insertBlockAndAttestationsToForkChoiceStore(ctx, wrapper.WrappedPhase0SignedBeaconBlock(block).Block(), r, beaconState)) @@ -462,7 +462,7 @@ func TestServiceStop_SaveCachedBlocks(t *testing.T) { cancel: cancel, initSyncBlocks: make(map[[32]byte]block.SignedBeaconBlock), } - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() r, err := block.Block.HashTreeRoot() require.NoError(t, err) s.saveInitSyncBlock(r, wrapper.WrappedPhase0SignedBeaconBlock(block)) @@ -490,7 +490,7 @@ func BenchmarkHasBlockDB(b *testing.B) { s := &Service{ cfg: &Config{BeaconDB: beaconDB}, } - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() require.NoError(b, s.cfg.BeaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(block))) r, err := block.Block.HashTreeRoot() require.NoError(b, err) diff --git a/beacon-chain/blockchain/weak_subjectivity_checks_test.go b/beacon-chain/blockchain/weak_subjectivity_checks_test.go index 0f5eee766..9d67ce129 100644 --- a/beacon-chain/blockchain/weak_subjectivity_checks_test.go +++ b/beacon-chain/blockchain/weak_subjectivity_checks_test.go @@ -9,14 +9,14 @@ import ( "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestService_VerifyWeakSubjectivityRoot(t *testing.T) { beaconDB := testDB.SetupDB(t) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = 32 require.NoError(t, beaconDB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(b))) r, err := b.Block.HashTreeRoot() diff --git a/beacon-chain/cache/BUILD.bazel b/beacon-chain/cache/BUILD.bazel index 16cc84239..e31f4b6e4 100644 --- a/beacon-chain/cache/BUILD.bazel +++ b/beacon-chain/cache/BUILD.bazel @@ -85,9 +85,9 @@ go_test( "//config/params:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/prysm/v1alpha1:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "@com_github_google_gofuzz//:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", "@org_golang_google_protobuf//proto:go_default_library", diff --git a/beacon-chain/cache/active_balance_test.go b/beacon-chain/cache/active_balance_test.go index 334e2cf93..2d6faa5ed 100644 --- a/beacon-chain/cache/active_balance_test.go +++ b/beacon-chain/cache/active_balance_test.go @@ -10,7 +10,7 @@ import ( "github.com/prysmaticlabs/prysm/config/features" "github.com/prysmaticlabs/prysm/config/params" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestBalanceCache_AddGetBalance(t *testing.T) { diff --git a/beacon-chain/cache/attestation_data_test.go b/beacon-chain/cache/attestation_data_test.go index c4e9bdec8..6fc27f53b 100644 --- a/beacon-chain/cache/attestation_data_test.go +++ b/beacon-chain/cache/attestation_data_test.go @@ -6,7 +6,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/cache" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" "google.golang.org/protobuf/proto" ) diff --git a/beacon-chain/cache/checkpoint_state_test.go b/beacon-chain/cache/checkpoint_state_test.go index 77a839ac1..6507f2197 100644 --- a/beacon-chain/cache/checkpoint_state_test.go +++ b/beacon-chain/cache/checkpoint_state_test.go @@ -9,8 +9,8 @@ import ( "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" "google.golang.org/protobuf/proto" ) diff --git a/beacon-chain/cache/committee_fuzz_test.go b/beacon-chain/cache/committee_fuzz_test.go index 7429da05c..348661e31 100644 --- a/beacon-chain/cache/committee_fuzz_test.go +++ b/beacon-chain/cache/committee_fuzz_test.go @@ -4,8 +4,8 @@ import ( "testing" fuzz "github.com/google/gofuzz" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestCommitteeKeyFuzz_OK(t *testing.T) { diff --git a/beacon-chain/cache/committee_test.go b/beacon-chain/cache/committee_test.go index d8180bf0a..31954be2b 100644 --- a/beacon-chain/cache/committee_test.go +++ b/beacon-chain/cache/committee_test.go @@ -9,8 +9,8 @@ import ( types "github.com/prysmaticlabs/eth2-types" "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/encoding/bytesutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestCommitteeKeyFn_OK(t *testing.T) { diff --git a/beacon-chain/cache/depositcache/BUILD.bazel b/beacon-chain/cache/depositcache/BUILD.bazel index 8641c2526..fc542ea68 100644 --- a/beacon-chain/cache/depositcache/BUILD.bazel +++ b/beacon-chain/cache/depositcache/BUILD.bazel @@ -35,8 +35,8 @@ go_test( "//container/trie:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/prysm/v1alpha1:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "@com_github_sirupsen_logrus//hooks/test:go_default_library", "@org_golang_google_protobuf//proto:go_default_library", ], diff --git a/beacon-chain/cache/depositcache/deposits_cache_test.go b/beacon-chain/cache/depositcache/deposits_cache_test.go index f635b46ce..4aa6b55b8 100644 --- a/beacon-chain/cache/depositcache/deposits_cache_test.go +++ b/beacon-chain/cache/depositcache/deposits_cache_test.go @@ -12,8 +12,8 @@ import ( "github.com/prysmaticlabs/prysm/encoding/bytesutil" dbpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" logTest "github.com/sirupsen/logrus/hooks/test" ) diff --git a/beacon-chain/cache/depositcache/pending_deposits_test.go b/beacon-chain/cache/depositcache/pending_deposits_test.go index 6c94a31e4..ea874f476 100644 --- a/beacon-chain/cache/depositcache/pending_deposits_test.go +++ b/beacon-chain/cache/depositcache/pending_deposits_test.go @@ -8,7 +8,7 @@ import ( "github.com/prysmaticlabs/prysm/encoding/bytesutil" dbpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" "google.golang.org/protobuf/proto" ) diff --git a/beacon-chain/cache/proposer_indices_test.go b/beacon-chain/cache/proposer_indices_test.go index ba630b245..fb7fe2e7b 100644 --- a/beacon-chain/cache/proposer_indices_test.go +++ b/beacon-chain/cache/proposer_indices_test.go @@ -6,8 +6,8 @@ import ( types "github.com/prysmaticlabs/eth2-types" "github.com/prysmaticlabs/prysm/encoding/bytesutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestProposerKeyFn_OK(t *testing.T) { diff --git a/beacon-chain/cache/skip_slot_cache_test.go b/beacon-chain/cache/skip_slot_cache_test.go index 89e11d808..53ad405bf 100644 --- a/beacon-chain/cache/skip_slot_cache_test.go +++ b/beacon-chain/cache/skip_slot_cache_test.go @@ -8,8 +8,8 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/state" v1 "github.com/prysmaticlabs/prysm/beacon-chain/state/v1" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestSkipSlotCache_RoundTrip(t *testing.T) { diff --git a/beacon-chain/cache/subnet_ids_test.go b/beacon-chain/cache/subnet_ids_test.go index 8a3b8afe0..0bd3af62a 100644 --- a/beacon-chain/cache/subnet_ids_test.go +++ b/beacon-chain/cache/subnet_ids_test.go @@ -4,8 +4,8 @@ import ( "testing" types "github.com/prysmaticlabs/eth2-types" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestSubnetIDsCache_RoundTrip(t *testing.T) { diff --git a/beacon-chain/cache/sync_committee_head_state_test.go b/beacon-chain/cache/sync_committee_head_state_test.go index 7c5692769..b7f83aa49 100644 --- a/beacon-chain/cache/sync_committee_head_state_test.go +++ b/beacon-chain/cache/sync_committee_head_state_test.go @@ -9,7 +9,7 @@ import ( v2 "github.com/prysmaticlabs/prysm/beacon-chain/state/v2" "github.com/prysmaticlabs/prysm/config/params" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestSyncCommitteeHeadState(t *testing.T) { diff --git a/beacon-chain/cache/sync_committee_test.go b/beacon-chain/cache/sync_committee_test.go index c7d804435..9dc95fc77 100644 --- a/beacon-chain/cache/sync_committee_test.go +++ b/beacon-chain/cache/sync_committee_test.go @@ -8,13 +8,13 @@ import ( "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestSyncCommitteeCache_CanUpdateAndRetrieve(t *testing.T) { numValidators := 101 - deterministicState, _ := testutil.DeterministicGenesisStateAltair(t, uint64(numValidators)) + deterministicState, _ := util.DeterministicGenesisStateAltair(t, uint64(numValidators)) pubKeys := make([][]byte, deterministicState.NumValidators()) for i, val := range deterministicState.Validators() { pubKeys[i] = val.PublicKey @@ -160,7 +160,7 @@ func TestSyncCommitteeCache_CanUpdateAndRetrieve(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - s, _ := testutil.DeterministicGenesisStateAltair(t, uint64(numValidators)) + s, _ := util.DeterministicGenesisStateAltair(t, uint64(numValidators)) require.NoError(t, s.SetCurrentSyncCommittee(tt.currentSyncCommittee)) require.NoError(t, s.SetNextSyncCommittee(tt.nextSyncCommittee)) cache := cache.NewSyncCommittee() @@ -188,7 +188,7 @@ func TestSyncCommitteeCache_RootDoesNotExist(t *testing.T) { func TestSyncCommitteeCache_CanRotate(t *testing.T) { c := cache.NewSyncCommittee() - s, _ := testutil.DeterministicGenesisStateAltair(t, 64) + s, _ := util.DeterministicGenesisStateAltair(t, 64) require.NoError(t, s.SetCurrentSyncCommittee(convertToCommittee([][]byte{{1}}))) require.NoError(t, c.UpdatePositionsInCommittee([32]byte{'a'}, s)) require.NoError(t, s.SetCurrentSyncCommittee(convertToCommittee([][]byte{{2}}))) diff --git a/beacon-chain/cache/sync_subnet_ids_test.go b/beacon-chain/cache/sync_subnet_ids_test.go index 625795664..74d7496f8 100644 --- a/beacon-chain/cache/sync_subnet_ids_test.go +++ b/beacon-chain/cache/sync_subnet_ids_test.go @@ -4,8 +4,8 @@ import ( "testing" "github.com/prysmaticlabs/prysm/config/params" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestSyncSubnetIDsCache_Roundtrip(t *testing.T) { diff --git a/beacon-chain/core/BUILD.bazel b/beacon-chain/core/BUILD.bazel index ddb00f5a1..6e7ea4cf2 100644 --- a/beacon-chain/core/BUILD.bazel +++ b/beacon-chain/core/BUILD.bazel @@ -13,13 +13,13 @@ go_library( "//runtime/interop:__pkg__", "//shared/attestationutil:__pkg__", "//shared/keystore:__pkg__", - "//shared/testutil:__pkg__", - "//shared/testutil/altair:__pkg__", "//slasher:__subpackages__", + "//testing/altair:__pkg__", "//testing/benchmark/benchmark_files:__subpackages__", "//testing/endtoend/evaluators:__pkg__", "//testing/fuzz:__pkg__", "//testing/spectest:__subpackages__", + "//testing/util:__pkg__", "//tools:__subpackages__", "//validator:__subpackages__", ], @@ -42,8 +42,8 @@ go_test( "//beacon-chain/state/v1:go_default_library", "//config/params:go_default_library", "//proto/prysm/v1alpha1:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "//time:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", ], diff --git a/beacon-chain/core/altair/BUILD.bazel b/beacon-chain/core/altair/BUILD.bazel index ade1b704d..5b21bd9d3 100644 --- a/beacon-chain/core/altair/BUILD.bazel +++ b/beacon-chain/core/altair/BUILD.bazel @@ -16,8 +16,8 @@ go_library( importpath = "github.com/prysmaticlabs/prysm/beacon-chain/core/altair", visibility = [ "//beacon-chain:__subpackages__", - "//shared/testutil:__pkg__", "//testing/spectest:__subpackages__", + "//testing/util:__pkg__", "//validator/client:__pkg__", ], deps = [ @@ -75,9 +75,9 @@ go_test( "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation:go_default_library", "//proto/prysm/v1alpha1/wrapper:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "//time:go_default_library", "@com_github_google_gofuzz//:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", diff --git a/beacon-chain/core/altair/attestation_test.go b/beacon-chain/core/altair/attestation_test.go index 6a1006b63..3eb2ae05c 100644 --- a/beacon-chain/core/altair/attestation_test.go +++ b/beacon-chain/core/altair/attestation_test.go @@ -19,26 +19,26 @@ import ( ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/attestation" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestProcessAttestations_InclusionDelayFailure(t *testing.T) { attestations := []*ethpb.Attestation{ - testutil.HydrateAttestation(ðpb.Attestation{ + util.HydrateAttestation(ðpb.Attestation{ Data: ðpb.AttestationData{ Target: ðpb.Checkpoint{Epoch: 0, Root: make([]byte, 32)}, Slot: 5, }, }), } - b := testutil.NewBeaconBlockAltair() + b := util.NewBeaconBlockAltair() b.Block = ðpb.BeaconBlockAltair{ Body: ðpb.BeaconBlockBodyAltair{ Attestations: attestations, }, } - beaconState, _ := testutil.DeterministicGenesisStateAltair(t, 100) + beaconState, _ := util.DeterministicGenesisStateAltair(t, 100) want := fmt.Sprintf( "attestation slot %d + inclusion delay %d > state slot %d", @@ -53,18 +53,18 @@ func TestProcessAttestations_InclusionDelayFailure(t *testing.T) { } func TestProcessAttestations_NeitherCurrentNorPrevEpoch(t *testing.T) { - att := testutil.HydrateAttestation(ðpb.Attestation{ + att := util.HydrateAttestation(ðpb.Attestation{ Data: ðpb.AttestationData{ Source: ðpb.Checkpoint{Epoch: 0, Root: []byte("hello-world")}, Target: ðpb.Checkpoint{Epoch: 0}}}) - b := testutil.NewBeaconBlockAltair() + b := util.NewBeaconBlockAltair() b.Block = ðpb.BeaconBlockAltair{ Body: ðpb.BeaconBlockBodyAltair{ Attestations: []*ethpb.Attestation{att}, }, } - beaconState, _ := testutil.DeterministicGenesisStateAltair(t, 100) + beaconState, _ := util.DeterministicGenesisStateAltair(t, 100) err := beaconState.SetSlot(beaconState.Slot() + params.BeaconConfig().SlotsPerEpoch*4 + params.BeaconConfig().MinAttestationInclusionDelay) require.NoError(t, err) pfc := beaconState.PreviousJustifiedCheckpoint() @@ -93,13 +93,13 @@ func TestProcessAttestations_CurrentEpochFFGDataMismatches(t *testing.T) { AggregationBits: bitfield.Bitlist{0x09}, }, } - b := testutil.NewBeaconBlockAltair() + b := util.NewBeaconBlockAltair() b.Block = ðpb.BeaconBlockAltair{ Body: ðpb.BeaconBlockBodyAltair{ Attestations: attestations, }, } - beaconState, _ := testutil.DeterministicGenesisStateAltair(t, 100) + beaconState, _ := util.DeterministicGenesisStateAltair(t, 100) require.NoError(t, beaconState.SetSlot(beaconState.Slot()+params.BeaconConfig().MinAttestationInclusionDelay)) cfc := beaconState.CurrentJustifiedCheckpoint() cfc.Root = []byte("hello-world") @@ -119,7 +119,7 @@ func TestProcessAttestations_CurrentEpochFFGDataMismatches(t *testing.T) { } func TestProcessAttestations_PrevEpochFFGDataMismatches(t *testing.T) { - beaconState, _ := testutil.DeterministicGenesisStateAltair(t, 100) + beaconState, _ := util.DeterministicGenesisStateAltair(t, 100) aggBits := bitfield.NewBitlist(3) aggBits.SetBitAt(0, true) @@ -133,7 +133,7 @@ func TestProcessAttestations_PrevEpochFFGDataMismatches(t *testing.T) { AggregationBits: aggBits, }, } - b := testutil.NewBeaconBlockAltair() + b := util.NewBeaconBlockAltair() b.Block = ðpb.BeaconBlockAltair{ Body: ðpb.BeaconBlockBodyAltair{ Attestations: attestations, @@ -161,7 +161,7 @@ func TestProcessAttestations_PrevEpochFFGDataMismatches(t *testing.T) { } func TestProcessAttestations_InvalidAggregationBitsLength(t *testing.T) { - beaconState, _ := testutil.DeterministicGenesisStateAltair(t, 100) + beaconState, _ := util.DeterministicGenesisStateAltair(t, 100) aggBits := bitfield.NewBitlist(4) att := ðpb.Attestation{ @@ -171,7 +171,7 @@ func TestProcessAttestations_InvalidAggregationBitsLength(t *testing.T) { AggregationBits: aggBits, } - b := testutil.NewBeaconBlockAltair() + b := util.NewBeaconBlockAltair() b.Block = ðpb.BeaconBlockAltair{ Body: ðpb.BeaconBlockBodyAltair{ Attestations: []*ethpb.Attestation{att}, @@ -193,13 +193,13 @@ func TestProcessAttestations_InvalidAggregationBitsLength(t *testing.T) { } func TestProcessAttestations_OK(t *testing.T) { - beaconState, privKeys := testutil.DeterministicGenesisStateAltair(t, 100) + beaconState, privKeys := util.DeterministicGenesisStateAltair(t, 100) aggBits := bitfield.NewBitlist(3) aggBits.SetBitAt(0, true) var mockRoot [32]byte copy(mockRoot[:], "hello-world") - att := testutil.HydrateAttestation(ðpb.Attestation{ + att := util.HydrateAttestation(ðpb.Attestation{ Data: ðpb.AttestationData{ Source: ðpb.Checkpoint{Root: mockRoot[:]}, Target: ðpb.Checkpoint{Root: mockRoot[:]}, @@ -225,7 +225,7 @@ func TestProcessAttestations_OK(t *testing.T) { } att.Signature = bls.AggregateSignatures(sigs).Marshal() - block := testutil.NewBeaconBlockAltair() + block := util.NewBeaconBlockAltair() block.Block.Body.Attestations = []*ethpb.Attestation{att} err = beaconState.SetSlot(beaconState.Slot() + params.BeaconConfig().MinAttestationInclusionDelay) @@ -237,7 +237,7 @@ func TestProcessAttestations_OK(t *testing.T) { } func TestProcessAttestationNoVerify_SourceTargetHead(t *testing.T) { - beaconState, _ := testutil.DeterministicGenesisStateAltair(t, 64) + beaconState, _ := util.DeterministicGenesisStateAltair(t, 64) err := beaconState.SetSlot(beaconState.Slot() + params.BeaconConfig().MinAttestationInclusionDelay) require.NoError(t, err) @@ -468,7 +468,7 @@ func TestSetParticipationAndRewardProposer(t *testing.T) { } for _, test := range tests { t.Run(test.name, func(t *testing.T) { - beaconState, _ := testutil.DeterministicGenesisStateAltair(t, params.BeaconConfig().MaxValidatorsPerCommittee) + beaconState, _ := util.DeterministicGenesisStateAltair(t, params.BeaconConfig().MaxValidatorsPerCommittee) require.NoError(t, beaconState.SetSlot(params.BeaconConfig().SlotsPerEpoch)) currentEpoch := core.CurrentEpoch(beaconState) @@ -503,7 +503,7 @@ func TestSetParticipationAndRewardProposer(t *testing.T) { } func TestEpochParticipation(t *testing.T) { - beaconState, _ := testutil.DeterministicGenesisStateAltair(t, params.BeaconConfig().MaxValidatorsPerCommittee) + beaconState, _ := util.DeterministicGenesisStateAltair(t, params.BeaconConfig().MaxValidatorsPerCommittee) cfg := params.BeaconConfig() sourceFlagIndex := cfg.TimelySourceFlagIndex targetFlagIndex := cfg.TimelyTargetFlagIndex @@ -573,7 +573,7 @@ func TestEpochParticipation(t *testing.T) { } func TestRewardProposer(t *testing.T) { - beaconState, _ := testutil.DeterministicGenesisStateAltair(t, params.BeaconConfig().MaxValidatorsPerCommittee) + beaconState, _ := util.DeterministicGenesisStateAltair(t, params.BeaconConfig().MaxValidatorsPerCommittee) require.NoError(t, beaconState.SetSlot(1)) tests := []struct { rewardNumerator uint64 @@ -596,7 +596,7 @@ func TestRewardProposer(t *testing.T) { } func TestAttestationParticipationFlagIndices(t *testing.T) { - beaconState, _ := testutil.DeterministicGenesisStateAltair(t, params.BeaconConfig().MaxValidatorsPerCommittee) + beaconState, _ := util.DeterministicGenesisStateAltair(t, params.BeaconConfig().MaxValidatorsPerCommittee) require.NoError(t, beaconState.SetSlot(1)) cfg := params.BeaconConfig() sourceFlagIndex := cfg.TimelySourceFlagIndex @@ -678,7 +678,7 @@ func TestAttestationParticipationFlagIndices(t *testing.T) { } func TestMatchingStatus(t *testing.T) { - beaconState, _ := testutil.DeterministicGenesisStateAltair(t, params.BeaconConfig().MaxValidatorsPerCommittee) + beaconState, _ := util.DeterministicGenesisStateAltair(t, params.BeaconConfig().MaxValidatorsPerCommittee) require.NoError(t, beaconState.SetSlot(1)) tests := []struct { name string diff --git a/beacon-chain/core/altair/block_test.go b/beacon-chain/core/altair/block_test.go index 2afa74ddb..b47dd7e91 100644 --- a/beacon-chain/core/altair/block_test.go +++ b/beacon-chain/core/altair/block_test.go @@ -15,12 +15,12 @@ import ( "github.com/prysmaticlabs/prysm/crypto/bls" "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestProcessSyncCommittee_PerfectParticipation(t *testing.T) { - beaconState, privKeys := testutil.DeterministicGenesisStateAltair(t, params.BeaconConfig().MaxValidatorsPerCommittee) + beaconState, privKeys := util.DeterministicGenesisStateAltair(t, params.BeaconConfig().MaxValidatorsPerCommittee) require.NoError(t, beaconState.SetSlot(1)) committee, err := altair.NextSyncCommittee(context.Background(), beaconState) require.NoError(t, err) @@ -94,7 +94,7 @@ func TestProcessSyncCommittee_PerfectParticipation(t *testing.T) { } func TestProcessSyncCommittee_MixParticipation_BadSignature(t *testing.T) { - beaconState, privKeys := testutil.DeterministicGenesisStateAltair(t, params.BeaconConfig().MaxValidatorsPerCommittee) + beaconState, privKeys := util.DeterministicGenesisStateAltair(t, params.BeaconConfig().MaxValidatorsPerCommittee) require.NoError(t, beaconState.SetSlot(1)) committee, err := altair.NextSyncCommittee(context.Background(), beaconState) require.NoError(t, err) @@ -129,7 +129,7 @@ func TestProcessSyncCommittee_MixParticipation_BadSignature(t *testing.T) { } func TestProcessSyncCommittee_MixParticipation_GoodSignature(t *testing.T) { - beaconState, privKeys := testutil.DeterministicGenesisStateAltair(t, params.BeaconConfig().MaxValidatorsPerCommittee) + beaconState, privKeys := util.DeterministicGenesisStateAltair(t, params.BeaconConfig().MaxValidatorsPerCommittee) require.NoError(t, beaconState.SetSlot(1)) committee, err := altair.NextSyncCommittee(context.Background(), beaconState) require.NoError(t, err) @@ -166,7 +166,7 @@ func TestProcessSyncCommittee_MixParticipation_GoodSignature(t *testing.T) { } func TestProcessSyncCommittee_FilterSyncCommitteeVotes(t *testing.T) { - beaconState, _ := testutil.DeterministicGenesisStateAltair(t, params.BeaconConfig().MaxValidatorsPerCommittee) + beaconState, _ := util.DeterministicGenesisStateAltair(t, params.BeaconConfig().MaxValidatorsPerCommittee) require.NoError(t, beaconState.SetSlot(1)) committee, err := altair.NextSyncCommittee(context.Background(), beaconState) require.NoError(t, err) @@ -202,7 +202,7 @@ func TestProcessSyncCommittee_FilterSyncCommitteeVotes(t *testing.T) { } func Test_VerifySyncCommitteeSig(t *testing.T) { - beaconState, privKeys := testutil.DeterministicGenesisStateAltair(t, params.BeaconConfig().MaxValidatorsPerCommittee) + beaconState, privKeys := util.DeterministicGenesisStateAltair(t, params.BeaconConfig().MaxValidatorsPerCommittee) require.NoError(t, beaconState.SetSlot(1)) committee, err := altair.NextSyncCommittee(context.Background(), beaconState) require.NoError(t, err) @@ -238,7 +238,7 @@ func Test_VerifySyncCommitteeSig(t *testing.T) { } func Test_ApplySyncRewardsPenalties(t *testing.T) { - beaconState, _ := testutil.DeterministicGenesisStateAltair(t, params.BeaconConfig().MaxValidatorsPerCommittee) + beaconState, _ := util.DeterministicGenesisStateAltair(t, params.BeaconConfig().MaxValidatorsPerCommittee) beaconState, err := altair.ApplySyncRewardsPenalties(beaconState, []types.ValidatorIndex{0, 1}, // voted []types.ValidatorIndex{2, 3}) // didn't vote diff --git a/beacon-chain/core/altair/deposit_fuzz_test.go b/beacon-chain/core/altair/deposit_fuzz_test.go index 1c4feaec0..c440d8ae2 100644 --- a/beacon-chain/core/altair/deposit_fuzz_test.go +++ b/beacon-chain/core/altair/deposit_fuzz_test.go @@ -8,7 +8,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core/altair" stateAltair "github.com/prysmaticlabs/prysm/beacon-chain/state/v2" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestFuzzProcessDeposits_10000(t *testing.T) { diff --git a/beacon-chain/core/altair/deposit_test.go b/beacon-chain/core/altair/deposit_test.go index ab0427dd1..e7c7546ed 100644 --- a/beacon-chain/core/altair/deposit_test.go +++ b/beacon-chain/core/altair/deposit_test.go @@ -12,15 +12,15 @@ import ( "github.com/prysmaticlabs/prysm/crypto/bls" "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestProcessDeposits_SameValidatorMultipleDepositsSameBlock(t *testing.T) { // Same validator created 3 valid deposits within the same block - dep, _, err := testutil.DeterministicDepositsAndKeysSameValidator(3) + dep, _, err := util.DeterministicDepositsAndKeysSameValidator(3) require.NoError(t, err) - eth1Data, err := testutil.DeterministicEth1Data(len(dep)) + eth1Data, err := util.DeterministicEth1Data(len(dep)) require.NoError(t, err) registry := []*ethpb.Validator{ { @@ -75,9 +75,9 @@ func TestProcessDeposits_MerkleBranchFailsVerification(t *testing.T) { } func TestProcessDeposits_AddsNewValidatorDeposit(t *testing.T) { - dep, _, err := testutil.DeterministicDepositsAndKeys(1) + dep, _, err := util.DeterministicDepositsAndKeys(1) require.NoError(t, err) - eth1Data, err := testutil.DeterministicEth1Data(len(dep)) + eth1Data, err := util.DeterministicEth1Data(len(dep)) require.NoError(t, err) registry := []*ethpb.Validator{ @@ -160,9 +160,9 @@ func TestProcessDeposits_RepeatedDeposit_IncreasesValidatorBalance(t *testing.T) func TestProcessDeposit_AddsNewValidatorDeposit(t *testing.T) { // Similar to TestProcessDeposits_AddsNewValidatorDeposit except that this test directly calls ProcessDeposit - dep, _, err := testutil.DeterministicDepositsAndKeys(1) + dep, _, err := util.DeterministicDepositsAndKeys(1) require.NoError(t, err) - eth1Data, err := testutil.DeterministicEth1Data(len(dep)) + eth1Data, err := util.DeterministicEth1Data(len(dep)) require.NoError(t, err) registry := []*ethpb.Validator{ @@ -197,10 +197,10 @@ func TestProcessDeposit_AddsNewValidatorDeposit(t *testing.T) { func TestProcessDeposit_SkipsInvalidDeposit(t *testing.T) { // Same test settings as in TestProcessDeposit_AddsNewValidatorDeposit, except that we use an invalid signature - dep, _, err := testutil.DeterministicDepositsAndKeys(1) + dep, _, err := util.DeterministicDepositsAndKeys(1) require.NoError(t, err) dep[0].Data.Signature = make([]byte, 96) - trie, _, err := testutil.DepositTrieFromDeposits(dep) + trie, _, err := util.DepositTrieFromDeposits(dep) require.NoError(t, err) root := trie.HashTreeRoot() eth1Data := ðpb.Eth1Data{ diff --git a/beacon-chain/core/altair/epoch_precompute_test.go b/beacon-chain/core/altair/epoch_precompute_test.go index c403e7308..60dc784cb 100644 --- a/beacon-chain/core/altair/epoch_precompute_test.go +++ b/beacon-chain/core/altair/epoch_precompute_test.go @@ -10,8 +10,8 @@ import ( stateAltair "github.com/prysmaticlabs/prysm/beacon-chain/state/v2" "github.com/prysmaticlabs/prysm/config/params" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestInitializeEpochValidators_Ok(t *testing.T) { diff --git a/beacon-chain/core/altair/epoch_spec_test.go b/beacon-chain/core/altair/epoch_spec_test.go index c0e6de0a5..7ab45bfaf 100644 --- a/beacon-chain/core/altair/epoch_spec_test.go +++ b/beacon-chain/core/altair/epoch_spec_test.go @@ -14,14 +14,14 @@ import ( "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/protobuf/proto" ) func TestProcessSyncCommitteeUpdates_CanRotate(t *testing.T) { - s, _ := testutil.DeterministicGenesisStateAltair(t, params.BeaconConfig().MaxValidatorsPerCommittee) + s, _ := util.DeterministicGenesisStateAltair(t, params.BeaconConfig().MaxValidatorsPerCommittee) h := ðpb.BeaconBlockHeader{ StateRoot: bytesutil.PadTo([]byte{'a'}, 32), ParentRoot: bytesutil.PadTo([]byte{'b'}, 32), @@ -66,7 +66,7 @@ func TestProcessSyncCommitteeUpdates_CanRotate(t *testing.T) { } func TestProcessParticipationFlagUpdates_CanRotate(t *testing.T) { - s, _ := testutil.DeterministicGenesisStateAltair(t, params.BeaconConfig().MaxValidatorsPerCommittee) + s, _ := util.DeterministicGenesisStateAltair(t, params.BeaconConfig().MaxValidatorsPerCommittee) c, err := s.CurrentEpochParticipation() require.NoError(t, err) require.DeepEqual(t, make([]byte, params.BeaconConfig().MaxValidatorsPerCommittee), c) diff --git a/beacon-chain/core/altair/reward_test.go b/beacon-chain/core/altair/reward_test.go index 9cca5e716..a7a937212 100644 --- a/beacon-chain/core/altair/reward_test.go +++ b/beacon-chain/core/altair/reward_test.go @@ -8,13 +8,13 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core/altair" "github.com/prysmaticlabs/prysm/beacon-chain/state" "github.com/prysmaticlabs/prysm/config/params" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func Test_BaseReward(t *testing.T) { genState := func(valCount uint64) state.ReadOnlyBeaconState { - s, _ := testutil.DeterministicGenesisStateAltair(t, valCount) + s, _ := util.DeterministicGenesisStateAltair(t, valCount) return s } tests := []struct { @@ -66,7 +66,7 @@ func Test_BaseReward(t *testing.T) { } func Test_BaseRewardWithTotalBalance(t *testing.T) { - s, _ := testutil.DeterministicGenesisStateAltair(t, 1) + s, _ := util.DeterministicGenesisStateAltair(t, 1) tests := []struct { name string valIdx types.ValidatorIndex diff --git a/beacon-chain/core/altair/sync_committee_test.go b/beacon-chain/core/altair/sync_committee_test.go index 31d20bb8a..67e1493b5 100644 --- a/beacon-chain/core/altair/sync_committee_test.go +++ b/beacon-chain/core/altair/sync_committee_test.go @@ -12,8 +12,8 @@ import ( "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/crypto/bls" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" prysmTime "github.com/prysmaticlabs/prysm/time" ) diff --git a/beacon-chain/core/altair/transition_test.go b/beacon-chain/core/altair/transition_test.go index 1ada9f810..101b67ba5 100644 --- a/beacon-chain/core/altair/transition_test.go +++ b/beacon-chain/core/altair/transition_test.go @@ -6,12 +6,12 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core/altair" "github.com/prysmaticlabs/prysm/config/params" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestProcessEpoch_CanProcess(t *testing.T) { - st, _ := testutil.DeterministicGenesisStateAltair(t, params.BeaconConfig().MaxValidatorsPerCommittee) + st, _ := util.DeterministicGenesisStateAltair(t, params.BeaconConfig().MaxValidatorsPerCommittee) require.NoError(t, st.SetSlot(10*params.BeaconConfig().SlotsPerEpoch)) newState, err := altair.ProcessEpoch(context.Background(), st) require.NoError(t, err) diff --git a/beacon-chain/core/altair/upgrade_test.go b/beacon-chain/core/altair/upgrade_test.go index a0436c51e..d5c659ba1 100644 --- a/beacon-chain/core/altair/upgrade_test.go +++ b/beacon-chain/core/altair/upgrade_test.go @@ -14,12 +14,12 @@ import ( "github.com/prysmaticlabs/prysm/config/params" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/attestation" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestTranslateParticipation(t *testing.T) { - s, _ := testutil.DeterministicGenesisStateAltair(t, 64) + s, _ := util.DeterministicGenesisStateAltair(t, 64) st, ok := s.(*stateAltair.BeaconState) require.Equal(t, true, ok) require.NoError(t, st.SetSlot(st.Slot()+params.BeaconConfig().MinAttestationInclusionDelay)) @@ -68,7 +68,7 @@ func TestTranslateParticipation(t *testing.T) { } func TestUpgradeToAltair(t *testing.T) { - st, _ := testutil.DeterministicGenesisState(t, params.BeaconConfig().MaxValidatorsPerCommittee) + st, _ := util.DeterministicGenesisState(t, params.BeaconConfig().MaxValidatorsPerCommittee) preForkState := st.Copy() aState, err := altair.UpgradeToAltair(context.Background(), st) require.NoError(t, err) diff --git a/beacon-chain/core/blocks/BUILD.bazel b/beacon-chain/core/blocks/BUILD.bazel index a3e92135e..83a55ab1a 100644 --- a/beacon-chain/core/blocks/BUILD.bazel +++ b/beacon-chain/core/blocks/BUILD.bazel @@ -18,9 +18,9 @@ go_library( importpath = "github.com/prysmaticlabs/prysm/beacon-chain/core/blocks", visibility = [ "//beacon-chain:__subpackages__", - "//shared/testutil:__pkg__", "//testing/fuzz:__pkg__", "//testing/spectest:__subpackages__", + "//testing/util:__pkg__", "//validator/accounts:__pkg__", ], deps = [ @@ -88,9 +88,9 @@ go_test( "//proto/prysm/v1alpha1/attestation/aggregation:go_default_library", "//proto/prysm/v1alpha1/attestation/aggregation/attestations:go_default_library", "//proto/prysm/v1alpha1/wrapper:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "@com_github_google_gofuzz//:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", diff --git a/beacon-chain/core/blocks/attestation_regression_test.go b/beacon-chain/core/blocks/attestation_regression_test.go index 5f2a5061c..21779a305 100644 --- a/beacon-chain/core/blocks/attestation_regression_test.go +++ b/beacon-chain/core/blocks/attestation_regression_test.go @@ -10,9 +10,9 @@ import ( v1 "github.com/prysmaticlabs/prysm/beacon-chain/state/v1" "github.com/prysmaticlabs/prysm/config/params" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) // Beaconfuzz discovered an off by one issue where an attestation could be produced which would pass @@ -50,7 +50,7 @@ func TestProcessAttestationNoVerifySignature_BeaconFuzzIssue78(t *testing.T) { func TestVerifyAttestationNoVerifySignature_IncorrectSourceEpoch(t *testing.T) { // Attestation with an empty signature - beaconState, _ := testutil.DeterministicGenesisState(t, 100) + beaconState, _ := util.DeterministicGenesisState(t, 100) aggBits := bitfield.NewBitlist(3) aggBits.SetBitAt(1, true) diff --git a/beacon-chain/core/blocks/attestation_test.go b/beacon-chain/core/blocks/attestation_test.go index 68299da73..6b6cbdc54 100644 --- a/beacon-chain/core/blocks/attestation_test.go +++ b/beacon-chain/core/blocks/attestation_test.go @@ -16,14 +16,14 @@ import ( "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/attestation" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/attestation/aggregation" attaggregation "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/attestation/aggregation/attestations" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestProcessAggregatedAttestation_OverlappingBits(t *testing.T) { - beaconState, privKeys := testutil.DeterministicGenesisState(t, 100) - data := testutil.HydrateAttestationData(ðpb.AttestationData{ + beaconState, privKeys := util.DeterministicGenesisState(t, 100) + data := util.HydrateAttestationData(ðpb.AttestationData{ Source: ðpb.Checkpoint{Epoch: 0, Root: bytesutil.PadTo([]byte("hello-world"), 32)}, Target: ðpb.Checkpoint{Epoch: 0, Root: bytesutil.PadTo([]byte("hello-world"), 32)}, }) @@ -81,9 +81,9 @@ func TestProcessAggregatedAttestation_OverlappingBits(t *testing.T) { } func TestVerifyAttestationNoVerifySignature_IncorrectSlotTargetEpoch(t *testing.T) { - beaconState, _ := testutil.DeterministicGenesisState(t, 1) + beaconState, _ := util.DeterministicGenesisState(t, 1) - att := testutil.HydrateAttestation(ðpb.Attestation{ + att := util.HydrateAttestation(ðpb.Attestation{ Data: ðpb.AttestationData{ Slot: params.BeaconConfig().SlotsPerEpoch, Target: ðpb.Checkpoint{Root: make([]byte, 32)}, @@ -97,7 +97,7 @@ func TestVerifyAttestationNoVerifySignature_IncorrectSlotTargetEpoch(t *testing. func TestProcessAttestationsNoVerify_OK(t *testing.T) { // Attestation with an empty signature - beaconState, _ := testutil.DeterministicGenesisState(t, 100) + beaconState, _ := util.DeterministicGenesisState(t, 100) aggBits := bitfield.NewBitlist(3) aggBits.SetBitAt(1, true) @@ -128,7 +128,7 @@ func TestProcessAttestationsNoVerify_OK(t *testing.T) { func TestVerifyAttestationNoVerifySignature_OK(t *testing.T) { // Attestation with an empty signature - beaconState, _ := testutil.DeterministicGenesisState(t, 100) + beaconState, _ := util.DeterministicGenesisState(t, 100) aggBits := bitfield.NewBitlist(3) aggBits.SetBitAt(1, true) @@ -157,7 +157,7 @@ func TestVerifyAttestationNoVerifySignature_OK(t *testing.T) { } func TestVerifyAttestationNoVerifySignature_BadAttIdx(t *testing.T) { - beaconState, _ := testutil.DeterministicGenesisState(t, 100) + beaconState, _ := util.DeterministicGenesisState(t, 100) aggBits := bitfield.NewBitlist(3) aggBits.SetBitAt(1, true) var mockRoot [32]byte @@ -216,7 +216,7 @@ func TestConvertToIndexed_OK(t *testing.T) { var sig [96]byte copy(sig[:], "signed") - att := testutil.HydrateAttestation(ðpb.Attestation{ + att := util.HydrateAttestation(ðpb.Attestation{ Signature: sig[:], }) for _, tt := range tests { @@ -238,7 +238,7 @@ func TestConvertToIndexed_OK(t *testing.T) { func TestVerifyIndexedAttestation_OK(t *testing.T) { numOfValidators := uint64(params.BeaconConfig().SlotsPerEpoch.Mul(4)) validators := make([]*ethpb.Validator, numOfValidators) - _, keys, err := testutil.DeterministicDepositsAndKeys(numOfValidators) + _, keys, err := util.DeterministicDepositsAndKeys(numOfValidators) require.NoError(t, err) for i := 0; i < len(validators); i++ { validators[i] = ðpb.Validator{ @@ -263,7 +263,7 @@ func TestVerifyIndexedAttestation_OK(t *testing.T) { attestation *ethpb.IndexedAttestation }{ {attestation: ðpb.IndexedAttestation{ - Data: testutil.HydrateAttestationData(ðpb.AttestationData{ + Data: util.HydrateAttestationData(ðpb.AttestationData{ Target: ðpb.Checkpoint{ Epoch: 2, }, @@ -273,7 +273,7 @@ func TestVerifyIndexedAttestation_OK(t *testing.T) { Signature: make([]byte, 96), }}, {attestation: ðpb.IndexedAttestation{ - Data: testutil.HydrateAttestationData(ðpb.AttestationData{ + Data: util.HydrateAttestationData(ðpb.AttestationData{ Target: ðpb.Checkpoint{ Epoch: 1, }, @@ -282,7 +282,7 @@ func TestVerifyIndexedAttestation_OK(t *testing.T) { Signature: make([]byte, 96), }}, {attestation: ðpb.IndexedAttestation{ - Data: testutil.HydrateAttestationData(ðpb.AttestationData{ + Data: util.HydrateAttestationData(ðpb.AttestationData{ Target: ðpb.Checkpoint{ Epoch: 4, }, @@ -291,7 +291,7 @@ func TestVerifyIndexedAttestation_OK(t *testing.T) { Signature: make([]byte, 96), }}, {attestation: ðpb.IndexedAttestation{ - Data: testutil.HydrateAttestationData(ðpb.AttestationData{ + Data: util.HydrateAttestationData(ðpb.AttestationData{ Target: ðpb.Checkpoint{ Epoch: 7, }, @@ -340,7 +340,7 @@ func TestValidateIndexedAttestation_AboveMaxLength(t *testing.T) { } func TestValidateIndexedAttestation_BadAttestationsSignatureSet(t *testing.T) { - beaconState, keys := testutil.DeterministicGenesisState(t, 128) + beaconState, keys := util.DeterministicGenesisState(t, 128) sig := keys[0].Sign([]byte{'t', 'e', 's', 't'}) list := bitfield.Bitlist{0b11111} @@ -385,7 +385,7 @@ func TestVerifyAttestations_HandlesPlannedFork(t *testing.T) { // In this test, att1 is from the prior fork and att2 is from the new fork. numOfValidators := uint64(params.BeaconConfig().SlotsPerEpoch.Mul(4)) validators := make([]*ethpb.Validator, numOfValidators) - _, keys, err := testutil.DeterministicDepositsAndKeys(numOfValidators) + _, keys, err := util.DeterministicDepositsAndKeys(numOfValidators) require.NoError(t, err) for i := 0; i < len(validators); i++ { validators[i] = ðpb.Validator{ @@ -395,7 +395,7 @@ func TestVerifyAttestations_HandlesPlannedFork(t *testing.T) { } } - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, st.SetSlot(35)) require.NoError(t, st.SetValidators(validators)) @@ -407,7 +407,7 @@ func TestVerifyAttestations_HandlesPlannedFork(t *testing.T) { comm1, err := helpers.BeaconCommitteeFromState(st, 1 /*slot*/, 0 /*committeeIndex*/) require.NoError(t, err) - att1 := testutil.HydrateAttestation(ðpb.Attestation{ + att1 := util.HydrateAttestation(ðpb.Attestation{ AggregationBits: bitfield.NewBitlist(uint64(len(comm1))), Data: ðpb.AttestationData{ Slot: 1, @@ -426,7 +426,7 @@ func TestVerifyAttestations_HandlesPlannedFork(t *testing.T) { comm2, err := helpers.BeaconCommitteeFromState(st, 1*params.BeaconConfig().SlotsPerEpoch+1 /*slot*/, 1 /*committeeIndex*/) require.NoError(t, err) - att2 := testutil.HydrateAttestation(ðpb.Attestation{ + att2 := util.HydrateAttestation(ðpb.Attestation{ AggregationBits: bitfield.NewBitlist(uint64(len(comm2))), Data: ðpb.AttestationData{ Slot: 1*params.BeaconConfig().SlotsPerEpoch + 1, @@ -449,7 +449,7 @@ func TestRetrieveAttestationSignatureSet_VerifiesMultipleAttestations(t *testing ctx := context.Background() numOfValidators := uint64(params.BeaconConfig().SlotsPerEpoch.Mul(4)) validators := make([]*ethpb.Validator, numOfValidators) - _, keys, err := testutil.DeterministicDepositsAndKeys(numOfValidators) + _, keys, err := util.DeterministicDepositsAndKeys(numOfValidators) require.NoError(t, err) for i := 0; i < len(validators); i++ { validators[i] = ðpb.Validator{ @@ -459,14 +459,14 @@ func TestRetrieveAttestationSignatureSet_VerifiesMultipleAttestations(t *testing } } - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, st.SetSlot(5)) require.NoError(t, st.SetValidators(validators)) comm1, err := helpers.BeaconCommitteeFromState(st, 1 /*slot*/, 0 /*committeeIndex*/) require.NoError(t, err) - att1 := testutil.HydrateAttestation(ðpb.Attestation{ + att1 := util.HydrateAttestation(ðpb.Attestation{ AggregationBits: bitfield.NewBitlist(uint64(len(comm1))), Data: ðpb.AttestationData{ Slot: 1, @@ -485,7 +485,7 @@ func TestRetrieveAttestationSignatureSet_VerifiesMultipleAttestations(t *testing comm2, err := helpers.BeaconCommitteeFromState(st, 1 /*slot*/, 1 /*committeeIndex*/) require.NoError(t, err) - att2 := testutil.HydrateAttestation(ðpb.Attestation{ + att2 := util.HydrateAttestation(ðpb.Attestation{ AggregationBits: bitfield.NewBitlist(uint64(len(comm2))), Data: ðpb.AttestationData{ Slot: 1, @@ -512,7 +512,7 @@ func TestRetrieveAttestationSignatureSet_AcrossFork(t *testing.T) { ctx := context.Background() numOfValidators := uint64(params.BeaconConfig().SlotsPerEpoch.Mul(4)) validators := make([]*ethpb.Validator, numOfValidators) - _, keys, err := testutil.DeterministicDepositsAndKeys(numOfValidators) + _, keys, err := util.DeterministicDepositsAndKeys(numOfValidators) require.NoError(t, err) for i := 0; i < len(validators); i++ { validators[i] = ðpb.Validator{ @@ -522,7 +522,7 @@ func TestRetrieveAttestationSignatureSet_AcrossFork(t *testing.T) { } } - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, st.SetSlot(5)) require.NoError(t, st.SetValidators(validators)) @@ -530,7 +530,7 @@ func TestRetrieveAttestationSignatureSet_AcrossFork(t *testing.T) { comm1, err := helpers.BeaconCommitteeFromState(st, 1 /*slot*/, 0 /*committeeIndex*/) require.NoError(t, err) - att1 := testutil.HydrateAttestation(ðpb.Attestation{ + att1 := util.HydrateAttestation(ðpb.Attestation{ AggregationBits: bitfield.NewBitlist(uint64(len(comm1))), Data: ðpb.AttestationData{ Slot: 1, @@ -549,7 +549,7 @@ func TestRetrieveAttestationSignatureSet_AcrossFork(t *testing.T) { comm2, err := helpers.BeaconCommitteeFromState(st, 1 /*slot*/, 1 /*committeeIndex*/) require.NoError(t, err) - att2 := testutil.HydrateAttestation(ðpb.Attestation{ + att2 := util.HydrateAttestation(ðpb.Attestation{ AggregationBits: bitfield.NewBitlist(uint64(len(comm2))), Data: ðpb.AttestationData{ Slot: 1, diff --git a/beacon-chain/core/blocks/attester_slashing_test.go b/beacon-chain/core/blocks/attester_slashing_test.go index 0fcb3ac5f..a976d94e5 100644 --- a/beacon-chain/core/blocks/attester_slashing_test.go +++ b/beacon-chain/core/blocks/attester_slashing_test.go @@ -13,17 +13,17 @@ import ( "github.com/prysmaticlabs/prysm/crypto/bls" "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestSlashableAttestationData_CanSlash(t *testing.T) { - att1 := testutil.HydrateAttestationData(ðpb.AttestationData{ + att1 := util.HydrateAttestationData(ðpb.AttestationData{ Target: ðpb.Checkpoint{Epoch: 1, Root: make([]byte, 32)}, Source: ðpb.Checkpoint{Root: bytesutil.PadTo([]byte{'A'}, 32)}, }) - att2 := testutil.HydrateAttestationData(ðpb.AttestationData{ + att2 := util.HydrateAttestationData(ðpb.AttestationData{ Target: ðpb.Checkpoint{Epoch: 1, Root: make([]byte, 32)}, Source: ðpb.Checkpoint{Root: bytesutil.PadTo([]byte{'B'}, 32)}, }) @@ -36,8 +36,8 @@ func TestSlashableAttestationData_CanSlash(t *testing.T) { func TestProcessAttesterSlashings_DataNotSlashable(t *testing.T) { slashings := []*ethpb.AttesterSlashing{{ - Attestation_1: testutil.HydrateIndexedAttestation(ðpb.IndexedAttestation{}), - Attestation_2: testutil.HydrateIndexedAttestation(ðpb.IndexedAttestation{ + Attestation_1: util.HydrateIndexedAttestation(ðpb.IndexedAttestation{}), + Attestation_2: util.HydrateIndexedAttestation(ðpb.IndexedAttestation{ Data: ðpb.AttestationData{ Source: ðpb.Checkpoint{Epoch: 1}, Target: ðpb.Checkpoint{Epoch: 1}}, @@ -51,7 +51,7 @@ func TestProcessAttesterSlashings_DataNotSlashable(t *testing.T) { Slot: currentSlot, }) require.NoError(t, err) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block = ðpb.BeaconBlock{ Body: ðpb.BeaconBlockBody{ AttesterSlashings: slashings, @@ -73,19 +73,19 @@ func TestProcessAttesterSlashings_IndexedAttestationFailedToVerify(t *testing.T) slashings := []*ethpb.AttesterSlashing{ { - Attestation_1: testutil.HydrateIndexedAttestation(ðpb.IndexedAttestation{ + Attestation_1: util.HydrateIndexedAttestation(ðpb.IndexedAttestation{ Data: ðpb.AttestationData{ Source: ðpb.Checkpoint{Epoch: 1}, }, AttestingIndices: make([]uint64, params.BeaconConfig().MaxValidatorsPerCommittee+1), }), - Attestation_2: testutil.HydrateIndexedAttestation(ðpb.IndexedAttestation{ + Attestation_2: util.HydrateIndexedAttestation(ðpb.IndexedAttestation{ AttestingIndices: make([]uint64, params.BeaconConfig().MaxValidatorsPerCommittee+1), }), }, } - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block = ðpb.BeaconBlock{ Body: ðpb.BeaconBlockBody{ AttesterSlashings: slashings, @@ -97,12 +97,12 @@ func TestProcessAttesterSlashings_IndexedAttestationFailedToVerify(t *testing.T) } func TestProcessAttesterSlashings_AppliesCorrectStatus(t *testing.T) { - beaconState, privKeys := testutil.DeterministicGenesisState(t, 100) + beaconState, privKeys := util.DeterministicGenesisState(t, 100) for _, vv := range beaconState.Validators() { vv.WithdrawableEpoch = types.Epoch(params.BeaconConfig().SlotsPerEpoch) } - att1 := testutil.HydrateIndexedAttestation(ðpb.IndexedAttestation{ + att1 := util.HydrateIndexedAttestation(ðpb.IndexedAttestation{ Data: ðpb.AttestationData{ Source: ðpb.Checkpoint{Epoch: 1}, }, @@ -117,7 +117,7 @@ func TestProcessAttesterSlashings_AppliesCorrectStatus(t *testing.T) { aggregateSig := bls.AggregateSignatures([]bls.Signature{sig0, sig1}) att1.Signature = aggregateSig.Marshal() - att2 := testutil.HydrateIndexedAttestation(ðpb.IndexedAttestation{ + att2 := util.HydrateIndexedAttestation(ðpb.IndexedAttestation{ AttestingIndices: []uint64{0, 1}, }) signingRoot, err = helpers.ComputeSigningRoot(att2.Data, domain) @@ -137,7 +137,7 @@ func TestProcessAttesterSlashings_AppliesCorrectStatus(t *testing.T) { currentSlot := 2 * params.BeaconConfig().SlotsPerEpoch require.NoError(t, beaconState.SetSlot(currentSlot)) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block = ðpb.BeaconBlock{ Body: ðpb.BeaconBlockBody{ AttesterSlashings: slashings, @@ -166,12 +166,12 @@ func TestProcessAttesterSlashings_AppliesCorrectStatus(t *testing.T) { } func TestProcessAttesterSlashings_AppliesCorrectStatusAltair(t *testing.T) { - beaconState, privKeys := testutil.DeterministicGenesisStateAltair(t, 100) + beaconState, privKeys := util.DeterministicGenesisStateAltair(t, 100) for _, vv := range beaconState.Validators() { vv.WithdrawableEpoch = types.Epoch(params.BeaconConfig().SlotsPerEpoch) } - att1 := testutil.HydrateIndexedAttestation(ðpb.IndexedAttestation{ + att1 := util.HydrateIndexedAttestation(ðpb.IndexedAttestation{ Data: ðpb.AttestationData{ Source: ðpb.Checkpoint{Epoch: 1}, }, @@ -186,7 +186,7 @@ func TestProcessAttesterSlashings_AppliesCorrectStatusAltair(t *testing.T) { aggregateSig := bls.AggregateSignatures([]bls.Signature{sig0, sig1}) att1.Signature = aggregateSig.Marshal() - att2 := testutil.HydrateIndexedAttestation(ðpb.IndexedAttestation{ + att2 := util.HydrateIndexedAttestation(ðpb.IndexedAttestation{ AttestingIndices: []uint64{0, 1}, }) signingRoot, err = helpers.ComputeSigningRoot(att2.Data, domain) @@ -206,7 +206,7 @@ func TestProcessAttesterSlashings_AppliesCorrectStatusAltair(t *testing.T) { currentSlot := 2 * params.BeaconConfig().SlotsPerEpoch require.NoError(t, beaconState.SetSlot(currentSlot)) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block = ðpb.BeaconBlock{ Body: ðpb.BeaconBlockBody{ AttesterSlashings: slashings, diff --git a/beacon-chain/core/blocks/block_operations_fuzz_test.go b/beacon-chain/core/blocks/block_operations_fuzz_test.go index 8ac74facb..3ee235732 100644 --- a/beacon-chain/core/blocks/block_operations_fuzz_test.go +++ b/beacon-chain/core/blocks/block_operations_fuzz_test.go @@ -12,7 +12,7 @@ import ( eth "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestFuzzProcessAttestationNoVerify_10000(t *testing.T) { diff --git a/beacon-chain/core/blocks/block_regression_test.go b/beacon-chain/core/blocks/block_regression_test.go index 42ad223f3..623144233 100644 --- a/beacon-chain/core/blocks/block_regression_test.go +++ b/beacon-chain/core/blocks/block_regression_test.go @@ -11,14 +11,14 @@ import ( "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/crypto/bls" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestProcessAttesterSlashings_RegressionSlashableIndices(t *testing.T) { - beaconState, privKeys := testutil.DeterministicGenesisState(t, 5500) + beaconState, privKeys := util.DeterministicGenesisState(t, 5500) for _, vv := range beaconState.Validators() { vv.WithdrawableEpoch = types.Epoch(params.BeaconConfig().SlotsPerEpoch) } @@ -40,7 +40,7 @@ func TestProcessAttesterSlashings_RegressionSlashableIndices(t *testing.T) { root1 := [32]byte{'d', 'o', 'u', 'b', 'l', 'e', '1'} att1 := ðpb.IndexedAttestation{ - Data: testutil.HydrateAttestationData(ðpb.AttestationData{Target: ðpb.Checkpoint{Epoch: 0, Root: root1[:]}}), + Data: util.HydrateAttestationData(ðpb.AttestationData{Target: ðpb.Checkpoint{Epoch: 0, Root: root1[:]}}), AttestingIndices: setA, Signature: make([]byte, 96), } @@ -58,7 +58,7 @@ func TestProcessAttesterSlashings_RegressionSlashableIndices(t *testing.T) { root2 := [32]byte{'d', 'o', 'u', 'b', 'l', 'e', '2'} att2 := ðpb.IndexedAttestation{ - Data: testutil.HydrateAttestationData(ðpb.AttestationData{ + Data: util.HydrateAttestationData(ðpb.AttestationData{ Target: ðpb.Checkpoint{Root: root2[:]}, }), AttestingIndices: setB, @@ -84,7 +84,7 @@ func TestProcessAttesterSlashings_RegressionSlashableIndices(t *testing.T) { currentSlot := 2 * params.BeaconConfig().SlotsPerEpoch require.NoError(t, beaconState.SetSlot(currentSlot)) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block = ðpb.BeaconBlock{ Body: ðpb.BeaconBlockBody{ AttesterSlashings: slashings, diff --git a/beacon-chain/core/blocks/deposit_test.go b/beacon-chain/core/blocks/deposit_test.go index b07dc7fd7..7425dc097 100644 --- a/beacon-chain/core/blocks/deposit_test.go +++ b/beacon-chain/core/blocks/deposit_test.go @@ -13,19 +13,19 @@ import ( "github.com/prysmaticlabs/prysm/crypto/bls" "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestProcessDeposits_SameValidatorMultipleDepositsSameBlock(t *testing.T) { // Same validator created 3 valid deposits within the same block - dep, _, err := testutil.DeterministicDepositsAndKeysSameValidator(3) + dep, _, err := util.DeterministicDepositsAndKeysSameValidator(3) require.NoError(t, err) - eth1Data, err := testutil.DeterministicEth1Data(len(dep)) + eth1Data, err := util.DeterministicEth1Data(len(dep)) require.NoError(t, err) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block = ðpb.BeaconBlock{ Body: ðpb.BeaconBlockBody{ // 3 deposits from the same validator @@ -73,7 +73,7 @@ func TestProcessDeposits_MerkleBranchFailsVerification(t *testing.T) { require.NoError(t, err, "Could not generate proof") deposit.Proof = proof - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block = ðpb.BeaconBlock{ Body: ðpb.BeaconBlockBody{ Deposits: []*ethpb.Deposit{deposit}, @@ -92,12 +92,12 @@ func TestProcessDeposits_MerkleBranchFailsVerification(t *testing.T) { } func TestProcessDeposits_AddsNewValidatorDeposit(t *testing.T) { - dep, _, err := testutil.DeterministicDepositsAndKeys(1) + dep, _, err := util.DeterministicDepositsAndKeys(1) require.NoError(t, err) - eth1Data, err := testutil.DeterministicEth1Data(len(dep)) + eth1Data, err := util.DeterministicEth1Data(len(dep)) require.NoError(t, err) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block = ðpb.BeaconBlock{ Body: ðpb.BeaconBlockBody{ Deposits: []*ethpb.Deposit{dep[0]}, @@ -156,7 +156,7 @@ func TestProcessDeposits_RepeatedDeposit_IncreasesValidatorBalance(t *testing.T) require.NoError(t, err, "Could not generate proof") deposit.Proof = proof - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block = ðpb.BeaconBlock{ Body: ðpb.BeaconBlockBody{ Deposits: []*ethpb.Deposit{deposit}, @@ -189,9 +189,9 @@ func TestProcessDeposits_RepeatedDeposit_IncreasesValidatorBalance(t *testing.T) func TestProcessDeposit_AddsNewValidatorDeposit(t *testing.T) { // Similar to TestProcessDeposits_AddsNewValidatorDeposit except that this test directly calls ProcessDeposit - dep, _, err := testutil.DeterministicDepositsAndKeys(1) + dep, _, err := util.DeterministicDepositsAndKeys(1) require.NoError(t, err) - eth1Data, err := testutil.DeterministicEth1Data(len(dep)) + eth1Data, err := util.DeterministicEth1Data(len(dep)) require.NoError(t, err) registry := []*ethpb.Validator{ @@ -227,10 +227,10 @@ func TestProcessDeposit_AddsNewValidatorDeposit(t *testing.T) { func TestProcessDeposit_SkipsInvalidDeposit(t *testing.T) { // Same test settings as in TestProcessDeposit_AddsNewValidatorDeposit, except that we use an invalid signature - dep, _, err := testutil.DeterministicDepositsAndKeys(1) + dep, _, err := util.DeterministicDepositsAndKeys(1) require.NoError(t, err) dep[0].Data.Signature = make([]byte, 96) - trie, _, err := testutil.DepositTrieFromDeposits(dep) + trie, _, err := util.DepositTrieFromDeposits(dep) require.NoError(t, err) root := trie.HashTreeRoot() eth1Data := ðpb.Eth1Data{ @@ -277,10 +277,10 @@ func TestProcessDeposit_SkipsInvalidDeposit(t *testing.T) { func TestPreGenesisDeposits_SkipInvalidDeposit(t *testing.T) { - dep, _, err := testutil.DeterministicDepositsAndKeys(100) + dep, _, err := util.DeterministicDepositsAndKeys(100) require.NoError(t, err) dep[0].Data.Signature = make([]byte, 96) - trie, _, err := testutil.DepositTrieFromDeposits(dep) + trie, _, err := util.DepositTrieFromDeposits(dep) require.NoError(t, err) for i := range dep { diff --git a/beacon-chain/core/blocks/eth1_data_test.go b/beacon-chain/core/blocks/eth1_data_test.go index dca17e5c3..1682abcfd 100644 --- a/beacon-chain/core/blocks/eth1_data_test.go +++ b/beacon-chain/core/blocks/eth1_data_test.go @@ -11,9 +11,9 @@ import ( "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/protobuf/proto" ) @@ -164,7 +164,7 @@ func TestProcessEth1Data_SetsCorrectly(t *testing.T) { }) require.NoError(t, err) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block = ðpb.BeaconBlock{ Body: ðpb.BeaconBlockBody{ Eth1Data: ðpb.Eth1Data{ diff --git a/beacon-chain/core/blocks/exit_test.go b/beacon-chain/core/blocks/exit_test.go index 5799e537b..6032fd393 100644 --- a/beacon-chain/core/blocks/exit_test.go +++ b/beacon-chain/core/blocks/exit_test.go @@ -12,9 +12,9 @@ import ( "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/crypto/bls" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestProcessVoluntaryExits_NotActiveLongEnoughToExit(t *testing.T) { @@ -36,7 +36,7 @@ func TestProcessVoluntaryExits_NotActiveLongEnoughToExit(t *testing.T) { Slot: 10, }) require.NoError(t, err) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block = ðpb.BeaconBlock{ Body: ðpb.BeaconBlockBody{ VoluntaryExits: exits, @@ -66,7 +66,7 @@ func TestProcessVoluntaryExits_ExitAlreadySubmitted(t *testing.T) { Slot: 0, }) require.NoError(t, err) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block = ðpb.BeaconBlock{ Body: ðpb.BeaconBlockBody{ VoluntaryExits: exits, @@ -115,7 +115,7 @@ func TestProcessVoluntaryExits_AppliesCorrectStatus(t *testing.T) { exits[0].Signature, err = helpers.ComputeDomainAndSign(state, core.CurrentEpoch(state), exits[0].Exit, params.BeaconConfig().DomainVoluntaryExit, priv) require.NoError(t, err) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block = ðpb.BeaconBlock{ Body: ðpb.BeaconBlockBody{ VoluntaryExits: exits, diff --git a/beacon-chain/core/blocks/genesis_test.go b/beacon-chain/core/blocks/genesis_test.go index 672d80592..9b86cb0d2 100644 --- a/beacon-chain/core/blocks/genesis_test.go +++ b/beacon-chain/core/blocks/genesis_test.go @@ -5,7 +5,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core/blocks" "github.com/prysmaticlabs/prysm/encoding/bytesutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" ) func TestGenesisBlock_InitializedCorrectly(t *testing.T) { diff --git a/beacon-chain/core/blocks/header_test.go b/beacon-chain/core/blocks/header_test.go index 8e2261af0..810a6e44c 100644 --- a/beacon-chain/core/blocks/header_test.go +++ b/beacon-chain/core/blocks/header_test.go @@ -14,9 +14,9 @@ import ( "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" "github.com/sirupsen/logrus" "google.golang.org/protobuf/proto" ) @@ -36,11 +36,11 @@ func TestProcessBlockHeader_ImproperBlockSlot(t *testing.T) { } } - state, err := testutil.NewBeaconState() + state, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, state.SetSlot(10)) require.NoError(t, state.SetValidators(validators)) - require.NoError(t, state.SetLatestBlockHeader(testutil.HydrateBeaconHeader(ðpb.BeaconBlockHeader{ + require.NoError(t, state.SetLatestBlockHeader(util.HydrateBeaconHeader(ðpb.BeaconBlockHeader{ Slot: 10, // Must be less than block.Slot }))) @@ -52,7 +52,7 @@ func TestProcessBlockHeader_ImproperBlockSlot(t *testing.T) { require.NoError(t, err) pID, err := helpers.BeaconProposerIndex(state) require.NoError(t, err) - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() block.Block.ProposerIndex = pID block.Block.Slot = 10 block.Block.Body.RandaoReveal = bytesutil.PadTo([]byte{'A', 'B', 'C'}, 96) @@ -73,8 +73,8 @@ func TestProcessBlockHeader_ImproperBlockSlot(t *testing.T) { func TestProcessBlockHeader_WrongProposerSig(t *testing.T) { - beaconState, privKeys := testutil.DeterministicGenesisState(t, 100) - require.NoError(t, beaconState.SetLatestBlockHeader(testutil.HydrateBeaconHeader(ðpb.BeaconBlockHeader{ + beaconState, privKeys := util.DeterministicGenesisState(t, 100) + require.NoError(t, beaconState.SetLatestBlockHeader(util.HydrateBeaconHeader(ðpb.BeaconBlockHeader{ Slot: 9, }))) require.NoError(t, beaconState.SetSlot(10)) @@ -85,7 +85,7 @@ func TestProcessBlockHeader_WrongProposerSig(t *testing.T) { proposerIdx, err := helpers.BeaconProposerIndex(beaconState) require.NoError(t, err) - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() block.Block.ProposerIndex = proposerIdx block.Block.Slot = 10 block.Block.Body.RandaoReveal = bytesutil.PadTo([]byte{'A', 'B', 'C'}, 96) @@ -109,11 +109,11 @@ func TestProcessBlockHeader_DifferentSlots(t *testing.T) { } } - state, err := testutil.NewBeaconState() + state, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, state.SetValidators(validators)) require.NoError(t, state.SetSlot(10)) - require.NoError(t, state.SetLatestBlockHeader(testutil.HydrateBeaconHeader(ðpb.BeaconBlockHeader{ + require.NoError(t, state.SetLatestBlockHeader(util.HydrateBeaconHeader(ðpb.BeaconBlockHeader{ Slot: 9, }))) @@ -127,7 +127,7 @@ func TestProcessBlockHeader_DifferentSlots(t *testing.T) { blockSig, err := helpers.ComputeDomainAndSign(state, currentEpoch, &sszBytes, params.BeaconConfig().DomainBeaconProposer, priv) require.NoError(t, err) validators[5896].PublicKey = priv.PublicKey().Marshal() - block := testutil.HydrateSignedBeaconBlock(ðpb.SignedBeaconBlock{ + block := util.HydrateSignedBeaconBlock(ðpb.SignedBeaconBlock{ Block: ðpb.BeaconBlock{ Slot: 1, ParentRoot: lbhsr[:], @@ -151,7 +151,7 @@ func TestProcessBlockHeader_PreviousBlockRootNotSignedRoot(t *testing.T) { } } - state, err := testutil.NewBeaconState() + state, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, state.SetValidators(validators)) require.NoError(t, state.SetSlot(10)) @@ -167,7 +167,7 @@ func TestProcessBlockHeader_PreviousBlockRootNotSignedRoot(t *testing.T) { validators[5896].PublicKey = priv.PublicKey().Marshal() pID, err := helpers.BeaconProposerIndex(state) require.NoError(t, err) - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() block.Block.Slot = 10 block.Block.ProposerIndex = pID block.Block.Body.RandaoReveal = bytesutil.PadTo([]byte{'A', 'B', 'C'}, 96) @@ -190,7 +190,7 @@ func TestProcessBlockHeader_SlashedProposer(t *testing.T) { } } - state, err := testutil.NewBeaconState() + state, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, state.SetValidators(validators)) require.NoError(t, state.SetSlot(10)) @@ -209,7 +209,7 @@ func TestProcessBlockHeader_SlashedProposer(t *testing.T) { validators[12683].PublicKey = priv.PublicKey().Marshal() pID, err := helpers.BeaconProposerIndex(state) require.NoError(t, err) - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() block.Block.Slot = 10 block.Block.ProposerIndex = pID block.Block.Body.RandaoReveal = bytesutil.PadTo([]byte{'A', 'B', 'C'}, 96) @@ -232,11 +232,11 @@ func TestProcessBlockHeader_OK(t *testing.T) { } } - state, err := testutil.NewBeaconState() + state, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, state.SetValidators(validators)) require.NoError(t, state.SetSlot(10)) - require.NoError(t, state.SetLatestBlockHeader(testutil.HydrateBeaconHeader(ðpb.BeaconBlockHeader{ + require.NoError(t, state.SetLatestBlockHeader(util.HydrateBeaconHeader(ðpb.BeaconBlockHeader{ Slot: 9, }))) @@ -248,7 +248,7 @@ func TestProcessBlockHeader_OK(t *testing.T) { require.NoError(t, err) pID, err := helpers.BeaconProposerIndex(state) require.NoError(t, err) - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() block.Block.ProposerIndex = pID block.Block.Slot = 10 block.Block.Body.RandaoReveal = bytesutil.PadTo([]byte{'A', 'B', 'C'}, 96) @@ -290,11 +290,11 @@ func TestBlockSignatureSet_OK(t *testing.T) { } } - state, err := testutil.NewBeaconState() + state, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, state.SetValidators(validators)) require.NoError(t, state.SetSlot(10)) - require.NoError(t, state.SetLatestBlockHeader(testutil.HydrateBeaconHeader(ðpb.BeaconBlockHeader{ + require.NoError(t, state.SetLatestBlockHeader(util.HydrateBeaconHeader(ðpb.BeaconBlockHeader{ Slot: 9, ProposerIndex: 0, }))) @@ -307,7 +307,7 @@ func TestBlockSignatureSet_OK(t *testing.T) { require.NoError(t, err) pID, err := helpers.BeaconProposerIndex(state) require.NoError(t, err) - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() block.Block.Slot = 10 block.Block.ProposerIndex = pID block.Block.Body.RandaoReveal = bytesutil.PadTo([]byte{'A', 'B', 'C'}, 96) diff --git a/beacon-chain/core/blocks/proposer_slashing_regression_test.go b/beacon-chain/core/blocks/proposer_slashing_regression_test.go index d0e2ebb54..02e181c1a 100644 --- a/beacon-chain/core/blocks/proposer_slashing_regression_test.go +++ b/beacon-chain/core/blocks/proposer_slashing_regression_test.go @@ -7,7 +7,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core/blocks" v1 "github.com/prysmaticlabs/prysm/beacon-chain/state/v1" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) // Beaconfuzz discovered an issue where a proposer slashing could be produced which would pass diff --git a/beacon-chain/core/blocks/proposer_slashing_test.go b/beacon-chain/core/blocks/proposer_slashing_test.go index 737732c7e..1de8bbb61 100644 --- a/beacon-chain/core/blocks/proposer_slashing_test.go +++ b/beacon-chain/core/blocks/proposer_slashing_test.go @@ -16,14 +16,14 @@ import ( "github.com/prysmaticlabs/prysm/crypto/bls" "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestProcessProposerSlashings_UnmatchedHeaderSlots(t *testing.T) { - beaconState, _ := testutil.DeterministicGenesisState(t, 20) + beaconState, _ := util.DeterministicGenesisState(t, 20) currentSlot := types.Slot(0) slashings := []*ethpb.ProposerSlashing{ { @@ -43,7 +43,7 @@ func TestProcessProposerSlashings_UnmatchedHeaderSlots(t *testing.T) { } require.NoError(t, beaconState.SetSlot(currentSlot)) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block = ðpb.BeaconBlock{ Body: ðpb.BeaconBlockBody{ ProposerSlashings: slashings, @@ -56,7 +56,7 @@ func TestProcessProposerSlashings_UnmatchedHeaderSlots(t *testing.T) { func TestProcessProposerSlashings_SameHeaders(t *testing.T) { - beaconState, _ := testutil.DeterministicGenesisState(t, 2) + beaconState, _ := util.DeterministicGenesisState(t, 2) currentSlot := types.Slot(0) slashings := []*ethpb.ProposerSlashing{ { @@ -76,7 +76,7 @@ func TestProcessProposerSlashings_SameHeaders(t *testing.T) { } require.NoError(t, beaconState.SetSlot(currentSlot)) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block = ðpb.BeaconBlock{ Body: ðpb.BeaconBlockBody{ ProposerSlashings: slashings, @@ -123,7 +123,7 @@ func TestProcessProposerSlashings_ValidatorNotSlashable(t *testing.T) { Slot: currentSlot, }) require.NoError(t, err) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block = ðpb.BeaconBlock{ Body: ðpb.BeaconBlockBody{ ProposerSlashings: slashings, @@ -140,11 +140,11 @@ func TestProcessProposerSlashings_ValidatorNotSlashable(t *testing.T) { func TestProcessProposerSlashings_AppliesCorrectStatus(t *testing.T) { // We test the case when data is correct and verify the validator // registry has been updated. - beaconState, privKeys := testutil.DeterministicGenesisState(t, 100) + beaconState, privKeys := util.DeterministicGenesisState(t, 100) proposerIdx := types.ValidatorIndex(1) header1 := ðpb.SignedBeaconBlockHeader{ - Header: testutil.HydrateBeaconHeader(ðpb.BeaconBlockHeader{ + Header: util.HydrateBeaconHeader(ðpb.BeaconBlockHeader{ ProposerIndex: proposerIdx, StateRoot: bytesutil.PadTo([]byte("A"), 32), }), @@ -153,7 +153,7 @@ func TestProcessProposerSlashings_AppliesCorrectStatus(t *testing.T) { header1.Signature, err = helpers.ComputeDomainAndSign(beaconState, 0, header1.Header, params.BeaconConfig().DomainBeaconProposer, privKeys[proposerIdx]) require.NoError(t, err) - header2 := testutil.HydrateSignedBeaconHeader(ðpb.SignedBeaconBlockHeader{ + header2 := util.HydrateSignedBeaconHeader(ðpb.SignedBeaconBlockHeader{ Header: ðpb.BeaconBlockHeader{ ProposerIndex: proposerIdx, StateRoot: bytesutil.PadTo([]byte("B"), 32), @@ -169,7 +169,7 @@ func TestProcessProposerSlashings_AppliesCorrectStatus(t *testing.T) { }, } - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() block.Block.Body.ProposerSlashings = slashings newState, err := blocks.ProcessProposerSlashings(context.Background(), beaconState, block.Block.Body.ProposerSlashings, v.SlashValidator) @@ -188,11 +188,11 @@ func TestProcessProposerSlashings_AppliesCorrectStatus(t *testing.T) { func TestProcessProposerSlashings_AppliesCorrectStatusAltair(t *testing.T) { // We test the case when data is correct and verify the validator // registry has been updated. - beaconState, privKeys := testutil.DeterministicGenesisStateAltair(t, 100) + beaconState, privKeys := util.DeterministicGenesisStateAltair(t, 100) proposerIdx := types.ValidatorIndex(1) header1 := ðpb.SignedBeaconBlockHeader{ - Header: testutil.HydrateBeaconHeader(ðpb.BeaconBlockHeader{ + Header: util.HydrateBeaconHeader(ðpb.BeaconBlockHeader{ ProposerIndex: proposerIdx, StateRoot: bytesutil.PadTo([]byte("A"), 32), }), @@ -201,7 +201,7 @@ func TestProcessProposerSlashings_AppliesCorrectStatusAltair(t *testing.T) { header1.Signature, err = helpers.ComputeDomainAndSign(beaconState, 0, header1.Header, params.BeaconConfig().DomainBeaconProposer, privKeys[proposerIdx]) require.NoError(t, err) - header2 := testutil.HydrateSignedBeaconHeader(ðpb.SignedBeaconBlockHeader{ + header2 := util.HydrateSignedBeaconHeader(ðpb.SignedBeaconBlockHeader{ Header: ðpb.BeaconBlockHeader{ ProposerIndex: proposerIdx, StateRoot: bytesutil.PadTo([]byte("B"), 32), @@ -217,7 +217,7 @@ func TestProcessProposerSlashings_AppliesCorrectStatusAltair(t *testing.T) { }, } - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() block.Block.Body.ProposerSlashings = slashings newState, err := blocks.ProcessProposerSlashings(context.Background(), beaconState, block.Block.Body.ProposerSlashings, v.SlashValidator) @@ -239,7 +239,7 @@ func TestVerifyProposerSlashing(t *testing.T) { slashing *ethpb.ProposerSlashing } - beaconState, sks := testutil.DeterministicGenesisState(t, 2) + beaconState, sks := util.DeterministicGenesisState(t, 2) currentSlot := types.Slot(0) require.NoError(t, beaconState.SetSlot(currentSlot)) rand1, err := bls.RandKey() @@ -259,13 +259,13 @@ func TestVerifyProposerSlashing(t *testing.T) { name: "same header, same slot as state", args: args{ slashing: ðpb.ProposerSlashing{ - Header_1: testutil.HydrateSignedBeaconHeader(ðpb.SignedBeaconBlockHeader{ + Header_1: util.HydrateSignedBeaconHeader(ðpb.SignedBeaconBlockHeader{ Header: ðpb.BeaconBlockHeader{ ProposerIndex: 1, Slot: currentSlot, }, }), - Header_2: testutil.HydrateSignedBeaconHeader(ðpb.SignedBeaconBlockHeader{ + Header_2: util.HydrateSignedBeaconHeader(ðpb.SignedBeaconBlockHeader{ Header: ðpb.BeaconBlockHeader{ ProposerIndex: 1, Slot: currentSlot, @@ -280,13 +280,13 @@ func TestVerifyProposerSlashing(t *testing.T) { name: "same header, different signatures", args: args{ slashing: ðpb.ProposerSlashing{ - Header_1: testutil.HydrateSignedBeaconHeader(ðpb.SignedBeaconBlockHeader{ + Header_1: util.HydrateSignedBeaconHeader(ðpb.SignedBeaconBlockHeader{ Header: ðpb.BeaconBlockHeader{ ProposerIndex: 1, }, Signature: sig1, }), - Header_2: testutil.HydrateSignedBeaconHeader(ðpb.SignedBeaconBlockHeader{ + Header_2: util.HydrateSignedBeaconHeader(ðpb.SignedBeaconBlockHeader{ Header: ðpb.BeaconBlockHeader{ ProposerIndex: 1, }, diff --git a/beacon-chain/core/blocks/randao_test.go b/beacon-chain/core/blocks/randao_test.go index d838367bf..fcb60f73d 100644 --- a/beacon-chain/core/blocks/randao_test.go +++ b/beacon-chain/core/blocks/randao_test.go @@ -12,13 +12,13 @@ import ( "github.com/prysmaticlabs/prysm/config/params" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestProcessRandao_IncorrectProposerFailsVerification(t *testing.T) { - beaconState, privKeys := testutil.DeterministicGenesisState(t, 100) + beaconState, privKeys := util.DeterministicGenesisState(t, 100) // We fetch the proposer's index as that is whom the RANDAO will be verified against. proposerIdx, err := helpers.BeaconProposerIndex(beaconState) require.NoError(t, err) @@ -31,7 +31,7 @@ func TestProcessRandao_IncorrectProposerFailsVerification(t *testing.T) { require.NoError(t, err) // We make the previous validator's index sign the message instead of the proposer. epochSignature := privKeys[proposerIdx-1].Sign(root[:]) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block = ðpb.BeaconBlock{ Body: ðpb.BeaconBlockBody{ RandaoReveal: epochSignature.Marshal(), @@ -44,13 +44,13 @@ func TestProcessRandao_IncorrectProposerFailsVerification(t *testing.T) { } func TestProcessRandao_SignatureVerifiesAndUpdatesLatestStateMixes(t *testing.T) { - beaconState, privKeys := testutil.DeterministicGenesisState(t, 100) + beaconState, privKeys := util.DeterministicGenesisState(t, 100) epoch := core.CurrentEpoch(beaconState) - epochSignature, err := testutil.RandaoReveal(beaconState, epoch, privKeys) + epochSignature, err := util.RandaoReveal(beaconState, epoch, privKeys) require.NoError(t, err) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block = ðpb.BeaconBlock{ Body: ðpb.BeaconBlockBody{ RandaoReveal: epochSignature, @@ -69,10 +69,10 @@ func TestProcessRandao_SignatureVerifiesAndUpdatesLatestStateMixes(t *testing.T) } func TestRandaoSignatureSet_OK(t *testing.T) { - beaconState, privKeys := testutil.DeterministicGenesisState(t, 100) + beaconState, privKeys := util.DeterministicGenesisState(t, 100) epoch := core.CurrentEpoch(beaconState) - epochSignature, err := testutil.RandaoReveal(beaconState, epoch, privKeys) + epochSignature, err := util.RandaoReveal(beaconState, epoch, privKeys) require.NoError(t, err) block := ðpb.BeaconBlock{ diff --git a/beacon-chain/core/blocks/signature_test.go b/beacon-chain/core/blocks/signature_test.go index 647226a0c..884b0b6d6 100644 --- a/beacon-chain/core/blocks/signature_test.go +++ b/beacon-chain/core/blocks/signature_test.go @@ -9,9 +9,9 @@ import ( "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestVerifyBlockSignatureUsingCurrentFork(t *testing.T) { @@ -20,8 +20,8 @@ func TestVerifyBlockSignatureUsingCurrentFork(t *testing.T) { bCfg.AltairForkEpoch = 100 bCfg.ForkVersionSchedule[bytesutil.ToBytes4(bCfg.AltairForkVersion)] = 100 params.OverrideBeaconConfig(bCfg) - bState, keys := testutil.DeterministicGenesisState(t, 100) - altairBlk := testutil.NewBeaconBlockAltair() + bState, keys := util.DeterministicGenesisState(t, 100) + altairBlk := util.NewBeaconBlockAltair() altairBlk.Block.ProposerIndex = 0 altairBlk.Block.Slot = params.BeaconConfig().SlotsPerEpoch * 100 fData := ðpb.Fork{ diff --git a/beacon-chain/core/epoch/BUILD.bazel b/beacon-chain/core/epoch/BUILD.bazel index 6ebf313ea..90d2463f7 100644 --- a/beacon-chain/core/epoch/BUILD.bazel +++ b/beacon-chain/core/epoch/BUILD.bazel @@ -38,9 +38,9 @@ go_test( "//beacon-chain/state/v1:go_default_library", "//config/params:go_default_library", "//proto/prysm/v1alpha1:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "@com_github_google_gofuzz//:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", diff --git a/beacon-chain/core/epoch/epoch_processing_fuzz_test.go b/beacon-chain/core/epoch/epoch_processing_fuzz_test.go index 6cc4115c6..aa081c20d 100644 --- a/beacon-chain/core/epoch/epoch_processing_fuzz_test.go +++ b/beacon-chain/core/epoch/epoch_processing_fuzz_test.go @@ -6,7 +6,7 @@ import ( fuzz "github.com/google/gofuzz" v1 "github.com/prysmaticlabs/prysm/beacon-chain/state/v1" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestFuzzFinalUpdates_10000(t *testing.T) { diff --git a/beacon-chain/core/epoch/epoch_processing_test.go b/beacon-chain/core/epoch/epoch_processing_test.go index 688786da8..a576fcde7 100644 --- a/beacon-chain/core/epoch/epoch_processing_test.go +++ b/beacon-chain/core/epoch/epoch_processing_test.go @@ -13,9 +13,9 @@ import ( v1 "github.com/prysmaticlabs/prysm/beacon-chain/state/v1" "github.com/prysmaticlabs/prysm/config/params" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/protobuf/proto" ) @@ -426,7 +426,7 @@ func buildState(t testing.TB, slot types.Slot, validatorCount uint64) state.Beac for i := 0; i < len(latestRandaoMixes); i++ { latestRandaoMixes[i] = params.BeaconConfig().ZeroHash[:] } - s, err := testutil.NewBeaconState() + s, err := util.NewBeaconState() require.NoError(t, err) if err := s.SetSlot(slot); err != nil { t.Error(err) diff --git a/beacon-chain/core/epoch/precompute/BUILD.bazel b/beacon-chain/core/epoch/precompute/BUILD.bazel index 8ddad37b6..2a7622980 100644 --- a/beacon-chain/core/epoch/precompute/BUILD.bazel +++ b/beacon-chain/core/epoch/precompute/BUILD.bazel @@ -50,9 +50,9 @@ go_test( "//math:go_default_library", "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", diff --git a/beacon-chain/core/epoch/precompute/attestation_test.go b/beacon-chain/core/epoch/precompute/attestation_test.go index 55f262285..e4bef5c61 100644 --- a/beacon-chain/core/epoch/precompute/attestation_test.go +++ b/beacon-chain/core/epoch/precompute/attestation_test.go @@ -10,9 +10,9 @@ import ( "github.com/prysmaticlabs/prysm/config/params" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/attestation" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestUpdateValidator_Works(t *testing.T) { @@ -70,7 +70,7 @@ func TestUpdateBalance(t *testing.T) { } func TestSameHead(t *testing.T) { - beaconState, _ := testutil.DeterministicGenesisState(t, 100) + beaconState, _ := util.DeterministicGenesisState(t, 100) require.NoError(t, beaconState.SetSlot(1)) att := ðpb.Attestation{Data: ðpb.AttestationData{ Target: ðpb.Checkpoint{Epoch: 0}}} @@ -90,7 +90,7 @@ func TestSameHead(t *testing.T) { } func TestSameTarget(t *testing.T) { - beaconState, _ := testutil.DeterministicGenesisState(t, 100) + beaconState, _ := util.DeterministicGenesisState(t, 100) require.NoError(t, beaconState.SetSlot(1)) att := ðpb.Attestation{Data: ðpb.AttestationData{ Target: ðpb.Checkpoint{Epoch: 0}}} @@ -110,7 +110,7 @@ func TestSameTarget(t *testing.T) { } func TestAttestedPrevEpoch(t *testing.T) { - beaconState, _ := testutil.DeterministicGenesisState(t, 100) + beaconState, _ := util.DeterministicGenesisState(t, 100) require.NoError(t, beaconState.SetSlot(params.BeaconConfig().SlotsPerEpoch)) att := ðpb.Attestation{Data: ðpb.AttestationData{ Target: ðpb.Checkpoint{Epoch: 0}}} @@ -128,7 +128,7 @@ func TestAttestedPrevEpoch(t *testing.T) { } func TestAttestedCurrentEpoch(t *testing.T) { - beaconState, _ := testutil.DeterministicGenesisState(t, 100) + beaconState, _ := util.DeterministicGenesisState(t, 100) require.NoError(t, beaconState.SetSlot(params.BeaconConfig().SlotsPerEpoch+1)) att := ðpb.Attestation{Data: ðpb.AttestationData{ Target: ðpb.Checkpoint{Epoch: 1}}} @@ -150,7 +150,7 @@ func TestProcessAttestations(t *testing.T) { defer params.UseMainnetConfig() validators := uint64(128) - beaconState, _ := testutil.DeterministicGenesisState(t, validators) + beaconState, _ := util.DeterministicGenesisState(t, validators) require.NoError(t, beaconState.SetSlot(params.BeaconConfig().SlotsPerEpoch)) c := helpers.SlotCommitteeCount(validators) bf := bitfield.NewBitlist(c) diff --git a/beacon-chain/core/epoch/precompute/justification_finalization_test.go b/beacon-chain/core/epoch/precompute/justification_finalization_test.go index a2b6c1f29..308110e53 100644 --- a/beacon-chain/core/epoch/precompute/justification_finalization_test.go +++ b/beacon-chain/core/epoch/precompute/justification_finalization_test.go @@ -9,8 +9,8 @@ import ( v1 "github.com/prysmaticlabs/prysm/beacon-chain/state/v1" "github.com/prysmaticlabs/prysm/config/params" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestProcessJustificationAndFinalizationPreCompute_ConsecutiveEpochs(t *testing.T) { diff --git a/beacon-chain/core/epoch/precompute/new_test.go b/beacon-chain/core/epoch/precompute/new_test.go index d9caef785..fa8c8bc65 100644 --- a/beacon-chain/core/epoch/precompute/new_test.go +++ b/beacon-chain/core/epoch/precompute/new_test.go @@ -8,8 +8,8 @@ import ( v1 "github.com/prysmaticlabs/prysm/beacon-chain/state/v1" "github.com/prysmaticlabs/prysm/config/params" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestNew(t *testing.T) { diff --git a/beacon-chain/core/epoch/precompute/reward_penalty_test.go b/beacon-chain/core/epoch/precompute/reward_penalty_test.go index a1f6a1552..ba6264729 100644 --- a/beacon-chain/core/epoch/precompute/reward_penalty_test.go +++ b/beacon-chain/core/epoch/precompute/reward_penalty_test.go @@ -15,8 +15,8 @@ import ( "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/math" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestProcessRewardsAndPenaltiesPrecompute(t *testing.T) { diff --git a/beacon-chain/core/epoch/precompute/slashing_test.go b/beacon-chain/core/epoch/precompute/slashing_test.go index bae9acc79..a8af9a730 100644 --- a/beacon-chain/core/epoch/precompute/slashing_test.go +++ b/beacon-chain/core/epoch/precompute/slashing_test.go @@ -8,8 +8,8 @@ import ( v1 "github.com/prysmaticlabs/prysm/beacon-chain/state/v1" "github.com/prysmaticlabs/prysm/config/params" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" "google.golang.org/protobuf/proto" ) diff --git a/beacon-chain/core/helpers/BUILD.bazel b/beacon-chain/core/helpers/BUILD.bazel index c63142dfc..edf71e961 100644 --- a/beacon-chain/core/helpers/BUILD.bazel +++ b/beacon-chain/core/helpers/BUILD.bazel @@ -25,13 +25,13 @@ go_library( "//runtime/interop:__pkg__", "//shared/attestationutil:__pkg__", "//shared/keystore:__pkg__", - "//shared/testutil:__pkg__", - "//shared/testutil/altair:__pkg__", "//slasher:__subpackages__", + "//testing/altair:__pkg__", "//testing/benchmark/benchmark_files:__subpackages__", "//testing/endtoend/evaluators:__pkg__", "//testing/fuzz:__pkg__", "//testing/spectest:__subpackages__", + "//testing/util:__pkg__", "//tools:__subpackages__", "//validator:__subpackages__", ], @@ -87,9 +87,9 @@ go_test( "//crypto/hash:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/prysm/v1alpha1:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "//time:go_default_library", "@com_github_google_gofuzz//:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", diff --git a/beacon-chain/core/helpers/attestation_test.go b/beacon-chain/core/helpers/attestation_test.go index 08bc964f6..acc4d7227 100644 --- a/beacon-chain/core/helpers/attestation_test.go +++ b/beacon-chain/core/helpers/attestation_test.go @@ -13,15 +13,15 @@ import ( "github.com/prysmaticlabs/prysm/crypto/bls" "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" prysmTime "github.com/prysmaticlabs/prysm/time" ) func TestAttestation_IsAggregator(t *testing.T) { t.Run("aggregator", func(t *testing.T) { - beaconState, privKeys := testutil.DeterministicGenesisState(t, 100) + beaconState, privKeys := util.DeterministicGenesisState(t, 100) committee, err := helpers.BeaconCommitteeFromState(beaconState, 0, 0) require.NoError(t, err) sig := privKeys[0].Sign([]byte{'A'}) @@ -33,7 +33,7 @@ func TestAttestation_IsAggregator(t *testing.T) { t.Run("not aggregator", func(t *testing.T) { params.UseMinimalConfig() defer params.UseMainnetConfig() - beaconState, privKeys := testutil.DeterministicGenesisState(t, 2048) + beaconState, privKeys := util.DeterministicGenesisState(t, 2048) committee, err := helpers.BeaconCommitteeFromState(beaconState, 0, 0) require.NoError(t, err) diff --git a/beacon-chain/core/helpers/beacon_committee_test.go b/beacon-chain/core/helpers/beacon_committee_test.go index 3a8c5928f..ab493c841 100644 --- a/beacon-chain/core/helpers/beacon_committee_test.go +++ b/beacon-chain/core/helpers/beacon_committee_test.go @@ -14,8 +14,8 @@ import ( "github.com/prysmaticlabs/prysm/crypto/hash" "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestComputeCommittee_WithoutCache(t *testing.T) { diff --git a/beacon-chain/core/helpers/block_test.go b/beacon-chain/core/helpers/block_test.go index 258e2f36c..fb5c5eb01 100644 --- a/beacon-chain/core/helpers/block_test.go +++ b/beacon-chain/core/helpers/block_test.go @@ -10,8 +10,8 @@ import ( v1 "github.com/prysmaticlabs/prysm/beacon-chain/state/v1" "github.com/prysmaticlabs/prysm/config/params" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestBlockRootAtSlot_CorrectBlockRoot(t *testing.T) { diff --git a/beacon-chain/core/helpers/randao_test.go b/beacon-chain/core/helpers/randao_test.go index acc5a12de..761df7296 100644 --- a/beacon-chain/core/helpers/randao_test.go +++ b/beacon-chain/core/helpers/randao_test.go @@ -9,8 +9,8 @@ import ( "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestRandaoMix_OK(t *testing.T) { diff --git a/beacon-chain/core/helpers/rewards_penalties_test.go b/beacon-chain/core/helpers/rewards_penalties_test.go index 912a930d3..3c882210e 100644 --- a/beacon-chain/core/helpers/rewards_penalties_test.go +++ b/beacon-chain/core/helpers/rewards_penalties_test.go @@ -9,8 +9,8 @@ import ( "github.com/prysmaticlabs/prysm/config/features" "github.com/prysmaticlabs/prysm/config/params" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestTotalBalance_OK(t *testing.T) { diff --git a/beacon-chain/core/helpers/shuffle_test.go b/beacon-chain/core/helpers/shuffle_test.go index f7815143b..46de8f004 100644 --- a/beacon-chain/core/helpers/shuffle_test.go +++ b/beacon-chain/core/helpers/shuffle_test.go @@ -8,8 +8,8 @@ import ( types "github.com/prysmaticlabs/eth2-types" "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/container/slice" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestShuffleList_InvalidValidatorCount(t *testing.T) { diff --git a/beacon-chain/core/helpers/signing_root_test.go b/beacon-chain/core/helpers/signing_root_test.go index 1ce7c9beb..e528c38ad 100644 --- a/beacon-chain/core/helpers/signing_root_test.go +++ b/beacon-chain/core/helpers/signing_root_test.go @@ -13,13 +13,13 @@ import ( "github.com/prysmaticlabs/prysm/encoding/bytesutil" eth "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestSigningRoot_ComputeSigningRoot(t *testing.T) { - emptyBlock := testutil.NewBeaconBlock() + emptyBlock := util.NewBeaconBlock() _, err := helpers.ComputeSigningRoot(emptyBlock, bytesutil.PadTo([]byte{'T', 'E', 'S', 'T'}, 32)) assert.NoError(t, err, "Could not compute signing root of block") } @@ -56,12 +56,12 @@ func TestSigningRoot_ComputeDomainAndSign(t *testing.T) { { name: "block proposer", genState: func(t *testing.T) (state.BeaconState, []bls.SecretKey) { - beaconState, privKeys := testutil.DeterministicGenesisState(t, 100) + beaconState, privKeys := util.DeterministicGenesisState(t, 100) require.NoError(t, beaconState.SetSlot(beaconState.Slot()+1)) return beaconState, privKeys }, genBlock: func(t *testing.T, st state.BeaconState, keys []bls.SecretKey) *eth.SignedBeaconBlock { - block, err := testutil.GenerateFullBlock(st, keys, nil, 1) + block, err := util.GenerateFullBlock(st, keys, nil, 1) require.NoError(t, err) return block }, diff --git a/beacon-chain/core/helpers/sync_committee_test.go b/beacon-chain/core/helpers/sync_committee_test.go index f225f9e43..2578d62f6 100644 --- a/beacon-chain/core/helpers/sync_committee_test.go +++ b/beacon-chain/core/helpers/sync_committee_test.go @@ -12,7 +12,7 @@ import ( "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestIsCurrentEpochSyncCommittee_UsingCache(t *testing.T) { diff --git a/beacon-chain/core/helpers/validators_test.go b/beacon-chain/core/helpers/validators_test.go index 33f5abf78..d73af1e53 100644 --- a/beacon-chain/core/helpers/validators_test.go +++ b/beacon-chain/core/helpers/validators_test.go @@ -12,8 +12,8 @@ import ( "github.com/prysmaticlabs/prysm/crypto/hash" "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestIsActiveValidator_OK(t *testing.T) { diff --git a/beacon-chain/core/helpers/weak_subjectivity_test.go b/beacon-chain/core/helpers/weak_subjectivity_test.go index df073269f..ff3ab4195 100644 --- a/beacon-chain/core/helpers/weak_subjectivity_test.go +++ b/beacon-chain/core/helpers/weak_subjectivity_test.go @@ -10,9 +10,9 @@ import ( "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestWeakSubjectivity_ComputeWeakSubjectivityPeriod(t *testing.T) { @@ -275,7 +275,7 @@ func TestWeakSubjectivity_ParseWeakSubjectivityInputString(t *testing.T) { } func genState(t *testing.T, valCount, avgBalance uint64) state.BeaconState { - beaconState, err := testutil.NewBeaconState() + beaconState, err := util.NewBeaconState() require.NoError(t, err) validators := make([]*ethpb.Validator, valCount) diff --git a/beacon-chain/core/slot_epoch_test.go b/beacon-chain/core/slot_epoch_test.go index e2ce80055..2d55c322f 100644 --- a/beacon-chain/core/slot_epoch_test.go +++ b/beacon-chain/core/slot_epoch_test.go @@ -9,8 +9,8 @@ import ( v1 "github.com/prysmaticlabs/prysm/beacon-chain/state/v1" "github.com/prysmaticlabs/prysm/config/params" eth "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" prysmTime "github.com/prysmaticlabs/prysm/time" ) diff --git a/beacon-chain/core/transition/BUILD.bazel b/beacon-chain/core/transition/BUILD.bazel index ae96f7cd1..588804b2b 100644 --- a/beacon-chain/core/transition/BUILD.bazel +++ b/beacon-chain/core/transition/BUILD.bazel @@ -16,10 +16,10 @@ go_library( visibility = [ "//beacon-chain:__subpackages__", "//runtime/interop:__pkg__", - "//shared/testutil:__pkg__", "//testing/endtoend:__pkg__", "//testing/fuzz:__pkg__", "//testing/spectest:__subpackages__", + "//testing/util:__pkg__", "//tools/benchmark-files-gen:__pkg__", "//tools/genesis-state-gen:__pkg__", "//tools/pcli:__pkg__", @@ -90,10 +90,10 @@ go_test( "//proto/prysm/v1alpha1/attestation:go_default_library", "//proto/prysm/v1alpha1/wrapper:go_default_library", "//runtime/version:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", "//testing/benchmark:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "@com_github_google_gofuzz//:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", @@ -123,8 +123,8 @@ go_test( "//beacon-chain/state/v1:go_default_library", "//config/params:go_default_library", "//proto/prysm/v1alpha1:go_default_library", - "//shared/testutil/require:go_default_library", "//testing/benchmark:go_default_library", + "//testing/require:go_default_library", "@org_golang_google_protobuf//proto:go_default_library", ], ) diff --git a/beacon-chain/core/transition/altair_transition_no_verify_sig_test.go b/beacon-chain/core/transition/altair_transition_no_verify_sig_test.go index 94a04c793..b5a91cb68 100644 --- a/beacon-chain/core/transition/altair_transition_no_verify_sig_test.go +++ b/beacon-chain/core/transition/altair_transition_no_verify_sig_test.go @@ -16,13 +16,13 @@ import ( "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestExecuteAltairStateTransitionNoVerify_FullProcess(t *testing.T) { - beaconState, privKeys := testutil.DeterministicGenesisStateAltair(t, 100) + beaconState, privKeys := util.DeterministicGenesisStateAltair(t, 100) syncCommittee, err := altair.NextSyncCommittee(context.Background(), beaconState) require.NoError(t, err) @@ -44,7 +44,7 @@ func TestExecuteAltairStateTransitionNoVerify_FullProcess(t *testing.T) { require.NoError(t, beaconState.SetSlot(beaconState.Slot()+1)) epoch := core.CurrentEpoch(beaconState) - randaoReveal, err := testutil.RandaoReveal(beaconState, epoch, privKeys) + randaoReveal, err := util.RandaoReveal(beaconState, epoch, privKeys) require.NoError(t, err) require.NoError(t, beaconState.SetSlot(beaconState.Slot()-1)) @@ -54,7 +54,7 @@ func TestExecuteAltairStateTransitionNoVerify_FullProcess(t *testing.T) { require.NoError(t, err) proposerIdx, err := helpers.BeaconProposerIndex(nextSlotState) require.NoError(t, err) - block := testutil.NewBeaconBlockAltair() + block := util.NewBeaconBlockAltair() block.Block.ProposerIndex = proposerIdx block.Block.Slot = beaconState.Slot() + 1 block.Block.ParentRoot = parentRoot[:] @@ -95,7 +95,7 @@ func TestExecuteAltairStateTransitionNoVerify_FullProcess(t *testing.T) { block.Block.StateRoot = stateRoot[:] c := beaconState.Copy() - sig, err := testutil.BlockSignatureAltair(c, block.Block, privKeys) + sig, err := util.BlockSignatureAltair(c, block.Block, privKeys) require.NoError(t, err) block.Signature = sig.Marshal() @@ -109,7 +109,7 @@ func TestExecuteAltairStateTransitionNoVerify_FullProcess(t *testing.T) { } func TestExecuteAltairStateTransitionNoVerifySignature_CouldNotVerifyStateRoot(t *testing.T) { - beaconState, privKeys := testutil.DeterministicGenesisStateAltair(t, 100) + beaconState, privKeys := util.DeterministicGenesisStateAltair(t, 100) syncCommittee, err := altair.NextSyncCommittee(context.Background(), beaconState) require.NoError(t, err) @@ -131,7 +131,7 @@ func TestExecuteAltairStateTransitionNoVerifySignature_CouldNotVerifyStateRoot(t require.NoError(t, beaconState.SetSlot(beaconState.Slot()+1)) epoch := core.CurrentEpoch(beaconState) - randaoReveal, err := testutil.RandaoReveal(beaconState, epoch, privKeys) + randaoReveal, err := util.RandaoReveal(beaconState, epoch, privKeys) require.NoError(t, err) require.NoError(t, beaconState.SetSlot(beaconState.Slot()-1)) @@ -141,7 +141,7 @@ func TestExecuteAltairStateTransitionNoVerifySignature_CouldNotVerifyStateRoot(t require.NoError(t, err) proposerIdx, err := helpers.BeaconProposerIndex(nextSlotState) require.NoError(t, err) - block := testutil.NewBeaconBlockAltair() + block := util.NewBeaconBlockAltair() block.Block.ProposerIndex = proposerIdx block.Block.Slot = beaconState.Slot() + 1 block.Block.ParentRoot = parentRoot[:] @@ -183,7 +183,7 @@ func TestExecuteAltairStateTransitionNoVerifySignature_CouldNotVerifyStateRoot(t block.Block.StateRoot = stateRoot[:] c := beaconState.Copy() - sig, err := testutil.BlockSignatureAltair(c, block.Block, privKeys) + sig, err := util.BlockSignatureAltair(c, block.Block, privKeys) require.NoError(t, err) block.Signature = sig.Marshal() @@ -208,13 +208,13 @@ func TestExecuteStateTransitionNoVerifyAnySig_PassesProcessingConditions(t *test func createFullAltairBlockWithOperations(t *testing.T) (state.BeaconStateAltair, *ethpb.SignedBeaconBlockAltair) { - beaconState, privKeys := testutil.DeterministicGenesisStateAltair(t, 32) + beaconState, privKeys := util.DeterministicGenesisStateAltair(t, 32) sCom, err := altair.NextSyncCommittee(context.Background(), beaconState) assert.NoError(t, err) assert.NoError(t, beaconState.SetCurrentSyncCommittee(sCom)) tState := beaconState.Copy() - blk, err := testutil.GenerateFullBlockAltair(tState, privKeys, - &testutil.BlockGenConfig{NumAttestations: 1, NumVoluntaryExits: 0, NumDeposits: 0}, 1) + blk, err := util.GenerateFullBlockAltair(tState, privKeys, + &util.BlockGenConfig{NumAttestations: 1, NumVoluntaryExits: 0, NumDeposits: 0}, 1) require.NoError(t, err) return beaconState, blk diff --git a/beacon-chain/core/transition/benchmarks_test.go b/beacon-chain/core/transition/benchmarks_test.go index a10d1597e..8dc3c2a15 100644 --- a/beacon-chain/core/transition/benchmarks_test.go +++ b/beacon-chain/core/transition/benchmarks_test.go @@ -12,8 +12,8 @@ import ( "github.com/prysmaticlabs/prysm/config/params" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil/require" "github.com/prysmaticlabs/prysm/testing/benchmark" + "github.com/prysmaticlabs/prysm/testing/require" "google.golang.org/protobuf/proto" ) diff --git a/beacon-chain/core/transition/skip_slot_cache_test.go b/beacon-chain/core/transition/skip_slot_cache_test.go index e3b612a8e..efb358c6a 100644 --- a/beacon-chain/core/transition/skip_slot_cache_test.go +++ b/beacon-chain/core/transition/skip_slot_cache_test.go @@ -10,26 +10,26 @@ import ( v1 "github.com/prysmaticlabs/prysm/beacon-chain/state/v1" "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestSkipSlotCache_OK(t *testing.T) { transition.SkipSlotCache.Enable() defer transition.SkipSlotCache.Disable() - bState, privs := testutil.DeterministicGenesisState(t, params.MinimalSpecConfig().MinGenesisActiveValidatorCount) + bState, privs := util.DeterministicGenesisState(t, params.MinimalSpecConfig().MinGenesisActiveValidatorCount) pbState, err := v1.ProtobufBeaconState(bState.CloneInnerState()) require.NoError(t, err) originalState, err := v1.InitializeFromProto(pbState) require.NoError(t, err) - blkCfg := testutil.DefaultBlockGenConfig() + blkCfg := util.DefaultBlockGenConfig() blkCfg.NumAttestations = 1 // First transition will be with an empty cache, so the cache becomes populated // with the state - blk, err := testutil.GenerateFullBlock(bState, privs, blkCfg, originalState.Slot()+10) + blk, err := util.GenerateFullBlock(bState, privs, blkCfg, originalState.Slot()+10) require.NoError(t, err) executedState, err := transition.ExecuteStateTransition(context.Background(), originalState, wrapper.WrappedPhase0SignedBeaconBlock(blk)) require.NoError(t, err, "Could not run state transition") @@ -42,20 +42,20 @@ func TestSkipSlotCache_OK(t *testing.T) { } func TestSkipSlotCache_ConcurrentMixup(t *testing.T) { - bState, privs := testutil.DeterministicGenesisState(t, params.MinimalSpecConfig().MinGenesisActiveValidatorCount) + bState, privs := util.DeterministicGenesisState(t, params.MinimalSpecConfig().MinGenesisActiveValidatorCount) pbState, err := v1.ProtobufBeaconState(bState.CloneInnerState()) require.NoError(t, err) originalState, err := v1.InitializeFromProto(pbState) require.NoError(t, err) - blkCfg := testutil.DefaultBlockGenConfig() + blkCfg := util.DefaultBlockGenConfig() blkCfg.NumAttestations = 1 transition.SkipSlotCache.Disable() // First transition will be with an empty cache, so the cache becomes populated // with the state - blk, err := testutil.GenerateFullBlock(bState, privs, blkCfg, originalState.Slot()+10) + blk, err := util.GenerateFullBlock(bState, privs, blkCfg, originalState.Slot()+10) require.NoError(t, err) executedState, err := transition.ExecuteStateTransition(context.Background(), originalState, wrapper.WrappedPhase0SignedBeaconBlock(blk)) require.NoError(t, err, "Could not run state transition") @@ -65,10 +65,10 @@ func TestSkipSlotCache_ConcurrentMixup(t *testing.T) { // Create two shallow but different forks var s1, s0 state.BeaconState { - blk, err := testutil.GenerateFullBlock(originalState.Copy(), privs, blkCfg, originalState.Slot()+10) + blk, err := util.GenerateFullBlock(originalState.Copy(), privs, blkCfg, originalState.Slot()+10) require.NoError(t, err) copy(blk.Block.Body.Graffiti, "block 1") - signature, err := testutil.BlockSignature(originalState, blk.Block, privs) + signature, err := util.BlockSignature(originalState, blk.Block, privs) require.NoError(t, err) blk.Signature = signature.Marshal() s1, err = transition.ExecuteStateTransition(context.Background(), originalState.Copy(), wrapper.WrappedPhase0SignedBeaconBlock(blk)) @@ -76,10 +76,10 @@ func TestSkipSlotCache_ConcurrentMixup(t *testing.T) { } { - blk, err := testutil.GenerateFullBlock(originalState.Copy(), privs, blkCfg, originalState.Slot()+10) + blk, err := util.GenerateFullBlock(originalState.Copy(), privs, blkCfg, originalState.Slot()+10) require.NoError(t, err) copy(blk.Block.Body.Graffiti, "block 2") - signature, err := testutil.BlockSignature(originalState, blk.Block, privs) + signature, err := util.BlockSignature(originalState, blk.Block, privs) require.NoError(t, err) blk.Signature = signature.Marshal() s0, err = transition.ExecuteStateTransition(context.Background(), originalState.Copy(), wrapper.WrappedPhase0SignedBeaconBlock(blk)) diff --git a/beacon-chain/core/transition/state_test.go b/beacon-chain/core/transition/state_test.go index e7098580a..a4eac1688 100644 --- a/beacon-chain/core/transition/state_test.go +++ b/beacon-chain/core/transition/state_test.go @@ -10,9 +10,9 @@ import ( "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/crypto/hash" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/protobuf/proto" ) @@ -32,9 +32,9 @@ func TestGenesisBeaconState_OK(t *testing.T) { assert.Equal(t, types.Epoch(8192), params.BeaconConfig().EpochsPerSlashingsVector, "EpochsPerSlashingsVector should be 8192 for these tests to pass") genesisTime := uint64(99999) - deposits, _, err := testutil.DeterministicDepositsAndKeys(uint64(depositsForChainStart)) + deposits, _, err := util.DeterministicDepositsAndKeys(uint64(depositsForChainStart)) require.NoError(t, err) - eth1Data, err := testutil.DeterministicEth1Data(len(deposits)) + eth1Data, err := util.DeterministicEth1Data(len(deposits)) require.NoError(t, err) newState, err := transition.GenesisBeaconState(context.Background(), deposits, genesisTime, eth1Data) require.NoError(t, err, "Could not execute GenesisBeaconState") @@ -91,7 +91,7 @@ func TestGenesisBeaconState_OK(t *testing.T) { } func TestGenesisState_HashEquality(t *testing.T) { - deposits, _, err := testutil.DeterministicDepositsAndKeys(100) + deposits, _, err := util.DeterministicDepositsAndKeys(100) require.NoError(t, err) state1, err := transition.GenesisBeaconState(context.Background(), deposits, 0, ðpb.Eth1Data{BlockHash: make([]byte, 32)}) require.NoError(t, err) diff --git a/beacon-chain/core/transition/stateutils/BUILD.bazel b/beacon-chain/core/transition/stateutils/BUILD.bazel index e9d932a92..9c1be0675 100644 --- a/beacon-chain/core/transition/stateutils/BUILD.bazel +++ b/beacon-chain/core/transition/stateutils/BUILD.bazel @@ -6,7 +6,7 @@ go_library( importpath = "github.com/prysmaticlabs/prysm/beacon-chain/core/transition/stateutils", visibility = [ "//beacon-chain:__subpackages__", - "//shared/testutil:__pkg__", + "//testing/util:__pkg__", ], deps = [ "//encoding/bytesutil:go_default_library", @@ -24,8 +24,8 @@ go_test( "//beacon-chain/state/v1:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/prysm/v1alpha1:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", ], ) diff --git a/beacon-chain/core/transition/stateutils/validator_index_map_test.go b/beacon-chain/core/transition/stateutils/validator_index_map_test.go index f102e050b..cde34e778 100644 --- a/beacon-chain/core/transition/stateutils/validator_index_map_test.go +++ b/beacon-chain/core/transition/stateutils/validator_index_map_test.go @@ -8,8 +8,8 @@ import ( v1 "github.com/prysmaticlabs/prysm/beacon-chain/state/v1" "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestValidatorIndexMap_OK(t *testing.T) { diff --git a/beacon-chain/core/transition/trailing_slot_state_cache_test.go b/beacon-chain/core/transition/trailing_slot_state_cache_test.go index 7fb4f9560..f4ab8657b 100644 --- a/beacon-chain/core/transition/trailing_slot_state_cache_test.go +++ b/beacon-chain/core/transition/trailing_slot_state_cache_test.go @@ -6,8 +6,8 @@ import ( types "github.com/prysmaticlabs/eth2-types" "github.com/prysmaticlabs/prysm/beacon-chain/core/transition" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestTrailingSlotState_RoundTrip(t *testing.T) { @@ -17,7 +17,7 @@ func TestTrailingSlotState_RoundTrip(t *testing.T) { require.NoError(t, err) require.Equal(t, nil, s) - s, _ = testutil.DeterministicGenesisState(t, 1) + s, _ = util.DeterministicGenesisState(t, 1) require.NoError(t, transition.UpdateNextSlotCache(ctx, r, s)) s, err = transition.NextSlotState(ctx, r) require.NoError(t, err) diff --git a/beacon-chain/core/transition/transition_no_verify_sig_test.go b/beacon-chain/core/transition/transition_no_verify_sig_test.go index 259c42880..2fd3fd7a9 100644 --- a/beacon-chain/core/transition/transition_no_verify_sig_test.go +++ b/beacon-chain/core/transition/transition_no_verify_sig_test.go @@ -11,13 +11,13 @@ import ( "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestExecuteStateTransitionNoVerify_FullProcess(t *testing.T) { - beaconState, privKeys := testutil.DeterministicGenesisState(t, 100) + beaconState, privKeys := util.DeterministicGenesisState(t, 100) eth1Data := ðpb.Eth1Data{ DepositCount: 100, @@ -35,7 +35,7 @@ func TestExecuteStateTransitionNoVerify_FullProcess(t *testing.T) { require.NoError(t, beaconState.SetSlot(beaconState.Slot()+1)) epoch := core.CurrentEpoch(beaconState) - randaoReveal, err := testutil.RandaoReveal(beaconState, epoch, privKeys) + randaoReveal, err := util.RandaoReveal(beaconState, epoch, privKeys) require.NoError(t, err) require.NoError(t, beaconState.SetSlot(beaconState.Slot()-1)) @@ -45,7 +45,7 @@ func TestExecuteStateTransitionNoVerify_FullProcess(t *testing.T) { require.NoError(t, err) proposerIdx, err := helpers.BeaconProposerIndex(nextSlotState) require.NoError(t, err) - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() block.Block.ProposerIndex = proposerIdx block.Block.Slot = beaconState.Slot() + 1 block.Block.ParentRoot = parentRoot[:] @@ -57,7 +57,7 @@ func TestExecuteStateTransitionNoVerify_FullProcess(t *testing.T) { block.Block.StateRoot = stateRoot[:] - sig, err := testutil.BlockSignature(beaconState, block.Block, privKeys) + sig, err := util.BlockSignature(beaconState, block.Block, privKeys) require.NoError(t, err) block.Signature = sig.Marshal() @@ -69,7 +69,7 @@ func TestExecuteStateTransitionNoVerify_FullProcess(t *testing.T) { } func TestExecuteStateTransitionNoVerifySignature_CouldNotVerifyStateRoot(t *testing.T) { - beaconState, privKeys := testutil.DeterministicGenesisState(t, 100) + beaconState, privKeys := util.DeterministicGenesisState(t, 100) eth1Data := ðpb.Eth1Data{ DepositCount: 100, @@ -87,7 +87,7 @@ func TestExecuteStateTransitionNoVerifySignature_CouldNotVerifyStateRoot(t *test require.NoError(t, beaconState.SetSlot(beaconState.Slot()+1)) epoch := core.CurrentEpoch(beaconState) - randaoReveal, err := testutil.RandaoReveal(beaconState, epoch, privKeys) + randaoReveal, err := util.RandaoReveal(beaconState, epoch, privKeys) require.NoError(t, err) require.NoError(t, beaconState.SetSlot(beaconState.Slot()-1)) @@ -97,7 +97,7 @@ func TestExecuteStateTransitionNoVerifySignature_CouldNotVerifyStateRoot(t *test require.NoError(t, err) proposerIdx, err := helpers.BeaconProposerIndex(nextSlotState) require.NoError(t, err) - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() block.Block.ProposerIndex = proposerIdx block.Block.Slot = beaconState.Slot() + 1 block.Block.ParentRoot = parentRoot[:] @@ -109,7 +109,7 @@ func TestExecuteStateTransitionNoVerifySignature_CouldNotVerifyStateRoot(t *test block.Block.StateRoot = stateRoot[:] - sig, err := testutil.BlockSignature(beaconState, block.Block, privKeys) + sig, err := util.BlockSignature(beaconState, block.Block, privKeys) require.NoError(t, err) block.Signature = sig.Marshal() @@ -161,7 +161,7 @@ func TestCalculateStateRootAltair_OK(t *testing.T) { } func TestProcessBlockDifferentVersion(t *testing.T) { - beaconState, _ := testutil.DeterministicGenesisState(t, 64) // Phase 0 state + beaconState, _ := util.DeterministicGenesisState(t, 64) // Phase 0 state _, block := createFullAltairBlockWithOperations(t) wsb, err := wrapper.WrappedAltairSignedBeaconBlock(block) // Altair block require.NoError(t, err) diff --git a/beacon-chain/core/transition/transition_test.go b/beacon-chain/core/transition/transition_test.go index 788201404..dadf7d5fd 100644 --- a/beacon-chain/core/transition/transition_test.go +++ b/beacon-chain/core/transition/transition_test.go @@ -20,9 +20,9 @@ import ( "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/attestation" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" "github.com/prysmaticlabs/prysm/runtime/version" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func init() { @@ -47,7 +47,7 @@ func TestExecuteStateTransition_IncorrectSlot(t *testing.T) { } func TestExecuteStateTransition_FullProcess(t *testing.T) { - beaconState, privKeys := testutil.DeterministicGenesisState(t, 100) + beaconState, privKeys := util.DeterministicGenesisState(t, 100) eth1Data := ðpb.Eth1Data{ DepositCount: 100, @@ -68,7 +68,7 @@ func TestExecuteStateTransition_FullProcess(t *testing.T) { require.NoError(t, beaconState.SetSlot(beaconState.Slot()+1)) epoch := core.CurrentEpoch(beaconState) - randaoReveal, err := testutil.RandaoReveal(beaconState, epoch, privKeys) + randaoReveal, err := util.RandaoReveal(beaconState, epoch, privKeys) require.NoError(t, err) require.NoError(t, beaconState.SetSlot(beaconState.Slot()-1)) @@ -78,7 +78,7 @@ func TestExecuteStateTransition_FullProcess(t *testing.T) { require.NoError(t, err) proposerIdx, err := helpers.BeaconProposerIndex(nextSlotState) require.NoError(t, err) - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() block.Block.ProposerIndex = proposerIdx block.Block.Slot = beaconState.Slot() + 1 block.Block.ParentRoot = parentRoot[:] @@ -90,7 +90,7 @@ func TestExecuteStateTransition_FullProcess(t *testing.T) { block.Block.StateRoot = stateRoot[:] - sig, err := testutil.BlockSignature(beaconState, block.Block, privKeys) + sig, err := util.BlockSignature(beaconState, block.Block, privKeys) require.NoError(t, err) block.Signature = sig.Marshal() @@ -105,18 +105,18 @@ func TestExecuteStateTransition_FullProcess(t *testing.T) { } func TestProcessBlock_IncorrectProcessExits(t *testing.T) { - beaconState, _ := testutil.DeterministicGenesisState(t, 100) + beaconState, _ := util.DeterministicGenesisState(t, 100) proposerSlashings := []*ethpb.ProposerSlashing{ { - Header_1: testutil.HydrateSignedBeaconHeader(ðpb.SignedBeaconBlockHeader{ + Header_1: util.HydrateSignedBeaconHeader(ðpb.SignedBeaconBlockHeader{ Header: ðpb.BeaconBlockHeader{ ProposerIndex: 3, Slot: 1, }, Signature: bytesutil.PadTo([]byte("A"), 96), }), - Header_2: testutil.HydrateSignedBeaconHeader(ðpb.SignedBeaconBlockHeader{ + Header_2: util.HydrateSignedBeaconHeader(ðpb.SignedBeaconBlockHeader{ Header: ðpb.BeaconBlockHeader{ ProposerIndex: 3, Slot: 1, @@ -128,12 +128,12 @@ func TestProcessBlock_IncorrectProcessExits(t *testing.T) { attesterSlashings := []*ethpb.AttesterSlashing{ { Attestation_1: ðpb.IndexedAttestation{ - Data: testutil.HydrateAttestationData(ðpb.AttestationData{}), + Data: util.HydrateAttestationData(ðpb.AttestationData{}), AttestingIndices: []uint64{0, 1}, Signature: make([]byte, 96), }, Attestation_2: ðpb.IndexedAttestation{ - Data: testutil.HydrateAttestationData(ðpb.AttestationData{}), + Data: util.HydrateAttestationData(ðpb.AttestationData{}), AttestingIndices: []uint64{0, 1}, Signature: make([]byte, 96), }, @@ -144,7 +144,7 @@ func TestProcessBlock_IncorrectProcessExits(t *testing.T) { blockRoots = append(blockRoots, []byte{byte(i)}) } require.NoError(t, beaconState.SetBlockRoots(blockRoots)) - blockAtt := testutil.HydrateAttestation(ðpb.Attestation{ + blockAtt := util.HydrateAttestation(ðpb.Attestation{ Data: ðpb.AttestationData{ Target: ðpb.Checkpoint{Root: bytesutil.PadTo([]byte("hello-world"), 32)}, }, @@ -158,7 +158,7 @@ func TestProcessBlock_IncorrectProcessExits(t *testing.T) { genesisBlock := blocks.NewGenesisBlock([]byte{}) bodyRoot, err := genesisBlock.Block.HashTreeRoot() require.NoError(t, err) - err = beaconState.SetLatestBlockHeader(testutil.HydrateBeaconHeader(ðpb.BeaconBlockHeader{ + err = beaconState.SetLatestBlockHeader(util.HydrateBeaconHeader(ðpb.BeaconBlockHeader{ Slot: genesisBlock.Block.Slot, ParentRoot: genesisBlock.Block.ParentRoot, BodyRoot: bodyRoot[:], @@ -166,7 +166,7 @@ func TestProcessBlock_IncorrectProcessExits(t *testing.T) { require.NoError(t, err) parentRoot, err := beaconState.LatestBlockHeader().HashTreeRoot() require.NoError(t, err) - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() block.Block.Slot = 1 block.Block.ParentRoot = parentRoot[:] block.Block.Body.ProposerSlashings = proposerSlashings @@ -188,7 +188,7 @@ func TestProcessBlock_IncorrectProcessExits(t *testing.T) { func createFullBlockWithOperations(t *testing.T) (state.BeaconState, *ethpb.SignedBeaconBlock, []*ethpb.Attestation, []*ethpb.ProposerSlashing, []*ethpb.SignedVoluntaryExit) { - beaconState, privKeys := testutil.DeterministicGenesisState(t, 32) + beaconState, privKeys := util.DeterministicGenesisState(t, 32) genesisBlock := blocks.NewGenesisBlock([]byte{}) bodyRoot, err := genesisBlock.Block.HashTreeRoot() require.NoError(t, err) @@ -214,7 +214,7 @@ func createFullBlockWithOperations(t *testing.T) (state.BeaconState, require.NoError(t, err) currentEpoch := core.CurrentEpoch(beaconState) - header1 := testutil.HydrateSignedBeaconHeader(ðpb.SignedBeaconBlockHeader{ + header1 := util.HydrateSignedBeaconHeader(ðpb.SignedBeaconBlockHeader{ Header: ðpb.BeaconBlockHeader{ ProposerIndex: proposerSlashIdx, Slot: 1, @@ -224,7 +224,7 @@ func createFullBlockWithOperations(t *testing.T) (state.BeaconState, header1.Signature, err = helpers.ComputeDomainAndSign(beaconState, currentEpoch, header1.Header, params.BeaconConfig().DomainBeaconProposer, privKeys[proposerSlashIdx]) require.NoError(t, err) - header2 := testutil.HydrateSignedBeaconHeader(ðpb.SignedBeaconBlockHeader{ + header2 := util.HydrateSignedBeaconHeader(ðpb.SignedBeaconBlockHeader{ Header: ðpb.BeaconBlockHeader{ ProposerIndex: proposerSlashIdx, Slot: 1, @@ -245,7 +245,7 @@ func createFullBlockWithOperations(t *testing.T) (state.BeaconState, require.NoError(t, beaconState.SetValidators(validators)) mockRoot2 := [32]byte{'A'} - att1 := testutil.HydrateIndexedAttestation(ðpb.IndexedAttestation{ + att1 := util.HydrateIndexedAttestation(ðpb.IndexedAttestation{ Data: ðpb.AttestationData{ Source: ðpb.Checkpoint{Epoch: 0, Root: mockRoot2[:]}, }, @@ -261,7 +261,7 @@ func createFullBlockWithOperations(t *testing.T) (state.BeaconState, att1.Signature = aggregateSig.Marshal() mockRoot3 := [32]byte{'B'} - att2 := testutil.HydrateIndexedAttestation(ðpb.IndexedAttestation{ + att2 := util.HydrateIndexedAttestation(ðpb.IndexedAttestation{ Data: ðpb.AttestationData{ Source: ðpb.Checkpoint{Epoch: 0, Root: mockRoot3[:]}, Target: ðpb.Checkpoint{Epoch: 0, Root: make([]byte, 32)}, @@ -291,7 +291,7 @@ func createFullBlockWithOperations(t *testing.T) (state.BeaconState, aggBits := bitfield.NewBitlist(1) aggBits.SetBitAt(0, true) - blockAtt := testutil.HydrateAttestation(ðpb.Attestation{ + blockAtt := util.HydrateAttestation(ðpb.Attestation{ Data: ðpb.AttestationData{ Slot: beaconState.Slot(), Target: ðpb.Checkpoint{Epoch: core.CurrentEpoch(beaconState)}, @@ -331,11 +331,11 @@ func createFullBlockWithOperations(t *testing.T) (state.BeaconState, require.NoError(t, err) copied := beaconState.Copy() require.NoError(t, copied.SetSlot(beaconState.Slot()+1)) - randaoReveal, err := testutil.RandaoReveal(copied, currentEpoch, privKeys) + randaoReveal, err := util.RandaoReveal(copied, currentEpoch, privKeys) require.NoError(t, err) proposerIndex, err := helpers.BeaconProposerIndex(copied) require.NoError(t, err) - block := testutil.HydrateSignedBeaconBlock(ðpb.SignedBeaconBlock{ + block := util.HydrateSignedBeaconBlock(ðpb.SignedBeaconBlock{ Block: ðpb.BeaconBlock{ ParentRoot: parentRoot[:], Slot: beaconState.Slot() + 1, @@ -350,7 +350,7 @@ func createFullBlockWithOperations(t *testing.T) (state.BeaconState, }, }) - sig, err := testutil.BlockSignature(beaconState, block.Block, privKeys) + sig, err := util.BlockSignature(beaconState, block.Block, privKeys) require.NoError(t, err) block.Signature = sig.Marshal() @@ -517,7 +517,7 @@ func TestProcessSlots_ThroughAltairEpoch(t *testing.T) { params.OverrideBeaconConfig(conf) defer params.UseMainnetConfig() - st, _ := testutil.DeterministicGenesisState(t, params.BeaconConfig().MaxValidatorsPerCommittee) + st, _ := util.DeterministicGenesisState(t, params.BeaconConfig().MaxValidatorsPerCommittee) st, err := transition.ProcessSlots(context.Background(), st, params.BeaconConfig().SlotsPerEpoch*10) require.NoError(t, err) require.Equal(t, version.Altair, st.Version()) @@ -552,7 +552,7 @@ func TestProcessSlots_OnlyAltairEpoch(t *testing.T) { params.OverrideBeaconConfig(conf) defer params.UseMainnetConfig() - st, _ := testutil.DeterministicGenesisStateAltair(t, params.BeaconConfig().MaxValidatorsPerCommittee) + st, _ := util.DeterministicGenesisStateAltair(t, params.BeaconConfig().MaxValidatorsPerCommittee) require.NoError(t, st.SetSlot(params.BeaconConfig().SlotsPerEpoch*6)) st, err := transition.ProcessSlots(context.Background(), st, params.BeaconConfig().SlotsPerEpoch*10) require.NoError(t, err) @@ -583,7 +583,7 @@ func TestProcessSlots_OnlyAltairEpoch(t *testing.T) { func TestProcessSlotsUsingNextSlotCache(t *testing.T) { ctx := context.Background() - s, _ := testutil.DeterministicGenesisState(t, 1) + s, _ := util.DeterministicGenesisState(t, 1) r := []byte{'a'} s, err := transition.ProcessSlotsUsingNextSlotCache(ctx, s, r, 5) require.NoError(t, err) diff --git a/beacon-chain/core/validators/BUILD.bazel b/beacon-chain/core/validators/BUILD.bazel index 8dcbc8ddd..fe2ebece9 100644 --- a/beacon-chain/core/validators/BUILD.bazel +++ b/beacon-chain/core/validators/BUILD.bazel @@ -30,8 +30,8 @@ go_test( "//beacon-chain/state/v1:go_default_library", "//config/params:go_default_library", "//proto/prysm/v1alpha1:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", ], ) diff --git a/beacon-chain/core/validators/validator_test.go b/beacon-chain/core/validators/validator_test.go index fc3eb422f..dff2a3ef8 100644 --- a/beacon-chain/core/validators/validator_test.go +++ b/beacon-chain/core/validators/validator_test.go @@ -9,8 +9,8 @@ import ( v1 "github.com/prysmaticlabs/prysm/beacon-chain/state/v1" "github.com/prysmaticlabs/prysm/config/params" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestHasVoted_OK(t *testing.T) { diff --git a/beacon-chain/db/BUILD.bazel b/beacon-chain/db/BUILD.bazel index 0a82b77d4..b697104e4 100644 --- a/beacon-chain/db/BUILD.bazel +++ b/beacon-chain/db/BUILD.bazel @@ -38,9 +38,9 @@ go_test( "//beacon-chain/db/kv:go_default_library", "//cmd:go_default_library", "//proto/prysm/v1alpha1/wrapper:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", "@com_github_sirupsen_logrus//hooks/test:go_default_library", "@com_github_urfave_cli_v2//:go_default_library", diff --git a/beacon-chain/db/filters/BUILD.bazel b/beacon-chain/db/filters/BUILD.bazel index 46c2b6a9b..5ef7203fe 100644 --- a/beacon-chain/db/filters/BUILD.bazel +++ b/beacon-chain/db/filters/BUILD.bazel @@ -16,7 +16,7 @@ go_test( srcs = ["filter_test.go"], embed = [":go_default_library"], deps = [ - "//shared/testutil/assert:go_default_library", + "//testing/assert:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", ], ) diff --git a/beacon-chain/db/filters/filter_test.go b/beacon-chain/db/filters/filter_test.go index 76d8070f9..b2b9c6e08 100644 --- a/beacon-chain/db/filters/filter_test.go +++ b/beacon-chain/db/filters/filter_test.go @@ -4,7 +4,7 @@ import ( "testing" types "github.com/prysmaticlabs/eth2-types" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" ) func TestQueryFilter_ChainsCorrectly(t *testing.T) { diff --git a/beacon-chain/db/kv/BUILD.bazel b/beacon-chain/db/kv/BUILD.bazel index 39fcf68d6..a0ac4388a 100644 --- a/beacon-chain/db/kv/BUILD.bazel +++ b/beacon-chain/db/kv/BUILD.bazel @@ -110,9 +110,9 @@ go_test( "//proto/prysm/v1alpha1/block:go_default_library", "//proto/prysm/v1alpha1/wrapper:go_default_library", "//proto/testing:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "@com_github_ethereum_go_ethereum//common:go_default_library", "@com_github_golang_snappy//:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", diff --git a/beacon-chain/db/kv/archived_point_test.go b/beacon-chain/db/kv/archived_point_test.go index 995524676..8236f389b 100644 --- a/beacon-chain/db/kv/archived_point_test.go +++ b/beacon-chain/db/kv/archived_point_test.go @@ -5,9 +5,9 @@ import ( "testing" types "github.com/prysmaticlabs/eth2-types" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestArchivedPointIndexRoot_CanSaveRetrieve(t *testing.T) { @@ -18,7 +18,7 @@ func TestArchivedPointIndexRoot_CanSaveRetrieve(t *testing.T) { received := db.ArchivedPointRoot(ctx, i1) require.NotEqual(t, r1, received, "Should not have been saved") - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, st.SetSlot(i1)) require.NoError(t, db.SaveState(ctx, st, r1)) @@ -33,7 +33,7 @@ func TestLastArchivedPoint_CanRetrieve(t *testing.T) { require.NoError(t, err) assert.Equal(t, types.Slot(0), i, "Did not get correct index") - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) assert.NoError(t, db.SaveState(ctx, st, [32]byte{'A'})) assert.Equal(t, [32]byte{'A'}, db.LastArchivedRoot(ctx), "Did not get wanted root") diff --git a/beacon-chain/db/kv/backup_test.go b/beacon-chain/db/kv/backup_test.go index 0738807b4..83b7841b0 100644 --- a/beacon-chain/db/kv/backup_test.go +++ b/beacon-chain/db/kv/backup_test.go @@ -9,8 +9,8 @@ import ( types "github.com/prysmaticlabs/eth2-types" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestStore_Backup(t *testing.T) { @@ -18,13 +18,13 @@ func TestStore_Backup(t *testing.T) { require.NoError(t, err, "Failed to instantiate DB") ctx := context.Background() - head := testutil.NewBeaconBlock() + head := util.NewBeaconBlock() head.Block.Slot = 5000 require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(head))) root, err := head.Block.HashTreeRoot() require.NoError(t, err) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, db.SaveState(ctx, st, root)) require.NoError(t, db.SaveHeadBlockRoot(ctx, root)) @@ -59,12 +59,12 @@ func TestStore_BackupMultipleBuckets(t *testing.T) { startSlot := types.Slot(5000) for i := startSlot; i < 5200; i++ { - head := testutil.NewBeaconBlock() + head := util.NewBeaconBlock() head.Block.Slot = i require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(head))) root, err := head.Block.HashTreeRoot() require.NoError(t, err) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, st.SetSlot(i)) require.NoError(t, err) require.NoError(t, db.SaveState(ctx, st, root)) @@ -91,7 +91,7 @@ func TestStore_BackupMultipleBuckets(t *testing.T) { require.NoError(t, backedDB.Close(), "Failed to close database") }) for i := startSlot; i < 5200; i++ { - head := testutil.NewBeaconBlock() + head := util.NewBeaconBlock() head.Block.Slot = i root, err := head.Block.HashTreeRoot() require.NoError(t, err) diff --git a/beacon-chain/db/kv/block_altair_test.go b/beacon-chain/db/kv/block_altair_test.go index ec93ecdda..109ea263c 100644 --- a/beacon-chain/db/kv/block_altair_test.go +++ b/beacon-chain/db/kv/block_altair_test.go @@ -12,9 +12,9 @@ import ( v2 "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/protobuf/proto" ) @@ -24,14 +24,14 @@ func TestStore_SaveAltairBlock_NoDuplicates(t *testing.T) { slot := types.Slot(20) ctx := context.Background() // First we save a previous block to ensure the cache max size is reached. - prevBlock := testutil.NewBeaconBlockAltair() + prevBlock := util.NewBeaconBlockAltair() prevBlock.Block.Slot = slot - 1 prevBlock.Block.ParentRoot = bytesutil.PadTo([]byte{1, 2, 3}, 32) wsb, err := wrapper.WrappedAltairSignedBeaconBlock(prevBlock) require.NoError(t, err) require.NoError(t, db.SaveBlock(ctx, wsb)) - block := testutil.NewBeaconBlockAltair() + block := util.NewBeaconBlockAltair() block.Block.Slot = slot block.Block.ParentRoot = bytesutil.PadTo([]byte{1, 2, 3}, 32) // Even with a full cache, saving new blocks should not cause @@ -53,7 +53,7 @@ func TestStore_AltairBlocksCRUD(t *testing.T) { db := setupDB(t) ctx := context.Background() - block := testutil.NewBeaconBlockAltair() + block := util.NewBeaconBlockAltair() block.Block.Slot = 20 block.Block.ParentRoot = bytesutil.PadTo([]byte{1, 2, 3}, 32) @@ -81,7 +81,7 @@ func TestStore_AltairBlocksBatchDelete(t *testing.T) { blockRoots := make([][32]byte, 0) oddBlocks := make([]block.SignedBeaconBlock, 0) for i := 0; i < len(totalBlocks); i++ { - b := testutil.NewBeaconBlockAltair() + b := util.NewBeaconBlockAltair() b.Block.Slot = types.Slot(i) b.Block.ParentRoot = bytesutil.PadTo([]byte("parent"), 32) wb, err := wrapper.WrappedAltairSignedBeaconBlock(b) @@ -118,7 +118,7 @@ func TestStore_AltairBlocksHandleZeroCase(t *testing.T) { numBlocks := 10 totalBlocks := make([]block.SignedBeaconBlock, numBlocks) for i := 0; i < len(totalBlocks); i++ { - b := testutil.NewBeaconBlockAltair() + b := util.NewBeaconBlockAltair() b.Block.Slot = types.Slot(i) b.Block.ParentRoot = bytesutil.PadTo([]byte("parent"), 32) wb, err := wrapper.WrappedAltairSignedBeaconBlock(b) @@ -141,7 +141,7 @@ func TestStore_AltairBlocksHandleInvalidEndSlot(t *testing.T) { totalBlocks := make([]block.SignedBeaconBlock, numBlocks) // Save blocks from slot 1 onwards. for i := 0; i < len(totalBlocks); i++ { - b := testutil.NewBeaconBlockAltair() + b := util.NewBeaconBlockAltair() b.Block.Slot = types.Slot(i) + 1 b.Block.ParentRoot = bytesutil.PadTo([]byte("parent"), 32) wb, err := wrapper.WrappedAltairSignedBeaconBlock(b) @@ -164,7 +164,7 @@ func TestStore_AltairBlocksHandleInvalidEndSlot(t *testing.T) { func TestStore_AltairBlocksCRUD_NoCache(t *testing.T) { db := setupDB(t) ctx := context.Background() - block := testutil.NewBeaconBlockAltair() + block := util.NewBeaconBlockAltair() block.Block.Slot = 20 block.Block.ParentRoot = bytesutil.PadTo([]byte{1, 2, 3}, 32) blockRoot, err := block.Block.HashTreeRoot() @@ -186,19 +186,19 @@ func TestStore_AltairBlocksCRUD_NoCache(t *testing.T) { func TestStore_AltairBlocks_FiltersCorrectly(t *testing.T) { db := setupDB(t) - b4 := testutil.NewBeaconBlockAltair() + b4 := util.NewBeaconBlockAltair() b4.Block.Slot = 4 b4.Block.ParentRoot = bytesutil.PadTo([]byte("parent"), 32) - b5 := testutil.NewBeaconBlockAltair() + b5 := util.NewBeaconBlockAltair() b5.Block.Slot = 5 b5.Block.ParentRoot = bytesutil.PadTo([]byte("parent2"), 32) - b6 := testutil.NewBeaconBlockAltair() + b6 := util.NewBeaconBlockAltair() b6.Block.Slot = 6 b6.Block.ParentRoot = bytesutil.PadTo([]byte("parent2"), 32) - b7 := testutil.NewBeaconBlockAltair() + b7 := util.NewBeaconBlockAltair() b7.Block.Slot = 7 b7.Block.ParentRoot = bytesutil.PadTo([]byte("parent3"), 32) - b8 := testutil.NewBeaconBlockAltair() + b8 := util.NewBeaconBlockAltair() b8.Block.Slot = 8 b8.Block.ParentRoot = bytesutil.PadTo([]byte("parent4"), 32) blocks := make([]block.SignedBeaconBlock, 0) @@ -275,11 +275,11 @@ func TestStore_AltairBlocks_FiltersCorrectly(t *testing.T) { func TestStore_AltairBlocks_VerifyBlockRoots(t *testing.T) { ctx := context.Background() db := setupDB(t) - b1 := testutil.NewBeaconBlockAltair() + b1 := util.NewBeaconBlockAltair() b1.Block.Slot = 1 r1, err := b1.Block.HashTreeRoot() require.NoError(t, err) - b2 := testutil.NewBeaconBlockAltair() + b2 := util.NewBeaconBlockAltair() b2.Block.Slot = 2 r2, err := b2.Block.HashTreeRoot() require.NoError(t, err) @@ -301,7 +301,7 @@ func TestStore_AltairBlocks_Retrieve_SlotRange(t *testing.T) { db := setupDB(t) totalBlocks := make([]block.SignedBeaconBlock, 500) for i := 0; i < 500; i++ { - b := testutil.NewBeaconBlockAltair() + b := util.NewBeaconBlockAltair() b.Block.Slot = types.Slot(i) b.Block.ParentRoot = bytesutil.PadTo([]byte("parent"), 32) wb, err := wrapper.WrappedAltairSignedBeaconBlock(b) @@ -320,7 +320,7 @@ func TestStore_AltairBlocks_Retrieve_Epoch(t *testing.T) { slots := params.BeaconConfig().SlotsPerEpoch.Mul(7) totalBlocks := make([]block.SignedBeaconBlock, slots) for i := types.Slot(0); i < slots; i++ { - b := testutil.NewBeaconBlockAltair() + b := util.NewBeaconBlockAltair() b.Block.Slot = i b.Block.ParentRoot = bytesutil.PadTo([]byte("parent"), 32) wb, err := wrapper.WrappedAltairSignedBeaconBlock(b) @@ -343,7 +343,7 @@ func TestStore_AltairBlocks_Retrieve_SlotRangeWithStep(t *testing.T) { db := setupDB(t) totalBlocks := make([]block.SignedBeaconBlock, 500) for i := 0; i < 500; i++ { - b := testutil.NewBeaconBlockAltair() + b := util.NewBeaconBlockAltair() b.Block.Slot = types.Slot(i) b.Block.ParentRoot = bytesutil.PadTo([]byte("parent"), 32) wb, err := wrapper.WrappedAltairSignedBeaconBlock(b) @@ -365,11 +365,11 @@ func TestStore_SaveAltairBlock_CanGetHighestAt(t *testing.T) { db := setupDB(t) ctx := context.Background() - block1 := testutil.NewBeaconBlockAltair() + block1 := util.NewBeaconBlockAltair() block1.Block.Slot = 1 - block2 := testutil.NewBeaconBlockAltair() + block2 := util.NewBeaconBlockAltair() block2.Block.Slot = 10 - block3 := testutil.NewBeaconBlockAltair() + block3 := util.NewBeaconBlockAltair() block3.Block.Slot = 100 for _, b := range []*v2.SignedBeaconBlockAltair{block1, block2, block3} { @@ -404,14 +404,14 @@ func TestStore_GenesisAltairBlock_CanGetHighestAt(t *testing.T) { db := setupDB(t) ctx := context.Background() - genesisBlock := testutil.NewBeaconBlockAltair() + genesisBlock := util.NewBeaconBlockAltair() genesisRoot, err := genesisBlock.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, db.SaveGenesisBlockRoot(ctx, genesisRoot)) wsb, err := wrapper.WrappedAltairSignedBeaconBlock(genesisBlock) require.NoError(t, err) require.NoError(t, db.SaveBlock(ctx, wsb)) - block1 := testutil.NewBeaconBlockAltair() + block1 := util.NewBeaconBlockAltair() block1.Block.Slot = 1 wsb, err = wrapper.WrappedAltairSignedBeaconBlock(block1) require.NoError(t, err) @@ -435,7 +435,7 @@ func TestStore_SaveAltairBlocks_HasCachedBlocks(t *testing.T) { var err error b := make([]block.SignedBeaconBlock, 500) for i := 0; i < 500; i++ { - blk := testutil.NewBeaconBlockAltair() + blk := util.NewBeaconBlockAltair() blk.Block.ParentRoot = bytesutil.PadTo([]byte("parent"), 32) blk.Block.Slot = types.Slot(i) b[i], err = wrapper.WrappedAltairSignedBeaconBlock(blk) @@ -458,7 +458,7 @@ func TestStore_SaveAltairBlocks_HasRootsMatched(t *testing.T) { var err error b := make([]block.SignedBeaconBlock, 500) for i := 0; i < 500; i++ { - blk := testutil.NewBeaconBlockAltair() + blk := util.NewBeaconBlockAltair() blk.Block.ParentRoot = bytesutil.PadTo([]byte("parent"), 32) blk.Block.Slot = types.Slot(i) b[i], err = wrapper.WrappedAltairSignedBeaconBlock(blk) @@ -483,12 +483,12 @@ func TestStore_AltairBlocksBySlot_BlockRootsBySlot(t *testing.T) { db := setupDB(t) ctx := context.Background() - b1 := testutil.NewBeaconBlockAltair() + b1 := util.NewBeaconBlockAltair() b1.Block.Slot = 20 - b2 := testutil.NewBeaconBlockAltair() + b2 := util.NewBeaconBlockAltair() b2.Block.Slot = 100 b2.Block.ParentRoot = bytesutil.PadTo([]byte("parent1"), 32) - b3 := testutil.NewBeaconBlockAltair() + b3 := util.NewBeaconBlockAltair() b3.Block.Slot = 100 b3.Block.ParentRoot = bytesutil.PadTo([]byte("parent2"), 32) diff --git a/beacon-chain/db/kv/blocks_test.go b/beacon-chain/db/kv/blocks_test.go index 0043202f9..e34da5314 100644 --- a/beacon-chain/db/kv/blocks_test.go +++ b/beacon-chain/db/kv/blocks_test.go @@ -11,9 +11,9 @@ import ( "github.com/prysmaticlabs/prysm/encoding/bytesutil" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/protobuf/proto" ) @@ -23,12 +23,12 @@ func TestStore_SaveBlock_NoDuplicates(t *testing.T) { slot := types.Slot(20) ctx := context.Background() // First we save a previous block to ensure the cache max size is reached. - prevBlock := testutil.NewBeaconBlock() + prevBlock := util.NewBeaconBlock() prevBlock.Block.Slot = slot - 1 prevBlock.Block.ParentRoot = bytesutil.PadTo([]byte{1, 2, 3}, 32) require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(prevBlock))) - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() block.Block.Slot = slot block.Block.ParentRoot = bytesutil.PadTo([]byte{1, 2, 3}, 32) // Even with a full cache, saving new blocks should not cause @@ -48,7 +48,7 @@ func TestStore_BlocksCRUD(t *testing.T) { db := setupDB(t) ctx := context.Background() - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() block.Block.Slot = 20 block.Block.ParentRoot = bytesutil.PadTo([]byte{1, 2, 3}, 32) @@ -74,7 +74,7 @@ func TestStore_BlocksBatchDelete(t *testing.T) { blockRoots := make([][32]byte, 0) oddBlocks := make([]block.SignedBeaconBlock, 0) for i := 0; i < len(totalBlocks); i++ { - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = types.Slot(i) b.Block.ParentRoot = bytesutil.PadTo([]byte("parent"), 32) totalBlocks[i] = wrapper.WrappedPhase0SignedBeaconBlock(b) @@ -109,7 +109,7 @@ func TestStore_BlocksHandleZeroCase(t *testing.T) { numBlocks := 10 totalBlocks := make([]block.SignedBeaconBlock, numBlocks) for i := 0; i < len(totalBlocks); i++ { - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = types.Slot(i) b.Block.ParentRoot = bytesutil.PadTo([]byte("parent"), 32) totalBlocks[i] = wrapper.WrappedPhase0SignedBeaconBlock(b) @@ -130,7 +130,7 @@ func TestStore_BlocksHandleInvalidEndSlot(t *testing.T) { totalBlocks := make([]block.SignedBeaconBlock, numBlocks) // Save blocks from slot 1 onwards. for i := 0; i < len(totalBlocks); i++ { - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = types.Slot(i) + 1 b.Block.ParentRoot = bytesutil.PadTo([]byte("parent"), 32) totalBlocks[i] = wrapper.WrappedPhase0SignedBeaconBlock(b) @@ -151,7 +151,7 @@ func TestStore_BlocksHandleInvalidEndSlot(t *testing.T) { func TestStore_GenesisBlock(t *testing.T) { db := setupDB(t) ctx := context.Background() - genesisBlock := testutil.NewBeaconBlock() + genesisBlock := util.NewBeaconBlock() genesisBlock.Block.ParentRoot = bytesutil.PadTo([]byte{1, 2, 3}, 32) blockRoot, err := genesisBlock.Block.HashTreeRoot() require.NoError(t, err) @@ -165,7 +165,7 @@ func TestStore_GenesisBlock(t *testing.T) { func TestStore_BlocksCRUD_NoCache(t *testing.T) { db := setupDB(t) ctx := context.Background() - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() block.Block.Slot = 20 block.Block.ParentRoot = bytesutil.PadTo([]byte{1, 2, 3}, 32) blockRoot, err := block.Block.HashTreeRoot() @@ -185,19 +185,19 @@ func TestStore_BlocksCRUD_NoCache(t *testing.T) { func TestStore_Blocks_FiltersCorrectly(t *testing.T) { db := setupDB(t) - b4 := testutil.NewBeaconBlock() + b4 := util.NewBeaconBlock() b4.Block.Slot = 4 b4.Block.ParentRoot = bytesutil.PadTo([]byte("parent"), 32) - b5 := testutil.NewBeaconBlock() + b5 := util.NewBeaconBlock() b5.Block.Slot = 5 b5.Block.ParentRoot = bytesutil.PadTo([]byte("parent2"), 32) - b6 := testutil.NewBeaconBlock() + b6 := util.NewBeaconBlock() b6.Block.Slot = 6 b6.Block.ParentRoot = bytesutil.PadTo([]byte("parent2"), 32) - b7 := testutil.NewBeaconBlock() + b7 := util.NewBeaconBlock() b7.Block.Slot = 7 b7.Block.ParentRoot = bytesutil.PadTo([]byte("parent3"), 32) - b8 := testutil.NewBeaconBlock() + b8 := util.NewBeaconBlock() b8.Block.Slot = 8 b8.Block.ParentRoot = bytesutil.PadTo([]byte("parent4"), 32) blocks := []block.SignedBeaconBlock{ @@ -275,11 +275,11 @@ func TestStore_Blocks_FiltersCorrectly(t *testing.T) { func TestStore_Blocks_VerifyBlockRoots(t *testing.T) { ctx := context.Background() db := setupDB(t) - b1 := testutil.NewBeaconBlock() + b1 := util.NewBeaconBlock() b1.Block.Slot = 1 r1, err := b1.Block.HashTreeRoot() require.NoError(t, err) - b2 := testutil.NewBeaconBlock() + b2 := util.NewBeaconBlock() b2.Block.Slot = 2 r2, err := b2.Block.HashTreeRoot() require.NoError(t, err) @@ -298,7 +298,7 @@ func TestStore_Blocks_Retrieve_SlotRange(t *testing.T) { db := setupDB(t) totalBlocks := make([]block.SignedBeaconBlock, 500) for i := 0; i < 500; i++ { - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = types.Slot(i) b.Block.ParentRoot = bytesutil.PadTo([]byte("parent"), 32) totalBlocks[i] = wrapper.WrappedPhase0SignedBeaconBlock(b) @@ -315,7 +315,7 @@ func TestStore_Blocks_Retrieve_Epoch(t *testing.T) { slots := params.BeaconConfig().SlotsPerEpoch.Mul(7) totalBlocks := make([]block.SignedBeaconBlock, slots) for i := types.Slot(0); i < slots; i++ { - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = i b.Block.ParentRoot = bytesutil.PadTo([]byte("parent"), 32) totalBlocks[i] = wrapper.WrappedPhase0SignedBeaconBlock(b) @@ -336,7 +336,7 @@ func TestStore_Blocks_Retrieve_SlotRangeWithStep(t *testing.T) { db := setupDB(t) totalBlocks := make([]block.SignedBeaconBlock, 500) for i := 0; i < 500; i++ { - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = types.Slot(i) b.Block.ParentRoot = bytesutil.PadTo([]byte("parent"), 32) totalBlocks[i] = wrapper.WrappedPhase0SignedBeaconBlock(b) @@ -356,13 +356,13 @@ func TestStore_SaveBlock_CanGetHighestAt(t *testing.T) { db := setupDB(t) ctx := context.Background() - block1 := testutil.NewBeaconBlock() + block1 := util.NewBeaconBlock() block1.Block.Slot = 1 require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(block1))) - block2 := testutil.NewBeaconBlock() + block2 := util.NewBeaconBlock() block2.Block.Slot = 10 require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(block2))) - block3 := testutil.NewBeaconBlock() + block3 := util.NewBeaconBlock() block3.Block.Slot = 100 require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(block3))) @@ -392,12 +392,12 @@ func TestStore_GenesisBlock_CanGetHighestAt(t *testing.T) { db := setupDB(t) ctx := context.Background() - genesisBlock := testutil.NewBeaconBlock() + genesisBlock := util.NewBeaconBlock() genesisRoot, err := genesisBlock.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, db.SaveGenesisBlockRoot(ctx, genesisRoot)) require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(genesisBlock))) - block1 := testutil.NewBeaconBlock() + block1 := util.NewBeaconBlock() block1.Block.Slot = 1 require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(block1))) @@ -418,7 +418,7 @@ func TestStore_SaveBlocks_HasCachedBlocks(t *testing.T) { b := make([]block.SignedBeaconBlock, 500) for i := 0; i < 500; i++ { - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.ParentRoot = bytesutil.PadTo([]byte("parent"), 32) blk.Block.Slot = types.Slot(i) b[i] = wrapper.WrappedPhase0SignedBeaconBlock(blk) @@ -439,7 +439,7 @@ func TestStore_SaveBlocks_HasRootsMatched(t *testing.T) { b := make([]block.SignedBeaconBlock, 500) for i := 0; i < 500; i++ { - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.ParentRoot = bytesutil.PadTo([]byte("parent"), 32) blk.Block.Slot = types.Slot(i) b[i] = wrapper.WrappedPhase0SignedBeaconBlock(blk) @@ -463,14 +463,14 @@ func TestStore_BlocksBySlot_BlockRootsBySlot(t *testing.T) { db := setupDB(t) ctx := context.Background() - b1 := testutil.NewBeaconBlock() + b1 := util.NewBeaconBlock() b1.Block.Slot = 20 require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b1))) - b2 := testutil.NewBeaconBlock() + b2 := util.NewBeaconBlock() b2.Block.Slot = 100 b2.Block.ParentRoot = bytesutil.PadTo([]byte("parent1"), 32) require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b2))) - b3 := testutil.NewBeaconBlock() + b3 := util.NewBeaconBlock() b3.Block.Slot = 100 b3.Block.ParentRoot = bytesutil.PadTo([]byte("parent2"), 32) require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b3))) diff --git a/beacon-chain/db/kv/checkpoint_test.go b/beacon-chain/db/kv/checkpoint_test.go index d4ac67ab3..d3e8d4af2 100644 --- a/beacon-chain/db/kv/checkpoint_test.go +++ b/beacon-chain/db/kv/checkpoint_test.go @@ -8,9 +8,9 @@ import ( "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/protobuf/proto" ) @@ -22,7 +22,7 @@ func TestStore_JustifiedCheckpoint_CanSaveRetrieve(t *testing.T) { Epoch: 10, Root: root[:], } - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, st.SetSlot(1)) require.NoError(t, db.SaveState(ctx, st, root)) @@ -40,7 +40,7 @@ func TestStore_FinalizedCheckpoint_CanSaveRetrieve(t *testing.T) { genesis := bytesutil.ToBytes32([]byte{'G', 'E', 'N', 'E', 'S', 'I', 'S'}) require.NoError(t, db.SaveGenesisBlockRoot(ctx, genesis)) - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.ParentRoot = genesis[:] blk.Block.Slot = 40 @@ -54,7 +54,7 @@ func TestStore_FinalizedCheckpoint_CanSaveRetrieve(t *testing.T) { // a valid chain is required to save finalized checkpoint. require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(blk))) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, st.SetSlot(1)) // a state is required to save checkpoint diff --git a/beacon-chain/db/kv/deposit_contract_test.go b/beacon-chain/db/kv/deposit_contract_test.go index 281c3b7d7..ac54f1bf2 100644 --- a/beacon-chain/db/kv/deposit_contract_test.go +++ b/beacon-chain/db/kv/deposit_contract_test.go @@ -5,8 +5,8 @@ import ( "testing" "github.com/ethereum/go-ethereum/common" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestStore_DepositContract(t *testing.T) { diff --git a/beacon-chain/db/kv/encoding_test.go b/beacon-chain/db/kv/encoding_test.go index 8c1b799ba..c83f427d5 100644 --- a/beacon-chain/db/kv/encoding_test.go +++ b/beacon-chain/db/kv/encoding_test.go @@ -5,7 +5,7 @@ import ( "testing" testpb "github.com/prysmaticlabs/prysm/proto/testing" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) func Test_encode_handlesNilFromFunction(t *testing.T) { diff --git a/beacon-chain/db/kv/finalized_block_roots_test.go b/beacon-chain/db/kv/finalized_block_roots_test.go index 8b3146719..c6733ea95 100644 --- a/beacon-chain/db/kv/finalized_block_roots_test.go +++ b/beacon-chain/db/kv/finalized_block_roots_test.go @@ -10,9 +10,9 @@ import ( ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) var genesisBlockRoot = bytesutil.ToBytes32([]byte{'G', 'E', 'N', 'E', 'S', 'I', 'S'}) @@ -35,7 +35,7 @@ func TestStore_IsFinalizedBlock(t *testing.T) { Root: root[:], } - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) // a state is required to save checkpoint require.NoError(t, db.SaveState(ctx, st, root)) @@ -58,7 +58,7 @@ func TestStore_IsFinalizedBlockGenesis(t *testing.T) { db := setupDB(t) ctx := context.Background() - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.Slot = 0 root, err := blk.Block.HashTreeRoot() require.NoError(t, err) @@ -100,7 +100,7 @@ func TestStore_IsFinalized_ForkEdgeCase(t *testing.T) { Epoch: 1, } - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) // A state is required to save checkpoint require.NoError(t, db.SaveState(ctx, st, bytesutil.ToBytes32(checkpoint1.Root))) @@ -151,7 +151,7 @@ func TestStore_IsFinalizedChildBlock(t *testing.T) { Root: root[:], } - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) // a state is required to save checkpoint require.NoError(t, db.SaveState(ctx, st, root)) @@ -188,7 +188,7 @@ func TestStore_IsFinalizedChildBlockAltair(t *testing.T) { Root: root[:], } - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) // a state is required to save checkpoint require.NoError(t, db.SaveState(ctx, st, root)) @@ -219,7 +219,7 @@ func makeBlocks(t *testing.T, i, n uint64, previousRoot [32]byte) []block.Signed for j := i; j < n+i; j++ { parentRoot := make([]byte, 32) copy(parentRoot, previousRoot[:]) - blocks[j-i] = testutil.NewBeaconBlock() + blocks[j-i] = util.NewBeaconBlock() blocks[j-i].Block.Slot = types.Slot(j + 1) blocks[j-i].Block.ParentRoot = parentRoot var err error @@ -236,7 +236,7 @@ func makeBlocksAltair(t *testing.T, startIdx, num uint64, previousRoot [32]byte) for j := startIdx; j < num+startIdx; j++ { parentRoot := make([]byte, 32) copy(parentRoot, previousRoot[:]) - blocks[j-startIdx] = testutil.NewBeaconBlockAltair() + blocks[j-startIdx] = util.NewBeaconBlockAltair() blocks[j-startIdx].Block.Slot = types.Slot(j + 1) blocks[j-startIdx].Block.ParentRoot = parentRoot var err error diff --git a/beacon-chain/db/kv/genesis_test.go b/beacon-chain/db/kv/genesis_test.go index d287e7993..3ab581e22 100644 --- a/beacon-chain/db/kv/genesis_test.go +++ b/beacon-chain/db/kv/genesis_test.go @@ -8,15 +8,15 @@ import ( "github.com/bazelbuild/rules_go/go/tools/bazel" "github.com/prysmaticlabs/prysm/beacon-chain/db/iface" "github.com/prysmaticlabs/prysm/config/params" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestStore_SaveGenesisData(t *testing.T) { ctx := context.Background() db := setupDB(t) - gs, err := testutil.NewBeaconState() + gs, err := util.NewBeaconState() assert.NoError(t, err) assert.NoError(t, db.SaveGenesisData(ctx, gs)) diff --git a/beacon-chain/db/kv/kv_test.go b/beacon-chain/db/kv/kv_test.go index 674ebd39a..768718ce8 100644 --- a/beacon-chain/db/kv/kv_test.go +++ b/beacon-chain/db/kv/kv_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) // setupDB instantiates and returns a Store instance. diff --git a/beacon-chain/db/kv/migration_archived_index_test.go b/beacon-chain/db/kv/migration_archived_index_test.go index ddb705cca..e6b1f290c 100644 --- a/beacon-chain/db/kv/migration_archived_index_test.go +++ b/beacon-chain/db/kv/migration_archived_index_test.go @@ -5,8 +5,8 @@ import ( "testing" "github.com/prysmaticlabs/prysm/encoding/bytesutil" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/util" "go.etcd.io/bbolt" ) @@ -49,7 +49,7 @@ func Test_migrateArchivedIndex(t *testing.T) { if err := tx.Bucket(archivedRootBucket).Put(bytesutil.Uint64ToBytesLittleEndian(2048), []byte("foo")); err != nil { return err } - sb := testutil.NewBeaconBlock() + sb := util.NewBeaconBlock() sb.Block.Slot = 2048 b, err := encode(context.Background(), sb) if err != nil { diff --git a/beacon-chain/db/kv/migration_block_slot_index_test.go b/beacon-chain/db/kv/migration_block_slot_index_test.go index 7d3be71cf..835325758 100644 --- a/beacon-chain/db/kv/migration_block_slot_index_test.go +++ b/beacon-chain/db/kv/migration_block_slot_index_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/prysmaticlabs/prysm/encoding/bytesutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" "go.etcd.io/bbolt" ) diff --git a/beacon-chain/db/kv/migration_state_validators_test.go b/beacon-chain/db/kv/migration_state_validators_test.go index c977fb20f..5368280a3 100644 --- a/beacon-chain/db/kv/migration_state_validators_test.go +++ b/beacon-chain/db/kv/migration_state_validators_test.go @@ -10,9 +10,9 @@ import ( v2 "github.com/prysmaticlabs/prysm/beacon-chain/state/v2" "github.com/prysmaticlabs/prysm/config/features" v1alpha1 "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" "go.etcd.io/bbolt" ) @@ -75,7 +75,7 @@ func Test_migrateStateValidators(t *testing.T) { // create a new state and save it blockRoot := [32]byte{'B'} - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() newValidators := validators(10) assert.NoError(t, err) assert.NoError(t, st.SetSlot(101)) @@ -186,7 +186,7 @@ func Test_migrateStateValidators(t *testing.T) { // add a state with the given validators vals := validators(10) blockRoot := [32]byte{'A'} - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() assert.NoError(t, err) assert.NoError(t, st.SetSlot(100)) assert.NoError(t, st.SetValidators(vals)) @@ -289,7 +289,7 @@ func Test_migrateAltairStateValidators(t *testing.T) { // add a state with the given validators vals := validators(10) blockRoot := [32]byte{'A'} - st, _ := testutil.DeterministicGenesisStateAltair(t, 20) + st, _ := util.DeterministicGenesisStateAltair(t, 20) assert.NoError(t, st.SetSlot(100)) assert.NoError(t, st.SetValidators(vals)) assert.NoError(t, dbStore.SaveState(context.Background(), st, blockRoot)) diff --git a/beacon-chain/db/kv/operations_test.go b/beacon-chain/db/kv/operations_test.go index b41deeab7..cadf37330 100644 --- a/beacon-chain/db/kv/operations_test.go +++ b/beacon-chain/db/kv/operations_test.go @@ -5,8 +5,8 @@ import ( "testing" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" "google.golang.org/protobuf/proto" ) diff --git a/beacon-chain/db/kv/slashings_test.go b/beacon-chain/db/kv/slashings_test.go index 8369ea50d..ab890db78 100644 --- a/beacon-chain/db/kv/slashings_test.go +++ b/beacon-chain/db/kv/slashings_test.go @@ -5,9 +5,9 @@ import ( "testing" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/protobuf/proto" ) @@ -15,12 +15,12 @@ func TestStore_ProposerSlashing_CRUD(t *testing.T) { db := setupDB(t) ctx := context.Background() prop := ðpb.ProposerSlashing{ - Header_1: testutil.HydrateSignedBeaconHeader(ðpb.SignedBeaconBlockHeader{ + Header_1: util.HydrateSignedBeaconHeader(ðpb.SignedBeaconBlockHeader{ Header: ðpb.BeaconBlockHeader{ ProposerIndex: 5, }, }), - Header_2: testutil.HydrateSignedBeaconHeader(ðpb.SignedBeaconBlockHeader{ + Header_2: util.HydrateSignedBeaconHeader(ðpb.SignedBeaconBlockHeader{ Header: ðpb.BeaconBlockHeader{ ProposerIndex: 5, }, @@ -44,11 +44,11 @@ func TestStore_AttesterSlashing_CRUD(t *testing.T) { db := setupDB(t) ctx := context.Background() att := ðpb.AttesterSlashing{ - Attestation_1: testutil.HydrateIndexedAttestation(ðpb.IndexedAttestation{ + Attestation_1: util.HydrateIndexedAttestation(ðpb.IndexedAttestation{ Data: ðpb.AttestationData{ Slot: 5, }}), - Attestation_2: testutil.HydrateIndexedAttestation(ðpb.IndexedAttestation{ + Attestation_2: util.HydrateIndexedAttestation(ðpb.IndexedAttestation{ Data: ðpb.AttestationData{ Slot: 7, }})} diff --git a/beacon-chain/db/kv/state_summary_test.go b/beacon-chain/db/kv/state_summary_test.go index 3721ddafb..4d39e2bfc 100644 --- a/beacon-chain/db/kv/state_summary_test.go +++ b/beacon-chain/db/kv/state_summary_test.go @@ -7,8 +7,8 @@ import ( types "github.com/prysmaticlabs/eth2-types" "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestStateSummary_CanSaveRetrieve(t *testing.T) { diff --git a/beacon-chain/db/kv/state_test.go b/beacon-chain/db/kv/state_test.go index a430ef688..9d351f954 100644 --- a/beacon-chain/db/kv/state_test.go +++ b/beacon-chain/db/kv/state_test.go @@ -16,9 +16,9 @@ import ( v1alpha "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" bolt "go.etcd.io/bbolt" ) @@ -29,7 +29,7 @@ func TestState_CanSaveRetrieve(t *testing.T) { require.Equal(t, false, db.HasState(context.Background(), r)) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, st.SetSlot(100)) @@ -60,7 +60,7 @@ func TestState_CanSaveRetrieveValidatorEntries(t *testing.T) { require.Equal(t, false, db.HasState(context.Background(), r)) stateValidators := validators(10) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, st.SetSlot(100)) require.NoError(t, st.SetValidators(stateValidators)) @@ -113,7 +113,7 @@ func TestStateAltair_CanSaveRetrieveValidatorEntries(t *testing.T) { require.Equal(t, false, db.HasState(context.Background(), r)) stateValidators := validators(10) - st, _ := testutil.DeterministicGenesisStateAltair(t, 20) + st, _ := util.DeterministicGenesisStateAltair(t, 20) require.NoError(t, st.SetSlot(100)) require.NoError(t, st.SetValidators(stateValidators)) @@ -165,7 +165,7 @@ func TestState_CanSaveRetrieveValidatorEntriesFromCache(t *testing.T) { require.Equal(t, false, db.HasState(context.Background(), r)) stateValidators := validators(10) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, st.SetSlot(100)) require.NoError(t, st.SetValidators(stateValidators)) @@ -221,7 +221,7 @@ func TestState_CanSaveRetrieveValidatorEntriesWithoutCache(t *testing.T) { require.Equal(t, false, db.HasState(context.Background(), r)) stateValidators := validators(10) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, st.SetSlot(100)) require.NoError(t, st.SetValidators(stateValidators)) @@ -279,12 +279,12 @@ func TestState_DeleteState(t *testing.T) { // create two states with the same set of validators. stateValidators := validators(10) - st1, err := testutil.NewBeaconState() + st1, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, st1.SetSlot(100)) require.NoError(t, st1.SetValidators(stateValidators)) - st2, err := testutil.NewBeaconState() + st2, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, st2.SetSlot(101)) require.NoError(t, st2.SetValidators(stateValidators)) @@ -347,7 +347,7 @@ func TestGenesisState_CanSaveRetrieve(t *testing.T) { headRoot := [32]byte{'B'} - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, st.SetSlot(1)) require.NoError(t, db.SaveGenesisBlockRoot(context.Background(), headRoot)) @@ -367,12 +367,12 @@ func TestStore_StatesBatchDelete(t *testing.T) { blockRoots := make([][32]byte, 0) evenBlockRoots := make([][32]byte, 0) for i := 0; i < len(totalBlocks); i++ { - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = types.Slot(i) totalBlocks[i] = wrapper.WrappedPhase0SignedBeaconBlock(b) r, err := totalBlocks[i].Block().HashTreeRoot() require.NoError(t, err) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, st.SetSlot(types.Slot(i))) require.NoError(t, db.SaveState(context.Background(), st, r)) @@ -401,7 +401,7 @@ func TestStore_DeleteGenesisState(t *testing.T) { genesisBlockRoot := [32]byte{'A'} require.NoError(t, db.SaveGenesisBlockRoot(ctx, genesisBlockRoot)) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, st.SetSlot(100)) require.NoError(t, db.SaveState(ctx, st, genesisBlockRoot)) @@ -416,7 +416,7 @@ func TestStore_DeleteFinalizedState(t *testing.T) { genesis := bytesutil.ToBytes32([]byte{'G', 'E', 'N', 'E', 'S', 'I', 'S'}) require.NoError(t, db.SaveGenesisBlockRoot(ctx, genesis)) - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.ParentRoot = genesis[:] blk.Block.Slot = 100 @@ -425,7 +425,7 @@ func TestStore_DeleteFinalizedState(t *testing.T) { finalizedBlockRoot, err := blk.Block.HashTreeRoot() require.NoError(t, err) - finalizedState, err := testutil.NewBeaconState() + finalizedState, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, finalizedState.SetSlot(100)) require.NoError(t, db.SaveState(ctx, finalizedState, finalizedBlockRoot)) @@ -442,14 +442,14 @@ func TestStore_DeleteHeadState(t *testing.T) { genesis := bytesutil.ToBytes32([]byte{'G', 'E', 'N', 'E', 'S', 'I', 'S'}) require.NoError(t, db.SaveGenesisBlockRoot(ctx, genesis)) - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.ParentRoot = genesis[:] blk.Block.Slot = 100 require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(blk))) headBlockRoot, err := blk.Block.HashTreeRoot() require.NoError(t, err) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, st.SetSlot(100)) require.NoError(t, db.SaveState(ctx, st, headBlockRoot)) @@ -461,12 +461,12 @@ func TestStore_DeleteHeadState(t *testing.T) { func TestStore_SaveDeleteState_CanGetHighestBelow(t *testing.T) { db := setupDB(t) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = 1 r, err := b.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, db.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(b))) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, st.SetSlot(1)) s0 := st.InnerStateUnsafe() @@ -476,7 +476,7 @@ func TestStore_SaveDeleteState_CanGetHighestBelow(t *testing.T) { r1, err := b.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, db.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(b))) - st, err = testutil.NewBeaconState() + st, err = util.NewBeaconState() require.NoError(t, err) require.NoError(t, st.SetSlot(100)) s1 := st.InnerStateUnsafe() @@ -486,7 +486,7 @@ func TestStore_SaveDeleteState_CanGetHighestBelow(t *testing.T) { r2, err := b.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, db.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(b))) - st, err = testutil.NewBeaconState() + st, err = util.NewBeaconState() require.NoError(t, err) require.NoError(t, st.SetSlot(1000)) s2 := st.InnerStateUnsafe() @@ -509,19 +509,19 @@ func TestStore_SaveDeleteState_CanGetHighestBelow(t *testing.T) { func TestStore_GenesisState_CanGetHighestBelow(t *testing.T) { db := setupDB(t) - genesisState, err := testutil.NewBeaconState() + genesisState, err := util.NewBeaconState() require.NoError(t, err) genesisRoot := [32]byte{'a'} require.NoError(t, db.SaveGenesisBlockRoot(context.Background(), genesisRoot)) require.NoError(t, db.SaveState(context.Background(), genesisState, genesisRoot)) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = 1 r, err := b.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, db.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(b))) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, st.SetSlot(1)) require.NoError(t, db.SaveState(context.Background(), st, r)) @@ -541,7 +541,7 @@ func TestStore_GenesisState_CanGetHighestBelow(t *testing.T) { func TestStore_CleanUpDirtyStates_AboveThreshold(t *testing.T) { db := setupDB(t) - genesisState, err := testutil.NewBeaconState() + genesisState, err := util.NewBeaconState() require.NoError(t, err) genesisRoot := [32]byte{'a'} require.NoError(t, db.SaveGenesisBlockRoot(context.Background(), genesisRoot)) @@ -551,7 +551,7 @@ func TestStore_CleanUpDirtyStates_AboveThreshold(t *testing.T) { slotsPerArchivedPoint := types.Slot(128) prevRoot := genesisRoot for i := types.Slot(1); i <= slotsPerArchivedPoint; i++ { - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = i b.Block.ParentRoot = prevRoot[:] r, err := b.Block.HashTreeRoot() @@ -560,7 +560,7 @@ func TestStore_CleanUpDirtyStates_AboveThreshold(t *testing.T) { bRoots = append(bRoots, r) prevRoot = r - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, st.SetSlot(i)) require.NoError(t, db.SaveState(context.Background(), st, r)) @@ -584,20 +584,20 @@ func TestStore_CleanUpDirtyStates_AboveThreshold(t *testing.T) { func TestStore_CleanUpDirtyStates_Finalized(t *testing.T) { db := setupDB(t) - genesisState, err := testutil.NewBeaconState() + genesisState, err := util.NewBeaconState() require.NoError(t, err) genesisRoot := [32]byte{'a'} require.NoError(t, db.SaveGenesisBlockRoot(context.Background(), genesisRoot)) require.NoError(t, db.SaveState(context.Background(), genesisState, genesisRoot)) for i := types.Slot(1); i <= params.BeaconConfig().SlotsPerEpoch; i++ { - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = i r, err := b.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, db.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(b))) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, st.SetSlot(i)) require.NoError(t, db.SaveState(context.Background(), st, r)) @@ -611,7 +611,7 @@ func TestStore_CleanUpDirtyStates_Finalized(t *testing.T) { func TestStore_CleanUpDirtyStates_DontDeleteNonFinalized(t *testing.T) { db := setupDB(t) - genesisState, err := testutil.NewBeaconState() + genesisState, err := util.NewBeaconState() require.NoError(t, err) genesisRoot := [32]byte{'a'} require.NoError(t, db.SaveGenesisBlockRoot(context.Background(), genesisRoot)) @@ -619,14 +619,14 @@ func TestStore_CleanUpDirtyStates_DontDeleteNonFinalized(t *testing.T) { var unfinalizedRoots [][32]byte for i := types.Slot(1); i <= params.BeaconConfig().SlotsPerEpoch; i++ { - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = i r, err := b.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, db.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(b))) unfinalizedRoots = append(unfinalizedRoots, r) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, st.SetSlot(i)) require.NoError(t, db.SaveState(context.Background(), st, r)) @@ -647,7 +647,7 @@ func TestAltairState_CanSaveRetrieve(t *testing.T) { require.Equal(t, false, db.HasState(context.Background(), r)) - st, _ := testutil.DeterministicGenesisStateAltair(t, 1) + st, _ := util.DeterministicGenesisStateAltair(t, 1) require.NoError(t, st.SetSlot(100)) require.NoError(t, db.SaveState(context.Background(), st, r)) @@ -670,7 +670,7 @@ func TestAltairState_CanDelete(t *testing.T) { require.Equal(t, false, db.HasState(context.Background(), r)) - st, _ := testutil.DeterministicGenesisStateAltair(t, 1) + st, _ := util.DeterministicGenesisStateAltair(t, 1) require.NoError(t, st.SetSlot(100)) require.NoError(t, db.SaveState(context.Background(), st, r)) @@ -713,7 +713,7 @@ func checkStateSaveTime(b *testing.B, saveCount int) { key := make([]byte, 32) _, err := rand.Read(key) require.NoError(b, err) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(b, err) // Add some more new validator to the base validator. @@ -730,7 +730,7 @@ func checkStateSaveTime(b *testing.B, saveCount int) { // create a state to save in benchmark r := [32]byte{'A'} - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(b, err) require.NoError(b, st.SetValidators(initialSetOfValidators)) @@ -749,7 +749,7 @@ func checkStateReadTime(b *testing.B, saveCount int) { // Save a state to read in benchmark r := [32]byte{'A'} - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(b, err) require.NoError(b, st.SetValidators(initialSetOfValidators)) require.NoError(b, db.SaveState(context.Background(), st, r)) @@ -759,7 +759,7 @@ func checkStateReadTime(b *testing.B, saveCount int) { key := make([]byte, 32) _, err := rand.Read(key) require.NoError(b, err) - st, err = testutil.NewBeaconState() + st, err = util.NewBeaconState() require.NoError(b, err) // Add some more new validator to the base validator. diff --git a/beacon-chain/db/kv/utils_test.go b/beacon-chain/db/kv/utils_test.go index c03279aa6..56f62dcd8 100644 --- a/beacon-chain/db/kv/utils_test.go +++ b/beacon-chain/db/kv/utils_test.go @@ -6,8 +6,8 @@ import ( "testing" "github.com/prysmaticlabs/prysm/encoding/bytesutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" bolt "go.etcd.io/bbolt" ) diff --git a/beacon-chain/db/restore_test.go b/beacon-chain/db/restore_test.go index 2707cdf2d..efaa7ce77 100644 --- a/beacon-chain/db/restore_test.go +++ b/beacon-chain/db/restore_test.go @@ -12,9 +12,9 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/db/kv" "github.com/prysmaticlabs/prysm/cmd" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" logTest "github.com/sirupsen/logrus/hooks/test" "github.com/urfave/cli/v2" ) @@ -25,12 +25,12 @@ func TestRestore(t *testing.T) { backupDb, err := kv.NewKVStore(context.Background(), t.TempDir(), &kv.Config{}) require.NoError(t, err) - head := testutil.NewBeaconBlock() + head := util.NewBeaconBlock() head.Block.Slot = 5000 require.NoError(t, backupDb.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(head))) root, err := head.Block.HashTreeRoot() require.NoError(t, err) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, backupDb.SaveState(ctx, st, root)) require.NoError(t, backupDb.SaveHeadBlockRoot(ctx, root)) diff --git a/beacon-chain/db/slasherkv/BUILD.bazel b/beacon-chain/db/slasherkv/BUILD.bazel index 9cb647379..5a3eb5f4c 100644 --- a/beacon-chain/db/slasherkv/BUILD.bazel +++ b/beacon-chain/db/slasherkv/BUILD.bazel @@ -48,8 +48,8 @@ go_test( "//config/params:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/prysm/v1alpha1:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "@com_github_ferranbt_fastssz//:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", diff --git a/beacon-chain/db/slasherkv/kv_test.go b/beacon-chain/db/slasherkv/kv_test.go index 25cdeed8e..7db3e15fd 100644 --- a/beacon-chain/db/slasherkv/kv_test.go +++ b/beacon-chain/db/slasherkv/kv_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) // setupDB instantiates and returns a Store instance. diff --git a/beacon-chain/db/slasherkv/pruning_test.go b/beacon-chain/db/slasherkv/pruning_test.go index ed15e60fe..464cff567 100644 --- a/beacon-chain/db/slasherkv/pruning_test.go +++ b/beacon-chain/db/slasherkv/pruning_test.go @@ -9,7 +9,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core" slashertypes "github.com/prysmaticlabs/prysm/beacon-chain/slasher/types" "github.com/prysmaticlabs/prysm/config/params" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" logTest "github.com/sirupsen/logrus/hooks/test" bolt "go.etcd.io/bbolt" ) diff --git a/beacon-chain/db/slasherkv/slasher_test.go b/beacon-chain/db/slasherkv/slasher_test.go index 9ea6dab4a..b9365cf43 100644 --- a/beacon-chain/db/slasherkv/slasher_test.go +++ b/beacon-chain/db/slasherkv/slasher_test.go @@ -15,8 +15,8 @@ import ( "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" slashpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestStore_AttestationRecordForValidator_SaveRetrieve(t *testing.T) { diff --git a/beacon-chain/forkchoice/protoarray/BUILD.bazel b/beacon-chain/forkchoice/protoarray/BUILD.bazel index afd47bce3..a197780d7 100644 --- a/beacon-chain/forkchoice/protoarray/BUILD.bazel +++ b/beacon-chain/forkchoice/protoarray/BUILD.bazel @@ -41,8 +41,8 @@ go_test( "//config/params:go_default_library", "//crypto/hash:go_default_library", "//encoding/bytesutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", ], ) diff --git a/beacon-chain/forkchoice/protoarray/ffg_update_test.go b/beacon-chain/forkchoice/protoarray/ffg_update_test.go index 43a7f3fa1..c434b4575 100644 --- a/beacon-chain/forkchoice/protoarray/ffg_update_test.go +++ b/beacon-chain/forkchoice/protoarray/ffg_update_test.go @@ -6,8 +6,8 @@ import ( types "github.com/prysmaticlabs/eth2-types" "github.com/prysmaticlabs/prysm/config/params" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestFFGUpdates_OneBranch(t *testing.T) { diff --git a/beacon-chain/forkchoice/protoarray/helpers_test.go b/beacon-chain/forkchoice/protoarray/helpers_test.go index dbff56d0d..fad41ecf9 100644 --- a/beacon-chain/forkchoice/protoarray/helpers_test.go +++ b/beacon-chain/forkchoice/protoarray/helpers_test.go @@ -7,8 +7,8 @@ import ( "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/crypto/hash" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestComputeDelta_ZeroHash(t *testing.T) { diff --git a/beacon-chain/forkchoice/protoarray/no_vote_test.go b/beacon-chain/forkchoice/protoarray/no_vote_test.go index 2ddb3be90..fe7ff69d0 100644 --- a/beacon-chain/forkchoice/protoarray/no_vote_test.go +++ b/beacon-chain/forkchoice/protoarray/no_vote_test.go @@ -5,8 +5,8 @@ import ( "testing" "github.com/prysmaticlabs/prysm/config/params" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestNoVote_CanFindHead(t *testing.T) { diff --git a/beacon-chain/forkchoice/protoarray/node_test.go b/beacon-chain/forkchoice/protoarray/node_test.go index c620c0eec..de29d5a1d 100644 --- a/beacon-chain/forkchoice/protoarray/node_test.go +++ b/beacon-chain/forkchoice/protoarray/node_test.go @@ -4,7 +4,7 @@ import ( "testing" types "github.com/prysmaticlabs/eth2-types" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestNode_Getters(t *testing.T) { diff --git a/beacon-chain/forkchoice/protoarray/store_test.go b/beacon-chain/forkchoice/protoarray/store_test.go index 91977aa34..6053360e2 100644 --- a/beacon-chain/forkchoice/protoarray/store_test.go +++ b/beacon-chain/forkchoice/protoarray/store_test.go @@ -6,8 +6,8 @@ import ( types "github.com/prysmaticlabs/eth2-types" "github.com/prysmaticlabs/prysm/encoding/bytesutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestStore_PruneThreshold(t *testing.T) { diff --git a/beacon-chain/forkchoice/protoarray/vote_test.go b/beacon-chain/forkchoice/protoarray/vote_test.go index 8c8abb23a..a0e65f4f2 100644 --- a/beacon-chain/forkchoice/protoarray/vote_test.go +++ b/beacon-chain/forkchoice/protoarray/vote_test.go @@ -5,8 +5,8 @@ import ( "testing" "github.com/prysmaticlabs/prysm/config/params" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestVotes_CanFindHead(t *testing.T) { diff --git a/beacon-chain/gateway/BUILD.bazel b/beacon-chain/gateway/BUILD.bazel index 1d08e5833..683f744d8 100644 --- a/beacon-chain/gateway/BUILD.bazel +++ b/beacon-chain/gateway/BUILD.bazel @@ -19,7 +19,7 @@ go_test( srcs = ["helpers_test.go"], embed = [":go_default_library"], deps = [ - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", ], ) diff --git a/beacon-chain/gateway/helpers_test.go b/beacon-chain/gateway/helpers_test.go index 9a0b8486d..692673cd3 100644 --- a/beacon-chain/gateway/helpers_test.go +++ b/beacon-chain/gateway/helpers_test.go @@ -3,8 +3,8 @@ package gateway import ( "testing" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestDefaultConfig(t *testing.T) { diff --git a/beacon-chain/node/BUILD.bazel b/beacon-chain/node/BUILD.bazel index 358b735c7..879cd6dfe 100644 --- a/beacon-chain/node/BUILD.bazel +++ b/beacon-chain/node/BUILD.bazel @@ -71,8 +71,8 @@ go_test( "//cmd:go_default_library", "//cmd/beacon-chain/flags:go_default_library", "//config/params:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", "@com_github_sirupsen_logrus//hooks/test:go_default_library", "@com_github_urfave_cli_v2//:go_default_library", diff --git a/beacon-chain/node/config_test.go b/beacon-chain/node/config_test.go index 7e6abb224..b714fc298 100644 --- a/beacon-chain/node/config_test.go +++ b/beacon-chain/node/config_test.go @@ -10,8 +10,8 @@ import ( "github.com/prysmaticlabs/prysm/cmd" "github.com/prysmaticlabs/prysm/cmd/beacon-chain/flags" "github.com/prysmaticlabs/prysm/config/params" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" logTest "github.com/sirupsen/logrus/hooks/test" "github.com/urfave/cli/v2" ) diff --git a/beacon-chain/node/node_test.go b/beacon-chain/node/node_test.go index 5efa9dbfb..dae920684 100644 --- a/beacon-chain/node/node_test.go +++ b/beacon-chain/node/node_test.go @@ -9,7 +9,7 @@ import ( statefeed "github.com/prysmaticlabs/prysm/beacon-chain/core/feed/state" "github.com/prysmaticlabs/prysm/cmd" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" logTest "github.com/sirupsen/logrus/hooks/test" "github.com/urfave/cli/v2" ) diff --git a/beacon-chain/node/registration/BUILD.bazel b/beacon-chain/node/registration/BUILD.bazel index d191505cc..5ce3d4264 100644 --- a/beacon-chain/node/registration/BUILD.bazel +++ b/beacon-chain/node/registration/BUILD.bazel @@ -31,8 +31,8 @@ go_test( "//cmd:go_default_library", "//cmd/beacon-chain/flags:go_default_library", "//config/params:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "@com_github_sirupsen_logrus//hooks/test:go_default_library", "@com_github_urfave_cli_v2//:go_default_library", ], diff --git a/beacon-chain/node/registration/p2p_test.go b/beacon-chain/node/registration/p2p_test.go index e6905a94d..2f42e8a0d 100644 --- a/beacon-chain/node/registration/p2p_test.go +++ b/beacon-chain/node/registration/p2p_test.go @@ -7,8 +7,8 @@ import ( "github.com/prysmaticlabs/prysm/cmd" "github.com/prysmaticlabs/prysm/config/params" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/urfave/cli/v2" ) diff --git a/beacon-chain/node/registration/powchain_test.go b/beacon-chain/node/registration/powchain_test.go index e3ed6f205..3cf7dde9e 100644 --- a/beacon-chain/node/registration/powchain_test.go +++ b/beacon-chain/node/registration/powchain_test.go @@ -6,8 +6,8 @@ import ( "github.com/prysmaticlabs/prysm/cmd/beacon-chain/flags" "github.com/prysmaticlabs/prysm/config/params" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" logTest "github.com/sirupsen/logrus/hooks/test" "github.com/urfave/cli/v2" ) diff --git a/beacon-chain/operations/attestations/BUILD.bazel b/beacon-chain/operations/attestations/BUILD.bazel index 0708dc375..dee73984c 100644 --- a/beacon-chain/operations/attestations/BUILD.bazel +++ b/beacon-chain/operations/attestations/BUILD.bazel @@ -51,9 +51,9 @@ go_test( "//crypto/bls:go_default_library", "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation/aggregation/attestations:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "//time:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", "@org_golang_google_protobuf//proto:go_default_library", diff --git a/beacon-chain/operations/attestations/kv/BUILD.bazel b/beacon-chain/operations/attestations/kv/BUILD.bazel index 5d26a020e..9a912dd58 100644 --- a/beacon-chain/operations/attestations/kv/BUILD.bazel +++ b/beacon-chain/operations/attestations/kv/BUILD.bazel @@ -41,9 +41,9 @@ go_test( deps = [ "//crypto/bls:go_default_library", "//proto/prysm/v1alpha1:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "@com_github_ferranbt_fastssz//:go_default_library", "@com_github_patrickmn_go_cache//:go_default_library", "@com_github_pkg_errors//:go_default_library", diff --git a/beacon-chain/operations/attestations/kv/aggregated_test.go b/beacon-chain/operations/attestations/kv/aggregated_test.go index 88ac33adf..5ff31e4a3 100644 --- a/beacon-chain/operations/attestations/kv/aggregated_test.go +++ b/beacon-chain/operations/attestations/kv/aggregated_test.go @@ -12,9 +12,9 @@ import ( "github.com/prysmaticlabs/go-bitfield" "github.com/prysmaticlabs/prysm/crypto/bls" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestKV_Aggregated_AggregateUnaggregatedAttestations(t *testing.T) { @@ -23,14 +23,14 @@ func TestKV_Aggregated_AggregateUnaggregatedAttestations(t *testing.T) { require.NoError(t, err) sig1 := priv.Sign([]byte{'a'}) sig2 := priv.Sign([]byte{'b'}) - att1 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b1001}, Signature: sig1.Marshal()}) - att2 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b1010}, Signature: sig1.Marshal()}) - att3 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b1100}, Signature: sig1.Marshal()}) - att4 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b1001}, Signature: sig2.Marshal()}) - att5 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2}, AggregationBits: bitfield.Bitlist{0b1001}, Signature: sig1.Marshal()}) - att6 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2}, AggregationBits: bitfield.Bitlist{0b1010}, Signature: sig1.Marshal()}) - att7 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2}, AggregationBits: bitfield.Bitlist{0b1100}, Signature: sig1.Marshal()}) - att8 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2}, AggregationBits: bitfield.Bitlist{0b1001}, Signature: sig2.Marshal()}) + att1 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b1001}, Signature: sig1.Marshal()}) + att2 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b1010}, Signature: sig1.Marshal()}) + att3 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b1100}, Signature: sig1.Marshal()}) + att4 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b1001}, Signature: sig2.Marshal()}) + att5 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2}, AggregationBits: bitfield.Bitlist{0b1001}, Signature: sig1.Marshal()}) + att6 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2}, AggregationBits: bitfield.Bitlist{0b1010}, Signature: sig1.Marshal()}) + att7 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2}, AggregationBits: bitfield.Bitlist{0b1100}, Signature: sig1.Marshal()}) + att8 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2}, AggregationBits: bitfield.Bitlist{0b1001}, Signature: sig2.Marshal()}) atts := []*ethpb.Attestation{att1, att2, att3, att4, att5, att6, att7, att8} require.NoError(t, cache.SaveUnaggregatedAttestations(atts)) require.NoError(t, cache.AggregateUnaggregatedAttestations(context.Background())) @@ -42,7 +42,7 @@ func TestKV_Aggregated_AggregateUnaggregatedAttestations(t *testing.T) { func TestKV_Aggregated_AggregateUnaggregatedAttestationsBySlotIndex(t *testing.T) { cache := NewAttCaches() genData := func(slot types.Slot, committeeIndex types.CommitteeIndex) *ethpb.AttestationData { - return testutil.HydrateAttestationData(ðpb.AttestationData{ + return util.HydrateAttestationData(ðpb.AttestationData{ Slot: slot, CommitteeIndex: committeeIndex, }) @@ -113,14 +113,14 @@ func TestKV_Aggregated_SaveAggregatedAttestation(t *testing.T) { }, { name: "not aggregated", - att: testutil.HydrateAttestation(ðpb.Attestation{ + att: util.HydrateAttestation(ðpb.Attestation{ Data: ðpb.AttestationData{}, AggregationBits: bitfield.Bitlist{0b10100}}), wantErrString: "attestation is not aggregated", }, { name: "invalid hash", att: ðpb.Attestation{ - Data: testutil.HydrateAttestationData(ðpb.AttestationData{ + Data: util.HydrateAttestationData(ðpb.AttestationData{ BeaconBlockRoot: []byte{0b0}, }), AggregationBits: bitfield.Bitlist{0b10111}, @@ -129,7 +129,7 @@ func TestKV_Aggregated_SaveAggregatedAttestation(t *testing.T) { }, { name: "already seen", - att: testutil.HydrateAttestation(ðpb.Attestation{ + att: util.HydrateAttestation(ðpb.Attestation{ Data: ðpb.AttestationData{ Slot: 100, }, @@ -139,7 +139,7 @@ func TestKV_Aggregated_SaveAggregatedAttestation(t *testing.T) { }, { name: "normal save", - att: testutil.HydrateAttestation(ðpb.Attestation{ + att: util.HydrateAttestation(ðpb.Attestation{ Data: ðpb.AttestationData{ Slot: 1, }, @@ -148,7 +148,7 @@ func TestKV_Aggregated_SaveAggregatedAttestation(t *testing.T) { count: 1, }, } - r, err := hashFn(testutil.HydrateAttestationData(ðpb.AttestationData{ + r, err := hashFn(util.HydrateAttestationData(ðpb.AttestationData{ Slot: 100, })) require.NoError(t, err) @@ -181,9 +181,9 @@ func TestKV_Aggregated_SaveAggregatedAttestations(t *testing.T) { { name: "no duplicates", atts: []*ethpb.Attestation{ - testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, + util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b1101}}), - testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, + util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b1101}}), }, count: 1, @@ -216,9 +216,9 @@ func TestKV_Aggregated_SaveAggregatedAttestations_SomeGoodSomeBad(t *testing.T) { name: "the first attestation is bad", atts: []*ethpb.Attestation{ - testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, + util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b1100}}), - testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, + util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b1101}}), }, count: 1, @@ -244,9 +244,9 @@ func TestKV_Aggregated_SaveAggregatedAttestations_SomeGoodSomeBad(t *testing.T) func TestKV_Aggregated_AggregatedAttestations(t *testing.T) { cache := NewAttCaches() - att1 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b1101}}) - att2 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2}, AggregationBits: bitfield.Bitlist{0b1101}}) - att3 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 3}, AggregationBits: bitfield.Bitlist{0b1101}}) + att1 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b1101}}) + att2 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2}, AggregationBits: bitfield.Bitlist{0b1101}}) + att3 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 3}, AggregationBits: bitfield.Bitlist{0b1101}}) atts := []*ethpb.Attestation{att1, att2, att3} for _, att := range atts { @@ -264,13 +264,13 @@ func TestKV_Aggregated_DeleteAggregatedAttestation(t *testing.T) { t.Run("nil attestation", func(t *testing.T) { cache := NewAttCaches() assert.ErrorContains(t, "attestation can't be nil", cache.DeleteAggregatedAttestation(nil)) - att := testutil.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b10101}, Data: ðpb.AttestationData{Slot: 2}}) + att := util.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b10101}, Data: ðpb.AttestationData{Slot: 2}}) assert.NoError(t, cache.DeleteAggregatedAttestation(att)) }) t.Run("non aggregated attestation", func(t *testing.T) { cache := NewAttCaches() - att := testutil.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b1001}, Data: ðpb.AttestationData{Slot: 2}}) + att := util.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b1001}, Data: ðpb.AttestationData{Slot: 2}}) err := cache.DeleteAggregatedAttestation(att) assert.ErrorContains(t, "attestation is not aggregated", err) }) @@ -292,16 +292,16 @@ func TestKV_Aggregated_DeleteAggregatedAttestation(t *testing.T) { t.Run("nonexistent attestation", func(t *testing.T) { cache := NewAttCaches() - att := testutil.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b1111}, Data: ðpb.AttestationData{Slot: 2}}) + att := util.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b1111}, Data: ðpb.AttestationData{Slot: 2}}) assert.NoError(t, cache.DeleteAggregatedAttestation(att)) }) t.Run("non-filtered deletion", func(t *testing.T) { cache := NewAttCaches() - att1 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b11010}}) - att2 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2}, AggregationBits: bitfield.Bitlist{0b11010}}) - att3 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 3}, AggregationBits: bitfield.Bitlist{0b11010}}) - att4 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 3}, AggregationBits: bitfield.Bitlist{0b10101}}) + att1 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b11010}}) + att2 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2}, AggregationBits: bitfield.Bitlist{0b11010}}) + att3 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 3}, AggregationBits: bitfield.Bitlist{0b11010}}) + att4 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 3}, AggregationBits: bitfield.Bitlist{0b10101}}) atts := []*ethpb.Attestation{att1, att2, att3, att4} require.NoError(t, cache.SaveAggregatedAttestations(atts)) require.NoError(t, cache.DeleteAggregatedAttestation(att1)) @@ -314,10 +314,10 @@ func TestKV_Aggregated_DeleteAggregatedAttestation(t *testing.T) { t.Run("filtered deletion", func(t *testing.T) { cache := NewAttCaches() - att1 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b110101}}) - att2 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2}, AggregationBits: bitfield.Bitlist{0b110111}}) - att3 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2}, AggregationBits: bitfield.Bitlist{0b110100}}) - att4 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2}, AggregationBits: bitfield.Bitlist{0b110101}}) + att1 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b110101}}) + att2 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2}, AggregationBits: bitfield.Bitlist{0b110111}}) + att3 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2}, AggregationBits: bitfield.Bitlist{0b110100}}) + att4 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2}, AggregationBits: bitfield.Bitlist{0b110101}}) atts := []*ethpb.Attestation{att1, att2, att3, att4} require.NoError(t, cache.SaveAggregatedAttestations(atts)) @@ -357,7 +357,7 @@ func TestKV_Aggregated_HasAggregatedAttestation(t *testing.T) { }, { name: "empty cache aggregated", - input: testutil.HydrateAttestation(ðpb.Attestation{ + input: util.HydrateAttestation(ðpb.Attestation{ Data: ðpb.AttestationData{ Slot: 1, }, @@ -366,7 +366,7 @@ func TestKV_Aggregated_HasAggregatedAttestation(t *testing.T) { }, { name: "empty cache unaggregated", - input: testutil.HydrateAttestation(ðpb.Attestation{ + input: util.HydrateAttestation(ðpb.Attestation{ Data: ðpb.AttestationData{ Slot: 1, }, @@ -376,13 +376,13 @@ func TestKV_Aggregated_HasAggregatedAttestation(t *testing.T) { { name: "single attestation in cache with exact match", existing: []*ethpb.Attestation{{ - Data: testutil.HydrateAttestationData(ðpb.AttestationData{ + Data: util.HydrateAttestationData(ðpb.AttestationData{ Slot: 1, }), AggregationBits: bitfield.Bitlist{0b1111}}, }, input: ðpb.Attestation{ - Data: testutil.HydrateAttestationData(ðpb.AttestationData{ + Data: util.HydrateAttestationData(ðpb.AttestationData{ Slot: 1, }), AggregationBits: bitfield.Bitlist{0b1111}}, @@ -391,13 +391,13 @@ func TestKV_Aggregated_HasAggregatedAttestation(t *testing.T) { { name: "single attestation in cache with subset aggregation", existing: []*ethpb.Attestation{{ - Data: testutil.HydrateAttestationData(ðpb.AttestationData{ + Data: util.HydrateAttestationData(ðpb.AttestationData{ Slot: 1, }), AggregationBits: bitfield.Bitlist{0b1111}}, }, input: ðpb.Attestation{ - Data: testutil.HydrateAttestationData(ðpb.AttestationData{ + Data: util.HydrateAttestationData(ðpb.AttestationData{ Slot: 1, }), AggregationBits: bitfield.Bitlist{0b1110}}, @@ -406,13 +406,13 @@ func TestKV_Aggregated_HasAggregatedAttestation(t *testing.T) { { name: "single attestation in cache with superset aggregation", existing: []*ethpb.Attestation{{ - Data: testutil.HydrateAttestationData(ðpb.AttestationData{ + Data: util.HydrateAttestationData(ðpb.AttestationData{ Slot: 1, }), AggregationBits: bitfield.Bitlist{0b1110}}, }, input: ðpb.Attestation{ - Data: testutil.HydrateAttestationData(ðpb.AttestationData{ + Data: util.HydrateAttestationData(ðpb.AttestationData{ Slot: 1, }), AggregationBits: bitfield.Bitlist{0b1111}}, @@ -422,20 +422,20 @@ func TestKV_Aggregated_HasAggregatedAttestation(t *testing.T) { name: "multiple attestations with same data in cache with overlapping aggregation, input is subset", existing: []*ethpb.Attestation{ { - Data: testutil.HydrateAttestationData(ðpb.AttestationData{ + Data: util.HydrateAttestationData(ðpb.AttestationData{ Slot: 1, }), AggregationBits: bitfield.Bitlist{0b1111000}, }, { - Data: testutil.HydrateAttestationData(ðpb.AttestationData{ + Data: util.HydrateAttestationData(ðpb.AttestationData{ Slot: 1, }), AggregationBits: bitfield.Bitlist{0b1100111}, }, }, input: ðpb.Attestation{ - Data: testutil.HydrateAttestationData(ðpb.AttestationData{ + Data: util.HydrateAttestationData(ðpb.AttestationData{ Slot: 1, }), AggregationBits: bitfield.Bitlist{0b1100000}}, @@ -445,20 +445,20 @@ func TestKV_Aggregated_HasAggregatedAttestation(t *testing.T) { name: "multiple attestations with same data in cache with overlapping aggregation and input is superset", existing: []*ethpb.Attestation{ { - Data: testutil.HydrateAttestationData(ðpb.AttestationData{ + Data: util.HydrateAttestationData(ðpb.AttestationData{ Slot: 1, }), AggregationBits: bitfield.Bitlist{0b1111000}, }, { - Data: testutil.HydrateAttestationData(ðpb.AttestationData{ + Data: util.HydrateAttestationData(ðpb.AttestationData{ Slot: 1, }), AggregationBits: bitfield.Bitlist{0b1100111}, }, }, input: ðpb.Attestation{ - Data: testutil.HydrateAttestationData(ðpb.AttestationData{ + Data: util.HydrateAttestationData(ðpb.AttestationData{ Slot: 1, }), AggregationBits: bitfield.Bitlist{0b1111111}}, @@ -468,20 +468,20 @@ func TestKV_Aggregated_HasAggregatedAttestation(t *testing.T) { name: "multiple attestations with different data in cache", existing: []*ethpb.Attestation{ { - Data: testutil.HydrateAttestationData(ðpb.AttestationData{ + Data: util.HydrateAttestationData(ðpb.AttestationData{ Slot: 2, }), AggregationBits: bitfield.Bitlist{0b1111000}, }, { - Data: testutil.HydrateAttestationData(ðpb.AttestationData{ + Data: util.HydrateAttestationData(ðpb.AttestationData{ Slot: 3, }), AggregationBits: bitfield.Bitlist{0b1100111}, }, }, input: ðpb.Attestation{ - Data: testutil.HydrateAttestationData(ðpb.AttestationData{ + Data: util.HydrateAttestationData(ðpb.AttestationData{ Slot: 1, }), AggregationBits: bitfield.Bitlist{0b1111111}}, @@ -491,14 +491,14 @@ func TestKV_Aggregated_HasAggregatedAttestation(t *testing.T) { name: "attestations with different bitlist lengths", existing: []*ethpb.Attestation{ { - Data: testutil.HydrateAttestationData(ðpb.AttestationData{ + Data: util.HydrateAttestationData(ðpb.AttestationData{ Slot: 2, }), AggregationBits: bitfield.Bitlist{0b1111000}, }, }, input: ðpb.Attestation{ - Data: testutil.HydrateAttestationData(ðpb.AttestationData{ + Data: util.HydrateAttestationData(ðpb.AttestationData{ Slot: 2, }), AggregationBits: bitfield.Bitlist{0b1111}, @@ -540,8 +540,8 @@ func TestKV_Aggregated_HasAggregatedAttestation(t *testing.T) { func TestKV_Aggregated_DuplicateAggregatedAttestations(t *testing.T) { cache := NewAttCaches() - att1 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b1101}}) - att2 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b1111}}) + att1 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b1101}}) + att2 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b1111}}) atts := []*ethpb.Attestation{att1, att2} for _, att := range atts { diff --git a/beacon-chain/operations/attestations/kv/benchmark_test.go b/beacon-chain/operations/attestations/kv/benchmark_test.go index fabedfdf5..5c1141f96 100644 --- a/beacon-chain/operations/attestations/kv/benchmark_test.go +++ b/beacon-chain/operations/attestations/kv/benchmark_test.go @@ -5,7 +5,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/operations/attestations/kv" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" ) func BenchmarkAttCaches(b *testing.B) { diff --git a/beacon-chain/operations/attestations/kv/block_test.go b/beacon-chain/operations/attestations/kv/block_test.go index ee3397e6b..c19700296 100644 --- a/beacon-chain/operations/attestations/kv/block_test.go +++ b/beacon-chain/operations/attestations/kv/block_test.go @@ -6,24 +6,24 @@ import ( "github.com/prysmaticlabs/go-bitfield" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestKV_BlockAttestation_CanSaveRetrieve(t *testing.T) { cache := NewAttCaches() - att1 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b1101}}) - att2 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2}, AggregationBits: bitfield.Bitlist{0b1101}}) - att3 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 3}, AggregationBits: bitfield.Bitlist{0b1101}}) + att1 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b1101}}) + att2 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2}, AggregationBits: bitfield.Bitlist{0b1101}}) + att3 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 3}, AggregationBits: bitfield.Bitlist{0b1101}}) atts := []*ethpb.Attestation{att1, att2, att3} for _, att := range atts { require.NoError(t, cache.SaveBlockAttestation(att)) } // Diff bit length should not panic. - att4 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 3}, AggregationBits: bitfield.Bitlist{0b11011}}) + att4 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 3}, AggregationBits: bitfield.Bitlist{0b11011}}) if err := cache.SaveBlockAttestation(att4); err != bitfield.ErrBitlistDifferentLength { t.Errorf("Unexpected error: wanted %v, got %v", bitfield.ErrBitlistDifferentLength, err) } @@ -40,9 +40,9 @@ func TestKV_BlockAttestation_CanSaveRetrieve(t *testing.T) { func TestKV_BlockAttestation_CanDelete(t *testing.T) { cache := NewAttCaches() - att1 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b1101}}) - att2 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2}, AggregationBits: bitfield.Bitlist{0b1101}}) - att3 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 3}, AggregationBits: bitfield.Bitlist{0b1101}}) + att1 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b1101}}) + att2 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2}, AggregationBits: bitfield.Bitlist{0b1101}}) + att3 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 3}, AggregationBits: bitfield.Bitlist{0b1101}}) atts := []*ethpb.Attestation{att1, att2, att3} for _, att := range atts { diff --git a/beacon-chain/operations/attestations/kv/forkchoice_test.go b/beacon-chain/operations/attestations/kv/forkchoice_test.go index 5797610aa..610ce3420 100644 --- a/beacon-chain/operations/attestations/kv/forkchoice_test.go +++ b/beacon-chain/operations/attestations/kv/forkchoice_test.go @@ -6,17 +6,17 @@ import ( "github.com/prysmaticlabs/go-bitfield" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestKV_Forkchoice_CanSaveRetrieve(t *testing.T) { cache := NewAttCaches() - att1 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b1101}}) - att2 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2}, AggregationBits: bitfield.Bitlist{0b1101}}) - att3 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 3}, AggregationBits: bitfield.Bitlist{0b1101}}) + att1 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b1101}}) + att2 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2}, AggregationBits: bitfield.Bitlist{0b1101}}) + att3 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 3}, AggregationBits: bitfield.Bitlist{0b1101}}) atts := []*ethpb.Attestation{att1, att2, att3} for _, att := range atts { @@ -35,9 +35,9 @@ func TestKV_Forkchoice_CanSaveRetrieve(t *testing.T) { func TestKV_Forkchoice_CanDelete(t *testing.T) { cache := NewAttCaches() - att1 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b1101}}) - att2 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2}, AggregationBits: bitfield.Bitlist{0b1101}}) - att3 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 3}, AggregationBits: bitfield.Bitlist{0b1101}}) + att1 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b1101}}) + att2 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2}, AggregationBits: bitfield.Bitlist{0b1101}}) + att3 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 3}, AggregationBits: bitfield.Bitlist{0b1101}}) atts := []*ethpb.Attestation{att1, att2, att3} for _, att := range atts { @@ -55,9 +55,9 @@ func TestKV_Forkchoice_CanDelete(t *testing.T) { func TestKV_Forkchoice_CanCount(t *testing.T) { cache := NewAttCaches() - att1 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b1101}}) - att2 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2}, AggregationBits: bitfield.Bitlist{0b1101}}) - att3 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 3}, AggregationBits: bitfield.Bitlist{0b1101}}) + att1 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b1101}}) + att2 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2}, AggregationBits: bitfield.Bitlist{0b1101}}) + att3 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 3}, AggregationBits: bitfield.Bitlist{0b1101}}) atts := []*ethpb.Attestation{att1, att2, att3} for _, att := range atts { diff --git a/beacon-chain/operations/attestations/kv/seen_bits_test.go b/beacon-chain/operations/attestations/kv/seen_bits_test.go index 5848ae745..b81492e1a 100644 --- a/beacon-chain/operations/attestations/kv/seen_bits_test.go +++ b/beacon-chain/operations/attestations/kv/seen_bits_test.go @@ -5,27 +5,27 @@ import ( "github.com/prysmaticlabs/go-bitfield" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestAttCaches_hasSeenBit(t *testing.T) { c := NewAttCaches() - seenA1 := testutil.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b10000011}}) - seenA2 := testutil.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b11100000}}) + seenA1 := util.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b10000011}}) + seenA2 := util.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b11100000}}) require.NoError(t, c.insertSeenBit(seenA1)) require.NoError(t, c.insertSeenBit(seenA2)) tests := []struct { att *ethpb.Attestation want bool }{ - {att: testutil.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b10000000}}), want: true}, - {att: testutil.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b10000001}}), want: true}, - {att: testutil.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b11100000}}), want: true}, - {att: testutil.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b10000011}}), want: true}, - {att: testutil.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b10001000}}), want: false}, - {att: testutil.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b11110111}}), want: false}, + {att: util.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b10000000}}), want: true}, + {att: util.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b10000001}}), want: true}, + {att: util.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b11100000}}), want: true}, + {att: util.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b10000011}}), want: true}, + {att: util.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b10001000}}), want: false}, + {att: util.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b11110111}}), want: false}, } for _, tt := range tests { got, err := c.hasSeenBit(tt.att) @@ -38,7 +38,7 @@ func TestAttCaches_hasSeenBit(t *testing.T) { func TestAttCaches_insertSeenBitDuplicates(t *testing.T) { c := NewAttCaches() - att1 := testutil.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b10000011}}) + att1 := util.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b10000011}}) r, err := hashFn(att1.Data) require.NoError(t, err) require.NoError(t, c.insertSeenBit(att1)) diff --git a/beacon-chain/operations/attestations/kv/unaggregated_test.go b/beacon-chain/operations/attestations/kv/unaggregated_test.go index 066ebd029..cacbc7c27 100644 --- a/beacon-chain/operations/attestations/kv/unaggregated_test.go +++ b/beacon-chain/operations/attestations/kv/unaggregated_test.go @@ -10,9 +10,9 @@ import ( c "github.com/patrickmn/go-cache" "github.com/prysmaticlabs/go-bitfield" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestKV_Unaggregated_SaveUnaggregatedAttestation(t *testing.T) { @@ -42,12 +42,12 @@ func TestKV_Unaggregated_SaveUnaggregatedAttestation(t *testing.T) { }, { name: "normal save", - att: testutil.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b0001}}), + att: util.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b0001}}), count: 1, }, { name: "already seen", - att: testutil.HydrateAttestation(ðpb.Attestation{ + att: util.HydrateAttestation(ðpb.Attestation{ Data: ðpb.AttestationData{ Slot: 100, }, @@ -56,7 +56,7 @@ func TestKV_Unaggregated_SaveUnaggregatedAttestation(t *testing.T) { count: 0, }, } - r, err := hashFn(testutil.HydrateAttestationData(ðpb.AttestationData{Slot: 100})) + r, err := hashFn(util.HydrateAttestationData(ðpb.AttestationData{Slot: 100})) require.NoError(t, err) for _, tt := range tests { @@ -91,18 +91,18 @@ func TestKV_Unaggregated_SaveUnaggregatedAttestations(t *testing.T) { { name: "unaggregated only", atts: []*ethpb.Attestation{ - testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}}), - testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2}}), - testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 3}}), + util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}}), + util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2}}), + util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 3}}), }, count: 3, }, { name: "has aggregated", atts: []*ethpb.Attestation{ - testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}}), + util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}}), {AggregationBits: bitfield.Bitlist{0b1111}, Data: ðpb.AttestationData{Slot: 2}}, - testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 3}}), + util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 3}}), }, wantErrString: "attestation is aggregated", count: 1, @@ -141,9 +141,9 @@ func TestKV_Unaggregated_DeleteUnaggregatedAttestation(t *testing.T) { t.Run("successful deletion", func(t *testing.T) { cache := NewAttCaches() - att1 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b101}}) - att2 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2}, AggregationBits: bitfield.Bitlist{0b110}}) - att3 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 3}, AggregationBits: bitfield.Bitlist{0b110}}) + att1 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b101}}) + att2 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2}, AggregationBits: bitfield.Bitlist{0b110}}) + att3 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 3}, AggregationBits: bitfield.Bitlist{0b110}}) atts := []*ethpb.Attestation{att1, att2, att3} require.NoError(t, cache.SaveUnaggregatedAttestations(atts)) for _, att := range atts { @@ -156,7 +156,7 @@ func TestKV_Unaggregated_DeleteUnaggregatedAttestation(t *testing.T) { } func TestKV_Unaggregated_DeleteSeenUnaggregatedAttestations(t *testing.T) { - d := testutil.HydrateAttestationData(ðpb.AttestationData{}) + d := util.HydrateAttestationData(ðpb.AttestationData{}) t.Run("no attestations", func(t *testing.T) { cache := NewAttCaches() @@ -168,9 +168,9 @@ func TestKV_Unaggregated_DeleteSeenUnaggregatedAttestations(t *testing.T) { t.Run("none seen", func(t *testing.T) { cache := NewAttCaches() atts := []*ethpb.Attestation{ - testutil.HydrateAttestation(ðpb.Attestation{Data: d, AggregationBits: bitfield.Bitlist{0b1001}}), - testutil.HydrateAttestation(ðpb.Attestation{Data: d, AggregationBits: bitfield.Bitlist{0b1010}}), - testutil.HydrateAttestation(ðpb.Attestation{Data: d, AggregationBits: bitfield.Bitlist{0b1100}}), + util.HydrateAttestation(ðpb.Attestation{Data: d, AggregationBits: bitfield.Bitlist{0b1001}}), + util.HydrateAttestation(ðpb.Attestation{Data: d, AggregationBits: bitfield.Bitlist{0b1010}}), + util.HydrateAttestation(ðpb.Attestation{Data: d, AggregationBits: bitfield.Bitlist{0b1100}}), } require.NoError(t, cache.SaveUnaggregatedAttestations(atts)) assert.Equal(t, 3, cache.UnaggregatedAttestationCount()) @@ -185,9 +185,9 @@ func TestKV_Unaggregated_DeleteSeenUnaggregatedAttestations(t *testing.T) { t.Run("some seen", func(t *testing.T) { cache := NewAttCaches() atts := []*ethpb.Attestation{ - testutil.HydrateAttestation(ðpb.Attestation{Data: d, AggregationBits: bitfield.Bitlist{0b1001}}), - testutil.HydrateAttestation(ðpb.Attestation{Data: d, AggregationBits: bitfield.Bitlist{0b1010}}), - testutil.HydrateAttestation(ðpb.Attestation{Data: d, AggregationBits: bitfield.Bitlist{0b1100}}), + util.HydrateAttestation(ðpb.Attestation{Data: d, AggregationBits: bitfield.Bitlist{0b1001}}), + util.HydrateAttestation(ðpb.Attestation{Data: d, AggregationBits: bitfield.Bitlist{0b1010}}), + util.HydrateAttestation(ðpb.Attestation{Data: d, AggregationBits: bitfield.Bitlist{0b1100}}), } require.NoError(t, cache.SaveUnaggregatedAttestations(atts)) assert.Equal(t, 3, cache.UnaggregatedAttestationCount()) @@ -210,9 +210,9 @@ func TestKV_Unaggregated_DeleteSeenUnaggregatedAttestations(t *testing.T) { t.Run("all seen", func(t *testing.T) { cache := NewAttCaches() atts := []*ethpb.Attestation{ - testutil.HydrateAttestation(ðpb.Attestation{Data: d, AggregationBits: bitfield.Bitlist{0b1001}}), - testutil.HydrateAttestation(ðpb.Attestation{Data: d, AggregationBits: bitfield.Bitlist{0b1010}}), - testutil.HydrateAttestation(ðpb.Attestation{Data: d, AggregationBits: bitfield.Bitlist{0b1100}}), + util.HydrateAttestation(ðpb.Attestation{Data: d, AggregationBits: bitfield.Bitlist{0b1001}}), + util.HydrateAttestation(ðpb.Attestation{Data: d, AggregationBits: bitfield.Bitlist{0b1010}}), + util.HydrateAttestation(ðpb.Attestation{Data: d, AggregationBits: bitfield.Bitlist{0b1100}}), } require.NoError(t, cache.SaveUnaggregatedAttestations(atts)) assert.Equal(t, 3, cache.UnaggregatedAttestationCount()) @@ -235,9 +235,9 @@ func TestKV_Unaggregated_DeleteSeenUnaggregatedAttestations(t *testing.T) { func TestKV_Unaggregated_UnaggregatedAttestationsBySlotIndex(t *testing.T) { cache := NewAttCaches() - att1 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1, CommitteeIndex: 1}, AggregationBits: bitfield.Bitlist{0b101}}) - att2 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1, CommitteeIndex: 2}, AggregationBits: bitfield.Bitlist{0b110}}) - att3 := testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2, CommitteeIndex: 1}, AggregationBits: bitfield.Bitlist{0b110}}) + att1 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1, CommitteeIndex: 1}, AggregationBits: bitfield.Bitlist{0b101}}) + att2 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1, CommitteeIndex: 2}, AggregationBits: bitfield.Bitlist{0b110}}) + att3 := util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2, CommitteeIndex: 1}, AggregationBits: bitfield.Bitlist{0b110}}) atts := []*ethpb.Attestation{att1, att2, att3} for _, att := range atts { diff --git a/beacon-chain/operations/attestations/prepare_forkchoice_test.go b/beacon-chain/operations/attestations/prepare_forkchoice_test.go index 0d330734e..295538c50 100644 --- a/beacon-chain/operations/attestations/prepare_forkchoice_test.go +++ b/beacon-chain/operations/attestations/prepare_forkchoice_test.go @@ -10,9 +10,9 @@ import ( "github.com/prysmaticlabs/prysm/crypto/bls" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" attaggregation "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/attestation/aggregation/attestations" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/protobuf/proto" ) @@ -234,7 +234,7 @@ func TestSeenAttestations_PresentInCache(t *testing.T) { s, err := NewService(context.Background(), &Config{Pool: NewPool()}) require.NoError(t, err) - ad1 := testutil.HydrateAttestationData(ðpb.AttestationData{}) + ad1 := util.HydrateAttestationData(ðpb.AttestationData{}) att1 := ðpb.Attestation{Data: ad1, Signature: []byte{'A'}, AggregationBits: bitfield.Bitlist{0x13} /* 0b00010011 */} got, err := s.seen(att1) require.NoError(t, err) @@ -252,9 +252,9 @@ func TestSeenAttestations_PresentInCache(t *testing.T) { } func TestService_seen(t *testing.T) { - ad1 := testutil.HydrateAttestationData(ðpb.AttestationData{Slot: 1}) + ad1 := util.HydrateAttestationData(ðpb.AttestationData{Slot: 1}) - ad2 := testutil.HydrateAttestationData(ðpb.AttestationData{Slot: 2}) + ad2 := util.HydrateAttestationData(ðpb.AttestationData{Slot: 2}) // Attestation are checked in order of this list. tests := []struct { diff --git a/beacon-chain/operations/attestations/prune_expired_test.go b/beacon-chain/operations/attestations/prune_expired_test.go index 7ea261732..5b2db876c 100644 --- a/beacon-chain/operations/attestations/prune_expired_test.go +++ b/beacon-chain/operations/attestations/prune_expired_test.go @@ -9,9 +9,9 @@ import ( "github.com/prysmaticlabs/prysm/async" "github.com/prysmaticlabs/prysm/config/params" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" prysmTime "github.com/prysmaticlabs/prysm/time" ) @@ -25,9 +25,9 @@ func TestPruneExpired_Ticker(t *testing.T) { }) require.NoError(t, err) - ad1 := testutil.HydrateAttestationData(ðpb.AttestationData{}) + ad1 := util.HydrateAttestationData(ðpb.AttestationData{}) - ad2 := testutil.HydrateAttestationData(ðpb.AttestationData{Slot: 1}) + ad2 := util.HydrateAttestationData(ðpb.AttestationData{Slot: 1}) atts := []*ethpb.Attestation{ {Data: ad1, AggregationBits: bitfield.Bitlist{0b1000, 0b1}, Signature: make([]byte, 96)}, @@ -84,9 +84,9 @@ func TestPruneExpired_PruneExpiredAtts(t *testing.T) { s, err := NewService(context.Background(), &Config{Pool: NewPool()}) require.NoError(t, err) - ad1 := testutil.HydrateAttestationData(ðpb.AttestationData{}) + ad1 := util.HydrateAttestationData(ðpb.AttestationData{}) - ad2 := testutil.HydrateAttestationData(ðpb.AttestationData{}) + ad2 := util.HydrateAttestationData(ðpb.AttestationData{}) att1 := ðpb.Attestation{Data: ad1, AggregationBits: bitfield.Bitlist{0b1101}} att2 := ðpb.Attestation{Data: ad1, AggregationBits: bitfield.Bitlist{0b1111}} diff --git a/beacon-chain/operations/attestations/service_test.go b/beacon-chain/operations/attestations/service_test.go index 6064b882b..15a78ff24 100644 --- a/beacon-chain/operations/attestations/service_test.go +++ b/beacon-chain/operations/attestations/service_test.go @@ -5,8 +5,8 @@ import ( "errors" "testing" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestStop_OK(t *testing.T) { diff --git a/beacon-chain/operations/slashings/BUILD.bazel b/beacon-chain/operations/slashings/BUILD.bazel index 821185287..7cd8076c9 100644 --- a/beacon-chain/operations/slashings/BUILD.bazel +++ b/beacon-chain/operations/slashings/BUILD.bazel @@ -47,9 +47,9 @@ go_test( "//config/params:go_default_library", "//crypto/bls:go_default_library", "//proto/prysm/v1alpha1:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", ], ) diff --git a/beacon-chain/operations/slashings/service_attester_test.go b/beacon-chain/operations/slashings/service_attester_test.go index 035846f59..410f88328 100644 --- a/beacon-chain/operations/slashings/service_attester_test.go +++ b/beacon-chain/operations/slashings/service_attester_test.go @@ -9,15 +9,15 @@ import ( "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/crypto/bls" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func validAttesterSlashingForValIdx(t *testing.T, beaconState state.BeaconState, privs []bls.SecretKey, valIdx ...uint64) *ethpb.AttesterSlashing { var slashings []*ethpb.AttesterSlashing for _, idx := range valIdx { - slashing, err := testutil.GenerateAttesterSlashingForValidator(beaconState, privs[idx], types.ValidatorIndex(idx)) + slashing, err := util.GenerateAttesterSlashingForValidator(beaconState, privs[idx], types.ValidatorIndex(idx)) require.NoError(t, err) slashings = append(slashings, slashing) } @@ -74,11 +74,11 @@ func TestPool_InsertAttesterSlashing(t *testing.T) { slashings []*ethpb.AttesterSlashing } - beaconState, privKeys := testutil.DeterministicGenesisState(t, 64) + beaconState, privKeys := util.DeterministicGenesisState(t, 64) pendingSlashings := make([]*PendingAttesterSlashing, 20) slashings := make([]*ethpb.AttesterSlashing, 20) for i := 0; i < len(pendingSlashings); i++ { - sl, err := testutil.GenerateAttesterSlashingForValidator(beaconState, privKeys[i], types.ValidatorIndex(i)) + sl, err := util.GenerateAttesterSlashingForValidator(beaconState, privKeys[i], types.ValidatorIndex(i)) require.NoError(t, err) pendingSlashings[i] = &PendingAttesterSlashing{ attesterSlashing: sl, @@ -299,11 +299,11 @@ func TestPool_InsertAttesterSlashing_SigFailsVerify_ClearPool(t *testing.T) { conf := params.BeaconConfig() conf.MaxAttesterSlashings = 2 params.OverrideBeaconConfig(conf) - beaconState, privKeys := testutil.DeterministicGenesisState(t, 64) + beaconState, privKeys := util.DeterministicGenesisState(t, 64) pendingSlashings := make([]*PendingAttesterSlashing, 2) slashings := make([]*ethpb.AttesterSlashing, 2) for i := 0; i < 2; i++ { - sl, err := testutil.GenerateAttesterSlashingForValidator(beaconState, privKeys[i], types.ValidatorIndex(i)) + sl, err := util.GenerateAttesterSlashingForValidator(beaconState, privKeys[i], types.ValidatorIndex(i)) require.NoError(t, err) pendingSlashings[i] = &PendingAttesterSlashing{ attesterSlashing: sl, @@ -453,11 +453,11 @@ func TestPool_PendingAttesterSlashings(t *testing.T) { all bool } params.SetupTestConfigCleanup(t) - beaconState, privKeys := testutil.DeterministicGenesisState(t, 64) + beaconState, privKeys := util.DeterministicGenesisState(t, 64) pendingSlashings := make([]*PendingAttesterSlashing, 20) slashings := make([]*ethpb.AttesterSlashing, 20) for i := 0; i < len(pendingSlashings); i++ { - sl, err := testutil.GenerateAttesterSlashingForValidator(beaconState, privKeys[i], types.ValidatorIndex(i)) + sl, err := util.GenerateAttesterSlashingForValidator(beaconState, privKeys[i], types.ValidatorIndex(i)) require.NoError(t, err) pendingSlashings[i] = &PendingAttesterSlashing{ attesterSlashing: sl, @@ -519,7 +519,7 @@ func TestPool_PendingAttesterSlashings_Slashed(t *testing.T) { conf := params.BeaconConfig() conf.MaxAttesterSlashings = 2 params.OverrideBeaconConfig(conf) - beaconState, privKeys := testutil.DeterministicGenesisState(t, 64) + beaconState, privKeys := util.DeterministicGenesisState(t, 64) val, err := beaconState.ValidatorAtIndex(0) require.NoError(t, err) val.Slashed = true @@ -532,7 +532,7 @@ func TestPool_PendingAttesterSlashings_Slashed(t *testing.T) { pendingSlashings2 := make([]*PendingAttesterSlashing, 20) slashings := make([]*ethpb.AttesterSlashing, 20) for i := 0; i < len(pendingSlashings); i++ { - sl, err := testutil.GenerateAttesterSlashingForValidator(beaconState, privKeys[i], types.ValidatorIndex(i)) + sl, err := util.GenerateAttesterSlashingForValidator(beaconState, privKeys[i], types.ValidatorIndex(i)) require.NoError(t, err) pendingSlashings[i] = &PendingAttesterSlashing{ attesterSlashing: sl, @@ -586,11 +586,11 @@ func TestPool_PendingAttesterSlashings_NoDuplicates(t *testing.T) { conf := params.BeaconConfig() conf.MaxAttesterSlashings = 2 params.OverrideBeaconConfig(conf) - beaconState, privKeys := testutil.DeterministicGenesisState(t, 64) + beaconState, privKeys := util.DeterministicGenesisState(t, 64) pendingSlashings := make([]*PendingAttesterSlashing, 3) slashings := make([]*ethpb.AttesterSlashing, 3) for i := 0; i < 2; i++ { - sl, err := testutil.GenerateAttesterSlashingForValidator(beaconState, privKeys[i], types.ValidatorIndex(i)) + sl, err := util.GenerateAttesterSlashingForValidator(beaconState, privKeys[i], types.ValidatorIndex(i)) require.NoError(t, err) pendingSlashings[i] = &PendingAttesterSlashing{ attesterSlashing: sl, diff --git a/beacon-chain/operations/slashings/service_proposer_test.go b/beacon-chain/operations/slashings/service_proposer_test.go index dea48f40c..50d9f163b 100644 --- a/beacon-chain/operations/slashings/service_proposer_test.go +++ b/beacon-chain/operations/slashings/service_proposer_test.go @@ -7,9 +7,9 @@ import ( types "github.com/prysmaticlabs/eth2-types" "github.com/prysmaticlabs/prysm/config/params" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func proposerSlashingForValIdx(valIdx types.ValidatorIndex) *ethpb.ProposerSlashing { @@ -33,10 +33,10 @@ func TestPool_InsertProposerSlashing(t *testing.T) { slashings []*ethpb.ProposerSlashing } - beaconState, privKeys := testutil.DeterministicGenesisState(t, 64) + beaconState, privKeys := util.DeterministicGenesisState(t, 64) slashings := make([]*ethpb.ProposerSlashing, 20) for i := 0; i < len(slashings); i++ { - sl, err := testutil.GenerateProposerSlashingForValidator(beaconState, privKeys[i], types.ValidatorIndex(i)) + sl, err := util.GenerateProposerSlashingForValidator(beaconState, privKeys[i], types.ValidatorIndex(i)) require.NoError(t, err) slashings[i] = sl } @@ -183,10 +183,10 @@ func TestPool_InsertProposerSlashing_SigFailsVerify_ClearPool(t *testing.T) { conf := params.BeaconConfig() conf.MaxAttesterSlashings = 2 params.OverrideBeaconConfig(conf) - beaconState, privKeys := testutil.DeterministicGenesisState(t, 64) + beaconState, privKeys := util.DeterministicGenesisState(t, 64) slashings := make([]*ethpb.ProposerSlashing, 2) for i := 0; i < 2; i++ { - sl, err := testutil.GenerateProposerSlashingForValidator(beaconState, privKeys[i], types.ValidatorIndex(i)) + sl, err := util.GenerateProposerSlashingForValidator(beaconState, privKeys[i], types.ValidatorIndex(i)) require.NoError(t, err) slashings[i] = sl } @@ -326,10 +326,10 @@ func TestPool_PendingProposerSlashings(t *testing.T) { pending []*ethpb.ProposerSlashing noLimit bool } - beaconState, privKeys := testutil.DeterministicGenesisState(t, 64) + beaconState, privKeys := util.DeterministicGenesisState(t, 64) slashings := make([]*ethpb.ProposerSlashing, 20) for i := 0; i < len(slashings); i++ { - sl, err := testutil.GenerateProposerSlashingForValidator(beaconState, privKeys[i], types.ValidatorIndex(i)) + sl, err := util.GenerateProposerSlashingForValidator(beaconState, privKeys[i], types.ValidatorIndex(i)) require.NoError(t, err) slashings[i] = sl } @@ -383,7 +383,7 @@ func TestPool_PendingProposerSlashings_Slashed(t *testing.T) { all bool pending []*ethpb.ProposerSlashing } - beaconState, privKeys := testutil.DeterministicGenesisState(t, 64) + beaconState, privKeys := util.DeterministicGenesisState(t, 64) val, err := beaconState.ValidatorAtIndex(0) require.NoError(t, err) val.Slashed = true @@ -396,7 +396,7 @@ func TestPool_PendingProposerSlashings_Slashed(t *testing.T) { slashings2 := make([]*ethpb.ProposerSlashing, 32) result := make([]*ethpb.ProposerSlashing, 32) for i := 0; i < len(slashings); i++ { - sl, err := testutil.GenerateProposerSlashingForValidator(beaconState, privKeys[i], types.ValidatorIndex(i)) + sl, err := util.GenerateProposerSlashingForValidator(beaconState, privKeys[i], types.ValidatorIndex(i)) require.NoError(t, err) slashings[i] = sl slashings2[i] = sl diff --git a/beacon-chain/operations/slashings/service_test.go b/beacon-chain/operations/slashings/service_test.go index 2dff1ed13..ae0b8852a 100644 --- a/beacon-chain/operations/slashings/service_test.go +++ b/beacon-chain/operations/slashings/service_test.go @@ -3,7 +3,7 @@ package slashings import ( "testing" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestPool_validatorSlashingPreconditionCheck_requiresLock(t *testing.T) { diff --git a/beacon-chain/operations/synccommittee/BUILD.bazel b/beacon-chain/operations/synccommittee/BUILD.bazel index 6f83481ba..09d2e9529 100644 --- a/beacon-chain/operations/synccommittee/BUILD.bazel +++ b/beacon-chain/operations/synccommittee/BUILD.bazel @@ -31,6 +31,6 @@ go_test( embed = [":go_default_library"], deps = [ "//proto/prysm/v1alpha1:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/require:go_default_library", ], ) diff --git a/beacon-chain/operations/synccommittee/contribution_test.go b/beacon-chain/operations/synccommittee/contribution_test.go index 60901bca6..124ca8577 100644 --- a/beacon-chain/operations/synccommittee/contribution_test.go +++ b/beacon-chain/operations/synccommittee/contribution_test.go @@ -4,7 +4,7 @@ import ( "testing" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestSyncCommitteeContributionCache_Nil(t *testing.T) { diff --git a/beacon-chain/operations/synccommittee/message_test.go b/beacon-chain/operations/synccommittee/message_test.go index 9a108432d..c892a8ec0 100644 --- a/beacon-chain/operations/synccommittee/message_test.go +++ b/beacon-chain/operations/synccommittee/message_test.go @@ -4,7 +4,7 @@ import ( "testing" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestSyncCommitteeSignatureCache_Nil(t *testing.T) { diff --git a/beacon-chain/operations/voluntaryexits/BUILD.bazel b/beacon-chain/operations/voluntaryexits/BUILD.bazel index 087441a2e..d1619bdb7 100644 --- a/beacon-chain/operations/voluntaryexits/BUILD.bazel +++ b/beacon-chain/operations/voluntaryexits/BUILD.bazel @@ -31,7 +31,7 @@ go_test( "//beacon-chain/state/v1:go_default_library", "//config/params:go_default_library", "//proto/prysm/v1alpha1:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/require:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", "@org_golang_google_protobuf//proto:go_default_library", ], diff --git a/beacon-chain/operations/voluntaryexits/service_test.go b/beacon-chain/operations/voluntaryexits/service_test.go index d2bed397f..8c64f2ee6 100644 --- a/beacon-chain/operations/voluntaryexits/service_test.go +++ b/beacon-chain/operations/voluntaryexits/service_test.go @@ -9,7 +9,7 @@ import ( v1 "github.com/prysmaticlabs/prysm/beacon-chain/state/v1" "github.com/prysmaticlabs/prysm/config/params" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "google.golang.org/protobuf/proto" ) diff --git a/beacon-chain/p2p/BUILD.bazel b/beacon-chain/p2p/BUILD.bazel index 79c2075a9..5514c9b88 100644 --- a/beacon-chain/p2p/BUILD.bazel +++ b/beacon-chain/p2p/BUILD.bazel @@ -153,9 +153,9 @@ go_test( "//proto/prysm/v1alpha1/wrapper:go_default_library", "//proto/testing:go_default_library", "//runtime/version:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "//time:go_default_library", "@com_github_ethereum_go_ethereum//crypto:go_default_library", "@com_github_ethereum_go_ethereum//p2p/discover:go_default_library", diff --git a/beacon-chain/p2p/addr_factory_test.go b/beacon-chain/p2p/addr_factory_test.go index fa16d3b8f..3984879d1 100644 --- a/beacon-chain/p2p/addr_factory_test.go +++ b/beacon-chain/p2p/addr_factory_test.go @@ -4,8 +4,8 @@ import ( "testing" ma "github.com/multiformats/go-multiaddr" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestRelayAddrs_OnlyFactory(t *testing.T) { diff --git a/beacon-chain/p2p/broadcaster_test.go b/beacon-chain/p2p/broadcaster_test.go index 45207a755..3cced728d 100644 --- a/beacon-chain/p2p/broadcaster_test.go +++ b/beacon-chain/p2p/broadcaster_test.go @@ -23,9 +23,9 @@ import ( pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" testpb "github.com/prysmaticlabs/prysm/proto/testing" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/protobuf/proto" ) @@ -86,7 +86,7 @@ func TestService_Broadcast(t *testing.T) { // Broadcast to peers and wait. require.NoError(t, p.Broadcast(context.Background(), msg)) - if testutil.WaitTimeout(&wg, 1*time.Second) { + if util.WaitTimeout(&wg, 1*time.Second) { t.Error("Failed to receive pubsub within 1s") } } @@ -164,7 +164,7 @@ func TestService_BroadcastAttestation(t *testing.T) { }), } - msg := testutil.HydrateAttestation(ð.Attestation{AggregationBits: bitfield.NewBitlist(7)}) + msg := util.HydrateAttestation(ð.Attestation{AggregationBits: bitfield.NewBitlist(7)}) subnet := uint64(5) topic := AttestationSubnetTopicFormat @@ -200,7 +200,7 @@ func TestService_BroadcastAttestation(t *testing.T) { // Broadcast to peers and wait. require.NoError(t, p.BroadcastAttestation(context.Background(), subnet, msg)) - if testutil.WaitTimeout(&wg, 1*time.Second) { + if util.WaitTimeout(&wg, 1*time.Second) { t.Error("Failed to receive pubsub within 1s") } } @@ -323,7 +323,7 @@ func TestService_BroadcastAttestationWithDiscoveryAttempts(t *testing.T) { }), } - msg := testutil.HydrateAttestation(ð.Attestation{AggregationBits: bitfield.NewBitlist(7)}) + msg := util.HydrateAttestation(ð.Attestation{AggregationBits: bitfield.NewBitlist(7)}) topic := AttestationSubnetTopicFormat GossipTypeMapping[reflect.TypeOf(msg)] = topic digest, err := p.currentForkDigest() @@ -361,7 +361,7 @@ func TestService_BroadcastAttestationWithDiscoveryAttempts(t *testing.T) { // Broadcast to peers and wait. require.NoError(t, p.BroadcastAttestation(context.Background(), subnet, msg)) - if testutil.WaitTimeout(&wg, 4*time.Second) { + if util.WaitTimeout(&wg, 4*time.Second) { t.Error("Failed to receive pubsub within 4s") } } @@ -388,7 +388,7 @@ func TestService_BroadcastSyncCommittee(t *testing.T) { }), } - msg := testutil.HydrateSyncCommittee(&pb.SyncCommitteeMessage{}) + msg := util.HydrateSyncCommittee(&pb.SyncCommitteeMessage{}) subnet := uint64(5) topic := SyncCommitteeSubnetTopicFormat @@ -424,7 +424,7 @@ func TestService_BroadcastSyncCommittee(t *testing.T) { // Broadcast to peers and wait. require.NoError(t, p.BroadcastSyncCommitteeMessage(context.Background(), subnet, msg)) - if testutil.WaitTimeout(&wg, 1*time.Second) { + if util.WaitTimeout(&wg, 1*time.Second) { t.Error("Failed to receive pubsub within 1s") } } diff --git a/beacon-chain/p2p/connection_gater_test.go b/beacon-chain/p2p/connection_gater_test.go index 2fbe2e968..984f74ff8 100644 --- a/beacon-chain/p2p/connection_gater_test.go +++ b/beacon-chain/p2p/connection_gater_test.go @@ -14,8 +14,8 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/p2p/peers/scorers" mockp2p "github.com/prysmaticlabs/prysm/beacon-chain/p2p/testing" ethpb "github.com/prysmaticlabs/prysm/proto/eth/v1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestPeer_AtMaxLimit(t *testing.T) { diff --git a/beacon-chain/p2p/dial_relay_node_test.go b/beacon-chain/p2p/dial_relay_node_test.go index 96e7ace98..a798a00c5 100644 --- a/beacon-chain/p2p/dial_relay_node_test.go +++ b/beacon-chain/p2p/dial_relay_node_test.go @@ -7,8 +7,8 @@ import ( bh "github.com/libp2p/go-libp2p-blankhost" swarmt "github.com/libp2p/go-libp2p-swarm/testing" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestMakePeer_InvalidMultiaddress(t *testing.T) { diff --git a/beacon-chain/p2p/discovery_test.go b/beacon-chain/p2p/discovery_test.go index 331418ba6..d944de48c 100644 --- a/beacon-chain/p2p/discovery_test.go +++ b/beacon-chain/p2p/discovery_test.go @@ -36,8 +36,8 @@ import ( pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" "github.com/prysmaticlabs/prysm/runtime/version" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" logTest "github.com/sirupsen/logrus/hooks/test" ) diff --git a/beacon-chain/p2p/encoder/BUILD.bazel b/beacon-chain/p2p/encoder/BUILD.bazel index 244d1accb..a62343ae9 100644 --- a/beacon-chain/p2p/encoder/BUILD.bazel +++ b/beacon-chain/p2p/encoder/BUILD.bazel @@ -33,9 +33,9 @@ go_test( deps = [ "//config/params:go_default_library", "//proto/prysm/v1alpha1:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "@com_github_gogo_protobuf//proto:go_default_library", "@com_github_golang_snappy//:go_default_library", "@org_golang_google_protobuf//proto:go_default_library", diff --git a/beacon-chain/p2p/encoder/snappy_test.go b/beacon-chain/p2p/encoder/snappy_test.go index 1d6ee51ad..0ede68ff9 100644 --- a/beacon-chain/p2p/encoder/snappy_test.go +++ b/beacon-chain/p2p/encoder/snappy_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/golang/snappy" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" ) func TestSszNetworkEncoder_BufferedReader(t *testing.T) { diff --git a/beacon-chain/p2p/encoder/ssz_test.go b/beacon-chain/p2p/encoder/ssz_test.go index 891b7dd4b..2b7f38bdc 100644 --- a/beacon-chain/p2p/encoder/ssz_test.go +++ b/beacon-chain/p2p/encoder/ssz_test.go @@ -12,9 +12,9 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/p2p/encoder" "github.com/prysmaticlabs/prysm/config/params" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/protobuf/proto" ) @@ -107,7 +107,7 @@ func TestSszNetworkEncoder_DecodeWithMaxLength(t *testing.T) { func TestSszNetworkEncoder_DecodeWithMultipleFrames(t *testing.T) { buf := new(bytes.Buffer) - st, _ := testutil.DeterministicGenesisState(t, 100) + st, _ := util.DeterministicGenesisState(t, 100) e := &encoder.SszNetworkEncoder{} params.SetupTestConfigCleanup(t) c := params.BeaconNetworkConfig() diff --git a/beacon-chain/p2p/encoder/varint_test.go b/beacon-chain/p2p/encoder/varint_test.go index 3b45bf1f2..20f12c602 100644 --- a/beacon-chain/p2p/encoder/varint_test.go +++ b/beacon-chain/p2p/encoder/varint_test.go @@ -5,8 +5,8 @@ import ( "testing" "github.com/gogo/protobuf/proto" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestReadVarint(t *testing.T) { diff --git a/beacon-chain/p2p/fork_test.go b/beacon-chain/p2p/fork_test.go index 869bef7fd..def1f733e 100644 --- a/beacon-chain/p2p/fork_test.go +++ b/beacon-chain/p2p/fork_test.go @@ -20,8 +20,8 @@ import ( "github.com/prysmaticlabs/prysm/encoding/bytesutil" "github.com/prysmaticlabs/prysm/network/forks" pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/sirupsen/logrus" logTest "github.com/sirupsen/logrus/hooks/test" ) diff --git a/beacon-chain/p2p/gossip_scoring_params_test.go b/beacon-chain/p2p/gossip_scoring_params_test.go index afa8d7c0c..5a0a56a7e 100644 --- a/beacon-chain/p2p/gossip_scoring_params_test.go +++ b/beacon-chain/p2p/gossip_scoring_params_test.go @@ -8,9 +8,9 @@ import ( dbutil "github.com/prysmaticlabs/prysm/beacon-chain/db/testing" "github.com/prysmaticlabs/prysm/config/params" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestCorrect_ActiveValidatorsCount(t *testing.T) { @@ -25,7 +25,7 @@ func TestCorrect_ActiveValidatorsCount(t *testing.T) { ctx: context.Background(), cfg: &Config{DB: db}, } - bState, err := testutil.NewBeaconState(func(state *ethpb.BeaconState) error { + bState, err := util.NewBeaconState(func(state *ethpb.BeaconState) error { validators := make([]*ethpb.Validator, params.BeaconConfig().MinGenesisActiveValidatorCount) for i := 0; i < len(validators); i++ { validators[i] = ðpb.Validator{ diff --git a/beacon-chain/p2p/gossip_topic_mappings_test.go b/beacon-chain/p2p/gossip_topic_mappings_test.go index 630f2e340..285676e8f 100644 --- a/beacon-chain/p2p/gossip_topic_mappings_test.go +++ b/beacon-chain/p2p/gossip_topic_mappings_test.go @@ -8,7 +8,7 @@ import ( "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" ) func TestMappingHasNoDuplicates(t *testing.T) { diff --git a/beacon-chain/p2p/message_id_test.go b/beacon-chain/p2p/message_id_test.go index ac183c7d3..d10db5e4a 100644 --- a/beacon-chain/p2p/message_id_test.go +++ b/beacon-chain/p2p/message_id_test.go @@ -13,7 +13,7 @@ import ( "github.com/prysmaticlabs/prysm/crypto/hash" "github.com/prysmaticlabs/prysm/encoding/bytesutil" "github.com/prysmaticlabs/prysm/network/forks" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" ) func TestMsgID_HashesCorrectly(t *testing.T) { diff --git a/beacon-chain/p2p/options_test.go b/beacon-chain/p2p/options_test.go index 9e46a6dfd..558ee50c8 100644 --- a/beacon-chain/p2p/options_test.go +++ b/beacon-chain/p2p/options_test.go @@ -12,8 +12,8 @@ import ( "github.com/ethereum/go-ethereum/p2p/enr" "github.com/libp2p/go-libp2p-core/crypto" "github.com/prysmaticlabs/prysm/config/params" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestPrivateKeyLoading(t *testing.T) { diff --git a/beacon-chain/p2p/parameter_test.go b/beacon-chain/p2p/parameter_test.go index e3735642f..c4c4ecc2e 100644 --- a/beacon-chain/p2p/parameter_test.go +++ b/beacon-chain/p2p/parameter_test.go @@ -4,7 +4,7 @@ import ( "testing" pubsub "github.com/libp2p/go-libp2p-pubsub" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" ) func TestOverlayParameters(t *testing.T) { diff --git a/beacon-chain/p2p/peers/BUILD.bazel b/beacon-chain/p2p/peers/BUILD.bazel index c55b50c0a..7d5f899d3 100644 --- a/beacon-chain/p2p/peers/BUILD.bazel +++ b/beacon-chain/p2p/peers/BUILD.bazel @@ -41,8 +41,8 @@ go_test( "//proto/eth/v1:go_default_library", "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/wrapper:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "@com_github_ethereum_go_ethereum//p2p/enr:go_default_library", "@com_github_libp2p_go_libp2p_core//network:go_default_library", "@com_github_libp2p_go_libp2p_core//peer:go_default_library", diff --git a/beacon-chain/p2p/peers/peerdata/BUILD.bazel b/beacon-chain/p2p/peers/peerdata/BUILD.bazel index 3c43d6cd3..1cbda5ca7 100644 --- a/beacon-chain/p2p/peers/peerdata/BUILD.bazel +++ b/beacon-chain/p2p/peers/peerdata/BUILD.bazel @@ -20,8 +20,8 @@ go_test( srcs = ["store_test.go"], deps = [ ":go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "@com_github_libp2p_go_libp2p_core//peer:go_default_library", ], ) diff --git a/beacon-chain/p2p/peers/peerdata/store_test.go b/beacon-chain/p2p/peers/peerdata/store_test.go index fb032c5ad..8972bd5cd 100644 --- a/beacon-chain/p2p/peers/peerdata/store_test.go +++ b/beacon-chain/p2p/peers/peerdata/store_test.go @@ -6,8 +6,8 @@ import ( "github.com/libp2p/go-libp2p-core/peer" "github.com/prysmaticlabs/prysm/beacon-chain/p2p/peers/peerdata" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestStore_GetSetDelete(t *testing.T) { diff --git a/beacon-chain/p2p/peers/scorers/BUILD.bazel b/beacon-chain/p2p/peers/scorers/BUILD.bazel index 72f93e218..d839df1f0 100644 --- a/beacon-chain/p2p/peers/scorers/BUILD.bazel +++ b/beacon-chain/p2p/peers/scorers/BUILD.bazel @@ -43,8 +43,8 @@ go_test( "//config/features:go_default_library", "//crypto/rand:go_default_library", "//proto/prysm/v1alpha1:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "//time:go_default_library", "@com_github_libp2p_go_libp2p_core//network:go_default_library", "@com_github_libp2p_go_libp2p_core//peer:go_default_library", diff --git a/beacon-chain/p2p/peers/scorers/bad_responses_test.go b/beacon-chain/p2p/peers/scorers/bad_responses_test.go index bd0998dc7..a8a413ae5 100644 --- a/beacon-chain/p2p/peers/scorers/bad_responses_test.go +++ b/beacon-chain/p2p/peers/scorers/bad_responses_test.go @@ -10,8 +10,8 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/p2p/peers" "github.com/prysmaticlabs/prysm/beacon-chain/p2p/peers/peerdata" "github.com/prysmaticlabs/prysm/beacon-chain/p2p/peers/scorers" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestScorers_BadResponses_Score(t *testing.T) { diff --git a/beacon-chain/p2p/peers/scorers/block_providers_test.go b/beacon-chain/p2p/peers/scorers/block_providers_test.go index fcf3213d8..27ef73ffd 100644 --- a/beacon-chain/p2p/peers/scorers/block_providers_test.go +++ b/beacon-chain/p2p/peers/scorers/block_providers_test.go @@ -13,7 +13,7 @@ import ( "github.com/prysmaticlabs/prysm/cmd/beacon-chain/flags" "github.com/prysmaticlabs/prysm/config/features" "github.com/prysmaticlabs/prysm/crypto/rand" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" "github.com/prysmaticlabs/prysm/time" ) diff --git a/beacon-chain/p2p/peers/scorers/gossip_scorer_test.go b/beacon-chain/p2p/peers/scorers/gossip_scorer_test.go index ad2113d67..c908b8bf0 100644 --- a/beacon-chain/p2p/peers/scorers/gossip_scorer_test.go +++ b/beacon-chain/p2p/peers/scorers/gossip_scorer_test.go @@ -7,7 +7,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/p2p/peers" "github.com/prysmaticlabs/prysm/beacon-chain/p2p/peers/scorers" pbrpc "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" ) func TestScorers_Gossip_Score(t *testing.T) { diff --git a/beacon-chain/p2p/peers/scorers/peer_status_test.go b/beacon-chain/p2p/peers/scorers/peer_status_test.go index 4b4cab915..581965951 100644 --- a/beacon-chain/p2p/peers/scorers/peer_status_test.go +++ b/beacon-chain/p2p/peers/scorers/peer_status_test.go @@ -11,8 +11,8 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/p2p/peers/scorers" p2ptypes "github.com/prysmaticlabs/prysm/beacon-chain/p2p/types" pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestScorers_PeerStatus_Score(t *testing.T) { diff --git a/beacon-chain/p2p/peers/scorers/service_test.go b/beacon-chain/p2p/peers/scorers/service_test.go index 206826a8c..9504a93ad 100644 --- a/beacon-chain/p2p/peers/scorers/service_test.go +++ b/beacon-chain/p2p/peers/scorers/service_test.go @@ -10,7 +10,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/p2p/peers" "github.com/prysmaticlabs/prysm/beacon-chain/p2p/peers/scorers" "github.com/prysmaticlabs/prysm/cmd/beacon-chain/flags" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" ) func TestScorers_Service_Init(t *testing.T) { diff --git a/beacon-chain/p2p/peers/status_test.go b/beacon-chain/p2p/peers/status_test.go index b6d079fdb..2a7d206de 100644 --- a/beacon-chain/p2p/peers/status_test.go +++ b/beacon-chain/p2p/peers/status_test.go @@ -20,8 +20,8 @@ import ( ethpb "github.com/prysmaticlabs/prysm/proto/eth/v1" pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestStatus(t *testing.T) { diff --git a/beacon-chain/p2p/pubsub_filter_test.go b/beacon-chain/p2p/pubsub_filter_test.go index ff901fa3c..1052b7d7e 100644 --- a/beacon-chain/p2p/pubsub_filter_test.go +++ b/beacon-chain/p2p/pubsub_filter_test.go @@ -15,7 +15,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/p2p/encoder" "github.com/prysmaticlabs/prysm/encoding/bytesutil" "github.com/prysmaticlabs/prysm/network/forks" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" prysmTime "github.com/prysmaticlabs/prysm/time" "github.com/stretchr/testify/require" ) diff --git a/beacon-chain/p2p/pubsub_test.go b/beacon-chain/p2p/pubsub_test.go index 85a4e258e..5b6809d3e 100644 --- a/beacon-chain/p2p/pubsub_test.go +++ b/beacon-chain/p2p/pubsub_test.go @@ -11,8 +11,8 @@ import ( mock "github.com/prysmaticlabs/prysm/beacon-chain/blockchain/testing" "github.com/prysmaticlabs/prysm/beacon-chain/p2p/encoder" testp2p "github.com/prysmaticlabs/prysm/beacon-chain/p2p/testing" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestService_PublishToTopicConcurrentMapWrite(t *testing.T) { diff --git a/beacon-chain/p2p/rpc_topic_mappings_test.go b/beacon-chain/p2p/rpc_topic_mappings_test.go index ba1529e03..9af3040f5 100644 --- a/beacon-chain/p2p/rpc_topic_mappings_test.go +++ b/beacon-chain/p2p/rpc_topic_mappings_test.go @@ -10,8 +10,8 @@ import ( "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/encoding/bytesutil" pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestVerifyRPCMappings(t *testing.T) { diff --git a/beacon-chain/p2p/sender_test.go b/beacon-chain/p2p/sender_test.go index 7ec394d32..1b47fc9ba 100644 --- a/beacon-chain/p2p/sender_test.go +++ b/beacon-chain/p2p/sender_test.go @@ -7,12 +7,12 @@ import ( "time" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" + "github.com/prysmaticlabs/prysm/testing/util" "github.com/libp2p/go-libp2p-core/network" testp2p "github.com/prysmaticlabs/prysm/beacon-chain/p2p/testing" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" "google.golang.org/protobuf/proto" ) @@ -52,7 +52,7 @@ func TestService_Send(t *testing.T) { stream, err := svc.Send(context.Background(), msg, "/testing/1", p2.BHost.ID()) require.NoError(t, err) - testutil.WaitTimeout(&wg, 1*time.Second) + util.WaitTimeout(&wg, 1*time.Second) rcvd := ðpb.Fork{} require.NoError(t, svc.Encoding().DecodeWithMaxLength(stream, rcvd)) diff --git a/beacon-chain/p2p/service_test.go b/beacon-chain/p2p/service_test.go index 0f0e2c495..963651e87 100644 --- a/beacon-chain/p2p/service_test.go +++ b/beacon-chain/p2p/service_test.go @@ -24,8 +24,8 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/p2p/peers/scorers" "github.com/prysmaticlabs/prysm/encoding/bytesutil" "github.com/prysmaticlabs/prysm/network/forks" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" prysmTime "github.com/prysmaticlabs/prysm/time" logTest "github.com/sirupsen/logrus/hooks/test" ) diff --git a/beacon-chain/p2p/subnets_test.go b/beacon-chain/p2p/subnets_test.go index 5e165ae3d..d2c4659d1 100644 --- a/beacon-chain/p2p/subnets_test.go +++ b/beacon-chain/p2p/subnets_test.go @@ -19,8 +19,8 @@ import ( "github.com/prysmaticlabs/prysm/cmd/beacon-chain/flags" pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestStartDiscV5_DiscoverPeersWithSubnets(t *testing.T) { diff --git a/beacon-chain/p2p/types/BUILD.bazel b/beacon-chain/p2p/types/BUILD.bazel index 17db3c5b4..5e36a2d61 100644 --- a/beacon-chain/p2p/types/BUILD.bazel +++ b/beacon-chain/p2p/types/BUILD.bazel @@ -11,8 +11,8 @@ go_library( importpath = "github.com/prysmaticlabs/prysm/beacon-chain/p2p/types", visibility = [ "//beacon-chain:__subpackages__", - "//shared/testutil:__pkg__", "//slasher/rpc:__pkg__", + "//testing/util:__pkg__", "//validator/client:__pkg__", ], deps = [ @@ -39,7 +39,7 @@ go_test( deps = [ "//config/params:go_default_library", "//encoding/bytesutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", ], ) diff --git a/beacon-chain/p2p/types/object_mapping_test.go b/beacon-chain/p2p/types/object_mapping_test.go index f18c0c35e..67db23160 100644 --- a/beacon-chain/p2p/types/object_mapping_test.go +++ b/beacon-chain/p2p/types/object_mapping_test.go @@ -5,7 +5,7 @@ import ( "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/encoding/bytesutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" ) func TestInitializeDataMaps(t *testing.T) { diff --git a/beacon-chain/p2p/types/types_test.go b/beacon-chain/p2p/types/types_test.go index e07cb2f5d..11a8fb283 100644 --- a/beacon-chain/p2p/types/types_test.go +++ b/beacon-chain/p2p/types/types_test.go @@ -5,8 +5,8 @@ import ( "testing" "github.com/prysmaticlabs/prysm/config/params" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestBeaconBlockByRootsReq_Limit(t *testing.T) { diff --git a/beacon-chain/p2p/utils_test.go b/beacon-chain/p2p/utils_test.go index c54474930..2d9731f90 100644 --- a/beacon-chain/p2p/utils_test.go +++ b/beacon-chain/p2p/utils_test.go @@ -6,8 +6,8 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" logTest "github.com/sirupsen/logrus/hooks/test" ) diff --git a/beacon-chain/powchain/BUILD.bazel b/beacon-chain/powchain/BUILD.bazel index a5055d845..d158f8378 100644 --- a/beacon-chain/powchain/BUILD.bazel +++ b/beacon-chain/powchain/BUILD.bazel @@ -92,9 +92,9 @@ go_test( "//network:go_default_library", "//network/authorization:go_default_library", "//proto/prysm/v1alpha1:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "@com_github_ethereum_go_ethereum//:go_default_library", "@com_github_ethereum_go_ethereum//accounts/abi/bind/backends:go_default_library", "@com_github_ethereum_go_ethereum//common:go_default_library", diff --git a/beacon-chain/powchain/block_cache_test.go b/beacon-chain/powchain/block_cache_test.go index 2448371b6..ee926bd18 100644 --- a/beacon-chain/powchain/block_cache_test.go +++ b/beacon-chain/powchain/block_cache_test.go @@ -7,8 +7,8 @@ import ( "github.com/ethereum/go-ethereum/common" gethTypes "github.com/ethereum/go-ethereum/core/types" "github.com/prysmaticlabs/prysm/beacon-chain/powchain/types" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestHashKeyFn_OK(t *testing.T) { diff --git a/beacon-chain/powchain/block_reader_test.go b/beacon-chain/powchain/block_reader_test.go index fac0a64b2..5c3c9f6d0 100644 --- a/beacon-chain/powchain/block_reader_test.go +++ b/beacon-chain/powchain/block_reader_test.go @@ -13,8 +13,8 @@ import ( dbutil "github.com/prysmaticlabs/prysm/beacon-chain/db/testing" mockPOW "github.com/prysmaticlabs/prysm/beacon-chain/powchain/testing" contracts "github.com/prysmaticlabs/prysm/contracts/deposit" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) var endpoint = "http://127.0.0.1" diff --git a/beacon-chain/powchain/deposit_test.go b/beacon-chain/powchain/deposit_test.go index 156a5edcf..5841b733b 100644 --- a/beacon-chain/powchain/deposit_test.go +++ b/beacon-chain/powchain/deposit_test.go @@ -13,9 +13,9 @@ import ( "github.com/prysmaticlabs/prysm/crypto/bls" "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" logTest "github.com/sirupsen/logrus/hooks/test" ) @@ -31,10 +31,10 @@ func TestProcessDeposit_OK(t *testing.T) { web3Service = setDefaultMocks(web3Service) - deposits, _, err := testutil.DeterministicDepositsAndKeys(1) + deposits, _, err := util.DeterministicDepositsAndKeys(1) require.NoError(t, err) - eth1Data, err := testutil.DeterministicEth1Data(len(deposits)) + eth1Data, err := util.DeterministicEth1Data(len(deposits)) require.NoError(t, err) err = web3Service.processDeposit(context.Background(), eth1Data, deposits[0]) @@ -54,10 +54,10 @@ func TestProcessDeposit_InvalidMerkleBranch(t *testing.T) { require.NoError(t, err, "unable to setup web3 ETH1.0 chain service") web3Service = setDefaultMocks(web3Service) - deposits, _, err := testutil.DeterministicDepositsAndKeys(1) + deposits, _, err := util.DeterministicDepositsAndKeys(1) require.NoError(t, err) - eth1Data, err := testutil.DeterministicEth1Data(len(deposits)) + eth1Data, err := util.DeterministicEth1Data(len(deposits)) require.NoError(t, err) deposits[0].Proof = [][]byte{{'f', 'a', 'k', 'e'}} @@ -80,7 +80,7 @@ func TestProcessDeposit_InvalidPublicKey(t *testing.T) { require.NoError(t, err, "unable to setup web3 ETH1.0 chain service") web3Service = setDefaultMocks(web3Service) - deposits, _, err := testutil.DeterministicDepositsAndKeys(1) + deposits, _, err := util.DeterministicDepositsAndKeys(1) require.NoError(t, err) deposits[0].Data.PublicKey = bytesutil.PadTo([]byte("junk"), 48) @@ -116,7 +116,7 @@ func TestProcessDeposit_InvalidSignature(t *testing.T) { require.NoError(t, err, "unable to setup web3 ETH1.0 chain service") web3Service = setDefaultMocks(web3Service) - deposits, _, err := testutil.DeterministicDepositsAndKeys(1) + deposits, _, err := util.DeterministicDepositsAndKeys(1) require.NoError(t, err) var fakeSig [96]byte copy(fakeSig[:], []byte{'F', 'A', 'K', 'E'}) @@ -151,12 +151,12 @@ func TestProcessDeposit_UnableToVerify(t *testing.T) { require.NoError(t, err, "unable to setup web3 ETH1.0 chain service") web3Service = setDefaultMocks(web3Service) - deposits, keys, err := testutil.DeterministicDepositsAndKeys(1) + deposits, keys, err := util.DeterministicDepositsAndKeys(1) require.NoError(t, err) sig := keys[0].Sign([]byte{'F', 'A', 'K', 'E'}) deposits[0].Data.Signature = sig.Marshal() - trie, _, err := testutil.DepositTrieFromDeposits(deposits) + trie, _, err := util.DepositTrieFromDeposits(deposits) require.NoError(t, err) root := trie.HashTreeRoot() eth1Data := ðpb.Eth1Data{ @@ -245,9 +245,9 @@ func TestProcessDeposit_AllDepositedSuccessfully(t *testing.T) { require.NoError(t, err, "unable to setup web3 ETH1.0 chain service") web3Service = setDefaultMocks(web3Service) - deposits, keys, err := testutil.DeterministicDepositsAndKeys(10) + deposits, keys, err := util.DeterministicDepositsAndKeys(10) require.NoError(t, err) - eth1Data, err := testutil.DeterministicEth1Data(len(deposits)) + eth1Data, err := util.DeterministicEth1Data(len(deposits)) require.NoError(t, err) for i := range keys { diff --git a/beacon-chain/powchain/log_processing_test.go b/beacon-chain/powchain/log_processing_test.go index c8662e764..87a2a965d 100644 --- a/beacon-chain/powchain/log_processing_test.go +++ b/beacon-chain/powchain/log_processing_test.go @@ -17,9 +17,9 @@ import ( mockPOW "github.com/prysmaticlabs/prysm/beacon-chain/powchain/testing" "github.com/prysmaticlabs/prysm/config/params" contracts "github.com/prysmaticlabs/prysm/contracts/deposit" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" logTest "github.com/sirupsen/logrus/hooks/test" ) @@ -46,10 +46,10 @@ func TestProcessDepositLog_OK(t *testing.T) { testAcc.Backend.Commit() - deposits, _, err := testutil.DeterministicDepositsAndKeys(1) + deposits, _, err := util.DeterministicDepositsAndKeys(1) require.NoError(t, err) - _, depositRoots, err := testutil.DeterministicDepositTrie(len(deposits)) + _, depositRoots, err := util.DeterministicDepositTrie(len(deposits)) require.NoError(t, err) data := deposits[0].Data @@ -110,9 +110,9 @@ func TestProcessDepositLog_InsertsPendingDeposit(t *testing.T) { testAcc.Backend.Commit() - deposits, _, err := testutil.DeterministicDepositsAndKeys(1) + deposits, _, err := util.DeterministicDepositsAndKeys(1) require.NoError(t, err) - _, depositRoots, err := testutil.DeterministicDepositTrie(len(deposits)) + _, depositRoots, err := util.DeterministicDepositTrie(len(deposits)) require.NoError(t, err) data := deposits[0].Data @@ -165,9 +165,9 @@ func TestUnpackDepositLogData_OK(t *testing.T) { testAcc.Backend.Commit() - deposits, _, err := testutil.DeterministicDepositsAndKeys(1) + deposits, _, err := util.DeterministicDepositsAndKeys(1) require.NoError(t, err) - _, depositRoots, err := testutil.DeterministicDepositTrie(len(deposits)) + _, depositRoots, err := util.DeterministicDepositTrie(len(deposits)) require.NoError(t, err) data := deposits[0].Data @@ -222,9 +222,9 @@ func TestProcessETH2GenesisLog_8DuplicatePubkeys(t *testing.T) { testAcc.Backend.Commit() require.NoError(t, testAcc.Backend.AdjustTime(time.Duration(int64(time.Now().Nanosecond())))) - deposits, _, err := testutil.DeterministicDepositsAndKeys(1) + deposits, _, err := util.DeterministicDepositsAndKeys(1) require.NoError(t, err) - _, depositRoots, err := testutil.DeterministicDepositTrie(len(deposits)) + _, depositRoots, err := util.DeterministicDepositTrie(len(deposits)) require.NoError(t, err) data := deposits[0].Data @@ -291,9 +291,9 @@ func TestProcessETH2GenesisLog(t *testing.T) { testAcc.Backend.Commit() require.NoError(t, testAcc.Backend.AdjustTime(time.Duration(int64(time.Now().Nanosecond())))) - deposits, _, err := testutil.DeterministicDepositsAndKeys(uint64(depositsReqForChainStart)) + deposits, _, err := util.DeterministicDepositsAndKeys(uint64(depositsReqForChainStart)) require.NoError(t, err) - _, roots, err := testutil.DeterministicDepositTrie(len(deposits)) + _, roots, err := util.DeterministicDepositTrie(len(deposits)) require.NoError(t, err) // 64 Validators are used as size required for beacon-chain to start. This number @@ -388,9 +388,9 @@ func TestProcessETH2GenesisLog_CorrectNumOfDeposits(t *testing.T) { totalNumOfDeposits := depositsReqForChainStart + 30 - deposits, _, err := testutil.DeterministicDepositsAndKeys(uint64(totalNumOfDeposits)) + deposits, _, err := util.DeterministicDepositsAndKeys(uint64(totalNumOfDeposits)) require.NoError(t, err) - _, depositRoots, err := testutil.DeterministicDepositTrie(len(deposits)) + _, depositRoots, err := util.DeterministicDepositTrie(len(deposits)) require.NoError(t, err) depositOffset := 5 @@ -480,9 +480,9 @@ func TestProcessETH2GenesisLog_LargePeriodOfNoLogs(t *testing.T) { totalNumOfDeposits := depositsReqForChainStart + 30 - deposits, _, err := testutil.DeterministicDepositsAndKeys(uint64(totalNumOfDeposits)) + deposits, _, err := util.DeterministicDepositsAndKeys(uint64(totalNumOfDeposits)) require.NoError(t, err) - _, depositRoots, err := testutil.DeterministicDepositTrie(len(deposits)) + _, depositRoots, err := util.DeterministicDepositTrie(len(deposits)) require.NoError(t, err) depositOffset := 5 diff --git a/beacon-chain/powchain/prometheus_test.go b/beacon-chain/powchain/prometheus_test.go index a36a8e4ca..92715f6ff 100644 --- a/beacon-chain/powchain/prometheus_test.go +++ b/beacon-chain/powchain/prometheus_test.go @@ -6,7 +6,7 @@ import ( "time" "github.com/prometheus/client_golang/prometheus" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" ) // TestCleanup ensures that the cleanup function unregisters the prometheus.Collection diff --git a/beacon-chain/powchain/provider_test.go b/beacon-chain/powchain/provider_test.go index 5e32fadbe..70f27fe94 100644 --- a/beacon-chain/powchain/provider_test.go +++ b/beacon-chain/powchain/provider_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/prysmaticlabs/prysm/network/authorization" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" logTest "github.com/sirupsen/logrus/hooks/test" ) diff --git a/beacon-chain/powchain/service_test.go b/beacon-chain/powchain/service_test.go index df9838079..f2b942cc2 100644 --- a/beacon-chain/powchain/service_test.go +++ b/beacon-chain/powchain/service_test.go @@ -25,9 +25,9 @@ import ( "github.com/prysmaticlabs/prysm/network" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" protodb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" logTest "github.com/sirupsen/logrus/hooks/test" ) @@ -179,7 +179,7 @@ func TestStart_NoHttpEndpointDefinedFails_WithoutChainStarted(t *testing.T) { }() s.Start() }() - testutil.WaitTimeout(wg, time.Second) + util.WaitTimeout(wg, time.Second) require.LogsContain(t, hook, "cannot create genesis state: no eth1 http endpoint defined") hook.Reset() } @@ -189,8 +189,8 @@ func TestStart_NoHttpEndpointDefinedSucceeds_WithGenesisState(t *testing.T) { beaconDB := dbutil.SetupDB(t) testAcc, err := contracts.Setup() require.NoError(t, err, "Unable to set up simulated backend") - st, _ := testutil.DeterministicGenesisState(t, 10) - b := testutil.NewBeaconBlock() + st, _ := util.DeterministicGenesisState(t, 10) + b := util.NewBeaconBlock() genRoot, err := b.HashTreeRoot() require.NoError(t, err) require.NoError(t, beaconDB.SaveState(context.Background(), st, genRoot)) @@ -213,7 +213,7 @@ func TestStart_NoHttpEndpointDefinedSucceeds_WithGenesisState(t *testing.T) { wg.Done() }() s.cancel() - testutil.WaitTimeout(wg, time.Second) + util.WaitTimeout(wg, time.Second) require.LogsDoNotContain(t, hook, "cannot create genesis state: no eth1 http endpoint defined") hook.Reset() } @@ -438,7 +438,7 @@ func TestInitDepositCache_OK(t *testing.T) { {Index: 1, Eth1BlockHeight: 4, Deposit: ðpb.Deposit{Proof: [][]byte{[]byte("B")}}}, {Index: 2, Eth1BlockHeight: 6, Deposit: ðpb.Deposit{Proof: [][]byte{[]byte("c")}}}, } - gs, _ := testutil.DeterministicGenesisState(t, 1) + gs, _ := util.DeterministicGenesisState(t, 1) beaconDB := dbutil.SetupDB(t) s := &Service{ chainStartData: &protodb.ChainStartData{Chainstarted: false}, @@ -454,7 +454,7 @@ func TestInitDepositCache_OK(t *testing.T) { blockRootA := [32]byte{'a'} - emptyState, err := testutil.NewBeaconState() + emptyState, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, s.cfg.BeaconDB.SaveGenesisBlockRoot(context.Background(), blockRootA)) require.NoError(t, s.cfg.BeaconDB.SaveState(context.Background(), emptyState, blockRootA)) @@ -622,7 +622,7 @@ func TestService_EnsureConsistentPowchainData(t *testing.T) { DepositCache: cache, }) require.NoError(t, err) - genState, err := testutil.NewBeaconState() + genState, err := util.NewBeaconState() require.NoError(t, err) assert.NoError(t, genState.SetSlot(1000)) @@ -646,7 +646,7 @@ func TestService_InitializeCorrectly(t *testing.T) { DepositCache: cache, }) require.NoError(t, err) - genState, err := testutil.NewBeaconState() + genState, err := util.NewBeaconState() require.NoError(t, err) assert.NoError(t, genState.SetSlot(1000)) @@ -670,7 +670,7 @@ func TestService_EnsureValidPowchainData(t *testing.T) { DepositCache: cache, }) require.NoError(t, err) - genState, err := testutil.NewBeaconState() + genState, err := util.NewBeaconState() require.NoError(t, err) assert.NoError(t, genState.SetSlot(1000)) diff --git a/beacon-chain/rpc/BUILD.bazel b/beacon-chain/rpc/BUILD.bazel index 321338041..23045d3c3 100644 --- a/beacon-chain/rpc/BUILD.bazel +++ b/beacon-chain/rpc/BUILD.bazel @@ -62,8 +62,8 @@ go_test( "//beacon-chain/blockchain/testing:go_default_library", "//beacon-chain/powchain/testing:go_default_library", "//beacon-chain/sync/initial-sync/testing:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", "@com_github_sirupsen_logrus//hooks/test:go_default_library", ], diff --git a/beacon-chain/rpc/apimiddleware/BUILD.bazel b/beacon-chain/rpc/apimiddleware/BUILD.bazel index 6faa7e1d4..111c7a9c5 100644 --- a/beacon-chain/rpc/apimiddleware/BUILD.bazel +++ b/beacon-chain/rpc/apimiddleware/BUILD.bazel @@ -37,8 +37,8 @@ go_test( "//beacon-chain/rpc/eth/events:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/eth/v2:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "@com_github_gogo_protobuf//types:go_default_library", "@com_github_r3labs_sse//:go_default_library", ], diff --git a/beacon-chain/rpc/apimiddleware/custom_handlers_test.go b/beacon-chain/rpc/apimiddleware/custom_handlers_test.go index ba755530d..fe52e5df5 100644 --- a/beacon-chain/rpc/apimiddleware/custom_handlers_test.go +++ b/beacon-chain/rpc/apimiddleware/custom_handlers_test.go @@ -13,8 +13,8 @@ import ( "github.com/prysmaticlabs/prysm/api/gateway" "github.com/prysmaticlabs/prysm/api/grpc" "github.com/prysmaticlabs/prysm/beacon-chain/rpc/eth/events" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/r3labs/sse" ) diff --git a/beacon-chain/rpc/apimiddleware/custom_hooks_test.go b/beacon-chain/rpc/apimiddleware/custom_hooks_test.go index f84fa6ada..81888d888 100644 --- a/beacon-chain/rpc/apimiddleware/custom_hooks_test.go +++ b/beacon-chain/rpc/apimiddleware/custom_hooks_test.go @@ -12,8 +12,8 @@ import ( "github.com/prysmaticlabs/prysm/api/gateway" "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpbv2 "github.com/prysmaticlabs/prysm/proto/eth/v2" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestWrapAttestationArray(t *testing.T) { diff --git a/beacon-chain/rpc/apimiddleware/structs_marshalling_test.go b/beacon-chain/rpc/apimiddleware/structs_marshalling_test.go index 08c8cec7f..1587508c9 100644 --- a/beacon-chain/rpc/apimiddleware/structs_marshalling_test.go +++ b/beacon-chain/rpc/apimiddleware/structs_marshalling_test.go @@ -4,8 +4,8 @@ import ( "encoding/base64" "testing" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestUnmarshalEpochParticipation(t *testing.T) { diff --git a/beacon-chain/rpc/eth/beacon/BUILD.bazel b/beacon-chain/rpc/eth/beacon/BUILD.bazel index 31d140a45..859d6fb7a 100644 --- a/beacon-chain/rpc/eth/beacon/BUILD.bazel +++ b/beacon-chain/rpc/eth/beacon/BUILD.bazel @@ -101,9 +101,9 @@ go_test( "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/block:go_default_library", "//proto/prysm/v1alpha1/wrapper:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "@com_github_grpc_ecosystem_grpc_gateway_v2//runtime:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", diff --git a/beacon-chain/rpc/eth/beacon/blocks_test.go b/beacon-chain/rpc/eth/beacon/blocks_test.go index ba2f070d6..c81ceb640 100644 --- a/beacon-chain/rpc/eth/beacon/blocks_test.go +++ b/beacon-chain/rpc/eth/beacon/blocks_test.go @@ -18,14 +18,14 @@ import ( ethpbalpha "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func fillDBTestBlocks(ctx context.Context, t *testing.T, beaconDB db.Database) (*ethpbalpha.SignedBeaconBlock, []*ethpbalpha.BeaconBlockContainer) { parentRoot := [32]byte{1, 2, 3} - genBlk := testutil.NewBeaconBlock() + genBlk := util.NewBeaconBlock() genBlk.Block.ParentRoot = parentRoot[:] root, err := genBlk.Block.HashTreeRoot() require.NoError(t, err) @@ -36,13 +36,13 @@ func fillDBTestBlocks(ctx context.Context, t *testing.T, beaconDB db.Database) ( blks := make([]block.SignedBeaconBlock, count) blkContainers := make([]*ethpbalpha.BeaconBlockContainer, count) for i := types.Slot(0); i < count; i++ { - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = i b.Block.ParentRoot = bytesutil.PadTo([]byte{uint8(i)}, 32) - att1 := testutil.NewAttestation() + att1 := util.NewAttestation() att1.Data.Slot = i att1.Data.CommitteeIndex = types.CommitteeIndex(i) - att2 := testutil.NewAttestation() + att2 := util.NewAttestation() att2.Data.Slot = i att2.Data.CommitteeIndex = types.CommitteeIndex(i + 1) b.Block.Body.Attestations = []*ethpbalpha.Attestation{att1, att2} @@ -67,7 +67,7 @@ func fillDBTestBlocks(ctx context.Context, t *testing.T, beaconDB db.Database) ( func fillDBTestBlocksAltair(ctx context.Context, t *testing.T, beaconDB db.Database) (*ethpbalpha.SignedBeaconBlockAltair, []*ethpbalpha.BeaconBlockContainer) { parentRoot := [32]byte{1, 2, 3} - genBlk := testutil.NewBeaconBlockAltair() + genBlk := util.NewBeaconBlockAltair() genBlk.Block.ParentRoot = parentRoot[:] root, err := genBlk.Block.HashTreeRoot() require.NoError(t, err) @@ -80,13 +80,13 @@ func fillDBTestBlocksAltair(ctx context.Context, t *testing.T, beaconDB db.Datab blks := make([]block.SignedBeaconBlock, count) blkContainers := make([]*ethpbalpha.BeaconBlockContainer, count) for i := types.Slot(0); i < count; i++ { - b := testutil.NewBeaconBlockAltair() + b := util.NewBeaconBlockAltair() b.Block.Slot = i b.Block.ParentRoot = bytesutil.PadTo([]byte{uint8(i)}, 32) - att1 := testutil.NewAttestation() + att1 := util.NewAttestation() att1.Data.Slot = i att1.Data.CommitteeIndex = types.CommitteeIndex(i) - att2 := testutil.NewAttestation() + att2 := util.NewAttestation() att2.Data.Slot = i att2.Data.CommitteeIndex = types.CommitteeIndex(i + 1) b.Block.Body.Attestations = []*ethpbalpha.Attestation{att1, att2} @@ -118,11 +118,11 @@ func TestServer_GetBlockHeader(t *testing.T) { require.NoError(t, err) headBlock := blkContainers[len(blkContainers)-1] - b2 := testutil.NewBeaconBlock() + b2 := util.NewBeaconBlock() b2.Block.Slot = 30 b2.Block.ParentRoot = bytesutil.PadTo([]byte{1}, 32) require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b2))) - b3 := testutil.NewBeaconBlock() + b3 := util.NewBeaconBlock() b3.Block.Slot = 30 b3.Block.ParentRoot = bytesutil.PadTo([]byte{4}, 32) require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b3))) @@ -223,19 +223,19 @@ func TestServer_ListBlockHeaders(t *testing.T) { }, } - b2 := testutil.NewBeaconBlock() + b2 := util.NewBeaconBlock() b2.Block.Slot = 30 b2.Block.ParentRoot = bytesutil.PadTo([]byte{1}, 32) require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b2))) - b3 := testutil.NewBeaconBlock() + b3 := util.NewBeaconBlock() b3.Block.Slot = 30 b3.Block.ParentRoot = bytesutil.PadTo([]byte{4}, 32) require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b3))) - b4 := testutil.NewBeaconBlock() + b4 := util.NewBeaconBlock() b4.Block.Slot = 31 b4.Block.ParentRoot = bytesutil.PadTo([]byte{1}, 32) require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b4))) - b5 := testutil.NewBeaconBlock() + b5 := util.NewBeaconBlock() b5.Block.Slot = 28 b5.Block.ParentRoot = bytesutil.PadTo([]byte{1}, 32) require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b5))) @@ -295,11 +295,11 @@ func TestServer_ProposeBlock_OK(t *testing.T) { params.SetupTestConfigCleanup(t) params.OverrideBeaconConfig(params.MainnetConfig()) - genesis := testutil.NewBeaconBlock() + genesis := util.NewBeaconBlock() require.NoError(t, beaconDB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(genesis)), "Could not save genesis block") numDeposits := uint64(64) - beaconState, _ := testutil.DeterministicGenesisState(t, numDeposits) + beaconState, _ := util.DeterministicGenesisState(t, numDeposits) bsRoot, err := beaconState.HashTreeRoot(ctx) require.NoError(t, err) genesisRoot, err := genesis.Block.HashTreeRoot() @@ -314,7 +314,7 @@ func TestServer_ProposeBlock_OK(t *testing.T) { BlockNotifier: c.BlockNotifier(), Broadcaster: mockp2p.NewTestP2P(t), } - req := testutil.NewBeaconBlock() + req := util.NewBeaconBlock() req.Block.Slot = 5 req.Block.ParentRoot = bsRoot[:] v1Block, err := migration.V1Alpha1ToV1SignedBlock(req) @@ -335,11 +335,11 @@ func TestServer_GetBlock(t *testing.T) { _, blkContainers := fillDBTestBlocks(ctx, t, beaconDB) headBlock := blkContainers[len(blkContainers)-1] - b2 := testutil.NewBeaconBlock() + b2 := util.NewBeaconBlock() b2.Block.Slot = 30 b2.Block.ParentRoot = bytesutil.PadTo([]byte{1}, 32) require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b2))) - b3 := testutil.NewBeaconBlock() + b3 := util.NewBeaconBlock() b3.Block.Slot = 30 b3.Block.ParentRoot = bytesutil.PadTo([]byte{4}, 32) require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b3))) @@ -444,11 +444,11 @@ func TestServer_GetBlockV2(t *testing.T) { _, blkContainers := fillDBTestBlocks(ctx, t, beaconDB) headBlock := blkContainers[len(blkContainers)-1] - b2 := testutil.NewBeaconBlock() + b2 := util.NewBeaconBlock() b2.Block.Slot = 30 b2.Block.ParentRoot = bytesutil.PadTo([]byte{1}, 32) require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b2))) - b3 := testutil.NewBeaconBlock() + b3 := util.NewBeaconBlock() b3.Block.Slot = 30 b3.Block.ParentRoot = bytesutil.PadTo([]byte{4}, 32) require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b3))) @@ -555,13 +555,13 @@ func TestServer_GetBlockV2(t *testing.T) { _, blkContainers := fillDBTestBlocksAltair(ctx, t, beaconDB) headBlock := blkContainers[len(blkContainers)-1] - b2 := testutil.NewBeaconBlockAltair() + b2 := util.NewBeaconBlockAltair() b2.Block.Slot = 30 b2.Block.ParentRoot = bytesutil.PadTo([]byte{1}, 32) signedBlk, err := wrapper.WrappedAltairSignedBeaconBlock(b2) require.NoError(t, err) require.NoError(t, beaconDB.SaveBlock(ctx, signedBlk)) - b3 := testutil.NewBeaconBlockAltair() + b3 := util.NewBeaconBlockAltair() b3.Block.Slot = 30 b3.Block.ParentRoot = bytesutil.PadTo([]byte{4}, 32) signedBlk, err = wrapper.WrappedAltairSignedBeaconBlock(b2) @@ -673,7 +673,7 @@ func TestServer_GetBlockSSZ(t *testing.T) { _, blkContainers := fillDBTestBlocks(ctx, t, beaconDB) headBlock := blkContainers[len(blkContainers)-1] - b2 := testutil.NewBeaconBlock() + b2 := util.NewBeaconBlock() b2.Block.Slot = 30 b2.Block.ParentRoot = bytesutil.PadTo([]byte{1}, 32) require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b2))) @@ -708,7 +708,7 @@ func TestServer_GetBlockSSZV2(t *testing.T) { _, blkContainers := fillDBTestBlocks(ctx, t, beaconDB) headBlock := blkContainers[len(blkContainers)-1] - b2 := testutil.NewBeaconBlock() + b2 := util.NewBeaconBlock() b2.Block.Slot = 30 b2.Block.ParentRoot = bytesutil.PadTo([]byte{1}, 32) require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b2))) @@ -742,7 +742,7 @@ func TestServer_GetBlockSSZV2(t *testing.T) { _, blkContainers := fillDBTestBlocksAltair(ctx, t, beaconDB) headBlock := blkContainers[len(blkContainers)-1] - b2 := testutil.NewBeaconBlockAltair() + b2 := util.NewBeaconBlockAltair() b2.Block.Slot = 30 b2.Block.ParentRoot = bytesutil.PadTo([]byte{1}, 32) signedBlk, err := wrapper.WrappedAltairSignedBeaconBlock(b2) @@ -780,11 +780,11 @@ func TestServer_GetBlockRoot(t *testing.T) { genBlk, blkContainers := fillDBTestBlocks(ctx, t, beaconDB) headBlock := blkContainers[len(blkContainers)-1] - b2 := testutil.NewBeaconBlock() + b2 := util.NewBeaconBlock() b2.Block.Slot = 30 b2.Block.ParentRoot = bytesutil.PadTo([]byte{1}, 32) require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b2))) - b3 := testutil.NewBeaconBlock() + b3 := util.NewBeaconBlock() b3.Block.Slot = 30 b3.Block.ParentRoot = bytesutil.PadTo([]byte{4}, 32) require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b3))) diff --git a/beacon-chain/rpc/eth/beacon/config_test.go b/beacon-chain/rpc/eth/beacon/config_test.go index 1f573a180..5d2de7422 100644 --- a/beacon-chain/rpc/eth/beacon/config_test.go +++ b/beacon-chain/rpc/eth/beacon/config_test.go @@ -8,8 +8,8 @@ import ( types "github.com/prysmaticlabs/eth2-types" "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/encoding/bytesutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" "google.golang.org/protobuf/types/known/emptypb" ) diff --git a/beacon-chain/rpc/eth/beacon/pool_test.go b/beacon-chain/rpc/eth/beacon/pool_test.go index 8176c54b1..7878f0120 100644 --- a/beacon-chain/rpc/eth/beacon/pool_test.go +++ b/beacon-chain/rpc/eth/beacon/pool_test.go @@ -24,15 +24,15 @@ import ( ethpbv1 "github.com/prysmaticlabs/prysm/proto/eth/v1" "github.com/prysmaticlabs/prysm/proto/migration" ethpbv1alpha1 "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/grpc" "google.golang.org/protobuf/types/known/emptypb" ) func TestListPoolAttestations(t *testing.T) { - state, err := testutil.NewBeaconState() + state, err := util.NewBeaconState() require.NoError(t, err) att1 := ðpbv1alpha1.Attestation{ AggregationBits: []byte{1, 10}, @@ -194,7 +194,7 @@ func TestListPoolAttestations(t *testing.T) { } func TestListPoolAttesterSlashings(t *testing.T) { - state, err := testutil.NewBeaconState() + state, err := util.NewBeaconState() require.NoError(t, err) slashing1 := ðpbv1alpha1.AttesterSlashing{ Attestation_1: ðpbv1alpha1.IndexedAttestation{ @@ -282,7 +282,7 @@ func TestListPoolAttesterSlashings(t *testing.T) { } func TestListPoolProposerSlashings(t *testing.T) { - state, err := testutil.NewBeaconState() + state, err := util.NewBeaconState() require.NoError(t, err) slashing1 := ðpbv1alpha1.ProposerSlashing{ Header_1: ðpbv1alpha1.SignedBeaconBlockHeader{ @@ -342,7 +342,7 @@ func TestListPoolProposerSlashings(t *testing.T) { } func TestListPoolVoluntaryExits(t *testing.T) { - state, err := testutil.NewBeaconState() + state, err := util.NewBeaconState() require.NoError(t, err) exit1 := ðpbv1alpha1.SignedVoluntaryExit{ Exit: ðpbv1alpha1.VoluntaryExit{ @@ -374,12 +374,12 @@ func TestListPoolVoluntaryExits(t *testing.T) { func TestSubmitAttesterSlashing_Ok(t *testing.T) { ctx := context.Background() - _, keys, err := testutil.DeterministicDepositsAndKeys(1) + _, keys, err := util.DeterministicDepositsAndKeys(1) require.NoError(t, err) validator := ðpbv1alpha1.Validator{ PublicKey: keys[0].PublicKey().Marshal(), } - state, err := testutil.NewBeaconState(func(state *ethpbv1alpha1.BeaconState) error { + state, err := util.NewBeaconState(func(state *ethpbv1alpha1.BeaconState) error { state.Validators = []*ethpbv1alpha1.Validator{validator} return nil }) @@ -447,7 +447,7 @@ func TestSubmitAttesterSlashing_Ok(t *testing.T) { func TestSubmitAttesterSlashing_InvalidSlashing(t *testing.T) { ctx := context.Background() - state, err := testutil.NewBeaconState() + state, err := util.NewBeaconState() require.NoError(t, err) attestation := ðpbv1.IndexedAttestation{ @@ -488,13 +488,13 @@ func TestSubmitAttesterSlashing_InvalidSlashing(t *testing.T) { func TestSubmitProposerSlashing_Ok(t *testing.T) { ctx := context.Background() - _, keys, err := testutil.DeterministicDepositsAndKeys(1) + _, keys, err := util.DeterministicDepositsAndKeys(1) require.NoError(t, err) validator := ðpbv1alpha1.Validator{ PublicKey: keys[0].PublicKey().Marshal(), WithdrawableEpoch: eth2types.Epoch(1), } - state, err := testutil.NewBeaconState(func(state *ethpbv1alpha1.BeaconState) error { + state, err := util.NewBeaconState(func(state *ethpbv1alpha1.BeaconState) error { state.Validators = []*ethpbv1alpha1.Validator{validator} return nil }) @@ -554,7 +554,7 @@ func TestSubmitProposerSlashing_Ok(t *testing.T) { func TestSubmitProposerSlashing_InvalidSlashing(t *testing.T) { ctx := context.Background() - state, err := testutil.NewBeaconState() + state, err := util.NewBeaconState() require.NoError(t, err) header := ðpbv1.SignedBeaconBlockHeader{ @@ -588,13 +588,13 @@ func TestSubmitProposerSlashing_InvalidSlashing(t *testing.T) { func TestSubmitVoluntaryExit_Ok(t *testing.T) { ctx := context.Background() - _, keys, err := testutil.DeterministicDepositsAndKeys(1) + _, keys, err := util.DeterministicDepositsAndKeys(1) require.NoError(t, err) validator := ðpbv1alpha1.Validator{ ExitEpoch: params.BeaconConfig().FarFutureEpoch, PublicKey: keys[0].PublicKey().Marshal(), } - state, err := testutil.NewBeaconState(func(state *ethpbv1alpha1.BeaconState) error { + state, err := util.NewBeaconState(func(state *ethpbv1alpha1.BeaconState) error { state.Validators = []*ethpbv1alpha1.Validator{validator} // Satisfy activity time required before exiting. state.Slot = params.BeaconConfig().SlotsPerEpoch.Mul(uint64(params.BeaconConfig().ShardCommitteePeriod)) @@ -634,13 +634,13 @@ func TestSubmitVoluntaryExit_Ok(t *testing.T) { func TestSubmitVoluntaryExit_InvalidValidatorIndex(t *testing.T) { ctx := context.Background() - _, keys, err := testutil.DeterministicDepositsAndKeys(1) + _, keys, err := util.DeterministicDepositsAndKeys(1) require.NoError(t, err) validator := ðpbv1alpha1.Validator{ ExitEpoch: params.BeaconConfig().FarFutureEpoch, PublicKey: keys[0].PublicKey().Marshal(), } - state, err := testutil.NewBeaconState(func(state *ethpbv1alpha1.BeaconState) error { + state, err := util.NewBeaconState(func(state *ethpbv1alpha1.BeaconState) error { state.Validators = []*ethpbv1alpha1.Validator{validator} return nil }) @@ -669,13 +669,13 @@ func TestSubmitVoluntaryExit_InvalidValidatorIndex(t *testing.T) { func TestSubmitVoluntaryExit_InvalidExit(t *testing.T) { ctx := context.Background() - _, keys, err := testutil.DeterministicDepositsAndKeys(1) + _, keys, err := util.DeterministicDepositsAndKeys(1) require.NoError(t, err) validator := ðpbv1alpha1.Validator{ ExitEpoch: params.BeaconConfig().FarFutureEpoch, PublicKey: keys[0].PublicKey().Marshal(), } - state, err := testutil.NewBeaconState(func(state *ethpbv1alpha1.BeaconState) error { + state, err := util.NewBeaconState(func(state *ethpbv1alpha1.BeaconState) error { state.Validators = []*ethpbv1alpha1.Validator{validator} return nil }) @@ -709,7 +709,7 @@ func TestServer_SubmitAttestations_Ok(t *testing.T) { c.SlotsPerEpoch = 1 params.OverrideBeaconConfig(c) - _, keys, err := testutil.DeterministicDepositsAndKeys(1) + _, keys, err := util.DeterministicDepositsAndKeys(1) require.NoError(t, err) validators := []*ethpbv1alpha1.Validator{ { @@ -717,7 +717,7 @@ func TestServer_SubmitAttestations_Ok(t *testing.T) { ExitEpoch: params.BeaconConfig().FarFutureEpoch, }, } - state, err := testutil.NewBeaconState(func(state *ethpbv1alpha1.BeaconState) error { + state, err := util.NewBeaconState(func(state *ethpbv1alpha1.BeaconState) error { state.Validators = validators state.Slot = 1 state.PreviousJustifiedCheckpoint = ðpbv1alpha1.Checkpoint{ @@ -815,7 +815,7 @@ func TestServer_SubmitAttestations_ValidAttestationSubmitted(t *testing.T) { c.SlotsPerEpoch = 1 params.OverrideBeaconConfig(c) - _, keys, err := testutil.DeterministicDepositsAndKeys(1) + _, keys, err := util.DeterministicDepositsAndKeys(1) require.NoError(t, err) validators := []*ethpbv1alpha1.Validator{ { @@ -823,7 +823,7 @@ func TestServer_SubmitAttestations_ValidAttestationSubmitted(t *testing.T) { ExitEpoch: params.BeaconConfig().FarFutureEpoch, }, } - state, err := testutil.NewBeaconState(func(state *ethpbv1alpha1.BeaconState) error { + state, err := util.NewBeaconState(func(state *ethpbv1alpha1.BeaconState) error { state.Validators = validators state.Slot = 1 state.PreviousJustifiedCheckpoint = ðpbv1alpha1.Checkpoint{ @@ -915,7 +915,7 @@ func TestServer_SubmitAttestations_InvalidAttestationGRPCHeader(t *testing.T) { c.SlotsPerEpoch = 1 params.OverrideBeaconConfig(c) - _, keys, err := testutil.DeterministicDepositsAndKeys(1) + _, keys, err := util.DeterministicDepositsAndKeys(1) require.NoError(t, err) validators := []*ethpbv1alpha1.Validator{ { @@ -923,7 +923,7 @@ func TestServer_SubmitAttestations_InvalidAttestationGRPCHeader(t *testing.T) { ExitEpoch: params.BeaconConfig().FarFutureEpoch, }, } - state, err := testutil.NewBeaconState(func(state *ethpbv1alpha1.BeaconState) error { + state, err := util.NewBeaconState(func(state *ethpbv1alpha1.BeaconState) error { state.Validators = validators state.Slot = 1 state.PreviousJustifiedCheckpoint = ðpbv1alpha1.Checkpoint{ diff --git a/beacon-chain/rpc/eth/beacon/state_test.go b/beacon-chain/rpc/eth/beacon/state_test.go index 40ec4a10b..081748273 100644 --- a/beacon-chain/rpc/eth/beacon/state_test.go +++ b/beacon-chain/rpc/eth/beacon/state_test.go @@ -11,9 +11,9 @@ import ( "github.com/prysmaticlabs/prysm/encoding/bytesutil" eth "github.com/prysmaticlabs/prysm/proto/eth/v1" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - sharedtestutil "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/protobuf/types/known/emptypb" ) @@ -72,7 +72,7 @@ func TestGetGenesis(t *testing.T) { func TestGetStateRoot(t *testing.T) { ctx := context.Background() - fakeState, err := sharedtestutil.NewBeaconState() + fakeState, err := util.NewBeaconState() require.NoError(t, err) stateRoot, err := fakeState.HashTreeRoot(ctx) require.NoError(t, err) @@ -99,7 +99,7 @@ func TestGetStateFork(t *testing.T) { } return nil } - fakeState, err := sharedtestutil.NewBeaconState(fillFork) + fakeState, err := util.NewBeaconState(fillFork) require.NoError(t, err) server := &Server{ StateFetcher: &testutil.MockFetcher{ @@ -134,7 +134,7 @@ func TestGetFinalityCheckpoints(t *testing.T) { } return nil } - fakeState, err := sharedtestutil.NewBeaconState(fillCheckpoints) + fakeState, err := util.NewBeaconState(fillCheckpoints) require.NoError(t, err) server := &Server{ StateFetcher: &testutil.MockFetcher{ diff --git a/beacon-chain/rpc/eth/beacon/sync_committee_test.go b/beacon-chain/rpc/eth/beacon/sync_committee_test.go index d60da198c..fb17b68ca 100644 --- a/beacon-chain/rpc/eth/beacon/sync_committee_test.go +++ b/beacon-chain/rpc/eth/beacon/sync_committee_test.go @@ -17,15 +17,15 @@ import ( "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpbv2 "github.com/prysmaticlabs/prysm/proto/eth/v2" ethpbalpha "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - sharedtestutil "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" bytesutil2 "github.com/wealdtech/go-bytesutil" "google.golang.org/grpc" ) func Test_currentCommitteeIndicesFromState(t *testing.T) { - st, _ := sharedtestutil.DeterministicGenesisStateAltair(t, params.BeaconConfig().SyncCommitteeSize) + st, _ := util.DeterministicGenesisStateAltair(t, params.BeaconConfig().SyncCommitteeSize) vals := st.Validators() wantedCommittee := make([][]byte, params.BeaconConfig().SyncCommitteeSize) wantedIndices := make([]types.ValidatorIndex, len(wantedCommittee)) @@ -56,7 +56,7 @@ func Test_currentCommitteeIndicesFromState(t *testing.T) { } func Test_extractSyncSubcommittees(t *testing.T) { - st, _ := sharedtestutil.DeterministicGenesisStateAltair(t, params.BeaconConfig().SyncCommitteeSize) + st, _ := util.DeterministicGenesisStateAltair(t, params.BeaconConfig().SyncCommitteeSize) vals := st.Validators() syncCommittee := make([][]byte, params.BeaconConfig().SyncCommitteeSize) for i := 0; i < len(syncCommittee); i++ { @@ -109,7 +109,7 @@ func Test_extractSyncSubcommittees(t *testing.T) { func TestListSyncCommittees(t *testing.T) { ctx := context.Background() - st, _ := sharedtestutil.DeterministicGenesisStateAltair(t, params.BeaconConfig().SyncCommitteeSize) + st, _ := util.DeterministicGenesisStateAltair(t, params.BeaconConfig().SyncCommitteeSize) syncCommittee := make([][]byte, params.BeaconConfig().SyncCommitteeSize) vals := st.Validators() for i := 0; i < len(syncCommittee); i++ { @@ -152,7 +152,7 @@ func TestListSyncCommittees(t *testing.T) { func TestSubmitPoolSyncCommitteeSignatures(t *testing.T) { ctx := grpc.NewContextWithServerTransportStream(context.Background(), &runtime.ServerTransportStream{}) - st, _ := sharedtestutil.DeterministicGenesisStateAltair(t, 10) + st, _ := util.DeterministicGenesisStateAltair(t, 10) alphaServer := &validator.Server{ SyncCommitteePool: synccommittee.NewStore(), diff --git a/beacon-chain/rpc/eth/beacon/validator_test.go b/beacon-chain/rpc/eth/beacon/validator_test.go index 10939b766..19b17a6c7 100644 --- a/beacon-chain/rpc/eth/beacon/validator_test.go +++ b/beacon-chain/rpc/eth/beacon/validator_test.go @@ -18,16 +18,16 @@ import ( ethpb "github.com/prysmaticlabs/prysm/proto/eth/v1" "github.com/prysmaticlabs/prysm/proto/migration" eth "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - sharedtestutil "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestGetValidator(t *testing.T) { ctx := context.Background() var st state.BeaconState - st, _ = sharedtestutil.DeterministicGenesisState(t, 8192) + st, _ = util.DeterministicGenesisState(t, 8192) t.Run("Head Get Validator by index", func(t *testing.T) { s := Server{ @@ -78,7 +78,7 @@ func TestListValidators(t *testing.T) { ctx := context.Background() var st state.BeaconState - st, _ = sharedtestutil.DeterministicGenesisState(t, 8192) + st, _ = util.DeterministicGenesisState(t, 8192) t.Run("Head List All Validators", func(t *testing.T) { s := Server{ @@ -207,7 +207,7 @@ func TestListValidators_Status(t *testing.T) { ctx := context.Background() var st state.BeaconState - st, _ = sharedtestutil.DeterministicGenesisState(t, 8192) + st, _ = util.DeterministicGenesisState(t, 8192) farFutureEpoch := params.BeaconConfig().FarFutureEpoch validators := []*eth.Validator{ @@ -438,7 +438,7 @@ func TestListValidatorBalances(t *testing.T) { ctx := context.Background() var st state.BeaconState - st, _ = sharedtestutil.DeterministicGenesisState(t, 8192) + st, _ = util.DeterministicGenesisState(t, 8192) t.Run("Head List Validators Balance by index", func(t *testing.T) { s := Server{ @@ -510,7 +510,7 @@ func TestListCommittees(t *testing.T) { ctx := context.Background() var st state.BeaconState - st, _ = sharedtestutil.DeterministicGenesisState(t, 8192) + st, _ = util.DeterministicGenesisState(t, 8192) epoch := core.SlotToEpoch(st.Slot()) t.Run("Head All Committees", func(t *testing.T) { diff --git a/beacon-chain/rpc/eth/debug/BUILD.bazel b/beacon-chain/rpc/eth/debug/BUILD.bazel index 0d45568e8..189db1927 100644 --- a/beacon-chain/rpc/eth/debug/BUILD.bazel +++ b/beacon-chain/rpc/eth/debug/BUILD.bazel @@ -36,9 +36,9 @@ go_test( "//encoding/bytesutil:go_default_library", "//proto/eth/v1:go_default_library", "//proto/eth/v2:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", "@org_golang_google_protobuf//types/known/emptypb:go_default_library", ], diff --git a/beacon-chain/rpc/eth/debug/debug_test.go b/beacon-chain/rpc/eth/debug/debug_test.go index 032622cee..5fcf9a79b 100644 --- a/beacon-chain/rpc/eth/debug/debug_test.go +++ b/beacon-chain/rpc/eth/debug/debug_test.go @@ -10,14 +10,14 @@ import ( "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpbv1 "github.com/prysmaticlabs/prysm/proto/eth/v1" ethpbv2 "github.com/prysmaticlabs/prysm/proto/eth/v2" - sharedtestutil "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/protobuf/types/known/emptypb" ) func TestGetBeaconState(t *testing.T) { - fakeState, err := sharedtestutil.NewBeaconState() + fakeState, err := util.NewBeaconState() require.NoError(t, err) server := &Server{ StateFetcher: &testutil.MockFetcher{ @@ -33,7 +33,7 @@ func TestGetBeaconState(t *testing.T) { func TestGetBeaconStateV2(t *testing.T) { t.Run("Phase 0", func(t *testing.T) { - fakeState, err := sharedtestutil.NewBeaconState() + fakeState, err := util.NewBeaconState() require.NoError(t, err) server := &Server{ StateFetcher: &testutil.MockFetcher{ @@ -48,7 +48,7 @@ func TestGetBeaconStateV2(t *testing.T) { assert.Equal(t, ethpbv2.Version_PHASE0, resp.Version) }) t.Run("Altair", func(t *testing.T) { - fakeState, _ := sharedtestutil.DeterministicGenesisStateAltair(t, 1) + fakeState, _ := util.DeterministicGenesisStateAltair(t, 1) server := &Server{ StateFetcher: &testutil.MockFetcher{ BeaconState: fakeState, @@ -64,7 +64,7 @@ func TestGetBeaconStateV2(t *testing.T) { } func TestGetBeaconStateSSZ(t *testing.T) { - fakeState, err := sharedtestutil.NewBeaconState() + fakeState, err := util.NewBeaconState() require.NoError(t, err) sszState, err := fakeState.MarshalSSZ() require.NoError(t, err) @@ -85,7 +85,7 @@ func TestGetBeaconStateSSZ(t *testing.T) { func TestGetBeaconStateSSZV2(t *testing.T) { t.Run("Phase 0", func(t *testing.T) { - fakeState, err := sharedtestutil.NewBeaconState() + fakeState, err := util.NewBeaconState() require.NoError(t, err) sszState, err := fakeState.MarshalSSZ() require.NoError(t, err) @@ -104,7 +104,7 @@ func TestGetBeaconStateSSZV2(t *testing.T) { assert.DeepEqual(t, sszState, resp.Data) }) t.Run("Altair", func(t *testing.T) { - fakeState, _ := sharedtestutil.DeterministicGenesisStateAltair(t, 1) + fakeState, _ := util.DeterministicGenesisStateAltair(t, 1) sszState, err := fakeState.MarshalSSZ() require.NoError(t, err) diff --git a/beacon-chain/rpc/eth/events/BUILD.bazel b/beacon-chain/rpc/eth/events/BUILD.bazel index f6a1f3568..a48e96f8f 100644 --- a/beacon-chain/rpc/eth/events/BUILD.bazel +++ b/beacon-chain/rpc/eth/events/BUILD.bazel @@ -40,10 +40,10 @@ go_test( "//proto/migration:go_default_library", "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/wrapper:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", "//testing/mock:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "@com_github_golang_mock//gomock:go_default_library", "@com_github_grpc_ecosystem_grpc_gateway_v2//proto/gateway:go_default_library", "@org_golang_google_protobuf//types/known/anypb:go_default_library", diff --git a/beacon-chain/rpc/eth/events/events_test.go b/beacon-chain/rpc/eth/events/events_test.go index e75a4c6b4..c32b82db5 100644 --- a/beacon-chain/rpc/eth/events/events_test.go +++ b/beacon-chain/rpc/eth/events/events_test.go @@ -16,10 +16,10 @@ import ( "github.com/prysmaticlabs/prysm/proto/migration" eth "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" "github.com/prysmaticlabs/prysm/testing/mock" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/protobuf/types/known/anypb" ) @@ -48,7 +48,7 @@ func TestStreamEvents_BlockEvents(t *testing.T) { srv, ctrl, mockStream := setupServer(ctx, t) defer ctrl.Finish() - wantedBlock := testutil.HydrateSignedBeaconBlock(ð.SignedBeaconBlock{ + wantedBlock := util.HydrateSignedBeaconBlock(ð.SignedBeaconBlock{ Block: ð.BeaconBlock{ Slot: 8, }, @@ -88,7 +88,7 @@ func TestStreamEvents_OperationsEvents(t *testing.T) { srv, ctrl, mockStream := setupServer(ctx, t) defer ctrl.Finish() - wantedAttV1alpha1 := testutil.HydrateAttestation(ð.Attestation{ + wantedAttV1alpha1 := util.HydrateAttestation(ð.Attestation{ Data: ð.AttestationData{ Slot: 8, }, @@ -123,7 +123,7 @@ func TestStreamEvents_OperationsEvents(t *testing.T) { defer ctrl.Finish() wantedAttV1alpha1 := ð.AggregateAttestationAndProof{ - Aggregate: testutil.HydrateAttestation(ð.Attestation{}), + Aggregate: util.HydrateAttestation(ð.Attestation{}), } wantedAtt := migration.V1Alpha1AggregateAttAndProofToV1(wantedAttV1alpha1) genericResponse, err := anypb.New(wantedAtt) diff --git a/beacon-chain/rpc/eth/helpers/BUILD.bazel b/beacon-chain/rpc/eth/helpers/BUILD.bazel index 7255207ab..e46eabb18 100644 --- a/beacon-chain/rpc/eth/helpers/BUILD.bazel +++ b/beacon-chain/rpc/eth/helpers/BUILD.bazel @@ -29,8 +29,8 @@ go_test( "//config/params:go_default_library", "//proto/eth/v1:go_default_library", "//proto/migration:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", ], ) diff --git a/beacon-chain/rpc/eth/helpers/validator_status_test.go b/beacon-chain/rpc/eth/helpers/validator_status_test.go index a18990a86..3a3364177 100644 --- a/beacon-chain/rpc/eth/helpers/validator_status_test.go +++ b/beacon-chain/rpc/eth/helpers/validator_status_test.go @@ -9,8 +9,8 @@ import ( "github.com/prysmaticlabs/prysm/config/params" ethpb "github.com/prysmaticlabs/prysm/proto/eth/v1" "github.com/prysmaticlabs/prysm/proto/migration" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func Test_ValidatorStatus(t *testing.T) { diff --git a/beacon-chain/rpc/eth/node/BUILD.bazel b/beacon-chain/rpc/eth/node/BUILD.bazel index 7e741e7bc..cb107f850 100644 --- a/beacon-chain/rpc/eth/node/BUILD.bazel +++ b/beacon-chain/rpc/eth/node/BUILD.bazel @@ -50,9 +50,9 @@ go_test( "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/wrapper:go_default_library", "//runtime/version:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "@com_github_ethereum_go_ethereum//p2p/enode:go_default_library", "@com_github_ethereum_go_ethereum//p2p/enr:go_default_library", "@com_github_grpc_ecosystem_grpc_gateway_v2//runtime:go_default_library", diff --git a/beacon-chain/rpc/eth/node/node_test.go b/beacon-chain/rpc/eth/node/node_test.go index dfc7d9f8c..968085dfb 100644 --- a/beacon-chain/rpc/eth/node/node_test.go +++ b/beacon-chain/rpc/eth/node/node_test.go @@ -28,9 +28,9 @@ import ( pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" "github.com/prysmaticlabs/prysm/runtime/version" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/grpc" "google.golang.org/protobuf/types/known/emptypb" ) @@ -163,7 +163,7 @@ func TestGetIdentity(t *testing.T) { func TestSyncStatus(t *testing.T) { currentSlot := new(types.Slot) *currentSlot = 110 - state, err := testutil.NewBeaconState() + state, err := util.NewBeaconState() require.NoError(t, err) err = state.SetSlot(100) require.NoError(t, err) diff --git a/beacon-chain/rpc/eth/validator/BUILD.bazel b/beacon-chain/rpc/eth/validator/BUILD.bazel index b33fb9b5a..f81bb9c12 100644 --- a/beacon-chain/rpc/eth/validator/BUILD.bazel +++ b/beacon-chain/rpc/eth/validator/BUILD.bazel @@ -72,9 +72,9 @@ go_test( "//proto/migration:go_default_library", "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/wrapper:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", "@org_golang_google_protobuf//proto:go_default_library", diff --git a/beacon-chain/rpc/eth/validator/validator_test.go b/beacon-chain/rpc/eth/validator/validator_test.go index c84feefb7..562ec0ab1 100644 --- a/beacon-chain/rpc/eth/validator/validator_test.go +++ b/beacon-chain/rpc/eth/validator/validator_test.go @@ -36,19 +36,19 @@ import ( "github.com/prysmaticlabs/prysm/proto/migration" ethpbalpha "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - sharedtestutil "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/protobuf/proto" ) func TestGetAttesterDuties(t *testing.T) { ctx := context.Background() - genesis := sharedtestutil.NewBeaconBlock() + genesis := util.NewBeaconBlock() depChainStart := params.BeaconConfig().MinGenesisActiveValidatorCount - deposits, _, err := sharedtestutil.DeterministicDepositsAndKeys(depChainStart) + deposits, _, err := util.DeterministicDepositsAndKeys(depChainStart) require.NoError(t, err) - eth1Data, err := sharedtestutil.DeterministicEth1Data(len(deposits)) + eth1Data, err := util.DeterministicEth1Data(len(deposits)) require.NoError(t, err) bs, err := transition.GenesisBeaconState(context.Background(), deposits, 0, eth1Data) require.NoError(t, err, "Could not set up genesis state") @@ -203,11 +203,11 @@ func TestGetAttesterDuties_SyncNotReady(t *testing.T) { func TestGetProposerDuties(t *testing.T) { ctx := context.Background() - genesis := sharedtestutil.NewBeaconBlock() + genesis := util.NewBeaconBlock() depChainStart := params.BeaconConfig().MinGenesisActiveValidatorCount - deposits, _, err := sharedtestutil.DeterministicDepositsAndKeys(depChainStart) + deposits, _, err := util.DeterministicDepositsAndKeys(depChainStart) require.NoError(t, err) - eth1Data, err := sharedtestutil.DeterministicEth1Data(len(deposits)) + eth1Data, err := util.DeterministicEth1Data(len(deposits)) require.NoError(t, err) bs, err := transition.GenesisBeaconState(context.Background(), deposits, 0, eth1Data) require.NoError(t, err, "Could not set up genesis state") @@ -325,7 +325,7 @@ func TestGetProposerDuties_SyncNotReady(t *testing.T) { func TestGetSyncCommitteeDuties(t *testing.T) { ctx := context.Background() numVals := uint64(10) - st, _ := sharedtestutil.DeterministicGenesisStateAltair(t, numVals) + st, _ := util.DeterministicGenesisStateAltair(t, numVals) vals := st.Validators() committee := ðpbalpha.SyncCommittee{} for _, v := range vals { @@ -403,7 +403,7 @@ func TestProduceBlock(t *testing.T) { params.SetupTestConfigCleanup(t) params.OverrideBeaconConfig(params.MainnetConfig()) - beaconState, privKeys := sharedtestutil.DeterministicGenesisState(t, 64) + beaconState, privKeys := util.DeterministicGenesisState(t, 64) stateRoot, err := beaconState.HashTreeRoot(ctx) require.NoError(t, err, "Could not hash genesis state") @@ -432,7 +432,7 @@ func TestProduceBlock(t *testing.T) { proposerSlashings := make([]*ethpbalpha.ProposerSlashing, params.BeaconConfig().MaxProposerSlashings) for i := types.ValidatorIndex(0); uint64(i) < params.BeaconConfig().MaxProposerSlashings; i++ { - proposerSlashing, err := sharedtestutil.GenerateProposerSlashingForValidator( + proposerSlashing, err := util.GenerateProposerSlashingForValidator( beaconState, privKeys[i], i, /* validator index */ @@ -445,7 +445,7 @@ func TestProduceBlock(t *testing.T) { attSlashings := make([]*ethpbalpha.AttesterSlashing, params.BeaconConfig().MaxAttesterSlashings) for i := uint64(0); i < params.BeaconConfig().MaxAttesterSlashings; i++ { - attesterSlashing, err := sharedtestutil.GenerateAttesterSlashingForValidator( + attesterSlashing, err := util.GenerateAttesterSlashingForValidator( beaconState, privKeys[i+params.BeaconConfig().MaxProposerSlashings], types.ValidatorIndex(i+params.BeaconConfig().MaxProposerSlashings), /* validator index */ @@ -459,7 +459,7 @@ func TestProduceBlock(t *testing.T) { v1Server := &Server{ V1Alpha1Server: v1Alpha1Server, } - randaoReveal, err := sharedtestutil.RandaoReveal(beaconState, 0, privKeys) + randaoReveal, err := util.RandaoReveal(beaconState, 0, privKeys) require.NoError(t, err) graffiti := bytesutil.ToBytes32([]byte("eth2")) req := ðpbv1.ProduceBlockRequest{ @@ -493,7 +493,7 @@ func TestProduceBlockV2(t *testing.T) { db := dbutil.SetupDB(t) ctx := context.Background() - beaconState, privKeys := sharedtestutil.DeterministicGenesisState(t, 64) + beaconState, privKeys := util.DeterministicGenesisState(t, 64) stateRoot, err := beaconState.HashTreeRoot(ctx) require.NoError(t, err, "Could not hash genesis state") @@ -522,7 +522,7 @@ func TestProduceBlockV2(t *testing.T) { proposerSlashings := make([]*ethpbalpha.ProposerSlashing, params.BeaconConfig().MaxProposerSlashings) for i := types.ValidatorIndex(0); uint64(i) < params.BeaconConfig().MaxProposerSlashings; i++ { - proposerSlashing, err := sharedtestutil.GenerateProposerSlashingForValidator( + proposerSlashing, err := util.GenerateProposerSlashingForValidator( beaconState, privKeys[i], i, /* validator index */ @@ -535,7 +535,7 @@ func TestProduceBlockV2(t *testing.T) { attSlashings := make([]*ethpbalpha.AttesterSlashing, params.BeaconConfig().MaxAttesterSlashings) for i := uint64(0); i < params.BeaconConfig().MaxAttesterSlashings; i++ { - attesterSlashing, err := sharedtestutil.GenerateAttesterSlashingForValidator( + attesterSlashing, err := util.GenerateAttesterSlashingForValidator( beaconState, privKeys[i+params.BeaconConfig().MaxProposerSlashings], types.ValidatorIndex(i+params.BeaconConfig().MaxProposerSlashings), /* validator index */ @@ -549,7 +549,7 @@ func TestProduceBlockV2(t *testing.T) { v1Server := &Server{ V1Alpha1Server: v1Alpha1Server, } - randaoReveal, err := sharedtestutil.RandaoReveal(beaconState, 0, privKeys) + randaoReveal, err := util.RandaoReveal(beaconState, 0, privKeys) require.NoError(t, err) graffiti := bytesutil.ToBytes32([]byte("eth2")) req := ðpbv1.ProduceBlockRequest{ @@ -591,7 +591,7 @@ func TestProduceBlockV2(t *testing.T) { bc.AltairForkEpoch = types.Epoch(0) params.OverrideBeaconConfig(bc) - beaconState, privKeys := sharedtestutil.DeterministicGenesisStateAltair(t, params.BeaconConfig().SyncCommitteeSize) + beaconState, privKeys := util.DeterministicGenesisStateAltair(t, params.BeaconConfig().SyncCommitteeSize) syncCommittee, err := altair.NextSyncCommittee(context.Background(), beaconState) require.NoError(t, err) require.NoError(t, beaconState.SetCurrentSyncCommittee(syncCommittee)) @@ -599,7 +599,7 @@ func TestProduceBlockV2(t *testing.T) { stateRoot, err := beaconState.HashTreeRoot(ctx) require.NoError(t, err, "Could not hash genesis state") - genesisBlock := sharedtestutil.NewBeaconBlockAltair() + genesisBlock := util.NewBeaconBlockAltair() genesisBlock.Block.StateRoot = stateRoot[:] wrappedAltairBlock, err := wrapper.WrappedAltairSignedBeaconBlock(genesisBlock) require.NoError(t, err) @@ -627,7 +627,7 @@ func TestProduceBlockV2(t *testing.T) { proposerSlashings := make([]*ethpbalpha.ProposerSlashing, params.BeaconConfig().MaxProposerSlashings) for i := types.ValidatorIndex(0); uint64(i) < params.BeaconConfig().MaxProposerSlashings; i++ { - proposerSlashing, err := sharedtestutil.GenerateProposerSlashingForValidator( + proposerSlashing, err := util.GenerateProposerSlashingForValidator( beaconState, privKeys[i], i, /* validator index */ @@ -640,7 +640,7 @@ func TestProduceBlockV2(t *testing.T) { attSlashings := make([]*ethpbalpha.AttesterSlashing, params.BeaconConfig().MaxAttesterSlashings) for i := uint64(0); i < params.BeaconConfig().MaxAttesterSlashings; i++ { - attesterSlashing, err := sharedtestutil.GenerateAttesterSlashingForValidator( + attesterSlashing, err := util.GenerateAttesterSlashingForValidator( beaconState, privKeys[i+params.BeaconConfig().MaxProposerSlashings], types.ValidatorIndex(i+params.BeaconConfig().MaxProposerSlashings), /* validator index */ @@ -682,7 +682,7 @@ func TestProduceBlockV2(t *testing.T) { v1Server := &Server{ V1Alpha1Server: v1Alpha1Server, } - randaoReveal, err := sharedtestutil.RandaoReveal(beaconState, 0, privKeys) + randaoReveal, err := util.RandaoReveal(beaconState, 0, privKeys) require.NoError(t, err) graffiti := bytesutil.ToBytes32([]byte("eth2")) @@ -724,11 +724,11 @@ func TestProduceBlockV2(t *testing.T) { } func TestProduceAttestationData(t *testing.T) { - block := sharedtestutil.NewBeaconBlock() + block := util.NewBeaconBlock() block.Block.Slot = 3*params.BeaconConfig().SlotsPerEpoch + 1 - targetBlock := sharedtestutil.NewBeaconBlock() + targetBlock := util.NewBeaconBlock() targetBlock.Block.Slot = 1 * params.BeaconConfig().SlotsPerEpoch - justifiedBlock := sharedtestutil.NewBeaconBlock() + justifiedBlock := util.NewBeaconBlock() justifiedBlock.Block.Slot = 2 * params.BeaconConfig().SlotsPerEpoch blockRoot, err := block.Block.HashTreeRoot() require.NoError(t, err, "Could not hash beacon block") @@ -737,7 +737,7 @@ func TestProduceAttestationData(t *testing.T) { targetRoot, err := targetBlock.Block.HashTreeRoot() require.NoError(t, err, "Could not get signing root for target block") slot := 3*params.BeaconConfig().SlotsPerEpoch + 1 - beaconState, err := sharedtestutil.NewBeaconState() + beaconState, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, beaconState.SetSlot(slot)) err = beaconState.SetCurrentJustifiedCheckpoint(ðpbalpha.Checkpoint{ @@ -953,11 +953,11 @@ func TestGetAggregateAttestation_SameSlotAndRoot_ReturnMostAggregationBits(t *te func TestSubmitBeaconCommitteeSubscription(t *testing.T) { ctx := context.Background() - genesis := sharedtestutil.NewBeaconBlock() + genesis := util.NewBeaconBlock() depChainStart := params.BeaconConfig().MinGenesisActiveValidatorCount - deposits, _, err := sharedtestutil.DeterministicDepositsAndKeys(depChainStart) + deposits, _, err := util.DeterministicDepositsAndKeys(depChainStart) require.NoError(t, err) - eth1Data, err := sharedtestutil.DeterministicEth1Data(len(deposits)) + eth1Data, err := util.DeterministicEth1Data(len(deposits)) require.NoError(t, err) bs, err := transition.GenesisBeaconState(context.Background(), deposits, 0, eth1Data) require.NoError(t, err, "Could not set up genesis state") @@ -1094,12 +1094,12 @@ func TestSubmitBeaconCommitteeSubscription_SyncNotReady(t *testing.T) { func TestSubmitSyncCommitteeSubscription(t *testing.T) { ctx := context.Background() - genesis := sharedtestutil.NewBeaconBlock() - deposits, _, err := sharedtestutil.DeterministicDepositsAndKeys(64) + genesis := util.NewBeaconBlock() + deposits, _, err := util.DeterministicDepositsAndKeys(64) require.NoError(t, err) - eth1Data, err := sharedtestutil.DeterministicEth1Data(len(deposits)) + eth1Data, err := util.DeterministicEth1Data(len(deposits)) require.NoError(t, err) - bs, err := sharedtestutil.GenesisBeaconState(context.Background(), deposits, 0, eth1Data) + bs, err := util.GenesisBeaconState(context.Background(), deposits, 0, eth1Data) require.NoError(t, err, "Could not set up genesis state") genesisRoot, err := genesis.Block.HashTreeRoot() require.NoError(t, err, "Could not get signing root") diff --git a/beacon-chain/rpc/prysm/v1alpha1/beacon/BUILD.bazel b/beacon-chain/rpc/prysm/v1alpha1/beacon/BUILD.bazel index 2da66fa5e..ab9535cd5 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/beacon/BUILD.bazel +++ b/beacon-chain/rpc/prysm/v1alpha1/beacon/BUILD.bazel @@ -107,10 +107,10 @@ go_test( "//proto/prysm/v1alpha1/attestation/aggregation/attestations:go_default_library", "//proto/prysm/v1alpha1/block:go_default_library", "//proto/prysm/v1alpha1/wrapper:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", "//testing/mock:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "//time:go_default_library", "@com_github_golang_mock//gomock:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", diff --git a/beacon-chain/rpc/prysm/v1alpha1/beacon/assignments_test.go b/beacon-chain/rpc/prysm/v1alpha1/beacon/assignments_test.go index d97c84073..f7e5f7560 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/beacon/assignments_test.go +++ b/beacon-chain/rpc/prysm/v1alpha1/beacon/assignments_test.go @@ -17,9 +17,9 @@ import ( "github.com/prysmaticlabs/prysm/config/params" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/protobuf/proto" ) @@ -48,10 +48,10 @@ func TestServer_ListAssignments_NoResults(t *testing.T) { db := dbTest.SetupDB(t) ctx := context.Background() - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b))) gRoot, err := b.Block.HashTreeRoot() require.NoError(t, err) @@ -101,11 +101,11 @@ func TestServer_ListAssignments_Pagination_InputOutOfRange(t *testing.T) { }) } - blk := testutil.NewBeaconBlock().Block + blk := util.NewBeaconBlock().Block blockRoot, err := blk.HashTreeRoot() require.NoError(t, err) - s, err := testutil.NewBeaconState() + s, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, s.SetValidators(validators)) require.NoError(t, db.SaveState(ctx, s, blockRoot)) @@ -176,11 +176,11 @@ func TestServer_ListAssignments_Pagination_DefaultPageSize_NoArchive(t *testing. } } - blk := testutil.NewBeaconBlock().Block + blk := util.NewBeaconBlock().Block blockRoot, err := blk.HashTreeRoot() require.NoError(t, err) - s, err := testutil.NewBeaconState() + s, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, s.SetValidators(validators)) require.NoError(t, db.SaveState(ctx, s, blockRoot)) @@ -246,10 +246,10 @@ func TestServer_ListAssignments_FilterPubkeysIndices_NoPagination(t *testing.T) validators = append(validators, val) } - blk := testutil.NewBeaconBlock().Block + blk := util.NewBeaconBlock().Block blockRoot, err := blk.HashTreeRoot() require.NoError(t, err) - s, err := testutil.NewBeaconState() + s, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, s.SetValidators(validators)) require.NoError(t, db.SaveState(ctx, s, blockRoot)) @@ -315,10 +315,10 @@ func TestServer_ListAssignments_CanFilterPubkeysIndices_WithPagination(t *testin validators = append(validators, val) } - blk := testutil.NewBeaconBlock().Block + blk := util.NewBeaconBlock().Block blockRoot, err := blk.HashTreeRoot() require.NoError(t, err) - s, err := testutil.NewBeaconState() + s, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, s.SetValidators(validators)) require.NoError(t, db.SaveState(ctx, s, blockRoot)) diff --git a/beacon-chain/rpc/prysm/v1alpha1/beacon/attestations_test.go b/beacon-chain/rpc/prysm/v1alpha1/beacon/attestations_test.go index 06a08ed55..2d9a80591 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/beacon/attestations_test.go +++ b/beacon-chain/rpc/prysm/v1alpha1/beacon/attestations_test.go @@ -28,10 +28,10 @@ import ( attaggregation "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/attestation/aggregation/attestations" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" "github.com/prysmaticlabs/prysm/testing/mock" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/emptypb" ) @@ -79,7 +79,7 @@ func TestServer_ListAttestations_Genesis(t *testing.T) { }, } - att := testutil.HydrateAttestation(ðpb.Attestation{ + att := util.HydrateAttestation(ðpb.Attestation{ AggregationBits: bitfield.NewBitlist(0), Data: ðpb.AttestationData{ Slot: 2, @@ -88,7 +88,7 @@ func TestServer_ListAttestations_Genesis(t *testing.T) { }) parentRoot := [32]byte{1, 2, 3} - signedBlock := testutil.NewBeaconBlock() + signedBlock := util.NewBeaconBlock() signedBlock.Block.ParentRoot = bytesutil.PadTo(parentRoot[:], 32) signedBlock.Block.Body.Attestations = []*ethpb.Attestation{att} root, err := signedBlock.Block.HashTreeRoot() @@ -117,7 +117,7 @@ func TestServer_ListAttestations_NoPagination(t *testing.T) { count := types.Slot(8) atts := make([]*ethpb.Attestation, 0, count) for i := types.Slot(0); i < count; i++ { - blockExample := testutil.NewBeaconBlock() + blockExample := util.NewBeaconBlock() blockExample.Block.Body.Attestations = []*ethpb.Attestation{ { Signature: make([]byte, 96), @@ -159,7 +159,7 @@ func TestServer_ListAttestations_FiltersCorrectly(t *testing.T) { blocks := []block.SignedBeaconBlock{ wrapper.WrappedPhase0SignedBeaconBlock( - testutil.HydrateSignedBeaconBlock( + util.HydrateSignedBeaconBlock( ðpb.SignedBeaconBlock{ Block: ðpb.BeaconBlock{ Slot: 4, @@ -186,7 +186,7 @@ func TestServer_ListAttestations_FiltersCorrectly(t *testing.T) { }, })), wrapper.WrappedPhase0SignedBeaconBlock( - testutil.HydrateSignedBeaconBlock(ðpb.SignedBeaconBlock{ + util.HydrateSignedBeaconBlock(ðpb.SignedBeaconBlock{ Block: ðpb.BeaconBlock{ Slot: 5 + params.BeaconConfig().SlotsPerEpoch, Body: ðpb.BeaconBlockBody{ @@ -212,7 +212,7 @@ func TestServer_ListAttestations_FiltersCorrectly(t *testing.T) { }, })), wrapper.WrappedPhase0SignedBeaconBlock( - testutil.HydrateSignedBeaconBlock( + util.HydrateSignedBeaconBlock( ðpb.SignedBeaconBlock{ Block: ðpb.BeaconBlock{ Slot: 5, @@ -266,10 +266,10 @@ func TestServer_ListAttestations_Pagination_CustomPageParameters(t *testing.T) { atts := make([]*ethpb.Attestation, 0, count) for i := types.Slot(0); i < params.BeaconConfig().SlotsPerEpoch; i++ { for s := types.CommitteeIndex(0); s < 4; s++ { - blockExample := testutil.NewBeaconBlock() + blockExample := util.NewBeaconBlock() blockExample.Block.Slot = i blockExample.Block.Body.Attestations = []*ethpb.Attestation{ - testutil.HydrateAttestation(ðpb.Attestation{ + util.HydrateAttestation(ðpb.Attestation{ Data: ðpb.AttestationData{ CommitteeIndex: s, Slot: i, @@ -364,11 +364,11 @@ func TestServer_ListAttestations_Pagination_CustomPageParameters(t *testing.T) { func TestServer_ListAttestations_Pagination_OutOfRange(t *testing.T) { db := dbTest.SetupDB(t) ctx := context.Background() - testutil.NewBeaconBlock() + util.NewBeaconBlock() count := types.Slot(1) atts := make([]*ethpb.Attestation, 0, count) for i := types.Slot(0); i < count; i++ { - blockExample := testutil.HydrateSignedBeaconBlock(ðpb.SignedBeaconBlock{ + blockExample := util.HydrateSignedBeaconBlock(ðpb.SignedBeaconBlock{ Block: ðpb.BeaconBlock{ Body: ðpb.BeaconBlockBody{ Attestations: []*ethpb.Attestation{ @@ -424,7 +424,7 @@ func TestServer_ListAttestations_Pagination_DefaultPageSize(t *testing.T) { count := types.Slot(params.BeaconConfig().DefaultPageSize) atts := make([]*ethpb.Attestation, 0, count) for i := types.Slot(0); i < count; i++ { - blockExample := testutil.NewBeaconBlock() + blockExample := util.NewBeaconBlock() blockExample.Block.Body.Attestations = []*ethpb.Attestation{ { Data: ðpb.AttestationData{ @@ -508,7 +508,7 @@ func TestServer_ListIndexedAttestations_GenesisEpoch(t *testing.T) { } else { targetRoot = targetRoot2 } - blockExample := testutil.NewBeaconBlock() + blockExample := util.NewBeaconBlock() blockExample.Block.Body.Attestations = []*ethpb.Attestation{ { Signature: make([]byte, 96), @@ -537,7 +537,7 @@ func TestServer_ListIndexedAttestations_GenesisEpoch(t *testing.T) { // We setup 128 validators. numValidators := uint64(128) - state, _ := testutil.DeterministicGenesisState(t, numValidators) + state, _ := util.DeterministicGenesisState(t, numValidators) // Next up we convert the test attestations to indexed form: indexedAtts := make([]*ethpb.IndexedAttestation, len(atts)+len(atts2)) @@ -637,7 +637,7 @@ func TestServer_ListIndexedAttestations_OldEpoch(t *testing.T) { // We setup 128 validators. numValidators := uint64(128) - state, _ := testutil.DeterministicGenesisState(t, numValidators) + state, _ := util.DeterministicGenesisState(t, numValidators) randaoMixes := make([][]byte, params.BeaconConfig().EpochsPerHistoricalVector) for i := 0; i < len(randaoMixes); i++ { @@ -747,7 +747,7 @@ func TestServer_AttestationPool_Pagination_DefaultPageSize(t *testing.T) { atts := make([]*ethpb.Attestation, params.BeaconConfig().DefaultPageSize+1) for i := 0; i < len(atts); i++ { - att := testutil.NewAttestation() + att := util.NewAttestation() att.Data.Slot = types.Slot(i) atts[i] = att } @@ -769,7 +769,7 @@ func TestServer_AttestationPool_Pagination_CustomPageSize(t *testing.T) { numAtts := 100 atts := make([]*ethpb.Attestation, numAtts) for i := 0; i < len(atts); i++ { - att := testutil.NewAttestation() + att := util.NewAttestation() att.Data.Slot = types.Slot(i) atts[i] = att } @@ -853,8 +853,8 @@ func TestServer_StreamIndexedAttestations_OK(t *testing.T) { ctx := context.Background() numValidators := 64 - headState, privKeys := testutil.DeterministicGenesisState(t, uint64(numValidators)) - b := testutil.NewBeaconBlock() + headState, privKeys := util.DeterministicGenesisState(t, uint64(numValidators)) + b := util.NewBeaconBlock() require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b))) gRoot, err := b.Block.HashTreeRoot() require.NoError(t, err) @@ -1025,9 +1025,9 @@ func TestServer_StreamAttestations_OnSlotTick(t *testing.T) { } atts := []*ethpb.Attestation{ - testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b1101}}), - testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2}, AggregationBits: bitfield.Bitlist{0b1101}}), - testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 3}, AggregationBits: bitfield.Bitlist{0b1101}}), + util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b1101}}), + util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2}, AggregationBits: bitfield.Bitlist{0b1101}}), + util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 3}, AggregationBits: bitfield.Bitlist{0b1101}}), } mockStream := mock.NewMockBeaconChain_StreamAttestationsServer(ctrl) diff --git a/beacon-chain/rpc/prysm/v1alpha1/beacon/blocks_test.go b/beacon-chain/rpc/prysm/v1alpha1/beacon/blocks_test.go index 3f24117bf..19fa2b46c 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/beacon/blocks_test.go +++ b/beacon-chain/rpc/prysm/v1alpha1/beacon/blocks_test.go @@ -23,10 +23,10 @@ import ( ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" "github.com/prysmaticlabs/prysm/testing/mock" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/emptypb" ) @@ -90,7 +90,7 @@ func TestServer_ListBlocks_Genesis(t *testing.T) { // Should return the proper genesis block if it exists. parentRoot := [32]byte{'a'} - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.ParentRoot = parentRoot[:] root, err := blk.Block.HashTreeRoot() require.NoError(t, err) @@ -127,7 +127,7 @@ func TestServer_ListBlocks_Genesis_MultiBlocks(t *testing.T) { } // Should return the proper genesis block if it exists. parentRoot := [32]byte{1, 2, 3} - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.ParentRoot = parentRoot[:] root, err := blk.Block.HashTreeRoot() require.NoError(t, err) @@ -137,7 +137,7 @@ func TestServer_ListBlocks_Genesis_MultiBlocks(t *testing.T) { count := types.Slot(100) blks := make([]block.SignedBeaconBlock, count) for i := types.Slot(0); i < count; i++ { - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = i require.NoError(t, err) blks[i] = wrapper.WrappedPhase0SignedBeaconBlock(b) @@ -167,7 +167,7 @@ func TestServer_ListBlocks_Pagination(t *testing.T) { blks := make([]block.SignedBeaconBlock, count) blkContainers := make([]*ethpb.BeaconBlockContainer, count) for i := types.Slot(0); i < count; i++ { - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = i root, err := b.Block.HashTreeRoot() require.NoError(t, err) @@ -181,7 +181,7 @@ func TestServer_ListBlocks_Pagination(t *testing.T) { } require.NoError(t, db.SaveBlocks(ctx, blks)) - orphanedBlk := testutil.NewBeaconBlock() + orphanedBlk := util.NewBeaconBlock() orphanedBlk.Block.Slot = 300 orphanedBlkRoot, err := orphanedBlk.Block.HashTreeRoot() require.NoError(t, err) @@ -207,7 +207,7 @@ func TestServer_ListBlocks_Pagination(t *testing.T) { BlockContainers: []*ethpb.BeaconBlockContainer{ { Block: ðpb.BeaconBlockContainer_Phase0Block{ - Phase0Block: testutil.HydrateSignedBeaconBlock(ðpb.SignedBeaconBlock{ + Phase0Block: util.HydrateSignedBeaconBlock(ðpb.SignedBeaconBlock{ Block: ðpb.BeaconBlock{ Slot: 5, }, @@ -229,7 +229,7 @@ func TestServer_ListBlocks_Pagination(t *testing.T) { BlockContainers: []*ethpb.BeaconBlockContainer{ { Block: ðpb.BeaconBlockContainer_Phase0Block{ - Phase0Block: testutil.HydrateSignedBeaconBlock(ðpb.SignedBeaconBlock{ + Phase0Block: util.HydrateSignedBeaconBlock(ðpb.SignedBeaconBlock{ Block: ðpb.BeaconBlock{ Slot: 6, }, @@ -248,7 +248,7 @@ func TestServer_ListBlocks_Pagination(t *testing.T) { BlockContainers: []*ethpb.BeaconBlockContainer{ { Block: ðpb.BeaconBlockContainer_Phase0Block{ - Phase0Block: testutil.HydrateSignedBeaconBlock(ðpb.SignedBeaconBlock{ + Phase0Block: util.HydrateSignedBeaconBlock(ðpb.SignedBeaconBlock{ Block: ðpb.BeaconBlock{ Slot: 6, }, @@ -302,7 +302,7 @@ func TestServer_ListBlocks_Pagination(t *testing.T) { BlockContainers: []*ethpb.BeaconBlockContainer{ { Block: ðpb.BeaconBlockContainer_Phase0Block{ - Phase0Block: testutil.HydrateSignedBeaconBlock(ðpb.SignedBeaconBlock{ + Phase0Block: util.HydrateSignedBeaconBlock(ðpb.SignedBeaconBlock{ Block: ðpb.BeaconBlock{ Slot: 300, }, @@ -370,14 +370,14 @@ func TestServer_ListBlocks_Errors(t *testing.T) { func TestServer_GetChainHead_NoFinalizedBlock(t *testing.T) { db := dbTest.SetupDB(t) - s, err := testutil.NewBeaconState() + s, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, s.SetSlot(1)) require.NoError(t, s.SetPreviousJustifiedCheckpoint(ðpb.Checkpoint{Epoch: 3, Root: bytesutil.PadTo([]byte{'A'}, 32)})) require.NoError(t, s.SetCurrentJustifiedCheckpoint(ðpb.Checkpoint{Epoch: 2, Root: bytesutil.PadTo([]byte{'B'}, 32)})) require.NoError(t, s.SetFinalizedCheckpoint(ðpb.Checkpoint{Epoch: 1, Root: bytesutil.PadTo([]byte{'C'}, 32)})) - genBlock := testutil.NewBeaconBlock() + genBlock := util.NewBeaconBlock() genBlock.Block.ParentRoot = bytesutil.PadTo([]byte{'G'}, 32) require.NoError(t, db.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(genBlock))) gRoot, err := genBlock.Block.HashTreeRoot() @@ -410,28 +410,28 @@ func TestServer_GetChainHead(t *testing.T) { defer params.UseMainnetConfig() db := dbTest.SetupDB(t) - genBlock := testutil.NewBeaconBlock() + genBlock := util.NewBeaconBlock() genBlock.Block.ParentRoot = bytesutil.PadTo([]byte{'G'}, 32) require.NoError(t, db.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(genBlock))) gRoot, err := genBlock.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, db.SaveGenesisBlockRoot(context.Background(), gRoot)) - finalizedBlock := testutil.NewBeaconBlock() + finalizedBlock := util.NewBeaconBlock() finalizedBlock.Block.Slot = 1 finalizedBlock.Block.ParentRoot = bytesutil.PadTo([]byte{'A'}, 32) require.NoError(t, db.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(finalizedBlock))) fRoot, err := finalizedBlock.Block.HashTreeRoot() require.NoError(t, err) - justifiedBlock := testutil.NewBeaconBlock() + justifiedBlock := util.NewBeaconBlock() justifiedBlock.Block.Slot = 2 justifiedBlock.Block.ParentRoot = bytesutil.PadTo([]byte{'B'}, 32) require.NoError(t, db.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(justifiedBlock))) jRoot, err := justifiedBlock.Block.HashTreeRoot() require.NoError(t, err) - prevJustifiedBlock := testutil.NewBeaconBlock() + prevJustifiedBlock := util.NewBeaconBlock() prevJustifiedBlock.Block.Slot = 3 prevJustifiedBlock.Block.ParentRoot = bytesutil.PadTo([]byte{'C'}, 32) require.NoError(t, db.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(prevJustifiedBlock))) @@ -446,7 +446,7 @@ func TestServer_GetChainHead(t *testing.T) { }) require.NoError(t, err) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot, err = core.StartSlot(s.PreviousJustifiedCheckpoint().Epoch) require.NoError(t, err) b.Block.Slot++ @@ -500,28 +500,28 @@ func TestServer_StreamChainHead_ContextCanceled(t *testing.T) { func TestServer_StreamChainHead_OnHeadUpdated(t *testing.T) { db := dbTest.SetupDB(t) params.UseMainnetConfig() - genBlock := testutil.NewBeaconBlock() + genBlock := util.NewBeaconBlock() genBlock.Block.ParentRoot = bytesutil.PadTo([]byte{'G'}, 32) require.NoError(t, db.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(genBlock))) gRoot, err := genBlock.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, db.SaveGenesisBlockRoot(context.Background(), gRoot)) - finalizedBlock := testutil.NewBeaconBlock() + finalizedBlock := util.NewBeaconBlock() finalizedBlock.Block.Slot = 32 finalizedBlock.Block.ParentRoot = bytesutil.PadTo([]byte{'A'}, 32) require.NoError(t, db.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(finalizedBlock))) fRoot, err := finalizedBlock.Block.HashTreeRoot() require.NoError(t, err) - justifiedBlock := testutil.NewBeaconBlock() + justifiedBlock := util.NewBeaconBlock() justifiedBlock.Block.Slot = 64 justifiedBlock.Block.ParentRoot = bytesutil.PadTo([]byte{'B'}, 32) require.NoError(t, db.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(justifiedBlock))) jRoot, err := justifiedBlock.Block.HashTreeRoot() require.NoError(t, err) - prevJustifiedBlock := testutil.NewBeaconBlock() + prevJustifiedBlock := util.NewBeaconBlock() prevJustifiedBlock.Block.Slot = 96 prevJustifiedBlock.Block.ParentRoot = bytesutil.PadTo([]byte{'C'}, 32) require.NoError(t, db.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(prevJustifiedBlock))) @@ -536,7 +536,7 @@ func TestServer_StreamChainHead_OnHeadUpdated(t *testing.T) { }) require.NoError(t, err) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot, err = core.StartSlot(s.PreviousJustifiedCheckpoint().Epoch) require.NoError(t, err) @@ -649,8 +649,8 @@ func TestServer_StreamBlocks_ContextCanceled(t *testing.T) { func TestServer_StreamBlocks_OnHeadUpdated(t *testing.T) { ctx := context.Background() - beaconState, privs := testutil.DeterministicGenesisState(t, 32) - b, err := testutil.GenerateFullBlock(beaconState, privs, testutil.DefaultBlockGenConfig(), 1) + beaconState, privs := util.DeterministicGenesisState(t, 32) + b, err := util.GenerateFullBlock(beaconState, privs, util.DefaultBlockGenConfig(), 1) require.NoError(t, err) chainService := &chainMock.ChainService{State: beaconState} server := &Server{ @@ -684,8 +684,8 @@ func TestServer_StreamBlocks_OnHeadUpdated(t *testing.T) { func TestServer_StreamBlocksVerified_OnHeadUpdated(t *testing.T) { db := dbTest.SetupDB(t) ctx := context.Background() - beaconState, privs := testutil.DeterministicGenesisState(t, 32) - b, err := testutil.GenerateFullBlock(beaconState, privs, testutil.DefaultBlockGenConfig(), 1) + beaconState, privs := util.DeterministicGenesisState(t, 32) + b, err := util.GenerateFullBlock(beaconState, privs, util.DefaultBlockGenConfig(), 1) require.NoError(t, err) r, err := b.Block.HashTreeRoot() require.NoError(t, err) @@ -729,7 +729,7 @@ func TestServer_GetWeakSubjectivityCheckpoint(t *testing.T) { ctx := context.Background() // Beacon state. - beaconState, err := testutil.NewBeaconState() + beaconState, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, beaconState.SetSlot(10)) @@ -750,7 +750,7 @@ func TestServer_GetWeakSubjectivityCheckpoint(t *testing.T) { require.NoError(t, beaconState.SetBalances(balances)) // Genesis block. - genesisBlock := testutil.NewBeaconBlock() + genesisBlock := util.NewBeaconBlock() genesisBlockRoot, err := genesisBlock.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(genesisBlock))) @@ -851,7 +851,7 @@ func TestServer_ListBlocksAltair_Genesis(t *testing.T) { // Should return the proper genesis block if it exists. parentRoot := [32]byte{'a'} - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.ParentRoot = parentRoot[:] root, err := blk.Block.HashTreeRoot() require.NoError(t, err) @@ -884,7 +884,7 @@ func TestServer_ListBlocksAltair_Genesis_MultiBlocks(t *testing.T) { } // Should return the proper genesis block if it exists. parentRoot := [32]byte{1, 2, 3} - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.ParentRoot = parentRoot[:] root, err := blk.Block.HashTreeRoot() require.NoError(t, err) @@ -894,7 +894,7 @@ func TestServer_ListBlocksAltair_Genesis_MultiBlocks(t *testing.T) { count := types.Slot(100) blks := make([]block.SignedBeaconBlock, count) for i := types.Slot(0); i < count; i++ { - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = i require.NoError(t, err) blks[i] = wrapper.WrappedPhase0SignedBeaconBlock(b) @@ -924,7 +924,7 @@ func TestServer_ListBlocksAltair_Pagination(t *testing.T) { blks := make([]block.SignedBeaconBlock, count) blkContainers := make([]*ethpb.BeaconBlockContainer, count) for i := types.Slot(0); i < count; i++ { - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = i root, err := b.Block.HashTreeRoot() require.NoError(t, err) @@ -936,7 +936,7 @@ func TestServer_ListBlocksAltair_Pagination(t *testing.T) { } require.NoError(t, db.SaveBlocks(ctx, blks)) - orphanedBlk := testutil.NewBeaconBlock() + orphanedBlk := util.NewBeaconBlock() orphanedBlk.Block.Slot = 300 orphanedBlkRoot, err := orphanedBlk.Block.HashTreeRoot() require.NoError(t, err) @@ -959,7 +959,7 @@ func TestServer_ListBlocksAltair_Pagination(t *testing.T) { QueryFilter: ðpb.ListBlocksRequest_Slot{Slot: 5}, PageSize: 3}, res: ðpb.ListBeaconBlocksResponse{ - BlockContainers: []*ethpb.BeaconBlockContainer{{Block: ðpb.BeaconBlockContainer_Phase0Block{Phase0Block: testutil.HydrateSignedBeaconBlock(ðpb.SignedBeaconBlock{ + BlockContainers: []*ethpb.BeaconBlockContainer{{Block: ðpb.BeaconBlockContainer_Phase0Block{Phase0Block: util.HydrateSignedBeaconBlock(ðpb.SignedBeaconBlock{ Block: ðpb.BeaconBlock{ Slot: 5}})}, BlockRoot: blkContainers[5].BlockRoot, @@ -974,7 +974,7 @@ func TestServer_ListBlocksAltair_Pagination(t *testing.T) { PageSize: 3}, res: ðpb.ListBeaconBlocksResponse{ BlockContainers: []*ethpb.BeaconBlockContainer{{Block: ðpb.BeaconBlockContainer_Phase0Block{ - Phase0Block: testutil.HydrateSignedBeaconBlock(ðpb.SignedBeaconBlock{ + Phase0Block: util.HydrateSignedBeaconBlock(ðpb.SignedBeaconBlock{ Block: ðpb.BeaconBlock{ Slot: 6}})}, BlockRoot: blkContainers[6].BlockRoot, @@ -983,7 +983,7 @@ func TestServer_ListBlocksAltair_Pagination(t *testing.T) { {req: ðpb.ListBlocksRequest{QueryFilter: ðpb.ListBlocksRequest_Root{Root: root6[:]}}, res: ðpb.ListBeaconBlocksResponse{ BlockContainers: []*ethpb.BeaconBlockContainer{{Block: ðpb.BeaconBlockContainer_Phase0Block{ - Phase0Block: testutil.HydrateSignedBeaconBlock(ðpb.SignedBeaconBlock{ + Phase0Block: util.HydrateSignedBeaconBlock(ðpb.SignedBeaconBlock{ Block: ðpb.BeaconBlock{ Slot: 6}})}, BlockRoot: blkContainers[6].BlockRoot, @@ -1027,7 +1027,7 @@ func TestServer_ListBlocksAltair_Pagination(t *testing.T) { PageSize: 3}, res: ðpb.ListBeaconBlocksResponse{ BlockContainers: []*ethpb.BeaconBlockContainer{{Block: ðpb.BeaconBlockContainer_Phase0Block{ - Phase0Block: testutil.HydrateSignedBeaconBlock(ðpb.SignedBeaconBlock{ + Phase0Block: util.HydrateSignedBeaconBlock(ðpb.SignedBeaconBlock{ Block: ðpb.BeaconBlock{ Slot: 300}})}, BlockRoot: orphanedBlkRoot[:], diff --git a/beacon-chain/rpc/prysm/v1alpha1/beacon/committees_test.go b/beacon-chain/rpc/prysm/v1alpha1/beacon/committees_test.go index 909e5f001..1f293b63a 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/beacon/committees_test.go +++ b/beacon-chain/rpc/prysm/v1alpha1/beacon/committees_test.go @@ -15,9 +15,9 @@ import ( "github.com/prysmaticlabs/prysm/config/params" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" prysmTime "github.com/prysmaticlabs/prysm/time" "google.golang.org/protobuf/proto" "gopkg.in/d4l3k/messagediff.v1" @@ -40,7 +40,7 @@ func TestServer_ListBeaconCommittees_CurrentEpoch(t *testing.T) { GenesisTimeFetcher: m, StateGen: stategen.New(db), } - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b))) gRoot, err := b.Block.HashTreeRoot() require.NoError(t, err) @@ -85,7 +85,7 @@ func TestServer_ListBeaconCommittees_PreviousEpoch(t *testing.T) { require.NoError(t, headState.SetRandaoMixes(mixes)) require.NoError(t, headState.SetSlot(params.BeaconConfig().SlotsPerEpoch)) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b))) gRoot, err := b.Block.HashTreeRoot() require.NoError(t, err) @@ -156,7 +156,7 @@ func TestRetrieveCommitteesForRoot(t *testing.T) { GenesisTimeFetcher: m, StateGen: stategen.New(db), } - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b))) gRoot, err := b.Block.HashTreeRoot() require.NoError(t, err) @@ -208,7 +208,7 @@ func setupActiveValidators(t *testing.T, count int) state.BeaconState { WithdrawalCredentials: make([]byte, 32), }) } - s, err := testutil.NewBeaconState() + s, err := util.NewBeaconState() require.NoError(t, err) if err := s.SetValidators(validators); err != nil { t.Error(err) diff --git a/beacon-chain/rpc/prysm/v1alpha1/beacon/config_test.go b/beacon-chain/rpc/prysm/v1alpha1/beacon/config_test.go index e08dc3479..51c8712fa 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/beacon/config_test.go +++ b/beacon-chain/rpc/prysm/v1alpha1/beacon/config_test.go @@ -7,8 +7,8 @@ import ( "testing" "github.com/prysmaticlabs/prysm/config/params" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" "google.golang.org/protobuf/types/known/emptypb" ) diff --git a/beacon-chain/rpc/prysm/v1alpha1/beacon/slashings_test.go b/beacon-chain/rpc/prysm/v1alpha1/beacon/slashings_test.go index ada2b24e5..5f00d0a6f 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/beacon/slashings_test.go +++ b/beacon-chain/rpc/prysm/v1alpha1/beacon/slashings_test.go @@ -7,20 +7,20 @@ import ( types "github.com/prysmaticlabs/eth2-types" "github.com/prysmaticlabs/prysm/config/features" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/protobuf/proto" mock "github.com/prysmaticlabs/prysm/beacon-chain/blockchain/testing" "github.com/prysmaticlabs/prysm/beacon-chain/operations/slashings" mockp2p "github.com/prysmaticlabs/prysm/beacon-chain/p2p/testing" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestServer_SubmitProposerSlashing(t *testing.T) { ctx := context.Background() - st, privs := testutil.DeterministicGenesisState(t, 64) + st, privs := util.DeterministicGenesisState(t, 64) slashedVal, err := st.ValidatorAtIndex(5) require.NoError(t, err) // We mark the validator at index 5 as already slashed. @@ -38,7 +38,7 @@ func TestServer_SubmitProposerSlashing(t *testing.T) { // We want a proposer slashing for validator with index 2 to // be included in the pool. - slashing, err := testutil.GenerateProposerSlashingForValidator(st, privs[2], types.ValidatorIndex(2)) + slashing, err := util.GenerateProposerSlashingForValidator(st, privs[2], types.ValidatorIndex(2)) require.NoError(t, err) _, err = bs.SubmitProposerSlashing(ctx, slashing) @@ -49,7 +49,7 @@ func TestServer_SubmitProposerSlashing(t *testing.T) { func TestServer_SubmitAttesterSlashing(t *testing.T) { ctx := context.Background() // We mark the validators at index 5, 6 as already slashed. - st, privs := testutil.DeterministicGenesisState(t, 64) + st, privs := util.DeterministicGenesisState(t, 64) slashedVal, err := st.ValidatorAtIndex(5) require.NoError(t, err) @@ -66,7 +66,7 @@ func TestServer_SubmitAttesterSlashing(t *testing.T) { Broadcaster: mb, } - slashing, err := testutil.GenerateAttesterSlashingForValidator(st, privs[2], types.ValidatorIndex(2)) + slashing, err := util.GenerateAttesterSlashingForValidator(st, privs[2], types.ValidatorIndex(2)) require.NoError(t, err) // We want the intersection of the slashing attesting indices @@ -81,7 +81,7 @@ func TestServer_SubmitProposerSlashing_DontBroadcast(t *testing.T) { resetCfg := features.InitWithReset(&features.Flags{DisableBroadcastSlashings: true}) defer resetCfg() ctx := context.Background() - st, privs := testutil.DeterministicGenesisState(t, 64) + st, privs := util.DeterministicGenesisState(t, 64) slashedVal, err := st.ValidatorAtIndex(5) require.NoError(t, err) // We mark the validator at index 5 as already slashed. @@ -102,7 +102,7 @@ func TestServer_SubmitProposerSlashing_DontBroadcast(t *testing.T) { wanted := ðpb.SubmitSlashingResponse{ SlashedIndices: []types.ValidatorIndex{2}, } - slashing, err := testutil.GenerateProposerSlashingForValidator(st, privs[2], types.ValidatorIndex(2)) + slashing, err := util.GenerateProposerSlashingForValidator(st, privs[2], types.ValidatorIndex(2)) require.NoError(t, err) res, err := bs.SubmitProposerSlashing(ctx, slashing) @@ -113,7 +113,7 @@ func TestServer_SubmitProposerSlashing_DontBroadcast(t *testing.T) { assert.Equal(t, false, mb.BroadcastCalled, "Expected broadcast not to be called by default") - slashing, err = testutil.GenerateProposerSlashingForValidator(st, privs[5], types.ValidatorIndex(5)) + slashing, err = util.GenerateProposerSlashingForValidator(st, privs[5], types.ValidatorIndex(5)) require.NoError(t, err) // We do not want a proposer slashing for an already slashed validator @@ -127,7 +127,7 @@ func TestServer_SubmitAttesterSlashing_DontBroadcast(t *testing.T) { defer resetCfg() ctx := context.Background() // We mark the validators at index 5, 6 as already slashed. - st, privs := testutil.DeterministicGenesisState(t, 64) + st, privs := util.DeterministicGenesisState(t, 64) slashedVal, err := st.ValidatorAtIndex(5) require.NoError(t, err) @@ -144,7 +144,7 @@ func TestServer_SubmitAttesterSlashing_DontBroadcast(t *testing.T) { Broadcaster: mb, } - slashing, err := testutil.GenerateAttesterSlashingForValidator(st, privs[2], types.ValidatorIndex(2)) + slashing, err := util.GenerateAttesterSlashingForValidator(st, privs[2], types.ValidatorIndex(2)) require.NoError(t, err) // We want the intersection of the slashing attesting indices @@ -160,7 +160,7 @@ func TestServer_SubmitAttesterSlashing_DontBroadcast(t *testing.T) { } assert.Equal(t, false, mb.BroadcastCalled, "Expected broadcast not to be called by default") - slashing, err = testutil.GenerateAttesterSlashingForValidator(st, privs[5], types.ValidatorIndex(5)) + slashing, err = util.GenerateAttesterSlashingForValidator(st, privs[5], types.ValidatorIndex(5)) require.NoError(t, err) // If any of the attesting indices in the slashing object have already // been slashed, we should fail to insert properly into the attester slashing pool. diff --git a/beacon-chain/rpc/prysm/v1alpha1/beacon/validators_stream_test.go b/beacon-chain/rpc/prysm/v1alpha1/beacon/validators_stream_test.go index b3a94dc24..9cdc5c810 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/beacon/validators_stream_test.go +++ b/beacon-chain/rpc/prysm/v1alpha1/beacon/validators_stream_test.go @@ -7,9 +7,9 @@ import ( types "github.com/prysmaticlabs/eth2-types" mock "github.com/prysmaticlabs/prysm/beacon-chain/blockchain/testing" "github.com/prysmaticlabs/prysm/config/params" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestInfostream_EpochToTimestamp(t *testing.T) { @@ -69,7 +69,7 @@ func TestInfostream_HandleSetValidatorKeys(t *testing.T) { }, } - s, err := testutil.NewBeaconState() + s, err := util.NewBeaconState() require.NoError(t, err) is := &infostream{ @@ -119,7 +119,7 @@ func TestInfostream_HandleAddValidatorKeys(t *testing.T) { }, } - s, err := testutil.NewBeaconState() + s, err := util.NewBeaconState() require.NoError(t, err) is := &infostream{ pubKeysMutex: &sync.RWMutex{}, @@ -167,7 +167,7 @@ func TestInfostream_HandleRemoveValidatorKeys(t *testing.T) { }, } - s, err := testutil.NewBeaconState() + s, err := util.NewBeaconState() require.NoError(t, err) is := &infostream{ diff --git a/beacon-chain/rpc/prysm/v1alpha1/beacon/validators_test.go b/beacon-chain/rpc/prysm/v1alpha1/beacon/validators_test.go index 0c8fd56d6..06d948f3b 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/beacon/validators_test.go +++ b/beacon-chain/rpc/prysm/v1alpha1/beacon/validators_test.go @@ -26,9 +26,9 @@ import ( "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" prysmTime "github.com/prysmaticlabs/prysm/time" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/emptypb" @@ -41,7 +41,7 @@ const ( func TestServer_GetValidatorActiveSetChanges_CannotRequestFutureEpoch(t *testing.T) { beaconDB := dbTest.SetupDB(t) ctx := context.Background() - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, st.SetSlot(0)) bs := &Server{ @@ -68,7 +68,7 @@ func TestServer_ListValidatorBalances_CannotRequestFutureEpoch(t *testing.T) { beaconDB := dbTest.SetupDB(t) ctx := context.Background() - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, st.SetSlot(0)) bs := &Server{ @@ -95,7 +95,7 @@ func TestServer_ListValidatorBalances_NoResults(t *testing.T) { beaconDB := dbTest.SetupDB(t) ctx := context.Background() - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, st.SetSlot(0)) bs := &Server{ @@ -103,9 +103,9 @@ func TestServer_ListValidatorBalances_NoResults(t *testing.T) { StateGen: stategen.New(beaconDB), } - headState, err := testutil.NewBeaconState() + headState, err := util.NewBeaconState() require.NoError(t, err) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b))) gRoot, err := b.Block.HashTreeRoot() require.NoError(t, err) @@ -152,12 +152,12 @@ func TestServer_ListValidatorBalances_DefaultResponse_NoArchive(t *testing.T) { Status: "EXITED", } } - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, st.SetSlot(0)) require.NoError(t, st.SetValidators(validators)) require.NoError(t, st.SetBalances(balances)) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b))) gRoot, err := b.Block.HashTreeRoot() require.NoError(t, err) @@ -185,7 +185,7 @@ func TestServer_ListValidatorBalances_PaginationOutOfRange(t *testing.T) { ctx := context.Background() _, _, headState := setupValidators(t, beaconDB, 100) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() gRoot, err := b.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, beaconDB.SaveGenesisBlockRoot(ctx, gRoot)) @@ -233,7 +233,7 @@ func TestServer_ListValidatorBalances_Pagination_Default(t *testing.T) { ctx := context.Background() _, _, headState := setupValidators(t, beaconDB, 100) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() gRoot, err := b.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, beaconDB.SaveGenesisBlockRoot(ctx, gRoot)) @@ -316,7 +316,7 @@ func TestServer_ListValidatorBalances_Pagination_CustomPageSizes(t *testing.T) { count := 1000 _, _, headState := setupValidators(t, beaconDB, count) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() gRoot, err := b.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, beaconDB.SaveGenesisBlockRoot(ctx, gRoot)) @@ -383,7 +383,7 @@ func TestServer_ListValidatorBalances_OutOfRange(t *testing.T) { ctx := context.Background() _, _, headState := setupValidators(t, beaconDB, 1) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() gRoot, err := b.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, beaconDB.SaveGenesisBlockRoot(ctx, gRoot)) @@ -407,7 +407,7 @@ func TestServer_ListValidators_CannotRequestFutureEpoch(t *testing.T) { beaconDB := dbTest.SetupDB(t) ctx := context.Background() - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, st.SetSlot(0)) bs := &Server{ @@ -471,7 +471,7 @@ func TestServer_ListValidators_NoResults(t *testing.T) { beaconDB := dbTest.SetupDB(t) ctx := context.Background() - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, st.SetSlot(0)) gRoot := [32]byte{'g'} @@ -540,7 +540,7 @@ func TestServer_ListValidators_OnlyActiveValidators(t *testing.T) { } } } - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, st.SetValidators(validators)) require.NoError(t, st.SetBalances(balances)) @@ -556,7 +556,7 @@ func TestServer_ListValidators_OnlyActiveValidators(t *testing.T) { StateGen: stategen.New(beaconDB), } - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b))) gRoot, err := b.Block.HashTreeRoot() require.NoError(t, err) @@ -608,7 +608,7 @@ func TestServer_ListValidators_InactiveInTheMiddle(t *testing.T) { validators[0].ActivationEpoch = params.BeaconConfig().FarFutureEpoch activeValidators[0].Validator.ActivationEpoch = params.BeaconConfig().FarFutureEpoch - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, st.SetValidators(validators)) require.NoError(t, st.SetBalances(balances)) @@ -624,7 +624,7 @@ func TestServer_ListValidators_InactiveInTheMiddle(t *testing.T) { StateGen: stategen.New(beaconDB), } - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b))) gRoot, err := b.Block.HashTreeRoot() require.NoError(t, err) @@ -645,7 +645,7 @@ func TestServer_ListValidatorBalances_UnknownValidatorInResponse(t *testing.T) { ctx := context.Background() _, _, headState := setupValidators(t, beaconDB, 4) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() gRoot, err := b.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, beaconDB.SaveGenesisBlockRoot(ctx, gRoot)) @@ -1026,11 +1026,11 @@ func TestServer_ListValidators_FromOldEpoch(t *testing.T) { } } - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, st.SetSlot(20*params.BeaconConfig().SlotsPerEpoch)) require.NoError(t, st.SetValidators(validators)) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b))) gRoot, err := b.Block.HashTreeRoot() require.NoError(t, err) @@ -1094,12 +1094,12 @@ func TestServer_ListValidators_ProcessHeadStateSlots(t *testing.T) { } } - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, st.SetSlot(headSlot)) require.NoError(t, st.SetValidators(validators)) require.NoError(t, st.SetBalances(balances)) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b))) gRoot, err := b.Block.HashTreeRoot() require.NoError(t, err) @@ -1140,7 +1140,7 @@ func TestServer_GetValidator(t *testing.T) { } } - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, st.SetValidators(validators)) @@ -1215,7 +1215,7 @@ func TestServer_GetValidatorActiveSetChanges(t *testing.T) { ctx := context.Background() validators := make([]*ethpb.Validator, 8) - headState, err := testutil.NewBeaconState() + headState, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, headState.SetSlot(0)) require.NoError(t, headState.SetValidators(validators)) @@ -1253,7 +1253,7 @@ func TestServer_GetValidatorActiveSetChanges(t *testing.T) { }) require.NoError(t, err) } - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b))) gRoot, err := b.Block.HashTreeRoot() @@ -1373,7 +1373,7 @@ func TestServer_GetValidatorQueue_ExitedValidatorLeavesQueue(t *testing.T) { }, } - headState, err := testutil.NewBeaconState() + headState, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, headState.SetValidators(validators)) require.NoError(t, headState.SetFinalizedCheckpoint(ðpb.Checkpoint{Epoch: 0, Root: make([]byte, 32)})) @@ -1461,7 +1461,7 @@ func TestServer_GetValidatorParticipation_CannotRequestFutureEpoch(t *testing.T) beaconDB := dbTest.SetupDB(t) ctx := context.Background() - headState, err := testutil.NewBeaconState() + headState, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, headState.SetSlot(0)) bs := &Server{ @@ -1489,7 +1489,7 @@ func TestServer_GetValidatorParticipation_UnknownState(t *testing.T) { beaconDB := dbTest.SetupDB(t) ctx := context.Background() - headState, err := testutil.NewBeaconState() + headState, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, headState.SetSlot(0)) epoch := types.Epoch(50) @@ -1542,11 +1542,11 @@ func TestServer_GetValidatorParticipation_CurrentAndPrevEpoch(t *testing.T) { } atts := []*ethpb.PendingAttestation{{ - Data: testutil.HydrateAttestationData(ðpb.AttestationData{}), + Data: util.HydrateAttestationData(ðpb.AttestationData{}), InclusionDelay: 1, AggregationBits: bitfield.NewBitlist(validatorCount / uint64(params.BeaconConfig().SlotsPerEpoch)), }} - headState, err := testutil.NewBeaconState() + headState, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, headState.SetSlot(2*params.BeaconConfig().SlotsPerEpoch-1)) require.NoError(t, headState.SetValidators(validators)) @@ -1554,7 +1554,7 @@ func TestServer_GetValidatorParticipation_CurrentAndPrevEpoch(t *testing.T) { require.NoError(t, headState.AppendCurrentEpochAttestations(atts[0])) require.NoError(t, headState.AppendPreviousEpochAttestations(atts[0])) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = 16 require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b))) bRoot, err := b.Block.HashTreeRoot() @@ -1621,11 +1621,11 @@ func TestServer_GetValidatorParticipation_OrphanedUntilGenesis(t *testing.T) { } atts := []*ethpb.PendingAttestation{{ - Data: testutil.HydrateAttestationData(ðpb.AttestationData{}), + Data: util.HydrateAttestationData(ðpb.AttestationData{}), InclusionDelay: 1, AggregationBits: bitfield.NewBitlist(validatorCount / uint64(params.BeaconConfig().SlotsPerEpoch)), }} - headState, err := testutil.NewBeaconState() + headState, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, headState.SetSlot(2*params.BeaconConfig().SlotsPerEpoch-1)) require.NoError(t, headState.SetValidators(validators)) @@ -1633,7 +1633,7 @@ func TestServer_GetValidatorParticipation_OrphanedUntilGenesis(t *testing.T) { require.NoError(t, headState.AppendCurrentEpochAttestations(atts[0])) require.NoError(t, headState.AppendPreviousEpochAttestations(atts[0])) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b))) bRoot, err := b.Block.HashTreeRoot() require.NoError(t, beaconDB.SaveStateSummary(ctx, ðpb.StateSummary{Root: bRoot[:]})) @@ -1690,12 +1690,12 @@ func TestServer_GetValidatorParticipation_CurrentAndPrevEpochAltair(t *testing.T for i := range bits { bits[i] = 0xff } - headState, _ := testutil.DeterministicGenesisStateAltair(t, validatorCount) + headState, _ := util.DeterministicGenesisStateAltair(t, validatorCount) require.NoError(t, headState.SetSlot(2*params.BeaconConfig().SlotsPerEpoch-1)) require.NoError(t, headState.SetCurrentParticipationBits(bits)) require.NoError(t, headState.SetPreviousParticipationBits(bits)) - b := testutil.NewBeaconBlockAltair() + b := util.NewBeaconBlockAltair() b.Block.Slot = 16 ab, err := wrapper.WrappedAltairSignedBeaconBlock(b) require.NoError(t, err) @@ -1762,7 +1762,7 @@ func TestGetValidatorPerformance_OK(t *testing.T) { ctx := context.Background() epoch := types.Epoch(1) - headState, err := testutil.NewBeaconState() + headState, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, headState.SetSlot(params.BeaconConfig().SlotsPerEpoch.Mul(uint64(epoch+1)))) atts := make([]*ethpb.PendingAttestation, 3) @@ -1841,7 +1841,7 @@ func TestGetValidatorPerformance_Indices(t *testing.T) { epoch := types.Epoch(1) defaultBal := params.BeaconConfig().MaxEffectiveBalance extraBal := params.BeaconConfig().MaxEffectiveBalance + params.BeaconConfig().GweiPerEth - headState, err := testutil.NewBeaconState() + headState, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, headState.SetSlot(params.BeaconConfig().SlotsPerEpoch.Mul(uint64(epoch+1)))) balances := []uint64{defaultBal, extraBal, extraBal + params.BeaconConfig().GweiPerEth} @@ -1913,7 +1913,7 @@ func TestGetValidatorPerformance_IndicesPubkeys(t *testing.T) { epoch := types.Epoch(1) defaultBal := params.BeaconConfig().MaxEffectiveBalance extraBal := params.BeaconConfig().MaxEffectiveBalance + params.BeaconConfig().GweiPerEth - headState, err := testutil.NewBeaconState() + headState, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, headState.SetSlot(params.BeaconConfig().SlotsPerEpoch.Mul(uint64(epoch+1)))) balances := []uint64{defaultBal, extraBal, extraBal + params.BeaconConfig().GweiPerEth} @@ -1989,7 +1989,7 @@ func TestGetValidatorPerformanceAltair_OK(t *testing.T) { ctx := context.Background() epoch := types.Epoch(1) - headState, _ := testutil.DeterministicGenesisStateAltair(t, 32) + headState, _ := util.DeterministicGenesisStateAltair(t, 32) require.NoError(t, headState.SetSlot(params.BeaconConfig().SlotsPerEpoch.Mul(uint64(epoch+1)))) defaultBal := params.BeaconConfig().MaxEffectiveBalance @@ -2083,7 +2083,7 @@ func setupValidators(t testing.TB, _ db.Database, count int) ([]*ethpb.Validator WithdrawalCredentials: make([]byte, 32), }) } - s, err := testutil.NewBeaconState() + s, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, s.SetValidators(validators)) require.NoError(t, s.SetBalances(balances)) @@ -2108,13 +2108,13 @@ func TestServer_GetIndividualVotes_ValidatorsDontExist(t *testing.T) { ctx := context.Background() validators := uint64(64) - stateWithValidators, _ := testutil.DeterministicGenesisState(t, validators) - beaconState, err := testutil.NewBeaconState() + stateWithValidators, _ := util.DeterministicGenesisState(t, validators) + beaconState, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, beaconState.SetValidators(stateWithValidators.Validators())) require.NoError(t, beaconState.SetSlot(params.BeaconConfig().SlotsPerEpoch)) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = params.BeaconConfig().SlotsPerEpoch require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b))) gRoot, err := b.Block.HashTreeRoot() @@ -2181,16 +2181,16 @@ func TestServer_GetIndividualVotes_Working(t *testing.T) { ctx := context.Background() validators := uint64(32) - stateWithValidators, _ := testutil.DeterministicGenesisState(t, validators) - beaconState, err := testutil.NewBeaconState() + stateWithValidators, _ := util.DeterministicGenesisState(t, validators) + beaconState, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, beaconState.SetValidators(stateWithValidators.Validators())) require.NoError(t, beaconState.SetSlot(params.BeaconConfig().SlotsPerEpoch)) bf := bitfield.NewBitlist(validators / uint64(params.BeaconConfig().SlotsPerEpoch)) - att1 := testutil.NewAttestation() + att1 := util.NewAttestation() att1.AggregationBits = bf - att2 := testutil.NewAttestation() + att2 := util.NewAttestation() att2.AggregationBits = bf rt := [32]byte{'A'} att1.Data.Target.Root = rt[:] @@ -2210,7 +2210,7 @@ func TestServer_GetIndividualVotes_Working(t *testing.T) { }) require.NoError(t, err) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = params.BeaconConfig().SlotsPerEpoch require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b))) gRoot, err := b.Block.HashTreeRoot() @@ -2343,7 +2343,7 @@ func TestServer_isSlotCanonical(t *testing.T) { var roots [][32]byte cRoots := map[[32]byte]bool{} for i := 1; i < 100; i++ { - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = types.Slot(i) require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b))) br, err := b.Block.HashTreeRoot() @@ -2379,7 +2379,7 @@ func TestServer_isSlotCanonical_MultipleBlocks(t *testing.T) { var roots [][32]byte cRoots := map[[32]byte]bool{} for i := 1; i < 100; i++ { - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = types.Slot(i) require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b))) br, err := b.Block.HashTreeRoot() @@ -2387,7 +2387,7 @@ func TestServer_isSlotCanonical_MultipleBlocks(t *testing.T) { if i%2 == 0 { cRoots[br] = true // Save a block in the same slot - b = testutil.NewBeaconBlock() + b = util.NewBeaconBlock() b.Block.Slot = types.Slot(i) b.Block.ProposerIndex = 100 require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b))) diff --git a/beacon-chain/rpc/prysm/v1alpha1/debug/BUILD.bazel b/beacon-chain/rpc/prysm/v1alpha1/debug/BUILD.bazel index c0efae0c4..7ac4f3f44 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/debug/BUILD.bazel +++ b/beacon-chain/rpc/prysm/v1alpha1/debug/BUILD.bazel @@ -54,9 +54,9 @@ go_test( "//config/params:go_default_library", "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/wrapper:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", "@io_bazel_rules_go//proto/wkt:empty_go_proto", diff --git a/beacon-chain/rpc/prysm/v1alpha1/debug/block_test.go b/beacon-chain/rpc/prysm/v1alpha1/debug/block_test.go index 111943d51..38a03250a 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/debug/block_test.go +++ b/beacon-chain/rpc/prysm/v1alpha1/debug/block_test.go @@ -14,16 +14,16 @@ import ( ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" pbrpc "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestServer_GetBlock(t *testing.T) { db := dbTest.SetupDB(t) ctx := context.Background() - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = 100 require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b))) blockRoot, err := b.Block.HashTreeRoot() @@ -58,7 +58,7 @@ func TestServer_GetAttestationInclusionSlot(t *testing.T) { GenesisTimeFetcher: &mock.ChainService{Genesis: time.Now().Add(time.Duration(-1*offset) * time.Second)}, } - s, _ := testutil.DeterministicGenesisState(t, 2048) + s, _ := util.DeterministicGenesisState(t, 2048) tr := [32]byte{'a'} require.NoError(t, bs.StateGen.SaveState(ctx, tr, s)) c, err := helpers.BeaconCommitteeFromState(s, 1, 0) @@ -74,7 +74,7 @@ func TestServer_GetAttestationInclusionSlot(t *testing.T) { AggregationBits: bitfield.Bitlist{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01}, Signature: make([]byte, 96), } - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = 2 b.Block.Body.Attestations = []*ethpb.Attestation{a} require.NoError(t, bs.BeaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b))) diff --git a/beacon-chain/rpc/prysm/v1alpha1/debug/forkchoice_test.go b/beacon-chain/rpc/prysm/v1alpha1/debug/forkchoice_test.go index ca410ae0a..4bd4fc9f5 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/debug/forkchoice_test.go +++ b/beacon-chain/rpc/prysm/v1alpha1/debug/forkchoice_test.go @@ -7,8 +7,8 @@ import ( "github.com/golang/protobuf/ptypes/empty" mock "github.com/prysmaticlabs/prysm/beacon-chain/blockchain/testing" "github.com/prysmaticlabs/prysm/beacon-chain/forkchoice/protoarray" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestServer_GetForkChoice(t *testing.T) { diff --git a/beacon-chain/rpc/prysm/v1alpha1/debug/p2p_test.go b/beacon-chain/rpc/prysm/v1alpha1/debug/p2p_test.go index 777247f10..d9acd4836 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/debug/p2p_test.go +++ b/beacon-chain/rpc/prysm/v1alpha1/debug/p2p_test.go @@ -7,8 +7,8 @@ import ( "github.com/golang/protobuf/ptypes/empty" mockP2p "github.com/prysmaticlabs/prysm/beacon-chain/p2p/testing" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestDebugServer_GetPeer(t *testing.T) { diff --git a/beacon-chain/rpc/prysm/v1alpha1/debug/state_test.go b/beacon-chain/rpc/prysm/v1alpha1/debug/state_test.go index 98b1521b1..08a28b097 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/debug/state_test.go +++ b/beacon-chain/rpc/prysm/v1alpha1/debug/state_test.go @@ -10,19 +10,19 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/state/stategen" pbrpc "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestServer_GetBeaconState(t *testing.T) { db := dbTest.SetupDB(t) ctx := context.Background() - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) slot := types.Slot(100) require.NoError(t, st.SetSlot(slot)) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = slot require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b))) gRoot, err := b.Block.HashTreeRoot() diff --git a/beacon-chain/rpc/prysm/v1alpha1/node/BUILD.bazel b/beacon-chain/rpc/prysm/v1alpha1/node/BUILD.bazel index c21a769eb..c85fa37bb 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/node/BUILD.bazel +++ b/beacon-chain/rpc/prysm/v1alpha1/node/BUILD.bazel @@ -37,9 +37,9 @@ go_test( "//encoding/bytesutil:go_default_library", "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "@com_github_ethereum_go_ethereum//common:go_default_library", "@com_github_ethereum_go_ethereum//crypto:go_default_library", "@com_github_ethereum_go_ethereum//p2p/enode:go_default_library", diff --git a/beacon-chain/rpc/prysm/v1alpha1/node/server_test.go b/beacon-chain/rpc/prysm/v1alpha1/node/server_test.go index 3deaff230..501a46325 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/node/server_test.go +++ b/beacon-chain/rpc/prysm/v1alpha1/node/server_test.go @@ -16,9 +16,9 @@ import ( "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/runtime/version" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/grpc" "google.golang.org/grpc/reflection" "google.golang.org/protobuf/types/known/emptypb" @@ -44,7 +44,7 @@ func TestNodeServer_GetGenesis(t *testing.T) { ctx := context.Background() addr := common.Address{1, 2, 3} require.NoError(t, db.SaveDepositContractAddress(ctx, addr)) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) genValRoot := bytesutil.ToBytes32([]byte("I am root")) ns := &Server{ diff --git a/beacon-chain/rpc/prysm/v1alpha1/validator/BUILD.bazel b/beacon-chain/rpc/prysm/v1alpha1/validator/BUILD.bazel index cff7f92fa..5056a7a94 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/validator/BUILD.bazel +++ b/beacon-chain/rpc/prysm/v1alpha1/validator/BUILD.bazel @@ -129,10 +129,10 @@ go_test( "//proto/prysm/v1alpha1/attestation:go_default_library", "//proto/prysm/v1alpha1/attestation/aggregation/attestations:go_default_library", "//proto/prysm/v1alpha1/wrapper:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", "//testing/mock:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "//time:go_default_library", "@com_github_golang_mock//gomock:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", diff --git a/beacon-chain/rpc/prysm/v1alpha1/validator/aggregator_test.go b/beacon-chain/rpc/prysm/v1alpha1/validator/aggregator_test.go index 369d5093f..c1a753ec1 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/validator/aggregator_test.go +++ b/beacon-chain/rpc/prysm/v1alpha1/validator/aggregator_test.go @@ -20,9 +20,9 @@ import ( ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/attestation" attaggregation "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/attestation/aggregation/attestations" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestSubmitAggregateAndProof_Syncing(t *testing.T) { @@ -101,7 +101,7 @@ func TestSubmitAggregateAndProof_UnaggregateOk(t *testing.T) { ctx := context.Background() - beaconState, privKeys := testutil.DeterministicGenesisState(t, 32) + beaconState, privKeys := util.DeterministicGenesisState(t, 32) att0, err := generateUnaggregatedAtt(beaconState, 0, privKeys) require.NoError(t, err) err = beaconState.SetSlot(beaconState.Slot() + params.BeaconConfig().MinAttestationInclusionDelay) @@ -135,7 +135,7 @@ func TestSubmitAggregateAndProof_AggregateOk(t *testing.T) { ctx := context.Background() - beaconState, privKeys := testutil.DeterministicGenesisState(t, 32) + beaconState, privKeys := util.DeterministicGenesisState(t, 32) att0, err := generateAtt(beaconState, 0, privKeys) require.NoError(t, err) att1, err := generateAtt(beaconState, 2, privKeys) @@ -180,7 +180,7 @@ func TestSubmitAggregateAndProof_AggregateNotOk(t *testing.T) { ctx := context.Background() - beaconState, _ := testutil.DeterministicGenesisState(t, 32) + beaconState, _ := util.DeterministicGenesisState(t, 32) require.NoError(t, beaconState.SetSlot(beaconState.Slot()+params.BeaconConfig().MinAttestationInclusionDelay)) aggregatorServer := &Server{ @@ -209,7 +209,7 @@ func generateAtt(state state.ReadOnlyBeaconState, index uint64, privKeys []bls.S aggBits := bitfield.NewBitlist(4) aggBits.SetBitAt(index, true) aggBits.SetBitAt(index+1, true) - att := testutil.HydrateAttestation(ðpb.Attestation{ + att := util.HydrateAttestation(ðpb.Attestation{ Data: ðpb.AttestationData{CommitteeIndex: 1}, AggregationBits: aggBits, }) @@ -246,7 +246,7 @@ func generateAtt(state state.ReadOnlyBeaconState, index uint64, privKeys []bls.S func generateUnaggregatedAtt(state state.ReadOnlyBeaconState, index uint64, privKeys []bls.SecretKey) (*ethpb.Attestation, error) { aggBits := bitfield.NewBitlist(4) aggBits.SetBitAt(index, true) - att := testutil.HydrateAttestation(ðpb.Attestation{ + att := util.HydrateAttestation(ðpb.Attestation{ Data: ðpb.AttestationData{ CommitteeIndex: 1, }, @@ -294,7 +294,7 @@ func TestSubmitAggregateAndProof_PreferOwnAttestation(t *testing.T) { // This test creates 3 attestations. 0 and 2 have the same attestation data and can be // aggregated. 1 has the validator's signature making this request and that is the expected // attestation to sign, even though the aggregated 0&2 would have more aggregated bits. - beaconState, privKeys := testutil.DeterministicGenesisState(t, 32) + beaconState, privKeys := util.DeterministicGenesisState(t, 32) att0, err := generateAtt(beaconState, 0, privKeys) require.NoError(t, err) att0.Data.BeaconBlockRoot = bytesutil.PadTo([]byte("foo"), 32) @@ -348,7 +348,7 @@ func TestSubmitAggregateAndProof_SelectsMostBitsWhenOwnAttestationNotPresent(t * // This test creates two distinct attestations, neither of which contain the validator's index, // index 0. This test should choose the most bits attestation, att1. - beaconState, privKeys := testutil.DeterministicGenesisState(t, 32) + beaconState, privKeys := util.DeterministicGenesisState(t, 32) att0, err := generateAtt(beaconState, 0, privKeys) require.NoError(t, err) att0.Data.BeaconBlockRoot = bytesutil.PadTo([]byte("foo"), 32) diff --git a/beacon-chain/rpc/prysm/v1alpha1/validator/assignments_test.go b/beacon-chain/rpc/prysm/v1alpha1/validator/assignments_test.go index 6686ec74c..e44e7a055 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/validator/assignments_test.go +++ b/beacon-chain/rpc/prysm/v1alpha1/validator/assignments_test.go @@ -21,10 +21,10 @@ import ( "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpbv1 "github.com/prysmaticlabs/prysm/proto/eth/v1" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" "github.com/prysmaticlabs/prysm/testing/mock" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) // pubKey is a helper to generate a well-formed public key. @@ -35,11 +35,11 @@ func pubKey(i uint64) []byte { } func TestGetDuties_OK(t *testing.T) { - genesis := testutil.NewBeaconBlock() + genesis := util.NewBeaconBlock() depChainStart := params.BeaconConfig().MinGenesisActiveValidatorCount - deposits, _, err := testutil.DeterministicDepositsAndKeys(depChainStart) + deposits, _, err := util.DeterministicDepositsAndKeys(depChainStart) require.NoError(t, err) - eth1Data, err := testutil.DeterministicEth1Data(len(deposits)) + eth1Data, err := util.DeterministicEth1Data(len(deposits)) require.NoError(t, err) bs, err := transition.GenesisBeaconState(context.Background(), deposits, 0, eth1Data) require.NoError(t, err, "Could not setup genesis bs") @@ -104,12 +104,12 @@ func TestGetAltairDuties_SyncCommitteeOK(t *testing.T) { cfg.AltairForkEpoch = types.Epoch(0) params.OverrideBeaconConfig(cfg) - genesis := testutil.NewBeaconBlock() - deposits, _, err := testutil.DeterministicDepositsAndKeys(params.BeaconConfig().SyncCommitteeSize) + genesis := util.NewBeaconBlock() + deposits, _, err := util.DeterministicDepositsAndKeys(params.BeaconConfig().SyncCommitteeSize) require.NoError(t, err) - eth1Data, err := testutil.DeterministicEth1Data(len(deposits)) + eth1Data, err := util.DeterministicEth1Data(len(deposits)) require.NoError(t, err) - bs, err := testutil.GenesisBeaconState(context.Background(), deposits, 0, eth1Data) + bs, err := util.GenesisBeaconState(context.Background(), deposits, 0, eth1Data) h := ðpb.BeaconBlockHeader{ StateRoot: bytesutil.PadTo([]byte{'a'}, 32), ParentRoot: bytesutil.PadTo([]byte{'b'}, 32), @@ -214,11 +214,11 @@ func TestGetDuties_SlotOutOfUpperBound(t *testing.T) { } func TestGetDuties_CurrentEpoch_ShouldNotFail(t *testing.T) { - genesis := testutil.NewBeaconBlock() + genesis := util.NewBeaconBlock() depChainStart := params.BeaconConfig().MinGenesisActiveValidatorCount - deposits, _, err := testutil.DeterministicDepositsAndKeys(depChainStart) + deposits, _, err := util.DeterministicDepositsAndKeys(depChainStart) require.NoError(t, err) - eth1Data, err := testutil.DeterministicEth1Data(len(deposits)) + eth1Data, err := util.DeterministicEth1Data(len(deposits)) require.NoError(t, err) bState, err := transition.GenesisBeaconState(context.Background(), deposits, 0, eth1Data) require.NoError(t, err, "Could not setup genesis state") @@ -254,12 +254,12 @@ func TestGetDuties_CurrentEpoch_ShouldNotFail(t *testing.T) { } func TestGetDuties_MultipleKeys_OK(t *testing.T) { - genesis := testutil.NewBeaconBlock() + genesis := util.NewBeaconBlock() depChainStart := uint64(64) - deposits, _, err := testutil.DeterministicDepositsAndKeys(depChainStart) + deposits, _, err := util.DeterministicDepositsAndKeys(depChainStart) require.NoError(t, err) - eth1Data, err := testutil.DeterministicEth1Data(len(deposits)) + eth1Data, err := util.DeterministicEth1Data(len(deposits)) require.NoError(t, err) bs, err := transition.GenesisBeaconState(context.Background(), deposits, 0, eth1Data) require.NoError(t, err, "Could not setup genesis bs") @@ -315,11 +315,11 @@ func TestStreamDuties_SyncNotReady(t *testing.T) { } func TestStreamDuties_OK(t *testing.T) { - genesis := testutil.NewBeaconBlock() + genesis := util.NewBeaconBlock() depChainStart := params.BeaconConfig().MinGenesisActiveValidatorCount - deposits, _, err := testutil.DeterministicDepositsAndKeys(depChainStart) + deposits, _, err := util.DeterministicDepositsAndKeys(depChainStart) require.NoError(t, err) - eth1Data, err := testutil.DeterministicEth1Data(len(deposits)) + eth1Data, err := util.DeterministicEth1Data(len(deposits)) require.NoError(t, err) bs, err := transition.GenesisBeaconState(context.Background(), deposits, 0, eth1Data) require.NoError(t, err, "Could not setup genesis bs") @@ -372,11 +372,11 @@ func TestStreamDuties_OK(t *testing.T) { } func TestStreamDuties_OK_ChainReorg(t *testing.T) { - genesis := testutil.NewBeaconBlock() + genesis := util.NewBeaconBlock() depChainStart := params.BeaconConfig().MinGenesisActiveValidatorCount - deposits, _, err := testutil.DeterministicDepositsAndKeys(depChainStart) + deposits, _, err := util.DeterministicDepositsAndKeys(depChainStart) require.NoError(t, err) - eth1Data, err := testutil.DeterministicEth1Data(len(deposits)) + eth1Data, err := util.DeterministicEth1Data(len(deposits)) require.NoError(t, err) bs, err := transition.GenesisBeaconState(context.Background(), deposits, 0, eth1Data) require.NoError(t, err, "Could not setup genesis bs") @@ -477,11 +477,11 @@ func TestAssignValidatorToSyncSubnet(t *testing.T) { func BenchmarkCommitteeAssignment(b *testing.B) { - genesis := testutil.NewBeaconBlock() + genesis := util.NewBeaconBlock() depChainStart := uint64(8192 * 2) - deposits, _, err := testutil.DeterministicDepositsAndKeys(depChainStart) + deposits, _, err := util.DeterministicDepositsAndKeys(depChainStart) require.NoError(b, err) - eth1Data, err := testutil.DeterministicEth1Data(len(deposits)) + eth1Data, err := util.DeterministicEth1Data(len(deposits)) require.NoError(b, err) bs, err := transition.GenesisBeaconState(context.Background(), deposits, 0, eth1Data) require.NoError(b, err, "Could not setup genesis bs") diff --git a/beacon-chain/rpc/prysm/v1alpha1/validator/attester_test.go b/beacon-chain/rpc/prysm/v1alpha1/validator/attester_test.go index 58fc58b94..e6f4d127e 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/validator/attester_test.go +++ b/beacon-chain/rpc/prysm/v1alpha1/validator/attester_test.go @@ -22,9 +22,9 @@ import ( "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" prysmTime "github.com/prysmaticlabs/prysm/time" "google.golang.org/protobuf/proto" ) @@ -37,7 +37,7 @@ func TestProposeAttestation_OK(t *testing.T) { AttPool: attestations.NewPool(), OperationNotifier: (&mock.ChainService{}).OperationNotifier(), } - head := testutil.NewBeaconBlock() + head := util.NewBeaconBlock() head.Block.Slot = 999 head.Block.ParentRoot = bytesutil.PadTo([]byte{'a'}, 32) root, err := head.Block.HashTreeRoot() @@ -53,7 +53,7 @@ func TestProposeAttestation_OK(t *testing.T) { } } - state, err := testutil.NewBeaconState() + state, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, state.SetSlot(params.BeaconConfig().SlotsPerEpoch+1)) require.NoError(t, state.SetValidators(validators)) @@ -82,18 +82,18 @@ func TestProposeAttestation_IncorrectSignature(t *testing.T) { OperationNotifier: (&mock.ChainService{}).OperationNotifier(), } - req := testutil.HydrateAttestation(ðpb.Attestation{}) + req := util.HydrateAttestation(ðpb.Attestation{}) wanted := "Incorrect attestation signature" _, err := attesterServer.ProposeAttestation(context.Background(), req) assert.ErrorContains(t, wanted, err) } func TestGetAttestationData_OK(t *testing.T) { - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() block.Block.Slot = 3*params.BeaconConfig().SlotsPerEpoch + 1 - targetBlock := testutil.NewBeaconBlock() + targetBlock := util.NewBeaconBlock() targetBlock.Block.Slot = 1 * params.BeaconConfig().SlotsPerEpoch - justifiedBlock := testutil.NewBeaconBlock() + justifiedBlock := util.NewBeaconBlock() justifiedBlock.Block.Slot = 2 * params.BeaconConfig().SlotsPerEpoch blockRoot, err := block.Block.HashTreeRoot() require.NoError(t, err, "Could not hash beacon block") @@ -102,7 +102,7 @@ func TestGetAttestationData_OK(t *testing.T) { targetRoot, err := targetBlock.Block.HashTreeRoot() require.NoError(t, err, "Could not get signing root for target block") slot := 3*params.BeaconConfig().SlotsPerEpoch + 1 - beaconState, err := testutil.NewBeaconState() + beaconState, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, beaconState.SetSlot(slot)) err = beaconState.SetCurrentJustifiedCheckpoint(ðpb.Checkpoint{ @@ -185,13 +185,13 @@ func TestAttestationDataAtSlot_HandlesFarAwayJustifiedEpoch(t *testing.T) { cfg.HistoricalRootsLimit = 8192 params.OverrideBeaconConfig(cfg) - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() block.Block.Slot = 10000 - epochBoundaryBlock := testutil.NewBeaconBlock() + epochBoundaryBlock := util.NewBeaconBlock() var err error epochBoundaryBlock.Block.Slot, err = core.StartSlot(core.SlotToEpoch(10000)) require.NoError(t, err) - justifiedBlock := testutil.NewBeaconBlock() + justifiedBlock := util.NewBeaconBlock() justifiedBlock.Block.Slot, err = core.StartSlot(core.SlotToEpoch(1500)) require.NoError(t, err) justifiedBlock.Block.Slot -= 2 // Imagine two skip block @@ -203,7 +203,7 @@ func TestAttestationDataAtSlot_HandlesFarAwayJustifiedEpoch(t *testing.T) { require.NoError(t, err, "Could not hash justified block") slot := types.Slot(10000) - beaconState, err := testutil.NewBeaconState() + beaconState, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, beaconState.SetSlot(slot)) err = beaconState.SetCurrentJustifiedCheckpoint(ðpb.Checkpoint{ @@ -336,13 +336,13 @@ func TestServer_GetAttestationData_HeadStateSlotGreaterThanRequestSlot(t *testin db := dbutil.SetupDB(t) slot := 3*params.BeaconConfig().SlotsPerEpoch + 1 - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() block.Block.Slot = slot - block2 := testutil.NewBeaconBlock() + block2 := util.NewBeaconBlock() block2.Block.Slot = slot - 1 - targetBlock := testutil.NewBeaconBlock() + targetBlock := util.NewBeaconBlock() targetBlock.Block.Slot = 1 * params.BeaconConfig().SlotsPerEpoch - justifiedBlock := testutil.NewBeaconBlock() + justifiedBlock := util.NewBeaconBlock() justifiedBlock.Block.Slot = 2 * params.BeaconConfig().SlotsPerEpoch blockRoot, err := block.Block.HashTreeRoot() require.NoError(t, err, "Could not hash beacon block") @@ -354,12 +354,12 @@ func TestServer_GetAttestationData_HeadStateSlotGreaterThanRequestSlot(t *testin targetRoot, err := targetBlock.Block.HashTreeRoot() require.NoError(t, err, "Could not get signing root for target block") - beaconState, err := testutil.NewBeaconState() + beaconState, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, beaconState.SetSlot(slot)) offset := int64(slot.Mul(params.BeaconConfig().SecondsPerSlot)) require.NoError(t, beaconState.SetGenesisTime(uint64(time.Now().Unix()-offset))) - err = beaconState.SetLatestBlockHeader(testutil.HydrateBeaconHeader(ðpb.BeaconBlockHeader{ + err = beaconState.SetLatestBlockHeader(util.HydrateBeaconHeader(ðpb.BeaconBlockHeader{ ParentRoot: blockRoot2[:], })) require.NoError(t, err) @@ -423,11 +423,11 @@ func TestServer_GetAttestationData_HeadStateSlotGreaterThanRequestSlot(t *testin func TestGetAttestationData_SucceedsInFirstEpoch(t *testing.T) { slot := types.Slot(5) - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() block.Block.Slot = slot - targetBlock := testutil.NewBeaconBlock() + targetBlock := util.NewBeaconBlock() targetBlock.Block.Slot = 0 - justifiedBlock := testutil.NewBeaconBlock() + justifiedBlock := util.NewBeaconBlock() justifiedBlock.Block.Slot = 0 blockRoot, err := block.Block.HashTreeRoot() require.NoError(t, err, "Could not hash beacon block") @@ -436,7 +436,7 @@ func TestGetAttestationData_SucceedsInFirstEpoch(t *testing.T) { targetRoot, err := targetBlock.Block.HashTreeRoot() require.NoError(t, err, "Could not get signing root for target block") - beaconState, err := testutil.NewBeaconState() + beaconState, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, beaconState.SetSlot(slot)) err = beaconState.SetCurrentJustifiedCheckpoint(ðpb.Checkpoint{ @@ -556,7 +556,7 @@ func TestServer_SubscribeCommitteeSubnets_MultipleSlots(t *testing.T) { } } - state, err := testutil.NewBeaconState() + state, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, state.SetValidators(validators)) diff --git a/beacon-chain/rpc/prysm/v1alpha1/validator/blocks_test.go b/beacon-chain/rpc/prysm/v1alpha1/validator/blocks_test.go index 653b4e6bd..6a7101bb1 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/validator/blocks_test.go +++ b/beacon-chain/rpc/prysm/v1alpha1/validator/blocks_test.go @@ -14,10 +14,10 @@ import ( "github.com/prysmaticlabs/prysm/config/params" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" "github.com/prysmaticlabs/prysm/testing/mock" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestServer_StreamAltairBlocksVerified_ContextCanceled(t *testing.T) { @@ -73,12 +73,12 @@ func TestServer_StreamAltairBlocks_ContextCanceled(t *testing.T) { func TestServer_StreamAltairBlocks_OnHeadUpdated(t *testing.T) { params.UseMainnetConfig() ctx := context.Background() - beaconState, privs := testutil.DeterministicGenesisStateAltair(t, 64) + beaconState, privs := util.DeterministicGenesisStateAltair(t, 64) c, err := altair.NextSyncCommittee(ctx, beaconState) require.NoError(t, err) require.NoError(t, beaconState.SetCurrentSyncCommittee(c)) - b, err := testutil.GenerateFullBlockAltair(beaconState, privs, testutil.DefaultBlockGenConfig(), 1) + b, err := util.GenerateFullBlockAltair(beaconState, privs, util.DefaultBlockGenConfig(), 1) require.NoError(t, err) chainService := &chainMock.ChainService{State: beaconState} server := &Server{ @@ -115,12 +115,12 @@ func TestServer_StreamAltairBlocksVerified_OnHeadUpdated(t *testing.T) { params.UseMainnetConfig() db := dbTest.SetupDB(t) ctx := context.Background() - beaconState, privs := testutil.DeterministicGenesisStateAltair(t, 32) + beaconState, privs := util.DeterministicGenesisStateAltair(t, 32) c, err := altair.NextSyncCommittee(ctx, beaconState) require.NoError(t, err) require.NoError(t, beaconState.SetCurrentSyncCommittee(c)) - b, err := testutil.GenerateFullBlockAltair(beaconState, privs, testutil.DefaultBlockGenConfig(), 1) + b, err := util.GenerateFullBlockAltair(beaconState, privs, util.DefaultBlockGenConfig(), 1) require.NoError(t, err) r, err := b.Block.HashTreeRoot() require.NoError(t, err) diff --git a/beacon-chain/rpc/prysm/v1alpha1/validator/exit_test.go b/beacon-chain/rpc/prysm/v1alpha1/validator/exit_test.go index 2f90fdd0f..d3223fabc 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/validator/exit_test.go +++ b/beacon-chain/rpc/prysm/v1alpha1/validator/exit_test.go @@ -17,21 +17,21 @@ import ( "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestProposeExit_Notification(t *testing.T) { ctx := context.Background() - deposits, keys, err := testutil.DeterministicDepositsAndKeys(params.BeaconConfig().MinGenesisActiveValidatorCount) + deposits, keys, err := util.DeterministicDepositsAndKeys(params.BeaconConfig().MinGenesisActiveValidatorCount) require.NoError(t, err) beaconState, err := transition.GenesisBeaconState(ctx, deposits, 0, ðpb.Eth1Data{BlockHash: make([]byte, 32)}) require.NoError(t, err) epoch := types.Epoch(2048) require.NoError(t, beaconState.SetSlot(params.BeaconConfig().SlotsPerEpoch.Mul(uint64(epoch)))) - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() genesisRoot, err := block.Block.HashTreeRoot() require.NoError(t, err, "Could not get signing root") @@ -93,13 +93,13 @@ func TestProposeExit_Notification(t *testing.T) { func TestProposeExit_NoPanic(t *testing.T) { ctx := context.Background() - deposits, keys, err := testutil.DeterministicDepositsAndKeys(params.BeaconConfig().MinGenesisActiveValidatorCount) + deposits, keys, err := util.DeterministicDepositsAndKeys(params.BeaconConfig().MinGenesisActiveValidatorCount) require.NoError(t, err) beaconState, err := transition.GenesisBeaconState(ctx, deposits, 0, ðpb.Eth1Data{BlockHash: make([]byte, 32)}) require.NoError(t, err) epoch := types.Epoch(2048) require.NoError(t, beaconState.SetSlot(params.BeaconConfig().SlotsPerEpoch.Mul(uint64(epoch)))) - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() genesisRoot, err := block.Block.HashTreeRoot() require.NoError(t, err, "Could not get signing root") diff --git a/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_attestations_test.go b/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_attestations_test.go index e4fde9ac6..d81648a87 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_attestations_test.go +++ b/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_attestations_test.go @@ -9,27 +9,27 @@ import ( "github.com/prysmaticlabs/go-bitfield" "github.com/prysmaticlabs/prysm/config/features" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestProposer_ProposerAtts_sortByProfitability(t *testing.T) { atts := proposerAtts([]*ethpb.Attestation{ - testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 4}, AggregationBits: bitfield.Bitlist{0b11100000}}), - testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b11000000}}), - testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2}, AggregationBits: bitfield.Bitlist{0b11100000}}), - testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 4}, AggregationBits: bitfield.Bitlist{0b11110000}}), - testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b11100000}}), - testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 3}, AggregationBits: bitfield.Bitlist{0b11000000}}), + util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 4}, AggregationBits: bitfield.Bitlist{0b11100000}}), + util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b11000000}}), + util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2}, AggregationBits: bitfield.Bitlist{0b11100000}}), + util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 4}, AggregationBits: bitfield.Bitlist{0b11110000}}), + util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b11100000}}), + util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 3}, AggregationBits: bitfield.Bitlist{0b11000000}}), }) want := proposerAtts([]*ethpb.Attestation{ - testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 4}, AggregationBits: bitfield.Bitlist{0b11110000}}), - testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 4}, AggregationBits: bitfield.Bitlist{0b11100000}}), - testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 3}, AggregationBits: bitfield.Bitlist{0b11000000}}), - testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2}, AggregationBits: bitfield.Bitlist{0b11100000}}), - testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b11100000}}), - testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b11000000}}), + util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 4}, AggregationBits: bitfield.Bitlist{0b11110000}}), + util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 4}, AggregationBits: bitfield.Bitlist{0b11100000}}), + util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 3}, AggregationBits: bitfield.Bitlist{0b11000000}}), + util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 2}, AggregationBits: bitfield.Bitlist{0b11100000}}), + util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b11100000}}), + util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b11000000}}), }) atts, err := atts.sortByProfitability() if err != nil { @@ -51,7 +51,7 @@ func TestProposer_ProposerAtts_sortByProfitabilityUsingMaxCover(t *testing.T) { getAtts := func(data []testData) proposerAtts { var atts proposerAtts for _, att := range data { - atts = append(atts, testutil.HydrateAttestation(ðpb.Attestation{ + atts = append(atts, util.HydrateAttestation(ðpb.Attestation{ Data: ðpb.AttestationData{Slot: att.slot}, AggregationBits: att.bits})) } return atts @@ -224,10 +224,10 @@ func TestProposer_ProposerAtts_sortByProfitabilityUsingMaxCover(t *testing.T) { } func TestProposer_ProposerAtts_dedup(t *testing.T) { - data1 := testutil.HydrateAttestationData(ðpb.AttestationData{ + data1 := util.HydrateAttestationData(ðpb.AttestationData{ Slot: 4, }) - data2 := testutil.HydrateAttestationData(ðpb.AttestationData{ + data2 := util.HydrateAttestationData(ðpb.AttestationData{ Slot: 5, }) tests := []struct { diff --git a/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_sync_aggregate_test.go b/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_sync_aggregate_test.go index 89f985261..2ff417899 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_sync_aggregate_test.go +++ b/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_sync_aggregate_test.go @@ -7,7 +7,7 @@ import ( "github.com/prysmaticlabs/go-bitfield" v2 "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" ) func TestProposerSyncContributions_FilterByBlockRoot(t *testing.T) { diff --git a/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_test.go b/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_test.go index cfcaa1181..78d523503 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_test.go +++ b/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_test.go @@ -32,9 +32,9 @@ import ( "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/attestation" attaggregation "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/attestation/aggregation/attestations" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/protobuf/proto" ) @@ -44,7 +44,7 @@ func TestProposer_GetBlock_OK(t *testing.T) { params.SetupTestConfigCleanup(t) params.OverrideBeaconConfig(params.MainnetConfig()) - beaconState, privKeys := testutil.DeterministicGenesisState(t, 64) + beaconState, privKeys := util.DeterministicGenesisState(t, 64) stateRoot, err := beaconState.HashTreeRoot(ctx) require.NoError(t, err, "Could not hash genesis state") @@ -71,7 +71,7 @@ func TestProposer_GetBlock_OK(t *testing.T) { StateGen: stategen.New(db), } - randaoReveal, err := testutil.RandaoReveal(beaconState, 0, privKeys) + randaoReveal, err := util.RandaoReveal(beaconState, 0, privKeys) require.NoError(t, err) graffiti := bytesutil.ToBytes32([]byte("eth2")) @@ -83,7 +83,7 @@ func TestProposer_GetBlock_OK(t *testing.T) { proposerSlashings := make([]*ethpb.ProposerSlashing, params.BeaconConfig().MaxProposerSlashings) for i := types.ValidatorIndex(0); uint64(i) < params.BeaconConfig().MaxProposerSlashings; i++ { - proposerSlashing, err := testutil.GenerateProposerSlashingForValidator( + proposerSlashing, err := util.GenerateProposerSlashingForValidator( beaconState, privKeys[i], i, /* validator index */ @@ -96,7 +96,7 @@ func TestProposer_GetBlock_OK(t *testing.T) { attSlashings := make([]*ethpb.AttesterSlashing, params.BeaconConfig().MaxAttesterSlashings) for i := uint64(0); i < params.BeaconConfig().MaxAttesterSlashings; i++ { - attesterSlashing, err := testutil.GenerateAttesterSlashingForValidator( + attesterSlashing, err := util.GenerateAttesterSlashingForValidator( beaconState, privKeys[i+params.BeaconConfig().MaxProposerSlashings], types.ValidatorIndex(i+params.BeaconConfig().MaxProposerSlashings), /* validator index */ @@ -125,7 +125,7 @@ func TestProposer_GetBlock_AddsUnaggregatedAtts(t *testing.T) { params.SetupTestConfigCleanup(t) params.OverrideBeaconConfig(params.MainnetConfig()) - beaconState, privKeys := testutil.DeterministicGenesisState(t, params.BeaconConfig().MinGenesisActiveValidatorCount) + beaconState, privKeys := util.DeterministicGenesisState(t, params.BeaconConfig().MinGenesisActiveValidatorCount) stateRoot, err := beaconState.HashTreeRoot(ctx) require.NoError(t, err, "Could not hash genesis state") @@ -156,7 +156,7 @@ func TestProposer_GetBlock_AddsUnaggregatedAtts(t *testing.T) { // we don't care for the purpose of this test. var atts []*ethpb.Attestation for i := uint64(0); len(atts) < int(params.BeaconConfig().MaxAttestations); i++ { - a, err := testutil.GenerateAttestations(beaconState, privKeys, 4, 1, true) + a, err := util.GenerateAttestations(beaconState, privKeys, 4, 1, true) require.NoError(t, err) atts = append(atts, a...) } @@ -167,7 +167,7 @@ func TestProposer_GetBlock_AddsUnaggregatedAtts(t *testing.T) { // Generate some more random attestations with a larger spread so that we can capture at least // one unaggregated attestation. - atts, err = testutil.GenerateAttestations(beaconState, privKeys, 300, 1, true) + atts, err = util.GenerateAttestations(beaconState, privKeys, 300, 1, true) require.NoError(t, err) found := false for _, a := range atts { @@ -178,7 +178,7 @@ func TestProposer_GetBlock_AddsUnaggregatedAtts(t *testing.T) { } require.Equal(t, true, found, "No unaggregated attestations were generated") - randaoReveal, err := testutil.RandaoReveal(beaconState, 0, privKeys) + randaoReveal, err := util.RandaoReveal(beaconState, 0, privKeys) assert.NoError(t, err) graffiti := bytesutil.ToBytes32([]byte("eth2")) @@ -211,11 +211,11 @@ func TestProposer_ProposeBlock_Phase0_OK(t *testing.T) { params.SetupTestConfigCleanup(t) params.OverrideBeaconConfig(params.MainnetConfig()) - genesis := testutil.NewBeaconBlock() + genesis := util.NewBeaconBlock() require.NoError(t, db.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(genesis)), "Could not save genesis block") numDeposits := uint64(64) - beaconState, _ := testutil.DeterministicGenesisState(t, numDeposits) + beaconState, _ := util.DeterministicGenesisState(t, numDeposits) bsRoot, err := beaconState.HashTreeRoot(ctx) require.NoError(t, err) genesisRoot, err := genesis.Block.HashTreeRoot() @@ -232,7 +232,7 @@ func TestProposer_ProposeBlock_Phase0_OK(t *testing.T) { BlockNotifier: c.BlockNotifier(), P2P: mockp2p.NewTestP2P(t), } - req := testutil.NewBeaconBlock() + req := util.NewBeaconBlock() req.Block.Slot = 5 req.Block.ParentRoot = bsRoot[:] require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(req))) @@ -247,11 +247,11 @@ func TestProposer_ProposeBlock_Altair_OK(t *testing.T) { params.SetupTestConfigCleanup(t) params.OverrideBeaconConfig(params.MainnetConfig()) - genesis := testutil.NewBeaconBlock() + genesis := util.NewBeaconBlock() require.NoError(t, db.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(genesis)), "Could not save genesis block") numDeposits := uint64(64) - beaconState, _ := testutil.DeterministicGenesisStateAltair(t, numDeposits) + beaconState, _ := util.DeterministicGenesisStateAltair(t, numDeposits) bsRoot, err := beaconState.HashTreeRoot(ctx) require.NoError(t, err) genesisRoot, err := genesis.Block.HashTreeRoot() @@ -268,7 +268,7 @@ func TestProposer_ProposeBlock_Altair_OK(t *testing.T) { BlockNotifier: c.BlockNotifier(), P2P: mockp2p.NewTestP2P(t), } - blockToPropose := testutil.NewBeaconBlockAltair() + blockToPropose := util.NewBeaconBlockAltair() blockToPropose.Block.Slot = 5 blockToPropose.Block.ParentRoot = bsRoot[:] blk := ðpb.GenericSignedBeaconBlock_Altair{Altair: blockToPropose} @@ -285,7 +285,7 @@ func TestProposer_ComputeStateRoot_OK(t *testing.T) { params.SetupTestConfigCleanup(t) params.OverrideBeaconConfig(params.MainnetConfig()) - beaconState, privKeys := testutil.DeterministicGenesisState(t, 100) + beaconState, privKeys := util.DeterministicGenesisState(t, 100) stateRoot, err := beaconState.HashTreeRoot(ctx) require.NoError(t, err, "Could not hash genesis state") @@ -304,12 +304,12 @@ func TestProposer_ComputeStateRoot_OK(t *testing.T) { Eth1BlockFetcher: &mockPOW.POWChain{}, StateGen: stategen.New(db), } - req := testutil.NewBeaconBlock() + req := util.NewBeaconBlock() req.Block.ProposerIndex = 21 req.Block.ParentRoot = parentRoot[:] req.Block.Slot = 1 require.NoError(t, beaconState.SetSlot(beaconState.Slot()+1)) - randaoReveal, err := testutil.RandaoReveal(beaconState, 0, privKeys) + randaoReveal, err := util.RandaoReveal(beaconState, 0, privKeys) require.NoError(t, err) proposerIdx, err := helpers.BeaconProposerIndex(beaconState) require.NoError(t, err) @@ -352,7 +352,7 @@ func TestProposer_PendingDeposits_Eth1DataVoteOK(t *testing.T) { blockHash = make([]byte, 32) copy(blockHash, "0x0") - beaconState, err := testutil.NewBeaconState() + beaconState, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, beaconState.SetEth1DepositIndex(2)) require.NoError(t, beaconState.SetEth1Data(ðpb.Eth1Data{ @@ -362,7 +362,7 @@ func TestProposer_PendingDeposits_Eth1DataVoteOK(t *testing.T) { })) require.NoError(t, beaconState.SetEth1DataVotes(votes)) - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blkRoot, err := blk.Block.HashTreeRoot() require.NoError(t, err) @@ -489,7 +489,7 @@ func TestProposer_PendingDeposits_OutsideEth1FollowWindow(t *testing.T) { depositCache.InsertPendingDeposit(ctx, dp.Deposit, dp.Eth1BlockHeight, dp.Index, depositTrie.HashTreeRoot()) } - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.Slot = beaconState.Slot() blkRoot, err := blk.HashTreeRoot() @@ -552,7 +552,7 @@ func TestProposer_PendingDeposits_FollowsCorrectEth1Block(t *testing.T) { Eth1DataVotes: votes, }) require.NoError(t, err) - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.Slot = beaconState.Slot() blkRoot, err := blk.HashTreeRoot() @@ -657,7 +657,7 @@ func TestProposer_PendingDeposits_CantReturnBelowStateEth1DepositIndex(t *testin }, } - beaconState, err := testutil.NewBeaconState() + beaconState, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, beaconState.SetEth1Data(ðpb.Eth1Data{ BlockHash: bytesutil.PadTo([]byte("0x0"), 32), @@ -665,7 +665,7 @@ func TestProposer_PendingDeposits_CantReturnBelowStateEth1DepositIndex(t *testin DepositCount: 100, })) require.NoError(t, beaconState.SetEth1DepositIndex(10)) - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.Slot = beaconState.Slot() blkRoot, err := blk.HashTreeRoot() require.NoError(t, err) @@ -762,7 +762,7 @@ func TestProposer_PendingDeposits_CantReturnMoreThanMax(t *testing.T) { Eth1DepositIndex: 2, }) require.NoError(t, err) - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.Slot = beaconState.Slot() blkRoot, err := blk.HashTreeRoot() require.NoError(t, err) @@ -856,7 +856,7 @@ func TestProposer_PendingDeposits_CantReturnMoreThanDepositCount(t *testing.T) { Eth1DepositIndex: 2, }) require.NoError(t, err) - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.Slot = beaconState.Slot() blkRoot, err := blk.HashTreeRoot() require.NoError(t, err) @@ -950,7 +950,7 @@ func TestProposer_DepositTrie_UtilizesCachedFinalizedDeposits(t *testing.T) { Eth1DepositIndex: 1, }) require.NoError(t, err) - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.Slot = beaconState.Slot() blkRoot, err := blk.Block.HashTreeRoot() @@ -1060,7 +1060,7 @@ func TestProposer_DepositTrie_RebuildTrie(t *testing.T) { Eth1DepositIndex: 1, }) require.NoError(t, err) - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.Slot = beaconState.Slot() blkRoot, err := blk.Block.HashTreeRoot() @@ -1854,10 +1854,10 @@ func TestProposer_Eth1Data_MajorityVote(t *testing.T) { func TestProposer_FilterAttestation(t *testing.T) { params.SetupTestConfigCleanup(t) params.OverrideBeaconConfig(params.MainnetConfig()) - genesis := testutil.NewBeaconBlock() + genesis := util.NewBeaconBlock() numValidators := uint64(64) - state, privKeys := testutil.DeterministicGenesisState(t, numValidators) + state, privKeys := util.DeterministicGenesisState(t, numValidators) require.NoError(t, state.SetGenesisValidatorRoot(params.BeaconConfig().ZeroHash[:])) assert.NoError(t, state.SetSlot(1)) @@ -1884,7 +1884,7 @@ func TestProposer_FilterAttestation(t *testing.T) { inputAtts: func() []*ethpb.Attestation { atts := make([]*ethpb.Attestation, 10) for i := 0; i < len(atts); i++ { - atts[i] = testutil.HydrateAttestation(ðpb.Attestation{ + atts[i] = util.HydrateAttestation(ðpb.Attestation{ Data: ðpb.AttestationData{ CommitteeIndex: types.CommitteeIndex(i), }, @@ -1901,7 +1901,7 @@ func TestProposer_FilterAttestation(t *testing.T) { inputAtts: func() []*ethpb.Attestation { atts := make([]*ethpb.Attestation, 10) for i := 0; i < len(atts); i++ { - atts[i] = testutil.HydrateAttestation(ðpb.Attestation{ + atts[i] = util.HydrateAttestation(ðpb.Attestation{ Data: ðpb.AttestationData{ CommitteeIndex: types.CommitteeIndex(i), Source: ðpb.Checkpoint{Root: params.BeaconConfig().ZeroHash[:]}, @@ -1974,7 +1974,7 @@ func TestProposer_Deposits_ReturnsEmptyList_IfLatestEth1DataEqGenesisEth1Block(t Eth1DepositIndex: 2, }) require.NoError(t, err) - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.Slot = beaconState.Slot() blkRoot, err := blk.Block.HashTreeRoot() require.NoError(t, err) @@ -2057,11 +2057,11 @@ func TestProposer_DeleteAttsInPool_Aggregated(t *testing.T) { require.NoError(t, err) sig := priv.Sign([]byte("foo")).Marshal() aggregatedAtts := []*ethpb.Attestation{ - testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b10101}, Signature: sig}), - testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b11010}, Signature: sig})} + util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b10101}, Signature: sig}), + util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b11010}, Signature: sig})} unaggregatedAtts := []*ethpb.Attestation{ - testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b10010}, Signature: sig}), - testutil.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b10100}, Signature: sig})} + util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b10010}, Signature: sig}), + util.HydrateAttestation(ðpb.Attestation{Data: ðpb.AttestationData{Slot: 1}, AggregationBits: bitfield.Bitlist{0b10100}, Signature: sig})} require.NoError(t, s.AttPool.SaveAggregatedAttestations(aggregatedAtts)) require.NoError(t, s.AttPool.SaveUnaggregatedAttestations(unaggregatedAtts)) @@ -2081,7 +2081,7 @@ func TestProposer_GetBeaconBlock_PreForkEpoch(t *testing.T) { params.SetupTestConfigCleanup(t) params.OverrideBeaconConfig(params.MainnetConfig()) - beaconState, privKeys := testutil.DeterministicGenesisState(t, 64) + beaconState, privKeys := util.DeterministicGenesisState(t, 64) stateRoot, err := beaconState.HashTreeRoot(ctx) require.NoError(t, err, "Could not hash genesis state") @@ -2127,7 +2127,7 @@ func TestProposer_GetBeaconBlock_PreForkEpoch(t *testing.T) { SyncCommitteePool: synccommittee.NewStore(), } - randaoReveal, err := testutil.RandaoReveal(beaconState, 0, privKeys) + randaoReveal, err := util.RandaoReveal(beaconState, 0, privKeys) require.NoError(t, err) graffiti := bytesutil.ToBytes32([]byte("eth2")) @@ -2139,7 +2139,7 @@ func TestProposer_GetBeaconBlock_PreForkEpoch(t *testing.T) { proposerSlashings := make([]*ethpb.ProposerSlashing, params.BeaconConfig().MaxProposerSlashings) for i := types.ValidatorIndex(0); uint64(i) < params.BeaconConfig().MaxProposerSlashings; i++ { - proposerSlashing, err := testutil.GenerateProposerSlashingForValidator( + proposerSlashing, err := util.GenerateProposerSlashingForValidator( beaconState, privKeys[i], i, /* validator index */ @@ -2152,7 +2152,7 @@ func TestProposer_GetBeaconBlock_PreForkEpoch(t *testing.T) { attSlashings := make([]*ethpb.AttesterSlashing, params.BeaconConfig().MaxAttesterSlashings) for i := uint64(0); i < params.BeaconConfig().MaxAttesterSlashings; i++ { - attesterSlashing, err := testutil.GenerateAttesterSlashingForValidator( + attesterSlashing, err := util.GenerateAttesterSlashingForValidator( beaconState, privKeys[i+params.BeaconConfig().MaxProposerSlashings], types.ValidatorIndex(i+params.BeaconConfig().MaxProposerSlashings), /* validator index */ @@ -2185,7 +2185,7 @@ func TestProposer_GetBeaconBlock_PostForkEpoch(t *testing.T) { cfg := params.MainnetConfig().Copy() cfg.AltairForkEpoch = 1 params.OverrideBeaconConfig(cfg) - beaconState, privKeys := testutil.DeterministicGenesisState(t, 64) + beaconState, privKeys := util.DeterministicGenesisState(t, 64) stateRoot, err := beaconState.HashTreeRoot(ctx) require.NoError(t, err, "Could not hash genesis state") @@ -2239,7 +2239,7 @@ func TestProposer_GetBeaconBlock_PostForkEpoch(t *testing.T) { SyncCommitteePool: synccommittee.NewStore(), } - randaoReveal, err := testutil.RandaoReveal(beaconState, 0, privKeys) + randaoReveal, err := util.RandaoReveal(beaconState, 0, privKeys) require.NoError(t, err) graffiti := bytesutil.ToBytes32([]byte("eth2")) @@ -2252,7 +2252,7 @@ func TestProposer_GetBeaconBlock_PostForkEpoch(t *testing.T) { proposerSlashings := make([]*ethpb.ProposerSlashing, params.BeaconConfig().MaxProposerSlashings) for i := types.ValidatorIndex(0); uint64(i) < params.BeaconConfig().MaxProposerSlashings; i++ { - proposerSlashing, err := testutil.GenerateProposerSlashingForValidator( + proposerSlashing, err := util.GenerateProposerSlashingForValidator( beaconState, privKeys[i], i, /* validator index */ @@ -2265,7 +2265,7 @@ func TestProposer_GetBeaconBlock_PostForkEpoch(t *testing.T) { attSlashings := make([]*ethpb.AttesterSlashing, params.BeaconConfig().MaxAttesterSlashings) for i := uint64(0); i < params.BeaconConfig().MaxAttesterSlashings; i++ { - attesterSlashing, err := testutil.GenerateAttesterSlashingForValidator( + attesterSlashing, err := util.GenerateAttesterSlashingForValidator( beaconState, privKeys[i+params.BeaconConfig().MaxProposerSlashings], types.ValidatorIndex(i+params.BeaconConfig().MaxProposerSlashings), /* validator index */ diff --git a/beacon-chain/rpc/prysm/v1alpha1/validator/server_test.go b/beacon-chain/rpc/prysm/v1alpha1/validator/server_test.go index 9f65dc422..147fb9a7e 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/validator/server_test.go +++ b/beacon-chain/rpc/prysm/v1alpha1/validator/server_test.go @@ -20,16 +20,16 @@ import ( "github.com/prysmaticlabs/prysm/crypto/bls" "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" "github.com/prysmaticlabs/prysm/testing/mock" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" logTest "github.com/sirupsen/logrus/hooks/test" "google.golang.org/protobuf/types/known/emptypb" ) func TestValidatorIndex_OK(t *testing.T) { - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) pubKey := pubKey(1) @@ -56,7 +56,7 @@ func TestWaitForActivation_ContextClosed(t *testing.T) { Validators: []*ethpb.Validator{}, }) require.NoError(t, err) - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() genesisRoot, err := block.Block.HashTreeRoot() require.NoError(t, err, "Could not get signing root") @@ -118,7 +118,7 @@ func TestWaitForActivation_ValidatorOriginallyExists(t *testing.T) { }, }, } - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() genesisRoot, err := block.Block.HashTreeRoot() require.NoError(t, err, "Could not get signing root") depData := ðpb.Deposit_Data{ @@ -218,7 +218,7 @@ func TestWaitForActivation_MultipleStatuses(t *testing.T) { }, }, } - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() genesisRoot, err := block.Block.HashTreeRoot() require.NoError(t, err, "Could not get signing root") trie, err := v1.InitializeFromProtoUnsafe(beaconState) @@ -298,7 +298,7 @@ func TestWaitForChainStart_ContextClosed(t *testing.T) { } func TestWaitForChainStart_AlreadyStarted(t *testing.T) { - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, st.SetSlot(3)) genesisValidatorsRoot := bytesutil.ToBytes32([]byte("validators")) @@ -361,7 +361,7 @@ func TestWaitForChainStart_HeadStateDoesNotExist(t *testing.T) { GenesisValidatorsRoot: genesisValidatorRoot[:], }, }) - testutil.WaitTimeout(wg, time.Second) + util.WaitTimeout(wg, time.Second) } func TestWaitForChainStart_NotStartedThenLogFired(t *testing.T) { diff --git a/beacon-chain/rpc/prysm/v1alpha1/validator/status_test.go b/beacon-chain/rpc/prysm/v1alpha1/validator/status_test.go index 2a7ba9ec4..651422d2a 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/validator/status_test.go +++ b/beacon-chain/rpc/prysm/v1alpha1/validator/status_test.go @@ -21,15 +21,15 @@ import ( "github.com/prysmaticlabs/prysm/crypto/bls" "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/protobuf/proto" ) func TestValidatorStatus_DepositedEth1(t *testing.T) { ctx := context.Background() - deposits, _, err := testutil.DeterministicDepositsAndKeys(1) + deposits, _, err := util.DeterministicDepositsAndKeys(1) require.NoError(t, err, "Could not generate deposits and keys") deposit := deposits[0] pubKey1 := deposit.Data.PublicKey @@ -167,11 +167,11 @@ func TestValidatorStatus_Pending(t *testing.T) { ctx := context.Background() pubKey := pubKey(1) - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() genesisRoot, err := block.Block.HashTreeRoot() require.NoError(t, err, "Could not get signing root") // Pending active because activation epoch is still defaulted at far future slot. - state, err := testutil.NewBeaconState() + state, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, state.SetSlot(5000)) err = state.SetValidators([]*ethpb.Validator{ @@ -249,7 +249,7 @@ func TestValidatorStatus_Active(t *testing.T) { // Active because activation epoch <= current epoch < exit epoch. activeEpoch := helpers.ActivationExitEpoch(0) - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() genesisRoot, err := block.Block.HashTreeRoot() require.NoError(t, err, "Could not get signing root") @@ -303,7 +303,7 @@ func TestValidatorStatus_Exiting(t *testing.T) { epoch := core.SlotToEpoch(slot) exitEpoch := helpers.ActivationExitEpoch(epoch) withdrawableEpoch := exitEpoch + params.BeaconConfig().MinValidatorWithdrawabilityDelay - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() genesisRoot, err := block.Block.HashTreeRoot() require.NoError(t, err, "Could not get signing root") @@ -361,7 +361,7 @@ func TestValidatorStatus_Slashing(t *testing.T) { // Exit slashed because slashed is true, exit epoch is =< current epoch and withdrawable epoch > epoch . slot := types.Slot(10000) epoch := core.SlotToEpoch(slot) - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() genesisRoot, err := block.Block.HashTreeRoot() require.NoError(t, err, "Could not get signing root") @@ -418,12 +418,12 @@ func TestValidatorStatus_Exited(t *testing.T) { // Exit because only exit epoch is =< current epoch. slot := types.Slot(10000) epoch := core.SlotToEpoch(slot) - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() genesisRoot, err := block.Block.HashTreeRoot() require.NoError(t, err, "Could not get signing root") params.SetupTestConfigCleanup(t) params.OverrideBeaconConfig(params.MainnetConfig()) - state, err := testutil.NewBeaconState() + state, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, state.SetSlot(slot)) err = state.SetValidators([]*ethpb.Validator{{ @@ -495,7 +495,7 @@ func TestValidatorStatus_UnknownStatus(t *testing.T) { func TestActivationStatus_OK(t *testing.T) { ctx := context.Background() - deposits, _, err := testutil.DeterministicDepositsAndKeys(4) + deposits, _, err := util.DeterministicDepositsAndKeys(4) require.NoError(t, err) pubKeys := [][]byte{deposits[0].Data.PublicKey, deposits[1].Data.PublicKey, deposits[2].Data.PublicKey, deposits[3].Data.PublicKey} stateObj, err := v1.InitializeFromProtoUnsafe(ðpb.BeaconState{ @@ -520,7 +520,7 @@ func TestActivationStatus_OK(t *testing.T) { }, }) require.NoError(t, err) - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() genesisRoot, err := block.Block.HashTreeRoot() require.NoError(t, err, "Could not get signing root") dep := deposits[0] @@ -584,7 +584,7 @@ func TestValidatorStatus_CorrectActivationQueue(t *testing.T) { ctx := context.Background() pbKey := pubKey(5) - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() genesisRoot, err := block.Block.HashTreeRoot() require.NoError(t, err, "Could not get signing root") currentSlot := types.Slot(5000) @@ -633,7 +633,7 @@ func TestValidatorStatus_CorrectActivationQueue(t *testing.T) { WithdrawableEpoch: params.BeaconConfig().FarFutureEpoch, }, } - state, err := testutil.NewBeaconState() + state, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, state.SetValidators(validators)) require.NoError(t, state.SetSlot(currentSlot)) @@ -682,7 +682,7 @@ func TestValidatorStatus_CorrectActivationQueue(t *testing.T) { func TestMultipleValidatorStatus_Pubkeys(t *testing.T) { ctx := context.Background() - deposits, _, err := testutil.DeterministicDepositsAndKeys(6) + deposits, _, err := util.DeterministicDepositsAndKeys(6) require.NoError(t, err) pubKeys := [][]byte{ deposits[0].Data.PublicKey, @@ -725,7 +725,7 @@ func TestMultipleValidatorStatus_Pubkeys(t *testing.T) { }, }) require.NoError(t, err) - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() genesisRoot, err := block.Block.HashTreeRoot() require.NoError(t, err, "Could not get signing root") depositTrie, err := trie.NewTrie(params.BeaconConfig().DepositContractTreeDepth) @@ -831,7 +831,7 @@ func TestMultipleValidatorStatus_Indices(t *testing.T) { } stateObj, err := v1.InitializeFromProtoUnsafe(beaconState) require.NoError(t, err) - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() genesisRoot, err := block.Block.HashTreeRoot() require.NoError(t, err, "Could not get signing root") @@ -886,7 +886,7 @@ func TestMultipleValidatorStatus_Indices(t *testing.T) { func TestValidatorStatus_Invalid(t *testing.T) { ctx := context.Background() - deposits, _, err := testutil.DeterministicDepositsAndKeys(1) + deposits, _, err := util.DeterministicDepositsAndKeys(1) require.NoError(t, err, "Could not generate deposits and keys") deposit := deposits[0] pubKey1 := deposit.Data.PublicKey @@ -1240,7 +1240,7 @@ func TestServer_CheckDoppelGanger(t *testing.T) { func createStateSetup(t *testing.T, head types.Epoch, mockgen *stategen.MockStateManager) (state.BeaconState, state.BeaconState, state.BeaconState, []bls.SecretKey) { - gs, keys := testutil.DeterministicGenesisState(t, 64) + gs, keys := util.DeterministicGenesisState(t, 64) hs := gs.Copy() // Head State headEpoch := head diff --git a/beacon-chain/rpc/prysm/v1alpha1/validator/sync_committee_test.go b/beacon-chain/rpc/prysm/v1alpha1/validator/sync_committee_test.go index e29e1ad3e..2d68870b0 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/validator/sync_committee_test.go +++ b/beacon-chain/rpc/prysm/v1alpha1/validator/sync_committee_test.go @@ -11,8 +11,8 @@ import ( mockp2p "github.com/prysmaticlabs/prysm/beacon-chain/p2p/testing" "github.com/prysmaticlabs/prysm/config/params" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/protobuf/types/known/emptypb" ) @@ -27,7 +27,7 @@ func TestGetSyncMessageBlockRoot_OK(t *testing.T) { } func TestSubmitSyncMessage_OK(t *testing.T) { - st, _ := testutil.DeterministicGenesisStateAltair(t, 10) + st, _ := util.DeterministicGenesisStateAltair(t, 10) server := &Server{ SyncCommitteePool: synccommittee.NewStore(), P2P: &mockp2p.MockBroadcaster{}, diff --git a/beacon-chain/rpc/service_test.go b/beacon-chain/rpc/service_test.go index 73c48c2b5..c3569d223 100644 --- a/beacon-chain/rpc/service_test.go +++ b/beacon-chain/rpc/service_test.go @@ -10,8 +10,8 @@ import ( mock "github.com/prysmaticlabs/prysm/beacon-chain/blockchain/testing" mockPOW "github.com/prysmaticlabs/prysm/beacon-chain/powchain/testing" mockSync "github.com/prysmaticlabs/prysm/beacon-chain/sync/initial-sync/testing" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/sirupsen/logrus" logTest "github.com/sirupsen/logrus/hooks/test" ) diff --git a/beacon-chain/rpc/statefetcher/BUILD.bazel b/beacon-chain/rpc/statefetcher/BUILD.bazel index 9117781e0..e211c87bd 100644 --- a/beacon-chain/rpc/statefetcher/BUILD.bazel +++ b/beacon-chain/rpc/statefetcher/BUILD.bazel @@ -29,9 +29,9 @@ go_test( "//encoding/bytesutil:go_default_library", "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/wrapper:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", ], diff --git a/beacon-chain/rpc/statefetcher/fetcher_test.go b/beacon-chain/rpc/statefetcher/fetcher_test.go index a84e11e7c..f61aa5b85 100644 --- a/beacon-chain/rpc/statefetcher/fetcher_test.go +++ b/beacon-chain/rpc/statefetcher/fetcher_test.go @@ -16,9 +16,9 @@ import ( "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestGetState(t *testing.T) { @@ -29,7 +29,7 @@ func TestGetState(t *testing.T) { state.Slot = headSlot return nil } - state, err := testutil.NewBeaconState(testutil.FillRootsNaturalOpt, fillSlot) + state, err := util.NewBeaconState(util.FillRootsNaturalOpt, fillSlot) require.NoError(t, err) stateRoot, err := state.HashTreeRoot(ctx) require.NoError(t, err) @@ -53,13 +53,13 @@ func TestGetState(t *testing.T) { params.OverrideBeaconConfig(cfg) db := testDB.SetupDB(t) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.StateRoot = bytesutil.PadTo([]byte("foo"), 32) require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b))) r, err := b.Block.HashTreeRoot() require.NoError(t, err) - state, err := testutil.NewBeaconState(func(state *ethpb.BeaconState) error { + state, err := util.NewBeaconState(func(state *ethpb.BeaconState) error { state.BlockRoots[0] = r[:] return nil }) @@ -191,13 +191,13 @@ func TestGetStateRoot(t *testing.T) { state.Slot = headSlot return nil } - state, err := testutil.NewBeaconState(testutil.FillRootsNaturalOpt, fillSlot) + state, err := util.NewBeaconState(util.FillRootsNaturalOpt, fillSlot) require.NoError(t, err) stateRoot, err := state.HashTreeRoot(ctx) require.NoError(t, err) t.Run("head", func(t *testing.T) { - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.StateRoot = stateRoot[:] p := StateProvider{ ChainInfoFetcher: &chainMock.ChainService{ @@ -213,12 +213,12 @@ func TestGetStateRoot(t *testing.T) { t.Run("genesis", func(t *testing.T) { db := testDB.SetupDB(t) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b))) r, err := b.Block.HashTreeRoot() require.NoError(t, err) - state, err := testutil.NewBeaconState(func(state *ethpb.BeaconState) error { + state, err := util.NewBeaconState(func(state *ethpb.BeaconState) error { state.BlockRoots[0] = r[:] return nil }) @@ -243,7 +243,7 @@ func TestGetStateRoot(t *testing.T) { db := testDB.SetupDB(t) genesis := bytesutil.ToBytes32([]byte("genesis")) require.NoError(t, db.SaveGenesisBlockRoot(ctx, genesis)) - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.ParentRoot = genesis[:] blk.Block.Slot = 40 root, err := blk.Block.HashTreeRoot() @@ -254,7 +254,7 @@ func TestGetStateRoot(t *testing.T) { } // a valid chain is required to save finalized checkpoint. require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(blk))) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, st.SetSlot(1)) // a state is required to save checkpoint @@ -274,7 +274,7 @@ func TestGetStateRoot(t *testing.T) { db := testDB.SetupDB(t) genesis := bytesutil.ToBytes32([]byte("genesis")) require.NoError(t, db.SaveGenesisBlockRoot(ctx, genesis)) - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.ParentRoot = genesis[:] blk.Block.Slot = 40 root, err := blk.Block.HashTreeRoot() @@ -285,7 +285,7 @@ func TestGetStateRoot(t *testing.T) { } // a valid chain is required to save finalized checkpoint. require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(blk))) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, st.SetSlot(1)) // a state is required to save checkpoint @@ -328,13 +328,13 @@ func TestGetStateRoot(t *testing.T) { db := testDB.SetupDB(t) genesis := bytesutil.ToBytes32([]byte("genesis")) require.NoError(t, db.SaveGenesisBlockRoot(ctx, genesis)) - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.ParentRoot = genesis[:] blk.Block.Slot = 40 root, err := blk.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(blk))) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, st.SetSlot(1)) // a state is required to save checkpoint diff --git a/beacon-chain/slasher/BUILD.bazel b/beacon-chain/slasher/BUILD.bazel index 6dd80f7bf..3d989fd88 100644 --- a/beacon-chain/slasher/BUILD.bazel +++ b/beacon-chain/slasher/BUILD.bazel @@ -20,7 +20,7 @@ go_test( srcs = ["params_test.go"], embed = [":go_default_library"], deps = [ - "//shared/testutil/assert:go_default_library", + "//testing/assert:go_default_library", "@com_github_ferranbt_fastssz//:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", ], diff --git a/beacon-chain/slasher/params_test.go b/beacon-chain/slasher/params_test.go index 18cb46ca8..99b449de0 100644 --- a/beacon-chain/slasher/params_test.go +++ b/beacon-chain/slasher/params_test.go @@ -6,7 +6,7 @@ import ( ssz "github.com/ferranbt/fastssz" types "github.com/prysmaticlabs/eth2-types" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" ) func TestDefaultParams(t *testing.T) { diff --git a/beacon-chain/state/BUILD.bazel b/beacon-chain/state/BUILD.bazel index 29555476b..a49754c62 100644 --- a/beacon-chain/state/BUILD.bazel +++ b/beacon-chain/state/BUILD.bazel @@ -12,11 +12,11 @@ go_library( "//contracts/deposit:__subpackages__", "//proto/testing:__subpackages__", "//shared/aggregation:__subpackages__", - "//shared/testutil:__pkg__", "//slasher/rpc:__subpackages__", "//testing/benchmark:__pkg__", "//testing/fuzz:__pkg__", "//testing/spectest:__subpackages__", + "//testing/util:__pkg__", "//tools/benchmark-files-gen:__pkg__", "//tools/exploredb:__pkg__", "//tools/pcli:__pkg__", diff --git a/beacon-chain/state/fieldtrie/BUILD.bazel b/beacon-chain/state/fieldtrie/BUILD.bazel index 156536d20..180065daa 100644 --- a/beacon-chain/state/fieldtrie/BUILD.bazel +++ b/beacon-chain/state/fieldtrie/BUILD.bazel @@ -30,9 +30,9 @@ go_test( "//beacon-chain/state/v1:go_default_library", "//config/params:go_default_library", "//proto/prysm/v1alpha1:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", ], ) diff --git a/beacon-chain/state/fieldtrie/field_trie_test.go b/beacon-chain/state/fieldtrie/field_trie_test.go index 5cb316c6a..5c566e0c7 100644 --- a/beacon-chain/state/fieldtrie/field_trie_test.go +++ b/beacon-chain/state/fieldtrie/field_trie_test.go @@ -9,13 +9,13 @@ import ( v1 "github.com/prysmaticlabs/prysm/beacon-chain/state/v1" "github.com/prysmaticlabs/prysm/config/params" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestFieldTrie_NewTrie(t *testing.T) { - newState, _ := testutil.DeterministicGenesisState(t, 40) + newState, _ := util.DeterministicGenesisState(t, 40) // 5 represents the enum value of state roots trie, err := fieldtrie.NewFieldTrie(5, stateTypes.BasicArray, newState.StateRoots(), uint64(params.BeaconConfig().SlotsPerHistoricalRoot)) @@ -28,7 +28,7 @@ func TestFieldTrie_NewTrie(t *testing.T) { } func TestFieldTrie_RecomputeTrie(t *testing.T) { - newState, _ := testutil.DeterministicGenesisState(t, 32) + newState, _ := util.DeterministicGenesisState(t, 32) // 10 represents the enum value of validators trie, err := fieldtrie.NewFieldTrie(11, stateTypes.CompositeArray, newState.Validators(), params.BeaconConfig().ValidatorRegistryLimit) require.NoError(t, err) @@ -56,7 +56,7 @@ func TestFieldTrie_RecomputeTrie(t *testing.T) { } func TestFieldTrie_CopyTrieImmutable(t *testing.T) { - newState, _ := testutil.DeterministicGenesisState(t, 32) + newState, _ := util.DeterministicGenesisState(t, 32) // 12 represents the enum value of randao mixes. trie, err := fieldtrie.NewFieldTrie(13, stateTypes.BasicArray, newState.RandaoMixes(), uint64(params.BeaconConfig().EpochsPerHistoricalVector)) require.NoError(t, err) diff --git a/beacon-chain/state/fieldtrie/helpers_test.go b/beacon-chain/state/fieldtrie/helpers_test.go index a9bd5a1da..ec9cf5aae 100644 --- a/beacon-chain/state/fieldtrie/helpers_test.go +++ b/beacon-chain/state/fieldtrie/helpers_test.go @@ -4,7 +4,7 @@ import ( "testing" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" ) func Test_handlePendingAttestation_OutOfRange(t *testing.T) { diff --git a/beacon-chain/state/stategen/BUILD.bazel b/beacon-chain/state/stategen/BUILD.bazel index 7f04a6ed5..13e45b08f 100644 --- a/beacon-chain/state/stategen/BUILD.bazel +++ b/beacon-chain/state/stategen/BUILD.bazel @@ -69,9 +69,9 @@ go_test( "//proto/prysm/v1alpha1/block:go_default_library", "//proto/prysm/v1alpha1/wrapper:go_default_library", "//runtime/version:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", "@com_github_sirupsen_logrus//hooks/test:go_default_library", "@org_golang_google_protobuf//proto:go_default_library", diff --git a/beacon-chain/state/stategen/epoch_boundary_state_cache_test.go b/beacon-chain/state/stategen/epoch_boundary_state_cache_test.go index a88d3f1d3..eefb84e71 100644 --- a/beacon-chain/state/stategen/epoch_boundary_state_cache_test.go +++ b/beacon-chain/state/stategen/epoch_boundary_state_cache_test.go @@ -4,9 +4,9 @@ import ( "testing" types "github.com/prysmaticlabs/eth2-types" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestEpochBoundaryStateCache_BadSlotKey(t *testing.T) { @@ -21,7 +21,7 @@ func TestEpochBoundaryStateCache_BadRootKey(t *testing.T) { func TestEpochBoundaryStateCache_CanSave(t *testing.T) { e := newBoundaryStateCache() - s, err := testutil.NewBeaconState() + s, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, s.SetSlot(1)) r := [32]byte{'a'} @@ -52,7 +52,7 @@ func TestEpochBoundaryStateCache_CanTrim(t *testing.T) { e := newBoundaryStateCache() offSet := types.Slot(10) for i := types.Slot(0); i < offSet.Add(maxCacheSize); i++ { - s, err := testutil.NewBeaconState() + s, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, s.SetSlot(i)) r := [32]byte{byte(i)} diff --git a/beacon-chain/state/stategen/getter_test.go b/beacon-chain/state/stategen/getter_test.go index 285c44062..d73f8988b 100644 --- a/beacon-chain/state/stategen/getter_test.go +++ b/beacon-chain/state/stategen/getter_test.go @@ -11,9 +11,9 @@ import ( "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestStateByRoot_ColdState(t *testing.T) { @@ -24,12 +24,12 @@ func TestStateByRoot_ColdState(t *testing.T) { service.finalizedInfo.slot = 2 service.slotsPerArchivedPoint = 1 - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = 1 require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b))) bRoot, err := b.Block.HashTreeRoot() require.NoError(t, err) - beaconState, _ := testutil.DeterministicGenesisState(t, 32) + beaconState, _ := util.DeterministicGenesisState(t, 32) require.NoError(t, beaconState.SetSlot(1)) require.NoError(t, service.beaconDB.SaveState(ctx, beaconState, bRoot)) require.NoError(t, service.beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b))) @@ -45,9 +45,9 @@ func TestStateByRoot_HotStateUsingEpochBoundaryCacheNoReplay(t *testing.T) { service := New(beaconDB) - beaconState, _ := testutil.DeterministicGenesisState(t, 32) + beaconState, _ := util.DeterministicGenesisState(t, 32) require.NoError(t, beaconState.SetSlot(10)) - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blkRoot, err := blk.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, service.beaconDB.SaveStateSummary(ctx, ðpb.StateSummary{Root: blkRoot[:]})) @@ -63,13 +63,13 @@ func TestStateByRoot_HotStateUsingEpochBoundaryCacheWithReplay(t *testing.T) { service := New(beaconDB) - beaconState, _ := testutil.DeterministicGenesisState(t, 32) - blk := testutil.NewBeaconBlock() + beaconState, _ := util.DeterministicGenesisState(t, 32) + blk := util.NewBeaconBlock() blkRoot, err := blk.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, service.epochBoundaryStateCache.put(blkRoot, beaconState)) targetSlot := types.Slot(10) - targetBlock := testutil.NewBeaconBlock() + targetBlock := util.NewBeaconBlock() targetBlock.Block.Slot = 11 targetBlock.Block.ParentRoot = blkRoot[:] targetBlock.Block.ProposerIndex = 8 @@ -88,7 +88,7 @@ func TestStateByRoot_HotStateCached(t *testing.T) { service := New(beaconDB) - beaconState, _ := testutil.DeterministicGenesisState(t, 32) + beaconState, _ := util.DeterministicGenesisState(t, 32) r := [32]byte{'A'} require.NoError(t, service.beaconDB.SaveStateSummary(ctx, ðpb.StateSummary{Root: r[:]})) service.hotStateCache.put(r, beaconState) @@ -104,10 +104,10 @@ func TestStateByRootInitialSync_UseEpochStateCache(t *testing.T) { service := New(beaconDB) - beaconState, _ := testutil.DeterministicGenesisState(t, 32) + beaconState, _ := util.DeterministicGenesisState(t, 32) targetSlot := types.Slot(10) require.NoError(t, beaconState.SetSlot(targetSlot)) - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blkRoot, err := blk.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, service.epochBoundaryStateCache.put(blkRoot, beaconState)) @@ -122,7 +122,7 @@ func TestStateByRootInitialSync_UseCache(t *testing.T) { service := New(beaconDB) - beaconState, _ := testutil.DeterministicGenesisState(t, 32) + beaconState, _ := util.DeterministicGenesisState(t, 32) r := [32]byte{'A'} require.NoError(t, service.beaconDB.SaveStateSummary(ctx, ðpb.StateSummary{Root: r[:]})) service.hotStateCache.put(r, beaconState) @@ -140,13 +140,13 @@ func TestStateByRootInitialSync_CanProcessUpTo(t *testing.T) { beaconDB := testDB.SetupDB(t) service := New(beaconDB) - beaconState, _ := testutil.DeterministicGenesisState(t, 32) - blk := testutil.NewBeaconBlock() + beaconState, _ := util.DeterministicGenesisState(t, 32) + blk := util.NewBeaconBlock() blkRoot, err := blk.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, service.epochBoundaryStateCache.put(blkRoot, beaconState)) targetSlot := types.Slot(10) - targetBlk := testutil.NewBeaconBlock() + targetBlk := util.NewBeaconBlock() targetBlk.Block.Slot = 11 targetBlk.Block.ParentRoot = blkRoot[:] targetRoot, err := targetBlk.Block.HashTreeRoot() @@ -167,7 +167,7 @@ func TestStateBySlot_ColdState(t *testing.T) { service.slotsPerArchivedPoint = params.BeaconConfig().SlotsPerEpoch * 2 service.finalizedInfo.slot = service.slotsPerArchivedPoint + 1 - beaconState, pks := testutil.DeterministicGenesisState(t, 32) + beaconState, pks := util.DeterministicGenesisState(t, 32) genesisStateRoot, err := beaconState.HashTreeRoot(ctx) require.NoError(t, err) genesis := blocks.NewGenesisBlock(genesisStateRoot[:]) @@ -177,7 +177,7 @@ func TestStateBySlot_ColdState(t *testing.T) { assert.NoError(t, beaconDB.SaveState(ctx, beaconState, gRoot)) assert.NoError(t, beaconDB.SaveGenesisBlockRoot(ctx, gRoot)) - b, err := testutil.GenerateFullBlock(beaconState, pks, testutil.DefaultBlockGenConfig(), 1) + b, err := util.GenerateFullBlock(beaconState, pks, util.DefaultBlockGenConfig(), 1) require.NoError(t, err) require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b))) bRoot, err := b.Block.HashTreeRoot() @@ -200,7 +200,7 @@ func TestStateBySlot_HotStateDB(t *testing.T) { service := New(beaconDB) - beaconState, _ := testutil.DeterministicGenesisState(t, 32) + beaconState, _ := util.DeterministicGenesisState(t, 32) genesisStateRoot, err := beaconState.HashTreeRoot(ctx) require.NoError(t, err) genesis := blocks.NewGenesisBlock(genesisStateRoot[:]) @@ -221,7 +221,7 @@ func TestLoadeStateByRoot_Cached(t *testing.T) { beaconDB := testDB.SetupDB(t) service := New(beaconDB) - beaconState, _ := testutil.DeterministicGenesisState(t, 32) + beaconState, _ := util.DeterministicGenesisState(t, 32) r := [32]byte{'A'} service.hotStateCache.put(r, beaconState) @@ -236,7 +236,7 @@ func TestLoadeStateByRoot_FinalizedState(t *testing.T) { beaconDB := testDB.SetupDB(t) service := New(beaconDB) - beaconState, _ := testutil.DeterministicGenesisState(t, 32) + beaconState, _ := util.DeterministicGenesisState(t, 32) genesisStateRoot, err := beaconState.HashTreeRoot(ctx) require.NoError(t, err) genesis := blocks.NewGenesisBlock(genesisStateRoot[:]) @@ -260,13 +260,13 @@ func TestLoadeStateByRoot_EpochBoundaryStateCanProcess(t *testing.T) { beaconDB := testDB.SetupDB(t) service := New(beaconDB) - beaconState, _ := testutil.DeterministicGenesisState(t, 32) - gBlk := testutil.NewBeaconBlock() + beaconState, _ := util.DeterministicGenesisState(t, 32) + gBlk := util.NewBeaconBlock() gBlkRoot, err := gBlk.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, service.epochBoundaryStateCache.put(gBlkRoot, beaconState)) - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.Slot = 11 blk.Block.ProposerIndex = 8 blk.Block.ParentRoot = gBlkRoot[:] @@ -286,13 +286,13 @@ func TestLoadeStateByRoot_FromDBBoundaryCase(t *testing.T) { beaconDB := testDB.SetupDB(t) service := New(beaconDB) - beaconState, _ := testutil.DeterministicGenesisState(t, 32) - gBlk := testutil.NewBeaconBlock() + beaconState, _ := util.DeterministicGenesisState(t, 32) + gBlk := util.NewBeaconBlock() gBlkRoot, err := gBlk.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, service.epochBoundaryStateCache.put(gBlkRoot, beaconState)) - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.Slot = 11 blk.Block.ProposerIndex = 8 blk.Block.ParentRoot = gBlkRoot[:] @@ -311,8 +311,8 @@ func TestLoadeStateBySlot_CanAdvanceSlotUsingDB(t *testing.T) { ctx := context.Background() beaconDB := testDB.SetupDB(t) service := New(beaconDB) - beaconState, _ := testutil.DeterministicGenesisState(t, 32) - b := testutil.NewBeaconBlock() + beaconState, _ := util.DeterministicGenesisState(t, 32) + b := util.NewBeaconBlock() require.NoError(t, service.beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b))) gRoot, err := b.Block.HashTreeRoot() require.NoError(t, err) @@ -329,7 +329,7 @@ func TestLoadeStateBySlot_CanReplayBlock(t *testing.T) { ctx := context.Background() beaconDB := testDB.SetupDB(t) service := New(beaconDB) - genesis, keys := testutil.DeterministicGenesisState(t, 64) + genesis, keys := util.DeterministicGenesisState(t, 64) genesisBlockRoot := bytesutil.ToBytes32(nil) require.NoError(t, beaconDB.SaveState(ctx, genesis, genesisBlockRoot)) stateRoot, err := genesis.HashTreeRoot(ctx) @@ -340,7 +340,7 @@ func TestLoadeStateBySlot_CanReplayBlock(t *testing.T) { require.NoError(t, err) require.NoError(t, beaconDB.SaveGenesisBlockRoot(ctx, genesisBlkRoot)) - b1, err := testutil.GenerateFullBlock(genesis, keys, testutil.DefaultBlockGenConfig(), 1) + b1, err := util.GenerateFullBlock(genesis, keys, util.DefaultBlockGenConfig(), 1) assert.NoError(t, err) require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b1))) r1, err := b1.Block.HashTreeRoot() @@ -357,7 +357,7 @@ func TestLoadeStateBySlot_DoesntReplayBlockOnRequestedSlot(t *testing.T) { ctx := context.Background() beaconDB := testDB.SetupDB(t) service := New(beaconDB) - genesis, keys := testutil.DeterministicGenesisState(t, 64) + genesis, keys := util.DeterministicGenesisState(t, 64) genesisBlockRoot := bytesutil.ToBytes32(nil) require.NoError(t, beaconDB.SaveState(ctx, genesis, genesisBlockRoot)) stateRoot, err := genesis.HashTreeRoot(ctx) @@ -368,7 +368,7 @@ func TestLoadeStateBySlot_DoesntReplayBlockOnRequestedSlot(t *testing.T) { require.NoError(t, err) require.NoError(t, beaconDB.SaveGenesisBlockRoot(ctx, genesisBlkRoot)) - b1, err := testutil.GenerateFullBlock(genesis, keys, testutil.DefaultBlockGenConfig(), 1) + b1, err := util.GenerateFullBlock(genesis, keys, util.DefaultBlockGenConfig(), 1) assert.NoError(t, err) require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b1))) r1, err := b1.Block.HashTreeRoot() @@ -389,27 +389,27 @@ func TestLastAncestorState_CanGetUsingDB(t *testing.T) { beaconDB := testDB.SetupDB(t) service := New(beaconDB) - b0 := testutil.NewBeaconBlock() + b0 := util.NewBeaconBlock() b0.Block.ParentRoot = bytesutil.PadTo([]byte{'a'}, 32) r0, err := b0.Block.HashTreeRoot() require.NoError(t, err) - b1 := testutil.NewBeaconBlock() + b1 := util.NewBeaconBlock() b1.Block.Slot = 1 b1.Block.ParentRoot = bytesutil.PadTo(r0[:], 32) r1, err := b1.Block.HashTreeRoot() require.NoError(t, err) - b2 := testutil.NewBeaconBlock() + b2 := util.NewBeaconBlock() b2.Block.Slot = 2 b2.Block.ParentRoot = bytesutil.PadTo(r1[:], 32) r2, err := b2.Block.HashTreeRoot() require.NoError(t, err) - b3 := testutil.NewBeaconBlock() + b3 := util.NewBeaconBlock() b3.Block.Slot = 3 b3.Block.ParentRoot = bytesutil.PadTo(r2[:], 32) r3, err := b3.Block.HashTreeRoot() require.NoError(t, err) - b1State, err := testutil.NewBeaconState() + b1State, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, b1State.SetSlot(1)) @@ -429,27 +429,27 @@ func TestLastAncestorState_CanGetUsingCache(t *testing.T) { beaconDB := testDB.SetupDB(t) service := New(beaconDB) - b0 := testutil.NewBeaconBlock() + b0 := util.NewBeaconBlock() b0.Block.ParentRoot = bytesutil.PadTo([]byte{'a'}, 32) r0, err := b0.Block.HashTreeRoot() require.NoError(t, err) - b1 := testutil.NewBeaconBlock() + b1 := util.NewBeaconBlock() b1.Block.Slot = 1 b1.Block.ParentRoot = bytesutil.PadTo(r0[:], 32) r1, err := b1.Block.HashTreeRoot() require.NoError(t, err) - b2 := testutil.NewBeaconBlock() + b2 := util.NewBeaconBlock() b2.Block.Slot = 2 b2.Block.ParentRoot = bytesutil.PadTo(r1[:], 32) r2, err := b2.Block.HashTreeRoot() require.NoError(t, err) - b3 := testutil.NewBeaconBlock() + b3 := util.NewBeaconBlock() b3.Block.Slot = 3 b3.Block.ParentRoot = bytesutil.PadTo(r2[:], 32) r3, err := b3.Block.HashTreeRoot() require.NoError(t, err) - b1State, err := testutil.NewBeaconState() + b1State, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, b1State.SetSlot(1)) @@ -468,7 +468,7 @@ func TestState_HasState(t *testing.T) { ctx := context.Background() beaconDB := testDB.SetupDB(t) service := New(beaconDB) - s, err := testutil.NewBeaconState() + s, err := util.NewBeaconState() require.NoError(t, err) rHit1 := [32]byte{1} rHit2 := [32]byte{2} @@ -476,7 +476,7 @@ func TestState_HasState(t *testing.T) { service.hotStateCache.put(rHit1, s) require.NoError(t, service.epochBoundaryStateCache.put(rHit2, s)) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() rHit3, err := b.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, service.beaconDB.SaveState(ctx, s, rHit3)) @@ -500,7 +500,7 @@ func TestState_HasStateInCache(t *testing.T) { ctx := context.Background() beaconDB := testDB.SetupDB(t) service := New(beaconDB) - s, err := testutil.NewBeaconState() + s, err := util.NewBeaconState() require.NoError(t, err) rHit1 := [32]byte{1} rHit2 := [32]byte{2} diff --git a/beacon-chain/state/stategen/hot_state_cache_test.go b/beacon-chain/state/stategen/hot_state_cache_test.go index 421f87e33..27385aacb 100644 --- a/beacon-chain/state/stategen/hot_state_cache_test.go +++ b/beacon-chain/state/stategen/hot_state_cache_test.go @@ -6,8 +6,8 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/state" v1 "github.com/prysmaticlabs/prysm/beacon-chain/state/v1" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestHotStateCache_RoundTrip(t *testing.T) { diff --git a/beacon-chain/state/stategen/migrate_test.go b/beacon-chain/state/stategen/migrate_test.go index b642a3a2d..ec2c5d8cc 100644 --- a/beacon-chain/state/stategen/migrate_test.go +++ b/beacon-chain/state/stategen/migrate_test.go @@ -9,9 +9,9 @@ import ( testDB "github.com/prysmaticlabs/prysm/beacon-chain/db/testing" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" logTest "github.com/sirupsen/logrus/hooks/test" ) @@ -19,8 +19,8 @@ func TestMigrateToCold_CanSaveFinalizedInfo(t *testing.T) { ctx := context.Background() beaconDB := testDB.SetupDB(t) service := New(beaconDB) - beaconState, _ := testutil.DeterministicGenesisState(t, 32) - b := testutil.NewBeaconBlock() + beaconState, _ := util.DeterministicGenesisState(t, 32) + b := util.NewBeaconBlock() b.Block.Slot = 1 br, err := b.Block.HashTreeRoot() require.NoError(t, err) @@ -39,10 +39,10 @@ func TestMigrateToCold_HappyPath(t *testing.T) { service := New(beaconDB) service.slotsPerArchivedPoint = 1 - beaconState, _ := testutil.DeterministicGenesisState(t, 32) + beaconState, _ := util.DeterministicGenesisState(t, 32) stateSlot := types.Slot(1) require.NoError(t, beaconState.SetSlot(stateSlot)) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = 2 fRoot, err := b.Block.HashTreeRoot() require.NoError(t, err) @@ -69,7 +69,7 @@ func TestMigrateToCold_RegeneratePath(t *testing.T) { service := New(beaconDB) service.slotsPerArchivedPoint = 1 - beaconState, pks := testutil.DeterministicGenesisState(t, 32) + beaconState, pks := util.DeterministicGenesisState(t, 32) genesisStateRoot, err := beaconState.HashTreeRoot(ctx) require.NoError(t, err) genesis := blocks.NewGenesisBlock(genesisStateRoot[:]) @@ -79,14 +79,14 @@ func TestMigrateToCold_RegeneratePath(t *testing.T) { assert.NoError(t, beaconDB.SaveState(ctx, beaconState, gRoot)) assert.NoError(t, beaconDB.SaveGenesisBlockRoot(ctx, gRoot)) - b1, err := testutil.GenerateFullBlock(beaconState, pks, testutil.DefaultBlockGenConfig(), 1) + b1, err := util.GenerateFullBlock(beaconState, pks, util.DefaultBlockGenConfig(), 1) require.NoError(t, err) r1, err := b1.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, service.beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b1))) require.NoError(t, service.beaconDB.SaveStateSummary(ctx, ðpb.StateSummary{Slot: 1, Root: r1[:]})) - b4, err := testutil.GenerateFullBlock(beaconState, pks, testutil.DefaultBlockGenConfig(), 4) + b4, err := util.GenerateFullBlock(beaconState, pks, util.DefaultBlockGenConfig(), 4) require.NoError(t, err) r4, err := b4.Block.HashTreeRoot() require.NoError(t, err) @@ -119,10 +119,10 @@ func TestMigrateToCold_StateExistsInDB(t *testing.T) { service := New(beaconDB) service.slotsPerArchivedPoint = 1 - beaconState, _ := testutil.DeterministicGenesisState(t, 32) + beaconState, _ := util.DeterministicGenesisState(t, 32) stateSlot := types.Slot(1) require.NoError(t, beaconState.SetSlot(stateSlot)) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = 2 fRoot, err := b.Block.HashTreeRoot() require.NoError(t, err) diff --git a/beacon-chain/state/stategen/replay_test.go b/beacon-chain/state/stategen/replay_test.go index fb48c116f..72846a162 100644 --- a/beacon-chain/state/stategen/replay_test.go +++ b/beacon-chain/state/stategen/replay_test.go @@ -14,16 +14,16 @@ import ( "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" "github.com/prysmaticlabs/prysm/runtime/version" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/protobuf/proto" ) func TestReplayBlocks_AllSkipSlots(t *testing.T) { beaconDB := testDB.SetupDB(t) - beaconState, _ := testutil.DeterministicGenesisState(t, 32) + beaconState, _ := util.DeterministicGenesisState(t, 32) genesisBlock := blocks.NewGenesisBlock([]byte{}) bodyRoot, err := genesisBlock.Block.HashTreeRoot() require.NoError(t, err) @@ -52,7 +52,7 @@ func TestReplayBlocks_AllSkipSlots(t *testing.T) { func TestReplayBlocks_SameSlot(t *testing.T) { beaconDB := testDB.SetupDB(t) - beaconState, _ := testutil.DeterministicGenesisState(t, 32) + beaconState, _ := util.DeterministicGenesisState(t, 32) genesisBlock := blocks.NewGenesisBlock([]byte{}) bodyRoot, err := genesisBlock.Block.HashTreeRoot() require.NoError(t, err) @@ -81,7 +81,7 @@ func TestReplayBlocks_SameSlot(t *testing.T) { func TestReplayBlocks_LowerSlotBlock(t *testing.T) { beaconDB := testDB.SetupDB(t) - beaconState, _ := testutil.DeterministicGenesisState(t, 32) + beaconState, _ := util.DeterministicGenesisState(t, 32) require.NoError(t, beaconState.SetSlot(1)) genesisBlock := blocks.NewGenesisBlock([]byte{}) bodyRoot, err := genesisBlock.Block.HashTreeRoot() @@ -103,7 +103,7 @@ func TestReplayBlocks_LowerSlotBlock(t *testing.T) { service := New(beaconDB) targetSlot := beaconState.Slot() - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = beaconState.Slot() - 1 newState, err := service.ReplayBlocks(context.Background(), beaconState, []block.SignedBeaconBlock{wrapper.WrappedPhase0SignedBeaconBlock(b)}, targetSlot) require.NoError(t, err) @@ -117,7 +117,7 @@ func TestReplayBlocks_ThroughForkBoundary(t *testing.T) { bCfg.ForkVersionSchedule[bytesutil.ToBytes4(bCfg.AltairForkVersion)] = 1 params.OverrideBeaconConfig(bCfg) - beaconState, _ := testutil.DeterministicGenesisState(t, 32) + beaconState, _ := util.DeterministicGenesisState(t, 32) genesisBlock := blocks.NewGenesisBlock([]byte{}) bodyRoot, err := genesisBlock.Block.HashTreeRoot() require.NoError(t, err) @@ -322,7 +322,7 @@ func TestLastSavedBlock_Genesis(t *testing.T) { finalizedInfo: &finalizedInfo{slot: 128}, } - gBlk := testutil.NewBeaconBlock() + gBlk := util.NewBeaconBlock() gRoot, err := gBlk.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, s.beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(gBlk))) @@ -342,13 +342,13 @@ func TestLastSavedBlock_CanGet(t *testing.T) { finalizedInfo: &finalizedInfo{slot: 128}, } - b1 := testutil.NewBeaconBlock() + b1 := util.NewBeaconBlock() b1.Block.Slot = s.finalizedInfo.slot + 5 require.NoError(t, s.beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b1))) - b2 := testutil.NewBeaconBlock() + b2 := util.NewBeaconBlock() b2.Block.Slot = s.finalizedInfo.slot + 10 require.NoError(t, s.beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b2))) - b3 := testutil.NewBeaconBlock() + b3 := util.NewBeaconBlock() b3.Block.Slot = s.finalizedInfo.slot + 20 require.NoError(t, s.beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b3))) @@ -383,8 +383,8 @@ func TestLastSavedState_Genesis(t *testing.T) { finalizedInfo: &finalizedInfo{slot: 128}, } - gBlk := testutil.NewBeaconBlock() - gState, err := testutil.NewBeaconState() + gBlk := util.NewBeaconBlock() + gState, err := util.NewBeaconState() require.NoError(t, err) gRoot, err := gBlk.Block.HashTreeRoot() require.NoError(t, err) @@ -405,20 +405,20 @@ func TestLastSavedState_CanGet(t *testing.T) { finalizedInfo: &finalizedInfo{slot: 128}, } - b1 := testutil.NewBeaconBlock() + b1 := util.NewBeaconBlock() b1.Block.Slot = s.finalizedInfo.slot + 5 require.NoError(t, s.beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b1))) - b2 := testutil.NewBeaconBlock() + b2 := util.NewBeaconBlock() b2.Block.Slot = s.finalizedInfo.slot + 10 require.NoError(t, s.beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b2))) b2Root, err := b2.Block.HashTreeRoot() require.NoError(t, err) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, st.SetSlot(s.finalizedInfo.slot+10)) require.NoError(t, s.beaconDB.SaveState(ctx, st, b2Root)) - b3 := testutil.NewBeaconBlock() + b3 := util.NewBeaconBlock() b3.Block.Slot = s.finalizedInfo.slot + 20 require.NoError(t, s.beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b3))) @@ -435,7 +435,7 @@ func TestLastSavedState_NoSavedBlockState(t *testing.T) { finalizedInfo: &finalizedInfo{slot: 128}, } - b1 := testutil.NewBeaconBlock() + b1 := util.NewBeaconBlock() b1.Block.Slot = 127 require.NoError(t, s.beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b1))) @@ -448,75 +448,75 @@ func TestLastSavedState_NoSavedBlockState(t *testing.T) { // \- B2 -- B4 -- B6 ----- B8 // \- B7 func tree1(t *testing.T, beaconDB db.Database, genesisRoot []byte) ([][32]byte, []*ethpb.SignedBeaconBlock, error) { - b0 := testutil.NewBeaconBlock() + b0 := util.NewBeaconBlock() b0.Block.Slot = 0 b0.Block.ParentRoot = genesisRoot r0, err := b0.Block.HashTreeRoot() if err != nil { return nil, nil, err } - b1 := testutil.NewBeaconBlock() + b1 := util.NewBeaconBlock() b1.Block.Slot = 1 b1.Block.ParentRoot = r0[:] r1, err := b1.Block.HashTreeRoot() if err != nil { return nil, nil, err } - b2 := testutil.NewBeaconBlock() + b2 := util.NewBeaconBlock() b2.Block.Slot = 2 b2.Block.ParentRoot = r1[:] r2, err := b2.Block.HashTreeRoot() if err != nil { return nil, nil, err } - b3 := testutil.NewBeaconBlock() + b3 := util.NewBeaconBlock() b3.Block.Slot = 3 b3.Block.ParentRoot = r1[:] r3, err := b3.Block.HashTreeRoot() if err != nil { return nil, nil, err } - b4 := testutil.NewBeaconBlock() + b4 := util.NewBeaconBlock() b4.Block.Slot = 4 b4.Block.ParentRoot = r2[:] r4, err := b4.Block.HashTreeRoot() if err != nil { return nil, nil, err } - b5 := testutil.NewBeaconBlock() + b5 := util.NewBeaconBlock() b5.Block.Slot = 5 b5.Block.ParentRoot = r3[:] r5, err := b5.Block.HashTreeRoot() if err != nil { return nil, nil, err } - b6 := testutil.NewBeaconBlock() + b6 := util.NewBeaconBlock() b6.Block.Slot = 6 b6.Block.ParentRoot = r4[:] r6, err := b6.Block.HashTreeRoot() if err != nil { return nil, nil, err } - b7 := testutil.NewBeaconBlock() + b7 := util.NewBeaconBlock() b7.Block.Slot = 7 b7.Block.ParentRoot = r6[:] r7, err := b7.Block.HashTreeRoot() if err != nil { return nil, nil, err } - b8 := testutil.NewBeaconBlock() + b8 := util.NewBeaconBlock() b8.Block.Slot = 8 b8.Block.ParentRoot = r6[:] r8, err := b8.Block.HashTreeRoot() if err != nil { return nil, nil, err } - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) returnedBlocks := make([]*ethpb.SignedBeaconBlock, 0) for _, b := range []*ethpb.SignedBeaconBlock{b0, b1, b2, b3, b4, b5, b6, b7, b8} { - beaconBlock := testutil.NewBeaconBlock() + beaconBlock := util.NewBeaconBlock() beaconBlock.Block.Slot = b.Block.Slot beaconBlock.Block.ParentRoot = bytesutil.PadTo(b.Block.ParentRoot, 32) if err := beaconDB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(beaconBlock)); err != nil { @@ -537,21 +537,21 @@ func tree1(t *testing.T, beaconDB db.Database, genesisRoot []byte) ([][32]byte, // \- B2 // \- B2 -- B3 func tree2(t *testing.T, beaconDB db.Database, genesisRoot []byte) ([][32]byte, []*ethpb.SignedBeaconBlock, error) { - b0 := testutil.NewBeaconBlock() + b0 := util.NewBeaconBlock() b0.Block.Slot = 0 b0.Block.ParentRoot = genesisRoot r0, err := b0.Block.HashTreeRoot() if err != nil { return nil, nil, err } - b1 := testutil.NewBeaconBlock() + b1 := util.NewBeaconBlock() b1.Block.Slot = 1 b1.Block.ParentRoot = r0[:] r1, err := b1.Block.HashTreeRoot() if err != nil { return nil, nil, err } - b21 := testutil.NewBeaconBlock() + b21 := util.NewBeaconBlock() b21.Block.Slot = 2 b21.Block.ParentRoot = r1[:] b21.Block.StateRoot = bytesutil.PadTo([]byte{'A'}, 32) @@ -559,7 +559,7 @@ func tree2(t *testing.T, beaconDB db.Database, genesisRoot []byte) ([][32]byte, if err != nil { return nil, nil, err } - b22 := testutil.NewBeaconBlock() + b22 := util.NewBeaconBlock() b22.Block.Slot = 2 b22.Block.ParentRoot = r1[:] b22.Block.StateRoot = bytesutil.PadTo([]byte{'B'}, 32) @@ -567,7 +567,7 @@ func tree2(t *testing.T, beaconDB db.Database, genesisRoot []byte) ([][32]byte, if err != nil { return nil, nil, err } - b23 := testutil.NewBeaconBlock() + b23 := util.NewBeaconBlock() b23.Block.Slot = 2 b23.Block.ParentRoot = r1[:] b23.Block.StateRoot = bytesutil.PadTo([]byte{'C'}, 32) @@ -575,7 +575,7 @@ func tree2(t *testing.T, beaconDB db.Database, genesisRoot []byte) ([][32]byte, if err != nil { return nil, nil, err } - b24 := testutil.NewBeaconBlock() + b24 := util.NewBeaconBlock() b24.Block.Slot = 2 b24.Block.ParentRoot = r1[:] b24.Block.StateRoot = bytesutil.PadTo([]byte{'D'}, 32) @@ -583,19 +583,19 @@ func tree2(t *testing.T, beaconDB db.Database, genesisRoot []byte) ([][32]byte, if err != nil { return nil, nil, err } - b3 := testutil.NewBeaconBlock() + b3 := util.NewBeaconBlock() b3.Block.Slot = 3 b3.Block.ParentRoot = r24[:] r3, err := b3.Block.HashTreeRoot() if err != nil { return nil, nil, err } - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) returnedBlocks := make([]*ethpb.SignedBeaconBlock, 0) for _, b := range []*ethpb.SignedBeaconBlock{b0, b1, b21, b22, b23, b24, b3} { - beaconBlock := testutil.NewBeaconBlock() + beaconBlock := util.NewBeaconBlock() beaconBlock.Block.Slot = b.Block.Slot beaconBlock.Block.ParentRoot = bytesutil.PadTo(b.Block.ParentRoot, 32) beaconBlock.Block.StateRoot = bytesutil.PadTo(b.Block.StateRoot, 32) @@ -617,21 +617,21 @@ func tree2(t *testing.T, beaconDB db.Database, genesisRoot []byte) ([][32]byte, // \- B2 // \- B2 func tree3(t *testing.T, beaconDB db.Database, genesisRoot []byte) ([][32]byte, []*ethpb.SignedBeaconBlock, error) { - b0 := testutil.NewBeaconBlock() + b0 := util.NewBeaconBlock() b0.Block.Slot = 0 b0.Block.ParentRoot = genesisRoot r0, err := b0.Block.HashTreeRoot() if err != nil { return nil, nil, err } - b1 := testutil.NewBeaconBlock() + b1 := util.NewBeaconBlock() b1.Block.Slot = 1 b1.Block.ParentRoot = r0[:] r1, err := b1.Block.HashTreeRoot() if err != nil { return nil, nil, err } - b21 := testutil.NewBeaconBlock() + b21 := util.NewBeaconBlock() b21.Block.Slot = 2 b21.Block.ParentRoot = r1[:] b21.Block.StateRoot = bytesutil.PadTo([]byte{'A'}, 32) @@ -639,7 +639,7 @@ func tree3(t *testing.T, beaconDB db.Database, genesisRoot []byte) ([][32]byte, if err != nil { return nil, nil, err } - b22 := testutil.NewBeaconBlock() + b22 := util.NewBeaconBlock() b22.Block.Slot = 2 b22.Block.ParentRoot = r1[:] b22.Block.StateRoot = bytesutil.PadTo([]byte{'B'}, 32) @@ -647,7 +647,7 @@ func tree3(t *testing.T, beaconDB db.Database, genesisRoot []byte) ([][32]byte, if err != nil { return nil, nil, err } - b23 := testutil.NewBeaconBlock() + b23 := util.NewBeaconBlock() b23.Block.Slot = 2 b23.Block.ParentRoot = r1[:] b23.Block.StateRoot = bytesutil.PadTo([]byte{'C'}, 32) @@ -655,7 +655,7 @@ func tree3(t *testing.T, beaconDB db.Database, genesisRoot []byte) ([][32]byte, if err != nil { return nil, nil, err } - b24 := testutil.NewBeaconBlock() + b24 := util.NewBeaconBlock() b24.Block.Slot = 2 b24.Block.ParentRoot = r1[:] b24.Block.StateRoot = bytesutil.PadTo([]byte{'D'}, 32) @@ -663,12 +663,12 @@ func tree3(t *testing.T, beaconDB db.Database, genesisRoot []byte) ([][32]byte, if err != nil { return nil, nil, err } - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) returnedBlocks := make([]*ethpb.SignedBeaconBlock, 0) for _, b := range []*ethpb.SignedBeaconBlock{b0, b1, b21, b22, b23, b24} { - beaconBlock := testutil.NewBeaconBlock() + beaconBlock := util.NewBeaconBlock() beaconBlock.Block.Slot = b.Block.Slot beaconBlock.Block.ParentRoot = bytesutil.PadTo(b.Block.ParentRoot, 32) beaconBlock.Block.StateRoot = bytesutil.PadTo(b.Block.StateRoot, 32) @@ -691,14 +691,14 @@ func tree3(t *testing.T, beaconDB db.Database, genesisRoot []byte) ([][32]byte, // \- B2 // \- B2 func tree4(t *testing.T, beaconDB db.Database, genesisRoot []byte) ([][32]byte, []*ethpb.SignedBeaconBlock, error) { - b0 := testutil.NewBeaconBlock() + b0 := util.NewBeaconBlock() b0.Block.Slot = 0 b0.Block.ParentRoot = genesisRoot r0, err := b0.Block.HashTreeRoot() if err != nil { return nil, nil, err } - b21 := testutil.NewBeaconBlock() + b21 := util.NewBeaconBlock() b21.Block.Slot = 2 b21.Block.ParentRoot = r0[:] b21.Block.StateRoot = bytesutil.PadTo([]byte{'A'}, 32) @@ -706,7 +706,7 @@ func tree4(t *testing.T, beaconDB db.Database, genesisRoot []byte) ([][32]byte, if err != nil { return nil, nil, err } - b22 := testutil.NewBeaconBlock() + b22 := util.NewBeaconBlock() b22.Block.Slot = 2 b22.Block.ParentRoot = r0[:] b22.Block.StateRoot = bytesutil.PadTo([]byte{'B'}, 32) @@ -714,7 +714,7 @@ func tree4(t *testing.T, beaconDB db.Database, genesisRoot []byte) ([][32]byte, if err != nil { return nil, nil, err } - b23 := testutil.NewBeaconBlock() + b23 := util.NewBeaconBlock() b23.Block.Slot = 2 b23.Block.ParentRoot = r0[:] b23.Block.StateRoot = bytesutil.PadTo([]byte{'C'}, 32) @@ -722,7 +722,7 @@ func tree4(t *testing.T, beaconDB db.Database, genesisRoot []byte) ([][32]byte, if err != nil { return nil, nil, err } - b24 := testutil.NewBeaconBlock() + b24 := util.NewBeaconBlock() b24.Block.Slot = 2 b24.Block.ParentRoot = r0[:] b24.Block.StateRoot = bytesutil.PadTo([]byte{'D'}, 32) @@ -730,12 +730,12 @@ func tree4(t *testing.T, beaconDB db.Database, genesisRoot []byte) ([][32]byte, if err != nil { return nil, nil, err } - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) returnedBlocks := make([]*ethpb.SignedBeaconBlock, 0) for _, b := range []*ethpb.SignedBeaconBlock{b0, b21, b22, b23, b24} { - beaconBlock := testutil.NewBeaconBlock() + beaconBlock := util.NewBeaconBlock() beaconBlock.Block.Slot = b.Block.Slot beaconBlock.Block.ParentRoot = bytesutil.PadTo(b.Block.ParentRoot, 32) beaconBlock.Block.StateRoot = bytesutil.PadTo(b.Block.StateRoot, 32) @@ -757,7 +757,7 @@ func TestLoadFinalizedBlocks(t *testing.T) { s := &State{ beaconDB: beaconDB, } - gBlock := testutil.NewBeaconBlock() + gBlock := util.NewBeaconBlock() gRoot, err := gBlock.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(gBlock))) diff --git a/beacon-chain/state/stategen/service_test.go b/beacon-chain/state/stategen/service_test.go index 9c84c0af6..075476c55 100644 --- a/beacon-chain/state/stategen/service_test.go +++ b/beacon-chain/state/stategen/service_test.go @@ -8,9 +8,9 @@ import ( "github.com/prysmaticlabs/prysm/config/params" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestResume(t *testing.T) { @@ -18,11 +18,11 @@ func TestResume(t *testing.T) { beaconDB := testDB.SetupDB(t) service := New(beaconDB) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() require.NoError(t, service.beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b))) root, err := b.Block.HashTreeRoot() require.NoError(t, err) - beaconState, _ := testutil.DeterministicGenesisState(t, 32) + beaconState, _ := util.DeterministicGenesisState(t, 32) require.NoError(t, beaconState.SetSlot(params.BeaconConfig().SlotsPerEpoch)) require.NoError(t, service.beaconDB.SaveState(ctx, beaconState, root)) require.NoError(t, service.beaconDB.SaveGenesisBlockRoot(ctx, root)) diff --git a/beacon-chain/state/stategen/setter_test.go b/beacon-chain/state/stategen/setter_test.go index 1ef467e55..f0dc9ce20 100644 --- a/beacon-chain/state/stategen/setter_test.go +++ b/beacon-chain/state/stategen/setter_test.go @@ -7,9 +7,9 @@ import ( testDB "github.com/prysmaticlabs/prysm/beacon-chain/db/testing" "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" logTest "github.com/sirupsen/logrus/hooks/test" ) @@ -19,7 +19,7 @@ func TestSaveState_HotStateCanBeSaved(t *testing.T) { service := New(beaconDB) service.slotsPerArchivedPoint = 1 - beaconState, _ := testutil.DeterministicGenesisState(t, 32) + beaconState, _ := util.DeterministicGenesisState(t, 32) // This goes to hot section, verify it can save on epoch boundary. require.NoError(t, beaconState.SetSlot(params.BeaconConfig().SlotsPerEpoch)) @@ -40,7 +40,7 @@ func TestSaveState_HotStateCached(t *testing.T) { service := New(beaconDB) service.slotsPerArchivedPoint = 1 - beaconState, _ := testutil.DeterministicGenesisState(t, 32) + beaconState, _ := util.DeterministicGenesisState(t, 32) require.NoError(t, beaconState.SetSlot(params.BeaconConfig().SlotsPerEpoch)) // Cache the state prior. @@ -59,7 +59,7 @@ func TestState_ForceCheckpoint_SavesStateToDatabase(t *testing.T) { beaconDB := testDB.SetupDB(t) svc := New(beaconDB) - beaconState, _ := testutil.DeterministicGenesisState(t, 32) + beaconState, _ := util.DeterministicGenesisState(t, 32) require.NoError(t, beaconState.SetSlot(params.BeaconConfig().SlotsPerEpoch)) r := [32]byte{'a'} @@ -79,7 +79,7 @@ func TestSaveState_Alreadyhas(t *testing.T) { beaconDB := testDB.SetupDB(t) service := New(beaconDB) - beaconState, _ := testutil.DeterministicGenesisState(t, 32) + beaconState, _ := util.DeterministicGenesisState(t, 32) require.NoError(t, beaconState.SetSlot(params.BeaconConfig().SlotsPerEpoch)) r := [32]byte{'A'} @@ -98,7 +98,7 @@ func TestSaveState_CanSaveOnEpochBoundary(t *testing.T) { beaconDB := testDB.SetupDB(t) service := New(beaconDB) - beaconState, _ := testutil.DeterministicGenesisState(t, 32) + beaconState, _ := util.DeterministicGenesisState(t, 32) require.NoError(t, beaconState.SetSlot(params.BeaconConfig().SlotsPerEpoch)) r := [32]byte{'A'} @@ -119,10 +119,10 @@ func TestSaveState_NoSaveNotEpochBoundary(t *testing.T) { beaconDB := testDB.SetupDB(t) service := New(beaconDB) - beaconState, _ := testutil.DeterministicGenesisState(t, 32) + beaconState, _ := util.DeterministicGenesisState(t, 32) require.NoError(t, beaconState.SetSlot(params.BeaconConfig().SlotsPerEpoch-1)) r := [32]byte{'A'} - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b))) gRoot, err := b.Block.HashTreeRoot() require.NoError(t, err) @@ -143,7 +143,7 @@ func TestSaveState_CanSaveHotStateToDB(t *testing.T) { beaconDB := testDB.SetupDB(t) service := New(beaconDB) service.EnableSaveHotStateToDB(ctx) - beaconState, _ := testutil.DeterministicGenesisState(t, 32) + beaconState, _ := util.DeterministicGenesisState(t, 32) require.NoError(t, beaconState.SetSlot(defaultHotStateDBInterval)) r := [32]byte{'A'} @@ -182,7 +182,7 @@ func TestEnableSaveHotStateToDB_Disabled(t *testing.T) { beaconDB := testDB.SetupDB(t) service := New(beaconDB) service.saveHotStateDB.enabled = true - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b))) r, err := b.Block.HashTreeRoot() require.NoError(t, err) diff --git a/beacon-chain/state/stateutil/BUILD.bazel b/beacon-chain/state/stateutil/BUILD.bazel index aae9b8f99..025209d4d 100644 --- a/beacon-chain/state/stateutil/BUILD.bazel +++ b/beacon-chain/state/stateutil/BUILD.bazel @@ -18,8 +18,8 @@ go_library( "//proto/migration:__subpackages__", "//proto/testing:__subpackages__", "//shared/blockutil:__subpackages__", - "//shared/testutil:__subpackages__", "//slasher:__subpackages__", + "//testing:__subpackages__", "//testing/fuzz:__pkg__", "//tools/blocktree:__pkg__", "//tools/pcli:__pkg__", @@ -58,9 +58,9 @@ go_test( "//encoding/ssz:go_default_library", "//proto/prysm/v1alpha1:go_default_library", "//runtime/interop:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", ], ) @@ -84,7 +84,7 @@ go_test( "//crypto/hash:go_default_library", "//encoding/ssz:go_default_library", "//proto/prysm/v1alpha1:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", ], ) diff --git a/beacon-chain/state/stateutil/benchmark_test.go b/beacon-chain/state/stateutil/benchmark_test.go index 9b716b0d5..90a187d08 100644 --- a/beacon-chain/state/stateutil/benchmark_test.go +++ b/beacon-chain/state/stateutil/benchmark_test.go @@ -5,7 +5,7 @@ import ( "github.com/prysmaticlabs/prysm/crypto/hash" "github.com/prysmaticlabs/prysm/encoding/ssz" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) func BenchmarkMerkleize_Buffered(b *testing.B) { diff --git a/beacon-chain/state/stateutil/state_root_test.go b/beacon-chain/state/stateutil/state_root_test.go index 79755bb3f..32fa72640 100644 --- a/beacon-chain/state/stateutil/state_root_test.go +++ b/beacon-chain/state/stateutil/state_root_test.go @@ -9,8 +9,8 @@ import ( "github.com/prysmaticlabs/prysm/config/params" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/runtime/interop" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestState_FieldCount(t *testing.T) { diff --git a/beacon-chain/state/stateutil/trie_helpers_test.go b/beacon-chain/state/stateutil/trie_helpers_test.go index fb08779ef..4149a5622 100644 --- a/beacon-chain/state/stateutil/trie_helpers_test.go +++ b/beacon-chain/state/stateutil/trie_helpers_test.go @@ -10,13 +10,13 @@ import ( "github.com/prysmaticlabs/prysm/crypto/hash" "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestReturnTrieLayer_OK(t *testing.T) { - newState, _ := testutil.DeterministicGenesisState(t, 32) + newState, _ := util.DeterministicGenesisState(t, 32) root, err := v1.RootsArrayHashTreeRoot(newState.BlockRoots(), uint64(params.BeaconConfig().SlotsPerHistoricalRoot), "BlockRoots") require.NoError(t, err) blockRts := newState.BlockRoots() @@ -30,7 +30,7 @@ func TestReturnTrieLayer_OK(t *testing.T) { } func TestReturnTrieLayerVariable_OK(t *testing.T) { - newState, _ := testutil.DeterministicGenesisState(t, 32) + newState, _ := util.DeterministicGenesisState(t, 32) root, err := v1.ValidatorRegistryRoot(newState.Validators()) require.NoError(t, err) hasher := hash.CustomSHA256Hasher() @@ -49,7 +49,7 @@ func TestReturnTrieLayerVariable_OK(t *testing.T) { } func TestRecomputeFromLayer_FixedSizedArray(t *testing.T) { - newState, _ := testutil.DeterministicGenesisState(t, 32) + newState, _ := util.DeterministicGenesisState(t, 32) blockRts := newState.BlockRoots() roots := make([][32]byte, 0, len(blockRts)) for _, rt := range blockRts { @@ -70,7 +70,7 @@ func TestRecomputeFromLayer_FixedSizedArray(t *testing.T) { } func TestRecomputeFromLayer_VariableSizedArray(t *testing.T) { - newState, _ := testutil.DeterministicGenesisState(t, 32) + newState, _ := util.DeterministicGenesisState(t, 32) validators := newState.Validators() hasher := hash.CustomSHA256Hasher() roots := make([][32]byte, 0, len(validators)) diff --git a/beacon-chain/state/stateutil/validator_root_test.go b/beacon-chain/state/stateutil/validator_root_test.go index ce33f9df0..9526a062f 100644 --- a/beacon-chain/state/stateutil/validator_root_test.go +++ b/beacon-chain/state/stateutil/validator_root_test.go @@ -4,7 +4,7 @@ import ( "testing" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" ) func Test_handleValidatorSlice_OutOfRange(t *testing.T) { diff --git a/beacon-chain/state/types/BUILD.bazel b/beacon-chain/state/types/BUILD.bazel index 8f3fc17bc..43ec2319b 100644 --- a/beacon-chain/state/types/BUILD.bazel +++ b/beacon-chain/state/types/BUILD.bazel @@ -12,5 +12,5 @@ go_test( name = "go_default_test", srcs = ["types_test.go"], embed = [":go_default_library"], - deps = ["//shared/testutil/assert:go_default_library"], + deps = ["//testing/assert:go_default_library"], ) diff --git a/beacon-chain/state/types/types_test.go b/beacon-chain/state/types/types_test.go index 53fe30575..99394d2fd 100644 --- a/beacon-chain/state/types/types_test.go +++ b/beacon-chain/state/types/types_test.go @@ -3,7 +3,7 @@ package types import ( "testing" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" ) func TestStateFieldIndexes(t *testing.T) { diff --git a/beacon-chain/state/v1/BUILD.bazel b/beacon-chain/state/v1/BUILD.bazel index 8d5dbf1ec..73f99df81 100644 --- a/beacon-chain/state/v1/BUILD.bazel +++ b/beacon-chain/state/v1/BUILD.bazel @@ -35,11 +35,11 @@ go_library( "//proto/testing:__subpackages__", "//runtime/interop:__subpackages__", "//shared/aggregation:__subpackages__", - "//shared/testutil:__pkg__", "//slasher/rpc:__subpackages__", "//testing/benchmark:__pkg__", "//testing/fuzz:__pkg__", "//testing/spectest:__subpackages__", + "//testing/util:__pkg__", "//tools/benchmark-files-gen:__pkg__", "//tools/pcli:__pkg__", ], @@ -91,9 +91,9 @@ go_test( "//encoding/bytesutil:go_default_library", "//proto/prysm/v1alpha1:go_default_library", "//runtime/interop:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", diff --git a/beacon-chain/state/v1/getters_attestation_test.go b/beacon-chain/state/v1/getters_attestation_test.go index b054c841b..af85b2661 100644 --- a/beacon-chain/state/v1/getters_attestation_test.go +++ b/beacon-chain/state/v1/getters_attestation_test.go @@ -4,7 +4,7 @@ import ( "testing" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestBeaconState_PreviousEpochAttestations(t *testing.T) { diff --git a/beacon-chain/state/v1/getters_block_test.go b/beacon-chain/state/v1/getters_block_test.go index cb86e04e8..651106dc6 100644 --- a/beacon-chain/state/v1/getters_block_test.go +++ b/beacon-chain/state/v1/getters_block_test.go @@ -6,7 +6,7 @@ import ( "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" v1alpha1 "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestBeaconState_LatestBlockHeader(t *testing.T) { diff --git a/beacon-chain/state/v1/getters_test.go b/beacon-chain/state/v1/getters_test.go index 73db5f82a..a985a3f2a 100644 --- a/beacon-chain/state/v1/getters_test.go +++ b/beacon-chain/state/v1/getters_test.go @@ -8,8 +8,8 @@ import ( types "github.com/prysmaticlabs/eth2-types" eth "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestBeaconState_SlotDataRace(t *testing.T) { diff --git a/beacon-chain/state/v1/getters_validator_test.go b/beacon-chain/state/v1/getters_validator_test.go index 54e1828ba..cb2834976 100644 --- a/beacon-chain/state/v1/getters_validator_test.go +++ b/beacon-chain/state/v1/getters_validator_test.go @@ -5,8 +5,8 @@ import ( v1 "github.com/prysmaticlabs/prysm/beacon-chain/state/v1" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestBeaconState_ValidatorAtIndexReadOnly_HandlesNilSlice(t *testing.T) { diff --git a/beacon-chain/state/v1/readonly_validator_test.go b/beacon-chain/state/v1/readonly_validator_test.go index f448e17ad..0207e7b7f 100644 --- a/beacon-chain/state/v1/readonly_validator_test.go +++ b/beacon-chain/state/v1/readonly_validator_test.go @@ -6,8 +6,8 @@ import ( types "github.com/prysmaticlabs/eth2-types" v1 "github.com/prysmaticlabs/prysm/beacon-chain/state/v1" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestReadOnlyValidator_ReturnsErrorOnNil(t *testing.T) { diff --git a/beacon-chain/state/v1/references_test.go b/beacon-chain/state/v1/references_test.go index a2a3150b7..6feb76de3 100644 --- a/beacon-chain/state/v1/references_test.go +++ b/beacon-chain/state/v1/references_test.go @@ -11,8 +11,8 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/state/types" "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestStateReferenceSharing_Finalizer(t *testing.T) { diff --git a/beacon-chain/state/v1/setters_attestation_test.go b/beacon-chain/state/v1/setters_attestation_test.go index 546f61fef..616682502 100644 --- a/beacon-chain/state/v1/setters_attestation_test.go +++ b/beacon-chain/state/v1/setters_attestation_test.go @@ -9,8 +9,8 @@ import ( "github.com/prysmaticlabs/prysm/config/params" eth "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestBeaconState_RotateAttestations(t *testing.T) { diff --git a/beacon-chain/state/v1/state_test.go b/beacon-chain/state/v1/state_test.go index 9f15b5266..4d8c90396 100644 --- a/beacon-chain/state/v1/state_test.go +++ b/beacon-chain/state/v1/state_test.go @@ -9,7 +9,7 @@ import ( "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" ) func TestValidatorMap_DistinctCopy(t *testing.T) { diff --git a/beacon-chain/state/v1/state_trie_test.go b/beacon-chain/state/v1/state_trie_test.go index 37cd4c4f7..542eb1a16 100644 --- a/beacon-chain/state/v1/state_trie_test.go +++ b/beacon-chain/state/v1/state_trie_test.go @@ -11,13 +11,13 @@ import ( "github.com/prysmaticlabs/prysm/encoding/bytesutil" eth "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestInitializeFromProto(t *testing.T) { - testState, _ := testutil.DeterministicGenesisState(t, 64) + testState, _ := util.DeterministicGenesisState(t, 64) pbState, err := v1.ProtobufBeaconState(testState.InnerStateUnsafe()) require.NoError(t, err) type test struct { @@ -60,7 +60,7 @@ func TestInitializeFromProto(t *testing.T) { } func TestInitializeFromProtoUnsafe(t *testing.T) { - testState, _ := testutil.DeterministicGenesisState(t, 64) + testState, _ := util.DeterministicGenesisState(t, 64) pbState, err := v1.ProtobufBeaconState(testState.InnerStateUnsafe()) require.NoError(t, err) type test struct { @@ -103,7 +103,7 @@ func TestInitializeFromProtoUnsafe(t *testing.T) { } func TestBeaconState_HashTreeRoot(t *testing.T) { - testState, _ := testutil.DeterministicGenesisState(t, 64) + testState, _ := util.DeterministicGenesisState(t, 64) type test struct { name string @@ -172,7 +172,7 @@ func TestBeaconState_HashTreeRoot(t *testing.T) { } func TestBeaconState_HashTreeRoot_FieldTrie(t *testing.T) { - testState, _ := testutil.DeterministicGenesisState(t, 64) + testState, _ := util.DeterministicGenesisState(t, 64) type test struct { name string @@ -241,7 +241,7 @@ func TestBeaconState_HashTreeRoot_FieldTrie(t *testing.T) { } func TestBeaconState_AppendValidator_DoesntMutateCopy(t *testing.T) { - st0, err := testutil.NewBeaconState() + st0, err := util.NewBeaconState() require.NoError(t, err) st1 := st0.Copy() originalCount := st1.NumValidators() diff --git a/beacon-chain/state/v1/types_test.go b/beacon-chain/state/v1/types_test.go index d10babcd3..5f71a2545 100644 --- a/beacon-chain/state/v1/types_test.go +++ b/beacon-chain/state/v1/types_test.go @@ -11,8 +11,8 @@ import ( "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/runtime/interop" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" log "github.com/sirupsen/logrus" "google.golang.org/protobuf/proto" ) diff --git a/beacon-chain/state/v2/BUILD.bazel b/beacon-chain/state/v2/BUILD.bazel index b2fca99aa..99b8f8db4 100644 --- a/beacon-chain/state/v2/BUILD.bazel +++ b/beacon-chain/state/v2/BUILD.bazel @@ -36,8 +36,8 @@ go_library( visibility = [ "//beacon-chain:__subpackages__", "//proto/migration:__subpackages__", - "//shared/testutil:__pkg__", "//testing/spectest:__subpackages__", + "//testing/util:__pkg__", ], deps = [ "//beacon-chain/state:go_default_library", @@ -83,8 +83,8 @@ go_test( "//config/params:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/prysm/v1alpha1:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", ], ) diff --git a/beacon-chain/state/v2/deprecated_getters_test.go b/beacon-chain/state/v2/deprecated_getters_test.go index 63d4f0b5b..6e4aafe62 100644 --- a/beacon-chain/state/v2/deprecated_getters_test.go +++ b/beacon-chain/state/v2/deprecated_getters_test.go @@ -3,7 +3,7 @@ package v2 import ( "testing" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestBeaconState_CurrentEpochAttestations(t *testing.T) { diff --git a/beacon-chain/state/v2/deprecated_setters_test.go b/beacon-chain/state/v2/deprecated_setters_test.go index 56fb73ff6..718c4f07b 100644 --- a/beacon-chain/state/v2/deprecated_setters_test.go +++ b/beacon-chain/state/v2/deprecated_setters_test.go @@ -3,7 +3,7 @@ package v2 import ( "testing" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestBeaconState_AppendCurrentEpochAttestations(t *testing.T) { diff --git a/beacon-chain/state/v2/getters_block_test.go b/beacon-chain/state/v2/getters_block_test.go index 3fb58d0b6..d7ae85d06 100644 --- a/beacon-chain/state/v2/getters_block_test.go +++ b/beacon-chain/state/v2/getters_block_test.go @@ -6,7 +6,7 @@ import ( "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" v1alpha1 "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestBeaconState_LatestBlockHeader(t *testing.T) { diff --git a/beacon-chain/state/v2/getters_test.go b/beacon-chain/state/v2/getters_test.go index 2a0d9266a..e2849a011 100644 --- a/beacon-chain/state/v2/getters_test.go +++ b/beacon-chain/state/v2/getters_test.go @@ -7,8 +7,8 @@ import ( types "github.com/prysmaticlabs/eth2-types" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestBeaconState_SlotDataRace(t *testing.T) { diff --git a/beacon-chain/state/v2/getters_validator_test.go b/beacon-chain/state/v2/getters_validator_test.go index f77678132..454a1bbf6 100644 --- a/beacon-chain/state/v2/getters_validator_test.go +++ b/beacon-chain/state/v2/getters_validator_test.go @@ -5,8 +5,8 @@ import ( v1 "github.com/prysmaticlabs/prysm/beacon-chain/state/v1" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestBeaconState_ValidatorAtIndexReadOnly_HandlesNilSlice(t *testing.T) { diff --git a/beacon-chain/state/v2/setters_test.go b/beacon-chain/state/v2/setters_test.go index 0a9547332..f05031c32 100644 --- a/beacon-chain/state/v2/setters_test.go +++ b/beacon-chain/state/v2/setters_test.go @@ -8,8 +8,8 @@ import ( "github.com/prysmaticlabs/prysm/config/params" eth "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestAppendBeyondIndicesLimit(t *testing.T) { diff --git a/beacon-chain/state/v2/state_trie_test.go b/beacon-chain/state/v2/state_trie_test.go index f1c8a1669..8f8508c70 100644 --- a/beacon-chain/state/v2/state_trie_test.go +++ b/beacon-chain/state/v2/state_trie_test.go @@ -9,8 +9,8 @@ import ( "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestValidatorMap_DistinctCopy(t *testing.T) { diff --git a/beacon-chain/sync/BUILD.bazel b/beacon-chain/sync/BUILD.bazel index 39e760437..8f8b40f1a 100644 --- a/beacon-chain/sync/BUILD.bazel +++ b/beacon-chain/sync/BUILD.bazel @@ -195,9 +195,9 @@ go_test( "//proto/prysm/v1alpha1/block:go_default_library", "//proto/prysm/v1alpha1/metadata:go_default_library", "//proto/prysm/v1alpha1/wrapper:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "//time:go_default_library", "@com_github_d4l3k_messagediff//:go_default_library", "@com_github_ethereum_go_ethereum//p2p/enr:go_default_library", diff --git a/beacon-chain/sync/batch_verifier_test.go b/beacon-chain/sync/batch_verifier_test.go index 5bd06c59e..3bd580553 100644 --- a/beacon-chain/sync/batch_verifier_test.go +++ b/beacon-chain/sync/batch_verifier_test.go @@ -6,12 +6,12 @@ import ( pubsub "github.com/libp2p/go-libp2p-pubsub" "github.com/prysmaticlabs/prysm/crypto/bls" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestValidateWithBatchVerifier(t *testing.T) { - _, keys, err := testutil.DeterministicDepositsAndKeys(10) + _, keys, err := util.DeterministicDepositsAndKeys(10) assert.NoError(t, err) sig := keys[0].Sign(make([]byte, 32)) badSig := keys[1].Sign(make([]byte, 32)) diff --git a/beacon-chain/sync/context_test.go b/beacon-chain/sync/context_test.go index 2e65342ec..e4cc30f5f 100644 --- a/beacon-chain/sync/context_test.go +++ b/beacon-chain/sync/context_test.go @@ -12,8 +12,8 @@ import ( swarm "github.com/libp2p/go-libp2p-swarm" "github.com/prysmaticlabs/prysm/beacon-chain/p2p" p2ptest "github.com/prysmaticlabs/prysm/beacon-chain/p2p/testing" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestContextWrite_NoWrites(t *testing.T) { @@ -33,7 +33,7 @@ func TestContextWrite_NoWrites(t *testing.T) { // Nothing will be written to the stream assert.NoError(t, writeContextToStream(nil, strm, nil)) - if testutil.WaitTimeout(wg, 1*time.Second) { + if util.WaitTimeout(wg, 1*time.Second) { t.Fatal("Did not receive stream within 1 sec") } } @@ -68,7 +68,7 @@ func TestContextRead_NoReads(t *testing.T) { n, err := strm.Write(wantedData) assert.NoError(t, err) assert.Equal(t, len(wantedData), n) - if testutil.WaitTimeout(wg, 1*time.Second) { + if util.WaitTimeout(wg, 1*time.Second) { t.Fatal("Did not receive stream within 1 sec") } } diff --git a/beacon-chain/sync/decode_pubsub_test.go b/beacon-chain/sync/decode_pubsub_test.go index 07e2297e1..50b0acbcd 100644 --- a/beacon-chain/sync/decode_pubsub_test.go +++ b/beacon-chain/sync/decode_pubsub_test.go @@ -18,8 +18,8 @@ import ( "github.com/prysmaticlabs/prysm/config/params" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestService_decodePubsubMessage(t *testing.T) { @@ -63,7 +63,7 @@ func TestService_decodePubsubMessage(t *testing.T) { Message: &pb.Message{ Data: func() []byte { buf := new(bytes.Buffer) - if _, err := p2ptesting.NewTestP2P(t).Encoding().EncodeGossip(buf, testutil.NewBeaconBlock()); err != nil { + if _, err := p2ptesting.NewTestP2P(t).Encoding().EncodeGossip(buf, util.NewBeaconBlock()); err != nil { t.Fatal(err) } return buf.Bytes() @@ -71,7 +71,7 @@ func TestService_decodePubsubMessage(t *testing.T) { }, }, wantErr: nil, - want: wrapper.WrappedPhase0SignedBeaconBlock(testutil.NewBeaconBlock()), + want: wrapper.WrappedPhase0SignedBeaconBlock(util.NewBeaconBlock()), }, } for _, tt := range tests { diff --git a/beacon-chain/sync/error_test.go b/beacon-chain/sync/error_test.go index 7e3259976..235b7e98f 100644 --- a/beacon-chain/sync/error_test.go +++ b/beacon-chain/sync/error_test.go @@ -6,8 +6,8 @@ import ( p2ptest "github.com/prysmaticlabs/prysm/beacon-chain/p2p/testing" "github.com/prysmaticlabs/prysm/beacon-chain/p2p/types" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestRegularSync_generateErrorResponse(t *testing.T) { diff --git a/beacon-chain/sync/fork_watcher_test.go b/beacon-chain/sync/fork_watcher_test.go index 974a0f0ef..b0429cb85 100644 --- a/beacon-chain/sync/fork_watcher_test.go +++ b/beacon-chain/sync/fork_watcher_test.go @@ -13,7 +13,7 @@ import ( mockSync "github.com/prysmaticlabs/prysm/beacon-chain/sync/initial-sync/testing" "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/network/forks" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" ) func TestService_CheckForNextEpochFork(t *testing.T) { diff --git a/beacon-chain/sync/initial-sync/BUILD.bazel b/beacon-chain/sync/initial-sync/BUILD.bazel index 342bdc4df..49abe81ea 100644 --- a/beacon-chain/sync/initial-sync/BUILD.bazel +++ b/beacon-chain/sync/initial-sync/BUILD.bazel @@ -80,9 +80,9 @@ go_test( "//encoding/bytesutil:go_default_library", "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/wrapper:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "//time:go_default_library", "@com_github_ethereum_go_ethereum//p2p/enr:go_default_library", "@com_github_kevinms_leakybucket_go//:go_default_library", @@ -131,9 +131,9 @@ go_test( "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/block:go_default_library", "//proto/prysm/v1alpha1/wrapper:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "//time:go_default_library", "@com_github_ethereum_go_ethereum//p2p/enr:go_default_library", "@com_github_kevinms_leakybucket_go//:go_default_library", diff --git a/beacon-chain/sync/initial-sync/blocks_fetcher_peers_test.go b/beacon-chain/sync/initial-sync/blocks_fetcher_peers_test.go index 299661149..1e1697707 100644 --- a/beacon-chain/sync/initial-sync/blocks_fetcher_peers_test.go +++ b/beacon-chain/sync/initial-sync/blocks_fetcher_peers_test.go @@ -13,8 +13,8 @@ import ( types "github.com/prysmaticlabs/eth2-types" "github.com/prysmaticlabs/prysm/beacon-chain/p2p/peers/scorers" "github.com/prysmaticlabs/prysm/cmd/beacon-chain/flags" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" prysmTime "github.com/prysmaticlabs/prysm/time" ) diff --git a/beacon-chain/sync/initial-sync/blocks_fetcher_test.go b/beacon-chain/sync/initial-sync/blocks_fetcher_test.go index 140c3ee47..08986a339 100644 --- a/beacon-chain/sync/initial-sync/blocks_fetcher_test.go +++ b/beacon-chain/sync/initial-sync/blocks_fetcher_test.go @@ -25,9 +25,9 @@ import ( p2ppb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" "github.com/sirupsen/logrus" logTest "github.com/sirupsen/logrus/hooks/test" ) @@ -268,10 +268,10 @@ func TestBlocksFetcher_RoundRobin(t *testing.T) { genesisRoot := cache.rootCache[0] cache.RUnlock() - err := beaconDB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(testutil.NewBeaconBlock())) + err := beaconDB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(util.NewBeaconBlock())) require.NoError(t, err) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) mc := &mock.ChainService{ @@ -611,7 +611,7 @@ func TestBlocksFetcher_requestBlocksFromPeerReturningInvalidBlocks(t *testing.T) handlerGenFn: func(req *p2ppb.BeaconBlocksByRangeRequest) func(stream network.Stream) { return func(stream network.Stream) { for i := req.StartSlot; i < req.StartSlot.Add(req.Count*req.Step); i += types.Slot(req.Step) { - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.Slot = i mchain := &mock.ChainService{Genesis: time.Now(), ValidatorsRoot: [32]byte{}} assert.NoError(t, beaconsync.WriteBlockChunk(stream, mchain, p1.Encoding(), wrapper.WrappedPhase0SignedBeaconBlock(blk))) @@ -633,7 +633,7 @@ func TestBlocksFetcher_requestBlocksFromPeerReturningInvalidBlocks(t *testing.T) handlerGenFn: func(req *p2ppb.BeaconBlocksByRangeRequest) func(stream network.Stream) { return func(stream network.Stream) { for i := req.StartSlot; i < req.StartSlot.Add(req.Count*req.Step+1); i += types.Slot(req.Step) { - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.Slot = i chain := &mock.ChainService{Genesis: time.Now(), ValidatorsRoot: [32]byte{}} assert.NoError(t, beaconsync.WriteBlockChunk(stream, chain, p1.Encoding(), wrapper.WrappedPhase0SignedBeaconBlock(blk))) @@ -655,12 +655,12 @@ func TestBlocksFetcher_requestBlocksFromPeerReturningInvalidBlocks(t *testing.T) }, handlerGenFn: func(req *p2ppb.BeaconBlocksByRangeRequest) func(stream network.Stream) { return func(stream network.Stream) { - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.Slot = 163 chain := &mock.ChainService{Genesis: time.Now(), ValidatorsRoot: [32]byte{}} assert.NoError(t, beaconsync.WriteBlockChunk(stream, chain, p1.Encoding(), wrapper.WrappedPhase0SignedBeaconBlock(blk))) - blk = testutil.NewBeaconBlock() + blk = util.NewBeaconBlock() blk.Block.Slot = 162 assert.NoError(t, beaconsync.WriteBlockChunk(stream, chain, p1.Encoding(), wrapper.WrappedPhase0SignedBeaconBlock(blk))) assert.NoError(t, stream.Close()) @@ -680,13 +680,13 @@ func TestBlocksFetcher_requestBlocksFromPeerReturningInvalidBlocks(t *testing.T) }, handlerGenFn: func(req *p2ppb.BeaconBlocksByRangeRequest) func(stream network.Stream) { return func(stream network.Stream) { - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.Slot = 160 chain := &mock.ChainService{Genesis: time.Now(), ValidatorsRoot: [32]byte{}} assert.NoError(t, beaconsync.WriteBlockChunk(stream, chain, p1.Encoding(), wrapper.WrappedPhase0SignedBeaconBlock(blk))) - blk = testutil.NewBeaconBlock() + blk = util.NewBeaconBlock() blk.Block.Slot = 160 assert.NoError(t, beaconsync.WriteBlockChunk(stream, chain, p1.Encoding(), wrapper.WrappedPhase0SignedBeaconBlock(blk))) assert.NoError(t, stream.Close()) @@ -710,7 +710,7 @@ func TestBlocksFetcher_requestBlocksFromPeerReturningInvalidBlocks(t *testing.T) assert.NoError(t, stream.Close()) }() for i := req.StartSlot; i < req.StartSlot.Add(req.Count*req.Step); i += types.Slot(req.Step) { - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() chain := &mock.ChainService{Genesis: time.Now(), ValidatorsRoot: [32]byte{}} // Patch mid block, with invalid slot number. if i == req.StartSlot.Add(req.Count*req.Step/2) { @@ -742,7 +742,7 @@ func TestBlocksFetcher_requestBlocksFromPeerReturningInvalidBlocks(t *testing.T) assert.NoError(t, stream.Close()) }() for i := req.StartSlot; i < req.StartSlot.Add(req.Count*req.Step); i += types.Slot(req.Step) { - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() chain := &mock.ChainService{Genesis: time.Now(), ValidatorsRoot: [32]byte{}} // Patch mid block, with invalid slot number. if i == req.StartSlot.Add(req.Count*req.Step/2) { @@ -770,12 +770,12 @@ func TestBlocksFetcher_requestBlocksFromPeerReturningInvalidBlocks(t *testing.T) }, handlerGenFn: func(req *p2ppb.BeaconBlocksByRangeRequest) func(stream network.Stream) { return func(stream network.Stream) { - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.Slot = 100 chain := &mock.ChainService{Genesis: time.Now(), ValidatorsRoot: [32]byte{}} assert.NoError(t, beaconsync.WriteBlockChunk(stream, chain, p1.Encoding(), wrapper.WrappedPhase0SignedBeaconBlock(blk))) - blk = testutil.NewBeaconBlock() + blk = util.NewBeaconBlock() blk.Block.Slot = 105 assert.NoError(t, beaconsync.WriteBlockChunk(stream, chain, p1.Encoding(), wrapper.WrappedPhase0SignedBeaconBlock(blk))) assert.NoError(t, stream.Close()) @@ -794,12 +794,12 @@ func TestBlocksFetcher_requestBlocksFromPeerReturningInvalidBlocks(t *testing.T) }, handlerGenFn: func(req *p2ppb.BeaconBlocksByRangeRequest) func(stream network.Stream) { return func(stream network.Stream) { - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.Slot = 100 chain := &mock.ChainService{Genesis: time.Now(), ValidatorsRoot: [32]byte{}} assert.NoError(t, beaconsync.WriteBlockChunk(stream, chain, p1.Encoding(), wrapper.WrappedPhase0SignedBeaconBlock(blk))) - blk = testutil.NewBeaconBlock() + blk = util.NewBeaconBlock() blk.Block.Slot = 103 assert.NoError(t, beaconsync.WriteBlockChunk(stream, chain, p1.Encoding(), wrapper.WrappedPhase0SignedBeaconBlock(blk))) assert.NoError(t, stream.Close()) diff --git a/beacon-chain/sync/initial-sync/blocks_fetcher_utils_test.go b/beacon-chain/sync/initial-sync/blocks_fetcher_utils_test.go index b2b2d64c6..277372de9 100644 --- a/beacon-chain/sync/initial-sync/blocks_fetcher_utils_test.go +++ b/beacon-chain/sync/initial-sync/blocks_fetcher_utils_test.go @@ -22,9 +22,9 @@ import ( eth "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" p2ppb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestBlocksFetcher_nonSkippedSlotAfter(t *testing.T) { @@ -104,7 +104,7 @@ func TestBlocksFetcher_nonSkippedSlotAfter(t *testing.T) { } } }() - if testutil.WaitTimeout(&wg, 5*time.Second) { + if util.WaitTimeout(&wg, 5*time.Second) { t.Errorf("Isolated non-skipped slot not found in %d iterations: %v", i, expectedSlot) } else { log.Debugf("Isolated non-skipped slot found in %d iterations", i) @@ -168,7 +168,7 @@ func TestBlocksFetcher_findFork(t *testing.T) { genesisRoot, err := genesisBlock.Block.HashTreeRoot() require.NoError(t, err) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) mc := &mock.ChainService{ State: st, @@ -320,7 +320,7 @@ func TestBlocksFetcher_findForkWithPeer(t *testing.T) { genesisRoot, err := genesisBlock.Block.HashTreeRoot() require.NoError(t, err) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) mc := &mock.ChainService{ State: st, @@ -432,7 +432,7 @@ func TestBlocksFetcher_findAncestor(t *testing.T) { genesisRoot, err := genesisBlock.Block.HashTreeRoot() require.NoError(t, err) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) mc := &mock.ChainService{ State: st, diff --git a/beacon-chain/sync/initial-sync/blocks_queue_test.go b/beacon-chain/sync/initial-sync/blocks_queue_test.go index a353e6400..cf4e88ee8 100644 --- a/beacon-chain/sync/initial-sync/blocks_queue_test.go +++ b/beacon-chain/sync/initial-sync/blocks_queue_test.go @@ -21,9 +21,9 @@ import ( eth "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" prysmTime "github.com/prysmaticlabs/prysm/time" logTest "github.com/sirupsen/logrus/hooks/test" ) @@ -526,8 +526,8 @@ func TestBlocksQueue_onDataReceivedEvent(t *testing.T) { response := &fetchRequestResponse{ pid: "abc", blocks: []block.SignedBeaconBlock{ - wrapper.WrappedPhase0SignedBeaconBlock(testutil.NewBeaconBlock()), - wrapper.WrappedPhase0SignedBeaconBlock(testutil.NewBeaconBlock()), + wrapper.WrappedPhase0SignedBeaconBlock(util.NewBeaconBlock()), + wrapper.WrappedPhase0SignedBeaconBlock(util.NewBeaconBlock()), }, } fsm := &stateMachine{ @@ -622,7 +622,7 @@ func TestBlocksQueue_onReadyToSendEvent(t *testing.T) { queue.smm.machines[256].state = stateDataParsed queue.smm.machines[256].pid = pidDataParsed queue.smm.machines[256].blocks = []block.SignedBeaconBlock{ - wrapper.WrappedPhase0SignedBeaconBlock(testutil.NewBeaconBlock()), + wrapper.WrappedPhase0SignedBeaconBlock(util.NewBeaconBlock()), } handlerFn := queue.onReadyToSendEvent(ctx) @@ -652,7 +652,7 @@ func TestBlocksQueue_onReadyToSendEvent(t *testing.T) { queue.smm.machines[320].state = stateDataParsed queue.smm.machines[320].pid = pidDataParsed queue.smm.machines[320].blocks = []block.SignedBeaconBlock{ - wrapper.WrappedPhase0SignedBeaconBlock(testutil.NewBeaconBlock()), + wrapper.WrappedPhase0SignedBeaconBlock(util.NewBeaconBlock()), } handlerFn := queue.onReadyToSendEvent(ctx) @@ -679,7 +679,7 @@ func TestBlocksQueue_onReadyToSendEvent(t *testing.T) { queue.smm.machines[320].state = stateDataParsed queue.smm.machines[320].pid = pidDataParsed queue.smm.machines[320].blocks = []block.SignedBeaconBlock{ - wrapper.WrappedPhase0SignedBeaconBlock(testutil.NewBeaconBlock()), + wrapper.WrappedPhase0SignedBeaconBlock(util.NewBeaconBlock()), } handlerFn := queue.onReadyToSendEvent(ctx) @@ -1042,7 +1042,7 @@ func TestBlocksQueue_stuckInUnfavourableFork(t *testing.T) { genesisRoot, err := genesisBlock.Block.HashTreeRoot() require.NoError(t, err) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) mc := &mock.ChainService{ State: st, @@ -1243,7 +1243,7 @@ func TestBlocksQueue_stuckWhenHeadIsSetToOrphanedBlock(t *testing.T) { genesisRoot, err := genesisBlock.Block.HashTreeRoot() require.NoError(t, err) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) mc := &mock.ChainService{ State: st, @@ -1271,9 +1271,9 @@ func TestBlocksQueue_stuckWhenHeadIsSetToOrphanedBlock(t *testing.T) { // Set head to slot 85, while we do not have block with slot 84 in DB, so block is orphaned. // Moreover, block with slot 85 is a forked block and should be replaced, with block from peer. - orphanedBlock := testutil.NewBeaconBlock() + orphanedBlock := util.NewBeaconBlock() orphanedBlock.Block.Slot = 85 - orphanedBlock.Block.StateRoot = testutil.Random32Bytes(t) + orphanedBlock.Block.StateRoot = util.Random32Bytes(t) require.NoError(t, beaconDB.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(orphanedBlock))) require.NoError(t, st.SetSlot(orphanedBlock.Block.Slot)) require.Equal(t, types.Slot(85), mc.HeadSlot()) diff --git a/beacon-chain/sync/initial-sync/fsm_benchmark_test.go b/beacon-chain/sync/initial-sync/fsm_benchmark_test.go index 35493726e..65582d0fb 100644 --- a/beacon-chain/sync/initial-sync/fsm_benchmark_test.go +++ b/beacon-chain/sync/initial-sync/fsm_benchmark_test.go @@ -3,7 +3,7 @@ package initialsync import ( "testing" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) func BenchmarkStateMachine_trigger(b *testing.B) { diff --git a/beacon-chain/sync/initial-sync/fsm_test.go b/beacon-chain/sync/initial-sync/fsm_test.go index e4475fbcb..cf3b4a957 100644 --- a/beacon-chain/sync/initial-sync/fsm_test.go +++ b/beacon-chain/sync/initial-sync/fsm_test.go @@ -6,8 +6,8 @@ import ( "testing" types "github.com/prysmaticlabs/eth2-types" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestStateMachineManager_String(t *testing.T) { diff --git a/beacon-chain/sync/initial-sync/initial_sync_test.go b/beacon-chain/sync/initial-sync/initial_sync_test.go index 01e00aa09..84f577753 100644 --- a/beacon-chain/sync/initial-sync/initial_sync_test.go +++ b/beacon-chain/sync/initial-sync/initial_sync_test.go @@ -29,9 +29,9 @@ import ( eth "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" p2ppb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" prysmTime "github.com/prysmaticlabs/prysm/time" "github.com/sirupsen/logrus" ) @@ -83,10 +83,10 @@ func initializeTestServices(t *testing.T, slots []types.Slot, peers []*peerData) genesisRoot := cache.rootCache[0] cache.RUnlock() - err := beaconDB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(testutil.NewBeaconBlock())) + err := beaconDB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(util.NewBeaconBlock())) require.NoError(t, err) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) return &mock.ChainService{ @@ -133,13 +133,13 @@ func (c *testCache) initializeRootCache(reqSlots []types.Slot, t *testing.T) { c.parentSlotCache = make(map[types.Slot]types.Slot) parentSlot := types.Slot(0) - genesisBlock := testutil.NewBeaconBlock().Block + genesisBlock := util.NewBeaconBlock().Block genesisRoot, err := genesisBlock.HashTreeRoot() require.NoError(t, err) c.rootCache[0] = genesisRoot parentRoot := genesisRoot for _, slot := range reqSlots { - currentBlock := testutil.NewBeaconBlock().Block + currentBlock := util.NewBeaconBlock().Block currentBlock.Slot = slot currentBlock.ParentRoot = parentRoot[:] parentRoot, err = currentBlock.HashTreeRoot() @@ -200,7 +200,7 @@ func connectPeer(t *testing.T, host *p2pt.TestP2P, datum *peerData, peerStatus * cache.RLock() parentRoot := cache.rootCache[cache.parentSlotCache[slot]] cache.RUnlock() - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.Slot = slot blk.Block.ParentRoot = parentRoot[:] // If forked peer, give a different parent root. @@ -248,22 +248,22 @@ func extendBlockSequence(t *testing.T, inSeq []*eth.SignedBeaconBlock, size int) // See if genesis block needs to be created. startSlot := len(inSeq) if len(inSeq) == 0 { - outSeq[0] = testutil.NewBeaconBlock() - outSeq[0].Block.StateRoot = testutil.Random32Bytes(t) + outSeq[0] = util.NewBeaconBlock() + outSeq[0].Block.StateRoot = util.Random32Bytes(t) startSlot++ outSeq = append(outSeq, nil) } // Extend block chain sequentially. for slot := startSlot; slot < len(outSeq); slot++ { - outSeq[slot] = testutil.NewBeaconBlock() + outSeq[slot] = util.NewBeaconBlock() outSeq[slot].Block.Slot = types.Slot(slot) parentRoot, err := outSeq[slot-1].Block.HashTreeRoot() require.NoError(t, err) outSeq[slot].Block.ParentRoot = parentRoot[:] // Make sure that blocks having the same slot number, produce different hashes. // That way different branches/forks will have different blocks for the same slots. - outSeq[slot].Block.StateRoot = testutil.Random32Bytes(t) + outSeq[slot].Block.StateRoot = util.Random32Bytes(t) } return outSeq diff --git a/beacon-chain/sync/initial-sync/round_robin_test.go b/beacon-chain/sync/initial-sync/round_robin_test.go index 3699bf2cd..fc117540a 100644 --- a/beacon-chain/sync/initial-sync/round_robin_test.go +++ b/beacon-chain/sync/initial-sync/round_robin_test.go @@ -15,9 +15,9 @@ import ( eth "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" logTest "github.com/sirupsen/logrus/hooks/test" ) @@ -283,10 +283,10 @@ func TestService_roundRobinSync(t *testing.T) { genesisRoot := cache.rootCache[0] cache.RUnlock() - err := beaconDB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(testutil.NewBeaconBlock())) + err := beaconDB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(util.NewBeaconBlock())) require.NoError(t, err) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) mc := &mock.ChainService{ State: st, @@ -323,12 +323,12 @@ func TestService_roundRobinSync(t *testing.T) { func TestService_processBlock(t *testing.T) { beaconDB := dbtest.SetupDB(t) - genesisBlk := testutil.NewBeaconBlock() + genesisBlk := util.NewBeaconBlock() genesisBlkRoot, err := genesisBlk.Block.HashTreeRoot() require.NoError(t, err) err = beaconDB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(genesisBlk)) require.NoError(t, err) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) s := NewService(context.Background(), &Config{ P2P: p2pt.NewTestP2P(t), @@ -349,12 +349,12 @@ func TestService_processBlock(t *testing.T) { genesis := makeGenesisTime(32) t.Run("process duplicate block", func(t *testing.T) { - blk1 := testutil.NewBeaconBlock() + blk1 := util.NewBeaconBlock() blk1.Block.Slot = 1 blk1.Block.ParentRoot = genesisBlkRoot[:] blk1Root, err := blk1.Block.HashTreeRoot() require.NoError(t, err) - blk2 := testutil.NewBeaconBlock() + blk2 := util.NewBeaconBlock() blk2.Block.Slot = 2 blk2.Block.ParentRoot = blk1Root[:] @@ -386,12 +386,12 @@ func TestService_processBlock(t *testing.T) { func TestService_processBlockBatch(t *testing.T) { beaconDB := dbtest.SetupDB(t) - genesisBlk := testutil.NewBeaconBlock() + genesisBlk := util.NewBeaconBlock() genesisBlkRoot, err := genesisBlk.Block.HashTreeRoot() require.NoError(t, err) err = beaconDB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(genesisBlk)) require.NoError(t, err) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) s := NewService(context.Background(), &Config{ P2P: p2pt.NewTestP2P(t), @@ -414,7 +414,7 @@ func TestService_processBlockBatch(t *testing.T) { currBlockRoot := genesisBlkRoot for i := types.Slot(1); i < 10; i++ { parentRoot := currBlockRoot - blk1 := testutil.NewBeaconBlock() + blk1 := util.NewBeaconBlock() blk1.Block.Slot = i blk1.Block.ParentRoot = parentRoot[:] blk1Root, err := blk1.Block.HashTreeRoot() @@ -428,7 +428,7 @@ func TestService_processBlockBatch(t *testing.T) { var batch2 []block.SignedBeaconBlock for i := types.Slot(10); i < 20; i++ { parentRoot := currBlockRoot - blk1 := testutil.NewBeaconBlock() + blk1 := util.NewBeaconBlock() blk1.Block.Slot = i blk1.Block.ParentRoot = parentRoot[:] blk1Root, err := blk1.Block.HashTreeRoot() @@ -517,10 +517,10 @@ func TestService_blockProviderScoring(t *testing.T) { genesisRoot := cache.rootCache[0] cache.RUnlock() - err := beaconDB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(testutil.NewBeaconBlock())) + err := beaconDB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(util.NewBeaconBlock())) require.NoError(t, err) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, err) mc := &mock.ChainService{ @@ -583,10 +583,10 @@ func TestService_syncToFinalizedEpoch(t *testing.T) { genesisRoot := cache.rootCache[0] cache.RUnlock() - err := beaconDB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(testutil.NewBeaconBlock())) + err := beaconDB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(util.NewBeaconBlock())) require.NoError(t, err) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) mc := &mock.ChainService{ State: st, diff --git a/beacon-chain/sync/initial-sync/service_test.go b/beacon-chain/sync/initial-sync/service_test.go index d7961c02f..bc40807c5 100644 --- a/beacon-chain/sync/initial-sync/service_test.go +++ b/beacon-chain/sync/initial-sync/service_test.go @@ -20,9 +20,9 @@ import ( "github.com/prysmaticlabs/prysm/config/params" eth "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" logTest "github.com/sirupsen/logrus/hooks/test" ) @@ -50,7 +50,7 @@ func TestService_InitStartStop(t *testing.T) { name: "future genesis", chainService: func() *mock.ChainService { // Set to future time (genesis time hasn't arrived yet). - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) return &mock.ChainService{ @@ -81,7 +81,7 @@ func TestService_InitStartStop(t *testing.T) { name: "zeroth epoch", chainService: func() *mock.ChainService { // Set to nearby slot. - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) return &mock.ChainService{ State: st, @@ -112,7 +112,7 @@ func TestService_InitStartStop(t *testing.T) { name: "already synced", chainService: func() *mock.ChainService { // Set to some future slot, and then make sure that current head matches it. - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) futureSlot := types.Slot(27354) require.NoError(t, st.SetSlot(futureSlot)) @@ -188,7 +188,7 @@ func TestService_InitStartStop(t *testing.T) { cancel() }) }() - if testutil.WaitTimeout(wg, time.Second*4) { + if util.WaitTimeout(wg, time.Second*4) { t.Fatalf("Test should have exited by now, timed out") } tt.assert() @@ -232,7 +232,7 @@ func TestService_waitForStateInitialization(t *testing.T) { }) }() - if testutil.WaitTimeout(wg, time.Second*2) { + if util.WaitTimeout(wg, time.Second*2) { t.Fatalf("Test should have exited by now, timed out") } assert.LogsContain(t, hook, "Waiting for state to be initialized") @@ -274,7 +274,7 @@ func TestService_waitForStateInitialization(t *testing.T) { }) }() - if testutil.WaitTimeout(wg, time.Second*2) { + if util.WaitTimeout(wg, time.Second*2) { t.Fatalf("Test should have exited by now, timed out") } assert.Equal(t, expectedGenesisTime, receivedGenesisTime) @@ -316,7 +316,7 @@ func TestService_waitForStateInitialization(t *testing.T) { wg.Done() }() - if testutil.WaitTimeout(wg, time.Second*5) { + if util.WaitTimeout(wg, time.Second*5) { t.Fatalf("Test should have exited by now, timed out") } assert.LogsContain(t, hook, "Waiting for state to be initialized") @@ -364,7 +364,7 @@ func TestService_markSynced(t *testing.T) { }() s.markSynced(expectedGenesisTime) - if testutil.WaitTimeout(wg, time.Second*2) { + if util.WaitTimeout(wg, time.Second*2) { t.Fatalf("Test should have exited by now, timed out") } assert.Equal(t, expectedGenesisTime, receivedGenesisTime) @@ -378,7 +378,7 @@ func TestService_Resync(t *testing.T) { }, p.Peers()) cache.initializeRootCache(makeSequence(1, 160), t) beaconDB := dbtest.SetupDB(t) - err := beaconDB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(testutil.NewBeaconBlock())) + err := beaconDB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(util.NewBeaconBlock())) require.NoError(t, err) cache.RLock() genesisRoot := cache.rootCache[0] @@ -398,7 +398,7 @@ func TestService_Resync(t *testing.T) { { name: "resync ok", chainService: func() *mock.ChainService { - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) futureSlot := types.Slot(160) require.NoError(t, st.SetGenesisTime(uint64(makeGenesisTime(futureSlot).Unix()))) diff --git a/beacon-chain/sync/pending_attestations_queue_test.go b/beacon-chain/sync/pending_attestations_queue_test.go index 410379bdd..a0c572aaa 100644 --- a/beacon-chain/sync/pending_attestations_queue_test.go +++ b/beacon-chain/sync/pending_attestations_queue_test.go @@ -24,9 +24,9 @@ import ( pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/attestation" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" prysmTime "github.com/prysmaticlabs/prysm/time" logTest "github.com/sirupsen/logrus/hooks/test" ) @@ -60,9 +60,9 @@ func TestProcessPendingAtts_HasBlockSaveUnAggregatedAtt(t *testing.T) { p1 := p2ptest.NewTestP2P(t) validators := uint64(256) - beaconState, privKeys := testutil.DeterministicGenesisState(t, validators) + beaconState, privKeys := util.DeterministicGenesisState(t, validators) - sb := testutil.NewBeaconBlock() + sb := util.NewBeaconBlock() require.NoError(t, db.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(sb))) root, err := sb.Block.HashTreeRoot() require.NoError(t, err) @@ -122,11 +122,11 @@ func TestProcessPendingAtts_HasBlockSaveUnAggregatedAtt(t *testing.T) { seenUnAggregatedAttestationCache: lruwrpr.New(10), } - sb = testutil.NewBeaconBlock() + sb = util.NewBeaconBlock() r32, err := sb.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, r.cfg.DB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(sb))) - s, err := testutil.NewBeaconState() + s, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, r.cfg.DB.SaveState(context.Background(), s, r32)) @@ -145,7 +145,7 @@ func TestProcessPendingAtts_NoBroadcastWithBadSignature(t *testing.T) { db := dbtest.SetupDB(t) p1 := p2ptest.NewTestP2P(t) - s, _ := testutil.DeterministicGenesisState(t, 256) + s, _ := util.DeterministicGenesisState(t, 256) r := &Service{ cfg: &Config{ P2P: p1, @@ -162,12 +162,12 @@ func TestProcessPendingAtts_NoBroadcastWithBadSignature(t *testing.T) { Aggregate: ðpb.Attestation{ Signature: priv.Sign([]byte("foo")).Marshal(), AggregationBits: bitfield.Bitlist{0x02}, - Data: testutil.HydrateAttestationData(ðpb.AttestationData{}), + Data: util.HydrateAttestationData(ðpb.AttestationData{}), }, SelectionProof: make([]byte, 96), } - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() r32, err := b.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, r.cfg.DB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(b))) @@ -183,7 +183,7 @@ func TestProcessPendingAtts_NoBroadcastWithBadSignature(t *testing.T) { validators := uint64(256) - _, privKeys := testutil.DeterministicGenesisState(t, validators) + _, privKeys := util.DeterministicGenesisState(t, validators) aggBits := bitfield.NewBitlist(8) aggBits.SetBitAt(1, true) att := ðpb.Attestation{ @@ -249,9 +249,9 @@ func TestProcessPendingAtts_HasBlockSaveAggregatedAtt(t *testing.T) { p1 := p2ptest.NewTestP2P(t) validators := uint64(256) - beaconState, privKeys := testutil.DeterministicGenesisState(t, validators) + beaconState, privKeys := util.DeterministicGenesisState(t, validators) - sb := testutil.NewBeaconBlock() + sb := util.NewBeaconBlock() require.NoError(t, db.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(sb))) root, err := sb.Block.HashTreeRoot() require.NoError(t, err) @@ -315,11 +315,11 @@ func TestProcessPendingAtts_HasBlockSaveAggregatedAtt(t *testing.T) { seenAggregatedAttestationCache: lruwrpr.New(10), } - sb = testutil.NewBeaconBlock() + sb = util.NewBeaconBlock() r32, err := sb.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, r.cfg.DB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(sb))) - s, err := testutil.NewBeaconState() + s, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, r.cfg.DB.SaveState(context.Background(), s, r32)) diff --git a/beacon-chain/sync/pending_blocks_queue_test.go b/beacon-chain/sync/pending_blocks_queue_test.go index 40667b397..97c01b7ab 100644 --- a/beacon-chain/sync/pending_blocks_queue_test.go +++ b/beacon-chain/sync/pending_blocks_queue_test.go @@ -23,9 +23,9 @@ import ( "github.com/prysmaticlabs/prysm/crypto/rand" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) // /- b1 - b2 @@ -52,21 +52,21 @@ func TestRegularSyncBeaconBlockSubscriber_ProcessPendingBlocks1(t *testing.T) { } r.initCaches() - b0 := testutil.NewBeaconBlock() + b0 := util.NewBeaconBlock() require.NoError(t, r.cfg.DB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(b0))) b0Root, err := b0.Block.HashTreeRoot() require.NoError(t, err) - b3 := testutil.NewBeaconBlock() + b3 := util.NewBeaconBlock() b3.Block.Slot = 3 b3.Block.ParentRoot = b0Root[:] require.NoError(t, r.cfg.DB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(b3))) // Incomplete block link - b1 := testutil.NewBeaconBlock() + b1 := util.NewBeaconBlock() b1.Block.Slot = 1 b1.Block.ParentRoot = b0Root[:] b1Root, err := b1.Block.HashTreeRoot() require.NoError(t, err) - b2 := testutil.NewBeaconBlock() + b2 := util.NewBeaconBlock() b2.Block.Slot = 2 b2.Block.ParentRoot = b1Root[:] b2Root, err := b1.Block.HashTreeRoot() @@ -84,7 +84,7 @@ func TestRegularSyncBeaconBlockSubscriber_ProcessPendingBlocks1(t *testing.T) { require.NoError(t, r.cfg.DB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(b1))) // Insert bad b1 in the cache to verify the good one doesn't get replaced. - require.NoError(t, r.insertBlockToPendingQueue(b1.Block.Slot, wrapper.WrappedPhase0SignedBeaconBlock(testutil.NewBeaconBlock()), [32]byte{})) + require.NoError(t, r.insertBlockToPendingQueue(b1.Block.Slot, wrapper.WrappedPhase0SignedBeaconBlock(util.NewBeaconBlock()), [32]byte{})) require.NoError(t, r.processPendingBlocks(context.Background())) // Marks a block as bad require.NoError(t, r.processPendingBlocks(context.Background())) // Bad block removed on second run @@ -113,12 +113,12 @@ func TestRegularSync_InsertDuplicateBlocks(t *testing.T) { } r.initCaches() - b0 := testutil.NewBeaconBlock() + b0 := util.NewBeaconBlock() b0r := [32]byte{'a'} require.NoError(t, r.cfg.DB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(b0))) b0Root, err := b0.Block.HashTreeRoot() require.NoError(t, err) - b1 := testutil.NewBeaconBlock() + b1 := util.NewBeaconBlock() b1.Block.Slot = 1 b1.Block.ParentRoot = b0Root[:] b1r := [32]byte{'b'} @@ -186,11 +186,11 @@ func TestRegularSyncBeaconBlockSubscriber_ProcessPendingBlocks_2Chains(t *testin p1.Peers().SetConnectionState(p2.PeerID(), peers.PeerConnected) p1.Peers().SetChainState(p2.PeerID(), ðpb.Status{}) - b0 := testutil.NewBeaconBlock() + b0 := util.NewBeaconBlock() require.NoError(t, r.cfg.DB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(b0))) b0Root, err := b0.Block.HashTreeRoot() require.NoError(t, err) - b1 := testutil.NewBeaconBlock() + b1 := util.NewBeaconBlock() b1.Block.Slot = 1 b1.Block.ParentRoot = b0Root[:] require.NoError(t, r.cfg.DB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(b1))) @@ -198,22 +198,22 @@ func TestRegularSyncBeaconBlockSubscriber_ProcessPendingBlocks_2Chains(t *testin require.NoError(t, err) // Incomplete block links - b2 := testutil.NewBeaconBlock() + b2 := util.NewBeaconBlock() b2.Block.Slot = 2 b2.Block.ParentRoot = b1Root[:] b2Root, err := b2.Block.HashTreeRoot() require.NoError(t, err) - b5 := testutil.NewBeaconBlock() + b5 := util.NewBeaconBlock() b5.Block.Slot = 5 b5.Block.ParentRoot = b2Root[:] b5Root, err := b5.Block.HashTreeRoot() require.NoError(t, err) - b3 := testutil.NewBeaconBlock() + b3 := util.NewBeaconBlock() b3.Block.Slot = 3 b3.Block.ParentRoot = b0Root[:] b3Root, err := b3.Block.HashTreeRoot() require.NoError(t, err) - b4 := testutil.NewBeaconBlock() + b4 := util.NewBeaconBlock() b4.Block.Slot = 4 b4.Block.ParentRoot = b3Root[:] b4Root, err := b4.Block.HashTreeRoot() @@ -277,11 +277,11 @@ func TestRegularSyncBeaconBlockSubscriber_PruneOldPendingBlocks(t *testing.T) { p1.Peers().SetConnectionState(p1.PeerID(), peers.PeerConnected) p1.Peers().SetChainState(p1.PeerID(), ðpb.Status{}) - b0 := testutil.NewBeaconBlock() + b0 := util.NewBeaconBlock() require.NoError(t, r.cfg.DB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(b0))) b0Root, err := b0.Block.HashTreeRoot() require.NoError(t, err) - b1 := testutil.NewBeaconBlock() + b1 := util.NewBeaconBlock() b1.Block.Slot = 1 b1.Block.ParentRoot = b0Root[:] require.NoError(t, r.cfg.DB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(b1))) @@ -289,22 +289,22 @@ func TestRegularSyncBeaconBlockSubscriber_PruneOldPendingBlocks(t *testing.T) { require.NoError(t, err) // Incomplete block links - b2 := testutil.NewBeaconBlock() + b2 := util.NewBeaconBlock() b2.Block.Slot = 2 b2.Block.ParentRoot = b1Root[:] b2Root, err := b2.Block.HashTreeRoot() require.NoError(t, err) - b5 := testutil.NewBeaconBlock() + b5 := util.NewBeaconBlock() b5.Block.Slot = 5 b5.Block.ParentRoot = b2Root[:] b5Root, err := b5.Block.HashTreeRoot() require.NoError(t, err) - b3 := testutil.NewBeaconBlock() + b3 := util.NewBeaconBlock() b3.Block.Slot = 3 b3.Block.ParentRoot = b0Root[:] b3Root, err := b3.Block.HashTreeRoot() require.NoError(t, err) - b4 := testutil.NewBeaconBlock() + b4 := util.NewBeaconBlock() b4.Block.Slot = 4 b4.Block.ParentRoot = b3Root[:] b4Root, err := b4.Block.HashTreeRoot() @@ -327,10 +327,10 @@ func TestService_sortedPendingSlots(t *testing.T) { } var lastSlot types.Slot = math.MaxUint64 - require.NoError(t, r.insertBlockToPendingQueue(lastSlot, wrapper.WrappedPhase0SignedBeaconBlock(testutil.HydrateSignedBeaconBlock(ðpb.SignedBeaconBlock{Block: ðpb.BeaconBlock{Slot: lastSlot}})), [32]byte{1})) - require.NoError(t, r.insertBlockToPendingQueue(lastSlot-3, wrapper.WrappedPhase0SignedBeaconBlock(testutil.HydrateSignedBeaconBlock(ðpb.SignedBeaconBlock{Block: ðpb.BeaconBlock{Slot: lastSlot - 3}})), [32]byte{2})) - require.NoError(t, r.insertBlockToPendingQueue(lastSlot-5, wrapper.WrappedPhase0SignedBeaconBlock(testutil.HydrateSignedBeaconBlock(ðpb.SignedBeaconBlock{Block: ðpb.BeaconBlock{Slot: lastSlot - 5}})), [32]byte{3})) - require.NoError(t, r.insertBlockToPendingQueue(lastSlot-2, wrapper.WrappedPhase0SignedBeaconBlock(testutil.HydrateSignedBeaconBlock(ðpb.SignedBeaconBlock{Block: ðpb.BeaconBlock{Slot: lastSlot - 2}})), [32]byte{4})) + require.NoError(t, r.insertBlockToPendingQueue(lastSlot, wrapper.WrappedPhase0SignedBeaconBlock(util.HydrateSignedBeaconBlock(ðpb.SignedBeaconBlock{Block: ðpb.BeaconBlock{Slot: lastSlot}})), [32]byte{1})) + require.NoError(t, r.insertBlockToPendingQueue(lastSlot-3, wrapper.WrappedPhase0SignedBeaconBlock(util.HydrateSignedBeaconBlock(ðpb.SignedBeaconBlock{Block: ðpb.BeaconBlock{Slot: lastSlot - 3}})), [32]byte{2})) + require.NoError(t, r.insertBlockToPendingQueue(lastSlot-5, wrapper.WrappedPhase0SignedBeaconBlock(util.HydrateSignedBeaconBlock(ðpb.SignedBeaconBlock{Block: ðpb.BeaconBlock{Slot: lastSlot - 5}})), [32]byte{3})) + require.NoError(t, r.insertBlockToPendingQueue(lastSlot-2, wrapper.WrappedPhase0SignedBeaconBlock(util.HydrateSignedBeaconBlock(ðpb.SignedBeaconBlock{Block: ðpb.BeaconBlock{Slot: lastSlot - 2}})), [32]byte{4})) want := []types.Slot{lastSlot - 5, lastSlot - 3, lastSlot - 2, lastSlot} assert.DeepEqual(t, want, r.sortedPendingSlots(), "Unexpected pending slots list") @@ -365,33 +365,33 @@ func TestService_BatchRootRequest(t *testing.T) { p1.Peers().SetConnectionState(p2.PeerID(), peers.PeerConnected) p1.Peers().SetChainState(p2.PeerID(), ðpb.Status{FinalizedEpoch: 2}) - b0 := testutil.NewBeaconBlock() + b0 := util.NewBeaconBlock() require.NoError(t, r.cfg.DB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(b0))) b0Root, err := b0.Block.HashTreeRoot() require.NoError(t, err) - b1 := testutil.NewBeaconBlock() + b1 := util.NewBeaconBlock() b1.Block.Slot = 1 b1.Block.ParentRoot = b0Root[:] require.NoError(t, r.cfg.DB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(b1))) b1Root, err := b1.Block.HashTreeRoot() require.NoError(t, err) - b2 := testutil.NewBeaconBlock() + b2 := util.NewBeaconBlock() b2.Block.Slot = 2 b2.Block.ParentRoot = b1Root[:] b2Root, err := b2.Block.HashTreeRoot() require.NoError(t, err) - b5 := testutil.NewBeaconBlock() + b5 := util.NewBeaconBlock() b5.Block.Slot = 5 b5.Block.ParentRoot = b2Root[:] b5Root, err := b5.Block.HashTreeRoot() require.NoError(t, err) - b3 := testutil.NewBeaconBlock() + b3 := util.NewBeaconBlock() b3.Block.Slot = 3 b3.Block.ParentRoot = b0Root[:] b3Root, err := b3.Block.HashTreeRoot() require.NoError(t, err) - b4 := testutil.NewBeaconBlock() + b4 := util.NewBeaconBlock() b4.Block.Slot = 4 b4.Block.ParentRoot = b3Root[:] b4Root, err := b4.Block.HashTreeRoot() @@ -421,7 +421,7 @@ func TestService_BatchRootRequest(t *testing.T) { require.NoError(t, r.sendBatchRootRequest(context.Background(), sentRoots, rand.NewGenerator())) - if testutil.WaitTimeout(&wg, 1*time.Second) { + if util.WaitTimeout(&wg, 1*time.Second) { t.Fatal("Did not receive stream within 1 sec") } assert.Equal(t, 4, len(r.slotToPendingBlocks.Items()), "Incorrect size for slot to pending blocks cache") @@ -434,7 +434,7 @@ func TestService_AddPeningBlockToQueueOverMax(t *testing.T) { seenPendingBlocks: make(map[[32]byte]bool), } - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b1 := ethpb.CopySignedBeaconBlock(b) b1.Block.StateRoot = []byte{'a'} b2 := ethpb.CopySignedBeaconBlock(b) @@ -470,8 +470,8 @@ func TestService_ProcessPendingBlockOnCorrectSlot(t *testing.T) { } r.initCaches() - beaconState, privKeys := testutil.DeterministicGenesisState(t, 100) - parentBlock := testutil.NewBeaconBlock() + beaconState, privKeys := util.DeterministicGenesisState(t, 100) + parentBlock := util.NewBeaconBlock() require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(parentBlock))) bRoot, err := parentBlock.Block.HashTreeRoot() require.NoError(t, err) @@ -482,12 +482,12 @@ func TestService_ProcessPendingBlockOnCorrectSlot(t *testing.T) { proposerIdx, err := helpers.BeaconProposerIndex(copied) require.NoError(t, err) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) mockChain.Root = bRoot[:] mockChain.State = st - b1 := testutil.NewBeaconBlock() + b1 := util.NewBeaconBlock() b1.Block.ParentRoot = bRoot[:] b1.Block.Slot = 1 b1Root, err := b1.Block.HashTreeRoot() @@ -496,13 +496,13 @@ func TestService_ProcessPendingBlockOnCorrectSlot(t *testing.T) { b1.Signature, err = helpers.ComputeDomainAndSign(beaconState, 0, b1.Block, params.BeaconConfig().DomainBeaconProposer, privKeys[proposerIdx]) require.NoError(t, err) - b2 := testutil.NewBeaconBlock() + b2 := util.NewBeaconBlock() b2.Block.Slot = 2 b2.Block.ParentRoot = bRoot[:] b2Root, err := b2.Block.HashTreeRoot() require.NoError(t, err) - b3 := testutil.NewBeaconBlock() + b3 := util.NewBeaconBlock() b3.Block.Slot = 3 b3.Block.ParentRoot = b2Root[:] b3Root, err := b3.Block.HashTreeRoot() @@ -542,8 +542,8 @@ func TestService_ProcessBadPendingBlocks(t *testing.T) { } r.initCaches() - beaconState, privKeys := testutil.DeterministicGenesisState(t, 100) - parentBlock := testutil.NewBeaconBlock() + beaconState, privKeys := util.DeterministicGenesisState(t, 100) + parentBlock := util.NewBeaconBlock() require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(parentBlock))) bRoot, err := parentBlock.Block.HashTreeRoot() require.NoError(t, err) @@ -554,12 +554,12 @@ func TestService_ProcessBadPendingBlocks(t *testing.T) { proposerIdx, err := helpers.BeaconProposerIndex(copied) require.NoError(t, err) - st, err := testutil.NewBeaconState() + st, err := util.NewBeaconState() require.NoError(t, err) mockChain.Root = bRoot[:] mockChain.State = st - b1 := testutil.NewBeaconBlock() + b1 := util.NewBeaconBlock() b1.Block.ParentRoot = bRoot[:] b1.Block.Slot = 1 b1Root, err := b1.Block.HashTreeRoot() @@ -568,7 +568,7 @@ func TestService_ProcessBadPendingBlocks(t *testing.T) { b1.Signature, err = helpers.ComputeDomainAndSign(beaconState, 0, b1.Block, params.BeaconConfig().DomainBeaconProposer, privKeys[proposerIdx]) require.NoError(t, err) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = 55 b.Block.ParentRoot = []byte{'A', 'B', 'C'} bA := wrapper.WrappedPhase0SignedBeaconBlock(b) @@ -576,7 +576,7 @@ func TestService_ProcessBadPendingBlocks(t *testing.T) { // Add block1 for slot 55 require.NoError(t, r.insertBlockToPendingQueue(b.Block.Slot, bA, b1Root)) - bB := wrapper.WrappedPhase0SignedBeaconBlock(testutil.NewBeaconBlock()) + bB := wrapper.WrappedPhase0SignedBeaconBlock(util.NewBeaconBlock()) assert.NoError(t, err) // remove with a different block from the same slot. require.NoError(t, r.deleteBlockFromPendingQueue(b.Block.Slot, bB, b1Root)) diff --git a/beacon-chain/sync/rate_limiter_test.go b/beacon-chain/sync/rate_limiter_test.go index 4d23db35b..af95eda84 100644 --- a/beacon-chain/sync/rate_limiter_test.go +++ b/beacon-chain/sync/rate_limiter_test.go @@ -11,9 +11,9 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/p2p" mockp2p "github.com/prysmaticlabs/prysm/beacon-chain/p2p/testing" p2ptypes "github.com/prysmaticlabs/prysm/beacon-chain/p2p/types" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestNewRateLimiter(t *testing.T) { @@ -58,7 +58,7 @@ func TestRateLimiter_ExceedCapacity(t *testing.T) { require.NoError(t, stream.Close(), "could not close stream") - if testutil.WaitTimeout(&wg, 1*time.Second) { + if util.WaitTimeout(&wg, 1*time.Second) { t.Fatal("Did not receive stream within 1 sec") } } @@ -101,7 +101,7 @@ func TestRateLimiter_ExceedRawCapacity(t *testing.T) { assert.Equal(t, true, p1.Peers().IsBad(p2.PeerID()), "peer is not marked as a bad peer") require.NoError(t, stream.Close(), "could not close stream") - if testutil.WaitTimeout(&wg, 1*time.Second) { + if util.WaitTimeout(&wg, 1*time.Second) { t.Fatal("Did not receive stream within 1 sec") } } diff --git a/beacon-chain/sync/rpc_beacon_blocks_by_range_test.go b/beacon-chain/sync/rpc_beacon_blocks_by_range_test.go index 3f433c250..1e349039f 100644 --- a/beacon-chain/sync/rpc_beacon_blocks_by_range_test.go +++ b/beacon-chain/sync/rpc_beacon_blocks_by_range_test.go @@ -25,9 +25,9 @@ import ( ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" logTest "github.com/sirupsen/logrus/hooks/test" ) @@ -46,7 +46,7 @@ func TestRPCBeaconBlocksByRange_RPCHandlerReturnsBlocks(t *testing.T) { // Populate the database with blocks that would match the request. for i := req.StartSlot; i < req.StartSlot.Add(req.Step*req.Count); i += types.Slot(req.Step) { - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.Slot = i require.NoError(t, d.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(blk))) } @@ -62,7 +62,7 @@ func TestRPCBeaconBlocksByRange_RPCHandlerReturnsBlocks(t *testing.T) { defer wg.Done() for i := req.StartSlot; i < req.StartSlot.Add(req.Count*req.Step); i += types.Slot(req.Step) { expectSuccess(t, stream) - res := testutil.NewBeaconBlock() + res := util.NewBeaconBlock() assert.NoError(t, r.cfg.P2P.Encoding().DecodeWithMaxLength(stream, res)) if res.Block.Slot.SubSlot(req.StartSlot).Mod(req.Step) != 0 { t.Errorf("Received unexpected block slot %d", res.Block.Slot) @@ -81,7 +81,7 @@ func TestRPCBeaconBlocksByRange_RPCHandlerReturnsBlocks(t *testing.T) { expectedCapacity := int64(req.Count*10 - req.Count) require.Equal(t, expectedCapacity, remainingCapacity, "Unexpected rate limiting capacity") - if testutil.WaitTimeout(&wg, 1*time.Second) { + if util.WaitTimeout(&wg, 1*time.Second) { t.Fatal("Did not receive stream within 1 sec") } } @@ -102,7 +102,7 @@ func TestRPCBeaconBlocksByRange_ReturnCorrectNumberBack(t *testing.T) { genRoot := [32]byte{} // Populate the database with blocks that would match the request. for i := req.StartSlot; i < req.StartSlot.Add(req.Step*req.Count); i += types.Slot(req.Step) { - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.Slot = i if i == 0 { rt, err := blk.Block.HashTreeRoot() @@ -128,7 +128,7 @@ func TestRPCBeaconBlocksByRange_ReturnCorrectNumberBack(t *testing.T) { defer wg.Done() for i := newReq.StartSlot; i < newReq.StartSlot.Add(newReq.Count*newReq.Step); i += types.Slot(newReq.Step) { expectSuccess(t, stream) - res := testutil.NewBeaconBlock() + res := util.NewBeaconBlock() assert.NoError(t, r.cfg.P2P.Encoding().DecodeWithMaxLength(stream, res)) if res.Block.Slot.SubSlot(newReq.StartSlot).Mod(newReq.Step) != 0 { t.Errorf("Received unexpected block slot %d", res.Block.Slot) @@ -146,7 +146,7 @@ func TestRPCBeaconBlocksByRange_ReturnCorrectNumberBack(t *testing.T) { err = r.beaconBlocksByRangeRPCHandler(context.Background(), newReq, stream1) require.NoError(t, err) - if testutil.WaitTimeout(&wg, 1*time.Second) { + if util.WaitTimeout(&wg, 1*time.Second) { t.Fatal("Did not receive stream within 1 sec") } } @@ -168,7 +168,7 @@ func TestRPCBeaconBlocksByRange_RPCHandlerReturnsSortedBlocks(t *testing.T) { expectedRoots := make([][32]byte, req.Count) // Populate the database with blocks that would match the request. for i, j := endSlot, req.Count-1; i >= req.StartSlot; i -= types.Slot(req.Step) { - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.Slot = i rt, err := blk.Block.HashTreeRoot() require.NoError(t, err) @@ -208,7 +208,7 @@ func TestRPCBeaconBlocksByRange_RPCHandlerReturnsSortedBlocks(t *testing.T) { require.NoError(t, err) require.NoError(t, r.beaconBlocksByRangeRPCHandler(context.Background(), req, stream1)) - if testutil.WaitTimeout(&wg, 1*time.Second) { + if util.WaitTimeout(&wg, 1*time.Second) { t.Fatal("Did not receive stream within 1 sec") } } @@ -229,7 +229,7 @@ func TestRPCBeaconBlocksByRange_ReturnsGenesisBlock(t *testing.T) { prevRoot := [32]byte{} // Populate the database with blocks that would match the request. for i := req.StartSlot; i < req.StartSlot.Add(req.Step*req.Count); i++ { - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.Slot = i blk.Block.ParentRoot = prevRoot[:] rt, err := blk.Block.HashTreeRoot() @@ -268,7 +268,7 @@ func TestRPCBeaconBlocksByRange_ReturnsGenesisBlock(t *testing.T) { require.NoError(t, err) require.NoError(t, r.beaconBlocksByRangeRPCHandler(context.Background(), req, stream1)) - if testutil.WaitTimeout(&wg, 1*time.Second) { + if util.WaitTimeout(&wg, 1*time.Second) { t.Fatal("Did not receive stream within 1 sec") } } @@ -279,7 +279,7 @@ func TestRPCBeaconBlocksByRange_RPCHandlerRateLimitOverflow(t *testing.T) { // Populate the database with blocks that would match the request. parentRoot := [32]byte{} for i := req.StartSlot; i < req.StartSlot.Add(req.Step*req.Count); i += types.Slot(req.Step) { - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() block.Block.Slot = i if req.Step == 1 { block.Block.ParentRoot = parentRoot[:] @@ -305,7 +305,7 @@ func TestRPCBeaconBlocksByRange_RPCHandlerRateLimitOverflow(t *testing.T) { continue } expectSuccess(t, stream) - res := testutil.NewBeaconBlock() + res := util.NewBeaconBlock() assert.NoError(t, r.cfg.P2P.Encoding().DecodeWithMaxLength(stream, res)) if res.Block.Slot.SubSlot(req.StartSlot).Mod(req.Step) != 0 { t.Errorf("Received unexpected block slot %d", res.Block.Slot) @@ -317,7 +317,7 @@ func TestRPCBeaconBlocksByRange_RPCHandlerRateLimitOverflow(t *testing.T) { if err := r.beaconBlocksByRangeRPCHandler(context.Background(), req, stream); err != nil { return err } - if testutil.WaitTimeout(&wg, 1*time.Second) { + if util.WaitTimeout(&wg, 1*time.Second) { t.Fatal("Did not receive stream within 1 sec") } return nil @@ -540,7 +540,7 @@ func TestRPCBeaconBlocksByRange_EnforceResponseInvariants(t *testing.T) { // Populate the database with blocks that would match the request. parentRoot := [32]byte{} for i := req.StartSlot; i < req.StartSlot.Add(req.Step*req.Count); i += types.Slot(req.Step) { - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() block.Block.Slot = i block.Block.ParentRoot = parentRoot[:] require.NoError(t, d.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(block))) @@ -559,7 +559,7 @@ func TestRPCBeaconBlocksByRange_EnforceResponseInvariants(t *testing.T) { blocks := make([]*ethpb.SignedBeaconBlock, 0, req.Count) for i := req.StartSlot; i < req.StartSlot.Add(req.Count*req.Step); i += types.Slot(req.Step) { expectSuccess(t, stream) - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() assert.NoError(t, r.cfg.P2P.Encoding().DecodeWithMaxLength(stream, blk)) if blk.Block.Slot.SubSlot(req.StartSlot).Mod(req.Step) != 0 { t.Errorf("Received unexpected block slot %d", blk.Block.Slot) @@ -573,7 +573,7 @@ func TestRPCBeaconBlocksByRange_EnforceResponseInvariants(t *testing.T) { if err := r.beaconBlocksByRangeRPCHandler(context.Background(), req, stream); err != nil { return err } - if testutil.WaitTimeout(&wg, 1*time.Second) { + if util.WaitTimeout(&wg, 1*time.Second) { t.Fatal("Did not receive stream within 1 sec") } return nil @@ -613,7 +613,7 @@ func TestRPCBeaconBlocksByRange_FilterBlocks(t *testing.T) { hook := logTest.NewGlobal() saveBlocks := func(d db2.Database, chain *chainMock.ChainService, req *pb.BeaconBlocksByRangeRequest, finalized bool) { - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.Slot = 0 previousRoot, err := blk.Block.HashTreeRoot() require.NoError(t, err) @@ -625,7 +625,7 @@ func TestRPCBeaconBlocksByRange_FilterBlocks(t *testing.T) { for i, j := req.StartSlot, 0; i < req.StartSlot.Add(req.Step*req.Count); i += types.Slot(req.Step) { parentRoot := make([]byte, 32) copy(parentRoot, previousRoot[:]) - blocks[j] = testutil.NewBeaconBlock() + blocks[j] = util.NewBeaconBlock() blocks[j].Block.Slot = i blocks[j].Block.ParentRoot = parentRoot var err error @@ -658,7 +658,7 @@ func TestRPCBeaconBlocksByRange_FilterBlocks(t *testing.T) { } saveBadBlocks := func(d db2.Database, chain *chainMock.ChainService, req *pb.BeaconBlocksByRangeRequest, badBlockNum uint64, finalized bool) { - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.Slot = 0 previousRoot, err := blk.Block.HashTreeRoot() require.NoError(t, err) @@ -671,7 +671,7 @@ func TestRPCBeaconBlocksByRange_FilterBlocks(t *testing.T) { for i, j := req.StartSlot, 0; i < req.StartSlot.Add(req.Step*req.Count); i += types.Slot(req.Step) { parentRoot := make([]byte, 32) copy(parentRoot, previousRoot[:]) - blocks[j] = testutil.NewBeaconBlock() + blocks[j] = util.NewBeaconBlock() blocks[j].Block.Slot = i blocks[j].Block.ParentRoot = parentRoot // Make the 2nd block have a bad root. @@ -721,7 +721,7 @@ func TestRPCBeaconBlocksByRange_FilterBlocks(t *testing.T) { if code != 0 || err == io.EOF { break } - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() assert.NoError(t, r.cfg.P2P.Encoding().DecodeWithMaxLength(stream, blk)) if blk.Block.Slot.SubSlot(req.StartSlot).Mod(req.Step) != 0 { t.Errorf("Received unexpected block slot %d", blk.Block.Slot) @@ -735,7 +735,7 @@ func TestRPCBeaconBlocksByRange_FilterBlocks(t *testing.T) { if err := r.beaconBlocksByRangeRPCHandler(context.Background(), req, stream); err != nil { return err } - if testutil.WaitTimeout(&wg, 1*time.Second) { + if util.WaitTimeout(&wg, 1*time.Second) { t.Fatal("Did not receive stream within 1 sec") } return nil diff --git a/beacon-chain/sync/rpc_beacon_blocks_by_root_test.go b/beacon-chain/sync/rpc_beacon_blocks_by_root_test.go index 8ff586489..4f0e32b29 100644 --- a/beacon-chain/sync/rpc_beacon_blocks_by_root_test.go +++ b/beacon-chain/sync/rpc_beacon_blocks_by_root_test.go @@ -20,9 +20,9 @@ import ( "github.com/prysmaticlabs/prysm/config/params" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestRecentBeaconBlocksRPCHandler_ReturnsBlocks(t *testing.T) { @@ -35,7 +35,7 @@ func TestRecentBeaconBlocksRPCHandler_ReturnsBlocks(t *testing.T) { var blkRoots p2pTypes.BeaconBlockByRootsReq // Populate the database with blocks that would match the request. for i := types.Slot(1); i < 11; i++ { - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.Slot = i root, err := blk.Block.HashTreeRoot() require.NoError(t, err) @@ -55,7 +55,7 @@ func TestRecentBeaconBlocksRPCHandler_ReturnsBlocks(t *testing.T) { defer wg.Done() for i := range blkRoots { expectSuccess(t, stream) - res := testutil.NewBeaconBlock() + res := util.NewBeaconBlock() assert.NoError(t, r.cfg.P2P.Encoding().DecodeWithMaxLength(stream, res)) if uint64(res.Block.Slot) != uint64(i+1) { t.Errorf("Received unexpected block slot %d but wanted %d", res.Block.Slot, i+1) @@ -68,7 +68,7 @@ func TestRecentBeaconBlocksRPCHandler_ReturnsBlocks(t *testing.T) { err = r.beaconBlocksRootRPCHandler(context.Background(), &blkRoots, stream1) assert.NoError(t, err) - if testutil.WaitTimeout(&wg, 1*time.Second) { + if util.WaitTimeout(&wg, 1*time.Second) { t.Fatal("Did not receive stream within 1 sec") } } @@ -78,9 +78,9 @@ func TestRecentBeaconBlocks_RPCRequestSent(t *testing.T) { p2 := p2ptest.NewTestP2P(t) p1.DelaySend = true - blockA := testutil.NewBeaconBlock() + blockA := util.NewBeaconBlock() blockA.Block.Slot = 111 - blockB := testutil.NewBeaconBlock() + blockB := util.NewBeaconBlock() blockB.Block.Slot = 40 // Set up a head state with data we expect. blockARoot, err := blockA.Block.HashTreeRoot() @@ -140,7 +140,7 @@ func TestRecentBeaconBlocks_RPCRequestSent(t *testing.T) { p1.Connect(p2) require.NoError(t, r.sendRecentBeaconBlocksRequest(context.Background(), &expectedRoots, p2.PeerID())) - if testutil.WaitTimeout(&wg, 1*time.Second) { + if util.WaitTimeout(&wg, 1*time.Second) { t.Fatal("Did not receive stream within 1 sec") } } @@ -168,7 +168,7 @@ func TestRecentBeaconBlocksRPCHandler_HandleZeroBlocks(t *testing.T) { require.NoError(t, err) err = r.beaconBlocksRootRPCHandler(context.Background(), &p2pTypes.BeaconBlockByRootsReq{}, stream1) assert.ErrorContains(t, "no block roots provided", err) - if testutil.WaitTimeout(&wg, 1*time.Second) { + if util.WaitTimeout(&wg, 1*time.Second) { t.Fatal("Did not receive stream within 1 sec") } diff --git a/beacon-chain/sync/rpc_chunked_response_test.go b/beacon-chain/sync/rpc_chunked_response_test.go index e7e1defeb..168dd63f1 100644 --- a/beacon-chain/sync/rpc_chunked_response_test.go +++ b/beacon-chain/sync/rpc_chunked_response_test.go @@ -11,7 +11,7 @@ import ( ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestExtractBlockDataType(t *testing.T) { diff --git a/beacon-chain/sync/rpc_goodbye_test.go b/beacon-chain/sync/rpc_goodbye_test.go index 3879f4a44..ace8489ae 100644 --- a/beacon-chain/sync/rpc_goodbye_test.go +++ b/beacon-chain/sync/rpc_goodbye_test.go @@ -14,9 +14,9 @@ import ( db "github.com/prysmaticlabs/prysm/beacon-chain/db/testing" p2ptest "github.com/prysmaticlabs/prysm/beacon-chain/p2p/testing" p2ptypes "github.com/prysmaticlabs/prysm/beacon-chain/p2p/types" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestGoodByeRPCHandler_Disconnects_With_Peer(t *testing.T) { @@ -51,7 +51,7 @@ func TestGoodByeRPCHandler_Disconnects_With_Peer(t *testing.T) { assert.NoError(t, r.goodbyeRPCHandler(context.Background(), &failureCode, stream1)) - if testutil.WaitTimeout(&wg, 1*time.Second) { + if util.WaitTimeout(&wg, 1*time.Second) { t.Fatal("Did not receive stream within 1 sec") } @@ -96,7 +96,7 @@ func TestGoodByeRPCHandler_BackOffPeer(t *testing.T) { assert.NoError(t, r.goodbyeRPCHandler(context.Background(), &failureCode, stream1)) - if testutil.WaitTimeout(&wg, 1*time.Second) { + if util.WaitTimeout(&wg, 1*time.Second) { t.Fatal("Did not receive stream within 1 sec") } @@ -123,7 +123,7 @@ func TestGoodByeRPCHandler_BackOffPeer(t *testing.T) { assert.NoError(t, r.goodbyeRPCHandler(context.Background(), &failureCode, stream2)) - if testutil.WaitTimeout(&wg, 1*time.Second) { + if util.WaitTimeout(&wg, 1*time.Second) { t.Fatal("Did not receive stream within 1 sec") } @@ -174,7 +174,7 @@ func TestSendGoodbye_SendsMessage(t *testing.T) { err := r.sendGoodByeMessage(context.Background(), failureCode, p2.BHost.ID()) assert.NoError(t, err) - if testutil.WaitTimeout(&wg, 1*time.Second) { + if util.WaitTimeout(&wg, 1*time.Second) { t.Fatal("Did not receive stream within 1 sec") } @@ -222,7 +222,7 @@ func TestSendGoodbye_DisconnectWithPeer(t *testing.T) { t.Error("Peer is still not disconnected despite sending a goodbye message") } - if testutil.WaitTimeout(&wg, 1*time.Second) { + if util.WaitTimeout(&wg, 1*time.Second) { t.Fatal("Did not receive stream within 1 sec") } diff --git a/beacon-chain/sync/rpc_metadata_test.go b/beacon-chain/sync/rpc_metadata_test.go index 75152384c..07ba8eb12 100644 --- a/beacon-chain/sync/rpc_metadata_test.go +++ b/beacon-chain/sync/rpc_metadata_test.go @@ -21,9 +21,9 @@ import ( pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/metadata" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestMetaDataRPCHandler_ReceivesMetadata(t *testing.T) { @@ -68,7 +68,7 @@ func TestMetaDataRPCHandler_ReceivesMetadata(t *testing.T) { assert.NoError(t, r.metaDataHandler(context.Background(), new(interface{}), stream1)) - if testutil.WaitTimeout(&wg, 1*time.Second) { + if util.WaitTimeout(&wg, 1*time.Second) { t.Fatal("Did not receive stream within 1 sec") } @@ -129,7 +129,7 @@ func TestMetadataRPCHandler_SendsMetadata(t *testing.T) { t.Fatalf("MetadataV0 unequal, received %v but wanted %v", metadata, p2.LocalMetadata) } - if testutil.WaitTimeout(&wg, 1*time.Second) { + if util.WaitTimeout(&wg, 1*time.Second) { t.Fatal("Did not receive stream within 1 sec") } @@ -193,7 +193,7 @@ func TestMetadataRPCHandler_SendsMetadataAltair(t *testing.T) { _, err := r.sendMetaDataRequest(context.Background(), p2.BHost.ID()) assert.NoError(t, err) - if testutil.WaitTimeout(&wg, 1*time.Second) { + if util.WaitTimeout(&wg, 1*time.Second) { t.Fatal("Did not receive stream within 1 sec") } @@ -217,7 +217,7 @@ func TestMetadataRPCHandler_SendsMetadataAltair(t *testing.T) { t.Fatalf("MetadataV1 unequal, received %v but wanted %v", metadata, p2.LocalMetadata) } - if testutil.WaitTimeout(&wg, 1*time.Second) { + if util.WaitTimeout(&wg, 1*time.Second) { t.Fatal("Did not receive stream within 1 sec") } diff --git a/beacon-chain/sync/rpc_ping_test.go b/beacon-chain/sync/rpc_ping_test.go index 6f29bc3e7..68ad182f7 100644 --- a/beacon-chain/sync/rpc_ping_test.go +++ b/beacon-chain/sync/rpc_ping_test.go @@ -18,9 +18,9 @@ import ( p2ptypes "github.com/prysmaticlabs/prysm/beacon-chain/p2p/types" pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestPingRPCHandler_ReceivesPing(t *testing.T) { @@ -70,7 +70,7 @@ func TestPingRPCHandler_ReceivesPing(t *testing.T) { assert.NoError(t, r.pingHandler(context.Background(), &seqNumber, stream1)) - if testutil.WaitTimeout(&wg, 1*time.Second) { + if util.WaitTimeout(&wg, 1*time.Second) { t.Fatal("Did not receive stream within 1 sec") } @@ -137,7 +137,7 @@ func TestPingRPCHandler_SendsPing(t *testing.T) { assert.NoError(t, r.sendPingRequest(context.Background(), p2.BHost.ID())) - if testutil.WaitTimeout(&wg, 1*time.Second) { + if util.WaitTimeout(&wg, 1*time.Second) { t.Fatal("Did not receive stream within 1 sec") } @@ -198,7 +198,7 @@ func TestPingRPCHandler_BadSequenceNumber(t *testing.T) { err = r.pingHandler(context.Background(), &wantedSeq, stream1) assert.ErrorContains(t, p2ptypes.ErrInvalidSequenceNum.Error(), err) - if testutil.WaitTimeout(&wg, 1*time.Second) { + if util.WaitTimeout(&wg, 1*time.Second) { t.Fatal("Did not receive stream within 1 sec") } diff --git a/beacon-chain/sync/rpc_send_request_test.go b/beacon-chain/sync/rpc_send_request_test.go index 430faa9f0..4bcbf0a9c 100644 --- a/beacon-chain/sync/rpc_send_request_test.go +++ b/beacon-chain/sync/rpc_send_request_test.go @@ -20,9 +20,9 @@ import ( pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestSendRequest_SendBeaconBlocksByRangeRequest(t *testing.T) { @@ -43,12 +43,12 @@ func TestSendRequest_SendBeaconBlocksByRangeRequest(t *testing.T) { }) knownBlocks := make([]*eth.SignedBeaconBlock, 0) - genesisBlk := testutil.NewBeaconBlock() + genesisBlk := util.NewBeaconBlock() genesisBlkRoot, err := genesisBlk.Block.HashTreeRoot() require.NoError(t, err) parentRoot := genesisBlkRoot for i := 0; i < 255; i++ { - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.Slot = types.Slot(i) blk.Block.ParentRoot = parentRoot[:] knownBlocks = append(knownBlocks, blk) @@ -308,7 +308,7 @@ func TestSendRequest_SendBeaconBlocksByRootRequest(t *testing.T) { knownBlocks := make(map[[32]byte]*eth.SignedBeaconBlock) knownRoots := make([][32]byte, 0) for i := 0; i < 5; i++ { - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blkRoot, err := blk.Block.HashTreeRoot() require.NoError(t, err) knownRoots = append(knownRoots, blkRoot) diff --git a/beacon-chain/sync/rpc_status_test.go b/beacon-chain/sync/rpc_status_test.go index c040ef9fa..d081f0d4a 100644 --- a/beacon-chain/sync/rpc_status_test.go +++ b/beacon-chain/sync/rpc_status_test.go @@ -28,9 +28,9 @@ import ( "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" p2pWrapper "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" prysmTime "github.com/prysmaticlabs/prysm/time" "google.golang.org/protobuf/proto" ) @@ -93,10 +93,10 @@ func TestStatusRPCHandler_Disconnects_OnForkVersionMismatch(t *testing.T) { require.NoError(t, err) assert.NoError(t, r.statusRPCHandler(context.Background(), &pb.Status{ForkDigest: bytesutil.PadTo([]byte("f"), 4), HeadRoot: make([]byte, 32), FinalizedRoot: make([]byte, 32)}, stream1)) - if testutil.WaitTimeout(&wg, 1*time.Second) { + if util.WaitTimeout(&wg, 1*time.Second) { t.Fatal("Did not receive stream within 1 sec") } - if testutil.WaitTimeout(&wg2, 1*time.Second) { + if util.WaitTimeout(&wg2, 1*time.Second) { t.Fatal("Did not receive stream within 1 sec") } @@ -151,7 +151,7 @@ func TestStatusRPCHandler_ConnectsOnGenesis(t *testing.T) { err = r.statusRPCHandler(context.Background(), &pb.Status{ForkDigest: digest[:], FinalizedRoot: params.BeaconConfig().ZeroHash[:]}, stream1) assert.NoError(t, err) - if testutil.WaitTimeout(&wg, 1*time.Second) { + if util.WaitTimeout(&wg, 1*time.Second) { t.Fatal("Did not receive stream within 1 sec") } @@ -166,12 +166,12 @@ func TestStatusRPCHandler_ReturnsHelloMessage(t *testing.T) { db := testingDB.SetupDB(t) // Set up a head state with data we expect. - head := testutil.NewBeaconBlock() + head := util.NewBeaconBlock() head.Block.Slot = 111 headRoot, err := head.Block.HashTreeRoot() require.NoError(t, err) blkSlot := 3 * params.BeaconConfig().SlotsPerEpoch - finalized := testutil.NewBeaconBlock() + finalized := util.NewBeaconBlock() finalized.Block.Slot = blkSlot finalizedRoot, err := finalized.Block.HashTreeRoot() require.NoError(t, err) @@ -241,7 +241,7 @@ func TestStatusRPCHandler_ReturnsHelloMessage(t *testing.T) { }, stream1) assert.NoError(t, err) - if testutil.WaitTimeout(&wg, 1*time.Second) { + if util.WaitTimeout(&wg, 1*time.Second) { t.Fatal("Did not receive stream within 1 sec") } } @@ -267,7 +267,7 @@ func TestHandshakeHandlers_Roundtrip(t *testing.T) { Slot: 5, }) require.NoError(t, err) - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.Slot = 0 require.NoError(t, db.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(blk))) finalizedRoot, err := blk.Block.HashTreeRoot() @@ -357,10 +357,10 @@ func TestHandshakeHandlers_Roundtrip(t *testing.T) { p2.Peers().Add(new(enr.Record), p1.BHost.ID(), p1.BHost.Addrs()[0], network.DirUnknown) p2.Peers().SetMetadata(p1.BHost.ID(), p1.LocalMetadata) - if testutil.WaitTimeout(&wg, 1*time.Second) { + if util.WaitTimeout(&wg, 1*time.Second) { t.Fatal("Did not receive stream within 1 sec") } - if testutil.WaitTimeout(&wg2, 1*time.Second) { + if util.WaitTimeout(&wg2, 1*time.Second) { t.Fatal("Did not receive stream within 1 sec") } @@ -390,11 +390,11 @@ func TestStatusRPCRequest_RequestSent(t *testing.T) { p2 := p2ptest.NewTestP2P(t) // Set up a head state with data we expect. - head := testutil.NewBeaconBlock() + head := util.NewBeaconBlock() head.Block.Slot = 111 headRoot, err := head.Block.HashTreeRoot() require.NoError(t, err) - finalized := testutil.NewBeaconBlock() + finalized := util.NewBeaconBlock() finalized.Block.Slot = 40 finalizedRoot, err := finalized.Block.HashTreeRoot() require.NoError(t, err) @@ -453,7 +453,7 @@ func TestStatusRPCRequest_RequestSent(t *testing.T) { p1.AddConnectionHandler(r.sendRPCStatusRequest, nil) p1.Connect(p2) - if testutil.WaitTimeout(&wg, 1*time.Second) { + if util.WaitTimeout(&wg, 1*time.Second) { t.Fatal("Did not receive stream within 1 sec") } @@ -466,12 +466,12 @@ func TestStatusRPCRequest_FinalizedBlockExists(t *testing.T) { db := testingDB.SetupDB(t) // Set up a head state with data we expect. - head := testutil.NewBeaconBlock() + head := util.NewBeaconBlock() head.Block.Slot = 111 headRoot, err := head.Block.HashTreeRoot() require.NoError(t, err) blkSlot := 3 * params.BeaconConfig().SlotsPerEpoch - finalized := testutil.NewBeaconBlock() + finalized := util.NewBeaconBlock() finalized.Block.Slot = blkSlot finalizedRoot, err := finalized.Block.HashTreeRoot() require.NoError(t, err) @@ -479,7 +479,7 @@ func TestStatusRPCRequest_FinalizedBlockExists(t *testing.T) { require.NoError(t, err) require.NoError(t, genesisState.SetSlot(111)) require.NoError(t, genesisState.UpdateBlockRootAtIndex(111%uint64(params.BeaconConfig().SlotsPerHistoricalRoot), headRoot)) - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.Slot = blkSlot require.NoError(t, db.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(blk))) require.NoError(t, db.SaveGenesisBlockRoot(context.Background(), finalizedRoot)) @@ -544,7 +544,7 @@ func TestStatusRPCRequest_FinalizedBlockExists(t *testing.T) { p1.AddConnectionHandler(r.sendRPCStatusRequest, nil) p1.Connect(p2) - if testutil.WaitTimeout(&wg, 1*time.Second) { + if util.WaitTimeout(&wg, 1*time.Second) { t.Fatal("Did not receive stream within 1 sec") } @@ -557,7 +557,7 @@ func TestStatusRPCRequest_FinalizedBlockSkippedSlots(t *testing.T) { bState, err := transition.GenesisBeaconState(context.Background(), nil, 0, ðpb.Eth1Data{DepositRoot: make([]byte, 32), BlockHash: make([]byte, 32)}) require.NoError(t, err) - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.Slot = 0 genRoot, err := blk.Block.HashTreeRoot() require.NoError(t, err) @@ -718,7 +718,7 @@ func TestStatusRPCRequest_FinalizedBlockSkippedSlots(t *testing.T) { p1.AddConnectionHandler(r.sendRPCStatusRequest, nil) p1.Connect(p2) - if testutil.WaitTimeout(&wg, 1*time.Second) { + if util.WaitTimeout(&wg, 1*time.Second) { t.Fatal("Did not receive stream within 1 sec") } @@ -733,11 +733,11 @@ func TestStatusRPCRequest_BadPeerHandshake(t *testing.T) { p2 := p2ptest.NewTestP2P(t) // Set up a head state with data we expect. - head := testutil.NewBeaconBlock() + head := util.NewBeaconBlock() head.Block.Slot = 111 headRoot, err := head.Block.HashTreeRoot() require.NoError(t, err) - finalized := testutil.NewBeaconBlock() + finalized := util.NewBeaconBlock() finalizedRoot, err := finalized.Block.HashTreeRoot() require.NoError(t, err) genesisState, err := transition.GenesisBeaconState(context.Background(), nil, 0, ðpb.Eth1Data{}) @@ -798,7 +798,7 @@ func TestStatusRPCRequest_BadPeerHandshake(t *testing.T) { assert.Equal(t, false, p1.Peers().Scorers().IsBadPeer(p2.PeerID()), "Peer is marked as bad") p1.Connect(p2) - if testutil.WaitTimeout(&wg, time.Second) { + if util.WaitTimeout(&wg, time.Second) { t.Fatal("Did not receive stream within 1 sec") } time.Sleep(100 * time.Millisecond) @@ -812,12 +812,12 @@ func TestStatusRPCRequest_BadPeerHandshake(t *testing.T) { func TestStatusRPC_ValidGenesisMessage(t *testing.T) { // Set up a head state with data we expect. - head := testutil.NewBeaconBlock() + head := util.NewBeaconBlock() head.Block.Slot = 111 headRoot, err := head.Block.HashTreeRoot() require.NoError(t, err) blkSlot := 3 * params.BeaconConfig().SlotsPerEpoch - finalized := testutil.NewBeaconBlock() + finalized := util.NewBeaconBlock() finalized.Block.Slot = blkSlot finalizedRoot, err := finalized.Block.HashTreeRoot() require.NoError(t, err) @@ -935,7 +935,7 @@ func makeBlocks(t *testing.T, i, n uint64, previousRoot [32]byte) []block.Signed for j := i; j < n+i; j++ { parentRoot := make([]byte, 32) copy(parentRoot, previousRoot[:]) - blocks[j-i] = testutil.NewBeaconBlock() + blocks[j-i] = util.NewBeaconBlock() blocks[j-i].Block.Slot = types.Slot(j + 1) blocks[j-i].Block.ParentRoot = parentRoot var err error diff --git a/beacon-chain/sync/rpc_test.go b/beacon-chain/sync/rpc_test.go index eb81b5fb2..2a552e21c 100644 --- a/beacon-chain/sync/rpc_test.go +++ b/beacon-chain/sync/rpc_test.go @@ -13,9 +13,9 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/p2p/encoder" p2ptest "github.com/prysmaticlabs/prysm/beacon-chain/p2p/testing" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func init() { @@ -76,7 +76,7 @@ func TestRegisterRPC_ReceivesValidMessage(t *testing.T) { p2p.ReceiveRPC(topic, ðpb.Fork{CurrentVersion: []byte("fooo"), PreviousVersion: []byte("barr")}) - if testutil.WaitTimeout(&wg, time.Second) { + if util.WaitTimeout(&wg, time.Second) { t.Fatal("Did not receive RPC in 1 second") } } diff --git a/beacon-chain/sync/service_test.go b/beacon-chain/sync/service_test.go index b62e67ec7..d9fdca1ee 100644 --- a/beacon-chain/sync/service_test.go +++ b/beacon-chain/sync/service_test.go @@ -17,9 +17,9 @@ import ( "github.com/prysmaticlabs/prysm/crypto/bls" "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestService_StatusZeroEpoch(t *testing.T) { @@ -75,8 +75,8 @@ func TestSyncHandlers_WaitToSync(t *testing.T) { sk, err := bls.SecretKeyFromBytes(b32[:]) require.NoError(t, err) - msg := testutil.NewBeaconBlock() - msg.Block.ParentRoot = testutil.Random32Bytes(t) + msg := util.NewBeaconBlock() + msg.Block.ParentRoot = util.Random32Bytes(t) msg.Signature = sk.Sign([]byte("data")).Marshal() p2p.ReceivePubSub(topic, msg) // wait for chainstart to be sent @@ -155,8 +155,8 @@ func TestSyncHandlers_WaitTillSynced(t *testing.T) { sk, err := bls.SecretKeyFromBytes(b32[:]) require.NoError(t, err) - msg := testutil.NewBeaconBlock() - msg.Block.ParentRoot = testutil.Random32Bytes(t) + msg := util.NewBeaconBlock() + msg.Block.ParentRoot = util.Random32Bytes(t) msg.Signature = sk.Sign([]byte("data")).Marshal() p2p.Digest, err = r.currentForkDigest() r.cfg.BlockNotifier = chainService.BlockNotifier() @@ -194,7 +194,7 @@ func TestSyncHandlers_WaitTillSynced(t *testing.T) { p2p.ReceivePubSub(topic, msg) // wait for message to be sent - testutil.WaitTimeout(wg, 2*time.Second) + util.WaitTimeout(wg, 2*time.Second) } func TestSyncService_StopCleanly(t *testing.T) { diff --git a/beacon-chain/sync/subscriber_beacon_aggregate_proof_test.go b/beacon-chain/sync/subscriber_beacon_aggregate_proof_test.go index 94add24a3..dd61a6b93 100644 --- a/beacon-chain/sync/subscriber_beacon_aggregate_proof_test.go +++ b/beacon-chain/sync/subscriber_beacon_aggregate_proof_test.go @@ -9,9 +9,9 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/operations/attestations" lruwrpr "github.com/prysmaticlabs/prysm/cache/lru" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestBeaconAggregateProofSubscriber_CanSaveAggregatedAttestation(t *testing.T) { @@ -25,7 +25,7 @@ func TestBeaconAggregateProofSubscriber_CanSaveAggregatedAttestation(t *testing. a := ðpb.SignedAggregateAttestationAndProof{ Message: ðpb.AggregateAttestationAndProof{ - Aggregate: testutil.HydrateAttestation(ðpb.Attestation{ + Aggregate: util.HydrateAttestation(ðpb.Attestation{ AggregationBits: bitfield.Bitlist{0x07}, }), AggregatorIndex: 100, @@ -47,7 +47,7 @@ func TestBeaconAggregateProofSubscriber_CanSaveUnaggregatedAttestation(t *testin a := ðpb.SignedAggregateAttestationAndProof{ Message: ðpb.AggregateAttestationAndProof{ - Aggregate: testutil.HydrateAttestation(ðpb.Attestation{ + Aggregate: util.HydrateAttestation(ðpb.Attestation{ AggregationBits: bitfield.Bitlist{0x03}, Signature: make([]byte, 96), }), diff --git a/beacon-chain/sync/subscriber_beacon_blocks_test.go b/beacon-chain/sync/subscriber_beacon_blocks_test.go index c8de8d2b7..5fd9f04bd 100644 --- a/beacon-chain/sync/subscriber_beacon_blocks_test.go +++ b/beacon-chain/sync/subscriber_beacon_blocks_test.go @@ -13,9 +13,9 @@ import ( ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/protobuf/proto" ) @@ -24,10 +24,10 @@ func TestDeleteAttsInPool(t *testing.T) { cfg: &Config{AttPool: attestations.NewPool()}, } - att1 := testutil.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b1101}}) - att2 := testutil.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b1110}}) - att3 := testutil.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b1011}}) - att4 := testutil.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b1001}}) + att1 := util.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b1101}}) + att2 := util.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b1110}}) + att3 := util.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b1011}}) + att4 := util.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b1001}}) require.NoError(t, r.cfg.AttPool.SaveAggregatedAttestation(att1)) require.NoError(t, r.cfg.AttPool.SaveAggregatedAttestation(att2)) require.NoError(t, r.cfg.AttPool.SaveAggregatedAttestation(att3)) @@ -43,9 +43,9 @@ func TestDeleteAttsInPool(t *testing.T) { func TestService_beaconBlockSubscriber(t *testing.T) { pooledAttestations := []*ethpb.Attestation{ // Aggregated. - testutil.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b00011111}}), + util.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b00011111}}), // Unaggregated. - testutil.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b00010001}}), + util.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b00010001}}), } type args struct { @@ -61,7 +61,7 @@ func TestService_beaconBlockSubscriber(t *testing.T) { name: "invalid block does not remove attestations", args: args{ msg: func() *ethpb.SignedBeaconBlock { - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Body.Attestations = pooledAttestations return b }(), diff --git a/beacon-chain/sync/subscriber_test.go b/beacon-chain/sync/subscriber_test.go index 12ba50073..37464dff6 100644 --- a/beacon-chain/sync/subscriber_test.go +++ b/beacon-chain/sync/subscriber_test.go @@ -29,9 +29,9 @@ import ( "github.com/prysmaticlabs/prysm/encoding/bytesutil" "github.com/prysmaticlabs/prysm/network/forks" pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" logTest "github.com/sirupsen/logrus/hooks/test" "google.golang.org/protobuf/proto" ) @@ -71,7 +71,7 @@ func TestSubscribe_ReceivesValidMessage(t *testing.T) { p2pService.ReceivePubSub(topic, &pb.SignedVoluntaryExit{Exit: &pb.VoluntaryExit{Epoch: 55}, Signature: make([]byte, 96)}) - if testutil.WaitTimeout(&wg, time.Second) { + if util.WaitTimeout(&wg, time.Second) { t.Fatal("Did not receive PubSub in 1 second") } } @@ -147,10 +147,10 @@ func TestSubscribe_ReceivesAttesterSlashing(t *testing.T) { wg.Done() return nil }, p2pService.Digest) - beaconState, privKeys := testutil.DeterministicGenesisState(t, 64) + beaconState, privKeys := util.DeterministicGenesisState(t, 64) chainService.State = beaconState r.markForChainStart() - attesterSlashing, err := testutil.GenerateAttesterSlashingForValidator( + attesterSlashing, err := util.GenerateAttesterSlashingForValidator( beaconState, privKeys[1], 1, /* validator index */ @@ -160,7 +160,7 @@ func TestSubscribe_ReceivesAttesterSlashing(t *testing.T) { require.NoError(t, err) p2pService.ReceivePubSub(topic, attesterSlashing) - if testutil.WaitTimeout(&wg, time.Second) { + if util.WaitTimeout(&wg, time.Second) { t.Fatal("Did not receive PubSub in 1 second") } as := r.cfg.SlashingPool.PendingAttesterSlashings(ctx, beaconState, false /*noLimit*/) @@ -201,10 +201,10 @@ func TestSubscribe_ReceivesProposerSlashing(t *testing.T) { wg.Done() return nil }, p2pService.Digest) - beaconState, privKeys := testutil.DeterministicGenesisState(t, 64) + beaconState, privKeys := util.DeterministicGenesisState(t, 64) chainService.State = beaconState r.markForChainStart() - proposerSlashing, err := testutil.GenerateProposerSlashingForValidator( + proposerSlashing, err := util.GenerateProposerSlashingForValidator( beaconState, privKeys[1], 1, /* validator index */ @@ -213,7 +213,7 @@ func TestSubscribe_ReceivesProposerSlashing(t *testing.T) { p2pService.ReceivePubSub(topic, proposerSlashing) - if testutil.WaitTimeout(&wg, time.Second) { + if util.WaitTimeout(&wg, time.Second) { t.Fatal("Did not receive PubSub in 1 second") } ps := r.cfg.SlashingPool.PendingProposerSlashings(ctx, beaconState, false /*noLimit*/) @@ -249,7 +249,7 @@ func TestSubscribe_HandlesPanic(t *testing.T) { r.markForChainStart() p.ReceivePubSub(topic, &pb.SignedVoluntaryExit{Exit: &pb.VoluntaryExit{Epoch: 55}, Signature: make([]byte, 96)}) - if testutil.WaitTimeout(&wg, time.Second) { + if util.WaitTimeout(&wg, time.Second) { t.Fatal("Did not receive PubSub in 1 second") } } diff --git a/beacon-chain/sync/subscription_topic_handler_test.go b/beacon-chain/sync/subscription_topic_handler_test.go index 7d3f9aa34..c7239917a 100644 --- a/beacon-chain/sync/subscription_topic_handler_test.go +++ b/beacon-chain/sync/subscription_topic_handler_test.go @@ -9,7 +9,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/p2p" "github.com/prysmaticlabs/prysm/beacon-chain/p2p/encoder" "github.com/prysmaticlabs/prysm/network/forks" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" ) func TestSubTopicHandler_CRUD(t *testing.T) { diff --git a/beacon-chain/sync/utils_test.go b/beacon-chain/sync/utils_test.go index b26939efd..36e61eae8 100644 --- a/beacon-chain/sync/utils_test.go +++ b/beacon-chain/sync/utils_test.go @@ -9,7 +9,7 @@ import ( ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestSortedObj_SortBlocksRoots(t *testing.T) { diff --git a/beacon-chain/sync/validate_aggregate_proof_test.go b/beacon-chain/sync/validate_aggregate_proof_test.go index 6c02d1166..0738684f1 100644 --- a/beacon-chain/sync/validate_aggregate_proof_test.go +++ b/beacon-chain/sync/validate_aggregate_proof_test.go @@ -25,9 +25,9 @@ import ( ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/attestation" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestVerifyIndexInCommittee_CanVerify(t *testing.T) { @@ -36,7 +36,7 @@ func TestVerifyIndexInCommittee_CanVerify(t *testing.T) { defer params.UseMainnetConfig() validators := uint64(32) - s, _ := testutil.DeterministicGenesisState(t, validators) + s, _ := util.DeterministicGenesisState(t, validators) require.NoError(t, s.SetSlot(params.BeaconConfig().SlotsPerEpoch)) bf := bitfield.NewBitlist(validators / uint64(params.BeaconConfig().SlotsPerEpoch)) @@ -61,7 +61,7 @@ func TestVerifyIndexInCommittee_ExistsInBeaconCommittee(t *testing.T) { defer params.UseMainnetConfig() validators := uint64(64) - s, _ := testutil.DeterministicGenesisState(t, validators) + s, _ := util.DeterministicGenesisState(t, validators) require.NoError(t, s.SetSlot(params.BeaconConfig().SlotsPerEpoch)) bf := []byte{0xff} @@ -83,10 +83,10 @@ func TestVerifySelection_NotAnAggregator(t *testing.T) { params.UseMinimalConfig() defer params.UseMainnetConfig() validators := uint64(2048) - beaconState, privKeys := testutil.DeterministicGenesisState(t, validators) + beaconState, privKeys := util.DeterministicGenesisState(t, validators) sig := privKeys[0].Sign([]byte{'A'}) - data := testutil.HydrateAttestationData(ðpb.AttestationData{}) + data := util.HydrateAttestationData(ðpb.AttestationData{}) _, err := validateSelectionIndex(ctx, beaconState, data, 0, sig.Marshal()) wanted := "validator is not an aggregator for slot" @@ -97,7 +97,7 @@ func TestValidateAggregateAndProof_NoBlock(t *testing.T) { db := dbtest.SetupDB(t) p := p2ptest.NewTestP2P(t) - att := testutil.HydrateAttestation(ðpb.Attestation{ + att := util.HydrateAttestation(ðpb.Attestation{ Data: ðpb.AttestationData{ Source: ðpb.Checkpoint{Root: bytesutil.PadTo([]byte("hello-world"), 32)}, Target: ðpb.Checkpoint{Root: bytesutil.PadTo([]byte("hello-world"), 32)}, @@ -147,13 +147,13 @@ func TestValidateAggregateAndProof_NotWithinSlotRange(t *testing.T) { p := p2ptest.NewTestP2P(t) validators := uint64(256) - beaconState, _ := testutil.DeterministicGenesisState(t, validators) + beaconState, _ := util.DeterministicGenesisState(t, validators) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() require.NoError(t, db.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(b))) root, err := b.Block.HashTreeRoot() require.NoError(t, err) - s, err := testutil.NewBeaconState() + s, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, db.SaveState(context.Background(), s, root)) @@ -232,9 +232,9 @@ func TestValidateAggregateAndProof_ExistedInPool(t *testing.T) { p := p2ptest.NewTestP2P(t) validators := uint64(256) - beaconState, _ := testutil.DeterministicGenesisState(t, validators) + beaconState, _ := util.DeterministicGenesisState(t, validators) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() require.NoError(t, db.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(b))) root, err := b.Block.HashTreeRoot() require.NoError(t, err) @@ -297,13 +297,13 @@ func TestValidateAggregateAndProof_CanValidate(t *testing.T) { p := p2ptest.NewTestP2P(t) validators := uint64(256) - beaconState, privKeys := testutil.DeterministicGenesisState(t, validators) + beaconState, privKeys := util.DeterministicGenesisState(t, validators) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() require.NoError(t, db.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(b))) root, err := b.Block.HashTreeRoot() require.NoError(t, err) - s, err := testutil.NewBeaconState() + s, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, db.SaveState(context.Background(), s, root)) @@ -390,13 +390,13 @@ func TestVerifyIndexInCommittee_SeenAggregatorEpoch(t *testing.T) { p := p2ptest.NewTestP2P(t) validators := uint64(256) - beaconState, privKeys := testutil.DeterministicGenesisState(t, validators) + beaconState, privKeys := util.DeterministicGenesisState(t, validators) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() require.NoError(t, db.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(b))) root, err := b.Block.HashTreeRoot() require.NoError(t, err) - s, err := testutil.NewBeaconState() + s, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, db.SaveState(context.Background(), s, root)) @@ -501,12 +501,12 @@ func TestValidateAggregateAndProof_BadBlock(t *testing.T) { p := p2ptest.NewTestP2P(t) validators := uint64(256) - beaconState, privKeys := testutil.DeterministicGenesisState(t, validators) + beaconState, privKeys := util.DeterministicGenesisState(t, validators) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() root, err := b.Block.HashTreeRoot() require.NoError(t, err) - s, err := testutil.NewBeaconState() + s, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, db.SaveState(context.Background(), s, root)) @@ -590,13 +590,13 @@ func TestValidateAggregateAndProof_RejectWhenAttEpochDoesntEqualTargetEpoch(t *t p := p2ptest.NewTestP2P(t) validators := uint64(256) - beaconState, privKeys := testutil.DeterministicGenesisState(t, validators) + beaconState, privKeys := util.DeterministicGenesisState(t, validators) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() require.NoError(t, db.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(b))) root, err := b.Block.HashTreeRoot() require.NoError(t, err) - s, err := testutil.NewBeaconState() + s, err := util.NewBeaconState() require.NoError(t, err) require.NoError(t, db.SaveState(context.Background(), s, root)) diff --git a/beacon-chain/sync/validate_attester_slashing_test.go b/beacon-chain/sync/validate_attester_slashing_test.go index 90134e5d5..9be87ff76 100644 --- a/beacon-chain/sync/validate_attester_slashing_test.go +++ b/beacon-chain/sync/validate_attester_slashing_test.go @@ -20,20 +20,20 @@ import ( "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/crypto/bls" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func setupValidAttesterSlashing(t *testing.T) (*ethpb.AttesterSlashing, state.BeaconState) { - state, privKeys := testutil.DeterministicGenesisState(t, 5) + state, privKeys := util.DeterministicGenesisState(t, 5) vals := state.Validators() for _, vv := range vals { vv.WithdrawableEpoch = types.Epoch(1 * params.BeaconConfig().SlotsPerEpoch) } require.NoError(t, state.SetValidators(vals)) - att1 := testutil.HydrateIndexedAttestation(ðpb.IndexedAttestation{ + att1 := util.HydrateIndexedAttestation(ðpb.IndexedAttestation{ Data: ðpb.AttestationData{ Source: ðpb.Checkpoint{Epoch: 1}, }, @@ -48,7 +48,7 @@ func setupValidAttesterSlashing(t *testing.T) (*ethpb.AttesterSlashing, state.Be aggregateSig := bls.AggregateSignatures([]bls.Signature{sig0, sig1}) att1.Signature = aggregateSig.Marshal() - att2 := testutil.HydrateIndexedAttestation(ðpb.IndexedAttestation{ + att2 := util.HydrateIndexedAttestation(ðpb.IndexedAttestation{ AttestingIndices: []uint64{0, 1}, }) hashTreeRoot, err = helpers.ComputeSigningRoot(att2.Data, domain) @@ -132,10 +132,10 @@ func TestValidateAttesterSlashing_CanFilter(t *testing.T) { topic = r.addDigestToTopic(topic, d) buf := new(bytes.Buffer) _, err = p.Encoding().EncodeGossip(buf, ðpb.AttesterSlashing{ - Attestation_1: testutil.HydrateIndexedAttestation(ðpb.IndexedAttestation{ + Attestation_1: util.HydrateIndexedAttestation(ðpb.IndexedAttestation{ AttestingIndices: []uint64{3}, }), - Attestation_2: testutil.HydrateIndexedAttestation(ðpb.IndexedAttestation{ + Attestation_2: util.HydrateIndexedAttestation(ðpb.IndexedAttestation{ AttestingIndices: []uint64{3}, }), }) @@ -151,10 +151,10 @@ func TestValidateAttesterSlashing_CanFilter(t *testing.T) { buf = new(bytes.Buffer) _, err = p.Encoding().EncodeGossip(buf, ðpb.AttesterSlashing{ - Attestation_1: testutil.HydrateIndexedAttestation(ðpb.IndexedAttestation{ + Attestation_1: util.HydrateIndexedAttestation(ðpb.IndexedAttestation{ AttestingIndices: []uint64{4, 3}, }), - Attestation_2: testutil.HydrateIndexedAttestation(ðpb.IndexedAttestation{ + Attestation_2: util.HydrateIndexedAttestation(ðpb.IndexedAttestation{ AttestingIndices: []uint64{3, 4}, }), }) diff --git a/beacon-chain/sync/validate_beacon_attestation_test.go b/beacon-chain/sync/validate_beacon_attestation_test.go index e37441af1..81ecc995d 100644 --- a/beacon-chain/sync/validate_beacon_attestation_test.go +++ b/beacon-chain/sync/validate_beacon_attestation_test.go @@ -20,8 +20,8 @@ import ( "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestService_validateCommitteeIndexBeaconAttestation(t *testing.T) { @@ -54,7 +54,7 @@ func TestService_validateCommitteeIndexBeaconAttestation(t *testing.T) { digest, err := s.currentForkDigest() require.NoError(t, err) - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.Slot = 1 require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(blk))) @@ -66,7 +66,7 @@ func TestService_validateCommitteeIndexBeaconAttestation(t *testing.T) { } validators := uint64(64) - savedState, keys := testutil.DeterministicGenesisState(t, validators) + savedState, keys := util.DeterministicGenesisState(t, validators) require.NoError(t, savedState.SetSlot(1)) require.NoError(t, db.SaveState(context.Background(), savedState, validBlockRoot)) chain.State = savedState diff --git a/beacon-chain/sync/validate_beacon_blocks_test.go b/beacon-chain/sync/validate_beacon_blocks_test.go index 33bb2a32e..a3602df2a 100644 --- a/beacon-chain/sync/validate_beacon_blocks_test.go +++ b/beacon-chain/sync/validate_beacon_blocks_test.go @@ -29,9 +29,9 @@ import ( "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" logTest "github.com/sirupsen/logrus/hooks/test" ) @@ -43,8 +43,8 @@ func TestValidateBeaconBlockPubSub_InvalidSignature(t *testing.T) { db := dbtest.SetupDB(t) p := p2ptest.NewTestP2P(t) ctx := context.Background() - beaconState, _ := testutil.DeterministicGenesisState(t, 100) - parentBlock := testutil.NewBeaconBlock() + beaconState, _ := util.DeterministicGenesisState(t, 100) + parentBlock := util.NewBeaconBlock() require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(parentBlock))) bRoot, err := parentBlock.Block.HashTreeRoot() require.NoError(t, err) @@ -54,7 +54,7 @@ func TestValidateBeaconBlockPubSub_InvalidSignature(t *testing.T) { require.NoError(t, copied.SetSlot(1)) proposerIdx, err := helpers.BeaconProposerIndex(copied) require.NoError(t, err) - msg := testutil.NewBeaconBlock() + msg := util.NewBeaconBlock() msg.Block.ParentRoot = bRoot[:] msg.Block.Slot = 1 msg.Block.ProposerIndex = proposerIdx @@ -98,9 +98,9 @@ func TestValidateBeaconBlockPubSub_BlockAlreadyPresentInDB(t *testing.T) { ctx := context.Background() p := p2ptest.NewTestP2P(t) - msg := testutil.NewBeaconBlock() + msg := util.NewBeaconBlock() msg.Block.Slot = 100 - msg.Block.ParentRoot = testutil.Random32Bytes(t) + msg.Block.ParentRoot = util.Random32Bytes(t) require.NoError(t, db.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(msg))) chainService := &mock.ChainService{Genesis: time.Now()} @@ -135,8 +135,8 @@ func TestValidateBeaconBlockPubSub_CanRecoverStateSummary(t *testing.T) { db := dbtest.SetupDB(t) p := p2ptest.NewTestP2P(t) ctx := context.Background() - beaconState, privKeys := testutil.DeterministicGenesisState(t, 100) - parentBlock := testutil.NewBeaconBlock() + beaconState, privKeys := util.DeterministicGenesisState(t, 100) + parentBlock := util.NewBeaconBlock() require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(parentBlock))) bRoot, err := parentBlock.Block.HashTreeRoot() require.NoError(t, err) @@ -145,7 +145,7 @@ func TestValidateBeaconBlockPubSub_CanRecoverStateSummary(t *testing.T) { require.NoError(t, copied.SetSlot(1)) proposerIdx, err := helpers.BeaconProposerIndex(copied) require.NoError(t, err) - msg := testutil.NewBeaconBlock() + msg := util.NewBeaconBlock() msg.Block.ParentRoot = bRoot[:] msg.Block.Slot = 1 msg.Block.ProposerIndex = proposerIdx @@ -196,8 +196,8 @@ func TestValidateBeaconBlockPubSub_IsInCache(t *testing.T) { db := dbtest.SetupDB(t) p := p2ptest.NewTestP2P(t) ctx := context.Background() - beaconState, privKeys := testutil.DeterministicGenesisState(t, 100) - parentBlock := testutil.NewBeaconBlock() + beaconState, privKeys := util.DeterministicGenesisState(t, 100) + parentBlock := util.NewBeaconBlock() bRoot, err := parentBlock.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, db.SaveState(ctx, beaconState, bRoot)) @@ -206,7 +206,7 @@ func TestValidateBeaconBlockPubSub_IsInCache(t *testing.T) { require.NoError(t, copied.SetSlot(1)) proposerIdx, err := helpers.BeaconProposerIndex(copied) require.NoError(t, err) - msg := testutil.NewBeaconBlock() + msg := util.NewBeaconBlock() msg.Block.ParentRoot = bRoot[:] msg.Block.Slot = 1 msg.Block.ProposerIndex = proposerIdx @@ -258,8 +258,8 @@ func TestValidateBeaconBlockPubSub_ValidProposerSignature(t *testing.T) { db := dbtest.SetupDB(t) p := p2ptest.NewTestP2P(t) ctx := context.Background() - beaconState, privKeys := testutil.DeterministicGenesisState(t, 100) - parentBlock := testutil.NewBeaconBlock() + beaconState, privKeys := util.DeterministicGenesisState(t, 100) + parentBlock := util.NewBeaconBlock() require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(parentBlock))) bRoot, err := parentBlock.Block.HashTreeRoot() require.NoError(t, err) @@ -269,7 +269,7 @@ func TestValidateBeaconBlockPubSub_ValidProposerSignature(t *testing.T) { require.NoError(t, copied.SetSlot(1)) proposerIdx, err := helpers.BeaconProposerIndex(copied) require.NoError(t, err) - msg := testutil.NewBeaconBlock() + msg := util.NewBeaconBlock() msg.Block.ParentRoot = bRoot[:] msg.Block.Slot = 1 msg.Block.ProposerIndex = proposerIdx @@ -320,8 +320,8 @@ func TestValidateBeaconBlockPubSub_WithLookahead(t *testing.T) { db := dbtest.SetupDB(t) p := p2ptest.NewTestP2P(t) ctx := context.Background() - beaconState, privKeys := testutil.DeterministicGenesisState(t, 100) - parentBlock := testutil.NewBeaconBlock() + beaconState, privKeys := util.DeterministicGenesisState(t, 100) + parentBlock := util.NewBeaconBlock() require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(parentBlock))) bRoot, err := parentBlock.Block.HashTreeRoot() require.NoError(t, err) @@ -334,7 +334,7 @@ func TestValidateBeaconBlockPubSub_WithLookahead(t *testing.T) { require.NoError(t, err) proposerIdx, err := helpers.BeaconProposerIndex(copied) require.NoError(t, err) - msg := testutil.NewBeaconBlock() + msg := util.NewBeaconBlock() msg.Block.ProposerIndex = proposerIdx msg.Block.Slot = blkSlot msg.Block.ParentRoot = bRoot[:] @@ -385,8 +385,8 @@ func TestValidateBeaconBlockPubSub_AdvanceEpochsForState(t *testing.T) { db := dbtest.SetupDB(t) p := p2ptest.NewTestP2P(t) ctx := context.Background() - beaconState, privKeys := testutil.DeterministicGenesisState(t, 100) - parentBlock := testutil.NewBeaconBlock() + beaconState, privKeys := util.DeterministicGenesisState(t, 100) + parentBlock := util.NewBeaconBlock() require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(parentBlock))) bRoot, err := parentBlock.Block.HashTreeRoot() require.NoError(t, err) @@ -399,7 +399,7 @@ func TestValidateBeaconBlockPubSub_AdvanceEpochsForState(t *testing.T) { require.NoError(t, err) proposerIdx, err := helpers.BeaconProposerIndex(copied) require.NoError(t, err) - msg := testutil.NewBeaconBlock() + msg := util.NewBeaconBlock() msg.Block.ProposerIndex = proposerIdx msg.Block.Slot = blkSlot msg.Block.ParentRoot = bRoot[:] @@ -453,8 +453,8 @@ func TestValidateBeaconBlockPubSub_Syncing(t *testing.T) { b32 := bytesutil.ToBytes32(b) sk, err := bls.SecretKeyFromBytes(b32[:]) require.NoError(t, err) - msg := testutil.NewBeaconBlock() - msg.Block.ParentRoot = testutil.Random32Bytes(t) + msg := util.NewBeaconBlock() + msg.Block.ParentRoot = util.Random32Bytes(t) msg.Signature = sk.Sign([]byte("data")).Marshal() chainService := &mock.ChainService{ Genesis: time.Now(), @@ -490,8 +490,8 @@ func TestValidateBeaconBlockPubSub_AcceptBlocksFromNearFuture(t *testing.T) { p := p2ptest.NewTestP2P(t) ctx := context.Background() - beaconState, privKeys := testutil.DeterministicGenesisState(t, 100) - parentBlock := testutil.NewBeaconBlock() + beaconState, privKeys := util.DeterministicGenesisState(t, 100) + parentBlock := util.NewBeaconBlock() require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(parentBlock))) bRoot, err := parentBlock.Block.HashTreeRoot() require.NoError(t, err) @@ -502,7 +502,7 @@ func TestValidateBeaconBlockPubSub_AcceptBlocksFromNearFuture(t *testing.T) { proposerIdx, err := helpers.BeaconProposerIndex(copied) require.NoError(t, err) - msg := testutil.NewBeaconBlock() + msg := util.NewBeaconBlock() msg.Block.Slot = 2 // two slots in future msg.Block.ParentRoot = bRoot[:] msg.Block.ProposerIndex = proposerIdx @@ -559,9 +559,9 @@ func TestValidateBeaconBlockPubSub_RejectBlocksFromFuture(t *testing.T) { b32 := bytesutil.ToBytes32(b) sk, err := bls.SecretKeyFromBytes(b32[:]) require.NoError(t, err) - msg := testutil.NewBeaconBlock() + msg := util.NewBeaconBlock() msg.Block.Slot = 3 - msg.Block.ParentRoot = testutil.Random32Bytes(t) + msg.Block.ParentRoot = util.Random32Bytes(t) msg.Signature = sk.Sign([]byte("data")).Marshal() chainService := &mock.ChainService{Genesis: time.Now()} @@ -602,8 +602,8 @@ func TestValidateBeaconBlockPubSub_RejectBlocksFromThePast(t *testing.T) { ctx := context.Background() sk, err := bls.SecretKeyFromBytes(b32[:]) require.NoError(t, err) - msg := testutil.NewBeaconBlock() - msg.Block.ParentRoot = testutil.Random32Bytes(t) + msg := util.NewBeaconBlock() + msg.Block.ParentRoot = util.Random32Bytes(t) msg.Block.Slot = 10 msg.Signature = sk.Sign([]byte("data")).Marshal() @@ -644,8 +644,8 @@ func TestValidateBeaconBlockPubSub_SeenProposerSlot(t *testing.T) { db := dbtest.SetupDB(t) p := p2ptest.NewTestP2P(t) ctx := context.Background() - beaconState, privKeys := testutil.DeterministicGenesisState(t, 100) - parentBlock := testutil.NewBeaconBlock() + beaconState, privKeys := util.DeterministicGenesisState(t, 100) + parentBlock := util.NewBeaconBlock() require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(parentBlock))) bRoot, err := parentBlock.Block.HashTreeRoot() require.NoError(t, err) @@ -653,7 +653,7 @@ func TestValidateBeaconBlockPubSub_SeenProposerSlot(t *testing.T) { proposerIdx, err := helpers.BeaconProposerIndex(beaconState) require.NoError(t, err) - msg := testutil.NewBeaconBlock() + msg := util.NewBeaconBlock() msg.Block.Slot = 1 msg.Block.ProposerIndex = proposerIdx msg.Block.ParentRoot = bRoot[:] @@ -702,7 +702,7 @@ func TestValidateBeaconBlockPubSub_FilterByFinalizedEpoch(t *testing.T) { db := dbtest.SetupDB(t) p := p2ptest.NewTestP2P(t) - parent := testutil.NewBeaconBlock() + parent := util.NewBeaconBlock() require.NoError(t, db.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(parent))) parentRoot, err := parent.Block.HashTreeRoot() require.NoError(t, err) @@ -724,7 +724,7 @@ func TestValidateBeaconBlockPubSub_FilterByFinalizedEpoch(t *testing.T) { badBlockCache: lruwrpr.New(10), } - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = 1 b.Block.ParentRoot = parentRoot[:] buf := new(bytes.Buffer) @@ -760,8 +760,8 @@ func TestValidateBeaconBlockPubSub_ParentNotFinalizedDescendant(t *testing.T) { db := dbtest.SetupDB(t) p := p2ptest.NewTestP2P(t) ctx := context.Background() - beaconState, privKeys := testutil.DeterministicGenesisState(t, 100) - parentBlock := testutil.NewBeaconBlock() + beaconState, privKeys := util.DeterministicGenesisState(t, 100) + parentBlock := util.NewBeaconBlock() require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(parentBlock))) bRoot, err := parentBlock.Block.HashTreeRoot() require.NoError(t, err) @@ -771,7 +771,7 @@ func TestValidateBeaconBlockPubSub_ParentNotFinalizedDescendant(t *testing.T) { require.NoError(t, copied.SetSlot(1)) proposerIdx, err := helpers.BeaconProposerIndex(copied) require.NoError(t, err) - msg := testutil.NewBeaconBlock() + msg := util.NewBeaconBlock() msg.Block.Slot = 1 msg.Block.ProposerIndex = proposerIdx msg.Block.ParentRoot = bRoot[:] @@ -822,8 +822,8 @@ func TestValidateBeaconBlockPubSub_InvalidParentBlock(t *testing.T) { db := dbtest.SetupDB(t) p := p2ptest.NewTestP2P(t) ctx := context.Background() - beaconState, privKeys := testutil.DeterministicGenesisState(t, 100) - parentBlock := testutil.NewBeaconBlock() + beaconState, privKeys := util.DeterministicGenesisState(t, 100) + parentBlock := util.NewBeaconBlock() require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(parentBlock))) bRoot, err := parentBlock.Block.HashTreeRoot() require.NoError(t, err) @@ -833,7 +833,7 @@ func TestValidateBeaconBlockPubSub_InvalidParentBlock(t *testing.T) { require.NoError(t, copied.SetSlot(1)) proposerIdx, err := helpers.BeaconProposerIndex(copied) require.NoError(t, err) - msg := testutil.NewBeaconBlock() + msg := util.NewBeaconBlock() msg.Block.ProposerIndex = proposerIdx msg.Block.Slot = 1 msg.Block.ParentRoot = bRoot[:] @@ -882,7 +882,7 @@ func TestValidateBeaconBlockPubSub_InvalidParentBlock(t *testing.T) { proposerIdx, err = helpers.BeaconProposerIndex(copied) require.NoError(t, err) - msg = testutil.NewBeaconBlock() + msg = util.NewBeaconBlock() msg.Block.Slot = 2 msg.Block.ProposerIndex = proposerIdx msg.Block.ParentRoot = currBlockRoot[:] @@ -907,8 +907,8 @@ func TestValidateBeaconBlockPubSub_RejectEvilBlocksFromFuture(t *testing.T) { p := p2ptest.NewTestP2P(t) ctx := context.Background() - beaconState, privKeys := testutil.DeterministicGenesisState(t, 100) - parentBlock := testutil.NewBeaconBlock() + beaconState, privKeys := util.DeterministicGenesisState(t, 100) + parentBlock := util.NewBeaconBlock() require.NoError(t, db.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(parentBlock))) bRoot, err := parentBlock.Block.HashTreeRoot() require.NoError(t, err) @@ -923,7 +923,7 @@ func TestValidateBeaconBlockPubSub_RejectEvilBlocksFromFuture(t *testing.T) { proposerIdx, err := helpers.BeaconProposerIndex(copied) require.NoError(t, err) - msg := testutil.NewBeaconBlock() + msg := util.NewBeaconBlock() msg.Block.ProposerIndex = proposerIdx msg.Block.Slot = blkSlot diff --git a/beacon-chain/sync/validate_proposer_slashing_test.go b/beacon-chain/sync/validate_proposer_slashing_test.go index 1762ea99e..d98383717 100644 --- a/beacon-chain/sync/validate_proposer_slashing_test.go +++ b/beacon-chain/sync/validate_proposer_slashing_test.go @@ -24,8 +24,8 @@ import ( "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/crypto/bls" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func setupValidProposerSlashing(t *testing.T) (*ethpb.ProposerSlashing, state.BeaconState) { diff --git a/beacon-chain/sync/validate_sync_committee_message_test.go b/beacon-chain/sync/validate_sync_committee_message_test.go index 502a33001..18cef171d 100644 --- a/beacon-chain/sync/validate_sync_committee_message_test.go +++ b/beacon-chain/sync/validate_sync_committee_message_test.go @@ -25,8 +25,8 @@ import ( "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestService_ValidateSyncCommitteeMessage(t *testing.T) { diff --git a/beacon-chain/sync/validate_sync_contribution_proof_test.go b/beacon-chain/sync/validate_sync_contribution_proof_test.go index 259c7cc3e..a6f3566f6 100644 --- a/beacon-chain/sync/validate_sync_contribution_proof_test.go +++ b/beacon-chain/sync/validate_sync_contribution_proof_test.go @@ -31,9 +31,9 @@ import ( "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestService_ValidateSyncContributionAndProof(t *testing.T) { @@ -888,7 +888,7 @@ func TestService_ValidateSyncContributionAndProof(t *testing.T) { } func fillUpBlocksAndState(ctx context.Context, t *testing.T, beaconDB db.Database) ([32]byte, []bls.SecretKey) { - gs, keys := testutil.DeterministicGenesisStateAltair(t, 64) + gs, keys := util.DeterministicGenesisStateAltair(t, 64) sCom, err := altair.NextSyncCommittee(ctx, gs) assert.NoError(t, err) assert.NoError(t, gs.SetCurrentSyncCommittee(sCom)) @@ -897,7 +897,7 @@ func fillUpBlocksAndState(ctx context.Context, t *testing.T, beaconDB db.Databas testState := gs.Copy() hRoot := [32]byte{} for i := types.Slot(1); i <= params.BeaconConfig().SlotsPerEpoch; i++ { - blk, err := testutil.GenerateFullBlockAltair(testState, keys, testutil.DefaultBlockGenConfig(), i) + blk, err := util.GenerateFullBlockAltair(testState, keys, util.DefaultBlockGenConfig(), i) require.NoError(t, err) r, err := blk.Block.HashTreeRoot() require.NoError(t, err) diff --git a/beacon-chain/sync/validate_voluntary_exit_test.go b/beacon-chain/sync/validate_voluntary_exit_test.go index 00490d29d..33911c98c 100644 --- a/beacon-chain/sync/validate_voluntary_exit_test.go +++ b/beacon-chain/sync/validate_voluntary_exit_test.go @@ -22,8 +22,8 @@ import ( "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/crypto/bls" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func setupValidExit(t *testing.T) (*ethpb.SignedVoluntaryExit, state.BeaconState) { diff --git a/cmd/BUILD.bazel b/cmd/BUILD.bazel index 24e221fcf..e2a76f475 100644 --- a/cmd/BUILD.bazel +++ b/cmd/BUILD.bazel @@ -36,8 +36,8 @@ go_test( embed = [":go_default_library"], deps = [ "//config/params:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "@com_github_golang_mock//gomock:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_urfave_cli_v2//:go_default_library", diff --git a/cmd/config_test.go b/cmd/config_test.go index 278d48196..6f0eba1aa 100644 --- a/cmd/config_test.go +++ b/cmd/config_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/prysmaticlabs/prysm/config/params" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" "github.com/urfave/cli/v2" ) diff --git a/cmd/flags_test.go b/cmd/flags_test.go index a17102183..a31fe61ce 100644 --- a/cmd/flags_test.go +++ b/cmd/flags_test.go @@ -6,7 +6,7 @@ import ( "os" "testing" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/urfave/cli/v2" ) diff --git a/cmd/helpers_test.go b/cmd/helpers_test.go index 751262603..95c9ee0df 100644 --- a/cmd/helpers_test.go +++ b/cmd/helpers_test.go @@ -8,8 +8,8 @@ import ( "github.com/golang/mock/gomock" "github.com/pkg/errors" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/urfave/cli/v2" ) diff --git a/config/features/BUILD.bazel b/config/features/BUILD.bazel index 08745dfe7..f0e7430f5 100644 --- a/config/features/BUILD.bazel +++ b/config/features/BUILD.bazel @@ -26,7 +26,7 @@ go_test( ], embed = [":go_default_library"], deps = [ - "//shared/testutil/assert:go_default_library", + "//testing/assert:go_default_library", "@com_github_urfave_cli_v2//:go_default_library", ], ) diff --git a/config/features/config_test.go b/config/features/config_test.go index 7db1e9813..2eca5db5b 100644 --- a/config/features/config_test.go +++ b/config/features/config_test.go @@ -4,7 +4,7 @@ import ( "flag" "testing" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" "github.com/urfave/cli/v2" ) diff --git a/config/features/deprecated_flags_test.go b/config/features/deprecated_flags_test.go index d8140c48c..c836a31a3 100644 --- a/config/features/deprecated_flags_test.go +++ b/config/features/deprecated_flags_test.go @@ -5,7 +5,7 @@ import ( "strings" "testing" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" ) func TestDeprecatedFlags(t *testing.T) { diff --git a/config/params/BUILD.bazel b/config/params/BUILD.bazel index b657cdd3a..01cc9135e 100644 --- a/config/params/BUILD.bazel +++ b/config/params/BUILD.bazel @@ -50,8 +50,8 @@ go_test( race = "on", deps = [ ":go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", "@in_gopkg_yaml_v2//:go_default_library", "@io_bazel_rules_go//go/tools/bazel:go_default_library", diff --git a/config/params/loader_test.go b/config/params/loader_test.go index 597e35c6f..91a11535a 100644 --- a/config/params/loader_test.go +++ b/config/params/loader_test.go @@ -9,8 +9,8 @@ import ( "github.com/bazelbuild/rules_go/go/tools/bazel" "github.com/prysmaticlabs/prysm/config/params" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" "gopkg.in/yaml.v2" ) diff --git a/config/params/testnet_config_test.go b/config/params/testnet_config_test.go index d84786988..89e234d98 100644 --- a/config/params/testnet_config_test.go +++ b/config/params/testnet_config_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/bazelbuild/rules_go/go/tools/bazel" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) func testnetConfigFilePath(t *testing.T, network string) string { diff --git a/container/queue/BUILD.bazel b/container/queue/BUILD.bazel index 5c93b0288..ee3085b8a 100644 --- a/container/queue/BUILD.bazel +++ b/container/queue/BUILD.bazel @@ -11,5 +11,5 @@ go_test( name = "go_default_test", srcs = ["priority_queue_test.go"], embed = [":go_default_library"], - deps = ["//shared/testutil/require:go_default_library"], + deps = ["//testing/require:go_default_library"], ) diff --git a/container/queue/priority_queue_test.go b/container/queue/priority_queue_test.go index 2d8828656..ca12e5bd7 100644 --- a/container/queue/priority_queue_test.go +++ b/container/queue/priority_queue_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) // Ensure we satisfy the heap.Interface diff --git a/container/trie/BUILD.bazel b/container/trie/BUILD.bazel index fab7bfd61..52e9494bd 100644 --- a/container/trie/BUILD.bazel +++ b/container/trie/BUILD.bazel @@ -27,7 +27,7 @@ go_test( "//crypto/hash:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/prysm/v1alpha1:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/require:go_default_library", "@com_github_ethereum_go_ethereum//accounts/abi/bind:go_default_library", ], ) diff --git a/container/trie/sparse_merkle_test.go b/container/trie/sparse_merkle_test.go index ffc41861d..41733528d 100644 --- a/container/trie/sparse_merkle_test.go +++ b/container/trie/sparse_merkle_test.go @@ -11,7 +11,7 @@ import ( "github.com/prysmaticlabs/prysm/crypto/hash" "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestMarshalDepositWithProof(t *testing.T) { diff --git a/contracts/deposit/BUILD.bazel b/contracts/deposit/BUILD.bazel index a62a7707f..06f102dbf 100644 --- a/contracts/deposit/BUILD.bazel +++ b/contracts/deposit/BUILD.bazel @@ -46,9 +46,9 @@ go_test( "//crypto/bls:go_default_library", "//proto/prysm/v1alpha1:go_default_library", "//runtime/interop:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "@com_github_ethereum_go_ethereum//:go_default_library", "@com_github_ethereum_go_ethereum//accounts/abi/bind:go_default_library", "@com_github_ethereum_go_ethereum//common:go_default_library", diff --git a/contracts/deposit/contract_test.go b/contracts/deposit/contract_test.go index 2117e8bb6..f7b13c53f 100644 --- a/contracts/deposit/contract_test.go +++ b/contracts/deposit/contract_test.go @@ -9,8 +9,8 @@ import ( "github.com/ethereum/go-ethereum/common" depositcontract "github.com/prysmaticlabs/prysm/contracts/deposit" "github.com/prysmaticlabs/prysm/runtime/interop" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestSetupRegistrationContract_OK(t *testing.T) { diff --git a/contracts/deposit/deposit_test.go b/contracts/deposit/deposit_test.go index 8e131d88c..64f446c7e 100644 --- a/contracts/deposit/deposit_test.go +++ b/contracts/deposit/deposit_test.go @@ -8,9 +8,9 @@ import ( "github.com/prysmaticlabs/prysm/contracts/deposit" "github.com/prysmaticlabs/prysm/crypto/bls" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestDepositInput_GeneratesPb(t *testing.T) { @@ -44,7 +44,7 @@ func TestDepositInput_GeneratesPb(t *testing.T) { } func TestVerifyDepositSignature_ValidSig(t *testing.T) { - deposits, _, err := testutil.DeterministicDepositsAndKeys(1) + deposits, _, err := util.DeterministicDepositsAndKeys(1) require.NoError(t, err) dep := deposits[0] domain, err := helpers.ComputeDomain( @@ -58,7 +58,7 @@ func TestVerifyDepositSignature_ValidSig(t *testing.T) { } func TestVerifyDepositSignature_InvalidSig(t *testing.T) { - deposits, _, err := testutil.DeterministicDepositsAndKeys(1) + deposits, _, err := util.DeterministicDepositsAndKeys(1) require.NoError(t, err) dep := deposits[0] domain, err := helpers.ComputeDomain( diff --git a/contracts/deposit/deposit_tree_test.go b/contracts/deposit/deposit_tree_test.go index 363b64acb..b5ab74f3d 100644 --- a/contracts/deposit/deposit_tree_test.go +++ b/contracts/deposit/deposit_tree_test.go @@ -9,8 +9,8 @@ import ( "github.com/prysmaticlabs/prysm/container/trie" depositcontract "github.com/prysmaticlabs/prysm/contracts/deposit" "github.com/prysmaticlabs/prysm/runtime/interop" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestDepositTrieRoot_OK(t *testing.T) { diff --git a/crypto/bls/BUILD.bazel b/crypto/bls/BUILD.bazel index cb7fa686b..e1171e806 100644 --- a/crypto/bls/BUILD.bazel +++ b/crypto/bls/BUILD.bazel @@ -29,7 +29,7 @@ go_test( deps = [ "//crypto/bls/common:go_default_library", "//crypto/rand:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", ], ) diff --git a/crypto/bls/bls_test.go b/crypto/bls/bls_test.go index 61e6e968f..03883575b 100644 --- a/crypto/bls/bls_test.go +++ b/crypto/bls/bls_test.go @@ -6,8 +6,8 @@ import ( "github.com/prysmaticlabs/prysm/crypto/bls/common" "github.com/prysmaticlabs/prysm/crypto/rand" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestDisallowZeroSecretKeys(t *testing.T) { diff --git a/crypto/bls/blst/BUILD.bazel b/crypto/bls/blst/BUILD.bazel index 7e234fd34..23bc2a91f 100644 --- a/crypto/bls/blst/BUILD.bazel +++ b/crypto/bls/blst/BUILD.bazel @@ -148,8 +148,8 @@ go_test( "//crypto/bls/blst:go_default_library", "//crypto/bls/common:go_default_library", "//encoding/bytesutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", ], "//conditions:default": [], }), @@ -183,8 +183,8 @@ go_test( ): [ "//crypto/bls/common:go_default_library", "//encoding/bytesutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", ], "//conditions:default": [], }), diff --git a/crypto/bls/blst/bls_benchmark_test.go b/crypto/bls/blst/bls_benchmark_test.go index a07f79ef9..ecd54c675 100644 --- a/crypto/bls/blst/bls_benchmark_test.go +++ b/crypto/bls/blst/bls_benchmark_test.go @@ -8,7 +8,7 @@ import ( "github.com/prysmaticlabs/prysm/crypto/bls/blst" "github.com/prysmaticlabs/prysm/crypto/bls/common" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) func BenchmarkSignature_Verify(b *testing.B) { diff --git a/crypto/bls/blst/public_key_test.go b/crypto/bls/blst/public_key_test.go index 574381219..6bf0ad1fb 100644 --- a/crypto/bls/blst/public_key_test.go +++ b/crypto/bls/blst/public_key_test.go @@ -9,8 +9,8 @@ import ( "testing" "github.com/prysmaticlabs/prysm/crypto/bls/blst" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestPublicKeyFromBytes(t *testing.T) { diff --git a/crypto/bls/blst/secret_key_test.go b/crypto/bls/blst/secret_key_test.go index 8af81007e..1eb2c2c2a 100644 --- a/crypto/bls/blst/secret_key_test.go +++ b/crypto/bls/blst/secret_key_test.go @@ -12,8 +12,8 @@ import ( "github.com/prysmaticlabs/prysm/crypto/bls/blst" "github.com/prysmaticlabs/prysm/crypto/bls/common" "github.com/prysmaticlabs/prysm/encoding/bytesutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestMarshalUnmarshal(t *testing.T) { diff --git a/crypto/bls/blst/signature_test.go b/crypto/bls/blst/signature_test.go index ed521cd9a..2c1212391 100644 --- a/crypto/bls/blst/signature_test.go +++ b/crypto/bls/blst/signature_test.go @@ -9,8 +9,8 @@ import ( "testing" "github.com/prysmaticlabs/prysm/crypto/bls/common" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestSignVerify(t *testing.T) { diff --git a/crypto/bls/signature_set_test.go b/crypto/bls/signature_set_test.go index 9dc14f36a..ea5b198ac 100644 --- a/crypto/bls/signature_set_test.go +++ b/crypto/bls/signature_set_test.go @@ -3,7 +3,7 @@ package bls import ( "testing" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" ) func TestCopySignatureSet(t *testing.T) { diff --git a/crypto/hash/BUILD.bazel b/crypto/hash/BUILD.bazel index 858c80b97..245c2b785 100644 --- a/crypto/hash/BUILD.bazel +++ b/crypto/hash/BUILD.bazel @@ -25,8 +25,8 @@ go_test( "//encoding/bytesutil:go_default_library", "//proto/prysm/v1alpha1:go_default_library", "//proto/testing:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "@com_github_google_gofuzz//:go_default_library", ], ) diff --git a/crypto/hash/hash_test.go b/crypto/hash/hash_test.go index e30ac3c51..67232e9ca 100644 --- a/crypto/hash/hash_test.go +++ b/crypto/hash/hash_test.go @@ -10,8 +10,8 @@ import ( "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" pb "github.com/prysmaticlabs/prysm/proto/testing" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestHash(t *testing.T) { diff --git a/crypto/keystore/BUILD.bazel b/crypto/keystore/BUILD.bazel index aff31ae2e..02f9918ad 100644 --- a/crypto/keystore/BUILD.bazel +++ b/crypto/keystore/BUILD.bazel @@ -34,8 +34,8 @@ go_test( deps = [ "//crypto/bls:go_default_library", "//encoding/bytesutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "@com_github_pborman_uuid//:go_default_library", ], ) diff --git a/crypto/keystore/key_test.go b/crypto/keystore/key_test.go index f22dca3f3..2a8a05319 100644 --- a/crypto/keystore/key_test.go +++ b/crypto/keystore/key_test.go @@ -9,7 +9,7 @@ import ( "github.com/pborman/uuid" "github.com/prysmaticlabs/prysm/crypto/bls" "github.com/prysmaticlabs/prysm/encoding/bytesutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestMarshalAndUnmarshal(t *testing.T) { diff --git a/crypto/keystore/keystore_test.go b/crypto/keystore/keystore_test.go index 36250e1e7..0c2d64d4c 100644 --- a/crypto/keystore/keystore_test.go +++ b/crypto/keystore/keystore_test.go @@ -9,8 +9,8 @@ import ( "github.com/pborman/uuid" "github.com/prysmaticlabs/prysm/crypto/bls" "github.com/prysmaticlabs/prysm/encoding/bytesutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestStoreAndGetKey(t *testing.T) { diff --git a/encoding/bytesutil/BUILD.bazel b/encoding/bytesutil/BUILD.bazel index 59d7907cc..81da860d7 100644 --- a/encoding/bytesutil/BUILD.bazel +++ b/encoding/bytesutil/BUILD.bazel @@ -17,7 +17,7 @@ go_test( srcs = ["bytes_test.go"], deps = [ ":go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", ], ) diff --git a/encoding/bytesutil/bytes_test.go b/encoding/bytesutil/bytes_test.go index 4412c394b..78b2b544c 100644 --- a/encoding/bytesutil/bytes_test.go +++ b/encoding/bytesutil/bytes_test.go @@ -5,8 +5,8 @@ import ( "testing" "github.com/prysmaticlabs/prysm/encoding/bytesutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestToBytes(t *testing.T) { diff --git a/encoding/ssz/BUILD.bazel b/encoding/ssz/BUILD.bazel index bc254d225..d9e431746 100644 --- a/encoding/ssz/BUILD.bazel +++ b/encoding/ssz/BUILD.bazel @@ -39,8 +39,8 @@ go_test( ":go_default_library", "//crypto/hash:go_default_library", "//proto/prysm/v1alpha1:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", ], ) diff --git a/encoding/ssz/deep_equal_test.go b/encoding/ssz/deep_equal_test.go index 74fb0006e..c4699f7c7 100644 --- a/encoding/ssz/deep_equal_test.go +++ b/encoding/ssz/deep_equal_test.go @@ -5,7 +5,7 @@ import ( "github.com/prysmaticlabs/prysm/encoding/ssz" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" ) func TestDeepEqualBasicTypes(t *testing.T) { diff --git a/encoding/ssz/hashers_test.go b/encoding/ssz/hashers_test.go index 0f9ff6211..19a479719 100644 --- a/encoding/ssz/hashers_test.go +++ b/encoding/ssz/hashers_test.go @@ -5,7 +5,7 @@ import ( "github.com/prysmaticlabs/prysm/crypto/hash" "github.com/prysmaticlabs/prysm/encoding/ssz" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" ) func TestHash(t *testing.T) { diff --git a/encoding/ssz/helpers_test.go b/encoding/ssz/helpers_test.go index b414b9e47..bf0d8842b 100644 --- a/encoding/ssz/helpers_test.go +++ b/encoding/ssz/helpers_test.go @@ -6,8 +6,8 @@ import ( "github.com/prysmaticlabs/go-bitfield" "github.com/prysmaticlabs/prysm/crypto/hash" "github.com/prysmaticlabs/prysm/encoding/ssz" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) const merkleizingListLimitError = "merkleizing list that is too large, over limit" diff --git a/encoding/ssz/htrutils_test.go b/encoding/ssz/htrutils_test.go index 7c4018af0..92477b86b 100644 --- a/encoding/ssz/htrutils_test.go +++ b/encoding/ssz/htrutils_test.go @@ -6,8 +6,8 @@ import ( "github.com/prysmaticlabs/prysm/crypto/hash" "github.com/prysmaticlabs/prysm/encoding/ssz" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestUint64Root(t *testing.T) { diff --git a/encoding/ssz/merkleize_test.go b/encoding/ssz/merkleize_test.go index 612c1a438..72fb0c658 100644 --- a/encoding/ssz/merkleize_test.go +++ b/encoding/ssz/merkleize_test.go @@ -5,7 +5,7 @@ import ( "github.com/prysmaticlabs/prysm/crypto/hash" "github.com/prysmaticlabs/prysm/encoding/ssz" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" ) func TestGetDepth(t *testing.T) { diff --git a/io/file/BUILD.bazel b/io/file/BUILD.bazel index 1a3eb6e34..930938a8c 100644 --- a/io/file/BUILD.bazel +++ b/io/file/BUILD.bazel @@ -18,7 +18,7 @@ go_test( deps = [ ":go_default_library", "//config/params:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", ], ) diff --git a/io/file/fileutil_test.go b/io/file/fileutil_test.go index 7e07ba403..4ac75b7cc 100644 --- a/io/file/fileutil_test.go +++ b/io/file/fileutil_test.go @@ -27,8 +27,8 @@ import ( "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/io/file" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestPathExpansion(t *testing.T) { diff --git a/io/logs/BUILD.bazel b/io/logs/BUILD.bazel index 0598efaa1..031358edb 100644 --- a/io/logs/BUILD.bazel +++ b/io/logs/BUILD.bazel @@ -25,5 +25,5 @@ go_test( "stream_test.go", ], embed = [":go_default_library"], - deps = ["//shared/testutil/require:go_default_library"], + deps = ["//testing/require:go_default_library"], ) diff --git a/io/logs/logutil_test.go b/io/logs/logutil_test.go index 85d914566..8758a6433 100644 --- a/io/logs/logutil_test.go +++ b/io/logs/logutil_test.go @@ -3,7 +3,7 @@ package logs import ( "testing" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) var urltests = []struct { diff --git a/io/logs/stream_test.go b/io/logs/stream_test.go index 819fab54c..ee34e449f 100644 --- a/io/logs/stream_test.go +++ b/io/logs/stream_test.go @@ -3,7 +3,7 @@ package logs import ( "testing" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestStreamServer_BackfillsMessages(t *testing.T) { diff --git a/io/prompt/BUILD.bazel b/io/prompt/BUILD.bazel index dc5d36062..287b52df4 100644 --- a/io/prompt/BUILD.bazel +++ b/io/prompt/BUILD.bazel @@ -24,7 +24,7 @@ go_test( srcs = ["validate_test.go"], embed = [":go_default_library"], deps = [ - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", ], ) diff --git a/io/prompt/validate_test.go b/io/prompt/validate_test.go index 86043db09..c2ce035a9 100644 --- a/io/prompt/validate_test.go +++ b/io/prompt/validate_test.go @@ -5,8 +5,8 @@ import ( "os" "testing" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestValidatePasswordInput(t *testing.T) { diff --git a/math/BUILD.bazel b/math/BUILD.bazel index a07d49000..192020846 100644 --- a/math/BUILD.bazel +++ b/math/BUILD.bazel @@ -14,6 +14,6 @@ go_test( srcs = ["math_helper_test.go"], deps = [ ":go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/require:go_default_library", ], ) diff --git a/math/math_helper_test.go b/math/math_helper_test.go index 7c1a0bb9c..916c267e2 100644 --- a/math/math_helper_test.go +++ b/math/math_helper_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/prysmaticlabs/prysm/math" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestIntegerSquareRoot(t *testing.T) { diff --git a/monitoring/clientstats/BUILD.bazel b/monitoring/clientstats/BUILD.bazel index 590d7fde1..3c994d5ff 100644 --- a/monitoring/clientstats/BUILD.bazel +++ b/monitoring/clientstats/BUILD.bazel @@ -23,7 +23,7 @@ go_test( srcs = ["scrapers_test.go"], embed = [":go_default_library"], deps = [ - "//shared/testutil/require:go_default_library", + "//testing/require:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", "@com_github_sirupsen_logrus//hooks/test:go_default_library", ], diff --git a/monitoring/clientstats/scrapers_test.go b/monitoring/clientstats/scrapers_test.go index c05761320..b854c4854 100644 --- a/monitoring/clientstats/scrapers_test.go +++ b/monitoring/clientstats/scrapers_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/sirupsen/logrus" logTest "github.com/sirupsen/logrus/hooks/test" ) diff --git a/monitoring/prometheus/BUILD.bazel b/monitoring/prometheus/BUILD.bazel index 180f32efe..d0df487d9 100644 --- a/monitoring/prometheus/BUILD.bazel +++ b/monitoring/prometheus/BUILD.bazel @@ -30,8 +30,8 @@ go_test( embed = [":go_default_library"], deps = [ "//runtime:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", ], ) diff --git a/monitoring/prometheus/logrus_collector_test.go b/monitoring/prometheus/logrus_collector_test.go index 440c12f22..b106a8758 100644 --- a/monitoring/prometheus/logrus_collector_test.go +++ b/monitoring/prometheus/logrus_collector_test.go @@ -10,8 +10,8 @@ import ( "time" "github.com/prysmaticlabs/prysm/monitoring/prometheus" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" log "github.com/sirupsen/logrus" ) diff --git a/monitoring/prometheus/service_test.go b/monitoring/prometheus/service_test.go index e7d6baa08..39ee33cbe 100644 --- a/monitoring/prometheus/service_test.go +++ b/monitoring/prometheus/service_test.go @@ -10,8 +10,8 @@ import ( "time" "github.com/prysmaticlabs/prysm/runtime" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/sirupsen/logrus" ) diff --git a/network/BUILD.bazel b/network/BUILD.bazel index cf2eca8b4..cf26210b2 100644 --- a/network/BUILD.bazel +++ b/network/BUILD.bazel @@ -20,7 +20,7 @@ go_test( embed = [":go_default_library"], deps = [ "//network/authorization:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", ], ) diff --git a/network/endpoint_test.go b/network/endpoint_test.go index 70033e226..3bfa9029c 100644 --- a/network/endpoint_test.go +++ b/network/endpoint_test.go @@ -4,8 +4,8 @@ import ( "testing" "github.com/prysmaticlabs/prysm/network/authorization" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestToHeaderValue(t *testing.T) { diff --git a/network/external_ip_test.go b/network/external_ip_test.go index 9c27ff65f..048c82604 100644 --- a/network/external_ip_test.go +++ b/network/external_ip_test.go @@ -6,8 +6,8 @@ import ( "testing" "github.com/prysmaticlabs/prysm/network" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestExternalIPv4(t *testing.T) { diff --git a/network/forks/BUILD.bazel b/network/forks/BUILD.bazel index 80b3cceaf..bd51668bf 100644 --- a/network/forks/BUILD.bazel +++ b/network/forks/BUILD.bazel @@ -24,7 +24,7 @@ go_test( "//beacon-chain/core/helpers:go_default_library", "//config/params:go_default_library", "//proto/prysm/v1alpha1:go_default_library", - "//shared/testutil/assert:go_default_library", + "//testing/assert:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", ], ) diff --git a/network/forks/fork_test.go b/network/forks/fork_test.go index fbe32c105..79537e99c 100644 --- a/network/forks/fork_test.go +++ b/network/forks/fork_test.go @@ -10,7 +10,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core/helpers" "github.com/prysmaticlabs/prysm/config/params" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" ) func TestFork(t *testing.T) { diff --git a/proto/migration/BUILD.bazel b/proto/migration/BUILD.bazel index fb7913955..8a64f116b 100644 --- a/proto/migration/BUILD.bazel +++ b/proto/migration/BUILD.bazel @@ -33,9 +33,9 @@ go_test( "//proto/eth/v1:go_default_library", "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/wrapper:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", ], diff --git a/proto/migration/v1alpha1_to_v1_test.go b/proto/migration/v1alpha1_to_v1_test.go index d71f39250..6145022e1 100644 --- a/proto/migration/v1alpha1_to_v1_test.go +++ b/proto/migration/v1alpha1_to_v1_test.go @@ -9,9 +9,9 @@ import ( ethpbv1 "github.com/prysmaticlabs/prysm/proto/eth/v1" ethpbalpha "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) var ( @@ -36,7 +36,7 @@ var ( ) func Test_BlockIfaceToV1BlockHeader(t *testing.T) { - alphaBlock := testutil.HydrateSignedBeaconBlock(ðpbalpha.SignedBeaconBlock{}) + alphaBlock := util.HydrateSignedBeaconBlock(ðpbalpha.SignedBeaconBlock{}) alphaBlock.Block.Slot = slot alphaBlock.Block.ProposerIndex = validatorIndex alphaBlock.Block.ParentRoot = parentRoot @@ -57,7 +57,7 @@ func Test_BlockIfaceToV1BlockHeader(t *testing.T) { func Test_V1Alpha1AggregateAttAndProofToV1(t *testing.T) { proof := [32]byte{1} - att := testutil.HydrateAttestation(ðpbalpha.Attestation{ + att := util.HydrateAttestation(ðpbalpha.Attestation{ Data: ðpbalpha.AttestationData{ Slot: 5, }, @@ -74,7 +74,7 @@ func Test_V1Alpha1AggregateAttAndProofToV1(t *testing.T) { } func Test_V1Alpha1ToV1SignedBlock(t *testing.T) { - alphaBlock := testutil.HydrateSignedBeaconBlock(ðpbalpha.SignedBeaconBlock{}) + alphaBlock := util.HydrateSignedBeaconBlock(ðpbalpha.SignedBeaconBlock{}) alphaBlock.Block.Slot = slot alphaBlock.Block.ProposerIndex = validatorIndex alphaBlock.Block.ParentRoot = parentRoot @@ -97,7 +97,7 @@ func Test_V1Alpha1ToV1SignedBlock(t *testing.T) { } func Test_V1ToV1Alpha1SignedBlock(t *testing.T) { - v1Block := testutil.HydrateV1SignedBeaconBlock(ðpbv1.SignedBeaconBlock{}) + v1Block := util.HydrateV1SignedBeaconBlock(ðpbv1.SignedBeaconBlock{}) v1Block.Block.Slot = slot v1Block.Block.ProposerIndex = validatorIndex v1Block.Block.ParentRoot = parentRoot @@ -120,7 +120,7 @@ func Test_V1ToV1Alpha1SignedBlock(t *testing.T) { } func Test_V1ToV1Alpha1Block(t *testing.T) { - alphaBlock := testutil.HydrateBeaconBlock(ðpbalpha.BeaconBlock{}) + alphaBlock := util.HydrateBeaconBlock(ðpbalpha.BeaconBlock{}) alphaBlock.Slot = slot alphaBlock.ProposerIndex = validatorIndex alphaBlock.ParentRoot = parentRoot @@ -173,7 +173,7 @@ func Test_V1Alpha1AttSlashingToV1(t *testing.T) { } func Test_V1Alpha1ProposerSlashingToV1(t *testing.T) { - alphaHeader := testutil.HydrateSignedBeaconHeader(ðpbalpha.SignedBeaconBlockHeader{}) + alphaHeader := util.HydrateSignedBeaconHeader(ðpbalpha.SignedBeaconBlockHeader{}) alphaHeader.Header.Slot = slot alphaHeader.Header.ProposerIndex = validatorIndex alphaHeader.Header.ParentRoot = parentRoot @@ -337,7 +337,7 @@ func Test_V1AttToV1Alpha1(t *testing.T) { } func Test_BlockInterfaceToV1Block(t *testing.T) { - v1Alpha1Block := testutil.HydrateSignedBeaconBlock(ðpbalpha.SignedBeaconBlock{}) + v1Alpha1Block := util.HydrateSignedBeaconBlock(ðpbalpha.SignedBeaconBlock{}) v1Alpha1Block.Block.Slot = slot v1Alpha1Block.Block.ProposerIndex = validatorIndex v1Alpha1Block.Block.ParentRoot = parentRoot @@ -411,7 +411,7 @@ func Test_V1SignedAggregateAttAndProofToV1Alpha1(t *testing.T) { v1Att := ðpbv1.SignedAggregateAttestationAndProof{ Message: ðpbv1.AggregateAttestationAndProof{ AggregatorIndex: 1, - Aggregate: testutil.HydrateV1Attestation(ðpbv1.Attestation{}), + Aggregate: util.HydrateV1Attestation(ðpbv1.Attestation{}), SelectionProof: selectionProof, }, Signature: signature, @@ -426,7 +426,7 @@ func Test_V1SignedAggregateAttAndProofToV1Alpha1(t *testing.T) { } func Test_V1AttestationToV1Alpha1(t *testing.T) { - v1Att := testutil.HydrateV1Attestation(ðpbv1.Attestation{}) + v1Att := util.HydrateV1Attestation(ðpbv1.Attestation{}) v1Alpha1Att := V1AttToV1Alpha1(v1Att) v1Root, err := v1Att.HashTreeRoot() @@ -437,7 +437,7 @@ func Test_V1AttestationToV1Alpha1(t *testing.T) { } func Test_V1Alpha1BeaconBlockAltairToV2(t *testing.T) { - alphaBlock := testutil.HydrateBeaconBlockAltair(ðpbalpha.BeaconBlockAltair{}) + alphaBlock := util.HydrateBeaconBlockAltair(ðpbalpha.BeaconBlockAltair{}) alphaBlock.Slot = slot alphaBlock.ProposerIndex = validatorIndex alphaBlock.ParentRoot = parentRoot @@ -465,7 +465,7 @@ func Test_V1Alpha1BeaconBlockAltairToV2(t *testing.T) { } func TestBeaconStateToV1(t *testing.T) { - source, err := testutil.NewBeaconState(testutil.FillRootsNaturalOpt, func(state *ethpbalpha.BeaconState) error { + source, err := util.NewBeaconState(util.FillRootsNaturalOpt, func(state *ethpbalpha.BeaconState) error { state.GenesisTime = 1 state.GenesisValidatorsRoot = bytesutil.PadTo([]byte("genesisvalidatorroot"), 32) state.Slot = 2 diff --git a/proto/prysm/v1alpha1/BUILD.bazel b/proto/prysm/v1alpha1/BUILD.bazel index 6f4d280e2..e25e4c56f 100644 --- a/proto/prysm/v1alpha1/BUILD.bazel +++ b/proto/prysm/v1alpha1/BUILD.bazel @@ -199,6 +199,6 @@ go_test( srcs = ["cloners_test.go"], embed = [":go_default_library"], deps = [ - "//shared/testutil/assert:go_default_library", + "//testing/assert:go_default_library", ], ) diff --git a/proto/prysm/v1alpha1/attestation/BUILD.bazel b/proto/prysm/v1alpha1/attestation/BUILD.bazel index dd07fc6ba..f330b9272 100644 --- a/proto/prysm/v1alpha1/attestation/BUILD.bazel +++ b/proto/prysm/v1alpha1/attestation/BUILD.bazel @@ -24,8 +24,8 @@ go_test( ":go_default_library", "//config/params:go_default_library", "//proto/prysm/v1alpha1:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", ], diff --git a/proto/prysm/v1alpha1/attestation/aggregation/BUILD.bazel b/proto/prysm/v1alpha1/attestation/aggregation/BUILD.bazel index 588a213be..2075e2216 100644 --- a/proto/prysm/v1alpha1/attestation/aggregation/BUILD.bazel +++ b/proto/prysm/v1alpha1/attestation/aggregation/BUILD.bazel @@ -25,7 +25,7 @@ go_test( deps = [ "//config/params:go_default_library", "//proto/prysm/v1alpha1/attestation/aggregation/testing:go_default_library", - "//shared/testutil/assert:go_default_library", + "//testing/assert:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", ], ) diff --git a/proto/prysm/v1alpha1/attestation/aggregation/attestations/BUILD.bazel b/proto/prysm/v1alpha1/attestation/aggregation/attestations/BUILD.bazel index 289aadb6e..3c538315d 100644 --- a/proto/prysm/v1alpha1/attestation/aggregation/attestations/BUILD.bazel +++ b/proto/prysm/v1alpha1/attestation/aggregation/attestations/BUILD.bazel @@ -36,8 +36,8 @@ go_test( "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation/aggregation:go_default_library", "//proto/prysm/v1alpha1/attestation/aggregation/testing:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", ], diff --git a/proto/prysm/v1alpha1/attestation/aggregation/attestations/attestations_bench_test.go b/proto/prysm/v1alpha1/attestation/aggregation/attestations/attestations_bench_test.go index e216814eb..984b44239 100644 --- a/proto/prysm/v1alpha1/attestation/aggregation/attestations/attestations_bench_test.go +++ b/proto/prysm/v1alpha1/attestation/aggregation/attestations/attestations_bench_test.go @@ -10,7 +10,7 @@ import ( "github.com/prysmaticlabs/prysm/crypto/bls" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" aggtesting "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/attestation/aggregation/testing" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) func BenchmarkAggregateAttestations_Aggregate(b *testing.B) { diff --git a/proto/prysm/v1alpha1/attestation/aggregation/attestations/attestations_test.go b/proto/prysm/v1alpha1/attestation/aggregation/attestations/attestations_test.go index ba7041044..814070387 100644 --- a/proto/prysm/v1alpha1/attestation/aggregation/attestations/attestations_test.go +++ b/proto/prysm/v1alpha1/attestation/aggregation/attestations/attestations_test.go @@ -14,8 +14,8 @@ import ( ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/attestation/aggregation" aggtesting "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/attestation/aggregation/testing" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/sirupsen/logrus" ) diff --git a/proto/prysm/v1alpha1/attestation/aggregation/attestations/maxcover_test.go b/proto/prysm/v1alpha1/attestation/aggregation/attestations/maxcover_test.go index f26eae6cd..a3add6de5 100644 --- a/proto/prysm/v1alpha1/attestation/aggregation/attestations/maxcover_test.go +++ b/proto/prysm/v1alpha1/attestation/aggregation/attestations/maxcover_test.go @@ -7,7 +7,7 @@ import ( "github.com/prysmaticlabs/prysm/crypto/bls" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/attestation/aggregation" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" ) func TestAggregateAttestations_MaxCover_NewMaxCover(t *testing.T) { diff --git a/proto/prysm/v1alpha1/attestation/aggregation/maxcover_test.go b/proto/prysm/v1alpha1/attestation/aggregation/maxcover_test.go index b869a69aa..da1ce4149 100644 --- a/proto/prysm/v1alpha1/attestation/aggregation/maxcover_test.go +++ b/proto/prysm/v1alpha1/attestation/aggregation/maxcover_test.go @@ -7,7 +7,7 @@ import ( "github.com/prysmaticlabs/go-bitfield" aggtesting "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/attestation/aggregation/testing" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" ) func TestMaxCover_MaxCoverCandidates_filter(t *testing.T) { diff --git a/proto/prysm/v1alpha1/attestation/aggregation/sync_contribution/BUILD.bazel b/proto/prysm/v1alpha1/attestation/aggregation/sync_contribution/BUILD.bazel index be1afd35d..63bf6db2d 100644 --- a/proto/prysm/v1alpha1/attestation/aggregation/sync_contribution/BUILD.bazel +++ b/proto/prysm/v1alpha1/attestation/aggregation/sync_contribution/BUILD.bazel @@ -27,8 +27,8 @@ go_test( "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/attestation/aggregation:go_default_library", "//proto/prysm/v1alpha1/attestation/aggregation/testing:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", ], ) diff --git a/proto/prysm/v1alpha1/attestation/aggregation/sync_contribution/naive_test.go b/proto/prysm/v1alpha1/attestation/aggregation/sync_contribution/naive_test.go index 8a926f6cf..e3f2887f2 100644 --- a/proto/prysm/v1alpha1/attestation/aggregation/sync_contribution/naive_test.go +++ b/proto/prysm/v1alpha1/attestation/aggregation/sync_contribution/naive_test.go @@ -11,8 +11,8 @@ import ( ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/attestation/aggregation" aggtesting "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/attestation/aggregation/testing" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestAggregateAttestations_aggregate(t *testing.T) { diff --git a/proto/prysm/v1alpha1/attestation/attestation_utils_test.go b/proto/prysm/v1alpha1/attestation/attestation_utils_test.go index 60fb28eb6..56b1d86a5 100644 --- a/proto/prysm/v1alpha1/attestation/attestation_utils_test.go +++ b/proto/prysm/v1alpha1/attestation/attestation_utils_test.go @@ -9,8 +9,8 @@ import ( "github.com/prysmaticlabs/prysm/config/params" eth "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/attestation" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestAttestingIndices(t *testing.T) { diff --git a/proto/prysm/v1alpha1/block/BUILD.bazel b/proto/prysm/v1alpha1/block/BUILD.bazel index bf20db729..ce97bd90f 100644 --- a/proto/prysm/v1alpha1/block/BUILD.bazel +++ b/proto/prysm/v1alpha1/block/BUILD.bazel @@ -26,7 +26,7 @@ go_test( "//encoding/bytesutil:go_default_library", "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/wrapper:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", ], ) diff --git a/proto/prysm/v1alpha1/block/block_utils_test.go b/proto/prysm/v1alpha1/block/block_utils_test.go index 674bc042e..38ea8f58d 100644 --- a/proto/prysm/v1alpha1/block/block_utils_test.go +++ b/proto/prysm/v1alpha1/block/block_utils_test.go @@ -8,8 +8,8 @@ import ( eth "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestBeaconBlockHeaderFromBlock(t *testing.T) { diff --git a/proto/prysm/v1alpha1/cloners_test.go b/proto/prysm/v1alpha1/cloners_test.go index d65a648ca..21b59e155 100644 --- a/proto/prysm/v1alpha1/cloners_test.go +++ b/proto/prysm/v1alpha1/cloners_test.go @@ -6,7 +6,7 @@ import ( "testing" v1alpha1 "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" ) func TestCopyETH1Data(t *testing.T) { diff --git a/proto/prysm/v1alpha1/wrapper/BUILD.bazel b/proto/prysm/v1alpha1/wrapper/BUILD.bazel index cd8ff0e2e..306f30b48 100644 --- a/proto/prysm/v1alpha1/wrapper/BUILD.bazel +++ b/proto/prysm/v1alpha1/wrapper/BUILD.bazel @@ -28,9 +28,9 @@ go_test( "//encoding/bytesutil:go_default_library", "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", ], ) diff --git a/proto/prysm/v1alpha1/wrapper/beacon_block_test.go b/proto/prysm/v1alpha1/wrapper/beacon_block_test.go index c4d16fe79..710085ce2 100644 --- a/proto/prysm/v1alpha1/wrapper/beacon_block_test.go +++ b/proto/prysm/v1alpha1/wrapper/beacon_block_test.go @@ -10,9 +10,9 @@ import ( v1alpha1 "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" "github.com/prysmaticlabs/prysm/runtime/version" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestAltairSignedBeaconBlock_Signature(t *testing.T) { @@ -81,7 +81,7 @@ func TestAltairSignedBeaconBlock_PbAltairBlock(t *testing.T) { } func TestAltairSignedBeaconBlock_MarshalSSZTo(t *testing.T) { - wsb, err := wrapper.WrappedAltairSignedBeaconBlock(testutil.HydrateSignedBeaconBlockAltair(ðpb.SignedBeaconBlockAltair{})) + wsb, err := wrapper.WrappedAltairSignedBeaconBlock(util.HydrateSignedBeaconBlockAltair(ðpb.SignedBeaconBlockAltair{})) assert.NoError(t, err) var b []byte @@ -91,7 +91,7 @@ func TestAltairSignedBeaconBlock_MarshalSSZTo(t *testing.T) { } func TestAltairSignedBeaconBlock_SSZ(t *testing.T) { - wsb, err := wrapper.WrappedAltairSignedBeaconBlock(testutil.HydrateSignedBeaconBlockAltair(ðpb.SignedBeaconBlockAltair{})) + wsb, err := wrapper.WrappedAltairSignedBeaconBlock(util.HydrateSignedBeaconBlockAltair(ðpb.SignedBeaconBlockAltair{})) assert.NoError(t, err) b, err := wsb.MarshalSSZ() @@ -161,7 +161,7 @@ func TestAltairBeaconBlock_IsNil(t *testing.T) { } func TestAltairBeaconBlock_HashTreeRoot(t *testing.T) { - wb, err := wrapper.WrappedAltairBeaconBlock(testutil.HydrateBeaconBlockAltair(ðpb.BeaconBlockAltair{})) + wb, err := wrapper.WrappedAltairBeaconBlock(util.HydrateBeaconBlockAltair(ðpb.BeaconBlockAltair{})) require.NoError(t, err) rt, err := wb.HashTreeRoot() @@ -178,7 +178,7 @@ func TestAltairBeaconBlock_Proto(t *testing.T) { } func TestAltairBeaconBlock_SSZ(t *testing.T) { - wb, err := wrapper.WrappedAltairBeaconBlock(testutil.HydrateBeaconBlockAltair(ðpb.BeaconBlockAltair{})) + wb, err := wrapper.WrappedAltairBeaconBlock(util.HydrateBeaconBlockAltair(ðpb.BeaconBlockAltair{})) assert.NoError(t, err) b, err := wb.MarshalSSZ() @@ -291,7 +291,7 @@ func TestAltairBeaconBlockBody_IsNil(t *testing.T) { } func TestAltairBeaconBlockBody_HashTreeRoot(t *testing.T) { - wb, err := wrapper.WrappedAltairBeaconBlockBody(testutil.HydrateBeaconBlockBodyAltair(ðpb.BeaconBlockBodyAltair{})) + wb, err := wrapper.WrappedAltairBeaconBlockBody(util.HydrateBeaconBlockBodyAltair(ðpb.BeaconBlockBodyAltair{})) assert.NoError(t, err) rt, err := wb.HashTreeRoot() @@ -311,7 +311,7 @@ func TestPhase0SignedBeaconBlock_Header(t *testing.T) { root := bytesutil.PadTo([]byte("root"), 32) signature := bytesutil.PadTo([]byte("sig"), 96) body := ðpb.BeaconBlockBody{} - body = testutil.HydrateBeaconBlockBody(body) + body = util.HydrateBeaconBlockBody(body) bodyRoot, err := body.HashTreeRoot() require.NoError(t, err) block := ðpb.SignedBeaconBlock{ @@ -340,7 +340,7 @@ func TestAltairSignedBeaconBlock_Header(t *testing.T) { root := bytesutil.PadTo([]byte("root"), 32) signature := bytesutil.PadTo([]byte("sig"), 96) body := ðpb.BeaconBlockBodyAltair{} - body = testutil.HydrateBeaconBlockBodyAltair(body) + body = util.HydrateBeaconBlockBodyAltair(body) bodyRoot, err := body.HashTreeRoot() require.NoError(t, err) block := ðpb.SignedBeaconBlockAltair{ diff --git a/proto/testing/BUILD.bazel b/proto/testing/BUILD.bazel index 887a5a211..2bb0311af 100644 --- a/proto/testing/BUILD.bazel +++ b/proto/testing/BUILD.bazel @@ -56,9 +56,9 @@ go_test( "//beacon-chain/state/v1:go_default_library", "//proto/prysm/v1alpha1:go_default_library", "//encoding/bytesutil:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/util:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "@com_github_ferranbt_fastssz//:go_default_library", "@com_github_ghodss_yaml//:go_default_library", "@com_github_golang_snappy//:go_default_library", diff --git a/proto/testing/tags_test.go b/proto/testing/tags_test.go index 30ab6e8cb..b9519b9d6 100644 --- a/proto/testing/tags_test.go +++ b/proto/testing/tags_test.go @@ -8,8 +8,8 @@ import ( "testing" pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestSSZTagSize(t *testing.T) { diff --git a/runtime/BUILD.bazel b/runtime/BUILD.bazel index f0814742a..246e05856 100644 --- a/runtime/BUILD.bazel +++ b/runtime/BUILD.bazel @@ -13,8 +13,8 @@ go_test( srcs = ["service_registry_test.go"], embed = [":go_default_library"], deps = [ - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", ], ) diff --git a/runtime/interop/BUILD.bazel b/runtime/interop/BUILD.bazel index cc0e0ef52..c1fb07388 100644 --- a/runtime/interop/BUILD.bazel +++ b/runtime/interop/BUILD.bazel @@ -38,8 +38,8 @@ go_test( "//config/params:go_default_library", "//container/trie:go_default_library", "//proto/prysm/v1alpha1:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", "@com_github_go_yaml_yaml//:go_default_library", "@io_bazel_rules_go//go/tools/bazel:go_default_library", diff --git a/runtime/interop/generate_genesis_state_test.go b/runtime/interop/generate_genesis_state_test.go index f43194f31..7a6a69046 100644 --- a/runtime/interop/generate_genesis_state_test.go +++ b/runtime/interop/generate_genesis_state_test.go @@ -9,8 +9,8 @@ import ( "github.com/prysmaticlabs/prysm/container/trie" eth "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/runtime/interop" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestGenerateGenesisState(t *testing.T) { diff --git a/runtime/interop/generate_keys_test.go b/runtime/interop/generate_keys_test.go index 40007ec22..30b8e9661 100644 --- a/runtime/interop/generate_keys_test.go +++ b/runtime/interop/generate_keys_test.go @@ -8,8 +8,8 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" "github.com/go-yaml/yaml" "github.com/prysmaticlabs/prysm/runtime/interop" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) type TestCase struct { diff --git a/runtime/messagehandler/BUILD.bazel b/runtime/messagehandler/BUILD.bazel index 945ac386d..374efa54c 100644 --- a/runtime/messagehandler/BUILD.bazel +++ b/runtime/messagehandler/BUILD.bazel @@ -18,7 +18,7 @@ go_test( srcs = ["messagehandler_test.go"], deps = [ ":go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/require:go_default_library", "@com_github_libp2p_go_libp2p_pubsub//:go_default_library", "@com_github_sirupsen_logrus//hooks/test:go_default_library", ], diff --git a/runtime/messagehandler/messagehandler_test.go b/runtime/messagehandler/messagehandler_test.go index 9733b20ad..6ff1fb1d3 100644 --- a/runtime/messagehandler/messagehandler_test.go +++ b/runtime/messagehandler/messagehandler_test.go @@ -6,7 +6,7 @@ import ( pubsub "github.com/libp2p/go-libp2p-pubsub" "github.com/prysmaticlabs/prysm/runtime/messagehandler" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" logTest "github.com/sirupsen/logrus/hooks/test" ) diff --git a/runtime/prereqs/BUILD.bazel b/runtime/prereqs/BUILD.bazel index 0061fc3ab..1f18d275f 100644 --- a/runtime/prereqs/BUILD.bazel +++ b/runtime/prereqs/BUILD.bazel @@ -16,7 +16,7 @@ go_test( srcs = ["prereq_test.go"], embed = [":go_default_library"], deps = [ - "//shared/testutil/require:go_default_library", + "//testing/require:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_sirupsen_logrus//hooks/test:go_default_library", ], diff --git a/runtime/prereqs/prereq_test.go b/runtime/prereqs/prereq_test.go index 0b6334bce..b160b5aea 100644 --- a/runtime/prereqs/prereq_test.go +++ b/runtime/prereqs/prereq_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/pkg/errors" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" logTest "github.com/sirupsen/logrus/hooks/test" ) diff --git a/runtime/service_registry_test.go b/runtime/service_registry_test.go index 6e23ffec9..9dfed5d9f 100644 --- a/runtime/service_registry_test.go +++ b/runtime/service_registry_test.go @@ -5,8 +5,8 @@ import ( "reflect" "testing" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) type mockService struct { diff --git a/runtime/tos/BUILD.bazel b/runtime/tos/BUILD.bazel index 5854af73c..3295e8b24 100644 --- a/runtime/tos/BUILD.bazel +++ b/runtime/tos/BUILD.bazel @@ -22,7 +22,7 @@ go_test( embed = [":go_default_library"], deps = [ "//cmd:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/require:go_default_library", "@com_github_urfave_cli_v2//:go_default_library", ], ) diff --git a/runtime/tos/tos_test.go b/runtime/tos/tos_test.go index c65aa7614..331d35fb8 100644 --- a/runtime/tos/tos_test.go +++ b/runtime/tos/tos_test.go @@ -8,7 +8,7 @@ import ( "testing" "github.com/prysmaticlabs/prysm/cmd" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/urfave/cli/v2" ) diff --git a/shared/testutil/assert/BUILD.bazel b/testing/assert/BUILD.bazel similarity index 67% rename from shared/testutil/assert/BUILD.bazel rename to testing/assert/BUILD.bazel index e2d24c289..0ecf2951b 100644 --- a/shared/testutil/assert/BUILD.bazel +++ b/testing/assert/BUILD.bazel @@ -4,10 +4,10 @@ go_library( name = "go_default_library", testonly = True, srcs = ["assertions.go"], - importpath = "github.com/prysmaticlabs/prysm/shared/testutil/assert", + importpath = "github.com/prysmaticlabs/prysm/testing/assert", visibility = ["//visibility:public"], deps = [ - "//shared/testutil/assertions:go_default_library", + "//testing/assertions:go_default_library", "@com_github_sirupsen_logrus//hooks/test:go_default_library", ], ) diff --git a/shared/testutil/assert/assertions.go b/testing/assert/assertions.go similarity index 98% rename from shared/testutil/assert/assertions.go rename to testing/assert/assertions.go index f2afd6eb1..4c49ba83e 100644 --- a/shared/testutil/assert/assertions.go +++ b/testing/assert/assertions.go @@ -1,7 +1,7 @@ package assert import ( - "github.com/prysmaticlabs/prysm/shared/testutil/assertions" + "github.com/prysmaticlabs/prysm/testing/assertions" "github.com/sirupsen/logrus/hooks/test" ) diff --git a/shared/testutil/assertions/BUILD.bazel b/testing/assertions/BUILD.bazel similarity index 82% rename from shared/testutil/assertions/BUILD.bazel rename to testing/assertions/BUILD.bazel index dfd5ae657..c64a7f992 100644 --- a/shared/testutil/assertions/BUILD.bazel +++ b/testing/assertions/BUILD.bazel @@ -3,7 +3,7 @@ load("@prysm//tools/go:def.bzl", "go_library", "go_test") go_library( name = "go_default_library", srcs = ["assertions.go"], - importpath = "github.com/prysmaticlabs/prysm/shared/testutil/assertions", + importpath = "github.com/prysmaticlabs/prysm/testing/assertions", visibility = ["//visibility:public"], deps = [ "//encoding/ssz:go_default_library", @@ -20,8 +20,8 @@ go_test( ":go_default_library", "//proto/prysm/v1alpha1:go_default_library", "//proto/testing:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", "@com_github_sirupsen_logrus//hooks/test:go_default_library", "@org_golang_google_protobuf//types/known/timestamppb:go_default_library", diff --git a/shared/testutil/assertions/assertions.go b/testing/assertions/assertions.go similarity index 100% rename from shared/testutil/assertions/assertions.go rename to testing/assertions/assertions.go diff --git a/shared/testutil/assertions/assertions_test.go b/testing/assertions/assertions_test.go similarity index 99% rename from shared/testutil/assertions/assertions_test.go rename to testing/assertions/assertions_test.go index d426ed2c6..012516dcf 100644 --- a/shared/testutil/assertions/assertions_test.go +++ b/testing/assertions/assertions_test.go @@ -8,9 +8,9 @@ import ( eth "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" testpb "github.com/prysmaticlabs/prysm/proto/testing" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/assertions" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/assertions" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/sirupsen/logrus" "github.com/sirupsen/logrus/hooks/test" "google.golang.org/protobuf/types/known/timestamppb" diff --git a/testing/benchmark/BUILD.bazel b/testing/benchmark/BUILD.bazel index 96f61d78a..70120820a 100644 --- a/testing/benchmark/BUILD.bazel +++ b/testing/benchmark/BUILD.bazel @@ -19,5 +19,5 @@ go_test( name = "go_default_test", srcs = ["pregen_test.go"], embed = [":go_default_library"], - deps = ["//shared/testutil/require:go_default_library"], + deps = ["//testing/require:go_default_library"], ) diff --git a/testing/benchmark/pregen_test.go b/testing/benchmark/pregen_test.go index 93fe28f95..5fbb77018 100644 --- a/testing/benchmark/pregen_test.go +++ b/testing/benchmark/pregen_test.go @@ -3,7 +3,7 @@ package benchmark import ( "testing" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestPreGenFullBlock(t *testing.T) { diff --git a/testing/bls/BUILD.bazel b/testing/bls/BUILD.bazel index 9a1630ffa..2254c7bbc 100644 --- a/testing/bls/BUILD.bazel +++ b/testing/bls/BUILD.bazel @@ -26,8 +26,8 @@ go_test( "//crypto/bls:go_default_library", "//crypto/bls/common:go_default_library", "//encoding/bytesutil:go_default_library", - "//shared/testutil/require:go_default_library", "//testing/bls/utils:go_default_library", + "//testing/require:go_default_library", "@com_github_ghodss_yaml//:go_default_library", "@com_github_supranational_blst//:go_default_library", ], diff --git a/testing/bls/aggregate_test.go b/testing/bls/aggregate_test.go index a736b89ba..85b143d7c 100644 --- a/testing/bls/aggregate_test.go +++ b/testing/bls/aggregate_test.go @@ -7,8 +7,8 @@ import ( "github.com/ghodss/yaml" "github.com/prysmaticlabs/prysm/crypto/bls" "github.com/prysmaticlabs/prysm/crypto/bls/common" - "github.com/prysmaticlabs/prysm/shared/testutil/require" "github.com/prysmaticlabs/prysm/testing/bls/utils" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestAggregate(t *testing.T) { diff --git a/testing/bls/aggregate_verify_test.go b/testing/bls/aggregate_verify_test.go index 802f1d2f9..122c3d36d 100644 --- a/testing/bls/aggregate_verify_test.go +++ b/testing/bls/aggregate_verify_test.go @@ -9,8 +9,8 @@ import ( "github.com/prysmaticlabs/prysm/crypto/bls" "github.com/prysmaticlabs/prysm/crypto/bls/common" "github.com/prysmaticlabs/prysm/encoding/bytesutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" "github.com/prysmaticlabs/prysm/testing/bls/utils" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestAggregateVerify(t *testing.T) { diff --git a/testing/bls/batch_verify_test.go b/testing/bls/batch_verify_test.go index 713198070..8d2875cad 100644 --- a/testing/bls/batch_verify_test.go +++ b/testing/bls/batch_verify_test.go @@ -9,8 +9,8 @@ import ( "github.com/prysmaticlabs/prysm/crypto/bls" "github.com/prysmaticlabs/prysm/crypto/bls/common" "github.com/prysmaticlabs/prysm/encoding/bytesutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" "github.com/prysmaticlabs/prysm/testing/bls/utils" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestBatchVerify(t *testing.T) { diff --git a/testing/bls/deserialization_G1_test.go b/testing/bls/deserialization_G1_test.go index 18537e911..276281f41 100644 --- a/testing/bls/deserialization_G1_test.go +++ b/testing/bls/deserialization_G1_test.go @@ -8,8 +8,8 @@ import ( "github.com/ghodss/yaml" "github.com/prysmaticlabs/prysm/crypto/bls" "github.com/prysmaticlabs/prysm/crypto/bls/common" - "github.com/prysmaticlabs/prysm/shared/testutil/require" "github.com/prysmaticlabs/prysm/testing/bls/utils" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestDeserializationG1(t *testing.T) { diff --git a/testing/bls/deserialization_G2_test.go b/testing/bls/deserialization_G2_test.go index 392e87fb3..630533fb6 100644 --- a/testing/bls/deserialization_G2_test.go +++ b/testing/bls/deserialization_G2_test.go @@ -6,8 +6,8 @@ import ( "github.com/ghodss/yaml" "github.com/prysmaticlabs/prysm/crypto/bls" - "github.com/prysmaticlabs/prysm/shared/testutil/require" "github.com/prysmaticlabs/prysm/testing/bls/utils" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestDeserializationG2(t *testing.T) { diff --git a/testing/bls/fast_aggregate_verify_test.go b/testing/bls/fast_aggregate_verify_test.go index 07f0206b3..898b25a87 100644 --- a/testing/bls/fast_aggregate_verify_test.go +++ b/testing/bls/fast_aggregate_verify_test.go @@ -9,8 +9,8 @@ import ( "github.com/prysmaticlabs/prysm/crypto/bls" "github.com/prysmaticlabs/prysm/crypto/bls/common" "github.com/prysmaticlabs/prysm/encoding/bytesutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" "github.com/prysmaticlabs/prysm/testing/bls/utils" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestFastAggregateVerify(t *testing.T) { diff --git a/testing/bls/hash_to_G2_test.go b/testing/bls/hash_to_G2_test.go index ce18ee8bd..d0d6a09aa 100644 --- a/testing/bls/hash_to_G2_test.go +++ b/testing/bls/hash_to_G2_test.go @@ -7,8 +7,8 @@ import ( "testing" "github.com/ghodss/yaml" - "github.com/prysmaticlabs/prysm/shared/testutil/require" "github.com/prysmaticlabs/prysm/testing/bls/utils" + "github.com/prysmaticlabs/prysm/testing/require" blst "github.com/supranational/blst/bindings/go" ) diff --git a/testing/bls/sign_test.go b/testing/bls/sign_test.go index cc4111ffc..55b3b1b3e 100644 --- a/testing/bls/sign_test.go +++ b/testing/bls/sign_test.go @@ -9,8 +9,8 @@ import ( "github.com/ghodss/yaml" "github.com/prysmaticlabs/prysm/crypto/bls" "github.com/prysmaticlabs/prysm/crypto/bls/common" - "github.com/prysmaticlabs/prysm/shared/testutil/require" "github.com/prysmaticlabs/prysm/testing/bls/utils" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestSign(t *testing.T) { diff --git a/testing/bls/utils/BUILD.bazel b/testing/bls/utils/BUILD.bazel index dc51345cd..04bcdc881 100644 --- a/testing/bls/utils/BUILD.bazel +++ b/testing/bls/utils/BUILD.bazel @@ -8,7 +8,7 @@ go_library( visibility = ["//testing/bls:__subpackages__"], deps = [ "//io/file:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/require:go_default_library", "@io_bazel_rules_go//go/tools/bazel:go_default_library", ], ) diff --git a/testing/bls/utils/utils.go b/testing/bls/utils/utils.go index d09f1251a..7ae8ed108 100644 --- a/testing/bls/utils/utils.go +++ b/testing/bls/utils/utils.go @@ -8,7 +8,7 @@ import ( "github.com/bazelbuild/rules_go/go/tools/bazel" "github.com/prysmaticlabs/prysm/io/file" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) func RetrieveFiles(name string, t *testing.T) ([]string, [][]byte) { diff --git a/testing/bls/verify_test.go b/testing/bls/verify_test.go index 4740b2338..31b6ad798 100644 --- a/testing/bls/verify_test.go +++ b/testing/bls/verify_test.go @@ -8,8 +8,8 @@ import ( "github.com/ghodss/yaml" "github.com/prysmaticlabs/prysm/crypto/bls" "github.com/prysmaticlabs/prysm/crypto/bls/common" - "github.com/prysmaticlabs/prysm/shared/testutil/require" "github.com/prysmaticlabs/prysm/testing/bls/utils" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestVerify(t *testing.T) { diff --git a/testing/endtoend/BUILD.bazel b/testing/endtoend/BUILD.bazel index 6d5096be4..3598ace8d 100644 --- a/testing/endtoend/BUILD.bazel +++ b/testing/endtoend/BUILD.bazel @@ -31,13 +31,13 @@ go_test( "//beacon-chain/core/transition:go_default_library", "//config/params:go_default_library", "//proto/prysm/v1alpha1:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", "//testing/endtoend/components:go_default_library", "//testing/endtoend/evaluators:go_default_library", "//testing/endtoend/helpers:go_default_library", "//testing/endtoend/params:go_default_library", "//testing/endtoend/types:go_default_library", + "//testing/require:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", "@org_golang_google_grpc//:go_default_library", diff --git a/testing/endtoend/components/BUILD.bazel b/testing/endtoend/components/BUILD.bazel index 11a5b0bd9..21df5fcd9 100644 --- a/testing/endtoend/components/BUILD.bazel +++ b/testing/endtoend/components/BUILD.bazel @@ -21,10 +21,10 @@ go_library( "//config/params:go_default_library", "//contracts/deposit:go_default_library", "//encoding/bytesutil:go_default_library", - "//shared/testutil:go_default_library", "//testing/endtoend/helpers:go_default_library", "//testing/endtoend/params:go_default_library", "//testing/endtoend/types:go_default_library", + "//testing/util:go_default_library", "@com_github_ethereum_go_ethereum//accounts/abi/bind:go_default_library", "@com_github_ethereum_go_ethereum//accounts/keystore:go_default_library", "@com_github_ethereum_go_ethereum//core/types:go_default_library", diff --git a/testing/endtoend/components/validator.go b/testing/endtoend/components/validator.go index c7b095c97..d32db4a97 100644 --- a/testing/endtoend/components/validator.go +++ b/testing/endtoend/components/validator.go @@ -23,10 +23,10 @@ import ( "github.com/prysmaticlabs/prysm/config/params" contracts "github.com/prysmaticlabs/prysm/contracts/deposit" "github.com/prysmaticlabs/prysm/encoding/bytesutil" - "github.com/prysmaticlabs/prysm/shared/testutil" "github.com/prysmaticlabs/prysm/testing/endtoend/helpers" e2e "github.com/prysmaticlabs/prysm/testing/endtoend/params" e2etypes "github.com/prysmaticlabs/prysm/testing/endtoend/types" + "github.com/prysmaticlabs/prysm/testing/util" ) const depositGasLimit = 4000000 @@ -246,7 +246,7 @@ func sendDeposits(web3 *ethclient.Client, keystoreBytes []byte, num, offset int, balances[i] = params.BeaconConfig().MaxEffectiveBalance } } - deposits, trie, err := testutil.DepositsWithBalance(balances) + deposits, trie, err := util.DepositsWithBalance(balances) if err != nil { return err } @@ -254,7 +254,7 @@ func sendDeposits(web3 *ethclient.Client, keystoreBytes []byte, num, offset int, allRoots := trie.Items() allBalances := balances if partial { - deposits2, trie2, err := testutil.DepositsWithBalance(balances) + deposits2, trie2, err := util.DepositsWithBalance(balances) if err != nil { return err } diff --git a/testing/endtoend/endtoend_test.go b/testing/endtoend/endtoend_test.go index 835a2b719..382155e2d 100644 --- a/testing/endtoend/endtoend_test.go +++ b/testing/endtoend/endtoend_test.go @@ -19,13 +19,13 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core/transition" "github.com/prysmaticlabs/prysm/config/params" eth "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" "github.com/prysmaticlabs/prysm/testing/endtoend/components" ev "github.com/prysmaticlabs/prysm/testing/endtoend/evaluators" "github.com/prysmaticlabs/prysm/testing/endtoend/helpers" e2e "github.com/prysmaticlabs/prysm/testing/endtoend/params" e2etypes "github.com/prysmaticlabs/prysm/testing/endtoend/types" + "github.com/prysmaticlabs/prysm/testing/require" log "github.com/sirupsen/logrus" "golang.org/x/sync/errgroup" "google.golang.org/grpc" diff --git a/testing/endtoend/evaluators/BUILD.bazel b/testing/endtoend/evaluators/BUILD.bazel index c50841985..5cededf1d 100644 --- a/testing/endtoend/evaluators/BUILD.bazel +++ b/testing/endtoend/evaluators/BUILD.bazel @@ -31,11 +31,11 @@ go_library( "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/block:go_default_library", "//proto/prysm/v1alpha1/wrapper:go_default_library", - "//shared/testutil:go_default_library", "//testing/endtoend/helpers:go_default_library", "//testing/endtoend/params:go_default_library", "//testing/endtoend/policies:go_default_library", "//testing/endtoend/types:go_default_library", + "//testing/util:go_default_library", "//time/slots:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", "@com_github_pkg_errors//:go_default_library", diff --git a/testing/endtoend/evaluators/operations.go b/testing/endtoend/evaluators/operations.go index bb63ce378..e69ba0ea8 100644 --- a/testing/endtoend/evaluators/operations.go +++ b/testing/endtoend/evaluators/operations.go @@ -14,11 +14,11 @@ import ( ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" "github.com/prysmaticlabs/prysm/testing/endtoend/helpers" e2e "github.com/prysmaticlabs/prysm/testing/endtoend/params" "github.com/prysmaticlabs/prysm/testing/endtoend/policies" e2etypes "github.com/prysmaticlabs/prysm/testing/endtoend/types" + "github.com/prysmaticlabs/prysm/testing/util" "golang.org/x/exp/rand" "google.golang.org/grpc" "google.golang.org/protobuf/types/known/emptypb" @@ -292,7 +292,7 @@ func proposeVoluntaryExit(conns ...*grpc.ClientConn) error { return errors.Wrap(err, "could not get chain head") } - _, privKeys, err := testutil.DeterministicDepositsAndKeys(params.BeaconConfig().MinGenesisActiveValidatorCount) + _, privKeys, err := util.DeterministicDepositsAndKeys(params.BeaconConfig().MinGenesisActiveValidatorCount) if err != nil { return err } diff --git a/testing/endtoend/evaluators/slashing.go b/testing/endtoend/evaluators/slashing.go index b7597ed7d..35da747df 100644 --- a/testing/endtoend/evaluators/slashing.go +++ b/testing/endtoend/evaluators/slashing.go @@ -12,9 +12,9 @@ import ( "github.com/prysmaticlabs/prysm/container/slice" "github.com/prysmaticlabs/prysm/encoding/bytesutil" eth "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" "github.com/prysmaticlabs/prysm/testing/endtoend/policies" e2eTypes "github.com/prysmaticlabs/prysm/testing/endtoend/types" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/grpc" "google.golang.org/protobuf/types/known/emptypb" ) @@ -106,7 +106,7 @@ func insertDoubleAttestationIntoPool(conns ...*grpc.ClientConn) error { return errors.Wrap(err, "could not get chain head") } - _, privKeys, err := testutil.DeterministicDepositsAndKeys(params.BeaconConfig().MinGenesisActiveValidatorCount) + _, privKeys, err := util.DeterministicDepositsAndKeys(params.BeaconConfig().MinGenesisActiveValidatorCount) if err != nil { return err } @@ -194,7 +194,7 @@ func proposeDoubleBlock(conns ...*grpc.ClientConn) error { return errors.Wrap(err, "could not get chain head") } - _, privKeys, err := testutil.DeterministicDepositsAndKeys(params.BeaconConfig().MinGenesisActiveValidatorCount) + _, privKeys, err := util.DeterministicDepositsAndKeys(params.BeaconConfig().MinGenesisActiveValidatorCount) if err != nil { return err } diff --git a/testing/endtoend/minimal_e2e_test.go b/testing/endtoend/minimal_e2e_test.go index f518c8dd9..20025656d 100644 --- a/testing/endtoend/minimal_e2e_test.go +++ b/testing/endtoend/minimal_e2e_test.go @@ -7,10 +7,10 @@ import ( "testing" "github.com/prysmaticlabs/prysm/config/params" - "github.com/prysmaticlabs/prysm/shared/testutil/require" ev "github.com/prysmaticlabs/prysm/testing/endtoend/evaluators" e2eParams "github.com/prysmaticlabs/prysm/testing/endtoend/params" "github.com/prysmaticlabs/prysm/testing/endtoend/types" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestEndToEnd_MinimalConfig(t *testing.T) { diff --git a/testing/endtoend/minimal_slashing_e2e_test.go b/testing/endtoend/minimal_slashing_e2e_test.go index 921ee53dd..aea4c450c 100644 --- a/testing/endtoend/minimal_slashing_e2e_test.go +++ b/testing/endtoend/minimal_slashing_e2e_test.go @@ -4,10 +4,10 @@ import ( "testing" "github.com/prysmaticlabs/prysm/config/params" - "github.com/prysmaticlabs/prysm/shared/testutil/require" ev "github.com/prysmaticlabs/prysm/testing/endtoend/evaluators" e2eParams "github.com/prysmaticlabs/prysm/testing/endtoend/params" "github.com/prysmaticlabs/prysm/testing/endtoend/types" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestEndToEnd_Slashing_MinimalConfig(t *testing.T) { diff --git a/testing/fuzz/BUILD.bazel b/testing/fuzz/BUILD.bazel index e20aede16..cc750b004 100644 --- a/testing/fuzz/BUILD.bazel +++ b/testing/fuzz/BUILD.bazel @@ -76,7 +76,7 @@ go_fuzz_test( "//beacon-chain/operations/slashings:go_default_library", "//beacon-chain/forkchoice/protoarray:go_default_library", "//beacon-chain/powchain/testing:go_default_library", - "//shared/testutil:go_default_library", + "//testing/util:go_default_library", "@com_github_libp2p_go_libp2p_core//peer:go_default_library", "@com_github_libp2p_go_libp2p_pubsub//:go_default_library", "@com_github_libp2p_go_libp2p_pubsub//pb:go_default_library", @@ -190,7 +190,7 @@ go_library( "//config/features:go_default_library", "//config/params:go_default_library", "//crypto/rand:go_default_library", - "//shared/testutil:go_default_library", + "//testing/util:go_default_library", "@com_github_libp2p_go_libp2p_core//host:go_default_library", "@com_github_libp2p_go_libp2p_core//network:go_default_library", "@com_github_libp2p_go_libp2p_core//peer:go_default_library", diff --git a/testing/fuzz/block_fuzz.go b/testing/fuzz/block_fuzz.go index 190cf4dfe..3ae4e2214 100644 --- a/testing/fuzz/block_fuzz.go +++ b/testing/fuzz/block_fuzz.go @@ -31,7 +31,7 @@ import ( "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/crypto/rand" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" + "github.com/prysmaticlabs/prysm/testing/util" "github.com/sirupsen/logrus" ) @@ -66,11 +66,11 @@ func setupDB() { } ctx := context.Background() - s, err := testutil.NewBeaconState() + s, err := util.NewBeaconState() if err != nil { panic(err) } - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() if err := db1.SaveBlock(ctx, wrapper.WrappedPhase0SignedBeaconBlock(b)); err != nil { panic(err) } diff --git a/testing/fuzz/testing/BUILD.bazel b/testing/fuzz/testing/BUILD.bazel index 5e8783f45..0c62efeff 100644 --- a/testing/fuzz/testing/BUILD.bazel +++ b/testing/fuzz/testing/BUILD.bazel @@ -13,7 +13,7 @@ go_library( ], deps = [ "//proto/prysm/v1alpha1:go_default_library", - "//shared/testutil:go_default_library", + "//testing/util:go_default_library", ], ) @@ -21,5 +21,5 @@ go_test( name = "go_default_test", srcs = ["beacon_fuzz_states_test.go"], embed = [":go_default_library"], - deps = ["//shared/testutil/require:go_default_library"], + deps = ["//testing/require:go_default_library"], ) diff --git a/testing/fuzz/testing/beacon_fuzz_states.go b/testing/fuzz/testing/beacon_fuzz_states.go index 7cf517b12..be5a85411 100644 --- a/testing/fuzz/testing/beacon_fuzz_states.go +++ b/testing/fuzz/testing/beacon_fuzz_states.go @@ -6,7 +6,7 @@ import ( "strconv" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" + "github.com/prysmaticlabs/prysm/testing/util" ) const fileBase = "0-11-0/mainnet/beaconstate" @@ -20,14 +20,14 @@ func BeaconFuzzState(ID uint64) (*ethpb.BeaconState, error) { if p, ok := os.LookupEnv(fileBaseENV); ok { base = p } - ok, err := testutil.BazelDirectoryNonEmpty(base) + ok, err := util.BazelDirectoryNonEmpty(base) if err != nil { panic(err) } if !ok { panic(fmt.Sprintf("Beacon states directory (%s) does not exist or has no files.", base)) } - b, err := testutil.BazelFileBytes(base, strconv.Itoa(int(ID))) + b, err := util.BazelFileBytes(base, strconv.Itoa(int(ID))) if err != nil { return nil, err } diff --git a/testing/fuzz/testing/beacon_fuzz_states_test.go b/testing/fuzz/testing/beacon_fuzz_states_test.go index 768d7ba56..a34142609 100644 --- a/testing/fuzz/testing/beacon_fuzz_states_test.go +++ b/testing/fuzz/testing/beacon_fuzz_states_test.go @@ -3,7 +3,7 @@ package testing import ( "testing" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestGetBeaconFuzzState(t *testing.T) { diff --git a/shared/testutil/require/BUILD.bazel b/testing/require/BUILD.bazel similarity index 67% rename from shared/testutil/require/BUILD.bazel rename to testing/require/BUILD.bazel index 24a06cedd..61faf608f 100644 --- a/shared/testutil/require/BUILD.bazel +++ b/testing/require/BUILD.bazel @@ -4,10 +4,10 @@ go_library( name = "go_default_library", testonly = True, srcs = ["requires.go"], - importpath = "github.com/prysmaticlabs/prysm/shared/testutil/require", + importpath = "github.com/prysmaticlabs/prysm/testing/require", visibility = ["//visibility:public"], deps = [ - "//shared/testutil/assertions:go_default_library", + "//testing/assertions:go_default_library", "@com_github_sirupsen_logrus//hooks/test:go_default_library", ], ) diff --git a/shared/testutil/require/requires.go b/testing/require/requires.go similarity index 98% rename from shared/testutil/require/requires.go rename to testing/require/requires.go index 2e8d7977a..365405d3e 100644 --- a/shared/testutil/require/requires.go +++ b/testing/require/requires.go @@ -1,7 +1,7 @@ package require import ( - "github.com/prysmaticlabs/prysm/shared/testutil/assertions" + "github.com/prysmaticlabs/prysm/testing/assertions" "github.com/sirupsen/logrus/hooks/test" ) diff --git a/testing/spectest/general/phase0/bls/BUILD.bazel b/testing/spectest/general/phase0/bls/BUILD.bazel index b7cbca5c3..c82fc1190 100644 --- a/testing/spectest/general/phase0/bls/BUILD.bazel +++ b/testing/spectest/general/phase0/bls/BUILD.bazel @@ -34,9 +34,9 @@ go_test( "//crypto/bls:go_default_library", "//crypto/bls/common:go_default_library", "//encoding/bytesutil:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", + "//testing/util:go_default_library", "@com_github_ghodss_yaml//:go_default_library", ], ) diff --git a/testing/spectest/general/phase0/bls/aggregate_test.go b/testing/spectest/general/phase0/bls/aggregate_test.go index b21a534bb..d82df5a6d 100644 --- a/testing/spectest/general/phase0/bls/aggregate_test.go +++ b/testing/spectest/general/phase0/bls/aggregate_test.go @@ -9,9 +9,9 @@ import ( "github.com/ghodss/yaml" "github.com/prysmaticlabs/prysm/crypto/bls" "github.com/prysmaticlabs/prysm/crypto/bls/common" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestAggregate(t *testing.T) { @@ -23,7 +23,7 @@ func testAggregate(t *testing.T) { for _, folder := range testFolders { t.Run(folder.Name(), func(t *testing.T) { - file, err := testutil.BazelFileBytes(path.Join(testFolderPath, folder.Name(), "data.yaml")) + file, err := util.BazelFileBytes(path.Join(testFolderPath, folder.Name(), "data.yaml")) require.NoError(t, err) test := &AggregateTest{} require.NoError(t, yaml.Unmarshal(file, test)) diff --git a/testing/spectest/general/phase0/bls/aggregate_verify_test.go b/testing/spectest/general/phase0/bls/aggregate_verify_test.go index becf2c912..aa9c2fde6 100644 --- a/testing/spectest/general/phase0/bls/aggregate_verify_test.go +++ b/testing/spectest/general/phase0/bls/aggregate_verify_test.go @@ -10,9 +10,9 @@ import ( "github.com/prysmaticlabs/prysm/crypto/bls" "github.com/prysmaticlabs/prysm/crypto/bls/common" "github.com/prysmaticlabs/prysm/encoding/bytesutil" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestAggregateVerify(t *testing.T) { @@ -24,7 +24,7 @@ func testAggregateVerify(t *testing.T) { for i, folder := range testFolders { t.Run(folder.Name(), func(t *testing.T) { - file, err := testutil.BazelFileBytes(path.Join(testFolderPath, folder.Name(), "data.yaml")) + file, err := util.BazelFileBytes(path.Join(testFolderPath, folder.Name(), "data.yaml")) require.NoError(t, err) test := &AggregateVerifyTest{} require.NoError(t, yaml.Unmarshal(file, test)) diff --git a/testing/spectest/general/phase0/bls/fast_aggregate_verify_test.go b/testing/spectest/general/phase0/bls/fast_aggregate_verify_test.go index 3d8bafb04..99450e1f4 100644 --- a/testing/spectest/general/phase0/bls/fast_aggregate_verify_test.go +++ b/testing/spectest/general/phase0/bls/fast_aggregate_verify_test.go @@ -10,9 +10,9 @@ import ( "github.com/prysmaticlabs/prysm/crypto/bls" "github.com/prysmaticlabs/prysm/crypto/bls/common" "github.com/prysmaticlabs/prysm/encoding/bytesutil" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestFastAggregateVerify(t *testing.T) { @@ -24,7 +24,7 @@ func testFastAggregateVerify(t *testing.T) { for i, folder := range testFolders { t.Run(folder.Name(), func(t *testing.T) { - file, err := testutil.BazelFileBytes(path.Join(testFolderPath, folder.Name(), "data.yaml")) + file, err := util.BazelFileBytes(path.Join(testFolderPath, folder.Name(), "data.yaml")) require.NoError(t, err) test := &FastAggregateVerifyTest{} require.NoError(t, yaml.Unmarshal(file, test)) diff --git a/testing/spectest/general/phase0/bls/sign_test.go b/testing/spectest/general/phase0/bls/sign_test.go index 42bc626cc..53096c185 100644 --- a/testing/spectest/general/phase0/bls/sign_test.go +++ b/testing/spectest/general/phase0/bls/sign_test.go @@ -10,9 +10,9 @@ import ( "github.com/ghodss/yaml" "github.com/prysmaticlabs/prysm/crypto/bls" "github.com/prysmaticlabs/prysm/crypto/bls/common" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestSign(t *testing.T) { @@ -24,7 +24,7 @@ func testSign(t *testing.T) { for i, folder := range testFolders { t.Run(folder.Name(), func(t *testing.T) { - file, err := testutil.BazelFileBytes(path.Join(testFolderPath, folder.Name(), "data.yaml")) + file, err := util.BazelFileBytes(path.Join(testFolderPath, folder.Name(), "data.yaml")) require.NoError(t, err) test := &SignMsgTest{} require.NoError(t, yaml.Unmarshal(file, test)) diff --git a/testing/spectest/general/phase0/bls/verify_test.go b/testing/spectest/general/phase0/bls/verify_test.go index 48ee34753..b5be5881a 100644 --- a/testing/spectest/general/phase0/bls/verify_test.go +++ b/testing/spectest/general/phase0/bls/verify_test.go @@ -9,9 +9,9 @@ import ( "github.com/ghodss/yaml" "github.com/prysmaticlabs/prysm/crypto/bls" "github.com/prysmaticlabs/prysm/crypto/bls/common" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" + "github.com/prysmaticlabs/prysm/testing/util" ) func TestVerify(t *testing.T) { @@ -23,7 +23,7 @@ func testVerify(t *testing.T) { for i, folder := range testFolders { t.Run(folder.Name(), func(t *testing.T) { - file, err := testutil.BazelFileBytes(path.Join(testFolderPath, folder.Name(), "data.yaml")) + file, err := util.BazelFileBytes(path.Join(testFolderPath, folder.Name(), "data.yaml")) require.NoError(t, err) test := &VerifyMsgTest{} require.NoError(t, yaml.Unmarshal(file, test)) diff --git a/testing/spectest/shared/altair/epoch_processing/BUILD.bazel b/testing/spectest/shared/altair/epoch_processing/BUILD.bazel index 87891b56c..13394f49b 100644 --- a/testing/spectest/shared/altair/epoch_processing/BUILD.bazel +++ b/testing/spectest/shared/altair/epoch_processing/BUILD.bazel @@ -28,9 +28,9 @@ go_library( "//beacon-chain/state/v2:go_default_library", "//config/params:go_default_library", "//proto/prysm/v1alpha1:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", + "//testing/util:go_default_library", "@com_github_golang_snappy//:go_default_library", "@in_gopkg_d4l3k_messagediff_v1//:go_default_library", "@io_bazel_rules_go//go/tools/bazel:go_default_library", diff --git a/testing/spectest/shared/altair/epoch_processing/effective_balance_updates.go b/testing/spectest/shared/altair/epoch_processing/effective_balance_updates.go index 8719816c2..86eae0b87 100644 --- a/testing/spectest/shared/altair/epoch_processing/effective_balance_updates.go +++ b/testing/spectest/shared/altair/epoch_processing/effective_balance_updates.go @@ -6,7 +6,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core/epoch" "github.com/prysmaticlabs/prysm/beacon-chain/state" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" ) diff --git a/testing/spectest/shared/altair/epoch_processing/eth1_data_reset.go b/testing/spectest/shared/altair/epoch_processing/eth1_data_reset.go index b26b16e04..661e4f7ef 100644 --- a/testing/spectest/shared/altair/epoch_processing/eth1_data_reset.go +++ b/testing/spectest/shared/altair/epoch_processing/eth1_data_reset.go @@ -6,7 +6,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core/epoch" "github.com/prysmaticlabs/prysm/beacon-chain/state" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" ) diff --git a/testing/spectest/shared/altair/epoch_processing/helpers.go b/testing/spectest/shared/altair/epoch_processing/helpers.go index 9302364f6..c1ad9eb74 100644 --- a/testing/spectest/shared/altair/epoch_processing/helpers.go +++ b/testing/spectest/shared/altair/epoch_processing/helpers.go @@ -11,8 +11,8 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/state" stateAltair "github.com/prysmaticlabs/prysm/beacon-chain/state/v2" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/protobuf/proto" "gopkg.in/d4l3k/messagediff.v1" ) @@ -26,7 +26,7 @@ func RunEpochOperationTest( testFolderPath string, operationFn epochOperation, ) { - preBeaconStateFile, err := testutil.BazelFileBytes(path.Join(testFolderPath, "pre.ssz_snappy")) + preBeaconStateFile, err := util.BazelFileBytes(path.Join(testFolderPath, "pre.ssz_snappy")) require.NoError(t, err) preBeaconStateSSZ, err := snappy.Decode(nil /* dst */, preBeaconStateFile) require.NoError(t, err, "Failed to decompress") diff --git a/testing/spectest/shared/altair/epoch_processing/historical_roots_update.go b/testing/spectest/shared/altair/epoch_processing/historical_roots_update.go index 8cea8f93c..894f1f5da 100644 --- a/testing/spectest/shared/altair/epoch_processing/historical_roots_update.go +++ b/testing/spectest/shared/altair/epoch_processing/historical_roots_update.go @@ -6,7 +6,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core/epoch" "github.com/prysmaticlabs/prysm/beacon-chain/state" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" ) diff --git a/testing/spectest/shared/altair/epoch_processing/inactivity_updates.go b/testing/spectest/shared/altair/epoch_processing/inactivity_updates.go index ad8752a32..44d7ad8d6 100644 --- a/testing/spectest/shared/altair/epoch_processing/inactivity_updates.go +++ b/testing/spectest/shared/altair/epoch_processing/inactivity_updates.go @@ -8,7 +8,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core/altair" "github.com/prysmaticlabs/prysm/beacon-chain/core/helpers" "github.com/prysmaticlabs/prysm/beacon-chain/state" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" ) diff --git a/testing/spectest/shared/altair/epoch_processing/justification_and_finalization.go b/testing/spectest/shared/altair/epoch_processing/justification_and_finalization.go index bce2eeb64..1333351f2 100644 --- a/testing/spectest/shared/altair/epoch_processing/justification_and_finalization.go +++ b/testing/spectest/shared/altair/epoch_processing/justification_and_finalization.go @@ -8,7 +8,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core/altair" "github.com/prysmaticlabs/prysm/beacon-chain/core/epoch/precompute" "github.com/prysmaticlabs/prysm/beacon-chain/state" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" ) diff --git a/testing/spectest/shared/altair/epoch_processing/participation_flag_updates.go b/testing/spectest/shared/altair/epoch_processing/participation_flag_updates.go index 6d528b4c8..6332c8889 100644 --- a/testing/spectest/shared/altair/epoch_processing/participation_flag_updates.go +++ b/testing/spectest/shared/altair/epoch_processing/participation_flag_updates.go @@ -6,7 +6,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core/altair" "github.com/prysmaticlabs/prysm/beacon-chain/state" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" ) diff --git a/testing/spectest/shared/altair/epoch_processing/randao_mixes_reset.go b/testing/spectest/shared/altair/epoch_processing/randao_mixes_reset.go index 833767d7c..a7cfb8020 100644 --- a/testing/spectest/shared/altair/epoch_processing/randao_mixes_reset.go +++ b/testing/spectest/shared/altair/epoch_processing/randao_mixes_reset.go @@ -6,7 +6,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core/epoch" "github.com/prysmaticlabs/prysm/beacon-chain/state" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" ) diff --git a/testing/spectest/shared/altair/epoch_processing/registry_updates.go b/testing/spectest/shared/altair/epoch_processing/registry_updates.go index 7b7e9ffbe..fed0549a0 100644 --- a/testing/spectest/shared/altair/epoch_processing/registry_updates.go +++ b/testing/spectest/shared/altair/epoch_processing/registry_updates.go @@ -7,7 +7,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core/epoch" "github.com/prysmaticlabs/prysm/beacon-chain/core/helpers" "github.com/prysmaticlabs/prysm/beacon-chain/state" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" ) diff --git a/testing/spectest/shared/altair/epoch_processing/rewards_and_penalties.go b/testing/spectest/shared/altair/epoch_processing/rewards_and_penalties.go index c0cf2fd50..48a95a0dd 100644 --- a/testing/spectest/shared/altair/epoch_processing/rewards_and_penalties.go +++ b/testing/spectest/shared/altair/epoch_processing/rewards_and_penalties.go @@ -8,7 +8,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core/altair" "github.com/prysmaticlabs/prysm/beacon-chain/core/helpers" "github.com/prysmaticlabs/prysm/beacon-chain/state" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" ) diff --git a/testing/spectest/shared/altair/epoch_processing/slashings.go b/testing/spectest/shared/altair/epoch_processing/slashings.go index 32850f175..617eca09b 100644 --- a/testing/spectest/shared/altair/epoch_processing/slashings.go +++ b/testing/spectest/shared/altair/epoch_processing/slashings.go @@ -8,7 +8,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core/helpers" "github.com/prysmaticlabs/prysm/beacon-chain/state" "github.com/prysmaticlabs/prysm/config/params" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" ) diff --git a/testing/spectest/shared/altair/epoch_processing/slashings_reset.go b/testing/spectest/shared/altair/epoch_processing/slashings_reset.go index 305330ae0..459925f3d 100644 --- a/testing/spectest/shared/altair/epoch_processing/slashings_reset.go +++ b/testing/spectest/shared/altair/epoch_processing/slashings_reset.go @@ -6,7 +6,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core/epoch" "github.com/prysmaticlabs/prysm/beacon-chain/state" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" ) diff --git a/testing/spectest/shared/altair/finality/BUILD.bazel b/testing/spectest/shared/altair/finality/BUILD.bazel index 949c7c54e..07a6795ce 100644 --- a/testing/spectest/shared/altair/finality/BUILD.bazel +++ b/testing/spectest/shared/altair/finality/BUILD.bazel @@ -13,9 +13,9 @@ go_library( "//beacon-chain/state/v2:go_default_library", "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/wrapper:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", + "//testing/util:go_default_library", "@com_github_golang_snappy//:go_default_library", "@org_golang_google_protobuf//proto:go_default_library", ], diff --git a/testing/spectest/shared/altair/finality/finality.go b/testing/spectest/shared/altair/finality/finality.go index 71b421a7a..baf4a63d4 100644 --- a/testing/spectest/shared/altair/finality/finality.go +++ b/testing/spectest/shared/altair/finality/finality.go @@ -12,9 +12,9 @@ import ( stateAltair "github.com/prysmaticlabs/prysm/beacon-chain/state/v2" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/protobuf/proto" ) @@ -34,7 +34,7 @@ func RunFinalityTest(t *testing.T, config string) { for _, folder := range testFolders { t.Run(folder.Name(), func(t *testing.T) { helpers.ClearCache() - preBeaconStateFile, err := testutil.BazelFileBytes(testsFolderPath, folder.Name(), "pre.ssz_snappy") + preBeaconStateFile, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "pre.ssz_snappy") require.NoError(t, err) preBeaconStateSSZ, err := snappy.Decode(nil /* dst */, preBeaconStateFile) require.NoError(t, err, "Failed to decompress") @@ -43,7 +43,7 @@ func RunFinalityTest(t *testing.T, config string) { beaconState, err := stateAltair.InitializeFromProto(beaconStateBase) require.NoError(t, err) - file, err := testutil.BazelFileBytes(testsFolderPath, folder.Name(), "meta.yaml") + file, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "meta.yaml") require.NoError(t, err) metaYaml := &Config{} @@ -53,7 +53,7 @@ func RunFinalityTest(t *testing.T, config string) { var ok bool for i := 0; i < metaYaml.BlocksCount; i++ { filename := fmt.Sprintf("blocks_%d.ssz_snappy", i) - blockFile, err := testutil.BazelFileBytes(testsFolderPath, folder.Name(), filename) + blockFile, err := util.BazelFileBytes(testsFolderPath, folder.Name(), filename) require.NoError(t, err) blockSSZ, err := snappy.Decode(nil /* dst */, blockFile) require.NoError(t, err, "Failed to decompress") @@ -67,7 +67,7 @@ func RunFinalityTest(t *testing.T, config string) { require.Equal(t, true, ok) } - postBeaconStateFile, err := testutil.BazelFileBytes(testsFolderPath, folder.Name(), "post.ssz_snappy") + postBeaconStateFile, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "post.ssz_snappy") require.NoError(t, err) postBeaconStateSSZ, err := snappy.Decode(nil /* dst */, postBeaconStateFile) require.NoError(t, err, "Failed to decompress") diff --git a/testing/spectest/shared/altair/fork/BUILD.bazel b/testing/spectest/shared/altair/fork/BUILD.bazel index c7c773e4f..7f6d94e58 100644 --- a/testing/spectest/shared/altair/fork/BUILD.bazel +++ b/testing/spectest/shared/altair/fork/BUILD.bazel @@ -19,9 +19,9 @@ go_library( "//config/params:go_default_library", "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/wrapper:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", + "//testing/util:go_default_library", "@com_github_golang_snappy//:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", "@org_golang_google_protobuf//proto:go_default_library", diff --git a/testing/spectest/shared/altair/fork/transition.go b/testing/spectest/shared/altair/fork/transition.go index 215a7a2b2..cb9b8f5d4 100644 --- a/testing/spectest/shared/altair/fork/transition.go +++ b/testing/spectest/shared/altair/fork/transition.go @@ -16,9 +16,9 @@ import ( ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" wrapperv1 "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" + "github.com/prysmaticlabs/prysm/testing/util" ) type ForkConfig struct { @@ -36,7 +36,7 @@ func RunForkTransitionTest(t *testing.T, config string) { for _, folder := range testFolders { t.Run(folder.Name(), func(t *testing.T) { helpers.ClearCache() - file, err := testutil.BazelFileBytes(testsFolderPath, folder.Name(), "meta.yaml") + file, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "meta.yaml") require.NoError(t, err) config := &ForkConfig{} require.NoError(t, utils.UnmarshalYaml(file, config), "Failed to Unmarshal") @@ -47,7 +47,7 @@ func RunForkTransitionTest(t *testing.T, config string) { if config.ForkBlock == 0 { for i := 0; i < config.BlocksCount; i++ { fileName := fmt.Sprint("blocks_", i, ".ssz_snappy") - blockFile, err := testutil.BazelFileBytes(testsFolderPath, folder.Name(), fileName) + blockFile, err := util.BazelFileBytes(testsFolderPath, folder.Name(), fileName) require.NoError(t, err) blockSSZ, err := snappy.Decode(nil /* dst */, blockFile) require.NoError(t, err, "Failed to decompress") @@ -59,7 +59,7 @@ func RunForkTransitionTest(t *testing.T, config string) { } else { for i := 0; i <= config.ForkBlock; i++ { fileName := fmt.Sprint("blocks_", i, ".ssz_snappy") - blockFile, err := testutil.BazelFileBytes(testsFolderPath, folder.Name(), fileName) + blockFile, err := util.BazelFileBytes(testsFolderPath, folder.Name(), fileName) require.NoError(t, err) blockSSZ, err := snappy.Decode(nil /* dst */, blockFile) require.NoError(t, err, "Failed to decompress") @@ -69,7 +69,7 @@ func RunForkTransitionTest(t *testing.T, config string) { } for i := config.ForkBlock + 1; i < config.BlocksCount; i++ { fileName := fmt.Sprint("blocks_", i, ".ssz_snappy") - blockFile, err := testutil.BazelFileBytes(testsFolderPath, folder.Name(), fileName) + blockFile, err := util.BazelFileBytes(testsFolderPath, folder.Name(), fileName) require.NoError(t, err) blockSSZ, err := snappy.Decode(nil /* dst */, blockFile) require.NoError(t, err, "Failed to decompress") @@ -79,7 +79,7 @@ func RunForkTransitionTest(t *testing.T, config string) { } } - preBeaconStateFile, err := testutil.BazelFileBytes(testsFolderPath, folder.Name(), "pre.ssz_snappy") + preBeaconStateFile, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "pre.ssz_snappy") require.NoError(t, err) preBeaconStateSSZ, err := snappy.Decode(nil /* dst */, preBeaconStateFile) require.NoError(t, err, "Failed to decompress") @@ -110,7 +110,7 @@ func RunForkTransitionTest(t *testing.T, config string) { require.Equal(t, true, ok) } - postBeaconStateFile, err := testutil.BazelFileBytes(testsFolderPath, folder.Name(), "post.ssz_snappy") + postBeaconStateFile, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "post.ssz_snappy") require.NoError(t, err) postBeaconStateSSZ, err := snappy.Decode(nil /* dst */, postBeaconStateFile) require.NoError(t, err, "Failed to decompress") diff --git a/testing/spectest/shared/altair/fork/upgrade_to_altair.go b/testing/spectest/shared/altair/fork/upgrade_to_altair.go index c3aebb667..31c5e5d7f 100644 --- a/testing/spectest/shared/altair/fork/upgrade_to_altair.go +++ b/testing/spectest/shared/altair/fork/upgrade_to_altair.go @@ -11,9 +11,9 @@ import ( v1 "github.com/prysmaticlabs/prysm/beacon-chain/state/v1" statealtair "github.com/prysmaticlabs/prysm/beacon-chain/state/v2" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/protobuf/proto" ) @@ -28,7 +28,7 @@ func RunUpgradeToAltair(t *testing.T, config string) { helpers.ClearCache() folderPath := path.Join(testsFolderPath, folder.Name()) - preStateFile, err := testutil.BazelFileBytes(path.Join(folderPath, "pre.ssz_snappy")) + preStateFile, err := util.BazelFileBytes(path.Join(folderPath, "pre.ssz_snappy")) require.NoError(t, err) preStateSSZ, err := snappy.Decode(nil /* dst */, preStateFile) require.NoError(t, err, "Failed to decompress") @@ -43,7 +43,7 @@ func RunUpgradeToAltair(t *testing.T, config string) { postStateFromFunction, err := statealtair.ProtobufBeaconState(postState.InnerStateUnsafe()) require.NoError(t, err) - postStateFile, err := testutil.BazelFileBytes(path.Join(folderPath, "post.ssz_snappy")) + postStateFile, err := util.BazelFileBytes(path.Join(folderPath, "post.ssz_snappy")) require.NoError(t, err) postStateSSZ, err := snappy.Decode(nil /* dst */, postStateFile) require.NoError(t, err, "Failed to decompress") diff --git a/testing/spectest/shared/altair/operations/BUILD.bazel b/testing/spectest/shared/altair/operations/BUILD.bazel index 3e088d94c..baa7f1f91 100644 --- a/testing/spectest/shared/altair/operations/BUILD.bazel +++ b/testing/spectest/shared/altair/operations/BUILD.bazel @@ -25,9 +25,9 @@ go_library( "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/block:go_default_library", "//proto/prysm/v1alpha1/wrapper:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", + "//testing/util:go_default_library", "@com_github_golang_snappy//:go_default_library", "@in_gopkg_d4l3k_messagediff_v1//:go_default_library", "@io_bazel_rules_go//go/tools/bazel:go_default_library", diff --git a/testing/spectest/shared/altair/operations/attestation.go b/testing/spectest/shared/altair/operations/attestation.go index 1cad0a787..46492cb9a 100644 --- a/testing/spectest/shared/altair/operations/attestation.go +++ b/testing/spectest/shared/altair/operations/attestation.go @@ -12,9 +12,9 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/state" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" + "github.com/prysmaticlabs/prysm/testing/util" ) func RunAttestationTest(t *testing.T, config string) { @@ -23,7 +23,7 @@ func RunAttestationTest(t *testing.T, config string) { for _, folder := range testFolders { t.Run(folder.Name(), func(t *testing.T) { folderPath := path.Join(testsFolderPath, folder.Name()) - attestationFile, err := testutil.BazelFileBytes(folderPath, "attestation.ssz_snappy") + attestationFile, err := util.BazelFileBytes(folderPath, "attestation.ssz_snappy") require.NoError(t, err) attestationSSZ, err := snappy.Decode(nil /* dst */, attestationFile) require.NoError(t, err, "Failed to decompress") diff --git a/testing/spectest/shared/altair/operations/attester_slashing.go b/testing/spectest/shared/altair/operations/attester_slashing.go index 8d9691b08..489e78df3 100644 --- a/testing/spectest/shared/altair/operations/attester_slashing.go +++ b/testing/spectest/shared/altair/operations/attester_slashing.go @@ -11,9 +11,9 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/state" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" + "github.com/prysmaticlabs/prysm/testing/util" ) func RunAttesterSlashingTest(t *testing.T, config string) { @@ -22,7 +22,7 @@ func RunAttesterSlashingTest(t *testing.T, config string) { for _, folder := range testFolders { t.Run(folder.Name(), func(t *testing.T) { folderPath := path.Join(testsFolderPath, folder.Name()) - attSlashingFile, err := testutil.BazelFileBytes(folderPath, "attester_slashing.ssz_snappy") + attSlashingFile, err := util.BazelFileBytes(folderPath, "attester_slashing.ssz_snappy") require.NoError(t, err) attSlashingSSZ, err := snappy.Decode(nil /* dst */, attSlashingFile) require.NoError(t, err, "Failed to decompress") diff --git a/testing/spectest/shared/altair/operations/block_header.go b/testing/spectest/shared/altair/operations/block_header.go index e86b325a3..0f006aa90 100644 --- a/testing/spectest/shared/altair/operations/block_header.go +++ b/testing/spectest/shared/altair/operations/block_header.go @@ -11,9 +11,9 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core/blocks" stateAltair "github.com/prysmaticlabs/prysm/beacon-chain/state/v2" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/protobuf/proto" "gopkg.in/d4l3k/messagediff.v1" ) @@ -23,14 +23,14 @@ func RunBlockHeaderTest(t *testing.T, config string) { testFolders, testsFolderPath := utils.TestFolders(t, config, "altair", "operations/block_header/pyspec_tests") for _, folder := range testFolders { t.Run(folder.Name(), func(t *testing.T) { - blockFile, err := testutil.BazelFileBytes(testsFolderPath, folder.Name(), "block.ssz_snappy") + blockFile, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "block.ssz_snappy") require.NoError(t, err) blockSSZ, err := snappy.Decode(nil /* dst */, blockFile) require.NoError(t, err, "Failed to decompress") block := ðpb.BeaconBlockAltair{} require.NoError(t, block.UnmarshalSSZ(blockSSZ), "Failed to unmarshal") - preBeaconStateFile, err := testutil.BazelFileBytes(testsFolderPath, folder.Name(), "pre.ssz_snappy") + preBeaconStateFile, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "pre.ssz_snappy") require.NoError(t, err) preBeaconStateSSZ, err := snappy.Decode(nil /* dst */, preBeaconStateFile) require.NoError(t, err, "Failed to decompress") diff --git a/testing/spectest/shared/altair/operations/deposit.go b/testing/spectest/shared/altair/operations/deposit.go index 0dea08cc7..143a9c2ae 100644 --- a/testing/spectest/shared/altair/operations/deposit.go +++ b/testing/spectest/shared/altair/operations/deposit.go @@ -10,9 +10,9 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/state" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" + "github.com/prysmaticlabs/prysm/testing/util" ) func RunDepositTest(t *testing.T, config string) { @@ -21,7 +21,7 @@ func RunDepositTest(t *testing.T, config string) { for _, folder := range testFolders { t.Run(folder.Name(), func(t *testing.T) { folderPath := path.Join(testsFolderPath, folder.Name()) - depositFile, err := testutil.BazelFileBytes(folderPath, "deposit.ssz_snappy") + depositFile, err := util.BazelFileBytes(folderPath, "deposit.ssz_snappy") require.NoError(t, err) depositSSZ, err := snappy.Decode(nil /* dst */, depositFile) require.NoError(t, err, "Failed to decompress") diff --git a/testing/spectest/shared/altair/operations/helpers.go b/testing/spectest/shared/altair/operations/helpers.go index 2c701bc57..12313ea01 100644 --- a/testing/spectest/shared/altair/operations/helpers.go +++ b/testing/spectest/shared/altair/operations/helpers.go @@ -15,8 +15,8 @@ import ( ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/protobuf/proto" "gopkg.in/d4l3k/messagediff.v1" ) @@ -31,7 +31,7 @@ func RunBlockOperationTest( body *ethpb.BeaconBlockBodyAltair, operationFn blockOperation, ) { - preBeaconStateFile, err := testutil.BazelFileBytes(path.Join(folderPath, "pre.ssz_snappy")) + preBeaconStateFile, err := util.BazelFileBytes(path.Join(folderPath, "pre.ssz_snappy")) require.NoError(t, err) preBeaconStateSSZ, err := snappy.Decode(nil /* dst */, preBeaconStateFile) require.NoError(t, err, "Failed to decompress") @@ -52,7 +52,7 @@ func RunBlockOperationTest( } helpers.ClearCache() - b := testutil.NewBeaconBlockAltair() + b := util.NewBeaconBlockAltair() b.Block.Body = body wsb, err := wrapper.WrappedAltairSignedBeaconBlock(b) require.NoError(t, err) diff --git a/testing/spectest/shared/altair/operations/proposer_slashing.go b/testing/spectest/shared/altair/operations/proposer_slashing.go index a9820855d..14abcb876 100644 --- a/testing/spectest/shared/altair/operations/proposer_slashing.go +++ b/testing/spectest/shared/altair/operations/proposer_slashing.go @@ -11,9 +11,9 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/state" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" + "github.com/prysmaticlabs/prysm/testing/util" ) func RunProposerSlashingTest(t *testing.T, config string) { @@ -22,7 +22,7 @@ func RunProposerSlashingTest(t *testing.T, config string) { for _, folder := range testFolders { t.Run(folder.Name(), func(t *testing.T) { folderPath := path.Join(testsFolderPath, folder.Name()) - proposerSlashingFile, err := testutil.BazelFileBytes(folderPath, "proposer_slashing.ssz_snappy") + proposerSlashingFile, err := util.BazelFileBytes(folderPath, "proposer_slashing.ssz_snappy") require.NoError(t, err) proposerSlashingSSZ, err := snappy.Decode(nil /* dst */, proposerSlashingFile) require.NoError(t, err, "Failed to decompress") diff --git a/testing/spectest/shared/altair/operations/sync_committee.go b/testing/spectest/shared/altair/operations/sync_committee.go index e1207c4a1..730f50b17 100644 --- a/testing/spectest/shared/altair/operations/sync_committee.go +++ b/testing/spectest/shared/altair/operations/sync_committee.go @@ -10,9 +10,9 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/state" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" + "github.com/prysmaticlabs/prysm/testing/util" ) func RunSyncCommitteeTest(t *testing.T, config string) { @@ -21,7 +21,7 @@ func RunSyncCommitteeTest(t *testing.T, config string) { for _, folder := range testFolders { t.Run(folder.Name(), func(t *testing.T) { folderPath := path.Join(testsFolderPath, folder.Name()) - syncCommitteeFile, err := testutil.BazelFileBytes(folderPath, "sync_aggregate.ssz_snappy") + syncCommitteeFile, err := util.BazelFileBytes(folderPath, "sync_aggregate.ssz_snappy") require.NoError(t, err) syncCommitteeSSZ, err := snappy.Decode(nil /* dst */, syncCommitteeFile) require.NoError(t, err, "Failed to decompress") diff --git a/testing/spectest/shared/altair/operations/voluntary_exit.go b/testing/spectest/shared/altair/operations/voluntary_exit.go index ca03bb788..6ec080fc3 100644 --- a/testing/spectest/shared/altair/operations/voluntary_exit.go +++ b/testing/spectest/shared/altair/operations/voluntary_exit.go @@ -10,9 +10,9 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/state" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" + "github.com/prysmaticlabs/prysm/testing/util" ) func RunVoluntaryExitTest(t *testing.T, config string) { @@ -21,7 +21,7 @@ func RunVoluntaryExitTest(t *testing.T, config string) { for _, folder := range testFolders { t.Run(folder.Name(), func(t *testing.T) { folderPath := path.Join(testsFolderPath, folder.Name()) - exitFile, err := testutil.BazelFileBytes(folderPath, "voluntary_exit.ssz_snappy") + exitFile, err := util.BazelFileBytes(folderPath, "voluntary_exit.ssz_snappy") require.NoError(t, err) exitSSZ, err := snappy.Decode(nil /* dst */, exitFile) require.NoError(t, err, "Failed to decompress") diff --git a/testing/spectest/shared/altair/rewards/BUILD.bazel b/testing/spectest/shared/altair/rewards/BUILD.bazel index 387b44308..4def4684b 100644 --- a/testing/spectest/shared/altair/rewards/BUILD.bazel +++ b/testing/spectest/shared/altair/rewards/BUILD.bazel @@ -11,9 +11,9 @@ go_library( "//beacon-chain/core/helpers:go_default_library", "//beacon-chain/state/v2:go_default_library", "//proto/prysm/v1alpha1:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", + "//testing/util:go_default_library", "@com_github_golang_snappy//:go_default_library", ], ) diff --git a/testing/spectest/shared/altair/rewards/rewards_penalties.go b/testing/spectest/shared/altair/rewards/rewards_penalties.go index 07233fe1c..678b3badb 100644 --- a/testing/spectest/shared/altair/rewards/rewards_penalties.go +++ b/testing/spectest/shared/altair/rewards/rewards_penalties.go @@ -14,9 +14,9 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core/helpers" stateAltair "github.com/prysmaticlabs/prysm/beacon-chain/state/v2" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" + "github.com/prysmaticlabs/prysm/testing/util" ) // Delta contains list of rewards and penalties. @@ -42,7 +42,7 @@ func RunPrecomputeRewardsAndPenaltiesTests(t *testing.T, config string) { require.NoError(t, utils.SetConfig(t, config)) _, testsFolderPath := utils.TestFolders(t, config, "altair", "rewards") - testTypes, err := testutil.BazelListDirectories(testsFolderPath) + testTypes, err := util.BazelListDirectories(testsFolderPath) require.NoError(t, err) for _, testType := range testTypes { @@ -59,7 +59,7 @@ func RunPrecomputeRewardsAndPenaltiesTests(t *testing.T, config string) { func runPrecomputeRewardsAndPenaltiesTest(t *testing.T, testFolderPath string) { ctx := context.Background() - preBeaconStateFile, err := testutil.BazelFileBytes(path.Join(testFolderPath, "pre.ssz_snappy")) + preBeaconStateFile, err := util.BazelFileBytes(path.Join(testFolderPath, "pre.ssz_snappy")) require.NoError(t, err) preBeaconStateSSZ, err := snappy.Decode(nil /* dst */, preBeaconStateFile) require.NoError(t, err, "Failed to decompress") @@ -79,7 +79,7 @@ func runPrecomputeRewardsAndPenaltiesTest(t *testing.T, testFolderPath string) { totalSpecTestPenalties := make([]uint64, len(penalties)) // Fetch delta files. i.e. source_deltas.ssz_snappy, etc. - testfiles, err := testutil.BazelListFiles(path.Join(testFolderPath)) + testfiles, err := util.BazelListFiles(path.Join(testFolderPath)) require.NoError(t, err) deltaFiles := make([]string, 0, len(testfiles)) for _, tf := range testfiles { @@ -92,7 +92,7 @@ func runPrecomputeRewardsAndPenaltiesTest(t *testing.T, testFolderPath string) { } for _, dFile := range deltaFiles { - sourceFile, err := testutil.BazelFileBytes(path.Join(testFolderPath, dFile)) + sourceFile, err := util.BazelFileBytes(path.Join(testFolderPath, dFile)) require.NoError(t, err) sourceSSZ, err := snappy.Decode(nil /* dst */, sourceFile) require.NoError(t, err, "Failed to decompress") diff --git a/testing/spectest/shared/altair/sanity/BUILD.bazel b/testing/spectest/shared/altair/sanity/BUILD.bazel index 523a0d975..8f569ba16 100644 --- a/testing/spectest/shared/altair/sanity/BUILD.bazel +++ b/testing/spectest/shared/altair/sanity/BUILD.bazel @@ -17,9 +17,9 @@ go_library( "//beacon-chain/state/v2:go_default_library", "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/wrapper:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", + "//testing/util:go_default_library", "@com_github_d4l3k_messagediff//:go_default_library", "@com_github_golang_snappy//:go_default_library", "@in_gopkg_d4l3k_messagediff_v1//:go_default_library", diff --git a/testing/spectest/shared/altair/sanity/block_processing.go b/testing/spectest/shared/altair/sanity/block_processing.go index 4d58c47d2..c6be94244 100644 --- a/testing/spectest/shared/altair/sanity/block_processing.go +++ b/testing/spectest/shared/altair/sanity/block_processing.go @@ -17,9 +17,9 @@ import ( stateAltair "github.com/prysmaticlabs/prysm/beacon-chain/state/v2" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/protobuf/proto" ) @@ -35,7 +35,7 @@ func RunBlockProcessingTest(t *testing.T, config, folderPath string) { for _, folder := range testFolders { t.Run(folder.Name(), func(t *testing.T) { helpers.ClearCache() - preBeaconStateFile, err := testutil.BazelFileBytes(testsFolderPath, folder.Name(), "pre.ssz_snappy") + preBeaconStateFile, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "pre.ssz_snappy") require.NoError(t, err) preBeaconStateSSZ, err := snappy.Decode(nil /* dst */, preBeaconStateFile) require.NoError(t, err, "Failed to decompress") @@ -44,7 +44,7 @@ func RunBlockProcessingTest(t *testing.T, config, folderPath string) { beaconState, err := stateAltair.InitializeFromProto(beaconStateBase) require.NoError(t, err) - file, err := testutil.BazelFileBytes(testsFolderPath, folder.Name(), "meta.yaml") + file, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "meta.yaml") require.NoError(t, err) metaYaml := &SanityConfig{} @@ -55,7 +55,7 @@ func RunBlockProcessingTest(t *testing.T, config, folderPath string) { var ok bool for i := 0; i < metaYaml.BlocksCount; i++ { filename := fmt.Sprintf("blocks_%d.ssz_snappy", i) - blockFile, err := testutil.BazelFileBytes(testsFolderPath, folder.Name(), filename) + blockFile, err := util.BazelFileBytes(testsFolderPath, folder.Name(), filename) require.NoError(t, err) blockSSZ, err := snappy.Decode(nil /* dst */, blockFile) require.NoError(t, err, "Failed to decompress") diff --git a/testing/spectest/shared/altair/sanity/slot_processing.go b/testing/spectest/shared/altair/sanity/slot_processing.go index 03a3dfd07..74103eeba 100644 --- a/testing/spectest/shared/altair/sanity/slot_processing.go +++ b/testing/spectest/shared/altair/sanity/slot_processing.go @@ -9,9 +9,9 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core/transition" stateAltair "github.com/prysmaticlabs/prysm/beacon-chain/state/v2" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/protobuf/proto" "gopkg.in/d4l3k/messagediff.v1" ) @@ -28,7 +28,7 @@ func RunSlotProcessingTests(t *testing.T, config string) { for _, folder := range testFolders { t.Run(folder.Name(), func(t *testing.T) { - preBeaconStateFile, err := testutil.BazelFileBytes(testsFolderPath, folder.Name(), "pre.ssz_snappy") + preBeaconStateFile, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "pre.ssz_snappy") require.NoError(t, err) preBeaconStateSSZ, err := snappy.Decode(nil /* dst */, preBeaconStateFile) require.NoError(t, err, "Failed to decompress") @@ -37,13 +37,13 @@ func RunSlotProcessingTests(t *testing.T, config string) { beaconState, err := stateAltair.InitializeFromProto(base) require.NoError(t, err) - file, err := testutil.BazelFileBytes(testsFolderPath, folder.Name(), "slots.yaml") + file, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "slots.yaml") require.NoError(t, err) fileStr := string(file) slotsCount, err := strconv.Atoi(fileStr[:len(fileStr)-5]) require.NoError(t, err) - postBeaconStateFile, err := testutil.BazelFileBytes(testsFolderPath, folder.Name(), "post.ssz_snappy") + postBeaconStateFile, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "post.ssz_snappy") require.NoError(t, err) postBeaconStateSSZ, err := snappy.Decode(nil /* dst */, postBeaconStateFile) require.NoError(t, err, "Failed to decompress") diff --git a/testing/spectest/shared/altair/ssz_static/BUILD.bazel b/testing/spectest/shared/altair/ssz_static/BUILD.bazel index e88f58325..a20fa4b54 100644 --- a/testing/spectest/shared/altair/ssz_static/BUILD.bazel +++ b/testing/spectest/shared/altair/ssz_static/BUILD.bazel @@ -9,9 +9,9 @@ go_library( deps = [ "//beacon-chain/state/v2:go_default_library", "//proto/prysm/v1alpha1:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", + "//testing/util:go_default_library", "@com_github_ferranbt_fastssz//:go_default_library", "@com_github_golang_snappy//:go_default_library", ], diff --git a/testing/spectest/shared/altair/ssz_static/ssz_static.go b/testing/spectest/shared/altair/ssz_static/ssz_static.go index e7feb1d5a..3201d3cf0 100644 --- a/testing/spectest/shared/altair/ssz_static/ssz_static.go +++ b/testing/spectest/shared/altair/ssz_static/ssz_static.go @@ -11,9 +11,9 @@ import ( "github.com/golang/snappy" stateAltair "github.com/prysmaticlabs/prysm/beacon-chain/state/v2" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" + "github.com/prysmaticlabs/prysm/testing/util" ) // SSZRoots -- @@ -33,14 +33,14 @@ func RunSSZStaticTests(t *testing.T, config string) { for _, innerFolder := range innerTestFolders { t.Run(path.Join(folder.Name(), innerFolder.Name()), func(t *testing.T) { - serializedBytes, err := testutil.BazelFileBytes(innerTestsFolderPath, innerFolder.Name(), "serialized.ssz_snappy") + serializedBytes, err := util.BazelFileBytes(innerTestsFolderPath, innerFolder.Name(), "serialized.ssz_snappy") require.NoError(t, err) serializedSSZ, err := snappy.Decode(nil /* dst */, serializedBytes) require.NoError(t, err, "Failed to decompress") object, err := UnmarshalledSSZ(t, serializedSSZ, folder.Name()) require.NoError(t, err, "Could not unmarshall serialized SSZ") - rootsYamlFile, err := testutil.BazelFileBytes(innerTestsFolderPath, innerFolder.Name(), "roots.yaml") + rootsYamlFile, err := util.BazelFileBytes(innerTestsFolderPath, innerFolder.Name(), "roots.yaml") require.NoError(t, err) rootsYaml := &SSZRoots{} require.NoError(t, utils.UnmarshalYaml(rootsYamlFile, rootsYaml), "Failed to Unmarshal") diff --git a/testing/spectest/shared/phase0/epoch_processing/BUILD.bazel b/testing/spectest/shared/phase0/epoch_processing/BUILD.bazel index bc83506cd..6569928e5 100644 --- a/testing/spectest/shared/phase0/epoch_processing/BUILD.bazel +++ b/testing/spectest/shared/phase0/epoch_processing/BUILD.bazel @@ -26,9 +26,9 @@ go_library( "//beacon-chain/state/v1:go_default_library", "//config/params:go_default_library", "//proto/prysm/v1alpha1:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", + "//testing/util:go_default_library", "@com_github_golang_snappy//:go_default_library", "@io_bazel_rules_go//go/tools/bazel:go_default_library", "@org_golang_google_protobuf//proto:go_default_library", diff --git a/testing/spectest/shared/phase0/epoch_processing/effective_balance_updates.go b/testing/spectest/shared/phase0/epoch_processing/effective_balance_updates.go index 78154bdc7..bfbc8c1ea 100644 --- a/testing/spectest/shared/phase0/epoch_processing/effective_balance_updates.go +++ b/testing/spectest/shared/phase0/epoch_processing/effective_balance_updates.go @@ -6,7 +6,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core/epoch" "github.com/prysmaticlabs/prysm/beacon-chain/state" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" ) diff --git a/testing/spectest/shared/phase0/epoch_processing/eth1_data_reset.go b/testing/spectest/shared/phase0/epoch_processing/eth1_data_reset.go index dee3807fd..a65f5c8e4 100644 --- a/testing/spectest/shared/phase0/epoch_processing/eth1_data_reset.go +++ b/testing/spectest/shared/phase0/epoch_processing/eth1_data_reset.go @@ -6,7 +6,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core/epoch" "github.com/prysmaticlabs/prysm/beacon-chain/state" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" ) diff --git a/testing/spectest/shared/phase0/epoch_processing/helpers.go b/testing/spectest/shared/phase0/epoch_processing/helpers.go index 20918f0c1..408dd48c1 100644 --- a/testing/spectest/shared/phase0/epoch_processing/helpers.go +++ b/testing/spectest/shared/phase0/epoch_processing/helpers.go @@ -11,8 +11,8 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/state" v1 "github.com/prysmaticlabs/prysm/beacon-chain/state/v1" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/protobuf/proto" ) @@ -25,7 +25,7 @@ func RunEpochOperationTest( testFolderPath string, operationFn epochOperation, ) { - preBeaconStateFile, err := testutil.BazelFileBytes(path.Join(testFolderPath, "pre.ssz_snappy")) + preBeaconStateFile, err := util.BazelFileBytes(path.Join(testFolderPath, "pre.ssz_snappy")) require.NoError(t, err) preBeaconStateSSZ, err := snappy.Decode(nil /* dst */, preBeaconStateFile) require.NoError(t, err, "Failed to decompress") diff --git a/testing/spectest/shared/phase0/epoch_processing/historical_roots_update.go b/testing/spectest/shared/phase0/epoch_processing/historical_roots_update.go index d6130a093..54ee7862f 100644 --- a/testing/spectest/shared/phase0/epoch_processing/historical_roots_update.go +++ b/testing/spectest/shared/phase0/epoch_processing/historical_roots_update.go @@ -6,7 +6,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core/epoch" "github.com/prysmaticlabs/prysm/beacon-chain/state" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" ) diff --git a/testing/spectest/shared/phase0/epoch_processing/justification_and_finalization.go b/testing/spectest/shared/phase0/epoch_processing/justification_and_finalization.go index 347d001d0..a50ef87a9 100644 --- a/testing/spectest/shared/phase0/epoch_processing/justification_and_finalization.go +++ b/testing/spectest/shared/phase0/epoch_processing/justification_and_finalization.go @@ -7,7 +7,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core/epoch/precompute" "github.com/prysmaticlabs/prysm/beacon-chain/state" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" ) diff --git a/testing/spectest/shared/phase0/epoch_processing/participation_record_updates.go b/testing/spectest/shared/phase0/epoch_processing/participation_record_updates.go index 0c4d8a3f0..77c897190 100644 --- a/testing/spectest/shared/phase0/epoch_processing/participation_record_updates.go +++ b/testing/spectest/shared/phase0/epoch_processing/participation_record_updates.go @@ -6,7 +6,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core/epoch" "github.com/prysmaticlabs/prysm/beacon-chain/state" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" ) diff --git a/testing/spectest/shared/phase0/epoch_processing/randao_mixes_reset.go b/testing/spectest/shared/phase0/epoch_processing/randao_mixes_reset.go index 1c82f83c4..1201f29ac 100644 --- a/testing/spectest/shared/phase0/epoch_processing/randao_mixes_reset.go +++ b/testing/spectest/shared/phase0/epoch_processing/randao_mixes_reset.go @@ -6,7 +6,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core/epoch" "github.com/prysmaticlabs/prysm/beacon-chain/state" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" ) diff --git a/testing/spectest/shared/phase0/epoch_processing/registry_updates.go b/testing/spectest/shared/phase0/epoch_processing/registry_updates.go index c00c5e60b..2f6771ee9 100644 --- a/testing/spectest/shared/phase0/epoch_processing/registry_updates.go +++ b/testing/spectest/shared/phase0/epoch_processing/registry_updates.go @@ -7,7 +7,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core/epoch" "github.com/prysmaticlabs/prysm/beacon-chain/core/helpers" "github.com/prysmaticlabs/prysm/beacon-chain/state" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" ) diff --git a/testing/spectest/shared/phase0/epoch_processing/rewards_and_penalties.go b/testing/spectest/shared/phase0/epoch_processing/rewards_and_penalties.go index dcb5b49be..c07779b5b 100644 --- a/testing/spectest/shared/phase0/epoch_processing/rewards_and_penalties.go +++ b/testing/spectest/shared/phase0/epoch_processing/rewards_and_penalties.go @@ -8,7 +8,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core/epoch/precompute" "github.com/prysmaticlabs/prysm/beacon-chain/core/helpers" "github.com/prysmaticlabs/prysm/beacon-chain/state" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" ) diff --git a/testing/spectest/shared/phase0/epoch_processing/slashings.go b/testing/spectest/shared/phase0/epoch_processing/slashings.go index 56a08fcda..3155d87a5 100644 --- a/testing/spectest/shared/phase0/epoch_processing/slashings.go +++ b/testing/spectest/shared/phase0/epoch_processing/slashings.go @@ -10,7 +10,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core/helpers" "github.com/prysmaticlabs/prysm/beacon-chain/state" "github.com/prysmaticlabs/prysm/config/params" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" ) diff --git a/testing/spectest/shared/phase0/epoch_processing/slashings_reset.go b/testing/spectest/shared/phase0/epoch_processing/slashings_reset.go index 43a21c59d..6d67bacd4 100644 --- a/testing/spectest/shared/phase0/epoch_processing/slashings_reset.go +++ b/testing/spectest/shared/phase0/epoch_processing/slashings_reset.go @@ -6,7 +6,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core/epoch" "github.com/prysmaticlabs/prysm/beacon-chain/state" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" ) diff --git a/testing/spectest/shared/phase0/finality/BUILD.bazel b/testing/spectest/shared/phase0/finality/BUILD.bazel index bca9fd013..61201d8b9 100644 --- a/testing/spectest/shared/phase0/finality/BUILD.bazel +++ b/testing/spectest/shared/phase0/finality/BUILD.bazel @@ -13,9 +13,9 @@ go_library( "//beacon-chain/state/v1:go_default_library", "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/wrapper:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", + "//testing/util:go_default_library", "@com_github_golang_snappy//:go_default_library", "@in_gopkg_d4l3k_messagediff_v1//:go_default_library", "@org_golang_google_protobuf//proto:go_default_library", diff --git a/testing/spectest/shared/phase0/finality/runner.go b/testing/spectest/shared/phase0/finality/runner.go index 9eb9e32a2..c02a9b42c 100644 --- a/testing/spectest/shared/phase0/finality/runner.go +++ b/testing/spectest/shared/phase0/finality/runner.go @@ -12,9 +12,9 @@ import ( v1 "github.com/prysmaticlabs/prysm/beacon-chain/state/v1" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/protobuf/proto" "gopkg.in/d4l3k/messagediff.v1" ) @@ -35,7 +35,7 @@ func RunFinalityTest(t *testing.T, config string) { for _, folder := range testFolders { t.Run(folder.Name(), func(t *testing.T) { helpers.ClearCache() - preBeaconStateFile, err := testutil.BazelFileBytes(testsFolderPath, folder.Name(), "pre.ssz_snappy") + preBeaconStateFile, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "pre.ssz_snappy") require.NoError(t, err) preBeaconStateSSZ, err := snappy.Decode(nil /* dst */, preBeaconStateFile) require.NoError(t, err, "Failed to decompress") @@ -44,7 +44,7 @@ func RunFinalityTest(t *testing.T, config string) { beaconState, err := v1.InitializeFromProto(beaconStateBase) require.NoError(t, err) - file, err := testutil.BazelFileBytes(testsFolderPath, folder.Name(), "meta.yaml") + file, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "meta.yaml") require.NoError(t, err) metaYaml := &Config{} @@ -54,7 +54,7 @@ func RunFinalityTest(t *testing.T, config string) { var ok bool for i := 0; i < metaYaml.BlocksCount; i++ { filename := fmt.Sprintf("blocks_%d.ssz_snappy", i) - blockFile, err := testutil.BazelFileBytes(testsFolderPath, folder.Name(), filename) + blockFile, err := util.BazelFileBytes(testsFolderPath, folder.Name(), filename) require.NoError(t, err) blockSSZ, err := snappy.Decode(nil /* dst */, blockFile) require.NoError(t, err, "Failed to decompress") @@ -66,7 +66,7 @@ func RunFinalityTest(t *testing.T, config string) { require.Equal(t, true, ok) } - postBeaconStateFile, err := testutil.BazelFileBytes(testsFolderPath, folder.Name(), "post.ssz_snappy") + postBeaconStateFile, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "post.ssz_snappy") require.NoError(t, err) postBeaconStateSSZ, err := snappy.Decode(nil /* dst */, postBeaconStateFile) require.NoError(t, err, "Failed to decompress") diff --git a/testing/spectest/shared/phase0/operations/BUILD.bazel b/testing/spectest/shared/phase0/operations/BUILD.bazel index f4760ff9e..f091afdca 100644 --- a/testing/spectest/shared/phase0/operations/BUILD.bazel +++ b/testing/spectest/shared/phase0/operations/BUILD.bazel @@ -23,9 +23,9 @@ go_library( "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/block:go_default_library", "//proto/prysm/v1alpha1/wrapper:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", + "//testing/util:go_default_library", "@com_github_golang_snappy//:go_default_library", "@com_github_pkg_errors//:go_default_library", "@in_gopkg_d4l3k_messagediff_v1//:go_default_library", diff --git a/testing/spectest/shared/phase0/operations/attestation.go b/testing/spectest/shared/phase0/operations/attestation.go index 3112079b9..532acd95f 100644 --- a/testing/spectest/shared/phase0/operations/attestation.go +++ b/testing/spectest/shared/phase0/operations/attestation.go @@ -11,9 +11,9 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/state" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" + "github.com/prysmaticlabs/prysm/testing/util" ) // RunAttestationTest executes "operations/attestation" tests. @@ -23,7 +23,7 @@ func RunAttestationTest(t *testing.T, config string) { for _, folder := range testFolders { t.Run(folder.Name(), func(t *testing.T) { folderPath := path.Join(testsFolderPath, folder.Name()) - attestationFile, err := testutil.BazelFileBytes(folderPath, "attestation.ssz_snappy") + attestationFile, err := util.BazelFileBytes(folderPath, "attestation.ssz_snappy") require.NoError(t, err) attestationSSZ, err := snappy.Decode(nil /* dst */, attestationFile) require.NoError(t, err, "Failed to decompress") diff --git a/testing/spectest/shared/phase0/operations/attester_slashing.go b/testing/spectest/shared/phase0/operations/attester_slashing.go index d44a36bc1..c887ee8a4 100644 --- a/testing/spectest/shared/phase0/operations/attester_slashing.go +++ b/testing/spectest/shared/phase0/operations/attester_slashing.go @@ -11,9 +11,9 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/state" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" + "github.com/prysmaticlabs/prysm/testing/util" ) // RunAttesterSlashingTest executes "operations/attester_slashing" tests. @@ -23,7 +23,7 @@ func RunAttesterSlashingTest(t *testing.T, config string) { for _, folder := range testFolders { t.Run(folder.Name(), func(t *testing.T) { folderPath := path.Join(testsFolderPath, folder.Name()) - attSlashingFile, err := testutil.BazelFileBytes(folderPath, "attester_slashing.ssz_snappy") + attSlashingFile, err := util.BazelFileBytes(folderPath, "attester_slashing.ssz_snappy") require.NoError(t, err) attSlashingSSZ, err := snappy.Decode(nil /* dst */, attSlashingFile) require.NoError(t, err, "Failed to decompress") diff --git a/testing/spectest/shared/phase0/operations/block_header.go b/testing/spectest/shared/phase0/operations/block_header.go index a10f1ac81..0006aab8a 100644 --- a/testing/spectest/shared/phase0/operations/block_header.go +++ b/testing/spectest/shared/phase0/operations/block_header.go @@ -11,9 +11,9 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core/blocks" v1 "github.com/prysmaticlabs/prysm/beacon-chain/state/v1" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/protobuf/proto" "gopkg.in/d4l3k/messagediff.v1" ) @@ -24,14 +24,14 @@ func RunBlockHeaderTest(t *testing.T, config string) { testFolders, testsFolderPath := utils.TestFolders(t, config, "phase0", "operations/block_header/pyspec_tests") for _, folder := range testFolders { t.Run(folder.Name(), func(t *testing.T) { - blockFile, err := testutil.BazelFileBytes(testsFolderPath, folder.Name(), "block.ssz_snappy") + blockFile, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "block.ssz_snappy") require.NoError(t, err) blockSSZ, err := snappy.Decode(nil /* dst */, blockFile) require.NoError(t, err, "Failed to decompress") block := ðpb.BeaconBlock{} require.NoError(t, block.UnmarshalSSZ(blockSSZ), "Failed to unmarshal") - preBeaconStateFile, err := testutil.BazelFileBytes(testsFolderPath, folder.Name(), "pre.ssz_snappy") + preBeaconStateFile, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "pre.ssz_snappy") require.NoError(t, err) preBeaconStateSSZ, err := snappy.Decode(nil /* dst */, preBeaconStateFile) require.NoError(t, err, "Failed to decompress") diff --git a/testing/spectest/shared/phase0/operations/deposit.go b/testing/spectest/shared/phase0/operations/deposit.go index a03e05592..fc17b5178 100644 --- a/testing/spectest/shared/phase0/operations/deposit.go +++ b/testing/spectest/shared/phase0/operations/deposit.go @@ -10,9 +10,9 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/state" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" + "github.com/prysmaticlabs/prysm/testing/util" ) // RunDepositTest executes "operations/deposit" tests. @@ -22,7 +22,7 @@ func RunDepositTest(t *testing.T, config string) { for _, folder := range testFolders { t.Run(folder.Name(), func(t *testing.T) { folderPath := path.Join(testsFolderPath, folder.Name()) - depositFile, err := testutil.BazelFileBytes(folderPath, "deposit.ssz_snappy") + depositFile, err := util.BazelFileBytes(folderPath, "deposit.ssz_snappy") require.NoError(t, err) depositSSZ, err := snappy.Decode(nil /* dst */, depositFile) require.NoError(t, err, "Failed to decompress") diff --git a/testing/spectest/shared/phase0/operations/helpers.go b/testing/spectest/shared/phase0/operations/helpers.go index 7b7692e43..7be88c5f8 100644 --- a/testing/spectest/shared/phase0/operations/helpers.go +++ b/testing/spectest/shared/phase0/operations/helpers.go @@ -15,8 +15,8 @@ import ( ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/protobuf/proto" "gopkg.in/d4l3k/messagediff.v1" ) @@ -31,7 +31,7 @@ func RunBlockOperationTest( body *ethpb.BeaconBlockBody, operationFn blockOperation, ) { - preBeaconStateFile, err := testutil.BazelFileBytes(path.Join(folderPath, "pre.ssz_snappy")) + preBeaconStateFile, err := util.BazelFileBytes(path.Join(folderPath, "pre.ssz_snappy")) require.NoError(t, err) preBeaconStateSSZ, err := snappy.Decode(nil /* dst */, preBeaconStateFile) require.NoError(t, err, "Failed to decompress") @@ -52,7 +52,7 @@ func RunBlockOperationTest( } helpers.ClearCache() - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Body = body beaconState, err := operationFn(context.Background(), preState, wrapper.WrappedPhase0SignedBeaconBlock(b)) if postSSZExists { diff --git a/testing/spectest/shared/phase0/operations/proposer_slashing.go b/testing/spectest/shared/phase0/operations/proposer_slashing.go index 61b808f1f..64de7727d 100644 --- a/testing/spectest/shared/phase0/operations/proposer_slashing.go +++ b/testing/spectest/shared/phase0/operations/proposer_slashing.go @@ -11,9 +11,9 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/state" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" + "github.com/prysmaticlabs/prysm/testing/util" ) // RunProposerSlashingTest executes "operations/proposer_slashing" tests. @@ -23,7 +23,7 @@ func RunProposerSlashingTest(t *testing.T, config string) { for _, folder := range testFolders { t.Run(folder.Name(), func(t *testing.T) { folderPath := path.Join(testsFolderPath, folder.Name()) - proposerSlashingFile, err := testutil.BazelFileBytes(folderPath, "proposer_slashing.ssz_snappy") + proposerSlashingFile, err := util.BazelFileBytes(folderPath, "proposer_slashing.ssz_snappy") require.NoError(t, err) proposerSlashingSSZ, err := snappy.Decode(nil /* dst */, proposerSlashingFile) require.NoError(t, err, "Failed to decompress") diff --git a/testing/spectest/shared/phase0/operations/voluntary_exit.go b/testing/spectest/shared/phase0/operations/voluntary_exit.go index c6595cf22..398b1f323 100644 --- a/testing/spectest/shared/phase0/operations/voluntary_exit.go +++ b/testing/spectest/shared/phase0/operations/voluntary_exit.go @@ -10,9 +10,9 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/state" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" + "github.com/prysmaticlabs/prysm/testing/util" ) // RunVoluntaryExitTest executes "operations/voluntary_exit" tests. @@ -22,7 +22,7 @@ func RunVoluntaryExitTest(t *testing.T, config string) { for _, folder := range testFolders { t.Run(folder.Name(), func(t *testing.T) { folderPath := path.Join(testsFolderPath, folder.Name()) - exitFile, err := testutil.BazelFileBytes(folderPath, "voluntary_exit.ssz_snappy") + exitFile, err := util.BazelFileBytes(folderPath, "voluntary_exit.ssz_snappy") require.NoError(t, err) exitSSZ, err := snappy.Decode(nil /* dst */, exitFile) require.NoError(t, err, "Failed to decompress") diff --git a/testing/spectest/shared/phase0/rewards/BUILD.bazel b/testing/spectest/shared/phase0/rewards/BUILD.bazel index e8d90378f..83e40043e 100644 --- a/testing/spectest/shared/phase0/rewards/BUILD.bazel +++ b/testing/spectest/shared/phase0/rewards/BUILD.bazel @@ -11,9 +11,9 @@ go_library( "//beacon-chain/core/helpers:go_default_library", "//beacon-chain/state/v1:go_default_library", "//proto/prysm/v1alpha1:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", + "//testing/util:go_default_library", "@com_github_golang_snappy//:go_default_library", ], ) diff --git a/testing/spectest/shared/phase0/rewards/rewards_penalties.go b/testing/spectest/shared/phase0/rewards/rewards_penalties.go index 215f99ed9..bdd604d91 100644 --- a/testing/spectest/shared/phase0/rewards/rewards_penalties.go +++ b/testing/spectest/shared/phase0/rewards/rewards_penalties.go @@ -13,9 +13,9 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core/helpers" v1 "github.com/prysmaticlabs/prysm/beacon-chain/state/v1" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" + "github.com/prysmaticlabs/prysm/testing/util" ) // Delta contains list of rewards and penalties. @@ -49,7 +49,7 @@ func RunPrecomputeRewardsAndPenaltiesTests(t *testing.T, config string) { require.NoError(t, utils.SetConfig(t, config)) _, testsFolderPath := utils.TestFolders(t, config, "phase0", "rewards") - testTypes, err := testutil.BazelListDirectories(testsFolderPath) + testTypes, err := util.BazelListDirectories(testsFolderPath) require.NoError(t, err) for _, testType := range testTypes { @@ -66,7 +66,7 @@ func RunPrecomputeRewardsAndPenaltiesTests(t *testing.T, config string) { func runPrecomputeRewardsAndPenaltiesTest(t *testing.T, testFolderPath string) { ctx := context.Background() - preBeaconStateFile, err := testutil.BazelFileBytes(path.Join(testFolderPath, "pre.ssz_snappy")) + preBeaconStateFile, err := util.BazelFileBytes(path.Join(testFolderPath, "pre.ssz_snappy")) require.NoError(t, err) preBeaconStateSSZ, err := snappy.Decode(nil /* dst */, preBeaconStateFile) require.NoError(t, err, "Failed to decompress") @@ -95,7 +95,7 @@ func runPrecomputeRewardsAndPenaltiesTest(t *testing.T, testFolderPath string) { totalSpecTestPenalties := make([]uint64, len(penalties)) for _, dFile := range deltaFiles { - sourceFile, err := testutil.BazelFileBytes(path.Join(testFolderPath, dFile)) + sourceFile, err := util.BazelFileBytes(path.Join(testFolderPath, dFile)) require.NoError(t, err) sourceSSZ, err := snappy.Decode(nil /* dst */, sourceFile) require.NoError(t, err, "Failed to decompress") diff --git a/testing/spectest/shared/phase0/sanity/BUILD.bazel b/testing/spectest/shared/phase0/sanity/BUILD.bazel index 3790883c7..95da1ab32 100644 --- a/testing/spectest/shared/phase0/sanity/BUILD.bazel +++ b/testing/spectest/shared/phase0/sanity/BUILD.bazel @@ -17,9 +17,9 @@ go_library( "//beacon-chain/state/v1:go_default_library", "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/wrapper:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", + "//testing/util:go_default_library", "@com_github_golang_snappy//:go_default_library", "@in_gopkg_d4l3k_messagediff_v1//:go_default_library", "@io_bazel_rules_go//go/tools/bazel:go_default_library", diff --git a/testing/spectest/shared/phase0/sanity/block_processing.go b/testing/spectest/shared/phase0/sanity/block_processing.go index 21f8454a5..9d07a7dc9 100644 --- a/testing/spectest/shared/phase0/sanity/block_processing.go +++ b/testing/spectest/shared/phase0/sanity/block_processing.go @@ -16,9 +16,9 @@ import ( v1 "github.com/prysmaticlabs/prysm/beacon-chain/state/v1" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/protobuf/proto" "gopkg.in/d4l3k/messagediff.v1" ) @@ -35,7 +35,7 @@ func RunBlockProcessingTest(t *testing.T, config, folderPath string) { for _, folder := range testFolders { t.Run(folder.Name(), func(t *testing.T) { helpers.ClearCache() - preBeaconStateFile, err := testutil.BazelFileBytes(testsFolderPath, folder.Name(), "pre.ssz_snappy") + preBeaconStateFile, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "pre.ssz_snappy") require.NoError(t, err) preBeaconStateSSZ, err := snappy.Decode(nil /* dst */, preBeaconStateFile) require.NoError(t, err, "Failed to decompress") @@ -44,7 +44,7 @@ func RunBlockProcessingTest(t *testing.T, config, folderPath string) { beaconState, err := v1.InitializeFromProto(beaconStateBase) require.NoError(t, err) - file, err := testutil.BazelFileBytes(testsFolderPath, folder.Name(), "meta.yaml") + file, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "meta.yaml") require.NoError(t, err) metaYaml := &SanityConfig{} @@ -55,7 +55,7 @@ func RunBlockProcessingTest(t *testing.T, config, folderPath string) { var ok bool for i := 0; i < metaYaml.BlocksCount; i++ { filename := fmt.Sprintf("blocks_%d.ssz_snappy", i) - blockFile, err := testutil.BazelFileBytes(testsFolderPath, folder.Name(), filename) + blockFile, err := util.BazelFileBytes(testsFolderPath, folder.Name(), filename) require.NoError(t, err) blockSSZ, err := snappy.Decode(nil /* dst */, blockFile) require.NoError(t, err, "Failed to decompress") diff --git a/testing/spectest/shared/phase0/sanity/slot_processing.go b/testing/spectest/shared/phase0/sanity/slot_processing.go index 0c7df1229..e9d0fbd3d 100644 --- a/testing/spectest/shared/phase0/sanity/slot_processing.go +++ b/testing/spectest/shared/phase0/sanity/slot_processing.go @@ -9,9 +9,9 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core/transition" v1 "github.com/prysmaticlabs/prysm/beacon-chain/state/v1" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" + "github.com/prysmaticlabs/prysm/testing/util" "google.golang.org/protobuf/proto" "gopkg.in/d4l3k/messagediff.v1" ) @@ -28,7 +28,7 @@ func RunSlotProcessingTests(t *testing.T, config string) { for _, folder := range testFolders { t.Run(folder.Name(), func(t *testing.T) { - preBeaconStateFile, err := testutil.BazelFileBytes(testsFolderPath, folder.Name(), "pre.ssz_snappy") + preBeaconStateFile, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "pre.ssz_snappy") require.NoError(t, err) preBeaconStateSSZ, err := snappy.Decode(nil /* dst */, preBeaconStateFile) require.NoError(t, err, "Failed to decompress") @@ -37,13 +37,13 @@ func RunSlotProcessingTests(t *testing.T, config string) { beaconState, err := v1.InitializeFromProto(base) require.NoError(t, err) - file, err := testutil.BazelFileBytes(testsFolderPath, folder.Name(), "slots.yaml") + file, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "slots.yaml") require.NoError(t, err) fileStr := string(file) slotsCount, err := strconv.Atoi(fileStr[:len(fileStr)-5]) require.NoError(t, err) - postBeaconStateFile, err := testutil.BazelFileBytes(testsFolderPath, folder.Name(), "post.ssz_snappy") + postBeaconStateFile, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "post.ssz_snappy") require.NoError(t, err) postBeaconStateSSZ, err := snappy.Decode(nil /* dst */, postBeaconStateFile) require.NoError(t, err, "Failed to decompress") diff --git a/testing/spectest/shared/phase0/shuffling/core/shuffle/BUILD.bazel b/testing/spectest/shared/phase0/shuffling/core/shuffle/BUILD.bazel index dc9272f0b..61495dc03 100644 --- a/testing/spectest/shared/phase0/shuffling/core/shuffle/BUILD.bazel +++ b/testing/spectest/shared/phase0/shuffling/core/shuffle/BUILD.bazel @@ -11,9 +11,9 @@ go_library( visibility = ["//testing/spectest:__subpackages__"], deps = [ "//beacon-chain/core/helpers:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", + "//testing/util:go_default_library", "@com_github_ethereum_go_ethereum//common:go_default_library", "@com_github_go_yaml_yaml//:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", diff --git a/testing/spectest/shared/phase0/shuffling/core/shuffle/shuffle.go b/testing/spectest/shared/phase0/shuffling/core/shuffle/shuffle.go index fc5361302..89ad3d9a4 100644 --- a/testing/spectest/shared/phase0/shuffling/core/shuffle/shuffle.go +++ b/testing/spectest/shared/phase0/shuffling/core/shuffle/shuffle.go @@ -11,9 +11,9 @@ import ( "github.com/go-yaml/yaml" types "github.com/prysmaticlabs/eth2-types" "github.com/prysmaticlabs/prysm/beacon-chain/core/helpers" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" + "github.com/prysmaticlabs/prysm/testing/util" ) // RunShuffleTests executes "shuffling/core/shuffle" tests. @@ -23,7 +23,7 @@ func RunShuffleTests(t *testing.T, config string) { testFolders, testsFolderPath := utils.TestFolders(t, config, "phase0", "shuffling/core/shuffle") for _, folder := range testFolders { t.Run(folder.Name(), func(t *testing.T) { - testCaseFile, err := testutil.BazelFileBytes(path.Join(testsFolderPath, folder.Name(), "mapping.yaml")) + testCaseFile, err := util.BazelFileBytes(path.Join(testsFolderPath, folder.Name(), "mapping.yaml")) require.NoError(t, err, "Could not read YAML tests directory") testCase := &ShuffleTestCase{} diff --git a/testing/spectest/shared/phase0/ssz_static/BUILD.bazel b/testing/spectest/shared/phase0/ssz_static/BUILD.bazel index d2561ec20..2668769d4 100644 --- a/testing/spectest/shared/phase0/ssz_static/BUILD.bazel +++ b/testing/spectest/shared/phase0/ssz_static/BUILD.bazel @@ -9,9 +9,9 @@ go_library( deps = [ "//beacon-chain/state/v1:go_default_library", "//proto/prysm/v1alpha1:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/require:go_default_library", "//testing/spectest/utils:go_default_library", + "//testing/util:go_default_library", "@com_github_ferranbt_fastssz//:go_default_library", "@com_github_golang_snappy//:go_default_library", ], diff --git a/testing/spectest/shared/phase0/ssz_static/ssz_static.go b/testing/spectest/shared/phase0/ssz_static/ssz_static.go index 76fce8679..f9fe2a472 100644 --- a/testing/spectest/shared/phase0/ssz_static/ssz_static.go +++ b/testing/spectest/shared/phase0/ssz_static/ssz_static.go @@ -11,9 +11,9 @@ import ( "github.com/golang/snappy" v1 "github.com/prysmaticlabs/prysm/beacon-chain/state/v1" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/testing/spectest/utils" + "github.com/prysmaticlabs/prysm/testing/util" ) // SSZRoots -- @@ -33,14 +33,14 @@ func RunSSZStaticTests(t *testing.T, config string) { for _, innerFolder := range innerTestFolders { t.Run(path.Join(folder.Name(), innerFolder.Name()), func(t *testing.T) { - serializedBytes, err := testutil.BazelFileBytes(innerTestsFolderPath, innerFolder.Name(), "serialized.ssz_snappy") + serializedBytes, err := util.BazelFileBytes(innerTestsFolderPath, innerFolder.Name(), "serialized.ssz_snappy") require.NoError(t, err) serializedSSZ, err := snappy.Decode(nil /* dst */, serializedBytes) require.NoError(t, err, "Failed to decompress") object, err := UnmarshalledSSZ(t, serializedSSZ, folder.Name()) require.NoError(t, err, "Could not unmarshall serialized SSZ") - rootsYamlFile, err := testutil.BazelFileBytes(innerTestsFolderPath, innerFolder.Name(), "roots.yaml") + rootsYamlFile, err := util.BazelFileBytes(innerTestsFolderPath, innerFolder.Name(), "roots.yaml") require.NoError(t, err) rootsYaml := &SSZRoots{} require.NoError(t, utils.UnmarshalYaml(rootsYamlFile, rootsYaml), "Failed to Unmarshal") diff --git a/testing/spectest/utils/BUILD.bazel b/testing/spectest/utils/BUILD.bazel index 4b329ceb3..10517c6cf 100644 --- a/testing/spectest/utils/BUILD.bazel +++ b/testing/spectest/utils/BUILD.bazel @@ -11,7 +11,7 @@ go_library( visibility = ["//testing/spectest:__subpackages__"], deps = [ "//config/params:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/require:go_default_library", "@com_github_ghodss_yaml//:go_default_library", "@com_github_json_iterator_go//:go_default_library", "@io_bazel_rules_go//go/tools/bazel:go_default_library", @@ -25,7 +25,7 @@ go_test( embed = [":go_default_library"], deps = [ "//config/params:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/require:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", ], ) diff --git a/testing/spectest/utils/config_test.go b/testing/spectest/utils/config_test.go index 3c76fe64f..135e5d87b 100644 --- a/testing/spectest/utils/config_test.go +++ b/testing/spectest/utils/config_test.go @@ -5,7 +5,7 @@ import ( types "github.com/prysmaticlabs/eth2-types" "github.com/prysmaticlabs/prysm/config/params" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestConfig(t *testing.T) { diff --git a/testing/spectest/utils/utils.go b/testing/spectest/utils/utils.go index 747697af7..9b4b824f9 100644 --- a/testing/spectest/utils/utils.go +++ b/testing/spectest/utils/utils.go @@ -9,7 +9,7 @@ import ( "github.com/bazelbuild/rules_go/go/tools/bazel" "github.com/ghodss/yaml" jsoniter "github.com/json-iterator/go" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) var json = jsoniter.Config{ diff --git a/shared/testutil/BUILD.bazel b/testing/util/BUILD.bazel similarity index 93% rename from shared/testutil/BUILD.bazel rename to testing/util/BUILD.bazel index 0c8fb3e80..f270fd449 100644 --- a/shared/testutil/BUILD.bazel +++ b/testing/util/BUILD.bazel @@ -15,7 +15,7 @@ go_library( "sync_committee.go", "wait_timeout.go", ], - importpath = "github.com/prysmaticlabs/prysm/shared/testutil", + importpath = "github.com/prysmaticlabs/prysm/testing/util", visibility = ["//visibility:public"], deps = [ "//beacon-chain/core:go_default_library", @@ -67,8 +67,8 @@ go_test( "//proto/eth/v1:go_default_library", "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/wrapper:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", "@org_golang_google_protobuf//proto:go_default_library", ], diff --git a/shared/testutil/altair.go b/testing/util/altair.go similarity index 99% rename from shared/testutil/altair.go rename to testing/util/altair.go index 1a1aa28ca..537ad42d7 100644 --- a/shared/testutil/altair.go +++ b/testing/util/altair.go @@ -1,4 +1,4 @@ -package testutil +package util import ( "context" diff --git a/shared/testutil/attestation.go b/testing/util/attestation.go similarity index 99% rename from shared/testutil/attestation.go rename to testing/util/attestation.go index adb373e06..6f9f1db0c 100644 --- a/shared/testutil/attestation.go +++ b/testing/util/attestation.go @@ -1,4 +1,4 @@ -package testutil +package util import ( "context" diff --git a/shared/testutil/attestation_test.go b/testing/util/attestation_test.go similarity index 95% rename from shared/testutil/attestation_test.go rename to testing/util/attestation_test.go index c7d926459..8d0650130 100644 --- a/shared/testutil/attestation_test.go +++ b/testing/util/attestation_test.go @@ -1,4 +1,4 @@ -package testutil +package util import ( "testing" @@ -6,7 +6,7 @@ import ( "github.com/prysmaticlabs/prysm/config/params" v1 "github.com/prysmaticlabs/prysm/proto/eth/v1" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestHydrateAttestation(t *testing.T) { diff --git a/shared/testutil/bazel.go b/testing/util/bazel.go similarity index 99% rename from shared/testutil/bazel.go rename to testing/util/bazel.go index 8863a72fe..81e8f58b1 100644 --- a/shared/testutil/bazel.go +++ b/testing/util/bazel.go @@ -1,4 +1,4 @@ -package testutil +package util import ( "io/ioutil" diff --git a/shared/testutil/block.go b/testing/util/block.go similarity index 99% rename from shared/testutil/block.go rename to testing/util/block.go index da402666e..aebdd7890 100644 --- a/shared/testutil/block.go +++ b/testing/util/block.go @@ -1,4 +1,4 @@ -package testutil +package util import ( "context" diff --git a/shared/testutil/block_test.go b/testing/util/block_test.go similarity index 99% rename from shared/testutil/block_test.go rename to testing/util/block_test.go index 183c63186..d5f897a59 100644 --- a/shared/testutil/block_test.go +++ b/testing/util/block_test.go @@ -1,4 +1,4 @@ -package testutil +package util import ( "context" @@ -14,7 +14,7 @@ import ( eth "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" v2 "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestGenerateFullBlock_PassesStateTransition(t *testing.T) { diff --git a/shared/testutil/deposits.go b/testing/util/deposits.go similarity index 99% rename from shared/testutil/deposits.go rename to testing/util/deposits.go index 1cc8cbd14..fc0708c85 100644 --- a/shared/testutil/deposits.go +++ b/testing/util/deposits.go @@ -1,4 +1,4 @@ -package testutil +package util import ( "context" diff --git a/shared/testutil/deposits_test.go b/testing/util/deposits_test.go similarity index 99% rename from shared/testutil/deposits_test.go rename to testing/util/deposits_test.go index 230e2e789..8caf08094 100644 --- a/shared/testutil/deposits_test.go +++ b/testing/util/deposits_test.go @@ -1,4 +1,4 @@ -package testutil +package util import ( "bytes" @@ -7,7 +7,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core/helpers" "github.com/prysmaticlabs/prysm/config/params" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "google.golang.org/protobuf/proto" ) diff --git a/shared/testutil/helpers.go b/testing/util/helpers.go similarity index 99% rename from shared/testutil/helpers.go rename to testing/util/helpers.go index cc3d15bfe..dcd4185eb 100644 --- a/shared/testutil/helpers.go +++ b/testing/util/helpers.go @@ -1,4 +1,4 @@ -package testutil +package util import ( "context" diff --git a/shared/testutil/helpers_test.go b/testing/util/helpers_test.go similarity index 93% rename from shared/testutil/helpers_test.go rename to testing/util/helpers_test.go index 640c7593d..02dd78ff9 100644 --- a/shared/testutil/helpers_test.go +++ b/testing/util/helpers_test.go @@ -1,4 +1,4 @@ -package testutil +package util import ( "bytes" @@ -9,8 +9,8 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core" "github.com/prysmaticlabs/prysm/beacon-chain/core/helpers" "github.com/prysmaticlabs/prysm/config/params" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestBlockSignature(t *testing.T) { diff --git a/shared/testutil/state.go b/testing/util/state.go similarity index 99% rename from shared/testutil/state.go rename to testing/util/state.go index f490768b8..4040eb832 100644 --- a/shared/testutil/state.go +++ b/testing/util/state.go @@ -1,4 +1,4 @@ -package testutil +package util import ( "fmt" diff --git a/shared/testutil/state_test.go b/testing/util/state_test.go similarity index 90% rename from shared/testutil/state_test.go rename to testing/util/state_test.go index 393797723..924d44fd5 100644 --- a/shared/testutil/state_test.go +++ b/testing/util/state_test.go @@ -1,4 +1,4 @@ -package testutil +package util import ( "context" @@ -6,7 +6,7 @@ import ( "testing" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestNewBeaconState(t *testing.T) { diff --git a/shared/testutil/sync_aggregate.go b/testing/util/sync_aggregate.go similarity index 99% rename from shared/testutil/sync_aggregate.go rename to testing/util/sync_aggregate.go index 651969ead..3c9a43fae 100644 --- a/shared/testutil/sync_aggregate.go +++ b/testing/util/sync_aggregate.go @@ -1,4 +1,4 @@ -package testutil +package util import ( "github.com/pkg/errors" diff --git a/shared/testutil/sync_committee.go b/testing/util/sync_committee.go similarity index 95% rename from shared/testutil/sync_committee.go rename to testing/util/sync_committee.go index 2e414aace..3f63d0cb1 100644 --- a/shared/testutil/sync_committee.go +++ b/testing/util/sync_committee.go @@ -1,4 +1,4 @@ -package testutil +package util import ( ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" diff --git a/shared/testutil/wait_timeout.go b/testing/util/wait_timeout.go similarity index 95% rename from shared/testutil/wait_timeout.go rename to testing/util/wait_timeout.go index aff6c0dca..d7abaaefe 100644 --- a/shared/testutil/wait_timeout.go +++ b/testing/util/wait_timeout.go @@ -1,4 +1,4 @@ -package testutil +package util import ( "sync" diff --git a/time/slots/BUILD.bazel b/time/slots/BUILD.bazel index 34827e8a3..ad19d52bc 100644 --- a/time/slots/BUILD.bazel +++ b/time/slots/BUILD.bazel @@ -29,7 +29,7 @@ go_test( embed = [":go_default_library"], deps = [ "//config/params:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/require:go_default_library", "//time:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", diff --git a/time/slots/countdown_test.go b/time/slots/countdown_test.go index ac4634858..87b12ed71 100644 --- a/time/slots/countdown_test.go +++ b/time/slots/countdown_test.go @@ -6,7 +6,7 @@ import ( "time" "github.com/prysmaticlabs/prysm/config/params" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" prysmTime "github.com/prysmaticlabs/prysm/time" "github.com/sirupsen/logrus" logTest "github.com/sirupsen/logrus/hooks/test" diff --git a/tools/analyzers/errcheck/BUILD.bazel b/tools/analyzers/errcheck/BUILD.bazel index 22a2eff37..6579b7717 100644 --- a/tools/analyzers/errcheck/BUILD.bazel +++ b/tools/analyzers/errcheck/BUILD.bazel @@ -30,7 +30,7 @@ go_test( srcs = ["embedded_walker_test.go"], embed = [":go_default_library"], deps = [ - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", ], ) diff --git a/tools/analyzers/errcheck/embedded_walker_test.go b/tools/analyzers/errcheck/embedded_walker_test.go index a048f2800..8808f7712 100644 --- a/tools/analyzers/errcheck/embedded_walker_test.go +++ b/tools/analyzers/errcheck/embedded_walker_test.go @@ -7,8 +7,8 @@ import ( "go/types" "testing" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) const commonSrc = ` diff --git a/tools/benchmark-files-gen/BUILD.bazel b/tools/benchmark-files-gen/BUILD.bazel index 0bc28b8b2..7ce5fe331 100644 --- a/tools/benchmark-files-gen/BUILD.bazel +++ b/tools/benchmark-files-gen/BUILD.bazel @@ -18,8 +18,8 @@ go_library( "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/wrapper:go_default_library", "//runtime/interop:go_default_library", - "//shared/testutil:go_default_library", "//testing/benchmark:go_default_library", + "//testing/util:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", ], diff --git a/tools/benchmark-files-gen/main.go b/tools/benchmark-files-gen/main.go index e13f66985..8aba654b3 100644 --- a/tools/benchmark-files-gen/main.go +++ b/tools/benchmark-files-gen/main.go @@ -20,8 +20,8 @@ import ( ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" "github.com/prysmaticlabs/prysm/runtime/interop" - "github.com/prysmaticlabs/prysm/shared/testutil" "github.com/prysmaticlabs/prysm/testing/benchmark" + "github.com/prysmaticlabs/prysm/testing/util" ) var ( @@ -95,11 +95,11 @@ func generateMarshalledFullStateAndBlock() error { return err } - conf := &testutil.BlockGenConfig{} + conf := &util.BlockGenConfig{} slotsPerEpoch := params.BeaconConfig().SlotsPerEpoch // Small offset for the beacon state so we dont process a block on an epoch. slotOffset := types.Slot(2) - block, err := testutil.GenerateFullBlock(beaconState, privs, conf, slotsPerEpoch+slotOffset) + block, err := util.GenerateFullBlock(beaconState, privs, conf, slotsPerEpoch+slotOffset) if err != nil { return err } @@ -108,20 +108,20 @@ func generateMarshalledFullStateAndBlock() error { return err } - attConfig := &testutil.BlockGenConfig{ + attConfig := &util.BlockGenConfig{ NumAttestations: benchmark.AttestationsPerEpoch / uint64(slotsPerEpoch), } var atts []*ethpb.Attestation for i := slotOffset + 1; i < slotsPerEpoch+slotOffset; i++ { - attsForSlot, err := testutil.GenerateAttestations(beaconState, privs, attConfig.NumAttestations, i, false) + attsForSlot, err := util.GenerateAttestations(beaconState, privs, attConfig.NumAttestations, i, false) if err != nil { return err } atts = append(atts, attsForSlot...) } - block, err = testutil.GenerateFullBlock(beaconState, privs, attConfig, beaconState.Slot()) + block, err = util.GenerateFullBlock(beaconState, privs, attConfig, beaconState.Slot()) if err != nil { return errors.Wrap(err, "could not generate full block") } @@ -183,12 +183,12 @@ func generate2FullEpochState() error { return err } - attConfig := &testutil.BlockGenConfig{ + attConfig := &util.BlockGenConfig{ NumAttestations: benchmark.AttestationsPerEpoch / uint64(params.BeaconConfig().SlotsPerEpoch), } for i := types.Slot(0); i < params.BeaconConfig().SlotsPerEpoch*2-1; i++ { - block, err := testutil.GenerateFullBlock(beaconState, privs, attConfig, beaconState.Slot()) + block, err := util.GenerateFullBlock(beaconState, privs, attConfig, beaconState.Slot()) if err != nil { return err } diff --git a/tools/bootnode/BUILD.bazel b/tools/bootnode/BUILD.bazel index 07da94632..0a7ccfdbe 100644 --- a/tools/bootnode/BUILD.bazel +++ b/tools/bootnode/BUILD.bazel @@ -70,8 +70,8 @@ go_test( deps = [ "//network:go_default_library", "//runtime/maxprocs:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "@com_github_ethereum_go_ethereum//p2p/discover:go_default_library", "@com_github_ethereum_go_ethereum//p2p/enode:go_default_library", "@com_github_libp2p_go_libp2p_core//crypto:go_default_library", diff --git a/tools/bootnode/bootnode_test.go b/tools/bootnode/bootnode_test.go index 495a30ed9..949394331 100644 --- a/tools/bootnode/bootnode_test.go +++ b/tools/bootnode/bootnode_test.go @@ -13,8 +13,8 @@ import ( "github.com/libp2p/go-libp2p-core/crypto" "github.com/prysmaticlabs/prysm/network" _ "github.com/prysmaticlabs/prysm/runtime/maxprocs" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/sirupsen/logrus" ) diff --git a/tools/genesis-state-gen/BUILD.bazel b/tools/genesis-state-gen/BUILD.bazel index 80e95a412..ea545f2bd 100644 --- a/tools/genesis-state-gen/BUILD.bazel +++ b/tools/genesis-state-gen/BUILD.bazel @@ -58,7 +58,7 @@ go_test( deps = [ "//crypto/bls:go_default_library", "//runtime/interop:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", ], ) diff --git a/tools/genesis-state-gen/main_test.go b/tools/genesis-state-gen/main_test.go index 82b93446a..9f17174e5 100644 --- a/tools/genesis-state-gen/main_test.go +++ b/tools/genesis-state-gen/main_test.go @@ -8,8 +8,8 @@ import ( "github.com/prysmaticlabs/prysm/crypto/bls" "github.com/prysmaticlabs/prysm/runtime/interop" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func Test_genesisStateFromJSONValidators(t *testing.T) { diff --git a/tools/http-request-sink/BUILD.bazel b/tools/http-request-sink/BUILD.bazel index 1e65d527d..8a19b0d2c 100644 --- a/tools/http-request-sink/BUILD.bazel +++ b/tools/http-request-sink/BUILD.bazel @@ -51,6 +51,6 @@ go_test( embed = [":go_default_library"], deps = [ "//config/params:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/require:go_default_library", ], ) diff --git a/tools/http-request-sink/main_test.go b/tools/http-request-sink/main_test.go index 143094be4..f0562523f 100644 --- a/tools/http-request-sink/main_test.go +++ b/tools/http-request-sink/main_test.go @@ -10,7 +10,7 @@ import ( "testing" "github.com/prysmaticlabs/prysm/config/params" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) type sampleRPCRequest struct { diff --git a/tools/interop/split-keys/BUILD.bazel b/tools/interop/split-keys/BUILD.bazel index b9bffebca..6bc7ca54d 100644 --- a/tools/interop/split-keys/BUILD.bazel +++ b/tools/interop/split-keys/BUILD.bazel @@ -28,7 +28,7 @@ go_test( srcs = ["main_test.go"], embed = [":go_default_library"], deps = [ - "//shared/testutil/require:go_default_library", + "//testing/require:go_default_library", "//validator/accounts/wallet:go_default_library", "//validator/keymanager:go_default_library", "//validator/keymanager/imported:go_default_library", diff --git a/tools/interop/split-keys/main_test.go b/tools/interop/split-keys/main_test.go index e794e0d5f..d1fada340 100644 --- a/tools/interop/split-keys/main_test.go +++ b/tools/interop/split-keys/main_test.go @@ -10,7 +10,7 @@ import ( "strings" "testing" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/validator/accounts/wallet" "github.com/prysmaticlabs/prysm/validator/keymanager" "github.com/prysmaticlabs/prysm/validator/keymanager/imported" diff --git a/tools/keystores/BUILD.bazel b/tools/keystores/BUILD.bazel index bed19aab3..375cb8814 100644 --- a/tools/keystores/BUILD.bazel +++ b/tools/keystores/BUILD.bazel @@ -32,8 +32,8 @@ go_test( deps = [ "//config/params:go_default_library", "//crypto/bls:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "//validator/keymanager:go_default_library", "@com_github_google_uuid//:go_default_library", "@com_github_urfave_cli_v2//:go_default_library", diff --git a/tools/keystores/main_test.go b/tools/keystores/main_test.go index 8291ef9ee..0c71ded4c 100644 --- a/tools/keystores/main_test.go +++ b/tools/keystores/main_test.go @@ -13,8 +13,8 @@ import ( "github.com/google/uuid" "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/crypto/bls" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/validator/keymanager" "github.com/urfave/cli/v2" keystorev4 "github.com/wealdtech/go-eth2-wallet-encryptor-keystorev4" diff --git a/tools/unencrypted-keys-gen/BUILD.bazel b/tools/unencrypted-keys-gen/BUILD.bazel index fde943781..65306730f 100644 --- a/tools/unencrypted-keys-gen/BUILD.bazel +++ b/tools/unencrypted-keys-gen/BUILD.bazel @@ -26,8 +26,8 @@ go_test( srcs = ["main_test.go"], embed = [":go_default_library"], deps = [ - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "//tools/unencrypted-keys-gen/keygen:go_default_library", ], ) diff --git a/tools/unencrypted-keys-gen/main_test.go b/tools/unencrypted-keys-gen/main_test.go index 74ad76844..9d1fd0a71 100644 --- a/tools/unencrypted-keys-gen/main_test.go +++ b/tools/unencrypted-keys-gen/main_test.go @@ -5,8 +5,8 @@ import ( "encoding/json" "testing" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/tools/unencrypted-keys-gen/keygen" ) diff --git a/validator/accounts/BUILD.bazel b/validator/accounts/BUILD.bazel index 9dcbf3b3d..3b0f40c09 100644 --- a/validator/accounts/BUILD.bazel +++ b/validator/accounts/BUILD.bazel @@ -78,9 +78,9 @@ go_test( "//io/file:go_default_library", "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/validator-client:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", "//testing/mock:go_default_library", + "//testing/require:go_default_library", "//time:go_default_library", "//validator/accounts/iface:go_default_library", "//validator/accounts/petnames:go_default_library", diff --git a/validator/accounts/accounts_backup_test.go b/validator/accounts/accounts_backup_test.go index 0ab49bc52..df4692b42 100644 --- a/validator/accounts/accounts_backup_test.go +++ b/validator/accounts/accounts_backup_test.go @@ -14,8 +14,8 @@ import ( "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/io/file" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/validator/accounts/iface" "github.com/prysmaticlabs/prysm/validator/accounts/wallet" "github.com/prysmaticlabs/prysm/validator/keymanager" diff --git a/validator/accounts/accounts_delete_test.go b/validator/accounts/accounts_delete_test.go index a657cf896..cc5600f5f 100644 --- a/validator/accounts/accounts_delete_test.go +++ b/validator/accounts/accounts_delete_test.go @@ -9,8 +9,8 @@ import ( "time" "github.com/prysmaticlabs/prysm/encoding/bytesutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/validator/accounts/wallet" "github.com/prysmaticlabs/prysm/validator/keymanager" "github.com/prysmaticlabs/prysm/validator/keymanager/imported" diff --git a/validator/accounts/accounts_exit_test.go b/validator/accounts/accounts_exit_test.go index 9f413e320..c7cb653d5 100644 --- a/validator/accounts/accounts_exit_test.go +++ b/validator/accounts/accounts_exit_test.go @@ -11,9 +11,9 @@ import ( "github.com/golang/mock/gomock" "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" mock2 "github.com/prysmaticlabs/prysm/testing/mock" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/validator/accounts/wallet" "github.com/prysmaticlabs/prysm/validator/keymanager" "github.com/prysmaticlabs/prysm/validator/keymanager/imported" diff --git a/validator/accounts/accounts_import_test.go b/validator/accounts/accounts_import_test.go index c4635efd1..fc38b8992 100644 --- a/validator/accounts/accounts_import_test.go +++ b/validator/accounts/accounts_import_test.go @@ -16,8 +16,8 @@ import ( "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/crypto/bls" "github.com/prysmaticlabs/prysm/encoding/bytesutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" prysmTime "github.com/prysmaticlabs/prysm/time" "github.com/prysmaticlabs/prysm/validator/accounts/iface" "github.com/prysmaticlabs/prysm/validator/accounts/wallet" diff --git a/validator/accounts/accounts_list_test.go b/validator/accounts/accounts_list_test.go index 50a3d3574..8b2c13068 100644 --- a/validator/accounts/accounts_list_test.go +++ b/validator/accounts/accounts_list_test.go @@ -18,9 +18,9 @@ import ( "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" validatorpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" "github.com/prysmaticlabs/prysm/testing/mock" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/validator/accounts/petnames" "github.com/prysmaticlabs/prysm/validator/accounts/wallet" "github.com/prysmaticlabs/prysm/validator/keymanager" diff --git a/validator/accounts/wallet/BUILD.bazel b/validator/accounts/wallet/BUILD.bazel index 8f814463e..a6314cf5a 100644 --- a/validator/accounts/wallet/BUILD.bazel +++ b/validator/accounts/wallet/BUILD.bazel @@ -33,7 +33,7 @@ go_test( deps = [ ":go_default_library", "//config/params:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/require:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", ], ) diff --git a/validator/accounts/wallet/wallet_test.go b/validator/accounts/wallet/wallet_test.go index 3bebd209a..425f89286 100644 --- a/validator/accounts/wallet/wallet_test.go +++ b/validator/accounts/wallet/wallet_test.go @@ -7,7 +7,7 @@ import ( "testing" "github.com/prysmaticlabs/prysm/config/params" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/validator/accounts/wallet" "github.com/sirupsen/logrus" ) diff --git a/validator/accounts/wallet_create_test.go b/validator/accounts/wallet_create_test.go index 7f430afcb..2b42badff 100644 --- a/validator/accounts/wallet_create_test.go +++ b/validator/accounts/wallet_create_test.go @@ -12,8 +12,8 @@ import ( "github.com/pkg/errors" "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/config/params" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/validator/accounts/wallet" "github.com/prysmaticlabs/prysm/validator/keymanager" "github.com/prysmaticlabs/prysm/validator/keymanager/imported" diff --git a/validator/accounts/wallet_edit_test.go b/validator/accounts/wallet_edit_test.go index 3e18f9c26..d6cb5f035 100644 --- a/validator/accounts/wallet_edit_test.go +++ b/validator/accounts/wallet_edit_test.go @@ -5,8 +5,8 @@ import ( "testing" "github.com/prysmaticlabs/prysm/cmd/validator/flags" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/validator/accounts/wallet" "github.com/prysmaticlabs/prysm/validator/keymanager" "github.com/prysmaticlabs/prysm/validator/keymanager/remote" diff --git a/validator/accounts/wallet_recover_test.go b/validator/accounts/wallet_recover_test.go index 47ba145b2..b2cecc00d 100644 --- a/validator/accounts/wallet_recover_test.go +++ b/validator/accounts/wallet_recover_test.go @@ -10,8 +10,8 @@ import ( "testing" "github.com/prysmaticlabs/prysm/cmd/validator/flags" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/validator/accounts/iface" "github.com/prysmaticlabs/prysm/validator/accounts/wallet" "github.com/prysmaticlabs/prysm/validator/keymanager" diff --git a/validator/client/BUILD.bazel b/validator/client/BUILD.bazel index 406901f34..499688fd1 100644 --- a/validator/client/BUILD.bazel +++ b/validator/client/BUILD.bazel @@ -116,10 +116,10 @@ go_test( "//proto/prysm/v1alpha1/validator-client:go_default_library", "//proto/prysm/v1alpha1/wrapper:go_default_library", "//runtime:go_default_library", - "//shared/testutil:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", "//testing/mock:go_default_library", + "//testing/require:go_default_library", + "//testing/util:go_default_library", "//time:go_default_library", "//time/slots:go_default_library", "//time/slots/testing:go_default_library", diff --git a/validator/client/aggregate_test.go b/validator/client/aggregate_test.go index 9de0ee4f0..e6d6433e2 100644 --- a/validator/client/aggregate_test.go +++ b/validator/client/aggregate_test.go @@ -11,9 +11,9 @@ import ( "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/crypto/bls" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" "github.com/prysmaticlabs/prysm/time" "github.com/prysmaticlabs/prysm/time/slots" logTest "github.com/sirupsen/logrus/hooks/test" @@ -56,7 +56,7 @@ func TestSubmitAggregateAndProof_SignFails(t *testing.T) { ).Return(ðpb.AggregateSelectionResponse{ AggregateAndProof: ðpb.AggregateAttestationAndProof{ AggregatorIndex: 0, - Aggregate: testutil.HydrateAttestation(ðpb.Attestation{ + Aggregate: util.HydrateAttestation(ðpb.Attestation{ AggregationBits: make([]byte, 1), }), SelectionProof: make([]byte, 96), @@ -95,7 +95,7 @@ func TestSubmitAggregateAndProof_Ok(t *testing.T) { ).Return(ðpb.AggregateSelectionResponse{ AggregateAndProof: ðpb.AggregateAttestationAndProof{ AggregatorIndex: 0, - Aggregate: testutil.HydrateAttestation(ðpb.Attestation{ + Aggregate: util.HydrateAttestation(ðpb.Attestation{ AggregationBits: make([]byte, 1), }), SelectionProof: make([]byte, 96), @@ -158,7 +158,7 @@ func TestAggregateAndProofSignature_CanSignValidSignature(t *testing.T) { agg := ðpb.AggregateAttestationAndProof{ AggregatorIndex: 0, - Aggregate: testutil.HydrateAttestation(ðpb.Attestation{ + Aggregate: util.HydrateAttestation(ðpb.Attestation{ AggregationBits: bitfield.NewBitlist(1), }), SelectionProof: make([]byte, 96), diff --git a/validator/client/attest_protect_test.go b/validator/client/attest_protect_test.go index 25e717190..9398bf25c 100644 --- a/validator/client/attest_protect_test.go +++ b/validator/client/attest_protect_test.go @@ -9,7 +9,7 @@ import ( "github.com/prysmaticlabs/prysm/config/features" "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" mockSlasher "github.com/prysmaticlabs/prysm/validator/testing" ) diff --git a/validator/client/attest_test.go b/validator/client/attest_test.go index d58132f3f..2a4c08dac 100644 --- a/validator/client/attest_test.go +++ b/validator/client/attest_test.go @@ -21,9 +21,9 @@ import ( ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" validatorpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" prysmTime "github.com/prysmaticlabs/prysm/time" logTest "github.com/sirupsen/logrus/hooks/test" grpc "google.golang.org/grpc" @@ -460,7 +460,7 @@ func TestSignAttestation(t *testing.T) { DomainData(gomock.Any(), gomock.Any()). Return(ðpb.DomainResponse{SignatureDomain: attesterDomain}, nil) ctx := context.Background() - att := testutil.NewAttestation() + att := util.NewAttestation() att.Data.Source.Epoch = 100 att.Data.Target.Epoch = 200 att.Data.Slot = 999 diff --git a/validator/client/key_reload_test.go b/validator/client/key_reload_test.go index c45396401..e51f0d13e 100644 --- a/validator/client/key_reload_test.go +++ b/validator/client/key_reload_test.go @@ -8,9 +8,9 @@ import ( "github.com/pkg/errors" "github.com/prysmaticlabs/prysm/crypto/bls" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" "github.com/prysmaticlabs/prysm/testing/mock" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/validator/client/testutil" logTest "github.com/sirupsen/logrus/hooks/test" ) diff --git a/validator/client/log_test.go b/validator/client/log_test.go index 218326ef9..12edaa88a 100644 --- a/validator/client/log_test.go +++ b/validator/client/log_test.go @@ -5,7 +5,7 @@ import ( types "github.com/prysmaticlabs/eth2-types" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" logTest "github.com/sirupsen/logrus/hooks/test" ) diff --git a/validator/client/metrics_test.go b/validator/client/metrics_test.go index d829f8771..756b6a966 100644 --- a/validator/client/metrics_test.go +++ b/validator/client/metrics_test.go @@ -6,7 +6,7 @@ import ( types "github.com/prysmaticlabs/eth2-types" "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" logTest "github.com/sirupsen/logrus/hooks/test" ) diff --git a/validator/client/propose_protect_test.go b/validator/client/propose_protect_test.go index 5054f5758..53464b143 100644 --- a/validator/client/propose_protect_test.go +++ b/validator/client/propose_protect_test.go @@ -8,8 +8,8 @@ import ( "github.com/prysmaticlabs/prysm/config/features" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" mockSlasher "github.com/prysmaticlabs/prysm/validator/testing" ) @@ -127,7 +127,7 @@ func TestPreBlockSignValidation(t *testing.T) { pubKey := [48]byte{} copy(pubKey[:], validatorKey.PublicKey().Marshal()) - block := testutil.NewBeaconBlock() + block := util.NewBeaconBlock() block.Block.Slot = 10 mockProtector := &mockSlasher.MockProtector{AllowBlock: false} validator.protector = mockProtector @@ -148,7 +148,7 @@ func TestPostBlockSignUpdate(t *testing.T) { defer finish() pubKey := [48]byte{} copy(pubKey[:], validatorKey.PublicKey().Marshal()) - emptyBlock := testutil.NewBeaconBlock() + emptyBlock := util.NewBeaconBlock() emptyBlock.Block.Slot = 10 emptyBlock.Block.ProposerIndex = 0 mockProtector := &mockSlasher.MockProtector{AllowBlock: false} diff --git a/validator/client/propose_test.go b/validator/client/propose_test.go index 47a370db9..5304347b5 100644 --- a/validator/client/propose_test.go +++ b/validator/client/propose_test.go @@ -17,10 +17,10 @@ import ( ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" validatorpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" mock2 "github.com/prysmaticlabs/prysm/testing/mock" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" testing2 "github.com/prysmaticlabs/prysm/validator/db/testing" "github.com/prysmaticlabs/prysm/validator/graffiti" logTest "github.com/sirupsen/logrus/hooks/test" @@ -197,7 +197,7 @@ func TestProposeBlock_ProposeBlockFailed(t *testing.T) { m.validatorClient.EXPECT().GetBlock( gomock.Any(), // ctx gomock.Any(), - ).Return(testutil.NewBeaconBlock().Block, nil /*err*/) + ).Return(util.NewBeaconBlock().Block, nil /*err*/) m.validatorClient.EXPECT().DomainData( gomock.Any(), // ctx @@ -233,7 +233,7 @@ func TestProposeBlockAltair_ProposeBlockFailed(t *testing.T) { gomock.Any(), // ctx gomock.Any(), ).Return(ðpb.GenericBeaconBlock{ - Block: ðpb.GenericBeaconBlock_Altair{Altair: testutil.NewBeaconBlockAltair().Block}, + Block: ðpb.GenericBeaconBlock_Altair{Altair: util.NewBeaconBlockAltair().Block}, }, nil /*err*/) m.validatorClient.EXPECT().DomainData( @@ -267,7 +267,7 @@ func TestProposeBlock_BlocksDoubleProposal(t *testing.T) { gomock.Any(), // epoch ).Times(1).Return(ðpb.DomainResponse{SignatureDomain: make([]byte, 32)}, nil /*err*/) - testBlock := testutil.NewBeaconBlock() + testBlock := util.NewBeaconBlock() slot := params.BeaconConfig().SlotsPerEpoch*5 + 2 testBlock.Block.Slot = slot m.validatorClient.EXPECT().GetBlock( @@ -275,7 +275,7 @@ func TestProposeBlock_BlocksDoubleProposal(t *testing.T) { gomock.Any(), ).Return(testBlock.Block, nil /*err*/) - secondTestBlock := testutil.NewBeaconBlock() + secondTestBlock := util.NewBeaconBlock() secondTestBlock.Block.Slot = slot graffiti := [32]byte{} copy(graffiti[:], "someothergraffiti") @@ -323,7 +323,7 @@ func TestProposeBlockAltair_BlocksDoubleProposal(t *testing.T) { gomock.Any(), // epoch ).Times(1).Return(ðpb.DomainResponse{SignatureDomain: make([]byte, 32)}, nil /*err*/) - testBlock := testutil.NewBeaconBlockAltair() + testBlock := util.NewBeaconBlockAltair() slot := params.BeaconConfig().SlotsPerEpoch*5 + 2 testBlock.Block.Slot = slot m.validatorClient.EXPECT().GetBeaconBlock( @@ -333,7 +333,7 @@ func TestProposeBlockAltair_BlocksDoubleProposal(t *testing.T) { Block: ðpb.GenericBeaconBlock_Altair{Altair: testBlock.Block}, }, nil /*err*/) - secondTestBlock := testutil.NewBeaconBlockAltair() + secondTestBlock := util.NewBeaconBlockAltair() secondTestBlock.Block.Slot = slot graffiti := [32]byte{} copy(graffiti[:], "someothergraffiti") @@ -379,7 +379,7 @@ func TestProposeBlock_BlocksDoubleProposal_After54KEpochs(t *testing.T) { gomock.Any(), // epoch ).Times(1).Return(ðpb.DomainResponse{SignatureDomain: make([]byte, 32)}, nil /*err*/) - testBlock := testutil.NewBeaconBlock() + testBlock := util.NewBeaconBlock() farFuture := params.BeaconConfig().SlotsPerEpoch.Mul(uint64(params.BeaconConfig().WeakSubjectivityPeriod + 9)) testBlock.Block.Slot = farFuture m.validatorClient.EXPECT().GetBlock( @@ -387,7 +387,7 @@ func TestProposeBlock_BlocksDoubleProposal_After54KEpochs(t *testing.T) { gomock.Any(), ).Return(testBlock.Block, nil /*err*/) - secondTestBlock := testutil.NewBeaconBlock() + secondTestBlock := util.NewBeaconBlock() secondTestBlock.Block.Slot = farFuture graffiti := [32]byte{} copy(graffiti[:], "someothergraffiti") @@ -431,7 +431,7 @@ func TestProposeBlock_AllowsPastProposals(t *testing.T) { ).Times(2).Return(ðpb.DomainResponse{SignatureDomain: make([]byte, 32)}, nil /*err*/) farAhead := params.BeaconConfig().SlotsPerEpoch.Mul(uint64(params.BeaconConfig().WeakSubjectivityPeriod + 9)) - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.Slot = farAhead m.validatorClient.EXPECT().GetBlock( gomock.Any(), // ctx @@ -452,7 +452,7 @@ func TestProposeBlock_AllowsPastProposals(t *testing.T) { require.LogsDoNotContain(t, hook, failedPreBlockSignLocalErr) past := params.BeaconConfig().SlotsPerEpoch.Mul(uint64(params.BeaconConfig().WeakSubjectivityPeriod - 400)) - blk2 := testutil.NewBeaconBlock() + blk2 := util.NewBeaconBlock() blk2.Block.Slot = past m.validatorClient.EXPECT().GetBlock( gomock.Any(), // ctx @@ -479,7 +479,7 @@ func TestProposeBlock_AllowsSameEpoch(t *testing.T) { ).Times(2).Return(ðpb.DomainResponse{SignatureDomain: make([]byte, 32)}, nil /*err*/) farAhead := params.BeaconConfig().SlotsPerEpoch.Mul(uint64(params.BeaconConfig().WeakSubjectivityPeriod + 9)) - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.Slot = farAhead m.validatorClient.EXPECT().GetBlock( gomock.Any(), // ctx @@ -499,7 +499,7 @@ func TestProposeBlock_AllowsSameEpoch(t *testing.T) { validator.ProposeBlock(context.Background(), farAhead, pubKey) require.LogsDoNotContain(t, hook, failedPreBlockSignLocalErr) - blk2 := testutil.NewBeaconBlock() + blk2 := util.NewBeaconBlock() blk2.Block.Slot = farAhead - 4 m.validatorClient.EXPECT().GetBlock( gomock.Any(), // ctx @@ -524,7 +524,7 @@ func TestProposeBlock_BroadcastsBlock(t *testing.T) { m.validatorClient.EXPECT().GetBlock( gomock.Any(), // ctx gomock.Any(), - ).Return(testutil.NewBeaconBlock().Block, nil /*err*/) + ).Return(util.NewBeaconBlock().Block, nil /*err*/) m.validatorClient.EXPECT().DomainData( gomock.Any(), // ctx @@ -552,7 +552,7 @@ func TestProposeBlock_BroadcastsBlock_WithGraffiti(t *testing.T) { gomock.Any(), // epoch ).Return(ðpb.DomainResponse{SignatureDomain: make([]byte, 32)}, nil /*err*/) - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.Body.Graffiti = validator.graffiti m.validatorClient.EXPECT().GetBlock( gomock.Any(), // ctx @@ -595,7 +595,7 @@ func TestProposeBlockAltair_BroadcastsBlock_WithGraffiti(t *testing.T) { gomock.Any(), // epoch ).Return(ðpb.DomainResponse{SignatureDomain: make([]byte, 32)}, nil /*err*/) - blk := testutil.NewBeaconBlockAltair() + blk := util.NewBeaconBlockAltair() blk.Block.Body.Graffiti = validator.graffiti m.validatorClient.EXPECT().GetBeaconBlock( gomock.Any(), // ctx @@ -821,7 +821,7 @@ func TestSignBlock(t *testing.T) { DomainData(gomock.Any(), gomock.Any()). Return(ðpb.DomainResponse{SignatureDomain: proposerDomain}, nil) ctx := context.Background() - blk := testutil.NewBeaconBlock() + blk := util.NewBeaconBlock() blk.Block.Slot = 1 blk.Block.ProposerIndex = 100 var pubKey [48]byte @@ -854,7 +854,7 @@ func TestSignAltairBlock(t *testing.T) { DomainData(gomock.Any(), gomock.Any()). Return(ðpb.DomainResponse{SignatureDomain: proposerDomain}, nil) ctx := context.Background() - blk := testutil.NewBeaconBlockAltair() + blk := util.NewBeaconBlockAltair() blk.Block.Slot = 1 blk.Block.ProposerIndex = 100 var pubKey [48]byte diff --git a/validator/client/runner_test.go b/validator/client/runner_test.go index 21d100eef..682fad7b8 100644 --- a/validator/client/runner_test.go +++ b/validator/client/runner_test.go @@ -9,8 +9,8 @@ import ( types "github.com/prysmaticlabs/eth2-types" "github.com/prysmaticlabs/prysm/async/event" "github.com/prysmaticlabs/prysm/config/features" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/validator/client/iface" "github.com/prysmaticlabs/prysm/validator/client/testutil" "github.com/prysmaticlabs/prysm/validator/keymanager/remote" diff --git a/validator/client/service_test.go b/validator/client/service_test.go index 0a2822fd1..75a300ec7 100644 --- a/validator/client/service_test.go +++ b/validator/client/service_test.go @@ -7,8 +7,8 @@ import ( "time" "github.com/prysmaticlabs/prysm/runtime" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" logTest "github.com/sirupsen/logrus/hooks/test" "google.golang.org/grpc/metadata" ) diff --git a/validator/client/slashing_protection_interchange_test.go b/validator/client/slashing_protection_interchange_test.go index d4a602a0f..2bde13bab 100644 --- a/validator/client/slashing_protection_interchange_test.go +++ b/validator/client/slashing_protection_interchange_test.go @@ -13,8 +13,8 @@ import ( "github.com/prysmaticlabs/prysm/io/file" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" interchangeformat "github.com/prysmaticlabs/prysm/validator/slashing-protection/local/standard-protection-format" ) @@ -120,7 +120,7 @@ func TestEIP3076SpecTests(t *testing.T) { require.NoError(t, err) pk, err := interchangeformat.PubKeyFromHex(sb.Pubkey) require.NoError(t, err) - b := testutil.NewBeaconBlock() + b := util.NewBeaconBlock() b.Block.Slot = bSlot var signingRoot [32]byte diff --git a/validator/client/sync_committee_test.go b/validator/client/sync_committee_test.go index 68c955361..bc4099ffb 100644 --- a/validator/client/sync_committee_test.go +++ b/validator/client/sync_committee_test.go @@ -13,8 +13,8 @@ import ( "github.com/prysmaticlabs/prysm/encoding/bytesutil" eth "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" logTest "github.com/sirupsen/logrus/hooks/test" "google.golang.org/grpc" "google.golang.org/protobuf/types/known/emptypb" diff --git a/validator/client/validator_test.go b/validator/client/validator_test.go index 0eacb6861..eefcdf5a0 100644 --- a/validator/client/validator_test.go +++ b/validator/client/validator_test.go @@ -19,10 +19,10 @@ import ( "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" validatorpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client" - "github.com/prysmaticlabs/prysm/shared/testutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" mock2 "github.com/prysmaticlabs/prysm/testing/mock" + "github.com/prysmaticlabs/prysm/testing/require" + "github.com/prysmaticlabs/prysm/testing/util" "github.com/prysmaticlabs/prysm/validator/client/iface" dbTest "github.com/prysmaticlabs/prysm/validator/db/testing" "github.com/sirupsen/logrus" @@ -570,7 +570,7 @@ func TestUpdateDuties_OK(t *testing.T) { require.NoError(t, v.UpdateDuties(context.Background(), slot), "Could not update assignments") - testutil.WaitTimeout(&wg, 3*time.Second) + util.WaitTimeout(&wg, 3*time.Second) assert.Equal(t, params.BeaconConfig().SlotsPerEpoch+1, v.duties.Duties[0].ProposerSlots[0], "Unexpected validator assignments") assert.Equal(t, params.BeaconConfig().SlotsPerEpoch, v.duties.Duties[0].AttesterSlot, "Unexpected validator assignments") @@ -625,7 +625,7 @@ func TestUpdateDuties_OK_FilterBlacklistedPublicKeys(t *testing.T) { require.NoError(t, v.UpdateDuties(context.Background(), slot), "Could not update assignments") - testutil.WaitTimeout(&wg, 3*time.Second) + util.WaitTimeout(&wg, 3*time.Second) for range blacklistedPublicKeys { assert.LogsContain(t, hook, "Not including slashable public key") diff --git a/validator/client/wait_for_activation_test.go b/validator/client/wait_for_activation_test.go index f7b525e8a..526a8d06d 100644 --- a/validator/client/wait_for_activation_test.go +++ b/validator/client/wait_for_activation_test.go @@ -12,9 +12,9 @@ import ( "github.com/prysmaticlabs/prysm/crypto/bls" "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" "github.com/prysmaticlabs/prysm/testing/mock" + "github.com/prysmaticlabs/prysm/testing/require" slotutilmock "github.com/prysmaticlabs/prysm/time/slots/testing" walletMock "github.com/prysmaticlabs/prysm/validator/accounts/testing" "github.com/prysmaticlabs/prysm/validator/client/testutil" diff --git a/validator/db/BUILD.bazel b/validator/db/BUILD.bazel index cacb32f9a..9363b0272 100644 --- a/validator/db/BUILD.bazel +++ b/validator/db/BUILD.bazel @@ -35,8 +35,8 @@ go_test( deps = [ "//cmd:go_default_library", "//config/params:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "//validator/db/kv:go_default_library", "//validator/db/testing:go_default_library", "@com_github_sirupsen_logrus//hooks/test:go_default_library", diff --git a/validator/db/kv/BUILD.bazel b/validator/db/kv/BUILD.bazel index f825e3fac..813f4c919 100644 --- a/validator/db/kv/BUILD.bazel +++ b/validator/db/kv/BUILD.bazel @@ -63,8 +63,8 @@ go_test( "//crypto/hash:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/prysm/v1alpha1:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", "@com_github_sirupsen_logrus//hooks/test:go_default_library", diff --git a/validator/db/kv/attester_protection_test.go b/validator/db/kv/attester_protection_test.go index 79e18d179..b07b6fa0e 100644 --- a/validator/db/kv/attester_protection_test.go +++ b/validator/db/kv/attester_protection_test.go @@ -11,8 +11,8 @@ import ( types "github.com/prysmaticlabs/eth2-types" "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" logTest "github.com/sirupsen/logrus/hooks/test" bolt "go.etcd.io/bbolt" ) diff --git a/validator/db/kv/backup_test.go b/validator/db/kv/backup_test.go index 3d947e31a..f1db57440 100644 --- a/validator/db/kv/backup_test.go +++ b/validator/db/kv/backup_test.go @@ -8,7 +8,7 @@ import ( "testing" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestStore_Backup(t *testing.T) { diff --git a/validator/db/kv/deprecated_attester_protection_test.go b/validator/db/kv/deprecated_attester_protection_test.go index 21835a65b..696504217 100644 --- a/validator/db/kv/deprecated_attester_protection_test.go +++ b/validator/db/kv/deprecated_attester_protection_test.go @@ -7,8 +7,8 @@ import ( types "github.com/prysmaticlabs/eth2-types" "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/encoding/bytesutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestNewAttestationHistoryArray(t *testing.T) { diff --git a/validator/db/kv/eip_blacklisted_keys_test.go b/validator/db/kv/eip_blacklisted_keys_test.go index ccfac95cc..458fc8fad 100644 --- a/validator/db/kv/eip_blacklisted_keys_test.go +++ b/validator/db/kv/eip_blacklisted_keys_test.go @@ -5,8 +5,8 @@ import ( "fmt" "testing" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestStore_EIPBlacklistedPublicKeys(t *testing.T) { diff --git a/validator/db/kv/genesis_test.go b/validator/db/kv/genesis_test.go index 5975c3d00..c08054f97 100644 --- a/validator/db/kv/genesis_test.go +++ b/validator/db/kv/genesis_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/prysmaticlabs/prysm/config/params" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestStore_GenesisValidatorsRoot_ReadAndWrite(t *testing.T) { diff --git a/validator/db/kv/graffiti_test.go b/validator/db/kv/graffiti_test.go index 1106f2ce2..6b78bd8b4 100644 --- a/validator/db/kv/graffiti_test.go +++ b/validator/db/kv/graffiti_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/prysmaticlabs/prysm/crypto/hash" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestStore_GraffitiOrderedIndex_ReadAndWrite(t *testing.T) { diff --git a/validator/db/kv/kv_test.go b/validator/db/kv/kv_test.go index 9e7e3a39c..3ef6472c1 100644 --- a/validator/db/kv/kv_test.go +++ b/validator/db/kv/kv_test.go @@ -5,7 +5,7 @@ import ( "io/ioutil" "testing" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/sirupsen/logrus" ) diff --git a/validator/db/kv/migration_optimal_attester_protection_test.go b/validator/db/kv/migration_optimal_attester_protection_test.go index fe6546a5f..b2c54defa 100644 --- a/validator/db/kv/migration_optimal_attester_protection_test.go +++ b/validator/db/kv/migration_optimal_attester_protection_test.go @@ -7,7 +7,7 @@ import ( types "github.com/prysmaticlabs/eth2-types" "github.com/prysmaticlabs/prysm/encoding/bytesutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" bolt "go.etcd.io/bbolt" ) diff --git a/validator/db/kv/migration_source_target_epochs_bucket_test.go b/validator/db/kv/migration_source_target_epochs_bucket_test.go index 332cf0442..46380cb59 100644 --- a/validator/db/kv/migration_source_target_epochs_bucket_test.go +++ b/validator/db/kv/migration_source_target_epochs_bucket_test.go @@ -8,7 +8,7 @@ import ( "testing" "github.com/prysmaticlabs/prysm/encoding/bytesutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" bolt "go.etcd.io/bbolt" ) diff --git a/validator/db/kv/proposer_protection_test.go b/validator/db/kv/proposer_protection_test.go index 11eb7c898..b3bb05027 100644 --- a/validator/db/kv/proposer_protection_test.go +++ b/validator/db/kv/proposer_protection_test.go @@ -7,8 +7,8 @@ import ( types "github.com/prysmaticlabs/eth2-types" "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/encoding/bytesutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestProposalHistoryForSlot_InitializesNewPubKeys(t *testing.T) { diff --git a/validator/db/kv/prune_attester_protection_test.go b/validator/db/kv/prune_attester_protection_test.go index a6949084e..fefbcba5d 100644 --- a/validator/db/kv/prune_attester_protection_test.go +++ b/validator/db/kv/prune_attester_protection_test.go @@ -8,7 +8,7 @@ import ( types "github.com/prysmaticlabs/eth2-types" "github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/encoding/bytesutil" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" bolt "go.etcd.io/bbolt" ) diff --git a/validator/db/migrate_test.go b/validator/db/migrate_test.go index 4e9171fda..b796c2398 100644 --- a/validator/db/migrate_test.go +++ b/validator/db/migrate_test.go @@ -5,8 +5,8 @@ import ( "testing" "github.com/prysmaticlabs/prysm/cmd" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" dbtest "github.com/prysmaticlabs/prysm/validator/db/testing" "github.com/urfave/cli/v2" ) diff --git a/validator/db/restore_test.go b/validator/db/restore_test.go index 505630741..db9fe8e75 100644 --- a/validator/db/restore_test.go +++ b/validator/db/restore_test.go @@ -10,8 +10,8 @@ import ( "github.com/prysmaticlabs/prysm/cmd" "github.com/prysmaticlabs/prysm/config/params" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/validator/db/kv" logTest "github.com/sirupsen/logrus/hooks/test" "github.com/urfave/cli/v2" diff --git a/validator/db/testing/BUILD.bazel b/validator/db/testing/BUILD.bazel index 01377a09f..4a236a0b7 100644 --- a/validator/db/testing/BUILD.bazel +++ b/validator/db/testing/BUILD.bazel @@ -16,7 +16,7 @@ go_test( srcs = ["setup_db_test.go"], embed = [":go_default_library"], deps = [ - "//shared/testutil/require:go_default_library", + "//testing/require:go_default_library", "//validator/db/kv:go_default_library", ], ) diff --git a/validator/db/testing/setup_db_test.go b/validator/db/testing/setup_db_test.go index 584cc5214..6bde03600 100644 --- a/validator/db/testing/setup_db_test.go +++ b/validator/db/testing/setup_db_test.go @@ -6,7 +6,7 @@ import ( "path/filepath" "testing" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/validator/db/kv" ) diff --git a/validator/graffiti/BUILD.bazel b/validator/graffiti/BUILD.bazel index 4a6aaaed5..844dc2dd4 100644 --- a/validator/graffiti/BUILD.bazel +++ b/validator/graffiti/BUILD.bazel @@ -22,8 +22,8 @@ go_test( embed = [":go_default_library"], deps = [ "//crypto/hash:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", ], ) diff --git a/validator/graffiti/parse_graffiti_test.go b/validator/graffiti/parse_graffiti_test.go index 997444455..9f0482a1d 100644 --- a/validator/graffiti/parse_graffiti_test.go +++ b/validator/graffiti/parse_graffiti_test.go @@ -8,8 +8,8 @@ import ( types "github.com/prysmaticlabs/eth2-types" "github.com/prysmaticlabs/prysm/crypto/hash" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestParseGraffitiFile_Default(t *testing.T) { diff --git a/validator/keymanager/derived/BUILD.bazel b/validator/keymanager/derived/BUILD.bazel index fe27ea499..c36d16e2f 100644 --- a/validator/keymanager/derived/BUILD.bazel +++ b/validator/keymanager/derived/BUILD.bazel @@ -40,8 +40,8 @@ go_test( "//crypto/bls:go_default_library", "//crypto/rand:go_default_library", "//proto/prysm/v1alpha1/validator-client:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "//validator/accounts/testing:go_default_library", "//validator/testing:go_default_library", "@com_github_tyler_smith_go_bip39//:go_default_library", diff --git a/validator/keymanager/derived/eip_test.go b/validator/keymanager/derived/eip_test.go index 5af99a00f..7b96fa931 100644 --- a/validator/keymanager/derived/eip_test.go +++ b/validator/keymanager/derived/eip_test.go @@ -6,8 +6,8 @@ import ( "testing" "github.com/prysmaticlabs/prysm/crypto/bls" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" util "github.com/wealdtech/go-eth2-util" ) diff --git a/validator/keymanager/derived/keymanager_test.go b/validator/keymanager/derived/keymanager_test.go index db2263cbe..2fe7b84d8 100644 --- a/validator/keymanager/derived/keymanager_test.go +++ b/validator/keymanager/derived/keymanager_test.go @@ -8,8 +8,8 @@ import ( "github.com/prysmaticlabs/prysm/crypto/bls" "github.com/prysmaticlabs/prysm/crypto/rand" validatorpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" mock "github.com/prysmaticlabs/prysm/validator/accounts/testing" constant "github.com/prysmaticlabs/prysm/validator/testing" "github.com/tyler-smith/go-bip39" diff --git a/validator/keymanager/derived/mnemonic_test.go b/validator/keymanager/derived/mnemonic_test.go index 5f0048813..b8eb4636e 100644 --- a/validator/keymanager/derived/mnemonic_test.go +++ b/validator/keymanager/derived/mnemonic_test.go @@ -3,8 +3,8 @@ package derived import ( "testing" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/tyler-smith/go-bip39" ) diff --git a/validator/keymanager/imported/BUILD.bazel b/validator/keymanager/imported/BUILD.bazel index 5c8574ec8..c184ef789 100644 --- a/validator/keymanager/imported/BUILD.bazel +++ b/validator/keymanager/imported/BUILD.bazel @@ -54,8 +54,8 @@ go_test( "//crypto/bls:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/prysm/v1alpha1/validator-client:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "//validator/accounts/testing:go_default_library", "//validator/keymanager:go_default_library", "@com_github_google_uuid//:go_default_library", diff --git a/validator/keymanager/imported/backup_test.go b/validator/keymanager/imported/backup_test.go index 85ca1b562..7913a593f 100644 --- a/validator/keymanager/imported/backup_test.go +++ b/validator/keymanager/imported/backup_test.go @@ -7,8 +7,8 @@ import ( "github.com/prysmaticlabs/prysm/crypto/bls" "github.com/prysmaticlabs/prysm/encoding/bytesutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" ) func TestImportedKeymanager_ExtractKeystores(t *testing.T) { diff --git a/validator/keymanager/imported/import_test.go b/validator/keymanager/imported/import_test.go index f211fc64f..cc4a0e2fe 100644 --- a/validator/keymanager/imported/import_test.go +++ b/validator/keymanager/imported/import_test.go @@ -9,8 +9,8 @@ import ( "github.com/google/uuid" "github.com/prysmaticlabs/prysm/crypto/bls" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" mock "github.com/prysmaticlabs/prysm/validator/accounts/testing" "github.com/prysmaticlabs/prysm/validator/keymanager" logTest "github.com/sirupsen/logrus/hooks/test" diff --git a/validator/keymanager/imported/keymanager_test.go b/validator/keymanager/imported/keymanager_test.go index dcec0073c..5add2eff4 100644 --- a/validator/keymanager/imported/keymanager_test.go +++ b/validator/keymanager/imported/keymanager_test.go @@ -10,8 +10,8 @@ import ( "github.com/prysmaticlabs/prysm/crypto/bls" "github.com/prysmaticlabs/prysm/encoding/bytesutil" validatorpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" mock "github.com/prysmaticlabs/prysm/validator/accounts/testing" "github.com/prysmaticlabs/prysm/validator/keymanager" logTest "github.com/sirupsen/logrus/hooks/test" diff --git a/validator/keymanager/imported/refresh_test.go b/validator/keymanager/imported/refresh_test.go index c9b53e2d8..700f0a05d 100644 --- a/validator/keymanager/imported/refresh_test.go +++ b/validator/keymanager/imported/refresh_test.go @@ -9,8 +9,8 @@ import ( "github.com/prysmaticlabs/prysm/async/event" "github.com/prysmaticlabs/prysm/crypto/bls" "github.com/prysmaticlabs/prysm/encoding/bytesutil" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" mock "github.com/prysmaticlabs/prysm/validator/accounts/testing" keystorev4 "github.com/wealdtech/go-eth2-wallet-encryptor-keystorev4" ) diff --git a/validator/keymanager/remote/BUILD.bazel b/validator/keymanager/remote/BUILD.bazel index b09137913..cc0bbefc8 100644 --- a/validator/keymanager/remote/BUILD.bazel +++ b/validator/keymanager/remote/BUILD.bazel @@ -38,9 +38,9 @@ go_test( "//crypto/bls:go_default_library", "//encoding/bytesutil:go_default_library", "//proto/prysm/v1alpha1/validator-client:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", "//testing/mock:go_default_library", + "//testing/require:go_default_library", "//validator/keymanager:go_default_library", "@com_github_golang_mock//gomock:go_default_library", "@com_github_sirupsen_logrus//hooks/test:go_default_library", diff --git a/validator/keymanager/remote/keymanager_test.go b/validator/keymanager/remote/keymanager_test.go index 5d642fd66..eab330a83 100644 --- a/validator/keymanager/remote/keymanager_test.go +++ b/validator/keymanager/remote/keymanager_test.go @@ -17,9 +17,9 @@ import ( "github.com/prysmaticlabs/prysm/crypto/bls" "github.com/prysmaticlabs/prysm/encoding/bytesutil" validatorpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" "github.com/prysmaticlabs/prysm/testing/mock" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/validator/keymanager" logTest "github.com/sirupsen/logrus/hooks/test" ) diff --git a/validator/node/BUILD.bazel b/validator/node/BUILD.bazel index aae07b59e..7a1407762 100644 --- a/validator/node/BUILD.bazel +++ b/validator/node/BUILD.bazel @@ -7,7 +7,7 @@ go_test( embed = [":go_default_library"], deps = [ "//cmd/validator/flags:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/require:go_default_library", "//validator/accounts:go_default_library", "//validator/accounts/wallet:go_default_library", "//validator/keymanager:go_default_library", diff --git a/validator/node/node_test.go b/validator/node/node_test.go index 24fd4d97b..96873fea7 100644 --- a/validator/node/node_test.go +++ b/validator/node/node_test.go @@ -9,7 +9,7 @@ import ( "testing" "github.com/prysmaticlabs/prysm/cmd/validator/flags" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/validator/accounts" "github.com/prysmaticlabs/prysm/validator/accounts/wallet" "github.com/prysmaticlabs/prysm/validator/keymanager" diff --git a/validator/rpc/BUILD.bazel b/validator/rpc/BUILD.bazel index e8761534d..1a517eafa 100644 --- a/validator/rpc/BUILD.bazel +++ b/validator/rpc/BUILD.bazel @@ -86,9 +86,9 @@ go_test( "//io/file:go_default_library", "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/validator-client:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", "//testing/mock:go_default_library", + "//testing/require:go_default_library", "//time:go_default_library", "//validator/accounts:go_default_library", "//validator/accounts/iface:go_default_library", diff --git a/validator/rpc/accounts_test.go b/validator/rpc/accounts_test.go index 38e299c12..422e03132 100644 --- a/validator/rpc/accounts_test.go +++ b/validator/rpc/accounts_test.go @@ -16,9 +16,9 @@ import ( "github.com/prysmaticlabs/prysm/encoding/bytesutil" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" mock2 "github.com/prysmaticlabs/prysm/testing/mock" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/validator/accounts" "github.com/prysmaticlabs/prysm/validator/accounts/iface" "github.com/prysmaticlabs/prysm/validator/accounts/wallet" diff --git a/validator/rpc/auth_test.go b/validator/rpc/auth_test.go index 6593c74a9..78b27d8a7 100644 --- a/validator/rpc/auth_test.go +++ b/validator/rpc/auth_test.go @@ -11,8 +11,8 @@ import ( "github.com/prysmaticlabs/prysm/async/event" "github.com/prysmaticlabs/prysm/io/file" pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/validator/accounts" "github.com/prysmaticlabs/prysm/validator/accounts/wallet" dbtest "github.com/prysmaticlabs/prysm/validator/db/testing" diff --git a/validator/rpc/beacon_test.go b/validator/rpc/beacon_test.go index 5f0f0fda2..e9cf0f06f 100644 --- a/validator/rpc/beacon_test.go +++ b/validator/rpc/beacon_test.go @@ -10,9 +10,9 @@ import ( "github.com/pkg/errors" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" mock2 "github.com/prysmaticlabs/prysm/testing/mock" + "github.com/prysmaticlabs/prysm/testing/require" "google.golang.org/grpc/metadata" "google.golang.org/protobuf/types/known/timestamppb" ) diff --git a/validator/rpc/health_test.go b/validator/rpc/health_test.go index 76fad1dc7..dcf61022d 100644 --- a/validator/rpc/health_test.go +++ b/validator/rpc/health_test.go @@ -8,7 +8,7 @@ import ( "github.com/golang/protobuf/ptypes/empty" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/validator/client" "google.golang.org/protobuf/types/known/timestamppb" ) diff --git a/validator/rpc/intercepter_test.go b/validator/rpc/intercepter_test.go index 45c5b76f6..1f0e9119b 100644 --- a/validator/rpc/intercepter_test.go +++ b/validator/rpc/intercepter_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/golang-jwt/jwt" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/time" "google.golang.org/grpc" "google.golang.org/grpc/metadata" diff --git a/validator/rpc/slashing_test.go b/validator/rpc/slashing_test.go index fa11a9047..ca841e083 100644 --- a/validator/rpc/slashing_test.go +++ b/validator/rpc/slashing_test.go @@ -7,7 +7,7 @@ import ( "github.com/golang/protobuf/ptypes/empty" pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/validator/accounts" "github.com/prysmaticlabs/prysm/validator/accounts/wallet" "github.com/prysmaticlabs/prysm/validator/db/kv" diff --git a/validator/rpc/wallet_test.go b/validator/rpc/wallet_test.go index a7526510c..1967e4d95 100644 --- a/validator/rpc/wallet_test.go +++ b/validator/rpc/wallet_test.go @@ -15,8 +15,8 @@ import ( "github.com/prysmaticlabs/prysm/crypto/bls" "github.com/prysmaticlabs/prysm/io/file" pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/validator/accounts" "github.com/prysmaticlabs/prysm/validator/accounts/iface" "github.com/prysmaticlabs/prysm/validator/accounts/wallet" diff --git a/validator/slashing-protection/BUILD.bazel b/validator/slashing-protection/BUILD.bazel index 22276c408..d6a83a4eb 100644 --- a/validator/slashing-protection/BUILD.bazel +++ b/validator/slashing-protection/BUILD.bazel @@ -51,8 +51,8 @@ go_test( "//encoding/bytesutil:go_default_library", "//io/file:go_default_library", "//proto/prysm/v1alpha1:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "//validator/db/kv:go_default_library", "//validator/db/testing:go_default_library", "//validator/slashing-protection/local/standard-protection-format/format:go_default_library", diff --git a/validator/slashing-protection/cli_import_export_test.go b/validator/slashing-protection/cli_import_export_test.go index c4afec099..34b312e2a 100644 --- a/validator/slashing-protection/cli_import_export_test.go +++ b/validator/slashing-protection/cli_import_export_test.go @@ -10,8 +10,8 @@ import ( "github.com/prysmaticlabs/prysm/cmd" "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/io/file" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/validator/db/kv" dbTest "github.com/prysmaticlabs/prysm/validator/db/testing" "github.com/prysmaticlabs/prysm/validator/slashing-protection/local/standard-protection-format/format" diff --git a/validator/slashing-protection/external_test.go b/validator/slashing-protection/external_test.go index 6118a0f0c..ead8f71cc 100644 --- a/validator/slashing-protection/external_test.go +++ b/validator/slashing-protection/external_test.go @@ -6,7 +6,7 @@ import ( "github.com/prysmaticlabs/prysm/encoding/bytesutil" eth "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" mockSlasher "github.com/prysmaticlabs/prysm/validator/testing" ) diff --git a/validator/slashing-protection/local/standard-protection-format/BUILD.bazel b/validator/slashing-protection/local/standard-protection-format/BUILD.bazel index 387a7c9c3..84946a4ae 100644 --- a/validator/slashing-protection/local/standard-protection-format/BUILD.bazel +++ b/validator/slashing-protection/local/standard-protection-format/BUILD.bazel @@ -38,8 +38,8 @@ go_test( embed = [":go_default_library"], deps = [ "//proto/prysm/v1alpha1:go_default_library", - "//shared/testutil/assert:go_default_library", - "//shared/testutil/require:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", "//validator/db/kv:go_default_library", "//validator/db/testing:go_default_library", "//validator/slashing-protection/local/standard-protection-format/format:go_default_library", diff --git a/validator/slashing-protection/local/standard-protection-format/export_test.go b/validator/slashing-protection/local/standard-protection-format/export_test.go index 7a1de79df..b07e88b7e 100644 --- a/validator/slashing-protection/local/standard-protection-format/export_test.go +++ b/validator/slashing-protection/local/standard-protection-format/export_test.go @@ -6,8 +6,8 @@ import ( "testing" types "github.com/prysmaticlabs/eth2-types" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" dbtest "github.com/prysmaticlabs/prysm/validator/db/testing" "github.com/prysmaticlabs/prysm/validator/slashing-protection/local/standard-protection-format/format" ) diff --git a/validator/slashing-protection/local/standard-protection-format/import_test.go b/validator/slashing-protection/local/standard-protection-format/import_test.go index 0c42792eb..45458e829 100644 --- a/validator/slashing-protection/local/standard-protection-format/import_test.go +++ b/validator/slashing-protection/local/standard-protection-format/import_test.go @@ -11,8 +11,8 @@ import ( types "github.com/prysmaticlabs/eth2-types" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/validator/db/kv" dbtest "github.com/prysmaticlabs/prysm/validator/db/testing" "github.com/prysmaticlabs/prysm/validator/slashing-protection/local/standard-protection-format/format" diff --git a/validator/slashing-protection/local/standard-protection-format/round_trip_test.go b/validator/slashing-protection/local/standard-protection-format/round_trip_test.go index 12231e3ce..f20052745 100644 --- a/validator/slashing-protection/local/standard-protection-format/round_trip_test.go +++ b/validator/slashing-protection/local/standard-protection-format/round_trip_test.go @@ -8,8 +8,8 @@ import ( "testing" types "github.com/prysmaticlabs/eth2-types" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" "github.com/prysmaticlabs/prysm/validator/db/kv" dbtest "github.com/prysmaticlabs/prysm/validator/db/testing" protectionFormat "github.com/prysmaticlabs/prysm/validator/slashing-protection/local/standard-protection-format" diff --git a/validator/slashing-protection/slasher_client_test.go b/validator/slashing-protection/slasher_client_test.go index 5dda0590c..de9c755e7 100644 --- a/validator/slashing-protection/slasher_client_test.go +++ b/validator/slashing-protection/slasher_client_test.go @@ -4,8 +4,8 @@ import ( "context" "testing" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" - "github.com/prysmaticlabs/prysm/shared/testutil/require" + "github.com/prysmaticlabs/prysm/testing/assert" + "github.com/prysmaticlabs/prysm/testing/require" "google.golang.org/grpc/metadata" ) diff --git a/validator/web/BUILD.bazel b/validator/web/BUILD.bazel index 3344f8067..dec83d0d9 100644 --- a/validator/web/BUILD.bazel +++ b/validator/web/BUILD.bazel @@ -34,5 +34,5 @@ go_test( name = "go_default_test", srcs = ["handler_test.go"], embed = [":go_default_library"], - deps = ["//shared/testutil/assert:go_default_library"], + deps = ["//testing/assert:go_default_library"], ) diff --git a/validator/web/handler_test.go b/validator/web/handler_test.go index c1a3c8a7c..14ed59d9b 100644 --- a/validator/web/handler_test.go +++ b/validator/web/handler_test.go @@ -5,7 +5,7 @@ import ( "net/http/httptest" "testing" - "github.com/prysmaticlabs/prysm/shared/testutil/assert" + "github.com/prysmaticlabs/prysm/testing/assert" ) func TestHandler(t *testing.T) {