From e68119d8ba4bcc73c6953d2f9cd28e891dd37d15 Mon Sep 17 00:00:00 2001 From: echo Date: Tue, 21 May 2024 23:49:25 +0800 Subject: [PATCH] test --- test/EIP150.t.sol | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/test/EIP150.t.sol b/test/EIP150.t.sol index e38a184..72b50b3 100644 --- a/test/EIP150.t.sol +++ b/test/EIP150.t.sol @@ -30,18 +30,18 @@ contract EIP150Test is Test, Verifier { from: self, toChainId: 2, to: self, - gasLimit: 63000, + gasLimit: 0, encoded: "" }); uint256 f = ormp.fee(m.toChainId, m.from, m.gasLimit, m.encoded, ""); ormp.send{value: f}(m.toChainId, m.to, m.gasLimit, m.encoded, self, ""); vm.chainId(m.toChainId); - bool r = ormp.recv{gas: 64000}(m, ""); + bool r = ormp.recv{gas: 50000}(m, ""); assertEq(r, false); } - function test_eip150() public { + function testFail_eip150() public { m = Message({ channel: address(ormp), index: 0, @@ -60,6 +60,25 @@ contract EIP150Test is Test, Verifier { assertEq(r, false); } + function test_eip150() public { + m = Message({ + channel: address(ormp), + index: 0, + fromChainId: 1, + from: self, + toChainId: 2, + to: self, + gasLimit: 100, + encoded: abi.encodeWithSelector(this.loop.selector) + }); + uint256 f = ormp.fee(m.toChainId, m.from, m.gasLimit, m.encoded, ""); + ormp.send{value: f}(m.toChainId, m.to, m.gasLimit, m.encoded, self, ""); + vm.chainId(m.toChainId); + + bool r = ormp.recv{gas: 50000}(m, ""); + assertEq(r, false); + } + function fee(uint256, address) external pure returns (uint256) { return 2; }