Skip to content

Commit

Permalink
Merge pull request #265 from hyperledger-labs/move-clients
Browse files Browse the repository at this point in the history
Mkdir clients/{09-localhost,ibft2,mock} and move implementations into the directories respectively

Signed-off-by: Jun Kimura <[email protected]>
  • Loading branch information
bluele authored May 15, 2024
2 parents 6b23172 + becc167 commit 491df7d
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 46 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.20;

import {ILightClient} from "../core/02-client/ILightClient.sol";
import {ILightClientErrors} from "../core/02-client/ILightClientErrors.sol";
import {IBCHeight} from "../core/02-client/IBCHeight.sol";
import {IIBCHandler} from "../core/25-handler/IIBCHandler.sol";
import {Height} from "../proto/Client.sol";
import {IbcLightclientsLocalhostV2ClientState as ClientState} from "../proto/Localhost.sol";
import {GoogleProtobufAny as Any} from "../proto/GoogleProtobufAny.sol";
import {ILightClient} from "../../core/02-client/ILightClient.sol";
import {ILightClientErrors} from "../../core/02-client/ILightClientErrors.sol";
import {IBCHeight} from "../../core/02-client/IBCHeight.sol";
import {IIBCHandler} from "../../core/25-handler/IIBCHandler.sol";
import {Height} from "../../proto/Client.sol";
import {IbcLightclientsLocalhostV2ClientState as ClientState} from "../../proto/Localhost.sol";
import {GoogleProtobufAny as Any} from "../../proto/GoogleProtobufAny.sol";

/**
* @title LocalhostClient
* @notice LocalhostClient is a light client to facilitate testing of IBC Apps on a single chain
* @dev LocalhostClient implements [09-localhost](https://github.com/cosmos/ibc/tree/main/spec/client/ics-009-loopback-cilent), but the following differences:
* @dev LocalhostClient implements [09-localhost](https://github.com/cosmos/ibc/tree/main/spec/client/ics-009-loopback-cilent), but there are some differences:
* - The client identifier is `09-localhost-0`, not `09-localhost`
* - `getLatestHeight` always returns the current block number
* - `verifyMembership` checks the proof height is not greater than the current block height
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.20;

import {IIBCHandler} from "../core/25-handler/IIBCHandler.sol";
import {LocalhostClient, LocalhostClientLib} from "../clients/LocalhostClient.sol";
import {Version, Counterparty, MerklePrefix} from "../proto/Connection.sol";
import {IBCConnectionLib} from "../core/03-connection/IBCConnectionLib.sol";
import {IIBCClient} from "../core/02-client/IIBCClient.sol";
import {IIBCClientErrors} from "../core/02-client/IIBCClientErrors.sol";
import {IIBCConnection} from "../core/03-connection/IIBCConnection.sol";
import {Height} from "../proto/Client.sol";
import {Channel, ChannelCounterparty} from "../proto/Channel.sol";
import {IbcLightclientsLocalhostV2ClientState as ClientState} from "../proto/Localhost.sol";
import {GoogleProtobufAny as Any} from "../proto/GoogleProtobufAny.sol";
import {IIBCChannelHandshake} from "../core/04-channel/IIBCChannel.sol";
import {IIBCHandler} from "../../core/25-handler/IIBCHandler.sol";
import {LocalhostClient, LocalhostClientLib} from "./LocalhostClient.sol";
import {Version, Counterparty, MerklePrefix} from "../../proto/Connection.sol";
import {IBCConnectionLib} from "../../core/03-connection/IBCConnectionLib.sol";
import {IIBCClient} from "../../core/02-client/IIBCClient.sol";
import {IIBCClientErrors} from "../../core/02-client/IIBCClientErrors.sol";
import {IIBCConnection} from "../../core/03-connection/IIBCConnection.sol";
import {Height} from "../../proto/Client.sol";
import {Channel, ChannelCounterparty} from "../../proto/Channel.sol";
import {IbcLightclientsLocalhostV2ClientState as ClientState} from "../../proto/Localhost.sol";
import {GoogleProtobufAny as Any} from "../../proto/GoogleProtobufAny.sol";
import {IIBCChannelHandshake} from "../../core/04-channel/IIBCChannel.sol";

/**
* @title LocalhostHelper
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.20;

import {ILightClient} from "../core/02-client/ILightClient.sol";
import {ILightClientErrors} from "../core/02-client/ILightClientErrors.sol";
import {IBCHeight} from "../core/02-client/IBCHeight.sol";
import {IIBCHandler} from "../core/25-handler/IIBCHandler.sol";
import {Height} from "../proto/Client.sol";
import {ILightClient} from "../../core/02-client/ILightClient.sol";
import {ILightClientErrors} from "../../core/02-client/ILightClientErrors.sol";
import {IBCHeight} from "../../core/02-client/IBCHeight.sol";
import {IIBCHandler} from "../../core/25-handler/IIBCHandler.sol";
import {Height} from "../../proto/Client.sol";
import {
IbcLightclientsIbft2V1ClientState as ClientState,
IbcLightclientsIbft2V1ConsensusState as ConsensusState,
IbcLightclientsIbft2V1Header as Header
} from "../proto/IBFT2.sol";
import {GoogleProtobufAny as Any} from "../proto/GoogleProtobufAny.sol";
} from "../../proto/IBFT2.sol";
import {GoogleProtobufAny as Any} from "../../proto/GoogleProtobufAny.sol";
import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import {RLPReader} from "solidity-rlp/contracts/RLPReader.sol";
import {MPTProof} from "solidity-mpt/src/MPTProof.sol";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
pragma solidity ^0.8.20;

import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {ILightClient} from "../core/02-client/ILightClient.sol";
import {ILightClientErrors} from "../core/02-client/ILightClientErrors.sol";
import {IBCHeight} from "../core/02-client/IBCHeight.sol";
import {IIBCHandler} from "../core/25-handler/IIBCHandler.sol";
import {Height} from "../proto/Client.sol";
import {ILightClient} from "../../core/02-client/ILightClient.sol";
import {ILightClientErrors} from "../../core/02-client/ILightClientErrors.sol";
import {IBCHeight} from "../../core/02-client/IBCHeight.sol";
import {IIBCHandler} from "../../core/25-handler/IIBCHandler.sol";
import {Height} from "../../proto/Client.sol";
import {
IbcLightclientsMockV1ClientState as ClientState,
IbcLightclientsMockV1ConsensusState as ConsensusState,
IbcLightclientsMockV1Header as Header
} from "../proto/MockClient.sol";
import {GoogleProtobufAny as Any} from "../proto/GoogleProtobufAny.sol";
} from "../../proto/MockClient.sol";
import {GoogleProtobufAny as Any} from "../../proto/GoogleProtobufAny.sol";

/// @notice MockClient implements https://github.com/datachainlab/ibc-mock-client
/// WARNING: This client is intended to be used for testing purpose.
Expand Down
4 changes: 2 additions & 2 deletions tests/foundry/src/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import {
} from "../../../contracts/core/04-channel/IBCChannelUpgrade.sol";
import {IIBCHandler} from "../../../contracts/core/25-handler/IIBCHandler.sol";
import {OwnableIBCHandler} from "../../../contracts/core/25-handler/OwnableIBCHandler.sol";
import {MockClient} from "../../../contracts/clients/MockClient.sol";
import {IBFT2Client} from "../../../contracts/clients/IBFT2Client.sol";
import {MockClient} from "../../../contracts/clients/mock/MockClient.sol";
import {IBFT2Client} from "../../../contracts/clients/ibft2/IBFT2Client.sol";
import {ICS20Bank} from "../../../contracts/apps/20-transfer/ICS20Bank.sol";
import {ICS20TransferBank} from "../../../contracts/apps/20-transfer/ICS20TransferBank.sol";
import {ERC20Token} from "../../../contracts/apps/20-transfer/ERC20Token.sol";
Expand Down
2 changes: 1 addition & 1 deletion tests/foundry/src/IBC.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import "../../../contracts/core/04-channel/IBCChannelPacketSendRecv.sol";
import "../../../contracts/core/04-channel/IBCChannelPacketTimeout.sol";
import "../../../contracts/core/04-channel/IBCChannelUpgrade.sol";
import "../../../contracts/core/24-host/IBCCommitment.sol";
import "../../../contracts/clients/MockClient.sol";
import "../../../contracts/clients/mock/MockClient.sol";
import "../../../contracts/proto/MockClient.sol";
import "../../../contracts/proto/Connection.sol";
import "../../../contracts/proto/Channel.sol";
Expand Down
4 changes: 2 additions & 2 deletions tests/foundry/src/IBCMockApp.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {Vm} from "forge-std/Test.sol";
import {IBCMockApp} from "../../../contracts/apps/mock/IBCMockApp.sol";
import {IBCMockLib} from "../../../contracts/apps/mock/IBCMockLib.sol";
import {IIBCChannelRecvPacket, IIBCChannelAcknowledgePacket} from "../../../contracts/core/04-channel/IIBCChannel.sol";
import {LocalhostClientLib} from "../../../contracts/clients/LocalhostClient.sol";
import {LocalhostHelper} from "../../../contracts/helpers/LocalhostHelper.sol";
import {LocalhostClientLib} from "../../../contracts/clients/09-localhost/LocalhostClient.sol";
import {LocalhostHelper} from "../../../contracts/clients/09-localhost/LocalhostHelper.sol";
import {ICS04PacketEventTestHelper} from "./helpers/ICS04PacketTestHelper.t.sol";

contract IBCMockAppTest is IBCTestHelper, ICS04PacketEventTestHelper {
Expand Down
2 changes: 1 addition & 1 deletion tests/foundry/src/ICS02.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import "../../../contracts/proto/MockClient.sol";
import "../../../contracts/proto/Connection.sol";
import "../../../contracts/proto/Channel.sol";
import "../../../contracts/apps/mock/IBCMockApp.sol";
import "../../../contracts/clients/MockClient.sol";
import "../../../contracts/clients/mock/MockClient.sol";
import "./helpers/TestableIBCHandler.t.sol";
import "./helpers/IBCTestHelper.t.sol";
import "./helpers/MockClientTestHelper.t.sol";
Expand Down
4 changes: 2 additions & 2 deletions tests/foundry/src/ICS04Upgrade.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import "./helpers/IBCTestHelper.t.sol";
import {Vm} from "forge-std/Test.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
import {Upgrade, UpgradeFields, Timeout} from "../../../contracts/proto/Channel.sol";
import {LocalhostClientLib} from "../../../contracts/clients/LocalhostClient.sol";
import {LocalhostHelper} from "../../../contracts/helpers/LocalhostHelper.sol";
import {LocalhostClientLib} from "../../../contracts/clients/09-localhost/LocalhostClient.sol";
import {LocalhostHelper} from "../../../contracts/clients/09-localhost/LocalhostHelper.sol";
import {IIBCChannelRecvPacket, IIBCChannelAcknowledgePacket} from "../../../contracts/core/04-channel/IIBCChannel.sol";
import {IIBCChannelUpgrade, IIBCChannelUpgradeBase} from "../../../contracts/core/04-channel/IIBCChannelUpgrade.sol";
import {TestIBCChannelUpgradableMockApp} from "./helpers/TestIBCChannelUpgradableMockApp.t.sol";
Expand Down
4 changes: 2 additions & 2 deletions tests/foundry/src/ICS04UpgradeApp.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ pragma solidity ^0.8.20;
import "./helpers/IBCTestHelper.t.sol";
import {Vm} from "forge-std/Test.sol";
import {Upgrade, UpgradeFields, Timeout} from "../../../contracts/proto/Channel.sol";
import {LocalhostClientLib} from "../../../contracts/clients/LocalhostClient.sol";
import {LocalhostHelper} from "../../../contracts/helpers/LocalhostHelper.sol";
import {LocalhostClientLib} from "../../../contracts/clients/09-localhost/LocalhostClient.sol";
import {LocalhostHelper} from "../../../contracts/clients/09-localhost/LocalhostHelper.sol";
import {IIBCChannelUpgrade} from "../../../contracts/core/04-channel/IIBCChannelUpgrade.sol";
import {TestIBCChannelUpgradableMockApp} from "./helpers/TestIBCChannelUpgradableMockApp.t.sol";
import {
Expand Down
2 changes: 1 addition & 1 deletion tests/foundry/src/helpers/IBCTestHelper.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import "../../../../contracts/proto/MockClient.sol";
import "../../../../contracts/proto/Connection.sol";
import "../../../../contracts/proto/Channel.sol";
import "../../../../contracts/apps/mock/IBCMockApp.sol";
import "../../../../contracts/clients/MockClient.sol";
import "../../../../contracts/clients/mock/MockClient.sol";
import {TestableIBCHandler} from "./TestableIBCHandler.t.sol";

abstract contract IBCTestHelper is Test {
Expand Down
2 changes: 1 addition & 1 deletion tests/foundry/src/helpers/MockClientTestHelper.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity ^0.8.20;

import {Height} from "../../../../contracts/proto/Client.sol";
import {IBCHeight} from "../../../../contracts/core/02-client/IBCHeight.sol";
import {MockClient} from "../../../../contracts/clients/MockClient.sol";
import {MockClient} from "../../../../contracts/clients/mock/MockClient.sol";
import "./IBCTestHelper.t.sol";

abstract contract MockClientTestHelper is IBCTestHelper {
Expand Down

0 comments on commit 491df7d

Please sign in to comment.