As discussed in https://github.com/arkworks-rs/circom-compat/issues/72
it's not currently possible to load parameters from their binary.
This would help a lot in browser envoiroments where JS can take care of
handling the read and we just open the door in the WASM module to allow
to load new ones from the bytes read.
The commit adds a change in the tests which now load from binary instead
of reading from file. This ensures that the reading is indeed working as
expected although we rely on a different fn from `wasmer`.
* fix: manage already allocated public inputs with a custom mapping
* fix: initialize CircomCircuit with empty allocated public input variables
* feat: add ability to choose to allocate inputs as witnesses or instances
* chore: remove outdated comment
* test: add relevant tests and asserts for generate_constraints
* chore: add files used for tests
* chore: replace assert_eq with match statement
* chore: bump ethers
* fix: adjust ethers breaking changes
1. Use the abigen'd ::deploy methods
2. Use Anvil instead of Ganache
* silence warning
* fix: replace abi with full verifier artifact
* ci: use anvil instead of the node stack
* chore: remove ethers-solc
* fix: return error instead of raise
17c0834abf
this api got deprecated and would panic instead of generating an error that can behandled
* lints
* minimfy json
* All tests pass under circom-2 feature flag
- Check for version in WASM, default to version 1
- Include Circom1 when Circom 2 feature flag is enabled
Currently a lot of code duplication. Once Circom-2 is more stable and
proven to work in the wild, feature flag can be removed.
* Separate Circom 1 and Circom2 witness calculation
* Cleanup
* WitnessCalculator helpers for Circom 1 and 2
Also make helper fn private
* Move comment
* Fix expression return
* cargo fmt
* Add cargo test circom-2 to ci
* Improve r1cs_reader for Circom 2
Shamelessly taken from https://github.com/poma/zkutil/pull/7/files by @lispc
* Document Seek type restriction
* Doc linter: use automatic links
* Use iter for iterating over sections
* Better error handling with ok_or_else
* Revert "Use iter for iterating over sections"
This reverts commit bc88c72659.
* Import circom-2 test vectors
* Add failing test under feature flag
* Add exceptionHandler
* Add showSharedRWMemory
* Add getFieldNumLen32 and disable getFrLen
* Add getVersion
Also print version, n32
* Add getRawPrime
- Disable getPtrRawPrime
- Write as conditional cfg code blocks
* Refactor cfg code blocks
* Add readSharedRWMemory and get prime from WASM mem
- Add fromArray32 convenience function
* WIP: Debug R1CSfile header
field_size in header is 1, not 32 as expected
Don't see anything recently changed here:
https://github.com/iden3/r1csfile/blob/master/src/r1csfile.js (used by snarkjs)
But this seems new: 0149dc0643/constraint_writers/src/r1cs_writer.rs
* Add CircomVersion struct to Wasm
* XXX: Enum test
* Trait version
* Move traits to Circom, CircomBase, Circom2
* Simplify Wasm struct and remove version
* Feature gate Circom1/Circom2 traits
* Use cfg_if for witness calculation
Make normal dependency
* Fix visibilty for both test paths
* Remove println
Can introduce tracing separately
* refactor
* Make clippy happy with imports, unused variables
* Early exit in error callback from Wasm
This avoids Wasm execution hanging due to problems such as wrong public
input.
Mimics circom_runtime behaviour with less detailed debug information.
See https://github.com/iden3/circom_runtime/blob/master/js/witness_calculator.js#L52-L64
Adds test for wrong public input. Without early exit, the test stalls.
With it, the Circom build step fails as expected.
* chore: clean up error handling
* ci: add caching
Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
* feat: add function for calculating the coefficients
* fix tests / debug coeffs
* feat: use groth16 with configurable matrices
* test: add no r1cs test
* test: add a test to check matrices values
* scaffold of the matrix calculation
* feat: correctly load and use matrices in the without_r1cs variant
* chore: cargo fmt
* chore: cargo fmt / lints
* ci: do not double run tests
* fix: calculate correctly points at inf
* test: use correct abicoder v2 types
Co-authored-by: Kobi Gurkan <kobigurk@gmail.com>