Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests #167

Merged
merged 1 commit into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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));
}
}
Loading