Skip to content

Commit 864d2ef

Browse files
feat(aggregation-mode): task sender + hoodi support in sdk/cli (#2215)
1 parent 35d2e2c commit 864d2ef

File tree

8 files changed

+72
-6
lines changed

8 files changed

+72
-6
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

aggregation_mode/gateway/src/config.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use serde::{Deserialize, Serialize};
44

55
#[derive(Clone, Debug, Deserialize, Serialize)]
66
pub struct Config {
7+
pub ip: String,
78
pub port: u16,
89
pub db_connection_url: String,
910
pub network: String,

aggregation_mode/gateway/src/http.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl GatewayServer {
5959
.route("/proof/risc0", web::post().to(Self::post_proof_risc0))
6060
.route("/quotas/{address}", web::get().to(Self::get_quotas))
6161
})
62-
.bind(("127.0.0.1", port))
62+
.bind((self.config.ip.as_str(), port))
6363
.expect("To bind socket correctly")
6464
.run()
6565
.await

aggregation_mode/sdk/src/types.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use std::str::FromStr;
33
#[derive(Debug, Clone)]
44
pub enum Network {
55
Devnet,
6+
Hoodi,
67
}
78

89
#[derive(Debug, Clone)]
@@ -15,6 +16,7 @@ impl FromStr for Network {
1516
fn from_str(s: &str) -> Result<Self, Self::Err> {
1617
match s.to_lowercase().as_str() {
1718
"devnet" => Ok(Self::Devnet),
19+
"hoodi" => Ok(Self::Hoodi),
1820
_ => Err(NetworkError::InvalidNetwork),
1921
}
2022
}
@@ -24,12 +26,14 @@ impl Network {
2426
pub fn chain_id(&self) -> u64 {
2527
match self {
2628
Self::Devnet => 31_337,
29+
Self::Hoodi => 56_0048,
2730
}
2831
}
2932

3033
pub fn gateway_url(&self) -> String {
3134
match self {
3235
Self::Devnet => "http://127.0.0.1:8089".to_string(),
36+
Self::Hoodi => "http://hoodi.gateway.alignedlayer.com:8080".to_string(),
3337
}
3438
}
3539
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
ip: "127.0.0.1"
12
port: 8089
23
db_connection_url: "postgres://postgres:postgres@localhost:5435/"
34
eth_rpc_url: "http://localhost:8545"
45
payment_service_address: "0x922D6956C99E12DFeB3224DEA977D0939758A1Fe"
56
network: "devnet"
67
max_daily_proofs_per_user: 32
8+
last_block_fetched_filepath: "config-files/proof-aggregator.last_block_fetched.json"

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
ip: "127.0.0.1"
12
port: 8089
23
db_connection_url: "postgres://postgres:postgres@localhost:5435/"
34
eth_rpc_url: "http://localhost:8545"

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)