Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
hujw77 committed May 21, 2024
1 parent 9b4af25 commit e68119d
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions test/EIP150.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
}
Expand Down

0 comments on commit e68119d

Please sign in to comment.