mirror of https://github.com/vacp2p/zerokit.git
Serialize proof
This commit is contained in:
parent
b382046584
commit
78f3ce4fdd
|
@ -22,7 +22,7 @@ ark-bn254 = { version = "0.3.0" }
|
|||
ark-groth16 = { git = "https://github.com/arkworks-rs/groth16", rev = "765817f", features = ["parallel"] }
|
||||
# ark-poly = { version = "^0.3.0", default-features = false, features = ["parallel"] }
|
||||
ark-relations = { version = "0.3.0", default-features = false }
|
||||
# ark-serialize = { version = "0.3.0", default-features = false }
|
||||
ark-serialize = { version = "0.3.0", default-features = false }
|
||||
|
||||
ark-circom = { git = "https://github.com/gakonst/ark-circom", features = ["circom-2"] }
|
||||
|
||||
|
|
|
@ -9,6 +9,9 @@ use ark_groth16::{
|
|||
prepare_verifying_key,
|
||||
verify_proof
|
||||
};
|
||||
use ark_serialize::{CanonicalSerialize, CanonicalDeserialize, SerializationError};
|
||||
|
||||
use std::io::{self, Read, Write};
|
||||
|
||||
|
||||
pub struct Multiplier {
|
||||
|
@ -43,9 +46,20 @@ impl Multiplier {
|
|||
Multiplier { circom, params }
|
||||
}
|
||||
|
||||
// TODO Return proof
|
||||
pub fn prove() -> bool {
|
||||
false
|
||||
// TODO Input Read
|
||||
pub fn prove<W: Write>(&self, mut result_data: W) -> io::Result<()> {
|
||||
let mut rng = thread_rng();
|
||||
|
||||
// XXX: There's probably a better way to do this
|
||||
let circom = self.circom.clone();
|
||||
let params = self.params.clone();
|
||||
|
||||
let proof = prove(circom, ¶ms, &mut rng).unwrap();
|
||||
|
||||
// XXX: Unclear if this is different from other serialization(s)
|
||||
let _ = proof.serialize(result_data).unwrap();
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// TODO Return proof
|
||||
|
|
Loading…
Reference in New Issue