Skip to content

Commit

Permalink
specs: auto generate table of contents (#1441)
Browse files Browse the repository at this point in the history
## Motivation 
The table of contents at the top of each file can be a maintenance
burden. We can auto-generate it with
[mdbook-toc](https://github.com/badboy/mdbook-toc).

## Screenshot

Before | After
--- | ---
<img width="500" alt="before"
src="https://user-images.githubusercontent.com/3699047/222535783-8ad53ec3-43db-4e4b-ad8f-ea974061190b.png">
| <img width="479" alt="after"
src="https://user-images.githubusercontent.com/3699047/222535796-39c4172d-79b9-4e64-a492-7a68c37f5381.png">
  • Loading branch information
rootulp committed Mar 6, 2023
1 parent 1547891 commit c09843d
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 118 deletions.
7 changes: 6 additions & 1 deletion specs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@

## Building From Source

Prerequisite: [install mdBook](https://rust-lang.github.io/mdBook/guide/installation.html).
Install [mdbook](https://rust-lang.github.io/mdBook/guide/installation.html) and [mdbook-toc](https://github.com/badboy/mdbook-toc):

```sh
cargo install mdbook
cargo install mdbook-toc
```

To build book:

Expand Down
4 changes: 4 additions & 0 deletions specs/book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ git-repository-url = "https://github.com/celestiaorg/celestia-app"

[rust]
edition = "2021"

[preprocessor.toc]
command = "mdbook-toc"
renderer = ["html"]
5 changes: 1 addition & 4 deletions specs/src/rationale/message_block_layout.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# Message Layout

- [Preamble](#preamble)
- [Message Layout Rationale](#message-layout-rationale)
- [Non-Interactive Default Rules](#non-interactive-default-rules)
- [Caveats](#caveats)
<!-- toc -->

## Preamble

Expand Down
3 changes: 1 addition & 2 deletions specs/src/specs/block_proposer.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Honest Block Proposer

- [Deciding on a Block Size](#deciding-on-a-block-size)
- [Laying out Transactions and Messages](#laying-out-transactions-and-messages)
<!-- toc -->

This document describes the tasks of an honest block proposer to assemble a new block. Performing these actions is not enforced by the [consensus rules](./consensus.md), so long as a valid block is produced.

Expand Down
30 changes: 1 addition & 29 deletions specs/src/specs/consensus.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,6 @@
# Consensus Rules

- [System Parameters](#system-parameters)
- [Units](#units)
- [Constants](#constants)
- [Reserved Namespace IDs](#reserved-namespace-ids)
- [Reserved State Subtree IDs](#reserved-state-subtree-ids)
- [Rewards and Penalties](#rewards-and-penalties)
- [Leader Selection](#leader-selection)
- [Fork Choice](#fork-choice)
- [Block Validity](#block-validity)
- [Block Structure](#block-structure)
- [`block.header`](#blockheader)
- [`block.availableDataHeader`](#blockavailabledataheader)
- [`block.lastCommit`](#blocklastcommit)
- [`block.availableData`](#blockavailabledata)
- [State Transitions](#state-transitions)
- [`block.availableData.transactionData`](#blockavailabledatatransactiondata)
- [SignedTransactionDataTransfer](#signedtransactiondatatransfer)
- [SignedTransactionDataMsgPayForData](#signedtransactiondatamsgpayfordata)
- [SignedTransactionDataCreateValidator](#signedtransactiondatacreatevalidator)
- [SignedTransactionDataBeginUnbondingValidator](#signedtransactiondatabeginunbondingvalidator)
- [SignedTransactionDataUnbondValidator](#signedtransactiondataunbondvalidator)
- [SignedTransactionDataCreateDelegation](#signedtransactiondatacreatedelegation)
- [SignedTransactionDataBeginUnbondingDelegation](#signedtransactiondatabeginunbondingdelegation)
- [SignedTransactionDataUnbondDelegation](#signedtransactiondataunbonddelegation)
- [SignedTransactionDataBurn](#signedtransactiondataburn)
- [SignedTransactionRedelegateCommission](#signedtransactionredelegatecommission)
- [SignedTransactionRedelegateReward](#signedtransactionredelegatereward)
- [Begin Block](#begin-block)
- [End Block](#end-block)
<!-- toc -->

## System Parameters

Expand Down
73 changes: 1 addition & 72 deletions specs/src/specs/data_structures.md
Original file line number Diff line number Diff line change
@@ -1,77 +1,6 @@
# Data Structures

- [Data Structures Overview](#data-structures-overview)
- [Type Aliases](#type-aliases)
- [Blockchain Data Structures](#blockchain-data-structures)
- [Block](#block)
- [Header](#header)
- [AvailableDataHeader](#availabledataheader)
- [AvailableData](#availabledata)
- [Commit](#commit)
- [Timestamp](#timestamp)
- [HashDigest](#hashdigest)
- [TransactionFee](#transactionfee)
- [Address](#address)
- [CommitSig](#commitsig)
- [Signature](#signature)
- [ConsensusVersion](#consensusversion)
- [Serialization](#serialization)
- [Hashing](#hashing)
- [Public-Key Cryptography](#public-key-cryptography)
- [Merkle Trees](#merkle-trees)
- [Binary Merkle Tree](#binary-merkle-tree)
- [BinaryMerkleTreeInclusionProof](#binarymerkletreeinclusionproof)
- [Namespace Merkle Tree](#namespace-merkle-tree)
- [NamespaceMerkleTreeInclusionProof](#namespacemerkletreeinclusionproof)
- [Sparse Merkle Tree](#sparse-merkle-tree)
- [SparseMerkleTreeInclusionProof](#sparsemerkletreeinclusionproof)
- [Erasure Coding](#erasure-coding)
- [Reed-Solomon Erasure Coding](#reed-solomon-erasure-coding)
- [2D Reed-Solomon Encoding Scheme](#2d-reed-solomon-encoding-scheme)
- [Share](#share)
- [Compact Share](#compact-share)
- [Sparse Share](#sparse-share)
- [Parity Share](#parity-share)
- [Namespace Padding Share](#namespace-padding-share)
- [Tail Padding Share](#tail-padding-share)
- [Arranging Available Data Into Shares](#arranging-available-data-into-shares)
- [Available Data](#available-data)
- [TransactionData](#transactiondata)
- [WrappedTransaction](#wrappedtransaction)
- [Transaction](#transaction)
- [SignedTransactionData](#signedtransactiondata)
- [SignedTransactionDataTransfer](#signedtransactiondatatransfer)
- [SignedTransactionDataMsgPayForData](#signedtransactiondatamsgpayfordata)
- [SignedTransactionDataCreateValidator](#signedtransactiondatacreatevalidator)
- [SignedTransactionDataBeginUnbondingValidator](#signedtransactiondatabeginunbondingvalidator)
- [SignedTransactionDataUnbondValidator](#signedtransactiondataunbondvalidator)
- [SignedTransactionDataCreateDelegation](#signedtransactiondatacreatedelegation)
- [SignedTransactionDataBeginUnbondingDelegation](#signedtransactiondatabeginunbondingdelegation)
- [SignedTransactionDataUnbondDelegation](#signedtransactiondataunbonddelegation)
- [SignedTransactionDataBurn](#signedtransactiondataburn)
- [SignedTransactionRedelegateCommission](#signedtransactionredelegatecommission)
- [SignedTransactionRedelegateReward](#signedtransactionredelegatereward)
- [PayForBlobData](#payforblobdata)
- [IntermediateStateRootData](#intermediatestaterootdata)
- [WrappedIntermediateStateRoot](#wrappedintermediatestateroot)
- [IntermediateStateRoot](#intermediatestateroot)
- [MessageData](#messagedata)
- [Message](#message)
- [State](#state)
- [StateElement](#stateelement)
- [Account](#account)
- [Delegation](#delegation)
- [Validator](#validator)
- [ActiveValidatorCount](#activevalidatorcount)
- [ActiveVotingPower](#activevotingpower)
- [ProposerBlockReward](#proposerblockreward)
- [ProposerInitialVotingPower](#proposerinitialvotingpower)
- [ValidatorQueueHead](#validatorqueuehead)
- [PeriodEntry](#periodentry)
- [Decimal](#decimal)
- [MessagePaid](#messagepaid)
- [MessagePaidHead](#messagepaidhead)
- [Consensus Parameters](#consensus-parameters)
<!-- toc -->

## Data Structures Overview

Expand Down
11 changes: 1 addition & 10 deletions specs/src/specs/networking.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
# Networking

- [Wire Format](#wire-format)
- [AvailableData](#availabledata)
- [AvailableDataRow](#availabledatarow)
- [ConsensusProposal](#consensusproposal)
- [MsgWirePayForData](#msgwirepayfordata)
- [Invalid Erasure Coding](#invalid-erasure-coding)
- [ShareProof](#shareproof)
- [BadEncodingFraudProof](#badencodingfraudproof)
- [Invalid State Update](#invalid-state-update)
- [StateFraudProof](#statefraudproof)
<!-- toc -->

## Wire Format

Expand Down

0 comments on commit c09843d

Please sign in to comment.