From 82dbf024b9f8e9e300ab51cd6a19d28534eb802f Mon Sep 17 00:00:00 2001 From: ChiTimesChi <88190723+ChiTimesChi@users.noreply.github.com> Date: Wed, 23 Apr 2025 17:30:03 +0100 Subject: [PATCH 1/3] chore: update actions/cache@v2 to v4 in GitHub workflows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .github/workflows/coveralls.yaml | 2 +- .github/workflows/test.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/coveralls.yaml b/.github/workflows/coveralls.yaml index 8d8d6d634..59a00410c 100644 --- a/.github/workflows/coveralls.yaml +++ b/.github/workflows/coveralls.yaml @@ -31,7 +31,7 @@ jobs: node-version: "${{ steps.nvm.outputs.NVMRC }}" - name: Cache node modules - uses: actions/cache@v2 + uses: actions/cache@v4 env: cache-name: cache-node-modules with: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index a482cb666..31bb242fb 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -51,7 +51,7 @@ jobs: submodules: recursive - name: Cache node modules - uses: actions/cache@v2 + uses: actions/cache@v4 env: cache-name: cache-node-modules with: @@ -82,7 +82,7 @@ jobs: submodules: recursive - name: Cache node modules - uses: actions/cache@v2 + uses: actions/cache@v4 env: cache-name: cache-node-modules with: From 4cde32fdc65d7a8a569540d82c49775ee98fbda5 Mon Sep 17 00:00:00 2001 From: ChiTimesChi <88190723+ChiTimesChi@users.noreply.github.com> Date: Wed, 4 Jun 2025 16:05:42 +0100 Subject: [PATCH 2/3] fix: update old tests for foundry 1.0 --- test/messaging/AuthVerifier.t.sol | 3 ++- test/messaging/GasFeePricing.t.sol | 10 +++---- test/messaging/MessageBusSender.t.sol | 33 +++++++++++------------- test/router/libs/UniversalTokenLib.t.sol | 4 --- 4 files changed, 21 insertions(+), 29 deletions(-) diff --git a/test/messaging/AuthVerifier.t.sol b/test/messaging/AuthVerifier.t.sol index 8fb86af04..392e0a723 100644 --- a/test/messaging/AuthVerifier.t.sol +++ b/test/messaging/AuthVerifier.t.sol @@ -20,7 +20,8 @@ contract AuthVerifierTest is Test { assertEq(authVerifier.nodegroup(), address(7331)); } - function testFailUnauthorizedNodeGroupSet() public { + function testUnauthorizedNodeGroupSetRevert() public { + vm.expectRevert("Ownable: caller is not the owner"); vm.prank(address(9999)); authVerifier.setNodeGroup(address(7331)); } diff --git a/test/messaging/GasFeePricing.t.sol b/test/messaging/GasFeePricing.t.sol index 7be91dc30..4733d73fd 100644 --- a/test/messaging/GasFeePricing.t.sol +++ b/test/messaging/GasFeePricing.t.sol @@ -25,7 +25,8 @@ contract GasFeePricingTest is Test { gasFeePricing = new GasFeePricing(); } - function testFailSetCostAsNotOwner() public { + function testSetCostAsNotOwnerRevert() public { + vm.expectRevert("Ownable: caller is not the owner"); vm.prank(address(0)); gasFeePricing.setCostPerChain(expectedDstChainId, expectedDstGasPrice, expectedGasTokenPriceRatio); } @@ -85,15 +86,12 @@ contract GasFeePricingTest is Test { assertEq(dstAddress, _address); } - function testFailRevertNoDstNativeAddress() public { + function testNoDstNativeAddressRevert() public { bytes memory options = gasFeePricing.encodeOptions(2, 300000, 100000000000000000, bytes32(0)); - + vm.expectRevert("dstNativeAddress empty"); (uint16 txType, uint256 gasLimit, uint256 dstAirdrop, bytes32 dstAddress) = gasFeePricing.decodeOptions( options ); - assertEq(txType, 2); - assertEq(gasLimit, 300000); - assertEq(dstAirdrop, 100000000000000000); } function testEstimateFeeWithOptionsTypeOne(uint64 _gasLimit) public { diff --git a/test/messaging/MessageBusSender.t.sol b/test/messaging/MessageBusSender.t.sol index 70698d519..966f983f9 100644 --- a/test/messaging/MessageBusSender.t.sol +++ b/test/messaging/MessageBusSender.t.sol @@ -50,38 +50,35 @@ contract MessageBusSenderTest is Test { } // Test fee query on an unset dstChain - function testFailUnsetEstimateFee() public { + function testUnsetEstimateFeeRevert() public { + vm.expectRevert("Fee not set"); messageBusSender.estimateFee(1, bytes("")); } - function testFailSendMessageWrongChainID() public { + function testSendMessageWrongChainIDRevert() public { bytes32 receiverAddress = addressToBytes32(address(1337)); // 99 is default foundry chain id + vm.expectRevert("Fee not set"); messageBusSender.sendMessage(receiverAddress, 99, bytes(""), bytes("")); } // Enforce fees above returned fee amount from fee calculator - function testFailSendMessageWithLowFees() public { - uint256 estimatedFee = messageBusSender.estimateFee(gasFeePricingTest.expectedDstChainId(), bytes("")); + function testSendMessageWithLowFeesRevert() public { + uint256 dstChainId = gasFeePricingTest.expectedDstChainId(); + uint256 estimatedFee = messageBusSender.estimateFee(dstChainId, bytes("")); bytes32 receiverAddress = addressToBytes32(address(1337)); - messageBusSender.sendMessage{value: estimatedFee - 1}( - receiverAddress, - gasFeePricingTest.expectedDstChainId(), - bytes(""), - bytes("") - ); + vm.expectRevert("Insuffient gas fee"); + messageBusSender.sendMessage{value: estimatedFee - 1}(receiverAddress, dstChainId, bytes(""), bytes("")); } // Fee calculator reverts upon 0 fees (Fee is unset) - function testFailMessageOnUnsetFees() public { - uint256 estimatedFee = messageBusSender.estimateFee(gasFeePricingTest.expectedDstChainId() - 1, bytes("")); + function testMessageOnUnsetFeesRevert() public { + uint256 dstChainId = gasFeePricingTest.expectedDstChainId() - 1; + vm.expectRevert("Fee not set"); + uint256 estimatedFee = messageBusSender.estimateFee(dstChainId, bytes("")); bytes32 receiverAddress = addressToBytes32(address(1337)); - messageBusSender.sendMessage{value: estimatedFee}( - receiverAddress, - gasFeePricingTest.expectedDstChainId() - 1, - bytes(""), - bytes("") - ); + vm.expectRevert("Fee not set"); + messageBusSender.sendMessage{value: estimatedFee}(receiverAddress, dstChainId, bytes(""), bytes("")); } // Send message without reversion, pay correct amount of fees, emit correct event diff --git a/test/router/libs/UniversalTokenLib.t.sol b/test/router/libs/UniversalTokenLib.t.sol index 29dfdf535..b8a53cb48 100644 --- a/test/router/libs/UniversalTokenLib.t.sol +++ b/test/router/libs/UniversalTokenLib.t.sol @@ -38,10 +38,6 @@ contract UniversalTokenLibraryTest is Test { // Should not revert, as the transfer is a noop due to the same recipient libHarness.universalTransfer(address(token), address(libHarness), amount); assertEq(token.balanceOf(address(libHarness)), amount); - // Trying to transfer to the harness should still revert - token.mint(address(this), amount); - vm.expectRevert("Disabled transfers to harness"); - token.transfer(address(libHarness), amount); } function testUniversalTransferETH() public { From c95feeab1a5bbece371c150167a558f6e44390dc Mon Sep 17 00:00:00 2001 From: ChiTimesChi <88190723+ChiTimesChi@users.noreply.github.com> Date: Wed, 4 Jun 2025 16:13:01 +0100 Subject: [PATCH 3/3] fix: update integration tests to 1.0 --- script/integration/InspectIntegration.s.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/integration/InspectIntegration.s.sol b/script/integration/InspectIntegration.s.sol index 6d175f3b0..9165492fa 100644 --- a/script/integration/InspectIntegration.s.sol +++ b/script/integration/InspectIntegration.s.sol @@ -3,13 +3,13 @@ pragma solidity 0.8.17; import {IntegrationTest} from "../../test/utils/IntegrationTest.sol"; -import {console, Script} from "forge-std/Script.sol"; +import {console2, Script} from "forge-std/Script.sol"; contract InspectIntegration is Script { function run(string memory testContractName) external { IntegrationTest testContract = IntegrationTest(deployCode(testContractName)); // Log chain and contract name. Also log the "run-if-deployed" flag. - console.log( + console2.log( "%s %s %s", testContract.chainName(), testContract.contractName(),