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 13bee2eb7..e85df5799 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -122,6 +122,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..96990127c 100644 --- a/contracts/docs/api/LineaRollup.md +++ b/contracts/docs/api/LineaRollup.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## LineaRollup +# `LineaRollup` ### CONTRACT_VERSION diff --git a/contracts/docs/api/ZkEvmV2.md b/contracts/docs/api/ZkEvmV2.mdx similarity index 97% rename from contracts/docs/api/ZkEvmV2.md rename to contracts/docs/api/ZkEvmV2.mdx index a9c80d966..c74fc6891 100644 --- a/contracts/docs/api/ZkEvmV2.md +++ b/contracts/docs/api/ZkEvmV2.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## ZkEvmV2 +# `ZkEvmV2` ### MODULO_R diff --git a/contracts/docs/api/interfaces/IGenericErrors.md b/contracts/docs/api/interfaces/IGenericErrors.mdx similarity index 91% rename from contracts/docs/api/interfaces/IGenericErrors.md rename to contracts/docs/api/interfaces/IGenericErrors.mdx index e49b79007..2f60a8e66 100644 --- a/contracts/docs/api/interfaces/IGenericErrors.md +++ b/contracts/docs/api/interfaces/IGenericErrors.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## IGenericErrors +# `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..02a03fde7 100644 --- a/contracts/docs/api/interfaces/IMessageService.md +++ b/contracts/docs/api/interfaces/IMessageService.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## IMessageService +# `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..d09f221c0 100644 --- a/contracts/docs/api/interfaces/IPauseManager.md +++ b/contracts/docs/api/interfaces/IPauseManager.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## IPauseManager +# `IPauseManager` ### PauseTypeRole diff --git a/contracts/docs/api/interfaces/IPermissionsManager.md b/contracts/docs/api/interfaces/IPermissionsManager.mdx similarity index 72% rename from contracts/docs/api/interfaces/IPermissionsManager.md rename to contracts/docs/api/interfaces/IPermissionsManager.mdx index a280d9184..c7b189b79 100644 --- a/contracts/docs/api/interfaces/IPermissionsManager.md +++ b/contracts/docs/api/interfaces/IPermissionsManager.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## IPermissionsManager +# `IPermissionsManager` ### RoleAddress diff --git a/contracts/docs/api/interfaces/IRateLimiter.md b/contracts/docs/api/interfaces/IRateLimiter.mdx similarity index 98% rename from contracts/docs/api/interfaces/IRateLimiter.md rename to contracts/docs/api/interfaces/IRateLimiter.mdx index f5683068c..17db2b885 100644 --- a/contracts/docs/api/interfaces/IRateLimiter.md +++ b/contracts/docs/api/interfaces/IRateLimiter.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## IRateLimiter +# `IRateLimiter` ### RateLimitInitialized diff --git a/contracts/docs/api/interfaces/l1/IL1MessageManager.md b/contracts/docs/api/interfaces/l1/IL1MessageManager.mdx similarity index 98% rename from contracts/docs/api/interfaces/l1/IL1MessageManager.md rename to contracts/docs/api/interfaces/l1/IL1MessageManager.mdx index cf90c2a87..04fc8935d 100644 --- a/contracts/docs/api/interfaces/l1/IL1MessageManager.md +++ b/contracts/docs/api/interfaces/l1/IL1MessageManager.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## IL1MessageManager +# `IL1MessageManager` ### RollingHashUpdated diff --git a/contracts/docs/api/interfaces/l1/IL1MessageManagerV1.md b/contracts/docs/api/interfaces/l1/IL1MessageManagerV1.mdx similarity index 82% rename from contracts/docs/api/interfaces/l1/IL1MessageManagerV1.md rename to contracts/docs/api/interfaces/l1/IL1MessageManagerV1.mdx index f4283b8f7..b9b0495be 100644 --- a/contracts/docs/api/interfaces/l1/IL1MessageManagerV1.md +++ b/contracts/docs/api/interfaces/l1/IL1MessageManagerV1.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## IL1MessageManagerV1 +# `IL1MessageManagerV1` ### MessageDoesNotExistOrHasAlreadyBeenClaimed diff --git a/contracts/docs/api/interfaces/l1/IL1MessageService.md b/contracts/docs/api/interfaces/l1/IL1MessageService.mdx similarity index 97% rename from contracts/docs/api/interfaces/l1/IL1MessageService.md rename to contracts/docs/api/interfaces/l1/IL1MessageService.mdx index 6b70ac418..7fad8aed2 100644 --- a/contracts/docs/api/interfaces/l1/IL1MessageService.md +++ b/contracts/docs/api/interfaces/l1/IL1MessageService.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## IL1MessageService +# `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..62e8e3944 100644 --- a/contracts/docs/api/interfaces/l1/ILineaRollup.md +++ b/contracts/docs/api/interfaces/l1/ILineaRollup.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## ILineaRollup +# `ILineaRollup` ### InitializationData diff --git a/contracts/docs/api/interfaces/l1/IPlonkVerifier.md b/contracts/docs/api/interfaces/l1/IPlonkVerifier.mdx similarity index 93% rename from contracts/docs/api/interfaces/l1/IPlonkVerifier.md rename to contracts/docs/api/interfaces/l1/IPlonkVerifier.mdx index 72ed2cd7b..ecf004e5a 100644 --- a/contracts/docs/api/interfaces/l1/IPlonkVerifier.md +++ b/contracts/docs/api/interfaces/l1/IPlonkVerifier.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## IPlonkVerifier +# `IPlonkVerifier` ### Verify diff --git a/contracts/docs/api/interfaces/l1/IZkEvmV2.md b/contracts/docs/api/interfaces/l1/IZkEvmV2.mdx similarity index 95% rename from contracts/docs/api/interfaces/l1/IZkEvmV2.md rename to contracts/docs/api/interfaces/l1/IZkEvmV2.mdx index 9d2f757a9..1e9d3bd42 100644 --- a/contracts/docs/api/interfaces/l1/IZkEvmV2.md +++ b/contracts/docs/api/interfaces/l1/IZkEvmV2.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## IZkEvmV2 +# `IZkEvmV2` ### StartingRootHashDoesNotMatch diff --git a/contracts/docs/api/interfaces/l2/IL2MessageManager.md b/contracts/docs/api/interfaces/l2/IL2MessageManager.mdx similarity index 98% rename from contracts/docs/api/interfaces/l2/IL2MessageManager.md rename to contracts/docs/api/interfaces/l2/IL2MessageManager.mdx index 9ae18047d..341cf725d 100644 --- a/contracts/docs/api/interfaces/l2/IL2MessageManager.md +++ b/contracts/docs/api/interfaces/l2/IL2MessageManager.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## IL2MessageManager +# `IL2MessageManager` ### RollingHashUpdated diff --git a/contracts/docs/api/interfaces/l2/IL2MessageManagerV1.md b/contracts/docs/api/interfaces/l2/IL2MessageManagerV1.mdx similarity index 96% rename from contracts/docs/api/interfaces/l2/IL2MessageManagerV1.md rename to contracts/docs/api/interfaces/l2/IL2MessageManagerV1.mdx index 765f36939..0f795e031 100644 --- a/contracts/docs/api/interfaces/l2/IL2MessageManagerV1.md +++ b/contracts/docs/api/interfaces/l2/IL2MessageManagerV1.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## IL2MessageManagerV1 +# `IL2MessageManagerV1` ### MinimumFeeChanged diff --git a/contracts/docs/api/interfaces/l2/IL2MessageServiceV1.md b/contracts/docs/api/interfaces/l2/IL2MessageServiceV1.mdx similarity index 89% rename from contracts/docs/api/interfaces/l2/IL2MessageServiceV1.md rename to contracts/docs/api/interfaces/l2/IL2MessageServiceV1.mdx index 22f7388b7..8108c9df5 100644 --- a/contracts/docs/api/interfaces/l2/IL2MessageServiceV1.md +++ b/contracts/docs/api/interfaces/l2/IL2MessageServiceV1.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## IL2MessageServiceV1 +# `IL2MessageServiceV1` ### setMinimumFee diff --git a/contracts/docs/api/lib/CallForwardingProxy.mdx b/contracts/docs/api/lib/CallForwardingProxy.mdx new file mode 100644 index 000000000..0464089fd --- /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 90% rename from contracts/docs/api/lib/L2MessageServicePauseManager.md rename to contracts/docs/api/lib/L2MessageServicePauseManager.mdx index dfaa3cc17..ff78dbccf 100644 --- a/contracts/docs/api/lib/L2MessageServicePauseManager.md +++ b/contracts/docs/api/lib/L2MessageServicePauseManager.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## L2MessageServicePauseManager +# `L2MessageServicePauseManager` ### PAUSE_L1_L2_ROLE diff --git a/contracts/docs/api/lib/LineaRollupPauseManager.md b/contracts/docs/api/lib/LineaRollupPauseManager.mdx similarity index 95% rename from contracts/docs/api/lib/LineaRollupPauseManager.md rename to contracts/docs/api/lib/LineaRollupPauseManager.mdx index bfb0b0252..3b308c7a3 100644 --- a/contracts/docs/api/lib/LineaRollupPauseManager.md +++ b/contracts/docs/api/lib/LineaRollupPauseManager.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## LineaRollupPauseManager +# `LineaRollupPauseManager` ### PAUSE_L1_L2_ROLE diff --git a/contracts/docs/api/lib/Mimc.md b/contracts/docs/api/lib/Mimc.mdx similarity index 96% rename from contracts/docs/api/lib/Mimc.md rename to contracts/docs/api/lib/Mimc.mdx index 1fa9a993b..b8dbed1d8 100644 --- a/contracts/docs/api/lib/Mimc.md +++ b/contracts/docs/api/lib/Mimc.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## Mimc +# `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..8b85b7d9b 100644 --- a/contracts/docs/api/lib/PauseManager.md +++ b/contracts/docs/api/lib/PauseManager.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## PauseManager +# `PauseManager` ### PAUSE_ALL_ROLE diff --git a/contracts/docs/api/lib/PermissionsManager.md b/contracts/docs/api/lib/PermissionsManager.mdx similarity index 91% rename from contracts/docs/api/lib/PermissionsManager.md rename to contracts/docs/api/lib/PermissionsManager.mdx index 8af4ba67b..23f9a7432 100644 --- a/contracts/docs/api/lib/PermissionsManager.md +++ b/contracts/docs/api/lib/PermissionsManager.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## PermissionsManager +# `PermissionsManager` ### __Permissions_init diff --git a/contracts/docs/api/lib/SparseMerkleProof.md b/contracts/docs/api/lib/SparseMerkleProof.mdx similarity index 95% rename from contracts/docs/api/lib/SparseMerkleProof.md rename to contracts/docs/api/lib/SparseMerkleProof.mdx index 65d07974d..153e344fe 100644 --- a/contracts/docs/api/lib/SparseMerkleProof.md +++ b/contracts/docs/api/lib/SparseMerkleProof.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## SparseMerkleProof +# `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 90% rename from contracts/docs/api/lib/TokenBridgePauseManager.md rename to contracts/docs/api/lib/TokenBridgePauseManager.mdx index 0061c3d64..b0047aa76 100644 --- a/contracts/docs/api/lib/TokenBridgePauseManager.md +++ b/contracts/docs/api/lib/TokenBridgePauseManager.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## TokenBridgePauseManager +# `TokenBridgePauseManager` ### PAUSE_INITIATE_TOKEN_BRIDGING_ROLE diff --git a/contracts/docs/api/lib/Utils.md b/contracts/docs/api/lib/Utils.mdx similarity index 96% rename from contracts/docs/api/lib/Utils.md rename to contracts/docs/api/lib/Utils.mdx index 37204966d..029dd3dab 100644 --- a/contracts/docs/api/lib/Utils.md +++ b/contracts/docs/api/lib/Utils.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## Utils +# `Utils` ### _efficientKeccak diff --git a/contracts/docs/api/messageService/MessageServiceBase.md b/contracts/docs/api/messageService/MessageServiceBase.mdx similarity index 98% rename from contracts/docs/api/messageService/MessageServiceBase.md rename to contracts/docs/api/messageService/MessageServiceBase.mdx index 3df994aed..54ba690d8 100644 --- a/contracts/docs/api/messageService/MessageServiceBase.md +++ b/contracts/docs/api/messageService/MessageServiceBase.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## MessageServiceBase +# `MessageServiceBase` ### messageService diff --git a/contracts/docs/api/messageService/l1/L1MessageManager.md b/contracts/docs/api/messageService/l1/L1MessageManager.mdx similarity index 98% rename from contracts/docs/api/messageService/l1/L1MessageManager.md rename to contracts/docs/api/messageService/l1/L1MessageManager.mdx index 40a14fbcd..fb5f87c8b 100644 --- a/contracts/docs/api/messageService/l1/L1MessageManager.md +++ b/contracts/docs/api/messageService/l1/L1MessageManager.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## L1MessageManager +# `L1MessageManager` ### rollingHashes diff --git a/contracts/docs/api/messageService/l1/L1MessageService.md b/contracts/docs/api/messageService/l1/L1MessageService.mdx similarity index 98% rename from contracts/docs/api/messageService/l1/L1MessageService.md rename to contracts/docs/api/messageService/l1/L1MessageService.mdx index 5892e5c95..ddc8fdca6 100644 --- a/contracts/docs/api/messageService/l1/L1MessageService.md +++ b/contracts/docs/api/messageService/l1/L1MessageService.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## L1MessageService +# `L1MessageService` ### systemMigrationBlock diff --git a/contracts/docs/api/messageService/l1/TransientStorageReentrancyGuardUpgradeable.md b/contracts/docs/api/messageService/l1/TransientStorageReentrancyGuardUpgradeable.mdx similarity index 65% rename from contracts/docs/api/messageService/l1/TransientStorageReentrancyGuardUpgradeable.md rename to contracts/docs/api/messageService/l1/TransientStorageReentrancyGuardUpgradeable.mdx index 261ace02e..3d9fe9a6b 100644 --- a/contracts/docs/api/messageService/l1/TransientStorageReentrancyGuardUpgradeable.md +++ b/contracts/docs/api/messageService/l1/TransientStorageReentrancyGuardUpgradeable.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## TransientStorageReentrancyGuardUpgradeable +# `TransientStorageReentrancyGuardUpgradeable` ### ReentrantCall diff --git a/contracts/docs/api/messageService/l1/v1/L1MessageManagerV1.md b/contracts/docs/api/messageService/l1/v1/L1MessageManagerV1.mdx similarity index 97% rename from contracts/docs/api/messageService/l1/v1/L1MessageManagerV1.md rename to contracts/docs/api/messageService/l1/v1/L1MessageManagerV1.mdx index ecee43cbb..38aa292d1 100644 --- a/contracts/docs/api/messageService/l1/v1/L1MessageManagerV1.md +++ b/contracts/docs/api/messageService/l1/v1/L1MessageManagerV1.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## L1MessageManagerV1 +# `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 98% rename from contracts/docs/api/messageService/l1/v1/L1MessageServiceV1.md rename to contracts/docs/api/messageService/l1/v1/L1MessageServiceV1.mdx index ff270a808..f8e985305 100644 --- a/contracts/docs/api/messageService/l1/v1/L1MessageServiceV1.md +++ b/contracts/docs/api/messageService/l1/v1/L1MessageServiceV1.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## L1MessageServiceV1 +# `L1MessageServiceV1` ### nextMessageNumber diff --git a/contracts/docs/api/messageService/l2/L2MessageManager.md b/contracts/docs/api/messageService/l2/L2MessageManager.mdx similarity index 97% rename from contracts/docs/api/messageService/l2/L2MessageManager.md rename to contracts/docs/api/messageService/l2/L2MessageManager.mdx index 003833b15..d364fbd45 100644 --- a/contracts/docs/api/messageService/l2/L2MessageManager.md +++ b/contracts/docs/api/messageService/l2/L2MessageManager.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## L2MessageManager +# `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 98% rename from contracts/docs/api/messageService/l2/L2MessageService.md rename to contracts/docs/api/messageService/l2/L2MessageService.mdx index 6ce7b23c7..d83edaf55 100644 --- a/contracts/docs/api/messageService/l2/L2MessageService.md +++ b/contracts/docs/api/messageService/l2/L2MessageService.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## L2MessageService +# `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 95% rename from contracts/docs/api/messageService/l2/v1/L2MessageManagerV1.md rename to contracts/docs/api/messageService/l2/v1/L2MessageManagerV1.mdx index 85c736649..cd9b595ad 100644 --- a/contracts/docs/api/messageService/l2/v1/L2MessageManagerV1.md +++ b/contracts/docs/api/messageService/l2/v1/L2MessageManagerV1.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## L2MessageManagerV1 +# `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 98% rename from contracts/docs/api/messageService/l2/v1/L2MessageServiceV1.md rename to contracts/docs/api/messageService/l2/v1/L2MessageServiceV1.mdx index 1dd41fe4f..bda39c206 100644 --- a/contracts/docs/api/messageService/l2/v1/L2MessageServiceV1.md +++ b/contracts/docs/api/messageService/l2/v1/L2MessageServiceV1.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## L2MessageServiceV1 +# `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 96% rename from contracts/docs/api/messageService/lib/MessageHashing.md rename to contracts/docs/api/messageService/lib/MessageHashing.mdx index dd8fe1b27..47fe17ffd 100644 --- a/contracts/docs/api/messageService/lib/MessageHashing.md +++ b/contracts/docs/api/messageService/lib/MessageHashing.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## MessageHashing +# `MessageHashing` ### _hashMessage diff --git a/contracts/docs/api/messageService/lib/RateLimiter.md b/contracts/docs/api/messageService/lib/RateLimiter.mdx similarity index 98% rename from contracts/docs/api/messageService/lib/RateLimiter.md rename to contracts/docs/api/messageService/lib/RateLimiter.mdx index 4e191ea0e..d5f9f44ef 100644 --- a/contracts/docs/api/messageService/lib/RateLimiter.md +++ b/contracts/docs/api/messageService/lib/RateLimiter.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## RateLimiter +# `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 97% rename from contracts/docs/api/messageService/lib/SparseMerkleTreeVerifier.md rename to contracts/docs/api/messageService/lib/SparseMerkleTreeVerifier.mdx index 6432d4465..3c1cf650a 100644 --- a/contracts/docs/api/messageService/lib/SparseMerkleTreeVerifier.md +++ b/contracts/docs/api/messageService/lib/SparseMerkleTreeVerifier.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## SparseMerkleTreeVerifier +# `SparseMerkleTreeVerifier` ### SafeCastOverflowedUintDowncast diff --git a/contracts/docs/api/messageService/lib/TimeLock.md b/contracts/docs/api/messageService/lib/TimeLock.mdx similarity index 91% rename from contracts/docs/api/messageService/lib/TimeLock.md rename to contracts/docs/api/messageService/lib/TimeLock.mdx index 9ffa653c0..203043933 100644 --- a/contracts/docs/api/messageService/lib/TimeLock.md +++ b/contracts/docs/api/messageService/lib/TimeLock.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## TimeLock +# `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 98% rename from contracts/docs/api/messageService/lib/TransientStorageHelpers.md rename to contracts/docs/api/messageService/lib/TransientStorageHelpers.mdx index 889b9203c..68f4f4c9c 100644 --- a/contracts/docs/api/messageService/lib/TransientStorageHelpers.md +++ b/contracts/docs/api/messageService/lib/TransientStorageHelpers.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## TransientStorageHelpers +# `TransientStorageHelpers` ### tstoreUint256 diff --git a/contracts/docs/api/tokenBridge/BridgedToken.md b/contracts/docs/api/tokenBridge/BridgedToken.mdx similarity index 98% rename from contracts/docs/api/tokenBridge/BridgedToken.md rename to contracts/docs/api/tokenBridge/BridgedToken.mdx index 44c01bc62..8f7c4d585 100644 --- a/contracts/docs/api/tokenBridge/BridgedToken.md +++ b/contracts/docs/api/tokenBridge/BridgedToken.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## BridgedToken +# `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 84% rename from contracts/docs/api/tokenBridge/CustomBridgedToken.md rename to contracts/docs/api/tokenBridge/CustomBridgedToken.mdx index eeee08966..eef9c2b58 100644 --- a/contracts/docs/api/tokenBridge/CustomBridgedToken.md +++ b/contracts/docs/api/tokenBridge/CustomBridgedToken.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## CustomBridgedToken +# `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..f333b32e7 100644 --- a/contracts/docs/api/tokenBridge/TokenBridge.md +++ b/contracts/docs/api/tokenBridge/TokenBridge.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## TokenBridge +# `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..2225d9481 100644 --- a/contracts/docs/api/tokenBridge/interfaces/ITokenBridge.md +++ b/contracts/docs/api/tokenBridge/interfaces/ITokenBridge.mdx @@ -1,6 +1,4 @@ -# Solidity API - -## ITokenBridge +# `ITokenBridge` ### InitializationData diff --git a/contracts/docs/api/tokenBridge/lib/StorageFiller39.md b/contracts/docs/api/tokenBridge/lib/StorageFiller39.md deleted file mode 100644 index ccee22b8b..000000000 --- a/contracts/docs/api/tokenBridge/lib/StorageFiller39.md +++ /dev/null @@ -1,4 +0,0 @@ -# Solidity API - -## StorageFiller39 - diff --git a/contracts/docs/api/tokenBridge/lib/StorageFiller39.mdx b/contracts/docs/api/tokenBridge/lib/StorageFiller39.mdx new file mode 100644 index 000000000..54576613e --- /dev/null +++ b/contracts/docs/api/tokenBridge/lib/StorageFiller39.mdx @@ -0,0 +1,2 @@ +# `StorageFiller39` + diff --git a/contracts/docs/docgen-templates/contract.hbs b/contracts/docs/docgen-templates/contract.hbs new file mode 100644 index 000000000..99c682b56 --- /dev/null +++ b/contracts/docs/docgen-templates/contract.hbs @@ -0,0 +1,10 @@ +# `{{name}}` + +{{{natspec.notice}}} + +{{#each items}} +{{#hsection}} +{{>item}} +{{/hsection}} + +{{/each}} \ No newline at end of file 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..8e910bfb4 --- /dev/null +++ b/contracts/docs/scripts/create-docs-website-pr-branch.sh @@ -0,0 +1,113 @@ +#!/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 (from the new branch) + +### ASSUMPTIONS +# - Requires permissions to create a branch on docs.linea.build repo +# - Must execute this script from within linea-monorepo (can be anywhere) +# - Hardhat must be installed in the local project, Foundry must be installed globally + +### 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 + +MAX_FOLDER_DEPTH=3 + +### SCRIPT START + +# Ensure that `contracts` is the starting working directory +MONOREPO_ROOT_PATH=$(git rev-parse --show-toplevel) +cd $MONOREPO_ROOT_PATH +cd contracts + +# Check required installations +if ! command -v forge &> /dev/null; then + echo "Please install Foundry - https://book.getfoundry.sh/getting-started/installation" + exit 1 +fi + +if ! command -v pnpm &> /dev/null; then + echo "Please install pnpm - https://pnpm.io/installation" + exit 1 +fi + +if [ -z "$(pnpm -F contracts list hardhat)" ]; then + echo "Please install Hardhat - \`pnpm i\`" + exit 1 +fi + +# Docgen +npx hardhat docgen + +# Git clone docs website repo and create a 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 + UPDATE_SIDEBAR_SCRIPT to docs website repo +cd $MONOREPO_ROOT_PATH +rm -rf "$DOCS_WEBSITE_REPO_PATH/$DOCS_REPO_SMART_CONTRACT_DOC_DIRECTORY" +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" + +# Ensure directories is entirely lowercase +# To pass Github Action enforcing no uppercase for file name +cd $DOCS_WEBSITE_REPO_PATH + +# Purpose: Change folder names to lowercase +# Parameters: +# $1 - max folder depth +function directory_to_lowercase_at_depth() { + local DEPTH=$1 + for FOLDER in `find -d "$DOCS_REPO_SMART_CONTRACT_DOC_DIRECTORY" -type d -maxdepth $DEPTH` + do + NEW_FOLDER=$(echo $FOLDER | tr 'A-Z' 'a-z') + if [[ "$FOLDER" != "$NEW_FOLDER" ]]; then + mv $FOLDER $NEW_FOLDER + fi + done; +} + +# Clumsy way of forcing `find` to do breadth-first search (BFS) +# Not a true BFS currently - as we 'descend' we are redundantly repeating BFS of previously explored folder depths +# Can tolerate inefficient implementation for readability +# +# The issue with default depth-first search (DFS) algorithm of `find` is that we mutate the folder list as iterate through it +# So the `mv` command spits errors because it is acting on stale folder names +# Seems that `find` first obtains the complete folder list, then iterates through the list to apply our for-loop +# What we want is for `find` to apply our for-loop body as it adds each item to the folder list +for ((i = 1; i <= MAX_FOLDER_DEPTH; i++)); do + directory_to_lowercase_at_depth $i +done + +# Ensure filenames is entirely lowercase +# To pass Github Action enforcing no uppercase for file name +for FILENAME in `find "$DOCS_REPO_SMART_CONTRACT_DOC_DIRECTORY" -type f \( -iname \*.md -o -iname \*.mdx \)` +do + NEW_FILENAME=$(echo $FILENAME | tr 'A-Z' 'a-z') + mv $FILENAME $NEW_FILENAME +done; + +# Execute UPDATE_SIDEBAR_SCRIPT then delete the 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..ccfda3389 --- /dev/null +++ b/contracts/docs/scripts/updateSidebar.js @@ -0,0 +1,187 @@ +/* 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 + +/** + * PURPOSE + * + * Modifies sidebars.js in the root directory of https://github.com/Consensys/doc.linea to correctly include smart contract documentation pages. + * The sidebars.js file configures the sidebar for the documentation website @ https://docs.linea.build/ + */ + +const fs = require("fs"); +const path = require("path"); +const { execSync } = require("child_process"); + +/** + * TYPES + */ + +/** + * Represents a sidebar section - see https://docusaurus.io/docs/sidebar/items#sidebar-item-category + * @property {'category'} type - Type of sidebar item + * @property {number} label - Sidebar label text + * @property {null} link - Sidebar item link, set to null so only collapsing/expanding the sidebar occurs on click + * @property {boolean} collapsible - If true, sidebar item can be collapsed. If false, sidebar item is permanently expanded + * @property {string | FolderSidebar} items - Items contained in this sidebar section + */ +class FolderSidebar { + type = "category"; + label = ""; + link = null; + collapsible = true; + items = []; + + constructor(label = "", collapsible = true) { + this.label = label; + this.collapsible = collapsible; + } +} + +/** + * CONSTANTS + */ +const SIDEBAR_FILE_PATH = "sidebars.js"; +const SMART_CONTRACT_SIDEBAR_LABEL = "Linea smart contracts"; + +// Import the sidebar JS object from sidebars.js +const sidebarObject = require(path.join(__dirname, SIDEBAR_FILE_PATH)); + +/** + * MAIN FUNCTION + */ + +main(); + +function main() { + removeExistingSmartContractSidebar(sidebarObject); + const smartContractSidebarNode = getSmartContractSidebar(); + sidebarObject?.apiSidebar?.push(smartContractSidebarNode); + createNewSidebarFile(sidebarObject); +} + +/** + * HELPER FUNCTIONS + */ + +/** + * Remove existing smart contract section from sidebar object + * @param {FolderSidebar} sidebarObject + */ +function removeExistingSmartContractSidebar(sidebarObject) { + if (sidebarObject?.apiSidebar) { + sidebarObject.apiSidebar = sidebarObject?.apiSidebar.filter(sidebarSection => sidebarSection?.label !== SMART_CONTRACT_SIDEBAR_LABEL); + } +} + +/** + * Creates FolderSidebar representing folder structure of smart contract documentation pages + * @returns {FolderSidebar} + */ +function getSmartContractSidebar() { + // Create and populate smart contract sidebar + const smartContractsPath = path.join( + __dirname, + "docs", + "api", + "linea-smart-contracts", + ); + + let smartContractSidebar = new FolderSidebar( + SMART_CONTRACT_SIDEBAR_LABEL, + // Prefer having the smart contract sidebar section permanently expanded to fill out the main sidebar + false, + ); + + populateFolderSidebar( + smartContractSidebar, + smartContractsPath, + ".mdx", + ); + + return smartContractSidebar; +} + +/** + * Recursive function to populate FolderSidebar for a given folder + * Performs depth-first search (DFS) of the folder tree + * @param {FolderSidebar} folderSidebar - Mutated throughout the function body. Mutated object is then returned by the function. + * @param {string} subdirectoryPath - folder path + * @param {string} fileExtension + * @return {FolderSidebar} + */ +function populateFolderSidebar(folderSidebar, subdirectoryPath, fileExtension) { + const folderFileList = fs.readdirSync(subdirectoryPath); + + // Ensure *.mdx files at the top of the sidebar section + for (const fileNode of folderFileList) { + const filePath = path.join(subdirectoryPath, fileNode); + const fileMetadata = fs.statSync(filePath); + + // Base case => *.mdx file => Add relative path to sidebar + if (fileMetadata.isFile() && fileNode.endsWith(fileExtension)) { + const relativePath = path.relative( + path.join(__dirname, "docs"), + filePath.split(fileExtension)[0], + ); + folderSidebar?.items.push(relativePath); + } + } + + // Ensure directories are below *.mdx files in the sidebar section + for (const fileNode of folderFileList) { + const filePath = path.join(subdirectoryPath, fileNode); + const fileMetadata = fs.statSync(filePath); + + // Directory => Create new child FolderSidebar, then make recursive call to populate new child FolderSidebar + if (fileMetadata.isDirectory()) { + let newFolderNode = new FolderSidebar(fileNode); + populateFolderSidebar(newFolderNode, filePath, fileExtension); + // Add populated child FolderSidebar to current sidebar section + folderSidebar?.items.push(newFolderNode); + } + } + + // Not a *.mdx file or directory => Do nothing + + return folderSidebar; +} + +/** + * Overwrites existing sidebars.js file with modified sidebar object + * @param {FolderSidebar} sidebarObject - Entire sidebar object to save + */ +function createNewSidebarFile(sidebarObject) { + // Create new sidebars.js file content + 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}`; + + // Overwrite existing sidebars.js + const newSidebarFilePath = path.join(__dirname, SIDEBAR_FILE_PATH); + fs.writeFileSync(newSidebarFilePath, newSidebarFileContent); + + // Do linting + lintJSFile(newSidebarFilePath); +} + +/** + * Execute linting of Javascript file + * @param {string} filePath + */ +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..c4e005952 100644 --- a/contracts/hardhat.config.ts +++ b/contracts/hardhat.config.ts @@ -157,6 +157,9 @@ const config: HardhatUserConfig = { exclude: ["token", "test-contracts", "proxies", "tools", "interfaces/tools", "tokenBridge/mocks", "verifiers"], pages: "files", outputDir: "docs/api/", + // For compatibility with docs.linea.build + pageExtension: ".mdx", + templates: "docs/docgen-templates", }, };