Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean up file structure for external devs #43

Merged
merged 5 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

pragma solidity ^0.8.9;

import './Ibc.sol';
import './IbcReceiver.sol';
import './IbcDispatcher.sol';
import './IbcMiddleware.sol';
import '../libs/Ibc.sol';
import '../interfaces/IbcReceiver.sol';
import '../interfaces/IbcDispatcher.sol';
import '../interfaces/IbcMiddleware.sol';

contract GeneralMiddleware is IbcMwUser, IbcMiddleware, IbcMwEventsEmitter {
/**
Expand Down
6 changes: 3 additions & 3 deletions contracts/Dispatcher.sol → contracts/core/Dispatcher.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ pragma solidity ^0.8.9;

import '@openzeppelin/contracts/utils/Strings.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import './IbcDispatcher.sol';
import {IbcChannelReceiver, IbcPacketReceiver} from './IbcReceiver.sol';
import './ConsensusStateManager.sol';
import '../interfaces/IbcDispatcher.sol';
import {IbcChannelReceiver, IbcPacketReceiver} from '../interfaces/IbcReceiver.sol';
import '../interfaces/ConsensusStateManager.sol';

/**
* @title Dispatcher
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

import './Ibc.sol';
import './ConsensusStateManager.sol';
import '../libs/Ibc.sol';
import '../interfaces/ConsensusStateManager.sol';

import {L1Block} from 'optimism/L2/L1Block.sol';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {SecureMerkleTrie} from 'optimism/libraries/trie/SecureMerkleTrie.sol';
import {RLPReader} from 'optimism/libraries/rlp/RLPReader.sol';
import {RLPWriter} from 'optimism/libraries/rlp/RLPWriter.sol';

import './ProofVerifier.sol';
import '../interfaces/ProofVerifier.sol';

contract OpProofVerifier is ProofVerifier {
using RLPReader for RLPReader.RLPItem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
pragma solidity ^0.8.9;

import '@openzeppelin/contracts/access/Ownable.sol';
import './IbcDispatcher.sol';
import './IbcMiddleware.sol';
import {IbcReceiver} from './IbcReceiver.sol';
import './Ibc.sol';
import '../interfaces/IbcDispatcher.sol';
import '../interfaces/IbcMiddleware.sol';
import {IbcReceiver} from '../interfaces/IbcReceiver.sol';
import '../libs/Ibc.sol';

contract UniversalChannelHandler is IbcReceiverBase, IbcUniversalChannelMW {
constructor(IbcDispatcher _dispatcher) IbcReceiverBase(_dispatcher) {}
Expand Down
8 changes: 4 additions & 4 deletions contracts/Earth.sol → contracts/examples/Earth.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

pragma solidity ^0.8.9;

import './Ibc.sol';
import './IbcReceiver.sol';
import './IbcDispatcher.sol';
import './IbcMiddleware.sol';
import '../libs/Ibc.sol';
import '../interfaces/IbcReceiver.sol';
import '../interfaces/IbcDispatcher.sol';
import '../interfaces/IbcMiddleware.sol';

contract Earth is IbcMwUser, IbcUniversalPacketReceiver {
struct UcPacketWithChannel {
Expand Down
6 changes: 3 additions & 3 deletions contracts/Mars.sol → contracts/examples/Mars.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

pragma solidity ^0.8.9;

import './Ibc.sol';
import './IbcReceiver.sol';
import './IbcDispatcher.sol';
import '../libs/Ibc.sol';
import '../interfaces/IbcReceiver.sol';
import '../interfaces/IbcDispatcher.sol';

contract Mars is IbcReceiverBase, IbcReceiver {
// received packet as chain B
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

import './Ibc.sol';
import '../libs/Ibc.sol';
import './ProofVerifier.sol';

interface ConsensusStateManager {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

pragma solidity ^0.8.9;

import './Ibc.sol';
import '../libs/Ibc.sol';
import './IbcReceiver.sol';
import './ProofVerifier.sol';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

pragma solidity ^0.8.9;

import './Ibc.sol';
import '../libs/Ibc.sol';
import './IbcDispatcher.sol';
import './IbcReceiver.sol';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity ^0.8.9;

import '@openzeppelin/contracts/access/Ownable.sol';
import './IbcDispatcher.sol';
import './Ibc.sol';
import '../libs/Ibc.sol';

/**
* @title IbcChannelReceiver
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

import './ConsensusStateManager.sol';
import '../interfaces/ConsensusStateManager.sol';

/**
* @title DummyConsensusStateManager
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

import './ProofVerifier.sol';
import '../interfaces/ProofVerifier.sol';

contract DummyProofVerifier is ProofVerifier {
function verifyStateUpdate(L1Header calldata, OpL2StateProof calldata, bytes32, bytes32, uint64) external pure {}
Expand Down
File renamed without changes.
16 changes: 8 additions & 8 deletions test/Dispatcher.base.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ pragma solidity ^0.8.13;

import 'forge-std/Test.sol';
import './Proof.base.t.sol';
import '../contracts/Ibc.sol';
import {Dispatcher} from '../contracts/Dispatcher.sol';
import {IbcEventsEmitter} from '../contracts/IbcDispatcher.sol';
import {IbcChannelReceiver} from '../contracts/IbcReceiver.sol';
import '../contracts/Mars.sol';
import '../contracts/OpConsensusStateManager.sol';
import '../contracts/DummyConsensusStateManager.sol';
import '../contracts/OpProofVerifier.sol';
import '../contracts/libs/Ibc.sol';
import {Dispatcher} from '../contracts/core/Dispatcher.sol';
import {IbcEventsEmitter} from '../contracts/interfaces/IbcDispatcher.sol';
import {IbcChannelReceiver} from '../contracts/interfaces/IbcReceiver.sol';
import '../contracts/examples/Mars.sol';
import '../contracts/core/OpConsensusStateManager.sol';
import '../contracts/utils/DummyConsensusStateManager.sol';
import '../contracts/core/OpProofVerifier.sol';

struct LocalEnd {
IbcChannelReceiver receiver;
Expand Down
12 changes: 6 additions & 6 deletions test/Dispatcher.client.t.sol
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

import '../contracts/Ibc.sol';
import {Dispatcher} from '../contracts/Dispatcher.sol';
import {IbcEventsEmitter} from '../contracts/IbcDispatcher.sol';
import {IbcReceiver} from '../contracts/IbcReceiver.sol';
import '../contracts/Mars.sol';
import '../contracts/OpConsensusStateManager.sol';
import '../contracts/libs/Ibc.sol';
import {Dispatcher} from '../contracts/core/Dispatcher.sol';
import {IbcEventsEmitter} from '../contracts/interfaces/IbcDispatcher.sol';
import {IbcReceiver} from '../contracts/interfaces/IbcReceiver.sol';
import '../contracts/examples/Mars.sol';
import '../contracts/core/OpConsensusStateManager.sol';
import './Dispatcher.base.t.sol';

contract ClientTestBase is Base {
Expand Down
8 changes: 4 additions & 4 deletions test/Dispatcher.proof.t.sol
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.15;

import '../contracts/Ibc.sol';
import {Dispatcher} from '../contracts/Dispatcher.sol';
import '../contracts/Mars.sol';
import '../contracts/OpConsensusStateManager.sol';
import '../contracts/libs/Ibc.sol';
import {Dispatcher} from '../contracts/core/Dispatcher.sol';
import '../contracts/examples/Mars.sol';
import '../contracts/core/OpConsensusStateManager.sol';
import './Proof.base.t.sol';
import {stdStorage, StdStorage} from 'forge-std/Test.sol';

Expand Down
12 changes: 6 additions & 6 deletions test/Dispatcher.t.sol
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

import '../contracts/Ibc.sol';
import {Dispatcher} from '../contracts/Dispatcher.sol';
import {IbcEventsEmitter} from '../contracts/IbcDispatcher.sol';
import {IbcReceiver} from '../contracts/IbcReceiver.sol';
import '../contracts/Mars.sol';
import '../contracts/OpConsensusStateManager.sol';
import '../contracts/libs/Ibc.sol';
import {Dispatcher} from '../contracts/core/Dispatcher.sol';
import {IbcEventsEmitter} from '../contracts/interfaces/IbcDispatcher.sol';
import {IbcReceiver} from '../contracts/interfaces/IbcReceiver.sol';
import '../contracts/examples/Mars.sol';
import '../contracts/core/OpConsensusStateManager.sol';
import './Dispatcher.base.t.sol';

contract ChannelHandshakeTest is Base {
Expand Down
2 changes: 1 addition & 1 deletion test/Ibc.t.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

import '../contracts/Ibc.sol';
import '../contracts/libs/Ibc.sol';
import 'forge-std/Test.sol';

contract IbcTest is Ibc, Test {
Expand Down
4 changes: 2 additions & 2 deletions test/OpConsensusStateManager.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
pragma solidity ^0.8.0;

import 'forge-std/Test.sol';
import '../contracts/OpConsensusStateManager.sol';
import '../contracts/DummyProofVerifier.sol';
import '../contracts/core/OpConsensusStateManager.sol';
import '../contracts/utils/DummyProofVerifier.sol';
import './Proof.base.t.sol';

contract OptimisticConsensusStateManagerTest is ProofBase {
Expand Down
4 changes: 2 additions & 2 deletions test/Proof.base.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
pragma solidity ^0.8.0;

import 'forge-std/Test.sol';
import '../contracts/Ibc.sol';
import '../contracts/OpProofVerifier.sol';
import '../contracts/libs/Ibc.sol';
import '../contracts/core/OpProofVerifier.sol';
import {L1Block} from 'optimism/L2/L1Block.sol';

contract ProofBase is Test, Ibc {
Expand Down
4 changes: 2 additions & 2 deletions test/Verifier.t.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

import '../contracts/OpProofVerifier.sol';
import '../contracts/Ibc.sol';
import '../contracts/core/OpProofVerifier.sol';
import '../contracts/libs/Ibc.sol';
import 'forge-std/Test.sol';
import './Proof.base.t.sol';

Expand Down
18 changes: 9 additions & 9 deletions test/VirtualChain.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ pragma solidity ^0.8.13;

import 'forge-std/Test.sol';
import '@openzeppelin/contracts/utils/Strings.sol';
import '../contracts/Ibc.sol';
import '../contracts/Dispatcher.sol';
import '../contracts/ProofVerifier.sol';
import {UniversalChannelHandler} from '../contracts/UniversalChannelHandler.sol';
import {Mars} from '../contracts/Mars.sol';
import {Earth} from '../contracts/Earth.sol';
import {IbcMiddleware} from '../contracts/IbcMiddleware.sol';
import {GeneralMiddleware} from '../contracts/GeneralMiddleware.sol';
import '../contracts/DummyConsensusStateManager.sol';
import '../contracts/libs/Ibc.sol';
import '../contracts/core/Dispatcher.sol';
import '../contracts/interfaces/ProofVerifier.sol';
import {UniversalChannelHandler} from '../contracts/core/UniversalChannelHandler.sol';
import {Mars} from '../contracts/examples/Mars.sol';
import {Earth} from '../contracts/examples/Earth.sol';
import {IbcMiddleware} from '../contracts/interfaces/IbcMiddleware.sol';
import {GeneralMiddleware} from '../contracts/base/GeneralMiddleware.sol';
import '../contracts/utils/DummyConsensusStateManager.sol';

struct ChannelSetting {
ChannelOrder ordering;
Expand Down
2 changes: 1 addition & 1 deletion test/payload/ack.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity ^0.8.13;

import 'forge-std/Test.sol';

import '../../contracts/Ibc.sol';
import '../../contracts/libs/Ibc.sol';

contract AckContract {
// getAckPacketBytes returns the bytes representation of the AckPacket
Expand Down
14 changes: 7 additions & 7 deletions test/universal.channel.t.sol
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

import '../contracts/Ibc.sol';
import {Dispatcher} from '../contracts/Dispatcher.sol';
import {IbcEventsEmitter} from '../contracts/IbcDispatcher.sol';
import {IbcReceiver} from '../contracts/IbcReceiver.sol';
import '../contracts/UniversalChannelHandler.sol';
import '../contracts/Mars.sol';
import '../contracts/OpConsensusStateManager.sol';
import '../contracts/libs/Ibc.sol';
import {Dispatcher} from '../contracts/core/Dispatcher.sol';
import {IbcEventsEmitter} from '../contracts/interfaces/IbcDispatcher.sol';
import {IbcReceiver} from '../contracts/interfaces/IbcReceiver.sol';
import '../contracts/core/UniversalChannelHandler.sol';
import '../contracts/examples/Mars.sol';
import '../contracts/core/OpConsensusStateManager.sol';
import './Dispatcher.base.t.sol';
import './VirtualChain.sol';

Expand Down
Loading