-
Notifications
You must be signed in to change notification settings - Fork 358
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
feat: SDK refactor #1855
base: dev
Are you sure you want to change the base?
feat: SDK refactor #1855
Conversation
017d5de
to
051545c
Compare
7dca438
to
6ceb9dd
Compare
/// Verify that an SP1 proof is valid given its vkey and metadata. | ||
/// For Plonk proofs, verifies that the public inputs of the PlonkBn254 proof match | ||
/// the hash of the VK and the committed public values of the SP1ProofWithPublicValues. | ||
pub fn verify( |
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.
thoughts on putting this on a seperate func? I guess this was the reason we previously had a CpuProver
wrapper over SP1Prover<DefaultProverComponents>
so we could attach 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.
Ya I think we need to expose verify somehow but lets revisit towards the end
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.
okie looking good,
Some issues with async stuff though, lets remove ProofRequest
traits, so users dont need to import it to use it, and make sure any method called run
is not async.
So LocalProofRequest
run just calls prove
on the underlying sp1_prover
, and its IntoFuture
will just do a tokio::task::spawn_blocking
Now for Network its run
either needs to use the blocking methods on the client if they exist or create a new runtime and block on that.
And finally for DynProofRequest
its run method calls prover.prove_with_options_sync
and its into future method will call prove_with_options
crates/sdk/src/client.rs
Outdated
Self::create_from_env() | ||
} | ||
|
||
fn create_from_env() -> Self { |
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.
So I think that the DynBuilder should also expose default_{cycle_limt, timeout}?
I think that we should remove this method "create_from_env" and make the method like "build_with_env" that than overrides stuff at the end
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.
do you mean as methods? Currently I have:
/// The default timeout seconds for a proof request to be generated (4 hours).
pub const DEFAULT_TIMEOUT: u64 = 14400;
/// The default cycle limit for a proof request.
pub const DEFAULT_CYCLE_LIMIT: u64 = 100_000_000;
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.
Yaa I think since these are common defaults we can optionally let the user set them at builder level wdyt? Otherwise default to these
/// Verify that an SP1 proof is valid given its vkey and metadata. | ||
/// For Plonk proofs, verifies that the public inputs of the PlonkBn254 proof match | ||
/// the hash of the VK and the committed public values of the SP1ProofWithPublicValues. | ||
pub fn verify( |
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.
Ya I think we need to expose verify somehow but lets revisit towards the end
SP1 Performance Test Results Branch: mattstam/sdk-refactor-proposal
|
217abfa
to
2873a73
Compare
use std::sync::Arc; | ||
|
||
/// The ELF we want to execute inside the zkVM. | ||
const ELF: &[u8] = include_elf!("fibonacci-program"); |
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.
note: we will update this macro to return an Arc so its easy
@@ -1,142 +0,0 @@ | |||
use std::{borrow::Cow, str::FromStr}; |
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.
note: I am nuking v1 and I will convert network-v2
to just network
(after review because otherwise diff would be nightmarish)
7f559a2
to
4e4e8c4
Compare
API: