Skip to content

Commit

Permalink
add simple ready entrypoint (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
sixbigsquare authored Aug 14, 2024
1 parent 2b4f75d commit 250c380
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
8 changes: 3 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ halo2curves.workspace = true
bytes.workspace = true
tokio.workspace = true
warp.workspace = true
chrono.workspace = true

[[bin]]
name = "expander-exec"
Expand All @@ -29,17 +30,15 @@ default = []
grinding = []

[workspace]
members = [
"arith",
"bi-kzg"
]
members = ["arith", "bi-kzg"]

[workspace.dependencies]
ark-std = "0.4"
ark-bn254 = "0.4.0"
ark-ec = "0.4.0"
ark-ff = { version = "0.4" }
bytes = "1.6.0"
chrono = "0.4.38"
clap = { version = "4.1", features = ["derive"] }
criterion = { version = "0.5", features = ["html_reports"] }
env_logger = "0.11.3"
Expand All @@ -54,4 +53,3 @@ sha2 = "0.10.8"
tokio = { version = "1.38.0", features = ["full"] }
tynm = { version = "0.1.6", default-features = false }
warp = "0.3.7"

16 changes: 12 additions & 4 deletions src/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ async fn run_command<C: GKRConfig>(
let circuit_clone_for_verifier = circuit.clone();
let prover = Arc::new(Mutex::new(prover));
let verifier = Arc::new(Mutex::new(verifier));

let ready_time = chrono::offset::Utc::now();
let ready = warp::path("ready").map(move || {
info!("Received ready request.");
reply::with_status(format!("Ready since {:?}", ready_time), StatusCode::OK)
});
let prove =
warp::path("prove")
.and(warp::body::bytes())
Expand Down Expand Up @@ -141,9 +145,13 @@ async fn run_command<C: GKRConfig>(
}
}
});
warp::serve(warp::post().and(prove.or(verify)))
.run((host, port))
.await;
warp::serve(
warp::post()
.and(prove.or(verify))
.or(warp::get().and(ready)),
)
.run((host, port))
.await;
}
_ => {
println!("Invalid command.");
Expand Down

0 comments on commit 250c380

Please sign in to comment.