Skip to content

Commit db7a40f

Browse files
committed
Merge remote-tracking branch 'origin/staging' into refactor/move-agg-mode-sdk-to-new-dir
2 parents 73021cd + 2ef46d0 commit db7a40f

11 files changed

Lines changed: 131 additions & 11 deletions

File tree

Makefile

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -323,11 +323,12 @@ agg_mode_gateway_send_payment:
323323
0x922D6956C99E12DFeB3224DEA977D0939758A1Fe \
324324
--private-key 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d
325325

326-
agg_mode_gateway_send_sp1_proof:
327-
@cargo run --manifest-path aggregation_mode/cli/Cargo.toml -- submit sp1 \
328-
--proof scripts/test_files/sp1/sp1_fibonacci_5_0_0.proof \
329-
--vk scripts/test_files/sp1/sp1_fibonacci_5_0_0_vk.bin \
330-
--private-key "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"
326+
327+
agg_mode_install_cli: ## Install the aggregation mode CLI
328+
@cargo install --path aggregation_mode/cli
329+
330+
agg_mode_task_sender_start: agg_mode_install_cli ## Send proofs to agg mode gateway
331+
@. scripts/.agg_mode.task_sender.env && . ./scripts/agg_mode_send_sp1_proof_interval.sh
331332

332333
agg_mode_get_quotas:
333334
curl -X GET http://127.0.0.1:8089/quotas/0x70997970C51812dc3A010C7d01b50e0d17dc79C8
@@ -985,6 +986,10 @@ upgrade_proof_aggregator: ## Upgrade ProofAggregator contract. Parameters: NETWO
985986
@echo "Upgrading ProofAggregator Contract on $(NETWORK) network..."
986987
@. contracts/scripts/.env.$(NETWORK) && . contracts/scripts/upgrade_proof_aggregator.sh
987988

989+
deploy_agg_mode_payment_service:
990+
@echo "Deploying Agg Mode Payment Service contract on $(NETWORK) network..."
991+
@. contracts/scripts/.env.$(NETWORK) && . contracts/scripts/deploy_agg_mode_payment_service.sh
992+
988993
__SP1_FFI__: ##
989994
build_sp1_macos:
990995
@cd operator/sp1/lib && cargo build $(RELEASE_FLAG)

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: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,25 @@ impl GatewayServer {
5252
HttpServer::new(move || {
5353
App::new()
5454
.app_data(Data::new(state.clone()))
55+
.route("/", web::get().to(Self::get_root))
5556
.route("/nonce/{address}", web::get().to(Self::get_nonce))
5657
.route("/receipts", web::get().to(Self::get_receipts))
5758
.route("/proof/sp1", web::post().to(Self::post_proof_sp1))
5859
.route("/proof/risc0", web::post().to(Self::post_proof_risc0))
5960
.route("/quotas/{address}", web::get().to(Self::get_quotas))
6061
})
61-
.bind(("127.0.0.1", port))
62+
.bind((self.config.ip.as_str(), port))
6263
.expect("To bind socket correctly")
6364
.run()
6465
.await
6566
.expect("Server to never end");
6667
}
6768

69+
// Returns an OK response (code 200), no matters what receives in the request
70+
async fn get_root(_req: HttpRequest) -> impl Responder {
71+
HttpResponse::Ok().json(AppResponse::new_sucessfull(serde_json::json!({})))
72+
}
73+
6874
// Returns the nonce (number of submitted tasks) for a given address
6975
async fn get_nonce(req: HttpRequest) -> impl Responder {
7076
let Some(address_raw) = req.match_info().get("address") else {

aggregation_mode/sdk/src/constants.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ pub const ALIGNED_AGG_PAYMENT_SERVICE_ADDRESS_DEVNET: &str =
1818
pub const ALIGNED_AGG_MODE_GATEWAY_URL_MAINNET: &str = "";
1919
pub const ALIGNED_AGG_MODE_GATEWAY_URL_MAINNET_STAGE: &str = "";
2020
pub const ALIGNED_AGG_MODE_GATEWAY_URL_SEPOLIA: &str = "";
21-
pub const ALIGNED_AGG_MODE_GATEWAY_URL_HOODI: &str = "";
21+
pub const ALIGNED_AGG_MODE_GATEWAY_URL_HOODI: &str = "http://hoodi.gateway.alignedlayer.com:8080";
2222
pub const ALIGNED_AGG_MODE_GATEWAY_URL_DEVNET: &str = "http://127.0.0.1:8089";

aggregation_mode/sdk/src/types.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
use std::str::FromStr;
22

33
use crate::constants::{
4-
ALIGNED_AGG_MODE_GATEWAY_URL_DEVNET, ALIGNED_AGG_PAYMENT_SERVICE_ADDRESS_DEVNET,
5-
ALIGNED_PROOF_AGG_SERVICE_ADDRESS_DEVNET,
4+
ALIGNED_AGG_MODE_GATEWAY_URL_DEVNET, ALIGNED_AGG_MODE_GATEWAY_URL_HOODI,
5+
ALIGNED_AGG_PAYMENT_SERVICE_ADDRESS_DEVNET, ALIGNED_AGG_PAYMENT_SERVICE_ADDRESS_HOODI,
6+
ALIGNED_PROOF_AGG_SERVICE_ADDRESS_DEVNET, ALIGNED_PROOF_AGG_SERVICE_ADDRESS_HOODI,
67
};
78

89
#[derive(Debug, Clone)]
910
pub enum Network {
1011
Devnet,
12+
Hoodi,
1113
}
1214

1315
#[derive(Debug, Clone)]
@@ -20,6 +22,7 @@ impl FromStr for Network {
2022
fn from_str(s: &str) -> Result<Self, Self::Err> {
2123
match s.to_lowercase().as_str() {
2224
"devnet" => Ok(Self::Devnet),
25+
"hoodi" => Ok(Self::Hoodi),
2326
_ => Err(NetworkError::InvalidNetwork),
2427
}
2528
}
@@ -29,23 +32,27 @@ impl Network {
2932
pub fn chain_id(&self) -> u64 {
3033
match self {
3134
Self::Devnet => 31_337,
35+
Self::Hoodi => 56_0048,
3236
}
3337
}
3438

3539
pub fn gateway_url(&self) -> String {
3640
match self {
41+
Self::Hoodi => ALIGNED_AGG_MODE_GATEWAY_URL_HOODI.to_string(),
3742
Self::Devnet => ALIGNED_AGG_MODE_GATEWAY_URL_DEVNET.to_string(),
3843
}
3944
}
4045

4146
pub fn proof_aggregator_contract_address(&self) -> String {
4247
match self {
48+
Self::Hoodi => ALIGNED_PROOF_AGG_SERVICE_ADDRESS_HOODI.to_string(),
4349
Self::Devnet => ALIGNED_PROOF_AGG_SERVICE_ADDRESS_DEVNET.to_string(),
4450
}
4551
}
4652

4753
pub fn aggregation_mode_payment_service_address(&self) -> String {
4854
match self {
55+
Self::Hoodi => ALIGNED_AGG_PAYMENT_SERVICE_ADDRESS_HOODI.to_string(),
4956
Self::Devnet => ALIGNED_AGG_PAYMENT_SERVICE_ADDRESS_DEVNET.to_string(),
5057
}
5158
}
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"
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
3+
# ENV VARIABLES
4+
#
5+
# PROOF_AGGREGATOR_DEPLOY_CONFIG_PATH: Path to the proof aggregator deploy config file
6+
# - Holesky Stage: ./script/deploy/config/holesky/proof-aggregator-service.holesky.config.stage.json
7+
# - Holesky Prod: ./script/deploy/config/holesky/proof-aggregator-service.holesky.config.json
8+
# - Sepolia: ./script/deploy/config/sepolia/proof-aggregator-service.sepolia.config.json
9+
#
10+
# PROOF_AGGREGATOR_OUTPUT_PATH: Path to the proof aggregator output file
11+
# - Holesky Stage: ./script/output/holesky/proof_aggregation_service_deployment_output.stage.json
12+
# - Holesky Prod: ./script/output/holesky/proof_aggregation_service_deployment_output.json
13+
# - Sepolia: ./script/output/sepolia/proof_aggregation_service_deployment_output.json
14+
#
15+
# RPC_URL: The RPC URL to connect to the Ethereum network
16+
#
17+
# PRIVATE_KEY: The private key to use for the deployment
18+
#
19+
# ETHERSCAN_API_KEY: The Etherscan API key to use for verification
20+
#
21+
22+
# cd to the directory of this script so that this can be run from anywhere
23+
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
24+
# At this point we are in contracts/scripts
25+
cd "$parent_path"
26+
27+
# At this point we are in contracts
28+
cd ../
29+
30+
# Deploy agg mode payment service contract
31+
forge script script/deploy/AggregationModePaymentServiceDeployer.s.sol \
32+
$PROOF_AGGREGATOR_DEPLOY_CONFIG_PATH \
33+
$PROOF_AGGREGATOR_OUTPUT_PATH \
34+
--rpc-url $RPC_URL \
35+
--private-key $PRIVATE_KEY \
36+
--broadcast \
37+
--verify \
38+
--etherscan-api-key $ETHERSCAN_API_KEY \
39+
--slow \
40+
--sig "run(string configPath, string outputPath)" \
41+
--via-ir

explorer/lib/explorer/contract_managers/aligned_proof_aggregation_service.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ defmodule AlignedProofAggregationService do
22
require Logger
33

44
@aligned_config_file System.get_env("ALIGNED_PROOF_AGG_CONFIG_FILE")
5-
@verifyRisc0_solidity_signature "0x0769eb53"
6-
@verifySp1_solidity_signature "0x96f7966f"
5+
@verifyRisc0_solidity_signature "0xbe96ce93"
6+
@verifySp1_solidity_signature "0x39ad96d9"
77

88
config_file_path =
99
case @aligned_config_file do

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

0 commit comments

Comments
 (0)