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

Fixes for Node 20 and latest Foundry support #60

Merged
merged 2 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ jobs:
with:
submodules: recursive

# This step is required by `generate-artifacts.sh` since it pins an old
# version of the Hardhat package ("hardhat@2.12.2").
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '18.x'

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
Expand Down
9 changes: 7 additions & 2 deletions test/CoWSwapEthFlow.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,13 @@ contract TestOrderCreation is EthFlowTestSetup, ICoWSwapOnchainOrders {
assertEq(order.sellAmount, sellAmount);
assertEq(order.feeAmount, feeAmount);

vm.expectRevert();
ethFlow.createOrder{value: sellAmount}(order);
vm.expectRevert(stdError.arithmeticError);
// We use value `0` instead of the more appropriate `sellAmount` because
// otherwise we receive a revert from Foundry's internals and the call
// doesn't reach the called contract. This means that this call would
// revert regardless (the amount doesn't match) and so it's important to
// require that the revert message matches an arithmetic error.
ethFlow.createOrder{value: 0}(order);
}
}

Expand Down
3 changes: 2 additions & 1 deletion test/EthFlowOrder.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ contract TestCoWSwapOnchainOrders is Test {
assertEq(cowSwapOrder.buyTokenBalance, GPv2Order.BALANCE_ERC20);
}

/// This is a reverting library call, an internal revert is expected.
/// forge-config: default.allow_internal_expect_revert = true
function testRevertIfNoReceiver() public {
EthFlowOrder.Data memory ethFlowOrder = EthFlowOrder.Data(
IERC20(FillWithSameByte.toAddress(0x01)),
Expand All @@ -66,7 +68,6 @@ contract TestCoWSwapOnchainOrders is Test {
IERC20 wrappedNativeToken = IERC20(FillWithSameByte.toAddress(0x42));

vm.expectRevert(EthFlowOrder.ReceiverMustBeSet.selector);

ethFlowOrder.toCoWSwapOrder(wrappedNativeToken);
}
}
Loading