Commit 3647aa0
authored
[Peras 6] Improve generation of Peras events in ChainDB state machine tests (#1772)
This PR introduces a sequence of changes to progressively improve the
chances of observing possible-but-currently-uncommon Peras events in the
ChainDB state machine tests. Concretely, we are interested in observing
the chain selection algorithm switching from a longer to a shorter
chain. For this, we rely on the following changes:
1. Tweaking the `Cmd` generation frequencies to produce more `AddBlock`
and `AddPerasCerts` commands.
2. Enhancing the `Cmd` generator to "remember" previously generated
blocks so that generated gaps can actually be filled sometimes (this
previously relied entirely on randomness).
3. Generating a geometrically-distributed security parameter (k) on the
fly, while first addressing #1745. This includes a rationale for why we
have chosen to sample k using a geometric distribution with `p=0.5`.
Please check the commit messages to find the empirical effect of these
changes between commits. In short, we improve the chances of observing
`TagSwitchedToShorterChain` from ~0.03% to about ~1.8%.
Closes #1745File tree
7 files changed
+382
-101
lines changed- ouroboros-consensus
- changelog.d
- src/ouroboros-consensus/Ouroboros/Consensus/Block
- test
- consensus-test/Test/Consensus/MiniProtocol/ObjectDiffusion/PerasCert
- storage-test/Test/Ouroboros/Storage
- ChainDB
- StateMachine/Utils
- PerasCertDB
7 files changed
+382
-101
lines changedLines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | 17 | | |
19 | 18 | | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
Lines changed: 12 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
57 | 60 | | |
58 | 61 | | |
59 | 62 | | |
| |||
77 | 80 | | |
78 | 81 | | |
79 | 82 | | |
80 | | - | |
81 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
82 | 89 | | |
83 | 90 | | |
84 | 91 | | |
85 | 92 | | |
86 | 93 | | |
87 | 94 | | |
88 | | - | |
| 95 | + | |
89 | 96 | | |
90 | 97 | | |
91 | 98 | | |
| |||
123 | 130 | | |
124 | 131 | | |
125 | 132 | | |
126 | | - | |
127 | | - | |
| 133 | + | |
| 134 | + | |
128 | 135 | | |
129 | 136 | | |
130 | 137 | | |
| |||
0 commit comments