From dafa1b0d02d8286f5dff0a081ecf744db97fe256 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Garillot?= Date: Thu, 15 Aug 2024 16:21:10 -0400 Subject: [PATCH 01/11] refactor: Refactor proof handling across all components - Update Sphinx dependencies from tag v1.0.0 to branch forward_ports_43 across all components. - Modification of all instances of `SphinxProof` in favor of `SphinxProofWithPublicValues`. - Inclusion of the run() method call chained after the `prove` and `execute` functions across system (enacting builder pattern). - Removal and integration of separate `prove_plonk` and `verify_plonk` functions into main proving and verification functions using the method `.plonk()` where required. - Direct passing of `stdin` as an argument in the `execute` function across applications. - Update of the Rust Toolchain from "nightly-2024-07-30" to "nightly-2024-08-13" in both Aptos and Ethereum components. - Addition of `bytes` function for supporting different proof types in the fixture-generator. - Updating proof creation and validation in the fixture generation process with revised function calls. - Revisions in client and server operations to support `SphinxProofWithPublicValues` and updated function calls. - Update of `tokio` version from `"1.39.0"` to `"1.39.2"` and Hex dependency addition at version `0.4.3`. --- aptos/.vscode/settings.json | 3 + aptos/Cargo.lock | 171 ++++++++--------- aptos/light-client/benches/e2e.rs | 14 +- aptos/light-client/benches/epoch_change.rs | 8 +- aptos/light-client/benches/inclusion.rs | 8 +- aptos/light-client/benches/sig.rs | 8 +- aptos/light-client/src/epoch_change.rs | 27 +-- aptos/light-client/src/inclusion.rs | 27 +-- aptos/light-client/src/sig.rs | 28 +-- aptos/proof-server/src/bin/client.rs | 21 ++- aptos/proof-server/src/bin/server_primary.rs | 7 +- .../proof-server/src/bin/server_secondary.rs | 7 +- aptos/proof-server/src/types/proof_server.rs | 14 +- ethereum/Cargo.lock | 151 +++++++-------- ethereum/Cargo.toml | 2 +- .../src/proofs/committee_change.rs | 10 +- ethereum/light-client/src/proofs/inclusion.rs | 10 +- ethereum/light-client/src/proofs/mod.rs | 20 +- fixture-generator/Cargo.lock | 172 +++++++++--------- fixture-generator/Cargo.toml | 1 + fixture-generator/src/bin/main.rs | 25 ++- 21 files changed, 390 insertions(+), 344 deletions(-) create mode 100644 aptos/.vscode/settings.json diff --git a/aptos/.vscode/settings.json b/aptos/.vscode/settings.json new file mode 100644 index 00000000..7b2b22c3 --- /dev/null +++ b/aptos/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "rust-analyzer.cargo.features": "all" +} \ No newline at end of file diff --git a/aptos/Cargo.lock b/aptos/Cargo.lock index 3f666e30..b583abab 100644 --- a/aptos/Cargo.lock +++ b/aptos/Cargo.lock @@ -171,7 +171,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -187,7 +187,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", "syn-solidity", "tiny-keccak", ] @@ -203,7 +203,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", "syn-solidity", ] @@ -2062,7 +2062,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -2073,7 +2073,7 @@ checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -2112,7 +2112,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -2369,7 +2369,7 @@ dependencies = [ "regex", "rustc-hash 1.1.0", "shlex", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -2391,7 +2391,7 @@ dependencies = [ "regex", "rustc-hash 1.1.0", "shlex", - "syn 2.0.74", + "syn 2.0.75", "which", ] @@ -2689,9 +2689,9 @@ checksum = "4964518bd3b4a8190e832886cdc0da9794f12e8e6c1613a9e90ff331c4c8724b" [[package]] name = "camino" -version = "1.1.8" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3054fea8a20d8ff3968d5b22cc27501d2b08dc4decdb31b184323f00c5ef23bb" +checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" dependencies = [ "serde", ] @@ -2922,7 +2922,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -3462,7 +3462,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -3524,7 +3524,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.11.1", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -3546,7 +3546,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core 0.20.10", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -3628,7 +3628,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -3641,7 +3641,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version 0.4.0", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -3841,7 +3841,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -4033,7 +4033,7 @@ dependencies = [ "regex", "serde", "serde_json", - "syn 2.0.74", + "syn 2.0.75", "toml 0.8.2", "walkdir", ] @@ -4051,7 +4051,7 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -4077,7 +4077,7 @@ dependencies = [ "serde", "serde_json", "strum 0.26.3", - "syn 2.0.74", + "syn 2.0.75", "tempfile", "thiserror", "tiny-keccak", @@ -4431,7 +4431,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -5679,9 +5679,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.156" +version = "0.2.158" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5f43f184355eefb8d17fc948dbecf6c13be3c141f20d834ae842193a448c72a" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" [[package]] name = "libgit2-sys" @@ -6943,7 +6943,7 @@ dependencies = [ "proc-macro-crate 2.0.2", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -7047,7 +7047,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -7112,7 +7112,7 @@ dependencies = [ [[package]] name = "p3-air" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "p3-field", "p3-matrix", @@ -7121,7 +7121,7 @@ dependencies = [ [[package]] name = "p3-baby-bear" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "num-bigint 0.4.6", "p3-field", @@ -7135,7 +7135,7 @@ dependencies = [ [[package]] name = "p3-blake3" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "blake3", "p3-symmetric", @@ -7144,7 +7144,7 @@ dependencies = [ [[package]] name = "p3-bn254-fr" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "ff 0.13.0", "num-bigint 0.4.6", @@ -7158,7 +7158,7 @@ dependencies = [ [[package]] name = "p3-challenger" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "p3-field", "p3-maybe-rayon", @@ -7170,7 +7170,7 @@ dependencies = [ [[package]] name = "p3-commit" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "itertools 0.12.1", "p3-challenger", @@ -7183,7 +7183,7 @@ dependencies = [ [[package]] name = "p3-dft" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "p3-field", "p3-matrix", @@ -7195,7 +7195,7 @@ dependencies = [ [[package]] name = "p3-field" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "itertools 0.12.1", "num-bigint 0.4.6", @@ -7208,7 +7208,7 @@ dependencies = [ [[package]] name = "p3-fri" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "itertools 0.12.1", "p3-challenger", @@ -7226,7 +7226,7 @@ dependencies = [ [[package]] name = "p3-interpolation" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "p3-field", "p3-matrix", @@ -7236,7 +7236,7 @@ dependencies = [ [[package]] name = "p3-keccak" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "p3-symmetric", "tiny-keccak", @@ -7245,7 +7245,7 @@ dependencies = [ [[package]] name = "p3-keccak-air" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "p3-air", "p3-field", @@ -7258,7 +7258,7 @@ dependencies = [ [[package]] name = "p3-matrix" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "itertools 0.12.1", "p3-field", @@ -7272,7 +7272,7 @@ dependencies = [ [[package]] name = "p3-maybe-rayon" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "rayon", ] @@ -7280,7 +7280,7 @@ dependencies = [ [[package]] name = "p3-mds" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "itertools 0.12.1", "p3-dft", @@ -7294,7 +7294,7 @@ dependencies = [ [[package]] name = "p3-merkle-tree" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "itertools 0.12.1", "p3-commit", @@ -7310,7 +7310,7 @@ dependencies = [ [[package]] name = "p3-poseidon2" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "gcd", "p3-field", @@ -7322,7 +7322,7 @@ dependencies = [ [[package]] name = "p3-symmetric" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "itertools 0.12.1", "p3-field", @@ -7332,7 +7332,7 @@ dependencies = [ [[package]] name = "p3-uni-stark" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "itertools 0.12.1", "p3-air", @@ -7350,7 +7350,7 @@ dependencies = [ [[package]] name = "p3-util" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "serde", ] @@ -7613,7 +7613,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -7702,7 +7702,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -7822,7 +7822,7 @@ dependencies = [ "proc-macro-crate 2.0.2", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -7928,7 +7928,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" dependencies = [ "proc-macro2", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -8132,7 +8132,7 @@ dependencies = [ "itertools 0.12.1", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -8460,7 +8460,7 @@ checksum = "bcc303e793d3734489387d205e9b186fac9c6cfacedd98cbb2e8a5943595f3e6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -8886,9 +8886,9 @@ dependencies = [ [[package]] name = "rustls-native-certs" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a88d6d420651b496bdd98684116959239430022a115c1240e6c3993be0b15fba" +checksum = "04182dffc9091a404e0fc069ea5cd60e5b866c3adf881eff99a32d048242dffa" dependencies = [ "openssl-probe", "rustls-pemfile 2.1.3", @@ -9220,7 +9220,7 @@ checksum = "24008e81ff7613ed8e5ba0cfaf24e2c2f1e5b8a0495711e44fcd4882fca62bcf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -9305,7 +9305,7 @@ dependencies = [ "darling 0.20.10", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -9355,7 +9355,7 @@ checksum = "82fe9db325bcef1fbcde82e078a5cc4efdf787e96b3b9cf45b50b529f2083d67" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -9650,7 +9650,7 @@ dependencies = [ [[package]] name = "sphinx-core" version = "1.0.0" -source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#93e4598c5036fb3d50cb4aac95ed88decff0815a" +source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#7574ef9faf26bb8634a533b7c9e7cf2bfa3860cc" dependencies = [ "anyhow", "arrayref", @@ -9712,7 +9712,7 @@ dependencies = [ [[package]] name = "sphinx-derive" version = "1.0.0" -source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#93e4598c5036fb3d50cb4aac95ed88decff0815a" +source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#7574ef9faf26bb8634a533b7c9e7cf2bfa3860cc" dependencies = [ "proc-macro2", "quote", @@ -9722,7 +9722,7 @@ dependencies = [ [[package]] name = "sphinx-helper" version = "1.0.0" -source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#93e4598c5036fb3d50cb4aac95ed88decff0815a" +source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#7574ef9faf26bb8634a533b7c9e7cf2bfa3860cc" dependencies = [ "cargo_metadata 0.18.1", "chrono", @@ -9731,7 +9731,7 @@ dependencies = [ [[package]] name = "sphinx-primitives" version = "1.0.0" -source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#93e4598c5036fb3d50cb4aac95ed88decff0815a" +source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#7574ef9faf26bb8634a533b7c9e7cf2bfa3860cc" dependencies = [ "itertools 0.12.1", "lazy_static", @@ -9744,7 +9744,7 @@ dependencies = [ [[package]] name = "sphinx-prover" version = "1.0.0" -source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#93e4598c5036fb3d50cb4aac95ed88decff0815a" +source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#7574ef9faf26bb8634a533b7c9e7cf2bfa3860cc" dependencies = [ "anyhow", "backtrace", @@ -9786,7 +9786,7 @@ dependencies = [ [[package]] name = "sphinx-recursion-circuit" version = "1.0.0" -source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#93e4598c5036fb3d50cb4aac95ed88decff0815a" +source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#7574ef9faf26bb8634a533b7c9e7cf2bfa3860cc" dependencies = [ "bincode", "itertools 0.12.1", @@ -9809,7 +9809,7 @@ dependencies = [ [[package]] name = "sphinx-recursion-compiler" version = "1.0.0" -source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#93e4598c5036fb3d50cb4aac95ed88decff0815a" +source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#7574ef9faf26bb8634a533b7c9e7cf2bfa3860cc" dependencies = [ "backtrace", "hashbrown 0.14.5", @@ -9826,6 +9826,7 @@ dependencies = [ "p3-util", "serde", "sphinx-core", + "sphinx-primitives", "sphinx-recursion-core", "sphinx-recursion-derive", "tracing", @@ -9834,7 +9835,7 @@ dependencies = [ [[package]] name = "sphinx-recursion-core" version = "1.0.0" -source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#93e4598c5036fb3d50cb4aac95ed88decff0815a" +source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#7574ef9faf26bb8634a533b7c9e7cf2bfa3860cc" dependencies = [ "arrayref", "backtrace", @@ -9868,7 +9869,7 @@ dependencies = [ [[package]] name = "sphinx-recursion-derive" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#93e4598c5036fb3d50cb4aac95ed88decff0815a" +source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#7574ef9faf26bb8634a533b7c9e7cf2bfa3860cc" dependencies = [ "proc-macro2", "quote", @@ -9878,7 +9879,7 @@ dependencies = [ [[package]] name = "sphinx-recursion-gnark-ffi" version = "1.0.0" -source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#93e4598c5036fb3d50cb4aac95ed88decff0815a" +source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#7574ef9faf26bb8634a533b7c9e7cf2bfa3860cc" dependencies = [ "anyhow", "bincode", @@ -9902,7 +9903,7 @@ dependencies = [ [[package]] name = "sphinx-recursion-program" version = "1.0.0" -source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#93e4598c5036fb3d50cb4aac95ed88decff0815a" +source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#7574ef9faf26bb8634a533b7c9e7cf2bfa3860cc" dependencies = [ "itertools 0.12.1", "p3-air", @@ -9921,6 +9922,7 @@ dependencies = [ "rand 0.8.5", "serde", "sphinx-core", + "sphinx-primitives", "sphinx-recursion-compiler", "sphinx-recursion-core", "tracing", @@ -9929,7 +9931,7 @@ dependencies = [ [[package]] name = "sphinx-sdk" version = "1.0.0" -source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#93e4598c5036fb3d50cb4aac95ed88decff0815a" +source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#7574ef9faf26bb8634a533b7c9e7cf2bfa3860cc" dependencies = [ "alloy-sol-types", "anyhow", @@ -9939,13 +9941,16 @@ dependencies = [ "cfg-if", "ethers", "futures", + "hashbrown 0.14.5", "hex", "home", "indicatif", "log", "num-bigint 0.4.6", + "p3-baby-bear", "p3-commit", "p3-field", + "p3-fri", "p3-matrix", "prost", "reqwest 0.12.5", @@ -10104,7 +10109,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -10117,7 +10122,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -10154,9 +10159,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.74" +version = "2.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fceb41e3d546d0bd83421d3409b1460cc7444cd389341a4c880fe7a042cb3d7" +checksum = "f6af063034fc1935ede7be0122941bafa9bacb949334d090b77ca98b5817c7d9" dependencies = [ "proc-macro2", "quote", @@ -10172,7 +10177,7 @@ dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -10326,7 +10331,7 @@ checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -10436,9 +10441,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.39.2" +version = "1.39.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daa4fb1bc778bd6f04cbfc4bb2d06a7396a8f299dc33ea1900cedaa316f467b1" +checksum = "9babc99b9923bfa4804bd74722ff02c0381021eafa4db9949217e3be8e84fff5" dependencies = [ "backtrace", "bytes", @@ -10470,7 +10475,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -10696,7 +10701,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -10876,7 +10881,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a615d6c2764852a2e88a4f16e9ce1ea49bb776b5872956309e170d63a042a34f" dependencies = [ "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -11249,7 +11254,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", "wasm-bindgen-shared", ] @@ -11283,7 +11288,7 @@ checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -11737,7 +11742,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -11757,7 +11762,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] diff --git a/aptos/light-client/benches/e2e.rs b/aptos/light-client/benches/e2e.rs index 612597ae..525f05b3 100644 --- a/aptos/light-client/benches/e2e.rs +++ b/aptos/light-client/benches/e2e.rs @@ -29,7 +29,7 @@ use aptos_lc_core::types::validator::ValidatorVerifier; use serde::Serialize; use sphinx_sdk::artifacts::try_install_plonk_bn254_artifacts; use sphinx_sdk::utils::setup_logger; -use sphinx_sdk::{ProverClient, SphinxPlonkBn254Proof, SphinxProof, SphinxStdin}; +use sphinx_sdk::{ProverClient, SphinxProofWithPublicValues, SphinxStdin}; use std::env; use std::time::Instant; @@ -51,8 +51,8 @@ struct BenchmarkResults { enum ProofType { #[allow(dead_code)] - Snark(SphinxPlonkBn254Proof), - Stark(SphinxProof), + Snark(SphinxProofWithPublicValues), + Stark(SphinxProofWithPublicValues), } fn main() { @@ -254,9 +254,9 @@ fn prove_epoch_change( let (pk, _) = client.setup(aptos_programs::EPOCH_CHANGE_PROGRAM); if snark { - Snark(client.prove_plonk(&pk, stdin).unwrap()) + Snark(client.prove(&pk, stdin).plonk().run().unwrap()) } else { - Stark(client.prove(&pk, stdin).unwrap()) + Stark(client.prove(&pk, stdin).run().unwrap()) } } @@ -288,9 +288,9 @@ fn prove_inclusion( let (pk, _) = client.setup(aptos_programs::INCLUSION_PROGRAM); if snark { - Snark(client.prove_plonk(&pk, stdin).unwrap()) + Snark(client.prove(&pk, stdin).plonk().run().unwrap()) } else { - Stark(client.prove(&pk, stdin).unwrap()) + Stark(client.prove(&pk, stdin).run().unwrap()) } } diff --git a/aptos/light-client/benches/epoch_change.rs b/aptos/light-client/benches/epoch_change.rs index c19c58d7..3a788dee 100644 --- a/aptos/light-client/benches/epoch_change.rs +++ b/aptos/light-client/benches/epoch_change.rs @@ -20,7 +20,7 @@ use aptos_lc_core::crypto::hash::CryptoHash; use aptos_lc_core::types::trusted_state::TrustedState; use serde::Serialize; use sphinx_sdk::utils::setup_logger; -use sphinx_sdk::{ProverClient, SphinxProof, SphinxStdin}; +use sphinx_sdk::{ProverClient, SphinxProofWithPublicValues, SphinxStdin}; use std::hint::black_box; use std::time::Instant; @@ -64,7 +64,7 @@ impl ProvingAssets { } } - fn prove(&self) -> SphinxProof { + fn prove(&self) -> SphinxProofWithPublicValues { let mut stdin = SphinxStdin::new(); setup_logger(); @@ -73,10 +73,10 @@ impl ProvingAssets { stdin.write(&self.epoch_change_proof); let (pk, _) = self.client.setup(aptos_programs::EPOCH_CHANGE_PROGRAM); - self.client.prove(&pk, stdin).unwrap() + self.client.prove(&pk, stdin).run().unwrap() } - fn verify(&self, proof: &SphinxProof) { + fn verify(&self, proof: &SphinxProofWithPublicValues) { let (_, vk) = self.client.setup(aptos_programs::EPOCH_CHANGE_PROGRAM); self.client.verify(proof, &vk).expect("Verification failed"); } diff --git a/aptos/light-client/benches/inclusion.rs b/aptos/light-client/benches/inclusion.rs index 1c5a3f5c..f014e7d6 100644 --- a/aptos/light-client/benches/inclusion.rs +++ b/aptos/light-client/benches/inclusion.rs @@ -27,7 +27,7 @@ use aptos_lc_core::types::trusted_state::TrustedState; use aptos_lc_core::types::validator::ValidatorVerifier; use serde::Serialize; use sphinx_sdk::utils::setup_logger; -use sphinx_sdk::{ProverClient, SphinxProof, SphinxStdin}; +use sphinx_sdk::{ProverClient, SphinxProofWithPublicValues, SphinxStdin}; use std::hint::black_box; use std::time::Instant; @@ -99,7 +99,7 @@ impl ProvingAssets { /// Proves the account inclusion using the ProverClient. /// Evaluates the predicate P3 during the proving process. - fn prove(&self) -> SphinxProof { + fn prove(&self) -> SphinxProofWithPublicValues { let mut stdin = SphinxStdin::new(); setup_logger(); @@ -119,10 +119,10 @@ impl ProvingAssets { stdin.write(self.validator_verifier_assets.validator_verifier()); let (pk, _) = self.client.setup(aptos_programs::INCLUSION_PROGRAM); - self.client.prove(&pk, stdin).unwrap() + self.client.prove(&pk, stdin).run().unwrap() } - fn verify(&self, proof: &SphinxProof) { + fn verify(&self, proof: &SphinxProofWithPublicValues) { let (_, vk) = self.client.setup(aptos_programs::INCLUSION_PROGRAM); self.client.verify(proof, &vk).expect("Verification failed"); } diff --git a/aptos/light-client/benches/sig.rs b/aptos/light-client/benches/sig.rs index 4cb0a2ad..2f0d67dd 100644 --- a/aptos/light-client/benches/sig.rs +++ b/aptos/light-client/benches/sig.rs @@ -4,7 +4,7 @@ use aptos_lc_core::aptos_test_utils::wrapper::AptosWrapper; use serde::Serialize; use sphinx_sdk::utils::setup_logger; -use sphinx_sdk::{ProverClient, SphinxProof, SphinxStdin}; +use sphinx_sdk::{ProverClient, SphinxProofWithPublicValues, SphinxStdin}; use std::hint::black_box; use std::time::Instant; @@ -31,7 +31,7 @@ impl ProvingAssets { } } - fn prove(&self) -> SphinxProof { + fn prove(&self) -> SphinxProofWithPublicValues { let mut stdin = SphinxStdin::new(); setup_logger(); @@ -41,10 +41,10 @@ impl ProvingAssets { let (pk, _) = self .client .setup(aptos_programs::bench::SIGNATURE_VERIFICATION_PROGRAM); - self.client.prove(&pk, stdin).unwrap() + self.client.prove(&pk, stdin).run().unwrap() } - fn verify(&self, proof: &SphinxProof) { + fn verify(&self, proof: &SphinxProofWithPublicValues) { let (_, vk) = self .client .setup(aptos_programs::bench::SIGNATURE_VERIFICATION_PROGRAM); diff --git a/aptos/light-client/src/epoch_change.rs b/aptos/light-client/src/epoch_change.rs index 109c73e7..931baf51 100644 --- a/aptos/light-client/src/epoch_change.rs +++ b/aptos/light-client/src/epoch_change.rs @@ -2,7 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 use anyhow::Result; -use sphinx_sdk::{ProverClient, SphinxProof, SphinxProvingKey, SphinxStdin, SphinxVerifyingKey}; +use sphinx_sdk::{ + ProverClient, SphinxProofWithPublicValues, SphinxProvingKey, SphinxStdin, SphinxVerifyingKey, +}; use crate::error::LightClientError; @@ -61,18 +63,20 @@ fn prove_epoch_change( client: &ProverClient, current_trusted_state: &[u8], epoch_change_proof: &[u8], -) -> Result<(SphinxProof, EpochChangeOutput), LightClientError> { +) -> Result<(SphinxProofWithPublicValues, EpochChangeOutput), LightClientError> { sphinx_sdk::utils::setup_logger(); let stdin = generate_stdin(current_trusted_state, epoch_change_proof); let (pk, _) = generate_keys(client); - let mut proof = client - .prove(&pk, stdin) - .map_err(|err| LightClientError::ProvingError { - program: "prove-epoch-change".to_string(), - source: err.into(), - })?; + let mut proof = + client + .prove(&pk, stdin) + .run() + .map_err(|err| LightClientError::ProvingError { + program: "prove-epoch-change".to_string(), + source: err.into(), + })?; // Read output. let prev_validator_verifier_hash = proof.public_values.read::<[u8; 32]>(); @@ -108,7 +112,8 @@ mod test { let client = ProverClient::new(); client - .execute(aptos_programs::EPOCH_CHANGE_PROGRAM, &stdin) + .execute(aptos_programs::EPOCH_CHANGE_PROGRAM, stdin) + .run() .map_err(|err| LightClientError::ProvingError { program: "prove-epoch-change".to_string(), source: err.into(), @@ -179,12 +184,12 @@ mod test { let start = Instant::now(); println!("Starting generation of prove_epoch_change proof..."); - let snark_proof = client.prove_plonk(&pk, stdin).unwrap(); + let snark_proof = client.prove(&pk, stdin).plonk().run().unwrap(); println!("Proving took {:?}", start.elapsed()); let start = Instant::now(); println!("Starting verification of prove_epoch_change proof..."); - client.verify_plonk(&snark_proof, &vk).unwrap(); + client.verify(&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 e716adc0..b4b22273 100644 --- a/aptos/light-client/src/inclusion.rs +++ b/aptos/light-client/src/inclusion.rs @@ -4,7 +4,9 @@ use anyhow::Result; use getset::Getters; use serde::{Deserialize, Serialize}; -use sphinx_sdk::{ProverClient, SphinxProof, SphinxProvingKey, SphinxStdin, SphinxVerifyingKey}; +use sphinx_sdk::{ + ProverClient, SphinxProofWithPublicValues, SphinxProvingKey, SphinxStdin, SphinxVerifyingKey, +}; use crate::error::LightClientError; @@ -168,7 +170,7 @@ fn prove_inclusion( sparse_merkle_proof_assets: &SparseMerkleProofAssets, transaction_proof_assets: &TransactionProofAssets, validator_verifier_assets: &ValidatorVerifierAssets, -) -> Result<(SphinxProof, InclusionOutput), LightClientError> { +) -> Result<(SphinxProofWithPublicValues, InclusionOutput), LightClientError> { sphinx_sdk::utils::setup_logger(); let stdin = generate_stdin( @@ -178,12 +180,14 @@ fn prove_inclusion( ); let (pk, _) = generate_keys(client); - let mut proof = client - .prove(&pk, stdin) - .map_err(|err| LightClientError::ProvingError { - program: "prove-merkle-inclusion".to_string(), - source: err.into(), - })?; + let mut proof = + client + .prove(&pk, stdin) + .run() + .map_err(|err| LightClientError::ProvingError { + program: "prove-merkle-inclusion".to_string(), + source: err.into(), + })?; // Read output. let validator_verifier_hash = proof.public_values.read::<[u8; 32]>(); @@ -240,7 +244,8 @@ mod test { let client = ProverClient::new(); client - .execute(aptos_programs::INCLUSION_PROGRAM, &stdin) + .execute(aptos_programs::INCLUSION_PROGRAM, stdin) + .run() .map_err(|err| LightClientError::ProvingError { program: "prove-merkle-inclusion".to_string(), source: err.into(), @@ -332,12 +337,12 @@ mod test { let start = Instant::now(); println!("Starting generation of inclusion proof..."); - let snark_proof = client.prove_plonk(&pk, stdin).unwrap(); + let snark_proof = client.prove(&pk, stdin).plonk().run().unwrap(); println!("Proving took {:?}", start.elapsed()); let start = Instant::now(); println!("Starting verification of inclusion proof..."); - client.verify_plonk(&snark_proof, &vk).unwrap(); + client.verify(&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 f9b4b383..09f7b2e7 100644 --- a/aptos/light-client/src/sig.rs +++ b/aptos/light-client/src/sig.rs @@ -2,13 +2,13 @@ // SPDX-License-Identifier: Apache-2.0 use crate::error::LightClientError; -use sphinx_sdk::{ProverClient, SphinxProof, SphinxStdin}; +use sphinx_sdk::{ProverClient, SphinxProofWithPublicValues, SphinxStdin}; #[allow(dead_code)] fn sig_verification( client: &ProverClient, ledger_info_w_sig: &[u8], -) -> Result<(SphinxProof, bool), LightClientError> { +) -> Result<(SphinxProofWithPublicValues, bool), LightClientError> { use sphinx_sdk::utils; utils::setup_logger(); @@ -17,12 +17,14 @@ fn sig_verification( stdin.write(&ledger_info_w_sig); let (pk, _) = client.setup(aptos_programs::bench::SIGNATURE_VERIFICATION_PROGRAM); - let mut proof = client - .prove(&pk, stdin) - .map_err(|err| LightClientError::ProvingError { - program: "signature-verification".to_string(), - source: err.into(), - })?; + let mut proof = + client + .prove(&pk, stdin) + .run() + .map_err(|err| LightClientError::ProvingError { + program: "signature-verification".to_string(), + source: err.into(), + })?; // Read output. let success = proof.public_values.read::(); @@ -45,10 +47,8 @@ mod test { let client = ProverClient::new(); client - .execute( - aptos_programs::bench::SIGNATURE_VERIFICATION_PROGRAM, - &stdin, - ) + .execute(aptos_programs::bench::SIGNATURE_VERIFICATION_PROGRAM, stdin) + .run() .map_err(|err| LightClientError::ProvingError { program: "signature-verification".to_string(), source: err.into(), @@ -141,12 +141,12 @@ mod test { let start = Instant::now(); println!("Starting generation of signature verification proof..."); - let snark_proof = client.prove_plonk(&pk, stdin).unwrap(); + let snark_proof = client.prove(&pk, stdin).plonk().run().unwrap(); println!("Proving took {:?}", start.elapsed()); let start = Instant::now(); println!("Starting verification of signature verification proof..."); - client.verify_plonk(&snark_proof, &vk).unwrap(); + client.verify(&snark_proof, &vk).unwrap(); println!("Verification took {:?}", start.elapsed()); } } diff --git a/aptos/proof-server/src/bin/client.rs b/aptos/proof-server/src/bin/client.rs index 762047ee..c5bca3ae 100644 --- a/aptos/proof-server/src/bin/client.rs +++ b/aptos/proof-server/src/bin/client.rs @@ -51,7 +51,7 @@ use proof_server::{ utils::{read_bytes, write_bytes}, APTOS_EPOCH_CHANGE_PROOF_ENDPOINT, APTOS_LEDGER_INFO_ENDPOINT, }; -use sphinx_sdk::SphinxProof; +use sphinx_sdk::SphinxProofWithPublicValues; use std::fmt::Display; use std::str::FromStr; use std::sync::Arc; @@ -91,11 +91,12 @@ type VerifierState = (HashValue, HashValue); /// The type of proof that is currently being processed. enum ProofType { EpochChange { - task: JoinHandle>, + task: + JoinHandle>, permit: OwnedSemaphorePermit, }, Inclusion { - task: JoinHandle>, + task: JoinHandle>, permit: OwnedSemaphorePermit, }, } @@ -449,7 +450,7 @@ async fn request_prover( /// /// An error if the predicate is not satisfied. fn assert_validator_verifier_predicate( - proof: &mut SphinxProof, + proof: &mut SphinxProofWithPublicValues, expected_hash: HashValue, ) -> Result<(), ClientError> { info!("Verifying validator verifier equality"); @@ -484,7 +485,7 @@ async fn epoch_change_proving_task( proof_server_address: Arc, aptos_node_url: Arc, epoch: u64, -) -> Result<(TrustedState, HashValue, SphinxProof), ClientError> { +) -> Result<(TrustedState, HashValue, SphinxProofWithPublicValues), ClientError> { info!("Starting epoch change proving task for epoch: {}", epoch); debug!("Fetching epoch change proof data for epoch: {}", epoch); @@ -511,7 +512,7 @@ async fn epoch_change_proving_task( let request = Request::ProveEpochChange(epoch_change_proof_data.clone().into()); - let epoch_change_proof: SphinxProof = bcs::from_bytes( + let epoch_change_proof: SphinxProofWithPublicValues = bcs::from_bytes( &request_prover(&proof_server_address, &request).await?, ) .map_err(|err| ClientError::ResponsePayload { @@ -559,7 +560,7 @@ async fn epoch_change_proving_task( /// The verifier state after the verification. async fn epoch_change_verifying_task( proof_server_address: Arc, - epoch_change_proof: &mut SphinxProof, + epoch_change_proof: &mut SphinxProofWithPublicValues, verifier_state: VerifierState, ) -> Result { info!("Starting epoch change verification task"); @@ -605,7 +606,7 @@ async fn inclusion_proving_task( proof_server_address: Arc, aptos_node_url: Arc, account: String, -) -> Result { +) -> Result { info!("Starting account inclusion proving task"); debug!("Fetching account inclusion proof for account: {}", account); @@ -614,7 +615,7 @@ async fn inclusion_proving_task( debug!("Sending account inclusion proof request to the prover"); let request = Request::ProveInclusion(inclusion_proof_data.into()); - let account_inclusion_proof: SphinxProof = bcs::from_bytes( + let account_inclusion_proof: SphinxProofWithPublicValues = bcs::from_bytes( &request_prover(&proof_server_address, &request).await?, ) .map_err(|err| ClientError::ResponsePayload { @@ -640,7 +641,7 @@ async fn inclusion_proving_task( /// The verifier state after the verification. async fn inclusion_verifying_task( proof_server_address: Arc, - account_inclusion_proof: &mut SphinxProof, + account_inclusion_proof: &mut SphinxProofWithPublicValues, verifier_state: VerifierState, ) -> Result { info!("Verifying account inclusion proof"); diff --git a/aptos/proof-server/src/bin/server_primary.rs b/aptos/proof-server/src/bin/server_primary.rs index 85e367fc..24e68859 100644 --- a/aptos/proof-server/src/bin/server_primary.rs +++ b/aptos/proof-server/src/bin/server_primary.rs @@ -108,7 +108,8 @@ async fn main() -> Result<()> { &validator_verifier_assets, ); info!("Start proving"); - let proof_handle = spawn_blocking(move || prover_client.prove(&pk, stdin)); + let proof_handle = + spawn_blocking(move || prover_client.prove(&pk, stdin).run()); let proof = proof_handle.await??; info!("Proof generated. Serializing"); let proof_bytes = bcs::to_bytes(&proof)?; @@ -164,7 +165,7 @@ async fn main() -> Result<()> { ); info!("Start proving"); let proof_handle = - spawn_blocking(move || prover_client.prove_plonk(&pk, stdin)); + spawn_blocking(move || prover_client.prove(&pk, stdin).plonk().run()); let proof = proof_handle.await??; info!("Proof generated. Serializing"); let proof_bytes = bcs::to_bytes(&proof)?; @@ -175,7 +176,7 @@ async fn main() -> Result<()> { Ok(Request::SnarkVerifyInclusion(proof)) => { write_bytes( &mut client_stream, - &bcs::to_bytes(&prover_client.verify_plonk(&proof, &vk).is_ok())?, + &bcs::to_bytes(&prover_client.verify(&proof, &vk).is_ok())?, ) .await?; } diff --git a/aptos/proof-server/src/bin/server_secondary.rs b/aptos/proof-server/src/bin/server_secondary.rs index 765400c3..84b4399e 100644 --- a/aptos/proof-server/src/bin/server_secondary.rs +++ b/aptos/proof-server/src/bin/server_secondary.rs @@ -79,7 +79,8 @@ async fn main() -> Result<()> { }) => { let stdin = epoch_change::generate_stdin(&trusted_state, &epoch_change_proof); info!("Start proving"); - let proof_handle = spawn_blocking(move || prover_client.prove(&pk, stdin)); + let proof_handle = + spawn_blocking(move || prover_client.prove(&pk, stdin).run()); let proof = proof_handle.await??; info!("Proof generated. Serializing"); let proof_bytes = bcs::to_bytes(&proof)?; @@ -101,7 +102,7 @@ async fn main() -> Result<()> { let stdin = epoch_change::generate_stdin(&trusted_state, &epoch_change_proof); info!("Start proving"); let proof_handle = - spawn_blocking(move || prover_client.prove_plonk(&pk, stdin)); + spawn_blocking(move || prover_client.prove(&pk, stdin).plonk().run()); let proof = proof_handle.await??; info!("Proof generated. Serializing"); let proof_bytes = bcs::to_bytes(&proof)?; @@ -112,7 +113,7 @@ async fn main() -> Result<()> { SecondaryRequest::SnarkVerify(proof) => { write_bytes( &mut primary_stream, - &bcs::to_bytes(&prover_client.verify_plonk(&proof, &vk).is_ok())?, + &bcs::to_bytes(&prover_client.verify(&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 92dc9527..dc0a735e 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::{SphinxPlonkBn254Proof, SphinxProof}; +use sphinx_sdk::SphinxProofWithPublicValues; use std::fmt::Display; /// Data structure used as a payload to request an epoch change proof generation from the proof @@ -31,12 +31,12 @@ pub struct InclusionData { pub enum Request { ProveInclusion(InclusionData), ProveEpochChange(EpochChangeData), - VerifyInclusion(SphinxProof), - VerifyEpochChange(SphinxProof), + VerifyInclusion(SphinxProofWithPublicValues), + VerifyEpochChange(SphinxProofWithPublicValues), SnarkProveInclusion(InclusionData), SnarkProveEpochChange(EpochChangeData), - SnarkVerifyInclusion(SphinxPlonkBn254Proof), - SnarkVerifyEpochChange(SphinxPlonkBn254Proof), + SnarkVerifyInclusion(SphinxProofWithPublicValues), + SnarkVerifyEpochChange(SphinxProofWithPublicValues), } impl Display for &Request { @@ -59,7 +59,7 @@ impl Display for &Request { #[derive(Serialize, Deserialize)] pub enum SecondaryRequest { Prove(EpochChangeData), - Verify(SphinxProof), + Verify(SphinxProofWithPublicValues), SnarkProve(EpochChangeData), - SnarkVerify(SphinxPlonkBn254Proof), + SnarkVerify(SphinxProofWithPublicValues), } diff --git a/ethereum/Cargo.lock b/ethereum/Cargo.lock index ea7bce06..b11dea1d 100644 --- a/ethereum/Cargo.lock +++ b/ethereum/Cargo.lock @@ -119,7 +119,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -135,7 +135,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", "syn-solidity", "tiny-keccak", ] @@ -151,7 +151,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", "syn-solidity", ] @@ -399,7 +399,7 @@ checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -427,7 +427,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -571,7 +571,7 @@ dependencies = [ "regex", "rustc-hash 1.1.0", "shlex", - "syn 2.0.74", + "syn 2.0.75", "which", ] @@ -738,9 +738,9 @@ dependencies = [ [[package]] name = "camino" -version = "1.1.8" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3054fea8a20d8ff3968d5b22cc27501d2b08dc4decdb31b184323f00c5ef23bb" +checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" dependencies = [ "serde", ] @@ -859,7 +859,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -1080,7 +1080,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -1128,7 +1128,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.11.1", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -1150,7 +1150,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core 0.20.10", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -1192,7 +1192,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -1205,7 +1205,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version 0.4.0", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -1589,7 +1589,7 @@ dependencies = [ "regex", "serde", "serde_json", - "syn 2.0.74", + "syn 2.0.75", "toml", "walkdir", ] @@ -1607,7 +1607,7 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -1633,7 +1633,7 @@ dependencies = [ "serde", "serde_json", "strum", - "syn 2.0.74", + "syn 2.0.75", "tempfile", "thiserror", "tiny-keccak", @@ -1908,7 +1908,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -2639,9 +2639,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.156" +version = "0.2.158" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5f43f184355eefb8d17fc948dbecf6c13be3c141f20d834ae842193a448c72a" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" [[package]] name = "libgit2-sys" @@ -2948,7 +2948,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -3035,7 +3035,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -3065,7 +3065,7 @@ checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "p3-air" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "p3-field", "p3-matrix", @@ -3074,7 +3074,7 @@ dependencies = [ [[package]] name = "p3-baby-bear" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "num-bigint 0.4.6", "p3-field", @@ -3088,7 +3088,7 @@ dependencies = [ [[package]] name = "p3-blake3" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "blake3", "p3-symmetric", @@ -3097,7 +3097,7 @@ dependencies = [ [[package]] name = "p3-bn254-fr" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "ff 0.13.0", "num-bigint 0.4.6", @@ -3111,7 +3111,7 @@ dependencies = [ [[package]] name = "p3-challenger" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "p3-field", "p3-maybe-rayon", @@ -3123,7 +3123,7 @@ dependencies = [ [[package]] name = "p3-commit" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "itertools 0.12.1", "p3-challenger", @@ -3136,7 +3136,7 @@ dependencies = [ [[package]] name = "p3-dft" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "p3-field", "p3-matrix", @@ -3148,7 +3148,7 @@ dependencies = [ [[package]] name = "p3-field" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "itertools 0.12.1", "num-bigint 0.4.6", @@ -3161,7 +3161,7 @@ dependencies = [ [[package]] name = "p3-fri" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "itertools 0.12.1", "p3-challenger", @@ -3179,7 +3179,7 @@ dependencies = [ [[package]] name = "p3-interpolation" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "p3-field", "p3-matrix", @@ -3189,7 +3189,7 @@ dependencies = [ [[package]] name = "p3-keccak" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "p3-symmetric", "tiny-keccak", @@ -3198,7 +3198,7 @@ dependencies = [ [[package]] name = "p3-keccak-air" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "p3-air", "p3-field", @@ -3211,7 +3211,7 @@ dependencies = [ [[package]] name = "p3-matrix" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "itertools 0.12.1", "p3-field", @@ -3225,7 +3225,7 @@ dependencies = [ [[package]] name = "p3-maybe-rayon" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "rayon", ] @@ -3233,7 +3233,7 @@ dependencies = [ [[package]] name = "p3-mds" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "itertools 0.12.1", "p3-dft", @@ -3247,7 +3247,7 @@ dependencies = [ [[package]] name = "p3-merkle-tree" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "itertools 0.12.1", "p3-commit", @@ -3263,7 +3263,7 @@ dependencies = [ [[package]] name = "p3-poseidon2" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "gcd", "p3-field", @@ -3275,7 +3275,7 @@ dependencies = [ [[package]] name = "p3-symmetric" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "itertools 0.12.1", "p3-field", @@ -3285,7 +3285,7 @@ dependencies = [ [[package]] name = "p3-uni-stark" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "itertools 0.12.1", "p3-air", @@ -3303,7 +3303,7 @@ dependencies = [ [[package]] name = "p3-util" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "serde", ] @@ -3483,7 +3483,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -3542,7 +3542,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" dependencies = [ "proc-macro2", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -3651,7 +3651,7 @@ dependencies = [ "itertools 0.12.1", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -4353,7 +4353,7 @@ checksum = "24008e81ff7613ed8e5ba0cfaf24e2c2f1e5b8a0495711e44fcd4882fca62bcf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -4426,7 +4426,7 @@ dependencies = [ "darling 0.20.10", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -4451,7 +4451,7 @@ checksum = "82fe9db325bcef1fbcde82e078a5cc4efdf787e96b3b9cf45b50b529f2083d67" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -4577,7 +4577,7 @@ dependencies = [ [[package]] name = "sphinx-core" version = "1.0.0" -source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#93e4598c5036fb3d50cb4aac95ed88decff0815a" +source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#7574ef9faf26bb8634a533b7c9e7cf2bfa3860cc" dependencies = [ "anyhow", "arrayref", @@ -4639,7 +4639,7 @@ dependencies = [ [[package]] name = "sphinx-derive" version = "1.0.0" -source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#93e4598c5036fb3d50cb4aac95ed88decff0815a" +source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#7574ef9faf26bb8634a533b7c9e7cf2bfa3860cc" dependencies = [ "proc-macro2", "quote", @@ -4649,7 +4649,7 @@ dependencies = [ [[package]] name = "sphinx-helper" version = "1.0.0" -source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#93e4598c5036fb3d50cb4aac95ed88decff0815a" +source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#7574ef9faf26bb8634a533b7c9e7cf2bfa3860cc" dependencies = [ "cargo_metadata", "chrono", @@ -4658,7 +4658,7 @@ dependencies = [ [[package]] name = "sphinx-primitives" version = "1.0.0" -source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#93e4598c5036fb3d50cb4aac95ed88decff0815a" +source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#7574ef9faf26bb8634a533b7c9e7cf2bfa3860cc" dependencies = [ "itertools 0.12.1", "lazy_static", @@ -4671,7 +4671,7 @@ dependencies = [ [[package]] name = "sphinx-prover" version = "1.0.0" -source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#93e4598c5036fb3d50cb4aac95ed88decff0815a" +source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#7574ef9faf26bb8634a533b7c9e7cf2bfa3860cc" dependencies = [ "anyhow", "backtrace", @@ -4713,7 +4713,7 @@ dependencies = [ [[package]] name = "sphinx-recursion-circuit" version = "1.0.0" -source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#93e4598c5036fb3d50cb4aac95ed88decff0815a" +source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#7574ef9faf26bb8634a533b7c9e7cf2bfa3860cc" dependencies = [ "bincode", "itertools 0.12.1", @@ -4736,7 +4736,7 @@ dependencies = [ [[package]] name = "sphinx-recursion-compiler" version = "1.0.0" -source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#93e4598c5036fb3d50cb4aac95ed88decff0815a" +source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#7574ef9faf26bb8634a533b7c9e7cf2bfa3860cc" dependencies = [ "backtrace", "hashbrown 0.14.5", @@ -4753,6 +4753,7 @@ dependencies = [ "p3-util", "serde", "sphinx-core", + "sphinx-primitives", "sphinx-recursion-core", "sphinx-recursion-derive", "tracing", @@ -4761,7 +4762,7 @@ dependencies = [ [[package]] name = "sphinx-recursion-core" version = "1.0.0" -source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#93e4598c5036fb3d50cb4aac95ed88decff0815a" +source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#7574ef9faf26bb8634a533b7c9e7cf2bfa3860cc" dependencies = [ "arrayref", "backtrace", @@ -4795,7 +4796,7 @@ dependencies = [ [[package]] name = "sphinx-recursion-derive" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#93e4598c5036fb3d50cb4aac95ed88decff0815a" +source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#7574ef9faf26bb8634a533b7c9e7cf2bfa3860cc" dependencies = [ "proc-macro2", "quote", @@ -4805,7 +4806,7 @@ dependencies = [ [[package]] name = "sphinx-recursion-gnark-ffi" version = "1.0.0" -source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#93e4598c5036fb3d50cb4aac95ed88decff0815a" +source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#7574ef9faf26bb8634a533b7c9e7cf2bfa3860cc" dependencies = [ "anyhow", "bincode", @@ -4829,7 +4830,7 @@ dependencies = [ [[package]] name = "sphinx-recursion-program" version = "1.0.0" -source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#93e4598c5036fb3d50cb4aac95ed88decff0815a" +source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#7574ef9faf26bb8634a533b7c9e7cf2bfa3860cc" dependencies = [ "itertools 0.12.1", "p3-air", @@ -4848,6 +4849,7 @@ dependencies = [ "rand", "serde", "sphinx-core", + "sphinx-primitives", "sphinx-recursion-compiler", "sphinx-recursion-core", "tracing", @@ -4856,7 +4858,7 @@ dependencies = [ [[package]] name = "sphinx-sdk" version = "1.0.0" -source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#93e4598c5036fb3d50cb4aac95ed88decff0815a" +source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#7574ef9faf26bb8634a533b7c9e7cf2bfa3860cc" dependencies = [ "alloy-sol-types", "anyhow", @@ -4866,13 +4868,16 @@ dependencies = [ "cfg-if", "ethers", "futures", + "hashbrown 0.14.5", "hex", "home", "indicatif", "log", "num-bigint 0.4.6", + "p3-baby-bear", "p3-commit", "p3-field", + "p3-fri", "p3-matrix", "prost", "reqwest 0.12.5", @@ -4969,7 +4974,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -5000,9 +5005,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.74" +version = "2.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fceb41e3d546d0bd83421d3409b1460cc7444cd389341a4c880fe7a042cb3d7" +checksum = "f6af063034fc1935ede7be0122941bafa9bacb949334d090b77ca98b5817c7d9" dependencies = [ "proc-macro2", "quote", @@ -5018,7 +5023,7 @@ dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -5090,7 +5095,7 @@ checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -5162,9 +5167,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.39.2" +version = "1.39.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daa4fb1bc778bd6f04cbfc4bb2d06a7396a8f299dc33ea1900cedaa316f467b1" +checksum = "9babc99b9923bfa4804bd74722ff02c0381021eafa4db9949217e3be8e84fff5" dependencies = [ "backtrace", "bytes", @@ -5186,7 +5191,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -5327,7 +5332,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -5631,7 +5636,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", "wasm-bindgen-shared", ] @@ -5665,7 +5670,7 @@ checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -6002,7 +6007,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -6022,7 +6027,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] diff --git a/ethereum/Cargo.toml b/ethereum/Cargo.toml index 427a3b5f..6a239fba 100644 --- a/ethereum/Cargo.toml +++ b/ethereum/Cargo.toml @@ -27,7 +27,7 @@ sha2 = "0.9" ssz_types = "0.6" thiserror = "1.0.61" tiny-keccak = "2.0.2" -tokio = "1.39.0" +tokio = "1.39.2" tree_hash = "0.6" tree_hash_derive = "0.6" # Crypto dependencies diff --git a/ethereum/light-client/src/proofs/committee_change.rs b/ethereum/light-client/src/proofs/committee_change.rs index 6069c14e..9ea90520 100644 --- a/ethereum/light-client/src/proofs/committee_change.rs +++ b/ethereum/light-client/src/proofs/committee_change.rs @@ -186,7 +186,8 @@ impl Prover for CommitteeChangeProver { let (mut public_values, _) = self .client - .execute(Self::PROGRAM, &stdin) + .execute(Self::PROGRAM, stdin) + .run() .map_err(|err| ProverError::Execution { source: err.into() })?; Ok(CommitteeChangeOut::from(&mut public_values)) @@ -199,6 +200,7 @@ impl Prover for CommitteeChangeProver { ProvingMode::STARK => self .client .prove(&self.keys.0, stdin) + .run() .map_err(|err| ProverError::Proving { proof_type: mode.into(), source: err.into(), @@ -206,7 +208,9 @@ impl Prover for CommitteeChangeProver { .map(ProofType::STARK), ProvingMode::SNARK => self .client - .prove_plonk(&self.keys.0, stdin) + .prove(&self.keys.0, stdin) + .plonk() + .run() .map_err(|err| ProverError::Proving { proof_type: mode.into(), source: err.into(), @@ -225,7 +229,7 @@ impl Prover for CommitteeChangeProver { .map_err(|err| ProverError::Verification { source: err.into() }), ProofType::SNARK(proof) => self .client - .verify_plonk(proof, vk) + .verify(proof, vk) .map_err(|err| ProverError::Verification { source: err.into() }), } } diff --git a/ethereum/light-client/src/proofs/inclusion.rs b/ethereum/light-client/src/proofs/inclusion.rs index a7b0d3d9..bfaf6980 100644 --- a/ethereum/light-client/src/proofs/inclusion.rs +++ b/ethereum/light-client/src/proofs/inclusion.rs @@ -248,7 +248,8 @@ impl Prover for StorageInclusionProver { let (mut public_values, _) = self .client - .execute(Self::PROGRAM, &stdin) + .execute(Self::PROGRAM, stdin) + .run() .map_err(|err| ProverError::Execution { source: err.into() })?; Ok(StorageInclusionOut::from(&mut public_values)) @@ -261,6 +262,7 @@ impl Prover for StorageInclusionProver { ProvingMode::STARK => self .client .prove(&self.keys.0, stdin) + .run() .map_err(|err| ProverError::Proving { proof_type: mode.into(), source: err.into(), @@ -268,7 +270,9 @@ impl Prover for StorageInclusionProver { .map(ProofType::STARK), ProvingMode::SNARK => self .client - .prove_plonk(&self.keys.0, stdin) + .prove(&self.keys.0, stdin) + .plonk() + .run() .map_err(|err| ProverError::Proving { proof_type: mode.into(), source: err.into(), @@ -287,7 +291,7 @@ impl Prover for StorageInclusionProver { .map_err(|err| ProverError::Verification { source: err.into() }), ProofType::SNARK(proof) => self .client - .verify_plonk(proof, vk) + .verify(proof, vk) .map_err(|err| ProverError::Verification { source: err.into() }), } } diff --git a/ethereum/light-client/src/proofs/mod.rs b/ethereum/light-client/src/proofs/mod.rs index 207d0a4f..51418e99 100644 --- a/ethereum/light-client/src/proofs/mod.rs +++ b/ethereum/light-client/src/proofs/mod.rs @@ -21,10 +21,7 @@ use anyhow::{anyhow, Result}; use serde::{Deserialize, Serialize}; -use sphinx_sdk::{ - SphinxPlonkBn254Proof, SphinxProof, SphinxProofWithPublicValues, SphinxPublicValues, - SphinxStdin, -}; +use sphinx_sdk::{SphinxProofWithPublicValues, SphinxPublicValues, SphinxStdin}; pub mod committee_change; pub mod error; @@ -80,8 +77,8 @@ impl ProvingMode { /// The proof type generated by the prover. #[derive(Clone, Debug, Serialize, Deserialize)] pub enum ProofType { - STARK(SphinxProof), - SNARK(SphinxPlonkBn254Proof), + STARK(SphinxProofWithPublicValues), + SNARK(SphinxProofWithPublicValues), } impl ProofType { @@ -107,7 +104,7 @@ impl ProofType { bytes.extend_from_slice(&[0]); bytes.extend_from_slice( - &serde_json::to_vec(&(proof.clone() as SphinxProofWithPublicValues<_>)) + &serde_json::to_vec(&(proof.clone() as SphinxProofWithPublicValues)) .map_err(|err| anyhow!(err))?, ); @@ -116,7 +113,7 @@ impl ProofType { ProofType::SNARK(proof) => { bytes.extend_from_slice(&[1]); bytes.extend_from_slice( - &serde_json::to_vec(&(proof.clone() as SphinxProofWithPublicValues<_>)) + &serde_json::to_vec(&(proof.clone() as SphinxProofWithPublicValues)) .map_err(|err| anyhow!(err))?, ); @@ -137,13 +134,13 @@ impl ProofType { pub fn from_bytes(bytes: &[u8]) -> Result { match bytes[0] { 0 => { - let proof = serde_json::from_slice::(&bytes[1..]) + let proof = serde_json::from_slice::(&bytes[1..]) .map_err(|err| anyhow!(err))?; - Ok(ProofType::STARK(proof as SphinxProof)) + Ok(ProofType::STARK(proof as SphinxProofWithPublicValues)) } 1 => { - let proof = serde_json::from_slice::(&bytes[1..]) + let proof = serde_json::from_slice::(&bytes[1..]) .map_err(|err| anyhow!(err))?; Ok(ProofType::SNARK(proof)) @@ -158,6 +155,7 @@ impl ProofType { /// /// The public values of the proof. pub fn public_values(self) -> SphinxPublicValues { + #[allow(clippy::match_same_arms)] match self { ProofType::STARK(proof) => proof.public_values, ProofType::SNARK(proof) => proof.public_values, diff --git a/fixture-generator/Cargo.lock b/fixture-generator/Cargo.lock index e21d33c0..cdc95daf 100644 --- a/fixture-generator/Cargo.lock +++ b/fixture-generator/Cargo.lock @@ -171,7 +171,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -187,7 +187,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", "syn-solidity", "tiny-keccak", ] @@ -203,7 +203,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", "syn-solidity", ] @@ -2059,7 +2059,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -2070,7 +2070,7 @@ checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -2109,7 +2109,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -2366,7 +2366,7 @@ dependencies = [ "regex", "rustc-hash 1.1.0", "shlex", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -2388,7 +2388,7 @@ dependencies = [ "regex", "rustc-hash 1.1.0", "shlex", - "syn 2.0.74", + "syn 2.0.75", "which", ] @@ -2686,9 +2686,9 @@ checksum = "4964518bd3b4a8190e832886cdc0da9794f12e8e6c1613a9e90ff331c4c8724b" [[package]] name = "camino" -version = "1.1.8" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3054fea8a20d8ff3968d5b22cc27501d2b08dc4decdb31b184323f00c5ef23bb" +checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" dependencies = [ "serde", ] @@ -2919,7 +2919,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -3459,7 +3459,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -3521,7 +3521,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.11.1", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -3543,7 +3543,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core 0.20.10", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -3625,7 +3625,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -3638,7 +3638,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version 0.4.0", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -3838,7 +3838,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -4075,7 +4075,7 @@ dependencies = [ "regex", "serde", "serde_json", - "syn 2.0.74", + "syn 2.0.75", "toml 0.8.2", "walkdir", ] @@ -4093,7 +4093,7 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -4119,7 +4119,7 @@ dependencies = [ "serde", "serde_json", "strum 0.26.3", - "syn 2.0.74", + "syn 2.0.75", "tempfile", "thiserror", "tiny-keccak", @@ -4347,6 +4347,7 @@ dependencies = [ "aptos-lc", "clap 4.5.16", "ethereum-lc", + "hex", "serde", "serde_json", "sphinx-prover", @@ -4488,7 +4489,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -5736,9 +5737,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.156" +version = "0.2.158" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5f43f184355eefb8d17fc948dbecf6c13be3c141f20d834ae842193a448c72a" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" [[package]] name = "libgit2-sys" @@ -7000,7 +7001,7 @@ dependencies = [ "proc-macro-crate 2.0.2", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -7104,7 +7105,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -7169,7 +7170,7 @@ dependencies = [ [[package]] name = "p3-air" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "p3-field", "p3-matrix", @@ -7178,7 +7179,7 @@ dependencies = [ [[package]] name = "p3-baby-bear" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "num-bigint 0.4.6", "p3-field", @@ -7192,7 +7193,7 @@ dependencies = [ [[package]] name = "p3-blake3" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "blake3", "p3-symmetric", @@ -7201,7 +7202,7 @@ dependencies = [ [[package]] name = "p3-bn254-fr" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "ff 0.13.0", "num-bigint 0.4.6", @@ -7215,7 +7216,7 @@ dependencies = [ [[package]] name = "p3-challenger" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "p3-field", "p3-maybe-rayon", @@ -7227,7 +7228,7 @@ dependencies = [ [[package]] name = "p3-commit" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "itertools 0.12.1", "p3-challenger", @@ -7240,7 +7241,7 @@ dependencies = [ [[package]] name = "p3-dft" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "p3-field", "p3-matrix", @@ -7252,7 +7253,7 @@ dependencies = [ [[package]] name = "p3-field" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "itertools 0.12.1", "num-bigint 0.4.6", @@ -7265,7 +7266,7 @@ dependencies = [ [[package]] name = "p3-fri" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "itertools 0.12.1", "p3-challenger", @@ -7283,7 +7284,7 @@ dependencies = [ [[package]] name = "p3-interpolation" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "p3-field", "p3-matrix", @@ -7293,7 +7294,7 @@ dependencies = [ [[package]] name = "p3-keccak" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "p3-symmetric", "tiny-keccak", @@ -7302,7 +7303,7 @@ dependencies = [ [[package]] name = "p3-keccak-air" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "p3-air", "p3-field", @@ -7315,7 +7316,7 @@ dependencies = [ [[package]] name = "p3-matrix" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "itertools 0.12.1", "p3-field", @@ -7329,7 +7330,7 @@ dependencies = [ [[package]] name = "p3-maybe-rayon" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "rayon", ] @@ -7337,7 +7338,7 @@ dependencies = [ [[package]] name = "p3-mds" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "itertools 0.12.1", "p3-dft", @@ -7351,7 +7352,7 @@ dependencies = [ [[package]] name = "p3-merkle-tree" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "itertools 0.12.1", "p3-commit", @@ -7367,7 +7368,7 @@ dependencies = [ [[package]] name = "p3-poseidon2" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "gcd", "p3-field", @@ -7379,7 +7380,7 @@ dependencies = [ [[package]] name = "p3-symmetric" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "itertools 0.12.1", "p3-field", @@ -7389,7 +7390,7 @@ dependencies = [ [[package]] name = "p3-uni-stark" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "itertools 0.12.1", "p3-air", @@ -7407,7 +7408,7 @@ dependencies = [ [[package]] name = "p3-util" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1-new#5c26090fc284202335641438a9ee300d4bbe6f69" +source = "git+https://github.com/argumentcomputer/Plonky3.git?branch=sp1#a0b9287038ab11e165c78df1fbc2402609a7d6b5" dependencies = [ "serde", ] @@ -7670,7 +7671,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -7759,7 +7760,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -7879,7 +7880,7 @@ dependencies = [ "proc-macro-crate 2.0.2", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -7985,7 +7986,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" dependencies = [ "proc-macro2", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -8168,7 +8169,7 @@ dependencies = [ "itertools 0.12.1", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -8496,7 +8497,7 @@ checksum = "bcc303e793d3734489387d205e9b186fac9c6cfacedd98cbb2e8a5943595f3e6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -8922,9 +8923,9 @@ dependencies = [ [[package]] name = "rustls-native-certs" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a88d6d420651b496bdd98684116959239430022a115c1240e6c3993be0b15fba" +checksum = "04182dffc9091a404e0fc069ea5cd60e5b866c3adf881eff99a32d048242dffa" dependencies = [ "openssl-probe", "rustls-pemfile 2.1.3", @@ -9256,7 +9257,7 @@ checksum = "24008e81ff7613ed8e5ba0cfaf24e2c2f1e5b8a0495711e44fcd4882fca62bcf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -9341,7 +9342,7 @@ dependencies = [ "darling 0.20.10", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -9391,7 +9392,7 @@ checksum = "82fe9db325bcef1fbcde82e078a5cc4efdf787e96b3b9cf45b50b529f2083d67" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -9686,7 +9687,7 @@ dependencies = [ [[package]] name = "sphinx-core" version = "1.0.0" -source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#93e4598c5036fb3d50cb4aac95ed88decff0815a" +source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#7574ef9faf26bb8634a533b7c9e7cf2bfa3860cc" dependencies = [ "anyhow", "arrayref", @@ -9748,7 +9749,7 @@ dependencies = [ [[package]] name = "sphinx-derive" version = "1.0.0" -source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#93e4598c5036fb3d50cb4aac95ed88decff0815a" +source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#7574ef9faf26bb8634a533b7c9e7cf2bfa3860cc" dependencies = [ "proc-macro2", "quote", @@ -9758,7 +9759,7 @@ dependencies = [ [[package]] name = "sphinx-helper" version = "1.0.0" -source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#93e4598c5036fb3d50cb4aac95ed88decff0815a" +source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#7574ef9faf26bb8634a533b7c9e7cf2bfa3860cc" dependencies = [ "cargo_metadata 0.18.1", "chrono", @@ -9767,7 +9768,7 @@ dependencies = [ [[package]] name = "sphinx-primitives" version = "1.0.0" -source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#93e4598c5036fb3d50cb4aac95ed88decff0815a" +source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#7574ef9faf26bb8634a533b7c9e7cf2bfa3860cc" dependencies = [ "itertools 0.12.1", "lazy_static", @@ -9780,7 +9781,7 @@ dependencies = [ [[package]] name = "sphinx-prover" version = "1.0.0" -source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#93e4598c5036fb3d50cb4aac95ed88decff0815a" +source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#7574ef9faf26bb8634a533b7c9e7cf2bfa3860cc" dependencies = [ "anyhow", "backtrace", @@ -9822,7 +9823,7 @@ dependencies = [ [[package]] name = "sphinx-recursion-circuit" version = "1.0.0" -source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#93e4598c5036fb3d50cb4aac95ed88decff0815a" +source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#7574ef9faf26bb8634a533b7c9e7cf2bfa3860cc" dependencies = [ "bincode", "itertools 0.12.1", @@ -9845,7 +9846,7 @@ dependencies = [ [[package]] name = "sphinx-recursion-compiler" version = "1.0.0" -source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#93e4598c5036fb3d50cb4aac95ed88decff0815a" +source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#7574ef9faf26bb8634a533b7c9e7cf2bfa3860cc" dependencies = [ "backtrace", "hashbrown 0.14.5", @@ -9862,6 +9863,7 @@ dependencies = [ "p3-util", "serde", "sphinx-core", + "sphinx-primitives", "sphinx-recursion-core", "sphinx-recursion-derive", "tracing", @@ -9870,7 +9872,7 @@ dependencies = [ [[package]] name = "sphinx-recursion-core" version = "1.0.0" -source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#93e4598c5036fb3d50cb4aac95ed88decff0815a" +source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#7574ef9faf26bb8634a533b7c9e7cf2bfa3860cc" dependencies = [ "arrayref", "backtrace", @@ -9904,7 +9906,7 @@ dependencies = [ [[package]] name = "sphinx-recursion-derive" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#93e4598c5036fb3d50cb4aac95ed88decff0815a" +source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#7574ef9faf26bb8634a533b7c9e7cf2bfa3860cc" dependencies = [ "proc-macro2", "quote", @@ -9914,7 +9916,7 @@ dependencies = [ [[package]] name = "sphinx-recursion-gnark-ffi" version = "1.0.0" -source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#93e4598c5036fb3d50cb4aac95ed88decff0815a" +source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#7574ef9faf26bb8634a533b7c9e7cf2bfa3860cc" dependencies = [ "anyhow", "bincode", @@ -9938,7 +9940,7 @@ dependencies = [ [[package]] name = "sphinx-recursion-program" version = "1.0.0" -source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#93e4598c5036fb3d50cb4aac95ed88decff0815a" +source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#7574ef9faf26bb8634a533b7c9e7cf2bfa3860cc" dependencies = [ "itertools 0.12.1", "p3-air", @@ -9957,6 +9959,7 @@ dependencies = [ "rand 0.8.5", "serde", "sphinx-core", + "sphinx-primitives", "sphinx-recursion-compiler", "sphinx-recursion-core", "tracing", @@ -9965,7 +9968,7 @@ dependencies = [ [[package]] name = "sphinx-sdk" version = "1.0.0" -source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#93e4598c5036fb3d50cb4aac95ed88decff0815a" +source = "git+https://github.com/argumentcomputer/sphinx?branch=dev#7574ef9faf26bb8634a533b7c9e7cf2bfa3860cc" dependencies = [ "alloy-sol-types", "anyhow", @@ -9975,13 +9978,16 @@ dependencies = [ "cfg-if", "ethers", "futures", + "hashbrown 0.14.5", "hex", "home", "indicatif", "log", "num-bigint 0.4.6", + "p3-baby-bear", "p3-commit", "p3-field", + "p3-fri", "p3-matrix", "prost", "reqwest 0.12.5", @@ -10140,7 +10146,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -10153,7 +10159,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -10190,9 +10196,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.74" +version = "2.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fceb41e3d546d0bd83421d3409b1460cc7444cd389341a4c880fe7a042cb3d7" +checksum = "f6af063034fc1935ede7be0122941bafa9bacb949334d090b77ca98b5817c7d9" dependencies = [ "proc-macro2", "quote", @@ -10208,7 +10214,7 @@ dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -10362,7 +10368,7 @@ checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -10472,9 +10478,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.39.2" +version = "1.39.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daa4fb1bc778bd6f04cbfc4bb2d06a7396a8f299dc33ea1900cedaa316f467b1" +checksum = "9babc99b9923bfa4804bd74722ff02c0381021eafa4db9949217e3be8e84fff5" dependencies = [ "backtrace", "bytes", @@ -10506,7 +10512,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -10732,7 +10738,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -10912,7 +10918,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a615d6c2764852a2e88a4f16e9ce1ea49bb776b5872956309e170d63a042a34f" dependencies = [ "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -11285,7 +11291,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", "wasm-bindgen-shared", ] @@ -11319,7 +11325,7 @@ checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -11773,7 +11779,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -11793,7 +11799,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] diff --git a/fixture-generator/Cargo.toml b/fixture-generator/Cargo.toml index a7121822..0d788029 100644 --- a/fixture-generator/Cargo.toml +++ b/fixture-generator/Cargo.toml @@ -21,6 +21,7 @@ serde = { version = "1.0.193", features = ["derive"] } clap = { version = "4.5.4", features = ["derive", "env"] } tracing = "0.1.40" alloy-sol-types = "0.7.2" +hex = "0.4.3" # Match the forks used by the aptos crates [patch.crates-io] diff --git a/fixture-generator/src/bin/main.rs b/fixture-generator/src/bin/main.rs index 520fb234..332a8824 100644 --- a/fixture-generator/src/bin/main.rs +++ b/fixture-generator/src/bin/main.rs @@ -1,7 +1,7 @@ use clap::Parser; use serde::{Deserialize, Serialize}; use sphinx_prover::types::HashableKey; -use sphinx_sdk::ProverClient; +use sphinx_sdk::{ProverClient, SphinxProof, SphinxProofWithPublicValues}; use std::path::PathBuf; use ethereum_lc::proofs::committee_change::{CommitteeChangeIn, CommitteeChangeProver}; @@ -73,6 +73,13 @@ struct MoveFixture { args: [MoveArg; 3], // vk, public_values, proof } +fn bytes(proof: SphinxProofWithPublicValues) -> String { + match proof.proof { + SphinxProof::Plonk(pr) => pr.raw_proof, + _ => unimplemented!("Only Plonk proofs are supported for now"), + } +} + fn generate_fixture_inclusion_aptos_lc() { tracing::info!("Generating inclusion fixture using Aptos program (for Solidity verification)"); @@ -87,9 +94,9 @@ fn generate_fixture_inclusion_aptos_lc() { let prover = ProverClient::new(); let (pk, vk) = prover.setup(elf); - let proof = prover.prove_plonk(&pk, stdin).unwrap(); + let proof = prover.prove(&pk, stdin).plonk().run().unwrap(); // just to check that proof is valid and verifiable - prover.verify_plonk(&proof, &vk).unwrap(); + prover.verify(&proof, &vk).unwrap(); let fixture_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join(SOLIDITY_FIXTURE_PATH); @@ -97,7 +104,7 @@ fn generate_fixture_inclusion_aptos_lc() { let fixture = SolidityFixture { vkey: vk.bytes32().to_string(), public_values: proof.public_values.bytes().to_string(), - proof: proof.bytes(), + proof: bytes(proof), }; std::fs::create_dir_all(&fixture_path).expect("failed to create fixture path"); let fixture_path = fixture_path.join(INCLUSION_FIXTURE_FILENAME); @@ -148,7 +155,7 @@ fn generate_fixture_inclusion_ethereum_lc() { MoveArg { // proof type_: String::from("hex"), - value: proof.bytes(), + value: bytes(proof), }, ], }; @@ -176,9 +183,9 @@ fn generate_fixture_epoch_change_aptos_lc() { let prover = ProverClient::new(); let (pk, vk) = prover.setup(elf); - let proof = prover.prove_plonk(&pk, stdin).unwrap(); + let proof = prover.prove(&pk, stdin).plonk().run().unwrap(); // just to check that proof is valid and verifiable - prover.verify_plonk(&proof, &vk).unwrap(); + prover.verify(&proof, &vk).unwrap(); let fixture_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join(SOLIDITY_FIXTURE_PATH); @@ -186,7 +193,7 @@ fn generate_fixture_epoch_change_aptos_lc() { let fixture = SolidityFixture { vkey: vk.bytes32().to_string(), public_values: proof.public_values.bytes().to_string(), - proof: proof.bytes(), + proof: bytes(proof), }; std::fs::create_dir_all(&fixture_path).expect("failed to create fixture path"); let fixture_path = fixture_path.join(EPOCH_CHANGE_FIXTURE_FILENAME); @@ -240,7 +247,7 @@ fn generate_fixture_epoch_change_ethereum_lc() { MoveArg { // proof type_: String::from("hex"), - value: proof.bytes(), + value: bytes(proof), }, ], }; From fb00206dc30b85adc18d84761e1970010fcc47d2 Mon Sep 17 00:00:00 2001 From: wwared <541936+wwared@users.noreply.github.com> Date: Mon, 19 Aug 2024 10:57:34 -0300 Subject: [PATCH 02/11] fix: Adapt fixture-generator to prepend vkey hash --- fixture-generator/rust-toolchain.toml | 2 +- fixture-generator/src/bin/main.rs | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/fixture-generator/rust-toolchain.toml b/fixture-generator/rust-toolchain.toml index 19a29444..c02ee06b 100644 --- a/fixture-generator/rust-toolchain.toml +++ b/fixture-generator/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] channel = "nightly-2024-08-13" profile = "default" -components = ["rustfmt", "clippy"] \ No newline at end of file +components = ["rustfmt", "clippy"] diff --git a/fixture-generator/src/bin/main.rs b/fixture-generator/src/bin/main.rs index 332a8824..f5685125 100644 --- a/fixture-generator/src/bin/main.rs +++ b/fixture-generator/src/bin/main.rs @@ -74,8 +74,15 @@ struct MoveFixture { } fn bytes(proof: SphinxProofWithPublicValues) -> String { - match proof.proof { - SphinxProof::Plonk(pr) => pr.raw_proof, + match &proof.proof { + SphinxProof::Plonk(pr) => { + pr.encoded_proof + format!( + "0x{}{}", + hex::encode(&pr.plonk_vkey_hash[..4]); + pr.encoded_proof, + ) + } _ => unimplemented!("Only Plonk proofs are supported for now"), } } From 14c77a3d3451eebbe8fc2faa5aa153e200c4b749 Mon Sep 17 00:00:00 2001 From: wwared <541936+wwared@users.noreply.github.com> Date: Mon, 19 Aug 2024 11:33:33 -0300 Subject: [PATCH 03/11] fix: Fix small typo --- fixture-generator/src/bin/main.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/fixture-generator/src/bin/main.rs b/fixture-generator/src/bin/main.rs index f5685125..540eb117 100644 --- a/fixture-generator/src/bin/main.rs +++ b/fixture-generator/src/bin/main.rs @@ -76,12 +76,11 @@ struct MoveFixture { fn bytes(proof: SphinxProofWithPublicValues) -> String { match &proof.proof { SphinxProof::Plonk(pr) => { - pr.encoded_proof - format!( - "0x{}{}", - hex::encode(&pr.plonk_vkey_hash[..4]); - pr.encoded_proof, - ) + format!( + "0x{}{}", + hex::encode(&pr.plonk_vkey_hash[..4]), + pr.encoded_proof, + ) } _ => unimplemented!("Only Plonk proofs are supported for now"), } From 824d4fd226415bb4492d5724fc7fad14de841fdb Mon Sep 17 00:00:00 2001 From: wwared <541936+wwared@users.noreply.github.com> Date: Mon, 19 Aug 2024 11:38:40 -0300 Subject: [PATCH 04/11] chore: Update forge dependencies --- aptos/solidity/contracts/lib/forge-std | 2 +- aptos/solidity/contracts/lib/openzeppelin-contracts | 2 +- aptos/solidity/contracts/lib/sphinx-contracts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/aptos/solidity/contracts/lib/forge-std b/aptos/solidity/contracts/lib/forge-std index 07263d19..bf660614 160000 --- a/aptos/solidity/contracts/lib/forge-std +++ b/aptos/solidity/contracts/lib/forge-std @@ -1 +1 @@ -Subproject commit 07263d193d621c4b2b0ce8b4d54af58f6957d97d +Subproject commit bf6606142994b1e47e2882ce0cd477c020d77623 diff --git a/aptos/solidity/contracts/lib/openzeppelin-contracts b/aptos/solidity/contracts/lib/openzeppelin-contracts index dbb6104c..4764ea50 160000 --- a/aptos/solidity/contracts/lib/openzeppelin-contracts +++ b/aptos/solidity/contracts/lib/openzeppelin-contracts @@ -1 +1 @@ -Subproject commit dbb6104ce834628e473d2173bbc9d47f81a9eec3 +Subproject commit 4764ea50750d8bda9096e833706beba86918b163 diff --git a/aptos/solidity/contracts/lib/sphinx-contracts b/aptos/solidity/contracts/lib/sphinx-contracts index 57b8995c..cb4520c6 160000 --- a/aptos/solidity/contracts/lib/sphinx-contracts +++ b/aptos/solidity/contracts/lib/sphinx-contracts @@ -1 +1 @@ -Subproject commit 57b8995c9b281281180fa5d9aa5db7909ea8f95a +Subproject commit cb4520c63ff695d6a16fa2ad56001882ebf13591 From 886b5da01110f58f72caa8001b5f8aff006b47e1 Mon Sep 17 00:00:00 2001 From: wwared <541936+wwared@users.noreply.github.com> Date: Mon, 19 Aug 2024 11:58:51 -0300 Subject: [PATCH 05/11] fix: Update Move verifier constants and vkey logic --- ethereum/move/sources/plonk_verifier.move | 38 +++++++++++------------ ethereum/move/sources/script.move | 9 +++++- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/ethereum/move/sources/plonk_verifier.move b/ethereum/move/sources/plonk_verifier.move index 4f9f049e..27c2b9f7 100644 --- a/ethereum/move/sources/plonk_verifier.move +++ b/ethereum/move/sources/plonk_verifier.move @@ -30,26 +30,26 @@ module plonk_verifier_addr::plonk_verifier { const VK_DOMAIN_SIZE: u256 = 67108864; const VK_INV_DOMAIN_SIZE: u256 = 0x30644e66c81e03716be83b486d6feabcc7ddd0fe6cbf5e72d585d142f7829b05; const VK_OMEGA: u256 = 0x1067569af1ff73b20113eff9b8d89d4a605b52b63d68f9ae1c79bd572f4e9212; - const VK_QL_COM_X: u256 = 0x291f93471379f3bf591fdbfe309bfe7a40269d6427b1aa1a8b8de960d96775a8; - const VK_QL_COM_Y: u256 = 0x2283bc4ce9b8918045e93744d83fca3414ff664d225b765162c1aa94fbe55e1c; - const VK_QR_COM_X: u256 = 0x04294a9de8e6bc370d5f036314c4705b434aa4f1b937cc35e6a767972829184c; - const VK_QR_COM_Y: u256 = 0x01d83e7ef2d621f3edac2a4d5a930b3b5660854ef8217ee68932455e32fa5ec2; - const VK_QM_COM_X: u256 = 0x2601143f3b897c27215a4353e2f49cf286f3a62e6829993ff5ba4c9b936f9f95; - const VK_QM_COM_Y: u256 = 0x2f879a9b7806fda982182f42e4c897ecddfe2c7162a6512e5eb7b0eb6f521008; - const VK_QO_COM_X: u256 = 0x07e1f52079636bee266de2c3c06d498545baf9918b54a44885e6f4cb63a6d47c; - const VK_QO_COM_Y: u256 = 0x06068ad3520d70299638b2dba0242509254ab76f384031b47050d612a13fc895; - const VK_QK_COM_X: u256 = 0x0cbf77bfb1482575e8fb885c67f88094020d86a77f4fa844589a7d332574a537; - const VK_QK_COM_Y: u256 = 0x1d9db7e100affcec0f7e75af2bfa7216f450df1950b94fff7fee2795cc0a7dac; - const VK_S1_COM_X: u256 = 0x073a45a1ce7d752ff0ed055b7ab0936aa8466c5ed136d92489ccf2ad067fbfb6; - const VK_S1_COM_Y: u256 = 0x086bbe0f9d3160b2fe7844ae9483e6a9c02727d51acb6b555f65425a743de8d5; - const VK_S2_COM_X: u256 = 0x2cb45f95eebb782301c335f57956c6ddd6f467183834fd1e01b1299f490826be; - const VK_S2_COM_Y: u256 = 0x08195b6fd528afe6dc76691dc464f17de6f01b133291fd7023d3fddf2f67dc28; - const VK_S3_COM_X: u256 = 0x1c76f451ec46bd2189516ef80c4cb09c5cdbbfa4e93a9847f44455d15e911080; - const VK_S3_COM_Y: u256 = 0x0f6957bf727f83b077b262c8ec3060b68389a4b6185fd0ed3e4bf0a685ea6eed; + const VK_QL_COM_X: u256 = 48928834306167443025507055502202067200240823993352402100102620828723773653; + const VK_QL_COM_Y: u256 = 2042095935721586861269278494849843501067752929878965775735116249791377189349; + const VK_QR_COM_X: u256 = 9263055746511352788967168242441740132968013915506788573208357567094202827437; + const VK_QR_COM_Y: u256 = 17628428921127964441677913917368279104903634377401680292327523375466045449821; + const VK_QM_COM_X: u256 = 5386497313205418866075671870604723600462702364443576348523388000562720155397; + const VK_QM_COM_Y: u256 = 10251277836844837493691486022258656237409980141605838548173765900573579037048; + const VK_QO_COM_X: u256 = 17892144205963166011887822724506030774548821972604674531477350577120233687735; + const VK_QO_COM_Y: u256 = 12628315211947344797164579921778371930128823896428193831555008525111790366444; + const VK_QK_COM_X: u256 = 14861769437953976497529730847443333640366704373271067429561158303180456942870; + const VK_QK_COM_Y: u256 = 14662562919486173853933305484282245429424763948861532235926442375885400771007; + const VK_S1_COM_X: u256 = 3073888053341554920881016181058807402426536838286493276385115449633539775248; + const VK_S1_COM_Y: u256 = 5384424222329100501817783245522106750938337029519044356500555260900853476873; + const VK_S2_COM_X: u256 = 19461186879863774198290657382293078306984201116484502913827155116237255045292; + const VK_S2_COM_Y: u256 = 2873204720580225076071638780752364114819201030390154715441418039817738911367; + const VK_S3_COM_X: u256 = 2096906860978765391282094222602615310661660657556910851436043580799708727565; + const VK_S3_COM_Y: u256 = 2161063310508571838500646252285726166473952589055632093444464980556430797130; const VK_COSET_SHIFT: u256 = 5; - const VK_QCP_0_X: u256 = 0x237f7ac20e4012ea653cdfd8fbabd4741c883dc784d31ef04005b398beebe5e3; - const VK_QCP_0_Y: u256 = 0x0525090d2e5e3c446a811ba313f3425326375032a51d287315e681f8bd886694; - const VK_INDEX_COMMIT_API_0: u256 = 0x0000000000000000000000000000000000000000000000000000000001bdf707; + const VK_QCP_0_X: u256 = 7517051128132060126170113520963297922398874457515198318132621766317406868261; + const VK_QCP_0_Y: u256 = 11472137363060303021114982968577795162044850614296769357227193724808785551909; + const VK_INDEX_COMMIT_API_0: u256 = 31314682; const VK_NB_CUSTOM_GATES: u64 = 1; // Utils for Fiat Shamir diff --git a/ethereum/move/sources/script.move b/ethereum/move/sources/script.move index 41e25945..d68693bc 100644 --- a/ethereum/move/sources/script.move +++ b/ethereum/move/sources/script.move @@ -6,6 +6,7 @@ script { const ERROR_LENGTH_VK: u64 = 3001; const ERROR_LENGTH_PROOF: u64 = 3002; + const ERROR_PROOF_VERSION: u64 = 3003; fun run_verification( _account: signer, @@ -21,8 +22,14 @@ script { // convert vkey let vkey: u256 = bytes_to_uint256(vkey_); + // check hardcoded plonk verifier hash + let expected_verifier_hash: u256 = 0xa8558442; // corresponds to v1.0.8-testnet artifacts + let verifier_hash_header = slice(&proof, 0, 4); + let verifier_hash: u256 = bytes_to_uint256(verifier_hash_header); + assert!(verifier_hash == expected_verifier_hash, ERROR_PROOF_VERSION); + // convert proof - let i = 0; + let i = 4; // skip first 4 bytes let n = length(&proof_) / 32; let proof = vector::empty(); while (i < n) { From 2479c8a22539a7836659b03b9a310c3a5d5ecdcb Mon Sep 17 00:00:00 2001 From: wwared <541936+wwared@users.noreply.github.com> Date: Mon, 19 Aug 2024 12:06:49 -0300 Subject: [PATCH 06/11] chore: clippy --- fixture-generator/src/bin/main.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fixture-generator/src/bin/main.rs b/fixture-generator/src/bin/main.rs index 540eb117..7da19b38 100644 --- a/fixture-generator/src/bin/main.rs +++ b/fixture-generator/src/bin/main.rs @@ -73,7 +73,7 @@ struct MoveFixture { args: [MoveArg; 3], // vk, public_values, proof } -fn bytes(proof: SphinxProofWithPublicValues) -> String { +fn bytes(proof: &SphinxProofWithPublicValues) -> String { match &proof.proof { SphinxProof::Plonk(pr) => { format!( @@ -110,7 +110,7 @@ fn generate_fixture_inclusion_aptos_lc() { let fixture = SolidityFixture { vkey: vk.bytes32().to_string(), public_values: proof.public_values.bytes().to_string(), - proof: bytes(proof), + proof: bytes(&proof), }; std::fs::create_dir_all(&fixture_path).expect("failed to create fixture path"); let fixture_path = fixture_path.join(INCLUSION_FIXTURE_FILENAME); @@ -161,7 +161,7 @@ fn generate_fixture_inclusion_ethereum_lc() { MoveArg { // proof type_: String::from("hex"), - value: bytes(proof), + value: bytes(&proof), }, ], }; @@ -199,7 +199,7 @@ fn generate_fixture_epoch_change_aptos_lc() { let fixture = SolidityFixture { vkey: vk.bytes32().to_string(), public_values: proof.public_values.bytes().to_string(), - proof: bytes(proof), + proof: bytes(&proof), }; std::fs::create_dir_all(&fixture_path).expect("failed to create fixture path"); let fixture_path = fixture_path.join(EPOCH_CHANGE_FIXTURE_FILENAME); @@ -253,7 +253,7 @@ fn generate_fixture_epoch_change_ethereum_lc() { MoveArg { // proof type_: String::from("hex"), - value: bytes(proof), + value: bytes(&proof), }, ], }; From 7fe6d6b1e9fc1dc537c5746f2716213e265ddee9 Mon Sep 17 00:00:00 2001 From: wwared <541936+wwared@users.noreply.github.com> Date: Mon, 19 Aug 2024 12:33:57 -0300 Subject: [PATCH 07/11] fix: Fix the script.move version header logic --- ethereum/move/sources/script.move | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ethereum/move/sources/script.move b/ethereum/move/sources/script.move index d68693bc..44da427a 100644 --- a/ethereum/move/sources/script.move +++ b/ethereum/move/sources/script.move @@ -17,23 +17,24 @@ script { // we do not perform input validation of public_values since while core verification it is hashed, // and if hash is invalid, core verification will simply fail assert!(length(&vkey_) == 32, ERROR_LENGTH_VK); - assert!(length(&proof_) % 32 == 0, ERROR_LENGTH_PROOF); + assert!((length(&proof_) - 4) % 32 == 0, ERROR_LENGTH_PROOF); // convert vkey let vkey: u256 = bytes_to_uint256(vkey_); // check hardcoded plonk verifier hash let expected_verifier_hash: u256 = 0xa8558442; // corresponds to v1.0.8-testnet artifacts - let verifier_hash_header = slice(&proof, 0, 4); + let verifier_hash_header = slice(&proof_, 0, 4); let verifier_hash: u256 = bytes_to_uint256(verifier_hash_header); assert!(verifier_hash == expected_verifier_hash, ERROR_PROOF_VERSION); // convert proof - let i = 4; // skip first 4 bytes - let n = length(&proof_) / 32; + let i = 0; + let n = (length(&proof_) - 4) / 32; let proof = vector::empty(); while (i < n) { - let chunk = slice(&proof_, i * 32, i * 32 + 32); + // offset by 4 to skip the version header + let chunk = slice(&proof_, 4 + i * 32, 4 + i * 32 + 32); push_back(&mut proof, bytes_to_uint256(chunk)); i = i + 1; }; From 84c00a36ce6ee5394e5b7b74ff4eab6287e118d1 Mon Sep 17 00:00:00 2001 From: wwared <541936+wwared@users.noreply.github.com> Date: Mon, 19 Aug 2024 12:34:22 -0300 Subject: [PATCH 08/11] chore: Update inclusion fixtures --- .../contracts/src/plonk_fixtures/inclusion_fixture.json | 4 ++-- ethereum/move/sources/fixtures/inclusion_fixture.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/aptos/solidity/contracts/src/plonk_fixtures/inclusion_fixture.json b/aptos/solidity/contracts/src/plonk_fixtures/inclusion_fixture.json index 91c23ca2..a34be5c6 100644 --- a/aptos/solidity/contracts/src/plonk_fixtures/inclusion_fixture.json +++ b/aptos/solidity/contracts/src/plonk_fixtures/inclusion_fixture.json @@ -1,5 +1,5 @@ { "vkey": "0x00336c570224c00161ca7b3c275c24f3968aa09086c31d09d98691bce109f4f6", - "publicValues": "0x205829098a4c0273312e8bc4fdbde28fc12abdc540c88bdd9abeef0a85d706ec3dd645e837249b87982ab2ba4031dc2c364f9a4c6cbeed583e519de5ef1918fc020202020202020202020202020202020202020202020202020202020202020244fa02feb400a383b1824df6198c7e30cbf60a21838efa46fedf35f760fdf25839d1a3ec2b5d09aee31c1c0c380eef28744673ea3ab7e9d065baccc8d1874ca1", - "proof": "0x1ce8c01edf002b737588f10123bdf9e8cbb01689942f3846b20457dd9a8d96261d7134800be23b5fa21d8c06c1ab4b7f769f9b02306d4a83263e7a317856eb35139e80ff3da26baf85b7d65eac468acb9548dc48c3e5fa5c31a2a5772272357107a502780b3ab020e853b1d62fe41a5443b2b2c6db53429e98f6d6a2bb680a7830066367d1f6eb1805040ce5886aeb3699f5f7d81d5f218fe855a8592f34f93e01e5caaa29dde6fc4053eefde5ac16f18380fe029dc0cbf0a3c66c30d198e56816aafb4e53ea238e83879b0ee30c709a473119051ae99db92ff0a0bb7d3fab370d301d0a07a50d43d7ceab67cd8394902314b426e1b033215c36ccfc977919d4015e82dab97c4d42440c349f883769513184628dc7ca08afdf78809600b3a70205c4c21cf258351fad9815610e3314e351f52603f2edec8a44f9a1fe28170ca213c504614b75a750bda658c1ef9fdc0be20104c0384a1cb3d3ce0d706c3f22ef2c46213d5a54a90084ebe33d86aea51da01af554cb2d8f34ab780f5a0d15012d2ed792b54cd954533022d8f6da843df731da7ac74068f787cb14250a4111b27c119d2aa542722ce6144b7ab6fa8938eef592f3a9784a3b6f1897cb551d738e9e000107a3a81a0000c59e5676b8a5112864ae0d37fe2bcac26509d00082bbfaeb11431f2aef7babb872321b6e4891742fd99a0ba4430fe15377ca5a5fd5c0ac1f016706f30512e34de4489bac32a9c6b344e9669af668a8b349b53237a327ba8e0184eb7dd4551ba4d26df8ad1f8b9f0a6cb57dc15e3f1cad6cbd413bc2e5aad31fa08db5fa836e4081d231405fef03badb5d2d77e45e02dc9c21d77011a3d17821c786a444376cea630bcbe762ca4d8c5c9848c6d2f1a99cff2d7e0a5d1939311c1cd2662c3d8384921674fe688c89d879604a2d5be2b119916486dee66d57da13dc674967c078c7d99e172eeb0dd8526c4b0043e5ddab832c476ba5e69f2f63075d4e75488ffc32501e62c79871d83d49f61208808807f2c66fff75f768ce0b07a1b7151f28a4b35c25dfe0659b7c915efb71b443f130329903668f8b7f0d6302bcc76b83612f6d095f5482b293777ee74087f1772535286c982b3bdcfbcb7e028b64b80a3cadb05ccb321fd0f188f07257f1ebeb6134b9fce1cf881c210c951a587d747964a20923b47a5f2df2fa0743f62006ea7a61b12b7e353d571039f5" + "publicValues": "0x205829098a4c0273312e8bc4fdbde28fc12abdc540c88bdd9abeef0a85d706ec5c1e92bfe65b6200f1f7383d8fe6be26f70e05d784df4a170e38eb6be236145c020202020202020202020202020202020202020202020202020202020202020244fa02feb400a383b1824df6198c7e30cbf60a21838efa46fedf35f760fdf25839d1a3ec2b5d09aee31c1c0c380eef28744673ea3ab7e9d065baccc8d1874ca1", + "proof": "0xa855844200667c07f515143095356049737e6657b90cadabb9e75b17ac3a9dca9ee5e7f52c8b43ff6d992c9eff8ee2c0628b15a5399f549188867048db7c0367e7c79b9d233c2374c0a912c170f58bf362342adfd7f09ce84f7000ac4f065aae3c1502172df54ea50bdb9ed329044aef6350f53a2233c71bfd0c6b465a667b6ffe5424301eaa330341702e7afd6ae68033b0707744b5e50a149d59af317b8e52401af21d102acdfe11036570f2d0691342614e3ddd6549cfd67729fb189140573e946032218c0fb39ec5093827752c7b54ef6468e2f86f6ee9e8405467a30388ae7f42ff08857c2a06da015595c42b9df69c4937ff73f22e2d954ad067ae45a04148782c0e310ecba87e87e0a0b6e5ecc2bc605b3dc7a5a4e2547018d7f18b49e519ece9067be6db04dea06356dea63bca0ef328ed312ab9270ed04dd6dffd3524d83ade23cb10051eb93281b83417e2cba965885e7ee012d9ee5b9d497cd1dc79996c3b301fd4279c8fef195adabc01808df994d148091ce14176df7831ca0b71969384050a16976a9e578f3cc941d84d436b920f6fd3daad140b65b8ae89e4ab9e2c810c94eb34bb13f7d67249579f1a01f071abcc17b9ed5966a8934981fbd758ec86272a97a5ce2f775b958104caff4d25d410dbbeafa51b9607fea23eb50795ace414795d11ba6618cff0899fd73081ea45552543c720c96d332a69e689381c45541fe8bea6880184167ad371fbcaf02a4d773ab4fcb1e9bfd8e794ce2aa5b8fdb100b46c07bfea1a1fbad8482559a57ee58cd558be3e2ddcfa09b8784efcbb41f907040ec3bc4c94b45cde233abbe553d8c1d63c95e0c255c1254a00e920c0a4390c7000b724c6824524ecaaab56665b799bfce546e0564342f9c3c6e60ec827d126c8bb9c6c2f735e6343c1e9e5bdfd80337af117b43bacc8a6f1caf2b943f2430c02db189892f57e103ba7119e5e280ae84bf0df40f68d7c7feca8a5a04b1cb50122e868aa96fe13c9186855897783a5db92f18469aaac677b177d19565b08521d3810e9094abb668d8cb919f20b6c6af73a38d8cd20b353e690160916bfb7c4124465371d102cbb003eb9ab98adc44184de1126ffb20de7b7899067b909fc8b1092a0c2e947725839c187ad71869e6c53c63dff202f839ff654baec3f4e607c24101e865f15d29b2bd21baea29231bebe0a411ef5adc219b024c236513dd741" } \ No newline at end of file diff --git a/ethereum/move/sources/fixtures/inclusion_fixture.json b/ethereum/move/sources/fixtures/inclusion_fixture.json index 994c7c27..fdc2bc4d 100644 --- a/ethereum/move/sources/fixtures/inclusion_fixture.json +++ b/ethereum/move/sources/fixtures/inclusion_fixture.json @@ -14,7 +14,7 @@ }, { "type": "hex", - "value": "0x0e3a59351d759a5a4b5fdda0bd7bb1ee7368bb0d3aa86780006f90bfdc46abb92316ffbf3decf01933a1d7bf2d4ea4ed45a23253ed043cd8cf82b918c67f80570190ccb3aac7a70d26951666e12cb65ac7d2aa66646b5ac8e6d61ce44453c9c50491fd71ab3db7862b87bf6d713a0559c5318092162ab46c2aa38fd7461a11d4090d7e7d62d7a0f1aabde824b4a15f0e7011d506967d37de155ae2355fc5db7a1f5a59ed2fd8ee8514f97d586d53d3614cab0cd6b617d8db4b603ded1f1302292e4087407be3b2b8991cc001d1243b5c87d127d32b752d74ae904a5f5b8436a1302804a63e25afba036a919ad9fd4ea0faf1add91ff58da49d400848bc075f14233074c0c5126e1e66c601a38a160b4c8194e892a19b78adb86ce575d5de095d047a60917c36bee08cac090095c11437ea0c13892825f4774b4a5ff804c909f50d71fd40593ebea437bcc4b3487d9f07a3681ec4dbcc76b1ecd2db3338227d042a4dbd3d1d8f19345494819ecab3fde189b00a65fde6f719cb7df39f920bb4c40d74e89802c132cd61a57fa469ca7fbc3822e83fc76912a275ab47028a2dca67194fb8e4374d8ea41d412cab0bd4bd75b9972eea8b2edacb595ff9dfe031cf3410d77a62582a27d616c39dadeacb56765b54a74b484a258696044d7230afe4b82d025e7820d4fca8cf050b5b4dce120f98c839a0b1396faa2695a1de699660a827afb70cd47d32a8d32876d791e1247b63d43f2a936ac71afae2d26412242ce02fb0d0901d80976b103cfef869165f7f0859b3aa2cb9d91817e7e8e257555ace288b37c0642a879314ebc8008605f6301d97951abbcb99d259b554fc7e4b1d8b01169cf34cce9ae0474de8d22d7ff2d59e9963761dff256607f422be7108affc0f9763c53df402495a14b65db7de9353d7376572132e2c8ab7b93932aa1737b41e7181d4d4b19296867d8cf2778f6465c920b24e5b9fe5df0343f1fdb3617a3f0521e8ac0b4ecbd3d50844ac3ae2dc1de56b0edb2df1ed4738d385d9d21692ef243bc792357204054aef4604b90ae203ebaa0b25bdccf6034859370fa17e155c08d264670b37166e5bc67948645f2328c1f9a6063012a9a6c87fd5b5ed9381062c217364c3e83913b47a8f292f929ae0de17d0a754b0b8b955d1b3a7b94c5c3a2990ebe1fe32ca540f241511e3a6d375e04e7d0fd53147cc1f91cc698f5277b6" + "value": "0xa8558442145a08a26ee2065c00f7c2b6513ca5b703cf0c2ca60a7f4dcadbd37fcf4fba580cec82e09b467e4bf1e113e6de4aa1dff150237be24cee593aa4e0cf8167f5c72ffff353b5611c84676f747b7747bd2eca4812f7d3661b16ea219ddce4b7986b296ee3dda66116bd6c16d4e3a07d790b3e7edf4c92568e02d64fdd5dbabbfd771e9a87eb9abc6387b978133f774328143603095cb4028026bbfadc7be5c7517d15e75452be2d9c0d6328f553e10536db2097bcf330a5dfd1ec1bf5f490cf164816d45e4aabf58eace80023a5f9aaf7449812b1c8a4549c46332781234b6e3b9000eb5ccc975658d05d1d335a5596866b331abe08efc6cf591f822cde254d62c607fc59b832efcc57f879f56e4030003017eaa159622bc1dc3461a01afedb62bf1faca3a7ae5030a44af45705509f112cdb00b065991e5df2be509d47bd37190a282801481e6cb6c56cdfa4d3fa985525cb5ce206469dfaef61f0a198b025c7051025c8f67ca110ddaa9eacfd64a3033c840844a6445c5dbf5873cdefbe81b189097432906d0f50a86476f992f9e9eb63e7669344667821a65c8ae8b5aa0a94fe10e3eb5c335a6464659ae2d9151869a25a4494172ca759c8d7d4bbeb6fd843ef2fa24c9ba20e8d9ba9ad009960de388b350f2e22026d8641ecd70a3cc928e556222838e52c02d618ab56de6ed07716043fe4b40c0ff6df78a24fc3eae76d0b93021896bf2190dfeccfb5380174e5517234ddf1d380a017cf075544854a1ce4ac081c30c2838da653b84fd75c6a177345b67f1b5d22db6f55960d78d91a81b1b92781ca27587d988440fd7a2fed948245a1ce98f7581c2ff678755b640d0af9a024509d33274219dd46cfe49d335555186b248a72285afd54e09655a919fc5373185a2f641161299d13b63fd1c1c08179422d6b97589f95f648d26fafd9eeb70d1887b19becea8174ae42518f2ac6602246c80fa0168e09947ae298844a8fe7371e367a516c701f379bd7a4346d617e5a7fd282548002af9d39ecc5787706526e2696e210a6fa8dc46f0bd2facd5ae7ff2984ebd5e129d8619313d9bbb2d754502430bbc4b1ac5de6d49e073f0396391f6dda96e3b60d281eea42107c8da442be16fedf7805410fec1a0befbb7aab7cdddef102151ef19217829fcef4f98fda962c69189e2dd0feb47f077c93066cb59c6207d12092f5fa0ea6a7ee547b0c5b2c" } ] } \ No newline at end of file From 54751501fa8575fde78a65376bdde1fb28470e15 Mon Sep 17 00:00:00 2001 From: wwared <541936+wwared@users.noreply.github.com> Date: Mon, 19 Aug 2024 12:52:04 -0300 Subject: [PATCH 09/11] chore: Update fixtures --- aptos/solidity/contracts/test/test_lc_proofs.t.sol | 6 +++--- ethereum/move/sources/fixtures/epoch_change_fixture.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/aptos/solidity/contracts/test/test_lc_proofs.t.sol b/aptos/solidity/contracts/test/test_lc_proofs.t.sol index 4351926e..93237a36 100644 --- a/aptos/solidity/contracts/test/test_lc_proofs.t.sol +++ b/aptos/solidity/contracts/test/test_lc_proofs.t.sol @@ -25,12 +25,12 @@ contract SolidityVerificationTest is Test { // valid inclusion fixture for testing purposes bytes private TestInclusionVkey = - abi.encodePacked(hex"0049db69bb4f4f06cddfb1aa47738ec568589ecb72cce157064391dab5bf749b"); + abi.encodePacked(hex"00336c570224c00161ca7b3c275c24f3968aa09086c31d09d98691bce109f4f6"); bytes private TestInclusionPublicValues = abi.encodePacked( - hex"205829098a4c0273312e8bc4fdbde28fc12abdc540c88bdd9abeef0a85d706ec4921987f359fc1f9482c493bf7378db9fca188451b56fe3007ec8c0105d7c2a9020202020202020202020202020202020202020202020202020202020202020244fa02feb400a383b1824df6198c7e30cbf60a21838efa46fedf35f760fdf25839d1a3ec2b5d09aee31c1c0c380eef28744673ea3ab7e9d065baccc8d1874ca1" + hex"205829098a4c0273312e8bc4fdbde28fc12abdc540c88bdd9abeef0a85d706ec5c1e92bfe65b6200f1f7383d8fe6be26f70e05d784df4a170e38eb6be236145c020202020202020202020202020202020202020202020202020202020202020244fa02feb400a383b1824df6198c7e30cbf60a21838efa46fedf35f760fdf25839d1a3ec2b5d09aee31c1c0c380eef28744673ea3ab7e9d065baccc8d1874ca1" ); bytes private TestInclusionProof = abi.encodePacked( - hex"19766fbbd87b34a85a37d4553e46adbdefe3d1633ef632c4b3a3dd1cfffb88c623c58ea58729fba3e2d139921d026f80c35c352cfada675f68caa33f5fadafae2c90327aa4b63e76fb8e3cfdfa4dd77e1f7a739bff6c2056378be4a8c2a298850972c1299d56ca6500d1590c074f50c5508c7123fc79b594aa2752b3417821242c094a1df1918b7e42b1d63ef7ce475a2212a24b6c0e4b364a50fd9f259348192930efcd1ec69a0bf4c57d0152bfb77c06493960940735109948865814b508f32acb9dac228c3708b66e17894b65749e0093c6d1bc3efce4dab0e10efd0cb6a00609f7c720e1298aea5fcc0d54ae838c592079b6243e19856a86e619a7217c371b42efdf4853f99e80dbccabb4a6c15404360b606ad684787e207472096b34f81b36e6214b2ecb98a1897f701096aa0cea17ebe12cc01274b78f64dbb385e7e12cfa34313e39c5d7749d78c55b5aa86e1b91eb129d83b63915cb3651772a20f81f2f24cbbe4259192b106742d272409c701a0e16f39e9a1895aa69038f51c34709b18c22ef8af33aa72aac809e4bcf028da2f19506973bf3ada9345e3d760d4a2d40cd9354fbb88b5cb2185b3a0438c9450b822c6809b7029dedcf0a4101c4701d5cfd4cb0c5ca526f2b7a3f8eca95473e666cb8a7db1f54e5c5765c49e4c5132e2b17ab8ebe6262ca821de5e00fcf24bdf06b3a93856fb7933835a18b849cda1d32d128b4c05318b9c08c08b39777bbd9e66d89aae1ff6b675a07fea86a8dd71f9a3c8db30779f58c79a2ab32e7f423fd4896d235c4df610a13792693911b351c240dbf6a1c87cdb5287d5eee80491b1fe322e54e4cb596612573d2a63689c2278a84e391193bc3a6ddab48f522b819d067e77a7f0df1ca4538e401cfec706c0cc2ab73e04805b7ea000bd647a67d4d701de3fc7812c2b5aa22854d9a7d39212742d4b51e4122308e6249b1601b5098ec2926480fca1abb4f7e57c66a846ee203898982369346dd5cdd8d16ed498a663a0ed8c07e0aa1064358363bf282a0d70fdd7328163b0624eeb6981ebe70e9a0c4afffbb09d896b068f8b54e7e4a0d62081e6124a36ec5a174ced54f63e2b75d96d7438395f8ee86195e35b619a29a341b1e44cb366a1d505a7c1b6579e1f0963631df08410ddf88fc44a5540c7296b6273ac8f322f54a991abcd4e9a4a8b174888bfd23b0748bcd5a31d48c1aaa93dc" + hex"a855844200667c07f515143095356049737e6657b90cadabb9e75b17ac3a9dca9ee5e7f52c8b43ff6d992c9eff8ee2c0628b15a5399f549188867048db7c0367e7c79b9d233c2374c0a912c170f58bf362342adfd7f09ce84f7000ac4f065aae3c1502172df54ea50bdb9ed329044aef6350f53a2233c71bfd0c6b465a667b6ffe5424301eaa330341702e7afd6ae68033b0707744b5e50a149d59af317b8e52401af21d102acdfe11036570f2d0691342614e3ddd6549cfd67729fb189140573e946032218c0fb39ec5093827752c7b54ef6468e2f86f6ee9e8405467a30388ae7f42ff08857c2a06da015595c42b9df69c4937ff73f22e2d954ad067ae45a04148782c0e310ecba87e87e0a0b6e5ecc2bc605b3dc7a5a4e2547018d7f18b49e519ece9067be6db04dea06356dea63bca0ef328ed312ab9270ed04dd6dffd3524d83ade23cb10051eb93281b83417e2cba965885e7ee012d9ee5b9d497cd1dc79996c3b301fd4279c8fef195adabc01808df994d148091ce14176df7831ca0b71969384050a16976a9e578f3cc941d84d436b920f6fd3daad140b65b8ae89e4ab9e2c810c94eb34bb13f7d67249579f1a01f071abcc17b9ed5966a8934981fbd758ec86272a97a5ce2f775b958104caff4d25d410dbbeafa51b9607fea23eb50795ace414795d11ba6618cff0899fd73081ea45552543c720c96d332a69e689381c45541fe8bea6880184167ad371fbcaf02a4d773ab4fcb1e9bfd8e794ce2aa5b8fdb100b46c07bfea1a1fbad8482559a57ee58cd558be3e2ddcfa09b8784efcbb41f907040ec3bc4c94b45cde233abbe553d8c1d63c95e0c255c1254a00e920c0a4390c7000b724c6824524ecaaab56665b799bfce546e0564342f9c3c6e60ec827d126c8bb9c6c2f735e6343c1e9e5bdfd80337af117b43bacc8a6f1caf2b943f2430c02db189892f57e103ba7119e5e280ae84bf0df40f68d7c7feca8a5a04b1cb50122e868aa96fe13c9186855897783a5db92f18469aaac677b177d19565b08521d3810e9094abb668d8cb919f20b6c6af73a38d8cd20b353e690160916bfb7c4124465371d102cbb003eb9ab98adc44184de1126ffb20de7b7899067b909fc8b1092a0c2e947725839c187ad71869e6c53c63dff202f839ff654baec3f4e607c24101e865f15d29b2bd21baea29231bebe0a411ef5adc219b024c236513dd741" ); Wrapper wrapper; diff --git a/ethereum/move/sources/fixtures/epoch_change_fixture.json b/ethereum/move/sources/fixtures/epoch_change_fixture.json index bd325272..050df0bc 100644 --- a/ethereum/move/sources/fixtures/epoch_change_fixture.json +++ b/ethereum/move/sources/fixtures/epoch_change_fixture.json @@ -14,7 +14,7 @@ }, { "type": "hex", - "value": "0x0a40152d92937c82bb55f66772597c967656b632b0914d6e719b37fdff5736aa3057788f7174ee7fea58ae31ecf7b141310789b6039d8109f838615eb54937852bf2a37633445c0696eb58885f402b73970115499068de6d6db5569cd5b274de170ffbca86e7113643a5df99c7a4a29fda7d2f79d31747b0c762d0d1dd6a71842bf014278929e20faf998b7d8cda032a8abbf834fbc9e16d7777bfb541493e3c13dca2e795f9fac44e8917db29a3b6b68a60ebf5c05d8cd6b0af9f350c8527e71e190666b98c228f4a0a00a9c6dc2d2d4a88cb8a38dfdf8cc55b39dcd2c3bf582ef998102c9fe7245ea2fc38d71d35b05ec009ba345735ba9c878ed3d1145de412ce064d79c6c10d9da0284a82748d2870d62c8e4845c23002e8596939acff44190eb90c456103c1bf78f5db603051551115b3dd93d6bf177217983425cab6c007bd879a30c7c55732dddc126962f05da7dab688683870c79cbd3b791805c49e0fb377c8f24028fd501415b7361283a5e0374da46c186816f1359d32f88e56d300d8758f4f9eb2a4bb438c062a718756e46a3833bfdd83232994fe3ed0fa5366079e6667234f5322ca04a53d67398389062a31f3f1d6fddcb0d552a41b797faa297159477929f83025f09c015d398bbf21b2c0f904c6e3772d8cc2469b9198bf3024a5a2f7e23ff22df35a93e5f3fbecc05dee4d917c240315b851a7277ad65e03eefc341a058cc7c19dd8a321feb6001a87966637146eeb4e1497c78123d258036ba69d90ab7c5ef4ccc775decf09e09f90718976f82a8d2bcdb8d0aa94ff320d303b596558a343da09a017b81f782016bb43185c2424294f5a4991e5b857471018eb4ff2aca722e1e421419ea902e9a0f3db567ead0d21d460fea9d5a28d1411251640189e4229052bc0b65a34ddb62b8c41d2f0777a27ecd703b8276d40aa02eb69cc3dc3a836af6b33867a0c11fa667a55ee6433bd3030ab4c6609358b841c42f95f90c9d83f68f2c8c60ea0dd07fb12f2796643d13d8127471bf19d83e41edb6682fea176d36ea25d42a46846643d283be9ec36c1da867c5935c5e03f402431a2b733885b5aad6627d3dcefc52136b0ab987cfbad68ed8a3d9e6926a4380b7355bebd3be1e14c10e432aa8b98287aacd19ad0f3e9e59b6f912c6849656021675cb6b7788c5ee6abdb93761608ec62cc487be0c3e33cec4d054e0fa56605" + "value": "0xa85584420fd45c6fef3776719fe89b01980dbcd3720b5386fe4a21016432c625eb651ccf2b759ec295d73c34a53318645c641a901cff6038bf1f9f2df2d66e5b94519a7713baa08cbd531848786eb484c2221426690c7755444bdf1efe32399641d3ed900216e169e571fe77eb90a5990cc6ff9de9cec78b198cc736eacce9b27edbf227086cedc648a971627092d205186e2b9b9515673c61aadd8cee6c96b900043bb009fcd972a733bedcfd09b23a132590fcdd6d92324a85bc350d53f4c231c1191e28aec7460cee2883cfc84683cf2c9f962d0b4757ad847b20a67ecdd1b25a20e91a76fa6ecccd8140f32b85a5e22306ffb2f38d1dc00027de8ff74ddaf7d996bb21ef8877d6f8050671c2e74e0861300c592f5adb0886600a5ca36c1c70617e82196a4d37af53a5b7d0c941a94fb1fb6dc52e7b289a71091edf998948643b715f2f7e470aadace8a2ff04ea23a3687c87be249732eace60d5bdc89b60c42639b52f18b8fcf248b1fd18b56d0050fe0d4f676f8d82ce21e56861a2ce098e2b18571f88ca0cfad5db81c715b2d17559b1e02d55effc8868306867cdbe048cd861ef25eddaf2aaaef3d09c59fca02827585feab8239950eb59f6ef2b6a8805f5edb803b9b22933cb3134935a7b44221a9f6af81109433b56cd271ae54513fe6c43850361ba6b4b440678d543f1f568ac424b932608c679cbbeabdd888112ecac4216011efd9a7eea265d2c7972e0ed1b61f089c5160cf15a57b23f986bbf9bc872c811920f9a5355b974d80abe210f32c255752ff969e8e4eb6363f86ca745731f5a2ba8f3b8d8b539d5b4dccab3911a1a26f1fce8caa99c50dd12a69b977e9a6852090c453e0b9fd78360baa18dbc29d7b547362017bdc6f5ec9b27ea49934ddbde14c39e3d20febad6d97d70e86aab4c1b11e019db52b6cde6156bedcb2564d9c127af1c6d8717508001a827f838ffa05413cea2ab38dcd19ad1bc50fa174f39972880d4365d45e8a7ee97ef401cf018da50e6ccc1ccf8b3ab36b27860f8c96f7a011668893b0b808e0e55e0e732fec810962aaba0ee5b6c18c53da3353a789bdf2c4476469aa2f0a89c057d96617a5ac79b297ba4ad13ca9597c25c4548c924cd27f62e6335bbfb4b514cb7a9d8a818ae9bf477499d301e818f44986f01785f182767ad820e5027b052871df0de9beaa14e1be8792ca7c1bd10866d025b335162" } ] } \ No newline at end of file From 9084199ff1ed955f5d6d5eac9025427d20c7a27c Mon Sep 17 00:00:00 2001 From: wwared <541936+wwared@users.noreply.github.com> Date: Mon, 19 Aug 2024 13:12:30 -0300 Subject: [PATCH 10/11] chore: Update all solidity fixtures --- .../contracts/src/plonk_fixtures/epoch_change_fixture.json | 2 +- aptos/solidity/contracts/test/test_lc_proofs.t.sol | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/aptos/solidity/contracts/src/plonk_fixtures/epoch_change_fixture.json b/aptos/solidity/contracts/src/plonk_fixtures/epoch_change_fixture.json index 2b7333b9..f8bd10f5 100644 --- a/aptos/solidity/contracts/src/plonk_fixtures/epoch_change_fixture.json +++ b/aptos/solidity/contracts/src/plonk_fixtures/epoch_change_fixture.json @@ -1,5 +1,5 @@ { "vkey": "0x008f0133dc5a02eb31ac769e9e3a2f34da1af34c963bf3ee9a058982a2978cc9", "publicValues": "0x205829098a4c0273312e8bc4fdbde28fc12abdc540c88bdd9abeef0a85d706ecc071f215064bfe6f1c24295135199ce6f6dec2974115fad50989e666915453ad", - "proof": "0x160d88d91d9a25ffd74b13e5fc9e62f9079088927a2de48f78bda2453ab66cb61dddd1f2e9c5dd9d4549d0b4caa48d8d3c128877863a0599f4e14d93c319a1710e565c820ba6a3e646aeafe5611cb110a94d03751dab47adee53cc19949c59c50a893389814a7a898e788761b8db7ee66e7e6cd63af3264a11e794edfacd65d10ff9c0dd6b1dfb5b41f06f226b0e824d8cc59c3bbda4003b94fd3019d3678b57013c7c45623edc36ea3e182e5ab4e030097f7b6c15e782b914f4e69d0a184c64095b76ac00788c6d56ecae8b63095d2a901cfb0281558090356215ed7f105c681010e389ea4489111765ae411e23128027d4f5cf311186bf33c7c612524d4cd226bf42bdc73cff698d1be851fd6c06054a384632e62e970ab94fdfb6928435171de6e623ce670d84d786eb5a7b34d27de751874318b42923ef3fd8c6ffcea59306df3a232304cfc602ed2e2e6af3a0c04f3c0299e8f22b328074b83250f718fa24453f20938ff82388fe6298853e823e0256c52d45db4327eebbe5c2fb25c6fe0251256d8e8058a803a3d0ec346269f8ec36984fc8eaaa3d917299644259a5742526f8702dd96e6dd7363fe7f492f86763012707665eef6c5774b784c004797a0af5db2199d10d6ba946a9daaa151a3fbdda73c39d819418633754877e2f1e9f0e1e2ece6a772a93999a052a112d47e1e0f684cce42e75e53554a6d3b87f17a12fd4beccf4b4963743cd0592b4f652c2b4bbe206b861d16c2f65706b6acbc6592abaf5c641b512457b83f3c8ac091383c6d91008fc61608404ecad7b50c9e01f19f0e41a2a1996d752948d57fd3aea29aa7f10612fcc016644441d0b05aa83d2124cac5d1b61a16d5607c00ea832b1be0e3f64b8e52f1d8491a3718dd12090630603b7b74843298da5d5fd01f5e39f7841d0626b2c65f70333009be1d96f4f77085f314dc5a79c8ee884b9151f22e605a53add630d7830af9113f8dd4f1aecf12c39dc665b51f89b56949f7b724cf7e0904ea50e169bf57b76fe97670f99c5b30c3778f45aa648a162cd2b4229b066a4ba39eb23e37657cffd5a9e9bf89ea2cc2598302e794bf6d312dca40a980b30620ea92fcd5c6d216d03fbbbd575abfbc71ff7c092ac5569f0fb77a75d04115111781536edd0a3338bd238d1b9fbef9d442af2237939ad7bf0e73792fb1951fc231c510b0a76f4fee5daf4a31145885b34" + "proof": "0xa85584422a848d6615d731b6b12d755d14514e776f2509176f2e9678efeffac647a8543c3037c967c8bee22ece9629e8b265955143933a9b2811b2cfc12298c7ba99a7de0ddfa29e6d69c14da6477e1557a5c1d507a26481b2d28ed768837dfd0420797d00a1d144d1d30135eda50df9d6904fbba8e8c32052394583c4ae8f68895a431829cc83ced958a7b614d24eedcf523c7413e7ec234095e808524a21c948ffb7bc0838c2ae4ddb6c1b50f462dd42c22e049a9cf43364c9af1f55ab4883d5f30afd0e641effc953868bace766a9ed67d0d5f1c0276faf40ba02951b5149aaa5d0161f55dbbb9a7af707c9eaef2a21abd24312c3b6d17352fbe5df7f293267d456cf1a3c6bacdf1ab788ca65fb93acbe94db3cd14d44c406f4acc07d47fbb8c58b6729ee8a8bc74db938c89833cbb75265ad45aa9d001ea758d60077f8e61e45c4ff0e8d46d952778944e8ddd387f90114bc90f8d6bd89f05e4e48121fc8ac09560e19b54fb817a93efb37006a9f1b6146016648c7ea5a2fbad5b5c13e7d6b7064220891f0a6d8e87bd4b2142ff1ebb909f300cc4d078734ee2340460cf29c75cf9212cc7b6f473d48d2c3f61ca548826e296493c56676df31716268349e5cf466d92d7c8d5cf166a96c0f69b188a258acfb350eedbb5bd030225580cbf98587102e0683afba98713fb55f1d2462ff389816bb4c2a4d776b8e64e4eb35d9c6d3e3950ef973d79f55b5fdf573d85c7445cf0a44195302ae185260f6b68fef401fc7f6159f060c1fb9c20802914780d88f6d5501dbb419178a2c5c249c7f7594d89cfe0895a67a085dba1d29c758f3363e0961b8ae2975a4cbeab0e89e9cf329fd9c7925157f49f0e05082f15c0fdd2cc1fbdddb890061b11f6df5155727654588ba0f060fdec748ed5ea822f1dec725fb0a44bebd5a313f68dde008698b6d1b3365752702e16fecdc672d66e00256db9fc0de58ba9e3602b757b4c99418051204bb9b1b7b7e318b750f95b7ac2504f4cdf1c400855a8b99ea37b9553b11bac180ca2308775113f4a9d86aa580ca68a9bbec4e8555253680a9c6ff5817a4e1d5ae2d5e28cddc2cd44f8cff7cc80202b66bcac0861f15afa0c4bf5356951218b39cf75f09202cc1b745bc8eec6aeb082caa8095e121a85196c84b7c3c6a4e0395b0cc452901f62988dfb27e0fb55710eaee7d1a8ded34d5da344a05dfe5f25521f7b9e2" } \ No newline at end of file diff --git a/aptos/solidity/contracts/test/test_lc_proofs.t.sol b/aptos/solidity/contracts/test/test_lc_proofs.t.sol index 93237a36..fad175cd 100644 --- a/aptos/solidity/contracts/test/test_lc_proofs.t.sol +++ b/aptos/solidity/contracts/test/test_lc_proofs.t.sol @@ -15,12 +15,12 @@ contract SolidityVerificationTest is Test { // valid epoch change fixture for testing purposes bytes private TestEpochChangeVkey = - abi.encodePacked(hex"00eea0650222f7e5bb6a2fe57c0e0e504d1df8b3d848d5116174a8703d228c94"); + abi.encodePacked(hex"008f0133dc5a02eb31ac769e9e3a2f34da1af34c963bf3ee9a058982a2978cc9"); bytes private TestEpochChangePublicValues = abi.encodePacked( hex"205829098a4c0273312e8bc4fdbde28fc12abdc540c88bdd9abeef0a85d706ecc071f215064bfe6f1c24295135199ce6f6dec2974115fad50989e666915453ad" ); bytes private TestEpochChangeProof = abi.encodePacked( - hex"0ab2a3f76f07021cf8355041b0e80a079ea24e9fe36886d2f2b0fe9f6ca8c1d11460d09b1ce1d3cf50cd5cc0760669b8e8f5629fc0d426050d380152451cceb42b863aca64cbe9e67344a5f4851b78dfc55b157cfb75ac6df0a6e82b64487bf20cfa2c2a004cbaa685d0743c75f31afee3fa2b89a910c41d616a2a0c805cd4f8190e84bf17686dbb04c74b27ba0e79b46c06901c79931bcdd9e36c0aa192398f1b60a06cdcbeef2a2c0d7be5fdcc101cb9de1625966661f763b7f4d380f8c77b1aeca50fea9474242c8342665be9e2b36f99e589c61b5af219c72ac20d7a4f6d01f47105ead257b6a8d4cbad6f0025f9499da47b185a6a29be2a0976350fd3c52978a822a071e2c4828b7a1fdef0745a641e85f0a98d526ab811bc94846a17f220618a59cd47622fb2066de0817b53f74dbf9b496b6c9346ac9bf8ea3e50667d16500b36c88cc53c95a61989eae61bd2d7cabf39fa295d0e303c1ae04e14aa202c98c3188b2bae90cd20f7586a95abf55c943b669238561cd66ca1b4a31ab9d4121da63c61700abc8cd5dc10168781407667ccc4a5c14010bf62e9b969423b7011f55c5a114b4aa35b5b32a4371ec41a7e6c0a99bb8ed9928f1c81d38c1d65981ea57c37621be5cf357a0694051db17a310d87d81824a728960b20a29579ab5509713c982d7b5457bfd6cf995d2093b37070fa8d81e7f130ef35599a3bd6130c1bbec9cb0352e1986e59aa4a0480cdca6b0a280cbc0435dc005beec32483eb3a2c178b87931b1014a8b424cc19c992b5a6c17aa54b013f7401865edc52c1dec226c2b9aa2a25f98925a2171e5e63bb78cb13a30b6099c5cba62a8ff92265f7082a79086c6d603ab1e7e0950d707acb3bc6a929cc5dacd0102b3b7aa29253fac921e2a94b75536d62e6a6585c0f96974a236f2740fa0d249fb5ad4facfe3cc4d605901c9cf8931d8f2b87db2535a44f14e2c3e01ef4b98e8ea259c1decd2a4ee01e0406c20e0523faddd984577b94f688517d0d930346d18ed029331b8818e2f6168201bfb0ecc95d72b83957e916e5d79a5aaafbd2e6018fc9164b369cd732231dc4501b768ca50f25b7655a28ad83fd1bea600fa5e8cdd59c776adc17bd36890c30e071749d843cb7a1d2f964ad6e4a01d5595b848f5faef51c286a8b01e77015a5c0d1b9d05e0b287b288c582fb3dfd8d108370b7e1873630bb2aec4f4c869" + hex"a85584422a848d6615d731b6b12d755d14514e776f2509176f2e9678efeffac647a8543c3037c967c8bee22ece9629e8b265955143933a9b2811b2cfc12298c7ba99a7de0ddfa29e6d69c14da6477e1557a5c1d507a26481b2d28ed768837dfd0420797d00a1d144d1d30135eda50df9d6904fbba8e8c32052394583c4ae8f68895a431829cc83ced958a7b614d24eedcf523c7413e7ec234095e808524a21c948ffb7bc0838c2ae4ddb6c1b50f462dd42c22e049a9cf43364c9af1f55ab4883d5f30afd0e641effc953868bace766a9ed67d0d5f1c0276faf40ba02951b5149aaa5d0161f55dbbb9a7af707c9eaef2a21abd24312c3b6d17352fbe5df7f293267d456cf1a3c6bacdf1ab788ca65fb93acbe94db3cd14d44c406f4acc07d47fbb8c58b6729ee8a8bc74db938c89833cbb75265ad45aa9d001ea758d60077f8e61e45c4ff0e8d46d952778944e8ddd387f90114bc90f8d6bd89f05e4e48121fc8ac09560e19b54fb817a93efb37006a9f1b6146016648c7ea5a2fbad5b5c13e7d6b7064220891f0a6d8e87bd4b2142ff1ebb909f300cc4d078734ee2340460cf29c75cf9212cc7b6f473d48d2c3f61ca548826e296493c56676df31716268349e5cf466d92d7c8d5cf166a96c0f69b188a258acfb350eedbb5bd030225580cbf98587102e0683afba98713fb55f1d2462ff389816bb4c2a4d776b8e64e4eb35d9c6d3e3950ef973d79f55b5fdf573d85c7445cf0a44195302ae185260f6b68fef401fc7f6159f060c1fb9c20802914780d88f6d5501dbb419178a2c5c249c7f7594d89cfe0895a67a085dba1d29c758f3363e0961b8ae2975a4cbeab0e89e9cf329fd9c7925157f49f0e05082f15c0fdd2cc1fbdddb890061b11f6df5155727654588ba0f060fdec748ed5ea822f1dec725fb0a44bebd5a313f68dde008698b6d1b3365752702e16fecdc672d66e00256db9fc0de58ba9e3602b757b4c99418051204bb9b1b7b7e318b750f95b7ac2504f4cdf1c400855a8b99ea37b9553b11bac180ca2308775113f4a9d86aa580ca68a9bbec4e8555253680a9c6ff5817a4e1d5ae2d5e28cddc2cd44f8cff7cc80202b66bcac0861f15afa0c4bf5356951218b39cf75f09202cc1b745bc8eec6aeb082caa8095e121a85196c84b7c3c6a4e0395b0cc452901f62988dfb27e0fb55710eaee7d1a8ded34d5da344a05dfe5f25521f7b9e2" ); // valid inclusion fixture for testing purposes From 16cc3cd5ac7e559c1c6906936dd136f2539995e5 Mon Sep 17 00:00:00 2001 From: Artem Storozhuk Date: Tue, 20 Aug 2024 17:37:15 +0300 Subject: [PATCH 11/11] feat: Update Move codebase --- aptos/.vscode/settings.json | 2 +- .../plonk_fixtures/epoch_change_fixture.json | 2 +- .../src/plonk_fixtures/inclusion_fixture.json | 2 +- .../fixtures/epoch_change_fixture.json | 4 +- .../sources/fixtures/inclusion_fixture.json | 4 +- ethereum/move/sources/plonk_verifier.move | 143 ++++++++---------- ethereum/move/sources/script.move | 25 +-- ethereum/move/sources/utilities.move | 33 ++++ ethereum/move/sources/wrapper.move | 52 ++----- 9 files changed, 113 insertions(+), 154 deletions(-) diff --git a/aptos/.vscode/settings.json b/aptos/.vscode/settings.json index 7b2b22c3..39a5ca1e 100644 --- a/aptos/.vscode/settings.json +++ b/aptos/.vscode/settings.json @@ -1,3 +1,3 @@ { "rust-analyzer.cargo.features": "all" -} \ No newline at end of file +} diff --git a/aptos/solidity/contracts/src/plonk_fixtures/epoch_change_fixture.json b/aptos/solidity/contracts/src/plonk_fixtures/epoch_change_fixture.json index f8bd10f5..2d5052da 100644 --- a/aptos/solidity/contracts/src/plonk_fixtures/epoch_change_fixture.json +++ b/aptos/solidity/contracts/src/plonk_fixtures/epoch_change_fixture.json @@ -2,4 +2,4 @@ "vkey": "0x008f0133dc5a02eb31ac769e9e3a2f34da1af34c963bf3ee9a058982a2978cc9", "publicValues": "0x205829098a4c0273312e8bc4fdbde28fc12abdc540c88bdd9abeef0a85d706ecc071f215064bfe6f1c24295135199ce6f6dec2974115fad50989e666915453ad", "proof": "0xa85584422a848d6615d731b6b12d755d14514e776f2509176f2e9678efeffac647a8543c3037c967c8bee22ece9629e8b265955143933a9b2811b2cfc12298c7ba99a7de0ddfa29e6d69c14da6477e1557a5c1d507a26481b2d28ed768837dfd0420797d00a1d144d1d30135eda50df9d6904fbba8e8c32052394583c4ae8f68895a431829cc83ced958a7b614d24eedcf523c7413e7ec234095e808524a21c948ffb7bc0838c2ae4ddb6c1b50f462dd42c22e049a9cf43364c9af1f55ab4883d5f30afd0e641effc953868bace766a9ed67d0d5f1c0276faf40ba02951b5149aaa5d0161f55dbbb9a7af707c9eaef2a21abd24312c3b6d17352fbe5df7f293267d456cf1a3c6bacdf1ab788ca65fb93acbe94db3cd14d44c406f4acc07d47fbb8c58b6729ee8a8bc74db938c89833cbb75265ad45aa9d001ea758d60077f8e61e45c4ff0e8d46d952778944e8ddd387f90114bc90f8d6bd89f05e4e48121fc8ac09560e19b54fb817a93efb37006a9f1b6146016648c7ea5a2fbad5b5c13e7d6b7064220891f0a6d8e87bd4b2142ff1ebb909f300cc4d078734ee2340460cf29c75cf9212cc7b6f473d48d2c3f61ca548826e296493c56676df31716268349e5cf466d92d7c8d5cf166a96c0f69b188a258acfb350eedbb5bd030225580cbf98587102e0683afba98713fb55f1d2462ff389816bb4c2a4d776b8e64e4eb35d9c6d3e3950ef973d79f55b5fdf573d85c7445cf0a44195302ae185260f6b68fef401fc7f6159f060c1fb9c20802914780d88f6d5501dbb419178a2c5c249c7f7594d89cfe0895a67a085dba1d29c758f3363e0961b8ae2975a4cbeab0e89e9cf329fd9c7925157f49f0e05082f15c0fdd2cc1fbdddb890061b11f6df5155727654588ba0f060fdec748ed5ea822f1dec725fb0a44bebd5a313f68dde008698b6d1b3365752702e16fecdc672d66e00256db9fc0de58ba9e3602b757b4c99418051204bb9b1b7b7e318b750f95b7ac2504f4cdf1c400855a8b99ea37b9553b11bac180ca2308775113f4a9d86aa580ca68a9bbec4e8555253680a9c6ff5817a4e1d5ae2d5e28cddc2cd44f8cff7cc80202b66bcac0861f15afa0c4bf5356951218b39cf75f09202cc1b745bc8eec6aeb082caa8095e121a85196c84b7c3c6a4e0395b0cc452901f62988dfb27e0fb55710eaee7d1a8ded34d5da344a05dfe5f25521f7b9e2" -} \ No newline at end of file +} diff --git a/aptos/solidity/contracts/src/plonk_fixtures/inclusion_fixture.json b/aptos/solidity/contracts/src/plonk_fixtures/inclusion_fixture.json index a34be5c6..bb40a333 100644 --- a/aptos/solidity/contracts/src/plonk_fixtures/inclusion_fixture.json +++ b/aptos/solidity/contracts/src/plonk_fixtures/inclusion_fixture.json @@ -2,4 +2,4 @@ "vkey": "0x00336c570224c00161ca7b3c275c24f3968aa09086c31d09d98691bce109f4f6", "publicValues": "0x205829098a4c0273312e8bc4fdbde28fc12abdc540c88bdd9abeef0a85d706ec5c1e92bfe65b6200f1f7383d8fe6be26f70e05d784df4a170e38eb6be236145c020202020202020202020202020202020202020202020202020202020202020244fa02feb400a383b1824df6198c7e30cbf60a21838efa46fedf35f760fdf25839d1a3ec2b5d09aee31c1c0c380eef28744673ea3ab7e9d065baccc8d1874ca1", "proof": "0xa855844200667c07f515143095356049737e6657b90cadabb9e75b17ac3a9dca9ee5e7f52c8b43ff6d992c9eff8ee2c0628b15a5399f549188867048db7c0367e7c79b9d233c2374c0a912c170f58bf362342adfd7f09ce84f7000ac4f065aae3c1502172df54ea50bdb9ed329044aef6350f53a2233c71bfd0c6b465a667b6ffe5424301eaa330341702e7afd6ae68033b0707744b5e50a149d59af317b8e52401af21d102acdfe11036570f2d0691342614e3ddd6549cfd67729fb189140573e946032218c0fb39ec5093827752c7b54ef6468e2f86f6ee9e8405467a30388ae7f42ff08857c2a06da015595c42b9df69c4937ff73f22e2d954ad067ae45a04148782c0e310ecba87e87e0a0b6e5ecc2bc605b3dc7a5a4e2547018d7f18b49e519ece9067be6db04dea06356dea63bca0ef328ed312ab9270ed04dd6dffd3524d83ade23cb10051eb93281b83417e2cba965885e7ee012d9ee5b9d497cd1dc79996c3b301fd4279c8fef195adabc01808df994d148091ce14176df7831ca0b71969384050a16976a9e578f3cc941d84d436b920f6fd3daad140b65b8ae89e4ab9e2c810c94eb34bb13f7d67249579f1a01f071abcc17b9ed5966a8934981fbd758ec86272a97a5ce2f775b958104caff4d25d410dbbeafa51b9607fea23eb50795ace414795d11ba6618cff0899fd73081ea45552543c720c96d332a69e689381c45541fe8bea6880184167ad371fbcaf02a4d773ab4fcb1e9bfd8e794ce2aa5b8fdb100b46c07bfea1a1fbad8482559a57ee58cd558be3e2ddcfa09b8784efcbb41f907040ec3bc4c94b45cde233abbe553d8c1d63c95e0c255c1254a00e920c0a4390c7000b724c6824524ecaaab56665b799bfce546e0564342f9c3c6e60ec827d126c8bb9c6c2f735e6343c1e9e5bdfd80337af117b43bacc8a6f1caf2b943f2430c02db189892f57e103ba7119e5e280ae84bf0df40f68d7c7feca8a5a04b1cb50122e868aa96fe13c9186855897783a5db92f18469aaac677b177d19565b08521d3810e9094abb668d8cb919f20b6c6af73a38d8cd20b353e690160916bfb7c4124465371d102cbb003eb9ab98adc44184de1126ffb20de7b7899067b909fc8b1092a0c2e947725839c187ad71869e6c53c63dff202f839ff654baec3f4e607c24101e865f15d29b2bd21baea29231bebe0a411ef5adc219b024c236513dd741" -} \ No newline at end of file +} diff --git a/ethereum/move/sources/fixtures/epoch_change_fixture.json b/ethereum/move/sources/fixtures/epoch_change_fixture.json index 050df0bc..f89bc64d 100644 --- a/ethereum/move/sources/fixtures/epoch_change_fixture.json +++ b/ethereum/move/sources/fixtures/epoch_change_fixture.json @@ -14,7 +14,7 @@ }, { "type": "hex", - "value": "0xa85584420fd45c6fef3776719fe89b01980dbcd3720b5386fe4a21016432c625eb651ccf2b759ec295d73c34a53318645c641a901cff6038bf1f9f2df2d66e5b94519a7713baa08cbd531848786eb484c2221426690c7755444bdf1efe32399641d3ed900216e169e571fe77eb90a5990cc6ff9de9cec78b198cc736eacce9b27edbf227086cedc648a971627092d205186e2b9b9515673c61aadd8cee6c96b900043bb009fcd972a733bedcfd09b23a132590fcdd6d92324a85bc350d53f4c231c1191e28aec7460cee2883cfc84683cf2c9f962d0b4757ad847b20a67ecdd1b25a20e91a76fa6ecccd8140f32b85a5e22306ffb2f38d1dc00027de8ff74ddaf7d996bb21ef8877d6f8050671c2e74e0861300c592f5adb0886600a5ca36c1c70617e82196a4d37af53a5b7d0c941a94fb1fb6dc52e7b289a71091edf998948643b715f2f7e470aadace8a2ff04ea23a3687c87be249732eace60d5bdc89b60c42639b52f18b8fcf248b1fd18b56d0050fe0d4f676f8d82ce21e56861a2ce098e2b18571f88ca0cfad5db81c715b2d17559b1e02d55effc8868306867cdbe048cd861ef25eddaf2aaaef3d09c59fca02827585feab8239950eb59f6ef2b6a8805f5edb803b9b22933cb3134935a7b44221a9f6af81109433b56cd271ae54513fe6c43850361ba6b4b440678d543f1f568ac424b932608c679cbbeabdd888112ecac4216011efd9a7eea265d2c7972e0ed1b61f089c5160cf15a57b23f986bbf9bc872c811920f9a5355b974d80abe210f32c255752ff969e8e4eb6363f86ca745731f5a2ba8f3b8d8b539d5b4dccab3911a1a26f1fce8caa99c50dd12a69b977e9a6852090c453e0b9fd78360baa18dbc29d7b547362017bdc6f5ec9b27ea49934ddbde14c39e3d20febad6d97d70e86aab4c1b11e019db52b6cde6156bedcb2564d9c127af1c6d8717508001a827f838ffa05413cea2ab38dcd19ad1bc50fa174f39972880d4365d45e8a7ee97ef401cf018da50e6ccc1ccf8b3ab36b27860f8c96f7a011668893b0b808e0e55e0e732fec810962aaba0ee5b6c18c53da3353a789bdf2c4476469aa2f0a89c057d96617a5ac79b297ba4ad13ca9597c25c4548c924cd27f62e6335bbfb4b514cb7a9d8a818ae9bf477499d301e818f44986f01785f182767ad820e5027b052871df0de9beaa14e1be8792ca7c1bd10866d025b335162" + "value": "0xa85584420cd57f98d0674405ad491ffa65d06aeb77212d72d62c5facc6cf57b618268fd8303165cebe8c85d03d7d359458c112e73acfb107c0499db598a748345271ce5b1e8a91c291a639bc8c8c2574bc4b0447554f1cfc1daf0697424e5dfc5f21c8a727d3f14a99d5d031e9e63bc79def7af0729f5607690fc1f33eb13b013d8169b4117fcb772971e207a4fb1cc079af410dab30850c7dbd096c7b474642c7d3d780173f7dbd23e6a0a0402eb0415bfc3f64f9d90eeb45c7381dbb7f8de06b3c68b92dfeecd6cb098ec40f92d947e66928f1cc21e3fe426c3035ffa8dc041d5f1d130253c1616afa7e3ac1100296d1b7e02ff9cb22d4b02d534026eebe79991bec212a7077be94366d313871a31722f491f2955736b97e57979719ba3817049b06861f799f5fd46bed9e6008356120928211c3112a3d6ad32b3689af4d13e80d6ca0198fdca28c2b521e6e37dadb2c630df1ae727b1b19b690e5b99325936bb59bf104f2e5309f6ca2b8727cee7f3ef19576441cce8b42f839a15b3a3316720068a22216cef664a28960dfc45b0a85ed7b79e4aa678e38518224996f765742c169dc17236d46bdb41040908a80698ce9209461f1856dd9e57f5cc2725e3c959ee65b11934e49b1265599d7c0c04a18b68add3b6b3d1601f22c89115cfb6f6fbb403f3035d1cbd896b352292fdf1d6d8020dfe1be76a8b14f4d681dc9b763a6e22aae05267b9f933fa39cbe36667aa9bcefbe0708fc129450d9bef3a4d45fb3a336a609c1b093745fbf870e4aad3ec234ebf4b0cf1238882e3dd0e7fa474f7f10f73f144e4f145a4a88dcb9a184fec77d3695b18a0eb2f556b5e520e736df0f9e01040dbaf528f9fd147fb238e4ec5c4d20381502bdfbc6bfc5de019988b5f4e77ca5200f180077271f1cbec6c6e0971470f6688e480d83c40c728b36e85e0c99b9ea22a893392c90edd356e6318ec8864b990a048cd107fd4e3b201a59921e4861f81d6f62c0e7c8245dba477f2494655fa215e47d8d01a22e35c4750b13104e547f19b1a26591015e9f1dc6db1ab1b60cf7e0eb54b56d351d5832d495bbdc41481c00d3330e0b302e49575282b792bf89ec39946c84d3a93f24cb35501433ce0b5208d7312934466a24a65d4d35d38aca861e835b139de86ba4283367783f9f99dc260c2def5fcb2d7e3423b6fe0cc4726eda51a0144e74f154f2c036a968a87685" } ] -} \ No newline at end of file +} diff --git a/ethereum/move/sources/fixtures/inclusion_fixture.json b/ethereum/move/sources/fixtures/inclusion_fixture.json index fdc2bc4d..d524d00d 100644 --- a/ethereum/move/sources/fixtures/inclusion_fixture.json +++ b/ethereum/move/sources/fixtures/inclusion_fixture.json @@ -14,7 +14,7 @@ }, { "type": "hex", - "value": "0xa8558442145a08a26ee2065c00f7c2b6513ca5b703cf0c2ca60a7f4dcadbd37fcf4fba580cec82e09b467e4bf1e113e6de4aa1dff150237be24cee593aa4e0cf8167f5c72ffff353b5611c84676f747b7747bd2eca4812f7d3661b16ea219ddce4b7986b296ee3dda66116bd6c16d4e3a07d790b3e7edf4c92568e02d64fdd5dbabbfd771e9a87eb9abc6387b978133f774328143603095cb4028026bbfadc7be5c7517d15e75452be2d9c0d6328f553e10536db2097bcf330a5dfd1ec1bf5f490cf164816d45e4aabf58eace80023a5f9aaf7449812b1c8a4549c46332781234b6e3b9000eb5ccc975658d05d1d335a5596866b331abe08efc6cf591f822cde254d62c607fc59b832efcc57f879f56e4030003017eaa159622bc1dc3461a01afedb62bf1faca3a7ae5030a44af45705509f112cdb00b065991e5df2be509d47bd37190a282801481e6cb6c56cdfa4d3fa985525cb5ce206469dfaef61f0a198b025c7051025c8f67ca110ddaa9eacfd64a3033c840844a6445c5dbf5873cdefbe81b189097432906d0f50a86476f992f9e9eb63e7669344667821a65c8ae8b5aa0a94fe10e3eb5c335a6464659ae2d9151869a25a4494172ca759c8d7d4bbeb6fd843ef2fa24c9ba20e8d9ba9ad009960de388b350f2e22026d8641ecd70a3cc928e556222838e52c02d618ab56de6ed07716043fe4b40c0ff6df78a24fc3eae76d0b93021896bf2190dfeccfb5380174e5517234ddf1d380a017cf075544854a1ce4ac081c30c2838da653b84fd75c6a177345b67f1b5d22db6f55960d78d91a81b1b92781ca27587d988440fd7a2fed948245a1ce98f7581c2ff678755b640d0af9a024509d33274219dd46cfe49d335555186b248a72285afd54e09655a919fc5373185a2f641161299d13b63fd1c1c08179422d6b97589f95f648d26fafd9eeb70d1887b19becea8174ae42518f2ac6602246c80fa0168e09947ae298844a8fe7371e367a516c701f379bd7a4346d617e5a7fd282548002af9d39ecc5787706526e2696e210a6fa8dc46f0bd2facd5ae7ff2984ebd5e129d8619313d9bbb2d754502430bbc4b1ac5de6d49e073f0396391f6dda96e3b60d281eea42107c8da442be16fedf7805410fec1a0befbb7aab7cdddef102151ef19217829fcef4f98fda962c69189e2dd0feb47f077c93066cb59c6207d12092f5fa0ea6a7ee547b0c5b2c" + "value": "0xa85584420325031b628d531025b0a9ed7a846346c5d0b28ca9903a48ddd8ae739c58f0dc21ef49a01ebc2ef95e1f3989f72e0832965a3b5a908fa5050c74d9162a2f605b13a0d682d5d301ce6e44c44f40025daeded008acc8fcc5178c611ec2b6fdfbb12496f32cd1f99fd80f28cb46ddf7909603b6dd223db93a9378bce7892b3afa171493a69320d2f383c4e505b48d9baac4e1824f03147ac6dd61bffc9154f3d8361d176a85fbe837e1c06cc3ac383b14292440a038663381b8421b853fa171012905ee8ef1eb7cd86afb19b9e4c5911f285965935565cacdc41880b63fb49290b028cd994696aeecedeeca036957bbb0fa3d5f0369774191b73b3078fb36cf348f0e4b3781a083576bbe5ca35644f4a0be66c445b798791423c74075584ad14abd2a1c80fdf84060b407ad6b2547b20bcfcdd5d66a6dff8a91f15785b8b76dff8b10d4da4463ce69cb27070ad711e7251179333474867518d332c10f9a92b37797002ba50aad3d2407f3abebd3c20096ad104f74ddb8bd1f93a7da0381cb91eb9515efa3ef61ebb693501f125966142b116ed314c377c71ddb44967c61ddd1efe21eceb027b6c9b0ca22fc2ea5966a81f9492788a1588c1f6293fcf0abe22c60482d1fe48f09c1381c4e6de67655f38dee93440ae12ae715eda424eb0976aad614288471895e4d73791f2aaa18756177583f963e711ae58c281cc664a84ec09508200025017b717d6a477f613757115b1b5588c7860a54c1ded466aa34d15727b70a4fbabdd03f3ceacec53c104fb141ac4de3c3c8cb012b90f27766fc18fa83e42e685f270199861d080c06e64ddcf0cd2f320d68a4aa8962bc52836ec61efba1183b52115b482af21e79a2fd813ffb60319a0525ff47ec5b80fa2b8116a606b319992cf0e85ef4fee9a7c242ef040583d7265b5b344df5a2032729529ca2738820589dc9b1d5228e840825c7818c187845a3ce9c39395848dcf544e997d9bfe51fe28ee664cf36f843628e87ac413386c0735a4f4fe6410ed4bd0533902890db161d1b45c98162b2a0fdfe30fc2cffb197cd0fbd27fcfdab4a0d710f3fd3eefd195aff571eead04df178ad290b9e25f856fdae12bb7b412ac6a79909e3dee17a08e2f61eec9ffa72cb508122c2c469ad1a1e0645b28a2456910da5e0a540e6c0252b6b23efea0055f623723a9f741f15309e7d9698a03a1daa4e87801daa284f" } ] -} \ No newline at end of file +} diff --git a/ethereum/move/sources/plonk_verifier.move b/ethereum/move/sources/plonk_verifier.move index 27c2b9f7..2633af42 100644 --- a/ethereum/move/sources/plonk_verifier.move +++ b/ethereum/move/sources/plonk_verifier.move @@ -30,26 +30,28 @@ module plonk_verifier_addr::plonk_verifier { const VK_DOMAIN_SIZE: u256 = 67108864; const VK_INV_DOMAIN_SIZE: u256 = 0x30644e66c81e03716be83b486d6feabcc7ddd0fe6cbf5e72d585d142f7829b05; const VK_OMEGA: u256 = 0x1067569af1ff73b20113eff9b8d89d4a605b52b63d68f9ae1c79bd572f4e9212; - const VK_QL_COM_X: u256 = 48928834306167443025507055502202067200240823993352402100102620828723773653; - const VK_QL_COM_Y: u256 = 2042095935721586861269278494849843501067752929878965775735116249791377189349; - const VK_QR_COM_X: u256 = 9263055746511352788967168242441740132968013915506788573208357567094202827437; - const VK_QR_COM_Y: u256 = 17628428921127964441677913917368279104903634377401680292327523375466045449821; - const VK_QM_COM_X: u256 = 5386497313205418866075671870604723600462702364443576348523388000562720155397; - const VK_QM_COM_Y: u256 = 10251277836844837493691486022258656237409980141605838548173765900573579037048; - const VK_QO_COM_X: u256 = 17892144205963166011887822724506030774548821972604674531477350577120233687735; - const VK_QO_COM_Y: u256 = 12628315211947344797164579921778371930128823896428193831555008525111790366444; - const VK_QK_COM_X: u256 = 14861769437953976497529730847443333640366704373271067429561158303180456942870; - const VK_QK_COM_Y: u256 = 14662562919486173853933305484282245429424763948861532235926442375885400771007; - const VK_S1_COM_X: u256 = 3073888053341554920881016181058807402426536838286493276385115449633539775248; - const VK_S1_COM_Y: u256 = 5384424222329100501817783245522106750938337029519044356500555260900853476873; - const VK_S2_COM_X: u256 = 19461186879863774198290657382293078306984201116484502913827155116237255045292; - const VK_S2_COM_Y: u256 = 2873204720580225076071638780752364114819201030390154715441418039817738911367; - const VK_S3_COM_X: u256 = 2096906860978765391282094222602615310661660657556910851436043580799708727565; - const VK_S3_COM_Y: u256 = 2161063310508571838500646252285726166473952589055632093444464980556430797130; + const VK_QL_COM_X: u256 = 0x001bb15754e011a2a423c73e153aa852b09aef41cc2b1295694ccc6f9cf300d5; + const VK_QL_COM_Y: u256 = 0x0483c90c0cfc2de75643c07e4fede2aa9c2f5eb6bd094a1c28590f2a23bc29e5; + const VK_QR_COM_X: u256 = 0x147ab4297dbf87265d3ab42c6300ec8b0f59e7258e8ff9243a81b956e2b402ad; + const VK_QR_COM_Y: u256 = 0x26f95651cfe1c49de5d5765b6cfad6b8a34348a54713d5fc55f1b92ab107265d; + const VK_QM_COM_X: u256 = 0x0be8a641a5e52b4b2026fd30e9ea51dbb57418891fc3372e49ff13e514622705; + const VK_QM_COM_Y: u256 = 0x16aa04840c5dba028688923bb4abe223662512feb496e3074f239ca6c0864978; + const VK_QO_COM_X: u256 = 0x278e984160a07cd1d9896aef99a0d92dfd8e0f4f3d08ca91b51cc1467b1c8ab7; + const VK_QO_COM_Y: u256 = 0x1beb5f8491dae2d9ea489874553b0f3d7581dd6cdc30df0fd5d52d55141b6eec; + const VK_QK_COM_X: u256 = 0x20db76a217f45ae31f96d72384089b40a69ab8185e9f7ae8da387d8945375d16; + const VK_QK_COM_Y: u256 = 0x206ab76da8725088e16f1c2bb07b3665740eb110d45676ebefb068eed71b09bf; + const VK_S1_COM_X: u256 = 0x06cbc24cbd62ee09a95672a3c251abc39baed40c7a8682a556291b5efb7a5b10; + const VK_S1_COM_Y: u256 = 0x0be779e26f0936ebcf1368e98ae78bed27e08f796b7865d47cee108abad8ee09; + const VK_S2_COM_X: u256 = 0x2b06a434bea3630550a316e1047568944b33c8ba0f79e424969603116b2770ac; + const VK_S2_COM_Y: u256 = 0x065a2d1e37b4d5564937baf39cadb76f22348e027bc3d2f3db4fd559c46ffe87; + const VK_S3_COM_X: u256 = 0x04a2cea642f8ee9d9b73e8715a74e84e30c2625d4eb3175e242c5b7e37da890d; + const VK_S3_COM_Y: u256 = 0x04c71e553bcf61e4d5f85b2ffc1b1dab4a4a7f4d76a0b2de19300e42ff15694a; const VK_COSET_SHIFT: u256 = 5; - const VK_QCP_0_X: u256 = 7517051128132060126170113520963297922398874457515198318132621766317406868261; - const VK_QCP_0_Y: u256 = 11472137363060303021114982968577795162044850614296769357227193724808785551909; + + const VK_QCP_0_X: u256 = 0x109e800acb84a21685e8eabdb98a8c4ab1abc939341902b34dcb3f1a3aa6d325; + const VK_QCP_0_Y: u256 = 0x195cffe8af99edb66d60be290baa002cdec78a7b9998259f88f818f32fa3e225; const VK_INDEX_COMMIT_API_0: u256 = 31314682; + const VK_NB_CUSTOM_GATES: u64 = 1; // Utils for Fiat Shamir @@ -713,30 +715,30 @@ module plonk_verifier_addr::plonk_verifier { public fun test_derive_gamma() { let proof = get_proof(); let gamma = derive_gamma(proof, SphinxInclusionProofVk, SphinxPublicValuesHash); - assert!(gamma == 0xbec7f35a9a4ab19ed3c1bd4122d8a4ef9e7eaa3a29483c4602cc45d88db86135, 1); + assert!(gamma == 0x36ab7b3ee6ee14f303c705f8bf298dcd83d005f957fe6ab42e3298530d856ffe, 1); } #[test] public fun test_derive_beta() { - let gamma = 0xbec7f35a9a4ab19ed3c1bd4122d8a4ef9e7eaa3a29483c4602cc45d88db86135; + let gamma = 0x36ab7b3ee6ee14f303c705f8bf298dcd83d005f957fe6ab42e3298530d856ffe; let beta = derive_beta(gamma); - assert!(beta == 0x42fc83c6f494936df5a8d6d66f7b1c92e8f9e3b4f59653a03260e3b61590e031, 1); + assert!(beta == 0x56312fd81f7977970edb1322391cdb08fdc00e00b7184ca63e2c9ed50bdfc5c6, 1); } #[test] public fun test_derive_alpha() { let proof = get_proof(); - let beta = 0x42fc83c6f494936df5a8d6d66f7b1c92e8f9e3b4f59653a03260e3b61590e031; + let beta = 0x56312fd81f7977970edb1322391cdb08fdc00e00b7184ca63e2c9ed50bdfc5c6; let alpha = derive_alpha(proof, beta); - assert!(alpha == 0x9deb5bee532ca79e9560d86926c70bd8fd8a727cc24a38a0c6c977542cd1db00, 1); + assert!(alpha == 0x692c5a0559999207073af899757b72492f32d8911ad6ed690441273fb480b6ff, 1); } #[test] public fun test_derive_zeta() { let proof = get_proof(); - let alpha = 0x9deb5bee532ca79e9560d86926c70bd8fd8a727cc24a38a0c6c977542cd1db00; + let alpha = 0x692c5a0559999207073af899757b72492f32d8911ad6ed690441273fb480b6ff; let zeta = derive_zeta(proof, alpha); - assert!(zeta == 0x16497e15231e0304a0f5307d0a4d3b874bc4a33bb786c88344ce3206a952f61a, 1); + assert!(zeta == 0x62c1899d13488ac348727366d41d27f0f6cf756503cff9706622e6737c12d5c3, 1); } #[test] @@ -754,56 +756,43 @@ module plonk_verifier_addr::plonk_verifier { verify_inner(proof, public_inputs); } - #[test_only] - fun compute_public_values_hash(raw_public_inputs: vector): u256 { - let preimage = vector::empty(); - let i = 0; - while(i < length(&raw_public_inputs)) { - append_value(&mut preimage, *vector::borrow(&raw_public_inputs, i), true, 32); - i = i + 1; - }; - - let one: u256 = 1; - let hash = bytes_to_uint256(sha2_256(preimage)) & ((one << 253) - 1); - hash - } - #[test] public fun test_compute_public_values_hash() { - let public_values = get_public_values(); - let pv_hash = compute_public_values_hash(public_values); + let raw_public_inputs = x"205829098a4c0273312e8bc4fdbde28fc12abdc540c88bdd9abeef0a85d706ec5c1e92bfe65b6200f1f7383d8fe6be26f70e05d784df4a170e38eb6be236145c020202020202020202020202020202020202020202020202020202020202020244fa02feb400a383b1824df6198c7e30cbf60a21838efa46fedf35f760fdf25839d1a3ec2b5d09aee31c1c0c380eef28744673ea3ab7e9d065baccc8d1874ca1"; + let pv_hash = bytes_to_uint256(sha2_256(raw_public_inputs)) & ((1 << 253) - 1); assert!(pv_hash == SphinxPublicValuesHash, 1); } // Actual valid proof instance data generated by Sphinx using inclusion program - // (from inclusion_fixture.json) - const Proof_chunk_0: u256 = 0x22260e22daca34e1068152746ae216a2576089f90a3b8d07831b364e1e0ea6f7; - const Proof_chunk_1: u256 = 0x20ca2f29609382c698b2c89310ae12c0480f85850d514fe8b0de8b0122ccac20; - const Proof_chunk_2: u256 = 0x083abde04f1ad3b0e3de4a757bfd265c95813964c59cca3d4e8649283879bff2; - const Proof_chunk_3: u256 = 0x1a84b386c065f769074e7702e3fe905ed017140dac90f890628fcac0b1668a8b; - const Proof_chunk_4: u256 = 0x0071cf52b558d58c3ef27c152e933775e0fc9153c63294af6f18567da2029669; - const Proof_chunk_5: u256 = 0x2198dceeda96b8b0d9059ac0c95fea33c7cbaa544e9ffcd3e23f5f14c2b9d379; - const Proof_chunk_6: u256 = 0x02ae25ae6dd5ddf546536b49f5a95ab8f1d62638078ced7ae27a74db063e4eaf; - const Proof_chunk_7: u256 = 0x17fe58c15400e3a138143be59e573202e5b0ede42340b4bb3fdf5b9a60ab1d46; - const Proof_chunk_8: u256 = 0x301376093bd4af6c89aa43fb90b08623c1cce6810f469b863a808bd8c8fa5bff; - const Proof_chunk_9: u256 = 0x16aa37fb247c92f9d17eb9b1d8d89724269e14af43f719d53a8766006f7de93e; - const Proof_chunk_10: u256 = 0x076d1faac1fa4b235ffc8802522a3e9b9601e23f011dfa6c8e5c15ecd8f6913c; - const Proof_chunk_11: u256 = 0x0fca1f8b773e831881d70e907f8453946fd9af1e80b1b3e2a15c766732840904; - const Proof_chunk_12: u256 = 0x2acb8ea1cc325082dc7d9255302747046ff7665978deb49f4d918056183e6439; - const Proof_chunk_13: u256 = 0x27755b2b9ffdff73ac96803106da5245baa3a1af4db5d4c54461076a91c9f3f3; - const Proof_chunk_14: u256 = 0x24c4593c2e883ebea49825e3f9d8c128bd28e44f4ccee8084a3276d5a7703b82; - const Proof_chunk_15: u256 = 0x0f5a3f27fdd4168c1143bc700cf648863406021f45aa0dca338e3a175a4c309a; - const Proof_chunk_16: u256 = 0x0535bd79d2cd0a7048e0984f79d0d342dd5c3b0bf354f20d447fcb6731d2ee65; - const Proof_chunk_17: u256 = 0x01f755ec65481149faa10ce77989f2dcf0fac47c4eac553b157c757f3337ff04; - const Proof_chunk_18: u256 = 0x052f9ae5a78abb78689c2ca378af86afa180c683aefde3ed835a42960314fa2f; - const Proof_chunk_19: u256 = 0x1ae1fd74ea330416d0fa891250535dd7deac3b8e98338c5bb21a168116cd014f; - const Proof_chunk_20: u256 = 0x1f201aede6e12b30bc9cf21d5e92534ef76d84e88e95eeb772f5a59f65ac7ea1; - const Proof_chunk_21: u256 = 0x28f2b25c8172a777d706196a470e604c650372818f2f514efff1e7e76d413a8e; - const Proof_chunk_22: u256 = 0x143856445caa26db7923454b0352aa2856a40426a61344a62063e2a155a36e90; - const Proof_chunk_23: u256 = 0x2602c5e130d1246cbbc88c26b74ea864dcb1dc94bc8128faa4e39fd81ab64e64; - const Proof_chunk_24: u256 = 0x0665cd62153ce455e65dd02ba8422717c862f179ec17d03918dd5dab88e602dc; - const Proof_chunk_25: u256 = 0x2d108e2f617641e1148229ee62332ae0841bc704a7614924c780ae62119e771a; - const Proof_chunk_26: u256 = 0x26659d75a98e0401e8f60968dd55c96ad5d8044942b15d75fe53efb24e01d0b7; + // (from Solidity's inclusion_fixture.json) + + const Proof_chunk_0: u256 = 0x00667c07f515143095356049737e6657b90cadabb9e75b17ac3a9dca9ee5e7f5; + const Proof_chunk_1: u256 = 0x2c8b43ff6d992c9eff8ee2c0628b15a5399f549188867048db7c0367e7c79b9d; + const Proof_chunk_2: u256 = 0x233c2374c0a912c170f58bf362342adfd7f09ce84f7000ac4f065aae3c150217; + const Proof_chunk_3: u256 = 0x2df54ea50bdb9ed329044aef6350f53a2233c71bfd0c6b465a667b6ffe542430; + const Proof_chunk_4: u256 = 0x1eaa330341702e7afd6ae68033b0707744b5e50a149d59af317b8e52401af21d; + const Proof_chunk_5: u256 = 0x102acdfe11036570f2d0691342614e3ddd6549cfd67729fb189140573e946032; + const Proof_chunk_6: u256 = 0x218c0fb39ec5093827752c7b54ef6468e2f86f6ee9e8405467a30388ae7f42ff; + const Proof_chunk_7: u256 = 0x08857c2a06da015595c42b9df69c4937ff73f22e2d954ad067ae45a04148782c; + const Proof_chunk_8: u256 = 0x0e310ecba87e87e0a0b6e5ecc2bc605b3dc7a5a4e2547018d7f18b49e519ece9; + const Proof_chunk_9: u256 = 0x067be6db04dea06356dea63bca0ef328ed312ab9270ed04dd6dffd3524d83ade; + const Proof_chunk_10: u256 = 0x23cb10051eb93281b83417e2cba965885e7ee012d9ee5b9d497cd1dc79996c3b; + const Proof_chunk_11: u256 = 0x301fd4279c8fef195adabc01808df994d148091ce14176df7831ca0b71969384; + const Proof_chunk_12: u256 = 0x050a16976a9e578f3cc941d84d436b920f6fd3daad140b65b8ae89e4ab9e2c81; + const Proof_chunk_13: u256 = 0x0c94eb34bb13f7d67249579f1a01f071abcc17b9ed5966a8934981fbd758ec86; + const Proof_chunk_14: u256 = 0x272a97a5ce2f775b958104caff4d25d410dbbeafa51b9607fea23eb50795ace4; + const Proof_chunk_15: u256 = 0x14795d11ba6618cff0899fd73081ea45552543c720c96d332a69e689381c4554; + const Proof_chunk_16: u256 = 0x1fe8bea6880184167ad371fbcaf02a4d773ab4fcb1e9bfd8e794ce2aa5b8fdb1; + const Proof_chunk_17: u256 = 0x00b46c07bfea1a1fbad8482559a57ee58cd558be3e2ddcfa09b8784efcbb41f9; + const Proof_chunk_18: u256 = 0x07040ec3bc4c94b45cde233abbe553d8c1d63c95e0c255c1254a00e920c0a439; + const Proof_chunk_19: u256 = 0x0c7000b724c6824524ecaaab56665b799bfce546e0564342f9c3c6e60ec827d1; + const Proof_chunk_20: u256 = 0x26c8bb9c6c2f735e6343c1e9e5bdfd80337af117b43bacc8a6f1caf2b943f243; + const Proof_chunk_21: u256 = 0x0c02db189892f57e103ba7119e5e280ae84bf0df40f68d7c7feca8a5a04b1cb5; + const Proof_chunk_22: u256 = 0x0122e868aa96fe13c9186855897783a5db92f18469aaac677b177d19565b0852; + const Proof_chunk_23: u256 = 0x1d3810e9094abb668d8cb919f20b6c6af73a38d8cd20b353e690160916bfb7c4; + const Proof_chunk_24: u256 = 0x124465371d102cbb003eb9ab98adc44184de1126ffb20de7b7899067b909fc8b; + const Proof_chunk_25: u256 = 0x1092a0c2e947725839c187ad71869e6c53c63dff202f839ff654baec3f4e607c; + const Proof_chunk_26: u256 = 0x24101e865f15d29b2bd21baea29231bebe0a411ef5adc219b024c236513dd741; #[test_only] public fun get_proof(): vector { @@ -838,9 +827,8 @@ module plonk_verifier_addr::plonk_verifier { proof } - // TODO: add function for computing this digest based on the SphinxVerifier.sol contract - const SphinxPublicValuesHash: u256 = 0x1b73d6e73d3224150622f22a8c18740efc94af34d45500eaf658a389935513ad; - const SphinxInclusionProofVk: u256 = 0x00edc477759b49c9f16fa0fae93b11dcde295121eda80472196c13cf4b6d079f; + const SphinxPublicValuesHash: u256 = 0x02eb293422b0c500ccdaa643ad740f777cf82ea54daf1c7d0a9b6076caa05548; + const SphinxInclusionProofVk: u256 = 0x00336c570224c00161ca7b3c275c24f3968aa09086c31d09d98691bce109f4f6; #[test_only] public fun get_public_inputs(): vector { @@ -849,15 +837,4 @@ module plonk_verifier_addr::plonk_verifier { push_back(&mut public_inputs, SphinxPublicValuesHash); public_inputs } - - const PublicValuesChunk0: u256 = 0x205829098a4c0273312e8bc4fdbde28fc12abdc540c88bdd9abeef0a85d706ec; - const PublicValuesChunk1: u256 = 0x4f76ef143d0388ab65a4cd568c05da10c070aefbfd385cc4824f5d71b009e962; - - #[test_only] - public fun get_public_values(): vector { - let public_inputs = vector::empty(); - push_back(&mut public_inputs, PublicValuesChunk0); - push_back(&mut public_inputs, PublicValuesChunk1); - public_inputs - } } diff --git a/ethereum/move/sources/script.move b/ethereum/move/sources/script.move index 44da427a..48ba393b 100644 --- a/ethereum/move/sources/script.move +++ b/ethereum/move/sources/script.move @@ -1,8 +1,7 @@ script { use plonk_verifier_addr::plonk_verifier; - use plonk_verifier_addr::utilities::{bytes_to_uint256}; - use std::vector::{length, slice, push_back}; - use std::vector; + use plonk_verifier_addr::utilities::{validate_fixture_data}; + use std::vector::length; const ERROR_LENGTH_VK: u64 = 3001; const ERROR_LENGTH_PROOF: u64 = 3002; @@ -19,25 +18,7 @@ script { assert!(length(&vkey_) == 32, ERROR_LENGTH_VK); assert!((length(&proof_) - 4) % 32 == 0, ERROR_LENGTH_PROOF); - // convert vkey - let vkey: u256 = bytes_to_uint256(vkey_); - - // check hardcoded plonk verifier hash - let expected_verifier_hash: u256 = 0xa8558442; // corresponds to v1.0.8-testnet artifacts - let verifier_hash_header = slice(&proof_, 0, 4); - let verifier_hash: u256 = bytes_to_uint256(verifier_hash_header); - assert!(verifier_hash == expected_verifier_hash, ERROR_PROOF_VERSION); - - // convert proof - let i = 0; - let n = (length(&proof_) - 4) / 32; - let proof = vector::empty(); - while (i < n) { - // offset by 4 to skip the version header - let chunk = slice(&proof_, 4 + i * 32, 4 + i * 32 + 32); - push_back(&mut proof, bytes_to_uint256(chunk)); - i = i + 1; - }; + let (proof, vkey) = validate_fixture_data(proof_, vkey_); plonk_verifier::verify(proof, vkey, public_values); } diff --git a/ethereum/move/sources/utilities.move b/ethereum/move/sources/utilities.move index c57b9f3c..3bee2183 100644 --- a/ethereum/move/sources/utilities.move +++ b/ethereum/move/sources/utilities.move @@ -10,6 +10,39 @@ module plonk_verifier_addr::utilities { use std::hash::sha2_256; const ERROR_U256_TO_FR: u64 = 2001; + const ERROR_LENGTH_VK: u64 = 2002; + const ERROR_LENGTH_PROOF: u64 = 2003; + const ERROR_SPHINX_PROOF_VERSION: u64 = 2004; + + const VK_BYTES_SIZE: u64 = 32; + const PROOF_CHUNK_BYTE_SIZE: u64 = 32; + + public fun validate_fixture_data(sphinx_proof: vector, sphinx_vkey: vector): (vector, u256) { + assert!(length(&sphinx_vkey) == VK_BYTES_SIZE, ERROR_LENGTH_VK); + let proof_length = length(&sphinx_proof); + assert!(proof_length > 4, ERROR_LENGTH_PROOF); + assert!((proof_length - 4) % PROOF_CHUNK_BYTE_SIZE == 0, ERROR_LENGTH_PROOF); + + // convert vkey + let vkey: u256 = bytes_to_uint256(sphinx_vkey); + + // check hardcoded plonk verifier hash + let expected_version: u256 = 0xa8558442; // corresponds to v1.0.8-testnet artifacts + let actual_version = slice(&sphinx_proof, 0, 4); + let actual_version: u256 = bytes_to_uint256(actual_version); + assert!(expected_version == actual_version, ERROR_SPHINX_PROOF_VERSION); + + // convert proof + let i = 0; + let n = (proof_length - 4) / PROOF_CHUNK_BYTE_SIZE; + let proof_in = vector::empty(); + while (i < n) { + let chunk = slice(&sphinx_proof, i * PROOF_CHUNK_BYTE_SIZE + 4, i * PROOF_CHUNK_BYTE_SIZE + PROOF_CHUNK_BYTE_SIZE + 4); + push_back(&mut proof_in, bytes_to_uint256(chunk)); + i = i + 1; + }; + (proof_in, vkey) + } public fun powSmall(base: Element, exponent: u256): Element { let result = one(); diff --git a/ethereum/move/sources/wrapper.move b/ethereum/move/sources/wrapper.move index 734660f6..c8c8c34e 100644 --- a/ethereum/move/sources/wrapper.move +++ b/ethereum/move/sources/wrapper.move @@ -1,13 +1,11 @@ module plonk_verifier_addr::wrapper { use std::signer; use plonk_verifier_addr::plonk_verifier; - use std::vector; - use std::vector::{length, slice, push_back, reverse}; + use std::vector::{length, slice, reverse}; use plonk_verifier_addr::utilities::bytes_to_uint256; use std::string::utf8; + use plonk_verifier_addr::utilities; - const ERROR_LENGTH_VK: u64 = 4001; - const ERROR_LENGTH_PROOF: u64 = 4003; const ERROR_COMMITTEE_CHANGE: u64 = 4004; const ERROR_INCLUSION: u64 = 4005; const ERROR_COMMITTEE_CHANGE_UNEXPECTED_PUBLIC_VALUES: u64 = 4006; @@ -28,9 +26,6 @@ module plonk_verifier_addr::wrapper { // one merkle tree value (8 bytes length prefix + at least 1 byte) const INCLUSION_PUBLIC_VALUES_MIN_LENGTH_BYTES: u64 = 118; - const VK_BYTES_SIZE: u64 = 32; - const PROOF_CHUNK_BYTE_SIZE: u64 = 32; - const BLOCK_HEIGHT_BYTE_SIZE: u64 = 8; const COMMITTEE_HASH_BYTE_SIZE: u64 = 32; const EIP1186_PROOF_ADDRESS_BYTE_SIZE: u64 = 20; @@ -89,21 +84,8 @@ module plonk_verifier_addr::wrapper { public fun committee_change_event_processing(a: &signer, vkey: vector, proof: vector, public_values: vector) acquires Hashes { // we know definitely the expected length of public values for committee change event assert!(length(&public_values) == COMMITTEE_CHANGE_PUBLIC_VALUES_LENGTH_BYTES, ERROR_COMMITTEE_CHANGE_UNEXPECTED_PUBLIC_VALUES); - assert!(length(&vkey) == VK_BYTES_SIZE, ERROR_LENGTH_VK); - assert!(length(&proof) % PROOF_CHUNK_BYTE_SIZE == 0, ERROR_LENGTH_PROOF); - - // convert vkey - let vkey: u256 = bytes_to_uint256(vkey); - - // convert proof - let i = 0; - let n = length(&proof) / PROOF_CHUNK_BYTE_SIZE; - let proof_in = vector::empty(); - while (i < n) { - let chunk = slice(&proof, i * PROOF_CHUNK_BYTE_SIZE, i * PROOF_CHUNK_BYTE_SIZE + PROOF_CHUNK_BYTE_SIZE); - push_back(&mut proof_in, bytes_to_uint256(chunk)); - i = i + 1; - }; + + let (proof_in, vkey) = utilities::validate_fixture_data(proof, vkey); // execute core verification plonk_verifier::verify(proof_in, vkey, public_values); @@ -139,21 +121,8 @@ module plonk_verifier_addr::wrapper { public fun inclusion_event_processing(a: &signer, vkey: vector, proof: vector, public_values: vector) acquires Hashes { // we know only minimal acceptable length of public values in inclusion event, when EIP1186 proof contains 1 key/value pair assert!(length(&public_values) >= INCLUSION_PUBLIC_VALUES_MIN_LENGTH_BYTES, ERROR_INCLUSION_UNEXPECTED_PUBLIC_VALUES); - assert!(length(&vkey) == VK_BYTES_SIZE, ERROR_LENGTH_VK); - assert!(length(&proof) % PROOF_CHUNK_BYTE_SIZE == 0, ERROR_LENGTH_PROOF); - - // convert vkey - let vkey: u256 = bytes_to_uint256(vkey); - - // convert proof - let i = 0; - let n = length(&proof) / VK_BYTES_SIZE; - let proof_in = vector::empty(); - while (i < n) { - let chunk = slice(&proof, i * PROOF_CHUNK_BYTE_SIZE, i * PROOF_CHUNK_BYTE_SIZE + PROOF_CHUNK_BYTE_SIZE); - push_back(&mut proof_in, bytes_to_uint256(chunk)); - i = i + 1; - }; + + let (proof_in, vkey) = utilities::validate_fixture_data(proof, vkey); // execute core verification plonk_verifier::verify(proof_in, vkey, public_values); @@ -315,12 +284,11 @@ module plonk_verifier_addr::wrapper { const UpdatedSyncCommitteeHashH30: u256 = 0x85382a0c8b1b38485a3d816f31ab5b23a0eae94d86c90086cd4e7b6e8c5c4682; const NextSyncCommitteeHashH31: u256 = 0x5ebd1cf9ea54ce88af740aad4d7e95e742157209f36867ff5d7d490afa91c6bf; - const EpochChangeVk: vector = x"00bcfcc3dcbdc7f3c1eeb99dce85dd389dfe4896e94494f22740c3f56965ff78"; + const EpochChangeVk: vector = x"00bb9c681c4466b62efe6f5198bd1e5453b2500ed947810581ab37f2580aa3b3"; const EpochChangePublicValues: vector = x"e0e58f00000000005d32119aae2ee9f88867d5787af5c4df68884a4bf8fff525ff8c408e8f98805085382a0c8b1b38485a3d816f31ab5b23a0eae94d86c90086cd4e7b6e8c5c46825ebd1cf9ea54ce88af740aad4d7e95e742157209f36867ff5d7d490afa91c6bf"; - const EpochChangeProof: vector = x"1c4d9239aa37ce4e46a51548849ee6f80ebbd5b7297d8ee219c7e243938fe3091b7eb59e14352e7375f9d26affef30bbc37307d50f4f13e6393b94dd926bcad50380a78c1ef216d777784e1fa2a4c0e53ffa09dd5f98e3adb8d613133f0c35c016711f4bd906b35d52bfb95a35a7333a1c166e04d0224cad8d464c73e98e440f0ee507235a17b7a742da7bd8af131eb6fd8ae08df9795c14987b370a916dc3c224903e09963046e687ca6d8f995619a50d6d840acc26c3ba55b005a5bd14db9a303c426cedc49c2da933ccd9f12817262c78db4b0b5c34003752f84b801c11950da266d3568e6765e35998c70d381b7f7c1e5a291795cbba76ba9d4dd99577882a686c3abfb1fde1e1ffb24ddfb248c9cb2ad38fdad6638f69752b5e854336c220db999f2f20766164559a1529d90d5feed42befc81933ae426b637b82d6a84d12677dcca6035905febe868c6d0f0761bb83cb581c1e19e97a412ccf513df53103b97bac07501414b2c388a550961a078ee93f1610324aa78389ce648d6ae5c307351c17e241b7990c44b8f98ad3be8097fd375a9a35812081ef74b455f7e9b217fe1b56f2b9d5d4952827b5e8975fcf9d135391314161acdfeaf14db9d98baf1778e9dadc6074119811041f9feaef0d935c89633570bc49550a7133745628382ed6dcb04b3041942209fc20b034f515400a4b7b8ce6c142ab22878ab4b033ec10492dd7eb8093816038fe5bfef120ae435ec4e2a1f149e1777a9faab436924e19c54b2619f2ac9bf6b1c89a9cfe30f9fe556450a12bf43a9d15d1b0e8dc38ee2b2df1b3d36c496dc42f0151ebddafc7414486d6112a8432f6a534d2dd20f3730c9522c33bb531c518309938898c2223fb697038fc85cf1b9c4369e83280fb3f1efde55d698a32e546f90565588a97f7694bbefd316b92152ddb1e7fb3c4c1872df421106581245876b6aea345633dbf7a727bf91797591f665e31c6e823aff325ad8db2fdc6182255ed4b79da91df21ce25d09291d0806da1f47470afa6e75123aa972bbd5fa473011fea66612c6165755bfd5a762ee32460789d9e402f789f2ee65a0e34a9a80bd906aa3fcb53d6ac6e22a0b16d3e5f4bfcea8f5310d687cb12ccf639a010e2a179274c3535888644ece752730dc63c5f2e5c680259b345650f2aa4e3d097b6e9850302be4ebfb71449a5fe76b69ed28f3276b1432504fbdf"; + const EpochChangeProof: vector = x"a85584420cd57f98d0674405ad491ffa65d06aeb77212d72d62c5facc6cf57b618268fd8303165cebe8c85d03d7d359458c112e73acfb107c0499db598a748345271ce5b1e8a91c291a639bc8c8c2574bc4b0447554f1cfc1daf0697424e5dfc5f21c8a727d3f14a99d5d031e9e63bc79def7af0729f5607690fc1f33eb13b013d8169b4117fcb772971e207a4fb1cc079af410dab30850c7dbd096c7b474642c7d3d780173f7dbd23e6a0a0402eb0415bfc3f64f9d90eeb45c7381dbb7f8de06b3c68b92dfeecd6cb098ec40f92d947e66928f1cc21e3fe426c3035ffa8dc041d5f1d130253c1616afa7e3ac1100296d1b7e02ff9cb22d4b02d534026eebe79991bec212a7077be94366d313871a31722f491f2955736b97e57979719ba3817049b06861f799f5fd46bed9e6008356120928211c3112a3d6ad32b3689af4d13e80d6ca0198fdca28c2b521e6e37dadb2c630df1ae727b1b19b690e5b99325936bb59bf104f2e5309f6ca2b8727cee7f3ef19576441cce8b42f839a15b3a3316720068a22216cef664a28960dfc45b0a85ed7b79e4aa678e38518224996f765742c169dc17236d46bdb41040908a80698ce9209461f1856dd9e57f5cc2725e3c959ee65b11934e49b1265599d7c0c04a18b68add3b6b3d1601f22c89115cfb6f6fbb403f3035d1cbd896b352292fdf1d6d8020dfe1be76a8b14f4d681dc9b763a6e22aae05267b9f933fa39cbe36667aa9bcefbe0708fc129450d9bef3a4d45fb3a336a609c1b093745fbf870e4aad3ec234ebf4b0cf1238882e3dd0e7fa474f7f10f73f144e4f145a4a88dcb9a184fec77d3695b18a0eb2f556b5e520e736df0f9e01040dbaf528f9fd147fb238e4ec5c4d20381502bdfbc6bfc5de019988b5f4e77ca5200f180077271f1cbec6c6e0971470f6688e480d83c40c728b36e85e0c99b9ea22a893392c90edd356e6318ec8864b990a048cd107fd4e3b201a59921e4861f81d6f62c0e7c8245dba477f2494655fa215e47d8d01a22e35c4750b13104e547f19b1a26591015e9f1dc6db1ab1b60cf7e0eb54b56d351d5832d495bbdc41481c00d3330e0b302e49575282b792bf89ec39946c84d3a93f24cb35501433ce0b5208d7312934466a24a65d4d35d38aca861e835b139de86ba4283367783f9f99dc260c2def5fcb2d7e3423b6fe0cc4726eda51a0144e74f154f2c036a968a87685"; - const InclusionVk: vector = x"00e326549ab661885dbefc3570c3f1f73aafc248b5f6119db8c08a3f9149c5eb"; + const InclusionVk: vector = x"00ac8f803153fab4cd7291beb0eac498f4c7949f74e7786bd69a0578bc325927"; const InclusionPublicValues: vector = x"e0fc9100000000000969ed235cf75d25800ea6845c2584af013c1f9617ad2de87202d7e9b93739c95c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f22002fe30a172d0a479f6add89c63b29dce29b6071b3c7e486b0fb4bc431f88501000000000000002000000000000000290decd9548b62a8ef0d3e6ac11e2d7b95a49e22ecf57fc6044b6f007ca2b2ba010000000000000080"; - const InclusionProof: vector = x"0a55c90b03ae2afd44c45fcf2a4053fc34d3896e9da9ff20857a6880381ca9803034bcd8ef4fa1bc50d6ca8f44b6d9bf46e986cdb614389a59f6affb58b395e11f9d74a40e86539048719166ae9658a20b437699d336cc4add796a254673aad00dd1e8107842847b8c60ba58b104b24e86379071b20d895d0e5ae7f82d611bba0dce4b9239034f5c80b956bd9cc7d3a1fd29119168b1b4425a45b3e948ad03af194a1e83d7aef29152b8c253e6b6b7a1a347a6a194e0f94d81c612f111c6171318de02b6a8ed77fb0f3a61543f39244f39f8363dc02290da9a87dc21266b647b077f7d591a8bcd3c7519952a1ec570fbbd10a1502a639eddd97f67f57654a95c140d995a6ee72e1c85f8e755a5d47fb055f3b40d67cc7ac537fadcba739313b4219fae4b63a3279de675c236f4156682029f5963382fb9cb4d2e60bd4f3dee912aa6c2e03a2f078148fe78243307d8631f2fbeba70e0c75573d856bd3ae36b3b2c810c270993e4f42a2f5d173bd924e6694ced0c218d98c217b00aefc977e28b27dc053cf901dba318eca443cfeded204b21c8db2c8fdc90a5dccaf67ecaaef82966ebb2053f878f41806283a636d9bdbf7c58ca4a40b152443d836fdab5394908474c911fc2e846a20b93bc92f3d45ddbc020d38ba363a68dc6f72872bbb2db2aacc1454352e0667f9d540511b0d4ef177726f77df460217c2c06d4859c55481df5fa7e9c76429f1dd8520e72bfdd996897ad9b16cc8d5a1f5d875ea1d0414c161277b48777abcb4de44d7992c22967cf9e237af7c69a800bf5ac6774b009c71b9db958635e5de897e21bf941e1ff66bb04a229ed47213b8b2c859120cc3fab25caa4f317f111c7751c7f8c6d7c9a0c272e4a759e1ab3f2ba5882280fefa6df1b487cd6ef96faa8eb09683cb94879664495d72fc50042cc59e25a3660b1563700a87ecca8fec5372a886849965715d2a30027ddf9bdbf20c0051b0ad7008ff10ff7f0805a25f3fb10f9df86ec7463320f7b2d85d0be624d9281bbc4fd13fa5f28e6a90c517439ff444be5852a5005eb95c083a68aeccf6b236cfc40e9e5d0a51a3304b133ba4b6680e69912ba719747530acbd2f0d94bc34f4d8b555bb92446254e682daad529691d916a3c2a08248ac1fc6cfce8ad7ee354680b56d63dd1e22b3329a12c9845f66683e887bc220f4f180ff114b1f5322fd6d21e4d6c402312"; - + const InclusionProof: vector = x"a85584420325031b628d531025b0a9ed7a846346c5d0b28ca9903a48ddd8ae739c58f0dc21ef49a01ebc2ef95e1f3989f72e0832965a3b5a908fa5050c74d9162a2f605b13a0d682d5d301ce6e44c44f40025daeded008acc8fcc5178c611ec2b6fdfbb12496f32cd1f99fd80f28cb46ddf7909603b6dd223db93a9378bce7892b3afa171493a69320d2f383c4e505b48d9baac4e1824f03147ac6dd61bffc9154f3d8361d176a85fbe837e1c06cc3ac383b14292440a038663381b8421b853fa171012905ee8ef1eb7cd86afb19b9e4c5911f285965935565cacdc41880b63fb49290b028cd994696aeecedeeca036957bbb0fa3d5f0369774191b73b3078fb36cf348f0e4b3781a083576bbe5ca35644f4a0be66c445b798791423c74075584ad14abd2a1c80fdf84060b407ad6b2547b20bcfcdd5d66a6dff8a91f15785b8b76dff8b10d4da4463ce69cb27070ad711e7251179333474867518d332c10f9a92b37797002ba50aad3d2407f3abebd3c20096ad104f74ddb8bd1f93a7da0381cb91eb9515efa3ef61ebb693501f125966142b116ed314c377c71ddb44967c61ddd1efe21eceb027b6c9b0ca22fc2ea5966a81f9492788a1588c1f6293fcf0abe22c60482d1fe48f09c1381c4e6de67655f38dee93440ae12ae715eda424eb0976aad614288471895e4d73791f2aaa18756177583f963e711ae58c281cc664a84ec09508200025017b717d6a477f613757115b1b5588c7860a54c1ded466aa34d15727b70a4fbabdd03f3ceacec53c104fb141ac4de3c3c8cb012b90f27766fc18fa83e42e685f270199861d080c06e64ddcf0cd2f320d68a4aa8962bc52836ec61efba1183b52115b482af21e79a2fd813ffb60319a0525ff47ec5b80fa2b8116a606b319992cf0e85ef4fee9a7c242ef040583d7265b5b344df5a2032729529ca2738820589dc9b1d5228e840825c7818c187845a3ce9c39395848dcf544e997d9bfe51fe28ee664cf36f843628e87ac413386c0735a4f4fe6410ed4bd0533902890db161d1b45c98162b2a0fdfe30fc2cffb197cd0fbd27fcfdab4a0d710f3fd3eefd195aff571eead04df178ad290b9e25f856fdae12bb7b412ac6a79909e3dee17a08e2f61eec9ffa72cb508122c2c469ad1a1e0645b28a2456910da5e0a540e6c0252b6b23efea0055f623723a9f741f15309e7d9698a03a1daa4e87801daa284f"; }