-
Notifications
You must be signed in to change notification settings - Fork 992
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
Murisi/reverse conversion at source #4288
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4288 +/- ##
=======================================
Coverage 74.03% 74.04%
=======================================
Files 345 345
Lines 110047 110027 -20
=======================================
- Hits 81476 81468 -8
+ Misses 28571 28559 -12 ☔ View full report in Codecov by Sentry. |
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.
lgtm even though personally I prefer the approach of #4290
Understood. Thanks for comparing the two PRs! |
Describe your changes
Based on the bug fix in #4287. An alternative to #4290 that simplifies the exchanging an amount to some past epoch. If the current epoch is 10 and it is desired to convert an asset from epoch 2 to epoch 6 when only conversions to the latest epoch, 10, are available. Then the following process is now done:
A
B
. (If we were converting to epoch 10, thenB
would equal 0 since that is the conversion from an epoch to itself.)C=A-B
. Because of the way the conversion tree is constructed,C
is the conversion from epoch 2 to epoch 6 that would have been returned during epoch 6.So more generally
query_allowed_conversion
now returns the result of a subtractionA-B
. And by definition, the second operand of the subtraction is 0 when converting to the latest epoch, which ultimately means the result is simplyA
in that case. Additionally,compute_exchanged_amount
has been simplified removing the forward and backward conversions.Checklist before merging
breaking::
labelsnamada-docs
reponamada-indexer
ornamada-masp-indexer
, a corresponding PR is opened in that repo