Skip to content

Commit cba67b1

Browse files
committed
Created read-me file with instructions for building and running
1 parent f17bcb0 commit cba67b1

File tree

2 files changed

+126
-4
lines changed

2 files changed

+126
-4
lines changed

analysis/markov/Main.lean

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ def runMarkovCmd (p : Parsed) : IO UInt32 :=
3535
IO.eprintln s!"Missing probability: {1 - totalProbability sn}"
3636
pure 0
3737

38-
def markovCmd : Cmd := `[Cli|
39-
markovCmd VIA runMarkovCmd; ["0.0.1"]
38+
def markov : Cmd := `[Cli|
39+
markov VIA runMarkovCmd; ["0.0.1"]
4040
"Run a Markov simulation of Linear Leios."
4141
FLAGS:
4242
"active-slot-coefficient" : Float ; "The active slot coefficient for RBs, in probability per slot."
@@ -51,7 +51,6 @@ def markovCmd : Cmd := `[Cli|
5151
"rb-count" : Nat ; "Number of RBs to simulate."
5252
"output-file" : String ; "Path to the JSON output file for the EB distribution."
5353
EXTENSIONS:
54-
author "bwbush";
5554
defaultValues! #[
5655
("active-slot-coefficient", "0.05")
5756
, ("l-header" , "1" )
@@ -67,4 +66,4 @@ def markovCmd : Cmd := `[Cli|
6766
]
6867

6968
def main (args : List String) : IO UInt32 :=
70-
markovCmd.validate args
69+
markov.validate args

analysis/markov/ReadMe.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# Markov-model simulation for Linear Leios
2+
3+
4+
## Example
5+
6+
```console
7+
$ lake exe linleios \
8+
--l-header 1 \
9+
--l-vote 4 \
10+
--l-diff 5 \
11+
--committee-size 600 \
12+
--quorum-fraction 0.80 \
13+
--p-rb-header-arrives 0.95 \
14+
--p-eb-validates 0.85 \
15+
--output-file tmp.json
16+
17+
Efficiency: 0.358416
18+
Missing probability: 0.000001
19+
20+
$ json2yaml tmp.json
21+
22+
'61': 0
23+
'60': 0
24+
'59': 1e-06
25+
'58': 2e-06
26+
'57': 5e-06
27+
'56': 1.2e-05
28+
'55': 2.8e-05
29+
'54': 6.2e-05
30+
'53': 0.00013
31+
'52': 0.000263
32+
'51': 0.00051
33+
'50': 0.00095
34+
'49': 0.0017
35+
'48': 0.002924
36+
'47': 0.004832
37+
'46': 0.00767
38+
'45': 0.011695
39+
'44': 0.017128
40+
'43': 0.024091
41+
'42': 0.032532
42+
'41': 0.042169
43+
'40': 0.052455
44+
'39': 0.062599
45+
'38': 0.071642
46+
'37': 0.0786
47+
'36': 0.082632
48+
'35': 0.083203
49+
'34': 0.080197
50+
'33': 0.073954
51+
'32': 0.065202
52+
'31': 0.054925
53+
'30': 0.044172
54+
'29': 0.033887
55+
'28': 0.024777
56+
'27': 0.017248
57+
'26': 0.011419
58+
'25': 0.007182
59+
'24': 0.004285
60+
'23': 0.002422
61+
'22': 0.001295
62+
'21': 0.000654
63+
'20': 0.000311
64+
'19': 0.000139
65+
'18': 5.8e-05
66+
'17': 2.3e-05
67+
'16': 8e-06
68+
'15': 3e-06
69+
'14': 1e-06
70+
'13': 0
71+
'12': 0
72+
```
73+
74+
75+
## Usage
76+
77+
```console
78+
$ lake exe linleios --help
79+
80+
markov [0.0.1]
81+
Run a Markov simulation of Linear Leios.
82+
83+
USAGE:
84+
markov [FLAGS]
85+
86+
FLAGS:
87+
-h, --help Prints this message.
88+
--version Prints the version.
89+
--active-slot-coefficient : Float The active slot coefficient for RBs, in
90+
probability per slot. [Default: `0.05`]
91+
--l-header : Nat L_header protocol parameter, in slots.
92+
[Default: `1`]
93+
--l-vote : Nat L_vote protocol parameter, in slots.
94+
[Default: `4`]
95+
--l-diff : Nat L_diff protocol parameter, in slots.
96+
[Default: `7`]
97+
--committee-size : Nat Expected number of voters in the
98+
committee. [Default: `600`]
99+
--quorum-fraction : Float τ protocol parameter, in %/100. [Default:
100+
`0.75`]
101+
--p-rb-header-arrives : Float Probability that the RB header arrives
102+
before L_header. [Default: `0.95`]
103+
--p-eb-validates : Float Probability that the EB is fully
104+
validated before 3 L_header + L_vote.
105+
[Default: `0.90`]
106+
--tolerance : Float Discard states with less than this
107+
probability. [Default: `1e-8`]
108+
--rb-count : Nat Number of RBs to simulate. [Default:
109+
`100`]
110+
--output-file : String Path to the JSON output file for the EB
111+
distribution.
112+
```
113+
114+
115+
## Building
116+
117+
```console
118+
$ nix-shell -p lean4 elan
119+
120+
$ lake build
121+
```
122+
123+
The executable program will reside at `.lake/build/bin/linleios`.

0 commit comments

Comments
 (0)