-
Notifications
You must be signed in to change notification settings - Fork 199
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: Prune Paths + Fast ABI #183
Conversation
8fbeb3e
to
049bec9
Compare
packages/asset-swapper/src/utils/market_operation_utils/path_optimizer.ts
Outdated
Show resolved
Hide resolved
TKR-24 Prune paths
Prune paths where the smallest sell amount rate is less than the best adjusted rate. |
5bfb9f4
to
e232e5e
Compare
e232e5e
to
4ba4af0
Compare
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, just a couple of nits
packages/asset-swapper/src/utils/market_operation_utils/path.ts
Outdated
Show resolved
Hide resolved
packages/asset-swapper/src/utils/market_operation_utils/path_optimizer.ts
Outdated
Show resolved
Hide resolved
4ba4af0
to
f20674d
Compare
const sortedPaths = paths.sort((a, b) => b.adjustedCompleteRate().comparedTo(a.adjustedCompleteRate())); | ||
const sortedPaths = paths | ||
.sort((a, b) => b.adjustedCompleteRate().comparedTo(a.adjustedCompleteRate())) | ||
.filter(a => a.adjustedCompleteRate().isGreaterThanOrEqualTo(0)); |
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.
Doesn't it make more sense to have this filter()
occur in reducePaths()
?
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.
820c26e
to
30a5b2a
Compare
fa56749
to
248e5ab
Compare
9428ec3
to
93b2283
Compare
86855f9
to
086ab6a
Compare
Description
TKR-24
Simbot sells
Prune paths
Prune paths where the rate (
bestRate
) when selling a fractional amount is less than the adjusted complete rate of selling the entire amount (adjustedCompleteRate
) to the best source (sorted byadjustedCompleteRate
).Since selling anything to this path wouldn't result in any overall improvement. We can cut down on the paths to compare.
We should see no regressions, only improved response times (there is the small possibility of improved prices as we have more time to search over less paths)
Fast ABI
Use an ABI encoder/decoder which is more performant than our AbiEncoder (though lacks the transaction gas optimization).
Testing instructions
Types of changes
Checklist:
[WIP]
if necessary.