-
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
feat: Reimplement & test GetCandidateRoute algorithm #379
feat: Reimplement & test GetCandidateRoute algorithm #379
Conversation
* fix alloyed prices breakage with candidate route optimization * update docs * unit test and docs * clean up * clean up * remove test
Warning Review failedThe pull request is closed. WalkthroughThe updates primarily introduce a new Changes
Sequence DiagramsCandidate Route SearchingsequenceDiagram
participant User
participant RouterUsecase
participant CandidateRouteFinder
User ->> RouterUsecase: Request Token Swap Route
RouterUsecase ->> CandidateRouteFinder: FindCandidateRoutes(options)
CandidateRouteFinder ->> RouterUsecase: Return Routes
RouterUsecase ->> User: Return Token Swap Route
Poem
Tip CodeRabbit can use your project's `golangci-lint` configuration to improve the quality of code reviewsAdd a configuration file to your project to let CodeRabbit know how to run 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 Configration File (
|
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.
I have left a few questions ( non blocking ), looks good to me! I think breaking app in smaller parts by reating a new candidate route search abstraction really helps to manage and reduce complexity.
return sqsdomain.CandidateRoutes{}, fmt.Errorf("no pools found for denom %s", currenTokenInDenom) | ||
} | ||
|
||
for i := 0; i < len(rankedPools) && len(routes) < maxRoutes; i++ { | ||
for i := 0; i < len(rankedPools) && len(routes) < options.MaxRoutes; i++ { |
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.
it may be just a personal preference, but now options.MaxRoute
reads much better than maxRoutes
, and even better, we have documented everything in the single place!
return sqsdomain.CandidateRoutes{}, err | ||
} | ||
if len(rankedPools) == 0 { | ||
c.logger.Debug("no pools found for denom in candidate route search", zap.String("denom", denom)) |
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.
just a random idea, would it be any benefit feed this data to our observability service?
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.
Thanks for suggestion!. Specifically for this one - I don't think so. The reason is that this branch may be taken in the expected cases. It also happens quite frequently. Adding some counter/alert for this specific case would result in too much noise.
However, it might be helpful for debugging, thus, I added a log at the Debug
level.
…t-test-getcandidateroute
https://linear.app/osmosis/issue/DATA-250/[candidaterouteopt]-reimplement-and-test-getcandidateroute-algorithm
Summary by CodeRabbit
New Features
Bug Fixes
Tests
Refactor