From 7f7d1fea8582c4cb3b872165bc348faf0a6d304d Mon Sep 17 00:00:00 2001 From: Tyler <48813565+technicallyty@users.noreply.github.com> Date: Wed, 18 Sep 2024 08:26:34 -0700 Subject: [PATCH] fix: error handling for invalid gRPC endpoints (#757) --- cmd/slinky/main.go | 1 - providers/factories/oracle/marketmap.go | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/cmd/slinky/main.go b/cmd/slinky/main.go index f98d0833b..daa2150c8 100644 --- a/cmd/slinky/main.go +++ b/cmd/slinky/main.go @@ -5,7 +5,6 @@ import ( "errors" "fmt" "net/http" - //nolint: gosec _ "net/http/pprof" "os" diff --git a/providers/factories/oracle/marketmap.go b/providers/factories/oracle/marketmap.go index 3f184ab90..261a2da08 100644 --- a/providers/factories/oracle/marketmap.go +++ b/providers/factories/oracle/marketmap.go @@ -49,11 +49,11 @@ func MarketMapProviderFactory( return nil, err } - switch name := cfg.Name; { - case name == dydx.Name: + switch cfg.Name { + case dydx.Name: apiDataHandler, err = dydx.NewAPIHandler(logger, cfg.API) ids = []types.Chain{{ChainID: dydx.ChainID}} - case name == dydx.SwitchOverAPIHandlerName: + case dydx.SwitchOverAPIHandlerName: marketMapFetcher, err = dydx.NewDefaultSwitchOverMarketMapFetcher( logger, cfg.API, @@ -61,7 +61,7 @@ func MarketMapProviderFactory( apiMetrics, ) ids = []types.Chain{{ChainID: dydx.ChainID}} - case name == dydx.ResearchAPIHandlerName || name == dydx.ResearchCMCAPIHandlerName: + case dydx.ResearchAPIHandlerName, dydx.ResearchCMCAPIHandlerName: marketMapFetcher, err = dydx.DefaultDYDXResearchMarketMapFetcher( requestHandler, apiMetrics,