diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 96b94c6e..180dad5b 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -32,6 +32,8 @@ jobs: exclude: - guest: stateless-validator-ethrex zkvm: airbender + - guest: stateless-validator-reth + zkvm: airbender - guest: stateless-validator-ethrex zkvm: openvm - guest: stateless-validator-ethrex diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index ae0fc7fc..b3442f24 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -89,4 +89,6 @@ jobs: --target riscv32imac-unknown-none-elf \ --exclude integration-tests \ --exclude block-encoding-length \ - --exclude stateless-validator-ethrex + --exclude stateless-validator-ethrex \ + --exclude stateless-validator-reth \ + --exclude stateless-validator-common diff --git a/Cargo.lock b/Cargo.lock index c087a905..e2c645c2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -304,7 +304,10 @@ dependencies = [ "alloy-eips", "alloy-primitives", "alloy-rlp", + "alloy-serde", "derive_more 2.1.1", + "rand 0.8.5", + "serde", "strum", ] @@ -1027,7 +1030,7 @@ dependencies = [ [[package]] name = "block-encoding-length" -version = "0.3.0" +version = "0.4.0" dependencies = [ "alloy-consensus", "alloy-eips", @@ -1658,9 +1661,9 @@ dependencies = [ [[package]] name = "data-encoding" -version = "2.9.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2330da5de22e8a3cb63252ce2abb30116bf5265e89c0e01bc17015ce30a476" +checksum = "d7a1e2f27636f116493b8b860f5546edb47c8d8f8ea73e1d2a20be88e28d1fea" [[package]] name = "datatest-stable" @@ -2033,6 +2036,17 @@ dependencies = [ "uint 0.10.0", ] +[[package]] +name = "ethereum_hashing" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c853bd72c9e5787f8aafc3df2907c2ed03cff3150c3acd94e2e53a98ab70a8ab" +dependencies = [ + "cpufeatures", + "ring", + "sha2", +] + [[package]] name = "ethereum_serde_utils" version = "0.8.0" @@ -2689,7 +2703,7 @@ dependencies = [ [[package]] name = "guest" -version = "0.3.0" +version = "0.4.0" dependencies = [ "ere-io", "ere-platform-trait", @@ -2721,9 +2735,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3c0b69cfcb4e1b9f1bf2f53f95f766e4661169728ec61cd3fe5a0166f2d1386" +checksum = "2f44da3a8150a6703ed5d34e164b875fd14c2cdab9af1252a9a1020bde2bdc54" dependencies = [ "atomic-waker", "bytes", @@ -3172,8 +3186,9 @@ dependencies = [ [[package]] name = "integration-tests" -version = "0.3.0" +version = "0.4.0" dependencies = [ + "alloy-primitives", "block-encoding-length", "ere-dockerized", "ere-io", @@ -3181,13 +3196,17 @@ dependencies = [ "flate2", "guest", "rayon", + "reth-chainspec", + "reth-evm-ethereum", "reth-stateless", "serde", "serde_json", "sha2", + "stateless-validator-common", "stateless-validator-ethrex", "stateless-validator-reth", "tar", + "tempfile", "tracing", "tracing-subscriber", ] @@ -4370,7 +4389,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d" dependencies = [ "anyhow", - "itertools 0.14.0", + "itertools 0.10.5", "proc-macro2", "quote", "syn 2.0.112", @@ -4892,6 +4911,16 @@ dependencies = [ "url", ] +[[package]] +name = "reth-payload-validator" +version = "1.9.3" +source = "git+https://github.com/paradigmxyz/reth?rev=cfde951976bfa9100a6d9f806e06fb539ae25241#cfde951976bfa9100a6d9f806e06fb539ae25241" +dependencies = [ + "alloy-consensus", + "alloy-rpc-types-engine", + "reth-primitives-traits", +] + [[package]] name = "reth-primitives-traits" version = "1.9.3" @@ -5421,9 +5450,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.35" +version = "0.23.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "533f54bc6a7d4f647e46ad909549eda97bf5afc1585190ef692b4286b198bd8f" +checksum = "c665f33d38cea657d9614f766881e4d510e0eda4239891eea56b4cadcf01801b" dependencies = [ "once_cell", "rustls-pki-types", @@ -5978,6 +6007,22 @@ dependencies = [ "der", ] +[[package]] +name = "ssz_types" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b55bedc9a18ed2860a46d6beb4f4082416ee1d60be0cc364cebdcdddc7afd4" +dependencies = [ + "ethereum_serde_utils", + "ethereum_ssz", + "itertools 0.13.0", + "serde", + "serde_derive", + "smallvec", + "tree_hash", + "typenum", +] + [[package]] name = "stable_deref_trait" version = "1.2.1" @@ -5986,23 +6031,33 @@ checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" [[package]] name = "stateless-validator-common" -version = "0.3.0" +version = "0.4.0" dependencies = [ - "reth-stateless", + "alloy-eips", + "alloy-primitives", + "anyhow", + "ethereum_ssz", + "ethereum_ssz_derive", "rkyv", "serde", + "serde_with", "sha2", + "ssz_types", + "tree_hash", + "tree_hash_derive", + "typenum", ] [[package]] name = "stateless-validator-ethrex" -version = "0.3.0" +version = "0.4.0" dependencies = [ "alloy-consensus", "alloy-eips", "alloy-genesis", "alloy-rlp", "anyhow", + "bytes", "ere-io", "ere-zkvm-interface", "ethrex-common", @@ -6011,27 +6066,42 @@ dependencies = [ "ethrex-vm", "guest", "guest_program", + "reth-stateless", "rkyv", "stateless-validator-common", + "stateless-validator-reth", ] [[package]] name = "stateless-validator-reth" -version = "0.3.0" +version = "0.4.0" dependencies = [ + "alloy-consensus", + "alloy-eips", + "alloy-genesis", + "alloy-primitives", + "alloy-rlp", + "alloy-rpc-types-engine", "anyhow", "ere-io", "ere-zkvm-interface", + "ethereum_ssz", "guest", "once_cell", "reth-chainspec", "reth-ethereum-primitives", "reth-evm-ethereum", + "reth-payload-validator", "reth-primitives-traits", "reth-stateless", "serde", + "serde_with", + "sha2", "sparsestate", + "ssz_types", "stateless-validator-common", + "tree_hash", + "tree_hash_derive", ] [[package]] @@ -6364,9 +6434,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" +checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" dependencies = [ "futures-core", "pin-project-lite", @@ -6538,6 +6608,31 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "tree_hash" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee44f4cef85f88b4dea21c0b1f58320bdf35715cf56d840969487cff00613321" +dependencies = [ + "alloy-primitives", + "ethereum_hashing", + "ethereum_ssz", + "smallvec", + "typenum", +] + +[[package]] +name = "tree_hash_derive" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bee2ea1551f90040ab0e34b6fb7f2fa3bad8acc925837ac654f2c78a13e3089" +dependencies = [ + "darling 0.20.11", + "proc-macro2", + "quote", + "syn 2.0.112", +] + [[package]] name = "try-lock" version = "0.2.5" diff --git a/Cargo.toml b/Cargo.toml index a257ce86..4aa0a4ea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,7 +18,7 @@ resolver = "2" edition = "2024" license = "MIT OR Apache-2.0" rust-version = "1.88" -version = "0.3.0" +version = "0.4.0" [workspace.lints.rust] missing_debug_implementations = "warn" @@ -43,6 +43,8 @@ serde = { version = "1.0", default-features = false } serde_json = { version = "*", default-features = false } serde_with = { version = "3", default-features = false } sha2 = { version = "0.10.9", default-features = false } +tempfile = { version = "3.6.0", default-features = false } +bytes = { version = "1.6.0", default-features = false } # test flate2 = "1.1.5" @@ -55,16 +57,19 @@ tracing-subscriber = "0.3.22" alloy-consensus = { version = "1.1.2", default-features = false } alloy-eips = { version = "1.1.2", default-features = false } alloy-genesis = { version = "1.1.2", default-features = false } +alloy-rpc-types-engine = { version = "1.1.2", default-features = false } alloy-primitives = { version = "1.4.1", default-features = false } alloy-rlp = { version = "0.3.10", default-features = false } alloy-trie = { version = "0.9.1", default-features = false } # reth reth-chainspec = { git = "https://github.com/paradigmxyz/reth", rev = "cfde951976bfa9100a6d9f806e06fb539ae25241", default-features = false } +reth-ethereum-payload-builder = { git = "https://github.com/paradigmxyz/reth", rev = "cfde951976bfa9100a6d9f806e06fb539ae25241", default-features = false } reth-ethereum-primitives = { git = "https://github.com/paradigmxyz/reth", rev = "cfde951976bfa9100a6d9f806e06fb539ae25241", default-features = false } reth-evm-ethereum = { git = "https://github.com/paradigmxyz/reth", rev = "cfde951976bfa9100a6d9f806e06fb539ae25241", default-features = false } reth-primitives-traits = { git = "https://github.com/paradigmxyz/reth", rev = "cfde951976bfa9100a6d9f806e06fb539ae25241", default-features = false } reth-stateless = { git = "https://github.com/paradigmxyz/reth", rev = "cfde951976bfa9100a6d9f806e06fb539ae25241", default-features = false } +reth-payload-validator = { git = "https://github.com/paradigmxyz/reth", rev = "cfde951976bfa9100a6d9f806e06fb539ae25241", default-features = false } # ethrex ethrex-common = { git = "https://github.com/lambdaclass/ethrex.git", rev = "e6d70854d0fe3b0f29ed8961e5cbfc5de7bdd7d1", default-features = false } @@ -73,6 +78,12 @@ ethrex-rlp = { git = "https://github.com/lambdaclass/ethrex.git", rev = "e6d7085 ethrex-rpc = { git = "https://github.com/lambdaclass/ethrex.git", rev = "e6d70854d0fe3b0f29ed8961e5cbfc5de7bdd7d1", default-features = false } ethrex-vm = { git = "https://github.com/lambdaclass/ethrex.git", rev = "e6d70854d0fe3b0f29ed8961e5cbfc5de7bdd7d1", default-features = false } +# lighthouse +tree_hash = "0.10.0" +tree_hash_derive = "0.10.0" +ssz_types = { version = "0.11", default-features = false } +typenum = { version = "1.18", default-features = false } + # ssz ethereum_ssz = "0.9" ethereum_ssz_derive = "0.9" diff --git a/bin/block-encoding-length/airbender/Cargo.lock b/bin/block-encoding-length/airbender/Cargo.lock index ab9d35aa..2fe539d3 100644 --- a/bin/block-encoding-length/airbender/Cargo.lock +++ b/bin/block-encoding-length/airbender/Cargo.lock @@ -618,7 +618,7 @@ dependencies = [ [[package]] name = "block-encoding-length" -version = "0.3.0" +version = "0.4.0" dependencies = [ "alloy-consensus", "alloy-eips", @@ -1305,7 +1305,7 @@ dependencies = [ [[package]] name = "guest" -version = "0.3.0" +version = "0.4.0" dependencies = [ "ere-io", "ere-platform-trait", diff --git a/bin/block-encoding-length/openvm/Cargo.lock b/bin/block-encoding-length/openvm/Cargo.lock index 933e157d..a8fff44e 100644 --- a/bin/block-encoding-length/openvm/Cargo.lock +++ b/bin/block-encoding-length/openvm/Cargo.lock @@ -618,7 +618,7 @@ dependencies = [ [[package]] name = "block-encoding-length" -version = "0.3.0" +version = "0.4.0" dependencies = [ "alloy-consensus", "alloy-eips", @@ -1314,7 +1314,7 @@ dependencies = [ [[package]] name = "guest" -version = "0.3.0" +version = "0.4.0" dependencies = [ "ere-io", "ere-platform-trait", diff --git a/bin/block-encoding-length/pico/Cargo.lock b/bin/block-encoding-length/pico/Cargo.lock index fdd51c09..6d3e720e 100644 --- a/bin/block-encoding-length/pico/Cargo.lock +++ b/bin/block-encoding-length/pico/Cargo.lock @@ -799,7 +799,7 @@ dependencies = [ [[package]] name = "block-encoding-length" -version = "0.3.0" +version = "0.4.0" dependencies = [ "alloy-consensus", "alloy-eips", @@ -1902,7 +1902,7 @@ dependencies = [ [[package]] name = "guest" -version = "0.3.0" +version = "0.4.0" dependencies = [ "ere-io", "ere-platform-trait", diff --git a/bin/block-encoding-length/risc0/Cargo.lock b/bin/block-encoding-length/risc0/Cargo.lock index 956a0fa5..42054d2a 100644 --- a/bin/block-encoding-length/risc0/Cargo.lock +++ b/bin/block-encoding-length/risc0/Cargo.lock @@ -812,7 +812,7 @@ dependencies = [ [[package]] name = "block-encoding-length" -version = "0.3.0" +version = "0.4.0" dependencies = [ "alloy-consensus", "alloy-eips", @@ -1604,7 +1604,7 @@ dependencies = [ [[package]] name = "guest" -version = "0.3.0" +version = "0.4.0" dependencies = [ "ere-io", "ere-platform-trait", diff --git a/bin/block-encoding-length/sp1/Cargo.lock b/bin/block-encoding-length/sp1/Cargo.lock index d107e995..4f8a741e 100644 --- a/bin/block-encoding-length/sp1/Cargo.lock +++ b/bin/block-encoding-length/sp1/Cargo.lock @@ -646,7 +646,7 @@ dependencies = [ [[package]] name = "block-encoding-length" -version = "0.3.0" +version = "0.4.0" dependencies = [ "alloy-consensus", "alloy-eips", @@ -1348,7 +1348,7 @@ dependencies = [ [[package]] name = "guest" -version = "0.3.0" +version = "0.4.0" dependencies = [ "ere-io", "ere-platform-trait", diff --git a/bin/block-encoding-length/zisk/Cargo.lock b/bin/block-encoding-length/zisk/Cargo.lock index 0969b5fa..6e2b8388 100644 --- a/bin/block-encoding-length/zisk/Cargo.lock +++ b/bin/block-encoding-length/zisk/Cargo.lock @@ -628,7 +628,7 @@ dependencies = [ [[package]] name = "block-encoding-length" -version = "0.3.0" +version = "0.4.0" dependencies = [ "alloy-consensus", "alloy-eips", @@ -1318,7 +1318,7 @@ dependencies = [ [[package]] name = "guest" -version = "0.3.0" +version = "0.4.0" dependencies = [ "ere-io", "ere-platform-trait", diff --git a/bin/stateless-validator-ethrex/risc0/Cargo.lock b/bin/stateless-validator-ethrex/risc0/Cargo.lock index 05fdc7dd..22381541 100644 --- a/bin/stateless-validator-ethrex/risc0/Cargo.lock +++ b/bin/stateless-validator-ethrex/risc0/Cargo.lock @@ -40,6 +40,44 @@ version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" +[[package]] +name = "alloy-primitives" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6a0fb18dd5fb43ec5f0f6a20be1ce0287c79825827de5744afaa6c957737c33" +dependencies = [ + "alloy-rlp", + "bytes", + "cfg-if", + "const-hex", + "derive_more 2.0.1", + "foldhash 0.2.0", + "hashbrown 0.16.1", + "indexmap 2.12.1", + "itoa", + "k256", + "keccak-asm", + "paste", + "proptest", + "rand 0.9.2", + "rapidhash", + "ruint", + "rustc-hash", + "serde", + "sha3", + "tiny-keccak", +] + +[[package]] +name = "alloy-rlp" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f70d83b765fdc080dbcd4f4db70d8d23fe4761f2f02ebfa9146b833900634b4" +dependencies = [ + "arrayvec", + "bytes", +] + [[package]] name = "android_system_properties" version = "0.1.5" @@ -112,9 +150,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d69eab57e8d2663efa5c63135b2af4f396d66424f88954c21104125ab6b3e6bc" dependencies = [ "ark-ec", - "ark-ff", + "ark-ff 0.5.0", "ark-r1cs-std", - "ark-std", + "ark-std 0.5.0", ] [[package]] @@ -126,14 +164,14 @@ dependencies = [ "ahash", "ark-crypto-primitives-macros", "ark-ec", - "ark-ff", + "ark-ff 0.5.0", "ark-relations", - "ark-serialize", + "ark-serialize 0.5.0", "ark-snark", - "ark-std", + "ark-std 0.5.0", "blake2", "derivative", - "digest", + "digest 0.10.7", "fnv", "merlin", "sha2", @@ -157,10 +195,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43d68f2d516162846c1238e755a7c4d131b892b70cc70c471a8e3ca3ed818fce" dependencies = [ "ahash", - "ark-ff", + "ark-ff 0.5.0", "ark-poly", - "ark-serialize", - "ark-std", + "ark-serialize 0.5.0", + "ark-std 0.5.0", "educe", "fnv", "hashbrown 0.15.5", @@ -171,18 +209,56 @@ dependencies = [ "zeroize", ] +[[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 0.4.6", + "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 0.4.6", + "num-traits", + "paste", + "rustc_version 0.4.1", + "zeroize", +] + [[package]] name = "ark-ff" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a177aba0ed1e0fbb62aa9f6d0502e9b46dad8c2eab04c14258a1212d2557ea70" dependencies = [ - "ark-ff-asm", - "ark-ff-macros", - "ark-serialize", - "ark-std", + "ark-ff-asm 0.5.0", + "ark-ff-macros 0.5.0", + "ark-serialize 0.5.0", + "ark-std 0.5.0", "arrayvec", - "digest", + "digest 0.10.7", "educe", "itertools 0.13.0", "num-bigint 0.4.6", @@ -191,6 +267,26 @@ dependencies = [ "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-asm" version = "0.5.0" @@ -201,6 +297,31 @@ dependencies = [ "syn 2.0.111", ] +[[package]] +name = "ark-ff-macros" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fd794a08ccb318058009eefdf15bcaaaaf6f8161eb3345f907222bac38b20" +dependencies = [ + "num-bigint 0.4.6", + "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 0.4.6", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "ark-ff-macros" version = "0.5.0" @@ -222,11 +343,11 @@ checksum = "88f1d0f3a534bb54188b8dcc104307db6c56cdae574ddc3212aec0625740fc7e" dependencies = [ "ark-crypto-primitives", "ark-ec", - "ark-ff", + "ark-ff 0.5.0", "ark-poly", "ark-relations", - "ark-serialize", - "ark-std", + "ark-serialize 0.5.0", + "ark-std 0.5.0", ] [[package]] @@ -236,9 +357,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "579305839da207f02b89cd1679e50e67b4331e2f9294a57693e5051b7703fe27" dependencies = [ "ahash", - "ark-ff", - "ark-serialize", - "ark-std", + "ark-ff 0.5.0", + "ark-serialize 0.5.0", + "ark-std 0.5.0", "educe", "fnv", "hashbrown 0.15.5", @@ -251,9 +372,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "941551ef1df4c7a401de7068758db6503598e6f01850bdb2cfdb614a1f9dbea1" dependencies = [ "ark-ec", - "ark-ff", + "ark-ff 0.5.0", "ark-relations", - "ark-std", + "ark-std 0.5.0", "educe", "num-bigint 0.4.6", "num-integer", @@ -267,12 +388,33 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec46ddc93e7af44bcab5230937635b06fb5744464dd6a7e7b083e80ebd274384" dependencies = [ - "ark-ff", - "ark-std", + "ark-ff 0.5.0", + "ark-std 0.5.0", "tracing", "tracing-subscriber 0.2.25", ] +[[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 0.4.6", +] + [[package]] name = "ark-serialize" version = "0.5.0" @@ -280,9 +422,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f4d068aaf107ebcd7dfb52bc748f8030e0fc930ac8e360146ca54c1203088f7" dependencies = [ "ark-serialize-derive", - "ark-std", + "ark-std 0.5.0", "arrayvec", - "digest", + "digest 0.10.7", "num-bigint 0.4.6", ] @@ -303,10 +445,30 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d368e2848c2d4c129ce7679a7d0d2d612b6a274d3ea6a13bad4445d61b381b88" dependencies = [ - "ark-ff", + "ark-ff 0.5.0", "ark-relations", - "ark-serialize", - "ark-std", + "ark-serialize 0.5.0", + "ark-std 0.5.0", +] + +[[package]] +name = "ark-std" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1df2c09229cbc5a028b1d70e00fdb2acee28b1055dfb5ca73eea49c5a25c4e7c" +dependencies = [ + "num-traits", + "rand 0.8.5", +] + +[[package]] +name = "ark-std" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" +dependencies = [ + "num-traits", + "rand 0.8.5", ] [[package]] @@ -342,6 +504,17 @@ dependencies = [ "syn 2.0.111", ] +[[package]] +name = "auto_impl" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffdcb70bdbc4d478427380519163274ac86e52916e10f0a8889adf0f96d3fee7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", +] + [[package]] name = "autocfg" version = "1.5.0" @@ -420,7 +593,7 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" dependencies = [ - "digest", + "digest 0.10.7", ] [[package]] @@ -456,7 +629,7 @@ name = "bls12_381" version = "0.8.0" source = "git+https://github.com/lambdaclass/bls12_381?branch=expose-fp-struct#219174187bd78154cec35b0809799fc2c991a579" dependencies = [ - "digest", + "digest 0.10.7", "ff", "group", "pairing", @@ -679,6 +852,18 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" +[[package]] +name = "const-hex" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bb320cac8a0750d7f25280aa97b09c26edfe161164238ecbbb31092b079e735" +dependencies = [ + "cfg-if", + "cpufeatures", + "proptest", + "serde_core", +] + [[package]] name = "const-oid" version = "0.9.6" @@ -849,14 +1034,38 @@ dependencies = [ "typenum", ] +[[package]] +name = "darling" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" +dependencies = [ + "darling_core 0.20.11", + "darling_macro 0.20.11", +] + [[package]] name = "darling" version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" dependencies = [ - "darling_core", - "darling_macro", + "darling_core 0.21.3", + "darling_macro 0.21.3", +] + +[[package]] +name = "darling_core" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.111", ] [[package]] @@ -873,13 +1082,24 @@ dependencies = [ "syn 2.0.111", ] +[[package]] +name = "darling_macro" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" +dependencies = [ + "darling_core 0.20.11", + "quote", + "syn 2.0.111", +] + [[package]] name = "darling_macro" version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" dependencies = [ - "darling_core", + "darling_core 0.21.3", "quote", "syn 2.0.111", ] @@ -971,6 +1191,15 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + [[package]] name = "digest" version = "0.10.7" @@ -1013,7 +1242,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" dependencies = [ "der", - "digest", + "digest 0.10.7", "elliptic-curve", "rfc6979", "signature", @@ -1052,7 +1281,7 @@ checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" dependencies = [ "base16ct", "crypto-bigint", - "digest", + "digest 0.10.7", "ff", "generic-array", "group", @@ -1125,7 +1354,17 @@ name = "ere-platform-trait" version = "0.0.16" source = "git+https://github.com/eth-act/ere?rev=ec75f8a26657ddbf7efc44cdb3167fff4f55fe27#ec75f8a26657ddbf7efc44cdb3167fff4f55fe27" dependencies = [ - "digest", + "digest 0.10.7", +] + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys", ] [[package]] @@ -1157,8 +1396,57 @@ dependencies = [ "fixed-hash", "impl-rlp", "impl-serde", - "primitive-types", - "uint", + "primitive-types 0.13.1", + "uint 0.10.0", +] + +[[package]] +name = "ethereum_hashing" +version = "0.7.0" +source = "git+https://github.com/jsign/ethereum_hashing?rev=08c88633b700d7447ef840d19ce7b369c44311de#08c88633b700d7447ef840d19ce7b369c44311de" +dependencies = [ + "cpufeatures", + "sha2", +] + +[[package]] +name = "ethereum_serde_utils" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dc1355dbb41fbbd34ec28d4fb2a57d9a70c67ac3c19f6a5ca4d4a176b9e997a" +dependencies = [ + "alloy-primitives", + "hex", + "serde", + "serde_derive", + "serde_json", +] + +[[package]] +name = "ethereum_ssz" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dcddb2554d19cde19b099fadddde576929d7a4d0c1cd3512d1fd95cf174375c" +dependencies = [ + "alloy-primitives", + "ethereum_serde_utils", + "itertools 0.13.0", + "serde", + "serde_derive", + "smallvec", + "typenum", +] + +[[package]] +name = "ethereum_ssz_derive" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a657b6b3b7e153637dc6bdc6566ad9279d9ee11a15b12cfb24a2e04360637e9f" +dependencies = [ + "darling 0.20.11", + "proc-macro2", + "quote", + "syn 2.0.111", ] [[package]] @@ -1255,7 +1543,7 @@ source = "git+https://github.com/lambdaclass/ethrex.git?rev=e6d70854d0fe3b0f29ed dependencies = [ "ark-bn254", "ark-ec", - "ark-ff", + "ark-ff 0.5.0", "bitvec", "bls12_381", "bytes", @@ -1348,7 +1636,7 @@ dependencies = [ "anyhow", "bytes", "crossbeam", - "digest", + "digest 0.10.7", "ethereum-types", "ethrex-crypto", "ethrex-rlp", @@ -1397,6 +1685,34 @@ dependencies = [ "regex-syntax", ] +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[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 = "fastrlp" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce8dba4714ef14b8274c371879b175aa55b16b30f269663f19d576f380018dc4" +dependencies = [ + "arrayvec", + "auto_impl", + "bytes", +] + [[package]] name = "ff" version = "0.13.1" @@ -1607,7 +1923,7 @@ dependencies = [ [[package]] name = "guest" -version = "0.3.0" +version = "0.4.0" dependencies = [ "ere-io", "ere-platform-trait", @@ -1662,6 +1978,8 @@ dependencies = [ "allocator-api2", "equivalent", "foldhash 0.2.0", + "serde", + "serde_core", ] [[package]] @@ -1694,7 +2012,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest", + "digest 0.10.7", ] [[package]] @@ -1829,6 +2147,15 @@ dependencies = [ "icu_properties", ] +[[package]] +name = "impl-codec" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" +dependencies = [ + "parity-scale-codec", +] + [[package]] name = "impl-codec" version = "0.7.1" @@ -1844,7 +2171,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "54ed8ad1f3877f7e775b8cbf30ed1bd3209a95401817f19a0eb4402d13f8cf90" dependencies = [ - "rlp", + "rlp 0.6.1", ] [[package]] @@ -1902,6 +2229,15 @@ version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" +[[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.12.1" @@ -1969,6 +2305,16 @@ dependencies = [ "cpufeatures", ] +[[package]] +name = "keccak-asm" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "505d1856a39b200489082f90d897c3f07c455563880bc5952e38eabf731c83b6" +dependencies = [ + "digest 0.10.7", + "sha3-asm", +] + [[package]] name = "kzg-rs" version = "0.2.7" @@ -2045,6 +2391,12 @@ dependencies = [ "escape8259", ] +[[package]] +name = "linux-raw-sys" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" + [[package]] name = "litemap" version = "0.8.1" @@ -2479,6 +2831,16 @@ version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" +[[package]] +name = "pest" +version = "2.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9eb05c21a464ea704b53158d358a31e6425db2f63a1a7312268b05fe2b75f7" +dependencies = [ + "memchr", + "ucd-trie", +] + [[package]] name = "pin-project-lite" version = "0.2.16" @@ -2547,6 +2909,17 @@ dependencies = [ "risc0-bigint2", ] +[[package]] +name = "primitive-types" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" +dependencies = [ + "fixed-hash", + "impl-codec 0.6.0", + "uint 0.9.5", +] + [[package]] name = "primitive-types" version = "0.13.1" @@ -2554,10 +2927,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d15600a7d856470b7d278b3fe0e311fe28c2526348549f8ef2ff7db3299c87f5" dependencies = [ "fixed-hash", - "impl-codec", + "impl-codec 0.7.1", "impl-rlp", "impl-serde", - "uint", + "uint 0.10.0", ] [[package]] @@ -2584,11 +2957,16 @@ version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bee689443a2bd0a16ab0348b52ee43e3b2d1b1f931c8aa5c9f8de4c86fbe8c40" dependencies = [ + "bit-set", + "bit-vec", "bitflags 2.10.0", "num-traits", "rand 0.9.2", "rand_chacha 0.9.0", "rand_xorshift", + "regex-syntax", + "rusty-fork", + "tempfile", "unarray", ] @@ -2621,6 +2999,12 @@ dependencies = [ "xxhash-rust", ] +[[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.42" @@ -2668,7 +3052,9 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ + "rand_chacha 0.9.0", "rand_core 0.9.3", + "serde", ] [[package]] @@ -2705,6 +3091,10 @@ name = "rand_core" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.4", + "serde", +] [[package]] name = "rand_xorshift" @@ -2715,6 +3105,15 @@ dependencies = [ "rand_core 0.9.3", ] +[[package]] +name = "rapidhash" +version = "4.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d8b5b858a440a0bc02625b62dd95131b9201aa9f69f411195dd4a7cfb1de3d7" +dependencies = [ + "rustversion", +] + [[package]] name = "rayon" version = "1.11.0" @@ -2797,7 +3196,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" dependencies = [ - "digest", + "digest 0.10.7", ] [[package]] @@ -2827,7 +3226,7 @@ dependencies = [ "risc0-zkp", "risc0-zkvm-platform", "ruint", - "semver", + "semver 1.0.27", "serde", "tracing", ] @@ -2900,9 +3299,9 @@ dependencies = [ "anyhow", "ark-bn254", "ark-ec", - "ark-ff", + "ark-ff 0.5.0", "ark-groth16", - "ark-serialize", + "ark-serialize 0.5.0", "bytemuck", "hex", "num-bigint 0.4.6", @@ -2934,7 +3333,7 @@ dependencies = [ "borsh", "bytemuck", "cfg-if", - "digest", + "digest 0.10.7", "hex", "hex-literal", "metal", @@ -2969,7 +3368,7 @@ dependencies = [ "risc0-zkp", "risc0-zkvm-platform", "rrs-lib", - "semver", + "semver 1.0.27", "serde", "sha2", "stability", @@ -3022,6 +3421,16 @@ dependencies = [ "syn 2.0.111", ] +[[package]] +name = "rlp" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" +dependencies = [ + "bytes", + "rustc-hex", +] + [[package]] name = "rlp" version = "0.6.1" @@ -3048,10 +3457,23 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a68df0380e5c9d20ce49534f292a36a7514ae21350726efe1865bdb1fa91d278" dependencies = [ + "alloy-rlp", + "ark-ff 0.3.0", + "ark-ff 0.4.2", + "ark-ff 0.5.0", "borsh", + "bytes", + "fastrlp 0.3.1", + "fastrlp 0.4.0", + "num-bigint 0.4.6", + "num-integer", + "num-traits", + "parity-scale-codec", + "primitive-types 0.12.2", "proptest", "rand 0.8.5", "rand 0.9.2", + "rlp 0.5.2", "ruint-macro", "serde_core", "valuable", @@ -3076,12 +3498,55 @@ 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.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver 1.0.27", +] + +[[package]] +name = "rustix" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" +dependencies = [ + "bitflags 2.10.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] + [[package]] name = "rustversion" version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" +[[package]] +name = "rusty-fork" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc6bf79ff24e648f6da1f8d1f011e9cac26491b619e6b9280f2b47f1774e6ee2" +dependencies = [ + "fnv", + "quick-error", + "tempfile", + "wait-timeout", +] + [[package]] name = "ryu" version = "1.0.20" @@ -3144,6 +3609,15 @@ dependencies = [ "zeroize", ] +[[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.27" @@ -3154,6 +3628,15 @@ dependencies = [ "serde_core", ] +[[package]] +name = "semver-parser" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9900206b54a3527fdc7b8a938bffd94a568bac4f4aa8113b209df75a09c0dec2" +dependencies = [ + "pest", +] + [[package]] name = "serde" version = "1.0.228" @@ -3231,7 +3714,7 @@ version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08a72d8216842fdd57820dc78d840bef99248e35fb2554ff923319e60f2d686b" dependencies = [ - "darling", + "darling 0.21.3", "proc-macro2", "quote", "syn 2.0.111", @@ -3244,7 +3727,7 @@ source = "git+https://github.com/risc0/RustCrypto-hashes?tag=sha2-v0.10.9-riscze dependencies = [ "cfg-if", "cpufeatures", - "digest", + "digest 0.10.7", ] [[package]] @@ -3253,10 +3736,20 @@ version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" dependencies = [ - "digest", + "digest 0.10.7", "keccak", ] +[[package]] +name = "sha3-asm" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28efc5e327c837aa837c59eae585fc250715ef939ac32881bcc11677cd02d46" +dependencies = [ + "cc", + "cfg-if", +] + [[package]] name = "sharded-slab" version = "0.1.7" @@ -3278,7 +3771,7 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ - "digest", + "digest 0.10.7", "rand_core 0.6.4", ] @@ -3368,6 +3861,22 @@ dependencies = [ "der", ] +[[package]] +name = "ssz_types" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b55bedc9a18ed2860a46d6beb4f4082416ee1d60be0cc364cebdcdddc7afd4" +dependencies = [ + "ethereum_serde_utils", + "ethereum_ssz", + "itertools 0.13.0", + "serde", + "serde_derive", + "smallvec", + "tree_hash", + "typenum", +] + [[package]] name = "stability" version = "0.2.1" @@ -3386,17 +3895,30 @@ checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" [[package]] name = "stateless-validator-common" -version = "0.3.0" +version = "0.4.0" dependencies = [ + "anyhow", + "ethereum_ssz", + "ethereum_ssz_derive", "rkyv", + "serde", + "serde_with", + "sha2", + "ssz_types", + "tree_hash", + "tree_hash_derive", + "typenum", ] [[package]] name = "stateless-validator-ethrex" -version = "0.3.0" +version = "0.4.0" dependencies = [ + "anyhow", + "bytes", "ere-io", "ethrex-common", + "ethrex-rlp", "ethrex-vm", "guest", "guest_program", @@ -3506,6 +4028,19 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" +[[package]] +name = "tempfile" +version = "3.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "655da9c7eb6305c55742045d5a8d2037996d61d8de95806335c7c86ce0f82e9c" +dependencies = [ + "fastrand", + "getrandom 0.3.4", + "once_cell", + "rustix", + "windows-sys", +] + [[package]] name = "thiserror" version = "2.0.17" @@ -3733,12 +4268,55 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "tree_hash" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee44f4cef85f88b4dea21c0b1f58320bdf35715cf56d840969487cff00613321" +dependencies = [ + "alloy-primitives", + "ethereum_hashing", + "ethereum_ssz", + "smallvec", + "typenum", +] + +[[package]] +name = "tree_hash_derive" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bee2ea1551f90040ab0e34b6fb7f2fa3bad8acc925837ac654f2c78a13e3089" +dependencies = [ + "darling 0.20.11", + "proc-macro2", + "quote", + "syn 2.0.111", +] + [[package]] name = "typenum" version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + +[[package]] +name = "uint" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", +] + [[package]] name = "uint" version = "0.10.0" @@ -3821,6 +4399,15 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +[[package]] +name = "wait-timeout" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11" +dependencies = [ + "libc", +] + [[package]] name = "walkdir" version = "2.5.0" diff --git a/bin/stateless-validator-ethrex/risc0/Cargo.toml b/bin/stateless-validator-ethrex/risc0/Cargo.toml index 41bac053..3bbe8ad6 100644 --- a/bin/stateless-validator-ethrex/risc0/Cargo.toml +++ b/bin/stateless-validator-ethrex/risc0/Cargo.toml @@ -18,7 +18,10 @@ ere-platform-risc0 = { git = "https://github.com/eth-act/ere", rev = "ec75f8a266 ] } # local -stateless-validator-ethrex = { path = "../../../crates/stateless-validator-ethrex", features = ["std", "risc0"] } +stateless-validator-ethrex = { path = "../../../crates/stateless-validator-ethrex", features = [ + "std", + "risc0", +] } [patch.crates-io] sha2 = { git = "https://github.com/risc0/RustCrypto-hashes", tag = "sha2-v0.10.9-risczero.0" } @@ -27,6 +30,7 @@ p256 = { git = "https://github.com/risc0/RustCrypto-elliptic-curves", tag = "p25 crypto-bigint = { git = "https://github.com/risc0/RustCrypto-crypto-bigint", tag = "v0.5.5-risczero.0" } c-kzg = { git = "https://github.com/risc0/c-kzg-4844", tag = "c-kzg/v2.1.1-risczero.0" } substrate-bn = { git = "https://github.com/risc0/paritytech-bn", tag = "v0.6.0-risczero.0" } +ethereum_hashing = { git = "https://github.com/jsign/ethereum_hashing", rev = "08c88633b700d7447ef840d19ce7b369c44311de" } # These precompiles require the "unstable" risc0 feature which is not suited # for production environments. diff --git a/bin/stateless-validator-ethrex/sp1/Cargo.lock b/bin/stateless-validator-ethrex/sp1/Cargo.lock index d2aab08a..cbe55d9d 100644 --- a/bin/stateless-validator-ethrex/sp1/Cargo.lock +++ b/bin/stateless-validator-ethrex/sp1/Cargo.lock @@ -40,6 +40,44 @@ version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" +[[package]] +name = "alloy-primitives" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6a0fb18dd5fb43ec5f0f6a20be1ce0287c79825827de5744afaa6c957737c33" +dependencies = [ + "alloy-rlp", + "bytes", + "cfg-if", + "const-hex", + "derive_more 2.1.1", + "foldhash 0.2.0", + "hashbrown 0.16.1", + "indexmap 2.12.1", + "itoa", + "k256", + "keccak-asm", + "paste", + "proptest", + "rand 0.9.2", + "rapidhash", + "ruint", + "rustc-hash", + "serde", + "sha3", + "tiny-keccak", +] + +[[package]] +name = "alloy-rlp" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f70d83b765fdc080dbcd4f4db70d8d23fe4761f2f02ebfa9146b833900634b4" +dependencies = [ + "arrayvec", + "bytes", +] + [[package]] name = "android_system_properties" version = "0.1.5" @@ -112,8 +150,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d69eab57e8d2663efa5c63135b2af4f396d66424f88954c21104125ab6b3e6bc" dependencies = [ "ark-ec", - "ark-ff", - "ark-std", + "ark-ff 0.5.0", + "ark-std 0.5.0", ] [[package]] @@ -123,10 +161,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43d68f2d516162846c1238e755a7c4d131b892b70cc70c471a8e3ca3ed818fce" dependencies = [ "ahash", - "ark-ff", + "ark-ff 0.5.0", "ark-poly", - "ark-serialize", - "ark-std", + "ark-serialize 0.5.0", + "ark-std 0.5.0", "educe", "fnv", "hashbrown 0.15.5", @@ -137,18 +175,56 @@ dependencies = [ "zeroize", ] +[[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 0.4.6", + "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 0.4.6", + "num-traits", + "paste", + "rustc_version 0.4.1", + "zeroize", +] + [[package]] name = "ark-ff" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a177aba0ed1e0fbb62aa9f6d0502e9b46dad8c2eab04c14258a1212d2557ea70" dependencies = [ - "ark-ff-asm", - "ark-ff-macros", - "ark-serialize", - "ark-std", + "ark-ff-asm 0.5.0", + "ark-ff-macros 0.5.0", + "ark-serialize 0.5.0", + "ark-std 0.5.0", "arrayvec", - "digest", + "digest 0.10.7", "educe", "itertools 0.13.0", "num-bigint 0.4.6", @@ -157,6 +233,26 @@ dependencies = [ "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-asm" version = "0.5.0" @@ -167,6 +263,31 @@ dependencies = [ "syn 2.0.111", ] +[[package]] +name = "ark-ff-macros" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fd794a08ccb318058009eefdf15bcaaaaf6f8161eb3345f907222bac38b20" +dependencies = [ + "num-bigint 0.4.6", + "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 0.4.6", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "ark-ff-macros" version = "0.5.0" @@ -187,14 +308,35 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "579305839da207f02b89cd1679e50e67b4331e2f9294a57693e5051b7703fe27" dependencies = [ "ahash", - "ark-ff", - "ark-serialize", - "ark-std", + "ark-ff 0.5.0", + "ark-serialize 0.5.0", + "ark-std 0.5.0", "educe", "fnv", "hashbrown 0.15.5", ] +[[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 0.4.6", +] + [[package]] name = "ark-serialize" version = "0.5.0" @@ -202,9 +344,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f4d068aaf107ebcd7dfb52bc748f8030e0fc930ac8e360146ca54c1203088f7" dependencies = [ "ark-serialize-derive", - "ark-std", + "ark-std 0.5.0", "arrayvec", - "digest", + "digest 0.10.7", "num-bigint 0.4.6", ] @@ -219,6 +361,26 @@ dependencies = [ "syn 2.0.111", ] +[[package]] +name = "ark-std" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1df2c09229cbc5a028b1d70e00fdb2acee28b1055dfb5ca73eea49c5a25c4e7c" +dependencies = [ + "num-traits", + "rand 0.8.5", +] + +[[package]] +name = "ark-std" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" +dependencies = [ + "num-traits", + "rand 0.8.5", +] + [[package]] name = "ark-std" version = "0.5.0" @@ -226,7 +388,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "246a225cc6131e9ee4f24619af0f19d67761fff15d7ccc22e42b80846e69449a" dependencies = [ "num-traits", - "rand", + "rand 0.8.5", ] [[package]] @@ -252,6 +414,17 @@ dependencies = [ "syn 2.0.111", ] +[[package]] +name = "auto_impl" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffdcb70bdbc4d478427380519163274ac86e52916e10f0a8889adf0f96d3fee7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", +] + [[package]] name = "autocfg" version = "1.5.0" @@ -306,6 +479,12 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" +[[package]] +name = "bitflags" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" + [[package]] name = "bitvec" version = "1.0.1" @@ -346,12 +525,12 @@ version = "0.8.0" source = "git+https://github.com/lambdaclass/bls12_381-patch/?branch=expose-fp-struct#f2242f78b2b5fc10d9168a810c04ab8728ac6804" dependencies = [ "cfg-if", - "digest", + "digest 0.10.7", "ff", "group", "hex", "pairing", - "rand_core", + "rand_core 0.6.4", "sp1-lib", "subtle", ] @@ -512,6 +691,18 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b396d1f76d455557e1218ec8066ae14bba60b4b36ecd55577ba979f5db7ecaa" +[[package]] +name = "const-hex" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bb320cac8a0750d7f25280aa97b09c26edfe161164238ecbbb31092b079e735" +dependencies = [ + "cfg-if", + "cpufeatures", + "proptest", + "serde_core", +] + [[package]] name = "const-oid" version = "0.9.6" @@ -553,6 +744,15 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "convert_case" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "633458d4ef8c78b72454de2d54fd6ab2e60f9e02be22f3c6104cdc8a4e0fceb9" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -651,7 +851,7 @@ version = "0.5.5" source = "git+https://github.com/sp1-patches/RustCrypto-bigint?tag=patch-0.5.5-sp1-4.0.0#d421029772fb604022defd4cae5fffb269ad5155" dependencies = [ "generic-array", - "rand_core", + "rand_core 0.6.4", "subtle", "zeroize", ] @@ -666,14 +866,38 @@ dependencies = [ "typenum", ] +[[package]] +name = "darling" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" +dependencies = [ + "darling_core 0.20.11", + "darling_macro 0.20.11", +] + [[package]] name = "darling" version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" dependencies = [ - "darling_core", - "darling_macro", + "darling_core 0.21.3", + "darling_macro 0.21.3", +] + +[[package]] +name = "darling_core" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.111", ] [[package]] @@ -690,13 +914,24 @@ dependencies = [ "syn 2.0.111", ] +[[package]] +name = "darling_macro" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" +dependencies = [ + "darling_core 0.20.11", + "quote", + "syn 2.0.111", +] + [[package]] name = "darling_macro" version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" dependencies = [ - "darling_core", + "darling_core 0.21.3", "quote", "syn 2.0.111", ] @@ -734,13 +969,33 @@ dependencies = [ "serde_core", ] +[[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 = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a9b99b9cbbe49445b21764dc0625032a89b145a2642e67603e1c936f5458d05" dependencies = [ - "derive_more-impl", + "derive_more-impl 1.0.0", +] + +[[package]] +name = "derive_more" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" +dependencies = [ + "derive_more-impl 2.1.1", ] [[package]] @@ -749,13 +1004,36 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" dependencies = [ - "convert_case", + "convert_case 0.6.0", + "proc-macro2", + "quote", + "syn 2.0.111", + "unicode-xid", +] + +[[package]] +name = "derive_more-impl" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" +dependencies = [ + "convert_case 0.10.0", "proc-macro2", "quote", + "rustc_version 0.4.1", "syn 2.0.111", "unicode-xid", ] +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + [[package]] name = "digest" version = "0.10.7" @@ -791,7 +1069,7 @@ version = "0.16.9" source = "git+https://github.com/sp1-patches/signatures?tag=patch-16.9-sp1-4.1.0#1880299a48fe7ef249edaa616fd411239fb5daf1" dependencies = [ "der", - "digest", + "digest 0.10.7", "elliptic-curve", "rfc6979", "signature", @@ -824,14 +1102,14 @@ checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" dependencies = [ "base16ct", "crypto-bigint", - "digest", + "digest 0.10.7", "ff", "generic-array", "group", "hkdf", "pem-rfc7468", "pkcs8", - "rand_core", + "rand_core 0.6.4", "sec1", "subtle", "zeroize", @@ -897,7 +1175,17 @@ name = "ere-platform-trait" version = "0.0.16" source = "git+https://github.com/eth-act/ere?rev=ec75f8a26657ddbf7efc44cdb3167fff4f55fe27#ec75f8a26657ddbf7efc44cdb3167fff4f55fe27" dependencies = [ - "digest", + "digest 0.10.7", +] + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys", ] [[package]] @@ -929,8 +1217,57 @@ dependencies = [ "fixed-hash", "impl-rlp", "impl-serde", - "primitive-types", - "uint", + "primitive-types 0.13.1", + "uint 0.10.0", +] + +[[package]] +name = "ethereum_hashing" +version = "0.7.0" +source = "git+https://github.com/jsign/ethereum_hashing?rev=08c88633b700d7447ef840d19ce7b369c44311de#08c88633b700d7447ef840d19ce7b369c44311de" +dependencies = [ + "cpufeatures", + "sha2", +] + +[[package]] +name = "ethereum_serde_utils" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dc1355dbb41fbbd34ec28d4fb2a57d9a70c67ac3c19f6a5ca4d4a176b9e997a" +dependencies = [ + "alloy-primitives", + "hex", + "serde", + "serde_derive", + "serde_json", +] + +[[package]] +name = "ethereum_ssz" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dcddb2554d19cde19b099fadddde576929d7a4d0c1cd3512d1fd95cf174375c" +dependencies = [ + "alloy-primitives", + "ethereum_serde_utils", + "itertools 0.13.0", + "serde", + "serde_derive", + "smallvec", + "typenum", +] + +[[package]] +name = "ethereum_ssz_derive" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a657b6b3b7e153637dc6bdc6566ad9279d9ee11a15b12cfb24a2e04360637e9f" +dependencies = [ + "darling 0.20.11", + "proc-macro2", + "quote", + "syn 2.0.111", ] [[package]] @@ -1026,12 +1363,12 @@ source = "git+https://github.com/lambdaclass/ethrex.git?rev=e6d70854d0fe3b0f29ed dependencies = [ "ark-bn254", "ark-ec", - "ark-ff", + "ark-ff 0.5.0", "bitvec", "bls12_381", "bytes", "datatest-stable", - "derive_more", + "derive_more 1.0.0", "ethrex-common", "ethrex-crypto", "ethrex-rlp", @@ -1119,7 +1456,7 @@ dependencies = [ "anyhow", "bytes", "crossbeam", - "digest", + "digest 0.10.7", "ethereum-types", "ethrex-crypto", "ethrex-rlp", @@ -1142,7 +1479,7 @@ source = "git+https://github.com/lambdaclass/ethrex.git?rev=e6d70854d0fe3b0f29ed dependencies = [ "bincode", "bytes", - "derive_more", + "derive_more 1.0.0", "dyn-clone", "ethereum-types", "ethrex-common", @@ -1168,6 +1505,34 @@ dependencies = [ "regex-syntax", ] +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[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 = "fastrlp" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce8dba4714ef14b8274c371879b175aa55b16b30f269663f19d576f380018dc4" +dependencies = [ + "arrayvec", + "auto_impl", + "bytes", +] + [[package]] name = "ff" version = "0.13.1" @@ -1177,7 +1542,7 @@ dependencies = [ "bitvec", "byteorder", "ff_derive", - "rand_core", + "rand_core 0.6.4", "subtle", ] @@ -1209,7 +1574,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" dependencies = [ "byteorder", - "rand", + "rand 0.8.5", "rustc-hex", "static_assertions", ] @@ -1339,13 +1704,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" dependencies = [ "ff", - "rand_core", + "rand_core 0.6.4", "subtle", ] [[package]] name = "guest" -version = "0.3.0" +version = "0.4.0" dependencies = [ "ere-io", "ere-platform-trait", @@ -1400,6 +1765,8 @@ dependencies = [ "allocator-api2", "equivalent", "foldhash 0.2.0", + "serde", + "serde_core", ] [[package]] @@ -1435,7 +1802,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest", + "digest 0.10.7", ] [[package]] @@ -1570,6 +1937,15 @@ dependencies = [ "icu_properties", ] +[[package]] +name = "impl-codec" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" +dependencies = [ + "parity-scale-codec", +] + [[package]] name = "impl-codec" version = "0.7.1" @@ -1585,7 +1961,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "54ed8ad1f3877f7e775b8cbf30ed1bd3209a95401817f19a0eb4402d13f8cf90" dependencies = [ - "rlp", + "rlp 0.6.1", ] [[package]] @@ -1637,6 +2013,15 @@ version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" +[[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.12.1" @@ -1704,6 +2089,16 @@ dependencies = [ "cpufeatures", ] +[[package]] +name = "keccak-asm" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "505d1856a39b200489082f90d897c3f07c455563880bc5952e38eabf731c83b6" +dependencies = [ + "digest 0.10.7", + "sha3-asm", +] + [[package]] name = "kzg-rs" version = "0.2.7" @@ -1725,8 +2120,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "58b1a1c1102a5a7fbbda117b79fb3a01e033459c738a3c1642269603484fd1c1" dependencies = [ "lambdaworks-math", - "rand", - "rand_chacha", + "rand 0.8.5", + "rand_chacha 0.3.1", "serde", "sha2", "sha3", @@ -1741,7 +2136,7 @@ dependencies = [ "getrandom 0.2.16", "num-bigint 0.4.6", "num-traits", - "rand", + "rand 0.8.5", "rayon", "serde", "serde_json", @@ -1758,9 +2153,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.177" +version = "0.2.180" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" +checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc" [[package]] name = "libm" @@ -1786,6 +2181,12 @@ version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9afa463f5405ee81cdb9cc2baf37e08ec7e4c8209442b5d72c04cfb2cd6e6286" +[[package]] +name = "linux-raw-sys" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" + [[package]] name = "litemap" version = "0.8.1" @@ -1940,6 +2341,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", + "libm", ] [[package]] @@ -1978,7 +2380,7 @@ dependencies = [ "p3-mds", "p3-poseidon2", "p3-symmetric", - "rand", + "rand 0.8.5", "serde", ] @@ -2005,7 +2407,7 @@ dependencies = [ "num-bigint 0.4.6", "num-traits", "p3-util", - "rand", + "rand 0.8.5", "serde", ] @@ -2019,7 +2421,7 @@ dependencies = [ "p3-field", "p3-maybe-rayon", "p3-util", - "rand", + "rand 0.8.5", "serde", "tracing", ] @@ -2042,7 +2444,7 @@ dependencies = [ "p3-matrix", "p3-symmetric", "p3-util", - "rand", + "rand 0.8.5", ] [[package]] @@ -2055,7 +2457,7 @@ dependencies = [ "p3-field", "p3-mds", "p3-symmetric", - "rand", + "rand 0.8.5", "serde", ] @@ -2137,6 +2539,16 @@ version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" +[[package]] +name = "pest" +version = "2.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9eb05c21a464ea704b53158d358a31e6425db2f63a1a7312268b05fe2b75f7" +dependencies = [ + "memchr", + "ucd-trie", +] + [[package]] name = "pin-project-lite" version = "0.2.16" @@ -2191,6 +2603,17 @@ dependencies = [ "elliptic-curve", ] +[[package]] +name = "primitive-types" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" +dependencies = [ + "fixed-hash", + "impl-codec 0.6.0", + "uint 0.9.5", +] + [[package]] name = "primitive-types" version = "0.13.1" @@ -2198,10 +2621,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d15600a7d856470b7d278b3fe0e311fe28c2526348549f8ef2ff7db3299c87f5" dependencies = [ "fixed-hash", - "impl-codec", + "impl-codec 0.7.1", "impl-rlp", "impl-serde", - "uint", + "uint 0.10.0", ] [[package]] @@ -2222,6 +2645,25 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "proptest" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee689443a2bd0a16ab0348b52ee43e3b2d1b1f931c8aa5c9f8de4c86fbe8c40" +dependencies = [ + "bit-set", + "bit-vec", + "bitflags", + "num-traits", + "rand 0.9.2", + "rand_chacha 0.9.0", + "rand_xorshift", + "regex-syntax", + "rusty-fork", + "tempfile", + "unarray", +] + [[package]] name = "ptr_meta" version = "0.3.1" @@ -2251,6 +2693,12 @@ dependencies = [ "xxhash-rust", ] +[[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.42" @@ -2288,8 +2736,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha", - "rand_core", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.5", + "serde", ] [[package]] @@ -2299,7 +2758,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.5", ] [[package]] @@ -2311,6 +2780,34 @@ dependencies = [ "getrandom 0.2.16", ] +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", + "serde", +] + +[[package]] +name = "rand_xorshift" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a" +dependencies = [ + "rand_core 0.9.5", +] + +[[package]] +name = "rapidhash" +version = "4.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d8b5b858a440a0bc02625b62dd95131b9201aa9f69f411195dd4a7cfb1de3d7" +dependencies = [ + "rustversion", +] + [[package]] name = "rayon" version = "1.11.0" @@ -2392,7 +2889,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" dependencies = [ - "digest", + "digest 0.10.7", ] [[package]] @@ -2425,6 +2922,16 @@ dependencies = [ "syn 2.0.111", ] +[[package]] +name = "rlp" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" +dependencies = [ + "bytes", + "rustc-hex", +] + [[package]] name = "rlp" version = "0.6.1" @@ -2447,6 +2954,40 @@ dependencies = [ "svgbobdoc", ] +[[package]] +name = "ruint" +version = "1.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c141e807189ad38a07276942c6623032d3753c8859c146104ac2e4d68865945a" +dependencies = [ + "alloy-rlp", + "ark-ff 0.3.0", + "ark-ff 0.4.2", + "ark-ff 0.5.0", + "bytes", + "fastrlp 0.3.1", + "fastrlp 0.4.0", + "num-bigint 0.4.6", + "num-integer", + "num-traits", + "parity-scale-codec", + "primitive-types 0.12.2", + "proptest", + "rand 0.8.5", + "rand 0.9.2", + "rlp 0.5.2", + "ruint-macro", + "serde_core", + "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-hash" version = "2.1.1" @@ -2459,12 +3000,55 @@ 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.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver 1.0.27", +] + +[[package]] +name = "rustix" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] + [[package]] name = "rustversion" version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" +[[package]] +name = "rusty-fork" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc6bf79ff24e648f6da1f8d1f011e9cac26491b619e6b9280f2b47f1774e6ee2" +dependencies = [ + "fnv", + "quick-error", + "tempfile", + "wait-timeout", +] + [[package]] name = "ryu" version = "1.0.20" @@ -2527,6 +3111,30 @@ dependencies = [ "zeroize", ] +[[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.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" + +[[package]] +name = "semver-parser" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9900206b54a3527fdc7b8a938bffd94a568bac4f4aa8113b209df75a09c0dec2" +dependencies = [ + "pest", +] + [[package]] name = "serde" version = "1.0.228" @@ -2604,7 +3212,7 @@ version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08a72d8216842fdd57820dc78d840bef99248e35fb2554ff923319e60f2d686b" dependencies = [ - "darling", + "darling 0.21.3", "proc-macro2", "quote", "syn 2.0.111", @@ -2617,7 +3225,7 @@ source = "git+https://github.com/sp1-patches/RustCrypto-hashes?tag=patch-sha2-0. dependencies = [ "cfg-if", "cpufeatures", - "digest", + "digest 0.10.7", ] [[package]] @@ -2625,10 +3233,20 @@ name = "sha3" version = "0.10.8" source = "git+https://github.com/sp1-patches/RustCrypto-hashes?tag=patch-sha3-0.10.8-sp1-4.0.0#8f6d303c0861ba7e5adcc36207c0f41fe5edaabc" dependencies = [ - "digest", + "digest 0.10.7", "keccak", ] +[[package]] +name = "sha3-asm" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28efc5e327c837aa837c59eae585fc250715ef939ac32881bcc11677cd02d46" +dependencies = [ + "cc", + "cfg-if", +] + [[package]] name = "sharded-slab" version = "0.1.7" @@ -2650,8 +3268,8 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ - "digest", - "rand_core", + "digest 0.10.7", + "rand_core 0.6.4", ] [[package]] @@ -2723,7 +3341,7 @@ dependencies = [ "getrandom 0.3.4", "lazy_static", "libm", - "rand", + "rand 0.8.5", "sha2", "sp1-lib", "sp1-primitives", @@ -2739,7 +3357,7 @@ dependencies = [ "ff", "group", "pairing", - "rand_core", + "rand_core 0.6.4", "sp1-lib", "subtle", ] @@ -2760,6 +3378,22 @@ dependencies = [ "der", ] +[[package]] +name = "ssz_types" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b55bedc9a18ed2860a46d6beb4f4082416ee1d60be0cc364cebdcdddc7afd4" +dependencies = [ + "ethereum_serde_utils", + "ethereum_ssz", + "itertools 0.13.0", + "serde", + "serde_derive", + "smallvec", + "tree_hash", + "typenum", +] + [[package]] name = "stable_deref_trait" version = "1.2.1" @@ -2768,17 +3402,30 @@ checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" [[package]] name = "stateless-validator-common" -version = "0.3.0" +version = "0.4.0" dependencies = [ + "anyhow", + "ethereum_ssz", + "ethereum_ssz_derive", "rkyv", + "serde", + "serde_with", + "sha2", + "ssz_types", + "tree_hash", + "tree_hash_derive", + "typenum", ] [[package]] name = "stateless-validator-ethrex" -version = "0.3.0" +version = "0.4.0" dependencies = [ + "anyhow", + "bytes", "ere-io", "ethrex-common", + "ethrex-rlp", "ethrex-vm", "guest", "guest_program", @@ -2838,7 +3485,7 @@ dependencies = [ "crunchy", "lazy_static", "num-bigint 0.4.6", - "rand", + "rand 0.8.5", "rustc-hex", "sp1-lib", ] @@ -2901,6 +3548,19 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" +[[package]] +name = "tempfile" +version = "3.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "655da9c7eb6305c55742045d5a8d2037996d61d8de95806335c7c86ce0f82e9c" +dependencies = [ + "fastrand", + "getrandom 0.3.4", + "once_cell", + "rustix", + "windows-sys", +] + [[package]] name = "thiserror" version = "2.0.17" @@ -3110,12 +3770,55 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "tree_hash" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee44f4cef85f88b4dea21c0b1f58320bdf35715cf56d840969487cff00613321" +dependencies = [ + "alloy-primitives", + "ethereum_hashing", + "ethereum_ssz", + "smallvec", + "typenum", +] + +[[package]] +name = "tree_hash_derive" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bee2ea1551f90040ab0e34b6fb7f2fa3bad8acc925837ac654f2c78a13e3089" +dependencies = [ + "darling 0.20.11", + "proc-macro2", + "quote", + "syn 2.0.111", +] + [[package]] name = "typenum" version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + +[[package]] +name = "uint" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", +] + [[package]] name = "uint" version = "0.10.0" @@ -3128,6 +3831,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 = "unicode-ident" version = "1.0.22" @@ -3198,6 +3907,15 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +[[package]] +name = "wait-timeout" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11" +dependencies = [ + "libc", +] + [[package]] name = "walkdir" version = "2.5.0" diff --git a/bin/stateless-validator-ethrex/sp1/Cargo.toml b/bin/stateless-validator-ethrex/sp1/Cargo.toml index 1a138cc6..64038253 100644 --- a/bin/stateless-validator-ethrex/sp1/Cargo.toml +++ b/bin/stateless-validator-ethrex/sp1/Cargo.toml @@ -10,7 +10,10 @@ version = "0.1.0" ere-platform-sp1 = { git = "https://github.com/eth-act/ere", rev = "ec75f8a26657ddbf7efc44cdb3167fff4f55fe27" } # local -stateless-validator-ethrex = { path = "../../../crates/stateless-validator-ethrex", features = ["std", "sp1"] } +stateless-validator-ethrex = { path = "../../../crates/stateless-validator-ethrex", features = [ + "std", + "sp1", +] } [patch.crates-io] sha2-v0-10-9 = { git = "https://github.com/sp1-patches/RustCrypto-hashes", package = "sha2", tag = "patch-sha2-0.10.9-sp1-4.0.0" } @@ -21,6 +24,7 @@ p256 = { git = "https://github.com/sp1-patches/elliptic-curves", tag = "patch-p2 ecdsa = { git = "https://github.com/sp1-patches/signatures", tag = "patch-16.9-sp1-4.1.0" } k256 = { git = "https://github.com/sp1-patches/elliptic-curves", tag = "patch-k256-13.4-sp1-5.0.0" } substrate-bn = { git = "https://github.com/sp1-patches/bn", tag = "patch-0.6.0-sp1-5.0.0" } +ethereum_hashing = { git = "https://github.com/jsign/ethereum_hashing", rev = "08c88633b700d7447ef840d19ce7b369c44311de" } [patch."https://github.com/lambdaclass/bls12_381"] bls12_381 = { git = "https://github.com/lambdaclass/bls12_381-patch/", branch = "expose-fp-struct" } diff --git a/bin/stateless-validator-ethrex/zisk/Cargo.lock b/bin/stateless-validator-ethrex/zisk/Cargo.lock index a0fa896b..6b024873 100644 --- a/bin/stateless-validator-ethrex/zisk/Cargo.lock +++ b/bin/stateless-validator-ethrex/zisk/Cargo.lock @@ -40,6 +40,44 @@ version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" +[[package]] +name = "alloy-primitives" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6a0fb18dd5fb43ec5f0f6a20be1ce0287c79825827de5744afaa6c957737c33" +dependencies = [ + "alloy-rlp", + "bytes", + "cfg-if", + "const-hex", + "derive_more 2.1.1", + "foldhash 0.2.0", + "hashbrown 0.16.1", + "indexmap 2.12.1", + "itoa", + "k256", + "keccak-asm", + "paste", + "proptest", + "rand 0.9.2", + "rapidhash", + "ruint", + "rustc-hash", + "serde", + "sha3", + "tiny-keccak", +] + +[[package]] +name = "alloy-rlp" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f70d83b765fdc080dbcd4f4db70d8d23fe4761f2f02ebfa9146b833900634b4" +dependencies = [ + "arrayvec", + "bytes", +] + [[package]] name = "android_system_properties" version = "0.1.5" @@ -112,8 +150,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d69eab57e8d2663efa5c63135b2af4f396d66424f88954c21104125ab6b3e6bc" dependencies = [ "ark-ec", - "ark-ff", - "ark-std", + "ark-ff 0.5.0", + "ark-std 0.5.0", ] [[package]] @@ -123,10 +161,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43d68f2d516162846c1238e755a7c4d131b892b70cc70c471a8e3ca3ed818fce" dependencies = [ "ahash", - "ark-ff", + "ark-ff 0.5.0", "ark-poly", - "ark-serialize", - "ark-std", + "ark-serialize 0.5.0", + "ark-std 0.5.0", "educe", "fnv", "hashbrown 0.15.5", @@ -137,18 +175,56 @@ dependencies = [ "zeroize", ] +[[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 0.4.6", + "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 0.4.6", + "num-traits", + "paste", + "rustc_version 0.4.1", + "zeroize", +] + [[package]] name = "ark-ff" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a177aba0ed1e0fbb62aa9f6d0502e9b46dad8c2eab04c14258a1212d2557ea70" dependencies = [ - "ark-ff-asm", - "ark-ff-macros", - "ark-serialize", - "ark-std", + "ark-ff-asm 0.5.0", + "ark-ff-macros 0.5.0", + "ark-serialize 0.5.0", + "ark-std 0.5.0", "arrayvec", - "digest", + "digest 0.10.7", "educe", "itertools 0.13.0", "num-bigint 0.4.6", @@ -157,6 +233,26 @@ dependencies = [ "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-asm" version = "0.5.0" @@ -167,6 +263,31 @@ dependencies = [ "syn 2.0.111", ] +[[package]] +name = "ark-ff-macros" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fd794a08ccb318058009eefdf15bcaaaaf6f8161eb3345f907222bac38b20" +dependencies = [ + "num-bigint 0.4.6", + "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 0.4.6", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "ark-ff-macros" version = "0.5.0" @@ -187,14 +308,35 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "579305839da207f02b89cd1679e50e67b4331e2f9294a57693e5051b7703fe27" dependencies = [ "ahash", - "ark-ff", - "ark-serialize", - "ark-std", + "ark-ff 0.5.0", + "ark-serialize 0.5.0", + "ark-std 0.5.0", "educe", "fnv", "hashbrown 0.15.5", ] +[[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 0.4.6", +] + [[package]] name = "ark-serialize" version = "0.5.0" @@ -202,9 +344,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f4d068aaf107ebcd7dfb52bc748f8030e0fc930ac8e360146ca54c1203088f7" dependencies = [ "ark-serialize-derive", - "ark-std", + "ark-std 0.5.0", "arrayvec", - "digest", + "digest 0.10.7", "num-bigint 0.4.6", ] @@ -219,6 +361,26 @@ dependencies = [ "syn 2.0.111", ] +[[package]] +name = "ark-std" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1df2c09229cbc5a028b1d70e00fdb2acee28b1055dfb5ca73eea49c5a25c4e7c" +dependencies = [ + "num-traits", + "rand 0.8.5", +] + +[[package]] +name = "ark-std" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" +dependencies = [ + "num-traits", + "rand 0.8.5", +] + [[package]] name = "ark-std" version = "0.5.0" @@ -226,7 +388,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "246a225cc6131e9ee4f24619af0f19d67761fff15d7ccc22e42b80846e69449a" dependencies = [ "num-traits", - "rand", + "rand 0.8.5", ] [[package]] @@ -252,6 +414,17 @@ dependencies = [ "syn 2.0.111", ] +[[package]] +name = "auto_impl" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffdcb70bdbc4d478427380519163274ac86e52916e10f0a8889adf0f96d3fee7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", +] + [[package]] name = "autocfg" version = "1.5.0" @@ -320,6 +493,12 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" +[[package]] +name = "bitflags" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" + [[package]] name = "bitvec" version = "1.0.1" @@ -359,11 +538,11 @@ name = "bls12_381" version = "0.8.0" source = "git+https://github.com/lambdaclass/bls12_381?branch=expose-fp-struct#219174187bd78154cec35b0809799fc2c991a579" dependencies = [ - "digest", + "digest 0.10.7", "ff", "group", "pairing", - "rand_core", + "rand_core 0.6.4", "subtle", ] @@ -503,6 +682,18 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" +[[package]] +name = "const-hex" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bb320cac8a0750d7f25280aa97b09c26edfe161164238ecbbb31092b079e735" +dependencies = [ + "cfg-if", + "cpufeatures", + "proptest", + "serde_core", +] + [[package]] name = "const-oid" version = "0.9.6" @@ -544,6 +735,15 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "convert_case" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "633458d4ef8c78b72454de2d54fd6ab2e60f9e02be22f3c6104cdc8a4e0fceb9" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -637,7 +837,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ "generic-array", - "rand_core", + "rand_core 0.6.4", "subtle", "zeroize", ] @@ -652,14 +852,38 @@ dependencies = [ "typenum", ] +[[package]] +name = "darling" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" +dependencies = [ + "darling_core 0.20.11", + "darling_macro 0.20.11", +] + [[package]] name = "darling" version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" dependencies = [ - "darling_core", - "darling_macro", + "darling_core 0.21.3", + "darling_macro 0.21.3", +] + +[[package]] +name = "darling_core" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.111", ] [[package]] @@ -676,13 +900,24 @@ dependencies = [ "syn 2.0.111", ] +[[package]] +name = "darling_macro" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" +dependencies = [ + "darling_core 0.20.11", + "quote", + "syn 2.0.111", +] + [[package]] name = "darling_macro" version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" dependencies = [ - "darling_core", + "darling_core 0.21.3", "quote", "syn 2.0.111", ] @@ -720,13 +955,33 @@ dependencies = [ "serde_core", ] +[[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 = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a9b99b9cbbe49445b21764dc0625032a89b145a2642e67603e1c936f5458d05" dependencies = [ - "derive_more-impl", + "derive_more-impl 1.0.0", +] + +[[package]] +name = "derive_more" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" +dependencies = [ + "derive_more-impl 2.1.1", ] [[package]] @@ -735,13 +990,36 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" dependencies = [ - "convert_case", + "convert_case 0.6.0", + "proc-macro2", + "quote", + "syn 2.0.111", + "unicode-xid", +] + +[[package]] +name = "derive_more-impl" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" +dependencies = [ + "convert_case 0.10.0", "proc-macro2", "quote", + "rustc_version 0.4.1", "syn 2.0.111", "unicode-xid", ] +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + [[package]] name = "digest" version = "0.10.7" @@ -778,7 +1056,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" dependencies = [ "der", - "digest", + "digest 0.10.7", "elliptic-curve", "rfc6979", "signature", @@ -811,13 +1089,13 @@ checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" dependencies = [ "base16ct", "crypto-bigint", - "digest", + "digest 0.10.7", "ff", "generic-array", "group", "pem-rfc7468", "pkcs8", - "rand_core", + "rand_core 0.6.4", "sec1", "subtle", "zeroize", @@ -862,7 +1140,7 @@ name = "ere-platform-trait" version = "0.0.16" source = "git+https://github.com/eth-act/ere?rev=ec75f8a26657ddbf7efc44cdb3167fff4f55fe27#ec75f8a26657ddbf7efc44cdb3167fff4f55fe27" dependencies = [ - "digest", + "digest 0.10.7", ] [[package]] @@ -874,6 +1152,16 @@ dependencies = [ "ziskos", ] +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys", +] + [[package]] name = "escape8259" version = "0.5.3" @@ -903,8 +1191,57 @@ dependencies = [ "fixed-hash", "impl-rlp", "impl-serde", - "primitive-types", - "uint", + "primitive-types 0.13.1", + "uint 0.10.0", +] + +[[package]] +name = "ethereum_hashing" +version = "0.7.0" +source = "git+https://github.com/jsign/ethereum_hashing?rev=08c88633b700d7447ef840d19ce7b369c44311de#08c88633b700d7447ef840d19ce7b369c44311de" +dependencies = [ + "cpufeatures", + "sha2", +] + +[[package]] +name = "ethereum_serde_utils" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dc1355dbb41fbbd34ec28d4fb2a57d9a70c67ac3c19f6a5ca4d4a176b9e997a" +dependencies = [ + "alloy-primitives", + "hex", + "serde", + "serde_derive", + "serde_json", +] + +[[package]] +name = "ethereum_ssz" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dcddb2554d19cde19b099fadddde576929d7a4d0c1cd3512d1fd95cf174375c" +dependencies = [ + "alloy-primitives", + "ethereum_serde_utils", + "itertools 0.13.0", + "serde", + "serde_derive", + "smallvec", + "typenum", +] + +[[package]] +name = "ethereum_ssz_derive" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a657b6b3b7e153637dc6bdc6566ad9279d9ee11a15b12cfb24a2e04360637e9f" +dependencies = [ + "darling 0.20.11", + "proc-macro2", + "quote", + "syn 2.0.111", ] [[package]] @@ -1000,12 +1337,12 @@ source = "git+https://github.com/lambdaclass/ethrex.git?rev=e6d70854d0fe3b0f29ed dependencies = [ "ark-bn254", "ark-ec", - "ark-ff", + "ark-ff 0.5.0", "bitvec", "bls12_381", "bytes", "datatest-stable", - "derive_more", + "derive_more 1.0.0", "ethrex-common", "ethrex-crypto", "ethrex-rlp", @@ -1094,7 +1431,7 @@ dependencies = [ "anyhow", "bytes", "crossbeam", - "digest", + "digest 0.10.7", "ethereum-types", "ethrex-crypto", "ethrex-rlp", @@ -1117,7 +1454,7 @@ source = "git+https://github.com/lambdaclass/ethrex.git?rev=e6d70854d0fe3b0f29ed dependencies = [ "bincode 1.3.3", "bytes", - "derive_more", + "derive_more 1.0.0", "dyn-clone", "ethereum-types", "ethrex-common", @@ -1143,6 +1480,34 @@ dependencies = [ "regex-syntax", ] +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[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 = "fastrlp" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce8dba4714ef14b8274c371879b175aa55b16b30f269663f19d576f380018dc4" +dependencies = [ + "arrayvec", + "auto_impl", + "bytes", +] + [[package]] name = "ff" version = "0.13.1" @@ -1152,7 +1517,7 @@ dependencies = [ "bitvec", "byteorder", "ff_derive", - "rand_core", + "rand_core 0.6.4", "subtle", ] @@ -1184,7 +1549,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" dependencies = [ "byteorder", - "rand", + "rand 0.8.5", "rustc-hex", "static_assertions", ] @@ -1295,6 +1660,18 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasip2", +] + [[package]] name = "group" version = "0.13.0" @@ -1302,13 +1679,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" dependencies = [ "ff", - "rand_core", + "rand_core 0.6.4", "subtle", ] [[package]] name = "guest" -version = "0.3.0" +version = "0.4.0" dependencies = [ "ere-io", "ere-platform-trait", @@ -1363,6 +1740,8 @@ dependencies = [ "allocator-api2", "equivalent", "foldhash 0.2.0", + "serde", + "serde_core", ] [[package]] @@ -1389,7 +1768,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest", + "digest 0.10.7", ] [[package]] @@ -1524,6 +1903,15 @@ dependencies = [ "icu_properties", ] +[[package]] +name = "impl-codec" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" +dependencies = [ + "parity-scale-codec", +] + [[package]] name = "impl-codec" version = "0.7.1" @@ -1539,7 +1927,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "54ed8ad1f3877f7e775b8cbf30ed1bd3209a95401817f19a0eb4402d13f8cf90" dependencies = [ - "rlp", + "rlp 0.6.1", ] [[package]] @@ -1591,6 +1979,15 @@ version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" +[[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.12.1" @@ -1656,6 +2053,16 @@ dependencies = [ "cpufeatures", ] +[[package]] +name = "keccak-asm" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "505d1856a39b200489082f90d897c3f07c455563880bc5952e38eabf731c83b6" +dependencies = [ + "digest 0.10.7", + "sha3-asm", +] + [[package]] name = "kzg-rs" version = "0.2.7" @@ -1677,8 +2084,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "58b1a1c1102a5a7fbbda117b79fb3a01e033459c738a3c1642269603484fd1c1" dependencies = [ "lambdaworks-math", - "rand", - "rand_chacha", + "rand 0.8.5", + "rand_chacha 0.3.1", "serde", "sha2", "sha3", @@ -1690,10 +2097,10 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "018a95aa873eb49896a858dee0d925c33f3978d073c64b08dd4f2c9b35a017c6" dependencies = [ - "getrandom", + "getrandom 0.2.16", "num-bigint 0.4.6", "num-traits", - "rand", + "rand 0.8.5", "rayon", "serde", "serde_json", @@ -1737,6 +2144,12 @@ dependencies = [ "escape8259", ] +[[package]] +name = "linux-raw-sys" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" + [[package]] name = "litemap" version = "0.8.1" @@ -1891,6 +2304,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", + "libm", ] [[package]] @@ -1928,7 +2342,7 @@ dependencies = [ "p3-mds", "p3-poseidon2", "p3-symmetric", - "rand", + "rand 0.8.5", "serde", ] @@ -1955,7 +2369,7 @@ dependencies = [ "num-bigint 0.4.6", "num-traits", "p3-util", - "rand", + "rand 0.8.5", "serde", ] @@ -1969,7 +2383,7 @@ dependencies = [ "p3-field", "p3-maybe-rayon", "p3-util", - "rand", + "rand 0.8.5", "serde", "tracing", ] @@ -1992,7 +2406,7 @@ dependencies = [ "p3-matrix", "p3-symmetric", "p3-util", - "rand", + "rand 0.8.5", ] [[package]] @@ -2005,7 +2419,7 @@ dependencies = [ "p3-field", "p3-mds", "p3-symmetric", - "rand", + "rand 0.8.5", "serde", ] @@ -2087,6 +2501,16 @@ version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" +[[package]] +name = "pest" +version = "2.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9eb05c21a464ea704b53158d358a31e6425db2f63a1a7312268b05fe2b75f7" +dependencies = [ + "memchr", + "ucd-trie", +] + [[package]] name = "pin-project-lite" version = "0.2.16" @@ -2142,6 +2566,17 @@ dependencies = [ "elliptic-curve", ] +[[package]] +name = "primitive-types" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" +dependencies = [ + "fixed-hash", + "impl-codec 0.6.0", + "uint 0.9.5", +] + [[package]] name = "primitive-types" version = "0.13.1" @@ -2149,10 +2584,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d15600a7d856470b7d278b3fe0e311fe28c2526348549f8ef2ff7db3299c87f5" dependencies = [ "fixed-hash", - "impl-codec", + "impl-codec 0.7.1", "impl-rlp", "impl-serde", - "uint", + "uint 0.10.0", ] [[package]] @@ -2173,6 +2608,25 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "proptest" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee689443a2bd0a16ab0348b52ee43e3b2d1b1f931c8aa5c9f8de4c86fbe8c40" +dependencies = [ + "bit-set", + "bit-vec", + "bitflags", + "num-traits", + "rand 0.9.2", + "rand_chacha 0.9.0", + "rand_xorshift", + "regex-syntax", + "rusty-fork", + "tempfile", + "unarray", +] + [[package]] name = "ptr_meta" version = "0.3.1" @@ -2202,6 +2656,12 @@ dependencies = [ "xxhash-rust", ] +[[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.42" @@ -2211,6 +2671,12 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + [[package]] name = "radium" version = "0.7.0" @@ -2233,8 +2699,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha", - "rand_core", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.5", + "serde", ] [[package]] @@ -2244,7 +2721,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.5", ] [[package]] @@ -2253,7 +2740,35 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom", + "getrandom 0.2.16", +] + +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", + "serde", +] + +[[package]] +name = "rand_xorshift" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a" +dependencies = [ + "rand_core 0.9.5", +] + +[[package]] +name = "rapidhash" +version = "4.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d8b5b858a440a0bc02625b62dd95131b9201aa9f69f411195dd4a7cfb1de3d7" +dependencies = [ + "rustversion", ] [[package]] @@ -2338,7 +2853,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" dependencies = [ - "digest", + "digest 0.10.7", ] [[package]] @@ -2371,6 +2886,16 @@ dependencies = [ "syn 2.0.111", ] +[[package]] +name = "rlp" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" +dependencies = [ + "bytes", + "rustc-hex", +] + [[package]] name = "rlp" version = "0.6.1" @@ -2381,6 +2906,40 @@ dependencies = [ "rustc-hex", ] +[[package]] +name = "ruint" +version = "1.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c141e807189ad38a07276942c6623032d3753c8859c146104ac2e4d68865945a" +dependencies = [ + "alloy-rlp", + "ark-ff 0.3.0", + "ark-ff 0.4.2", + "ark-ff 0.5.0", + "bytes", + "fastrlp 0.3.1", + "fastrlp 0.4.0", + "num-bigint 0.4.6", + "num-integer", + "num-traits", + "parity-scale-codec", + "primitive-types 0.12.2", + "proptest", + "rand 0.8.5", + "rand 0.9.2", + "rlp 0.5.2", + "ruint-macro", + "serde_core", + "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-hash" version = "2.1.1" @@ -2393,12 +2952,55 @@ 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.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver 1.0.27", +] + +[[package]] +name = "rustix" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] + [[package]] name = "rustversion" version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" +[[package]] +name = "rusty-fork" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc6bf79ff24e648f6da1f8d1f011e9cac26491b619e6b9280f2b47f1774e6ee2" +dependencies = [ + "fnv", + "quick-error", + "tempfile", + "wait-timeout", +] + [[package]] name = "ryu" version = "1.0.20" @@ -2461,6 +3063,30 @@ dependencies = [ "zeroize", ] +[[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.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" + +[[package]] +name = "semver-parser" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9900206b54a3527fdc7b8a938bffd94a568bac4f4aa8113b209df75a09c0dec2" +dependencies = [ + "pest", +] + [[package]] name = "serde" version = "1.0.228" @@ -2538,7 +3164,7 @@ version = "3.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52a8e3ca0ca629121f70ab50f95249e5a6f925cc0f6ffe8256c45b728875706c" dependencies = [ - "darling", + "darling 0.21.3", "proc-macro2", "quote", "syn 2.0.111", @@ -2551,7 +3177,7 @@ source = "git+https://github.com/0xPolygonHermez/zisk-patch-hashes.git?tag=patch dependencies = [ "cfg-if", "cpufeatures", - "digest", + "digest 0.10.7", ] [[package]] @@ -2559,10 +3185,20 @@ name = "sha3" version = "0.10.8" source = "git+https://github.com/0xPolygonHermez/zisk-patch-hashes.git?tag=patch-sha3-0.10.8-zisk-0.15.0#08098df5827b672d604e2dc440446b86064b99f2" dependencies = [ - "digest", + "digest 0.10.7", "keccak", ] +[[package]] +name = "sha3-asm" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28efc5e327c837aa837c59eae585fc250715ef939ac32881bcc11677cd02d46" +dependencies = [ + "cc", + "cfg-if", +] + [[package]] name = "sharded-slab" version = "0.1.7" @@ -2584,8 +3220,8 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ - "digest", - "rand_core", + "digest 0.10.7", + "rand_core 0.6.4", ] [[package]] @@ -2652,7 +3288,7 @@ dependencies = [ "ff", "group", "pairing", - "rand_core", + "rand_core 0.6.4", "sp1-lib", "subtle", ] @@ -2673,6 +3309,22 @@ dependencies = [ "der", ] +[[package]] +name = "ssz_types" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b55bedc9a18ed2860a46d6beb4f4082416ee1d60be0cc364cebdcdddc7afd4" +dependencies = [ + "ethereum_serde_utils", + "ethereum_ssz", + "itertools 0.13.0", + "serde", + "serde_derive", + "smallvec", + "tree_hash", + "typenum", +] + [[package]] name = "stable_deref_trait" version = "1.2.1" @@ -2681,17 +3333,30 @@ checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" [[package]] name = "stateless-validator-common" -version = "0.3.0" +version = "0.4.0" dependencies = [ + "anyhow", + "ethereum_ssz", + "ethereum_ssz_derive", "rkyv", + "serde", + "serde_with", + "sha2", + "ssz_types", + "tree_hash", + "tree_hash_derive", + "typenum", ] [[package]] name = "stateless-validator-ethrex" -version = "0.3.0" +version = "0.4.0" dependencies = [ + "anyhow", + "bytes", "ere-io", "ethrex-common", + "ethrex-rlp", "ethrex-vm", "guest", "guest_program", @@ -2748,7 +3413,7 @@ dependencies = [ "byteorder", "crunchy", "lazy_static", - "rand", + "rand 0.8.5", "rustc-hex", ] @@ -2797,6 +3462,19 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" +[[package]] +name = "tempfile" +version = "3.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "655da9c7eb6305c55742045d5a8d2037996d61d8de95806335c7c86ce0f82e9c" +dependencies = [ + "fastrand", + "getrandom 0.3.4", + "once_cell", + "rustix", + "windows-sys", +] + [[package]] name = "thiserror" version = "2.0.17" @@ -3006,12 +3684,55 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "tree_hash" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee44f4cef85f88b4dea21c0b1f58320bdf35715cf56d840969487cff00613321" +dependencies = [ + "alloy-primitives", + "ethereum_hashing", + "ethereum_ssz", + "smallvec", + "typenum", +] + +[[package]] +name = "tree_hash_derive" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bee2ea1551f90040ab0e34b6fb7f2fa3bad8acc925837ac654f2c78a13e3089" +dependencies = [ + "darling 0.20.11", + "proc-macro2", + "quote", + "syn 2.0.111", +] + [[package]] name = "typenum" version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + +[[package]] +name = "uint" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", +] + [[package]] name = "uint" version = "0.10.0" @@ -3024,6 +3745,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 = "unicode-ident" version = "1.0.22" @@ -3100,6 +3827,15 @@ version = "0.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "051eb1abcf10076295e815102942cc58f9d5e3b4560e46e53c21e8ff6f3af7b1" +[[package]] +name = "wait-timeout" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11" +dependencies = [ + "libc", +] + [[package]] name = "walkdir" version = "2.5.0" @@ -3116,6 +3852,15 @@ version = "0.11.1+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" +[[package]] +name = "wasip2" +version = "1.0.1+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" +dependencies = [ + "wit-bindgen", +] + [[package]] name = "wasm-bindgen" version = "0.2.106" @@ -3257,6 +4002,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "wit-bindgen" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" + [[package]] name = "writeable" version = "0.6.2" @@ -3402,13 +4153,13 @@ source = "git+https://github.com/0xPolygonHermez/zisk.git?tag=v0.15.0#b3ca745b80 dependencies = [ "bincode 2.0.1", "cfg-if", - "getrandom", + "getrandom 0.2.16", "lazy_static", "lib-c", "num-bigint 0.4.6", "num-integer", "num-traits", - "rand", + "rand 0.8.5", "serde", "static_assertions", "tiny-keccak", diff --git a/bin/stateless-validator-ethrex/zisk/Cargo.toml b/bin/stateless-validator-ethrex/zisk/Cargo.toml index ab134467..d40bdefc 100644 --- a/bin/stateless-validator-ethrex/zisk/Cargo.toml +++ b/bin/stateless-validator-ethrex/zisk/Cargo.toml @@ -10,7 +10,10 @@ version = "0.1.0" ere-platform-zisk = { git = "https://github.com/eth-act/ere", rev = "ec75f8a26657ddbf7efc44cdb3167fff4f55fe27" } # local -stateless-validator-ethrex = { path = "../../../crates/stateless-validator-ethrex", features = ["std", "zisk"] } +stateless-validator-ethrex = { path = "../../../crates/stateless-validator-ethrex", features = [ + "std", + "zisk", +] } [patch.crates-io] sha2 = { git = "https://github.com/0xPolygonHermez/zisk-patch-hashes.git", tag = "patch-sha2-0.10.9-zisk-0.15.0" } @@ -20,6 +23,7 @@ substrate-bn = { git = "https://github.com/0xPolygonHermez/zisk-patch-bn.git", t sp1_bls12_381 = { git = "https://github.com/0xPolygonHermez/zisk-patch-bls12-381", tag = "patch-0.8.0-zisk-0.15.0" } tiny-keccak = { git = "https://github.com/0xPolygonHermez/zisk-patch-tiny-keccak/", tag = "patch-2.0.2-zisk-0.15.0" } kzg-rs = { git = "https://github.com/0xPolygonHermez/zisk-patch-kzg/", tag = "patch-0.2.7-zisk-0.15.0" } +ethereum_hashing = { git = "https://github.com/jsign/ethereum_hashing", rev = "08c88633b700d7447ef840d19ce7b369c44311de" } [features] l2 = ["stateless-validator-ethrex/l2"] diff --git a/bin/stateless-validator-reth/airbender/Cargo.lock b/bin/stateless-validator-reth/airbender/Cargo.lock index 3622fa83..96a18b0b 100644 --- a/bin/stateless-validator-reth/airbender/Cargo.lock +++ b/bin/stateless-validator-reth/airbender/Cargo.lock @@ -267,7 +267,10 @@ dependencies = [ "alloy-eips", "alloy-primitives", "alloy-rlp", + "alloy-serde", "derive_more", + "rand 0.8.5", + "serde", "strum", ] @@ -398,7 +401,7 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04950a13cc4209d8e9b78f306e87782466bad8538c94324702d061ff03e211c9" dependencies = [ - "darling", + "darling 0.21.3", "proc-macro2", "quote", "syn 2.0.111", @@ -413,6 +416,12 @@ dependencies = [ "libc", ] +[[package]] +name = "anyhow" +version = "1.0.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" + [[package]] name = "ark-bls12-381" version = "0.5.0" @@ -1029,14 +1038,38 @@ dependencies = [ "typenum", ] +[[package]] +name = "darling" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" +dependencies = [ + "darling_core 0.20.11", + "darling_macro 0.20.11", +] + [[package]] name = "darling" version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" dependencies = [ - "darling_core", - "darling_macro", + "darling_core 0.21.3", + "darling_macro 0.21.3", +] + +[[package]] +name = "darling_core" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.111", ] [[package]] @@ -1054,13 +1087,24 @@ dependencies = [ "syn 2.0.111", ] +[[package]] +name = "darling_macro" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" +dependencies = [ + "darling_core 0.20.11", + "quote", + "syn 2.0.111", +] + [[package]] name = "darling_macro" version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" dependencies = [ - "darling_core", + "darling_core 0.21.3", "quote", "syn 2.0.111", ] @@ -1292,6 +1336,55 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "ethereum_hashing" +version = "0.7.0" +source = "git+https://github.com/jsign/ethereum_hashing?rev=08c88633b700d7447ef840d19ce7b369c44311de#08c88633b700d7447ef840d19ce7b369c44311de" +dependencies = [ + "cpufeatures", + "sha2", +] + +[[package]] +name = "ethereum_serde_utils" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dc1355dbb41fbbd34ec28d4fb2a57d9a70c67ac3c19f6a5ca4d4a176b9e997a" +dependencies = [ + "alloy-primitives", + "hex", + "serde", + "serde_derive", + "serde_json", +] + +[[package]] +name = "ethereum_ssz" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dcddb2554d19cde19b099fadddde576929d7a4d0c1cd3512d1fd95cf174375c" +dependencies = [ + "alloy-primitives", + "ethereum_serde_utils", + "itertools 0.13.0", + "serde", + "serde_derive", + "smallvec", + "typenum", +] + +[[package]] +name = "ethereum_ssz_derive" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a657b6b3b7e153637dc6bdc6566ad9279d9ee11a15b12cfb24a2e04360637e9f" +dependencies = [ + "darling 0.20.11", + "proc-macro2", + "quote", + "syn 2.0.111", +] + [[package]] name = "fastrand" version = "2.3.0" @@ -1452,7 +1545,7 @@ dependencies = [ [[package]] name = "guest" -version = "0.3.0" +version = "0.4.0" dependencies = [ "ere-io", "ere-platform-trait", @@ -2627,6 +2720,16 @@ dependencies = [ "url", ] +[[package]] +name = "reth-payload-validator" +version = "1.9.3" +source = "git+https://github.com/paradigmxyz/reth?rev=cfde951976bfa9100a6d9f806e06fb539ae25241#cfde951976bfa9100a6d9f806e06fb539ae25241" +dependencies = [ + "alloy-consensus", + "alloy-rpc-types-engine", + "reth-primitives-traits", +] + [[package]] name = "reth-primitives-traits" version = "1.9.3" @@ -3262,7 +3365,7 @@ version = "3.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52a8e3ca0ca629121f70ab50f95249e5a6f925cc0f6ffe8256c45b728875706c" dependencies = [ - "darling", + "darling 0.21.3", "proc-macro2", "quote", "syn 2.0.111", @@ -3371,6 +3474,22 @@ dependencies = [ "der", ] +[[package]] +name = "ssz_types" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b55bedc9a18ed2860a46d6beb4f4082416ee1d60be0cc364cebdcdddc7afd4" +dependencies = [ + "ethereum_serde_utils", + "ethereum_ssz", + "itertools 0.13.0", + "serde", + "serde_derive", + "smallvec", + "tree_hash", + "typenum", +] + [[package]] name = "stable_deref_trait" version = "1.2.1" @@ -3379,26 +3498,49 @@ checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" [[package]] name = "stateless-validator-common" -version = "0.3.0" +version = "0.4.0" dependencies = [ + "anyhow", + "ethereum_ssz", + "ethereum_ssz_derive", "serde", + "serde_with", + "sha2", + "ssz_types", + "tree_hash", + "tree_hash_derive", + "typenum", ] [[package]] name = "stateless-validator-reth" -version = "0.3.0" +version = "0.4.0" dependencies = [ + "alloy-consensus", + "alloy-eips", + "alloy-genesis", + "alloy-primitives", + "alloy-rlp", + "alloy-rpc-types-engine", + "anyhow", "ere-io", + "ethereum_ssz", "guest", "once_cell", "reth-chainspec", "reth-ethereum-primitives", "reth-evm-ethereum", + "reth-payload-validator", "reth-primitives-traits", "reth-stateless", "serde", + "serde_with", + "sha2", "sparsestate", + "ssz_types", "stateless-validator-common", + "tree_hash", + "tree_hash_derive", ] [[package]] @@ -3667,6 +3809,31 @@ dependencies = [ "once_cell", ] +[[package]] +name = "tree_hash" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee44f4cef85f88b4dea21c0b1f58320bdf35715cf56d840969487cff00613321" +dependencies = [ + "alloy-primitives", + "ethereum_hashing", + "ethereum_ssz", + "smallvec", + "typenum", +] + +[[package]] +name = "tree_hash_derive" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bee2ea1551f90040ab0e34b6fb7f2fa3bad8acc925837ac654f2c78a13e3089" +dependencies = [ + "darling 0.20.11", + "proc-macro2", + "quote", + "syn 2.0.111", +] + [[package]] name = "typenum" version = "1.19.0" diff --git a/bin/stateless-validator-reth/airbender/Cargo.toml b/bin/stateless-validator-reth/airbender/Cargo.toml index 3bfc5036..00e228d0 100644 --- a/bin/stateless-validator-reth/airbender/Cargo.toml +++ b/bin/stateless-validator-reth/airbender/Cargo.toml @@ -7,17 +7,25 @@ edition = "2024" [dependencies] # enable features -alloy-primitives = { version = "1.4.1", default-features = false, features = ["map-foldhash", "sha3-keccak"] } +alloy-primitives = { version = "1.4.1", default-features = false, features = [ + "map-foldhash", + "sha3-keccak", +] } revm = { version = "33.1.0", default-features = false, features = ["bn"] } # ere -ere-platform-airbender = { git = "https://github.com/eth-act/ere", rev = "ec75f8a26657ddbf7efc44cdb3167fff4f55fe27", features = ["custom_allocator"] } +ere-platform-airbender = { git = "https://github.com/eth-act/ere", rev = "ec75f8a26657ddbf7efc44cdb3167fff4f55fe27", features = [ + "custom_allocator", +] } # local -stateless-validator-reth = { path = "../../../crates/stateless-validator-reth", default-features = false, features = ["k256"] } +stateless-validator-reth = { path = "../../../crates/stateless-validator-reth", default-features = false, features = [ + "k256", +] } [patch.crates-io] radium = { git = "https://github.com/han0110/radium", branch = "feature/riscv32ima" } +ethereum_hashing = { git = "https://github.com/jsign/ethereum_hashing", rev = "08c88633b700d7447ef840d19ce7b369c44311de" } [profile.release] codegen-units = 1 diff --git a/bin/stateless-validator-reth/openvm/Cargo.lock b/bin/stateless-validator-reth/openvm/Cargo.lock index 00bda14e..3cdb675e 100644 --- a/bin/stateless-validator-reth/openvm/Cargo.lock +++ b/bin/stateless-validator-reth/openvm/Cargo.lock @@ -267,7 +267,10 @@ dependencies = [ "alloy-eips", "alloy-primitives", "alloy-rlp", + "alloy-serde", "derive_more", + "rand 0.8.5", + "serde", "strum", ] @@ -285,7 +288,7 @@ dependencies = [ "alloy-rlp", "alloy-serde", "alloy-sol-types", - "itertools 0.13.0", + "itertools 0.14.0", "serde", "serde_json", "serde_with", @@ -398,7 +401,7 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04950a13cc4209d8e9b78f306e87782466bad8538c94324702d061ff03e211c9" dependencies = [ - "darling", + "darling 0.21.3", "proc-macro2", "quote", "syn 2.0.111", @@ -413,6 +416,12 @@ dependencies = [ "libc", ] +[[package]] +name = "anyhow" +version = "1.0.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" + [[package]] name = "ark-bls12-381" version = "0.5.0" @@ -1090,14 +1099,38 @@ dependencies = [ "typenum", ] +[[package]] +name = "darling" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" +dependencies = [ + "darling_core 0.20.11", + "darling_macro 0.20.11", +] + [[package]] name = "darling" version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" dependencies = [ - "darling_core", - "darling_macro", + "darling_core 0.21.3", + "darling_macro 0.21.3", +] + +[[package]] +name = "darling_core" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.111", ] [[package]] @@ -1115,13 +1148,24 @@ dependencies = [ "syn 2.0.111", ] +[[package]] +name = "darling_macro" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" +dependencies = [ + "darling_core 0.20.11", + "quote", + "syn 2.0.111", +] + [[package]] name = "darling_macro" version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" dependencies = [ - "darling_core", + "darling_core 0.21.3", "quote", "syn 2.0.111", ] @@ -1353,6 +1397,55 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "ethereum_hashing" +version = "0.7.0" +source = "git+https://github.com/jsign/ethereum_hashing?rev=08c88633b700d7447ef840d19ce7b369c44311de#08c88633b700d7447ef840d19ce7b369c44311de" +dependencies = [ + "cpufeatures", + "sha2", +] + +[[package]] +name = "ethereum_serde_utils" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dc1355dbb41fbbd34ec28d4fb2a57d9a70c67ac3c19f6a5ca4d4a176b9e997a" +dependencies = [ + "alloy-primitives", + "hex", + "serde", + "serde_derive", + "serde_json", +] + +[[package]] +name = "ethereum_ssz" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dcddb2554d19cde19b099fadddde576929d7a4d0c1cd3512d1fd95cf174375c" +dependencies = [ + "alloy-primitives", + "ethereum_serde_utils", + "itertools 0.13.0", + "serde", + "serde_derive", + "smallvec", + "typenum", +] + +[[package]] +name = "ethereum_ssz_derive" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a657b6b3b7e153637dc6bdc6566ad9279d9ee11a15b12cfb24a2e04360637e9f" +dependencies = [ + "darling 0.20.11", + "proc-macro2", + "quote", + "syn 2.0.111", +] + [[package]] name = "fastrand" version = "2.3.0" @@ -1520,7 +1613,7 @@ dependencies = [ [[package]] name = "guest" -version = "0.3.0" +version = "0.4.0" dependencies = [ "ere-io", "ere-platform-trait", @@ -3113,6 +3206,16 @@ dependencies = [ "url", ] +[[package]] +name = "reth-payload-validator" +version = "1.9.3" +source = "git+https://github.com/paradigmxyz/reth?rev=cfde951976bfa9100a6d9f806e06fb539ae25241#cfde951976bfa9100a6d9f806e06fb539ae25241" +dependencies = [ + "alloy-consensus", + "alloy-rpc-types-engine", + "reth-primitives-traits", +] + [[package]] name = "reth-primitives-traits" version = "1.9.3" @@ -3760,7 +3863,7 @@ version = "3.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52a8e3ca0ca629121f70ab50f95249e5a6f925cc0f6ffe8256c45b728875706c" dependencies = [ - "darling", + "darling 0.21.3", "proc-macro2", "quote", "syn 2.0.111", @@ -3875,6 +3978,22 @@ dependencies = [ "der", ] +[[package]] +name = "ssz_types" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b55bedc9a18ed2860a46d6beb4f4082416ee1d60be0cc364cebdcdddc7afd4" +dependencies = [ + "ethereum_serde_utils", + "ethereum_ssz", + "itertools 0.13.0", + "serde", + "serde_derive", + "smallvec", + "tree_hash", + "typenum", +] + [[package]] name = "stable_deref_trait" version = "1.2.1" @@ -3883,26 +4002,49 @@ checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" [[package]] name = "stateless-validator-common" -version = "0.3.0" +version = "0.4.0" dependencies = [ + "anyhow", + "ethereum_ssz", + "ethereum_ssz_derive", "serde", + "serde_with", + "sha2", + "ssz_types", + "tree_hash", + "tree_hash_derive", + "typenum", ] [[package]] name = "stateless-validator-reth" -version = "0.3.0" +version = "0.4.0" dependencies = [ + "alloy-consensus", + "alloy-eips", + "alloy-genesis", + "alloy-primitives", + "alloy-rlp", + "alloy-rpc-types-engine", + "anyhow", "ere-io", + "ethereum_ssz", "guest", "once_cell", "reth-chainspec", "reth-ethereum-primitives", "reth-evm-ethereum", + "reth-payload-validator", "reth-primitives-traits", "reth-stateless", "serde", + "serde_with", + "sha2", "sparsestate", + "ssz_types", "stateless-validator-common", + "tree_hash", + "tree_hash_derive", ] [[package]] @@ -4181,6 +4323,31 @@ dependencies = [ "once_cell", ] +[[package]] +name = "tree_hash" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee44f4cef85f88b4dea21c0b1f58320bdf35715cf56d840969487cff00613321" +dependencies = [ + "alloy-primitives", + "ethereum_hashing", + "ethereum_ssz", + "smallvec", + "typenum", +] + +[[package]] +name = "tree_hash_derive" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bee2ea1551f90040ab0e34b6fb7f2fa3bad8acc925837ac654f2c78a13e3089" +dependencies = [ + "darling 0.20.11", + "proc-macro2", + "quote", + "syn 2.0.111", +] + [[package]] name = "typenum" version = "1.19.0" diff --git a/bin/stateless-validator-reth/openvm/Cargo.toml b/bin/stateless-validator-reth/openvm/Cargo.toml index eb1c7f26..b08f77cc 100644 --- a/bin/stateless-validator-reth/openvm/Cargo.toml +++ b/bin/stateless-validator-reth/openvm/Cargo.toml @@ -7,25 +7,39 @@ edition = "2024" [dependencies] # enable features -alloy-consensus = { version = "1.1.2", default-features = false, features = ["crypto-backend"] } -alloy-primitives = { version = "1.4.1", default-features = false, features = ["map-hashbrown", "native-keccak"] } +alloy-consensus = { version = "1.1.2", default-features = false, features = [ + "crypto-backend", +] } +alloy-primitives = { version = "1.4.1", default-features = false, features = [ + "map-hashbrown", + "native-keccak", +] } # revm revm = { version = "33.1.0", default-features = false } # openvm -openvm = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.2", features = ["std"] } +openvm = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.2", features = [ + "std", +] } openvm-algebra-guest = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.2" } openvm-ecc-guest = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.2" } openvm-k256 = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.2", package = "k256" } openvm-keccak256 = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.2" } openvm-p256 = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.2", package = "p256" } -openvm-pairing = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.2", features = ["bn254", "bls12_381"] } +openvm-pairing = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.2", features = [ + "bn254", + "bls12_381", +] } openvm-sha2 = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.2" } -openvm-kzg = { git = "https://github.com/axiom-crypto/openvm-kzg.git", rev = "530a6ed413def5296b7e4967650ba4fc8fd92ea1", default-features = false, features = ["use-intrinsics"] } +openvm-kzg = { git = "https://github.com/axiom-crypto/openvm-kzg.git", rev = "530a6ed413def5296b7e4967650ba4fc8fd92ea1", default-features = false, features = [ + "use-intrinsics", +] } # ere -ere-platform-openvm = { git = "https://github.com/eth-act/ere", rev = "ec75f8a26657ddbf7efc44cdb3167fff4f55fe27", features = ["std"] } +ere-platform-openvm = { git = "https://github.com/eth-act/ere", rev = "ec75f8a26657ddbf7efc44cdb3167fff4f55fe27", features = [ + "std", +] } # local stateless-validator-reth = { path = "../../../crates/stateless-validator-reth" } @@ -50,6 +64,9 @@ openvm-rv32im-guest = { git = "https://github.com/openvm-org//openvm.git", tag = openvm-sha2 = { git = "https://github.com/openvm-org//openvm.git", tag = "v1.4.2" } openvm-sha256-guest = { git = "https://github.com/openvm-org//openvm.git", tag = "v1.4.2" } +[patch.crates-io] +ethereum_hashing = { git = "https://github.com/jsign/ethereum_hashing", rev = "08c88633b700d7447ef840d19ce7b369c44311de" } + [profile.release] codegen-units = 1 lto = "fat" diff --git a/bin/stateless-validator-reth/pico/Cargo.lock b/bin/stateless-validator-reth/pico/Cargo.lock index 1f38f465..3d9e2609 100644 --- a/bin/stateless-validator-reth/pico/Cargo.lock +++ b/bin/stateless-validator-reth/pico/Cargo.lock @@ -302,7 +302,10 @@ dependencies = [ "alloy-eips", "alloy-primitives", "alloy-rlp", + "alloy-serde", "derive_more 2.1.1", + "rand 0.8.5", + "serde", "strum 0.27.2", ] @@ -433,7 +436,7 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04950a13cc4209d8e9b78f306e87782466bad8538c94324702d061ff03e211c9" dependencies = [ - "darling", + "darling 0.21.3", "proc-macro2", "quote", "syn 2.0.111", @@ -1409,14 +1412,38 @@ dependencies = [ "syn 2.0.111", ] +[[package]] +name = "darling" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" +dependencies = [ + "darling_core 0.20.11", + "darling_macro 0.20.11", +] + [[package]] name = "darling" version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" dependencies = [ - "darling_core", - "darling_macro", + "darling_core 0.21.3", + "darling_macro 0.21.3", +] + +[[package]] +name = "darling_core" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.111", ] [[package]] @@ -1434,13 +1461,24 @@ dependencies = [ "syn 2.0.111", ] +[[package]] +name = "darling_macro" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" +dependencies = [ + "darling_core 0.20.11", + "quote", + "syn 2.0.111", +] + [[package]] name = "darling_macro" version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" dependencies = [ - "darling_core", + "darling_core 0.21.3", "quote", "syn 2.0.111", ] @@ -1823,6 +1861,55 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "ethereum_hashing" +version = "0.7.0" +source = "git+https://github.com/jsign/ethereum_hashing?rev=08c88633b700d7447ef840d19ce7b369c44311de#08c88633b700d7447ef840d19ce7b369c44311de" +dependencies = [ + "cpufeatures", + "sha2", +] + +[[package]] +name = "ethereum_serde_utils" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dc1355dbb41fbbd34ec28d4fb2a57d9a70c67ac3c19f6a5ca4d4a176b9e997a" +dependencies = [ + "alloy-primitives", + "hex", + "serde", + "serde_derive", + "serde_json", +] + +[[package]] +name = "ethereum_ssz" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dcddb2554d19cde19b099fadddde576929d7a4d0c1cd3512d1fd95cf174375c" +dependencies = [ + "alloy-primitives", + "ethereum_serde_utils", + "itertools 0.13.0", + "serde", + "serde_derive", + "smallvec", + "typenum", +] + +[[package]] +name = "ethereum_ssz_derive" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a657b6b3b7e153637dc6bdc6566ad9279d9ee11a15b12cfb24a2e04360637e9f" +dependencies = [ + "darling 0.20.11", + "proc-macro2", + "quote", + "syn 2.0.111", +] + [[package]] name = "eyre" version = "0.6.12" @@ -2052,7 +2139,7 @@ dependencies = [ [[package]] name = "guest" -version = "0.3.0" +version = "0.4.0" dependencies = [ "ere-io", "ere-platform-trait", @@ -4153,6 +4240,16 @@ dependencies = [ "url", ] +[[package]] +name = "reth-payload-validator" +version = "1.9.3" +source = "git+https://github.com/paradigmxyz/reth?rev=cfde951976bfa9100a6d9f806e06fb539ae25241#cfde951976bfa9100a6d9f806e06fb539ae25241" +dependencies = [ + "alloy-consensus", + "alloy-rpc-types-engine", + "reth-primitives-traits", +] + [[package]] name = "reth-primitives-traits" version = "1.9.3" @@ -4844,7 +4941,7 @@ version = "3.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52a8e3ca0ca629121f70ab50f95249e5a6f925cc0f6ffe8256c45b728875706c" dependencies = [ - "darling", + "darling 0.21.3", "proc-macro2", "quote", "syn 2.0.111", @@ -4970,6 +5067,22 @@ dependencies = [ "der", ] +[[package]] +name = "ssz_types" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b55bedc9a18ed2860a46d6beb4f4082416ee1d60be0cc364cebdcdddc7afd4" +dependencies = [ + "ethereum_serde_utils", + "ethereum_ssz", + "itertools 0.13.0", + "serde", + "serde_derive", + "smallvec", + "tree_hash", + "typenum", +] + [[package]] name = "stable_deref_trait" version = "1.2.1" @@ -4978,26 +5091,49 @@ checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" [[package]] name = "stateless-validator-common" -version = "0.3.0" +version = "0.4.0" dependencies = [ + "anyhow", + "ethereum_ssz", + "ethereum_ssz_derive", "serde", + "serde_with", + "sha2", + "ssz_types", + "tree_hash", + "tree_hash_derive", + "typenum", ] [[package]] name = "stateless-validator-reth" -version = "0.3.0" +version = "0.4.0" dependencies = [ + "alloy-consensus", + "alloy-eips", + "alloy-genesis", + "alloy-primitives", + "alloy-rlp", + "alloy-rpc-types-engine", + "anyhow", "ere-io", + "ethereum_ssz", "guest", "once_cell", "reth-chainspec", "reth-ethereum-primitives", "reth-evm-ethereum", + "reth-payload-validator", "reth-primitives-traits", "reth-stateless", "serde", + "serde_with", + "sha2", "sparsestate", + "ssz_types", "stateless-validator-common", + "tree_hash", + "tree_hash_derive", ] [[package]] @@ -5412,6 +5548,31 @@ dependencies = [ "strength_reduce", ] +[[package]] +name = "tree_hash" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee44f4cef85f88b4dea21c0b1f58320bdf35715cf56d840969487cff00613321" +dependencies = [ + "alloy-primitives", + "ethereum_hashing", + "ethereum_ssz", + "smallvec", + "typenum", +] + +[[package]] +name = "tree_hash_derive" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bee2ea1551f90040ab0e34b6fb7f2fa3bad8acc925837ac654f2c78a13e3089" +dependencies = [ + "darling 0.20.11", + "proc-macro2", + "quote", + "syn 2.0.111", +] + [[package]] name = "typenum" version = "1.19.0" diff --git a/bin/stateless-validator-reth/pico/Cargo.toml b/bin/stateless-validator-reth/pico/Cargo.toml index 715929f3..8104bbea 100644 --- a/bin/stateless-validator-reth/pico/Cargo.toml +++ b/bin/stateless-validator-reth/pico/Cargo.toml @@ -7,7 +7,10 @@ edition = "2024" [dependencies] # enable features -alloy-primitives = { version = "1.4.1", default-features = false, features = ["map-foldhash", "sha3-keccak"] } +alloy-primitives = { version = "1.4.1", default-features = false, features = [ + "map-foldhash", + "sha3-keccak", +] } revm = { version = "33.1.0", default-features = false, features = ["bn"] } # crypto provider @@ -26,6 +29,7 @@ sha3 = { git = "https://github.com/brevis-network/hashes", tag = "pico-patch-v1. curve25519-dalek = { git = "https://github.com/brevis-network/curve25519-dalek", tag = "pico-patch-v1.0.1-curve25519-dalek-v4.1.3" } ecdsa-core = { git = "https://github.com/brevis-network/signatures", tag = "pico-patch-v1.0.1-ecdsa-0.16.9", package = "ecdsa" } substrate-bn = { git = "https://github.com/brevis-network/bn", tag = "pico-patch-v1.0.1-bn-v0.6.0" } +ethereum_hashing = { git = "https://github.com/jsign/ethereum_hashing", rev = "08c88633b700d7447ef840d19ce7b369c44311de" } [profile.release] codegen-units = 1 diff --git a/bin/stateless-validator-reth/risc0/Cargo.lock b/bin/stateless-validator-reth/risc0/Cargo.lock index 6696dd3f..9a8a9425 100644 --- a/bin/stateless-validator-reth/risc0/Cargo.lock +++ b/bin/stateless-validator-reth/risc0/Cargo.lock @@ -267,7 +267,10 @@ dependencies = [ "alloy-eips", "alloy-primitives", "alloy-rlp", + "alloy-serde", "derive_more", + "rand 0.8.5", + "serde", "strum", ] @@ -398,7 +401,7 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04950a13cc4209d8e9b78f306e87782466bad8538c94324702d061ff03e211c9" dependencies = [ - "darling", + "darling 0.21.3", "proc-macro2", "quote", "syn 2.0.111", @@ -1202,14 +1205,38 @@ dependencies = [ "typenum", ] +[[package]] +name = "darling" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" +dependencies = [ + "darling_core 0.20.11", + "darling_macro 0.20.11", +] + [[package]] name = "darling" version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" dependencies = [ - "darling_core", - "darling_macro", + "darling_core 0.21.3", + "darling_macro 0.21.3", +] + +[[package]] +name = "darling_core" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.111", ] [[package]] @@ -1227,13 +1254,24 @@ dependencies = [ "syn 2.0.111", ] +[[package]] +name = "darling_macro" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" +dependencies = [ + "darling_core 0.20.11", + "quote", + "syn 2.0.111", +] + [[package]] name = "darling_macro" version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" dependencies = [ - "darling_core", + "darling_core 0.21.3", "quote", "syn 2.0.111", ] @@ -1490,6 +1528,55 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "ethereum_hashing" +version = "0.7.0" +source = "git+https://github.com/jsign/ethereum_hashing?rev=08c88633b700d7447ef840d19ce7b369c44311de#08c88633b700d7447ef840d19ce7b369c44311de" +dependencies = [ + "cpufeatures", + "sha2", +] + +[[package]] +name = "ethereum_serde_utils" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dc1355dbb41fbbd34ec28d4fb2a57d9a70c67ac3c19f6a5ca4d4a176b9e997a" +dependencies = [ + "alloy-primitives", + "hex", + "serde", + "serde_derive", + "serde_json", +] + +[[package]] +name = "ethereum_ssz" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dcddb2554d19cde19b099fadddde576929d7a4d0c1cd3512d1fd95cf174375c" +dependencies = [ + "alloy-primitives", + "ethereum_serde_utils", + "itertools 0.13.0", + "serde", + "serde_derive", + "smallvec", + "typenum", +] + +[[package]] +name = "ethereum_ssz_derive" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a657b6b3b7e153637dc6bdc6566ad9279d9ee11a15b12cfb24a2e04360637e9f" +dependencies = [ + "darling 0.20.11", + "proc-macro2", + "quote", + "syn 2.0.111", +] + [[package]] name = "fastrand" version = "2.3.0" @@ -1687,7 +1774,7 @@ dependencies = [ [[package]] name = "guest" -version = "0.3.0" +version = "0.4.0" dependencies = [ "ere-io", "ere-platform-trait", @@ -2942,6 +3029,16 @@ dependencies = [ "url", ] +[[package]] +name = "reth-payload-validator" +version = "1.9.3" +source = "git+https://github.com/paradigmxyz/reth?rev=cfde951976bfa9100a6d9f806e06fb539ae25241#cfde951976bfa9100a6d9f806e06fb539ae25241" +dependencies = [ + "alloy-consensus", + "alloy-rpc-types-engine", + "reth-primitives-traits", +] + [[package]] name = "reth-primitives-traits" version = "1.9.3" @@ -3825,7 +3922,7 @@ version = "3.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52a8e3ca0ca629121f70ab50f95249e5a6f925cc0f6ffe8256c45b728875706c" dependencies = [ - "darling", + "darling 0.21.3", "proc-macro2", "quote", "syn 2.0.111", @@ -3933,6 +4030,22 @@ dependencies = [ "der", ] +[[package]] +name = "ssz_types" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b55bedc9a18ed2860a46d6beb4f4082416ee1d60be0cc364cebdcdddc7afd4" +dependencies = [ + "ethereum_serde_utils", + "ethereum_ssz", + "itertools 0.13.0", + "serde", + "serde_derive", + "smallvec", + "tree_hash", + "typenum", +] + [[package]] name = "stability" version = "0.2.1" @@ -3951,26 +4064,49 @@ checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" [[package]] name = "stateless-validator-common" -version = "0.3.0" +version = "0.4.0" dependencies = [ + "anyhow", + "ethereum_ssz", + "ethereum_ssz_derive", "serde", + "serde_with", + "sha2", + "ssz_types", + "tree_hash", + "tree_hash_derive", + "typenum", ] [[package]] name = "stateless-validator-reth" -version = "0.3.0" +version = "0.4.0" dependencies = [ + "alloy-consensus", + "alloy-eips", + "alloy-genesis", + "alloy-primitives", + "alloy-rlp", + "alloy-rpc-types-engine", + "anyhow", "ere-io", + "ethereum_ssz", "guest", "once_cell", "reth-chainspec", "reth-ethereum-primitives", "reth-evm-ethereum", + "reth-payload-validator", "reth-primitives-traits", "reth-stateless", "serde", + "serde_with", + "sha2", "sparsestate", + "ssz_types", "stateless-validator-common", + "tree_hash", + "tree_hash_derive", ] [[package]] @@ -4251,6 +4387,31 @@ dependencies = [ "tracing-core", ] +[[package]] +name = "tree_hash" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee44f4cef85f88b4dea21c0b1f58320bdf35715cf56d840969487cff00613321" +dependencies = [ + "alloy-primitives", + "ethereum_hashing", + "ethereum_ssz", + "smallvec", + "typenum", +] + +[[package]] +name = "tree_hash_derive" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bee2ea1551f90040ab0e34b6fb7f2fa3bad8acc925837ac654f2c78a13e3089" +dependencies = [ + "darling 0.20.11", + "proc-macro2", + "quote", + "syn 2.0.111", +] + [[package]] name = "typenum" version = "1.19.0" diff --git a/bin/stateless-validator-reth/risc0/Cargo.toml b/bin/stateless-validator-reth/risc0/Cargo.toml index f1a08de6..b6774e0c 100644 --- a/bin/stateless-validator-reth/risc0/Cargo.toml +++ b/bin/stateless-validator-reth/risc0/Cargo.toml @@ -7,11 +7,24 @@ edition = "2024" [dependencies] # enable features -alloy-primitives = { version = "1.4.1", default-features = false, features = ["map-foldhash", "tiny-keccak"] } -revm = { version = "33.1.0", default-features = false, features = ["std", "c-kzg", "blst", "bn"] } +alloy-primitives = { version = "1.4.1", default-features = false, features = [ + "map-foldhash", + "tiny-keccak", +] } +revm = { version = "33.1.0", default-features = false, features = [ + "std", + "c-kzg", + "blst", + "bn", +] } # ere -ere-platform-risc0 = { git = "https://github.com/eth-act/ere", rev = "ec75f8a26657ddbf7efc44cdb3167fff4f55fe27", features = ["std", "unstable", "getrandom", "sys-getenv"] } +ere-platform-risc0 = { git = "https://github.com/eth-act/ere", rev = "ec75f8a26657ddbf7efc44cdb3167fff4f55fe27", features = [ + "std", + "unstable", + "getrandom", + "sys-getenv", +] } # local stateless-validator-reth = { path = "../../../crates/stateless-validator-reth" } @@ -25,6 +38,7 @@ p256 = { git = "https://github.com/risc0/RustCrypto-elliptic-curves", tag = "p25 substrate-bn = { git = "https://github.com/risc0/paritytech-bn", tag = "v0.6.0-risczero.0" } crypto-bigint = { git = "https://github.com/risc0/RustCrypto-crypto-bigint", tag = "v0.5.5-risczero.0" } c-kzg = { git = "https://github.com/risc0/c-kzg-4844", tag = "v2.1.5-risczero.0" } +ethereum_hashing = { git = "https://github.com/jsign/ethereum_hashing", rev = "08c88633b700d7447ef840d19ce7b369c44311de" } [profile.release] codegen-units = 1 diff --git a/bin/stateless-validator-reth/sp1/Cargo.lock b/bin/stateless-validator-reth/sp1/Cargo.lock index 9dd98c5b..2d3653ef 100644 --- a/bin/stateless-validator-reth/sp1/Cargo.lock +++ b/bin/stateless-validator-reth/sp1/Cargo.lock @@ -267,7 +267,10 @@ dependencies = [ "alloy-eips", "alloy-primitives", "alloy-rlp", + "alloy-serde", "derive_more", + "rand 0.8.5", + "serde", "strum", ] @@ -398,7 +401,7 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04950a13cc4209d8e9b78f306e87782466bad8538c94324702d061ff03e211c9" dependencies = [ - "darling", + "darling 0.21.3", "proc-macro2", "quote", "syn 2.0.111", @@ -413,6 +416,12 @@ dependencies = [ "libc", ] +[[package]] +name = "anyhow" +version = "1.0.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" + [[package]] name = "ark-bls12-381" version = "0.5.0" @@ -1076,14 +1085,38 @@ dependencies = [ "typenum", ] +[[package]] +name = "darling" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" +dependencies = [ + "darling_core 0.20.11", + "darling_macro 0.20.11", +] + [[package]] name = "darling" version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" dependencies = [ - "darling_core", - "darling_macro", + "darling_core 0.21.3", + "darling_macro 0.21.3", +] + +[[package]] +name = "darling_core" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.111", ] [[package]] @@ -1101,13 +1134,24 @@ dependencies = [ "syn 2.0.111", ] +[[package]] +name = "darling_macro" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" +dependencies = [ + "darling_core 0.20.11", + "quote", + "syn 2.0.111", +] + [[package]] name = "darling_macro" version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" dependencies = [ - "darling_core", + "darling_core 0.21.3", "quote", "syn 2.0.111", ] @@ -1339,6 +1383,55 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "ethereum_hashing" +version = "0.7.0" +source = "git+https://github.com/jsign/ethereum_hashing?rev=08c88633b700d7447ef840d19ce7b369c44311de#08c88633b700d7447ef840d19ce7b369c44311de" +dependencies = [ + "cpufeatures", + "sha2", +] + +[[package]] +name = "ethereum_serde_utils" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dc1355dbb41fbbd34ec28d4fb2a57d9a70c67ac3c19f6a5ca4d4a176b9e997a" +dependencies = [ + "alloy-primitives", + "hex", + "serde", + "serde_derive", + "serde_json", +] + +[[package]] +name = "ethereum_ssz" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dcddb2554d19cde19b099fadddde576929d7a4d0c1cd3512d1fd95cf174375c" +dependencies = [ + "alloy-primitives", + "ethereum_serde_utils", + "itertools 0.13.0", + "serde", + "serde_derive", + "smallvec", + "typenum", +] + +[[package]] +name = "ethereum_ssz_derive" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a657b6b3b7e153637dc6bdc6566ad9279d9ee11a15b12cfb24a2e04360637e9f" +dependencies = [ + "darling 0.20.11", + "proc-macro2", + "quote", + "syn 2.0.111", +] + [[package]] name = "fastrand" version = "2.3.0" @@ -1505,7 +1598,7 @@ dependencies = [ [[package]] name = "guest" -version = "0.3.0" +version = "0.4.0" dependencies = [ "ere-io", "ere-platform-trait", @@ -2812,6 +2905,16 @@ dependencies = [ "url", ] +[[package]] +name = "reth-payload-validator" +version = "1.9.3" +source = "git+https://github.com/paradigmxyz/reth?rev=cfde951976bfa9100a6d9f806e06fb539ae25241#cfde951976bfa9100a6d9f806e06fb539ae25241" +dependencies = [ + "alloy-consensus", + "alloy-rpc-types-engine", + "reth-primitives-traits", +] + [[package]] name = "reth-primitives-traits" version = "1.9.3" @@ -3441,7 +3544,7 @@ version = "3.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52a8e3ca0ca629121f70ab50f95249e5a6f925cc0f6ffe8256c45b728875706c" dependencies = [ - "darling", + "darling 0.21.3", "proc-macro2", "quote", "syn 2.0.111", @@ -3597,6 +3700,22 @@ dependencies = [ "der", ] +[[package]] +name = "ssz_types" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b55bedc9a18ed2860a46d6beb4f4082416ee1d60be0cc364cebdcdddc7afd4" +dependencies = [ + "ethereum_serde_utils", + "ethereum_ssz", + "itertools 0.13.0", + "serde", + "serde_derive", + "smallvec", + "tree_hash", + "typenum", +] + [[package]] name = "stable_deref_trait" version = "1.2.1" @@ -3605,26 +3724,49 @@ checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" [[package]] name = "stateless-validator-common" -version = "0.3.0" +version = "0.4.0" dependencies = [ + "anyhow", + "ethereum_ssz", + "ethereum_ssz_derive", "serde", + "serde_with", + "sha2", + "ssz_types", + "tree_hash", + "tree_hash_derive", + "typenum", ] [[package]] name = "stateless-validator-reth" -version = "0.3.0" +version = "0.4.0" dependencies = [ + "alloy-consensus", + "alloy-eips", + "alloy-genesis", + "alloy-primitives", + "alloy-rlp", + "alloy-rpc-types-engine", + "anyhow", "ere-io", + "ethereum_ssz", "guest", "once_cell", "reth-chainspec", "reth-ethereum-primitives", "reth-evm-ethereum", + "reth-payload-validator", "reth-primitives-traits", "reth-stateless", "serde", + "serde_with", + "sha2", "sparsestate", + "ssz_types", "stateless-validator-common", + "tree_hash", + "tree_hash_derive", ] [[package]] @@ -3896,6 +4038,31 @@ dependencies = [ "once_cell", ] +[[package]] +name = "tree_hash" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee44f4cef85f88b4dea21c0b1f58320bdf35715cf56d840969487cff00613321" +dependencies = [ + "alloy-primitives", + "ethereum_hashing", + "ethereum_ssz", + "smallvec", + "typenum", +] + +[[package]] +name = "tree_hash_derive" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bee2ea1551f90040ab0e34b6fb7f2fa3bad8acc925837ac654f2c78a13e3089" +dependencies = [ + "darling 0.20.11", + "proc-macro2", + "quote", + "syn 2.0.111", +] + [[package]] name = "typenum" version = "1.19.0" diff --git a/bin/stateless-validator-reth/sp1/Cargo.toml b/bin/stateless-validator-reth/sp1/Cargo.toml index 21b1fbc7..1df45d0f 100644 --- a/bin/stateless-validator-reth/sp1/Cargo.toml +++ b/bin/stateless-validator-reth/sp1/Cargo.toml @@ -7,7 +7,10 @@ edition = "2024" [dependencies] # enable features -alloy-primitives = { version = "1.4.1", default-features = false, features = ["map-foldhash", "sha3-keccak"] } +alloy-primitives = { version = "1.4.1", default-features = false, features = [ + "map-foldhash", + "sha3-keccak", +] } revm = { version = "33.1.0", default-features = false, features = ["bn"] } # ere @@ -25,6 +28,7 @@ k256 = { git = "https://github.com/sp1-patches/elliptic-curves", tag = "patch-k2 p256 = { git = "https://github.com/sp1-patches/elliptic-curves", tag = "patch-p256-13.2-sp1-5.0.0" } substrate-bn = { git = "https://github.com/sp1-patches/bn", tag = "patch-0.6.0-sp1-5.0.0" } ecdsa = { git = "https://github.com/sp1-patches/signatures", tag = "patch-16.9-sp1-4.1.0" } +ethereum_hashing = { git = "https://github.com/jsign/ethereum_hashing", rev = "08c88633b700d7447ef840d19ce7b369c44311de" } [profile.release] codegen-units = 1 diff --git a/bin/stateless-validator-reth/zisk/Cargo.lock b/bin/stateless-validator-reth/zisk/Cargo.lock index 2e395c2c..79e77892 100644 --- a/bin/stateless-validator-reth/zisk/Cargo.lock +++ b/bin/stateless-validator-reth/zisk/Cargo.lock @@ -267,7 +267,10 @@ dependencies = [ "alloy-eips", "alloy-primitives", "alloy-rlp", + "alloy-serde", "derive_more", + "rand 0.8.5", + "serde", "strum", ] @@ -398,7 +401,7 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04950a13cc4209d8e9b78f306e87782466bad8538c94324702d061ff03e211c9" dependencies = [ - "darling", + "darling 0.21.3", "proc-macro2", "quote", "syn 2.0.111", @@ -413,6 +416,12 @@ dependencies = [ "libc", ] +[[package]] +name = "anyhow" +version = "1.0.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" + [[package]] name = "ark-bls12-381" version = "0.5.0" @@ -1027,14 +1036,38 @@ dependencies = [ "typenum", ] +[[package]] +name = "darling" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" +dependencies = [ + "darling_core 0.20.11", + "darling_macro 0.20.11", +] + [[package]] name = "darling" version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" dependencies = [ - "darling_core", - "darling_macro", + "darling_core 0.21.3", + "darling_macro 0.21.3", +] + +[[package]] +name = "darling_core" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.111", ] [[package]] @@ -1052,13 +1085,24 @@ dependencies = [ "syn 2.0.111", ] +[[package]] +name = "darling_macro" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" +dependencies = [ + "darling_core 0.20.11", + "quote", + "syn 2.0.111", +] + [[package]] name = "darling_macro" version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" dependencies = [ - "darling_core", + "darling_core 0.21.3", "quote", "syn 2.0.111", ] @@ -1290,6 +1334,55 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "ethereum_hashing" +version = "0.7.0" +source = "git+https://github.com/jsign/ethereum_hashing?rev=08c88633b700d7447ef840d19ce7b369c44311de#08c88633b700d7447ef840d19ce7b369c44311de" +dependencies = [ + "cpufeatures", + "sha2", +] + +[[package]] +name = "ethereum_serde_utils" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dc1355dbb41fbbd34ec28d4fb2a57d9a70c67ac3c19f6a5ca4d4a176b9e997a" +dependencies = [ + "alloy-primitives", + "hex", + "serde", + "serde_derive", + "serde_json", +] + +[[package]] +name = "ethereum_ssz" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dcddb2554d19cde19b099fadddde576929d7a4d0c1cd3512d1fd95cf174375c" +dependencies = [ + "alloy-primitives", + "ethereum_serde_utils", + "itertools 0.13.0", + "serde", + "serde_derive", + "smallvec", + "typenum", +] + +[[package]] +name = "ethereum_ssz_derive" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a657b6b3b7e153637dc6bdc6566ad9279d9ee11a15b12cfb24a2e04360637e9f" +dependencies = [ + "darling 0.20.11", + "proc-macro2", + "quote", + "syn 2.0.111", +] + [[package]] name = "fastrand" version = "2.3.0" @@ -1450,7 +1543,7 @@ dependencies = [ [[package]] name = "guest" -version = "0.3.0" +version = "0.4.0" dependencies = [ "ere-io", "ere-platform-trait", @@ -1695,6 +1788,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 = "itertools" version = "0.14.0" @@ -2613,6 +2715,16 @@ dependencies = [ "url", ] +[[package]] +name = "reth-payload-validator" +version = "1.9.3" +source = "git+https://github.com/paradigmxyz/reth?rev=cfde951976bfa9100a6d9f806e06fb539ae25241#cfde951976bfa9100a6d9f806e06fb539ae25241" +dependencies = [ + "alloy-consensus", + "alloy-rpc-types-engine", + "reth-primitives-traits", +] + [[package]] name = "reth-primitives-traits" version = "1.9.3" @@ -3243,7 +3355,7 @@ version = "3.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52a8e3ca0ca629121f70ab50f95249e5a6f925cc0f6ffe8256c45b728875706c" dependencies = [ - "darling", + "darling 0.21.3", "proc-macro2", "quote", "syn 2.0.111", @@ -3350,6 +3462,22 @@ dependencies = [ "der", ] +[[package]] +name = "ssz_types" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b55bedc9a18ed2860a46d6beb4f4082416ee1d60be0cc364cebdcdddc7afd4" +dependencies = [ + "ethereum_serde_utils", + "ethereum_ssz", + "itertools 0.13.0", + "serde", + "serde_derive", + "smallvec", + "tree_hash", + "typenum", +] + [[package]] name = "stable_deref_trait" version = "1.2.1" @@ -3358,26 +3486,49 @@ checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" [[package]] name = "stateless-validator-common" -version = "0.3.0" +version = "0.4.0" dependencies = [ + "anyhow", + "ethereum_ssz", + "ethereum_ssz_derive", "serde", + "serde_with", + "sha2", + "ssz_types", + "tree_hash", + "tree_hash_derive", + "typenum", ] [[package]] name = "stateless-validator-reth" -version = "0.3.0" +version = "0.4.0" dependencies = [ + "alloy-consensus", + "alloy-eips", + "alloy-genesis", + "alloy-primitives", + "alloy-rlp", + "alloy-rpc-types-engine", + "anyhow", "ere-io", + "ethereum_ssz", "guest", "once_cell", "reth-chainspec", "reth-ethereum-primitives", "reth-evm-ethereum", + "reth-payload-validator", "reth-primitives-traits", "reth-stateless", "serde", + "serde_with", + "sha2", "sparsestate", + "ssz_types", "stateless-validator-common", + "tree_hash", + "tree_hash_derive", ] [[package]] @@ -3645,6 +3796,31 @@ dependencies = [ "once_cell", ] +[[package]] +name = "tree_hash" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee44f4cef85f88b4dea21c0b1f58320bdf35715cf56d840969487cff00613321" +dependencies = [ + "alloy-primitives", + "ethereum_hashing", + "ethereum_ssz", + "smallvec", + "typenum", +] + +[[package]] +name = "tree_hash_derive" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bee2ea1551f90040ab0e34b6fb7f2fa3bad8acc925837ac654f2c78a13e3089" +dependencies = [ + "darling 0.20.11", + "proc-macro2", + "quote", + "syn 2.0.111", +] + [[package]] name = "typenum" version = "1.19.0" diff --git a/bin/stateless-validator-reth/zisk/Cargo.toml b/bin/stateless-validator-reth/zisk/Cargo.toml index d1b32d99..a4955717 100644 --- a/bin/stateless-validator-reth/zisk/Cargo.toml +++ b/bin/stateless-validator-reth/zisk/Cargo.toml @@ -7,7 +7,10 @@ edition = "2024" [dependencies] # enable features -alloy-primitives = { version = "1.4.1", default-features = false, features = ["map-foldhash", "sha3-keccak"] } +alloy-primitives = { version = "1.4.1", default-features = false, features = [ + "map-foldhash", + "sha3-keccak", +] } revm = { version = "33.1.0", default-features = false, features = ["bn"] } # ere @@ -28,6 +31,7 @@ ark-ff = { git = "https://github.com/0xPolygonHermez/zisk-patch-ark-algebra.git" ark-bn254 = { git = "https://github.com/0xPolygonHermez/zisk-patch-ark-algebra.git", tag = "patch-0.5.0-zisk-0.15.0" } ark-serialize = { git = "https://github.com/0xPolygonHermez/zisk-patch-ark-algebra.git", tag = "patch-0.5.0-zisk-0.15.0" } aurora-engine-modexp = { git = "https://github.com/0xPolygonHermez/zisk-patch-modexp.git", tag = "patch-1.2.0-zisk-0.15.0" } +ethereum_hashing = { git = "https://github.com/jsign/ethereum_hashing", rev = "08c88633b700d7447ef840d19ce7b369c44311de" } [profile.release] codegen-units = 1 diff --git a/crates/integration-tests/Cargo.toml b/crates/integration-tests/Cargo.toml index 533f5cf2..2008fb8d 100644 --- a/crates/integration-tests/Cargo.toml +++ b/crates/integration-tests/Cargo.toml @@ -16,10 +16,15 @@ serde = { workspace = true, features = ["derive"] } tar.workspace = true tracing.workspace = true tracing-subscriber.workspace = true +tempfile.workspace = true +serde_json.workspace = true # reth reth-stateless.workspace = true +# alloy +alloy-primitives.workspace = true + # ere ere-dockerized.workspace = true ere-io.workspace = true @@ -27,15 +32,27 @@ ere-zkvm-interface.workspace = true # local guest.workspace = true +stateless-validator-common.workspace = true [dev-dependencies] -serde_json.workspace = true +reth-chainspec.workspace = true +reth-stateless.workspace = true +reth-evm-ethereum.workspace = true # ere ere-zkvm-interface.workspace = true ere-dockerized.workspace = true # local -block-encoding-length = { workspace = true, default-features = true, features = ["host"] } -stateless-validator-ethrex = { workspace = true, default-features = true, features = ["host"] } -stateless-validator-reth = { workspace = true, default-features = true, features = ["host"] } +block-encoding-length = { workspace = true, default-features = true, features = [ + "host", +] } +stateless-validator-common = { workspace = true, default-features = true, features = [ + "host", +] } +stateless-validator-ethrex = { workspace = true, default-features = true, features = [ + "host", +] } +stateless-validator-reth = { workspace = true, default-features = true, features = [ + "host", +] } diff --git a/crates/integration-tests/src/lib.rs b/crates/integration-tests/src/lib.rs index 2607db72..66fb5184 100644 --- a/crates/integration-tests/src/lib.rs +++ b/crates/integration-tests/src/lib.rs @@ -2,20 +2,22 @@ use std::{ fs::{self, File}, - path::PathBuf, + path::{Path, PathBuf}, }; use ere_dockerized::{CompilerKind, DockerizedCompiler, DockerizedzkVM, zkVMKind}; use ere_io::Io; use ere_zkvm_interface::{Compiler, Input, ProverResourceType, zkVM}; use flate2::read::GzDecoder; -use guest::{Guest, GuestInput, GuestOutput}; +use guest::{Guest, GuestInput, GuestOutput, Platform}; use rayon::prelude::*; use sha2::{Digest, Sha256}; use tar::Archive; use tracing::info; use tracing_subscriber::EnvFilter; +use crate::stateless_validator::StatelessValidatorFixture; + pub mod stateless_validator; /// Returns path to workspace @@ -32,7 +34,7 @@ pub fn fixtures_dir() -> PathBuf { } /// Unpack all fixtures in fixtures dir. -pub fn untar_fixtures() -> std::io::Result<()> { +pub fn untar_fixtures(target_dir: &Path) -> std::io::Result<()> { let fixtures_dir = fixtures_dir(); for entry in fs::read_dir(&fixtures_dir)? { @@ -41,13 +43,28 @@ pub fn untar_fixtures() -> std::io::Result<()> { if filename.is_some_and(|file_name| file_name.ends_with(".tar.gz")) { let file = File::open(&path)?; let gz = GzDecoder::new(file); - Archive::new(gz).unpack(&fixtures_dir)?; + Archive::new(gz).unpack(target_dir)?; } } Ok(()) } +/// Reads all stateless validator fixtures. +pub fn get_fixtures() -> Vec { + let dir = tempfile::tempdir().unwrap(); + let dir_path = dir.path(); + untar_fixtures(dir_path).unwrap(); + fs::read_dir(dir_path.join("block")) + .unwrap() + .map(|file| { + let bytes = fs::read(file.unwrap().path()).unwrap(); + let fixture: StatelessValidatorFixture = serde_json::from_slice(&bytes).unwrap(); + fixture + }) + .collect() +} + /// Compiles guest program and initialize zkVM. pub fn compile_and_init_zkvm(guest: &str, zkvm_kind: zkVMKind) -> DockerizedzkVM { let workspace = workspace(); @@ -134,3 +151,22 @@ impl TestCase { self } } +/// A platform that to run guests outside zkVMs. +#[derive(Debug)] +pub struct NoopPlatform; + +impl Platform for NoopPlatform { + #[allow(unreachable_code)] + fn read_whole_input() -> impl std::ops::Deref { + panic!("Can't read input in NoopPlatform"); + &[] as &[u8] + } + + fn write_whole_output(_: &[u8]) { + panic!("Can't write output in NoopPlatform"); + } + + fn print(message: &str) { + println!("{}", message); + } +} diff --git a/crates/integration-tests/src/stateless_validator.rs b/crates/integration-tests/src/stateless_validator.rs index 756e3826..f6e612cc 100644 --- a/crates/integration-tests/src/stateless_validator.rs +++ b/crates/integration-tests/src/stateless_validator.rs @@ -1,7 +1,11 @@ -//! This module proivdes struct for stateless validator test fixture. +//! This module provides struct for stateless validator test fixture. +use std::collections::HashMap; + +use alloy_primitives::{B256, b256}; use reth_stateless::StatelessInput; use serde::{Deserialize, Serialize}; +use stateless_validator_common::guest::StatelessValidatorOutput; /// A stateless validation fixture containing block data and witness information. #[derive(Debug, Clone, Serialize, Deserialize)] @@ -13,3 +17,87 @@ pub struct StatelessValidatorFixture { /// Whether the stateless block validation is successful. pub success: bool, } + +/// Returns the expected `StatelessValidatorOutput` for a given block hash in the fixtures, which was +/// calculated by an independent implementation. +pub fn get_stateless_validator_output(block_hash: B256, success: bool) -> StatelessValidatorOutput { + let expected_roots = expected_execution_payload_tree_roots(); + let expected_root = *expected_roots.get(&block_hash).unwrap(); + + StatelessValidatorOutput::new(expected_root.0, success) +} + +/// Returns a mapping of block hashes from fixtures to their expected execution payload tree roots. +/// These roots where independently computed from this repository. +fn expected_execution_payload_tree_roots() -> HashMap { + HashMap::from([ + ( + b256!("e6e4c256069674f7939f82fc808d0cd104210533c83add12d2c33d274fc3c027"), + b256!("043b1e44af00a6ff2b3c0570404d8b6701fe6221ed6aa3a39856c835f1ccdec4"), + ), + ( + b256!("74356579507633dcd34faa38c64f8ec46bc23ab5c13bbb1f2ce46786147baf54"), + b256!("03a7ab28fe855a1ba21024171c3b235e7a2e0206d2f0deefa50e186daf02fcf9"), + ), + ( + b256!("f72d095aaf5db3e99dbb76ec7f1dee9e6a3fe4cda536c073c7403ff160be356c"), + b256!("9acbdd5767796bc24c3afbfa52f56fec54636d0e78db03032abdfa8e6f81c9dd"), + ), + ( + b256!("eca0cdd3433d05468326534f1fd7b64a23b7d01c3cec0791f4c5e16e0caa4228"), + b256!("693e63f3b1db57e43f00161ef24ce591980dfc97cc0fa15fd6c1502f4dc97cec"), + ), + ( + b256!("bdee559b347d195bd65a82cac27533e2b9f94a5ba9dfb662e05033d12fb0ca4d"), + b256!("ae730c3c051710c9b18e48c7a6cbf011aa967e93d32cd969e548030c8fc1216a"), + ), + ( + b256!("8466849d8c0855c92e9732b70f58e0d228a03d7741f7f0344ad9457eda4dab99"), + b256!("3d1e280f1df9e380aefee8d6ff2cf10cd508e29812957ea53be7585b995781a0"), + ), + ( + b256!("b19d0861de72dbc6f40d6a118b05a975c3b7a525ad19db37b2bd975d60f0648f"), + b256!("fe081fe4f17e96ff956517e23e204245cce07a68e18a40489f19fc2223403d48"), + ), + ( + b256!("7c6cf5941884a4c9a3183bf4d8c0025e771838929ea3651353f9a09ddb0f56de"), + b256!("0000000000000000000000000000000000000000000000000000000000000000"), + ), + ( + b256!("2c041b9467dcf0899f85681d164d7edb08b992a552e796761c50d88dbffb6598"), + b256!("8d129e566ca042f959abf3e1bc5d0e21c2a6a52d381f1d906e0a8665aeff14fe"), + ), + ( + b256!("c8e14160123e5e2f8037857b7fdc414bc1687b7c9173218c7ba25320e9448f24"), + b256!("befe3b02a08353c0c07511f009590d01503ad076d34db02447ded858b02389d6"), + ), + ( + b256!("a6ee6b71a5c245a00e2724f3e92cf1b25e12fcc8844a343c241e00020d48500e"), + b256!("957785c5a0d6008eb28e2d01a8a19c708cb07e69a3d8ac3c5e7c0b8557e046ab"), + ), + ( + b256!("cdaf26ec02a13a84ca0a3fc0047584290e57eb972dff3d19ebf2978733f1735f"), + b256!("89134081d1d828eeba109aa97ff5714af6d9d2f44efaa48da62e81916f49c9ad"), + ), + ( + b256!("c8ac491bec27d1fbf6fa9e894b4f1ba593491e84bb593b9a81dfb89f29027149"), + b256!("5743a40b8ffd635ec3e50c4f1833fd6734af834ac43189c4bf50c9df3b18c2b9"), + ), + ( + b256!("e4bd1c4dc22a58a0a9a8e789e2c54b4ace2d1ebc16a605c3976723b52fc011f1"), + b256!("45328434f812b65daa21b4e8a3d6440d0da95fbd95a6c10b0a28f081cab53bd5"), + ), + ( + b256!("ba11cc5f2a0d42cc2d1c6ecee10b0c2c3c17dc685b17584be3474d6cafb14140"), + b256!("4e5881a6977b69b39787accd970dafb9138bc8580046be01b7b073a91cd3eaec"), + ), + ( + b256!("444460fa6bf40df3a2b419d55450fb68424c3b5dff248581afb87741be7f92b9"), + b256!("0cb48a874df4018608d53f09a025cad2977ffb06881cc6d2d07382c8280a2ce3"), + ), + ( + b256!("cec65cbf796165f17dc68b583aff9bb8e2f5ccd0fb41c03ac53d57b4740b6534"), + b256!("895c7d51f58aeab5ec891651de307043efd42300338db3dbaf0d1e36dc13138c"), + ), + ]) +} diff --git a/crates/integration-tests/tests/block-encoding-length.rs b/crates/integration-tests/tests/block-encoding-length.rs index 754197bc..df84d2da 100644 --- a/crates/integration-tests/tests/block-encoding-length.rs +++ b/crates/integration-tests/tests/block-encoding-length.rs @@ -1,20 +1,17 @@ //! Execution tests for `block-encoding-length` guest program -use std::fs; - use block_encoding_length::guest::{ BlockEncodingFormat, BlockEncodingLengthGuest, BlockEncodingLengthInput, }; use ere_dockerized::zkVMKind; -use integration_tests::{ - TestCase, fixtures_dir, stateless_validator::StatelessValidatorFixture, untar_fixtures, -}; +use integration_tests::{TestCase, get_fixtures}; fn test_execution(zkvm_kind: zkVMKind) { - untar_fixtures().unwrap(); - let path = fixtures_dir().join("block/rpc_block_22974575.json"); - let fixture: StatelessValidatorFixture = - serde_json::from_slice(&fs::read(path).unwrap()).unwrap(); + let fixtures = get_fixtures(); + let fixture = fixtures + .into_iter() + .find(|f| f.name == "rpc_block_22974575") + .expect("Fixture rpc_block_22974575.json not found"); let block = fixture.stateless_input.block; let loop_count = 10; let test_cases = [BlockEncodingFormat::Rlp, BlockEncodingFormat::Ssz].map(|format| { diff --git a/crates/integration-tests/tests/new_payload_request.rs b/crates/integration-tests/tests/new_payload_request.rs new file mode 100644 index 00000000..8ba72390 --- /dev/null +++ b/crates/integration-tests/tests/new_payload_request.rs @@ -0,0 +1,40 @@ +//! Test for StatelessInput <-> NewPayloadRequest <-> EL block conversions +use std::sync::Arc; + +use integration_tests::get_fixtures; +use reth_stateless::Genesis; +use stateless_validator_reth::{ + guest::StatelessValidatorRethInput, new_payload_request::new_payload_request_to_block, +}; + +#[test] +fn test_new_payload_request_el_block_roundtrip() { + for fixture in get_fixtures() { + // Simulate the preparation the prover does to send input to the guest. + let input = + StatelessValidatorRethInput::new(&fixture.stateless_input, fixture.success).unwrap(); + let new_payload_request = input.new_payload_request; + + // Do the work that the guest program does to reconstruct the block. + let genesis = Genesis { + config: fixture.stateless_input.chain_config.clone(), + ..Default::default() + }; + let chain_spec = Arc::new(genesis.into()); + let guest_block = new_payload_request_to_block(new_payload_request, chain_spec).unwrap(); + + // Get the block hash computed by the guest. + let guest_block_hash = guest_block.hash_slow(); + + // Original block hash from StatelessInput. + let stateless_input_block_hash = fixture.stateless_input.block.hash_slow(); + + // Assert that the EL_Block -> NewPayloadRequest -> EL_Block roundtrip is consistent with + // the original block in StatelessInput. + assert_eq!( + stateless_input_block_hash, guest_block_hash, + "Block hash mismatch for fixture: {}", + fixture.name + ); + } +} diff --git a/crates/integration-tests/tests/stateless-validator-ethrex.rs b/crates/integration-tests/tests/stateless-validator-ethrex.rs index 6c35a4d5..d7b90e93 100644 --- a/crates/integration-tests/tests/stateless-validator-ethrex.rs +++ b/crates/integration-tests/tests/stateless-validator-ethrex.rs @@ -1,31 +1,39 @@ //! Execution tests for `stateless-validator-ethrex` guest program -use std::fs; - use ere_dockerized::zkVMKind; +use guest::Guest; use integration_tests::{ - TestCase, fixtures_dir, stateless_validator::StatelessValidatorFixture, untar_fixtures, + NoopPlatform, TestCase, get_fixtures, stateless_validator::get_stateless_validator_output, }; use stateless_validator_ethrex::guest::{ - StatelessValidatorEthrexGuest, StatelessValidatorEthrexInput, StatelessValidatorOutput, + StatelessValidatorEthrexGuest, StatelessValidatorEthrexInput, }; +use stateless_validator_reth::guest::{StatelessValidatorRethGuest, StatelessValidatorRethInput}; fn test_execution(zkvm_kind: zkVMKind) { - untar_fixtures().unwrap(); - let inputs = fs::read_dir(fixtures_dir().join("block")) - .unwrap() - .map(|file| { - let bytes = fs::read(file.unwrap().path()).unwrap(); - let fixture: StatelessValidatorFixture = serde_json::from_slice(&bytes).unwrap(); - let input = StatelessValidatorEthrexInput::new(&fixture.stateless_input).unwrap(); - let output = StatelessValidatorOutput::new( + let fixtures = get_fixtures(); + let inputs = fixtures.into_iter().map(|fixture| { + let output = if !fixture.success { + let input = StatelessValidatorRethInput::new(&fixture.stateless_input, fixture.success) + .unwrap(); + // For invalid blocks we can't correctly generate the NewPayloadRequest + // from an EL block. This is because to get the Electra requests, we + // need to execute the block successfully first. + StatelessValidatorRethGuest::compute::(input.clone()) + } else { + // For valid blocks (i.e. mainnet), we can rely on testing the output against an independent + // implementation that calculated the NewPayloadRequest root from a CL block. + get_stateless_validator_output( fixture.stateless_input.block.hash_slow(), - fixture.stateless_input.block.parent_hash, fixture.success, - ); - TestCase::new::(fixture.name, input, output) - .output_sha256() - }); + ) + }; + assert_eq!(output.successful_block_validation, fixture.success); + + let input = + StatelessValidatorEthrexInput::new(&fixture.stateless_input, fixture.success).unwrap(); + TestCase::new::(fixture.name, input, output).output_sha256() + }); integration_tests::test_execution("stateless-validator-ethrex", zkvm_kind, inputs); } diff --git a/crates/integration-tests/tests/stateless-validator-reth.rs b/crates/integration-tests/tests/stateless-validator-reth.rs index 4f73dd7c..597ea318 100644 --- a/crates/integration-tests/tests/stateless-validator-reth.rs +++ b/crates/integration-tests/tests/stateless-validator-reth.rs @@ -1,31 +1,35 @@ //! Execution tests for `stateless-validator-reth` guest program -use std::fs; - use ere_dockerized::zkVMKind; +use guest::Guest; use integration_tests::{ - TestCase, fixtures_dir, stateless_validator::StatelessValidatorFixture, untar_fixtures, -}; -use stateless_validator_reth::guest::{ - StatelessValidatorOutput, StatelessValidatorRethGuest, StatelessValidatorRethInput, + NoopPlatform, TestCase, get_fixtures, stateless_validator::get_stateless_validator_output, }; +use stateless_validator_reth::guest::{StatelessValidatorRethGuest, StatelessValidatorRethInput}; fn test_execution(zkvm_kind: zkVMKind) { - untar_fixtures().unwrap(); - let inputs = fs::read_dir(fixtures_dir().join("block")) - .unwrap() - .map(|file| { - let bytes = fs::read(file.unwrap().path()).unwrap(); - let fixture: StatelessValidatorFixture = serde_json::from_slice(&bytes).unwrap(); - let input = StatelessValidatorRethInput::new(&fixture.stateless_input).unwrap(); - let output = StatelessValidatorOutput::new( + let fixtures = get_fixtures(); + let inputs = fixtures.into_iter().map(|fixture| { + let input = + StatelessValidatorRethInput::new(&fixture.stateless_input, fixture.success).unwrap(); + + let output = if !fixture.success { + // For invalid blocks we can't correctly generate the NewPayloadRequest + // from an EL block. This is because to get the Electra requests, we + // need to execute the block successfully first. + StatelessValidatorRethGuest::compute::(input.clone()) + } else { + // For valid blocks (i.e. mainnet), we can rely on testing the output against an independent + // implementation that calculated the NewPayloadRequest root from a CL block. + get_stateless_validator_output( fixture.stateless_input.block.hash_slow(), - fixture.stateless_input.block.parent_hash, fixture.success, - ); - TestCase::new::(fixture.name, input, output) - .output_sha256() - }); + ) + }; + assert_eq!(output.successful_block_validation, fixture.success); + + TestCase::new::(fixture.name, input, output).output_sha256() + }); integration_tests::test_execution("stateless-validator-reth", zkvm_kind, inputs); } diff --git a/crates/stateless-validator-common/Cargo.toml b/crates/stateless-validator-common/Cargo.toml index e89de35e..4af9037f 100644 --- a/crates/stateless-validator-common/Cargo.toml +++ b/crates/stateless-validator-common/Cargo.toml @@ -9,19 +9,37 @@ license.workspace = true workspace = true [dependencies] +anyhow.workspace = true rkyv = { workspace = true, optional = true } -serde = { workspace = true, features = ["derive"], optional = true } -sha2 = { workspace = true, optional = true } +serde_with = { workspace = true, optional = true, features = ["macros"] } +serde = { workspace = true, optional = true, features = [ + "derive", + "alloc", +], default-features = false } -# reth -reth-stateless = { workspace = true, optional = true } +# lighthouse +tree_hash.workspace = true +tree_hash_derive.workspace = true +ssz_types.workspace = true +typenum.workspace = true + +# ssz +ethereum_ssz.workspace = true +ethereum_ssz_derive.workspace = true + +#alloy +alloy-primitives = { workspace = true, optional = true } +alloy-eips = { workspace = true, optional = true } + +# crypto +sha2.workspace = true [features] # guest default = ["std"] -std = [] -serde = ["dep:serde"] +std = ["serde"] +serde = ["dep:serde", "dep:serde_with"] rkyv = ["dep:rkyv"] # host -host = ["std", "dep:sha2", "dep:reth-stateless"] +host = ["std", "dep:alloy-primitives", "dep:alloy-eips"] diff --git a/crates/stateless-validator-common/src/guest.rs b/crates/stateless-validator-common/src/guest.rs index 99966ae1..df9a879a 100644 --- a/crates/stateless-validator-common/src/guest.rs +++ b/crates/stateless-validator-common/src/guest.rs @@ -4,31 +4,24 @@ pub const STATELESS_VALIDATOR_OUTPUT_SIZE: usize = size_of::(); /// Output of stateless validator guest program. -#[derive(Clone, Copy, Debug, PartialEq, Eq)] +#[derive(Clone, Copy, Debug, PartialEq, Eq, Default)] #[cfg_attr( feature = "rkyv", derive(rkyv::Serialize, rkyv::Deserialize, rkyv::Archive) )] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct StatelessValidatorOutput { - /// Block hash - pub block_hash: [u8; 32], - /// Parent hash - pub parent_hash: [u8; 32], + /// New payload request root. + pub new_payload_request_root: [u8; 32], /// Stateless validation is successful or not. pub successful_block_validation: bool, } impl StatelessValidatorOutput { /// Constructs a new [`StatelessValidatorOutput`]. - pub fn new( - block_hash: impl Into<[u8; 32]>, - parent_hash: impl Into<[u8; 32]>, - successful_block_validation: bool, - ) -> Self { + pub fn new(new_payload_request_root: [u8; 32], successful_block_validation: bool) -> Self { Self { - block_hash: block_hash.into(), - parent_hash: parent_hash.into(), + new_payload_request_root, successful_block_validation, } } @@ -36,9 +29,8 @@ impl StatelessValidatorOutput { /// Returns serialized output. pub fn serialize(&self) -> [u8; STATELESS_VALIDATOR_OUTPUT_SIZE] { let mut buf = [0; STATELESS_VALIDATOR_OUTPUT_SIZE]; - buf[0..32].copy_from_slice(&self.block_hash); - buf[32..64].copy_from_slice(&self.parent_hash); - buf[64] = self.successful_block_validation as u8; + buf[0..32].copy_from_slice(&self.new_payload_request_root); + buf[32] = self.successful_block_validation as u8; buf } } diff --git a/crates/stateless-validator-common/src/host.rs b/crates/stateless-validator-common/src/host.rs index 8de6b05b..d8aa2391 100644 --- a/crates/stateless-validator-common/src/host.rs +++ b/crates/stateless-validator-common/src/host.rs @@ -1,25 +1,200 @@ //! Stateless validator common types and utilities for host. +use anyhow::{Context, Result}; use sha2::{Digest, Sha256}; +use ssz::{Decode, Encode}; +use ssz_types::VariableList; -use crate::guest::StatelessValidatorOutput; - -#[rustfmt::skip] -pub use reth_stateless::StatelessInput; +use crate::{ + guest::StatelessValidatorOutput, + new_payload_request::{ + ConsolidationRequest, DepositRequest, ExecutionPayloadV1, ExecutionPayloadV2, + ExecutionPayloadV3, ExecutionRequests, Hash32, NewPayloadRequest, + NewPayloadRequestBellatrix, NewPayloadRequestCapella, NewPayloadRequestDeneb, + NewPayloadRequestElectraFulu, WithdrawalRequest, + }, +}; impl StatelessValidatorOutput { - /// Constructs a output from [`StatelessInput`] and an bool indicating - /// whehter the stateless validation is successful or not. - pub fn from_stateless_input(stateless_input: &StatelessInput, success: bool) -> Self { - Self::new( - stateless_input.block.hash_slow(), - stateless_input.block.parent_hash, - success, - ) - } - /// Returns sha256 digest of serialized output. pub fn sha256(&self) -> [u8; 32] { Sha256::digest(self.serialize()).into() } } + +impl NewPayloadRequest { + /// Constructs a new [`NewPayloadRequest`] for Bellatrix. + pub fn new_bellatrix(execution_payload: ExecutionPayloadV1) -> Self { + NewPayloadRequest::Bellatrix(NewPayloadRequestBellatrix { execution_payload }) + } + + /// Constructs a new [`NewPayloadRequest`] for Capella. + pub fn new_capella(execution_payload: ExecutionPayloadV2) -> Self { + NewPayloadRequest::Capella(NewPayloadRequestCapella { execution_payload }) + } + + /// Constructs a new [`NewPayloadRequest`] for Deneb. + pub fn new_deneb( + execution_payload: ExecutionPayloadV3, + versioned_hashes: Vec, + parent_beacon_block_root: Hash32, + ) -> Result { + let versioned_hashes = VariableList::new(versioned_hashes).map_err(|err| { + anyhow::anyhow!("Versioned hashes length should be within bounds: {:?}", err) + })?; + Ok(NewPayloadRequest::Deneb(NewPayloadRequestDeneb { + execution_payload, + versioned_hashes, + parent_beacon_block_root, + })) + } + + /// Constructs a new [`NewPayloadRequest`] for Electra or Fulu. + pub fn new_electra_fulu( + execution_payload: ExecutionPayloadV3, + versioned_hashes: Vec, + parent_beacon_block_root: Hash32, + execution_requests: &[impl AsRef<[u8]>], + ) -> Result { + let versioned_hashes = VariableList::new(versioned_hashes).map_err(|err| { + anyhow::anyhow!("Versioned hashes length should be within bounds: {:?}", err) + })?; + let execution_requests = decode_execution_requests(execution_requests) + .context("Decoding execution requests failed")?; + Ok(NewPayloadRequest::ElectraFulu( + NewPayloadRequestElectraFulu { + execution_payload, + versioned_hashes, + parent_beacon_block_root, + execution_requests, + }, + )) + } +} + +/// Decodes a list of execution requests obtained from execution and deserializes them into an +/// [`ExecutionRequests`] struct. +fn decode_execution_requests(requests_list: &[impl AsRef<[u8]>]) -> Result { + // EIP-7685: requests are encoded as request_type (1 byte) ++ request_data + // Request types for Electra (Prague): + // - 0x00: Deposit requests (EIP-6110) + // - 0x01: Withdrawal requests (EIP-7002) + // - 0x02: Consolidation requests (EIP-7251) + + const DEPOSIT_REQUEST_TYPE: u8 = 0x00; + const WITHDRAWAL_REQUEST_TYPE: u8 = 0x01; + const CONSOLIDATION_REQUEST_TYPE: u8 = 0x02; + + // Fixed SSZ sizes for each request type (excluding the type byte) + let deposit_request_size = ::ssz_fixed_len(); + let withdrawal_request_size = ::ssz_fixed_len(); + let consolidation_request_size = ::ssz_fixed_len(); + + let mut deposits = Vec::new(); + let mut withdrawals = Vec::new(); + let mut consolidations = Vec::new(); + + let mut last_request_type: Option = None; + + for (idx, request) in requests_list.iter().enumerate() { + let request_bytes = request.as_ref(); + + anyhow::ensure!(!request_bytes.is_empty(), "Empty request at index {}", idx); + + // Read request type (first byte) + let request_type = request_bytes[0]; + let data = &request_bytes[1..]; + + // Validate uniqueness and ascending order + if let Some(last_type) = last_request_type { + anyhow::ensure!( + request_type > last_type, + "Invalid request ordering at index {}: type {:#x} must be greater than previous type {:#x}", + idx, + request_type, + last_type + ); + } + last_request_type = Some(request_type); + + match request_type { + DEPOSIT_REQUEST_TYPE => { + anyhow::ensure!( + data.len() % deposit_request_size == 0, + "Deposit request data length {} is not a multiple of {} at index {}", + data.len(), + deposit_request_size, + idx + ); + + for (i, chunk) in data.chunks_exact(deposit_request_size).enumerate() { + let deposit = DepositRequest::from_ssz_bytes(chunk).map_err(|e| { + anyhow::anyhow!( + "Failed to SSZ decode deposit request {} at index {}: {:?}", + i, + idx, + e + ) + })?; + deposits.push(deposit); + } + } + WITHDRAWAL_REQUEST_TYPE => { + anyhow::ensure!( + data.len() % withdrawal_request_size == 0, + "Withdrawal request data length {} is not a multiple of {} at index {}", + data.len(), + withdrawal_request_size, + idx + ); + + for (i, chunk) in data.chunks_exact(withdrawal_request_size).enumerate() { + let withdrawal = WithdrawalRequest::from_ssz_bytes(chunk).map_err(|e| { + anyhow::anyhow!( + "Failed to SSZ decode withdrawal request {} at index {}: {:?}", + i, + idx, + e + ) + })?; + withdrawals.push(withdrawal); + } + } + CONSOLIDATION_REQUEST_TYPE => { + anyhow::ensure!( + data.len() % consolidation_request_size == 0, + "Consolidation request data length {} is not a multiple of {} at index {}", + data.len(), + consolidation_request_size, + idx + ); + + for (i, chunk) in data.chunks_exact(consolidation_request_size).enumerate() { + let consolidation = + ConsolidationRequest::from_ssz_bytes(chunk).map_err(|e| { + anyhow::anyhow!( + "Failed to SSZ decode consolidation request {} at index {}: {:?}", + i, + idx, + e + ) + })?; + consolidations.push(consolidation); + } + } + _ => { + anyhow::bail!("Unknown request type at index {}: {:#x}", idx, request_type); + } + } + } + + Ok(ExecutionRequests { + deposits: VariableList::new(deposits) + .map_err(|e| anyhow::anyhow!("Failed to create deposits VariableList: {:?}", e))?, + withdrawals: VariableList::new(withdrawals) + .map_err(|e| anyhow::anyhow!("Failed to create withdrawals VariableList: {:?}", e))?, + consolidations: VariableList::new(consolidations).map_err(|e| { + anyhow::anyhow!("Failed to create consolidations VariableList: {:?}", e) + })?, + }) +} diff --git a/crates/stateless-validator-common/src/lib.rs b/crates/stateless-validator-common/src/lib.rs index 95fde180..5d7cd8a7 100644 --- a/crates/stateless-validator-common/src/lib.rs +++ b/crates/stateless-validator-common/src/lib.rs @@ -2,7 +2,16 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + pub mod guest; +pub mod new_payload_request; + +#[cfg(feature = "rkyv")] +pub mod rkyv_wrappers; + +#[cfg(feature = "serde")] +pub mod serde_wrappers; #[cfg(feature = "host")] pub mod host; diff --git a/crates/stateless-validator-common/src/new_payload_request.rs b/crates/stateless-validator-common/src/new_payload_request.rs new file mode 100644 index 00000000..2ea8d28d --- /dev/null +++ b/crates/stateless-validator-common/src/new_payload_request.rs @@ -0,0 +1,307 @@ +//! Consensus types to support new payload requests. + +#![allow(missing_docs)] + +use alloc::vec::Vec; + +#[cfg(feature = "serde")] +use serde::{Deserialize, Serialize}; +use ssz_types::{FixedVector, VariableList}; +use tree_hash::TreeHash; +use tree_hash_derive::TreeHash; +use typenum::Prod; + +/// Primitive types +pub type Hash32 = [u8; 32]; +pub type Bytes48 = [u8; 48]; +pub type Bytes96 = [u8; 96]; +pub type Address20 = [u8; 20]; +pub type Uint256Bytes = [u8; 32]; +pub type LogsBloom = FixedVector; +pub type ExtraData = VariableList; + +/// Limits +pub type MaxBytesPerTransaction = Prod; // 2^30 +pub type MaxWithdrawalsPerPayload = typenum::U16; // 16 +pub type MaxTransactionsPerPayload = Prod; // 2^20 +pub type MaxBlobCommitmentsPerBlock = typenum::U4096; // 4096 +pub type MaxDepositRequestsPerPayload = typenum::U8192; // 2^13 +pub type MaxWithdrawalRequestsPerPayload = typenum::U16; // 2^4 +pub type MaxConsolidationRequestsPerPayload = typenum::U2; // 2^1 + +/// Composite types +pub type Transaction = VariableList; +pub type Transactions = VariableList; +pub type Withdrawals = VariableList; + +#[derive(Debug, Clone, TreeHash)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr( + feature = "rkyv", + derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) +)] +pub struct Withdrawal { + pub index: u64, + pub validator_index: u64, + pub address: Address20, + pub amount: u64, +} + +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[derive(Debug, Clone, TreeHash, ssz_derive::Encode, ssz_derive::Decode)] +#[cfg_attr( + feature = "rkyv", + derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) +)] +pub struct DepositRequest { + #[cfg_attr(feature = "serde", serde(with = "crate::serde_wrappers::bytes_array"))] + pub pubkey: Bytes48, + pub withdrawal_credentials: Hash32, + pub amount: u64, + #[cfg_attr(feature = "serde", serde(with = "crate::serde_wrappers::bytes_array"))] + pub signature: Bytes96, + pub index: u64, +} + +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[derive(Debug, Clone, TreeHash, ssz_derive::Encode, ssz_derive::Decode)] +#[cfg_attr( + feature = "rkyv", + derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) +)] +pub struct WithdrawalRequest { + pub source_address: Address20, + #[cfg_attr(feature = "serde", serde(with = "crate::serde_wrappers::bytes_array"))] + pub validator_pubkey: Bytes48, + pub amount: u64, +} + +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[derive(Debug, Clone, TreeHash, ssz_derive::Encode, ssz_derive::Decode)] +#[cfg_attr( + feature = "rkyv", + derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) +)] +pub struct ConsolidationRequest { + pub source_address: Address20, + #[cfg_attr(feature = "serde", serde(with = "crate::serde_wrappers::bytes_array"))] + pub source_pubkey: Bytes48, + #[cfg_attr(feature = "serde", serde(with = "crate::serde_wrappers::bytes_array"))] + pub target_pubkey: Bytes48, +} + +#[derive(Debug, Clone, Default, TreeHash)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr( + feature = "rkyv", + derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) +)] +pub struct ExecutionRequests { + #[cfg_attr(feature = "rkyv", rkyv(with = crate::rkyv_wrappers::AsVariableList))] + pub deposits: VariableList, + #[cfg_attr(feature = "rkyv", rkyv(with = crate::rkyv_wrappers::AsVariableList))] + pub withdrawals: VariableList, + #[cfg_attr(feature = "rkyv", rkyv(with = crate::rkyv_wrappers::AsVariableList))] + pub consolidations: VariableList, +} + +#[derive(Debug, Clone, Copy)] +pub enum ForkName { + Bellatrix, + Capella, + Deneb, + Electra, + Fulu, +} + +#[derive(Debug, Clone, TreeHash)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr( + feature = "rkyv", + derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) +)] +pub struct ExecutionPayloadV1 { + pub parent_hash: Hash32, + pub fee_recipient: Address20, + pub state_root: Hash32, + pub receipts_root: Hash32, + #[cfg_attr(feature = "rkyv", rkyv(with = crate::rkyv_wrappers::AsFixedVector))] + pub logs_bloom: LogsBloom, + pub prev_randao: Hash32, + pub block_number: u64, + pub gas_limit: u64, + pub gas_used: u64, + pub timestamp: u64, + #[cfg_attr(feature = "rkyv", rkyv(with = crate::rkyv_wrappers::AsVariableList))] + pub extra_data: ExtraData, + pub base_fee_per_gas: Uint256Bytes, + pub block_hash: Hash32, + #[cfg_attr(feature = "rkyv", rkyv(with = crate::rkyv_wrappers::AsNestedVariableList))] + pub transactions: Transactions, +} + +#[derive(Debug, Clone, TreeHash)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr( + feature = "rkyv", + derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) +)] +pub struct ExecutionPayloadV2 { + pub parent_hash: Hash32, + pub fee_recipient: Address20, + pub state_root: Hash32, + pub receipts_root: Hash32, + #[cfg_attr(feature = "rkyv", rkyv(with = crate::rkyv_wrappers::AsFixedVector))] + pub logs_bloom: LogsBloom, + pub prev_randao: Hash32, + pub block_number: u64, + pub gas_limit: u64, + pub gas_used: u64, + pub timestamp: u64, + #[cfg_attr(feature = "rkyv", rkyv(with = crate::rkyv_wrappers::AsVariableList))] + pub extra_data: ExtraData, + pub base_fee_per_gas: Uint256Bytes, + pub block_hash: Hash32, + #[cfg_attr(feature = "rkyv", rkyv(with = crate::rkyv_wrappers::AsNestedVariableList))] + pub transactions: Transactions, + #[cfg_attr(feature = "rkyv", rkyv(with = crate::rkyv_wrappers::AsVariableList))] + pub withdrawals: Withdrawals, +} + +#[derive(Debug, Clone, TreeHash)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr( + feature = "rkyv", + derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) +)] +pub struct ExecutionPayloadV3 { + pub parent_hash: Hash32, + pub fee_recipient: Address20, + pub state_root: Hash32, + pub receipts_root: Hash32, + #[cfg_attr(feature = "rkyv", rkyv(with = crate::rkyv_wrappers::AsFixedVector))] + pub logs_bloom: LogsBloom, + pub prev_randao: Hash32, + pub block_number: u64, + pub gas_limit: u64, + pub gas_used: u64, + pub timestamp: u64, + #[cfg_attr(feature = "rkyv", rkyv(with = crate::rkyv_wrappers::AsVariableList))] + pub extra_data: ExtraData, + pub base_fee_per_gas: Uint256Bytes, + pub block_hash: Hash32, + #[cfg_attr(feature = "rkyv", rkyv(with = crate::rkyv_wrappers::AsNestedVariableList))] + pub transactions: Transactions, + #[cfg_attr(feature = "rkyv", rkyv(with = crate::rkyv_wrappers::AsVariableList))] + pub withdrawals: Withdrawals, + pub blob_gas_used: u64, + pub excess_blob_gas: u64, +} + +#[derive(Debug, Clone, TreeHash)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr( + feature = "rkyv", + derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) +)] +pub struct NewPayloadRequestBellatrix { + pub execution_payload: ExecutionPayloadV1, +} + +#[derive(Debug, Clone, TreeHash)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr( + feature = "rkyv", + derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) +)] +pub struct NewPayloadRequestCapella { + pub execution_payload: ExecutionPayloadV2, +} + +#[derive(Debug, Clone, TreeHash)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr( + feature = "rkyv", + derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) +)] +pub struct NewPayloadRequestDeneb { + pub execution_payload: ExecutionPayloadV3, + #[cfg_attr(feature = "rkyv", rkyv(with = crate::rkyv_wrappers::AsVariableList))] + pub versioned_hashes: VariableList, + pub parent_beacon_block_root: Hash32, +} + +#[derive(Debug, Clone, TreeHash)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr( + feature = "rkyv", + derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) +)] +pub struct NewPayloadRequestElectraFulu { + pub execution_payload: ExecutionPayloadV3, + #[cfg_attr(feature = "rkyv", rkyv(with = crate::rkyv_wrappers::AsVariableList))] + pub versioned_hashes: VariableList, + pub parent_beacon_block_root: Hash32, + pub execution_requests: ExecutionRequests, +} + +#[derive(Debug, Clone)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr( + feature = "rkyv", + derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) +)] +pub enum NewPayloadRequest { + Bellatrix(NewPayloadRequestBellatrix), + Capella(NewPayloadRequestCapella), + Deneb(NewPayloadRequestDeneb), + ElectraFulu(NewPayloadRequestElectraFulu), +} + +impl NewPayloadRequest { + pub fn tree_hash_root(&self) -> [u8; 32] { + match self { + NewPayloadRequest::Bellatrix(req) => req.tree_hash_root().0, + NewPayloadRequest::Capella(req) => req.tree_hash_root().0, + NewPayloadRequest::Deneb(req) => req.tree_hash_root().0, + NewPayloadRequest::ElectraFulu(req) => req.tree_hash_root().0, + } + } +} + +/// Computes the requests hash for EL block construction. +pub fn compute_requests_hash(requests: &ExecutionRequests) -> [u8; 32] { + use sha2::{Digest, Sha256}; + use ssz::Encode; + + let mut outer_hasher = Sha256::new(); + + // Deposit requests (type 0x00) + let mut deposits_bytes = vec![0x00u8]; + for deposit in requests.deposits.iter() { + deposits_bytes.extend(deposit.as_ssz_bytes()); + } + if deposits_bytes.len() > 1 { + outer_hasher.update(Sha256::digest(&deposits_bytes)); + } + + // Withdrawal requests (type 0x01) + let mut withdrawals_bytes = vec![0x01u8]; + for withdrawal in requests.withdrawals.iter() { + withdrawals_bytes.extend(withdrawal.as_ssz_bytes()); + } + if withdrawals_bytes.len() > 1 { + outer_hasher.update(Sha256::digest(&withdrawals_bytes)); + } + + // Consolidation requests (type 0x02) + let mut consolidations_bytes = vec![0x02u8]; + for consolidation in requests.consolidations.iter() { + consolidations_bytes.extend(consolidation.as_ssz_bytes()); + } + if consolidations_bytes.len() > 1 { + outer_hasher.update(Sha256::digest(&consolidations_bytes)); + } + + outer_hasher.finalize().into() +} diff --git a/crates/stateless-validator-common/src/rkyv_wrappers.rs b/crates/stateless-validator-common/src/rkyv_wrappers.rs new file mode 100644 index 00000000..dfb579eb --- /dev/null +++ b/crates/stateless-validator-common/src/rkyv_wrappers.rs @@ -0,0 +1,244 @@ +//! rkyv wrappers for ssz_types (VariableList, FixedVector). +//! +//! ssz_types doesn't support rkyv natively, so we provide wrappers that +//! serialize them as `Vec` and reconstruct on deserialization. + +use alloc::{format, string::String, vec::Vec}; +use core::{fmt, ops::Deref}; + +use rkyv::{ + Archive, Deserialize, Place, Serialize, + rancor::{Fallible, Source}, + ser::{Allocator, Writer}, + vec::{ArchivedVec, VecResolver}, + with::{ArchiveWith, DeserializeWith, SerializeWith}, +}; +use ssz_types::{FixedVector, VariableList}; +use typenum::Unsigned; + +/// Simple error wrapper for ssz_types errors which don't implement std::error::Error. +#[derive(Debug)] +struct SszError(String); + +impl fmt::Display for SszError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "{}", self.0) + } +} + +impl core::error::Error for SszError {} + +/// Wrapper to serialize `VariableList` as `Vec`. +/// +/// On serialization, the inner slice is serialized as a Vec. +/// On deserialization, the Vec is converted back to VariableList. +#[derive(Debug)] +pub struct AsVariableList; + +impl ArchiveWith> for AsVariableList +where + T: Archive, + N: Unsigned, +{ + type Archived = ArchivedVec; + type Resolver = VecResolver; + + fn resolve_with( + field: &VariableList, + resolver: Self::Resolver, + out: Place, + ) { + // VariableList implements Deref + ArchivedVec::resolve_from_slice(field.deref(), resolver, out); + } +} + +impl SerializeWith, S> for AsVariableList +where + T: Serialize, + N: Unsigned, + S: Fallible + Allocator + Writer + ?Sized, +{ + fn serialize_with( + field: &VariableList, + serializer: &mut S, + ) -> Result { + ArchivedVec::serialize_from_slice(field.deref(), serializer) + } +} + +impl DeserializeWith, VariableList, D> for AsVariableList +where + T: Archive, + T::Archived: Deserialize, + N: Unsigned, + D: Fallible + ?Sized, + D::Error: Source, +{ + fn deserialize_with( + archived: &ArchivedVec, + deserializer: &mut D, + ) -> Result, D::Error> { + let vec: Vec = Deserialize::, D>::deserialize(archived, deserializer)?; + // VariableList::new returns Err if vec.len() > N::to_usize() + // This shouldn't happen if data was serialized correctly + VariableList::new(vec).map_err(|e| ::new(SszError(format!("{e:?}")))) + } +} + +/// Wrapper to serialize `FixedVector` as `Vec`. +/// +/// On serialization, the inner slice is serialized as a Vec. +/// On deserialization, the Vec is converted back to FixedVector. +#[derive(Debug)] +pub struct AsFixedVector; + +impl ArchiveWith> for AsFixedVector +where + T: Archive, + N: Unsigned, +{ + type Archived = ArchivedVec; + type Resolver = VecResolver; + + fn resolve_with( + field: &FixedVector, + resolver: Self::Resolver, + out: Place, + ) { + // FixedVector implements Deref + ArchivedVec::resolve_from_slice(field.deref(), resolver, out); + } +} + +impl SerializeWith, S> for AsFixedVector +where + T: Serialize, + N: Unsigned, + S: Fallible + Allocator + Writer + ?Sized, +{ + fn serialize_with( + field: &FixedVector, + serializer: &mut S, + ) -> Result { + ArchivedVec::serialize_from_slice(field.deref(), serializer) + } +} + +impl DeserializeWith, FixedVector, D> for AsFixedVector +where + T: Archive + Clone + Default, + T::Archived: Deserialize, + N: Unsigned, + D: Fallible + ?Sized, + D::Error: Source, +{ + fn deserialize_with( + archived: &ArchivedVec, + deserializer: &mut D, + ) -> Result, D::Error> { + let vec: Vec = Deserialize::, D>::deserialize(archived, deserializer)?; + // FixedVector::new returns Err if vec.len() != N::to_usize() + FixedVector::new(vec).map_err(|e| ::new(SszError(format!("{e:?}")))) + } +} + +/// Wrapper for nested VariableList types like `VariableList, N>`. +/// +/// This is used for fields like `Transactions = VariableList` +/// where `Transaction = VariableList`. +/// +/// Serializes as `Vec>` and reconstructs on deserialization. +#[derive(Debug)] +pub struct AsNestedVariableList; + +impl ArchiveWith, N>> for AsNestedVariableList +where + T: Archive, + M: Unsigned, + N: Unsigned, +{ + type Archived = ArchivedVec>; + type Resolver = VecResolver; + + fn resolve_with( + field: &VariableList, N>, + resolver: Self::Resolver, + out: Place, + ) { + ArchivedVec::resolve_from_len(field.len(), resolver, out); + } +} + +impl SerializeWith, N>, S> for AsNestedVariableList +where + T: Serialize, + M: Unsigned, + N: Unsigned, + S: Fallible + Allocator + Writer + ?Sized, +{ + fn serialize_with( + field: &VariableList, N>, + serializer: &mut S, + ) -> Result { + // Convert to Vec> and serialize that + let vecs: Vec<&[T]> = field.iter().map(|inner| inner.deref()).collect(); + + // We need to serialize as Vec> which archives to ArchivedVec> + // But we have Vec<&[T]>, so we need to serialize each slice individually + ArchivedVec::serialize_from_iter( + vecs.iter().map(|slice| { + // Each slice needs to be wrapped to serialize as ArchivedVec + SliceAsVec(slice) + }), + serializer, + ) + } +} + +/// Helper wrapper to serialize a slice as ArchivedVec +struct SliceAsVec<'a, T>(&'a [T]); + +impl Archive for SliceAsVec<'_, T> { + type Archived = ArchivedVec; + type Resolver = VecResolver; + + fn resolve(&self, resolver: Self::Resolver, out: Place) { + ArchivedVec::resolve_from_slice(self.0, resolver, out); + } +} + +impl, S: Fallible + Allocator + Writer + ?Sized> Serialize + for SliceAsVec<'_, T> +{ + fn serialize(&self, serializer: &mut S) -> Result { + ArchivedVec::serialize_from_slice(self.0, serializer) + } +} + +impl + DeserializeWith>, VariableList, N>, D> + for AsNestedVariableList +where + T: Archive, + T::Archived: Deserialize, + M: Unsigned, + N: Unsigned, + D: Fallible + ?Sized, + D::Error: Source, +{ + fn deserialize_with( + archived: &ArchivedVec>, + deserializer: &mut D, + ) -> Result, N>, D::Error> { + let mut outer = Vec::with_capacity(archived.len()); + for inner_archived in archived.iter() { + let inner_vec: Vec = + Deserialize::, D>::deserialize(inner_archived, deserializer)?; + let inner = VariableList::new(inner_vec) + .map_err(|e| ::new(SszError(format!("{e:?}"))))?; + outer.push(inner); + } + VariableList::new(outer).map_err(|e| ::new(SszError(format!("{e:?}")))) + } +} diff --git a/crates/stateless-validator-common/src/serde_wrappers.rs b/crates/stateless-validator-common/src/serde_wrappers.rs new file mode 100644 index 00000000..24f7ea65 --- /dev/null +++ b/crates/stateless-validator-common/src/serde_wrappers.rs @@ -0,0 +1,27 @@ +//! Serde wrappers for byte arrays. +//! +//! Provides helpers for serializing fixed-size byte arrays using serde_with::Bytes, +//! which is efficient for binary formats and uses byte sequences for human-readable formats. + +use serde::{Deserializer, Serializer}; +use serde_with::{DeserializeAs, SerializeAs}; + +/// Serialize a byte array using serde_with::Bytes. +pub mod bytes_array { + use super::*; + + /// Serialize a fixed-size byte array. + pub fn serialize( + bytes: &[u8; N], + serializer: S, + ) -> Result { + serde_with::Bytes::serialize_as(bytes, serializer) + } + + /// Deserialize a fixed-size byte array. + pub fn deserialize<'de, const N: usize, D: Deserializer<'de>>( + deserializer: D, + ) -> Result<[u8; N], D::Error> { + serde_with::Bytes::deserialize_as(deserializer) + } +} diff --git a/crates/stateless-validator-ethrex/Cargo.toml b/crates/stateless-validator-ethrex/Cargo.toml index 7afc8dfd..9ac0a713 100644 --- a/crates/stateless-validator-ethrex/Cargo.toml +++ b/crates/stateless-validator-ethrex/Cargo.toml @@ -9,8 +9,9 @@ license.workspace = true workspace = true [dependencies] -anyhow = { workspace = true, optional = true } +anyhow.workspace = true rkyv.workspace = true +bytes.workspace = true # alloy alloy-consensus = { workspace = true, optional = true } @@ -21,10 +22,13 @@ alloy-rlp = { workspace = true, optional = true } # ethrex ethrex-common.workspace = true ethrex-guest-program.workspace = true -ethrex-rlp = { workspace = true, optional = true } +ethrex-rlp.workspace = true ethrex-rpc = { workspace = true, optional = true } ethrex-vm.workspace = true +# reth +reth-stateless = { workspace = true, optional = true } + # ere ere-io = { workspace = true, features = ["rkyv"] } ere-zkvm-interface = { workspace = true, optional = true } @@ -32,6 +36,10 @@ ere-zkvm-interface = { workspace = true, optional = true } # local guest.workspace = true stateless-validator-common = { workspace = true, features = ["rkyv"] } +stateless-validator-reth = { workspace = true, default-features = true, optional = true, features = [ + "host", +] } + [features] # guest @@ -46,12 +54,12 @@ zisk = ["ethrex-vm/zisk"] host = [ "std", "stateless-validator-common/host", - "dep:anyhow", "dep:alloy-consensus", "dep:alloy-eips", "dep:alloy-rlp", "dep:alloy-genesis", - "dep:ethrex-rlp", - "dep:ethrex-rpc", "dep:ere-zkvm-interface", + "dep:ethrex-rpc", + "dep:reth-stateless", + "dep:stateless-validator-reth", ] diff --git a/crates/stateless-validator-ethrex/src/execution_payload.rs b/crates/stateless-validator-ethrex/src/execution_payload.rs new file mode 100644 index 00000000..4cb5c4fa --- /dev/null +++ b/crates/stateless-validator-ethrex/src/execution_payload.rs @@ -0,0 +1,192 @@ +#![allow(missing_docs)] +use anyhow::{Context, Result}; +use bytes::Bytes; +use ethrex_common::{ + Address, Bloom, H256, + constants::DEFAULT_OMMERS_HASH, + types::{ + Block, BlockBody, BlockHeader, Transaction, Withdrawal, compute_transactions_root, + compute_withdrawals_root, + }, +}; +use ethrex_rlp::error::RLPDecodeError; + +#[derive(Clone, Debug)] +pub struct ExecutionPayload { + pub parent_hash: H256, + pub fee_recipient: Address, + pub state_root: H256, + pub receipts_root: H256, + pub logs_bloom: Bloom, + pub prev_randao: H256, + pub block_number: u64, + pub gas_limit: u64, + pub gas_used: u64, + pub timestamp: u64, + pub extra_data: Bytes, + pub base_fee_per_gas: u64, + pub block_hash: H256, + pub transactions: Vec, + pub withdrawals: Option>, + // ExecutionPayloadV3 fields. Optional since we support V2 too + pub blob_gas_used: Option, + pub excess_blob_gas: Option, +} + +#[derive(Clone, Debug)] +pub struct EncodedTransaction(pub Bytes); + +impl ExecutionPayload { + /// Converts an `ExecutionPayload` into a block (aka a BlockHeader and BlockBody) + /// using the parentBeaconBlockRoot received along with the payload in the rpc call `engine_newPayloadV2/V3` + pub fn into_block( + self, + parent_beacon_block_root: Option, + requests_hash: Option, + ) -> Result { + let body = BlockBody { + transactions: self + .transactions + .iter() + .map(|encoded_tx| encoded_tx.decode()) + .collect::, RLPDecodeError>>()?, + ommers: vec![], + withdrawals: self.withdrawals, + }; + let header = BlockHeader { + parent_hash: self.parent_hash, + ommers_hash: *DEFAULT_OMMERS_HASH, + coinbase: self.fee_recipient, + state_root: self.state_root, + transactions_root: compute_transactions_root(&body.transactions), + receipts_root: self.receipts_root, + logs_bloom: self.logs_bloom, + difficulty: 0.into(), + number: self.block_number, + gas_limit: self.gas_limit, + gas_used: self.gas_used, + timestamp: self.timestamp, + extra_data: self.extra_data, + prev_randao: self.prev_randao, + nonce: 0, + base_fee_per_gas: Some(self.base_fee_per_gas), + withdrawals_root: body + .withdrawals + .as_ref() + .map(|w| compute_withdrawals_root(w)), + blob_gas_used: self.blob_gas_used, + excess_blob_gas: self.excess_blob_gas, + parent_beacon_block_root, + requests_hash, + ..Default::default() + }; + + Ok(Block::new(header, body)) + } +} + +impl EncodedTransaction { + fn decode(&self) -> Result { + Transaction::decode_canonical(self.0.as_ref()) + } +} + +pub fn validate_execution_payload_v1(payload: &ExecutionPayload) -> Result<()> { + // Validate that only the required arguments are present + anyhow::ensure!( + payload.withdrawals.is_none(), + "withdrawals field is not allowed in ExecutionPayloadV1" + ); + anyhow::ensure!( + payload.blob_gas_used.is_none(), + "blob_gas_used field is not allowed in ExecutionPayloadV1" + ); + anyhow::ensure!( + payload.excess_blob_gas.is_none(), + "excess_blob_gas field is not allowed in ExecutionPayloadV1" + ); + + Ok(()) +} + +pub fn validate_execution_payload_v2(payload: &ExecutionPayload) -> Result<()> { + // Validate that only the required arguments are present + anyhow::ensure!( + payload.withdrawals.is_some(), + "withdrawals field is required in ExecutionPayloadV2" + ); + anyhow::ensure!( + payload.blob_gas_used.is_none(), + "blob_gas_used field is not allowed in ExecutionPayloadV2" + ); + anyhow::ensure!( + payload.excess_blob_gas.is_none(), + "excess_blob_gas field is not allowed in ExecutionPayloadV2" + ); + + Ok(()) +} + +pub fn validate_execution_payload_v3(payload: &ExecutionPayload) -> Result<()> { + // Validate that only the required arguments are present + anyhow::ensure!( + payload.withdrawals.is_some(), + "withdrawals field is required in ExecutionPayloadV3" + ); + anyhow::ensure!( + payload.blob_gas_used.is_some(), + "blob_gas_used field is required in ExecutionPayloadV3" + ); + anyhow::ensure!( + payload.excess_blob_gas.is_some(), + "excess_blob_gas field is required in ExecutionPayloadV3" + ); + + Ok(()) +} + +pub fn validate_block_payload_v1_v2(payload: &ExecutionPayload, block: &Block) -> Result<()> { + let block_hash = payload.block_hash; + let actual_block_hash = block.hash(); + anyhow::ensure!( + block_hash == actual_block_hash, + "Block hash mismatch: expected {:?}, got {:?}", + block_hash, + actual_block_hash + ); + Ok(()) +} + +pub fn validate_block_payload_v3( + payload: &ExecutionPayload, + block: &Block, + versioned_hashes: &[[u8; 32]], +) -> Result<()> { + validate_block_payload_v1_v2(payload, block) + .context("Block validation against payload for v1/v2 fields failed")?; + + // V3 specific: validate blob hashes + let blob_versioned_hashes: Vec = block + .body + .transactions + .iter() + .flat_map(|tx| tx.blob_versioned_hashes()) + .collect(); + + anyhow::ensure!( + versioned_hashes.len() == blob_versioned_hashes.len(), + "Invalid number of blob_versioned_hashes: expected {}, got {}", + versioned_hashes.len(), + blob_versioned_hashes.len() + ); + for (expected, actual) in versioned_hashes.iter().zip(blob_versioned_hashes.iter()) { + anyhow::ensure!( + H256::from(*expected) == *actual, + "Invalid blob_versioned_hashes: expected {:?}, got {:?}", + H256::from(*expected), + actual + ); + } + + Ok(()) +} diff --git a/crates/stateless-validator-ethrex/src/guest.rs b/crates/stateless-validator-ethrex/src/guest.rs index 3f1519ed..44cc0eb1 100644 --- a/crates/stateless-validator-ethrex/src/guest.rs +++ b/crates/stateless-validator-ethrex/src/guest.rs @@ -3,12 +3,12 @@ use alloc::format; use core::fmt::Debug; -use ere_io::rkyv::{ - IoRkyv, - rkyv::{Archive, Deserialize, Serialize}, -}; -use ethrex_common::types::block_execution_witness::ExecutionWitness; +use ere_io::rkyv::IoRkyv; +use ethrex_common::types::{block_execution_witness::ExecutionWitness, fee_config::FeeConfig}; use ethrex_guest_program::{execution::execution_program, input::ProgramInput}; +use stateless_validator_common::new_payload_request::NewPayloadRequest; + +use crate::new_payload_request::get_block_from_new_payload_request; #[rustfmt::skip] pub use { @@ -17,21 +17,26 @@ pub use { }; /// Input for the Ethrex stateless validator guest program. -#[derive(Serialize, Deserialize, Archive)] -pub struct StatelessValidatorEthrexInput(pub ProgramInput); +#[derive(rkyv::Serialize, rkyv::Deserialize, rkyv::Archive)] +pub struct StatelessValidatorEthrexInput { + /// New payload request data. + pub new_payload_request: NewPayloadRequest, + /// database containing all the data necessary to execute + pub execution_witness: ExecutionWitness, + /// value used to calculate base fee + pub elasticity_multiplier: u64, + /// Configuration for L2 fees used for each block + pub fee_configs: Option>, +} impl Clone for StatelessValidatorEthrexInput { fn clone(&self) -> Self { - Self(ProgramInput { - blocks: self.0.blocks.clone(), - execution_witness: self.0.execution_witness.clone(), - elasticity_multiplier: self.0.elasticity_multiplier, - fee_configs: self.0.fee_configs.clone(), - #[cfg(feature = "l2")] - blob_commitment: self.0.blob_commitment, - #[cfg(feature = "l2")] - blob_proof: self.0.blob_proof, - }) + Self { + new_payload_request: self.new_payload_request.clone(), + execution_witness: self.execution_witness.clone(), + elasticity_multiplier: self.elasticity_multiplier, + fee_configs: self.fee_configs.clone(), + } } } @@ -54,13 +59,13 @@ impl Debug for StatelessValidatorEthrexInput { } f.debug_struct("StatelessValidatorEthrexInput") - .field("blocks", &self.0.blocks) + .field("new_payload_request", &self.new_payload_request) .field( "execution_witness", - &DebugExecutionWitness(&self.0.execution_witness), + &DebugExecutionWitness(&self.execution_witness), ) - .field("elasticity_multiplier", &self.0.elasticity_multiplier) - .field("fee_configs", &self.0.fee_configs) + .field("elasticity_multiplier", &self.elasticity_multiplier) + .field("fee_configs", &self.fee_configs) .finish() } } @@ -76,30 +81,58 @@ pub struct StatelessValidatorEthrexGuest; impl Guest for StatelessValidatorEthrexGuest { type Io = StatelessValidatorEthrexIo; - fn compute( - StatelessValidatorEthrexInput(input): GuestInput, - ) -> GuestOutput { - let (header, parent_hash) = P::cycle_scope("public_inputs_preparation", || { - ( - input.blocks[0].header.clone(), - input.blocks[0].header.parent_hash, - ) - }); + fn compute(input: GuestInput) -> GuestOutput { + let new_payload_request_root = input.new_payload_request.tree_hash_root(); + + #[cfg(feature = "std")] + { + let result = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| { + Self::compute_inner::

(input, new_payload_request_root) + })); + + match result { + Ok(output) => output, + Err(_) => { + P::print("Panic occurred during validation\n"); + StatelessValidatorOutput::new(new_payload_request_root, false) + } + } + } - if input.blocks.len() != 1 { - return StatelessValidatorOutput::new(header.compute_block_hash(), parent_hash, false); + #[cfg(not(feature = "std"))] + { + Self::compute_inner::

(input, new_payload_request_root) } + } +} +impl StatelessValidatorEthrexGuest { + fn compute_inner( + input: GuestInput, + new_payload_request_root: [u8; 32], + ) -> GuestOutput { + let block = match get_block_from_new_payload_request(input.new_payload_request) { + Ok(block) => block, + Err(err) => { + P::print(&format!("Block construction failed: {err}\n")); + return StatelessValidatorOutput::new(new_payload_request_root, false); + } + }; + let input = ProgramInput { + blocks: vec![block], + execution_witness: input.execution_witness, + elasticity_multiplier: input.elasticity_multiplier, + fee_configs: input.fee_configs, + }; + + let block_num = input.blocks[0].header.number; let res = P::cycle_scope("validation", || execution_program(input)); match res { - Ok(out) => StatelessValidatorOutput::new(out.last_block_hash, parent_hash, true), + Ok(_) => StatelessValidatorOutput::new(new_payload_request_root, true), Err(err) => { - P::print(&format!( - "Block {} validation failed: {err}\n", - header.number - )); - StatelessValidatorOutput::new(header.compute_block_hash(), parent_hash, false) + P::print(&format!("Block {} validation failed: {err}\n", block_num)); + StatelessValidatorOutput::new(new_payload_request_root, false) } } } @@ -107,13 +140,33 @@ impl Guest for StatelessValidatorEthrexGuest { #[cfg(test)] mod test { + use stateless_validator_common::new_payload_request::{ExecutionPayloadV1, NewPayloadRequest}; + use crate::guest::{Io, StatelessValidatorEthrexIo, StatelessValidatorOutput}; #[test] fn serialize_output() { + let dummy_new_payload_request_root = NewPayloadRequest::new_bellatrix(ExecutionPayloadV1 { + parent_hash: [1; 32], + fee_recipient: [2; 20], + state_root: [3; 32], + receipts_root: [4; 32], + logs_bloom: Default::default(), + prev_randao: [5; 32], + block_number: 1, + gas_limit: 2, + gas_used: 3, + timestamp: 4, + extra_data: Default::default(), + base_fee_per_gas: [6; 32], + block_hash: [7; 32], + transactions: Default::default(), + }) + .tree_hash_root(); + for output in [ - StatelessValidatorOutput::new([0x00; 32], [0x00; 32], false), - StatelessValidatorOutput::new([0xff; 32], [0xff; 32], true), + StatelessValidatorOutput::new(dummy_new_payload_request_root, false), + StatelessValidatorOutput::new(dummy_new_payload_request_root, true), ] { assert_eq!( StatelessValidatorEthrexIo::serialize_output(&output).unwrap(), diff --git a/crates/stateless-validator-ethrex/src/host.rs b/crates/stateless-validator-ethrex/src/host.rs index 1a04c3dd..9f1558fa 100644 --- a/crates/stateless-validator-ethrex/src/host.rs +++ b/crates/stateless-validator-ethrex/src/host.rs @@ -1,48 +1,40 @@ //! Implementations for host environment. -use alloc::vec; - use alloy_eips::eip6110::MAINNET_DEPOSIT_CONTRACT_ADDRESS; -use alloy_rlp::Encodable; use ere_zkvm_interface::Input; use ethrex_common::{ H160, - types::{BlobSchedule, Block, ChainConfig, ForkBlobSchedule, block_execution_witness}, + types::{BlobSchedule, ChainConfig, ForkBlobSchedule, block_execution_witness}, }; -use ethrex_rlp::decode::RLPDecode; use ethrex_rpc::debug::execution_witness::{ RpcExecutionWitness, execution_witness_from_rpc_chain_config, }; use guest::{GuestIo, Io}; +use stateless_validator_reth::guest::StatelessValidatorRethInput; use crate::guest::{StatelessValidatorEthrexGuest, StatelessValidatorEthrexInput}; #[rustfmt::skip] pub use { ethrex_guest_program::input::ProgramInput, - stateless_validator_common::host::StatelessInput, + reth_stateless::StatelessInput, }; impl StatelessValidatorEthrexInput { /// Construct [`StatelessValidatorEthrexInput`] given [`StatelessInput`]. - pub fn new(stateless_input: &StatelessInput) -> anyhow::Result { - let mut rlp_bytes = vec![]; - stateless_input.block.encode(&mut rlp_bytes); - let (ethrex_block, _) = Block::decode_unfinished(&rlp_bytes)?; + pub fn new(stateless_input: &StatelessInput, valid_block: bool) -> anyhow::Result { + let reth_input = StatelessValidatorRethInput::new(stateless_input, valid_block)?; + let new_payload_request = reth_input.new_payload_request; - Ok(Self(ProgramInput { - blocks: vec![ethrex_block], + Ok(Self { + new_payload_request, execution_witness: from_reth_witness_to_ethrex_witness( stateless_input.block.number, stateless_input, )?, elasticity_multiplier: 2u64, // NOTE: Ethrex doesn't derive this value from chain config. fee_configs: Default::default(), - #[cfg(feature = "l2")] - blob_commitment: [0; 48], - #[cfg(feature = "l2")] - blob_proof: [0; 48], - })) + }) } /// Returns [`Input`] to [`zkVM`] methods. diff --git a/crates/stateless-validator-ethrex/src/lib.rs b/crates/stateless-validator-ethrex/src/lib.rs index 9f5f6fe5..1f4d0475 100644 --- a/crates/stateless-validator-ethrex/src/lib.rs +++ b/crates/stateless-validator-ethrex/src/lib.rs @@ -8,3 +8,6 @@ pub mod guest; #[cfg(feature = "host")] pub mod host; + +pub mod execution_payload; +pub mod new_payload_request; diff --git a/crates/stateless-validator-ethrex/src/new_payload_request.rs b/crates/stateless-validator-ethrex/src/new_payload_request.rs new file mode 100644 index 00000000..50479977 --- /dev/null +++ b/crates/stateless-validator-ethrex/src/new_payload_request.rs @@ -0,0 +1,178 @@ +//! Conversion utilities for NewPayloadRequest to ethrex Block. + +use anyhow::{Context, Result}; +use ethrex_common::{Address, Bloom, Bytes, H256, types::Block}; +use stateless_validator_common::new_payload_request::{ + ExecutionPayloadV1, ExecutionPayloadV2, ExecutionPayloadV3, NewPayloadRequest, Withdrawal, + compute_requests_hash, +}; + +use crate::execution_payload::{ + EncodedTransaction, ExecutionPayload, validate_block_payload_v1_v2, validate_block_payload_v3, + validate_execution_payload_v1, validate_execution_payload_v2, validate_execution_payload_v3, +}; + +/// Converts a [`NewPayloadRequest`] into an ethrex [`Block`]. +pub fn get_block_from_new_payload_request(req: NewPayloadRequest) -> Result { + match req { + NewPayloadRequest::Bellatrix(b) => { + let payload: ExecutionPayload = b.execution_payload.into(); + validate_execution_payload_v1(&payload).context("V1 payload validation failed")?; + let block = payload + .clone() + .into_block(None, None) + .context("into_block failed")?; + validate_block_payload_v1_v2(&payload, &block) + .context("Block/Payload validation failed")?; + Ok(block) + } + NewPayloadRequest::Capella(c) => { + let payload: ExecutionPayload = c.execution_payload.into(); + validate_execution_payload_v2(&payload).context("V2 payload validation failed")?; + let block = payload + .clone() + .into_block(None, None) + .context("into_block failed")?; + validate_block_payload_v1_v2(&payload, &block) + .context("Block/Payload validation failed")?; + Ok(block) + } + NewPayloadRequest::Deneb(d) => { + let parent_beacon_block_root = Some(H256::from(d.parent_beacon_block_root)); + let payload: ExecutionPayload = d.execution_payload.into(); + validate_execution_payload_v3(&payload).context("V3 payload validation failed")?; + let block = payload + .clone() + .into_block(parent_beacon_block_root, None) + .context("into_block failed")?; + validate_block_payload_v3(&payload, &block, &d.versioned_hashes) + .context("Block/Payload validation failed")?; + Ok(block) + } + NewPayloadRequest::ElectraFulu(e) => { + let parent_beacon_block_root = Some(H256::from(e.parent_beacon_block_root)); + let requests_hash = Some(H256::from(compute_requests_hash(&e.execution_requests))); + let payload: ExecutionPayload = e.execution_payload.into(); + validate_execution_payload_v3(&payload).context("V3 payload validation failed")?; + let block = payload + .clone() + .into_block(parent_beacon_block_root, requests_hash) + .context("into_block failed")?; + validate_block_payload_v3(&payload, &block, &e.versioned_hashes) + .context("Block/Payload validation failed")?; + Ok(block) + } + } +} + +impl From for ExecutionPayload { + fn from(payload: ExecutionPayloadV1) -> Self { + ExecutionPayload { + parent_hash: H256::from(payload.parent_hash), + fee_recipient: Address::from(payload.fee_recipient), + state_root: H256::from(payload.state_root), + receipts_root: H256::from(payload.receipts_root), + logs_bloom: Bloom::from_slice(&payload.logs_bloom[..]), + prev_randao: H256::from(payload.prev_randao), + block_number: payload.block_number, + gas_limit: payload.gas_limit, + gas_used: payload.gas_used, + timestamp: payload.timestamp, + extra_data: Bytes::from(Vec::from(payload.extra_data)), + base_fee_per_gas: base_fee_to_u64(&payload.base_fee_per_gas), + block_hash: H256::from(payload.block_hash), + transactions: payload + .transactions + .into_iter() + .map(|t| EncodedTransaction(Bytes::from(Vec::from(t)))) + .collect(), + withdrawals: None, + blob_gas_used: None, + excess_blob_gas: None, + } + } +} + +impl From for ExecutionPayload { + fn from(payload: ExecutionPayloadV2) -> Self { + ExecutionPayload { + parent_hash: H256::from(payload.parent_hash), + fee_recipient: Address::from(payload.fee_recipient), + state_root: H256::from(payload.state_root), + receipts_root: H256::from(payload.receipts_root), + logs_bloom: Bloom::from_slice(&payload.logs_bloom[..]), + prev_randao: H256::from(payload.prev_randao), + block_number: payload.block_number, + gas_limit: payload.gas_limit, + gas_used: payload.gas_used, + timestamp: payload.timestamp, + extra_data: Bytes::from(Vec::from(payload.extra_data)), + base_fee_per_gas: base_fee_to_u64(&payload.base_fee_per_gas), + block_hash: H256::from(payload.block_hash), + transactions: payload + .transactions + .into_iter() + .map(|t| EncodedTransaction(Bytes::from(Vec::from(t)))) + .collect(), + withdrawals: Some( + payload + .withdrawals + .into_iter() + .map(convert_withdrawal) + .collect(), + ), + blob_gas_used: None, + excess_blob_gas: None, + } + } +} + +impl From for ExecutionPayload { + fn from(payload: ExecutionPayloadV3) -> Self { + ExecutionPayload { + parent_hash: H256::from(payload.parent_hash), + fee_recipient: Address::from(payload.fee_recipient), + state_root: H256::from(payload.state_root), + receipts_root: H256::from(payload.receipts_root), + logs_bloom: Bloom::from_slice(&payload.logs_bloom[..]), + prev_randao: H256::from(payload.prev_randao), + block_number: payload.block_number, + gas_limit: payload.gas_limit, + gas_used: payload.gas_used, + timestamp: payload.timestamp, + extra_data: Bytes::from(Vec::from(payload.extra_data)), + base_fee_per_gas: base_fee_to_u64(&payload.base_fee_per_gas), + block_hash: H256::from(payload.block_hash), + transactions: payload + .transactions + .into_iter() + .map(|t| EncodedTransaction(Bytes::from(Vec::from(t)))) + .collect(), + withdrawals: Some( + payload + .withdrawals + .into_iter() + .map(convert_withdrawal) + .collect(), + ), + blob_gas_used: Some(payload.blob_gas_used), + excess_blob_gas: Some(payload.excess_blob_gas), + } + } +} + +/// Convert our Withdrawal type to ethrex's Withdrawal type. +fn convert_withdrawal(w: Withdrawal) -> ethrex_common::types::Withdrawal { + ethrex_common::types::Withdrawal { + index: w.index, + validator_index: w.validator_index, + address: Address::from(w.address), + amount: w.amount, + } +} + +/// Convert base_fee_per_gas from 32-byte little-endian to u64. +fn base_fee_to_u64(base_fee: &[u8; 32]) -> u64 { + debug_assert!(base_fee[8..].iter().all(|&b| b == 0), "base_fee overflow"); + u64::from_le_bytes(base_fee[..8].try_into().unwrap()) +} diff --git a/crates/stateless-validator-reth/Cargo.toml b/crates/stateless-validator-reth/Cargo.toml index afce3bff..23fc6c55 100644 --- a/crates/stateless-validator-reth/Cargo.toml +++ b/crates/stateless-validator-reth/Cargo.toml @@ -9,17 +9,37 @@ license.workspace = true workspace = true [dependencies] -anyhow = { workspace = true, optional = true } +anyhow = { workspace = true } once_cell.workspace = true serde.workspace = true +serde_with.workspace = true + +# alloy +alloy-consensus.workspace = true +alloy-eips.workspace = true +alloy-genesis.workspace = true +alloy-primitives.workspace = true +alloy-rlp.workspace = true +alloy-rpc-types-engine = { workspace = true, default-features = false, features = [ + "serde", +] } # reth reth-chainspec.workspace = true +reth-payload-validator = { workspace = true, default-features = false } reth-ethereum-primitives.workspace = true reth-evm-ethereum.workspace = true reth-primitives-traits.workspace = true reth-stateless.workspace = true +# lighthouse +tree_hash.workspace = true +tree_hash_derive.workspace = true + +# ssz +ssz_types.workspace = true +ethereum_ssz.workspace = true + # mpt sparsestate.workspace = true @@ -27,6 +47,9 @@ sparsestate.workspace = true ere-io = { workspace = true, features = ["bincode"] } ere-zkvm-interface = { workspace = true, optional = true } +# crypto +sha2.workspace = true + # local guest.workspace = true stateless-validator-common = { workspace = true, features = ["serde"] } @@ -39,4 +62,4 @@ k256 = ["reth-stateless/k256"] secp256k1 = ["reth-stateless/secp256k1"] # host -host = ["std", "stateless-validator-common/host", "dep:anyhow", "dep:ere-zkvm-interface"] +host = ["std", "stateless-validator-common/host", "dep:ere-zkvm-interface"] diff --git a/crates/stateless-validator-reth/src/guest.rs b/crates/stateless-validator-reth/src/guest.rs index 8f1198e9..9389a9dd 100644 --- a/crates/stateless-validator-reth/src/guest.rs +++ b/crates/stateless-validator-reth/src/guest.rs @@ -2,15 +2,19 @@ use alloc::{format, sync::Arc, vec::Vec}; +use alloy_genesis::ChainConfig; use ere_io::serde::{IoSerde, bincode::BincodeLegacy}; use reth_chainspec::ChainSpec; use reth_evm_ethereum::EthEvmConfig; -use reth_primitives_traits::Block; use reth_stateless::{ - Genesis, StatelessInput, UncompressedPublicKey, stateless_validation_with_trie, + ExecutionWitness, Genesis, UncompressedPublicKey, stateless_validation_with_trie, }; use serde::{Deserialize, Serialize}; +use serde_with::serde_as; use sparsestate::SparseState; +use stateless_validator_common::new_payload_request::NewPayloadRequest; + +use crate::new_payload_request::new_payload_request_to_block; #[rustfmt::skip] pub use { @@ -19,10 +23,16 @@ pub use { }; /// Input for the stateless validator guest program. +#[serde_as] #[derive(Debug, Clone, Serialize, Deserialize)] pub struct StatelessValidatorRethInput { - /// The stateless input for the stateless validation function. - pub stateless_input: StatelessInput, + /// New payload request data. + pub new_payload_request: NewPayloadRequest, + /// Execution witness for the EL block. + pub witness: ExecutionWitness, + /// Chain configuration for the stateless validation function + #[serde_as(as = "alloy_genesis::serde_bincode_compat::ChainConfig<'_>")] + pub chain_config: ChainConfig, /// The recovered signers for the transactions in the block. pub public_keys: Vec, } @@ -39,36 +49,76 @@ impl Guest for StatelessValidatorRethGuest { type Io = StatelessValidatorRethIo; fn compute(input: GuestInput) -> GuestOutput { - let genesis = Genesis { - config: input.stateless_input.chain_config.clone(), - ..Default::default() + let new_payload_request_root = input.new_payload_request.tree_hash_root(); + + #[cfg(feature = "std")] + { + let result = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| { + Self::compute_inner::

(input, new_payload_request_root) + })); + + match result { + Ok(output) => output, + Err(_) => { + P::print("Panic occurred during validation\n"); + StatelessValidatorOutput::new(new_payload_request_root, false) + } + } + } + + #[cfg(not(feature = "std"))] + { + Self::compute_inner::

(input, new_payload_request_root) + } + } +} + +impl StatelessValidatorRethGuest { + fn compute_inner( + input: GuestInput, + new_payload_request_root: [u8; 32], + ) -> GuestOutput { + let (chain_spec, evm_config, block_result) = + P::cycle_scope("validation_inputs_preparation", || { + let genesis = Genesis { + config: input.chain_config.clone(), + ..Default::default() + }; + let chain_spec: Arc = Arc::new(genesis.into()); + let evm_config = EthEvmConfig::new(chain_spec.clone()); + let sealed_block_res = + new_payload_request_to_block(input.new_payload_request, chain_spec.clone()); + (chain_spec, evm_config, sealed_block_res) + }); + + let block = match block_result { + Ok(block) => block, + Err(err) => { + P::print(&format!("Failed to convert to reth block: {err}\n")); + return StatelessValidatorOutput::new(new_payload_request_root, false); + } }; - let chain_spec: Arc = Arc::new(genesis.into()); - let evm_config = EthEvmConfig::new(chain_spec.clone()); - let (header, parent_hash) = P::cycle_scope("public_inputs_preparation", || { - ( - input.stateless_input.block.header().clone(), - input.stateless_input.block.parent_hash, - ) - }); + // TODO: consider asking Reth to have an `stateless_validation_with_trie` + // variant which accepts `SealedBlock`. Since this isn't the case today, + // `stateless_validator_with_trie` will hash again the block. + let block = block.into_block(); let res = P::cycle_scope("validation", || { stateless_validation_with_trie::( - input.stateless_input.block, + block, input.public_keys, - input.stateless_input.witness, + input.witness, chain_spec, evm_config, ) - .map(|(block_hash, _)| block_hash) }); match res { - Ok(block_hash) => StatelessValidatorOutput::new(block_hash, parent_hash, true), + Ok(_) => StatelessValidatorOutput::new(new_payload_request_root, true), Err(err) => { P::print(&format!("Block validation failed: {err}\n")); - StatelessValidatorOutput::new(header.hash_slow(), parent_hash, false) + StatelessValidatorOutput::new(new_payload_request_root, false) } } } diff --git a/crates/stateless-validator-reth/src/host.rs b/crates/stateless-validator-reth/src/host.rs index dfd6138a..c1c35ecf 100644 --- a/crates/stateless-validator-reth/src/host.rs +++ b/crates/stateless-validator-reth/src/host.rs @@ -1,25 +1,42 @@ //! Implementations for host environment. use alloc::{format, vec::Vec}; +use std::sync::Arc; +use alloy_consensus::Transaction; +use alloy_eips::{Encodable2718, eip7685::Requests}; +use alloy_genesis::{ChainConfig, Genesis}; +use alloy_primitives::U256; use anyhow::Context; use ere_zkvm_interface::Input; use guest::{GuestIo, Io}; +use reth_chainspec::ChainSpec; use reth_ethereum_primitives::TransactionSigned; -use reth_stateless::UncompressedPublicKey; +use reth_evm_ethereum::EthEvmConfig; +use reth_primitives_traits::Block; +pub use reth_stateless::StatelessInput; +use reth_stateless::{UncompressedPublicKey, stateless_validation_with_trie}; +use sparsestate::SparseState; +use ssz_types::{FixedVector, VariableList}; +pub use stateless_validator_common::guest::StatelessValidatorOutput; +use stateless_validator_common::new_payload_request::{ + ExecutionPayloadV1, ExecutionPayloadV2, ExecutionPayloadV3, ForkName, NewPayloadRequest, + Transaction as Tx, Transactions, Withdrawal, Withdrawals, +}; use crate::guest::{StatelessValidatorRethGuest, StatelessValidatorRethInput}; -#[rustfmt::skip] -pub use stateless_validator_common::host::StatelessInput; - impl StatelessValidatorRethInput { /// Construct [`StatelessValidatorRethInput`] given [`StatelessInput`]. - pub fn new(stateless_input: &StatelessInput) -> anyhow::Result { + pub fn new(stateless_input: &StatelessInput, valid_block: bool) -> anyhow::Result { let signers = recover_signers(&stateless_input.block.body.transactions)?; + let requests = get_requests(stateless_input, &signers, valid_block)?; + let new_payload_request = to_new_payload_request(stateless_input, requests)?; Ok(Self { - stateless_input: stateless_input.clone(), + new_payload_request, + witness: stateless_input.witness.clone(), + chain_config: stateless_input.chain_config.clone(), public_keys: signers, }) } @@ -50,15 +67,277 @@ where .collect() } +/// Determines the fork name based on alloy chain config and block timestamp. +pub fn determine_fork_name(chain_config: &ChainConfig, timestamp: u64) -> ForkName { + // Check forks in reverse chronological order + if chain_config + .osaka_time + .is_some_and(|osaka_time| timestamp >= osaka_time) + { + return ForkName::Fulu; + } + if chain_config + .prague_time + .is_some_and(|prague_time| timestamp >= prague_time) + { + return ForkName::Electra; + } + if chain_config + .cancun_time + .is_some_and(|cancun_time| timestamp >= cancun_time) + { + return ForkName::Deneb; + } + if chain_config + .shanghai_time + .is_some_and(|shanghai_time| timestamp >= shanghai_time) + { + return ForkName::Capella; + } + ForkName::Bellatrix +} + +/// Converts a [`StatelessInput`] to a [`NewPayloadRequest`]. +pub fn to_new_payload_request( + stateless_input: &StatelessInput, + requests: Requests, +) -> anyhow::Result { + let header = stateless_input.block.header(); + let body = stateless_input.block.body(); + let fork = determine_fork_name(&stateless_input.chain_config, header.timestamp); + + // Convert transactions to RLP-encoded bytes + let transactions: Transactions = { + let txs: Vec = body + .transactions() + .map(|tx| { + let mut buf = Vec::new(); + tx.encode_2718(&mut buf); + Tx::from(buf) + }) + .collect(); + Transactions::from(txs) + }; + + // Helper to convert alloy withdrawal to our neutral type + let convert_withdrawal = |w: &alloy_eips::eip4895::Withdrawal| Withdrawal { + index: w.index, + validator_index: w.validator_index, + address: w.address.0.0, + amount: w.amount, + }; + + match fork { + ForkName::Bellatrix => { + let payload = ExecutionPayloadV1 { + parent_hash: header.parent_hash.0, + fee_recipient: header.beneficiary.0.0, + state_root: header.state_root.0, + receipts_root: header.receipts_root.0, + logs_bloom: FixedVector::from(header.logs_bloom.0.to_vec()), + prev_randao: header.mix_hash.0, + block_number: header.number, + gas_limit: header.gas_limit, + gas_used: header.gas_used, + timestamp: header.timestamp, + extra_data: VariableList::from(header.extra_data.to_vec()), + base_fee_per_gas: U256::from(header.base_fee_per_gas.unwrap_or_default()) + .to_le_bytes(), + block_hash: stateless_input.block.hash_slow().0, + transactions: transactions.clone(), + }; + Ok(NewPayloadRequest::new_bellatrix(payload)) + } + ForkName::Capella => { + let withdrawals: Withdrawals = { + let wdls: Vec = body + .withdrawals + .as_ref() + .map(|ws| ws.iter().map(convert_withdrawal).collect()) + .unwrap_or_default(); + Withdrawals::from(wdls) + }; + + let payload = ExecutionPayloadV2 { + parent_hash: header.parent_hash.0, + fee_recipient: header.beneficiary.0.0, + state_root: header.state_root.0, + receipts_root: header.receipts_root.0, + logs_bloom: FixedVector::from(header.logs_bloom.0.to_vec()), + prev_randao: header.mix_hash.0, + block_number: header.number, + gas_limit: header.gas_limit, + gas_used: header.gas_used, + timestamp: header.timestamp, + extra_data: VariableList::from(header.extra_data.to_vec()), + base_fee_per_gas: U256::from(header.base_fee_per_gas.unwrap_or_default()) + .to_le_bytes(), + block_hash: stateless_input.block.hash_slow().0, + transactions: transactions.clone(), + withdrawals, + }; + Ok(NewPayloadRequest::new_capella(payload)) + } + ForkName::Deneb => { + let withdrawals: Withdrawals = { + let wdls: Vec = body + .withdrawals + .as_ref() + .map(|ws| ws.iter().map(convert_withdrawal).collect()) + .unwrap_or_default(); + Withdrawals::from(wdls) + }; + + let payload = ExecutionPayloadV3 { + parent_hash: header.parent_hash.0, + fee_recipient: header.beneficiary.0.0, + state_root: header.state_root.0, + receipts_root: header.receipts_root.0, + logs_bloom: FixedVector::from(header.logs_bloom.0.to_vec()), + prev_randao: header.mix_hash.0, + block_number: header.number, + gas_limit: header.gas_limit, + gas_used: header.gas_used, + timestamp: header.timestamp, + extra_data: VariableList::from(header.extra_data.to_vec()), + base_fee_per_gas: U256::from(header.base_fee_per_gas.unwrap_or_default()) + .to_le_bytes(), + block_hash: stateless_input.block.hash_slow().0, + transactions: transactions.clone(), + withdrawals, + blob_gas_used: header.blob_gas_used.unwrap_or_default(), + excess_blob_gas: header.excess_blob_gas.unwrap_or_default(), + }; + + // Collect blob versioned hashes from all blob transactions + let versioned_hashes: Vec<[u8; 32]> = body + .transactions() + .filter_map(|tx| tx.blob_versioned_hashes()) + .flatten() + .map(|h| h.0) + .collect(); + + let parent_beacon_block_root = stateless_input + .block + .parent_beacon_block_root + .unwrap_or_default() + .0; + + NewPayloadRequest::new_deneb(payload, versioned_hashes, parent_beacon_block_root) + } + ForkName::Electra | ForkName::Fulu => { + let withdrawals: Withdrawals = { + let wdls: Vec = body + .withdrawals + .as_ref() + .map(|ws| ws.iter().map(convert_withdrawal).collect()) + .unwrap_or_default(); + Withdrawals::from(wdls) + }; + + let payload = ExecutionPayloadV3 { + parent_hash: header.parent_hash.0, + fee_recipient: header.beneficiary.0.0, + state_root: header.state_root.0, + receipts_root: header.receipts_root.0, + logs_bloom: FixedVector::from(header.logs_bloom.0.to_vec()), + prev_randao: header.mix_hash.0, + block_number: header.number, + gas_limit: header.gas_limit, + gas_used: header.gas_used, + timestamp: header.timestamp, + extra_data: VariableList::from(header.extra_data.to_vec()), + base_fee_per_gas: U256::from(header.base_fee_per_gas.unwrap_or_default()) + .to_le_bytes(), + block_hash: stateless_input.block.hash_slow().0, + transactions, + withdrawals, + blob_gas_used: header.blob_gas_used.unwrap_or_default(), + excess_blob_gas: header.excess_blob_gas.unwrap_or_default(), + }; + + // Collect blob versioned hashes from all blob transactions + let versioned_hashes: Vec<[u8; 32]> = body + .transactions() + .filter_map(|tx| tx.blob_versioned_hashes()) + .flatten() + .map(|h| h.0) + .collect(); + + let parent_beacon_block_root = stateless_input + .block + .parent_beacon_block_root + .unwrap_or_default() + .0; + + NewPayloadRequest::new_electra_fulu( + payload, + versioned_hashes, + parent_beacon_block_root, + &requests, + ) + } + } +} + +fn get_requests( + stateless_input: &StatelessInput, + signers: &[UncompressedPublicKey], + valid_block: bool, +) -> anyhow::Result { + if !valid_block { + return Ok(Requests::default()); + } + + let genesis = Genesis { + config: stateless_input.chain_config.clone(), + ..Default::default() + }; + let chain_spec: Arc = Arc::new(genesis.into()); + let evm_config = EthEvmConfig::new(chain_spec.clone()); + let (_, out) = stateless_validation_with_trie::( + stateless_input.block.clone(), + signers.to_owned(), + stateless_input.witness.clone(), + chain_spec.clone(), + evm_config, + ) + .context("stateless validation failed")?; + + // This clone doesn't make much sense, but rust-analyzer can't figure out + // why isn't required and mark it as error otherwise. Since this is only used + // in the host side, we can afford the extra clone. + Ok(out.requests.clone()) +} + #[cfg(test)] mod test { + use stateless_validator_common::new_payload_request::{ExecutionPayloadV1, NewPayloadRequest}; + use crate::guest::{Io, StatelessValidatorOutput, StatelessValidatorRethIo}; #[test] fn serialize_output() { + let dummy_new_payload_request_root = NewPayloadRequest::new_bellatrix(ExecutionPayloadV1 { + parent_hash: [1; 32], + fee_recipient: [2; 20], + state_root: [3; 32], + receipts_root: [4; 32], + logs_bloom: Default::default(), + prev_randao: [5; 32], + block_number: 1, + gas_limit: 2, + gas_used: 3, + timestamp: 4, + extra_data: Default::default(), + base_fee_per_gas: [6; 32], + block_hash: [7; 32], + transactions: Default::default(), + }) + .tree_hash_root(); for output in [ - StatelessValidatorOutput::new([0x00; 32], [0x00; 32], false), - StatelessValidatorOutput::new([0xff; 32], [0xff; 32], true), + StatelessValidatorOutput::new(dummy_new_payload_request_root, false), + StatelessValidatorOutput::new(dummy_new_payload_request_root, true), ] { assert_eq!( StatelessValidatorRethIo::serialize_output(&output).unwrap(), diff --git a/crates/stateless-validator-reth/src/lib.rs b/crates/stateless-validator-reth/src/lib.rs index 3e8b68fb..1aaae5ab 100644 --- a/crates/stateless-validator-reth/src/lib.rs +++ b/crates/stateless-validator-reth/src/lib.rs @@ -6,5 +6,7 @@ extern crate alloc; pub mod guest; +pub mod new_payload_request; + #[cfg(feature = "host")] pub mod host; diff --git a/crates/stateless-validator-reth/src/new_payload_request.rs b/crates/stateless-validator-reth/src/new_payload_request.rs new file mode 100644 index 00000000..2d4a1338 --- /dev/null +++ b/crates/stateless-validator-reth/src/new_payload_request.rs @@ -0,0 +1,250 @@ +//! Execution payload request to block utilities. + +use alloc::{sync::Arc, vec::Vec}; + +use alloy_consensus::Block; +use alloy_eips::eip4895::Withdrawal as AlloyWithdrawal; +use alloy_primitives::{Address, B256, Bloom, Bytes, U256}; +use alloy_rpc_types_engine::{ + CancunPayloadFields, ExecutionData, ExecutionPayload as AlloyExecutionPayload, + ExecutionPayloadSidecar, ExecutionPayloadV1 as AlloyExecutionPayloadV1, + ExecutionPayloadV2 as AlloyExecutionPayloadV2, ExecutionPayloadV3 as AlloyExecutionPayloadV3, + PayloadError, +}; +use anyhow::{Context, Result}; +use reth_chainspec::{ChainSpec, EthereumHardforks}; +use reth_payload_validator::{cancun, prague, shanghai}; +use reth_primitives_traits::{Block as _, SealedBlock, SignedTransaction}; +use stateless_validator_common::new_payload_request::{ + ExecutionPayloadV1, ExecutionPayloadV2, ExecutionPayloadV3, NewPayloadRequest, Withdrawal, + compute_requests_hash, +}; + +/// Converts a [`NewPayloadRequest`] into a validated reth [`Block`]. +pub fn new_payload_request_to_block( + new_payload_request: NewPayloadRequest, + chain_spec: Arc, +) -> Result>> { + let execution_data = new_payload_request_to_execution_data(new_payload_request); + let sealed_block = ensure_well_formed_payload(chain_spec, execution_data) + .context("Payload validation failed")?; + Ok(sealed_block) +} + +/// This method is copied from `reth-ethereum-payload-builder` crate. +/// https://github.com/paradigmxyz/reth/blob/8eecad3d1d433ed509373713c21c31504290d17d/crates/ethereum/payload/src/validator.rs#L66 +/// Unfortunately, that crate does not allow to have minimal activated +/// features in alloy-consensus to use directly without pulling in blst +/// and other non-friendly dependencies for zkVMs. +/// TODO: If we can upstream some changes to this crate accordingly, we +/// can remove this method and use directly from reth. +fn ensure_well_formed_payload( + chain_spec: ChainSpec, + payload: ExecutionData, +) -> Result>, PayloadError> +where + ChainSpec: EthereumHardforks, + T: SignedTransaction, +{ + let ExecutionData { payload, sidecar } = payload; + + let expected_hash = payload.block_hash(); + + // First parse the block + let sealed_block = payload.try_into_block_with_sidecar(&sidecar)?.seal_slow(); + + // Ensure the hash included in the payload matches the block hash + if expected_hash != sealed_block.hash() { + return Err(PayloadError::BlockHash { + execution: sealed_block.hash(), + consensus: expected_hash, + }); + } + + shanghai::ensure_well_formed_fields( + sealed_block.body(), + chain_spec.is_shanghai_active_at_timestamp(sealed_block.timestamp), + )?; + + cancun::ensure_well_formed_fields( + &sealed_block, + sidecar.cancun(), + chain_spec.is_cancun_active_at_timestamp(sealed_block.timestamp), + )?; + + prague::ensure_well_formed_fields( + sealed_block.body(), + sidecar.prague(), + chain_spec.is_prague_active_at_timestamp(sealed_block.timestamp), + )?; + + Ok(sealed_block) +} + +fn new_payload_request_to_execution_data(req: NewPayloadRequest) -> ExecutionData { + match req { + NewPayloadRequest::Bellatrix(b) => { + let v1 = convert_v1_to_alloy(b.execution_payload); + ExecutionData::new( + AlloyExecutionPayload::V1(v1), + ExecutionPayloadSidecar::none(), + ) + } + NewPayloadRequest::Capella(c) => { + let (v1, withdrawals) = convert_v2_to_alloy(c.execution_payload); + let v2 = AlloyExecutionPayloadV2 { + payload_inner: v1, + withdrawals, + }; + ExecutionData::new( + AlloyExecutionPayload::V2(v2), + ExecutionPayloadSidecar::none(), + ) + } + NewPayloadRequest::Deneb(d) => { + let blob_gas_used = d.execution_payload.blob_gas_used; + let excess_blob_gas = d.execution_payload.excess_blob_gas; + let (v1, withdrawals) = convert_v2_to_alloy_from_v3(d.execution_payload); + let v3 = AlloyExecutionPayloadV3 { + payload_inner: AlloyExecutionPayloadV2 { + payload_inner: v1, + withdrawals, + }, + blob_gas_used, + excess_blob_gas, + }; + + let versioned_hashes: Vec = + d.versioned_hashes.into_iter().map(B256::from).collect(); + let parent_beacon_block_root = B256::from(d.parent_beacon_block_root); + let cancun_fields = + CancunPayloadFields::new(parent_beacon_block_root, versioned_hashes); + let sidecar = ExecutionPayloadSidecar::v3(cancun_fields); + + ExecutionData::new(AlloyExecutionPayload::V3(v3), sidecar) + } + NewPayloadRequest::ElectraFulu(e) => { + let blob_gas_used = e.execution_payload.blob_gas_used; + let excess_blob_gas = e.execution_payload.excess_blob_gas; + let (v1, withdrawals) = convert_v2_to_alloy_from_v3(e.execution_payload); + let v3 = AlloyExecutionPayloadV3 { + payload_inner: AlloyExecutionPayloadV2 { + payload_inner: v1, + withdrawals, + }, + blob_gas_used, + excess_blob_gas, + }; + + let versioned_hashes: Vec = + e.versioned_hashes.into_iter().map(B256::from).collect(); + let parent_beacon_block_root = B256::from(e.parent_beacon_block_root); + let cancun_fields = + CancunPayloadFields::new(parent_beacon_block_root, versioned_hashes); + + let requests_hash = B256::from(compute_requests_hash(&e.execution_requests)); + let prague_fields = alloy_rpc_types_engine::PraguePayloadFields::new(requests_hash); + let sidecar = ExecutionPayloadSidecar::v4(cancun_fields, prague_fields); + + ExecutionData::new(AlloyExecutionPayload::V3(v3), sidecar) + } + } +} + +fn convert_v1_to_alloy(payload: ExecutionPayloadV1) -> AlloyExecutionPayloadV1 { + AlloyExecutionPayloadV1 { + parent_hash: B256::from(payload.parent_hash), + fee_recipient: Address::from(payload.fee_recipient), + state_root: B256::from(payload.state_root), + receipts_root: B256::from(payload.receipts_root), + logs_bloom: Bloom::from_slice(&payload.logs_bloom[..]), + prev_randao: B256::from(payload.prev_randao), + block_number: payload.block_number, + gas_limit: payload.gas_limit, + gas_used: payload.gas_used, + timestamp: payload.timestamp, + extra_data: Bytes::from(Vec::from(payload.extra_data)), + base_fee_per_gas: U256::from_le_bytes(payload.base_fee_per_gas), + block_hash: B256::from(payload.block_hash), + transactions: payload + .transactions + .into_iter() + .map(|tx| Bytes::from(Vec::from(tx))) + .collect(), + } +} + +fn convert_v2_to_alloy( + payload: ExecutionPayloadV2, +) -> (AlloyExecutionPayloadV1, Vec) { + let v1 = AlloyExecutionPayloadV1 { + parent_hash: B256::from(payload.parent_hash), + fee_recipient: Address::from(payload.fee_recipient), + state_root: B256::from(payload.state_root), + receipts_root: B256::from(payload.receipts_root), + logs_bloom: Bloom::from_slice(&payload.logs_bloom[..]), + prev_randao: B256::from(payload.prev_randao), + block_number: payload.block_number, + gas_limit: payload.gas_limit, + gas_used: payload.gas_used, + timestamp: payload.timestamp, + extra_data: Bytes::from(Vec::from(payload.extra_data)), + base_fee_per_gas: U256::from_le_bytes(payload.base_fee_per_gas), + block_hash: B256::from(payload.block_hash), + transactions: payload + .transactions + .into_iter() + .map(|tx| Bytes::from(Vec::from(tx))) + .collect(), + }; + + let withdrawals = payload + .withdrawals + .into_iter() + .map(convert_withdrawal) + .collect(); + + (v1, withdrawals) +} + +fn convert_v2_to_alloy_from_v3( + payload: ExecutionPayloadV3, +) -> (AlloyExecutionPayloadV1, Vec) { + let v1 = AlloyExecutionPayloadV1 { + parent_hash: B256::from(payload.parent_hash), + fee_recipient: Address::from(payload.fee_recipient), + state_root: B256::from(payload.state_root), + receipts_root: B256::from(payload.receipts_root), + logs_bloom: Bloom::from_slice(&payload.logs_bloom[..]), + prev_randao: B256::from(payload.prev_randao), + block_number: payload.block_number, + gas_limit: payload.gas_limit, + gas_used: payload.gas_used, + timestamp: payload.timestamp, + extra_data: Bytes::from(Vec::from(payload.extra_data)), + base_fee_per_gas: U256::from_le_bytes(payload.base_fee_per_gas), + block_hash: B256::from(payload.block_hash), + transactions: payload + .transactions + .into_iter() + .map(|tx| Bytes::from(Vec::from(tx))) + .collect(), + }; + + let withdrawals = payload + .withdrawals + .into_iter() + .map(convert_withdrawal) + .collect(); + + (v1, withdrawals) +} + +fn convert_withdrawal(w: Withdrawal) -> AlloyWithdrawal { + AlloyWithdrawal { + index: w.index, + validator_index: w.validator_index, + address: Address::from(w.address), + amount: w.amount, + } +}