-
Notifications
You must be signed in to change notification settings - Fork 335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
zkVM: add remote proving by using the bonsai sdk #677
Conversation
This change enables generating proofs remotely by using bonsai using the zkVM API. In order to execute, add the following environment variables before running the host code: BONSAI_API_KEY, BONSAI_API_URL. A new function has been added to generate an executor if these environment variables are set.
This is my initial idea for integrating the bonsai alpha sdk. I haven't changed the examples and I haven't run any workloads but I did change r0vm to see what this looks like. Before I go change all of the examples, I thought this is a good stopping place for initial feedback |
risc0/zkvm/src/prove/mod.rs
Outdated
} | ||
|
||
fn prove_segment(&self, _ctx: &VerifierContext, _segment: &Segment) -> Result<SegmentReceipt> { | ||
Err(anyhow!( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we consider using https://doc.rust-lang.org/std/macro.unimplemented.html instead of returning a failable error? Im not sure either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah... I'm not sure about this. I saw all of the cases that use prove_segment. the unimplemented will panic which I know we're trying to reduce...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@flaub do you have any thoughts on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think in this case a panic is probably fine since it indicates a programmer mistake. One way to think about it is if this panics, will it bring down a decentralized node? I'd say in this case perhaps, but I'd argue that was a logical mistake by the programmer of the node software itself, and not related to any outside user input.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your clarification!
risc0/zkvm/src/prove/mod.rs
Outdated
// the proof request succeeded. | ||
let res = session.status(&client)?; | ||
if res.status == "RUNNING" { | ||
std::thread::sleep(Duration::from_secs(15)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might wanna make this a configurable timestep if possible. I might also recommend dropping it down to 5 seconds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be helpful for review to use this new higher level API in the rust starter-template first before examples. Plus it would be a good one to convert to test / review you API changes. The SDK integration looks clear to me.
TODO: make the timestep configurable
I'm thinking about renaming the |
How about we rename |
Should we drop |
I think we should split |
Co-authored-by: Frank Laub <flaub@risc0.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this
Benchmark for Linux-cuda ab105e0Click to hide benchmark
Benchmark for Linux-default
Benchmark for macOS-default ab105e0Click to hide benchmark
Benchmark for macOS-metal ab105e0Click to hide benchmark
|
Benchmark for Linux-cuda
Benchmark for Linux-default e28b5deClick to hide benchmark
Benchmark for macOS-default e28b5deClick to hide benchmark
Benchmark for macOS-metal
|
This change enables generating proofs remotely by using bonsai using the zkVM API. In order to execute, add the following environment variables before running the host code: BONSAI_API_KEY, BONSAI_API_URL. A new function has been added to generate an executor if these environment variables are set.