-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from trangnv/trang/repo-reorg-fix-maturin-develop
Repo reorg fix maturin develop
- Loading branch information
Showing
20 changed files
with
145 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,44 @@ | ||
# Quick Start | ||
|
||
## Setup | ||
|
||
PyChiquito uses PyO3 and Maturin to expose Rust APIs to Python. Maturin requires the user to locally build a Python virtual environment. | ||
Run the following script to create a Python virtual environment, install required packages, and build the project. | ||
``` | ||
|
||
```bash | ||
# clone this repo and its submodules | ||
git clone --recursive https://github.com/qwang98/PyChiquito | ||
|
||
# Create a virtual environment | ||
python3 -m venv .env | ||
|
||
# Activate the virtual environment | ||
source .env/bin/activate | ||
|
||
# Install the required packages | ||
pip install maturin | ||
pip install py_ecc | ||
pip install -r requirements.txt | ||
|
||
# Build the project | ||
maturin develop | ||
``` | ||
|
||
If the above doesn't work, follow the guide here: https://pyo3.rs/main/getting_started#python | ||
|
||
## Testing with examples | ||
|
||
Run fibonacci.py example file using the following script: | ||
|
||
``` | ||
python3 pychiquito/fibonacci.py | ||
python3 examples/fibonacci.py | ||
``` | ||
|
||
If setup is correct, you should see a print out of the parsed Rust AST circuit and TraceWitness. All Halo2 and Chiquito Debug messages for generating and verifying proof should also appear in the terminal. | ||
|
||
# Technical Design | ||
|
||
Python front end -> Python AST object/TraceWitness -> serialize to JSON string -> pass JSON string to Rust using PyO3 -> deserialize JSON string to Chiquito AST/TraceWitness -> store AST in Rust HashMap<UUID, AST> -> pass back UUID to Python -> generate and verify proof from Python with AST UUID and TraceWitness JSON | ||
|
||
## Notes: | ||
|
||
- Rust bindings to expose to Python are in lib.rs | ||
- Boilerplate functions and `Deserialize` trait implementations for Rust Chiquito AST, TraceWitness, and their sub types are in frontend.rs of Rust Chiquito: https://github.com/privacy-scaling-explorations/chiquito |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from __future__ import annotations | ||
from typing import Tuple | ||
|
||
from chiquito.dsl import Circuit, StepType | ||
from chiquito.cb import eq | ||
from chiquito.query import Queriable | ||
from chiquito.util import F | ||
import chiquito | ||
# from chiquito import chiquito | ||
|
||
|
||
# def main(): | ||
print("Hello, world!") | ||
# print(Circuit) | ||
# print(StepType) | ||
# print(eq) | ||
# print(Queriable) | ||
# print(chiquito.__all__) | ||
print(dir(chiquito)) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
appnope==0.1.3 | ||
asttokens==2.2.1 | ||
backcall==0.2.0 | ||
cached-property==1.5.2 | ||
comm==0.1.4 | ||
cytoolz==0.12.2 | ||
debugpy==1.6.7.post1 | ||
decorator==5.1.1 | ||
eth-hash==0.5.2 | ||
eth-typing==3.4.0 | ||
eth-utils==2.2.0 | ||
executing==1.2.0 | ||
ipykernel==6.25.1 | ||
ipython==8.14.0 | ||
jedi==0.19.0 | ||
jupyter_client==8.3.0 | ||
jupyter_core==5.3.1 | ||
matplotlib-inline==0.1.6 | ||
maturin==1.2.0 | ||
mypy-extensions==1.0.0 | ||
nest-asyncio==1.5.7 | ||
packaging==23.1 | ||
parso==0.8.3 | ||
pexpect==4.8.0 | ||
pickleshare==0.7.5 | ||
platformdirs==3.10.0 | ||
prompt-toolkit==3.0.39 | ||
psutil==5.9.5 | ||
ptyprocess==0.7.0 | ||
pure-eval==0.2.2 | ||
py-ecc==6.0.0 | ||
Pygments==2.16.1 | ||
python-dateutil==2.8.2 | ||
pyzmq==25.1.1 | ||
six==1.16.0 | ||
stack-data==0.6.2 | ||
toolz==0.12.0 | ||
tornado==6.3.2 | ||
traitlets==5.9.0 | ||
wcwidth==0.2.6 |