Skip to content

Commit 8477b9b

Browse files
authored
Experiments at tag leios-2025w26 (#425)
* Designed conflict experiment for KIS Leios * K.I.S. results * Analyzed conflict results * Updated logbook
1 parent 0f29241 commit 8477b9b

File tree

19 files changed

+3622
-1
lines changed

19 files changed

+3622
-1
lines changed

Logbook.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,51 @@
22

33
## 2025-06-24
44

5+
### Conflict experiment on simplest Leios variant
6+
7+
Experiments exploring the effect of conflicting transactions at 100 TPS for the simplest Leios variant were completed in [analysis/sims/2025w26/analysis.ipynb](analysis/sims/2025w26/analysis.ipynb).
8+
9+
Assumptions:
10+
11+
- mini-mainnet topology, with 100 Mb/s inter-nodal links
12+
- 100 tx/s
13+
- 0.2 IB/s
14+
- 2097.152 kB/IB maximum
15+
- 2.5 EB/stage
16+
- 10 slot/stage
17+
- aggressive pruning of memory pool
18+
- txs ordered by arrival in memory pool
19+
- no overcollateralization
20+
- no sharding
21+
- 0%, 25%, or 50% of transactions conflict with other transactions
22+
23+
Findings:
24+
25+
1. Spatial efficiency can be as low as 55%, which is due to the occasional production of an IB before the previous one is received.
26+
2. Transaction typically reach the ledger within 75 seconds.
27+
3. All non-conflicted transactions reach the ledger.
28+
4. NIC bandwidth of 20 Mb/s is sufficient: see figure below.
29+
5. Four vCPU cores are sufficient.
30+
6. Even the largest IBs (up to 2 MB) diffuse globally within 5 seconds: see figure below.
31+
7. IB traffic does not interfere with transaction, vote, EB, or RB traffic.
32+
8. The occasional large IBs benefit performance by diffusing before the mean time between IBs, which permits pruning of the memory pool before the next IB is typically produced.
33+
34+
![Mean nodal network ingress at 100 TPS when IBs up to 2 MB are allowed](analysis/sims/2025w26/plots/cxs/ingress-average-area.png)
35+
36+
![Diffusion of IBs at 100 TPS when IBs up to 2 MB are allowed](analysis/sims/2025w26/plots/cxs/elapsed-IB.png)
37+
538
### Bandwidth experiment
639

740
Experiments exploring the effect of bandwidth limits at 100 TPS and 300 TPS were completed in [analysis/sims/2025w25/analysis.ipynb](analysis/sims/2025w25/analysis.ipynb). Key findings follow:
841

9-
1. The following protocol parameters are sufficient for Leios high performance at 100 tx/s (or 300 tx/s): 1 IB/s (or 2 IB/s), 10 slot/stage, 328 kB/IB maximum, 1.5 EB/stage, and multiple shards.
42+
1. The following protocol parameters are sufficient for Leios high performance at 100 tx/s (or 300 tx/s): mini-mainnet topology, 1 IB/s (or 2 IB/s), 10 slot/stage, 328 kB/IB maximum, 1.5 EB/stage, and multiple shards.
1043
2. Spatial efficiency is 80%.
1144
3. All transactions reach the ledger, typically within two minutes.
1245
4. A 30 Mbps network interface card (NIC) is sufficient for the Leios node.
1346
5. A 4-core vCPU is also sufficient.
47+
6. The results are insensitive to inter-nodal link bandwidths greater than 50 Mb/s, and even at 10 Mb/s the effect of link bandwidth is small: see the figure below.
48+
49+
![Diffusion of IBs at 300 TPS as a function of intra-nodal link bandwidth](analysis/sims/2025w25/plots/bw-2IBps/elapsed-IB.png)
1450

1551
## 2025-06-20
1652

22.3 KB
Loading

analysis/sims/2025w26/analysis.ipynb

Lines changed: 2360 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env nix-shell
2+
#!nix-shell -i bash -p gzip
3+
4+
set -e
5+
6+
mkdir -p results/cxs
7+
8+
for d in cxs
9+
do
10+
for f in cpus lifecycle resources receipts
11+
do
12+
DIR=$(find $d -type f -name $f.csv.gz \( -not -empty \) -printf %h\\n -quit)
13+
HL=$(sed -n -e '1p' "$DIR/case.csv")
14+
HR=$(zcat "$DIR/$f.csv.gz" | sed -n -e '1p')
15+
(
16+
echo "$HL,$HR"
17+
for g in $(find $d -type f -name $f.csv.gz \( -not -empty \) -printf %h\\n)
18+
do
19+
if [ ! -e "$g/stderr" ]
20+
then
21+
echo "Skipping $g because it has no stderr." >> /dev/stderr
22+
elif [ -s "$g/stderr" ]
23+
then
24+
echo "Skipping $g because its stderr is not empty." >> /dev/stderr
25+
else
26+
BL=$(sed -n -e '2p' "$g/case.csv")
27+
zcat "$g/$f.csv.gz" | sed -e "1d;s/^/$BL,/;s/null/NA/g"
28+
fi
29+
done
30+
) | pigz -p 3 -9c > results/$d/$f.csv.gz &
31+
done
32+
done
33+
wait

analysis/sims/2025w26/config.yaml

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

0 commit comments

Comments
 (0)