From d1b41f1ddd9dda67934545391b5e5610fd31c567 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 22 Oct 2024 16:57:55 -0500 Subject: [PATCH] Bump github.com/coinbase/rosetta-sdk-go from 0.8.5 to 0.8.6 in /hedera-mirror-rosetta (#9610) * Bump github.com/coinbase/rosetta-sdk-go in /hedera-mirror-rosetta Bumps [github.com/coinbase/rosetta-sdk-go](https://github.com/coinbase/rosetta-sdk-go) from 0.8.5 to 0.8.6. - [Release notes](https://github.com/coinbase/rosetta-sdk-go/releases) - [Commits](https://github.com/coinbase/rosetta-sdk-go/compare/v0.8.5...v0.8.6) --- updated-dependencies: - dependency-name: github.com/coinbase/rosetta-sdk-go dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: Xin Li Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Xin Li --- hedera-mirror-rosetta/app/middleware/health.go | 5 +++++ .../app/middleware/health_test.go | 8 ++++++++ hedera-mirror-rosetta/app/middleware/metrics.go | 5 +++++ .../app/middleware/metrics_test.go | 6 ++++++ hedera-mirror-rosetta/go.mod | 2 +- hedera-mirror-rosetta/go.sum | 4 ++-- hedera-mirror-rosetta/main.go | 14 +++++++------- 7 files changed, 34 insertions(+), 10 deletions(-) diff --git a/hedera-mirror-rosetta/app/middleware/health.go b/hedera-mirror-rosetta/app/middleware/health.go index 2363da1b35b..f8a8204d60c 100644 --- a/hedera-mirror-rosetta/app/middleware/health.go +++ b/hedera-mirror-rosetta/app/middleware/health.go @@ -19,6 +19,7 @@ package middleware import ( "context" "fmt" + "net/http" "time" "github.com/coinbase/rosetta-sdk-go/client" @@ -91,6 +92,10 @@ func (c *healthController) Routes() server.Routes { } } +func (c *healthController) ContextFromRequest(r *http.Request) context.Context { + return r.Context() +} + func checkNetworkStatus(port uint16) func(ctx context.Context) error { serverUrl := fmt.Sprintf("http://localhost:%d", port) cfg := client.NewConfiguration(serverUrl, "readiness-check", nil) diff --git a/hedera-mirror-rosetta/app/middleware/health_test.go b/hedera-mirror-rosetta/app/middleware/health_test.go index 88b6b39bfcf..f7a502b7cf9 100644 --- a/hedera-mirror-rosetta/app/middleware/health_test.go +++ b/hedera-mirror-rosetta/app/middleware/health_test.go @@ -74,3 +74,11 @@ func TestReadiness(t *testing.T) { require.Equal(t, httpStatus, tracingResponseWriter.statusCode) } } + +func TestHealthContextFromRequest(t *testing.T) { + healthController, err := NewHealthController(&config.Config{}) + require.NoError(t, err) + + request := httptest.NewRequest("GET", "http://localhost"+readinessPath, nil) + require.Equal(t, request.Context(), healthController.ContextFromRequest(request)) +} diff --git a/hedera-mirror-rosetta/app/middleware/metrics.go b/hedera-mirror-rosetta/app/middleware/metrics.go index 57a8992552b..cd760fb0177 100644 --- a/hedera-mirror-rosetta/app/middleware/metrics.go +++ b/hedera-mirror-rosetta/app/middleware/metrics.go @@ -17,6 +17,7 @@ package middleware import ( + "context" "net/http" "github.com/coinbase/rosetta-sdk-go/server" @@ -86,6 +87,10 @@ func (c *metricsController) Routes() server.Routes { } } +func (c *metricsController) ContextFromRequest(r *http.Request) context.Context { + return r.Context() +} + // MetricsMiddleware instruments HTTP requests with request metrics func MetricsMiddleware(next http.Handler) http.Handler { return middleware.Instrument{ diff --git a/hedera-mirror-rosetta/app/middleware/metrics_test.go b/hedera-mirror-rosetta/app/middleware/metrics_test.go index 9f47a3e069d..d88bc01031a 100644 --- a/hedera-mirror-rosetta/app/middleware/metrics_test.go +++ b/hedera-mirror-rosetta/app/middleware/metrics_test.go @@ -36,3 +36,9 @@ func TestMetrics(t *testing.T) { require.Contains(t, responseWriter.Header().Get("Content-Type"), "text/plain") require.Contains(t, response, "promhttp_metric_handler_requests_total") } + +func TestMetricsContextFromRequest(t *testing.T) { + metricsController := NewMetricsController() + request := httptest.NewRequest("GET", "http://localhost"+metricsPath, nil) + require.Equal(t, request.Context(), metricsController.ContextFromRequest(request)) +} diff --git a/hedera-mirror-rosetta/go.mod b/hedera-mirror-rosetta/go.mod index e49446fa960..4040e1c37e0 100644 --- a/hedera-mirror-rosetta/go.mod +++ b/hedera-mirror-rosetta/go.mod @@ -4,7 +4,7 @@ go 1.22 require ( github.com/Code-Hex/go-generics-cache v1.5.1 - github.com/coinbase/rosetta-sdk-go v0.8.5 + github.com/coinbase/rosetta-sdk-go v0.8.6 github.com/coinbase/rosetta-sdk-go/types v1.0.0 github.com/cucumber/godog v0.14.1 github.com/ethereum/go-ethereum v1.14.11 diff --git a/hedera-mirror-rosetta/go.sum b/hedera-mirror-rosetta/go.sum index e156452c210..7f05a9de998 100644 --- a/hedera-mirror-rosetta/go.sum +++ b/hedera-mirror-rosetta/go.sum @@ -476,8 +476,8 @@ github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZ github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/coinbase/rosetta-sdk-go v0.8.5 h1:spP8996SFsRnfU8k12dxOHqDyeLXnFOpqshkclo4tMc= -github.com/coinbase/rosetta-sdk-go v0.8.5/go.mod h1:hFaqXH62zEgjZ/NFj58Sip1+JCEckTLM+xgmAUkbSIQ= +github.com/coinbase/rosetta-sdk-go v0.8.6 h1:FQ8ApWTZIsung1AsTv+DjXR7RwKnS6MQXzLcXtBNyjc= +github.com/coinbase/rosetta-sdk-go v0.8.6/go.mod h1:LD9qAq1m+pwAqEBrzNTjDy9VTYEDgeHiiltVTVyHfXI= github.com/coinbase/rosetta-sdk-go/types v1.0.0 h1:jpVIwLcPoOeCR6o1tU+Xv7r5bMONNbHU7MuEHboiFuA= github.com/coinbase/rosetta-sdk-go/types v1.0.0/go.mod h1:eq7W2TMRH22GTW0N0beDnN931DW0/WOI1R2sdHNHG4c= github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ= diff --git a/hedera-mirror-rosetta/main.go b/hedera-mirror-rosetta/main.go index 6515ee664fd..73545405ac2 100644 --- a/hedera-mirror-rosetta/main.go +++ b/hedera-mirror-rosetta/main.go @@ -87,7 +87,7 @@ func newBlockchainOnlineRouter( baseService := services.NewOnlineBaseService(blockRepo, transactionRepo) networkAPIService := services.NewNetworkAPIService(baseService, addressBookEntryRepo, network, version) - networkAPIController := server.NewNetworkAPIController(networkAPIService, asserter) + networkAPIController := server.NewNetworkAPIController(networkAPIService, asserter, nil) blockAPIService := services.NewBlockAPIService( accountRepo, @@ -96,10 +96,10 @@ func newBlockchainOnlineRouter( rosettaConfig.Response.MaxTransactionsInBlock, serverContext, ) - blockAPIController := server.NewBlockAPIController(blockAPIService, asserter) + blockAPIController := server.NewBlockAPIController(blockAPIService, asserter, nil) mempoolAPIService := services.NewMempoolAPIService() - mempoolAPIController := server.NewMempoolAPIController(mempoolAPIService, asserter) + mempoolAPIController := server.NewMempoolAPIController(mempoolAPIService, asserter, nil) constructionAPIService, err := services.NewConstructionAPIService( accountRepo, @@ -110,10 +110,10 @@ func newBlockchainOnlineRouter( if err != nil { return nil, err } - constructionAPIController := server.NewConstructionAPIController(constructionAPIService, asserter) + constructionAPIController := server.NewConstructionAPIController(constructionAPIService, asserter, nil) accountAPIService := services.NewAccountAPIService(baseService, accountRepo, rosettaConfig.Shard, rosettaConfig.Realm) - accountAPIController := server.NewAccountAPIController(accountAPIService, asserter) + accountAPIController := server.NewAccountAPIController(accountAPIService, asserter, nil) healthController, err := middleware.NewHealthController(rosettaConfig) metricsController := middleware.NewMetricsController() if err != nil { @@ -151,7 +151,7 @@ func newBlockchainOfflineRouter( if err != nil { return nil, err } - constructionAPIController := server.NewConstructionAPIController(constructionAPIService, asserter) + constructionAPIController := server.NewConstructionAPIController(constructionAPIService, asserter, nil) healthController, err := middleware.NewHealthController(rosettaConfig) if err != nil { return nil, err @@ -159,7 +159,7 @@ func newBlockchainOfflineRouter( metricsController := middleware.NewMetricsController() networkAPIService := services.NewNetworkAPIService(baseService, nil, network, version) - networkAPIController := server.NewNetworkAPIController(networkAPIService, asserter) + networkAPIController := server.NewNetworkAPIController(networkAPIService, asserter, nil) return server.NewRouter(constructionAPIController, healthController, metricsController, networkAPIController), nil }