Skip to content

Commit

Permalink
fix tests (#167)
Browse files Browse the repository at this point in the history
  • Loading branch information
hujw77 authored May 21, 2024
1 parent 4eca7ca commit 802853f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
11 changes: 4 additions & 7 deletions test/Channel.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,12 @@ contract ChannelTest is Test, Verifier {
ChannelWrapper channel;
address immutable self = address(this);

bytes32[32] zeroHashes;
bytes32 msgHash;

function setUp() public {
vm.chainId(1);
channel = new ChannelWrapper(self);
channel.setDefaultConfig(self, self);
for (uint256 height = 0; height < 31; height++) {
zeroHashes[height + 1] = keccak256(abi.encodePacked(zeroHashes[height], zeroHashes[height]));
}
}

function test_constructorArgs() public {
Expand All @@ -34,7 +31,7 @@ contract ChannelTest is Test, Verifier {
}

function test_recvMessage() public {
bytes32 msgHash = channel.sendMessage(self, 2, self, 0, "");
msgHash = channel.sendMessage(self, 2, self, 0, "");

Message memory message = Message({
channel: address(channel),
Expand All @@ -55,7 +52,7 @@ contract ChannelTest is Test, Verifier {
for (uint256 i = 0; i < 100; i++) {
vm.chainId(1);
uint256 index = channel.count();
bytes32 msgHash = channel.sendMessage(self, 2, self, 0, "");
msgHash = channel.sendMessage(self, 2, self, 0, "");
Message memory message = Message({
channel: address(channel),
index: index,
Expand All @@ -73,7 +70,7 @@ contract ChannelTest is Test, Verifier {
}

function hashOf(uint256, address, uint256) public view override returns (bytes32) {
return bytes32(0);
return msgHash;
}
}

Expand Down
8 changes: 4 additions & 4 deletions test/ORMP.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ contract ORMPTest is Test, Verifier {
vm.chainId(2);
}

function test_Refunds() public {
function test_refunds() public {
uint256 f = ormp.fee(2, self, 0, "", "");
ormp.send{value: f + 5}(2, self, 0, "", address(5), "");
assertEq(address(5).balance, 5);
Expand All @@ -55,7 +55,7 @@ contract ORMPTest is Test, Verifier {
assertEq(msgHash1, msgHash2);
}

function testFail_SendWithZeroNativeFee() public {
function testFail_sendWithZeroNativeFee() public {
ormp.send{value: 0}(2, self, 0, "", address(5), "");
vm.chainId(2);
}
Expand Down Expand Up @@ -90,11 +90,11 @@ contract ORMPTest is Test, Verifier {
return 2;
}

function fee(uint256, address, uint256, bytes calldata) external pure returns (uint256) {
function fee(uint256, address, uint256, bytes calldata, bytes calldata) external pure returns (uint256) {
return 1;
}

function hashOf(uint256, address, uint256) public view override returns (bytes32) {
return bytes32(0);
return hash(message);
}
}
2 changes: 1 addition & 1 deletion test/eco/Oracle.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ contract OracleTest is Test {
assertEq(r, bytes32(uint256(1)));
}

function hashLookup(address, uint256, bytes32) external pure returns (bytes32) {
function hashLookup(address, bytes32) external pure returns (bytes32) {
return bytes32(uint256(1));
}
}

0 comments on commit 802853f

Please sign in to comment.