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

fix: remove SETTLE_TAKE_PAIR and update action discriminants #20

Merged
merged 1 commit into from
Dec 25, 2024

Conversation

shuhuiluo
Copy link
Owner

@shuhuiluo shuhuiluo commented Dec 25, 2024

Removed the SETTLE_TAKE_PAIR action as it is no longer required and adjusted the discriminant values for existing actions accordingly. Updated the tests and parsers to reflect these changes.

Summary by CodeRabbit

  • Bug Fixes

    • Simplified test cases by removing the SETTLE_TAKE_PAIR action, focusing on remaining actions in the parse_calldata function.
  • New Features

    • Updated action discriminant values in the Actions enum for various liquidity and trading operations, ensuring consistent behavior across the application.

Removed the `SETTLE_TAKE_PAIR` action as it is no longer required and adjusted the discriminant values for existing actions accordingly. Updated the tests and parsers to reflect these changes.
Copy link
Contributor

coderabbitai bot commented Dec 25, 2024

Walkthrough

The pull request introduces modifications to the discriminant values of actions in the Actions enum within the v4_planner.rs file. Multiple action variants have had their hexadecimal values adjusted, including swap, settle, take, and other related actions. Simultaneously, a test modification in v4_base_actions_parser.rs removes the SETTLE_TAKE_PAIR action from the test vector.

Changes

File Change Summary
src/utils/v4_planner.rs Reassigned discriminant values for multiple Actions enum variants, shifting hexadecimal values for swap, settle, take, and other actions
src/utils/v4_base_actions_parser.rs Removed SETTLE_TAKE_PAIR action from test vector

Poem

Bits and bytes dance and sway,
Enum values shift today,
Discriminants rearrange with glee,
A code ballet of symmetry! 🕺💻
Refactoring's sweet melody

[Adjusts glasses and clears throat]

Fascinating! The precision of these hexadecimal modifications is simply exquisite. One might even say... mathematically elegant.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c747fa3 and 78bc7e2.

📒 Files selected for processing (2)
  • src/utils/v4_base_actions_parser.rs (0 hunks)
  • src/utils/v4_planner.rs (13 hunks)
💤 Files with no reviewable changes (1)
  • src/utils/v4_base_actions_parser.rs
🔇 Additional comments (38)
src/utils/v4_planner.rs (38)

18-18: Bazinga! The increment to 0x06 for SWAP_EXACT_IN_SINGLE ensures neat spacing.


19-19: Fascinating! Shifting SWAP_EXACT_IN to 0x07 is consistent with the new offsets.


20-20: Oh, the audacity! SWAP_EXACT_OUT_SINGLE moving to 0x08 keeps a tidy sequence.


21-21: Intriguing! SWAP_EXACT_OUT is now 0x09, maintaining a logical progression.


25-25: Remarkable! SETTLE becomes 0x0b. The gap from 0x09 is presumably for future expansions.


26-26: Logical! SETTLE_ALL at 0x0c fits the updated code block.


27-27: Indeed! SETTLE_PAIR is set to 0x0d. No collisions found so far.


29-29: Fascinating choice to move TAKE to 0x0e. Ensures no overlap with earlier actions.


30-30: “Oh dear!” TAKE_ALL gets 0x0f. The continuity is acceptable.


31-31: Neat. TAKE_PORTION occupying 0x10 systematically follows the pattern.


32-32: As expected! TAKE_PAIR is 0x11, aligning with the rest.


34-34: “Bazinga x2!” CLOSE_CURRENCY claims 0x12. Notably we skip 0x13.


35-35: So SWEEP leaps to 0x14. The skipped 0x13 might be an intentional gap.


82-85: New decode arms for the swapping actions. They look consistent, no illogical bits.


86-94: Decode logic for settle/take/close/sweep updated accordingly. No immediate caveats.


294-294: Test ensures SWAP_EXACT_IN_SINGLE discriminant is 0x06. Splendid coverage.


298-298: Test cross-checks SWAP_EXACT_IN at 0x07. Thorough validation.


302-302: Affirmation that SWAP_EXACT_OUT_SINGLE is 0x08. Perfect verification.


306-306: Test ensures SWAP_EXACT_OUT equals 0x09. Consistency, check!


308-308: SETTLE at 0x0b—the test is accurate.


309-309: SETTLE_ALL verified at 0x0c. Nothing peculiar here.


312-312: SETTLE_PAIR validated at 0x0d.


314-314: TAKE recognized as 0x0e. Hodgkin's law of parallel iteration confirmed.


315-315: TAKE_ALL pinned to 0x0f. More trivial delight.


318-318: TAKE_PORTION validated at 0x10. Good test coverage.


320-320: TAKE_PAIR tested as 0x11.


323-323: CLOSE_CURRENCY is 0x12. Right on target.


325-325: SWEEP at 0x14. The skip of 0x13 remains an enigma but not an error.


339-339: Test for single swap (0x06) is consistent.


377-377: Test for multi-hop exact in uses 0x07.


404-404: Exact out scenario verifying 0x09. No mix-ups observed.


429-429: Another exact out synergy at 0x09.


454-454: Exact in scenario with 0x07; test logic remains steadfast.


512-512: SETTLE expecting 0x0b. The test’s result is conclusive.


523-523: Specified amount settle also goes 0x0b. Everything’s peachy.


534-534: SETTLE with payerIsUser=false also aligns with 0x0b.


554-554: TAKE with optional amount references 0x0e. Test is consistent.


569-569: Final test for TAKE at 0x0e with user-defined amount—works perfectly.


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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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 generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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

@shuhuiluo
Copy link
Owner Author

@coderabbitai review

Copy link
Contributor

coderabbitai bot commented Dec 25, 2024

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@shuhuiluo shuhuiluo merged commit 29ad430 into main Dec 25, 2024
3 checks passed
@shuhuiluo shuhuiluo deleted the settle-take-pair branch December 25, 2024 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant