Skip to content

Commit

Permalink
Bump github.com/coinbase/rosetta-sdk-go from 0.8.5 to 0.8.6 in /heder…
Browse files Browse the repository at this point in the history
…a-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](coinbase/mesh-sdk-go@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] <[email protected]>
Signed-off-by: Xin Li <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Xin Li <[email protected]>
  • Loading branch information
dependabot[bot] and xin-hedera authored Oct 22, 2024
1 parent bccc7bc commit d1b41f1
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 10 deletions.
5 changes: 5 additions & 0 deletions hedera-mirror-rosetta/app/middleware/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package middleware
import (
"context"
"fmt"
"net/http"
"time"

"github.com/coinbase/rosetta-sdk-go/client"
Expand Down Expand Up @@ -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)
Expand Down
8 changes: 8 additions & 0 deletions hedera-mirror-rosetta/app/middleware/health_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
5 changes: 5 additions & 0 deletions hedera-mirror-rosetta/app/middleware/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package middleware

import (
"context"
"net/http"

"github.com/coinbase/rosetta-sdk-go/server"
Expand Down Expand Up @@ -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{
Expand Down
6 changes: 6 additions & 0 deletions hedera-mirror-rosetta/app/middleware/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
2 changes: 1 addition & 1 deletion hedera-mirror-rosetta/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions hedera-mirror-rosetta/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
14 changes: 7 additions & 7 deletions hedera-mirror-rosetta/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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 {
Expand Down Expand Up @@ -151,15 +151,15 @@ 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
}

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
}
Expand Down

0 comments on commit d1b41f1

Please sign in to comment.