From 71ad42539cc19edceb347bab8636111d2b3a85da Mon Sep 17 00:00:00 2001 From: BartolomeoDiaz Date: Sun, 21 Jul 2024 18:57:55 +0200 Subject: [PATCH] Revert "swiftness" --- .github/workflows/ci.yml | 2 +- .github/workflows/npm_publish.yaml | 58 ---- .gitignore | 3 +- Cargo.lock | 266 +++++++++--------- Cargo.toml | 20 +- README.md | 15 +- cli/Cargo.toml | 13 +- cli/src/lib.rs | 2 - cli/src/main.rs | 15 +- crates/air/Cargo.toml | 11 +- crates/air/README.md | 1 - crates/air/src/fixtures/commitment.rs | 2 +- crates/air/src/fixtures/config.rs | 2 +- crates/air/src/fixtures/decommitment.rs | 2 +- crates/air/src/fixtures/witness.rs | 2 +- crates/air/src/layout/dex/global_values.rs | 2 +- crates/air/src/layout/dex/mod.rs | 4 +- crates/air/src/layout/mod.rs | 2 +- .../air/src/layout/recursive/global_values.rs | 2 +- crates/air/src/layout/recursive/mod.rs | 4 +- .../recursive_with_poseidon/global_values.rs | 2 +- .../src/layout/recursive_with_poseidon/mod.rs | 4 +- crates/air/src/layout/small/global_values.rs | 2 +- crates/air/src/layout/small/mod.rs | 4 +- .../air/src/layout/starknet/global_values.rs | 2 +- crates/air/src/layout/starknet/mod.rs | 4 +- .../starknet_with_keccak/global_values.rs | 2 +- .../src/layout/starknet_with_keccak/mod.rs | 4 +- crates/air/src/trace/config.rs | 6 +- crates/air/src/trace/decommit.rs | 2 +- crates/air/src/trace/mod.rs | 12 +- crates/commitment/Cargo.toml | 9 +- crates/commitment/README.md | 1 - crates/commitment/src/table/commit.rs | 2 +- .../table/tests/table_commitment_commit.rs | 2 +- crates/commitment/src/vector/commit.rs | 2 +- .../vector/tests/vector_commitment_commit.rs | 2 +- crates/fri/Cargo.toml | 13 +- crates/fri/README.md | 1 - crates/fri/src/config.rs | 4 +- crates/fri/src/fixtures/commitment.rs | 4 +- crates/fri/src/fixtures/config.rs | 2 +- crates/fri/src/fixtures/witness.rs | 4 +- crates/fri/src/fri.rs | 6 +- crates/fri/src/tests/commit.rs | 2 +- crates/fri/src/types.rs | 4 +- crates/pow/Cargo.toml | 9 +- crates/pow/README.md | 1 - crates/pow/src/pow.rs | 2 +- crates/stark/Cargo.toml | 17 +- crates/stark/README.md | 1 - crates/stark/src/commit.rs | 28 +- crates/stark/src/config.rs | 16 +- crates/stark/src/fixtures/commitment.rs | 10 +- crates/stark/src/fixtures/config.rs | 10 +- crates/stark/src/fixtures/domains.rs | 2 +- .../stark/src/fixtures/unsent_commitment.rs | 6 +- crates/stark/src/fixtures/witness.rs | 10 +- crates/stark/src/oods.rs | 18 +- crates/stark/src/queries.rs | 4 +- crates/stark/src/stark.rs | 20 +- crates/stark/src/tests/commit.rs | 4 +- crates/stark/src/tests/proof.rs | 2 +- crates/stark/src/tests/verify.rs | 4 +- crates/stark/src/types.rs | 24 +- crates/stark/src/verify.rs | 12 +- crates/transcript/Cargo.toml | 7 +- crates/transcript/README.md | 1 - Dockerfile => dockerfile | 0 proof-parser/Cargo.toml | 17 +- proof-parser/README.md | 1 - proof-parser/src/conversion.rs | 10 +- proof-parser/src/lib.rs | 2 +- wasm-binding/Cargo.toml | 17 +- wasm-binding/README.md | 25 +- wasm-binding/pkg/README.md | 24 ++ wasm-binding/pkg/package.json | 23 ++ wasm-binding/src/lib.rs | 21 +- 78 files changed, 429 insertions(+), 449 deletions(-) delete mode 100644 .github/workflows/npm_publish.yaml delete mode 100644 cli/src/lib.rs delete mode 100644 crates/air/README.md delete mode 100644 crates/commitment/README.md delete mode 100644 crates/fri/README.md delete mode 100644 crates/pow/README.md delete mode 100644 crates/stark/README.md delete mode 100644 crates/transcript/README.md rename Dockerfile => dockerfile (100%) delete mode 100644 proof-parser/README.md create mode 100644 wasm-binding/pkg/README.md create mode 100644 wasm-binding/pkg/package.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 73d6fef..2b4279f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -70,4 +70,4 @@ jobs: ${{ runner.os }}-cargo-build- - name: Run verification - run: cargo run --release --bin swiftness --features ${{ matrix.layout }},keccak --no-default-features -- --proof examples/proofs/${{ matrix.layout }}/cairo0_example_proof.json \ No newline at end of file + run: cargo run --release --bin cairovm_verifier_cli --features ${{ matrix.layout }},keccak --no-default-features -- --proof examples/proofs/${{ matrix.layout }}/cairo0_example_proof.json \ No newline at end of file diff --git a/.github/workflows/npm_publish.yaml b/.github/workflows/npm_publish.yaml deleted file mode 100644 index 861ebd8..0000000 --- a/.github/workflows/npm_publish.yaml +++ /dev/null @@ -1,58 +0,0 @@ -name: Manual Publish to npm - -on: - workflow_dispatch: - inputs: - npm_version: - description: 'Version to publish' - required: true - default: 'patch' # could be 'patch', 'minor', 'major', or a specific version - -jobs: - publish: - runs-on: ubuntu-latest - - env: - WORKING_DIR: wasm-binding # define the working directory here - - strategy: - fail-fast: false - matrix: - layout: ["starknet_with_keccak"] - hash: ["blake2s"] - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: '18' # specify your desired Node.js version - - - name: Install dependencies - run: npm install - working-directory: ${{ env.WORKING_DIR }} - - - name: Update version - run: npm version ${{ github.event.inputs.npm_version }} --no-git-tag-version - working-directory: ${{ env.WORKING_DIR }} - - - name: Configure npm - run: npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }} - working-directory: ${{ env.WORKING_DIR }} - - - name: Install wasm-pack - run: cargo install wasm-pack - - - name: Build package - run: wasm-pack build --target web --workspace --features ${{ matrix.layout }},${{ matrix.hash }} --no-default-features --out-dir pkg - working-directory: ${{ env.WORKING_DIR }} - - - name: Rename package - run: jq '.name = "swiftness-${{ matrix.layout }}-${{ matrix.hash }}"' package.json > tmp.json && mv tmp.json package.json - working-directory: ${{ env.WORKING_DIR }}/pkg - - - name: Publish to npm - run: npm publish --dry-run - working-directory: ${{ env.WORKING_DIR }}/pkg diff --git a/.gitignore b/.gitignore index 0b27d31..b630a4c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ # will have compiled files and executables debug/ target/ -pkg/ # 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 @@ -12,4 +11,4 @@ pkg/ **/*.rs.bk # MSVC Windows builds of rustc generate these, which store debugging information -*.pdb \ No newline at end of file +*.pdb diff --git a/Cargo.lock b/Cargo.lock index 2386991..fc17d1a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -135,11 +135,138 @@ version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" +[[package]] +name = "cairovm_verifier_air" +version = "0.0.3" +dependencies = [ + "bail-out", + "cairovm_verifier_commitment", + "cairovm_verifier_transcript", + "serde", + "serde_with", + "starknet-core", + "starknet-crypto", + "thiserror", +] + +[[package]] +name = "cairovm_verifier_cli" +version = "0.0.3" +dependencies = [ + "cairovm_verifier_air", + "cairovm_verifier_proof_parser", + "cairovm_verifier_stark", + "clap", + "starknet-crypto", + "thiserror", +] + +[[package]] +name = "cairovm_verifier_commitment" +version = "0.0.3" +dependencies = [ + "blake2", + "cairovm_verifier_transcript", + "crypto-bigint", + "serde", + "serde_with", + "sha3", + "starknet-core", + "starknet-crypto", + "starknet-types-core", + "thiserror", +] + +[[package]] +name = "cairovm_verifier_fri" +version = "0.0.3" +dependencies = [ + "cairovm_verifier_air", + "cairovm_verifier_commitment", + "cairovm_verifier_transcript", + "serde", + "serde_with", + "sha3", + "starknet-core", + "starknet-crypto", + "thiserror", +] + +[[package]] +name = "cairovm_verifier_pow" +version = "0.0.3" +dependencies = [ + "bail-out", + "blake2", + "cairovm_verifier_transcript", + "serde", + "sha3", + "starknet-crypto", + "starknet-types-core", + "thiserror", +] + +[[package]] +name = "cairovm_verifier_proof_parser" +version = "0.0.3" +dependencies = [ + "anyhow", + "cairovm_verifier_air", + "cairovm_verifier_commitment", + "cairovm_verifier_fri", + "cairovm_verifier_pow", + "cairovm_verifier_stark", + "clap", + "num-bigint", + "regex", + "serde", + "serde_json", + "starknet-types-core", + "thiserror", +] + +[[package]] +name = "cairovm_verifier_stark" +version = "0.0.3" +dependencies = [ + "bail-out", + "cairovm_verifier_air", + "cairovm_verifier_commitment", + "cairovm_verifier_fri", + "cairovm_verifier_pow", + "cairovm_verifier_transcript", + "serde", + "serde_with", + "starknet-core", + "starknet-crypto", + "thiserror", + "wasm-bindgen", +] + +[[package]] +name = "cairovm_verifier_transcript" +version = "0.0.3" +dependencies = [ + "starknet-crypto", +] + +[[package]] +name = "cairovm_verifier_wasm" +version = "0.0.3" +dependencies = [ + "cairovm_verifier_air", + "cairovm_verifier_proof_parser", + "cairovm_verifier_stark", + "getrandom", + "serde_json", + "wasm-bindgen", +] + [[package]] name = "cc" -version = "1.1.6" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aba8f4e9906c7ce3c73463f62a7f0c65183ada1a2d47e397cc8810827f9694f" +checksum = "324c74f2155653c90b04f25b2a47a8a631360cb908f92a772695f430c7e31052" [[package]] name = "cfg-if" @@ -788,133 +915,6 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" -[[package]] -name = "swiftness" -version = "0.0.3" -dependencies = [ - "clap", - "starknet-crypto", - "swiftness_air", - "swiftness_proof_parser", - "swiftness_stark", - "thiserror", -] - -[[package]] -name = "swiftness_air" -version = "0.0.3" -dependencies = [ - "bail-out", - "serde", - "serde_with", - "starknet-core", - "starknet-crypto", - "swiftness_commitment", - "swiftness_transcript", - "thiserror", -] - -[[package]] -name = "swiftness_commitment" -version = "0.0.3" -dependencies = [ - "blake2", - "crypto-bigint", - "serde", - "serde_with", - "sha3", - "starknet-core", - "starknet-crypto", - "starknet-types-core", - "swiftness_transcript", - "thiserror", -] - -[[package]] -name = "swiftness_fri" -version = "0.0.3" -dependencies = [ - "serde", - "serde_with", - "sha3", - "starknet-core", - "starknet-crypto", - "swiftness_air", - "swiftness_commitment", - "swiftness_transcript", - "thiserror", -] - -[[package]] -name = "swiftness_pow" -version = "0.0.3" -dependencies = [ - "bail-out", - "blake2", - "serde", - "sha3", - "starknet-crypto", - "starknet-types-core", - "swiftness_transcript", - "thiserror", -] - -[[package]] -name = "swiftness_proof_parser" -version = "0.0.3" -dependencies = [ - "anyhow", - "clap", - "num-bigint", - "regex", - "serde", - "serde_json", - "starknet-types-core", - "swiftness_air", - "swiftness_commitment", - "swiftness_fri", - "swiftness_pow", - "swiftness_stark", - "thiserror", -] - -[[package]] -name = "swiftness_stark" -version = "0.0.3" -dependencies = [ - "bail-out", - "serde", - "serde_with", - "starknet-core", - "starknet-crypto", - "swiftness_air", - "swiftness_commitment", - "swiftness_fri", - "swiftness_pow", - "swiftness_transcript", - "thiserror", - "wasm-bindgen", -] - -[[package]] -name = "swiftness_transcript" -version = "0.0.3" -dependencies = [ - "starknet-crypto", -] - -[[package]] -name = "swiftness_wasm" -version = "0.0.3" -dependencies = [ - "getrandom", - "serde_json", - "swiftness_air", - "swiftness_proof_parser", - "swiftness_stark", - "wasm-bindgen", -] - [[package]] name = "syn" version = "2.0.71" @@ -928,18 +928,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.63" +version = "1.0.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "f2675633b1499176c2dff06b0856a27976a8f9d436737b4cf4f312d4d91d8bbb" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "d20468752b09f49e909e55a5d338caa8bedf615594e9d80bc4c565d30faf798c" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 041145f..a4f49bb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,11 +16,13 @@ members = [ exclude = [] [workspace.package] -description = "Swiftness - Rust CairoVM Verifier implementation" +description = "" edition = "2021" +homepage = "" license-file = "LICENSE" readme = "README.md" -repository = "https://github.com/iosis-tech/swiftness" +repository = "https://github.com/iosis-tech/cairovm-verifier" +version = "0.0.3" [workspace.dependencies] bail-out = "0.2.0" @@ -37,10 +39,10 @@ num-bigint = { version = "0.4.4", features = ["serde"] } blake2 = "0.10.6" wasm-bindgen = "0.2" -swiftness_air = { path = "crates/air", default-features = false, version = "0.0.3" } -swiftness_commitment = { path = "crates/commitment", default-features = false, version = "0.0.3" } -swiftness_fri = { path = "crates/fri", default-features = false, version = "0.0.3" } -swiftness_pow = { path = "crates/pow", default-features = false, version = "0.0.3" } -swiftness_stark = { path = "crates/stark", default-features = false, version = "0.0.3" } -swiftness_transcript = { path = "crates/transcript", default-features = false, version = "0.0.3" } -swiftness_proof_parser = { path = "proof-parser", default-features = false, version = "0.0.3" } +cairovm_verifier_air = { path = "crates/air", default-features = false } +cairovm_verifier_commitment = { path = "crates/commitment", default-features = false } +cairovm_verifier_fri = { path = "crates/fri", default-features = false } +cairovm_verifier_pow = { path = "crates/pow", default-features = false } +cairovm_verifier_stark = { path = "crates/stark", default-features = false } +cairovm_verifier_transcript = { path = "crates/transcript", default-features = false } +cairovm_verifier_proof_parser = { path = "proof-parser", default-features = false } diff --git a/README.md b/README.md index 39e9116..b35c15f 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ # Swiftness CairoVM Verifier ![Version](https://img.shields.io/badge/v0.0.3-green?style=flat-square&logo=git&logoColor=white&label=version) -![Continuous Integration](https://img.shields.io/github/actions/workflow/status/iosis-tech/swiftness/ci.yml?style=flat-square&logo=githubactions&logoColor=white&label=Continuous%20Integration) +![Continuous Integration](https://img.shields.io/github/actions/workflow/status/iosis-tech/cairovm-verifier/ci.yml?style=flat-square&logo=githubactions&logoColor=white&label=Continuous%20Integration) This is the Rust implementation of the Cairo-VM STARK verifier with layouts. The code is inspired by StarkWare's [Cairo-verifier](https://github.com/starkware-libs/cairo-lang) implementation in Cairo0. ### Verify example proof: ```sh -cargo run --release --bin swiftness --features starknet_with_keccak,keccak --no-default-features -- --proof examples/proofs/starknet_with_keccak/cairo0_example_proof.json +cargo run --release --bin cairovm_verifier_cli --features starknet_with_keccak,keccak --no-default-features -- --proof examples/proofs/starknet_with_keccak/cairo0_example_proof.json ``` ## Run Tests @@ -17,17 +17,6 @@ cargo run --release --bin swiftness --features starknet_with_keccak,keccak --no- cargo test ``` -### Install wasm-pack -```sh -cargo install wasm-pack -``` - -### Build WASM: - -```sh -cd wasm-binding && wasm-pack build --target web --workspace --features starknet_with_keccak,blake2s --no-default-features -``` - ## Features - **Usage:** diff --git a/cli/Cargo.toml b/cli/Cargo.toml index c0a186e..e5eeb7b 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -1,23 +1,24 @@ [package] -name = "swiftness" +name = "cairovm_verifier_cli" description.workspace = true edition.workspace = true +homepage.workspace = true license-file.workspace = true readme.workspace = true repository.workspace = true -version = "0.0.3" +version.workspace = true [dependencies] clap = { version = "4.4.4", features = ["derive"] } thiserror.workspace = true starknet-crypto.workspace = true -swiftness_air = { workspace = true } -swiftness_stark = { workspace = true } -swiftness_proof_parser = { workspace = true } +cairovm_verifier_air = { workspace = true, default-features = false } +cairovm_verifier_stark = { workspace = true, default-features = false } +cairovm_verifier_proof_parser = { workspace = true, default-features = false } [features] -default = ["starknet_with_keccak", "blake2s"] +default = ["recursive", "keccak"] dex = [] recursive = [] recursive_with_poseidon = [] diff --git a/cli/src/lib.rs b/cli/src/lib.rs deleted file mode 100644 index 7dd5486..0000000 --- a/cli/src/lib.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub use swiftness_proof_parser::*; -pub use swiftness_stark::*; diff --git a/cli/src/main.rs b/cli/src/main.rs index ec5d7f3..be169ad 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -1,20 +1,19 @@ use std::path::PathBuf; -pub use swiftness_proof_parser::*; -pub use swiftness_stark::*; #[cfg(feature = "dex")] -use swiftness_air::layout::dex::Layout; +use cairovm_verifier_air::layout::dex::Layout; #[cfg(feature = "recursive")] -use swiftness_air::layout::recursive::Layout; +use cairovm_verifier_air::layout::recursive::Layout; #[cfg(feature = "recursive_with_poseidon")] -use swiftness_air::layout::recursive_with_poseidon::Layout; +use cairovm_verifier_air::layout::recursive_with_poseidon::Layout; #[cfg(feature = "small")] -use swiftness_air::layout::small::Layout; +use cairovm_verifier_air::layout::small::Layout; #[cfg(feature = "starknet")] -use swiftness_air::layout::starknet::Layout; +use cairovm_verifier_air::layout::starknet::Layout; #[cfg(feature = "starknet_with_keccak")] -use swiftness_air::layout::starknet_with_keccak::Layout; +use cairovm_verifier_air::layout::starknet_with_keccak::Layout; +use cairovm_verifier_proof_parser::parse; use clap::Parser; #[derive(Parser)] diff --git a/crates/air/Cargo.toml b/crates/air/Cargo.toml index 46f963a..d8b9073 100644 --- a/crates/air/Cargo.toml +++ b/crates/air/Cargo.toml @@ -1,11 +1,12 @@ [package] -name = "swiftness_air" +name = "cairovm_verifier_air" description.workspace = true edition.workspace = true +homepage.workspace = true license-file.workspace = true -readme = "README.md" +readme.workspace = true repository.workspace = true -version = "0.0.3" +version.workspace = true [dependencies] bail-out.workspace = true @@ -15,8 +16,8 @@ starknet-core.workspace = true starknet-crypto.workspace = true thiserror.workspace = true -swiftness_commitment.workspace = true -swiftness_transcript.workspace = true +cairovm_verifier_commitment.workspace = true +cairovm_verifier_transcript.workspace = true [features] default = ["recursive"] diff --git a/crates/air/README.md b/crates/air/README.md deleted file mode 100644 index 7afa590..0000000 --- a/crates/air/README.md +++ /dev/null @@ -1 +0,0 @@ -# Swiftness Air CairoVM Verifier \ No newline at end of file diff --git a/crates/air/src/fixtures/commitment.rs b/crates/air/src/fixtures/commitment.rs index f2fe1b8..30a3d6f 100644 --- a/crates/air/src/fixtures/commitment.rs +++ b/crates/air/src/fixtures/commitment.rs @@ -1,7 +1,7 @@ use super::{config, interaction_elements, unsent_commitment}; use crate::{layout::recursive::global_values::InteractionElements, trace::Commitment}; +use cairovm_verifier_commitment::{table, vector}; use starknet_crypto::Felt; -use swiftness_commitment::{table, vector}; pub fn get() -> Commitment { let unsent_commitment = unsent_commitment::get(); diff --git a/crates/air/src/fixtures/config.rs b/crates/air/src/fixtures/config.rs index 0493b43..65b82ab 100644 --- a/crates/air/src/fixtures/config.rs +++ b/crates/air/src/fixtures/config.rs @@ -1,6 +1,6 @@ use crate::trace; +use cairovm_verifier_commitment::{table, vector}; use starknet_crypto::Felt; -use swiftness_commitment::{table, vector}; pub fn get() -> trace::config::Config { trace::config::Config { diff --git a/crates/air/src/fixtures/decommitment.rs b/crates/air/src/fixtures/decommitment.rs index 26453b8..bdfe6da 100644 --- a/crates/air/src/fixtures/decommitment.rs +++ b/crates/air/src/fixtures/decommitment.rs @@ -1,5 +1,5 @@ +use cairovm_verifier_commitment::table; use starknet_crypto::Felt; -use swiftness_commitment::table; use crate::trace; diff --git a/crates/air/src/fixtures/witness.rs b/crates/air/src/fixtures/witness.rs index 1f75ae8..cc86fe5 100644 --- a/crates/air/src/fixtures/witness.rs +++ b/crates/air/src/fixtures/witness.rs @@ -1,6 +1,6 @@ use crate::trace::Witness; +use cairovm_verifier_commitment::{table, vector}; use starknet_crypto::Felt; -use swiftness_commitment::{table, vector}; pub fn get() -> Witness { Witness { diff --git a/crates/air/src/layout/dex/global_values.rs b/crates/air/src/layout/dex/global_values.rs index 2716518..c89b37e 100644 --- a/crates/air/src/layout/dex/global_values.rs +++ b/crates/air/src/layout/dex/global_values.rs @@ -1,8 +1,8 @@ +use cairovm_verifier_transcript::transcript::Transcript; use serde::{Deserialize, Serialize}; use serde_with::serde_as; use starknet_core::serde::unsigned_field_element::UfeHex; use starknet_crypto::Felt; -use swiftness_transcript::transcript::Transcript; #[serde_as] #[derive(Debug, PartialEq, Serialize, Deserialize)] diff --git a/crates/air/src/layout/dex/mod.rs b/crates/air/src/layout/dex/mod.rs index e374300..873f1c4 100644 --- a/crates/air/src/layout/dex/mod.rs +++ b/crates/air/src/layout/dex/mod.rs @@ -7,10 +7,10 @@ use crate::{ public_memory::{PublicInput, INITIAL_PC, MAX_ADDRESS, MAX_LOG_N_STEPS, MAX_RANGE_CHECK}, }; use bail_out::ensure; +use cairovm_verifier_commitment::table::{commit::table_commit, decommit::table_decommit}; use global_values::{EcPoint, EcdsaSigConfig, GlobalValues, InteractionElements}; use starknet_core::types::NonZeroFelt; use starknet_crypto::{poseidon_hash_many, Felt}; -use swiftness_commitment::table::{commit::table_commit, decommit::table_decommit}; use super::{CompositionPolyEvalError, LayoutTrait, PublicInputError}; @@ -211,7 +211,7 @@ impl LayoutTrait for Layout { ) } fn traces_commit( - transcript: &mut swiftness_transcript::transcript::Transcript, + transcript: &mut cairovm_verifier_transcript::transcript::Transcript, unsent_commitment: &crate::trace::UnsentCommitment, config: crate::trace::config::Config, ) -> crate::trace::Commitment { diff --git a/crates/air/src/layout/mod.rs b/crates/air/src/layout/mod.rs index e41741e..96d032c 100644 --- a/crates/air/src/layout/mod.rs +++ b/crates/air/src/layout/mod.rs @@ -1,6 +1,6 @@ use crate::{domains::StarkDomains, public_memory::PublicInput}; +use cairovm_verifier_transcript::transcript::Transcript; use starknet_crypto::Felt; -use swiftness_transcript::transcript::Transcript; pub mod dex; pub mod recursive; diff --git a/crates/air/src/layout/recursive/global_values.rs b/crates/air/src/layout/recursive/global_values.rs index e15c969..704ff71 100644 --- a/crates/air/src/layout/recursive/global_values.rs +++ b/crates/air/src/layout/recursive/global_values.rs @@ -1,8 +1,8 @@ +use cairovm_verifier_transcript::transcript::Transcript; use serde::{Deserialize, Serialize}; use serde_with::serde_as; use starknet_core::serde::unsigned_field_element::UfeHex; use starknet_crypto::Felt; -use swiftness_transcript::transcript::Transcript; #[serde_as] #[derive(Debug, PartialEq, Serialize, Deserialize)] diff --git a/crates/air/src/layout/recursive/mod.rs b/crates/air/src/layout/recursive/mod.rs index f1f5486..426612b 100644 --- a/crates/air/src/layout/recursive/mod.rs +++ b/crates/air/src/layout/recursive/mod.rs @@ -7,10 +7,10 @@ use crate::{ public_memory::{PublicInput, INITIAL_PC, MAX_ADDRESS, MAX_LOG_N_STEPS, MAX_RANGE_CHECK}, }; use bail_out::ensure; +use cairovm_verifier_commitment::table::{commit::table_commit, decommit::table_decommit}; use global_values::{EcPoint, GlobalValues, InteractionElements}; use starknet_core::types::NonZeroFelt; use starknet_crypto::{poseidon_hash_many, Felt}; -use swiftness_commitment::table::{commit::table_commit, decommit::table_decommit}; use super::{CompositionPolyEvalError, LayoutTrait, PublicInputError}; @@ -213,7 +213,7 @@ impl LayoutTrait for Layout { ) } fn traces_commit( - transcript: &mut swiftness_transcript::transcript::Transcript, + transcript: &mut cairovm_verifier_transcript::transcript::Transcript, unsent_commitment: &crate::trace::UnsentCommitment, config: crate::trace::config::Config, ) -> crate::trace::Commitment { diff --git a/crates/air/src/layout/recursive_with_poseidon/global_values.rs b/crates/air/src/layout/recursive_with_poseidon/global_values.rs index 9b07ff5..7ac7259 100644 --- a/crates/air/src/layout/recursive_with_poseidon/global_values.rs +++ b/crates/air/src/layout/recursive_with_poseidon/global_values.rs @@ -1,8 +1,8 @@ +use cairovm_verifier_transcript::transcript::Transcript; use serde::{Deserialize, Serialize}; use serde_with::serde_as; use starknet_core::serde::unsigned_field_element::UfeHex; use starknet_crypto::Felt; -use swiftness_transcript::transcript::Transcript; #[serde_as] #[derive(Debug, PartialEq, Serialize, Deserialize)] diff --git a/crates/air/src/layout/recursive_with_poseidon/mod.rs b/crates/air/src/layout/recursive_with_poseidon/mod.rs index 811f548..84fb424 100644 --- a/crates/air/src/layout/recursive_with_poseidon/mod.rs +++ b/crates/air/src/layout/recursive_with_poseidon/mod.rs @@ -11,10 +11,10 @@ use crate::{ public_memory::{PublicInput, INITIAL_PC, MAX_ADDRESS, MAX_LOG_N_STEPS, MAX_RANGE_CHECK}, }; use bail_out::ensure; +use cairovm_verifier_commitment::table::{commit::table_commit, decommit::table_decommit}; use global_values::{EcPoint, GlobalValues, InteractionElements}; use starknet_core::types::NonZeroFelt; use starknet_crypto::{poseidon_hash_many, Felt}; -use swiftness_commitment::table::{commit::table_commit, decommit::table_decommit}; use super::{CompositionPolyEvalError, LayoutTrait, PublicInputError}; @@ -255,7 +255,7 @@ impl LayoutTrait for Layout { ) } fn traces_commit( - transcript: &mut swiftness_transcript::transcript::Transcript, + transcript: &mut cairovm_verifier_transcript::transcript::Transcript, unsent_commitment: &crate::trace::UnsentCommitment, config: crate::trace::config::Config, ) -> crate::trace::Commitment { diff --git a/crates/air/src/layout/small/global_values.rs b/crates/air/src/layout/small/global_values.rs index 2716518..c89b37e 100644 --- a/crates/air/src/layout/small/global_values.rs +++ b/crates/air/src/layout/small/global_values.rs @@ -1,8 +1,8 @@ +use cairovm_verifier_transcript::transcript::Transcript; use serde::{Deserialize, Serialize}; use serde_with::serde_as; use starknet_core::serde::unsigned_field_element::UfeHex; use starknet_crypto::Felt; -use swiftness_transcript::transcript::Transcript; #[serde_as] #[derive(Debug, PartialEq, Serialize, Deserialize)] diff --git a/crates/air/src/layout/small/mod.rs b/crates/air/src/layout/small/mod.rs index ca64d3f..f51020c 100644 --- a/crates/air/src/layout/small/mod.rs +++ b/crates/air/src/layout/small/mod.rs @@ -7,10 +7,10 @@ use crate::{ public_memory::{PublicInput, INITIAL_PC, MAX_ADDRESS, MAX_LOG_N_STEPS, MAX_RANGE_CHECK}, }; use bail_out::ensure; +use cairovm_verifier_commitment::table::{commit::table_commit, decommit::table_decommit}; use global_values::{EcPoint, EcdsaSigConfig, GlobalValues, InteractionElements}; use starknet_core::types::NonZeroFelt; use starknet_crypto::{poseidon_hash_many, Felt}; -use swiftness_commitment::table::{commit::table_commit, decommit::table_decommit}; use super::{CompositionPolyEvalError, LayoutTrait, PublicInputError}; @@ -211,7 +211,7 @@ impl LayoutTrait for Layout { ) } fn traces_commit( - transcript: &mut swiftness_transcript::transcript::Transcript, + transcript: &mut cairovm_verifier_transcript::transcript::Transcript, unsent_commitment: &crate::trace::UnsentCommitment, config: crate::trace::config::Config, ) -> crate::trace::Commitment { diff --git a/crates/air/src/layout/starknet/global_values.rs b/crates/air/src/layout/starknet/global_values.rs index a58d0e5..0b0379d 100644 --- a/crates/air/src/layout/starknet/global_values.rs +++ b/crates/air/src/layout/starknet/global_values.rs @@ -1,8 +1,8 @@ +use cairovm_verifier_transcript::transcript::Transcript; use serde::{Deserialize, Serialize}; use serde_with::serde_as; use starknet_core::serde::unsigned_field_element::UfeHex; use starknet_crypto::Felt; -use swiftness_transcript::transcript::Transcript; #[serde_as] #[derive(Debug, PartialEq, Serialize, Deserialize)] diff --git a/crates/air/src/layout/starknet/mod.rs b/crates/air/src/layout/starknet/mod.rs index d589752..8d63c49 100644 --- a/crates/air/src/layout/starknet/mod.rs +++ b/crates/air/src/layout/starknet/mod.rs @@ -13,10 +13,10 @@ use crate::{ public_memory::{PublicInput, INITIAL_PC, MAX_ADDRESS, MAX_LOG_N_STEPS, MAX_RANGE_CHECK}, }; use bail_out::ensure; +use cairovm_verifier_commitment::table::{commit::table_commit, decommit::table_decommit}; use global_values::{CurveConfig, EcPoint, EcdsaSigConfig, GlobalValues, InteractionElements}; use starknet_core::types::NonZeroFelt; use starknet_crypto::{poseidon_hash_many, Felt}; -use swiftness_commitment::table::{commit::table_commit, decommit::table_decommit}; use super::{CompositionPolyEvalError, LayoutTrait, PublicInputError}; @@ -296,7 +296,7 @@ impl LayoutTrait for Layout { ) } fn traces_commit( - transcript: &mut swiftness_transcript::transcript::Transcript, + transcript: &mut cairovm_verifier_transcript::transcript::Transcript, unsent_commitment: &crate::trace::UnsentCommitment, config: crate::trace::config::Config, ) -> crate::trace::Commitment { diff --git a/crates/air/src/layout/starknet_with_keccak/global_values.rs b/crates/air/src/layout/starknet_with_keccak/global_values.rs index e8f792b..1845e7c 100644 --- a/crates/air/src/layout/starknet_with_keccak/global_values.rs +++ b/crates/air/src/layout/starknet_with_keccak/global_values.rs @@ -1,8 +1,8 @@ +use cairovm_verifier_transcript::transcript::Transcript; use serde::{Deserialize, Serialize}; use serde_with::serde_as; use starknet_core::serde::unsigned_field_element::UfeHex; use starknet_crypto::Felt; -use swiftness_transcript::transcript::Transcript; #[serde_as] #[derive(Debug, PartialEq, Serialize, Deserialize)] diff --git a/crates/air/src/layout/starknet_with_keccak/mod.rs b/crates/air/src/layout/starknet_with_keccak/mod.rs index 0b67dca..8f542b3 100644 --- a/crates/air/src/layout/starknet_with_keccak/mod.rs +++ b/crates/air/src/layout/starknet_with_keccak/mod.rs @@ -15,10 +15,10 @@ use crate::{ public_memory::{PublicInput, INITIAL_PC, MAX_ADDRESS, MAX_LOG_N_STEPS, MAX_RANGE_CHECK}, }; use bail_out::ensure; +use cairovm_verifier_commitment::table::{commit::table_commit, decommit::table_decommit}; use global_values::{CurveConfig, EcPoint, EcdsaSigConfig, GlobalValues, InteractionElements}; use starknet_core::types::NonZeroFelt; use starknet_crypto::{poseidon_hash_many, Felt}; -use swiftness_commitment::table::{commit::table_commit, decommit::table_decommit}; use super::{CompositionPolyEvalError, LayoutTrait, PublicInputError}; @@ -330,7 +330,7 @@ impl LayoutTrait for Layout { ) } fn traces_commit( - transcript: &mut swiftness_transcript::transcript::Transcript, + transcript: &mut cairovm_verifier_transcript::transcript::Transcript, unsent_commitment: &crate::trace::UnsentCommitment, config: crate::trace::config::Config, ) -> crate::trace::Commitment { diff --git a/crates/air/src/trace/config.rs b/crates/air/src/trace/config.rs index 723700d..b6fedf9 100644 --- a/crates/air/src/trace/config.rs +++ b/crates/air/src/trace/config.rs @@ -11,17 +11,17 @@ use crate::layout::starknet::{NUM_COLUMNS_FIRST, NUM_COLUMNS_SECOND}; #[cfg(feature = "starknet_with_keccak")] use crate::layout::starknet_with_keccak::{NUM_COLUMNS_FIRST, NUM_COLUMNS_SECOND}; +use cairovm_verifier_commitment::vector; use serde::{Deserialize, Serialize}; use starknet_crypto::Felt; -use swiftness_commitment::vector; const MAX_N_COLUMNS: Felt = Felt::from_hex_unchecked("0x80"); // Configuration for the Traces component. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct Config { - pub original: swiftness_commitment::table::config::Config, - pub interaction: swiftness_commitment::table::config::Config, + pub original: cairovm_verifier_commitment::table::config::Config, + pub interaction: cairovm_verifier_commitment::table::config::Config, } impl Config { diff --git a/crates/air/src/trace/decommit.rs b/crates/air/src/trace/decommit.rs index c150bef..fd01ccf 100644 --- a/crates/air/src/trace/decommit.rs +++ b/crates/air/src/trace/decommit.rs @@ -1,4 +1,4 @@ -use swiftness_commitment::table; +use cairovm_verifier_commitment::table; use thiserror::Error; #[derive(Error, Debug)] diff --git a/crates/air/src/trace/mod.rs b/crates/air/src/trace/mod.rs index bbaa610..dabd9e8 100644 --- a/crates/air/src/trace/mod.rs +++ b/crates/air/src/trace/mod.rs @@ -21,12 +21,12 @@ pub struct UnsentCommitment { #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct Commitment { // Commitment to the first trace. - pub original: swiftness_commitment::table::types::Commitment, + pub original: cairovm_verifier_commitment::table::types::Commitment, // The interaction elements that were sent to the prover after the first trace commitment (e.g. // memory interaction). pub interaction_elements: InteractionElements, // Commitment to the second (interaction) trace. - pub interaction: swiftness_commitment::table::types::Commitment, + pub interaction: cairovm_verifier_commitment::table::types::Commitment, } // Responses for queries to the AIR commitment. @@ -34,14 +34,14 @@ pub struct Commitment { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct Decommitment { // Responses for queries to the original trace. - pub original: swiftness_commitment::table::types::Decommitment, + pub original: cairovm_verifier_commitment::table::types::Decommitment, // Responses for queries to the interaction trace. - pub interaction: swiftness_commitment::table::types::Decommitment, + pub interaction: cairovm_verifier_commitment::table::types::Decommitment, } // A witness for a decommitment of the AIR traces over queries. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct Witness { - pub original: swiftness_commitment::table::types::Witness, - pub interaction: swiftness_commitment::table::types::Witness, + pub original: cairovm_verifier_commitment::table::types::Witness, + pub interaction: cairovm_verifier_commitment::table::types::Witness, } diff --git a/crates/commitment/Cargo.toml b/crates/commitment/Cargo.toml index a4f141a..5b1b014 100644 --- a/crates/commitment/Cargo.toml +++ b/crates/commitment/Cargo.toml @@ -1,11 +1,12 @@ [package] -name = "swiftness_commitment" +name = "cairovm_verifier_commitment" description.workspace = true edition.workspace = true +homepage.workspace = true license-file.workspace = true -readme = "README.md" +readme.workspace = true repository.workspace = true -version = "0.0.3" +version.workspace = true [dependencies] serde_with.workspace = true @@ -18,7 +19,7 @@ thiserror.workspace = true crypto-bigint.workspace = true blake2.workspace = true -swiftness_transcript.workspace = true +cairovm_verifier_transcript.workspace = true [features] default = ["keccak"] diff --git a/crates/commitment/README.md b/crates/commitment/README.md deleted file mode 100644 index 08b9291..0000000 --- a/crates/commitment/README.md +++ /dev/null @@ -1 +0,0 @@ -# Swiftness Commitment CairoVM Verifier \ No newline at end of file diff --git a/crates/commitment/src/table/commit.rs b/crates/commitment/src/table/commit.rs index 84a0bc1..5a3d50b 100644 --- a/crates/commitment/src/table/commit.rs +++ b/crates/commitment/src/table/commit.rs @@ -1,7 +1,7 @@ use super::{config::Config, types::Commitment}; use crate::vector::commit::vector_commit; +use cairovm_verifier_transcript::transcript::Transcript; use starknet_crypto::Felt; -use swiftness_transcript::transcript::Transcript; pub fn table_commit( transcript: &mut Transcript, diff --git a/crates/commitment/src/table/tests/table_commitment_commit.rs b/crates/commitment/src/table/tests/table_commitment_commit.rs index b95a528..7dc8508 100644 --- a/crates/commitment/src/table/tests/table_commitment_commit.rs +++ b/crates/commitment/src/table/tests/table_commitment_commit.rs @@ -1,5 +1,5 @@ +use cairovm_verifier_transcript::transcript::Transcript; use starknet_crypto::Felt; -use swiftness_transcript::transcript::Transcript; use crate::{ table::{self, commit::table_commit}, diff --git a/crates/commitment/src/vector/commit.rs b/crates/commitment/src/vector/commit.rs index ab75d33..58c0679 100644 --- a/crates/commitment/src/vector/commit.rs +++ b/crates/commitment/src/vector/commit.rs @@ -1,5 +1,5 @@ +use cairovm_verifier_transcript::transcript::Transcript; use starknet_crypto::Felt; -use swiftness_transcript::transcript::Transcript; use super::{config::Config, types::Commitment}; diff --git a/crates/commitment/src/vector/tests/vector_commitment_commit.rs b/crates/commitment/src/vector/tests/vector_commitment_commit.rs index 6bab5cc..8393d8b 100644 --- a/crates/commitment/src/vector/tests/vector_commitment_commit.rs +++ b/crates/commitment/src/vector/tests/vector_commitment_commit.rs @@ -1,5 +1,5 @@ +use cairovm_verifier_transcript::transcript::Transcript; use starknet_crypto::Felt; -use swiftness_transcript::transcript::Transcript; use crate::vector::{commit::vector_commit, config::Config, types::Commitment}; diff --git a/crates/fri/Cargo.toml b/crates/fri/Cargo.toml index d458107..7d94f38 100644 --- a/crates/fri/Cargo.toml +++ b/crates/fri/Cargo.toml @@ -1,11 +1,12 @@ [package] -name = "swiftness_fri" +name = "cairovm_verifier_fri" description.workspace = true edition.workspace = true +homepage.workspace = true license-file.workspace = true -readme = "README.md" +readme.workspace = true repository.workspace = true -version = "0.0.3" +version.workspace = true [dependencies] serde_with.workspace = true @@ -15,6 +16,6 @@ starknet-core.workspace = true starknet-crypto.workspace = true thiserror.workspace = true -swiftness_air.workspace = true -swiftness_commitment.workspace = true -swiftness_transcript.workspace = true +cairovm_verifier_air.workspace = true +cairovm_verifier_commitment.workspace = true +cairovm_verifier_transcript.workspace = true diff --git a/crates/fri/README.md b/crates/fri/README.md deleted file mode 100644 index 0cc1bdd..0000000 --- a/crates/fri/README.md +++ /dev/null @@ -1 +0,0 @@ -# Swiftness Fri CairoVM Verifier \ No newline at end of file diff --git a/crates/fri/src/config.rs b/crates/fri/src/config.rs index 2a8dee5..b1c977d 100644 --- a/crates/fri/src/config.rs +++ b/crates/fri/src/config.rs @@ -20,7 +20,7 @@ pub struct Config { pub n_layers: Felt, // Array of size n_layers - 1, each entry is a configuration of a table commitment for the // corresponding inner layer. - pub inner_layers: Vec, + pub inner_layers: Vec, // Array of size n_layers, each entry represents the FRI step size, // i.e. the number of FRI-foldings between layer i and i+1. #[serde_as(as = "Vec")] @@ -98,5 +98,5 @@ pub enum Error { #[error("log input size mismatch, expected {expected}, got {actual}")] LogInputSizeMismatch { expected: Felt, actual: Felt }, #[error("vector validation failed: {0}")] - VectorValidationFailed(#[from] swiftness_commitment::vector::config::Error), + VectorValidationFailed(#[from] cairovm_verifier_commitment::vector::config::Error), } diff --git a/crates/fri/src/fixtures/commitment.rs b/crates/fri/src/fixtures/commitment.rs index e15bec1..9acecaf 100644 --- a/crates/fri/src/fixtures/commitment.rs +++ b/crates/fri/src/fixtures/commitment.rs @@ -1,8 +1,8 @@ -use starknet_crypto::Felt; -use swiftness_commitment::{ +use cairovm_verifier_commitment::{ table::{config::Config as TableCommitmentConfig, types::Commitment as TableCommitment}, vector::{config::Config as VectorCommitmentConfig, types::Commitment as VectorCommitment}, }; +use starknet_crypto::Felt; use crate::types::Commitment as FriCommitment; diff --git a/crates/fri/src/fixtures/config.rs b/crates/fri/src/fixtures/config.rs index 5a5666e..d4b78b1 100644 --- a/crates/fri/src/fixtures/config.rs +++ b/crates/fri/src/fixtures/config.rs @@ -1,6 +1,6 @@ use crate::config::Config; +use cairovm_verifier_commitment::{table, vector}; use starknet_crypto::Felt; -use swiftness_commitment::{table, vector}; pub fn get() -> Config { Config { diff --git a/crates/fri/src/fixtures/witness.rs b/crates/fri/src/fixtures/witness.rs index 9895b80..aea8e37 100644 --- a/crates/fri/src/fixtures/witness.rs +++ b/crates/fri/src/fixtures/witness.rs @@ -1,11 +1,11 @@ use std::vec; use crate::types::{LayerWitness, Witness}; -use starknet_crypto::Felt; -use swiftness_commitment::{ +use cairovm_verifier_commitment::{ table::types::Witness as TableCommitmentWitness, vector::types::Witness as VectorCommitmentWitness, }; +use starknet_crypto::Felt; pub fn get() -> Witness { Witness { diff --git a/crates/fri/src/fri.rs b/crates/fri/src/fri.rs index fa64681..0454dc1 100644 --- a/crates/fri/src/fri.rs +++ b/crates/fri/src/fri.rs @@ -1,11 +1,11 @@ -use starknet_crypto::Felt; -use swiftness_commitment::table::{ +use cairovm_verifier_commitment::table::{ commit::table_commit, config::Config as TableCommitmentConfig, decommit::table_decommit, types::{Commitment as TableCommitment, Decommitment as TableDecommitment}, }; -use swiftness_transcript::transcript::Transcript; +use cairovm_verifier_transcript::transcript::Transcript; +use starknet_crypto::Felt; use crate::{ config::Config as FriConfig, diff --git a/crates/fri/src/tests/commit.rs b/crates/fri/src/tests/commit.rs index 370af31..452dce3 100644 --- a/crates/fri/src/tests/commit.rs +++ b/crates/fri/src/tests/commit.rs @@ -1,5 +1,5 @@ +use cairovm_verifier_transcript::transcript::Transcript; use starknet_crypto::Felt; -use swiftness_transcript::transcript::Transcript; use crate::{ fixtures::{commitment, config, unsent_commitment}, diff --git a/crates/fri/src/types.rs b/crates/fri/src/types.rs index 2fc9a8f..020b319 100644 --- a/crates/fri/src/types.rs +++ b/crates/fri/src/types.rs @@ -23,7 +23,7 @@ pub struct UnsentCommitment { pub struct Commitment { pub config: Config, // Array of size n_layers - 1 containing table commitments for each inner layer. - pub inner_layers: Vec, + pub inner_layers: Vec, // Array of size n_layers, of one evaluation point for each layer. #[serde_as(as = "Vec")] pub eval_points: Vec, @@ -61,5 +61,5 @@ pub struct LayerWitness { #[serde_as(as = "Vec")] pub leaves: Vec, // Table commitment witnesses for decommiting all the leaves. - pub table_witness: swiftness_commitment::table::types::Witness, + pub table_witness: cairovm_verifier_commitment::table::types::Witness, } diff --git a/crates/pow/Cargo.toml b/crates/pow/Cargo.toml index e69fba8..3e4777f 100644 --- a/crates/pow/Cargo.toml +++ b/crates/pow/Cargo.toml @@ -1,11 +1,12 @@ [package] -name = "swiftness_pow" +name = "cairovm_verifier_pow" description.workspace = true edition.workspace = true +homepage.workspace = true license-file.workspace = true -readme = "README.md" +readme.workspace = true repository.workspace = true -version = "0.0.3" +version.workspace = true [dependencies] bail-out.workspace = true @@ -16,7 +17,7 @@ starknet-types-core.workspace = true thiserror.workspace = true blake2.workspace = true -swiftness_transcript.workspace = true +cairovm_verifier_transcript.workspace = true [features] default = ["keccak"] diff --git a/crates/pow/README.md b/crates/pow/README.md deleted file mode 100644 index eea477d..0000000 --- a/crates/pow/README.md +++ /dev/null @@ -1 +0,0 @@ -# Swiftness Proof of Work CairoVM Verifier \ No newline at end of file diff --git a/crates/pow/src/pow.rs b/crates/pow/src/pow.rs index a14dccb..4b9de58 100644 --- a/crates/pow/src/pow.rs +++ b/crates/pow/src/pow.rs @@ -8,9 +8,9 @@ use sha3::Digest; use sha3::Keccak256; use bail_out::assure; +use cairovm_verifier_transcript::transcript::Transcript; use serde::{Deserialize, Serialize}; use starknet_crypto::Felt; -use swiftness_transcript::transcript::Transcript; use crate::config::Config; diff --git a/crates/stark/Cargo.toml b/crates/stark/Cargo.toml index 617b946..b6c37d4 100644 --- a/crates/stark/Cargo.toml +++ b/crates/stark/Cargo.toml @@ -1,11 +1,12 @@ [package] -name = "swiftness_stark" +name = "cairovm_verifier_stark" description.workspace = true edition.workspace = true +homepage.workspace = true license-file.workspace = true -readme = "README.md" +readme.workspace = true repository.workspace = true -version = "0.0.3" +version.workspace = true [dependencies] bail-out.workspace = true @@ -16,11 +17,11 @@ starknet-crypto.workspace = true thiserror.workspace = true wasm-bindgen.workspace = true -swiftness_air.workspace = true -swiftness_commitment.workspace = true -swiftness_fri.workspace = true -swiftness_pow.workspace = true -swiftness_transcript.workspace = true +cairovm_verifier_air.workspace = true +cairovm_verifier_commitment.workspace = true +cairovm_verifier_fri.workspace = true +cairovm_verifier_pow.workspace = true +cairovm_verifier_transcript.workspace = true [features] default = ["recursive"] diff --git a/crates/stark/README.md b/crates/stark/README.md deleted file mode 100644 index 712dadf..0000000 --- a/crates/stark/README.md +++ /dev/null @@ -1 +0,0 @@ -# Swiftness Stark CairoVM Verifier \ No newline at end of file diff --git a/crates/stark/src/commit.rs b/crates/stark/src/commit.rs index e48d8d7..1bfb88b 100644 --- a/crates/stark/src/commit.rs +++ b/crates/stark/src/commit.rs @@ -1,22 +1,28 @@ #[cfg(feature = "dex")] -use swiftness_air::layout::dex::{CONSTRAINT_DEGREE, MASK_SIZE, N_CONSTRAINTS}; +use cairovm_verifier_air::layout::dex::{CONSTRAINT_DEGREE, MASK_SIZE, N_CONSTRAINTS}; #[cfg(feature = "recursive")] -use swiftness_air::layout::recursive::{CONSTRAINT_DEGREE, MASK_SIZE, N_CONSTRAINTS}; +use cairovm_verifier_air::layout::recursive::{CONSTRAINT_DEGREE, MASK_SIZE, N_CONSTRAINTS}; #[cfg(feature = "recursive_with_poseidon")] -use swiftness_air::layout::recursive_with_poseidon::{CONSTRAINT_DEGREE, MASK_SIZE, N_CONSTRAINTS}; +use cairovm_verifier_air::layout::recursive_with_poseidon::{ + CONSTRAINT_DEGREE, MASK_SIZE, N_CONSTRAINTS, +}; #[cfg(feature = "small")] -use swiftness_air::layout::small::{CONSTRAINT_DEGREE, MASK_SIZE, N_CONSTRAINTS}; +use cairovm_verifier_air::layout::small::{CONSTRAINT_DEGREE, MASK_SIZE, N_CONSTRAINTS}; #[cfg(feature = "starknet")] -use swiftness_air::layout::starknet::{CONSTRAINT_DEGREE, MASK_SIZE, N_CONSTRAINTS}; +use cairovm_verifier_air::layout::starknet::{CONSTRAINT_DEGREE, MASK_SIZE, N_CONSTRAINTS}; #[cfg(feature = "starknet_with_keccak")] -use swiftness_air::layout::starknet_with_keccak::{CONSTRAINT_DEGREE, MASK_SIZE, N_CONSTRAINTS}; +use cairovm_verifier_air::layout::starknet_with_keccak::{ + CONSTRAINT_DEGREE, MASK_SIZE, N_CONSTRAINTS, +}; +use cairovm_verifier_air::{ + domains::StarkDomains, layout::LayoutTrait, public_memory::PublicInput, +}; +use cairovm_verifier_commitment::table::commit::table_commit; +use cairovm_verifier_fri::fri::fri_commit; +use cairovm_verifier_pow::pow; +use cairovm_verifier_transcript::transcript::Transcript; use starknet_crypto::Felt; -use swiftness_air::{domains::StarkDomains, layout::LayoutTrait, public_memory::PublicInput}; -use swiftness_commitment::table::commit::table_commit; -use swiftness_fri::fri::fri_commit; -use swiftness_pow::pow; -use swiftness_transcript::transcript::Transcript; // STARK commitment phase. pub fn stark_commit( diff --git a/crates/stark/src/config.rs b/crates/stark/src/config.rs index 46a9331..0033282 100644 --- a/crates/stark/src/config.rs +++ b/crates/stark/src/config.rs @@ -6,10 +6,10 @@ use starknet_crypto::Felt; #[serde_as] #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct StarkConfig { - pub traces: swiftness_air::trace::config::Config, - pub composition: swiftness_commitment::table::config::Config, - pub fri: swiftness_fri::config::Config, - pub proof_of_work: swiftness_pow::config::Config, + pub traces: cairovm_verifier_air::trace::config::Config, + pub composition: cairovm_verifier_commitment::table::config::Config, + pub fri: cairovm_verifier_fri::config::Config, + pub proof_of_work: cairovm_verifier_pow::config::Config, // Log2 of the trace domain size. #[serde_as(as = "UfeHex")] pub log_trace_domain_size: Felt, @@ -50,7 +50,7 @@ impl StarkConfig { } } -use swiftness_commitment::vector; +use cairovm_verifier_commitment::vector; use thiserror::Error; #[derive(Error, Debug)] @@ -58,9 +58,9 @@ pub enum Error { #[error("Vector Error")] Vector(#[from] vector::config::Error), #[error("Fri Error")] - Fri(#[from] swiftness_fri::config::Error), + Fri(#[from] cairovm_verifier_fri::config::Error), #[error("Pow Error")] - Pow(#[from] swiftness_pow::config::Error), + Pow(#[from] cairovm_verifier_pow::config::Error), #[error("Trace Error")] - Trace(#[from] swiftness_air::trace::config::Error), + Trace(#[from] cairovm_verifier_air::trace::config::Error), } diff --git a/crates/stark/src/fixtures/commitment.rs b/crates/stark/src/fixtures/commitment.rs index 160aa52..13d6c7f 100644 --- a/crates/stark/src/fixtures/commitment.rs +++ b/crates/stark/src/fixtures/commitment.rs @@ -1,9 +1,9 @@ -use starknet_crypto::Felt; -use swiftness_air::layout::recursive::global_values::InteractionElements; -use swiftness_commitment::{ +use cairovm_verifier_air::layout::recursive::global_values::InteractionElements; +use cairovm_verifier_commitment::{ table::{config::Config as TableCommitmentConfig, types::Commitment as TableCommitment}, vector::{config::Config as VectorCommitmentConfig, types::Commitment as VectorCommitment}, }; +use starknet_crypto::Felt; use crate::types::StarkCommitment; @@ -11,7 +11,7 @@ use super::oods_values; pub fn get() -> StarkCommitment { StarkCommitment { - traces: swiftness_air::fixtures::commitment::get(), + traces: cairovm_verifier_air::fixtures::commitment::get(), composition: TableCommitment { config: TableCommitmentConfig { n_columns: Felt::from_hex_unchecked("0x2"), @@ -439,6 +439,6 @@ pub fn get() -> StarkCommitment { "0x7a702a902f300a47fb79f18195691f2f1cd57fa870b6d4e12d365ed59231506", ), ], - fri: swiftness_fri::fixtures::commitment::get(), + fri: cairovm_verifier_fri::fixtures::commitment::get(), } } diff --git a/crates/stark/src/fixtures/config.rs b/crates/stark/src/fixtures/config.rs index 0766ff3..d74ce61 100644 --- a/crates/stark/src/fixtures/config.rs +++ b/crates/stark/src/fixtures/config.rs @@ -1,14 +1,14 @@ -use starknet_crypto::Felt; -use swiftness_commitment::{ +use cairovm_verifier_commitment::{ table::config::Config as TableCommitmentConfig, vector::config::Config as VectorCommitmentConfig, }; +use starknet_crypto::Felt; use crate::config::StarkConfig; pub fn get() -> StarkConfig { StarkConfig { - traces: swiftness_air::fixtures::config::get(), + traces: cairovm_verifier_air::fixtures::config::get(), composition: TableCommitmentConfig { n_columns: Felt::from_hex_unchecked("0x2"), vector: VectorCommitmentConfig { @@ -16,8 +16,8 @@ pub fn get() -> StarkConfig { n_verifier_friendly_commitment_layers: Felt::from_hex_unchecked("0x64"), }, }, - fri: swiftness_fri::fixtures::config::get(), - proof_of_work: swiftness_pow::fixtures::config::get(), + fri: cairovm_verifier_fri::fixtures::config::get(), + proof_of_work: cairovm_verifier_pow::fixtures::config::get(), log_trace_domain_size: Felt::from_hex_unchecked("0x12"), n_queries: Felt::from_hex_unchecked("0xa"), log_n_cosets: Felt::from_hex_unchecked("0x2"), diff --git a/crates/stark/src/fixtures/domains.rs b/crates/stark/src/fixtures/domains.rs index b4ca842..48f801a 100644 --- a/crates/stark/src/fixtures/domains.rs +++ b/crates/stark/src/fixtures/domains.rs @@ -1,5 +1,5 @@ +use cairovm_verifier_air::domains::StarkDomains; use starknet_crypto::Felt; -use swiftness_air::domains::StarkDomains; pub fn get() -> StarkDomains { StarkDomains { diff --git a/crates/stark/src/fixtures/unsent_commitment.rs b/crates/stark/src/fixtures/unsent_commitment.rs index c1396c5..52e4927 100644 --- a/crates/stark/src/fixtures/unsent_commitment.rs +++ b/crates/stark/src/fixtures/unsent_commitment.rs @@ -4,12 +4,12 @@ use crate::{fixtures::oods_values, types::StarkUnsentCommitment}; pub fn get() -> StarkUnsentCommitment { StarkUnsentCommitment { - traces: swiftness_air::fixtures::unsent_commitment::get(), + traces: cairovm_verifier_air::fixtures::unsent_commitment::get(), composition: Felt::from_hex_unchecked( "0x30b93bbd6b193eb57d9f818202b899b7e8e09b0c7d183537fe85f4e6b6f4373", ), oods_values: oods_values::get(), - fri: swiftness_fri::fixtures::unsent_commitment::get(), - proof_of_work: swiftness_pow::fixtures::unsent_commitment::get(), + fri: cairovm_verifier_fri::fixtures::unsent_commitment::get(), + proof_of_work: cairovm_verifier_pow::fixtures::unsent_commitment::get(), } } diff --git a/crates/stark/src/fixtures/witness.rs b/crates/stark/src/fixtures/witness.rs index 3bed483..b3f2371 100644 --- a/crates/stark/src/fixtures/witness.rs +++ b/crates/stark/src/fixtures/witness.rs @@ -1,15 +1,15 @@ -use starknet_crypto::Felt; -use swiftness_commitment::{ +use cairovm_verifier_commitment::{ table::types::{Decommitment as TableDecommitment, Witness as TableCommitmentWitness}, vector::types::Witness as VectorCommitmentWitness, }; +use starknet_crypto::Felt; use crate::types::StarkWitness; pub fn get() -> StarkWitness { StarkWitness { - traces_decommitment: swiftness_air::fixtures::decommitment::get(), - traces_witness: swiftness_air::fixtures::witness::get(), + traces_decommitment: cairovm_verifier_air::fixtures::decommitment::get(), + traces_witness: cairovm_verifier_air::fixtures::witness::get(), composition_decommitment: TableDecommitment { values: vec![ Felt::from_hex_unchecked( @@ -560,6 +560,6 @@ pub fn get() -> StarkWitness { ], }, }, - fri_witness: swiftness_fri::fixtures::witness::get(), + fri_witness: cairovm_verifier_fri::fixtures::witness::get(), } } diff --git a/crates/stark/src/oods.rs b/crates/stark/src/oods.rs index 7e48db6..4e8f598 100644 --- a/crates/stark/src/oods.rs +++ b/crates/stark/src/oods.rs @@ -1,23 +1,23 @@ use bail_out::assure; -use starknet_crypto::Felt; #[cfg(feature = "dex")] -use swiftness_air::layout::dex::CONSTRAINT_DEGREE; +use cairovm_verifier_air::layout::dex::CONSTRAINT_DEGREE; #[cfg(feature = "recursive")] -use swiftness_air::layout::recursive::CONSTRAINT_DEGREE; +use cairovm_verifier_air::layout::recursive::CONSTRAINT_DEGREE; #[cfg(feature = "recursive_with_poseidon")] -use swiftness_air::layout::recursive_with_poseidon::CONSTRAINT_DEGREE; +use cairovm_verifier_air::layout::recursive_with_poseidon::CONSTRAINT_DEGREE; #[cfg(feature = "small")] -use swiftness_air::layout::small::CONSTRAINT_DEGREE; +use cairovm_verifier_air::layout::small::CONSTRAINT_DEGREE; #[cfg(feature = "starknet")] -use swiftness_air::layout::starknet::CONSTRAINT_DEGREE; +use cairovm_verifier_air::layout::starknet::CONSTRAINT_DEGREE; #[cfg(feature = "starknet_with_keccak")] -use swiftness_air::layout::starknet_with_keccak::CONSTRAINT_DEGREE; -use swiftness_air::{ +use cairovm_verifier_air::layout::starknet_with_keccak::CONSTRAINT_DEGREE; +use cairovm_verifier_air::{ layout::{CompositionPolyEvalError, LayoutTrait}, public_memory::PublicInput, trace, }; -use swiftness_commitment::table; +use cairovm_verifier_commitment::table; +use starknet_crypto::Felt; pub struct OodsEvaluationInfo { pub oods_values: Vec, diff --git a/crates/stark/src/queries.rs b/crates/stark/src/queries.rs index 28f4f87..bccb010 100644 --- a/crates/stark/src/queries.rs +++ b/crates/stark/src/queries.rs @@ -1,7 +1,7 @@ +use cairovm_verifier_air::domains::StarkDomains; +use cairovm_verifier_transcript::transcript::Transcript; use starknet_core::types::NonZeroFelt; use starknet_crypto::Felt; -use swiftness_air::domains::StarkDomains; -use swiftness_transcript::transcript::Transcript; const FIELD_GENERATOR: Felt = Felt::from_hex_unchecked("0x3"); diff --git a/crates/stark/src/stark.rs b/crates/stark/src/stark.rs index 7528fca..193cd77 100644 --- a/crates/stark/src/stark.rs +++ b/crates/stark/src/stark.rs @@ -2,17 +2,19 @@ use crate::{ commit::stark_commit, queries::generate_queries, types::StarkProof, verify::stark_verify, }; #[cfg(feature = "dex")] -use swiftness_air::layout::dex::{NUM_COLUMNS_FIRST, NUM_COLUMNS_SECOND}; +use cairovm_verifier_air::layout::dex::{NUM_COLUMNS_FIRST, NUM_COLUMNS_SECOND}; #[cfg(feature = "recursive")] -use swiftness_air::layout::recursive::{NUM_COLUMNS_FIRST, NUM_COLUMNS_SECOND}; +use cairovm_verifier_air::layout::recursive::{NUM_COLUMNS_FIRST, NUM_COLUMNS_SECOND}; #[cfg(feature = "recursive_with_poseidon")] -use swiftness_air::layout::recursive_with_poseidon::{NUM_COLUMNS_FIRST, NUM_COLUMNS_SECOND}; +use cairovm_verifier_air::layout::recursive_with_poseidon::{ + NUM_COLUMNS_FIRST, NUM_COLUMNS_SECOND, +}; #[cfg(feature = "small")] -use swiftness_air::layout::small::{NUM_COLUMNS_FIRST, NUM_COLUMNS_SECOND}; +use cairovm_verifier_air::layout::small::{NUM_COLUMNS_FIRST, NUM_COLUMNS_SECOND}; #[cfg(feature = "starknet")] -use swiftness_air::layout::starknet::{NUM_COLUMNS_FIRST, NUM_COLUMNS_SECOND}; +use cairovm_verifier_air::layout::starknet::{NUM_COLUMNS_FIRST, NUM_COLUMNS_SECOND}; #[cfg(feature = "starknet_with_keccak")] -use swiftness_air::layout::starknet_with_keccak::{NUM_COLUMNS_FIRST, NUM_COLUMNS_SECOND}; +use cairovm_verifier_air::layout::starknet_with_keccak::{NUM_COLUMNS_FIRST, NUM_COLUMNS_SECOND}; impl StarkProof { pub fn verify(&self, security_bits: Felt) -> Result<(Felt, Felt), Error> { @@ -59,12 +61,12 @@ impl StarkProof { } } -use starknet_crypto::Felt; -use swiftness_air::{ +use cairovm_verifier_air::{ domains::StarkDomains, layout::{LayoutTrait, PublicInputError}, }; -use swiftness_transcript::transcript::Transcript; +use cairovm_verifier_transcript::transcript::Transcript; +use starknet_crypto::Felt; use thiserror::Error; #[derive(Error, Debug)] diff --git a/crates/stark/src/tests/commit.rs b/crates/stark/src/tests/commit.rs index cda0389..6feec1e 100644 --- a/crates/stark/src/tests/commit.rs +++ b/crates/stark/src/tests/commit.rs @@ -1,6 +1,6 @@ +use cairovm_verifier_air::{fixtures::public_input, layout::recursive::Layout}; +use cairovm_verifier_transcript::transcript::Transcript; use starknet_crypto::Felt; -use swiftness_air::{fixtures::public_input, layout::recursive::Layout}; -use swiftness_transcript::transcript::Transcript; use crate::{ commit::stark_commit, diff --git a/crates/stark/src/tests/proof.rs b/crates/stark/src/tests/proof.rs index ee3f6e8..23a4635 100644 --- a/crates/stark/src/tests/proof.rs +++ b/crates/stark/src/tests/proof.rs @@ -2,8 +2,8 @@ use crate::{ fixtures::{config, unsent_commitment, witness}, types::StarkProof, }; +use cairovm_verifier_air::{fixtures::public_input, layout::recursive::Layout}; use starknet_crypto::Felt; -use swiftness_air::{fixtures::public_input, layout::recursive::Layout}; #[test] fn test_stark_proof_fibonacci_verify() { diff --git a/crates/stark/src/tests/verify.rs b/crates/stark/src/tests/verify.rs index e7626bf..7de58b8 100644 --- a/crates/stark/src/tests/verify.rs +++ b/crates/stark/src/tests/verify.rs @@ -2,8 +2,8 @@ use crate::{ fixtures::{commitment, domains, witness}, verify::stark_verify, }; -use swiftness_air::layout::recursive::{Layout, NUM_COLUMNS_FIRST, NUM_COLUMNS_SECOND}; -use swiftness_fri::fixtures::queries; +use cairovm_verifier_air::layout::recursive::{Layout, NUM_COLUMNS_FIRST, NUM_COLUMNS_SECOND}; +use cairovm_verifier_fri::fixtures::queries; #[test] pub fn test_stark_verify() { diff --git a/crates/stark/src/types.rs b/crates/stark/src/types.rs index 6adc794..239c406 100644 --- a/crates/stark/src/types.rs +++ b/crates/stark/src/types.rs @@ -8,7 +8,7 @@ use crate::config; #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct StarkProof { pub config: config::StarkConfig, - pub public_input: swiftness_air::public_memory::PublicInput, + pub public_input: cairovm_verifier_air::public_memory::PublicInput, pub unsent_commitment: StarkUnsentCommitment, pub witness: StarkWitness, } @@ -16,7 +16,7 @@ pub struct StarkProof { #[serde_as] #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct StarkUnsentCommitment { - pub traces: swiftness_air::trace::UnsentCommitment, + pub traces: cairovm_verifier_air::trace::UnsentCommitment, #[serde_as(as = "UfeHex")] pub composition: Felt, // n_oods_values elements. The i-th value is the evaluation of the i-th mask item polynomial at @@ -24,29 +24,29 @@ pub struct StarkUnsentCommitment { // corresponding column shifted by the corresponding row_offset. #[serde_as(as = "Vec")] pub oods_values: Vec, - pub fri: swiftness_fri::types::UnsentCommitment, - pub proof_of_work: swiftness_pow::pow::UnsentCommitment, + pub fri: cairovm_verifier_fri::types::UnsentCommitment, + pub proof_of_work: cairovm_verifier_pow::pow::UnsentCommitment, } #[serde_as] #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct StarkCommitment { - pub traces: swiftness_air::trace::Commitment, - pub composition: swiftness_commitment::table::types::Commitment, + pub traces: cairovm_verifier_air::trace::Commitment, + pub composition: cairovm_verifier_commitment::table::types::Commitment, #[serde_as(as = "UfeHex")] pub interaction_after_composition: Felt, #[serde_as(as = "Vec")] pub oods_values: Vec, #[serde_as(as = "Vec")] pub interaction_after_oods: Vec, - pub fri: swiftness_fri::types::Commitment, + pub fri: cairovm_verifier_fri::types::Commitment, } #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct StarkWitness { - pub traces_decommitment: swiftness_air::trace::Decommitment, - pub traces_witness: swiftness_air::trace::Witness, - pub composition_decommitment: swiftness_commitment::table::types::Decommitment, - pub composition_witness: swiftness_commitment::table::types::Witness, - pub fri_witness: swiftness_fri::types::Witness, + pub traces_decommitment: cairovm_verifier_air::trace::Decommitment, + pub traces_witness: cairovm_verifier_air::trace::Witness, + pub composition_decommitment: cairovm_verifier_commitment::table::types::Decommitment, + pub composition_witness: cairovm_verifier_commitment::table::types::Witness, + pub fri_witness: cairovm_verifier_fri::types::Witness, } diff --git a/crates/stark/src/verify.rs b/crates/stark/src/verify.rs index e81b160..91b9747 100644 --- a/crates/stark/src/verify.rs +++ b/crates/stark/src/verify.rs @@ -1,10 +1,10 @@ -use starknet_crypto::Felt; -use swiftness_air::{domains::StarkDomains, layout::LayoutTrait}; -use swiftness_commitment::table::decommit::table_decommit; -use swiftness_fri::{ +use cairovm_verifier_air::{domains::StarkDomains, layout::LayoutTrait}; +use cairovm_verifier_commitment::table::decommit::table_decommit; +use cairovm_verifier_fri::{ fri::{self, fri_verify}, types, }; +use starknet_crypto::Felt; use crate::{ oods::{eval_oods_boundary_poly_at_points, OodsEvaluationInfo}, @@ -68,8 +68,8 @@ pub enum Error { FriError(#[from] fri::Error), #[error("TraceDecommit Error")] - TraceDecommitError(#[from] swiftness_air::trace::decommit::Error), + TraceDecommitError(#[from] cairovm_verifier_air::trace::decommit::Error), #[error("TableDecommit Error")] - TableDecommitError(#[from] swiftness_commitment::table::decommit::Error), + TableDecommitError(#[from] cairovm_verifier_commitment::table::decommit::Error), } diff --git a/crates/transcript/Cargo.toml b/crates/transcript/Cargo.toml index 142411f..44ec0fd 100644 --- a/crates/transcript/Cargo.toml +++ b/crates/transcript/Cargo.toml @@ -1,11 +1,12 @@ [package] -name = "swiftness_transcript" +name = "cairovm_verifier_transcript" description.workspace = true edition.workspace = true +homepage.workspace = true license-file.workspace = true -readme = "README.md" +readme.workspace = true repository.workspace = true -version = "0.0.3" +version.workspace = true [dependencies] starknet-crypto.workspace = true \ No newline at end of file diff --git a/crates/transcript/README.md b/crates/transcript/README.md deleted file mode 100644 index afa73bf..0000000 --- a/crates/transcript/README.md +++ /dev/null @@ -1 +0,0 @@ -# Swiftness Transcript CairoVM Verifier \ No newline at end of file diff --git a/Dockerfile b/dockerfile similarity index 100% rename from Dockerfile rename to dockerfile diff --git a/proof-parser/Cargo.toml b/proof-parser/Cargo.toml index e507e7e..e45fbef 100644 --- a/proof-parser/Cargo.toml +++ b/proof-parser/Cargo.toml @@ -1,11 +1,12 @@ [package] -name = "swiftness_proof_parser" +name = "cairovm_verifier_proof_parser" description.workspace = true edition.workspace = true +homepage.workspace = true license-file.workspace = true -readme = "README.md" +readme.workspace = true repository.workspace = true -version = "0.0.3" +version.workspace = true [dependencies] serde.workspace = true @@ -17,8 +18,8 @@ clap = { version = "4.5.1", features = ["derive"] } regex = "1.10.3" serde_json = "1.0.114" -swiftness_stark.workspace = true -swiftness_commitment.workspace = true -swiftness_fri.workspace = true -swiftness_air.workspace = true -swiftness_pow.workspace = true \ No newline at end of file +cairovm_verifier_stark.workspace = true +cairovm_verifier_commitment.workspace = true +cairovm_verifier_fri.workspace = true +cairovm_verifier_air.workspace = true +cairovm_verifier_pow.workspace = true \ No newline at end of file diff --git a/proof-parser/README.md b/proof-parser/README.md deleted file mode 100644 index 7d4e2bc..0000000 --- a/proof-parser/README.md +++ /dev/null @@ -1 +0,0 @@ -# Swiftness Proof Parser CairoVM Verifier \ No newline at end of file diff --git a/proof-parser/src/conversion.rs b/proof-parser/src/conversion.rs index f9506fd..c403bb1 100644 --- a/proof-parser/src/conversion.rs +++ b/proof-parser/src/conversion.rs @@ -1,4 +1,4 @@ -use swiftness_air::{ +use cairovm_verifier_air::{ public_memory::PublicInput as PublicInputVerifier, trace::{ config::Config as TraceConfigVerifier, Decommitment as TraceDecommitmentVerifier, @@ -6,7 +6,7 @@ use swiftness_air::{ }, types::{AddrValue, Page, SegmentInfo as SegmentInfoVerifier}, }; -use swiftness_commitment::{ +use cairovm_verifier_commitment::{ table::{ config::Config as TableConfigVerifier, types::{ @@ -17,17 +17,17 @@ use swiftness_commitment::{ config::Config as VectorConfigVerifier, types::Witness as VectorCommitmentWitnessVerifier, }, }; -use swiftness_fri::{ +use cairovm_verifier_fri::{ config::Config as FriConfigVerifier, types::{ LayerWitness, UnsentCommitment as FriUnsentCommitmentVerifier, Witness as FriWitnessVerifier, }, }; -use swiftness_pow::{ +use cairovm_verifier_pow::{ config::Config as PowConfigVerifier, pow::UnsentCommitment as PowUnsentCommitmentVerifier, }; -use swiftness_stark::{ +use cairovm_verifier_stark::{ config::StarkConfig as StarkConfigVerifier, types::{ StarkProof as StarkProofVerifier, StarkUnsentCommitment as StarkUnsentCommitmentVerifier, diff --git a/proof-parser/src/lib.rs b/proof-parser/src/lib.rs index ea953b8..b820a4b 100644 --- a/proof-parser/src/lib.rs +++ b/proof-parser/src/lib.rs @@ -12,7 +12,7 @@ extern crate clap; extern crate num_bigint; extern crate regex; extern crate serde; -use swiftness_stark::types::StarkProof as StarkProofFromVerifier; +use cairovm_verifier_stark::types::StarkProof as StarkProofFromVerifier; pub fn parse(input: String) -> anyhow::Result { let proof_json = serde_json::from_str::(&input)?; diff --git a/wasm-binding/Cargo.toml b/wasm-binding/Cargo.toml index 4c24945..ebe53aa 100644 --- a/wasm-binding/Cargo.toml +++ b/wasm-binding/Cargo.toml @@ -1,19 +1,20 @@ [package] -name = "swiftness_wasm" -description = "Swiftness CairoVM Verifier | swiftness-{layout}-{commitment hash}" +name = "cairovm_verifier_wasm" +description = "CairoVM verifier - starknet_with_keccak & blake2s" edition.workspace = true +homepage.workspace = true license = "Apache-2.0" -readme = "README.md" +readme.workspace = true repository.workspace = true -version = "0.0.3" +version.workspace = true [dependencies] serde_json.workspace = true wasm-bindgen.workspace = true -swiftness_air = { workspace = true } -swiftness_stark = { workspace = true } -swiftness_proof_parser = { workspace = true } +cairovm_verifier_air = { workspace = true, default-features = false } +cairovm_verifier_stark = { workspace = true, default-features = false } +cairovm_verifier_proof_parser = { workspace = true, default-features = false } [lib] crate-type = ["cdylib", "rlib"] @@ -22,7 +23,7 @@ crate-type = ["cdylib", "rlib"] getrandom = { version = "0.2.15", features = ["js"] } [features] -default = ["starknet_with_keccak", "blake2s"] +default = ["starknet_with_keccak", "keccak"] dex = [] recursive = [] recursive_with_poseidon = [] diff --git a/wasm-binding/README.md b/wasm-binding/README.md index d334fe9..5557fe6 100644 --- a/wasm-binding/README.md +++ b/wasm-binding/README.md @@ -1,24 +1,17 @@ -# Swiftness CairoVM Verifier +# Cairo-VM Verifier ![Version](https://img.shields.io/badge/v0.0.3-green?style=flat-square&logo=git&logoColor=white&label=version) -![Continuous Integration](https://img.shields.io/github/actions/workflow/status/iosis-tech/swiftness/ci.yml?style=flat-square&logo=githubactions&logoColor=white&label=Continuous%20Integration) +![Continuous Integration](https://img.shields.io/github/actions/workflow/status/iosis-tech/cairovm-verifier/ci.yml?style=flat-square&logo=githubactions&logoColor=white&label=Continuous%20Integration) This is the Rust implementation of the Cairo-VM STARK verifier with layouts. The code is inspired by StarkWare's [Cairo-verifier](https://github.com/starkware-libs/cairo-lang) implementation in Cairo0. -### Example usage -```js -import init, { verify_proof } from 'swiftness-{layout}-{commitment hash}'; - -async function run(proof_json) { - await init(); // Initialize the Wasm module - try { - const [programHash, programOutput] = JSON.parse( await verify_proof(proof_json) ); - } catch (err) { - console.error(`Verification failed: ${err}`); - } -} +### Install wasm-pack +```sh +cargo install wasm-pack ``` -## Contributing +### Build WASM: -Feel free to open issues or submit pull requests to help improve this project. +```sh +wasm-pack build --target bundler --workspace --features starknet_with_keccak,blake2s --no-default-features +``` \ No newline at end of file diff --git a/wasm-binding/pkg/README.md b/wasm-binding/pkg/README.md new file mode 100644 index 0000000..f422517 --- /dev/null +++ b/wasm-binding/pkg/README.md @@ -0,0 +1,24 @@ +# Cairo-VM Verifier + +![Version](https://img.shields.io/badge/v0.0.3-green?style=flat-square&logo=git&logoColor=white&label=version) +![Continuous Integration](https://img.shields.io/github/actions/workflow/status/iosis-tech/cairovm-verifier/ci.yml?style=flat-square&logo=githubactions&logoColor=white&label=Continuous%20Integration) + +This is the Rust implementation of the Cairo-VM STARK verifier with layouts. The code is inspired by StarkWare's [Cairo-verifier](https://github.com/starkware-libs/cairo-lang) implementation in Cairo0. + +### Example usage +```js +import init, { cairovm_verify } from 'cairovm_verifier'; + +async function run(proof_json) { + await init(); // Initialize the Wasm module + try { + const [programHash, programOutput] = JSON.parse( await cairovm_verify(proof_json) ); + } catch (err) { + console.error(`Verification failed: ${err}`); + } +} +``` + +## Contributing + +Feel free to open issues or submit pull requests to help improve this project. diff --git a/wasm-binding/pkg/package.json b/wasm-binding/pkg/package.json new file mode 100644 index 0000000..3674ad6 --- /dev/null +++ b/wasm-binding/pkg/package.json @@ -0,0 +1,23 @@ +{ + "name": "cairovm_verifier", + "type": "module", + "keywords": ["stark", "wasm", "verifier", "cairovm"], + "description": "CairoVM verifier - starknet_with_keccak & blake2s", + "version": "0.0.3", + "license": "Apache-2.0", + "repository": { + "type": "git", + "url": "https://github.com/iosis-tech/cairovm-verifier" + }, + "files": [ + "cairovm_verifier_wasm_bg.wasm", + "cairovm_verifier_wasm.js", + "cairovm_verifier_wasm.d.ts" + ], + "main": "cairovm_verifier_wasm.js", + "homepage": "", + "types": "cairovm_verifier_wasm.d.ts", + "sideEffects": [ + "./snippets/*" + ] +} \ No newline at end of file diff --git a/wasm-binding/src/lib.rs b/wasm-binding/src/lib.rs index 608d9fb..5fd8925 100644 --- a/wasm-binding/src/lib.rs +++ b/wasm-binding/src/lib.rs @@ -1,21 +1,21 @@ #[cfg(feature = "dex")] -use swiftness_air::layout::dex::Layout; +use cairovm_verifier_air::layout::dex::Layout; #[cfg(feature = "recursive")] -use swiftness_air::layout::recursive::Layout; +use cairovm_verifier_air::layout::recursive::Layout; #[cfg(feature = "recursive_with_poseidon")] -use swiftness_air::layout::recursive_with_poseidon::Layout; +use cairovm_verifier_air::layout::recursive_with_poseidon::Layout; #[cfg(feature = "small")] -use swiftness_air::layout::small::Layout; +use cairovm_verifier_air::layout::small::Layout; #[cfg(feature = "starknet")] -use swiftness_air::layout::starknet::Layout; +use cairovm_verifier_air::layout::starknet::Layout; #[cfg(feature = "starknet_with_keccak")] -use swiftness_air::layout::starknet_with_keccak::Layout; +use cairovm_verifier_air::layout::starknet_with_keccak::Layout; -use swiftness_proof_parser::parse; +use cairovm_verifier_proof_parser::parse; use wasm_bindgen::prelude::*; #[wasm_bindgen] -pub fn verify_proof(proof: JsValue) -> Result { +pub fn cairovm_verify(proof: JsValue) -> Result { // Deserialize input from JsValue to Rust types let proof_str: String = proof.as_string().ok_or_else(|| JsError::new("Invalid input"))?; @@ -24,8 +24,9 @@ pub fn verify_proof(proof: JsValue) -> Result { // Get security bits and verify let security_bits = stark_proof.config.security_bits(); - let (program_hash, output_hash) = - stark_proof.verify::(security_bits).map_err(|e| JsError::new(&e.to_string()))?; + let (program_hash, output_hash) = stark_proof + .verify::(security_bits) + .map_err(|e| JsError::new(&e.to_string()))?; // Serialize result to JsValue let result = serde_json::to_value((program_hash, output_hash))