Skip to content

Commit 3b38eb5

Browse files
script to send proofs with random addresses (#1865)
Co-authored-by: Mauro Toscano <[email protected]>
1 parent c10d89b commit 3b38eb5

File tree

3 files changed

+104
-0
lines changed

3 files changed

+104
-0
lines changed

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,11 @@ batcher_send_burst_groth16: batcher/target/release/aligned
572572
@mkdir -p scripts/test_files/gnark_groth16_bn254_infinite_script/infinite_proofs
573573
@./batcher/aligned/send_burst_tasks.sh $(BURST_SIZE) $(START_COUNTER)
574574

575+
batcher_send_proof_with_random_address:
576+
@cd batcher/aligned/ && ./send_proof_with_random_address.sh
577+
578+
batcher_send_burst_with_random_address:
579+
@cd batcher/aligned/ && ./send_burst_with_random_address.sh
575580

576581
__TASK_SENDER__:
577582
BURST_TIME_SECS ?= 3
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
# This script send periodically a burst of proof with a specific amount of repetitions
4+
# the proofs always have a random address
5+
# Params:
6+
# PROOF_TYPE = sp1|groth16|plonk|risc0 (default sp1)
7+
# RPC_URL (default localhost:8545)
8+
# NETWORK devnet|holesky-stage|holesky
9+
# REPETITIONS (default 1)
10+
# BURST_DELAY in secs (default 30)
11+
12+
if [ -z $BURST_DELAY ]; then
13+
echo "Using default burst delay 30"
14+
BURST_DELAY=30
15+
fi
16+
17+
while true
18+
do
19+
. ./send_proof_with_random_address.sh &
20+
sleep $BURST_DELAY
21+
done
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#!/bin/bash
2+
3+
# Params:
4+
# PROOF_TYPE = sp1|groth16|plonk|risc0 (default sp1)
5+
# RPC_URL (default localhost:8545)
6+
# NETWORK devnet|holesky-stage|holesky
7+
# REPETITIONS (default 1)
8+
9+
if [ -z "$NETWORK" ]; then
10+
echo "NETWORK is not set. Setting it to devnet"
11+
NETWORK="devnet"
12+
fi
13+
14+
if [ -z "$RPC_URL" ]; then
15+
echo "RPC_URL is not set. Setting it to localhost:8545"
16+
RPC_URL="http://localhost:8545"
17+
fi
18+
19+
if [ -z $PROOF_TYPE ]; then
20+
echo "Proof type not provided, using SP1 default"
21+
PROOF_TYPE="sp1" #sp1|groth16|plonk|risc0
22+
fi
23+
24+
if [ -z $REPETITIONS ]; then
25+
echo "REPETITIONS not provided, using 1 as default"
26+
REPETITIONS=1
27+
fi
28+
29+
echo "Sending $REPETITIONS $PROOF_TYPE proof/s to the batcher"
30+
echo "Batcher in $NETWORK and endpoint at $RPC_URL"
31+
32+
if [[ $PROOF_TYPE == "sp1" ]]; then
33+
aligned submit \
34+
--proving_system SP1 \
35+
--proof ../../scripts/test_files/sp1/sp1_fibonacci_4_1_3.proof \
36+
--vm_program ../../scripts/test_files/sp1/sp1_fibonacci_4_1_3.elf \
37+
--random_address \
38+
--repetitions $REPETITIONS \
39+
--rpc_url $RPC_URL \
40+
--network $NETWORK
41+
42+
elif [[ $PROOF_TYPE == "groth16" ]]; then
43+
aligned submit \
44+
--proving_system Groth16Bn254 \
45+
--proof ../../scripts/test_files/gnark_groth16_bn254_script/groth16.proof \
46+
--public_input ../../scripts/test_files/gnark_groth16_bn254_script/groth16.pub \
47+
--vk ../../scripts/test_files/gnark_groth16_bn254_script/groth16.vk \
48+
--random_address \
49+
--repetitions $REPETITIONS \
50+
--rpc_url $RPC_URL \
51+
--network $NETWORK
52+
53+
elif [[ $PROOF_TYPE == "plonk" ]]; then
54+
aligned submit \
55+
--proving_system GnarkPlonkBn254 \
56+
--proof ../../scripts/test_files/gnark_plonk_bn254_script/plonk.proof \
57+
--public_input ../../scripts/test_files/gnark_plonk_bn254_script/plonk_pub_input.pub \
58+
--vk ../../scripts/test_files/gnark_plonk_bn254_script/plonk.vk \
59+
--random_address \
60+
--repetitions $REPETITIONS \
61+
--rpc_url $RPC_URL \
62+
--network $NETWORK
63+
64+
elif [[ $PROOF_TYPE == "risc0" ]]; then
65+
aligned submit \
66+
--proving_system Risc0 \
67+
--proof ../../scripts/test_files/risc_zero/fibonacci_proof_generator/risc_zero_fibonacci_2_0.proof \
68+
--vm_program ../../scripts/test_files/risc_zero/fibonacci_proof_generator/fibonacci_id_2_0.bin \
69+
--public_input ../../scripts/test_files/risc_zero/fibonacci_proof_generator/risc_zero_fibonacci_2_0.pub \
70+
--random_address \
71+
--repetitions $REPETITIONS \
72+
--rpc_url $RPC_URL \
73+
--network $NETWORK
74+
75+
else
76+
echo "Incorrect proof type provided $1"
77+
exit 1
78+
fi

0 commit comments

Comments
 (0)