diff --git a/contracts/contracts/tools/ProxyAdminReplica.sol b/contracts/contracts/tools/ProxyAdminReplica.sol deleted file mode 100644 index a88c32897..000000000 --- a/contracts/contracts/tools/ProxyAdminReplica.sol +++ /dev/null @@ -1,12 +0,0 @@ -// SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v4.8.3) (proxy/transparent/ProxyAdmin.sol) - -pragma solidity ^0.8.0; - -/** - * @dev This is only for operational scripts. Do not use for anything else. - @dev This generates an artefact and contract types in order to use when transferring ownership. - */ -contract ProxyAdminReplica { - function transferOwnership(address newOwner) public {} -} diff --git a/contracts/docs/api/tokenBridge/BridgedToken.mdx b/contracts/docs/api/bridging/token/BridgedToken.mdx similarity index 100% rename from contracts/docs/api/tokenBridge/BridgedToken.mdx rename to contracts/docs/api/bridging/token/BridgedToken.mdx diff --git a/contracts/docs/api/tokenBridge/CustomBridgedToken.mdx b/contracts/docs/api/bridging/token/CustomBridgedToken.mdx similarity index 100% rename from contracts/docs/api/tokenBridge/CustomBridgedToken.mdx rename to contracts/docs/api/bridging/token/CustomBridgedToken.mdx diff --git a/contracts/docs/api/tokenBridge/TokenBridge.mdx b/contracts/docs/api/bridging/token/TokenBridge.mdx similarity index 100% rename from contracts/docs/api/tokenBridge/TokenBridge.mdx rename to contracts/docs/api/bridging/token/TokenBridge.mdx diff --git a/contracts/docs/api/tokenBridge/interfaces/ITokenBridge.mdx b/contracts/docs/api/bridging/token/interfaces/ITokenBridge.mdx similarity index 100% rename from contracts/docs/api/tokenBridge/interfaces/ITokenBridge.mdx rename to contracts/docs/api/bridging/token/interfaces/ITokenBridge.mdx diff --git a/contracts/docs/api/tokenBridge/lib/StorageFiller39.mdx b/contracts/docs/api/bridging/token/utils/StorageFiller39.mdx similarity index 100% rename from contracts/docs/api/tokenBridge/lib/StorageFiller39.mdx rename to contracts/docs/api/bridging/token/utils/StorageFiller39.mdx diff --git a/contracts/docs/api/messageService/lib/TimeLock.mdx b/contracts/docs/api/governance/TimeLock.mdx similarity index 100% rename from contracts/docs/api/messageService/lib/TimeLock.mdx rename to contracts/docs/api/governance/TimeLock.mdx diff --git a/contracts/docs/api/interfaces/l1/IPlonkVerifier.mdx b/contracts/docs/api/interfaces/l1/IPlonkVerifier.mdx deleted file mode 100644 index ecf004e5a..000000000 --- a/contracts/docs/api/interfaces/l1/IPlonkVerifier.mdx +++ /dev/null @@ -1,23 +0,0 @@ -# `IPlonkVerifier` - -### Verify - -```solidity -function Verify(bytes _proof, uint256[] _public_inputs) external returns (bool success) -``` - -Interface for verifier contracts. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _proof | bytes | The proof used to verify. | -| _public_inputs | uint256[] | The computed public inputs for the proof verification. | - -#### Return Values - -| Name | Type | Description | -| ---- | ---- | ----------- | -| success | bool | Returns true if successfully verified. | - diff --git a/contracts/docs/api/lib/CallForwardingProxy.mdx b/contracts/docs/api/lib/CallForwardingProxy.mdx deleted file mode 100644 index 0464089fd..000000000 --- a/contracts/docs/api/lib/CallForwardingProxy.mdx +++ /dev/null @@ -1,24 +0,0 @@ -# `CallForwardingProxy` - -### target - -```solidity -address target -``` - -The underlying target address that is called. - -### constructor - -```solidity -constructor(address _target) public -``` - -### fallback - -```solidity -fallback() external payable -``` - -Defaults to, and forwards all calls to the target address. - diff --git a/contracts/docs/api/lib/Mimc.mdx b/contracts/docs/api/libraries/Mimc.mdx similarity index 100% rename from contracts/docs/api/lib/Mimc.mdx rename to contracts/docs/api/libraries/Mimc.mdx diff --git a/contracts/docs/api/lib/SparseMerkleProof.mdx b/contracts/docs/api/libraries/SparseMerkleProof.mdx similarity index 100% rename from contracts/docs/api/lib/SparseMerkleProof.mdx rename to contracts/docs/api/libraries/SparseMerkleProof.mdx diff --git a/contracts/docs/api/messageService/lib/TransientStorageHelpers.mdx b/contracts/docs/api/libraries/TransientStorageHelpers.mdx similarity index 100% rename from contracts/docs/api/messageService/lib/TransientStorageHelpers.mdx rename to contracts/docs/api/libraries/TransientStorageHelpers.mdx diff --git a/contracts/docs/api/lib/Utils.mdx b/contracts/docs/api/libraries/Utils.mdx similarity index 100% rename from contracts/docs/api/lib/Utils.mdx rename to contracts/docs/api/libraries/Utils.mdx diff --git a/contracts/docs/api/messageService/MessageServiceBase.mdx b/contracts/docs/api/messaging/MessageServiceBase.mdx similarity index 100% rename from contracts/docs/api/messageService/MessageServiceBase.mdx rename to contracts/docs/api/messaging/MessageServiceBase.mdx diff --git a/contracts/docs/api/interfaces/IMessageService.mdx b/contracts/docs/api/messaging/interfaces/IMessageService.mdx similarity index 100% rename from contracts/docs/api/interfaces/IMessageService.mdx rename to contracts/docs/api/messaging/interfaces/IMessageService.mdx diff --git a/contracts/docs/api/messageService/l1/L1MessageManager.mdx b/contracts/docs/api/messaging/l1/L1MessageManager.mdx similarity index 100% rename from contracts/docs/api/messageService/l1/L1MessageManager.mdx rename to contracts/docs/api/messaging/l1/L1MessageManager.mdx diff --git a/contracts/docs/api/messageService/l1/L1MessageService.mdx b/contracts/docs/api/messaging/l1/L1MessageService.mdx similarity index 100% rename from contracts/docs/api/messageService/l1/L1MessageService.mdx rename to contracts/docs/api/messaging/l1/L1MessageService.mdx diff --git a/contracts/docs/api/interfaces/l1/IL1MessageManager.mdx b/contracts/docs/api/messaging/l1/interfaces/IL1MessageManager.mdx similarity index 100% rename from contracts/docs/api/interfaces/l1/IL1MessageManager.mdx rename to contracts/docs/api/messaging/l1/interfaces/IL1MessageManager.mdx diff --git a/contracts/docs/api/interfaces/l1/IL1MessageService.mdx b/contracts/docs/api/messaging/l1/interfaces/IL1MessageService.mdx similarity index 100% rename from contracts/docs/api/interfaces/l1/IL1MessageService.mdx rename to contracts/docs/api/messaging/l1/interfaces/IL1MessageService.mdx diff --git a/contracts/docs/api/messageService/l1/v1/L1MessageManagerV1.mdx b/contracts/docs/api/messaging/l1/v1/L1MessageManagerV1.mdx similarity index 100% rename from contracts/docs/api/messageService/l1/v1/L1MessageManagerV1.mdx rename to contracts/docs/api/messaging/l1/v1/L1MessageManagerV1.mdx diff --git a/contracts/docs/api/messageService/l1/v1/L1MessageServiceV1.mdx b/contracts/docs/api/messaging/l1/v1/L1MessageServiceV1.mdx similarity index 100% rename from contracts/docs/api/messageService/l1/v1/L1MessageServiceV1.mdx rename to contracts/docs/api/messaging/l1/v1/L1MessageServiceV1.mdx diff --git a/contracts/docs/api/interfaces/l1/IL1MessageManagerV1.mdx b/contracts/docs/api/messaging/l1/v1/interfaces/IL1MessageManagerV1.mdx similarity index 100% rename from contracts/docs/api/interfaces/l1/IL1MessageManagerV1.mdx rename to contracts/docs/api/messaging/l1/v1/interfaces/IL1MessageManagerV1.mdx diff --git a/contracts/docs/api/messageService/l2/L2MessageManager.mdx b/contracts/docs/api/messaging/l2/L2MessageManager.mdx similarity index 100% rename from contracts/docs/api/messageService/l2/L2MessageManager.mdx rename to contracts/docs/api/messaging/l2/L2MessageManager.mdx diff --git a/contracts/docs/api/messageService/l2/L2MessageService.mdx b/contracts/docs/api/messaging/l2/L2MessageService.mdx similarity index 100% rename from contracts/docs/api/messageService/l2/L2MessageService.mdx rename to contracts/docs/api/messaging/l2/L2MessageService.mdx diff --git a/contracts/docs/api/interfaces/l2/IL2MessageManager.mdx b/contracts/docs/api/messaging/l2/interfaces/IL2MessageManager.mdx similarity index 100% rename from contracts/docs/api/interfaces/l2/IL2MessageManager.mdx rename to contracts/docs/api/messaging/l2/interfaces/IL2MessageManager.mdx diff --git a/contracts/docs/api/messageService/l2/v1/L2MessageManagerV1.mdx b/contracts/docs/api/messaging/l2/v1/L2MessageManagerV1.mdx similarity index 100% rename from contracts/docs/api/messageService/l2/v1/L2MessageManagerV1.mdx rename to contracts/docs/api/messaging/l2/v1/L2MessageManagerV1.mdx diff --git a/contracts/docs/api/messageService/l2/v1/L2MessageServiceV1.mdx b/contracts/docs/api/messaging/l2/v1/L2MessageServiceV1.mdx similarity index 100% rename from contracts/docs/api/messageService/l2/v1/L2MessageServiceV1.mdx rename to contracts/docs/api/messaging/l2/v1/L2MessageServiceV1.mdx diff --git a/contracts/docs/api/interfaces/l2/IL2MessageManagerV1.mdx b/contracts/docs/api/messaging/l2/v1/interfaces/IL2MessageManagerV1.mdx similarity index 100% rename from contracts/docs/api/interfaces/l2/IL2MessageManagerV1.mdx rename to contracts/docs/api/messaging/l2/v1/interfaces/IL2MessageManagerV1.mdx diff --git a/contracts/docs/api/interfaces/l2/IL2MessageServiceV1.mdx b/contracts/docs/api/messaging/l2/v1/interfaces/IL2MessageServiceV1.mdx similarity index 100% rename from contracts/docs/api/interfaces/l2/IL2MessageServiceV1.mdx rename to contracts/docs/api/messaging/l2/v1/interfaces/IL2MessageServiceV1.mdx diff --git a/contracts/docs/api/messageService/lib/MessageHashing.mdx b/contracts/docs/api/messaging/libraries/MessageHashing.mdx similarity index 100% rename from contracts/docs/api/messageService/lib/MessageHashing.mdx rename to contracts/docs/api/messaging/libraries/MessageHashing.mdx diff --git a/contracts/docs/api/messageService/lib/SparseMerkleTreeVerifier.mdx b/contracts/docs/api/messaging/libraries/SparseMerkleTreeVerifier.mdx similarity index 100% rename from contracts/docs/api/messageService/lib/SparseMerkleTreeVerifier.mdx rename to contracts/docs/api/messaging/libraries/SparseMerkleTreeVerifier.mdx diff --git a/contracts/docs/api/LineaRollup.mdx b/contracts/docs/api/rollup/LineaRollup.mdx similarity index 100% rename from contracts/docs/api/LineaRollup.mdx rename to contracts/docs/api/rollup/LineaRollup.mdx diff --git a/contracts/docs/api/ZkEvmV2.mdx b/contracts/docs/api/rollup/ZkEvmV2.mdx similarity index 100% rename from contracts/docs/api/ZkEvmV2.mdx rename to contracts/docs/api/rollup/ZkEvmV2.mdx diff --git a/contracts/docs/api/interfaces/l1/ILineaRollup.mdx b/contracts/docs/api/rollup/interfaces/ILineaRollup.mdx similarity index 100% rename from contracts/docs/api/interfaces/l1/ILineaRollup.mdx rename to contracts/docs/api/rollup/interfaces/ILineaRollup.mdx diff --git a/contracts/docs/api/interfaces/l1/IZkEvmV2.mdx b/contracts/docs/api/rollup/interfaces/IZkEvmV2.mdx similarity index 100% rename from contracts/docs/api/interfaces/l1/IZkEvmV2.mdx rename to contracts/docs/api/rollup/interfaces/IZkEvmV2.mdx diff --git a/contracts/docs/api/lib/PermissionsManager.mdx b/contracts/docs/api/security/access/PermissionsManager.mdx similarity index 100% rename from contracts/docs/api/lib/PermissionsManager.mdx rename to contracts/docs/api/security/access/PermissionsManager.mdx diff --git a/contracts/docs/api/interfaces/IPermissionsManager.mdx b/contracts/docs/api/security/access/interfaces/IPermissionsManager.mdx similarity index 100% rename from contracts/docs/api/interfaces/IPermissionsManager.mdx rename to contracts/docs/api/security/access/interfaces/IPermissionsManager.mdx diff --git a/contracts/docs/api/messageService/lib/RateLimiter.mdx b/contracts/docs/api/security/limiting/RateLimiter.mdx similarity index 100% rename from contracts/docs/api/messageService/lib/RateLimiter.mdx rename to contracts/docs/api/security/limiting/RateLimiter.mdx diff --git a/contracts/docs/api/interfaces/IRateLimiter.mdx b/contracts/docs/api/security/limiting/interfaces/IRateLimiter.mdx similarity index 100% rename from contracts/docs/api/interfaces/IRateLimiter.mdx rename to contracts/docs/api/security/limiting/interfaces/IRateLimiter.mdx diff --git a/contracts/docs/api/lib/L2MessageServicePauseManager.mdx b/contracts/docs/api/security/pausing/L2MessageServicePauseManager.mdx similarity index 100% rename from contracts/docs/api/lib/L2MessageServicePauseManager.mdx rename to contracts/docs/api/security/pausing/L2MessageServicePauseManager.mdx diff --git a/contracts/docs/api/lib/LineaRollupPauseManager.mdx b/contracts/docs/api/security/pausing/LineaRollupPauseManager.mdx similarity index 100% rename from contracts/docs/api/lib/LineaRollupPauseManager.mdx rename to contracts/docs/api/security/pausing/LineaRollupPauseManager.mdx diff --git a/contracts/docs/api/lib/PauseManager.mdx b/contracts/docs/api/security/pausing/PauseManager.mdx similarity index 100% rename from contracts/docs/api/lib/PauseManager.mdx rename to contracts/docs/api/security/pausing/PauseManager.mdx diff --git a/contracts/docs/api/lib/TokenBridgePauseManager.mdx b/contracts/docs/api/security/pausing/TokenBridgePauseManager.mdx similarity index 100% rename from contracts/docs/api/lib/TokenBridgePauseManager.mdx rename to contracts/docs/api/security/pausing/TokenBridgePauseManager.mdx diff --git a/contracts/docs/api/interfaces/IPauseManager.mdx b/contracts/docs/api/security/pausing/interfaces/IPauseManager.mdx similarity index 100% rename from contracts/docs/api/interfaces/IPauseManager.mdx rename to contracts/docs/api/security/pausing/interfaces/IPauseManager.mdx diff --git a/contracts/docs/api/messageService/l1/TransientStorageReentrancyGuardUpgradeable.mdx b/contracts/docs/api/security/reentrancy/TransientStorageReentrancyGuardUpgradeable.mdx similarity index 100% rename from contracts/docs/api/messageService/l1/TransientStorageReentrancyGuardUpgradeable.mdx rename to contracts/docs/api/security/reentrancy/TransientStorageReentrancyGuardUpgradeable.mdx diff --git a/contracts/foundry.toml b/contracts/foundry.toml index 92a329340..c7a025b9f 100644 --- a/contracts/foundry.toml +++ b/contracts/foundry.toml @@ -1,5 +1,5 @@ [profile.default] -src = 'contracts' +src = 'src' out = 'out' libs = ['node_modules', 'lib'] cache_path = 'cache_forge' diff --git a/contracts/hardhat.config.ts b/contracts/hardhat.config.ts index c4e005952..4910756c0 100644 --- a/contracts/hardhat.config.ts +++ b/contracts/hardhat.config.ts @@ -30,6 +30,7 @@ const useViaIR = process.env.ENABLE_VIA_IR === "true"; const config: HardhatUserConfig = { paths: { artifacts: "./build", + sources: "./src", }, solidity: { // NB: double check the autoupdate shell script version complies to the latest solidity version if you add a new one. @@ -154,7 +155,7 @@ const config: HardhatUserConfig = { ], }, docgen: { - exclude: ["token", "test-contracts", "proxies", "tools", "interfaces/tools", "tokenBridge/mocks", "verifiers"], + exclude: ["tokens", "_testing", "proxies", "recovery", "verifiers"], pages: "files", outputDir: "docs/api/", // For compatibility with docs.linea.build diff --git a/contracts/contracts/test-contracts/IntegrationTestTrueVerifier.sol b/contracts/src/_testing/integration/IntegrationTestTrueVerifier.sol similarity index 78% rename from contracts/contracts/test-contracts/IntegrationTestTrueVerifier.sol rename to contracts/src/_testing/integration/IntegrationTestTrueVerifier.sol index 597c55e55..f48795aa3 100644 --- a/contracts/contracts/test-contracts/IntegrationTestTrueVerifier.sol +++ b/contracts/src/_testing/integration/IntegrationTestTrueVerifier.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.8.26; -import { IPlonkVerifier } from "../interfaces/l1/IPlonkVerifier.sol"; +import { IPlonkVerifier } from "../../verifiers/interfaces/IPlonkVerifier.sol"; contract IntegrationTestTrueVerifier is IPlonkVerifier { /// @dev Always returns true for quick turnaround testing. diff --git a/contracts/contracts/test-contracts/L2MessageServiceLineaMainnet.sol b/contracts/src/_testing/integration/L2MessageServiceLineaMainnet.sol similarity index 100% rename from contracts/contracts/test-contracts/L2MessageServiceLineaMainnet.sol rename to contracts/src/_testing/integration/L2MessageServiceLineaMainnet.sol diff --git a/contracts/contracts/test-contracts/LineaRollupV5.sol b/contracts/src/_testing/integration/LineaRollupV5.sol similarity index 100% rename from contracts/contracts/test-contracts/LineaRollupV5.sol rename to contracts/src/_testing/integration/LineaRollupV5.sol diff --git a/contracts/contracts/proxies/ProxyAdmin.sol b/contracts/src/_testing/integration/ProxyAdmin.sol similarity index 100% rename from contracts/contracts/proxies/ProxyAdmin.sol rename to contracts/src/_testing/integration/ProxyAdmin.sol diff --git a/contracts/contracts/tokenBridge/mocks/TokenBridgeFlatten.sol b/contracts/src/_testing/integration/TokenBridgeFlatten.sol similarity index 100% rename from contracts/contracts/tokenBridge/mocks/TokenBridgeFlatten.sol rename to contracts/src/_testing/integration/TokenBridgeFlatten.sol diff --git a/contracts/contracts/proxies/TransparentUpgradeableProxy.sol b/contracts/src/_testing/integration/TransparentUpgradeableProxy.sol similarity index 100% rename from contracts/contracts/proxies/TransparentUpgradeableProxy.sol rename to contracts/src/_testing/integration/TransparentUpgradeableProxy.sol diff --git a/contracts/contracts/test-contracts/RevertingVerifier.sol b/contracts/src/_testing/mocks/base/RevertingVerifier.sol similarity index 89% rename from contracts/contracts/test-contracts/RevertingVerifier.sol rename to contracts/src/_testing/mocks/base/RevertingVerifier.sol index 8fdac40d9..2347f007e 100644 --- a/contracts/contracts/test-contracts/RevertingVerifier.sol +++ b/contracts/src/_testing/mocks/base/RevertingVerifier.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.8.26; -import { IPlonkVerifier } from "../interfaces/l1/IPlonkVerifier.sol"; +import { IPlonkVerifier } from "../../../verifiers/interfaces/IPlonkVerifier.sol"; /// @dev Test verifier contract that returns true. contract RevertingVerifier is IPlonkVerifier { diff --git a/contracts/contracts/test-contracts/TestClaimingCaller.sol b/contracts/src/_testing/mocks/base/TestClaimingCaller.sol similarity index 81% rename from contracts/contracts/test-contracts/TestClaimingCaller.sol rename to contracts/src/_testing/mocks/base/TestClaimingCaller.sol index db67b8374..96171370c 100644 --- a/contracts/contracts/test-contracts/TestClaimingCaller.sol +++ b/contracts/src/_testing/mocks/base/TestClaimingCaller.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.8.26; -import { IMessageService } from "../interfaces/IMessageService.sol"; +import { IMessageService } from "../../../messaging/interfaces/IMessageService.sol"; contract TestClaimingCaller { address private expectedAddress; diff --git a/contracts/contracts/test-contracts/TestL1RevertContract.sol b/contracts/src/_testing/mocks/base/TestL1RevertContract.sol similarity index 100% rename from contracts/contracts/test-contracts/TestL1RevertContract.sol rename to contracts/src/_testing/mocks/base/TestL1RevertContract.sol diff --git a/contracts/contracts/test-contracts/TestReceivingContract.sol b/contracts/src/_testing/mocks/base/TestReceivingContract.sol similarity index 100% rename from contracts/contracts/test-contracts/TestReceivingContract.sol rename to contracts/src/_testing/mocks/base/TestReceivingContract.sol diff --git a/contracts/contracts/tokenBridge/mocks/MockMessageService.sol b/contracts/src/_testing/mocks/bridging/MockMessageService.sol similarity index 93% rename from contracts/contracts/tokenBridge/mocks/MockMessageService.sol rename to contracts/src/_testing/mocks/bridging/MockMessageService.sol index 1b0eeb926..b933e4315 100644 --- a/contracts/contracts/tokenBridge/mocks/MockMessageService.sol +++ b/contracts/src/_testing/mocks/bridging/MockMessageService.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.8.19; -import { IMessageService } from "../../interfaces/IMessageService.sol"; +import { IMessageService } from "../../../messaging/interfaces/IMessageService.sol"; contract MockMessageService is IMessageService { uint256 public constant CALL_GAS_LIMIT = 1000000; diff --git a/contracts/contracts/tokenBridge/mocks/MessageBridgeV2/MockMessageServiceV2.sol b/contracts/src/_testing/mocks/bridging/MockMessageServiceV2.sol similarity index 88% rename from contracts/contracts/tokenBridge/mocks/MessageBridgeV2/MockMessageServiceV2.sol rename to contracts/src/_testing/mocks/bridging/MockMessageServiceV2.sol index 420f78e59..07596e0c4 100644 --- a/contracts/contracts/tokenBridge/mocks/MessageBridgeV2/MockMessageServiceV2.sol +++ b/contracts/src/_testing/mocks/bridging/MockMessageServiceV2.sol @@ -1,10 +1,10 @@ // SPDX-License-Identifier: Apache-2.0 pragma solidity >=0.8.19 <=0.8.26; -import { IMessageService } from "../../../interfaces/IMessageService.sol"; +import { IMessageService } from "../../../messaging/interfaces/IMessageService.sol"; import { IGenericErrors } from "../../../interfaces/IGenericErrors.sol"; -import { LineaRollupPauseManager } from "../../../lib/LineaRollupPauseManager.sol"; -import { L1MessageManager } from "../../../messageService/l1/L1MessageManager.sol"; +import { LineaRollupPauseManager } from "../../../security/pausing/LineaRollupPauseManager.sol"; +import { L1MessageManager } from "../../../messaging/l1/L1MessageManager.sol"; contract MockMessageServiceV2 is L1MessageManager, IMessageService, LineaRollupPauseManager, IGenericErrors { address internal messageSender = address(0); diff --git a/contracts/contracts/tokenBridge/mocks/MockTokenBridge.sol b/contracts/src/_testing/mocks/bridging/MockTokenBridge.sol similarity index 76% rename from contracts/contracts/tokenBridge/mocks/MockTokenBridge.sol rename to contracts/src/_testing/mocks/bridging/MockTokenBridge.sol index a2ff67338..5e60f5960 100644 --- a/contracts/contracts/tokenBridge/mocks/MockTokenBridge.sol +++ b/contracts/src/_testing/mocks/bridging/MockTokenBridge.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.8.19; -import { TokenBridge } from "../TokenBridge.sol"; +import { TokenBridge } from "../../../bridging/token/TokenBridge.sol"; contract MockTokenBridge is TokenBridge { function setNativeMappingValue(address token, address value) external { diff --git a/contracts/contracts/tokenBridge/mocks/TestTokenBridge.sol b/contracts/src/_testing/mocks/bridging/TestTokenBridge.sol similarity index 77% rename from contracts/contracts/tokenBridge/mocks/TestTokenBridge.sol rename to contracts/src/_testing/mocks/bridging/TestTokenBridge.sol index fdf8e926b..75796e338 100644 --- a/contracts/contracts/tokenBridge/mocks/TestTokenBridge.sol +++ b/contracts/src/_testing/mocks/bridging/TestTokenBridge.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.8.19; -import { TokenBridge } from "../TokenBridge.sol"; +import { TokenBridge } from "../../../bridging/token/TokenBridge.sol"; contract TestTokenBridge is TokenBridge { function testReturnDataToString(bytes memory _data) public pure returns (string memory) { diff --git a/contracts/contracts/tokenBridge/mocks/UpgradedBridgedToken.sol b/contracts/src/_testing/mocks/bridging/UpgradedBridgedToken.sol similarity index 72% rename from contracts/contracts/tokenBridge/mocks/UpgradedBridgedToken.sol rename to contracts/src/_testing/mocks/bridging/UpgradedBridgedToken.sol index fcdca2bcf..723a744e5 100644 --- a/contracts/contracts/tokenBridge/mocks/UpgradedBridgedToken.sol +++ b/contracts/src/_testing/mocks/bridging/UpgradedBridgedToken.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.8.19; -import { BridgedToken } from "../BridgedToken.sol"; +import { BridgedToken } from "../../../bridging/token/BridgedToken.sol"; contract UpgradedBridgedToken is BridgedToken { function isUpgraded() external pure returns (bool) { diff --git a/contracts/contracts/tokenBridge/mocks/Reentrancy/MaliciousERC777.sol b/contracts/src/_testing/mocks/security/reentrancy/MaliciousERC777.sol similarity index 100% rename from contracts/contracts/tokenBridge/mocks/Reentrancy/MaliciousERC777.sol rename to contracts/src/_testing/mocks/security/reentrancy/MaliciousERC777.sol diff --git a/contracts/contracts/tokenBridge/mocks/Reentrancy/ReentrancyContract.sol b/contracts/src/_testing/mocks/security/reentrancy/ReentrancyContract.sol similarity index 92% rename from contracts/contracts/tokenBridge/mocks/Reentrancy/ReentrancyContract.sol rename to contracts/src/_testing/mocks/security/reentrancy/ReentrancyContract.sol index 9a071b18b..9868204cf 100644 --- a/contracts/contracts/tokenBridge/mocks/Reentrancy/ReentrancyContract.sol +++ b/contracts/src/_testing/mocks/security/reentrancy/ReentrancyContract.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; -import { TokenBridge } from "../../TokenBridge.sol"; +import { TokenBridge } from "../../../../bridging/token/TokenBridge.sol"; contract ReentrancyContract { // The Linea `TokenBridge` contract diff --git a/contracts/contracts/tokenBridge/mocks/ERC20MintBurn.sol b/contracts/src/_testing/mocks/tokens/ERC20MintBurn.sol similarity index 100% rename from contracts/contracts/tokenBridge/mocks/ERC20MintBurn.sol rename to contracts/src/_testing/mocks/tokens/ERC20MintBurn.sol diff --git a/contracts/contracts/tokenBridge/mocks/ERC20NoNameMintBurn.sol b/contracts/src/_testing/mocks/tokens/ERC20NoNameMintBurn.sol similarity index 100% rename from contracts/contracts/tokenBridge/mocks/ERC20NoNameMintBurn.sol rename to contracts/src/_testing/mocks/tokens/ERC20NoNameMintBurn.sol diff --git a/contracts/contracts/tokenBridge/mocks/ERC20UnknownDecimals.sol b/contracts/src/_testing/mocks/tokens/ERC20UnknownDecimals.sol similarity index 100% rename from contracts/contracts/tokenBridge/mocks/ERC20UnknownDecimals.sol rename to contracts/src/_testing/mocks/tokens/ERC20UnknownDecimals.sol diff --git a/contracts/contracts/tokenBridge/mocks/ERC20WeirdNameSymbol.sol b/contracts/src/_testing/mocks/tokens/ERC20WeirdNameSymbol.sol similarity index 100% rename from contracts/contracts/tokenBridge/mocks/ERC20WeirdNameSymbol.sol rename to contracts/src/_testing/mocks/tokens/ERC20WeirdNameSymbol.sol diff --git a/contracts/contracts/tokenBridge/mocks/ERCFees.sol b/contracts/src/_testing/mocks/tokens/ERCFees.sol similarity index 100% rename from contracts/contracts/tokenBridge/mocks/ERCFees.sol rename to contracts/src/_testing/mocks/tokens/ERCFees.sol diff --git a/contracts/contracts/tokenBridge/mocks/TestERC20.sol b/contracts/src/_testing/mocks/tokens/TestERC20.sol similarity index 100% rename from contracts/contracts/tokenBridge/mocks/TestERC20.sol rename to contracts/src/_testing/mocks/tokens/TestERC20.sol diff --git a/contracts/contracts/test-contracts/ErrorAndDestructionTesting.sol b/contracts/src/_testing/unit/ErrorAndDestructionTesting.sol similarity index 100% rename from contracts/contracts/test-contracts/ErrorAndDestructionTesting.sol rename to contracts/src/_testing/unit/ErrorAndDestructionTesting.sol diff --git a/contracts/contracts/test-contracts/LondonEvmCodes.yul b/contracts/src/_testing/unit/LondonEvmCodes.yul similarity index 100% rename from contracts/contracts/test-contracts/LondonEvmCodes.yul rename to contracts/src/_testing/unit/LondonEvmCodes.yul diff --git a/contracts/contracts/test-contracts/OpcodeTestContract.sol b/contracts/src/_testing/unit/OpcodeTestContract.sol similarity index 100% rename from contracts/contracts/test-contracts/OpcodeTestContract.sol rename to contracts/src/_testing/unit/OpcodeTestContract.sol diff --git a/contracts/contracts/test-contracts/OpcodeTester.sol b/contracts/src/_testing/unit/OpcodeTester.sol similarity index 100% rename from contracts/contracts/test-contracts/OpcodeTester.sol rename to contracts/src/_testing/unit/OpcodeTester.sol diff --git a/contracts/contracts/test-contracts/TestEIP4844.sol b/contracts/src/_testing/unit/TestEIP4844.sol similarity index 100% rename from contracts/contracts/test-contracts/TestEIP4844.sol rename to contracts/src/_testing/unit/TestEIP4844.sol diff --git a/contracts/contracts/test-contracts/TestExternalCalls.sol b/contracts/src/_testing/unit/TestExternalCalls.sol similarity index 100% rename from contracts/contracts/test-contracts/TestExternalCalls.sol rename to contracts/src/_testing/unit/TestExternalCalls.sol diff --git a/contracts/contracts/test-contracts/TestL1MessageManager.sol b/contracts/src/_testing/unit/TestL1MessageManager.sol similarity index 94% rename from contracts/contracts/test-contracts/TestL1MessageManager.sol rename to contracts/src/_testing/unit/TestL1MessageManager.sol index 5b0705f5e..869a5f10b 100644 --- a/contracts/contracts/test-contracts/TestL1MessageManager.sol +++ b/contracts/src/_testing/unit/TestL1MessageManager.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.8.26; -import { L1MessageManager } from "../messageService/l1/L1MessageManager.sol"; +import { L1MessageManager } from "../../messaging/l1/L1MessageManager.sol"; contract TestL1MessageManager is L1MessageManager { /** diff --git a/contracts/contracts/test-contracts/TestL1MessageService.sol b/contracts/src/_testing/unit/TestL1MessageService.sol similarity index 97% rename from contracts/contracts/test-contracts/TestL1MessageService.sol rename to contracts/src/_testing/unit/TestL1MessageService.sol index b4032bc4c..4c48dbf4b 100644 --- a/contracts/contracts/test-contracts/TestL1MessageService.sol +++ b/contracts/src/_testing/unit/TestL1MessageService.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.8.26; -import { L1MessageService } from "../messageService/l1/L1MessageService.sol"; +import { L1MessageService } from "../../messaging/l1/L1MessageService.sol"; import { TestSetPauseTypeRoles } from "./TestSetPauseTypeRoles.sol"; contract TestL1MessageService is L1MessageService, TestSetPauseTypeRoles { diff --git a/contracts/contracts/test-contracts/TestL1MessageServiceMerkleProof.sol b/contracts/src/_testing/unit/TestL1MessageServiceMerkleProof.sol similarity index 94% rename from contracts/contracts/test-contracts/TestL1MessageServiceMerkleProof.sol rename to contracts/src/_testing/unit/TestL1MessageServiceMerkleProof.sol index 456bd01d5..f5c59b181 100644 --- a/contracts/contracts/test-contracts/TestL1MessageServiceMerkleProof.sol +++ b/contracts/src/_testing/unit/TestL1MessageServiceMerkleProof.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.8.26; -import { L1MessageService } from "../messageService/l1/L1MessageService.sol"; -import { IL1MessageService } from "../interfaces/l1/IL1MessageService.sol"; +import { L1MessageService } from "../../messaging/l1/L1MessageService.sol"; +import { IL1MessageService } from "../../messaging/l1/interfaces/IL1MessageService.sol"; import { TestSetPauseTypeRoles } from "./TestSetPauseTypeRoles.sol"; interface ITestL1MessageService { diff --git a/contracts/contracts/test-contracts/TestL2MessageManager.sol b/contracts/src/_testing/unit/TestL2MessageManager.sol similarity index 90% rename from contracts/contracts/test-contracts/TestL2MessageManager.sol rename to contracts/src/_testing/unit/TestL2MessageManager.sol index 435f2c97e..9a19aad6b 100644 --- a/contracts/contracts/test-contracts/TestL2MessageManager.sol +++ b/contracts/src/_testing/unit/TestL2MessageManager.sol @@ -2,8 +2,8 @@ pragma solidity 0.8.19; import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; -import { L2MessageManager } from "../messageService/l2/L2MessageManager.sol"; -import { IGenericErrors } from "../interfaces/IGenericErrors.sol"; +import { L2MessageManager } from "../../messaging/l2/L2MessageManager.sol"; +import { IGenericErrors } from "../../interfaces/IGenericErrors.sol"; import { TestSetPauseTypeRoles } from "./TestSetPauseTypeRoles.sol"; contract TestL2MessageManager is Initializable, L2MessageManager, IGenericErrors, TestSetPauseTypeRoles { diff --git a/contracts/contracts/test-contracts/TestL2MessageService.sol b/contracts/src/_testing/unit/TestL2MessageService.sol similarity index 96% rename from contracts/contracts/test-contracts/TestL2MessageService.sol rename to contracts/src/_testing/unit/TestL2MessageService.sol index cf7e5b16f..8b1469533 100644 --- a/contracts/contracts/test-contracts/TestL2MessageService.sol +++ b/contracts/src/_testing/unit/TestL2MessageService.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.8.19; -import { L2MessageService } from "../messageService/l2/L2MessageService.sol"; +import { L2MessageService } from "../../messaging/l2/L2MessageService.sol"; contract TestL2MessageService is L2MessageService { address public originalSender; diff --git a/contracts/contracts/test-contracts/TestLineaRollup.sol b/contracts/src/_testing/unit/TestLineaRollup.sol similarity index 96% rename from contracts/contracts/test-contracts/TestLineaRollup.sol rename to contracts/src/_testing/unit/TestLineaRollup.sol index 17083ba45..6233a55e9 100644 --- a/contracts/contracts/test-contracts/TestLineaRollup.sol +++ b/contracts/src/_testing/unit/TestLineaRollup.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.8.26; -import { LineaRollup } from "../LineaRollup.sol"; +import { LineaRollup } from "../../rollup/LineaRollup.sol"; contract TestLineaRollup is LineaRollup { function addRollingHash(uint256 _messageNumber, bytes32 _messageHash) external { diff --git a/contracts/contracts/test-contracts/TestLineaRollupV5.sol b/contracts/src/_testing/unit/TestLineaRollupV5.sol similarity index 84% rename from contracts/contracts/test-contracts/TestLineaRollupV5.sol rename to contracts/src/_testing/unit/TestLineaRollupV5.sol index 6c880cb7d..9fa1e15f2 100644 --- a/contracts/contracts/test-contracts/TestLineaRollupV5.sol +++ b/contracts/src/_testing/unit/TestLineaRollupV5.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.8.24; -import { LineaRollupV5 } from "./LineaRollupV5.sol"; +import { LineaRollupV5 } from "../integration/LineaRollupV5.sol"; contract TestLineaRollupV5 is LineaRollupV5 { function setDefaultShnarfExistValue(bytes32 _shnarf) external { diff --git a/contracts/contracts/test-contracts/TestLineaSurgeXP.sol b/contracts/src/_testing/unit/TestLineaSurgeXP.sol similarity index 100% rename from contracts/contracts/test-contracts/TestLineaSurgeXP.sol rename to contracts/src/_testing/unit/TestLineaSurgeXP.sol diff --git a/contracts/contracts/test-contracts/TestMessageServiceBase.sol b/contracts/src/_testing/unit/TestMessageServiceBase.sol similarity index 90% rename from contracts/contracts/test-contracts/TestMessageServiceBase.sol rename to contracts/src/_testing/unit/TestMessageServiceBase.sol index 63b548b9f..71705dcbd 100644 --- a/contracts/contracts/test-contracts/TestMessageServiceBase.sol +++ b/contracts/src/_testing/unit/TestMessageServiceBase.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0 pragma solidity >=0.8.19 <=0.8.26; -import { MessageServiceBase } from "../messageService/MessageServiceBase.sol"; +import { MessageServiceBase } from "../../messaging/MessageServiceBase.sol"; contract TestMessageServiceBase is MessageServiceBase { function initialize(address _messageService, address _remoteSender) external initializer { diff --git a/contracts/contracts/test-contracts/TestPauseManager.sol b/contracts/src/_testing/unit/TestPauseManager.sol similarity index 87% rename from contracts/contracts/test-contracts/TestPauseManager.sol rename to contracts/src/_testing/unit/TestPauseManager.sol index 5e7084f1a..152bc6f28 100644 --- a/contracts/contracts/test-contracts/TestPauseManager.sol +++ b/contracts/src/_testing/unit/TestPauseManager.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0 pragma solidity >=0.8.19 <=0.8.26; -import { PauseManager } from "../lib/PauseManager.sol"; +import { PauseManager } from "../../security/pausing/PauseManager.sol"; import { TestSetPauseTypeRoles } from "./TestSetPauseTypeRoles.sol"; contract TestPauseManager is PauseManager, TestSetPauseTypeRoles { diff --git a/contracts/contracts/verifiers/test/TestPlonkVerifierForDataAggregation.sol b/contracts/src/_testing/unit/TestPlonkVerifierForDataAggregation.sol similarity index 100% rename from contracts/contracts/verifiers/test/TestPlonkVerifierForDataAggregation.sol rename to contracts/src/_testing/unit/TestPlonkVerifierForDataAggregation.sol diff --git a/contracts/contracts/test-contracts/TestPublicInputVerifier.sol b/contracts/src/_testing/unit/TestPublicInputVerifier.sol similarity index 85% rename from contracts/contracts/test-contracts/TestPublicInputVerifier.sol rename to contracts/src/_testing/unit/TestPublicInputVerifier.sol index c94494aef..63d95660e 100644 --- a/contracts/contracts/test-contracts/TestPublicInputVerifier.sol +++ b/contracts/src/_testing/unit/TestPublicInputVerifier.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.8.26; -import { IPlonkVerifier } from "../interfaces/l1/IPlonkVerifier.sol"; +import { IPlonkVerifier } from "../../verifiers/interfaces/IPlonkVerifier.sol"; /// @dev Test verifier contract that returns true. contract TestPublicInputVerifier is IPlonkVerifier { diff --git a/contracts/contracts/test-contracts/TestRateLimiter.sol b/contracts/src/_testing/unit/TestRateLimiter.sol similarity index 91% rename from contracts/contracts/test-contracts/TestRateLimiter.sol rename to contracts/src/_testing/unit/TestRateLimiter.sol index b60cde25b..b27f12e64 100644 --- a/contracts/contracts/test-contracts/TestRateLimiter.sol +++ b/contracts/src/_testing/unit/TestRateLimiter.sol @@ -2,7 +2,7 @@ pragma solidity >=0.8.19 <=0.8.26; import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; -import { RateLimiter } from "../messageService/lib/RateLimiter.sol"; +import { RateLimiter } from "../../security/limiting/RateLimiter.sol"; contract TestRateLimiter is Initializable, RateLimiter { // we need eth to test the limits with diff --git a/contracts/contracts/test-contracts/TestSetPauseTypeRoles.sol b/contracts/src/_testing/unit/TestSetPauseTypeRoles.sol similarity index 83% rename from contracts/contracts/test-contracts/TestSetPauseTypeRoles.sol rename to contracts/src/_testing/unit/TestSetPauseTypeRoles.sol index cd384c022..f8f6c8f4c 100644 --- a/contracts/contracts/test-contracts/TestSetPauseTypeRoles.sol +++ b/contracts/src/_testing/unit/TestSetPauseTypeRoles.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0 pragma solidity >=0.8.19 <=0.8.26; -import { PauseManager } from "../lib/PauseManager.sol"; +import { PauseManager } from "../../security/pausing/PauseManager.sol"; contract TestSetPauseTypeRoles is PauseManager { function initializePauseTypesAndPermissions( diff --git a/contracts/contracts/test-contracts/TestSparseMerkleTreeVerifier.sol b/contracts/src/_testing/unit/TestSparseMerkleTreeVerifier.sol similarity index 87% rename from contracts/contracts/test-contracts/TestSparseMerkleTreeVerifier.sol rename to contracts/src/_testing/unit/TestSparseMerkleTreeVerifier.sol index b595b7872..37ff6f548 100644 --- a/contracts/contracts/test-contracts/TestSparseMerkleTreeVerifier.sol +++ b/contracts/src/_testing/unit/TestSparseMerkleTreeVerifier.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.8.26; -import { SparseMerkleTreeVerifier } from "../messageService/lib/SparseMerkleTreeVerifier.sol"; -import { Utils } from "../lib/Utils.sol"; +import { SparseMerkleTreeVerifier } from "../../messaging/libraries/SparseMerkleTreeVerifier.sol"; +import { Utils } from "../../libraries/Utils.sol"; contract TestSparseMerkleTreeVerifier { using SparseMerkleTreeVerifier for *; diff --git a/contracts/contracts/test-contracts/TestUtils.sol b/contracts/src/_testing/unit/TestUtils.sol similarity index 82% rename from contracts/contracts/test-contracts/TestUtils.sol rename to contracts/src/_testing/unit/TestUtils.sol index e21bd044f..e6b8124d4 100644 --- a/contracts/contracts/test-contracts/TestUtils.sol +++ b/contracts/src/_testing/unit/TestUtils.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.8.26; -import { Utils } from "../lib/Utils.sol"; +import { Utils } from "../../libraries/Utils.sol"; contract TestUtils { function efficientKeccak(bytes32 _left, bytes32 _right) external pure returns (bytes32 value) { diff --git a/contracts/contracts/tokenBridge/BridgedToken.sol b/contracts/src/bridging/token/BridgedToken.sol similarity index 100% rename from contracts/contracts/tokenBridge/BridgedToken.sol rename to contracts/src/bridging/token/BridgedToken.sol diff --git a/contracts/contracts/tokenBridge/CustomBridgedToken.sol b/contracts/src/bridging/token/CustomBridgedToken.sol similarity index 100% rename from contracts/contracts/tokenBridge/CustomBridgedToken.sol rename to contracts/src/bridging/token/CustomBridgedToken.sol diff --git a/contracts/contracts/tokenBridge/TokenBridge.sol b/contracts/src/bridging/token/TokenBridge.sol similarity index 98% rename from contracts/contracts/tokenBridge/TokenBridge.sol rename to contracts/src/bridging/token/TokenBridge.sol index c2d1f49ac..9ffce5b26 100644 --- a/contracts/contracts/tokenBridge/TokenBridge.sol +++ b/contracts/src/bridging/token/TokenBridge.sol @@ -2,7 +2,7 @@ pragma solidity 0.8.19; import { ITokenBridge } from "./interfaces/ITokenBridge.sol"; -import { IMessageService } from "../interfaces/IMessageService.sol"; +import { IMessageService } from "../../messaging/interfaces/IMessageService.sol"; import { IERC20PermitUpgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol"; import { IERC20MetadataUpgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol"; @@ -14,14 +14,14 @@ import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/ import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import { BridgedToken } from "./BridgedToken.sol"; -import { MessageServiceBase } from "../messageService/MessageServiceBase.sol"; +import { MessageServiceBase } from "../../messaging/MessageServiceBase.sol"; -import { TokenBridgePauseManager } from "../lib/TokenBridgePauseManager.sol"; +import { TokenBridgePauseManager } from "../../security/pausing/TokenBridgePauseManager.sol"; import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; -import { StorageFiller39 } from "./lib/StorageFiller39.sol"; -import { PermissionsManager } from "../lib/PermissionsManager.sol"; +import { StorageFiller39 } from "./utils/StorageFiller39.sol"; +import { PermissionsManager } from "../../security/access/PermissionsManager.sol"; -import { Utils } from "../lib/Utils.sol"; +import { Utils } from "../../libraries/Utils.sol"; /** * @title Linea Canonical Token Bridge * @notice Contract to manage cross-chain ERC20 bridging. diff --git a/contracts/contracts/tokenBridge/interfaces/ITokenBridge.sol b/contracts/src/bridging/token/interfaces/ITokenBridge.sol similarity index 98% rename from contracts/contracts/tokenBridge/interfaces/ITokenBridge.sol rename to contracts/src/bridging/token/interfaces/ITokenBridge.sol index 330d6ba4f..41fb93f50 100644 --- a/contracts/contracts/tokenBridge/interfaces/ITokenBridge.sol +++ b/contracts/src/bridging/token/interfaces/ITokenBridge.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: Apache-2.0 pragma solidity 0.8.19; -import { IPauseManager } from "../../interfaces/IPauseManager.sol"; -import { IPermissionsManager } from "../../interfaces/IPermissionsManager.sol"; +import { IPauseManager } from "../../../security/pausing/interfaces/IPauseManager.sol"; +import { IPermissionsManager } from "../../../security/access/interfaces/IPermissionsManager.sol"; /** * @title Interface declaring Canonical Token Bridge struct, functions, events and errors. diff --git a/contracts/contracts/tokenBridge/lib/StorageFiller39.sol b/contracts/src/bridging/token/utils/StorageFiller39.sol similarity index 100% rename from contracts/contracts/tokenBridge/lib/StorageFiller39.sol rename to contracts/src/bridging/token/utils/StorageFiller39.sol diff --git a/contracts/contracts/messageService/lib/TimeLock.sol b/contracts/src/governance/TimeLock.sol similarity index 100% rename from contracts/contracts/messageService/lib/TimeLock.sol rename to contracts/src/governance/TimeLock.sol diff --git a/contracts/contracts/interfaces/IGenericErrors.sol b/contracts/src/interfaces/IGenericErrors.sol similarity index 100% rename from contracts/contracts/interfaces/IGenericErrors.sol rename to contracts/src/interfaces/IGenericErrors.sol diff --git a/contracts/contracts/lib/Mimc.sol b/contracts/src/libraries/Mimc.sol similarity index 100% rename from contracts/contracts/lib/Mimc.sol rename to contracts/src/libraries/Mimc.sol diff --git a/contracts/contracts/lib/SparseMerkleProof.sol b/contracts/src/libraries/SparseMerkleProof.sol similarity index 100% rename from contracts/contracts/lib/SparseMerkleProof.sol rename to contracts/src/libraries/SparseMerkleProof.sol diff --git a/contracts/contracts/messageService/lib/TransientStorageHelpers.sol b/contracts/src/libraries/TransientStorageHelpers.sol similarity index 100% rename from contracts/contracts/messageService/lib/TransientStorageHelpers.sol rename to contracts/src/libraries/TransientStorageHelpers.sol diff --git a/contracts/contracts/lib/Utils.sol b/contracts/src/libraries/Utils.sol similarity index 100% rename from contracts/contracts/lib/Utils.sol rename to contracts/src/libraries/Utils.sol diff --git a/contracts/contracts/messageService/MessageServiceBase.sol b/contracts/src/messaging/MessageServiceBase.sol similarity index 97% rename from contracts/contracts/messageService/MessageServiceBase.sol rename to contracts/src/messaging/MessageServiceBase.sol index 77c2957aa..7434e6d16 100644 --- a/contracts/contracts/messageService/MessageServiceBase.sol +++ b/contracts/src/messaging/MessageServiceBase.sol @@ -2,7 +2,7 @@ pragma solidity >=0.8.19 <=0.8.26; import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; -import { IMessageService } from "../interfaces/IMessageService.sol"; +import { IMessageService } from "./interfaces/IMessageService.sol"; import { IGenericErrors } from "../interfaces/IGenericErrors.sol"; /** diff --git a/contracts/contracts/interfaces/IMessageService.sol b/contracts/src/messaging/interfaces/IMessageService.sol similarity index 100% rename from contracts/contracts/interfaces/IMessageService.sol rename to contracts/src/messaging/interfaces/IMessageService.sol diff --git a/contracts/contracts/messageService/l1/L1MessageManager.sol b/contracts/src/messaging/l1/L1MessageManager.sol similarity index 97% rename from contracts/contracts/messageService/l1/L1MessageManager.sol rename to contracts/src/messaging/l1/L1MessageManager.sol index 1afe831ae..58e549226 100644 --- a/contracts/contracts/messageService/l1/L1MessageManager.sol +++ b/contracts/src/messaging/l1/L1MessageManager.sol @@ -3,8 +3,8 @@ pragma solidity 0.8.26; import { BitMaps } from "@openzeppelin/contracts/utils/structs/BitMaps.sol"; import { L1MessageManagerV1 } from "./v1/L1MessageManagerV1.sol"; -import { IL1MessageManager } from "../../interfaces/l1/IL1MessageManager.sol"; -import { Utils } from "../../lib/Utils.sol"; +import { IL1MessageManager } from "./interfaces/IL1MessageManager.sol"; +import { Utils } from "../../libraries/Utils.sol"; /** * @title Contract to manage cross-chain message rolling hash computation and storage on L1. diff --git a/contracts/contracts/messageService/l1/L1MessageService.sol b/contracts/src/messaging/l1/L1MessageService.sol similarity index 94% rename from contracts/contracts/messageService/l1/L1MessageService.sol rename to contracts/src/messaging/l1/L1MessageService.sol index a8e18f897..5a02ecb0c 100644 --- a/contracts/contracts/messageService/l1/L1MessageService.sol +++ b/contracts/src/messaging/l1/L1MessageService.sol @@ -4,11 +4,11 @@ pragma solidity 0.8.26; import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import { L1MessageServiceV1 } from "./v1/L1MessageServiceV1.sol"; import { L1MessageManager } from "./L1MessageManager.sol"; -import { IL1MessageService } from "../../interfaces/l1/IL1MessageService.sol"; +import { IL1MessageService } from "./interfaces/IL1MessageService.sol"; import { IGenericErrors } from "../../interfaces/IGenericErrors.sol"; -import { SparseMerkleTreeVerifier } from "../lib/SparseMerkleTreeVerifier.sol"; -import { TransientStorageHelpers } from "../lib/TransientStorageHelpers.sol"; -import { MessageHashing } from "../lib/MessageHashing.sol"; +import { SparseMerkleTreeVerifier } from "../libraries/SparseMerkleTreeVerifier.sol"; +import { TransientStorageHelpers } from "../../libraries/TransientStorageHelpers.sol"; +import { MessageHashing } from "../libraries/MessageHashing.sol"; /** * @title Contract to manage cross-chain messaging on L1. diff --git a/contracts/contracts/interfaces/l1/IL1MessageManager.sol b/contracts/src/messaging/l1/interfaces/IL1MessageManager.sol similarity index 100% rename from contracts/contracts/interfaces/l1/IL1MessageManager.sol rename to contracts/src/messaging/l1/interfaces/IL1MessageManager.sol diff --git a/contracts/contracts/interfaces/l1/IL1MessageService.sol b/contracts/src/messaging/l1/interfaces/IL1MessageService.sol similarity index 100% rename from contracts/contracts/interfaces/l1/IL1MessageService.sol rename to contracts/src/messaging/l1/interfaces/IL1MessageService.sol diff --git a/contracts/contracts/messageService/l1/v1/L1MessageManagerV1.sol b/contracts/src/messaging/l1/v1/L1MessageManagerV1.sol similarity index 96% rename from contracts/contracts/messageService/l1/v1/L1MessageManagerV1.sol rename to contracts/src/messaging/l1/v1/L1MessageManagerV1.sol index ca808b53e..1c98962f9 100644 --- a/contracts/contracts/messageService/l1/v1/L1MessageManagerV1.sol +++ b/contracts/src/messaging/l1/v1/L1MessageManagerV1.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.8.26; -import { IL1MessageManagerV1 } from "../../../interfaces/l1/IL1MessageManagerV1.sol"; +import { IL1MessageManagerV1 } from "./interfaces/IL1MessageManagerV1.sol"; /** * @title Contract to manage cross-chain message hashes storage and status on L1. diff --git a/contracts/contracts/messageService/l1/v1/L1MessageServiceV1.sol b/contracts/src/messaging/l1/v1/L1MessageServiceV1.sol similarity index 90% rename from contracts/contracts/messageService/l1/v1/L1MessageServiceV1.sol rename to contracts/src/messaging/l1/v1/L1MessageServiceV1.sol index 06cce7834..b15ca491b 100644 --- a/contracts/contracts/messageService/l1/v1/L1MessageServiceV1.sol +++ b/contracts/src/messaging/l1/v1/L1MessageServiceV1.sol @@ -2,13 +2,13 @@ pragma solidity 0.8.26; import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; -import { LineaRollupPauseManager } from "../../../lib/LineaRollupPauseManager.sol"; -import { RateLimiter } from "../../lib/RateLimiter.sol"; +import { LineaRollupPauseManager } from "../../../security/pausing/LineaRollupPauseManager.sol"; +import { RateLimiter } from "../../../security/limiting/RateLimiter.sol"; import { L1MessageManagerV1 } from "./L1MessageManagerV1.sol"; -import { TransientStorageReentrancyGuardUpgradeable } from "../TransientStorageReentrancyGuardUpgradeable.sol"; -import { IMessageService } from "../../../interfaces/IMessageService.sol"; -import { TransientStorageHelpers } from "../../lib/TransientStorageHelpers.sol"; -import { MessageHashing } from "../../lib/MessageHashing.sol"; +import { TransientStorageReentrancyGuardUpgradeable } from "../../../security/reentrancy/TransientStorageReentrancyGuardUpgradeable.sol"; +import { IMessageService } from "../../interfaces/IMessageService.sol"; +import { TransientStorageHelpers } from "../../../libraries/TransientStorageHelpers.sol"; +import { MessageHashing } from "../../libraries/MessageHashing.sol"; /** * @title Contract to manage cross-chain messaging on L1. diff --git a/contracts/contracts/interfaces/l1/IL1MessageManagerV1.sol b/contracts/src/messaging/l1/v1/interfaces/IL1MessageManagerV1.sol similarity index 100% rename from contracts/contracts/interfaces/l1/IL1MessageManagerV1.sol rename to contracts/src/messaging/l1/v1/interfaces/IL1MessageManagerV1.sol diff --git a/contracts/contracts/messageService/l2/L2MessageManager.sol b/contracts/src/messaging/l2/L2MessageManager.sol similarity index 96% rename from contracts/contracts/messageService/l2/L2MessageManager.sol rename to contracts/src/messaging/l2/L2MessageManager.sol index 8869daa68..a679cf00e 100644 --- a/contracts/contracts/messageService/l2/L2MessageManager.sol +++ b/contracts/src/messaging/l2/L2MessageManager.sol @@ -3,8 +3,8 @@ pragma solidity 0.8.19; import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import { L2MessageManagerV1 } from "./v1/L2MessageManagerV1.sol"; -import { IL2MessageManager } from "../../interfaces/l2/IL2MessageManager.sol"; -import { Utils } from "../../lib/Utils.sol"; +import { IL2MessageManager } from "./interfaces/IL2MessageManager.sol"; +import { Utils } from "../../libraries/Utils.sol"; /** * @title Contract to manage cross-chain message hashes storage and statuses on L2. diff --git a/contracts/contracts/messageService/l2/L2MessageService.sol b/contracts/src/messaging/l2/L2MessageService.sol similarity index 97% rename from contracts/contracts/messageService/l2/L2MessageService.sol rename to contracts/src/messaging/l2/L2MessageService.sol index c6568e78c..8a2c99bcd 100644 --- a/contracts/contracts/messageService/l2/L2MessageService.sol +++ b/contracts/src/messaging/l2/L2MessageService.sol @@ -4,7 +4,7 @@ pragma solidity 0.8.19; import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import { L2MessageServiceV1 } from "./v1/L2MessageServiceV1.sol"; import { L2MessageManager } from "./L2MessageManager.sol"; -import { PermissionsManager } from "../../lib/PermissionsManager.sol"; +import { PermissionsManager } from "../../security/access/PermissionsManager.sol"; /** * @title Contract to manage cross-chain messaging on L2. diff --git a/contracts/contracts/interfaces/l2/IL2MessageManager.sol b/contracts/src/messaging/l2/interfaces/IL2MessageManager.sol similarity index 100% rename from contracts/contracts/interfaces/l2/IL2MessageManager.sol rename to contracts/src/messaging/l2/interfaces/IL2MessageManager.sol diff --git a/contracts/contracts/messageService/l2/v1/L2MessageManagerV1.sol b/contracts/src/messaging/l2/v1/L2MessageManagerV1.sol similarity index 90% rename from contracts/contracts/messageService/l2/v1/L2MessageManagerV1.sol rename to contracts/src/messaging/l2/v1/L2MessageManagerV1.sol index ffd6150c8..93245f4ff 100644 --- a/contracts/contracts/messageService/l2/v1/L2MessageManagerV1.sol +++ b/contracts/src/messaging/l2/v1/L2MessageManagerV1.sol @@ -2,8 +2,8 @@ pragma solidity 0.8.19; import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; -import { IL2MessageManagerV1 } from "../../../interfaces/l2/IL2MessageManagerV1.sol"; -import { L2MessageServicePauseManager } from "../../../lib/L2MessageServicePauseManager.sol"; +import { IL2MessageManagerV1 } from "./interfaces/IL2MessageManagerV1.sol"; +import { L2MessageServicePauseManager } from "../../../security/pausing/L2MessageServicePauseManager.sol"; /** * @title Contract to manage cross-chain message hashes storage and statuses on L2. diff --git a/contracts/contracts/messageService/l2/v1/L2MessageServiceV1.sol b/contracts/src/messaging/l2/v1/L2MessageServiceV1.sol similarity index 96% rename from contracts/contracts/messageService/l2/v1/L2MessageServiceV1.sol rename to contracts/src/messaging/l2/v1/L2MessageServiceV1.sol index 975cce51f..18221c2cf 100644 --- a/contracts/contracts/messageService/l2/v1/L2MessageServiceV1.sol +++ b/contracts/src/messaging/l2/v1/L2MessageServiceV1.sol @@ -3,12 +3,12 @@ pragma solidity 0.8.19; import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; -import { IMessageService } from "../../../interfaces/IMessageService.sol"; -import { IL2MessageServiceV1 } from "../../../interfaces/l2/IL2MessageServiceV1.sol"; +import { IMessageService } from "../../interfaces/IMessageService.sol"; +import { IL2MessageServiceV1 } from "./interfaces/IL2MessageServiceV1.sol"; import { IGenericErrors } from "../../../interfaces/IGenericErrors.sol"; -import { RateLimiter } from "../../lib/RateLimiter.sol"; +import { RateLimiter } from "../../../security/limiting/RateLimiter.sol"; import { L2MessageManagerV1 } from "./L2MessageManagerV1.sol"; -import { MessageHashing } from "../../lib/MessageHashing.sol"; +import { MessageHashing } from "../../libraries/MessageHashing.sol"; /** * @title Contract to manage cross-chain messaging on L2. diff --git a/contracts/contracts/interfaces/l2/IL2MessageManagerV1.sol b/contracts/src/messaging/l2/v1/interfaces/IL2MessageManagerV1.sol similarity index 100% rename from contracts/contracts/interfaces/l2/IL2MessageManagerV1.sol rename to contracts/src/messaging/l2/v1/interfaces/IL2MessageManagerV1.sol diff --git a/contracts/contracts/interfaces/l2/IL2MessageServiceV1.sol b/contracts/src/messaging/l2/v1/interfaces/IL2MessageServiceV1.sol similarity index 100% rename from contracts/contracts/interfaces/l2/IL2MessageServiceV1.sol rename to contracts/src/messaging/l2/v1/interfaces/IL2MessageServiceV1.sol diff --git a/contracts/contracts/messageService/lib/MessageHashing.sol b/contracts/src/messaging/libraries/MessageHashing.sol similarity index 100% rename from contracts/contracts/messageService/lib/MessageHashing.sol rename to contracts/src/messaging/libraries/MessageHashing.sol diff --git a/contracts/contracts/messageService/lib/SparseMerkleTreeVerifier.sol b/contracts/src/messaging/libraries/SparseMerkleTreeVerifier.sol similarity index 97% rename from contracts/contracts/messageService/lib/SparseMerkleTreeVerifier.sol rename to contracts/src/messaging/libraries/SparseMerkleTreeVerifier.sol index 0f07ad829..6b188b9d8 100644 --- a/contracts/contracts/messageService/lib/SparseMerkleTreeVerifier.sol +++ b/contracts/src/messaging/libraries/SparseMerkleTreeVerifier.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.8.26; -import { Utils } from "../../lib/Utils.sol"; +import { Utils } from "../../libraries/Utils.sol"; /** * @title Library to verify sparse merkle proofs and to get the leaf hash value diff --git a/contracts/contracts/lib/CallForwardingProxy.sol b/contracts/src/proxies/CallForwardingProxy.sol similarity index 100% rename from contracts/contracts/lib/CallForwardingProxy.sol rename to contracts/src/proxies/CallForwardingProxy.sol diff --git a/contracts/contracts/tools/RecoverFunds.sol b/contracts/src/recovery/RecoverFunds.sol similarity index 96% rename from contracts/contracts/tools/RecoverFunds.sol rename to contracts/src/recovery/RecoverFunds.sol index 36210aa18..c6e2f172d 100644 --- a/contracts/contracts/tools/RecoverFunds.sol +++ b/contracts/src/recovery/RecoverFunds.sol @@ -3,7 +3,7 @@ pragma solidity 0.8.26; import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import { IGenericErrors } from "../interfaces/IGenericErrors.sol"; -import { IRecoverFunds } from "../interfaces/tools/IRecoverFunds.sol"; +import { IRecoverFunds } from "./interfaces/IRecoverFunds.sol"; /** * @title Contract to recover funds sent to the message service address on the alternate chain. diff --git a/contracts/contracts/interfaces/tools/IRecoverFunds.sol b/contracts/src/recovery/interfaces/IRecoverFunds.sol similarity index 100% rename from contracts/contracts/interfaces/tools/IRecoverFunds.sol rename to contracts/src/recovery/interfaces/IRecoverFunds.sol diff --git a/contracts/contracts/LineaRollup.sol b/contracts/src/rollup/LineaRollup.sol similarity index 99% rename from contracts/contracts/LineaRollup.sol rename to contracts/src/rollup/LineaRollup.sol index bdc28b863..1460ca916 100644 --- a/contracts/contracts/LineaRollup.sol +++ b/contracts/src/rollup/LineaRollup.sol @@ -3,12 +3,12 @@ pragma solidity 0.8.26; import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; -import { L1MessageService } from "./messageService/l1/L1MessageService.sol"; +import { L1MessageService } from "../messaging/l1/L1MessageService.sol"; import { ZkEvmV2 } from "./ZkEvmV2.sol"; -import { ILineaRollup } from "./interfaces/l1/ILineaRollup.sol"; -import { PermissionsManager } from "./lib/PermissionsManager.sol"; +import { ILineaRollup } from "./interfaces/ILineaRollup.sol"; +import { PermissionsManager } from "../security/access/PermissionsManager.sol"; -import { Utils } from "./lib/Utils.sol"; +import { Utils } from "../libraries/Utils.sol"; /** * @title Contract to manage cross-chain messaging on L1, L2 data submission, and rollup proof verification. * @author ConsenSys Software Inc. diff --git a/contracts/contracts/ZkEvmV2.sol b/contracts/src/rollup/ZkEvmV2.sol similarity index 93% rename from contracts/contracts/ZkEvmV2.sol rename to contracts/src/rollup/ZkEvmV2.sol index 2fb702236..7e7c9c33e 100644 --- a/contracts/contracts/ZkEvmV2.sol +++ b/contracts/src/rollup/ZkEvmV2.sol @@ -3,9 +3,9 @@ pragma solidity 0.8.26; import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; -import { L1MessageServiceV1 } from "./messageService/l1/v1/L1MessageServiceV1.sol"; -import { IZkEvmV2 } from "./interfaces/l1/IZkEvmV2.sol"; -import { IPlonkVerifier } from "./interfaces/l1/IPlonkVerifier.sol"; +import { L1MessageServiceV1 } from "../messaging/l1/v1/L1MessageServiceV1.sol"; +import { IZkEvmV2 } from "./interfaces/IZkEvmV2.sol"; +import { IPlonkVerifier } from "../verifiers/interfaces/IPlonkVerifier.sol"; /** * @title Contract to manage cross-chain L1 rollup proving. * @author ConsenSys Software Inc. diff --git a/contracts/contracts/interfaces/l1/ILineaRollup.sol b/contracts/src/rollup/interfaces/ILineaRollup.sol similarity index 98% rename from contracts/contracts/interfaces/l1/ILineaRollup.sol rename to contracts/src/rollup/interfaces/ILineaRollup.sol index d7d31c4b4..75178600c 100644 --- a/contracts/contracts/interfaces/l1/ILineaRollup.sol +++ b/contracts/src/rollup/interfaces/ILineaRollup.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: Apache-2.0 pragma solidity 0.8.26; -import { IPauseManager } from "../../interfaces/IPauseManager.sol"; -import { IPermissionsManager } from "../../interfaces/IPermissionsManager.sol"; +import { IPauseManager } from "../../security/pausing/interfaces/IPauseManager.sol"; +import { IPermissionsManager } from "../../security/access/interfaces/IPermissionsManager.sol"; /** * @title LineaRollup interface for current functions, structs, events and errors. diff --git a/contracts/contracts/interfaces/l1/IZkEvmV2.sol b/contracts/src/rollup/interfaces/IZkEvmV2.sol similarity index 100% rename from contracts/contracts/interfaces/l1/IZkEvmV2.sol rename to contracts/src/rollup/interfaces/IZkEvmV2.sol diff --git a/contracts/contracts/lib/PermissionsManager.sol b/contracts/src/security/access/PermissionsManager.sol similarity index 88% rename from contracts/contracts/lib/PermissionsManager.sol rename to contracts/src/security/access/PermissionsManager.sol index 477628c29..b98dd686f 100644 --- a/contracts/contracts/lib/PermissionsManager.sol +++ b/contracts/src/security/access/PermissionsManager.sol @@ -3,8 +3,8 @@ pragma solidity >=0.8.19 <=0.8.26; import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; -import { IGenericErrors } from "../interfaces/IGenericErrors.sol"; -import { IPermissionsManager } from "../interfaces/IPermissionsManager.sol"; +import { IGenericErrors } from "../../interfaces/IGenericErrors.sol"; +import { IPermissionsManager } from "./interfaces/IPermissionsManager.sol"; /** * @title Contract to manage permissions initialization. diff --git a/contracts/contracts/interfaces/IPermissionsManager.sol b/contracts/src/security/access/interfaces/IPermissionsManager.sol similarity index 100% rename from contracts/contracts/interfaces/IPermissionsManager.sol rename to contracts/src/security/access/interfaces/IPermissionsManager.sol diff --git a/contracts/contracts/messageService/lib/RateLimiter.sol b/contracts/src/security/limiting/RateLimiter.sol similarity index 98% rename from contracts/contracts/messageService/lib/RateLimiter.sol rename to contracts/src/security/limiting/RateLimiter.sol index b2b3637fc..79ed7c942 100644 --- a/contracts/contracts/messageService/lib/RateLimiter.sol +++ b/contracts/src/security/limiting/RateLimiter.sol @@ -3,7 +3,7 @@ pragma solidity >=0.8.19 <=0.8.26; import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; -import { IRateLimiter } from "../../interfaces/IRateLimiter.sol"; +import { IRateLimiter } from "./interfaces/IRateLimiter.sol"; /** * @title Rate Limiter by period and amount using the block timestamp. diff --git a/contracts/contracts/interfaces/IRateLimiter.sol b/contracts/src/security/limiting/interfaces/IRateLimiter.sol similarity index 100% rename from contracts/contracts/interfaces/IRateLimiter.sol rename to contracts/src/security/limiting/interfaces/IRateLimiter.sol diff --git a/contracts/contracts/lib/L2MessageServicePauseManager.sol b/contracts/src/security/pausing/L2MessageServicePauseManager.sol similarity index 100% rename from contracts/contracts/lib/L2MessageServicePauseManager.sol rename to contracts/src/security/pausing/L2MessageServicePauseManager.sol diff --git a/contracts/contracts/lib/LineaRollupPauseManager.sol b/contracts/src/security/pausing/LineaRollupPauseManager.sol similarity index 100% rename from contracts/contracts/lib/LineaRollupPauseManager.sol rename to contracts/src/security/pausing/LineaRollupPauseManager.sol diff --git a/contracts/contracts/lib/PauseManager.sol b/contracts/src/security/pausing/PauseManager.sol similarity index 98% rename from contracts/contracts/lib/PauseManager.sol rename to contracts/src/security/pausing/PauseManager.sol index 55be8f03b..ac724d9ed 100644 --- a/contracts/contracts/lib/PauseManager.sol +++ b/contracts/src/security/pausing/PauseManager.sol @@ -3,7 +3,7 @@ pragma solidity >=0.8.19 <=0.8.26; import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; -import { IPauseManager } from "../interfaces/IPauseManager.sol"; +import { IPauseManager } from "./interfaces/IPauseManager.sol"; /** * @title Contract to manage cross-chain function pausing. diff --git a/contracts/contracts/lib/TokenBridgePauseManager.sol b/contracts/src/security/pausing/TokenBridgePauseManager.sol similarity index 100% rename from contracts/contracts/lib/TokenBridgePauseManager.sol rename to contracts/src/security/pausing/TokenBridgePauseManager.sol diff --git a/contracts/contracts/interfaces/IPauseManager.sol b/contracts/src/security/pausing/interfaces/IPauseManager.sol similarity index 100% rename from contracts/contracts/interfaces/IPauseManager.sol rename to contracts/src/security/pausing/interfaces/IPauseManager.sol diff --git a/contracts/contracts/messageService/l1/TransientStorageReentrancyGuardUpgradeable.sol b/contracts/src/security/reentrancy/TransientStorageReentrancyGuardUpgradeable.sol similarity index 94% rename from contracts/contracts/messageService/l1/TransientStorageReentrancyGuardUpgradeable.sol rename to contracts/src/security/reentrancy/TransientStorageReentrancyGuardUpgradeable.sol index d635384a0..b60f0274e 100644 --- a/contracts/contracts/messageService/l1/TransientStorageReentrancyGuardUpgradeable.sol +++ b/contracts/src/security/reentrancy/TransientStorageReentrancyGuardUpgradeable.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.8.26; -import { TransientStorageHelpers } from "../lib/TransientStorageHelpers.sol"; +import { TransientStorageHelpers } from "../../libraries/TransientStorageHelpers.sol"; /** * @title Contract that helps prevent reentrant calls. diff --git a/contracts/contracts/token/LineaSurgeXP.sol b/contracts/src/tokens/LineaSurgeXP.sol similarity index 100% rename from contracts/contracts/token/LineaSurgeXP.sol rename to contracts/src/tokens/LineaSurgeXP.sol diff --git a/contracts/contracts/token/LineaVoyageXP.sol b/contracts/src/tokens/LineaVoyageXP.sol similarity index 100% rename from contracts/contracts/token/LineaVoyageXP.sol rename to contracts/src/tokens/LineaVoyageXP.sol diff --git a/contracts/contracts/token/TokenMintingRateLimiter.sol b/contracts/src/tokens/TokenMintingRateLimiter.sol similarity index 97% rename from contracts/contracts/token/TokenMintingRateLimiter.sol rename to contracts/src/tokens/TokenMintingRateLimiter.sol index 60356b138..b877ffd75 100644 --- a/contracts/contracts/token/TokenMintingRateLimiter.sol +++ b/contracts/src/tokens/TokenMintingRateLimiter.sol @@ -2,8 +2,8 @@ pragma solidity 0.8.19; import { AccessControl } from "@openzeppelin/contracts/access/AccessControl.sol"; -import { ITokenMinter } from "./ITokenMinter.sol"; -import { ITokenMintingRateLimiter } from "./ITokenMintingRateLimiter.sol"; +import { ITokenMinter } from "./interfaces/ITokenMinter.sol"; +import { ITokenMintingRateLimiter } from "./interfaces/ITokenMintingRateLimiter.sol"; /** * @title Token minting rate limiter. diff --git a/contracts/contracts/token/ITokenMinter.sol b/contracts/src/tokens/interfaces/ITokenMinter.sol similarity index 100% rename from contracts/contracts/token/ITokenMinter.sol rename to contracts/src/tokens/interfaces/ITokenMinter.sol diff --git a/contracts/contracts/token/ITokenMintingRateLimiter.sol b/contracts/src/tokens/interfaces/ITokenMintingRateLimiter.sol similarity index 100% rename from contracts/contracts/token/ITokenMintingRateLimiter.sol rename to contracts/src/tokens/interfaces/ITokenMintingRateLimiter.sol diff --git a/contracts/contracts/verifiers/PlonkVerifierDev.sol b/contracts/src/verifiers/PlonkVerifierDev.sol similarity index 100% rename from contracts/contracts/verifiers/PlonkVerifierDev.sol rename to contracts/src/verifiers/PlonkVerifierDev.sol diff --git a/contracts/contracts/verifiers/PlonkVerifierForDataAggregation.sol b/contracts/src/verifiers/PlonkVerifierForDataAggregation.sol similarity index 100% rename from contracts/contracts/verifiers/PlonkVerifierForDataAggregation.sol rename to contracts/src/verifiers/PlonkVerifierForDataAggregation.sol diff --git a/contracts/contracts/verifiers/PlonkVerifierForMultiTypeDataAggregation.sol b/contracts/src/verifiers/PlonkVerifierForMultiTypeDataAggregation.sol similarity index 100% rename from contracts/contracts/verifiers/PlonkVerifierForMultiTypeDataAggregation.sol rename to contracts/src/verifiers/PlonkVerifierForMultiTypeDataAggregation.sol diff --git a/contracts/contracts/verifiers/Utils.sol b/contracts/src/verifiers/Utils.sol similarity index 100% rename from contracts/contracts/verifiers/Utils.sol rename to contracts/src/verifiers/Utils.sol diff --git a/contracts/contracts/interfaces/l1/IPlonkVerifier.sol b/contracts/src/verifiers/interfaces/IPlonkVerifier.sol similarity index 100% rename from contracts/contracts/interfaces/l1/IPlonkVerifier.sol rename to contracts/src/verifiers/interfaces/IPlonkVerifier.sol diff --git a/contracts/test/LineaRollup.ts b/contracts/test/LineaRollup.ts index 9f0e1083d..a837b1144 100644 --- a/contracts/test/LineaRollup.ts +++ b/contracts/test/LineaRollup.ts @@ -198,7 +198,7 @@ describe("Linea Rollup contract", () => { defaultAdmin: securityCouncil.address, }; - const deployCall = deployUpgradableFromFactory("contracts/LineaRollup.sol:LineaRollup", [initializationData], { + const deployCall = deployUpgradableFromFactory("src/rollup/LineaRollup.sol:LineaRollup", [initializationData], { initializer: LINEA_ROLLUP_INITIALIZE_SIGNATURE, unsafeAllow: ["constructor"], }); @@ -265,7 +265,7 @@ describe("Linea Rollup contract", () => { }; const lineaRollup = await deployUpgradableFromFactory( - "contracts/LineaRollup.sol:LineaRollup", + "src/rollup/LineaRollup.sol:LineaRollup", [initializationData], { initializer: LINEA_ROLLUP_INITIALIZE_SIGNATURE, @@ -292,7 +292,7 @@ describe("Linea Rollup contract", () => { }; const lineaRollup = await deployUpgradableFromFactory( - "contracts/LineaRollup.sol:LineaRollup", + "src/rollup/LineaRollup.sol:LineaRollup", [initializationData], { initializer: LINEA_ROLLUP_INITIALIZE_SIGNATURE, @@ -2377,7 +2377,7 @@ describe("Linea Rollup contract", () => { verifier = await plonkVerifier.getAddress(); const lineaRollup = (await deployUpgradableFromFactory( - "contracts/test-contracts/TestLineaRollupV5.sol:TestLineaRollupV5", + "src/_testing/unit/TestLineaRollupV5.sol:TestLineaRollupV5", [ parentStateRootHash, 0, @@ -2435,7 +2435,7 @@ describe("Linea Rollup contract", () => { // Deploy new implementation const newLineaRollupFactory = await ethers.getContractFactory( - "contracts/test-contracts/TestLineaRollup.sol:TestLineaRollup", + "src/_testing/unit/TestLineaRollup.sol:TestLineaRollup", ); const newLineaRollup = await upgrades.upgradeProxy(lineaRollupV5, newLineaRollupFactory, { unsafeAllowRenames: true, @@ -2475,7 +2475,7 @@ describe("Linea Rollup contract", () => { // Deploy new LineaRollup implementation const newLineaRollupFactory = await ethers.getContractFactory( - "contracts/test-contracts/TestLineaRollup.sol:TestLineaRollup", + "src/_testing/unit/TestLineaRollup.sol:TestLineaRollup", ); const newLineaRollup = await upgrades.upgradeProxy(lineaRollupV5, newLineaRollupFactory, { unsafeAllowRenames: true, @@ -2522,7 +2522,7 @@ describe("Linea Rollup contract", () => { expect(await lineaRollupV5.currentL2BlockNumber()).to.equal(0); // Deploy new implementation - const newLineaRollupFactory = await ethers.getContractFactory("contracts/LineaRollup.sol:LineaRollup"); + const newLineaRollupFactory = await ethers.getContractFactory("src/rollup/LineaRollup.sol:LineaRollup"); const newLineaRollup = await upgrades.upgradeProxy(lineaRollupV5, newLineaRollupFactory, { unsafeAllowRenames: true, }); @@ -2548,7 +2548,7 @@ describe("Linea Rollup contract", () => { expect(await lineaRollupV5.currentL2BlockNumber()).to.equal(0); // Deploy new implementation - const newLineaRollupFactory = await ethers.getContractFactory("contracts/LineaRollup.sol:LineaRollup"); + const newLineaRollupFactory = await ethers.getContractFactory("src/rollup/LineaRollup.sol:LineaRollup"); const newLineaRollup = await upgrades.upgradeProxy(lineaRollupV5, newLineaRollupFactory, { unsafeAllowRenames: true, }); @@ -2570,7 +2570,7 @@ describe("Linea Rollup contract", () => { expect(await lineaRollupV5.currentL2BlockNumber()).to.equal(0); // Deploy new implementation - const newLineaRollupFactory = await ethers.getContractFactory("contracts/LineaRollup.sol:LineaRollup"); + const newLineaRollupFactory = await ethers.getContractFactory("src/rollup/LineaRollup.sol:LineaRollup"); const newLineaRollup = await upgrades.upgradeProxy(lineaRollupV5, newLineaRollupFactory, { unsafeAllowRenames: true, }); @@ -2594,7 +2594,7 @@ describe("Linea Rollup contract", () => { it("Should revert with ZeroAddressNotAllowed when addressWithRole is zero address in reinitializeLineaRollupV6", async () => { // Deploy new implementation - const newLineaRollupFactory = await ethers.getContractFactory("contracts/LineaRollup.sol:LineaRollup"); + const newLineaRollupFactory = await ethers.getContractFactory("src/rollup/LineaRollup.sol:LineaRollup"); const newLineaRollup = await upgrades.upgradeProxy(lineaRollupV5, newLineaRollupFactory, { unsafeAllowRenames: true, }); @@ -2615,7 +2615,7 @@ describe("Linea Rollup contract", () => { it("Should set all permissions", async () => { // Deploy new implementation - const newLineaRollupFactory = await ethers.getContractFactory("contracts/LineaRollup.sol:LineaRollup"); + const newLineaRollupFactory = await ethers.getContractFactory("src/rollup/LineaRollup.sol:LineaRollup"); const newLineaRollup = await upgrades.upgradeProxy(lineaRollupV5, newLineaRollupFactory, { unsafeAllowRenames: true, }); @@ -2635,7 +2635,7 @@ describe("Linea Rollup contract", () => { it("Should set all pause types and unpause types in mappings and emit events", async () => { // Deploy new implementation - const newLineaRollupFactory = await ethers.getContractFactory("contracts/LineaRollup.sol:LineaRollup"); + const newLineaRollupFactory = await ethers.getContractFactory("src/rollup/LineaRollup.sol:LineaRollup"); const newLineaRollup = await upgrades.upgradeProxy(lineaRollupV5, newLineaRollupFactory, { unsafeAllowRenames: true, }); diff --git a/contracts/test/messageService/l2/L2MessageService.ts b/contracts/test/messageService/l2/L2MessageService.ts index 18aeaba0a..e59d51415 100644 --- a/contracts/test/messageService/l2/L2MessageService.ts +++ b/contracts/test/messageService/l2/L2MessageService.ts @@ -1431,7 +1431,7 @@ describe("L2MessageService", () => { async function deployL2MessageServiceFixture() { return deployUpgradableFromFactory( - "contracts/test-contracts/L2MessageServiceLineaMainnet.sol:L2MessageServiceLineaMainnet", + "src/_testing/integration/L2MessageServiceLineaMainnet.sol:L2MessageServiceLineaMainnet", [securityCouncil.address, l1l2MessageSetter.address, ONE_DAY_IN_SECONDS, INITIAL_WITHDRAW_LIMIT], ) as unknown as Promise; } @@ -1460,7 +1460,7 @@ describe("L2MessageService", () => { // Deploy new implementation const newL2MessageServiceFactory = await ethers.getContractFactory( - "contracts/messageService/l2/L2MessageService.sol:L2MessageService", + "src/messaging/l2/L2MessageService.sol:L2MessageService", ); const newL2MessageService = await upgrades.upgradeProxy(l2MessageService, newL2MessageServiceFactory); @@ -1476,7 +1476,7 @@ describe("L2MessageService", () => { it("Should revert with ZeroAddressNotAllowed when addressWithRole is zero address in reinitializePauseTypesAndPermissions", async () => { // Deploy new implementation const newL2MessageServiceFactory = await ethers.getContractFactory( - "contracts/messageService/l2/L2MessageService.sol:L2MessageService", + "src/messaging/l2/L2MessageService.sol:L2MessageService", ); const newL2MessageService = await upgrades.upgradeProxy(l2MessageService, newL2MessageServiceFactory); @@ -1496,7 +1496,7 @@ describe("L2MessageService", () => { it("Should set all permissions", async () => { // Deploy new implementation const newL2MessageServiceFactory = await ethers.getContractFactory( - "contracts/messageService/l2/L2MessageService.sol:L2MessageService", + "src/messaging/l2/L2MessageService.sol:L2MessageService", ); const newL2MessageService = await upgrades.upgradeProxy(l2MessageService, newL2MessageServiceFactory); @@ -1514,7 +1514,7 @@ describe("L2MessageService", () => { it("Should set all pause types and unpause types in mappings and emit events", async () => { // Deploy new implementation const newL2MessageServiceFactory = await ethers.getContractFactory( - "contracts/messageService/l2/L2MessageService.sol:L2MessageService", + "src/messaging/l2/L2MessageService.sol:L2MessageService", ); const newL2MessageService = await upgrades.upgradeProxy(l2MessageService, newL2MessageServiceFactory); diff --git a/contracts/test/tokenBridge/TokenBridge.ts b/contracts/test/tokenBridge/TokenBridge.ts index 23c5061ed..d979b777d 100644 --- a/contracts/test/tokenBridge/TokenBridge.ts +++ b/contracts/test/tokenBridge/TokenBridge.ts @@ -958,7 +958,7 @@ describe("TokenBridge", function () { const { owner, messageService, chainIds } = await loadFixture(deployContractsFixture); const TokenBridgeV1 = await ethers.getContractFactory( - "contracts/tokenBridge/mocks/TokenBridgeFlatten.sol:TokenBridgeFlatten", + "src/_testing/integration/TokenBridgeFlatten.sol:TokenBridgeFlatten", ); const tokenBridgeV1 = (await upgrades.deployProxy(TokenBridgeV1, [ owner.address, @@ -1053,7 +1053,7 @@ describe("TokenBridge", function () { const { owner, messageService, chainIds } = await loadFixture(deployContractsFixture); const TokenBridgeV1 = await ethers.getContractFactory( - "contracts/tokenBridge/mocks/TokenBridgeFlatten.sol:TokenBridgeFlatten", + "src/_testing/integration/TokenBridgeFlatten.sol:TokenBridgeFlatten", ); const tokenBridgeV1 = (await upgrades.deployProxy(TokenBridgeV1, [ owner.address,