diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index cb7fefe7a..00fb4cd36 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -18,6 +18,9 @@ on: # '!**.md' will not work by itself to exclude *.md files. See https://github.com/orgs/community/discussions/25369 - '**' - '!**.md' + - '!**.mdx' + - '!**/docs/**' + - '!docs/**' jobs: analyze: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 10157b19e..67cb25043 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -120,6 +120,8 @@ jobs: filters: | has-changes-requiring-build: - '!**/*.md' + - '!**/*.mdx' + - '!**/docs/**' - '!docs/**' # Enables us to exclude changes in multiple file types if required predicate-quantifier: 'every' diff --git a/.github/workflows/run-smc-tests.yml b/.github/workflows/run-smc-tests.yml index e41e68e15..af94f3311 100644 --- a/.github/workflows/run-smc-tests.yml +++ b/.github/workflows/run-smc-tests.yml @@ -7,8 +7,10 @@ on: - 'testdata/**' - 'prover/**' - '!contracts/**/*.md' + - '!contracts/**/*.mdx' - '!testdata/**/*.md' - '!prover/**/*.md' + - '!**/docs/**' push: branches: - main @@ -17,8 +19,10 @@ on: - 'testdata/**' - 'prover/**' - '!contracts/**/*.md' + - '!contracts/**/*.mdx' - '!testdata/**/*.md' - '!prover/**/*.md' + - '!**/docs/**' env: GOPROXY: "https://proxy.golang.org" diff --git a/contracts/contracts/lib/SparseMerkleProof.sol b/contracts/contracts/lib/SparseMerkleProof.sol index dcc7b1287..5737d6748 100644 --- a/contracts/contracts/lib/SparseMerkleProof.sol +++ b/contracts/contracts/lib/SparseMerkleProof.sol @@ -79,7 +79,7 @@ library SparseMerkleProof { /** * @notice Hash a value using MIMC hash * @param _input Value to hash - * @return {bytes32} Mimc hash + * @return bytes32 Mimc hash */ function mimcHash(bytes calldata _input) external pure returns (bytes32) { return Mimc.hash(_input); @@ -106,7 +106,7 @@ library SparseMerkleProof { /** * @notice Hash account value * @param _value Encoded account value bytes (nonce, balance, storageRoot, mimcCodeHash, keccakCodeHash, codeSize) - * @return {bytes32} Account value hash + * @return bytes32 Account value hash */ function hashAccountValue(bytes calldata _value) external pure returns (bytes32) { Account memory account = _parseAccount(_value); @@ -128,7 +128,7 @@ library SparseMerkleProof { /** * @notice Hash storage value * @param _value Encoded storage value bytes - * @return {bytes32} Storage value hash + * @return bytes32 Storage value hash */ function hashStorageValue(bytes32 _value) external pure returns (bytes32) { (bytes32 msb, bytes32 lsb) = _splitBytes32(_value); diff --git a/contracts/docs/api/LineaRollup.md b/contracts/docs/api/LineaRollup.mdx similarity index 99% rename from contracts/docs/api/LineaRollup.md rename to contracts/docs/api/LineaRollup.mdx index d08021952..eb6319fab 100644 --- a/contracts/docs/api/LineaRollup.md +++ b/contracts/docs/api/LineaRollup.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## LineaRollup ### CONTRACT_VERSION diff --git a/contracts/docs/api/ZkEvmV2.md b/contracts/docs/api/ZkEvmV2.mdx similarity index 98% rename from contracts/docs/api/ZkEvmV2.md rename to contracts/docs/api/ZkEvmV2.mdx index a9c80d966..0eaaa5b18 100644 --- a/contracts/docs/api/ZkEvmV2.md +++ b/contracts/docs/api/ZkEvmV2.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## ZkEvmV2 ### MODULO_R diff --git a/contracts/docs/api/interfaces/IGenericErrors.md b/contracts/docs/api/interfaces/IGenericErrors.mdx similarity index 95% rename from contracts/docs/api/interfaces/IGenericErrors.md rename to contracts/docs/api/interfaces/IGenericErrors.mdx index e49b79007..76be1055a 100644 --- a/contracts/docs/api/interfaces/IGenericErrors.md +++ b/contracts/docs/api/interfaces/IGenericErrors.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## IGenericErrors ### ZeroAddressNotAllowed diff --git a/contracts/docs/api/interfaces/IMessageService.md b/contracts/docs/api/interfaces/IMessageService.mdx similarity index 99% rename from contracts/docs/api/interfaces/IMessageService.md rename to contracts/docs/api/interfaces/IMessageService.mdx index 87f849237..e4feafa25 100644 --- a/contracts/docs/api/interfaces/IMessageService.md +++ b/contracts/docs/api/interfaces/IMessageService.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## IMessageService ### MessageSent diff --git a/contracts/docs/api/interfaces/IPauseManager.md b/contracts/docs/api/interfaces/IPauseManager.mdx similarity index 99% rename from contracts/docs/api/interfaces/IPauseManager.md rename to contracts/docs/api/interfaces/IPauseManager.mdx index 462732ae9..4b54ba7f3 100644 --- a/contracts/docs/api/interfaces/IPauseManager.md +++ b/contracts/docs/api/interfaces/IPauseManager.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## IPauseManager ### PauseTypeRole diff --git a/contracts/docs/api/interfaces/IPermissionsManager.md b/contracts/docs/api/interfaces/IPermissionsManager.mdx similarity index 88% rename from contracts/docs/api/interfaces/IPermissionsManager.md rename to contracts/docs/api/interfaces/IPermissionsManager.mdx index a280d9184..87076845c 100644 --- a/contracts/docs/api/interfaces/IPermissionsManager.md +++ b/contracts/docs/api/interfaces/IPermissionsManager.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## IPermissionsManager ### RoleAddress diff --git a/contracts/docs/api/interfaces/IRateLimiter.md b/contracts/docs/api/interfaces/IRateLimiter.mdx similarity index 99% rename from contracts/docs/api/interfaces/IRateLimiter.md rename to contracts/docs/api/interfaces/IRateLimiter.mdx index f5683068c..0279a2bf7 100644 --- a/contracts/docs/api/interfaces/IRateLimiter.md +++ b/contracts/docs/api/interfaces/IRateLimiter.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## IRateLimiter ### RateLimitInitialized diff --git a/contracts/docs/api/interfaces/l1/IL1MessageManager.md b/contracts/docs/api/interfaces/l1/IL1MessageManager.mdx similarity index 99% rename from contracts/docs/api/interfaces/l1/IL1MessageManager.md rename to contracts/docs/api/interfaces/l1/IL1MessageManager.mdx index cf90c2a87..94f534673 100644 --- a/contracts/docs/api/interfaces/l1/IL1MessageManager.md +++ b/contracts/docs/api/interfaces/l1/IL1MessageManager.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## IL1MessageManager ### RollingHashUpdated diff --git a/contracts/docs/api/interfaces/l1/IL1MessageManagerV1.md b/contracts/docs/api/interfaces/l1/IL1MessageManagerV1.mdx similarity index 92% rename from contracts/docs/api/interfaces/l1/IL1MessageManagerV1.md rename to contracts/docs/api/interfaces/l1/IL1MessageManagerV1.mdx index f4283b8f7..85bbf7436 100644 --- a/contracts/docs/api/interfaces/l1/IL1MessageManagerV1.md +++ b/contracts/docs/api/interfaces/l1/IL1MessageManagerV1.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## IL1MessageManagerV1 ### MessageDoesNotExistOrHasAlreadyBeenClaimed diff --git a/contracts/docs/api/interfaces/l1/IL1MessageService.md b/contracts/docs/api/interfaces/l1/IL1MessageService.mdx similarity index 98% rename from contracts/docs/api/interfaces/l1/IL1MessageService.md rename to contracts/docs/api/interfaces/l1/IL1MessageService.mdx index 6b70ac418..e30c8c44c 100644 --- a/contracts/docs/api/interfaces/l1/IL1MessageService.md +++ b/contracts/docs/api/interfaces/l1/IL1MessageService.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## IL1MessageService ### ClaimMessageWithProofParams diff --git a/contracts/docs/api/interfaces/l1/ILineaRollup.md b/contracts/docs/api/interfaces/l1/ILineaRollup.mdx similarity index 99% rename from contracts/docs/api/interfaces/l1/ILineaRollup.md rename to contracts/docs/api/interfaces/l1/ILineaRollup.mdx index 747ccc2b8..6f02eba28 100644 --- a/contracts/docs/api/interfaces/l1/ILineaRollup.md +++ b/contracts/docs/api/interfaces/l1/ILineaRollup.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## ILineaRollup ### InitializationData diff --git a/contracts/docs/api/interfaces/l1/IPlonkVerifier.md b/contracts/docs/api/interfaces/l1/IPlonkVerifier.mdx similarity index 97% rename from contracts/docs/api/interfaces/l1/IPlonkVerifier.md rename to contracts/docs/api/interfaces/l1/IPlonkVerifier.mdx index 72ed2cd7b..04bfb736f 100644 --- a/contracts/docs/api/interfaces/l1/IPlonkVerifier.md +++ b/contracts/docs/api/interfaces/l1/IPlonkVerifier.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## IPlonkVerifier ### Verify diff --git a/contracts/docs/api/interfaces/l1/IZkEvmV2.md b/contracts/docs/api/interfaces/l1/IZkEvmV2.mdx similarity index 97% rename from contracts/docs/api/interfaces/l1/IZkEvmV2.md rename to contracts/docs/api/interfaces/l1/IZkEvmV2.mdx index 9d2f757a9..2f9cffc32 100644 --- a/contracts/docs/api/interfaces/l1/IZkEvmV2.md +++ b/contracts/docs/api/interfaces/l1/IZkEvmV2.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## IZkEvmV2 ### StartingRootHashDoesNotMatch diff --git a/contracts/docs/api/interfaces/l2/IL2MessageManager.md b/contracts/docs/api/interfaces/l2/IL2MessageManager.mdx similarity index 99% rename from contracts/docs/api/interfaces/l2/IL2MessageManager.md rename to contracts/docs/api/interfaces/l2/IL2MessageManager.mdx index 9ae18047d..b6b8ae147 100644 --- a/contracts/docs/api/interfaces/l2/IL2MessageManager.md +++ b/contracts/docs/api/interfaces/l2/IL2MessageManager.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## IL2MessageManager ### RollingHashUpdated diff --git a/contracts/docs/api/interfaces/l2/IL2MessageManagerV1.md b/contracts/docs/api/interfaces/l2/IL2MessageManagerV1.mdx similarity index 98% rename from contracts/docs/api/interfaces/l2/IL2MessageManagerV1.md rename to contracts/docs/api/interfaces/l2/IL2MessageManagerV1.mdx index 765f36939..dd963190e 100644 --- a/contracts/docs/api/interfaces/l2/IL2MessageManagerV1.md +++ b/contracts/docs/api/interfaces/l2/IL2MessageManagerV1.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## IL2MessageManagerV1 ### MinimumFeeChanged diff --git a/contracts/docs/api/interfaces/l2/IL2MessageServiceV1.md b/contracts/docs/api/interfaces/l2/IL2MessageServiceV1.mdx similarity index 95% rename from contracts/docs/api/interfaces/l2/IL2MessageServiceV1.md rename to contracts/docs/api/interfaces/l2/IL2MessageServiceV1.mdx index 22f7388b7..a674f9195 100644 --- a/contracts/docs/api/interfaces/l2/IL2MessageServiceV1.md +++ b/contracts/docs/api/interfaces/l2/IL2MessageServiceV1.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## IL2MessageServiceV1 ### setMinimumFee diff --git a/contracts/docs/api/lib/CallForwardingProxy.mdx b/contracts/docs/api/lib/CallForwardingProxy.mdx new file mode 100644 index 000000000..91df4a94f --- /dev/null +++ b/contracts/docs/api/lib/CallForwardingProxy.mdx @@ -0,0 +1,24 @@ +## CallForwardingProxy + +### target + +```solidity +address target +``` + +The underlying target address that is called. + +### constructor + +```solidity +constructor(address _target) public +``` + +### fallback + +```solidity +fallback() external payable +``` + +Defaults to, and forwards all calls to the target address. + diff --git a/contracts/docs/api/lib/L2MessageServicePauseManager.md b/contracts/docs/api/lib/L2MessageServicePauseManager.mdx similarity index 96% rename from contracts/docs/api/lib/L2MessageServicePauseManager.md rename to contracts/docs/api/lib/L2MessageServicePauseManager.mdx index dfaa3cc17..06db9385b 100644 --- a/contracts/docs/api/lib/L2MessageServicePauseManager.md +++ b/contracts/docs/api/lib/L2MessageServicePauseManager.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## L2MessageServicePauseManager ### PAUSE_L1_L2_ROLE diff --git a/contracts/docs/api/lib/LineaRollupPauseManager.md b/contracts/docs/api/lib/LineaRollupPauseManager.mdx similarity index 98% rename from contracts/docs/api/lib/LineaRollupPauseManager.md rename to contracts/docs/api/lib/LineaRollupPauseManager.mdx index bfb0b0252..4cf588caa 100644 --- a/contracts/docs/api/lib/LineaRollupPauseManager.md +++ b/contracts/docs/api/lib/LineaRollupPauseManager.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## LineaRollupPauseManager ### PAUSE_L1_L2_ROLE diff --git a/contracts/docs/api/lib/Mimc.md b/contracts/docs/api/lib/Mimc.mdx similarity index 97% rename from contracts/docs/api/lib/Mimc.md rename to contracts/docs/api/lib/Mimc.mdx index 1fa9a993b..80f78db92 100644 --- a/contracts/docs/api/lib/Mimc.md +++ b/contracts/docs/api/lib/Mimc.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## Mimc ### DataMissing diff --git a/contracts/docs/api/lib/PauseManager.md b/contracts/docs/api/lib/PauseManager.mdx similarity index 99% rename from contracts/docs/api/lib/PauseManager.md rename to contracts/docs/api/lib/PauseManager.mdx index f0ac60640..a18ff5e8a 100644 --- a/contracts/docs/api/lib/PauseManager.md +++ b/contracts/docs/api/lib/PauseManager.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## PauseManager ### PAUSE_ALL_ROLE diff --git a/contracts/docs/api/lib/PermissionsManager.md b/contracts/docs/api/lib/PermissionsManager.mdx similarity index 96% rename from contracts/docs/api/lib/PermissionsManager.md rename to contracts/docs/api/lib/PermissionsManager.mdx index 8af4ba67b..e97249cc2 100644 --- a/contracts/docs/api/lib/PermissionsManager.md +++ b/contracts/docs/api/lib/PermissionsManager.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## PermissionsManager ### __Permissions_init diff --git a/contracts/docs/api/lib/SparseMerkleProof.md b/contracts/docs/api/lib/SparseMerkleProof.mdx similarity index 96% rename from contracts/docs/api/lib/SparseMerkleProof.md rename to contracts/docs/api/lib/SparseMerkleProof.mdx index 65d07974d..666c08073 100644 --- a/contracts/docs/api/lib/SparseMerkleProof.md +++ b/contracts/docs/api/lib/SparseMerkleProof.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## SparseMerkleProof ### Account @@ -130,7 +128,7 @@ Hash a value using MIMC hash | Name | Type | Description | | ---- | ---- | ----------- | -| [0] | bytes32 | {bytes32} Mimc hash | +| [0] | bytes32 | bytes32 Mimc hash | ### getLeaf @@ -190,7 +188,7 @@ Hash account value | Name | Type | Description | | ---- | ---- | ----------- | -| [0] | bytes32 | {bytes32} Account value hash | +| [0] | bytes32 | bytes32 Account value hash | ### hashStorageValue @@ -210,5 +208,5 @@ Hash storage value | Name | Type | Description | | ---- | ---- | ----------- | -| [0] | bytes32 | {bytes32} Storage value hash | +| [0] | bytes32 | bytes32 Storage value hash | diff --git a/contracts/docs/api/lib/TokenBridgePauseManager.md b/contracts/docs/api/lib/TokenBridgePauseManager.mdx similarity index 96% rename from contracts/docs/api/lib/TokenBridgePauseManager.md rename to contracts/docs/api/lib/TokenBridgePauseManager.mdx index 0061c3d64..77ca0248c 100644 --- a/contracts/docs/api/lib/TokenBridgePauseManager.md +++ b/contracts/docs/api/lib/TokenBridgePauseManager.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## TokenBridgePauseManager ### PAUSE_INITIATE_TOKEN_BRIDGING_ROLE diff --git a/contracts/docs/api/lib/Utils.md b/contracts/docs/api/lib/Utils.mdx similarity index 97% rename from contracts/docs/api/lib/Utils.md rename to contracts/docs/api/lib/Utils.mdx index 37204966d..109b9bbca 100644 --- a/contracts/docs/api/lib/Utils.md +++ b/contracts/docs/api/lib/Utils.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## Utils ### _efficientKeccak diff --git a/contracts/docs/api/messageService/MessageServiceBase.md b/contracts/docs/api/messageService/MessageServiceBase.mdx similarity index 99% rename from contracts/docs/api/messageService/MessageServiceBase.md rename to contracts/docs/api/messageService/MessageServiceBase.mdx index 3df994aed..2acc28dca 100644 --- a/contracts/docs/api/messageService/MessageServiceBase.md +++ b/contracts/docs/api/messageService/MessageServiceBase.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## MessageServiceBase ### messageService diff --git a/contracts/docs/api/messageService/l1/L1MessageManager.md b/contracts/docs/api/messageService/l1/L1MessageManager.mdx similarity index 99% rename from contracts/docs/api/messageService/l1/L1MessageManager.md rename to contracts/docs/api/messageService/l1/L1MessageManager.mdx index 40a14fbcd..9d948dd2d 100644 --- a/contracts/docs/api/messageService/l1/L1MessageManager.md +++ b/contracts/docs/api/messageService/l1/L1MessageManager.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## L1MessageManager ### rollingHashes diff --git a/contracts/docs/api/messageService/l1/L1MessageService.md b/contracts/docs/api/messageService/l1/L1MessageService.mdx similarity index 99% rename from contracts/docs/api/messageService/l1/L1MessageService.md rename to contracts/docs/api/messageService/l1/L1MessageService.mdx index 5892e5c95..086889671 100644 --- a/contracts/docs/api/messageService/l1/L1MessageService.md +++ b/contracts/docs/api/messageService/l1/L1MessageService.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## L1MessageService ### systemMigrationBlock diff --git a/contracts/docs/api/messageService/l1/TransientStorageReentrancyGuardUpgradeable.md b/contracts/docs/api/messageService/l1/TransientStorageReentrancyGuardUpgradeable.mdx similarity index 91% rename from contracts/docs/api/messageService/l1/TransientStorageReentrancyGuardUpgradeable.md rename to contracts/docs/api/messageService/l1/TransientStorageReentrancyGuardUpgradeable.mdx index 261ace02e..0847e3a6b 100644 --- a/contracts/docs/api/messageService/l1/TransientStorageReentrancyGuardUpgradeable.md +++ b/contracts/docs/api/messageService/l1/TransientStorageReentrancyGuardUpgradeable.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## TransientStorageReentrancyGuardUpgradeable ### ReentrantCall diff --git a/contracts/docs/api/messageService/l1/v1/L1MessageManagerV1.md b/contracts/docs/api/messageService/l1/v1/L1MessageManagerV1.mdx similarity index 98% rename from contracts/docs/api/messageService/l1/v1/L1MessageManagerV1.md rename to contracts/docs/api/messageService/l1/v1/L1MessageManagerV1.mdx index ecee43cbb..6a5268b3d 100644 --- a/contracts/docs/api/messageService/l1/v1/L1MessageManagerV1.md +++ b/contracts/docs/api/messageService/l1/v1/L1MessageManagerV1.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## L1MessageManagerV1 ### INBOX_STATUS_UNKNOWN diff --git a/contracts/docs/api/messageService/l1/v1/L1MessageServiceV1.md b/contracts/docs/api/messageService/l1/v1/L1MessageServiceV1.mdx similarity index 99% rename from contracts/docs/api/messageService/l1/v1/L1MessageServiceV1.md rename to contracts/docs/api/messageService/l1/v1/L1MessageServiceV1.mdx index ff270a808..648362a2b 100644 --- a/contracts/docs/api/messageService/l1/v1/L1MessageServiceV1.md +++ b/contracts/docs/api/messageService/l1/v1/L1MessageServiceV1.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## L1MessageServiceV1 ### nextMessageNumber diff --git a/contracts/docs/api/messageService/l2/L2MessageManager.md b/contracts/docs/api/messageService/l2/L2MessageManager.mdx similarity index 98% rename from contracts/docs/api/messageService/l2/L2MessageManager.md rename to contracts/docs/api/messageService/l2/L2MessageManager.mdx index 003833b15..a1c0244c3 100644 --- a/contracts/docs/api/messageService/l2/L2MessageManager.md +++ b/contracts/docs/api/messageService/l2/L2MessageManager.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## L2MessageManager ### L1_L2_MESSAGE_SETTER_ROLE diff --git a/contracts/docs/api/messageService/l2/L2MessageService.md b/contracts/docs/api/messageService/l2/L2MessageService.mdx similarity index 99% rename from contracts/docs/api/messageService/l2/L2MessageService.md rename to contracts/docs/api/messageService/l2/L2MessageService.mdx index 6ce7b23c7..99a2af0ed 100644 --- a/contracts/docs/api/messageService/l2/L2MessageService.md +++ b/contracts/docs/api/messageService/l2/L2MessageService.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## L2MessageService ### CONTRACT_VERSION diff --git a/contracts/docs/api/messageService/l2/v1/L2MessageManagerV1.md b/contracts/docs/api/messageService/l2/v1/L2MessageManagerV1.mdx similarity index 98% rename from contracts/docs/api/messageService/l2/v1/L2MessageManagerV1.md rename to contracts/docs/api/messageService/l2/v1/L2MessageManagerV1.mdx index 85c736649..57bfc3884 100644 --- a/contracts/docs/api/messageService/l2/v1/L2MessageManagerV1.md +++ b/contracts/docs/api/messageService/l2/v1/L2MessageManagerV1.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## L2MessageManagerV1 ### INBOX_STATUS_UNKNOWN diff --git a/contracts/docs/api/messageService/l2/v1/L2MessageServiceV1.md b/contracts/docs/api/messageService/l2/v1/L2MessageServiceV1.mdx similarity index 99% rename from contracts/docs/api/messageService/l2/v1/L2MessageServiceV1.md rename to contracts/docs/api/messageService/l2/v1/L2MessageServiceV1.mdx index 1dd41fe4f..c81a341f9 100644 --- a/contracts/docs/api/messageService/l2/v1/L2MessageServiceV1.md +++ b/contracts/docs/api/messageService/l2/v1/L2MessageServiceV1.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## L2MessageServiceV1 ### MINIMUM_FEE_SETTER_ROLE diff --git a/contracts/docs/api/messageService/lib/MessageHashing.md b/contracts/docs/api/messageService/lib/MessageHashing.mdx similarity index 98% rename from contracts/docs/api/messageService/lib/MessageHashing.md rename to contracts/docs/api/messageService/lib/MessageHashing.mdx index dd8fe1b27..2a21a3d99 100644 --- a/contracts/docs/api/messageService/lib/MessageHashing.md +++ b/contracts/docs/api/messageService/lib/MessageHashing.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## MessageHashing ### _hashMessage diff --git a/contracts/docs/api/messageService/lib/RateLimiter.md b/contracts/docs/api/messageService/lib/RateLimiter.mdx similarity index 99% rename from contracts/docs/api/messageService/lib/RateLimiter.md rename to contracts/docs/api/messageService/lib/RateLimiter.mdx index 4e191ea0e..e44345d1f 100644 --- a/contracts/docs/api/messageService/lib/RateLimiter.md +++ b/contracts/docs/api/messageService/lib/RateLimiter.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## RateLimiter You can use this control numeric limits over a period using timestamp. diff --git a/contracts/docs/api/messageService/lib/SparseMerkleTreeVerifier.md b/contracts/docs/api/messageService/lib/SparseMerkleTreeVerifier.mdx similarity index 98% rename from contracts/docs/api/messageService/lib/SparseMerkleTreeVerifier.md rename to contracts/docs/api/messageService/lib/SparseMerkleTreeVerifier.mdx index 6432d4465..504e897f3 100644 --- a/contracts/docs/api/messageService/lib/SparseMerkleTreeVerifier.md +++ b/contracts/docs/api/messageService/lib/SparseMerkleTreeVerifier.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## SparseMerkleTreeVerifier ### SafeCastOverflowedUintDowncast diff --git a/contracts/docs/api/messageService/lib/TimeLock.md b/contracts/docs/api/messageService/lib/TimeLock.mdx similarity index 94% rename from contracts/docs/api/messageService/lib/TimeLock.md rename to contracts/docs/api/messageService/lib/TimeLock.mdx index 9ffa653c0..e96f56028 100644 --- a/contracts/docs/api/messageService/lib/TimeLock.md +++ b/contracts/docs/api/messageService/lib/TimeLock.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## 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 diff --git a/contracts/docs/api/messageService/lib/TransientStorageHelpers.md b/contracts/docs/api/messageService/lib/TransientStorageHelpers.mdx similarity index 99% rename from contracts/docs/api/messageService/lib/TransientStorageHelpers.md rename to contracts/docs/api/messageService/lib/TransientStorageHelpers.mdx index 889b9203c..4b61ad164 100644 --- a/contracts/docs/api/messageService/lib/TransientStorageHelpers.md +++ b/contracts/docs/api/messageService/lib/TransientStorageHelpers.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## TransientStorageHelpers ### tstoreUint256 diff --git a/contracts/docs/api/tokenBridge/BridgedToken.md b/contracts/docs/api/tokenBridge/BridgedToken.mdx similarity index 99% rename from contracts/docs/api/tokenBridge/BridgedToken.md rename to contracts/docs/api/tokenBridge/BridgedToken.mdx index 44c01bc62..ec90c0926 100644 --- a/contracts/docs/api/tokenBridge/BridgedToken.md +++ b/contracts/docs/api/tokenBridge/BridgedToken.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## BridgedToken ERC20 token created when a native token is bridged to a target chain. diff --git a/contracts/docs/api/tokenBridge/CustomBridgedToken.md b/contracts/docs/api/tokenBridge/CustomBridgedToken.mdx similarity index 93% rename from contracts/docs/api/tokenBridge/CustomBridgedToken.md rename to contracts/docs/api/tokenBridge/CustomBridgedToken.mdx index eeee08966..871efd435 100644 --- a/contracts/docs/api/tokenBridge/CustomBridgedToken.md +++ b/contracts/docs/api/tokenBridge/CustomBridgedToken.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## CustomBridgedToken Custom ERC20 token manually deployed for the Linea TokenBridge. diff --git a/contracts/docs/api/tokenBridge/TokenBridge.md b/contracts/docs/api/tokenBridge/TokenBridge.mdx similarity index 99% rename from contracts/docs/api/tokenBridge/TokenBridge.md rename to contracts/docs/api/tokenBridge/TokenBridge.mdx index f4baeb46e..a87b30a4e 100644 --- a/contracts/docs/api/tokenBridge/TokenBridge.md +++ b/contracts/docs/api/tokenBridge/TokenBridge.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## TokenBridge Contract to manage cross-chain ERC20 bridging. diff --git a/contracts/docs/api/tokenBridge/interfaces/ITokenBridge.md b/contracts/docs/api/tokenBridge/interfaces/ITokenBridge.mdx similarity index 99% rename from contracts/docs/api/tokenBridge/interfaces/ITokenBridge.md rename to contracts/docs/api/tokenBridge/interfaces/ITokenBridge.mdx index 2817d38f5..dff660454 100644 --- a/contracts/docs/api/tokenBridge/interfaces/ITokenBridge.md +++ b/contracts/docs/api/tokenBridge/interfaces/ITokenBridge.mdx @@ -1,5 +1,3 @@ -# Solidity API - ## ITokenBridge ### InitializationData diff --git a/contracts/docs/api/tokenBridge/lib/StorageFiller39.md b/contracts/docs/api/tokenBridge/lib/StorageFiller39.mdx similarity index 55% rename from contracts/docs/api/tokenBridge/lib/StorageFiller39.md rename to contracts/docs/api/tokenBridge/lib/StorageFiller39.mdx index ccee22b8b..af159b89e 100644 --- a/contracts/docs/api/tokenBridge/lib/StorageFiller39.md +++ b/contracts/docs/api/tokenBridge/lib/StorageFiller39.mdx @@ -1,4 +1,2 @@ -# Solidity API - ## StorageFiller39 diff --git a/contracts/docs/docgen-templates/page.hbs b/contracts/docs/docgen-templates/page.hbs new file mode 100644 index 000000000..65f29077a --- /dev/null +++ b/contracts/docs/docgen-templates/page.hbs @@ -0,0 +1,8 @@ +{{! This template is from the solidity-docgen repository - https://github.com/OpenZeppelin/solidity-docgen/blob/f51c722278bef58847214a4d6b0ffd60dcdfa719/src/themes/markdown/page.hbs }} +{{! We delete the top line `# Solidity API` to make the generated documentation more Docusarus-friendly }} +{{#each items}} +{{#hsection}} +{{>item}} +{{/hsection}} + +{{/each}} diff --git a/contracts/docs/scripts/create-docs-website-pr-branch.sh b/contracts/docs/scripts/create-docs-website-pr-branch.sh new file mode 100755 index 000000000..923c34e7f --- /dev/null +++ b/contracts/docs/scripts/create-docs-website-pr-branch.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +# PURPOSE +# This script will automate pushing a PR branch into the docs.linea.build repo. The new PR branch will contain autogenerated smart contract documentation for the Linea monorepo. +# You must manually create the Github PR yourself + +# ASSUMPTIONS +# Requires permissions to create a branch on docs.linea.build repo +# Must execute this script from within linea-monorepo + +# CONSTANTS +DOCS_WEBSITE_REPO_NAME=doc.linea +DOCS_WEBSITE_REPO_GIT_LINK=https://github.com/Consensys/$DOCS_WEBSITE_REPO_NAME.git +DOCS_REPO_PR_BRANCH_NAME=update-linea-smart-contract-docs +DOCS_REPO_PR_COMMIT_MESSAGE="Update Linea smart contract docs" + +UPDATE_SIDEBAR_SCRIPT_NAME=updateSidebar.js +UPDATE_SIDEBAR_SCRIPT_PATH=contracts/docs/scripts/$UPDATE_SIDEBAR_SCRIPT_NAME +MONOREPO_SMART_CONTRACT_DOCS_DIRECTORY=contracts/docs/api + +DOCS_REPO_SMART_CONTRACT_DOC_DIRECTORY=docs/api/linea-smart-contracts + +# Ensure that `contracts` is the working directory +MONOREPO_ROOT_PATH=$(git rev-parse --show-toplevel) +cd $MONOREPO_ROOT_PATH +cd contracts + +# Docgen +npx hardhat docgen + +# Git clone docs website and create new branch +cd $MONOREPO_ROOT_PATH +cd .. +git clone $DOCS_WEBSITE_REPO_GIT_LINK --depth 1 +cd $DOCS_WEBSITE_REPO_NAME +DOCS_WEBSITE_REPO_PATH=$(pwd) +git checkout -b $DOCS_REPO_PR_BRANCH_NAME + +# Copy autogenerated smart contract docs + updateSidebar.js to docs website repo +cd $MONOREPO_ROOT_PATH +cp -r "$MONOREPO_ROOT_PATH/$MONOREPO_SMART_CONTRACT_DOCS_DIRECTORY" "$DOCS_WEBSITE_REPO_PATH/$DOCS_REPO_SMART_CONTRACT_DOC_DIRECTORY" +cp "$MONOREPO_ROOT_PATH/$UPDATE_SIDEBAR_SCRIPT_PATH" "$DOCS_WEBSITE_REPO_PATH/$UPDATE_SIDEBAR_SCRIPT_NAME" + +# Execute updateSidebar script, then delete script (so it is not in the commit) +cd $DOCS_WEBSITE_REPO_PATH +node $UPDATE_SIDEBAR_SCRIPT_NAME +rm $UPDATE_SIDEBAR_SCRIPT_NAME + +# Git commit and push +git add . +git commit -m "$DOCS_REPO_PR_COMMIT_MESSAGE" +git push --set-upstream origin $DOCS_REPO_PR_BRANCH_NAME \ No newline at end of file diff --git a/contracts/docs/scripts/updateSidebar.js b/contracts/docs/scripts/updateSidebar.js new file mode 100644 index 000000000..43cf6bfb5 --- /dev/null +++ b/contracts/docs/scripts/updateSidebar.js @@ -0,0 +1,121 @@ +/* eslint-disable */ +// This script is meant to be executed in the root directory of https://github.com/Consensys/doc.linea, which has different linting rules +// The purpose of this script is to modify the sidebars.js file to correctly include the autogenerated smart contract documentation + +const fs = require("fs"); +const path = require("path"); +const { execSync } = require("child_process"); + +// CONSTANTS +const SIDEBAR_FILE_PATH = "sidebars.js"; + +// IMPORTED OBJECT +const sidebarObject = require(path.join(__dirname, SIDEBAR_FILE_PATH)); + +// TYPES +class FolderSidebar { + type = "category"; + label = ""; + link = null; + collapsible = true; + items = []; + + constructor(label = "", collapsible = true) { + this.label = label; + this.collapsible = collapsible; + } +} + +// MAIN +main(); + +function main() { + const smartContractSidebarNode = getSmartContractSidebar(); + sidebarObject?.apiSidebar?.push(smartContractSidebarNode); + createNewSidebarFile(sidebarObject); +} + +// HELPER FUNCTIONS +function getSmartContractSidebar() { + // Create and populate smart contract sidebar + const smartContractsPath = path.join( + __dirname, + "docs", + "api", + "linea-smart-contracts", + ); + + let smartContractSidebar = new FolderSidebar( + "Linea Smart Contracts", + false, + ); + + populateFolderSidebar( + smartContractSidebar, + smartContractsPath, + ".mdx", + ); + + return smartContractSidebar; +} + +// Recursive function to populate sidebar object for a given folder +// Essentially we do a depth-first search (DFS) of the folder tree, and populate the sidebar object recursively +// Do note that we mutate the parameter `folderSidebar` throughout the function body +function populateFolderSidebar(folderSidebar, subdirectoryPath, fileExtension) { + const folderFileList = fs.readdirSync(subdirectoryPath); + + for (const fileNode of folderFileList) { + const filePath = path.join(subdirectoryPath, fileNode); + const fileMetadata = fs.statSync(filePath); + + // Directory => Create folder node, recurse then add folder node + if (fileMetadata.isDirectory()) { + let newFolderNode = new FolderSidebar(fileNode); + populateFolderSidebar(newFolderNode, filePath, fileExtension); + folderSidebar?.items.push(newFolderNode); + + // Base case => *.mdx file => Add relative path + } else if (fileMetadata.isFile() && fileNode.endsWith(fileExtension)) { + const relativePath = path.relative( + path.join(__dirname, "docs"), + filePath.split(fileExtension)[0], + ); + folderSidebar?.items.push(relativePath); + } + // Not a directory or *.mdx file => Do nothing + } + + return folderSidebar; +} + +function createNewSidebarFile(sidebarObject) { + // Create new js file + const sidebarFileLine1 = + "/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */"; + const sidebarFileLine2 = "const sidebars ="; + const sidebarFileLineFinal = "module.exports = sidebars;"; + + const newSidebarFileContent = `${sidebarFileLine1}\n${sidebarFileLine2}\n${JSON.stringify(sidebarObject, null, 2)}\n\n${sidebarFileLineFinal}`; + + // Save new js file + const newSidebarFilePath = path.join(__dirname, SIDEBAR_FILE_PATH); + fs.writeFileSync(newSidebarFilePath, newSidebarFileContent); + + lintJSFile(newSidebarFilePath); +} + +function lintJSFile(filePath) { + try { + const installCmd = `npm install --save-dev --no-save eslint`; + execSync(installCmd, { stdio: "inherit" }); + + const lintCmd = `npx eslint --fix --no-ignore ${filePath}`; + // Execute command synchronously and route output directly to the current stdout + execSync(lintCmd, { stdio: "inherit" }); + } catch (error) { + console.error(`Error:`, error.message); + console.error(`Exiting...`); + process.exit(1); + } +} diff --git a/contracts/hardhat.config.ts b/contracts/hardhat.config.ts index 8fdaad00d..5c69ed75f 100644 --- a/contracts/hardhat.config.ts +++ b/contracts/hardhat.config.ts @@ -157,6 +157,8 @@ const config: HardhatUserConfig = { exclude: ["token", "test-contracts", "proxies", "tools", "interfaces/tools", "tokenBridge/mocks", "verifiers"], pages: "files", outputDir: "docs/api/", + pageExtension: ".mdx", + templates: "docs/docgen-templates", }, };