Skip to content

Commit b1cc033

Browse files
specs: fix spec markdown linting (#3061)
* style(specs): fix toc/lint in specs, update CI style(specs): lint/toc/link fixes style(readme): fix bedrock contracts link chore(specs): specs lint scripts chore(specs): update CI jobs to use new lint scripts and unsilence links linter style(specs): fix toc, fix quotes in markdown lint script * yarn: update linting dependencies * specs: add minimal batch submitter spec, fix broken links Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent 7b7dae0 commit b1cc033

16 files changed

+465
-284
lines changed

.circleci/config.yml

+8-3
Original file line numberDiff line numberDiff line change
@@ -277,14 +277,19 @@ jobs:
277277
image: ubuntu-2004:202111-02
278278
steps:
279279
- checkout
280+
- run:
281+
name: yarn dev deps # todo: what's the best way to pull in the dependencies for linting? yarn install above is using production env without dev dependencies
282+
command: yarn install --production=false
283+
- run:
284+
name: specs toc
285+
command: yarn lint:specs:toc && git diff --exit-code
280286
- run:
281287
name: markdown lint
282-
command: |
283-
docker run -v `pwd`:/workdir davidanson/markdownlint-cli2:0.4.0 "op-node/README.md" "./specs/**/*.md" "#**/node_modules"
288+
command: yarn lint:specs:check
284289
- run:
285290
name: link lint
286291
command: |
287-
docker run --init -it -v `pwd`:/input lycheeverse/lychee --verbose --no-progress --exclude-loopback --exclude twitter.com --exclude-mail /input/README.md "/input/specs/**/*.md" "/input/meta/**/*.md" "/input/op-node/**/*.md" || exit 0
292+
docker run --init -it -v `pwd`:/input lycheeverse/lychee --verbose --no-progress --exclude-loopback --exclude twitter.com --exclude-mail /input/README.md "/input/specs/**/*.md"
288293
289294
fuzz-op-node:
290295
docker:

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ root
5858
├── <a href="./teleportr">teleportr</a>: Bridge for teleporting ETH between L1 and L2 at low cost
5959

6060
~~ BEDROCK upgrade - Not production-ready yet, part of next major upgrade ~~
61-
├── <a href="./contracts-bedrock">contracts-bedrock</a>: Bedrock smart contracts. To be merged with ./packages/contracts.
61+
├── <a href="./packages/contracts-bedrock">packages/contracts-bedrock</a>: Bedrock smart contracts. To be merged with ./packages/contracts.
6262
├── <a href="./op-bindings">op-bindings</a>: Go bindings for Bedrock smart contracts.
6363
├── <a href="./op-batcher">op-batcher</a>: L2-Batch Submitter, submits bundles of batches to L1
6464
├── <a href="./op-e2e">op-e2e</a>: End-to-End testing of all bedrock components in Go

package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@
4646
"lint:ts:check": "yarn lerna run lint:ts:check",
4747
"lint:check": "yarn lerna run lint:check",
4848
"lint:fix": "yarn lerna run lint:fix --parallel",
49+
"lint:specs:fix": "yarn run markdownlint-cli2-fix \"./specs/**/*.md\"",
50+
"lint:specs:check": "yarn run markdownlint-cli2 \"./specs/**/*.md\"",
51+
"lint:specs:toc": "yarn run doctoc '--title=**Table of Contents**' ./specs",
4952
"postinstall": "patch-package",
5053
"ready": "yarn lint && yarn test",
5154
"prepare": "husky install",
@@ -63,7 +66,7 @@
6366
"chai": "^4.2.0",
6467
"copyfiles": "^2.3.0",
6568
"depcheck": "^1.4.3",
66-
"doctoc": "2.1.0",
69+
"doctoc": "^2.2.0",
6770
"eslint": "^8.16.0",
6871
"eslint-config-prettier": "^8.3.0",
6972
"eslint-config-standard": "^16.0.3",
@@ -79,7 +82,7 @@
7982
"lerna": "^4.0.0",
8083
"lint-staged": "11.0.0",
8184
"markdownlint": "^0.24.0",
82-
"markdownlint-cli2": "^0.3.2",
85+
"markdownlint-cli2": "0.4.0",
8386
"mkdirp": "^1.0.4",
8487
"mocha": "^8.4.0",
8588
"nyc": "^15.1.0",

specs/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!-- DOCTOC SKIP -->
22
# Optimism Bedrock specs
33

4-
This directory contains the plain english specs for Optimism, an minimal optimistic rollup protocol
4+
This directory contains the plain english specs for Optimism, a minimal optimistic rollup protocol
55
that maintains 1:1 compatibility with Ethereum.
66

77
## Specification Contents

specs/batcher.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!-- DOCTOC SKIP -->
2+
# Batch Submitter
3+
4+
The batch submitter, also referred to as the batcher, is the entity submitting the L2 sequencer data to L1,
5+
to make it available for verifiers.
6+
7+
[derivation-spec]: ./derivation.md
8+
9+
The format of the data transactions is defined in the [derivation spec]: the data is constructed from L2 blocks
10+
in the reverse order as it is derived from data into L2 blocks.
11+
12+
The timing, operation and transaction signing is implementation-specific: any data can be submitted at any time,
13+
but only the data that matches the [derivation spec] rules will be valid from the verifier perspective.
14+
15+
The most minimal batcher implementation can be defined as a loop of the following operations:
16+
17+
1. See if the `unsafe` L2 block number is past the `safe` block number: `unsafe` data needs to be submitted.
18+
2. Iterate over all unsafe L2 blocks, skip any that were previously submitted.
19+
3. Open a channel, buffer all the L2 block data to be submitted,
20+
while applying the encoding and compression as defined in the [derivation spec].
21+
4. Pull frames from the channel to fill data transactions with, until the channel is empty.
22+
5. Submit the data transactions to L1
23+
24+
The L2 view of safe/unsafe does not instantly update after data is submitted, nor when it gets confirmed on L1,
25+
so special care may have to be taken to not duplicate data submissions.

specs/deposits.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ with the authorization and validation conditions on L2.
3636
- [User-Deposited Transactions](#user-deposited-transactions)
3737
- [Deposit Contract](#deposit-contract)
3838
- [Address Aliasing](#address-aliasing)
39-
- [Deposit Feed Contract: Reference Implementation](#deposit-feed-contract-reference-implementation)
39+
- [Deposit Contract Implementation: Optimism Portal](#deposit-contract-implementation-optimism-portal)
4040

4141
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
4242

@@ -221,7 +221,7 @@ The contract has the following solidity interface, and can be interacted with ac
221221

222222
A reference implementation of the L1 Attributes predeploy contract can be found in [L1Block.sol].
223223

224-
[L1Block.sol]: ../packages/contracts/contracts/L2/L1Block.sol
224+
[L1Block.sol]: ../packages/contracts-bedrock/contracts/L2/L1Block.sol
225225

226226
After running `yarn build` in the `packages/contracts` directory, the bytecode to add to the genesis
227227
file will be located in the `deployedBytecode` field of the build artifacts file at
@@ -233,8 +233,8 @@ file will be located in the `deployedBytecode` field of the build artifacts file
233233

234234
[User-deposited transactions][g-user-deposited] are [deposited transactions][deposited-tx-type]
235235
generated by the [L2 Chain Derivation][g-derivation] process. The content of each user-deposited
236-
transaction are determined by the corresponding `TransactionDeposited` event emitted by the [deposit
237-
feed contract][deposit-feed-contract] on L1.
236+
transaction are determined by the corresponding `TransactionDeposited` event emitted by the
237+
[deposit contract][deposit-contract] on L1.
238238

239239
1. `from` is unchanged from the emitted value (though it may have been transformed to an alias in
240240
the deposit feed contract).
@@ -275,8 +275,8 @@ contract on L1 has the same address as a contract on L2 but doesn't have the sam
275275
for EOAs because they're guaranteed to have the same "code" (i.e. no code at all). This also makes
276276
it possible for users to interact with contracts on L2 even when the Sequencer is down.
277277

278-
#### Deposit Feed Contract: Reference Implementation
278+
#### Deposit Contract Implementation: Optimism Portal
279279

280-
A reference implementation of the Deposit Feed contract can be found in [DepositFeed.sol].
280+
A reference implementation of the deposit contract can be found in [OptimismPortal.sol].
281281

282-
[DepositFeed.sol]: ../packages/contracts/contracts/L1/abstracts/DepositFeed.sol
282+
[OptimismPortal.sol]: ../packages/contracts-bedrock/contracts/L1/OptimismPortal.sol

specs/derivation.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
[g-avail-provider]: glossary.md#data-availability-provider
2929
[g-batcher]: glossary.md#batcher
3030
[g-l2-output]: glossary.md#l2-output
31-
[g-fault-proof]: glosary.md#fault-proof
31+
[g-fault-proof]: glossary.md#fault-proof
3232
[g-channel]: glossary.md#channel
3333
[g-channel-frame]: glossary.md#channel-frame
3434
[g-rollup-node]: glossary.md#rollup-node
@@ -181,7 +181,7 @@ by a correct output root **for the existing sequencer batches.**
181181

182182
Refer to the [Batch Submission specification][batcher-spec] for more information.
183183

184-
[batcher-spec]: batching.md
184+
[batcher-spec]: batcher.md
185185

186186
> **TODO** rewrite the batch submission specification
187187
>
@@ -303,7 +303,7 @@ where:
303303
> can influence things down the line!!
304304
305305
[sqlite-uvarint]: https://www.sqlite.org/src4/doc/trunk/www/varint.wiki
306-
[batcher-spec]: batching.md
306+
[batcher-spec]: batcher.md
307307

308308
### Channel Format
309309

specs/introduction.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ Links to components mentioned in this diagram:
138138
- [Execution Engine](./exec-engine.md)
139139
- Sequencer Batch Submitter (WIP)
140140
- [L2 Output Oracle](./proposals.md#l2-output-oracle-smart-contract)
141-
- [L2 Output Submitter](./proposals#proposing-l2-output-commitments)
141+
- [L2 Output Submitter](./proposals.md#proposing-l2-output-commitments)
142142
- Fault Proof VM (WIP)
143143

144144
### Withdrawing

specs/meta/devnet.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<!-- DOCTOC SKIP -->
12
# Bedrock Local Devnet Setup
23

34
<!-- START doctoc generated TOC please keep comment here to allow auto update -->

specs/meta/linting.md

+7-4
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,13 @@ Justification for linting rules in [.markdownlint.json](/.markdownlint.json):
2424
- *no-emphasis-as-heading*: enable emphasized paragraphs
2525

2626
```shell
27-
yarn # Install dependencies
28-
yarn lint # Run linter
29-
yarn lint:links # Check links
30-
yarn lint:toc # Update TOC docs
27+
yarn # Install dependencies
28+
yarn lint:specs:check # Run linter
29+
yarn lint:specs:fix # Fix lint issues
30+
yarn lint:specs:toc # Update TOC docs
31+
32+
# Check links
33+
docker run --init -it -v `pwd`:/input lycheeverse/lychee --verbose --no-progress --exclude-loopback --exclude twitter.com --exclude-mail /input/README.md "/input/specs/**/*.md"
3134
```
3235

3336
To check links, you'll need to install [lychee]. The [version ran in CI][lychee-ci] is 0.8.1, but

specs/meta/markdown-style.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ In general:
4343
- e.g. `[g-block]: glossary.md#block`
4444
- Example: [Rollup Node Specification source][rollup-node]
4545

46-
[glossary]: ../specs/glossary.md
46+
[glossary]: ../glossary.md
4747
[rollup-node]: https://raw.githubusercontent.com/ethereum-optimism/optimistic-specs/main/specs/rollup-node.md
4848

4949
## Internal (In-File) Links

specs/overview.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ and fault proofs.
8585

8686
**Spec links:**
8787

88-
- [Execution Engine](specs/exec-engine.md)
88+
- [Execution Engine](./exec-engine.md)
8989

9090
Since the EE uses Geth under the hood, Optimism uses Geth's built-in peer-to-peer network and transaction pool to
9191
propagate transactions. The same network can also be used to propagate submitted blocks and support snap-sync.

specs/predeploys.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,9 @@ Reserved for future use.
333333

334334
## L1Block
335335

336-
[l1-block-predeploy]: glossary.md#l1-block-predeployed-contract
336+
[l1-block-predeploy]: glossary.md#l1-attributes-predeployed-contract
337337

338-
The [L1Block](l1-block-predeploy) was introduced in Bedrock and is responsible for
338+
The [L1Block][l1-block-predeploy] was introduced in Bedrock and is responsible for
339339
maintaining L1 context in L2. This allows for L1 state to be accessed in L2.
340340

341341
```solidity
@@ -370,10 +370,11 @@ interface L1Block {
370370
* @dev sets the latest L1 block attributes
371371
*/
372372
function setL1BlockValues(
373-
uint256 _number,
374-
uint256 _timestamp,
373+
uint64 _number,
374+
uint64 _timestamp,
375375
uint256 _basefee,
376-
bytes32 _hash
376+
bytes32 _hash,
377+
uint64 _sequenceNumber
377378
) external;
378379
}
379380
```

specs/rollup-node-p2p.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ For async communication over different channels over the same connection, multip
171171

172172
#### GossipSub
173173

174-
[GossipSub 1.1](gossipsub) (`/meshsub/1.1.0`, i.e. with peer-scoring extension) is a pubsub protocol for mesh-networks,
174+
[GossipSub 1.1][gossipsub] (`/meshsub/1.1.0`, i.e. with peer-scoring extension) is a pubsub protocol for mesh-networks,
175175
deployed on L1 consensus (Eth2) and other protocols such as Filecoin, offering lots of customization options.
176176

177177
##### Content-based message identification

specs/rollup-node.md

-5
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ currently only concerned with the specification of the rollup driver.
2424
- [Derivation](#derivation)
2525
- [L2 Output RPC method](#l2-output-rpc-method)
2626
- [Output Method API](#output-method-api)
27-
- [L2 Batch creation RPC method](#l2-batch-creation-rpc-method)
2827

2928
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
3029

@@ -74,7 +73,3 @@ The input and return types here are as defined by the [engine API specs][engine-
7473
- returns:
7574
1. `version`: `DATA`, 32 Bytes - the output root version number, beginning with 0.
7675
1. `l2OutputRoot`: `DATA`, 32 Bytes - the output root
77-
78-
## L2 Batch creation RPC method
79-
80-
See [Batch derivation](./batching.md) for an RPC specification for batch data submission.

0 commit comments

Comments
 (0)