Skip to content
Prev Previous commit
Next Next commit
fix tests for bindPort
Signed-off-by: Jun Kimura <[email protected]>
  • Loading branch information
bluele committed Jul 13, 2024
commit b6b750bf0ab9ded8a84518793bc6d5a770e644d5
2 changes: 1 addition & 1 deletion .gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ TestICS03Version:testIsSupportedVersion() (gas: 7864)
TestICS03Version:testPickVersion() (gas: 25327)
TestICS03Version:testVerifyProposedVersion() (gas: 11777)
TestICS03Version:testVerifySupportedFeature() (gas: 4153)
TestICS04Handshake:testBindPort() (gas: 128408)
TestICS04Handshake:testBindPort() (gas: 137001)
TestICS04Handshake:testChanClose() (gas: 12938942)
TestICS04Handshake:testChanOpenAck() (gas: 3459492)
TestICS04Handshake:testChanOpenConfirm() (gas: 3770761)
Expand Down
12 changes: 10 additions & 2 deletions tests/foundry/src/ICS04Handshake.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,22 @@ contract TestICS04Handshake is ICS03TestHelper, ICS04HandshakeMockClientTestHelp
}

function testBindPort() public {
assertNotEq(address(handler.getIBCModuleByPort("portidone")), address(0));
vm.expectRevert();
handler.getIBCModuleByPort("portidtwo");

// must be failed if the port is already binded
vm.expectRevert();
handler.bindPort("portidone", mockApp);
// must be failed if the module does not support IIBCModule
vm.expectRevert();
handler.bindPort("portidone", IIBCModule(address(0x01)));
handler.bindPort("portidtwo", IIBCModule(address(0x01)));
// must be failed if the port is empty
vm.expectRevert();
handler.bindPort("", IIBCModule(address(0x01)));
// must be failed if the module address is empty
vm.expectRevert();
handler.bindPort("portidone", IIBCModule(address(0)));
handler.bindPort("portidtwo", IIBCModule(address(0)));
}

function testChanOpenInit() public {
Expand Down