tweaks
This commit is contained in:
parent
b8a79d4dda
commit
efb2c8a492
6 changed files with 795 additions and 251 deletions
1005
Cargo.lock
generated
1005
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -65,8 +65,8 @@ digest = { version = "0.9", optional = true }
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
wasm-bindgen-test = "^0.3.0"
|
wasm-bindgen-test = "^0.3.0"
|
||||||
pretty_assertions = "0.6.1"
|
pretty_assertions = "0.6.1"
|
||||||
ethabi = "16.0.0"
|
ethabi = "17.0.0"
|
||||||
primitive-types = { version = "0.10", features = ["rlp"] }
|
primitive-types = { version = "0.11", features = ["rlp"] }
|
||||||
zokrates_fs_resolver = { version = "0.5", path = "../zokrates_fs_resolver"}
|
zokrates_fs_resolver = { version = "0.5", path = "../zokrates_fs_resolver"}
|
||||||
zokrates_solidity_test = { path = "../zokrates_solidity_test"}
|
zokrates_solidity_test = { path = "../zokrates_solidity_test"}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ use digest::Digest;
|
||||||
use num::Zero;
|
use num::Zero;
|
||||||
use rand_0_8::{Error, RngCore, SeedableRng};
|
use rand_0_8::{Error, RngCore, SeedableRng};
|
||||||
use sha3::Keccak256;
|
use sha3::Keccak256;
|
||||||
|
use std::convert::TryInto;
|
||||||
use std::{convert::TryFrom, marker::PhantomData};
|
use std::{convert::TryFrom, marker::PhantomData};
|
||||||
|
|
||||||
use zokrates_field::{ArkFieldExtensions, Field};
|
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)),
|
.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(),
|
evaluations: proof.evaluations.into_iter().map(T::from_ark).collect(),
|
||||||
pc_proof_proof: proof
|
pc_proof_proof: proof
|
||||||
.pc_proof
|
.pc_proof
|
||||||
.proof
|
.proof
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|p| (parse_g1::<T>(&p.w), p.random_v.map(T::from_ark)))
|
.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: proof
|
||||||
.pc_proof
|
.pc_proof
|
||||||
.evals
|
.evals
|
||||||
|
@ -300,12 +307,12 @@ impl<T: Field + ArkFieldExtensions> Backend<T, marlin::Marlin> for Ark {
|
||||||
commitments: proof
|
commitments: proof
|
||||||
.proof
|
.proof
|
||||||
.commitments
|
.commitments
|
||||||
.into_iter()
|
.iter()
|
||||||
.map(|r| {
|
.map(|r| {
|
||||||
r.into_iter()
|
r.into_iter()
|
||||||
.map(|(c, shifted_comm)| Commitment {
|
.map(|(c, shifted_comm)| Commitment {
|
||||||
comm: KZG10Commitment(serialization::to_g1::<T>(c)),
|
comm: KZG10Commitment(serialization::to_g1::<T>(c.clone())),
|
||||||
shifted_comm: shifted_comm.map(|shifted_comm| {
|
shifted_comm: shifted_comm.clone().map(|shifted_comm| {
|
||||||
KZG10Commitment(serialization::to_g1::<T>(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: proof
|
||||||
.proof
|
.proof
|
||||||
.pc_proof_proof
|
.pc_proof_proof
|
||||||
.into_iter()
|
.iter()
|
||||||
.map(|(w, random_v)| KZG10Proof {
|
.map(|(w, random_v)| KZG10Proof {
|
||||||
w: serialization::to_g1::<T>(w),
|
w: serialization::to_g1::<T>(w.clone()),
|
||||||
random_v: random_v.map(|v| v.into_ark()),
|
random_v: random_v.clone().map(|v| v.into_ark()),
|
||||||
})
|
})
|
||||||
.collect(),
|
.collect(),
|
||||||
evals: proof
|
evals: proof
|
||||||
|
|
|
@ -59,7 +59,7 @@ pub type Fr = String;
|
||||||
pub type Fq = String;
|
pub type Fq = String;
|
||||||
pub type Fq2 = (String, String);
|
pub type Fq2 = (String, String);
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone)]
|
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||||
pub struct G1Affine(Fq, Fq);
|
pub struct G1Affine(Fq, Fq);
|
||||||
|
|
||||||
// When G2 is defined on Fq2 field
|
// When G2 is defined on Fq2 field
|
||||||
|
|
|
@ -11,9 +11,9 @@ pub struct Marlin;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
pub struct ProofPoints<Fr, G1> {
|
pub struct ProofPoints<Fr, G1> {
|
||||||
pub commitments: Vec<Vec<(G1, Option<G1>)>>,
|
pub commitments: [[(G1, Option<G1>); 2]; 3],
|
||||||
pub evaluations: Vec<Fr>,
|
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 pc_proof_evals: Option<Vec<Fr>>,
|
||||||
pub prover_messages_count: usize,
|
pub prover_messages_count: usize,
|
||||||
}
|
}
|
||||||
|
@ -832,6 +832,6 @@ mod tests {
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert_eq!(&result.out, &to_be_bytes(&U256::from(1)));
|
assert_eq!(&result.out, &to_be_bytes(&U256::from(1)));
|
||||||
//println!("{:?}", result);
|
println!("{:?}", result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,8 @@ edition = "2018"
|
||||||
# Modeled after the testing pipeline of the Fe project: https://github.com/ethereum/fe/
|
# Modeled after the testing pipeline of the Fe project: https://github.com/ethereum/fe/
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ethabi = "16.0.0"
|
ethabi = "17.0.0"
|
||||||
primitive-types = { version = "0.10", features = ["rlp"] }
|
primitive-types = { version = "0.11", features = ["rlp"] }
|
||||||
hex = { version = "0.4" }
|
hex = { version = "0.4" }
|
||||||
bytes = { version = "1.1", default-features = false }
|
bytes = { version = "1.1", default-features = false }
|
||||||
serde_json = { version = "1.0" }
|
serde_json = { version = "1.0" }
|
||||||
|
|
Loading…
Reference in a new issue