-
Notifications
You must be signed in to change notification settings - Fork 13
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: active orders overflow bug #468
Conversation
WalkthroughThe changes made to the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant OrderbookUseCase
participant TokensUsecase
User->>OrderbookUseCase: createLimitOrder(...)
OrderbookUseCase->>TokensUsecase: GetSpotPriceScalingFactorByDenom(...)
TokensUsecase-->>OrderbookUseCase: normalizationFactor or error
alt if no error
OrderbookUseCase->>OrderbookUseCase: Calculate normalizedPrice (multiplication)
OrderbookUseCase-->>User: Order created successfully
else
OrderbookUseCase-->>User: Error message
end
Poem
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Additionally, you can add CodeRabbit Configuration File (
|
Quality Gate passedIssues Measures |
There was a problem hiding this 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
Files selected for processing (1)
- orderbook/usecase/orderbook_usecase.go (2 hunks)
Additional comments not posted (2)
orderbook/usecase/orderbook_usecase.go (2)
294-294
: Review the calculation ofnormalizedPrice
.The calculation of
normalizedPrice
has been updated to use multiplication with thenormalizationFactor
. Ensure this change aligns with the intended logic and does not introduce any discrepancies in price normalization.Consider verifying the impact of this change on the order processing logic.
224-227
: Ensure error handling forGetSpotPriceScalingFactorByDenom
.The error handling for retrieving the normalization factor is correctly implemented. Ensure that this method is robust and handles edge cases effectively.
Run the following script to verify the implementation of
GetSpotPriceScalingFactorByDenom
:Verification successful
Error handling for
GetSpotPriceScalingFactorByDenom
is correctly implemented.The function
GetSpotPriceScalingFactorByDenom
intokens/usecase/tokens_usecase.go
includes appropriate error handling, ensuring robustness in retrieving the scaling factor.
- File:
tokens/usecase/tokens_usecase.go
- Function:
GetSpotPriceScalingFactorByDenom
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the implementation of `GetSpotPriceScalingFactorByDenom`. # Test: Search for the function implementation. Expect: Correct error handling and edge case management. ast-grep --lang go --pattern $'func GetSpotPriceScalingFactorByDenom($_, $_) ($_, error) { $$$ }'Length of output: 100
Script:
#!/bin/bash # Description: Search for the function `GetSpotPriceScalingFactorByDenom` in interfaces or other related patterns. # Test: Search for the function definition in interfaces. rg 'GetSpotPriceScalingFactorByDenom' -A 3 --type goLength of output: 3462
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, I have also verified that change does not effect output by runnig a diff on after/before responses.
v25.17.0 tag contains: f1b7756 fix: no routes for this trade (#480) e6d44b6 perf: add load test for active orders (#472) bc570d6 active order fault tolerance via "best-effort" boolean return (#471) 37f4424 add concurrency to the order book processing in active orders (#470) 4f5b8b8 chore: active orders observability TODOs (#469) 7a28502 chore: add mergify backport on tag action (#473) b63ca05 fix: active orders overflow bug (#468)
* Update CHANGELOG.md v25.17.0 tag contains: f1b7756 fix: no routes for this trade (#480) e6d44b6 perf: add load test for active orders (#472) bc570d6 active order fault tolerance via "best-effort" boolean return (#471) 37f4424 add concurrency to the order book processing in active orders (#470) 4f5b8b8 chore: active orders observability TODOs (#469) 7a28502 chore: add mergify backport on tag action (#473) b63ca05 fix: active orders overflow bug (#468) * Update CHANGELOG.md Co-authored-by: Roman <[email protected]> * Update CHANGELOG.md Co-authored-by: Roman <[email protected]> * Update CHANGELOG.md Co-authored-by: Roman <[email protected]> --------- Co-authored-by: Roman <[email protected]>
* Update CHANGELOG.md v25.17.0 tag contains: f1b7756 fix: no routes for this trade (#480) e6d44b6 perf: add load test for active orders (#472) bc570d6 active order fault tolerance via "best-effort" boolean return (#471) 37f4424 add concurrency to the order book processing in active orders (#470) 4f5b8b8 chore: active orders observability TODOs (#469) 7a28502 chore: add mergify backport on tag action (#473) b63ca05 fix: active orders overflow bug (#468) * Update CHANGELOG.md Co-authored-by: Roman <[email protected]> * Update CHANGELOG.md Co-authored-by: Roman <[email protected]> * Update CHANGELOG.md Co-authored-by: Roman <[email protected]> --------- Co-authored-by: Roman <[email protected]> (cherry picked from commit 1f6db39)
* Update CHANGELOG.md v25.17.0 tag contains: f1b7756 fix: no routes for this trade (#480) e6d44b6 perf: add load test for active orders (#472) bc570d6 active order fault tolerance via "best-effort" boolean return (#471) 37f4424 add concurrency to the order book processing in active orders (#470) 4f5b8b8 chore: active orders observability TODOs (#469) 7a28502 chore: add mergify backport on tag action (#473) b63ca05 fix: active orders overflow bug (#468) * Update CHANGELOG.md Co-authored-by: Roman <[email protected]> * Update CHANGELOG.md Co-authored-by: Roman <[email protected]> * Update CHANGELOG.md Co-authored-by: Roman <[email protected]> --------- Co-authored-by: Roman <[email protected]> (cherry picked from commit 1f6db39) Co-authored-by: Calvin <[email protected]>
Discovered overflow when computing the price scaling factor. Instead, we can get it from cache.
Summary by CodeRabbit
New Features
Bug Fixes