Skip to content

chore: migrate GPv2Order orderUid tests to Foundry #197

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

Merged
merged 11 commits into from
Aug 12, 2024

Conversation

fedgiac
Copy link
Contributor

@fedgiac fedgiac commented Aug 7, 2024

Description

See title. Left an empty test file as a reminder that GPv2OrderTestInterface still needs to be removed from test/src.

Test Plan

CI.

Related Issues

#117

@fedgiac fedgiac requested a review from a team as a code owner August 7, 2024 14:08
Base automatically changed from migrate-test-order to main August 8, 2024 07:03
bytes32 orderDigest = keccak256("order digest");
address owner = address(uint160(uint256(keccak256("owner"))));
uint32 validTo = uint32(uint256(keccak256("valid to")));
bytes memory orderUid = executor.packOrderUidParamsTest(GPv2Order.UID_LENGTH, orderDigest, owner, validTo);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could alternatively use Order.sol within test/libraries as can all related incidences of packOrderUidParamsTest.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's true that Order.computeOrderUid is almost duplicate code of packOrderUidParamsTest. I'd still vote in favor of using packOrderUidParamsTest here because otherwise we'd need to assume that the Order library won't change in the future (and in case we wouldn't be testing GPv2Order anymore but just the custom implementation of Order.
And I really considered replacing the implementation of Order.computeOrderUid with just abi.encodePacked(...input parameters) so that I could use that to test that packOrderUidParamsTest worked as expected (but I decided not to to avoid the exact problem I mentioned above).

@fedgiac fedgiac merged commit d05b8a7 into main Aug 12, 2024
9 checks passed
@fedgiac fedgiac deleted the migrate-test-order-orderuid branch August 12, 2024 15:20
@github-actions github-actions bot locked and limited conversation to collaborators Aug 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants