diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 725c1125..bf663a96 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -9,9 +9,6 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref_protected == 'true' && github.sha || github.ref }} cancel-in-progress: true -env: - MINIMUM_RUST_VERSION: 1.80.0 - jobs: complete: @@ -81,8 +78,11 @@ jobs: - name: Use the minimum supported Rust version if: matrix.rust == 'msrv' run: | - rustup override set $MINIMUM_RUST_VERSION - rustup component add clippy --toolchain $MINIMUM_RUST_VERSION + if [ -f "Cargo.toml" ]; then + msrv="$(cargo metadata --format-version 1 --no-deps | jq -r '.packages | map(.rust_version) | map(values) | min')" + rustup override set $msrv + rustup component add clippy --toolchain $msrv + fi - name: Error on warnings and clippy checks # Only error on warnings and checks for the msrv, because new versions of # Rust will frequently add new warnings and checks. @@ -99,7 +99,7 @@ jobs: deno-version: v2.x # Setup Stellar CLI - - uses: stellar/stellar-cli@v22.5.0 + - uses: stellar/stellar-cli@v22.8.0 # Build and Test - run: make test diff --git a/account/Cargo.toml b/account/Cargo.toml index 838efe60..8a86eb07 100644 --- a/account/Cargo.toml +++ b/account/Cargo.toml @@ -3,6 +3,7 @@ name = "soroban-account-contract" version = "0.0.0" edition = "2021" publish = false +rust-version = "1.80.0" [lib] crate-type = ["cdylib"] diff --git a/alloc/Cargo.toml b/alloc/Cargo.toml index f8894509..a2c7b44e 100644 --- a/alloc/Cargo.toml +++ b/alloc/Cargo.toml @@ -3,6 +3,7 @@ name = "soroban-alloc-contract" version = "0.0.0" edition = "2021" publish = false +rust-version = "1.80.0" [lib] crate-type = ["cdylib"] diff --git a/atomic_multiswap/Cargo.toml b/atomic_multiswap/Cargo.toml index e8bb8115..18067b44 100644 --- a/atomic_multiswap/Cargo.toml +++ b/atomic_multiswap/Cargo.toml @@ -3,6 +3,7 @@ name = "soroban-atomic-multiswap-contract" version = "0.0.0" edition = "2021" publish = false +rust-version = "1.80.0" [lib] crate-type = ["cdylib"] diff --git a/atomic_swap/Cargo.toml b/atomic_swap/Cargo.toml index a63bcea2..4c44174f 100644 --- a/atomic_swap/Cargo.toml +++ b/atomic_swap/Cargo.toml @@ -3,6 +3,7 @@ name = "soroban-atomic-swap-contract" version = "0.0.0" edition = "2021" publish = false +rust-version = "1.80.0" [lib] crate-type = ["cdylib"] diff --git a/auth/Cargo.toml b/auth/Cargo.toml index 3414c0eb..d3bac046 100644 --- a/auth/Cargo.toml +++ b/auth/Cargo.toml @@ -3,6 +3,7 @@ name = "soroban-auth-contract" version = "0.0.0" edition = "2021" publish = false +rust-version = "1.80.0" [lib] crate-type = ["cdylib"] diff --git a/bls_signature/Cargo.toml b/bls_signature/Cargo.toml index 2f2fbf36..7d76ebf6 100644 --- a/bls_signature/Cargo.toml +++ b/bls_signature/Cargo.toml @@ -3,6 +3,7 @@ name = "soroban-bls-signature" version = "0.0.0" edition = "2021" publish = false +rust-version = "1.80.0" description = """ WARNING: DO NOT USE THIS LIBRARY IN PRODUCTION OR FOR SECURE APPLICATIONS! diff --git a/bls_signature/src/test.rs b/bls_signature/src/test.rs index ec13465c..c1a9063b 100644 --- a/bls_signature/src/test.rs +++ b/bls_signature/src/test.rs @@ -103,7 +103,6 @@ fn create_client(e: &Env) -> IncrementContractClient { #[test] fn test() { let env = Env::default(); - env.cost_estimate().budget().reset_unlimited(); let pk = aggregate_pk_bytes(&env); env.mock_all_auths(); @@ -112,7 +111,6 @@ fn test() { let payload = BytesN::random(&env); let sig_val = sign_and_aggregate(&env, &payload.clone().into()).to_val(); - env.cost_estimate().budget().reset_default(); env.try_invoke_contract_check_auth::(&client.address, &payload, sig_val, &vec![&env]) .unwrap(); env.cost_estimate().budget().print(); diff --git a/cross_contract/contract_a/Cargo.toml b/cross_contract/contract_a/Cargo.toml index 07416992..657e2669 100644 --- a/cross_contract/contract_a/Cargo.toml +++ b/cross_contract/contract_a/Cargo.toml @@ -3,6 +3,7 @@ name = "soroban-cross-contract-a-contract" version = "0.0.0" edition = "2021" publish = false +rust-version = "1.80.0" [lib] crate-type = ["cdylib"] diff --git a/cross_contract/contract_b/Cargo.toml b/cross_contract/contract_b/Cargo.toml index db1f8008..48d17253 100644 --- a/cross_contract/contract_b/Cargo.toml +++ b/cross_contract/contract_b/Cargo.toml @@ -3,6 +3,7 @@ name = "soroban-cross-contract-b-contract" version = "0.0.0" edition = "2021" publish = false +rust-version = "1.80.0" [lib] crate-type = ["cdylib"] diff --git a/custom_types/Cargo.toml b/custom_types/Cargo.toml index 1be32c52..76c43c8e 100644 --- a/custom_types/Cargo.toml +++ b/custom_types/Cargo.toml @@ -3,6 +3,7 @@ name = "soroban-custom-types-contract" version = "0.0.0" edition = "2021" publish = false +rust-version = "1.80.0" [lib] crate-type = ["cdylib"] diff --git a/deep_contract_auth/Cargo.toml b/deep_contract_auth/Cargo.toml index a1974ae0..320b13e4 100644 --- a/deep_contract_auth/Cargo.toml +++ b/deep_contract_auth/Cargo.toml @@ -3,6 +3,7 @@ name = "soroban-deployer-contract" version = "0.0.0" edition = "2021" publish = false +rust-version = "1.80.0" [lib] crate-type = ["cdylib"] diff --git a/deployer/contract/Cargo.toml b/deployer/contract/Cargo.toml index a3bce78d..f2f5e183 100644 --- a/deployer/contract/Cargo.toml +++ b/deployer/contract/Cargo.toml @@ -3,6 +3,7 @@ name = "soroban-deployer-test-contract" version = "0.0.0" edition = "2021" publish = false +rust-version = "1.80.0" [lib] crate-type = ["cdylib"] diff --git a/deployer/deployer/Cargo.toml b/deployer/deployer/Cargo.toml index a1974ae0..320b13e4 100644 --- a/deployer/deployer/Cargo.toml +++ b/deployer/deployer/Cargo.toml @@ -3,6 +3,7 @@ name = "soroban-deployer-contract" version = "0.0.0" edition = "2021" publish = false +rust-version = "1.80.0" [lib] crate-type = ["cdylib"] diff --git a/errors/Cargo.toml b/errors/Cargo.toml index e07a57c2..82b372d8 100644 --- a/errors/Cargo.toml +++ b/errors/Cargo.toml @@ -3,6 +3,7 @@ name = "soroban-errors-contract" version = "0.0.0" edition = "2021" publish = false +rust-version = "1.80.0" [lib] crate-type = ["cdylib"] diff --git a/eth_abi/Cargo.toml b/eth_abi/Cargo.toml index df74d1f1..05fa4bbe 100644 --- a/eth_abi/Cargo.toml +++ b/eth_abi/Cargo.toml @@ -3,6 +3,7 @@ name = "soroban-eth-abi" version = "0.1.0" edition = "2021" publish = false +rust-version = "1.80.0" [lib] crate-type = ["cdylib"] diff --git a/events/Cargo.toml b/events/Cargo.toml index fab42480..b2f6f7c5 100644 --- a/events/Cargo.toml +++ b/events/Cargo.toml @@ -3,6 +3,7 @@ name = "soroban-events-contract" version = "0.0.0" edition = "2021" publish = false +rust-version = "1.80.0" [lib] crate-type = ["cdylib"] diff --git a/fuzzing/Cargo.toml b/fuzzing/Cargo.toml index ee88db4d..a6a86c00 100644 --- a/fuzzing/Cargo.toml +++ b/fuzzing/Cargo.toml @@ -3,6 +3,7 @@ name = "soroban-fuzzing-contract" version = "0.0.0" edition = "2021" publish = false +rust-version = "1.80.0" [lib] crate-type = ["cdylib", "rlib"] diff --git a/groth16_verifier/Cargo.lock b/groth16_verifier/Cargo.lock new file mode 100644 index 00000000..817569a2 --- /dev/null +++ b/groth16_verifier/Cargo.lock @@ -0,0 +1,1622 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + +[[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 = "arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" +dependencies = [ + "derive_arbitrary", +] + +[[package]] +name = "ark-bls12-381" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c775f0d12169cba7aae4caeb547bb6a50781c7449a8aa53793827c9ec4abf488" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-serialize", + "ark-std", +] + +[[package]] +name = "ark-ec" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba" +dependencies = [ + "ark-ff", + "ark-poly", + "ark-serialize", + "ark-std", + "derivative", + "hashbrown 0.13.2", + "itertools", + "num-traits", + "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", + "ark-ff-macros", + "ark-serialize", + "ark-std", + "derivative", + "digest", + "itertools", + "num-bigint", + "num-traits", + "paste", + "rustc_version", + "zeroize", +] + +[[package]] +name = "ark-ff-asm" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-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-poly" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" +dependencies = [ + "ark-ff", + "ark-serialize", + "ark-std", + "derivative", + "hashbrown 0.13.2", +] + +[[package]] +name = "ark-serialize" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" +dependencies = [ + "ark-serialize-derive", + "ark-std", + "digest", + "num-bigint", +] + +[[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-std" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" +dependencies = [ + "num-traits", + "rand", +] + +[[package]] +name = "autocfg" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bumpalo" +version = "3.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes-lit" +version = "0.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0adabf37211a5276e46335feabcbb1530c95eb3fdf85f324c7db942770aa025d" +dependencies = [ + "num-bigint", + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "cc" +version = "1.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9157bbaa6b165880c27a4293a474c91cdcf265cc68cc829bf10be0964a391caf" +dependencies = [ + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chrono" +version = "0.4.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "num-traits", + "serde", + "windows-targets", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpufeatures" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16b80225097f2e5ae4e7179dd2266824648f3e2f49d9134d584b76389d31c4c3" +dependencies = [ + "libc", +] + +[[package]] +name = "crate-git-revision" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c521bf1f43d31ed2f73441775ed31935d77901cb3451e44b38a1c1612fcbaf98" +dependencies = [ + "serde", + "serde_derive", + "serde_json", +] + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "ctor" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a2785755761f3ddc1492979ce1e48d2c00d09311c39e4466429188f3dd6501" +dependencies = [ + "quote", + "syn 2.0.90", +] + +[[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", + "digest", + "fiat-crypto", + "rustc_version", + "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.90", +] + +[[package]] +name = "darling" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.90", +] + +[[package]] +name = "darling_macro" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "data-encoding" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", + "serde", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "derive_arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "const-oid", + "crypto-common", + "subtle", +] + +[[package]] +name = "downcast-rs" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" + +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871" +dependencies = [ + "curve25519-dalek", + "ed25519", + "rand_core", + "serde", + "sha2", + "subtle", + "zeroize", +] + +[[package]] +name = "either" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" + +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "escape-bytes" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bfcf67fea2815c2fc3b90873fae90957be12ff417335dfadc7f52927feb03b2" + +[[package]] +name = "ethnum" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b90ca2580b73ab6a1f724b76ca11ab632df820fd6040c336200d2c1df7b3c82c" + +[[package]] +name = "ff" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +dependencies = [ + "rand_core", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] + +[[package]] +name = "hashbrown" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +dependencies = [ + "serde", +] + +[[package]] +name = "hex-literal" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[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 = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" +dependencies = [ + "equivalent", + "hashbrown 0.15.2", + "serde", +] + +[[package]] +name = "indexmap-nostd" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e04e2fd2b8188ea827b32ef11de88377086d690286ab35747ef7f9bf3ccb590" + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" + +[[package]] +name = "js-sys" +version = "0.3.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "k256" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "sha2", +] + +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "libc" +version = "0.2.168" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d" + +[[package]] +name = "libm" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa" + +[[package]] +name = "log" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" + +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "ecdsa", + "elliptic-curve", + "primeorder", + "sha2", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppv-lite86" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "prettyplease" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033" +dependencies = [ + "proc-macro2", + "syn 2.0.90", +] + +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + +[[package]] +name = "proc-macro2" +version = "1.0.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "subtle", + "zeroize", +] + +[[package]] +name = "semver" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cb6eb87a131f756572d7fb904f6e7b68633f09cca868c5df1c4b8d1a694bbba" + +[[package]] +name = "serde" +version = "1.0.216" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.216" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "serde_json" +version = "1.0.133" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "serde_with" +version = "3.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e28bdad6db2b8340e449f7108f020b3b092e8583a9e3fb82713e1d4e71fe817" +dependencies = [ + "base64 0.22.1", + "chrono", + "hex", + "indexmap 1.9.3", + "indexmap 2.7.0", + "serde", + "serde_derive", + "serde_json", + "serde_with_macros", + "time", +] + +[[package]] +name = "serde_with_macros" +version = "3.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d846214a9854ef724f3da161b426242d8de7c1fc7de2f89bb1efcb154dca79d" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest", + "keccak", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core", +] + +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + +[[package]] +name = "soroban-builtin-sdk-macros" +version = "22.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf2e42bf80fcdefb3aae6ff3c7101a62cf942e95320ed5b518a1705bc11c6b2f" +dependencies = [ + "itertools", + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "soroban-env-common" +version = "22.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "027cd856171bfd6ad2c0ffb3b7dfe55ad7080fb3050c36ad20970f80da634472" +dependencies = [ + "arbitrary", + "crate-git-revision", + "ethnum", + "num-derive", + "num-traits", + "serde", + "soroban-env-macros", + "soroban-wasmi", + "static_assertions", + "stellar-xdr", + "wasmparser", +] + +[[package]] +name = "soroban-env-guest" +version = "22.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a07dda1ae5220d975979b19ad4fd56bc86ec7ec1b4b25bc1c5d403f934e592e" +dependencies = [ + "soroban-env-common", + "static_assertions", +] + +[[package]] +name = "soroban-env-host" +version = "22.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66e8b03a4191d485eab03f066336112b2a50541a7553179553dc838b986b94dd" +dependencies = [ + "ark-bls12-381", + "ark-ec", + "ark-ff", + "ark-serialize", + "curve25519-dalek", + "ecdsa", + "ed25519-dalek", + "elliptic-curve", + "generic-array", + "getrandom", + "hex-literal", + "hmac", + "k256", + "num-derive", + "num-integer", + "num-traits", + "p256", + "rand", + "rand_chacha", + "sec1", + "sha2", + "sha3", + "soroban-builtin-sdk-macros", + "soroban-env-common", + "soroban-wasmi", + "static_assertions", + "stellar-strkey", + "wasmparser", +] + +[[package]] +name = "soroban-env-macros" +version = "22.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00eff744764ade3bc480e4909e3a581a240091f3d262acdce80b41f7069b2bd9" +dependencies = [ + "itertools", + "proc-macro2", + "quote", + "serde", + "serde_json", + "stellar-xdr", + "syn 2.0.90", +] + +[[package]] +name = "soroban-groth16-verifier-contract" +version = "0.0.0" +dependencies = [ + "ark-bls12-381", + "ark-ec", + "ark-ff", + "ark-serialize", + "soroban-sdk", +] + +[[package]] +name = "soroban-ledger-snapshot" +version = "22.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2826e2c9d364edbb2ea112dc861077c74557bdad0a7a00487969088c7c648169" +dependencies = [ + "serde", + "serde_json", + "serde_with", + "soroban-env-common", + "soroban-env-host", + "thiserror", +] + +[[package]] +name = "soroban-sdk" +version = "22.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7ac27d7573e62b745513fa1be8dab7a09b9676a7f39db97164f1d458a344749" +dependencies = [ + "arbitrary", + "bytes-lit", + "ctor", + "derive_arbitrary", + "ed25519-dalek", + "rand", + "rustc_version", + "serde", + "serde_json", + "soroban-env-guest", + "soroban-env-host", + "soroban-ledger-snapshot", + "soroban-sdk-macros", + "stellar-strkey", +] + +[[package]] +name = "soroban-sdk-macros" +version = "22.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ef0d7d62b2584696d306b8766728971c7d0731a03a5e047f1fc68722ac8cf0c" +dependencies = [ + "crate-git-revision", + "darling", + "itertools", + "proc-macro2", + "quote", + "rustc_version", + "sha2", + "soroban-env-common", + "soroban-spec", + "soroban-spec-rust", + "stellar-xdr", + "syn 2.0.90", +] + +[[package]] +name = "soroban-spec" +version = "22.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4ad0867aec99770ed614fedbec7ac4591791df162ff9e548ab7ebd07cd23a9c" +dependencies = [ + "base64 0.13.1", + "stellar-xdr", + "thiserror", + "wasmparser", +] + +[[package]] +name = "soroban-spec-rust" +version = "22.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aebe31c042adfa2885ec47b67b08fcead8707da80a3fe737eaf2a9ae1a8cfdc3" +dependencies = [ + "prettyplease", + "proc-macro2", + "quote", + "sha2", + "soroban-spec", + "stellar-xdr", + "syn 2.0.90", + "thiserror", +] + +[[package]] +name = "soroban-wasmi" +version = "0.31.1-soroban.20.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "710403de32d0e0c35375518cb995d4fc056d0d48966f2e56ea471b8cb8fc9719" +dependencies = [ + "smallvec", + "spin", + "wasmi_arena", + "wasmi_core", + "wasmparser-nostd", +] + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "stellar-strkey" +version = "0.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e3aa3ed00e70082cb43febc1c2afa5056b9bb3e348bbb43d0cd0aa88a611144" +dependencies = [ + "crate-git-revision", + "data-encoding", + "thiserror", +] + +[[package]] +name = "stellar-xdr" +version = "22.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ce69db907e64d1e70a3dce8d4824655d154749426a6132b25395c49136013e4" +dependencies = [ + "arbitrary", + "base64 0.13.1", + "crate-git-revision", + "escape-bytes", + "hex", + "serde", + "serde_with", + "stellar-strkey", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.90" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "time" +version = "0.3.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35e7868883861bd0e56d9ac6efcaaca0d6d5d82a2a7ec8209ff492c07cf37b21" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2834e6017e3e5e4b9834939793b282bc03b37a3336245fa820e35e233e2a85de" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "unicode-ident" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.99" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396" +dependencies = [ + "cfg-if", + "once_cell", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.99" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79" +dependencies = [ + "bumpalo", + "log", + "proc-macro2", + "quote", + "syn 2.0.90", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.99" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.99" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.99" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" + +[[package]] +name = "wasmi_arena" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "104a7f73be44570cac297b3035d76b169d6599637631cf37a1703326a0727073" + +[[package]] +name = "wasmi_core" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf1a7db34bff95b85c261002720c00c3a6168256dcb93041d3fa2054d19856a" +dependencies = [ + "downcast-rs", + "libm", + "num-traits", + "paste", +] + +[[package]] +name = "wasmparser" +version = "0.116.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a58e28b80dd8340cb07b8242ae654756161f6fc8d0038123d679b7b99964fa50" +dependencies = [ + "indexmap 2.7.0", + "semver", +] + +[[package]] +name = "wasmparser-nostd" +version = "0.100.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5a015fe95f3504a94bb1462c717aae75253e39b9dd6c3fb1062c934535c64aa" +dependencies = [ + "indexmap-nostd", +] + +[[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-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "byteorder", + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] diff --git a/groth16_verifier/Cargo.toml b/groth16_verifier/Cargo.toml new file mode 100644 index 00000000..1aa5ac02 --- /dev/null +++ b/groth16_verifier/Cargo.toml @@ -0,0 +1,34 @@ +[package] +name = "soroban-groth16-verifier-contract" +version = "0.0.0" +edition = "2021" +publish = false +rust-version = "1.84.0" + +[lib] +crate-type = ["cdylib"] +doctest = false + +[dependencies] +soroban-sdk = { version = "22.0.8" } + +[dev-dependencies] +soroban-sdk = { version = "22.0.8", features = ["testutils"] } +ark-bls12-381 = { version = "0.4.0"} +ark-serialize = { version = "0.4.2"} +ark-ff = { version = "0.4.2"} +ark-ec = { version = "0.4.2"} + +[profile.release] +opt-level = "z" +overflow-checks = true +debug = 0 +strip = "symbols" +debug-assertions = false +panic = "abort" +codegen-units = 1 +lto = true + +[profile.release-with-logs] +inherits = "release" +debug-assertions = true diff --git a/groth16_verifier/Makefile b/groth16_verifier/Makefile new file mode 100644 index 00000000..b9719346 --- /dev/null +++ b/groth16_verifier/Makefile @@ -0,0 +1,16 @@ +default: build + +all: test + +test: build + cargo test + +build: + stellar contract build + @ls -l target/wasm32v1-none/release/*.wasm + +fmt: + cargo fmt --all + +clean: + cargo clean diff --git a/groth16_verifier/README b/groth16_verifier/README new file mode 100644 index 00000000..bef4649f --- /dev/null +++ b/groth16_verifier/README @@ -0,0 +1,28 @@ +# Groth16 Verifier Contract + +A demonstration of a Groth16 zero-knowledge proof verifier implemented as a Soroban smart contract. + +The proof and verification key are generated following the Circom2 (circom compiler 2.2.1) [getting-started guide](https://docs.circom.io/getting-started/installation/). + +The computation demonstrates a simple multiplication circuit: `a * b = c`, where: +- `a` and `b` are private inputs +- `c` is the public output + +The `./data` directory contains all input files (circuit definition, inputs) and generated outputs. For proof verification, three key files are required: +- [proof.json](./data/proof.json) - Contains the zero-knowledge proof +- [verification_key.json](./data/verification_key.json) - Contains the verification key +- [public.json](./data/public.json) - Contains the public inputs/outputs + +Other intermediate artifacts, including witness generation code and outputs from the "Powers of Tau" ceremony, are included in `./data/auxiliary` for reproducibility. + +The [contract implementation](./src/lib.rs) is translated from the auto-generated [Solidity contract](./data/multiplier2_js/verifier.sol). The [test suite](./src/test.rs) demonstrates off-chain parsing of the proof and verification key, along with successful contract execution. + +This example was presented at the [Stellar Developer Meeting - 12/19/2024](https://www.youtube.com/watch?v=51SitOUZySk&list=PLmr3tp_7-7Gg5IAsJ0VlgfMoh-aTmbQmh&index=4) to demonstrate the BLS12-381 features. + +## ⚠️ WARNING: Demonstration Use Only + +**This project is for demonstration purposes only.** +- It has **not** undergone security auditing +- It is **not** safe for use in production environments + +**Use at your own risk.** \ No newline at end of file diff --git a/groth16_verifier/data/auxiliary/input.json b/groth16_verifier/data/auxiliary/input.json new file mode 100644 index 00000000..c7e0fc65 --- /dev/null +++ b/groth16_verifier/data/auxiliary/input.json @@ -0,0 +1 @@ +{"a": 3, "b": 11} diff --git a/groth16_verifier/data/auxiliary/multiplier2.circom b/groth16_verifier/data/auxiliary/multiplier2.circom new file mode 100644 index 00000000..080377d0 --- /dev/null +++ b/groth16_verifier/data/auxiliary/multiplier2.circom @@ -0,0 +1,16 @@ +pragma circom 2.0.0; + +/*This circuit template checks that c is the multiplication of a and b.*/ + +template Multiplier2 () { + + // Declaration of signals. + signal input a; + signal input b; + signal output c; + + // Constraints. + c <== a * b; +} + +component main = Multiplier2(); diff --git a/groth16_verifier/data/auxiliary/multiplier2_0000.zkey b/groth16_verifier/data/auxiliary/multiplier2_0000.zkey new file mode 100644 index 00000000..7d9b5b09 Binary files /dev/null and b/groth16_verifier/data/auxiliary/multiplier2_0000.zkey differ diff --git a/groth16_verifier/data/auxiliary/multiplier2_0001.zkey b/groth16_verifier/data/auxiliary/multiplier2_0001.zkey new file mode 100644 index 00000000..2be0729a Binary files /dev/null and b/groth16_verifier/data/auxiliary/multiplier2_0001.zkey differ diff --git a/groth16_verifier/data/auxiliary/pot12_0000.ptau b/groth16_verifier/data/auxiliary/pot12_0000.ptau new file mode 100644 index 00000000..a7bd6041 Binary files /dev/null and b/groth16_verifier/data/auxiliary/pot12_0000.ptau differ diff --git a/groth16_verifier/data/auxiliary/pot12_0001.ptau b/groth16_verifier/data/auxiliary/pot12_0001.ptau new file mode 100644 index 00000000..262ae1b4 Binary files /dev/null and b/groth16_verifier/data/auxiliary/pot12_0001.ptau differ diff --git a/groth16_verifier/data/auxiliary/pot12_final.ptau b/groth16_verifier/data/auxiliary/pot12_final.ptau new file mode 100644 index 00000000..5b6df58d Binary files /dev/null and b/groth16_verifier/data/auxiliary/pot12_final.ptau differ diff --git a/groth16_verifier/data/auxiliary/witness.wtns b/groth16_verifier/data/auxiliary/witness.wtns new file mode 100644 index 00000000..4b6d58cf Binary files /dev/null and b/groth16_verifier/data/auxiliary/witness.wtns differ diff --git a/groth16_verifier/data/proof.json b/groth16_verifier/data/proof.json new file mode 100644 index 00000000..2f5f720b --- /dev/null +++ b/groth16_verifier/data/proof.json @@ -0,0 +1,28 @@ +{ + "pi_a": [ + "314442236668110257304682488877371582255161413673331360366570443799415414639292047869143313601702131653514009114222", + "2384632327855835824635705027009217874826122107057894594162233214798350178691568018290025994699762298534539543934607", + "1" + ], + "pi_b": [ + [ + "428844167033934720609657613212495751617651348480870890908850335525890280786532876634895457032623422366474694342656", + "3083139526360252775789959298805261067575555607578161553873977966165446991459924053189383038704105379290158793353905" + ], + [ + "1590919422794657666432683000821892403620510405626533455397042191265963587891653562867091397248216891852168698286910", + "3617931039814164588401589536353142503544155307022467123698224064329647390280346725086550997337076315487486714327146" + ], + [ + "1", + "0" + ] + ], + "pi_c": [ + "3052934797502613468327963344215392478880720823583493172692775426011388142569325036386650708808320216973179639719187", + "2028185281516938724429867827057869371578022471499780916652824405212207527699373814371051328341613972789943854539597", + "1" + ], + "protocol": "groth16", + "curve": "bls12381" +} \ No newline at end of file diff --git a/groth16_verifier/data/public.json b/groth16_verifier/data/public.json new file mode 100644 index 00000000..bf203097 --- /dev/null +++ b/groth16_verifier/data/public.json @@ -0,0 +1,3 @@ +[ + "33" +] \ No newline at end of file diff --git a/groth16_verifier/data/verification_key.json b/groth16_verifier/data/verification_key.json new file mode 100644 index 00000000..e778e4cc --- /dev/null +++ b/groth16_verifier/data/verification_key.json @@ -0,0 +1,94 @@ +{ + "protocol": "groth16", + "curve": "bls12381", + "nPublic": 1, + "vk_alpha_1": [ + "851850525556173310373115880154698084608631105506432893865500290442025919078535925294035153152030470398262539759609", + "2637289349983507610125993281171282870664683328789064436670091381805667870657250691837988574635646688089951719927247", + "1" + ], + "vk_beta_2": [ + [ + "1312620381151154625549413690218290437739613987001512553647554932245743783919690104921577716179019375920325686841943", + "1853421227732662200477195678252233549930451033531229987959164216695698667330234953033341200627605777603511819497457" + ], + [ + "3215807833988244618006117550809420301978856703407297742347804415291049013404133666905173282837707341742014140541018", + "812366606879346135498483310623227330050424196838294715759414425317592599094348477520229174120664109186562798527696" + ], + [ + "1", + "0" + ] + ], + "vk_gamma_2": [ + [ + "352701069587466618187139116011060144890029952792775240219908644239793785735715026873347600343865175952761926303160", + "3059144344244213709971259814753781636986470325476647558659373206291635324768958432433509563104347017837885763365758" + ], + [ + "1985150602287291935568054521177171638300868978215655730859378665066344726373823718423869104263333984641494340347905", + "927553665492332455747201965776037880757740193453592970025027978793976877002675564980949289727957565575433344219582" + ], + [ + "1", + "0" + ] + ], + "vk_delta_2": [ + [ + "2981843938988033214458466658185878126396080429969635248100956025957789319926032198626745120548947333202362392267114", + "2236695112259305382987038341098587500598216646308901956168137697892380899086228863246537938263638056666003066263342" + ], + [ + "717163810166643254871951856655865822196000925757284470845197358532703820821048809982340614428800986999944933231635", + "3496058064578305387608803828034117220735807855182872031001942587835768203820179263722136810383631418598310938506798" + ], + [ + "1", + "0" + ] + ], + "vk_alphabeta_12": [ + [ + [ + "986314345434602723285761114714540815165948174207594366788880385445737871991742175366408675245262651703330249336130", + "326977788325290192027797763473385602198956814735567144445960526834466398305728141416506007314903111972816830478089" + ], + [ + "2566972005765663057117355569821288484662616312199992221569222108527565285637706226450975712288567676826211052009828", + "3699434258626382601224687161724795332821272399478014444888824853489335102533827344776496756934365201558496458450771" + ], + [ + "2791301291086490268194308427815002039220388356530337362551865917357667624852630484089067561323027336067266533847617", + "2525898105055075876710827163715065053410720193292753626174136502545194475866793819259204836400779184493881266645914" + ] + ], + [ + [ + "480299570814332158054387851962628719327276307648582608402834899543072822075592318735491209978693496772033004010886", + "2621205732128367220198749961294220375809850215113980318702173439822645663565392552757606784904531795766602126547186" + ], + [ + "595095377653192119804154024995457838213848090311176688409443538615730480845851619856290554780504041637921591536463", + "3453759709483545713747202263396993637467503312851899108221558283493344243439629223186561135905026261100343232562575" + ], + [ + "2939220041151334342625680543852621747013170638890028810335805818305055266895856524675501328053529188293569824477394", + "1312330610224137073804595761443475470236611771864535096449446987267281424279024152773977719507281348207744015092239" + ] + ] + ], + "IC": [ + [ + "829685638389803071404995253486571779300247099942205634643821309129201420207693030476756893332812706176564514055395", + "3455508165409829148751617737772894557887792278044850553785496869183933597103951941805834639972489587640583544390358", + "1" + ], + [ + "2645559270376031734407122278942646687260452979296081924477586893972449945444985371392950465676350735694002713633589", + "2241039659097418315097403108596818813895651201896886552939297756980670248638746432560267634304593609165964274111037", + "1" + ] + ] +} \ No newline at end of file diff --git a/groth16_verifier/rust-toolchain.toml b/groth16_verifier/rust-toolchain.toml new file mode 100644 index 00000000..3ee8d11a --- /dev/null +++ b/groth16_verifier/rust-toolchain.toml @@ -0,0 +1,4 @@ +[toolchain] +channel = "1.84.0" +targets = ["wasm32v1-none"] +components = ["rustc", "cargo", "rustfmt", "clippy", "rust-src"] \ No newline at end of file diff --git a/groth16_verifier/src/lib.rs b/groth16_verifier/src/lib.rs new file mode 100644 index 00000000..80697e68 --- /dev/null +++ b/groth16_verifier/src/lib.rs @@ -0,0 +1,67 @@ +#![no_std] +use soroban_sdk::{ + contract, contracterror, contractimpl, contracttype, + crypto::bls12_381::{Fr, G1Affine, G2Affine}, + vec, Env, Vec, +}; + +#[contracterror] +#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord)] +#[repr(u32)] +pub enum Groth16Error { + MalformedVerifyingKey = 0, +} + +#[derive(Clone)] +#[contracttype] +pub struct VerificationKey { + pub alpha: G1Affine, + pub beta: G2Affine, + pub gamma: G2Affine, + pub delta: G2Affine, + pub ic: Vec, +} + +#[derive(Clone)] +#[contracttype] +pub struct Proof { + pub a: G1Affine, + pub b: G2Affine, + pub c: G1Affine, +} + +#[contract] +pub struct Groth16Verifier; + +#[contractimpl] +impl Groth16Verifier { + pub fn verify_proof( + env: Env, + vk: VerificationKey, + proof: Proof, + pub_signals: Vec, + ) -> Result { + let bls = env.crypto().bls12_381(); + + // Prepare proof inputs: + // Compute vk_x = ic[0] + sum(pub_signals[i] * ic[i+1]) + if pub_signals.len() + 1 != vk.ic.len() { + return Err(Groth16Error::MalformedVerifyingKey); + } + let mut vk_x = vk.ic.get(0).unwrap(); + for (s, v) in pub_signals.iter().zip(vk.ic.iter().skip(1)) { + let prod = bls.g1_mul(&v, &s); + vk_x = bls.g1_add(&vk_x, &prod); + } + + // Compute the pairing: + // e(-A, B) * e(alpha, beta) * e(vk_x, gamma) * e(C, delta) == 1 + let neg_a = -proof.a; + let vp1 = vec![&env, neg_a, vk.alpha, vk_x, proof.c]; + let vp2 = vec![&env, proof.b, vk.beta, vk.gamma, vk.delta]; + + Ok(bls.pairing_check(vp1, vp2)) + } +} + +mod test; diff --git a/groth16_verifier/src/test.rs b/groth16_verifier/src/test.rs new file mode 100644 index 00000000..67021e26 --- /dev/null +++ b/groth16_verifier/src/test.rs @@ -0,0 +1,139 @@ +#![cfg(test)] +extern crate std; + +use ark_bls12_381::{Fq, Fq2}; +use ark_serialize::CanonicalSerialize; +use core::str::FromStr; +use soroban_sdk::{ + crypto::bls12_381::{Fr, G1Affine, G2Affine, G1_SERIALIZED_SIZE, G2_SERIALIZED_SIZE}, + Env, Vec, U256, +}; + +use crate::{Groth16Verifier, Groth16VerifierClient, Proof, VerificationKey}; + +fn g1_from_coords(env: &Env, x: &str, y: &str) -> G1Affine { + let ark_g1 = ark_bls12_381::G1Affine::new(Fq::from_str(x).unwrap(), Fq::from_str(y).unwrap()); + let mut buf = [0u8; G1_SERIALIZED_SIZE]; + ark_g1.serialize_uncompressed(&mut buf[..]).unwrap(); + G1Affine::from_array(env, &buf) +} + +fn g2_from_coords(env: &Env, x1: &str, x2: &str, y1: &str, y2: &str) -> G2Affine { + let x = Fq2::new(Fq::from_str(x1).unwrap(), Fq::from_str(x2).unwrap()); + let y = Fq2::new(Fq::from_str(y1).unwrap(), Fq::from_str(y2).unwrap()); + let ark_g2 = ark_bls12_381::G2Affine::new(x, y); + let mut buf = [0u8; G2_SERIALIZED_SIZE]; + ark_g2.serialize_uncompressed(&mut buf[..]).unwrap(); + G2Affine::from_array(env, &buf) +} + +fn create_client(e: &Env) -> Groth16VerifierClient { + Groth16VerifierClient::new(e, &e.register(Groth16Verifier {}, ())) +} + +#[test] +fn test() { + // Initialize the test environment + let env = Env::default(); + + // Load verification key components (copied from `data/verification_key.json`) + // These values are pre-computed for the circuit that verifies a*b = c + // where a=3, b=11, c=33 and only c is public. + let alphax = "851850525556173310373115880154698084608631105506432893865500290442025919078535925294035153152030470398262539759609"; + let alphay = "2637289349983507610125993281171282870664683328789064436670091381805667870657250691837988574635646688089951719927247"; + + let betax1 = "1312620381151154625549413690218290437739613987001512553647554932245743783919690104921577716179019375920325686841943"; + let betax2 = "1853421227732662200477195678252233549930451033531229987959164216695698667330234953033341200627605777603511819497457"; + let betay1 = "3215807833988244618006117550809420301978856703407297742347804415291049013404133666905173282837707341742014140541018"; + let betay2 = "812366606879346135498483310623227330050424196838294715759414425317592599094348477520229174120664109186562798527696"; + + let gammax1 = "352701069587466618187139116011060144890029952792775240219908644239793785735715026873347600343865175952761926303160"; + let gammax2 = "3059144344244213709971259814753781636986470325476647558659373206291635324768958432433509563104347017837885763365758"; + let gammay1 = "1985150602287291935568054521177171638300868978215655730859378665066344726373823718423869104263333984641494340347905"; + let gammay2 = "927553665492332455747201965776037880757740193453592970025027978793976877002675564980949289727957565575433344219582"; + + let deltax1 = "2981843938988033214458466658185878126396080429969635248100956025957789319926032198626745120548947333202362392267114"; + let deltax2 = "2236695112259305382987038341098587500598216646308901956168137697892380899086228863246537938263638056666003066263342"; + let deltay1 = "717163810166643254871951856655865822196000925757284470845197358532703820821048809982340614428800986999944933231635"; + let deltay2 = "3496058064578305387608803828034117220735807855182872031001942587835768203820179263722136810383631418598310938506798"; + + let ic0x = "829685638389803071404995253486571779300247099942205634643821309129201420207693030476756893332812706176564514055395"; + let ic0y = "3455508165409829148751617737772894557887792278044850553785496869183933597103951941805834639972489587640583544390358"; + + let ic1x = "2645559270376031734407122278942646687260452979296081924477586893972449945444985371392950465676350735694002713633589"; + let ic1y = "2241039659097418315097403108596818813895651201896886552939297756980670248638746432560267634304593609165964274111037"; + + // Construct the verification key from the pre-computed components + let vk = VerificationKey { + alpha: g1_from_coords(&env, alphax, alphay), + beta: g2_from_coords(&env, betax1, betax2, betay1, betay2), + gamma: g2_from_coords(&env, gammax1, gammax2, gammay1, gammay2), + delta: g2_from_coords(&env, deltax1, deltax2, deltay1, deltay2), + ic: Vec::from_array( + &env, + [ + g1_from_coords(&env, ic0x, ic0y), + g1_from_coords(&env, ic1x, ic1y), + ], + ), + }; + + // Load proof components (copied from `data/proof.json`) + let pi_ax = "314442236668110257304682488877371582255161413673331360366570443799415414639292047869143313601702131653514009114222"; + let pi_ay = "2384632327855835824635705027009217874826122107057894594162233214798350178691568018290025994699762298534539543934607"; + let pi_bx1 = "428844167033934720609657613212495751617651348480870890908850335525890280786532876634895457032623422366474694342656"; + let pi_bx2 = "3083139526360252775789959298805261067575555607578161553873977966165446991459924053189383038704105379290158793353905"; + let pi_by1 = "1590919422794657666432683000821892403620510405626533455397042191265963587891653562867091397248216891852168698286910"; + let pi_by2 = "3617931039814164588401589536353142503544155307022467123698224064329647390280346725086550997337076315487486714327146"; + let pi_cx = "3052934797502613468327963344215392478880720823583493172692775426011388142569325036386650708808320216973179639719187"; + let pi_cy = "2028185281516938724429867827057869371578022471499780916652824405212207527699373814371051328341613972789943854539597"; + + // Construct the proof from the pre-computed components + let proof = Proof { + a: g1_from_coords(&env, &pi_ax, &pi_ay), + b: g2_from_coords(&env, &pi_bx1, &pi_bx2, &pi_by1, &pi_by2), + c: g1_from_coords(&env, &pi_cx, &pi_cy), + }; + + // Create the contract client + let client = create_client(&env); + + // Test Case 1: Verify the proof with the correct public output (33, copied from `data/public.json`) + let output = Vec::from_array(&env, [Fr::from_u256(U256::from_u32(&env, 33))]); + let res = client.verify_proof(&vk, &proof, &output); + assert_eq!(res, true); + + // Print out the budget report showing CPU and memory cost breakdown for + // different operations (zero-value operations omitted for brevity) + env.cost_estimate().budget().print(); + /* + ================================================================= + Cpu limit: 100000000; used: 40968821 + Mem limit: 41943040; used: 297494 + ================================================================= + CostType cpu_insns mem_bytes + MemAlloc 12089 3401 + MemCpy 3091 0 + MemCmp 928 0 + VisitObject 5917 0 + ComputeSha256Hash 3738 0 + Bls12381EncodeFp 2644 0 + Bls12381DecodeFp 29550 0 + Bls12381G1CheckPointOnCurve 13538 0 + Bls12381G1CheckPointInSubgroup 3652550 0 + Bls12381G2CheckPointOnCurve 23684 0 + Bls12381G2CheckPointInSubgroup 4231288 0 + Bls12381G1ProjectiveToAffine 185284 0 + Bls12381G1Add 7689 0 + Bls12381G1Mul 2458985 0 + Bls12381Pairing 30335852 294093 + Bls12381FrFromU256 1994 0 + // ... zero-value rows omitted ... + ================================================================= + */ + + // Test Case 2: Verify the proof with an incorrect public output (22) + let output = Vec::from_array(&env, [Fr::from_u256(U256::from_u32(&env, 22))]); + let res = client.verify_proof(&vk, &proof, &output); + assert_eq!(res, false); +} diff --git a/hello_world/Cargo.toml b/hello_world/Cargo.toml index 13be6fe5..0dd2002f 100644 --- a/hello_world/Cargo.toml +++ b/hello_world/Cargo.toml @@ -3,6 +3,7 @@ name = "soroban-hello-world-contract" version = "0.0.0" edition = "2021" publish = false +rust-version = "1.80.0" [lib] crate-type = ["cdylib"] diff --git a/increment/Cargo.toml b/increment/Cargo.toml index 265f8ed3..216475f8 100644 --- a/increment/Cargo.toml +++ b/increment/Cargo.toml @@ -3,6 +3,7 @@ name = "soroban-increment-contract" version = "0.0.0" edition = "2021" publish = false +rust-version = "1.80.0" [lib] crate-type = ["cdylib"] diff --git a/increment_with_fuzz/Cargo.toml b/increment_with_fuzz/Cargo.toml index a9ac275f..0fa0e5aa 100644 --- a/increment_with_fuzz/Cargo.toml +++ b/increment_with_fuzz/Cargo.toml @@ -3,6 +3,7 @@ name = "soroban-increment-with-fuzz-contract" version = "0.0.0" edition = "2021" publish = false +rust-version = "1.80.0" [lib] crate-type = ["lib", "cdylib"] diff --git a/increment_with_fuzz/fuzz/Cargo.toml b/increment_with_fuzz/fuzz/Cargo.toml index a7f86309..4633fed2 100644 --- a/increment_with_fuzz/fuzz/Cargo.toml +++ b/increment_with_fuzz/fuzz/Cargo.toml @@ -2,6 +2,7 @@ name = "soroban-increment-with-fuzz-contract-fuzz" version = "0.0.0" publish = false +rust-version = "1.80.0" edition = "2021" [package.metadata] diff --git a/increment_with_pause/Cargo.toml b/increment_with_pause/Cargo.toml index 96058650..5277cade 100644 --- a/increment_with_pause/Cargo.toml +++ b/increment_with_pause/Cargo.toml @@ -3,6 +3,7 @@ name = "soroban-increment-with-pause-contract" version = "0.0.0" edition = "2021" publish = false +rust-version = "1.80.0" [lib] crate-type = ["cdylib"] diff --git a/liquidity_pool/Cargo.toml b/liquidity_pool/Cargo.toml index 5350ba30..1187965d 100644 --- a/liquidity_pool/Cargo.toml +++ b/liquidity_pool/Cargo.toml @@ -3,6 +3,7 @@ name = "soroban-liquidity-pool-contract" version = "0.0.0" edition = "2021" publish = false +rust-version = "1.80.0" [lib] crate-type = ["cdylib"] diff --git a/logging/Cargo.toml b/logging/Cargo.toml index 6ff29ce5..0bc50121 100644 --- a/logging/Cargo.toml +++ b/logging/Cargo.toml @@ -3,6 +3,7 @@ name = "soroban-logging-contract" version = "0.0.0" edition = "2021" publish = false +rust-version = "1.80.0" [lib] crate-type = ["cdylib"] diff --git a/mint-lock/Cargo.toml b/mint-lock/Cargo.toml index 41cd13a0..fa153850 100644 --- a/mint-lock/Cargo.toml +++ b/mint-lock/Cargo.toml @@ -3,6 +3,7 @@ name = "soroban-mint-lock-contract" version = "0.0.0" edition = "2021" publish = false +rust-version = "1.80.0" [lib] crate-type = ["cdylib"] diff --git a/multisig_1_of_n_account/contract/Cargo.toml b/multisig_1_of_n_account/contract/Cargo.toml index e7958a26..a041036e 100644 --- a/multisig_1_of_n_account/contract/Cargo.toml +++ b/multisig_1_of_n_account/contract/Cargo.toml @@ -3,6 +3,7 @@ name = "soroban-multisig-1-of-n-account-contract" version = "0.0.0" edition = "2021" publish = false +rust-version = "1.80.0" [lib] crate-type = ["cdylib"] diff --git a/multisig_1_of_n_account/stellar-cli-sign-auth-ed25519/Cargo.toml b/multisig_1_of_n_account/stellar-cli-sign-auth-ed25519/Cargo.toml index 2f6030c3..3402f911 100644 --- a/multisig_1_of_n_account/stellar-cli-sign-auth-ed25519/Cargo.toml +++ b/multisig_1_of_n_account/stellar-cli-sign-auth-ed25519/Cargo.toml @@ -3,6 +3,7 @@ name = "stellar-sign-auth-ed25519" version = "0.1.0" edition = "2021" publish = false +rust-version = "1.80.0" [dependencies] stellar-xdr = { version = "22.2.0", features = ["base64", "serde"] } diff --git a/other_custom_types/Cargo.toml b/other_custom_types/Cargo.toml index 84ae3af4..36230fa3 100644 --- a/other_custom_types/Cargo.toml +++ b/other_custom_types/Cargo.toml @@ -3,6 +3,7 @@ name = "soroban-other-custom-types-contract" version = "0.0.0" edition = "2021" publish = false +rust-version = "1.80.0" [lib] crate-type = ["cdylib"] diff --git a/pause/Cargo.toml b/pause/Cargo.toml index bdcd5181..0af368a5 100644 --- a/pause/Cargo.toml +++ b/pause/Cargo.toml @@ -3,6 +3,7 @@ name = "soroban-pause-contract" version = "0.0.0" edition = "2021" publish = false +rust-version = "1.80.0" [lib] crate-type = ["cdylib"] diff --git a/simple_account/Cargo.toml b/simple_account/Cargo.toml index 87703880..606bb10a 100644 --- a/simple_account/Cargo.toml +++ b/simple_account/Cargo.toml @@ -3,6 +3,7 @@ name = "soroban-simple-account-contract" version = "0.0.0" edition = "2021" publish = false +rust-version = "1.80.0" [lib] crate-type = ["cdylib"] diff --git a/single_offer/Cargo.toml b/single_offer/Cargo.toml index 62f18470..e3bc6777 100644 --- a/single_offer/Cargo.toml +++ b/single_offer/Cargo.toml @@ -3,6 +3,7 @@ name = "soroban-single-offer-contract" version = "0.0.0" edition = "2021" publish = false +rust-version = "1.80.0" [lib] crate-type = ["cdylib"] diff --git a/timelock/Cargo.toml b/timelock/Cargo.toml index bba8a19c..95c21775 100644 --- a/timelock/Cargo.toml +++ b/timelock/Cargo.toml @@ -3,6 +3,7 @@ name = "soroban-timelock-contract" version = "0.0.0" edition = "2021" publish = false +rust-version = "1.80.0" [lib] crate-type = ["cdylib"] diff --git a/token/Cargo.toml b/token/Cargo.toml index 6b43a0e5..6f2099b3 100644 --- a/token/Cargo.toml +++ b/token/Cargo.toml @@ -3,6 +3,7 @@ name = "soroban-token-contract" description = "Soroban standard token contract" version = "0.0.6" edition = "2021" +rust-version = "1.80.0" [lib] crate-type = ["cdylib"] diff --git a/ttl/Cargo.toml b/ttl/Cargo.toml index e9a4022c..c7994673 100644 --- a/ttl/Cargo.toml +++ b/ttl/Cargo.toml @@ -3,6 +3,7 @@ name = "soroban-ttl-example" version = "0.0.0" edition = "2021" publish = false +rust-version = "1.80.0" [lib] crate-type = ["cdylib"] diff --git a/upgradeable_contract/new_contract/Cargo.toml b/upgradeable_contract/new_contract/Cargo.toml index 2744094c..70c93f36 100644 --- a/upgradeable_contract/new_contract/Cargo.toml +++ b/upgradeable_contract/new_contract/Cargo.toml @@ -3,6 +3,7 @@ name = "soroban-upgradeable-contract-new-contract" version = "0.0.0" edition = "2021" publish = false +rust-version = "1.80.0" [lib] crate-type = ["cdylib"] diff --git a/upgradeable_contract/old_contract/Cargo.toml b/upgradeable_contract/old_contract/Cargo.toml index 823be292..0499e158 100644 --- a/upgradeable_contract/old_contract/Cargo.toml +++ b/upgradeable_contract/old_contract/Cargo.toml @@ -3,6 +3,7 @@ name = "soroban-upgradeable-contract-old-contract" version = "0.0.0" edition = "2021" publish = false +rust-version = "1.80.0" [lib] crate-type = ["cdylib"] diff --git a/workspace/contract_a/Cargo.toml b/workspace/contract_a/Cargo.toml index 31dfd89d..793e7892 100644 --- a/workspace/contract_a/Cargo.toml +++ b/workspace/contract_a/Cargo.toml @@ -3,6 +3,7 @@ name = "soroban-workspace-contract-a" version.workspace = true edition = "2021" publish = false +rust-version = "1.80.0" [lib] crate-type = ["cdylib", "rlib"] diff --git a/workspace/contract_a_interface/Cargo.toml b/workspace/contract_a_interface/Cargo.toml index 25407dd3..dea10ea0 100644 --- a/workspace/contract_a_interface/Cargo.toml +++ b/workspace/contract_a_interface/Cargo.toml @@ -3,6 +3,7 @@ name = "soroban-workspace-contract-a-interface" version.workspace = true edition = "2021" publish = false +rust-version = "1.80.0" [lib] crate-type = ["rlib"] diff --git a/workspace/contract_b/Cargo.toml b/workspace/contract_b/Cargo.toml index 31db2024..dddedb22 100644 --- a/workspace/contract_b/Cargo.toml +++ b/workspace/contract_b/Cargo.toml @@ -3,6 +3,7 @@ name = "soroban-workspace-contract-b" version.workspace = true edition = "2021" publish = false +rust-version = "1.80.0" [lib] crate-type = ["cdylib"]