Skip to content

Commit

Permalink
adding new rapid snark and adding some notes in README
Browse files Browse the repository at this point in the history
  • Loading branch information
coax1d committed Oct 14, 2024
1 parent 4d4004d commit f8278b4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,10 @@ Make sure when building anything depending on Aptos SDK to run this when buildin
```rust
RUSTFLAGS="--cfg tokio_unstable" cargo build --release
```

### Make sure tbb a DYLD library path is correct in your terminal config
Mac
```bash
export DYLD_LIBRARY_PATH="/opt/homebrew/lib:$DYLD_LIBRARY_PATH" &&
source ~/.zshrc
```
1 change: 1 addition & 0 deletions prover_service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ edition.workspace = true

[dependencies]
aptos-keyless-common = { git = "https://github.com/aptos-labs/aptos-core" }
rust-rapidsnark = {git = "https://github.com/aptos-labs/rust-rapidsnark" }

25 changes: 19 additions & 6 deletions prover_service/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use aptos_keyless_common::api::{RequestInput, ProverServiceResponse};
use std::sync::Mutex;

use rust_rapidsnark::{FullProver, ProverInitError};

pub type Bytes = Vec<u8>;
#[derive(Default)]
Expand All @@ -13,8 +13,19 @@ pub struct Groth16Vk {
}

// TODO: Implement
#[derive(Default)]
pub struct RapidProver {}
pub struct RapidProver {
pub prover: Option<FullProver>
}

impl Default for RapidProver {
fn default() -> Self {
let prover = FullProver::new(&"Default").ok();
RapidProver {
prover
}
}
}

#[derive(Default)]
// TODO: Implement
pub struct Config {}
Expand All @@ -38,8 +49,7 @@ impl State {

// TODO: Make main Tokio runtime
fn main() {
// TODO: Add Service to do some sending/receiving of proof requests etc

//TODO: Add Service to do some sending/receiving of proof requests etc

//TODO: log service

Expand All @@ -51,12 +61,15 @@ fn main() {

//TODO: Fetch JWK refresh in some interval -- async fn

// Some metrics service start perhaps
//TODO: Some metrics service start perhaps
}

#[test]
fn can_create_state() {
let test_state = State::new();

assert!(test_state.groth16_vk.alpha_g1.is_empty());

let rapid_prover = test_state.prover.try_lock().unwrap();
assert!(rapid_prover.prover.as_ref().is_none());
}

0 comments on commit f8278b4

Please sign in to comment.