diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 971e0b75..a05821b5 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -98,6 +98,39 @@ jobs: run: cargo xclippy -D warnings working-directory: ${{ github.workspace }}/${{ matrix.package }} + solidity-unit-tests: + runs-on: buildjet-16vcpu-ubuntu-2204 + steps: + - uses: actions/checkout@v4 + with: + repository: lurk-lab/ci-workflows + - uses: ./.github/actions/ci-env + - uses: actions/checkout@v4 + with: + submodules: recursive + token: ${{ secrets.REPO_TOKEN }} + - name: Setup CI + uses: ./.github/actions/setup + with: + pull_token: ${{ secrets.REPO_TOKEN }} + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + version: nightly + - name: Check formatting + run: | + forge fmt --check + working-directory: ${{ github.workspace }}/aptos/solidity/contracts/ + - name: Run Forge build + run: | + forge --version + forge build + working-directory: ${{ github.workspace }}/aptos/solidity/contracts/ + - name: Run Forge tests + run: | + forge test + working-directory: ${{ github.workspace }}/aptos/solidity/contracts/ + cycle-count-regression: runs-on: warp-ubuntu-latest-x64-32x steps: diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..f0832068 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,8 @@ +[submodule "aptos/solidity/contracts/lib/forge-std"] + path = aptos/solidity/contracts/lib/forge-std + url = https://github.com/foundry-rs/forge-std + # https://stackoverflow.com/questions/5126765/how-to-get-rid-of-git-submodules-untracked-status + ignore = dirty +[submodule "aptos/solidity/contracts/lib/sphinx-contracts"] + path = aptos/solidity/contracts/lib/sphinx-contracts + url = https://github.com/lurk-lab/sphinx-contracts diff --git a/aptos/Cargo.lock b/aptos/Cargo.lock index a43862bb..0d56884d 100644 --- a/aptos/Cargo.lock +++ b/aptos/Cargo.lock @@ -7,6 +7,10 @@ name = "Inflector" version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" +dependencies = [ + "lazy_static", + "regex", +] [[package]] name = "abstract-domain-derive" @@ -124,147 +128,6 @@ version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" -[[package]] -name = "alloy" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-contract", - "alloy-core", - "alloy-eips", - "alloy-genesis", - "alloy-provider", - "alloy-rpc-client", - "alloy-serde", - "alloy-signer", - "alloy-signer-wallet", - "alloy-transport-http", - "reqwest 0.12.4", -] - -[[package]] -name = "alloy-consensus" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-eips", - "alloy-primitives", - "alloy-rlp", - "alloy-serde", - "serde", - "sha2 0.10.8", -] - -[[package]] -name = "alloy-contract" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-dyn-abi", - "alloy-json-abi", - "alloy-network", - "alloy-primitives", - "alloy-provider", - "alloy-rpc-types", - "alloy-sol-types", - "alloy-transport", - "futures", - "futures-util", - "thiserror", -] - -[[package]] -name = "alloy-core" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5af3faff14c12c8b11037e0a093dd157c3702becb8435577a2408534d0758315" -dependencies = [ - "alloy-dyn-abi", - "alloy-json-abi", - "alloy-primitives", - "alloy-sol-types", -] - -[[package]] -name = "alloy-dyn-abi" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb6e6436a9530f25010d13653e206fab4c9feddacf21a54de8d7311b275bc56b" -dependencies = [ - "alloy-json-abi", - "alloy-primitives", - "alloy-sol-type-parser", - "alloy-sol-types", - "const-hex", - "itoa", - "serde", - "serde_json", - "winnow 0.6.13", -] - -[[package]] -name = "alloy-eips" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-primitives", - "alloy-rlp", - "alloy-serde", - "c-kzg", - "once_cell", - "serde", -] - -[[package]] -name = "alloy-genesis" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-primitives", - "alloy-serde", - "serde", -] - -[[package]] -name = "alloy-json-abi" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aaeaccd50238126e3a0ff9387c7c568837726ad4f4e399b528ca88104d6c25ef" -dependencies = [ - "alloy-primitives", - "alloy-sol-type-parser", - "serde", - "serde_json", -] - -[[package]] -name = "alloy-json-rpc" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-primitives", - "serde", - "serde_json", - "thiserror", -] - -[[package]] -name = "alloy-network" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-consensus", - "alloy-eips", - "alloy-json-rpc", - "alloy-primitives", - "alloy-rpc-types", - "alloy-signer", - "async-trait", - "futures-utils-wasm", - "serde", - "thiserror", -] - [[package]] name = "alloy-primitives" version = "0.7.6" @@ -287,142 +150,16 @@ dependencies = [ "tiny-keccak", ] -[[package]] -name = "alloy-provider" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-json-rpc", - "alloy-network", - "alloy-primitives", - "alloy-rpc-client", - "alloy-rpc-types", - "alloy-rpc-types-trace", - "alloy-transport", - "alloy-transport-http", - "async-stream", - "async-trait", - "auto_impl", - "dashmap", - "futures", - "lru 0.12.3", - "reqwest 0.12.4", - "serde_json", - "tokio", - "tracing", - "url", -] - [[package]] name = "alloy-rlp" version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b155716bab55763c95ba212806cf43d05bcc70e5f35b02bad20cf5ec7fe11fed" dependencies = [ - "alloy-rlp-derive", "arrayvec 0.7.4", "bytes", ] -[[package]] -name = "alloy-rlp-derive" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8037e03c7f462a063f28daec9fda285a9a89da003c552f8637a80b9c8fd96241" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.66", -] - -[[package]] -name = "alloy-rpc-client" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-json-rpc", - "alloy-transport", - "alloy-transport-http", - "futures", - "pin-project", - "reqwest 0.12.4", - "serde", - "serde_json", - "tokio", - "tokio-stream", - "tower", - "tracing", - "url", -] - -[[package]] -name = "alloy-rpc-types" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-consensus", - "alloy-eips", - "alloy-genesis", - "alloy-primitives", - "alloy-rlp", - "alloy-serde", - "alloy-sol-types", - "itertools 0.12.1", - "serde", - "serde_json", - "thiserror", -] - -[[package]] -name = "alloy-rpc-types-trace" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-primitives", - "alloy-rpc-types", - "alloy-serde", - "serde", - "serde_json", -] - -[[package]] -name = "alloy-serde" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-primitives", - "serde", - "serde_json", -] - -[[package]] -name = "alloy-signer" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-primitives", - "async-trait", - "auto_impl", - "elliptic-curve", - "k256", - "thiserror", -] - -[[package]] -name = "alloy-signer-wallet" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-consensus", - "alloy-network", - "alloy-primitives", - "alloy-signer", - "async-trait", - "k256", - "rand 0.8.5", - "thiserror", -] - [[package]] name = "alloy-sol-macro" version = "0.7.6" @@ -434,7 +171,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -443,7 +180,6 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd9899da7d011b4fe4c406a524ed3e3f963797dbc93b45479d60341d3a27b252" dependencies = [ - "alloy-json-abi", "alloy-sol-macro-input", "const-hex", "heck 0.5.0", @@ -451,7 +187,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", "syn-solidity", "tiny-keccak", ] @@ -462,70 +198,27 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d32d595768fdc61331a132b6f65db41afae41b9b97d36c21eb1b955c422a7e60" dependencies = [ - "alloy-json-abi", "const-hex", "dunce", "heck 0.5.0", "proc-macro2", "quote", - "serde_json", - "syn 2.0.66", + "syn 2.0.68", "syn-solidity", ] -[[package]] -name = "alloy-sol-type-parser" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baa2fbd22d353d8685bd9fee11ba2d8b5c3b1d11e56adb3265fcf1f32bfdf404" -dependencies = [ - "winnow 0.6.13", -] - [[package]] name = "alloy-sol-types" version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a49042c6d3b66a9fe6b2b5a8bf0d39fc2ae1ee0310a2a26ffedd79fb097878dd" dependencies = [ - "alloy-json-abi", "alloy-primitives", "alloy-sol-macro", "const-hex", "serde", ] -[[package]] -name = "alloy-transport" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-json-rpc", - "base64 0.22.1", - "futures-util", - "futures-utils-wasm", - "serde", - "serde_json", - "thiserror", - "tokio", - "tower", - "url", - "wasm-bindgen-futures", -] - -[[package]] -name = "alloy-transport-http" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-json-rpc", - "alloy-transport", - "reqwest 0.12.4", - "serde_json", - "tower", - "url", -] - [[package]] name = "android-tzdata" version = "0.1.1" @@ -921,7 +614,7 @@ dependencies = [ "either", "hex", "itertools 0.12.1", - "lru 0.7.8", + "lru", "move-core-types 0.0.4 (git+https://github.com/aptos-labs/aptos-core/?tag=aptos-node-v1.14.0)", "num-derive", "once_cell", @@ -1147,7 +840,7 @@ dependencies = [ "itertools 0.12.1", "libsecp256k1", "log", - "lru 0.7.8", + "lru", "merlin", "move-binary-format", "move-cli", @@ -1370,7 +1063,7 @@ dependencies = [ "proptest", "rand 0.7.3", "rand_core 0.5.1", - "reqwest 0.12.4", + "reqwest 0.12.5", "serde", "serde_bytes", "sha2 0.9.9", @@ -2371,7 +2064,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -2382,7 +2075,18 @@ checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", +] + +[[package]] +name = "async_io_stream" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d7b9decdf35d8908a7e3ef02f64c5e9b1695e230154c0e8de3969142d9b94c" +dependencies = [ + "futures", + "pharos", + "rustc_version 0.4.0", ] [[package]] @@ -2410,7 +2114,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -2590,6 +2294,12 @@ dependencies = [ "thiserror", ] +[[package]] +name = "bech32" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" + [[package]] name = "bellpepper" version = "0.4.1" @@ -2661,7 +2371,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -2683,7 +2393,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.66", + "syn 2.0.68", "which", ] @@ -2882,6 +2592,16 @@ dependencies = [ "subtle", ] +[[package]] +name = "bs58" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" +dependencies = [ + "sha2 0.10.8", + "tinyvec", +] + [[package]] name = "bstr" version = "0.2.17" @@ -2943,9 +2663,9 @@ checksum = "5ce89b21cab1437276d2650d57e971f9d548a2d9037cc231abdc0562b97498ce" [[package]] name = "bytemuck" -version = "1.16.0" +version = "1.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78834c15cb5d5efe3452d58b1e8ba890dd62d21907f867f383358198e56ebca5" +checksum = "b236fc92302c97ed75b38da1f4917b5cdda4984745740f153a5d3059e48d725e" [[package]] name = "byteorder" @@ -2973,20 +2693,6 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "c-kzg" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdf100c4cea8f207e883ff91ca886d621d8a166cb04971dfaa9bb8fd99ed95df" -dependencies = [ - "blst", - "cc", - "glob", - "hex", - "libc", - "serde", -] - [[package]] name = "c_linked_list" version = "1.1.1" @@ -3052,9 +2758,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.0.99" +version = "1.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96c51067fd44124faa7f870b4b1c969379ad32b2ba805aa959430ceaa384f695" +checksum = "c891175c3fb232128f48de6590095e59198bbeb8620c310be349bfc3afd12c7b" dependencies = [ "jobserver", "libc", @@ -3228,7 +2934,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -3268,19 +2974,71 @@ dependencies = [ ] [[package]] -name = "colorchoice" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" - -[[package]] -name = "colored" -version = "2.1.0" +name = "coins-bip32" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" +checksum = "3b6be4a5df2098cd811f3194f64ddb96c267606bffd9689ac7b0160097b01ad3" dependencies = [ - "lazy_static", - "windows-sys 0.48.0", + "bs58", + "coins-core", + "digest 0.10.7", + "hmac 0.12.1", + "k256", + "serde", + "sha2 0.10.8", + "thiserror", +] + +[[package]] +name = "coins-bip39" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db8fba409ce3dc04f7d804074039eb68b960b0829161f8e06c95fea3f122528" +dependencies = [ + "bitvec 1.0.1", + "coins-bip32", + "hmac 0.12.1", + "once_cell", + "pbkdf2 0.12.2", + "rand 0.8.5", + "sha2 0.10.8", + "thiserror", +] + +[[package]] +name = "coins-core" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5286a0843c21f8367f7be734f89df9b822e0321d8bcce8d6e735aadff7d74979" +dependencies = [ + "base64 0.21.7", + "bech32", + "bs58", + "digest 0.10.7", + "generic-array", + "hex", + "ripemd", + "serde", + "serde_derive", + "sha2 0.10.8", + "sha3 0.10.8", + "thiserror", +] + +[[package]] +name = "colorchoice" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" + +[[package]] +name = "colored" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" +dependencies = [ + "lazy_static", + "windows-sys 0.48.0", ] [[package]] @@ -3695,15 +3453,14 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.1.2" +version = "4.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a677b8922c94e01bdbb12126b0bc852f00447528dee1782229af9c720c3f348" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" dependencies = [ "cfg-if", "cpufeatures", "curve25519-dalek-derive", "fiat-crypto", - "platforms", "rustc_version 0.4.0", "subtle", "zeroize", @@ -3717,7 +3474,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -3779,7 +3536,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.11.1", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -3801,7 +3558,7 @@ checksum = "733cabb43482b1a1b53eee8583c2b9e8684d592215ea83efd305dd31bc2f0178" dependencies = [ "darling_core 0.20.9", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -3869,7 +3626,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -3882,7 +3639,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version 0.4.0", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -3939,17 +3696,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "displaydoc" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.66", -] - [[package]] name = "doc-comment" version = "0.3.3" @@ -4066,6 +3812,24 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "enr" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a3d8dc56e02f954cac8eb489772c552c473346fc34f67412bb6244fd647f7e4" +dependencies = [ + "base64 0.21.7", + "bytes", + "hex", + "k256", + "log", + "rand 0.8.5", + "rlp", + "serde", + "sha3 0.10.8", + "zeroize", +] + [[package]] name = "enum_dispatch" version = "0.3.13" @@ -4075,7 +3839,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -4144,12 +3908,286 @@ dependencies = [ "version_check", ] +[[package]] +name = "eth-keystore" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fda3bf123be441da5260717e0661c25a2fd9cb2b2c1d20bf2e05580047158ab" +dependencies = [ + "aes", + "ctr", + "digest 0.10.7", + "hex", + "hmac 0.12.1", + "pbkdf2 0.11.0", + "rand 0.8.5", + "scrypt", + "serde", + "serde_json", + "sha2 0.10.8", + "sha3 0.10.8", + "thiserror", + "uuid", +] + +[[package]] +name = "ethabi" +version = "18.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7413c5f74cc903ea37386a8965a936cbeb334bd270862fdece542c1b2dcbc898" +dependencies = [ + "ethereum-types", + "hex", + "once_cell", + "regex", + "serde", + "serde_json", + "sha3 0.10.8", + "thiserror", + "uint", +] + +[[package]] +name = "ethbloom" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60" +dependencies = [ + "crunchy", + "fixed-hash 0.8.0", + "impl-codec 0.6.0", + "impl-rlp", + "impl-serde 0.4.0", + "scale-info", + "tiny-keccak", +] + +[[package]] +name = "ethereum-types" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" +dependencies = [ + "ethbloom", + "fixed-hash 0.8.0", + "impl-codec 0.6.0", + "impl-rlp", + "impl-serde 0.4.0", + "primitive-types 0.12.2", + "scale-info", + "uint", +] + +[[package]] +name = "ethers" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "816841ea989f0c69e459af1cf23a6b0033b19a55424a1ea3a30099becdb8dec0" +dependencies = [ + "ethers-addressbook", + "ethers-contract", + "ethers-core", + "ethers-middleware", + "ethers-providers", + "ethers-signers", +] + +[[package]] +name = "ethers-addressbook" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5495afd16b4faa556c3bba1f21b98b4983e53c1755022377051a975c3b021759" +dependencies = [ + "ethers-core", + "once_cell", + "serde", + "serde_json", +] + +[[package]] +name = "ethers-contract" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fceafa3578c836eeb874af87abacfb041f92b4da0a78a5edd042564b8ecdaaa" +dependencies = [ + "const-hex", + "ethers-contract-abigen", + "ethers-contract-derive", + "ethers-core", + "ethers-providers", + "futures-util", + "once_cell", + "pin-project", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "ethers-contract-abigen" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04ba01fbc2331a38c429eb95d4a570166781f14290ef9fdb144278a90b5a739b" +dependencies = [ + "Inflector", + "const-hex", + "dunce", + "ethers-core", + "eyre", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "serde", + "serde_json", + "syn 2.0.68", + "toml 0.8.2", + "walkdir", +] + +[[package]] +name = "ethers-contract-derive" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87689dcabc0051cde10caaade298f9e9093d65f6125c14575db3fd8c669a168f" +dependencies = [ + "Inflector", + "const-hex", + "ethers-contract-abigen", + "ethers-core", + "proc-macro2", + "quote", + "serde_json", + "syn 2.0.68", +] + +[[package]] +name = "ethers-core" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82d80cc6ad30b14a48ab786523af33b37f28a8623fc06afd55324816ef18fb1f" +dependencies = [ + "arrayvec 0.7.4", + "bytes", + "cargo_metadata 0.18.1", + "chrono", + "const-hex", + "elliptic-curve", + "ethabi", + "generic-array", + "k256", + "num_enum 0.7.2", + "once_cell", + "open-fastrlp", + "rand 0.8.5", + "rlp", + "serde", + "serde_json", + "strum 0.26.3", + "syn 2.0.68", + "tempfile", + "thiserror", + "tiny-keccak", + "unicode-xid", +] + +[[package]] +name = "ethers-middleware" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48f9fdf09aec667c099909d91908d5eaf9be1bd0e2500ba4172c1d28bfaa43de" +dependencies = [ + "async-trait", + "auto_impl", + "ethers-contract", + "ethers-core", + "ethers-providers", + "ethers-signers", + "futures-channel", + "futures-locks", + "futures-util", + "instant", + "reqwest 0.11.27", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", + "tracing-futures", + "url", +] + +[[package]] +name = "ethers-providers" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6434c9a33891f1effc9c75472e12666db2fa5a0fec4b29af6221680a6fe83ab2" +dependencies = [ + "async-trait", + "auto_impl", + "base64 0.21.7", + "bytes", + "const-hex", + "enr", + "ethers-core", + "futures-core", + "futures-timer", + "futures-util", + "hashers", + "http 0.2.12", + "instant", + "jsonwebtoken", + "once_cell", + "pin-project", + "reqwest 0.11.27", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", + "tracing-futures", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "ws_stream_wasm", +] + +[[package]] +name = "ethers-signers" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "228875491c782ad851773b652dd8ecac62cda8571d3bc32a5853644dd26766c2" +dependencies = [ + "async-trait", + "coins-bip32", + "coins-bip39", + "const-hex", + "elliptic-curve", + "eth-keystore", + "ethers-core", + "rand 0.8.5", + "sha2 0.10.8", + "thiserror", + "tracing", +] + [[package]] name = "ethnum" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b90ca2580b73ab6a1f724b76ca11ab632df820fd6040c336200d2c1df7b3c82c" +[[package]] +name = "eyre" +version = "0.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cd915d99f24784cdc19fd37ef22b97e3ff0ae756c7e492e9fbfe897d61e2aec" +dependencies = [ + "indenter", + "once_cell", +] + [[package]] name = "fail" version = "0.5.1" @@ -4266,6 +4304,20 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d" +[[package]] +name = "fixture-generator" +version = "0.1.0" +dependencies = [ + "alloy-sol-types", + "aptos-lc", + "clap 4.5.7", + "serde", + "serde_json", + "sphinx-prover", + "sphinx-sdk", + "tracing", +] + [[package]] name = "flate2" version = "1.0.30" @@ -4382,6 +4434,16 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +[[package]] +name = "futures-locks" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45ec6fe3675af967e67c5536c0b9d44e34e6c52f86bedc4ea49c5317b8e94d06" +dependencies = [ + "futures-channel", + "futures-task", +] + [[package]] name = "futures-macro" version = "0.3.30" @@ -4390,7 +4452,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -4405,6 +4467,16 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +[[package]] +name = "futures-timer" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" +dependencies = [ + "gloo-timers", + "send_wrapper 0.4.0", +] + [[package]] name = "futures-util" version = "0.3.30" @@ -4423,12 +4495,6 @@ dependencies = [ "slab", ] -[[package]] -name = "futures-utils-wasm" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42012b0f064e01aa58b545fe3727f90f7dd4020f4a3ea735b50344965f5a57e9" - [[package]] name = "fxhash" version = "0.2.1" @@ -4591,6 +4657,18 @@ dependencies = [ "walkdir", ] +[[package]] +name = "gloo-timers" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", +] + [[package]] name = "goldenfile" version = "1.7.1" @@ -4745,6 +4823,16 @@ checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ "ahash 0.8.11", "allocator-api2", + "serde", +] + +[[package]] +name = "hashers" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2bca93b15ea5a746f220e56587f71e73c6165eab783df9e26590069953e3c30" +dependencies = [ + "fxhash", ] [[package]] @@ -4971,9 +5059,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.9.3" +version = "1.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0e7a4dd27b9476dc40cb050d3632d3bba3a70ddbff012285f7f8559a1e7e545" +checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" [[package]] name = "httpdate" @@ -4998,9 +5086,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hybrid-array" -version = "0.2.0-rc.8" +version = "0.2.0-rc.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53668f5da5a41d9eaf4bf7064be46d1ebe6a4e1ceed817f387587b18f2b51047" +checksum = "4d306b679262030ad8813a82d4915fc04efff97776e4db7f8eb5137039d56400" dependencies = [ "typenum", ] @@ -5050,6 +5138,23 @@ dependencies = [ "want", ] +[[package]] +name = "hyper-rustls" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155" +dependencies = [ + "futures-util", + "http 1.1.0", + "hyper 1.3.1", + "hyper-util", + "rustls 0.23.10", + "rustls-pki-types", + "tokio", + "tokio-rustls 0.26.0", + "tower-service", +] + [[package]] name = "hyper-timeout" version = "0.4.1" @@ -5134,124 +5239,6 @@ dependencies = [ "cc", ] -[[package]] -name = "icu_collections" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" -dependencies = [ - "displaydoc", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_locid" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" -dependencies = [ - "displaydoc", - "litemap", - "tinystr", - "writeable", - "zerovec", -] - -[[package]] -name = "icu_locid_transform" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" -dependencies = [ - "displaydoc", - "icu_locid", - "icu_locid_transform_data", - "icu_provider", - "tinystr", - "zerovec", -] - -[[package]] -name = "icu_locid_transform_data" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" - -[[package]] -name = "icu_normalizer" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" -dependencies = [ - "displaydoc", - "icu_collections", - "icu_normalizer_data", - "icu_properties", - "icu_provider", - "smallvec", - "utf16_iter", - "utf8_iter", - "write16", - "zerovec", -] - -[[package]] -name = "icu_normalizer_data" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" - -[[package]] -name = "icu_properties" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f8ac670d7422d7f76b32e17a5db556510825b29ec9154f235977c9caba61036" -dependencies = [ - "displaydoc", - "icu_collections", - "icu_locid_transform", - "icu_properties_data", - "icu_provider", - "tinystr", - "zerovec", -] - -[[package]] -name = "icu_properties_data" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" - -[[package]] -name = "icu_provider" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" -dependencies = [ - "displaydoc", - "icu_locid", - "icu_provider_macros", - "stable_deref_trait", - "tinystr", - "writeable", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_provider_macros" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.66", -] - [[package]] name = "ident_case" version = "1.0.1" @@ -5270,14 +5257,12 @@ dependencies = [ [[package]] name = "idna" -version = "1.0.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4716a3a0933a1d01c2f72450e89596eb51dd34ef3c211ccd875acdf1f8fe47ed" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" dependencies = [ - "icu_normalizer", - "icu_properties", - "smallvec", - "utf8_iter", + "unicode-bidi", + "unicode-normalization", ] [[package]] @@ -5328,6 +5313,15 @@ dependencies = [ "parity-scale-codec 3.6.11", ] +[[package]] +name = "impl-rlp" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" +dependencies = [ + "rlp", +] + [[package]] name = "impl-serde" version = "0.3.2" @@ -5337,6 +5331,15 @@ dependencies = [ "serde", ] +[[package]] +name = "impl-serde" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" +dependencies = [ + "serde", +] + [[package]] name = "impl-trait-for-tuples" version = "0.2.2" @@ -5372,6 +5375,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "indenter" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" + [[package]] name = "indexmap" version = "1.9.3" @@ -5632,11 +5641,11 @@ dependencies = [ [[package]] name = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" dependencies = [ - "spin 0.5.2", + "spin 0.9.8", ] [[package]] @@ -5702,9 +5711,9 @@ dependencies = [ [[package]] name = "libloading" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19" +checksum = "e310b3a6b5907f99202fcdb4960ff45b93735d7c7d96b760fcff8db2dc0e103d" dependencies = [ "cfg-if", "windows-targets 0.52.5", @@ -5820,12 +5829,6 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" -[[package]] -name = "litemap" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704" - [[package]] name = "lock_api" version = "0.4.12" @@ -5854,15 +5857,6 @@ dependencies = [ "hashbrown 0.12.3", ] -[[package]] -name = "lru" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3262e75e648fce39813cb56ac41f3c3e3f65217ebf3844d818d1f9398cfb0dc" -dependencies = [ - "hashbrown 0.14.5", -] - [[package]] name = "lz4-sys" version = "1.9.5" @@ -5952,9 +5946,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" dependencies = [ "adler", ] @@ -6406,7 +6400,7 @@ dependencies = [ "sha2 0.9.9", "tempfile", "termcolor", - "toml", + "toml 0.7.8", "walkdir", "whoami", ] @@ -6435,7 +6429,7 @@ dependencies = [ "once_cell", "serde", "simplelog", - "toml", + "toml 0.7.8", ] [[package]] @@ -6601,7 +6595,7 @@ dependencies = [ "fail", "hashbrown 0.14.5", "lazy_static", - "lru 0.7.8", + "lru", "move-binary-format", "move-bytecode-verifier", "move-core-types 0.0.4 (git+https://github.com/aptos-labs/aptos-core/?tag=aptos-node-v1.14.0)", @@ -6940,7 +6934,16 @@ version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" dependencies = [ - "num_enum_derive", + "num_enum_derive 0.5.11", +] + +[[package]] +name = "num_enum" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845" +dependencies = [ + "num_enum_derive 0.7.2", ] [[package]] @@ -6955,6 +6958,18 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "num_enum_derive" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" +dependencies = [ + "proc-macro-crate 1.3.1", + "proc-macro2", + "quote", + "syn 2.0.68", +] + [[package]] name = "num_threads" version = "0.1.7" @@ -7003,10 +7018,35 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" [[package]] -name = "opaque-debug" -version = "0.3.1" +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + +[[package]] +name = "open-fastrlp" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "786393f80485445794f6043fd3138854dd109cc6c4bd1a6383db304c9ce9b9ce" +dependencies = [ + "arrayvec 0.7.4", + "auto_impl", + "bytes", + "ethereum-types", + "open-fastrlp-derive", +] + +[[package]] +name = "open-fastrlp-derive" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" +checksum = "003b2be5c6c53c1cfeb0a238b8a1c3915cd410feb684457a36c10038f764bb1c" +dependencies = [ + "bytes", + "proc-macro2", + "quote", + "syn 1.0.109", +] [[package]] name = "openssl" @@ -7031,7 +7071,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -7096,7 +7136,7 @@ dependencies = [ [[package]] name = "p3-air" version = "0.1.0" -source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1-new#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1#03f2b272e1b33ed91f8dfb0336f0a791071ef458" dependencies = [ "p3-field", "p3-matrix", @@ -7105,7 +7145,7 @@ dependencies = [ [[package]] name = "p3-baby-bear" version = "0.1.0" -source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1-new#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1#03f2b272e1b33ed91f8dfb0336f0a791071ef458" dependencies = [ "num-bigint 0.4.5", "p3-field", @@ -7119,7 +7159,7 @@ dependencies = [ [[package]] name = "p3-blake3" version = "0.1.0" -source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1-new#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1#03f2b272e1b33ed91f8dfb0336f0a791071ef458" dependencies = [ "blake3", "p3-symmetric", @@ -7128,7 +7168,7 @@ dependencies = [ [[package]] name = "p3-bn254-fr" version = "0.1.0" -source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1-new#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1#03f2b272e1b33ed91f8dfb0336f0a791071ef458" dependencies = [ "ff 0.13.0", "num-bigint 0.4.5", @@ -7142,7 +7182,7 @@ dependencies = [ [[package]] name = "p3-challenger" version = "0.1.0" -source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1-new#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1#03f2b272e1b33ed91f8dfb0336f0a791071ef458" dependencies = [ "p3-field", "p3-maybe-rayon", @@ -7154,7 +7194,7 @@ dependencies = [ [[package]] name = "p3-commit" version = "0.1.0" -source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1-new#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1#03f2b272e1b33ed91f8dfb0336f0a791071ef458" dependencies = [ "itertools 0.12.1", "p3-challenger", @@ -7167,7 +7207,7 @@ dependencies = [ [[package]] name = "p3-dft" version = "0.1.0" -source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1-new#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1#03f2b272e1b33ed91f8dfb0336f0a791071ef458" dependencies = [ "p3-field", "p3-matrix", @@ -7179,7 +7219,7 @@ dependencies = [ [[package]] name = "p3-field" version = "0.1.0" -source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1-new#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1#03f2b272e1b33ed91f8dfb0336f0a791071ef458" dependencies = [ "itertools 0.12.1", "num-bigint 0.4.5", @@ -7192,7 +7232,7 @@ dependencies = [ [[package]] name = "p3-fri" version = "0.1.0" -source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1-new#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1#03f2b272e1b33ed91f8dfb0336f0a791071ef458" dependencies = [ "itertools 0.12.1", "p3-challenger", @@ -7210,7 +7250,7 @@ dependencies = [ [[package]] name = "p3-interpolation" version = "0.1.0" -source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1-new#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1#03f2b272e1b33ed91f8dfb0336f0a791071ef458" dependencies = [ "p3-field", "p3-matrix", @@ -7220,7 +7260,7 @@ dependencies = [ [[package]] name = "p3-keccak" version = "0.1.0" -source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1-new#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1#03f2b272e1b33ed91f8dfb0336f0a791071ef458" dependencies = [ "p3-symmetric", "tiny-keccak", @@ -7229,7 +7269,7 @@ dependencies = [ [[package]] name = "p3-keccak-air" version = "0.1.0" -source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1-new#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1#03f2b272e1b33ed91f8dfb0336f0a791071ef458" dependencies = [ "p3-air", "p3-field", @@ -7242,7 +7282,7 @@ dependencies = [ [[package]] name = "p3-matrix" version = "0.1.0" -source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1-new#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1#03f2b272e1b33ed91f8dfb0336f0a791071ef458" dependencies = [ "itertools 0.12.1", "p3-field", @@ -7256,7 +7296,7 @@ dependencies = [ [[package]] name = "p3-maybe-rayon" version = "0.1.0" -source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1-new#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1#03f2b272e1b33ed91f8dfb0336f0a791071ef458" dependencies = [ "rayon", ] @@ -7264,7 +7304,7 @@ dependencies = [ [[package]] name = "p3-mds" version = "0.1.0" -source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1-new#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1#03f2b272e1b33ed91f8dfb0336f0a791071ef458" dependencies = [ "itertools 0.12.1", "p3-dft", @@ -7278,7 +7318,7 @@ dependencies = [ [[package]] name = "p3-merkle-tree" version = "0.1.0" -source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1-new#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1#03f2b272e1b33ed91f8dfb0336f0a791071ef458" dependencies = [ "itertools 0.12.1", "p3-commit", @@ -7294,7 +7334,7 @@ dependencies = [ [[package]] name = "p3-poseidon2" version = "0.1.0" -source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1-new#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1#03f2b272e1b33ed91f8dfb0336f0a791071ef458" dependencies = [ "gcd", "p3-field", @@ -7306,7 +7346,7 @@ dependencies = [ [[package]] name = "p3-symmetric" version = "0.1.0" -source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1-new#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1#03f2b272e1b33ed91f8dfb0336f0a791071ef458" dependencies = [ "itertools 0.12.1", "p3-field", @@ -7316,7 +7356,7 @@ dependencies = [ [[package]] name = "p3-uni-stark" version = "0.1.0" -source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1-new#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1#03f2b272e1b33ed91f8dfb0336f0a791071ef458" dependencies = [ "itertools 0.12.1", "p3-air", @@ -7334,7 +7374,7 @@ dependencies = [ [[package]] name = "p3-util" version = "0.1.0" -source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1-new#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/lurk-lab/Plonky3.git?branch=sp1#03f2b272e1b33ed91f8dfb0336f0a791071ef458" dependencies = [ "serde", ] @@ -7517,6 +7557,25 @@ dependencies = [ "crypto-mac 0.8.0", ] +[[package]] +name = "pbkdf2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "pbkdf2" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" +dependencies = [ + "digest 0.10.7", + "hmac 0.12.1", +] + [[package]] name = "peeking_take_while" version = "0.1.2" @@ -7578,7 +7637,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -7602,6 +7661,16 @@ dependencies = [ "indexmap 1.9.3", ] +[[package]] +name = "pharos" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9567389417feee6ce15dd6527a8a1ecac205ef62c2932bcf3d9f6fc5b78b414" +dependencies = [ + "futures", + "rustc_version 0.4.0", +] + [[package]] name = "phf" version = "0.11.2" @@ -7657,7 +7726,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -7699,12 +7768,6 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" -[[package]] -name = "platforms" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db23d408679286588f4d4644f965003d056e3dd5abcaaa938116871d7ce2fee7" - [[package]] name = "plotters" version = "0.3.6" @@ -7783,7 +7846,7 @@ dependencies = [ "proc-macro-crate 2.0.2", "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -7886,7 +7949,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" dependencies = [ "proc-macro2", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -7906,7 +7969,7 @@ checksum = "05e4722c697a58a99d5d06a08c30821d7c082a4632198de1eaa5a6c22ef42373" dependencies = [ "fixed-hash 0.7.0", "impl-codec 0.5.1", - "impl-serde", + "impl-serde 0.3.2", "uint", ] @@ -7918,6 +7981,9 @@ checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" dependencies = [ "fixed-hash 0.8.0", "impl-codec 0.6.0", + "impl-rlp", + "impl-serde 0.4.0", + "scale-info", "uint", ] @@ -7979,9 +8045,9 @@ checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" [[package]] name = "proc-macro2" -version = "1.0.85" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -8027,7 +8093,7 @@ dependencies = [ "clap 4.5.7", "env_logger 0.11.3", "log", - "reqwest 0.12.4", + "reqwest 0.12.5", "serde", "serde_json", "sphinx-sdk", @@ -8038,9 +8104,9 @@ dependencies = [ [[package]] name = "proptest" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf" +checksum = "b4c2511913b88df1637da85cc8d96ec8e43a3f8bb8ccb71ee1ac240d6f3df58d" dependencies = [ "bit-set", "bit-vec", @@ -8087,7 +8153,7 @@ dependencies = [ "itertools 0.12.1", "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -8367,7 +8433,7 @@ checksum = "bcc303e793d3734489387d205e9b186fac9c6cfacedd98cbb2e8a5943595f3e6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -8460,9 +8526,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.12.4" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10" +checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37" dependencies = [ "base64 0.22.1", "bytes", @@ -8475,6 +8541,7 @@ dependencies = [ "http-body 1.0.0", "http-body-util", "hyper 1.3.1", + "hyper-rustls", "hyper-tls 0.6.0", "hyper-util", "ipnet", @@ -8489,7 +8556,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", - "sync_wrapper 0.1.2", + "sync_wrapper 1.0.1", "system-configuration", "tokio", "tokio-native-tls", @@ -8512,7 +8579,7 @@ dependencies = [ "anyhow", "async-trait", "http 1.1.0", - "reqwest 0.12.4", + "reqwest 0.12.5", "serde", "thiserror", "tower-service", @@ -8592,9 +8659,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" dependencies = [ "bytes", + "rlp-derive", "rustc-hex", ] +[[package]] +name = "rlp-derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e33d7b2abe0c340d8797fe2907d3f20d3b5ea5908683618bfe80df7f621f672a" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "rocksdb" version = "0.21.0" @@ -8611,7 +8690,7 @@ version = "0.1.0" source = "git+https://github.com/GregAC/rrs.git#b23afc16b4e6a1fb5c4a73eb1e337e9400816507" dependencies = [ "downcast-rs", - "num_enum", + "num_enum 0.5.11", "paste", ] @@ -8754,6 +8833,19 @@ dependencies = [ "zeroize", ] +[[package]] +name = "rustls" +version = "0.23.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05cff451f60db80f490f3c182b77c35260baace73209e9cdbbe526bfe3a4d402" +dependencies = [ + "once_cell", + "rustls-pki-types", + "rustls-webpki 0.102.4", + "subtle", + "zeroize", +] + [[package]] name = "rustls-native-certs" version = "0.7.0" @@ -8837,6 +8929,15 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" +[[package]] +name = "salsa20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" +dependencies = [ + "cipher", +] + [[package]] name = "same-file" version = "1.0.6" @@ -8846,6 +8947,30 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "scale-info" +version = "2.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c453e59a955f81fb62ee5d596b450383d699f152d350e9d23a0db2adb78e4c0" +dependencies = [ + "cfg-if", + "derive_more", + "parity-scale-codec 3.6.11", + "scale-info-derive", +] + +[[package]] +name = "scale-info-derive" +version = "2.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18cf6c6447f813ef19eb450e985bcce6705f9ce7660db221b59093d15c79c4b7" +dependencies = [ + "proc-macro-crate 1.3.1", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "scc" version = "2.1.1" @@ -8870,6 +8995,18 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "scrypt" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f9e24d2b632954ded8ab2ef9fea0a0c769ea56ea98bddbafbad22caeeadf45d" +dependencies = [ + "hmac 0.12.1", + "pbkdf2 0.11.0", + "salsa20", + "sha2 0.10.8", +] + [[package]] name = "sct" version = "0.7.1" @@ -8950,6 +9087,18 @@ dependencies = [ "pest", ] +[[package]] +name = "send_wrapper" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0" + +[[package]] +name = "send_wrapper" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" + [[package]] name = "serde" version = "1.0.203" @@ -9033,7 +9182,7 @@ checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -9117,7 +9266,7 @@ dependencies = [ "darling 0.20.9", "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -9167,7 +9316,7 @@ checksum = "82fe9db325bcef1fbcde82e078a5cc4efdf787e96b3b9cf45b50b529f2083d67" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -9462,7 +9611,7 @@ dependencies = [ [[package]] name = "sphinx-core" version = "0.1.0" -source = "git+ssh://git@github.com/lurk-lab/sphinx?branch=dev#785d0e01c92133152fe534bb181f2f80ef180d78" +source = "git+ssh://git@github.com/lurk-lab/sphinx?branch=plonk-rebased#8d0b36e42fe23ed75231f0340f2f2f15be1a2680" dependencies = [ "anyhow", "arrayref", @@ -9470,9 +9619,10 @@ dependencies = [ "blake3", "bls12_381 0.8.0", "cfg-if", - "curve25519-dalek 4.1.2", + "curve25519-dalek 4.1.3", "elf", "elliptic-curve", + "hashbrown 0.14.5", "hex", "hybrid-array", "itertools 0.12.1", @@ -9500,6 +9650,7 @@ dependencies = [ "p3-symmetric", "p3-uni-stark", "p3-util", + "rand 0.8.5", "rayon-scan", "rrs-lib", "serde", @@ -9508,7 +9659,7 @@ dependencies = [ "size", "sphinx-derive", "sphinx-primitives", - "strum 0.26.2", + "strum 0.26.3", "strum_macros 0.26.4", "tempfile", "thiserror", @@ -9521,7 +9672,7 @@ dependencies = [ [[package]] name = "sphinx-derive" version = "0.1.0" -source = "git+ssh://git@github.com/lurk-lab/sphinx?branch=dev#785d0e01c92133152fe534bb181f2f80ef180d78" +source = "git+ssh://git@github.com/lurk-lab/sphinx?branch=plonk-rebased#8d0b36e42fe23ed75231f0340f2f2f15be1a2680" dependencies = [ "proc-macro2", "quote", @@ -9531,7 +9682,7 @@ dependencies = [ [[package]] name = "sphinx-helper" version = "0.1.0" -source = "git+ssh://git@github.com/lurk-lab/sphinx?branch=dev#785d0e01c92133152fe534bb181f2f80ef180d78" +source = "git+ssh://git@github.com/lurk-lab/sphinx?branch=plonk-rebased#8d0b36e42fe23ed75231f0340f2f2f15be1a2680" dependencies = [ "cargo_metadata 0.18.1", "chrono", @@ -9540,7 +9691,7 @@ dependencies = [ [[package]] name = "sphinx-primitives" version = "0.1.0" -source = "git+ssh://git@github.com/lurk-lab/sphinx?branch=dev#785d0e01c92133152fe534bb181f2f80ef180d78" +source = "git+ssh://git@github.com/lurk-lab/sphinx?branch=plonk-rebased#8d0b36e42fe23ed75231f0340f2f2f15be1a2680" dependencies = [ "itertools 0.12.1", "lazy_static", @@ -9553,7 +9704,7 @@ dependencies = [ [[package]] name = "sphinx-prover" version = "0.1.0" -source = "git+ssh://git@github.com/lurk-lab/sphinx?branch=dev#785d0e01c92133152fe534bb181f2f80ef180d78" +source = "git+ssh://git@github.com/lurk-lab/sphinx?branch=plonk-rebased#8d0b36e42fe23ed75231f0340f2f2f15be1a2680" dependencies = [ "anyhow", "backtrace", @@ -9571,7 +9722,7 @@ dependencies = [ "p3-commit", "p3-field", "rayon", - "reqwest 0.12.4", + "reqwest 0.12.5", "serde", "serde_json", "serial_test", @@ -9584,6 +9735,7 @@ dependencies = [ "sphinx-recursion-core", "sphinx-recursion-gnark-ffi", "sphinx-recursion-program", + "subtle-encoding", "tempfile", "thiserror", "tokio", @@ -9594,7 +9746,7 @@ dependencies = [ [[package]] name = "sphinx-recursion-circuit" version = "0.1.0" -source = "git+ssh://git@github.com/lurk-lab/sphinx?branch=dev#785d0e01c92133152fe534bb181f2f80ef180d78" +source = "git+ssh://git@github.com/lurk-lab/sphinx?branch=plonk-rebased#8d0b36e42fe23ed75231f0340f2f2f15be1a2680" dependencies = [ "bincode", "itertools 0.12.1", @@ -9617,9 +9769,10 @@ dependencies = [ [[package]] name = "sphinx-recursion-compiler" version = "0.1.0" -source = "git+ssh://git@github.com/lurk-lab/sphinx?branch=dev#785d0e01c92133152fe534bb181f2f80ef180d78" +source = "git+ssh://git@github.com/lurk-lab/sphinx?branch=plonk-rebased#8d0b36e42fe23ed75231f0340f2f2f15be1a2680" dependencies = [ "backtrace", + "hashbrown 0.14.5", "itertools 0.12.1", "p3-air", "p3-baby-bear", @@ -9641,7 +9794,7 @@ dependencies = [ [[package]] name = "sphinx-recursion-core" version = "0.1.0" -source = "git+ssh://git@github.com/lurk-lab/sphinx?branch=dev#785d0e01c92133152fe534bb181f2f80ef180d78" +source = "git+ssh://git@github.com/lurk-lab/sphinx?branch=plonk-rebased#8d0b36e42fe23ed75231f0340f2f2f15be1a2680" dependencies = [ "arrayref", "backtrace", @@ -9674,7 +9827,7 @@ dependencies = [ [[package]] name = "sphinx-recursion-derive" version = "0.1.0" -source = "git+ssh://git@github.com/lurk-lab/sphinx?branch=dev#785d0e01c92133152fe534bb181f2f80ef180d78" +source = "git+ssh://git@github.com/lurk-lab/sphinx?branch=plonk-rebased#8d0b36e42fe23ed75231f0340f2f2f15be1a2680" dependencies = [ "proc-macro2", "quote", @@ -9684,16 +9837,19 @@ dependencies = [ [[package]] name = "sphinx-recursion-gnark-ffi" version = "0.1.0" -source = "git+ssh://git@github.com/lurk-lab/sphinx?branch=dev#785d0e01c92133152fe534bb181f2f80ef180d78" +source = "git+ssh://git@github.com/lurk-lab/sphinx?branch=plonk-rebased#8d0b36e42fe23ed75231f0340f2f2f15be1a2680" dependencies = [ "bindgen 0.69.4", + "cfg-if", "log", "num-bigint 0.4.5", "p3-baby-bear", "p3-field", + "p3-symmetric", "rand 0.8.5", "serde", "serde_json", + "sphinx-core", "sphinx-recursion-compiler", "tempfile", ] @@ -9701,7 +9857,7 @@ dependencies = [ [[package]] name = "sphinx-recursion-program" version = "0.1.0" -source = "git+ssh://git@github.com/lurk-lab/sphinx?branch=dev#785d0e01c92133152fe534bb181f2f80ef180d78" +source = "git+ssh://git@github.com/lurk-lab/sphinx?branch=plonk-rebased#8d0b36e42fe23ed75231f0340f2f2f15be1a2680" dependencies = [ "itertools 0.12.1", "p3-air", @@ -9728,15 +9884,18 @@ dependencies = [ [[package]] name = "sphinx-sdk" version = "0.1.0" -source = "git+ssh://git@github.com/lurk-lab/sphinx?branch=dev#785d0e01c92133152fe534bb181f2f80ef180d78" +source = "git+ssh://git@github.com/lurk-lab/sphinx?branch=plonk-rebased#8d0b36e42fe23ed75231f0340f2f2f15be1a2680" dependencies = [ - "alloy", + "alloy-sol-types", "anyhow", "async-trait", "axum 0.7.5", "bincode", + "cfg-if", + "ethers", "futures", "hex", + "home", "indicatif", "log", "num-bigint 0.4.5", @@ -9744,13 +9903,15 @@ dependencies = [ "p3-field", "p3-matrix", "prost", - "reqwest 0.12.4", + "reqwest 0.12.5", "reqwest-middleware", "serde", "serde_json", "sha2 0.10.8", "sphinx-core", "sphinx-prover", + "strum 0.26.3", + "strum_macros 0.26.4", "tempfile", "tokio", "tracing", @@ -9867,9 +10028,12 @@ dependencies = [ [[package]] name = "strum" -version = "0.26.2" +version = "0.26.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d8cec3501a5194c432b2b7976db6b7d10ec95c253208b45f83f7136aa985e29" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" +dependencies = [ + "strum_macros 0.26.4", +] [[package]] name = "strum_macros" @@ -9894,7 +10058,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -9907,14 +10071,23 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] name = "subtle" -version = "2.5.0" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d0208408ba0c3df17ed26eb06992cb1a1268d41b2c0e12e65203fbe3972cee5" + +[[package]] +name = "subtle-encoding" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +checksum = "7dcb1ed7b8330c5eed5441052651dd7a12c75e2ed88f2ec024ae1fa3a5e59945" +dependencies = [ + "zeroize", +] [[package]] name = "subtle-ng" @@ -9935,9 +10108,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.66" +version = "2.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5" +checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" dependencies = [ "proc-macro2", "quote", @@ -9953,7 +10126,7 @@ dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -9968,17 +10141,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" -[[package]] -name = "synstructure" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.66", -] - [[package]] name = "sysinfo" version = "0.28.4" @@ -10117,7 +10279,7 @@ checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -10181,7 +10343,7 @@ dependencies = [ "anyhow", "hmac 0.8.1", "once_cell", - "pbkdf2", + "pbkdf2 0.4.0", "rand 0.7.3", "rustc-hash", "sha2 0.9.9", @@ -10200,16 +10362,6 @@ dependencies = [ "crunchy", ] -[[package]] -name = "tinystr" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" -dependencies = [ - "displaydoc", - "zerovec", -] - [[package]] name = "tinytemplate" version = "1.2.1" @@ -10272,7 +10424,7 @@ checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -10306,6 +10458,17 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-rustls" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" +dependencies = [ + "rustls 0.23.10", + "rustls-pki-types", + "tokio", +] + [[package]] name = "tokio-stream" version = "0.1.15" @@ -10315,7 +10478,6 @@ dependencies = [ "futures-core", "pin-project-lite", "tokio", - "tokio-util", ] [[package]] @@ -10343,6 +10505,18 @@ dependencies = [ "toml_edit 0.19.15", ] +[[package]] +name = "toml" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "185d8ab0dfbb35cf1399a6344d8484209c088f75f8f68230da55d48d95d43e3d" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit 0.20.2", +] + [[package]] name = "toml_datetime" version = "0.6.3" @@ -10362,7 +10536,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "winnow 0.5.40", + "winnow", ] [[package]] @@ -10372,8 +10546,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" dependencies = [ "indexmap 2.2.6", + "serde", + "serde_spanned", "toml_datetime", - "winnow 0.5.40", + "winnow", ] [[package]] @@ -10474,7 +10650,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -10500,6 +10676,16 @@ dependencies = [ "tracing-subscriber 0.3.18", ] +[[package]] +name = "tracing-futures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" +dependencies = [ + "pin-project", + "tracing", +] + [[package]] name = "tracing-log" version = "0.2.0" @@ -10564,9 +10750,9 @@ dependencies = [ [[package]] name = "triomphe" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b2cb4fbb9995eeb36ac86fadf24031ccd58f99d6b4b2d7b911db70bddb80d90" +checksum = "e6631e42e10b40c0690bf92f404ebcfe6e1fdb480391d15f17cc8e96eeed5369" dependencies = [ "serde", "stable_deref_trait", @@ -10594,7 +10780,7 @@ dependencies = [ [[package]] name = "twirp" version = "0.3.0" -source = "git+https://github.com/github/twirp-rs.git#e18a3cfb30853250213d4bdc486a9fb8f5ac9bd4" +source = "git+https://github.com/github/twirp-rs.git?rev=c85f31f9c54957374e7dcb3534fc52cff0aa2dc5#c85f31f9c54957374e7dcb3534fc52cff0aa2dc5" dependencies = [ "async-trait", "axum 0.7.5", @@ -10604,7 +10790,7 @@ dependencies = [ "http-body-util", "hyper 1.3.1", "prost", - "reqwest 0.12.4", + "reqwest 0.12.5", "serde", "serde_json", "thiserror", @@ -10644,7 +10830,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a615d6c2764852a2e88a4f16e9ce1ea49bb776b5872956309e170d63a042a34f" dependencies = [ "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -10861,12 +11047,12 @@ dependencies = [ [[package]] name = "url" -version = "2.5.1" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7c25da092f0a868cdf09e8674cd3b7ef3a7d92a24253e663a2fb85e2496de56" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" dependencies = [ "form_urlencoded", - "idna 1.0.0", + "idna 0.5.0", "percent-encoding", "serde", ] @@ -10887,24 +11073,22 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "utf16_iter" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" - -[[package]] -name = "utf8_iter" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" - [[package]] name = "utf8parse" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" +[[package]] +name = "uuid" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" +dependencies = [ + "getrandom 0.2.15", + "serde", +] + [[package]] name = "valuable" version = "0.1.0" @@ -11018,7 +11202,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", "wasm-bindgen-shared", ] @@ -11052,7 +11236,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -11391,15 +11575,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "winnow" -version = "0.6.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59b5e5f6c299a3c7890b876a2a587f3115162487e704907d9b6cd29473052ba1" -dependencies = [ - "memchr", -] - [[package]] name = "winreg" version = "0.50.0" @@ -11421,16 +11596,23 @@ dependencies = [ ] [[package]] -name = "write16" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" - -[[package]] -name = "writeable" -version = "0.5.5" +name = "ws_stream_wasm" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" +checksum = "7999f5f4217fe3818726b66257a4475f71e74ffd190776ad053fa159e50737f5" +dependencies = [ + "async_io_stream", + "futures", + "js-sys", + "log", + "pharos", + "rustc_version 0.4.0", + "send_wrapper 0.6.0", + "thiserror", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] [[package]] name = "wyz" @@ -11472,30 +11654,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" -[[package]] -name = "yoke" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5" -dependencies = [ - "serde", - "stable_deref_trait", - "yoke-derive", - "zerofrom", -] - -[[package]] -name = "yoke-derive" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.66", - "synstructure", -] - [[package]] name = "zerocopy" version = "0.7.34" @@ -11513,28 +11671,7 @@ checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", -] - -[[package]] -name = "zerofrom" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55" -dependencies = [ - "zerofrom-derive", -] - -[[package]] -name = "zerofrom-derive" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.66", - "synstructure", + "syn 2.0.68", ] [[package]] @@ -11554,29 +11691,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", -] - -[[package]] -name = "zerovec" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2cc8827d6c0994478a15c53f374f46fbd41bea663d809b14744bc42e6b109c" -dependencies = [ - "yoke", - "zerofrom", - "zerovec-derive", -] - -[[package]] -name = "zerovec-derive" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97cf56601ee5052b4417d90c8755c6683473c926039908196cf35d99f893ebe7" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -11626,9 +11741,9 @@ dependencies = [ [[package]] name = "zstd-sys" -version = "2.0.10+zstd.1.5.6" +version = "2.0.11+zstd.1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c253a4914af5bafc8fa8c86ee400827e83cf6ec01195ec1f1ed8441bf00d65aa" +checksum = "75652c55c0b6f3e6f12eb786fe1bc960396bf05a1eb3bf1f3691c3610ac2e6d4" dependencies = [ "cc", "pkg-config", diff --git a/aptos/Cargo.toml b/aptos/Cargo.toml index 88266141..54f97be2 100644 --- a/aptos/Cargo.toml +++ b/aptos/Cargo.toml @@ -6,6 +6,7 @@ members = [ "light-client", "aptos-programs", "proof-server", + "solidity/fixture-generator", ] [workspace.dependencies] @@ -46,9 +47,10 @@ thiserror = "1.0.58" tiny-keccak = "2.0.2" url = "2.5.0" sphinx-derive = { git = "ssh://git@github.com/lurk-lab/sphinx", branch = "dev" } -sphinx-sdk = { git = "ssh://git@github.com/lurk-lab/sphinx", branch = "dev" } +sphinx-sdk = { git = "ssh://git@github.com/lurk-lab/sphinx", branch = "dev", features = ["plonk"] } sphinx-zkvm = { git = "ssh://git@github.com/lurk-lab/sphinx", branch = "dev" } sphinx-helper = { git = "ssh://git@github.com/lurk-lab/sphinx", branch = "dev" } +sphinx-prover = { git = "ssh://git@github.com/lurk-lab/sphinx", branch = "dev" } tokio = "1.37" tokio-stream = "0.1" diff --git a/aptos/README.md b/aptos/README.md index 93142f87..84994bab 100644 --- a/aptos/README.md +++ b/aptos/README.md @@ -36,7 +36,7 @@ generated in two ways: - Automated: There is a build script located at `./aptos-programs/build.rs` that will compile all the programs and place them in the `./aptos-programs/artifacts` - folder. + folder. To enable this feature, it is needed to set the environment variable `LC_PROGRAM_AUTOBUILD=1`. - Manual: You can also compile the programs manually using `make` by running the following command in the `./aptos-programs` folder: ```shell diff --git a/aptos/aptos-programs/artifacts/epoch-change-program b/aptos/aptos-programs/artifacts/epoch-change-program index ebcd43dc..ca31234a 100755 Binary files a/aptos/aptos-programs/artifacts/epoch-change-program and b/aptos/aptos-programs/artifacts/epoch-change-program differ diff --git a/aptos/aptos-programs/build.rs b/aptos/aptos-programs/build.rs index 7b49d686..de14a5fe 100644 --- a/aptos/aptos-programs/build.rs +++ b/aptos/aptos-programs/build.rs @@ -10,6 +10,14 @@ const PROGRAM_PATTERNS: [&str; 2] = ["../programs/*", "../programs/benchmarks/*" const TARGET_DIR: [&str; 2] = ["./artifacts", "./artifacts/benchmarks"]; fn main() { + // Get `LC_PROGRAM_AUTOBUILD` env variable, default to 0 + let should_build: bool = + std::env::var("LC_PROGRAM_AUTOBUILD").unwrap_or_else(|_| "0".into()) == "1"; + + if !should_build { + return; + } + // Re-run if the core library changes let core_dir = std::path::Path::new("../core"); println!("cargo:rerun-if-changed={}", core_dir.display()); diff --git a/aptos/docs/src/SUMMARY.md b/aptos/docs/src/SUMMARY.md index f83941bd..394c1692 100644 --- a/aptos/docs/src/SUMMARY.md +++ b/aptos/docs/src/SUMMARY.md @@ -38,6 +38,7 @@ This section goes over how to run the benchmarks to measure the performances of - [Configuration](./benchmark/configuration.md) - [Benchmarks individual proofs](./benchmark/proof.md) - [E2E benchmarks](./benchmark/e2e.md) +- [On-chain verification benchmarks](./benchmark/on_chain.md) # Miscellaneous diff --git a/aptos/docs/src/benchmark/on_chain.md b/aptos/docs/src/benchmark/on_chain.md new file mode 100644 index 00000000..613c1eae --- /dev/null +++ b/aptos/docs/src/benchmark/on_chain.md @@ -0,0 +1,75 @@ +# Benchmark on-chain verification + +Our Light Client is able to produce SNARK proofs that can be verified on-chain. This section will cover how to run the +benchmarks for the on-chain verification. + +To be able to execute such tests our repository contains a project called `solidity` is based +off [Foundry](https://github.com/foundry-rs/foundry) which demonstrates the Solidity verification using so-called +fixtures (JSON files) containing the proof data (proof itself, public values and verification key) required for running +the verification for both epoch-change and inclusion programs. + +The contracts used for testing can be found in the [sphinx-contracts](https://github.com/lurk-lab/sphinx-contracts) +repository which is used as a dependency. + +## Requirements + +Make sure that you have properly set up the `sphinx-contracts` submodule. If you haven't done so, you can do it by +running the following command: + +```bash +git submodule update --init --recursive +``` + +## Run the tests + +To run the tests, navigate to the `solidity/contracts` directory and execute the following command: + +```bash +cd solidity/contracts && \ + forge test +``` + +The output should look like this: + +``` +% cd solidity/contracts && forge test +[⠊] Compiling... +[⠒] Compiling 29 files with Solc 0.8.26 +[⠢] Solc 0.8.26 finished in 1.11s +Compiler run successful! + +Ran 4 tests for test/test_lc_proofs.sol:SolidityVerificationTest +[PASS] testFail_FakeProofEpochChange() (gas: 8660281895700906413) +[PASS] testFail_FakeProofInclusion() (gas: 8660281895700906417) +[PASS] testValidEpochChangeProofPlonk() (gas: 318056) +[PASS] testValidInclusionProofPlonk() (gas: 318103) +Suite result: ok. 4 passed; 0 failed; 0 skipped; finished in 12.52ms (15.70ms CPU time) + +Ran 1 test suite in 154.07ms (12.52ms CPU time): 4 tests passed, 0 failed, 0 skipped (4 total tests) +``` + +Currently, the verification of Plonk proof (either epoch-change or inclusion program) costs ~318k gas. + +## Fixture generation + +If you wish to either run the tests with custom fixtures or regenerate the existing ones, you can do so by running the +`fixture-generator` Rust program. This program will run the end-to-end proving (either epoch-change or inclusion) and +export the fixture file to the relevant place (`solidity/contracts/src/plonk_fixtures`). + +To run the `fixture-generator` for the inclusion program, execute the following command: + +```bash +RUST_LOG=info RUSTFLAGS="-C target-cpu=native --cfg tokio_unstable" SHARD_SIZE=4194304 SHARD_BATCH_SIZE=0 cargo +nightly run --release --features aptos --bin generate-fixture -- --program inclusion +``` + +> **Tips** +> +> Check that the fixtures have been updated by running `git status`. + +> **Note** +> +> You might be encountering issue with updating `sphinx-contracts` Foundry dependency, in this case try manually +> specifying accessing the submodule via SSH +> ``` +> git config submodule.aptos/solidity/contracts/lib/sphinx-contracts.url git@github.com:lurk-lab/sphinx-contracts +> ``` \ No newline at end of file diff --git a/aptos/light-client/Cargo.toml b/aptos/light-client/Cargo.toml index d5d245d7..d3b6dc47 100644 --- a/aptos/light-client/Cargo.toml +++ b/aptos/light-client/Cargo.toml @@ -18,10 +18,10 @@ anyhow = { workspace = true } getset = { workspace = true } serde = { workspace = true, features = ["derive", "rc"] } thiserror = { workspace = true } +bcs = { workspace = true } [dev-dependencies] aptos-programs = { path = "../aptos-programs", features = ["bench"] } -bcs = { workspace = true } cfg-if = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } diff --git a/aptos/light-client/benches/e2e.rs b/aptos/light-client/benches/e2e.rs index cc6f2c90..3a529c00 100644 --- a/aptos/light-client/benches/e2e.rs +++ b/aptos/light-client/benches/e2e.rs @@ -28,7 +28,7 @@ use aptos_lc_core::types::trusted_state::{EpochChangeProof, TrustedState, Truste use aptos_lc_core::types::validator::ValidatorVerifier; use serde::Serialize; use sphinx_sdk::utils::setup_logger; -use sphinx_sdk::{ProverClient, SphinxGroth16Proof, SphinxProof, SphinxStdin}; +use sphinx_sdk::{ProverClient, SphinxPlonkBn254Proof, SphinxProof, SphinxStdin}; use std::env; use std::time::Instant; @@ -50,7 +50,7 @@ struct BenchmarkResults { enum ProofType { #[allow(dead_code)] - Snark(SphinxGroth16Proof), + Snark(SphinxPlonkBn254Proof), Stark(SphinxProof), } @@ -250,7 +250,7 @@ fn prove_epoch_change( let (pk, _) = client.setup(aptos_programs::EPOCH_CHANGE_PROGRAM); if snark { - Snark(client.prove_groth16(&pk, stdin).unwrap()) + Snark(client.prove_plonk(&pk, stdin).unwrap()) } else { Stark(client.prove(&pk, stdin).unwrap()) } @@ -284,7 +284,7 @@ fn prove_inclusion( let (pk, _) = client.setup(aptos_programs::INCLUSION_PROGRAM); if snark { - Snark(client.prove_groth16(&pk, stdin).unwrap()) + Snark(client.prove_plonk(&pk, stdin).unwrap()) } else { Stark(client.prove(&pk, stdin).unwrap()) } diff --git a/aptos/light-client/src/epoch_change.rs b/aptos/light-client/src/epoch_change.rs index 2e5a9244..743f2eda 100644 --- a/aptos/light-client/src/epoch_change.rs +++ b/aptos/light-client/src/epoch_change.rs @@ -12,6 +12,38 @@ struct EpochChangeOutput { new_validator_verifier_hash: [u8; 32], } +#[cfg(feature = "aptos")] +pub fn setup_assets() -> (Vec, Vec, Vec) { + use aptos_lc_core::aptos_test_utils::wrapper::AptosWrapper; + use aptos_lc_core::crypto::hash::CryptoHash; + + const NBR_VALIDATORS: usize = 130; + const AVERAGE_SIGNERS_NBR: usize = 95; + + let mut aptos_wrapper = AptosWrapper::new(20000, NBR_VALIDATORS, AVERAGE_SIGNERS_NBR).unwrap(); + + let trusted_state = bcs::to_bytes(aptos_wrapper.trusted_state()).unwrap(); + let validator_verifier_hash = + match aptos_lc_core::types::trusted_state::TrustedState::from_bytes(&trusted_state).unwrap() + { + aptos_lc_core::types::trusted_state::TrustedState::EpochState { + epoch_state, .. + } => epoch_state.verifier().hash().to_vec(), + _ => panic!("Expected epoch change for current trusted state"), + }; + let trusted_state_version = *aptos_wrapper.current_version(); + + aptos_wrapper.generate_traffic().unwrap(); + + let state_proof = aptos_wrapper + .new_state_proof(trusted_state_version) + .unwrap(); + + let epoch_change_proof = bcs::to_bytes(state_proof.epoch_changes()).unwrap(); + + (trusted_state, epoch_change_proof, validator_verifier_hash) +} + pub fn generate_stdin(current_trusted_state: &[u8], epoch_change_proof: &[u8]) -> SphinxStdin { let mut stdin = SphinxStdin::new(); stdin.write(¤t_trusted_state); @@ -57,6 +89,7 @@ fn prove_epoch_change( #[cfg(all(test, feature = "aptos"))] mod test { + use crate::epoch_change::setup_assets; use crate::error::LightClientError; use sphinx_sdk::utils::setup_logger; use sphinx_sdk::{ProverClient, SphinxStdin}; @@ -85,29 +118,13 @@ mod test { #[test] fn test_execute_epoch_change() { - use aptos_lc_core::aptos_test_utils::wrapper::AptosWrapper; use std::time::Instant; - const NBR_VALIDATORS: usize = 130; - const AVERAGE_SIGNERS_NBR: usize = 95; - - let mut aptos_wrapper = - AptosWrapper::new(20000, NBR_VALIDATORS, AVERAGE_SIGNERS_NBR).unwrap(); - - let trusted_state = bcs::to_bytes(aptos_wrapper.trusted_state()).unwrap(); - let trusted_state_version = *aptos_wrapper.current_version(); - - aptos_wrapper.generate_traffic().unwrap(); - - let state_proof = aptos_wrapper - .new_state_proof(trusted_state_version) - .unwrap(); - - let epoch_change_proof = &bcs::to_bytes(state_proof.epoch_changes()).unwrap(); + let (trusted_state, epoch_change_proof, _) = setup_assets(); println!("Starting execution of prove_epoch_change..."); let start = Instant::now(); - execute_epoch_change(&trusted_state, epoch_change_proof).unwrap(); + execute_epoch_change(&trusted_state, &epoch_change_proof).unwrap(); println!("Execution took {:?}", start.elapsed()); } @@ -115,39 +132,17 @@ mod test { #[ignore = "This test is too slow for CI"] fn test_prove_epoch_change() { use super::*; - use aptos_lc_core::aptos_test_utils::wrapper::AptosWrapper; - use aptos_lc_core::crypto::hash::CryptoHash; - use aptos_lc_core::types::trusted_state::TrustedState; use sphinx_sdk::ProverClient; use std::time::Instant; - const NBR_VALIDATORS: usize = 130; - const AVERAGE_SIGNERS_NBR: usize = 95; - - let mut aptos_wrapper = - AptosWrapper::new(20000, NBR_VALIDATORS, AVERAGE_SIGNERS_NBR).unwrap(); - - let trusted_state = bcs::to_bytes(aptos_wrapper.trusted_state()).unwrap(); - let validator_verifier_hash = match TrustedState::from_bytes(&trusted_state).unwrap() { - TrustedState::EpochState { epoch_state, .. } => epoch_state.verifier().hash().to_vec(), - _ => panic!("Expected epoch change for current trusted state"), - }; - let trusted_state_version = *aptos_wrapper.current_version(); - - aptos_wrapper.generate_traffic().unwrap(); - - let state_proof = aptos_wrapper - .new_state_proof(trusted_state_version) - .unwrap(); - - let epoch_change_proof = &bcs::to_bytes(state_proof.epoch_changes()).unwrap(); + let (trusted_state, epoch_change_proof, validator_verifier_hash) = setup_assets(); let client = ProverClient::new(); let start = Instant::now(); println!("Starting generation of prove_epoch_change proof..."); let (proof, output) = - prove_epoch_change(&client, &trusted_state, epoch_change_proof).unwrap(); + prove_epoch_change(&client, &trusted_state, &epoch_change_proof).unwrap(); println!("Proving took {:?}", start.elapsed()); assert_eq!( @@ -164,49 +159,28 @@ mod test { #[test] #[ignore = "This test is too slow for CI"] - fn test_groth16_prove_epoch_change() { + fn test_snark_prove_epoch_change() { use super::*; - use aptos_lc_core::aptos_test_utils::wrapper::AptosWrapper; - use aptos_lc_core::crypto::hash::CryptoHash; - use aptos_lc_core::types::trusted_state::TrustedState; use sphinx_sdk::ProverClient; use std::time::Instant; setup_logger(); - const NBR_VALIDATORS: usize = 130; - const AVERAGE_SIGNERS_NBR: usize = 95; - - let mut aptos_wrapper = AptosWrapper::new(5, NBR_VALIDATORS, AVERAGE_SIGNERS_NBR).unwrap(); - - let trusted_state = bcs::to_bytes(aptos_wrapper.trusted_state()).unwrap(); - let _validator_verifier_hash = match TrustedState::from_bytes(&trusted_state).unwrap() { - TrustedState::EpochState { epoch_state, .. } => epoch_state.verifier().hash().to_vec(), - _ => panic!("Expected epoch change for current trusted state"), - }; - let trusted_state_version = *aptos_wrapper.current_version(); - - aptos_wrapper.generate_traffic().unwrap(); - - let state_proof = aptos_wrapper - .new_state_proof(trusted_state_version) - .unwrap(); - - let epoch_change_proof = &bcs::to_bytes(state_proof.epoch_changes()).unwrap(); + let (trusted_state, epoch_change_proof, _) = setup_assets(); let client = ProverClient::new(); let (pk, vk) = client.setup(aptos_programs::EPOCH_CHANGE_PROGRAM); - let stdin = generate_stdin(trusted_state.as_slice(), epoch_change_proof); + let stdin = generate_stdin(trusted_state.as_slice(), &epoch_change_proof); let start = Instant::now(); println!("Starting generation of prove_epoch_change proof..."); - let groth16proof = client.prove_groth16(&pk, stdin).unwrap(); + let snark_proof = client.prove_plonk(&pk, stdin).unwrap(); println!("Proving took {:?}", start.elapsed()); let start = Instant::now(); println!("Starting verification of prove_epoch_change proof..."); - client.verify_groth16(&groth16proof, &vk).unwrap(); + client.verify_plonk(&snark_proof, &vk).unwrap(); println!("Verification took {:?}", start.elapsed()); } } diff --git a/aptos/light-client/src/inclusion.rs b/aptos/light-client/src/inclusion.rs index 690a2fef..7891f543 100644 --- a/aptos/light-client/src/inclusion.rs +++ b/aptos/light-client/src/inclusion.rs @@ -67,6 +67,64 @@ impl ValidatorVerifierAssets { } } +#[cfg(feature = "aptos")] +pub fn setup_assets() -> ( + SparseMerkleProofAssets, + TransactionProofAssets, + ValidatorVerifierAssets, +) { + use aptos_lc_core::aptos_test_utils::wrapper::AptosWrapper; + use aptos_lc_core::types::trusted_state::TrustedState; + + const NBR_VALIDATORS: usize = 130; + const AVERAGE_SIGNERS_NBR: usize = 95; + + let mut aptos_wrapper = AptosWrapper::new(500, NBR_VALIDATORS, AVERAGE_SIGNERS_NBR).unwrap(); + aptos_wrapper.generate_traffic().unwrap(); + + let proof_assets = aptos_wrapper.get_latest_proof_account(400).unwrap(); + + let sparse_merkle_proof = bcs::to_bytes(proof_assets.state_proof()).unwrap(); + let key: [u8; 32] = *proof_assets.key().as_ref(); + let element_hash: [u8; 32] = *proof_assets.state_value_hash().unwrap().as_ref(); + + let transaction = bcs::to_bytes(&proof_assets.transaction()).unwrap(); + let transaction_proof = bcs::to_bytes(&proof_assets.transaction_proof()).unwrap(); + + let latest_li = aptos_wrapper.get_latest_li_bytes().unwrap(); + + let validator_verifier = + match TrustedState::from_bytes(&bcs::to_bytes(&aptos_wrapper.trusted_state()).unwrap()) + .unwrap() + { + TrustedState::EpochState { epoch_state, .. } => epoch_state.verifier().clone(), + _ => panic!("expected epoch state"), + }; + + let sparse_merkle_proof_assets = SparseMerkleProofAssets { + sparse_merkle_proof, + leaf_key: key, + leaf_hash: element_hash, + }; + + let transaction_proof_assets = TransactionProofAssets { + transaction, + transaction_index: *proof_assets.transaction_version(), + transaction_proof, + latest_li, + }; + + let validator_verifier_assets = ValidatorVerifierAssets { + validator_verifier: validator_verifier.to_bytes(), + }; + + ( + sparse_merkle_proof_assets, + transaction_proof_assets, + validator_verifier_assets, + ) +} + pub fn generate_stdin( sparse_merkle_proof_assets: &SparseMerkleProofAssets, transaction_proof_assets: &TransactionProofAssets, @@ -141,70 +199,12 @@ fn prove_inclusion( mod test { use crate::error::LightClientError; use crate::inclusion::{ - SparseMerkleProofAssets, TransactionProofAssets, ValidatorVerifierAssets, + setup_assets, SparseMerkleProofAssets, TransactionProofAssets, ValidatorVerifierAssets, }; use aptos_lc_core::types::validator::ValidatorVerifier; use sphinx_sdk::utils::setup_logger; use sphinx_sdk::{ProverClient, SphinxStdin}; - fn setup_assets() -> ( - SparseMerkleProofAssets, - TransactionProofAssets, - ValidatorVerifierAssets, - ) { - use aptos_lc_core::aptos_test_utils::wrapper::AptosWrapper; - use aptos_lc_core::types::trusted_state::TrustedState; - - const NBR_VALIDATORS: usize = 130; - const AVERAGE_SIGNERS_NBR: usize = 95; - - let mut aptos_wrapper = - AptosWrapper::new(500, NBR_VALIDATORS, AVERAGE_SIGNERS_NBR).unwrap(); - aptos_wrapper.generate_traffic().unwrap(); - - let proof_assets = aptos_wrapper.get_latest_proof_account(400).unwrap(); - - let sparse_merkle_proof = bcs::to_bytes(proof_assets.state_proof()).unwrap(); - let key: [u8; 32] = *proof_assets.key().as_ref(); - let element_hash: [u8; 32] = *proof_assets.state_value_hash().unwrap().as_ref(); - - let transaction = bcs::to_bytes(&proof_assets.transaction()).unwrap(); - let transaction_proof = bcs::to_bytes(&proof_assets.transaction_proof()).unwrap(); - - let latest_li = aptos_wrapper.get_latest_li_bytes().unwrap(); - - let validator_verifier = - match TrustedState::from_bytes(&bcs::to_bytes(&aptos_wrapper.trusted_state()).unwrap()) - .unwrap() - { - TrustedState::EpochState { epoch_state, .. } => epoch_state.verifier().clone(), - _ => panic!("expected epoch state"), - }; - - let sparse_merkle_proof_assets = SparseMerkleProofAssets { - sparse_merkle_proof, - leaf_key: key, - leaf_hash: element_hash, - }; - - let transaction_proof_assets = TransactionProofAssets { - transaction, - transaction_index: *proof_assets.transaction_version(), - transaction_proof, - latest_li, - }; - - let validator_verifier_assets = ValidatorVerifierAssets { - validator_verifier: validator_verifier.to_bytes(), - }; - - ( - sparse_merkle_proof_assets, - transaction_proof_assets, - validator_verifier_assets, - ) - } - fn execute_inclusion( sparse_merkle_proof_assets: &SparseMerkleProofAssets, transaction_proof_assets: &TransactionProofAssets, @@ -298,7 +298,7 @@ mod test { #[test] #[ignore = "This test is too slow for CI"] - fn test_groth16_prove_inclusion() { + fn test_snark_prove_inclusion() { use super::*; use sphinx_sdk::ProverClient; use std::time::Instant; @@ -319,12 +319,12 @@ mod test { let start = Instant::now(); println!("Starting generation of inclusion proof..."); - let groth16proof = client.prove_groth16(&pk, stdin).unwrap(); + let snark_proof = client.prove_plonk(&pk, stdin).unwrap(); println!("Proving took {:?}", start.elapsed()); let start = Instant::now(); println!("Starting verification of inclusion proof..."); - client.verify_groth16(&groth16proof, &vk).unwrap(); + client.verify_plonk(&snark_proof, &vk).unwrap(); println!("Verification took {:?}", start.elapsed()); } } diff --git a/aptos/light-client/src/sig.rs b/aptos/light-client/src/sig.rs index badb9931..c293e193 100644 --- a/aptos/light-client/src/sig.rs +++ b/aptos/light-client/src/sig.rs @@ -114,7 +114,7 @@ mod test { #[test] #[ignore = "This test is too slow for CI"] - fn test_groth16_prove_sig() { + fn test_snark_prove_sig() { use super::*; use aptos_lc_core::aptos_test_utils::wrapper::AptosWrapper; use sphinx_sdk::ProverClient; @@ -141,12 +141,12 @@ mod test { let start = Instant::now(); println!("Starting generation of signature verification proof..."); - let groth16proof = client.prove_groth16(&pk, stdin).unwrap(); + let snark_proof = client.prove_plonk(&pk, stdin).unwrap(); println!("Proving took {:?}", start.elapsed()); let start = Instant::now(); println!("Starting verification of signature verification proof..."); - client.verify_groth16(&groth16proof, &vk).unwrap(); + client.verify_plonk(&snark_proof, &vk).unwrap(); println!("Verification took {:?}", start.elapsed()); } } diff --git a/aptos/proof-server/benches/proof_server.rs b/aptos/proof-server/benches/proof_server.rs index ad8d60ae..bcbc1c39 100644 --- a/aptos/proof-server/benches/proof_server.rs +++ b/aptos/proof-server/benches/proof_server.rs @@ -39,28 +39,28 @@ const RUST_LOG: &str = "debug"; const RUSTFLAGS: &str = "-C target-cpu=native --cfg tokio_unstable"; fn main() -> Result<(), anyhow::Error> { - let groth16: bool = env::var("GROTH16").unwrap_or_else(|_| "0".into()) == "1"; + let final_snark: bool = env::var("SNARK").unwrap_or_else(|_| "0".into()) == "1"; let run_serially: bool = env::var("RUN_SERIAL").unwrap_or_else(|_| "0".into()) == "1"; let rt = Runtime::new().unwrap(); // Start secondary server - let mut secondary_server_process = rt.block_on(start_secondary_server(groth16))?; + let mut secondary_server_process = rt.block_on(start_secondary_server(final_snark))?; // Start primary server - let mut primary_server_process = rt.block_on(start_primary_server(groth16))?; + let mut primary_server_process = rt.block_on(start_primary_server(final_snark))?; // Join the benchmark tasks and block until they are done let (res_inclusion_proof, res_epoch_change_proof) = if run_serially { rt.block_on(async { - let inclusion_proof = bench_proving_inclusion(groth16).await; - let epoch_change_proof = bench_proving_epoch_change(groth16).await; + let inclusion_proof = bench_proving_inclusion(final_snark).await; + let epoch_change_proof = bench_proving_epoch_change(final_snark).await; (Ok(inclusion_proof), Ok(epoch_change_proof)) }) } else { rt.block_on(async { - let inclusion_proof_task = tokio::spawn(bench_proving_inclusion(groth16)); - let epoch_change_proof_task = tokio::spawn(bench_proving_epoch_change(groth16)); + let inclusion_proof_task = tokio::spawn(bench_proving_inclusion(final_snark)); + let epoch_change_proof_task = tokio::spawn(bench_proving_epoch_change(final_snark)); let inclusion_proof = inclusion_proof_task.await.map_err(|e| anyhow!(e)); let epoch_change_proof = epoch_change_proof_task.await.map_err(|e| anyhow!(e)); @@ -93,13 +93,13 @@ fn main() -> Result<(), anyhow::Error> { Ok(()) } -async fn start_primary_server(groth16: bool) -> Result { +async fn start_primary_server(final_snark: bool) -> Result { let primary_addr = env::var("PRIMARY_ADDR").map_err(|_| anyhow::anyhow!("PRIMARY_ADDR not set"))?; let secondary_addr = env::var("SECONDARY_ADDR").map_err(|_| anyhow::anyhow!("SECONDARY_ADDR not set"))?; - let shard_size = if groth16 { + let shard_size = if final_snark { SNARK_SHARD_SIZE } else { STARK_SHARD_SIZE @@ -145,11 +145,11 @@ async fn start_primary_server(groth16: bool) -> Result { } } -async fn start_secondary_server(groth16: bool) -> Result { +async fn start_secondary_server(final_snark: bool) -> Result { let secondary_addr = env::var("SECONDARY_ADDR").map_err(|_| anyhow::anyhow!("SECONDARY_ADDR not set"))?; - let shard_size = if groth16 { + let shard_size = if final_snark { SNARK_SHARD_SIZE } else { STARK_SHARD_SIZE @@ -166,10 +166,10 @@ async fn start_secondary_server(groth16: bool) -> Result { "-a", &secondary_addr, ]) - .env("RUST_LOG", RUST_LOG) - .env("RUSTFLAGS", RUSTFLAGS) + .env("RUST_LOG", "debug") + .env("RUSTFLAGS", "-C target-cpu=native --cfg tokio_unstable") .env("SHARD_SIZE", shard_size) - .env("SHARD_BATCH_SIZE", SHARD_BATCH_SIZE) + .env("SHARD_BATCH_SIZE", "0") .spawn() .map_err(|e| anyhow!(e))?; @@ -193,7 +193,7 @@ async fn start_secondary_server(groth16: bool) -> Result { } } -async fn bench_proving_inclusion(groth16: bool) -> Result { +async fn bench_proving_inclusion(final_snark: bool) -> Result { // Connect to primary server let primary_address = env::var("PRIMARY_ADDR").map_err(|_| anyhow::anyhow!("PRIMARY_ADDR not set"))?; @@ -214,8 +214,8 @@ async fn bench_proving_inclusion(groth16: bool) -> Result Result Result { +async fn bench_proving_epoch_change(final_snark: bool) -> Result { // Connect to primary server let primary_address = env::var("PRIMARY_ADDR").map_err(|_| anyhow::anyhow!("PRIMARY_ADDR not set"))?; @@ -257,8 +257,8 @@ async fn bench_proving_epoch_change(groth16: bool) -> Result Result<()> { write_bytes(&mut client_stream, &verified).await?; info!("Verification result sent"); } - Ok(Request::Groth16ProveInclusion(inclusion_data)) => { + Ok(Request::SnarkProveInclusion(inclusion_data)) => { let InclusionData { sparse_merkle_proof_assets, transaction_proof_assets, @@ -164,7 +164,7 @@ async fn main() -> Result<()> { ); info!("Start proving"); let proof_handle = - spawn_blocking(move || prover_client.prove_groth16(&pk, stdin)); + spawn_blocking(move || prover_client.prove_plonk(&pk, stdin)); let proof = proof_handle.await??; info!("Proof generated. Serializing"); let proof_bytes = bcs::to_bytes(&proof)?; @@ -172,17 +172,17 @@ async fn main() -> Result<()> { write_bytes(&mut client_stream, &proof_bytes).await?; info!("Proof sent"); } - Ok(Request::Groth16VerifyInclusion(proof)) => { + Ok(Request::SnarkVerifyInclusion(proof)) => { write_bytes( &mut client_stream, - &bcs::to_bytes(&prover_client.verify_groth16(&proof, &vk).is_ok())?, + &bcs::to_bytes(&prover_client.verify_plonk(&proof, &vk).is_ok())?, ) .await?; } - Ok(Request::Groth16ProveEpochChange(epoch_change_data)) => { + Ok(Request::SnarkProveEpochChange(epoch_change_data)) => { info!("Connecting to the secondary server"); let mut secondary_stream = TcpStream::connect(&*snd_addr).await?; - let secondary_request = SecondaryRequest::Groth16Prove(epoch_change_data); + let secondary_request = SecondaryRequest::SnarkProve(epoch_change_data); info!("Serializing secondary request"); let secondary_request_bytes = bcs::to_bytes(&secondary_request)?; info!("Sending secondary request"); @@ -193,10 +193,10 @@ async fn main() -> Result<()> { write_bytes(&mut client_stream, &proof_bytes).await?; info!("Proof sent"); } - Ok(Request::Groth16VerifyEpochChange(proof)) => { + Ok(Request::SnarkVerifyEpochChange(proof)) => { info!("Connecting to the secondary server"); let mut secondary_stream = TcpStream::connect(&*snd_addr).await?; - let secondary_request = SecondaryRequest::Groth16Verify(proof); + let secondary_request = SecondaryRequest::SnarkVerify(proof); info!("Serializing secondary request"); let secondary_request_bytes = bcs::to_bytes(&secondary_request)?; info!("Sending secondary request"); diff --git a/aptos/proof-server/src/bin/server_secondary.rs b/aptos/proof-server/src/bin/server_secondary.rs index f86b2d86..3e11bf70 100644 --- a/aptos/proof-server/src/bin/server_secondary.rs +++ b/aptos/proof-server/src/bin/server_secondary.rs @@ -94,14 +94,14 @@ async fn main() -> Result<()> { ) .await?; } - SecondaryRequest::Groth16Prove(EpochChangeData { + SecondaryRequest::SnarkProve(EpochChangeData { trusted_state, epoch_change_proof, }) => { let stdin = epoch_change::generate_stdin(&trusted_state, &epoch_change_proof); info!("Start proving"); let proof_handle = - spawn_blocking(move || prover_client.prove_groth16(&pk, stdin)); + spawn_blocking(move || prover_client.prove_plonk(&pk, stdin)); let proof = proof_handle.await??; info!("Proof generated. Serializing"); let proof_bytes = bcs::to_bytes(&proof)?; @@ -109,10 +109,10 @@ async fn main() -> Result<()> { write_bytes(&mut primary_stream, &proof_bytes).await?; info!("Proof sent"); } - SecondaryRequest::Groth16Verify(proof) => { + SecondaryRequest::SnarkVerify(proof) => { write_bytes( &mut primary_stream, - &bcs::to_bytes(&prover_client.verify_groth16(&proof, &vk).is_ok())?, + &bcs::to_bytes(&prover_client.verify_plonk(&proof, &vk).is_ok())?, ) .await?; } diff --git a/aptos/proof-server/src/types/proof_server.rs b/aptos/proof-server/src/types/proof_server.rs index 6c465b20..6319888d 100644 --- a/aptos/proof-server/src/types/proof_server.rs +++ b/aptos/proof-server/src/types/proof_server.rs @@ -5,7 +5,7 @@ use aptos_lc::inclusion::{ SparseMerkleProofAssets, TransactionProofAssets, ValidatorVerifierAssets, }; use serde::{Deserialize, Serialize}; -use sphinx_sdk::{SphinxGroth16Proof, SphinxProof}; +use sphinx_sdk::{SphinxPlonkBn254Proof, SphinxProof}; use std::fmt::Display; /// Data structure used as a payload to request an epoch change proof generation from the proof @@ -33,10 +33,10 @@ pub enum Request { ProveEpochChange(EpochChangeData), VerifyInclusion(SphinxProof), VerifyEpochChange(SphinxProof), - Groth16ProveInclusion(InclusionData), - Groth16ProveEpochChange(EpochChangeData), - Groth16VerifyInclusion(SphinxGroth16Proof), - Groth16VerifyEpochChange(SphinxGroth16Proof), + SnarkProveInclusion(InclusionData), + SnarkProveEpochChange(EpochChangeData), + SnarkVerifyInclusion(SphinxPlonkBn254Proof), + SnarkVerifyEpochChange(SphinxPlonkBn254Proof), } impl Display for &Request { @@ -46,10 +46,10 @@ impl Display for &Request { Request::ProveEpochChange(_) => write!(f, "ProveEpochChange"), Request::VerifyInclusion(_) => write!(f, "VerifyInclusion"), Request::VerifyEpochChange(_) => write!(f, "VerifyEpochChange"), - Request::Groth16ProveInclusion(_) => write!(f, "Groth16ProveInclusion"), - Request::Groth16ProveEpochChange(_) => write!(f, "Groth16ProveEpochChange"), - Request::Groth16VerifyInclusion(_) => write!(f, "Groth16VerifyInclusion"), - Request::Groth16VerifyEpochChange(_) => write!(f, "Groth16VerifyEpochChange"), + Request::SnarkProveInclusion(_) => write!(f, "SnarkProveInclusion"), + Request::SnarkProveEpochChange(_) => write!(f, "SnarkProveEpochChange"), + Request::SnarkVerifyInclusion(_) => write!(f, "SnarkVerifyInclusion"), + Request::SnarkVerifyEpochChange(_) => write!(f, "SnarkVerifyEpochChange"), } } } @@ -60,6 +60,6 @@ impl Display for &Request { pub enum SecondaryRequest { Prove(EpochChangeData), Verify(SphinxProof), - Groth16Prove(EpochChangeData), - Groth16Verify(SphinxGroth16Proof), + SnarkProve(EpochChangeData), + SnarkVerify(SphinxPlonkBn254Proof), } diff --git a/aptos/solidity/README.md b/aptos/solidity/README.md new file mode 100644 index 00000000..58266896 --- /dev/null +++ b/aptos/solidity/README.md @@ -0,0 +1,8 @@ +## On-chain Plonk verification + +One of the requirements for the Light Client is the on-chain (Solidity) verification of Sphinx proofs generated by +epoch-change and inclusion programs. + +For more information about how to run the on-chain verification benchmarks, please refer to the dedicated section of the +mdBook. Otherwise, the README can be found in the [`docs/src/benchmarks/on_chain.md`](../docs/src/benchmark/on_chain.md) +folder. \ No newline at end of file diff --git a/aptos/solidity/contracts/.gitignore b/aptos/solidity/contracts/.gitignore new file mode 100644 index 00000000..85198aaa --- /dev/null +++ b/aptos/solidity/contracts/.gitignore @@ -0,0 +1,14 @@ +# Compiler files +cache/ +out/ + +# Ignores development broadcast logs +!/broadcast +/broadcast/*/31337/ +/broadcast/**/dry-run/ + +# Docs +docs/ + +# Dotenv file +.env diff --git a/aptos/solidity/contracts/foundry.toml b/aptos/solidity/contracts/foundry.toml new file mode 100644 index 00000000..56790bea --- /dev/null +++ b/aptos/solidity/contracts/foundry.toml @@ -0,0 +1,6 @@ +[profile.default] +src = "src" +out = "out" +libs = ["lib"] + +fs_permissions = [{ access = "read-write", path = "./"}] diff --git a/aptos/solidity/contracts/lib/forge-std b/aptos/solidity/contracts/lib/forge-std new file mode 160000 index 00000000..19891e6a --- /dev/null +++ b/aptos/solidity/contracts/lib/forge-std @@ -0,0 +1 @@ +Subproject commit 19891e6a0b5474b9ea6827ddb90bb9388f7acfc0 diff --git a/aptos/solidity/contracts/lib/sphinx-contracts b/aptos/solidity/contracts/lib/sphinx-contracts new file mode 160000 index 00000000..c3bc9561 --- /dev/null +++ b/aptos/solidity/contracts/lib/sphinx-contracts @@ -0,0 +1 @@ +Subproject commit c3bc9561bfc08ad409f47820d9790260d77e3997 diff --git a/aptos/solidity/contracts/remappings.txt b/aptos/solidity/contracts/remappings.txt new file mode 100644 index 00000000..c40de20e --- /dev/null +++ b/aptos/solidity/contracts/remappings.txt @@ -0,0 +1,2 @@ +forge-std/=lib/forge-std/src/ +sphinx-contracts/=lib/sphinx-contracts/contracts/src/ diff --git a/aptos/solidity/contracts/src/EpochChange.sol b/aptos/solidity/contracts/src/EpochChange.sol new file mode 100644 index 00000000..9096e8e5 --- /dev/null +++ b/aptos/solidity/contracts/src/EpochChange.sol @@ -0,0 +1,15 @@ +pragma solidity ^0.8.25; + +import {SphinxVerifier as SphinxPlonkVerifier} from "sphinx-contracts/SphinxVerifier.sol"; + +contract EpochChange is SphinxPlonkVerifier { + bytes32 public epochChangeProgramVkey; + + constructor(bytes32 _epochChangeProgramVkey) { + epochChangeProgramVkey = _epochChangeProgramVkey; + } + + function verifyProof(bytes memory proof, bytes memory publicValues) public view { + this.verifyProof(epochChangeProgramVkey, publicValues, proof); + } +} diff --git a/aptos/solidity/contracts/src/Inclusion.sol b/aptos/solidity/contracts/src/Inclusion.sol new file mode 100644 index 00000000..8a34321d --- /dev/null +++ b/aptos/solidity/contracts/src/Inclusion.sol @@ -0,0 +1,15 @@ +pragma solidity ^0.8.25; + +import {SphinxVerifier as SphinxPlonkVerifier} from "sphinx-contracts/SphinxVerifier.sol"; + +contract Inclusion is SphinxPlonkVerifier { + bytes32 public inclusionProgramVkey; + + constructor(bytes32 _inclusionProgramVkey) { + inclusionProgramVkey = _inclusionProgramVkey; + } + + function verifyProof(bytes memory proof, bytes memory publicValues) public view { + this.verifyProof(inclusionProgramVkey, publicValues, proof); + } +} diff --git a/aptos/solidity/contracts/src/plonk_fixtures/epoch_change_fixture.json b/aptos/solidity/contracts/src/plonk_fixtures/epoch_change_fixture.json new file mode 100644 index 00000000..da01f883 --- /dev/null +++ b/aptos/solidity/contracts/src/plonk_fixtures/epoch_change_fixture.json @@ -0,0 +1,5 @@ +{ + "vkey": "0x00ecf6a7b70dc2d50a314ab3f342826ac7235cb27db6f6f439519a12f737c0f2", + "publicValues": "0x205829098a4c0273312e8bc4fdbde28fc12abdc540c88bdd9abeef0a85d706ecc071f215064bfe6f1c24295135199ce6f6dec2974115fad50989e666915453ad", + "proof": "0x0ae41ce65a672a984240b3fe10f9356b67db98ee680d2fbf918f7b5918d83d1608b604caa796ca29c07e57d4eefd9c00710a4a3432c97e6ab74cdea46c84e0a61e71d39612363c4c18d55d669304836f737413d18f31c4c1c6063fb91c1546cf1e1cba0e0e997e2cfe676becaa0f47ef15104464d12bd032df66f711a5fa09682c5d0fe5f9e1ea940d8cba96ebba2f4c2fc4d63a692b2ab30d319aaa8c518008084c882cc93a12e2adedd57d898e6cda51e475c37c0abc6fea7cbfef60ad846a1a5fcaf65b87564325c48b3927cc6819c235e2cb1890b11c97fbd2a4778612d50927be5805b98fdeded77f38dd90da713159dbebc172ec8bbcaf8e1a4bc36a032db19cd5b722b9b34002b2bf854f6d27826f331e93d985e2be10a135db9986d60805e059e92359f3ace3d353f01b28d7a6aad882757d079b75f352480a8240450ceb783462b62b1f5dfbba2fddd95aaebcf4f7e25e30567b68f3352aeb8b3f3c1dec60669becfe1754e8d986f463f3f57adf659909a51c50801205c00c1d1ec508fcc43a584b61f9fc2089cac009f4fb675df8aadaabd7fdad42a9eaf714d224086773fb2c47e8cbefe4ce7a01e75df58fa63857eb5a3b5e8b3e847516cfd192051ae4be28d525725e357f9de14ee34decebe0511f6d13114a4fea99df282c8a110feae686fc9106763c0b681cde1ed87daa812619dc565cbb9d3d99b8c88c202c2d6813db10b7234ced34a2d944d4e9c54766bc999ab9312eaa451ea2e97bd815395fc3ef1d91f35f2c42848f008fbb4a7c1c85829b6d127d7d3d4feb4df356276d7b7b7a453bc4a8b93001f36df88212531349903679b4ccdf3349be68a2152531c684adce63081af722b729772bf5faad71c71e08400caef6e8d9c97ca18d2b446dd6157b8afc866d92dcd81bc51ad37c1d5c70739b161dbde259b6c886242fd425917f69d3ee7265cf5507a6c2921e864aae65b81ee2f1f33fc52a5846ab28a57921a01b4bcd85b842fbea66215318c4a5d73feca310b0b05752f9a0394b02063d78cb47f8dcf0bbfde77fc9e427ec96aec44815a2f82c1b1245165bd25715fea1f6dbd1f5207885a8367b9b2df970b6e1e4bce3dcbbda0fda2e66badd311d772a48d7382c577f862004c871784330ad9fcbde04fbe894e2e68daeb5b844165e87cfe2e2c550915384adc41cb5181c9581ce34b5af41ee8455adadba29e3" +} diff --git a/aptos/solidity/contracts/src/plonk_fixtures/inclusion_fixture.json b/aptos/solidity/contracts/src/plonk_fixtures/inclusion_fixture.json new file mode 100644 index 00000000..8670e4dd --- /dev/null +++ b/aptos/solidity/contracts/src/plonk_fixtures/inclusion_fixture.json @@ -0,0 +1,5 @@ +{ + "vkey": "0x008250372636bf382b645ba064dead84a34d26f30c930a1ec81c42fad2b183a1", + "publicValues": "0x205829098a4c0273312e8bc4fdbde28fc12abdc540c88bdd9abeef0a85d706ec8c8d51f0d08a701bfaff8e03459ed0e51d9abd103406731a2e4276d4ae0938d5", + "proof": "0x2a1f5ee25d15b06fe79870e1b76151e4360ac8a1aa82ed2c7ed0092a4175fb1925df8b465a5b272949d63b506686021da3ed5d6e676dc70fcce28c277d42671e11e8c655950e6e0f1b90c483372ee0908f2fa846903525f8f4e3d74d825c5c050be8ece7c5493c80a77114d1b05109c67b93fbfdbfa9b286bc906e74f37fc3ee135bc873a37bf39475cc12f0a66ca8b410ec9032a6f367d36b905714f8ec05972d48cd3982c9711e1d8fcd3869ced8f7be1c66ff939ca0c70d910e0dc8bb6b960834c1564e23ce6bfee0ba6b8c6902297a1750184ea02645da7837dd88c2a54d24a085a0f707e51fc5a6ca9251bdae9a254cf7de303644189f55ebf204d9d53422351de89382a215c3ce13dc38df3cf79d3d34789dbfaa3ef455ddef178d624f20c81bdb81954bc14a1c82da78d1d4fa4a31a67fa27cc945197048cec461729125d8f953d06254aabe6063186f7c7d781952f024f45d377d7466af95eda268a90e993f5e417a3c5d711c1e791f2ee680a279bbc287b82345d66f29cf265f24311017409da89c3a72c517f20ad38603c63e49ddda52fb0eb7dec22b6a4c76d4202d597ebba83227bffdd905627c12ea588efa2d6d863e993854ab90921199458d107371a118dbb7d924b667c177025ca4879b766339a002210abc3fb9655afc891e4ff067e638c03e36727f547398b72607a2ab3814c3e1c9b93fcfa1a44f0d151461433794588f3666e826eb2e1143bf6b90203b93398760deaecce7c1d2521314f8fbfb6a6a296ebf16dd4120fe8c8ecea17d15caf8ccb350e8478bbfe202612f63149d718c7f8d08d114d05f7e3ab97bc7de3aa290805e300fed02d64ef49a239fc240bf79e93b4ec5e36c088038cfe36b08b59f9612ccd6415bafb6b7280b294872005e3a5ecaf31dd4fa5b6a833ba17d789618e2017fe98a5bbdba65f90f088f7a0c4e4fb98d5158a3babfee08fbeb40132c3d096aebfa89f02ce8c7c2571363af51283fa66f7626f82e06f566d53f1f079c3e9a142beeecfc15c28b6feb0b6ed5b1857e99da3786eef9a39a55020392455bec35d8ccdfc04a5c0ea37b031eddeb2a2084a3a0a2e4188d814f2572c0342b76967d62cfcc1eeb99773a9fe303dabf06494bd01060c9b2f20083150249ae83f051d397df44a802b37639169a0b4dfd149f27ec95a939400603df21a1722b9ccd1fc97f28819d4c8d0576d0ac" +} diff --git a/aptos/solidity/contracts/test/test_lc_proofs.sol b/aptos/solidity/contracts/test/test_lc_proofs.sol new file mode 100644 index 00000000..e3aa5d74 --- /dev/null +++ b/aptos/solidity/contracts/test/test_lc_proofs.sol @@ -0,0 +1,104 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.25; + +import {Test, console} from "forge-std/Test.sol"; +import {stdJson} from "forge-std/StdJson.sol"; +import {Inclusion} from "../src/Inclusion.sol"; +import {EpochChange} from "../src/EpochChange.sol"; + +struct SphinxProofFixtureJson { + bytes proof; + bytes publicValues; + bytes32 vkey; +} + +contract SolidityVerificationTest is Test { + using stdJson for string; + + Inclusion public inclusion; + EpochChange public epochChange; + + function loadPlonkInclusionFixture() public view returns (SphinxProofFixtureJson memory) { + string memory root = vm.projectRoot(); + string memory path = string.concat(root, "/src/plonk_fixtures/inclusion_fixture.json"); + string memory json = vm.readFile(path); + bytes memory jsonBytes = json.parseRaw("."); + return abi.decode(jsonBytes, (SphinxProofFixtureJson)); + } + + function loadPlonkEpochChangeFixture() public view returns (SphinxProofFixtureJson memory) { + string memory root = vm.projectRoot(); + string memory path = string.concat(root, "/src/plonk_fixtures/epoch_change_fixture.json"); + string memory json = vm.readFile(path); + bytes memory jsonBytes = json.parseRaw("."); + return abi.decode(jsonBytes, (SphinxProofFixtureJson)); + } + + function setUp() public { + SphinxProofFixtureJson memory plonkInclusionFixture = loadPlonkInclusionFixture(); + inclusion = new Inclusion(plonkInclusionFixture.vkey); + + SphinxProofFixtureJson memory plonkEpochChangeFixture = loadPlonkEpochChangeFixture(); + epochChange = new EpochChange(plonkEpochChangeFixture.vkey); + } + + function testValidInclusionProofPlonk() public view { + SphinxProofFixtureJson memory fixture = loadPlonkInclusionFixture(); + uint256 gasCost = gasleft(); + inclusion.verifyProof(fixture.proof, fixture.publicValues); + console.log("gas cost: ", gasCost - gasleft()); + } + + function testValidEpochChangeProofPlonk() public view { + SphinxProofFixtureJson memory fixture = loadPlonkEpochChangeFixture(); + uint256 gasCost = gasleft(); + epochChange.verifyProof(fixture.proof, fixture.publicValues); + console.log("gas cost: ", gasCost - gasleft()); + } + + // Negative tests with a fake proof + function testFail_FakeProofInclusion() public view { + SphinxProofFixtureJson memory fixture = loadPlonkInclusionFixture(); + bytes memory fakeProof = new bytes(fixture.proof.length); + inclusion.verifyProof(fakeProof, fixture.publicValues); + } + + function testFail_FakeProofEpochChange() public view { + SphinxProofFixtureJson memory fixture = loadPlonkEpochChangeFixture(); + bytes memory fakeProof = new bytes(fixture.proof.length); + epochChange.verifyProof(fakeProof, fixture.publicValues); + } + + // Negative tests with a fake public values (currently failing, need to be enabled if porting v1.0.7-testnet contracts of SP1 to Sphinx) + function _testFail_FakePublicValuesInclusion() public view { + console.log("running testFail_FakePublicValuesInclusion"); + SphinxProofFixtureJson memory fixture = loadPlonkInclusionFixture(); + + bytes memory fakePublicValues = new bytes(fixture.proof.length + 100); + + inclusion.verifyProof(fixture.proof, fakePublicValues); + } + + function _testFail_FakePublicValuesEpochChange() public view { + SphinxProofFixtureJson memory fixture = loadPlonkEpochChangeFixture(); + bytes memory fakePublicValues = new bytes(fixture.proof.length); + epochChange.verifyProof(fixture.proof, fakePublicValues); + } + + // Negative tests with a wrong vk (currently failing, need to be enabled if porting v1.0.7-testnet contracts of SP1 to Sphinx) + function _testFail_WrongVkValuesInclusion() public { + SphinxProofFixtureJson memory plonkEpochChangeFixture = loadPlonkEpochChangeFixture(); + inclusion = new Inclusion(plonkEpochChangeFixture.vkey); // take key of epoch_change program + + SphinxProofFixtureJson memory fixture = loadPlonkInclusionFixture(); + inclusion.verifyProof(fixture.proof, fixture.publicValues); + } + + function _testFail_WrongVkValuesEpochChange() public { + SphinxProofFixtureJson memory plonkInclusionFixture = loadPlonkInclusionFixture(); + epochChange = new EpochChange(plonkInclusionFixture.vkey); // take key of inclusion program + + SphinxProofFixtureJson memory fixture = loadPlonkEpochChangeFixture(); + epochChange.verifyProof(fixture.proof, fixture.publicValues); + } +} diff --git a/aptos/solidity/fixture-generator/Cargo.toml b/aptos/solidity/fixture-generator/Cargo.toml new file mode 100644 index 00000000..048a9de6 --- /dev/null +++ b/aptos/solidity/fixture-generator/Cargo.toml @@ -0,0 +1,18 @@ +[package] +version = "0.1.0" +name = "fixture-generator" +edition = "2021" + +[[bin]] +name = "generate-fixture" +path = "src/bin/main.rs" + +[dependencies] +sphinx-sdk = { workspace = true } +sphinx-prover = {workspace = true } +aptos-lc = { path = "../../light-client", features = ["aptos"] } +serde_json = { version = "1.0", default-features = false, features = ["alloc"] } +serde = { version = "1.0", default-features = false, features = ["derive"] } +clap = { version = "4.0", features = ["derive", "env"] } +tracing = "0.1.40" +alloy-sol-types = "0.7.2" diff --git a/aptos/solidity/fixture-generator/rust-toolchain b/aptos/solidity/fixture-generator/rust-toolchain new file mode 100644 index 00000000..989860f4 --- /dev/null +++ b/aptos/solidity/fixture-generator/rust-toolchain @@ -0,0 +1,3 @@ +[toolchain] +channel = "nightly-2024-04-17" +components = ["llvm-tools", "rustc-dev"] diff --git a/aptos/solidity/fixture-generator/src/bin/main.rs b/aptos/solidity/fixture-generator/src/bin/main.rs new file mode 100644 index 00000000..0bb0b38d --- /dev/null +++ b/aptos/solidity/fixture-generator/src/bin/main.rs @@ -0,0 +1,76 @@ +use clap::Parser; +use serde::{Deserialize, Serialize}; +use sphinx_prover::types::HashableKey; +use sphinx_prover::SphinxStdin; +use sphinx_sdk::ProverClient; +use std::path::PathBuf; + +pub const INCLUSION_ELF: &[u8] = + include_bytes!("../../../../aptos-programs/artifacts/inclusion-program"); +pub const EPOCH_CHANGE_ELF: &[u8] = + include_bytes!("../../../../aptos-programs/artifacts/epoch-change-program"); + +#[derive(Parser, Debug)] +#[clap(author, version, about, long_about = None)] +struct ProveArgs { + #[clap(long, default_value_t = String::from("inclusion"))] + program: String, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +struct SP1ProofFixture { + vkey: String, + public_values: String, + proof: String, +} + +fn main() { + sphinx_sdk::utils::setup_logger(); + let args = ProveArgs::parse(); + + let elf: &[u8]; + let stdin: SphinxStdin; + match args.program.as_str() { + "inclusion" => { + elf = INCLUSION_ELF; + let (sparse_merkle_proof_assets, transaction_proof_assets, validator_verifier_assets) = + aptos_lc::inclusion::setup_assets(); + stdin = aptos_lc::inclusion::generate_stdin( + &sparse_merkle_proof_assets, + &transaction_proof_assets, + &validator_verifier_assets, + ); + } + "epoch_change" => { + elf = EPOCH_CHANGE_ELF; + let (trusted_state, epoch_change_proof, _) = aptos_lc::epoch_change::setup_assets(); + stdin = aptos_lc::epoch_change::generate_stdin(&trusted_state, &epoch_change_proof); + } + _ => panic!("Unsupported program. Use: ['inclusion', 'epoch_change']"), + } + + let prover = ProverClient::new(); + let (pk, vk) = prover.setup(elf); + let proof = prover.prove_plonk(&pk, stdin).unwrap(); + // just to check that proof is valid and verifiable + prover.verify_plonk(&proof, &vk).unwrap(); + + // save fixture + let fixture = SP1ProofFixture { + vkey: vk.bytes32().to_string(), + public_values: proof.public_values.bytes().to_string(), + proof: proof.bytes(), + }; + + let fixture_path = + PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../contracts/src/plonk_fixtures"); + std::fs::create_dir_all(&fixture_path).expect("failed to create fixture path"); + let fixture_path = fixture_path.join(args.program.as_str().to_owned() + "_fixture.json"); + std::fs::write( + fixture_path.clone(), + serde_json::to_string_pretty(&fixture).unwrap(), + ) + .expect("failed to write fixture"); + tracing::info!("Fixture has been successfully saved to {:?}", fixture_path); +}