Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Arvolear committed Nov 14, 2024
1 parent 027d21e commit bf6a9b1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@

This hardhat plugin is a zero-config, one-stop Circom development environment that streamlines circuits management and lets you focus on the important - code.

- Developer-oriented abstractions that simplify `r1cs`, `zkey`, `vkey`, and `witness` generation processes.
- Developer-oriented abstractions that simplify `r1cs`, `witness`, `zkey`, and `vkey` generation processes.
- Support of `groth16` and `plonk` proving systems.
- Recompilation of only the modified circuits.
- Recompilation and resetup of only the modified circuits.
- Full TypeScript typization of signals and ZK proofs.
- Automatic downloads of phase-1 `ptau` files.
- Convenient phase-2 contributions to `zkey` files.
- Available `witness` testing via chai assertions.
- Invisible platform-specific and fallback `wasm`-based Circom compiler management.
- Practical `witness` and proof testing via chai assertions.
- Invisible platform-specific and `wasm`-based Circom compiler management.
- Simplified `node_modules` libraries resolution.
- Rich plugin configuration.
- And much more!
Expand All @@ -41,7 +41,7 @@ require("@solarity/hardhat-zkit"); // JavaScript
```

> [!TIP]
> There is no need to download the Circom compiler separately. The plugin automatically installs missing compilers under the hood.
> There is no need to download the Circom compiler separately. The plugin automatically installs required compilers under the hood.
## Usage

Expand All @@ -62,7 +62,7 @@ module.exports = {
},
setupSettings: {
contributionSettings: {
provingSystem: "groth16", // or ["groth16", "plonk"]
provingSystem: "groth16", // or "plonk"
contributions: 2,
},
onlyFiles: [],
Expand All @@ -72,7 +72,7 @@ module.exports = {
},
verifiersSettings: {
verifiersDir: "contracts/verifiers",
verifiersType: "sol",
verifiersType: "sol", // or "vy"
},
typesDir: "generated-types/zkit",
quiet: false,
Expand All @@ -90,18 +90,18 @@ Where:
- `skipFiles` - The list of directories (or files) to be excluded from the compilation.
- `c` - The flag to generate the c-based witness generator (generates wasm by default).
- `json` - The flag to output the constraints in json format.
- `optimization` - The flag to set the level of constraint simplification during compilation (`O0`, `O1` or `O2`).
- `optimization` - The flag to set the level of constraint simplification during compilation (`"O0"`, `"O1"` or `"O2"`).
- `setupSettings`
- `contributionSettings`
- `provingSystem` - The option to indicate which proving system to use (`groth16`, `plonk` or `["groth16", "plonk"]`).
- `provingSystem` - The option to indicate which proving system to use (`"groth16"`, `"plonk"` or `["groth16", "plonk"]`).
- `contributions` - The number of phase-2 `zkey` contributions to make if `groth16` is chosen.
- `onlyFiles` - The list of directories (or files) to be considered for the setup phase.
- `skipFiles` - The list of directories (or files) to be excluded from the setup phase.
- `ptauDir` - The directory where to look for the `ptau` files. `$HOME/.zkit/ptau/` by default.
- `ptauDownload` - The flag to allow automatic download of required `ptau` files.
- `verifiersSettings`
- `verifiersDir` - The directory where to generate the Solidity verifiers.
- `verifiersType` - The option (`sol` or `vy`) to indicate which language to use for verifiers generation.
- `verifiersDir` - The directory where to generate the Solidity | Vyper verifiers.
- `verifiersType` - The option (`"sol"` or `"vy"`) to indicate which language to use for verifiers generation.
- `typesDir` - The directory where to save the generated typed circuits wrappers.
- `quiet` - The flag indicating whether to suppress the output.

Expand All @@ -123,7 +123,7 @@ npx hardhat help zkit <zkit task name>

### Typization

The plugin provides full TypeScript typization of Circom circuits leveraging [`zktype`](https://github.com/dl-solarity/zktype) library.
The plugin provides full TypeScript typization of Circom circuits leveraging [`zktype`](https://github.com/dl-solarity/zktype) library. Both `groth16` and `plonk` proving systems are supported.

The following config may be added to `tsconfig.json` file to allow for a better development experience:

Expand Down Expand Up @@ -156,7 +156,7 @@ require("@solarity/chai-zkit"); // JavaScript
The package extends `expect` chai assertion to recognize typed `zktype` objects for frictionless testing experience.

> [!NOTE]
> Please note that for witness testing purposes it is sufficient to compile the circuit just with `zkit compile` task, without generating the keys.
> Please note that for witness testing purposes it is sufficient to compile circuits just with `zkit compile` task, without generating the keys.
### Example

Expand Down Expand Up @@ -226,7 +226,7 @@ To see the plugin in action, place the `Multiplier` circuit in the `circuits` di
npx hardhat zkit make
```

This command will install the newest compatible Circom compiler, compile the provided circuit, download the necessary `ptau` file regarding the number of circuit's constraints, build the required `zkey` and `vkey` files, and generate TypeScript object wrappers to enable full typization of signals and ZK proofs.
This command will install the newest compatible Circom compiler, compile the provided circuit, download the necessary `ptau` file regarding the number of circuit's constraints and the proving system of choice, build the required `zkey` and `vkey` files, and generate TypeScript object wrappers to enable full typization of signals and ZK proofs.

Afterward, copy the provided script to the `test` directory and run the tests via `npx hardhat test`. You will see that all the tests are passing!

Expand All @@ -244,18 +244,18 @@ The method works regardless of how the circuit was compiled, however, if `zkit c

In case there are conflicts between circuit file names and `main` component names, you should use the `fullCircuitName`, which has the following form: `circuitSourceName:circuitName`.

The optional `provingSystem` parameter should be specified only if multiple proving systems were set in the config.

Where:

- `circuitSourceName` - Path to the circuit file from the project root.
- `circuitName` - Circuit `main` component name.
- `provingSystem` - Optional parameter that can either be `groth16` or `plonk`.

The optional `provingSystem` parameter should only be specified if multiple proving systems were set in the config. Otherwise, leave it as `undefined`.

> [!IMPORTANT]
> Please note that the method actually returns the [`zktype`](https://github.com/dl-solarity/zktype) typed zkit wrapper objects which enable full TypeScript typization of signals and proofs. Also, check out the [`zkit`](https://github.com/dl-solarity/zkit) documentation to understand zkit object capabilities and how to interact with circuits.
## Known limitations

- Currently there is minimal support for `var` Circom variables. Some circuits may not work if you are using complex `var`-dependent expressions.
- Even though the plugin provides support of Circom `v2.2.0`, its newest feature `bus` is not supported.
- Due to current `wasm` memory limitations (address space is 32-bit), the plugin may fail to compile especially large circuits on some platforms.
4 changes: 2 additions & 2 deletions src/core/dependencies/parser/CircomTemplateInputsVisitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -533,12 +533,12 @@ export class CircomTemplateInputsVisitor extends CircomVisitor<void> {
switch (ctx.SELF_OP().getText()) {
case "++":
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
// @ts-ignore
this._vars[assigneeName]++;
break;
case "--":
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
// @ts-ignore
this._vars[assigneeName]--;
break;
default:
Expand Down

0 comments on commit bf6a9b1

Please sign in to comment.