mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-11 06:18:05 -05:00
Compare commits
2 Commits
migrate-js
...
migrate-ht
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b6e43638a3 | ||
|
|
7ccb2ba291 |
@@ -4,7 +4,6 @@ go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"client.go",
|
||||
"json_rest_handler.go",
|
||||
"options.go",
|
||||
],
|
||||
importpath = "github.com/prysmaticlabs/prysm/v5/api/client",
|
||||
@@ -17,16 +16,10 @@ go_library(
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
srcs = [
|
||||
"client_test.go",
|
||||
"json_rest_handler_test.go",
|
||||
],
|
||||
srcs = ["client_test.go"],
|
||||
embed = [":go_default_library"],
|
||||
deps = [
|
||||
"//api/httputil:go_default_library",
|
||||
"//api/server/structs:go_default_library",
|
||||
"//testing/assert:go_default_library",
|
||||
"//testing/require:go_default_library",
|
||||
"@com_github_pkg_errors//:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
load("@prysm//tools/go:def.bzl", "go_library")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["json_rest_handler_mock.go"],
|
||||
importpath = "github.com/prysmaticlabs/prysm/v5/api/client/Mock",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = ["@org_uber_go_mock//gomock:go_default_library"],
|
||||
)
|
||||
@@ -32,9 +32,6 @@ var ErrInvalidNodeVersion = errors.New("invalid node version response")
|
||||
// ErrConnectionIssue represents a connection problem.
|
||||
var ErrConnectionIssue = errors.New("could not connect")
|
||||
|
||||
// ErrNotSupported represents a connection to a beacon node that is non prysm or wrong version
|
||||
var ErrNotSupported = errors.New("endpoint not supported")
|
||||
|
||||
// Non200Err is a function that parses an HTTP response to handle responses that are not 200 with a formatted error.
|
||||
func Non200Err(r *http.Response) error {
|
||||
b, err := io.ReadAll(io.LimitReader(r.Body, MaxErrBodySize))
|
||||
|
||||
3
changelog/james-prysm_migrate-httputil.md
Normal file
3
changelog/james-prysm_migrate-httputil.md
Normal file
@@ -0,0 +1,3 @@
|
||||
### Ignored
|
||||
|
||||
- migrating network/httputil to api/httputil and merging apiutils with httputil.
|
||||
@@ -14,6 +14,7 @@ go_library(
|
||||
importpath = "github.com/prysmaticlabs/prysm/v5/cmd/validator/accounts",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//api/grpcutil:go_default_library",
|
||||
"//cmd:go_default_library",
|
||||
"//cmd/validator/flags:go_default_library",
|
||||
"//config/features:go_default_library",
|
||||
@@ -31,7 +32,6 @@ go_library(
|
||||
"//validator/node:go_default_library",
|
||||
"@com_github_golang_protobuf//ptypes/empty",
|
||||
"@com_github_pkg_errors//:go_default_library",
|
||||
"@com_github_prysmaticlabs_prysm_v5//api/grpc:go_default_library",
|
||||
"@com_github_sirupsen_logrus//:go_default_library",
|
||||
"@com_github_urfave_cli_v2//:go_default_library",
|
||||
"@org_golang_google_grpc//:go_default_library",
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
"github.com/pkg/errors"
|
||||
grpcutil "github.com/prysmaticlabs/prysm/v5/api/grpc"
|
||||
grpcutil "github.com/prysmaticlabs/prysm/v5/api/grpcutil"
|
||||
"github.com/prysmaticlabs/prysm/v5/cmd"
|
||||
"github.com/prysmaticlabs/prysm/v5/cmd/validator/flags"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
|
||||
@@ -24,7 +24,7 @@ go_library(
|
||||
"//validator:__subpackages__",
|
||||
],
|
||||
deps = [
|
||||
"//api/client:go_default_library",
|
||||
"//api/grpcutil:go_default_library",
|
||||
"//beacon-chain/core/blocks:go_default_library",
|
||||
"//cmd/validator/flags:go_default_library",
|
||||
"//config/fieldparams:go_default_library",
|
||||
@@ -51,7 +51,6 @@ go_library(
|
||||
"@com_github_logrusorgru_aurora//:go_default_library",
|
||||
"@com_github_manifoldco_promptui//:go_default_library",
|
||||
"@com_github_pkg_errors//:go_default_library",
|
||||
"@com_github_prysmaticlabs_prysm_v5//api/grpc:go_default_library",
|
||||
"@com_github_sirupsen_logrus//:go_default_library",
|
||||
"@com_github_urfave_cli_v2//:go_default_library",
|
||||
"@com_github_wealdtech_go_eth2_wallet_encryptor_keystorev4//:go_default_library",
|
||||
|
||||
@@ -8,10 +8,10 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
beaconApi "github.com/prysmaticlabs/prysm/v5/api/client"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/grpcutil"
|
||||
"github.com/prysmaticlabs/prysm/v5/crypto/bls"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/accounts/wallet"
|
||||
beaconApi "github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api"
|
||||
iface "github.com/prysmaticlabs/prysm/v5/validator/client/iface"
|
||||
nodeClientFactory "github.com/prysmaticlabs/prysm/v5/validator/client/node-client-factory"
|
||||
validatorClientFactory "github.com/prysmaticlabs/prysm/v5/validator/client/validator-client-factory"
|
||||
|
||||
@@ -23,9 +23,9 @@ go_library(
|
||||
"//validator:__subpackages__",
|
||||
],
|
||||
deps = [
|
||||
"//api/client:go_default_library",
|
||||
"//api/client/beacon:go_default_library",
|
||||
"//api/client/event:go_default_library",
|
||||
"//api/grpcutil:go_default_library",
|
||||
"//api/httputil:go_default_library",
|
||||
"//api/server/structs:go_default_library",
|
||||
"//async:go_default_library",
|
||||
@@ -56,6 +56,7 @@ go_library(
|
||||
"//time/slots:go_default_library",
|
||||
"//validator/accounts/iface:go_default_library",
|
||||
"//validator/accounts/wallet:go_default_library",
|
||||
"//validator/client/beacon-api:go_default_library",
|
||||
"//validator/client/beacon-chain-client-factory:go_default_library",
|
||||
"//validator/client/iface:go_default_library",
|
||||
"//validator/client/node-client-factory:go_default_library",
|
||||
@@ -81,7 +82,6 @@ go_library(
|
||||
"@com_github_prometheus_client_golang//prometheus:go_default_library",
|
||||
"@com_github_prometheus_client_golang//prometheus/promauto:go_default_library",
|
||||
"@com_github_prysmaticlabs_go_bitfield//:go_default_library",
|
||||
"@com_github_prysmaticlabs_prysm_v5//api/grpc:go_default_library",
|
||||
"@com_github_sirupsen_logrus//:go_default_library",
|
||||
"@io_opencensus_go//plugin/ocgrpc:go_default_library",
|
||||
"@io_opentelemetry_go_contrib_instrumentation_net_http_otelhttp//:go_default_library",
|
||||
|
||||
@@ -18,6 +18,7 @@ go_library(
|
||||
"genesis.go",
|
||||
"get_beacon_block.go",
|
||||
"index.go",
|
||||
"json_rest_handler.go",
|
||||
"log.go",
|
||||
"metrics.go",
|
||||
"prepare_beacon_proposer.go",
|
||||
@@ -39,7 +40,6 @@ go_library(
|
||||
importpath = "github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api",
|
||||
visibility = ["//validator:__subpackages__"],
|
||||
deps = [
|
||||
"//api/client:go_default_library",
|
||||
"//api/client/beacon:go_default_library",
|
||||
"//api/client/event:go_default_library",
|
||||
"//api/httputil:go_default_library",
|
||||
@@ -89,6 +89,7 @@ go_test(
|
||||
"genesis_test.go",
|
||||
"get_beacon_block_test.go",
|
||||
"index_test.go",
|
||||
"json_rest_handler_test.go",
|
||||
"prepare_beacon_proposer_test.go",
|
||||
"propose_attestation_test.go",
|
||||
"propose_beacon_block_altair_test.go",
|
||||
@@ -120,7 +121,6 @@ go_test(
|
||||
],
|
||||
embed = [":go_default_library"],
|
||||
deps = [
|
||||
"//api/client/Mock:go_default_library",
|
||||
"//api/httputil:go_default_library",
|
||||
"//api/server/structs:go_default_library",
|
||||
"//beacon-chain/core/helpers:go_default_library",
|
||||
|
||||
@@ -8,11 +8,11 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/client/Mock"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/server/structs"
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/mock"
|
||||
"go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
@@ -29,7 +29,7 @@ func TestGetAttestationData_ValidAttestation(t *testing.T) {
|
||||
ctrl := gomock.NewController(t)
|
||||
defer ctrl.Finish()
|
||||
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
produceAttestationDataResponseJson := structs.GetAttestationDataResponse{}
|
||||
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
@@ -181,7 +181,7 @@ func TestGetAttestationData_InvalidData(t *testing.T) {
|
||||
defer ctrl.Finish()
|
||||
|
||||
produceAttestationDataResponseJson := structs.GetAttestationDataResponse{}
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
"/eth/v1/validator/attestation_data?committee_index=2&slot=1",
|
||||
@@ -209,7 +209,7 @@ func TestGetAttestationData_JsonResponseError(t *testing.T) {
|
||||
ctrl := gomock.NewController(t)
|
||||
defer ctrl.Finish()
|
||||
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
produceAttestationDataResponseJson := structs.GetAttestationDataResponse{}
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
|
||||
@@ -8,7 +8,6 @@ import (
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/client"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/server/structs"
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
@@ -18,7 +17,7 @@ import (
|
||||
|
||||
type beaconApiChainClient struct {
|
||||
fallbackClient iface.ChainClient
|
||||
jsonRestHandler client.JsonRestHandler
|
||||
jsonRestHandler JsonRestHandler
|
||||
stateValidatorsProvider StateValidatorsProvider
|
||||
}
|
||||
|
||||
@@ -334,7 +333,7 @@ func (c beaconApiChainClient) ValidatorParticipation(ctx context.Context, in *et
|
||||
return nil, errors.New("beaconApiChainClient.ValidatorParticipation is not implemented. To use a fallback client, pass a fallback client as the last argument of NewBeaconApiChainClientWithFallback.")
|
||||
}
|
||||
|
||||
func NewBeaconApiChainClientWithFallback(jsonRestHandler client.JsonRestHandler, fallbackClient iface.ChainClient) iface.ChainClient {
|
||||
func NewBeaconApiChainClientWithFallback(jsonRestHandler JsonRestHandler, fallbackClient iface.ChainClient) iface.ChainClient {
|
||||
return &beaconApiChainClient{
|
||||
jsonRestHandler: jsonRestHandler,
|
||||
fallbackClient: fallbackClient,
|
||||
|
||||
@@ -9,7 +9,6 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
mock2 "github.com/prysmaticlabs/prysm/v5/api/client/Mock"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/server/structs"
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
@@ -117,7 +116,7 @@ func TestListValidators(t *testing.T) {
|
||||
nil,
|
||||
)
|
||||
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(gomock.Any(), blockHeaderEndpoint, gomock.Any()).Return(errors.New("bar error"))
|
||||
|
||||
beaconChainClient := beaconApiChainClient{
|
||||
@@ -190,7 +189,7 @@ func TestListValidators(t *testing.T) {
|
||||
nil,
|
||||
)
|
||||
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(gomock.Any(), blockHeaderEndpoint, gomock.Any()).Return(
|
||||
nil,
|
||||
).SetArg(
|
||||
@@ -742,7 +741,7 @@ func TestGetChainHead(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
finalityCheckpointsResponse := structs.GetFinalityCheckpointsResponse{}
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(gomock.Any(), finalityCheckpointsEndpoint, &finalityCheckpointsResponse).Return(
|
||||
testCase.finalityCheckpointsError,
|
||||
).SetArg(
|
||||
@@ -839,7 +838,7 @@ func TestGetChainHead(t *testing.T) {
|
||||
defer ctrl.Finish()
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
finalityCheckpointsResponse := structs.GetFinalityCheckpointsResponse{}
|
||||
jsonRestHandler.EXPECT().Get(gomock.Any(), finalityCheckpointsEndpoint, &finalityCheckpointsResponse).Return(
|
||||
@@ -869,7 +868,7 @@ func TestGetChainHead(t *testing.T) {
|
||||
defer ctrl.Finish()
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
finalityCheckpointsResponse := structs.GetFinalityCheckpointsResponse{}
|
||||
jsonRestHandler.EXPECT().Get(gomock.Any(), finalityCheckpointsEndpoint, &finalityCheckpointsResponse).Return(
|
||||
|
||||
@@ -7,10 +7,10 @@ import (
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
"github.com/prysmaticlabs/prysm/v5/api/client/Mock"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/server/structs"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/mock"
|
||||
"go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
@@ -21,7 +21,7 @@ func TestGetFork_Nominal(t *testing.T) {
|
||||
defer ctrl.Finish()
|
||||
|
||||
stateForkResponseJson := structs.GetStateForkResponse{}
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
expected := structs.GetStateForkResponse{
|
||||
Data: &structs.Fork{
|
||||
@@ -57,7 +57,7 @@ func TestGetFork_Invalid(t *testing.T) {
|
||||
ctrl := gomock.NewController(t)
|
||||
defer ctrl.Finish()
|
||||
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
@@ -84,7 +84,7 @@ func TestGetHeaders_Nominal(t *testing.T) {
|
||||
defer ctrl.Finish()
|
||||
|
||||
blockHeadersResponseJson := structs.GetBlockHeadersResponse{}
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
expected := structs.GetBlockHeadersResponse{
|
||||
Data: []*structs.SignedBeaconBlockHeaderContainer{
|
||||
@@ -124,7 +124,7 @@ func TestGetHeaders_Invalid(t *testing.T) {
|
||||
ctrl := gomock.NewController(t)
|
||||
defer ctrl.Finish()
|
||||
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
@@ -171,7 +171,7 @@ func TestGetLiveness_Nominal(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Post(
|
||||
gomock.Any(),
|
||||
livenessEndpoint,
|
||||
@@ -198,7 +198,7 @@ func TestGetLiveness_Invalid(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Post(
|
||||
gomock.Any(),
|
||||
livenessEndpoint,
|
||||
@@ -238,7 +238,7 @@ func TestGetIsSyncing_Nominal(t *testing.T) {
|
||||
defer ctrl.Finish()
|
||||
|
||||
syncingResponseJson := structs.SyncStatusResponse{}
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
expected := structs.SyncStatusResponse{
|
||||
Data: &structs.SyncStatusResponseData{
|
||||
@@ -275,7 +275,7 @@ func TestGetIsSyncing_Invalid(t *testing.T) {
|
||||
defer ctrl.Finish()
|
||||
|
||||
syncingResponseJson := structs.SyncStatusResponse{}
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/client"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/client/beacon"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/server/structs"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
@@ -21,7 +20,7 @@ var (
|
||||
|
||||
type beaconApiNodeClient struct {
|
||||
fallbackClient iface.NodeClient
|
||||
jsonRestHandler client.JsonRestHandler
|
||||
jsonRestHandler JsonRestHandler
|
||||
genesisProvider GenesisProvider
|
||||
healthTracker *beacon.NodeHealthTracker
|
||||
}
|
||||
@@ -112,7 +111,7 @@ func (c *beaconApiNodeClient) HealthTracker() *beacon.NodeHealthTracker {
|
||||
return c.healthTracker
|
||||
}
|
||||
|
||||
func NewNodeClientWithFallback(jsonRestHandler client.JsonRestHandler, fallbackClient iface.NodeClient) iface.NodeClient {
|
||||
func NewNodeClientWithFallback(jsonRestHandler JsonRestHandler, fallbackClient iface.NodeClient) iface.NodeClient {
|
||||
b := &beaconApiNodeClient{
|
||||
jsonRestHandler: jsonRestHandler,
|
||||
fallbackClient: fallbackClient,
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
mock2 "github.com/prysmaticlabs/prysm/v5/api/client/Mock"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/server/structs"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/assert"
|
||||
@@ -121,7 +120,7 @@ func TestGetGenesis(t *testing.T) {
|
||||
)
|
||||
|
||||
depositContractJson := structs.GetDepositContractResponse{}
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
if testCase.queriesDepositContract {
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
@@ -202,7 +201,7 @@ func TestGetSyncStatus(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
syncingResponse := structs.SyncStatusResponse{}
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
syncingEndpoint,
|
||||
@@ -266,7 +265,7 @@ func TestGetVersion(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
var versionResponse structs.GetVersionResponse
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
versionEndpoint,
|
||||
|
||||
@@ -8,7 +8,6 @@ import (
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/client"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/client/event"
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
|
||||
"github.com/prysmaticlabs/prysm/v5/encoding/bytesutil"
|
||||
@@ -23,13 +22,13 @@ type beaconApiValidatorClient struct {
|
||||
genesisProvider GenesisProvider
|
||||
dutiesProvider dutiesProvider
|
||||
stateValidatorsProvider StateValidatorsProvider
|
||||
jsonRestHandler client.JsonRestHandler
|
||||
jsonRestHandler JsonRestHandler
|
||||
beaconBlockConverter BeaconBlockConverter
|
||||
prysmChainClient iface.PrysmChainClient
|
||||
isEventStreamRunning bool
|
||||
}
|
||||
|
||||
func NewBeaconApiValidatorClient(jsonRestHandler client.JsonRestHandler, opts ...ValidatorClientOpt) iface.ValidatorClient {
|
||||
func NewBeaconApiValidatorClient(jsonRestHandler JsonRestHandler, opts ...ValidatorClientOpt) iface.ValidatorClient {
|
||||
c := &beaconApiValidatorClient{
|
||||
genesisProvider: &beaconApiGenesisProvider{jsonRestHandler: jsonRestHandler},
|
||||
dutiesProvider: beaconApiDutiesProvider{jsonRestHandler: jsonRestHandler},
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
mock2 "github.com/prysmaticlabs/prysm/v5/api/client/Mock"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/server/structs"
|
||||
"github.com/prysmaticlabs/prysm/v5/config/params"
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
|
||||
@@ -29,7 +28,7 @@ func TestBeaconApiValidatorClient_GetAttestationDataValid(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
produceAttestationDataResponseJson := structs.GetAttestationDataResponse{}
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
@@ -63,7 +62,7 @@ func TestBeaconApiValidatorClient_GetAttestationDataError(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
produceAttestationDataResponseJson := structs.GetAttestationDataResponse{}
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
@@ -137,7 +136,7 @@ func TestBeaconApiValidatorClient_ProposeBeaconBlockValid(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Post(
|
||||
gomock.Any(),
|
||||
"/eth/v2/beacon/blocks",
|
||||
@@ -173,7 +172,7 @@ func TestBeaconApiValidatorClient_ProposeBeaconBlockError(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Post(
|
||||
gomock.Any(),
|
||||
"/eth/v2/beacon/blocks",
|
||||
@@ -208,7 +207,7 @@ func TestBeaconApiValidatorClient_Host(t *testing.T) {
|
||||
defer ctrl.Finish()
|
||||
|
||||
hosts := []string{"http://localhost:8080", "http://localhost:8081"}
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().SetHost(
|
||||
hosts[0],
|
||||
).Times(1)
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/client/Mock"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/mock"
|
||||
testhelpers "github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/test-helpers"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/iface"
|
||||
"go.uber.org/mock/gomock"
|
||||
@@ -90,7 +90,7 @@ func TestGetAggregatedSelections(t *testing.T) {
|
||||
for _, test := range testcases {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
ctrl := gomock.NewController(t)
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
reqBody, err := json.Marshal(test.req)
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -8,7 +8,6 @@ import (
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/pkg/errors"
|
||||
mock2 "github.com/prysmaticlabs/prysm/v5/api/client/Mock"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/server/structs"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/assert"
|
||||
@@ -290,7 +289,7 @@ func TestCheckDoppelGanger_Nominal(t *testing.T) {
|
||||
ctrl := gomock.NewController(t)
|
||||
defer ctrl.Finish()
|
||||
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
if testCase.getSyncingOutput != nil {
|
||||
syncingResponseJson := structs.SyncStatusResponse{}
|
||||
@@ -724,7 +723,7 @@ func TestCheckDoppelGanger_Errors(t *testing.T) {
|
||||
ctrl := gomock.NewController(t)
|
||||
defer ctrl.Finish()
|
||||
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
if testCase.getSyncingOutput != nil {
|
||||
syncingResponseJson := structs.SyncStatusResponse{}
|
||||
|
||||
@@ -27,7 +27,7 @@ type dutiesProvider interface {
|
||||
}
|
||||
|
||||
type beaconApiDutiesProvider struct {
|
||||
jsonRestHandler client.JsonRestHandler
|
||||
jsonRestHandler JsonRestHandler
|
||||
}
|
||||
|
||||
type attesterDuty struct {
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
mock2 "github.com/prysmaticlabs/prysm/v5/api/client/Mock"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/server/structs"
|
||||
"github.com/prysmaticlabs/prysm/v5/config/params"
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
|
||||
@@ -62,7 +61,7 @@ func TestGetAttesterDuties_Valid(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
validatorIndices := []primitives.ValidatorIndex{2, 9}
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Post(
|
||||
gomock.Any(),
|
||||
fmt.Sprintf("%s/%d", getAttesterDutiesTestEndpoint, epoch),
|
||||
@@ -90,7 +89,7 @@ func TestGetAttesterDuties_HttpError(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Post(
|
||||
gomock.Any(),
|
||||
fmt.Sprintf("%s/%d", getAttesterDutiesTestEndpoint, epoch),
|
||||
@@ -114,7 +113,7 @@ func TestGetAttesterDuties_NilAttesterDuty(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Post(
|
||||
gomock.Any(),
|
||||
fmt.Sprintf("%s/%d", getAttesterDutiesTestEndpoint, epoch),
|
||||
@@ -158,7 +157,7 @@ func TestGetProposerDuties_Valid(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
fmt.Sprintf("%s/%d", getProposerDutiesTestEndpoint, epoch),
|
||||
@@ -184,7 +183,7 @@ func TestGetProposerDuties_HttpError(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
fmt.Sprintf("%s/%d", getProposerDutiesTestEndpoint, epoch),
|
||||
@@ -206,7 +205,7 @@ func TestGetProposerDuties_NilData(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
fmt.Sprintf("%s/%d", getProposerDutiesTestEndpoint, epoch),
|
||||
@@ -233,7 +232,7 @@ func TestGetProposerDuties_NilProposerDuty(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
fmt.Sprintf("%s/%d", getProposerDutiesTestEndpoint, epoch),
|
||||
@@ -286,7 +285,7 @@ func TestGetSyncDuties_Valid(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
validatorIndices := []primitives.ValidatorIndex{2, 6}
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Post(
|
||||
gomock.Any(),
|
||||
fmt.Sprintf("%s/%d", getSyncDutiesTestEndpoint, epoch),
|
||||
@@ -314,7 +313,7 @@ func TestGetSyncDuties_HttpError(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Post(
|
||||
gomock.Any(),
|
||||
fmt.Sprintf("%s/%d", getSyncDutiesTestEndpoint, epoch),
|
||||
@@ -338,7 +337,7 @@ func TestGetSyncDuties_NilData(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Post(
|
||||
gomock.Any(),
|
||||
fmt.Sprintf("%s/%d", getSyncDutiesTestEndpoint, epoch),
|
||||
@@ -367,7 +366,7 @@ func TestGetSyncDuties_NilSyncDuty(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Post(
|
||||
gomock.Any(),
|
||||
fmt.Sprintf("%s/%d", getSyncDutiesTestEndpoint, epoch),
|
||||
@@ -417,7 +416,7 @@ func TestGetCommittees_Valid(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
fmt.Sprintf("%s?epoch=%d", getCommitteesTestEndpoint, epoch),
|
||||
@@ -443,7 +442,7 @@ func TestGetCommittees_HttpError(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
fmt.Sprintf("%s?epoch=%d", getCommitteesTestEndpoint, epoch),
|
||||
@@ -465,7 +464,7 @@ func TestGetCommittees_NilData(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
fmt.Sprintf("%s?epoch=%d", getCommitteesTestEndpoint, epoch),
|
||||
@@ -492,7 +491,7 @@ func TestGetCommittees_NilCommittee(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
fmt.Sprintf("%s?epoch=%d", getCommitteesTestEndpoint, epoch),
|
||||
|
||||
@@ -8,9 +8,10 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/client"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/httputil"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/server/structs"
|
||||
fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams"
|
||||
"github.com/prysmaticlabs/prysm/v5/encoding/bytesutil"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
)
|
||||
|
||||
@@ -19,7 +20,7 @@ type GenesisProvider interface {
|
||||
}
|
||||
|
||||
type beaconApiGenesisProvider struct {
|
||||
jsonRestHandler client.JsonRestHandler
|
||||
jsonRestHandler JsonRestHandler
|
||||
genesis *structs.Genesis
|
||||
once sync.Once
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/client/Mock"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/server/structs"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/mock"
|
||||
"go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
@@ -19,7 +19,7 @@ func TestGetGenesis_ValidGenesis(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
genesisResponseJson := structs.GetGenesisResponse{}
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
"/eth/v1/beacon/genesis",
|
||||
@@ -51,7 +51,7 @@ func TestGetGenesis_NilData(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
genesisResponseJson := structs.GetGenesisResponse{}
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
"/eth/v1/beacon/genesis",
|
||||
@@ -75,7 +75,7 @@ func TestGetGenesis_EndpointCalledOnlyOnce(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
genesisResponseJson := structs.GetGenesisResponse{}
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
"/eth/v1/beacon/genesis",
|
||||
@@ -109,7 +109,7 @@ func TestGetGenesis_EndpointCanBeCalledAgainAfterError(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
genesisResponseJson := structs.GetGenesisResponse{}
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
"/eth/v1/beacon/genesis",
|
||||
|
||||
@@ -9,13 +9,13 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/client/Mock"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/httputil"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/server/structs"
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/mock"
|
||||
testhelpers "github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/test-helpers"
|
||||
"go.uber.org/mock/gomock"
|
||||
)
|
||||
@@ -26,7 +26,7 @@ func TestGetBeaconBlock_RequestFailed(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
gomock.Any(),
|
||||
@@ -123,7 +123,7 @@ func TestGetBeaconBlock_Error(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
gomock.Any(),
|
||||
@@ -159,7 +159,7 @@ func TestGetBeaconBlock_Phase0Valid(t *testing.T) {
|
||||
graffiti := []byte{3}
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
fmt.Sprintf("/eth/v3/validator/blocks/%d?graffiti=%s&randao_reveal=%s", slot, hexutil.Encode(graffiti), hexutil.Encode(randaoReveal)),
|
||||
@@ -202,7 +202,7 @@ func TestGetBeaconBlock_AltairValid(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
fmt.Sprintf("/eth/v3/validator/blocks/%d?graffiti=%s&randao_reveal=%s", slot, hexutil.Encode(graffiti), hexutil.Encode(randaoReveal)),
|
||||
@@ -245,7 +245,7 @@ func TestGetBeaconBlock_BellatrixValid(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
fmt.Sprintf("/eth/v3/validator/blocks/%d?graffiti=%s&randao_reveal=%s", slot, hexutil.Encode(graffiti), hexutil.Encode(randaoReveal)),
|
||||
@@ -290,7 +290,7 @@ func TestGetBeaconBlock_BlindedBellatrixValid(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
fmt.Sprintf("/eth/v3/validator/blocks/%d?graffiti=%s&randao_reveal=%s", slot, hexutil.Encode(graffiti), hexutil.Encode(randaoReveal)),
|
||||
@@ -335,7 +335,7 @@ func TestGetBeaconBlock_CapellaValid(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
fmt.Sprintf("/eth/v3/validator/blocks/%d?graffiti=%s&randao_reveal=%s", slot, hexutil.Encode(graffiti), hexutil.Encode(randaoReveal)),
|
||||
@@ -380,7 +380,7 @@ func TestGetBeaconBlock_BlindedCapellaValid(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
fmt.Sprintf("/eth/v3/validator/blocks/%d?graffiti=%s&randao_reveal=%s", slot, hexutil.Encode(graffiti), hexutil.Encode(randaoReveal)),
|
||||
@@ -425,7 +425,7 @@ func TestGetBeaconBlock_DenebValid(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
fmt.Sprintf("/eth/v3/validator/blocks/%d?graffiti=%s&randao_reveal=%s", slot, hexutil.Encode(graffiti), hexutil.Encode(randaoReveal)),
|
||||
@@ -470,7 +470,7 @@ func TestGetBeaconBlock_BlindedDenebValid(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
fmt.Sprintf("/eth/v3/validator/blocks/%d?graffiti=%s&randao_reveal=%s", slot, hexutil.Encode(graffiti), hexutil.Encode(randaoReveal)),
|
||||
@@ -515,7 +515,7 @@ func TestGetBeaconBlock_ElectraValid(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
fmt.Sprintf("/eth/v3/validator/blocks/%d?graffiti=%s&randao_reveal=%s", slot, hexutil.Encode(graffiti), hexutil.Encode(randaoReveal)),
|
||||
@@ -560,7 +560,7 @@ func TestGetBeaconBlock_BlindedElectraValid(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
fmt.Sprintf("/eth/v3/validator/blocks/%d?graffiti=%s&randao_reveal=%s", slot, hexutil.Encode(graffiti), hexutil.Encode(randaoReveal)),
|
||||
@@ -605,7 +605,7 @@ func TestGetBeaconBlock_FallbackToBlindedBlock(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
fmt.Sprintf("/eth/v3/validator/blocks/%d?graffiti=%s&randao_reveal=%s", slot, hexutil.Encode(graffiti), hexutil.Encode(randaoReveal)),
|
||||
@@ -656,7 +656,7 @@ func TestGetBeaconBlock_FallbackToFullBlock(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
fmt.Sprintf("/eth/v3/validator/blocks/%d?graffiti=%s&randao_reveal=%s", slot, hexutil.Encode(graffiti), hexutil.Encode(randaoReveal)),
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/mock"
|
||||
"go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
@@ -41,7 +42,7 @@ func TestIndex_Nominal(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
stateValidatorsResponseJson := structs.GetValidatorsResponse{}
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
jsonRestHandler.EXPECT().Post(
|
||||
gomock.Any(),
|
||||
@@ -91,7 +92,7 @@ func TestIndex_UnexistingValidator(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
stateValidatorsResponseJson := structs.GetValidatorsResponse{}
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
jsonRestHandler.EXPECT().Post(
|
||||
gomock.Any(),
|
||||
@@ -133,7 +134,7 @@ func TestIndex_BadIndexError(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
stateValidatorsResponseJson := structs.GetValidatorsResponse{}
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
jsonRestHandler.EXPECT().Post(
|
||||
gomock.Any(),
|
||||
@@ -182,7 +183,7 @@ func TestIndex_JsonResponseError(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
stateValidatorsResponseJson := structs.GetValidatorsResponse{}
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
jsonRestHandler.EXPECT().Post(
|
||||
gomock.Any(),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package client
|
||||
package beacon_api
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
@@ -1,4 +1,4 @@
|
||||
package client
|
||||
package beacon_api
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
@@ -6,6 +6,7 @@ go_library(
|
||||
"beacon_block_converter_mock.go",
|
||||
"duties_mock.go",
|
||||
"genesis_mock.go",
|
||||
"json_rest_handler_mock.go",
|
||||
"state_validators_mock.go",
|
||||
],
|
||||
importpath = "github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/mock",
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
//
|
||||
|
||||
// Package mock is a generated GoMock package.
|
||||
package Mock
|
||||
package mock
|
||||
|
||||
import (
|
||||
bytes "bytes"
|
||||
@@ -8,11 +8,11 @@ import (
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/client/Mock"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/server/structs"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/mock"
|
||||
"go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
@@ -46,7 +46,7 @@ func TestPrepareBeaconProposer_Valid(t *testing.T) {
|
||||
marshalledJsonRecipients, err := json.Marshal(jsonRecipients)
|
||||
require.NoError(t, err)
|
||||
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Post(
|
||||
gomock.Any(),
|
||||
prepareBeaconProposerTestEndpoint,
|
||||
@@ -90,7 +90,7 @@ func TestPrepareBeaconProposer_BadRequest(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Post(
|
||||
gomock.Any(),
|
||||
prepareBeaconProposerTestEndpoint,
|
||||
|
||||
@@ -8,13 +8,13 @@ import (
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"github.com/prysmaticlabs/prysm/v5/api/client/Mock"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/httputil"
|
||||
"github.com/prysmaticlabs/prysm/v5/beacon-chain/core/helpers"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v5/runtime/version"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/mock"
|
||||
testhelpers "github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/test-helpers"
|
||||
"go.uber.org/mock/gomock"
|
||||
)
|
||||
@@ -107,7 +107,7 @@ func TestProposeAttestation(t *testing.T) {
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
ctrl := gomock.NewController(t)
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
var marshalledAttestations []byte
|
||||
if helpers.ValidateNilAttestation(test.attestation) == nil {
|
||||
@@ -168,7 +168,7 @@ func TestProposeAttestationFallBack(t *testing.T) {
|
||||
}
|
||||
|
||||
ctrl := gomock.NewController(t)
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
var marshalledAttestations []byte
|
||||
if helpers.ValidateNilAttestation(attestation) == nil {
|
||||
@@ -295,7 +295,7 @@ func TestProposeAttestationElectra(t *testing.T) {
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
ctrl := gomock.NewController(t)
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
var marshalledAttestations []byte
|
||||
if helpers.ValidateNilAttestation(test.attestation) == nil {
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/mock"
|
||||
testhelpers "github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/test-helpers"
|
||||
"go.uber.org/mock/gomock"
|
||||
)
|
||||
@@ -19,7 +20,7 @@ import (
|
||||
func TestProposeBeaconBlock_Altair(t *testing.T) {
|
||||
ctrl := gomock.NewController(t)
|
||||
defer ctrl.Finish()
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
altairBlock := generateSignedAltairBlock()
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/mock"
|
||||
testhelpers "github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/test-helpers"
|
||||
"go.uber.org/mock/gomock"
|
||||
)
|
||||
@@ -20,7 +21,7 @@ import (
|
||||
func TestProposeBeaconBlock_Bellatrix(t *testing.T) {
|
||||
ctrl := gomock.NewController(t)
|
||||
defer ctrl.Finish()
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
bellatrixBlock := generateSignedBellatrixBlock()
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import (
|
||||
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/mock"
|
||||
testhelpers "github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/test-helpers"
|
||||
"go.uber.org/mock/gomock"
|
||||
)
|
||||
@@ -21,7 +22,7 @@ import (
|
||||
func TestProposeBeaconBlock_BlindedBellatrix(t *testing.T) {
|
||||
ctrl := gomock.NewController(t)
|
||||
defer ctrl.Finish()
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
blindedBellatrixBlock := generateSignedBlindedBellatrixBlock()
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import (
|
||||
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/mock"
|
||||
testhelpers "github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/test-helpers"
|
||||
"go.uber.org/mock/gomock"
|
||||
)
|
||||
@@ -21,7 +22,7 @@ import (
|
||||
func TestProposeBeaconBlock_BlindedCapella(t *testing.T) {
|
||||
ctrl := gomock.NewController(t)
|
||||
defer ctrl.Finish()
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
blindedCapellaBlock := generateSignedBlindedCapellaBlock()
|
||||
|
||||
|
||||
@@ -6,18 +6,18 @@ import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
"github.com/prysmaticlabs/prysm/v5/api/client/Mock"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/server/structs"
|
||||
rpctesting "github.com/prysmaticlabs/prysm/v5/beacon-chain/rpc/eth/shared/testing"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/mock"
|
||||
"go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
func TestProposeBeaconBlock_BlindedDeneb(t *testing.T) {
|
||||
ctrl := gomock.NewController(t)
|
||||
defer ctrl.Finish()
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
var block structs.SignedBlindedBeaconBlockDeneb
|
||||
err := json.Unmarshal([]byte(rpctesting.BlindedDenebBlock), &block)
|
||||
|
||||
@@ -6,18 +6,18 @@ import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
"github.com/prysmaticlabs/prysm/v5/api/client/Mock"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/server/structs"
|
||||
rpctesting "github.com/prysmaticlabs/prysm/v5/beacon-chain/rpc/eth/shared/testing"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/mock"
|
||||
"go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
func TestProposeBeaconBlock_BlindedElectra(t *testing.T) {
|
||||
ctrl := gomock.NewController(t)
|
||||
defer ctrl.Finish()
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
var block structs.SignedBlindedBeaconBlockElectra
|
||||
err := json.Unmarshal([]byte(rpctesting.BlindedElectraBlock), &block)
|
||||
|
||||
@@ -6,18 +6,18 @@ import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
"github.com/prysmaticlabs/prysm/v5/api/client/Mock"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/server/structs"
|
||||
rpctesting "github.com/prysmaticlabs/prysm/v5/beacon-chain/rpc/eth/shared/testing"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/mock"
|
||||
"go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
func TestProposeBeaconBlock_BlindedFulu(t *testing.T) {
|
||||
ctrl := gomock.NewController(t)
|
||||
defer ctrl.Finish()
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
var block structs.SignedBlindedBeaconBlockFulu
|
||||
err := json.Unmarshal([]byte(rpctesting.BlindedFuluBlock), &block)
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/mock"
|
||||
testhelpers "github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/test-helpers"
|
||||
"go.uber.org/mock/gomock"
|
||||
)
|
||||
@@ -20,7 +21,7 @@ import (
|
||||
func TestProposeBeaconBlock_Capella(t *testing.T) {
|
||||
ctrl := gomock.NewController(t)
|
||||
defer ctrl.Finish()
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
capellaBlock := generateSignedCapellaBlock()
|
||||
|
||||
|
||||
@@ -6,18 +6,18 @@ import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
"github.com/prysmaticlabs/prysm/v5/api/client/Mock"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/server/structs"
|
||||
rpctesting "github.com/prysmaticlabs/prysm/v5/beacon-chain/rpc/eth/shared/testing"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/mock"
|
||||
"go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
func TestProposeBeaconBlock_Deneb(t *testing.T) {
|
||||
ctrl := gomock.NewController(t)
|
||||
defer ctrl.Finish()
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
var blockContents structs.SignedBeaconBlockContentsDeneb
|
||||
err := json.Unmarshal([]byte(rpctesting.DenebBlockContents), &blockContents)
|
||||
|
||||
@@ -6,18 +6,18 @@ import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
"github.com/prysmaticlabs/prysm/v5/api/client/Mock"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/server/structs"
|
||||
rpctesting "github.com/prysmaticlabs/prysm/v5/beacon-chain/rpc/eth/shared/testing"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/mock"
|
||||
"go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
func TestProposeBeaconBlock_Electra(t *testing.T) {
|
||||
ctrl := gomock.NewController(t)
|
||||
defer ctrl.Finish()
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
var blockContents structs.SignedBeaconBlockContentsElectra
|
||||
err := json.Unmarshal([]byte(rpctesting.ElectraBlockContents), &blockContents)
|
||||
|
||||
@@ -6,18 +6,18 @@ import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
"github.com/prysmaticlabs/prysm/v5/api/client/Mock"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/server/structs"
|
||||
rpctesting "github.com/prysmaticlabs/prysm/v5/beacon-chain/rpc/eth/shared/testing"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/mock"
|
||||
"go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
func TestProposeBeaconBlock_Fulu(t *testing.T) {
|
||||
ctrl := gomock.NewController(t)
|
||||
defer ctrl.Finish()
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
var blockContents structs.SignedBeaconBlockContentsFulu
|
||||
err := json.Unmarshal([]byte(rpctesting.FuluBlockContents), &blockContents)
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/mock"
|
||||
testhelpers "github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/test-helpers"
|
||||
"go.uber.org/mock/gomock"
|
||||
)
|
||||
@@ -19,7 +20,7 @@ import (
|
||||
func TestProposeBeaconBlock_Phase0(t *testing.T) {
|
||||
ctrl := gomock.NewController(t)
|
||||
defer ctrl.Finish()
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
phase0Block := generateSignedPhase0Block()
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ import (
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"github.com/prysmaticlabs/prysm/v5/api/client/Mock"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/httputil"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/mock"
|
||||
"go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
@@ -105,7 +105,7 @@ func TestProposeBeaconBlock_Error(t *testing.T) {
|
||||
defer ctrl.Finish()
|
||||
|
||||
ctx := context.Background()
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
headers := map[string]string{"Eth-Consensus-Version": testCase.consensusVersion}
|
||||
jsonRestHandler.EXPECT().Post(
|
||||
|
||||
@@ -8,11 +8,11 @@ import (
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/client/Mock"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/server/structs"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/mock"
|
||||
"go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
@@ -37,7 +37,7 @@ func TestProposeExit_Valid(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Post(
|
||||
gomock.Any(),
|
||||
proposeExitTestEndpoint,
|
||||
@@ -86,7 +86,7 @@ func TestProposeExit_BadRequest(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Post(
|
||||
gomock.Any(),
|
||||
proposeExitTestEndpoint,
|
||||
|
||||
@@ -18,7 +18,7 @@ import (
|
||||
)
|
||||
|
||||
// NewPrysmChainClient returns implementation of iface.PrysmChainClient.
|
||||
func NewPrysmChainClient(jsonRestHandler client.JsonRestHandler, nodeClient iface.NodeClient) iface.PrysmChainClient {
|
||||
func NewPrysmChainClient(jsonRestHandler JsonRestHandler, nodeClient iface.NodeClient) iface.PrysmChainClient {
|
||||
return prysmChainClient{
|
||||
jsonRestHandler: jsonRestHandler,
|
||||
nodeClient: nodeClient,
|
||||
@@ -26,7 +26,7 @@ func NewPrysmChainClient(jsonRestHandler client.JsonRestHandler, nodeClient ifac
|
||||
}
|
||||
|
||||
type prysmChainClient struct {
|
||||
jsonRestHandler client.JsonRestHandler
|
||||
jsonRestHandler JsonRestHandler
|
||||
nodeClient iface.NodeClient
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ func (c prysmChainClient) ValidatorCount(ctx context.Context, stateID string, st
|
||||
}
|
||||
|
||||
if !strings.Contains(strings.ToLower(nodeVersion.Version), "prysm") {
|
||||
return nil, httputil.ErrNotSupported
|
||||
return nil, iface.ErrNotSupported
|
||||
}
|
||||
|
||||
queryParams := neturl.Values{}
|
||||
@@ -85,7 +85,7 @@ func (c prysmChainClient) ValidatorPerformance(ctx context.Context, in *ethpb.Va
|
||||
}
|
||||
|
||||
if !strings.Contains(strings.ToLower(nodeVersion.Version), "prysm") {
|
||||
return nil, httputil.ErrNotSupported
|
||||
return nil, iface.ErrNotSupported
|
||||
}
|
||||
|
||||
request, err := json.Marshal(structs.GetValidatorPerformanceRequest{
|
||||
|
||||
@@ -7,12 +7,12 @@ import (
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
"github.com/prysmaticlabs/prysm/v5/api/client/Mock"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/server/structs"
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/validator"
|
||||
"github.com/prysmaticlabs/prysm/v5/encoding/bytesutil"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/mock"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/iface"
|
||||
"go.uber.org/mock/gomock"
|
||||
)
|
||||
@@ -117,7 +117,7 @@ func TestGetValidatorCount(t *testing.T) {
|
||||
defer ctrl.Finish()
|
||||
|
||||
ctx := context.Background()
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
// Expect node version endpoint call.
|
||||
var nodeVersionResponse structs.GetVersionResponse
|
||||
@@ -178,7 +178,7 @@ func Test_beaconApiBeaconChainClient_GetValidatorPerformance(t *testing.T) {
|
||||
PublicKeys: [][]byte{publicKeys[0][:], publicKeys[2][:], publicKeys[1][:]},
|
||||
})
|
||||
require.NoError(t, err)
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
// Expect node version endpoint call.
|
||||
var nodeVersionResponse structs.GetVersionResponse
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
|
||||
@@ -9,11 +9,11 @@ import (
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/client/Mock"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/server/structs"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/mock"
|
||||
"go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
@@ -66,7 +66,7 @@ func TestRegistration_Valid(t *testing.T) {
|
||||
marshalledJsonRegistrations, err := json.Marshal(jsonRegistrations)
|
||||
require.NoError(t, err)
|
||||
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Post(
|
||||
gomock.Any(),
|
||||
"/eth/v1/validator/register_validator",
|
||||
@@ -141,7 +141,7 @@ func TestRegistration_BadRequest(t *testing.T) {
|
||||
ctrl := gomock.NewController(t)
|
||||
defer ctrl.Finish()
|
||||
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Post(
|
||||
gomock.Any(),
|
||||
"/eth/v1/validator/register_validator",
|
||||
|
||||
@@ -21,7 +21,7 @@ type StateValidatorsProvider interface {
|
||||
}
|
||||
|
||||
type beaconApiStateValidatorsProvider struct {
|
||||
jsonRestHandler client.JsonRestHandler
|
||||
jsonRestHandler JsonRestHandler
|
||||
}
|
||||
|
||||
func (c beaconApiStateValidatorsProvider) StateValidators(
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/mock"
|
||||
"go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
@@ -34,7 +35,7 @@ func TestGetStateValidators_Nominal_POST(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
stateValidatorsResponseJson := structs.GetValidatorsResponse{}
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
wanted := []*structs.ValidatorContainer{
|
||||
{
|
||||
@@ -120,7 +121,7 @@ func TestGetStateValidators_Nominal_GET(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
stateValidatorsResponseJson := structs.GetValidatorsResponse{}
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
wanted := []*structs.ValidatorContainer{
|
||||
{
|
||||
@@ -220,7 +221,7 @@ func TestGetStateValidators_GetRestJsonResponseOnError(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
stateValidatorsResponseJson := structs.GetValidatorsResponse{}
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
@@ -277,7 +278,7 @@ func TestGetStateValidators_DataIsNil_POST(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
stateValidatorsResponseJson := structs.GetValidatorsResponse{}
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
jsonRestHandler.EXPECT().Post(
|
||||
gomock.Any(),
|
||||
@@ -316,7 +317,7 @@ func TestGetStateValidators_DataIsNil_GET(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
stateValidatorsResponseJson := structs.GetValidatorsResponse{}
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
// First call POST which will return an error.
|
||||
jsonRestHandler.EXPECT().Post(
|
||||
|
||||
@@ -6,10 +6,10 @@ import (
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/httputil"
|
||||
"github.com/prysmaticlabs/prysm/v5/config/params"
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/iface"
|
||||
)
|
||||
|
||||
func (c *beaconApiValidatorClient) validatorStatus(ctx context.Context, in *ethpb.ValidatorStatusRequest) (*ethpb.ValidatorStatusResponse, error) {
|
||||
@@ -84,7 +84,7 @@ func (c *beaconApiValidatorClient) validatorsStatusResponse(ctx context.Context,
|
||||
|
||||
// TODO: we should remove this API call
|
||||
validatorsCountResponse, err := c.prysmChainClient.ValidatorCount(ctx, "head", nil)
|
||||
if err != nil && !errors.Is(err, httputil.ErrNotSupported) {
|
||||
if err != nil && !errors.Is(err, iface.ErrNotSupported) {
|
||||
return nil, nil, nil, errors.Wrap(err, "failed to get total validator count")
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,6 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
mock2 "github.com/prysmaticlabs/prysm/v5/api/client/Mock"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/httputil"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/server/structs"
|
||||
"github.com/prysmaticlabs/prysm/v5/config/params"
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
|
||||
@@ -16,6 +14,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/mock"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/iface"
|
||||
"go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
@@ -52,7 +51,7 @@ func TestValidatorStatus_Nominal(t *testing.T) {
|
||||
nil,
|
||||
).Times(1)
|
||||
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
validatorClient := beaconApiValidatorClient{
|
||||
stateValidatorsProvider: stateValidatorsProvider,
|
||||
prysmChainClient: prysmChainClient{
|
||||
@@ -69,7 +68,7 @@ func TestValidatorStatus_Nominal(t *testing.T) {
|
||||
"/eth/v1/node/version",
|
||||
&nodeVersionResponse,
|
||||
).Return(
|
||||
httputil.ErrNotSupported,
|
||||
iface.ErrNotSupported,
|
||||
).Times(1)
|
||||
|
||||
actualValidatorStatusResponse, err := validatorClient.ValidatorStatus(
|
||||
@@ -167,7 +166,7 @@ func TestMultipleValidatorStatus_Nominal(t *testing.T) {
|
||||
nil,
|
||||
).Times(1)
|
||||
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
// Expect node version endpoint call.
|
||||
var nodeVersionResponse structs.GetVersionResponse
|
||||
@@ -176,7 +175,7 @@ func TestMultipleValidatorStatus_Nominal(t *testing.T) {
|
||||
"/eth/v1/node/version",
|
||||
&nodeVersionResponse,
|
||||
).Return(
|
||||
httputil.ErrNotSupported,
|
||||
iface.ErrNotSupported,
|
||||
).Times(1)
|
||||
|
||||
validatorClient := beaconApiValidatorClient{
|
||||
@@ -319,7 +318,7 @@ func TestGetValidatorsStatusResponse_Nominal_SomeActiveValidators(t *testing.T)
|
||||
nil,
|
||||
).Times(1)
|
||||
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
// Expect node version endpoint call.
|
||||
var nodeVersionResponse structs.GetVersionResponse
|
||||
@@ -467,7 +466,7 @@ func TestGetValidatorsStatusResponse_Nominal_NoActiveValidators(t *testing.T) {
|
||||
nil,
|
||||
).Times(1)
|
||||
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
// Expect node version endpoint call.
|
||||
var nodeVersionResponse structs.GetVersionResponse
|
||||
@@ -476,7 +475,7 @@ func TestGetValidatorsStatusResponse_Nominal_NoActiveValidators(t *testing.T) {
|
||||
"/eth/v1/node/version",
|
||||
&nodeVersionResponse,
|
||||
).Return(
|
||||
httputil.ErrNotSupported,
|
||||
iface.ErrNotSupported,
|
||||
).Times(1)
|
||||
|
||||
wantedValidatorsPubKey := [][]byte{validatorPubKey}
|
||||
@@ -706,7 +705,7 @@ func TestValidatorStatusResponse_InvalidData(t *testing.T) {
|
||||
testCase.inputGetStateValidatorsInterface.outputErr,
|
||||
).Times(1)
|
||||
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
// Expect node version endpoint call.
|
||||
var nodeVersionResponse structs.GetVersionResponse
|
||||
@@ -715,7 +714,7 @@ func TestValidatorStatusResponse_InvalidData(t *testing.T) {
|
||||
"/eth/v1/node/version",
|
||||
&nodeVersionResponse,
|
||||
).Return(
|
||||
httputil.ErrNotSupported,
|
||||
iface.ErrNotSupported,
|
||||
).Times(testCase.validatorCountCalled)
|
||||
|
||||
validatorClient := beaconApiValidatorClient{
|
||||
|
||||
@@ -9,7 +9,6 @@ import (
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/pkg/errors"
|
||||
mock2 "github.com/prysmaticlabs/prysm/v5/api/client/Mock"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/server/structs"
|
||||
rpctesting "github.com/prysmaticlabs/prysm/v5/beacon-chain/rpc/eth/shared/testing"
|
||||
eth "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
@@ -26,7 +25,7 @@ func TestStreamBlocks_UnsupportedConsensusVersion(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
gomock.Any(),
|
||||
@@ -148,7 +147,7 @@ func TestStreamBlocks_Error(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
gomock.Any(),
|
||||
@@ -199,7 +198,7 @@ func TestStreamBlocks_Phase0Valid(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
signedBlockResponseJson := abstractSignedBlockResponseJson{}
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
beaconBlockConverter := mock.NewMockBeaconBlockConverter(ctrl)
|
||||
|
||||
// For the first call, return a block that satisfies the verifiedOnly condition. This block should be returned by the first Recv().
|
||||
@@ -360,7 +359,7 @@ func TestStreamBlocks_AltairValid(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
signedBlockResponseJson := abstractSignedBlockResponseJson{}
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
beaconBlockConverter := mock.NewMockBeaconBlockConverter(ctrl)
|
||||
|
||||
// For the first call, return a block that satisfies the verifiedOnly condition. This block should be returned by the first Recv().
|
||||
@@ -521,7 +520,7 @@ func TestStreamBlocks_BellatrixValid(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
signedBlockResponseJson := abstractSignedBlockResponseJson{}
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
beaconBlockConverter := mock.NewMockBeaconBlockConverter(ctrl)
|
||||
|
||||
// For the first call, return a block that satisfies the verifiedOnly condition. This block should be returned by the first Recv().
|
||||
@@ -682,7 +681,7 @@ func TestStreamBlocks_CapellaValid(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
signedBlockResponseJson := abstractSignedBlockResponseJson{}
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
beaconBlockConverter := mock.NewMockBeaconBlockConverter(ctrl)
|
||||
|
||||
// For the first call, return a block that satisfies the verifiedOnly condition. This block should be returned by the first Recv().
|
||||
@@ -843,7 +842,7 @@ func TestStreamBlocks_DenebValid(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
signedBlockResponseJson := abstractSignedBlockResponseJson{}
|
||||
jsonRestHandler := mock2.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
beaconBlockConverter := mock.NewMockBeaconBlockConverter(ctrl)
|
||||
|
||||
// For the first call, return a block that satisfies the verifiedOnly condition. This block should be returned by the first Recv().
|
||||
|
||||
@@ -9,13 +9,13 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/client/Mock"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/httputil"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/server/structs"
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/mock"
|
||||
testhelpers "github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/test-helpers"
|
||||
"go.uber.org/mock/gomock"
|
||||
)
|
||||
@@ -97,7 +97,7 @@ func TestSubmitAggregateSelectionProof(t *testing.T) {
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
// Call node syncing endpoint to check if head is optimistic.
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
@@ -217,7 +217,7 @@ func TestSubmitAggregateSelectionProofFallBack(t *testing.T) {
|
||||
ctrl := gomock.NewController(t)
|
||||
defer ctrl.Finish()
|
||||
ctx := context.Background()
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
// Call node syncing endpoint to check if head is optimistic.
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
@@ -389,7 +389,7 @@ func TestSubmitAggregateSelectionProofElectra(t *testing.T) {
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
// Call node syncing endpoint to check if head is optimistic.
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
|
||||
@@ -8,13 +8,13 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/client/Mock"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/httputil"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/server/structs"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v5/runtime/version"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/mock"
|
||||
testhelpers "github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/test-helpers"
|
||||
"go.uber.org/mock/gomock"
|
||||
)
|
||||
@@ -29,7 +29,7 @@ func TestSubmitSignedAggregateSelectionProof_Valid(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
headers := map[string]string{"Eth-Consensus-Version": version.String(signedAggregateAndProof.Message.Version())}
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Post(
|
||||
gomock.Any(),
|
||||
"/eth/v2/validator/aggregate_and_proofs",
|
||||
@@ -61,7 +61,7 @@ func TestSubmitSignedAggregateSelectionProof_BadRequest(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
headers := map[string]string{"Eth-Consensus-Version": version.String(signedAggregateAndProof.Message.Version())}
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Post(
|
||||
gomock.Any(),
|
||||
"/eth/v2/validator/aggregate_and_proofs",
|
||||
@@ -89,7 +89,7 @@ func TestSubmitSignedAggregateSelectionProof_Fallback(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
headers := map[string]string{"Eth-Consensus-Version": version.String(signedAggregateAndProof.Message.Version())}
|
||||
jsonRestHandler.EXPECT().Post(
|
||||
gomock.Any(),
|
||||
@@ -133,7 +133,7 @@ func TestSubmitSignedAggregateSelectionProofElectra_Valid(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
headers := map[string]string{"Eth-Consensus-Version": version.String(signedAggregateAndProofElectra.Message.Version())}
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Post(
|
||||
gomock.Any(),
|
||||
"/eth/v2/validator/aggregate_and_proofs",
|
||||
@@ -165,7 +165,7 @@ func TestSubmitSignedAggregateSelectionProofElectra_BadRequest(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
headers := map[string]string{"Eth-Consensus-Version": version.String(signedAggregateAndProofElectra.Message.Version())}
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Post(
|
||||
gomock.Any(),
|
||||
"/eth/v2/validator/aggregate_and_proofs",
|
||||
|
||||
@@ -8,11 +8,11 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/client/Mock"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/server/structs"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/mock"
|
||||
"go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
@@ -44,7 +44,7 @@ func TestSubmitSignedContributionAndProof_Valid(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Post(
|
||||
gomock.Any(),
|
||||
submitSignedContributionAndProofTestEndpoint,
|
||||
@@ -118,7 +118,7 @@ func TestSubmitSignedContributionAndProof_Error(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
if testCase.httpRequestExpected {
|
||||
jsonRestHandler.EXPECT().Post(
|
||||
gomock.Any(),
|
||||
|
||||
@@ -8,12 +8,12 @@ import (
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"github.com/prysmaticlabs/prysm/v5/api/client/Mock"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/server/structs"
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/mock"
|
||||
"go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
@@ -45,7 +45,7 @@ func TestSubscribeCommitteeSubnets_Valid(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Post(
|
||||
gomock.Any(),
|
||||
subscribeCommitteeSubnetsTestEndpoint,
|
||||
@@ -206,7 +206,7 @@ func TestSubscribeCommitteeSubnets_Error(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
if testCase.expectSubscribeRestCall {
|
||||
jsonRestHandler.EXPECT().Post(
|
||||
gomock.Any(),
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/client/Mock"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/mock"
|
||||
testhelpers "github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/test-helpers"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/iface"
|
||||
"go.uber.org/mock/gomock"
|
||||
@@ -97,7 +97,7 @@ func TestGetAggregatedSyncSelections(t *testing.T) {
|
||||
for _, test := range testcases {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
ctrl := gomock.NewController(t)
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
reqBody, err := json.Marshal(test.req)
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -18,6 +18,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
||||
"github.com/prysmaticlabs/prysm/v5/time/slots"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/mock"
|
||||
"go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
@@ -44,7 +45,7 @@ func TestSubmitSyncMessage_Valid(t *testing.T) {
|
||||
marshalledJsonRegistrations, err := json.Marshal([]*structs.SyncCommitteeMessage{jsonSyncCommitteeMessage})
|
||||
require.NoError(t, err)
|
||||
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Post(
|
||||
gomock.Any(),
|
||||
"/eth/v1/beacon/pool/sync_committees",
|
||||
@@ -73,7 +74,7 @@ func TestSubmitSyncMessage_BadRequest(t *testing.T) {
|
||||
ctrl := gomock.NewController(t)
|
||||
defer ctrl.Finish()
|
||||
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Post(
|
||||
gomock.Any(),
|
||||
"/eth/v1/beacon/pool/sync_committees",
|
||||
@@ -137,7 +138,7 @@ func TestGetSyncMessageBlockRoot(t *testing.T) {
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
"/eth/v1/beacon/blocks/head/root",
|
||||
@@ -207,7 +208,7 @@ func TestGetSyncCommitteeContribution(t *testing.T) {
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
"/eth/v1/beacon/blocks/head/root",
|
||||
@@ -314,7 +315,7 @@ func TestGetSyncSubCommitteeIndex(t *testing.T) {
|
||||
}
|
||||
valsReqBytes, err := json.Marshal(valsReq)
|
||||
require.NoError(t, err)
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Post(
|
||||
gomock.Any(),
|
||||
validatorsEndpoint,
|
||||
|
||||
@@ -7,11 +7,11 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/client/Mock"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/httputil"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/server/structs"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api/mock"
|
||||
"go.uber.org/mock/gomock"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
@@ -22,7 +22,7 @@ func TestWaitForChainStart_ValidGenesis(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
genesisResponseJson := structs.GetGenesisResponse{}
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
"/eth/v1/beacon/genesis",
|
||||
@@ -89,7 +89,7 @@ func TestWaitForChainStart_BadGenesis(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
genesisResponseJson := structs.GetGenesisResponse{}
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
"/eth/v1/beacon/genesis",
|
||||
@@ -117,7 +117,7 @@ func TestWaitForChainStart_JsonResponseError(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
genesisResponseJson := structs.GetGenesisResponse{}
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
"/eth/v1/beacon/genesis",
|
||||
@@ -140,7 +140,7 @@ func TestWaitForChainStart_JsonResponseError404(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
genesisResponseJson := structs.GetGenesisResponse{}
|
||||
jsonRestHandler := Mock.NewMockJsonRestHandler(ctrl)
|
||||
jsonRestHandler := mock.NewMockJsonRestHandler(ctrl)
|
||||
|
||||
// First, mock a request that receives a 404 error (which means that the genesis data is not available yet)
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
|
||||
@@ -6,7 +6,6 @@ go_library(
|
||||
importpath = "github.com/prysmaticlabs/prysm/v5/validator/client/beacon-chain-client-factory",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//api/client:go_default_library",
|
||||
"//config/features:go_default_library",
|
||||
"//validator/client/beacon-api:go_default_library",
|
||||
"//validator/client/grpc-api:go_default_library",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package beacon_chain_client_factory
|
||||
|
||||
import (
|
||||
"github.com/prysmaticlabs/prysm/v5/api/client"
|
||||
"github.com/prysmaticlabs/prysm/v5/config/features"
|
||||
beaconApi "github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api"
|
||||
grpcApi "github.com/prysmaticlabs/prysm/v5/validator/client/grpc-api"
|
||||
@@ -10,7 +9,7 @@ import (
|
||||
validatorHelpers "github.com/prysmaticlabs/prysm/v5/validator/helpers"
|
||||
)
|
||||
|
||||
func NewChainClient(validatorConn validatorHelpers.NodeConnection, jsonRestHandler client.JsonRestHandler) iface.ChainClient {
|
||||
func NewChainClient(validatorConn validatorHelpers.NodeConnection, jsonRestHandler beaconApi.JsonRestHandler) iface.ChainClient {
|
||||
grpcClient := grpcApi.NewGrpcChainClient(validatorConn.GetGrpcClientConn())
|
||||
if features.Get().EnableBeaconRESTApi {
|
||||
return beaconApi.NewBeaconApiChainClientWithFallback(jsonRestHandler, grpcClient)
|
||||
@@ -19,7 +18,7 @@ func NewChainClient(validatorConn validatorHelpers.NodeConnection, jsonRestHandl
|
||||
}
|
||||
}
|
||||
|
||||
func NewPrysmChainClient(validatorConn validatorHelpers.NodeConnection, jsonRestHandler client.JsonRestHandler) iface.PrysmChainClient {
|
||||
func NewPrysmChainClient(validatorConn validatorHelpers.NodeConnection, jsonRestHandler beaconApi.JsonRestHandler) iface.PrysmChainClient {
|
||||
if features.Get().EnableBeaconRESTApi {
|
||||
return beaconApi.NewPrysmChainClient(jsonRestHandler, nodeClientFactory.NewNodeClient(validatorConn, jsonRestHandler))
|
||||
} else {
|
||||
|
||||
@@ -203,11 +203,11 @@ func (c *grpcValidatorClient) AggregatedSigAndAggregationBits(
|
||||
}
|
||||
|
||||
func (*grpcValidatorClient) AggregatedSelections(context.Context, []iface.BeaconCommitteeSelection) ([]iface.BeaconCommitteeSelection, error) {
|
||||
return nil, httputil.ErrNotSupported
|
||||
return nil, iface.ErrNotSupported
|
||||
}
|
||||
|
||||
func (*grpcValidatorClient) AggregatedSyncSelections(context.Context, []iface.SyncCommitteeSelection) ([]iface.SyncCommitteeSelection, error) {
|
||||
return nil, httputil.ErrNotSupported
|
||||
return nil, iface.ErrNotSupported
|
||||
}
|
||||
|
||||
func NewGrpcValidatorClient(cc grpc.ClientConnInterface) iface.ValidatorClient {
|
||||
@@ -307,10 +307,10 @@ func (c *grpcValidatorClient) EventStreamIsRunning() bool {
|
||||
}
|
||||
|
||||
func (*grpcValidatorClient) Host() string {
|
||||
log.Warn(httputil.ErrNotSupported)
|
||||
log.Warn(iface.ErrNotSupported)
|
||||
return ""
|
||||
}
|
||||
|
||||
func (*grpcValidatorClient) SetHost(_ string) {
|
||||
log.Warn(httputil.ErrNotSupported)
|
||||
log.Warn(iface.ErrNotSupported)
|
||||
}
|
||||
|
||||
@@ -3,10 +3,13 @@ package iface
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/validator"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
)
|
||||
|
||||
var ErrNotSupported = errors.New("endpoint not supported")
|
||||
|
||||
type ValidatorCount struct {
|
||||
Status string
|
||||
Count uint64
|
||||
|
||||
@@ -7,13 +7,13 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promauto"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/httputil"
|
||||
fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams"
|
||||
"github.com/prysmaticlabs/prysm/v5/config/params"
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
|
||||
"github.com/prysmaticlabs/prysm/v5/encoding/bytesutil"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v5/time/slots"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/iface"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
@@ -233,7 +233,7 @@ func (v *validator) LogValidatorGainsAndLosses(ctx context.Context, slot primiti
|
||||
}
|
||||
resp, err := v.prysmChainClient.ValidatorPerformance(ctx, req)
|
||||
if err != nil {
|
||||
if errors.Is(err, httputil.ErrNotSupported) {
|
||||
if errors.Is(err, iface.ErrNotSupported) {
|
||||
log.WithError(err).Debug("Skipping validator performance metric for non-Prysm beacon node")
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ go_library(
|
||||
importpath = "github.com/prysmaticlabs/prysm/v5/validator/client/node-client-factory",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//api/client:go_default_library",
|
||||
"//config/features:go_default_library",
|
||||
"//validator/client/beacon-api:go_default_library",
|
||||
"//validator/client/grpc-api:go_default_library",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package node_client_factory
|
||||
|
||||
import (
|
||||
"github.com/prysmaticlabs/prysm/v5/api/client"
|
||||
"github.com/prysmaticlabs/prysm/v5/config/features"
|
||||
beaconApi "github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api"
|
||||
grpcApi "github.com/prysmaticlabs/prysm/v5/validator/client/grpc-api"
|
||||
@@ -9,7 +8,7 @@ import (
|
||||
validatorHelpers "github.com/prysmaticlabs/prysm/v5/validator/helpers"
|
||||
)
|
||||
|
||||
func NewNodeClient(validatorConn validatorHelpers.NodeConnection, jsonRestHandler client.JsonRestHandler) iface.NodeClient {
|
||||
func NewNodeClient(validatorConn validatorHelpers.NodeConnection, jsonRestHandler beaconApi.JsonRestHandler) iface.NodeClient {
|
||||
grpcClient := grpcApi.NewNodeClient(validatorConn.GetGrpcClientConn())
|
||||
if features.Get().EnableBeaconRESTApi {
|
||||
return beaconApi.NewNodeClientWithFallback(jsonRestHandler, grpcClient)
|
||||
|
||||
@@ -12,8 +12,7 @@ import (
|
||||
grpcopentracing "github.com/grpc-ecosystem/go-grpc-middleware/tracing/opentracing"
|
||||
grpcprometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
|
||||
"github.com/pkg/errors"
|
||||
beaconApi "github.com/prysmaticlabs/prysm/v5/api/client"
|
||||
grpcutil "github.com/prysmaticlabs/prysm/v5/api/grpc"
|
||||
grpcutil "github.com/prysmaticlabs/prysm/v5/api/grpcutil"
|
||||
"github.com/prysmaticlabs/prysm/v5/async/event"
|
||||
lruwrpr "github.com/prysmaticlabs/prysm/v5/cache/lru"
|
||||
fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams"
|
||||
@@ -22,6 +21,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/accounts/wallet"
|
||||
beaconApi "github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api"
|
||||
beaconChainClientFactory "github.com/prysmaticlabs/prysm/v5/validator/client/beacon-chain-client-factory"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client/iface"
|
||||
nodeclientfactory "github.com/prysmaticlabs/prysm/v5/validator/client/node-client-factory"
|
||||
|
||||
@@ -6,7 +6,6 @@ go_library(
|
||||
importpath = "github.com/prysmaticlabs/prysm/v5/validator/client/validator-client-factory",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//api/client:go_default_library",
|
||||
"//config/features:go_default_library",
|
||||
"//validator/client/beacon-api:go_default_library",
|
||||
"//validator/client/grpc-api:go_default_library",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package validator_client_factory
|
||||
|
||||
import (
|
||||
"github.com/prysmaticlabs/prysm/v5/api/client"
|
||||
"github.com/prysmaticlabs/prysm/v5/config/features"
|
||||
beaconApi "github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api"
|
||||
grpcApi "github.com/prysmaticlabs/prysm/v5/validator/client/grpc-api"
|
||||
@@ -11,7 +10,7 @@ import (
|
||||
|
||||
func NewValidatorClient(
|
||||
validatorConn validatorHelpers.NodeConnection,
|
||||
jsonRestHandler client.JsonRestHandler,
|
||||
jsonRestHandler beaconApi.JsonRestHandler,
|
||||
opt ...beaconApi.ValidatorClientOpt,
|
||||
) iface.ValidatorClient {
|
||||
if features.Get().EnableBeaconRESTApi {
|
||||
|
||||
@@ -23,7 +23,7 @@ go_library(
|
||||
],
|
||||
deps = [
|
||||
"//api:go_default_library",
|
||||
"//api/client:go_default_library",
|
||||
"//api/grpcutil:go_default_library",
|
||||
"//api/httputil:go_default_library",
|
||||
"//api/pagination:go_default_library",
|
||||
"//api/server:go_default_library",
|
||||
@@ -52,6 +52,7 @@ go_library(
|
||||
"//validator/accounts/petnames:go_default_library",
|
||||
"//validator/accounts/wallet:go_default_library",
|
||||
"//validator/client:go_default_library",
|
||||
"//validator/client/beacon-api:go_default_library",
|
||||
"//validator/client/beacon-chain-client-factory:go_default_library",
|
||||
"//validator/client/iface:go_default_library",
|
||||
"//validator/client/node-client-factory:go_default_library",
|
||||
@@ -73,7 +74,6 @@ go_library(
|
||||
"@com_github_grpc_ecosystem_go_grpc_middleware//tracing/opentracing:go_default_library",
|
||||
"@com_github_grpc_ecosystem_go_grpc_prometheus//:go_default_library",
|
||||
"@com_github_pkg_errors//:go_default_library",
|
||||
"@com_github_prysmaticlabs_prysm_v5//api/grpc:go_default_library",
|
||||
"@com_github_sirupsen_logrus//:go_default_library",
|
||||
"@com_github_tyler_smith_go_bip39//:go_default_library",
|
||||
"@com_github_tyler_smith_go_bip39//wordlists:go_default_library",
|
||||
|
||||
@@ -8,10 +8,10 @@ import (
|
||||
grpcopentracing "github.com/grpc-ecosystem/go-grpc-middleware/tracing/opentracing"
|
||||
grpcprometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
|
||||
"github.com/pkg/errors"
|
||||
beaconApi "github.com/prysmaticlabs/prysm/v5/api/client"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/grpcutil"
|
||||
grpcutil "github.com/prysmaticlabs/prysm/v5/api/grpcutil"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/client"
|
||||
beaconApi "github.com/prysmaticlabs/prysm/v5/validator/client/beacon-api"
|
||||
beaconChainClientFactory "github.com/prysmaticlabs/prysm/v5/validator/client/beacon-chain-client-factory"
|
||||
nodeClientFactory "github.com/prysmaticlabs/prysm/v5/validator/client/node-client-factory"
|
||||
validatorClientFactory "github.com/prysmaticlabs/prysm/v5/validator/client/validator-client-factory"
|
||||
|
||||
Reference in New Issue
Block a user