From 60eeb8ff04d44110842709296017ace389ff984c Mon Sep 17 00:00:00 2001 From: Leo Lara Date: Wed, 13 Sep 2023 08:03:42 +0000 Subject: [PATCH 1/4] Fix pypi publish --- .github/workflows/pypi_publish.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/pypi_publish.yml b/.github/workflows/pypi_publish.yml index d1e93793..feff6735 100644 --- a/.github/workflows/pypi_publish.yml +++ b/.github/workflows/pypi_publish.yml @@ -7,8 +7,6 @@ on: - master tags: - "v*" - pull_request: - workflow_dispatch: permissions: contents: read From 2c7371a134f7ed93dca51c63ba4e41f4e2e1981c Mon Sep 17 00:00:00 2001 From: indextree <142781545+indextree@users.noreply.github.com> Date: Wed, 13 Sep 2023 17:06:26 +0900 Subject: [PATCH 2/4] Fix typo (#122) Fixed simple typo: circuit Co-authored-by: Leo Lara --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 83d7ca47..70504318 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ In research: + Signal typing system, which allows statically checking for soundness issues. + Folding backend with ProtoStar, HyperNova, and/or others. -## Fibonnaci circtuit in Chiquito's Python frontend. +## Fibonnaci circuit in Chiquito's Python frontend. But better see for yourself: From f8a96dbb4f535759f77d0b4142cbccbe14e362e1 Mon Sep 17 00:00:00 2001 From: YoungWan Kwon <87213416+000wan@users.noreply.github.com> Date: Wed, 13 Sep 2023 17:06:43 +0900 Subject: [PATCH 3/4] Assign languages to all code blocks (#123) Good to see such a cool project. I've specified languages to all code blocks in tutorials and readme, which enables syntax highlighting. Co-authored-by: Leo Lara --- README.md | 2 +- src/frontend/python/README.md | 6 +++--- tutorials/tutorial_pt2.ipynb | 6 +++--- tutorials/tutorial_pt3_ch2.ipynb | 10 +++++----- tutorials/tutorial_pt3_ch4.ipynb | 6 +++--- tutorials/tutorial_pt3_ch5.ipynb | 8 ++++---- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 70504318..6fcd3653 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ In research: But better see for yourself: -``` +```python class FiboStep(StepType): def setup(self: FiboStep): self.c = self.internal("c") diff --git a/src/frontend/python/README.md b/src/frontend/python/README.md index adf6b24d..caa4fe15 100644 --- a/src/frontend/python/README.md +++ b/src/frontend/python/README.md @@ -2,7 +2,7 @@ ## Setup Chiquito's Python frontend 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 git clone https://github.com/privacy-scaling-explorations/chiquito/ # Navigate to the repository root directory @@ -22,13 +22,13 @@ If the above doesn't work, follow the guide here: https://pyo3.rs/main/getting_s ## Testing with examples Run fibonacci.py example file using the following script in the virtual environment: -``` +```bash python3 example/fibonacci.py ``` Run mimc7.py example: -``` +```bash python example/mimc7.py ``` diff --git a/tutorials/tutorial_pt2.ipynb b/tutorials/tutorial_pt2.ipynb index 3b8323c4..da969fe7 100644 --- a/tutorials/tutorial_pt2.ipynb +++ b/tutorials/tutorial_pt2.ipynb @@ -10,7 +10,7 @@ "Chiquito's Python frontend requires using a Python virtual environment for its dependencies, which you should have setup following the [Python README](https://github.com/privacy-scaling-explorations/chiquito/tree/main/src/frontend/python/README.md).\n", "\n", "Specifically, after cloning Chiquito, you need to run the following commands in your local machine (NOT in Jupyter):\n", - "```\n", + "```bash\n", "python3 -m venv .env # create virtual environment\n", "source .env/bin/activate # activate virtual environment\n", "pip install -r requirements.txt # install required python dependencies from requirements.txt\n", @@ -18,12 +18,12 @@ "```\n", "\n", "Then install your local Python virtual environment as a Jupyter Lab Kernel called `chiquito_kernel`. \n", - "```\n", + "```bash\n", "python -m ipykernel install --user --name=chiquito_kernel\n", "```\n", "\n", "After that, run the following: \n", - "```\n", + "```bash\n", "cd tutorials # navigate to the tutorials subfolder\n", "jupyter lab # launch jupyter notebook in browser\n", "```\n", diff --git a/tutorials/tutorial_pt3_ch2.ipynb b/tutorials/tutorial_pt3_ch2.ipynb index 1783ae8d..cefb3443 100644 --- a/tutorials/tutorial_pt3_ch2.ipynb +++ b/tutorials/tutorial_pt3_ch2.ipynb @@ -61,7 +61,7 @@ "\n", "## FiboStep Setup\n", "We now define the only step type, `FiboStep`:\n", - "```\n", + "```python\n", "class FiboStep(StepType):\n", " def setup(self):\n", " self.c = self.internal(\"c\")\n", @@ -81,7 +81,7 @@ "In the code snippet above, forward signals \"a\" and \"b\" are expressed as `self.circuit.a` and `self.circuit.b`, whereas internal signal \"c\" is expressed as `self.c`, because \"a\" and \"b\" are at the circuit-level. `self.circuit.a.next()` queries the value of circuit-level signal \"a\" at the next step instance. `eq` is a constraint builder that enforces equality between the two arguments passed in. It builds the three constraints of `FiboStep`: `a + b == c`, `b == a.next`, and `c == b.next`.\n", "\n", "## FiboStep Witness Generation\n", - "```\n", + "```python\n", "class FiboStep(StepType):\n", " def setup(self):\n", " # ...\n", @@ -97,7 +97,7 @@ "Note that in `self.assign`, `a_value` and `b_value` are both wrapped in `F`, which converts them from int to field elements. All witness assignments in PyChiquito are field elements.\n", "\n", "Putting everything for `FiboStep` together, we have:\n", - "```\n", + "```python\n", "class FiboStep(StepType):\n", " def setup(self):\n", " self.c = self.internal(\"c\")\n", @@ -119,7 +119,7 @@ "\n", "## Circuit Setup\n", "We first define the circuit `setup`:\n", - "```\n", + "```python\n", "class Fibonacci(Circuit):\n", " def setup(self):\n", " self.a = self.forward(\"a\")\n", @@ -139,7 +139,7 @@ "\n", "## Circuit Trace\n", "Now we instantiate step types and assign witness values using `trace`:\n", - "```\n", + "```python\n", "class Fibonacci(Circuit):\n", " def setup(self):\n", " # ...\n", diff --git a/tutorials/tutorial_pt3_ch4.ipynb b/tutorials/tutorial_pt3_ch4.ipynb index d22c5875..14996ecb 100644 --- a/tutorials/tutorial_pt3_ch4.ipynb +++ b/tutorials/tutorial_pt3_ch4.ipynb @@ -27,7 +27,7 @@ "\n", "The following shows the incremental code of `FiboFirstStep` compared to `FiboStep`:\n", "\n", - "```\n", + "```python\n", "class FiboFirstStep(StepType):\n", " def setup(self):\n", " # ...\n", @@ -40,7 +40,7 @@ "\n", "Next, in circuit `setup`, we need to append this step type and constrain that the first step instance is `FiboFirstStep`. Otherwise `setup` is identical to that in Chapter 3:\n", "\n", - "```\n", + "```python\n", "class Fibonacci(Circuit):\n", " def setup(self):\n", " # ...\n", @@ -53,7 +53,7 @@ "\n", "Finally, in circuit `trace`, we need to instantiate `FiboFirstStep` for the first step instance. Otherwise `trace` is identical to that in Chapter 3:\n", "\n", - "```\n", + "```python\n", "class Fibonacci(Circuit):\n", " def setup(self):\n", " # ...\n", diff --git a/tutorials/tutorial_pt3_ch5.ipynb b/tutorials/tutorial_pt3_ch5.ipynb index e20a0939..e01f227e 100644 --- a/tutorials/tutorial_pt3_ch5.ipynb +++ b/tutorials/tutorial_pt3_ch5.ipynb @@ -73,7 +73,7 @@ "\n", "First, let's add the padding step type: \n", "\n", - "```\n", + "```python\n", "class Padding(StepType):\n", " def setup(self):\n", " self.transition(eq(self.circuit.b, self.circuit.b.next()))\n", @@ -96,7 +96,7 @@ "\n", "Second, let's modify all existing step types to account for the new signal `n`, basically adding a new constraint `n == n.next` in `setup` and assigning `n_value` in `wg`:\n", "\n", - "```\n", + "```python\n", "class FiboFirstStep(StepType):\n", " def setup(self):\n", " # ...\n", @@ -120,7 +120,7 @@ "\n", "Third, let's modify the circuit `setup`:\n", "\n", - "```\n", + "```python\n", "class Fibonacci(Circuit):\n", " def setup(self):\n", " self.a = self.forward(\"a\")\n", @@ -153,7 +153,7 @@ "- `FiboStep` for the 2nd through n-th step instance\n", "- `Padding` for the rest step instances such that there are 10 step instances in total, as specified by `self.pragma_num_steps(10)`\n", "\n", - "```\n", + "```python\n", "class Fibonacci(Circuit):\n", " def setup(self):\n", " # ...\n", From 4b20bf3c22119cc6c1c4ebdc28e9d33519ee3758 Mon Sep 17 00:00:00 2001 From: Jaewon In Date: Thu, 14 Sep 2023 09:40:25 +0900 Subject: [PATCH 4/4] Move use chiquito::dsl::cb::* to circuit lambda (#124) Hi maintainers, I'm student from PSE Summer Contribution program. I just followed the mentioned part in #22 . Comments would help me a lot :) Thanks! --------- Co-authored-by: Leo Lara --- examples/fibonacci.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/examples/fibonacci.rs b/examples/fibonacci.rs index 1a161831..4fc08fc3 100644 --- a/examples/fibonacci.rs +++ b/examples/fibonacci.rs @@ -2,17 +2,14 @@ use std::hash::Hash; use chiquito::{ ast::expr::*, - frontend::dsl::{ - cb::*, // functions for constraint building - circuit, // main function for constructing an AST circuit - }, + frontend::dsl::circuit, // main function for constructing an AST circuit plonkish::backend::halo2::{chiquito2Halo2, ChiquitoHalo2Circuit}, /* compiles to - * Chiquito Halo2 - * backend, - * which can be - * integrated into - * Halo2 - * circuit */ + * Chiquito Halo2 + * backend, + * which can be + * integrated into + * Halo2 + * circuit */ plonkish::compiler::{ cell_manager::SingleRowCellManager, // input for constructing the compiler compile, // input for constructing the compiler @@ -36,6 +33,9 @@ fn fibo_circuit + Hash>() -> (Circuit, Option("fibonacci", |ctx| { // the following objects (forward signals, steptypes) are defined on the circuit-level @@ -151,7 +151,7 @@ fn main() { let result_plaf = prover_plaf.verify_par(); - println!("result = {:#?}", result); + println!("result = {:#?}", result_plaf); if let Err(failures) = &result_plaf { for failure in failures.iter() {