From 89b1327a18b4762d04dede178b43fdef8852171e Mon Sep 17 00:00:00 2001 From: Pratyush Mishra Date: Fri, 25 Oct 2024 10:06:12 -0700 Subject: [PATCH] Use BufReader for loading R1CS file (#79) Co-authored-by: Bruno Valente <140794260+bruno-valante@users.noreply.github.com> --- src/circom/builder.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/circom/builder.rs b/src/circom/builder.rs index f1842a0..5bb562a 100644 --- a/src/circom/builder.rs +++ b/src/circom/builder.rs @@ -1,13 +1,10 @@ -use std::{fs::File, path::Path}; -use wasmer::Store; - use ark_ff::PrimeField; +use num_bigint::BigInt; +use std::{collections::HashMap, fs::File, io::BufReader, path::Path}; +use wasmer::Store; use super::{CircomCircuit, R1CS}; -use num_bigint::BigInt; -use std::collections::HashMap; - use crate::{ circom::R1CSFile, witness::{Wasm, WitnessCalculator}, @@ -33,7 +30,7 @@ impl CircomConfig { pub fn new(wtns: impl AsRef, r1cs: impl AsRef) -> Result { let mut store = Store::default(); 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(); Ok(Self { wtns,