Skip to content

Commit

Permalink
[Feat] Automate smart contract docgen and PR branch creation into Lin…
Browse files Browse the repository at this point in the history
…ea docs repo (#446)

* did poc for autogenerated *.mdx into docs.linea.build

* changed sparseMerkleProof

* first draft of contracts-docgen

* fix typos

* try different github token

* cleanup

* created create-docs-website-pr-branch

* cleanup for doc website repo scripts

* created first docs-repo pr using create-docs-website-pr-branch.sh

* improve comments

* added bash script segment to change filename to lowercase

* fix *.mdx headers to make more docusarus friendly

* update scripts for updated docs pr

* added comments to updateSidebar.js

* fix scripts after local test

* added installation checks

* Update contracts/docs/scripts/create-docs-website-pr-branch.sh

Co-authored-by: The Dark Jester <[email protected]>
Signed-off-by: kyzooghost <[email protected]>

---------

Signed-off-by: kyzooghost <[email protected]>
Co-authored-by: The Dark Jester <[email protected]>
  • Loading branch information
kyzooghost and thedarkjester authored Dec 20, 2024
1 parent 6ad7ba2 commit ea79b2d
Show file tree
Hide file tree
Showing 55 changed files with 405 additions and 139 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/run-smc-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ on:
- 'testdata/**'
- 'prover/**'
- '!contracts/**/*.md'
- '!contracts/**/*.mdx'
- '!testdata/**/*.md'
- '!prover/**/*.md'
- '!**/docs/**'
push:
branches:
- main
Expand All @@ -17,8 +19,10 @@ on:
- 'testdata/**'
- 'prover/**'
- '!contracts/**/*.md'
- '!contracts/**/*.mdx'
- '!testdata/**/*.md'
- '!prover/**/*.md'
- '!**/docs/**'

env:
GOPROXY: "https://proxy.golang.org"
Expand Down
6 changes: 3 additions & 3 deletions contracts/contracts/lib/SparseMerkleProof.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Solidity API

## LineaRollup
# `LineaRollup`

### CONTRACT_VERSION

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Solidity API

## ZkEvmV2
# `ZkEvmV2`

### MODULO_R

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Solidity API

## IGenericErrors
# `IGenericErrors`

### ZeroAddressNotAllowed

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Solidity API

## IMessageService
# `IMessageService`

### MessageSent

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Solidity API

## IPauseManager
# `IPauseManager`

### PauseTypeRole

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Solidity API

## IPermissionsManager
# `IPermissionsManager`

### RoleAddress

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Solidity API

## IRateLimiter
# `IRateLimiter`

### RateLimitInitialized

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Solidity API

## IL1MessageManager
# `IL1MessageManager`

### RollingHashUpdated

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Solidity API

## IL1MessageManagerV1
# `IL1MessageManagerV1`

### MessageDoesNotExistOrHasAlreadyBeenClaimed

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Solidity API

## IL1MessageService
# `IL1MessageService`

### ClaimMessageWithProofParams

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Solidity API

## ILineaRollup
# `ILineaRollup`

### InitializationData

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Solidity API

## IPlonkVerifier
# `IPlonkVerifier`

### Verify

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Solidity API

## IZkEvmV2
# `IZkEvmV2`

### StartingRootHashDoesNotMatch

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Solidity API

## IL2MessageManager
# `IL2MessageManager`

### RollingHashUpdated

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Solidity API

## IL2MessageManagerV1
# `IL2MessageManagerV1`

### MinimumFeeChanged

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Solidity API

## IL2MessageServiceV1
# `IL2MessageServiceV1`

### setMinimumFee

Expand Down
24 changes: 24 additions & 0 deletions contracts/docs/api/lib/CallForwardingProxy.mdx
Original file line number Diff line number Diff line change
@@ -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.

Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Solidity API

## L2MessageServicePauseManager
# `L2MessageServicePauseManager`

### PAUSE_L1_L2_ROLE

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Solidity API

## LineaRollupPauseManager
# `LineaRollupPauseManager`

### PAUSE_L1_L2_ROLE

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Solidity API

## Mimc
# `Mimc`

### DataMissing

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Solidity API

## PauseManager
# `PauseManager`

### PAUSE_ALL_ROLE

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Solidity API

## PermissionsManager
# `PermissionsManager`

### __Permissions_init

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Solidity API

## SparseMerkleProof
# `SparseMerkleProof`

### Account

Expand Down Expand Up @@ -130,7 +128,7 @@ Hash a value using MIMC hash

| Name | Type | Description |
| ---- | ---- | ----------- |
| [0] | bytes32 | {bytes32} Mimc hash |
| [0] | bytes32 | bytes32 Mimc hash |

### getLeaf

Expand Down Expand Up @@ -190,7 +188,7 @@ Hash account value

| Name | Type | Description |
| ---- | ---- | ----------- |
| [0] | bytes32 | {bytes32} Account value hash |
| [0] | bytes32 | bytes32 Account value hash |

### hashStorageValue

Expand All @@ -210,5 +208,5 @@ Hash storage value

| Name | Type | Description |
| ---- | ---- | ----------- |
| [0] | bytes32 | {bytes32} Storage value hash |
| [0] | bytes32 | bytes32 Storage value hash |

Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Solidity API

## TokenBridgePauseManager
# `TokenBridgePauseManager`

### PAUSE_INITIATE_TOKEN_BRIDGING_ROLE

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Solidity API

## Utils
# `Utils`

### _efficientKeccak

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Solidity API

## MessageServiceBase
# `MessageServiceBase`

### messageService

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Solidity API

## L1MessageManager
# `L1MessageManager`

### rollingHashes

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Solidity API

## L1MessageService
# `L1MessageService`

### systemMigrationBlock

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Solidity API

## TransientStorageReentrancyGuardUpgradeable
# `TransientStorageReentrancyGuardUpgradeable`

### ReentrantCall

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Solidity API

## L1MessageManagerV1
# `L1MessageManagerV1`

### INBOX_STATUS_UNKNOWN

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Solidity API

## L1MessageServiceV1
# `L1MessageServiceV1`

### nextMessageNumber

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Solidity API

## L2MessageManager
# `L2MessageManager`

### L1_L2_MESSAGE_SETTER_ROLE

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Solidity API

## L2MessageService
# `L2MessageService`

### CONTRACT_VERSION

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Solidity API

## L2MessageManagerV1
# `L2MessageManagerV1`

### INBOX_STATUS_UNKNOWN

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Solidity API

## L2MessageServiceV1
# `L2MessageServiceV1`

### MINIMUM_FEE_SETTER_ROLE

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Solidity API

## MessageHashing
# `MessageHashing`

### _hashMessage

Expand Down
Loading

0 comments on commit ea79b2d

Please sign in to comment.