fix(dex): resolve precision loss in wallet#3123
Conversation
Co-authored-by: charl <charl@vanstaden.info>
|
Cursor Agent can help with this pull request. Just |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Visit the preview URL for this PR (updated for commit 8f1dbff): https://walletrc--pull-3123-merge-z7zifvwy.web.app (expires Tue, 09 Sep 2025 11:45:21 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: f66a4ff03faa546f12f0ae5a841bd9eff2714dcc |
Co-authored-by: charl <charl@vanstaden.info>
smk762
left a comment
There was a problem hiding this comment.
- Ran 5 test swaps where min == max, matched with exact, using values with > 10 significant figures `. All 5 completed successfully ✔️
- confirmed min/max validation working in form
- confirmed new "exact" button functioning as expected.
LGTM to approve, thanks!
A minor enhancement which I can send to issue would be some form of visual indication where an order is exact only ( e.g. 🎯 ) though this should be discussed more to cover other min_volume != null cases
Fix precision loss in fraction parsing and add an "Exact" taker amount option to resolve order matching issues for large volumes.
The
fract2ratutility previously converted fraction numerator/denominator viadouble.parsebefore converting toBigInt, which introduced precision loss for large values. This caused mismatches, particularly when a maker'smin_volwas exactly equal tomax_vol, preventing takers from matching these orders precisely. The "Exact" button provides a direct way to use the maker's precisemaxVolumewithout UI-induced rounding.