-
Notifications
You must be signed in to change notification settings - Fork 7
Add Snarkify Cloud support via snarkify-sdk #3
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
Conversation
ba78d3d to
550626c
Compare
550626c to
1527cfe
Compare
| let params: ParamsIPA<vesta::Affine> = ParamsIPA::<EqAffine>::new(K); | ||
| // private input | ||
| let mut inputs = Vec::new(); | ||
| for i in 0..5 { |
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.
For demo purpose, we can support input message of type Vec. In this case, we can first use the poseidon_hash function in the library to calculate the out_hash as the public input. The issue is from user's perpective, he/she doesn't know the output hash without precalculate it.
But at least with a larger size of input and increase K accordingly might be better.
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.
Just to confirm, shall we remove the public_input (the hash) and calculate it?
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 produce (hash_value, proof) in that case? @chaosma
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.
Per our discussion
- create rust binary that takes integer inputs and outputs a Poseidon hash
- server computes the hash_value and proof for the user
cyphersnake
left a comment
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.
Need a little more top-level context. I understand the repository, but want to understand exactly how it is planned to be used for the demo. I.e. will this code be part of a public presentation of a cloud platform for example
| #[path = "../main_gate.rs"] | ||
| mod main_gate; | ||
| #[path = "../poseidon_circuit.rs"] | ||
| mod poseidon_circuit; | ||
| #[path = "../test_circuit.rs"] | ||
| mod test_circuit; |
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.
Each folder and file is a module. Usually you do not specify paths to specific files, but make a structure, i.e. these modules should be imported from super.
Can you tell me what purpose you are pursuing with such a project structure? When we have both main.rs and bin/snarkify.rs?
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.
Sounds like we need ‘super’ here.
my understanding is that the code has an existing main.rs, to integrate with snarkify-sdk, we created a new bin/snarkify.rs. Developers can use main.rs to run their code locally, while bin/snarkify.rs is for cloud integration
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.
need some hints on how I can use super here, chatgpt doesn't seem to be able to provide an answer
src/bin/snarkify.rs
Outdated
| use halo2_proofs::plonk::{create_proof, keygen_pk, keygen_vk, verify_proof}; | ||
| use halo2_proofs::poly::commitment::ParamsProver; | ||
| use halo2_proofs::poly::ipa::commitment::{IPACommitmentScheme, ParamsIPA}; | ||
| use halo2_proofs::poly::ipa::multiopen::ProverIPA; | ||
| use halo2_proofs::poly::{ipa::strategy::SingleStrategy, VerificationStrategy}; | ||
| use halo2_proofs::transcript::{ | ||
| Blake2bRead, Blake2bWrite, Challenge255, TranscriptReadBuffer, TranscriptWriterBuffer, | ||
| }; |
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.
NBD:
use halo2_proofs::{
plonk::{create_proof, keygen_pk, keygen_vk, verify_proof},
poly::{
commitment::ParamsProver,
ipa::{
commitment::{IPACommitmentScheme, ParamsIPA},
multiopen::ProverIPA,
strategy::SingleStrategy,
},
VerificationStrategy,
},
transcript::{
Blake2bRead, Blake2bWrite, Challenge255, TranscriptReadBuffer, TranscriptWriterBuffer,
},
};
Please follow this tutorial and try it out https://docs.snarkify.io/introduction/quickstart/deploy-your-first-prover |
I still tried it yesterday (all that's left is to generate a proof), the question is exactly about what the final presentation of the cloud platform will look like I'm asking to understand to what extent to pick on the code |
|
Easier to explain over huddle |
|
Please check #5 |
|
close as duplicate of #5 |
This PR demonstrates how we can turn an existing halo2 circuit project into a deployable supported by Snarkify Cloud. The major changes are:
ProofHandlertrait along with theprovemethod to handle input params and produce a proof output