Skip to content

Commit

Permalink
Merge pull request #6 from Moonsong-Labs/uncomment-mock-failing-tests
Browse files Browse the repository at this point in the history
Uncomment tests due to mock fix
  • Loading branch information
Karrq authored Apr 24, 2024
2 parents 5e4dbbe + 6ab2092 commit 2122285
Showing 1 changed file with 53 additions and 53 deletions.
106 changes: 53 additions & 53 deletions tests/adapters/LayerZeroAdapter.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -113,41 +113,41 @@ contract LayerZeroAdapterTest is BaseAdapterTest {
assertEq(layerZeroAdapter.infraToNativeChainId(ChainIds.POLYGON), 30109);
}

// function testLzReceive(
// address crossChainController,
// address lzEndpoint,
// address originForwarder,
// uint256 baseGasLimit
// )
// public
// setLZAdapter(crossChainController, lzEndpoint, originForwarder, baseGasLimit, ChainIds.ETHEREUM)
// {
// bytes memory payload = abi.encode('test message');

// Origin memory origin = Origin({
// srcEid: uint32(30101),
// sender: bytes32(uint256(uint160(originForwarder))),
// nonce: uint64(1)
// });

// hoax(lzEndpoint);
// vm.mockCall(
// crossChainController,
// abi.encodeWithSelector(ICrossChainReceiver.receiveCrossChainMessage.selector),
// abi.encode()
// );
// vm.expectCall(
// crossChainController,
// 0,
// abi.encodeWithSelector(
// ICrossChainReceiver.receiveCrossChainMessage.selector,
// payload,
// ChainIds.ETHEREUM
// )
// );
// layerZeroAdapter.lzReceive(origin, bytes32(0), payload, address(23), bytes(''));
// vm.clearMockedCalls();
// }
function testLzReceive(
address crossChainController,
address lzEndpoint,
address originForwarder,
uint256 baseGasLimit
)
public
setLZAdapter(crossChainController, lzEndpoint, originForwarder, baseGasLimit, ChainIds.ETHEREUM)
{
bytes memory payload = abi.encode('test message');

Origin memory origin = Origin({
srcEid: uint32(30101),
sender: bytes32(uint256(uint160(originForwarder))),
nonce: uint64(1)
});

hoax(lzEndpoint);
vm.mockCall(
crossChainController,
abi.encodeWithSelector(ICrossChainReceiver.receiveCrossChainMessage.selector),
abi.encode()
);
vm.expectCall(
crossChainController,
0,
abi.encodeWithSelector(
ICrossChainReceiver.receiveCrossChainMessage.selector,
payload,
ChainIds.ETHEREUM
)
);
layerZeroAdapter.lzReceive(origin, bytes32(0), payload, address(23), bytes(''));
vm.clearMockedCalls();
}

function testLzReceiveWhenNotEndpoint(
address crossChainController,
Expand Down Expand Up @@ -196,24 +196,24 @@ contract LayerZeroAdapterTest is BaseAdapterTest {
layerZeroAdapter.lzReceive(origin, bytes32(0), payload, address(23), bytes(''));
}

// function testForwardPayload(
// address crossChainController,
// address lzEndpoint,
// address originForwarder,
// uint256 baseGasLimit,
// uint256 dstGasLimit,
// address receiver,
// address caller
// )
// public
// setLZAdapter(crossChainController, lzEndpoint, originForwarder, baseGasLimit, ChainIds.ETHEREUM)
// {
// vm.assume(dstGasLimit < 1 ether);
// vm.assume(receiver != address(0));
// vm.assume(caller != address(0));

// _testForwardMessage(lzEndpoint, receiver, dstGasLimit, caller);
// }
function testForwardPayload(
address crossChainController,
address lzEndpoint,
address originForwarder,
uint256 baseGasLimit,
uint256 dstGasLimit,
address receiver,
address caller
)
public
setLZAdapter(crossChainController, lzEndpoint, originForwarder, baseGasLimit, ChainIds.ETHEREUM)
{
vm.assume(dstGasLimit < 1 ether);
vm.assume(receiver != address(0));
vm.assume(caller != address(0));

_testForwardMessage(lzEndpoint, receiver, dstGasLimit, caller);
}

function testForwardPayloadWithNoValue(
address crossChainController,
Expand Down

0 comments on commit 2122285

Please sign in to comment.