mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 04:54:05 -05:00
Change gogoproto compiler to protoc-gen-go-cast (#8697)
* Remove gogoproto compiler * Remove more gogoproto * Improvements * Fix gengo * More scripts * Gazelle, fix deps * Fix version and errors * Fix gocast for arrays * Fix ethapis * Fixes * Fix compile errors * fix go.mod * //proto/... builds * Update for protov2 * temp fix compilation to move on * Change everything to emptypb.empty * Add grpc to proto/slashings * Fix almost all build failures * Oher build problems * FIX THIS FUCKING THING * gaz literally every .bazel * Final touches * Final final touches * Fix proto * Begin moving proto.Marshal to native * Fix site_data * Fixes * Fix duplicate gateway * Fix gateway target * Fix ethapis * Fixes from review * Update * Fix * Fix status test * Fix fuzz * Add isprotoslice to fun * Change DeepEqual to DeepSSZEqual for proto arrays * Fix build * Fix gaz * Update go * Fixes * Fixes * Add case for nil validators after copy * Fix cast * Fix test * Fix imports * Go mod * Only use extension where needed * Fixes * Split gateway from gengo * gaz * go mod * Add back hydrated state * fix hydrate * Fix proto.clone * Fies * Revert "Split gateway from gengo" This reverts commit7298bb2054. * Revert "gaz" This reverts commitca95256570. * Merge all gateway into one target * go mod * Gaz * Add generate v1_gateway files * run pb again * goimports * gaz * Fix comments * Fix protos * Fix PR * Fix protos * Update grpc-gateway and ethapis * Update ethapis and gen-go-cast * Go tidy * Reorder * Fix ethapis * fix spec tests * Fix script * Remove unused import * Fix fuzz * Fix gomod * Update version * Error if the cloned result is nil * Handle optional slots * ADd more empty checks to clone * Undo fuzz changes * Fix build.bazel * Gaz * Redo fuzz changes * Undo some eth1data changes * Update go.mod Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com> * Undo clone beacon state * Remove gogo proto more and unused v1_gateway * Add manual fix for nil vals * Fix gaz * tidy * Tidy again * Add detailed error * Revert "Add detailed error" This reverts commit59bc053dcd. * Undo varint changes * Fix nil validators in deposit test * Commit * Undo Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com> Co-authored-by: Radosław Kapka <rkapka@wp.pl> Co-authored-by: Nishant Das <nishdas93@gmail.com> Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
This commit is contained in:
21
BUILD.bazel
21
BUILD.bazel
@@ -23,7 +23,16 @@ gazelle(
|
||||
# Protobuf compiler (non-gRPC)
|
||||
alias(
|
||||
name = "proto_compiler",
|
||||
actual = "@io_bazel_rules_go//proto:gogofast_proto",
|
||||
actual = "@io_bazel_rules_go//proto:go_proto",
|
||||
visibility = [
|
||||
"//proto:__subpackages__",
|
||||
],
|
||||
)
|
||||
|
||||
# Cast protobuf compiler (non-gRPC)
|
||||
alias(
|
||||
name = "cast_proto_compiler",
|
||||
actual = "@com_github_prysmaticlabs_protoc_gen_go_cast//:go_cast",
|
||||
visibility = [
|
||||
"//proto:__subpackages__",
|
||||
],
|
||||
@@ -32,21 +41,21 @@ alias(
|
||||
# Protobuf compiler (gRPC)
|
||||
alias(
|
||||
name = "grpc_proto_compiler",
|
||||
actual = "@io_bazel_rules_go//proto:gogofast_grpc",
|
||||
actual = "@io_bazel_rules_go//proto:go_grpc",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# Protobuf gRPC compiler without gogoproto. Required for gRPC gateway.
|
||||
# Cast protobuf compiler (gRPC)
|
||||
alias(
|
||||
name = "grpc_nogogo_proto_compiler",
|
||||
actual = "@io_bazel_rules_go//proto:go_grpc",
|
||||
name = "cast_grpc_proto_compiler",
|
||||
actual = "@com_github_prysmaticlabs_protoc_gen_go_cast//:go_cast_grpc",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# Protobuf gRPC gateway compiler
|
||||
alias(
|
||||
name = "grpc_gateway_proto_compiler",
|
||||
actual = "@com_github_grpc_ecosystem_grpc_gateway//protoc-gen-grpc-gateway:go_gen_grpc_gateway",
|
||||
actual = "@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-grpc-gateway:go_gen_grpc_gateway",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
|
||||
@@ -286,9 +286,9 @@ buildifier_dependencies()
|
||||
|
||||
git_repository(
|
||||
name = "com_google_protobuf",
|
||||
commit = "fde7cf7358ec7cd69e8db9be4f1fa6a5c431386a", # v3.13.0
|
||||
commit = "436bd7880e458532901c58f4d9d1ea23fa7edd52",
|
||||
remote = "https://github.com/protocolbuffers/protobuf",
|
||||
shallow_since = "1597443653 -0700",
|
||||
shallow_since = "1617835118 -0700",
|
||||
)
|
||||
|
||||
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
|
||||
|
||||
@@ -116,11 +116,11 @@ go_test(
|
||||
"@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",
|
||||
"@com_github_gogo_protobuf//proto:go_default_library",
|
||||
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
|
||||
"@com_github_sirupsen_logrus//:go_default_library",
|
||||
"@com_github_sirupsen_logrus//hooks/test:go_default_library",
|
||||
"@in_gopkg_d4l3k_messagediff_v1//:go_default_library",
|
||||
"@org_golang_google_protobuf//proto:go_default_library",
|
||||
"@org_golang_x_net//context:go_default_library",
|
||||
],
|
||||
)
|
||||
@@ -165,10 +165,10 @@ go_test(
|
||||
"@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",
|
||||
"@com_github_gogo_protobuf//proto:go_default_library",
|
||||
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
|
||||
"@com_github_sirupsen_logrus//:go_default_library",
|
||||
"@com_github_sirupsen_logrus//hooks/test:go_default_library",
|
||||
"@org_golang_google_protobuf//proto:go_default_library",
|
||||
"@org_golang_x_net//context:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
|
||||
@@ -18,6 +17,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
// Ensure Service implements chain info interface.
|
||||
|
||||
@@ -8,7 +8,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/gogo/protobuf/proto"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/cache/depositcache"
|
||||
b "github.com/prysmaticlabs/prysm/beacon-chain/core/blocks"
|
||||
@@ -34,6 +33,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
logTest "github.com/sirupsen/logrus/hooks/test"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
type mockBeaconNode struct {
|
||||
|
||||
2
beacon-chain/cache/BUILD.bazel
vendored
2
beacon-chain/cache/BUILD.bazel
vendored
@@ -69,9 +69,9 @@ go_test(
|
||||
"//shared/params:go_default_library",
|
||||
"//shared/testutil/assert:go_default_library",
|
||||
"//shared/testutil/require:go_default_library",
|
||||
"@com_github_gogo_protobuf//proto:go_default_library",
|
||||
"@com_github_google_gofuzz//:go_default_library",
|
||||
"@com_github_prysmaticlabs_eth2_types//:go_default_library",
|
||||
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
|
||||
"@org_golang_google_protobuf//proto:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
2
beacon-chain/cache/attestation_data_test.go
vendored
2
beacon-chain/cache/attestation_data_test.go
vendored
@@ -4,10 +4,10 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/cache"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func TestAttestationCache_RoundTrip(t *testing.T) {
|
||||
|
||||
2
beacon-chain/cache/checkpoint_state_test.go
vendored
2
beacon-chain/cache/checkpoint_state_test.go
vendored
@@ -3,7 +3,6 @@ package cache
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
iface "github.com/prysmaticlabs/prysm/beacon-chain/state/interface"
|
||||
@@ -13,6 +12,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/params"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func TestCheckpointStateCache_StateByCheckpoint(t *testing.T) {
|
||||
|
||||
2
beacon-chain/cache/depositcache/BUILD.bazel
vendored
2
beacon-chain/cache/depositcache/BUILD.bazel
vendored
@@ -39,8 +39,8 @@ go_test(
|
||||
"//shared/testutil/assert:go_default_library",
|
||||
"//shared/testutil/require:go_default_library",
|
||||
"//shared/trieutil:go_default_library",
|
||||
"@com_github_gogo_protobuf//proto:go_default_library",
|
||||
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
|
||||
"@com_github_sirupsen_logrus//hooks/test:go_default_library",
|
||||
"@org_golang_google_protobuf//proto:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -5,11 +5,11 @@ import (
|
||||
"math/big"
|
||||
"testing"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
dbpb "github.com/prysmaticlabs/prysm/proto/beacon/db"
|
||||
"github.com/prysmaticlabs/prysm/shared/bytesutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
var _ PendingDepositsFetcher = (*DepositCache)(nil)
|
||||
@@ -90,7 +90,7 @@ func TestPendingDeposits_OK(t *testing.T) {
|
||||
{Proof: [][]byte{[]byte("A")}},
|
||||
{Proof: [][]byte{[]byte("B")}},
|
||||
}
|
||||
assert.DeepEqual(t, expected, deposits)
|
||||
assert.DeepSSZEqual(t, expected, deposits)
|
||||
|
||||
all := dc.PendingDeposits(context.Background(), nil)
|
||||
assert.Equal(t, len(dc.pendingDeposits), len(all), "PendingDeposits(ctx, nil) did not return all deposits")
|
||||
|
||||
@@ -40,12 +40,12 @@ go_library(
|
||||
"//shared/slashutil:go_default_library",
|
||||
"//shared/sliceutil:go_default_library",
|
||||
"//shared/trieutil:go_default_library",
|
||||
"@com_github_gogo_protobuf//proto:go_default_library",
|
||||
"@com_github_pkg_errors//:go_default_library",
|
||||
"@com_github_prysmaticlabs_eth2_types//:go_default_library",
|
||||
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
|
||||
"@com_github_sirupsen_logrus//:go_default_library",
|
||||
"@io_opencensus_go//trace:go_default_library",
|
||||
"@org_golang_google_protobuf//proto:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -87,11 +87,11 @@ go_test(
|
||||
"//shared/testutil/assert:go_default_library",
|
||||
"//shared/testutil/require:go_default_library",
|
||||
"//shared/trieutil:go_default_library",
|
||||
"@com_github_gogo_protobuf//proto:go_default_library",
|
||||
"@com_github_google_gofuzz//:go_default_library",
|
||||
"@com_github_prysmaticlabs_eth2_types//:go_default_library",
|
||||
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
|
||||
"@com_github_prysmaticlabs_go_bitfield//:go_default_library",
|
||||
"@com_github_sirupsen_logrus//:go_default_library",
|
||||
"@org_golang_google_protobuf//proto:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/core/blocks"
|
||||
@@ -16,6 +15,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func FakeDeposits(n uint64) []*ethpb.Eth1Data {
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"io/ioutil"
|
||||
"testing"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/core/blocks"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
|
||||
@@ -17,6 +16,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"github.com/sirupsen/logrus"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
@@ -4,13 +4,13 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/pkg/errors"
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
|
||||
iface "github.com/prysmaticlabs/prysm/beacon-chain/state/interface"
|
||||
"github.com/prysmaticlabs/prysm/shared/params"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
type slashValidatorFunc func(iface.BeaconState, types.ValidatorIndex) (iface.BeaconState, error)
|
||||
|
||||
@@ -42,10 +42,10 @@ go_test(
|
||||
"//shared/testutil:go_default_library",
|
||||
"//shared/testutil/assert:go_default_library",
|
||||
"//shared/testutil/require:go_default_library",
|
||||
"@com_github_gogo_protobuf//proto:go_default_library",
|
||||
"@com_github_google_gofuzz//:go_default_library",
|
||||
"@com_github_prysmaticlabs_eth2_types//:go_default_library",
|
||||
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
|
||||
"@com_github_prysmaticlabs_go_bitfield//:go_default_library",
|
||||
"@org_golang_google_protobuf//proto:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/go-bitfield"
|
||||
@@ -17,6 +16,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func TestUnslashedAttestingIndices_CanSortAndFilter(t *testing.T) {
|
||||
|
||||
@@ -52,9 +52,9 @@ go_test(
|
||||
"//shared/testutil:go_default_library",
|
||||
"//shared/testutil/assert:go_default_library",
|
||||
"//shared/testutil/require:go_default_library",
|
||||
"@com_github_gogo_protobuf//proto:go_default_library",
|
||||
"@com_github_prysmaticlabs_eth2_types//:go_default_library",
|
||||
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
|
||||
"@com_github_prysmaticlabs_go_bitfield//:go_default_library",
|
||||
"@org_golang_google_protobuf//proto:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/core/epoch/precompute"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/state/stateV0"
|
||||
@@ -12,6 +11,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/params"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func TestProcessSlashingsPrecompute_NotSlashedWithSlashedTrue(t *testing.T) {
|
||||
|
||||
@@ -115,10 +115,7 @@ func TestAttestation_ComputeSubnetForAttestation(t *testing.T) {
|
||||
Source: nil,
|
||||
Target: nil,
|
||||
},
|
||||
Signature: []byte{'B'},
|
||||
XXX_NoUnkeyedLiteral: struct{}{},
|
||||
XXX_unrecognized: nil,
|
||||
XXX_sizecache: 0,
|
||||
Signature: []byte{'B'},
|
||||
}
|
||||
valCount, err := helpers.ActiveValidatorCount(state, helpers.SlotToEpoch(att.Data.Slot))
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -88,12 +88,12 @@ go_test(
|
||||
"//shared/testutil/assert:go_default_library",
|
||||
"//shared/testutil/require:go_default_library",
|
||||
"//shared/trieutil:go_default_library",
|
||||
"@com_github_gogo_protobuf//proto:go_default_library",
|
||||
"@com_github_google_gofuzz//:go_default_library",
|
||||
"@com_github_prysmaticlabs_eth2_types//:go_default_library",
|
||||
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
|
||||
"@com_github_prysmaticlabs_go_bitfield//:go_default_library",
|
||||
"@com_github_sirupsen_logrus//:go_default_library",
|
||||
"@org_golang_google_protobuf//proto:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -121,6 +121,6 @@ go_test(
|
||||
"//shared/benchutil:go_default_library",
|
||||
"//shared/params:go_default_library",
|
||||
"//shared/testutil/require:go_default_library",
|
||||
"@com_github_gogo_protobuf//proto:go_default_library",
|
||||
"@org_golang_google_protobuf//proto:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
|
||||
coreState "github.com/prysmaticlabs/prysm/beacon-chain/core/state"
|
||||
iface "github.com/prysmaticlabs/prysm/beacon-chain/state/interface"
|
||||
@@ -13,6 +12,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/benchutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/params"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
var runAmount = 25
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/core/state"
|
||||
@@ -15,6 +14,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func TestGenesisBeaconState_OK(t *testing.T) {
|
||||
|
||||
@@ -454,14 +454,15 @@ func TestProcessEpochPrecompute_CanProcess(t *testing.T) {
|
||||
FinalizedCheckpoint: ðpb.Checkpoint{Root: make([]byte, 32)},
|
||||
JustificationBits: bitfield.Bitvector4{0x00},
|
||||
CurrentJustifiedCheckpoint: ðpb.Checkpoint{Root: make([]byte, 32)},
|
||||
Validators: []*ethpb.Validator{},
|
||||
}
|
||||
s, err := stateV0.InitializeFromProto(base)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, s.SetValidators([]*ethpb.Validator{}))
|
||||
newState, err := state.ProcessEpochPrecompute(context.Background(), s)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, uint64(0), newState.Slashings()[2], "Unexpected slashed balance")
|
||||
}
|
||||
|
||||
func BenchmarkProcessBlk_65536Validators_FullBlock(b *testing.B) {
|
||||
logrus.SetLevel(logrus.PanicLevel)
|
||||
|
||||
|
||||
@@ -50,7 +50,6 @@ go_library(
|
||||
"@com_github_dgraph_io_ristretto//:go_default_library",
|
||||
"@com_github_ethereum_go_ethereum//common:go_default_library",
|
||||
"@com_github_ferranbt_fastssz//:go_default_library",
|
||||
"@com_github_gogo_protobuf//proto:go_default_library",
|
||||
"@com_github_golang_snappy//:go_default_library",
|
||||
"@com_github_pkg_errors//:go_default_library",
|
||||
"@com_github_prometheus_client_golang//prometheus:go_default_library",
|
||||
@@ -60,6 +59,7 @@ go_library(
|
||||
"@com_github_sirupsen_logrus//:go_default_library",
|
||||
"@io_etcd_go_bbolt//:go_default_library",
|
||||
"@io_opencensus_go//trace:go_default_library",
|
||||
"@org_golang_google_protobuf//proto:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -100,11 +100,11 @@ go_test(
|
||||
"//shared/testutil/assert:go_default_library",
|
||||
"//shared/testutil/require:go_default_library",
|
||||
"@com_github_ethereum_go_ethereum//common:go_default_library",
|
||||
"@com_github_gogo_protobuf//proto:go_default_library",
|
||||
"@com_github_prysmaticlabs_eth2_types//:go_default_library",
|
||||
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
|
||||
"@in_gopkg_d4l3k_messagediff_v1//:go_default_library",
|
||||
"@io_bazel_rules_go//go/tools/bazel:go_default_library",
|
||||
"@io_etcd_go_bbolt//:go_default_library",
|
||||
"@org_golang_google_protobuf//proto:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"sort"
|
||||
"testing"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/db/filters"
|
||||
@@ -14,6 +13,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func TestStore_SaveBlock_NoDuplicates(t *testing.T) {
|
||||
|
||||
@@ -4,13 +4,13 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/shared/bytesutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/params"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func TestStore_JustifiedCheckpoint_CanSaveRetrieve(t *testing.T) {
|
||||
|
||||
@@ -6,11 +6,11 @@ import (
|
||||
"reflect"
|
||||
|
||||
fastssz "github.com/ferranbt/fastssz"
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/golang/snappy"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
|
||||
"go.opencensus.io/trace"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func decode(ctx context.Context, data []byte, dst proto.Message) error {
|
||||
|
||||
@@ -4,10 +4,10 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func TestStore_VoluntaryExits_CRUD(t *testing.T) {
|
||||
|
||||
@@ -4,11 +4,11 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/prysmaticlabs/prysm/proto/beacon/db"
|
||||
"github.com/prysmaticlabs/prysm/shared/traceutil"
|
||||
bolt "go.etcd.io/bbolt"
|
||||
"go.opencensus.io/trace"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
// SavePowchainData saves the pow chain data.
|
||||
|
||||
@@ -4,11 +4,11 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func TestStore_ProposerSlashing_CRUD(t *testing.T) {
|
||||
|
||||
@@ -55,8 +55,8 @@ go_test(
|
||||
"//shared/testutil/assert:go_default_library",
|
||||
"//shared/testutil/require:go_default_library",
|
||||
"//shared/timeutils:go_default_library",
|
||||
"@com_github_gogo_protobuf//proto:go_default_library",
|
||||
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
|
||||
"@com_github_prysmaticlabs_go_bitfield//:go_default_library",
|
||||
"@org_golang_google_protobuf//proto:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -256,7 +256,7 @@ func TestKV_Aggregated_AggregatedAttestations(t *testing.T) {
|
||||
sort.Slice(returned, func(i, j int) bool {
|
||||
return returned[i].Data.Slot < returned[j].Data.Slot
|
||||
})
|
||||
assert.DeepEqual(t, atts, returned)
|
||||
assert.DeepSSZEqual(t, atts, returned)
|
||||
}
|
||||
|
||||
func TestKV_Aggregated_DeleteAggregatedAttestation(t *testing.T) {
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"sort"
|
||||
"testing"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/go-bitfield"
|
||||
attaggregation "github.com/prysmaticlabs/prysm/shared/aggregation/attestations"
|
||||
@@ -14,6 +13,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func TestBatchAttestations_Multiple(t *testing.T) {
|
||||
@@ -110,7 +110,7 @@ func TestBatchAttestations_Multiple(t *testing.T) {
|
||||
return wanted[i].Data.Slot < wanted[j].Data.Slot
|
||||
})
|
||||
|
||||
assert.DeepEqual(t, wanted, received)
|
||||
assert.DeepSSZEqual(t, wanted, received)
|
||||
}
|
||||
|
||||
func TestBatchAttestations_Single(t *testing.T) {
|
||||
|
||||
@@ -33,8 +33,8 @@ go_test(
|
||||
"//proto/beacon/p2p/v1:go_default_library",
|
||||
"//shared/params:go_default_library",
|
||||
"//shared/testutil/require:go_default_library",
|
||||
"@com_github_gogo_protobuf//proto:go_default_library",
|
||||
"@com_github_prysmaticlabs_eth2_types//:go_default_library",
|
||||
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
|
||||
"@org_golang_google_protobuf//proto:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -5,13 +5,13 @@ import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/state/stateV0"
|
||||
p2ppb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
|
||||
"github.com/prysmaticlabs/prysm/shared/params"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func TestPool_InsertVoluntaryExit(t *testing.T) {
|
||||
|
||||
@@ -68,7 +68,6 @@ go_library(
|
||||
"@com_github_ethereum_go_ethereum//p2p/discover: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_gogo_protobuf//proto:go_default_library",
|
||||
"@com_github_ipfs_go_ipfs_addr//:go_default_library",
|
||||
"@com_github_kevinms_leakybucket_go//:go_default_library",
|
||||
"@com_github_libp2p_go_libp2p//:go_default_library",
|
||||
@@ -95,6 +94,7 @@ go_library(
|
||||
"@com_github_prysmaticlabs_go_bitfield//:go_default_library",
|
||||
"@com_github_sirupsen_logrus//:go_default_library",
|
||||
"@io_opencensus_go//trace:go_default_library",
|
||||
"@org_golang_google_protobuf//proto:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -150,7 +150,6 @@ go_test(
|
||||
"@com_github_ethereum_go_ethereum//p2p/discover: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_gogo_protobuf//proto:go_default_library",
|
||||
"@com_github_golang_snappy//:go_default_library",
|
||||
"@com_github_kevinms_leakybucket_go//:go_default_library",
|
||||
"@com_github_libp2p_go_libp2p//:go_default_library",
|
||||
@@ -171,5 +170,6 @@ go_test(
|
||||
"@com_github_sirupsen_logrus//:go_default_library",
|
||||
"@com_github_sirupsen_logrus//hooks/test:go_default_library",
|
||||
"@com_github_stretchr_testify//require:go_default_library",
|
||||
"@org_golang_google_protobuf//proto:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -7,13 +7,13 @@ import (
|
||||
"reflect"
|
||||
"time"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/pkg/errors"
|
||||
eth "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/shared/hashutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/params"
|
||||
"github.com/prysmaticlabs/prysm/shared/traceutil"
|
||||
"go.opencensus.io/trace"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
// ErrMessageNotMapped occurs on a Broadcast attempt when a message has not been defined in the
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum/p2p/discover"
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/libp2p/go-libp2p-core/host"
|
||||
pubsub "github.com/libp2p/go-libp2p-pubsub"
|
||||
eth "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
@@ -25,6 +24,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func TestService_Broadcast(t *testing.T) {
|
||||
|
||||
@@ -39,5 +39,6 @@ go_test(
|
||||
"//shared/testutil/require: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",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -8,13 +8,14 @@ import (
|
||||
"math"
|
||||
"testing"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
gogo "github.com/gogo/protobuf/proto"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/p2p/encoder"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
|
||||
"github.com/prysmaticlabs/prysm/shared/params"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func TestSszNetworkEncoder_RoundTrip(t *testing.T) {
|
||||
@@ -185,7 +186,7 @@ func newBadSnappyStream() *badSnappyStream {
|
||||
payload[3] = 0
|
||||
|
||||
return &badSnappyStream{
|
||||
varint: proto.EncodeVarint(1000),
|
||||
varint: gogo.EncodeVarint(1000),
|
||||
header: header,
|
||||
repeat: payload,
|
||||
i: 0,
|
||||
|
||||
@@ -3,8 +3,8 @@ package p2p
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
pb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
// GossipTopicMappings represent the protocol ID to protobuf message type map for easy
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/ethereum/go-ethereum/p2p/enr"
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/libp2p/go-libp2p-core/connmgr"
|
||||
"github.com/libp2p/go-libp2p-core/host"
|
||||
"github.com/libp2p/go-libp2p-core/network"
|
||||
@@ -15,6 +14,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/p2p/encoder"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/p2p/peers"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
// P2P represents the full p2p interface composed of all of the sub-interfaces.
|
||||
|
||||
@@ -15,13 +15,13 @@ go_library(
|
||||
"//shared/rand:go_default_library",
|
||||
"//shared/timeutils:go_default_library",
|
||||
"@com_github_ethereum_go_ethereum//p2p/enr:go_default_library",
|
||||
"@com_github_gogo_protobuf//proto:go_default_library",
|
||||
"@com_github_libp2p_go_libp2p_core//network:go_default_library",
|
||||
"@com_github_libp2p_go_libp2p_core//peer:go_default_library",
|
||||
"@com_github_multiformats_go_multiaddr//:go_default_library",
|
||||
"@com_github_multiformats_go_multiaddr//net: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",
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum/p2p/enr"
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/libp2p/go-libp2p-core/network"
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
ma "github.com/multiformats/go-multiaddr"
|
||||
@@ -43,6 +42,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/params"
|
||||
"github.com/prysmaticlabs/prysm/shared/rand"
|
||||
"github.com/prysmaticlabs/prysm/shared/timeutils"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -8,12 +8,12 @@ import (
|
||||
|
||||
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"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"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func TestService_Send(t *testing.T) {
|
||||
|
||||
@@ -11,7 +11,6 @@ import (
|
||||
|
||||
"github.com/ethereum/go-ethereum/p2p/enode"
|
||||
"github.com/ethereum/go-ethereum/p2p/enr"
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/kevinms/leakybucket-go"
|
||||
"github.com/libp2p/go-libp2p"
|
||||
"github.com/libp2p/go-libp2p-core/host"
|
||||
@@ -34,6 +33,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/slotutil"
|
||||
"github.com/sirupsen/logrus"
|
||||
"go.opencensus.io/trace"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
var _ shared.Service = (*Service)(nil)
|
||||
|
||||
@@ -25,7 +25,6 @@ go_library(
|
||||
"@com_github_ethereum_go_ethereum//crypto: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_gogo_protobuf//proto:go_default_library",
|
||||
"@com_github_libp2p_go_libp2p_blankhost//:go_default_library",
|
||||
"@com_github_libp2p_go_libp2p_core//:go_default_library",
|
||||
"@com_github_libp2p_go_libp2p_core//connmgr:go_default_library",
|
||||
@@ -41,5 +40,6 @@ go_library(
|
||||
"@com_github_multiformats_go_multiaddr//:go_default_library",
|
||||
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
|
||||
"@com_github_sirupsen_logrus//:go_default_library",
|
||||
"@org_golang_google_protobuf//proto:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/ethereum/go-ethereum/p2p/enr"
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/libp2p/go-libp2p-core/control"
|
||||
"github.com/libp2p/go-libp2p-core/host"
|
||||
"github.com/libp2p/go-libp2p-core/network"
|
||||
@@ -12,6 +11,7 @@ import (
|
||||
pubsub "github.com/libp2p/go-libp2p-pubsub"
|
||||
"github.com/multiformats/go-multiaddr"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"google.golang.org/protobuf/proto"
|
||||
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/p2p/encoder"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/p2p/peers"
|
||||
|
||||
@@ -3,8 +3,8 @@ package testing
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
// MockBroadcaster implements p2p.Broadcaster for testing.
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum/p2p/enr"
|
||||
"github.com/gogo/protobuf/proto"
|
||||
bhost "github.com/libp2p/go-libp2p-blankhost"
|
||||
core "github.com/libp2p/go-libp2p-core"
|
||||
"github.com/libp2p/go-libp2p-core/control"
|
||||
@@ -27,6 +26,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/p2p/peers/scorers"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
|
||||
"github.com/sirupsen/logrus"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
// TestP2P represents a p2p implementation that can be used for testing.
|
||||
|
||||
@@ -22,6 +22,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/fileutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/iputils"
|
||||
"github.com/sirupsen/logrus"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
const keyPath = "network-keys"
|
||||
@@ -119,7 +120,7 @@ func metaDataFromConfig(cfg *Config) (*pbp2p.MetaData, error) {
|
||||
SeqNumber: 0,
|
||||
Attnets: bitfield.NewBitvector64(),
|
||||
}
|
||||
dst, err := metaData.Marshal()
|
||||
dst, err := proto.Marshal(metaData)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -137,7 +138,7 @@ func metaDataFromConfig(cfg *Config) (*pbp2p.MetaData, error) {
|
||||
return nil, err
|
||||
}
|
||||
metaData := &pbp2p.MetaData{}
|
||||
if err := metaData.Unmarshal(src); err != nil {
|
||||
if err := proto.Unmarshal(src, metaData); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return metaData, nil
|
||||
|
||||
@@ -183,6 +183,7 @@ func TestProcessDeposit_IncompleteDeposit(t *testing.T) {
|
||||
})
|
||||
require.NoError(t, err, "unable to setup web3 ETH1.0 chain service")
|
||||
web3Service = setDefaultMocks(web3Service)
|
||||
require.NoError(t, web3Service.preGenesisState.SetValidators([]*ethpb.Validator{}))
|
||||
|
||||
deposit := ðpb.Deposit{
|
||||
Data: ðpb.Deposit_Data{
|
||||
|
||||
@@ -49,7 +49,6 @@ go_library(
|
||||
"//shared/params:go_default_library",
|
||||
"//shared/sliceutil:go_default_library",
|
||||
"//shared/slotutil:go_default_library",
|
||||
"@com_github_gogo_protobuf//types:go_default_library",
|
||||
"@com_github_patrickmn_go_cache//:go_default_library",
|
||||
"@com_github_prometheus_client_golang//prometheus:go_default_library",
|
||||
"@com_github_prometheus_client_golang//prometheus/promauto:go_default_library",
|
||||
@@ -58,6 +57,7 @@ go_library(
|
||||
"@com_github_sirupsen_logrus//:go_default_library",
|
||||
"@org_golang_google_grpc//codes:go_default_library",
|
||||
"@org_golang_google_grpc//status:go_default_library",
|
||||
"@org_golang_google_protobuf//types/known/emptypb:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -107,12 +107,12 @@ go_test(
|
||||
"//shared/testutil/assert:go_default_library",
|
||||
"//shared/testutil/require:go_default_library",
|
||||
"//shared/timeutils:go_default_library",
|
||||
"@com_github_gogo_protobuf//proto:go_default_library",
|
||||
"@com_github_gogo_protobuf//types:go_default_library",
|
||||
"@com_github_golang_mock//gomock:go_default_library",
|
||||
"@com_github_prysmaticlabs_eth2_types//:go_default_library",
|
||||
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
|
||||
"@com_github_prysmaticlabs_go_bitfield//:go_default_library",
|
||||
"@in_gopkg_d4l3k_messagediff_v1//:go_default_library",
|
||||
"@org_golang_google_protobuf//proto:go_default_library",
|
||||
"@org_golang_google_protobuf//types/known/emptypb:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
mock "github.com/prysmaticlabs/prysm/beacon-chain/blockchain/testing"
|
||||
@@ -19,6 +18,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func TestServer_ListAssignments_CannotRequestFutureEpoch(t *testing.T) {
|
||||
@@ -222,7 +222,7 @@ func TestServer_ListAssignments_Pagination_DefaultPageSize_NoArchive(t *testing.
|
||||
ValidatorIndex: index,
|
||||
})
|
||||
}
|
||||
assert.DeepEqual(t, wanted, res.Assignments, "Did not receive wanted assignments")
|
||||
assert.DeepSSZEqual(t, wanted, res.Assignments, "Did not receive wanted assignments")
|
||||
}
|
||||
|
||||
func TestServer_ListAssignments_FilterPubkeysIndices_NoPagination(t *testing.T) {
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
ptypes "github.com/gogo/protobuf/types"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/core/feed"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/core/feed/operation"
|
||||
@@ -21,6 +20,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/slotutil"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
// sortableAttestations implements the Sort interface to sort attestations
|
||||
@@ -201,7 +201,7 @@ func (bs *Server) ListIndexedAttestations(
|
||||
// aggregated attestations currently in the pool at the start of a slot and sends
|
||||
// them over a gRPC stream.
|
||||
func (bs *Server) StreamAttestations(
|
||||
_ *ptypes.Empty, stream ethpb.BeaconChain_StreamAttestationsServer,
|
||||
_ *emptypb.Empty, stream ethpb.BeaconChain_StreamAttestationsServer,
|
||||
) error {
|
||||
attestationsChannel := make(chan *feed.Event, 1)
|
||||
attSub := bs.AttestationNotifier.OperationFeed().Subscribe(attestationsChannel)
|
||||
@@ -235,7 +235,7 @@ func (bs *Server) StreamAttestations(
|
||||
// aggregated attestations currently in the pool, converts them into indexed form, and
|
||||
// sends them over a gRPC stream.
|
||||
func (bs *Server) StreamIndexedAttestations(
|
||||
_ *ptypes.Empty, stream ethpb.BeaconChain_StreamIndexedAttestationsServer,
|
||||
_ *emptypb.Empty, stream ethpb.BeaconChain_StreamIndexedAttestationsServer,
|
||||
) error {
|
||||
attestationsChannel := make(chan *feed.Event, 1)
|
||||
attSub := bs.AttestationNotifier.OperationFeed().Subscribe(attestationsChannel)
|
||||
|
||||
@@ -8,8 +8,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
ptypes "github.com/gogo/protobuf/types"
|
||||
"github.com/golang/mock/gomock"
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
@@ -32,6 +30,8 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
func TestServer_ListAttestations_NoResults(t *testing.T) {
|
||||
@@ -828,7 +828,7 @@ func TestServer_StreamIndexedAttestations_ContextCanceled(t *testing.T) {
|
||||
mockStream := mock.NewMockBeaconChain_StreamIndexedAttestationsServer(ctrl)
|
||||
mockStream.EXPECT().Context().Return(ctx).AnyTimes()
|
||||
go func(tt *testing.T) {
|
||||
err := server.StreamIndexedAttestations(&ptypes.Empty{}, mockStream)
|
||||
err := server.StreamIndexedAttestations(&emptypb.Empty{}, mockStream)
|
||||
assert.ErrorContains(t, "Context canceled", err)
|
||||
<-exitRoutine
|
||||
}(t)
|
||||
@@ -972,7 +972,7 @@ func TestServer_StreamIndexedAttestations_OK(t *testing.T) {
|
||||
mockStream.EXPECT().Context().Return(ctx).AnyTimes()
|
||||
|
||||
go func(tt *testing.T) {
|
||||
assert.NoError(tt, server.StreamIndexedAttestations(&ptypes.Empty{}, mockStream), "Could not call RPC method")
|
||||
assert.NoError(tt, server.StreamIndexedAttestations(&emptypb.Empty{}, mockStream), "Could not call RPC method")
|
||||
}(t)
|
||||
|
||||
server.CollectedAttestationsBuffer <- allAtts
|
||||
@@ -996,7 +996,7 @@ func TestServer_StreamAttestations_ContextCanceled(t *testing.T) {
|
||||
mockStream.EXPECT().Context().Return(ctx)
|
||||
go func(tt *testing.T) {
|
||||
err := server.StreamAttestations(
|
||||
&ptypes.Empty{},
|
||||
&emptypb.Empty{},
|
||||
mockStream,
|
||||
)
|
||||
assert.ErrorContains(tt, "Context canceled", err)
|
||||
@@ -1032,7 +1032,7 @@ func TestServer_StreamAttestations_OnSlotTick(t *testing.T) {
|
||||
mockStream.EXPECT().Context().Return(ctx).AnyTimes()
|
||||
|
||||
go func(tt *testing.T) {
|
||||
assert.NoError(tt, server.StreamAttestations(&ptypes.Empty{}, mockStream), "Could not call RPC method")
|
||||
assert.NoError(tt, server.StreamAttestations(&emptypb.Empty{}, mockStream), "Could not call RPC method")
|
||||
}(t)
|
||||
for i := 0; i < len(atts); i++ {
|
||||
// Send in a loop to ensure it is delivered (busy wait for the service to subscribe to the state feed).
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
ptypes "github.com/gogo/protobuf/types"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/core/blocks"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/core/feed"
|
||||
@@ -19,6 +18,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/params"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
// ListBlocks retrieves blocks by root, slot, or epoch.
|
||||
@@ -187,7 +187,7 @@ func (bs *Server) ListBlocks(
|
||||
//
|
||||
// This includes the head block slot and root as well as information about
|
||||
// the most recent finalized and justified slots.
|
||||
func (bs *Server) GetChainHead(ctx context.Context, _ *ptypes.Empty) (*ethpb.ChainHead, error) {
|
||||
func (bs *Server) GetChainHead(ctx context.Context, _ *emptypb.Empty) (*ethpb.ChainHead, error) {
|
||||
return bs.chainHeadRetrieval(ctx)
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@ func (bs *Server) StreamBlocks(req *ethpb.StreamBlocksRequest, stream ethpb.Beac
|
||||
}
|
||||
|
||||
// StreamChainHead to clients every single time the head block and state of the chain change.
|
||||
func (bs *Server) StreamChainHead(_ *ptypes.Empty, stream ethpb.BeaconChain_StreamChainHeadServer) error {
|
||||
func (bs *Server) StreamChainHead(_ *emptypb.Empty, stream ethpb.BeaconChain_StreamChainHeadServer) error {
|
||||
stateChannel := make(chan *feed.Event, 1)
|
||||
stateSub := bs.StateNotifier.StateFeed().Subscribe(stateChannel)
|
||||
defer stateSub.Unsubscribe()
|
||||
@@ -363,7 +363,7 @@ func (bs *Server) chainHeadRetrieval(ctx context.Context) (*ethpb.ChainHead, err
|
||||
}
|
||||
|
||||
// GetWeakSubjectivityCheckpoint retrieves weak subjectivity state root, block root, and epoch.
|
||||
func (bs *Server) GetWeakSubjectivityCheckpoint(ctx context.Context, _ *ptypes.Empty) (*ethpb.WeakSubjectivityCheckpoint, error) {
|
||||
func (bs *Server) GetWeakSubjectivityCheckpoint(ctx context.Context, _ *emptypb.Empty) (*ethpb.WeakSubjectivityCheckpoint, error) {
|
||||
hs, err := bs.HeadFetcher.HeadState(ctx)
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.Internal, "Could not get head state")
|
||||
|
||||
@@ -6,8 +6,6 @@ import (
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
ptypes "github.com/gogo/protobuf/types"
|
||||
"github.com/golang/mock/gomock"
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
@@ -27,6 +25,8 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
func TestServer_ListBlocks_NoResults(t *testing.T) {
|
||||
@@ -444,7 +444,7 @@ func TestServer_StreamChainHead_ContextCanceled(t *testing.T) {
|
||||
mockStream := mock.NewMockBeaconChain_StreamChainHeadServer(ctrl)
|
||||
mockStream.EXPECT().Context().Return(ctx)
|
||||
go func(tt *testing.T) {
|
||||
assert.ErrorContains(tt, "Context canceled", server.StreamChainHead(&ptypes.Empty{}, mockStream))
|
||||
assert.ErrorContains(tt, "Context canceled", server.StreamChainHead(&emptypb.Empty{}, mockStream))
|
||||
<-exitRoutine
|
||||
}(t)
|
||||
cancel()
|
||||
@@ -534,7 +534,7 @@ func TestServer_StreamChainHead_OnHeadUpdated(t *testing.T) {
|
||||
mockStream.EXPECT().Context().Return(ctx).AnyTimes()
|
||||
|
||||
go func(tt *testing.T) {
|
||||
assert.NoError(tt, server.StreamChainHead(&ptypes.Empty{}, mockStream), "Could not call RPC method")
|
||||
assert.NoError(tt, server.StreamChainHead(&emptypb.Empty{}, mockStream), "Could not call RPC method")
|
||||
}(t)
|
||||
|
||||
// Send in a loop to ensure it is delivered (busy wait for the service to subscribe to the state feed).
|
||||
@@ -735,7 +735,7 @@ func TestServer_GetWeakSubjectivityCheckpoint(t *testing.T) {
|
||||
wsEpoch, err := helpers.ComputeWeakSubjectivityPeriod(beaconState)
|
||||
require.NoError(t, err)
|
||||
|
||||
c, err := server.GetWeakSubjectivityCheckpoint(ctx, &ptypes.Empty{})
|
||||
c, err := server.GetWeakSubjectivityCheckpoint(ctx, &emptypb.Empty{})
|
||||
require.NoError(t, err)
|
||||
e := finalizedEpoch - (finalizedEpoch % wsEpoch)
|
||||
require.Equal(t, e, c.Epoch)
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
mock "github.com/prysmaticlabs/prysm/beacon-chain/blockchain/testing"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
|
||||
@@ -19,6 +18,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"github.com/prysmaticlabs/prysm/shared/timeutils"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"gopkg.in/d4l3k/messagediff.v1"
|
||||
)
|
||||
|
||||
|
||||
@@ -5,13 +5,13 @@ import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
ptypes "github.com/gogo/protobuf/types"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/shared/params"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
// GetBeaconConfig retrieves the current configuration parameters of the beacon chain.
|
||||
func (bs *Server) GetBeaconConfig(_ context.Context, _ *ptypes.Empty) (*ethpb.BeaconConfig, error) {
|
||||
func (bs *Server) GetBeaconConfig(_ context.Context, _ *emptypb.Empty) (*ethpb.BeaconConfig, error) {
|
||||
conf := params.BeaconConfig()
|
||||
val := reflect.ValueOf(conf).Elem()
|
||||
numFields := val.Type().NumField()
|
||||
|
||||
@@ -6,16 +6,16 @@ import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
ptypes "github.com/gogo/protobuf/types"
|
||||
"github.com/prysmaticlabs/prysm/shared/params"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
func TestServer_GetBeaconConfig(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
bs := &Server{}
|
||||
res, err := bs.GetBeaconConfig(ctx, &ptypes.Empty{})
|
||||
res, err := bs.GetBeaconConfig(ctx, &emptypb.Empty{})
|
||||
require.NoError(t, err)
|
||||
conf := params.BeaconConfig()
|
||||
numFields := reflect.TypeOf(conf).Elem().NumField()
|
||||
|
||||
@@ -4,10 +4,10 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/shared/featureconfig"
|
||||
"google.golang.org/protobuf/proto"
|
||||
|
||||
mock "github.com/prysmaticlabs/prysm/beacon-chain/blockchain/testing"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/operations/slashings"
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
ptypes "github.com/gogo/protobuf/types"
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/core/epoch/precompute"
|
||||
@@ -20,6 +19,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/params"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
// BalancesTimeout for gRPC requests to ListValidatorBalances.
|
||||
@@ -551,7 +551,7 @@ func (bs *Server) GetValidatorParticipation(
|
||||
|
||||
// GetValidatorQueue retrieves the current validator queue information.
|
||||
func (bs *Server) GetValidatorQueue(
|
||||
ctx context.Context, _ *ptypes.Empty,
|
||||
ctx context.Context, _ *emptypb.Empty,
|
||||
) (*ethpb.ValidatorQueue, error) {
|
||||
headState, err := bs.HeadFetcher.HeadState(ctx)
|
||||
if err != nil {
|
||||
|
||||
@@ -9,8 +9,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
ptypes "github.com/gogo/protobuf/types"
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/go-bitfield"
|
||||
@@ -31,6 +29,8 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"github.com/prysmaticlabs/prysm/shared/timeutils"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -680,7 +680,7 @@ func TestServer_ListValidators_NoPagination(t *testing.T) {
|
||||
|
||||
received, err := bs.ListValidators(context.Background(), ðpb.ListValidatorsRequest{})
|
||||
require.NoError(t, err)
|
||||
assert.DeepEqual(t, want, received.ValidatorList, "Incorrect respond of validators")
|
||||
assert.DeepSSZEqual(t, want, received.ValidatorList, "Incorrect respond of validators")
|
||||
}
|
||||
|
||||
func TestServer_ListValidators_StategenNotUsed(t *testing.T) {
|
||||
@@ -1304,7 +1304,7 @@ func TestServer_GetValidatorQueue_PendingActivation(t *testing.T) {
|
||||
State: headState,
|
||||
},
|
||||
}
|
||||
res, err := bs.GetValidatorQueue(context.Background(), &ptypes.Empty{})
|
||||
res, err := bs.GetValidatorQueue(context.Background(), &emptypb.Empty{})
|
||||
require.NoError(t, err)
|
||||
// We verify the keys are properly sorted by the validators' activation eligibility epoch.
|
||||
wanted := [][]byte{
|
||||
@@ -1349,7 +1349,7 @@ func TestServer_GetValidatorQueue_ExitedValidatorLeavesQueue(t *testing.T) {
|
||||
}
|
||||
|
||||
// First we check if validator with index 1 is in the exit queue.
|
||||
res, err := bs.GetValidatorQueue(context.Background(), &ptypes.Empty{})
|
||||
res, err := bs.GetValidatorQueue(context.Background(), &emptypb.Empty{})
|
||||
require.NoError(t, err)
|
||||
wanted := [][]byte{
|
||||
bytesutil.PadTo([]byte("2"), 48),
|
||||
@@ -1366,7 +1366,7 @@ func TestServer_GetValidatorQueue_ExitedValidatorLeavesQueue(t *testing.T) {
|
||||
// Now, we move the state.slot past the exit epoch of the validator, and now
|
||||
// the validator should no longer exist in the queue.
|
||||
require.NoError(t, headState.SetSlot(params.BeaconConfig().SlotsPerEpoch.Mul(uint64(validators[1].ExitEpoch+1))))
|
||||
res, err = bs.GetValidatorQueue(context.Background(), &ptypes.Empty{})
|
||||
res, err = bs.GetValidatorQueue(context.Background(), &emptypb.Empty{})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 0, len(res.ExitPublicKeys))
|
||||
}
|
||||
@@ -1406,7 +1406,7 @@ func TestServer_GetValidatorQueue_PendingExit(t *testing.T) {
|
||||
State: headState,
|
||||
},
|
||||
}
|
||||
res, err := bs.GetValidatorQueue(context.Background(), &ptypes.Empty{})
|
||||
res, err := bs.GetValidatorQueue(context.Background(), &emptypb.Empty{})
|
||||
require.NoError(t, err)
|
||||
// We verify the keys are properly sorted by the validators' withdrawable epoch.
|
||||
wanted := [][]byte{
|
||||
|
||||
@@ -40,7 +40,6 @@ go_library(
|
||||
"//shared/featureconfig:go_default_library",
|
||||
"//shared/params:go_default_library",
|
||||
"@com_github_ethereum_go_ethereum//common/hexutil:go_default_library",
|
||||
"@com_github_gogo_protobuf//types:go_default_library",
|
||||
"@com_github_pkg_errors//:go_default_library",
|
||||
"@com_github_prysmaticlabs_eth2_types//:go_default_library",
|
||||
"@com_github_prysmaticlabs_ethereumapis//eth/v1:go_default_library",
|
||||
@@ -49,6 +48,8 @@ go_library(
|
||||
"@io_opencensus_go//trace:go_default_library",
|
||||
"@org_golang_google_grpc//codes:go_default_library",
|
||||
"@org_golang_google_grpc//status:go_default_library",
|
||||
"@org_golang_google_protobuf//types/known/emptypb:go_default_library",
|
||||
"@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -84,10 +85,10 @@ go_test(
|
||||
"//shared/testutil/assert:go_default_library",
|
||||
"//shared/testutil/require:go_default_library",
|
||||
"@com_github_ethereum_go_ethereum//common/hexutil:go_default_library",
|
||||
"@com_github_gogo_protobuf//types:go_default_library",
|
||||
"@com_github_prysmaticlabs_eth2_types//:go_default_library",
|
||||
"@com_github_prysmaticlabs_ethereumapis//eth/v1:go_default_library",
|
||||
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
|
||||
"@com_github_prysmaticlabs_go_bitfield//:go_default_library",
|
||||
"@org_golang_google_protobuf//types/known/emptypb:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
ptypes "github.com/gogo/protobuf/types"
|
||||
"github.com/pkg/errors"
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1"
|
||||
@@ -17,6 +16,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/bytesutil"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
// GetBlockHeader retrieves block header for given block id.
|
||||
@@ -70,11 +70,15 @@ func (bs *Server) ListBlockHeaders(ctx context.Context, req *ethpb.BlockHeadersR
|
||||
return nil, status.Errorf(codes.Internal, "Could not retrieve blocks: %v", err)
|
||||
}
|
||||
} else {
|
||||
_, blks, err = bs.BeaconDB.BlocksBySlot(ctx, req.Slot)
|
||||
slot := bs.ChainInfoFetcher.HeadSlot()
|
||||
if req.Slot != nil {
|
||||
slot = *req.Slot
|
||||
}
|
||||
_, blks, err = bs.BeaconDB.BlocksBySlot(ctx, slot)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "Could not retrieve blocks for slot %d: %v", req.Slot, err)
|
||||
}
|
||||
_, blkRoots, err = bs.BeaconDB.BlockRootsBySlot(ctx, req.Slot)
|
||||
_, blkRoots, err = bs.BeaconDB.BlockRootsBySlot(ctx, slot)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "Could not retrieve block roots for slot %d: %v", req.Slot, err)
|
||||
}
|
||||
@@ -115,7 +119,7 @@ func (bs *Server) ListBlockHeaders(ctx context.Context, req *ethpb.BlockHeadersR
|
||||
// response (20X) only indicates that the broadcast has been successful. The beacon node is expected to integrate the
|
||||
// new block into its state, and therefore validate the block internally, however blocks which fail the validation are
|
||||
// still broadcast but a different status code is returned (202).
|
||||
func (bs *Server) SubmitBlock(ctx context.Context, req *ethpb.BeaconBlockContainer) (*ptypes.Empty, error) {
|
||||
func (bs *Server) SubmitBlock(ctx context.Context, req *ethpb.BeaconBlockContainer) (*emptypb.Empty, error) {
|
||||
blk := req.Message
|
||||
|
||||
v1alpha1Block, err := migration.V1ToV1Alpha1Block(ðpb.SignedBeaconBlock{Block: blk, Signature: req.Signature})
|
||||
@@ -147,7 +151,7 @@ func (bs *Server) SubmitBlock(ctx context.Context, req *ethpb.BeaconBlockContain
|
||||
return nil, status.Errorf(codes.Internal, "Could not process beacon block: %v", err)
|
||||
}
|
||||
|
||||
return &ptypes.Empty{}, nil
|
||||
return &emptypb.Empty{}, nil
|
||||
}
|
||||
|
||||
// GetBlock retrieves block details for given block id.
|
||||
|
||||
@@ -200,7 +200,7 @@ func TestServer_ListBlockHeaders(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
name: "slot",
|
||||
slot: 30,
|
||||
slot: types.Slot(30),
|
||||
want: []*ethpb_alpha.SignedBeaconBlock{
|
||||
blkContainers[30].Block,
|
||||
b2,
|
||||
@@ -221,7 +221,7 @@ func TestServer_ListBlockHeaders(t *testing.T) {
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
headers, err := bs.ListBlockHeaders(ctx, ðpb.BlockHeadersRequest{
|
||||
Slot: tt.slot,
|
||||
Slot: &tt.slot,
|
||||
ParentRoot: tt.parentRoot,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -9,17 +9,17 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
ptypes "github.com/gogo/protobuf/types"
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1"
|
||||
"github.com/prysmaticlabs/prysm/shared/params"
|
||||
"go.opencensus.io/trace"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
// GetForkSchedule retrieve all scheduled upcoming forks this node is aware of.
|
||||
func (bs *Server) GetForkSchedule(ctx context.Context, _ *ptypes.Empty) (*ethpb.ForkScheduleResponse, error) {
|
||||
func (bs *Server) GetForkSchedule(ctx context.Context, _ *emptypb.Empty) (*ethpb.ForkScheduleResponse, error) {
|
||||
ctx, span := trace.StartSpan(ctx, "beaconv1.GetForkSchedule")
|
||||
defer span.End()
|
||||
|
||||
@@ -56,7 +56,7 @@ func (bs *Server) GetForkSchedule(ctx context.Context, _ *ptypes.Empty) (*ethpb.
|
||||
// Values are returned with following format:
|
||||
// - any value starting with 0x in the spec is returned as a hex string.
|
||||
// - all other values are returned as number.
|
||||
func (bs *Server) GetSpec(ctx context.Context, _ *ptypes.Empty) (*ethpb.SpecResponse, error) {
|
||||
func (bs *Server) GetSpec(ctx context.Context, _ *emptypb.Empty) (*ethpb.SpecResponse, error) {
|
||||
ctx, span := trace.StartSpan(ctx, "beaconV1.GetSpec")
|
||||
defer span.End()
|
||||
|
||||
@@ -68,7 +68,7 @@ func (bs *Server) GetSpec(ctx context.Context, _ *ptypes.Empty) (*ethpb.SpecResp
|
||||
}
|
||||
|
||||
// GetDepositContract retrieves deposit contract address and genesis fork version.
|
||||
func (bs *Server) GetDepositContract(ctx context.Context, _ *ptypes.Empty) (*ethpb.DepositContractResponse, error) {
|
||||
func (bs *Server) GetDepositContract(ctx context.Context, _ *emptypb.Empty) (*ethpb.DepositContractResponse, error) {
|
||||
ctx, span := trace.StartSpan(ctx, "beaconv1.GetDepositContract")
|
||||
defer span.End()
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
pbtypes "github.com/gogo/protobuf/types"
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
"github.com/prysmaticlabs/prysm/shared/params"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
func TestGetSpec(t *testing.T) {
|
||||
@@ -94,7 +94,7 @@ func TestGetSpec(t *testing.T) {
|
||||
params.OverrideBeaconConfig(config)
|
||||
|
||||
server := &Server{}
|
||||
resp, err := server.GetSpec(context.Background(), &pbtypes.Empty{})
|
||||
resp, err := server.GetSpec(context.Background(), &emptypb.Empty{})
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, 60, len(resp.Data))
|
||||
@@ -236,7 +236,7 @@ func TestGetDepositContract(t *testing.T) {
|
||||
params.OverrideBeaconConfig(config)
|
||||
|
||||
s := Server{}
|
||||
resp, err := s.GetDepositContract(context.Background(), &pbtypes.Empty{})
|
||||
resp, err := s.GetDepositContract(context.Background(), &emptypb.Empty{})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, uint64(chainId), resp.Data.ChainId)
|
||||
assert.Equal(t, address, resp.Data.Address)
|
||||
@@ -260,7 +260,7 @@ func TestForkSchedule_Ok(t *testing.T) {
|
||||
params.OverrideBeaconConfig(config)
|
||||
|
||||
s := &Server{}
|
||||
resp, err := s.GetForkSchedule(context.Background(), &pbtypes.Empty{})
|
||||
resp, err := s.GetForkSchedule(context.Background(), &emptypb.Empty{})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 3, len(resp.Data))
|
||||
fork := resp.Data[0]
|
||||
@@ -279,7 +279,7 @@ func TestForkSchedule_Ok(t *testing.T) {
|
||||
|
||||
func TestForkSchedule_NoForks(t *testing.T) {
|
||||
s := &Server{}
|
||||
resp, err := s.GetForkSchedule(context.Background(), &pbtypes.Empty{})
|
||||
resp, err := s.GetForkSchedule(context.Background(), &emptypb.Empty{})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 0, len(resp.Data))
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
ptypes "github.com/gogo/protobuf/types"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1"
|
||||
ethpb_alpha "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/core/blocks"
|
||||
@@ -13,6 +12,7 @@ import (
|
||||
"go.opencensus.io/trace"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
// ListPoolAttestations retrieves attestations known by the node but
|
||||
@@ -23,7 +23,7 @@ func (bs *Server) ListPoolAttestations(ctx context.Context, req *ethpb.Attestati
|
||||
|
||||
// SubmitAttestations submits Attestation object to node. If attestation passes all validation
|
||||
// constraints, node MUST publish attestation on appropriate subnet.
|
||||
func (bs *Server) SubmitAttestations(ctx context.Context, req *ethpb.SubmitAttestationsRequest) (*ptypes.Empty, error) {
|
||||
func (bs *Server) SubmitAttestations(ctx context.Context, req *ethpb.SubmitAttestationsRequest) (*emptypb.Empty, error) {
|
||||
ctx, span := trace.StartSpan(ctx, "beaconv1.SubmitAttestation")
|
||||
defer span.End()
|
||||
|
||||
@@ -60,12 +60,12 @@ func (bs *Server) SubmitAttestations(ctx context.Context, req *ethpb.SubmitAttes
|
||||
codes.Internal,
|
||||
"Could not publish one or more attestations. Some attestations could be published successfully.")
|
||||
}
|
||||
return &ptypes.Empty{}, nil
|
||||
return &emptypb.Empty{}, nil
|
||||
}
|
||||
|
||||
// ListPoolAttesterSlashings retrieves attester slashings known by the node but
|
||||
// not necessarily incorporated into any block.
|
||||
func (bs *Server) ListPoolAttesterSlashings(ctx context.Context, req *ptypes.Empty) (*ethpb.AttesterSlashingsPoolResponse, error) {
|
||||
func (bs *Server) ListPoolAttesterSlashings(ctx context.Context, req *emptypb.Empty) (*ethpb.AttesterSlashingsPoolResponse, error) {
|
||||
ctx, span := trace.StartSpan(ctx, "beaconv1.ListPoolAttesterSlashings")
|
||||
defer span.End()
|
||||
|
||||
@@ -87,7 +87,7 @@ func (bs *Server) ListPoolAttesterSlashings(ctx context.Context, req *ptypes.Emp
|
||||
|
||||
// SubmitAttesterSlashing submits AttesterSlashing object to node's pool and
|
||||
// if passes validation node MUST broadcast it to network.
|
||||
func (bs *Server) SubmitAttesterSlashing(ctx context.Context, req *ethpb.AttesterSlashing) (*ptypes.Empty, error) {
|
||||
func (bs *Server) SubmitAttesterSlashing(ctx context.Context, req *ethpb.AttesterSlashing) (*emptypb.Empty, error) {
|
||||
ctx, span := trace.StartSpan(ctx, "beaconv1.SubmitAttesterSlashing")
|
||||
defer span.End()
|
||||
|
||||
@@ -112,12 +112,12 @@ func (bs *Server) SubmitAttesterSlashing(ctx context.Context, req *ethpb.Atteste
|
||||
}
|
||||
}
|
||||
|
||||
return &ptypes.Empty{}, nil
|
||||
return &emptypb.Empty{}, nil
|
||||
}
|
||||
|
||||
// ListPoolProposerSlashings retrieves proposer slashings known by the node
|
||||
// but not necessarily incorporated into any block.
|
||||
func (bs *Server) ListPoolProposerSlashings(ctx context.Context, req *ptypes.Empty) (*ethpb.ProposerSlashingPoolResponse, error) {
|
||||
func (bs *Server) ListPoolProposerSlashings(ctx context.Context, req *emptypb.Empty) (*ethpb.ProposerSlashingPoolResponse, error) {
|
||||
ctx, span := trace.StartSpan(ctx, "beaconv1.ListPoolProposerSlashings")
|
||||
defer span.End()
|
||||
|
||||
@@ -139,7 +139,7 @@ func (bs *Server) ListPoolProposerSlashings(ctx context.Context, req *ptypes.Emp
|
||||
|
||||
// SubmitProposerSlashing submits AttesterSlashing object to node's pool and if
|
||||
// passes validation node MUST broadcast it to network.
|
||||
func (bs *Server) SubmitProposerSlashing(ctx context.Context, req *ethpb.ProposerSlashing) (*ptypes.Empty, error) {
|
||||
func (bs *Server) SubmitProposerSlashing(ctx context.Context, req *ethpb.ProposerSlashing) (*emptypb.Empty, error) {
|
||||
ctx, span := trace.StartSpan(ctx, "beaconv1.SubmitProposerSlashing")
|
||||
defer span.End()
|
||||
|
||||
@@ -164,12 +164,12 @@ func (bs *Server) SubmitProposerSlashing(ctx context.Context, req *ethpb.Propose
|
||||
}
|
||||
}
|
||||
|
||||
return &ptypes.Empty{}, nil
|
||||
return &emptypb.Empty{}, nil
|
||||
}
|
||||
|
||||
// ListPoolVoluntaryExits retrieves voluntary exits known by the node but
|
||||
// not necessarily incorporated into any block.
|
||||
func (bs *Server) ListPoolVoluntaryExits(ctx context.Context, req *ptypes.Empty) (*ethpb.VoluntaryExitsPoolResponse, error) {
|
||||
func (bs *Server) ListPoolVoluntaryExits(ctx context.Context, req *emptypb.Empty) (*ethpb.VoluntaryExitsPoolResponse, error) {
|
||||
ctx, span := trace.StartSpan(ctx, "beaconv1.ListPoolVoluntaryExits")
|
||||
defer span.End()
|
||||
|
||||
@@ -192,7 +192,7 @@ func (bs *Server) ListPoolVoluntaryExits(ctx context.Context, req *ptypes.Empty)
|
||||
|
||||
// SubmitVoluntaryExit submits SignedVoluntaryExit object to node's pool
|
||||
// and if passes validation node MUST broadcast it to network.
|
||||
func (bs *Server) SubmitVoluntaryExit(ctx context.Context, req *ethpb.SignedVoluntaryExit) (*ptypes.Empty, error) {
|
||||
func (bs *Server) SubmitVoluntaryExit(ctx context.Context, req *ethpb.SignedVoluntaryExit) (*emptypb.Empty, error) {
|
||||
ctx, span := trace.StartSpan(ctx, "beaconv1.SubmitVoluntaryExit")
|
||||
defer span.End()
|
||||
|
||||
@@ -216,5 +216,5 @@ func (bs *Server) SubmitVoluntaryExit(ctx context.Context, req *ethpb.SignedVolu
|
||||
return nil, status.Errorf(codes.Internal, "Could not broadcast voluntary exit object: %v", err)
|
||||
}
|
||||
|
||||
return &ptypes.Empty{}, nil
|
||||
return &emptypb.Empty{}, nil
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/gogo/protobuf/types"
|
||||
eth2types "github.com/prysmaticlabs/eth2-types"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1"
|
||||
eth "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
@@ -24,6 +23,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
func TestListPoolAttesterSlashings(t *testing.T) {
|
||||
@@ -107,7 +107,7 @@ func TestListPoolAttesterSlashings(t *testing.T) {
|
||||
SlashingsPool: &slashings.PoolMock{PendingAttSlashings: []*eth.AttesterSlashing{slashing1, slashing2}},
|
||||
}
|
||||
|
||||
resp, err := s.ListPoolAttesterSlashings(context.Background(), &types.Empty{})
|
||||
resp, err := s.ListPoolAttesterSlashings(context.Background(), &emptypb.Empty{})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 2, len(resp.Data))
|
||||
assert.DeepEqual(t, migration.V1Alpha1AttSlashingToV1(slashing1), resp.Data[0])
|
||||
@@ -167,7 +167,7 @@ func TestListPoolProposerSlashings(t *testing.T) {
|
||||
SlashingsPool: &slashings.PoolMock{PendingPropSlashings: []*eth.ProposerSlashing{slashing1, slashing2}},
|
||||
}
|
||||
|
||||
resp, err := s.ListPoolProposerSlashings(context.Background(), &types.Empty{})
|
||||
resp, err := s.ListPoolProposerSlashings(context.Background(), &emptypb.Empty{})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 2, len(resp.Data))
|
||||
assert.DeepEqual(t, migration.V1Alpha1ProposerSlashingToV1(slashing1), resp.Data[0])
|
||||
@@ -197,7 +197,7 @@ func TestListPoolVoluntaryExits(t *testing.T) {
|
||||
VoluntaryExitsPool: &voluntaryexits.PoolMock{Exits: []*eth.SignedVoluntaryExit{exit1, exit2}},
|
||||
}
|
||||
|
||||
resp, err := s.ListPoolVoluntaryExits(context.Background(), &types.Empty{})
|
||||
resp, err := s.ListPoolVoluntaryExits(context.Background(), &emptypb.Empty{})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 2, len(resp.Data))
|
||||
assert.DeepEqual(t, migration.V1Alpha1ExitToV1(exit1), resp.Data[0])
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
ptypes "github.com/gogo/protobuf/types"
|
||||
"github.com/pkg/errors"
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1"
|
||||
@@ -19,10 +18,12 @@ import (
|
||||
"go.opencensus.io/trace"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
"google.golang.org/protobuf/types/known/timestamppb"
|
||||
)
|
||||
|
||||
// GetGenesis retrieves details of the chain's genesis which can be used to identify chain.
|
||||
func (bs *Server) GetGenesis(ctx context.Context, _ *ptypes.Empty) (*ethpb.GenesisResponse, error) {
|
||||
func (bs *Server) GetGenesis(ctx context.Context, _ *emptypb.Empty) (*ethpb.GenesisResponse, error) {
|
||||
ctx, span := trace.StartSpan(ctx, "beaconv1.GetGenesis")
|
||||
defer span.End()
|
||||
|
||||
@@ -38,7 +39,7 @@ func (bs *Server) GetGenesis(ctx context.Context, _ *ptypes.Empty) (*ethpb.Genes
|
||||
|
||||
return ðpb.GenesisResponse{
|
||||
Data: ðpb.GenesisResponse_Genesis{
|
||||
GenesisTime: &ptypes.Timestamp{
|
||||
GenesisTime: ×tamppb.Timestamp{
|
||||
Seconds: genesisTime.Unix(),
|
||||
Nanos: 0,
|
||||
},
|
||||
|
||||
@@ -9,7 +9,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
ptypes "github.com/gogo/protobuf/types"
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1"
|
||||
eth "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
@@ -23,6 +22,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
func TestGetGenesis(t *testing.T) {
|
||||
@@ -43,7 +43,7 @@ func TestGetGenesis(t *testing.T) {
|
||||
GenesisTimeFetcher: chainService,
|
||||
ChainInfoFetcher: chainService,
|
||||
}
|
||||
resp, err := s.GetGenesis(ctx, &ptypes.Empty{})
|
||||
resp, err := s.GetGenesis(ctx, &emptypb.Empty{})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, genesis.Unix(), resp.Data.GenesisTime.Seconds)
|
||||
assert.Equal(t, int32(0), resp.Data.GenesisTime.Nanos)
|
||||
@@ -60,7 +60,7 @@ func TestGetGenesis(t *testing.T) {
|
||||
GenesisTimeFetcher: chainService,
|
||||
ChainInfoFetcher: chainService,
|
||||
}
|
||||
_, err := s.GetGenesis(ctx, &ptypes.Empty{})
|
||||
_, err := s.GetGenesis(ctx, &emptypb.Empty{})
|
||||
assert.ErrorContains(t, "Chain genesis info is not yet known", err)
|
||||
})
|
||||
|
||||
@@ -73,7 +73,7 @@ func TestGetGenesis(t *testing.T) {
|
||||
GenesisTimeFetcher: chainService,
|
||||
ChainInfoFetcher: chainService,
|
||||
}
|
||||
_, err := s.GetGenesis(ctx, &ptypes.Empty{})
|
||||
_, err := s.GetGenesis(ctx, &emptypb.Empty{})
|
||||
assert.ErrorContains(t, "Chain genesis info is not yet known", err)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -13,11 +13,11 @@ go_library(
|
||||
"//beacon-chain/blockchain:go_default_library",
|
||||
"//beacon-chain/db:go_default_library",
|
||||
"//beacon-chain/rpc/statefetcher:go_default_library",
|
||||
"@com_github_gogo_protobuf//types:go_default_library",
|
||||
"@com_github_prysmaticlabs_ethereumapis//eth/v1:go_default_library",
|
||||
"@io_opencensus_go//trace:go_default_library",
|
||||
"@org_golang_google_grpc//codes:go_default_library",
|
||||
"@org_golang_google_grpc//status:go_default_library",
|
||||
"@org_golang_google_protobuf//types/known/emptypb:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -32,8 +32,8 @@ go_test(
|
||||
"//shared/testutil:go_default_library",
|
||||
"//shared/testutil/assert:go_default_library",
|
||||
"//shared/testutil/require:go_default_library",
|
||||
"@com_github_gogo_protobuf//types:go_default_library",
|
||||
"@com_github_prysmaticlabs_eth2_types//:go_default_library",
|
||||
"@com_github_prysmaticlabs_ethereumapis//eth/v1:go_default_library",
|
||||
"@org_golang_google_protobuf//types/known/emptypb:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -3,11 +3,11 @@ package debugv1
|
||||
import (
|
||||
"context"
|
||||
|
||||
ptypes "github.com/gogo/protobuf/types"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1"
|
||||
"go.opencensus.io/trace"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
// GetBeaconState returns the full beacon state for a given state id.
|
||||
@@ -28,7 +28,7 @@ func (ds *Server) GetBeaconState(ctx context.Context, req *ethpb.StateRequest) (
|
||||
}
|
||||
|
||||
// ListForkChoiceHeads retrieves the fork choice leaves for the current head.
|
||||
func (ds *Server) ListForkChoiceHeads(ctx context.Context, _ *ptypes.Empty) (*ethpb.ForkChoiceHeadsResponse, error) {
|
||||
func (ds *Server) ListForkChoiceHeads(ctx context.Context, _ *emptypb.Empty) (*ethpb.ForkChoiceHeadsResponse, error) {
|
||||
ctx, span := trace.StartSpan(ctx, "debugv1.ListForkChoiceHeads")
|
||||
defer span.End()
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
protoTypes "github.com/gogo/protobuf/types"
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1"
|
||||
blockchainmock "github.com/prysmaticlabs/prysm/beacon-chain/blockchain/testing"
|
||||
@@ -13,6 +12,7 @@ import (
|
||||
sharedtestutil "github.com/prysmaticlabs/prysm/shared/testutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
func TestGetBeaconState(t *testing.T) {
|
||||
@@ -47,7 +47,7 @@ func TestListForkChoiceHeads(t *testing.T) {
|
||||
server := &Server{
|
||||
HeadFetcher: &blockchainmock.ChainService{},
|
||||
}
|
||||
resp, err := server.ListForkChoiceHeads(ctx, &protoTypes.Empty{})
|
||||
resp, err := server.ListForkChoiceHeads(ctx, &emptypb.Empty{})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 2, len(resp.Data))
|
||||
for _, sr := range expectedSlotsAndRoots {
|
||||
|
||||
@@ -14,11 +14,12 @@ go_library(
|
||||
"//proto/beacon/rpc/v1:go_default_library",
|
||||
"//shared/logutil:go_default_library",
|
||||
"//shared/version:go_default_library",
|
||||
"@com_github_gogo_protobuf//types:go_default_library",
|
||||
"@com_github_golang_protobuf//ptypes:go_default_library_gen",
|
||||
"@com_github_libp2p_go_libp2p_core//network:go_default_library",
|
||||
"@com_github_libp2p_go_libp2p_core//peer:go_default_library",
|
||||
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
|
||||
"@io_bazel_rules_go//proto/wkt:empty_go_proto",
|
||||
"@io_bazel_rules_go//proto/wkt:timestamp_go_proto",
|
||||
"@org_golang_google_grpc//:go_default_library",
|
||||
"@org_golang_google_grpc//codes:go_default_library",
|
||||
"@org_golang_google_grpc//status:go_default_library",
|
||||
@@ -43,9 +44,10 @@ go_test(
|
||||
"@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",
|
||||
"@com_github_gogo_protobuf//types:go_default_library",
|
||||
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
|
||||
"@org_golang_google_grpc//:go_default_library",
|
||||
"@org_golang_google_grpc//reflection:go_default_library",
|
||||
"@org_golang_google_protobuf//types/known/emptypb:go_default_library",
|
||||
"@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -9,8 +9,9 @@ import (
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
ptypes "github.com/gogo/protobuf/types"
|
||||
"github.com/golang/protobuf/ptypes"
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
"github.com/golang/protobuf/ptypes/timestamp"
|
||||
"github.com/libp2p/go-libp2p-core/network"
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
@@ -44,7 +45,7 @@ type Server struct {
|
||||
}
|
||||
|
||||
// GetSyncStatus checks the current network sync status of the node.
|
||||
func (ns *Server) GetSyncStatus(_ context.Context, _ *ptypes.Empty) (*ethpb.SyncStatus, error) {
|
||||
func (ns *Server) GetSyncStatus(_ context.Context, _ *empty.Empty) (*ethpb.SyncStatus, error) {
|
||||
return ðpb.SyncStatus{
|
||||
Syncing: ns.SyncChecker.Syncing(),
|
||||
}, nil
|
||||
@@ -52,14 +53,14 @@ func (ns *Server) GetSyncStatus(_ context.Context, _ *ptypes.Empty) (*ethpb.Sync
|
||||
|
||||
// GetGenesis fetches genesis chain information of Ethereum 2.0. Returns unix timestamp 0
|
||||
// if a genesis time has yet to be determined.
|
||||
func (ns *Server) GetGenesis(ctx context.Context, _ *ptypes.Empty) (*ethpb.Genesis, error) {
|
||||
func (ns *Server) GetGenesis(ctx context.Context, _ *empty.Empty) (*ethpb.Genesis, error) {
|
||||
contractAddr, err := ns.BeaconDB.DepositContractAddress(ctx)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "Could not retrieve contract address from db: %v", err)
|
||||
}
|
||||
genesisTime := ns.GenesisTimeFetcher.GenesisTime()
|
||||
var defaultGenesisTime time.Time
|
||||
var gt *ptypes.Timestamp
|
||||
var gt *timestamp.Timestamp
|
||||
if genesisTime == defaultGenesisTime {
|
||||
gt, err = ptypes.TimestampProto(time.Unix(0, 0))
|
||||
} else {
|
||||
@@ -78,7 +79,7 @@ func (ns *Server) GetGenesis(ctx context.Context, _ *ptypes.Empty) (*ethpb.Genes
|
||||
}
|
||||
|
||||
// GetVersion checks the version information of the beacon node.
|
||||
func (ns *Server) GetVersion(_ context.Context, _ *ptypes.Empty) (*ethpb.Version, error) {
|
||||
func (ns *Server) GetVersion(_ context.Context, _ *empty.Empty) (*ethpb.Version, error) {
|
||||
return ðpb.Version{
|
||||
Version: version.Version(),
|
||||
}, nil
|
||||
@@ -89,7 +90,7 @@ func (ns *Server) GetVersion(_ context.Context, _ *ptypes.Empty) (*ethpb.Version
|
||||
// Any service not present in this list may return UNIMPLEMENTED or
|
||||
// PERMISSION_DENIED. The server may also support fetching services by grpc
|
||||
// reflection.
|
||||
func (ns *Server) ListImplementedServices(_ context.Context, _ *ptypes.Empty) (*ethpb.ImplementedServices, error) {
|
||||
func (ns *Server) ListImplementedServices(_ context.Context, _ *empty.Empty) (*ethpb.ImplementedServices, error) {
|
||||
serviceInfo := ns.Server.GetServiceInfo()
|
||||
serviceNames := make([]string, 0, len(serviceInfo))
|
||||
for svc := range serviceInfo {
|
||||
@@ -102,7 +103,7 @@ func (ns *Server) ListImplementedServices(_ context.Context, _ *ptypes.Empty) (*
|
||||
}
|
||||
|
||||
// GetHost returns the p2p data on the current local and host peer.
|
||||
func (ns *Server) GetHost(_ context.Context, _ *ptypes.Empty) (*ethpb.HostData, error) {
|
||||
func (ns *Server) GetHost(_ context.Context, _ *empty.Empty) (*ethpb.HostData, error) {
|
||||
var stringAddr []string
|
||||
for _, addr := range ns.PeerManager.Host().Addrs() {
|
||||
stringAddr = append(stringAddr, addr.String())
|
||||
@@ -170,7 +171,7 @@ func (ns *Server) GetPeer(_ context.Context, peerReq *ethpb.PeerRequest) (*ethpb
|
||||
}
|
||||
|
||||
// ListPeers lists the peers connected to this node.
|
||||
func (ns *Server) ListPeers(ctx context.Context, _ *ptypes.Empty) (*ethpb.Peers, error) {
|
||||
func (ns *Server) ListPeers(ctx context.Context, _ *empty.Empty) (*ethpb.Peers, error) {
|
||||
peers := ns.PeersFetcher.Peers().Connected()
|
||||
res := make([]*ethpb.Peer, 0, len(peers))
|
||||
for _, pid := range peers {
|
||||
|
||||
@@ -8,11 +8,7 @@ import (
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/p2p/enode"
|
||||
ptypes "github.com/gogo/protobuf/types"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/reflection"
|
||||
|
||||
mock "github.com/prysmaticlabs/prysm/beacon-chain/blockchain/testing"
|
||||
dbutil "github.com/prysmaticlabs/prysm/beacon-chain/db/testing"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/p2p"
|
||||
@@ -23,6 +19,10 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"github.com/prysmaticlabs/prysm/shared/version"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/reflection"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
"google.golang.org/protobuf/types/known/timestamppb"
|
||||
)
|
||||
|
||||
func TestNodeServer_GetSyncStatus(t *testing.T) {
|
||||
@@ -30,11 +30,11 @@ func TestNodeServer_GetSyncStatus(t *testing.T) {
|
||||
ns := &Server{
|
||||
SyncChecker: mSync,
|
||||
}
|
||||
res, err := ns.GetSyncStatus(context.Background(), &ptypes.Empty{})
|
||||
res, err := ns.GetSyncStatus(context.Background(), &emptypb.Empty{})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, false, res.Syncing)
|
||||
ns.SyncChecker = &mockSync.Sync{IsSyncing: true}
|
||||
res, err = ns.GetSyncStatus(context.Background(), &ptypes.Empty{})
|
||||
res, err = ns.GetSyncStatus(context.Background(), &emptypb.Empty{})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, true, res.Syncing)
|
||||
}
|
||||
@@ -55,26 +55,24 @@ func TestNodeServer_GetGenesis(t *testing.T) {
|
||||
ValidatorsRoot: genValRoot,
|
||||
},
|
||||
}
|
||||
res, err := ns.GetGenesis(context.Background(), &ptypes.Empty{})
|
||||
res, err := ns.GetGenesis(context.Background(), &emptypb.Empty{})
|
||||
require.NoError(t, err)
|
||||
assert.DeepEqual(t, addr.Bytes(), res.DepositContractAddress)
|
||||
pUnix, err := ptypes.TimestampProto(time.Unix(0, 0))
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, true, res.GenesisTime.Equal(pUnix))
|
||||
pUnix := timestamppb.New(time.Unix(0, 0))
|
||||
assert.Equal(t, res.GenesisTime.Seconds, pUnix.Seconds)
|
||||
assert.DeepEqual(t, genValRoot[:], res.GenesisValidatorsRoot)
|
||||
|
||||
ns.GenesisTimeFetcher = &mock.ChainService{Genesis: time.Unix(10, 0)}
|
||||
res, err = ns.GetGenesis(context.Background(), &ptypes.Empty{})
|
||||
res, err = ns.GetGenesis(context.Background(), &emptypb.Empty{})
|
||||
require.NoError(t, err)
|
||||
pUnix, err = ptypes.TimestampProto(time.Unix(10, 0))
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, true, res.GenesisTime.Equal(pUnix))
|
||||
pUnix = timestamppb.New(time.Unix(10, 0))
|
||||
assert.Equal(t, res.GenesisTime.Seconds, pUnix.Seconds)
|
||||
}
|
||||
|
||||
func TestNodeServer_GetVersion(t *testing.T) {
|
||||
v := version.Version()
|
||||
ns := &Server{}
|
||||
res, err := ns.GetVersion(context.Background(), &ptypes.Empty{})
|
||||
res, err := ns.GetVersion(context.Background(), &emptypb.Empty{})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, v, res.Version)
|
||||
}
|
||||
@@ -87,7 +85,7 @@ func TestNodeServer_GetImplementedServices(t *testing.T) {
|
||||
ethpb.RegisterNodeServer(server, ns)
|
||||
reflection.Register(server)
|
||||
|
||||
res, err := ns.ListImplementedServices(context.Background(), &ptypes.Empty{})
|
||||
res, err := ns.ListImplementedServices(context.Background(), &emptypb.Empty{})
|
||||
require.NoError(t, err)
|
||||
// We verify the services include the node service + the registered reflection service.
|
||||
assert.Equal(t, 2, len(res.Services))
|
||||
@@ -111,7 +109,7 @@ func TestNodeServer_GetHost(t *testing.T) {
|
||||
}
|
||||
ethpb.RegisterNodeServer(server, ns)
|
||||
reflection.Register(server)
|
||||
h, err := ns.GetHost(context.Background(), &ptypes.Empty{})
|
||||
h, err := ns.GetHost(context.Background(), &emptypb.Empty{})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, mP2P.PeerID().String(), h.PeerId)
|
||||
assert.Equal(t, stringENR, h.Enr)
|
||||
@@ -143,7 +141,7 @@ func TestNodeServer_ListPeers(t *testing.T) {
|
||||
ethpb.RegisterNodeServer(server, ns)
|
||||
reflection.Register(server)
|
||||
|
||||
res, err := ns.ListPeers(context.Background(), &ptypes.Empty{})
|
||||
res, err := ns.ListPeers(context.Background(), &emptypb.Empty{})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 2, len(res.Peers))
|
||||
assert.Equal(t, int(ethpb.PeerDirection_INBOUND), int(res.Peers[0].Direction))
|
||||
|
||||
@@ -17,7 +17,6 @@ go_library(
|
||||
"//beacon-chain/p2p/peers/peerdata:go_default_library",
|
||||
"//beacon-chain/sync:go_default_library",
|
||||
"//shared/version:go_default_library",
|
||||
"@com_github_gogo_protobuf//types:go_default_library",
|
||||
"@com_github_libp2p_go_libp2p_core//peer:go_default_library",
|
||||
"@com_github_pkg_errors//:go_default_library",
|
||||
"@com_github_prysmaticlabs_ethereumapis//eth/v1:go_default_library",
|
||||
@@ -25,6 +24,7 @@ go_library(
|
||||
"@org_golang_google_grpc//:go_default_library",
|
||||
"@org_golang_google_grpc//codes:go_default_library",
|
||||
"@org_golang_google_grpc//status:go_default_library",
|
||||
"@org_golang_google_protobuf//types/known/emptypb:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -48,7 +48,6 @@ go_test(
|
||||
"//shared/version: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_gogo_protobuf//types:go_default_library",
|
||||
"@com_github_libp2p_go_libp2p_core//network:go_default_library",
|
||||
"@com_github_libp2p_go_libp2p_core//peer:go_default_library",
|
||||
"@com_github_libp2p_go_libp2p_peerstore//test:go_default_library",
|
||||
@@ -56,5 +55,6 @@ go_test(
|
||||
"@com_github_prysmaticlabs_eth2_types//:go_default_library",
|
||||
"@com_github_prysmaticlabs_ethereumapis//eth/v1:go_default_library",
|
||||
"@com_github_prysmaticlabs_go_bitfield//:go_default_library",
|
||||
"@org_golang_google_protobuf//types/known/emptypb:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
ptypes "github.com/gogo/protobuf/types"
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
"github.com/pkg/errors"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1"
|
||||
@@ -17,6 +16,7 @@ import (
|
||||
"go.opencensus.io/trace"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -29,7 +29,7 @@ var (
|
||||
)
|
||||
|
||||
// GetIdentity retrieves data about the node's network presence.
|
||||
func (ns *Server) GetIdentity(ctx context.Context, _ *ptypes.Empty) (*ethpb.IdentityResponse, error) {
|
||||
func (ns *Server) GetIdentity(ctx context.Context, _ *emptypb.Empty) (*ethpb.IdentityResponse, error) {
|
||||
ctx, span := trace.StartSpan(ctx, "nodeV1.GetIdentity")
|
||||
defer span.End()
|
||||
|
||||
@@ -207,7 +207,7 @@ func (ns *Server) ListPeers(ctx context.Context, req *ethpb.PeersRequest) (*ethp
|
||||
}
|
||||
|
||||
// PeerCount retrieves retrieves number of known peers.
|
||||
func (ns *Server) PeerCount(ctx context.Context, _ *ptypes.Empty) (*ethpb.PeerCountResponse, error) {
|
||||
func (ns *Server) PeerCount(ctx context.Context, _ *emptypb.Empty) (*ethpb.PeerCountResponse, error) {
|
||||
ctx, span := trace.StartSpan(ctx, "nodev1.PeerCount")
|
||||
defer span.End()
|
||||
|
||||
@@ -225,7 +225,7 @@ func (ns *Server) PeerCount(ctx context.Context, _ *ptypes.Empty) (*ethpb.PeerCo
|
||||
|
||||
// GetVersion requests that the beacon node identify information about its implementation in a
|
||||
// format similar to a HTTP User-Agent field.
|
||||
func (ns *Server) GetVersion(ctx context.Context, _ *ptypes.Empty) (*ethpb.VersionResponse, error) {
|
||||
func (ns *Server) GetVersion(ctx context.Context, _ *emptypb.Empty) (*ethpb.VersionResponse, error) {
|
||||
ctx, span := trace.StartSpan(ctx, "nodev1.Version")
|
||||
defer span.End()
|
||||
|
||||
@@ -239,7 +239,7 @@ func (ns *Server) GetVersion(ctx context.Context, _ *ptypes.Empty) (*ethpb.Versi
|
||||
|
||||
// GetSyncStatus requests the beacon node to describe if it's currently syncing or not, and
|
||||
// if it is, what block it is up to.
|
||||
func (ns *Server) GetSyncStatus(ctx context.Context, _ *ptypes.Empty) (*ethpb.SyncingResponse, error) {
|
||||
func (ns *Server) GetSyncStatus(ctx context.Context, _ *emptypb.Empty) (*ethpb.SyncingResponse, error) {
|
||||
ctx, span := trace.StartSpan(ctx, "nodev1.GetSyncStatus")
|
||||
defer span.End()
|
||||
|
||||
@@ -260,14 +260,14 @@ func (ns *Server) GetSyncStatus(ctx context.Context, _ *ptypes.Empty) (*ethpb.Sy
|
||||
// description: Node is syncing but can serve incomplete data
|
||||
// "503":
|
||||
// description: Node not initialized or having issues
|
||||
func (ns *Server) GetHealth(ctx context.Context, _ *ptypes.Empty) (*ptypes.Empty, error) {
|
||||
func (ns *Server) GetHealth(ctx context.Context, _ *emptypb.Empty) (*emptypb.Empty, error) {
|
||||
ctx, span := trace.StartSpan(ctx, "nodev1.GetHealth")
|
||||
defer span.End()
|
||||
|
||||
if ns.SyncChecker.Syncing() || ns.SyncChecker.Initialized() {
|
||||
return &ptypes.Empty{}, nil
|
||||
return &emptypb.Empty{}, nil
|
||||
}
|
||||
return &ptypes.Empty{}, status.Error(codes.Internal, "Node not initialized or having issues")
|
||||
return &emptypb.Empty{}, status.Error(codes.Internal, "Node not initialized or having issues")
|
||||
}
|
||||
|
||||
func (ns *Server) handleEmptyFilters(req *ethpb.PeersRequest, peerStatus *peers.Status) (emptyState, emptyDirection bool) {
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
|
||||
"github.com/ethereum/go-ethereum/p2p/enode"
|
||||
"github.com/ethereum/go-ethereum/p2p/enr"
|
||||
ptypes "github.com/gogo/protobuf/types"
|
||||
"github.com/libp2p/go-libp2p-core/network"
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
libp2ptest "github.com/libp2p/go-libp2p-peerstore/test"
|
||||
@@ -28,6 +27,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"github.com/prysmaticlabs/prysm/shared/version"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
type dummyIdentity enode.ID
|
||||
@@ -39,7 +39,7 @@ func TestGetVersion(t *testing.T) {
|
||||
semVer := version.SemanticVersion()
|
||||
os := runtime.GOOS
|
||||
arch := runtime.GOARCH
|
||||
res, err := (&Server{}).GetVersion(context.Background(), &ptypes.Empty{})
|
||||
res, err := (&Server{}).GetVersion(context.Background(), &emptypb.Empty{})
|
||||
require.NoError(t, err)
|
||||
v := res.Data.Version
|
||||
assert.Equal(t, true, strings.Contains(v, semVer))
|
||||
@@ -54,10 +54,10 @@ func TestGetHealth(t *testing.T) {
|
||||
SyncChecker: checker,
|
||||
}
|
||||
|
||||
_, err := s.GetHealth(ctx, &ptypes.Empty{})
|
||||
_, err := s.GetHealth(ctx, &emptypb.Empty{})
|
||||
require.ErrorContains(t, "Node not initialized or having issues", err)
|
||||
checker.IsInitialized = true
|
||||
_, err = s.GetHealth(ctx, &ptypes.Empty{})
|
||||
_, err = s.GetHealth(ctx, &emptypb.Empty{})
|
||||
require.NoError(t, err)
|
||||
checker.IsInitialized = false
|
||||
checker.IsSyncing = true
|
||||
@@ -94,7 +94,7 @@ func TestGetIdentity(t *testing.T) {
|
||||
MetadataProvider: metadataProvider,
|
||||
}
|
||||
|
||||
resp, err := s.GetIdentity(ctx, &ptypes.Empty{})
|
||||
resp, err := s.GetIdentity(ctx, &emptypb.Empty{})
|
||||
require.NoError(t, err)
|
||||
expectedID := peer.ID("foo").Pretty()
|
||||
assert.Equal(t, expectedID, resp.Data.PeerId)
|
||||
@@ -130,7 +130,7 @@ func TestGetIdentity(t *testing.T) {
|
||||
MetadataProvider: metadataProvider,
|
||||
}
|
||||
|
||||
_, err = s.GetIdentity(ctx, &ptypes.Empty{})
|
||||
_, err = s.GetIdentity(ctx, &emptypb.Empty{})
|
||||
assert.ErrorContains(t, "could not obtain enr", err)
|
||||
})
|
||||
|
||||
@@ -147,7 +147,7 @@ func TestGetIdentity(t *testing.T) {
|
||||
MetadataProvider: metadataProvider,
|
||||
}
|
||||
|
||||
_, err = s.GetIdentity(ctx, &ptypes.Empty{})
|
||||
_, err = s.GetIdentity(ctx, &emptypb.Empty{})
|
||||
assert.ErrorContains(t, "could not obtain discovery address", err)
|
||||
})
|
||||
}
|
||||
@@ -165,7 +165,7 @@ func TestSyncStatus(t *testing.T) {
|
||||
HeadFetcher: chainService,
|
||||
GenesisTimeFetcher: chainService,
|
||||
}
|
||||
resp, err := s.GetSyncStatus(context.Background(), &ptypes.Empty{})
|
||||
resp, err := s.GetSyncStatus(context.Background(), &emptypb.Empty{})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, types.Slot(100), resp.Data.HeadSlot)
|
||||
assert.Equal(t, types.Slot(10), resp.Data.SyncDistance)
|
||||
@@ -401,7 +401,7 @@ func TestPeerCount(t *testing.T) {
|
||||
}
|
||||
|
||||
s := Server{PeersFetcher: peerFetcher}
|
||||
resp, err := s.PeerCount(context.Background(), &ptypes.Empty{})
|
||||
resp, err := s.PeerCount(context.Background(), &emptypb.Empty{})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, uint64(1), resp.Data.Connecting, "Wrong number of connecting peers")
|
||||
assert.Equal(t, uint64(2), resp.Data.Connected, "Wrong number of connected peers")
|
||||
|
||||
@@ -54,7 +54,6 @@ go_library(
|
||||
"//shared/traceutil:go_default_library",
|
||||
"//shared/trieutil:go_default_library",
|
||||
"@com_github_ferranbt_fastssz//:go_default_library",
|
||||
"@com_github_gogo_protobuf//types:go_default_library",
|
||||
"@com_github_pkg_errors//:go_default_library",
|
||||
"@com_github_prysmaticlabs_eth2_types//:go_default_library",
|
||||
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
|
||||
@@ -63,6 +62,7 @@ go_library(
|
||||
"@io_opencensus_go//trace:go_default_library",
|
||||
"@org_golang_google_grpc//codes:go_default_library",
|
||||
"@org_golang_google_grpc//status:go_default_library",
|
||||
"@org_golang_google_protobuf//types/known/emptypb:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -117,13 +117,13 @@ go_test(
|
||||
"//shared/testutil/require:go_default_library",
|
||||
"//shared/timeutils:go_default_library",
|
||||
"//shared/trieutil:go_default_library",
|
||||
"@com_github_gogo_protobuf//proto:go_default_library",
|
||||
"@com_github_gogo_protobuf//types:go_default_library",
|
||||
"@com_github_golang_mock//gomock:go_default_library",
|
||||
"@com_github_prysmaticlabs_eth2_types//:go_default_library",
|
||||
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
|
||||
"@com_github_prysmaticlabs_go_bitfield//:go_default_library",
|
||||
"@com_github_sirupsen_logrus//:go_default_library",
|
||||
"@com_github_sirupsen_logrus//hooks/test:go_default_library",
|
||||
"@org_golang_google_protobuf//proto:go_default_library",
|
||||
"@org_golang_google_protobuf//types/known/emptypb:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
ptypes "github.com/gogo/protobuf/types"
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/cache"
|
||||
@@ -21,6 +20,7 @@ import (
|
||||
"go.opencensus.io/trace"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
// GetAttestationData requests that the beacon node produce an attestation data object,
|
||||
@@ -195,7 +195,7 @@ func (vs *Server) ProposeAttestation(ctx context.Context, att *ethpb.Attestation
|
||||
}
|
||||
|
||||
// SubscribeCommitteeSubnets subscribes to the committee ID subnet given subscribe request.
|
||||
func (vs *Server) SubscribeCommitteeSubnets(ctx context.Context, req *ethpb.CommitteeSubnetsSubscribeRequest) (*ptypes.Empty, error) {
|
||||
func (vs *Server) SubscribeCommitteeSubnets(ctx context.Context, req *ethpb.CommitteeSubnetsSubscribeRequest) (*emptypb.Empty, error) {
|
||||
ctx, span := trace.StartSpan(ctx, "AttesterServer.SubscribeCommitteeSubnets")
|
||||
defer span.End()
|
||||
|
||||
@@ -239,5 +239,5 @@ func (vs *Server) SubscribeCommitteeSubnets(ctx context.Context, req *ethpb.Comm
|
||||
}
|
||||
}
|
||||
|
||||
return &ptypes.Empty{}, nil
|
||||
return &emptypb.Empty{}, nil
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
mock "github.com/prysmaticlabs/prysm/beacon-chain/blockchain/testing"
|
||||
@@ -27,6 +26,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"github.com/prysmaticlabs/prysm/shared/timeutils"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func TestProposeAttestation_OK(t *testing.T) {
|
||||
|
||||
@@ -40,7 +40,7 @@ var eth1DataNotification bool
|
||||
const eth1dataTimeout = 2 * time.Second
|
||||
|
||||
type eth1DataSingleVote struct {
|
||||
eth1Data ethpb.Eth1Data
|
||||
eth1Data *ethpb.Eth1Data
|
||||
blockHeight *big.Int
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ func (vs *Server) inRangeVotes(ctx context.Context,
|
||||
// lastValidBlockNumber.Cmp(height) > -1 filters out all blocks after lastValidBlockNumber
|
||||
// These filters result in the range [firstValidBlockNumber, lastValidBlockNumber]
|
||||
if exists && firstValidBlockNumber.Cmp(height) < 1 && lastValidBlockNumber.Cmp(height) > -1 {
|
||||
inRangeVotes = append(inRangeVotes, eth1DataSingleVote{eth1Data: *eth1Data, blockHeight: height})
|
||||
inRangeVotes = append(inRangeVotes, eth1DataSingleVote{eth1Data: eth1Data, blockHeight: height})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"math/big"
|
||||
"testing"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/go-bitfield"
|
||||
@@ -33,6 +32,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"github.com/prysmaticlabs/prysm/shared/trieutil"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func TestProposer_GetBlock_OK(t *testing.T) {
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
ptypes "github.com/gogo/protobuf/types"
|
||||
"github.com/pkg/errors"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/blockchain"
|
||||
@@ -31,6 +30,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/params"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
// Server defines a server implementation of the gRPC Validator service,
|
||||
@@ -137,7 +137,7 @@ func (vs *Server) DomainData(_ context.Context, request *ethpb.DomainRequest) (*
|
||||
|
||||
// CanonicalHead of the current beacon chain. This method is requested on-demand
|
||||
// by a validator when it is their time to propose or attest.
|
||||
func (vs *Server) CanonicalHead(ctx context.Context, _ *ptypes.Empty) (*ethpb.SignedBeaconBlock, error) {
|
||||
func (vs *Server) CanonicalHead(ctx context.Context, _ *emptypb.Empty) (*ethpb.SignedBeaconBlock, error) {
|
||||
headBlk, err := vs.HeadFetcher.HeadBlock(ctx)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "Could not get head block: %v", err)
|
||||
@@ -149,7 +149,7 @@ func (vs *Server) CanonicalHead(ctx context.Context, _ *ptypes.Empty) (*ethpb.Si
|
||||
// has started its runtime and validators begin their responsibilities. If it has not, it then
|
||||
// subscribes to an event stream triggered by the powchain service whenever the ChainStart log does
|
||||
// occur in the Deposit Contract on ETH 1.0.
|
||||
func (vs *Server) WaitForChainStart(_ *ptypes.Empty, stream ethpb.BeaconNodeValidator_WaitForChainStartServer) error {
|
||||
func (vs *Server) WaitForChainStart(_ *emptypb.Empty, stream ethpb.BeaconNodeValidator_WaitForChainStartServer) error {
|
||||
head, err := vs.HeadFetcher.HeadState(stream.Context())
|
||||
if err != nil {
|
||||
return status.Errorf(codes.Internal, "Could not retrieve head state: %v", err)
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
ptypes "github.com/gogo/protobuf/types"
|
||||
"github.com/golang/mock/gomock"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
mockChain "github.com/prysmaticlabs/prysm/beacon-chain/blockchain/testing"
|
||||
@@ -28,6 +27,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"github.com/prysmaticlabs/prysm/shared/trieutil"
|
||||
logTest "github.com/sirupsen/logrus/hooks/test"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
func TestValidatorIndex_OK(t *testing.T) {
|
||||
@@ -305,7 +305,7 @@ func TestWaitForChainStart_ContextClosed(t *testing.T) {
|
||||
mockStream := mock.NewMockBeaconNodeValidator_WaitForChainStartServer(ctrl)
|
||||
mockStream.EXPECT().Context().Return(ctx)
|
||||
go func(tt *testing.T) {
|
||||
err := Server.WaitForChainStart(&ptypes.Empty{}, mockStream)
|
||||
err := Server.WaitForChainStart(&emptypb.Empty{}, mockStream)
|
||||
assert.ErrorContains(tt, "Context canceled", err)
|
||||
<-exitRoutine
|
||||
}(t)
|
||||
@@ -346,7 +346,7 @@ func TestWaitForChainStart_AlreadyStarted(t *testing.T) {
|
||||
},
|
||||
).Return(nil)
|
||||
mockStream.EXPECT().Context().Return(context.Background())
|
||||
assert.NoError(t, Server.WaitForChainStart(&ptypes.Empty{}, mockStream), "Could not call RPC method")
|
||||
assert.NoError(t, Server.WaitForChainStart(&emptypb.Empty{}, mockStream), "Could not call RPC method")
|
||||
}
|
||||
|
||||
func TestWaitForChainStart_HeadStateDoesNotExist(t *testing.T) {
|
||||
@@ -373,7 +373,7 @@ func TestWaitForChainStart_HeadStateDoesNotExist(t *testing.T) {
|
||||
wg := new(sync.WaitGroup)
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
assert.NoError(t, Server.WaitForChainStart(&ptypes.Empty{}, mockStream), "Could not call RPC method")
|
||||
assert.NoError(t, Server.WaitForChainStart(&emptypb.Empty{}, mockStream), "Could not call RPC method")
|
||||
wg.Done()
|
||||
}()
|
||||
// Simulate a late state initialization event, so that
|
||||
@@ -416,7 +416,7 @@ func TestWaitForChainStart_NotStartedThenLogFired(t *testing.T) {
|
||||
).Return(nil)
|
||||
mockStream.EXPECT().Context().Return(context.Background())
|
||||
go func(tt *testing.T) {
|
||||
assert.NoError(tt, Server.WaitForChainStart(&ptypes.Empty{}, mockStream))
|
||||
assert.NoError(tt, Server.WaitForChainStart(&emptypb.Empty{}, mockStream))
|
||||
<-exitRoutine
|
||||
}(t)
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
mockChain "github.com/prysmaticlabs/prysm/beacon-chain/blockchain/testing"
|
||||
@@ -22,6 +21,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"github.com/prysmaticlabs/prysm/shared/trieutil"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func TestValidatorStatus_DepositedEth1(t *testing.T) {
|
||||
|
||||
@@ -55,7 +55,6 @@ go_library(
|
||||
"//shared/params:go_default_library",
|
||||
"//shared/sliceutil:go_default_library",
|
||||
"@com_github_dgraph_io_ristretto//:go_default_library",
|
||||
"@com_github_gogo_protobuf//proto:go_default_library",
|
||||
"@com_github_pkg_errors//:go_default_library",
|
||||
"@com_github_prometheus_client_golang//prometheus:go_default_library",
|
||||
"@com_github_prometheus_client_golang//prometheus/promauto:go_default_library",
|
||||
@@ -64,6 +63,7 @@ go_library(
|
||||
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
|
||||
"@com_github_prysmaticlabs_go_bitfield//:go_default_library",
|
||||
"@io_opencensus_go//trace:go_default_library",
|
||||
"@org_golang_google_protobuf//proto:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -91,10 +91,10 @@ go_test(
|
||||
"//shared/testutil:go_default_library",
|
||||
"//shared/testutil/assert:go_default_library",
|
||||
"//shared/testutil/require:go_default_library",
|
||||
"@com_github_gogo_protobuf//proto:go_default_library",
|
||||
"@com_github_prysmaticlabs_eth2_types//:go_default_library",
|
||||
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
|
||||
"@com_github_prysmaticlabs_go_bitfield//:go_default_library",
|
||||
"@com_github_sirupsen_logrus//:go_default_library",
|
||||
"@org_golang_google_protobuf//proto:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package stateV0
|
||||
|
||||
import (
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/pkg/errors"
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/state/stateutil"
|
||||
pbp2p "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
|
||||
"github.com/prysmaticlabs/prysm/shared/hashutil"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
// For our setters, we have a field reference counter through
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"sort"
|
||||
"sync"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promauto"
|
||||
@@ -20,6 +19,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/params"
|
||||
"github.com/prysmaticlabs/prysm/shared/sliceutil"
|
||||
"go.opencensus.io/trace"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -29,7 +29,7 @@ var (
|
||||
})
|
||||
)
|
||||
|
||||
// InitializeFromProto the beacon state from a protobuf representation.
|
||||
// InitializeFromProtog the beacon state from a protobuf representation.
|
||||
func InitializeFromProto(st *pbp2p.BeaconState) (*BeaconState, error) {
|
||||
return InitializeFromProtoUnsafe(proto.Clone(st).(*pbp2p.BeaconState))
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/state/stateV0"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
|
||||
@@ -16,6 +15,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func TestBeaconState_ProtoBeaconStateCompatibility(t *testing.T) {
|
||||
|
||||
@@ -67,9 +67,9 @@ go_test(
|
||||
"//shared/testutil:go_default_library",
|
||||
"//shared/testutil/assert:go_default_library",
|
||||
"//shared/testutil/require:go_default_library",
|
||||
"@com_github_gogo_protobuf//proto:go_default_library",
|
||||
"@com_github_prysmaticlabs_eth2_types//:go_default_library",
|
||||
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
|
||||
"@com_github_sirupsen_logrus//hooks/test:go_default_library",
|
||||
"@org_golang_google_protobuf//proto:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/core/blocks"
|
||||
@@ -16,6 +15,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func TestReplayBlocks_AllSkipSlots(t *testing.T) {
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
@@ -20,7 +19,9 @@ func TestState_FieldCount(t *testing.T) {
|
||||
typ := reflect.TypeOf(pb.BeaconState{})
|
||||
numFields := 0
|
||||
for i := 0; i < typ.NumField(); i++ {
|
||||
if strings.HasPrefix(typ.Field(i).Name, "XXX_") {
|
||||
if typ.Field(i).Name == "state" ||
|
||||
typ.Field(i).Name == "sizeCache" ||
|
||||
typ.Field(i).Name == "unknownFields" {
|
||||
continue
|
||||
}
|
||||
numFields++
|
||||
|
||||
@@ -81,7 +81,6 @@ go_library(
|
||||
"//shared/sszutil:go_default_library",
|
||||
"//shared/timeutils:go_default_library",
|
||||
"//shared/traceutil:go_default_library",
|
||||
"@com_github_gogo_protobuf//proto:go_default_library",
|
||||
"@com_github_hashicorp_golang_lru//:go_default_library",
|
||||
"@com_github_kevinms_leakybucket_go//:go_default_library",
|
||||
"@com_github_libp2p_go_libp2p_core//:go_default_library",
|
||||
@@ -99,6 +98,7 @@ go_library(
|
||||
"@com_github_sirupsen_logrus//:go_default_library",
|
||||
"@com_github_trailofbits_go_mutexasserts//:go_default_library",
|
||||
"@io_opencensus_go//trace:go_default_library",
|
||||
"@org_golang_google_protobuf//proto:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -170,7 +170,6 @@ go_test(
|
||||
"//shared/timeutils:go_default_library",
|
||||
"@com_github_d4l3k_messagediff//:go_default_library",
|
||||
"@com_github_ethereum_go_ethereum//p2p/enr:go_default_library",
|
||||
"@com_github_gogo_protobuf//proto:go_default_library",
|
||||
"@com_github_hashicorp_golang_lru//:go_default_library",
|
||||
"@com_github_kevinms_leakybucket_go//:go_default_library",
|
||||
"@com_github_libp2p_go_libp2p_core//:go_default_library",
|
||||
@@ -186,5 +185,6 @@ go_test(
|
||||
"@com_github_prysmaticlabs_go_bitfield//:go_default_library",
|
||||
"@com_github_sirupsen_logrus//:go_default_library",
|
||||
"@com_github_sirupsen_logrus//hooks/test:go_default_library",
|
||||
"@org_golang_google_protobuf//proto:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -4,9 +4,9 @@ import (
|
||||
"errors"
|
||||
"strings"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
pubsub "github.com/libp2p/go-libp2p-pubsub"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/p2p"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
var errNilPubsubMessage = errors.New("nil pubsub message")
|
||||
|
||||
@@ -6,13 +6,13 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/d4l3k/messagediff"
|
||||
"github.com/gogo/protobuf/proto"
|
||||
pubsub "github.com/libp2p/go-libp2p-pubsub"
|
||||
pb "github.com/libp2p/go-libp2p-pubsub/pb"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/p2p"
|
||||
p2ptesting "github.com/prysmaticlabs/prysm/beacon-chain/p2p/testing"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func TestService_decodePubsubMessage(t *testing.T) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user