Skip to content

Commit b59f572

Browse files
committed
wip partial move of verify on chain to agg mode cli
1 parent b7c5b6d commit b59f572

File tree

5 files changed

+79
-18
lines changed

5 files changed

+79
-18
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
use clap::{self, ValueEnum};
2+
use std::str::FromStr;
3+
4+
use agg_mode_sdk::types::Network;
5+
6+
pub fn parse_network(value: &str) -> Result<Network, String> {
7+
Network::from_str(value).map_err(|_| format!("unsupported network supplied: {value}"))
8+
}
9+
10+
#[derive(Debug, Clone, ValueEnum)]
11+
pub enum ProvingSystemArg {
12+
#[clap(name = "GnarkPlonkBls12_381")]
13+
GnarkPlonkBls12_381,
14+
#[clap(name = "GnarkPlonkBn254")]
15+
GnarkPlonkBn254,
16+
#[clap(name = "GnarkGroth16Bn254")]
17+
GnarkGroth16Bn254,
18+
#[clap(name = "SP1")]
19+
SP1,
20+
#[clap(name = "Risc0")]
21+
Risc0,
22+
#[clap(name = "CircomGroth16Bn256")]
23+
CircomGroth16Bn256,
24+
#[clap(name = "Mina")]
25+
Mina,
26+
#[clap(name = "MinaAccount")]
27+
MinaAccount,
28+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,20 @@
1+
use crate::commands::{submit::SubmitCommand, verify::VerifyOnChainArgs};
2+
use clap::{Parser, Subcommand};
3+
4+
mod helpers;
15
pub mod submit;
6+
pub mod verify;
7+
8+
#[derive(Debug, Parser)]
9+
pub struct Cli {
10+
#[command(subcommand)]
11+
pub command: Command,
12+
}
13+
14+
#[derive(Debug, Subcommand)]
15+
pub enum Command {
16+
#[command(subcommand)]
17+
Submit(SubmitCommand),
18+
#[command(name = "verify-on-chain")]
19+
VerifyOnChain(VerifyOnChainArgs),
20+
}

aggregation_mode/cli/src/commands/submit.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ use clap::{command, Args, Subcommand};
44
use sp1_sdk::{SP1ProofWithPublicValues, SP1VerifyingKey};
55
use std::{path::PathBuf, str::FromStr};
66

7+
use crate::commands::helpers::parse_network;
8+
79
#[derive(Debug, Subcommand)]
810
pub enum SubmitCommand {
911
#[command(name = "sp1")]
@@ -22,10 +24,6 @@ pub struct SubmitSP1Args {
2224
network: Network,
2325
}
2426

25-
fn parse_network(value: &str) -> Result<Network, String> {
26-
Network::from_str(value).map_err(|_| format!("unsupported network supplied: {value}"))
27-
}
28-
2927
pub async fn run(args: SubmitSP1Args) {
3028
tracing::info!("Submitting SP1 proof to {:?} ", args.network);
3129

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
use agg_mode_sdk::types::Network;
2+
use clap::{self, Args};
3+
use std::path::PathBuf;
4+
5+
use crate::commands::helpers::{parse_network, ProvingSystemArg};
6+
7+
#[derive(Debug, Clone, Args)]
8+
pub struct VerifyOnChainArgs {
9+
#[arg(short = 'n', long = "network", default_value = "devnet", value_parser = parse_network)]
10+
network: Network,
11+
#[arg(long = "rpc-url")]
12+
rpc_url: String,
13+
#[arg(long = "beacon-url")]
14+
beacon_url: String,
15+
#[arg(long = "from-block")]
16+
from_block: Option<u64>,
17+
#[arg(long = "proving-system")]
18+
proving_system: ProvingSystemArg,
19+
#[arg(name = "Program verification key hash", long = "vk", required = true)]
20+
program_vk: PathBuf,
21+
#[arg(long = "vk")]
22+
verifying_key_path: PathBuf,
23+
#[arg(name = "Public input file name", long = "public-input")]
24+
pub_input_file_name: Option<PathBuf>,
25+
}
26+
27+
pub async fn run(args: VerifyOnChainArgs) {}

aggregation_mode/cli/src/main.rs

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,7 @@
1-
use agg_mode_cli::commands::{self, submit::SubmitCommand};
2-
use clap::{Parser, Subcommand};
1+
use agg_mode_cli::commands::{self, submit::SubmitCommand, Cli, Command};
2+
use clap::Parser;
33
use tracing_subscriber::{EnvFilter, FmtSubscriber};
44

5-
#[derive(Debug, Parser)]
6-
struct Cli {
7-
#[command(subcommand)]
8-
command: Command,
9-
}
10-
11-
#[derive(Debug, Subcommand)]
12-
enum Command {
13-
#[command(subcommand)]
14-
Submit(SubmitCommand),
15-
}
16-
175
#[tokio::main]
186
async fn main() {
197
let filter = EnvFilter::new("info");
@@ -26,5 +14,6 @@ async fn main() {
2614
Command::Submit(subcommand) => match subcommand {
2715
SubmitCommand::SP1(args) => commands::submit::run(args).await,
2816
},
17+
Command::VerifyOnChain(args) => commands::verify::run(args).await,
2918
};
3019
}

0 commit comments

Comments
 (0)