diff --git a/Cargo.lock b/Cargo.lock index 4ec9cb8da..b62934fb8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1749,6 +1749,18 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "async-compression" +version = "0.4.51" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d5755640120b24961f8231e05892e4a4f7e0d04e8aeca161508c9c397946970" +dependencies = [ + "compression-codecs", + "compression-core", + "pin-project-lite", + "tokio", +] + [[package]] name = "async-executor" version = "1.14.0" @@ -3628,6 +3640,23 @@ dependencies = [ "zkm-sdk", ] +[[package]] +name = "compression-codecs" +version = "0.4.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cae36683101b2899f48bd31f8db9839437356188e3b1ff23096e73dab09ba8fe" +dependencies = [ + "compression-core", + "flate2", + "memchr", +] + +[[package]] +name = "compression-core" +version = "0.4.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ebdda89edc534bf8d5dd2857562633b6495557e5846552ade994b99ed13c36a" + [[package]] name = "concurrent-queue" version = "2.5.0" @@ -5518,10 +5547,12 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.17.0" +version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f467dd6dccf739c208452f8014c75c18bb8301b050ad1cfb27153803edb0f51" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" dependencies = [ + "allocator-api2", + "equivalent", "foldhash 0.2.0", ] @@ -5540,7 +5571,7 @@ version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a596f1b20ed2cc5ecac41a164aaebc7258057060f06c0cf7a2ba3991ee7990fb" dependencies = [ - "hashbrown 0.17.0", + "hashbrown 0.17.1", ] [[package]] @@ -6288,7 +6319,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" dependencies = [ "equivalent", - "hashbrown 0.17.0", + "hashbrown 0.17.1", "serde", "serde_core", ] @@ -6414,6 +6445,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b4baf93f58d4425749ca49a51c50ebab072c5df6994d08fed93541c331481dc" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.18" @@ -7744,6 +7784,16 @@ dependencies = [ "rand 0.8.8", ] +[[package]] +name = "num-bigint" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93e7820bc0a80a0238e650327316f929ba18d5be054b647490a3a6a339f3e7c0" +dependencies = [ + "num-integer", + "num-traits", +] + [[package]] name = "num-bigint-dig" version = "0.8.6" @@ -8158,79 +8208,81 @@ dependencies = [ [[package]] name = "p3-air" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ + "hashbrown 0.17.1", "p3-field", "p3-matrix", + "serde", + "thiserror 2.0.18", "tracing", ] [[package]] name = "p3-bn254" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ - "num-bigint 0.4.6", + "num-bigint 0.5.1", "p3-field", "p3-poseidon2", "p3-symmetric", "p3-util", - "paste", "rand 0.10.1", "serde", ] [[package]] name = "p3-challenger" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ "p3-field", + "p3-keccak", "p3-maybe-rayon", - "p3-monty-31", "p3-symmetric", "p3-util", + "thiserror 2.0.18", "tracing", ] [[package]] name = "p3-commit" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ - "itertools 0.14.0", - "p3-challenger", + "itertools 0.15.0", "p3-dft", "p3-field", - "p3-interpolation", "p3-matrix", - "p3-multilinear-util", + "p3-maybe-rayon", "p3-util", "serde", + "thiserror 2.0.18", ] [[package]] name = "p3-dft" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ - "itertools 0.14.0", + "itertools 0.15.0", "p3-field", "p3-matrix", "p3-maybe-rayon", "p3-util", - "spin 0.10.0", + "spin 0.12.3", "tracing", ] [[package]] name = "p3-field" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ - "itertools 0.14.0", - "num-bigint 0.4.6", + "itertools 0.15.0", + "num-bigint 0.5.1", "p3-maybe-rayon", "p3-util", "paste", @@ -8241,40 +8293,40 @@ dependencies = [ [[package]] name = "p3-fri" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ - "itertools 0.14.0", + "itertools 0.15.0", "p3-challenger", "p3-commit", "p3-dft", "p3-field", - "p3-interpolation", "p3-matrix", "p3-maybe-rayon", + "p3-security", "p3-util", "rand 0.10.1", "serde", - "spin 0.10.0", + "spin 0.12.3", "thiserror 2.0.18", "tracing", ] [[package]] -name = "p3-interpolation" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +name = "p3-keccak" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ - "p3-field", - "p3-matrix", - "p3-maybe-rayon", + "cpufeatures 0.3.0", + "p3-symmetric", "p3-util", + "tiny-keccak", ] [[package]] name = "p3-keccak-air" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ "p3-air", "p3-field", @@ -8287,10 +8339,9 @@ dependencies = [ [[package]] name = "p3-koala-bear" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ - "p3-challenger", "p3-field", "p3-mds", "p3-monty-31", @@ -8302,10 +8353,10 @@ dependencies = [ [[package]] name = "p3-matrix" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ - "itertools 0.14.0", + "itertools 0.15.0", "p3-field", "p3-maybe-rayon", "p3-util", @@ -8316,16 +8367,16 @@ dependencies = [ [[package]] name = "p3-maybe-rayon" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ "rayon", ] [[package]] name = "p3-mds" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ "p3-dft", "p3-field", @@ -8336,10 +8387,10 @@ dependencies = [ [[package]] name = "p3-merkle-tree" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ - "itertools 0.14.0", + "itertools 0.15.0", "p3-commit", "p3-field", "p3-matrix", @@ -8348,17 +8399,18 @@ dependencies = [ "p3-util", "rand 0.10.1", "serde", + "spin 0.12.3", "thiserror 2.0.18", "tracing", ] [[package]] name = "p3-monty-31" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ - "itertools 0.14.0", - "num-bigint 0.4.6", + "itertools 0.15.0", + "num-bigint 0.5.1", "p3-dft", "p3-field", "p3-matrix", @@ -8368,73 +8420,74 @@ dependencies = [ "p3-poseidon2", "p3-symmetric", "p3-util", - "paste", - "rand 0.10.1", - "serde", - "spin 0.10.0", - "tracing", -] - -[[package]] -name = "p3-multilinear-util" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" -dependencies = [ - "itertools 0.14.0", - "p3-field", - "p3-matrix", - "p3-maybe-rayon", - "p3-util", "rand 0.10.1", "serde", + "spin 0.12.3", "tracing", ] [[package]] name = "p3-poseidon1" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ "p3-field", + "p3-mds", "p3-symmetric", "rand 0.10.1", ] [[package]] name = "p3-poseidon2" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ "p3-field", "p3-mds", "p3-symmetric", "p3-util", "rand 0.10.1", + "thiserror 2.0.18", +] + +[[package]] +name = "p3-security" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" +dependencies = [ + "libm", + "p3-air", + "p3-commit", + "p3-field", + "serde", + "thiserror 2.0.18", ] [[package]] name = "p3-symmetric" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ - "itertools 0.14.0", + "itertools 0.15.0", "p3-field", "p3-util", "serde", + "thiserror 2.0.18", ] [[package]] name = "p3-uni-stark" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ - "itertools 0.14.0", + "itertools 0.15.0", "p3-air", "p3-challenger", "p3-commit", "p3-field", "p3-matrix", "p3-maybe-rayon", + "p3-security", "p3-util", "serde", "thiserror 2.0.18", @@ -8443,11 +8496,11 @@ dependencies = [ [[package]] name = "p3-util" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ + "p3-maybe-rayon", "serde", - "transpose", ] [[package]] @@ -11541,6 +11594,12 @@ name = "spin" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5fe4ccb98d9c292d56fec89a5e07da7fc4cf0dc11e156b41793132775d3e591" + +[[package]] +name = "spin" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0134f9043ed38b087ac4f7d4af44c79e2c9e5094421fe3164f435ce585953b10" dependencies = [ "lock_api", ] @@ -11808,6 +11867,7 @@ dependencies = [ "lazy_static", "primitives", "proof-builder", + "reqwest 0.12.28", "reth-chainspec", "serde", "serde_json", @@ -11860,12 +11920,6 @@ dependencies = [ "walkdir", ] -[[package]] -name = "strength_reduce" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" - [[package]] name = "stringprep" version = "0.1.5" @@ -12682,13 +12736,18 @@ version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8" dependencies = [ + "async-compression", "bitflags 2.11.0", "bytes", + "futures-core", "futures-util", "http 1.4.0", "http-body 1.0.1", + "http-body-util", "iri-string", "pin-project-lite", + "tokio", + "tokio-util", "tower 0.5.3", "tower-layer", "tower-service", @@ -12815,16 +12874,6 @@ dependencies = [ "tracing-serde", ] -[[package]] -name = "transpose" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad61aed86bc3faea4300c7aee358b4c6d0c8d6ccc36524c96e4c92ccf26e77e" -dependencies = [ - "num-integer", - "strength_reduce", -] - [[package]] name = "try-lock" version = "0.2.5" @@ -14283,7 +14332,7 @@ dependencies = [ [[package]] name = "zkm-build" version = "2.0.0" -source = "git+https://github.com/ProjectZKM/Ziren#62acdd5cfaffe1d1bc44617cc9e6955f376ab93b" +source = "git+https://github.com/ProjectZKM/Ziren#a4d47079b45eecb244adc27ffa3daaac57de523b" dependencies = [ "anyhow", "cargo_metadata", @@ -14294,7 +14343,7 @@ dependencies = [ [[package]] name = "zkm-core-executor" version = "2.0.0" -source = "git+https://github.com/ProjectZKM/Ziren#62acdd5cfaffe1d1bc44617cc9e6955f376ab93b" +source = "git+https://github.com/ProjectZKM/Ziren#a4d47079b45eecb244adc27ffa3daaac57de523b" dependencies = [ "anyhow", "bincode", @@ -14333,7 +14382,7 @@ dependencies = [ [[package]] name = "zkm-core-jit" version = "2.0.0" -source = "git+https://github.com/ProjectZKM/Ziren#62acdd5cfaffe1d1bc44617cc9e6955f376ab93b" +source = "git+https://github.com/ProjectZKM/Ziren#a4d47079b45eecb244adc27ffa3daaac57de523b" dependencies = [ "dynasmrt", "libc", @@ -14346,7 +14395,7 @@ dependencies = [ [[package]] name = "zkm-core-machine" version = "2.0.0" -source = "git+https://github.com/ProjectZKM/Ziren#62acdd5cfaffe1d1bc44617cc9e6955f376ab93b" +source = "git+https://github.com/ProjectZKM/Ziren#a4d47079b45eecb244adc27ffa3daaac57de523b" dependencies = [ "bincode", "cfg-if", @@ -14362,6 +14411,7 @@ dependencies = [ "p256", "p3-air", "p3-challenger", + "p3-commit", "p3-field", "p3-keccak-air", "p3-koala-bear", @@ -14395,7 +14445,7 @@ dependencies = [ [[package]] name = "zkm-cuda" version = "2.0.0" -source = "git+https://github.com/ProjectZKM/Ziren#62acdd5cfaffe1d1bc44617cc9e6955f376ab93b" +source = "git+https://github.com/ProjectZKM/Ziren#a4d47079b45eecb244adc27ffa3daaac57de523b" dependencies = [ "bincode", "ctrlc", @@ -14413,7 +14463,7 @@ dependencies = [ [[package]] name = "zkm-curves" version = "2.0.0" -source = "git+https://github.com/ProjectZKM/Ziren#62acdd5cfaffe1d1bc44617cc9e6955f376ab93b" +source = "git+https://github.com/ProjectZKM/Ziren#a4d47079b45eecb244adc27ffa3daaac57de523b" dependencies = [ "cfg-if", "curve25519-dalek 4.1.3", @@ -14437,7 +14487,7 @@ dependencies = [ [[package]] name = "zkm-derive" version = "2.0.0" -source = "git+https://github.com/ProjectZKM/Ziren#62acdd5cfaffe1d1bc44617cc9e6955f376ab93b" +source = "git+https://github.com/ProjectZKM/Ziren#a4d47079b45eecb244adc27ffa3daaac57de523b" dependencies = [ "proc-macro2", "quote", @@ -14447,7 +14497,7 @@ dependencies = [ [[package]] name = "zkm-lib" version = "2.0.0" -source = "git+https://github.com/ProjectZKM/Ziren#62acdd5cfaffe1d1bc44617cc9e6955f376ab93b" +source = "git+https://github.com/ProjectZKM/Ziren#a4d47079b45eecb244adc27ffa3daaac57de523b" dependencies = [ "bincode", "cfg-if", @@ -14460,13 +14510,13 @@ dependencies = [ [[package]] name = "zkm-pcs" version = "2.0.0" -source = "git+https://github.com/ProjectZKM/Ziren#62acdd5cfaffe1d1bc44617cc9e6955f376ab93b" +source = "git+https://github.com/ProjectZKM/Ziren#a4d47079b45eecb244adc27ffa3daaac57de523b" dependencies = [ "arrayref", "bincode", "hashbrown 0.14.5", "itertools 0.13.0", - "num-bigint 0.4.6", + "num-bigint 0.5.1", "num-traits", "p3-air", "p3-challenger", @@ -14498,7 +14548,7 @@ dependencies = [ [[package]] name = "zkm-poly" version = "2.0.0" -source = "git+https://github.com/ProjectZKM/Ziren#62acdd5cfaffe1d1bc44617cc9e6955f376ab93b" +source = "git+https://github.com/ProjectZKM/Ziren#a4d47079b45eecb244adc27ffa3daaac57de523b" dependencies = [ "itertools 0.13.0", "p3-field", @@ -14507,13 +14557,13 @@ dependencies = [ [[package]] name = "zkm-primitives" version = "2.0.0" -source = "git+https://github.com/ProjectZKM/Ziren#62acdd5cfaffe1d1bc44617cc9e6955f376ab93b" +source = "git+https://github.com/ProjectZKM/Ziren#a4d47079b45eecb244adc27ffa3daaac57de523b" dependencies = [ "bincode", "blake3", "hex", "lazy_static", - "num-bigint 0.4.6", + "num-bigint 0.5.1", "p3-field", "p3-koala-bear", "p3-monty-31", @@ -14527,7 +14577,7 @@ dependencies = [ [[package]] name = "zkm-prover" version = "2.0.0" -source = "git+https://github.com/ProjectZKM/Ziren#62acdd5cfaffe1d1bc44617cc9e6955f376ab93b" +source = "git+https://github.com/ProjectZKM/Ziren#a4d47079b45eecb244adc27ffa3daaac57de523b" dependencies = [ "anyhow", "bincode", @@ -14536,7 +14586,7 @@ dependencies = [ "eyre", "hex", "itertools 0.13.0", - "num-bigint 0.4.6", + "num-bigint 0.5.1", "p3-air", "p3-bn254", "p3-challenger", @@ -14566,7 +14616,7 @@ dependencies = [ [[package]] name = "zkm-recursion-circuit" version = "2.0.0" -source = "git+https://github.com/ProjectZKM/Ziren#62acdd5cfaffe1d1bc44617cc9e6955f376ab93b" +source = "git+https://github.com/ProjectZKM/Ziren#a4d47079b45eecb244adc27ffa3daaac57de523b" dependencies = [ "hashbrown 0.14.5", "itertools 0.13.0", @@ -14596,7 +14646,7 @@ dependencies = [ [[package]] name = "zkm-recursion-compiler" version = "2.0.0" -source = "git+https://github.com/ProjectZKM/Ziren#62acdd5cfaffe1d1bc44617cc9e6955f376ab93b" +source = "git+https://github.com/ProjectZKM/Ziren#a4d47079b45eecb244adc27ffa3daaac57de523b" dependencies = [ "backtrace", "itertools 0.13.0", @@ -14617,7 +14667,7 @@ dependencies = [ [[package]] name = "zkm-recursion-core" version = "2.0.0" -source = "git+https://github.com/ProjectZKM/Ziren#62acdd5cfaffe1d1bc44617cc9e6955f376ab93b" +source = "git+https://github.com/ProjectZKM/Ziren#a4d47079b45eecb244adc27ffa3daaac57de523b" dependencies = [ "backtrace", "bincode", @@ -14656,7 +14706,7 @@ dependencies = [ [[package]] name = "zkm-recursion-derive" version = "2.0.0" -source = "git+https://github.com/ProjectZKM/Ziren#62acdd5cfaffe1d1bc44617cc9e6955f376ab93b" +source = "git+https://github.com/ProjectZKM/Ziren#a4d47079b45eecb244adc27ffa3daaac57de523b" dependencies = [ "quote", "syn 1.0.109", @@ -14665,7 +14715,7 @@ dependencies = [ [[package]] name = "zkm-recursion-gnark-ffi" version = "2.0.0" -source = "git+https://github.com/ProjectZKM/Ziren#62acdd5cfaffe1d1bc44617cc9e6955f376ab93b" +source = "git+https://github.com/ProjectZKM/Ziren#a4d47079b45eecb244adc27ffa3daaac57de523b" dependencies = [ "anyhow", "bincode", @@ -14673,7 +14723,7 @@ dependencies = [ "cfg-if", "hex", "log", - "num-bigint 0.4.6", + "num-bigint 0.5.1", "p3-field", "p3-koala-bear", "p3-symmetric", @@ -14689,7 +14739,7 @@ dependencies = [ [[package]] name = "zkm-sdk" version = "2.0.0" -source = "git+https://github.com/ProjectZKM/Ziren#62acdd5cfaffe1d1bc44617cc9e6955f376ab93b" +source = "git+https://github.com/ProjectZKM/Ziren#a4d47079b45eecb244adc27ffa3daaac57de523b" dependencies = [ "anyhow", "async-trait", @@ -14703,7 +14753,7 @@ dependencies = [ "indicatif", "itertools 0.13.0", "log", - "num-bigint 0.4.6", + "num-bigint 0.5.1", "p3-field", "p3-fri", "p3-koala-bear", @@ -14735,7 +14785,7 @@ dependencies = [ [[package]] name = "zkm-verifier" version = "2.0.0" -source = "git+https://github.com/ProjectZKM/Ziren#62acdd5cfaffe1d1bc44617cc9e6955f376ab93b" +source = "git+https://github.com/ProjectZKM/Ziren#a4d47079b45eecb244adc27ffa3daaac57de523b" dependencies = [ "anyhow", "ark-bn254", @@ -14771,7 +14821,7 @@ dependencies = [ [[package]] name = "zkm-zkvm" version = "2.0.0" -source = "git+https://github.com/ProjectZKM/Ziren#62acdd5cfaffe1d1bc44617cc9e6955f376ab93b" +source = "git+https://github.com/ProjectZKM/Ziren#a4d47079b45eecb244adc27ffa3daaac57de523b" dependencies = [ "bincode", "cfg-if", diff --git a/Cargo.toml b/Cargo.toml index 4e7e611c7..77c3518a3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -101,8 +101,8 @@ zkm-zkvm = { git = "https://github.com/ProjectZKM/Ziren", features = ["verify"] zkm-recursion-core = { git = "https://github.com/ProjectZKM/Ziren" } zkm-pcs = { git = "https://github.com/ProjectZKM/Ziren" } # Must match Ziren's own Plonky3 spec exactly, or the field types differ from Ziren's. -p3-bn254-fr = { git = "https://github.com/ProjectZKM/Plonky3", rev = "4dd0d47a8176503fbaa7293c9f0e3b20004e16b2", package = "p3-bn254" } -p3-field = { git = "https://github.com/ProjectZKM/Plonky3", rev = "4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" } +p3-bn254-fr = { git = "https://github.com/ProjectZKM/Plonky3", package = "p3-bn254" } +p3-field = { git = "https://github.com/ProjectZKM/Plonky3" } #zkm-build = { path = "../Ziren/crates/build" } #zkm-core-executor = { path = "../Ziren/crates/core/executor" } diff --git a/circuits/Cargo.lock b/circuits/Cargo.lock index e356d51a8..0d0eae7ed 100644 --- a/circuits/Cargo.lock +++ b/circuits/Cargo.lock @@ -1232,6 +1232,17 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" +[[package]] +name = "chacha20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.0", + "rand_core 0.10.1", +] + [[package]] name = "chrono" version = "0.4.44" @@ -2344,9 +2355,14 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.17.0" +version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f467dd6dccf739c208452f8014c75c18bb8301b050ad1cfb27153803edb0f51" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash 0.2.0", +] [[package]] name = "header-chain" @@ -2621,7 +2637,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" dependencies = [ "equivalent", - "hashbrown 0.17.0", + "hashbrown 0.17.1", "serde", "serde_core", ] @@ -2663,6 +2679,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b4baf93f58d4425749ca49a51c50ebab072c5df6994d08fed93541c331481dc" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.18" @@ -2974,6 +2999,16 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-bigint" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93e7820bc0a80a0238e650327316f929ba18d5be054b647490a3a6a339f3e7c0" +dependencies = [ + "num-integer", + "num-traits", +] + [[package]] name = "num-complex" version = "0.4.6" @@ -3163,79 +3198,81 @@ dependencies = [ [[package]] name = "p3-air" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ + "hashbrown 0.17.1", "p3-field", "p3-matrix", + "serde", + "thiserror 2.0.18", "tracing", ] [[package]] name = "p3-bn254" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ - "num-bigint 0.4.6", + "num-bigint 0.5.1", "p3-field", "p3-poseidon2", "p3-symmetric", "p3-util", - "paste", "rand 0.10.3", "serde", ] [[package]] name = "p3-challenger" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ "p3-field", + "p3-keccak", "p3-maybe-rayon", - "p3-monty-31", "p3-symmetric", "p3-util", + "thiserror 2.0.18", "tracing", ] [[package]] name = "p3-commit" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ - "itertools 0.14.0", - "p3-challenger", + "itertools 0.15.0", "p3-dft", "p3-field", - "p3-interpolation", "p3-matrix", - "p3-multilinear-util", + "p3-maybe-rayon", "p3-util", "serde", + "thiserror 2.0.18", ] [[package]] name = "p3-dft" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ - "itertools 0.14.0", + "itertools 0.15.0", "p3-field", "p3-matrix", "p3-maybe-rayon", "p3-util", - "spin 0.10.1", + "spin 0.12.3", "tracing", ] [[package]] name = "p3-field" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ - "itertools 0.14.0", - "num-bigint 0.4.6", + "itertools 0.15.0", + "num-bigint 0.5.1", "p3-maybe-rayon", "p3-util", "paste", @@ -3246,40 +3283,40 @@ dependencies = [ [[package]] name = "p3-fri" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ - "itertools 0.14.0", + "itertools 0.15.0", "p3-challenger", "p3-commit", "p3-dft", "p3-field", - "p3-interpolation", "p3-matrix", "p3-maybe-rayon", + "p3-security", "p3-util", "rand 0.10.3", "serde", - "spin 0.10.1", + "spin 0.12.3", "thiserror 2.0.18", "tracing", ] [[package]] -name = "p3-interpolation" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +name = "p3-keccak" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ - "p3-field", - "p3-matrix", - "p3-maybe-rayon", + "cpufeatures 0.3.0", + "p3-symmetric", "p3-util", + "tiny-keccak", ] [[package]] name = "p3-keccak-air" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ "p3-air", "p3-field", @@ -3292,10 +3329,9 @@ dependencies = [ [[package]] name = "p3-koala-bear" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ - "p3-challenger", "p3-field", "p3-mds", "p3-monty-31", @@ -3307,10 +3343,10 @@ dependencies = [ [[package]] name = "p3-matrix" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ - "itertools 0.14.0", + "itertools 0.15.0", "p3-field", "p3-maybe-rayon", "p3-util", @@ -3321,16 +3357,16 @@ dependencies = [ [[package]] name = "p3-maybe-rayon" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ "rayon", ] [[package]] name = "p3-mds" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ "p3-dft", "p3-field", @@ -3341,10 +3377,10 @@ dependencies = [ [[package]] name = "p3-merkle-tree" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ - "itertools 0.14.0", + "itertools 0.15.0", "p3-commit", "p3-field", "p3-matrix", @@ -3353,17 +3389,18 @@ dependencies = [ "p3-util", "rand 0.10.3", "serde", + "spin 0.12.3", "thiserror 2.0.18", "tracing", ] [[package]] name = "p3-monty-31" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ - "itertools 0.14.0", - "num-bigint 0.4.6", + "itertools 0.15.0", + "num-bigint 0.5.1", "p3-dft", "p3-field", "p3-matrix", @@ -3373,73 +3410,74 @@ dependencies = [ "p3-poseidon2", "p3-symmetric", "p3-util", - "paste", - "rand 0.10.3", - "serde", - "spin 0.10.1", - "tracing", -] - -[[package]] -name = "p3-multilinear-util" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" -dependencies = [ - "itertools 0.14.0", - "p3-field", - "p3-matrix", - "p3-maybe-rayon", - "p3-util", "rand 0.10.3", "serde", + "spin 0.12.3", "tracing", ] [[package]] name = "p3-poseidon1" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ "p3-field", + "p3-mds", "p3-symmetric", "rand 0.10.3", ] [[package]] name = "p3-poseidon2" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ "p3-field", "p3-mds", "p3-symmetric", "p3-util", "rand 0.10.3", + "thiserror 2.0.18", +] + +[[package]] +name = "p3-security" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" +dependencies = [ + "libm", + "p3-air", + "p3-commit", + "p3-field", + "serde", + "thiserror 2.0.18", ] [[package]] name = "p3-symmetric" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ - "itertools 0.14.0", + "itertools 0.15.0", "p3-field", "p3-util", "serde", + "thiserror 2.0.18", ] [[package]] name = "p3-uni-stark" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ - "itertools 0.14.0", + "itertools 0.15.0", "p3-air", "p3-challenger", "p3-commit", "p3-field", "p3-matrix", "p3-maybe-rayon", + "p3-security", "p3-util", "serde", "thiserror 2.0.18", @@ -3448,11 +3486,11 @@ dependencies = [ [[package]] name = "p3-util" -version = "0.5.1" -source = "git+https://github.com/ProjectZKM/Plonky3?rev=4dd0d47a8176503fbaa7293c9f0e3b20004e16b2#4dd0d47a8176503fbaa7293c9f0e3b20004e16b2" +version = "0.8.0" +source = "git+https://github.com/ProjectZKM/Plonky3#5ccd557f5f1a21f5a4c4b0bad83da8729ba2f091" dependencies = [ + "p3-maybe-rayon", "serde", - "transpose", ] [[package]] @@ -3910,6 +3948,7 @@ version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65c9fb96cbc91e3478eaae79a69fcd3f1ae4ad052e471fe6732fff548984b4af" dependencies = [ + "chacha20", "rand_core 0.10.1", ] @@ -5092,9 +5131,9 @@ checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" [[package]] name = "spin" -version = "0.10.1" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "023a211cb3138dbc438680b32560ad89f699977624c9f8dbb95a47d5b4c07dd3" +checksum = "0134f9043ed38b087ac4f7d4af44c79e2c9e5094421fe3164f435ce585953b10" dependencies = [ "lock_api", ] @@ -5161,12 +5200,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" -[[package]] -name = "strength_reduce" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" - [[package]] name = "strsim" version = "0.11.1" @@ -5614,16 +5647,6 @@ dependencies = [ "tracing-log", ] -[[package]] -name = "transpose" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad61aed86bc3faea4300c7aee358b4c6d0c8d6ccc36524c96e4c92ccf26e77e" -dependencies = [ - "num-integer", - "strength_reduce", -] - [[package]] name = "typenum" version = "1.19.0" @@ -6297,7 +6320,7 @@ dependencies = [ [[package]] name = "zkm-core-executor" version = "2.0.0" -source = "git+https://github.com/ProjectZKM/Ziren#62acdd5cfaffe1d1bc44617cc9e6955f376ab93b" +source = "git+https://github.com/ProjectZKM/Ziren#a4d47079b45eecb244adc27ffa3daaac57de523b" dependencies = [ "anyhow", "bincode", @@ -6336,7 +6359,7 @@ dependencies = [ [[package]] name = "zkm-core-jit" version = "2.0.0" -source = "git+https://github.com/ProjectZKM/Ziren#62acdd5cfaffe1d1bc44617cc9e6955f376ab93b" +source = "git+https://github.com/ProjectZKM/Ziren#a4d47079b45eecb244adc27ffa3daaac57de523b" dependencies = [ "dynasmrt", "libc", @@ -6349,7 +6372,7 @@ dependencies = [ [[package]] name = "zkm-core-machine" version = "2.0.0" -source = "git+https://github.com/ProjectZKM/Ziren#62acdd5cfaffe1d1bc44617cc9e6955f376ab93b" +source = "git+https://github.com/ProjectZKM/Ziren#a4d47079b45eecb244adc27ffa3daaac57de523b" dependencies = [ "bincode", "cfg-if", @@ -6365,6 +6388,7 @@ dependencies = [ "p256", "p3-air", "p3-challenger", + "p3-commit", "p3-field", "p3-keccak-air", "p3-koala-bear", @@ -6398,7 +6422,7 @@ dependencies = [ [[package]] name = "zkm-curves" version = "2.0.0" -source = "git+https://github.com/ProjectZKM/Ziren#62acdd5cfaffe1d1bc44617cc9e6955f376ab93b" +source = "git+https://github.com/ProjectZKM/Ziren#a4d47079b45eecb244adc27ffa3daaac57de523b" dependencies = [ "cfg-if", "curve25519-dalek", @@ -6422,7 +6446,7 @@ dependencies = [ [[package]] name = "zkm-derive" version = "2.0.0" -source = "git+https://github.com/ProjectZKM/Ziren#62acdd5cfaffe1d1bc44617cc9e6955f376ab93b" +source = "git+https://github.com/ProjectZKM/Ziren#a4d47079b45eecb244adc27ffa3daaac57de523b" dependencies = [ "proc-macro2", "quote", @@ -6432,7 +6456,7 @@ dependencies = [ [[package]] name = "zkm-lib" version = "2.0.0" -source = "git+https://github.com/ProjectZKM/Ziren#62acdd5cfaffe1d1bc44617cc9e6955f376ab93b" +source = "git+https://github.com/ProjectZKM/Ziren#a4d47079b45eecb244adc27ffa3daaac57de523b" dependencies = [ "bincode", "cfg-if", @@ -6445,13 +6469,13 @@ dependencies = [ [[package]] name = "zkm-pcs" version = "2.0.0" -source = "git+https://github.com/ProjectZKM/Ziren#62acdd5cfaffe1d1bc44617cc9e6955f376ab93b" +source = "git+https://github.com/ProjectZKM/Ziren#a4d47079b45eecb244adc27ffa3daaac57de523b" dependencies = [ "arrayref", "bincode", "hashbrown 0.14.5", "itertools 0.13.0", - "num-bigint 0.4.6", + "num-bigint 0.5.1", "num-traits", "p3-air", "p3-challenger", @@ -6483,7 +6507,7 @@ dependencies = [ [[package]] name = "zkm-poly" version = "2.0.0" -source = "git+https://github.com/ProjectZKM/Ziren#62acdd5cfaffe1d1bc44617cc9e6955f376ab93b" +source = "git+https://github.com/ProjectZKM/Ziren#a4d47079b45eecb244adc27ffa3daaac57de523b" dependencies = [ "itertools 0.13.0", "p3-field", @@ -6492,13 +6516,13 @@ dependencies = [ [[package]] name = "zkm-primitives" version = "2.0.0" -source = "git+https://github.com/ProjectZKM/Ziren#62acdd5cfaffe1d1bc44617cc9e6955f376ab93b" +source = "git+https://github.com/ProjectZKM/Ziren#a4d47079b45eecb244adc27ffa3daaac57de523b" dependencies = [ "bincode", "blake3", "hex", "lazy_static", - "num-bigint 0.4.6", + "num-bigint 0.5.1", "p3-field", "p3-koala-bear", "p3-monty-31", @@ -6512,7 +6536,7 @@ dependencies = [ [[package]] name = "zkm-recursion-core" version = "2.0.0" -source = "git+https://github.com/ProjectZKM/Ziren#62acdd5cfaffe1d1bc44617cc9e6955f376ab93b" +source = "git+https://github.com/ProjectZKM/Ziren#a4d47079b45eecb244adc27ffa3daaac57de523b" dependencies = [ "backtrace", "bincode", @@ -6551,7 +6575,7 @@ dependencies = [ [[package]] name = "zkm-verifier" version = "2.0.0" -source = "git+https://github.com/ProjectZKM/Ziren#62acdd5cfaffe1d1bc44617cc9e6955f376ab93b" +source = "git+https://github.com/ProjectZKM/Ziren#a4d47079b45eecb244adc27ffa3daaac57de523b" dependencies = [ "anyhow", "bincode", @@ -6581,7 +6605,7 @@ dependencies = [ [[package]] name = "zkm-zkvm" version = "2.0.0" -source = "git+https://github.com/ProjectZKM/Ziren#62acdd5cfaffe1d1bc44617cc9e6955f376ab93b" +source = "git+https://github.com/ProjectZKM/Ziren#a4d47079b45eecb244adc27ffa3daaac57de523b" dependencies = [ "bincode", "blake3", diff --git a/circuits/crates/bitcoin-light-client-circuit/src/lib.rs b/circuits/crates/bitcoin-light-client-circuit/src/lib.rs index 691065531..d516f19d9 100644 --- a/circuits/crates/bitcoin-light-client-circuit/src/lib.rs +++ b/circuits/crates/bitcoin-light-client-circuit/src/lib.rs @@ -33,10 +33,10 @@ pub const VK_HASH_SIZE: usize = 66; pub const TOTAL_WORK_SIZE: usize = 32; pub const CONSENSUS_BLOCK_HEIGHT_SIZE: usize = 4; -// 0x4dc626c63149074f261a81b2719491482d112e2564e1f68b948237f679a1f3fc +// 0xf70a446b6f2314b38b5220ae4b84ab3bee0cde87bf761155b24945cc434b7241 pub const ROOT_COMMIT_PROGRAM_ID: verifier::ProgramId = [ - 77, 198, 38, 198, 49, 73, 7, 79, 38, 26, 129, 178, 113, 148, 145, 72, 45, 17, 46, 37, 100, 225, - 246, 139, 148, 130, 55, 246, 121, 161, 243, 252, + 247, 10, 68, 107, 111, 35, 20, 179, 139, 82, 32, 174, 75, 132, 171, 59, 238, 12, 222, 135, 191, + 118, 17, 85, 178, 73, 69, 204, 67, 75, 114, 65, ]; #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] diff --git a/circuits/crates/verifier/src/lib.rs b/circuits/crates/verifier/src/lib.rs index 027ffae90..791a2ec38 100644 --- a/circuits/crates/verifier/src/lib.rs +++ b/circuits/crates/verifier/src/lib.rs @@ -122,7 +122,7 @@ pub fn verify_groth16_proof( mod tests { use super::*; - /// Pins the Groth16 statement to Ziren `62acdd5c` (circuit version v2.0.0). The Ziren dependency + /// Pins the Groth16 statement to Ziren `a4d47079` (circuit version v2.0.0). The Ziren dependency /// has no tag or rev, so a `cargo update` could otherwise move the wrap vk or the recursion vk /// root without a reviewable diff. Update these only together with a deliberate Ziren upgrade. #[test] @@ -131,17 +131,17 @@ mod tests { assert_eq!( imm_vk_hash, [ - 0xba, 0xad, 0x5b, 0x23, 0x1f, 0x3f, 0x25, 0x84, 0x35, 0x31, 0x96, 0xd8, 0xfe, 0xb7, - 0xfd, 0xd6, 0x0c, 0x49, 0x35, 0x6e, 0x8d, 0xd6, 0x04, 0x20, 0x6b, 0xf0, 0x18, 0xcf, - 0x19, 0xe2, 0xce, 0x0e, + 0xf7, 0x0a, 0xa6, 0x9f, 0xbf, 0x44, 0x76, 0xf1, 0xf4, 0x25, 0x48, 0xdc, 0x78, 0x3d, + 0x4c, 0x64, 0x05, 0x5f, 0xc1, 0xbb, 0x03, 0x1f, 0xe6, 0x55, 0xb9, 0x88, 0x0d, 0x5a, + 0x43, 0x24, 0x49, 0xfe, ] ); assert_eq!( *zkm_verifier::VK_ROOT_BYTES, [ - 0x00, 0x32, 0x6c, 0xc6, 0xf1, 0xf6, 0x4b, 0xa2, 0x26, 0x66, 0x0f, 0x3c, 0x89, 0x64, - 0x2d, 0x0e, 0xf2, 0x9c, 0x40, 0xf1, 0x75, 0xac, 0xb2, 0x1c, 0x21, 0xbe, 0x9a, 0xb9, - 0x0e, 0x32, 0x24, 0x6e, + 0x00, 0x7a, 0xd3, 0x94, 0x82, 0xc4, 0x46, 0x0f, 0xe9, 0x1d, 0x19, 0x53, 0x4e, 0xcc, + 0x20, 0xe2, 0x7d, 0x37, 0x4c, 0x3e, 0x17, 0xc0, 0xfe, 0x5f, 0x44, 0xd7, 0xcf, 0x7c, + 0xb0, 0xfd, 0x23, 0x49, ] ); } diff --git a/circuits/state-chain-proof/host/Cargo.toml b/circuits/state-chain-proof/host/Cargo.toml index 6229fea27..2be72afdc 100644 --- a/circuits/state-chain-proof/host/Cargo.toml +++ b/circuits/state-chain-proof/host/Cargo.toml @@ -28,6 +28,8 @@ bitcoin-light-client-circuit = { workspace = true } primitives.workspace = true reth-chainspec.workspace = true url.workspace = true +# Alloy shares this client; decode gzip responses for large execution witnesses. +reqwest = { workspace = true, features = ["gzip"] } host-executor.workspace = true alloy-provider.workspace = true alloy-primitives.workspace = true diff --git a/circuits/state-chain-proof/host/src/lib.rs b/circuits/state-chain-proof/host/src/lib.rs index 3b49feeda..73c2b72b1 100644 --- a/circuits/state-chain-proof/host/src/lib.rs +++ b/circuits/state-chain-proof/host/src/lib.rs @@ -8,18 +8,17 @@ use alloy_provider::{ use anyhow::Context; use bitcoin_light_client_circuit::EthClientExecutorInput; use cbft_rpc::{ - fetch_cbft_tx_data, fetch_cbft_validator_info, fetch_cosmos_block, get_cosmos_block_height_at, + HttpClient, fetch_cbft_tx_data, fetch_cbft_validator_info, fetch_cosmos_block, + get_cosmos_block_height_at, }; +use futures_util::{StreamExt, TryStreamExt, stream}; use host_executor::EthHostExecutor; use primitives::genesis::Genesis; use proof_builder::ProofRequest; use proof_builder::{LongRunning, ProofBuilder}; use reth_chainspec::ChainSpec; use state_chain::*; -use std::{ - collections::{BTreeMap, BTreeSet}, - sync::Arc, -}; +use std::{collections::BTreeSet, sync::Arc}; use url::Url; use zkm_sdk::{ HashableKey, ProverClient, ZKM_CIRCUIT_VERSION, ZKMProofKind, ZKMProofWithPublicValues, @@ -74,6 +73,11 @@ pub struct Args { #[clap(long, env, default_value_t = 0)] pub start: u64, + /// Maximum number of GOAT blocks fetched concurrently. + #[clap(long, env, default_value_t = default_fetch_concurrency())] + #[serde(default = "default_fetch_concurrency")] + pub fetch_concurrency: usize, + // Print-only mode skips runtime inputs but keeps them required otherwise. #[clap( long, @@ -85,6 +89,10 @@ pub struct Args { pub l2_contract_addresses: String, } +fn default_fetch_concurrency() -> usize { + 16 +} + impl LongRunning for Args { fn rotate(&self) -> Self { let mut next_args = self.clone(); @@ -193,53 +201,43 @@ fn collect_receipt_withdrawals( } async fn fetch_withdrawal_events( - execution_layer_rpc: &str, + provider: &RootProvider, l2_contract_addresses: &[Address], - start: u64, - batch_size: u64, -) -> anyhow::Result> { - let provider = RootProvider::::new_http(Url::parse(execution_layer_rpc)?); - let end = start.checked_add(batch_size).context("state-chain block range overflows")?; - let mut batches = BTreeMap::new(); - for height in start..end { - // EthGetBlock normalizes a missing transaction list into empty hashes. - // Read the typed RPC response directly so missing data remains distinguishable. - let block = provider - .client() - .request::<_, Option>( - "eth_getBlockByNumber", - (format!("0x{height:x}"), false), - ) + height: u64, +) -> anyhow::Result { + // EthGetBlock normalizes a missing transaction list into empty hashes. + // Read the typed RPC response directly so missing data remains distinguishable. + let block = provider + .client() + .request::<_, Option>("eth_getBlockByNumber", (format!("0x{height:x}"), false)) + .await + .map_err(|error| input_not_ready(format!("get block {height}: {error}")))? + .ok_or_else(|| input_not_ready(format!("block {height} is missing")))?; + if block.header.number != height { + return Err(input_not_ready(format!("wrong block number returned for {height}"))); + } + if block.transactions.is_uncle() { + return Err(input_not_ready(format!("block {height} has no transaction list"))); + } + let block_hash = block.header.hash; + let mut withdrawals = Vec::new(); + for (index, txid) in block.transactions.hashes().enumerate() { + let receipt = provider + .get_transaction_receipt(txid) .await - .map_err(|error| input_not_ready(format!("get block {height}: {error}")))? - .ok_or_else(|| input_not_ready(format!("block {height} is missing")))?; - if block.header.number != height { - return Err(input_not_ready(format!("wrong block number returned for {height}"))); - } - if block.transactions.is_uncle() { - return Err(input_not_ready(format!("block {height} has no transaction list"))); - } - let block_hash = block.header.hash; - let mut withdrawals = Vec::new(); - for (index, txid) in block.transactions.hashes().enumerate() { - let receipt = provider - .get_transaction_receipt(txid) - .await - .map_err(|error| input_not_ready(format!("get receipt {txid}: {error}")))? - .ok_or_else(|| input_not_ready(format!("receipt {txid} is missing")))?; - collect_receipt_withdrawals( - &receipt, - l2_contract_addresses, - height, - block_hash, - txid, - index as u64, - &mut withdrawals, - )?; - } - batches.insert(height, BlockWithdrawals { block_hash, withdrawals }); + .map_err(|error| input_not_ready(format!("get receipt {txid}: {error}")))? + .ok_or_else(|| input_not_ready(format!("receipt {txid} is missing")))?; + collect_receipt_withdrawals( + &receipt, + l2_contract_addresses, + height, + block_hash, + txid, + index as u64, + &mut withdrawals, + )?; } - Ok(batches) + Ok(BlockWithdrawals { block_hash, withdrawals }) } fn check_execution_block( @@ -258,13 +256,10 @@ fn check_execution_block( // https://github.com/ProjectZKM/reth-processor/blob/stateless/crates/executor/host/tests/integration.rs#L69 async fn fetch_exection_layer_block( - execution_layer_rpc: &str, + provider: &RootProvider, execution_layer_block_number: u64, genesis: &Genesis, ) -> anyhow::Result { - // Setup the provider. - let rpc_url = Url::parse(execution_layer_rpc)?; - let provider = RootProvider::::new_http(rpc_url); //let rpc_db = RpcDb::new(provider.clone(), provider.clone(), execution_layer_block_number - 1); let chain_spec: Arc = Arc::new(genesis.try_into().unwrap()); let custom_beneficiary = None; @@ -273,8 +268,8 @@ async fn fetch_exection_layer_block( let client_input = host_executor .execute( execution_layer_block_number, - &provider, - &provider, + provider, + provider, genesis.clone(), custom_beneficiary, false, @@ -283,6 +278,60 @@ async fn fetch_exection_layer_block( Ok(client_input) } +/// Fetch execution and consensus inputs for GOAT block `i` and match them to its receipts. +async fn fetch_state_block( + provider: &RootProvider, + cosmos: &HttpClient, + genesis: &Genesis, + withdrawal_block: BlockWithdrawals, + i: u64, + retry_after: u64, +) -> anyhow::Result { + let evm_block = fetch_exection_layer_block(provider, i, genesis).await.map_err(|e| { + tracing::error!("fetch_exection_layer_block: {e:?}"); + proof_builder::ProofError::InputNotReady(retry_after) + })?; + + check_execution_block( + i, + withdrawal_block.block_hash, + evm_block.current_block.header.number, + evm_block.current_block.header.hash_slow(), + )?; + let parent_beacon_block_root = evm_block + .current_block + .header + .parent_beacon_block_root + .ok_or_else(|| input_not_ready(format!("block {i} has no parent beacon block root")))?; + let parent_cosmos_block_height = get_cosmos_block_height_at(cosmos, *parent_beacon_block_root) + .await + .map_err(|error| input_not_ready(format!("get parent cosmos block for {i}: {error}")))?; + + let (_, cl_block_number) = + fetch_cbft_validator_info(cosmos, i, parent_cosmos_block_height, 1000).await.map_err( + |e| { + tracing::error!("fetch_cbft_validator_info: {e:?}"); + proof_builder::ProofError::InputNotReady(retry_after) + }, + )?; + let cosmos_txns = fetch_cbft_tx_data(cosmos, cl_block_number).await.map_err(|e| { + tracing::error!("fetch_cbft_tx_data: {e:?}"); + proof_builder::ProofError::InputNotReady(retry_after) + })?; + let cosmos_block = fetch_cosmos_block(cosmos, cl_block_number).await.map_err(|e| { + tracing::error!("fetch_cosmos_block: {e:?}"); + proof_builder::ProofError::InputNotReady(retry_after) + })?; + + tracing::info!("block: {i}, cl_block_number: {cl_block_number}, txns: {}", cosmos_txns.len()); + + let withdrawals = withdrawal_block.withdrawals; + let cosmos_block = serde_json::to_vec(&cosmos_block)?; + tracing::info!("[push] block: {}, withdrawals: {:?}", i, withdrawals); + Ok(CircuitStateBlock { cosmos_txns, cosmos_block, evm_block, withdrawals }) +} + +/// Fetches GOAT blocks `start..start + batch_size`, `concurrency` blocks at a time, in block order. #[allow(clippy::too_many_arguments)] pub async fn fetch_state_chain( l2_contract_addresses: &str, @@ -292,73 +341,39 @@ pub async fn fetch_state_chain( blocks_file: &str, genesis: &str, cosmos_rpc_url: &str, + concurrency: usize, ) -> anyhow::Result> { let l2_contract_addresses = parse_gateway_addresses(l2_contract_addresses)?; anyhow::ensure!(start > 0, "Don't get genesis block from the consensus layer"); anyhow::ensure!(batch_size > 0, "batch_size must be positive"); let end = start.checked_add(batch_size).context("state-chain block range overflows")?; let genesis = if genesis == "goattest" { Genesis::GoatTestnet } else { Genesis::GOAT }; - let mut blocks = Vec::new(); - // fetch graph_block_numbers and graph_ids between in goat block(start, start + batch_size) - let withdrawal_events = - fetch_withdrawal_events(execution_layer_rpc, &l2_contract_addresses, start, batch_size) - .await?; - - for i in start..end { - let evm_block = - fetch_exection_layer_block(execution_layer_rpc, i, &genesis).await.map_err(|e| { - tracing::error!("fetch_exection_layer_block: {e:?}"); - proof_builder::ProofError::InputNotReady((batch_size + start - i) * 3) - })?; - - let withdrawal_block = withdrawal_events - .get(&i) - .ok_or_else(|| input_not_ready(format!("withdrawal block {i} is missing")))?; - check_execution_block( - i, - withdrawal_block.block_hash, - evm_block.current_block.header.number, - evm_block.current_block.header.hash_slow(), - )?; - let parent_beacon_block_root = - evm_block.current_block.header.parent_beacon_block_root.ok_or_else(|| { - input_not_ready(format!("block {i} has no parent beacon block root")) - })?; - let parent_cosmos_block_height = - get_cosmos_block_height_at(cosmos_rpc_url, *parent_beacon_block_root).await.map_err( - |error| input_not_ready(format!("get parent cosmos block for {i}: {error}")), - )?; - - let (_, cl_block_number) = - fetch_cbft_validator_info(cosmos_rpc_url, i, parent_cosmos_block_height, 1000) - .await - .map_err(|e| { - tracing::error!("fetch_cbft_validator_info: {e:?}"); - // GOAT's block time is 3 seconds - proof_builder::ProofError::InputNotReady((batch_size + start - i) * 3) - })?; - let cosmos_txns = - fetch_cbft_tx_data(cosmos_rpc_url, cl_block_number).await.map_err(|e| { - tracing::error!("fetch_cbft_tx_data: {e:?}"); - proof_builder::ProofError::InputNotReady((batch_size + start - i) * 3) - })?; - let cosmos_block = - fetch_cosmos_block(cosmos_rpc_url, cl_block_number).await.map_err(|e| { - tracing::error!("fetch_cosmos_block: {e:?}"); - proof_builder::ProofError::InputNotReady((batch_size + start - i) * 3) - })?; - - tracing::info!( - "block: {i}, cl_block_number: {cl_block_number}, txns: {}", - cosmos_txns.len() - ); - - let withdrawals = withdrawal_block.withdrawals.clone(); - - let cosmos_block = serde_json::to_vec(&cosmos_block)?; - tracing::info!("[push] block: {}, withdrawals: {:?}", i, withdrawals); - blocks.push(CircuitStateBlock { cosmos_txns, cosmos_block, evm_block, withdrawals }); - } + // One client per layer for the whole batch, so blocks reuse their connections. + let provider = RootProvider::::new_http(Url::parse(execution_layer_rpc)?); + let cosmos = HttpClient::new(cosmos_rpc_url) + .map_err(|e| anyhow::anyhow!("Invalid cosmos rpc url {cosmos_rpc_url}: {e:?}"))?; + let concurrency = concurrency.max(1); + let fetch_start = std::time::Instant::now(); + + // Validate the batch's receipts before starting execution witness requests. + let withdrawals: Vec = stream::iter(start..end) + .map(|height| fetch_withdrawal_events(&provider, &l2_contract_addresses, height)) + .buffered(concurrency) + .try_collect() + .await?; + let blocks: Vec = stream::iter((start..end).zip(withdrawals)) + .map(|(i, withdrawal_block)| { + // GOAT's block time is 3 seconds. + let retry_after = (end - i).saturating_mul(3); + fetch_state_block(&provider, &cosmos, &genesis, withdrawal_block, i, retry_after) + }) + .buffered(concurrency) + .try_collect() + .await?; + tracing::info!( + "fetched blocks {start}..{end}, {concurrency} at a time, in {:?}", + fetch_start.elapsed() + ); let block_bytes = serde_json::to_vec(&blocks)?; std::fs::write(blocks_file, block_bytes)?; Ok(blocks) @@ -636,8 +651,9 @@ mod tests { ("eth_getTransactionReceipt", json!({"result": receipt(tx2, 1, true, vec![log(2, gateway(1), tx2, 1), log(1, gateway(1), tx2, 1), log(3, gateway(2), tx2, 1)])})), ("eth_getTransactionReceipt", json!({"result": receipt(tx3, 2, false, vec![log(99, gateway(1), tx3, 2)])})), ]).await; - let result = fetch_withdrawal_events(&url, &[gateway(1), gateway(2)], 10, 1).await.unwrap(); - let batch = &result[&10]; + let provider = RootProvider::::new_http(Url::parse(&url).unwrap()); + let batch = + fetch_withdrawal_events(&provider, &[gateway(1), gateway(2)], 10).await.unwrap(); assert_eq!(batch.block_hash, hash(10)); assert_eq!( batch.withdrawals, @@ -660,7 +676,8 @@ mod tests { ("eth_getTransactionReceipt", json!({"result": receipt(hash(1), 0, true, vec![log(1, gateway(1), hash(1), 0)])})), ("eth_getTransactionReceipt", response), ]).await; - assert_retry(&fetch_withdrawal_events(&url, &[gateway(1)], 10, 1).await.unwrap_err()); + let provider = RootProvider::::new_http(Url::parse(&url).unwrap()); + assert_retry(&fetch_withdrawal_events(&provider, &[gateway(1)], 10).await.unwrap_err()); finish(server).await; } } @@ -687,6 +704,7 @@ mod tests { file.to_str().unwrap(), "goattest", "http://127.0.0.1:1", + 1, ) .await .unwrap_err(); @@ -701,7 +719,8 @@ mod tests { let mut value = block(10, vec![hash(1)]); value.as_object_mut().unwrap().remove("transactions"); let (url, server) = rpc(vec![("eth_getBlockByNumber", json!({"result": value}))]).await; - assert_retry(&fetch_withdrawal_events(&url, &[gateway(1)], 10, 1).await.unwrap_err()); + let provider = RootProvider::::new_http(Url::parse(&url).unwrap()); + assert_retry(&fetch_withdrawal_events(&provider, &[gateway(1)], 10).await.unwrap_err()); finish(server).await; } @@ -792,4 +811,75 @@ mod tests { assert!(parse_gateway_addresses(&invalid).is_err(), "{invalid}"); } } + + /// A block as JSON, minus what changes between fetches of the same block: the cosmos node + /// that served the light block (behind a load balancer), and the order of the bytecodes, + /// which come from a hash map and which the guest looks up by hash. + fn comparable(block: &CircuitStateBlock) -> Value { + let mut light_block: Value = serde_json::from_slice(&block.cosmos_block).unwrap(); + light_block.as_object_mut().unwrap().remove("provider"); + let mut evm_block = serde_json::to_value(&block.evm_block).unwrap(); + evm_block["bytecodes"].as_array_mut().unwrap().sort_by_key(|code| code.to_string()); + serde_json::json!({ + "cosmos_txns": block.cosmos_txns, + "light_block": light_block, + "evm_block": evm_block, + "withdrawals": block.withdrawals, + }) + } + + /// The JSON paths at which two values differ. + fn differing_paths(a: &Value, b: &Value, path: String) -> Vec { + match (a, b) { + (Value::Object(x), Value::Object(y)) => { + let keys: std::collections::BTreeSet<&String> = x.keys().chain(y.keys()).collect(); + keys.into_iter() + .flat_map(|k| { + let missing = Value::Null; + let (x, y) = (x.get(k).unwrap_or(&missing), y.get(k).unwrap_or(&missing)); + differing_paths(x, y, format!("{path}.{k}")) + }) + .collect() + } + (Value::Array(x), Value::Array(y)) if x.len() == y.len() => (0..x.len()) + .flat_map(|i| differing_paths(&x[i], &y[i], format!("{path}[{i}]"))) + .collect(), + _ if a != b => vec![path], + _ => vec![], + } + } + + #[tokio::test] + #[ignore = "requires public GOAT testnet3 RPC"] + async fn concurrent_fetch_matches_sequential() { + let execution_layer_rpc = std::env::var("EXECUTION_LAYER_RPC") + .unwrap_or("https://rpc-legacy.testnet3.goat.network".to_string()); + let cosmos_rpc_url = std::env::var("COSMOS_RPC_URL") + .unwrap_or("https://rpc.testnet3.goat.network/goat-rpc".to_string()); + let (start, batch_size) = (17781200, 6); + let blocks_file = std::env::temp_dir().join("state-chain-fetch-test.blocks"); + let fetch = |concurrency| { + fetch_state_chain( + "0x0c7821F1C72181a2C710Eaa91d81120d7e009e41,0x60a5b099eE011018DD064F9eBD50d381C37b5e8b", + start, + batch_size, + &execution_layer_rpc, + blocks_file.to_str().unwrap(), + "goattest", + &cosmos_rpc_url, + concurrency, + ) + }; + + let sequential = fetch(1).await.unwrap(); + let concurrent = fetch(4).await.unwrap(); + + let numbers: Vec = + concurrent.iter().map(|b| b.evm_block.current_block.header.number).collect(); + assert_eq!(numbers, (start..start + batch_size).collect::>()); + for (number, (s, c)) in numbers.iter().zip(sequential.iter().zip(&concurrent)) { + let paths = differing_paths(&comparable(s), &comparable(c), String::new()); + assert!(paths.is_empty(), "block {number} differs at {}", paths.join(", ")); + } + } } diff --git a/circuits/state-chain-proof/host/src/main.rs b/circuits/state-chain-proof/host/src/main.rs index 8d8901d00..140c29643 100644 --- a/circuits/state-chain-proof/host/src/main.rs +++ b/circuits/state-chain-proof/host/src/main.rs @@ -25,6 +25,7 @@ async fn main() { &args.blocks, &args.goat_network, &args.cosmos_rpc_url, + args.fetch_concurrency, ) .await .unwrap(); diff --git a/crates/cbft-rpc/src/lib.rs b/crates/cbft-rpc/src/lib.rs index 1498f6c3b..9abf349e9 100644 --- a/crates/cbft-rpc/src/lib.rs +++ b/crates/cbft-rpc/src/lib.rs @@ -3,7 +3,9 @@ use state_chain::parse_cbft_tx_payload; use tendermint::block::Height; use tendermint::validator::Info; use tendermint_light_client_verifier::types::{LightBlock, PeerId, ValidatorSet}; -use tendermint_rpc::{Client, HttpClient}; +use tendermint_rpc::Client; +// Callers build one client per batch so its requests share connections. +pub use tendermint_rpc::HttpClient; /// Abstraction over Cosmos RPC calls used by the sequencer set hash monitor. /// Enables mock-based testing of sync logic without real RPC. @@ -91,10 +93,9 @@ pub async fn fetch_cbft_block_validators_hash_and_goat_block( // get cosmos block height from block hash: curl https://rpc.testnet3.goat.network/goat-rpc/block_by_hash?hash=0xd2e236b8f89278a527a042727cd4eebb59a566006a844f294da54ed727b95470 pub async fn get_cosmos_block_height_at( - cosmos_rpc_url: &str, + rpc: &HttpClient, cosmos_block_hash: [u8; 32], ) -> Result> { - let rpc = HttpClient::new(cosmos_rpc_url).unwrap(); match rpc.block_by_hash(tendermint::Hash::Sha256(cosmos_block_hash)).await { Ok(resp) => match resp.block { Some(b) => Ok(Some(b.header.height.into())), @@ -111,17 +112,15 @@ pub async fn get_cosmos_block_height_at( /// ``` /// curl "https://rpc.testnet3.goat.network/goat-rpcblock?height=5756784" | jq .result.block.data /// ``` -#[tracing::instrument(level = "info")] +#[tracing::instrument(level = "info", skip(rpc))] pub async fn fetch_cbft_validator_info( - cosmos_rpc_url: &str, + rpc: &HttpClient, goat_block_height: u64, parent_cosmos_block_height: Option, mut max_offset: u64, ) -> Result<([u8; 32], u64)> { // Linear search starting from `parent_cosmos_block_height` (or `goat_block_height`) // upward until we find the CBFT transaction with matching goat_block_height. - let rpc = HttpClient::new(cosmos_rpc_url).unwrap(); - let mut block_height: u64 = match parent_cosmos_block_height { Some(h) => h, None => goat_block_height, @@ -156,8 +155,7 @@ pub async fn fetch_cbft_validator_info( anyhow::bail!("Can not find the cosmos block for goat block height {goat_block_height}"); } -pub async fn fetch_cbft_tx_data(cosmos_rpc_url: &str, height: u64) -> Result>> { - let rpc = HttpClient::new(cosmos_rpc_url).unwrap(); +pub async fn fetch_cbft_tx_data(rpc: &HttpClient, height: u64) -> Result>> { let block_data = rpc .block(Height::from(height as u32)) .await @@ -167,8 +165,7 @@ pub async fn fetch_cbft_tx_data(cosmos_rpc_url: &str, height: u64) -> Result Result { - let rpc = HttpClient::new(cosmos_rpc_url).unwrap(); +pub async fn fetch_cosmos_block(rpc: &HttpClient, height: u64) -> Result { // 1. header + commit let commit_resp = rpc .commit(Height::try_from(height).unwrap()) @@ -208,7 +205,8 @@ mod tests { let block_number = 10000; let cosmos_rpc_url = std::env::var("COSMOS_RPC_URL") .unwrap_or("https://rpc.testnet3.goat.network/goat-rpc".to_string()); - let result = fetch_cbft_tx_data(&cosmos_rpc_url, block_number).await; + let rpc = HttpClient::new(cosmos_rpc_url.as_str()).unwrap(); + let result = fetch_cbft_tx_data(&rpc, block_number).await; assert!(result.is_ok()); } @@ -217,8 +215,9 @@ mod tests { let cosmos_rpc_url = std::env::var("COSMOS_RPC_URL") .unwrap_or("https://rpc.testnet3.goat.network/goat-rpc".to_string()); let evm_block_number = 10627151; + let rpc = HttpClient::new(cosmos_rpc_url.as_str()).unwrap(); let (sequencer_hash, block_number) = - fetch_cbft_validator_info(&cosmos_rpc_url, evm_block_number, None, 1000).await.unwrap(); + fetch_cbft_validator_info(&rpc, evm_block_number, None, 1000).await.unwrap(); println!("hex sequencer_hash: {}", hex::encode(sequencer_hash)); println!("cosmos block number: {}", block_number); @@ -235,7 +234,7 @@ mod tests { panic!("Invalid sequencer set hash"); } - let light_block = fetch_cosmos_block(&cosmos_rpc_url, block_number).await.unwrap(); + let light_block = fetch_cosmos_block(&rpc, block_number).await.unwrap(); assert_eq!(light_block.signed_header.header.validators_hash.as_bytes(), &sequencer_hash); } } diff --git a/deployment/regtest/proof-builder-rpc/proof-builder.toml b/deployment/regtest/proof-builder-rpc/proof-builder.toml index 0cf04f8c2..84c45a700 100644 --- a/deployment/regtest/proof-builder-rpc/proof-builder.toml +++ b/deployment/regtest/proof-builder-rpc/proof-builder.toml @@ -34,6 +34,8 @@ l2_contract_addresses = "0x294306b29b7A25EAe079fd874131B350bbA0b16c" #start = 9511050 start = 10579883 batch_size = 40 +## blocks fetched at once (default 16) +#fetch_concurrency = 16 execution_layer_rpc = "https://rpc-legacy.testnet3.goat.network" blocks = "../circuits/data/state-chain/state.blocks" ## input_proof is optional when init_input=true diff --git a/proof-builder-rpc/src/task/state_chain_proof.rs b/proof-builder-rpc/src/task/state_chain_proof.rs index aa24d0407..b9a13092f 100644 --- a/proof-builder-rpc/src/task/state_chain_proof.rs +++ b/proof-builder-rpc/src/task/state_chain_proof.rs @@ -87,6 +87,7 @@ async fn spawn_state_chain_ctx_builder( &args.blocks, &args.goat_network, &args.cosmos_rpc_url, + args.fetch_concurrency, ).await { Ok(d) => d, Err(e) => {