mirror of
https://github.com/codex-storage/circom-compat-ffi.git
synced 2025-02-18 13:27:08 +00:00
make sure vectors are sized to number of elements
This commit is contained in:
parent
190adb8c23
commit
23ff59715d
10
fixtures/mycircuit.circom
Normal file
10
fixtures/mycircuit.circom
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
template Multiplier() {
|
||||||
|
signal private input a;
|
||||||
|
signal private input b;
|
||||||
|
signal output c;
|
||||||
|
|
||||||
|
c <== a*b;
|
||||||
|
}
|
||||||
|
|
||||||
|
component main = Multiplier();
|
||||||
|
|
BIN
fixtures/mycircuit.r1cs
Normal file
BIN
fixtures/mycircuit.r1cs
Normal file
Binary file not shown.
BIN
fixtures/mycircuit.wasm
Normal file
BIN
fixtures/mycircuit.wasm
Normal file
Binary file not shown.
BIN
fixtures/powersOfTau28_hez_final_10.ptau
Normal file
BIN
fixtures/powersOfTau28_hez_final_10.ptau
Normal file
Binary file not shown.
BIN
fixtures/test.zkey
Normal file
BIN
fixtures/test.zkey
Normal file
Binary file not shown.
@ -147,7 +147,9 @@ impl From<VerifyingKey> for ark_groth16::VerifyingKey<Bn254> {
|
|||||||
|
|
||||||
impl From<&ark_groth16::VerifyingKey<Bn254>> for VerifyingKey {
|
impl From<&ark_groth16::VerifyingKey<Bn254>> for VerifyingKey {
|
||||||
fn from(vk: &ark_groth16::VerifyingKey<Bn254>) -> Self {
|
fn from(vk: &ark_groth16::VerifyingKey<Bn254>) -> Self {
|
||||||
let ic: Vec<G1> = vk.gamma_abc_g1.iter().map(|p| p.into()).collect();
|
let mut ic: Vec<G1> = vk.gamma_abc_g1.iter().map(|p| p.into()).collect();
|
||||||
|
ic.shrink_to_fit();
|
||||||
|
|
||||||
let len = ic.len();
|
let len = ic.len();
|
||||||
Self {
|
Self {
|
||||||
alpha1: G1::from(&vk.alpha_g1),
|
alpha1: G1::from(&vk.alpha_g1),
|
||||||
@ -162,11 +164,12 @@ impl From<&ark_groth16::VerifyingKey<Bn254>> for VerifyingKey {
|
|||||||
|
|
||||||
impl From<&[Fr]> for Inputs {
|
impl From<&[Fr]> for Inputs {
|
||||||
fn from(src: &[Fr]) -> Self {
|
fn from(src: &[Fr]) -> Self {
|
||||||
let els: Vec<[u8; 32]> = src
|
let mut els: Vec<[u8; 32]> = src
|
||||||
.iter()
|
.iter()
|
||||||
.map(|point| point_to_slice(*point))
|
.map(|point| point_to_slice(*point))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
|
els.shrink_to_fit();
|
||||||
let len = els.len();
|
let len = els.len();
|
||||||
Self {
|
Self {
|
||||||
elms: Box::leak(els.into_boxed_slice()).as_ptr(),
|
elms: Box::leak(els.into_boxed_slice()).as_ptr(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user