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

[CT-852] Deprecate StatefulOrderPlacementV1 #1545

Merged
merged 7 commits into from
May 20, 2024

Conversation

chenyaoy
Copy link
Contributor

@chenyaoy chenyaoy commented May 17, 2024

Changelist

We now use LongTermOrderPlacementV1, so deprecate StatefulOrderPlacementV1 to eliminate confusion

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.

Summary by CodeRabbit

  • Bug Fixes

    • Removed outdated orderPlace properties and related logic to streamline order event handling.
  • Refactor

    • Improved validation and event handling logic by removing unnecessary conditions and properties.
    • Updated internal data structures to reflect the removal of orderPlace.

These changes enhance the efficiency and accuracy of order event processing.

@chenyaoy chenyaoy changed the title Deprecate StatefulOrderPlacementV1 [CT-852] Deprecate StatefulOrderPlacementV1 May 17, 2024
Copy link
Contributor

coderabbitai bot commented May 17, 2024

Warning

Rate Limit Exceeded

@chenyaoy has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 43 minutes and 33 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.

Commits Files that changed from the base of the PR and between 0b74bf1 and b877807.

Walkthrough

The changes involve the removal of orderPlace related properties and logic from the StatefulOrderEventV1 interface and associated files. This includes updates to the TypeScript interfaces, the Proto definitions, and the validation logic in the service layer. These modifications streamline the handling of stateful orders by eliminating the orderPlace field and its associated methods.

Changes

File Path Change Summary
indexer/packages/v4-protos/src/codegen/dydxprotocol/indexer/events/events.ts
indexer/services/ender/src/validators/stateful-order-validator.ts
- Removed orderPlace properties from StatefulOrderEventV1 interface and StatefulOrderEventV1SDKType.
- Updated initialization, encoding, decoding, and fromPartial methods to exclude orderPlace.
- Removed StatefulOrderEventV1_StatefulOrderPlacementV1 import.
- Adjusted validation logic and refactored validateOrderPlace method.
- Updated getHandlerInitializer method based on orderPlace removal.
proto/dydxprotocol/indexer/events/events.proto - Updated reserved field values in StatefulOrderEventV1 message.
- Removed StatefulOrderPlacementV1 from oneof event field.

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.

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 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.

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

linear bot commented May 17, 2024

vincentwschau
vincentwschau previously approved these changes May 17, 2024
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

Out of diff range and nitpick comments (1)
indexer/packages/v4-protos/src/codegen/dydxprotocol/indexer/events/events.ts (1)

Line range hint 1-1: Review the removal of StatefulOrderPlacementV1 for potential impacts on related components.

Consider the broader impact of this removal on system components that might have depended on StatefulOrderPlacementV1. It's crucial to ensure that all dependent features are either updated or deprecated accordingly.

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 333df84 and fac6d73.
Files ignored due to path filters (1)
  • protocol/indexer/events/events.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
Files selected for processing (3)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/indexer/events/events.ts (7 hunks)
  • indexer/services/ender/src/validators/stateful-order-validator.ts (5 hunks)
  • proto/dydxprotocol/indexer/events/events.proto (1 hunks)
Additional Context Used
Path-based Instructions (3)
indexer/services/ender/src/validators/stateful-order-validator.ts (1)

Pattern **/**: Do not include a walkthrough. For all comments on line changes that are longer than 15 lines, add a prefix to the comment of what lines you are commenting on (for example: "The changes from lines 100 to 200...". Add your comment to be on the last 15 lines of the chunk rather than adding your comment to the entire chunk.

proto/dydxprotocol/indexer/events/events.proto (1)

Pattern **/**: Do not include a walkthrough. For all comments on line changes that are longer than 15 lines, add a prefix to the comment of what lines you are commenting on (for example: "The changes from lines 100 to 200...". Add your comment to be on the last 15 lines of the chunk rather than adding your comment to the entire chunk.

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

Pattern **/**: Do not include a walkthrough. For all comments on line changes that are longer than 15 lines, add a prefix to the comment of what lines you are commenting on (for example: "The changes from lines 100 to 200...". Add your comment to be on the last 15 lines of the chunk rather than adding your comment to the entire chunk.

Additional comments not posted (6)
indexer/services/ender/src/validators/stateful-order-validator.ts (2)

36-36: The refactoring of the validate method correctly reflects the removal of orderPlace. Ensure that all dependent components are updated accordingly.


178-178: The updates to getHandlerInitializer correctly handle the new event types without orderPlace. Good adherence to the new structure.

proto/dydxprotocol/indexer/events/events.proto (1)

241-241: The update to the reserved fields in StatefulOrderEventV1 is correctly implemented to avoid future conflicts. This is a good practice in protobuf design.

indexer/packages/v4-protos/src/codegen/dydxprotocol/indexer/events/events.ts (3)

Line range hint 1-1: Ensure all necessary imports are still in use after the removal of StatefulOrderPlacementV1.

Verification successful

Verify the necessity of imports in events.ts

The imports in indexer/packages/v4-protos/src/codegen/dydxprotocol/indexer/events/events.ts are still in use after the removal of StatefulOrderPlacementV1. The script output shows that all the imports are necessary and none are unused.

  • The imports from ../protocol/v1/subaccount, ../protocol/v1/clob, ../shared/removal_reason, ../protocol/v1/perpetual, protobufjs/minimal, and ../../../helpers are still required.
Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify if all imports are still necessary.

# Test: Search for unused imports. Expect: No unused imports.
rg --type typescript "import" "events.ts" | grep -v "StatefulOrderPlacementV1"

Length of output: 109



Script:

#!/bin/bash
# Description: Verify if all imports are still necessary.

# Test: Search for unused imports. Expect: No unused imports.
rg --type ts "import" "events.ts" | grep -v "StatefulOrderPlacementV1"

Length of output: 116



Script:

#!/bin/bash
# Description: Locate the `events.ts` file and verify if all imports are still necessary.

# Step 1: Locate the `events.ts` file.
file_path=$(fd events.ts)

# Step 2: Verify if all imports are still necessary.
rg --type ts "import" "$file_path" | grep -v "StatefulOrderPlacementV1"

Length of output: 860



Script:

#!/bin/bash
# Description: Verify if all imports are still necessary in the specific `events.ts` file.

# Step 1: Locate the specific `events.ts` file.
file_path="indexer/packages/v4-protos/src/codegen/dydxprotocol/indexer/events/events.ts"

# Step 2: Verify if all imports are still necessary.
rg --type ts "import" "$file_path" | grep -v "StatefulOrderPlacementV1"

Length of output: 855


Line range hint 1-1: Check for any remaining references to StatefulOrderPlacementV1 in the entire codebase.

Verification successful

No remaining references to StatefulOrderPlacementV1 found in the codebase.

  • The search for StatefulOrderPlacementV1 across the TypeScript files (excluding events.ts) returned no results.
Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Ensure no lingering references to `StatefulOrderPlacementV1` exist.

# Test: Search for the deprecated entity. Expect: No occurrences.
rg --type typescript "StatefulOrderPlacementV1" --glob '!events.ts'

Length of output: 102



Script:

#!/bin/bash
# Description: Ensure no lingering references to `StatefulOrderPlacementV1` exist.

# Test: Search for the deprecated entity. Expect: No occurrences.
rg --type ts "StatefulOrderPlacementV1" --glob '!events.ts'

Length of output: 59


Line range hint 1-1: Validate the removal process of StatefulOrderPlacementV1 against the project's deprecation policy.

@vincentwschau vincentwschau dismissed their stale review May 17, 2024 22:09

Additional question.

BrendanChou and others added 3 commits May 20, 2024 11:15
@github-actions github-actions bot removed the indexer label May 20, 2024
@github-actions github-actions bot removed the protocol label May 20, 2024
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 UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between fac6d73 and 0b74bf1.
Files selected for processing (1)
  • proto/dydxprotocol/indexer/events/events.proto (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • proto/dydxprotocol/indexer/events/events.proto

@chenyaoy chenyaoy merged commit 56501d6 into main May 20, 2024
33 checks passed
@chenyaoy chenyaoy deleted the chenyao/deprecate-StatefulOrderPlacementV1 branch May 20, 2024 16:46
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.

3 participants