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

GRPC Full node streaming - batching protos #1626

Merged
merged 2 commits into from
Jun 6, 2024
Merged

Conversation

jonfung-dydx
Copy link
Contributor

@jonfung-dydx jonfung-dydx commented Jun 4, 2024

Shift the debug fields of exec mode and block height one layer deeper

Summary by CodeRabbit

  • New Features

    • Enhanced order book update messages with new fields for blockHeight and execMode to provide more detailed information.
  • Improvements

    • Simplified message structures for better clarity and efficiency in handling order book updates.
  • Documentation

    • Updated comments for improved clarity regarding the snapshot field in order book updates.

Copy link
Contributor

coderabbitai bot commented Jun 4, 2024

Walkthrough

The recent changes involve restructuring and renaming fields within several interfaces and messages related to order book updates in the dydxprotocol/clob module. Specifically, the blockHeight and execMode fields were moved from the StreamOrderbookUpdatesResponse to the StreamUpdate interface and message. Additionally, comments were clarified, and method implementations were adjusted to accommodate these changes.

Changes

File Path Change Summary
indexer/packages/v4-protos/src/codegen/dydxprotocol/clob/query.ts Renamed and restructured fields within StreamOrderbookUpdatesResponse, StreamOrderbookUpdatesResponseSDKType, StreamUpdate, and StreamUpdateSDKType interfaces.
proto/dydxprotocol/clob/query.proto Simplified StreamOrderbookUpdatesResponse by removing block_height and exec_mode fields; added these fields to StreamUpdate. Modified comment for snapshot field in StreamOrderbookUpdate.
protocol/streaming/grpc/grpc_streaming_manager.go Updated SendOrderbookUpdates and SendOrderbookFillUpdates methods to set BlockHeight and ExecMode fields in StreamUpdate. Changed sendStreamUpdate method to set these fields in StreamOrderbookUpdatesResponse.

Poem

In code's deep sea, where changes flow,
Fields shift and structures grow.
Block heights rise, exec modes gleam,
Updates dance in a streamlined dream.
From proto to Go, the changes sweep,
A rabbit's joy, in code we keep. 🐇✨


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.

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 (1)
indexer/packages/v4-protos/src/codegen/dydxprotocol/clob/query.ts (1)

Line range hint 325-346: Clarify snapshot handling in comments.

The comment regarding the snapshot handling in StreamOrderbookUpdate has been clarified. This is a good improvement as it enhances the understandability of the code. It's important that such clarifications are accurate and reflect the intended functionality accurately. Consider adding examples or more detailed explanations if the process is complex.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between dba7cb6 and 731f772.

Files ignored due to path filters (1)
  • protocol/x/clob/types/query.pb.go is excluded by !**/*.pb.go
Files selected for processing (3)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/clob/query.ts (15 hunks)
  • proto/dydxprotocol/clob/query.proto (4 hunks)
  • protocol/streaming/grpc/grpc_streaming_manager.go (3 hunks)
Additional comments not posted (6)
protocol/streaming/grpc/grpc_streaming_manager.go (2)

130-131: The changes correctly set BlockHeight and ExecMode within the StreamUpdate struct, aligning with the PR objectives.


169-170: The changes correctly set BlockHeight and ExecMode within the StreamUpdate struct, aligning with the PR objectives.

proto/dydxprotocol/clob/query.proto (3)

173-173: The changes to StreamOrderbookUpdatesResponse correctly reflect the removal of block_height and exec_mode, aligning with the PR objectives.


188-191: The addition of block_height and exec_mode to StreamUpdate is correctly implemented, aligning with the PR objectives.


204-204: The clarification in the comment about the snapshot field enhances understanding and aligns with best practices for clear documentation.

indexer/packages/v4-protos/src/codegen/dydxprotocol/clob/query.ts (1)

Line range hint 360-381: Ensure consistency in naming conventions.

The changes in StreamOrderbookFill and its SDK type counterpart maintain consistency in naming conventions (clobMatch vs clob_match). This consistency is crucial for maintaining readability and preventing errors in data handling between different layers of the application.

Comment on lines +270 to +279
/** Batch of updates for the clob pair. */
updates: StreamUpdate[];
/**
* ---Additional fields used to debug issues---
* Block height of the updates.
*/

blockHeight: number;
/** Exec mode of the updates. */

execMode: number;
}
/**
* StreamOrderbookUpdatesResponse is a response message for the
* StreamOrderbookUpdates method.
*/

export interface StreamOrderbookUpdatesResponseSDKType {
/** Orderbook updates for the clob pair. */
/** Batch of updates for the clob pair. */
Copy link
Contributor

Choose a reason for hiding this comment

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

Refactor to centralize block height and exec mode data.

The restructuring of blockHeight and execMode from StreamOrderbookUpdatesResponse to StreamUpdate centralizes these properties, which could simplify data management and potentially improve data consistency across different parts of the system. Ensure that all parts of the system that interact with these properties are updated accordingly to accommodate this change.

Also applies to: 290-310

@jonfung-dydx jonfung-dydx merged commit 82778b9 into main Jun 6, 2024
32 of 34 checks passed
@jonfung-dydx jonfung-dydx deleted the jonfung/batchingProtos branch June 6, 2024 02:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants