Skip to content

Commit 6b6cf96

Browse files
committed
move IBCChannelUpgradableMockApp into apps/mock
Signed-off-by: Jun Kimura <jun.kimura@datachain.jp>
1 parent e70f0d5 commit 6b6cf96

File tree

4 files changed

+30
-21
lines changed

4 files changed

+30
-21
lines changed

tests/foundry/src/helpers/TestIBCChannelUpgradableMockApp.t.sol renamed to contracts/apps/mock/IBCChannelUpgradableMockApp.sol

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,32 @@
11
// SPDX-License-Identifier: Apache-2.0
22
pragma solidity ^0.8.20;
33

4-
import {UpgradeFields, Timeout} from "../../../../contracts/proto/Channel.sol";
5-
import {
6-
IIBCChannelUpgradeBase
7-
} from "../../../../contracts/core/04-channel/IIBCChannelUpgrade.sol";
8-
import {IIBCHandler} from "../../../../contracts/core/25-handler/IIBCHandler.sol";
9-
import {IBCMockApp} from "../../../../contracts/apps/mock/IBCMockApp.sol";
10-
import {IBCChannelUpgradableModuleBase} from "../../../../contracts/apps/commons/IBCChannelUpgradableModule.sol";
11-
import {IBCAppBase} from "../../../../contracts/apps/commons/IBCAppBase.sol";
4+
import {UpgradeFields, Timeout} from "../../proto/Channel.sol";
5+
import {IIBCChannelUpgradeBase} from "../../core/04-channel/IIBCChannelUpgrade.sol";
6+
import {IIBCHandler} from "../../core/25-handler/IIBCHandler.sol";
7+
import {IBCMockApp} from "./IBCMockApp.sol";
8+
import {IBCChannelUpgradableModuleBase} from "../commons/IBCChannelUpgradableModule.sol";
9+
import {IBCAppBase} from "../commons/IBCAppBase.sol";
1210

13-
contract TestIBCChannelUpgradableMockApp is IBCMockApp, IBCChannelUpgradableModuleBase {
11+
contract IBCChannelUpgradableMockApp is IBCMockApp, IBCChannelUpgradableModuleBase {
1412
constructor(IIBCHandler ibcHandler_) IBCMockApp(ibcHandler_) {}
1513

16-
function supportsInterface(bytes4 interfaceId) public view virtual override(IBCChannelUpgradableModuleBase, IBCAppBase) returns (bool) {
17-
return
18-
super.supportsInterface(interfaceId) || interfaceId == this.proposeAndInitUpgrade.selector;
14+
/**
15+
* @dev See {IERC165-supportsInterface}.
16+
*/
17+
function supportsInterface(bytes4 interfaceId)
18+
public
19+
view
20+
virtual
21+
override(IBCChannelUpgradableModuleBase, IBCAppBase)
22+
returns (bool)
23+
{
24+
return super.supportsInterface(interfaceId) || interfaceId == this.proposeAndInitUpgrade.selector;
1925
}
2026

27+
/**
28+
* @dev Propose upgrade and perform chanUpgradeInit.
29+
*/
2130
function proposeAndInitUpgrade(
2231
string calldata portId,
2332
string calldata channelId,

tests/foundry/src/ICS04Upgrade.t.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import {LocalhostClientLib} from "../../../contracts/clients/09-localhost/Localh
99
import {LocalhostHelper} from "../../../contracts/clients/09-localhost/LocalhostHelper.sol";
1010
import {IIBCChannelRecvPacket, IIBCChannelAcknowledgePacket} from "../../../contracts/core/04-channel/IIBCChannel.sol";
1111
import {IIBCChannelUpgradeBase} from "../../../contracts/core/04-channel/IIBCChannelUpgrade.sol";
12+
import {IBCChannelUpgradableMockApp} from "../../../contracts/apps/mock/IBCChannelUpgradableMockApp.sol";
1213
import {IIBCHostErrors} from "../../../contracts/core/24-host/IIBCHostErrors.sol";
13-
import {TestIBCChannelUpgradableMockApp} from "./helpers/TestIBCChannelUpgradableMockApp.t.sol";
1414
import {TestIBCChannelUpgradableMockAppInconsistentVersions} from "./helpers/TestIBCChannelUpgradableMockAppInconsistentVersions.t.sol";
1515
import {ICS04UpgradeTestHelper} from "./helpers/ICS04UpgradeTestHelper.t.sol";
1616
import {ICS04PacketEventTestHelper} from "./helpers/ICS04PacketTestHelper.t.sol";
@@ -28,7 +28,7 @@ contract TestICS04Upgrade is ICS04UpgradeTestHelper, ICS04PacketEventTestHelper
2828
string internal constant MOCK_APP_VERSION_2 = "mockapp-2";
2929

3030
TestableIBCHandler ibcHandler;
31-
TestIBCChannelUpgradableMockApp mockApp;
31+
IBCChannelUpgradableMockApp mockApp;
3232
TestIBCChannelUpgradableMockAppInconsistentVersions maliciousMockApp;
3333

3434
struct ChannelInfo {
@@ -39,7 +39,7 @@ contract TestICS04Upgrade is ICS04UpgradeTestHelper, ICS04PacketEventTestHelper
3939

4040
function setUp() public {
4141
ibcHandler = defaultIBCHandler();
42-
mockApp = new TestIBCChannelUpgradableMockApp(ibcHandler);
42+
mockApp = new IBCChannelUpgradableMockApp(ibcHandler);
4343
maliciousMockApp = new TestIBCChannelUpgradableMockAppInconsistentVersions(ibcHandler);
4444
ibcHandler.bindPort(MOCK_APP_PORT, mockApp);
4545
ibcHandler.registerLocalhostClient();

tests/foundry/src/ICS04UpgradeApp.t.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {LocalhostHelper} from "../../../contracts/clients/09-localhost/Localhost
88
import {
99
IIBCChannelUpgradableModule, IIBCChannelUpgradableModuleErrors
1010
} from "../../../contracts/apps/commons/IBCChannelUpgradableModule.sol";
11-
import {TestIBCChannelUpgradableMockApp} from "./helpers/TestIBCChannelUpgradableMockApp.t.sol";
11+
import {IBCChannelUpgradableMockApp} from "../../../contracts/apps/mock/IBCChannelUpgradableMockApp.sol";
1212
import {ICS04UpgradeTestHelper} from "./helpers/ICS04UpgradeTestHelper.t.sol";
1313

1414
contract TestICS04UpgradeApp is ICS04UpgradeTestHelper {
@@ -19,7 +19,7 @@ contract TestICS04UpgradeApp is ICS04UpgradeTestHelper {
1919
string internal constant MOCK_APP_VERSION_2 = "mockapp-2";
2020

2121
TestableIBCHandler ibcHandler;
22-
TestIBCChannelUpgradableMockApp mockApp;
22+
IBCChannelUpgradableMockApp mockApp;
2323

2424
struct ChannelInfo {
2525
string connectionId;
@@ -29,7 +29,7 @@ contract TestICS04UpgradeApp is ICS04UpgradeTestHelper {
2929

3030
function setUp() public {
3131
ibcHandler = defaultIBCHandler();
32-
mockApp = new TestIBCChannelUpgradableMockApp(ibcHandler);
32+
mockApp = new IBCChannelUpgradableMockApp(ibcHandler);
3333
ibcHandler.bindPort(MOCK_APP_PORT, mockApp);
3434
ibcHandler.registerLocalhostClient();
3535
ibcHandler.createLocalhostClient();

tests/foundry/src/helpers/TestIBCChannelUpgradableMockAppInconsistentVersions.t.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ pragma solidity ^0.8.20;
33

44
import {UpgradeFields} from "../../../../contracts/proto/Channel.sol";
55
import {TestableIBCHandler} from "./TestableIBCHandler.t.sol";
6-
import {TestIBCChannelUpgradableMockApp} from "./TestIBCChannelUpgradableMockApp.t.sol";
6+
import {IBCChannelUpgradableMockApp} from "../../../../contracts/apps/mock/IBCChannelUpgradableMockApp.sol";
77

8-
contract TestIBCChannelUpgradableMockAppInconsistentVersions is TestIBCChannelUpgradableMockApp {
9-
constructor(TestableIBCHandler _ibcHandler) TestIBCChannelUpgradableMockApp(_ibcHandler) {}
8+
contract TestIBCChannelUpgradableMockAppInconsistentVersions is IBCChannelUpgradableMockApp {
9+
constructor(TestableIBCHandler _ibcHandler) IBCChannelUpgradableMockApp(_ibcHandler) {}
1010

1111
function onChanUpgradeInit(
1212
string calldata portId,

0 commit comments

Comments
 (0)