Skip to content

Commit 0c7420a

Browse files
bwbushBrian W Bush
andauthored
Pseudo-mainnet experiment for Linear Leios (#472)
* Designed pseudo-mainnet experiment * Completed mini-mainnet vs pseudo-mainnet experiment * Analyzed experiment on mainnet variants * Updated logbook --------- Co-authored-by: Brian W Bush <[email protected]>
1 parent 000526e commit 0c7420a

File tree

16 files changed

+4297
-1
lines changed

16 files changed

+4297
-1
lines changed

Logbook.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
# Leios logbook
22

3+
## 2025-07-28
4+
5+
### Experiments on effect of network topology
6+
7+
We compared Linear Leios simulation results on the 750-node mini-mainnet vs the 10,000-node pseudo-mainnet networks in the Rust simulator. Results indicate that the smaller network is slightly more stressful to the protocol than the larger network, but in general there are no substantial differences between simulation results for the two networks. The same findings and conclusions would result from using either network. See [ouroboros-leios/analysis/sims/2025w30b/analysis.ipynb](ouroboros-leios/analysis/sims/2025w30b/analysis.ipynb) for more details.
8+
39
## 2025-07-25
410

5-
## CIP
11+
### CIP
612

713
- completed review of protocol overview, components flow and parameters
814
- completed integration of votes and certificates specification

analysis/sims/2025w30b/analysis.ipynb

Lines changed: 3374 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/env nix-shell
2+
#!nix-shell -i bash -p gnused gzip pigz "rWrapper.override { packages = with rPackages; [ data_table R_utils bit64 ggplot2 magrittr stringr ]; }"
3+
4+
set -e
5+
6+
mkdir -p results/$d
7+
for f in lifecycle resources receipts cpus
8+
do
9+
DIR=$(find linear-with-tx-references -type f -name $f.csv.gz \( -not -empty \) -printf %h\\n -quit)
10+
HL=$(sed -n -e '1p' "$DIR/case.csv")
11+
HR=$(zcat "$DIR/$f.csv.gz" | sed -n -e '1p')
12+
if [[ "$f" == "lifecycle" || "$f" == "resources" ]]
13+
then
14+
FRACT=1.00
15+
else
16+
FRACT=0.20
17+
fi
18+
(
19+
echo "$HL,$HR"
20+
for g in $(find linear-with-tx-references -type f -name $f.csv.gz \( -not -empty \) -printf %h\\n)
21+
do
22+
if [ ! -e "$g/stderr" ]
23+
then
24+
echo "Skipping $g because it has no stderr." >> /dev/stderr
25+
elif [ -s "$g/stderr" ]
26+
then
27+
echo "Skipping $g because its stderr is not empty." >> /dev/stderr
28+
else
29+
BL=$(sed -n -e '2p' "$g/case.csv")
30+
zcat "$g/$f.csv.gz" | gawk 'FNR > 1 && rand() <= '"$FRACT"' { print "'"$BL"'" "," $0}'
31+
fi
32+
done
33+
) | pigz -p 3 -9c > results/$f.csv.gz
34+
R --vanilla << EOI > /dev/null
35+
require(data.table)
36+
sampleSize <- $FRACT
37+
print(sampleSize)
38+
$f <- fread("results/$f.csv.gz", stringsAsFactors=TRUE)
39+
save($f, sampleSize, file="results/$f.Rdata", compression_level=9)
40+
EOI
41+
done
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
full-without-ibs/8,20000000/run.sh
2+
full-without-ibs/5,20000000/run.sh
3+
full-without-ibs/8,10000000/run.sh
4+
full-without-ibs/5,10000000/run.sh
5+
full-without-ibs/8,5000000/run.sh
6+
full-without-ibs/5,5000000/run.sh

analysis/sims/2025w30b/jobs.list

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
linear-with-tx-references/8,10000000,topology-v1/run.sh
2+
linear-with-tx-references/8,10000000,topology-v2/run.sh
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
linear-with-tx-references/8,20000000/run.sh
2+
linear-with-tx-references/5,20000000/run.sh
3+
linear-with-tx-references/8,10000000/run.sh
4+
linear-with-tx-references/5,10000000/run.sh
5+
linear-with-tx-references/8,5000000/run.sh
6+
linear-with-tx-references/5,5000000/run.sh
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Simulator,Variant,Stage length,Max EB size,Network
2+
Rust,linear-with-tx-references,8 slot/stage,10.0 MB/EB,topology-v1
Lines changed: 225 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,225 @@
1+
# yaml-language-server: $schema=./config.schema.json
2+
3+
################################################################################
4+
# Simulation Configuration File
5+
################################################################################
6+
#
7+
# This file contains the default configuration for running Leios simulations in
8+
# the Haskell simulation (`simulation/`) and the Rust simulation (`sim-rs/`).
9+
#
10+
################################################################################
11+
# Simulation Configuration
12+
################################################################################
13+
14+
relay-strategy: "request-from-first"
15+
tcp-congestion-control: true
16+
multiplex-mini-protocols: true
17+
simulate-transactions: true
18+
treat-blocks-as-full: false
19+
cleanup-policies: ["cleanup-expired-vote"]
20+
timestamp-resolution-ms: 0.1
21+
22+
################################################################################
23+
# Leios Protocol Configuration
24+
################################################################################
25+
26+
leios-variant: linear-with-tx-references
27+
linear-vote-stage-length-slots: 8
28+
linear-diffuse-stage-length-slots: 8
29+
leios-stage-length-slots: 8
30+
leios-stage-active-voting-slots: 1
31+
leios-vote-send-recv-stages: false
32+
leios-late-ib-inclusion: true
33+
leios-header-diffusion-time-ms: 1000.0
34+
leios-mempool-sampling-strategy: ordered-by-id
35+
leios-mempool-aggressive-pruning: true
36+
# TODO: revise default
37+
praos-chain-quality: 100
38+
praos-fallback-enabled: true
39+
40+
################################################################################
41+
# Transaction Configuration
42+
################################################################################
43+
44+
tx-generation-distribution:
45+
distribution: exp
46+
lambda: 0.85
47+
scale: 8.95
48+
tx-size-bytes-distribution:
49+
distribution: constant
50+
value: 1400
51+
tx-conflict-fraction: 0
52+
tx-overcollateralization-factor-distribution:
53+
distribution: constant
54+
value: 0
55+
tx-validation-cpu-time-ms: 0.065
56+
tx-max-size-bytes: 16384
57+
tx-start-time: 0
58+
tx-stop-time: 450
59+
60+
################################################################################
61+
# Ranking Block Configuration
62+
################################################################################
63+
64+
# 1/leios-stage-length-slots, targeting one RB per pipeline.
65+
# Also 20s is current rate of praos blocks.
66+
rb-generation-probability: 5.0e-2
67+
# Eng. team targets 1kB as worst case upper bound.
68+
# Actual size fairly close.
69+
rb-head-size-bytes: 1024
70+
rb-body-max-size-bytes: 90112
71+
# Note: certificate generation/validation is not included in the
72+
# timings here, see cert-* fields.
73+
rb-generation-cpu-time-ms: 1.0
74+
rb-head-validation-cpu-time-ms: 1.0
75+
76+
# On average, no Txs directly embedded in blocks.
77+
rb-body-legacy-praos-payload-avg-size-bytes: 0
78+
rb-body-legacy-praos-payload-validation-cpu-time-ms-constant: 50.0
79+
# the -per-byte component is meant to be using size as a (bad)
80+
# proxy for the complexity of the Txs included.
81+
rb-body-legacy-praos-payload-validation-cpu-time-ms-per-byte: 0.0005
82+
83+
################################################################################
84+
# Input Block Configuration
85+
################################################################################
86+
87+
ib-generation-probability: 2.0
88+
ib-shards: 1
89+
ib-shard-period-length-slots: 1
90+
ib-shard-group-count: 1
91+
92+
# ProducerId 32
93+
# SlotNo 64
94+
# VRF proof 80
95+
# Body hash 32
96+
# RB Ref 32
97+
# Signature 64
98+
# Total 304
99+
#
100+
# NOTE: using a KES Signature (like for Praos headers)
101+
# would instead more than double the total to 668.
102+
# And even 828 including Op Cert.
103+
ib-head-size-bytes: 304
104+
# 98KB to optimize for 3 TCP round trips
105+
ib-body-avg-size-bytes: 98304
106+
ib-body-max-size-bytes: 262144
107+
# Here we also use praos blocks as ballpark estimate.
108+
# Sec 2.3 Forging, of the benchmark cluster report, lists
109+
# * Slot start to announced: 0.12975s
110+
ib-generation-cpu-time-ms: 130.0
111+
ib-head-validation-cpu-time-ms: 1.0
112+
ib-body-validation-cpu-time-ms-constant: 50.0
113+
ib-body-validation-cpu-time-ms-per-byte: 0.0005
114+
ib-diffusion-strategy: "freshest-first"
115+
116+
# Haskell prototype relay mini-protocol parameters.
117+
ib-diffusion-max-bodies-to-request: 1
118+
ib-diffusion-max-headers-to-request: 100
119+
ib-diffusion-max-window-size: 100
120+
121+
################################################################################
122+
# Endorsement Block Configuration
123+
################################################################################
124+
125+
# We want one per pipeline, but not too many.
126+
eb-generation-probability: 1.0
127+
# ProducerId 32
128+
# SlotNo 64
129+
# VRF proof 80
130+
# Signature 64
131+
# Total 240
132+
#
133+
# See Note about signatures on ib-head-size-bytes.
134+
eb-size-bytes-constant: 240
135+
# IB hash
136+
eb-size-bytes-per-ib: 32
137+
# Collecting the IBs to reference and cryptography are the main tasks.
138+
# A comparable task is maybe mempool snapshotting.
139+
# Sec 2.3 Forging, of the benchmark cluster report, lists
140+
# * Mempool snapshotting: 0.07252s
141+
# 75ms then seems a generous estimate for eb generation.
142+
eb-generation-cpu-time-ms: 75.0
143+
# Validating signature and vrf proof, as in other headers.
144+
eb-validation-cpu-time-ms: 1.0
145+
146+
eb-diffusion-strategy: "peer-order"
147+
148+
# Haskell prototype relay mini-protocol parameters.
149+
eb-diffusion-max-bodies-to-request: 1
150+
eb-diffusion-max-headers-to-request: 100
151+
eb-diffusion-max-window-size: 100
152+
153+
# The maximum age of EBs included in RBs.
154+
# A an EB from slot `s` can only be included in RBs
155+
# up to slot `s+eb-max-age-slots`.
156+
# In short leios we expect votes to diffuse within 3 stages lengths of
157+
# EB generation, we allow for 2 more stage lengths to account for
158+
# variance in the interval within RBs.
159+
eb-max-age-slots: 240
160+
161+
# The maximum age of EBs to be relayed.
162+
# An EB from slot `s` will only be relayed
163+
# up to slot `s+eb-max-age-for-relay-slots`.
164+
eb-max-age-for-relay-slots: 40
165+
166+
# The maximum size of transactions (in bytes) which an EB can reference.
167+
# Only relevant when running with the "full-without-ibs" variant.
168+
eb-referenced-txs-max-size-bytes: 10000000
169+
eb-body-avg-size-bytes: 10000000
170+
171+
################################################################################
172+
# Vote Configuration
173+
################################################################################
174+
175+
# Cryptography related values taken from [vote-spec](crypto-benchmarks.rs/Specification.md)
176+
# using weighted averages of 80% persistent and 20% non-persistent.
177+
178+
# vote-spec#Committe and quorum size
179+
#
180+
# Note: this is used as the expected amount of total weight of
181+
# generated votes in the sims.
182+
vote-generation-probability: 500.0
183+
# vote-spec#"Committe and quorum size"
184+
# 60% of `vote-generation-probability`
185+
vote-threshold: 300
186+
# vote-spec#"Generate vote" 0.8*135e-3 + 0.2*280e-3
187+
vote-generation-cpu-time-ms-constant: 164.0e-3
188+
# No benchmark yet.
189+
vote-generation-cpu-time-ms-per-ib: 0
190+
# vote-spec#"Verify vote" 0.8*670e-3 + 0.2*1.4
191+
vote-validation-cpu-time-ms: 816.0e-3
192+
# The `Vote` structure counted in the -per-eb already identifies slot
193+
# (in Eid) and voter. We can assume a vote bundle is all for the same
194+
# voter and slot, so for non-persistent voters we could factor their
195+
# PoolKeyHash (28bytes) here, but that is for 20% of cases.
196+
# More relevant if EB generation is very high.
197+
vote-bundle-size-bytes-constant: 0
198+
# vote-spec#Votes 0.8*90 + 0.2*164
199+
vote-bundle-size-bytes-per-eb: 105
200+
201+
vote-diffusion-strategy: "peer-order"
202+
203+
# Haskell prototype relay mini-protocol parameters.
204+
vote-diffusion-max-bodies-to-request: 1
205+
vote-diffusion-max-headers-to-request: 100
206+
vote-diffusion-max-window-size: 100
207+
208+
################################################################################
209+
# Certificate Configuration
210+
################################################################################
211+
212+
# vote-spec - certificate size plot.
213+
# Realistic stake distributions need about 7 kilobytes for the certificate.
214+
cert-size-bytes-constant: 7168
215+
cert-size-bytes-per-node: 0
216+
217+
# For certificate timings we have bulk figures for realistic scenarios,
218+
# so we do not attempt to give -per-node (i.e. per-voter) timings.
219+
#
220+
# vote-spec#"Generate certificate"
221+
cert-generation-cpu-time-ms-constant: 90.0
222+
cert-generation-cpu-time-ms-per-node: 0
223+
# vote-spec#"Verify certificate"
224+
cert-validation-cpu-time-ms-constant: 130.0
225+
cert-validation-cpu-time-ms-per-node: 0
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../8,10000000,topology-v2/run.sh
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
INFO praos: sim_cli::events: 0 transactions(s) were generated in total.
2+
INFO praos: sim_cli::events: 0 naive praos block(s) were published.
3+
INFO praos: sim_cli::events: 0 slot(s) had no naive praos blocks.
4+
INFO praos: sim_cli::events: 0 transaction(s) (0 B) finalized in a naive praos block.
5+
INFO praos: sim_cli::events: 0 transaction(s) (0 B) did not reach a naive praos block.
6+
INFO leios: sim_cli::events: 0 IB(s) were generated, on average NaN IB(s) per slot.
7+
INFO leios: sim_cli::events: 0 out of 0 transaction(s) were included in at least one IB.
8+
INFO leios: sim_cli::events: The average age of the pending transactions is NaNs (stddev NaN).
9+
INFO leios: sim_cli::events: Each transaction was included in an average of NaN IB(s) (stddev NaN).
10+
INFO leios: sim_cli::events: Each IB contained an average of NaN transaction(s) (stddev NaN) and an average of 0 B (stddev 0 B). 0 IB(s) were empty.
11+
INFO leios: sim_cli::events: Each node received an average of 0.000 IB(s) (stddev 0.000).
12+
INFO leios: sim_cli::events: 0 EB(s) were generated; on average there were NaN EB(s) per slot.
13+
INFO leios: sim_cli::events: Each EB contained an average of NaN transaction(s) (stddev NaN). 0 EB(s) were empty.
14+
INFO leios: sim_cli::events: Each EB contained an average of NaN IB(s) (stddev NaN). 0 EB(s) were empty.
15+
INFO leios: sim_cli::events: Each IB was included in an average of NaN EB(s) (stddev NaN).
16+
INFO leios: sim_cli::events: 0 out of 0 IBs were included in at least one EB.
17+
INFO leios: sim_cli::events: 0 out of 0 IBs expired before they reached an EB.
18+
INFO leios: sim_cli::events: 0 out of 0 EBs expired before an EB from their stage reached an RB.
19+
INFO leios: sim_cli::events: 0 out of 0 transaction(s) were included in at least one EB.
20+
INFO leios: sim_cli::events: 0 total votes were generated.
21+
INFO leios: sim_cli::events: Each stake pool produced an average of 0.000 vote(s) (stddev 0.000).
22+
INFO leios: sim_cli::events: Each EB received an average of NaN vote(s) (stddev NaN).
23+
INFO leios: sim_cli::events: There were 0 bundle(s) of votes. Each bundle contained NaN vote(s) (stddev NaN).
24+
INFO leios: sim_cli::events: 0 L1 block(s) had a Leios endorsement.
25+
INFO leios: sim_cli::events: 0 tx(s) (0 B) were referenced by a Leios endorsement.
26+
INFO leios: sim_cli::events: 0 tx(s) (0 B) were included directly in a Praos block.
27+
INFO leios: sim_cli::events: Spatial efficiency: 0 B/0 B (NaN%) of Leios bytes were unique transactions.
28+
INFO leios: sim_cli::events: 0 tx(s) (NaN%) referenced by a Leios endorsement were redundant.
29+
INFO leios: sim_cli::events: Each transaction took an average of NaNs (stddev NaN) to be included in an IB.
30+
INFO leios: sim_cli::events: Each transaction took an average of NaNs (stddev NaN) to be included in an EB.
31+
INFO leios: sim_cli::events: Each transaction took an average of NaNs (stddev NaN) to be included in a block.
32+
INFO network: sim_cli::events: 0 TX message(s) were sent. 0 of them were received (NaN%).
33+
INFO network: sim_cli::events: 0 IB message(s) were sent. 0 of them were received (NaN%).
34+
INFO network: sim_cli::events: 0 EB message(s) were sent. 0 of them were received (NaN%).
35+
INFO network: sim_cli::events: 0 Vote message(s) were sent. 0 of them were received (NaN%).

0 commit comments

Comments
 (0)