Skip to content

Commit 0dbdae5

Browse files
committed
feat: aggregation mode task sender script
1 parent cef571e commit 0dbdae5

File tree

4 files changed

+64
-5
lines changed

4 files changed

+64
-5
lines changed

Makefile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -335,11 +335,12 @@ agg_mode_gateway_send_payment:
335335
0x922D6956C99E12DFeB3224DEA977D0939758A1Fe \
336336
--private-key 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d
337337

338-
agg_mode_gateway_send_sp1_proof:
339-
@cargo run --manifest-path aggregation_mode/cli/Cargo.toml -- submit sp1 \
340-
--proof scripts/test_files/sp1/sp1_fibonacci_5_0_0.proof \
341-
--vk scripts/test_files/sp1/sp1_fibonacci_5_0_0_vk.bin \
342-
--private-key "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"
338+
339+
agg_mode_install_cli: ## Install the aggregation mode CLI
340+
@cargo install --path aggregation_mode/cli
341+
342+
agg_mode_task_sender_start: agg_mode_install_cli ## Send proofs to agg mode gateway
343+
@. scripts/.agg_mode.task_sender.env && . ./scripts/agg_mode_send_sp1_proof_interval.sh
343344

344345
agg_mode_get_quotas:
345346
curl -X GET http://127.0.0.1:8089/quotas/0x70997970C51812dc3A010C7d01b50e0d17dc79C8

config-files/config-agg-mode-gateway-ethereum-package.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ eth_rpc_url: "http://localhost:8545"
44
payment_service_address: "0x922D6956C99E12DFeB3224DEA977D0939758A1Fe"
55
network: "devnet"
66
max_daily_proofs_per_user: 32
7+
last_block_fetched_filepath: "config-files/proof-aggregator.last_block_fetched.json"

scripts/.agg_mode.task_sender.env

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
INTERVAL_HOURS=1
2+
PROOF_PATH=scripts/test_files/sp1/sp1_fibonacci_5_0_0.proof
3+
VK_PATH=scripts/test_files/sp1/sp1_fibonacci_5_0_0_vk.bin
4+
PRIVATE_KEY=0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d
5+
NETWORK=devnet
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/bash
2+
3+
cli_bin="${AGG_MODE_CLI_BIN:-agg_mode_cli}"
4+
if ! command -v "$cli_bin" >/dev/null 2>&1; then
5+
echo "agg_mode CLI not found in PATH. Run: make agg_mode_install_cli"
6+
exit 1
7+
fi
8+
9+
interval_hours=$INTERVAL_HOURS
10+
network=$NETWORK
11+
private_key=$PRIVATE_KEY
12+
proof_path=$PROOF_PATH
13+
vk_path=$VK_PATH
14+
15+
if [[ -z "$interval_hours" ]]; then
16+
echo "INTERVAL_HOURS not found"
17+
exit 1
18+
fi
19+
20+
if [[ -z "$network" ]]; then
21+
echo "NETWORK not found"
22+
exit 1
23+
fi
24+
25+
if [[ -z "$private_key" ]]; then
26+
echo "PRIVATE_KEY not found"
27+
exit 1
28+
fi
29+
30+
if [[ ! -f "$proof_path" ]]; then
31+
echo "PROOF_PATH not found: $proof_path"
32+
exit 1
33+
fi
34+
35+
if [[ ! -f "$vk_path" ]]; then
36+
echo "VK_PATH key not found: $vk_path"
37+
exit 1
38+
fi
39+
40+
41+
sleep_seconds=$((interval_hours * 3600))
42+
echo "Sending SP1 proof every ${interval_hours} hour(s) using ${cli_bin}..."
43+
44+
while true; do
45+
"$cli_bin" submit sp1 \
46+
--proof "$proof_path" \
47+
--vk "$vk_path" \
48+
--private-key "$private_key" \
49+
--network "$network"
50+
echo "sleeping for ${sleep_seconds} seconds"
51+
sleep "$sleep_seconds"
52+
done

0 commit comments

Comments
 (0)