diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml new file mode 100644 index 0000000..8ca4c2b --- /dev/null +++ b/.github/actions/setup/action.yml @@ -0,0 +1,58 @@ +name: Setup Environment +description: Setup Rust, Node.js, Circom and SnarkJS for testing + +inputs: + rust-toolchain: + description: "Rust toolchain version" + required: false + default: "1.90.0" + node-version: + description: "Node.js version" + required: false + default: "22" + circom-version: + description: "Circom version" + required: false + default: "v2.2.2" + +runs: + using: composite + steps: + - name: Install Rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: ${{ inputs.rust-toolchain }} + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ inputs.node-version }} + + - name: Cache circom installation + id: cache-circom + uses: actions/cache@v4 + with: + path: ~/.cargo/bin/circom + key: circom-${{ runner.os }}-${{ inputs.circom-version }} + + - name: Install circom + if: steps.cache-circom.outputs.cache-hit != 'true' + shell: bash + run: | + wget -q https://github.com/iden3/circom/releases/download/${{ inputs.circom-version }}/circom-linux-amd64 + chmod +x circom-linux-amd64 + mv circom-linux-amd64 ~/.cargo/bin/circom + + - name: Install snarkjs + shell: bash + run: npm install -g snarkjs + + - name: Display versions + shell: bash + run: | + rustc --version + cargo --version + node --version + npm --version + circom --version + snarkjs --help | head -1 || true diff --git a/.github/workflows/rust-tests.yml b/.github/workflows/rust-tests.yml new file mode 100644 index 0000000..39535d9 --- /dev/null +++ b/.github/workflows/rust-tests.yml @@ -0,0 +1,47 @@ +name: Rust + +on: + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened] + branches: + - master + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + RUST_TOOLCHAIN: "1.90.0" + NODE_VERSION: "22" + CIRCOM_VERSION: "v2.2.2" + +jobs: + test-rust: + name: Test Workspace + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup environment + uses: ./.github/actions/setup + with: + rust-toolchain: ${{ env.RUST_TOOLCHAIN }} + node-version: ${{ env.NODE_VERSION }} + circom-version: ${{ env.CIRCOM_VERSION }} + + - name: Install npm dependencies (for circuit compilation) + working-directory: tests/rust-vk + run: npm install + + - name: Compile circuit and generate keys + working-directory: tests/rust-vk + run: npm run build-all + + - name: Build workspace + run: cargo build --workspace + + - name: Test workspace + run: cargo test --workspace diff --git a/.gitignore b/.gitignore index 5feb907..f3c831f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ target -node_modules \ No newline at end of file +node_modules +pot +build +.DS_Store diff --git a/Cargo.lock b/Cargo.lock index 1d6845b..e0daff1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -20,6 +20,24 @@ version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" +[[package]] +name = "anyhow" +version = "1.0.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" + +[[package]] +name = "ark-bls12-381" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3df4dcc01ff89867cd86b0da835f23c3f02738353aaee7dde7495af71363b8d5" +dependencies = [ + "ark-ec 0.5.0", + "ark-ff 0.5.0", + "ark-serialize 0.5.0", + "ark-std 0.5.0", +] + [[package]] name = "ark-bn254" version = "0.4.0" @@ -42,6 +60,40 @@ dependencies = [ "ark-std 0.5.0", ] +[[package]] +name = "ark-crypto-primitives" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0c292754729c8a190e50414fd1a37093c786c709899f29c9f7daccecfa855e" +dependencies = [ + "ahash", + "ark-crypto-primitives-macros", + "ark-ec 0.5.0", + "ark-ff 0.5.0", + "ark-relations", + "ark-serialize 0.5.0", + "ark-snark", + "ark-std 0.5.0", + "blake2", + "derivative", + "digest", + "fnv", + "merlin", + "rayon", + "sha2", +] + +[[package]] +name = "ark-crypto-primitives-macros" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e89fe77d1f0f4fe5b96dfc940923d88d17b6a773808124f21e764dfb063c6a" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "ark-ec" version = "0.4.2" @@ -77,6 +129,7 @@ dependencies = [ "num-bigint", "num-integer", "num-traits", + "rayon", "zeroize", ] @@ -117,6 +170,7 @@ dependencies = [ "num-bigint", "num-traits", "paste", + "rayon", "zeroize", ] @@ -166,6 +220,22 @@ dependencies = [ "syn 2.0.100", ] +[[package]] +name = "ark-groth16" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88f1d0f3a534bb54188b8dcc104307db6c56cdae574ddc3212aec0625740fc7e" +dependencies = [ + "ark-crypto-primitives", + "ark-ec 0.5.0", + "ark-ff 0.5.0", + "ark-poly 0.5.0", + "ark-relations", + "ark-serialize 0.5.0", + "ark-std 0.5.0", + "rayon", +] + [[package]] name = "ark-poly" version = "0.4.2" @@ -192,6 +262,19 @@ dependencies = [ "educe", "fnv", "hashbrown 0.15.2", + "rayon", +] + +[[package]] +name = "ark-relations" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec46ddc93e7af44bcab5230937635b06fb5744464dd6a7e7b083e80ebd274384" +dependencies = [ + "ark-ff 0.5.0", + "ark-std 0.5.0", + "tracing", + "tracing-subscriber", ] [[package]] @@ -217,6 +300,7 @@ dependencies = [ "arrayvec", "digest", "num-bigint", + "rayon", ] [[package]] @@ -241,6 +325,18 @@ dependencies = [ "syn 2.0.100", ] +[[package]] +name = "ark-snark" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d368e2848c2d4c129ce7679a7d0d2d612b6a274d3ea6a13bad4445d61b381b88" +dependencies = [ + "ark-ff 0.5.0", + "ark-relations", + "ark-serialize 0.5.0", + "ark-std 0.5.0", +] + [[package]] name = "ark-std" version = "0.4.0" @@ -259,6 +355,7 @@ checksum = "246a225cc6131e9ee4f24619af0f19d67761fff15d7ccc22e42b80846e69449a" dependencies = [ "num-traits", "rand", + "rayon", ] [[package]] @@ -279,6 +376,90 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" +[[package]] +name = "bitflags" +version = "2.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394" + +[[package]] +name = "blake2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" +dependencies = [ + "digest", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "borsh" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115e54d64eb62cdebad391c19efc9dce4981c690c85a33a12199d99bb9546fee" +dependencies = [ + "borsh-derive", + "hashbrown 0.13.2", +] + +[[package]] +name = "borsh-derive" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "831213f80d9423998dd696e2c5345aba6be7a0bd8cd19e31c5243e13df1cef89" +dependencies = [ + "borsh-derive-internal", + "borsh-schema-derive-internal", + "proc-macro-crate", + "proc-macro2", + "syn 1.0.109", +] + +[[package]] +name = "borsh-derive-internal" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65d6ba50644c98714aa2a70d13d7df3cd75cd2b523a2b452bf010443800976b3" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "borsh-schema-derive-internal" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "276691d96f063427be83e6692b86148e488ebba9f48f77788724ca027ba3b6d4" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "bs58" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "bumpalo" +version = "3.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" + [[package]] name = "bytemuck" version = "1.22.0" @@ -299,12 +480,94 @@ dependencies = [ "syn 2.0.100", ] +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "cc" +version = "1.2.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac9fe6cdbb24b6ade63616c0a0688e45bb56732262c158df3c0c4bea4ca47cb7" +dependencies = [ + "find-msvc-tools", + "jobserver", + "libc", + "shlex", +] + [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "circom-prover" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82cb9d752c87c707a7741ee2b1f9186780e20b8ea0ddb9fd288173ee10ba738e" +dependencies = [ + "anyhow", + "ark-bls12-381", + "ark-bn254 0.5.0", + "ark-crypto-primitives", + "ark-ec 0.5.0", + "ark-ff 0.5.0", + "ark-groth16", + "ark-poly 0.5.0", + "ark-relations", + "ark-serialize 0.5.0", + "ark-std 0.5.0", + "byteorder", + "hex-literal", + "num", + "num-bigint", + "num-traits", + "rand", + "rayon", + "rust-witness", + "serde", + "serde_json", + "uuid", +] + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + [[package]] name = "crypto-common" version = "0.1.6" @@ -332,7 +595,9 @@ version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ + "block-buffer", "crypto-common", + "subtle", ] [[package]] @@ -373,6 +638,36 @@ dependencies = [ "syn 2.0.100", ] +[[package]] +name = "find-msvc-tools" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52051878f80a721bb68ebfbc930e07b65ba72f2da88968ea5c06fd6ca3d3a127" + +[[package]] +name = "five8" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75b8549488b4715defcb0d8a8a1c1c76a80661b5fa106b4ca0e7fce59d7d875" +dependencies = [ + "five8_core", +] + +[[package]] +name = "five8_const" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26dec3da8bc3ef08f2c04f61eab298c3ab334523e55f076354d6d6f613799a7b" +dependencies = [ + "five8_core", +] + +[[package]] +name = "five8_core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2551bf44bc5f776c15044b9b94153a00198be06743e262afaaa61f11ac7523a5" + [[package]] name = "fnv" version = "1.0.7" @@ -389,6 +684,31 @@ dependencies = [ "version_check", ] +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasip2", +] + [[package]] name = "groth16-solana" version = "0.2.0" @@ -396,9 +716,11 @@ dependencies = [ "ark-bn254 0.5.0", "ark-ec 0.5.0", "ark-ff 0.5.0", + "ark-groth16", "ark-serialize 0.5.0", "ark-std 0.5.0", "array-bytes", + "circom-prover", "num-bigint", "serde", "serde_json", @@ -424,6 +746,12 @@ dependencies = [ "allocator-api2", ] +[[package]] +name = "hex-literal" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" + [[package]] name = "itertools" version = "0.10.5" @@ -449,104 +777,452 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] -name = "memchr" -version = "2.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" - -[[package]] -name = "num-bigint" -version = "0.4.6" +name = "jobserver" +version = "0.1.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" dependencies = [ - "num-integer", - "num-traits", + "getrandom 0.3.4", + "libc", ] [[package]] -name = "num-integer" -version = "0.1.46" +name = "js-sys" +version = "0.3.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +checksum = "ec48937a97411dcb524a265206ccd4c90bb711fca92b2792c407f268825b9305" dependencies = [ - "num-traits", + "once_cell", + "wasm-bindgen", ] [[package]] -name = "num-traits" -version = "0.2.19" +name = "keccak" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" dependencies = [ - "autocfg", + "cpufeatures", ] [[package]] -name = "once_cell" -version = "1.21.3" +name = "lazy_static" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] -name = "paste" -version = "1.0.15" +name = "libc" +version = "0.2.177" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" [[package]] -name = "ppv-lite86" -version = "0.2.21" +name = "light-compressed-account" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +checksum = "c0985921012ffc149596eac90d1170399bb70dbebfa2212bb72b2da30a558ec6" dependencies = [ - "zerocopy 0.8.24", + "borsh", + "light-hasher", + "light-macros", + "light-program-profiler", + "light-zero-copy", + "solana-msg", + "solana-pubkey", + "thiserror 2.0.12", + "zerocopy 0.8.27", ] [[package]] -name = "proc-macro2" -version = "1.0.95" +name = "light-hasher" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +checksum = "a7b8b99f626dbfe0e9731a214e2b2e8990341f5fdb249744661ab7f3029d9859" dependencies = [ - "unicode-ident", + "ark-bn254 0.5.0", + "ark-ff 0.5.0", + "arrayvec", + "borsh", + "light-poseidon", + "num-bigint", + "sha2", + "sha3", + "solana-nostd-keccak", + "solana-program-error", + "solana-pubkey", + "thiserror 2.0.12", ] [[package]] -name = "quote" -version = "1.0.40" +name = "light-indexed-array" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +checksum = "271ba5b246a77e0d4797d6f1752ec3ca627b2359a669189c198f5e104951d928" dependencies = [ - "proc-macro2", + "light-hasher", + "num-bigint", + "num-traits", + "thiserror 2.0.12", ] [[package]] -name = "rand" -version = "0.8.5" +name = "light-macros" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +checksum = "861c0817697c1201c2235cd831fcbaa2564a5f778e5229e9f5cc21035e97c273" dependencies = [ - "rand_chacha", - "rand_core", + "bs58", + "proc-macro2", + "quote", + "syn 2.0.100", ] [[package]] -name = "rand_chacha" -version = "0.3.1" +name = "light-merkle-tree-reference" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +checksum = "93b3c707e7d506c1c0f1d94520c5d8d93eb59eb599ead658a7eb22416c04a590" dependencies = [ - "ppv-lite86", - "rand_core", + "light-hasher", + "light-indexed-array", + "num-bigint", + "num-traits", + "thiserror 2.0.12", ] [[package]] -name = "rand_core" -version = "0.6.4" +name = "light-poseidon" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" - +checksum = "39e3d87542063daaccbfecd78b60f988079b6ec4e089249658b9455075c78d42" +dependencies = [ + "ark-bn254 0.5.0", + "ark-ff 0.5.0", + "num-bigint", + "thiserror 1.0.69", +] + +[[package]] +name = "light-profiler-macro" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a8be18fe4de58a6f754caa74a3fbc6d8a758a26f1f3c24d5b0f5b55df5f5408" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "light-program-profiler" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1d345871581aebd8825868a3f08410290aa1cdddcb189ca7f7e588f61d79fcf" +dependencies = [ + "light-profiler-macro", +] + +[[package]] +name = "light-zero-copy" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f4167c97f1291176414af783c01b647292d809ec14f991884c6d91b9ca2213e" +dependencies = [ + "light-zero-copy-derive", + "zerocopy 0.8.27", +] + +[[package]] +name = "light-zero-copy-derive" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "552463371ee2a6383882b17f7ed1a6803dbc9cb3c0188e0c74a014c2eb22f29e" +dependencies = [ + "lazy_static", + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "merlin" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58c38e2799fc0978b65dfff8023ec7843e2330bb462f19198840b34b6582397d" +dependencies = [ + "byteorder", + "keccak", + "rand_core", + "zeroize", +] + +[[package]] +name = "num" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" +dependencies = [ + "num-bigint", + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", + "rand", + "serde", +] + +[[package]] +name = "num-complex" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" +dependencies = [ + "num-bigint", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy 0.8.27", +] + +[[package]] +name = "proc-macro-crate" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" +dependencies = [ + "toml", +] + +[[package]] +name = "proc-macro2" +version = "1.0.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.16", +] + +[[package]] +name = "rayon" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags", +] + +[[package]] +name = "rust-vk-integration-test" +version = "0.1.0" +dependencies = [ + "circom-prover", + "groth16-solana", + "light-compressed-account", + "light-hasher", + "light-merkle-tree-reference", + "num-bigint", + "rust-witness", + "serde_json", +] + +[[package]] +name = "rust-witness" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b59361683f7b6b3b0d343fc77e797ee5a267b8a470b9531ed9911aeed160dea0" +dependencies = [ + "cc", + "fnv", + "num-bigint", + "num-traits", + "paste", + "walkdir", +] + [[package]] name = "rustc_version" version = "0.4.1" @@ -556,12 +1232,33 @@ dependencies = [ "semver", ] +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + [[package]] name = "ryu" version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + [[package]] name = "semver" version = "1.0.26" @@ -600,6 +1297,48 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest", + "keccak", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "solana-atomic-u64" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52e52720efe60465b052b9e7445a01c17550666beec855cce66f44766697bc2" +dependencies = [ + "parking_lot", +] + [[package]] name = "solana-bn254" version = "2.2.2" @@ -615,12 +1354,121 @@ dependencies = [ "thiserror 2.0.12", ] +[[package]] +name = "solana-decode-error" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c781686a18db2f942e70913f7ca15dc120ec38dcab42ff7557db2c70c625a35" +dependencies = [ + "num-traits", +] + [[package]] name = "solana-define-syscall" version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf784bb2cb3e02cac9801813c30187344228d2ae952534902108f6150573a33d" +[[package]] +name = "solana-hash" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b96e9f0300fa287b545613f007dfe20043d7812bee255f418c1eb649c93b63" +dependencies = [ + "five8", + "js-sys", + "solana-atomic-u64", + "solana-sanitize", + "wasm-bindgen", +] + +[[package]] +name = "solana-instruction" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47298e2ce82876b64f71e9d13a46bc4b9056194e7f9937ad3084385befa50885" +dependencies = [ + "getrandom 0.2.16", + "js-sys", + "num-traits", + "solana-define-syscall", + "solana-pubkey", + "wasm-bindgen", +] + +[[package]] +name = "solana-msg" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f36a1a14399afaabc2781a1db09cb14ee4cc4ee5c7a5a3cfcc601811379a8092" +dependencies = [ + "solana-define-syscall", +] + +[[package]] +name = "solana-nostd-keccak" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8ced70920435b1baa58f76e6f84bbc1110ddd1d6161ec76b6d731ae8431e9c4" +dependencies = [ + "sha3", +] + +[[package]] +name = "solana-program-error" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ee2e0217d642e2ea4bee237f37bd61bb02aec60da3647c48ff88f6556ade775" +dependencies = [ + "num-traits", + "solana-decode-error", + "solana-instruction", + "solana-msg", + "solana-pubkey", +] + +[[package]] +name = "solana-pubkey" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b62adb9c3261a052ca1f999398c388f1daf558a1b492f60a6d9e64857db4ff1" +dependencies = [ + "five8", + "five8_const", + "getrandom 0.2.16", + "js-sys", + "num-traits", + "solana-atomic-u64", + "solana-decode-error", + "solana-define-syscall", + "solana-sanitize", + "solana-sha256-hasher", + "wasm-bindgen", +] + +[[package]] +name = "solana-sanitize" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61f1bc1357b8188d9c4a3af3fc55276e56987265eb7ad073ae6f8180ee54cecf" + +[[package]] +name = "solana-sha256-hasher" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aa3feb32c28765f6aa1ce8f3feac30936f16c5c3f7eb73d63a5b8f6f8ecdc44" +dependencies = [ + "sha2", + "solana-define-syscall", + "solana-hash", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "syn" version = "1.0.109" @@ -683,6 +1531,59 @@ dependencies = [ "syn 2.0.100", ] +[[package]] +name = "tinyvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa5fdc3bce6191a1dbc8c02d5c8bffcf557bafa17c124c5264a458f1b0613fa" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "toml" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +dependencies = [ + "serde", +] + +[[package]] +name = "tracing" +version = "0.1.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-subscriber" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e0d2eaa99c3c2e41547cfa109e910a68ea03823cccad4a0525dcbc9b01e8c71" +dependencies = [ + "tracing-core", +] + [[package]] name = "typenum" version = "1.18.0" @@ -695,12 +1596,143 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" +[[package]] +name = "uuid" +version = "1.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f87b8aa10b915a06587d0dec516c282ff295b475d94abf425d62b57710070a2" +dependencies = [ + "getrandom 0.3.4", + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + [[package]] name = "version_check" version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.1+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1da10c01ae9f1ae40cbfac0bac3b1e724b320abfcf52229f80b547c0d250e2d" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "671c9a5a66f49d8a47345ab942e2cb93c7d1d0339065d4f8139c486121b43b19" +dependencies = [ + "bumpalo", + "log", + "proc-macro2", + "quote", + "syn 2.0.100", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ca60477e4c59f5f2986c50191cd972e3a50d8a95603bc9434501cf156a9a119" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f07d2f20d4da7b26400c9f4a0511e6e0345b040694e8a75bd41d578fa4421d7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bad67dc8b2a1a6e5448428adec4c3e84c43e561d8c9ee8a9e5aabeb193ec41d1" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "wit-bindgen" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" + [[package]] name = "zerocopy" version = "0.7.35" @@ -712,11 +1744,11 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.24" +version = "0.8.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" +checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" dependencies = [ - "zerocopy-derive 0.8.24", + "zerocopy-derive 0.8.27", ] [[package]] @@ -732,9 +1764,9 @@ dependencies = [ [[package]] name = "zerocopy-derive" -version = "0.8.24" +version = "0.8.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" +checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 04a3a55..271913a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,7 @@ +[workspace] +members = [".", "tests/rust-vk"] +resolver = "2" + [package] name = "groth16-solana" version = "0.2.0" @@ -14,6 +18,10 @@ ark-ec = "0.5" ark-ff = "0.5" ark-bn254 = "0.5" num-bigint = "0.4.6" +serde = { version = "1.0.195", optional = true, features = ["derive"] } +serde_json = { version = "1.0.111", optional = true } +circom-prover = { version = "0.1", optional = true } +ark-groth16 = { version = "0.5", optional = true } [dev-dependencies] @@ -21,3 +29,7 @@ ark-std = "0.5" array-bytes = "6.2.2" serde = "1.0.195" serde_json = "1.0.111" + +[features] +vk = ["serde", "serde_json"] +circom = ["circom-prover", "ark-groth16"] diff --git a/package-lock.json b/package-lock.json index aa3e855..5f9090e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,28 +8,31 @@ "name": "groth16-solana", "version": "1.0.0", "dependencies": { - "ffjavascript": "^0.2.48" + "ffjavascript": "^0.2.63" } }, "node_modules/ffjavascript": { - "version": "0.2.57", - "resolved": "https://registry.npmjs.org/ffjavascript/-/ffjavascript-0.2.57.tgz", - "integrity": "sha512-V+vxZ/zPNcthrWmqfe/1YGgqdkTamJeXiED0tsk7B84g40DKlrTdx47IqZuiygqAVG6zMw4qYuvXftIJWsmfKQ==", + "version": "0.2.63", + "resolved": "https://registry.npmjs.org/ffjavascript/-/ffjavascript-0.2.63.tgz", + "integrity": "sha512-dBgdsfGks58b66JnUZeZpGxdMIDQ4QsD3VYlRJyFVrKQHb2kJy4R2gufx5oetrTxXPT+aEjg0dOvOLg1N0on4A==", + "license": "GPL-3.0", "dependencies": { "wasmbuilder": "0.0.16", - "wasmcurves": "0.2.0", - "web-worker": "^1.2.0" + "wasmcurves": "0.2.2", + "web-worker": "1.2.0" } }, "node_modules/wasmbuilder": { "version": "0.0.16", "resolved": "https://registry.npmjs.org/wasmbuilder/-/wasmbuilder-0.0.16.tgz", - "integrity": "sha512-Qx3lEFqaVvp1cEYW7Bfi+ebRJrOiwz2Ieu7ZG2l7YyeSJIok/reEQCQCuicj/Y32ITIJuGIM9xZQppGx5LrQdA==" + "integrity": "sha512-Qx3lEFqaVvp1cEYW7Bfi+ebRJrOiwz2Ieu7ZG2l7YyeSJIok/reEQCQCuicj/Y32ITIJuGIM9xZQppGx5LrQdA==", + "license": "GPL-3.0" }, "node_modules/wasmcurves": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/wasmcurves/-/wasmcurves-0.2.0.tgz", - "integrity": "sha512-3e2rbxdujOwaod657gxgmdhZNn+i1qKdHO3Y/bK+8E7bV8ttV/fu5FO4/WLBACF375cK0QDLOP+65Na63qYuWA==", + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/wasmcurves/-/wasmcurves-0.2.2.tgz", + "integrity": "sha512-JRY908NkmKjFl4ytnTu5ED6AwPD+8VJ9oc94kdq7h5bIwbj0L4TDJ69mG+2aLs2SoCmGfqIesMWTEJjtYsoQXQ==", + "license": "GPL-3.0", "dependencies": { "wasmbuilder": "0.0.16" } diff --git a/package.json b/package.json index b0c70c3..d3f7ca2 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,6 @@ }, "author": "", "dependencies": { - "ffjavascript": "^0.2.48" + "ffjavascript": "^0.2.63" } } diff --git a/parse_vk_to_rust.js b/parse_vk_to_rust.js index 5b63bb3..313861e 100644 --- a/parse_vk_to_rust.js +++ b/parse_vk_to_rust.js @@ -78,7 +78,7 @@ async function main() { let resFile = await fs.openSync(outputPath + "verifying_key.rs","w") - let s = `use groth16_solana::groth16::Groth16Verifyingkey;\n\npub const VERIFYINGKEY: Groth16Verifyingkey = Groth16Verifyingkey {\n\tnr_pubinputs: ${mydata.IC.length},\n\n` + let s = `use groth16_solana::groth16::Groth16Verifyingkey;\n\npub const VERIFYINGKEY: Groth16Verifyingkey = Groth16Verifyingkey {\n\tnr_pubinputs: ${mydata.IC.length - 1},\n\n` s += "\tvk_alpha_g1: [\n" for (var j = 0; j < mydata.vk_alpha_1.length -1 ; j++) { console.log(typeof(mydata.vk_alpha_1[j])) diff --git a/src/errors.rs b/src/errors.rs index de81d49..1385a72 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -1,6 +1,6 @@ use thiserror::Error; -#[derive(Debug, Error, Clone, PartialEq, Eq)] +#[derive(Debug, Error, PartialEq)] pub enum Groth16Error { #[error("Incompatible Verifying Key with number of public inputs")] IncompatibleVerifyingKeyWithNrPublicInputs, @@ -22,4 +22,38 @@ pub enum Groth16Error { DecompressingG2Failed, #[error("PublicInputGreaterThanFieldSize")] PublicInputGreaterThanFieldSize, + #[cfg(feature = "circom")] + #[error("Arkworks serialization error: {0}")] + ArkworksSerializationError(String), + #[cfg(feature = "circom")] + #[error("Failed to convert proof component to byte array")] + ProofConversionError, +} + +#[cfg(feature = "circom")] +impl From for Groth16Error { + fn from(e: ark_serialize::SerializationError) -> Self { + Groth16Error::ArkworksSerializationError(e.to_string()) + } +} + +impl From for u32 { + fn from(error: Groth16Error) -> Self { + match error { + Groth16Error::IncompatibleVerifyingKeyWithNrPublicInputs => 0, + Groth16Error::ProofVerificationFailed => 1, + Groth16Error::PreparingInputsG1AdditionFailed => 2, + Groth16Error::PreparingInputsG1MulFailed => 3, + Groth16Error::InvalidG1Length => 4, + Groth16Error::InvalidG2Length => 5, + Groth16Error::InvalidPublicInputsLength => 6, + Groth16Error::DecompressingG1Failed => 7, + Groth16Error::DecompressingG2Failed => 8, + Groth16Error::PublicInputGreaterThanFieldSize => 9, + #[cfg(feature = "circom")] + Groth16Error::ArkworksSerializationError(_) => 10, + #[cfg(feature = "circom")] + Groth16Error::ProofConversionError => 11, + } + } } diff --git a/src/lib.rs b/src/lib.rs index d84fb0a..ea20d0c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -48,3 +48,9 @@ pub mod decompression; pub mod errors; pub mod groth16; + +#[cfg(feature = "vk")] +pub mod vk_parser; + +#[cfg(feature = "circom")] +pub mod proof_parser; diff --git a/src/proof_parser.rs b/src/proof_parser.rs new file mode 100644 index 0000000..d87e530 --- /dev/null +++ b/src/proof_parser.rs @@ -0,0 +1,175 @@ +//! Proof parser for converting circom-prover proofs to groth16-solana format. +//! +//! This module provides utilities to convert proofs generated by circom-prover +//! into the byte format expected by the groth16-solana verifier. +//! +//! # Example +//! +//! ```rust,ignore +//! use circom_prover::{CircomProver, prover::ProofLib, witness::WitnessFn}; +//! use groth16_solana::proof_parser::circom_prover::convert_proof; +//! +//! let proof = CircomProver::prove( +//! ProofLib::Arkworks, +//! WitnessFn::RustWitness(witness_fn), +//! circuit_inputs, +//! zkey_path, +//! )?; +//! +//! let (proof_a, proof_b, proof_c) = convert_proof(&proof.proof)?; +//! ``` + +#[cfg(feature = "circom")] +pub mod circom_prover { + use crate::errors::Groth16Error; + use ark_serialize::{CanonicalSerialize, Compress}; + use solana_bn254::compression::prelude::convert_endianness; + use std::ops::Neg; + + /// Convert circom-prover proof to groth16-solana format + /// + /// This follows the exact pattern from groth16.rs test (lines 347-368): + /// 1. Serialize with arkworks (outputs LE) + /// 2. Convert LE to BE using change_endianness/convert_endianness + /// + /// # Arguments + /// + /// * `circom_proof` - The proof from circom-prover + /// + /// # Returns + /// + /// A triple of (proof_a, proof_b, proof_c) in the format expected by groth16-solana + /// + /// # Errors + /// + /// Returns an error if serialization fails or byte conversion fails + pub fn convert_proof( + circom_proof: &::circom_prover::prover::circom::Proof, + ) -> Result<([u8; 64], [u8; 128], [u8; 64]), Groth16Error> { + // Convert to arkworks proof + let ark_proof: ark_groth16::Proof = circom_proof.clone().into(); + + // Serialize proof_a: negate it, serialize to LE, convert to BE + let mut proof_a_serialized = [0u8; 65]; + ark_proof + .a + .neg() + .x + .serialize_with_mode(&mut proof_a_serialized[..32], Compress::No)?; + ark_proof + .a + .neg() + .y + .serialize_with_mode(&mut proof_a_serialized[32..64], Compress::No)?; + + // Convert LE to BE using convert_endianness::<32, 64> (reverses each 32-byte chunk) + let proof_a: [u8; 64] = convert_endianness::<32, 64>( + &proof_a_serialized[..64] + .try_into() + .map_err(|_| Groth16Error::ProofConversionError)?, + ); + + // Serialize proof_b: serialize to LE, convert to BE + let mut proof_b_serialized = [0u8; 129]; + ark_proof + .b + .serialize_with_mode(&mut proof_b_serialized[..], Compress::No)?; + + // Convert LE to BE using convert_endianness::<64, 128> (reverses each 64-byte chunk) + let proof_b: [u8; 128] = convert_endianness::<64, 128>( + &proof_b_serialized[..128] + .try_into() + .map_err(|_| Groth16Error::ProofConversionError)?, + ); + + // Serialize proof_c: serialize to LE, convert to BE + let mut proof_c_serialized = [0u8; 65]; + ark_proof + .c + .serialize_with_mode(&mut proof_c_serialized[..], Compress::No)?; + + // Convert LE to BE using convert_endianness::<32, 64> (reverses each 32-byte chunk) + let proof_c: [u8; 64] = convert_endianness::<32, 64>( + &proof_c_serialized[..64] + .try_into() + .map_err(|_| Groth16Error::ProofConversionError)?, + ); + + Ok((proof_a, proof_b, proof_c)) + } + + /// Convert uncompressed proof to compressed format + /// + /// Compresses proof_a (64 bytes -> 32 bytes), proof_b (128 bytes -> 64 bytes), + /// and proof_c (64 bytes -> 32 bytes) using arkworks compressed serialization. + /// + /// # Arguments + /// + /// * `proof_a` - Uncompressed proof_a (64 bytes, big-endian) + /// * `proof_b` - Proof_b (128 bytes, big-endian) + /// * `proof_c` - Uncompressed proof_c (64 bytes, big-endian) + /// + /// # Returns + /// + /// A triple of (compressed_proof_a, compressed_proof_b, compressed_proof_c) where: + /// - compressed_proof_a: 32 bytes + /// - compressed_proof_b: 64 bytes + /// - compressed_proof_c: 32 bytes + /// + /// # Errors + /// + /// Returns an error if deserialization or compression fails + pub fn convert_proof_to_compressed( + proof_a: &[u8; 64], + proof_b: &[u8; 128], + proof_c: &[u8; 64], + ) -> Result<([u8; 32], [u8; 64], [u8; 32]), Groth16Error> { + use solana_bn254::compression::prelude::{alt_bn128_g1_compress, alt_bn128_g2_compress}; + + // Compress G1 points using solana_bn254 + let compressed_a = + alt_bn128_g1_compress(proof_a).map_err(|_| Groth16Error::ProofConversionError)?; + + let compressed_c = + alt_bn128_g1_compress(proof_c).map_err(|_| Groth16Error::ProofConversionError)?; + + // Compress G2 point using solana_bn254 + let compressed_b = + alt_bn128_g2_compress(proof_b).map_err(|_| Groth16Error::ProofConversionError)?; + + Ok((compressed_a, compressed_b, compressed_c)) + } + + /// Convert circom-prover public inputs to groth16-solana format + /// + /// Circom-prover gives us BigUint in BE format. + /// Groth16-solana expects BE byte arrays (no conversion needed). + /// + /// # Arguments + /// + /// * `pub_inputs` - The public inputs from circom-prover + /// + /// # Returns + /// + /// An array of public inputs in the format expected by groth16-solana + /// + /// # Panics + /// + /// Panics if the number of public inputs doesn't match N + pub fn convert_public_inputs( + pub_inputs: &::circom_prover::prover::PublicInputs, + ) -> [[u8; 32]; N] { + let mut public_inputs_vec: Vec<[u8; 32]> = Vec::new(); + for signal_bigint in &pub_inputs.0 { + let mut bytes = signal_bigint.to_bytes_be(); + // Pad to 32 bytes + if bytes.len() < 32 { + let mut padded = vec![0u8; 32 - bytes.len()]; + padded.extend_from_slice(&bytes); + bytes = padded; + } + public_inputs_vec.push(bytes[..32].try_into().unwrap()); + } + public_inputs_vec.try_into().unwrap() + } +} diff --git a/src/vk_parser.rs b/src/vk_parser.rs new file mode 100644 index 0000000..7df4ba5 --- /dev/null +++ b/src/vk_parser.rs @@ -0,0 +1,275 @@ +//! Verification key parser for build.rs usage. +//! +//! This module provides utilities to parse verification key JSON files +//! (generated by zkSNARK tooling) and convert them to Rust source code +//! for use with the Groth16 verifier. +//! +//! # Example +//! +//! ```rust,ignore +//! use groth16_solana::vk_parser::generate_vk_file; +//! +//! fn main() { +//! generate_vk_file( +//! "verification_key.json", +//! "src", +//! "verifying_key.rs" +//! ).unwrap(); +//! } +//! ``` + +use num_bigint::BigUint; +use serde::Deserialize; +use std::fs; +use std::path::Path; + +/// Errors that can occur during verification key parsing +#[derive(Debug, thiserror::Error)] +pub enum VkParseError { + #[error("Failed to read file: {0}")] + IoError(#[from] std::io::Error), + + #[error("Failed to parse JSON: {0}")] + JsonError(#[from] serde_json::Error), + + #[error("Invalid verification key data: {0}")] + InvalidData(String), +} + +/// Raw verification key data as it appears in JSON files +#[derive(Debug, Deserialize)] +struct RawVerifyingKey { + #[serde(rename = "vk_alpha_1")] + vk_alpha_1: Vec, + + #[serde(rename = "vk_beta_2")] + vk_beta_2: Vec>, + + #[serde(rename = "vk_gamma_2")] + vk_gamma_2: Vec>, + + #[serde(rename = "vk_delta_2")] + vk_delta_2: Vec>, + + #[serde(rename = "IC")] + ic: Vec>, +} + +/// Convert a bigint string to little-endian bytes, then reverse to big-endian +fn bigint_string_to_be_bytes(s: &str, size: usize) -> Result, VkParseError> { + let bigint = s + .parse::() + .map_err(|e| VkParseError::InvalidData(format!("Failed to parse bigint '{}': {}", s, e)))?; + + let le_bytes = bigint.to_bytes_le(); + + // Pad to desired size + let mut padded = le_bytes; + padded.resize(size, 0); + + // Reverse to get big-endian + padded.reverse(); + Ok(padded) +} + +/// Process G1 point: convert bigint to 32-byte BE +fn process_g1_component(component: &str) -> Result, VkParseError> { + bigint_string_to_be_bytes(component, 32) +} + +/// Process G2 point: concatenate two 32-byte LE components, reverse the full 64 bytes, then split +fn process_g2_component(components: &[String]) -> Result<(Vec, Vec), VkParseError> { + if components.len() != 2 { + return Err(VkParseError::InvalidData(format!( + "G2 component must have exactly 2 elements, got {}", + components.len() + ))); + } + + // Convert to LE bytes + let c0_le = components[0] + .parse::() + .map_err(|e| VkParseError::InvalidData(format!("Failed to parse bigint: {}", e)))? + .to_bytes_le(); + let c1_le = components[1] + .parse::() + .map_err(|e| VkParseError::InvalidData(format!("Failed to parse bigint: {}", e)))? + .to_bytes_le(); + + // Pad to 32 bytes + let mut c0_padded = c0_le; + c0_padded.resize(32, 0); + let mut c1_padded = c1_le; + c1_padded.resize(32, 0); + + // Concatenate and reverse + let mut concat = Vec::new(); + concat.extend_from_slice(&c0_padded); + concat.extend_from_slice(&c1_padded); + concat.reverse(); + + // Split back + let part0 = concat[0..32].to_vec(); + let part1 = concat[32..64].to_vec(); + + Ok((part0, part1)) +} + +/// Parse verification key JSON and generate Rust source code as a String +/// +/// # Arguments +/// +/// * `json_content` - The JSON content as a string +/// +/// # Returns +/// +/// A String containing the generated Rust code defining a `Groth16Verifyingkey` constant +pub fn parse_vk_json_to_rust_string(json_content: &str) -> Result { + let raw_vk: RawVerifyingKey = serde_json::from_str(json_content)?; + + let mut output = String::new(); + + // Header + output.push_str("use groth16_solana::groth16::Groth16Verifyingkey;\n\n"); + output.push_str(&format!( + "pub const VERIFYINGKEY: Groth16Verifyingkey = Groth16Verifyingkey {{\n\tnr_pubinputs: {},\n\n", + raw_vk.ic.len() - 1 + )); + + // Process vk_alpha_g1 - flat [u8; 64] + output.push_str("\tvk_alpha_g1: ["); + let mut alpha_bytes = Vec::new(); + for i in 0..raw_vk.vk_alpha_1.len() - 1 { + let bytes = process_g1_component(&raw_vk.vk_alpha_1[i])?; + alpha_bytes.extend_from_slice(&bytes); + } + output.push_str( + &alpha_bytes + .iter() + .map(|b| format!("{}u8", b)) + .collect::>() + .join(", "), + ); + output.push_str("],\n\n"); + + // Process vk_beta_g2 - flat [u8; 128] + output.push_str("\tvk_beta_g2: ["); + let mut beta_bytes = Vec::new(); + for i in 0..raw_vk.vk_beta_2.len() - 1 { + let (part0, part1) = process_g2_component(&raw_vk.vk_beta_2[i])?; + beta_bytes.extend_from_slice(&part0); + beta_bytes.extend_from_slice(&part1); + } + output.push_str( + &beta_bytes + .iter() + .map(|b| format!("{}u8", b)) + .collect::>() + .join(", "), + ); + output.push_str("],\n\n"); + + // Process vk_gamma_g2 - flat [u8; 128] + output.push_str("\tvk_gamma_g2: ["); + let mut gamma_bytes = Vec::new(); + for i in 0..raw_vk.vk_gamma_2.len() - 1 { + let (part0, part1) = process_g2_component(&raw_vk.vk_gamma_2[i])?; + gamma_bytes.extend_from_slice(&part0); + gamma_bytes.extend_from_slice(&part1); + } + output.push_str( + &gamma_bytes + .iter() + .map(|b| format!("{}u8", b)) + .collect::>() + .join(", "), + ); + output.push_str("],\n\n"); + + // Process vk_delta_g2 - flat [u8; 128] + output.push_str("\tvk_delta_g2: ["); + let mut delta_bytes = Vec::new(); + for i in 0..raw_vk.vk_delta_2.len() - 1 { + let (part0, part1) = process_g2_component(&raw_vk.vk_delta_2[i])?; + delta_bytes.extend_from_slice(&part0); + delta_bytes.extend_from_slice(&part1); + } + output.push_str( + &delta_bytes + .iter() + .map(|b| format!("{}u8", b)) + .collect::>() + .join(", "), + ); + output.push_str("],\n\n"); + + // Process vk_ic - &[[u8; 64]] + output.push_str("\tvk_ic: &[\n"); + for point in &raw_vk.ic { + output.push_str("\t\t["); + let mut point_bytes = Vec::new(); + for i in 0..point.len() - 1 { + let bytes = process_g1_component(&point[i])?; + point_bytes.extend_from_slice(&bytes); + } + output.push_str( + &point_bytes + .iter() + .map(|b| format!("{}u8", b)) + .collect::>() + .join(", "), + ); + output.push_str("],\n"); + } + output.push_str("\t]\n"); + + output.push_str("};\n"); + + Ok(output) +} + +/// Generate a verification key Rust file from a JSON file +/// +/// This is a convenience wrapper that reads the JSON file, parses it, +/// and writes the generated Rust code to the specified output location. +/// +/// # Arguments +/// +/// * `json_path` - Path to the input JSON file containing the verification key +/// * `output_dir` - Directory where the output Rust file will be written +/// * `output_filename` - Name of the output Rust file (e.g., "verifying_key.rs") +/// +/// # Example +/// +/// ```rust,ignore +/// // In build.rs +/// use groth16_solana::vk_parser::generate_vk_file; +/// +/// fn main() { +/// generate_vk_file( +/// "verification_key.json", +/// "src", +/// "verifying_key.rs" +/// ).unwrap(); +/// } +/// ``` +pub fn generate_vk_file( + json_path: impl AsRef, + output_dir: impl AsRef, + output_filename: &str, +) -> Result<(), VkParseError> { + // Read JSON file + let json_content = fs::read_to_string(json_path.as_ref())?; + + // Parse and generate Rust code + let rust_code = parse_vk_json_to_rust_string(&json_content)?; + + // Create output directory if it doesn't exist + fs::create_dir_all(output_dir.as_ref())?; + + // Write output file + let output_path = output_dir.as_ref().join(output_filename); + fs::write(output_path, rust_code)?; + + Ok(()) +} diff --git a/tests/rust-vk/Cargo.lock b/tests/rust-vk/Cargo.lock new file mode 100644 index 0000000..0bdffe4 --- /dev/null +++ b/tests/rust-vk/Cargo.lock @@ -0,0 +1,1777 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + +[[package]] +name = "anyhow" +version = "1.0.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" + +[[package]] +name = "ark-bls12-381" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3df4dcc01ff89867cd86b0da835f23c3f02738353aaee7dde7495af71363b8d5" +dependencies = [ + "ark-ec 0.5.0", + "ark-ff 0.5.0", + "ark-serialize 0.5.0", + "ark-std 0.5.0", +] + +[[package]] +name = "ark-bn254" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a22f4561524cd949590d78d7d4c5df8f592430d221f7f3c9497bbafd8972120f" +dependencies = [ + "ark-ec 0.4.2", + "ark-ff 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "ark-bn254" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d69eab57e8d2663efa5c63135b2af4f396d66424f88954c21104125ab6b3e6bc" +dependencies = [ + "ark-ec 0.5.0", + "ark-ff 0.5.0", + "ark-std 0.5.0", +] + +[[package]] +name = "ark-crypto-primitives" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0c292754729c8a190e50414fd1a37093c786c709899f29c9f7daccecfa855e" +dependencies = [ + "ahash", + "ark-crypto-primitives-macros", + "ark-ec 0.5.0", + "ark-ff 0.5.0", + "ark-relations", + "ark-serialize 0.5.0", + "ark-snark", + "ark-std 0.5.0", + "blake2", + "derivative", + "digest", + "fnv", + "merlin", + "rayon", + "sha2", +] + +[[package]] +name = "ark-crypto-primitives-macros" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e89fe77d1f0f4fe5b96dfc940923d88d17b6a773808124f21e764dfb063c6a" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.107", +] + +[[package]] +name = "ark-ec" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba" +dependencies = [ + "ark-ff 0.4.2", + "ark-poly 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "hashbrown 0.13.2", + "itertools 0.10.5", + "num-traits", + "zeroize", +] + +[[package]] +name = "ark-ec" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d68f2d516162846c1238e755a7c4d131b892b70cc70c471a8e3ca3ed818fce" +dependencies = [ + "ahash", + "ark-ff 0.5.0", + "ark-poly 0.5.0", + "ark-serialize 0.5.0", + "ark-std 0.5.0", + "educe", + "fnv", + "hashbrown 0.15.5", + "itertools 0.13.0", + "num-bigint", + "num-integer", + "num-traits", + "rayon", + "zeroize", +] + +[[package]] +name = "ark-ff" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" +dependencies = [ + "ark-ff-asm 0.4.2", + "ark-ff-macros 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "digest", + "itertools 0.10.5", + "num-bigint", + "num-traits", + "paste", + "rustc_version", + "zeroize", +] + +[[package]] +name = "ark-ff" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a177aba0ed1e0fbb62aa9f6d0502e9b46dad8c2eab04c14258a1212d2557ea70" +dependencies = [ + "ark-ff-asm 0.5.0", + "ark-ff-macros 0.5.0", + "ark-serialize 0.5.0", + "ark-std 0.5.0", + "arrayvec", + "digest", + "educe", + "itertools 0.13.0", + "num-bigint", + "num-traits", + "paste", + "rayon", + "zeroize", +] + +[[package]] +name = "ark-ff-asm" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-asm" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62945a2f7e6de02a31fe400aa489f0e0f5b2502e69f95f853adb82a96c7a6b60" +dependencies = [ + "quote", + "syn 2.0.107", +] + +[[package]] +name = "ark-ff-macros" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09be120733ee33f7693ceaa202ca41accd5653b779563608f1234f78ae07c4b3" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 2.0.107", +] + +[[package]] +name = "ark-groth16" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88f1d0f3a534bb54188b8dcc104307db6c56cdae574ddc3212aec0625740fc7e" +dependencies = [ + "ark-crypto-primitives", + "ark-ec 0.5.0", + "ark-ff 0.5.0", + "ark-poly 0.5.0", + "ark-relations", + "ark-serialize 0.5.0", + "ark-std 0.5.0", + "rayon", +] + +[[package]] +name = "ark-poly" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" +dependencies = [ + "ark-ff 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "hashbrown 0.13.2", +] + +[[package]] +name = "ark-poly" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "579305839da207f02b89cd1679e50e67b4331e2f9294a57693e5051b7703fe27" +dependencies = [ + "ahash", + "ark-ff 0.5.0", + "ark-serialize 0.5.0", + "ark-std 0.5.0", + "educe", + "fnv", + "hashbrown 0.15.5", + "rayon", +] + +[[package]] +name = "ark-relations" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec46ddc93e7af44bcab5230937635b06fb5744464dd6a7e7b083e80ebd274384" +dependencies = [ + "ark-ff 0.5.0", + "ark-std 0.5.0", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "ark-serialize" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" +dependencies = [ + "ark-serialize-derive 0.4.2", + "ark-std 0.4.0", + "digest", + "num-bigint", +] + +[[package]] +name = "ark-serialize" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f4d068aaf107ebcd7dfb52bc748f8030e0fc930ac8e360146ca54c1203088f7" +dependencies = [ + "ark-serialize-derive 0.5.0", + "ark-std 0.5.0", + "arrayvec", + "digest", + "num-bigint", + "rayon", +] + +[[package]] +name = "ark-serialize-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae3281bc6d0fd7e549af32b52511e1302185bd688fd3359fa36423346ff682ea" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-serialize-derive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213888f660fddcca0d257e88e54ac05bca01885f258ccdf695bafd77031bb69d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.107", +] + +[[package]] +name = "ark-snark" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d368e2848c2d4c129ce7679a7d0d2d612b6a274d3ea6a13bad4445d61b381b88" +dependencies = [ + "ark-ff 0.5.0", + "ark-relations", + "ark-serialize 0.5.0", + "ark-std 0.5.0", +] + +[[package]] +name = "ark-std" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" +dependencies = [ + "num-traits", + "rand", +] + +[[package]] +name = "ark-std" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "246a225cc6131e9ee4f24619af0f19d67761fff15d7ccc22e42b80846e69449a" +dependencies = [ + "num-traits", + "rand", + "rayon", +] + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "bitflags" +version = "2.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394" + +[[package]] +name = "blake2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" +dependencies = [ + "digest", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "borsh" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115e54d64eb62cdebad391c19efc9dce4981c690c85a33a12199d99bb9546fee" +dependencies = [ + "borsh-derive", + "hashbrown 0.13.2", +] + +[[package]] +name = "borsh-derive" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "831213f80d9423998dd696e2c5345aba6be7a0bd8cd19e31c5243e13df1cef89" +dependencies = [ + "borsh-derive-internal", + "borsh-schema-derive-internal", + "proc-macro-crate", + "proc-macro2", + "syn 1.0.109", +] + +[[package]] +name = "borsh-derive-internal" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65d6ba50644c98714aa2a70d13d7df3cd75cd2b523a2b452bf010443800976b3" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "borsh-schema-derive-internal" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "276691d96f063427be83e6692b86148e488ebba9f48f77788724ca027ba3b6d4" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "bs58" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "bumpalo" +version = "3.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" + +[[package]] +name = "bytemuck" +version = "1.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbdf580320f38b612e485521afda1ee26d10cc9884efaaa750d383e13e3c5f4" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9abbd1bc6865053c427f7198e6af43bfdedc55ab791faed4fbd361d789575ff" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.107", +] + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "cc" +version = "1.2.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac9fe6cdbb24b6ade63616c0a0688e45bb56732262c158df3c0c4bea4ca47cb7" +dependencies = [ + "find-msvc-tools", + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "circom-prover" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82cb9d752c87c707a7741ee2b1f9186780e20b8ea0ddb9fd288173ee10ba738e" +dependencies = [ + "anyhow", + "ark-bls12-381", + "ark-bn254 0.5.0", + "ark-crypto-primitives", + "ark-ec 0.5.0", + "ark-ff 0.5.0", + "ark-groth16", + "ark-poly 0.5.0", + "ark-relations", + "ark-serialize 0.5.0", + "ark-std 0.5.0", + "byteorder", + "hex-literal", + "num", + "num-bigint", + "num-traits", + "rand", + "rayon", + "rust-witness", + "serde", + "serde_json", + "uuid", +] + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", +] + +[[package]] +name = "educe" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7bc049e1bd8cdeb31b68bbd586a9464ecf9f3944af3958a7a9d0f8b9799417" +dependencies = [ + "enum-ordinalize", + "proc-macro2", + "quote", + "syn 2.0.107", +] + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "enum-ordinalize" +version = "4.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea0dcfa4e54eeb516fe454635a95753ddd39acda650ce703031c6973e315dd5" +dependencies = [ + "enum-ordinalize-derive", +] + +[[package]] +name = "enum-ordinalize-derive" +version = "4.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d28318a75d4aead5c4db25382e8ef717932d0346600cacae6357eb5941bc5ff" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.107", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52051878f80a721bb68ebfbc930e07b65ba72f2da88968ea5c06fd6ca3d3a127" + +[[package]] +name = "five8" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75b8549488b4715defcb0d8a8a1c1c76a80661b5fa106b4ca0e7fce59d7d875" +dependencies = [ + "five8_core", +] + +[[package]] +name = "five8_const" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26dec3da8bc3ef08f2c04f61eab298c3ab334523e55f076354d6d6f613799a7b" +dependencies = [ + "five8_core", +] + +[[package]] +name = "five8_core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2551bf44bc5f776c15044b9b94153a00198be06743e262afaaa61f11ac7523a5" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "generic-array" +version = "0.14.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bb6743198531e02858aeaea5398fcc883e71851fcbcb5a2f773e2fb6cb1edf2" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasip2", +] + +[[package]] +name = "groth16-solana" +version = "0.2.0" +dependencies = [ + "ark-bn254 0.5.0", + "ark-ec 0.5.0", + "ark-ff 0.5.0", + "ark-groth16", + "ark-serialize 0.5.0", + "circom-prover", + "num-bigint", + "serde", + "serde_json", + "solana-bn254", + "thiserror 1.0.69", +] + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "allocator-api2", +] + +[[package]] +name = "hex-literal" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" + +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.4", + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec48937a97411dcb524a265206ccd4c90bb711fca92b2792c407f268825b9305" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "libc" +version = "0.2.177" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" + +[[package]] +name = "light-compressed-account" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0985921012ffc149596eac90d1170399bb70dbebfa2212bb72b2da30a558ec6" +dependencies = [ + "borsh", + "light-hasher", + "light-macros", + "light-program-profiler", + "light-zero-copy", + "solana-msg", + "solana-pubkey", + "thiserror 2.0.17", + "zerocopy", +] + +[[package]] +name = "light-hasher" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7b8b99f626dbfe0e9731a214e2b2e8990341f5fdb249744661ab7f3029d9859" +dependencies = [ + "ark-bn254 0.5.0", + "ark-ff 0.5.0", + "arrayvec", + "borsh", + "light-poseidon", + "num-bigint", + "sha2", + "sha3", + "solana-nostd-keccak", + "solana-program-error", + "solana-pubkey", + "thiserror 2.0.17", +] + +[[package]] +name = "light-indexed-array" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271ba5b246a77e0d4797d6f1752ec3ca627b2359a669189c198f5e104951d928" +dependencies = [ + "light-hasher", + "num-bigint", + "num-traits", + "thiserror 2.0.17", +] + +[[package]] +name = "light-macros" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "861c0817697c1201c2235cd831fcbaa2564a5f778e5229e9f5cc21035e97c273" +dependencies = [ + "bs58", + "proc-macro2", + "quote", + "syn 2.0.107", +] + +[[package]] +name = "light-merkle-tree-reference" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93b3c707e7d506c1c0f1d94520c5d8d93eb59eb599ead658a7eb22416c04a590" +dependencies = [ + "light-hasher", + "light-indexed-array", + "num-bigint", + "num-traits", + "thiserror 2.0.17", +] + +[[package]] +name = "light-poseidon" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39e3d87542063daaccbfecd78b60f988079b6ec4e089249658b9455075c78d42" +dependencies = [ + "ark-bn254 0.5.0", + "ark-ff 0.5.0", + "num-bigint", + "thiserror 1.0.69", +] + +[[package]] +name = "light-profiler-macro" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a8be18fe4de58a6f754caa74a3fbc6d8a758a26f1f3c24d5b0f5b55df5f5408" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.107", +] + +[[package]] +name = "light-program-profiler" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1d345871581aebd8825868a3f08410290aa1cdddcb189ca7f7e588f61d79fcf" +dependencies = [ + "light-profiler-macro", +] + +[[package]] +name = "light-zero-copy" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f4167c97f1291176414af783c01b647292d809ec14f991884c6d91b9ca2213e" +dependencies = [ + "light-zero-copy-derive", + "zerocopy", +] + +[[package]] +name = "light-zero-copy-derive" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "552463371ee2a6383882b17f7ed1a6803dbc9cb3c0188e0c74a014c2eb22f29e" +dependencies = [ + "lazy_static", + "proc-macro2", + "quote", + "syn 2.0.107", +] + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" + +[[package]] +name = "memchr" +version = "2.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" + +[[package]] +name = "merlin" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58c38e2799fc0978b65dfff8023ec7843e2330bb462f19198840b34b6582397d" +dependencies = [ + "byteorder", + "keccak", + "rand_core", + "zeroize", +] + +[[package]] +name = "num" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" +dependencies = [ + "num-bigint", + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", + "rand", + "serde", +] + +[[package]] +name = "num-complex" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" +dependencies = [ + "num-bigint", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "proc-macro-crate" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" +dependencies = [ + "toml", +] + +[[package]] +name = "proc-macro2" +version = "1.0.101" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.16", +] + +[[package]] +name = "rayon" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags", +] + +[[package]] +name = "rust-vk-integration-test" +version = "0.1.0" +dependencies = [ + "circom-prover", + "groth16-solana", + "light-compressed-account", + "light-hasher", + "light-merkle-tree-reference", + "num-bigint", + "rust-witness", + "serde_json", +] + +[[package]] +name = "rust-witness" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b59361683f7b6b3b0d343fc77e797ee5a267b8a470b9531ed9911aeed160dea0" +dependencies = [ + "cc", + "fnv", + "num-bigint", + "num-traits", + "paste", + "walkdir", +] + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "ryu" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "semver" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.107", +] + +[[package]] +name = "serde_json" +version = "1.0.145" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", + "serde_core", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest", + "keccak", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "solana-atomic-u64" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52e52720efe60465b052b9e7445a01c17550666beec855cce66f44766697bc2" +dependencies = [ + "parking_lot", +] + +[[package]] +name = "solana-bn254" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4420f125118732833f36facf96a27e7b78314b2d642ba07fa9ffdacd8d79e243" +dependencies = [ + "ark-bn254 0.4.0", + "ark-ec 0.4.2", + "ark-ff 0.4.2", + "ark-serialize 0.4.2", + "bytemuck", + "solana-define-syscall", + "thiserror 2.0.17", +] + +[[package]] +name = "solana-decode-error" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c781686a18db2f942e70913f7ca15dc120ec38dcab42ff7557db2c70c625a35" +dependencies = [ + "num-traits", +] + +[[package]] +name = "solana-define-syscall" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ae3e2abcf541c8122eafe9a625d4d194b4023c20adde1e251f94e056bb1aee2" + +[[package]] +name = "solana-hash" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b96e9f0300fa287b545613f007dfe20043d7812bee255f418c1eb649c93b63" +dependencies = [ + "five8", + "js-sys", + "solana-atomic-u64", + "solana-sanitize", + "wasm-bindgen", +] + +[[package]] +name = "solana-instruction" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47298e2ce82876b64f71e9d13a46bc4b9056194e7f9937ad3084385befa50885" +dependencies = [ + "getrandom 0.2.16", + "js-sys", + "num-traits", + "solana-define-syscall", + "solana-pubkey", + "wasm-bindgen", +] + +[[package]] +name = "solana-msg" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f36a1a14399afaabc2781a1db09cb14ee4cc4ee5c7a5a3cfcc601811379a8092" +dependencies = [ + "solana-define-syscall", +] + +[[package]] +name = "solana-nostd-keccak" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8ced70920435b1baa58f76e6f84bbc1110ddd1d6161ec76b6d731ae8431e9c4" +dependencies = [ + "sha3", +] + +[[package]] +name = "solana-program-error" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ee2e0217d642e2ea4bee237f37bd61bb02aec60da3647c48ff88f6556ade775" +dependencies = [ + "num-traits", + "solana-decode-error", + "solana-instruction", + "solana-msg", + "solana-pubkey", +] + +[[package]] +name = "solana-pubkey" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b62adb9c3261a052ca1f999398c388f1daf558a1b492f60a6d9e64857db4ff1" +dependencies = [ + "five8", + "five8_const", + "getrandom 0.2.16", + "js-sys", + "num-traits", + "solana-atomic-u64", + "solana-decode-error", + "solana-define-syscall", + "solana-sanitize", + "solana-sha256-hasher", + "wasm-bindgen", +] + +[[package]] +name = "solana-sanitize" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61f1bc1357b8188d9c4a3af3fc55276e56987265eb7ad073ae6f8180ee54cecf" + +[[package]] +name = "solana-sha256-hasher" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aa3feb32c28765f6aa1ce8f3feac30936f16c5c3f7eb73d63a5b8f6f8ecdc44" +dependencies = [ + "sha2", + "solana-define-syscall", + "solana-hash", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a26dbd934e5451d21ef060c018dae56fc073894c5a7896f882928a76e6d081b" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" +dependencies = [ + "thiserror-impl 2.0.17", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.107", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.107", +] + +[[package]] +name = "tinyvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa5fdc3bce6191a1dbc8c02d5c8bffcf557bafa17c124c5264a458f1b0613fa" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "toml" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +dependencies = [ + "serde", +] + +[[package]] +name = "tracing" +version = "0.1.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-subscriber" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e0d2eaa99c3c2e41547cfa109e910a68ea03823cccad4a0525dcbc9b01e8c71" +dependencies = [ + "tracing-core", +] + +[[package]] +name = "typenum" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" + +[[package]] +name = "unicode-ident" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d" + +[[package]] +name = "uuid" +version = "1.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f87b8aa10b915a06587d0dec516c282ff295b475d94abf425d62b57710070a2" +dependencies = [ + "getrandom 0.3.4", + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.1+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1da10c01ae9f1ae40cbfac0bac3b1e724b320abfcf52229f80b547c0d250e2d" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "671c9a5a66f49d8a47345ab942e2cb93c7d1d0339065d4f8139c486121b43b19" +dependencies = [ + "bumpalo", + "log", + "proc-macro2", + "quote", + "syn 2.0.107", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ca60477e4c59f5f2986c50191cd972e3a50d8a95603bc9434501cf156a9a119" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f07d2f20d4da7b26400c9f4a0511e6e0345b040694e8a75bd41d578fa4421d7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.107", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bad67dc8b2a1a6e5448428adec4c3e84c43e561d8c9ee8a9e5aabeb193ec41d1" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "wit-bindgen" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" + +[[package]] +name = "zerocopy" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.107", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.107", +] diff --git a/tests/rust-vk/Cargo.toml b/tests/rust-vk/Cargo.toml new file mode 100644 index 0000000..ffd7dac --- /dev/null +++ b/tests/rust-vk/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "rust-vk-integration-test" +version = "0.1.0" +edition = "2021" +publish = false + +[dependencies] +groth16-solana = { path = "../..", features = ["circom"] } +circom-prover = "0.1" +rust-witness = "0.1" +num-bigint = "0.4" +serde_json = "1.0" +light-compressed-account = { version = "0.5.0", features = ["new-unique"] } +light-hasher = { version = "4.0.0", features = ["solana"] } +light-merkle-tree-reference = "3.0.0" + +[build-dependencies] +groth16-solana = { path = "../..", features = ["vk", "circom"] } +rust-witness = "0.1" diff --git a/tests/rust-vk/README.md b/tests/rust-vk/README.md new file mode 100644 index 0000000..bf8adb2 --- /dev/null +++ b/tests/rust-vk/README.md @@ -0,0 +1,123 @@ +# groth16-solana Integration Test with Rust VK Parser + +This integration test demonstrates the complete workflow for using `groth16-solana` with the Rust verification key parser: + +1. Compile a circom circuit +2. Generate proving and verification keys +3. Use the Rust VK parser (via `build.rs`) to generate the verifying key Rust code +4. Generate a proof +5. Verify the proof using `groth16-solana` + +## Prerequisites + +- Rust (latest stable) +- Node.js and npm +- circom (install with `npm install -g circom`) + +## Setup + +1. Install dependencies and download powers of tau: + +```bash +npm run setup +``` + +2. Compile the circuit and generate keys: + +```bash +npm run build-all +``` + +This will: +- Compile the circom circuit to R1CS and WASM +- Run the Groth16 trusted setup +- Contribute entropy to the ceremony +- Export the verification key JSON + +## Running the Test + +The test will automatically use the generated verification key via the `build.rs` script: + +```bash +cargo test +``` + +## How It Works + +### Build Process + +The `build.rs` script does two things: + +1. **Generates Verification Key Rust Code**: + - Reads `build/verification_key.json` + - Uses `groth16_solana::vk_parser::generate_vk_file()` to convert it to Rust + - Outputs `src/verifying_key.rs` containing the `VERIFYINGKEY` constant + +2. **Transpiles Witness Generator**: + - Converts the WASM witness generator to a native Rust library + - Links it for use with `circom-prover` + +### Test Flow + +The integration test (`src/lib.rs`): + +1. Creates a compressed account and Merkle proof inputs +2. Generates a Groth16 proof using `circom-prover` +3. Converts the proof to the format expected by `groth16-solana` +4. Verifies the proof using `Groth16Verifier` with the generated `VERIFYINGKEY` + +## Project Structure + +``` +tests/rust-vk/ +├── build/ # Generated circuit files +│ ├── compressed_account_merkle_proof.r1cs +│ ├── compressed_account_merkle_proof_js/ # WASM witness generator +│ ├── compressed_account_merkle_proof_final.zkey +│ └── verification_key.json +├── circuits/ +│ └── compressed_account_merkle_proof.circom +├── pot/ +│ └── powersOfTau28_hez_final_16.ptau +├── scripts/ +│ └── setup.sh +├── src/ +│ ├── lib.rs # Integration test +│ └── verifying_key.rs # Generated by build.rs +├── build.rs # Uses groth16-solana VK parser +├── Cargo.toml +└── package.json +``` + +## Key Features Demonstrated + +1. **Rust VK Parser Integration**: Shows how to use the `vk` feature of `groth16-solana` in `build.rs` +2. **Complete Circuit Workflow**: From circom source to verified proof +3. **Proof Format Conversion**: Demonstrates converting between circom-prover and groth16-solana formats +4. **Build-time Code Generation**: Verification key is generated at compile time + +## Troubleshooting + +### "Verification key JSON not found" + +Run `npm run build-all` to generate the circuit artifacts. + +### "Witness WASM not found" + +Run `npm run compile` to compile the circuit. + +### Verification fails + +Ensure you've run the full setup and the verification key matches the proving key: +```bash +npm run clean +npm run build-all +cargo clean +cargo test +``` + +## Notes + +- The circuit uses a 26-level Merkle tree for compressed account proofs +- The powers of tau ceremony file supports circuits up to 2^16 constraints +- The verification key is regenerated whenever `build/verification_key.json` changes diff --git a/tests/rust-vk/build.rs b/tests/rust-vk/build.rs new file mode 100644 index 0000000..131967a --- /dev/null +++ b/tests/rust-vk/build.rs @@ -0,0 +1,30 @@ +use groth16_solana::vk_parser::generate_vk_file; + +fn main() { + println!("cargo:rerun-if-changed=build/verification_key.json"); + println!("cargo:rerun-if-changed=build/compressed_account_merkle_proof_js"); + + // Generate the verifying key Rust file from the JSON + // This will be generated after running the circuit setup scripts + let vk_json_path = "./build/verification_key.json"; + let output_dir = "./src"; + let output_file = "verifying_key.rs"; + + // Only generate if the verification_key.json exists + if std::path::Path::new(vk_json_path).exists() { + generate_vk_file(vk_json_path, output_dir, output_file) + .expect("Failed to generate verifying key Rust file"); + println!("cargo:warning=Generated verifying_key.rs from verification_key.json"); + } else { + println!("cargo:warning=Verification key JSON not found. Run 'npm run build-all' first."); + } + + // Transpile the WebAssembly witness generator to native library + let witness_wasm_dir = "./build/compressed_account_merkle_proof_js"; + if std::path::Path::new(witness_wasm_dir).exists() { + rust_witness::transpile::transpile_wasm(witness_wasm_dir.to_string()); + println!("cargo:warning=Transpiled witness generator"); + } else { + println!("cargo:warning=Witness WASM not found. Run 'npm run compile' first."); + } +} diff --git a/tests/rust-vk/circuits/README.md b/tests/rust-vk/circuits/README.md new file mode 100644 index 0000000..200be6f --- /dev/null +++ b/tests/rust-vk/circuits/README.md @@ -0,0 +1,76 @@ +# ZK Circom Circuit for Compressed Account Merkle Proof + +This directory contains a circom circuit that verifies a Merkle proof of a compressed account on Solana. + +## Circuit Overview + +The `compressed_account_merkle_proof.circom` circuit combines two key components: + +1. **Compressed Account Hash**: Computes the hash of a compressed account using Poseidon hash + - Based on: https://github.com/ananas-block/compressed-account-circuit + - Inputs: owner_hashed, leaf_index, merkle_tree_hashed, discriminator, data_hash + +2. **Merkle Proof Verification**: Verifies the account exists in a Merkle tree + - Based on: /Users/ananas/dev/light-protocol2/circuit-lib/circuit-lib.circom + - Inputs: pathElements (26 levels), expectedRoot + +## Setup + +Run the setup script - it will handle dependencies, compilation, and key generation: + +```bash +./scripts/setup.sh +``` + +To clean up build artifacts: + +```bash +./scripts/clean.sh +``` + +## Testing + +### Rust Test with Mopro + +The circuit can be tested from Rust using the mopro library: + +```bash +cargo test test_compressed_account_merkle_proof_circuit +``` + +This test: +1. Loads the compiled circuit and zkey +2. Generates a proof with sample inputs +3. Verifies the proof is valid + +## Circuit Structure + +``` +CompressedAccountMerkleProof (main) +├── CompressedAccountHash +│ └── Poseidon(5) - Hashes account fields +└── MerkleProof(26) + ├── Num2Bits - Converts leaf index to bits + ├── Switcher[26] - Routes left/right based on path + └── Poseidon(2)[26] - Hashes up the tree +``` + +## Public Inputs + +The following inputs are public (visible in the proof): +- owner_hashed +- merkle_tree_hashed +- discriminator +- data_hash +- expectedRoot + +Private inputs: +- leaf_index +- pathElements + +## References + +- Compressed Account Circuit: https://github.com/ananas-block/compressed-account-circuit +- Merkle Proof Implementation: /Users/ananas/dev/light-protocol2/circuit-lib/circuit-lib.circom +- Mopro ZK Library: https://github.com/zkmopro/mopro +- SnarkJS: https://github.com/iden3/snarkjs diff --git a/tests/rust-vk/circuits/compressed_account_merkle_proof.circom b/tests/rust-vk/circuits/compressed_account_merkle_proof.circom new file mode 100644 index 0000000..fd0ddee --- /dev/null +++ b/tests/rust-vk/circuits/compressed_account_merkle_proof.circom @@ -0,0 +1,100 @@ +pragma circom 2.0.0; + +include "../node_modules/circomlib/circuits/poseidon.circom"; +include "../node_modules/circomlib/circuits/bitify.circom"; +include "../node_modules/circomlib/circuits/switcher.circom"; +include "../node_modules/circomlib/circuits/comparators.circom"; + +// Compressed Account Hash Template +// Computes the hash of a compressed account +template CompressedAccountHash() { + signal input owner_hashed; + signal input leaf_index; + signal input merkle_tree_hashed; + signal input discriminator; + signal input data_hash; + + signal output hash; + + component poseidon = Poseidon(5); + + poseidon.inputs[0] <== owner_hashed; + poseidon.inputs[1] <== leaf_index; + poseidon.inputs[2] <== merkle_tree_hashed; + poseidon.inputs[3] <== discriminator + 36893488147419103232; // + discriminator domain + poseidon.inputs[4] <== data_hash; + + hash <== poseidon.out; +} + +// Merkle Proof Verification Template +// Verifies that a leaf is in a Merkle tree with a given root +template MerkleProof(levels) { + signal input leaf; + signal input pathElements[levels]; + signal input leafIndex; + signal output root; + + component switcher[levels]; + component hasher[levels]; + + component indexBits = Num2Bits(levels); + indexBits.in <== leafIndex; + + for (var i = 0; i < levels; i++) { + switcher[i] = Switcher(); + switcher[i].L <== i == 0 ? leaf : hasher[i - 1].out; + switcher[i].R <== pathElements[i]; + switcher[i].sel <== indexBits.out[i]; + + hasher[i] = Poseidon(2); + hasher[i].inputs[0] <== switcher[i].outL; + hasher[i].inputs[1] <== switcher[i].outR; + } + + root <== hasher[levels - 1].out; +} + +// Main Circuit: Compressed Account Merkle Proof Verification +// Computes compressed account hash and verifies it exists in a Merkle tree +template CompressedAccountMerkleProof(levels) { + // Compressed account inputs + signal input owner_hashed; + signal input leaf_index; + signal input merkle_tree_hashed; + signal input discriminator; + signal input data_hash; + + // Merkle proof inputs + signal input pathElements[levels]; + signal input expectedRoot; + + // Step 1: Compute compressed account hash + component accountHasher = CompressedAccountHash(); + accountHasher.owner_hashed <== owner_hashed; + accountHasher.leaf_index <== leaf_index; + accountHasher.merkle_tree_hashed <== merkle_tree_hashed; + accountHasher.discriminator <== discriminator; + accountHasher.data_hash <== data_hash; + + // Step 2: Verify Merkle proof + component merkleProof = MerkleProof(levels); + merkleProof.leaf <== accountHasher.hash; + merkleProof.pathElements <== pathElements; + merkleProof.leafIndex <== leaf_index; + + // Step 3: CRITICAL CONSTRAINT - Enforce that computed root MUST equal expected root + // This === operator adds a constraint that will fail witness generation if roots don't match + merkleProof.root === expectedRoot; +} + +// Main component with 26 levels (typical for Solana state trees) +component main { + public [ + owner_hashed, + merkle_tree_hashed, + discriminator, + data_hash, + expectedRoot + ] +} = CompressedAccountMerkleProof(26); diff --git a/tests/rust-vk/package-lock.json b/tests/rust-vk/package-lock.json new file mode 100644 index 0000000..acdaf45 --- /dev/null +++ b/tests/rust-vk/package-lock.json @@ -0,0 +1,516 @@ +{ + "name": "groth16-solana-rust-vk-test", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "groth16-solana-rust-vk-test", + "version": "1.0.0", + "dependencies": { + "circomlib": "2.0.5" + }, + "devDependencies": { + "snarkjs": "^0.7.0" + } + }, + "node_modules/@iden3/bigarray": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/@iden3/bigarray/-/bigarray-0.0.2.tgz", + "integrity": "sha512-Xzdyxqm1bOFF6pdIsiHLLl3HkSLjbhqJHVyqaTxXt3RqXBEnmsUmEW47H7VOi/ak7TdkRpNkxjyK5Zbkm+y52g==", + "dev": true, + "license": "GPL-3.0" + }, + "node_modules/@iden3/binfileutils": { + "version": "0.0.12", + "resolved": "https://registry.npmjs.org/@iden3/binfileutils/-/binfileutils-0.0.12.tgz", + "integrity": "sha512-naAmzuDufRIcoNfQ1d99d7hGHufLA3wZSibtr4dMe6ZeiOPV1KwOZWTJ1YVz4HbaWlpDuzVU72dS4ATQS4PXBQ==", + "dev": true, + "license": "GPL-3.0", + "dependencies": { + "fastfile": "0.0.20", + "ffjavascript": "^0.3.0" + } + }, + "node_modules/async": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz", + "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==", + "dev": true, + "license": "MIT" + }, + "node_modules/b4a": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.7.3.tgz", + "integrity": "sha512-5Q2mfq2WfGuFp3uS//0s6baOJLMoVduPYVeNmDYxu5OUA1/cBfvr2RIS7vi62LdNj/urk1hfmj867I3qt6uZ7Q==", + "dev": true, + "license": "Apache-2.0", + "peerDependencies": { + "react-native-b4a": "*" + }, + "peerDependenciesMeta": { + "react-native-b4a": { + "optional": true + } + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/bfj": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/bfj/-/bfj-7.1.0.tgz", + "integrity": "sha512-I6MMLkn+anzNdCUp9hMRyui1HaNEUCco50lxbvNS4+EyXg8lN3nJ48PjPWtbH8UVS9CuMoaKE9U2V3l29DaRQw==", + "dev": true, + "license": "MIT", + "dependencies": { + "bluebird": "^3.7.2", + "check-types": "^11.2.3", + "hoopy": "^0.1.4", + "jsonpath": "^1.1.1", + "tryer": "^1.0.1" + }, + "engines": { + "node": ">= 8.0.0" + } + }, + "node_modules/blake2b-wasm": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/blake2b-wasm/-/blake2b-wasm-2.4.0.tgz", + "integrity": "sha512-S1kwmW2ZhZFFFOghcx73+ZajEfKBqhP82JMssxtLVMxlaPea1p9uoLiUZ5WYyHn0KddwbLc+0vh4wR0KBNoT5w==", + "dev": true, + "license": "MIT", + "dependencies": { + "b4a": "^1.0.1", + "nanoassert": "^2.0.0" + } + }, + "node_modules/bluebird": { + "version": "3.7.2", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", + "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", + "dev": true, + "license": "MIT" + }, + "node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/check-types": { + "version": "11.2.3", + "resolved": "https://registry.npmjs.org/check-types/-/check-types-11.2.3.tgz", + "integrity": "sha512-+67P1GkJRaxQD6PKK0Et9DhwQB+vGg3PM5+aavopCpZT1lj9jeqfvpgTLAWErNj8qApkkmXlu/Ug74kmhagkXg==", + "dev": true, + "license": "MIT" + }, + "node_modules/circom_runtime": { + "version": "0.1.28", + "resolved": "https://registry.npmjs.org/circom_runtime/-/circom_runtime-0.1.28.tgz", + "integrity": "sha512-ACagpQ7zBRLKDl5xRZ4KpmYIcZDUjOiNRuxvXLqhnnlLSVY1Dbvh73TI853nqoR0oEbihtWmMSjgc5f+pXf/jQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "ffjavascript": "0.3.1" + }, + "bin": { + "calcwit": "calcwit.js" + } + }, + "node_modules/circomlib": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/circomlib/-/circomlib-2.0.5.tgz", + "integrity": "sha512-O7NQ8OS+J4eshBuoy36z/TwQU0YHw8W3zxZcs4hVwpEll3e4hDm3mgkIPqItN8FDeLEKZFK3YeT/+k8TiLF3/A==", + "license": "GPL-3.0" + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/ejs": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.10.tgz", + "integrity": "sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "jake": "^10.8.5" + }, + "bin": { + "ejs": "bin/cli.js" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/escodegen": { + "version": "1.14.3", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.14.3.tgz", + "integrity": "sha512-qFcX0XJkdg+PB3xjZZG/wKSuT1PnQWx57+TVSjIMmILd2yC/6ByYElPwJnslDsuWuSAp4AwJGumarAAmJch5Kw==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esprima": "^4.0.1", + "estraverse": "^4.2.0", + "esutils": "^2.0.2", + "optionator": "^0.8.1" + }, + "bin": { + "escodegen": "bin/escodegen.js", + "esgenerate": "bin/esgenerate.js" + }, + "engines": { + "node": ">=4.0" + }, + "optionalDependencies": { + "source-map": "~0.6.1" + } + }, + "node_modules/escodegen/node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, + "license": "BSD-2-Clause", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/esprima": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-1.2.2.tgz", + "integrity": "sha512-+JpPZam9w5DuJ3Q67SqsMGtiHKENSMRVoxvArfJZK01/BfLEObtZ6orJa/MtoGNR/rfMgp5837T41PAmTwAv/A==", + "dev": true, + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fastfile": { + "version": "0.0.20", + "resolved": "https://registry.npmjs.org/fastfile/-/fastfile-0.0.20.tgz", + "integrity": "sha512-r5ZDbgImvVWCP0lA/cGNgQcZqR+aYdFx3u+CtJqUE510pBUVGMn4ulL/iRTI4tACTYsNJ736uzFxEBXesPAktA==", + "dev": true, + "license": "GPL-3.0" + }, + "node_modules/ffjavascript": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/ffjavascript/-/ffjavascript-0.3.1.tgz", + "integrity": "sha512-4PbK1WYodQtuF47D4pRI5KUg3Q392vuP5WjE1THSnceHdXwU3ijaoS0OqxTzLknCtz4Z2TtABzkBdBdMn3B/Aw==", + "dev": true, + "license": "GPL-3.0", + "dependencies": { + "wasmbuilder": "0.0.16", + "wasmcurves": "0.2.2", + "web-worker": "1.2.0" + } + }, + "node_modules/filelist": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz", + "integrity": "sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "minimatch": "^5.0.1" + } + }, + "node_modules/hoopy": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/hoopy/-/hoopy-0.1.4.tgz", + "integrity": "sha512-HRcs+2mr52W0K+x8RzcLzuPPmVIKMSv97RGHy0Ea9y/mpcaK+xTrjICA04KAHi4GRzxliNqNJEFYWHghy3rSfQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/jake": { + "version": "10.9.4", + "resolved": "https://registry.npmjs.org/jake/-/jake-10.9.4.tgz", + "integrity": "sha512-wpHYzhxiVQL+IV05BLE2Xn34zW1S223hvjtqk0+gsPrwd/8JNLXJgZZM/iPFsYc1xyphF+6M6EvdE5E9MBGkDA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "async": "^3.2.6", + "filelist": "^1.0.4", + "picocolors": "^1.1.1" + }, + "bin": { + "jake": "bin/cli.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/js-sha3": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/jsonpath": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/jsonpath/-/jsonpath-1.1.1.tgz", + "integrity": "sha512-l6Cg7jRpixfbgoWgkrl77dgEj8RPvND0wMH6TwQmi9Qs4TFfS9u5cUFnbeKTwj5ga5Y3BTGGNI28k117LJ009w==", + "dev": true, + "license": "MIT", + "dependencies": { + "esprima": "1.2.2", + "static-eval": "2.0.2", + "underscore": "1.12.1" + } + }, + "node_modules/levn": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/logplease": { + "version": "1.2.15", + "resolved": "https://registry.npmjs.org/logplease/-/logplease-1.2.15.tgz", + "integrity": "sha512-jLlHnlsPSJjpwUfcNyUxXCl33AYg2cHhIf9QhGL2T4iPT0XPB+xP1LRKFPgIg1M/sg9kAJvy94w9CzBNrfnstA==", + "dev": true, + "license": "MIT" + }, + "node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/nanoassert": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/nanoassert/-/nanoassert-2.0.0.tgz", + "integrity": "sha512-7vO7n28+aYO4J+8w96AzhmU8G+Y/xpPDJz/se19ICsqj/momRbb9mh9ZUtkoJ5X3nTnPdhEJyc0qnM6yAsHBaA==", + "dev": true, + "license": "ISC" + }, + "node_modules/optionator": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", + "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", + "dev": true, + "license": "MIT", + "dependencies": { + "deep-is": "~0.1.3", + "fast-levenshtein": "~2.0.6", + "levn": "~0.3.0", + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2", + "word-wrap": "~1.2.3" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/prelude-ls": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/r1csfile": { + "version": "0.0.48", + "resolved": "https://registry.npmjs.org/r1csfile/-/r1csfile-0.0.48.tgz", + "integrity": "sha512-kHRkKUJNaor31l05f2+RFzvcH5XSa7OfEfd/l4hzjte6NL6fjRkSMfZ4BjySW9wmfdwPOtq3mXurzPvPGEf5Tw==", + "dev": true, + "license": "GPL-3.0", + "dependencies": { + "@iden3/bigarray": "0.0.2", + "@iden3/binfileutils": "0.0.12", + "fastfile": "0.0.20", + "ffjavascript": "0.3.0" + } + }, + "node_modules/r1csfile/node_modules/ffjavascript": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/ffjavascript/-/ffjavascript-0.3.0.tgz", + "integrity": "sha512-l7sR5kmU3gRwDy8g0Z2tYBXy5ttmafRPFOqY7S6af5cq51JqJWt5eQ/lSR/rs2wQNbDYaYlQr5O+OSUf/oMLoQ==", + "dev": true, + "license": "GPL-3.0", + "dependencies": { + "wasmbuilder": "0.0.16", + "wasmcurves": "0.2.2", + "web-worker": "1.2.0" + } + }, + "node_modules/snarkjs": { + "version": "0.7.5", + "resolved": "https://registry.npmjs.org/snarkjs/-/snarkjs-0.7.5.tgz", + "integrity": "sha512-h+3c4rXZKLhLuHk4LHydZCk/h5GcNvk5GjVKRRkHmfb6Ntf8gHOA9zea3g656iclRuhqQ3iKDWFgiD9ypLrKiA==", + "dev": true, + "license": "GPL-3.0", + "dependencies": { + "@iden3/binfileutils": "0.0.12", + "bfj": "^7.0.2", + "blake2b-wasm": "^2.4.0", + "circom_runtime": "0.1.28", + "ejs": "^3.1.6", + "fastfile": "0.0.20", + "ffjavascript": "0.3.1", + "js-sha3": "^0.8.0", + "logplease": "^1.2.15", + "r1csfile": "0.0.48" + }, + "bin": { + "snarkjs": "build/cli.cjs" + } + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "license": "BSD-3-Clause", + "optional": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/static-eval": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/static-eval/-/static-eval-2.0.2.tgz", + "integrity": "sha512-N/D219Hcr2bPjLxPiV+TQE++Tsmrady7TqAJugLy7Xk1EumfDWS/f5dtBbkRCGE7wKKXuYockQoj8Rm2/pVKyg==", + "dev": true, + "license": "MIT", + "dependencies": { + "escodegen": "^1.8.1" + } + }, + "node_modules/tryer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/tryer/-/tryer-1.0.1.tgz", + "integrity": "sha512-c3zayb8/kWWpycWYg87P71E1S1ZL6b6IJxfb5fvsUgsf0S2MVGaDhDXXjDMpdCpfWXqptc+4mXwmiy1ypXqRAA==", + "dev": true, + "license": "MIT" + }, + "node_modules/type-check": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "~1.1.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/underscore": { + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.12.1.tgz", + "integrity": "sha512-hEQt0+ZLDVUMhebKxL4x1BTtDY7bavVofhZ9KZ4aI26X9SRaE+Y3m83XUL1UP2jn8ynjndwCCpEHdUG+9pP1Tw==", + "dev": true, + "license": "MIT" + }, + "node_modules/wasmbuilder": { + "version": "0.0.16", + "resolved": "https://registry.npmjs.org/wasmbuilder/-/wasmbuilder-0.0.16.tgz", + "integrity": "sha512-Qx3lEFqaVvp1cEYW7Bfi+ebRJrOiwz2Ieu7ZG2l7YyeSJIok/reEQCQCuicj/Y32ITIJuGIM9xZQppGx5LrQdA==", + "dev": true, + "license": "GPL-3.0" + }, + "node_modules/wasmcurves": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/wasmcurves/-/wasmcurves-0.2.2.tgz", + "integrity": "sha512-JRY908NkmKjFl4ytnTu5ED6AwPD+8VJ9oc94kdq7h5bIwbj0L4TDJ69mG+2aLs2SoCmGfqIesMWTEJjtYsoQXQ==", + "dev": true, + "license": "GPL-3.0", + "dependencies": { + "wasmbuilder": "0.0.16" + } + }, + "node_modules/web-worker": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/web-worker/-/web-worker-1.2.0.tgz", + "integrity": "sha512-PgF341avzqyx60neE9DD+XS26MMNMoUQRz9NOZwW32nPQrF6p77f1htcnjBSEV8BGMKZ16choqUG4hyI0Hx7mA==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + } + } +} diff --git a/tests/rust-vk/package.json b/tests/rust-vk/package.json new file mode 100644 index 0000000..74830c3 --- /dev/null +++ b/tests/rust-vk/package.json @@ -0,0 +1,20 @@ +{ + "name": "groth16-solana-rust-vk-test", + "version": "1.0.0", + "description": "Integration test for groth16-solana with Rust VK parser", + "scripts": { + "setup": "./scripts/setup.sh", + "clean": "rm -rf build/* node_modules", + "compile": "mkdir -p build && circom circuits/compressed_account_merkle_proof.circom --r1cs --wasm --sym -o build", + "setup-circuit": "snarkjs groth16 setup build/compressed_account_merkle_proof.r1cs pot/powersOfTau28_hez_final_16.ptau build/compressed_account_merkle_proof_0000.zkey", + "contribute": "snarkjs zkey contribute build/compressed_account_merkle_proof_0000.zkey build/compressed_account_merkle_proof_final.zkey --name='Test contribution' -e='random entropy'", + "export-vkey": "snarkjs zkey export verificationkey build/compressed_account_merkle_proof_final.zkey build/verification_key.json", + "build-all": "npm run setup && npm run compile && npm run setup-circuit && npm run contribute && npm run export-vkey" + }, + "dependencies": { + "circomlib": "2.0.5" + }, + "devDependencies": { + "snarkjs": "^0.7.0" + } +} diff --git a/tests/rust-vk/scripts/setup.sh b/tests/rust-vk/scripts/setup.sh new file mode 100755 index 0000000..1b7f8e5 --- /dev/null +++ b/tests/rust-vk/scripts/setup.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +set -e + +echo "Setting up groth16-solana integration test..." + +# Create directories +mkdir -p pot build + +# Download powers of tau if not exists +POT_FILE="pot/powersOfTau28_hez_final_16.ptau" +if [ ! -f "$POT_FILE" ]; then + echo "Downloading powers of tau ceremony file..." + curl -L https://storage.googleapis.com/zkevm/ptau/powersOfTau28_hez_final_16.ptau -o "$POT_FILE" + echo "Powers of tau downloaded successfully" +else + echo "Powers of tau file already exists, skipping download" +fi + +# Install npm dependencies +echo "Installing npm dependencies..." +npm install + +echo "Setup complete! Run 'npm run build-all' to compile the circuit and generate keys" diff --git a/tests/rust-vk/src/lib.rs b/tests/rust-vk/src/lib.rs new file mode 100644 index 0000000..c4d1366 --- /dev/null +++ b/tests/rust-vk/src/lib.rs @@ -0,0 +1,174 @@ +#![allow(unused)] +use circom_prover::{prover::ProofLib, witness::WitnessFn, CircomProver}; +use groth16_solana::groth16::Groth16Verifier; +use groth16_solana::proof_parser::circom_prover::{convert_proof, convert_public_inputs}; +use light_compressed_account::compressed_account::{CompressedAccount, CompressedAccountData}; +use light_compressed_account::Pubkey; +use light_hasher::{hash_to_field_size::hash_to_bn254_field_size_be, Poseidon}; +use light_merkle_tree_reference::MerkleTree; +use num_bigint::BigUint; +use std::collections::HashMap; + +// Link the generated witness library +#[link(name = "circuit", kind = "static")] +extern "C" {} + +// Declare the witness function +rust_witness::witness!(compressedaccountmerkleproof); + +// Include the generated verifying key +// This will be generated by build.rs from the verification_key.json +mod verifying_key; + +use verifying_key::VERIFYINGKEY; + +/// Helper function to add compressed account inputs to the circuit inputs HashMap +fn add_compressed_account_to_circuit_inputs( + inputs: &mut HashMap>, + compressed_account: &CompressedAccount, + merkle_tree_pubkey: &Pubkey, + leaf_index: u32, +) { + let owner = compressed_account.owner; + let (discriminator, data_hash) = if let Some(ref data) = compressed_account.data { + (data.discriminator, data.data_hash) + } else { + ([0u8; 8], [0u8; 32]) + }; + + let owner_hashed = hash_to_bn254_field_size_be(owner.as_ref()); + let merkle_tree_hashed = hash_to_bn254_field_size_be(merkle_tree_pubkey.as_ref()); + + inputs.insert( + "owner_hashed".to_string(), + vec![BigUint::from_bytes_be(&owner_hashed).to_string()], + ); + inputs.insert("leaf_index".to_string(), vec![leaf_index.to_string()]); + inputs.insert( + "merkle_tree_hashed".to_string(), + vec![BigUint::from_bytes_be(&merkle_tree_hashed).to_string()], + ); + inputs.insert( + "discriminator".to_string(), + vec![BigUint::from_bytes_be(&discriminator).to_string()], + ); + inputs.insert( + "data_hash".to_string(), + vec![BigUint::from_bytes_be(&data_hash).to_string()], + ); + + println!("Public inputs (in circuit order):"); + println!(" [0] owner_hashed: {:?}", owner_hashed); + println!(" [1] merkle_tree_hashed: {:?}", merkle_tree_hashed); + println!(" [2] discriminator: {:?}", discriminator); + println!(" [3] data_hash: {:?}", data_hash); +} + +/// Helper function to add Merkle proof inputs to the circuit inputs HashMap +fn add_merkle_proof_to_circuit_inputs( + inputs: &mut HashMap>, + merkle_proof_hashes: &[[u8; 32]], + merkle_root: &[u8; 32], +) { + let path_elements: Vec = merkle_proof_hashes + .iter() + .map(|hash| BigUint::from_bytes_be(hash).to_string()) + .collect(); + inputs.insert("pathElements".to_string(), path_elements); + + let expected_root_bigint = BigUint::from_bytes_be(merkle_root); + inputs.insert( + "expectedRoot".to_string(), + vec![expected_root_bigint.to_string()], + ); + + println!(" [4] expectedRoot: {:?}", merkle_root); +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_compressed_account_proof_with_groth16_solana() { + let zkey_path = "./build/compressed_account_merkle_proof_final.zkey".to_string(); + + // Create compressed account + let owner = Pubkey::new_from_array([1u8; 32]); + let merkle_tree_pubkey = Pubkey::new_from_array([2u8; 32]); + let leaf_index: u32 = 0; + + let compressed_account = CompressedAccount { + owner, + lamports: 0, + address: None, + data: Some(CompressedAccountData { + discriminator: [1u8; 8], + data: vec![], + data_hash: [3u8; 32], + }), + }; + + // Create Merkle tree and get proof + let compressed_account_hash = compressed_account + .hash(&merkle_tree_pubkey, &leaf_index, false) + .unwrap(); + + let mut merkle_tree = MerkleTree::::new(26, 0); + merkle_tree.append(&compressed_account_hash).unwrap(); + + let merkle_proof_hashes = merkle_tree + .get_proof_of_leaf(leaf_index as usize, false) + .unwrap(); + let merkle_root = merkle_tree.root(); + + // Build circuit inputs + let mut proof_inputs = HashMap::new(); + add_compressed_account_to_circuit_inputs( + &mut proof_inputs, + &compressed_account, + &merkle_tree_pubkey, + leaf_index, + ); + add_merkle_proof_to_circuit_inputs(&mut proof_inputs, &merkle_proof_hashes, &merkle_root); + + // Generate proof using circom-prover + let circuit_inputs = serde_json::to_string(&proof_inputs).unwrap(); + let proof = CircomProver::prove( + ProofLib::Arkworks, + WitnessFn::RustWitness(compressedaccountmerkleproof_witness), + circuit_inputs, + zkey_path.clone(), + ) + .expect("Proof generation failed"); + println!( + "Proof generated successfully with circom-prover {:?}", + proof + ); + // First verify the proof with circom-prover to ensure it's valid + let is_valid_circom = + CircomProver::verify(ProofLib::Arkworks, proof.clone(), zkey_path.clone()) + .expect("Circom proof verification failed"); + assert!( + is_valid_circom, + "Proof should be valid according to circom-prover" + ); + println!("Proof verified successfully with circom-prover"); + + // Convert proof and public inputs to groth16-solana format + let (proof_a, proof_b, proof_c) = + convert_proof(&proof.proof).expect("Failed to convert proof to groth16-solana format"); + let public_inputs: [[u8; 32]; 5] = convert_public_inputs(&proof.pub_inputs); + println!("Public inputs for groth16-solana: {:?}", public_inputs); + println!("Proof A: {:?}", proof_a); + println!("Proof B: {:?}", proof_b); + println!("Proof C: {:?}", proof_c); + let mut verifier = + Groth16Verifier::new(&proof_a, &proof_b, &proof_c, &public_inputs, &VERIFYINGKEY) + .expect("Failed to create verifier"); + + verifier.verify().expect("Proof verification failed"); + + println!("Proof verified successfully with groth16-solana!"); + } +} diff --git a/tests/rust-vk/src/verifying_key.rs b/tests/rust-vk/src/verifying_key.rs new file mode 100644 index 0000000..4e47b47 --- /dev/null +++ b/tests/rust-vk/src/verifying_key.rs @@ -0,0 +1,22 @@ +use groth16_solana::groth16::Groth16Verifyingkey; + +pub const VERIFYINGKEY: Groth16Verifyingkey = Groth16Verifyingkey { + nr_pubinputs: 5, + + vk_alpha_g1: [45u8, 77u8, 154u8, 167u8, 227u8, 2u8, 217u8, 223u8, 65u8, 116u8, 157u8, 85u8, 7u8, 148u8, 157u8, 5u8, 219u8, 234u8, 51u8, 251u8, 177u8, 108u8, 100u8, 59u8, 34u8, 245u8, 153u8, 162u8, 190u8, 109u8, 242u8, 226u8, 20u8, 190u8, 221u8, 80u8, 60u8, 55u8, 206u8, 176u8, 97u8, 216u8, 236u8, 96u8, 32u8, 159u8, 227u8, 69u8, 206u8, 137u8, 131u8, 10u8, 25u8, 35u8, 3u8, 1u8, 240u8, 118u8, 202u8, 255u8, 0u8, 77u8, 25u8, 38u8], + + vk_beta_g2: [9u8, 103u8, 3u8, 47u8, 203u8, 247u8, 118u8, 209u8, 175u8, 201u8, 133u8, 248u8, 136u8, 119u8, 241u8, 130u8, 211u8, 132u8, 128u8, 166u8, 83u8, 242u8, 222u8, 202u8, 169u8, 121u8, 76u8, 188u8, 59u8, 243u8, 6u8, 12u8, 14u8, 24u8, 120u8, 71u8, 173u8, 76u8, 121u8, 131u8, 116u8, 208u8, 214u8, 115u8, 43u8, 245u8, 1u8, 132u8, 125u8, 214u8, 139u8, 192u8, 224u8, 113u8, 36u8, 30u8, 2u8, 19u8, 188u8, 127u8, 193u8, 61u8, 183u8, 171u8, 48u8, 76u8, 251u8, 209u8, 224u8, 138u8, 112u8, 74u8, 153u8, 245u8, 232u8, 71u8, 217u8, 63u8, 140u8, 60u8, 170u8, 253u8, 222u8, 196u8, 107u8, 122u8, 13u8, 55u8, 157u8, 166u8, 154u8, 77u8, 17u8, 35u8, 70u8, 167u8, 23u8, 57u8, 193u8, 177u8, 164u8, 87u8, 168u8, 199u8, 49u8, 49u8, 35u8, 210u8, 77u8, 47u8, 145u8, 146u8, 248u8, 150u8, 183u8, 198u8, 62u8, 234u8, 5u8, 169u8, 213u8, 127u8, 6u8, 84u8, 122u8, 208u8, 206u8, 200u8], + + vk_gamma_g2: [25u8, 142u8, 147u8, 147u8, 146u8, 13u8, 72u8, 58u8, 114u8, 96u8, 191u8, 183u8, 49u8, 251u8, 93u8, 37u8, 241u8, 170u8, 73u8, 51u8, 53u8, 169u8, 231u8, 18u8, 151u8, 228u8, 133u8, 183u8, 174u8, 243u8, 18u8, 194u8, 24u8, 0u8, 222u8, 239u8, 18u8, 31u8, 30u8, 118u8, 66u8, 106u8, 0u8, 102u8, 94u8, 92u8, 68u8, 121u8, 103u8, 67u8, 34u8, 212u8, 247u8, 94u8, 218u8, 221u8, 70u8, 222u8, 189u8, 92u8, 217u8, 146u8, 246u8, 237u8, 9u8, 6u8, 137u8, 208u8, 88u8, 95u8, 240u8, 117u8, 236u8, 158u8, 153u8, 173u8, 105u8, 12u8, 51u8, 149u8, 188u8, 75u8, 49u8, 51u8, 112u8, 179u8, 142u8, 243u8, 85u8, 172u8, 218u8, 220u8, 209u8, 34u8, 151u8, 91u8, 18u8, 200u8, 94u8, 165u8, 219u8, 140u8, 109u8, 235u8, 74u8, 171u8, 113u8, 128u8, 141u8, 203u8, 64u8, 143u8, 227u8, 209u8, 231u8, 105u8, 12u8, 67u8, 211u8, 123u8, 76u8, 230u8, 204u8, 1u8, 102u8, 250u8, 125u8, 170u8], + + vk_delta_g2: [29u8, 101u8, 86u8, 247u8, 6u8, 195u8, 12u8, 191u8, 43u8, 222u8, 235u8, 242u8, 147u8, 233u8, 121u8, 93u8, 83u8, 252u8, 44u8, 61u8, 94u8, 229u8, 105u8, 232u8, 9u8, 253u8, 67u8, 31u8, 174u8, 9u8, 16u8, 187u8, 27u8, 125u8, 210u8, 232u8, 114u8, 142u8, 123u8, 67u8, 44u8, 126u8, 11u8, 182u8, 127u8, 1u8, 20u8, 144u8, 1u8, 164u8, 61u8, 63u8, 135u8, 177u8, 180u8, 193u8, 178u8, 98u8, 206u8, 69u8, 227u8, 229u8, 89u8, 66u8, 41u8, 82u8, 242u8, 150u8, 164u8, 228u8, 129u8, 0u8, 233u8, 115u8, 15u8, 189u8, 40u8, 32u8, 52u8, 82u8, 239u8, 56u8, 158u8, 185u8, 139u8, 27u8, 72u8, 139u8, 122u8, 110u8, 89u8, 64u8, 244u8, 137u8, 155u8, 220u8, 27u8, 62u8, 173u8, 25u8, 4u8, 255u8, 70u8, 49u8, 164u8, 34u8, 141u8, 154u8, 59u8, 27u8, 209u8, 25u8, 232u8, 157u8, 58u8, 143u8, 148u8, 105u8, 178u8, 66u8, 226u8, 156u8, 68u8, 197u8, 234u8, 139u8, 5u8, 176u8], + + vk_ic: &[ + [12u8, 192u8, 31u8, 5u8, 252u8, 153u8, 69u8, 152u8, 16u8, 193u8, 229u8, 27u8, 107u8, 12u8, 131u8, 157u8, 181u8, 114u8, 177u8, 46u8, 213u8, 38u8, 159u8, 73u8, 102u8, 40u8, 81u8, 214u8, 58u8, 242u8, 73u8, 236u8, 0u8, 58u8, 182u8, 252u8, 156u8, 30u8, 52u8, 250u8, 147u8, 222u8, 206u8, 111u8, 25u8, 4u8, 107u8, 115u8, 113u8, 133u8, 43u8, 77u8, 19u8, 249u8, 34u8, 131u8, 134u8, 29u8, 211u8, 140u8, 237u8, 147u8, 30u8, 7u8], + [9u8, 110u8, 51u8, 213u8, 168u8, 169u8, 164u8, 244u8, 19u8, 76u8, 14u8, 226u8, 213u8, 125u8, 216u8, 90u8, 119u8, 166u8, 116u8, 61u8, 176u8, 65u8, 159u8, 48u8, 229u8, 17u8, 174u8, 208u8, 151u8, 239u8, 129u8, 240u8, 31u8, 23u8, 226u8, 142u8, 142u8, 189u8, 121u8, 137u8, 47u8, 204u8, 35u8, 136u8, 216u8, 198u8, 164u8, 12u8, 93u8, 183u8, 45u8, 207u8, 112u8, 240u8, 113u8, 41u8, 111u8, 19u8, 197u8, 177u8, 167u8, 71u8, 172u8, 125u8], + [42u8, 196u8, 14u8, 64u8, 95u8, 212u8, 162u8, 19u8, 5u8, 80u8, 227u8, 221u8, 1u8, 190u8, 42u8, 223u8, 97u8, 165u8, 33u8, 109u8, 138u8, 210u8, 40u8, 82u8, 231u8, 37u8, 29u8, 98u8, 180u8, 32u8, 101u8, 225u8, 38u8, 201u8, 17u8, 234u8, 168u8, 4u8, 165u8, 151u8, 1u8, 204u8, 196u8, 33u8, 147u8, 161u8, 210u8, 91u8, 200u8, 239u8, 230u8, 152u8, 163u8, 3u8, 232u8, 1u8, 33u8, 55u8, 28u8, 149u8, 241u8, 133u8, 25u8, 207u8], + [37u8, 193u8, 7u8, 139u8, 47u8, 18u8, 214u8, 151u8, 196u8, 40u8, 110u8, 111u8, 149u8, 1u8, 58u8, 190u8, 105u8, 197u8, 122u8, 12u8, 98u8, 38u8, 24u8, 5u8, 123u8, 31u8, 26u8, 50u8, 18u8, 175u8, 245u8, 140u8, 26u8, 182u8, 233u8, 126u8, 204u8, 44u8, 225u8, 78u8, 38u8, 138u8, 242u8, 127u8, 3u8, 31u8, 89u8, 84u8, 137u8, 139u8, 182u8, 94u8, 88u8, 190u8, 177u8, 253u8, 207u8, 84u8, 232u8, 115u8, 231u8, 205u8, 235u8, 186u8], + [21u8, 10u8, 233u8, 74u8, 135u8, 47u8, 118u8, 170u8, 135u8, 5u8, 211u8, 202u8, 125u8, 176u8, 78u8, 204u8, 7u8, 204u8, 181u8, 215u8, 166u8, 122u8, 3u8, 40u8, 49u8, 99u8, 115u8, 191u8, 83u8, 134u8, 58u8, 69u8, 3u8, 121u8, 255u8, 73u8, 110u8, 240u8, 240u8, 60u8, 219u8, 180u8, 124u8, 27u8, 165u8, 0u8, 88u8, 80u8, 217u8, 152u8, 34u8, 246u8, 34u8, 195u8, 148u8, 37u8, 207u8, 236u8, 0u8, 120u8, 154u8, 60u8, 152u8, 209u8], + [42u8, 66u8, 27u8, 187u8, 193u8, 14u8, 48u8, 193u8, 195u8, 71u8, 164u8, 58u8, 40u8, 58u8, 74u8, 151u8, 2u8, 132u8, 65u8, 86u8, 4u8, 102u8, 73u8, 22u8, 113u8, 71u8, 235u8, 55u8, 3u8, 121u8, 70u8, 184u8, 42u8, 243u8, 12u8, 20u8, 194u8, 124u8, 62u8, 60u8, 228u8, 53u8, 208u8, 43u8, 171u8, 182u8, 240u8, 3u8, 45u8, 105u8, 185u8, 34u8, 252u8, 46u8, 251u8, 217u8, 171u8, 226u8, 140u8, 124u8, 186u8, 183u8, 35u8, 194u8], + ] +};