diff --git a/api/client/beacon/BUILD.bazel b/api/client/beacon/BUILD.bazel index 54fa3423ca..1263ce6189 100644 --- a/api/client/beacon/BUILD.bazel +++ b/api/client/beacon/BUILD.bazel @@ -14,6 +14,7 @@ go_library( "//beacon-chain/core/helpers:go_default_library", "//beacon-chain/rpc/apimiddleware:go_default_library", "//beacon-chain/rpc/eth/beacon:go_default_library", + "//beacon-chain/rpc/eth/config:go_default_library", "//beacon-chain/rpc/eth/shared:go_default_library", "//beacon-chain/state:go_default_library", "//consensus-types/interfaces:go_default_library", @@ -22,7 +23,6 @@ go_library( "//encoding/ssz/detect:go_default_library", "//io/file:go_default_library", "//network/forks:go_default_library", - "//proto/eth/v1:go_default_library", "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", diff --git a/api/client/beacon/client.go b/api/client/beacon/client.go index af0c02c0f1..336f816e53 100644 --- a/api/client/beacon/client.go +++ b/api/client/beacon/client.go @@ -13,17 +13,16 @@ import ( "strconv" "text/template" - "github.com/prysmaticlabs/prysm/v4/api/client" - "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/beacon" - "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared" - "github.com/prysmaticlabs/prysm/v4/network/forks" - v1 "github.com/prysmaticlabs/prysm/v4/proto/eth/v1" - "github.com/ethereum/go-ethereum/common/hexutil" "github.com/pkg/errors" + "github.com/prysmaticlabs/prysm/v4/api/client" "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware" + "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/beacon" + "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/config" + "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared" "github.com/prysmaticlabs/prysm/v4/consensus-types/primitives" "github.com/prysmaticlabs/prysm/v4/encoding/bytesutil" + "github.com/prysmaticlabs/prysm/v4/network/forks" ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1" log "github.com/sirupsen/logrus" ) @@ -179,12 +178,12 @@ func (c *Client) GetForkSchedule(ctx context.Context) (forks.OrderedSchedule, er } // GetConfigSpec retrieve the current configs of the network used by the beacon node. -func (c *Client) GetConfigSpec(ctx context.Context) (*v1.SpecResponse, error) { +func (c *Client) GetConfigSpec(ctx context.Context) (*config.GetSpecResponse, error) { body, err := c.Get(ctx, getConfigSpecPath) if err != nil { return nil, errors.Wrap(err, "error requesting configSpecPath") } - fsr := &v1.SpecResponse{} + fsr := &config.GetSpecResponse{} err = json.Unmarshal(body, fsr) if err != nil { return nil, err diff --git a/beacon-chain/rpc/BUILD.bazel b/beacon-chain/rpc/BUILD.bazel index 5692d9949a..155c8414d8 100644 --- a/beacon-chain/rpc/BUILD.bazel +++ b/beacon-chain/rpc/BUILD.bazel @@ -28,6 +28,7 @@ go_library( "//beacon-chain/rpc/eth/beacon:go_default_library", "//beacon-chain/rpc/eth/blob:go_default_library", "//beacon-chain/rpc/eth/builder:go_default_library", + "//beacon-chain/rpc/eth/config:go_default_library", "//beacon-chain/rpc/eth/debug:go_default_library", "//beacon-chain/rpc/eth/events:go_default_library", "//beacon-chain/rpc/eth/node:go_default_library", diff --git a/beacon-chain/rpc/apimiddleware/endpoint_factory.go b/beacon-chain/rpc/apimiddleware/endpoint_factory.go index 2f886a06b6..aaca9b394c 100644 --- a/beacon-chain/rpc/apimiddleware/endpoint_factory.go +++ b/beacon-chain/rpc/apimiddleware/endpoint_factory.go @@ -17,8 +17,6 @@ func (f *BeaconEndpointFactory) IsNil() bool { func (_ *BeaconEndpointFactory) Paths() []string { return []string{ "/eth/v1/beacon/weak_subjectivity", - "/eth/v1/config/fork_schedule", - "/eth/v1/config/spec", "/eth/v1/events", } } @@ -29,10 +27,6 @@ func (_ *BeaconEndpointFactory) Create(path string) (*apimiddleware.Endpoint, er switch path { case "/eth/v1/beacon/weak_subjectivity": endpoint.GetResponse = &WeakSubjectivityResponse{} - case "/eth/v1/config/fork_schedule": - endpoint.GetResponse = &ForkScheduleResponseJson{} - case "/eth/v1/config/spec": - endpoint.GetResponse = &SpecResponseJson{} case "/eth/v1/events": endpoint.CustomHandlers = []apimiddleware.CustomHandler{handleEvents} default: diff --git a/beacon-chain/rpc/apimiddleware/structs.go b/beacon-chain/rpc/apimiddleware/structs.go index 494e377242..9a9c78e810 100644 --- a/beacon-chain/rpc/apimiddleware/structs.go +++ b/beacon-chain/rpc/apimiddleware/structs.go @@ -23,18 +23,10 @@ type BlockRootResponseJson struct { Finalized bool `json:"finalized"` } -type ForkScheduleResponseJson struct { - Data []*ForkJson `json:"data"` -} - type DepositContractResponseJson struct { Data *DepositContractJson `json:"data"` } -type SpecResponseJson struct { - Data interface{} `json:"data"` -} - type AggregateAttestationResponseJson struct { Data *AttestationJson `json:"data"` } diff --git a/beacon-chain/rpc/eth/beacon/BUILD.bazel b/beacon-chain/rpc/eth/beacon/BUILD.bazel index 3a3b0033a0..aae2378dc5 100644 --- a/beacon-chain/rpc/eth/beacon/BUILD.bazel +++ b/beacon-chain/rpc/eth/beacon/BUILD.bazel @@ -4,7 +4,6 @@ go_library( name = "go_default_library", srcs = [ "blocks.go", - "config.go", "handlers.go", "handlers_pool.go", "handlers_state.go", @@ -51,7 +50,6 @@ go_library( "//consensus-types/validator:go_default_library", "//crypto/bls:go_default_library", "//encoding/bytesutil:go_default_library", - "//network/forks:go_default_library", "//network/http:go_default_library", "//proto/eth/v1:go_default_library", "//proto/prysm/v1alpha1:go_default_library", @@ -65,7 +63,6 @@ go_library( "@io_opencensus_go//trace:go_default_library", "@org_golang_google_grpc//codes:go_default_library", "@org_golang_google_grpc//status:go_default_library", - "@org_golang_google_protobuf//types/known/emptypb:go_default_library", ], ) @@ -74,7 +71,6 @@ go_test( srcs = [ "blinded_blocks_test.go", "blocks_test.go", - "config_test.go", "handlers_pool_test.go", "handlers_state_test.go", "handlers_test.go", @@ -118,7 +114,6 @@ go_test( "//crypto/hash:go_default_library", "//encoding/bytesutil:go_default_library", "//encoding/ssz:go_default_library", - "//network/forks:go_default_library", "//network/http:go_default_library", "//proto/eth/service:go_default_library", "//proto/migration:go_default_library", @@ -129,13 +124,11 @@ go_test( "//testing/require:go_default_library", "//testing/util:go_default_library", "//time/slots:go_default_library", - "@com_github_ethereum_go_ethereum//common:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", "@com_github_golang_mock//gomock:go_default_library", "@com_github_gorilla_mux//:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", "@com_github_stretchr_testify//mock:go_default_library", - "@org_golang_google_protobuf//types/known/emptypb:go_default_library", ], ) diff --git a/beacon-chain/rpc/eth/beacon/handlers.go b/beacon-chain/rpc/eth/beacon/handlers.go index dd8d36ae51..f3d2c7901e 100644 --- a/beacon-chain/rpc/eth/beacon/handlers.go +++ b/beacon-chain/rpc/eth/beacon/handlers.go @@ -1688,22 +1688,6 @@ func (s *Server) GetCommittees(w http.ResponseWriter, r *http.Request) { http2.WriteJson(w, &GetCommitteesResponse{Data: committees, ExecutionOptimistic: isOptimistic, Finalized: isFinalized}) } -// GetDepositContract retrieves deposit contract address and genesis fork version. -func (*Server) GetDepositContract(w http.ResponseWriter, r *http.Request) { - _, span := trace.StartSpan(r.Context(), "beacon.GetDepositContract") - defer span.End() - - http2.WriteJson(w, &DepositContractResponse{ - Data: &struct { - ChainId string `json:"chain_id"` - Address string `json:"address"` - }{ - ChainId: strconv.FormatUint(params.BeaconConfig().DepositChainID, 10), - Address: params.BeaconConfig().DepositContractAddress, - }, - }) -} - // GetBlockHeaders retrieves block headers matching given query. By default it will fetch current head slot blocks. func (s *Server) GetBlockHeaders(w http.ResponseWriter, r *http.Request) { ctx, span := trace.StartSpan(r.Context(), "beacon.GetBlockHeaders") diff --git a/beacon-chain/rpc/eth/beacon/handlers_test.go b/beacon-chain/rpc/eth/beacon/handlers_test.go index 9e302f7deb..49d5b40436 100644 --- a/beacon-chain/rpc/eth/beacon/handlers_test.go +++ b/beacon-chain/rpc/eth/beacon/handlers_test.go @@ -3147,23 +3147,3 @@ func TestGetGenesis(t *testing.T) { assert.StringContains(t, "Chain genesis info is not yet known", e.Message) }) } - -func TestGetDepositContract(t *testing.T) { - params.SetupTestConfigCleanup(t) - config := params.BeaconConfig().Copy() - config.DepositChainID = uint64(10) - config.DepositContractAddress = "0x4242424242424242424242424242424242424242" - params.OverrideBeaconConfig(config) - - request := httptest.NewRequest(http.MethodGet, "/eth/v1/beacon/states/{state_id}/finality_checkpoints", nil) - writer := httptest.NewRecorder() - writer.Body = &bytes.Buffer{} - - s := &Server{} - s.GetDepositContract(writer, request) - assert.Equal(t, http.StatusOK, writer.Code) - response := DepositContractResponse{} - require.NoError(t, json.Unmarshal(writer.Body.Bytes(), &response)) - assert.Equal(t, "10", response.Data.ChainId) - assert.Equal(t, "0x4242424242424242424242424242424242424242", response.Data.Address) -} diff --git a/beacon-chain/rpc/eth/beacon/structs.go b/beacon-chain/rpc/eth/beacon/structs.go index 989acacd84..d889358f6b 100644 --- a/beacon-chain/rpc/eth/beacon/structs.go +++ b/beacon-chain/rpc/eth/beacon/structs.go @@ -20,13 +20,6 @@ type GetCommitteesResponse struct { Finalized bool `json:"finalized"` } -type DepositContractResponse struct { - Data *struct { - ChainId string `json:"chain_id"` - Address string `json:"address"` - } `json:"data"` -} - type ListAttestationsResponse struct { Data []*shared.Attestation `json:"data"` } diff --git a/beacon-chain/rpc/eth/config/BUILD.bazel b/beacon-chain/rpc/eth/config/BUILD.bazel new file mode 100644 index 0000000000..80c914cb67 --- /dev/null +++ b/beacon-chain/rpc/eth/config/BUILD.bazel @@ -0,0 +1,35 @@ +load("@prysm//tools/go:def.bzl", "go_library", "go_test") + +go_library( + name = "go_default_library", + srcs = [ + "handlers.go", + "structs.go", + ], + importpath = "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/config", + visibility = ["//visibility:public"], + deps = [ + "//beacon-chain/rpc/eth/shared:go_default_library", + "//config/params:go_default_library", + "//network/forks:go_default_library", + "//network/http:go_default_library", + "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", + "@io_opencensus_go//trace:go_default_library", + ], +) + +go_test( + name = "go_default_test", + srcs = ["handlers_test.go"], + embed = [":go_default_library"], + deps = [ + "//config/params:go_default_library", + "//consensus-types/primitives:go_default_library", + "//encoding/bytesutil:go_default_library", + "//network/forks:go_default_library", + "//testing/assert:go_default_library", + "//testing/require:go_default_library", + "@com_github_ethereum_go_ethereum//common:go_default_library", + "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", + ], +) diff --git a/beacon-chain/rpc/eth/beacon/config.go b/beacon-chain/rpc/eth/config/handlers.go similarity index 60% rename from beacon-chain/rpc/eth/beacon/config.go rename to beacon-chain/rpc/eth/config/handlers.go index 6bd8d18a67..a13bbb0705 100644 --- a/beacon-chain/rpc/eth/beacon/config.go +++ b/beacon-chain/rpc/eth/config/handlers.go @@ -1,36 +1,48 @@ -package beacon +package config import ( - "context" "fmt" + "net/http" "reflect" "strconv" "strings" "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared" "github.com/prysmaticlabs/prysm/v4/config/params" "github.com/prysmaticlabs/prysm/v4/network/forks" - ethpb "github.com/prysmaticlabs/prysm/v4/proto/eth/v1" + http2 "github.com/prysmaticlabs/prysm/v4/network/http" "go.opencensus.io/trace" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - "google.golang.org/protobuf/types/known/emptypb" ) +// GetDepositContract retrieves deposit contract address and genesis fork version. +func GetDepositContract(w http.ResponseWriter, r *http.Request) { + _, span := trace.StartSpan(r.Context(), "config.GetDepositContract") + defer span.End() + + http2.WriteJson(w, &GetDepositContractResponse{ + Data: &DepositContractData{ + ChainId: strconv.FormatUint(params.BeaconConfig().DepositChainID, 10), + Address: params.BeaconConfig().DepositContractAddress, + }, + }) +} + // GetForkSchedule retrieve all scheduled upcoming forks this node is aware of. -func (_ *Server) GetForkSchedule(ctx context.Context, _ *emptypb.Empty) (*ethpb.ForkScheduleResponse, error) { - ctx, span := trace.StartSpan(ctx, "beacon.GetForkSchedule") +func GetForkSchedule(w http.ResponseWriter, r *http.Request) { + _, span := trace.StartSpan(r.Context(), "config.GetForkSchedule") defer span.End() schedule := params.BeaconConfig().ForkVersionSchedule if len(schedule) == 0 { - return ðpb.ForkScheduleResponse{ - Data: make([]*ethpb.Fork, 0), - }, nil + http2.WriteJson(w, &GetForkScheduleResponse{ + Data: make([]*shared.Fork, 0), + }) + return } versions := forks.SortedForkVersions(schedule) - chainForks := make([]*ethpb.Fork, len(schedule)) + chainForks := make([]*shared.Fork, len(schedule)) var previous, current []byte for i, v := range versions { if i == 0 { @@ -40,31 +52,32 @@ func (_ *Server) GetForkSchedule(ctx context.Context, _ *emptypb.Empty) (*ethpb. } copyV := v current = copyV[:] - chainForks[i] = ðpb.Fork{ - PreviousVersion: previous, - CurrentVersion: current, - Epoch: schedule[v], + chainForks[i] = &shared.Fork{ + PreviousVersion: hexutil.Encode(previous), + CurrentVersion: hexutil.Encode(current), + Epoch: fmt.Sprintf("%d", schedule[v]), } } - return ðpb.ForkScheduleResponse{ + http2.WriteJson(w, &GetForkScheduleResponse{ Data: chainForks, - }, nil + }) } // GetSpec retrieves specification configuration (without Phase 1 params) used on this node. Specification params list // Values are returned with following format: // - any value starting with 0x in the spec is returned as a hex string. // - all other values are returned as number. -func (_ *Server) GetSpec(ctx context.Context, _ *emptypb.Empty) (*ethpb.SpecResponse, error) { - ctx, span := trace.StartSpan(ctx, "beacon.GetSpec") +func GetSpec(w http.ResponseWriter, r *http.Request) { + _, span := trace.StartSpan(r.Context(), "config.GetSpec") defer span.End() data, err := prepareConfigSpec() if err != nil { - return nil, status.Errorf(codes.Internal, "Failed to prepare spec data: %v", err) + http2.HandleError(w, "Could not prepare config spec: "+err.Error(), http.StatusInternalServerError) + return } - return ðpb.SpecResponse{Data: data}, nil + http2.WriteJson(w, &GetSpecResponse{Data: data}) } func prepareConfigSpec() (map[string]string, error) { diff --git a/beacon-chain/rpc/eth/beacon/config_test.go b/beacon-chain/rpc/eth/config/handlers_test.go similarity index 77% rename from beacon-chain/rpc/eth/beacon/config_test.go rename to beacon-chain/rpc/eth/config/handlers_test.go index 12c3aeb0fa..66d59d3846 100644 --- a/beacon-chain/rpc/eth/beacon/config_test.go +++ b/beacon-chain/rpc/eth/config/handlers_test.go @@ -1,20 +1,43 @@ -package beacon +package config import ( - "context" + "bytes" "encoding/hex" + "encoding/json" + "fmt" + "net/http" + "net/http/httptest" "testing" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" "github.com/prysmaticlabs/prysm/v4/config/params" "github.com/prysmaticlabs/prysm/v4/consensus-types/primitives" "github.com/prysmaticlabs/prysm/v4/encoding/bytesutil" "github.com/prysmaticlabs/prysm/v4/network/forks" "github.com/prysmaticlabs/prysm/v4/testing/assert" "github.com/prysmaticlabs/prysm/v4/testing/require" - "google.golang.org/protobuf/types/known/emptypb" ) +func TestGetDepositContract(t *testing.T) { + params.SetupTestConfigCleanup(t) + config := params.BeaconConfig().Copy() + config.DepositChainID = uint64(10) + config.DepositContractAddress = "0x4242424242424242424242424242424242424242" + params.OverrideBeaconConfig(config) + + request := httptest.NewRequest(http.MethodGet, "http://example.com/eth/v1/config/deposit_contract", nil) + writer := httptest.NewRecorder() + writer.Body = &bytes.Buffer{} + + GetDepositContract(writer, request) + require.Equal(t, http.StatusOK, writer.Code) + response := GetDepositContractResponse{} + require.NoError(t, json.Unmarshal(writer.Body.Bytes(), &response)) + assert.Equal(t, "10", response.Data.ChainId) + assert.Equal(t, "0x4242424242424242424242424242424242424242", response.Data.Address) +} + func TestGetSpec(t *testing.T) { params.SetupTestConfigCleanup(t) config := params.BeaconConfig().Copy() @@ -137,12 +160,19 @@ func TestGetSpec(t *testing.T) { params.OverrideBeaconConfig(config) - server := &Server{} - resp, err := server.GetSpec(context.Background(), &emptypb.Empty{}) - require.NoError(t, err) + request := httptest.NewRequest(http.MethodGet, "http://example.com/eth/v1/config/spec", nil) + writer := httptest.NewRecorder() + writer.Body = &bytes.Buffer{} - assert.Equal(t, 112, len(resp.Data)) - for k, v := range resp.Data { + GetSpec(writer, request) + require.Equal(t, http.StatusOK, writer.Code) + resp := GetSpecResponse{} + require.NoError(t, json.Unmarshal(writer.Body.Bytes(), &resp)) + data, ok := resp.Data.(map[string]interface{}) + require.Equal(t, true, ok) + + assert.Equal(t, 112, len(data)) + for k, v := range data { switch k { case "CONFIG_NAME": assert.Equal(t, "ConfigName", v) @@ -353,7 +383,9 @@ func TestGetSpec(t *testing.T) { case "TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH": assert.Equal(t, "72", v) case "TERMINAL_BLOCK_HASH": - assert.Equal(t, common.HexToHash("TerminalBlockHash"), common.HexToHash(v)) + s, ok := v.(string) + require.Equal(t, true, ok) + assert.Equal(t, common.HexToHash("TerminalBlockHash"), common.HexToHash(s)) case "TERMINAL_TOTAL_DIFFICULTY": assert.Equal(t, "73", v) case "DefaultFeeRecipient": @@ -390,44 +422,55 @@ func TestGetSpec(t *testing.T) { } func TestForkSchedule_Ok(t *testing.T) { - genesisForkVersion := []byte("Genesis") - firstForkVersion, firstForkEpoch := []byte("Firs"), primitives.Epoch(100) - secondForkVersion, secondForkEpoch := []byte("Seco"), primitives.Epoch(200) - thirdForkVersion, thirdForkEpoch := []byte("Thir"), primitives.Epoch(300) + t.Run("ok", func(t *testing.T) { + genesisForkVersion := []byte("Genesis") + firstForkVersion, firstForkEpoch := []byte("Firs"), primitives.Epoch(100) + secondForkVersion, secondForkEpoch := []byte("Seco"), primitives.Epoch(200) + thirdForkVersion, thirdForkEpoch := []byte("Thir"), primitives.Epoch(300) - params.SetupTestConfigCleanup(t) - config := params.BeaconConfig().Copy() - config.GenesisForkVersion = genesisForkVersion - // Create fork schedule adding keys in non-sorted order. - schedule := make(map[[4]byte]primitives.Epoch, 3) - schedule[bytesutil.ToBytes4(secondForkVersion)] = secondForkEpoch - schedule[bytesutil.ToBytes4(firstForkVersion)] = firstForkEpoch - schedule[bytesutil.ToBytes4(thirdForkVersion)] = thirdForkEpoch - config.ForkVersionSchedule = schedule - params.OverrideBeaconConfig(config) + params.SetupTestConfigCleanup(t) + config := params.BeaconConfig().Copy() + config.GenesisForkVersion = genesisForkVersion + // Create fork schedule adding keys in non-sorted order. + schedule := make(map[[4]byte]primitives.Epoch, 3) + schedule[bytesutil.ToBytes4(secondForkVersion)] = secondForkEpoch + schedule[bytesutil.ToBytes4(firstForkVersion)] = firstForkEpoch + schedule[bytesutil.ToBytes4(thirdForkVersion)] = thirdForkEpoch + config.ForkVersionSchedule = schedule + params.OverrideBeaconConfig(config) - s := &Server{} - resp, err := s.GetForkSchedule(context.Background(), &emptypb.Empty{}) - require.NoError(t, err) - require.Equal(t, 3, len(resp.Data)) - fork := resp.Data[0] - assert.DeepEqual(t, genesisForkVersion, fork.PreviousVersion) - assert.DeepEqual(t, string(firstForkVersion), string(fork.CurrentVersion)) - assert.Equal(t, firstForkEpoch, fork.Epoch) - fork = resp.Data[1] - assert.DeepEqual(t, firstForkVersion, fork.PreviousVersion) - assert.DeepEqual(t, secondForkVersion, fork.CurrentVersion) - assert.Equal(t, secondForkEpoch, fork.Epoch) - fork = resp.Data[2] - assert.DeepEqual(t, secondForkVersion, fork.PreviousVersion) - assert.DeepEqual(t, thirdForkVersion, fork.CurrentVersion) - assert.Equal(t, thirdForkEpoch, fork.Epoch) -} - -func TestForkSchedule_CorrectNumberOfForks(t *testing.T) { - s := &Server{} - resp, err := s.GetForkSchedule(context.Background(), &emptypb.Empty{}) - require.NoError(t, err) - os := forks.NewOrderedSchedule(params.BeaconConfig()) - assert.Equal(t, os.Len(), len(resp.Data)) + request := httptest.NewRequest(http.MethodGet, "http://example.com/eth/v1/config/fork_schedule", nil) + writer := httptest.NewRecorder() + writer.Body = &bytes.Buffer{} + + GetForkSchedule(writer, request) + require.Equal(t, http.StatusOK, writer.Code) + resp := &GetForkScheduleResponse{} + require.NoError(t, json.Unmarshal(writer.Body.Bytes(), resp)) + require.Equal(t, 3, len(resp.Data)) + fork := resp.Data[0] + assert.DeepEqual(t, hexutil.Encode(genesisForkVersion), fork.PreviousVersion) + assert.DeepEqual(t, hexutil.Encode(firstForkVersion), fork.CurrentVersion) + assert.Equal(t, fmt.Sprintf("%d", firstForkEpoch), fork.Epoch) + fork = resp.Data[1] + assert.DeepEqual(t, hexutil.Encode(firstForkVersion), fork.PreviousVersion) + assert.DeepEqual(t, hexutil.Encode(secondForkVersion), fork.CurrentVersion) + assert.Equal(t, fmt.Sprintf("%d", secondForkEpoch), fork.Epoch) + fork = resp.Data[2] + assert.DeepEqual(t, hexutil.Encode(secondForkVersion), fork.PreviousVersion) + assert.DeepEqual(t, hexutil.Encode(thirdForkVersion), fork.CurrentVersion) + assert.Equal(t, fmt.Sprintf("%d", thirdForkEpoch), fork.Epoch) + }) + t.Run("correct number of forks", func(t *testing.T) { + request := httptest.NewRequest(http.MethodGet, "http://example.com/eth/v1/config/fork_schedule", nil) + writer := httptest.NewRecorder() + writer.Body = &bytes.Buffer{} + + GetForkSchedule(writer, request) + require.Equal(t, http.StatusOK, writer.Code) + resp := &GetForkScheduleResponse{} + require.NoError(t, json.Unmarshal(writer.Body.Bytes(), resp)) + os := forks.NewOrderedSchedule(params.BeaconConfig()) + assert.Equal(t, os.Len(), len(resp.Data)) + }) } diff --git a/beacon-chain/rpc/eth/config/structs.go b/beacon-chain/rpc/eth/config/structs.go new file mode 100644 index 0000000000..8a7ca30ec4 --- /dev/null +++ b/beacon-chain/rpc/eth/config/structs.go @@ -0,0 +1,20 @@ +package config + +import "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared" + +type GetDepositContractResponse struct { + Data *DepositContractData `json:"data"` +} + +type DepositContractData struct { + ChainId string `json:"chain_id"` + Address string `json:"address"` +} + +type GetForkScheduleResponse struct { + Data []*shared.Fork `json:"data"` +} + +type GetSpecResponse struct { + Data interface{} `json:"data"` +} diff --git a/beacon-chain/rpc/service.go b/beacon-chain/rpc/service.go index b6da53b387..106faee7f8 100644 --- a/beacon-chain/rpc/service.go +++ b/beacon-chain/rpc/service.go @@ -34,6 +34,7 @@ import ( "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/beacon" "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/blob" rpcBuilder "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/builder" + "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/config" "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/debug" "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/events" "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/node" @@ -466,13 +467,16 @@ func (s *Service) Start() { s.cfg.Router.HandleFunc("/eth/v1/beacon/pool/proposer_slashings", beaconChainServerV1.SubmitProposerSlashing).Methods(http.MethodPost) s.cfg.Router.HandleFunc("/eth/v1/beacon/headers", beaconChainServerV1.GetBlockHeaders).Methods(http.MethodGet) s.cfg.Router.HandleFunc("/eth/v1/beacon/headers/{block_id}", beaconChainServerV1.GetBlockHeader).Methods(http.MethodGet) - s.cfg.Router.HandleFunc("/eth/v1/config/deposit_contract", beaconChainServerV1.GetDepositContract).Methods(http.MethodGet) s.cfg.Router.HandleFunc("/eth/v1/beacon/genesis", beaconChainServerV1.GetGenesis).Methods(http.MethodGet) s.cfg.Router.HandleFunc("/eth/v1/beacon/states/{state_id}/finality_checkpoints", beaconChainServerV1.GetFinalityCheckpoints).Methods(http.MethodGet) s.cfg.Router.HandleFunc("/eth/v1/beacon/states/{state_id}/validators", beaconChainServerV1.GetValidators).Methods(http.MethodGet) s.cfg.Router.HandleFunc("/eth/v1/beacon/states/{state_id}/validators/{validator_id}", beaconChainServerV1.GetValidator).Methods(http.MethodGet) s.cfg.Router.HandleFunc("/eth/v1/beacon/states/{state_id}/validator_balances", beaconChainServerV1.GetValidatorBalances).Methods(http.MethodGet) + s.cfg.Router.HandleFunc("/eth/v1/config/deposit_contract", config.GetDepositContract).Methods(http.MethodGet) + s.cfg.Router.HandleFunc("/eth/v1/config/fork_schedule", config.GetForkSchedule).Methods(http.MethodGet) + s.cfg.Router.HandleFunc("/eth/v1/config/spec", config.GetSpec).Methods(http.MethodGet) + ethpbv1alpha1.RegisterNodeServer(s.grpcServer, nodeServer) ethpbv1alpha1.RegisterHealthServer(s.grpcServer, nodeServer) ethpbv1alpha1.RegisterBeaconChainServer(s.grpcServer, beaconChainServer) diff --git a/cmd/prysmctl/validator/BUILD.bazel b/cmd/prysmctl/validator/BUILD.bazel index c3c092903d..41cff0cf47 100644 --- a/cmd/prysmctl/validator/BUILD.bazel +++ b/cmd/prysmctl/validator/BUILD.bazel @@ -49,6 +49,7 @@ go_test( deps = [ "//beacon-chain/rpc/apimiddleware:go_default_library", "//beacon-chain/rpc/eth/beacon:go_default_library", + "//beacon-chain/rpc/eth/config:go_default_library", "//beacon-chain/rpc/eth/shared:go_default_library", "//config/params:go_default_library", "//testing/assert:go_default_library", diff --git a/cmd/prysmctl/validator/withdraw.go b/cmd/prysmctl/validator/withdraw.go index 8b2b8f1d82..c0312fdb74 100644 --- a/cmd/prysmctl/validator/withdraw.go +++ b/cmd/prysmctl/validator/withdraw.go @@ -97,16 +97,20 @@ func callWithdrawalEndpoints(ctx context.Context, host string, request []*shared if err != nil { return err } - forkEpoch, ok := spec.Data["CAPELLA_FORK_EPOCH"] + data, ok := spec.Data.(map[string]interface{}) if !ok { - return errors.New("Configs used on beacon node do not contain CAPELLA_FORK_EPOCH") + return errors.New("config has incorrect structure") + } + forkEpoch, ok := data["CAPELLA_FORK_EPOCH"].(string) + if !ok { + return errors.New("configs used on beacon node do not contain CAPELLA_FORK_EPOCH") } capellaForkEpoch, err := strconv.Atoi(forkEpoch) if err != nil { return errors.New("could not convert CAPELLA_FORK_EPOCH to a number") } if fork.Epoch < primitives.Epoch(capellaForkEpoch) { - return errors.New("setting withdrawals using the BLStoExecutionChange endpoint is only available after the Capella/Shanghai hard fork.") + return errors.New("setting withdrawals using the BLStoExecutionChange endpoint is only available after the Capella/Shanghai hard fork") } err = client.SubmitChangeBLStoExecution(ctx, request) if err != nil && strings.Contains(err.Error(), "POST error") { diff --git a/cmd/prysmctl/validator/withdraw_test.go b/cmd/prysmctl/validator/withdraw_test.go index d1daedccfc..07d05efba5 100644 --- a/cmd/prysmctl/validator/withdraw_test.go +++ b/cmd/prysmctl/validator/withdraw_test.go @@ -14,6 +14,7 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware" "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/beacon" + "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/config" "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared" "github.com/prysmaticlabs/prysm/v4/config/params" "github.com/prysmaticlabs/prysm/v4/testing/assert" @@ -52,7 +53,7 @@ func getHappyPathTestServer(file string, t *testing.T) *httptest.Server { } else if r.RequestURI == "/eth/v1/config/spec" { m := make(map[string]string) m["CAPELLA_FORK_EPOCH"] = "1350" - err := json.NewEncoder(w).Encode(&apimiddleware.SpecResponseJson{ + err := json.NewEncoder(w).Encode(&config.GetSpecResponse{ Data: m, }) require.NoError(t, err) @@ -91,7 +92,7 @@ func TestCallWithdrawalEndpoint(t *testing.T) { assert.LogsContain(t, hook, "Successfully published") } -func TestCallWithdrawalEndpoint_Mutiple(t *testing.T) { +func TestCallWithdrawalEndpoint_Multiple(t *testing.T) { file := "./testdata/change-operations-multiple.json" baseurl := "127.0.0.1:3500" l, err := net.Listen("tcp", baseurl) @@ -122,7 +123,7 @@ func TestCallWithdrawalEndpoint_Mutiple(t *testing.T) { assert.LogsDoNotContain(t, hook, "Set withdrawal address message not found in the node's operations pool.") } -func TestCallWithdrawalEndpoint_Mutiple_stakingcli(t *testing.T) { +func TestCallWithdrawalEndpoint_Multiple_stakingcli(t *testing.T) { stakingcliFile := "./testdata/staking-cli-change-operations-multiple.json" file := "./testdata/change-operations-multiple.json" baseurl := "127.0.0.1:3500" @@ -154,7 +155,7 @@ func TestCallWithdrawalEndpoint_Mutiple_stakingcli(t *testing.T) { assert.LogsDoNotContain(t, hook, "Set withdrawal address message not found in the node's operations pool.") } -func TestCallWithdrawalEndpoint_Mutiple_notfound(t *testing.T) { +func TestCallWithdrawalEndpoint_Multiple_notfound(t *testing.T) { respFile := "./testdata/change-operations-multiple_notfound.json" file := "./testdata/change-operations-multiple.json" baseurl := "127.0.0.1:3500" @@ -245,7 +246,7 @@ func TestCallWithdrawalEndpoint_Errors(t *testing.T) { w.Header().Set("Content-Type", "application/json") m := make(map[string]string) m["CAPELLA_FORK_EPOCH"] = "1350" - err := json.NewEncoder(w).Encode(&apimiddleware.SpecResponseJson{ + err := json.NewEncoder(w).Encode(&config.GetSpecResponse{ Data: m, }) require.NoError(t, err) @@ -301,7 +302,7 @@ func TestCallWithdrawalEndpoint_ForkBeforeCapella(t *testing.T) { } else if r.RequestURI == "/eth/v1/config/spec" { m := make(map[string]string) m["CAPELLA_FORK_EPOCH"] = "1350" - err := json.NewEncoder(w).Encode(&apimiddleware.SpecResponseJson{ + err := json.NewEncoder(w).Encode(&config.GetSpecResponse{ Data: m, }) require.NoError(t, err) @@ -324,10 +325,10 @@ func TestCallWithdrawalEndpoint_ForkBeforeCapella(t *testing.T) { cliCtx := cli.NewContext(&app, set, nil) err = setWithdrawalAddresses(cliCtx) - require.ErrorContains(t, "setting withdrawals using the BLStoExecutionChange endpoint is only available after the Capella/Shanghai hard fork.", err) + require.ErrorContains(t, "setting withdrawals using the BLStoExecutionChange endpoint is only available after the Capella/Shanghai hard fork", err) } -func TestVerifyWithdrawal_Mutiple(t *testing.T) { +func TestVerifyWithdrawal_Multiple(t *testing.T) { file := "./testdata/change-operations-multiple.json" baseurl := "127.0.0.1:3500" l, err := net.Listen("tcp", baseurl) diff --git a/proto/eth/service/beacon_chain_service.pb.go b/proto/eth/service/beacon_chain_service.pb.go index de0cf75d9e..092e7c5951 100755 --- a/proto/eth/service/beacon_chain_service.pb.go +++ b/proto/eth/service/beacon_chain_service.pb.go @@ -45,7 +45,7 @@ var file_proto_eth_service_beacon_chain_service_proto_rawDesc = []byte{ 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x5f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x32, 0x87, 0x03, 0x0a, 0x0b, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x43, 0x68, + 0x6f, 0x74, 0x6f, 0x32, 0x9e, 0x01, 0x0a, 0x0b, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x12, 0x8e, 0x01, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x57, 0x65, 0x61, 0x6b, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, @@ -55,48 +55,28 @@ var file_proto_eth_service_beacon_chain_service_proto_rawDesc = []byte{ 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2b, 0x12, 0x29, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2f, 0x77, 0x65, 0x61, 0x6b, 0x5f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, - 0x79, 0x88, 0x02, 0x01, 0x12, 0x7f, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x46, 0x6f, 0x72, 0x6b, 0x53, - 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, - 0x25, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, - 0x31, 0x2e, 0x46, 0x6f, 0x72, 0x6b, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x12, 0x25, - 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, - 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x66, 0x6f, 0x72, 0x6b, 0x5f, 0x73, 0x63, 0x68, - 0x65, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x66, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x53, 0x70, 0x65, 0x63, - 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1d, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, - 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x70, 0x65, 0x63, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x24, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x12, - 0x1c, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, - 0x31, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x73, 0x70, 0x65, 0x63, 0x42, 0x98, 0x01, - 0x0a, 0x18, 0x6f, 0x72, 0x67, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, - 0x74, 0x68, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x17, 0x42, 0x65, 0x61, 0x63, - 0x6f, 0x6e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, - 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x34, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, - 0x74, 0x68, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xaa, 0x02, 0x14, 0x45, 0x74, 0x68, - 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x45, 0x74, 0x68, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0xca, 0x02, 0x14, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x5c, 0x45, 0x74, 0x68, - 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x79, 0x88, 0x02, 0x01, 0x42, 0x98, 0x01, 0x0a, 0x18, 0x6f, 0x72, 0x67, 0x2e, 0x65, 0x74, 0x68, + 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x42, 0x17, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x33, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, + 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x34, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0xaa, 0x02, 0x14, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x45, 0x74, 0x68, + 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xca, 0x02, 0x14, 0x45, 0x74, 0x68, 0x65, 0x72, + 0x65, 0x75, 0x6d, 0x5c, 0x45, 0x74, 0x68, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var file_proto_eth_service_beacon_chain_service_proto_goTypes = []interface{}{ (*emptypb.Empty)(nil), // 0: google.protobuf.Empty (*v1.WeakSubjectivityResponse)(nil), // 1: ethereum.eth.v1.WeakSubjectivityResponse - (*v1.ForkScheduleResponse)(nil), // 2: ethereum.eth.v1.ForkScheduleResponse - (*v1.SpecResponse)(nil), // 3: ethereum.eth.v1.SpecResponse } var file_proto_eth_service_beacon_chain_service_proto_depIdxs = []int32{ 0, // 0: ethereum.eth.service.BeaconChain.GetWeakSubjectivity:input_type -> google.protobuf.Empty - 0, // 1: ethereum.eth.service.BeaconChain.GetForkSchedule:input_type -> google.protobuf.Empty - 0, // 2: ethereum.eth.service.BeaconChain.GetSpec:input_type -> google.protobuf.Empty - 1, // 3: ethereum.eth.service.BeaconChain.GetWeakSubjectivity:output_type -> ethereum.eth.v1.WeakSubjectivityResponse - 2, // 4: ethereum.eth.service.BeaconChain.GetForkSchedule:output_type -> ethereum.eth.v1.ForkScheduleResponse - 3, // 5: ethereum.eth.service.BeaconChain.GetSpec:output_type -> ethereum.eth.v1.SpecResponse - 3, // [3:6] is the sub-list for method output_type - 0, // [0:3] is the sub-list for method input_type + 1, // 1: ethereum.eth.service.BeaconChain.GetWeakSubjectivity:output_type -> ethereum.eth.v1.WeakSubjectivityResponse + 1, // [1:2] is the sub-list for method output_type + 0, // [0:1] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name 0, // [0:0] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name @@ -140,8 +120,6 @@ const _ = grpc.SupportPackageIsVersion6 type BeaconChainClient interface { // Deprecated: Do not use. GetWeakSubjectivity(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*v1.WeakSubjectivityResponse, error) - GetForkSchedule(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*v1.ForkScheduleResponse, error) - GetSpec(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*v1.SpecResponse, error) } type beaconChainClient struct { @@ -162,30 +140,10 @@ func (c *beaconChainClient) GetWeakSubjectivity(ctx context.Context, in *emptypb return out, nil } -func (c *beaconChainClient) GetForkSchedule(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*v1.ForkScheduleResponse, error) { - out := new(v1.ForkScheduleResponse) - err := c.cc.Invoke(ctx, "/ethereum.eth.service.BeaconChain/GetForkSchedule", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *beaconChainClient) GetSpec(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*v1.SpecResponse, error) { - out := new(v1.SpecResponse) - err := c.cc.Invoke(ctx, "/ethereum.eth.service.BeaconChain/GetSpec", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - // BeaconChainServer is the server API for BeaconChain service. type BeaconChainServer interface { // Deprecated: Do not use. GetWeakSubjectivity(context.Context, *emptypb.Empty) (*v1.WeakSubjectivityResponse, error) - GetForkSchedule(context.Context, *emptypb.Empty) (*v1.ForkScheduleResponse, error) - GetSpec(context.Context, *emptypb.Empty) (*v1.SpecResponse, error) } // UnimplementedBeaconChainServer can be embedded to have forward compatible implementations. @@ -195,12 +153,6 @@ type UnimplementedBeaconChainServer struct { func (*UnimplementedBeaconChainServer) GetWeakSubjectivity(context.Context, *emptypb.Empty) (*v1.WeakSubjectivityResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetWeakSubjectivity not implemented") } -func (*UnimplementedBeaconChainServer) GetForkSchedule(context.Context, *emptypb.Empty) (*v1.ForkScheduleResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetForkSchedule not implemented") -} -func (*UnimplementedBeaconChainServer) GetSpec(context.Context, *emptypb.Empty) (*v1.SpecResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetSpec not implemented") -} func RegisterBeaconChainServer(s *grpc.Server, srv BeaconChainServer) { s.RegisterService(&_BeaconChain_serviceDesc, srv) @@ -224,42 +176,6 @@ func _BeaconChain_GetWeakSubjectivity_Handler(srv interface{}, ctx context.Conte return interceptor(ctx, in, info, handler) } -func _BeaconChain_GetForkSchedule_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(emptypb.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(BeaconChainServer).GetForkSchedule(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ethereum.eth.service.BeaconChain/GetForkSchedule", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BeaconChainServer).GetForkSchedule(ctx, req.(*emptypb.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _BeaconChain_GetSpec_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(emptypb.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(BeaconChainServer).GetSpec(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ethereum.eth.service.BeaconChain/GetSpec", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BeaconChainServer).GetSpec(ctx, req.(*emptypb.Empty)) - } - return interceptor(ctx, in, info, handler) -} - var _BeaconChain_serviceDesc = grpc.ServiceDesc{ ServiceName: "ethereum.eth.service.BeaconChain", HandlerType: (*BeaconChainServer)(nil), @@ -268,14 +184,6 @@ var _BeaconChain_serviceDesc = grpc.ServiceDesc{ MethodName: "GetWeakSubjectivity", Handler: _BeaconChain_GetWeakSubjectivity_Handler, }, - { - MethodName: "GetForkSchedule", - Handler: _BeaconChain_GetForkSchedule_Handler, - }, - { - MethodName: "GetSpec", - Handler: _BeaconChain_GetSpec_Handler, - }, }, Streams: []grpc.StreamDesc{}, Metadata: "proto/eth/service/beacon_chain_service.proto", diff --git a/proto/eth/service/beacon_chain_service.pb.gw.go b/proto/eth/service/beacon_chain_service.pb.gw.go index 3d10a9783a..14c030dab1 100755 --- a/proto/eth/service/beacon_chain_service.pb.gw.go +++ b/proto/eth/service/beacon_chain_service.pb.gw.go @@ -53,42 +53,6 @@ func local_request_BeaconChain_GetWeakSubjectivity_0(ctx context.Context, marsha } -func request_BeaconChain_GetForkSchedule_0(ctx context.Context, marshaler runtime.Marshaler, client BeaconChainClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq emptypb.Empty - var metadata runtime.ServerMetadata - - msg, err := client.GetForkSchedule(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_BeaconChain_GetForkSchedule_0(ctx context.Context, marshaler runtime.Marshaler, server BeaconChainServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq emptypb.Empty - var metadata runtime.ServerMetadata - - msg, err := server.GetForkSchedule(ctx, &protoReq) - return msg, metadata, err - -} - -func request_BeaconChain_GetSpec_0(ctx context.Context, marshaler runtime.Marshaler, client BeaconChainClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq emptypb.Empty - var metadata runtime.ServerMetadata - - msg, err := client.GetSpec(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_BeaconChain_GetSpec_0(ctx context.Context, marshaler runtime.Marshaler, server BeaconChainServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq emptypb.Empty - var metadata runtime.ServerMetadata - - msg, err := server.GetSpec(ctx, &protoReq) - return msg, metadata, err - -} - // RegisterBeaconChainHandlerServer registers the http handlers for service BeaconChain to "mux". // UnaryRPC :call BeaconChainServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -118,52 +82,6 @@ func RegisterBeaconChainHandlerServer(ctx context.Context, mux *runtime.ServeMux }) - mux.Handle("GET", pattern_BeaconChain_GetForkSchedule_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/ethereum.eth.service.BeaconChain/GetForkSchedule") - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_BeaconChain_GetForkSchedule_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_BeaconChain_GetForkSchedule_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_BeaconChain_GetSpec_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/ethereum.eth.service.BeaconChain/GetSpec") - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_BeaconChain_GetSpec_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_BeaconChain_GetSpec_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - return nil } @@ -225,61 +143,13 @@ func RegisterBeaconChainHandlerClient(ctx context.Context, mux *runtime.ServeMux }) - mux.Handle("GET", pattern_BeaconChain_GetForkSchedule_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/ethereum.eth.service.BeaconChain/GetForkSchedule") - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_BeaconChain_GetForkSchedule_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_BeaconChain_GetForkSchedule_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_BeaconChain_GetSpec_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/ethereum.eth.service.BeaconChain/GetSpec") - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_BeaconChain_GetSpec_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_BeaconChain_GetSpec_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - return nil } var ( pattern_BeaconChain_GetWeakSubjectivity_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"internal", "eth", "v1", "beacon", "weak_subjectivity"}, "")) - - pattern_BeaconChain_GetForkSchedule_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"internal", "eth", "v1", "config", "fork_schedule"}, "")) - - pattern_BeaconChain_GetSpec_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"internal", "eth", "v1", "config", "spec"}, "")) ) var ( forward_BeaconChain_GetWeakSubjectivity_0 = runtime.ForwardResponseMessage - - forward_BeaconChain_GetForkSchedule_0 = runtime.ForwardResponseMessage - - forward_BeaconChain_GetSpec_0 = runtime.ForwardResponseMessage ) diff --git a/proto/eth/service/beacon_chain_service.proto b/proto/eth/service/beacon_chain_service.proto index c49653132b..faa641b174 100644 --- a/proto/eth/service/beacon_chain_service.proto +++ b/proto/eth/service/beacon_chain_service.proto @@ -45,23 +45,4 @@ service BeaconChain { option deprecated = true; option (google.api.http) = {get: "/internal/eth/v1/beacon/weak_subjectivity"}; } - - // Beacon config API related endpoints. - - // GetForkSchedule retrieve all scheduled upcoming forks this node is aware of. - // - // Spec: https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.3.0#/Config/getForkSchedule - rpc GetForkSchedule(google.protobuf.Empty) returns (v1.ForkScheduleResponse) { - option (google.api.http) = {get: "/internal/eth/v1/config/fork_schedule"}; - } - - // Spec retrieves specification configuration (without Phase 1 params) used on this node. Specification params list - // Values are returned with following format: - // - any value starting with 0x in the spec is returned as a hex string - // - all other values are returned as number - // - // Spec: https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.3.0#/Config/getSpec - rpc GetSpec(google.protobuf.Empty) returns (v1.SpecResponse) { - option (google.api.http) = {get: "/internal/eth/v1/config/spec"}; - } } diff --git a/proto/eth/v1/beacon_chain.pb.go b/proto/eth/v1/beacon_chain.pb.go index e7ce1d72f2..c82a0eb6ba 100755 --- a/proto/eth/v1/beacon_chain.pb.go +++ b/proto/eth/v1/beacon_chain.pb.go @@ -70,202 +70,6 @@ func (x *StateRequest) GetStateId() []byte { return nil } -type ForkScheduleResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Data []*Fork `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"` -} - -func (x *ForkScheduleResponse) Reset() { - *x = ForkScheduleResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_eth_v1_beacon_chain_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ForkScheduleResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ForkScheduleResponse) ProtoMessage() {} - -func (x *ForkScheduleResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_eth_v1_beacon_chain_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ForkScheduleResponse.ProtoReflect.Descriptor instead. -func (*ForkScheduleResponse) Descriptor() ([]byte, []int) { - return file_proto_eth_v1_beacon_chain_proto_rawDescGZIP(), []int{1} -} - -func (x *ForkScheduleResponse) GetData() []*Fork { - if x != nil { - return x.Data - } - return nil -} - -type SpecResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Data map[string]string `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` -} - -func (x *SpecResponse) Reset() { - *x = SpecResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_eth_v1_beacon_chain_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SpecResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SpecResponse) ProtoMessage() {} - -func (x *SpecResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_eth_v1_beacon_chain_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SpecResponse.ProtoReflect.Descriptor instead. -func (*SpecResponse) Descriptor() ([]byte, []int) { - return file_proto_eth_v1_beacon_chain_proto_rawDescGZIP(), []int{2} -} - -func (x *SpecResponse) GetData() map[string]string { - if x != nil { - return x.Data - } - return nil -} - -type DepositContractResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Data *DepositContract `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` -} - -func (x *DepositContractResponse) Reset() { - *x = DepositContractResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_eth_v1_beacon_chain_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DepositContractResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DepositContractResponse) ProtoMessage() {} - -func (x *DepositContractResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_eth_v1_beacon_chain_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DepositContractResponse.ProtoReflect.Descriptor instead. -func (*DepositContractResponse) Descriptor() ([]byte, []int) { - return file_proto_eth_v1_beacon_chain_proto_rawDescGZIP(), []int{3} -} - -func (x *DepositContractResponse) GetData() *DepositContract { - if x != nil { - return x.Data - } - return nil -} - -type DepositContract struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ChainId uint64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` -} - -func (x *DepositContract) Reset() { - *x = DepositContract{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_eth_v1_beacon_chain_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DepositContract) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DepositContract) ProtoMessage() {} - -func (x *DepositContract) ProtoReflect() protoreflect.Message { - mi := &file_proto_eth_v1_beacon_chain_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DepositContract.ProtoReflect.Descriptor instead. -func (*DepositContract) Descriptor() ([]byte, []int) { - return file_proto_eth_v1_beacon_chain_proto_rawDescGZIP(), []int{4} -} - -func (x *DepositContract) GetChainId() uint64 { - if x != nil { - return x.ChainId - } - return 0 -} - -func (x *DepositContract) GetAddress() string { - if x != nil { - return x.Address - } - return "" -} - // Deprecated: Marked as deprecated in proto/eth/v1/beacon_chain.proto. type WeakSubjectivityResponse struct { state protoimpl.MessageState @@ -278,7 +82,7 @@ type WeakSubjectivityResponse struct { func (x *WeakSubjectivityResponse) Reset() { *x = WeakSubjectivityResponse{} if protoimpl.UnsafeEnabled { - mi := &file_proto_eth_v1_beacon_chain_proto_msgTypes[5] + mi := &file_proto_eth_v1_beacon_chain_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -291,7 +95,7 @@ func (x *WeakSubjectivityResponse) String() string { func (*WeakSubjectivityResponse) ProtoMessage() {} func (x *WeakSubjectivityResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_eth_v1_beacon_chain_proto_msgTypes[5] + mi := &file_proto_eth_v1_beacon_chain_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -304,7 +108,7 @@ func (x *WeakSubjectivityResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use WeakSubjectivityResponse.ProtoReflect.Descriptor instead. func (*WeakSubjectivityResponse) Descriptor() ([]byte, []int) { - return file_proto_eth_v1_beacon_chain_proto_rawDescGZIP(), []int{5} + return file_proto_eth_v1_beacon_chain_proto_rawDescGZIP(), []int{1} } func (x *WeakSubjectivityResponse) GetData() *WeakSubjectivityData { @@ -327,7 +131,7 @@ type WeakSubjectivityData struct { func (x *WeakSubjectivityData) Reset() { *x = WeakSubjectivityData{} if protoimpl.UnsafeEnabled { - mi := &file_proto_eth_v1_beacon_chain_proto_msgTypes[6] + mi := &file_proto_eth_v1_beacon_chain_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -340,7 +144,7 @@ func (x *WeakSubjectivityData) String() string { func (*WeakSubjectivityData) ProtoMessage() {} func (x *WeakSubjectivityData) ProtoReflect() protoreflect.Message { - mi := &file_proto_eth_v1_beacon_chain_proto_msgTypes[6] + mi := &file_proto_eth_v1_beacon_chain_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -353,7 +157,7 @@ func (x *WeakSubjectivityData) ProtoReflect() protoreflect.Message { // Deprecated: Use WeakSubjectivityData.ProtoReflect.Descriptor instead. func (*WeakSubjectivityData) Descriptor() ([]byte, []int) { - return file_proto_eth_v1_beacon_chain_proto_rawDescGZIP(), []int{6} + return file_proto_eth_v1_beacon_chain_proto_rawDescGZIP(), []int{2} } func (x *WeakSubjectivityData) GetWsCheckpoint() *Checkpoint { @@ -384,55 +188,31 @@ var file_proto_eth_v1_beacon_chain_proto_rawDesc = []byte{ 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x1f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, - 0x2f, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0x29, 0x0a, 0x0c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, 0x74, 0x61, 0x74, 0x65, 0x49, 0x64, 0x22, 0x41, - 0x0a, 0x14, 0x46, 0x6f, 0x72, 0x6b, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, - 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x6f, 0x72, 0x6b, 0x52, 0x04, 0x64, 0x61, 0x74, - 0x61, 0x22, 0x84, 0x01, 0x0a, 0x0c, 0x53, 0x70, 0x65, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x27, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, - 0x76, 0x31, 0x2e, 0x53, 0x70, 0x65, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, - 0x44, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x1a, - 0x37, 0x0a, 0x09, 0x44, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, - 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x4f, 0x0a, 0x17, 0x44, 0x65, 0x70, 0x6f, - 0x73, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x20, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, - 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x72, - 0x61, 0x63, 0x74, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x46, 0x0a, 0x0f, 0x44, 0x65, 0x70, - 0x6f, 0x73, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x12, 0x19, 0x0a, 0x08, - 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, - 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x22, 0x59, 0x0a, 0x18, 0x57, 0x65, 0x61, 0x6b, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x69, 0x76, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, - 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x65, 0x74, - 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x65, - 0x61, 0x6b, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x44, 0x61, - 0x74, 0x61, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x7b, 0x0a, 0x14, - 0x57, 0x65, 0x61, 0x6b, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, - 0x44, 0x61, 0x74, 0x61, 0x12, 0x40, 0x0a, 0x0d, 0x77, 0x73, 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b, - 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x65, 0x74, - 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x68, - 0x65, 0x63, 0x6b, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x52, 0x0c, 0x77, 0x73, 0x43, 0x68, 0x65, 0x63, - 0x6b, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, - 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x74, 0x61, 0x74, - 0x65, 0x52, 0x6f, 0x6f, 0x74, 0x3a, 0x02, 0x18, 0x01, 0x42, 0x7d, 0x0a, 0x13, 0x6f, 0x72, 0x67, - 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, - 0x42, 0x10, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, - 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x34, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x74, - 0x68, 0x2f, 0x76, 0x31, 0xaa, 0x02, 0x0f, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, - 0x45, 0x74, 0x68, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0f, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, - 0x6d, 0x5c, 0x45, 0x74, 0x68, 0x5c, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x6f, 0x22, 0x29, 0x0a, 0x0c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, 0x74, 0x61, 0x74, 0x65, 0x49, 0x64, 0x22, 0x59, 0x0a, + 0x18, 0x57, 0x65, 0x61, 0x6b, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, + 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x04, 0x64, 0x61, 0x74, + 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, + 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x65, 0x61, 0x6b, 0x53, 0x75, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, + 0x64, 0x61, 0x74, 0x61, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x7b, 0x0a, 0x14, 0x57, 0x65, 0x61, 0x6b, + 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x44, 0x61, 0x74, 0x61, + 0x12, 0x40, 0x0a, 0x0d, 0x77, 0x73, 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x70, 0x6f, 0x69, 0x6e, + 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, + 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x70, + 0x6f, 0x69, 0x6e, 0x74, 0x52, 0x0c, 0x77, 0x73, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x70, 0x6f, 0x69, + 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x72, 0x6f, 0x6f, 0x74, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x74, 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6f, + 0x74, 0x3a, 0x02, 0x18, 0x01, 0x42, 0x7d, 0x0a, 0x13, 0x6f, 0x72, 0x67, 0x2e, 0x65, 0x74, 0x68, + 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x42, 0x10, 0x42, 0x65, + 0x61, 0x63, 0x6f, 0x6e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, + 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, + 0x2f, 0x76, 0x34, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, + 0xaa, 0x02, 0x0f, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x45, 0x74, 0x68, 0x2e, + 0x56, 0x31, 0xca, 0x02, 0x0f, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x5c, 0x45, 0x74, + 0x68, 0x5c, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -447,30 +227,21 @@ func file_proto_eth_v1_beacon_chain_proto_rawDescGZIP() []byte { return file_proto_eth_v1_beacon_chain_proto_rawDescData } -var file_proto_eth_v1_beacon_chain_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_proto_eth_v1_beacon_chain_proto_msgTypes = make([]protoimpl.MessageInfo, 3) var file_proto_eth_v1_beacon_chain_proto_goTypes = []interface{}{ (*StateRequest)(nil), // 0: ethereum.eth.v1.StateRequest - (*ForkScheduleResponse)(nil), // 1: ethereum.eth.v1.ForkScheduleResponse - (*SpecResponse)(nil), // 2: ethereum.eth.v1.SpecResponse - (*DepositContractResponse)(nil), // 3: ethereum.eth.v1.DepositContractResponse - (*DepositContract)(nil), // 4: ethereum.eth.v1.DepositContract - (*WeakSubjectivityResponse)(nil), // 5: ethereum.eth.v1.WeakSubjectivityResponse - (*WeakSubjectivityData)(nil), // 6: ethereum.eth.v1.WeakSubjectivityData - nil, // 7: ethereum.eth.v1.SpecResponse.DataEntry - (*Fork)(nil), // 8: ethereum.eth.v1.Fork - (*Checkpoint)(nil), // 9: ethereum.eth.v1.Checkpoint + (*WeakSubjectivityResponse)(nil), // 1: ethereum.eth.v1.WeakSubjectivityResponse + (*WeakSubjectivityData)(nil), // 2: ethereum.eth.v1.WeakSubjectivityData + (*Checkpoint)(nil), // 3: ethereum.eth.v1.Checkpoint } var file_proto_eth_v1_beacon_chain_proto_depIdxs = []int32{ - 8, // 0: ethereum.eth.v1.ForkScheduleResponse.data:type_name -> ethereum.eth.v1.Fork - 7, // 1: ethereum.eth.v1.SpecResponse.data:type_name -> ethereum.eth.v1.SpecResponse.DataEntry - 4, // 2: ethereum.eth.v1.DepositContractResponse.data:type_name -> ethereum.eth.v1.DepositContract - 6, // 3: ethereum.eth.v1.WeakSubjectivityResponse.data:type_name -> ethereum.eth.v1.WeakSubjectivityData - 9, // 4: ethereum.eth.v1.WeakSubjectivityData.ws_checkpoint:type_name -> ethereum.eth.v1.Checkpoint - 5, // [5:5] is the sub-list for method output_type - 5, // [5:5] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name + 2, // 0: ethereum.eth.v1.WeakSubjectivityResponse.data:type_name -> ethereum.eth.v1.WeakSubjectivityData + 3, // 1: ethereum.eth.v1.WeakSubjectivityData.ws_checkpoint:type_name -> ethereum.eth.v1.Checkpoint + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name } func init() { file_proto_eth_v1_beacon_chain_proto_init() } @@ -480,7 +251,6 @@ func file_proto_eth_v1_beacon_chain_proto_init() { } file_proto_eth_v1_attestation_proto_init() file_proto_eth_v1_beacon_block_proto_init() - file_proto_eth_v1_beacon_state_proto_init() if !protoimpl.UnsafeEnabled { file_proto_eth_v1_beacon_chain_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StateRequest); i { @@ -495,54 +265,6 @@ func file_proto_eth_v1_beacon_chain_proto_init() { } } file_proto_eth_v1_beacon_chain_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ForkScheduleResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_eth_v1_beacon_chain_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SpecResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_eth_v1_beacon_chain_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DepositContractResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_eth_v1_beacon_chain_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DepositContract); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_eth_v1_beacon_chain_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*WeakSubjectivityResponse); i { case 0: return &v.state @@ -554,7 +276,7 @@ func file_proto_eth_v1_beacon_chain_proto_init() { return nil } } - file_proto_eth_v1_beacon_chain_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_proto_eth_v1_beacon_chain_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*WeakSubjectivityData); i { case 0: return &v.state @@ -573,7 +295,7 @@ func file_proto_eth_v1_beacon_chain_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_proto_eth_v1_beacon_chain_proto_rawDesc, NumEnums: 0, - NumMessages: 8, + NumMessages: 3, NumExtensions: 0, NumServices: 0, }, diff --git a/proto/eth/v1/beacon_chain.proto b/proto/eth/v1/beacon_chain.proto index 641bb694de..333c9911e4 100644 --- a/proto/eth/v1/beacon_chain.proto +++ b/proto/eth/v1/beacon_chain.proto @@ -20,7 +20,6 @@ import "google/protobuf/descriptor.proto"; import "proto/eth/ext/options.proto"; import "proto/eth/v1/attestation.proto"; import "proto/eth/v1/beacon_block.proto"; -import "proto/eth/v1/beacon_state.proto"; option csharp_namespace = "Ethereum.Eth.V1"; option go_package = "github.com/prysmaticlabs/prysm/v4/proto/eth/v1"; @@ -37,33 +36,6 @@ message StateRequest { bytes state_id = 1; } -// Beacon Config API related messages. - -message ForkScheduleResponse { - // The fork data used for beacon chain versioning. - repeated Fork data = 1; -} - -// Spec response is a generic flat map of key values. -// Values are returned with following format: -// - any value starting with 0x in the spec is returned as a hex string -// - all other values are returned as string-number -message SpecResponse { - map data = 1; -} - -message DepositContractResponse { - DepositContract data = 1; -} - -message DepositContract { - // The chain_id of the network. - uint64 chain_id = 1; - - // The address of the deployed deposit contract in use. - string address = 2; -} - // DEPRECATED: GetWeakSubjectivity endpoint is no longer be supported message WeakSubjectivityResponse { option deprecated = true; diff --git a/testing/endtoend/evaluators/beaconapi_evaluators/BUILD.bazel b/testing/endtoend/evaluators/beaconapi_evaluators/BUILD.bazel index 6af600d88b..4212772ab4 100644 --- a/testing/endtoend/evaluators/beaconapi_evaluators/BUILD.bazel +++ b/testing/endtoend/evaluators/beaconapi_evaluators/BUILD.bazel @@ -13,6 +13,7 @@ go_library( deps = [ "//beacon-chain/rpc/apimiddleware:go_default_library", "//beacon-chain/rpc/eth/beacon:go_default_library", + "//beacon-chain/rpc/eth/config:go_default_library", "//beacon-chain/rpc/eth/debug:go_default_library", "//beacon-chain/rpc/eth/node:go_default_library", "//beacon-chain/rpc/eth/validator:go_default_library", diff --git a/testing/endtoend/evaluators/beaconapi_evaluators/beacon_api.go b/testing/endtoend/evaluators/beaconapi_evaluators/beacon_api.go index cf4acc921d..3a9a09df5f 100644 --- a/testing/endtoend/evaluators/beaconapi_evaluators/beacon_api.go +++ b/testing/endtoend/evaluators/beaconapi_evaluators/beacon_api.go @@ -12,6 +12,7 @@ import ( "github.com/pkg/errors" "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/apimiddleware" "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/beacon" + "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/config" "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/debug" "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/node" "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/validator" @@ -381,14 +382,14 @@ var requests = map[string]metadata{ "/config/fork_schedule": { basepath: v1PathTemplate, prysmResps: map[string]interface{}{ - "json": &apimiddleware.ForkScheduleResponseJson{}, + "json": &config.GetForkScheduleResponse{}, }, lighthouseResps: map[string]interface{}{ - "json": &apimiddleware.ForkScheduleResponseJson{}, + "json": &config.GetForkScheduleResponse{}, }, customEvaluation: func(p interface{}, l interface{}) error { // remove all forks with far-future epoch - pSchedule, ok := p.(*apimiddleware.ForkScheduleResponseJson) + pSchedule, ok := p.(*config.GetForkScheduleResponse) if !ok { return errJsonCast } @@ -397,7 +398,7 @@ var requests = map[string]metadata{ pSchedule.Data = append(pSchedule.Data[:i], pSchedule.Data[i+1:]...) } } - lSchedule, ok := l.(*apimiddleware.ForkScheduleResponseJson) + lSchedule, ok := l.(*config.GetForkScheduleResponse) if !ok { return errJsonCast }