Skip to content

Commit

Permalink
add proof server
Browse files Browse the repository at this point in the history
  • Loading branch information
gordon-to committed May 26, 2024
1 parent 120d759 commit e4f71d3
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 25 deletions.
2 changes: 1 addition & 1 deletion sp1_prover/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[workspace]
exclude = ["zkpoex", "ecdh"]
members = ["zkpoex-script", "ecdh-script", "evm-runner"]
members = ["zkpoex-script", "ecdh-script", "evm-runner", "bid-server"]
resolver = "2"
4 changes: 2 additions & 2 deletions sp1_prover/bid-server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[workspace]
[package]
version = "0.1.0"
name = "bid-server"
Expand All @@ -8,6 +7,7 @@ edition = "2021"
[dependencies]
rocket = "0.5.1"
cli-batteries = "0.5"
clap = { version = "4.5.4", features = ["derive"] }

[build-dependencies]
cli-batteries = "0.5"
cli-batteries = "0.5"
48 changes: 26 additions & 22 deletions sp1_prover/bid-server/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,38 +1,42 @@
#[macro_use] extern crate rocket;

use rocket::{Rocket, Build};
use rocket::{Rocket, Build, State};
use clap::Parser;


#[get("/")]
fn index() -> &'static str {
"Hello, world!"
}

// return contets of proof
#[get("/proof")]
async fn proof(args: &State<Args>) -> String {
args.proof.clone()
}

/// Simple program to serve proof files
#[derive(Parser, Debug)]
#[command(version, about, long_about = None)]
struct Args {
/// path to proof
#[arg(short, long)]
proof: String,

/// redemption address
#[arg(short, long, default_value_t = (&"0x..").to_string())]
address: String,
}

#[launch]
fn rocket() -> Rocket<Build> {
let args = Args::parse();
rocket::build()
// .mount("/", routes![hello, hello]) // uncomment this to get an error
// .mount("/", routes![unmanaged]) // uncomment this to get a sentinel error
.mount("/", routes![index])
.mount("/", routes![proof])
.manage(args)
}

#[derive(Parser)]
#[group(skip)]
struct Options {
/// File to read
#[clap(long, env, default_value = "")]
proofPath: PathBuf,
}


async fn app(options: Options) -> Result<()> {
let mut proof = File::open(options.proofPath).await?;
// verify
Ok(())
}

fn main() {
if let Err(e) = rocket().launch().await {
println!("Whoops! Rocket didn't launch!");
// We drop the error to get a Rocket-formatted panic.
drop(e);
};
}

0 comments on commit e4f71d3

Please sign in to comment.