Skip to content

Commit

Permalink
chore: add new integration test scenarios
Browse files Browse the repository at this point in the history
  • Loading branch information
sujithsomraaj committed Sep 7, 2023
1 parent b30dab1 commit f79b570
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 8 deletions.
8 changes: 4 additions & 4 deletions test/Setup.t.sol → test/integration-tests/Setup.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ import {WormholeReceiverAdapter} from "src/adapters/Wormhole/WormholeReceiverAda
import {AxelarSenderAdapter} from "src/adapters/axelar/AxelarSenderAdapter.sol";
import {AxelarReceiverAdapter} from "src/adapters/axelar/AxelarReceiverAdapter.sol";

import {GAC} from "../src/controllers/GAC.sol";
import {GovernanceTimelock} from "../src/controllers/GovernanceTimelock.sol";
import {GAC} from "src/controllers/GAC.sol";
import {GovernanceTimelock} from "src/controllers/GovernanceTimelock.sol";

import {MultiMessageSender} from "../src/MultiMessageSender.sol";
import {MultiMessageReceiver} from "../src/MultiMessageReceiver.sol";
import {MultiMessageSender} from "src/MultiMessageSender.sol";
import {MultiMessageReceiver} from "src/MultiMessageReceiver.sol";

/// @dev can inherit the setup in tests
abstract contract Setup is Test {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {Vm} from "forge-std/Test.sol";

/// local imports
import "../Setup.t.sol";
import "../contracts-mock/MockUniswapReceiver.sol";
import "../../contracts-mock/MockUniswapReceiver.sol";

import {MultiMessageSender} from "src/MultiMessageSender.sol";
import {MultiMessageReceiver} from "src/MultiMessageReceiver.sol";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {Vm} from "forge-std/Test.sol";

/// local imports
import "../Setup.t.sol";
import "../contracts-mock/MockUniswapReceiver.sol";
import "../../contracts-mock/MockUniswapReceiver.sol";

import {MultiMessageSender} from "src/MultiMessageSender.sol";
import {MultiMessageReceiver} from "src/MultiMessageReceiver.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity >=0.8.9;

/// library imports
import {Vm} from "forge-std/Test.sol";

/// local imports
import "../Setup.t.sol";
import "../../contracts-mock/MockUniswapReceiver.sol";

import {MultiMessageSender} from "src/MultiMessageSender.sol";
import {MultiMessageReceiver} from "src/MultiMessageReceiver.sol";
import {Error} from "src/libraries/Error.sol";
import {GovernanceTimelock} from "src/controllers/GovernanceTimelock.sol";

contract ZeroChainId is Setup {
MockUniswapReceiver target;

/// @dev intializes the setup
function setUp() public override {
super.setUp();

vm.selectFork(fork[137]);
target = new MockUniswapReceiver();
}

/// @dev just sends a message
function test_zeroChainId() public {
vm.selectFork(fork[1]);
vm.startPrank(caller);

/// send cross-chain message using MMA infra
vm.expectRevert(Error.ZERO_CHAIN_ID.selector);
MultiMessageSender(contractAddress[1][bytes("MMA_SENDER")]).remoteCall{value: 2 ether}(
0, address(target), abi.encode(MockUniswapReceiver.setValue.selector, ""), 0
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {Vm} from "forge-std/Test.sol";

/// local imports
import "../Setup.t.sol";
import "../contracts-mock/MockUniswapReceiver.sol";
import "../../contracts-mock/MockUniswapReceiver.sol";

import {MultiMessageSender} from "src/MultiMessageSender.sol";
import {MultiMessageReceiver} from "src/MultiMessageReceiver.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/unit-tests/MultiMessageReceiver.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pragma solidity >=0.8.9;
import {Vm} from "forge-std/Test.sol";

/// local imports
import "../Setup.t.sol";
import "../integration-tests/Setup.t.sol";
import "../contracts-mock/MockUniswapReceiver.sol";
import "src/adapters/Wormhole/WormholeReceiverAdapter.sol";
import "src/libraries/Error.sol";
Expand Down

0 comments on commit f79b570

Please sign in to comment.