Skip to content

Commit

Permalink
Dev (#15)
Browse files Browse the repository at this point in the history
* Added zk cryptography (#14)

* Add hash functions

* Add zk cryptography

* fix deps

* fix test runner

* linted and reorganised hash functions;
switched all files to one pragma circom version

* linted wasm-test

* updated hardhat-zkit package version

* linted zk cryptography circom files

* cleaned up wasm-test js files

* renamed functions to camel case

* removed double spaces;
added spaces between operators;
linting

* refactored comments, corrected typos

* linting

* updated dependencies

* rewrote tests from wasm to hardhat: bigInt folder

* rewrote tests from wasm to hardhat: bitify folder

* rewrote tests from wasm to hardhat: hasher folder

* rewrote tests from wasm to hardhat: int folder

* transfered common functions to helperFunctions file

* fixed typos:
ellipic -> elliptic
ADDERS_NUMBER -> ADDRES_NUMBER

* allowed UnlimitedContractSize for verifiers contracts

* updated hardhat-zkit version

* rewrote tests from wasm to hardhat: matrix folder

* fixed typos

* switched to same order of inputs in sig folder

* rewrote tests from wasm to hardhat: signature folder

* rewrote tests from wasm to hardhat: ec folder

* fixed typos

* trying to fix compile in ci

* trying to adjust ram in case its github limit

* refactored possibly undefined vars in tests

* checking a pipeline without 4 biggest circuits

* fixed tests for brainloop:
automatically generated verifier names were too long,
so corresponding contracts were not generated;
fixed by creating verifiers dirrectly whithin the tests

* refactored assertion checks in tests

* updated zkit hardhat version

* let -> const in tests

* deleted wasm-test folder

* trying to fix ci

* trying to fix ci command

* disabled ci checks

* consistency in tests

* added missing BigSubNonEqual test

* cleaned up

* mock directory renamed to main;
mock is for tests now

* moved mgf1.circom to utils

* fixed typo in Pippenger

* fixed paths (renamed mock to main)

* switched to local circuits instead of circomlib's

* renamed utils to mask

* CommitmentVerifier -> Commitment
SparseMerkleTreeVerifier -> SparseMerkleTree

* updated dependencies

* updated tests

* fixed package-lock

* linting

* removed unnecessary dependencies

* returned chai deps

---------

Co-authored-by: 1KitCat1 <denischool119@gmail.com>
Co-authored-by: Artem Chystiakov <artem.ch31@gmail.com>

* update readme

* update readme

---------

Co-authored-by: Yuliia Aritkulova <94910987+aritkulova@users.noreply.github.com>
Co-authored-by: 1KitCat1 <denischool119@gmail.com>
  • Loading branch information
3 people authored Jan 14, 2025
1 parent 42d462c commit 2a14fc5
Show file tree
Hide file tree
Showing 168 changed files with 811,647 additions and 263 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ insert_final_newline = true
[*.ts]
indent_size = 2
max_line_length = 120
[*.js]
indent_size = 2
max_line_length = 120
[*.sol]
indent_size = 4
max_line_length = 99
24 changes: 0 additions & 24 deletions .github/workflows/checks.yml

This file was deleted.

50 changes: 40 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,46 @@

The library consists of circom circuits that extend the capabilities of [solarity/solidity-lib](https://github.com/dl-solarity/solidity-lib) to be used in magnificent ZK applications.

- Versatile commitment / nullifier circuit.
- Optimized Sparse Merkle Tree (SMT) data structure.
```md
circuits
├── bigInt
│ ├── bigInt - "BigInt implementation with chunking"
│ ├── bigIntOverflow — "BigInt implementation with chunk overflow"
│ ├── bigIntFunc — "Additional functions to accommodate BigInt"
│ └── karatsuba — "Karatsuba multiplication for BigInt"
├── bitify
│ ├── bitGates — "Multiple binary gates"
│ ├── bitify — "Convert numbers to bits and vice versa"
│ ├── comparators - "Compare signals in binary representation"
│ └── operations — "Binary sum of multiple elements"
├── blinders
│ └── Commitment — "Commit/reveal scheme implementation"
├── data-structures
│ └── SparseMerkleTree — "SMT Merkle inclusion/exclusion proofs verification"
├── ec
│ ├── curve — "Elliptic curve operations (secp256r1, secp256k1, brainpoolP256r1, brainpoolP384r1, secp384r1)"
│ ├── get - "Generator point getters for supported elliptic curves"
│ └── powers — "Precompute tables for supported elliptic curves"
├── hasher
│ ├── hash — "Hash functions (sha1, sha224, sha256, sha384, sha512, poseidon)"
│ ├── poseidon - "Poseidon hash function implementation"
│ ├── sha1 — "SHA1 hash function implementation"
│ └── sha2 — "SHA2 hash functions family implementations"
├── int
│ └── arithmetic - "Arithmetic operations over integers"
├── matrix
│ └── matrix — "Common operations for NxM matrices"
├── signatures
│ ├── ecdsa - "ECDSA verification over supported curves"
│ ├── rsa — "RSA-PKCS#1 v1.5 signature verification"
│ ├── rsaPss — "RSASSA-PSS with MGF1 signature verification"
│ └── mask - "Mask generation functions implementation"
├── utils
│ ├── aliascheck — "Check the number fits the scalar field size"
│ └── compconstant — "Compare a number with a template parameter in a binary form"
├── main - "Main components for testing purposes"
└── mock - "Mocks (logs) for testing purposes"
```

Powered by [hardhat-zkit](https://github.com/dl-solarity/hardhat-zkit) circom environment.

Expand All @@ -28,14 +66,6 @@ You can compile the circuits in the project by executing the following command:
$ npm run zkit-compile
```

### Create verifier contracts for the circuits

Run the following command in order to generate the solidity verifier contracts:

```console
$ npm run zkit-verifiers
```

## License

The library is released under the MIT License.
Loading

0 comments on commit 2a14fc5

Please sign in to comment.