-
Notifications
You must be signed in to change notification settings - Fork 182
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
bugfix: Fix native currency tip amount scaling logic for partial fills when using fulfillOrders #565
bugfix: Fix native currency tip amount scaling logic for partial fills when using fulfillOrders #565
Conversation
thank you for the PR! could you add a test that helps validate that the math/scaling log is correct now? bonus points if it fails prior to the source change and passes after it :) |
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #565 +/- ##
==========================================
+ Coverage 98.27% 98.42% +0.14%
==========================================
Files 35 35
Lines 14526 15013 +487
Branches 660 675 +15
==========================================
+ Hits 14276 14776 +500
+ Misses 245 232 -13
Partials 5 5 ☔ View full report in Codecov by Sentry. |
Hi @ryanio, thank you for reviewing the PR. Regarding your comment - my understanding is that the actual scaling happens in the smart contract and not in the SDK. In the case of partial fills, the on-chain smart contract uses the offer and consideration parameters that are submitted to the Therefore if incorrect order parameters, tips in the case of this specific bug, are passed to The expected assertion here would be for the unit test to verify that the correct order parameters (i.e the original form of the order) are passed to the I've now extended the test assertion to verify the function arguments. As per your request, created another PR to verify the presence of the bug, failing test assertion in the absence of the correct tip amounts scaling fix. |
Motivation
Fixes 564
Solution
The tip amount scaling logic has been moved into the
fulfillAvailableOrders
function where all the order's offer and consideration items are scaled proportional to the ratio of the order being filled.This ensures that the
fulfillAvailableOrders
function has access to the original (unscaled) tip amounts to be passed to the Seaport contract as consideration items.