-
Notifications
You must be signed in to change notification settings - Fork 37
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
chore: migrate GPv2Signing recoverOrderFromTrade tests to Foundry #204
Conversation
…t-signing-set-pre-signature
Co-authored-by: mfw78 <53399572+mfw78@users.noreply.github.com>
…st-signing-recover-order-from-trade
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.
Approved, with with some discussion on why OrderFuzz.sol outside of Order.sol in test libraries.
test/libraries/OrderFuzz.sol
Outdated
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.
Is there a specific reason why this is not part of the Order
test library? If not, I'd be a fan of including this in the Order
test library - thinking of the event that downstream consumers want to fuzz orders as well (such as some kind of testing for programmatic orders) - having this all in one library to retrieve would be helpful.
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 used to be that the library was an abstract contract to be inherited by the test (I was experimenting with Foundry's fixtures) but I came to the conclusion it was better to keep it a simple library. Agreed that merging into Order
makes sense.
Description
See title.
This also introduces a small library to make it easier to create a test that uses fuzzed orders.
Fuzzed tests are used here because the exact bytes used in the tests are important, and fuzzing allows us to check if changing some bytes affects the test output. Previously, the sample order in the test was built by filling each byte with a nonzero value.
I also merged the tests "should round-trip encode order data" and "should compute order unique identifier" because it was just one line more in the first test, and now that we do fuzzing it's more efficient to do both in the same test rather than running independent fuzzes on both.
Here the signing and encoding libraries proved to be very nice to use!
Test Plan
CI.
Related Issues
#120