Use BufReader for loading R1CS file (#79)

Co-authored-by: Bruno Valente <140794260+bruno-valante@users.noreply.github.com>
This commit is contained in:
Pratyush Mishra 2024-10-25 10:06:12 -07:00 committed by Dmitriy Ryajov
parent 45bc3743d9
commit bc60de984f
No known key found for this signature in database
GPG Key ID: DA8C680CE7C657A4

View File

@ -1,13 +1,10 @@
use std::{fs::File, path::Path}; use ark_ff::PrimeField;
use num_bigint::BigInt;
use std::{collections::HashMap, fs::File, io::BufReader, path::Path};
use wasmer::Store; use wasmer::Store;
use ark_ff::PrimeField;
use super::{CircomCircuit, R1CS}; use super::{CircomCircuit, R1CS};
use num_bigint::BigInt;
use std::collections::HashMap;
use crate::{ use crate::{
circom::R1CSFile, circom::R1CSFile,
witness::{Wasm, WitnessCalculator}, witness::{Wasm, WitnessCalculator},
@ -33,7 +30,7 @@ impl<F: PrimeField> CircomConfig<F> {
pub fn new(wtns: impl AsRef<Path>, r1cs: impl AsRef<Path>) -> Result<Self> { pub fn new(wtns: impl AsRef<Path>, r1cs: impl AsRef<Path>) -> Result<Self> {
let mut store = Store::default(); let mut store = Store::default();
let wtns = WitnessCalculator::new(&mut store, wtns).unwrap(); let wtns = WitnessCalculator::new(&mut store, wtns).unwrap();
let reader = File::open(r1cs)?; let reader = BufReader::new(File::open(r1cs)?);
let r1cs = R1CSFile::new(reader)?.into(); let r1cs = R1CSFile::new(reader)?.into();
Ok(Self { Ok(Self {
wtns, wtns,