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

[CLOB-1038] liquidation daemon - grpc to get all market prices #857

Merged
merged 1 commit into from
Dec 8, 2023

Conversation

jayy04
Copy link
Contributor

@jayy04 jayy04 commented Dec 8, 2023

Changelist

  • grpc to get all market prices

Test Plan

[Describe how this PR was tested (if applicable)]

Author/Reviewer Checklist

  • If this PR has changes that result in a different app state given the same prior state and transaction list, manually add the state-breaking label.
  • If the PR has breaking postgres changes to the indexer add the indexer-postgres-breaking label.
  • If this PR isn't state-breaking but has changes that modify behavior in PrepareProposal or ProcessProposal, manually add the label proposal-breaking.
  • If this PR is one of many that implement a specific feature, manually label them all feature:[feature-name].
  • If you wish to for mergify-bot to automatically create a PR to backport your change to a release branch, manually add the label backport/[branch-name].
  • Manually add any of the following labels: refactor, chore, bug.

Copy link

linear bot commented Dec 8, 2023

Copy link
Contributor

coderabbitai bot commented Dec 8, 2023

Walkthrough

The codebase has been updated to enhance the liquidation daemon's capabilities. A new PricesQueryClient has been integrated into the Client structure, allowing for querying market prices. Additionally, the GetAllSubaccounts function now supports pagination through a pageLimit parameter. A new function, GetAllMarketPrices, has been added to fetch market prices, and corresponding metrics constants have been introduced to track the latency of these new operations. Tests have been updated to cover the new functionality.

Changes

File Path Change Summary
protocol/.../client.go Added PricesQueryClient to Client type.
protocol/.../grpc_helper.go Added GetAllMarketPrices function; modified GetAllSubaccounts to accept pageLimit; added getMarketPricesFromKey function.
protocol/.../grpc_helper_test.go Added pricestypes import; added TestGetAllMarketPrices function.
protocol/lib/metrics/metric_keys.go Added DaemonGetAllMarketPricesLatency and DaemonGetMarketPricesPaginatedLatency constants.

Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between f57fd40 and eee9c22.
Files selected for processing (4)
  • protocol/daemons/liquidation/client/client.go (3 hunks)
  • protocol/daemons/liquidation/client/grpc_helper.go (5 hunks)
  • protocol/daemons/liquidation/client/grpc_helper_test.go (2 hunks)
  • protocol/lib/metrics/metric_keys.go (1 hunks)
Files skipped from review due to trivial changes (1)
  • protocol/lib/metrics/metric_keys.go
Additional comments: 11
protocol/daemons/liquidation/client/client.go (2)
  • 24-29: The addition of PricesQueryClient to the Client struct aligns with the PR's objective to introduce gRPC client functionality for retrieving market prices.

  • 91-96: Initialization of PricesQueryClient within the Start method is consistent with the PR's objective and the provided summaries.

protocol/daemons/liquidation/client/grpc_helper.go (6)
  • 93-100: The change from limit to pageLimit in the GetAllSubaccounts function aligns with the PR objectives and summaries provided, indicating a shift towards a paginated approach for data retrieval.

  • 107-112: The getSubaccountsFromKey function has been correctly updated to accept pageLimit instead of limit, consistent with the changes in GetAllSubaccounts.

  • 44-90: The implementation of the GetAllMarketPrices function correctly queries the gRPC server for market prices and handles pagination as described in the PR objectives and summaries.

  • 229-259: The getMarketPricesFromKey helper function has been added and is implemented to support the retrieval of market prices from the gRPC server using pagination, which is in line with the PR objectives and summaries.

  • 2-19: The hunks do not show the addition of the new constants DaemonGetAllMarketPricesLatency and DaemonGetMarketPricesPaginatedLatency for latency metrics. If these constants were added in a different part of the file or another file, please ensure their usage is consistent with the telemetry and metrics patterns established in the codebase.

  • 2-19: The PR objectives mention a test plan with a new test function TestGetAllMarketPrices, but the provided hunks do not include any test code. Ensure that the test plan is implemented and that the new functionality is covered by tests, as per the PR objectives.

protocol/daemons/liquidation/client/grpc_helper_test.go (3)
  • 15-21: The addition of the pricestypes import aligns with the PR's objective to introduce gRPC client functionality for market price retrieval.

  • 179-271: The new test function TestGetAllMarketPrices is well-structured and covers multiple scenarios including success, pagination, and error propagation, which aligns with the PR's objective to ensure robust testing of the new market prices retrieval functionality.

  • 176-275: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [15-271]

No further issues or improvements are identified in the provided hunks.

@jayy04 jayy04 merged commit d15697e into main Dec 8, 2023
15 of 16 checks passed
@jayy04 jayy04 deleted the jy/clob-1038 branch December 8, 2023 02:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

2 participants