From 08edfb72ac514cee040106e192b84a7e91414185 Mon Sep 17 00:00:00 2001 From: Colin Roberts Date: Tue, 3 Dec 2024 12:42:49 -0700 Subject: [PATCH] init: v0.6.0 staging - adds CHANGELOG.md - bumps version - deletes extra builds - updates main.rs - updates circuits.json --- .gitignore | 5 +- CHANGELOG.md | 73 +++++++++++++++++++ .../target_1024b/aes_gctr_nivc_1024b.circom | 5 -- ....circom => http_verification_1024b.circom} | 0 ... => plaintext_authentication_1024b.circom} | 1 + builds/target_512b/aes_gctr_nivc_512b.circom | 5 -- builds/target_512b/chacha20_nivc_512b.circom | 5 -- builds/target_512b/http_nivc_512b.circom | 5 -- .../json_extract_value_512b.circom | 5 -- .../json_mask_array_index_512b.circom | 5 -- .../target_512b/json_mask_object_512b.circom | 5 -- circuits.json | 51 +++++-------- package.json | 2 +- src/main.rs | 4 +- 14 files changed, 99 insertions(+), 72 deletions(-) create mode 100644 CHANGELOG.md delete mode 100644 builds/target_1024b/aes_gctr_nivc_1024b.circom rename builds/target_1024b/{http_nivc_1024b.circom => http_verification_1024b.circom} (100%) rename builds/target_1024b/{chacha20_nivc_1024.circom => plaintext_authentication_1024b.circom} (64%) delete mode 100644 builds/target_512b/aes_gctr_nivc_512b.circom delete mode 100644 builds/target_512b/chacha20_nivc_512b.circom delete mode 100644 builds/target_512b/http_nivc_512b.circom delete mode 100644 builds/target_512b/json_extract_value_512b.circom delete mode 100644 builds/target_512b/json_mask_array_index_512b.circom delete mode 100644 builds/target_512b/json_mask_object_512b.circom diff --git a/.gitignore b/.gitignore index eb8c40e..fef1713 100644 --- a/.gitignore +++ b/.gitignore @@ -17,4 +17,7 @@ ir_log/* log_input_signals.txt *.bin *.r1cs -builds/**/artifacts/ \ No newline at end of file +builds/**/artifacts/ + +# MacOS folks +**/.DS_Store \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..7ce1a66 --- /dev/null +++ b/CHANGELOG.md @@ -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` + diff --git a/builds/target_1024b/aes_gctr_nivc_1024b.circom b/builds/target_1024b/aes_gctr_nivc_1024b.circom deleted file mode 100644 index 24a2834..0000000 --- a/builds/target_1024b/aes_gctr_nivc_1024b.circom +++ /dev/null @@ -1,5 +0,0 @@ -pragma circom 2.1.9; - -include "../../circuits/aes-gcm/nivc/aes-gctr-nivc.circom"; - -component main { public [step_in] } = AESGCTRFOLD(1); \ No newline at end of file diff --git a/builds/target_1024b/http_nivc_1024b.circom b/builds/target_1024b/http_verification_1024b.circom similarity index 100% rename from builds/target_1024b/http_nivc_1024b.circom rename to builds/target_1024b/http_verification_1024b.circom diff --git a/builds/target_1024b/chacha20_nivc_1024.circom b/builds/target_1024b/plaintext_authentication_1024b.circom similarity index 64% rename from builds/target_1024b/chacha20_nivc_1024.circom rename to builds/target_1024b/plaintext_authentication_1024b.circom index ff4cf28..bebf1b4 100644 --- a/builds/target_1024b/chacha20_nivc_1024.circom +++ b/builds/target_1024b/plaintext_authentication_1024b.circom @@ -2,4 +2,5 @@ pragma circom 2.1.9; include "../../circuits/chacha20/nivc/chacha20_nivc.circom"; +// Note: this takes in 32 bits (4 bytes) per chunk, so 256 * 4 = 1024 bytes component main { public [step_in] } = ChaCha20_NIVC(256); \ No newline at end of file diff --git a/builds/target_512b/aes_gctr_nivc_512b.circom b/builds/target_512b/aes_gctr_nivc_512b.circom deleted file mode 100644 index 24a2834..0000000 --- a/builds/target_512b/aes_gctr_nivc_512b.circom +++ /dev/null @@ -1,5 +0,0 @@ -pragma circom 2.1.9; - -include "../../circuits/aes-gcm/nivc/aes-gctr-nivc.circom"; - -component main { public [step_in] } = AESGCTRFOLD(1); \ No newline at end of file diff --git a/builds/target_512b/chacha20_nivc_512b.circom b/builds/target_512b/chacha20_nivc_512b.circom deleted file mode 100644 index 23264ef..0000000 --- a/builds/target_512b/chacha20_nivc_512b.circom +++ /dev/null @@ -1,5 +0,0 @@ -pragma circom 2.1.9; - -include "../../circuits/chacha20/nivc/chacha20_nivc.circom"; - -component main { public [step_in] } = ChaCha20_NIVC(128); \ No newline at end of file diff --git a/builds/target_512b/http_nivc_512b.circom b/builds/target_512b/http_nivc_512b.circom deleted file mode 100644 index a202b7d..0000000 --- a/builds/target_512b/http_nivc_512b.circom +++ /dev/null @@ -1,5 +0,0 @@ -pragma circom 2.1.9; - -include "../../circuits/http/nivc/http_nivc.circom"; - -component main { public [step_in] } = HttpNIVC(512, 10); diff --git a/builds/target_512b/json_extract_value_512b.circom b/builds/target_512b/json_extract_value_512b.circom deleted file mode 100644 index e7ad1f8..0000000 --- a/builds/target_512b/json_extract_value_512b.circom +++ /dev/null @@ -1,5 +0,0 @@ -pragma circom 2.1.9; - -include "../../circuits/json/nivc/extractor.circom"; - -component main { public [step_in] } = MaskExtractFinal(512, 48); \ No newline at end of file diff --git a/builds/target_512b/json_mask_array_index_512b.circom b/builds/target_512b/json_mask_array_index_512b.circom deleted file mode 100644 index ec72dc7..0000000 --- a/builds/target_512b/json_mask_array_index_512b.circom +++ /dev/null @@ -1,5 +0,0 @@ -pragma circom 2.1.9; - -include "../../circuits/json/nivc/masker.circom"; - -component main { public [step_in] } = JsonMaskArrayIndexNIVC(512, 10); \ No newline at end of file diff --git a/builds/target_512b/json_mask_object_512b.circom b/builds/target_512b/json_mask_object_512b.circom deleted file mode 100644 index 3bd0e31..0000000 --- a/builds/target_512b/json_mask_object_512b.circom +++ /dev/null @@ -1,5 +0,0 @@ -pragma circom 2.1.9; - -include "../../circuits/json/nivc/masker.circom"; - -component main { public [step_in] } = JsonMaskObjectNIVC(512, 10, 10); diff --git a/circuits.json b/circuits.json index 97ce86e..29fe196 100644 --- a/circuits.json +++ b/circuits.json @@ -213,45 +213,22 @@ 16 ] }, - "nivc_aes": { - "file": "aes-gcm/nivc/aes-gctr-nivc", - "template": "AESGCTRFOLD" - }, - "http_nivc": { - "file": "http/nivc/http_nivc", - "template": "HttpNIVC", - "params": [ - 1024, - 10 - ] - }, - "nivc_start_line": { - "file": "http/nivc/parse_and_lock_start_line", - "template": "ParseAndLockStartLine", + "plaintext_authentication_1024b": { + "file": "chacha20/nivc/chacha20_nivc", + "template": "ChaCha20_NIVC", "params": [ - 1024, - 50, - 200, - 50 + 256 ] }, - "nivc_lock_header": { - "file": "http/nivc/lock_header", - "template": "LockHeader", + "http_verification_1024b": { + "file": "http/nivc/http_nivc", + "template": "HttpNIVC", "params": [ 1024, - 50, - 100 - ] - }, - "nivc_body_mask": { - "file": "http/nivc/body_mask", - "template": "HTTPMaskBodyNIVC", - "params": [ - 1024 + 25 ] }, - "nivc_json_object": { + "json_mask_object_1024b": { "file": "json/nivc/masker", "template": "JsonMaskObjectNIVC", "params": [ @@ -260,12 +237,20 @@ 10 ] }, - "nivc_json_array": { + "json_mask_array_index_1024b": { "file": "json/nivc/masker", "template": "JsonMaskArrayIndexNIVC", "params": [ 1024, 10 ] + }, + "json_extract_value_1024b": { + "file": "json/nivc/extractor", + "template": "MaskExtractFinal", + "params": [ + 1024, + 50 + ] } } \ No newline at end of file diff --git a/package.json b/package.json index a9d686c..051a8ee 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "web-prover-circuits", "description": "ZK Circuits for WebProofs", - "version": "0.5.9", + "version": "0.6.0", "license": "Apache-2.0", "repository": { "type": "git", diff --git a/src/main.rs b/src/main.rs index d9f5b66..b5ecf0e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,8 +9,8 @@ struct CircuitFiles { } const BASE_CIRCUIT_NAMES: &[&str] = &[ - "aes_gctr_nivc", - "http_nivc", + "plaintext_authentication", + "http_verification", "json_mask_object", "json_mask_array_index", "json_extract_value",