Skip to content
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 GPv2Trade extractOrder tests to Foundry #199

Merged
merged 2 commits into from
Aug 8, 2024

Conversation

fedgiac
Copy link
Contributor

@fedgiac fedgiac commented Aug 8, 2024

Description

See title.

Instead of just copying the order from a previous test and create all functions to fill its bytes, I decided a fuzz test is more appropriate to match the spirit of the previous test.

Test Plan

CI.

Related Issues

#121

@fedgiac fedgiac requested a review from a team as a code owner August 8, 2024 09:52
Comment on lines 46 to 57
assertEq(address(lhs.sellToken), address(rhs.sellToken));
assertEq(address(lhs.buyToken), address(rhs.buyToken));
assertEq(lhs.receiver, rhs.receiver);
assertEq(lhs.sellAmount, rhs.sellAmount);
assertEq(lhs.buyAmount, rhs.buyAmount);
assertEq(lhs.validTo, rhs.validTo);
assertEq(lhs.appData, rhs.appData);
assertEq(lhs.feeAmount, rhs.feeAmount);
assertEq(lhs.kind, rhs.kind);
assertEq(lhs.partiallyFillable, rhs.partiallyFillable);
assertEq(lhs.sellTokenBalance, rhs.sellTokenBalance);
assertEq(lhs.buyTokenBalance, rhs.buyTokenBalance);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we not simply do assertEq(keccak256(abi.encode(lhs)), keccak256(abi.encode(rhs))) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right! Fixed, 16 lines less. 🙂

@fedgiac fedgiac merged commit 089ee26 into main Aug 8, 2024
10 checks passed
@fedgiac fedgiac deleted the migrate-test-trade-extract-order branch August 8, 2024 14:34
@github-actions github-actions bot locked and limited conversation to collaborators Aug 8, 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