Skip to content

Commit

Permalink
add back in close uch.closeChannel
Browse files Browse the repository at this point in the history
  • Loading branch information
RnkSngh committed Apr 25, 2024
1 parent 99c878a commit 7e2d744
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions contracts/core/UniversalChannelHandler.sol
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ contract UniversalChannelHandler is IbcReceiverBaseUpgradeable, UUPSUpgradeable,
__IbcReceiverBase_init(_dispatcher);
}

/**
* @dev Close a universal channel.
* Cannot send or receive packets after the channel is closed.
* @param channelId The channel id of the channel to be closed.
*/
function closeChannel(bytes32 channelId) external onlyOwner {
dispatcher.channelCloseInit(channelId);
}

function onChanCloseInit(bytes32 channelId, string calldata, bytes32) external onlyIbcDispatcher {}

function onChanCloseConfirm(bytes32 channelId, string calldata, bytes32) external onlyIbcDispatcher {}
Expand Down
1 change: 0 additions & 1 deletion test/upgradeableProxy/Dispatcher.upgrade.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ contract ChannelHandShakeUpgradeUtil is ChannelHandshakeUtils {
contract DispatcherUpgradeTest is ChannelHandShakeUpgradeUtil, UpgradeTestUtils {
function setUp() public override {
address targetMarsAddress = 0x71C95911E9a5D330f4D621842EC243EE1343292e;
Mars receivingMars = Mars(payable(targetMarsAddress));
(dispatcherProxy, dispatcherImplementation) = deployDispatcherProxyAndImpl(portPrefix);
deployCodeTo("contracts/examples/Mars.sol:Mars", abi.encode(address(dispatcherProxy)), targetMarsAddress);
dispatcherProxy.setClientForConnection(connectionHops[0], dummyLightClient);
Expand Down
3 changes: 2 additions & 1 deletion test/upgradeableProxy/DispatcherRC4.upgrade.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ import {IDispatcherRc4, DispatcherRc4} from "./upgrades/DispatcherRc4.sol";
contract DispatcherRC4UpgradeTest is ChannelHandShakeUpgradeUtil, UpgradeTestUtils {
Mars receivingMars;
Mars dummyMars;
IDispatcher oldDummyDispatcherProxy;

function setUp() public override {
// In Rc4 version, there can only be one dispatcher per light client so we deploy multiple clients
// Deploy dummy old dispathcer
IDispatcher oldDummyDispatcherProxy = deployDispatcherRC4ProxyAndImpl(portPrefix, dummyLightClient);
oldDummyDispatcherProxy = deployDispatcherRC4ProxyAndImpl(portPrefix, dummyLightClient);

// Deploy op old dispatcher
opLightClient = new OptimisticLightClient(1, opProofVerifier, l1BlockProvider);
Expand Down

0 comments on commit 7e2d744

Please sign in to comment.