From a02f7b8985f389576168e6842e07b73ffb43a92e Mon Sep 17 00:00:00 2001 From: Peter Argue <89119817+peterargue@users.noreply.github.com> Date: Tue, 17 Oct 2023 09:33:35 -0700 Subject: [PATCH] [Access] update execution data protobuf to new namespace --- engine/access/state_stream/engine.go | 6 +++--- engine/access/state_stream/handler.go | 15 +++++++++------ engine/access/state_stream/handler_test.go | 10 +++++----- go.mod | 2 +- go.sum | 4 ++-- insecure/go.mod | 2 +- insecure/go.sum | 4 ++-- integration/go.mod | 2 +- integration/go.sum | 4 ++-- 9 files changed, 26 insertions(+), 23 deletions(-) diff --git a/engine/access/state_stream/engine.go b/engine/access/state_stream/engine.go index 80b728098bf..8c4fde2ab35 100644 --- a/engine/access/state_stream/engine.go +++ b/engine/access/state_stream/engine.go @@ -3,6 +3,8 @@ package state_stream import ( "github.com/rs/zerolog" + "github.com/onflow/flow/protobuf/go/flow/executiondata" + "github.com/onflow/flow-go/engine" "github.com/onflow/flow-go/model/flow" "github.com/onflow/flow-go/module/component" @@ -12,8 +14,6 @@ import ( "github.com/onflow/flow-go/module/irrecoverable" "github.com/onflow/flow-go/storage" "github.com/onflow/flow-go/utils/logging" - - access "github.com/onflow/flow/protobuf/go/flow/executiondata" ) // Engine exposes the server with the state stream API. @@ -63,7 +63,7 @@ func NewEng( }). Build() - access.RegisterExecutionDataAPIServer(server.Server, e.handler) + executiondata.RegisterExecutionDataAPIServer(server.Server, e.handler) return e, nil } diff --git a/engine/access/state_stream/handler.go b/engine/access/state_stream/handler.go index c5b1d15a668..25ecaa0556b 100644 --- a/engine/access/state_stream/handler.go +++ b/engine/access/state_stream/handler.go @@ -5,8 +5,7 @@ import ( "sync/atomic" "github.com/onflow/flow/protobuf/go/flow/execution" - access "github.com/onflow/flow/protobuf/go/flow/executiondata" - executiondata "github.com/onflow/flow/protobuf/go/flow/executiondata" + "github.com/onflow/flow/protobuf/go/flow/executiondata" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -36,7 +35,7 @@ func NewHandler(api API, chain flow.Chain, conf EventFilterConfig, maxGlobalStre return h } -func (h *Handler) GetExecutionDataByBlockID(ctx context.Context, request *access.GetExecutionDataByBlockIDRequest) (*access.GetExecutionDataByBlockIDResponse, error) { +func (h *Handler) GetExecutionDataByBlockID(ctx context.Context, request *executiondata.GetExecutionDataByBlockIDRequest) (*executiondata.GetExecutionDataByBlockIDResponse, error) { blockID, err := convert.BlockID(request.GetBlockId()) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "could not convert block ID: %v", err) @@ -59,10 +58,10 @@ func (h *Handler) GetExecutionDataByBlockID(ctx context.Context, request *access return nil, status.Errorf(codes.Internal, "could not convert execution data event payloads to JSON: %v", err) } - return &access.GetExecutionDataByBlockIDResponse{BlockExecutionData: message}, nil + return &executiondata.GetExecutionDataByBlockIDResponse{BlockExecutionData: message}, nil } -func (h *Handler) SubscribeExecutionData(request *access.SubscribeExecutionDataRequest, stream access.ExecutionDataAPI_SubscribeExecutionDataServer) error { +func (h *Handler) SubscribeExecutionData(request *executiondata.SubscribeExecutionDataRequest, stream executiondata.ExecutionDataAPI_SubscribeExecutionDataServer) error { // check if the maximum number of streams is reached if h.streamCount.Load() >= h.maxStreams { return status.Errorf(codes.ResourceExhausted, "maximum number of streams reached") @@ -117,7 +116,7 @@ func (h *Handler) SubscribeExecutionData(request *access.SubscribeExecutionDataR } } -func (h *Handler) SubscribeEvents(request *access.SubscribeEventsRequest, stream access.ExecutionDataAPI_SubscribeEventsServer) error { +func (h *Handler) SubscribeEvents(request *executiondata.SubscribeEventsRequest, stream executiondata.ExecutionDataAPI_SubscribeEventsServer) error { // check if the maximum number of streams is reached if h.streamCount.Load() >= h.maxStreams { return status.Errorf(codes.ResourceExhausted, "maximum number of streams reached") @@ -184,3 +183,7 @@ func (h *Handler) SubscribeEvents(request *access.SubscribeEventsRequest, stream } } } + +func (h *Handler) GetRegisterValues(ctx context.Context, request *executiondata.GetRegisterValuesRequest) (*executiondata.GetRegisterValuesResponse, error) { + return nil, status.Error(codes.Unimplemented, "not implemented") +} diff --git a/engine/access/state_stream/handler_test.go b/engine/access/state_stream/handler_test.go index 50d7a7f32a8..20845bff446 100644 --- a/engine/access/state_stream/handler_test.go +++ b/engine/access/state_stream/handler_test.go @@ -13,7 +13,7 @@ import ( "google.golang.org/grpc" jsoncdc "github.com/onflow/cadence/encoding/json" - access "github.com/onflow/flow/protobuf/go/flow/executiondata" + "github.com/onflow/flow/protobuf/go/flow/executiondata" "github.com/onflow/flow-go/engine/access/state_stream" ssmock "github.com/onflow/flow-go/engine/access/state_stream/mock" @@ -30,7 +30,7 @@ func TestExecutionDataStream(t *testing.T) { defer cancel() api := ssmock.NewAPI(t) - stream := makeStreamMock[access.SubscribeExecutionDataRequest, access.SubscribeExecutionDataResponse](ctx) + stream := makeStreamMock[executiondata.SubscribeExecutionDataRequest, executiondata.SubscribeExecutionDataResponse](ctx) sub := state_stream.NewSubscription(1) // generate some events with a payload to include @@ -52,7 +52,7 @@ func TestExecutionDataStream(t *testing.T) { wg.Add(1) go func() { wg.Done() - err := h.SubscribeExecutionData(&access.SubscribeExecutionDataRequest{}, stream) + err := h.SubscribeExecutionData(&executiondata.SubscribeExecutionDataRequest{}, stream) require.NoError(t, err) t.Log("subscription closed") }() @@ -117,7 +117,7 @@ func TestEventStream(t *testing.T) { defer cancel() api := ssmock.NewAPI(t) - stream := makeStreamMock[access.SubscribeEventsRequest, access.SubscribeEventsResponse](ctx) + stream := makeStreamMock[executiondata.SubscribeEventsRequest, executiondata.SubscribeEventsResponse](ctx) sub := state_stream.NewSubscription(1) // generate some events with a payload to include @@ -139,7 +139,7 @@ func TestEventStream(t *testing.T) { wg.Add(1) go func() { wg.Done() - err := h.SubscribeEvents(&access.SubscribeEventsRequest{}, stream) + err := h.SubscribeEvents(&executiondata.SubscribeEventsRequest{}, stream) require.NoError(t, err) t.Log("subscription closed") }() diff --git a/go.mod b/go.mod index ff3ce7b61bf..3ba9c083e2f 100644 --- a/go.mod +++ b/go.mod @@ -57,7 +57,7 @@ require ( github.com/onflow/flow-core-contracts/lib/go/templates v1.2.3 github.com/onflow/flow-go-sdk v0.41.10 github.com/onflow/flow-go/crypto v0.24.9 - github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20230915140723-432828f7afb9 + github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20231017162044-5d0f9b6dfdb2 github.com/onflow/go-bitswap v0.0.0-20230703214630-6d3db958c73d github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 github.com/pierrec/lz4 v2.6.1+incompatible diff --git a/go.sum b/go.sum index c707412ed29..bd20279ea5c 100644 --- a/go.sum +++ b/go.sum @@ -1328,8 +1328,8 @@ github.com/onflow/flow-go/crypto v0.24.9/go.mod h1:fqCzkIBBMRRkciVrvW21rECKq1oD7 github.com/onflow/flow-nft/lib/go/contracts v1.1.0 h1:rhUDeD27jhLwOqQKI/23008CYfnqXErrJvc4EFRP2a0= github.com/onflow/flow-nft/lib/go/contracts v1.1.0/go.mod h1:YsvzYng4htDgRB9sa9jxdwoTuuhjK8WYWXTyLkIigZY= github.com/onflow/flow/protobuf/go/flow v0.2.2/go.mod h1:gQxYqCfkI8lpnKsmIjwtN2mV/N2PIwc1I+RUK4HPIc8= -github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20230915140723-432828f7afb9 h1:IGDANryEVnuVAlDZDzNLMMUui9lbwS04KE70C0HXkFw= -github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20230915140723-432828f7afb9/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= +github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20231017162044-5d0f9b6dfdb2 h1:PvDTPiMYERXeuEPDSuF67Lm+dG9soy3tMOO6VtRcKwM= +github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20231017162044-5d0f9b6dfdb2/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= github.com/onflow/go-bitswap v0.0.0-20230703214630-6d3db958c73d h1:QcOAeEyF3iAUHv21LQ12sdcsr0yFrJGoGLyCAzYYtvI= github.com/onflow/go-bitswap v0.0.0-20230703214630-6d3db958c73d/go.mod h1:GCPpiyRoHncdqPj++zPr9ZOYBX4hpJ0pYZRYqSE8VKk= github.com/onflow/sdks v0.5.0 h1:2HCRibwqDaQ1c9oUApnkZtEAhWiNY2GTpRD5+ftdkN8= diff --git a/insecure/go.mod b/insecure/go.mod index 1bbd6943a68..6ce42b999aa 100644 --- a/insecure/go.mod +++ b/insecure/go.mod @@ -196,7 +196,7 @@ require ( github.com/onflow/flow-ft/lib/go/contracts v0.7.0 // indirect github.com/onflow/flow-go-sdk v0.41.10 // indirect github.com/onflow/flow-nft/lib/go/contracts v1.1.0 // indirect - github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20230915140723-432828f7afb9 // indirect + github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20231017162044-5d0f9b6dfdb2 // indirect github.com/onflow/go-bitswap v0.0.0-20230703214630-6d3db958c73d // indirect github.com/onflow/sdks v0.5.0 // indirect github.com/onflow/wal v0.0.0-20230529184820-bc9f8244608d // indirect diff --git a/insecure/go.sum b/insecure/go.sum index 2d5b86e94fa..982f2185931 100644 --- a/insecure/go.sum +++ b/insecure/go.sum @@ -1302,8 +1302,8 @@ github.com/onflow/flow-go/crypto v0.24.9/go.mod h1:fqCzkIBBMRRkciVrvW21rECKq1oD7 github.com/onflow/flow-nft/lib/go/contracts v1.1.0 h1:rhUDeD27jhLwOqQKI/23008CYfnqXErrJvc4EFRP2a0= github.com/onflow/flow-nft/lib/go/contracts v1.1.0/go.mod h1:YsvzYng4htDgRB9sa9jxdwoTuuhjK8WYWXTyLkIigZY= github.com/onflow/flow/protobuf/go/flow v0.2.2/go.mod h1:gQxYqCfkI8lpnKsmIjwtN2mV/N2PIwc1I+RUK4HPIc8= -github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20230915140723-432828f7afb9 h1:IGDANryEVnuVAlDZDzNLMMUui9lbwS04KE70C0HXkFw= -github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20230915140723-432828f7afb9/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= +github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20231017162044-5d0f9b6dfdb2 h1:PvDTPiMYERXeuEPDSuF67Lm+dG9soy3tMOO6VtRcKwM= +github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20231017162044-5d0f9b6dfdb2/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= github.com/onflow/go-bitswap v0.0.0-20230703214630-6d3db958c73d h1:QcOAeEyF3iAUHv21LQ12sdcsr0yFrJGoGLyCAzYYtvI= github.com/onflow/go-bitswap v0.0.0-20230703214630-6d3db958c73d/go.mod h1:GCPpiyRoHncdqPj++zPr9ZOYBX4hpJ0pYZRYqSE8VKk= github.com/onflow/sdks v0.5.0 h1:2HCRibwqDaQ1c9oUApnkZtEAhWiNY2GTpRD5+ftdkN8= diff --git a/integration/go.mod b/integration/go.mod index 418a3413adb..1a025b32167 100644 --- a/integration/go.mod +++ b/integration/go.mod @@ -26,7 +26,7 @@ require ( github.com/onflow/flow-go-sdk v0.41.10 github.com/onflow/flow-go/crypto v0.24.9 github.com/onflow/flow-go/insecure v0.0.0-00010101000000-000000000000 - github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20230915140723-432828f7afb9 + github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20231017162044-5d0f9b6dfdb2 github.com/plus3it/gorecurcopy v0.0.1 github.com/prometheus/client_golang v1.14.0 github.com/prometheus/client_model v0.4.0 diff --git a/integration/go.sum b/integration/go.sum index b379ee9a00b..0a671441482 100644 --- a/integration/go.sum +++ b/integration/go.sum @@ -1446,8 +1446,8 @@ github.com/onflow/flow-go/crypto v0.24.9/go.mod h1:fqCzkIBBMRRkciVrvW21rECKq1oD7 github.com/onflow/flow-nft/lib/go/contracts v1.1.0 h1:rhUDeD27jhLwOqQKI/23008CYfnqXErrJvc4EFRP2a0= github.com/onflow/flow-nft/lib/go/contracts v1.1.0/go.mod h1:YsvzYng4htDgRB9sa9jxdwoTuuhjK8WYWXTyLkIigZY= github.com/onflow/flow/protobuf/go/flow v0.2.2/go.mod h1:gQxYqCfkI8lpnKsmIjwtN2mV/N2PIwc1I+RUK4HPIc8= -github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20230915140723-432828f7afb9 h1:IGDANryEVnuVAlDZDzNLMMUui9lbwS04KE70C0HXkFw= -github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20230915140723-432828f7afb9/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= +github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20231017162044-5d0f9b6dfdb2 h1:PvDTPiMYERXeuEPDSuF67Lm+dG9soy3tMOO6VtRcKwM= +github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20231017162044-5d0f9b6dfdb2/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= github.com/onflow/go-bitswap v0.0.0-20230703214630-6d3db958c73d h1:QcOAeEyF3iAUHv21LQ12sdcsr0yFrJGoGLyCAzYYtvI= github.com/onflow/go-bitswap v0.0.0-20230703214630-6d3db958c73d/go.mod h1:GCPpiyRoHncdqPj++zPr9ZOYBX4hpJ0pYZRYqSE8VKk= github.com/onflow/nft-storefront/lib/go/contracts v0.0.0-20221222181731-14b90207cead h1:2j1Unqs76Z1b95Gu4C3Y28hzNUHBix7wL490e61SMSw=