-
Notifications
You must be signed in to change notification settings - Fork 0
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
Repo reorg fix maturin develop #14
Merged
leolara
merged 12 commits into
qwang98:main
from
gnart33:trang/repo-reorg-fix-maturin-develop
Aug 15, 2023
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
f15e50f
first commit with python/chiquito layout
gnart33 548d6de
pyproject.toml
gnart33 cfda2ce
first tests passed
gnart33 5693ada
first tests did not pass without python dir, adding it
gnart33 90bb1ad
update pyproject.toml
gnart33 7799af3
should work now
gnart33 0e725f4
.github
gnart33 3cd243f
.github
gnart33 a555335
add submodules checkout for OS
gnart33 2d7d49a
delete if: "startsWith(github.ref, refs/tags/)" on CI
gnart33 f667282
delete if: "startsWith(github.ref, refs/tags/)" on CI
gnart33 65bb32d
maturin develop works, move all example to examples dir
gnart33 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so this makes rust_chiquito a sub module of package chiquito?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, an example using it here
In general,
chiquito.rust_chiquito
module has function listed hereThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, that makes much more sense structure wise