Skip to content

Commit cb7ec06

Browse files
authored
feat: HTTP parser + constraint counter (#1)
* feat: working http parser * feat: constraint counter * reduce brillig calls * clean up constraint counter * save state * counting constraints finally maybe * save point * LFG * cleanup * cleaning * remove vec * remove utils * cleanup * cleanup rust bin * Create check.yaml * Update lib.nr * speed up taplo * Update Cargo.toml
1 parent ca06b1f commit cb7ec06

File tree

15 files changed

+2045
-38
lines changed

15 files changed

+2045
-38
lines changed

.github/workflows/check.yaml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Check
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
test:
11+
name: test
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout sources
15+
uses: actions/checkout@v4
16+
17+
- name: Install Nargo
18+
uses: noir-lang/noirup@v0.1.3
19+
with:
20+
toolchain: v0.36.0
21+
22+
- name: Run Noir tests
23+
run: nargo test
24+
25+
noir-fmt:
26+
name: noir-fmt
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Checkout sources
30+
uses: actions/checkout@v4
31+
32+
- name: Install Nargo
33+
uses: noir-lang/noirup@v0.1.3
34+
with:
35+
toolchain: v0.36.0
36+
37+
- name: Check Noir formatting
38+
run: nargo fmt --check
39+
40+
toml-fmt:
41+
name: toml-fmt
42+
runs-on: ubuntu-latest
43+
steps:
44+
- name: Checkout sources
45+
uses: actions/checkout@v4
46+
47+
- name: Install cargo-binstall
48+
uses: cargo-bins/cargo-binstall@main
49+
50+
- name: Install Taplo
51+
run: cargo binstall --no-confirm taplo-cli
52+
53+
- name: Check TOML formatting
54+
run: taplo fmt --check

.taplo.toml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# .toml file formatting settings for `taplo`
2+
# https://taplo.tamasfe.dev/configuration/formatter-options.html
3+
4+
[formatting]
5+
# align entries vertically
6+
align_entries = true
7+
# allow up to 1 consecutive empty line (default: 2)
8+
allowed_blank_line = 1
9+
# collapse arrays into one line if they fit
10+
array_auto_collapse = true
11+
# alphabetically sort entries not separated by line breaks
12+
reorder_keys = true

Nargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[workspace]
2+
members = ["http", "bin"]

README.md

+34-27
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,70 @@
1-
![Pluto Logo](assets/Pluto%20Logo_White.svg)
1+
<p align="center">
2+
<img src="https://raw.githubusercontent.com/pluto/.github/main/profile/assets/assets_ios_Pluto-1024%401x.png" alt="Pluto Logo" width="50" height="50">
3+
<span style="font-size: 28px; vertical-align: 10px; margin: 0 10px;">❤️</span>
4+
<img src="https://raw.githubusercontent.com/noir-lang/noir/a1cf830b3cdf17a9265b8bdbf366d65c253f0ca4/noir-logo.png" alt="The Noir Programming Language" width="50">
5+
</p>
26

37
---
48

5-
# Project Name
9+
# Noir Web Prover Circuits
610

7-
Brief description of what this project does and its core value proposition.
11+
A collection of zero-knowledge circuits written in Noir for creating Web Proofs. These circuits enable secure authentication, HTTP request verification, and JSON data extraction in zero-knowledge applications.
812

913
## Features
1014

11-
- Key feature one with a brief explanation
12-
- Key feature two with a brief explanation
13-
- ...
15+
- **Encryption/Plaintext Authentication Circuit**: Verify encrypted data and authenticate plaintext without revealing sensitive information
16+
- **HTTP Parser and Header Locker**: Parse and lock HTTP headers in zero-knowledge proofs, ensuring request integrity
17+
- **JSON Parser/Extractor**: Extract and verify specific fields from JSON data within zero-knowledge proofs
18+
- **Constraint Counter**: Utility to analyze R1CS constraint counts for circuit optimization
1419

1520
## Getting Started
1621

17-
These instructions will help you get a copy of the project up and running on your local machine.
22+
These instructions will help you get the circuits up and running on your local machine.
1823

1924
### Prerequisites
2025

21-
What things you need to install and how to install them:
26+
You'll need to have Rust and Cargo installed on your system. Then, install the `just` command runner:
2227

2328
```bash
24-
npm install
25-
# or ...
29+
cargo install just
2630
```
2731

2832
### Installation
2933

3034
1. Clone the repository
3135
```bash
32-
git clone https://github.com/username/project.git
36+
git clone https://github.com/pluto/noir-web-prover-circuits.git
37+
cd noir-web-prover-circuits
3338
```
3439

35-
2. Install dependencies
40+
2. Set up the development environment
3641
```bash
37-
cd project
38-
npm install # or equivalent for your project
42+
# This will install Noirup, Nargo, and required tools
43+
just setup
3944
```
4045

41-
3. Configure environment variables
46+
3. Build the workspace
4247
```bash
43-
cp .env.example .env
44-
# Edit .env with your values
48+
just build
4549
```
4650

47-
4. ...
51+
### Available Commands
52+
53+
- `just`: List all available commands
54+
- `just setup`: Set up complete development environment
55+
- `just build`: Build the entire Nargo workspace
56+
- `just test`: Run all tests
57+
- `just fmt`: Format code (Noir and TOML)
58+
- `just ci`: Run all CI checks
4859

4960
## Usage
5061

51-
Show basic examples of how to use your project:
62+
### Using the Constraint Counter
5263

53-
```python
54-
# If it's a Python project
55-
from project import Example
64+
After running `just setup` you will also get access to the `constraint_counter` utility helps analyze the R1CS constraints in your circuits:
5665

57-
example = Example()
58-
result = example.do_something()
66+
```bash
67+
constraint_counter --circuit <circuit_name> --public-io-length <#_of_pub_inputs> --private-input-length <#_of_priv_inputs>
5968
```
6069

6170
## Contributing
@@ -72,6 +81,4 @@ This project is licensed under the Apache V2 License - see the [LICENSE](LICENSE
7281

7382
## Acknowledgments
7483

75-
- List any contributors
76-
- Reference any inspiration, code snippets, etc.
77-
- Link to relevant blog posts or documentation
84+
- The [Noir Programming Language](https://noir-lang.org/) team for their ZK circuit development framework

assets/Pluto Logo_White.svg

-11
This file was deleted.

bin/Nargo.toml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[package]
2+
authors = ["Colin Roberts"]
3+
compiler_version = ">=0.36.0"
4+
name = "bin"
5+
type = "bin"
6+
version = "0.1.0"
7+
8+
[dependencies]
9+
http = { path = "../http" }

bin/src/main.nr

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
use http::parse;
2+
3+
pub fn main(item: pub [Field; 1], data: str<1024>) -> pub Field {
4+
parse(data);
5+
item[0]
6+
}
7+

0 commit comments

Comments
 (0)