diff --git a/.gitignore b/.gitignore index 271728423..7eb824ff2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,11 @@ -.snfoundry_cache/ +**/.venv +**/__pycache__ # Generated by Cargo # will have compiled files and executables **/debug/ **/target/ +**/abi/ # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html @@ -13,13 +15,23 @@ **/*.rs.bk # MSVC Windows builds of rustc generate these, which store debugging information -*.pdb +**/*.pdb + +# Envs +**/.cargo/ # Scarb **/Scarb.lock -# vscode +# StarkNet Foundry +**/.snfoundry_cache/ + +# IDEs and editors **/.vscode/ +**/.idea/ + +# Logs +**/log/ # Resources -runner/resources/ +resources/ diff --git a/.tool-versions b/.tool-versions index 5c160e912..b100888da 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1 +1 @@ -scarb 2.4.1 +scarb 2.4.3 diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 000000000..6f83b579c --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,16 @@ +[workspace] +resolver = "2" +members = ["runner"] + +[workspace.package] +edition = "2021" +version = "0.1.0" + +[workspace.dependencies] +anyhow = "1" +cairo-args-runner = "1.0" +clap = { version = "4", features = ["derive"] } +lalrpop = "0.20" +lalrpop-util = { version = "0.20", features = ["lexer", "unicode"] } +serde = { version = "1", features = ["derive"] } +serde_json = "1" diff --git a/README.md b/README.md index d8dfcf789..f6ce37546 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ This document provides steps to build and run the Cairo Verifier. -## Building the Verifier +# Building the Verifier To build the latest version of the verifier and create a Sierra file, follow these steps: @@ -18,18 +18,45 @@ cd . scarb build ``` -## Running the Verifier +# Running the Verifier -After building the verifier, you can run it with the following steps: +## Getting the Parsed Proof -1. Navigate to the runner directory: +To obtain the parsed proof, follow these steps: -```bash -cd runner -``` +### 1. Download Source Code -2. Run the verifier: +- Access the source code at [Cairo1 Parser Repository](https://github.com/neotheprogramist/cairo-lang/tree/parser). -```bash -cargo run --release -- ../target/dev/cairo_verifier.sierra < resources/parserin.txt -``` +### 2. Install Dependencies + +- Execute the command: `pipenv install`. + +### 3. Activate Virtual Environment + +- Activate the virtual environment with: `pipenv shell`. + +### 4. Run the Parser + +- Use the parser by running: + ``` + python src/main.py -l starknet_with_keccak < src/starkware/cairo/stark_verifier/air/example_proof.json > out.txt + ``` + +### 5. Access Output File + +- The output will be available in the `out.txt` file. + +## Using the Parsed Proof + +Once you have the parsed proof, you can use it as follows: + +### 1. Copy Proof to Input File + +- Copy the entire content or a consistent section of `out.txt` to `./resources/in.txt`. + +### 3. Execute the Runner Script + +- Run: `cargo run --release -- ./target/dev/cairo_verifier.sierra.json < ./resources/in.txt` + +- Or run the script using: `./run.sh`. diff --git a/Scarb.lock b/Scarb.lock deleted file mode 100644 index 0743bc011..000000000 --- a/Scarb.lock +++ /dev/null @@ -1,6 +0,0 @@ -# Code generated by scarb DO NOT EDIT. -version = 1 - -[[package]] -name = "cairo_verifier" -version = "0.1.0" diff --git a/run.sh b/run.sh index 5cd5a1925..8beaea595 100755 --- a/run.sh +++ b/run.sh @@ -1,5 +1,3 @@ #!/usr/bin/env bash -scarb build && \ -cd runner && \ -cargo run --release -- ../target/dev/cairo_verifier.sierra.json < resources/parserin.txt +cargo run --release -- ./target/dev/cairo_verifier.sierra.json < ./resources/in.txt diff --git a/runner/Cargo.toml b/runner/Cargo.toml index 80145e467..6c2f87a7a 100644 --- a/runner/Cargo.toml +++ b/runner/Cargo.toml @@ -1,17 +1,17 @@ [package] name = "runner" -version = "0.1.0" -edition = "2021" +version.workspace = true +edition.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -anyhow = "1.0.76" -cairo-args-runner = "1.0.0" -clap = { version = "4.4.11", features = ["derive"] } -lalrpop-util = { version = "0.20.0", features = ["lexer", "unicode"] } -serde = { version = "1.0.193", features = ["derive"] } -serde_json = "1.0.108" +anyhow.workspace = true +cairo-args-runner.workspace = true +clap.workspace = true +lalrpop-util.workspace = true +serde.workspace = true +serde_json.workspace = true [build-dependencies] -lalrpop = "0.20.0" +lalrpop.workspace = true diff --git a/runner/README.md b/runner/README.md deleted file mode 100644 index 4140cee06..000000000 --- a/runner/README.md +++ /dev/null @@ -1,48 +0,0 @@ -# Cairo1 Verifier - -## Overview - -The Cairo1 Verifier is a tool designed for parsing and utilizing proofs in the Cairo language. This document provides instructions on how to get and use the parsed proof. - -## Getting the Parsed Proof - -To obtain the parsed proof, follow these steps: - -### 1. Download Source Code - -- Access the source code at [Cairo1 Parser Repository](https://github.com/neotheprogramist/cairo-lang/tree/parser). - -### 2. Install Dependencies - -- Execute the command: `pipenv install`. - -### 3. Activate Virtual Environment - -- Activate the virtual environment with: `pipenv shell`. - -### 4. Run the Parser - -- Use the parser by running: - ``` - python src/main.py -l starknet_with_keccak < src/starkware/cairo/stark_verifier/air/example_proof.json > parseout.txt - ``` - -### 5. Access Output File - -- The output will be available in the `parseout.txt` file. - -## Using the Parsed Proof - -Once you have the parsed proof, you can use it as follows: - -### 1. Copy Proof to Input File - -- Copy the entire content or a consistent section of `parseout.txt` to `runner/resources/parsein.txt`. - -### 2. Adjust Input Structures - -- Modify the structures in `src/input_structs` to match the copied content. - -### 3. Execute the Runner Script - -- Run the script using: `./run.sh`.