Skip to content

Commit

Permalink
release: v0.6.0 (#65)
Browse files Browse the repository at this point in the history
* init: v0.6.0 staging

- adds CHANGELOG.md
- bumps version
- deletes extra builds
- updates main.rs
- updates circuits.json

* chore: remove unused circuit material (#72)

* remove: extra HTTP material

* remove: aes

* fix: tests

* remove: old `circuits.json`

* cleanup: JSON

* Delete json_nivc.circom

* Delete extractor.circom

* remove: unneeded utils

* remove: more utils

* consolidate bytes

* fix: build

* feat: `DataHasher` takes -1 as padding (#76)

* feat: authentication of ciphertext hash (#77)

* fix: HTTP formatting constraints (#78)

* fix: http headers max

* fix: verify HTTP machine state at end

* use --O1 in build

* use `--O2` flag

* Update Makefile

* delete out-of-sync docs

* delete unused example files

* delete rogue logs

* add rust cache

* remove deprecated docs

* add git for private repos

* remove circuit warnings

* place rust cache at correct step

---------

Co-authored-by: lonerapier <[email protected]>
  • Loading branch information
Autoparallel and lonerapier authored Dec 6, 2024
1 parent bfc120b commit 34c23ef
Show file tree
Hide file tree
Showing 100 changed files with 527 additions and 7,265 deletions.
31 changes: 18 additions & 13 deletions .github/workflows/artifacts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,20 @@ jobs:
sudo apt-get update
sudo apt-get install -y protobuf-compiler libprotobuf-dev
- name: Configure Git for Private Repos
run: |
git config --global url."https://${{ secrets.PAT }}@github.com/".insteadOf "https://github.com/"
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2024-10-28

- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true

- name: Install Circom
run: |
CIRCOM_VERSION=2.1.9
Expand Down Expand Up @@ -87,33 +96,29 @@ jobs:
make debug # Show what will be processed
make build # Build the circuits
- name: Configure Git for Private Repos
run: |
git config --global url."https://${{ secrets.PAT }}@github.com/".insteadOf "https://github.com/"
- name: Build and run parameter generator
run: |
rustup install nightly
# Build the parameter generator
cargo build --release
# Generate parameters using makefile target
make params
# Verify parameter files were created
for target_dir in builds/target_*b; do
size=$(basename "$target_dir" | sed 's/target_//')
# Calculate ROM length the same way as in Makefile
rom_length=$(echo "${size%b} / 16 + 16" | bc)
# List of expected files
files=(
"aux_params_${size}_rom_length_${rom_length}.bin"
"prover_key_${size}_rom_length_${rom_length}.bin"
"verifier_key_${size}_rom_length_${rom_length}.bin"
)
for file in "${files[@]}"; do
if [ ! -f "$target_dir/artifacts/$file" ]; then
echo "Error: File not found: $file in $target_dir/artifacts"
Expand All @@ -122,7 +127,7 @@ jobs:
echo "Successfully verified: $file"
fi
done
echo "Successfully generated all parameter files for ${size}"
done
Expand All @@ -133,14 +138,14 @@ jobs:
size=$(basename "$target_dir" | sed 's/target_//')
# Calculate ROM length the same way as in Makefile
rom_length=$(echo "${size%b} / 16 + 16" | bc)
# List of expected files
files=(
"aux_params_${size}_rom_length_${rom_length}.bin"
"prover_key_${size}_rom_length_${rom_length}.bin"
"verifier_key_${size}_rom_length_${rom_length}.bin"
)
for file in "${files[@]}"; do
if [ ! -f "$target_dir/artifacts/$file" ]; then
echo "Error: File not found: $file in $target_dir/artifacts"
Expand All @@ -149,9 +154,9 @@ jobs:
echo "Successfully verified: $file"
fi
done
echo "Successfully generated all parameter files for ${size}"
# Create zip archive for this target size
if [ -d "$target_dir/artifacts" ]; then
echo "Creating archive for $size"
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@ ir_log/*
log_input_signals.txt
*.bin
*.r1cs
builds/**/artifacts/
builds/**/artifacts/

# MacOS folks
**/.DS_Store
73 changes: 73 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@

# Change Log
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).


## [UNRELEASED] [0.6.0] - 2024-12-3

### Added

### Changed
#### Circuit Builds
- Removed `512b` build path
- Removed `aes_gctr_nivc_*b.circom` from build

#### Artifacts
- Adjusted circuit names:
- `aes_gctr_nivc` and `chacha20-nivc` replaced with a more suitable name: `plaintext_authentication`
- Runs with `512b` per fold
- `http_nivc` replaced with more suitable name: `http_verification`

### Fixed
- TODO

### Notes
- **Total circuits:** 5
- **Circuit sizes:**
- `plaintext_authentication_1024b`
- non-linear constraints: `365,484`
- linear-constraints: `40,463`
- Theoretical storage size: `(40,463 + 365,484) * 3 * 32 bytes = 38,971,912 bytes ≈ 39 MB`
- R1CS file: `121.3MB`
- Graph file: `13.1MB`
- **WARNINGS:** Yes. Run `circomkit compile plaintext_authentication_1024b`
- `http_verification_1024b`:
- non-linear constaints: `546,895` **(WARNING: greater than `2^19 == 524,288`)**
- linear-constraints: `543,804`
- Theoretical storage size: `(546,895 + 543,804) * 3 * 32 bytes = 104,707,104 bytes ≈ 105 MB`
- R1CS file: `246.4MB`
- Graph file: `16.5MB`
- **WARNINGS:** Yes. Run `circomkit compile http_verification_1024b`
- `json_mask_object_1024b`:
- non-linear constraints: `550,001` **(WARNING: greater than `2^20 == 524,288`)**
- linear-constraints: `316,205`
- Theoretical storage size: `(550,001 + 316,205) * 3 * 32 bytes = 83,155,776 bytes ≈ 83 MB`
- R1CS file: `109MB`
- Graph file: `9.3MB`
- **WARNINGS:** Yes. Run `circomkit compile json_mask_object_1024b`
- `json_mask_array_index_1024b`:
- non-linear constraints: `295,146`
- linear-constraints: `194,082`
- Theoretical storage size: `(295,146 + 194,082) * 3 * 32 bytes = 46,966,080 bytes ≈ 47 MB`
- R1CS file: `67.4MB`
- Graph file: `7.4MB`
- **WARNINGS:** Yes. Run `circomkit compile json_mask_array_index_1024b`
- `json_extract_value_1024b`:
- non-linear constraints == `32,039`
- linear-constraints: `18,644`
- Theoretical storage size: `(32,039 + 18,644) * 3 * 32 bytes = 4,865,568 bytes ≈ 4.8 MB`
- R1CS file: `11.1MB`
- Graph file: `949KB`
- **Estimated expanded R1CS base memory requirements:** `2^{20} * 32 * 5 ~ 168MB`$
- **Circuit param file sizes (SNARK):**
- `aux_params`: `115.1MB`
- `prover_key`: `100.7MB`
- `verifier_key`: `780.3MB`
- **Circuit param file sizes (ppSNARK):**
- `aux_params`: `836MB` **(WARNING: THIS IS LARGE)**
- `prover_key`: `5.86GB` **(WARNING: THIS IS EXTREMELY LARGE!!!)**
- `verifier_key`: `16.8MB`

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ build:
@set -e;
@for circuit in $(CIRCOM_FILES); do \
echo "Processing $${circuit}..."; \
circom "$${circuit}" --r1cs --wasm -o "$$(dirname $${circuit})/artifacts" -l node_modules; \
circom "$${circuit}" --r1cs --wasm --O2 -o "$$(dirname $${circuit})/artifacts" -l node_modules; \
build-circuit "$${circuit}" "$$(dirname $${circuit})/artifacts/$$(basename $${circuit} .circom).bin" -l node_modules; \
echo "====================xxxxxxxxxx===================="; \
done
Expand Down
35 changes: 8 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,33 @@
<h1 align="center">
Parser Attestor
Web-Prover Circuits
</h1>

<div align="center">
<a href="https://github.com/pluto/parser-attestor/graphs/contributors">
<a href="https://github.com/pluto/web-prover-circuits/graphs/contributors">
<img src="https://img.shields.io/github/contributors/pluto/spark?style=flat-square&logo=github&logoColor=8b949e&labelColor=282f3b&color=32c955" alt="Contributors" />
</a>
<a href="https://github.com/pluto/parser-attestor/actions/workflows/test.yaml">
<a href="https://github.com/pluto/web-prover-circuits/actions/workflows/test.yml">
<img src="https://img.shields.io/badge/tests-passing-32c955?style=flat-square&logo=github-actions&logoColor=8b949e&labelColor=282f3b" alt="Tests" />
</a>
<a href="https://github.com/pluto/parser-attestor/actions/workflows/lint.yaml">
<img src="https://img.shields.io/badge/lint-passing-32c955?style=flat-square&logo=github-actions&logoColor=8b949e&labelColor=282f3b" alt="Lint" />
</a>
</div>

## Overview

`parser-attestor` is a project focused on implementing parsers and extractors/selective-disclosure for various data formats inside of zero-knowledge circuits.
`web-prover-circuits` is a project focused on implementing parsers and extractors/selective-disclosure for various data formats inside zero-knowledge circuits.

## Repository Structure

- `circuits/`: Current implementation of circuits
- `chacha`: ChaCha encryption circuit
- `http`: HTTP parser and extractor
- `json`: JSON parser and extractor
- `json` has its own documentation [here](docs/json.md)
- `utils`: Utility circuits
- `test`: Circuit tests
- `src/`: Rust `pabuild` binary
- `pabuild` has its own documentation [here](docs/pabuild.md)
- `src/`: Rust public-params creation binary
- `examples/`: Reference examples for JSON and HTTP parsers

Documentation, in general, can be found in the `docs` directory.
We will add to this over time to make working with `parser-attestor` easier.

## Getting Started

Expand Down Expand Up @@ -92,9 +88,9 @@ npx circomkit help
`circomkit` can essentially do everything you would want to do with these Circuits, though we can't guarantee all commands work properly.

**Example:**
For example, to compile the `json-parser`, you can run the following from the repository root:
For example, to compile the `plaintext_authentication`, you can run the following from the repository root:
```
npx circomkit compile json-parser
npx circomkit compile plaintext_authentication_1024b
```
which implicitly checks the `circuits.json` for an object that points to the circuit's code itself.

Expand All @@ -114,21 +110,6 @@ npx mocha
will run every circuit test.
To filter tests, you can use the `-g` flag (very helpful!).


### Install `pabuild`
From the root of this repository, run:
```sh
cargo install --path .
```
to install the `pabuild` binary.
You can see a help menu with the subcommands by:
```sh
pabuild --help
```
This is our local Rust command line application.
Please see the [documentation](docs/pabuild.md) for how to use this alongside the other tools.


## License

Licensed under the Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
Expand Down
5 changes: 0 additions & 5 deletions builds/target_1024b/aes_gctr_nivc_1024b.circom

This file was deleted.

5 changes: 0 additions & 5 deletions builds/target_1024b/http_nivc_1024b.circom

This file was deleted.

5 changes: 5 additions & 0 deletions builds/target_1024b/http_verification_1024b.circom
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pragma circom 2.1.9;

include "../../circuits/http/verification.circom";

component main { public [step_in] } = HTTPVerification(1024, 25);
5 changes: 0 additions & 5 deletions builds/target_512b/aes_gctr_nivc_512b.circom

This file was deleted.

5 changes: 0 additions & 5 deletions builds/target_512b/chacha20_nivc_512b.circom

This file was deleted.

5 changes: 0 additions & 5 deletions builds/target_512b/http_nivc_512b.circom

This file was deleted.

5 changes: 0 additions & 5 deletions builds/target_512b/json_extract_value_512b.circom

This file was deleted.

5 changes: 0 additions & 5 deletions builds/target_512b/json_mask_array_index_512b.circom

This file was deleted.

5 changes: 0 additions & 5 deletions builds/target_512b/json_mask_object_512b.circom

This file was deleted.

3 changes: 2 additions & 1 deletion circomkit.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"curve": "bn128",
"includes": [
"node_modules"
]
],
"optimization": 2
}
Loading

0 comments on commit 34c23ef

Please sign in to comment.