Skip to content

Commit d2f2f9b

Browse files
authored
Merge pull request #55 from cardano-scaling/push-wklyvyurytuy
Add opening section on the ledger state transition
2 parents 23d6afd + 9a76412 commit d2f2f9b

File tree

7 files changed

+59
-14
lines changed

7 files changed

+59
-14
lines changed

src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
- [Determinism](ledger/concepts/determinism.md)
2525
- [The State Transition Function](ledger/state-transition.md)
2626
- [Validity](ledger/state-transition/validity.md)
27+
- [How to read the Ledger specs](ledger/state-transition/reading-specs.md)
2728
- [Transaction fee](ledger/transaction-fee.md)
2829
- [Block Validation](ledger/block-validation.md)
2930
- [Plutus](plutus/README.md)

src/consensus/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ layer has four primary responsibilities:
219219

220220
- [Technical report: Data Diffusion and Network][network-design]: Original design document of the peer-to-peer network protocols and diffusion semantics
221221
- [Technical report: Cardano Consensus and Storage Layer](https://ouroboros-consensus.cardano.intersectmbo.org/pdfs/report.pdf): Documentation of the Haskell implementation of consensus components
222-
- [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
222+
- [Website: ouroboros-consensus](https://ouroboros-consensus.cardano.intersectmbo.org): Collection of developer articles on the Haskell implementation of consensus components
223223

224224
[bft]: https://iohk.io/en/research/library/papers/ouroboros-bft-a-simple-byzantine-fault-tolerant-consensus-protocol/
225225
[classic]: https://iohk.io/en/research/library/papers/ouroboros-a-provably-secure-proof-of-stake-blockchain-protocol/

src/ledger/plan.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@ case covered in the formal specs) and instead cover the general principles and
1515
details needed by all potential implementations.
1616

1717
- Concepts
18-
- Blocks
18+
- [x] Blocks
1919
- The header/body split
2020
- Transactions
2121
- Eras
2222
- The structure of an epoch
2323
- Determinism
2424
- The ledger state transition
25-
- How to read the specs
25+
- [x] How to read the specs
2626
- Old-style semi-formal specs
2727
- New-style Agda specifications
28-
- Validity
29-
- Multi-phase validity
30-
- Static vs dynamic checks
28+
- [x] Validity
29+
- [x] Multi-phase validity
30+
- [x] Static vs dynamic checks
3131
- Ledger interfaces
3232
- To the consensus layer
3333
- Applying a block

src/ledger/state-transition.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,44 @@
11
# The ledger state transition
22

3-
> This page is a stub.
3+
The ledger can be fundamentally seen as a state transition function. Given a
4+
ledger state and a signal (typically a block) we return a new ledger state.
5+
6+
In the formal modeling of the ledger, we allow a slightly richer definition in
7+
order to bring more clarity. As such, we think of the ledger transition function
8+
as having three parts:
9+
10+
- The *Environment*. This consists of "read-only" data which can affect the
11+
transition. This might consist of things such as as the protocol parameters
12+
or the current slot or block number.
13+
14+
- The *State*. This is the current state of the ledger. It includes obvious
15+
things such as the UTxO set.
16+
17+
- The *Signal*. The signal is what drives evolution of the ledger. There are
18+
three top-level signals which the ledger has to consider:
19+
20+
- A *block body*. When a new block is added to the chain, the state is
21+
updated. Since the ledger is concerned only with the
22+
[block body](./concepts/blocks.md), that is the part which drives the state
23+
transition.
24+
25+
- A *transaction*. This is needed to validate transactions when they enter
26+
the mempool, before including them into a block.
27+
28+
- A *tick*. This represents time moving on. Sometimes the state of the
29+
ledger updates just due to time moving - for example, at an epoch boundary.
30+
31+
The question of validity is determined inductively from an initial state. A
32+
transaction is valid with respect to some state if one can correctly apply the
33+
transition function to yield a new state, which is then itself considered valid.
34+
35+
We discuss the question of validity for transactions and blocks in
36+
[Validity](./state-transition/validity.md). Ticks must always be valid - if we
37+
are in a situation where we cannot advance time in a valid fashion, then we
38+
are in a very bad situation indeed!
39+
40+
The ledger state transition function must execute identically on each node in
41+
the network. Consequently, the full function is defined in the ledger specs -
42+
formal or semi-formal expressions of the computation to be performed. More
43+
detail on how to read the specs is detailed in
44+
[How to read the ledger specs](./state-transition/reading-specs.md)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# How to read the ledger specs
2+
3+
> TODO This section is a stub

src/ledger/state-transition/validity.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Block Validity
2+
3+
> This section is currently a stub
4+
15
# Transaction Validity
26

37
What does it mean for a transaction to be valid? The ledger specs define it
@@ -51,7 +55,7 @@ submitting the transaction and then be assured that it will either pass when
5155
the transaction is included, or that the transaction will fail during phase 1
5256
(for example, if an input has been spent).[^1]
5357

54-
## Static vs Dynamic Checks
58+
# Static vs Dynamic Checks
5559

5660
Since transaction validity is defined with regard to a ledger state, a change
5761
to the ledger state may result in previously valid transactions now becoming
@@ -78,11 +82,7 @@ verifying that inputs exist, checking that the transaction still sits within its
7882
validity window, and validating block transaction size against the protocol
7983
parameters.
8084

81-
# Block Validity
82-
83-
> This section is currently a stub
84-
85-
# Relevance for the node developer
85+
## Relevance for the node developer
8686

8787
The above is mostly relevant for node developers in that it is useful to be able
8888
to run the ledger transitions with fine-grained control over which checks are

src/storage/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,4 @@ best selection).
8787
## Resources
8888

8989
- [Technical report: Cardano Consensus and Storage Layer](https://ouroboros-consensus.cardano.intersectmbo.org/pdfs/report.pdf): Documentation of the Haskell implementation of consensus components
90-
- [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
90+
- [Website: ouroboros-consensus](https://ouroboros-consensus.cardano.intersectmbo.org): Collection of developer articles on the Haskell implementation of consensus components

0 commit comments

Comments
 (0)