1
0
Fork 0
mirror of synced 2025-09-23 12:18:44 +00:00
This commit is contained in:
schaeff 2022-03-14 16:31:17 +01:00
parent b8a79d4dda
commit efb2c8a492
6 changed files with 795 additions and 251 deletions

1005
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -65,8 +65,8 @@ digest = { version = "0.9", optional = true }
[dev-dependencies]
wasm-bindgen-test = "^0.3.0"
pretty_assertions = "0.6.1"
ethabi = "16.0.0"
primitive-types = { version = "0.10", features = ["rlp"] }
ethabi = "17.0.0"
primitive-types = { version = "0.11", features = ["rlp"] }
zokrates_fs_resolver = { version = "0.5", path = "../zokrates_fs_resolver"}
zokrates_solidity_test = { path = "../zokrates_solidity_test"}

View file

@ -20,6 +20,7 @@ use digest::Digest;
use num::Zero;
use rand_0_8::{Error, RngCore, SeedableRng};
use sha3::Keccak256;
use std::convert::TryInto;
use std::{convert::TryFrom, marker::PhantomData};
use zokrates_field::{ArkFieldExtensions, Field};
@ -256,16 +257,22 @@ impl<T: Field + ArkFieldExtensions> Backend<T, marlin::Marlin> for Ark {
.map(|shifted_comm| parse_g1::<T>(&shifted_comm.0)),
)
})
.collect()
.collect::<Vec<_>>()
.try_into()
.unwrap()
})
.collect(),
.collect::<Vec<_>>()
.try_into()
.unwrap(),
evaluations: proof.evaluations.into_iter().map(T::from_ark).collect(),
pc_proof_proof: proof
.pc_proof
.proof
.into_iter()
.map(|p| (parse_g1::<T>(&p.w), p.random_v.map(T::from_ark)))
.collect(),
.collect::<Vec<_>>()
.try_into()
.unwrap(),
pc_proof_evals: proof
.pc_proof
.evals
@ -300,12 +307,12 @@ impl<T: Field + ArkFieldExtensions> Backend<T, marlin::Marlin> for Ark {
commitments: proof
.proof
.commitments
.into_iter()
.iter()
.map(|r| {
r.into_iter()
.map(|(c, shifted_comm)| Commitment {
comm: KZG10Commitment(serialization::to_g1::<T>(c)),
shifted_comm: shifted_comm.map(|shifted_comm| {
comm: KZG10Commitment(serialization::to_g1::<T>(c.clone())),
shifted_comm: shifted_comm.clone().map(|shifted_comm| {
KZG10Commitment(serialization::to_g1::<T>(shifted_comm))
}),
})
@ -323,10 +330,10 @@ impl<T: Field + ArkFieldExtensions> Backend<T, marlin::Marlin> for Ark {
proof: proof
.proof
.pc_proof_proof
.into_iter()
.iter()
.map(|(w, random_v)| KZG10Proof {
w: serialization::to_g1::<T>(w),
random_v: random_v.map(|v| v.into_ark()),
w: serialization::to_g1::<T>(w.clone()),
random_v: random_v.clone().map(|v| v.into_ark()),
})
.collect(),
evals: proof

View file

@ -59,7 +59,7 @@ pub type Fr = String;
pub type Fq = String;
pub type Fq2 = (String, String);
#[derive(Serialize, Deserialize, Clone)]
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct G1Affine(Fq, Fq);
// When G2 is defined on Fq2 field

View file

@ -11,9 +11,9 @@ pub struct Marlin;
#[derive(Serialize, Deserialize)]
pub struct ProofPoints<Fr, G1> {
pub commitments: Vec<Vec<(G1, Option<G1>)>>,
pub commitments: [[(G1, Option<G1>); 2]; 3],
pub evaluations: Vec<Fr>,
pub pc_proof_proof: Vec<(G1, Option<Fr>)>,
pub pc_proof_proof: [(G1, Option<Fr>); 2],
pub pc_proof_evals: Option<Vec<Fr>>,
pub prover_messages_count: usize,
}
@ -832,6 +832,6 @@ mod tests {
)
.unwrap();
assert_eq!(&result.out, &to_be_bytes(&U256::from(1)));
//println!("{:?}", result);
println!("{:?}", result);
}
}

View file

@ -7,8 +7,8 @@ edition = "2018"
# Modeled after the testing pipeline of the Fe project: https://github.com/ethereum/fe/
[dependencies]
ethabi = "16.0.0"
primitive-types = { version = "0.10", features = ["rlp"] }
ethabi = "17.0.0"
primitive-types = { version = "0.11", features = ["rlp"] }
hex = { version = "0.4" }
bytes = { version = "1.1", default-features = false }
serde_json = { version = "1.0" }