diff --git a/test/Dispatcher/Dispatcher.multiclient.sol b/test/Dispatcher/Dispatcher.multiclient.sol index 1f13a879..0de0c38b 100644 --- a/test/Dispatcher/Dispatcher.multiclient.sol +++ b/test/Dispatcher/Dispatcher.multiclient.sol @@ -142,6 +142,8 @@ contract DispatcherRealProofMultiClient is Base { } function test_Dispatcher_removeConnection() public { + // Make sure that the connection exists before we delete it + assertEq(_getConnectiontoClientIdMapping(connectionHops1[0]), address(opLightClient)); Ics23Proof memory openChannelProof = load_proof("/test/payload/channel_confirm_pending_proof.hex", address(opLightClient)); @@ -153,7 +155,7 @@ contract DispatcherRealProofMultiClient is Base { // Remove connection to ensure packet can't be acked after removing light client dispatcherProxy.removeConnection(connectionHops1[0]); - assertEq(_getConnectiontoClientIdMapping(connectionHops1[0]), 0); + assertEq(_getConnectiontoClientIdMapping(connectionHops1[0]), address(0)); vm.expectRevert(abi.encodeWithSelector(IBCErrors.lightClientNotFound.selector, connectionHops1[0])); dispatcherProxy.acknowledgement(packet, bytes("ack"), openChannelProof); diff --git a/test/utils/Dispatcher.base.t.sol b/test/utils/Dispatcher.base.t.sol index e5179c4a..9d020c48 100644 --- a/test/utils/Dispatcher.base.t.sol +++ b/test/utils/Dispatcher.base.t.sol @@ -53,7 +53,7 @@ contract Base is IbcEventsEmitter, ProofBase, TestUtilsTest { uint256 fees ); - uint32 CONNECTION_TO_CLIENT_ID_STARTING_SLOT = 259; + uint32 CONNECTION_TO_CLIENT_ID_STARTING_SLOT = 260; uint32 SEND_PACKET_COMMITMENT_STARTING_SLOT = 255; uint64 UINT64_MAX = 18_446_744_073_709_551_615; bytes32 PEPTIDE_CHAIN_ID = bytes32(uint256(444)); @@ -286,9 +286,10 @@ contract Base is IbcEventsEmitter, ProofBase, TestUtilsTest { } // Store connection in channelid to connection mapping using store - function _getConnectiontoClientIdMapping(string memory connection) internal view returns (uint256 clientId) { - bytes32 clientIdSlot = keccak256(abi.encode(connection, CONNECTION_TO_CLIENT_ID_STARTING_SLOT)); - clientId = uint256(vm.load(address(dispatcherProxy), clientIdSlot)); + function _getConnectiontoClientIdMapping(string memory connection) internal view returns (address clientId) { + bytes32 clientIdSlot = + keccak256(abi.encodePacked(bytes(connection), uint256(CONNECTION_TO_CLIENT_ID_STARTING_SLOT))); + clientId = address(uint160(uint256(vm.load(address(dispatcherProxy), clientIdSlot)))); } function load_proof(string memory filepath, address lightClient) internal returns (Ics23Proof memory) {