feat: Minimal in-browser compatibility for the crate (#149)

* change: CircomWrapper constructor to use raw bytes

* chore: tmp update to latest circom-compat

* feat: Introduce PathOrBin to support in-browser CircomWrapper usage

This changes the associated type `Params` of the `CircomFCircuit` to use
the newly created `PathOrBin` type.

This allows the user of the lib to directly send the binary of the files
already read or instead, provide a path to it and let `sonobe` do the
work.

With this, Circom should be already usable from the browser if we allow
JS to take care of reading the `.wasm` and `.r1cs` files.

* feat: Introduce PathOrBin to support in-browser NoirFCircuit usage

This commit temporarilly stands on top of
https://github.com/dmpierre/arkworks_backend/pull/1 referenced as `rev`.

This changes the associated type `Params` of the `CircomFCircuit` to use
the newly created `PathOrBin` type.

This allows the user of the lib to directly send the binary of the files
already read or instead, provide a path to it and let `sonobe` do the
work.

With this, Noir should be already usable from the browser if we allow
JS to take care of reading the `circuit.json` files

* chore: Update deps to branch instead of `rev`

* fix: use PathOrBin in examples

* fix: clippy

* fix: read file length for initializing vec size

---------

Co-authored-by: dmpierre <pdaixmoreux@gmail.com>
This commit is contained in:
Carlos Pérez
2024-08-27 16:34:58 +02:00
committed by GitHub
parent 7097c001fc
commit 52de2d185c
6 changed files with 100 additions and 35 deletions

View File

@@ -61,7 +61,7 @@ fn main() {
"./folding-schemes/src/frontend/circom/test_folder/with_external_inputs_js/with_external_inputs.wasm",
);
let f_circuit_params = (r1cs_path, wasm_path, 1, 2);
let f_circuit_params = (r1cs_path.into(), wasm_path.into(), 1, 2);
let f_circuit = CircomFCircuit::<Fr>::new(f_circuit_params).unwrap();
pub type N =