From 7988f10d9b28585a1f10ab6dde3e89cee4ad66f9 Mon Sep 17 00:00:00 2001 From: Chance Date: Wed, 29 Jan 2025 21:18:40 -0600 Subject: [PATCH] Remove ashlang (#309) * refactor: remove ashlang * fix(ci): remove ashlang test * fix: re-add e2e tests --- .github/workflows/build-and-test.yml | 12 - Cargo.lock | 328 +----------------- mopro-ffi/Cargo.toml | 6 +- mopro-ffi/src/ashlang/mod.rs | 77 ---- mopro-ffi/src/lib.rs | 26 -- mopro-ffi/src/mopro.udl | 7 - test-e2e/Cargo.toml | 2 +- test-e2e/android/.idea/other.xml | 161 +++++++-- .../ios/mopro-test.xcodeproj/project.pbxproj | 10 +- test-e2e/ios/mopro-test/ContentView.swift | 64 ---- test-e2e/tests/ashlang.rs | 4 - .../tests/bindings/test_ashlang_example.kts | 21 -- .../tests/bindings/test_ashlang_example.swift | 27 -- test-vectors/ashlang/example.ar1cs | 291 ---------------- test-vectors/ashlang/multiplier2.ar1cs | 12 - 15 files changed, 162 insertions(+), 886 deletions(-) delete mode 100644 mopro-ffi/src/ashlang/mod.rs delete mode 100644 test-e2e/tests/ashlang.rs delete mode 100644 test-e2e/tests/bindings/test_ashlang_example.kts delete mode 100644 test-e2e/tests/bindings/test_ashlang_example.swift delete mode 100644 test-vectors/ashlang/example.ar1cs delete mode 100644 test-vectors/ashlang/multiplier2.ar1cs diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 22f2b324..98ff28a3 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -65,18 +65,6 @@ jobs: override: true - name: Run ffi circom tests run: cd mopro-ffi && cargo test --features circom --no-default-features - test-ffi-ashlang: - runs-on: ubuntu-latest - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name - steps: - - uses: actions/checkout@v4 - - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - name: Run ffi ashlang tests - run: cd mopro-ffi && cargo test --features ashlang --no-default-features setup-halo2-wasm-env: runs-on: ubuntu-latest if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name diff --git a/Cargo.lock b/Cargo.lock index 11be385d..1ab16534 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -66,21 +66,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - [[package]] name = "anstream" version = "0.6.18" @@ -385,27 +370,6 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" -[[package]] -name = "ashlang" -version = "0.1.3" -source = "git+https://github.com/chancehudson/ashlang.git?rev=696960a0c15db47170fdd1ff058682023d904b1b#696960a0c15db47170fdd1ff058682023d904b1b" -dependencies = [ - "anyhow", - "camino", - "chrono", - "clap 4.5.27", - "colored", - "curve25519-dalek", - "lazy_static", - "merlin", - "pest", - "pest_derive", - "ring-math", - "scalarff", - "serde", - "spartan", -] - [[package]] name = "askama" version = "0.12.1" @@ -582,26 +546,14 @@ dependencies = [ "constant_time_eq", ] -[[package]] -name = "block-buffer" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" -dependencies = [ - "block-padding 0.1.5", - "byte-tools", - "byteorder", - "generic-array 0.12.4", -] - [[package]] name = "block-buffer" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ - "block-padding 0.2.1", - "generic-array 0.14.7", + "block-padding", + "generic-array", ] [[package]] @@ -610,16 +562,7 @@ version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" dependencies = [ - "generic-array 0.14.7", -] - -[[package]] -name = "block-padding" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" -dependencies = [ - "byte-tools", + "generic-array", ] [[package]] @@ -663,12 +606,6 @@ version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" -[[package]] -name = "byte-tools" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" - [[package]] name = "bytecheck" version = "0.6.12" @@ -794,12 +731,7 @@ version = "0.4.39" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825" dependencies = [ - "android-tzdata", - "iana-time-zone", - "js-sys", "num-traits", - "wasm-bindgen", - "windows-targets", ] [[package]] @@ -944,16 +876,6 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" -[[package]] -name = "colored" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c" -dependencies = [ - "lazy_static", - "windows-sys 0.59.0", -] - [[package]] name = "console" version = "0.15.10" @@ -1120,7 +1042,7 @@ version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef" dependencies = [ - "generic-array 0.14.7", + "generic-array", "rand_core", "subtle", "zeroize", @@ -1132,7 +1054,7 @@ version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ - "generic-array 0.14.7", + "generic-array", "rand_core", "subtle", "zeroize", @@ -1144,7 +1066,7 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "generic-array 0.14.7", + "generic-array", "typenum", ] @@ -1169,35 +1091,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "curve25519-dalek" -version = "4.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" -dependencies = [ - "cfg-if", - "cpufeatures", - "curve25519-dalek-derive", - "fiat-crypto", - "group 0.13.0", - "rand_core", - "rustc_version", - "serde", - "subtle", - "zeroize", -] - -[[package]] -name = "curve25519-dalek-derive" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.96", -] - [[package]] name = "deflate64" version = "0.1.9" @@ -1287,22 +1180,13 @@ dependencies = [ "zeroize", ] -[[package]] -name = "digest" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" -dependencies = [ - "generic-array 0.12.4", -] - [[package]] name = "digest" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ - "generic-array 0.14.7", + "generic-array", ] [[package]] @@ -1371,7 +1255,7 @@ dependencies = [ "der 0.6.1", "digest 0.10.7", "ff 0.12.1", - "generic-array 0.14.7", + "generic-array", "group 0.12.1", "rand_core", "sec1 0.3.0", @@ -1389,7 +1273,7 @@ dependencies = [ "crypto-bigint 0.5.5", "digest 0.10.7", "ff 0.13.0", - "generic-array 0.14.7", + "generic-array", "group 0.13.0", "pkcs8 0.10.2", "rand_core", @@ -1533,7 +1417,7 @@ dependencies = [ "elliptic-curve 0.12.3", "ethabi 17.2.0", "fastrlp", - "generic-array 0.14.7", + "generic-array", "hex", "k256 0.11.6", "rand", @@ -1559,7 +1443,7 @@ dependencies = [ "chrono", "elliptic-curve 0.13.8", "ethabi 18.0.0", - "generic-array 0.14.7", + "generic-array", "hex", "k256 0.13.4", "num_enum", @@ -1637,12 +1521,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "fiat-crypto" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" - [[package]] name = "fibonacci-circuit" version = "0.1.0" @@ -1802,15 +1680,6 @@ dependencies = [ "plonkish_backend", ] -[[package]] -name = "generic-array" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" -dependencies = [ - "typenum", -] - [[package]] name = "generic-array" version = "0.14.7" @@ -2182,29 +2051,6 @@ dependencies = [ "plonkish_backend", ] -[[package]] -name = "iana-time-zone" -version = "0.1.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows-core", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - [[package]] name = "icu_collections" version = "1.5.0" @@ -2455,7 +2301,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" dependencies = [ - "generic-array 0.14.7", + "generic-array", ] [[package]] @@ -2603,18 +2449,6 @@ 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 = "mime" version = "0.3.17" @@ -2701,7 +2535,6 @@ dependencies = [ "ark-bls12-381", "ark-bn254", "ark-ff", - "ashlang", "bincode", "circom-prover", "color-eyre", @@ -2905,12 +2738,6 @@ version = "11.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b410bbe7e14ab526a0e86877eb47c6996a2bd7746f027ba551028c925390e4e9" -[[package]] -name = "opaque-debug" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" - [[package]] name = "opaque-debug" version = "0.3.1" @@ -3063,51 +2890,6 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" -[[package]] -name = "pest" -version = "2.7.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b7cafe60d6cf8e62e1b9b2ea516a089c008945bb5a275416789e7db0bc199dc" -dependencies = [ - "memchr", - "thiserror 2.0.3", - "ucd-trie", -] - -[[package]] -name = "pest_derive" -version = "2.7.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "816518421cfc6887a0d62bf441b6ffb4536fcc926395a69e1a85852d4363f57e" -dependencies = [ - "pest", - "pest_generator", -] - -[[package]] -name = "pest_generator" -version = "2.7.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d1396fd3a870fc7838768d171b4616d5c91f6cc25e377b673d714567d99377b" -dependencies = [ - "pest", - "pest_meta", - "proc-macro2", - "quote", - "syn 2.0.96", -] - -[[package]] -name = "pest_meta" -version = "2.7.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1e58089ea25d717bfd31fb534e4f3afcc2cc569c70de3e239778991ea3b7dea" -dependencies = [ - "once_cell", - "pest", - "sha2", -] - [[package]] name = "pin-project-lite" version = "0.2.16" @@ -3172,7 +2954,7 @@ source = "git+https://github.com/sifnoc/plonkish?branch=setup_custom#4f42eeb3ff0 dependencies = [ "bincode", "bitvec", - "generic-array 0.14.7", + "generic-array", "halo2_proofs 0.2.0 (git+https://github.com/han0110/halo2.git?branch=feature%2Ffor-benchmark)", "halo2curves 0.3.3", "itertools 0.10.5", @@ -3505,18 +3287,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "ring-math" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59f63ff5ee501c33087d20fd92ba4a217023d1a22760c4ce25960dbb571f0def" -dependencies = [ - "anyhow", - "rand", - "scalarff", - "serde", -] - [[package]] name = "rkyv" version = "0.7.45" @@ -3692,25 +3462,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "scalarff" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3faf445015761038e00520fff93645c478b173c9ad70dfac01bd97640f49d150" -dependencies = [ - "anyhow", - "ark-bn254", - "ark-ff", - "ark-std", - "colored", - "curve25519-dalek", - "ff 0.13.0", - "num-bigint", - "num-integer", - "rand", - "serde", -] - [[package]] name = "scale-info" version = "2.11.6" @@ -3778,7 +3529,7 @@ checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" dependencies = [ "base16ct 0.1.1", "der 0.6.1", - "generic-array 0.14.7", + "generic-array", "pkcs8 0.9.0", "subtle", "zeroize", @@ -3792,7 +3543,7 @@ checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" dependencies = [ "base16ct 0.2.0", "der 0.7.9", - "generic-array 0.14.7", + "generic-array", "pkcs8 0.10.2", "subtle", "zeroize", @@ -3926,19 +3677,6 @@ dependencies = [ "digest 0.10.7", ] -[[package]] -name = "sha3" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd26bc0e7a2e3a7c959bc494caf58b72ee0c71d67704e9520f736ca7e4853ecf" -dependencies = [ - "block-buffer 0.7.3", - "byte-tools", - "digest 0.8.1", - "keccak", - "opaque-debug 0.2.3", -] - [[package]] name = "sha3" version = "0.9.1" @@ -3948,7 +3686,7 @@ dependencies = [ "block-buffer 0.9.0", "digest 0.9.0", "keccak", - "opaque-debug 0.3.1", + "opaque-debug", ] [[package]] @@ -4051,25 +3789,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "spartan" -version = "0.8.0" -source = "git+https://github.com/chancehudson/spartan?branch=serialization#065b810c7a8e9dbba087d84f270db5d896ce1171" -dependencies = [ - "bincode", - "byteorder", - "curve25519-dalek", - "digest 0.8.1", - "flate2", - "itertools 0.10.5", - "merlin", - "rand", - "rand_core", - "serde", - "sha3 0.8.2", - "subtle", -] - [[package]] name = "spin" version = "0.9.8" @@ -4590,12 +4309,6 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" -[[package]] -name = "ucd-trie" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" - [[package]] name = "uint" version = "0.9.5" @@ -5046,15 +4759,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows-core" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" -dependencies = [ - "windows-targets", -] - [[package]] name = "windows-registry" version = "0.2.0" diff --git a/mopro-ffi/Cargo.toml b/mopro-ffi/Cargo.toml index 9e719b0d..113f4298 100644 --- a/mopro-ffi/Cargo.toml +++ b/mopro-ffi/Cargo.toml @@ -15,10 +15,9 @@ name = "mopro_ffi" [features] default = [] -ashlang = ["dep:ashlang"] halo2 = [] circom = [ - "circom-prover", + "circom-prover", "rust-witness", "ark-bn254", "ark-bls12-381", @@ -36,9 +35,6 @@ num-bigint = { version = "0.4.3", default-features = false, features = ["rand",] thiserror = "=2.0.3" color-eyre = "=0.6.2" -# ashlang deps -ashlang = { git = "https://github.com/chancehudson/ashlang.git", rev = "696960a0c15db47170fdd1ff058682023d904b1b", optional = true, default-features = false, features = ["spartan-prover", "serde"] } - # circom deps rust-witness = { version = "0.1.1", optional = true } ark-ff = { version = "0.4.0", optional = true } diff --git a/mopro-ffi/src/ashlang/mod.rs b/mopro-ffi/src/ashlang/mod.rs deleted file mode 100644 index 80894b42..00000000 --- a/mopro-ffi/src/ashlang/mod.rs +++ /dev/null @@ -1,77 +0,0 @@ -use std::fs; - -use ashlang::AshlangProver; -use ashlang::SpartanProver; - -use super::GenerateProofResult; - -#[macro_export] -macro_rules! ashlang_spartan_app { - () => { - fn generate_ashlang_spartan_proof( - ar1cs_path: String, // path to ar1cs file - secret_inputs: Vec, - ) -> Result { - mopro_ffi::ashlang::prove(&ar1cs_path, secret_inputs).map_err(|e| { - mopro_ffi::MoproError::AshlangError( - "error generating ashlang spartan proof".to_string(), - ) - }) - } - - fn verify_ashlang_spartan_proof( - ar1cs_path: String, - proof: Vec, - ) -> Result { - mopro_ffi::ashlang::verify(&ar1cs_path, proof).map_err(|e| { - mopro_ffi::MoproError::AshlangError("error verifying proof".to_string()) - }) - } - }; -} - -/// Generates a spartan proof from an ar1cs file compiled -/// with the ashlang compiler. -pub fn prove( - ar1cs_path: &str, // path to ar1cs file - secret_inputs: Vec, -) -> anyhow::Result { - let ir_source = fs::read_to_string(ar1cs_path)?; - // we pass an empty vec for public inputs because - // they are not supported in the ashlang spartan prover - // outputs are public and should be used instead - let proof = SpartanProver::prove_ir(&ir_source, vec![], secret_inputs.clone())?; - - Ok(GenerateProofResult { - proof: bincode::serialize(&proof)?, - inputs: vec![], - }) -} - -/// Verifies a spartan proof from an ar1cs file -pub fn verify(ar1cs_path: &str, proof: Vec) -> anyhow::Result { - let ir_source = fs::read_to_string(ar1cs_path)?; - let p = bincode::deserialize(&proof)?; - ashlang::SpartanProver::verify(&ir_source, p) -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_ashlang_spartan_prove_verify() -> anyhow::Result<()> { - let ar1cs_path = "../test-vectors/ashlang/example.ar1cs".to_string(); - let proof = prove(&ar1cs_path, vec!["55".to_string()])?; - verify(&ar1cs_path, proof.proof)?; - Ok(()) - } - - #[test] - fn test_ashlang_spartan_multiplier2() -> anyhow::Result<()> { - let ar1cs_path = "../test-vectors/ashlang/multiplier2.ar1cs".to_string(); - let proof = prove(&ar1cs_path, vec!["55".to_string(), "56".to_string()])?; - verify(&ar1cs_path, proof.proof)?; - Ok(()) - } -} diff --git a/mopro-ffi/src/lib.rs b/mopro-ffi/src/lib.rs index 2bfd7f6e..5ba86090 100644 --- a/mopro-ffi/src/lib.rs +++ b/mopro-ffi/src/lib.rs @@ -1,7 +1,5 @@ pub mod app_config; -#[cfg(feature = "ashlang")] -pub mod ashlang; #[cfg(feature = "circom")] mod circom; #[cfg(feature = "halo2")] @@ -19,26 +17,6 @@ pub use circom_prover::{ #[cfg(feature = "halo2")] pub use halo2::{Halo2ProveFn, Halo2VerifyFn}; -#[cfg(not(feature = "ashlang"))] -#[macro_export] -macro_rules! ashlang_spartan_app { - () => { - fn generate_ashlang_spartan_proof( - ar1cs_path: String, // path to ar1cs file - secret_inputs: Vec, - ) -> Result { - panic!("Ashlang proving is not enabled in this build. Please pass `ashlang` feature to `mopro-ffi` to enable Ashlang."); - } - - fn verify_ashlang_spartan_proof( - ar1cs_path: String, - proof: Vec, - ) -> Result { - panic!("Ashlang proving is not enabled in this build. Please pass `ashlang` feature to `mopro-ffi` to enable Ashlang."); - } - }; -} - #[cfg(not(feature = "circom"))] #[macro_export] macro_rules! circom_app { @@ -100,8 +78,6 @@ pub enum MoproError { CircomError(String), #[error("Halo2Error: {0}")] Halo2Error(String), - #[error("AshlangError: {0}")] - AshlangError(String), } #[derive(Debug, Clone)] @@ -161,8 +137,6 @@ macro_rules! app { mopro_ffi::halo2_app!(); - mopro_ffi::ashlang_spartan_app!(); - uniffi::include_scaffolding!("mopro"); }; } diff --git a/mopro-ffi/src/mopro.udl b/mopro-ffi/src/mopro.udl index d1c16cb8..d10df679 100644 --- a/mopro-ffi/src/mopro.udl +++ b/mopro-ffi/src/mopro.udl @@ -1,10 +1,4 @@ namespace mopro { - [Throws=MoproError] - GenerateProofResult generate_ashlang_spartan_proof(string ar1cs_path, sequence inputs); - - [Throws=MoproError] - boolean verify_ashlang_spartan_proof(string ar1cs_path, bytes proof); - [Throws=MoproError] GenerateProofResult generate_halo2_proof(string srs_path, string pk_path, record> circuit_inputs); @@ -46,5 +40,4 @@ dictionary ProofCalldata { enum MoproError { "CircomError", "Halo2Error", - "AshlangError", }; diff --git a/test-e2e/Cargo.toml b/test-e2e/Cargo.toml index c8e9f667..4dcff881 100644 --- a/test-e2e/Cargo.toml +++ b/test-e2e/Cargo.toml @@ -17,7 +17,7 @@ name = "android" name = "web" [dependencies] -mopro-ffi = { path = "../mopro-ffi", features = ["halo2", "circom", "ashlang"] } +mopro-ffi = { path = "../mopro-ffi", features = ["halo2", "circom"] } mopro-wasm = { path = "../mopro-wasm" } uniffi = "0.28.0" diff --git a/test-e2e/android/.idea/other.xml b/test-e2e/android/.idea/other.xml index 0d3a1fbb..720dd0e3 100644 --- a/test-e2e/android/.idea/other.xml +++ b/test-e2e/android/.idea/other.xml @@ -14,6 +14,17 @@ diff --git a/test-e2e/ios/mopro-test.xcodeproj/project.pbxproj b/test-e2e/ios/mopro-test.xcodeproj/project.pbxproj index 70a5e563..1f7f45e1 100644 --- a/test-e2e/ios/mopro-test.xcodeproj/project.pbxproj +++ b/test-e2e/ios/mopro-test.xcodeproj/project.pbxproj @@ -11,7 +11,6 @@ 4CBAB2782C3334B300B536B7 /* MoproBindings.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4CBAB2772C3334B300B536B7 /* MoproBindings.xcframework */; }; 4CBAB27A2C3334B800B536B7 /* mopro.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CBAB2792C3334B800B536B7 /* mopro.swift */; }; 4CCB9BDF2C33C20800C659C4 /* multiplier2_final.zkey in Resources */ = {isa = PBXBuildFile; fileRef = 4CCB9BDE2C33C20100C659C4 /* multiplier2_final.zkey */; }; - 4CDFE7EB2CC844C400A05E76 /* example.ar1cs in Resources */ = {isa = PBXBuildFile; fileRef = 4CDFE7EA2CC844C400A05E76 /* example.ar1cs */; }; 4CF977EF2C2BCF0000CE1139 /* mopro_testApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF977EE2C2BCF0000CE1139 /* mopro_testApp.swift */; }; 4CF977F12C2BCF0000CE1139 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF977F02C2BCF0000CE1139 /* ContentView.swift */; }; 4CF977F32C2BCF0300CE1139 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4CF977F22C2BCF0300CE1139 /* Assets.xcassets */; }; @@ -37,15 +36,14 @@ 4CBAB2772C3334B300B536B7 /* MoproBindings.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = MoproBindings.xcframework; path = ../MoproiOSBindings/MoproBindings.xcframework; sourceTree = ""; }; 4CBAB2792C3334B800B536B7 /* mopro.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = mopro.swift; path = ../../MoproiOSBindings/mopro.swift; sourceTree = ""; }; 4CCB9BDE2C33C20100C659C4 /* multiplier2_final.zkey */ = {isa = PBXFileReference; lastKnownFileType = file; name = multiplier2_final.zkey; path = "../../test-vectors/circom/multiplier2_final.zkey"; sourceTree = ""; }; - 4CDFE7EA2CC844C400A05E76 /* example.ar1cs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = example.ar1cs; path = "../../test-vectors/ashlang/example.ar1cs"; sourceTree = ""; }; 4CF977EB2C2BCF0000CE1139 /* mopro-test.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "mopro-test.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 4CF977EE2C2BCF0000CE1139 /* mopro_testApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = mopro_testApp.swift; sourceTree = ""; }; 4CF977F02C2BCF0000CE1139 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 4CF977F22C2BCF0300CE1139 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 4CF977F52C2BCF0300CE1139 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; - 60A8E4352C40404200D3A953 /* plonk_fibonacci_srs.bin */ = {isa = PBXFileReference; lastKnownFileType = file; name = plonk_fibonacci_srs.bin; path = "../../test-vectors/halo2/plonk_fibonacci_srs.bin"; sourceTree = ""; }; - 60A8E4362C40404300D3A953 /* plonk_fibonacci_pk.bin */ = {isa = PBXFileReference; lastKnownFileType = file; name = plonk_fibonacci_pk.bin; path = "../../test-vectors/halo2/plonk_fibonacci_pk.bin"; sourceTree = ""; }; - 60A8E4372C40404300D3A953 /* plonk_fibonacci_vk.bin */ = {isa = PBXFileReference; lastKnownFileType = file; name = plonk_fibonacci_vk.bin; path = "../../test-vectors/halo2/plonk_fibonacci_vk.bin"; sourceTree = ""; }; + 60A8E4352C40404200D3A953 /* plonk_fibonacci_srs.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; name = plonk_fibonacci_srs.bin; path = "../../test-vectors/halo2/plonk_fibonacci_srs.bin"; sourceTree = ""; }; + 60A8E4362C40404300D3A953 /* plonk_fibonacci_pk.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; name = plonk_fibonacci_pk.bin; path = "../../test-vectors/halo2/plonk_fibonacci_pk.bin"; sourceTree = ""; }; + 60A8E4372C40404300D3A953 /* plonk_fibonacci_vk.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; name = plonk_fibonacci_vk.bin; path = "../../test-vectors/halo2/plonk_fibonacci_vk.bin"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -78,7 +76,6 @@ 4CF977E22C2BCF0000CE1139 = { isa = PBXGroup; children = ( - 4CDFE7EA2CC844C400A05E76 /* example.ar1cs */, 60A8E4362C40404300D3A953 /* plonk_fibonacci_pk.bin */, 60A8E4352C40404200D3A953 /* plonk_fibonacci_srs.bin */, 60A8E4372C40404300D3A953 /* plonk_fibonacci_vk.bin */, @@ -221,7 +218,6 @@ 60A8E4382C40404300D3A953 /* plonk_fibonacci_srs.bin in Resources */, 4CF977F32C2BCF0300CE1139 /* Assets.xcassets in Resources */, 60A8E4392C40404300D3A953 /* plonk_fibonacci_pk.bin in Resources */, - 4CDFE7EB2CC844C400A05E76 /* example.ar1cs in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/test-e2e/ios/mopro-test/ContentView.swift b/test-e2e/ios/mopro-test/ContentView.swift index 3d4c2c5f..178f3cc0 100644 --- a/test-e2e/ios/mopro-test/ContentView.swift +++ b/test-e2e/ios/mopro-test/ContentView.swift @@ -45,13 +45,10 @@ struct ContentView: View { @State private var circomPublicInputs: Data? @State private var generatedHalo2Proof: Data? @State private var halo2PublicInputs: Data? - @State private var generatedAshlangProof: Data? - @State private var ashlangPublicInputs: Data? private let zkeyPath = Bundle.main.path(forResource: "multiplier2_final", ofType: "zkey")! private let srsPath = Bundle.main.path(forResource: "plonk_fibonacci_srs.bin", ofType: "")! private let vkPath = Bundle.main.path(forResource: "plonk_fibonacci_vk.bin", ofType: "")! private let pkPath = Bundle.main.path(forResource: "plonk_fibonacci_pk.bin", ofType: "")! - private let ar1csPath = Bundle.main.path(forResource: "example.ar1cs", ofType: "")! var body: some View { VStack(spacing: 10) { @@ -62,8 +59,6 @@ struct ContentView: View { Button("Verify Circom", action: runCircomVerifyAction).disabled(!isCircomVerifyButtonEnabled).accessibilityIdentifier("verifyCircom") Button("Prove Halo2", action: runHalo2ProveAction).disabled(!isHalo2roveButtonEnabled).accessibilityIdentifier("proveHalo2") Button("Verify Halo2", action: runHalo2VerifyAction).disabled(!isHalo2VerifyButtonEnabled).accessibilityIdentifier("verifyHalo2") - Button("Prove Ashlang", action: runAshlangProveAction).disabled(!isAshlangroveButtonEnabled).accessibilityIdentifier("proveAshlang") - Button("Verify Ashlang", action: runAshlangVerifyAction).disabled(!isAshlangVerifyButtonEnabled).accessibilityIdentifier("verifyAshlang") ScrollView { Text(textViewText) @@ -211,64 +206,5 @@ extension ContentView { print("\nUnexpected error: \(error)") } } - - func runAshlangProveAction() { - textViewText += "Generating Ashlang proof... " - do { - // Prepare inputs - var inputs = [String(55)] - - let start = CFAbsoluteTimeGetCurrent() - - // Generate Proof - let generateProofResult = try generateAshlangSpartanProof( ar1csPath: ar1csPath, inputs: inputs) - assert(!generateProofResult.proof.isEmpty, "Proof should not be empty") - assert(!generateProofResult.inputs.isEmpty, "Inputs should not be empty") - - - let end = CFAbsoluteTimeGetCurrent() - let timeTaken = end - start - - // Store the generated proof and public inputs for later verification - generatedAshlangProof = generateProofResult.proof - ashlangPublicInputs = generateProofResult.inputs - - textViewText += "\(String(format: "%.3f", timeTaken))s 1️⃣\n" - - isAshlangVerifyButtonEnabled = true - } catch { - textViewText += "\nProof generation failed: \(error.localizedDescription)\n" - } - } - - func runAshlangVerifyAction() { - guard let proof = generatedAshlangProof, - let inputs = ashlangPublicInputs else { - textViewText += "Proof has not been generated yet.\n" - return - } - - textViewText += "Verifying Ashlang proof... " - do { - let start = CFAbsoluteTimeGetCurrent() - - let isValid = try verifyAshlangSpartanProof( - ar1csPath: ar1csPath, proof: generatedAshlangProof!) - let end = CFAbsoluteTimeGetCurrent() - let timeTaken = end - start - - - if isValid { - textViewText += "\(String(format: "%.3f", timeTaken))s 2️⃣\n" - } else { - textViewText += "\nProof verification failed.\n" - } - isAshlangVerifyButtonEnabled = false - } catch let error as MoproError { - print("\nMoproError: \(error)") - } catch { - print("\nUnexpected error: \(error)") - } - } } diff --git a/test-e2e/tests/ashlang.rs b/test-e2e/tests/ashlang.rs deleted file mode 100644 index de56a933..00000000 --- a/test-e2e/tests/ashlang.rs +++ /dev/null @@ -1,4 +0,0 @@ -uniffi::build_foreign_language_testcases!( - "tests/bindings/test_ashlang_example.swift", - "tests/bindings/test_ashlang_example.kts", -); diff --git a/test-e2e/tests/bindings/test_ashlang_example.kts b/test-e2e/tests/bindings/test_ashlang_example.kts deleted file mode 100644 index a8df2f60..00000000 --- a/test-e2e/tests/bindings/test_ashlang_example.kts +++ /dev/null @@ -1,21 +0,0 @@ -import uniffi.mopro.* - -try { - var ar1csPath = "../test-vectors/ashlang/example.ar1cs" - - // this number is used but not constrained - var inputs = listOf("55") - - // Generate Proof - var generateProofResult = generateAshlangSpartanProof( ar1csPath, inputs) - - assert(generateProofResult.proof.size > 0) { "Proof is empty" } - - // Verify Proof - var isValid = verifyAshlangSpartanProof( - ar1csPath, generateProofResult.proof) - - assert(isValid) { "Proof is invalid" } -} catch (e: Exception) { - println(e) -} diff --git a/test-e2e/tests/bindings/test_ashlang_example.swift b/test-e2e/tests/bindings/test_ashlang_example.swift deleted file mode 100644 index 715d79a4..00000000 --- a/test-e2e/tests/bindings/test_ashlang_example.swift +++ /dev/null @@ -1,27 +0,0 @@ -import Foundation -import mopro - -do { - let ar1csPath = "../../../test-vectors/ashlang/example.ar1cs" - - // this number is used but not constrained - let inputs = [String(55)] - - // Generate Proof - let generateProofResult = try generateAshlangSpartanProof(ar1csPath: ar1csPath, inputs: inputs) - - assert(!generateProofResult.proof.isEmpty, "Proof should not be empty") - - // Verify Proof - let isValid = try verifyAshlangSpartanProof( - ar1csPath: ar1csPath, proof: generateProofResult.proof) - - assert(isValid, "Proof verification should succeed") - -} catch let error as MoproError { - print("MoproError: \(error)") - throw error -} catch { - print("Unexpected error: \(error)") - throw error -} diff --git a/test-vectors/ashlang/example.ar1cs b/test-vectors/ashlang/example.ar1cs deleted file mode 100644 index e428102a..00000000 --- a/test-vectors/ashlang/example.ar1cs +++ /dev/null @@ -1,291 +0,0 @@ -# r1cs_test.ash -# This script tests various mathemetical operators -# view the source below -# -# https://github.com/chancehudson/ashlang/blob/main/ashlang/test-vectors/r1cs_test.ash -# - -x1 = (1*one) * (0*one) # scalar literal (0) to signal index 0 (member of vector) -x2 = (1*one) * (100*one) # scalar literal (100) to signal index 0 (member of vector) -x3 = (100*one) + (0*one) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x4 = (1*one) * (99*one) # scalar literal (99) to signal index 0 (member of vector) -x5 = (99*one) + (0*one) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x6 = (1*one) * (98*one) # scalar literal (98) to signal index 0 (member of vector) -x7 = (98*one) + (0*one) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x8 = (1*one) * (99*one) # scalar literal (99) to signal index 0 (member of vector) -x9 = (100*one) + (0*one) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x10 = (100*one) + (0*one) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x11 = (99*one) + (0*one) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x12 = (99*one) + (0*one) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x13 = (98*one) + (0*one) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x14 = (98*one) + (0*one) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x15 = (99*one) * (1*x2) # re-assign _ -x16 = (9900*one) + (0*one) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x17 = (1*x2 + 7237005577332262213973186563042994240857116359379907606001950938285454250890*one) * (1*one) # re-assign _ -x18 = (1*one) + (0*one) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x19 = (99*one + 7237005577332262213973186563042994240857116359379907606001950938285454250988*x2) * (1*one) # re-assign _ -x20 = (99*one + 7237005577332262213973186563042994240857116359379907606001950938285454250988*x2) * (1*one) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x21 = (99*one + 1*x2) * (1*one) # re-assign _ -x22 = (199*one) + (0*one) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x23 = (4751569318450475190992496228260551774300126902623171660506331424126813397114*x2) * (1*one) # re-assign _ -x25 = (1*one) / (1*x2) # re-assign _ -x24 = (99*x25) * (1*one) # re-assign _ -x26 = (1*x2 + 1*x4) * (1*one) # re-assign _ -x27 = (199*one) + (0*one) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x28 = (1*x2 + 7237005577332262213973186563042994240857116359379907606001950938285454250988*x4) * (1*one) # re-assign _ -x29 = (1*one) + (0*one) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x30 = (1*x2) * (1*x4) # re-assign _ -x31 = (9900*one) + (0*one) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x32 = (1*one) / (1*x4) # re-assign _ -x33 = (1*x2) * (1*x32) # re-assign _ -x34 = (1*x2) * (1*x2) # let v2 -x35 = (1*x34) * (1*x34) # let v4 -x36 = (1*x35) * (1*x2) # return call in ./ashlang/stdlib/pow5.ash -x37 = (10000000000*one) + (0*one) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x38 = (32*one) + (0*one) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x39 = (32*one) + (0*one) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x40 = (1*one) * (32*one) # scalar literal (32) to signal index 0 (member of vector) -x41 = (9*one) + (0*one) # sqrt() (./ashlang/stdlib/sqrt.ar1cs) -x42 = (2*one) radix (1*x41) # b is the square root of a -x43 = (3*one) + (0*one) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x44 = (1*one) * (0*one) # scalar literal (0) to signal index 0 (member of vector) -x45 = (1*one) * (2*one) # scalar literal (2) to signal index 0 (member of vector) -x46 = (1*one + 1*x44) * (1*one) # re-assign lll -x47 = (1*x45) * (1*x45) # let v2 -x48 = (1*x47) * (1*x47) # let v4 -x49 = (1*x48) * (1*x45) # return call in ./ashlang/stdlib/pow5.ash -x50 = (1*x45) * (1*x45) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x51 = (1*x50) * (1*x45) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x52 = (1*x51) * (1*x45) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x53 = (1*x52) * (1*x45) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x54 = (1*one + 1*x46) * (1*one) # re-assign lll -x55 = (1*x49) * (1*x49) # let v2 -x56 = (1*x55) * (1*x55) # let v4 -x57 = (1*x56) * (1*x49) # return call in ./ashlang/stdlib/pow5.ash -x58 = (1*x49) * (1*x49) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x59 = (1*x58) * (1*x49) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x60 = (1*x59) * (1*x49) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x61 = (1*x60) * (1*x49) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x62 = (1*one + 1*x54) * (1*one) # re-assign lll -x63 = (1*x57) * (1*x57) # let v2 -x64 = (1*x63) * (1*x63) # let v4 -x65 = (1*x64) * (1*x57) # return call in ./ashlang/stdlib/pow5.ash -x66 = (1*x57) * (1*x57) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x67 = (1*x66) * (1*x57) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x68 = (1*x67) * (1*x57) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x69 = (1*x68) * (1*x57) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x70 = (1*one + 1*x62) * (1*one) # re-assign lll -x71 = (1*x65) * (1*x65) # let v2 -x72 = (1*x71) * (1*x71) # let v4 -x73 = (1*x72) * (1*x65) # return call in ./ashlang/stdlib/pow5.ash -x74 = (1*x65) * (1*x65) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x75 = (1*x74) * (1*x65) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x76 = (1*x75) * (1*x65) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x77 = (1*x76) * (1*x65) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x78 = (1*one + 1*x70) * (1*one) # re-assign lll -x79 = (1*x73) * (1*x73) # let v2 -x80 = (1*x79) * (1*x79) # let v4 -x81 = (1*x80) * (1*x73) # return call in ./ashlang/stdlib/pow5.ash -x82 = (1*x73) * (1*x73) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x83 = (1*x82) * (1*x73) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x84 = (1*x83) * (1*x73) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x85 = (1*x84) * (1*x73) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x86 = (1*one + 1*x78) * (1*one) # re-assign lll -x87 = (1*x81) * (1*x81) # let v2 -x88 = (1*x87) * (1*x87) # let v4 -x89 = (1*x88) * (1*x81) # return call in ./ashlang/stdlib/pow5.ash -x90 = (1*x81) * (1*x81) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x91 = (1*x90) * (1*x81) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x92 = (1*x91) * (1*x81) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x93 = (1*x92) * (1*x81) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x94 = (1*one + 1*x86) * (1*one) # re-assign lll -x95 = (1*x89) * (1*x89) # let v2 -x96 = (1*x95) * (1*x95) # let v4 -x97 = (1*x96) * (1*x89) # return call in ./ashlang/stdlib/pow5.ash -x98 = (1*x89) * (1*x89) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x99 = (1*x98) * (1*x89) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x100 = (1*x99) * (1*x89) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x101 = (1*x100) * (1*x89) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x102 = (1*one + 1*x94) * (1*one) # re-assign lll -x103 = (1*x97) * (1*x97) # let v2 -x104 = (1*x103) * (1*x103) # let v4 -x105 = (1*x104) * (1*x97) # return call in ./ashlang/stdlib/pow5.ash -x106 = (1*x97) * (1*x97) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x107 = (1*x106) * (1*x97) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x108 = (1*x107) * (1*x97) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x109 = (1*x108) * (1*x97) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x110 = (1*one + 1*x102) * (1*one) # re-assign lll -x111 = (1*x105) * (1*x105) # let v2 -x112 = (1*x111) * (1*x111) # let v4 -x113 = (1*x112) * (1*x105) # return call in ./ashlang/stdlib/pow5.ash -x114 = (1*x105) * (1*x105) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x115 = (1*x114) * (1*x105) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x116 = (1*x115) * (1*x105) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x117 = (1*x116) * (1*x105) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x118 = (1*one + 1*x110) * (1*one) # re-assign lll -x119 = (1*x113) * (1*x113) # let v2 -x120 = (1*x119) * (1*x119) # let v4 -x121 = (1*x120) * (1*x113) # return call in ./ashlang/stdlib/pow5.ash -x122 = (1*x113) * (1*x113) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x123 = (1*x122) * (1*x113) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x124 = (1*x123) * (1*x113) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x125 = (1*x124) * (1*x113) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x126 = (10*one) + (0*one) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -x127 = (1*one) input (1*one) # -x128 = (55*one) + (0*one) # assert_eq() (./ashlang/stdlib/assert_eq.ar1cs) -0 = (7237005577332262213973186563042994240857116359379907606001950938285454250988*one) * (7237005577332262213973186563042994240857116359379907606001950938285454250988*one) - (1*one) # field safety constraint -0 = (1*x1) * (1*one) - (0*one) # scalar literal (0) to signal index (0) (member of vector) -0 = (1*x2) * (1*one) - (100*one) # scalar literal (100) to signal index (0) (member of vector) -0 = (1*x3) * (1*one) - (100*one) # assigning literal (100) to signal 3 -0 = (1*x2 + 0*one) * (1*one) - (1*x3) # assert equality -0 = (1*x4) * (1*one) - (99*one) # scalar literal (99) to signal index (0) (member of vector) -0 = (1*x5) * (1*one) - (99*one) # assigning literal (99) to signal 5 -0 = (1*x4 + 0*one) * (1*one) - (1*x5) # assert equality -0 = (1*x6) * (1*one) - (98*one) # scalar literal (98) to signal index (0) (member of vector) -0 = (1*x7) * (1*one) - (98*one) # assigning literal (98) to signal 7 -0 = (1*x6 + 0*one) * (1*one) - (1*x7) # assert equality -0 = (1*x8) * (1*one) - (99*one) # scalar literal (99) to signal index (0) (member of vector) -0 = (1*x9) * (1*one) - (100*one) # assigning literal (100) to signal 9 -0 = (1*x10) * (1*one) - (100*one) # assigning literal (100) to signal 10 -0 = (1*x9 + 0*one) * (1*one) - (1*x10) # assert equality -0 = (1*x11) * (1*one) - (99*one) # assigning literal (99) to signal 11 -0 = (1*x12) * (1*one) - (99*one) # assigning literal (99) to signal 12 -0 = (1*x11 + 0*one) * (1*one) - (1*x12) # assert equality -0 = (1*x13) * (1*one) - (98*one) # assigning literal (98) to signal 13 -0 = (1*x14) * (1*one) - (98*one) # assigning literal (98) to signal 14 -0 = (1*x13 + 0*one) * (1*one) - (1*x14) # assert equality -0 = (99*one) * (1*x2) - (1*x15) # multiplication between (99) and 2 into 15 -0 = (1*x16) * (1*one) - (9900*one) # assigning literal (9900) to signal 16 -0 = (1*x15 + 0*one) * (1*one) - (1*x16) # assert equality -0 = (99*one + 1*x17) * (1*one) - (1*x2) # subtraction between 2 and (99) into 17 -0 = (1*x18) * (1*one) - (1*one) # assigning literal (1) to signal 18 -0 = (1*x17 + 0*one) * (1*one) - (1*x18) # assert equality -0 = (1*x2 + 1*x19) * (1*one) - (99*one) # subtraction between (99) and 2 into 19 -0 = (1*x2 + 1*x20) * (1*one) - (99*one) # subtraction between (99) and 2 into 20 -0 = (1*x19 + 0*one) * (1*one) - (1*x20) # assert equality -0 = (99*one + 1*x2) * (1*one) - (1*x21) # addition between (99) and 2 into 21 -0 = (1*x22) * (1*one) - (199*one) # assigning literal (199) to signal 22 -0 = (1*x21 + 0*one) * (1*one) - (1*x22) # assert equality -0 = (4751569318450475190992496228260551774300126902623171660506331424126813397114*x2) * (1*one) - (1*x23) # modinv between 2 and (99) into 23 -0 = (1*x2) * (1*x25) - (1*one) # modinv 2 into 25 -0 = (99*x25) * (1*one) - (1*x24) # multiply 25 and (99) into 24 -0 = (1*x2 + 1*x4) * (1*one) - (1*x26) # addition between 2 and 4 into 26 -0 = (1*x27) * (1*one) - (199*one) # assigning literal (199) to signal 27 -0 = (1*x26 + 0*one) * (1*one) - (1*x27) # assert equality -0 = (1*x2 + 7237005577332262213973186563042994240857116359379907606001950938285454250988*x4) * (1*one) - (1*x28) # subtraction between 2 and 4 into 28 -0 = (1*x29) * (1*one) - (1*one) # assigning literal (1) to signal 29 -0 = (1*x28 + 0*one) * (1*one) - (1*x29) # assert equality -0 = (1*x2) * (1*x4) - (1*x30) # multiplication between 2 and 4 into 30 -0 = (1*x31) * (1*one) - (9900*one) # assigning literal (9900) to signal 31 -0 = (1*x30 + 0*one) * (1*one) - (1*x31) # assert equality -0 = (1*x4) * (1*x32) - (1*one) # inversion of 4 into 32 (1/2) -0 = (1*x2) * (1*x32) - (1*x33) # multiplication of 2 and 32 into 33 (2/2) -0 = (1*x2) * (1*x2) - (1*x34) # multiplication between 2 and 2 into 34 -0 = (1*x34) * (1*x34) - (1*x35) # multiplication between 34 and 34 into 35 -0 = (1*x35) * (1*x2) - (1*x36) # multiplication between 35 and 2 into 36 -0 = (1*x37) * (1*one) - (10000000000*one) # assigning literal (10000000000) to signal 37 -0 = (1*x36 + 0*one) * (1*one) - (1*x37) # assert equality -0 = (1*x38) * (1*one) - (32*one) # assigning literal (32) to signal 38 -0 = (1*x39) * (1*one) - (32*one) # assigning literal (32) to signal 39 -0 = (1*x38 + 0*one) * (1*one) - (1*x39) # assert equality -0 = (1*x40) * (1*one) - (32*one) # scalar literal (32) to signal index (0) (member of vector) -0 = (1*x41) * (1*one) - (9*one) # assigning literal (9) to signal 41 -0 = (1*x42) * (1*x42) - (1*x41) # assert that a = b*b -0 = (1*x43) * (1*one) - (3*one) # assigning literal (3) to signal 43 -0 = (1*x42 + 0*one) * (1*one) - (1*x43) # assert equality -0 = (1*x44) * (1*one) - (0*one) # scalar literal (0) to signal index (0) (member of vector) -0 = (1*x45) * (1*one) - (2*one) # scalar literal (2) to signal index (0) (member of vector) -0 = (1*one + 1*x44) * (1*one) - (1*x46) # addition between (1) and 44 into 46 -0 = (1*x45) * (1*x45) - (1*x47) # multiplication between 45 and 45 into 47 -0 = (1*x47) * (1*x47) - (1*x48) # multiplication between 47 and 47 into 48 -0 = (1*x48) * (1*x45) - (1*x49) # multiplication between 48 and 45 into 49 -0 = (1*x45) * (1*x45) - (1*x50) # multiplication between 45 and 45 into 50 -0 = (1*x50) * (1*x45) - (1*x51) # multiplication between 50 and 45 into 51 -0 = (1*x51) * (1*x45) - (1*x52) # multiplication between 51 and 45 into 52 -0 = (1*x52) * (1*x45) - (1*x53) # multiplication between 52 and 45 into 53 -0 = (1*x49 + 0*one) * (1*one) - (1*x53) # assert equality -0 = (1*one + 1*x46) * (1*one) - (1*x54) # addition between (1) and 46 into 54 -0 = (1*x49) * (1*x49) - (1*x55) # multiplication between 49 and 49 into 55 -0 = (1*x55) * (1*x55) - (1*x56) # multiplication between 55 and 55 into 56 -0 = (1*x56) * (1*x49) - (1*x57) # multiplication between 56 and 49 into 57 -0 = (1*x49) * (1*x49) - (1*x58) # multiplication between 49 and 49 into 58 -0 = (1*x58) * (1*x49) - (1*x59) # multiplication between 58 and 49 into 59 -0 = (1*x59) * (1*x49) - (1*x60) # multiplication between 59 and 49 into 60 -0 = (1*x60) * (1*x49) - (1*x61) # multiplication between 60 and 49 into 61 -0 = (1*x57 + 0*one) * (1*one) - (1*x61) # assert equality -0 = (1*one + 1*x54) * (1*one) - (1*x62) # addition between (1) and 54 into 62 -0 = (1*x57) * (1*x57) - (1*x63) # multiplication between 57 and 57 into 63 -0 = (1*x63) * (1*x63) - (1*x64) # multiplication between 63 and 63 into 64 -0 = (1*x64) * (1*x57) - (1*x65) # multiplication between 64 and 57 into 65 -0 = (1*x57) * (1*x57) - (1*x66) # multiplication between 57 and 57 into 66 -0 = (1*x66) * (1*x57) - (1*x67) # multiplication between 66 and 57 into 67 -0 = (1*x67) * (1*x57) - (1*x68) # multiplication between 67 and 57 into 68 -0 = (1*x68) * (1*x57) - (1*x69) # multiplication between 68 and 57 into 69 -0 = (1*x65 + 0*one) * (1*one) - (1*x69) # assert equality -0 = (1*one + 1*x62) * (1*one) - (1*x70) # addition between (1) and 62 into 70 -0 = (1*x65) * (1*x65) - (1*x71) # multiplication between 65 and 65 into 71 -0 = (1*x71) * (1*x71) - (1*x72) # multiplication between 71 and 71 into 72 -0 = (1*x72) * (1*x65) - (1*x73) # multiplication between 72 and 65 into 73 -0 = (1*x65) * (1*x65) - (1*x74) # multiplication between 65 and 65 into 74 -0 = (1*x74) * (1*x65) - (1*x75) # multiplication between 74 and 65 into 75 -0 = (1*x75) * (1*x65) - (1*x76) # multiplication between 75 and 65 into 76 -0 = (1*x76) * (1*x65) - (1*x77) # multiplication between 76 and 65 into 77 -0 = (1*x73 + 0*one) * (1*one) - (1*x77) # assert equality -0 = (1*one + 1*x70) * (1*one) - (1*x78) # addition between (1) and 70 into 78 -0 = (1*x73) * (1*x73) - (1*x79) # multiplication between 73 and 73 into 79 -0 = (1*x79) * (1*x79) - (1*x80) # multiplication between 79 and 79 into 80 -0 = (1*x80) * (1*x73) - (1*x81) # multiplication between 80 and 73 into 81 -0 = (1*x73) * (1*x73) - (1*x82) # multiplication between 73 and 73 into 82 -0 = (1*x82) * (1*x73) - (1*x83) # multiplication between 82 and 73 into 83 -0 = (1*x83) * (1*x73) - (1*x84) # multiplication between 83 and 73 into 84 -0 = (1*x84) * (1*x73) - (1*x85) # multiplication between 84 and 73 into 85 -0 = (1*x81 + 0*one) * (1*one) - (1*x85) # assert equality -0 = (1*one + 1*x78) * (1*one) - (1*x86) # addition between (1) and 78 into 86 -0 = (1*x81) * (1*x81) - (1*x87) # multiplication between 81 and 81 into 87 -0 = (1*x87) * (1*x87) - (1*x88) # multiplication between 87 and 87 into 88 -0 = (1*x88) * (1*x81) - (1*x89) # multiplication between 88 and 81 into 89 -0 = (1*x81) * (1*x81) - (1*x90) # multiplication between 81 and 81 into 90 -0 = (1*x90) * (1*x81) - (1*x91) # multiplication between 90 and 81 into 91 -0 = (1*x91) * (1*x81) - (1*x92) # multiplication between 91 and 81 into 92 -0 = (1*x92) * (1*x81) - (1*x93) # multiplication between 92 and 81 into 93 -0 = (1*x89 + 0*one) * (1*one) - (1*x93) # assert equality -0 = (1*one + 1*x86) * (1*one) - (1*x94) # addition between (1) and 86 into 94 -0 = (1*x89) * (1*x89) - (1*x95) # multiplication between 89 and 89 into 95 -0 = (1*x95) * (1*x95) - (1*x96) # multiplication between 95 and 95 into 96 -0 = (1*x96) * (1*x89) - (1*x97) # multiplication between 96 and 89 into 97 -0 = (1*x89) * (1*x89) - (1*x98) # multiplication between 89 and 89 into 98 -0 = (1*x98) * (1*x89) - (1*x99) # multiplication between 98 and 89 into 99 -0 = (1*x99) * (1*x89) - (1*x100) # multiplication between 99 and 89 into 100 -0 = (1*x100) * (1*x89) - (1*x101) # multiplication between 100 and 89 into 101 -0 = (1*x97 + 0*one) * (1*one) - (1*x101) # assert equality -0 = (1*one + 1*x94) * (1*one) - (1*x102) # addition between (1) and 94 into 102 -0 = (1*x97) * (1*x97) - (1*x103) # multiplication between 97 and 97 into 103 -0 = (1*x103) * (1*x103) - (1*x104) # multiplication between 103 and 103 into 104 -0 = (1*x104) * (1*x97) - (1*x105) # multiplication between 104 and 97 into 105 -0 = (1*x97) * (1*x97) - (1*x106) # multiplication between 97 and 97 into 106 -0 = (1*x106) * (1*x97) - (1*x107) # multiplication between 106 and 97 into 107 -0 = (1*x107) * (1*x97) - (1*x108) # multiplication between 107 and 97 into 108 -0 = (1*x108) * (1*x97) - (1*x109) # multiplication between 108 and 97 into 109 -0 = (1*x105 + 0*one) * (1*one) - (1*x109) # assert equality -0 = (1*one + 1*x102) * (1*one) - (1*x110) # addition between (1) and 102 into 110 -0 = (1*x105) * (1*x105) - (1*x111) # multiplication between 105 and 105 into 111 -0 = (1*x111) * (1*x111) - (1*x112) # multiplication between 111 and 111 into 112 -0 = (1*x112) * (1*x105) - (1*x113) # multiplication between 112 and 105 into 113 -0 = (1*x105) * (1*x105) - (1*x114) # multiplication between 105 and 105 into 114 -0 = (1*x114) * (1*x105) - (1*x115) # multiplication between 114 and 105 into 115 -0 = (1*x115) * (1*x105) - (1*x116) # multiplication between 115 and 105 into 116 -0 = (1*x116) * (1*x105) - (1*x117) # multiplication between 116 and 105 into 117 -0 = (1*x113 + 0*one) * (1*one) - (1*x117) # assert equality -0 = (1*one + 1*x110) * (1*one) - (1*x118) # addition between (1) and 110 into 118 -0 = (1*x113) * (1*x113) - (1*x119) # multiplication between 113 and 113 into 119 -0 = (1*x119) * (1*x119) - (1*x120) # multiplication between 119 and 119 into 120 -0 = (1*x120) * (1*x113) - (1*x121) # multiplication between 120 and 113 into 121 -0 = (1*x113) * (1*x113) - (1*x122) # multiplication between 113 and 113 into 122 -0 = (1*x122) * (1*x113) - (1*x123) # multiplication between 122 and 113 into 123 -0 = (1*x123) * (1*x113) - (1*x124) # multiplication between 123 and 113 into 124 -0 = (1*x124) * (1*x113) - (1*x125) # multiplication between 124 and 113 into 125 -0 = (1*x121 + 0*one) * (1*one) - (1*x125) # assert equality -0 = (1*x126) * (1*one) - (10*one) # assigning literal (10) to signal 126 -0 = (1*x118 + 0*one) * (1*one) - (1*x126) # assert equality -0 = (1*x128) * (1*one) - (55*one) # assigning literal (55) to signal 128 -0 = (1*x127 + 0*one) * (1*one) - (1*x128) # assert equality diff --git a/test-vectors/ashlang/multiplier2.ar1cs b/test-vectors/ashlang/multiplier2.ar1cs deleted file mode 100644 index 1d3a3905..00000000 --- a/test-vectors/ashlang/multiplier2.ar1cs +++ /dev/null @@ -1,12 +0,0 @@ -# multiplier2 -# Compiled at 2024-10-24T07:36:29.607Z -# Compiled for curve25519 x^64+1 polynomial ring -# -x1 = (1*one) input (1*one) # -x2 = (1*one) input (1*one) # -x3 = (1*x1) * (1*x2) # write_output() (./ashlang/stdlib/io/write_output.ar1cs) -x4 = (1*one) * (1*x3) # -x4 = (1*one) output (1*one) # -0 = (7237005577332262213973186563042994240857116359379907606001950938285454250988*one) * (7237005577332262213973186563042994240857116359379907606001950938285454250988*one) - (1*one) # field safety constraint -0 = (1*x1) * (1*x2) - (1*x3) # multiplication between 1 and 2 into 3 -0 = (1*one) * (1*x4) - (1*x3) # constrain intermediate output assignment