Commit Graph

40 Commits

Author SHA1 Message Date
Dmitriy Ryajov 2bb54b79e7
adding support to read from byte buffers 2024-01-20 15:27:45 -06:00
tyshko-rostyslav 170b10fc9e
description and licence (#54) 2023-07-26 08:54:58 -04:00
tyshko-rostyslav 574813398e
Preparatory work for issue #47 (#48)
Co-authored-by: tyshkor <tyshko1@gmail.com>
2023-07-24 09:30:45 -07:00
tyshko-rostyslav 507aa4ff5b
Fix CI by fixing version + add toolchain file (#52)
* Fix CI by fixing version + add toolchain file

* readme comment

* Tweak README message

* typo

---------

Co-authored-by: tyshkor <tyshko1@gmail.com>
Co-authored-by: Pratyush Mishra <pratyushmishra@berkeley.edu>
2023-07-24 18:12:23 +02:00
tyshko-rostyslav f97ac2b245
new features to make ark-circom slimmer (#45)
* new features

* fmt

* update wasm feature

* revert

* update

---------

Co-authored-by: tyshkor <tyshko1@gmail.com>
2023-03-20 11:47:32 -07:00
Deepak Maram b892c62597
Update ark-circom for arkworks 0.4.0 (#43) 2023-03-16 14:42:33 -07:00
Georgios Konstantopoulos 35ce5a909e
fix: use correct feature name 2023-02-21 22:58:27 -08:00
Georgios Konstantopoulos 746d2329e9 chore: lints + remove ethers dep 2023-02-10 18:33:01 -08:00
tyshko-rostyslav 5a1b78b320
WIP: Lightweight version of `ark-circom` (#41)
* remove ethers-core

* test

* return ethereum and add a feature

* lint fixes

---------

Co-authored-by: s1fr0 <28568419+s1fr0@users.noreply.github.com>
Co-authored-by: tyshkor <tyshko1@gmail.com>
2023-02-10 18:32:52 -08:00
Evgeniy Abramov e226f90591
fix(ci): fmt and clippy goes green (#36) 2023-01-20 10:53:39 -08:00
laizy ab7f9ec3a1
add missing wasm runtime function (#29) 2023-01-05 18:49:21 +02:00
Georgios Konstantopoulos 06eb0759e0
Bump to latest Ethers (#26)
* 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
2022-08-29 15:06:27 -07:00
Georgios Konstantopoulos 8f6fcaf40b chore: add mit/apache dual license 2022-08-29 10:06:57 -07:00
Remco Bloemen a93c8b03d4
feat: allow WitnessCalculator construction from wasmer::Module (#24)
* Allow construction from Module

* Update src/witness/witness_calculator.rs

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
2022-03-19 11:21:03 -07:00
oskarth d0478d1538
When constraints are unsatisfied, show first one (#21)
Useful for debugging
2022-02-25 12:25:03 +02:00
Philipp Sippl e81fd92a67
replace i32 by u32 (#19)
* replace i32 by u32

* fix overflow in usize

* add testcase for u32 input
2022-02-17 17:23:19 +02:00
Yang Hau cac27e6536
doc: Fix Rust dependency in README (#16) 2022-02-01 18:11:30 +02:00
oskarth 1a383b6260
Ensure Circom 1 tests pass with experimental Circom 2 support (#18)
* 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
2022-01-13 13:30:00 +02:00
Philipp Sippl 1732e15d63
circom2 proof generation (#14)
* circom2 proof generation

* fix fmt and test

* fix clippy and format dependency

* make clippy happy (circom2 changes)

* make clippy happy (#12)
2021-12-22 03:05:57 +02:00
oskarth bf2b439fae
Improve r1cs_reader for Circom 2 (#13)
* 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 bc88c726590e250c2e042e9d4b74b77e294e32ec.
2021-12-01 14:09:57 +02:00
oskarth 64e0ee9546
Initial Circom 2 support (#10)
* 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
2021-11-29 10:02:46 +02:00
oskarth b1daefca96
Early exit in error callback from Wasm (#9)
* 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>
2021-11-18 12:03:37 +02:00
Georgios Konstantopoulos bb0f5429fc
feat: benchmarks (#3)
* add benchmark

* chore: add complex circuit

* feat: enable parallel / asm

* bench: use pre-calculated matrices/constraints

* chore: bump ethers-rs

* chore: fmt

* feat: add benches for differently sized circuits (#6)

* feat: update bench circuit

* feat: add benches for many sizes

* fix: adjust bench parameters

* fix: remove sym

* chore: fmt

* fix: point to correct commit of groth16

* fix: update function names to upstream

* fix: update function names to upstream

Co-authored-by: Kobi Gurkan <kobigurk@gmail.com>
2021-09-08 21:52:17 +03:00
Georgios Konstantopoulos 11e6d04f3b
Feat: Use pre-calculated ConstraintMatrices (#2)
* 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>
2021-08-17 14:45:13 +03:00
Georgios Konstantopoulos 4e2c2d39dd chore: cargo fmt 2021-08-13 12:47:30 +03:00
Georgios Konstantopoulos 0dd126bbd8 fix: use correct fn prover name in tests 2021-08-13 12:45:49 +03:00
Georgios Konstantopoulos a85b99e0db perf: enable parallel on ark packages 2021-08-13 12:40:23 +03:00
Georgios Konstantopoulos 3c11c94d63 perf: enable asm on ark-ff 2021-08-13 12:39:06 +03:00
Georgios Konstantopoulos f316f6a9fa chore: use latest upstream gro16 2021-08-13 12:37:09 +03:00
Georgios Konstantopoulos 293314f2ef chore: cargo fmt 2021-08-11 23:46:07 +03:00
Georgios Konstantopoulos 29de734540 feat: add deserialize_field2 function 2021-08-11 23:45:50 +03:00
Georgios Konstantopoulos cf225249ae chore: expose Proof a/b/c 2021-08-11 03:22:18 +03:00
Georgios Konstantopoulos de9af5b9e6 fix: negate negative witness elements 2021-08-11 03:22:18 +03:00
Georgios Konstantopoulos c32270a285 fix: use latest names for groth16 traits/types 2021-08-10 18:09:32 +03:00
Georgios Konstantopoulos c03ae8490f chore: trim deps 2021-07-26 18:13:46 +03:00
Georgios Konstantopoulos be99d3a1fd docs: add readme 2021-07-26 18:01:22 +03:00
Georgios Konstantopoulos 72c533ac62 refactor: rename circuit -> circom 2021-07-26 17:54:04 +03:00
Georgios Konstantopoulos 29a7555c08 zkey: expose only 1 method - everything else private 2021-07-26 17:38:29 +03:00
Georgios Konstantopoulos 8ff7f3cd1b refactor: rename circom_wasm to witness 2021-07-26 17:32:18 +03:00
Georgios Konstantopoulos b64f038283 initial commit 2021-07-26 17:04:43 +03:00