Skip to content

Commit

Permalink
Cleanup: remove logs
Browse files Browse the repository at this point in the history
  • Loading branch information
dwasse committed Oct 2, 2024
1 parent 7e88a97 commit 526f2af
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 24 deletions.
8 changes: 0 additions & 8 deletions services/rfq/api/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,18 +179,14 @@ func (c *clientImpl) PutRelayAck(ctx context.Context, req *model.PutAckRequest)
}

func (c *clientImpl) SubscribeActiveQuotes(ctx context.Context, req *model.SubscribeActiveRFQRequest, reqChan chan *model.ActiveRFQMessage) (respChan chan *model.ActiveRFQMessage, err error) {
fmt.Println("SubscribeActiveQuotes - starting")
conn, err := c.connectWebsocket(ctx, req)
if err != nil {
fmt.Printf("SubscribeActiveQuotes - failed to connect to websocket: %s\n", err)
return nil, fmt.Errorf("failed to connect to websocket: %w", err)
}
fmt.Println("SubscribeActiveQuotes - connected to websocket")
// first, subscrbe to the given chains
sub := model.SubscriptionParams{
Chains: req.ChainIDs,
}
fmt.Printf("SubscribeActiveQuotes - sub: %v\n", sub)
subJSON, err := json.Marshal(sub)
if err != nil {
return respChan, fmt.Errorf("error marshaling subscription params: %w", err)
Expand All @@ -200,18 +196,14 @@ func (c *clientImpl) SubscribeActiveQuotes(ctx context.Context, req *model.Subsc
Content: json.RawMessage(subJSON),
})
if err != nil {
fmt.Printf("SubscribeActiveQuotes - error sending subscribe message: %s\n", err)
return nil, fmt.Errorf("error sending subscribe message: %w", err)
}
fmt.Println("SubscribeActiveQuotes - subscribed to chains")
// make sure subscription is successful
var resp model.ActiveRFQMessage
err = conn.ReadJSON(&resp)
if err != nil {
fmt.Printf("SubscribeActiveQuotes - error reading subscribe response: %s\n", err)
return nil, fmt.Errorf("error reading subscribe response: %w", err)
}
fmt.Printf("SubscribeActiveQuotes - resp: %v\n", resp)
if !resp.Success || resp.Op != rest.SubscribeOp {
return nil, fmt.Errorf("subscription failed")
}

Check warning on line 209 in services/rfq/api/client/client.go

View check run for this annotation

Codecov / codecov/patch

services/rfq/api/client/client.go#L181-L209

Added lines #L181 - L209 were not covered by tests
Expand Down
13 changes: 0 additions & 13 deletions services/rfq/api/rest/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,7 @@ func (r *QuoterAPIServer) AuthMiddleware() gin.HandlerFunc {
loggedRequest = &req
}
case RFQRoute, RFQStreamRoute:
fmt.Println("AuthMiddleware - RFQRoute or RFQStreamRoute")
chainsHeader := c.GetHeader(ChainsHeader)
fmt.Printf("AuthMiddleware - chainsHeader: %s\n", chainsHeader)
if chainsHeader != "" {
var chainIDs []int
err = json.Unmarshal([]byte(chainsHeader), &chainIDs)
Expand All @@ -301,16 +299,13 @@ func (r *QuoterAPIServer) AuthMiddleware() gin.HandlerFunc {
for _, destChainID := range destChainIDs {
addr, err := r.checkRole(c, destChainID)
if err != nil {
fmt.Printf("AuthMiddleware - checkRole failed: %s\n", err)
c.JSON(http.StatusBadRequest, gin.H{"msg": err.Error()})
c.Abort()
return
}
if addressRecovered == nil {
addressRecovered = &addr
fmt.Printf("AuthMiddleware - addressRecovered: %s\n", *addressRecovered)
} else if *addressRecovered != addr {
fmt.Printf("AuthMiddleware - relayer address mismatch: %s\n", *addressRecovered)
c.JSON(http.StatusBadRequest, gin.H{"msg": "relayer address mismatch"})
c.Abort()
return
Expand All @@ -321,13 +316,11 @@ func (r *QuoterAPIServer) AuthMiddleware() gin.HandlerFunc {
// Store the request in context after binding and validation
c.Set("putRequest", loggedRequest)
c.Set("relayerAddr", addressRecovered.Hex())
fmt.Printf("AuthMiddleware - success relayer address: %s\n", addressRecovered.Hex())
c.Next()
}
}

func (r *QuoterAPIServer) checkRole(c *gin.Context, destChainID uint32) (addressRecovered common.Address, err error) {
fmt.Printf("checkRole - destChainID: %d\n", destChainID)
bridge, ok := r.fastBridgeContracts[destChainID]
if !ok {
err = fmt.Errorf("dest chain id not supported: %d", destChainID)
Expand Down Expand Up @@ -441,20 +434,16 @@ func (r *QuoterAPIServer) PutRelayAck(c *gin.Context) {
// @Header 101 {string} X-Api-Version "API Version Number - See docs for more info"
// @Router /rfq_stream [get].
func (r *QuoterAPIServer) GetActiveRFQWebsocket(ctx context.Context, c *gin.Context) {
fmt.Println("GetActiveRFQWebsocket")
ctx, span := r.handler.Tracer().Start(ctx, "GetActiveRFQWebsocket")
defer func() {
metrics.EndSpan(span)
}()

fmt.Println("GetActiveRFQWebsocket - upgrading websocket")
ws, err := r.upgrader.Upgrade(c.Writer, c.Request, nil)
if err != nil {
fmt.Printf("GetActiveRFQWebsocket - failed to upgrade websocket: %s\n", err)
logger.Error("Failed to set websocket upgrade", "error", err)
return
}

Check warning on line 446 in services/rfq/api/rest/server.go

View check run for this annotation

Codecov / codecov/patch

services/rfq/api/rest/server.go#L444-L446

Added lines #L444 - L446 were not covered by tests
fmt.Println("GetActiveRFQWebsocket - websocket upgraded")

// use the relayer address as the ID for the connection
rawRelayerAddr, exists := c.Get("relayerAddr")
Expand All @@ -467,7 +456,6 @@ func (r *QuoterAPIServer) GetActiveRFQWebsocket(ctx context.Context, c *gin.Cont
c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid relayer address type"})
return
}

Check warning on line 458 in services/rfq/api/rest/server.go

View check run for this annotation

Codecov / codecov/patch

services/rfq/api/rest/server.go#L456-L458

Added lines #L456 - L458 were not covered by tests
fmt.Printf("GetActiveRFQWebsocket - relayer address: %s\n", relayerAddr)

span.SetAttributes(
attribute.String("relayer_address", relayerAddr),
Expand All @@ -487,7 +475,6 @@ func (r *QuoterAPIServer) GetActiveRFQWebsocket(ctx context.Context, c *gin.Cont

client := newWsClient(relayerAddr, ws, r.pubSubManager, r.handler)
r.wsClients.Store(relayerAddr, client)
fmt.Println("GetActiveRFQWebsocket - registered ws client")
span.AddEvent("registered ws client")
err = client.Run(ctx)
if err != nil {
Expand Down
3 changes: 0 additions & 3 deletions services/rfq/relayer/quoter/quoter.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ func (m *Manager) SubmitAllQuotes(ctx context.Context) (err error) {
// SubscribeActiveRFQ subscribes to the RFQ websocket API.
// This function is blocking and will run until the context is canceled.
func (m *Manager) SubscribeActiveRFQ(ctx context.Context) (err error) {
fmt.Println("SubscribeActiveRFQ - starting")
ctx, span := m.metricsHandler.Tracer().Start(ctx, "SubscribeActiveRFQ")
defer func() {
metrics.EndSpanWithErr(span, err)
Expand All @@ -268,7 +267,6 @@ func (m *Manager) SubscribeActiveRFQ(ctx context.Context) (err error) {
for chainID := range m.config.Chains {
chainIDs = append(chainIDs, chainID)
}
fmt.Printf("SubscribeActiveRFQ - chainIDs: %v\n", chainIDs)
req := model.SubscribeActiveRFQRequest{
ChainIDs: chainIDs,
}
Expand All @@ -280,7 +278,6 @@ func (m *Manager) SubscribeActiveRFQ(ctx context.Context) (err error) {
return fmt.Errorf("error subscribing to active quotes: %w", err)
}
span.AddEvent("subscribed to active quotes")
fmt.Println("SubscribeActiveRFQ - subscribed to active quotes")
for {
select {
case <-ctx.Done():
Expand Down

0 comments on commit 526f2af

Please sign in to comment.