Skip to content

Commit 26a1616

Browse files
committed
ThreadNet: add high-level doc under "References"
1 parent 6223a5e commit 26a1616

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# ThreadNet tests
2+
3+
The ThreadNet tests spin up a network of nodes, but they are all within a single process --- a network of threads.
4+
5+
The purpose of the ThreadNet tests is to run a simple testnet within a Haskell process, and leverage the QuickCheck infrastructure to vary the parameters of the testnet. The following basic ideas apply:
6+
- all the nodes are honest --- can a few honest nodes build a chain together?
7+
- The test have an ability to partition the network, in order to check that the node can recover from the network partition. The test only supports an "easy" case of partition, half-in-half.
8+
- The leader schedule is not prescribed, but rather evolved naturally as it would in the real system.
9+
10+
## Enumeration and description of the ThreadNet tests
11+
12+
### Shelley era crossing tests
13+
14+
These exercise an era transitions between two consecutive Cardano eras.
15+
16+
We currently the following Shelley-based era crossing tests:
17+
18+
- [Test.ThreadNet.ShelleyAllegra](./../../../../ouroboros-consensus-cardano/test/cardano-test/Test/ThreadNet/ShelleyAllegra.hs)
19+
- [Test.ThreadNet.AllegraMary](./../../../../ouroboros-consensus-cardano/test/cardano-test/Test/ThreadNet/AllegraMary.hs)
20+
- [Test.ThreadNet.MaryAlonzo](./../../../../ouroboros-consensus-cardano/test/cardano-test/Test/ThreadNet/MaryAlonzo.hs)
21+
22+
The test scenario is roughly as follows:
23+
24+
- generate credentials of several core nodes.
25+
- Craft a protocol version update transaction that is signed by all core nodes. The meaning of the transaction is "every node proposes to increment the protocol version".
26+
- Spin up a network of core nodes.
27+
- Repeatedly submit the update transaction to the mempool of every core node, so that it end ups in the first minted block.
28+
- Wait for several slots
29+
- Stop the nodes, examine their final chains, and make sure the hard fork has happened.
30+
31+
### Shelley test that updates the decentralisation parameter
32+
33+
- [Test.ThreadNet.Shelley](./../../../../ouroboros-consensus-cardano/test/shelley-test/Test/ThreadNet/Shelley.hs)
34+
35+
This test has a structure similar to the Shelley era crossing tests, but actually does not cross between eras, but rather updates the decentralisation parameter.
36+
37+
### Test that crosses from Byron to Shelley, the "Cardano" test
38+
39+
- [Test.ThreadNet.Cardano](./../../../../ouroboros-consensus-cardano/test/cardano-test/Test/ThreadNet/Cardano.hs)
40+
41+
The `Test.ThreadNet.Cardano` module contains the test that crosses from Byron to Shelley. Notably, it uses the Cardano block type, rather than the more specialised two-era `ShelleyBasedHardForkBlock`. Otherwise the flow of the test is very similar to the Shelley-based era crossing tests described above.
42+
43+
### Byron tests
44+
45+
There are two more ThreadNet tests that test the Byron-era consensus code:
46+
47+
- the [Test.ThreadNet.Byron](./../../../../ouroboros-consensus-cardano/test/byron-test/Test/ThreadNet/Byron.hs) tests an ability of the nodes to build a chain using the old BFT protocol and also a bunch of Byron-specific chain properties related to epoch boundary blocks (EBBs).
48+
- The [Test.ThreadNet.DualByron](./../../../../ouroboros-consensus-cardano/test/byron-test/Test/ThreadNet/DualByron.hs) test runs the Byron ledger and the Byron specification in lockstep, verifying that they agree at every point.
49+
50+
These are very old tests that are mostly irrelevant today.
51+
52+
### Mock block tests
53+
54+
There are four ThreadNet tests that use a mock block, rather than a real Shelley block:
55+
56+
- [Test.ThreadNet.BFT](./../../../../ouroboros-consensus-diffusion/test/mock-test/Test/ThreadNet/BFT.hs) --- tests convergence of the Byron-era BFT consensus.
57+
- [Test.ThreadNet.PBFT](./../../../../ouroboros-consensus-diffusion/test/mock-test/Test/ThreadNet/PBFT.hs) --- tests convergence of the Shelley-era Permissive BFT (PBFT) consensus.
58+
- [Test.ThreadNet.Praos](./../../../../ouroboros-consensus-diffusion/test/mock-test/Test/ThreadNet/Praos.hs) --- tests convergence of Praos.
59+
- [Test.ThreadNet.LeaderSchedule](./../../../../ouroboros-consensus-diffusion/test/mock-test/Test/ThreadNet/LeaderSchedule.hs) --- looks very similar to the Praos test, but I don't know what exactly it tests.

0 commit comments

Comments
 (0)