From 6a638bd148fa0e10a29eebf5ce6aa304fdd4193a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Kapka?= Date: Wed, 29 Nov 2023 00:20:02 +0100 Subject: [PATCH] HTTP handler for Beacon API events (#13207) * in progress * implementation done * bzl * fixes * tests in progress * tests * go mod tidy * Update beacon-chain/rpc/eth/events/events.go Co-authored-by: Sammy Rosso <15244892+saolyn@users.noreply.github.com> * fix config test * fix unreachable code issue * remove proto service dir * test fix --------- Co-authored-by: Sammy Rosso <15244892+saolyn@users.noreply.github.com> Co-authored-by: james-prysm <90280386+james-prysm@users.noreply.github.com> --- beacon-chain/gateway/BUILD.bazel | 1 - beacon-chain/gateway/helpers.go | 5 +- beacon-chain/gateway/helpers_test.go | 2 +- beacon-chain/rpc/BUILD.bazel | 1 - beacon-chain/rpc/apimiddleware/BUILD.bazel | 7 - .../rpc/apimiddleware/custom_handlers.go | 173 --- .../rpc/apimiddleware/custom_handlers_test.go | 212 ---- .../rpc/apimiddleware/endpoint_factory.go | 12 +- beacon-chain/rpc/apimiddleware/structs.go | 102 -- beacon-chain/rpc/eth/events/BUILD.bazel | 34 +- beacon-chain/rpc/eth/events/events.go | 404 ++++--- beacon-chain/rpc/eth/events/events_test.go | 990 +++++----------- beacon-chain/rpc/eth/events/server.go | 3 - beacon-chain/rpc/eth/events/structs.go | 94 ++ beacon-chain/rpc/eth/shared/structs.go | 27 + beacon-chain/rpc/eth/shared/structs_blocks.go | 18 + beacon-chain/rpc/service.go | 18 +- go.mod | 2 - go.sum | 5 - proto/eth/service/BUILD.bazel | 98 -- proto/eth/service/events_service.pb.go | 209 ---- proto/eth/service/events_service.pb.gw.go | 150 --- proto/eth/service/events_service.proto | 44 - proto/eth/service/key_management.pb.go | 1054 ----------------- proto/eth/service/key_management.pb.gw.go | 317 ----- proto/eth/v1/beacon_chain.pb.go | 3 - proto/eth/v1/events.pb.go | 824 ++----------- proto/eth/v1/events.proto | 72 -- testing/endtoend/BUILD.bazel | 1 - testing/mock/BUILD.bazel | 4 - testing/mock/event_service_mock.go | 302 ----- testing/util/blob.go | 16 + 32 files changed, 826 insertions(+), 4378 deletions(-) delete mode 100644 beacon-chain/rpc/apimiddleware/custom_handlers.go delete mode 100644 beacon-chain/rpc/apimiddleware/custom_handlers_test.go create mode 100644 beacon-chain/rpc/eth/events/structs.go delete mode 100644 proto/eth/service/BUILD.bazel delete mode 100755 proto/eth/service/events_service.pb.go delete mode 100755 proto/eth/service/events_service.pb.gw.go delete mode 100644 proto/eth/service/events_service.proto delete mode 100755 proto/eth/service/key_management.pb.go delete mode 100755 proto/eth/service/key_management.pb.gw.go delete mode 100644 testing/mock/event_service_mock.go diff --git a/beacon-chain/gateway/BUILD.bazel b/beacon-chain/gateway/BUILD.bazel index e228373da..5ea81d383 100644 --- a/beacon-chain/gateway/BUILD.bazel +++ b/beacon-chain/gateway/BUILD.bazel @@ -8,7 +8,6 @@ go_library( deps = [ "//api/gateway:go_default_library", "//cmd/beacon-chain/flags:go_default_library", - "//proto/eth/service:go_default_library", "//proto/prysm/v1alpha1:go_default_library", "@com_github_grpc_ecosystem_grpc_gateway_v2//runtime:go_default_library", "@org_golang_google_protobuf//encoding/protojson:go_default_library", diff --git a/beacon-chain/gateway/helpers.go b/beacon-chain/gateway/helpers.go index 5d1d217ae..b51777b03 100644 --- a/beacon-chain/gateway/helpers.go +++ b/beacon-chain/gateway/helpers.go @@ -4,7 +4,6 @@ import ( gwruntime "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/prysmaticlabs/prysm/v4/api/gateway" "github.com/prysmaticlabs/prysm/v4/cmd/beacon-chain/flags" - ethpbservice "github.com/prysmaticlabs/prysm/v4/proto/eth/service" ethpbalpha "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1" "google.golang.org/protobuf/encoding/protojson" ) @@ -51,9 +50,7 @@ func DefaultConfig(enableDebugRPCEndpoints bool, httpModules string) MuxConfig { } } if flags.EnableHTTPEthAPI(httpModules) { - ethRegistrations := []gateway.PbHandlerRegistration{ - ethpbservice.RegisterEventsHandler, - } + ethRegistrations := []gateway.PbHandlerRegistration{} ethMux := gwruntime.NewServeMux( gwruntime.WithMarshalerOption(gwruntime.MIMEWildcard, &gwruntime.HTTPBodyMarshaler{ Marshaler: &gwruntime.JSONPb{ diff --git a/beacon-chain/gateway/helpers_test.go b/beacon-chain/gateway/helpers_test.go index db892f13b..973c10996 100644 --- a/beacon-chain/gateway/helpers_test.go +++ b/beacon-chain/gateway/helpers_test.go @@ -14,7 +14,7 @@ func TestDefaultConfig(t *testing.T) { assert.NotNil(t, cfg.EthPbMux.Mux) require.Equal(t, 2, len(cfg.EthPbMux.Patterns)) assert.Equal(t, "/internal/eth/v1/", cfg.EthPbMux.Patterns[0]) - assert.Equal(t, 1, len(cfg.EthPbMux.Registrations)) + assert.Equal(t, 0, len(cfg.EthPbMux.Registrations)) assert.Equal(t, (*gateway.PbMux)(nil), cfg.V1AlphaPbMux) }) t.Run("Without Eth API", func(t *testing.T) { diff --git a/beacon-chain/rpc/BUILD.bazel b/beacon-chain/rpc/BUILD.bazel index a7a3833b1..aace3201a 100644 --- a/beacon-chain/rpc/BUILD.bazel +++ b/beacon-chain/rpc/BUILD.bazel @@ -51,7 +51,6 @@ go_library( "//config/params:go_default_library", "//io/logs:go_default_library", "//monitoring/tracing:go_default_library", - "//proto/eth/service:go_default_library", "//proto/prysm/v1alpha1:go_default_library", "@com_github_gorilla_mux//:go_default_library", "@com_github_grpc_ecosystem_go_grpc_middleware//:go_default_library", diff --git a/beacon-chain/rpc/apimiddleware/BUILD.bazel b/beacon-chain/rpc/apimiddleware/BUILD.bazel index 7a504aee0..67777be96 100644 --- a/beacon-chain/rpc/apimiddleware/BUILD.bazel +++ b/beacon-chain/rpc/apimiddleware/BUILD.bazel @@ -3,7 +3,6 @@ load("@prysm//tools/go:def.bzl", "go_library", "go_test") go_library( name = "go_default_library", srcs = [ - "custom_handlers.go", "custom_hooks.go", "endpoint_factory.go", "structs.go", @@ -13,20 +12,16 @@ go_library( visibility = ["//visibility:public"], deps = [ "//api/gateway/apimiddleware:go_default_library", - "//beacon-chain/rpc/eth/events:go_default_library", "//config/params:go_default_library", "//consensus-types/primitives:go_default_library", - "//runtime/version:go_default_library", "//time/slots:go_default_library", "@com_github_pkg_errors//:go_default_library", - "@com_github_r3labs_sse_v2//:go_default_library", ], ) go_test( name = "go_default_test", srcs = [ - "custom_handlers_test.go", "custom_hooks_test.go", "endpoint_factory_test.go", "structs_marshalling_test.go", @@ -34,11 +29,9 @@ go_test( embed = [":go_default_library"], deps = [ "//api/gateway/apimiddleware:go_default_library", - "//beacon-chain/rpc/eth/events:go_default_library", "//config/params:go_default_library", "//testing/assert:go_default_library", "//testing/require:go_default_library", "//time/slots:go_default_library", - "@com_github_r3labs_sse_v2//:go_default_library", ], ) diff --git a/beacon-chain/rpc/apimiddleware/custom_handlers.go b/beacon-chain/rpc/apimiddleware/custom_handlers.go deleted file mode 100644 index 28514e861..000000000 --- a/beacon-chain/rpc/apimiddleware/custom_handlers.go +++ /dev/null @@ -1,173 +0,0 @@ -package apimiddleware - -import ( - "bytes" - "encoding/json" - "errors" - "fmt" - "net/http" - - "github.com/prysmaticlabs/prysm/v4/api/gateway/apimiddleware" - "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/events" - "github.com/prysmaticlabs/prysm/v4/runtime/version" - "github.com/r3labs/sse/v2" -) - -func handleEvents(m *apimiddleware.ApiProxyMiddleware, _ apimiddleware.Endpoint, w http.ResponseWriter, req *http.Request) (handled bool) { - sseClient := sse.NewClient("http://" + m.GatewayAddress + "/internal" + req.URL.RequestURI()) - sseClient.Headers["Grpc-Timeout"] = "0S" - eventChan := make(chan *sse.Event) - - // We use grpc-gateway as the server side of events, not the sse library. - // Because of this subscribing to streams doesn't work as intended, resulting in each event being handled by all subscriptions. - // To handle events properly, we subscribe just once using a placeholder value ('events') and handle all topics inside this subscription. - if err := sseClient.SubscribeChan("events", eventChan); err != nil { - apimiddleware.WriteError(w, apimiddleware.InternalServerError(err), nil) - sseClient.Unsubscribe(eventChan) - return - } - - errJson := receiveEvents(eventChan, w, req) - if errJson != nil { - apimiddleware.WriteError(w, errJson, nil) - } - - sseClient.Unsubscribe(eventChan) - return true -} - -type dataSubset struct { - Version string `json:"version"` -} - -func receiveEvents(eventChan <-chan *sse.Event, w http.ResponseWriter, req *http.Request) apimiddleware.ErrorJson { - for { - select { - case msg := <-eventChan: - var data interface{} - - // The message's event comes to us with trailing whitespace. Remove it here for - // ease of future processing. - msg.Event = bytes.TrimSpace(msg.Event) - - switch string(msg.Event) { - case events.HeadTopic: - data = &EventHeadJson{} - case events.BlockTopic: - data = &ReceivedBlockDataJson{} - case events.AttestationTopic: - data = &AttestationJson{} - - // Data received in the aggregated att event does not fit the expected event stream output. - // We extract the underlying attestation from event data - // and assign the attestation back to event data for further processing. - aggEventData := &AggregatedAttReceivedDataJson{} - if err := json.Unmarshal(msg.Data, aggEventData); err != nil { - return apimiddleware.InternalServerError(err) - } - var attData []byte - var err error - // If true, then we have an unaggregated attestation - if aggEventData.Aggregate == nil { - unaggEventData := &UnaggregatedAttReceivedDataJson{} - if err := json.Unmarshal(msg.Data, unaggEventData); err != nil { - return apimiddleware.InternalServerError(err) - } - attData, err = json.Marshal(unaggEventData) - if err != nil { - return apimiddleware.InternalServerError(err) - } - } else { - attData, err = json.Marshal(aggEventData.Aggregate) - if err != nil { - return apimiddleware.InternalServerError(err) - } - } - msg.Data = attData - case events.VoluntaryExitTopic: - data = &SignedVoluntaryExitJson{} - case events.FinalizedCheckpointTopic: - data = &EventFinalizedCheckpointJson{} - case events.ChainReorgTopic: - data = &EventChainReorgJson{} - case events.SyncCommitteeContributionTopic: - data = &SignedContributionAndProofJson{} - case events.BLSToExecutionChangeTopic: - data = &SignedBLSToExecutionChangeJson{} - case events.PayloadAttributesTopic: - dataSubset := &dataSubset{} - if err := json.Unmarshal(msg.Data, dataSubset); err != nil { - return apimiddleware.InternalServerError(err) - } - switch dataSubset.Version { - case version.String(version.Capella): - data = &EventPayloadAttributeStreamV2Json{} - case version.String(version.Bellatrix): - data = &EventPayloadAttributeStreamV1Json{} - default: - return apimiddleware.InternalServerError(errors.New("payload version unsupported")) - } - case events.BlobSidecarTopic: - data = &EventBlobSidecarJson{} - case "error": - data = &EventErrorJson{} - default: - return &apimiddleware.DefaultErrorJson{ - Message: fmt.Sprintf("Event type '%s' not supported", string(msg.Event)), - Code: http.StatusInternalServerError, - } - } - - if errJson := writeEvent(msg, w, data); errJson != nil { - return errJson - } - if errJson := flushEvent(w); errJson != nil { - return errJson - } - case <-req.Context().Done(): - return nil - } - } -} - -func writeEvent(msg *sse.Event, w http.ResponseWriter, data interface{}) apimiddleware.ErrorJson { - if err := json.Unmarshal(msg.Data, data); err != nil { - return apimiddleware.InternalServerError(err) - } - if errJson := apimiddleware.ProcessMiddlewareResponseFields(data); errJson != nil { - return errJson - } - dataJson, errJson := apimiddleware.SerializeMiddlewareResponseIntoJson(data) - if errJson != nil { - return errJson - } - - w.Header().Set("Content-Type", "text/event-stream") - - if _, err := w.Write([]byte("event: ")); err != nil { - return apimiddleware.InternalServerError(err) - } - if _, err := w.Write(msg.Event); err != nil { - return apimiddleware.InternalServerError(err) - } - if _, err := w.Write([]byte("\ndata: ")); err != nil { - return apimiddleware.InternalServerError(err) - } - if _, err := w.Write(dataJson); err != nil { - return apimiddleware.InternalServerError(err) - } - if _, err := w.Write([]byte("\n\n")); err != nil { - return apimiddleware.InternalServerError(err) - } - - return nil -} - -func flushEvent(w http.ResponseWriter) apimiddleware.ErrorJson { - flusher, ok := w.(http.Flusher) - if !ok { - return &apimiddleware.DefaultErrorJson{Message: fmt.Sprintf("Flush not supported in %T", w), Code: http.StatusInternalServerError} - } - flusher.Flush() - return nil -} diff --git a/beacon-chain/rpc/apimiddleware/custom_handlers_test.go b/beacon-chain/rpc/apimiddleware/custom_handlers_test.go deleted file mode 100644 index ee689939c..000000000 --- a/beacon-chain/rpc/apimiddleware/custom_handlers_test.go +++ /dev/null @@ -1,212 +0,0 @@ -package apimiddleware - -import ( - "bytes" - "context" - "encoding/json" - "net/http/httptest" - "testing" - "time" - - "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/events" - "github.com/prysmaticlabs/prysm/v4/testing/assert" - "github.com/prysmaticlabs/prysm/v4/testing/require" - "github.com/r3labs/sse/v2" -) - -func TestReceiveEvents(t *testing.T) { - ctx, cancel := context.WithCancel(context.Background()) - ch := make(chan *sse.Event) - w := httptest.NewRecorder() - w.Body = &bytes.Buffer{} - req := httptest.NewRequest("GET", "http://foo.example", &bytes.Buffer{}) - req = req.WithContext(ctx) - - go func() { - base64Val := "Zm9v" - data := &EventFinalizedCheckpointJson{ - Block: base64Val, - State: base64Val, - Epoch: "1", - } - bData, err := json.Marshal(data) - require.NoError(t, err) - msg := &sse.Event{ - Data: bData, - Event: []byte(events.FinalizedCheckpointTopic), - } - ch <- msg - time.Sleep(time.Second) - cancel() - }() - - errJson := receiveEvents(ch, w, req) - assert.Equal(t, true, errJson == nil) - - expectedEvent := `event: finalized_checkpoint -data: {"block":"0x666f6f","state":"0x666f6f","epoch":"1","execution_optimistic":false} - -` - assert.DeepEqual(t, expectedEvent, w.Body.String()) -} - -func TestReceiveEvents_AggregatedAtt(t *testing.T) { - ctx, cancel := context.WithCancel(context.Background()) - ch := make(chan *sse.Event) - w := httptest.NewRecorder() - w.Body = &bytes.Buffer{} - req := httptest.NewRequest("GET", "http://foo.example", &bytes.Buffer{}) - req = req.WithContext(ctx) - - go func() { - base64Val := "Zm9v" - data := AggregatedAttReceivedDataJson{ - Aggregate: &AttestationJson{ - AggregationBits: base64Val, - Data: &AttestationDataJson{ - Slot: "1", - CommitteeIndex: "1", - BeaconBlockRoot: base64Val, - Source: nil, - Target: nil, - }, - Signature: base64Val, - }, - } - bData, err := json.Marshal(data) - require.NoError(t, err) - msg := &sse.Event{ - Data: bData, - Event: []byte(events.AttestationTopic), - } - ch <- msg - time.Sleep(time.Second) - cancel() - }() - - errJson := receiveEvents(ch, w, req) - assert.Equal(t, true, errJson == nil) - - expectedEvent := `event: attestation -data: {"aggregation_bits":"0x666f6f","data":{"slot":"1","index":"1","beacon_block_root":"0x666f6f","source":null,"target":null},"signature":"0x666f6f"} - -` - assert.DeepEqual(t, expectedEvent, w.Body.String()) -} - -func TestReceiveEvents_UnaggregatedAtt(t *testing.T) { - ctx, cancel := context.WithCancel(context.Background()) - ch := make(chan *sse.Event) - w := httptest.NewRecorder() - w.Body = &bytes.Buffer{} - req := httptest.NewRequest("GET", "http://foo.example", &bytes.Buffer{}) - req = req.WithContext(ctx) - - go func() { - base64Val := "Zm9v" - data := UnaggregatedAttReceivedDataJson{ - AggregationBits: base64Val, - Data: &AttestationDataJson{ - Slot: "1", - CommitteeIndex: "1", - BeaconBlockRoot: base64Val, - Source: nil, - Target: nil, - }, - Signature: base64Val, - } - bData, err := json.Marshal(data) - require.NoError(t, err) - msg := &sse.Event{ - Data: bData, - Event: []byte(events.AttestationTopic), - } - ch <- msg - time.Sleep(time.Second) - cancel() - }() - - errJson := receiveEvents(ch, w, req) - assert.Equal(t, true, errJson == nil) - - expectedEvent := `event: attestation -data: {"aggregation_bits":"0x666f6f","data":{"slot":"1","index":"1","beacon_block_root":"0x666f6f","source":null,"target":null},"signature":"0x666f6f"} - -` - assert.DeepEqual(t, expectedEvent, w.Body.String()) -} - -func TestReceiveEvents_EventNotSupported(t *testing.T) { - ch := make(chan *sse.Event) - w := httptest.NewRecorder() - w.Body = &bytes.Buffer{} - req := httptest.NewRequest("GET", "http://foo.example", &bytes.Buffer{}) - - go func() { - msg := &sse.Event{ - Data: []byte("foo"), - Event: []byte("not_supported"), - } - ch <- msg - }() - - errJson := receiveEvents(ch, w, req) - require.NotNil(t, errJson) - assert.Equal(t, "Event type 'not_supported' not supported", errJson.Msg()) -} - -func TestReceiveEvents_TrailingSpace(t *testing.T) { - ctx, cancel := context.WithCancel(context.Background()) - ch := make(chan *sse.Event) - w := httptest.NewRecorder() - w.Body = &bytes.Buffer{} - req := httptest.NewRequest("GET", "http://foo.example", &bytes.Buffer{}) - req = req.WithContext(ctx) - - go func() { - base64Val := "Zm9v" - data := &EventFinalizedCheckpointJson{ - Block: base64Val, - State: base64Val, - Epoch: "1", - } - bData, err := json.Marshal(data) - require.NoError(t, err) - msg := &sse.Event{ - Data: bData, - Event: []byte("finalized_checkpoint "), - } - ch <- msg - time.Sleep(time.Second) - cancel() - }() - - errJson := receiveEvents(ch, w, req) - assert.Equal(t, true, errJson == nil) - assert.Equal(t, `event: finalized_checkpoint -data: {"block":"0x666f6f","state":"0x666f6f","epoch":"1","execution_optimistic":false} - -`, w.Body.String()) -} - -func TestWriteEvent(t *testing.T) { - base64Val := "Zm9v" - data := &EventFinalizedCheckpointJson{ - Block: base64Val, - State: base64Val, - Epoch: "1", - } - bData, err := json.Marshal(data) - require.NoError(t, err) - msg := &sse.Event{ - Data: bData, - Event: []byte("test_event"), - } - w := httptest.NewRecorder() - w.Body = &bytes.Buffer{} - - errJson := writeEvent(msg, w, &EventFinalizedCheckpointJson{}) - require.Equal(t, true, errJson == nil) - written := w.Body.String() - assert.Equal(t, "event: test_event\ndata: {\"block\":\"0x666f6f\",\"state\":\"0x666f6f\",\"epoch\":\"1\",\"execution_optimistic\":false}\n\n", written) -} diff --git a/beacon-chain/rpc/apimiddleware/endpoint_factory.go b/beacon-chain/rpc/apimiddleware/endpoint_factory.go index 2627981c0..5ce7800ce 100644 --- a/beacon-chain/rpc/apimiddleware/endpoint_factory.go +++ b/beacon-chain/rpc/apimiddleware/endpoint_factory.go @@ -1,7 +1,6 @@ package apimiddleware import ( - "github.com/pkg/errors" "github.com/prysmaticlabs/prysm/v4/api/gateway/apimiddleware" ) @@ -15,21 +14,12 @@ func (f *BeaconEndpointFactory) IsNil() bool { // Paths is a collection of all valid beacon chain API paths. func (_ *BeaconEndpointFactory) Paths() []string { - return []string{ - "/eth/v1/events", - } + return []string{} } // Create returns a new endpoint for the provided API path. func (_ *BeaconEndpointFactory) Create(path string) (*apimiddleware.Endpoint, error) { endpoint := apimiddleware.DefaultEndpoint() - switch path { - case "/eth/v1/events": - endpoint.CustomHandlers = []apimiddleware.CustomHandler{handleEvents} - default: - return nil, errors.New("invalid path") - } - endpoint.Path = path return &endpoint, nil } diff --git a/beacon-chain/rpc/apimiddleware/structs.go b/beacon-chain/rpc/apimiddleware/structs.go index eda5161a1..bd7612426 100644 --- a/beacon-chain/rpc/apimiddleware/structs.go +++ b/beacon-chain/rpc/apimiddleware/structs.go @@ -651,103 +651,6 @@ type SszResponse interface { SSZFinalized() bool } -// --------------- -// Events. -// --------------- - -type EventHeadJson struct { - Slot string `json:"slot"` - Block string `json:"block" hex:"true"` - State string `json:"state" hex:"true"` - EpochTransition bool `json:"epoch_transition"` - ExecutionOptimistic bool `json:"execution_optimistic"` - PreviousDutyDependentRoot string `json:"previous_duty_dependent_root" hex:"true"` - CurrentDutyDependentRoot string `json:"current_duty_dependent_root" hex:"true"` -} - -type ReceivedBlockDataJson struct { - Slot string `json:"slot"` - Block string `json:"block" hex:"true"` - ExecutionOptimistic bool `json:"execution_optimistic"` -} - -type AggregatedAttReceivedDataJson struct { - Aggregate *AttestationJson `json:"aggregate"` -} - -type UnaggregatedAttReceivedDataJson struct { - AggregationBits string `json:"aggregation_bits" hex:"true"` - Data *AttestationDataJson `json:"data"` - Signature string `json:"signature" hex:"true"` -} - -type EventFinalizedCheckpointJson struct { - Block string `json:"block" hex:"true"` - State string `json:"state" hex:"true"` - Epoch string `json:"epoch"` - ExecutionOptimistic bool `json:"execution_optimistic"` -} - -type EventChainReorgJson struct { - Slot string `json:"slot"` - Depth string `json:"depth"` - OldHeadBlock string `json:"old_head_block" hex:"true"` - NewHeadBlock string `json:"old_head_state" hex:"true"` - OldHeadState string `json:"new_head_block" hex:"true"` - NewHeadState string `json:"new_head_state" hex:"true"` - Epoch string `json:"epoch"` - ExecutionOptimistic bool `json:"execution_optimistic"` -} - -type EventPayloadAttributeStreamV1Json struct { - Version string `json:"version"` - Data *EventPayloadAttributeV1Json -} - -type EventPayloadAttributeStreamV2Json struct { - Version string `json:"version"` - Data *EventPayloadAttributeV2Json `json:"data"` -} - -type EventPayloadAttributeV1Json struct { - ProposerIndex string `json:"proposer_index"` - ProposalSlot string `json:"proposal_slot"` - ParentBlockNumber string `json:"parent_block_number"` - ParentBlockRoot string `json:"parent_block_root" hex:"true"` - ParentBlockHash string `json:"parent_block_hash" hex:"true"` - PayloadAttributes *PayloadAttributesV1Json `json:"payload_attributes"` -} - -type EventPayloadAttributeV2Json struct { - ProposerIndex string `json:"proposer_index"` - ProposalSlot string `json:"proposal_slot"` - ParentBlockNumber string `json:"parent_block_number"` - ParentBlockRoot string `json:"parent_block_root" hex:"true"` - ParentBlockHash string `json:"parent_block_hash" hex:"true"` - PayloadAttributes *PayloadAttributesV2Json `json:"payload_attributes"` -} - -type PayloadAttributesV1Json struct { - Timestamp string `json:"timestamp"` - Random string `json:"prev_randao" hex:"true"` - SuggestedFeeRecipient string `json:"suggested_fee_recipient" hex:"true"` -} - -type PayloadAttributesV2Json struct { - Timestamp string `json:"timestamp"` - Random string `json:"prev_randao" hex:"true"` - SuggestedFeeRecipient string `json:"suggested_fee_recipient" hex:"true"` - Withdrawals []*WithdrawalJson `json:"withdrawals"` -} - -type EventBlobSidecarJson struct { - BlockRoot string `json:"block_root" hex:"true"` - Index string `json:"index"` - Slot string `json:"slot"` - KzgCommitment string `json:"kzg_commitment" hex:"true"` - VersionedHash string `json:"versioned_hash" hex:"true"` -} - // --------------- // Error handling. // --------------- @@ -763,8 +666,3 @@ type SingleIndexedVerificationFailureJson struct { Index int `json:"index"` Message string `json:"message"` } - -type EventErrorJson struct { - StatusCode int `json:"status_code"` - Message string `json:"message"` -} diff --git a/beacon-chain/rpc/eth/events/BUILD.bazel b/beacon-chain/rpc/eth/events/BUILD.bazel index 54ead4b15..ef610f93d 100644 --- a/beacon-chain/rpc/eth/events/BUILD.bazel +++ b/beacon-chain/rpc/eth/events/BUILD.bazel @@ -5,6 +5,7 @@ go_library( srcs = [ "events.go", "server.go", + "structs.go", ], importpath = "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/events", visibility = ["//beacon-chain:__subpackages__"], @@ -16,20 +17,14 @@ go_library( "//beacon-chain/core/helpers:go_default_library", "//beacon-chain/core/time:go_default_library", "//beacon-chain/core/transition:go_default_library", - "//encoding/bytesutil:go_default_library", - "//proto/engine/v1:go_default_library", - "//proto/eth/service:go_default_library", + "//beacon-chain/rpc/eth/shared:go_default_library", + "//network/http:go_default_library", "//proto/eth/v1:go_default_library", - "//proto/migration:go_default_library", "//runtime/version:go_default_library", "//time/slots:go_default_library", - "@com_github_grpc_ecosystem_grpc_gateway_v2//proto/gateway:go_default_library", - "@com_github_pkg_errors//:go_default_library", + "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", - "@org_golang_google_grpc//codes:go_default_library", - "@org_golang_google_grpc//status:go_default_library", - "@org_golang_google_protobuf//proto:go_default_library", - "@org_golang_google_protobuf//types/known/anypb:go_default_library", + "@io_opencensus_go//trace:go_default_library", ], ) @@ -38,31 +33,18 @@ go_test( srcs = ["events_test.go"], embed = [":go_default_library"], deps = [ - "//async/event:go_default_library", - "//beacon-chain/blockchain:go_default_library", "//beacon-chain/blockchain/testing:go_default_library", - "//beacon-chain/core/blocks:go_default_library", "//beacon-chain/core/feed:go_default_library", "//beacon-chain/core/feed/operation:go_default_library", "//beacon-chain/core/feed/state:go_default_library", - "//beacon-chain/core/helpers:go_default_library", - "//beacon-chain/core/time:go_default_library", - "//config/fieldparams:go_default_library", + "//beacon-chain/state:go_default_library", "//consensus-types/blocks:go_default_library", - "//encoding/bytesutil:go_default_library", - "//proto/engine/v1:go_default_library", + "//consensus-types/interfaces:go_default_library", + "//consensus-types/primitives:go_default_library", "//proto/eth/v1:go_default_library", - "//proto/migration:go_default_library", "//proto/prysm/v1alpha1:go_default_library", - "//runtime/version:go_default_library", "//testing/assert:go_default_library", - "//testing/mock:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", - "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", - "@com_github_golang_mock//gomock:go_default_library", - "@com_github_grpc_ecosystem_grpc_gateway_v2//proto/gateway:go_default_library", - "@com_github_prysmaticlabs_go_bitfield//:go_default_library", - "@org_golang_google_protobuf//types/known/anypb:go_default_library", ], ) diff --git a/beacon-chain/rpc/eth/events/events.go b/beacon-chain/rpc/eth/events/events.go index 4ff128e80..2eff523dc 100644 --- a/beacon-chain/rpc/eth/events/events.go +++ b/beacon-chain/rpc/eth/events/events.go @@ -1,10 +1,12 @@ package events import ( - "strings" + "context" + "encoding/json" + "fmt" + "net/http" - gwpb "github.com/grpc-ecosystem/grpc-gateway/v2/proto/gateway" - "github.com/pkg/errors" + "github.com/ethereum/go-ethereum/common/hexutil" "github.com/prysmaticlabs/prysm/v4/beacon-chain/blockchain" "github.com/prysmaticlabs/prysm/v4/beacon-chain/core/feed" "github.com/prysmaticlabs/prysm/v4/beacon-chain/core/feed/operation" @@ -12,18 +14,13 @@ import ( "github.com/prysmaticlabs/prysm/v4/beacon-chain/core/helpers" "github.com/prysmaticlabs/prysm/v4/beacon-chain/core/time" "github.com/prysmaticlabs/prysm/v4/beacon-chain/core/transition" - "github.com/prysmaticlabs/prysm/v4/encoding/bytesutil" - enginev1 "github.com/prysmaticlabs/prysm/v4/proto/engine/v1" - ethpbservice "github.com/prysmaticlabs/prysm/v4/proto/eth/service" + "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared" + http2 "github.com/prysmaticlabs/prysm/v4/network/http" ethpb "github.com/prysmaticlabs/prysm/v4/proto/eth/v1" - "github.com/prysmaticlabs/prysm/v4/proto/migration" "github.com/prysmaticlabs/prysm/v4/runtime/version" "github.com/prysmaticlabs/prysm/v4/time/slots" log "github.com/sirupsen/logrus" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/types/known/anypb" + "go.opencensus.io/trace" ) const ( @@ -49,6 +46,8 @@ const ( BlobSidecarTopic = "blob_sidecar" ) +const topicDataMismatch = "Event data type %T does not correspond to event topic %s" + var casesHandled = map[string]bool{ HeadTopic: true, BlockTopic: true, @@ -62,300 +61,357 @@ var casesHandled = map[string]bool{ BlobSidecarTopic: true, } -// StreamEvents allows requesting all events from a set of topics defined in the Ethereum consensus API standard. -// The topics supported include block events, attestations, chain reorgs, voluntary exits, -// chain finality, and more. -func (s *Server) StreamEvents( - req *ethpb.StreamEventsRequest, stream ethpbservice.Events_StreamEventsServer, -) error { - if req == nil || len(req.Topics) == 0 { - return status.Error(codes.InvalidArgument, "No topics specified to subscribe to") +// StreamEvents provides an endpoint to subscribe to the beacon node Server-Sent-Events stream. +// Consumers should use the eventsource implementation to listen for those events. +// Servers may send SSE comments beginning with ':' for any purpose, +// including to keep the event stream connection alive in the presence of proxy servers. +func (s *Server) StreamEvents(w http.ResponseWriter, r *http.Request) { + ctx, span := trace.StartSpan(r.Context(), "events.StreamEvents") + defer span.End() + + flusher, ok := w.(http.Flusher) + if !ok { + http2.HandleError(w, "Streaming unsupported!", http.StatusInternalServerError) + return } - // Check if the topics in the request are valid. - requestedTopics := make(map[string]bool) - for _, rawTopic := range req.Topics { - splitTopic := strings.Split(rawTopic, ",") - for _, topic := range splitTopic { - if _, ok := casesHandled[topic]; !ok { - return status.Errorf(codes.InvalidArgument, "Topic %s not allowed for event subscriptions", topic) - } - requestedTopics[topic] = true + + topics := r.URL.Query()["topics"] + if len(topics) == 0 { + http2.HandleError(w, "No topics specified to subscribe to", http.StatusBadRequest) + return + } + topicsMap := make(map[string]bool) + for _, topic := range topics { + if _, ok := casesHandled[topic]; !ok { + http2.HandleError(w, fmt.Sprintf("Invalid topic: %s", topic), http.StatusBadRequest) + return } + topicsMap[topic] = true } // Subscribe to event feeds from information received in the beacon node runtime. opsChan := make(chan *feed.Event, 1) opsSub := s.OperationNotifier.OperationFeed().Subscribe(opsChan) - stateChan := make(chan *feed.Event, 1) stateSub := s.StateNotifier.StateFeed().Subscribe(stateChan) - defer opsSub.Unsubscribe() defer stateSub.Unsubscribe() - // Handle each event received and context cancelation. + // Set up SSE response headers + w.Header().Set("Content-Type", "text/event-stream") + w.Header().Set("Connection", "keep-alive") + + // Handle each event received and context cancellation. for { select { case event := <-opsChan: - if err := handleBlockOperationEvents(stream, requestedTopics, event); err != nil { - return status.Errorf(codes.Internal, "Could not handle block operations event: %v", err) - } + handleBlockOperationEvents(w, flusher, topicsMap, event) case event := <-stateChan: - if err := s.handleStateEvents(stream, requestedTopics, event); err != nil { - return status.Errorf(codes.Internal, "Could not handle state event: %v", err) - } - case <-s.Ctx.Done(): - return status.Errorf(codes.Canceled, "Context canceled") - case <-stream.Context().Done(): - return status.Errorf(codes.Canceled, "Context canceled") + s.handleStateEvents(ctx, w, flusher, topicsMap, event) + case <-ctx.Done(): + return } } } -func handleBlockOperationEvents( - stream ethpbservice.Events_StreamEventsServer, requestedTopics map[string]bool, event *feed.Event, -) error { +func handleBlockOperationEvents(w http.ResponseWriter, flusher http.Flusher, requestedTopics map[string]bool, event *feed.Event) { switch event.Type { case operation.AggregatedAttReceived: if _, ok := requestedTopics[AttestationTopic]; !ok { - return nil + return } attData, ok := event.Data.(*operation.AggregatedAttReceivedData) if !ok { - return nil + write(w, flusher, topicDataMismatch, event.Data, AttestationTopic) + return } - v1Data := migration.V1Alpha1AggregateAttAndProofToV1(attData.Attestation) - return streamData(stream, AttestationTopic, v1Data) + att := shared.AttestationFromConsensus(attData.Attestation.Aggregate) + send(w, flusher, AttestationTopic, att) case operation.UnaggregatedAttReceived: if _, ok := requestedTopics[AttestationTopic]; !ok { - return nil + return } attData, ok := event.Data.(*operation.UnAggregatedAttReceivedData) if !ok { - return nil + write(w, flusher, topicDataMismatch, event.Data, AttestationTopic) + return } - v1Data := migration.V1Alpha1AttestationToV1(attData.Attestation) - return streamData(stream, AttestationTopic, v1Data) + att := shared.AttestationFromConsensus(attData.Attestation) + send(w, flusher, AttestationTopic, att) case operation.ExitReceived: if _, ok := requestedTopics[VoluntaryExitTopic]; !ok { - return nil + return } exitData, ok := event.Data.(*operation.ExitReceivedData) if !ok { - return nil + write(w, flusher, topicDataMismatch, event.Data, VoluntaryExitTopic) + return } - v1Data := migration.V1Alpha1ExitToV1(exitData.Exit) - return streamData(stream, VoluntaryExitTopic, v1Data) + exit := shared.SignedVoluntaryExitFromConsensus(exitData.Exit) + send(w, flusher, VoluntaryExitTopic, exit) case operation.SyncCommitteeContributionReceived: if _, ok := requestedTopics[SyncCommitteeContributionTopic]; !ok { - return nil + return } contributionData, ok := event.Data.(*operation.SyncCommitteeContributionReceivedData) if !ok { - return nil + write(w, flusher, topicDataMismatch, event.Data, SyncCommitteeContributionTopic) + return } - v2Data := migration.V1Alpha1SignedContributionAndProofToV2(contributionData.Contribution) - return streamData(stream, SyncCommitteeContributionTopic, v2Data) + contribution := shared.SignedContributionAndProofFromConsensus(contributionData.Contribution) + send(w, flusher, SyncCommitteeContributionTopic, contribution) case operation.BLSToExecutionChangeReceived: if _, ok := requestedTopics[BLSToExecutionChangeTopic]; !ok { - return nil + return } changeData, ok := event.Data.(*operation.BLSToExecutionChangeReceivedData) if !ok { - return nil + write(w, flusher, topicDataMismatch, event.Data, BLSToExecutionChangeTopic) + return } - v2Change := migration.V1Alpha1SignedBLSToExecChangeToV2(changeData.Change) - return streamData(stream, BLSToExecutionChangeTopic, v2Change) + change, err := shared.SignedBlsToExecutionChangeFromConsensus(changeData.Change) + if err != nil { + write(w, flusher, err.Error()) + return + } + send(w, flusher, BLSToExecutionChangeTopic, change) case operation.BlobSidecarReceived: if _, ok := requestedTopics[BlobSidecarTopic]; !ok { - return nil + return } blobData, ok := event.Data.(*operation.BlobSidecarReceivedData) if !ok { - return nil - } - if blobData == nil || blobData.Blob == nil { - return nil + write(w, flusher, topicDataMismatch, event.Data, BlobSidecarTopic) + return } versionedHash := blockchain.ConvertKzgCommitmentToVersionedHash(blobData.Blob.Message.KzgCommitment) - blobEvent := ðpb.EventBlobSidecar{ - BlockRoot: bytesutil.SafeCopyBytes(blobData.Blob.Message.BlockRoot), - Index: blobData.Blob.Message.Index, - Slot: blobData.Blob.Message.Slot, - VersionedHash: bytesutil.SafeCopyBytes(versionedHash.Bytes()), - KzgCommitment: bytesutil.SafeCopyBytes(blobData.Blob.Message.KzgCommitment), + blobEvent := &BlobSidecarEvent{ + BlockRoot: hexutil.Encode(blobData.Blob.Message.BlockRoot), + Index: fmt.Sprintf("%d", blobData.Blob.Message.Index), + Slot: fmt.Sprintf("%d", blobData.Blob.Message.Slot), + VersionedHash: versionedHash.String(), + KzgCommitment: hexutil.Encode(blobData.Blob.Message.KzgCommitment), } - return streamData(stream, BlobSidecarTopic, blobEvent) - default: - return nil + send(w, flusher, BlobSidecarTopic, blobEvent) } } -func (s *Server) handleStateEvents( - stream ethpbservice.Events_StreamEventsServer, requestedTopics map[string]bool, event *feed.Event, -) error { +func (s *Server) handleStateEvents(ctx context.Context, w http.ResponseWriter, flusher http.Flusher, requestedTopics map[string]bool, event *feed.Event) { switch event.Type { case statefeed.NewHead: if _, ok := requestedTopics[HeadTopic]; ok { - head, ok := event.Data.(*ethpb.EventHead) + headData, ok := event.Data.(*ethpb.EventHead) if !ok { - return nil + write(w, flusher, topicDataMismatch, event.Data, HeadTopic) + return } - return streamData(stream, HeadTopic, head) + head := &HeadEvent{ + Slot: fmt.Sprintf("%d", headData.Slot), + Block: hexutil.Encode(headData.Block), + State: hexutil.Encode(headData.State), + EpochTransition: headData.EpochTransition, + ExecutionOptimistic: headData.ExecutionOptimistic, + PreviousDutyDependentRoot: hexutil.Encode(headData.PreviousDutyDependentRoot), + CurrentDutyDependentRoot: hexutil.Encode(headData.CurrentDutyDependentRoot), + } + send(w, flusher, HeadTopic, head) } if _, ok := requestedTopics[PayloadAttributesTopic]; ok { - if err := s.streamPayloadAttributes(stream); err != nil { - log.WithError(err).Error("Unable to obtain stream payload attributes") - } - return nil + s.sendPayloadAttributes(ctx, w, flusher) } - return nil case statefeed.MissedSlot: if _, ok := requestedTopics[PayloadAttributesTopic]; ok { - if err := s.streamPayloadAttributes(stream); err != nil { - log.WithError(err).Error("Unable to obtain stream payload attributes") - } - return nil + s.sendPayloadAttributes(ctx, w, flusher) } - return nil case statefeed.FinalizedCheckpoint: if _, ok := requestedTopics[FinalizedCheckpointTopic]; !ok { - return nil + return } - finalizedCheckpoint, ok := event.Data.(*ethpb.EventFinalizedCheckpoint) + checkpointData, ok := event.Data.(*ethpb.EventFinalizedCheckpoint) if !ok { - return nil + write(w, flusher, topicDataMismatch, event.Data, FinalizedCheckpointTopic) + return } - return streamData(stream, FinalizedCheckpointTopic, finalizedCheckpoint) + checkpoint := &FinalizedCheckpointEvent{ + Block: hexutil.Encode(checkpointData.Block), + State: hexutil.Encode(checkpointData.State), + Epoch: fmt.Sprintf("%d", checkpointData.Epoch), + ExecutionOptimistic: checkpointData.ExecutionOptimistic, + } + send(w, flusher, FinalizedCheckpointTopic, checkpoint) case statefeed.Reorg: if _, ok := requestedTopics[ChainReorgTopic]; !ok { - return nil + return } - reorg, ok := event.Data.(*ethpb.EventChainReorg) + reorgData, ok := event.Data.(*ethpb.EventChainReorg) if !ok { - return nil + write(w, flusher, topicDataMismatch, event.Data, ChainReorgTopic) + return } - return streamData(stream, ChainReorgTopic, reorg) + reorg := &ChainReorgEvent{ + Slot: fmt.Sprintf("%d", reorgData.Slot), + Depth: fmt.Sprintf("%d", reorgData.Depth), + OldHeadBlock: hexutil.Encode(reorgData.OldHeadBlock), + NewHeadBlock: hexutil.Encode(reorgData.NewHeadBlock), + OldHeadState: hexutil.Encode(reorgData.OldHeadState), + NewHeadState: hexutil.Encode(reorgData.NewHeadState), + Epoch: fmt.Sprintf("%d", reorgData.Epoch), + ExecutionOptimistic: reorgData.ExecutionOptimistic, + } + send(w, flusher, ChainReorgTopic, reorg) case statefeed.BlockProcessed: if _, ok := requestedTopics[BlockTopic]; !ok { - return nil + return } blkData, ok := event.Data.(*statefeed.BlockProcessedData) if !ok { - return nil + write(w, flusher, topicDataMismatch, event.Data, BlockTopic) + return } - v1Data, err := migration.BlockIfaceToV1BlockHeader(blkData.SignedBlock) + blockRoot, err := blkData.SignedBlock.Block().HashTreeRoot() if err != nil { - return err + write(w, flusher, "Could not get block root: "+err.Error()) + return } - item, err := v1Data.Message.HashTreeRoot() - if err != nil { - return errors.Wrap(err, "could not hash tree root block") - } - eventBlock := ðpb.EventBlock{ - Slot: blkData.Slot, - Block: item[:], + blk := &BlockEvent{ + Slot: fmt.Sprintf("%d", blkData.Slot), + Block: hexutil.Encode(blockRoot[:]), ExecutionOptimistic: blkData.Optimistic, } - return streamData(stream, BlockTopic, eventBlock) - default: - return nil + send(w, flusher, BlockTopic, blk) } } -// streamPayloadAttributes on new head event. // This event stream is intended to be used by builders and relays. -// parent_ fields are based on state at N_{current_slot}, while the rest of fields are based on state of N_{current_slot + 1} -func (s *Server) streamPayloadAttributes(stream ethpbservice.Events_StreamEventsServer) error { - headRoot, err := s.HeadFetcher.HeadRoot(s.Ctx) +// Parent fields are based on state at N_{current_slot}, while the rest of fields are based on state of N_{current_slot + 1} +func (s *Server) sendPayloadAttributes(ctx context.Context, w http.ResponseWriter, flusher http.Flusher) { + headRoot, err := s.HeadFetcher.HeadRoot(ctx) if err != nil { - return errors.Wrap(err, "could not get head root") + write(w, flusher, "Could not get head root: "+err.Error()) + return } - st, err := s.HeadFetcher.HeadState(s.Ctx) + st, err := s.HeadFetcher.HeadState(ctx) if err != nil { - return errors.Wrap(err, "could not get head state") + write(w, flusher, "Could not get head state: "+err.Error()) + return } - // advance the headstate - headState, err := transition.ProcessSlotsIfPossible(s.Ctx, st, s.ChainInfoFetcher.CurrentSlot()+1) + // advance the head state + headState, err := transition.ProcessSlotsIfPossible(ctx, st, s.ChainInfoFetcher.CurrentSlot()+1) if err != nil { - return err + write(w, flusher, "Could not advance head state: "+err.Error()) + return } - headBlock, err := s.HeadFetcher.HeadBlock(s.Ctx) + headBlock, err := s.HeadFetcher.HeadBlock(ctx) if err != nil { - return err + write(w, flusher, "Could not get head block: "+err.Error()) + return } headPayload, err := headBlock.Block().Body().Execution() if err != nil { - return err + write(w, flusher, "Could not get execution payload: "+err.Error()) + return } t, err := slots.ToTime(headState.GenesisTime(), headState.Slot()) if err != nil { - return err + write(w, flusher, "Could not get head state slot time: "+err.Error()) + return } prevRando, err := helpers.RandaoMix(headState, time.CurrentEpoch(headState)) if err != nil { - return err + write(w, flusher, "Could not get head state randao mix: "+err.Error()) + return } - proposerIndex, err := helpers.BeaconProposerIndex(s.Ctx, headState) + proposerIndex, err := helpers.BeaconProposerIndex(ctx, headState) if err != nil { - return err + write(w, flusher, "Could not get head state proposer index: "+err.Error()) + return } + var attributes interface{} switch headState.Version() { case version.Bellatrix: - return streamData(stream, PayloadAttributesTopic, ðpb.EventPayloadAttributeV1{ - Version: version.String(headState.Version()), - Data: ðpb.EventPayloadAttributeV1_BasePayloadAttribute{ - ProposerIndex: proposerIndex, - ProposalSlot: headState.Slot(), - ParentBlockNumber: headPayload.BlockNumber(), - ParentBlockRoot: headRoot, - ParentBlockHash: headPayload.BlockHash(), - PayloadAttributes: &enginev1.PayloadAttributes{ - Timestamp: uint64(t.Unix()), - PrevRandao: prevRando, - SuggestedFeeRecipient: headPayload.FeeRecipient(), - }, - }, - }) - case version.Capella, version.Deneb: + attributes = &PayloadAttributesV1{ + Timestamp: fmt.Sprintf("%d", t.Unix()), + PrevRandao: hexutil.Encode(prevRando), + SuggestedFeeRecipient: hexutil.Encode(headPayload.FeeRecipient()), + } + case version.Capella: withdrawals, err := headState.ExpectedWithdrawals() if err != nil { - return err + write(w, flusher, "Could not get head state expected withdrawals: "+err.Error()) + return + } + attributes = &PayloadAttributesV2{ + Timestamp: fmt.Sprintf("%d", t.Unix()), + PrevRandao: hexutil.Encode(prevRando), + SuggestedFeeRecipient: hexutil.Encode(headPayload.FeeRecipient()), + Withdrawals: shared.WithdrawalsFromConsensus(withdrawals), + } + case version.Deneb: + withdrawals, err := headState.ExpectedWithdrawals() + if err != nil { + write(w, flusher, "Could not get head state expected withdrawals: "+err.Error()) + return + } + parentRoot, err := headBlock.Block().HashTreeRoot() + if err != nil { + write(w, flusher, "Could not get head block root: "+err.Error()) + return + } + attributes = &PayloadAttributesV3{ + Timestamp: fmt.Sprintf("%d", t.Unix()), + PrevRandao: hexutil.Encode(prevRando), + SuggestedFeeRecipient: hexutil.Encode(headPayload.FeeRecipient()), + Withdrawals: shared.WithdrawalsFromConsensus(withdrawals), + ParentBeaconBlockRoot: hexutil.Encode(parentRoot[:]), } - return streamData(stream, PayloadAttributesTopic, ðpb.EventPayloadAttributeV2{ - Version: version.String(headState.Version()), - Data: ðpb.EventPayloadAttributeV2_BasePayloadAttribute{ - ProposerIndex: proposerIndex, - ProposalSlot: headState.Slot(), - ParentBlockNumber: headPayload.BlockNumber(), - ParentBlockRoot: headRoot, - ParentBlockHash: headPayload.BlockHash(), - PayloadAttributes: &enginev1.PayloadAttributesV2{ - Timestamp: uint64(t.Unix()), - PrevRandao: prevRando, - SuggestedFeeRecipient: headPayload.FeeRecipient(), - Withdrawals: withdrawals, - }, - }, - }) default: - return errors.New("payload version is not supported") + write(w, flusher, "Payload version %s is not supported", version.String(headState.Version())) + return } -} -func streamData(stream ethpbservice.Events_StreamEventsServer, name string, data proto.Message) error { - returnData, err := anypb.New(data) + attributesBytes, err := json.Marshal(attributes) if err != nil { - return err + write(w, flusher, err.Error()) + return } - return stream.Send(&gwpb.EventSource{ - Event: name, - Data: returnData, + eventData := PayloadAttributesEventData{ + ProposerIndex: fmt.Sprintf("%d", proposerIndex), + ProposalSlot: fmt.Sprintf("%d", headState.Slot()), + ParentBlockNumber: fmt.Sprintf("%d", headPayload.BlockNumber()), + ParentBlockRoot: hexutil.Encode(headRoot), + ParentBlockHash: hexutil.Encode(headPayload.BlockHash()), + PayloadAttributes: attributesBytes, + } + eventDataBytes, err := json.Marshal(eventData) + if err != nil { + write(w, flusher, err.Error()) + return + } + send(w, flusher, PayloadAttributesTopic, &PayloadAttributesEvent{ + Version: version.String(headState.Version()), + Data: eventDataBytes, }) } + +func send(w http.ResponseWriter, flusher http.Flusher, name string, data interface{}) { + j, err := json.Marshal(data) + if err != nil { + write(w, flusher, "Could not marshal event to JSON: "+err.Error()) + return + } + write(w, flusher, "event: %s\ndata: %s\n\n", name, string(j)) +} + +func write(w http.ResponseWriter, flusher http.Flusher, format string, a ...any) { + _, err := fmt.Fprintf(w, format, a...) + if err != nil { + log.WithError(err).Error("Could not write to response writer") + } + flusher.Flush() +} diff --git a/beacon-chain/rpc/eth/events/events_test.go b/beacon-chain/rpc/eth/events/events_test.go index 27f3474bc..b4812a635 100644 --- a/beacon-chain/rpc/eth/events/events_test.go +++ b/beacon-chain/rpc/eth/events/events_test.go @@ -1,735 +1,355 @@ package events import ( - "context" + "fmt" + "io" + "math" + "net/http" + "net/http/httptest" + "strings" "testing" "time" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/golang/mock/gomock" - "github.com/grpc-ecosystem/grpc-gateway/v2/proto/gateway" - "github.com/prysmaticlabs/go-bitfield" - "github.com/prysmaticlabs/prysm/v4/async/event" - "github.com/prysmaticlabs/prysm/v4/beacon-chain/blockchain" mockChain "github.com/prysmaticlabs/prysm/v4/beacon-chain/blockchain/testing" - b "github.com/prysmaticlabs/prysm/v4/beacon-chain/core/blocks" "github.com/prysmaticlabs/prysm/v4/beacon-chain/core/feed" "github.com/prysmaticlabs/prysm/v4/beacon-chain/core/feed/operation" statefeed "github.com/prysmaticlabs/prysm/v4/beacon-chain/core/feed/state" - "github.com/prysmaticlabs/prysm/v4/beacon-chain/core/helpers" - prysmtime "github.com/prysmaticlabs/prysm/v4/beacon-chain/core/time" - fieldparams "github.com/prysmaticlabs/prysm/v4/config/fieldparams" + "github.com/prysmaticlabs/prysm/v4/beacon-chain/state" "github.com/prysmaticlabs/prysm/v4/consensus-types/blocks" - "github.com/prysmaticlabs/prysm/v4/encoding/bytesutil" - enginev1 "github.com/prysmaticlabs/prysm/v4/proto/engine/v1" + "github.com/prysmaticlabs/prysm/v4/consensus-types/interfaces" + "github.com/prysmaticlabs/prysm/v4/consensus-types/primitives" ethpb "github.com/prysmaticlabs/prysm/v4/proto/eth/v1" - "github.com/prysmaticlabs/prysm/v4/proto/migration" eth "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1" - "github.com/prysmaticlabs/prysm/v4/runtime/version" "github.com/prysmaticlabs/prysm/v4/testing/assert" - "github.com/prysmaticlabs/prysm/v4/testing/mock" "github.com/prysmaticlabs/prysm/v4/testing/require" "github.com/prysmaticlabs/prysm/v4/testing/util" - "google.golang.org/protobuf/types/known/anypb" ) -func TestStreamEvents_Preconditions(t *testing.T) { - t.Run("no_topics_specified", func(t *testing.T) { - srv := &Server{} - ctrl := gomock.NewController(t) - defer ctrl.Finish() - mockStream := mock.NewMockEvents_StreamEventsServer(ctrl) - err := srv.StreamEvents(ðpb.StreamEventsRequest{Topics: nil}, mockStream) - require.ErrorContains(t, "No topics specified", err) - }) - t.Run("topic_not_allowed", func(t *testing.T) { - srv := &Server{} - ctrl := gomock.NewController(t) - defer ctrl.Finish() - mockStream := mock.NewMockEvents_StreamEventsServer(ctrl) - err := srv.StreamEvents(ðpb.StreamEventsRequest{Topics: []string{"foobar"}}, mockStream) - require.ErrorContains(t, "Topic foobar not allowed", err) - }) +type flushableResponseRecorder struct { + *httptest.ResponseRecorder + flushed bool +} + +func (f *flushableResponseRecorder) Flush() { + f.flushed = true } func TestStreamEvents_OperationsEvents(t *testing.T) { - t.Run("attestation_unaggregated", func(t *testing.T) { - ctx := context.Background() - srv, ctrl, mockStream := setupServer(ctx, t) - defer ctrl.Finish() - - wantedAttV1alpha1 := util.HydrateAttestation(ð.Attestation{ - Data: ð.AttestationData{ - Slot: 8, - }, - }) - wantedAtt := migration.V1Alpha1AttestationToV1(wantedAttV1alpha1) - genericResponse, err := anypb.New(wantedAtt) - require.NoError(t, err) - - wantedMessage := &gateway.EventSource{ - Event: AttestationTopic, - Data: genericResponse, + t.Run("operations", func(t *testing.T) { + s := &Server{ + StateNotifier: &mockChain.MockStateNotifier{}, + OperationNotifier: &mockChain.MockOperationNotifier{}, } - assertFeedSendAndReceive(ctx, &assertFeedArgs{ - t: t, - srv: srv, - topics: []string{AttestationTopic}, - stream: mockStream, - shouldReceive: wantedMessage, - itemToSend: &feed.Event{ - Type: operation.UnaggregatedAttReceived, - Data: &operation.UnAggregatedAttReceivedData{ - Attestation: wantedAttV1alpha1, + topics := []string{AttestationTopic, VoluntaryExitTopic, SyncCommitteeContributionTopic, BLSToExecutionChangeTopic, BlobSidecarTopic} + for i, topic := range topics { + topics[i] = "topics=" + topic + } + request := httptest.NewRequest(http.MethodGet, fmt.Sprintf("http://example.com/eth/v1/events?%s", strings.Join(topics, "&")), nil) + w := &flushableResponseRecorder{ + ResponseRecorder: httptest.NewRecorder(), + } + + go func() { + s.StreamEvents(w, request) + }() + // wait for initiation of StreamEvents + time.Sleep(100 * time.Millisecond) + s.OperationNotifier.OperationFeed().Send(&feed.Event{ + Type: operation.UnaggregatedAttReceived, + Data: &operation.UnAggregatedAttReceivedData{ + Attestation: util.HydrateAttestation(ð.Attestation{}), + }, + }) + s.OperationNotifier.OperationFeed().Send(&feed.Event{ + Type: operation.AggregatedAttReceived, + Data: &operation.AggregatedAttReceivedData{ + Attestation: ð.AggregateAttestationAndProof{ + AggregatorIndex: 0, + Aggregate: util.HydrateAttestation(ð.Attestation{}), + SelectionProof: make([]byte, 96), }, }, - feed: srv.OperationNotifier.OperationFeed(), }) - }) - t.Run("attestation_aggregated", func(t *testing.T) { - ctx := context.Background() - srv, ctrl, mockStream := setupServer(ctx, t) - defer ctrl.Finish() - - wantedAttV1alpha1 := ð.AggregateAttestationAndProof{ - Aggregate: util.HydrateAttestation(ð.Attestation{}), - } - wantedAtt := migration.V1Alpha1AggregateAttAndProofToV1(wantedAttV1alpha1) - genericResponse, err := anypb.New(wantedAtt) - require.NoError(t, err) - - wantedMessage := &gateway.EventSource{ - Event: AttestationTopic, - Data: genericResponse, - } - - assertFeedSendAndReceive(ctx, &assertFeedArgs{ - t: t, - srv: srv, - topics: []string{AttestationTopic}, - stream: mockStream, - shouldReceive: wantedMessage, - itemToSend: &feed.Event{ - Type: operation.AggregatedAttReceived, - Data: &operation.AggregatedAttReceivedData{ - Attestation: wantedAttV1alpha1, - }, - }, - feed: srv.OperationNotifier.OperationFeed(), - }) - }) - t.Run(VoluntaryExitTopic, func(t *testing.T) { - ctx := context.Background() - srv, ctrl, mockStream := setupServer(ctx, t) - defer ctrl.Finish() - - wantedExitV1alpha1 := ð.SignedVoluntaryExit{ - Exit: ð.VoluntaryExit{ - Epoch: 1, - ValidatorIndex: 1, - }, - Signature: make([]byte, 96), - } - wantedExit := migration.V1Alpha1ExitToV1(wantedExitV1alpha1) - genericResponse, err := anypb.New(wantedExit) - require.NoError(t, err) - - wantedMessage := &gateway.EventSource{ - Event: VoluntaryExitTopic, - Data: genericResponse, - } - - assertFeedSendAndReceive(ctx, &assertFeedArgs{ - t: t, - srv: srv, - topics: []string{VoluntaryExitTopic}, - stream: mockStream, - shouldReceive: wantedMessage, - itemToSend: &feed.Event{ - Type: operation.ExitReceived, - Data: &operation.ExitReceivedData{ - Exit: wantedExitV1alpha1, - }, - }, - feed: srv.OperationNotifier.OperationFeed(), - }) - }) - t.Run(SyncCommitteeContributionTopic, func(t *testing.T) { - ctx := context.Background() - srv, ctrl, mockStream := setupServer(ctx, t) - defer ctrl.Finish() - - wantedContributionV1alpha1 := ð.SignedContributionAndProof{ - Message: ð.ContributionAndProof{ - AggregatorIndex: 1, - Contribution: ð.SyncCommitteeContribution{ - Slot: 1, - BlockRoot: []byte("root"), - SubcommitteeIndex: 1, - AggregationBits: bitfield.NewBitvector128(), - Signature: []byte("sig"), - }, - SelectionProof: []byte("proof"), - }, - Signature: []byte("sig"), - } - wantedContribution := migration.V1Alpha1SignedContributionAndProofToV2(wantedContributionV1alpha1) - genericResponse, err := anypb.New(wantedContribution) - require.NoError(t, err) - - wantedMessage := &gateway.EventSource{ - Event: SyncCommitteeContributionTopic, - Data: genericResponse, - } - - assertFeedSendAndReceive(ctx, &assertFeedArgs{ - t: t, - srv: srv, - topics: []string{SyncCommitteeContributionTopic}, - stream: mockStream, - shouldReceive: wantedMessage, - itemToSend: &feed.Event{ - Type: operation.SyncCommitteeContributionReceived, - Data: &operation.SyncCommitteeContributionReceivedData{ - Contribution: wantedContributionV1alpha1, - }, - }, - feed: srv.OperationNotifier.OperationFeed(), - }) - }) - t.Run(BLSToExecutionChangeTopic, func(t *testing.T) { - ctx := context.Background() - srv, ctrl, mockStream := setupServer(ctx, t) - defer ctrl.Finish() - - wantedChangeV1alpha1 := ð.SignedBLSToExecutionChange{ - Message: ð.BLSToExecutionChange{ - ValidatorIndex: 1, - FromBlsPubkey: []byte("from"), - ToExecutionAddress: []byte("to"), - }, - Signature: make([]byte, 96), - } - wantedChange := migration.V1Alpha1SignedBLSToExecChangeToV2(wantedChangeV1alpha1) - genericResponse, err := anypb.New(wantedChange) - require.NoError(t, err) - - wantedMessage := &gateway.EventSource{ - Event: BLSToExecutionChangeTopic, - Data: genericResponse, - } - - assertFeedSendAndReceive(ctx, &assertFeedArgs{ - t: t, - srv: srv, - topics: []string{BLSToExecutionChangeTopic}, - stream: mockStream, - shouldReceive: wantedMessage, - itemToSend: &feed.Event{ - Type: operation.BLSToExecutionChangeReceived, - Data: &operation.BLSToExecutionChangeReceivedData{ - Change: wantedChangeV1alpha1, - }, - }, - feed: srv.OperationNotifier.OperationFeed(), - }) - }) - t.Run(BlobSidecarTopic, func(t *testing.T) { - ctx := context.Background() - srv, ctrl, mockStream := setupServer(ctx, t) - defer ctrl.Finish() - commitment, err := hexutil.Decode("0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8000") - require.NoError(t, err) - wantedBlobV1alpha1 := ð.SignedBlobSidecar{ - Message: ð.DeprecatedBlobSidecar{ - BlockRoot: make([]byte, fieldparams.RootLength), - Index: 1, - Slot: 3, - KzgCommitment: commitment, - }, - Signature: make([]byte, 96), - } - versionedHash := blockchain.ConvertKzgCommitmentToVersionedHash(commitment) - blobEvent := ðpb.EventBlobSidecar{ - BlockRoot: bytesutil.SafeCopyBytes(wantedBlobV1alpha1.Message.BlockRoot), - Index: wantedBlobV1alpha1.Message.Index, - Slot: wantedBlobV1alpha1.Message.Slot, - VersionedHash: bytesutil.SafeCopyBytes(versionedHash.Bytes()), - KzgCommitment: bytesutil.SafeCopyBytes(wantedBlobV1alpha1.Message.KzgCommitment), - } - genericResponse, err := anypb.New(blobEvent) - require.NoError(t, err) - - wantedMessage := &gateway.EventSource{ - Event: BlobSidecarTopic, - Data: genericResponse, - } - - assertFeedSendAndReceive(ctx, &assertFeedArgs{ - t: t, - srv: srv, - topics: []string{BlobSidecarTopic}, - stream: mockStream, - shouldReceive: wantedMessage, - itemToSend: &feed.Event{ - Type: operation.BlobSidecarReceived, - Data: &operation.BlobSidecarReceivedData{ - Blob: wantedBlobV1alpha1, - }, - }, - feed: srv.OperationNotifier.OperationFeed(), - }) - }) -} - -func TestStreamEvents_StateEvents(t *testing.T) { - t.Run(HeadTopic, func(t *testing.T) { - ctx := context.Background() - srv, ctrl, mockStream := setupServer(ctx, t) - defer ctrl.Finish() - - wantedHead := ðpb.EventHead{ - Slot: 8, - Block: make([]byte, 32), - State: make([]byte, 32), - EpochTransition: true, - PreviousDutyDependentRoot: make([]byte, 32), - CurrentDutyDependentRoot: make([]byte, 32), - ExecutionOptimistic: true, - } - genericResponse, err := anypb.New(wantedHead) - require.NoError(t, err) - wantedMessage := &gateway.EventSource{ - Event: HeadTopic, - Data: genericResponse, - } - - assertFeedSendAndReceive(ctx, &assertFeedArgs{ - t: t, - srv: srv, - topics: []string{HeadTopic}, - stream: mockStream, - shouldReceive: wantedMessage, - itemToSend: &feed.Event{ - Type: statefeed.NewHead, - Data: wantedHead, - }, - feed: srv.StateNotifier.StateFeed(), - }) - }) - t.Run(PayloadAttributesTopic+"_bellatrix", func(t *testing.T) { - ctx := context.Background() - - beaconState, _ := util.DeterministicGenesisStateBellatrix(t, 1) - err := beaconState.SetSlot(2) - require.NoError(t, err, "Count not set slot") - stateRoot, err := beaconState.HashTreeRoot(ctx) - require.NoError(t, err, "Could not hash genesis state") - - genesis := b.NewGenesisBlock(stateRoot[:]) - - parentRoot, err := genesis.Block.HashTreeRoot() - require.NoError(t, err, "Could not get signing root") - - var scBits [fieldparams.SyncAggregateSyncCommitteeBytesLength]byte - blk := ð.SignedBeaconBlockBellatrix{ - Block: ð.BeaconBlockBellatrix{ - ProposerIndex: 0, - Slot: 1, - ParentRoot: parentRoot[:], - StateRoot: genesis.Block.StateRoot, - Body: ð.BeaconBlockBodyBellatrix{ - RandaoReveal: genesis.Block.Body.RandaoReveal, - Graffiti: genesis.Block.Body.Graffiti, - Eth1Data: genesis.Block.Body.Eth1Data, - SyncAggregate: ð.SyncAggregate{SyncCommitteeBits: scBits[:], SyncCommitteeSignature: make([]byte, 96)}, - ExecutionPayload: &enginev1.ExecutionPayload{ - BlockNumber: 1, - ParentHash: make([]byte, fieldparams.RootLength), - FeeRecipient: make([]byte, fieldparams.FeeRecipientLength), - StateRoot: make([]byte, fieldparams.RootLength), - ReceiptsRoot: make([]byte, fieldparams.RootLength), - LogsBloom: make([]byte, fieldparams.LogsBloomLength), - PrevRandao: make([]byte, fieldparams.RootLength), - BaseFeePerGas: make([]byte, fieldparams.RootLength), - BlockHash: make([]byte, fieldparams.RootLength), + s.OperationNotifier.OperationFeed().Send(&feed.Event{ + Type: operation.ExitReceived, + Data: &operation.ExitReceivedData{ + Exit: ð.SignedVoluntaryExit{ + Exit: ð.VoluntaryExit{ + Epoch: 0, + ValidatorIndex: 0, }, + Signature: make([]byte, 96), }, }, - Signature: genesis.Signature, - } - signedBlk, err := blocks.NewSignedBeaconBlock(blk) - require.NoError(t, err) - srv, ctrl, mockStream := setupServer(ctx, t) - defer ctrl.Finish() - fetcher := &mockChain.ChainService{ - Genesis: time.Now(), - State: beaconState, - Block: signedBlk, - Root: make([]byte, 32), - ValidatorsRoot: [32]byte{}, - } - srv.HeadFetcher = fetcher - srv.ChainInfoFetcher = fetcher - - prevRando, err := helpers.RandaoMix(beaconState, prysmtime.CurrentEpoch(beaconState)) - require.NoError(t, err) - - wantedPayload := ðpb.EventPayloadAttributeV1{ - Version: version.String(version.Bellatrix), - Data: ðpb.EventPayloadAttributeV1_BasePayloadAttribute{ - ProposerIndex: 0, - ProposalSlot: 2, - ParentBlockNumber: 1, - ParentBlockRoot: make([]byte, 32), - ParentBlockHash: make([]byte, 32), - PayloadAttributes: &enginev1.PayloadAttributes{ - Timestamp: 24, - PrevRandao: prevRando, - SuggestedFeeRecipient: make([]byte, 20), - }, - }, - } - genericResponse, err := anypb.New(wantedPayload) - require.NoError(t, err) - wantedMessage := &gateway.EventSource{ - Event: PayloadAttributesTopic, - Data: genericResponse, - } - - assertFeedSendAndReceive(ctx, &assertFeedArgs{ - t: t, - srv: srv, - topics: []string{PayloadAttributesTopic}, - stream: mockStream, - shouldReceive: wantedMessage, - itemToSend: &feed.Event{ - Type: statefeed.NewHead, - Data: wantedPayload, - }, - feed: srv.StateNotifier.StateFeed(), }) - }) - t.Run(PayloadAttributesTopic+"_capella", func(t *testing.T) { - ctx := context.Background() - beaconState, _ := util.DeterministicGenesisStateCapella(t, 1) - validator, err := beaconState.ValidatorAtIndex(0) - require.NoError(t, err, "Could not get validator") - by, err := hexutil.Decode("0x010000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b") - require.NoError(t, err) - validator.WithdrawalCredentials = by - err = beaconState.UpdateValidatorAtIndex(0, validator) - require.NoError(t, err) - err = beaconState.SetSlot(2) - require.NoError(t, err, "Count not set slot") - err = beaconState.SetNextWithdrawalValidatorIndex(0) - require.NoError(t, err, "Could not set withdrawal index") - err = beaconState.SetBalances([]uint64{33000000000}) - require.NoError(t, err, "Could not set validator balance") - stateRoot, err := beaconState.HashTreeRoot(ctx) - require.NoError(t, err, "Could not hash genesis state") - - genesis := b.NewGenesisBlock(stateRoot[:]) - - parentRoot, err := genesis.Block.HashTreeRoot() - require.NoError(t, err, "Could not get signing root") - - withdrawals, err := beaconState.ExpectedWithdrawals() - require.NoError(t, err, "Could get expected withdrawals") - require.NotEqual(t, len(withdrawals), 0) - var scBits [fieldparams.SyncAggregateSyncCommitteeBytesLength]byte - blk := ð.SignedBeaconBlockCapella{ - Block: ð.BeaconBlockCapella{ - ProposerIndex: 0, - Slot: 1, - ParentRoot: parentRoot[:], - StateRoot: genesis.Block.StateRoot, - Body: ð.BeaconBlockBodyCapella{ - RandaoReveal: genesis.Block.Body.RandaoReveal, - Graffiti: genesis.Block.Body.Graffiti, - Eth1Data: genesis.Block.Body.Eth1Data, - SyncAggregate: ð.SyncAggregate{SyncCommitteeBits: scBits[:], SyncCommitteeSignature: make([]byte, 96)}, - ExecutionPayload: &enginev1.ExecutionPayloadCapella{ - BlockNumber: 1, - ParentHash: make([]byte, fieldparams.RootLength), - FeeRecipient: make([]byte, fieldparams.FeeRecipientLength), - StateRoot: make([]byte, fieldparams.RootLength), - ReceiptsRoot: make([]byte, fieldparams.RootLength), - LogsBloom: make([]byte, fieldparams.LogsBloomLength), - PrevRandao: make([]byte, fieldparams.RootLength), - BaseFeePerGas: make([]byte, fieldparams.RootLength), - BlockHash: make([]byte, fieldparams.RootLength), - Withdrawals: withdrawals, + s.OperationNotifier.OperationFeed().Send(&feed.Event{ + Type: operation.SyncCommitteeContributionReceived, + Data: &operation.SyncCommitteeContributionReceivedData{ + Contribution: ð.SignedContributionAndProof{ + Message: ð.ContributionAndProof{ + AggregatorIndex: 0, + Contribution: ð.SyncCommitteeContribution{ + Slot: 0, + BlockRoot: make([]byte, 32), + SubcommitteeIndex: 0, + AggregationBits: make([]byte, 16), + Signature: make([]byte, 96), + }, + SelectionProof: make([]byte, 96), }, + Signature: make([]byte, 96), }, }, - Signature: genesis.Signature, - } - signedBlk, err := blocks.NewSignedBeaconBlock(blk) - require.NoError(t, err) - srv, ctrl, mockStream := setupServer(ctx, t) - defer ctrl.Finish() - fetcher := &mockChain.ChainService{ - Genesis: time.Now(), - State: beaconState, - Block: signedBlk, - Root: make([]byte, 32), - ValidatorsRoot: [32]byte{}, - } - - srv.HeadFetcher = fetcher - srv.ChainInfoFetcher = fetcher - - prevRando, err := helpers.RandaoMix(beaconState, prysmtime.CurrentEpoch(beaconState)) - require.NoError(t, err) - - wantedPayload := ðpb.EventPayloadAttributeV2{ - Version: version.String(version.Capella), - Data: ðpb.EventPayloadAttributeV2_BasePayloadAttribute{ - ProposerIndex: 0, - ProposalSlot: 2, - ParentBlockNumber: 1, - ParentBlockRoot: make([]byte, 32), - ParentBlockHash: make([]byte, 32), - PayloadAttributes: &enginev1.PayloadAttributesV2{ - Timestamp: 24, - PrevRandao: prevRando, - SuggestedFeeRecipient: make([]byte, 20), - Withdrawals: withdrawals, + }) + s.OperationNotifier.OperationFeed().Send(&feed.Event{ + Type: operation.BLSToExecutionChangeReceived, + Data: &operation.BLSToExecutionChangeReceivedData{ + Change: ð.SignedBLSToExecutionChange{ + Message: ð.BLSToExecutionChange{ + ValidatorIndex: 0, + FromBlsPubkey: make([]byte, 48), + ToExecutionAddress: make([]byte, 20), + }, + Signature: make([]byte, 96), }, }, - } - genericResponse, err := anypb.New(wantedPayload) - require.NoError(t, err) - wantedMessage := &gateway.EventSource{ - Event: PayloadAttributesTopic, - Data: genericResponse, - } - - assertFeedSendAndReceive(ctx, &assertFeedArgs{ - t: t, - srv: srv, - topics: []string{PayloadAttributesTopic}, - stream: mockStream, - shouldReceive: wantedMessage, - itemToSend: &feed.Event{ - Type: statefeed.NewHead, - Data: wantedPayload, - }, - feed: srv.StateNotifier.StateFeed(), }) + s.OperationNotifier.OperationFeed().Send(&feed.Event{ + Type: operation.BlobSidecarReceived, + Data: &operation.BlobSidecarReceivedData{ + Blob: util.HydrateSignedBlobSidecar(ð.SignedBlobSidecar{}), + }, + }) + // wait for feed + time.Sleep(1 * time.Second) + request.Context().Done() + + resp := w.Result() + body, err := io.ReadAll(resp.Body) + require.NoError(t, err) + require.NotNil(t, body) + assert.Equal(t, operationsResult, string(body)) }) - t.Run(FinalizedCheckpointTopic, func(t *testing.T) { - ctx := context.Background() - srv, ctrl, mockStream := setupServer(ctx, t) - defer ctrl.Finish() - - wantedCheckpoint := ðpb.EventFinalizedCheckpoint{ - Block: make([]byte, 32), - State: make([]byte, 32), - Epoch: 8, - ExecutionOptimistic: true, - } - genericResponse, err := anypb.New(wantedCheckpoint) - require.NoError(t, err) - wantedMessage := &gateway.EventSource{ - Event: FinalizedCheckpointTopic, - Data: genericResponse, + t.Run("state", func(t *testing.T) { + s := &Server{ + StateNotifier: &mockChain.MockStateNotifier{}, + OperationNotifier: &mockChain.MockOperationNotifier{}, } - assertFeedSendAndReceive(ctx, &assertFeedArgs{ - t: t, - srv: srv, - topics: []string{FinalizedCheckpointTopic}, - stream: mockStream, - shouldReceive: wantedMessage, - itemToSend: &feed.Event{ - Type: statefeed.FinalizedCheckpoint, - Data: wantedCheckpoint, - }, - feed: srv.StateNotifier.StateFeed(), - }) - }) - t.Run(ChainReorgTopic, func(t *testing.T) { - ctx := context.Background() - srv, ctrl, mockStream := setupServer(ctx, t) - defer ctrl.Finish() - - wantedReorg := ðpb.EventChainReorg{ - Slot: 8, - Depth: 1, - OldHeadBlock: make([]byte, 32), - NewHeadBlock: make([]byte, 32), - OldHeadState: make([]byte, 32), - NewHeadState: make([]byte, 32), - Epoch: 0, - ExecutionOptimistic: true, + topics := []string{HeadTopic, FinalizedCheckpointTopic, ChainReorgTopic, BlockTopic} + for i, topic := range topics { + topics[i] = "topics=" + topic } - genericResponse, err := anypb.New(wantedReorg) - require.NoError(t, err) - wantedMessage := &gateway.EventSource{ - Event: ChainReorgTopic, - Data: genericResponse, + request := httptest.NewRequest(http.MethodGet, fmt.Sprintf("http://example.com/eth/v1/events?%s", strings.Join(topics, "&")), nil) + w := &flushableResponseRecorder{ + ResponseRecorder: httptest.NewRecorder(), } - assertFeedSendAndReceive(ctx, &assertFeedArgs{ - t: t, - srv: srv, - topics: []string{ChainReorgTopic}, - stream: mockStream, - shouldReceive: wantedMessage, - itemToSend: &feed.Event{ - Type: statefeed.Reorg, - Data: wantedReorg, - }, - feed: srv.StateNotifier.StateFeed(), - }) - }) - t.Run(BlockTopic, func(t *testing.T) { - ctx := context.Background() - srv, ctrl, mockStream := setupServer(ctx, t) - defer ctrl.Finish() - - blk := util.HydrateSignedBeaconBlock(ð.SignedBeaconBlock{ - Block: ð.BeaconBlock{ - Slot: 8, - }, - }) - bodyRoot, err := blk.Block.Body.HashTreeRoot() - require.NoError(t, err) - wantedHeader := util.HydrateBeaconHeader(ð.BeaconBlockHeader{ - Slot: 8, - BodyRoot: bodyRoot[:], - }) - wantedBlockRoot, err := wantedHeader.HashTreeRoot() - require.NoError(t, err) - genericResponse, err := anypb.New(ðpb.EventBlock{ - Slot: 8, - Block: wantedBlockRoot[:], - ExecutionOptimistic: true, - }) - require.NoError(t, err) - wantedMessage := &gateway.EventSource{ - Event: BlockTopic, - Data: genericResponse, - } - wsb, err := blocks.NewSignedBeaconBlock(blk) - require.NoError(t, err) - assertFeedSendAndReceive(ctx, &assertFeedArgs{ - t: t, - srv: srv, - topics: []string{BlockTopic}, - stream: mockStream, - shouldReceive: wantedMessage, - itemToSend: &feed.Event{ - Type: statefeed.BlockProcessed, - Data: &statefeed.BlockProcessedData{ - Slot: 8, - SignedBlock: wsb, - Optimistic: true, - }, - }, - feed: srv.StateNotifier.StateFeed(), - }) - }) -} - -func TestStreamEvents_CommaSeparatedTopics(t *testing.T) { - ctx := context.Background() - srv, ctrl, mockStream := setupServer(ctx, t) - defer ctrl.Finish() - - wantedHead := ðpb.EventHead{ - Slot: 8, - Block: make([]byte, 32), - State: make([]byte, 32), - EpochTransition: true, - PreviousDutyDependentRoot: make([]byte, 32), - CurrentDutyDependentRoot: make([]byte, 32), - } - headGenericResponse, err := anypb.New(wantedHead) - require.NoError(t, err) - wantedHeadMessage := &gateway.EventSource{ - Event: HeadTopic, - Data: headGenericResponse, - } - - assertFeedSendAndReceive(ctx, &assertFeedArgs{ - t: t, - srv: srv, - topics: []string{HeadTopic + "," + FinalizedCheckpointTopic}, - stream: mockStream, - shouldReceive: wantedHeadMessage, - itemToSend: &feed.Event{ + go func() { + s.StreamEvents(w, request) + }() + // wait for initiation of StreamEvents + time.Sleep(100 * time.Millisecond) + s.StateNotifier.StateFeed().Send(&feed.Event{ Type: statefeed.NewHead, - Data: wantedHead, - }, - feed: srv.StateNotifier.StateFeed(), - }) - - wantedCheckpoint := ðpb.EventFinalizedCheckpoint{ - Block: make([]byte, 32), - State: make([]byte, 32), - Epoch: 8, - } - checkpointGenericResponse, err := anypb.New(wantedCheckpoint) - require.NoError(t, err) - wantedCheckpointMessage := &gateway.EventSource{ - Event: FinalizedCheckpointTopic, - Data: checkpointGenericResponse, - } - - assertFeedSendAndReceive(ctx, &assertFeedArgs{ - t: t, - srv: srv, - topics: []string{HeadTopic + "," + FinalizedCheckpointTopic}, - stream: mockStream, - shouldReceive: wantedCheckpointMessage, - itemToSend: &feed.Event{ + Data: ðpb.EventHead{ + Slot: 0, + Block: make([]byte, 32), + State: make([]byte, 32), + EpochTransition: true, + PreviousDutyDependentRoot: make([]byte, 32), + CurrentDutyDependentRoot: make([]byte, 32), + ExecutionOptimistic: false, + }, + }) + s.StateNotifier.StateFeed().Send(&feed.Event{ Type: statefeed.FinalizedCheckpoint, - Data: wantedCheckpoint, - }, - feed: srv.StateNotifier.StateFeed(), + Data: ðpb.EventFinalizedCheckpoint{ + Block: make([]byte, 32), + State: make([]byte, 32), + Epoch: 0, + ExecutionOptimistic: false, + }, + }) + s.StateNotifier.StateFeed().Send(&feed.Event{ + Type: statefeed.Reorg, + Data: ðpb.EventChainReorg{ + Slot: 0, + Depth: 0, + OldHeadBlock: make([]byte, 32), + NewHeadBlock: make([]byte, 32), + OldHeadState: make([]byte, 32), + NewHeadState: make([]byte, 32), + Epoch: 0, + ExecutionOptimistic: false, + }, + }) + b, err := blocks.NewSignedBeaconBlock(util.HydrateSignedBeaconBlock(ð.SignedBeaconBlock{})) + require.NoError(t, err) + s.StateNotifier.StateFeed().Send(&feed.Event{ + Type: statefeed.BlockProcessed, + Data: &statefeed.BlockProcessedData{ + Slot: 0, + BlockRoot: [32]byte{}, + SignedBlock: b, + Verified: true, + Optimistic: false, + }, + }) + + // wait for feed + time.Sleep(1 * time.Second) + request.Context().Done() + + resp := w.Result() + body, err := io.ReadAll(resp.Body) + require.NoError(t, err) + require.NotNil(t, body) + assert.Equal(t, stateResult, string(body)) + }) + t.Run("payload attributes", func(t *testing.T) { + type testCase struct { + name string + getState func() state.BeaconState + getBlock func() interfaces.SignedBeaconBlock + expected string + } + testCases := []testCase{ + { + name: "bellatrix", + getState: func() state.BeaconState { + st, err := util.NewBeaconStateBellatrix() + require.NoError(t, err) + return st + }, + getBlock: func() interfaces.SignedBeaconBlock { + b, err := blocks.NewSignedBeaconBlock(util.HydrateSignedBeaconBlockBellatrix(ð.SignedBeaconBlockBellatrix{})) + require.NoError(t, err) + return b + }, + expected: payloadAttributesBellatrixResult, + }, + { + name: "capella", + getState: func() state.BeaconState { + st, err := util.NewBeaconStateCapella() + require.NoError(t, err) + return st + }, + getBlock: func() interfaces.SignedBeaconBlock { + b, err := blocks.NewSignedBeaconBlock(util.HydrateSignedBeaconBlockCapella(ð.SignedBeaconBlockCapella{})) + require.NoError(t, err) + return b + }, + expected: payloadAttributesCapellaResult, + }, + { + name: "deneb", + getState: func() state.BeaconState { + st, err := util.NewBeaconStateDeneb() + require.NoError(t, err) + return st + }, + getBlock: func() interfaces.SignedBeaconBlock { + b, err := blocks.NewSignedBeaconBlock(util.HydrateSignedBeaconBlockDeneb(ð.SignedBeaconBlockDeneb{})) + require.NoError(t, err) + return b + }, + expected: payloadAttributesDenebResult, + }, + } + for _, tc := range testCases { + st := tc.getState() + v := ð.Validator{ExitEpoch: math.MaxUint64} + require.NoError(t, st.SetValidators([]*eth.Validator{v})) + currentSlot := primitives.Slot(0) + // to avoid slot processing + require.NoError(t, st.SetSlot(currentSlot+1)) + b := tc.getBlock() + mockChainService := &mockChain.ChainService{ + Root: make([]byte, 32), + State: st, + Block: b, + Slot: ¤tSlot, + } + s := &Server{ + StateNotifier: &mockChain.MockStateNotifier{}, + OperationNotifier: &mockChain.MockOperationNotifier{}, + HeadFetcher: mockChainService, + ChainInfoFetcher: mockChainService, + } + + request := httptest.NewRequest(http.MethodGet, fmt.Sprintf("http://example.com/eth/v1/events?topics=%s", PayloadAttributesTopic), nil) + w := &flushableResponseRecorder{ + ResponseRecorder: httptest.NewRecorder(), + } + + go func() { + s.StreamEvents(w, request) + }() + // wait for initiation of StreamEvents + time.Sleep(100 * time.Millisecond) + s.StateNotifier.StateFeed().Send(&feed.Event{Type: statefeed.MissedSlot}) + + // wait for feed + time.Sleep(1 * time.Second) + request.Context().Done() + + resp := w.Result() + body, err := io.ReadAll(resp.Body) + require.NoError(t, err) + require.NotNil(t, body) + assert.Equal(t, tc.expected, string(body), "wrong result for "+tc.name) + } }) } -func setupServer(ctx context.Context, t testing.TB) (*Server, *gomock.Controller, *mock.Events_StreamEventsServer) { - srv := &Server{ - StateNotifier: &mockChain.MockStateNotifier{}, - OperationNotifier: &mockChain.MockOperationNotifier{}, - Ctx: ctx, - } - ctrl := gomock.NewController(t) - mockStream := mock.NewMockEvents_StreamEventsServer(ctrl) - return srv, ctrl, mockStream -} +const operationsResult = `event: attestation +data: {"aggregation_bits":"0x00","data":{"slot":"0","index":"0","beacon_block_root":"0x0000000000000000000000000000000000000000000000000000000000000000","source":{"epoch":"0","root":"0x0000000000000000000000000000000000000000000000000000000000000000"},"target":{"epoch":"0","root":"0x0000000000000000000000000000000000000000000000000000000000000000"}},"signature":"0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"} -type assertFeedArgs struct { - t *testing.T - topics []string - srv *Server - stream *mock.Events_StreamEventsServer - shouldReceive interface{} - itemToSend *feed.Event - feed *event.Feed -} +event: attestation +data: {"aggregation_bits":"0x00","data":{"slot":"0","index":"0","beacon_block_root":"0x0000000000000000000000000000000000000000000000000000000000000000","source":{"epoch":"0","root":"0x0000000000000000000000000000000000000000000000000000000000000000"},"target":{"epoch":"0","root":"0x0000000000000000000000000000000000000000000000000000000000000000"}},"signature":"0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"} -func assertFeedSendAndReceive(ctx context.Context, args *assertFeedArgs) { - exitRoutine := make(chan bool) - defer close(exitRoutine) - args.stream.EXPECT().Send(args.shouldReceive).Do(func(arg0 interface{}) { - exitRoutine <- true - }) - args.stream.EXPECT().Context().Return(ctx).AnyTimes() +event: voluntary_exit +data: {"message":{"epoch":"0","validator_index":"0"},"signature":"0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"} - req := ðpb.StreamEventsRequest{Topics: args.topics} - go func(tt *testing.T) { - assert.NoError(tt, args.srv.StreamEvents(req, args.stream), "Could not call RPC method") - }(args.t) - // Send in a loop to ensure it is delivered (busy wait for the service to subscribe to the state feed). - for sent := 0; sent == 0; { - sent = args.feed.Send(args.itemToSend) - } - <-exitRoutine -} +event: contribution_and_proof +data: {"message":{"aggregator_index":"0","contribution":{"slot":"0","beacon_block_root":"0x0000000000000000000000000000000000000000000000000000000000000000","subcommittee_index":"0","aggregation_bits":"0x00000000000000000000000000000000","signature":"0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"},"selection_proof":"0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"},"signature":"0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"} + +event: bls_to_execution_change +data: {"message":{"validator_index":"0","from_bls_pubkey":"0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","to_execution_address":"0x0000000000000000000000000000000000000000"},"signature":"0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"} + +event: blob_sidecar +data: {"block_root":"0x0000000000000000000000000000000000000000000000000000000000000000","index":"0","slot":"0","kzg_commitment":"0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","versioned_hash":"0x01b0761f87b081d5cf10757ccc89f12be355c70e2e29df288b65b30710dcbcd1"} + +` + +const stateResult = `event: head +data: {"slot":"0","block":"0x0000000000000000000000000000000000000000000000000000000000000000","state":"0x0000000000000000000000000000000000000000000000000000000000000000","epoch_transition":true,"execution_optimistic":false,"previous_duty_dependent_root":"0x0000000000000000000000000000000000000000000000000000000000000000","current_duty_dependent_root":"0x0000000000000000000000000000000000000000000000000000000000000000"} + +event: finalized_checkpoint +data: {"block":"0x0000000000000000000000000000000000000000000000000000000000000000","state":"0x0000000000000000000000000000000000000000000000000000000000000000","epoch":"0","execution_optimistic":false} + +event: chain_reorg +data: {"slot":"0","depth":"0","old_head_block":"0x0000000000000000000000000000000000000000000000000000000000000000","old_head_state":"0x0000000000000000000000000000000000000000000000000000000000000000","new_head_block":"0x0000000000000000000000000000000000000000000000000000000000000000","new_head_state":"0x0000000000000000000000000000000000000000000000000000000000000000","epoch":"0","execution_optimistic":false} + +event: block +data: {"slot":"0","block":"0xeade62f0457b2fdf48e7d3fc4b60736688286be7c7a3ac4c9a16a5e0600bd9e4","execution_optimistic":false} + +` + +const payloadAttributesBellatrixResult = `event: payload_attributes +data: {"version":"bellatrix","data":{"proposer_index":"0","proposal_slot":"1","parent_block_number":"0","parent_block_root":"0x0000000000000000000000000000000000000000000000000000000000000000","parent_block_hash":"0x0000000000000000000000000000000000000000000000000000000000000000","payload_attributes":{"timestamp":"12","prev_randao":"0x0000000000000000000000000000000000000000000000000000000000000000","suggested_fee_recipient":"0x0000000000000000000000000000000000000000"}}} + +` + +const payloadAttributesCapellaResult = `event: payload_attributes +data: {"version":"capella","data":{"proposer_index":"0","proposal_slot":"1","parent_block_number":"0","parent_block_root":"0x0000000000000000000000000000000000000000000000000000000000000000","parent_block_hash":"0x0000000000000000000000000000000000000000000000000000000000000000","payload_attributes":{"timestamp":"12","prev_randao":"0x0000000000000000000000000000000000000000000000000000000000000000","suggested_fee_recipient":"0x0000000000000000000000000000000000000000","withdrawals":[]}}} + +` + +const payloadAttributesDenebResult = `event: payload_attributes +data: {"version":"deneb","data":{"proposer_index":"0","proposal_slot":"1","parent_block_number":"0","parent_block_root":"0x0000000000000000000000000000000000000000000000000000000000000000","parent_block_hash":"0x0000000000000000000000000000000000000000000000000000000000000000","payload_attributes":{"timestamp":"12","prev_randao":"0x0000000000000000000000000000000000000000000000000000000000000000","suggested_fee_recipient":"0x0000000000000000000000000000000000000000","withdrawals":[],"parent_beacon_block_root":"0xbef96cb938fd48b2403d3e662664325abb0102ed12737cbb80d717520e50cf4a"}}} + +` diff --git a/beacon-chain/rpc/eth/events/server.go b/beacon-chain/rpc/eth/events/server.go index 1ffa6160e..2eacac91c 100644 --- a/beacon-chain/rpc/eth/events/server.go +++ b/beacon-chain/rpc/eth/events/server.go @@ -4,8 +4,6 @@ package events import ( - "context" - "github.com/prysmaticlabs/prysm/v4/beacon-chain/blockchain" opfeed "github.com/prysmaticlabs/prysm/v4/beacon-chain/core/feed/operation" statefeed "github.com/prysmaticlabs/prysm/v4/beacon-chain/core/feed/state" @@ -14,7 +12,6 @@ import ( // Server defines a server implementation of the gRPC events service, // providing RPC endpoints to subscribe to events from the beacon node. type Server struct { - Ctx context.Context StateNotifier statefeed.Notifier OperationNotifier opfeed.Notifier HeadFetcher blockchain.HeadFetcher diff --git a/beacon-chain/rpc/eth/events/structs.go b/beacon-chain/rpc/eth/events/structs.go new file mode 100644 index 000000000..81e10edd4 --- /dev/null +++ b/beacon-chain/rpc/eth/events/structs.go @@ -0,0 +1,94 @@ +package events + +import ( + "encoding/json" + + "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/shared" +) + +type HeadEvent struct { + Slot string `json:"slot"` + Block string `json:"block"` + State string `json:"state"` + EpochTransition bool `json:"epoch_transition"` + ExecutionOptimistic bool `json:"execution_optimistic"` + PreviousDutyDependentRoot string `json:"previous_duty_dependent_root"` + CurrentDutyDependentRoot string `json:"current_duty_dependent_root"` +} + +type BlockEvent struct { + Slot string `json:"slot"` + Block string `json:"block"` + ExecutionOptimistic bool `json:"execution_optimistic"` +} + +type AggregatedAttEventSource struct { + Aggregate *shared.Attestation `json:"aggregate"` +} + +type UnaggregatedAttEventSource struct { + AggregationBits string `json:"aggregation_bits"` + Data *shared.AttestationData `json:"data"` + Signature string `json:"signature"` +} + +type FinalizedCheckpointEvent struct { + Block string `json:"block"` + State string `json:"state"` + Epoch string `json:"epoch"` + ExecutionOptimistic bool `json:"execution_optimistic"` +} + +type ChainReorgEvent struct { + Slot string `json:"slot"` + Depth string `json:"depth"` + OldHeadBlock string `json:"old_head_block"` + NewHeadBlock string `json:"old_head_state"` + OldHeadState string `json:"new_head_block"` + NewHeadState string `json:"new_head_state"` + Epoch string `json:"epoch"` + ExecutionOptimistic bool `json:"execution_optimistic"` +} + +type PayloadAttributesEvent struct { + Version string `json:"version"` + Data json.RawMessage `json:"data"` +} + +type PayloadAttributesEventData struct { + ProposerIndex string `json:"proposer_index"` + ProposalSlot string `json:"proposal_slot"` + ParentBlockNumber string `json:"parent_block_number"` + ParentBlockRoot string `json:"parent_block_root"` + ParentBlockHash string `json:"parent_block_hash"` + PayloadAttributes json.RawMessage `json:"payload_attributes"` +} + +type PayloadAttributesV1 struct { + Timestamp string `json:"timestamp"` + PrevRandao string `json:"prev_randao"` + SuggestedFeeRecipient string `json:"suggested_fee_recipient"` +} + +type PayloadAttributesV2 struct { + Timestamp string `json:"timestamp"` + PrevRandao string `json:"prev_randao"` + SuggestedFeeRecipient string `json:"suggested_fee_recipient"` + Withdrawals []*shared.Withdrawal `json:"withdrawals"` +} + +type PayloadAttributesV3 struct { + Timestamp string `json:"timestamp"` + PrevRandao string `json:"prev_randao"` + SuggestedFeeRecipient string `json:"suggested_fee_recipient"` + Withdrawals []*shared.Withdrawal `json:"withdrawals"` + ParentBeaconBlockRoot string `json:"parent_beacon_block_root"` +} + +type BlobSidecarEvent struct { + BlockRoot string `json:"block_root"` + Index string `json:"index"` + Slot string `json:"slot"` + KzgCommitment string `json:"kzg_commitment"` + VersionedHash string `json:"versioned_hash"` +} diff --git a/beacon-chain/rpc/eth/shared/structs.go b/beacon-chain/rpc/eth/shared/structs.go index 9823eba52..f5e065c46 100644 --- a/beacon-chain/rpc/eth/shared/structs.go +++ b/beacon-chain/rpc/eth/shared/structs.go @@ -326,6 +326,14 @@ func (s *SignedContributionAndProof) ToConsensus() (*eth.SignedContributionAndPr }, nil } +func SignedContributionAndProofFromConsensus(c *eth.SignedContributionAndProof) *SignedContributionAndProof { + contribution := ContributionAndProofFromConsensus(c.Message) + return &SignedContributionAndProof{ + Message: contribution, + Signature: hexutil.Encode(c.Signature), + } +} + func (c *ContributionAndProof) ToConsensus() (*eth.ContributionAndProof, error) { contribution, err := c.Contribution.ToConsensus() if err != nil { @@ -347,6 +355,15 @@ func (c *ContributionAndProof) ToConsensus() (*eth.ContributionAndProof, error) }, nil } +func ContributionAndProofFromConsensus(c *eth.ContributionAndProof) *ContributionAndProof { + contribution := SyncCommitteeContributionFromConsensus(c.Contribution) + return &ContributionAndProof{ + AggregatorIndex: fmt.Sprintf("%d", c.AggregatorIndex), + Contribution: contribution, + SelectionProof: hexutil.Encode(c.SelectionProof), + } +} + func (s *SyncCommitteeContribution) ToConsensus() (*eth.SyncCommitteeContribution, error) { slot, err := strconv.ParseUint(s.Slot, 10, 64) if err != nil { @@ -378,6 +395,16 @@ func (s *SyncCommitteeContribution) ToConsensus() (*eth.SyncCommitteeContributio }, nil } +func SyncCommitteeContributionFromConsensus(c *eth.SyncCommitteeContribution) *SyncCommitteeContribution { + return &SyncCommitteeContribution{ + Slot: fmt.Sprintf("%d", c.Slot), + BeaconBlockRoot: hexutil.Encode(c.BlockRoot), + SubcommitteeIndex: fmt.Sprintf("%d", c.SubcommitteeIndex), + AggregationBits: hexutil.Encode(c.AggregationBits), + Signature: hexutil.Encode(c.Signature), + } +} + func (s *SignedAggregateAttestationAndProof) ToConsensus() (*eth.SignedAggregateAttestationAndProof, error) { msg, err := s.Message.ToConsensus() if err != nil { diff --git a/beacon-chain/rpc/eth/shared/structs_blocks.go b/beacon-chain/rpc/eth/shared/structs_blocks.go index f7014db84..1ed712c1a 100644 --- a/beacon-chain/rpc/eth/shared/structs_blocks.go +++ b/beacon-chain/rpc/eth/shared/structs_blocks.go @@ -8,6 +8,7 @@ import ( "github.com/pkg/errors" fieldparams "github.com/prysmaticlabs/prysm/v4/config/fieldparams" "github.com/prysmaticlabs/prysm/v4/consensus-types/primitives" + enginev1 "github.com/prysmaticlabs/prysm/v4/proto/engine/v1" eth "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1" ) @@ -561,6 +562,23 @@ type Withdrawal struct { Amount string `json:"amount" validate:"required"` } +func WithdrawalsFromConsensus(ws []*enginev1.Withdrawal) []*Withdrawal { + result := make([]*Withdrawal, len(ws)) + for i, w := range ws { + result[i] = WithdrawalFromConsensus(w) + } + return result +} + +func WithdrawalFromConsensus(w *enginev1.Withdrawal) *Withdrawal { + return &Withdrawal{ + WithdrawalIndex: fmt.Sprintf("%d", w.Index), + ValidatorIndex: fmt.Sprintf("%d", w.ValidatorIndex), + ExecutionAddress: hexutil.Encode(w.Address), + Amount: fmt.Sprintf("%d", w.Amount), + } +} + type SignedBlsToExecutionChange struct { Message *BlsToExecutionChange `json:"message" validate:"required"` Signature string `json:"signature" validate:"required"` diff --git a/beacon-chain/rpc/service.go b/beacon-chain/rpc/service.go index a8cda11e6..891b63964 100644 --- a/beacon-chain/rpc/service.go +++ b/beacon-chain/rpc/service.go @@ -15,6 +15,7 @@ import ( grpcopentracing "github.com/grpc-ecosystem/go-grpc-middleware/tracing/opentracing" grpcprometheus "github.com/grpc-ecosystem/go-grpc-prometheus" "github.com/pkg/errors" + "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/events" beacon2 "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/prysm/beacon" nodeprysm "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/prysm/node" validatorprysm "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/prysm/validator" @@ -46,7 +47,6 @@ import ( 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" lightclient "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/light-client" "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/node" "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/rewards" @@ -64,7 +64,6 @@ import ( "github.com/prysmaticlabs/prysm/v4/config/params" "github.com/prysmaticlabs/prysm/v4/io/logs" "github.com/prysmaticlabs/prysm/v4/monitoring/tracing" - ethpbservice "github.com/prysmaticlabs/prysm/v4/proto/eth/service" ethpbv1alpha1 "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1" ) @@ -453,6 +452,14 @@ func (s *Service) Start() { 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) + eventsServer := &events.Server{ + StateNotifier: s.cfg.StateNotifier, + OperationNotifier: s.cfg.OperationNotifier, + HeadFetcher: s.cfg.HeadFetcher, + ChainInfoFetcher: s.cfg.ChainInfoFetcher, + } + s.cfg.Router.HandleFunc("/eth/v1/events", eventsServer.StreamEvents).Methods(http.MethodGet) + lightClientServer := &lightclient.Server{ Blocker: blocker, Stater: stater, @@ -466,13 +473,6 @@ func (s *Service) Start() { ethpbv1alpha1.RegisterNodeServer(s.grpcServer, nodeServer) ethpbv1alpha1.RegisterHealthServer(s.grpcServer, nodeServer) ethpbv1alpha1.RegisterBeaconChainServer(s.grpcServer, beaconChainServer) - ethpbservice.RegisterEventsServer(s.grpcServer, &events.Server{ - Ctx: s.ctx, - StateNotifier: s.cfg.StateNotifier, - OperationNotifier: s.cfg.OperationNotifier, - HeadFetcher: s.cfg.HeadFetcher, - ChainInfoFetcher: s.cfg.ChainInfoFetcher, - }) if s.cfg.EnableDebugRPCEndpoints { log.Info("Enabled debug gRPC endpoints") debugServer := &debugv1alpha1.Server{ diff --git a/go.mod b/go.mod index b967149bb..de9f54cda 100644 --- a/go.mod +++ b/go.mod @@ -63,7 +63,6 @@ require ( github.com/prysmaticlabs/go-bitfield v0.0.0-20210809151128-385d8c5e3fb7 github.com/prysmaticlabs/prombbolt v0.0.0-20210126082820-9b7adba6db7c github.com/prysmaticlabs/protoc-gen-go-cast v0.0.0-20230228205207-28762a7b9294 - github.com/r3labs/sse/v2 v2.10.0 github.com/rs/cors v1.7.0 github.com/schollz/progressbar/v3 v3.3.4 github.com/sirupsen/logrus v1.9.0 @@ -238,7 +237,6 @@ require ( golang.org/x/term v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect golang.org/x/time v0.3.0 // indirect - gopkg.in/cenkalti/backoff.v1 v1.1.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect diff --git a/go.sum b/go.sum index f463a456f..0be2fa1b5 100644 --- a/go.sum +++ b/go.sum @@ -1137,8 +1137,6 @@ github.com/quic-go/quic-go v0.33.0 h1:ItNoTDN/Fm/zBlq769lLJc8ECe9gYaW40veHCCco7y github.com/quic-go/quic-go v0.33.0/go.mod h1:YMuhaAV9/jIu0XclDXwZPAsP/2Kgr5yMYhe9oxhhOFA= github.com/quic-go/webtransport-go v0.5.2 h1:GA6Bl6oZY+g/flt00Pnu0XtivSD8vukOu3lYhJjnGEk= github.com/quic-go/webtransport-go v0.5.2/go.mod h1:OhmmgJIzTTqXK5xvtuX0oBpLV2GkLWNDA+UeTGJXErU= -github.com/r3labs/sse/v2 v2.10.0 h1:hFEkLLFY4LDifoHdiCN/LlGBAdVJYsANaLqNYa1l/v0= -github.com/r3labs/sse/v2 v2.10.0/go.mod h1:Igau6Whc+F17QUgML1fYe1VPZzTV6EMCnYktEmkNJ7I= github.com/raulk/go-watchdog v1.3.0 h1:oUmdlHxdkXRJlwfG0O9omj8ukerm8MEQavSiDTEtBsk= github.com/raulk/go-watchdog v1.3.0/go.mod h1:fIvOnLbF0b0ZwkB9YU4mOW9Did//4vPZtDqv66NfsMU= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= @@ -1514,7 +1512,6 @@ golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191116160921-f9c825593386/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -1971,8 +1968,6 @@ google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cn google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/bsm/ratelimit.v1 v1.0.0-20160220154919-db14e161995a/go.mod h1:KF9sEfUPAXdG8Oev9e99iLGnl2uJMjc5B+4y3O7x610= -gopkg.in/cenkalti/backoff.v1 v1.1.0 h1:Arh75ttbsvlpVA7WtVpH4u9h6Zl46xuptxqLxPiSo4Y= -gopkg.in/cenkalti/backoff.v1 v1.1.0/go.mod h1:J6Vskwqd+OMVJl8C33mmtxTBs2gyzfv7UDAkHu8BrjI= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/proto/eth/service/BUILD.bazel b/proto/eth/service/BUILD.bazel deleted file mode 100644 index 675a5bc40..000000000 --- a/proto/eth/service/BUILD.bazel +++ /dev/null @@ -1,98 +0,0 @@ -load("@rules_proto//proto:defs.bzl", "proto_library") -load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") -load("@prysm//tools/go:def.bzl", "go_library") -load("@io_bazel_rules_go//proto:compiler.bzl", "go_proto_compiler") - -# gazelle:ignore -proto_library( - name = "proto", - srcs = [ - "events_service.proto", - ], - visibility = ["//visibility:public"], - deps = [ - "//proto/eth/ext:proto", - "//proto/eth/v1:proto", - "//proto/eth/v2:proto", - "@com_github_grpc_ecosystem_grpc_gateway_v2//proto/gateway:event_source_proto", - "@com_google_protobuf//:descriptor_proto", - "@com_google_protobuf//:empty_proto", - "@com_google_protobuf//:timestamp_proto", - "@googleapis//google/api:annotations_proto", - ], -) - -go_proto_library( - name = "go_proto", - compilers = ["@com_github_prysmaticlabs_protoc_gen_go_cast//:go_cast_grpc"], - importpath = "github.com/prysmaticlabs/prysm/v4/proto/eth/service", - proto = ":proto", - visibility = ["//visibility:public"], - deps = [ - "//consensus-types/primitives:go_default_library", - "//proto/eth/ext:go_default_library", - "//proto/eth/v1:go_default_library", - "//proto/eth/v2:go_default_library", - "@com_github_golang_protobuf//proto:go_default_library", - "@com_github_grpc_ecosystem_grpc_gateway_v2//proto/gateway:go_default_library", - "@googleapis//google/api:annotations_go_proto", - "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", - "@io_bazel_rules_go//proto/wkt:empty_go_proto", - "@org_golang_google_protobuf//types/descriptorpb:go_default_library", - "@org_golang_google_protobuf//types/known/emptypb:go_default_library", - ], -) - -go_proto_compiler( - name = "allow_delete_body_gateway_compiler", - options = [ - "logtostderr=true", - "allow_repeated_fields_in_body=true", - "allow_delete_body=true", - ], - plugin = "@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-grpc-gateway:protoc-gen-grpc-gateway", - suffix = ".pb.gw.go", - visibility = ["//visibility:public"], - deps = [ - "@com_github_grpc_ecosystem_grpc_gateway_v2//runtime:go_default_library", - "@com_github_grpc_ecosystem_grpc_gateway_v2//utilities:go_default_library", - "@org_golang_google_grpc//:go_default_library", - "@org_golang_google_grpc//codes:go_default_library", - "@org_golang_google_grpc//grpclog:go_default_library", - "@org_golang_google_grpc//metadata:go_default_library", - "@org_golang_google_grpc//status:go_default_library", - "@org_golang_google_protobuf//proto:go_default_library", - ], -) - -go_proto_library( - name = "go_grpc_gateway_library", - compilers = [ - "allow_delete_body_gateway_compiler", - ], - embed = [":go_proto"], - importpath = "github.com/prysmaticlabs/prysm/v4/proto/eth/service", - protos = [":proto"], - visibility = ["//proto:__subpackages__"], - deps = [ - "//proto/eth/ext:go_default_library", - "@com_github_grpc_ecosystem_grpc_gateway_v2//proto/gateway:go_default_library", - "@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2/options:options_go_proto", - "@com_github_prysmaticlabs_go_bitfield//:go_default_library", - "@googleapis//google/api:annotations_go_proto", - "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", - "@io_bazel_rules_go//proto/wkt:empty_go_proto", - "@io_bazel_rules_go//proto/wkt:timestamp_go_proto", - ], -) - -go_library( - name = "go_default_library", - embed = [":go_grpc_gateway_library"], - importpath = "github.com/prysmaticlabs/prysm/v4/proto/eth/service", - visibility = ["//visibility:public"], - deps = [ - "@org_golang_google_protobuf//types/descriptorpb", - "@org_golang_google_protobuf//types/known/emptypb", - ], -) diff --git a/proto/eth/service/events_service.pb.go b/proto/eth/service/events_service.pb.go deleted file mode 100755 index 17562da37..000000000 --- a/proto/eth/service/events_service.pb.go +++ /dev/null @@ -1,209 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.31.0 -// protoc v4.23.3 -// source: proto/eth/service/events_service.proto - -package service - -import ( - context "context" - reflect "reflect" - - gateway "github.com/grpc-ecosystem/grpc-gateway/v2/proto/gateway" - v1 "github.com/prysmaticlabs/prysm/v4/proto/eth/v1" - _ "google.golang.org/genproto/googleapis/api/annotations" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - _ "google.golang.org/protobuf/types/descriptorpb" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -var File_proto_eth_service_events_service_proto protoreflect.FileDescriptor - -var file_proto_eth_service_events_service_proto_rawDesc = []byte{ - 0x0a, 0x26, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x73, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, - 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x1a, 0x1c, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x76, 0x65, - 0x6e, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x77, 0x0a, 0x06, 0x45, - 0x76, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x6d, 0x0a, 0x0c, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x45, - 0x76, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x24, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, - 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x45, 0x76, - 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x67, 0x61, - 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x22, 0x1f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x12, 0x17, 0x2f, 0x69, 0x6e, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x76, 0x65, 0x6e, - 0x74, 0x73, 0x30, 0x01, 0x42, 0x93, 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, 0x12, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 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_events_service_proto_goTypes = []interface{}{ - (*v1.StreamEventsRequest)(nil), // 0: ethereum.eth.v1.StreamEventsRequest - (*gateway.EventSource)(nil), // 1: gateway.EventSource -} -var file_proto_eth_service_events_service_proto_depIdxs = []int32{ - 0, // 0: ethereum.eth.service.Events.StreamEvents:input_type -> ethereum.eth.v1.StreamEventsRequest - 1, // 1: ethereum.eth.service.Events.StreamEvents:output_type -> gateway.EventSource - 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 -} - -func init() { file_proto_eth_service_events_service_proto_init() } -func file_proto_eth_service_events_service_proto_init() { - if File_proto_eth_service_events_service_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_proto_eth_service_events_service_proto_rawDesc, - NumEnums: 0, - NumMessages: 0, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_proto_eth_service_events_service_proto_goTypes, - DependencyIndexes: file_proto_eth_service_events_service_proto_depIdxs, - }.Build() - File_proto_eth_service_events_service_proto = out.File - file_proto_eth_service_events_service_proto_rawDesc = nil - file_proto_eth_service_events_service_proto_goTypes = nil - file_proto_eth_service_events_service_proto_depIdxs = nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// EventsClient is the client API for Events service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type EventsClient interface { - StreamEvents(ctx context.Context, in *v1.StreamEventsRequest, opts ...grpc.CallOption) (Events_StreamEventsClient, error) -} - -type eventsClient struct { - cc grpc.ClientConnInterface -} - -func NewEventsClient(cc grpc.ClientConnInterface) EventsClient { - return &eventsClient{cc} -} - -func (c *eventsClient) StreamEvents(ctx context.Context, in *v1.StreamEventsRequest, opts ...grpc.CallOption) (Events_StreamEventsClient, error) { - stream, err := c.cc.NewStream(ctx, &_Events_serviceDesc.Streams[0], "/ethereum.eth.service.Events/StreamEvents", opts...) - if err != nil { - return nil, err - } - x := &eventsStreamEventsClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Events_StreamEventsClient interface { - Recv() (*gateway.EventSource, error) - grpc.ClientStream -} - -type eventsStreamEventsClient struct { - grpc.ClientStream -} - -func (x *eventsStreamEventsClient) Recv() (*gateway.EventSource, error) { - m := new(gateway.EventSource) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// EventsServer is the server API for Events service. -type EventsServer interface { - StreamEvents(*v1.StreamEventsRequest, Events_StreamEventsServer) error -} - -// UnimplementedEventsServer can be embedded to have forward compatible implementations. -type UnimplementedEventsServer struct { -} - -func (*UnimplementedEventsServer) StreamEvents(*v1.StreamEventsRequest, Events_StreamEventsServer) error { - return status.Errorf(codes.Unimplemented, "method StreamEvents not implemented") -} - -func RegisterEventsServer(s *grpc.Server, srv EventsServer) { - s.RegisterService(&_Events_serviceDesc, srv) -} - -func _Events_StreamEvents_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(v1.StreamEventsRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(EventsServer).StreamEvents(m, &eventsStreamEventsServer{stream}) -} - -type Events_StreamEventsServer interface { - Send(*gateway.EventSource) error - grpc.ServerStream -} - -type eventsStreamEventsServer struct { - grpc.ServerStream -} - -func (x *eventsStreamEventsServer) Send(m *gateway.EventSource) error { - return x.ServerStream.SendMsg(m) -} - -var _Events_serviceDesc = grpc.ServiceDesc{ - ServiceName: "ethereum.eth.service.Events", - HandlerType: (*EventsServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{ - { - StreamName: "StreamEvents", - Handler: _Events_StreamEvents_Handler, - ServerStreams: true, - }, - }, - Metadata: "proto/eth/service/events_service.proto", -} diff --git a/proto/eth/service/events_service.pb.gw.go b/proto/eth/service/events_service.pb.gw.go deleted file mode 100755 index d7b3bcee6..000000000 --- a/proto/eth/service/events_service.pb.gw.go +++ /dev/null @@ -1,150 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: proto/eth/service/events_service.proto - -/* -Package service is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package service - -import ( - "context" - "io" - "net/http" - - "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" - github_com_prysmaticlabs_prysm_v4_consensus_types_primitives "github.com/prysmaticlabs/prysm/v4/consensus-types/primitives" - v1 "github.com/prysmaticlabs/prysm/v4/proto/eth/v1" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/status" - "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/types/known/emptypb" -) - -// Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = metadata.Join -var _ = github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.Epoch(0) -var _ = emptypb.Empty{} - -var ( - filter_Events_StreamEvents_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_Events_StreamEvents_0(ctx context.Context, marshaler runtime.Marshaler, client EventsClient, req *http.Request, pathParams map[string]string) (Events_StreamEventsClient, runtime.ServerMetadata, error) { - var protoReq v1.StreamEventsRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Events_StreamEvents_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - stream, err := client.StreamEvents(ctx, &protoReq) - if err != nil { - return nil, metadata, err - } - header, err := stream.Header() - if err != nil { - return nil, metadata, err - } - metadata.HeaderMD = header - return stream, metadata, nil - -} - -// RegisterEventsHandlerServer registers the http handlers for service Events to "mux". -// UnaryRPC :call EventsServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterEventsHandlerFromEndpoint instead. -func RegisterEventsHandlerServer(ctx context.Context, mux *runtime.ServeMux, server EventsServer) error { - - mux.Handle("GET", pattern_Events_StreamEvents_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") - _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - }) - - return nil -} - -// RegisterEventsHandlerFromEndpoint is same as RegisterEventsHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterEventsHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.Dial(endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - - return RegisterEventsHandler(ctx, mux, conn) -} - -// RegisterEventsHandler registers the http handlers for service Events to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterEventsHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterEventsHandlerClient(ctx, mux, NewEventsClient(conn)) -} - -// RegisterEventsHandlerClient registers the http handlers for service Events -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "EventsClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "EventsClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "EventsClient" to call the correct interceptors. -func RegisterEventsHandlerClient(ctx context.Context, mux *runtime.ServeMux, client EventsClient) error { - - mux.Handle("GET", pattern_Events_StreamEvents_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.Events/StreamEvents") - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Events_StreamEvents_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Events_StreamEvents_0(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -var ( - pattern_Events_StreamEvents_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"internal", "eth", "v1", "events"}, "")) -) - -var ( - forward_Events_StreamEvents_0 = runtime.ForwardResponseStream -) diff --git a/proto/eth/service/events_service.proto b/proto/eth/service/events_service.proto deleted file mode 100644 index 1217b3459..000000000 --- a/proto/eth/service/events_service.proto +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2020 Prysmatic Labs. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -syntax = "proto3"; - -package ethereum.eth.service; - -import "google/api/annotations.proto"; -import "google/protobuf/descriptor.proto"; - -import "proto/eth/v1/events.proto"; -import "proto/gateway/event_source.proto"; - -option csharp_namespace = "Ethereum.Eth.Service"; -option go_package = "github.com/prysmaticlabs/prysm/v4/proto/eth/service"; -option java_multiple_files = true; -option java_outer_classname = "EventsServiceProto"; -option java_package = "org.ethereum.eth.service"; -option php_namespace = "Ethereum\\Eth\\Service"; - -// Events API -// -// This service is defined in the upstream Ethereum consensus APIs repository (beacon-apis/apis/debug). -service Events { - // Provides endpoint to subscribe to beacon node Server-Sent-Events stream. Consumers should use eventsource implementation to listen on those events. - // Servers may send SSE comments beginning with : for any purpose, including to keep the event stream connection alive in the presence of proxy servers. - // - // Spec: https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.3.0#/Events/eventstream - rpc StreamEvents(v1.StreamEventsRequest) returns (stream gateway.EventSource) { - option (google.api.http) = { - get: "/internal/eth/v1/events" - }; - } -} diff --git a/proto/eth/service/key_management.pb.go b/proto/eth/service/key_management.pb.go deleted file mode 100755 index d56f64fb6..000000000 --- a/proto/eth/service/key_management.pb.go +++ /dev/null @@ -1,1054 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.31.0 -// protoc v4.23.3 -// source: proto/eth/service/key_management.proto - -package service - -import ( - context "context" - reflect "reflect" - sync "sync" - - _ "google.golang.org/genproto/googleapis/api/annotations" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - _ "google.golang.org/protobuf/types/descriptorpb" - emptypb "google.golang.org/protobuf/types/known/emptypb" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type ImportedKeystoreStatus_Status int32 - -const ( - ImportedKeystoreStatus_IMPORTED ImportedKeystoreStatus_Status = 0 - ImportedKeystoreStatus_DUPLICATE ImportedKeystoreStatus_Status = 1 - ImportedKeystoreStatus_ERROR ImportedKeystoreStatus_Status = 2 -) - -// Enum value maps for ImportedKeystoreStatus_Status. -var ( - ImportedKeystoreStatus_Status_name = map[int32]string{ - 0: "IMPORTED", - 1: "DUPLICATE", - 2: "ERROR", - } - ImportedKeystoreStatus_Status_value = map[string]int32{ - "IMPORTED": 0, - "DUPLICATE": 1, - "ERROR": 2, - } -) - -func (x ImportedKeystoreStatus_Status) Enum() *ImportedKeystoreStatus_Status { - p := new(ImportedKeystoreStatus_Status) - *p = x - return p -} - -func (x ImportedKeystoreStatus_Status) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (ImportedKeystoreStatus_Status) Descriptor() protoreflect.EnumDescriptor { - return file_proto_eth_service_key_management_proto_enumTypes[0].Descriptor() -} - -func (ImportedKeystoreStatus_Status) Type() protoreflect.EnumType { - return &file_proto_eth_service_key_management_proto_enumTypes[0] -} - -func (x ImportedKeystoreStatus_Status) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use ImportedKeystoreStatus_Status.Descriptor instead. -func (ImportedKeystoreStatus_Status) EnumDescriptor() ([]byte, []int) { - return file_proto_eth_service_key_management_proto_rawDescGZIP(), []int{5, 0} -} - -type DeletedKeystoreStatus_Status int32 - -const ( - DeletedKeystoreStatus_DELETED DeletedKeystoreStatus_Status = 0 - DeletedKeystoreStatus_NOT_FOUND DeletedKeystoreStatus_Status = 1 - DeletedKeystoreStatus_NOT_ACTIVE DeletedKeystoreStatus_Status = 2 - DeletedKeystoreStatus_ERROR DeletedKeystoreStatus_Status = 3 -) - -// Enum value maps for DeletedKeystoreStatus_Status. -var ( - DeletedKeystoreStatus_Status_name = map[int32]string{ - 0: "DELETED", - 1: "NOT_FOUND", - 2: "NOT_ACTIVE", - 3: "ERROR", - } - DeletedKeystoreStatus_Status_value = map[string]int32{ - "DELETED": 0, - "NOT_FOUND": 1, - "NOT_ACTIVE": 2, - "ERROR": 3, - } -) - -func (x DeletedKeystoreStatus_Status) Enum() *DeletedKeystoreStatus_Status { - p := new(DeletedKeystoreStatus_Status) - *p = x - return p -} - -func (x DeletedKeystoreStatus_Status) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (DeletedKeystoreStatus_Status) Descriptor() protoreflect.EnumDescriptor { - return file_proto_eth_service_key_management_proto_enumTypes[1].Descriptor() -} - -func (DeletedKeystoreStatus_Status) Type() protoreflect.EnumType { - return &file_proto_eth_service_key_management_proto_enumTypes[1] -} - -func (x DeletedKeystoreStatus_Status) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use DeletedKeystoreStatus_Status.Descriptor instead. -func (DeletedKeystoreStatus_Status) EnumDescriptor() ([]byte, []int) { - return file_proto_eth_service_key_management_proto_rawDescGZIP(), []int{6, 0} -} - -type ListKeystoresResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Data []*ListKeystoresResponse_Keystore `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"` -} - -func (x *ListKeystoresResponse) Reset() { - *x = ListKeystoresResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_eth_service_key_management_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ListKeystoresResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListKeystoresResponse) ProtoMessage() {} - -func (x *ListKeystoresResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_eth_service_key_management_proto_msgTypes[0] - 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 ListKeystoresResponse.ProtoReflect.Descriptor instead. -func (*ListKeystoresResponse) Descriptor() ([]byte, []int) { - return file_proto_eth_service_key_management_proto_rawDescGZIP(), []int{0} -} - -func (x *ListKeystoresResponse) GetData() []*ListKeystoresResponse_Keystore { - if x != nil { - return x.Data - } - return nil -} - -type ImportKeystoresRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Keystores []string `protobuf:"bytes,1,rep,name=keystores,proto3" json:"keystores,omitempty"` - Passwords []string `protobuf:"bytes,2,rep,name=passwords,proto3" json:"passwords,omitempty"` - SlashingProtection string `protobuf:"bytes,3,opt,name=slashing_protection,json=slashingProtection,proto3" json:"slashing_protection,omitempty"` -} - -func (x *ImportKeystoresRequest) Reset() { - *x = ImportKeystoresRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_eth_service_key_management_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ImportKeystoresRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ImportKeystoresRequest) ProtoMessage() {} - -func (x *ImportKeystoresRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_eth_service_key_management_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 ImportKeystoresRequest.ProtoReflect.Descriptor instead. -func (*ImportKeystoresRequest) Descriptor() ([]byte, []int) { - return file_proto_eth_service_key_management_proto_rawDescGZIP(), []int{1} -} - -func (x *ImportKeystoresRequest) GetKeystores() []string { - if x != nil { - return x.Keystores - } - return nil -} - -func (x *ImportKeystoresRequest) GetPasswords() []string { - if x != nil { - return x.Passwords - } - return nil -} - -func (x *ImportKeystoresRequest) GetSlashingProtection() string { - if x != nil { - return x.SlashingProtection - } - return "" -} - -type ImportKeystoresResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Data []*ImportedKeystoreStatus `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"` -} - -func (x *ImportKeystoresResponse) Reset() { - *x = ImportKeystoresResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_eth_service_key_management_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ImportKeystoresResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ImportKeystoresResponse) ProtoMessage() {} - -func (x *ImportKeystoresResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_eth_service_key_management_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 ImportKeystoresResponse.ProtoReflect.Descriptor instead. -func (*ImportKeystoresResponse) Descriptor() ([]byte, []int) { - return file_proto_eth_service_key_management_proto_rawDescGZIP(), []int{2} -} - -func (x *ImportKeystoresResponse) GetData() []*ImportedKeystoreStatus { - if x != nil { - return x.Data - } - return nil -} - -type DeleteKeystoresRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Pubkeys [][]byte `protobuf:"bytes,1,rep,name=pubkeys,proto3" json:"pubkeys,omitempty"` -} - -func (x *DeleteKeystoresRequest) Reset() { - *x = DeleteKeystoresRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_eth_service_key_management_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DeleteKeystoresRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteKeystoresRequest) ProtoMessage() {} - -func (x *DeleteKeystoresRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_eth_service_key_management_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 DeleteKeystoresRequest.ProtoReflect.Descriptor instead. -func (*DeleteKeystoresRequest) Descriptor() ([]byte, []int) { - return file_proto_eth_service_key_management_proto_rawDescGZIP(), []int{3} -} - -func (x *DeleteKeystoresRequest) GetPubkeys() [][]byte { - if x != nil { - return x.Pubkeys - } - return nil -} - -type DeleteKeystoresResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Data []*DeletedKeystoreStatus `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"` - SlashingProtection string `protobuf:"bytes,2,opt,name=slashing_protection,json=slashingProtection,proto3" json:"slashing_protection,omitempty"` -} - -func (x *DeleteKeystoresResponse) Reset() { - *x = DeleteKeystoresResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_eth_service_key_management_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DeleteKeystoresResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteKeystoresResponse) ProtoMessage() {} - -func (x *DeleteKeystoresResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_eth_service_key_management_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 DeleteKeystoresResponse.ProtoReflect.Descriptor instead. -func (*DeleteKeystoresResponse) Descriptor() ([]byte, []int) { - return file_proto_eth_service_key_management_proto_rawDescGZIP(), []int{4} -} - -func (x *DeleteKeystoresResponse) GetData() []*DeletedKeystoreStatus { - if x != nil { - return x.Data - } - return nil -} - -func (x *DeleteKeystoresResponse) GetSlashingProtection() string { - if x != nil { - return x.SlashingProtection - } - return "" -} - -type ImportedKeystoreStatus struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Status ImportedKeystoreStatus_Status `protobuf:"varint,1,opt,name=status,proto3,enum=ethereum.eth.service.ImportedKeystoreStatus_Status" json:"status,omitempty"` - Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` -} - -func (x *ImportedKeystoreStatus) Reset() { - *x = ImportedKeystoreStatus{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_eth_service_key_management_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ImportedKeystoreStatus) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ImportedKeystoreStatus) ProtoMessage() {} - -func (x *ImportedKeystoreStatus) ProtoReflect() protoreflect.Message { - mi := &file_proto_eth_service_key_management_proto_msgTypes[5] - 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 ImportedKeystoreStatus.ProtoReflect.Descriptor instead. -func (*ImportedKeystoreStatus) Descriptor() ([]byte, []int) { - return file_proto_eth_service_key_management_proto_rawDescGZIP(), []int{5} -} - -func (x *ImportedKeystoreStatus) GetStatus() ImportedKeystoreStatus_Status { - if x != nil { - return x.Status - } - return ImportedKeystoreStatus_IMPORTED -} - -func (x *ImportedKeystoreStatus) GetMessage() string { - if x != nil { - return x.Message - } - return "" -} - -type DeletedKeystoreStatus struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Status DeletedKeystoreStatus_Status `protobuf:"varint,1,opt,name=status,proto3,enum=ethereum.eth.service.DeletedKeystoreStatus_Status" json:"status,omitempty"` - Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` -} - -func (x *DeletedKeystoreStatus) Reset() { - *x = DeletedKeystoreStatus{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_eth_service_key_management_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DeletedKeystoreStatus) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeletedKeystoreStatus) ProtoMessage() {} - -func (x *DeletedKeystoreStatus) ProtoReflect() protoreflect.Message { - mi := &file_proto_eth_service_key_management_proto_msgTypes[6] - 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 DeletedKeystoreStatus.ProtoReflect.Descriptor instead. -func (*DeletedKeystoreStatus) Descriptor() ([]byte, []int) { - return file_proto_eth_service_key_management_proto_rawDescGZIP(), []int{6} -} - -func (x *DeletedKeystoreStatus) GetStatus() DeletedKeystoreStatus_Status { - if x != nil { - return x.Status - } - return DeletedKeystoreStatus_DELETED -} - -func (x *DeletedKeystoreStatus) GetMessage() string { - if x != nil { - return x.Message - } - return "" -} - -type PubkeyRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Pubkey []byte `protobuf:"bytes,1,opt,name=pubkey,proto3" json:"pubkey,omitempty"` -} - -func (x *PubkeyRequest) Reset() { - *x = PubkeyRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_eth_service_key_management_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PubkeyRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PubkeyRequest) ProtoMessage() {} - -func (x *PubkeyRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_eth_service_key_management_proto_msgTypes[7] - 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 PubkeyRequest.ProtoReflect.Descriptor instead. -func (*PubkeyRequest) Descriptor() ([]byte, []int) { - return file_proto_eth_service_key_management_proto_rawDescGZIP(), []int{7} -} - -func (x *PubkeyRequest) GetPubkey() []byte { - if x != nil { - return x.Pubkey - } - return nil -} - -type ListKeystoresResponse_Keystore struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ValidatingPubkey []byte `protobuf:"bytes,1,opt,name=validating_pubkey,json=validatingPubkey,proto3" json:"validating_pubkey,omitempty"` - DerivationPath string `protobuf:"bytes,2,opt,name=derivation_path,json=derivationPath,proto3" json:"derivation_path,omitempty"` -} - -func (x *ListKeystoresResponse_Keystore) Reset() { - *x = ListKeystoresResponse_Keystore{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_eth_service_key_management_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ListKeystoresResponse_Keystore) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListKeystoresResponse_Keystore) ProtoMessage() {} - -func (x *ListKeystoresResponse_Keystore) ProtoReflect() protoreflect.Message { - mi := &file_proto_eth_service_key_management_proto_msgTypes[8] - 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 ListKeystoresResponse_Keystore.ProtoReflect.Descriptor instead. -func (*ListKeystoresResponse_Keystore) Descriptor() ([]byte, []int) { - return file_proto_eth_service_key_management_proto_rawDescGZIP(), []int{0, 0} -} - -func (x *ListKeystoresResponse_Keystore) GetValidatingPubkey() []byte { - if x != nil { - return x.ValidatingPubkey - } - return nil -} - -func (x *ListKeystoresResponse_Keystore) GetDerivationPath() string { - if x != nil { - return x.DerivationPath - } - return "" -} - -var File_proto_eth_service_key_management_proto protoreflect.FileDescriptor - -var file_proto_eth_service_key_management_proto_rawDesc = []byte{ - 0x0a, 0x26, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x73, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x2f, 0x6b, 0x65, 0x79, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, - 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x1a, 0x1c, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, - 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc3, 0x01, 0x0a, 0x15, - 0x4c, 0x69, 0x73, 0x74, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, - 0x74, 0x68, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4b, - 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x2e, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x1a, - 0x60, 0x0a, 0x08, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x2b, 0x0a, 0x11, 0x76, - 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x70, 0x75, 0x62, 0x6b, 0x65, 0x79, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x10, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, - 0x6e, 0x67, 0x50, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x12, 0x27, 0x0a, 0x0f, 0x64, 0x65, 0x72, 0x69, - 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0e, 0x64, 0x65, 0x72, 0x69, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x61, 0x74, - 0x68, 0x22, 0x85, 0x01, 0x0a, 0x16, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x4b, 0x65, 0x79, 0x73, - 0x74, 0x6f, 0x72, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, - 0x6b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, - 0x09, 0x6b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x61, - 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x70, - 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x73, 0x12, 0x2f, 0x0a, 0x13, 0x73, 0x6c, 0x61, 0x73, - 0x68, 0x69, 0x6e, 0x67, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x50, - 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x5b, 0x0a, 0x17, 0x49, 0x6d, 0x70, - 0x6f, 0x72, 0x74, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, - 0x68, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, - 0x65, 0x64, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x32, 0x0a, 0x16, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, - 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x18, 0x0a, 0x07, 0x70, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0c, 0x52, 0x07, 0x70, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x73, 0x22, 0x8b, 0x01, 0x0a, 0x17, 0x44, - 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, - 0x65, 0x74, 0x68, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x44, 0x65, 0x6c, 0x65, - 0x74, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x2f, 0x0a, 0x13, 0x73, 0x6c, 0x61, 0x73, 0x68, - 0x69, 0x6e, 0x67, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x50, 0x72, - 0x6f, 0x74, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xb1, 0x01, 0x0a, 0x16, 0x49, 0x6d, 0x70, - 0x6f, 0x72, 0x74, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x12, 0x4b, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x33, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, - 0x74, 0x68, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x49, 0x6d, 0x70, 0x6f, 0x72, - 0x74, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x30, 0x0a, 0x06, 0x53, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x12, 0x0c, 0x0a, 0x08, 0x49, 0x4d, 0x50, 0x4f, 0x52, 0x54, 0x45, 0x44, - 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x44, 0x55, 0x50, 0x4c, 0x49, 0x43, 0x41, 0x54, 0x45, 0x10, - 0x01, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x02, 0x22, 0xbe, 0x01, 0x0a, - 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x4a, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x32, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, - 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x3f, 0x0a, 0x06, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0b, 0x0a, 0x07, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, - 0x44, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, - 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x4e, 0x4f, 0x54, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, - 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x03, 0x22, 0x27, 0x0a, - 0x0d, 0x50, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, - 0x0a, 0x06, 0x70, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, - 0x70, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x32, 0xb9, 0x03, 0x0a, 0x0d, 0x4b, 0x65, 0x79, 0x4d, 0x61, - 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x78, 0x0a, 0x0d, 0x4c, 0x69, 0x73, 0x74, - 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 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, 0x2b, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, - 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4b, 0x65, 0x79, - 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x22, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x12, 0x1a, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, - 0x6c, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, - 0x65, 0x73, 0x12, 0x95, 0x01, 0x0a, 0x0f, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x4b, 0x65, 0x79, - 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x12, 0x2c, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, - 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x49, 0x6d, - 0x70, 0x6f, 0x72, 0x74, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, - 0x65, 0x74, 0x68, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x49, 0x6d, 0x70, 0x6f, - 0x72, 0x74, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x25, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x3a, 0x01, 0x2a, 0x22, 0x1a, - 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, - 0x2f, 0x6b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x12, 0x95, 0x01, 0x0a, 0x0f, 0x44, - 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x12, 0x2c, - 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x73, - 0x74, 0x6f, 0x72, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x65, - 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x73, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, - 0x72, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x25, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x1f, 0x3a, 0x01, 0x2a, 0x2a, 0x1a, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, - 0x6c, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, - 0x65, 0x73, 0x42, 0x9a, 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, - 0x19, 0x4b, 0x65, 0x79, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 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_key_management_proto_rawDescOnce sync.Once - file_proto_eth_service_key_management_proto_rawDescData = file_proto_eth_service_key_management_proto_rawDesc -) - -func file_proto_eth_service_key_management_proto_rawDescGZIP() []byte { - file_proto_eth_service_key_management_proto_rawDescOnce.Do(func() { - file_proto_eth_service_key_management_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_eth_service_key_management_proto_rawDescData) - }) - return file_proto_eth_service_key_management_proto_rawDescData -} - -var file_proto_eth_service_key_management_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_proto_eth_service_key_management_proto_msgTypes = make([]protoimpl.MessageInfo, 9) -var file_proto_eth_service_key_management_proto_goTypes = []interface{}{ - (ImportedKeystoreStatus_Status)(0), // 0: ethereum.eth.service.ImportedKeystoreStatus.Status - (DeletedKeystoreStatus_Status)(0), // 1: ethereum.eth.service.DeletedKeystoreStatus.Status - (*ListKeystoresResponse)(nil), // 2: ethereum.eth.service.ListKeystoresResponse - (*ImportKeystoresRequest)(nil), // 3: ethereum.eth.service.ImportKeystoresRequest - (*ImportKeystoresResponse)(nil), // 4: ethereum.eth.service.ImportKeystoresResponse - (*DeleteKeystoresRequest)(nil), // 5: ethereum.eth.service.DeleteKeystoresRequest - (*DeleteKeystoresResponse)(nil), // 6: ethereum.eth.service.DeleteKeystoresResponse - (*ImportedKeystoreStatus)(nil), // 7: ethereum.eth.service.ImportedKeystoreStatus - (*DeletedKeystoreStatus)(nil), // 8: ethereum.eth.service.DeletedKeystoreStatus - (*PubkeyRequest)(nil), // 9: ethereum.eth.service.PubkeyRequest - (*ListKeystoresResponse_Keystore)(nil), // 10: ethereum.eth.service.ListKeystoresResponse.Keystore - (*emptypb.Empty)(nil), // 11: google.protobuf.Empty -} -var file_proto_eth_service_key_management_proto_depIdxs = []int32{ - 10, // 0: ethereum.eth.service.ListKeystoresResponse.data:type_name -> ethereum.eth.service.ListKeystoresResponse.Keystore - 7, // 1: ethereum.eth.service.ImportKeystoresResponse.data:type_name -> ethereum.eth.service.ImportedKeystoreStatus - 8, // 2: ethereum.eth.service.DeleteKeystoresResponse.data:type_name -> ethereum.eth.service.DeletedKeystoreStatus - 0, // 3: ethereum.eth.service.ImportedKeystoreStatus.status:type_name -> ethereum.eth.service.ImportedKeystoreStatus.Status - 1, // 4: ethereum.eth.service.DeletedKeystoreStatus.status:type_name -> ethereum.eth.service.DeletedKeystoreStatus.Status - 11, // 5: ethereum.eth.service.KeyManagement.ListKeystores:input_type -> google.protobuf.Empty - 3, // 6: ethereum.eth.service.KeyManagement.ImportKeystores:input_type -> ethereum.eth.service.ImportKeystoresRequest - 5, // 7: ethereum.eth.service.KeyManagement.DeleteKeystores:input_type -> ethereum.eth.service.DeleteKeystoresRequest - 2, // 8: ethereum.eth.service.KeyManagement.ListKeystores:output_type -> ethereum.eth.service.ListKeystoresResponse - 4, // 9: ethereum.eth.service.KeyManagement.ImportKeystores:output_type -> ethereum.eth.service.ImportKeystoresResponse - 6, // 10: ethereum.eth.service.KeyManagement.DeleteKeystores:output_type -> ethereum.eth.service.DeleteKeystoresResponse - 8, // [8:11] is the sub-list for method output_type - 5, // [5:8] 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 -} - -func init() { file_proto_eth_service_key_management_proto_init() } -func file_proto_eth_service_key_management_proto_init() { - if File_proto_eth_service_key_management_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_proto_eth_service_key_management_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListKeystoresResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_eth_service_key_management_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ImportKeystoresRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_eth_service_key_management_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ImportKeystoresResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_eth_service_key_management_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteKeystoresRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_eth_service_key_management_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteKeystoresResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_eth_service_key_management_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ImportedKeystoreStatus); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_eth_service_key_management_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeletedKeystoreStatus); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_eth_service_key_management_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PubkeyRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_eth_service_key_management_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListKeystoresResponse_Keystore); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_proto_eth_service_key_management_proto_rawDesc, - NumEnums: 2, - NumMessages: 9, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_proto_eth_service_key_management_proto_goTypes, - DependencyIndexes: file_proto_eth_service_key_management_proto_depIdxs, - EnumInfos: file_proto_eth_service_key_management_proto_enumTypes, - MessageInfos: file_proto_eth_service_key_management_proto_msgTypes, - }.Build() - File_proto_eth_service_key_management_proto = out.File - file_proto_eth_service_key_management_proto_rawDesc = nil - file_proto_eth_service_key_management_proto_goTypes = nil - file_proto_eth_service_key_management_proto_depIdxs = nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// KeyManagementClient is the client API for KeyManagement service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type KeyManagementClient interface { - ListKeystores(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*ListKeystoresResponse, error) - ImportKeystores(ctx context.Context, in *ImportKeystoresRequest, opts ...grpc.CallOption) (*ImportKeystoresResponse, error) - DeleteKeystores(ctx context.Context, in *DeleteKeystoresRequest, opts ...grpc.CallOption) (*DeleteKeystoresResponse, error) -} - -type keyManagementClient struct { - cc grpc.ClientConnInterface -} - -func NewKeyManagementClient(cc grpc.ClientConnInterface) KeyManagementClient { - return &keyManagementClient{cc} -} - -func (c *keyManagementClient) ListKeystores(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*ListKeystoresResponse, error) { - out := new(ListKeystoresResponse) - err := c.cc.Invoke(ctx, "/ethereum.eth.service.KeyManagement/ListKeystores", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *keyManagementClient) ImportKeystores(ctx context.Context, in *ImportKeystoresRequest, opts ...grpc.CallOption) (*ImportKeystoresResponse, error) { - out := new(ImportKeystoresResponse) - err := c.cc.Invoke(ctx, "/ethereum.eth.service.KeyManagement/ImportKeystores", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *keyManagementClient) DeleteKeystores(ctx context.Context, in *DeleteKeystoresRequest, opts ...grpc.CallOption) (*DeleteKeystoresResponse, error) { - out := new(DeleteKeystoresResponse) - err := c.cc.Invoke(ctx, "/ethereum.eth.service.KeyManagement/DeleteKeystores", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// KeyManagementServer is the server API for KeyManagement service. -type KeyManagementServer interface { - ListKeystores(context.Context, *emptypb.Empty) (*ListKeystoresResponse, error) - ImportKeystores(context.Context, *ImportKeystoresRequest) (*ImportKeystoresResponse, error) - DeleteKeystores(context.Context, *DeleteKeystoresRequest) (*DeleteKeystoresResponse, error) -} - -// UnimplementedKeyManagementServer can be embedded to have forward compatible implementations. -type UnimplementedKeyManagementServer struct { -} - -func (*UnimplementedKeyManagementServer) ListKeystores(context.Context, *emptypb.Empty) (*ListKeystoresResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ListKeystores not implemented") -} -func (*UnimplementedKeyManagementServer) ImportKeystores(context.Context, *ImportKeystoresRequest) (*ImportKeystoresResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ImportKeystores not implemented") -} -func (*UnimplementedKeyManagementServer) DeleteKeystores(context.Context, *DeleteKeystoresRequest) (*DeleteKeystoresResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DeleteKeystores not implemented") -} - -func RegisterKeyManagementServer(s *grpc.Server, srv KeyManagementServer) { - s.RegisterService(&_KeyManagement_serviceDesc, srv) -} - -func _KeyManagement_ListKeystores_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.(KeyManagementServer).ListKeystores(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ethereum.eth.service.KeyManagement/ListKeystores", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(KeyManagementServer).ListKeystores(ctx, req.(*emptypb.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _KeyManagement_ImportKeystores_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ImportKeystoresRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(KeyManagementServer).ImportKeystores(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ethereum.eth.service.KeyManagement/ImportKeystores", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(KeyManagementServer).ImportKeystores(ctx, req.(*ImportKeystoresRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _KeyManagement_DeleteKeystores_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteKeystoresRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(KeyManagementServer).DeleteKeystores(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ethereum.eth.service.KeyManagement/DeleteKeystores", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(KeyManagementServer).DeleteKeystores(ctx, req.(*DeleteKeystoresRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _KeyManagement_serviceDesc = grpc.ServiceDesc{ - ServiceName: "ethereum.eth.service.KeyManagement", - HandlerType: (*KeyManagementServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "ListKeystores", - Handler: _KeyManagement_ListKeystores_Handler, - }, - { - MethodName: "ImportKeystores", - Handler: _KeyManagement_ImportKeystores_Handler, - }, - { - MethodName: "DeleteKeystores", - Handler: _KeyManagement_DeleteKeystores_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "proto/eth/service/key_management.proto", -} diff --git a/proto/eth/service/key_management.pb.gw.go b/proto/eth/service/key_management.pb.gw.go deleted file mode 100755 index 54a76e36e..000000000 --- a/proto/eth/service/key_management.pb.gw.go +++ /dev/null @@ -1,317 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: proto/eth/service/key_management.proto - -/* -Package service is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package service - -import ( - "context" - "io" - "net/http" - - "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" - github_com_prysmaticlabs_prysm_v4_consensus_types_primitives "github.com/prysmaticlabs/prysm/v4/consensus-types/primitives" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/status" - "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/types/known/emptypb" -) - -// Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = metadata.Join -var _ = github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.Epoch(0) -var _ = emptypb.Empty{} - -func request_KeyManagement_ListKeystores_0(ctx context.Context, marshaler runtime.Marshaler, client KeyManagementClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq emptypb.Empty - var metadata runtime.ServerMetadata - - msg, err := client.ListKeystores(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_KeyManagement_ListKeystores_0(ctx context.Context, marshaler runtime.Marshaler, server KeyManagementServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq emptypb.Empty - var metadata runtime.ServerMetadata - - msg, err := server.ListKeystores(ctx, &protoReq) - return msg, metadata, err - -} - -func request_KeyManagement_ImportKeystores_0(ctx context.Context, marshaler runtime.Marshaler, client KeyManagementClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ImportKeystoresRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.ImportKeystores(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_KeyManagement_ImportKeystores_0(ctx context.Context, marshaler runtime.Marshaler, server KeyManagementServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ImportKeystoresRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.ImportKeystores(ctx, &protoReq) - return msg, metadata, err - -} - -func request_KeyManagement_DeleteKeystores_0(ctx context.Context, marshaler runtime.Marshaler, client KeyManagementClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq DeleteKeystoresRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.DeleteKeystores(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_KeyManagement_DeleteKeystores_0(ctx context.Context, marshaler runtime.Marshaler, server KeyManagementServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq DeleteKeystoresRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.DeleteKeystores(ctx, &protoReq) - return msg, metadata, err - -} - -// RegisterKeyManagementHandlerServer registers the http handlers for service KeyManagement to "mux". -// UnaryRPC :call KeyManagementServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterKeyManagementHandlerFromEndpoint instead. -func RegisterKeyManagementHandlerServer(ctx context.Context, mux *runtime.ServeMux, server KeyManagementServer) error { - - mux.Handle("GET", pattern_KeyManagement_ListKeystores_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.KeyManagement/ListKeystores") - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_KeyManagement_ListKeystores_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_KeyManagement_ListKeystores_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_KeyManagement_ImportKeystores_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.KeyManagement/ImportKeystores") - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_KeyManagement_ImportKeystores_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_KeyManagement_ImportKeystores_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("DELETE", pattern_KeyManagement_DeleteKeystores_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.KeyManagement/DeleteKeystores") - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_KeyManagement_DeleteKeystores_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_KeyManagement_DeleteKeystores_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -// RegisterKeyManagementHandlerFromEndpoint is same as RegisterKeyManagementHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterKeyManagementHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.Dial(endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - - return RegisterKeyManagementHandler(ctx, mux, conn) -} - -// RegisterKeyManagementHandler registers the http handlers for service KeyManagement to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterKeyManagementHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterKeyManagementHandlerClient(ctx, mux, NewKeyManagementClient(conn)) -} - -// RegisterKeyManagementHandlerClient registers the http handlers for service KeyManagement -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "KeyManagementClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "KeyManagementClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "KeyManagementClient" to call the correct interceptors. -func RegisterKeyManagementHandlerClient(ctx context.Context, mux *runtime.ServeMux, client KeyManagementClient) error { - - mux.Handle("GET", pattern_KeyManagement_ListKeystores_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.KeyManagement/ListKeystores") - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_KeyManagement_ListKeystores_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_KeyManagement_ListKeystores_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_KeyManagement_ImportKeystores_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.KeyManagement/ImportKeystores") - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_KeyManagement_ImportKeystores_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_KeyManagement_ImportKeystores_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("DELETE", pattern_KeyManagement_DeleteKeystores_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.KeyManagement/DeleteKeystores") - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_KeyManagement_DeleteKeystores_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_KeyManagement_DeleteKeystores_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -var ( - pattern_KeyManagement_ListKeystores_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"internal", "eth", "v1", "keystores"}, "")) - - pattern_KeyManagement_ImportKeystores_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"internal", "eth", "v1", "keystores"}, "")) - - pattern_KeyManagement_DeleteKeystores_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"internal", "eth", "v1", "keystores"}, "")) -) - -var ( - forward_KeyManagement_ListKeystores_0 = runtime.ForwardResponseMessage - - forward_KeyManagement_ImportKeystores_0 = runtime.ForwardResponseMessage - - forward_KeyManagement_DeleteKeystores_0 = runtime.ForwardResponseMessage -) diff --git a/proto/eth/v1/beacon_chain.pb.go b/proto/eth/v1/beacon_chain.pb.go index 43fa8394c..29aa0dcae 100755 --- a/proto/eth/v1/beacon_chain.pb.go +++ b/proto/eth/v1/beacon_chain.pb.go @@ -77,8 +77,6 @@ var file_proto_eth_v1_beacon_chain_proto_rawDesc = []byte{ 0x6f, 0x12, 0x0f, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x74, 0x68, 0x2f, - 0x76, 0x31, 0x2f, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 0x42, @@ -122,7 +120,6 @@ func file_proto_eth_v1_beacon_chain_proto_init() { if File_proto_eth_v1_beacon_chain_proto != nil { return } - file_proto_eth_v1_attestation_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 { diff --git a/proto/eth/v1/events.pb.go b/proto/eth/v1/events.pb.go index 8b1f50b35..39b512036 100755 --- a/proto/eth/v1/events.pb.go +++ b/proto/eth/v1/events.pb.go @@ -11,7 +11,7 @@ import ( sync "sync" github_com_prysmaticlabs_prysm_v4_consensus_types_primitives "github.com/prysmaticlabs/prysm/v4/consensus-types/primitives" - v1 "github.com/prysmaticlabs/prysm/v4/proto/engine/v1" + _ "github.com/prysmaticlabs/prysm/v4/proto/engine/v1" _ "github.com/prysmaticlabs/prysm/v4/proto/eth/ext" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -25,53 +25,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -type StreamEventsRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Topics []string `protobuf:"bytes,1,rep,name=topics,proto3" json:"topics,omitempty"` -} - -func (x *StreamEventsRequest) Reset() { - *x = StreamEventsRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_eth_v1_events_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *StreamEventsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StreamEventsRequest) ProtoMessage() {} - -func (x *StreamEventsRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_eth_v1_events_proto_msgTypes[0] - 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 StreamEventsRequest.ProtoReflect.Descriptor instead. -func (*StreamEventsRequest) Descriptor() ([]byte, []int) { - return file_proto_eth_v1_events_proto_rawDescGZIP(), []int{0} -} - -func (x *StreamEventsRequest) GetTopics() []string { - if x != nil { - return x.Topics - } - return nil -} - type EventHead struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -89,7 +42,7 @@ type EventHead struct { func (x *EventHead) Reset() { *x = EventHead{} if protoimpl.UnsafeEnabled { - mi := &file_proto_eth_v1_events_proto_msgTypes[1] + mi := &file_proto_eth_v1_events_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -102,7 +55,7 @@ func (x *EventHead) String() string { func (*EventHead) ProtoMessage() {} func (x *EventHead) ProtoReflect() protoreflect.Message { - mi := &file_proto_eth_v1_events_proto_msgTypes[1] + mi := &file_proto_eth_v1_events_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -115,7 +68,7 @@ func (x *EventHead) ProtoReflect() protoreflect.Message { // Deprecated: Use EventHead.ProtoReflect.Descriptor instead. func (*EventHead) Descriptor() ([]byte, []int) { - return file_proto_eth_v1_events_proto_rawDescGZIP(), []int{1} + return file_proto_eth_v1_events_proto_rawDescGZIP(), []int{0} } func (x *EventHead) GetSlot() github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.Slot { @@ -180,7 +133,7 @@ type EventBlock struct { func (x *EventBlock) Reset() { *x = EventBlock{} if protoimpl.UnsafeEnabled { - mi := &file_proto_eth_v1_events_proto_msgTypes[2] + mi := &file_proto_eth_v1_events_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -193,7 +146,7 @@ func (x *EventBlock) String() string { func (*EventBlock) ProtoMessage() {} func (x *EventBlock) ProtoReflect() protoreflect.Message { - mi := &file_proto_eth_v1_events_proto_msgTypes[2] + mi := &file_proto_eth_v1_events_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -206,7 +159,7 @@ func (x *EventBlock) ProtoReflect() protoreflect.Message { // Deprecated: Use EventBlock.ProtoReflect.Descriptor instead. func (*EventBlock) Descriptor() ([]byte, []int) { - return file_proto_eth_v1_events_proto_rawDescGZIP(), []int{2} + return file_proto_eth_v1_events_proto_rawDescGZIP(), []int{1} } func (x *EventBlock) GetSlot() github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.Slot { @@ -248,7 +201,7 @@ type EventChainReorg struct { func (x *EventChainReorg) Reset() { *x = EventChainReorg{} if protoimpl.UnsafeEnabled { - mi := &file_proto_eth_v1_events_proto_msgTypes[3] + mi := &file_proto_eth_v1_events_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -261,7 +214,7 @@ func (x *EventChainReorg) String() string { func (*EventChainReorg) ProtoMessage() {} func (x *EventChainReorg) ProtoReflect() protoreflect.Message { - mi := &file_proto_eth_v1_events_proto_msgTypes[3] + mi := &file_proto_eth_v1_events_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -274,7 +227,7 @@ func (x *EventChainReorg) ProtoReflect() protoreflect.Message { // Deprecated: Use EventChainReorg.ProtoReflect.Descriptor instead. func (*EventChainReorg) Descriptor() ([]byte, []int) { - return file_proto_eth_v1_events_proto_rawDescGZIP(), []int{3} + return file_proto_eth_v1_events_proto_rawDescGZIP(), []int{2} } func (x *EventChainReorg) GetSlot() github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.Slot { @@ -347,7 +300,7 @@ type EventFinalizedCheckpoint struct { func (x *EventFinalizedCheckpoint) Reset() { *x = EventFinalizedCheckpoint{} if protoimpl.UnsafeEnabled { - mi := &file_proto_eth_v1_events_proto_msgTypes[4] + mi := &file_proto_eth_v1_events_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -360,7 +313,7 @@ func (x *EventFinalizedCheckpoint) String() string { func (*EventFinalizedCheckpoint) ProtoMessage() {} func (x *EventFinalizedCheckpoint) ProtoReflect() protoreflect.Message { - mi := &file_proto_eth_v1_events_proto_msgTypes[4] + mi := &file_proto_eth_v1_events_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -373,7 +326,7 @@ func (x *EventFinalizedCheckpoint) ProtoReflect() protoreflect.Message { // Deprecated: Use EventFinalizedCheckpoint.ProtoReflect.Descriptor instead. func (*EventFinalizedCheckpoint) Descriptor() ([]byte, []int) { - return file_proto_eth_v1_events_proto_rawDescGZIP(), []int{4} + return file_proto_eth_v1_events_proto_rawDescGZIP(), []int{3} } func (x *EventFinalizedCheckpoint) GetBlock() []byte { @@ -404,369 +357,6 @@ func (x *EventFinalizedCheckpoint) GetExecutionOptimistic() bool { return false } -type EventPayloadAttributeV1 struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` - Data *EventPayloadAttributeV1_BasePayloadAttribute `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` -} - -func (x *EventPayloadAttributeV1) Reset() { - *x = EventPayloadAttributeV1{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_eth_v1_events_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *EventPayloadAttributeV1) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EventPayloadAttributeV1) ProtoMessage() {} - -func (x *EventPayloadAttributeV1) ProtoReflect() protoreflect.Message { - mi := &file_proto_eth_v1_events_proto_msgTypes[5] - 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 EventPayloadAttributeV1.ProtoReflect.Descriptor instead. -func (*EventPayloadAttributeV1) Descriptor() ([]byte, []int) { - return file_proto_eth_v1_events_proto_rawDescGZIP(), []int{5} -} - -func (x *EventPayloadAttributeV1) GetVersion() string { - if x != nil { - return x.Version - } - return "" -} - -func (x *EventPayloadAttributeV1) GetData() *EventPayloadAttributeV1_BasePayloadAttribute { - if x != nil { - return x.Data - } - return nil -} - -type EventPayloadAttributeV2 struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` - Data *EventPayloadAttributeV2_BasePayloadAttribute `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` -} - -func (x *EventPayloadAttributeV2) Reset() { - *x = EventPayloadAttributeV2{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_eth_v1_events_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *EventPayloadAttributeV2) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EventPayloadAttributeV2) ProtoMessage() {} - -func (x *EventPayloadAttributeV2) ProtoReflect() protoreflect.Message { - mi := &file_proto_eth_v1_events_proto_msgTypes[6] - 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 EventPayloadAttributeV2.ProtoReflect.Descriptor instead. -func (*EventPayloadAttributeV2) Descriptor() ([]byte, []int) { - return file_proto_eth_v1_events_proto_rawDescGZIP(), []int{6} -} - -func (x *EventPayloadAttributeV2) GetVersion() string { - if x != nil { - return x.Version - } - return "" -} - -func (x *EventPayloadAttributeV2) GetData() *EventPayloadAttributeV2_BasePayloadAttribute { - if x != nil { - return x.Data - } - return nil -} - -type EventBlobSidecar struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - BlockRoot []byte `protobuf:"bytes,1,opt,name=block_root,json=blockRoot,proto3" json:"block_root,omitempty" ssz-size:"32"` - Index uint64 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"` - Slot github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.Slot `protobuf:"varint,3,opt,name=slot,proto3" json:"slot,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives.Slot"` - VersionedHash []byte `protobuf:"bytes,4,opt,name=versioned_hash,json=versionedHash,proto3" json:"versioned_hash,omitempty" ssz-size:"32"` - KzgCommitment []byte `protobuf:"bytes,5,opt,name=kzg_commitment,json=kzgCommitment,proto3" json:"kzg_commitment,omitempty" ssz-size:"48"` -} - -func (x *EventBlobSidecar) Reset() { - *x = EventBlobSidecar{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_eth_v1_events_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *EventBlobSidecar) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EventBlobSidecar) ProtoMessage() {} - -func (x *EventBlobSidecar) ProtoReflect() protoreflect.Message { - mi := &file_proto_eth_v1_events_proto_msgTypes[7] - 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 EventBlobSidecar.ProtoReflect.Descriptor instead. -func (*EventBlobSidecar) Descriptor() ([]byte, []int) { - return file_proto_eth_v1_events_proto_rawDescGZIP(), []int{7} -} - -func (x *EventBlobSidecar) GetBlockRoot() []byte { - if x != nil { - return x.BlockRoot - } - return nil -} - -func (x *EventBlobSidecar) GetIndex() uint64 { - if x != nil { - return x.Index - } - return 0 -} - -func (x *EventBlobSidecar) GetSlot() github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.Slot { - if x != nil { - return x.Slot - } - return github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.Slot(0) -} - -func (x *EventBlobSidecar) GetVersionedHash() []byte { - if x != nil { - return x.VersionedHash - } - return nil -} - -func (x *EventBlobSidecar) GetKzgCommitment() []byte { - if x != nil { - return x.KzgCommitment - } - return nil -} - -type EventPayloadAttributeV1_BasePayloadAttribute struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ProposalSlot github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.Slot `protobuf:"varint,3,opt,name=proposal_slot,json=proposalSlot,proto3" json:"proposal_slot,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives.Slot"` - ParentBlockNumber uint64 `protobuf:"varint,4,opt,name=parent_block_number,json=parentBlockNumber,proto3" json:"parent_block_number,omitempty"` - ParentBlockRoot []byte `protobuf:"bytes,5,opt,name=parent_block_root,json=parentBlockRoot,proto3" json:"parent_block_root,omitempty" ssz-size:"32"` - ParentBlockHash []byte `protobuf:"bytes,6,opt,name=parent_block_hash,json=parentBlockHash,proto3" json:"parent_block_hash,omitempty" ssz-size:"32"` - ProposerIndex github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.ValidatorIndex `protobuf:"varint,7,opt,name=proposer_index,json=proposerIndex,proto3" json:"proposer_index,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives.ValidatorIndex"` - PayloadAttributes *v1.PayloadAttributes `protobuf:"bytes,8,opt,name=payload_attributes,json=payloadAttributes,proto3" json:"payload_attributes,omitempty"` -} - -func (x *EventPayloadAttributeV1_BasePayloadAttribute) Reset() { - *x = EventPayloadAttributeV1_BasePayloadAttribute{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_eth_v1_events_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *EventPayloadAttributeV1_BasePayloadAttribute) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EventPayloadAttributeV1_BasePayloadAttribute) ProtoMessage() {} - -func (x *EventPayloadAttributeV1_BasePayloadAttribute) ProtoReflect() protoreflect.Message { - mi := &file_proto_eth_v1_events_proto_msgTypes[8] - 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 EventPayloadAttributeV1_BasePayloadAttribute.ProtoReflect.Descriptor instead. -func (*EventPayloadAttributeV1_BasePayloadAttribute) Descriptor() ([]byte, []int) { - return file_proto_eth_v1_events_proto_rawDescGZIP(), []int{5, 0} -} - -func (x *EventPayloadAttributeV1_BasePayloadAttribute) GetProposalSlot() github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.Slot { - if x != nil { - return x.ProposalSlot - } - return github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.Slot(0) -} - -func (x *EventPayloadAttributeV1_BasePayloadAttribute) GetParentBlockNumber() uint64 { - if x != nil { - return x.ParentBlockNumber - } - return 0 -} - -func (x *EventPayloadAttributeV1_BasePayloadAttribute) GetParentBlockRoot() []byte { - if x != nil { - return x.ParentBlockRoot - } - return nil -} - -func (x *EventPayloadAttributeV1_BasePayloadAttribute) GetParentBlockHash() []byte { - if x != nil { - return x.ParentBlockHash - } - return nil -} - -func (x *EventPayloadAttributeV1_BasePayloadAttribute) GetProposerIndex() github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.ValidatorIndex { - if x != nil { - return x.ProposerIndex - } - return github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.ValidatorIndex(0) -} - -func (x *EventPayloadAttributeV1_BasePayloadAttribute) GetPayloadAttributes() *v1.PayloadAttributes { - if x != nil { - return x.PayloadAttributes - } - return nil -} - -type EventPayloadAttributeV2_BasePayloadAttribute struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ProposalSlot github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.Slot `protobuf:"varint,3,opt,name=proposal_slot,json=proposalSlot,proto3" json:"proposal_slot,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives.Slot"` - ParentBlockNumber uint64 `protobuf:"varint,4,opt,name=parent_block_number,json=parentBlockNumber,proto3" json:"parent_block_number,omitempty"` - ParentBlockRoot []byte `protobuf:"bytes,5,opt,name=parent_block_root,json=parentBlockRoot,proto3" json:"parent_block_root,omitempty" ssz-size:"32"` - ParentBlockHash []byte `protobuf:"bytes,6,opt,name=parent_block_hash,json=parentBlockHash,proto3" json:"parent_block_hash,omitempty" ssz-size:"32"` - ProposerIndex github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.ValidatorIndex `protobuf:"varint,7,opt,name=proposer_index,json=proposerIndex,proto3" json:"proposer_index,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives.ValidatorIndex"` - PayloadAttributes *v1.PayloadAttributesV2 `protobuf:"bytes,8,opt,name=payload_attributes,json=payloadAttributes,proto3" json:"payload_attributes,omitempty"` -} - -func (x *EventPayloadAttributeV2_BasePayloadAttribute) Reset() { - *x = EventPayloadAttributeV2_BasePayloadAttribute{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_eth_v1_events_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *EventPayloadAttributeV2_BasePayloadAttribute) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EventPayloadAttributeV2_BasePayloadAttribute) ProtoMessage() {} - -func (x *EventPayloadAttributeV2_BasePayloadAttribute) ProtoReflect() protoreflect.Message { - mi := &file_proto_eth_v1_events_proto_msgTypes[9] - 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 EventPayloadAttributeV2_BasePayloadAttribute.ProtoReflect.Descriptor instead. -func (*EventPayloadAttributeV2_BasePayloadAttribute) Descriptor() ([]byte, []int) { - return file_proto_eth_v1_events_proto_rawDescGZIP(), []int{6, 0} -} - -func (x *EventPayloadAttributeV2_BasePayloadAttribute) GetProposalSlot() github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.Slot { - if x != nil { - return x.ProposalSlot - } - return github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.Slot(0) -} - -func (x *EventPayloadAttributeV2_BasePayloadAttribute) GetParentBlockNumber() uint64 { - if x != nil { - return x.ParentBlockNumber - } - return 0 -} - -func (x *EventPayloadAttributeV2_BasePayloadAttribute) GetParentBlockRoot() []byte { - if x != nil { - return x.ParentBlockRoot - } - return nil -} - -func (x *EventPayloadAttributeV2_BasePayloadAttribute) GetParentBlockHash() []byte { - if x != nil { - return x.ParentBlockHash - } - return nil -} - -func (x *EventPayloadAttributeV2_BasePayloadAttribute) GetProposerIndex() github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.ValidatorIndex { - if x != nil { - return x.ProposerIndex - } - return github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.ValidatorIndex(0) -} - -func (x *EventPayloadAttributeV2_BasePayloadAttribute) GetPayloadAttributes() *v1.PayloadAttributesV2 { - if x != nil { - return x.PayloadAttributes - } - return nil -} - var File_proto_eth_v1_events_proto protoreflect.FileDescriptor var file_proto_eth_v1_events_proto_rawDesc = []byte{ @@ -779,194 +369,96 @@ var file_proto_eth_v1_events_proto_rawDesc = []byte{ 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x26, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0x2d, 0x0a, 0x13, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x45, 0x76, 0x65, - 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x6f, - 0x70, 0x69, 0x63, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x74, 0x6f, 0x70, 0x69, - 0x63, 0x73, 0x22, 0x90, 0x03, 0x0a, 0x09, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x65, 0x61, 0x64, - 0x12, 0x59, 0x0a, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x45, - 0x82, 0xb5, 0x18, 0x41, 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, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, - 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, - 0x2e, 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x12, 0x1c, 0x0a, 0x05, 0x62, - 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, - 0x33, 0x32, 0x52, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x1c, 0x0a, 0x05, 0x73, 0x74, 0x61, - 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, - 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x65, 0x70, 0x6f, 0x63, 0x68, - 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x0f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x69, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x47, 0x0a, 0x1c, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x5f, 0x64, - 0x75, 0x74, 0x79, 0x5f, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x74, 0x5f, 0x72, 0x6f, - 0x6f, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, - 0x52, 0x19, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x44, 0x75, 0x74, 0x79, 0x44, 0x65, - 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x74, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x45, 0x0a, 0x1b, 0x63, - 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x64, 0x75, 0x74, 0x79, 0x5f, 0x64, 0x65, 0x70, 0x65, - 0x6e, 0x64, 0x65, 0x6e, 0x74, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, - 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x18, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, - 0x74, 0x44, 0x75, 0x74, 0x79, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x74, 0x52, 0x6f, - 0x6f, 0x74, 0x12, 0x31, 0x0a, 0x14, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5f, - 0x6f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x73, 0x74, 0x69, 0x63, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x13, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6d, - 0x69, 0x73, 0x74, 0x69, 0x63, 0x22, 0xb8, 0x01, 0x0a, 0x0a, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, - 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x59, 0x0a, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x04, 0x42, 0x45, 0x82, 0xb5, 0x18, 0x41, 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, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, - 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, - 0x69, 0x76, 0x65, 0x73, 0x2e, 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x12, - 0x1c, 0x0a, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, - 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x31, 0x0a, - 0x14, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6d, - 0x69, 0x73, 0x74, 0x69, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x65, 0x78, 0x65, - 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x73, 0x74, 0x69, 0x63, - 0x22, 0xcb, 0x03, 0x0a, 0x0f, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, - 0x65, 0x6f, 0x72, 0x67, 0x12, 0x59, 0x0a, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x04, 0x42, 0x45, 0x82, 0xb5, 0x18, 0x41, 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, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, - 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, - 0x69, 0x76, 0x65, 0x73, 0x2e, 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x12, - 0x14, 0x0a, 0x05, 0x64, 0x65, 0x70, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, - 0x64, 0x65, 0x70, 0x74, 0x68, 0x12, 0x2c, 0x0a, 0x0e, 0x6f, 0x6c, 0x64, 0x5f, 0x68, 0x65, 0x61, - 0x64, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, - 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x0c, 0x6f, 0x6c, 0x64, 0x48, 0x65, 0x61, 0x64, 0x42, 0x6c, - 0x6f, 0x63, 0x6b, 0x12, 0x2c, 0x0a, 0x0e, 0x6e, 0x65, 0x77, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x5f, - 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, - 0x02, 0x33, 0x32, 0x52, 0x0c, 0x6e, 0x65, 0x77, 0x48, 0x65, 0x61, 0x64, 0x42, 0x6c, 0x6f, 0x63, - 0x6b, 0x12, 0x2c, 0x0a, 0x0e, 0x6f, 0x6c, 0x64, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x5f, 0x73, 0x74, - 0x61, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, - 0x32, 0x52, 0x0c, 0x6f, 0x6c, 0x64, 0x48, 0x65, 0x61, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, - 0x2c, 0x0a, 0x0e, 0x6e, 0x65, 0x77, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x5f, 0x73, 0x74, 0x61, 0x74, - 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, - 0x0c, 0x6e, 0x65, 0x77, 0x48, 0x65, 0x61, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x5c, 0x0a, - 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x07, 0x20, 0x01, 0x28, 0x04, 0x42, 0x46, 0x82, 0xb5, - 0x18, 0x42, 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, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x45, - 0x70, 0x6f, 0x63, 0x68, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x31, 0x0a, 0x14, 0x65, - 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x73, - 0x74, 0x69, 0x63, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x65, 0x78, 0x65, 0x63, 0x75, - 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x73, 0x74, 0x69, 0x63, 0x22, 0xe7, - 0x01, 0x0a, 0x18, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, - 0x64, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x05, 0x62, - 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, - 0x33, 0x32, 0x52, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x1c, 0x0a, 0x05, 0x73, 0x74, 0x61, - 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, - 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x5c, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x42, 0x46, 0x82, 0xb5, 0x18, 0x42, 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, 0x63, 0x6f, - 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, - 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x52, 0x05, - 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x31, 0x0a, 0x14, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, - 0x6f, 0x6e, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x73, 0x74, 0x69, 0x63, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x13, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, - 0x74, 0x69, 0x6d, 0x69, 0x73, 0x74, 0x69, 0x63, 0x22, 0xf1, 0x04, 0x0a, 0x17, 0x45, 0x76, 0x65, - 0x6e, 0x74, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, - 0x74, 0x65, 0x56, 0x31, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x51, - 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3d, 0x2e, 0x65, - 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x45, - 0x76, 0x65, 0x6e, 0x74, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, - 0x62, 0x75, 0x74, 0x65, 0x56, 0x31, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x50, 0x61, 0x79, 0x6c, 0x6f, - 0x61, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x04, 0x64, 0x61, 0x74, - 0x61, 0x1a, 0xe8, 0x03, 0x0a, 0x14, 0x42, 0x61, 0x73, 0x65, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, - 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x6a, 0x0a, 0x0d, 0x70, 0x72, - 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x04, 0x42, 0x45, 0x82, 0xb5, 0x18, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6f, 0x74, 0x6f, 0x22, 0x90, 0x03, 0x0a, 0x09, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x65, 0x61, + 0x64, 0x12, 0x59, 0x0a, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, + 0x45, 0x82, 0xb5, 0x18, 0x41, 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, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, + 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, + 0x73, 0x2e, 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x12, 0x1c, 0x0a, 0x05, + 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, + 0x02, 0x33, 0x32, 0x52, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x1c, 0x0a, 0x05, 0x73, 0x74, + 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, + 0x32, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x65, 0x70, 0x6f, 0x63, + 0x68, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x0f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x47, 0x0a, 0x1c, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x5f, + 0x64, 0x75, 0x74, 0x79, 0x5f, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x74, 0x5f, 0x72, + 0x6f, 0x6f, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, + 0x32, 0x52, 0x19, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x44, 0x75, 0x74, 0x79, 0x44, + 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x74, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x45, 0x0a, 0x1b, + 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x64, 0x75, 0x74, 0x79, 0x5f, 0x64, 0x65, 0x70, + 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x74, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x18, 0x63, 0x75, 0x72, 0x72, 0x65, + 0x6e, 0x74, 0x44, 0x75, 0x74, 0x79, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x74, 0x52, + 0x6f, 0x6f, 0x74, 0x12, 0x31, 0x0a, 0x14, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x73, 0x74, 0x69, 0x63, 0x18, 0x07, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x13, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x69, + 0x6d, 0x69, 0x73, 0x74, 0x69, 0x63, 0x22, 0xb8, 0x01, 0x0a, 0x0a, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x59, 0x0a, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x04, 0x42, 0x45, 0x82, 0xb5, 0x18, 0x41, 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, 0x63, 0x6f, 0x6e, 0x73, 0x65, + 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, + 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x04, 0x73, 0x6c, 0x6f, 0x74, + 0x12, 0x1c, 0x0a, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, + 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x31, + 0x0a, 0x14, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6f, 0x70, 0x74, 0x69, + 0x6d, 0x69, 0x73, 0x74, 0x69, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x65, 0x78, + 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x73, 0x74, 0x69, + 0x63, 0x22, 0xcb, 0x03, 0x0a, 0x0f, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, + 0x52, 0x65, 0x6f, 0x72, 0x67, 0x12, 0x59, 0x0a, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x04, 0x42, 0x45, 0x82, 0xb5, 0x18, 0x41, 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, 0x63, 0x6f, 0x6e, 0x73, 0x65, + 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, + 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x04, 0x73, 0x6c, 0x6f, 0x74, + 0x12, 0x14, 0x0a, 0x05, 0x64, 0x65, 0x70, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x05, 0x64, 0x65, 0x70, 0x74, 0x68, 0x12, 0x2c, 0x0a, 0x0e, 0x6f, 0x6c, 0x64, 0x5f, 0x68, 0x65, + 0x61, 0x64, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, + 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x0c, 0x6f, 0x6c, 0x64, 0x48, 0x65, 0x61, 0x64, 0x42, + 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x2c, 0x0a, 0x0e, 0x6e, 0x65, 0x77, 0x5f, 0x68, 0x65, 0x61, 0x64, + 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, + 0x18, 0x02, 0x33, 0x32, 0x52, 0x0c, 0x6e, 0x65, 0x77, 0x48, 0x65, 0x61, 0x64, 0x42, 0x6c, 0x6f, + 0x63, 0x6b, 0x12, 0x2c, 0x0a, 0x0e, 0x6f, 0x6c, 0x64, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x5f, 0x73, + 0x74, 0x61, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, + 0x33, 0x32, 0x52, 0x0c, 0x6f, 0x6c, 0x64, 0x48, 0x65, 0x61, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, + 0x12, 0x2c, 0x0a, 0x0e, 0x6e, 0x65, 0x77, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x5f, 0x73, 0x74, 0x61, + 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, + 0x52, 0x0c, 0x6e, 0x65, 0x77, 0x48, 0x65, 0x61, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x5c, + 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x07, 0x20, 0x01, 0x28, 0x04, 0x42, 0x46, 0x82, + 0xb5, 0x18, 0x42, 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, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, + 0x45, 0x70, 0x6f, 0x63, 0x68, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x31, 0x0a, 0x14, + 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6d, 0x69, + 0x73, 0x74, 0x69, 0x63, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x65, 0x78, 0x65, 0x63, + 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x73, 0x74, 0x69, 0x63, 0x22, + 0xe7, 0x01, 0x0a, 0x18, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, + 0x65, 0x64, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x05, + 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, + 0x02, 0x33, 0x32, 0x52, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x1c, 0x0a, 0x05, 0x73, 0x74, + 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, + 0x32, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x5c, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, + 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x42, 0x46, 0x82, 0xb5, 0x18, 0x42, 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, 0x63, + 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, + 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x52, + 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x31, 0x0a, 0x14, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, + 0x69, 0x6f, 0x6e, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x73, 0x74, 0x69, 0x63, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x4f, + 0x70, 0x74, 0x69, 0x6d, 0x69, 0x73, 0x74, 0x69, 0x63, 0x42, 0x7e, 0x0a, 0x13, 0x6f, 0x72, 0x67, + 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, + 0x42, 0x11, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 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, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, - 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, - 0x76, 0x65, 0x73, 0x2e, 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x0c, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, - 0x61, 0x6c, 0x53, 0x6c, 0x6f, 0x74, 0x12, 0x2e, 0x0a, 0x13, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, - 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x04, 0x52, 0x11, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, - 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x32, 0x0a, 0x11, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, - 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x0f, 0x70, 0x61, 0x72, 0x65, 0x6e, - 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x32, 0x0a, 0x11, 0x70, 0x61, - 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x0f, 0x70, - 0x61, 0x72, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x12, 0x76, - 0x0a, 0x0e, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, - 0x18, 0x07, 0x20, 0x01, 0x28, 0x04, 0x42, 0x4f, 0x82, 0xb5, 0x18, 0x4b, 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, 0x63, 0x6f, - 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, - 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, - 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x0d, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, - 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x54, 0x0a, 0x12, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, - 0x64, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x08, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x6e, - 0x67, 0x69, 0x6e, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x41, - 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x52, 0x11, 0x70, 0x61, 0x79, 0x6c, 0x6f, - 0x61, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x22, 0xf3, 0x04, 0x0a, - 0x17, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x74, 0x74, - 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x56, 0x32, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x12, 0x51, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x3d, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, - 0x76, 0x31, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x41, - 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x56, 0x32, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x50, - 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, - 0x04, 0x64, 0x61, 0x74, 0x61, 0x1a, 0xea, 0x03, 0x0a, 0x14, 0x42, 0x61, 0x73, 0x65, 0x50, 0x61, - 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x6a, - 0x0a, 0x0d, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x73, 0x6c, 0x6f, 0x74, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x04, 0x42, 0x45, 0x82, 0xb5, 0x18, 0x41, 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, 0x63, 0x6f, 0x6e, - 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, - 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x0c, 0x70, 0x72, - 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x53, 0x6c, 0x6f, 0x74, 0x12, 0x2e, 0x0a, 0x13, 0x70, 0x61, - 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, - 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x11, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x42, - 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x32, 0x0a, 0x11, 0x70, 0x61, - 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x0f, 0x70, - 0x61, 0x72, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x32, - 0x0a, 0x11, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, - 0x61, 0x73, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, - 0x32, 0x52, 0x0f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, - 0x73, 0x68, 0x12, 0x76, 0x0a, 0x0e, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x5f, 0x69, - 0x6e, 0x64, 0x65, 0x78, 0x18, 0x07, 0x20, 0x01, 0x28, 0x04, 0x42, 0x4f, 0x82, 0xb5, 0x18, 0x4b, - 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, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, - 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x56, 0x61, 0x6c, - 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x0d, 0x70, 0x72, 0x6f, - 0x70, 0x6f, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x56, 0x0a, 0x12, 0x70, 0x61, - 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, - 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, - 0x6d, 0x2e, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x79, 0x6c, - 0x6f, 0x61, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x56, 0x32, 0x52, - 0x11, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, - 0x65, 0x73, 0x22, 0x88, 0x02, 0x0a, 0x10, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x62, - 0x53, 0x69, 0x64, 0x65, 0x63, 0x61, 0x72, 0x12, 0x25, 0x0a, 0x0a, 0x62, 0x6c, 0x6f, 0x63, 0x6b, - 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, - 0x02, 0x33, 0x32, 0x52, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x14, - 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x69, - 0x6e, 0x64, 0x65, 0x78, 0x12, 0x59, 0x0a, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x04, 0x42, 0x45, 0x82, 0xb5, 0x18, 0x41, 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, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, - 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, - 0x69, 0x76, 0x65, 0x73, 0x2e, 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x12, - 0x2d, 0x0a, 0x0e, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x64, 0x5f, 0x68, 0x61, 0x73, - 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, - 0x0d, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x64, 0x48, 0x61, 0x73, 0x68, 0x12, 0x2d, - 0x0a, 0x0e, 0x6b, 0x7a, 0x67, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x6d, 0x65, 0x6e, 0x74, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x34, 0x38, 0x52, 0x0d, - 0x6b, 0x7a, 0x67, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x7e, 0x0a, - 0x13, 0x6f, 0x72, 0x67, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, - 0x68, 0x2e, 0x76, 0x31, 0x42, 0x11, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x45, 0x76, 0x65, 0x6e, - 0x74, 0x73, 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, + 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 ( @@ -981,31 +473,19 @@ func file_proto_eth_v1_events_proto_rawDescGZIP() []byte { return file_proto_eth_v1_events_proto_rawDescData } -var file_proto_eth_v1_events_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_proto_eth_v1_events_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_proto_eth_v1_events_proto_goTypes = []interface{}{ - (*StreamEventsRequest)(nil), // 0: ethereum.eth.v1.StreamEventsRequest - (*EventHead)(nil), // 1: ethereum.eth.v1.EventHead - (*EventBlock)(nil), // 2: ethereum.eth.v1.EventBlock - (*EventChainReorg)(nil), // 3: ethereum.eth.v1.EventChainReorg - (*EventFinalizedCheckpoint)(nil), // 4: ethereum.eth.v1.EventFinalizedCheckpoint - (*EventPayloadAttributeV1)(nil), // 5: ethereum.eth.v1.EventPayloadAttributeV1 - (*EventPayloadAttributeV2)(nil), // 6: ethereum.eth.v1.EventPayloadAttributeV2 - (*EventBlobSidecar)(nil), // 7: ethereum.eth.v1.EventBlobSidecar - (*EventPayloadAttributeV1_BasePayloadAttribute)(nil), // 8: ethereum.eth.v1.EventPayloadAttributeV1.BasePayloadAttribute - (*EventPayloadAttributeV2_BasePayloadAttribute)(nil), // 9: ethereum.eth.v1.EventPayloadAttributeV2.BasePayloadAttribute - (*v1.PayloadAttributes)(nil), // 10: ethereum.engine.v1.PayloadAttributes - (*v1.PayloadAttributesV2)(nil), // 11: ethereum.engine.v1.PayloadAttributesV2 + (*EventHead)(nil), // 0: ethereum.eth.v1.EventHead + (*EventBlock)(nil), // 1: ethereum.eth.v1.EventBlock + (*EventChainReorg)(nil), // 2: ethereum.eth.v1.EventChainReorg + (*EventFinalizedCheckpoint)(nil), // 3: ethereum.eth.v1.EventFinalizedCheckpoint } var file_proto_eth_v1_events_proto_depIdxs = []int32{ - 8, // 0: ethereum.eth.v1.EventPayloadAttributeV1.data:type_name -> ethereum.eth.v1.EventPayloadAttributeV1.BasePayloadAttribute - 9, // 1: ethereum.eth.v1.EventPayloadAttributeV2.data:type_name -> ethereum.eth.v1.EventPayloadAttributeV2.BasePayloadAttribute - 10, // 2: ethereum.eth.v1.EventPayloadAttributeV1.BasePayloadAttribute.payload_attributes:type_name -> ethereum.engine.v1.PayloadAttributes - 11, // 3: ethereum.eth.v1.EventPayloadAttributeV2.BasePayloadAttribute.payload_attributes:type_name -> ethereum.engine.v1.PayloadAttributesV2 - 4, // [4:4] is the sub-list for method output_type - 4, // [4:4] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] 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 } func init() { file_proto_eth_v1_events_proto_init() } @@ -1015,18 +495,6 @@ func file_proto_eth_v1_events_proto_init() { } if !protoimpl.UnsafeEnabled { file_proto_eth_v1_events_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StreamEventsRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_eth_v1_events_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*EventHead); i { case 0: return &v.state @@ -1038,7 +506,7 @@ func file_proto_eth_v1_events_proto_init() { return nil } } - file_proto_eth_v1_events_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_proto_eth_v1_events_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*EventBlock); i { case 0: return &v.state @@ -1050,7 +518,7 @@ func file_proto_eth_v1_events_proto_init() { return nil } } - file_proto_eth_v1_events_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_proto_eth_v1_events_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*EventChainReorg); i { case 0: return &v.state @@ -1062,7 +530,7 @@ func file_proto_eth_v1_events_proto_init() { return nil } } - file_proto_eth_v1_events_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_proto_eth_v1_events_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*EventFinalizedCheckpoint); i { case 0: return &v.state @@ -1074,66 +542,6 @@ func file_proto_eth_v1_events_proto_init() { return nil } } - file_proto_eth_v1_events_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EventPayloadAttributeV1); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_eth_v1_events_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EventPayloadAttributeV2); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_eth_v1_events_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EventBlobSidecar); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_eth_v1_events_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EventPayloadAttributeV1_BasePayloadAttribute); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_eth_v1_events_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EventPayloadAttributeV2_BasePayloadAttribute); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } } type x struct{} out := protoimpl.TypeBuilder{ @@ -1141,7 +549,7 @@ func file_proto_eth_v1_events_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_proto_eth_v1_events_proto_rawDesc, NumEnums: 0, - NumMessages: 10, + NumMessages: 4, NumExtensions: 0, NumServices: 0, }, diff --git a/proto/eth/v1/events.proto b/proto/eth/v1/events.proto index acc047033..113f607eb 100644 --- a/proto/eth/v1/events.proto +++ b/proto/eth/v1/events.proto @@ -26,12 +26,6 @@ option java_outer_classname = "BeaconEventsProto"; option java_package = "org.ethereum.eth.v1"; option php_namespace = "Ethereum\\Eth\\v1"; -message StreamEventsRequest { - // List of topics to request for event streaming items. Allowed request topics are - // head, attestation, block, voluntary_exit, finalized_checkpoint, chain_reorg. - repeated string topics = 1; -} - message EventHead { // Slot of the new chain head. uint64 slot = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v4/consensus-types/primitives.Slot"]; @@ -104,70 +98,4 @@ message EventFinalizedCheckpoint { // Information about optimistic sync. bool execution_optimistic = 4; -} - -message EventPayloadAttributeV1 { - // the identifier of the beacon hard fork at `proposal_slot`, e.g.`"bellatrix"`. - string version = 1; - BasePayloadAttribute data = 2; - message BasePayloadAttribute { - // The slot at which a block using these payload attributes may be built. - uint64 proposal_slot = 3 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v4/consensus-types/primitives.Slot"]; - - // The execution block number of the parent block. - uint64 parent_block_number = 4; - - // The beacon block root of the parent block to be built upon. - bytes parent_block_root = 5 [(ethereum.eth.ext.ssz_size) = "32"]; - - // The execution block hash of the parent block. - bytes parent_block_hash = 6 [(ethereum.eth.ext.ssz_size) = "32"]; - - // The validator index of the proposer at proposal_slot on the chain identified by parent_block_root. - uint64 proposer_index = 7 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v4/consensus-types/primitives.ValidatorIndex"]; - - // payload_attributes: beacon API encoding of PayloadAttributesV as defined by the execution-apis specification. - // The version N must match the payload attributes for the hard fork matching version. - // The beacon API encoded object must have equivalent fields to its counterpart in execution-apis with two differences: - // 1) snake_case identifiers must be used rather than camelCase; 2) integers must be encoded as quoted decimals rather than big-endian hex. - engine.v1.PayloadAttributes payload_attributes = 8; - } -} - - -message EventPayloadAttributeV2 { - // the identifier of the beacon hard fork at `proposal_slot`, e.g.`"bellatrix"`. - string version = 1; - BasePayloadAttribute data = 2; - message BasePayloadAttribute { - // The slot at which a block using these payload attributes may be built. - uint64 proposal_slot = 3 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v4/consensus-types/primitives.Slot"]; - - // The execution block number of the parent block. - uint64 parent_block_number = 4; - - // The beacon block root of the parent block to be built upon. - bytes parent_block_root = 5 [(ethereum.eth.ext.ssz_size) = "32"]; - - // The execution block hash of the parent block. - bytes parent_block_hash = 6 [(ethereum.eth.ext.ssz_size) = "32"]; - - // The validator index of the proposer at proposal_slot on the chain identified by parent_block_root. - uint64 proposer_index = 7 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v4/consensus-types/primitives.ValidatorIndex"]; - - // payload_attributes: beacon API encoding of PayloadAttributesV as defined by the execution-apis specification. - // The version N must match the payload attributes for the hard fork matching version. - // The beacon API encoded object must have equivalent fields to its counterpart in execution-apis with two differences: - // 1) snake_case identifiers must be used rather than camelCase; 2) integers must be encoded as quoted decimals rather than big-endian hex. - engine.v1.PayloadAttributesV2 payload_attributes = 8; - } -} - -message EventBlobSidecar { - bytes block_root = 1 [(ethereum.eth.ext.ssz_size) = "32"]; - uint64 index = 2; - uint64 slot = 3 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v4/consensus-types/primitives.Slot"]; - // calculated from the kzg commitment - bytes versioned_hash = 4 [(ethereum.eth.ext.ssz_size) = "32"]; - bytes kzg_commitment = 5 [(ethereum.eth.ext.ssz_size) = "48"]; } \ No newline at end of file diff --git a/testing/endtoend/BUILD.bazel b/testing/endtoend/BUILD.bazel index f6bb75c90..7ba9571ae 100644 --- a/testing/endtoend/BUILD.bazel +++ b/testing/endtoend/BUILD.bazel @@ -57,7 +57,6 @@ common_deps = [ "//crypto/bls:go_default_library", "//encoding/bytesutil:go_default_library", "//io/file:go_default_library", - "//proto/eth/service:go_default_library", "//proto/eth/v1:go_default_library", "//math:go_default_library", "//proto/engine/v1:go_default_library", diff --git a/testing/mock/BUILD.bazel b/testing/mock/BUILD.bazel index 11ebce799..335197f9e 100644 --- a/testing/mock/BUILD.bazel +++ b/testing/mock/BUILD.bazel @@ -11,19 +11,15 @@ go_library( "beacon_service_mock.go", "beacon_validator_client_mock.go", "beacon_validator_server_mock.go", - "event_service_mock.go", "keymanager_mock.go", "node_service_mock.go", ], importpath = "github.com/prysmaticlabs/prysm/v4/testing/mock", visibility = ["//visibility:public"], deps = [ - "//proto/eth/service:go_default_library", - "//proto/eth/v1:go_default_library", "//proto/prysm/v1alpha1:go_default_library", "//proto/prysm/v1alpha1/validator-client:go_default_library", "@com_github_golang_mock//gomock:go_default_library", - "@com_github_grpc_ecosystem_grpc_gateway_v2//proto/gateway:go_default_library", "@org_golang_google_grpc//:go_default_library", "@org_golang_google_grpc//metadata:go_default_library", "@org_golang_google_protobuf//types/known/emptypb:go_default_library", diff --git a/testing/mock/event_service_mock.go b/testing/mock/event_service_mock.go deleted file mode 100644 index 72f419787..000000000 --- a/testing/mock/event_service_mock.go +++ /dev/null @@ -1,302 +0,0 @@ -// Code generated by MockGen. DO NOT EDIT. -// Source: github.com/prysmaticlabs/prysm/v4/proto/eth/service (interfaces: EventsClient,Events_StreamEventsClient,Events_StreamEventsServer) - -// Package mock is a generated GoMock package. -package mock - -import ( - context "context" - reflect "reflect" - - gomock "github.com/golang/mock/gomock" - gateway "github.com/grpc-ecosystem/grpc-gateway/v2/proto/gateway" - service "github.com/prysmaticlabs/prysm/v4/proto/eth/service" - v1 "github.com/prysmaticlabs/prysm/v4/proto/eth/v1" - grpc "google.golang.org/grpc" - metadata "google.golang.org/grpc/metadata" -) - -// MockEventsClient is a mock of EventsClient interface. -type EventsClient struct { - ctrl *gomock.Controller - recorder *EventsClientMockRecorder -} - -// MockEventsClientMockRecorder is the mock recorder for MockEventsClient. -type EventsClientMockRecorder struct { - mock *EventsClient -} - -// NewMockEventsClient creates a new mock instance. -func NewMockEventsClient(ctrl *gomock.Controller) *EventsClient { - mock := &EventsClient{ctrl: ctrl} - mock.recorder = &EventsClientMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *EventsClient) EXPECT() *EventsClientMockRecorder { - return m.recorder -} - -// StreamEvents mocks base method. -func (m *EventsClient) StreamEvents(arg0 context.Context, arg1 *v1.StreamEventsRequest, arg2 ...grpc.CallOption) (service.Events_StreamEventsClient, error) { - m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - for _, a := range arg2 { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "StreamEvents", varargs...) - ret0, _ := ret[0].(service.Events_StreamEventsClient) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// StreamEvents indicates an expected call of StreamEvents. -func (mr *EventsClientMockRecorder) StreamEvents(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StreamEvents", reflect.TypeOf((*EventsClient)(nil).StreamEvents), varargs...) -} - -// MockEvents_StreamEventsClient is a mock of Events_StreamEventsClient interface. -type Events_StreamEventsClient struct { - ctrl *gomock.Controller - recorder *Events_StreamEventsClientMockRecorder -} - -// MockEvents_StreamEventsClientMockRecorder is the mock recorder for MockEvents_StreamEventsClient. -type Events_StreamEventsClientMockRecorder struct { - mock *Events_StreamEventsClient -} - -// NewMockEvents_StreamEventsClient creates a new mock instance. -func NewMockEvents_StreamEventsClient(ctrl *gomock.Controller) *Events_StreamEventsClient { - mock := &Events_StreamEventsClient{ctrl: ctrl} - mock.recorder = &Events_StreamEventsClientMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *Events_StreamEventsClient) EXPECT() *Events_StreamEventsClientMockRecorder { - return m.recorder -} - -// CloseSend mocks base method. -func (m *Events_StreamEventsClient) CloseSend() error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CloseSend") - ret0, _ := ret[0].(error) - return ret0 -} - -// CloseSend indicates an expected call of CloseSend. -func (mr *Events_StreamEventsClientMockRecorder) CloseSend() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloseSend", reflect.TypeOf((*Events_StreamEventsClient)(nil).CloseSend)) -} - -// Context mocks base method. -func (m *Events_StreamEventsClient) Context() context.Context { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Context") - ret0, _ := ret[0].(context.Context) - return ret0 -} - -// Context indicates an expected call of Context. -func (mr *Events_StreamEventsClientMockRecorder) Context() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*Events_StreamEventsClient)(nil).Context)) -} - -// Header mocks base method. -func (m *Events_StreamEventsClient) Header() (metadata.MD, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Header") - ret0, _ := ret[0].(metadata.MD) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Header indicates an expected call of Header. -func (mr *Events_StreamEventsClientMockRecorder) Header() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Header", reflect.TypeOf((*Events_StreamEventsClient)(nil).Header)) -} - -// Recv mocks base method. -func (m *Events_StreamEventsClient) Recv() (*gateway.EventSource, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Recv") - ret0, _ := ret[0].(*gateway.EventSource) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Recv indicates an expected call of Recv. -func (mr *Events_StreamEventsClientMockRecorder) Recv() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Recv", reflect.TypeOf((*Events_StreamEventsClient)(nil).Recv)) -} - -// RecvMsg mocks base method. -func (m *Events_StreamEventsClient) RecvMsg(arg0 interface{}) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RecvMsg", arg0) - ret0, _ := ret[0].(error) - return ret0 -} - -// RecvMsg indicates an expected call of RecvMsg. -func (mr *Events_StreamEventsClientMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*Events_StreamEventsClient)(nil).RecvMsg), arg0) -} - -// SendMsg mocks base method. -func (m *Events_StreamEventsClient) SendMsg(arg0 interface{}) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SendMsg", arg0) - ret0, _ := ret[0].(error) - return ret0 -} - -// SendMsg indicates an expected call of SendMsg. -func (mr *Events_StreamEventsClientMockRecorder) SendMsg(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*Events_StreamEventsClient)(nil).SendMsg), arg0) -} - -// Trailer mocks base method. -func (m *Events_StreamEventsClient) Trailer() metadata.MD { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Trailer") - ret0, _ := ret[0].(metadata.MD) - return ret0 -} - -// Trailer indicates an expected call of Trailer. -func (mr *Events_StreamEventsClientMockRecorder) Trailer() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Trailer", reflect.TypeOf((*Events_StreamEventsClient)(nil).Trailer)) -} - -// MockEvents_StreamEventsServer is a mock of Events_StreamEventsServer interface. -type Events_StreamEventsServer struct { - ctrl *gomock.Controller - recorder *Events_StreamEventsServerMockRecorder -} - -// MockEvents_StreamEventsServerMockRecorder is the mock recorder for MockEvents_StreamEventsServer. -type Events_StreamEventsServerMockRecorder struct { - mock *Events_StreamEventsServer -} - -// NewMockEvents_StreamEventsServer creates a new mock instance. -func NewMockEvents_StreamEventsServer(ctrl *gomock.Controller) *Events_StreamEventsServer { - mock := &Events_StreamEventsServer{ctrl: ctrl} - mock.recorder = &Events_StreamEventsServerMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *Events_StreamEventsServer) EXPECT() *Events_StreamEventsServerMockRecorder { - return m.recorder -} - -// Context mocks base method. -func (m *Events_StreamEventsServer) Context() context.Context { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Context") - ret0, _ := ret[0].(context.Context) - return ret0 -} - -// Context indicates an expected call of Context. -func (mr *Events_StreamEventsServerMockRecorder) Context() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*Events_StreamEventsServer)(nil).Context)) -} - -// RecvMsg mocks base method. -func (m *Events_StreamEventsServer) RecvMsg(arg0 interface{}) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RecvMsg", arg0) - ret0, _ := ret[0].(error) - return ret0 -} - -// RecvMsg indicates an expected call of RecvMsg. -func (mr *Events_StreamEventsServerMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*Events_StreamEventsServer)(nil).RecvMsg), arg0) -} - -// Send mocks base method. -func (m *Events_StreamEventsServer) Send(arg0 *gateway.EventSource) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Send", arg0) - ret0, _ := ret[0].(error) - return ret0 -} - -// Send indicates an expected call of Send. -func (mr *Events_StreamEventsServerMockRecorder) Send(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*Events_StreamEventsServer)(nil).Send), arg0) -} - -// SendHeader mocks base method. -func (m *Events_StreamEventsServer) SendHeader(arg0 metadata.MD) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SendHeader", arg0) - ret0, _ := ret[0].(error) - return ret0 -} - -// SendHeader indicates an expected call of SendHeader. -func (mr *Events_StreamEventsServerMockRecorder) SendHeader(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendHeader", reflect.TypeOf((*Events_StreamEventsServer)(nil).SendHeader), arg0) -} - -// SendMsg mocks base method. -func (m *Events_StreamEventsServer) SendMsg(arg0 interface{}) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SendMsg", arg0) - ret0, _ := ret[0].(error) - return ret0 -} - -// SendMsg indicates an expected call of SendMsg. -func (mr *Events_StreamEventsServerMockRecorder) SendMsg(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*Events_StreamEventsServer)(nil).SendMsg), arg0) -} - -// SetHeader mocks base method. -func (m *Events_StreamEventsServer) SetHeader(arg0 metadata.MD) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SetHeader", arg0) - ret0, _ := ret[0].(error) - return ret0 -} - -// SetHeader indicates an expected call of SetHeader. -func (mr *Events_StreamEventsServerMockRecorder) SetHeader(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetHeader", reflect.TypeOf((*Events_StreamEventsServer)(nil).SetHeader), arg0) -} - -// SetTrailer mocks base method. -func (m *Events_StreamEventsServer) SetTrailer(arg0 metadata.MD) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "SetTrailer", arg0) -} - -// SetTrailer indicates an expected call of SetTrailer. -func (mr *Events_StreamEventsServerMockRecorder) SetTrailer(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTrailer", reflect.TypeOf((*Events_StreamEventsServer)(nil).SetTrailer), arg0) -} diff --git a/testing/util/blob.go b/testing/util/blob.go index 3c6554231..be30d2803 100644 --- a/testing/util/blob.go +++ b/testing/util/blob.go @@ -5,6 +5,19 @@ import ( ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1" ) +// HydrateSignedBlobSidecar hydrates a signed blob sidecar with correct field length sizes +// to comply with SSZ marshalling and unmarshalling rules. +func HydrateSignedBlobSidecar(b *ethpb.SignedBlobSidecar) *ethpb.SignedBlobSidecar { + if b.Signature == nil { + b.Signature = make([]byte, fieldparams.BLSSignatureLength) + } + if b.Message == nil { + b.Message = ðpb.DeprecatedBlobSidecar{} + } + b.Message = HydrateBlobSidecar(b.Message) + return b +} + // HydrateBlobSidecar hydrates a blob sidecar with correct field length sizes // to comply with SSZ marshalling and unmarshalling rules. func HydrateBlobSidecar(b *ethpb.DeprecatedBlobSidecar) *ethpb.DeprecatedBlobSidecar { @@ -32,6 +45,9 @@ func HydrateSignedBlindedBlobSidecar(b *ethpb.SignedBlindedBlobSidecar) *ethpb.S if b.Signature == nil { b.Signature = make([]byte, fieldparams.BLSSignatureLength) } + if b.Message == nil { + b.Message = ðpb.BlindedBlobSidecar{} + } b.Message = HydrateBlindedBlobSidecar(b.Message) return b }