Skip to content

Commit 40f0f15

Browse files
committed
Apply formatting and spell checking
Ran "treefmt" on the whole repository.
1 parent fc45895 commit 40f0f15

File tree

30 files changed

+280
-255
lines changed

30 files changed

+280
-255
lines changed

CONTRIBUTING.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
Thank you for considering contributing and sharing your knowledge about the Cardano protocol in one capacity or another.
44

55
There are basically two ways to contribute:
6-
- Validate and provide feedback about existing blueprints
7-
- Create or update blueprints
6+
7+
- Validate and provide feedback about existing blueprints
8+
- Create or update blueprints
89

910
## Validate blueprints
1011

@@ -44,10 +45,10 @@ Thank you for contributing your changes by opening a pull request!
4445

4546
We do appreciate it if your pull request meets the following criteria:
4647

47-
+ **Description of the changes**: providing a clear summary of the changes is beneficial
48-
+ **Quality of changes**: ensure that new or updated automated tests validate your changes
49-
+ **Scope**: we prefer multiple pull requests that are well-scoped rather than a single large one
50-
+ **Correctness**: the pull request should pass the continuous integration (CI) pipeline.
48+
- **Description of the changes**: providing a clear summary of the changes is beneficial
49+
- **Quality of changes**: ensure that new or updated automated tests validate your changes
50+
- **Scope**: we prefer multiple pull requests that are well-scoped rather than a single large one
51+
- **Correctness**: the pull request should pass the continuous integration (CI) pipeline.
5152

5253
The project is currently in an expand-and-gather phase with no requirement of approvals, but consider requesting for reviews on Github-suggested reviewers.
5354

src/SUMMARY.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
- [BlockFetch](network/node-to-node/blockfetch/README.md)
1010
- [TxSubmission2](network/node-to-node/txsubmission2/README.md)
1111
- [KeepAlive](network/node-to-node/keep-alive/README.md)
12-
- [PeerSharing]()
12+
- [PeerSharing](<>)
1313
- [Consensus](consensus/README.md)
1414
- [Chain validity](consensus/chainvalid.md)
1515
- [Chain selection](consensus/chainsel.md)
@@ -28,15 +28,15 @@
2828
- [Serialization](plutus/serialization.md)
2929
- [Client interfaces](client/README.md)
3030
- [NTC](client/node-to-client/README.md)
31-
- [Handshake]()
31+
- [Handshake](<>)
3232
- [LocalStateQuery](client/node-to-client/state-query/README.md)
33-
- [LocalTxSubmission]()
34-
- [TxMonitor]()
35-
- [LocalChainSync]()
33+
- [LocalTxSubmission](<>)
34+
- [TxMonitor](<>)
35+
- [LocalChainSync](<>)
3636
- [UTxO-RPC](client/utxo-rpc/README.md)
3737
- [Codec basics](codecs/README.md)
3838

39-
---
39+
______________________________________________________________________
4040

4141
- [Styleguide](styleguide.md)
4242
- [Contributing](CONTRIBUTING.md)

src/client/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ enabling this interaction:
1313
Below we present a table with clients and servers that implement each protocol:
1414

1515
| Server | NTC | UTxO RPC |
16-
|:---------------|-----|----------|
16+
| :------------- | --- | -------- |
1717
| [cardano-node] |||
1818
| [dingo] |||
1919
| [amaru] |||
2020

2121
<br/>
2222

2323
| Client | NTC | UTxO RPC |
24-
|:--------------|-----|----------|
24+
| :------------ | --- | -------- |
2525
| [cardano-cli] |||
2626
| [pallas] |||
2727
| [gouroboros] |||
@@ -30,9 +30,9 @@ Below we present a table with clients and servers that implement each protocol:
3030
>
3131
> Please help us keep this list up-to-date by [suggesting an edit](https://github.com/cardano-scaling/cardano-blueprint/edit/main/src/client/README.md).
3232
33-
[cardano-node]: https://github.com/IntersectMBO/cardano-node
33+
[amaru]: https://github.com/pragma-org/amaru/
3434
[cardano-cli]: https://github.com/IntersectMBO/cardano-cli
35+
[cardano-node]: https://github.com/IntersectMBO/cardano-node
3536
[dingo]: https://github.com/blinklabs-io/dingo
3637
[gouroboros]: https://github.com/blinklabs-io/gouroboros
37-
[amaru]: https://github.com/pragma-org/amaru/
3838
[pallas]: https://github.com/txpipe/pallas

src/client/node-to-client/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ In particular, these mini-protocols will also be wrapped by a
1111

1212
These mini-protocols are:
1313

14-
- [Handshake](): to negotiate the versions used in the connection,
15-
- [LocalTxSubmission](): to submit transactions to the network,
14+
- [Handshake](<>): to negotiate the versions used in the connection,
15+
- [LocalTxSubmission](<>): to submit transactions to the network,
1616
- [LocalStateQuery](state-query): to query for information about the ledger state,
17-
- [TxMonitor](): to monitor the status of transactions,
18-
- [LocalChainSync](): to retrieve chains of blocks from the node.
17+
- [TxMonitor](<>): to monitor the status of transactions,
18+
- [LocalChainSync](<>): to retrieve chains of blocks from the node.

src/client/node-to-client/state-query/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ stateDiagram
6161

6262
</details>
6363

64-
[^1]: Derived from [ogmios](https://ogmios.dev/mini-protocols/local-state-query/)' great ascii art description.
65-
6664
## Acquire a state
6765

6866
To use the ledger state query API, a client needs to first specify at which point on the chain the query should be executed. Depending on the server implementation, this point may only be within the "volatile" recent part of the chain. A typical practice is to acquire the tip of the chain, perform one or more queries and close the connection again.
@@ -103,6 +101,7 @@ Example response:
103101

104102
> [!CAUTION]
105103
> FIXME: While I experimented in using the network / consensus cddl parts above, `time` would be defined in the CDDL prelude (a number, assuming seconds since epoch), but is actually incorrect and the result is serialized using `ToCBOR UTCTime` following this cddl:
104+
>
106105
> ```cddl
107106
> time = [year, dayOfYear, timeOfDayPico]
108107
> year = bigint
@@ -114,3 +113,5 @@ Example response:
114113
115114
> [!WARNING]
116115
> TODO: Era-specific query with an involved answer
116+
117+
[^1]: Derived from [ogmios](https://ogmios.dev/mini-protocols/local-state-query/)' great ascii art description.

src/consensus/README.md

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ The consensus protocol has three main responsibilities:
6262

6363
- [Chain validity check](./chainvalid.md): the validity of a chain of blocks
6464
is defined by the Consensus protocol, whether the values in the block match
65-
are as expected. This involves things like singature checking, checking the
65+
are as expected. This involves things like signature checking, checking the
6666
previous hash, ensuring the header is consistent, etc.
6767

6868
- [Chain selection](./chainsel.md): Competing chains arise when two or more
@@ -96,15 +96,15 @@ Depending on the Ledger era in effect, the Consensus protocol (which governs
9696
both chain selection and block production) is different:
9797

9898
| Era | Protocol | Link |
99-
|:-------------------------------------------|:--------------------------------------|:-----------------------------------------|
100-
| Byron | Ouroboros Classic | [Paper][Classic] |
101-
| Byron (reimplementation, block forging) | Ouroboros BFT | [Paper][BFT] |
102-
| Byron (reimplementation, block processing) | Ouroboros Permissive BFT | Section 4 of the [Byron spec][PBFT] |
103-
| Shelley | Ouroboros Transitional Praos (TPraos) | Section 12 of the [Shelley spec][TPraos] |
99+
| :----------------------------------------- | :------------------------------------ | :--------------------------------------- |
100+
| Byron | Ouroboros Classic | [Paper][classic] |
101+
| Byron (reimplementation, block forging) | Ouroboros BFT | [Paper][bft] |
102+
| Byron (reimplementation, block processing) | Ouroboros Permissive BFT | Section 4 of the [Byron spec][pbft] |
103+
| Shelley | Ouroboros Transitional Praos (TPraos) | Section 12 of the [Shelley spec][tpraos] |
104104
| Allegra | Ouroboros TPraos | |
105105
| Mary | Ouroboros TPraos | |
106106
| Alonzo | Ouroboros TPraos | |
107-
| Babbage | Ouroboros Praos | [Paper][Praos] |
107+
| Babbage | Ouroboros Praos | [Paper][praos] |
108108
| Conway | Ouroboros Praos | |
109109

110110
Each of these protocols defines how to fulfill the responsibilities
@@ -120,18 +120,17 @@ based on the particular era in effect.
120120
> protocols used in the Network _will_ use this distinction of headers and
121121
> bodies, so implementations can as well consider leveraging it.
122122
123-
124123
An essential and uncontroversial design refinement in any blockchain
125124
implementation is to separate block headers and block bodies:
126125

127126
- If blocks can be almost fully validated in constant time based on looking at
128-
only a small fixed size block header, then honest nodes can validate candidate
129-
chains with a small bounded amount of work.
127+
only a small fixed size block header, then honest nodes can validate candidate
128+
chains with a small bounded amount of work.
130129

131130
- It also enables a design where a node can see blocks available from many
132-
immediate peers but can choose to download each block body of interest just once
133-
(from a peer of its choosing from which it is available). This saves network
134-
bandwidth.
131+
immediate peers but can choose to download each block body of interest just once
132+
(from a peer of its choosing from which it is available). This saves network
133+
bandwidth.
135134

136135
In the case of Ouroboros, all the cryptographic consensus evidence is packed
137136
into the block header, leaving the block body containing only the ledger data,
@@ -152,7 +151,7 @@ effectively separating concerns.
152151
## Mini-protocols
153152

154153
The mini-protocols mentioned in the neworking chapter are one of the possible
155-
mechanisms used for data difussion. The [Networking design
154+
mechanisms used for data diffusion. The [Networking design
156155
document][network-design] has many more insights on why these protocols were
157156
implemented, and how they differ from other off-the-shelf mechanisms.
158157

@@ -196,37 +195,36 @@ blocks or transactions. From the perspective of the consensus layer, the ledger
196195
layer has four primary responsibilities:
197196

198197
- Applying blocks: The most obvious and most important responsibility of the
199-
ledger is to define how the ledger state changes in response to new blocks,
200-
validating blocks at it goes and rejecting invalid blocks.
198+
ledger is to define how the ledger state changes in response to new blocks,
199+
validating blocks at it goes and rejecting invalid blocks.
201200

202201
- Applying transactions: Similar to applying blocks, the ledger layer must also
203-
provide an interface for applying a single transaction to the ledger state. This
204-
is important, because the consensus layer does not just deal with previously
205-
constructed blocks, but also constructs new blocks.
202+
provide an interface for applying a single transaction to the ledger state. This
203+
is important, because the consensus layer does not just deal with previously
204+
constructed blocks, but also constructs new blocks.
206205

207206
- Ticking time: Some parts of the ledger state change only due to the passage of
208-
time. For example, blocks might schedule some changes to be applied at a given
209-
slot, without the need for a block to be processed at that slot.
207+
time. For example, blocks might schedule some changes to be applied at a given
208+
slot, without the need for a block to be processed at that slot.
210209

211210
- Forecasting: Some consensus protocols require limited information from the
212-
ledger. For instance, in Praos, a node’s probability of being elected a slot
213-
leader is proportional to its stake, but the stake distribution is something
214-
that the ledger keeps track of. This information is referred to as _ledger
215-
view_. We require not just that the ledger can provide a view of the current
216-
ledger state but also that it can predict what view will be for slots in the
217-
near future.
218-
211+
ledger. For instance, in Praos, a node’s probability of being elected a slot
212+
leader is proportional to its stake, but the stake distribution is something
213+
that the ledger keeps track of. This information is referred to as _ledger
214+
view_. We require not just that the ledger can provide a view of the current
215+
ledger state but also that it can predict what view will be for slots in the
216+
near future.
219217

220218
## Resources
221219

222220
- [Technical report: Data Diffusion and Network][network-design]: Original design document of the peer-to-peer network protocols and diffusion semantics
223221
- [Technical report: Cardano Consensus and Storage Layer](https://ouroboros-consensus.cardano.intersectmbo.org/pdfs/report.pdf): Documentation of the Haskell implementation of consensus components
224222
- [Website: ouroboros-consensus > For Developers](https://ouroboros-consensus.cardano.intersectmbo.org/docs/for-developers): Collection of developer articles on the Haskell implementation of consensus components
225223

224+
[bft]: https://iohk.io/en/research/library/papers/ouroboros-bft-a-simple-byzantine-fault-tolerant-consensus-protocol/
225+
[classic]: https://iohk.io/en/research/library/papers/ouroboros-a-provably-secure-proof-of-stake-blockchain-protocol/
226226
[feature-table]: https://github.com/cardano-foundation/CIPs/blob/master/CIP-0059/feature-table.md
227227
[network-design]: https://ouroboros-network.cardano.intersectmbo.org/pdfs/network-design/network-design.pdf
228-
[Classic]: https://iohk.io/en/research/library/papers/ouroboros-a-provably-secure-proof-of-stake-blockchain-protocol/
229-
[BFT]: https://iohk.io/en/research/library/papers/ouroboros-bft-a-simple-byzantine-fault-tolerant-consensus-protocol/
230-
[PBFT]: https://github.com/intersectmbo/cardano-ledger/releases/latest/download/byron-blockchain.pdf
231-
[TPraos]: https://github.com/intersectmbo/cardano-ledger/releases/latest/download/shelley-ledger.pdf
232-
[Praos]: https://iohk.io/en/research/library/papers/ouroboros-praos-an-adaptively-secure-semi-synchronous-proof-of-stake-protocol/
228+
[pbft]: https://github.com/intersectmbo/cardano-ledger/releases/latest/download/byron-blockchain.pdf
229+
[praos]: https://iohk.io/en/research/library/papers/ouroboros-praos-an-adaptively-secure-semi-synchronous-proof-of-stake-protocol/
230+
[tpraos]: https://github.com/intersectmbo/cardano-ledger/releases/latest/download/shelley-ledger.pdf

src/consensus/chainsel.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ chain $B_{0}B_{1}\ldots{}B_{l}$ with a different chain
151151
$B_{0}{B'}_{1}\ldots{B'}_{s}$ if $s > l$, therefore if the candidate is longer
152152
than the current selection.
153153

154-
See Figure 1 in the [paper][BFT].
154+
See Figure 1 in the [paper][bft].
155155

156156
Ouroboros PBFT does not change the chain selection rules of BFT, just focuses on
157157
validity of blocks, making parts of the block superfluous. It therefore also
@@ -161,11 +161,11 @@ uses length to choose among candidates.
161161

162162
Ouroboros Praos circles back to defining the ${\tt maxvalid}_S(\mathcal{C},
163163
\mathbb{C})$ function, with identical behaviour to that in Ouroboros
164-
Classic. This means that longer candidates are preferrable to shorter ones, and
164+
Classic. This means that longer candidates are preferable to shorter ones, and
165165
that ties are broken in favour of the already selected candidate.
166166

167167
See Figure 4 and the definition of ${\tt maxvalid}$ above it in the
168-
[paper][Praos].
168+
[paper][praos].
169169

170170
Ouroboros TPraos refines how blocks are produced, but doesn't modify the ${\tt
171171
maxvalid}$ function in any way.
@@ -221,14 +221,14 @@ era).
221221
However, in Praos, the rule for selecting the best chain between two competing
222222
chains is fundamentally based on chain length. The protocol assumes
223223
instantaneous transmission of entire chains, meaning that the perceived length
224-
of a candidate would be its actual length. Due to fundamental real-world
224+
of a candidate would be its actual length. Due to fundamental real-world
225225
limitations, sending such a large amount of data instantaneously is impossible;
226226
instead, data is streamed to the syncing node. Consequently, nodes only know the
227227
length of the received prefix of the candidate chain. This creates the risk of
228228
adversaries tricking nodes into committing to an adversarial chain during
229229
synchronization.
230230

231-
[Ouroboros Genesis][Genesis] is a refinement of Praos used by nodes only during
231+
[Ouroboros Genesis][genesis] is a refinement of Praos used by nodes only during
232232
network synchronization. The key point of Genesis is precisely a refinement of
233233
the Praos chain selection rule: instead of choosing based (primarily) on length
234234
of the candidate chains, it chooses based on the density of blocks at the
@@ -260,10 +260,13 @@ into the usual length-based comparison used in Praos, so the node can safely
260260
switch to running only Ouroboros Praos.
261261

262262
<!-- iohk.io links return 403 "if you are not a human" -->
263+
263264
<!-- markdown-link-check-disable -->
265+
266+
<!-- markdown-link-check-enable -->
267+
268+
[bft]: https://iohk.io/en/research/library/papers/ouroboros-bft-a-simple-byzantine-fault-tolerant-consensus-protocol/
264269
[classic]: https://iohk.io/en/research/library/papers/ouroboros-a-provably-secure-proof-of-stake-blockchain-protocol/
265-
[BFT]: https://iohk.io/en/research/library/papers/ouroboros-bft-a-simple-byzantine-fault-tolerant-consensus-protocol/
266-
[Praos]: https://iohk.io/en/research/library/papers/ouroboros-praos-an-adaptively-secure-semi-synchronous-proof-of-stake-protocol/
267-
[Genesis]: https://iohk.io/en/research/library/papers/ouroboros-genesis-composable-proof-of-stake-blockchains-with-dynamic-availability/
270+
[genesis]: https://iohk.io/en/research/library/papers/ouroboros-genesis-composable-proof-of-stake-blockchains-with-dynamic-availability/
268271
[genesis-blogpost]: https://iohk.io/en/blog/posts/2024/05/08/ouroboros-genesis-design-update/
269-
<!-- markdown-link-check-enable -->
272+
[praos]: https://iohk.io/en/research/library/papers/ouroboros-praos-an-adaptively-secure-semi-synchronous-proof-of-stake-protocol/

src/consensus/chainvalid.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ A chain of blocks has to be valid in order to be considered for adoption. In
44
particular the mainnet chain _is_ valid.
55

66
Validity is defined by induction on the length of the chain as:
7+
78
- The first block on the chain fragment is valid,
89
- The tail of the chain fragment is valid.
910

@@ -89,7 +90,7 @@ A block is said to be _valid_ if:
8990
block. Notice the validity of these transactions is defined in the Ledger
9091
layer.
9192

92-
See Figure 1 in the [paper][BFT].
93+
See Figure 1 in the [paper][bft].
9394

9495
## Ouroboros PBFT
9596

@@ -118,4 +119,4 @@ This can be leveraged to skip such checks when replaying a chain that has
118119
already been validated, for example when restarting a node and having to replay
119120
the chain from scratch.
120121

121-
[BFT]: https://iohk.io/en/research/library/papers/ouroboros-bft-a-simple-byzantine-fault-tolerant-consensus-protocol/
122+
[bft]: https://iohk.io/en/research/library/papers/ouroboros-bft-a-simple-byzantine-fault-tolerant-consensus-protocol/

src/consensus/forging.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ actions:
2323
this slot. Below we describe what this means in Ouroboros Praos. We
2424
omit the details for other protocols as they do not produce blocks
2525
anymore on Cardano mainnet.
26-
2. Acquire a data to constitute the body of a block. Consensus is theoretically
26+
1. Acquire a data to constitute the body of a block. Consensus is theoretically
2727
unaware of what data makes up the block body, and it will be the
2828
[Mempool](../mempool) the one that specifies which data is valid and provides
2929
such data.
30-
3. Pack the data into a block body, produce a block header and emit a signature.
30+
1. Pack the data into a block body, produce a block header and emit a signature.
3131

3232
Note that it is in the interest of the stake pool (so that its block is included
3333
in the chain) and of the network as a whole (so that the chain grows) that the
@@ -71,7 +71,7 @@ $$p_i = \phi{}_f(\alpha_i) = 1 - (1 - f)^{\alpha_i}$$
7171
Some important properties are ensured by Praos:
7272

7373
- There can be multiple slot leaders as the events "$U_i$ is a leader for slot
74-
`sl`" are independant,
74+
`sl`" are independent,
7575
- There can be slots with no leader,
7676
- Only a slot leader is aware that it is indeed a leader for a given slot,
7777
- The probability of being a slot leader is independent of whether the stake

0 commit comments

Comments
 (0)