Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFQ API: add bulk quotes endpoint #2846

Merged
merged 14 commits into from
Jul 5, 2024
Merged

RFQ API: add bulk quotes endpoint #2846

merged 14 commits into from
Jul 5, 2024

Conversation

dwasse
Copy link
Collaborator

@dwasse dwasse commented Jul 5, 2024

Summary by CodeRabbit

  • New Features
    • Introduced bulk quoting functionality, allowing users to put multiple new quotes in a single API request.
    • Added new endpoint /bulk_quotes for upserting bulk quotes from a relayer.
  • Enhancements
    • Updated API documentation to include details for bulk quote upsert requests.
    • Refactored quote modification logic to support bulk operations.
  • Configuration
    • Added new configuration option to toggle between single and bulk quote submission.

9fbfc16: docs preview link
f026953: docs preview link

Copy link
Contributor

coderabbitai bot commented Jul 5, 2024

Walkthrough

The changes introduce a new bulk quote upsertion feature in the RFQ system. An enhanced API now allows relayers to submit multiple quotes in a single request. Adopting this new functionality, the RFQ service has expanded its client, handler, and database interfaces, updated endpoint documentation, altered setup configurations, and introduced new request models.

Changes

Files Change Summary
services/rfq/api/client/client.go Added PutBulkQuotes method to AuthenticatedClient and clientImpl.
.../suite_test.go Moved variables and assignments from SetupSuite to SetupTest.
.../api_db.go Added UpsertQuotes to APIDBWriter.
.../store.go Added UpsertQuotes to Store struct.
.../request.go Added new struct PutBulkQuotesRequest.
.../handler.go Refactored ModifyQuote and added ModifyBulkQuotes function.
.../server.go Added new route and handling for /bulk_quotes.
.../docs/docs.go Documented new /bulk_quotes endpoint and model.
.../swagger.json, .../swagger.yaml Added /bulk_quotes endpoint and request model.
.../quoter.go Added bulk quotes submission and configuration flag SubmitSingleQuotes.
.../relconfig/config.go Added SubmitSingleQuotes to Config struct.
docs/bridge/docs/rfq/API/upsert-quotes.api.mdx Documented new bulk quotes upsertion API.

Sequence Diagram(s)

sequenceDiagram
    participant Relayer
    participant API
    participant Handler
    participant DB
    
    Relayer->>API: PUT /bulk_quotes
    API->>Handler: HandleBulkQuotes
    Handler->>DB: UpsertQuotes
    DB-->>Handler: Success/Error
    Handler-->>API: Status Response
    API-->>Relayer: HTTP Response
Loading

Poem

In the realm of quotes so vast,
Bulk submissions arrive at last,
A single stroke, multiple prints,
Setting prices without a hint.
Database now swiftly adapts,
Relayers smile, applause perhaps.
Bulk quotes, a job now simplified,
Efficiency has amplified.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added go Pull requests that update Go code size/s labels Jul 5, 2024
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

  • Added PutBulkQuotes method to AuthenticatedClient in services/rfq/api/client/client.go
  • Introduced TestPutAndGetBulkQuotes in services/rfq/api/client/client_test.go
  • Added UpsertQuotes method to APIDBWriter in services/rfq/api/db/api_db.go
  • Implemented UpsertQuotes in services/rfq/api/db/sql/base/store.go
  • Created PutBulkQuotesRequest struct in services/rfq/api/model/request.go
  • Added ModifyBulkQuotes endpoint in services/rfq/api/rest/handler.go
  • Defined /bulk_quotes route and updated AuthMiddleware in services/rfq/api/rest/server.go
  • Introduced submitBulkQuotes method in services/rfq/relayer/quoter/quoter.go
  • Added SubmitSingleQuotes configuration option in services/rfq/relayer/relconfig/config.go

9 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Outside diff range and nitpick comments (2)
services/rfq/api/db/sql/base/store.go (1)

68-79: Ensure comprehensive error handling.

The method correctly uses gorm's OnConflict clause to handle conflicts. However, consider logging the error details for better diagnostics.

if dbTx.Error != nil {
	log.Printf("UpsertQuotes error: %v", dbTx.Error)
	return fmt.Errorf("could not update quotes: %w", dbTx.Error)
}
services/rfq/api/rest/handler.go (1)

Line range hint 121-147: Refactor error messages to follow style guidelines.

Error messages should not be capitalized.

if err != nil {
	return nil, fmt.Errorf("Invalid DestAmount")
}
if err != nil {
	return nil, fmt.Errorf("Invalid MaxOriginAmount")
}
if err != nil {
	return nil, fmt.Errorf("Invalid FixedFee")
}
if err != nil {
	return nil, fmt.Errorf("invalid DestAmount")
}
if err != nil {
	return nil, fmt.Errorf("invalid MaxOriginAmount")
}
if err != nil {
	return nil, fmt.Errorf("invalid FixedFee")
}
Tools
GitHub Check: Lint (services/rfq)

[failure] 105-105:
G601: Implicit memory aliasing in for loop. (gosec)


[failure] 124-124:
ST1005: error strings should not be capitalized (stylecheck)


[failure] 128-128:
ST1005: error strings should not be capitalized (stylecheck)


[failure] 132-132:
ST1005: error strings should not be capitalized (stylecheck)

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 9916a14 and cc5624c.

Files selected for processing (9)
  • services/rfq/api/client/client.go (2 hunks)
  • services/rfq/api/client/client_test.go (1 hunks)
  • services/rfq/api/db/api_db.go (1 hunks)
  • services/rfq/api/db/sql/base/store.go (2 hunks)
  • services/rfq/api/model/request.go (1 hunks)
  • services/rfq/api/rest/handler.go (3 hunks)
  • services/rfq/api/rest/server.go (4 hunks)
  • services/rfq/relayer/quoter/quoter.go (2 hunks)
  • services/rfq/relayer/relconfig/config.go (1 hunks)
Files skipped from review due to trivial changes (2)
  • services/rfq/api/model/request.go
  • services/rfq/relayer/relconfig/config.go
Additional context used
GitHub Check: Lint (services/rfq)
services/rfq/api/rest/handler.go

[failure] 105-105:
G601: Implicit memory aliasing in for loop. (gosec)


[failure] 124-124:
ST1005: error strings should not be capitalized (stylecheck)


[failure] 128-128:
ST1005: error strings should not be capitalized (stylecheck)


[failure] 132-132:
ST1005: error strings should not be capitalized (stylecheck)

Additional comments not posted (6)
services/rfq/api/db/api_db.go (1)

53-54: LGTM!

The UpsertQuotes method is correctly added to the APIDBWriter interface.

services/rfq/api/rest/handler.go (1)

58-69: LGTM!

The modifications to the ModifyQuote function are correct and improve code readability by using the parseDBQuote function.

services/rfq/api/client/client.go (1)

29-29: Interface update looks good.

The addition of PutBulkQuotes to the AuthenticatedClient interface aligns with the new functionality for handling multiple quotes.

services/rfq/api/rest/server.go (2)

145-146: Constant definition looks good.

The addition of BulkQuotesRoute aligns with the new functionality for handling bulk quote requests.


Line range hint 196-247: Ensure proper handling of destination chain IDs.

The updates in AuthMiddleware to handle multiple destination chain IDs for bulk quotes look good. However, ensure that the destination chain IDs are correctly processed and validated.

services/rfq/relayer/quoter/quoter.go (1)

273-297: Configuration-based submission looks good.

The updates in prepareAndSubmitQuotes to use submitBulkQuotes based on the SubmitSingleQuotes configuration flag are correctly implemented. Ensure that the configuration flag is properly set and validated.

Comment on lines +129 to +140
// PutBulkQuotes puts multiple new quotes in the RFQ quoting API.
func (c *clientImpl) PutBulkQuotes(ctx context.Context, q *model.PutBulkQuotesRequest) error {
res, err := c.rClient.R().
SetContext(ctx).
SetBody(q).
Put(rest.BulkQuotesRoute)

// TODO: Figure out if there's anything to do with the response, right now it's result: Status Code 200 OK
_ = res

return err
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure proper error handling for the response.

The function PutBulkQuotes is correctly implemented to handle multiple quotes. However, it would be beneficial to handle the response to check for errors or log relevant information.

-	// TODO: Figure out if there's anything to do with the response, right now it's result: Status Code 200 OK
-	_ = res
+	if res.IsError() {
+		return fmt.Errorf("error from server: %s", res.Status())
+	}
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// PutBulkQuotes puts multiple new quotes in the RFQ quoting API.
func (c *clientImpl) PutBulkQuotes(ctx context.Context, q *model.PutBulkQuotesRequest) error {
res, err := c.rClient.R().
SetContext(ctx).
SetBody(q).
Put(rest.BulkQuotesRoute)
// TODO: Figure out if there's anything to do with the response, right now it's result: Status Code 200 OK
_ = res
return err
}
// PutBulkQuotes puts multiple new quotes in the RFQ quoting API.
func (c *clientImpl) PutBulkQuotes(ctx context.Context, q *model.PutBulkQuotesRequest) error {
res, err := c.rClient.R().
SetContext(ctx).
SetBody(q).
Put(rest.BulkQuotesRoute)
// TODO: Figure out if there's anything to do with the response, right now it's result: Status Code 200 OK
if res.IsError() {
return fmt.Errorf("error from server: %s", res.Status())
}
return err
}

Comment on lines +615 to +627
func (m *Manager) submitBulkQuotes(ctx context.Context, quotes []model.PutQuoteRequest) error {
quoteCtx, quoteCancel := context.WithTimeout(ctx, m.config.GetQuoteSubmissionTimeout())
defer quoteCancel()

req := model.PutBulkQuotesRequest{
Quotes: quotes,
}
err := m.rfqClient.PutBulkQuotes(quoteCtx, &req)
if err != nil {
return fmt.Errorf("error submitting bulk quotes: %w", err)
}
return nil
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure proper error handling for the response.

The function submitBulkQuotes is correctly implemented to handle bulk quote submission. However, it would be beneficial to handle the response to check for errors or log relevant information.

-	if err != nil {
-		return fmt.Errorf("error submitting bulk quotes: %w", err)
-	}
+	if err != nil || res.IsError() {
+		return fmt.Errorf("error from server: %s, %w", res.Status(), err)
+	}

Committable suggestion was skipped due to low confidence.

Comment on lines +41 to +98
func (c *ClientSuite) TestPutAndGetBulkQuotes() {
req := model.PutBulkQuotesRequest{
Quotes: []model.PutQuoteRequest{
{
OriginChainID: 1,
OriginTokenAddr: "0xOriginTokenAddr",
DestChainID: 42161,
DestTokenAddr: "0xDestTokenAddr",
DestAmount: "100",
MaxOriginAmount: "200",
FixedFee: "10",
},
{
OriginChainID: 42161,
OriginTokenAddr: "0xOriginTokenAddr",
DestChainID: 1,
DestTokenAddr: "0xDestTokenAddr",
DestAmount: "100",
MaxOriginAmount: "200",
FixedFee: "10",
},
},
}

err := c.client.PutBulkQuotes(c.GetTestContext(), &req)
c.Require().NoError(err)

quotes, err := c.client.GetAllQuotes(c.GetTestContext())
c.Require().NoError(err)

expectedResp := []model.GetQuoteResponse{
{
OriginChainID: 1,
OriginTokenAddr: "0xOriginTokenAddr",
DestChainID: 42161,
DestTokenAddr: "0xDestTokenAddr",
DestAmount: "100",
MaxOriginAmount: "200",
FixedFee: "10",
RelayerAddr: c.testWallet.Address().String(),
UpdatedAt: quotes[0].UpdatedAt,
},
{
OriginChainID: 42161,
OriginTokenAddr: "0xOriginTokenAddr",
DestChainID: 1,
DestTokenAddr: "0xDestTokenAddr",
DestAmount: "100",
MaxOriginAmount: "200",
FixedFee: "10",
RelayerAddr: c.testWallet.Address().String(),
UpdatedAt: quotes[0].UpdatedAt,
},
}
c.Len(quotes, 2)
c.Equal(expectedResp[0], *quotes[0])
c.Equal(expectedResp[1], *quotes[1])
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Address implicit memory aliasing.

The loop in TestPutAndGetBulkQuotes contains implicit memory aliasing. To avoid this, create a new variable inside the loop.

for _, quoteReq := range putRequest.Quotes {
	dbQuote, err := parseDBQuote(&quoteReq, relayerAddr)
	if err != nil {
		c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid quote request"})
		return
	}
	dbQuotes = append(dbQuotes, dbQuote)
}
for i := range putRequest.Quotes {
	quoteReq := putRequest.Quotes[i]
	dbQuote, err := parseDBQuote(&quoteReq, relayerAddr)
	if err != nil {
		c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid quote request"})
		return
	}
	dbQuotes = append(dbQuotes, dbQuote)
}

Comment on lines 71 to 119
// ModifyBulkQuotes upserts multiple quotes
//
// PUT /bulk_quotes
// @dev Protected Method: Authentication is handled through middleware in server.go.
// nolint: cyclop
// @Summary Upsert quotes
// @Schemes
// @Description upsert bulk quotes from relayer.
// @Param request body model.PutBulkQuotesRequest true "query params"
// @Tags quotes
// @Accept json
// @Produce json
// @Success 200
// @Router /bulk_quotes [put].
func (h *Handler) ModifyBulkQuotes(c *gin.Context) {
// Retrieve the request from context
req, exists := c.Get("putRequest")
if !exists {
c.JSON(http.StatusBadRequest, gin.H{"error": "Request not found"})
return
}
relayerAddr, exists := c.Get("relayerAddr")
if !exists {
c.JSON(http.StatusBadRequest, gin.H{"error": "No relayer address recovered from signature"})
return
}
putRequest, ok := req.(*model.PutBulkQuotesRequest)
if !ok {
c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid request type"})
return
}

dbQuotes := []*db.Quote{}
for _, quoteReq := range putRequest.Quotes {
dbQuote, err := parseDBQuote(&quoteReq, relayerAddr)
if err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid quote request"})
return
}
dbQuotes = append(dbQuotes, dbQuote)
}

err := h.db.UpsertQuotes(c, dbQuotes)
if err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid FixedFee"})
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return
}
c.Status(http.StatusOK)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Address implicit memory aliasing.

The loop in ModifyBulkQuotes contains implicit memory aliasing. To avoid this, create a new variable inside the loop.

for _, quoteReq := range putRequest.Quotes {
	dbQuote, err := parseDBQuote(&quoteReq, relayerAddr)
	if err != nil {
		c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid quote request"})
		return
	}
	dbQuotes = append(dbQuotes, dbQuote)
}
for i := range putRequest.Quotes {
	quoteReq := putRequest.Quotes[i]
	dbQuote, err := parseDBQuote(&quoteReq, relayerAddr)
	if err != nil {
		c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid quote request"})
		return
	}
	dbQuotes = append(dbQuotes, dbQuote)
}
Tools
GitHub Check: Lint (services/rfq)

[failure] 105-105:
G601: Implicit memory aliasing in for loop. (gosec)

Copy link

codecov bot commented Jul 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 25.90211%. Comparing base (9916a14) to head (c2c7b6f).

Additional details and impacted files
@@                 Coverage Diff                 @@
##              master       #2846         +/-   ##
===================================================
- Coverage   25.91293%   25.90211%   -0.01082%     
===================================================
  Files            709         709                 
  Lines          52441       52405         -36     
  Branches          80          80                 
===================================================
- Hits           13589       13574         -15     
+ Misses         37465       37445         -20     
+ Partials        1387        1386          -1     
Flag Coverage Δ
opbot 0.21082% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

cloudflare-workers-and-pages bot commented Jul 5, 2024

Deploying sanguine-fe with  Cloudflare Pages  Cloudflare Pages

Latest commit: c2c7b6f
Status: ✅  Deploy successful!
Preview URL: https://8b09a3a8.sanguine-fe.pages.dev
Branch Preview URL: https://feat-bulk-quote.sanguine-fe.pages.dev

View logs

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

(updates since last review)

  • Added new endpoint for bulk quote upserts in services/rfq/api/rest/handler.go
  • Refactored quote submission logic to support single and bulk submissions
  • Modified parseDBQuote function to accept a value instead of a pointer for better request handling

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between cc5624c and 02ec98b.

Files selected for processing (1)
  • services/rfq/api/rest/handler.go (3 hunks)
Files skipped from review as they are similar to previous changes (1)
  • services/rfq/api/rest/handler.go

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

(updates since last review)

  • Introduced submitBulkQuotes method in services/rfq/relayer/quoter/quoter.go for handling multiple quotes in a single request.
  • Added configuration option to toggle between single and bulk quote submissions in services/rfq/relayer/quoter/quoter.go.

No major changes found since last review.

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

@github-actions github-actions bot added size/m and removed size/s labels Jul 5, 2024
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

(updates since last review)

  • Added /bulk_quotes endpoint in services/rfq/api/docs/docs.go for upserting multiple quotes.
  • Introduced model.PutBulkQuotesRequest schema in services/rfq/api/docs/swagger.json.
  • Updated services/rfq/api/docs/swagger.yaml to include new bulk quote functionality.

3 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 02ec98b and d95d62e.

Files selected for processing (4)
  • services/rfq/api/docs/docs.go (2 hunks)
  • services/rfq/api/docs/swagger.json (2 hunks)
  • services/rfq/api/docs/swagger.yaml (2 hunks)
  • services/rfq/relayer/quoter/quoter.go (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • services/rfq/relayer/quoter/quoter.go
Additional comments not posted (6)
services/rfq/api/docs/swagger.yaml (2)

46-52: Model Definition Approved

The PutBulkQuotesRequest model is correctly defined, including an array of PutQuoteRequest objects.


97-116: Endpoint Definition Approved

The /bulk_quotes endpoint is correctly defined with a PUT method, including the request body schema and expected responses.

services/rfq/api/docs/swagger.json (2)

38-68: Endpoint Definition Approved

The /bulk_quotes endpoint is correctly defined with a PUT method, including the request body schema and expected responses.


207-217: Model Definition Approved

The PutBulkQuotesRequest model is correctly defined, including an array of PutQuoteRequest objects.

services/rfq/api/docs/docs.go (2)

49-79: Endpoint Definition Approved

The /bulk_quotes endpoint is correctly defined with a PUT method, including the request body schema and expected responses.


218-228: Model Definition Approved

The PutBulkQuotesRequest model is correctly defined, including an array of PutQuoteRequest objects.

@github-actions github-actions bot added the M-docs label Jul 5, 2024
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

(updates since last review)

  • Added /bulk_quotes endpoint in docs/bridge/docs/rfq/API/upsert-quotes.api.mdx for bulk quote upsertion.
  • Updated request and response documentation for the new endpoint.

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link

codecov bot commented Jul 5, 2024

Bundle Report

Changes will increase total bundle size by 13.18MB ⬆️

Bundle name Size Change
docs-bridge-client-array-push 7.88MB 7.88MB ⬆️
docs-bridge-server-cjs 14.75MB 14.75MB ⬆️
sdk-router-@synapsecns/sdk-router-esm (removed) 252.08kB ⬇️
sdk-router-@synapsecns/sdk-router-cjs (removed) 116.91kB ⬇️
synapse-interface-client-array-push (removed) 7.44MB ⬇️
synapse-interface-server-cjs (removed) 1.37MB ⬇️
synapse-interface-edge-server-array-push (removed) 83 bytes ⬇️
widget-esm-cjs (removed) 272.4kB ⬇️

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

(updates since last review)

  • Moved test database initialization from SetupSuite to SetupTest in /services/rfq/api/client/suite_test.go
  • Moved metrics handler initialization from SetupSuite to SetupTest in /services/rfq/api/client/suite_test.go

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Outside diff range and nitpick comments (3)
docs/bridge/docs/rfq/API/upsert-quotes.api.mdx (3)

2-4: Improve Description for Clarity

The current description is concise but could be improved for clarity.

-  description: "upsert bulk quotes from relayer."
+  description: "Upsert multiple quotes in bulk from the relayer."

28-28: Add Missing Punctuation

A punctuation mark might be missing here.

-  as={"h1"}
+  as={"h1"},
Tools
LanguageTool

[uncategorized] ~28-~28: A punctuation mark might be missing here.
Context: ... "@theme/TabItem"; <Heading as={"h1"} className={"openapi__heading"} childre...

(AI_EN_LECTOR_MISSING_PUNCTUATION)


45-45: Add Missing Punctuation

A punctuation mark might be missing here.

-  id={"request"}
+  id={"request"},
Tools
LanguageTool

[uncategorized] ~45-~45: A punctuation mark might be missing here.
Context: ...sert bulk quotes from relayer. <Heading id={"request"} as={"h2"} className={...

(AI_EN_LECTOR_MISSING_PUNCTUATION)

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d95d62e and c2c7b6f.

Files selected for processing (2)
  • docs/bridge/docs/rfq/API/upsert-quotes.api.mdx (1 hunks)
  • services/rfq/api/client/suite_test.go (2 hunks)
Additional context used
LanguageTool
docs/bridge/docs/rfq/API/upsert-quotes.api.mdx

[uncategorized] ~28-~28: A punctuation mark might be missing here.
Context: ... "@theme/TabItem"; <Heading as={"h1"} className={"openapi__heading"} childre...

(AI_EN_LECTOR_MISSING_PUNCTUATION)


[uncategorized] ~45-~45: A punctuation mark might be missing here.
Context: ...sert bulk quotes from relayer. <Heading id={"request"} as={"h2"} className={...

(AI_EN_LECTOR_MISSING_PUNCTUATION)

Additional comments not posted (1)
services/rfq/api/client/suite_test.go (1)

61-62: Correct Initialization of metricsHandler

The initialization of metricsHandler is correct.

Comment on lines +63 to +68
dbType, err := dbcommon.DBTypeFromString("sqlite")
c.Require().NoError(err)
// TODO use temp file / in memory sqlite3 to not create in directory files
testDB, err := sql.Connect(c.GetSuiteContext(), dbType, filet.TmpDir(c.T(), ""), metricsHandler)
c.Require().NoError(err)
c.database = testDB
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct Initialization of testDB

The initialization of testDB is correct. However, the TODO comment should be addressed.

-  // TODO use temp file / in memory sqlite3 to not create in directory files

Consider using a temporary file or in-memory sqlite3 to avoid creating files in the directory.


Would you like me to address this TODO comment and update the code accordingly?

<!-- This is an auto-generated comment by CodeRabbit -->

@trajan0x trajan0x merged commit 48063a7 into master Jul 5, 2024
33 checks passed
@trajan0x trajan0x deleted the feat/bulk-quote branch July 5, 2024 21:57
trajan0x added a commit that referenced this pull request Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go Pull requests that update Go code M-docs size/m
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants