forked from aeyakovenko/percolator-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-cu-test.sh
More file actions
71 lines (57 loc) · 1.83 KB
/
Copy pathsetup-cu-test.sh
File metadata and controls
71 lines (57 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
# Setup accounts for CU testing and measure keeper-crank CU at each tier
set -e
CLI="node dist/index.js"
SLAB="3K1P8KXJHg4Uk2upGiorjjFdSxGxq2sjxrrFaBjZ34D9"
ORACLE="HovQMDrbAgAYPCmHVSrezcSmkMtXSSUsLDFANExrZh2J"
FEE=1000000
# Target tiers (doubling from current ~12)
# Current: 12, targets: 24, 48, 96, 192, 384, 768, 1536, 3072
TIERS=(24 48 96 192 384 768 1536 3072)
get_account_count() {
$CLI slab:engine --slab $SLAB 2>&1 | grep -v "bigint:" | grep "Num Used" | awk '{print $4}'
}
measure_crank_cu() {
local count=$1
local cu=$($CLI keeper-crank \
--slab $SLAB \
--oracle $ORACLE \
--compute-units 1400000 \
--simulate 2>&1 | grep -v "bigint:" | grep "Compute Units" | awk '{print $3}' | tr -d ',')
echo "$count,$cu"
}
create_accounts() {
local target=$1
local current=$(get_account_count)
local needed=$((target - current))
if [ $needed -le 0 ]; then
echo "Already have $current accounts (>= $target)"
return 0
fi
echo "Creating $needed accounts to reach $target..."
for i in $(seq 1 $needed); do
$CLI init-user --slab $SLAB --fee $FEE 2>&1 | grep -v "bigint:" > /dev/null
if [ $((i % 10)) -eq 0 ]; then
echo " Created $i / $needed"
fi
done
echo "Done. Now have $(get_account_count) accounts"
}
echo "=========================================="
echo "CU Scaling Test - Account Tiers"
echo "=========================================="
echo ""
echo "tier,accounts,crank_cu"
# Measure current
current=$(get_account_count)
result=$(measure_crank_cu $current)
echo "current,$result"
# For each tier, create accounts and measure
for tier in "${TIERS[@]}"; do
create_accounts $tier
actual=$(get_account_count)
result=$(measure_crank_cu $actual)
echo "tier_$tier,$result"
done
echo ""
echo "Done!"