Skip to content

Commit 84bfa3a

Browse files
authored
Stage-length experiment for "No IBs" Leios (#477)
* Designed experiments to vary stage length * Analyzed stage-length experiment * Updated logbook
1 parent 4b0d154 commit 84bfa3a

File tree

26 files changed

+4054
-7
lines changed

26 files changed

+4054
-7
lines changed

Logbook.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Leios logbook
22

3+
## 2025-07-30
4+
5+
### Experiment varying stage length in "No IBs" Leios
6+
7+
We varied the stage-length protocol parameter of "No IBs" Leios from 5 to 12 slots/stage in the experiment [analysis/sims/2025w31/analysis.ipynb](analysis/sims/2025w31/analysis.ipynb). Results indicate that the settlement time is not strongly affected by this parameter within this rage of values. Note that larger stage lengths result in less frequent voting.
8+
39
## 2025-07-28
410

511
### Experiments on effect of network topology

analysis/sims/2025w31/analysis.ipynb

Lines changed: 2960 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 sizes
8+
do
9+
DIR=$(find experiments -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" || "$f" == "sizes" ]]
13+
then
14+
FRACT=1.00
15+
else
16+
FRACT=1.00
17+
fi
18+
(
19+
echo "$HL,$HR"
20+
for g in $(find experiments -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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
experiments/full-without-ibs,10,10,0.150/run.sh
2+
experiments/full-without-ibs,12,10,0.150/run.sh
3+
experiments/full-without-ibs,5,10,0.150/run.sh
4+
experiments/full-without-ibs,8,10,0.150/run.sh
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
27+
linear-vote-stage-length-slots: 5
28+
linear-diffuse-stage-length-slots: 5
29+
leios-stage-length-slots: 5
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: 9.13
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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Simulator,Variant,Network,Bandwidth,Stage length,EB rate,Max EB size,Tx size,Throughput,Tx start [s],Tx stop [s],Sim stop [s]
2+
Rust,full-without-ibs,topology-v2,50 Mb/s,10 slot/stage,2.5 EB/stage,10 MB/EB,1500 B/Tx,0.150 TxMB/s,0,600,900
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
{
2+
"relay-strategy": "request-from-first",
3+
"tcp-congestion-control": true,
4+
"multiplex-mini-protocols": true,
5+
"simulate-transactions": true,
6+
"treat-blocks-as-full": false,
7+
"cleanup-policies": [
8+
"cleanup-expired-vote"
9+
],
10+
"timestamp-resolution-ms": 0.1,
11+
"leios-variant": "full-without-ibs",
12+
"linear-vote-stage-length-slots": 10,
13+
"linear-diffuse-stage-length-slots": 10,
14+
"leios-stage-length-slots": 10,
15+
"leios-stage-active-voting-slots": 1,
16+
"leios-vote-send-recv-stages": false,
17+
"leios-late-ib-inclusion": true,
18+
"leios-header-diffusion-time-ms": 1000.0,
19+
"leios-mempool-sampling-strategy": "ordered-by-id",
20+
"leios-mempool-aggressive-pruning": true,
21+
"praos-chain-quality": 100,
22+
"praos-fallback-enabled": true,
23+
"tx-generation-distribution": {
24+
"distribution": "constant",
25+
"value": 10
26+
},
27+
"tx-size-bytes-distribution": {
28+
"distribution": "constant",
29+
"value": 1500
30+
},
31+
"tx-conflict-fraction": 0,
32+
"tx-overcollateralization-factor-distribution": {
33+
"distribution": "constant",
34+
"value": 0
35+
},
36+
"tx-validation-cpu-time-ms": 0.065,
37+
"tx-max-size-bytes": 16384,
38+
"tx-start-time": 0,
39+
"tx-stop-time": 600,
40+
"rb-generation-probability": 0.05,
41+
"rb-head-size-bytes": 1024,
42+
"rb-body-max-size-bytes": 90112,
43+
"rb-generation-cpu-time-ms": 1.0,
44+
"rb-head-validation-cpu-time-ms": 1.0,
45+
"rb-body-legacy-praos-payload-avg-size-bytes": 0,
46+
"rb-body-legacy-praos-payload-validation-cpu-time-ms-constant": 50.0,
47+
"rb-body-legacy-praos-payload-validation-cpu-time-ms-per-byte": 0.0005,
48+
"ib-generation-probability": 2.0,
49+
"ib-shards": 1,
50+
"ib-shard-period-length-slots": 1,
51+
"ib-shard-group-count": 1,
52+
"ib-head-size-bytes": 304,
53+
"ib-body-avg-size-bytes": 98304,
54+
"ib-body-max-size-bytes": 262144,
55+
"ib-generation-cpu-time-ms": 130.0,
56+
"ib-head-validation-cpu-time-ms": 1.0,
57+
"ib-body-validation-cpu-time-ms-constant": 50.0,
58+
"ib-body-validation-cpu-time-ms-per-byte": 0.0005,
59+
"ib-diffusion-strategy": "freshest-first",
60+
"ib-diffusion-max-bodies-to-request": 1,
61+
"ib-diffusion-max-headers-to-request": 100,
62+
"ib-diffusion-max-window-size": 100,
63+
"eb-generation-probability": 2.5,
64+
"eb-size-bytes-constant": 240,
65+
"eb-size-bytes-per-ib": 32,
66+
"eb-generation-cpu-time-ms": 75.0,
67+
"eb-validation-cpu-time-ms": 1.0,
68+
"eb-diffusion-strategy": "peer-order",
69+
"eb-diffusion-max-bodies-to-request": 1,
70+
"eb-diffusion-max-headers-to-request": 100,
71+
"eb-diffusion-max-window-size": 100,
72+
"eb-max-age-slots": 240,
73+
"eb-max-age-for-relay-slots": 40,
74+
"eb-referenced-txs-max-size-bytes": 10000000,
75+
"eb-body-avg-size-bytes": 10000000,
76+
"vote-generation-probability": 500.0,
77+
"vote-threshold": 300,
78+
"vote-generation-cpu-time-ms-constant": 0.164,
79+
"vote-generation-cpu-time-ms-per-ib": 0,
80+
"vote-validation-cpu-time-ms": 0.816,
81+
"vote-bundle-size-bytes-constant": 0,
82+
"vote-bundle-size-bytes-per-eb": 105,
83+
"vote-diffusion-strategy": "peer-order",
84+
"vote-diffusion-max-bodies-to-request": 1,
85+
"vote-diffusion-max-headers-to-request": 100,
86+
"vote-diffusion-max-window-size": 100,
87+
"cert-size-bytes-constant": 7168,
88+
"cert-size-bytes-per-node": 0,
89+
"cert-generation-cpu-time-ms-constant": 90.0,
90+
"cert-generation-cpu-time-ms-per-node": 0,
91+
"cert-validation-cpu-time-ms-constant": 130.0,
92+
"cert-validation-cpu-time-ms-per-node": 0
93+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../run.sh

0 commit comments

Comments
 (0)