diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 77fc47d0..9f463625 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,8 +65,8 @@ jobs: - name: Run cargo clippy run: cargo clippy --all-targets -- -D warnings - simple_proof: - name: Execute bash script to generate and verify a proof from a small block + simple_proof_regular: + name: Execute bash script to generate and verify a proof for a small block. runs-on: zero-ci steps: @@ -77,3 +77,16 @@ jobs: run: | pushd tools ./simple_test.sh + + simple_proof_witness_only: + name: Execute bash script to generate the proof witness for a small block. + runs-on: zero-ci + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Run the script + run: | + pushd tools + ./simple_test.sh test_only diff --git a/.gitignore b/.gitignore index 2b0d4923..e6f77beb 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,6 @@ verifier_state_* # Coordinator output coordinator/benchmark_out/ coordinator/proof_out/ + +# Ignore IntelliJ IDEA/RustRover/Clion metadata +.idea/ diff --git a/Cargo.lock b/Cargo.lock index acb7d584..e99ec3ab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -21,16 +21,16 @@ dependencies = [ [[package]] name = "actix-http" -version = "3.6.0" +version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d223b13fd481fc0d1f83bb12659ae774d9e3601814c68a0bc539731698cca743" +checksum = "4eb9843d84c775696c37d9a418bbb01b932629d01870722c0f13eb3f95e2536d" dependencies = [ "actix-codec", "actix-rt", "actix-service", "actix-utils", "ahash", - "base64 0.21.7", + "base64 0.22.1", "bitflags 2.5.0", "brotli", "bytes", @@ -65,27 +65,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" dependencies = [ "quote", - "syn 2.0.63", + "syn 2.0.66", ] [[package]] name = "actix-router" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d22475596539443685426b6bdadb926ad0ecaefdfc5fb05e5e3441f15463c511" +checksum = "13d324164c51f63867b57e73ba5936ea151b8a41a1d23d1031eeb9f70d0236f8" dependencies = [ "bytestring", + "cfg-if", "http 0.2.12", "regex", + "regex-lite", "serde", "tracing", ] [[package]] name = "actix-rt" -version = "2.9.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28f32d40287d3f402ae0028a9d54bef51af15c8769492826a69d28f81893151d" +checksum = "24eda4e2a6e042aa4e55ac438a2ae052d3b5da0ecf83d7411e1a368946925208" dependencies = [ "actix-macros", "futures-core", @@ -94,9 +96,9 @@ dependencies = [ [[package]] name = "actix-server" -version = "2.3.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3eb13e7eef0423ea6eab0e59f6c72e7cb46d33691ad56a726b3cd07ddec2c2d4" +checksum = "b02303ce8d4e8be5b855af6cf3c3a08f3eff26880faad82bab679c22d3650cb5" dependencies = [ "actix-rt", "actix-service", @@ -132,9 +134,9 @@ dependencies = [ [[package]] name = "actix-web" -version = "4.5.1" +version = "4.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a6556ddebb638c2358714d853257ed226ece6023ef9364f23f0c70737ea984" +checksum = "5d6316df3fa569627c98b12557a8b6ff0674e5be4bb9b5e4ae2550ddb4964ed6" dependencies = [ "actix-codec", "actix-http", @@ -161,6 +163,7 @@ dependencies = [ "once_cell", "pin-project-lite", "regex", + "regex-lite", "serde", "serde_json", "serde_urlencoded", @@ -172,21 +175,21 @@ dependencies = [ [[package]] name = "actix-web-codegen" -version = "4.2.2" +version = "4.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb1f50ebbb30eca122b188319a4398b3f7bb4a8cdf50ecfb73bfc6a3c3ce54f5" +checksum = "f591380e2e68490b5dfaf1dd1aa0ebe78d84ba7067078512b4ea6e4492d622b8" dependencies = [ "actix-router", "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.66", ] [[package]] name = "addr2line" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" dependencies = [ "gimli", ] @@ -252,6 +255,400 @@ version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" +[[package]] +name = "alloy" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy#fb875f2c3614e878f0ece14589008cb63faae779" +dependencies = [ + "alloy-consensus", + "alloy-core", + "alloy-eips", + "alloy-genesis", + "alloy-provider", + "alloy-rpc-client", + "alloy-rpc-types", + "alloy-serde", + "alloy-transport", + "alloy-transport-http", + "reqwest 0.12.4", +] + +[[package]] +name = "alloy-chains" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24ceb48af11349cd7fbd12aa739800be3c4b3965f640b7ae26666907f3bdf091" +dependencies = [ + "num_enum", + "strum", +] + +[[package]] +name = "alloy-consensus" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy#fb875f2c3614e878f0ece14589008cb63faae779" +dependencies = [ + "alloy-eips", + "alloy-primitives", + "alloy-rlp", + "alloy-serde", + "c-kzg", + "serde", +] + +[[package]] +name = "alloy-core" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5af3faff14c12c8b11037e0a093dd157c3702becb8435577a2408534d0758315" +dependencies = [ + "alloy-dyn-abi", + "alloy-json-abi", + "alloy-primitives", + "alloy-sol-types", +] + +[[package]] +name = "alloy-dyn-abi" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb6e6436a9530f25010d13653e206fab4c9feddacf21a54de8d7311b275bc56b" +dependencies = [ + "alloy-json-abi", + "alloy-primitives", + "alloy-sol-type-parser", + "alloy-sol-types", + "const-hex", + "itoa", + "serde", + "serde_json", + "winnow 0.6.13", +] + +[[package]] +name = "alloy-eips" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy#fb875f2c3614e878f0ece14589008cb63faae779" +dependencies = [ + "alloy-primitives", + "alloy-rlp", + "alloy-serde", + "c-kzg", + "once_cell", + "serde", + "sha2", +] + +[[package]] +name = "alloy-genesis" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy#fb875f2c3614e878f0ece14589008cb63faae779" +dependencies = [ + "alloy-primitives", + "alloy-serde", + "serde", + "serde_json", +] + +[[package]] +name = "alloy-json-abi" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aaeaccd50238126e3a0ff9387c7c568837726ad4f4e399b528ca88104d6c25ef" +dependencies = [ + "alloy-primitives", + "alloy-sol-type-parser", + "serde", + "serde_json", +] + +[[package]] +name = "alloy-json-rpc" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy#fb875f2c3614e878f0ece14589008cb63faae779" +dependencies = [ + "alloy-primitives", + "serde", + "serde_json", + "thiserror", + "tracing", +] + +[[package]] +name = "alloy-network" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy#fb875f2c3614e878f0ece14589008cb63faae779" +dependencies = [ + "alloy-consensus", + "alloy-eips", + "alloy-json-rpc", + "alloy-primitives", + "alloy-rpc-types-eth", + "alloy-signer", + "alloy-sol-types", + "async-trait", + "auto_impl", + "futures-utils-wasm", + "thiserror", +] + +[[package]] +name = "alloy-primitives" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f783611babedbbe90db3478c120fb5f5daacceffc210b39adc0af4fe0da70bad" +dependencies = [ + "alloy-rlp", + "bytes", + "cfg-if", + "const-hex", + "derive_more", + "hex-literal", + "itoa", + "k256", + "keccak-asm", + "proptest", + "rand", + "ruint", + "serde", + "tiny-keccak", +] + +[[package]] +name = "alloy-provider" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy#fb875f2c3614e878f0ece14589008cb63faae779" +dependencies = [ + "alloy-chains", + "alloy-consensus", + "alloy-eips", + "alloy-json-rpc", + "alloy-network", + "alloy-primitives", + "alloy-rpc-client", + "alloy-rpc-types-eth", + "alloy-rpc-types-trace", + "alloy-transport", + "alloy-transport-http", + "async-stream", + "async-trait", + "auto_impl", + "dashmap", + "futures", + "futures-utils-wasm", + "lru", + "pin-project", + "reqwest 0.12.4", + "serde", + "serde_json", + "tokio", + "tracing", + "url", +] + +[[package]] +name = "alloy-rlp" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b155716bab55763c95ba212806cf43d05bcc70e5f35b02bad20cf5ec7fe11fed" +dependencies = [ + "alloy-rlp-derive", + "arrayvec", + "bytes", +] + +[[package]] +name = "alloy-rlp-derive" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8037e03c7f462a063f28daec9fda285a9a89da003c552f8637a80b9c8fd96241" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "alloy-rpc-client" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy#fb875f2c3614e878f0ece14589008cb63faae779" +dependencies = [ + "alloy-json-rpc", + "alloy-transport", + "alloy-transport-http", + "futures", + "pin-project", + "reqwest 0.12.4", + "serde", + "serde_json", + "tokio", + "tokio-stream", + "tower", + "tracing", + "url", +] + +[[package]] +name = "alloy-rpc-types" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy#fb875f2c3614e878f0ece14589008cb63faae779" +dependencies = [ + "alloy-rpc-types-eth", + "alloy-serde", +] + +[[package]] +name = "alloy-rpc-types-eth" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy#fb875f2c3614e878f0ece14589008cb63faae779" +dependencies = [ + "alloy-consensus", + "alloy-eips", + "alloy-genesis", + "alloy-primitives", + "alloy-rlp", + "alloy-serde", + "alloy-sol-types", + "itertools 0.13.0", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "alloy-rpc-types-trace" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy#fb875f2c3614e878f0ece14589008cb63faae779" +dependencies = [ + "alloy-primitives", + "alloy-rpc-types-eth", + "alloy-serde", + "serde", + "serde_json", +] + +[[package]] +name = "alloy-serde" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy#fb875f2c3614e878f0ece14589008cb63faae779" +dependencies = [ + "alloy-primitives", + "serde", + "serde_json", +] + +[[package]] +name = "alloy-signer" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy#fb875f2c3614e878f0ece14589008cb63faae779" +dependencies = [ + "alloy-primitives", + "async-trait", + "auto_impl", + "elliptic-curve", + "k256", + "thiserror", +] + +[[package]] +name = "alloy-sol-macro" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bad41a7c19498e3f6079f7744656328699f8ea3e783bdd10d85788cd439f572" +dependencies = [ + "alloy-sol-macro-expander", + "alloy-sol-macro-input", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "alloy-sol-macro-expander" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd9899da7d011b4fe4c406a524ed3e3f963797dbc93b45479d60341d3a27b252" +dependencies = [ + "alloy-sol-macro-input", + "const-hex", + "heck 0.5.0", + "indexmap 2.2.6", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.66", + "syn-solidity", + "tiny-keccak", +] + +[[package]] +name = "alloy-sol-macro-input" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d32d595768fdc61331a132b6f65db41afae41b9b97d36c21eb1b955c422a7e60" +dependencies = [ + "const-hex", + "dunce", + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.66", + "syn-solidity", +] + +[[package]] +name = "alloy-sol-type-parser" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baa2fbd22d353d8685bd9fee11ba2d8b5c3b1d11e56adb3265fcf1f32bfdf404" +dependencies = [ + "winnow 0.6.13", +] + +[[package]] +name = "alloy-sol-types" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a49042c6d3b66a9fe6b2b5a8bf0d39fc2ae1ee0310a2a26ffedd79fb097878dd" +dependencies = [ + "alloy-primitives", + "alloy-sol-macro", + "const-hex", + "serde", +] + +[[package]] +name = "alloy-transport" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy#fb875f2c3614e878f0ece14589008cb63faae779" +dependencies = [ + "alloy-json-rpc", + "base64 0.22.1", + "futures-util", + "futures-utils-wasm", + "serde", + "serde_json", + "thiserror", + "tokio", + "tower", + "url", +] + +[[package]] +name = "alloy-transport-http" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy#fb875f2c3614e878f0ece14589008cb63faae779" +dependencies = [ + "alloy-json-rpc", + "alloy-transport", + "reqwest 0.12.4", + "serde_json", + "tower", + "tracing", + "url", +] + [[package]] name = "amq-protocol" version = "7.2.0" @@ -347,9 +744,9 @@ dependencies = [ [[package]] name = "anstyle-query" -version = "1.0.3" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a64c907d4e79225ac72e2a354c9ce84d50ebb4586dee56c82b3ee73004f537f5" +checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391" dependencies = [ "windows-sys 0.52.0", ] @@ -366,13 +763,137 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.83" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25bdb32cbbdce2b519a9cd7df3a678443100e265d5e25ca763b7572a5104f5f3" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" dependencies = [ "backtrace", ] +[[package]] +name = "ark-ff" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b3235cc41ee7a12aaaf2c575a2ad7b46713a8a50bda2fc3b003a04845c05dd6" +dependencies = [ + "ark-ff-asm 0.3.0", + "ark-ff-macros 0.3.0", + "ark-serialize 0.3.0", + "ark-std 0.3.0", + "derivative", + "num-bigint", + "num-traits", + "paste", + "rustc_version 0.3.3", + "zeroize", +] + +[[package]] +name = "ark-ff" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" +dependencies = [ + "ark-ff-asm 0.4.2", + "ark-ff-macros 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "digest 0.10.7", + "itertools 0.10.5", + "num-bigint", + "num-traits", + "paste", + "rustc_version 0.4.0", + "zeroize", +] + +[[package]] +name = "ark-ff-asm" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db02d390bf6643fb404d3d22d31aee1c4bc4459600aef9113833d17e786c6e44" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-asm" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fd794a08ccb318058009eefdf15bcaaaaf6f8161eb3345f907222bac38b20" +dependencies = [ + "num-bigint", + "num-traits", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-serialize" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6c2b318ee6e10f8c2853e73a83adc0ccb88995aa978d8a3408d492ab2ee671" +dependencies = [ + "ark-std 0.3.0", + "digest 0.9.0", +] + +[[package]] +name = "ark-serialize" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" +dependencies = [ + "ark-std 0.4.0", + "digest 0.10.7", + "num-bigint", +] + +[[package]] +name = "ark-std" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1df2c09229cbc5a028b1d70e00fdb2acee28b1055dfb5ca73eea49c5a25c4e7c" +dependencies = [ + "num-traits", + "rand", +] + +[[package]] +name = "ark-std" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" +dependencies = [ + "num-traits", + "rand", +] + [[package]] name = "arrayvec" version = "0.7.4" @@ -403,7 +924,7 @@ checksum = "7378575ff571966e99a744addeff0bff98b8ada0dedf1956d59e634db95eaac1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.66", "synstructure", ] @@ -415,27 +936,26 @@ checksum = "7b18050c2cd6fe86c3a76584ef5e0baf286d038cda203eb6223df2cc413565f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.66", ] [[package]] name = "async-channel" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f2776ead772134d55b62dd45e59a79e21612d85d0af729b8b7d3967d601a62a" +checksum = "89b47800b0be77592da0afd425cc03468052844aff33b84e33cc696f64e77b6a" dependencies = [ "concurrent-queue", - "event-listener 5.3.0", - "event-listener-strategy 0.5.2", + "event-listener-strategy", "futures-core", "pin-project-lite", ] [[package]] name = "async-executor" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b10202063978b3351199d68f8b22c4e47e4b1b822f8d43fd862d5ea8c006b29a" +checksum = "c8828ec6e544c02b0d6691d21ed9f9218d0384a82542855073c2a3f58304aaf0" dependencies = [ "async-task", "concurrent-queue", @@ -452,8 +972,8 @@ checksum = "05b1b633a2115cd122d73b955eadd9916c18c8f510ec9cd1686404c60ad1c29c" dependencies = [ "async-channel", "async-executor", - "async-io 2.3.2", - "async-lock 3.3.0", + "async-io 2.3.3", + "async-lock 3.4.0", "blocking", "futures-lite 2.3.0", "once_cell", @@ -492,17 +1012,17 @@ dependencies = [ [[package]] name = "async-io" -version = "2.3.2" +version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcccb0f599cfa2f8ace422d3555572f47424da5648a4382a9dd0310ff8210884" +checksum = "0d6baa8f0178795da0e71bc42c9e5d13261aac7ee549853162e66a241ba17964" dependencies = [ - "async-lock 3.3.0", + "async-lock 3.4.0", "cfg-if", "concurrent-queue", "futures-io", "futures-lite 2.3.0", "parking", - "polling 3.7.0", + "polling 3.7.1", "rustix 0.38.34", "slab", "tracing", @@ -520,12 +1040,12 @@ dependencies = [ [[package]] name = "async-lock" -version = "3.3.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d034b430882f8381900d3fe6f0aaa3ad94f2cb4ac519b429692a1bc2dda4ae7b" +checksum = "ff6e472cdea888a4bd64f342f09b3f50e1886d32afe8df3d663c01140b811b18" dependencies = [ - "event-listener 4.0.3", - "event-listener-strategy 0.4.0", + "event-listener 5.3.1", + "event-listener-strategy", "pin-project-lite", ] @@ -560,7 +1080,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.66", ] [[package]] @@ -577,7 +1097,7 @@ checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.66", ] [[package]] @@ -595,6 +1115,17 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" +[[package]] +name = "auto_impl" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + [[package]] name = "autocfg" version = "1.3.0" @@ -603,9 +1134,9 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "aws-lc-rs" -version = "1.7.1" +version = "1.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8487b59d62764df8231cb371c459314df895b41756df457a1fb1243d65c89195" +checksum = "bf7d844e282b4b56750b2d4e893b2205581ded8709fddd2b6aa5418c150ca877" dependencies = [ "aws-lc-sys", "mirai-annotations", @@ -615,9 +1146,9 @@ dependencies = [ [[package]] name = "aws-lc-sys" -version = "0.16.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c15eb61145320320eb919d9bab524617a7aa4216c78d342fae3a758bc33073e4" +checksum = "c3a2c29203f6bf296d01141cc8bb9dbd5ecd4c27843f2ee0767bcd5985a927da" dependencies = [ "bindgen", "cc", @@ -699,9 +1230,9 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.71" +version = "0.3.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" +checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" dependencies = [ "addr2line", "cc", @@ -712,6 +1243,12 @@ dependencies = [ "rustc-demangle", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "base64" version = "0.13.1" @@ -755,10 +1292,25 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.63", + "syn 2.0.66", "which", ] +[[package]] +name = "bit-set" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" + [[package]] name = "bitflags" version = "1.3.2" @@ -812,23 +1364,34 @@ dependencies = [ [[package]] name = "blocking" -version = "1.6.0" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "495f7104e962b7356f0aeb34247aca1fe7d2e783b346582db7f2904cb5717e88" +checksum = "703f41c54fc768e63e091340b424302bb1c29ef4aa0c7f10fe849dfb114d29ea" dependencies = [ "async-channel", - "async-lock 3.3.0", "async-task", "futures-io", "futures-lite 2.3.0", "piper", ] +[[package]] +name = "blst" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62dc83a094a71d43eeadd254b1ec2d24cb6a0bb6cadce00df51f0db594711a32" +dependencies = [ + "cc", + "glob", + "threadpool", + "zeroize", +] + [[package]] name = "brotli" -version = "3.5.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d640d25bc63c50fb1f0b545ffd80207d2e10a4c965530809b40ba3386825c391" +checksum = "74f7971dbd9326d58187408ab83117d8ac1bb9c17b085fdacd1cf2f598719b6b" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -837,9 +1400,9 @@ dependencies = [ [[package]] name = "brotli-decompressor" -version = "2.5.1" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e2e4afe60d7dd600fdd3de8d0f08c2b7ec039712e3b6137ff98b7004e82de4f" +checksum = "9a45bd2e4095a8b518033b128020dd4a55aab1c0a381ba4404a472630f4bc362" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -881,6 +1444,20 @@ dependencies = [ "bytes", ] +[[package]] +name = "c-kzg" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdf100c4cea8f207e883ff91ca886d621d8a166cb04971dfaa9bb8fd99ed95df" +dependencies = [ + "blst", + "cc", + "glob", + "hex", + "libc", + "serde", +] + [[package]] name = "cbc" version = "0.1.2" @@ -892,9 +1469,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.97" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099a5357d84c4c61eb35fc8eafa9a79a902c2f76911e5747ced4e032edd8d9b4" +checksum = "96c51067fd44124faa7f870b4b1c969379ad32b2ba805aa959430ceaa384f695" dependencies = [ "jobserver", "libc", @@ -970,9 +1547,9 @@ dependencies = [ [[package]] name = "clang-sys" -version = "1.7.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67523a3b4be3ce1989d607a828d036249522dd9c1c8de7f4dd2dae43a37369d1" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" dependencies = [ "glob", "libc", @@ -981,9 +1558,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.4" +version = "4.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" +checksum = "5db83dced34638ad474f39f250d7fea9598bdd239eaced1bdf45d597da0f433f" dependencies = [ "clap_builder", "clap_derive", @@ -991,9 +1568,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.2" +version = "4.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" +checksum = "f7e204572485eb3fbf28f871612191521df159bc3e15a9f5064c66dba3a8c05f" dependencies = [ "anstream", "anstyle", @@ -1003,21 +1580,21 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.4" +version = "4.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" +checksum = "c780290ccf4fb26629baa7a1081e68ced113f1d3ec302fa5948f1c381ebf06c6" dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.66", ] [[package]] name = "clap_lex" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" +checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70" [[package]] name = "cmake" @@ -1056,16 +1633,18 @@ checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" name = "common" version = "0.1.0" dependencies = [ + "alloy", "anyhow", + "async-stream", "clap", "evm_arithmetization", + "futures", "plonky2", "proof_gen", - "seahash", "serde", "serde_json", "thiserror", - "trace_decoder", + "tokio", "tracing", ] @@ -1078,6 +1657,19 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "const-hex" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94fb8a24a26d37e1ffd45343323dc9fe6654ceea44c12f2fcb3d7ac29e610bc6" +dependencies = [ + "cfg-if", + "cpufeatures", + "hex", + "proptest", + "serde", +] + [[package]] name = "const-oid" version = "0.9.6" @@ -1133,6 +1725,7 @@ version = "0.1.0" dependencies = [ "actix-rt", "actix-web", + "alloy", "anyhow", "async-channel", "chrono", @@ -1152,6 +1745,7 @@ dependencies = [ "tokio", "tracing", "tracing-subscriber", + "url", ] [[package]] @@ -1181,9 +1775,9 @@ dependencies = [ [[package]] name = "crc32fast" -version = "1.4.0" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" dependencies = [ "cfg-if", ] @@ -1209,9 +1803,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.12" +version = "0.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab3db02a9c5b5121e1e42fbdb1aeb65f5e02624cc58c43f2884c6ccac0b82f95" +checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" dependencies = [ "crossbeam-utils", ] @@ -1256,9 +1850,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.19" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" [[package]] name = "crunchy" @@ -1266,6 +1860,18 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -1297,7 +1903,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.63", + "syn 2.0.66", ] [[package]] @@ -1308,7 +1914,7 @@ checksum = "733cabb43482b1a1b53eee8583c2b9e8684d592215ea83efd305dd31bc2f0178" dependencies = [ "darling_core", "quote", - "syn 2.0.63", + "syn 2.0.66", ] [[package]] @@ -1365,7 +1971,7 @@ checksum = "5fe87ce4529967e0ba1dcf8450bab64d97dfd5010a6256187ffe2e43e6f0e049" dependencies = [ "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.66", ] [[package]] @@ -1378,6 +1984,17 @@ dependencies = [ "serde", ] +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "derive_more" version = "0.99.17" @@ -1387,7 +2004,7 @@ dependencies = [ "convert_case", "proc-macro2", "quote", - "rustc_version", + "rustc_version 0.4.0", "syn 1.0.109", ] @@ -1416,6 +2033,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer 0.10.4", + "const-oid", "crypto-common", "subtle", ] @@ -1428,7 +2046,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.66", ] [[package]] @@ -1449,11 +2067,44 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest 0.10.7", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + [[package]] name = "either" -version = "1.11.0" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" + +[[package]] +name = "elliptic-curve" +version = "0.13.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest 0.10.7", + "ff", + "generic-array", + "group", + "pkcs8", + "rand_core", + "sec1", + "subtle", + "zeroize", +] [[package]] name = "embedded-io" @@ -1479,7 +2130,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.66", ] [[package]] @@ -1490,7 +2141,7 @@ checksum = "6fd000fd6988e73bbe993ea3db9b1aa64906ab88766d654973924340c8cddb42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.66", ] [[package]] @@ -1574,50 +2225,29 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] name = "event-listener" -version = "4.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67b215c49b2b248c855fb73579eb1f4f26c38ffdc12973e20e07b91d78d5646e" -dependencies = [ - "concurrent-queue", - "parking", - "pin-project-lite", -] - -[[package]] -name = "event-listener" -version = "5.3.0" +version = "5.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d9944b8ca13534cdfb2800775f8dd4902ff3fc75a50101466decadfdf322a24" +checksum = "6032be9bd27023a771701cc49f9f053c751055f71efb2e0ae5c15809093675ba" dependencies = [ "concurrent-queue", "parking", "pin-project-lite", ] -[[package]] -name = "event-listener-strategy" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "958e4d70b6d5e81971bebec42271ec641e7ff4e170a6fa605f2b8a8b65cb97d3" -dependencies = [ - "event-listener 4.0.3", - "pin-project-lite", -] - [[package]] name = "event-listener-strategy" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f214dc438f977e6d4e3500aaa277f5ad94ca83fbbd9b1a15713ce2344ccc5a1" dependencies = [ - "event-listener 5.3.0", + "event-listener 5.3.1", "pin-project-lite", ] [[package]] name = "evm_arithmetization" -version = "0.1.3" -source = "git+https://github.com/0xPolygonZero/zk_evm.git?tag=v0.3.1#c55f9e05f571b1b8658315e6de83427fe1d4efa3" +version = "0.2.0" +source = "git+https://github.com/0xPolygonZero/zk_evm.git?tag=v0.4.0#46eb449a5a97438ade3f22e2555d7f266b54b290" dependencies = [ "anyhow", "bytes", @@ -1673,6 +2303,27 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" +[[package]] +name = "fastrlp" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139834ddba373bbdd213dffe02c8d110508dcf1726c2be27e8d1f7d7e1856418" +dependencies = [ + "arrayvec", + "auto_impl", + "bytes", +] + +[[package]] +name = "ff" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +dependencies = [ + "rand_core", + "subtle", +] + [[package]] name = "fixed-hash" version = "0.7.0" @@ -1847,7 +2498,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.66", ] [[package]] @@ -1886,6 +2537,12 @@ dependencies = [ "slab", ] +[[package]] +name = "futures-utils-wasm" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42012b0f064e01aa58b545fe3727f90f7dd4020f4a3ea735b50344965f5a57e9" + [[package]] name = "gascalc" version = "0.1.0" @@ -1902,6 +2559,7 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", ] [[package]] @@ -1919,9 +2577,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.28.1" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" [[package]] name = "glob" @@ -1941,7 +2599,7 @@ dependencies = [ "google-cloud-token", "home", "jsonwebtoken", - "reqwest", + "reqwest 0.11.27", "serde", "serde_json", "thiserror", @@ -1957,7 +2615,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc279bfb50487d7bcd900e8688406475fc750fe474a835b2ab9ade9eb1fc90e2" dependencies = [ - "reqwest", + "reqwest 0.11.27", "thiserror", "tokio", ] @@ -1982,7 +2640,7 @@ dependencies = [ "percent-encoding", "pkcs8", "regex", - "reqwest", + "reqwest 0.11.27", "reqwest-middleware", "ring", "serde", @@ -2004,6 +2662,17 @@ dependencies = [ "async-trait", ] +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + [[package]] name = "h2" version = "0.3.26" @@ -2092,7 +2761,7 @@ checksum = "cdc6457c0eb62c71aac4bc17216026d8410337c4126773b9c5daba343f17964f" dependencies = [ "atomic-polyfill", "hash32", - "rustc_version", + "rustc_version 0.4.0", "serde", "spin", "stable_deref_trait", @@ -2121,6 +2790,9 @@ name = "hex" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +dependencies = [ + "serde", +] [[package]] name = "hex-literal" @@ -2191,12 +2863,12 @@ dependencies = [ [[package]] name = "http-body-util" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" dependencies = [ "bytes", - "futures-core", + "futures-util", "http 1.1.0", "http-body 1.0.0", "pin-project-lite", @@ -2204,9 +2876,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.8.0" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +checksum = "d0e7a4dd27b9476dc40cb050d3632d3bba3a70ddbff012285f7f8559a1e7e545" [[package]] name = "httpdate" @@ -2222,9 +2894,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.28" +version = "0.14.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" +checksum = "f361cde2f109281a220d4307746cdfd5ee3f410da58a70377762396775634b33" dependencies = [ "bytes", "futures-channel", @@ -2261,42 +2933,46 @@ dependencies = [ "pin-project-lite", "smallvec", "tokio", + "want", ] [[package]] -name = "hyper-rustls" -version = "0.24.2" +name = "hyper-tls" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ - "futures-util", - "http 0.2.12", - "hyper 0.14.28", - "rustls 0.21.12", + "bytes", + "hyper 0.14.29", + "native-tls", "tokio", - "tokio-rustls", + "tokio-native-tls", ] [[package]] name = "hyper-tls" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", - "hyper 0.14.28", + "http-body-util", + "hyper 1.3.1", + "hyper-util", "native-tls", "tokio", "tokio-native-tls", + "tower-service", ] [[package]] name = "hyper-util" -version = "0.1.3" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" +checksum = "7b875924a60b96e5d7b9ae7b066540b1dd1cbd90d1828f54c92e02a283351c56" dependencies = [ "bytes", + "futures-channel", "futures-util", "http 1.1.0", "http-body 1.0.0", @@ -2304,6 +2980,9 @@ dependencies = [ "pin-project-lite", "socket2 0.5.7", "tokio", + "tower", + "tower-service", + "tracing", ] [[package]] @@ -2329,6 +3008,124 @@ dependencies = [ "cc", ] +[[package]] +name = "icu_collections" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_properties" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f8ac670d7422d7f76b32e17a5db556510825b29ec9154f235977c9caba61036" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + [[package]] name = "ident_case" version = "1.0.1" @@ -2347,12 +3144,14 @@ dependencies = [ [[package]] name = "idna" -version = "0.5.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +checksum = "4716a3a0933a1d01c2f72450e89596eb51dd34ef3c211ccd875acdf1f8fe47ed" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "icu_normalizer", + "icu_properties", + "smallvec", + "utf8_iter", ] [[package]] @@ -2438,9 +3237,9 @@ dependencies = [ [[package]] name = "instant" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" dependencies = [ "cfg-if", ] @@ -2488,6 +3287,15 @@ version = "1.70.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + [[package]] name = "itertools" version = "0.11.0" @@ -2506,6 +3314,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.11" @@ -2580,6 +3397,19 @@ dependencies = [ "simple_asn1", ] +[[package]] +name = "k256" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2", +] + [[package]] name = "keccak" version = "0.1.5" @@ -2589,6 +3419,16 @@ dependencies = [ "cpufeatures", ] +[[package]] +name = "keccak-asm" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47a3633291834c4fbebf8673acbc1b04ec9d151418ff9b8e26dcd79129928758" +dependencies = [ + "digest 0.10.7", + "sha3-asm", +] + [[package]] name = "keccak-hash" version = "0.8.0" @@ -2653,12 +3493,13 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" name = "leader" version = "0.1.0" dependencies = [ + "alloy", "anyhow", "axum", "clap", "common", "dotenvy", - "ethereum-types", + "futures", "ops", "paladin-core", "proof_gen", @@ -2675,9 +3516,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.154" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libloading" @@ -2689,24 +3530,30 @@ dependencies = [ "windows-targets 0.52.5", ] +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + [[package]] name = "linkme" -version = "0.3.26" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "833222afbfe72868ac8f9770c91a33673f0d5fefc37c9dbe94aa3548b571623f" +checksum = "ccb76662d78edc9f9bf56360d6919bdacc8b7761227727e5082f128eeb90bbf5" dependencies = [ "linkme-impl", ] [[package]] name = "linkme-impl" -version = "0.3.26" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39f0dea92dbea3271557cc2e1848723967bba81f722f95026860974ec9283f08" +checksum = "f8dccda732e04fa3baf2e17cf835bfe2601c7c2edafd64417c627dabae3a8cda" dependencies = [ "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.66", ] [[package]] @@ -2717,9 +3564,15 @@ checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "linux-raw-sys" -version = "0.4.13" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + +[[package]] +name = "litemap" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" +checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704" [[package]] name = "local-channel" @@ -2755,6 +3608,15 @@ version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +[[package]] +name = "lru" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3262e75e648fce39813cb56ac41f3c3e3f65217ebf3844d818d1f9398cfb0dc" +dependencies = [ + "hashbrown 0.14.5", +] + [[package]] name = "matchers" version = "0.1.0" @@ -2800,9 +3662,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" +checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae" dependencies = [ "adler", ] @@ -2827,8 +3689,8 @@ checksum = "c9be0862c1b3f26a88803c4a49de6889c10e608b3ee9344e6ef5b45fb37ad3d1" [[package]] name = "mpt_trie" -version = "0.2.1" -source = "git+https://github.com/0xPolygonZero/zk_evm.git?tag=v0.3.1#c55f9e05f571b1b8658315e6de83427fe1d4efa3" +version = "0.3.0" +source = "git+https://github.com/0xPolygonZero/zk_evm.git?tag=v0.4.0#46eb449a5a97438ade3f22e2555d7f266b54b290" dependencies = [ "bytes", "enum-as-inner", @@ -2851,11 +3713,10 @@ dependencies = [ [[package]] name = "native-tls" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" dependencies = [ - "lazy_static", "libc", "log", "openssl", @@ -2966,6 +3827,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", + "libm", ] [[package]] @@ -2978,11 +3840,31 @@ dependencies = [ "libc", ] +[[package]] +name = "num_enum" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845" +dependencies = [ + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + [[package]] name = "object" -version = "0.32.2" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +checksum = "576dfe1fc8f9df304abb159d767a29d0476f7750fbf8aa7ad07816004a207434" dependencies = [ "memchr", ] @@ -3031,7 +3913,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.66", ] [[package]] @@ -3057,14 +3939,11 @@ name = "ops" version = "0.1.0" dependencies = [ "common", - "ethereum-types", "evm_arithmetization", "keccak-hash 0.10.0", "paladin-core", "proof_gen", - "rlp", "serde", - "trace_decoder", "tracing", ] @@ -3076,9 +3955,9 @@ checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "p12-keystore" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbd7792ed56836118732faffa19b8c2bb20d5f3ff8b403002cd817d6c4ffc96c" +checksum = "df7b60d0b2dcace322e6e8c4499c4c8bdf331c1bae046a54be5e4191c3610286" dependencies = [ "cbc", "cms", @@ -3136,7 +4015,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af25dcb10b7c0ce99abee8694e2e79e4787d7f778b9339dc5a50ba6fc45e5cc9" dependencies = [ "quote", - "syn 2.0.63", + "syn 2.0.66", ] [[package]] @@ -3173,9 +4052,9 @@ checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" [[package]] name = "parking_lot" -version = "0.12.2" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" dependencies = [ "lock_api", "parking_lot_core", @@ -3266,7 +4145,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.66", ] [[package]] @@ -3297,7 +4176,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.66", ] [[package]] @@ -3326,9 +4205,9 @@ dependencies = [ [[package]] name = "piper" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "464db0c665917b13ebb5d453ccdec4add5658ee1adc7affc7677615356a8afaf" +checksum = "ae1d5c74c9876f070d3e8fd503d748c7d974c3e48da8f41350fa5222ef9b4391" dependencies = [ "atomic-waker", "fastrand 2.1.0", @@ -3455,9 +4334,9 @@ dependencies = [ [[package]] name = "polling" -version = "3.7.0" +version = "3.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645493cf344456ef24219d02a768cf1fb92ddf8c92161679ae3d91b91a637be3" +checksum = "5e6a007746f34ed64099e88783b0ae369eaa3da6392868ba262e2af9b8fbaea1" dependencies = [ "cfg-if", "concurrent-queue", @@ -3499,7 +4378,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" dependencies = [ "proc-macro2", - "syn 2.0.63", + "syn 2.0.66", ] [[package]] @@ -3534,19 +4413,43 @@ dependencies = [ "toml_edit 0.21.1", ] +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + [[package]] name = "proc-macro2" -version = "1.0.82" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" +checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23" dependencies = [ "unicode-ident", ] [[package]] name = "proof_gen" -version = "0.1.3" -source = "git+https://github.com/0xPolygonZero/zk_evm.git?tag=v0.3.1#c55f9e05f571b1b8658315e6de83427fe1d4efa3" +version = "0.2.0" +source = "git+https://github.com/0xPolygonZero/zk_evm.git?tag=v0.4.0#46eb449a5a97438ade3f22e2555d7f266b54b290" dependencies = [ "ethereum-types", "evm_arithmetization", @@ -3556,21 +4459,52 @@ dependencies = [ "serde", ] +[[package]] +name = "proptest" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf" +dependencies = [ + "bit-set", + "bit-vec", + "bitflags 2.5.0", + "lazy_static", + "num-traits", + "rand", + "rand_chacha", + "rand_xorshift", + "regex-syntax 0.8.4", + "rusty-fork", + "tempfile", + "unarray", +] + [[package]] name = "prover" version = "0.1.0" dependencies = [ + "alloy", "anyhow", - "ethereum-types", + "chrono", + "common", "futures", + "num-traits", "ops", "paladin-core", "proof_gen", + "ruint", "serde", + "tokio", "trace_decoder", "tracing", ] +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + [[package]] name = "quote" version = "1.0.36" @@ -3616,6 +4550,15 @@ dependencies = [ "getrandom", ] +[[package]] +name = "rand_xorshift" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" +dependencies = [ + "rand_core", +] + [[package]] name = "rayon" version = "1.10.0" @@ -3667,14 +4610,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.4" +version = "1.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" +checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.6", - "regex-syntax 0.8.3", + "regex-automata 0.4.7", + "regex-syntax 0.8.4", ] [[package]] @@ -3688,15 +4631,21 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.3", + "regex-syntax 0.8.4", ] +[[package]] +name = "regex-lite" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53a49587ad06b26609c52e423de037e7f57f20d53535d66e08c695f347df952a" + [[package]] name = "regex-syntax" version = "0.6.29" @@ -3705,9 +4654,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "reqwest" @@ -3723,37 +4672,72 @@ dependencies = [ "h2", "http 0.2.12", "http-body 0.4.6", - "hyper 0.14.28", - "hyper-rustls", - "hyper-tls", + "hyper 0.14.29", + "hyper-tls 0.5.0", + "ipnet", + "js-sys", + "log", + "mime", + "mime_guess", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls-pemfile 1.0.4", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper 0.1.2", + "system-configuration", + "tokio", + "tokio-native-tls", + "tokio-util", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-streams", + "web-sys", + "winreg 0.50.0", +] + +[[package]] +name = "reqwest" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10" +dependencies = [ + "base64 0.22.1", + "bytes", + "futures-core", + "futures-util", + "http 1.1.0", + "http-body 1.0.0", + "http-body-util", + "hyper 1.3.1", + "hyper-tls 0.6.0", + "hyper-util", "ipnet", "js-sys", "log", "mime", - "mime_guess", "native-tls", "once_cell", "percent-encoding", "pin-project-lite", - "rustls 0.21.12", - "rustls-pemfile 1.0.4", + "rustls-pemfile 2.1.2", "serde", "serde_json", "serde_urlencoded", "sync_wrapper 0.1.2", - "system-configuration", "tokio", "tokio-native-tls", - "tokio-rustls", - "tokio-util", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", - "wasm-streams", "web-sys", - "webpki-roots", - "winreg", + "winreg 0.52.0", ] [[package]] @@ -3765,12 +4749,22 @@ dependencies = [ "anyhow", "async-trait", "http 0.2.12", - "reqwest", + "reqwest 0.11.27", "serde", "task-local-extensions", "thiserror", ] +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + [[package]] name = "ring" version = "0.17.8" @@ -3811,27 +4805,57 @@ dependencies = [ name = "rpc" version = "0.1.0" dependencies = [ + "alloy", "anyhow", "clap", "common", - "ethereum-types", "evm_arithmetization", "futures", "hex", "hex-literal", - "log", + "itertools 0.13.0", + "primitive-types 0.12.2", "prover", - "reqwest", "serde", "serde_json", - "serde_path_to_error", "thiserror", "tokio", "trace_decoder", "tracing", "tracing-subscriber", + "url", +] + +[[package]] +name = "ruint" +version = "1.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c3cc4c2511671f327125da14133d0c5c5d137f006a1017a16f557bc85b16286" +dependencies = [ + "alloy-rlp", + "ark-ff 0.3.0", + "ark-ff 0.4.2", + "bytes", + "fastrlp", + "num-bigint", + "num-traits", + "parity-scale-codec", + "primitive-types 0.12.2", + "proptest", + "rand", + "rlp", + "ruint-macro", + "serde", + "valuable", + "zeroize", ] +[[package]] +name = "ruint-macro" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48fd7bd8a6377e15ad9d42a8ec25371b94ddc67abe7c8b9127bec79bebaaae18" + [[package]] name = "rustc-demangle" version = "0.1.24" @@ -3850,13 +4874,22 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" +[[package]] +name = "rustc_version" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" +dependencies = [ + "semver 0.11.0", +] + [[package]] name = "rustc_version" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver", + "semver 1.0.23", ] [[package]] @@ -3891,33 +4924,21 @@ dependencies = [ "bitflags 2.5.0", "errno", "libc", - "linux-raw-sys 0.4.13", + "linux-raw-sys 0.4.14", "windows-sys 0.52.0", ] [[package]] name = "rustls" -version = "0.21.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" -dependencies = [ - "log", - "ring", - "rustls-webpki 0.101.7", - "sct", -] - -[[package]] -name = "rustls" -version = "0.23.5" +version = "0.23.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afabcee0551bd1aa3e18e5adbf2c0544722014b899adb31bd186ec638d3da97e" +checksum = "a218f0f6d05669de4eabfb24f31ce802035c952429d037507b4a4a39f0e60c5b" dependencies = [ "aws-lc-rs", "log", "once_cell", "rustls-pki-types", - "rustls-webpki 0.102.3", + "rustls-webpki", "subtle", "zeroize", ] @@ -3929,10 +4950,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "727a826801254b6cfcd2508a0508c01b7c1bca21d3673e84d86da084781b83d5" dependencies = [ "log", - "rustls 0.23.5", + "rustls", "rustls-native-certs", "rustls-pki-types", - "rustls-webpki 0.102.3", + "rustls-webpki", ] [[package]] @@ -3975,19 +4996,9 @@ checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" [[package]] name = "rustls-webpki" -version = "0.101.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" -dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "rustls-webpki" -version = "0.102.3" +version = "0.102.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3bce581c0dd41bce533ce695a1437fa16a7ab5ac3ccfa99fe1a620a7885eabf" +checksum = "ff448f7e92e913c4b7d4c6d8e4540a1724b319b4152b8aef6d4cf8339712b33e" dependencies = [ "aws-lc-rs", "ring", @@ -4001,6 +5012,18 @@ version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" +[[package]] +name = "rusty-fork" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f" +dependencies = [ + "fnv", + "quick-error", + "tempfile", + "wait-timeout", +] + [[package]] name = "ryu" version = "1.0.18" @@ -4043,21 +5066,19 @@ dependencies = [ ] [[package]] -name = "sct" -version = "0.7.1" +name = "sec1" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" dependencies = [ - "ring", - "untrusted", + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", ] -[[package]] -name = "seahash" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" - [[package]] name = "secp256k1" version = "0.27.0" @@ -4099,30 +5120,48 @@ dependencies = [ "libc", ] +[[package]] +name = "semver" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" +dependencies = [ + "semver-parser", +] + [[package]] name = "semver" version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" +[[package]] +name = "semver-parser" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" +dependencies = [ + "pest", +] + [[package]] name = "serde" -version = "1.0.202" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.202" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.66", ] [[package]] @@ -4194,7 +5233,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.66", ] [[package]] @@ -4242,6 +5281,16 @@ dependencies = [ "keccak", ] +[[package]] +name = "sha3-asm" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9b57fd861253bff08bb1919e995f90ba8f4889de2726091c8876f3a4e823b40" +dependencies = [ + "cc", + "cfg-if", +] + [[package]] name = "sharded-slab" version = "0.1.7" @@ -4266,6 +5315,16 @@ dependencies = [ "libc", ] +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest 0.10.7", + "rand_core", +] + [[package]] name = "simple_asn1" version = "0.6.2" @@ -4382,6 +5441,28 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +[[package]] +name = "strum" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d8cec3501a5194c432b2b7976db6b7d10ec95c253208b45f83f7136aa985e29" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.66", +] + [[package]] name = "subtle" version = "2.5.0" @@ -4401,15 +5482,27 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.63" +version = "2.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf5be731623ca1a1fb7d8be6f261a3be6d3e2337b8a1f97be944d020c8fcb704" +checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] +[[package]] +name = "syn-solidity" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d71e19bca02c807c9faa67b5a47673ff231b6e7449b251695188522f1dc44b2" +dependencies = [ + "paste", + "proc-macro2", + "quote", + "syn 2.0.66", +] + [[package]] name = "sync_wrapper" version = "0.1.2" @@ -4430,7 +5523,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.66", ] [[package]] @@ -4504,22 +5597,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.60" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "579e9083ca58dd9dcf91a9923bb9054071b9ebbd800b342194c9feb0ee89fc18" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.60" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2470041c06ec3ac1ab38d0356a6119054dedaea53e12fbefc0de730a1c08524" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.66", ] [[package]] @@ -4532,6 +5625,15 @@ dependencies = [ "once_cell", ] +[[package]] +name = "threadpool" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" +dependencies = [ + "num_cpus", +] + [[package]] name = "time" version = "0.3.36" @@ -4572,6 +5674,16 @@ dependencies = [ "crunchy", ] +[[package]] +name = "tinystr" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +dependencies = [ + "displaydoc", + "zerovec", +] + [[package]] name = "tinyvec" version = "1.6.0" @@ -4589,9 +5701,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.37.0" +version = "1.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" +checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" dependencies = [ "backtrace", "bytes", @@ -4619,13 +5731,13 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" +checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.66", ] [[package]] @@ -4652,16 +5764,6 @@ dependencies = [ "tokio-stream", ] -[[package]] -name = "tokio-rustls" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" -dependencies = [ - "rustls 0.21.12", - "tokio", -] - [[package]] name = "tokio-stream" version = "0.1.15" @@ -4671,6 +5773,7 @@ dependencies = [ "futures-core", "pin-project-lite", "tokio", + "tokio-util", ] [[package]] @@ -4689,14 +5792,14 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.13" +version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4e43f8cc456c9704c851ae29c67e17ef65d2c30017c17a9765b89c382dc8bba" +checksum = "6f49eb2ab21d2f26bd6db7bf383edc527a7ebaee412d17af4d40fdccd442f335" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.13", + "toml_edit 0.22.14", ] [[package]] @@ -4721,15 +5824,15 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.13" +version = "0.22.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c127785850e8c20836d49732ae6abfa47616e60bf9d9f57c43c250361a9db96c" +checksum = "f21c7aaf97f1bd9ca9d4f9e73b0a6c74bd5afef56f2bc931943a6e1c37e04e38" dependencies = [ "indexmap 2.2.6", "serde", "serde_spanned", "toml_datetime", - "winnow 0.6.8", + "winnow 0.6.13", ] [[package]] @@ -4762,8 +5865,8 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "trace_decoder" -version = "0.3.1" -source = "git+https://github.com/0xPolygonZero/zk_evm.git?tag=v0.3.1#c55f9e05f571b1b8658315e6de83427fe1d4efa3" +version = "0.4.0" +source = "git+https://github.com/0xPolygonZero/zk_evm.git?tag=v0.4.0#46eb449a5a97438ade3f22e2555d7f266b54b290" dependencies = [ "bytes", "ciborium", @@ -4804,7 +5907,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.66", ] [[package]] @@ -4876,6 +5979,12 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + [[package]] name = "unicase" version = "2.7.0" @@ -4924,12 +6033,12 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +checksum = "f7c25da092f0a868cdf09e8674cd3b7ef3a7d92a24253e663a2fb85e2496de56" dependencies = [ "form_urlencoded", - "idna 0.5.0", + "idna 1.0.0", "percent-encoding", ] @@ -4939,11 +6048,23 @@ version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + [[package]] name = "utf8parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" @@ -4990,6 +6111,15 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "wait-timeout" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" +dependencies = [ + "libc", +] + [[package]] name = "waker-fn" version = "1.2.0" @@ -5032,7 +6162,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.66", "wasm-bindgen-shared", ] @@ -5066,7 +6196,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.66", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -5132,7 +6262,7 @@ dependencies = [ "once_cell", "parking_lot", "pin-project", - "reqwest", + "reqwest 0.11.27", "rlp", "secp256k1", "serde", @@ -5158,12 +6288,6 @@ dependencies = [ "url", ] -[[package]] -name = "webpki-roots" -version = "0.25.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" - [[package]] name = "which" version = "4.4.2" @@ -5366,9 +6490,9 @@ dependencies = [ [[package]] name = "winnow" -version = "0.6.8" +version = "0.6.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c52e9c97a68071b23e836c9380edae937f17b9c4667bd021973efc689f618d" +checksum = "59b5e5f6c299a3c7890b876a2a587f3115162487e704907d9b6cd29473052ba1" dependencies = [ "memchr", ] @@ -5383,6 +6507,16 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "winreg" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + [[package]] name = "worker" version = "0.1.0" @@ -5399,6 +6533,18 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + [[package]] name = "wyz" version = "0.5.1" @@ -5436,6 +6582,30 @@ dependencies = [ "time", ] +[[package]] +name = "yoke" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", + "synstructure", +] + [[package]] name = "zerocopy" version = "0.7.34" @@ -5453,14 +6623,71 @@ checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.66", +] + +[[package]] +name = "zerofrom" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", + "synstructure", ] [[package]] name = "zeroize" -version = "1.7.0" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "zerovec" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb2cc8827d6c0994478a15c53f374f46fbd41bea663d809b14744bc42e6b109c" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +checksum = "97cf56601ee5052b4417d90c8755c6683473c926039908196cf35d99f893ebe7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] [[package]] name = "zstd" diff --git a/Cargo.toml b/Cargo.toml index cb62eebd..16738895 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,20 +10,25 @@ tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } clap = { version = "4.4.6", features = ["derive", "env"] } tokio = { version = "1.33.0", features = ["full"] } -serde = "1.0.183" +serde = {version = "1.0.183", features=["derive"]} serde_path_to_error = "0.1.14" serde_json = "1.0.107" -ethereum-types = "0.14.1" thiserror = "1.0.50" futures = "0.3.29" -rlp = "0.5.2" keccak-hash = "0.10.0" +alloy = { git = "https://github.com/alloy-rs/alloy", features = [ + "rpc-types-eth", + "providers", + "transports", + "transport-http", +] } +chrono = "0.4.38" # zk-evm dependencies plonky2 = "0.2.2" -evm_arithmetization = { git = "https://github.com/0xPolygonZero/zk_evm.git", tag = "v0.3.1" } -trace_decoder = { git = "https://github.com/0xPolygonZero/zk_evm.git", tag = "v0.3.1" } -proof_gen = { git = "https://github.com/0xPolygonZero/zk_evm.git", tag = "v0.3.1" } +evm_arithmetization = { git = "https://github.com/0xPolygonZero/zk_evm.git", tag = "v0.4.0" } +trace_decoder = { git = "https://github.com/0xPolygonZero/zk_evm.git", tag = "v0.4.0" } +proof_gen = { git = "https://github.com/0xPolygonZero/zk_evm.git", tag = "v0.4.0" } # GCP benchmark test dependencies google-cloud-storage = "0.16.0" diff --git a/README.md b/README.md index d826ab96..7ba9ad2f 100644 --- a/README.md +++ b/README.md @@ -385,16 +385,16 @@ A few other notes: ### Generating Witnesses Only -If you want to test a block without the high CPU & memory requirements that come with creating a full proof, you can instead generate only the witness using `tools/debug_block.sh`: +If you want to test a block without the high CPU & memory requirements that come with creating a full proof, you can instead generate only the witness using `tools/prove_blocks.sh` in the `test_only` mode: ```sh -./debug_block.sh +./prove_blocks.sh test_only ``` Filled in: ```sh -./debug_block.sh 18299898 http://34.89.57.138:8545 +./prove_blocks.sh 18299898 18299899 http://34.89.57.138:8545 true test_only ``` Finally, note that both of these testing scripts force proof generation to be sequential by allowing only one worker. Because of this, this is not a realistic representation of performance but makes the debugging logs much easier to follow. diff --git a/common/Cargo.toml b/common/Cargo.toml index 9a08bbd1..67989744 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -16,7 +16,9 @@ plonky2 = { workspace = true } evm_arithmetization = { workspace = true } clap = { workspace = true } anyhow = { workspace = true } -trace_decoder = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } -seahash = "4.1.0" +futures = { workspace = true } +tokio = { workspace = true } +alloy = { workspace = true } +async-stream = "0.3.5" diff --git a/common/src/block_interval.rs b/common/src/block_interval.rs new file mode 100644 index 00000000..5d0e3c1e --- /dev/null +++ b/common/src/block_interval.rs @@ -0,0 +1,272 @@ +use alloy::primitives::B256; +use alloy::rpc::types::eth::BlockId; +use alloy::{hex, providers::Provider, transports::Transport}; +use anyhow::{anyhow, Result}; +use async_stream::try_stream; +use futures::Stream; +use tracing::info; + +use crate::parsing; + +const DEFAULT_BLOCK_TIME: u64 = 1000; + +/// Range of blocks to be processed and proven. +#[derive(Debug, PartialEq, Clone)] +pub enum BlockInterval { + // A single block id (could be number or hash) + SingleBlockId(BlockId), + // A range of blocks. + Range(std::ops::Range), + // Dynamic interval from the start block to the latest network block + FollowFrom { + // Interval starting block number + start_block: u64, + // Block time specified in milliseconds. + // If not set, use the default block time to poll node. + block_time: Option, + }, +} + +impl BlockInterval { + /// Create a new block interval + /// + /// A valid block range is of the form: + /// * `block_number` for a single block number + /// * `lhs..rhs`, `lhs..=rhs` as an exclusive/inclusive range + /// * `lhs..` for a range starting from `lhs` to the chain tip. `lhs..=` + /// is also valid format. + /// + /// # Example + /// + /// ```rust + /// # use alloy::rpc::types::eth::BlockId; + /// # use common::block_interval::BlockInterval; + /// assert_eq!(BlockInterval::new("0..10").unwrap(), BlockInterval::Range(0..10)); + /// assert_eq!(BlockInterval::new("0..=10").unwrap(), BlockInterval::Range(0..11)); + /// assert_eq!(BlockInterval::new("32141").unwrap(), BlockInterval::SingleBlockId(BlockId::Number(32141.into()))); + /// assert_eq!(BlockInterval::new("100..").unwrap(), BlockInterval::FollowFrom{start_block: 100, block_time: None}); + /// ``` + pub fn new(s: &str) -> anyhow::Result { + if (s.starts_with("0x") && s.len() == 66) || s.len() == 64 { + // Try to parse hash + let hash = s + .parse::() + .map_err(|_| anyhow!("invalid block hash '{s}'"))?; + return Ok(BlockInterval::SingleBlockId(BlockId::Hash(hash.into()))); + } + + // First we parse for inclusive range and then for exclusive range, + // because both separators start with `..` + if let Ok(range) = parsing::parse_range_inclusive(s) { + Ok(BlockInterval::Range(range)) + } else if let Ok(range) = parsing::parse_range_exclusive(s) { + Ok(BlockInterval::Range(range)) + } + // Now we look for the follow from range + else if s.contains("..") { + let mut split = s.trim().split("..").filter(|s| *s != "=" && !s.is_empty()); + + // Any other character after `..` or `..=` is invalid + if split.clone().count() > 1 { + return Err(anyhow!("invalid block interval range '{s}'")); + } + let num = split + .next() + .map(|num| { + num.parse::() + .map_err(|_| anyhow!("invalid block number '{num}'")) + }) + .ok_or(anyhow!("invalid block interval range '{s}'"))??; + return Ok(BlockInterval::FollowFrom { + start_block: num, + block_time: None, + }); + } + // Only single block number is left to try to parse + else { + let num: u64 = s + .trim() + .parse() + .map_err(|_| anyhow!("invalid block interval range '{s}'"))?; + return Ok(BlockInterval::SingleBlockId(BlockId::Number(num.into()))); + } + } + + /// Convert the block interval into an async stream of block numbers. + pub fn into_bounded_stream(self) -> anyhow::Result> { + match self { + BlockInterval::SingleBlockId(BlockId::Number(num)) => { + let num = num + .as_number() + .ok_or(anyhow!("invalid block number '{num}'"))?; + Ok(futures::stream::iter(num..num + 1)) + } + BlockInterval::Range(range) => Ok(futures::stream::iter(range)), + _ => Err(anyhow!( + "could not create bounded stream from unbounded follow-from interval", + )), + } + } + + /// Convert the block interval into an unbounded async stream of block + /// numbers. Query the blockchain node for the latest block number. + pub async fn into_unbounded_stream( + self, + provider: ProviderT, + ) -> Result>, anyhow::Error> + where + ProviderT: Provider, + TransportT: Transport + Clone, + { + match self { + BlockInterval::FollowFrom { + start_block, + block_time, + } => Ok(try_stream! { + let mut current = start_block; + loop { + let last_block_number = provider.get_block_number().await.map_err(|e: alloy::transports::RpcError<_>| { + anyhow!("could not retrieve latest block number from the provider: {e}") + })?; + + if current < last_block_number { + current += 1; + yield current; + } else { + info!("Waiting for the new blocks to be mined, requested block number: {current}, \ + latest block number: {last_block_number}"); + let block_time = block_time.unwrap_or(DEFAULT_BLOCK_TIME); + // No need to poll the node too frequently, waiting + // a block time interval for a block to be mined should be enough + tokio::time::sleep(tokio::time::Duration::from_millis(block_time)).await; + } + } + }), + _ => Err(anyhow!( + "could not create unbounded follow-from stream from fixed bounded interval", + )), + } + } +} + +impl std::fmt::Display for BlockInterval { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + match self { + BlockInterval::SingleBlockId(block_id) => match block_id { + BlockId::Number(it) => f.write_fmt(format_args!("{}", it)), + BlockId::Hash(it) => f.write_fmt(format_args!("0x{}", &hex::encode(it.block_hash))), + }, + BlockInterval::Range(range) => { + write!(f, "{}..{}", range.start, range.end) + } + BlockInterval::FollowFrom { start_block, .. } => { + write!(f, "{start_block}..") + } + } + } +} + +impl std::str::FromStr for BlockInterval { + type Err = anyhow::Error; + + fn from_str(s: &str) -> Result { + BlockInterval::new(s) + } +} + +#[cfg(test)] +mod test { + use alloy::primitives::B256; + + use super::*; + + #[test] + fn can_create_block_interval_from_exclusive_range() { + assert_eq!( + BlockInterval::new("0..10").unwrap(), + BlockInterval::Range(0..10) + ); + } + + #[test] + fn can_create_block_interval_from_inclusive_range() { + assert_eq!( + BlockInterval::new("0..=10").unwrap(), + BlockInterval::Range(0..11) + ); + } + + #[test] + fn can_create_follow_from_block_interval() { + assert_eq!( + BlockInterval::new("100..").unwrap(), + BlockInterval::FollowFrom { + start_block: 100, + block_time: None + } + ); + } + + #[test] + fn can_create_single_block_interval() { + assert_eq!( + BlockInterval::new("123415131").unwrap(), + BlockInterval::SingleBlockId(BlockId::Number(123415131.into())) + ); + } + + #[test] + fn new_interval_proper_single_block_error() { + assert_eq!( + BlockInterval::new("113A").err().unwrap().to_string(), + "invalid block interval range '113A'" + ); + } + + #[test] + fn new_interval_proper_range_error() { + assert_eq!( + BlockInterval::new("111...156").err().unwrap().to_string(), + "invalid block interval range '111...156'" + ); + } + + #[test] + fn new_interval_parse_block_hash() { + assert_eq!( + BlockInterval::new( + "0xb51ceca7ba912779ed6721d2b93849758af0d2354683170fb71dead6e439e6cb" + ) + .unwrap(), + BlockInterval::SingleBlockId(BlockId::Hash( + "0xb51ceca7ba912779ed6721d2b93849758af0d2354683170fb71dead6e439e6cb" + .parse::() + .unwrap() + .into() + )) + ) + } + + #[tokio::test] + async fn can_into_bounded_stream() { + use futures::StreamExt; + let mut result = Vec::new(); + let mut stream = BlockInterval::new("1..10") + .unwrap() + .into_bounded_stream() + .unwrap(); + while let Some(val) = stream.next().await { + result.push(val); + } + assert_eq!(result, Vec::from_iter(1u64..10u64)); + } + + #[test] + fn can_create_from_string() { + use std::str::FromStr; + assert_eq!( + &format!("{}", BlockInterval::from_str("0..10").unwrap()), + "0..10" + ); + } +} diff --git a/common/src/lib.rs b/common/src/lib.rs index e9e7b504..635eba33 100644 --- a/common/src/lib.rs +++ b/common/src/lib.rs @@ -1,3 +1,4 @@ +pub mod block_interval; pub mod debug_utils; pub mod parsing; pub mod prover_state; diff --git a/common/src/parsing.rs b/common/src/parsing.rs index 911d35e3..d1452a46 100644 --- a/common/src/parsing.rs +++ b/common/src/parsing.rs @@ -1,5 +1,5 @@ //! Parsing utilities. -use std::{fmt::Display, ops::Range, str::FromStr}; +use std::{fmt::Display, ops::Add, ops::Range, str::FromStr}; use thiserror::Error; @@ -21,22 +21,43 @@ where RhsMissing, } -/// Parse a range from a string. +/// Parse an exclusive range from a string. /// /// A valid range is of the form `lhs..rhs`, where `lhs` and `rhs` are numbers. +pub(crate) fn parse_range_exclusive( + s: &str, +) -> Result, RangeParseError> +where + NumberT: Display + FromStr + From + Add, + NumberT::Err: Display, +{ + parse_range_gen(s, "..", false) +} + +/// Parse an inclusive range from a string. /// -/// # Example -/// -/// ```rust -/// # use common::parsing::parse_range; -/// assert_eq!(parse_range::("0..10"), Ok(0..10)); -/// ``` -pub fn parse_range(s: &str) -> Result, RangeParseError> +/// A valid range is of the form `lhs..=rhs`, where `lhs` and `rhs` are numbers. +pub(crate) fn parse_range_inclusive( + s: &str, +) -> Result, RangeParseError> where - T: Display + FromStr, - T::Err: Display, + NumberT: Display + FromStr + From + Add, + NumberT::Err: Display, { - let mut pairs = s.split(".."); + parse_range_gen(s, "..=", true) +} + +pub(crate) fn parse_range_gen( + s: &str, + separator: SeparatorT, + inclusive: bool, +) -> Result, RangeParseError> +where + NumberT: Display + FromStr + From + Add, + NumberT::Err: Display, + SeparatorT: AsRef, +{ + let mut pairs = s.split(separator.as_ref()); match (pairs.next(), pairs.next()) { // Empty input, "" (Some(""), None) => Err(RangeParseError::EmptyInput), @@ -47,7 +68,11 @@ where (Some(lhs), Some(rhs)) => { let lhs = lhs.parse().map_err(RangeParseError::LhsParseError)?; let rhs = rhs.parse().map_err(RangeParseError::RhsParseError)?; - Ok(lhs..rhs) + if inclusive { + Ok(lhs..(rhs + NumberT::from(1u8))) + } else { + Ok(lhs..rhs) + } } // (None, _) is not possible, because split always returns at least one element. _ => unreachable!(), @@ -59,14 +84,19 @@ mod test { use super::*; #[test] - fn it_parses_ranges() { - assert_eq!(parse_range::("0..10"), Ok(0..10)); + fn it_parses_exclusive_ranges() { + assert_eq!(parse_range_exclusive::("0..10"), Ok(0..10)); + } + + #[test] + fn it_parses_inclusive_ranges() { + assert_eq!(parse_range_inclusive::("0..=10"), Ok(0..11)); } #[test] fn it_handles_missing_lhs() { assert_eq!( - parse_range::("..10").unwrap_err(), + parse_range_exclusive::("..10").unwrap_err(), RangeParseError::LhsMissing ); } @@ -74,7 +104,7 @@ mod test { #[test] fn it_handles_missing_rhs() { assert_eq!( - parse_range::("10..").unwrap_err(), + parse_range_exclusive::("10..").unwrap_err(), RangeParseError::RhsMissing ); } @@ -82,7 +112,7 @@ mod test { #[test] fn it_handles_empty_input() { assert_eq!( - parse_range::("").unwrap_err(), + parse_range_exclusive::("").unwrap_err(), RangeParseError::EmptyInput ); } @@ -90,7 +120,7 @@ mod test { #[test] fn it_handles_rhs_parse_error() { assert_eq!( - parse_range::("10..f").unwrap_err(), + parse_range_exclusive::("10..f").unwrap_err(), RangeParseError::RhsParseError("f".parse::().unwrap_err()) ); } @@ -98,7 +128,7 @@ mod test { #[test] fn it_handles_lhs_parse_error() { assert_eq!( - parse_range::("hello..10").unwrap_err(), + parse_range_exclusive::("hello..10").unwrap_err(), RangeParseError::LhsParseError("hello".parse::().unwrap_err()) ); } diff --git a/common/src/prover_state/circuit.rs b/common/src/prover_state/circuit.rs index 6ab1a03a..5eaf2da7 100644 --- a/common/src/prover_state/circuit.rs +++ b/common/src/prover_state/circuit.rs @@ -8,7 +8,7 @@ use std::{ use evm_arithmetization::{AllStark, StarkConfig}; use proof_gen::types::AllRecursiveCircuits; -use crate::parsing::{parse_range, RangeParseError}; +use crate::parsing::{parse_range_exclusive, RangeParseError}; /// Number of tables defined in plonky2. /// @@ -51,7 +51,7 @@ impl FromStr for CircuitSize { type Err = RangeParseError; fn from_str(s: &str) -> Result { - Ok(CircuitSize(parse_range(s)?)) + Ok(CircuitSize(parse_range_exclusive(s)?)) } } diff --git a/coordinator/Cargo.toml b/coordinator/Cargo.toml index 7622fd9d..f50d17d5 100644 --- a/coordinator/Cargo.toml +++ b/coordinator/Cargo.toml @@ -18,6 +18,7 @@ common = { path = "../common" } leader = { path = "../leader" } # 3rd parties +alloy = {workspace = true} tokio = { workspace = true } anyhow = { workspace = true } clap = { workspace = true } @@ -31,8 +32,9 @@ serde_json = { workspace = true } actix-web = "4.5.1" actix-rt = "2.9.0" # env_logger = "0.11.3" -chrono = "0.4.38" +chrono = { workspace = true } async-channel = "2.2.1" futures = { workspace = true } tracing = { workspace = true } tracing-subscriber = { workspace = true } +url = "2.5.1" diff --git a/coordinator/README.md b/coordinator/README.md index b76a29aa..dd4f37ac 100644 --- a/coordinator/README.md +++ b/coordinator/README.md @@ -102,11 +102,7 @@ The example below proves blocks [1,10] using the RPC function listed in ZeroBin, ```json { "run_name": "run", - "start_block_number": 1, - "checkpoint_block_number": 1, - "terminate_on": { - "EndBlock": {"block_number": 10} - }, + "block_interval": "3..=10", "block_source": { "ZeroBinRpc": {"rpc_url": "http://35.208.84.178:8545/"} }, @@ -122,10 +118,7 @@ The example below proves blocks [1,10] using the RPC function listed in ZeroBin, ```json { "run_name": "run", - "start_block_number": 18, - "terminate_on": { - "EndBlock": {"block_number": 21} - }, + "block_interval": "3..=10", "block_source": { "ZeroBinRpc": {"rpc_url": "http://35.208.84.178:8545/"} }, @@ -140,11 +133,7 @@ An example not recording the proofs, and posting the results to a google cloud s ```json { "run_name": "run", - "start_block_number": 1, - "checkpoint_block_number": 1, - "terminate_on": { - "EndBlock": {"block_number": 10} - }, + "block_interval": "3..=5", "block_source": { "ZeroBinRpc": {"rpc_url": "http://35.208.84.178:8545/"} }, @@ -158,11 +147,7 @@ In this example, we run the experiment for just one minute. ```json { - "start_block_number": 1, - "checkpoint_block_number": 1, - "terminate_on": { - "ElapsedSeconds": {"num_seconds": 60} - }, + "block_interval": "3..=5", "block_source": { "ZeroBinRpc": {"rpc_url": "http://35.208.84.178:8545/"} }, @@ -174,17 +159,10 @@ In this example, we run the experiment for just one minute. ```json { - "start_block_number": 1, - "checkpoint_block_number": 1, - "terminate_on": { - "BlockGasUsed": {"until_gas_sum": 30000000} - }, + "block_interval": "3..=5", "block_source": { "ZeroBinRpc": {"rpc_url": "http://35.208.84.178:8545/"} }, - "block_concurrency": { - "Parallel": {"max_concurrent": 2} - }, "benchmark_output": { "GoogleCloudStorageCsv": {"file_name": "test.csv", "bucket": "zkevm-csv"} } @@ -193,17 +171,10 @@ In this example, we run the experiment for just one minute. ```json { - "start_block_number": 1, - "checkpoint_block_number": 1, - "terminate_on": { - "ElapsedSeconds": {"num_seconds": 60} - }, + "block_interval": "3..=5", "block_source": { "ZeroBinRpc": {"rpc_url": "http://35.208.84.178:8545/"} }, - "block_concurrency": { - "Parallel": {"max_concurrent": 5} - }, "benchmark_output": { "GoogleCloudStorageCsv": {"file_name": "2hr_parallel.csv", "bucket": "zkevm-csv"} } diff --git a/coordinator/src/fetch.rs b/coordinator/src/fetch.rs index d0db6729..2bd2960d 100644 --- a/coordinator/src/fetch.rs +++ b/coordinator/src/fetch.rs @@ -1,8 +1,12 @@ //! This is useful for fetching [ProverInput] per block +use alloy::{ + providers::RootProvider, + rpc::types::{BlockId, BlockNumberOrTag}, +}; use anyhow::Error; -use prover::ProverInput; -use rpc::{fetch_prover_input, FetchProverInputRequest}; -use tracing::{error, info}; +use common::block_interval::BlockInterval; +use rpc::{benchmark_prover_input, BenchmarkedProverInput}; +use tracing::info; use super::input::BlockSource; @@ -28,7 +32,7 @@ impl std::error::Error for FetchError {} #[derive(Debug, Clone, Copy, serde::Serialize, serde::Deserialize)] pub enum Checkpoint { - Constant(u64), + Constant(BlockId), BlockNumberNegativeOffset(u64), } @@ -39,44 +43,67 @@ impl Default for Checkpoint { } impl Checkpoint { - pub fn get_checkpoint(&self, block_number: u64) -> u64 { + pub fn get_checkpoint_from_blocknum(&self, block_number: u64) -> BlockId { match self { - Self::BlockNumberNegativeOffset(offset) if block_number > *offset => { - block_number - offset + Self::Constant(num @ BlockId::Number(_)) => *num, + Self::Constant(BlockId::Hash(_)) => { + unreachable!("Coordinator does not support Hash Block IDs") + } + Self::BlockNumberNegativeOffset(offset) => { + BlockId::Number(BlockNumberOrTag::Number(block_number - *offset)) + } + } + } + + pub fn get_checkpoint_from_interval(&self, block_interval: BlockInterval) -> BlockId { + match block_interval { + BlockInterval::FollowFrom { + start_block, + block_time: _, + } => self.get_checkpoint_from_blocknum(start_block), + BlockInterval::Range(range) => self.get_checkpoint_from_blocknum(range.start), + BlockInterval::SingleBlockId(BlockId::Number(BlockNumberOrTag::Number(start))) => { + self.get_checkpoint_from_blocknum(start) + } + BlockInterval::SingleBlockId(BlockId::Number(_) | BlockId::Hash(_)) => { + todo!("Coordinator only supports Numbers, not Tags or Block Hashes") } - Self::BlockNumberNegativeOffset(_) => 0, - Self::Constant(constant_value) => *constant_value, } } } /// Fetches the prover input given the [BlockSource] pub async fn fetch( - block_number: u64, + block_interval: BlockInterval, checkpoint_method: &Option, source: &BlockSource, -) -> Result { +) -> Result { match source { // Use ZeroBing's RPC fetch BlockSource::ZeroBinRpc { rpc_url } => { info!( "Requesting from block {} from RPC ({})", - block_number, rpc_url + block_interval, rpc_url ); - let fetch_prover_input_request = FetchProverInputRequest { - rpc_url: rpc_url.as_str(), - block_number, - checkpoint_block_number: checkpoint_method - .unwrap_or_default() - .get_checkpoint(block_number), + + let checkpoint = checkpoint_method + .unwrap_or_default() + .get_checkpoint_from_interval(block_interval.clone()); + + let provider_url = match url::Url::parse(rpc_url) { + Ok(url) => url, + Err(err) => return Err(FetchError::ZeroBinRpcFetchError(err.into())), }; - match fetch_prover_input(fetch_prover_input_request).await { - Ok(prover_input) => Ok(prover_input), - Err(err) => { - error!("Failed to fetch prover input: {}", err); - Err(FetchError::ZeroBinRpcFetchError(err)) - } + match benchmark_prover_input( + RootProvider::new_http(provider_url), + block_interval, + checkpoint, + ) + .await + { + Ok(input) => Ok(input), + Err(err) => Err(FetchError::ZeroBinRpcFetchError(err)), } } } diff --git a/coordinator/src/input.rs b/coordinator/src/input.rs index c53f2547..2ba38a73 100644 --- a/coordinator/src/input.rs +++ b/coordinator/src/input.rs @@ -1,4 +1,5 @@ //! This module contains a lot of the important input structs +use common::block_interval::BlockInterval; use serde::{Deserialize, Serialize}; use crate::{benchmarking::BenchmarkOutputConfig, fetch::Checkpoint}; @@ -92,21 +93,17 @@ use crate::proofout::ProofOutputMethod; pub struct ProveBlocksInput { /// The name of the run pub run_name: Option, - /// The starting block number - pub start_block_number: u64, + /// The block interval + /// + /// See [BlockInterval::new] to see the acceptable [String] representations + /// for the [BlockInterval] + pub block_interval: String, /// The checkpoint block number. If not provided, will be the /// the block before the current block number, or /// [Checkpoint::BlockNumberNegativeOffset] set to 1. pub checkpoint: Option, - /// The termination condition. If not provided, will not terminate until - /// exhausted or an error occurs. - pub terminate_on: Option, /// How we source the blocks. pub block_source: BlockSource, - /// The conccurency mode - pub block_concurrency: Option, - /// DEPRECATED - pub check_gas: Option, /// Stores the output of the proofs. If not provided, no proofs will be /// stored pub proof_output: Option, @@ -120,11 +117,17 @@ pub struct ProveBlocksInput { } impl ProveBlocksInput { + pub fn get_block_interval(&self) -> Result { + BlockInterval::new(&self.block_interval) + } + pub fn get_expected_number_proofs(&self) -> Option { - match self.terminate_on { - Some(TerminateOn::EndBlock { block_number }) => { - Some((block_number - self.start_block_number) + 1) - } + match self.get_block_interval() { + // Ranges should be determined by start and end + Ok(BlockInterval::Range(range)) => Some(range.end - range.start), + // Single block should be 1 + Ok(BlockInterval::SingleBlockId(_)) => Some(1), + // Nothing, then None _ => None, } } diff --git a/coordinator/src/main.rs b/coordinator/src/main.rs index e7bfc8a3..d92531cf 100644 --- a/coordinator/src/main.rs +++ b/coordinator/src/main.rs @@ -202,15 +202,13 @@ async fn handle_post( }; // Start the prover in a new thread - tokio::spawn(async move { - match prover.prove_blocks().await { - Ok(_) => info!("Completed request started (Request: {})", start_time), - Err(err) => error!( - "Critical error occured while attempting to perform proofs ({}): {}", - start_time, err - ), - } - }); + match prover.prove_blocks().await { + Ok(_) => info!("Completed request started (Request: {})", start_time), + Err(err) => error!( + "Critical error occured while attempting to perform proofs ({}): {}", + start_time, err + ), + }; // Respond the Accepted response HttpResponse::Accepted() diff --git a/coordinator/src/manyprover.rs b/coordinator/src/manyprover.rs index 220ae341..c750903a 100644 --- a/coordinator/src/manyprover.rs +++ b/coordinator/src/manyprover.rs @@ -1,25 +1,19 @@ //! This module contains everything to prove multiple blocks in either parallel //! or sequential. -use std::sync::{ - atomic::{AtomicBool, Ordering}, - Arc, -}; -use std::time::{Instant, SystemTime}; +use std::sync::Arc; +use std::time::Instant; -use async_channel; use chrono::{DateTime, Utc}; use paladin::runtime::Runtime; -use proof_gen::proof_types::GeneratedBlockProof; -use proof_gen::types::PlonkyProofIntern; use tokio::task::JoinError; -use tracing::{debug, error, info, warn}; +use tracing::{debug, error, info}; use crate::benchmarking::{ BenchmarkingOutput, BenchmarkingOutputBuildError, BenchmarkingOutputError, BenchmarkingStats, }; use crate::fetch::{fetch, FetchError}; -use crate::input::{BlockConcurrencyMode, ProveBlocksInput, TerminateOn}; +use crate::input::{ProveBlocksInput, TerminateOn}; use crate::proofout::{ProofOutput, ProofOutputBuildError, ProofOutputError}; //=========================================================================================== @@ -36,6 +30,12 @@ pub enum ManyProverError { FailedToSendTask(u64), } +impl From for ManyProverError { + fn from(value: FetchError) -> Self { + Self::Fetch(value) + } +} + impl std::fmt::Display for ManyProverError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Debug::fmt(&self, f) @@ -97,32 +97,6 @@ impl ManyProver { info!("Input received: {:?}", input); - // Gas is always checked, so this parameter is irrelevant - match input.check_gas { - Some(true) => warn!("Provided check_gas as true, but gas is always checked now."), - Some(false) => warn!("Provided check_gas as false, but we always check gas now. You can leave this out of future calls."), - None => (), - } - - // Forwarding the previous block seems to run into occasional issues, we should - // drop a warning if this was enabled - match input.forward_prev { - Some(true) => { - // Since forwarding previous block seems to cause issues currently and it only - // really matters to provide aggregated results, we will not support it for - // parallel execution (may change later) - if let Some(BlockConcurrencyMode::Parallel { - max_concurrent: _, - max_blocks: _, - }) = input.block_concurrency - { - return Err(ManyProverBuildError::InvalidConfiguration(String::from( - "Forwarding proofs with parallel not supported", - ))); - } - } - Some(false) | None => (), - } //================================================================================= // Init & Setup //================================================================================= @@ -176,11 +150,6 @@ impl ManyProver { }) } - /// Returns the termination conditions if present. - pub fn terminate_on(&self) -> &Option { - &self.input_request.terminate_on - } - /// Returns true if we are storing the proofs pub fn storing_proof(&self) -> bool { self.proof_out.is_some() @@ -191,715 +160,91 @@ impl ManyProver { self.benchmark_out.is_some() } - pub fn starting_block(&self) -> u64 { - self.input_request.start_block_number - } - - pub fn block_conccurency(&self) -> BlockConcurrencyMode { - self.input_request.block_concurrency.unwrap_or_default() - } - //=========================================================================================== // Running //=========================================================================================== pub async fn prove_blocks(&mut self) -> Result<(), ManyProverError> { - // Depending on the block concurrency mode, prove sequentially or in parallel - info!("Starting block proving process"); - match self.block_conccurency() { - BlockConcurrencyMode::Sequential => match self.prove_blocks_sequentially().await { - Ok(()) => info!("Completed Sequential block proving"), - Err(err) => { - error!("Failed to complete Sequential block proving: {}", err); - return Err(err); - } - }, - BlockConcurrencyMode::Parallel { - max_concurrent: _, - max_blocks: _, - } => match self.prove_blocks_parallel().await { - Ok(()) => info!("Completed Parallel block proving"), - Err(err) => { - error!("Failed to complete Parallel block proving: {}", err); - return Err(err); - } - }, - } - - Ok(()) - } - - //=========================================================================================== - // Parallel Block Proving - //=========================================================================================== - - pub async fn prove_blocks_parallel(&mut self) -> Result<(), ManyProverError> { - //======================================================================== - // Function to prove a singular block in parallel - //======================================================================== - - struct ParallelBlockProof { - benchmark_stats: BenchmarkingStats, - proof: GeneratedBlockProof, - } - - struct ProveBlockTaskInput { - input: Arc, - runtime: Arc, - block_num: u64, - } - - /// Function that proves a block - async fn prove_block( - prove_block_task_input: ProveBlockTaskInput, - ) -> Result { - let input = prove_block_task_input.input; - let runtime = prove_block_task_input.runtime; - let block_num = prove_block_task_input.block_num; - - // FETCHING - debug!("Attempting to fetch block {}", block_num); - let fetch_start_instance = Instant::now(); - let prover_input = match fetch(block_num, &input.checkpoint, &input.block_source).await - { - Ok(prover_input) => prover_input, - Err(err) => { - error!("Failed to fetch block number: {}", block_num); - return Err(ManyProverError::Fetch(err)); - } - }; - let fetch_duration = fetch_start_instance.elapsed(); - info!( - "Fetched block {} in {} seconds", - block_num, - fetch_duration.as_secs_f64() - ); - // EXTRACTING KEY INFO - // Number txs - let n_txs = prover_input.block_trace.txn_info.len(); - // Txs Gas Used - let gas_used_txs: Vec = prover_input - .block_trace - .txn_info - .iter() - .map(|txn_info| txn_info.meta.gas_used) - .collect(); - // Gas used in original block - let gas_used = match u64::try_from(prover_input.other_data.b_data.b_meta.block_gas_used) - { - Ok(gas) => gas, - Err(err) => panic!( - "Could not convert gas used by block {} to u64: {}", - block_num, err - ), - }; - // Retrieve the cur block's difficulty - let difficulty = - match u64::try_from(prover_input.other_data.b_data.b_meta.block_difficulty) { - Ok(diff) => diff, - Err(err) => panic!( - "Could not convert difficulty by block {} to u64: {}", - block_num, err - ), - }; - // PROVING - info!("Starting to prove block {}", block_num); - let proof_start_instance = Instant::now(); - let proof_start_stamp: DateTime = SystemTime::now().into(); - let benchmarked_proof = match prover_input - .prove_and_benchmark(runtime.as_ref(), None, true) - .await - { - Ok(benchmarked_proof) => benchmarked_proof, - Err(err) => { - error!("Failed to generate block {}'s proof: {}", block_num, err); - return Err(ManyProverError::Proof(err)); - } - }; - - let total_proof_duration = proof_start_instance.elapsed(); - let proof_end_stamp: DateTime = SystemTime::now().into(); - info!( - "Proved block {} in {} seconds", - block_num, - total_proof_duration.as_secs_f64() - ); - - // Create the benchmarking statistics and return both. - Ok(ParallelBlockProof { - benchmark_stats: BenchmarkingStats { - block_number: block_num, - n_txs: n_txs as u64, - cumulative_n_txs: None, - fetch_duration, - total_proof_duration, - prep_duration: benchmarked_proof.prep_dur, - txproof_duration: benchmarked_proof.proof_dur, - agg_duration: benchmarked_proof.agg_dur, - start_time: proof_start_stamp, - end_time: proof_end_stamp, - overall_elapsed_seconds: None, - proof_out_duration: None, - gas_used, - gas_used_per_tx: gas_used_txs, - cumulative_gas_used: None, - difficulty, - }, - proof: benchmarked_proof.proof, - }) - } - - //======================================================================== - // Init - //======================================================================== - info!("Initializing setup for parallel block proving"); - - // Panic if forward prev is enabled, parallel won't support that - if let Some(true) = self.input_request.forward_prev { - panic!("Cannot prove blocks in parallel & have forward_prev enabled"); - } - - let mut cumulative_n_txs: u64 = 0; - let mut cumulative_block_gas: u64 = 0; - - let parallel_cnt = match self.block_conccurency() { - BlockConcurrencyMode::Parallel { - max_concurrent, - max_blocks: _, - } => max_concurrent, - BlockConcurrencyMode::Sequential => { - unreachable!("Started parallel execution, however input was set to sequential") - } - }; - - // create the async channel (the work queue) - // the work queue will contain the proof inputs - let (task_sender, task_receiver) = async_channel::unbounded::(); - - let (result_sender, result_receiver) = - async_channel::unbounded::>(); - - // Starting flag - let start_working = Arc::new(AtomicBool::new(false)); - - /// the worker continually pulls tasks from the task_receiver, performs - /// the proof, and then sends results back to the master thread using - /// result_sender. - async fn pull_task_and_do_it( - start_working: Arc, - task_receiver: async_channel::Receiver, - result_sender: async_channel::Sender>, - ) { - // stall the thread until the timer begins - while !start_working.load(Ordering::SeqCst) {} - - while start_working.load(Ordering::SeqCst) { - let proof_task: ProveBlockTaskInput = match task_receiver.recv().await { - Ok(rec_i) => rec_i, - Err(_) => { - info!("Task queue closed. Ending thread..."); - return; - } - }; - - let result = prove_block(proof_task).await; - match result_sender.send(result).await { - Ok(_) => info!("Sent results for block"), - Err(err) => panic!("Critical error with Result Sender Channel: {}", err), - } - } - } - - // spawn `parallel_cnt` long-lived taskees (threads dedicated to proving a - // block) - let mut taskees: Vec> = - Vec::with_capacity(parallel_cnt as usize); - for _ in 0..parallel_cnt { - // Clone the task receiver / result sender clone - // NOTE: uses Arc, so .clone() creates a thread-safe reference to the same - // object. - let this_start_working = start_working.clone(); - let this_task_receiver = task_receiver.clone(); - let this_result_sender = result_sender.clone(); - // Create a new "taskee" - taskees.push(tokio::spawn(async move { - pull_task_and_do_it(this_start_working, this_task_receiver, this_result_sender) - .await - })); - } - - // Fill the Taskee Queue - let input_request_arc = Arc::new(self.input_request.clone()); - // Need to determine range of blocks we will be able to prove - const DFLT_MAX_NUMBER_BLOCKS: u64 = 1_000; - let end_block = { - if let Some(TerminateOn::EndBlock { block_number }) = self.input_request.terminate_on { - block_number - } else { - self.input_request - .get_expected_number_proofs() - .unwrap_or(DFLT_MAX_NUMBER_BLOCKS) - + self.input_request.start_block_number - } + info!("Startng to prove blocks"); + + info!("Starting fetch"); + let prover_input = fetch( + self.input_request + .get_block_interval() + .map_err(FetchError::ZeroBinRpcFetchError)?, + &self.input_request.checkpoint, + &self.input_request.block_source, + ) + .await?; + info!("Fetch completed"); + + info!("Starting proofs"); + let block_proof_start_time: DateTime = Utc::now(); + let block_proofs = match prover_input + .proverinput + .prove_and_benchmark(&self.runtime, None, true) + .await + { + Ok(block_proofs) => block_proofs, + Err(err) => return Err(ManyProverError::Proof(err)), }; - - info!( - "Creating tasks for [{},{}]", - self.starting_block(), - end_block - ); - - // Iterate through each block number from the starting point onward to the max - // number blocks. - for block_num in self.input_request.start_block_number..=end_block { - // Try to send the task to the queue - match task_sender - .send(ProveBlockTaskInput { - input: input_request_arc.clone(), - runtime: self.runtime.clone(), - block_num, - }) - .await - { - Ok(_) => (), - Err(err) => { - error!("{}", err); - return Err(ManyProverError::FailedToSendTask(block_num)); - } - } - } - - // the taskees will stop pulling proof inputs once the sender is closed - if !task_sender.is_closed() { - info!("Task Sender still open, closing now..."); - task_sender.close(); - } - - // Start the timer - let total_timer = Arc::new(Instant::now()); - let total_start_stamp: DateTime = SystemTime::now().into(); - // release the taskees upon starting the timer - start_working.store(true, Ordering::SeqCst); - info!("Starting the timer and the proving processes"); - - //================================================================================= - // Start checking for results - //================================================================================= - - loop { - // Pull the result - let prover_result = match result_receiver.recv().await { - Ok(Ok(prover_result)) => prover_result, - Ok(Err(err)) => { - error!("Failure when proving a block: {}", err); - continue; - } - Err(err) => { - info!("Result Receiver has been closed: {}", err); - if !task_sender.is_closed() { - warn!("Result Receiver was closed before Task Sender"); - task_sender.close(); - } - break; - } - }; - - // Deconstruct the result - let benchmark_stats = prover_result.benchmark_stats; - let proof = prover_result.proof; - - // Add to the cumulative values - cumulative_block_gas += benchmark_stats.gas_used; - cumulative_n_txs += benchmark_stats.n_txs; - - // The overall elapsed seconds until the end stamp for this proof - let overall_elapsed_seconds = benchmark_stats - .end_time - .signed_duration_since(total_start_stamp) - .num_seconds() as u64; - - //------------------------------------------------------------------------------------------- - // Proof out - //------------------------------------------------------------------------------------------- - - let proof_out_time: Option = match &self.proof_out { - Some(proof_out) => { - let proof_out_start = Instant::now(); - match proof_out.write(&proof) { - Ok(_) => { - info!("Successfully wrote proof"); - Some(proof_out_start.elapsed()) - } - Err(err) => { - error!("Failed to write proof"); - return Err(ManyProverError::ProofOutError(err)); - } - } - } - None => None, - }; - - //------------------------------------------------------------------------------------------- - // Benchmark Out - //------------------------------------------------------------------------------------------- - - // If we are tracking benchmark statistics, add the cumulative values - // and then add it to the benchmark out - if let Some(benchmark_out) = &mut self.benchmark_out { - // Make the received benchmark statistics mutable - let mut benchmark_stats = benchmark_stats; - // Add to the cumulative counts - benchmark_stats.cumulative_gas_used = Some(cumulative_block_gas); - benchmark_stats.cumulative_n_txs = Some(cumulative_n_txs); - benchmark_stats.proof_out_duration = proof_out_time; - benchmark_stats.overall_elapsed_seconds = Some(overall_elapsed_seconds); - benchmark_out.push(benchmark_stats); - } - - //================================================================================== - // Terminate? - //================================================================================== - - // This statement will evaluate whether we should terminate. - match self.terminate_on() { - Some(TerminateOn::ElapsedSeconds { num_seconds }) => { - let elapsed_seconds = total_timer.elapsed().as_secs(); - if &elapsed_seconds >= num_seconds { - info!( - "Terminating as elapsed amount of seconds exceeds allowed time ({}s / {}s)", - num_seconds, elapsed_seconds - ); - break; - } else { - info!( - "Total elapsed amount of seconds ({}s / {}s)", - num_seconds, elapsed_seconds - ); - } - } - Some(TerminateOn::BlockGasUsed { until_gas_sum }) => { - if &cumulative_block_gas >= until_gas_sum { - info!( - "Terminating as we have elapsed total amount of gas ({} / {})", - cumulative_block_gas, until_gas_sum - ); - break; - } else { - info!( - "Total elapsed amount of gas ({} / {})", - cumulative_block_gas, until_gas_sum - ); - } - } - Some(_) | None => (), - } - } - - start_working.store(false, Ordering::SeqCst); - - // the taskees will stop pulling proof inputs once the sender is closed - if !task_sender.is_closed() { - info!("Task Sender still open, closing now..."); - task_sender.close(); - } - - // Output the benchmark outputs - if let Some(benchmark_out) = &self.benchmark_out { - match benchmark_out.publish().await { - Ok(()) => info!("Published the benchmark"), - Err(err) => { - error!("Failed to publish benchmark statistics: {}", err); - } - } - } - - // clean up the tokio handles - let _ = futures::future::join_all(taskees).await; - - Ok(()) - } - - //=========================================================================================== - // Sequential Block Proving - //=========================================================================================== - - /// Sequentially proves blocks - pub async fn prove_blocks_sequentially(&mut self) -> Result<(), ManyProverError> { - //======================================================================== - // Init - //======================================================================== - info!("Initializing setup for sequential block proving"); - - // Stores the previous PlonkyProofIntern if applicable - let mut prev: Option = None; - - // Stores the cumulative amount of gas from all the operations - let mut cumulative_block_gas: u64 = 0; - - // Stores the current block number - let mut cur_block_num: u64 = self.input_request.start_block_number; + info!("Finalized benchmarked proofs"); let mut cumulative_n_txs: u64 = 0; + let mut cumulative_gas_used: u64 = 0; - //======================================================================== - // Performing the proofs - //======================================================================== - - info!("Starting the proof process"); - let total_timer = Instant::now(); - let total_start_stamp: DateTime = SystemTime::now().into(); - - loop { - //------------------------------------------------------------------------ - // Pre-Proving Termination check - //------------------------------------------------------------------------ - match self.terminate_on() { - Some(TerminateOn::ElapsedSeconds { num_seconds }) => { - match total_timer.elapsed().as_secs() { - elapsed_secs if elapsed_secs >= *num_seconds => { - info!( - "Terminating before block {} due to reaching time constraint.", - cur_block_num - ); - break; - } - elapsed_secs => { - info!( - "{}/{} seconds elapsed ({}%)", - elapsed_secs, - num_seconds, - ((elapsed_secs as f64) / (*num_seconds as f64)) - ) - } - } - } - Some(TerminateOn::EndBlock { block_number }) => { - if cur_block_num > *block_number { - info!( - "Terminating before block {} due to reaching specified end block: {}", - cur_block_num, cur_block_num - ); - break; - } else { - let cbn = (cur_block_num - self.starting_block()) as f64; - let bn = (block_number - self.starting_block()) as f64; - info!( - "{}/{} blocks processed ({}%)", - cur_block_num - self.starting_block(), - block_number - self.starting_block(), - cbn / bn - ) - } - } - Some(_) => (), - None => (), - } + for (benchmark_block_proof, fetch_time) in + block_proofs.iter().zip(prover_input.fetch_times.iter()) + { + cumulative_n_txs += benchmark_block_proof.n_txs; + cumulative_gas_used += benchmark_block_proof.gas_used; - //------------------------------------------------------------------------ - // Fetching - //------------------------------------------------------------------------ - - debug!("Attempting to fetch block {}", cur_block_num); - let fetch_start_instance = Instant::now(); - let prover_input = match fetch( - cur_block_num, - &self.input_request.checkpoint, - &self.input_request.block_source, - ) - .await - { - Ok(prover_input) => prover_input, - Err(err) => { - error!("Failed to fetch block number: {}", cur_block_num); - return Err(ManyProverError::Fetch(err)); - } - }; - let fetch_duration = fetch_start_instance.elapsed(); - info!( - "Fetched block {} in {} seconds", - cur_block_num, - fetch_duration.as_secs_f64() - ); - - //------------------------------------------------------------------------ - // Extract some key information - //------------------------------------------------------------------------ - - // Retrieve the number of transactions from this block. - let n_txs = prover_input.block_trace.txn_info.len() as u64; - let gas_used_txs: Vec = prover_input - .block_trace - .txn_info - .iter() - .map(|txn_info| txn_info.meta.gas_used) - .collect(); - cumulative_n_txs += n_txs; - // Retrieve the cur block's gas used - let cur_gas_used = - match u64::try_from(prover_input.other_data.b_data.b_meta.block_gas_used) { - Ok(gas) => { - cumulative_block_gas += gas; - gas - } - Err(err) => panic!( - "Could not convert gas used by block {} to u64: {}", - cur_block_num, err - ), - }; - - // Retrieve the cur block's difficulty - let difficulty = - match u64::try_from(prover_input.other_data.b_data.b_meta.block_difficulty) { - Ok(diff) => diff, - Err(err) => panic!( - "Could not convert difficulty by block {} to u64: {}", - cur_block_num, err - ), - }; - - //------------------------------------------------------------------------ - // Proving - //------------------------------------------------------------------------ - - info!("Starting to prove block {}", cur_block_num); - // Instance will track duration, better specified for that - let proof_start_instance = Instant::now(); - // The stamp will signify the starting process of this proof. - let proof_start_stamp: DateTime = SystemTime::now().into(); - let benchmarked_proof = match prover_input - .prove_and_benchmark(self.runtime.as_ref(), prev, true) - .await - { - Ok(proof) => proof, - Err(err) => { - error!( - "Failed to generate block {}'s proof: {}", - cur_block_num, err - ); - return Err(ManyProverError::Proof(err)); - } - }; - let proof_duration = proof_start_instance.elapsed(); - let proof_end_stamp: DateTime = SystemTime::now().into(); - info!( - "Proved block {} in {} seconds", - cur_block_num, - proof_duration.as_secs_f64() - ); - - //------------------------------------------------------------------------ - // Post-Proving Termination check - //------------------------------------------------------------------------ - - match self.terminate_on() { - Some(TerminateOn::BlockGasUsed { until_gas_sum }) => { - // if we have exceeded the gas sum, - info!( - "{}/{} block gas accumulated ({}%)", - cumulative_block_gas, - until_gas_sum, - (cumulative_block_gas as f64 / *until_gas_sum as f64) - ) - } - Some(TerminateOn::ElapsedSeconds { num_seconds }) => { - match total_timer.elapsed().as_secs() { - secs if secs > *num_seconds => { - info!( - "Exceeded elapsed time, terminating after recording block {}", - cur_block_num - ); - } - secs => info!( - "Time elapsed after proving block {}: {} / {}", - cur_block_num, secs, num_seconds - ), - } - } - _ => (), - } - - //------------------------------------------------------------------------ - // Recording the proof - //------------------------------------------------------------------------ - - // Record the proof if necessary - - let proof_out_time: Option = match &self.proof_out { + let proof_out_time = match &self.proof_out { Some(proof_out) => { - let proof_out_start = Instant::now(); - match proof_out.write(&benchmarked_proof.proof) { - Ok(_) => { - info!("Successfully wrote proof"); - Some(proof_out_start.elapsed()) - } - Err(err) => { - error!("Failed to write proof"); - return Err(ManyProverError::ProofOutError(err)); - } + let proof_out_instant = Instant::now(); + match proof_out.write(&benchmark_block_proof.proof) { + Ok(_) => (), + Err(err) => return Err(ManyProverError::ProofOutError(err)), } + Some(proof_out_instant.elapsed()) } None => None, }; - // If we need to keep the proof, save it in prev, otherwise do not. - prev = match self.input_request.forward_prev { - Some(false) | None => None, - Some(true) => Some(benchmarked_proof.proof.intern), - }; - - //------------------------------------------------------------------------ - // Recording the Benchmark - //------------------------------------------------------------------------ - - // If we are tracking benchmark statistics, produce the struct and - // push it to the benchmark output vector. - if let Some(benchmark_out) = &mut self.benchmark_out { - let benchmark_stats = BenchmarkingStats { - block_number: cur_block_num, - n_txs, + match &mut self.benchmark_out { + Some(benchmark_out) => benchmark_out.push(BenchmarkingStats { + block_number: benchmark_block_proof.proof.b_height, + n_txs: benchmark_block_proof.n_txs, cumulative_n_txs: Some(cumulative_n_txs), - fetch_duration, - total_proof_duration: proof_duration, - prep_duration: benchmarked_proof.prep_dur, - txproof_duration: benchmarked_proof.proof_dur, - agg_duration: benchmarked_proof.agg_dur, - start_time: proof_start_stamp, - end_time: proof_end_stamp, + fetch_duration: *fetch_time, + total_proof_duration: benchmark_block_proof + .total_dur + .expect("Value is expected"), + prep_duration: benchmark_block_proof.prep_dur, + proof_out_duration: proof_out_time, + agg_duration: benchmark_block_proof.agg_dur, + gas_used: benchmark_block_proof.gas_used, + gas_used_per_tx: benchmark_block_proof.gas_used_per_tx.clone(), + txproof_duration: benchmark_block_proof.proof_dur, + start_time: benchmark_block_proof.start_time, + end_time: benchmark_block_proof.end_time, + difficulty: benchmark_block_proof.difficulty, + cumulative_gas_used: Some(cumulative_gas_used), overall_elapsed_seconds: Some( - proof_end_stamp - .signed_duration_since(total_start_stamp) - .num_seconds() as u64, + (benchmark_block_proof.end_time - block_proof_start_time).num_seconds() + as u64, ), - proof_out_duration: proof_out_time, - gas_used: cur_gas_used, - gas_used_per_tx: gas_used_txs, - cumulative_gas_used: Some(cumulative_block_gas), - difficulty, - }; - benchmark_out.push(benchmark_stats) + }), + None => todo!(), } - - // Increment the block number - cur_block_num += 1; } - //----------------------------------------------------------------------- - // Benchmark Finalizing & Publishing - //----------------------------------------------------------------------- - - // Attempt to publish benchmark statistics match &self.benchmark_out { Some(benchmark_out) => match benchmark_out.publish().await { - Ok(_) => info!("Successfully published Benchmark Statistics"), - Err(err) => { - error!( - "Failed to publish data stored in BenchmarkingOutput: {}", - err - ); - return Err(ManyProverError::BenchmarkingOutput(err)); - } + Ok(_) => (), + Err(err) => return Err(ManyProverError::BenchmarkingOutput(err)), }, - None => debug!("No Benchmark Output, so no benchmark stats are published"), + None => (), } Ok(()) diff --git a/leader/Cargo.toml b/leader/Cargo.toml index 15f155d8..42e58798 100644 --- a/leader/Cargo.toml +++ b/leader/Cargo.toml @@ -20,7 +20,8 @@ tokio = { workspace = true } proof_gen = { workspace = true } serde_json = { workspace = true } serde_path_to_error = { workspace = true } -ethereum-types = { workspace = true } +futures = { workspace = true } +alloy.workspace = true axum = "0.7.4" toml = "0.8.12" diff --git a/leader/src/cli.rs b/leader/src/cli.rs index 10316f6a..06a71b61 100644 --- a/leader/src/cli.rs +++ b/leader/src/cli.rs @@ -34,22 +34,26 @@ pub(crate) enum Command { // The Jerigon RPC URL. #[arg(long, short = 'u', value_hint = ValueHint::Url)] rpc_url: String, - /// The block number for which to generate a proof. - #[arg(short, long)] - block_number: u64, + /// The block interval for which to generate a proof. + #[arg(long, short = 'i')] + block_interval: String, /// The checkpoint block number. #[arg(short, long, default_value_t = 0)] checkpoint_block_number: u64, /// The previous proof output. #[arg(long, short = 'f', value_hint = ValueHint::FilePath)] previous_proof: Option, - /// If provided, write the generated proof to this file instead of + /// If provided, write the generated proofs to this directory instead of /// stdout. #[arg(long, short = 'o', value_hint = ValueHint::FilePath)] - proof_output_path: Option, + proof_output_dir: Option, /// If true, save the public inputs to disk on error. #[arg(short, long, default_value_t = false)] save_inputs_on_error: bool, + /// Network block time in milliseconds. This value is used + /// to determine the blockchain node polling interval. + #[arg(short, long, env = "ZERO_BIN_BLOCK_TIME", default_value_t = 2000)] + block_time: u64, }, /// Reads input from HTTP and writes output to a directory. Http { diff --git a/leader/src/http.rs b/leader/src/http.rs index 1b950f3b..6b39a95a 100644 --- a/leader/src/http.rs +++ b/leader/src/http.rs @@ -1,11 +1,11 @@ use std::{net::SocketAddr, path::PathBuf, sync::Arc}; +use alloy::primitives::U256; use anyhow::{bail, Result}; use axum::{http::StatusCode, routing::post, Json, Router}; -use ethereum_types::U256; use paladin::runtime::Runtime; -use proof_gen::{proof_types::GeneratedBlockProof, types::PlonkyProofIntern}; -use prover::ProverInput; +use proof_gen::proof_types::GeneratedBlockProof; +use prover::BlockProverInput; use serde::{Deserialize, Serialize}; use serde_json::to_writer; use tracing::{debug, error, info}; @@ -46,7 +46,7 @@ fn write_to_file( match file { Ok(file) => { - to_writer(file, &generated_block_proof.intern)?; + to_writer(file, &generated_block_proof)?; Ok(fully_qualified_file_name) } Err(e) => { @@ -57,8 +57,8 @@ fn write_to_file( #[derive(Serialize, Deserialize, Debug)] struct HttpProverInput { - prover_input: ProverInput, - previous: Option, + prover_input: BlockProverInput, + previous: Option, } async fn prove( @@ -73,7 +73,11 @@ async fn prove( match payload .prover_input - .prove(&runtime, payload.previous, save_inputs_on_error) + .prove( + &runtime, + payload.previous.map(futures::future::ok), + save_inputs_on_error, + ) .await { Ok(b_proof) => match write_to_file(output_dir, block_number, &b_proof) { diff --git a/leader/src/jerigon.rs b/leader/src/jerigon.rs index 1e497121..135e71ed 100644 --- a/leader/src/jerigon.rs +++ b/leader/src/jerigon.rs @@ -4,38 +4,49 @@ use std::{ path::PathBuf, }; +use alloy::providers::RootProvider; use anyhow::Result; +use common::block_interval::BlockInterval; use paladin::runtime::Runtime; -use proof_gen::types::PlonkyProofIntern; +use proof_gen::proof_types::GeneratedBlockProof; /// The main function for the jerigon mode. pub async fn jerigon_main( runtime: Runtime, rpc_url: &str, - block_number: u64, + block_interval: BlockInterval, checkpoint_block_number: u64, - previous: Option, - proof_output_path_opt: Option, + previous_proof: Option, + proof_output_dir_opt: Option, save_inputs_on_error: bool, ) -> Result<()> { - let prover_input = rpc::fetch_prover_input(rpc::FetchProverInputRequest { - rpc_url, - block_number, - checkpoint_block_number, - }) + let prover_input = rpc::prover_input( + RootProvider::new_http(rpc_url.parse()?), + block_interval, + checkpoint_block_number.into(), + ) .await?; - let proof = prover_input - .prove(&runtime, previous, save_inputs_on_error) - .await; + let block_proofs = prover_input + .prove(&runtime, previous_proof, save_inputs_on_error) + .await?; runtime.close().await?; - let proof = serde_json::to_vec(&proof?.intern)?; - write_proof(proof, proof_output_path_opt) + for block_proof in block_proofs { + let block_proof_str = serde_json::to_vec(&block_proof)?; + write_proof( + block_proof_str, + proof_output_dir_opt.clone().map(|mut path| { + path.push(format!("b{}.zkproof", block_proof.b_height)); + path + }), + )?; + } + Ok(()) } -fn write_proof(proof: Vec, proof_output_path_opt: Option) -> Result<()> { - match proof_output_path_opt { +fn write_proof(proof: Vec, proof_output_dir_opt: Option) -> Result<()> { + match proof_output_dir_opt { Some(p) => { if let Some(parent) = p.parent() { create_dir_all(parent)?; diff --git a/leader/src/main.rs b/leader/src/main.rs index 5fc4d767..f03822c6 100644 --- a/leader/src/main.rs +++ b/leader/src/main.rs @@ -4,11 +4,12 @@ use std::{fs::File, path::PathBuf}; use anyhow::Result; use clap::Parser; use cli::Command; -use common::prover_state::TableLoadStrategy; +use common::block_interval::BlockInterval; use dotenvy::dotenv; use ops::register; use paladin::runtime::Runtime; -use proof_gen::types::PlonkyProofIntern; +use proof_gen::proof_types::GeneratedBlockProof; +use tracing::info; use crate::utils::get_package_version; @@ -19,7 +20,7 @@ mod jerigon; mod stdio; mod utils; -fn get_previous_proof(path: Option) -> Result> { +fn get_previous_proof(path: Option) -> Result> { if path.is_none() { return Ok(None); } @@ -27,7 +28,7 @@ fn get_previous_proof(path: Option) -> Result let path = path.unwrap(); let file = File::open(path)?; let des = &mut serde_json::Deserializer::from_reader(&file); - let proof: PlonkyProofIntern = serde_path_to_error::deserialize(des)?; + let proof: GeneratedBlockProof = serde_path_to_error::deserialize(des)?; Ok(Some(proof)) } @@ -55,9 +56,6 @@ async fn main() -> Result<()> { // state here. args.prover_state_config .into_prover_state_manager() - // Use the monolithic load strategy for the prover state when running in - // emulation mode. - .with_load_strategy(TableLoadStrategy::Monolithic) .initialize()?; } @@ -89,21 +87,33 @@ async fn main() -> Result<()> { } Command::Jerigon { rpc_url, - block_number, + block_interval, checkpoint_block_number, previous_proof, - proof_output_path, + proof_output_dir, save_inputs_on_error, + block_time, } => { let previous_proof = get_previous_proof(previous_proof)?; + let mut block_interval = BlockInterval::new(&block_interval)?; + + if let BlockInterval::FollowFrom { + start_block: _, + block_time: ref mut block_time_opt, + } = block_interval + { + *block_time_opt = Some(block_time); + } + + info!("Proving interval {block_interval}"); jerigon::jerigon_main( runtime, &rpc_url, - block_number, + block_interval, checkpoint_block_number, previous_proof, - proof_output_path, + proof_output_dir, save_inputs_on_error, ) .await?; diff --git a/leader/src/stdio.rs b/leader/src/stdio.rs index b747419d..6cd421b7 100644 --- a/leader/src/stdio.rs +++ b/leader/src/stdio.rs @@ -2,25 +2,31 @@ use std::io::{Read, Write}; use anyhow::Result; use paladin::runtime::Runtime; -use proof_gen::types::PlonkyProofIntern; -use prover::ProverInput; +use proof_gen::proof_types::GeneratedBlockProof; +use prover::BlockProverInput; /// The main function for the stdio mode. pub async fn stdio_main( runtime: Runtime, - previous: Option, + previous: Option, save_inputs_on_error: bool, ) -> Result<()> { let mut buffer = String::new(); std::io::stdin().read_to_string(&mut buffer)?; let des = &mut serde_json::Deserializer::from_str(&buffer); - let input: ProverInput = serde_path_to_error::deserialize(des)?; - let proof = input.prove(&runtime, previous, save_inputs_on_error).await; + let input: BlockProverInput = serde_path_to_error::deserialize(des)?; + let proof = input + .prove( + &runtime, + previous.map(futures::future::ok), + save_inputs_on_error, + ) + .await; runtime.close().await?; let proof = proof?; - std::io::stdout().write_all(&serde_json::to_vec(&proof.intern)?)?; + std::io::stdout().write_all(&serde_json::to_vec(&proof)?)?; Ok(()) } diff --git a/ops/Cargo.toml b/ops/Cargo.toml index f22ad6ad..11c265aa 100644 --- a/ops/Cargo.toml +++ b/ops/Cargo.toml @@ -13,10 +13,7 @@ paladin-core = { workspace = true } serde = { workspace = true } evm_arithmetization = { workspace = true } proof_gen = { workspace = true } -trace_decoder = { workspace = true } tracing = { workspace = true } -rlp = { workspace = true } -ethereum-types = { workspace = true } keccak-hash = { workspace = true } common = { path = "../common" } diff --git a/prover/Cargo.toml b/prover/Cargo.toml index fc7fd24e..35f4bc5d 100644 --- a/prover/Cargo.toml +++ b/prover/Cargo.toml @@ -14,13 +14,16 @@ proof_gen = { workspace = true } trace_decoder = { workspace = true } tracing = { workspace = true } paladin-core = { workspace = true } -ethereum-types = { workspace = true } anyhow = { workspace = true } futures = { workspace = true } - -# Local dependencies +alloy.workspace = true +tokio = {workspace = true} +ruint = { version = "1.12.1", features = ["num-traits", "primitive-types"] } ops = { path = "../ops" } +common = { path = "../common" } +chrono = {workspace = true} +num-traits = "0.2.19" [features] default = [] -test_only = ["ops/test_only"] \ No newline at end of file +test_only = ["ops/test_only"] diff --git a/prover/src/lib.rs b/prover/src/lib.rs index 63e70444..73b7eb57 100644 --- a/prover/src/lib.rs +++ b/prover/src/lib.rs @@ -1,16 +1,19 @@ +use std::future::Future; use std::time::{Duration, Instant}; +use alloy::primitives::U256; use anyhow::Result; -use ethereum_types::U256; -#[cfg(feature = "test_only")] -use futures::stream::TryStreamExt; +use chrono::{DateTime, Utc}; +use futures::{future::BoxFuture, stream::FuturesOrdered, FutureExt, TryFutureExt, TryStreamExt}; +use num_traits::ToPrimitive as _; use ops::TxProof; use paladin::{ directive::{Directive, IndexedStream}, runtime::Runtime, }; -use proof_gen::{proof_types::GeneratedBlockProof, types::PlonkyProofIntern}; +use proof_gen::proof_types::GeneratedBlockProof; use serde::{Deserialize, Serialize}; +use tokio::sync::oneshot; use trace_decoder::{ processed_block_trace::ProcessingMeta, trace_protocol::BlockTrace, @@ -19,19 +22,26 @@ use trace_decoder::{ use tracing::info; #[derive(Debug, Deserialize, Serialize)] -pub struct ProverInput { +pub struct BlockProverInput { pub block_trace: BlockTrace, pub other_data: OtherBlockData, } fn resolve_code_hash_fn(_: &CodeHash) -> Vec { todo!() } - +#[derive(Debug, Clone)] pub struct BenchmarkedGeneratedBlockProof { pub proof: GeneratedBlockProof, pub prep_dur: Option, pub proof_dur: Option, pub agg_dur: Option, + pub total_dur: Option, + pub n_txs: u64, + pub gas_used: u64, + pub gas_used_per_tx: Vec, + pub difficulty: u64, + pub start_time: DateTime, + pub end_time: DateTime, } impl From for GeneratedBlockProof { @@ -40,20 +50,24 @@ impl From for GeneratedBlockProof { } } -impl ProverInput { +impl BlockProverInput { pub fn get_block_number(&self) -> U256 { - self.other_data.b_data.b_meta.block_number + self.other_data.b_data.b_meta.block_number.into() } + /// Evaluates a singular block #[cfg(not(feature = "test_only"))] pub async fn prove_and_benchmark( self, runtime: &Runtime, - previous: Option, + previous: Option>>, save_inputs_on_error: bool, ) -> Result { + // Start timing for preparation let prep_start = Instant::now(); + let start_time: DateTime = Utc::now(); + // Basic preparation let block_number = self.get_block_number(); let other_data = self.other_data; let txs = self.block_trace.into_txn_proof_gen_ir( @@ -61,6 +75,17 @@ impl ProverInput { other_data.clone(), )?; + let n_txs = txs.len(); + let gas_used = u64::try_from(other_data.b_data.b_meta.block_gas_used).expect("Overflow"); + let gas_used_per_tx = txs + .iter() + .map(|tx| { + u64::try_from(tx.gas_used_after - tx.gas_used_before).expect("Overflow of gas") + }) + .collect(); + let difficulty = other_data.b_data.b_meta.block_difficulty; + + // Get time took to prepare let prep_dur = prep_start.elapsed(); info!( @@ -69,6 +94,7 @@ impl ProverInput { prep_dur.as_secs_f64() ); + // Time the agg proof let proof_start = Instant::now(); let agg_proof = IndexedStream::from(txs) .map(&TxProof { @@ -87,16 +113,17 @@ impl ProverInput { proof_dur.as_secs_f64() ); + // if let proof_gen::proof_types::AggregatableProof::Agg(proof) = agg_proof { let agg_start = Instant::now(); - let prev = previous.map(|p| GeneratedBlockProof { - b_height: block_number.as_u64() - 1, - intern: p, - }); + let prev = match previous { + Some(it) => Some(it.await?), + None => None, + }; let block_proof = paladin::directive::Literal(proof) .map(&ops::BlockProof { - prev, + prev: prev.map(|prev| prev.proof), save_inputs_on_error, }) .run(runtime) @@ -110,12 +137,21 @@ impl ProverInput { agg_dur.as_secs_f64() ); + let end_time: DateTime = Utc::now(); + // Return the block proof Ok(BenchmarkedGeneratedBlockProof { proof: block_proof.0, + total_dur: Some(prep_start.elapsed()), proof_dur: Some(proof_dur), prep_dur: Some(prep_dur), agg_dur: Some(agg_dur), + n_txs: n_txs as u64, + gas_used, + gas_used_per_tx, + difficulty: u64::try_from(difficulty).expect("Difficulty overflow"), + start_time, + end_time, }) } else { anyhow::bail!("AggProof is is not GeneratedAggProof") @@ -127,9 +163,11 @@ impl ProverInput { pub async fn prove( self, runtime: &Runtime, - previous: Option, + previous: Option>>, save_inputs_on_error: bool, ) -> Result { + use anyhow::Context as _; + let block_number = self.get_block_number(); let other_data = self.other_data; let txs = self.block_trace.into_txn_proof_gen_ir( @@ -148,10 +186,13 @@ impl ProverInput { .await?; if let proof_gen::proof_types::AggregatableProof::Agg(proof) = agg_proof { - let prev = previous.map(|p| GeneratedBlockProof { - b_height: block_number.as_u64() - 1, - intern: p, - }); + let _block_number = block_number + .to_u64() + .context("block number overflows u64")?; + let prev = match previous { + Some(it) => Some(it.await?), + None => None, + }; let block_proof = paladin::directive::Literal(proof) .map(&ops::BlockProof { @@ -172,7 +213,7 @@ impl ProverInput { pub async fn prove( self, runtime: &Runtime, - _previous: Option, + _previous: Option>>, save_inputs_on_error: bool, ) -> Result { let block_number = self.get_block_number(); @@ -197,8 +238,98 @@ impl ProverInput { // Dummy proof to match expected output type. Ok(GeneratedBlockProof { - b_height: block_number.as_u64(), + b_height: block_number + .to_u64() + .expect("Block number should fit in a u64"), intern: proof_gen::proof_gen::dummy_proof()?, }) } } + +#[derive(Debug, Deserialize, Serialize)] +pub struct ProverInput { + pub blocks: Vec, +} + +impl ProverInput { + pub async fn prove_and_benchmark( + self, + runtime: &Runtime, + previous_proof: Option, + save_inputs_on_error: bool, + ) -> Result> { + let mut prev: Option>> = + previous_proof.map(|proof| Box::pin(futures::future::ok(proof)) as BoxFuture<_>); + + let results: FuturesOrdered<_> = self + .blocks + .into_iter() + .map(|block| { + let block_number = block.get_block_number(); + info!("Proving block {block_number}"); + + let (tx, rx) = oneshot::channel::(); + + let fut = block + .prove_and_benchmark(runtime, prev.take(), save_inputs_on_error) + .then(|proof| async { + let proof = proof?; + + if tx.send(proof.clone()).is_err() { + anyhow::bail!("Failed to send proof"); + } + + Ok(proof) + }) + .boxed(); + + prev = Some(Box::pin(rx.map_err(anyhow::Error::new))); + + fut + }) + .collect(); + + results.try_collect().await + } + + pub async fn prove( + self, + runtime: &Runtime, + previous_proof: Option, + save_inputs_on_error: bool, + ) -> Result> { + let mut prev: Option>> = + previous_proof.map(|proof| Box::pin(futures::future::ok(proof)) as BoxFuture<_>); + + let results: FuturesOrdered<_> = self + .blocks + .into_iter() + .map(|block| { + let block_number = block.get_block_number(); + info!("Proving block {block_number}"); + + let (tx, rx) = oneshot::channel::(); + + // Prove the block + let fut = block + .prove(runtime, prev.take(), save_inputs_on_error) + .then(|proof| async { + let proof = proof?; + + if tx.send(proof.clone()).is_err() { + anyhow::bail!("Failed to send proof"); + } + + Ok(proof) + }) + .boxed(); + + prev = Some(Box::pin(rx.map_err(anyhow::Error::new))); + + fut + }) + .collect(); + + results.try_collect().await + } +} diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index 2406dbd7..330b0643 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -16,22 +16,15 @@ anyhow = { workspace = true } serde = { workspace = true } trace_decoder = { workspace = true } serde_json = { workspace = true } -serde_path_to_error = { workspace = true } clap = { workspace = true } -ethereum-types = { workspace = true } evm_arithmetization = { workspace = true } thiserror = { workspace = true } +alloy.workspace = true futures = { workspace = true } - hex = "0.4.3" hex-literal = "0.4.1" -reqwest = { version = "0.11.22", default-features = false, features = [ - "json", - "rustls-tls", -] } -log = "0.4.21" - - -# Local dependencies +itertools = "0.13.0" +url = "2.5.0" common = { path = "../common" } prover = { path = "../prover" } +__compat_primitive-types = { version = "0.12.2", package = "primitive-types" } diff --git a/rpc/src/cli.rs b/rpc/src/cli.rs deleted file mode 100644 index 5afe67c7..00000000 --- a/rpc/src/cli.rs +++ /dev/null @@ -1,23 +0,0 @@ -use clap::{Parser, Subcommand, ValueHint}; - -#[derive(Parser)] -pub(crate) struct Cli { - #[command(subcommand)] - pub(crate) command: Commands, -} - -#[derive(Subcommand)] -pub(crate) enum Commands { - /// Fetch and generate prover input from the RPC endpoint - Fetch { - /// The RPC URL - #[arg(short = 'u', long, value_hint = ValueHint::Url)] - rpc_url: String, - /// The block number - #[arg(short, long)] - block_number: u64, - /// The checkpoint block number - #[arg(short, long, default_value_t = 0)] - checkpoint_block_number: u64, - }, -} diff --git a/rpc/src/init.rs b/rpc/src/init.rs deleted file mode 100644 index f9391489..00000000 --- a/rpc/src/init.rs +++ /dev/null @@ -1,11 +0,0 @@ -use tracing_subscriber::{prelude::*, util::SubscriberInitExt, EnvFilter}; -pub(crate) fn tracing() { - tracing_subscriber::Registry::default() - .with( - tracing_subscriber::fmt::layer() - .with_ansi(false) - .compact() - .with_filter(EnvFilter::from_default_env()), - ) - .init(); -} diff --git a/rpc/src/lib.rs b/rpc/src/lib.rs index 4e74ff49..36229763 100644 --- a/rpc/src/lib.rs +++ b/rpc/src/lib.rs @@ -1,2 +1,310 @@ -mod rpc; -pub use rpc::{fetch_prover_input, FetchProverInputRequest}; +use std::time::{Duration, Instant}; + +use alloy::primitives::B256; +use alloy::rpc::types::eth::BlockNumberOrTag; +use alloy::{ + providers::Provider, + rpc::types::eth::{Block, BlockId, Withdrawal}, + transports::Transport, +}; +use anyhow::Context as _; +use common::block_interval::BlockInterval; +use evm_arithmetization::proof::{BlockHashes, BlockMetadata}; +use futures::{StreamExt as _, TryStreamExt as _}; +use prover::{BlockProverInput, ProverInput}; +use serde::Deserialize; +use serde_json::json; +use trace_decoder::{ + trace_protocol::{ + BlockTrace, BlockTraceTriePreImages, CombinedPreImages, TrieCompact, TxnInfo, + }, + types::{BlockLevelData, OtherBlockData}, +}; + +/// Transaction traces retrieved from Erigon zeroTracer. +#[derive(Debug, Deserialize)] +pub struct ZeroTxResult { + #[serde(rename(deserialize = "txHash"))] + pub tx_hash: alloy::primitives::TxHash, + pub result: TxnInfo, +} + +/// Block witness retrieved from Erigon zeroTracer. +#[derive(Debug, Deserialize)] +pub struct ZeroBlockWitness(TrieCompact); + +/// When [fetching a block over RPC](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblockbynumber), +/// we can choose the transaction format, between: +/// - Full JSON. +/// - Just the hash. +/// +/// We only need the latter. +const BLOCK_WITH_FULL_TRANSACTIONS: bool = false; + +/// Retrieve block information from the provider +pub async fn get_block( + provider: &mut ProviderT, + target_block_id: BlockId, + full_transaction_data: bool, +) -> anyhow::Result +where + ProviderT: Provider, + TransportT: Transport + Clone, +{ + provider + .get_block(target_block_id, full_transaction_data.into()) + .await? + .context("block does not exist") +} + +pub async fn block_prover_input( + provider: ProviderT, + target_block_id: BlockId, + checkpoint_state_trie_root: B256, +) -> anyhow::Result +where + ProviderT: Provider, + TransportT: Transport + Clone, +{ + // Grab trace information + let tx_results = provider + .raw_request::<_, Vec>( + "debug_traceBlockByNumber".into(), + (target_block_id, json!({"tracer": "zeroTracer"})), + ) + .await?; + + // Grab block witness info (packed as combined trie pre-images) + let block_witness = provider + .raw_request::<_, ZeroBlockWitness>("eth_getWitness".into(), vec![target_block_id]) + .await?; + + // Grab block info + let target_block = provider + .get_block(target_block_id, BLOCK_WITH_FULL_TRANSACTIONS.into()) + .await? + .context("target block does not exist")?; + let target_block_number = target_block + .header + .number + .context("target block is missing field `number`")?; + let chain_id = provider.get_chain_id().await?; + + let mut prev_hashes = [alloy::primitives::B256::ZERO; 256]; + let concurrency = prev_hashes.len(); + futures::stream::iter( + prev_hashes + .iter_mut() + .rev() // fill RTL + .zip(std::iter::successors(Some(target_block_number), |it| { + it.checked_sub(1) + })) + .map(|(dst, n)| { + let provider = &provider; + async move { + let block = provider + .get_block(n.into(), BLOCK_WITH_FULL_TRANSACTIONS.into()) + .await + .context("couldn't get block")? + .context("no such block")?; + *dst = block.header.parent_hash; + anyhow::Ok(()) + } + }), + ) + .buffered(concurrency) + .try_collect::<()>() + .await + .context("couldn't fill previous hashes")?; + + // Assemble + Ok(BlockProverInput { + block_trace: BlockTrace { + trie_pre_images: BlockTraceTriePreImages::Combined(CombinedPreImages { + compact: block_witness.0, + }), + txn_info: tx_results.into_iter().map(|it| it.result).collect(), + code_db: Default::default(), + }, + other_data: OtherBlockData { + b_data: BlockLevelData { + b_meta: BlockMetadata { + block_beneficiary: target_block.header.miner.compat(), + block_timestamp: target_block.header.timestamp.into(), + block_number: target_block_number.into(), + block_difficulty: target_block.header.difficulty.into(), + block_random: target_block + .header + .mix_hash + .context("target block is missing field `mix_hash`")? + .compat(), + block_gaslimit: target_block.header.gas_limit.into(), + block_chain_id: chain_id.into(), + block_base_fee: target_block + .header + .base_fee_per_gas + .context("target block is missing field `base_fee_per_gas`")? + .into(), + block_gas_used: target_block.header.gas_used.into(), + block_bloom: target_block.header.logs_bloom.compat(), + }, + b_hashes: BlockHashes { + prev_hashes: prev_hashes.map(|it| it.compat()).into(), + cur_hash: target_block + .header + .hash + .context("target block is missing field `hash`")? + .compat(), + }, + withdrawals: target_block + .withdrawals + .into_iter() + .flatten() + .map( + |Withdrawal { + address, amount, .. + }| { (address.compat(), amount.into()) }, + ) + .collect(), + }, + checkpoint_state_trie_root: checkpoint_state_trie_root.compat(), + }, + }) +} + +/// Obtain the prover input for a given block interval +pub async fn prover_input( + mut provider: ProviderT, + block_interval: BlockInterval, + checkpoint_block_id: BlockId, +) -> anyhow::Result +where + ProviderT: Provider, + TransportT: Transport + Clone, +{ + // Grab interval checkpoint block state trie + let checkpoint_state_trie_root = get_block( + &mut provider, + checkpoint_block_id, + BLOCK_WITH_FULL_TRANSACTIONS, + ) + .await? + .header + .state_root; + + let mut block_proofs = Vec::new(); + let mut block_interval = block_interval.into_bounded_stream()?; + + while let Some(block_num) = block_interval.next().await { + let block_id = BlockId::Number(BlockNumberOrTag::Number(block_num)); + let block_prover_input = + block_prover_input(&provider, block_id, checkpoint_state_trie_root).await?; + block_proofs.push(block_prover_input); + } + Ok(ProverInput { + blocks: block_proofs, + }) +} + +/// Obtain the prover input for a given block interval +pub async fn benchmark_prover_input( + mut provider: ProviderT, + block_interval: BlockInterval, + checkpoint_block_id: BlockId, +) -> anyhow::Result +where + ProviderT: Provider, + TransportT: Transport + Clone, +{ + // Grab interval checkpoint block state trie + let checkpoint_state_trie_root = get_block( + &mut provider, + checkpoint_block_id, + BLOCK_WITH_FULL_TRANSACTIONS, + ) + .await? + .header + .state_root; + + let mut block_proofs = Vec::new(); + let mut block_fetch_times = Vec::new(); + let mut block_interval = block_interval.into_bounded_stream()?; + + while let Some(block_num) = block_interval.next().await { + let block_id = BlockId::Number(BlockNumberOrTag::Number(block_num)); + let start = Instant::now(); + let block_prover_input = + block_prover_input(&provider, block_id, checkpoint_state_trie_root).await?; + block_proofs.push(block_prover_input); + block_fetch_times.push(start.elapsed()) + } + Ok(BenchmarkedProverInput { + proverinput: ProverInput { + blocks: block_proofs, + }, + fetch_times: block_fetch_times, + }) +} + +pub struct BenchmarkedProverInput { + /// The blocks [BlockProverInput], stored just like [ProverInput] + pub proverinput: ProverInput, + /// Includes the [Duration] of how long it took to fetch the + /// [BlockProverInput] of the same index in self.blocks + pub fetch_times: Vec, +} + +impl From for ProverInput { + fn from(value: BenchmarkedProverInput) -> Self { + value.proverinput + } +} + +impl BenchmarkedProverInput { + /// Iterate with the fetch times + pub fn iter_with_fetch_times(&self) -> impl Iterator { + self.proverinput.blocks.iter().zip(self.fetch_times.iter()) + } +} + +trait Compat { + fn compat(self) -> Out; +} + +impl Compat<__compat_primitive_types::H160> for alloy::primitives::Address { + fn compat(self) -> __compat_primitive_types::H160 { + let alloy::primitives::Address(alloy::primitives::FixedBytes(arr)) = self; + __compat_primitive_types::H160(arr) + } +} + +impl Compat<__compat_primitive_types::H256> for alloy::primitives::B256 { + fn compat(self) -> __compat_primitive_types::H256 { + let alloy::primitives::FixedBytes(arr) = self; + __compat_primitive_types::H256(arr) + } +} + +impl Compat<[__compat_primitive_types::U256; 8]> for alloy::primitives::Bloom { + fn compat(self) -> [__compat_primitive_types::U256; 8] { + let alloy::primitives::Bloom(alloy::primitives::FixedBytes(src)) = self; + // have u8 * 256 + // want U256 * 8 + // (no unsafe, no unstable) + let mut chunks = src.chunks_exact(32); + let dst = core::array::from_fn(|_ix| { + // This is a bit spicy because we're going from an uninterpeted array of bytes + // to wide integers, but we trust this `From` impl to do the right thing + __compat_primitive_types::U256::from( + <[u8; 32]>::try_from(chunks.next().unwrap()).unwrap(), + ) + }); + assert_eq!(chunks.len(), 0); + dst + } +} + +#[test] +fn bloom() { + let _did_not_panic = alloy::primitives::Bloom::ZERO.compat(); +} diff --git a/rpc/src/main.rs b/rpc/src/main.rs index 00bfc4c4..a38ee7a7 100644 --- a/rpc/src/main.rs +++ b/rpc/src/main.rs @@ -1,33 +1,51 @@ -use std::io::Write; +use std::io; -use anyhow::Result; -use clap::Parser; -use cli::Commands; -use rpc::{fetch_prover_input, FetchProverInputRequest}; +use alloy::{providers::RootProvider, rpc::types::eth::BlockId}; +use clap::{Parser, ValueHint}; +use common::block_interval::BlockInterval; +use tracing_subscriber::{prelude::*, EnvFilter}; +use url::Url; -mod cli; -mod init; -mod rpc; +#[derive(Parser)] +pub enum Args { + /// Fetch and generate prover input from the RPC endpoint. + Fetch { + /// The RPC URL. + #[arg(short = 'u', long, value_hint = ValueHint::Url)] + rpc_url: Url, + /// The block number. + #[arg(short, long)] + block_number: BlockId, + /// The checkpoint block number. + #[arg(short, long, default_value = "0")] + checkpoint_block_number: BlockId, + }, +} #[tokio::main] -async fn main() -> Result<()> { - init::tracing(); - let args = cli::Cli::parse(); +async fn main() -> anyhow::Result<()> { + tracing_subscriber::Registry::default() + .with( + tracing_subscriber::fmt::layer() + .with_ansi(false) + .compact() + .with_filter(EnvFilter::from_default_env()), + ) + .init(); + + let Args::Fetch { + rpc_url, + block_number, + checkpoint_block_number, + } = Args::parse(); + let prover_input = rpc::prover_input( + RootProvider::new_http(rpc_url), + BlockInterval::SingleBlockId(block_number), + checkpoint_block_number, + ) + .await?; + + serde_json::to_writer_pretty(io::stdout(), &prover_input)?; - match args.command { - Commands::Fetch { - rpc_url, - block_number, - checkpoint_block_number, - } => { - let prover_input = fetch_prover_input(FetchProverInputRequest { - rpc_url: &rpc_url, - block_number, - checkpoint_block_number, - }) - .await?; - std::io::stdout().write_all(&serde_json::to_vec(&prover_input)?)?; - } - } Ok(()) } diff --git a/tools/debug_block.sh b/tools/debug_block.sh deleted file mode 100755 index 74323e20..00000000 --- a/tools/debug_block.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -# Args: -# 1 --> Block idx -# 2 --> Rpc endpoint:port (eg. http://35.246.1.96:8545) - -export RUST_BACKTRACE=1 -export RUST_MIN_STACK=8388608 -export RUST_LOG=mpt_trie=info,trace_decoder=info,plonky2=info,evm_arithmetization=trace,leader=info -export RUSTFLAGS='-Ctarget-cpu=native' - -# Speciying smallest ranges, as we won't need them anyway. -export ARITHMETIC_CIRCUIT_SIZE="16..17" -export BYTE_PACKING_CIRCUIT_SIZE="9..10" -export CPU_CIRCUIT_SIZE="12..13" -export KECCAK_CIRCUIT_SIZE="14..15" -export KECCAK_SPONGE_CIRCUIT_SIZE="9..10" -export LOGIC_CIRCUIT_SIZE="12..13" -export MEMORY_CIRCUIT_SIZE="17..18" - -OUTPUT_DIR="debug" -OUT_DUMMY_PROOF_PATH="${OUTPUT_DIR}/b${1}.zkproof" -OUT_LOG_PATH="${OUTPUT_DIR}/b${1}.log" - -echo "Testing block ${1}..." -mkdir -p $OUTPUT_DIR - -cargo r --release --features test_only --bin leader -- -n 1 --runtime in-memory jerigon --rpc-url "$2" --block-number "$1" --checkpoint-block-number "$(($1-1))" --proof-output-path $OUT_DUMMY_PROOF_PATH > $OUT_LOG_PATH 2>&1 -retVal=$? -if [ $retVal -ne 0 ]; then - # Some error occured. - echo "Witness generation for block ${1} errored. See ${OUT_LOG_PATH} for more details." -else - echo "Witness generation for block ${1} succeeded." - # Remove the log / dummy proof on success. - rm $OUT_DUMMY_PROOF_PATH - rm $OUT_LOG_PATH -fi - diff --git a/tools/prove_blocks.sh b/tools/prove_blocks.sh index c27317ef..62766157 100755 --- a/tools/prove_blocks.sh +++ b/tools/prove_blocks.sh @@ -5,48 +5,99 @@ # 2 --> End block index (inclusive) # 3 --> Rpc endpoint:port (eg. http://35.246.1.96:8545) # 4 --> Ignore previous proofs (boolean) +# 5 --> Test run only flag `test_only` (optional) +export RUST_MIN_STACK=33554432 export RUST_BACKTRACE=1 -export RUST_LOG=mpt_trie=info,trace_decoder=info,plonky2=info,evm_arithmetization=trace,leader=info -export RUSTFLAGS='-Ctarget-cpu=native' +export RUST_LOG=info +# Disable the lld linker for now, as it's causing issues with the linkme package. +# https://github.com/rust-lang/rust/pull/124129 +# https://github.com/dtolnay/linkme/pull/88 +export RUSTFLAGS='-C target-cpu=native -Zlinker-features=-lld' -export ARITHMETIC_CIRCUIT_SIZE="16..23" -export BYTE_PACKING_CIRCUIT_SIZE="9..21" -export CPU_CIRCUIT_SIZE="12..25" -export KECCAK_CIRCUIT_SIZE="14..20" -export KECCAK_SPONGE_CIRCUIT_SIZE="9..15" -export LOGIC_CIRCUIT_SIZE="12..18" -export MEMORY_CIRCUIT_SIZE="17..28" +if [[ $5 == "test_only" ]]; then + # Circuit sizes don't matter in test_only mode, so we keep them minimal. + export ARITHMETIC_CIRCUIT_SIZE="16..17" + export BYTE_PACKING_CIRCUIT_SIZE="9..10" + export CPU_CIRCUIT_SIZE="12..13" + export KECCAK_CIRCUIT_SIZE="14..15" + export KECCAK_SPONGE_CIRCUIT_SIZE="9..10" + export LOGIC_CIRCUIT_SIZE="12..13" + export MEMORY_CIRCUIT_SIZE="17..18" +else + export ARITHMETIC_CIRCUIT_SIZE="16..23" + export BYTE_PACKING_CIRCUIT_SIZE="9..21" + export CPU_CIRCUIT_SIZE="12..25" + export KECCAK_CIRCUIT_SIZE="14..20" + export KECCAK_SPONGE_CIRCUIT_SIZE="9..15" + export LOGIC_CIRCUIT_SIZE="12..18" + export MEMORY_CIRCUIT_SIZE="17..28" +fi PROOF_OUTPUT_DIR="proofs" +OUT_LOG_PATH="${PROOF_OUTPUT_DIR}/b${i}.log" ALWAYS_WRITE_LOGS=0 # Change this to `1` if you always want logs to be written. - TOT_BLOCKS=$(($2-$1+1)) + +START_BLOCK=$1 +END_BLOCK=$2 +NODE_RPC_URL=$3 IGNORE_PREVIOUS_PROOFS=$4 -echo "Proving blocks ${1}..=${2}... (Total: ${TOT_BLOCKS})" + mkdir -p $PROOF_OUTPUT_DIR -for ((i=$1; i<=$2; i++)) -do - echo "Proving block ${i}..." - OUT_PROOF_PATH="${PROOF_OUTPUT_DIR}/b${i}.zkproof" - OUT_LOG_PATH="${PROOF_OUTPUT_DIR}/b${i}.log" +if [ $IGNORE_PREVIOUS_PROOFS ]; then + # Set checkpoint height to previous block number for the first block in range + prev_proof_num=$(($1-1)) + PREV_PROOF_EXTRA_ARG="--checkpoint-block-number ${prev_proof_num}" +else + if [ $1 -gt 1 ]; then + prev_proof_num=$(($1-1)) + PREV_PROOF_EXTRA_ARG="-f ${PROOF_OUTPUT_DIR}/b${prev_proof_num}.zkproof" + fi +fi + +# Convert hex to decimal parameters +if [[ $START_BLOCK == 0x* ]]; then + START_BLOCK=$((16#${START_BLOCK#"0x"})) +fi +if [[ $END_BLOCK == 0x* ]]; then + END_BLOCK=$((16#${END_BLOCK#"0x"})) +fi - if [ $IGNORE_PREVIOUS_PROOFS ]; then - # Set checkpoint height to previous block number - prev_proof_num=$((i-1)) - PREV_PROOF_EXTRA_ARG="--checkpoint-block-number ${prev_proof_num}" - else - if [ $i -gt 1 ]; then - prev_proof_num=$((i-1)) - PREV_PROOF_EXTRA_ARG="-f ${PROOF_OUTPUT_DIR}/b${prev_proof_num}.zkproof" +# Define block interval +if [ $START_BLOCK == $END_BLOCK ]; then + BLOCK_INTERVAL=$((16#${START_BLOCK#"0x"})) +else + BLOCK_INTERVAL=$START_BLOCK..=$END_BLOCK +fi + + +# If we set test_only flag, we'll generate a dummy +# proof. This is useful for quickly testing decoding and all of the +# other non-proving code. +if [[ $5 == "test_only" ]]; then + # test only run + echo "Proving blocks ${BLOCK_INTERVAL} in a test_only mode now... (Total: ${TOT_BLOCKS})" + cargo r --release --features test_only --bin leader -- --runtime in-memory --load-strategy on-demand jerigon --rpc-url "$NODE_RPC_URL" --block-interval $BLOCK_INTERVAL --proof-output-dir $PROOF_OUTPUT_DIR $PREV_PROOF_EXTRA_ARG > $OUT_LOG_PATH 2>&1 + if grep 'Successfully generated witness for block' $OUT_LOG_PATH; then + echo "Success - Note this was just a test, not a proof" + # Remove the log on success if we don't want to keep it. + if [ $ALWAYS_WRITE_LOGS -ne 1 ]; then + rm $OUT_LOG_PATH fi + exit + else + echo "Failed to create a witness" + exit 1 fi +else + # normal run + echo "Proving blocks ${BLOCK_INTERVAL} now... (Total: ${TOT_BLOCKS})" + cargo r --release --bin leader -- --runtime in-memory --load-strategy on-demand jerigon --rpc-url "$3" --block-interval $BLOCK_INTERVAL --proof-output-dir $PROOF_OUTPUT_DIR $PREV_PROOF_EXTRA_ARG > $OUT_LOG_PATH 2>&1 - cargo r --release --bin leader -- --runtime in-memory jerigon --rpc-url "$3" --block-number $i --proof-output-path $OUT_PROOF_PATH $PREV_PROOF_EXTRA_ARG > $OUT_LOG_PATH 2>&1 - retVal=$? if [ $retVal -ne 0 ]; then # Some error occured. @@ -58,6 +109,10 @@ do rm $OUT_LOG_PATH fi fi -done -echo "Successfully generated ${TOT_BLOCKS} proofs!" \ No newline at end of file + echo "Successfully generated ${TOT_BLOCKS} proofs!" +fi + + + + diff --git a/tools/simple_test.sh b/tools/simple_test.sh index f00e34ce..292c2ba9 100755 --- a/tools/simple_test.sh +++ b/tools/simple_test.sh @@ -20,7 +20,10 @@ export TOKIO_WORKER_THREADS=$num_procs export RUST_MIN_STACK=33554432 export RUST_BACKTRACE=full export RUST_LOG=info -export RUSTFLAGS='-C target-cpu=native' +# Disable the lld linker for now, as it's causing issues with the linkme package. +# https://github.com/rust-lang/rust/pull/124129 +# https://github.com/dtolnay/linkme/pull/88 +export RUSTFLAGS='-C target-cpu=native -Zlinker-features=-lld' if [[ $1 == "test_only" ]]; then # Circuit sizes don't matter in test_only mode, so we keep them minimal. @@ -47,7 +50,7 @@ fi # proof. This is useful for quickly testing decoding and all of the # other non-proving code. if [[ $1 == "test_only" ]]; then - cargo run --release --features test_only --bin leader -- --runtime in-memory stdio < witness.json | tee test.out + cargo run --release --features test_only --bin leader -- --runtime in-memory --load-strategy on-demand stdio < witness.json | tee test.out if grep 'Successfully generated witness for block' test.out; then echo "Success - Note this was just a test, not a proof" exit @@ -60,14 +63,14 @@ fi cargo build --release --jobs "$num_procs" start_time=$(date +%s%N) -../target/release/leader --runtime in-memory stdio < witness.json | tee leader.out +../target/release/leader --runtime in-memory --load-strategy monolithic stdio < witness.json | tee leader.out end_time=$(date +%s%N) tail -n 1 leader.out > proof.json ../target/release/verifier -f proof.json | tee verify.out -if grep 'Proof verified successfully!' verify.out; then +if grep -q 'Proof verified successfully!' verify.out; then duration_ns=$((end_time - start_time)) duration_sec=$(echo "$duration_ns / 1000000000" | bc -l) echo "Success!" diff --git a/verifier/src/main.rs b/verifier/src/main.rs index 271a1346..5e740255 100644 --- a/verifier/src/main.rs +++ b/verifier/src/main.rs @@ -3,7 +3,7 @@ use std::fs::File; use anyhow::Result; use clap::Parser; use dotenvy::dotenv; -use proof_gen::types::PlonkyProofIntern; +use proof_gen::proof_types::GeneratedBlockProof; use serde_json::Deserializer; use tracing::info; @@ -17,14 +17,14 @@ fn main() -> Result<()> { let args = cli::Cli::parse(); let file = File::open(args.file_path)?; let des = &mut Deserializer::from_reader(&file); - let input: PlonkyProofIntern = serde_path_to_error::deserialize(des)?; + let input: GeneratedBlockProof = serde_path_to_error::deserialize(des)?; let verifer = args .prover_state_config .into_prover_state_manager() .verifier()?; - match verifer.verify(&input) { + match verifer.verify(&input.intern) { Ok(_) => info!("Proof verified successfully!"), Err(e) => info!("Proof verification failed with error: {:?}", e), };