Skip to content

Commit c85da15

Browse files
authored
Attack simulations (#493)
* Designed attacks experiment * Analyzed experiment * Updated logbook
1 parent 45cbd12 commit c85da15

File tree

107 files changed

+11401
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+11401
-1
lines changed

Logbook.md

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

3+
## 2025-08-12
4+
5+
### First simulation experiment for attacks
6+
7+
An experiment invovling late EB and/or late transaction diffusion was run, where $L_\text{diff}$ and the EB propagation scheme were also varied. The attack successfully thwarts Leios throughput under some conditions.
8+
9+
- [Slides](analysis/sims/2025w33/ReadMe.pdf)
10+
- [Notebook](analysis/sims/2025w33/analysis.ipynb)
11+
- [Configurations](analysis/sims/2025w33/experiments/)
12+
313
## 2025-08-08
414

515
## CIP Progress

analysis/sims/2025w32/analysis.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2499,7 +2499,7 @@
24992499
"source": [
25002500
"peakCpuTimeseries(\n",
25012501
" cpusNode,\n",
2502-
" \"Peak CPU load among all nodes\",\n",
2502+
" \"Mean CPU load among all nodes\",\n",
25032503
" outfiles=paste0(\"plots/cpu-peak-timeseries.png\")\n",
25042504
")"
25052505
]

analysis/sims/2025w33/ReadMe.pdf

4.34 MB
Binary file not shown.

analysis/sims/2025w33/analysis.ipynb

Lines changed: 4493 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=0.15
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: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
experiments/eb-received,0,7,0.0,0/run.sh
2+
experiments/eb-received,0,7,0.0,1/run.sh
3+
experiments/eb-received,0,7,6.0,0/run.sh
4+
experiments/eb-received,0,7,6.0,1/run.sh
5+
experiments/eb-received,7,7,0.0,0/run.sh
6+
experiments/eb-received,7,7,0.0,1/run.sh
7+
experiments/eb-received,7,7,6.0,0/run.sh
8+
experiments/eb-received,7,7,6.0,1/run.sh
9+
experiments/fully-valid,0,7,0.0,0/run.sh
10+
experiments/fully-valid,0,7,0.0,1/run.sh
11+
experiments/fully-valid,0,7,6.0,0/run.sh
12+
experiments/fully-valid,0,7,6.0,1/run.sh
13+
experiments/fully-valid,7,7,0.0,0/run.sh
14+
experiments/fully-valid,7,7,0.0,1/run.sh
15+
experiments/fully-valid,7,7,6.0,0/run.sh
16+
experiments/fully-valid,7,7,6.0,1/run.sh
17+
experiments/txs-received,0,7,0.0,0/run.sh
18+
experiments/txs-received,0,7,0.0,1/run.sh
19+
experiments/txs-received,0,7,6.0,0/run.sh
20+
experiments/txs-received,0,7,6.0,1/run.sh
21+
experiments/txs-received,7,7,0.0,0/run.sh
22+
experiments/txs-received,7,7,0.0,1/run.sh
23+
experiments/txs-received,7,7,6.0,0/run.sh
24+
experiments/txs-received,7,7,6.0,1/run.sh
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env bash
2+
3+
jq -r '.
4+
| .nodes
5+
| to_entries
6+
| .[]
7+
| select(.value.stake > 0)
8+
| .key + "\t" + (.value.stake | tostring)
9+
' ../../../../data/simulation/pseudo-mainnet/topology-v2.yaml \
10+
> stake.tsv
11+
12+
TOTAL=$(gawk 'BEGIN {FS = "\t"} {total += $2} END {print total}' stake.tsv)
13+
14+
TARGET=$((TOTAL / 3))
15+
16+
gawk -v target=$TARGET '
17+
BEGIN {
18+
FS = "\t"
19+
total = 0
20+
}
21+
total < target {
22+
total += $2
23+
if (total <= target)
24+
print $1
25+
}
26+
' stake.tsv > adversary.tsv

0 commit comments

Comments
 (0)