Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: HTTP parser + constraint counter #1

Merged
merged 18 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Check

on:
push:
branches:
- main
pull_request:

jobs:
test:
name: test
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Install Nargo
uses: noir-lang/noirup@v0.1.3
with:
toolchain: v0.36.0

- name: Run Noir tests
run: nargo test

noir-fmt:
name: noir-fmt
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Install Nargo
uses: noir-lang/noirup@v0.1.3
with:
toolchain: v0.36.0

- name: Check Noir formatting
run: nargo fmt --check

toml-fmt:
name: toml-fmt
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Install cargo-binstall
uses: cargo-bins/cargo-binstall@main

- name: Install Taplo
run: cargo binstall --no-confirm taplo-cli

- name: Check TOML formatting
run: taplo fmt --check
12 changes: 12 additions & 0 deletions .taplo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# .toml file formatting settings for `taplo`
# https://taplo.tamasfe.dev/configuration/formatter-options.html

[formatting]
# align entries vertically
align_entries = true
# allow up to 1 consecutive empty line (default: 2)
allowed_blank_line = 1
# collapse arrays into one line if they fit
array_auto_collapse = true
# alphabetically sort entries not separated by line breaks
reorder_keys = true
2 changes: 2 additions & 0 deletions Nargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[workspace]
members = ["http", "bin"]
61 changes: 34 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,61 +1,70 @@
![Pluto Logo](assets/Pluto%20Logo_White.svg)
<p align="center">
<img src="https://raw.githubusercontent.com/pluto/.github/main/profile/assets/assets_ios_Pluto-1024%401x.png" alt="Pluto Logo" width="50" height="50">
<span style="font-size: 28px; vertical-align: 10px; margin: 0 10px;">❤️</span>
<img src="https://raw.githubusercontent.com/noir-lang/noir/a1cf830b3cdf17a9265b8bdbf366d65c253f0ca4/noir-logo.png" alt="The Noir Programming Language" width="50">
</p>

---

# Project Name
# Noir Web Prover Circuits

Brief description of what this project does and its core value proposition.
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.

## Features

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

## Getting Started

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

### Prerequisites

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

```bash
npm install
# or ...
cargo install just
```

### Installation

1. Clone the repository
```bash
git clone https://github.com/username/project.git
git clone https://github.com/pluto/noir-web-prover-circuits.git
cd noir-web-prover-circuits
```

2. Install dependencies
2. Set up the development environment
```bash
cd project
npm install # or equivalent for your project
# This will install Noirup, Nargo, and required tools
just setup
```

3. Configure environment variables
3. Build the workspace
```bash
cp .env.example .env
# Edit .env with your values
just build
```

4. ...
### Available Commands

- `just`: List all available commands
- `just setup`: Set up complete development environment
- `just build`: Build the entire Nargo workspace
- `just test`: Run all tests
- `just fmt`: Format code (Noir and TOML)
- `just ci`: Run all CI checks

## Usage

Show basic examples of how to use your project:
### Using the Constraint Counter

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

example = Example()
result = example.do_something()
```bash
constraint_counter --circuit <circuit_name> --public-io-length <#_of_pub_inputs> --private-input-length <#_of_priv_inputs>
```

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

## Acknowledgments

- List any contributors
- Reference any inspiration, code snippets, etc.
- Link to relevant blog posts or documentation
- The [Noir Programming Language](https://noir-lang.org/) team for their ZK circuit development framework
11 changes: 0 additions & 11 deletions assets/Pluto Logo_White.svg

This file was deleted.

9 changes: 9 additions & 0 deletions bin/Nargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
authors = ["Colin Roberts"]
compiler_version = ">=0.36.0"
name = "bin"
type = "bin"
version = "0.1.0"

[dependencies]
http = { path = "../http" }
7 changes: 7 additions & 0 deletions bin/src/main.nr
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
use http::parse;

pub fn main(item: pub [Field; 1], data: str<1024>) -> pub Field {
parse(data);
item[0]
}

Loading
Loading