Skip to content
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
4 changes: 2 additions & 2 deletions script/integration/InspectIntegration.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
3 changes: 2 additions & 1 deletion test/messaging/AuthVerifier.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down
10 changes: 4 additions & 6 deletions test/messaging/GasFeePricing.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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 {
Expand Down
33 changes: 15 additions & 18 deletions test/messaging/MessageBusSender.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions test/router/libs/UniversalTokenLib.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading