diff --git a/.dvc/.gitignore b/.dvc/.gitignore new file mode 100644 index 000000000..528f30c71 --- /dev/null +++ b/.dvc/.gitignore @@ -0,0 +1,3 @@ +/config.local +/tmp +/cache diff --git a/.dvc/config b/.dvc/config new file mode 100644 index 000000000..e69de29bb diff --git a/.dvcignore b/.dvcignore new file mode 100644 index 000000000..519730552 --- /dev/null +++ b/.dvcignore @@ -0,0 +1,3 @@ +# Add patterns of files dvc should ignore, which could improve +# the performance. Learn more at +# https://dvc.org/doc/user-guide/dvcignore diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 6e76dec10..ec67ff43d 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -28,7 +28,11 @@ jobs: - name: Setup DVC uses: iterative/setup-dvc@v1 - name: Fetch Fixtures - run: ./scripts/fetch-fixtures.sh + uses: nick-fields/retry@v2 + with: + max_attempts: 10 + timeout_minutes: 30 + command: dvc pull -v - name: Check Format run: | SKIP_WASM_BUILD=1 cargo fmt --all -- --check @@ -47,7 +51,11 @@ jobs: - name: Setup DVC uses: iterative/setup-dvc@v1 - name: Fetch Fixtures - run: ./scripts/fetch-fixtures.sh + uses: nick-fields/retry@v2 + with: + max_attempts: 10 + timeout_minutes: 30 + command: dvc pull -v - name: Check Build run: | SKIP_WASM_BUILD=1 cargo build --release -Z sparse-registry @@ -65,7 +73,11 @@ jobs: - name: Setup DVC uses: iterative/setup-dvc@v1 - name: Fetch Fixtures - run: ./scripts/fetch-fixtures.sh + uses: nick-fields/retry@v2 + with: + max_attempts: 10 + timeout_minutes: 30 + command: dvc pull -v - name: Install toolchain uses: dtolnay/rust-toolchain@stable with: @@ -96,18 +108,5 @@ jobs: needs: [check-format, check-build, test] runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 - - name: Set-Up - run: sudo apt install -y cmake pkg-config libssl-dev git build-essential clang libclang-dev curl protobuf-compiler - - name: Setup DVC - uses: iterative/setup-dvc@v1 - - name: Fetch Fixtures - run: ./scripts/fetch-fixtures.sh - - name: Install toolchain - uses: dtolnay/rust-toolchain@stable - with: - toolchain: nightly - - name: Install cargo-nextest - uses: baptiste0928/cargo-install@v1 - with: - crate: cargo-nextest + - name: All Done + run: echo "All Done" diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml index 1d72003c3..c97128864 100644 --- a/.github/workflows/coverage.yaml +++ b/.github/workflows/coverage.yaml @@ -33,15 +33,18 @@ jobs: uses: iterative/setup-dvc@v1 - name: Fetch Fixtures - run: ./scripts/fetch-fixtures.sh + uses: nick-fields/retry@v2 + with: + max_attempts: 10 + timeout_minutes: 30 + command: dvc pull -v - name: Install apt dependencies run: | sudo apt-get update && \ sudo apt-get install -y clang libssl-dev llvm libudev-dev libgmp3-dev protobuf-compiler && \ sudo rm -rf /var/lib/apt/lists/* - - + - name: Rust Cache uses: Swatinem/rust-cache@v1.3.0 diff --git a/.gitignore b/.gitignore index e10163dbb..538b9c0c1 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,4 @@ **/node_modules types/build types/ts-types -.dvc/ -solidity-fixtures .direnv diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index c491e2040..000000000 --- a/.gitmodules +++ /dev/null @@ -1,9 +0,0 @@ -[submodule "substrate-fixtures"] - path = substrate-fixtures - url = https://github.com/webb-tools/substrate-fixtures - branch = main - -[submodule "solidity-fixtures"] - path = solidity-fixtures - url = https://github.com/webb-tools/solidity-fixtures - branch = main diff --git a/Cargo.lock b/Cargo.lock index 66a82e398..23a1acb3e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -264,9 +264,9 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65be532f9dd1e98ad0150b037276cde464c6f371059e6dd02c0222395761f6aa" dependencies = [ - "ark-ec 0.3.0", - "ark-ff 0.3.0", - "ark-std 0.3.0", + "ark-ec", + "ark-ff", + "ark-std", ] [[package]] @@ -275,47 +275,9 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea691771ebbb28aea556c044e2e5c5227398d840cee0c34d4d20fa8eb2689e8c" dependencies = [ - "ark-ec 0.3.0", - "ark-ff 0.3.0", - "ark-std 0.3.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-circom" -version = "0.1.0" -source = "git+https://github.com/gakonst/ark-circom?branch=master#f97ac2b2458fd14489bc70375bb45688f5ef26a8" -dependencies = [ - "ark-bn254 0.4.0", - "ark-crypto-primitives 0.4.0", - "ark-ec 0.4.2", - "ark-ff 0.4.2", - "ark-groth16 0.4.0", - "ark-poly 0.4.2", - "ark-relations 0.4.0", - "ark-serialize 0.4.2", - "ark-std 0.4.0", - "byteorder", - "cfg-if", - "color-eyre 0.6.2", - "criterion", - "fnv", - "hex", - "num", - "num-bigint", - "num-traits", - "thiserror", - "wasmer", + "ark-ec", + "ark-ff", + "ark-std", ] [[package]] @@ -323,14 +285,14 @@ name = "ark-circom" version = "0.1.0" source = "git+https://github.com/vacp2p/ark-circom?branch=wasm#0e587145cb05e08b2d1a01509eb578670088eb2f" dependencies = [ - "ark-bn254 0.3.0", - "ark-ec 0.3.0", - "ark-ff 0.3.0", + "ark-bn254", + "ark-ec", + "ark-ff", "ark-groth16 0.3.0 (git+https://github.com/arkworks-rs/groth16?rev=765817f)", - "ark-poly 0.3.0", - "ark-relations 0.3.0", - "ark-serialize 0.3.0", - "ark-std 0.3.0", + "ark-poly", + "ark-relations", + "ark-serialize", + "ark-std", "byteorder", "cfg-if", "color-eyre 0.5.11", @@ -351,14 +313,14 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff773c0ef8c655c98071d3026a63950798a66b2f45baef22d8334c1756f1bd18" dependencies = [ - "ark-ec 0.3.0", - "ark-ff 0.3.0", + "ark-ec", + "ark-ff", "ark-nonnative-field", "ark-r1cs-std", - "ark-relations 0.3.0", - "ark-serialize 0.3.0", - "ark-snark 0.3.0", - "ark-std 0.3.0", + "ark-relations", + "ark-serialize", + "ark-snark", + "ark-std", "blake2 0.9.2", "derivative", "digest 0.9.0", @@ -366,68 +328,31 @@ dependencies = [ "tracing", ] -[[package]] -name = "ark-crypto-primitives" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3a13b34da09176a8baba701233fdffbaa7c1b1192ce031a3da4e55ce1f1a56" -dependencies = [ - "ark-ec 0.4.2", - "ark-ff 0.4.2", - "ark-relations 0.4.0", - "ark-serialize 0.4.2", - "ark-snark 0.4.0", - "ark-std 0.4.0", - "blake2 0.10.6", - "derivative", - "digest 0.10.6", - "rayon", - "sha2 0.10.6", -] - [[package]] name = "ark-ec" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dea978406c4b1ca13c2db2373b05cc55429c3575b8b21f1b9ee859aa5b03dd42" dependencies = [ - "ark-ff 0.3.0", - "ark-serialize 0.3.0", - "ark-std 0.3.0", + "ark-ff", + "ark-serialize", + "ark-std", "derivative", "num-traits", "rayon", "zeroize", ] -[[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", - "num-traits", - "rayon", - "zeroize", -] - [[package]] name = "ark-ff" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6b3235cc41ee7a12aaaf2c575a2ad7b46713a8a50bda2fc3b003a04845c05dd6" dependencies = [ - "ark-ff-asm 0.3.0", - "ark-ff-macros 0.3.0", - "ark-serialize 0.3.0", - "ark-std 0.3.0", + "ark-ff-asm", + "ark-ff-macros", + "ark-serialize", + "ark-std", "derivative", "num-bigint", "num-traits", @@ -437,27 +362,6 @@ dependencies = [ "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 0.10.6", - "itertools", - "num-bigint", - "num-traits", - "paste", - "rayon", - "rustc_version 0.4.0", - "zeroize", -] - [[package]] name = "ark-ff-asm" version = "0.3.0" @@ -468,16 +372,6 @@ dependencies = [ "syn 1.0.109", ] -[[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-macros" version = "0.3.0" @@ -490,32 +384,19 @@ dependencies = [ "syn 1.0.109", ] -[[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-groth16" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38f8fff7468e947130b5caf9bdd27de8b913cf30e15104b4f0cd301726b3d897" dependencies = [ - "ark-crypto-primitives 0.3.0", - "ark-ec 0.3.0", - "ark-ff 0.3.0", - "ark-poly 0.3.0", - "ark-relations 0.3.0", - "ark-serialize 0.3.0", - "ark-std 0.3.0", + "ark-crypto-primitives", + "ark-ec", + "ark-ff", + "ark-poly", + "ark-relations", + "ark-serialize", + "ark-std", ] [[package]] @@ -523,29 +404,13 @@ name = "ark-groth16" version = "0.3.0" source = "git+https://github.com/arkworks-rs/groth16?rev=765817f#765817f77a6e14964c6f264d565b18676b11bd59" dependencies = [ - "ark-crypto-primitives 0.3.0", - "ark-ec 0.3.0", - "ark-ff 0.3.0", - "ark-poly 0.3.0", - "ark-relations 0.3.0", - "ark-serialize 0.3.0", - "ark-std 0.3.0", - "rayon", -] - -[[package]] -name = "ark-groth16" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20ceafa83848c3e390f1cbf124bc3193b3e639b3f02009e0e290809a501b95fc" -dependencies = [ - "ark-crypto-primitives 0.4.0", - "ark-ec 0.4.2", - "ark-ff 0.4.2", - "ark-poly 0.4.2", - "ark-relations 0.4.0", - "ark-serialize 0.4.2", - "ark-std 0.4.0", + "ark-crypto-primitives", + "ark-ec", + "ark-ff", + "ark-poly", + "ark-relations", + "ark-serialize", + "ark-std", "rayon", ] @@ -555,11 +420,11 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "440ad4569974910adbeb84422b7e622b79e08d27142afd113785b7fcfb446186" dependencies = [ - "ark-ec 0.3.0", - "ark-ff 0.3.0", + "ark-ec", + "ark-ff", "ark-r1cs-std", - "ark-relations 0.3.0", - "ark-std 0.3.0", + "ark-relations", + "ark-std", "derivative", "num-bigint", "num-integer", @@ -573,38 +438,24 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b0f78f47537c2f15706db7e98fe64cc1711dbf9def81218194e17239e53e5aa" dependencies = [ - "ark-ff 0.3.0", - "ark-serialize 0.3.0", - "ark-std 0.3.0", + "ark-ff", + "ark-serialize", + "ark-std", "derivative", "hashbrown 0.11.2", "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", - "rayon", -] - [[package]] name = "ark-r1cs-std" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22e8fdacb1931f238a0d866ced1e916a49d36de832fd8b83dc916b718ae72893" dependencies = [ - "ark-ec 0.3.0", - "ark-ff 0.3.0", - "ark-relations 0.3.0", - "ark-std 0.3.0", + "ark-ec", + "ark-ff", + "ark-relations", + "ark-std", "derivative", "num-bigint", "num-traits", @@ -617,20 +468,8 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4cba4c1c99792a6834bd97f7fd76578ec2cd58d2afc5139a17e1d1bec65b38f6" dependencies = [ - "ark-ff 0.3.0", - "ark-std 0.3.0", - "tracing", - "tracing-subscriber 0.2.25", -] - -[[package]] -name = "ark-relations" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00796b6efc05a3f48225e59cb6a2cda78881e7c390872d5786aaf112f31fb4f0" -dependencies = [ - "ark-ff 0.4.2", - "ark-std 0.4.0", + "ark-ff", + "ark-std", "tracing", "tracing-subscriber 0.2.25", ] @@ -641,23 +480,11 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d6c2b318ee6e10f8c2853e73a83adc0ccb88995aa978d8a3408d492ab2ee671" dependencies = [ - "ark-serialize-derive 0.3.0", - "ark-std 0.3.0", + "ark-serialize-derive", + "ark-std", "digest 0.9.0", ] -[[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 0.10.6", - "num-bigint", -] - [[package]] name = "ark-serialize-derive" version = "0.3.0" @@ -669,38 +496,15 @@ dependencies = [ "syn 1.0.109", ] -[[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-snark" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0dc3dff1a5f67a9c0b34df32b079752d8dd17f1e9d06253da0453db6c1b7cc8a" dependencies = [ - "ark-ff 0.3.0", - "ark-relations 0.3.0", - "ark-std 0.3.0", -] - -[[package]] -name = "ark-snark" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84d3cc6833a335bb8a600241889ead68ee89a3cf8448081fb7694c0fe503da63" -dependencies = [ - "ark-ff 0.4.2", - "ark-relations 0.4.0", - "ark-serialize 0.4.2", - "ark-std 0.4.0", + "ark-ff", + "ark-relations", + "ark-std", ] [[package]] @@ -714,26 +518,15 @@ dependencies = [ "rayon", ] -[[package]] -name = "ark-std" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" -dependencies = [ - "num-traits", - "rand 0.8.5", - "rayon", -] - [[package]] name = "arkworks-native-gadgets" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35676148406eed6838c0f6e97edbaa8b3bb164a4dfc5b5f2bdd1371016fe3c0e" dependencies = [ - "ark-crypto-primitives 0.3.0", - "ark-ff 0.3.0", - "ark-std 0.3.0", + "ark-crypto-primitives", + "ark-ff", + "ark-std", ] [[package]] @@ -742,10 +535,10 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f4400533301ffdaeb5a0af712a1a417f9167818121135701a498c39748a4b69" dependencies = [ - "ark-ff 0.3.0", + "ark-ff", "ark-r1cs-std", - "ark-relations 0.3.0", - "ark-std 0.3.0", + "ark-relations", + "ark-std", "arkworks-native-gadgets", "arkworks-r1cs-gadgets", ] @@ -756,11 +549,11 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fab1001cb6614e9f17ec0897a7af1b8431b92581dd1dde838932809545a50e3" dependencies = [ - "ark-crypto-primitives 0.3.0", - "ark-ff 0.3.0", + "ark-crypto-primitives", + "ark-ff", "ark-r1cs-std", - "ark-relations 0.3.0", - "ark-std 0.3.0", + "ark-relations", + "ark-std", "arkworks-native-gadgets", ] @@ -770,14 +563,14 @@ version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5323a665ecb27b1a47a1a4df0f99a85ff265043d2ea27332f8438f2fcdcb4c55" dependencies = [ - "ark-crypto-primitives 0.3.0", - "ark-ec 0.3.0", - "ark-ff 0.3.0", + "ark-crypto-primitives", + "ark-ec", + "ark-ff", "ark-groth16 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "ark-r1cs-std", - "ark-relations 0.3.0", - "ark-serialize 0.3.0", - "ark-std 0.3.0", + "ark-relations", + "ark-serialize", + "ark-std", "arkworks-native-gadgets", "arkworks-r1cs-circuits", "arkworks-r1cs-gadgets", @@ -792,8 +585,8 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61236daec5fc93440fbde38981ea062deacd222bdbf95e44e6d39bdb01261f9b" dependencies = [ - "ark-ff 0.3.0", - "ark-std 0.3.0", + "ark-ff", + "ark-std", "hex", ] @@ -1488,15 +1281,15 @@ dependencies = [ name = "circom-proving" version = "0.1.0" dependencies = [ - "ark-bn254 0.3.0", - "ark-circom 0.1.0 (git+https://github.com/vacp2p/ark-circom?branch=wasm)", - "ark-crypto-primitives 0.3.0", - "ark-ec 0.3.0", - "ark-ff 0.3.0", + "ark-bn254", + "ark-circom", + "ark-crypto-primitives", + "ark-ec", + "ark-ff", "ark-groth16 0.3.0 (git+https://github.com/arkworks-rs/groth16?rev=765817f)", - "ark-relations 0.3.0", - "ark-serialize 0.3.0", - "ark-std 0.3.0", + "ark-relations", + "ark-serialize", + "ark-std", "arkworks-native-gadgets", "cfg-if", "color-eyre 0.6.2", @@ -5805,15 +5598,15 @@ name = "pallet-anonymity-mining-claims" version = "1.0.0" dependencies = [ "ark-bls12-381", - "ark-bn254 0.3.0", - "ark-circom 0.1.0 (git+https://github.com/vacp2p/ark-circom?branch=wasm)", - "ark-crypto-primitives 0.3.0", - "ark-ec 0.3.0", - "ark-ff 0.3.0", + "ark-bn254", + "ark-circom", + "ark-crypto-primitives", + "ark-ec", + "ark-ff", "ark-groth16 0.3.0 (git+https://github.com/arkworks-rs/groth16?rev=765817f)", - "ark-relations 0.3.0", - "ark-serialize 0.3.0", - "ark-std 0.3.0", + "ark-relations", + "ark-serialize", + "ark-std", "arkworks-setups", "cfg-if", "circom-proving", @@ -5859,13 +5652,13 @@ name = "pallet-anonymity-mining-rewards" version = "1.0.0" dependencies = [ "ark-bls12-381", - "ark-bn254 0.3.0", - "ark-crypto-primitives 0.3.0", - "ark-ec 0.3.0", - "ark-ff 0.3.0", - "ark-relations 0.3.0", - "ark-serialize 0.3.0", - "ark-std 0.3.0", + "ark-bn254", + "ark-crypto-primitives", + "ark-ec", + "ark-ff", + "ark-relations", + "ark-serialize", + "ark-std", "arkworks-setups", "frame-benchmarking", "frame-support", @@ -6082,7 +5875,7 @@ dependencies = [ name = "pallet-claims-verifier" version = "1.0.0" dependencies = [ - "ark-crypto-primitives 0.3.0", + "ark-crypto-primitives", "frame-benchmarking", "frame-support", "frame-system", @@ -6216,13 +6009,13 @@ name = "pallet-hasher" version = "1.0.0" dependencies = [ "ark-bls12-381", - "ark-bn254 0.3.0", - "ark-crypto-primitives 0.3.0", - "ark-ec 0.3.0", - "ark-ff 0.3.0", - "ark-relations 0.3.0", - "ark-serialize 0.3.0", - "ark-std 0.3.0", + "ark-bn254", + "ark-crypto-primitives", + "ark-ec", + "ark-ff", + "ark-relations", + "ark-serialize", + "ark-std", "arkworks-setups", "frame-benchmarking", "frame-support", @@ -6331,13 +6124,13 @@ dependencies = [ name = "pallet-linkable-tree" version = "1.0.0" dependencies = [ - "ark-bn254 0.3.0", - "ark-crypto-primitives 0.3.0", - "ark-ec 0.3.0", - "ark-ff 0.3.0", - "ark-relations 0.3.0", - "ark-serialize 0.3.0", - "ark-std 0.3.0", + "ark-bn254", + "ark-crypto-primitives", + "ark-ec", + "ark-ff", + "ark-relations", + "ark-serialize", + "ark-std", "arkworks-setups", "frame-benchmarking", "frame-support", @@ -6390,13 +6183,13 @@ name = "pallet-mixer" version = "1.0.0" dependencies = [ "ark-bls12-381", - "ark-bn254 0.3.0", - "ark-crypto-primitives 0.3.0", - "ark-ec 0.3.0", - "ark-ff 0.3.0", - "ark-relations 0.3.0", - "ark-serialize 0.3.0", - "ark-std 0.3.0", + "ark-bn254", + "ark-crypto-primitives", + "ark-ec", + "ark-ff", + "ark-relations", + "ark-serialize", + "ark-std", "arkworks-setups", "frame-benchmarking", "frame-support", @@ -6426,10 +6219,10 @@ dependencies = [ name = "pallet-mt" version = "1.0.0" dependencies = [ - "ark-bn254 0.3.0", - "ark-crypto-primitives 0.3.0", - "ark-ff 0.3.0", - "ark-std 0.3.0", + "ark-bn254", + "ark-crypto-primitives", + "ark-ff", + "ark-std", "arkworks-setups", "frame-benchmarking", "frame-support", @@ -6832,15 +6625,15 @@ dependencies = [ name = "pallet-vanchor" version = "1.0.0" dependencies = [ - "ark-bn254 0.3.0", - "ark-circom 0.1.0 (git+https://github.com/vacp2p/ark-circom?branch=wasm)", - "ark-crypto-primitives 0.3.0", - "ark-ec 0.3.0", - "ark-ff 0.3.0", + "ark-bn254", + "ark-circom", + "ark-crypto-primitives", + "ark-ec", + "ark-ff", "ark-groth16 0.3.0 (git+https://github.com/arkworks-rs/groth16?rev=765817f)", - "ark-relations 0.3.0", - "ark-serialize 0.3.0", - "ark-std 0.3.0", + "ark-relations", + "ark-serialize", + "ark-std", "arkworks-native-gadgets", "arkworks-setups", "cfg-if", @@ -6884,8 +6677,8 @@ dependencies = [ name = "pallet-vanchor-handler" version = "1.0.0" dependencies = [ - "ark-bn254 0.3.0", - "ark-crypto-primitives 0.3.0", + "ark-bn254", + "ark-crypto-primitives", "arkworks-setups", "frame-benchmarking", "frame-support", @@ -6921,7 +6714,7 @@ dependencies = [ name = "pallet-vanchor-verifier" version = "1.0.0" dependencies = [ - "ark-crypto-primitives 0.3.0", + "ark-crypto-primitives", "frame-benchmarking", "frame-support", "frame-system", @@ -6942,7 +6735,7 @@ dependencies = [ name = "pallet-verifier" version = "1.0.0" dependencies = [ - "ark-crypto-primitives 0.3.0", + "ark-crypto-primitives", "frame-benchmarking", "frame-support", "frame-system", @@ -12723,18 +12516,19 @@ name = "webb-client" version = "0.1.0" dependencies = [ "ark-bls12-381", - "ark-bn254 0.3.0", - "ark-circom 0.1.0 (git+https://github.com/gakonst/ark-circom?branch=master)", - "ark-crypto-primitives 0.3.0", - "ark-ec 0.3.0", - "ark-ff 0.3.0", + "ark-bn254", + "ark-circom", + "ark-crypto-primitives", + "ark-ec", + "ark-ff", "ark-groth16 0.3.0 (git+https://github.com/arkworks-rs/groth16?rev=765817f)", - "ark-relations 0.3.0", - "ark-serialize 0.3.0", - "ark-std 0.3.0", + "ark-relations", + "ark-serialize", + "ark-std", "arkworks-native-gadgets", "arkworks-setups", "cfg-if", + "circom-proving", "color-eyre 0.6.2", "frame-benchmarking", "frame-support", @@ -12767,20 +12561,21 @@ name = "webb-primitives" version = "0.1.0" dependencies = [ "ark-bls12-381", - "ark-bn254 0.3.0", - "ark-crypto-primitives 0.3.0", - "ark-ec 0.3.0", - "ark-ff 0.3.0", - "ark-groth16 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ark-relations 0.3.0", - "ark-serialize 0.3.0", - "ark-std 0.3.0", + "ark-bn254", + "ark-crypto-primitives", + "ark-ec", + "ark-ff", + "ark-groth16 0.3.0 (git+https://github.com/arkworks-rs/groth16?rev=765817f)", + "ark-relations", + "ark-serialize", + "ark-std", "arkworks-native-gadgets", "blake2 0.9.2", "byteorder", "digest 0.9.0", "ethabi 15.0.0", "frame-support", + "hex", "parity-scale-codec", "scale-info", "serde", @@ -12813,7 +12608,9 @@ dependencies = [ name = "webb-standalone-node" version = "1.0.0" dependencies = [ - "ark-bn254 0.3.0", + "ark-bn254", + "ark-circom", + "ark-serialize", "arkworks-setups", "clap 4.2.1", "frame-benchmarking", @@ -12875,6 +12672,7 @@ dependencies = [ "substrate-build-script-utils", "substrate-frame-rpc-system", "substrate-state-trie-migration-rpc", + "wasmer", "webb-primitives", "webb-standalone-runtime", ] diff --git a/circom-proving/Cargo.toml b/circom-proving/Cargo.toml index ed9b98a42..50a1f547a 100644 --- a/circom-proving/Cargo.toml +++ b/circom-proving/Cargo.toml @@ -10,6 +10,7 @@ ark-bn254 = { version = "0.3.0" } ark-circom = { git = "https://github.com/vacp2p/ark-circom", branch = "wasm", default-features = false, features = ["circom-2"] } ark-ec = { version = "^0.3.0", default-features = false } ark-ff = { version = "0.3.0", default-features = false, features = ["asm"] } +# ark-groth16 = { version = "^0.3.0", default-features = false } ark-groth16 = { git = "https://github.com/arkworks-rs/groth16", rev = "765817f", default-features = false, features = ["parallel"] } ark-relations = { version = "^0.3.0", default-features = false } ark-serialize = { version = "^0.3.0", default-features = false, features = ["derive"] } diff --git a/client/Cargo.toml b/client/Cargo.toml index 5fbb999d9..21cdb196f 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -23,7 +23,7 @@ tokio = { version = "1.17.0", features = ["full"] } # arkworks related deps ark-bls12-381 = { version = "^0.3.0", default-features = false, features = ["curve"] } ark-bn254 = { version = "^0.3.0", default-features = false, features = ["curve"] } -ark-circom = { git = "https://github.com/gakonst/ark-circom", branch = "master", default-features = false, features = ["circom-2"] } +ark-circom = { git = "https://github.com/vacp2p/ark-circom", branch = "wasm", default-features = false, features = ["circom-2"] } ark-crypto-primitives = { version = "^0.3.0", features = ["r1cs"], default-features = false } ark-ec = { version = "^0.3.0", default-features = false } ark-ff = { version = "^0.3.0", default-features = false } @@ -52,6 +52,7 @@ wasmer = { version = "2.3.0", default-features = false } # Webb deps arkworks-native-gadgets = { version = "1.2.0", default-features = false } webb-primitives = { path = "../primitives", features = ["hashing", "verifying", "field_ops"] } +circom-proving = { path = "../circom-proving", default-features = false } [features] default = ["std", "wasmer/sys-default"] diff --git a/client/tests/integration_tests.rs b/client/tests/integration_tests.rs index f92f0af5a..6c177bc89 100644 --- a/client/tests/integration_tests.rs +++ b/client/tests/integration_tests.rs @@ -15,6 +15,7 @@ use webb_primitives::{hashing::ethereum::keccak_256, utils::compute_chain_id_typ use ark_bn254::{Bn254, Fr as Bn254Fr}; use arkworks_native_gadgets::ark_std::rand::rngs::OsRng; use arkworks_setups::{common::verify_unchecked_raw, utxo::Utxo}; +use circom_proving::verify_proof; use subxt::{ ext::sp_runtime::AccountId32, tx::{PairSigner, TxProgress}, @@ -33,12 +34,10 @@ async fn test_mixer() -> Result<(), Box> { let api: OnlineClient<_> = OnlineClient::::new().await?; let signer = PairSigner::new(AccountKeyring::Alice.pair()); - let pk_bytes = include_bytes!( - "../../substrate-fixtures/substrate-fixtures/mixer/bn254/x5/proving_key_uncompressed.bin" - ); - let vk_bytes = include_bytes!( - "../../substrate-fixtures/substrate-fixtures/mixer/bn254/x5/verifying_key_uncompressed.bin" - ); + let pk_bytes = + include_bytes!("../../substrate-fixtures/mixer/bn254/x5/proving_key_uncompressed.bin"); + let vk_bytes = + include_bytes!("../../substrate-fixtures/mixer/bn254/x5/verifying_key_uncompressed.bin"); let recipient = AccountKeyring::Bob.to_account_id(); let relayer = AccountKeyring::Bob.to_account_id(); let recipient_bytes = truncate_and_pad(&recipient.encode()); @@ -197,7 +196,7 @@ async fn make_vanchor_tx( wc, ); - let res = verify_proof(&circom_params.0.vk, &proof, &public_inputs); + let res = verify_proof(&circom_params.0.vk, &proof, public_inputs.clone()); assert!(res.unwrap(), "Invalid proof"); println!("proof verified"); diff --git a/docker/Standalone.Dockerfile b/docker/Standalone.Dockerfile index d07ad5146..215c45895 100644 --- a/docker/Standalone.Dockerfile +++ b/docker/Standalone.Dockerfile @@ -32,8 +32,7 @@ WORKDIR /webb COPY . . # Use "RUN" instructions to combine multiple commands into a single layer -RUN git submodule update --init --recursive \ - && sh ./scripts/fetch-fixtures.sh \ +RUN dvc pull -v \ && RUST_BACKTRACE=1 cargo build --release -p webb-standalone-node --verbose # Use the final stage to reduce the size of the final image diff --git a/flake.nix b/flake.nix index 69a503766..6955f434a 100644 --- a/flake.nix +++ b/flake.nix @@ -38,6 +38,7 @@ ]; buildInputs = [ # Used for DVC + # use `pipx run dvc ` instead pkgs.python311 pkgs.python311Packages.pipx # We want the unwrapped version, wrapped comes with nixpkgs' toolchain @@ -49,19 +50,11 @@ # Finally the toolchain toolchain ]; - packages = [ ]; + packages = [ + pkgs.cargo-nextest + ]; # Environment variables RUST_SRC_PATH = "${toolchain}/lib/rustlib/src/rust/library"; - # Runs DVC pull in the fixtures - # we do not install dvc globally, since it - # is broken on nixos - shellHook = '' - ROOT=$(git rev-parse --show-toplevel) - cd $ROOT/solidity-fixtures && pipx run dvc pull - cd $ROOT - cd $ROOT/substrate-fixtures && pipx run dvc pull - cd $ROOT - ''; }; }); } diff --git a/pallets/masp/anonymity-mining-claims/src/test_utils.rs b/pallets/masp/anonymity-mining-claims/src/test_utils.rs index beaea429c..6f8d53eb3 100644 --- a/pallets/masp/anonymity-mining-claims/src/test_utils.rs +++ b/pallets/masp/anonymity-mining-claims/src/test_utils.rs @@ -45,11 +45,11 @@ pub fn setup_environment_with_circom( setup_environment(); println!("Setting up ZKey"); - let path_2_2 = "../../../solidity-fixtures/solidity-fixtures/reward_2/30/circuit_final.zkey"; + let path_2_2 = "../../../solidity-fixtures/reward_2/30/circuit_final.zkey"; let mut file_2_2 = File::open(path_2_2).unwrap(); let params_2_2 = read_zkey(&mut file_2_2).unwrap(); - let wasm_2_2_path = "../../../solidity-fixtures/solidity-fixtures/reward_2/30/reward_30_2.wasm"; + let wasm_2_2_path = "../../../solidity-fixtures/reward_2/30/reward_30_2.wasm"; let wc_2_2 = circom_from_folder(wasm_2_2_path); diff --git a/pallets/masp/anonymity-mining-claims/src/tests.rs b/pallets/masp/anonymity-mining-claims/src/tests.rs index 3f7e96191..f6d22c635 100644 --- a/pallets/masp/anonymity-mining-claims/src/tests.rs +++ b/pallets/masp/anonymity-mining-claims/src/tests.rs @@ -120,7 +120,7 @@ fn should_create_pallet() { } #[test] -// #[ignore] +#[ignore = "Needs to update the fixtures to the latest commit"] fn circom_should_complete_30x2_reward_claim_with_json_file() { new_test_ext().execute_with(|| { let (params_2_2, wc_2_2) = setup_environment_with_circom(); diff --git a/pallets/mixer/src/tests.rs b/pallets/mixer/src/tests.rs index 42ba10146..a1b68e111 100644 --- a/pallets/mixer/src/tests.rs +++ b/pallets/mixer/src/tests.rs @@ -45,11 +45,10 @@ fn setup_environment(curve: Curve) -> Vec { // 3. Setup the VerifierPallet // but to do so, we need to have a VerifyingKey let pk_bytes = include_bytes!( - "../../../substrate-fixtures/substrate-fixtures/mixer/bn254/x5/proving_key_uncompressed.bin" - ); - let vk_bytes = include_bytes!( - "../../../substrate-fixtures/substrate-fixtures/mixer/bn254/x5/verifying_key.bin" + "../../../substrate-fixtures/mixer/bn254/x5/proving_key_uncompressed.bin" ); + let vk_bytes = + include_bytes!("../../../substrate-fixtures/mixer/bn254/x5/verifying_key.bin"); assert_ok!(VerifierPallet::force_set_parameters( RuntimeOrigin::root(), diff --git a/pallets/vanchor-verifier/src/lib.rs b/pallets/vanchor-verifier/src/lib.rs index 7409e84db..b037bff3a 100644 --- a/pallets/vanchor-verifier/src/lib.rs +++ b/pallets/vanchor-verifier/src/lib.rs @@ -186,7 +186,7 @@ impl, I: 'static> VAnchorVerifierModule for Pallet { match T::Verifier::verify(public_inp_bytes, proof, ¶ms) { Ok(verified) => Ok(verified), Err(e) => { - log::error!("{:?}", e); + log::error!("Proof Verification Error: {:?}", e); ensure!(false, Error::::VerifyError); Ok(false) }, diff --git a/pallets/vanchor/Cargo.toml b/pallets/vanchor/Cargo.toml index 6f523348b..dcba53fb2 100644 --- a/pallets/vanchor/Cargo.toml +++ b/pallets/vanchor/Cargo.toml @@ -12,6 +12,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "max-encoded-len"] } scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +hex = { version = "0.4", default-features = false } ark-bn254 = { version = "^0.3.0", default-features = false, features = ["curve"] } ark-ff = { version = "^0.3.0", default-features = false } @@ -43,7 +44,8 @@ ark-circom = { git = "https://github.com/vacp2p/ark-circom", branch = "wasm", de ark-crypto-primitives = { version = "^0.3.0", features = ["r1cs"], default-features = false } ark-ec = { version = "^0.3.0", default-features = false } ark-ff = { version = "0.3.0", default-features = false, features = ["asm"] } -ark-groth16 = { git = "https://github.com/arkworks-rs/groth16", rev = "765817f", default-features = false, features = ["parallel"] } +ark-groth16 = { git = "https://github.com/arkworks-rs/groth16", rev = "765817f", default-features = false } +# ark-groth16 = { version = "^0.3.0", default-features = false } ark-relations = { version = "^0.3.0", default-features = false } ark-serialize = { version = "^0.3.0", default-features = false, features = ["derive"] } ark-std = { version = "^0.3.0", default-features = false } @@ -89,7 +91,8 @@ std = [ "ark-std/std", "arkworks-setups/std", "pallet-vanchor-verifier/std", - "pallet-hasher/std" + "pallet-hasher/std", + "hex/std" ] runtime-benchmarks = [ "frame-benchmarking", diff --git a/pallets/vanchor/src/test_utils.rs b/pallets/vanchor/src/test_utils.rs index 08586529b..d57698c51 100644 --- a/pallets/vanchor/src/test_utils.rs +++ b/pallets/vanchor/src/test_utils.rs @@ -68,7 +68,7 @@ pub fn setup_environment_with_circom( // Load the WASM and R1CS for witness and proof generation // Get path to solidity fixtures println!("Setting up ZKey"); - let path_2_2 = "../../solidity-fixtures/solidity-fixtures/vanchor_2/2/circuit_final.zkey"; + let path_2_2 = "../../solidity-fixtures/vanchor_2/2/circuit_final.zkey"; let mut file_2_2 = File::open(path_2_2).unwrap(); let params_2_2 = read_zkey(&mut file_2_2).unwrap(); @@ -82,8 +82,7 @@ pub fn setup_environment_with_circom( vk_2_2_bytes.try_into().unwrap(), )); - let wasm_2_2_path = - "../../solidity-fixtures/solidity-fixtures//vanchor_2/2/poseidon_vanchor_2_2.wasm"; + let wasm_2_2_path = "../../solidity-fixtures//vanchor_2/2/poseidon_vanchor_2_2.wasm"; let wc_2_2 = circom_from_folder(wasm_2_2_path); diff --git a/pallets/vanchor/src/tests.rs b/pallets/vanchor/src/tests.rs index 19602a6bb..bfc532744 100644 --- a/pallets/vanchor/src/tests.rs +++ b/pallets/vanchor/src/tests.rs @@ -52,22 +52,20 @@ fn setup_environment() -> (Vec, Vec, Vec, Vec) { // but to do so, we need to have a VerifyingKey let pk_2_2_bytes = include_bytes!( - "../../../substrate-fixtures/substrate-fixtures/vanchor/bn254/x5/2-2-2/proving_key_uncompressed.bin" - ) - .to_vec(); - let vk_2_2_bytes = include_bytes!( - "../../../substrate-fixtures/substrate-fixtures/vanchor/bn254/x5/2-2-2/verifying_key.bin" + "../../../substrate-fixtures/vanchor/bn254/x5/2-2-2/proving_key_uncompressed.bin" ) .to_vec(); + let vk_2_2_bytes = + include_bytes!("../../../substrate-fixtures/vanchor/bn254/x5/2-2-2/verifying_key.bin") + .to_vec(); let pk_2_16_bytes = include_bytes!( - "../../../substrate-fixtures/substrate-fixtures/vanchor/bn254/x5/2-16-2/proving_key_uncompressed.bin" - ) - .to_vec(); - let vk_2_16_bytes = include_bytes!( - "../../../substrate-fixtures/substrate-fixtures/vanchor/bn254/x5/2-16-2/verifying_key.bin" + "../../../substrate-fixtures/vanchor/bn254/x5/2-16-2/proving_key_uncompressed.bin" ) .to_vec(); + let vk_2_16_bytes = + include_bytes!("../../../substrate-fixtures/vanchor/bn254/x5/2-16-2/verifying_key.bin") + .to_vec(); assert_ok!(VAnchorVerifier1::force_set_parameters( RuntimeOrigin::root(), diff --git a/pallets/vanchor/src/tests_circom.rs b/pallets/vanchor/src/tests_circom.rs index 4eee018d4..f06906db4 100644 --- a/pallets/vanchor/src/tests_circom.rs +++ b/pallets/vanchor/src/tests_circom.rs @@ -12,7 +12,6 @@ use crate::{ use ark_ff::{BigInteger, PrimeField}; // use ark_groth16::ProvingKey; // use ark_relations::r1cs::ConstraintMatrices; -use ark_serialize::CanonicalSerialize; use arkworks_native_gadgets::{ merkle_tree::{Path, SparseMerkleTree}, poseidon::Poseidon, @@ -33,6 +32,7 @@ use webb_primitives::{ merkle_tree::TreeInspector, types::vanchor::{ExtData, ProofData}, utils::compute_chain_id_type, + verifying::circom::Proof as SolidityProof, AccountId, }; @@ -277,8 +277,8 @@ fn circom_should_complete_2x2_transaction_with_withdraw() { let (_chain_id, public_amount, root_set, nullifiers, commitments, ext_data_hash) = deconstruct_public_inputs_el(&inputs_for_verification.to_vec()); - let mut proof_bytes = Vec::new(); - proof.serialize(&mut proof_bytes).unwrap(); + let solidity_proof = SolidityProof::try_from(proof).unwrap(); + let proof_bytes = solidity_proof.encode().unwrap(); let proof_data = ProofData::new( proof_bytes, public_amount, diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml index ebe03a7d3..7d0df4b8e 100644 --- a/primitives/Cargo.toml +++ b/primitives/Cargo.toml @@ -23,8 +23,8 @@ ark-bls12-381 = { version = "^0.3.0", default-features = false, features = ["cur ark-bn254 = { version = "^0.3.0", default-features = false, features = ["curve"], optional = true } ark-ec = { version = "^0.3.0", default-features = false } ark-ff = { version = "^0.3.0", default-features = false } -# ark-groth16 = { git = "https://github.com/arkworks-rs/groth16", rev = "765817f", default-features = false, features = ["parallel"] } -ark-groth16 = { version = "^0.3.0", default-features = false } +ark-groth16 = { git = "https://github.com/arkworks-rs/groth16", rev = "765817f", default-features = false } +# ark-groth16 = { version = "^0.3.0", default-features = false } ark-relations = { version = "^0.3.0", default-features = false } ark-serialize = { version = "^0.3.0", default-features = false, features = ["derive"] } ark-std = { version = "^0.3.0", default-features = false } @@ -33,6 +33,7 @@ ark-std = { version = "^0.3.0", default-features = false } blake2 = { version = "0.9", default-features = false } byteorder = { version = "1", default-features = false } digest = { version = "0.9", default-features = false } +hex = { version = "0.4", default-features = false } ark-crypto-primitives = { version = "^0.3.0", default-features = false } arkworks-native-gadgets = { version = "1.2.0", default-features = false, optional = true } @@ -41,6 +42,7 @@ ethabi = { version = "15.0.0", default-features = false } webb-proposals = { git = "https://github.com/webb-tools/webb-rs", default-features = false, features = ["scale", "substrate", "evm"] } + [features] default = ["std", "hashing", "verifying", "field_ops"] field_ops = [ @@ -67,6 +69,7 @@ std = [ "ark-std/std", "ark-relations/std", "webb-proposals/std", + "hex/std", ] verifying = [ "arkworks-native-gadgets", diff --git a/primitives/src/types/vanchor.rs b/primitives/src/types/vanchor.rs index 6a4281f5d..f47dc97c3 100644 --- a/primitives/src/types/vanchor.rs +++ b/primitives/src/types/vanchor.rs @@ -1,5 +1,6 @@ use super::{ElementTrait, IntoAbiToken, Token}; use codec::{Decode, Encode, MaxEncodedLen}; +use ethabi::{Int, Uint}; use scale_info::TypeInfo; use sp_std::{vec, vec::Vec}; @@ -73,19 +74,21 @@ impl ExtData { } impl IntoAbiToken for ExtData { + // (bytes recipient,int256 extAmount,bytes relayer,uint256 fee,uint256 + // refund,bytes token,bytes encryptedOutput1,bytes encryptedOutput2) fn into_abi(&self) -> Token { let recipient = Token::Bytes(self.recipient.encode()); - let ext_amount = Token::Bytes(self.ext_amount.encode()); + let ext_amount = Token::Int(Int::from_little_endian(&self.ext_amount.encode())); let relayer = Token::Bytes(self.relayer.encode()); - let fee = Token::Bytes(self.fee.encode()); - let refund = Token::Bytes(self.refund.encode()); + let fee = Token::Uint(Uint::from_little_endian(&self.fee.encode())); + let refund = Token::Uint(Uint::from_little_endian(&self.refund.encode())); let token = Token::Bytes(self.token.encode()); let encrypted_output1 = Token::Bytes(self.encrypted_output1.clone()); let encrypted_output2 = Token::Bytes(self.encrypted_output2.clone()); let ext_data_args = vec![ recipient, - relayer, ext_amount, + relayer, fee, refund, token, @@ -95,3 +98,54 @@ impl IntoAbiToken for ExtData Result { - let public_input_field_elts = to_field_elements::(public_inp_bytes)?; - let vk = ArkVerifyingKey::deserialize(vk_bytes)?; - let proof = ArkProof::deserialize(proof_bytes)?; - let res = verify_groth16(&vk.into(), &public_input_field_elts, &proof)?; + let public_input_field_elts = match to_field_elements::(public_inp_bytes) { + Ok(v) => v, + Err(e) => { + frame_support::log::error!( + "Failed to convert public input bytes to field elements: {e:?}", + ); + return Err(e) + }, + }; + let vk = match ArkVerifyingKey::deserialize(vk_bytes) { + Ok(v) => v, + Err(e) => { + frame_support::log::error!("Failed to deserialize verifying key: {e:?}"); + return Err(e.into()) + }, + }; + let proof = match Proof::decode(proof_bytes).and_then(|v| v.try_into()) { + Ok(v) => v, + Err(e) => { + frame_support::log::error!("Failed to deserialize proof: {e:?}"); + return Err(e) + }, + }; + let res = match verify_groth16(&vk.into(), &public_input_field_elts, &proof) { + Ok(v) => v, + Err(e) => { + frame_support::log::error!("Failed to verify proof: {e:?}"); + return Err(e) + }, + }; + Ok(res) } } + +#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] +pub struct G1 { + pub x: U256, + pub y: U256, +} + +impl TryFrom for G1Affine { + type Error = Error; + fn try_from(src: G1) -> Result { + let x: ark_bn254::Fq = u256_to_point(src.x)?; + let y: ark_bn254::Fq = u256_to_point(src.y)?; + let inf = x.is_zero() && y.is_zero(); + Ok(Self::new(x, y, inf)) + } +} + +impl TryFrom<&G1Affine> for G1 { + type Error = Error; + fn try_from(p: &G1Affine) -> Result { + Ok(Self { x: point_to_u256(p.x)?, y: point_to_u256(p.y)? }) + } +} + +#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] +pub struct G2 { + pub x: [U256; 2], + pub y: [U256; 2], +} + +impl TryFrom for G2Affine { + type Error = Error; + fn try_from(src: G2) -> Result { + let c0 = u256_to_point(src.x[0])?; + let c1 = u256_to_point(src.x[1])?; + let x = ark_bn254::Fq2::new(c0, c1); + + let c0 = u256_to_point(src.y[0])?; + let c1 = u256_to_point(src.y[1])?; + let y = ark_bn254::Fq2::new(c0, c1); + + let inf = x.is_zero() && y.is_zero(); + Ok(Self::new(x, y, inf)) + } +} + +impl TryFrom<&G2Affine> for G2 { + type Error = Error; + fn try_from(p: &G2Affine) -> Result { + Ok(Self { + x: [point_to_u256(p.x.c0)?, point_to_u256(p.x.c1)?], + y: [point_to_u256(p.y.c0)?, point_to_u256(p.y.c1)?], + }) + } +} + +#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] +pub struct Proof { + pub a: G1, + pub b: G2, + pub c: G1, +} + +impl Proof { + pub fn decode(input: &[u8]) -> Result { + // (uint[2] a,uint[2][2] b,uint[2] c) + let mut decoded = ethabi::decode( + &[ParamType::Tuple(sp_std::vec![ + ParamType::FixedArray(Box::new(ParamType::Uint(256)), 2), + ParamType::FixedArray( + Box::new(ParamType::FixedArray(Box::new(ParamType::Uint(256)), 2)), + 2, + ), + ParamType::FixedArray(Box::new(ParamType::Uint(256)), 2), + ])], + input, + ) + .map_err(|e| { + frame_support::log::error!("Failed to decode proof: {:?}", e); + CircomError::InvalidProofBytes + })?; + // Unwrap the decoded tuple + let decoded = decoded.pop().ok_or(CircomError::InvalidProofBytes)?; + let decoded = match decoded { + ethabi::Token::Tuple(v) => v, + _ => return Err(CircomError::InvalidProofBytes.into()), + }; + let a = decoded[0].clone().into_fixed_array().ok_or(CircomError::InvalidProofBytes)?; + let a_x = a[0].clone().into_uint().ok_or(CircomError::InvalidProofBytes)?; + let a_y = a[1].clone().into_uint().ok_or(CircomError::InvalidProofBytes)?; + + let b = decoded[1].clone().into_fixed_array().ok_or(CircomError::InvalidProofBytes)?; + let b_x = b[0].clone().into_fixed_array().ok_or(CircomError::InvalidProofBytes)?; + let b_y = b[1].clone().into_fixed_array().ok_or(CircomError::InvalidProofBytes)?; + let b_x_0 = b_x[0].clone().into_uint().ok_or(CircomError::InvalidProofBytes)?; + let b_x_1 = b_x[1].clone().into_uint().ok_or(CircomError::InvalidProofBytes)?; + let b_y_0 = b_y[0].clone().into_uint().ok_or(CircomError::InvalidProofBytes)?; + let b_y_1 = b_y[1].clone().into_uint().ok_or(CircomError::InvalidProofBytes)?; + + let c = decoded[2].clone().into_fixed_array().ok_or(CircomError::InvalidProofBytes)?; + let c_x = c[0].clone().into_uint().ok_or(CircomError::InvalidProofBytes)?; + let c_y = c[1].clone().into_uint().ok_or(CircomError::InvalidProofBytes)?; + Ok(Self { + a: G1 { x: a_x, y: a_y }, + b: G2 { x: [b_x_1, b_x_0], y: [b_y_1, b_y_0] }, + c: G1 { x: c_x, y: c_y }, + }) + } + + pub fn encode(&self) -> Result, Error> { + let a_x = self.a.x; + let a_y = self.a.y; + let b_x_0 = self.b.x[0]; + let b_x_1 = self.b.x[1]; + let b_y_0 = self.b.y[0]; + let b_y_1 = self.b.y[1]; + let c_x = self.c.x; + let c_y = self.c.y; + let encoded = ethabi::encode(&[ethabi::Token::Tuple(vec![ + ethabi::Token::FixedArray(vec![ethabi::Token::Uint(a_x), ethabi::Token::Uint(a_y)]), + ethabi::Token::FixedArray(vec![ + ethabi::Token::FixedArray(vec![ + ethabi::Token::Uint(b_x_1), + ethabi::Token::Uint(b_x_0), + ]), + ethabi::Token::FixedArray(vec![ + ethabi::Token::Uint(b_y_1), + ethabi::Token::Uint(b_y_0), + ]), + ]), + ethabi::Token::FixedArray(vec![ethabi::Token::Uint(c_x), ethabi::Token::Uint(c_y)]), + ])]); + Ok(encoded) + } +} + +impl TryFrom> for Proof { + type Error = Error; + fn try_from(proof: ArkProof) -> Result { + Ok(Self { + a: G1::try_from(&proof.a)?, + b: G2::try_from(&proof.b)?, + c: G1::try_from(&proof.c)?, + }) + } +} + +impl TryFrom for ArkProof { + type Error = Error; + fn try_from(src: Proof) -> Result { + Ok(Self { a: src.a.try_into()?, b: src.b.try_into()?, c: src.c.try_into()? }) + } +} + +// Helper for converting a PrimeField to its U256 representation for Ethereum compatibility +fn u256_to_point(point: U256) -> Result { + let mut buf = [0; 32]; + point.to_little_endian(&mut buf); + let bigint = F::BigInt::read(&buf[..]).map_err(|_| CircomError::InvalidProofBytes)?; + F::from_repr(bigint).ok_or_else(|| CircomError::InvalidProofBytes.into()) +} + +// Helper for converting a PrimeField to its U256 representation for Ethereum compatibility +// (U256 reads data as big endian) +fn point_to_u256(point: F) -> Result { + let point = point.into_repr(); + let point_bytes = point.to_bytes_be(); + if point_bytes.len() != 32 { + return Err(CircomError::InvalidProofBytes.into()) + } + Ok(U256::from(&point_bytes[..])) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn from_js_solidity_proof_to_arkworks() { + let js_proof_bytes = hex::decode("283214454fd3acd78dd7d83e2e7ff187918f93c83a7a29c65e9d84c5b796e2f4165dedc98635cbb7226bca867c4b3454cc002902d74684b63bbba33bfbfe0b9e27f8c215f3b5574fa8c4cef8b4eacfe2577a17c37f60f0f037dec244d5f6d31401c2f126b04cb69727b8c273612659a3dd6cddb96891c2c2ebea6c313956ff700ebb472ecead76346d13468cf9eea1269b5a94b3c847840d5a5bb9dba50c39f029801c58394e18719ffacc6752e803b2e3fade1219f423c38618799bd954e9b910b3936beafe6bd89c38fe0f297a0c2387d20df79e9f20b4f04b3ae59ce9a22a0c08e7eae8e0b4f5234c040436720e5c44326034e69f4b0e5236958571b5f216").unwrap(); + let eth_proof = Proof::decode(&js_proof_bytes[..]).unwrap(); + eprintln!("eth_proof: {eth_proof:#?}"); + let ark_proof: ArkProof = eth_proof.try_into().unwrap(); + let eth_proof2: Proof = ark_proof.clone().try_into().unwrap(); + assert_eq!(eth_proof, eth_proof2); + let ark_proof2: ArkProof = eth_proof2.try_into().unwrap(); + assert_eq!(ark_proof, ark_proof2); + } +} diff --git a/scripts/fetch-fixtures.sh b/scripts/fetch-fixtures.sh index d6063ef91..7e687b350 100755 --- a/scripts/fetch-fixtures.sh +++ b/scripts/fetch-fixtures.sh @@ -1,31 +1,10 @@ #!/bin/bash -# Update submodules -git submodule update --init --recursive - -# cd into protocol-solidity submodules -cd solidity-fixtures - -# run dvc pull -dvc pull -v - -# Check if dvc pull succeeds -if [ "$?" -ne 0 ]; then - echo "dvc pull failed in solidity-fixtures" - exit 1 -fi - -# cd out of solidity fixtures -cd .. - -# cd into substrate-fixtures -cd substrate-fixtures - # run dvc pull dvc pull -v # Check if dvc pull succeeds if [ "$?" -ne 0 ]; then - echo "dvc pull failed in substrate-fixtures" + echo "dvc pull failed" exit 1 fi diff --git a/solidity-fixtures b/solidity-fixtures deleted file mode 160000 index a27da611e..000000000 --- a/solidity-fixtures +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a27da611e169de3fa7f08a71405ad55911edcea9 diff --git a/solidity-fixtures.dvc b/solidity-fixtures.dvc new file mode 100644 index 000000000..f4f55f3eb --- /dev/null +++ b/solidity-fixtures.dvc @@ -0,0 +1,12 @@ +md5: 68983869cb2108989cce1cd9e62de647 +frozen: true +deps: +- path: solidity-fixtures + repo: + url: https://github.com/webb-tools/solidity-fixtures + rev_lock: 97cb9f8e2a11ef5e67c4d451c496fe15e089ca72 +outs: +- md5: 5a60727de10eb4fc2486f04a16d9eb5d.dir + size: 6627655556 + nfiles: 230 + path: solidity-fixtures diff --git a/standalone/node/Cargo.toml b/standalone/node/Cargo.toml index f9f0dd722..1aa4e629e 100644 --- a/standalone/node/Cargo.toml +++ b/standalone/node/Cargo.toml @@ -97,13 +97,18 @@ substrate-state-trie-migration-rpc = { git = "https://github.com/paritytech/subs ark-bn254 = { version = "^0.3.0", default-features = false, features = ["curve"] } +ark-circom = { git = "https://github.com/vacp2p/ark-circom", branch = "wasm", default-features = false, features = ["circom-2"] } arkworks-setups = { version = "1.2.1", features = ["r1cs"], default-features = false } +ark-serialize = { version = "^0.3.0", default-features = false } +wasmer = { version = "2.3" } [features] cli = [ "clap", ] -default = ["cli"] +default = ["cli", "circom-backend"] +arkworks-backend = ["webb-runtime/arkworks-backend"] +circom-backend = ["webb-runtime/circom-backend"] runtime-benchmarks = [ "webb-runtime/runtime-benchmarks", "frame-benchmarking/runtime-benchmarks", diff --git a/standalone/node/src/chain_spec.rs b/standalone/node/src/chain_spec.rs index 04432454a..4d68846d4 100644 --- a/standalone/node/src/chain_spec.rs +++ b/standalone/node/src/chain_spec.rs @@ -208,24 +208,103 @@ fn testnet_genesis( log::info!("Verifier params for mixer"); let mixer_verifier_bn254_params = { - let vk_bytes = include_bytes!( - "../../../substrate-fixtures/substrate-fixtures/mixer/bn254/x5/verifying_key.bin" - ); + let vk_bytes = + include_bytes!("../../../substrate-fixtures/mixer/bn254/x5/verifying_key.bin"); vk_bytes.to_vec() }; - log::info!("Verifier params for vanchor"); - let vanchor_verifier_2_2_bn254_params = { + #[cfg(feature = "arkworks-backend")] + log::info!("Verifier params for arkworks vanchor"); + #[cfg(feature = "arkworks-backend")] + let vanchor_arkworks_verifier_2_2_bn254_params = { let vk_bytes = - include_bytes!("../../../substrate-fixtures/substrate-fixtures/vanchor/bn254/x5/2-2-2/verifying_key.bin"); + include_bytes!("../../../substrate-fixtures/vanchor/bn254/x5/2-2-2/verifying_key.bin"); vk_bytes.to_vec() }; - let vanchor_verifier_2_16_bn254_params = { + #[cfg(feature = "arkworks-backend")] + let vanchor_arkworks_verifier_2_16_bn254_params = { let vk_bytes = - include_bytes!("../../../substrate-fixtures/substrate-fixtures/vanchor/bn254/x5/2-16-2/verifying_key.bin"); + include_bytes!("../../../substrate-fixtures/vanchor/bn254/x5/2-16-2/verifying_key.bin"); vk_bytes.to_vec() }; + #[cfg(feature = "circom-backend")] + log::info!("Verifier params for circom vanchor"); + #[cfg(feature = "circom-backend")] + let vanchor_circom_verifier_2_2_bn254_params = { + log::info!("Reading circom vk for 2-2"); + let zk_bytes = include_bytes!("../../../solidity-fixtures/vanchor_2/2/circuit_final.zkey"); + // wrap the bytes in a Cursor and read the params + let mut zk_reader = std::io::Cursor::new(zk_bytes); + let params_2_2 = ark_circom::read_zkey(&mut zk_reader).expect("reading zkey for 2-2"); + let mut vk_2_2_bytes = Vec::new(); + ark_serialize::CanonicalSerialize::serialize(¶ms_2_2.0.vk, &mut vk_2_2_bytes) + .expect("serializing vk for 2-2"); + vk_2_2_bytes + }; + + #[cfg(feature = "circom-backend")] + let vanchor_circom_verifier_2_8_bn254_params = { + log::info!("Reading circom vk for 2-8"); + let zk_bytes = include_bytes!("../../../solidity-fixtures/vanchor_2/8/circuit_final.zkey"); + // wrap the bytes in a Cursor and read the params + let mut zk_reader = std::io::Cursor::new(zk_bytes); + let params_2_8 = ark_circom::read_zkey(&mut zk_reader).expect("reading zkey for 2-8"); + let mut vk_2_8_bytes = Vec::new(); + ark_serialize::CanonicalSerialize::serialize(¶ms_2_8.0.vk, &mut vk_2_8_bytes) + .expect("serializing vk for 2-8"); + vk_2_8_bytes + }; + + #[cfg(feature = "circom-backend")] + let vanchor_circom_verifier_16_2_bn254_params = { + log::info!("Reading circom vk for 16-2"); + let zk_bytes = include_bytes!("../../../solidity-fixtures/vanchor_16/2/circuit_final.zkey"); + // wrap the bytes in a Cursor and read the params + let mut zk_reader = std::io::Cursor::new(zk_bytes); + let params_16_2 = ark_circom::read_zkey(&mut zk_reader).expect("reading zkey for 16-2"); + let mut vk_16_2_bytes = Vec::new(); + ark_serialize::CanonicalSerialize::serialize(¶ms_16_2.0.vk, &mut vk_16_2_bytes) + .expect("serializing vk for 16-2"); + vk_16_2_bytes + }; + + #[cfg(feature = "circom-backend")] + let vanchor_circom_verifier_16_8_bn254_params = { + log::info!("Reading circom vk for 16-8"); + let zk_bytes = include_bytes!("../../../solidity-fixtures/vanchor_16/8/circuit_final.zkey"); + // wrap the bytes in a Cursor and read the params + let mut zk_reader = std::io::Cursor::new(zk_bytes); + let params_16_8 = ark_circom::read_zkey(&mut zk_reader).expect("reading zkey for 16-8"); + let mut vk_16_8_bytes = Vec::new(); + ark_serialize::CanonicalSerialize::serialize(¶ms_16_8.0.vk, &mut vk_16_8_bytes) + .expect("serializing vk for 16-8"); + vk_16_8_bytes + }; + + #[cfg(feature = "arkworks-backend")] + let v_anchor_verifier_config = VAnchorVerifierConfig { + parameters: Some(vec![ + (2, 2, vanchor_arkworks_verifier_2_2_bn254_params.try_into().unwrap()), + (2, 16, vanchor_arkworks_verifier_2_16_bn254_params.try_into().unwrap()), + ]), + phantom: Default::default(), + }; + + #[cfg(feature = "circom-backend")] + let v_anchor_verifier_config = VAnchorVerifierConfig { + phantom: Default::default(), + parameters: Some(vec![ + (2, 2, vanchor_circom_verifier_2_2_bn254_params.try_into().unwrap()), + (2, 8, vanchor_circom_verifier_2_8_bn254_params.try_into().unwrap()), + (16, 2, vanchor_circom_verifier_16_2_bn254_params.try_into().unwrap()), + (16, 8, vanchor_circom_verifier_16_8_bn254_params.try_into().unwrap()), + ]), + }; + #[cfg(not(any(feature = "arkworks-backend", feature = "circom-backend")))] + let v_anchor_verifier_config = + VAnchorVerifierConfig { phantom: Default::default(), parameters: None }; + let mut endowed_accounts: Vec = endowed_accounts; // endow all authorities and nominators. initial_authorities @@ -255,18 +334,25 @@ fn testnet_genesis( log::info!("Genesis Config"); GenesisConfig { system: webb_runtime::SystemConfig { code: wasm_binary_unwrap().to_vec() }, - asset_registry: AssetRegistryConfig { - asset_names: vec![(b"TEST".to_vec().try_into().unwrap(), 1)], - native_asset_name: b"WEBB".to_vec().try_into().unwrap(), - native_existential_deposit: webb_runtime::constants::currency::EXISTENTIAL_DEPOSIT, - }, - tokens: webb_runtime::TokensConfig { - balances: unique.iter().cloned().map(|k| (k, 1, ENDOWMENT)).collect(), + babe: BabeConfig { + authorities: vec![], + epoch_config: Some(webb_runtime::BABE_GENESIS_EPOCH_CONFIG), }, + indices: IndicesConfig { indices: vec![] }, balances: webb_runtime::BalancesConfig { balances: unique.iter().cloned().map(|k| (k, ENDOWMENT)).collect(), }, - indices: IndicesConfig { indices: vec![] }, + staking: StakingConfig { + validator_count: initial_authorities.len() as u32, + minimum_validator_count: initial_authorities.len() as u32, + invulnerables: initial_authorities.iter().map(|x| x.0.clone()).collect(), + slash_reward_fraction: Perbill::from_percent(10), + stakers: initial_authorities + .iter() + .map(|x| (x.0.clone(), x.1.clone(), STASH, StakerStatus::Validator)) + .collect(), + ..Default::default() + }, session: SessionConfig { keys: initial_authorities .iter() @@ -279,18 +365,8 @@ fn testnet_genesis( }) .collect::>(), }, - staking: StakingConfig { - validator_count: initial_authorities.len() as u32, - minimum_validator_count: initial_authorities.len() as u32, - invulnerables: initial_authorities.iter().map(|x| x.0.clone()).collect(), - slash_reward_fraction: Perbill::from_percent(10), - stakers: initial_authorities - .iter() - .map(|x| (x.0.clone(), x.1.clone(), STASH, StakerStatus::Validator)) - .collect(), - ..Default::default() - }, democracy: DemocracyConfig::default(), + council: CouncilConfig::default(), elections: ElectionsConfig { members: endowed_accounts .iter() @@ -299,31 +375,28 @@ fn testnet_genesis( .map(|member| (member, STASH)) .collect(), }, - council: CouncilConfig::default(), + grandpa: GrandpaConfig { authorities: vec![] }, + treasury: Default::default(), sudo: SudoConfig { key: Some(root_key) }, - babe: BabeConfig { - authorities: vec![], - epoch_config: Some(webb_runtime::BABE_GENESIS_EPOCH_CONFIG), - }, im_online: ImOnlineConfig { keys: vec![] }, authority_discovery: AuthorityDiscoveryConfig { keys: vec![] }, - grandpa: GrandpaConfig { authorities: vec![] }, - treasury: Default::default(), hasher_bn_254: HasherBn254Config { parameters: Some(bn254_x5_3_params.to_bytes().try_into().unwrap()), phantom: Default::default(), }, + asset_registry: AssetRegistryConfig { + asset_names: vec![(b"TEST".to_vec().try_into().unwrap(), 1)], + native_asset_name: b"WEBB".to_vec().try_into().unwrap(), + native_existential_deposit: webb_runtime::constants::currency::EXISTENTIAL_DEPOSIT, + }, + tokens: webb_runtime::TokensConfig { + balances: unique.iter().cloned().map(|k| (k, 1, ENDOWMENT)).collect(), + }, mixer_verifier_bn_254: MixerVerifierBn254Config { parameters: Some(mixer_verifier_bn254_params.try_into().unwrap()), phantom: Default::default(), }, - v_anchor_verifier: VAnchorVerifierConfig { - parameters: Some(vec![ - (2, 2, vanchor_verifier_2_2_bn254_params.try_into().unwrap()), - (2, 16, vanchor_verifier_2_16_bn254_params.try_into().unwrap()), - ]), - phantom: Default::default(), - }, + v_anchor_verifier: v_anchor_verifier_config, merkle_tree_bn_254: MerkleTreeBn254Config { phantom: Default::default(), default_hashes: None, diff --git a/standalone/runtime/Cargo.toml b/standalone/runtime/Cargo.toml index 05d119553..ceeb01dc6 100644 --- a/standalone/runtime/Cargo.toml +++ b/standalone/runtime/Cargo.toml @@ -108,7 +108,7 @@ pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/parityt pallet-utility = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false } [features] -default = ["std"] +default = ["std", "circom-backend"] runtime-benchmarks = [ "hex-literal", "sp-runtime/runtime-benchmarks", @@ -212,3 +212,6 @@ std = [ "orml-currencies/std", "webb-primitives/std", ] + +arkworks-backend = [] +circom-backend = [] diff --git a/standalone/runtime/src/lib.rs b/standalone/runtime/src/lib.rs index 65ee43f39..0a4db35ba 100644 --- a/standalone/runtime/src/lib.rs +++ b/standalone/runtime/src/lib.rs @@ -99,7 +99,7 @@ use webb_primitives::{ linkable_tree::LinkableTreeInspector, merkle_tree::TreeInspector, signing::SignatureVerifier, - verifying::ArkworksVerifierBn254, + verifying::{ArkworksVerifierBn254, CircomVerifierBn254}, Amount, ChainId, LeafIndex, }; @@ -1156,23 +1156,26 @@ impl pallet_mt::Config for Runtime { type Two = Two; type WeightInfo = pallet_mt::weights::WebbWeight; } -parameter_types! { - pub const MaxParameterLength : u32 = 1000; -} impl pallet_verifier::Config for Runtime { type RuntimeEvent = RuntimeEvent; type ForceOrigin = frame_system::EnsureRoot; type Verifier = ArkworksVerifierBn254; - type MaxParameterLength = MaxParameterLength; + type MaxParameterLength = ConstU32<1000>; type WeightInfo = pallet_verifier::weights::WebbWeight; } impl pallet_vanchor_verifier::Config for Runtime { type RuntimeEvent = RuntimeEvent; type ForceOrigin = frame_system::EnsureRoot; + #[cfg(feature = "arkworks-backend")] type Verifier = ArkworksVerifierBn254; - type MaxParameterLength = MaxParameterLength; + #[cfg(feature = "arkworks-backend")] + type MaxParameterLength = ConstU32<1000>; + #[cfg(feature = "circom-backend")] + type Verifier = CircomVerifierBn254; + #[cfg(feature = "circom-backend")] + type MaxParameterLength = ConstU32<2000>; type WeightInfo = pallet_vanchor_verifier::weights::WebbWeight; } diff --git a/substrate-fixtures b/substrate-fixtures deleted file mode 160000 index 2ee2d9448..000000000 --- a/substrate-fixtures +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 2ee2d9448af09772aedefd22972d4230f7fdc14f diff --git a/substrate-fixtures.dvc b/substrate-fixtures.dvc new file mode 100644 index 000000000..72bb90603 --- /dev/null +++ b/substrate-fixtures.dvc @@ -0,0 +1,12 @@ +md5: 556aaf5231aabec2aca01802ccba23d6 +frozen: true +deps: +- path: substrate-fixtures + repo: + url: https://github.com/webb-tools/substrate-fixtures + rev_lock: 2ee2d9448af09772aedefd22972d4230f7fdc14f +outs: +- md5: 9c00cd97c42bef50fcfdb4b8878be0fb.dir + size: 240092288 + nfiles: 35 + path: substrate-fixtures