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(), 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 {