From 07f80d528e1cadc4ef27153f120471d95d88301b Mon Sep 17 00:00:00 2001 From: VGau Date: Mon, 9 Dec 2024 17:26:57 +0100 Subject: [PATCH 1/3] fix: update contracts folder structure --- .../contracts/tools/ProxyAdminReplica.sol | 12 ---------- contracts/foundry.toml | 2 +- contracts/hardhat.config.ts | 1 + .../IntegrationTestTrueVerifier.sol | 2 +- .../L2MessageServiceLineaMainnet.sol | 0 .../_testing/integration}/LineaRollupV5.sol | 0 .../_testing/integration}/ProxyAdmin.sol | 0 .../integration}/TokenBridgeFlatten.sol | 0 .../TransparentUpgradeableProxy.sol | 0 .../mocks/base}/RevertingVerifier.sol | 2 +- .../mocks/base}/TestClaimingCaller.sol | 2 +- .../mocks/base}/TestL1RevertContract.sol | 0 .../mocks/base}/TestReceivingContract.sol | 0 .../mocks/bridging}/MockMessageService.sol | 2 +- .../mocks/bridging}/MockMessageServiceV2.sol | 6 ++--- .../mocks/bridging}/MockTokenBridge.sol | 2 +- .../mocks/bridging}/TestTokenBridge.sol | 2 +- .../mocks/bridging}/UpgradedBridgedToken.sol | 2 +- .../security/reentrancy}/MaliciousERC777.sol | 0 .../reentrancy}/ReentrancyContract.sol | 2 +- .../_testing/mocks/tokens}/ERC20MintBurn.sol | 0 .../mocks/tokens}/ERC20NoNameMintBurn.sol | 0 .../mocks/tokens}/ERC20UnknownDecimals.sol | 0 .../mocks/tokens}/ERC20WeirdNameSymbol.sol | 0 .../_testing/mocks/tokens}/ERCFees.sol | 0 .../_testing/mocks/tokens}/TestERC20.sol | 0 .../_testing/unit}/TestEIP4844.sol | 0 .../_testing/unit}/TestExternalCalls.sol | 0 .../_testing/unit}/TestL1MessageManager.sol | 2 +- .../_testing/unit}/TestL1MessageService.sol | 2 +- .../unit}/TestL1MessageServiceMerkleProof.sol | 4 ++-- .../_testing/unit}/TestL2MessageManager.sol | 4 ++-- .../_testing/unit}/TestL2MessageService.sol | 2 +- .../_testing/unit}/TestLineaRollup.sol | 2 +- .../_testing/unit}/TestLineaRollupV5.sol | 2 +- .../_testing/unit}/TestLineaSurgeXP.sol | 0 .../_testing/unit}/TestMessageServiceBase.sol | 2 +- .../_testing/unit}/TestPauseManager.sol | 2 +- .../TestPlonkVerifierForDataAggregation.sol | 0 .../unit}/TestPublicInputVerifier.sol | 2 +- .../_testing/unit}/TestRateLimiter.sol | 2 +- .../_testing/unit}/TestSetPauseTypeRoles.sol | 2 +- .../unit}/TestSparseMerkleTreeVerifier.sol | 4 ++-- .../_testing/unit}/TestUtils.sol | 2 +- .../bridging/token}/BridgedToken.sol | 0 .../bridging/token}/CustomBridgedToken.sol | 0 .../bridging/token}/TokenBridge.sol | 12 +++++----- .../token}/interfaces/ITokenBridge.sol | 4 ++-- .../bridging/token/utils}/StorageFiller39.sol | 0 .../lib => src/governance}/TimeLock.sol | 0 .../interfaces/IGenericErrors.sol | 0 .../{contracts/lib => src/libraries}/Mimc.sol | 0 .../libraries}/SparseMerkleProof.sol | 0 .../libraries}/TransientStorageHelpers.sol | 0 .../lib => src/libraries}/Utils.sol | 0 .../messaging}/MessageServiceBase.sol | 2 +- .../messaging}/interfaces/IMessageService.sol | 0 .../messaging}/l1/L1MessageManager.sol | 4 ++-- .../messaging}/l1/L1MessageService.sol | 8 +++---- .../l1/interfaces}/IL1MessageManager.sol | 0 .../l1/interfaces}/IL1MessageService.sol | 0 .../messaging}/l1/v1/L1MessageManagerV1.sol | 2 +- .../messaging}/l1/v1/L1MessageServiceV1.sol | 12 +++++----- .../l1/v1/interfaces}/IL1MessageManagerV1.sol | 0 .../messaging}/l2/L2MessageManager.sol | 4 ++-- .../messaging}/l2/L2MessageService.sol | 2 +- .../l2/interfaces}/IL2MessageManager.sol | 0 .../messaging}/l2/v1/L2MessageManagerV1.sol | 4 ++-- .../messaging}/l2/v1/L2MessageServiceV1.sol | 8 +++---- .../l2/v1/interfaces}/IL2MessageManagerV1.sol | 0 .../l2/v1/interfaces}/IL2MessageServiceV1.sol | 0 .../messaging/libraries}/MessageHashing.sol | 0 .../libraries}/SparseMerkleTreeVerifier.sol | 2 +- .../proxies}/CallForwardingProxy.sol | 0 .../tools => src/recovery}/RecoverFunds.sol | 2 +- .../recovery/interfaces}/IRecoverFunds.sol | 0 .../{contracts => src/rollup}/LineaRollup.sol | 8 +++---- .../{contracts => src/rollup}/ZkEvmV2.sol | 6 ++--- .../rollup/interfaces}/ILineaRollup.sol | 4 ++-- .../l1 => src/rollup/interfaces}/IZkEvmV2.sol | 0 .../security/access}/PermissionsManager.sol | 4 ++-- .../interfaces/IPermissionsManager.sol | 0 .../security/limiting}/RateLimiter.sol | 2 +- .../limiting}/interfaces/IRateLimiter.sol | 0 .../pausing}/L2MessageServicePauseManager.sol | 0 .../pausing}/LineaRollupPauseManager.sol | 0 .../security/pausing}/PauseManager.sol | 2 +- .../pausing}/TokenBridgePauseManager.sol | 0 .../pausing}/interfaces/IPauseManager.sol | 0 ...sientStorageReentrancyGuardUpgradeable.sol | 2 +- .../token => src/tokens}/LineaSurgeXP.sol | 0 .../token => src/tokens}/LineaVoyageXP.sol | 0 .../tokens}/TokenMintingRateLimiter.sol | 4 ++-- .../tokens/interfaces}/ITokenMinter.sol | 0 .../interfaces}/ITokenMintingRateLimiter.sol | 0 .../verifiers/PlonkVerifierDev.sol | 0 .../PlonkVerifierForDataAggregation.sol | 0 ...onkVerifierForMultiTypeDataAggregation.sol | 0 .../{contracts => src}/verifiers/Utils.sol | 0 .../verifiers/interfaces}/IPlonkVerifier.sol | 0 contracts/test/LineaRollup.ts | 24 +++++++++---------- .../messageService/l2/L2MessageService.ts | 10 ++++---- contracts/test/tokenBridge/TokenBridge.ts | 4 ++-- 103 files changed, 98 insertions(+), 109 deletions(-) delete mode 100644 contracts/contracts/tools/ProxyAdminReplica.sol rename contracts/{contracts/test-contracts => src/_testing/integration}/IntegrationTestTrueVerifier.sol (78%) rename contracts/{contracts/test-contracts => src/_testing/integration}/L2MessageServiceLineaMainnet.sol (100%) rename contracts/{contracts/test-contracts => src/_testing/integration}/LineaRollupV5.sol (100%) rename contracts/{contracts/proxies => src/_testing/integration}/ProxyAdmin.sol (100%) rename contracts/{contracts/tokenBridge/mocks => src/_testing/integration}/TokenBridgeFlatten.sol (100%) rename contracts/{contracts/proxies => src/_testing/integration}/TransparentUpgradeableProxy.sol (100%) rename contracts/{contracts/test-contracts => src/_testing/mocks/base}/RevertingVerifier.sol (88%) rename contracts/{contracts/test-contracts => src/_testing/mocks/base}/TestClaimingCaller.sol (81%) rename contracts/{contracts/test-contracts => src/_testing/mocks/base}/TestL1RevertContract.sol (100%) rename contracts/{contracts/test-contracts => src/_testing/mocks/base}/TestReceivingContract.sol (100%) rename contracts/{contracts/tokenBridge/mocks => src/_testing/mocks/bridging}/MockMessageService.sol (93%) rename contracts/{contracts/tokenBridge/mocks/MessageBridgeV2 => src/_testing/mocks/bridging}/MockMessageServiceV2.sol (88%) rename contracts/{contracts/tokenBridge/mocks => src/_testing/mocks/bridging}/MockTokenBridge.sol (76%) rename contracts/{contracts/tokenBridge/mocks => src/_testing/mocks/bridging}/TestTokenBridge.sol (77%) rename contracts/{contracts/tokenBridge/mocks => src/_testing/mocks/bridging}/UpgradedBridgedToken.sol (72%) rename contracts/{contracts/tokenBridge/mocks/Reentrancy => src/_testing/mocks/security/reentrancy}/MaliciousERC777.sol (100%) rename contracts/{contracts/tokenBridge/mocks/Reentrancy => src/_testing/mocks/security/reentrancy}/ReentrancyContract.sol (92%) rename contracts/{contracts/tokenBridge/mocks => src/_testing/mocks/tokens}/ERC20MintBurn.sol (100%) rename contracts/{contracts/tokenBridge/mocks => src/_testing/mocks/tokens}/ERC20NoNameMintBurn.sol (100%) rename contracts/{contracts/tokenBridge/mocks => src/_testing/mocks/tokens}/ERC20UnknownDecimals.sol (100%) rename contracts/{contracts/tokenBridge/mocks => src/_testing/mocks/tokens}/ERC20WeirdNameSymbol.sol (100%) rename contracts/{contracts/tokenBridge/mocks => src/_testing/mocks/tokens}/ERCFees.sol (100%) rename contracts/{contracts/tokenBridge/mocks => src/_testing/mocks/tokens}/TestERC20.sol (100%) rename contracts/{contracts/test-contracts => src/_testing/unit}/TestEIP4844.sol (100%) rename contracts/{contracts/test-contracts => src/_testing/unit}/TestExternalCalls.sol (100%) rename contracts/{contracts/test-contracts => src/_testing/unit}/TestL1MessageManager.sol (94%) rename contracts/{contracts/test-contracts => src/_testing/unit}/TestL1MessageService.sol (97%) rename contracts/{contracts/test-contracts => src/_testing/unit}/TestL1MessageServiceMerkleProof.sol (94%) rename contracts/{contracts/test-contracts => src/_testing/unit}/TestL2MessageManager.sol (90%) rename contracts/{contracts/test-contracts => src/_testing/unit}/TestL2MessageService.sol (96%) rename contracts/{contracts/test-contracts => src/_testing/unit}/TestLineaRollup.sol (96%) rename contracts/{contracts/test-contracts => src/_testing/unit}/TestLineaRollupV5.sol (84%) rename contracts/{contracts/test-contracts => src/_testing/unit}/TestLineaSurgeXP.sol (100%) rename contracts/{contracts/test-contracts => src/_testing/unit}/TestMessageServiceBase.sol (90%) rename contracts/{contracts/test-contracts => src/_testing/unit}/TestPauseManager.sol (87%) rename contracts/{contracts/verifiers/test => src/_testing/unit}/TestPlonkVerifierForDataAggregation.sol (100%) rename contracts/{contracts/test-contracts => src/_testing/unit}/TestPublicInputVerifier.sol (85%) rename contracts/{contracts/test-contracts => src/_testing/unit}/TestRateLimiter.sol (91%) rename contracts/{contracts/test-contracts => src/_testing/unit}/TestSetPauseTypeRoles.sol (83%) rename contracts/{contracts/test-contracts => src/_testing/unit}/TestSparseMerkleTreeVerifier.sol (87%) rename contracts/{contracts/test-contracts => src/_testing/unit}/TestUtils.sol (82%) rename contracts/{contracts/tokenBridge => src/bridging/token}/BridgedToken.sol (100%) rename contracts/{contracts/tokenBridge => src/bridging/token}/CustomBridgedToken.sol (100%) rename contracts/{contracts/tokenBridge => src/bridging/token}/TokenBridge.sol (98%) rename contracts/{contracts/tokenBridge => src/bridging/token}/interfaces/ITokenBridge.sol (98%) rename contracts/{contracts/tokenBridge/lib => src/bridging/token/utils}/StorageFiller39.sol (100%) rename contracts/{contracts/messageService/lib => src/governance}/TimeLock.sol (100%) rename contracts/{contracts => src}/interfaces/IGenericErrors.sol (100%) rename contracts/{contracts/lib => src/libraries}/Mimc.sol (100%) rename contracts/{contracts/lib => src/libraries}/SparseMerkleProof.sol (100%) rename contracts/{contracts/messageService/lib => src/libraries}/TransientStorageHelpers.sol (100%) rename contracts/{contracts/lib => src/libraries}/Utils.sol (100%) rename contracts/{contracts/messageService => src/messaging}/MessageServiceBase.sol (97%) rename contracts/{contracts => src/messaging}/interfaces/IMessageService.sol (100%) rename contracts/{contracts/messageService => src/messaging}/l1/L1MessageManager.sol (97%) rename contracts/{contracts/messageService => src/messaging}/l1/L1MessageService.sol (94%) rename contracts/{contracts/interfaces/l1 => src/messaging/l1/interfaces}/IL1MessageManager.sol (100%) rename contracts/{contracts/interfaces/l1 => src/messaging/l1/interfaces}/IL1MessageService.sol (100%) rename contracts/{contracts/messageService => src/messaging}/l1/v1/L1MessageManagerV1.sol (96%) rename contracts/{contracts/messageService => src/messaging}/l1/v1/L1MessageServiceV1.sol (90%) rename contracts/{contracts/interfaces/l1 => src/messaging/l1/v1/interfaces}/IL1MessageManagerV1.sol (100%) rename contracts/{contracts/messageService => src/messaging}/l2/L2MessageManager.sol (96%) rename contracts/{contracts/messageService => src/messaging}/l2/L2MessageService.sol (97%) rename contracts/{contracts/interfaces/l2 => src/messaging/l2/interfaces}/IL2MessageManager.sol (100%) rename contracts/{contracts/messageService => src/messaging}/l2/v1/L2MessageManagerV1.sol (90%) rename contracts/{contracts/messageService => src/messaging}/l2/v1/L2MessageServiceV1.sol (96%) rename contracts/{contracts/interfaces/l2 => src/messaging/l2/v1/interfaces}/IL2MessageManagerV1.sol (100%) rename contracts/{contracts/interfaces/l2 => src/messaging/l2/v1/interfaces}/IL2MessageServiceV1.sol (100%) rename contracts/{contracts/messageService/lib => src/messaging/libraries}/MessageHashing.sol (100%) rename contracts/{contracts/messageService/lib => src/messaging/libraries}/SparseMerkleTreeVerifier.sol (97%) rename contracts/{contracts/lib => src/proxies}/CallForwardingProxy.sol (100%) rename contracts/{contracts/tools => src/recovery}/RecoverFunds.sol (96%) rename contracts/{contracts/interfaces/tools => src/recovery/interfaces}/IRecoverFunds.sol (100%) rename contracts/{contracts => src/rollup}/LineaRollup.sol (99%) rename contracts/{contracts => src/rollup}/ZkEvmV2.sol (93%) rename contracts/{contracts/interfaces/l1 => src/rollup/interfaces}/ILineaRollup.sol (98%) rename contracts/{contracts/interfaces/l1 => src/rollup/interfaces}/IZkEvmV2.sol (100%) rename contracts/{contracts/lib => src/security/access}/PermissionsManager.sol (88%) rename contracts/{contracts => src/security/access}/interfaces/IPermissionsManager.sol (100%) rename contracts/{contracts/messageService/lib => src/security/limiting}/RateLimiter.sol (98%) rename contracts/{contracts => src/security/limiting}/interfaces/IRateLimiter.sol (100%) rename contracts/{contracts/lib => src/security/pausing}/L2MessageServicePauseManager.sol (100%) rename contracts/{contracts/lib => src/security/pausing}/LineaRollupPauseManager.sol (100%) rename contracts/{contracts/lib => src/security/pausing}/PauseManager.sol (98%) rename contracts/{contracts/lib => src/security/pausing}/TokenBridgePauseManager.sol (100%) rename contracts/{contracts => src/security/pausing}/interfaces/IPauseManager.sol (100%) rename contracts/{contracts/messageService/l1 => src/security/reentrancy}/TransientStorageReentrancyGuardUpgradeable.sol (94%) rename contracts/{contracts/token => src/tokens}/LineaSurgeXP.sol (100%) rename contracts/{contracts/token => src/tokens}/LineaVoyageXP.sol (100%) rename contracts/{contracts/token => src/tokens}/TokenMintingRateLimiter.sol (97%) rename contracts/{contracts/token => src/tokens/interfaces}/ITokenMinter.sol (100%) rename contracts/{contracts/token => src/tokens/interfaces}/ITokenMintingRateLimiter.sol (100%) rename contracts/{contracts => src}/verifiers/PlonkVerifierDev.sol (100%) rename contracts/{contracts => src}/verifiers/PlonkVerifierForDataAggregation.sol (100%) rename contracts/{contracts => src}/verifiers/PlonkVerifierForMultiTypeDataAggregation.sol (100%) rename contracts/{contracts => src}/verifiers/Utils.sol (100%) rename contracts/{contracts/interfaces/l1 => src/verifiers/interfaces}/IPlonkVerifier.sol (100%) 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/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 8fdaad00d..71ac5017f 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. 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 88% rename from contracts/contracts/test-contracts/RevertingVerifier.sol rename to contracts/src/_testing/mocks/base/RevertingVerifier.sol index 30653630f..fd165a9c1 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/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 5b8c9c59d..50070df3f 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, @@ -2463,7 +2463,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, @@ -2510,7 +2510,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, }); @@ -2536,7 +2536,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, }); @@ -2558,7 +2558,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, }); @@ -2582,7 +2582,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, }); @@ -2603,7 +2603,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, }); @@ -2623,7 +2623,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, From 3f25b966ad8e2f625d8134caf3ad23f66a6051eb Mon Sep 17 00:00:00 2001 From: VGau Date: Wed, 11 Dec 2024 09:41:32 +0100 Subject: [PATCH 2/3] fix: update contracts documentation --- .../token}/BridgedToken.md | 0 .../token}/CustomBridgedToken.md | 0 .../token}/TokenBridge.md | 0 .../token}/interfaces/ITokenBridge.md | 0 .../token/utils}/StorageFiller39.md | 0 .../lib => governance}/TimeLock.md | 0 .../docs/api/interfaces/l1/IPlonkVerifier.md | 25 ------------------- contracts/docs/api/{lib => libraries}/Mimc.md | 0 .../{lib => libraries}/SparseMerkleProof.md | 0 .../TransientStorageHelpers.md | 0 .../docs/api/{lib => libraries}/Utils.md | 0 .../MessageServiceBase.md | 0 .../interfaces/IMessageService.md | 0 .../l1/L1MessageManager.md | 0 .../l1/L1MessageService.md | 0 .../l1/interfaces}/IL1MessageManager.md | 0 .../l1/interfaces}/IL1MessageService.md | 0 .../l1/v1/L1MessageManagerV1.md | 0 .../l1/v1/L1MessageServiceV1.md | 0 .../l1/v1/interfaces}/IL1MessageManagerV1.md | 0 .../l2/L2MessageManager.md | 0 .../l2/L2MessageService.md | 0 .../l2/interfaces}/IL2MessageManager.md | 0 .../l2/v1/L2MessageManagerV1.md | 0 .../l2/v1/L2MessageServiceV1.md | 0 .../l2/v1/interfaces}/IL2MessageManagerV1.md | 0 .../l2/v1/interfaces}/IL2MessageServiceV1.md | 0 .../libraries}/MessageHashing.md | 0 .../libraries}/SparseMerkleTreeVerifier.md | 0 .../docs/api/{ => rollup}/LineaRollup.md | 0 contracts/docs/api/{ => rollup}/ZkEvmV2.md | 0 .../l1 => rollup/interfaces}/ILineaRollup.md | 0 .../l1 => rollup/interfaces}/IZkEvmV2.md | 0 .../access}/PermissionsManager.md | 0 .../access}/interfaces/IPermissionsManager.md | 0 .../lib => security/limiting}/RateLimiter.md | 0 .../limiting}/interfaces/IRateLimiter.md | 0 .../pausing}/L2MessageServicePauseManager.md | 0 .../pausing}/LineaRollupPauseManager.md | 0 .../{lib => security/pausing}/PauseManager.md | 0 .../pausing}/TokenBridgePauseManager.md | 0 .../pausing}/interfaces/IPauseManager.md | 0 ...nsientStorageReentrancyGuardUpgradeable.md | 0 contracts/hardhat.config.ts | 2 +- 44 files changed, 1 insertion(+), 26 deletions(-) rename contracts/docs/api/{tokenBridge => bridging/token}/BridgedToken.md (100%) rename contracts/docs/api/{tokenBridge => bridging/token}/CustomBridgedToken.md (100%) rename contracts/docs/api/{tokenBridge => bridging/token}/TokenBridge.md (100%) rename contracts/docs/api/{tokenBridge => bridging/token}/interfaces/ITokenBridge.md (100%) rename contracts/docs/api/{tokenBridge/lib => bridging/token/utils}/StorageFiller39.md (100%) rename contracts/docs/api/{messageService/lib => governance}/TimeLock.md (100%) delete mode 100644 contracts/docs/api/interfaces/l1/IPlonkVerifier.md rename contracts/docs/api/{lib => libraries}/Mimc.md (100%) rename contracts/docs/api/{lib => libraries}/SparseMerkleProof.md (100%) rename contracts/docs/api/{messageService/lib => libraries}/TransientStorageHelpers.md (100%) rename contracts/docs/api/{lib => libraries}/Utils.md (100%) rename contracts/docs/api/{messageService => messaging}/MessageServiceBase.md (100%) rename contracts/docs/api/{ => messaging}/interfaces/IMessageService.md (100%) rename contracts/docs/api/{messageService => messaging}/l1/L1MessageManager.md (100%) rename contracts/docs/api/{messageService => messaging}/l1/L1MessageService.md (100%) rename contracts/docs/api/{interfaces/l1 => messaging/l1/interfaces}/IL1MessageManager.md (100%) rename contracts/docs/api/{interfaces/l1 => messaging/l1/interfaces}/IL1MessageService.md (100%) rename contracts/docs/api/{messageService => messaging}/l1/v1/L1MessageManagerV1.md (100%) rename contracts/docs/api/{messageService => messaging}/l1/v1/L1MessageServiceV1.md (100%) rename contracts/docs/api/{interfaces/l1 => messaging/l1/v1/interfaces}/IL1MessageManagerV1.md (100%) rename contracts/docs/api/{messageService => messaging}/l2/L2MessageManager.md (100%) rename contracts/docs/api/{messageService => messaging}/l2/L2MessageService.md (100%) rename contracts/docs/api/{interfaces/l2 => messaging/l2/interfaces}/IL2MessageManager.md (100%) rename contracts/docs/api/{messageService => messaging}/l2/v1/L2MessageManagerV1.md (100%) rename contracts/docs/api/{messageService => messaging}/l2/v1/L2MessageServiceV1.md (100%) rename contracts/docs/api/{interfaces/l2 => messaging/l2/v1/interfaces}/IL2MessageManagerV1.md (100%) rename contracts/docs/api/{interfaces/l2 => messaging/l2/v1/interfaces}/IL2MessageServiceV1.md (100%) rename contracts/docs/api/{messageService/lib => messaging/libraries}/MessageHashing.md (100%) rename contracts/docs/api/{messageService/lib => messaging/libraries}/SparseMerkleTreeVerifier.md (100%) rename contracts/docs/api/{ => rollup}/LineaRollup.md (100%) rename contracts/docs/api/{ => rollup}/ZkEvmV2.md (100%) rename contracts/docs/api/{interfaces/l1 => rollup/interfaces}/ILineaRollup.md (100%) rename contracts/docs/api/{interfaces/l1 => rollup/interfaces}/IZkEvmV2.md (100%) rename contracts/docs/api/{lib => security/access}/PermissionsManager.md (100%) rename contracts/docs/api/{ => security/access}/interfaces/IPermissionsManager.md (100%) rename contracts/docs/api/{messageService/lib => security/limiting}/RateLimiter.md (100%) rename contracts/docs/api/{ => security/limiting}/interfaces/IRateLimiter.md (100%) rename contracts/docs/api/{lib => security/pausing}/L2MessageServicePauseManager.md (100%) rename contracts/docs/api/{lib => security/pausing}/LineaRollupPauseManager.md (100%) rename contracts/docs/api/{lib => security/pausing}/PauseManager.md (100%) rename contracts/docs/api/{lib => security/pausing}/TokenBridgePauseManager.md (100%) rename contracts/docs/api/{ => security/pausing}/interfaces/IPauseManager.md (100%) rename contracts/docs/api/{messageService/l1 => security/reentrancy}/TransientStorageReentrancyGuardUpgradeable.md (100%) diff --git a/contracts/docs/api/tokenBridge/BridgedToken.md b/contracts/docs/api/bridging/token/BridgedToken.md similarity index 100% rename from contracts/docs/api/tokenBridge/BridgedToken.md rename to contracts/docs/api/bridging/token/BridgedToken.md diff --git a/contracts/docs/api/tokenBridge/CustomBridgedToken.md b/contracts/docs/api/bridging/token/CustomBridgedToken.md similarity index 100% rename from contracts/docs/api/tokenBridge/CustomBridgedToken.md rename to contracts/docs/api/bridging/token/CustomBridgedToken.md diff --git a/contracts/docs/api/tokenBridge/TokenBridge.md b/contracts/docs/api/bridging/token/TokenBridge.md similarity index 100% rename from contracts/docs/api/tokenBridge/TokenBridge.md rename to contracts/docs/api/bridging/token/TokenBridge.md diff --git a/contracts/docs/api/tokenBridge/interfaces/ITokenBridge.md b/contracts/docs/api/bridging/token/interfaces/ITokenBridge.md similarity index 100% rename from contracts/docs/api/tokenBridge/interfaces/ITokenBridge.md rename to contracts/docs/api/bridging/token/interfaces/ITokenBridge.md diff --git a/contracts/docs/api/tokenBridge/lib/StorageFiller39.md b/contracts/docs/api/bridging/token/utils/StorageFiller39.md similarity index 100% rename from contracts/docs/api/tokenBridge/lib/StorageFiller39.md rename to contracts/docs/api/bridging/token/utils/StorageFiller39.md diff --git a/contracts/docs/api/messageService/lib/TimeLock.md b/contracts/docs/api/governance/TimeLock.md similarity index 100% rename from contracts/docs/api/messageService/lib/TimeLock.md rename to contracts/docs/api/governance/TimeLock.md diff --git a/contracts/docs/api/interfaces/l1/IPlonkVerifier.md b/contracts/docs/api/interfaces/l1/IPlonkVerifier.md deleted file mode 100644 index 72ed2cd7b..000000000 --- a/contracts/docs/api/interfaces/l1/IPlonkVerifier.md +++ /dev/null @@ -1,25 +0,0 @@ -# Solidity API - -## 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/Mimc.md b/contracts/docs/api/libraries/Mimc.md similarity index 100% rename from contracts/docs/api/lib/Mimc.md rename to contracts/docs/api/libraries/Mimc.md diff --git a/contracts/docs/api/lib/SparseMerkleProof.md b/contracts/docs/api/libraries/SparseMerkleProof.md similarity index 100% rename from contracts/docs/api/lib/SparseMerkleProof.md rename to contracts/docs/api/libraries/SparseMerkleProof.md diff --git a/contracts/docs/api/messageService/lib/TransientStorageHelpers.md b/contracts/docs/api/libraries/TransientStorageHelpers.md similarity index 100% rename from contracts/docs/api/messageService/lib/TransientStorageHelpers.md rename to contracts/docs/api/libraries/TransientStorageHelpers.md diff --git a/contracts/docs/api/lib/Utils.md b/contracts/docs/api/libraries/Utils.md similarity index 100% rename from contracts/docs/api/lib/Utils.md rename to contracts/docs/api/libraries/Utils.md diff --git a/contracts/docs/api/messageService/MessageServiceBase.md b/contracts/docs/api/messaging/MessageServiceBase.md similarity index 100% rename from contracts/docs/api/messageService/MessageServiceBase.md rename to contracts/docs/api/messaging/MessageServiceBase.md diff --git a/contracts/docs/api/interfaces/IMessageService.md b/contracts/docs/api/messaging/interfaces/IMessageService.md similarity index 100% rename from contracts/docs/api/interfaces/IMessageService.md rename to contracts/docs/api/messaging/interfaces/IMessageService.md diff --git a/contracts/docs/api/messageService/l1/L1MessageManager.md b/contracts/docs/api/messaging/l1/L1MessageManager.md similarity index 100% rename from contracts/docs/api/messageService/l1/L1MessageManager.md rename to contracts/docs/api/messaging/l1/L1MessageManager.md diff --git a/contracts/docs/api/messageService/l1/L1MessageService.md b/contracts/docs/api/messaging/l1/L1MessageService.md similarity index 100% rename from contracts/docs/api/messageService/l1/L1MessageService.md rename to contracts/docs/api/messaging/l1/L1MessageService.md diff --git a/contracts/docs/api/interfaces/l1/IL1MessageManager.md b/contracts/docs/api/messaging/l1/interfaces/IL1MessageManager.md similarity index 100% rename from contracts/docs/api/interfaces/l1/IL1MessageManager.md rename to contracts/docs/api/messaging/l1/interfaces/IL1MessageManager.md diff --git a/contracts/docs/api/interfaces/l1/IL1MessageService.md b/contracts/docs/api/messaging/l1/interfaces/IL1MessageService.md similarity index 100% rename from contracts/docs/api/interfaces/l1/IL1MessageService.md rename to contracts/docs/api/messaging/l1/interfaces/IL1MessageService.md diff --git a/contracts/docs/api/messageService/l1/v1/L1MessageManagerV1.md b/contracts/docs/api/messaging/l1/v1/L1MessageManagerV1.md similarity index 100% rename from contracts/docs/api/messageService/l1/v1/L1MessageManagerV1.md rename to contracts/docs/api/messaging/l1/v1/L1MessageManagerV1.md diff --git a/contracts/docs/api/messageService/l1/v1/L1MessageServiceV1.md b/contracts/docs/api/messaging/l1/v1/L1MessageServiceV1.md similarity index 100% rename from contracts/docs/api/messageService/l1/v1/L1MessageServiceV1.md rename to contracts/docs/api/messaging/l1/v1/L1MessageServiceV1.md diff --git a/contracts/docs/api/interfaces/l1/IL1MessageManagerV1.md b/contracts/docs/api/messaging/l1/v1/interfaces/IL1MessageManagerV1.md similarity index 100% rename from contracts/docs/api/interfaces/l1/IL1MessageManagerV1.md rename to contracts/docs/api/messaging/l1/v1/interfaces/IL1MessageManagerV1.md diff --git a/contracts/docs/api/messageService/l2/L2MessageManager.md b/contracts/docs/api/messaging/l2/L2MessageManager.md similarity index 100% rename from contracts/docs/api/messageService/l2/L2MessageManager.md rename to contracts/docs/api/messaging/l2/L2MessageManager.md diff --git a/contracts/docs/api/messageService/l2/L2MessageService.md b/contracts/docs/api/messaging/l2/L2MessageService.md similarity index 100% rename from contracts/docs/api/messageService/l2/L2MessageService.md rename to contracts/docs/api/messaging/l2/L2MessageService.md diff --git a/contracts/docs/api/interfaces/l2/IL2MessageManager.md b/contracts/docs/api/messaging/l2/interfaces/IL2MessageManager.md similarity index 100% rename from contracts/docs/api/interfaces/l2/IL2MessageManager.md rename to contracts/docs/api/messaging/l2/interfaces/IL2MessageManager.md diff --git a/contracts/docs/api/messageService/l2/v1/L2MessageManagerV1.md b/contracts/docs/api/messaging/l2/v1/L2MessageManagerV1.md similarity index 100% rename from contracts/docs/api/messageService/l2/v1/L2MessageManagerV1.md rename to contracts/docs/api/messaging/l2/v1/L2MessageManagerV1.md diff --git a/contracts/docs/api/messageService/l2/v1/L2MessageServiceV1.md b/contracts/docs/api/messaging/l2/v1/L2MessageServiceV1.md similarity index 100% rename from contracts/docs/api/messageService/l2/v1/L2MessageServiceV1.md rename to contracts/docs/api/messaging/l2/v1/L2MessageServiceV1.md diff --git a/contracts/docs/api/interfaces/l2/IL2MessageManagerV1.md b/contracts/docs/api/messaging/l2/v1/interfaces/IL2MessageManagerV1.md similarity index 100% rename from contracts/docs/api/interfaces/l2/IL2MessageManagerV1.md rename to contracts/docs/api/messaging/l2/v1/interfaces/IL2MessageManagerV1.md diff --git a/contracts/docs/api/interfaces/l2/IL2MessageServiceV1.md b/contracts/docs/api/messaging/l2/v1/interfaces/IL2MessageServiceV1.md similarity index 100% rename from contracts/docs/api/interfaces/l2/IL2MessageServiceV1.md rename to contracts/docs/api/messaging/l2/v1/interfaces/IL2MessageServiceV1.md diff --git a/contracts/docs/api/messageService/lib/MessageHashing.md b/contracts/docs/api/messaging/libraries/MessageHashing.md similarity index 100% rename from contracts/docs/api/messageService/lib/MessageHashing.md rename to contracts/docs/api/messaging/libraries/MessageHashing.md diff --git a/contracts/docs/api/messageService/lib/SparseMerkleTreeVerifier.md b/contracts/docs/api/messaging/libraries/SparseMerkleTreeVerifier.md similarity index 100% rename from contracts/docs/api/messageService/lib/SparseMerkleTreeVerifier.md rename to contracts/docs/api/messaging/libraries/SparseMerkleTreeVerifier.md diff --git a/contracts/docs/api/LineaRollup.md b/contracts/docs/api/rollup/LineaRollup.md similarity index 100% rename from contracts/docs/api/LineaRollup.md rename to contracts/docs/api/rollup/LineaRollup.md diff --git a/contracts/docs/api/ZkEvmV2.md b/contracts/docs/api/rollup/ZkEvmV2.md similarity index 100% rename from contracts/docs/api/ZkEvmV2.md rename to contracts/docs/api/rollup/ZkEvmV2.md diff --git a/contracts/docs/api/interfaces/l1/ILineaRollup.md b/contracts/docs/api/rollup/interfaces/ILineaRollup.md similarity index 100% rename from contracts/docs/api/interfaces/l1/ILineaRollup.md rename to contracts/docs/api/rollup/interfaces/ILineaRollup.md diff --git a/contracts/docs/api/interfaces/l1/IZkEvmV2.md b/contracts/docs/api/rollup/interfaces/IZkEvmV2.md similarity index 100% rename from contracts/docs/api/interfaces/l1/IZkEvmV2.md rename to contracts/docs/api/rollup/interfaces/IZkEvmV2.md diff --git a/contracts/docs/api/lib/PermissionsManager.md b/contracts/docs/api/security/access/PermissionsManager.md similarity index 100% rename from contracts/docs/api/lib/PermissionsManager.md rename to contracts/docs/api/security/access/PermissionsManager.md diff --git a/contracts/docs/api/interfaces/IPermissionsManager.md b/contracts/docs/api/security/access/interfaces/IPermissionsManager.md similarity index 100% rename from contracts/docs/api/interfaces/IPermissionsManager.md rename to contracts/docs/api/security/access/interfaces/IPermissionsManager.md diff --git a/contracts/docs/api/messageService/lib/RateLimiter.md b/contracts/docs/api/security/limiting/RateLimiter.md similarity index 100% rename from contracts/docs/api/messageService/lib/RateLimiter.md rename to contracts/docs/api/security/limiting/RateLimiter.md diff --git a/contracts/docs/api/interfaces/IRateLimiter.md b/contracts/docs/api/security/limiting/interfaces/IRateLimiter.md similarity index 100% rename from contracts/docs/api/interfaces/IRateLimiter.md rename to contracts/docs/api/security/limiting/interfaces/IRateLimiter.md diff --git a/contracts/docs/api/lib/L2MessageServicePauseManager.md b/contracts/docs/api/security/pausing/L2MessageServicePauseManager.md similarity index 100% rename from contracts/docs/api/lib/L2MessageServicePauseManager.md rename to contracts/docs/api/security/pausing/L2MessageServicePauseManager.md diff --git a/contracts/docs/api/lib/LineaRollupPauseManager.md b/contracts/docs/api/security/pausing/LineaRollupPauseManager.md similarity index 100% rename from contracts/docs/api/lib/LineaRollupPauseManager.md rename to contracts/docs/api/security/pausing/LineaRollupPauseManager.md diff --git a/contracts/docs/api/lib/PauseManager.md b/contracts/docs/api/security/pausing/PauseManager.md similarity index 100% rename from contracts/docs/api/lib/PauseManager.md rename to contracts/docs/api/security/pausing/PauseManager.md diff --git a/contracts/docs/api/lib/TokenBridgePauseManager.md b/contracts/docs/api/security/pausing/TokenBridgePauseManager.md similarity index 100% rename from contracts/docs/api/lib/TokenBridgePauseManager.md rename to contracts/docs/api/security/pausing/TokenBridgePauseManager.md diff --git a/contracts/docs/api/interfaces/IPauseManager.md b/contracts/docs/api/security/pausing/interfaces/IPauseManager.md similarity index 100% rename from contracts/docs/api/interfaces/IPauseManager.md rename to contracts/docs/api/security/pausing/interfaces/IPauseManager.md diff --git a/contracts/docs/api/messageService/l1/TransientStorageReentrancyGuardUpgradeable.md b/contracts/docs/api/security/reentrancy/TransientStorageReentrancyGuardUpgradeable.md similarity index 100% rename from contracts/docs/api/messageService/l1/TransientStorageReentrancyGuardUpgradeable.md rename to contracts/docs/api/security/reentrancy/TransientStorageReentrancyGuardUpgradeable.md diff --git a/contracts/hardhat.config.ts b/contracts/hardhat.config.ts index 71ac5017f..73245795c 100644 --- a/contracts/hardhat.config.ts +++ b/contracts/hardhat.config.ts @@ -155,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/", }, From 94ba20196de51be1148199b786f696b16d6cf2a8 Mon Sep 17 00:00:00 2001 From: VGau Date: Fri, 20 Dec 2024 13:23:28 +0100 Subject: [PATCH 3/3] fix: regenerate docs --- .../docs/api/bridging/token/BridgedToken.md | 89 --- .../api/bridging/token/CustomBridgedToken.md | 10 - .../docs/api/bridging/token/TokenBridge.md | 523 ------------------ .../bridging/token/interfaces/ITokenBridge.md | 486 ---------------- contracts/docs/api/governance/TimeLock.md | 10 - .../libraries => governance}/TimeLock.mdx | 0 contracts/docs/api/libraries/Mimc.md | 46 -- .../{security/pausing => libraries}/Mimc.mdx | 0 .../docs/api/libraries/SparseMerkleProof.md | 212 ------- .../SparseMerkleProof.mdx | 0 .../api/libraries/TransientStorageHelpers.md | 72 --- .../libraries/TransientStorageHelpers.mdx | 0 contracts/docs/api/libraries/Utils.md | 32 -- .../{security/pausing => libraries}/Utils.mdx | 0 .../docs/api/messaging/MessageServiceBase.md | 105 ---- .../messaging/interfaces/IMessageService.md | 126 ----- .../interfaces/IMessageService.mdx | 0 .../docs/api/messaging/l1/L1MessageManager.md | 111 ---- .../docs/api/messaging/l1/L1MessageService.md | 77 --- .../l1/interfaces/IL1MessageManager.md | 95 ---- .../l1/interfaces}/IL1MessageManager.mdx | 0 .../l1/interfaces/IL1MessageService.md | 65 --- .../l1/interfaces}/IL1MessageService.mdx | 0 .../api/messaging/l1/v1/L1MessageManagerV1.md | 71 --- .../api/messaging/l1/v1/L1MessageServiceV1.md | 81 --- .../l1/v1/interfaces/IL1MessageManagerV1.md | 10 - .../l1/v1/interfaces}/IL1MessageManagerV1.mdx | 0 .../docs/api/messaging/l2/L2MessageManager.md | 48 -- .../docs/api/messaging/l2/L2MessageService.md | 53 -- .../l2/interfaces/IL2MessageManager.md | 89 --- .../{v1 => }/interfaces/IL2MessageManager.mdx | 0 .../api/messaging/l2/v1/L2MessageManagerV1.md | 45 -- .../api/messaging/l2/v1/L2MessageServiceV1.md | 138 ----- .../l2/v1/interfaces/IL2MessageManagerV1.md | 48 -- .../l2/v1/interfaces/IL2MessageServiceV1.md | 18 - .../api/messaging/libraries/MessageHashing.md | 24 - .../libraries/SparseMerkleTreeVerifier.md | 66 --- contracts/docs/api/rollup/LineaRollup.md | 466 ---------------- .../docs/api/{ => rollup}/LineaRollup.mdx | 0 contracts/docs/api/rollup/ZkEvmV2.md | 64 --- contracts/docs/api/{ => rollup}/ZkEvmV2.mdx | 0 .../api/rollup/interfaces/ILineaRollup.md | 505 ----------------- .../l1 => rollup/interfaces}/ILineaRollup.mdx | 0 .../docs/api/rollup/interfaces/IZkEvmV2.md | 42 -- .../l1 => rollup/interfaces}/IZkEvmV2.mdx | 0 .../api/security/access/PermissionsManager.md | 16 - .../PermissionsManager.mdx | 0 .../access/interfaces/IPermissionsManager.md | 11 - .../interfaces/IPermissionsManager.mdx | 0 .../docs/api/security/limiting/RateLimiter.md | 111 ---- .../limiting}/RateLimiter.mdx | 0 .../limiting/interfaces/IRateLimiter.md | 106 ---- .../limiting}/interfaces/IRateLimiter.mdx | 0 .../security/pausing/CallForwardingProxy.mdx | 24 - .../pausing/L2MessageServicePauseManager.md | 34 -- .../pausing/LineaRollupPauseManager.md | 66 --- .../docs/api/security/pausing/PauseManager.md | 151 ----- .../pausing/TokenBridgePauseManager.md | 26 - .../pausing/interfaces/IPauseManager.md | 155 ------ .../pausing}/interfaces/IPauseManager.mdx | 0 ...nsientStorageReentrancyGuardUpgradeable.md | 14 - ...sientStorageReentrancyGuardUpgradeable.mdx | 0 62 files changed, 4541 deletions(-) delete mode 100644 contracts/docs/api/bridging/token/BridgedToken.md delete mode 100644 contracts/docs/api/bridging/token/CustomBridgedToken.md delete mode 100644 contracts/docs/api/bridging/token/TokenBridge.md delete mode 100644 contracts/docs/api/bridging/token/interfaces/ITokenBridge.md delete mode 100644 contracts/docs/api/governance/TimeLock.md rename contracts/docs/api/{messaging/libraries => governance}/TimeLock.mdx (100%) delete mode 100644 contracts/docs/api/libraries/Mimc.md rename contracts/docs/api/{security/pausing => libraries}/Mimc.mdx (100%) delete mode 100644 contracts/docs/api/libraries/SparseMerkleProof.md rename contracts/docs/api/{security/pausing => libraries}/SparseMerkleProof.mdx (100%) delete mode 100644 contracts/docs/api/libraries/TransientStorageHelpers.md rename contracts/docs/api/{messaging => }/libraries/TransientStorageHelpers.mdx (100%) delete mode 100644 contracts/docs/api/libraries/Utils.md rename contracts/docs/api/{security/pausing => libraries}/Utils.mdx (100%) delete mode 100644 contracts/docs/api/messaging/MessageServiceBase.md delete mode 100644 contracts/docs/api/messaging/interfaces/IMessageService.md rename contracts/docs/api/{ => messaging}/interfaces/IMessageService.mdx (100%) delete mode 100644 contracts/docs/api/messaging/l1/L1MessageManager.md delete mode 100644 contracts/docs/api/messaging/l1/L1MessageService.md delete mode 100644 contracts/docs/api/messaging/l1/interfaces/IL1MessageManager.md rename contracts/docs/api/{interfaces/l1 => messaging/l1/interfaces}/IL1MessageManager.mdx (100%) delete mode 100644 contracts/docs/api/messaging/l1/interfaces/IL1MessageService.md rename contracts/docs/api/{interfaces/l1 => messaging/l1/interfaces}/IL1MessageService.mdx (100%) delete mode 100644 contracts/docs/api/messaging/l1/v1/L1MessageManagerV1.md delete mode 100644 contracts/docs/api/messaging/l1/v1/L1MessageServiceV1.md delete mode 100644 contracts/docs/api/messaging/l1/v1/interfaces/IL1MessageManagerV1.md rename contracts/docs/api/{interfaces/l1 => messaging/l1/v1/interfaces}/IL1MessageManagerV1.mdx (100%) delete mode 100644 contracts/docs/api/messaging/l2/L2MessageManager.md delete mode 100644 contracts/docs/api/messaging/l2/L2MessageService.md delete mode 100644 contracts/docs/api/messaging/l2/interfaces/IL2MessageManager.md rename contracts/docs/api/messaging/l2/{v1 => }/interfaces/IL2MessageManager.mdx (100%) delete mode 100644 contracts/docs/api/messaging/l2/v1/L2MessageManagerV1.md delete mode 100644 contracts/docs/api/messaging/l2/v1/L2MessageServiceV1.md delete mode 100644 contracts/docs/api/messaging/l2/v1/interfaces/IL2MessageManagerV1.md delete mode 100644 contracts/docs/api/messaging/l2/v1/interfaces/IL2MessageServiceV1.md delete mode 100644 contracts/docs/api/messaging/libraries/MessageHashing.md delete mode 100644 contracts/docs/api/messaging/libraries/SparseMerkleTreeVerifier.md delete mode 100644 contracts/docs/api/rollup/LineaRollup.md rename contracts/docs/api/{ => rollup}/LineaRollup.mdx (100%) delete mode 100644 contracts/docs/api/rollup/ZkEvmV2.md rename contracts/docs/api/{ => rollup}/ZkEvmV2.mdx (100%) delete mode 100644 contracts/docs/api/rollup/interfaces/ILineaRollup.md rename contracts/docs/api/{interfaces/l1 => rollup/interfaces}/ILineaRollup.mdx (100%) delete mode 100644 contracts/docs/api/rollup/interfaces/IZkEvmV2.md rename contracts/docs/api/{interfaces/l1 => rollup/interfaces}/IZkEvmV2.mdx (100%) delete mode 100644 contracts/docs/api/security/access/PermissionsManager.md rename contracts/docs/api/security/{pausing => access}/PermissionsManager.mdx (100%) delete mode 100644 contracts/docs/api/security/access/interfaces/IPermissionsManager.md rename contracts/docs/api/{ => security/access}/interfaces/IPermissionsManager.mdx (100%) delete mode 100644 contracts/docs/api/security/limiting/RateLimiter.md rename contracts/docs/api/{messaging/libraries => security/limiting}/RateLimiter.mdx (100%) delete mode 100644 contracts/docs/api/security/limiting/interfaces/IRateLimiter.md rename contracts/docs/api/{ => security/limiting}/interfaces/IRateLimiter.mdx (100%) delete mode 100644 contracts/docs/api/security/pausing/CallForwardingProxy.mdx delete mode 100644 contracts/docs/api/security/pausing/L2MessageServicePauseManager.md delete mode 100644 contracts/docs/api/security/pausing/LineaRollupPauseManager.md delete mode 100644 contracts/docs/api/security/pausing/PauseManager.md delete mode 100644 contracts/docs/api/security/pausing/TokenBridgePauseManager.md delete mode 100644 contracts/docs/api/security/pausing/interfaces/IPauseManager.md rename contracts/docs/api/{ => security/pausing}/interfaces/IPauseManager.mdx (100%) delete mode 100644 contracts/docs/api/security/reentrancy/TransientStorageReentrancyGuardUpgradeable.md rename contracts/docs/api/{messaging/l1 => security/reentrancy}/TransientStorageReentrancyGuardUpgradeable.mdx (100%) diff --git a/contracts/docs/api/bridging/token/BridgedToken.md b/contracts/docs/api/bridging/token/BridgedToken.md deleted file mode 100644 index 8f7c4d585..000000000 --- a/contracts/docs/api/bridging/token/BridgedToken.md +++ /dev/null @@ -1,89 +0,0 @@ -# `BridgedToken` - -ERC20 token created when a native token is bridged to a target chain. - -### bridge - -```solidity -address bridge -``` - -### _decimals - -```solidity -uint8 _decimals -``` - -### OnlyBridge - -```solidity -error OnlyBridge(address bridgeAddress) -``` - -### constructor - -```solidity -constructor() public -``` - -_Disable constructor for safety_ - -### initialize - -```solidity -function initialize(string _tokenName, string _tokenSymbol, uint8 _tokenDecimals) external -``` - -### onlyBridge - -```solidity -modifier onlyBridge() -``` - -_Ensures call come from the bridge._ - -### mint - -```solidity -function mint(address _recipient, uint256 _amount) external -``` - -_Called by the bridge to mint tokens during a bridge transaction._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _recipient | address | The address to receive the minted tokens. | -| _amount | uint256 | The amount of tokens to mint. | - -### burn - -```solidity -function burn(address _account, uint256 _amount) external -``` - -_Called by the bridge to burn tokens during a bridge transaction. -User should first have allowed the bridge to spend tokens on their behalf._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _account | address | The account from which tokens will be burned. | -| _amount | uint256 | The amount of tokens to burn. | - -### decimals - -```solidity -function decimals() public view returns (uint8) -``` - -_Overrides ERC20 default function to support tokens with different decimals._ - -#### Return Values - -| Name | Type | Description | -| ---- | ---- | ----------- | -| [0] | uint8 | The number of decimal. | - diff --git a/contracts/docs/api/bridging/token/CustomBridgedToken.md b/contracts/docs/api/bridging/token/CustomBridgedToken.md deleted file mode 100644 index eef9c2b58..000000000 --- a/contracts/docs/api/bridging/token/CustomBridgedToken.md +++ /dev/null @@ -1,10 +0,0 @@ -# `CustomBridgedToken` - -Custom ERC20 token manually deployed for the Linea TokenBridge. - -### initializeV2 - -```solidity -function initializeV2(string _tokenName, string _tokenSymbol, uint8 _tokenDecimals, address _bridge) public -``` - diff --git a/contracts/docs/api/bridging/token/TokenBridge.md b/contracts/docs/api/bridging/token/TokenBridge.md deleted file mode 100644 index f333b32e7..000000000 --- a/contracts/docs/api/bridging/token/TokenBridge.md +++ /dev/null @@ -1,523 +0,0 @@ -# `TokenBridge` - -Contract to manage cross-chain ERC20 bridging. - -### CONTRACT_VERSION - -```solidity -string CONTRACT_VERSION -``` - -_This is the ABI version and not the reinitialize version._ - -### SET_MESSAGE_SERVICE_ROLE - -```solidity -bytes32 SET_MESSAGE_SERVICE_ROLE -``` - -Role used for setting the message service address. - -### SET_REMOTE_TOKENBRIDGE_ROLE - -```solidity -bytes32 SET_REMOTE_TOKENBRIDGE_ROLE -``` - -Role used for setting the remote token bridge address. - -### SET_RESERVED_TOKEN_ROLE - -```solidity -bytes32 SET_RESERVED_TOKEN_ROLE -``` - -Role used for setting a reserved token address. - -### REMOVE_RESERVED_TOKEN_ROLE - -```solidity -bytes32 REMOVE_RESERVED_TOKEN_ROLE -``` - -Role used for removing a reserved token address. - -### SET_CUSTOM_CONTRACT_ROLE - -```solidity -bytes32 SET_CUSTOM_CONTRACT_ROLE -``` - -Role used for setting a custom token contract address. - -### EMPTY - -```solidity -address EMPTY -``` - -EMPTY means a token is not present in the mapping. - -### RESERVED_STATUS - -```solidity -address RESERVED_STATUS -``` - -RESERVED means a token is reserved and cannot be bridged. - -### NATIVE_STATUS - -```solidity -address NATIVE_STATUS -``` - -NATIVE means a token is native to the current local chain. - -### DEPLOYED_STATUS - -```solidity -address DEPLOYED_STATUS -``` - -DEPLOYED means the bridged token contract has been deployed on the remote chain. - -### _PERMIT_SELECTOR - -```solidity -bytes4 _PERMIT_SELECTOR -``` - -_The permit selector to be used when decoding the permit._ - -### tokenBeacon - -```solidity -address tokenBeacon -``` - -The token beacon for deployed tokens. - -### nativeToBridgedToken - -```solidity -mapping(uint256 => mapping(address => address)) nativeToBridgedToken -``` - -The chainId mapped to a native token address which is then mapped to the bridged token address. - -### bridgedToNativeToken - -```solidity -mapping(address => address) bridgedToNativeToken -``` - -The bridged token address mapped to the native token address. - -### sourceChainId - -```solidity -uint256 sourceChainId -``` - -The current layer's chainId from where the bridging is triggered. - -### targetChainId - -```solidity -uint256 targetChainId -``` - -The targeted layer's chainId where the bridging is received. - -### isNewToken - -```solidity -modifier isNewToken(address _token) -``` - -_Ensures the token has not been bridged before._ - -### nonZeroAddress - -```solidity -modifier nonZeroAddress(address _addr) -``` - -_Ensures the address is not address(0)._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _addr | address | Address to check. | - -### nonZeroAmount - -```solidity -modifier nonZeroAmount(uint256 _amount) -``` - -_Ensures the amount is not 0._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _amount | uint256 | amount to check. | - -### constructor - -```solidity -constructor() public -``` - -_Disable constructor for safety_ - -### initialize - -```solidity -function initialize(struct ITokenBridge.InitializationData _initializationData) external -``` - -Initializes TokenBridge and underlying service dependencies - used for new networks only. - -_Contract will be used as proxy implementation._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _initializationData | struct ITokenBridge.InitializationData | The initial data used for initializing the TokenBridge contract. | - -### reinitializePauseTypesAndPermissions - -```solidity -function reinitializePauseTypesAndPermissions(address _defaultAdmin, struct IPermissionsManager.RoleAddress[] _roleAddresses, struct IPauseManager.PauseTypeRole[] _pauseTypeRoles, struct IPauseManager.PauseTypeRole[] _unpauseTypeRoles) external -``` - -Sets permissions for a list of addresses and their roles as well as initialises the PauseManager pauseType:role mappings. - -_This function is a reinitializer and can only be called once per version. Should be called using an upgradeAndCall transaction to the ProxyAdmin._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _defaultAdmin | address | The default admin account's address. | -| _roleAddresses | struct IPermissionsManager.RoleAddress[] | The list of addresses and roles to assign permissions to. | -| _pauseTypeRoles | struct IPauseManager.PauseTypeRole[] | The list of pause types to associate with roles. | -| _unpauseTypeRoles | struct IPauseManager.PauseTypeRole[] | The list of unpause types to associate with roles. | - -### bridgeToken - -```solidity -function bridgeToken(address _token, uint256 _amount, address _recipient) public payable -``` - -This function is the single entry point to bridge tokens to the - other chain, both for native and already bridged tokens. You can use it - to bridge any ERC20. If the token is bridged for the first time an ERC20 - (BridgedToken.sol) will be automatically deployed on the target chain. - -_User should first allow the bridge to transfer tokens on his behalf. - Alternatively, you can use BridgeTokenWithPermit to do so in a single - transaction. If you want the transfer to be automatically executed on the - destination chain. You should send enough ETH to pay the postman fees. - Note that Linea can reserve some tokens (which use a dedicated bridge). - In this case, the token cannot be bridged. Linea can only reserve tokens - that have not been bridged yet. - Linea can pause the bridge for security reason. In this case new bridge - transaction would revert. -Note: If, when bridging an unbridged token and decimals are unknown, -the call will revert to prevent mismatched decimals. Only those ERC20s, -with a decimals function are supported._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _token | address | The address of the token to be bridged. | -| _amount | uint256 | The amount of the token to be bridged. | -| _recipient | address | The address that will receive the tokens on the other chain. | - -### bridgeTokenWithPermit - -```solidity -function bridgeTokenWithPermit(address _token, uint256 _amount, address _recipient, bytes _permitData) external payable -``` - -Similar to `bridgeToken` function but allows to pass additional - permit data to do the ERC20 approval in a single transaction. -_permit can fail silently, don't rely on this function passing as a form - of authentication - -_There is no need for validation at this level as the validation on pausing, -and empty values exists on the "bridgeToken" call._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _token | address | The address of the token to be bridged. | -| _amount | uint256 | The amount of the token to be bridged. | -| _recipient | address | The address that will receive the tokens on the other chain. | -| _permitData | bytes | The permit data for the token, if applicable. | - -### completeBridging - -```solidity -function completeBridging(address _nativeToken, uint256 _amount, address _recipient, uint256 _chainId, bytes _tokenMetadata) external -``` - -_It can only be called from the Message Service. To finalize the bridging - process, a user or postman needs to use the `claimMessage` function of the - Message Service to trigger the transaction._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _nativeToken | address | The address of the token on its native chain. | -| _amount | uint256 | The amount of the token to be received. | -| _recipient | address | The address that will receive the tokens. | -| _chainId | uint256 | The token's origin layer chaindId | -| _tokenMetadata | bytes | Additional data used to deploy the bridged token if it doesn't exist already. | - -### setMessageService - -```solidity -function setMessageService(address _messageService) external -``` - -_Change the address of the Message Service. -SET_MESSAGE_SERVICE_ROLE is required to execute._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _messageService | address | The address of the new Message Service. | - -### confirmDeployment - -```solidity -function confirmDeployment(address[] _tokens) external payable -``` - -_Change the status to DEPLOYED to the tokens passed in parameter - Will call the method setDeployed on the other chain using the message Service_ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _tokens | address[] | Array of bridged tokens that have been deployed. | - -### setDeployed - -```solidity -function setDeployed(address[] _nativeTokens) external -``` - -_Change the status of tokens to DEPLOYED. New bridge transaction will not - contain token metadata, which save gas. - Can only be called from the Message Service. A user or postman needs to use - the `claimMessage` function of the Message Service to trigger the transaction._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _nativeTokens | address[] | Array of native tokens for which the DEPLOYED status must be set. | - -### setRemoteTokenBridge - -```solidity -function setRemoteTokenBridge(address _remoteTokenBridge) external -``` - -_Sets the address of the remote token bridge. Can only be called once. -SET_REMOTE_TOKENBRIDGE_ROLE is required to execute._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _remoteTokenBridge | address | The address of the remote token bridge to be set. | - -### deployBridgedToken - -```solidity -function deployBridgedToken(address _nativeToken, bytes _tokenMetadata, uint256 _chainId) internal returns (address bridgedTokenAddress) -``` - -_Deploy a new EC20 contract for bridged token using a beacon proxy pattern. - To adapt to future requirements, Linea can update the implementation of - all (existing and future) contracts by updating the beacon. This update is - subject to a delay by a time lock. - Contracts are deployed using CREATE2 so deployment address is deterministic._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _nativeToken | address | The address of the native token on the source chain. | -| _tokenMetadata | bytes | The encoded metadata for the token. | -| _chainId | uint256 | The chain id on which the token will be deployed, used to calculate the salt | - -#### Return Values - -| Name | Type | Description | -| ---- | ---- | ----------- | -| bridgedTokenAddress | address | The address of the newly deployed BridgedToken contract. | - -### setReserved - -```solidity -function setReserved(address _token) external -``` - -Make sure that _token is native to the current chain - where you are calling this function from - -_Linea can reserve tokens. In this case, the token cannot be bridged. - Linea can only reserve tokens that have not been bridged before. -SET_RESERVED_TOKEN_ROLE is required to execute._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _token | address | The address of the token to be set as reserved. | - -### removeReserved - -```solidity -function removeReserved(address _token) external -``` - -_Removes a token from the reserved list. -REMOVE_RESERVED_TOKEN_ROLE is required to execute._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _token | address | The address of the token to be removed from the reserved list. | - -### setCustomContract - -```solidity -function setCustomContract(address _nativeToken, address _targetContract) external -``` - -_Linea can set a custom ERC20 contract for specific ERC20. - For security purpose, Linea can only call this function if the token has - not been bridged yet. -SET_CUSTOM_CONTRACT_ROLE is required to execute._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _nativeToken | address | The address of the token on the source chain. | -| _targetContract | address | The address of the custom contract. | - -### _safeName - -```solidity -function _safeName(address _token) internal view returns (string tokenName) -``` - -_Provides a safe ERC20.name version which returns 'NO_NAME' as fallback string._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _token | address | The address of the ERC-20 token contract | - -#### Return Values - -| Name | Type | Description | -| ---- | ---- | ----------- | -| tokenName | string | Returns the string of the token name. | - -### _safeSymbol - -```solidity -function _safeSymbol(address _token) internal view returns (string symbol) -``` - -_Provides a safe ERC20.symbol version which returns 'NO_SYMBOL' as fallback string_ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _token | address | The address of the ERC-20 token contract | - -#### Return Values - -| Name | Type | Description | -| ---- | ---- | ----------- | -| symbol | string | Returns the string of the symbol. | - -### _safeDecimals - -```solidity -function _safeDecimals(address _token) internal view returns (uint8) -``` - -Provides a safe ERC20.decimals version which reverts when decimals are unknown - Note Tokens with (decimals > 255) are not supported - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _token | address | The address of the ERC-20 token contract | - -#### Return Values - -| Name | Type | Description | -| ---- | ---- | ----------- | -| [0] | uint8 | Returns the token's decimals value. | - -### _returnDataToString - -```solidity -function _returnDataToString(bytes _data) internal pure returns (string decodedString) -``` - -_Converts returned data to string. Returns 'NOT_VALID_ENCODING' as fallback value._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _data | bytes | returned data. | - -#### Return Values - -| Name | Type | Description | -| ---- | ---- | ----------- | -| decodedString | string | The decoded string data. | - -### _permit - -```solidity -function _permit(address _token, bytes _permitData) internal -``` - -Call the token permit method of extended ERC20 -Only support tokens implementing ERC-2612 - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _token | address | ERC20 token address | -| _permitData | bytes | Raw data of the call `permit` of the token | - diff --git a/contracts/docs/api/bridging/token/interfaces/ITokenBridge.md b/contracts/docs/api/bridging/token/interfaces/ITokenBridge.md deleted file mode 100644 index 2225d9481..000000000 --- a/contracts/docs/api/bridging/token/interfaces/ITokenBridge.md +++ /dev/null @@ -1,486 +0,0 @@ -# `ITokenBridge` - -### InitializationData - -```solidity -struct InitializationData { - address defaultAdmin; - address messageService; - address tokenBeacon; - uint256 sourceChainId; - uint256 targetChainId; - address[] reservedTokens; - struct IPermissionsManager.RoleAddress[] roleAddresses; - struct IPauseManager.PauseTypeRole[] pauseTypeRoles; - struct IPauseManager.PauseTypeRole[] unpauseTypeRoles; -} -``` - -### TokenReserved - -```solidity -event TokenReserved(address token) -``` - -Emitted when the token address is reserved. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| token | address | The indexed token address. | - -### ReservationRemoved - -```solidity -event ReservationRemoved(address token) -``` - -Emitted when the token address reservation is removed. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| token | address | The indexed token address. | - -### CustomContractSet - -```solidity -event CustomContractSet(address nativeToken, address customContract, address setBy) -``` - -Emitted when the custom token address is set. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| nativeToken | address | The indexed nativeToken token address. | -| customContract | address | The indexed custom contract address. | -| setBy | address | The indexed address of who set the custom contract. | - -### BridgingInitiated - -```solidity -event BridgingInitiated(address sender, address recipient, address token, uint256 amount) -``` - -Emitted when token bridging is initiated. - -_DEPRECATED in favor of BridgingInitiatedV2._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| sender | address | The indexed sender address. | -| recipient | address | The recipient address. | -| token | address | The indexed token address. | -| amount | uint256 | The indexed token amount. | - -### BridgingInitiatedV2 - -```solidity -event BridgingInitiatedV2(address sender, address recipient, address token, uint256 amount) -``` - -Emitted when token bridging is initiated. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| sender | address | The indexed sender address. | -| recipient | address | The indexed recipient address. | -| token | address | The indexed token address. | -| amount | uint256 | The token amount. | - -### BridgingFinalized - -```solidity -event BridgingFinalized(address nativeToken, address bridgedToken, uint256 amount, address recipient) -``` - -Emitted when token bridging is finalized. - -_DEPRECATED in favor of BridgingFinalizedV2._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| nativeToken | address | The indexed native token address. | -| bridgedToken | address | The indexed bridged token address. | -| amount | uint256 | The indexed token amount. | -| recipient | address | The recipient address. | - -### BridgingFinalizedV2 - -```solidity -event BridgingFinalizedV2(address nativeToken, address bridgedToken, uint256 amount, address recipient) -``` - -Emitted when token bridging is finalized. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| nativeToken | address | The indexed native token address. | -| bridgedToken | address | The indexed bridged token address. | -| amount | uint256 | The token amount. | -| recipient | address | The indexed recipient address. | - -### NewToken - -```solidity -event NewToken(address token) -``` - -Emitted when a new token is seen being bridged on the origin chain for the first time. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| token | address | The indexed token address. | - -### NewTokenDeployed - -```solidity -event NewTokenDeployed(address bridgedToken, address nativeToken) -``` - -Emitted when a new token is deployed. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| bridgedToken | address | The indexed bridged token address. | -| nativeToken | address | The indexed native token address. | - -### RemoteTokenBridgeSet - -```solidity -event RemoteTokenBridgeSet(address remoteTokenBridge, address setBy) -``` - -Emitted when the remote token bridge is set. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| remoteTokenBridge | address | The indexed remote token bridge address. | -| setBy | address | The indexed address that set the remote token bridge. | - -### TokenDeployed - -```solidity -event TokenDeployed(address token) -``` - -Emitted when the token is set as deployed. - -_This can be triggered by anyone calling confirmDeployment on the alternate chain._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| token | address | The indexed token address. | - -### DeploymentConfirmed - -```solidity -event DeploymentConfirmed(address[] tokens, address confirmedBy) -``` - -Emitted when the token deployment is confirmed. - -_This can be triggered by anyone provided there is correctly mapped token data._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| tokens | address[] | The token address list. | -| confirmedBy | address | The indexed address confirming deployment. | - -### MessageServiceUpdated - -```solidity -event MessageServiceUpdated(address newMessageService, address oldMessageService, address setBy) -``` - -Emitted when the message service address is set. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| newMessageService | address | The indexed new message service address. | -| oldMessageService | address | The indexed old message service address. | -| setBy | address | The indexed address setting the new message service address. | - -### ReservedToken - -```solidity -error ReservedToken(address token) -``` - -_Thrown when attempting to bridge a reserved token._ - -### RemoteTokenBridgeAlreadySet - -```solidity -error RemoteTokenBridgeAlreadySet(address remoteTokenBridge) -``` - -_Thrown when the remote token bridge is already set._ - -### AlreadyBridgedToken - -```solidity -error AlreadyBridgedToken(address token) -``` - -_Thrown when attempting to reserve an already bridged token._ - -### InvalidPermitData - -```solidity -error InvalidPermitData(bytes4 permitData, bytes4 permitSelector) -``` - -_Thrown when the permit data is invalid._ - -### PermitNotFromSender - -```solidity -error PermitNotFromSender(address owner) -``` - -_Thrown when the permit is not from the sender._ - -### PermitNotAllowingBridge - -```solidity -error PermitNotAllowingBridge(address spender) -``` - -_Thrown when the permit does not grant spending to the bridge._ - -### ZeroAmountNotAllowed - -```solidity -error ZeroAmountNotAllowed(uint256 amount) -``` - -_Thrown when the amount being bridged is zero._ - -### NotReserved - -```solidity -error NotReserved(address token) -``` - -_Thrown when trying to unreserve a non-reserved token._ - -### TokenNotDeployed - -```solidity -error TokenNotDeployed(address token) -``` - -_Thrown when trying to confirm deployment of a non-deployed token._ - -### AlreadyBrigedToNativeTokenSet - -```solidity -error AlreadyBrigedToNativeTokenSet(address token) -``` - -_Thrown when trying to set a custom contract on a bridged token._ - -### NativeToBridgedTokenAlreadySet - -```solidity -error NativeToBridgedTokenAlreadySet(address token) -``` - -_Thrown when trying to set a custom contract on an already set token._ - -### StatusAddressNotAllowed - -```solidity -error StatusAddressNotAllowed(address token) -``` - -_Thrown when trying to set a token that is already either native, deployed or reserved._ - -### DecimalsAreUnknown - -```solidity -error DecimalsAreUnknown(address token) -``` - -_Thrown when the decimals for a token cannot be determined._ - -### TokenListEmpty - -```solidity -error TokenListEmpty() -``` - -_Thrown when the token list is empty._ - -### bridgeTokenWithPermit - -```solidity -function bridgeTokenWithPermit(address _token, uint256 _amount, address _recipient, bytes _permitData) external payable -``` - -Similar to `bridgeToken` function but allows to pass additional - permit data to do the ERC20 approval in a single transaction. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _token | address | The address of the token to be bridged. | -| _amount | uint256 | The amount of the token to be bridged. | -| _recipient | address | The address that will receive the tokens on the other chain. | -| _permitData | bytes | The permit data for the token, if applicable. | - -### completeBridging - -```solidity -function completeBridging(address _nativeToken, uint256 _amount, address _recipient, uint256 _chainId, bytes _tokenMetadata) external -``` - -_It can only be called from the Message Service. To finalize the bridging - process, a user or postmen needs to use the `claimMessage` function of the - Message Service to trigger the transaction._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _nativeToken | address | The address of the token on its native chain. | -| _amount | uint256 | The amount of the token to be received. | -| _recipient | address | The address that will receive the tokens. | -| _chainId | uint256 | The source chainId or target chaindId for this token | -| _tokenMetadata | bytes | Additional data used to deploy the bridged token if it doesn't exist already. | - -### confirmDeployment - -```solidity -function confirmDeployment(address[] _tokens) external payable -``` - -_Change the status to DEPLOYED to the tokens passed in parameter - Will call the method setDeployed on the other chain using the message Service_ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _tokens | address[] | Array of bridged tokens that have been deployed. | - -### setMessageService - -```solidity -function setMessageService(address _messageService) external -``` - -_Change the address of the Message Service._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _messageService | address | The address of the new Message Service. | - -### setDeployed - -```solidity -function setDeployed(address[] _nativeTokens) external -``` - -_It can only be called from the Message Service. To change the status of - the native tokens to DEPLOYED meaning they have been deployed on the other chain - a user or postman needs to use the `claimMessage` function of the - Message Service to trigger the transaction._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _nativeTokens | address[] | The addresses of the native tokens. | - -### setReserved - -```solidity -function setReserved(address _token) external -``` - -Make sure that _token is native to the current chain - where you are calling this function from - -_Linea can reserve tokens. In this case, the token cannot be bridged. - Linea can only reserve tokens that have not been bridged before._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _token | address | The address of the token to be set as reserved. | - -### setRemoteTokenBridge - -```solidity -function setRemoteTokenBridge(address _remoteTokenBridge) external -``` - -_Sets the address of the remote token bridge. Can only be called once._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _remoteTokenBridge | address | The address of the remote token bridge to be set. | - -### removeReserved - -```solidity -function removeReserved(address _token) external -``` - -_Removes a token from the reserved list._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _token | address | The address of the token to be removed from the reserved list. | - -### setCustomContract - -```solidity -function setCustomContract(address _nativeToken, address _targetContract) external -``` - -_Linea can set a custom ERC20 contract for specific ERC20. - For security purpose, Linea can only call this function if the token has - not been bridged yet._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _nativeToken | address | address of the token on the source chain. | -| _targetContract | address | address of the custom contract. | - diff --git a/contracts/docs/api/governance/TimeLock.md b/contracts/docs/api/governance/TimeLock.md deleted file mode 100644 index 203043933..000000000 --- a/contracts/docs/api/governance/TimeLock.md +++ /dev/null @@ -1,10 +0,0 @@ -# `TimeLock` - -This timelock contract will be the owner of all upgrades that gives users confidence and an ability to exit should they want to before an upgrade takes place - -### constructor - -```solidity -constructor(uint256 minDelay, address[] proposers, address[] executors, address admin) public -``` - diff --git a/contracts/docs/api/messaging/libraries/TimeLock.mdx b/contracts/docs/api/governance/TimeLock.mdx similarity index 100% rename from contracts/docs/api/messaging/libraries/TimeLock.mdx rename to contracts/docs/api/governance/TimeLock.mdx diff --git a/contracts/docs/api/libraries/Mimc.md b/contracts/docs/api/libraries/Mimc.md deleted file mode 100644 index b8dbed1d8..000000000 --- a/contracts/docs/api/libraries/Mimc.md +++ /dev/null @@ -1,46 +0,0 @@ -# `Mimc` - -### DataMissing - -```solidity -error DataMissing() -``` - -Thrown when the data is not provided - -### DataIsNotMod32 - -```solidity -error DataIsNotMod32() -``` - -Thrown when the data is not purely in 32 byte chunks - -### FR_FIELD - -```solidity -uint256 FR_FIELD -``` - -### hash - -```solidity -function hash(bytes _msg) external pure returns (bytes32 mimcHash) -``` - -Performs a MiMC hash on the data provided - -_Only data that has length modulus 32 is hashed, reverts otherwise_ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _msg | bytes | The data to be hashed | - -#### Return Values - -| Name | Type | Description | -| ---- | ---- | ----------- | -| mimcHash | bytes32 | The computed MiMC hash | - diff --git a/contracts/docs/api/security/pausing/Mimc.mdx b/contracts/docs/api/libraries/Mimc.mdx similarity index 100% rename from contracts/docs/api/security/pausing/Mimc.mdx rename to contracts/docs/api/libraries/Mimc.mdx diff --git a/contracts/docs/api/libraries/SparseMerkleProof.md b/contracts/docs/api/libraries/SparseMerkleProof.md deleted file mode 100644 index 153e344fe..000000000 --- a/contracts/docs/api/libraries/SparseMerkleProof.md +++ /dev/null @@ -1,212 +0,0 @@ -# `SparseMerkleProof` - -### Account - -The Account struct represents the state of the account including the storage root, nonce, balance and codesize - -_This is mapped directly to the output of the storage proof_ - -```solidity -struct Account { - uint64 nonce; - uint256 balance; - bytes32 storageRoot; - bytes32 mimcCodeHash; - bytes32 keccakCodeHash; - uint64 codeSize; -} -``` - -### Leaf - -Represents the leaf structure in both account and storage tries - -_This is mapped directly to the output of the storage proof_ - -```solidity -struct Leaf { - uint256 prev; - uint256 next; - bytes32 hKey; - bytes32 hValue; -} -``` - -### WrongBytesLength - -```solidity -error WrongBytesLength(uint256 expectedLength, uint256 bytesLength) -``` - -Thrown when expected bytes length is incorrect - -### LengthNotMod32 - -```solidity -error LengthNotMod32() -``` - -Thrown when the length of bytes is not in exactly 32 byte chunks - -### MaxTreeLeafIndexExceed - -```solidity -error MaxTreeLeafIndexExceed() -``` - -Thrown when the leaf index is higher than the tree depth - -### WrongProofLength - -```solidity -error WrongProofLength(uint256 expectedLength, uint256 actualLength) -``` - -Thrown when the length of the unformatted proof is not provided exactly as expected (UNFORMATTED_PROOF_LENGTH) - -### TREE_DEPTH - -```solidity -uint256 TREE_DEPTH -``` - -### UNFORMATTED_PROOF_LENGTH - -```solidity -uint256 UNFORMATTED_PROOF_LENGTH -``` - -### ZERO_HASH - -```solidity -bytes32 ZERO_HASH -``` - -### MAX_TREE_LEAF_INDEX - -```solidity -uint256 MAX_TREE_LEAF_INDEX -``` - -### verifyProof - -```solidity -function verifyProof(bytes[] _rawProof, uint256 _leafIndex, bytes32 _root) external pure returns (bool) -``` - -Formats input, computes root and returns true if it matches the provided merkle root - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _rawProof | bytes[] | Raw sparse merkle tree proof | -| _leafIndex | uint256 | Index of the leaf | -| _root | bytes32 | Sparse merkle root | - -#### Return Values - -| Name | Type | Description | -| ---- | ---- | ----------- | -| [0] | bool | If the computed merkle root matches the provided one | - -### mimcHash - -```solidity -function mimcHash(bytes _input) external pure returns (bytes32) -``` - -Hash a value using MIMC hash - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _input | bytes | Value to hash | - -#### Return Values - -| Name | Type | Description | -| ---- | ---- | ----------- | -| [0] | bytes32 | bytes32 Mimc hash | - -### getLeaf - -```solidity -function getLeaf(bytes _encodedLeaf) external pure returns (struct SparseMerkleProof.Leaf) -``` - -Get leaf - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _encodedLeaf | bytes | Encoded leaf bytes (prev, next, hKey, hValue) | - -#### Return Values - -| Name | Type | Description | -| ---- | ---- | ----------- | -| [0] | struct SparseMerkleProof.Leaf | Leaf Formatted leaf struct | - -### getAccount - -```solidity -function getAccount(bytes _encodedAccountValue) external pure returns (struct SparseMerkleProof.Account) -``` - -Get account - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _encodedAccountValue | bytes | Encoded account value bytes (nonce, balance, storageRoot, mimcCodeHash, keccakCodeHash, codeSize) | - -#### Return Values - -| Name | Type | Description | -| ---- | ---- | ----------- | -| [0] | struct SparseMerkleProof.Account | Account Formatted account struct | - -### hashAccountValue - -```solidity -function hashAccountValue(bytes _value) external pure returns (bytes32) -``` - -Hash account value - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _value | bytes | Encoded account value bytes (nonce, balance, storageRoot, mimcCodeHash, keccakCodeHash, codeSize) | - -#### Return Values - -| Name | Type | Description | -| ---- | ---- | ----------- | -| [0] | bytes32 | bytes32 Account value hash | - -### hashStorageValue - -```solidity -function hashStorageValue(bytes32 _value) external pure returns (bytes32) -``` - -Hash storage value - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _value | bytes32 | Encoded storage value bytes | - -#### Return Values - -| Name | Type | Description | -| ---- | ---- | ----------- | -| [0] | bytes32 | bytes32 Storage value hash | - diff --git a/contracts/docs/api/security/pausing/SparseMerkleProof.mdx b/contracts/docs/api/libraries/SparseMerkleProof.mdx similarity index 100% rename from contracts/docs/api/security/pausing/SparseMerkleProof.mdx rename to contracts/docs/api/libraries/SparseMerkleProof.mdx diff --git a/contracts/docs/api/libraries/TransientStorageHelpers.md b/contracts/docs/api/libraries/TransientStorageHelpers.md deleted file mode 100644 index 68f4f4c9c..000000000 --- a/contracts/docs/api/libraries/TransientStorageHelpers.md +++ /dev/null @@ -1,72 +0,0 @@ -# `TransientStorageHelpers` - -### tstoreUint256 - -```solidity -function tstoreUint256(bytes32 _key, uint256 _value) internal -``` - -Internal function that stores a uint256 value at a given key in the EVM's transient storage using the `tstore` opcode. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _key | bytes32 | The key in the EVM transient storage where the value should be stored. | -| _value | uint256 | The uint256 value to be stored at the specified key in the EVM transient storage. | - -### tloadUint256 - -```solidity -function tloadUint256(bytes32 _key) internal view returns (uint256 value) -``` - -Internal function that retrieves a uint256 value from the EVM's transient storage using the `tload` opcode. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _key | bytes32 | The key in the EVM transient storage from which the value should be retrieved. | - -#### Return Values - -| Name | Type | Description | -| ---- | ---- | ----------- | -| value | uint256 | The uint256 value retrieved from the specified key in the EVM transient storage. | - -### tstoreAddress - -```solidity -function tstoreAddress(bytes32 _key, address _addr) internal -``` - -Internal function that stores an address at a given key in the EVM's transient storage using the `tstore` opcode. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _key | bytes32 | The key in the EVM transient storage where the value should be stored. | -| _addr | address | The address to be stored at the specified key in the EVM transient storage. | - -### tloadAddress - -```solidity -function tloadAddress(bytes32 _key) internal view returns (address addr) -``` - -Internal function that retrieves an address from the EVM's transient storage using the `tload` opcode. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _key | bytes32 | The key in the EVM transient storage from which the value should be retrieved. | - -#### Return Values - -| Name | Type | Description | -| ---- | ---- | ----------- | -| addr | address | The address retrieved from the specified key in the EVM transient storage. | - diff --git a/contracts/docs/api/messaging/libraries/TransientStorageHelpers.mdx b/contracts/docs/api/libraries/TransientStorageHelpers.mdx similarity index 100% rename from contracts/docs/api/messaging/libraries/TransientStorageHelpers.mdx rename to contracts/docs/api/libraries/TransientStorageHelpers.mdx diff --git a/contracts/docs/api/libraries/Utils.md b/contracts/docs/api/libraries/Utils.md deleted file mode 100644 index 029dd3dab..000000000 --- a/contracts/docs/api/libraries/Utils.md +++ /dev/null @@ -1,32 +0,0 @@ -# `Utils` - -### _efficientKeccak - -```solidity -function _efficientKeccak(bytes32 _left, bytes32 _right) internal pure returns (bytes32 value) -``` - -Performs a gas optimized keccak hash for two bytes32 values. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _left | bytes32 | Left value. | -| _right | bytes32 | Right value. | - -### _efficientKeccak - -```solidity -function _efficientKeccak(uint256 _left, address _right) internal pure returns (bytes32 value) -``` - -Performs a gas optimized keccak hash for uint256 and address. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _left | uint256 | Left value. | -| _right | address | Right value. | - diff --git a/contracts/docs/api/security/pausing/Utils.mdx b/contracts/docs/api/libraries/Utils.mdx similarity index 100% rename from contracts/docs/api/security/pausing/Utils.mdx rename to contracts/docs/api/libraries/Utils.mdx diff --git a/contracts/docs/api/messaging/MessageServiceBase.md b/contracts/docs/api/messaging/MessageServiceBase.md deleted file mode 100644 index 54ba690d8..000000000 --- a/contracts/docs/api/messaging/MessageServiceBase.md +++ /dev/null @@ -1,105 +0,0 @@ -# `MessageServiceBase` - -### messageService - -```solidity -contract IMessageService messageService -``` - -The message service address on the current chain. - -### remoteSender - -```solidity -address remoteSender -``` - -The token bridge on the alternate/remote chain. - -### RemoteSenderSet - -```solidity -event RemoteSenderSet(address remoteSender, address setter) -``` - -_Event emitted when the remote sender is set._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| remoteSender | address | The address of the new remote sender. | -| setter | address | The address of the account that set the remote sender. | - -### CallerIsNotMessageService - -```solidity -error CallerIsNotMessageService() -``` - -_Thrown when the caller address is not the message service address_ - -### SenderNotAuthorized - -```solidity -error SenderNotAuthorized() -``` - -_Thrown when remote sender address is not authorized._ - -### onlyMessagingService - -```solidity -modifier onlyMessagingService() -``` - -_Modifier to make sure the caller is the known message service. - -Requirements: - -- The msg.sender must be the message service._ - -### onlyAuthorizedRemoteSender - -```solidity -modifier onlyAuthorizedRemoteSender() -``` - -_Modifier to make sure the original sender is allowed. - -Requirements: - -- The original message sender via the message service must be a known sender._ - -### __MessageServiceBase_init - -```solidity -function __MessageServiceBase_init(address _messageService) internal -``` - -Initializes the message service - -_Must be initialized in the initialize function of the main contract or constructor._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _messageService | address | The message service address, cannot be empty. | - -### _setRemoteSender - -```solidity -function _setRemoteSender(address _remoteSender) internal -``` - -Sets the remote sender - -_This function sets the remote sender address and emits the RemoteSenderSet event._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _remoteSender | address | The authorized remote sender address, cannot be empty. | - diff --git a/contracts/docs/api/messaging/interfaces/IMessageService.md b/contracts/docs/api/messaging/interfaces/IMessageService.md deleted file mode 100644 index 02a03fde7..000000000 --- a/contracts/docs/api/messaging/interfaces/IMessageService.md +++ /dev/null @@ -1,126 +0,0 @@ -# `IMessageService` - -### MessageSent - -```solidity -event MessageSent(address _from, address _to, uint256 _fee, uint256 _value, uint256 _nonce, bytes _calldata, bytes32 _messageHash) -``` - -Emitted when a message is sent. - -__calldata has the _ because calldata is a reserved word. -We include the message hash to save hashing costs on the rollup. -This event is used on both L1 and L2._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _from | address | The indexed sender address of the message (msg.sender). | -| _to | address | The indexed intended recipient address of the message on the other layer. | -| _fee | uint256 | The fee being being paid to deliver the message to the recipient in Wei. | -| _value | uint256 | The value being sent to the recipient in Wei. | -| _nonce | uint256 | The unique message number. | -| _calldata | bytes | The calldata being passed to the intended recipient when being called on claiming. | -| _messageHash | bytes32 | The indexed hash of the message parameters. | - -### MessageClaimed - -```solidity -event MessageClaimed(bytes32 _messageHash) -``` - -Emitted when a message is claimed. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _messageHash | bytes32 | The indexed hash of the message that was claimed. | - -### FeeTooLow - -```solidity -error FeeTooLow() -``` - -_Thrown when fees are lower than the minimum fee._ - -### ValueSentTooLow - -```solidity -error ValueSentTooLow() -``` - -_Thrown when the value sent is less than the fee. -Value to forward on is msg.value - _fee._ - -### MessageSendingFailed - -```solidity -error MessageSendingFailed(address destination) -``` - -_Thrown when the destination address reverts._ - -### FeePaymentFailed - -```solidity -error FeePaymentFailed(address recipient) -``` - -_Thrown when the recipient address reverts._ - -### sendMessage - -```solidity -function sendMessage(address _to, uint256 _fee, bytes _calldata) external payable -``` - -Sends a message for transporting from the given chain. - -_This function should be called with a msg.value = _value + _fee. The fee will be paid on the destination chain._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _to | address | The destination address on the destination chain. | -| _fee | uint256 | The message service fee on the origin chain. | -| _calldata | bytes | The calldata used by the destination message service to call the destination contract. | - -### claimMessage - -```solidity -function claimMessage(address _from, address _to, uint256 _fee, uint256 _value, address payable _feeRecipient, bytes _calldata, uint256 _nonce) external -``` - -Deliver a message to the destination chain. -Is called by the Postman, dApp or end user. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _from | address | The msg.sender calling the origin message service. | -| _to | address | The destination address on the destination chain. | -| _fee | uint256 | The message service fee on the origin chain. | -| _value | uint256 | The value to be transferred to the destination address. | -| _feeRecipient | address payable | Address that will receive the fees. | -| _calldata | bytes | The calldata used by the destination message service to call/forward to the destination contract. | -| _nonce | uint256 | Unique message number. | - -### sender - -```solidity -function sender() external view returns (address originalSender) -``` - -Returns the original sender of the message on the origin layer. - -#### Return Values - -| Name | Type | Description | -| ---- | ---- | ----------- | -| originalSender | address | The original sender of the message on the origin layer. | - 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/messaging/l1/L1MessageManager.md b/contracts/docs/api/messaging/l1/L1MessageManager.md deleted file mode 100644 index fb5f87c8b..000000000 --- a/contracts/docs/api/messaging/l1/L1MessageManager.md +++ /dev/null @@ -1,111 +0,0 @@ -# `L1MessageManager` - -### rollingHashes - -```solidity -mapping(uint256 => bytes32) rollingHashes -``` - -Contains the L1 to L2 messaging rolling hashes mapped to message number computed on L1. - -### _messageClaimedBitMap - -```solidity -struct BitMaps.BitMap _messageClaimedBitMap -``` - -This maps which message numbers have been claimed to prevent duplicate claiming. - -### l2MerkleRootsDepths - -```solidity -mapping(bytes32 => uint256) l2MerkleRootsDepths -``` - -Contains the L2 messages Merkle roots mapped to their tree depth. - -### _addRollingHash - -```solidity -function _addRollingHash(uint256 _messageNumber, bytes32 _messageHash) internal -``` - -Take an existing message hash, calculates the rolling hash and stores at the message number. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _messageNumber | uint256 | The current message number being sent. | -| _messageHash | bytes32 | The hash of the message being sent. | - -### _setL2L1MessageToClaimed - -```solidity -function _setL2L1MessageToClaimed(uint256 _messageNumber) internal -``` - -Set the L2->L1 message as claimed when a user claims a message on L1. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _messageNumber | uint256 | The message number on L2. | - -### _addL2MerkleRoots - -```solidity -function _addL2MerkleRoots(bytes32[] _newRoots, uint256 _treeDepth) internal -``` - -Add the L2 Merkle roots to the storage. - -_This function is called during block finalization. -The _treeDepth does not need to be checked to be non-zero as it is, -already enforced to be non-zero in the circuit, and used in the proof's public input._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _newRoots | bytes32[] | New L2 Merkle roots. | -| _treeDepth | uint256 | | - -### _anchorL2MessagingBlocks - -```solidity -function _anchorL2MessagingBlocks(bytes _l2MessagingBlocksOffsets, uint256 _currentL2BlockNumber) internal -``` - -Emit an event for each L2 block containing L2->L1 messages. - -_This function is called during block finalization._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _l2MessagingBlocksOffsets | bytes | Is a sequence of uint16 values, where each value plus the last finalized L2 block number. indicates which L2 blocks have L2->L1 messages. | -| _currentL2BlockNumber | uint256 | Last L2 block number finalized on L1. | - -### isMessageClaimed - -```solidity -function isMessageClaimed(uint256 _messageNumber) external view returns (bool isClaimed) -``` - -Checks if the L2->L1 message is claimed or not. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _messageNumber | uint256 | The message number on L2. | - -#### Return Values - -| Name | Type | Description | -| ---- | ---- | ----------- | -| isClaimed | bool | Returns whether or not the message with _messageNumber has been claimed. | - diff --git a/contracts/docs/api/messaging/l1/L1MessageService.md b/contracts/docs/api/messaging/l1/L1MessageService.md deleted file mode 100644 index ddc8fdca6..000000000 --- a/contracts/docs/api/messaging/l1/L1MessageService.md +++ /dev/null @@ -1,77 +0,0 @@ -# `L1MessageService` - -### systemMigrationBlock - -```solidity -uint256 systemMigrationBlock -``` - -_This is currently not in use, but is reserved for future upgrades._ - -### __MessageService_init - -```solidity -function __MessageService_init(uint256 _rateLimitPeriod, uint256 _rateLimitAmount) internal -``` - -Initialises underlying message service dependencies. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _rateLimitPeriod | uint256 | The period to rate limit against. | -| _rateLimitAmount | uint256 | The limit allowed for withdrawing the period. | - -### sendMessage - -```solidity -function sendMessage(address _to, uint256 _fee, bytes _calldata) external payable -``` - -Adds a message for sending cross-chain and emits MessageSent. - -_The message number is preset (nextMessageNumber) and only incremented at the end if successful for the next caller. -This function should be called with a msg.value = _value + _fee. The fee will be paid on the destination chain._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _to | address | The address the message is intended for. | -| _fee | uint256 | The fee being paid for the message delivery. | -| _calldata | bytes | The calldata to pass to the recipient. | - -### claimMessageWithProof - -```solidity -function claimMessageWithProof(struct IL1MessageService.ClaimMessageWithProofParams _params) external -``` - -Claims and delivers a cross-chain message using a Merkle proof. - -_if tree depth is empty, it will revert with L2MerkleRootDoesNotExist. -if tree depth is different than proof size, it will revert with ProofLengthDifferentThanMerkleDepth._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _params | struct IL1MessageService.ClaimMessageWithProofParams | Collection of claim data with proof and supporting data. | - -### sender - -```solidity -function sender() external view returns (address originalSender) -``` - -Claims and delivers a cross-chain message. - -_The message sender address is set temporarily in the transient storage when claiming._ - -#### Return Values - -| Name | Type | Description | -| ---- | ---- | ----------- | -| originalSender | address | The message sender address that is stored temporarily in the transient storage when claiming. | - diff --git a/contracts/docs/api/messaging/l1/interfaces/IL1MessageManager.md b/contracts/docs/api/messaging/l1/interfaces/IL1MessageManager.md deleted file mode 100644 index 04fc8935d..000000000 --- a/contracts/docs/api/messaging/l1/interfaces/IL1MessageManager.md +++ /dev/null @@ -1,95 +0,0 @@ -# `IL1MessageManager` - -### RollingHashUpdated - -```solidity -event RollingHashUpdated(uint256 messageNumber, bytes32 rollingHash, bytes32 messageHash) -``` - -Emitted when a new message is sent and the rolling hash updated. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| messageNumber | uint256 | The unique indexed message number for the message. | -| rollingHash | bytes32 | The indexed rolling hash computed for the current message number. | -| messageHash | bytes32 | The indexed hash of the message parameters. | - -### L2MerkleRootAdded - -```solidity -event L2MerkleRootAdded(bytes32 l2MerkleRoot, uint256 treeDepth) -``` - -Emitted when the L2 Merkle root has been anchored on L1. - -_There may be more than one of these in a finalization depending on the amount of L2->L1 messages in the finalization._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| l2MerkleRoot | bytes32 | The indexed L2 Merkle root that has been anchored on L1 Ethereum. | -| treeDepth | uint256 | The indexed tree depth of the Merkle root. | - -### L2MessagingBlockAnchored - -```solidity -event L2MessagingBlockAnchored(uint256 l2Block) -``` - -Emitted when the L2 block contains L2 messages during finalization. - -_This is used externally in the logic for determining which messages belong to which Merkle root when claiming._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| l2Block | uint256 | The indexed L2 block containing L2 to L1 messages. | - -### MessageAlreadyClaimed - -```solidity -error MessageAlreadyClaimed(uint256 messageIndex) -``` - -_Thrown when the message has already been claimed._ - -### L2MerkleRootAlreadyAnchored - -```solidity -error L2MerkleRootAlreadyAnchored(bytes32 merkleRoot) -``` - -_Thrown when the L2 Merkle root has already been anchored on L1._ - -### BytesLengthNotMultipleOfTwo - -```solidity -error BytesLengthNotMultipleOfTwo(uint256 bytesLength) -``` - -_Thrown when the L2 messaging blocks offsets bytes length is not a multiple of 2._ - -### isMessageClaimed - -```solidity -function isMessageClaimed(uint256 _messageNumber) external view returns (bool isClaimed) -``` - -Checks if the L2->L1 message is claimed or not. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _messageNumber | uint256 | The message number on L2. | - -#### Return Values - -| Name | Type | Description | -| ---- | ---- | ----------- | -| isClaimed | bool | Returns whether or not the message with _messageNumber has been claimed. | - 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/messaging/l1/interfaces/IL1MessageService.md b/contracts/docs/api/messaging/l1/interfaces/IL1MessageService.md deleted file mode 100644 index 7fad8aed2..000000000 --- a/contracts/docs/api/messaging/l1/interfaces/IL1MessageService.md +++ /dev/null @@ -1,65 +0,0 @@ -# `IL1MessageService` - -### ClaimMessageWithProofParams - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | - -```solidity -struct ClaimMessageWithProofParams { - bytes32[] proof; - uint256 messageNumber; - uint32 leafIndex; - address from; - address to; - uint256 fee; - uint256 value; - address payable feeRecipient; - bytes32 merkleRoot; - bytes data; -} -``` - -### L2MerkleRootDoesNotExist - -```solidity -error L2MerkleRootDoesNotExist() -``` - -_Thrown when L2 Merkle root does not exist._ - -### InvalidMerkleProof - -```solidity -error InvalidMerkleProof() -``` - -_Thrown when the Merkle proof is invalid._ - -### ProofLengthDifferentThanMerkleDepth - -```solidity -error ProofLengthDifferentThanMerkleDepth(uint256 actual, uint256 expected) -``` - -_Thrown when Merkle depth doesn't match proof length._ - -### claimMessageWithProof - -```solidity -function claimMessageWithProof(struct IL1MessageService.ClaimMessageWithProofParams _params) external -``` - -Claims and delivers a cross-chain message using a Merkle proof. - -_if tree depth is empty, it will revert with L2MerkleRootDoesNotExist. -if tree depth is different than proof size, it will revert with ProofLengthDifferentThanMerkleDepth._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _params | struct IL1MessageService.ClaimMessageWithProofParams | Collection of claim data with proof and supporting data. | - 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/messaging/l1/v1/L1MessageManagerV1.md b/contracts/docs/api/messaging/l1/v1/L1MessageManagerV1.md deleted file mode 100644 index 38aa292d1..000000000 --- a/contracts/docs/api/messaging/l1/v1/L1MessageManagerV1.md +++ /dev/null @@ -1,71 +0,0 @@ -# `L1MessageManagerV1` - -### INBOX_STATUS_UNKNOWN - -```solidity -uint8 INBOX_STATUS_UNKNOWN -``` - -The 2 legacy status constants for message statuses. - -### INBOX_STATUS_RECEIVED - -```solidity -uint8 INBOX_STATUS_RECEIVED -``` - -### OUTBOX_STATUS_UNKNOWN - -```solidity -uint8 OUTBOX_STATUS_UNKNOWN -``` - -The 3 legacy status constants for message statuses. - -### OUTBOX_STATUS_SENT - -```solidity -uint8 OUTBOX_STATUS_SENT -``` - -### OUTBOX_STATUS_RECEIVED - -```solidity -uint8 OUTBOX_STATUS_RECEIVED -``` - -### outboxL1L2MessageStatus - -```solidity -mapping(bytes32 => uint256) outboxL1L2MessageStatus -``` - -_DEPRECATED in favor of the rollingHashes mapping on the L1MessageManager for L1 to L2 messaging._ - -### inboxL2L1MessageStatus - -```solidity -mapping(bytes32 => uint256) inboxL2L1MessageStatus -``` - -_Mapping to store L2->L1 message hashes status. -messageHash => messageStatus (0: unknown, 1: received). -For the most part this has been deprecated. This is only used for messages received pre-AlphaV2._ - -### _updateL2L1MessageStatusToClaimed - -```solidity -function _updateL2L1MessageStatusToClaimed(bytes32 _messageHash) internal -``` - -Update the status of L2->L1 message when a user claims a message on L1. - -_The L2->L1 message is removed from storage. -Due to the nature of the rollup, we should not get a second entry of this._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _messageHash | bytes32 | Hash of the message. | - diff --git a/contracts/docs/api/messaging/l1/v1/L1MessageServiceV1.md b/contracts/docs/api/messaging/l1/v1/L1MessageServiceV1.md deleted file mode 100644 index f8e985305..000000000 --- a/contracts/docs/api/messaging/l1/v1/L1MessageServiceV1.md +++ /dev/null @@ -1,81 +0,0 @@ -# `L1MessageServiceV1` - -### nextMessageNumber - -```solidity -uint256 nextMessageNumber -``` - -### _messageSender - -```solidity -address _messageSender -``` - -_DEPRECATED in favor of new transient storage with `MESSAGE_SENDER_TRANSIENT_KEY` key._ - -### REFUND_OVERHEAD_IN_GAS - -```solidity -uint256 REFUND_OVERHEAD_IN_GAS -``` - -_adding these should not affect storage as they are constants and are stored in bytecode._ - -### MESSAGE_SENDER_TRANSIENT_KEY - -```solidity -bytes32 MESSAGE_SENDER_TRANSIENT_KEY -``` - -_The transient storage key to set the message sender against while claiming._ - -### DEFAULT_MESSAGE_SENDER_TRANSIENT_VALUE - -```solidity -address DEFAULT_MESSAGE_SENDER_TRANSIENT_VALUE -``` - -The default value for the message sender reset to post claiming using the MESSAGE_SENDER_TRANSIENT_KEY. - -### distributeFees - -```solidity -modifier distributeFees(uint256 _feeInWei, address _to, bytes _calldata, address _feeRecipient) -``` - -The unspent fee is refunded if applicable. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _feeInWei | uint256 | The fee paid for delivery in Wei. | -| _to | address | The recipient of the message and gas refund. | -| _calldata | bytes | The calldata of the message. | -| _feeRecipient | address | | - -### claimMessage - -```solidity -function claimMessage(address _from, address _to, uint256 _fee, uint256 _value, address payable _feeRecipient, bytes _calldata, uint256 _nonce) external -``` - -Claims and delivers a cross-chain message. - -__feeRecipient can be set to address(0) to receive as msg.sender. -The original message sender address is temporarily set in transient storage, -while claiming. This address is used in sender()._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _from | address | The address of the original sender. | -| _to | address | The address the message is intended for. | -| _fee | uint256 | The fee being paid for the message delivery. | -| _value | uint256 | The value to be transferred to the destination address. | -| _feeRecipient | address payable | The recipient for the fee. | -| _calldata | bytes | The calldata to pass to the recipient. | -| _nonce | uint256 | The unique auto generated nonce used when sending the message. | - diff --git a/contracts/docs/api/messaging/l1/v1/interfaces/IL1MessageManagerV1.md b/contracts/docs/api/messaging/l1/v1/interfaces/IL1MessageManagerV1.md deleted file mode 100644 index b9b0495be..000000000 --- a/contracts/docs/api/messaging/l1/v1/interfaces/IL1MessageManagerV1.md +++ /dev/null @@ -1,10 +0,0 @@ -# `IL1MessageManagerV1` - -### MessageDoesNotExistOrHasAlreadyBeenClaimed - -```solidity -error MessageDoesNotExistOrHasAlreadyBeenClaimed(bytes32 messageHash) -``` - -_Thrown when the message has already been claimed._ - 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/messaging/l2/L2MessageManager.md b/contracts/docs/api/messaging/l2/L2MessageManager.md deleted file mode 100644 index d364fbd45..000000000 --- a/contracts/docs/api/messaging/l2/L2MessageManager.md +++ /dev/null @@ -1,48 +0,0 @@ -# `L2MessageManager` - -### L1_L2_MESSAGE_SETTER_ROLE - -```solidity -bytes32 L1_L2_MESSAGE_SETTER_ROLE -``` - -The role required to anchor L1 to L2 message hashes. - -### lastAnchoredL1MessageNumber - -```solidity -uint256 lastAnchoredL1MessageNumber -``` - -Contains the last L1 message number anchored on L2. - -### l1RollingHashes - -```solidity -mapping(uint256 => bytes32) l1RollingHashes -``` - -Contains the L1 to L2 messaging rolling hashes mapped to message number computed on L2. - -### anchorL1L2MessageHashes - -```solidity -function anchorL1L2MessageHashes(bytes32[] _messageHashes, uint256 _startingMessageNumber, uint256 _finalMessageNumber, bytes32 _finalRollingHash) external -``` - -Add cross-chain L1->L2 message hashes in storage. - -_Only address that has the role 'L1_L2_MESSAGE_SETTER_ROLE' are allowed to call this function. -NB: In the unlikely event of a duplicate anchoring, the lastAnchoredL1MessageNumber MUST NOT be incremented. -and the rolling hash not calculated, else synchronisation will break. -If starting number is zero, an underflow error is expected._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _messageHashes | bytes32[] | New message hashes to anchor on L2. | -| _startingMessageNumber | uint256 | The expected L1 message number to start when anchoring. | -| _finalMessageNumber | uint256 | The expected L1 message number to end on when anchoring. | -| _finalRollingHash | bytes32 | The expected L1 rolling hash to end on when anchoring. | - diff --git a/contracts/docs/api/messaging/l2/L2MessageService.md b/contracts/docs/api/messaging/l2/L2MessageService.md deleted file mode 100644 index d83edaf55..000000000 --- a/contracts/docs/api/messaging/l2/L2MessageService.md +++ /dev/null @@ -1,53 +0,0 @@ -# `L2MessageService` - -### CONTRACT_VERSION - -```solidity -string CONTRACT_VERSION -``` - -_This is the ABI version and not the reinitialize version._ - -### constructor - -```solidity -constructor() public -``` - -### initialize - -```solidity -function initialize(uint256 _rateLimitPeriod, uint256 _rateLimitAmount, address _defaultAdmin, struct IPermissionsManager.RoleAddress[] _roleAddresses, struct IPauseManager.PauseTypeRole[] _pauseTypeRoles, struct IPauseManager.PauseTypeRole[] _unpauseTypeRoles) external -``` - -Initializes underlying message service dependencies. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _rateLimitPeriod | uint256 | The period to rate limit against. | -| _rateLimitAmount | uint256 | The limit allowed for withdrawing the period. | -| _defaultAdmin | address | The account to be given DEFAULT_ADMIN_ROLE on initialization. | -| _roleAddresses | struct IPermissionsManager.RoleAddress[] | The list of addresses to grant roles to. | -| _pauseTypeRoles | struct IPauseManager.PauseTypeRole[] | The list of pause type roles. | -| _unpauseTypeRoles | struct IPauseManager.PauseTypeRole[] | The list of unpause type roles. | - -### reinitializePauseTypesAndPermissions - -```solidity -function reinitializePauseTypesAndPermissions(struct IPermissionsManager.RoleAddress[] _roleAddresses, struct IPauseManager.PauseTypeRole[] _pauseTypeRoles, struct IPauseManager.PauseTypeRole[] _unpauseTypeRoles) external -``` - -Sets permissions for a list of addresses and their roles as well as initialises the PauseManager pauseType:role mappings. - -_This function is a reinitializer and can only be called once per version. Should be called using an upgradeAndCall transaction to the ProxyAdmin._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _roleAddresses | struct IPermissionsManager.RoleAddress[] | The list of addresses and roles to assign permissions to. | -| _pauseTypeRoles | struct IPauseManager.PauseTypeRole[] | The list of pause types to associate with roles. | -| _unpauseTypeRoles | struct IPauseManager.PauseTypeRole[] | The list of unpause types to associate with roles. | - diff --git a/contracts/docs/api/messaging/l2/interfaces/IL2MessageManager.md b/contracts/docs/api/messaging/l2/interfaces/IL2MessageManager.md deleted file mode 100644 index 341cf725d..000000000 --- a/contracts/docs/api/messaging/l2/interfaces/IL2MessageManager.md +++ /dev/null @@ -1,89 +0,0 @@ -# `IL2MessageManager` - -### RollingHashUpdated - -```solidity -event RollingHashUpdated(uint256 messageNumber, bytes32 rollingHash) -``` - -Emitted after all messages are anchored on L2 and the latest message index and rolling hash stored. - -_NB: This event is used to provide data to the rollup. The last messageNumber and rollingHash, -emitted in a rollup will be used in the public input for validating the L1->L2 messaging state transition._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| messageNumber | uint256 | The indexed unique L1 computed indexed message number for the message. | -| rollingHash | bytes32 | The indexed L1 rolling hash computed for the current message number. | - -### ServiceVersionMigrated - -```solidity -event ServiceVersionMigrated(uint256 version) -``` - -_Emitted when the service switches over to a new version. -This is currently not in use, but left for existing consumers._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| version | uint256 | The indexed version. | - -### MessageHashesListLengthIsZero - -```solidity -error MessageHashesListLengthIsZero() -``` - -_Reverts when the message hashes array length is zero._ - -### L1MessageNumberSynchronizationWrong - -```solidity -error L1MessageNumberSynchronizationWrong(uint256 expected, uint256 found) -``` - -_Reverts when message number synchronization is mismatched._ - -### L1RollingHashSynchronizationWrong - -```solidity -error L1RollingHashSynchronizationWrong(bytes32 expected, bytes32 found) -``` - -_Reverts when rolling hash synchronization is mismatched._ - -### FinalRollingHashIsZero - -```solidity -error FinalRollingHashIsZero() -``` - -_Reverts when final rolling hash is zero hash._ - -### anchorL1L2MessageHashes - -```solidity -function anchorL1L2MessageHashes(bytes32[] _messageHashes, uint256 _startingMessageNumber, uint256 _finalMessageNumber, bytes32 _finalRollingHash) external -``` - -Add cross-chain L1->L2 message hashes in storage. - -_Only address that has the role 'L1_L2_MESSAGE_SETTER_ROLE' are allowed to call this function. -NB: In the unlikely event of a duplicate anchoring, the lastAnchoredL1MessageNumber MUST NOT be incremented. -and the rolling hash not calculated, else synchronisation will break. -If starting number is zero, an underflow error is expected._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _messageHashes | bytes32[] | New message hashes to anchor on L2. | -| _startingMessageNumber | uint256 | The expected L1 message number to start when anchoring. | -| _finalMessageNumber | uint256 | The expected L1 message number to end on when anchoring. | -| _finalRollingHash | bytes32 | The expected L1 rolling hash to end on when anchoring. | - diff --git a/contracts/docs/api/messaging/l2/v1/interfaces/IL2MessageManager.mdx b/contracts/docs/api/messaging/l2/interfaces/IL2MessageManager.mdx similarity index 100% rename from contracts/docs/api/messaging/l2/v1/interfaces/IL2MessageManager.mdx rename to contracts/docs/api/messaging/l2/interfaces/IL2MessageManager.mdx diff --git a/contracts/docs/api/messaging/l2/v1/L2MessageManagerV1.md b/contracts/docs/api/messaging/l2/v1/L2MessageManagerV1.md deleted file mode 100644 index cd9b595ad..000000000 --- a/contracts/docs/api/messaging/l2/v1/L2MessageManagerV1.md +++ /dev/null @@ -1,45 +0,0 @@ -# `L2MessageManagerV1` - -### INBOX_STATUS_UNKNOWN - -```solidity -uint8 INBOX_STATUS_UNKNOWN -``` - -The 3 status constants for L1 to L2 message statuses. - -### INBOX_STATUS_RECEIVED - -```solidity -uint8 INBOX_STATUS_RECEIVED -``` - -### INBOX_STATUS_CLAIMED - -```solidity -uint8 INBOX_STATUS_CLAIMED -``` - -### inboxL1L2MessageStatus - -```solidity -mapping(bytes32 => uint256) inboxL1L2MessageStatus -``` - -_Mapping to store L1->L2 message hashes status. -messageHash => messageStatus (0: unknown, 1: received, 2: claimed)._ - -### _updateL1L2MessageStatusToClaimed - -```solidity -function _updateL1L2MessageStatusToClaimed(bytes32 _messageHash) internal -``` - -Update the status of L1->L2 message when a user claims a message on L2. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _messageHash | bytes32 | Hash of the message. | - diff --git a/contracts/docs/api/messaging/l2/v1/L2MessageServiceV1.md b/contracts/docs/api/messaging/l2/v1/L2MessageServiceV1.md deleted file mode 100644 index bda39c206..000000000 --- a/contracts/docs/api/messaging/l2/v1/L2MessageServiceV1.md +++ /dev/null @@ -1,138 +0,0 @@ -# `L2MessageServiceV1` - -### MINIMUM_FEE_SETTER_ROLE - -```solidity -bytes32 MINIMUM_FEE_SETTER_ROLE -``` - -The role required to set the minimum DDOS fee. - -### _messageSender - -```solidity -address _messageSender -``` - -_The temporary message sender set when claiming a message._ - -### nextMessageNumber - -```solidity -uint256 nextMessageNumber -``` - -### minimumFeeInWei - -```solidity -uint256 minimumFeeInWei -``` - -### REFUND_OVERHEAD_IN_GAS - -```solidity -uint256 REFUND_OVERHEAD_IN_GAS -``` - -### DEFAULT_SENDER_ADDRESS - -```solidity -address DEFAULT_SENDER_ADDRESS -``` - -_The default message sender address reset after claiming a message._ - -### constructor - -```solidity -constructor() internal -``` - -### sendMessage - -```solidity -function sendMessage(address _to, uint256 _fee, bytes _calldata) external payable -``` - -Adds a message for sending cross-chain and emits a relevant event. - -_The message number is preset and only incremented at the end if successful for the next caller._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _to | address | The address the message is intended for. | -| _fee | uint256 | The fee being paid for the message delivery. | -| _calldata | bytes | The calldata to pass to the recipient. | - -### claimMessage - -```solidity -function claimMessage(address _from, address _to, uint256 _fee, uint256 _value, address payable _feeRecipient, bytes _calldata, uint256 _nonce) external -``` - -Claims and delivers a cross-chain message. - -__feeRecipient Can be set to address(0) to receive as msg.sender. -messageSender Is set temporarily when claiming and reset post._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _from | address | The address of the original sender. | -| _to | address | The address the message is intended for. | -| _fee | uint256 | The fee being paid for the message delivery. | -| _value | uint256 | The value to be transferred to the destination address. | -| _feeRecipient | address payable | The recipient for the fee. | -| _calldata | bytes | The calldata to pass to the recipient. | -| _nonce | uint256 | The unique auto generated message number used when sending the message. | - -### setMinimumFee - -```solidity -function setMinimumFee(uint256 _feeInWei) external -``` - -The Fee Manager sets a minimum fee to address DOS protection. - -_MINIMUM_FEE_SETTER_ROLE is required to set the minimum fee._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _feeInWei | uint256 | New minimum fee in Wei. | - -### sender - -```solidity -function sender() external view returns (address originalSender) -``` - -_The _messageSender address is set temporarily when claiming._ - -#### Return Values - -| Name | Type | Description | -| ---- | ---- | ----------- | -| originalSender | address | The original sender stored temporarily at the _messageSender address in storage. | - -### distributeFees - -```solidity -modifier distributeFees(uint256 _feeInWei, address _to, bytes _calldata, address _feeRecipient) -``` - -The unspent fee is refunded if applicable. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _feeInWei | uint256 | The fee paid for delivery in Wei. | -| _to | address | The recipient of the message and gas refund. | -| _calldata | bytes | The calldata of the message. | -| _feeRecipient | address | | - diff --git a/contracts/docs/api/messaging/l2/v1/interfaces/IL2MessageManagerV1.md b/contracts/docs/api/messaging/l2/v1/interfaces/IL2MessageManagerV1.md deleted file mode 100644 index 0f795e031..000000000 --- a/contracts/docs/api/messaging/l2/v1/interfaces/IL2MessageManagerV1.md +++ /dev/null @@ -1,48 +0,0 @@ -# `IL2MessageManagerV1` - -### MinimumFeeChanged - -```solidity -event MinimumFeeChanged(uint256 previousMinimumFee, uint256 newMinimumFee, address calledBy) -``` - -Emitted when L2 minimum fee is changed. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| previousMinimumFee | uint256 | The previous minimum fee in Wei. | -| newMinimumFee | uint256 | The new minimum fee in Wei. | -| calledBy | address | The indexed address who changed the minimum fee. | - -### L1L2MessageHashesAddedToInbox - -```solidity -event L1L2MessageHashesAddedToInbox(bytes32[] messageHashes) -``` - -Emitted when L1->L2 message hashes have been added to L2 storage. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| messageHashes | bytes32[] | The message hashes that were added to L2 for claiming. | - -### MessageHashesListLengthHigherThanOneHundred - -```solidity -error MessageHashesListLengthHigherThanOneHundred(uint256 length) -``` - -_Thrown when the message hashes list length is higher than one hundred._ - -### MessageDoesNotExistOrHasAlreadyBeenClaimed - -```solidity -error MessageDoesNotExistOrHasAlreadyBeenClaimed(bytes32 messageHash) -``` - -_Thrown when the message does not exist or has already been claimed._ - diff --git a/contracts/docs/api/messaging/l2/v1/interfaces/IL2MessageServiceV1.md b/contracts/docs/api/messaging/l2/v1/interfaces/IL2MessageServiceV1.md deleted file mode 100644 index 8108c9df5..000000000 --- a/contracts/docs/api/messaging/l2/v1/interfaces/IL2MessageServiceV1.md +++ /dev/null @@ -1,18 +0,0 @@ -# `IL2MessageServiceV1` - -### setMinimumFee - -```solidity -function setMinimumFee(uint256 _feeInWei) external -``` - -The Fee Manager sets a minimum fee to address DOS protection. - -_MINIMUM_FEE_SETTER_ROLE is required to set the minimum fee._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _feeInWei | uint256 | New minimum fee in Wei. | - diff --git a/contracts/docs/api/messaging/libraries/MessageHashing.md b/contracts/docs/api/messaging/libraries/MessageHashing.md deleted file mode 100644 index 47fe17ffd..000000000 --- a/contracts/docs/api/messaging/libraries/MessageHashing.md +++ /dev/null @@ -1,24 +0,0 @@ -# `MessageHashing` - -### _hashMessage - -```solidity -function _hashMessage(address _from, address _to, uint256 _fee, uint256 _valueSent, uint256 _messageNumber, bytes _calldata) internal pure returns (bytes32 messageHash) -``` - -Hashes messages using assembly for efficiency. - -_Adding 0xc0 is to indicate the calldata offset relative to the memory being added to. -If the calldata is not modulus 32, the extra bit needs to be added on at the end else the hash is wrong._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _from | address | The from address. | -| _to | address | The to address. | -| _fee | uint256 | The fee paid for delivery. | -| _valueSent | uint256 | The value to be sent when delivering. | -| _messageNumber | uint256 | The unique message number. | -| _calldata | bytes | The calldata to be passed to the destination address. | - diff --git a/contracts/docs/api/messaging/libraries/SparseMerkleTreeVerifier.md b/contracts/docs/api/messaging/libraries/SparseMerkleTreeVerifier.md deleted file mode 100644 index 3c1cf650a..000000000 --- a/contracts/docs/api/messaging/libraries/SparseMerkleTreeVerifier.md +++ /dev/null @@ -1,66 +0,0 @@ -# `SparseMerkleTreeVerifier` - -### SafeCastOverflowedUintDowncast - -```solidity -error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value) -``` - -_Value doesn't fit in a uint of `bits` size. -This is based on OpenZeppelin's SafeCast library._ - -### LeafIndexOutOfBounds - -```solidity -error LeafIndexOutOfBounds(uint32 leafIndex, uint32 maxAllowedIndex) -``` - -_Custom error for when the leaf index is out of bounds._ - -### _verifyMerkleProof - -```solidity -function _verifyMerkleProof(bytes32 _leafHash, bytes32[] _proof, uint32 _leafIndex, bytes32 _root) internal pure returns (bool proofIsValid) -``` - -Verify merkle proof - -_The depth of the tree is expected to be validated elsewhere beforehand._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _leafHash | bytes32 | Leaf hash. | -| _proof | bytes32[] | Sparse merkle tree proof. | -| _leafIndex | uint32 | Index of the leaf. | -| _root | bytes32 | Merkle root. | - -#### Return Values - -| Name | Type | Description | -| ---- | ---- | ----------- | -| proofIsValid | bool | Returns if the proof is valid or not. | - -### safeCastToUint32 - -```solidity -function safeCastToUint32(uint256 _value) internal pure returns (uint32 castUint32) -``` - -Tries to safely cast to uint32. - -_This is based on OpenZeppelin's SafeCast library._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _value | uint256 | The value being cast to uint32. | - -#### Return Values - -| Name | Type | Description | -| ---- | ---- | ----------- | -| castUint32 | uint32 | Returns a uint32 safely cast. | - diff --git a/contracts/docs/api/rollup/LineaRollup.md b/contracts/docs/api/rollup/LineaRollup.md deleted file mode 100644 index 96990127c..000000000 --- a/contracts/docs/api/rollup/LineaRollup.md +++ /dev/null @@ -1,466 +0,0 @@ -# `LineaRollup` - -### CONTRACT_VERSION - -```solidity -string CONTRACT_VERSION -``` - -This is the ABI version and not the reinitialize version. - -### VERIFIER_SETTER_ROLE - -```solidity -bytes32 VERIFIER_SETTER_ROLE -``` - -The role required to set/add proof verifiers by type. - -### VERIFIER_UNSETTER_ROLE - -```solidity -bytes32 VERIFIER_UNSETTER_ROLE -``` - -The role required to set/remove proof verifiers by type. - -### GENESIS_SHNARF - -```solidity -bytes32 GENESIS_SHNARF -``` - -The default genesis shnarf using empty/default hashes and a default state. - -### SHNARF_EXISTS_DEFAULT_VALUE - -```solidity -uint256 SHNARF_EXISTS_DEFAULT_VALUE -``` - -_Value indicating a shnarf exists._ - -### EMPTY_HASH - -```solidity -bytes32 EMPTY_HASH -``` - -_The default hash value._ - -### BLS_CURVE_MODULUS - -```solidity -uint256 BLS_CURVE_MODULUS -``` - -_The BLS Curve modulus value used._ - -### POINT_EVALUATION_PRECOMPILE_ADDRESS - -```solidity -address POINT_EVALUATION_PRECOMPILE_ADDRESS -``` - -_The well-known precompile address for point evaluation._ - -### POINT_EVALUATION_RETURN_DATA_LENGTH - -```solidity -uint256 POINT_EVALUATION_RETURN_DATA_LENGTH -``` - -_The expected point evaluation return data length._ - -### POINT_EVALUATION_FIELD_ELEMENTS_LENGTH - -```solidity -uint256 POINT_EVALUATION_FIELD_ELEMENTS_LENGTH -``` - -_The expected point evaluation field element length returned._ - -### SIX_MONTHS_IN_SECONDS - -```solidity -uint256 SIX_MONTHS_IN_SECONDS -``` - -_In practice, when used, this is expected to be a close approximation to 6 months, and is intentional._ - -### dataFinalStateRootHashes - -```solidity -mapping(bytes32 => bytes32) dataFinalStateRootHashes -``` - -_DEPRECATED in favor of the single blobShnarfExists mapping._ - -### dataParents - -```solidity -mapping(bytes32 => bytes32) dataParents -``` - -_DEPRECATED in favor of the single blobShnarfExists mapping._ - -### dataShnarfHashes - -```solidity -mapping(bytes32 => bytes32) dataShnarfHashes -``` - -_DEPRECATED in favor of the single blobShnarfExists mapping._ - -### dataStartingBlock - -```solidity -mapping(bytes32 => uint256) dataStartingBlock -``` - -_DEPRECATED in favor of the single blobShnarfExists mapping._ - -### dataEndingBlock - -```solidity -mapping(bytes32 => uint256) dataEndingBlock -``` - -_DEPRECATED in favor of the single blobShnarfExists mapping._ - -### currentL2StoredL1MessageNumber - -```solidity -uint256 currentL2StoredL1MessageNumber -``` - -_DEPRECATED in favor of currentFinalizedState hash._ - -### currentL2StoredL1RollingHash - -```solidity -bytes32 currentL2StoredL1RollingHash -``` - -_DEPRECATED in favor of currentFinalizedState hash._ - -### currentFinalizedShnarf - -```solidity -bytes32 currentFinalizedShnarf -``` - -Contains the most recent finalized shnarf. - -### blobShnarfExists - -```solidity -mapping(bytes32 => uint256) blobShnarfExists -``` - -_NB: THIS IS THE ONLY MAPPING BEING USED FOR DATA SUBMISSION TRACKING. -NB: This was shnarfFinalBlockNumbers and is replaced to indicate only that a shnarf exists with a value of 1._ - -### currentFinalizedState - -```solidity -bytes32 currentFinalizedState -``` - -Hash of the L2 computed L1 message number, rolling hash and finalized timestamp. - -### fallbackOperator - -```solidity -address fallbackOperator -``` - -The address of the fallback operator. - -_This address is granted the OPERATOR_ROLE after six months of finalization inactivity by the current operators._ - -### constructor - -```solidity -constructor() public -``` - -### initialize - -```solidity -function initialize(struct ILineaRollup.InitializationData _initializationData) external -``` - -Initializes LineaRollup and underlying service dependencies - used for new networks only. - -_DEFAULT_ADMIN_ROLE is set for the security council. -OPERATOR_ROLE is set for operators. -Note: This is used for new testnets and local/CI testing, and will not replace existing proxy based contracts._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _initializationData | struct ILineaRollup.InitializationData | The initial data used for proof verification. | - -### reinitializeLineaRollupV6 - -```solidity -function reinitializeLineaRollupV6(struct IPermissionsManager.RoleAddress[] _roleAddresses, struct IPauseManager.PauseTypeRole[] _pauseTypeRoles, struct IPauseManager.PauseTypeRole[] _unpauseTypeRoles, address _fallbackOperator) external -``` - -Sets permissions for a list of addresses and their roles as well as initialises the PauseManager pauseType:role mappings and fallback operator. - -_This function is a reinitializer and can only be called once per version. Should be called using an upgradeAndCall transaction to the ProxyAdmin._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _roleAddresses | struct IPermissionsManager.RoleAddress[] | The list of addresses and roles to assign permissions to. | -| _pauseTypeRoles | struct IPauseManager.PauseTypeRole[] | The list of pause types to associate with roles. | -| _unpauseTypeRoles | struct IPauseManager.PauseTypeRole[] | The list of unpause types to associate with roles. | -| _fallbackOperator | address | The address of the fallback operator. | - -### renounceRole - -```solidity -function renounceRole(bytes32 _role, address _account) public -``` - -Revokes `role` from the calling account. - -_Fallback operator cannot renounce role. Reverts with OnlyNonFallbackOperator._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _role | bytes32 | The role to renounce. | -| _account | address | The account to renounce - can only be the _msgSender(). | - -### setVerifierAddress - -```solidity -function setVerifierAddress(address _newVerifierAddress, uint256 _proofType) external -``` - -Adds or updates the verifier contract address for a proof type. - -_VERIFIER_SETTER_ROLE is required to execute._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _newVerifierAddress | address | The address for the verifier contract. | -| _proofType | uint256 | The proof type being set/updated. | - -### setFallbackOperator - -```solidity -function setFallbackOperator(uint256 _messageNumber, bytes32 _rollingHash, uint256 _lastFinalizedTimestamp) external -``` - -Sets the fallback operator role to the specified address if six months have passed since the last finalization. - -_Reverts if six months have not passed since the last finalization._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _messageNumber | uint256 | Last finalized L1 message number as part of the feedback loop. | -| _rollingHash | bytes32 | Last finalized L1 rolling hash as part of the feedback loop. | -| _lastFinalizedTimestamp | uint256 | Last finalized L2 block timestamp. | - -### unsetVerifierAddress - -```solidity -function unsetVerifierAddress(uint256 _proofType) external -``` - -Unset the verifier contract address for a proof type. - -_VERIFIER_UNSETTER_ROLE is required to execute._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _proofType | uint256 | The proof type being set/updated. | - -### submitBlobs - -```solidity -function submitBlobs(struct ILineaRollup.BlobSubmission[] _blobSubmissions, bytes32 _parentShnarf, bytes32 _finalBlobShnarf) external -``` - -Submit one or more EIP-4844 blobs. - -_OPERATOR_ROLE is required to execute. -This should be a blob carrying transaction._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _blobSubmissions | struct ILineaRollup.BlobSubmission[] | The data for blob submission including proofs and required polynomials. | -| _parentShnarf | bytes32 | The parent shnarf used in continuity checks as it includes the parentStateRootHash in its computation. | -| _finalBlobShnarf | bytes32 | The expected final shnarf post computation of all the blob shnarfs. | - -### submitDataAsCalldata - -```solidity -function submitDataAsCalldata(struct ILineaRollup.CompressedCalldataSubmission _submission, bytes32 _parentShnarf, bytes32 _expectedShnarf) external -``` - -Submit blobs using compressed data via calldata. - -_OPERATOR_ROLE is required to execute._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _submission | struct ILineaRollup.CompressedCalldataSubmission | The supporting data for compressed data submission including compressed data. | -| _parentShnarf | bytes32 | The parent shnarf used in continuity checks as it includes the parentStateRootHash in its computation. | -| _expectedShnarf | bytes32 | The expected shnarf post computation of all the submission. | - -### _computeLastFinalizedState - -```solidity -function _computeLastFinalizedState(uint256 _messageNumber, bytes32 _rollingHash, uint256 _timestamp) internal pure returns (bytes32 hashedFinalizationState) -``` - -Internal function to compute and save the finalization state. - -_Using assembly this way is cheaper gas wise._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _messageNumber | uint256 | Is the last L2 computed L1 message number in the finalization. | -| _rollingHash | bytes32 | Is the last L2 computed L1 rolling hash in the finalization. | -| _timestamp | uint256 | The final timestamp in the finalization. | - -### _computeShnarf - -```solidity -function _computeShnarf(bytes32 _parentShnarf, bytes32 _snarkHash, bytes32 _finalStateRootHash, bytes32 _dataEvaluationPoint, bytes32 _dataEvaluationClaim) internal pure returns (bytes32 shnarf) -``` - -Internal function to compute the shnarf more efficiently. - -_Using assembly this way is cheaper gas wise._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _parentShnarf | bytes32 | The shnarf of the parent data item. | -| _snarkHash | bytes32 | Is the computed hash for compressed data (using a SNARK-friendly hash function) that aggregates per data submission to be used in public input. | -| _finalStateRootHash | bytes32 | The final state root hash of the data being submitted. | -| _dataEvaluationPoint | bytes32 | The data evaluation point. | -| _dataEvaluationClaim | bytes32 | The data evaluation claim. | - -### _verifyPointEvaluation - -```solidity -function _verifyPointEvaluation(bytes32 _currentDataHash, uint256 _dataEvaluationPoint, uint256 _dataEvaluationClaim, bytes _kzgCommitment, bytes _kzgProof) internal view -``` - -Performs point evaluation for the compressed blob. - -__dataEvaluationPoint is modular reduced to be lower than the BLS_CURVE_MODULUS for precompile checks._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _currentDataHash | bytes32 | The current blob versioned hash. | -| _dataEvaluationPoint | uint256 | The data evaluation point. | -| _dataEvaluationClaim | uint256 | The data evaluation claim. | -| _kzgCommitment | bytes | The blob KZG commitment. | -| _kzgProof | bytes | The blob KZG point proof. | - -### finalizeBlocks - -```solidity -function finalizeBlocks(bytes _aggregatedProof, uint256 _proofType, struct ILineaRollup.FinalizationDataV3 _finalizationData) external -``` - -Finalize compressed blocks with proof. - -_OPERATOR_ROLE is required to execute._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _aggregatedProof | bytes | The aggregated proof. | -| _proofType | uint256 | The proof type. | -| _finalizationData | struct ILineaRollup.FinalizationDataV3 | The full finalization data. | - -### _finalizeBlocks - -```solidity -function _finalizeBlocks(struct ILineaRollup.FinalizationDataV3 _finalizationData, uint256 _lastFinalizedBlock) internal returns (bytes32 finalShnarf) -``` - -Internal function to finalize compressed blocks. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _finalizationData | struct ILineaRollup.FinalizationDataV3 | The full finalization data. | -| _lastFinalizedBlock | uint256 | The last finalized block. | - -#### Return Values - -| Name | Type | Description | -| ---- | ---- | ----------- | -| finalShnarf | bytes32 | The final computed shnarf in finalizing. | - -### _validateL2ComputedRollingHash - -```solidity -function _validateL2ComputedRollingHash(uint256 _rollingHashMessageNumber, bytes32 _rollingHash) internal view -``` - -Internal function to validate l1 rolling hash. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _rollingHashMessageNumber | uint256 | Message number associated with the rolling hash as computed on L2. | -| _rollingHash | bytes32 | L1 rolling hash as computed on L2. | - -### _calculateY - -```solidity -function _calculateY(bytes _data, bytes32 _dataEvaluationPoint) internal pure returns (bytes32 compressedDataComputedY) -``` - -Internal function to calculate Y for public input generation. - -_Each chunk of 32 bytes must start with a 0 byte. -The dataEvaluationPoint value is modulo-ed down during the computation and scalar field checking is not needed. -There is a hard constraint in the circuit to enforce the polynomial degree limit (4096), which will also be enforced with EIP-4844._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _data | bytes | Compressed data from submission data. | -| _dataEvaluationPoint | bytes32 | The data evaluation point. | - -#### Return Values - -| Name | Type | Description | -| ---- | ---- | ----------- | -| compressedDataComputedY | bytes32 | The Y calculated value using the Horner method. | - 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/rollup/ZkEvmV2.md b/contracts/docs/api/rollup/ZkEvmV2.md deleted file mode 100644 index c74fc6891..000000000 --- a/contracts/docs/api/rollup/ZkEvmV2.md +++ /dev/null @@ -1,64 +0,0 @@ -# `ZkEvmV2` - -### MODULO_R - -```solidity -uint256 MODULO_R -``` - -### OPERATOR_ROLE - -```solidity -bytes32 OPERATOR_ROLE -``` - -### currentTimestamp - -```solidity -uint256 currentTimestamp -``` - -_DEPRECATED in favor of currentFinalizedState hash._ - -### currentL2BlockNumber - -```solidity -uint256 currentL2BlockNumber -``` - -The most recent finalized L2 block number. - -### stateRootHashes - -```solidity -mapping(uint256 => bytes32) stateRootHashes -``` - -The most recent L2 state root hash mapped by block number. - -### verifiers - -```solidity -mapping(uint256 => address) verifiers -``` - -The verifier address to use for a proof type when proving. - -### _verifyProof - -```solidity -function _verifyProof(uint256 _publicInput, uint256 _proofType, bytes _proof) internal -``` - -Verifies the proof with locally computed public inputs. - -_If the verifier based on proof type is not found, it reverts with InvalidProofType._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _publicInput | uint256 | The computed public input hash cast as uint256. | -| _proofType | uint256 | The proof type to determine which verifier contract to use. | -| _proof | bytes | The proof to be verified with the proof type verifier contract. | - 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/rollup/interfaces/ILineaRollup.md b/contracts/docs/api/rollup/interfaces/ILineaRollup.md deleted file mode 100644 index 62e8e3944..000000000 --- a/contracts/docs/api/rollup/interfaces/ILineaRollup.md +++ /dev/null @@ -1,505 +0,0 @@ -# `ILineaRollup` - -### InitializationData - -Initialization data structure for the LineaRollup contract. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | - -```solidity -struct InitializationData { - bytes32 initialStateRootHash; - uint256 initialL2BlockNumber; - uint256 genesisTimestamp; - address defaultVerifier; - uint256 rateLimitPeriodInSeconds; - uint256 rateLimitAmountInWei; - struct IPermissionsManager.RoleAddress[] roleAddresses; - struct IPauseManager.PauseTypeRole[] pauseTypeRoles; - struct IPauseManager.PauseTypeRole[] unpauseTypeRoles; - address fallbackOperator; - address defaultAdmin; -} -``` - -### CompressedCalldataSubmission - -Supporting data for compressed calldata submission including compressed data. - -_finalStateRootHash is used to set state root at the end of the data. -snarkHash is the computed hash for compressed data (using a SNARK-friendly hash function) that aggregates per data submission to be used in public input. -compressedData is the compressed transaction data. It contains ordered data for each L2 block - l2Timestamps, the encoded transaction data._ - -```solidity -struct CompressedCalldataSubmission { - bytes32 finalStateRootHash; - bytes32 snarkHash; - bytes compressedData; -} -``` - -### ShnarfData - -Shnarf data for validating a shnarf. - -_parentShnarf is the parent computed shnarf. -snarkHash is the computed hash for compressed data (using a SNARK-friendly hash function) that aggregates per data submission to be used in public input. -finalStateRootHash is the final state root hash. -dataEvaluationPoint is the data evaluation point. -dataEvaluationClaim is the data evaluation claim._ - -```solidity -struct ShnarfData { - bytes32 parentShnarf; - bytes32 snarkHash; - bytes32 finalStateRootHash; - bytes32 dataEvaluationPoint; - bytes32 dataEvaluationClaim; -} -``` - -### BlobSubmission - -Data stucture for compressed blob data submission. - -_submissionData The supporting data for blob data submission excluding the compressed data. -dataEvaluationClaim The data evaluation claim. -kzgCommitment The blob KZG commitment. -kzgProof The blob KZG point proof._ - -```solidity -struct BlobSubmission { - uint256 dataEvaluationClaim; - bytes kzgCommitment; - bytes kzgProof; - bytes32 finalStateRootHash; - bytes32 snarkHash; -} -``` - -### FinalizationDataV3 - -Supporting data for finalization with proof. - -_NB: the dynamic sized fields are placed last on purpose for efficient keccaking on public input. -parentStateRootHash is the expected last state root hash finalized. -endBlockNumber is the end block finalizing until. -shnarfData contains data about the last data submission's shnarf used in finalization. -lastFinalizedTimestamp is the expected last finalized block's timestamp. -finalTimestamp is the timestamp of the last block being finalized. -lastFinalizedL1RollingHash is the last stored L2 computed rolling hash used in finalization. -l1RollingHash is the calculated rolling hash on L2 that is expected to match L1 at l1RollingHashMessageNumber. -This value will be used along with the stored last finalized L2 calculated rolling hash in the public input. -lastFinalizedL1RollingHashMessageNumber is the last stored L2 computed message number used in finalization. -l1RollingHashMessageNumber is the calculated message number on L2 that is expected to match the existing L1 rolling hash. -This value will be used along with the stored last finalized L2 calculated message number in the public input. -l2MerkleTreesDepth is the depth of all l2MerkleRoots. -l2MerkleRoots is an array of L2 message Merkle roots of depth l2MerkleTreesDepth between last finalized block and finalSubmissionData.finalBlockNumber. -l2MessagingBlocksOffsets indicates by offset from currentL2BlockNumber which L2 blocks contain MessageSent events._ - -```solidity -struct FinalizationDataV3 { - bytes32 parentStateRootHash; - uint256 endBlockNumber; - struct ILineaRollup.ShnarfData shnarfData; - uint256 lastFinalizedTimestamp; - uint256 finalTimestamp; - bytes32 lastFinalizedL1RollingHash; - bytes32 l1RollingHash; - uint256 lastFinalizedL1RollingHashMessageNumber; - uint256 l1RollingHashMessageNumber; - uint256 l2MerkleTreesDepth; - bytes32[] l2MerkleRoots; - bytes l2MessagingBlocksOffsets; -} -``` - -### LineaRollupVersionChanged - -```solidity -event LineaRollupVersionChanged(bytes8 previousVersion, bytes8 newVersion) -``` - -Emitted when the LineaRollup contract version has changed. - -_All bytes8 values are string based SemVer in the format M.m - e.g. "6.0"._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| previousVersion | bytes8 | The previous version. | -| newVersion | bytes8 | The new version. | - -### FallbackOperatorRoleGranted - -```solidity -event FallbackOperatorRoleGranted(address caller, address fallbackOperator) -``` - -Emitted when the fallback operator role is granted. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| caller | address | The address that called the function granting the role. | -| fallbackOperator | address | The fallback operator address that received the operator role. | - -### FallbackOperatorAddressSet - -```solidity -event FallbackOperatorAddressSet(address caller, address fallbackOperator) -``` - -Emitted when the fallback operator role is set on the contract. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| caller | address | The address that set the fallback operator address. | -| fallbackOperator | address | The fallback operator address. | - -### VerifierAddressChanged - -```solidity -event VerifierAddressChanged(address verifierAddress, uint256 proofType, address verifierSetBy, address oldVerifierAddress) -``` - -Emitted when a verifier is set for a particular proof type. - -_The verifier will be set by an account with the VERIFIER_SETTER_ROLE. Typically the Safe. -The oldVerifierAddress can be the zero address._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| verifierAddress | address | The indexed new verifier address being set. | -| proofType | uint256 | The indexed proof type/index that the verifier is mapped to. | -| verifierSetBy | address | The index address who set the verifier at the mapping. | -| oldVerifierAddress | address | Indicates the previous address mapped to the proof type. | - -### DataSubmittedV3 - -```solidity -event DataSubmittedV3(bytes32 parentShnarf, bytes32 shnarf, bytes32 finalStateRootHash) -``` - -Emitted when compressed data is being submitted and verified succesfully on L1. - -_The block range is indexed and parent shnarf included for state reconstruction simplicity._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| parentShnarf | bytes32 | The parent shnarf for the data being submitted. | -| shnarf | bytes32 | The indexed shnarf for the data being submitted. | -| finalStateRootHash | bytes32 | The L2 state root hash that the current blob submission ends on. NB: The last blob in the collection. | - -### DataFinalizedV3 - -```solidity -event DataFinalizedV3(uint256 startBlockNumber, uint256 endBlockNumber, bytes32 shnarf, bytes32 parentStateRootHash, bytes32 finalStateRootHash) -``` - -Emitted when L2 blocks have been finalized on L1. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| startBlockNumber | uint256 | The indexed L2 block number indicating which block the finalization the data starts from. | -| endBlockNumber | uint256 | The indexed L2 block number indicating which block the finalization the data ends on. | -| shnarf | bytes32 | The indexed shnarf being set as currentFinalizedShnarf in the current finalization. | -| parentStateRootHash | bytes32 | The parent L2 state root hash that the current finalization starts from. | -| finalStateRootHash | bytes32 | The L2 state root hash that the current finalization ends on. | - -### LastFinalizationTimeNotLapsed - -```solidity -error LastFinalizationTimeNotLapsed() -``` - -_Thrown when the last finalization time has not lapsed when trying to grant the OPERATOR_ROLE to the fallback operator address._ - -### PointEvaluationResponseInvalid - -```solidity -error PointEvaluationResponseInvalid(uint256 fieldElements, uint256 blsCurveModulus) -``` - -_Thrown when the point evaluation precompile's call return data field(s) are wrong._ - -### PrecompileReturnDataLengthWrong - -```solidity -error PrecompileReturnDataLengthWrong(uint256 expected, uint256 actual) -``` - -_Thrown when the point evaluation precompile's call return data length is wrong._ - -### PointEvaluationFailed - -```solidity -error PointEvaluationFailed() -``` - -_Thrown when the point evaluation precompile call returns false._ - -### EmptyBlobDataAtIndex - -```solidity -error EmptyBlobDataAtIndex(uint256 index) -``` - -_Thrown when the blobhash at an index equals to the zero hash._ - -### BlobSubmissionDataIsMissing - -```solidity -error BlobSubmissionDataIsMissing() -``` - -_Thrown when the data for multiple blobs submission has length zero._ - -### BlobSubmissionDataEmpty - -```solidity -error BlobSubmissionDataEmpty(uint256 emptyBlobIndex) -``` - -_Thrown when a blob has been submitted but there is no data for it._ - -### DataAlreadySubmitted - -```solidity -error DataAlreadySubmitted(bytes32 currentDataHash) -``` - -_Thrown when the current data was already submitted._ - -### EmptySubmissionData - -```solidity -error EmptySubmissionData() -``` - -_Thrown when submissionData is empty._ - -### L1RollingHashDoesNotExistOnL1 - -```solidity -error L1RollingHashDoesNotExistOnL1(uint256 messageNumber, bytes32 rollingHash) -``` - -_Thrown when finalizationData.l1RollingHash does not exist on L1 (Feedback loop)._ - -### FinalizationStateIncorrect - -```solidity -error FinalizationStateIncorrect(bytes32 expected, bytes32 value) -``` - -_Thrown when finalization state does not match._ - -### FinalBlockNumberLessThanOrEqualToLastFinalizedBlock - -```solidity -error FinalBlockNumberLessThanOrEqualToLastFinalizedBlock(uint256 finalBlockNumber, uint256 lastFinalizedBlock) -``` - -_Thrown when the final block number in finalization data is less than or equal to the last finalized block during finalization._ - -### FinalBlockStateEqualsZeroHash - -```solidity -error FinalBlockStateEqualsZeroHash() -``` - -_Thrown when the final block state equals the zero hash during finalization._ - -### FinalizationInTheFuture - -```solidity -error FinalizationInTheFuture(uint256 l2BlockTimestamp, uint256 currentBlockTimestamp) -``` - -_Thrown when final l2 block timestamp higher than current block.timestamp during finalization._ - -### MissingMessageNumberForRollingHash - -```solidity -error MissingMessageNumberForRollingHash(bytes32 rollingHash) -``` - -_Thrown when a rolling hash is provided without a corresponding message number._ - -### MissingRollingHashForMessageNumber - -```solidity -error MissingRollingHashForMessageNumber(uint256 messageNumber) -``` - -_Thrown when a message number is provided without a corresponding rolling hash._ - -### FirstByteIsNotZero - -```solidity -error FirstByteIsNotZero() -``` - -_Thrown when the first byte is not zero. -This is used explicitly with the four bytes in assembly 0x729eebce._ - -### BytesLengthNotMultipleOf32 - -```solidity -error BytesLengthNotMultipleOf32() -``` - -_Thrown when bytes length is not a multiple of 32._ - -### FinalShnarfWrong - -```solidity -error FinalShnarfWrong(bytes32 expected, bytes32 value) -``` - -_Thrown when the computed shnarf does not match what is expected._ - -### ParentBlobNotSubmitted - -```solidity -error ParentBlobNotSubmitted(bytes32 shnarf) -``` - -_Thrown when a shnarf does not exist for a parent blob._ - -### FinalBlobNotSubmitted - -```solidity -error FinalBlobNotSubmitted(bytes32 shnarf) -``` - -_Thrown when a shnarf does not exist for the final blob being finalized._ - -### OnlyNonFallbackOperator - -```solidity -error OnlyNonFallbackOperator() -``` - -_Thrown when the fallback operator tries to renounce their operator role._ - -### setVerifierAddress - -```solidity -function setVerifierAddress(address _newVerifierAddress, uint256 _proofType) external -``` - -Adds or updates the verifier contract address for a proof type. - -_VERIFIER_SETTER_ROLE is required to execute._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _newVerifierAddress | address | The address for the verifier contract. | -| _proofType | uint256 | The proof type being set/updated. | - -### setFallbackOperator - -```solidity -function setFallbackOperator(uint256 _messageNumber, bytes32 _rollingHash, uint256 _lastFinalizedTimestamp) external -``` - -Sets the fallback operator role to the specified address if six months have passed since the last finalization. - -_Reverts if six months have not passed since the last finalization._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _messageNumber | uint256 | Last finalized L1 message number as part of the feedback loop. | -| _rollingHash | bytes32 | Last finalized L1 rolling hash as part of the feedback loop. | -| _lastFinalizedTimestamp | uint256 | Last finalized L2 block timestamp. | - -### unsetVerifierAddress - -```solidity -function unsetVerifierAddress(uint256 _proofType) external -``` - -Unsets the verifier contract address for a proof type. - -_VERIFIER_UNSETTER_ROLE is required to execute._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _proofType | uint256 | The proof type being set/updated. | - -### submitBlobs - -```solidity -function submitBlobs(struct ILineaRollup.BlobSubmission[] _blobSubmissions, bytes32 _parentShnarf, bytes32 _finalBlobShnarf) external -``` - -Submit one or more EIP-4844 blobs. - -_OPERATOR_ROLE is required to execute. -This should be a blob carrying transaction._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _blobSubmissions | struct ILineaRollup.BlobSubmission[] | The data for blob submission including proofs and required polynomials. | -| _parentShnarf | bytes32 | The parent shnarf used in continuity checks as it includes the parentStateRootHash in its computation. | -| _finalBlobShnarf | bytes32 | The expected final shnarf post computation of all the blob shnarfs. | - -### submitDataAsCalldata - -```solidity -function submitDataAsCalldata(struct ILineaRollup.CompressedCalldataSubmission _submission, bytes32 _parentShnarf, bytes32 _expectedShnarf) external -``` - -Submit blobs using compressed data via calldata. - -_OPERATOR_ROLE is required to execute._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _submission | struct ILineaRollup.CompressedCalldataSubmission | The supporting data for compressed data submission including compressed data. | -| _parentShnarf | bytes32 | The parent shnarf used in continuity checks as it includes the parentStateRootHash in its computation. | -| _expectedShnarf | bytes32 | The expected shnarf post computation of all the submission. | - -### finalizeBlocks - -```solidity -function finalizeBlocks(bytes _aggregatedProof, uint256 _proofType, struct ILineaRollup.FinalizationDataV3 _finalizationData) external -``` - -Finalize compressed blocks with proof. - -_OPERATOR_ROLE is required to execute._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _aggregatedProof | bytes | The aggregated proof. | -| _proofType | uint256 | The proof type. | -| _finalizationData | struct ILineaRollup.FinalizationDataV3 | The full finalization data. | - 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/rollup/interfaces/IZkEvmV2.md b/contracts/docs/api/rollup/interfaces/IZkEvmV2.md deleted file mode 100644 index 1e9d3bd42..000000000 --- a/contracts/docs/api/rollup/interfaces/IZkEvmV2.md +++ /dev/null @@ -1,42 +0,0 @@ -# `IZkEvmV2` - -### StartingRootHashDoesNotMatch - -```solidity -error StartingRootHashDoesNotMatch() -``` - -_Thrown when the starting rootHash does not match the existing state._ - -### ProofIsEmpty - -```solidity -error ProofIsEmpty() -``` - -_Thrown when zk proof is empty bytes._ - -### InvalidProofType - -```solidity -error InvalidProofType() -``` - -_Thrown when zk proof type is invalid._ - -### InvalidProof - -```solidity -error InvalidProof() -``` - -_Thrown when zk proof is invalid._ - -### InvalidProofOrProofVerificationRanOutOfGas - -```solidity -error InvalidProofOrProofVerificationRanOutOfGas(string errorReason) -``` - -_Thrown when the call to the verifier runs out of gas or reverts internally._ - 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/security/access/PermissionsManager.md b/contracts/docs/api/security/access/PermissionsManager.md deleted file mode 100644 index 23f9a7432..000000000 --- a/contracts/docs/api/security/access/PermissionsManager.md +++ /dev/null @@ -1,16 +0,0 @@ -# `PermissionsManager` - -### __Permissions_init - -```solidity -function __Permissions_init(struct IPermissionsManager.RoleAddress[] _roleAddresses) internal -``` - -Sets permissions for a list of addresses and their roles. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _roleAddresses | struct IPermissionsManager.RoleAddress[] | The list of addresses and roles to assign permissions to. | - diff --git a/contracts/docs/api/security/pausing/PermissionsManager.mdx b/contracts/docs/api/security/access/PermissionsManager.mdx similarity index 100% rename from contracts/docs/api/security/pausing/PermissionsManager.mdx rename to contracts/docs/api/security/access/PermissionsManager.mdx diff --git a/contracts/docs/api/security/access/interfaces/IPermissionsManager.md b/contracts/docs/api/security/access/interfaces/IPermissionsManager.md deleted file mode 100644 index c7b189b79..000000000 --- a/contracts/docs/api/security/access/interfaces/IPermissionsManager.md +++ /dev/null @@ -1,11 +0,0 @@ -# `IPermissionsManager` - -### RoleAddress - -```solidity -struct RoleAddress { - address addressWithRole; - bytes32 role; -} -``` - 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/security/limiting/RateLimiter.md b/contracts/docs/api/security/limiting/RateLimiter.md deleted file mode 100644 index d5f9f44ef..000000000 --- a/contracts/docs/api/security/limiting/RateLimiter.md +++ /dev/null @@ -1,111 +0,0 @@ -# `RateLimiter` - -You can use this control numeric limits over a period using timestamp. - -### RATE_LIMIT_SETTER_ROLE - -```solidity -bytes32 RATE_LIMIT_SETTER_ROLE -``` - -### USED_RATE_LIMIT_RESETTER_ROLE - -```solidity -bytes32 USED_RATE_LIMIT_RESETTER_ROLE -``` - -### periodInSeconds - -```solidity -uint256 periodInSeconds -``` - -### limitInWei - -```solidity -uint256 limitInWei -``` - -### currentPeriodEnd - -```solidity -uint256 currentPeriodEnd -``` - -The time at which the current period ends at. - -_Public for ease of consumption._ - -### currentPeriodAmountInWei - -```solidity -uint256 currentPeriodAmountInWei -``` - -Amounts already withdrawn this period. - -_Public for ease of consumption._ - -### __RateLimiter_init - -```solidity -function __RateLimiter_init(uint256 _periodInSeconds, uint256 _limitInWei) internal -``` - -Initialises the limits and period for the rate limiter. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _periodInSeconds | uint256 | The length of the period in seconds. | -| _limitInWei | uint256 | The limit allowed in the period in Wei. | - -### _addUsedAmount - -```solidity -function _addUsedAmount(uint256 _usedAmount) internal -``` - -Increments the amount used in the period. - -_The amount determining logic is external to this (e.g. fees are included when calling here). -Ignores the calculation if _usedAmount is zero. -Reverts if the limit is breached._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _usedAmount | uint256 | The amount used to be added. | - -### resetRateLimitAmount - -```solidity -function resetRateLimitAmount(uint256 _amount) external -``` - -Resets the rate limit amount. - -_If the used amount is higher, it is set to the limit to avoid confusion/issues. -Only the RATE_LIMIT_SETTER_ROLE is allowed to execute this function. -Emits the LimitAmountChanged event. -usedLimitAmountToSet will use the default value of zero if period has expired._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _amount | uint256 | The amount to reset the limit to. | - -### resetAmountUsedInPeriod - -```solidity -function resetAmountUsedInPeriod() external -``` - -Resets the amount used to zero. - -_Only the USED_RATE_LIMIT_RESETTER_ROLE is allowed to execute this function. -Emits the AmountUsedInPeriodReset event._ - diff --git a/contracts/docs/api/messaging/libraries/RateLimiter.mdx b/contracts/docs/api/security/limiting/RateLimiter.mdx similarity index 100% rename from contracts/docs/api/messaging/libraries/RateLimiter.mdx rename to contracts/docs/api/security/limiting/RateLimiter.mdx diff --git a/contracts/docs/api/security/limiting/interfaces/IRateLimiter.md b/contracts/docs/api/security/limiting/interfaces/IRateLimiter.md deleted file mode 100644 index 17db2b885..000000000 --- a/contracts/docs/api/security/limiting/interfaces/IRateLimiter.md +++ /dev/null @@ -1,106 +0,0 @@ -# `IRateLimiter` - -### RateLimitInitialized - -```solidity -event RateLimitInitialized(uint256 periodInSeconds, uint256 limitInWei, uint256 currentPeriodEnd) -``` - -Emitted when the Rate Limit is initialized. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| periodInSeconds | uint256 | The time period in seconds the rate limiter has been initialized to. | -| limitInWei | uint256 | The limit in Wei the rate limiter has been initialized to. | -| currentPeriodEnd | uint256 | The time the current rate limit period will end. | - -### AmountUsedInPeriodReset - -```solidity -event AmountUsedInPeriodReset(address resettingAddress) -``` - -Emitted when the amount in the period is reset to zero. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| resettingAddress | address | The indexed address of who reset the used amount back to zero. | - -### LimitAmountChanged - -```solidity -event LimitAmountChanged(address amountChangeBy, uint256 amount, bool amountUsedLoweredToLimit, bool usedAmountResetToZero) -``` - -Emitted when the limit is changed. - -_If the current used amount is higher than the new limit, the used amount is lowered to the limit. -amountUsedLoweredToLimit and usedAmountResetToZero cannot be true at the same time._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| amountChangeBy | address | The indexed address of who changed the rate limit. | -| amount | uint256 | The rate limited amount in Wei that was set. | -| amountUsedLoweredToLimit | bool | Indicates if the amount used was lowered to the limit to avoid confusion. | -| usedAmountResetToZero | bool | Indicates if the amount used was set to zero because of the current period expiring. | - -### RateLimitExceeded - -```solidity -error RateLimitExceeded() -``` - -_Thrown when an amount breaches the limit in the period._ - -### PeriodIsZero - -```solidity -error PeriodIsZero() -``` - -_Thrown when the period is initialised to zero._ - -### LimitIsZero - -```solidity -error LimitIsZero() -``` - -_Thrown when the limit is initialised to zero._ - -### resetRateLimitAmount - -```solidity -function resetRateLimitAmount(uint256 _amount) external -``` - -Resets the rate limit amount. - -_If the used amount is higher, it is set to the limit to avoid confusion/issues. -Only the RATE_LIMIT_SETTER_ROLE is allowed to execute this function. -Emits the LimitAmountChanged event. -usedLimitAmountToSet will use the default value of zero if period has expired._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _amount | uint256 | The amount to reset the limit to. | - -### resetAmountUsedInPeriod - -```solidity -function resetAmountUsedInPeriod() external -``` - -Resets the amount used to zero. - -_Only the USED_RATE_LIMIT_RESETTER_ROLE is allowed to execute this function. -Emits the AmountUsedInPeriodReset event._ - 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/security/pausing/CallForwardingProxy.mdx b/contracts/docs/api/security/pausing/CallForwardingProxy.mdx deleted file mode 100644 index 0464089fd..000000000 --- a/contracts/docs/api/security/pausing/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/security/pausing/L2MessageServicePauseManager.md b/contracts/docs/api/security/pausing/L2MessageServicePauseManager.md deleted file mode 100644 index ff78dbccf..000000000 --- a/contracts/docs/api/security/pausing/L2MessageServicePauseManager.md +++ /dev/null @@ -1,34 +0,0 @@ -# `L2MessageServicePauseManager` - -### PAUSE_L1_L2_ROLE - -```solidity -bytes32 PAUSE_L1_L2_ROLE -``` - -This is used to pause L1 to L2 communication. - -### UNPAUSE_L1_L2_ROLE - -```solidity -bytes32 UNPAUSE_L1_L2_ROLE -``` - -This is used to unpause L1 to L2 communication. - -### PAUSE_L2_L1_ROLE - -```solidity -bytes32 PAUSE_L2_L1_ROLE -``` - -This is used to pause L2 to L1 communication. - -### UNPAUSE_L2_L1_ROLE - -```solidity -bytes32 UNPAUSE_L2_L1_ROLE -``` - -This is used to unpause L2 to L1 communication. - diff --git a/contracts/docs/api/security/pausing/LineaRollupPauseManager.md b/contracts/docs/api/security/pausing/LineaRollupPauseManager.md deleted file mode 100644 index 3b308c7a3..000000000 --- a/contracts/docs/api/security/pausing/LineaRollupPauseManager.md +++ /dev/null @@ -1,66 +0,0 @@ -# `LineaRollupPauseManager` - -### PAUSE_L1_L2_ROLE - -```solidity -bytes32 PAUSE_L1_L2_ROLE -``` - -This is used to pause L1 to L2 communication. - -### UNPAUSE_L1_L2_ROLE - -```solidity -bytes32 UNPAUSE_L1_L2_ROLE -``` - -This is used to unpause L1 to L2 communication. - -### PAUSE_L2_L1_ROLE - -```solidity -bytes32 PAUSE_L2_L1_ROLE -``` - -This is used to pause L2 to L1 communication. - -### UNPAUSE_L2_L1_ROLE - -```solidity -bytes32 UNPAUSE_L2_L1_ROLE -``` - -This is used to unpause L2 to L1 communication. - -### PAUSE_BLOB_SUBMISSION_ROLE - -```solidity -bytes32 PAUSE_BLOB_SUBMISSION_ROLE -``` - -This is used to pause blob submission. - -### UNPAUSE_BLOB_SUBMISSION_ROLE - -```solidity -bytes32 UNPAUSE_BLOB_SUBMISSION_ROLE -``` - -This is used to unpause blob submission. - -### PAUSE_FINALIZATION_ROLE - -```solidity -bytes32 PAUSE_FINALIZATION_ROLE -``` - -This is used to pause finalization submission. - -### UNPAUSE_FINALIZATION_ROLE - -```solidity -bytes32 UNPAUSE_FINALIZATION_ROLE -``` - -This is used to unpause finalization submission. - diff --git a/contracts/docs/api/security/pausing/PauseManager.md b/contracts/docs/api/security/pausing/PauseManager.md deleted file mode 100644 index 8b85b7d9b..000000000 --- a/contracts/docs/api/security/pausing/PauseManager.md +++ /dev/null @@ -1,151 +0,0 @@ -# `PauseManager` - -### PAUSE_ALL_ROLE - -```solidity -bytes32 PAUSE_ALL_ROLE -``` - -This is used to pause all pausable functions. - -### UNPAUSE_ALL_ROLE - -```solidity -bytes32 UNPAUSE_ALL_ROLE -``` - -This is used to unpause all unpausable functions. - -### pauseTypeStatuses - -```solidity -mapping(bytes32 => bool) pauseTypeStatuses -``` - -### whenTypeAndGeneralNotPaused - -```solidity -modifier whenTypeAndGeneralNotPaused(enum IPauseManager.PauseType _pauseType) -``` - -_Modifier to make a function callable only when the specific and general types are not paused._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _pauseType | enum IPauseManager.PauseType | The pause type value being checked. Requirements: - The type must not be paused. | - -### whenTypeNotPaused - -```solidity -modifier whenTypeNotPaused(enum IPauseManager.PauseType _pauseType) -``` - -_Modifier to make a function callable only when the type is not paused._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _pauseType | enum IPauseManager.PauseType | The pause type value being checked. Requirements: - The type must not be paused. | - -### __PauseManager_init - -```solidity -function __PauseManager_init(struct IPauseManager.PauseTypeRole[] _pauseTypeRoleAssignments, struct IPauseManager.PauseTypeRole[] _unpauseTypeRoleAssignments) internal -``` - -Initializes the pause manager with the given pause and unpause roles. - -_This function is called during contract initialization to set up the pause and unpause roles._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _pauseTypeRoleAssignments | struct IPauseManager.PauseTypeRole[] | An array of PauseTypeRole structs defining the pause types and their associated roles. | -| _unpauseTypeRoleAssignments | struct IPauseManager.PauseTypeRole[] | An array of PauseTypeRole structs defining the unpause types and their associated roles. | - -### _requireTypeAndGeneralNotPaused - -```solidity -function _requireTypeAndGeneralNotPaused(enum IPauseManager.PauseType _pauseType) internal view virtual -``` - -_Throws if the specific or general types are paused. -Checks the specific and general pause types._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _pauseType | enum IPauseManager.PauseType | The pause type value being checked. | - -### _requireTypeNotPaused - -```solidity -function _requireTypeNotPaused(enum IPauseManager.PauseType _pauseType) internal view virtual -``` - -_Throws if the type is paused. -Checks the specific pause type._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _pauseType | enum IPauseManager.PauseType | The pause type value being checked. | - -### pauseByType - -```solidity -function pauseByType(enum IPauseManager.PauseType _pauseType) external -``` - -Pauses functionality by specific type. - -_Requires the role mapped in `_pauseTypeRoles` for the pauseType._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _pauseType | enum IPauseManager.PauseType | The pause type value. | - -### unPauseByType - -```solidity -function unPauseByType(enum IPauseManager.PauseType _pauseType) external -``` - -Unpauses functionality by specific type. - -_Requires the role mapped in `_unPauseTypeRoles` for the pauseType._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _pauseType | enum IPauseManager.PauseType | The pause type value. | - -### isPaused - -```solidity -function isPaused(enum IPauseManager.PauseType _pauseType) public view returns (bool pauseTypeIsPaused) -``` - -Check if a pause type is enabled. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _pauseType | enum IPauseManager.PauseType | The pause type value. | - -#### Return Values - -| Name | Type | Description | -| ---- | ---- | ----------- | -| pauseTypeIsPaused | bool | Returns true if the pause type if paused, false otherwise. | - diff --git a/contracts/docs/api/security/pausing/TokenBridgePauseManager.md b/contracts/docs/api/security/pausing/TokenBridgePauseManager.md deleted file mode 100644 index b0047aa76..000000000 --- a/contracts/docs/api/security/pausing/TokenBridgePauseManager.md +++ /dev/null @@ -1,26 +0,0 @@ -# `TokenBridgePauseManager` - -### PAUSE_INITIATE_TOKEN_BRIDGING_ROLE - -```solidity -bytes32 PAUSE_INITIATE_TOKEN_BRIDGING_ROLE -``` - -### UNPAUSE_INITIATE_TOKEN_BRIDGING_ROLE - -```solidity -bytes32 UNPAUSE_INITIATE_TOKEN_BRIDGING_ROLE -``` - -### PAUSE_COMPLETE_TOKEN_BRIDGING_ROLE - -```solidity -bytes32 PAUSE_COMPLETE_TOKEN_BRIDGING_ROLE -``` - -### UNPAUSE_COMPLETE_TOKEN_BRIDGING_ROLE - -```solidity -bytes32 UNPAUSE_COMPLETE_TOKEN_BRIDGING_ROLE -``` - diff --git a/contracts/docs/api/security/pausing/interfaces/IPauseManager.md b/contracts/docs/api/security/pausing/interfaces/IPauseManager.md deleted file mode 100644 index d09f221c0..000000000 --- a/contracts/docs/api/security/pausing/interfaces/IPauseManager.md +++ /dev/null @@ -1,155 +0,0 @@ -# `IPauseManager` - -### PauseTypeRole - -```solidity -struct PauseTypeRole { - enum IPauseManager.PauseType pauseType; - bytes32 role; -} -``` - -### PauseType - -```solidity -enum PauseType { - UNUSED, - GENERAL, - L1_L2, - L2_L1, - BLOB_SUBMISSION, - CALLDATA_SUBMISSION, - FINALIZATION, - INITIATE_TOKEN_BRIDGING, - COMPLETE_TOKEN_BRIDGING -} -``` - -### Paused - -```solidity -event Paused(address messageSender, enum IPauseManager.PauseType pauseType) -``` - -Emitted when a pause type is paused. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| messageSender | address | The address performing the pause. | -| pauseType | enum IPauseManager.PauseType | The indexed pause type that was paused. | - -### UnPaused - -```solidity -event UnPaused(address messageSender, enum IPauseManager.PauseType pauseType) -``` - -Emitted when a pause type is unpaused. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| messageSender | address | The address performing the unpause. | -| pauseType | enum IPauseManager.PauseType | The indexed pause type that was unpaused. | - -### PauseTypeRoleSet - -```solidity -event PauseTypeRoleSet(enum IPauseManager.PauseType pauseType, bytes32 role) -``` - -Emitted when a pause type and its associated role are set in the `_pauseTypeRoles` mapping. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| pauseType | enum IPauseManager.PauseType | The indexed type of pause. | -| role | bytes32 | The indexed role associated with the pause type. | - -### UnPauseTypeRoleSet - -```solidity -event UnPauseTypeRoleSet(enum IPauseManager.PauseType unPauseType, bytes32 role) -``` - -Emitted when an unpause type and its associated role are set in the `_unPauseTypeRoles` mapping. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| unPauseType | enum IPauseManager.PauseType | The indexed type of unpause. | -| role | bytes32 | The indexed role associated with the unpause type. | - -### IsPaused - -```solidity -error IsPaused(enum IPauseManager.PauseType pauseType) -``` - -_Thrown when a specific pause type is paused._ - -### IsNotPaused - -```solidity -error IsNotPaused(enum IPauseManager.PauseType pauseType) -``` - -_Thrown when a specific pause type is not paused and expected to be._ - -### pauseByType - -```solidity -function pauseByType(enum IPauseManager.PauseType _pauseType) external -``` - -Pauses functionality by specific type. - -_Requires the role mapped in pauseTypeRoles for the pauseType._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _pauseType | enum IPauseManager.PauseType | The pause type value. | - -### unPauseByType - -```solidity -function unPauseByType(enum IPauseManager.PauseType _pauseType) external -``` - -Unpauses functionality by specific type. - -_Requires the role mapped in unPauseTypeRoles for the pauseType._ - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _pauseType | enum IPauseManager.PauseType | The pause type value. | - -### isPaused - -```solidity -function isPaused(enum IPauseManager.PauseType _pauseType) external view returns (bool pauseTypeIsPaused) -``` - -Check if a pause type is enabled. - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| _pauseType | enum IPauseManager.PauseType | The pause type value. | - -#### Return Values - -| Name | Type | Description | -| ---- | ---- | ----------- | -| pauseTypeIsPaused | bool | Returns true if the pause type if paused, false otherwise. | - 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/security/reentrancy/TransientStorageReentrancyGuardUpgradeable.md b/contracts/docs/api/security/reentrancy/TransientStorageReentrancyGuardUpgradeable.md deleted file mode 100644 index 3d9fe9a6b..000000000 --- a/contracts/docs/api/security/reentrancy/TransientStorageReentrancyGuardUpgradeable.md +++ /dev/null @@ -1,14 +0,0 @@ -# `TransientStorageReentrancyGuardUpgradeable` - -### ReentrantCall - -```solidity -error ReentrantCall() -``` - -### nonReentrant - -```solidity -modifier nonReentrant() -``` - diff --git a/contracts/docs/api/messaging/l1/TransientStorageReentrancyGuardUpgradeable.mdx b/contracts/docs/api/security/reentrancy/TransientStorageReentrancyGuardUpgradeable.mdx similarity index 100% rename from contracts/docs/api/messaging/l1/TransientStorageReentrancyGuardUpgradeable.mdx rename to contracts/docs/api/security/reentrancy/TransientStorageReentrancyGuardUpgradeable.mdx