Skip to content
This repository was archived by the owner on Jun 16, 2025. It is now read-only.

Commit 534e4b1

Browse files
committed
use messageFee > 0 in unit tests too
1 parent 134c706 commit 534e4b1

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

evm/forge/tests/MatchingEngine.t.sol

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ contract MatchingEngineTest is Test {
5555
uint32 constant ARB_DOMAIN = 3;
5656
uint32 constant ETH_DOMAIN = 0;
5757
uint32 constant AVAX_DOMAIN = 1;
58+
uint256 constant WORMHOLE_MESSAGE_FEE = 1;
59+
uint256 constant WORMHOLE_MESSAGE_FEE_STORAGE_SLOT = 7;
5860

5961
// Environment variables.
6062
uint256 immutable TESTING_SIGNER = uint256(vm.envBytes32("TESTING_DEVNET_GUARDIAN"));
@@ -128,6 +130,9 @@ contract MatchingEngineTest is Test {
128130
}
129131

130132
function setUp() public {
133+
// Set core bridge messageFee > 0
134+
vm.store(address(wormhole), bytes32(uint256(WORMHOLE_MESSAGE_FEE_STORAGE_SLOT)), bytes32(uint256(WORMHOLE_MESSAGE_FEE)));
135+
uint256 messageFee = wormhole.messageFee();
131136
vm.startPrank(makeAddr("owner"));
132137
engine = deployProxy(USDC_ADDRESS, address(wormhole), CIRCLE_BRIDGE.fromUniversalAddress());
133138

@@ -1794,9 +1799,10 @@ contract MatchingEngineTest is Test {
17941799
// Record logs for placeMarketOrder.
17951800
vm.recordLogs();
17961801

1802+
vm.deal(caller, WORMHOLE_MESSAGE_FEE);
17971803
// Place the order.
17981804
vm.prank(caller);
1799-
engine.executeFastOrder(fastMessage);
1805+
engine.executeFastOrder{value: WORMHOLE_MESSAGE_FEE}(fastMessage);
18001806

18011807
// Fetch the logs for Wormhole message. There should be two messages.
18021808
Vm.Log[] memory logs = vm.getRecordedLogs();
@@ -1816,9 +1822,10 @@ contract MatchingEngineTest is Test {
18161822
// Record logs for placeMarketOrder.
18171823
vm.recordLogs();
18181824

1825+
vm.deal(caller, WORMHOLE_MESSAGE_FEE);
18191826
// Place the order.
18201827
vm.prank(caller);
1821-
engine.executeFastOrder(fastMessage);
1828+
engine.executeFastOrder{value: WORMHOLE_MESSAGE_FEE}(fastMessage);
18221829

18231830
// Fetch the logs for Wormhole message. There should be two messages.
18241831
Vm.Log[] memory logs = vm.getRecordedLogs();
@@ -1837,8 +1844,10 @@ contract MatchingEngineTest is Test {
18371844
// Record logs for placeMarketOrder.
18381845
vm.recordLogs();
18391846

1847+
vm.deal(caller, WORMHOLE_MESSAGE_FEE);
1848+
18401849
vm.prank(caller);
1841-
engine.executeSlowOrderAndRedeem(fastTransferVaa, params);
1850+
engine.executeSlowOrderAndRedeem{value: WORMHOLE_MESSAGE_FEE}(fastTransferVaa, params);
18421851

18431852
// Fetch the logs for Wormhole message. There should be two messages.
18441853
Vm.Log[] memory logs = vm.getRecordedLogs();

0 commit comments

Comments
 (0)