diff --git a/Cargo.lock b/Cargo.lock index 2bc75ac1..da0e749c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -59,17 +59,53 @@ dependencies = [ "memchr", ] +[[package]] +name = "allocator-api2" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" + +[[package]] +name = "alloy-primitives" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0628ec0ba5b98b3370bb6be17b12f23bfce8ee4ad83823325a20546d9b03b78" +dependencies = [ + "alloy-rlp", + "bytes", + "cfg-if", + "const-hex", + "derive_more", + "hex-literal", + "itoa", + "ruint", + "serde", + "tiny-keccak 2.0.2", +] + [[package]] name = "alloy-rlp" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc0fac0fc16baf1f63f78b47c3d24718f3619b0714076f6a02957d808d52cbef" dependencies = [ + "alloy-rlp-derive", "arrayvec 0.7.4", "bytes", "smol_str", ] +[[package]] +name = "alloy-rlp-derive" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a047897373be4bbb0224c1afdabca92648dc57a9c9ef6e7b0be3aff7a859c83" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", +] + [[package]] name = "amcl" version = "0.3.0" @@ -106,130 +142,6 @@ version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" -[[package]] -name = "ark-ff" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b3235cc41ee7a12aaaf2c575a2ad7b46713a8a50bda2fc3b003a04845c05dd6" -dependencies = [ - "ark-ff-asm 0.3.0", - "ark-ff-macros 0.3.0", - "ark-serialize 0.3.0", - "ark-std 0.3.0", - "derivative", - "num-bigint", - "num-traits", - "paste", - "rustc_version 0.3.3", - "zeroize", -] - -[[package]] -name = "ark-ff" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" -dependencies = [ - "ark-ff-asm 0.4.2", - "ark-ff-macros 0.4.2", - "ark-serialize 0.4.2", - "ark-std 0.4.0", - "derivative", - "digest 0.10.7", - "itertools 0.10.5", - "num-bigint", - "num-traits", - "paste", - "rustc_version 0.4.0", - "zeroize", -] - -[[package]] -name = "ark-ff-asm" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db02d390bf6643fb404d3d22d31aee1c4bc4459600aef9113833d17e786c6e44" -dependencies = [ - "quote", - "syn 1.0.109", -] - -[[package]] -name = "ark-ff-asm" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" -dependencies = [ - "quote", - "syn 1.0.109", -] - -[[package]] -name = "ark-ff-macros" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db2fd794a08ccb318058009eefdf15bcaaaaf6f8161eb3345f907222bac38b20" -dependencies = [ - "num-bigint", - "num-traits", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "ark-ff-macros" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" -dependencies = [ - "num-bigint", - "num-traits", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "ark-serialize" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6c2b318ee6e10f8c2853e73a83adc0ccb88995aa978d8a3408d492ab2ee671" -dependencies = [ - "ark-std 0.3.0", - "digest 0.9.0", -] - -[[package]] -name = "ark-serialize" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" -dependencies = [ - "ark-std 0.4.0", - "digest 0.10.7", - "num-bigint", -] - -[[package]] -name = "ark-std" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1df2c09229cbc5a028b1d70e00fdb2acee28b1055dfb5ca73eea49c5a25c4e7c" -dependencies = [ - "num-traits", - "rand 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 = "arrayvec" version = "0.5.2" @@ -279,7 +191,7 @@ checksum = "b6d7b9decdf35d8908a7e3ef02f64c5e9b1695e230154c0e8de3969142d9b94c" dependencies = [ "futures", "pharos", - "rustc_version 0.4.0", + "rustc_version", ] [[package]] @@ -374,6 +286,29 @@ dependencies = [ "serde", ] +[[package]] +name = "bindgen" +version = "0.66.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2b84e06fc203107bfbad243f4aba2af864eb7db3b1cf46ea0a023b0b433d2a7" +dependencies = [ + "bitflags 2.4.1", + "cexpr", + "clang-sys", + "lazy_static", + "lazycell", + "log", + "peeking_take_while", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn 2.0.39", + "which", +] + [[package]] name = "bit-set" version = "0.5.3" @@ -400,6 +335,9 @@ name = "bitflags" version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +dependencies = [ + "serde", +] [[package]] name = "bitvec" @@ -442,6 +380,18 @@ dependencies = [ "generic-array", ] +[[package]] +name = "blst" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c94087b935a822949d3291a9989ad2b2051ea141eda0fd4e478a75f6aa3e604b" +dependencies = [ + "cc", + "glob", + "threadpool", + "zeroize", +] + [[package]] name = "bs58" version = "0.5.0" @@ -522,6 +472,21 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "c-kzg" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac926d808fb72fe09ebf471a091d6d72918876ccf0b4989766093d2d0d24a0ef" +dependencies = [ + "bindgen", + "blst", + "cc", + "glob", + "hex", + "libc", + "serde", +] + [[package]] name = "camino" version = "1.1.6" @@ -548,7 +513,7 @@ checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" dependencies = [ "camino", "cargo-platform", - "semver 1.0.20", + "semver", "serde", "serde_json", "thiserror", @@ -570,6 +535,15 @@ dependencies = [ "libc", ] +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + [[package]] name = "cfg-if" version = "1.0.0" @@ -627,6 +601,17 @@ dependencies = [ "inout", ] +[[package]] +name = "clang-sys" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67523a3b4be3ce1989d607a828d036249522dd9c1c8de7f4dd2dae43a37369d1" +dependencies = [ + "glob", + "libc", + "libloading", +] + [[package]] name = "clap" version = "3.2.25" @@ -1133,17 +1118,6 @@ dependencies = [ "powerfmt", ] -[[package]] -name = "derivative" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "derive_more" version = "0.99.17" @@ -1153,7 +1127,7 @@ dependencies = [ "convert_case", "proc-macro2", "quote", - "rustc_version 0.4.0", + "rustc_version", "syn 1.0.109", ] @@ -1604,7 +1578,7 @@ dependencies = [ "chrono", "ethers-core", "reqwest", - "semver 1.0.20", + "semver", "serde", "serde_json", "thiserror", @@ -1713,7 +1687,7 @@ dependencies = [ "path-slash", "rayon", "regex", - "semver 1.0.20", + "semver", "serde", "serde_json", "solang-parser", @@ -1774,17 +1748,6 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" -[[package]] -name = "fastrlp" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "139834ddba373bbdd213dffe02c8d110508dcf1726c2be27e8d1f7d7e1856418" -dependencies = [ - "arrayvec 0.7.4", - "auto_impl", - "bytes", -] - [[package]] name = "fdeflate" version = "0.3.1" @@ -2239,20 +2202,15 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.13.2" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" dependencies = [ "ahash", + "allocator-api2", "serde", ] -[[package]] -name = "hashbrown" -version = "0.14.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" - [[package]] name = "hashers" version = "1.0.1" @@ -2977,6 +2935,12 @@ dependencies = [ "spin 0.5.2", ] +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + [[package]] name = "libc" version = "0.2.150" @@ -3086,6 +3050,12 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "miniz_oxide" version = "0.7.1" @@ -3142,6 +3112,16 @@ dependencies = [ "libc", ] +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -3481,12 +3461,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "paste" -version = "1.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" - [[package]] name = "path-slash" version = "0.2.1" @@ -3509,7 +3483,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0444332826c70dc47be74a7c6a5fc44e23a7905ad6858d4162b658320455ef93" dependencies = [ - "rustc_version 0.4.0", + "rustc_version", ] [[package]] @@ -3557,6 +3531,12 @@ dependencies = [ "syn 2.0.39", ] +[[package]] +name = "peeking_take_while" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" + [[package]] name = "pem" version = "1.1.1" @@ -3572,17 +3552,6 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" -[[package]] -name = "pest" -version = "2.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae9cee2a55a544be8b89dc6848072af97a20f2422603c10865be2a42b580fff5" -dependencies = [ - "memchr", - "thiserror", - "ucd-trie", -] - [[package]] name = "petgraph" version = "0.6.4" @@ -3600,7 +3569,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e9567389417feee6ce15dd6527a8a1ecac205ef62c2932bcf3d9f6fc5b78b414" dependencies = [ "futures", - "rustc_version 0.4.0", + "rustc_version", ] [[package]] @@ -4160,8 +4129,8 @@ dependencies = [ [[package]] name = "revm" -version = "3.3.0" -source = "git+https://github.com/bluealloy/revm?rev=ac5c74824fb1a5935a65252903a2585ab9dd7825#ac5c74824fb1a5935a65252903a2585ab9dd7825" +version = "3.5.0" +source = "git+https://github.com/bluealloy/revm?rev=23cbac479f616eba5ab11ddfe6d5814b9c492202#23cbac479f616eba5ab11ddfe6d5814b9c492202" dependencies = [ "auto_impl", "revm-interpreter", @@ -4172,50 +4141,44 @@ dependencies = [ [[package]] name = "revm-interpreter" -version = "1.1.2" -source = "git+https://github.com/bluealloy/revm?rev=ac5c74824fb1a5935a65252903a2585ab9dd7825#ac5c74824fb1a5935a65252903a2585ab9dd7825" +version = "1.3.0" +source = "git+https://github.com/bluealloy/revm?rev=23cbac479f616eba5ab11ddfe6d5814b9c492202#23cbac479f616eba5ab11ddfe6d5814b9c492202" dependencies = [ - "derive_more", - "enumn", "revm-primitives", "serde", - "sha3", ] [[package]] name = "revm-precompile" -version = "2.0.3" -source = "git+https://github.com/bluealloy/revm?rev=ac5c74824fb1a5935a65252903a2585ab9dd7825#ac5c74824fb1a5935a65252903a2585ab9dd7825" +version = "2.2.0" +source = "git+https://github.com/bluealloy/revm?rev=23cbac479f616eba5ab11ddfe6d5814b9c492202#23cbac479f616eba5ab11ddfe6d5814b9c492202" dependencies = [ + "c-kzg", "k256", "num", "once_cell", "revm-primitives", "ripemd", + "secp256k1", "sha2 0.10.8", - "sha3", "substrate-bn", ] [[package]] name = "revm-primitives" -version = "1.1.2" -source = "git+https://github.com/bluealloy/revm?rev=ac5c74824fb1a5935a65252903a2585ab9dd7825#ac5c74824fb1a5935a65252903a2585ab9dd7825" +version = "1.3.0" +source = "git+https://github.com/bluealloy/revm?rev=23cbac479f616eba5ab11ddfe6d5814b9c492202#23cbac479f616eba5ab11ddfe6d5814b9c492202" dependencies = [ + "alloy-primitives", + "alloy-rlp", "auto_impl", + "bitflags 2.4.1", "bitvec 1.0.1", - "bytes", - "derive_more", + "c-kzg", "enumn", - "fixed-hash 0.8.0", - "hashbrown 0.13.2", + "hashbrown 0.14.2", "hex", - "hex-literal", - "primitive-types 0.12.2", - "rlp 0.5.2", - "ruint", "serde", - "sha3", ] [[package]] @@ -4304,17 +4267,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "608a5726529f2f0ef81b8fde9873c4bb829d6b5b5ca6be4d97345ddf0749c825" dependencies = [ "alloy-rlp", - "ark-ff 0.3.0", - "ark-ff 0.4.2", - "bytes", - "fastrlp", - "num-bigint", - "num-traits", - "parity-scale-codec 3.6.5", - "primitive-types 0.12.2", "proptest", "rand 0.8.5", - "rlp 0.5.2", "ruint-macro", "serde", "valuable", @@ -4345,22 +4299,13 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" -[[package]] -name = "rustc_version" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" -dependencies = [ - "semver 0.11.0", -] - [[package]] name = "rustc_version" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.20", + "semver", ] [[package]] @@ -4543,6 +4488,24 @@ dependencies = [ "zeroize", ] +[[package]] +name = "secp256k1" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25996b82292a7a57ed3508f052cfff8640d38d32018784acd714758b43da9c8f" +dependencies = [ + "secp256k1-sys", +] + +[[package]] +name = "secp256k1-sys" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70a129b9e9efbfb223753b9163c4ab3b13cff7fd9c7f010fbac25ab4099fa07e" +dependencies = [ + "cc", +] + [[package]] name = "security-framework" version = "2.9.2" @@ -4566,15 +4529,6 @@ dependencies = [ "libc", ] -[[package]] -name = "semver" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" -dependencies = [ - "semver-parser", -] - [[package]] name = "semver" version = "1.0.20" @@ -4584,15 +4538,6 @@ dependencies = [ "serde", ] -[[package]] -name = "semver-parser" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" -dependencies = [ - "pest", -] - [[package]] name = "send_wrapper" version = "0.4.0" @@ -4749,6 +4694,12 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "shlex" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380" + [[package]] name = "signal-hook-registry" version = "1.4.1" @@ -5025,7 +4976,7 @@ dependencies = [ "hex", "once_cell", "reqwest", - "semver 1.0.20", + "semver", "serde", "serde_json", "sha2 0.10.8", @@ -5152,6 +5103,15 @@ dependencies = [ "once_cell", ] +[[package]] +name = "threadpool" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" +dependencies = [ + "num_cpus", +] + [[package]] name = "time" version = "0.3.30" @@ -5540,12 +5500,6 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" -[[package]] -name = "ucd-trie" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" - [[package]] name = "uint" version = "0.8.5" @@ -5847,6 +5801,18 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb" +[[package]] +name = "which" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +dependencies = [ + "either", + "home", + "once_cell", + "rustix", +] + [[package]] name = "winapi" version = "0.3.9" @@ -5992,7 +5958,7 @@ dependencies = [ "js-sys", "log", "pharos", - "rustc_version 0.4.0", + "rustc_version", "send_wrapper 0.6.0", "thiserror", "wasm-bindgen", diff --git a/Cargo.toml b/Cargo.toml index dcc23608..3127f149 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ milagro_bls = { git = "https://github.com/Snowfork/milagro_bls" } # execution ethers = "2.0.11" -revm = { git = "https://github.com/bluealloy/revm", rev = "ac5c74824fb1a5935a65252903a2585ab9dd7825", default-features = false, features = ["std", "serde"] } +revm = { git = "https://github.com/bluealloy/revm", rev = "23cbac479f616eba5ab11ddfe6d5814b9c492202", default-features = false, features = ["std", "serde"] } triehash-ethereum = { git = "https://github.com/openethereum/parity-ethereum", rev = "55c90d4016505317034e3e98f699af07f5404b63" } # async/futures diff --git a/config/src/config.rs b/config/src/config.rs index fcafcdb7..a0c67d81 100644 --- a/config/src/config.rs +++ b/config/src/config.rs @@ -80,6 +80,8 @@ impl Config { self.forks.bellatrix.fork_version.clone() } else if epoch >= self.forks.altair.epoch { self.forks.altair.fork_version.clone() + } else if epoch >= self.forks.deneb.epoch { + self.forks.deneb.fork_version.clone() } else { self.forks.genesis.fork_version.clone() } diff --git a/config/src/networks.rs b/config/src/networks.rs index 906397ec..579cafdf 100644 --- a/config/src/networks.rs +++ b/config/src/networks.rs @@ -98,6 +98,10 @@ pub fn mainnet() -> BaseConfig { epoch: 194048, fork_version: hex_str_to_bytes("0x03000000").unwrap(), }, + deneb: Fork { + epoch: u64::MAX, + fork_version: hex_str_to_bytes("0x04000000").unwrap(), + }, }, max_checkpoint_age: 1_209_600, // 14 days #[cfg(not(target_arch = "wasm32"))] @@ -139,6 +143,10 @@ pub fn goerli() -> BaseConfig { epoch: 162304, fork_version: hex_str_to_bytes("0x03001020").unwrap(), }, + deneb: Fork { + epoch: 231680, + fork_version: hex_str_to_bytes("0x04001020").unwrap(), + }, }, max_checkpoint_age: 1_209_600, // 14 days #[cfg(not(target_arch = "wasm32"))] @@ -180,6 +188,10 @@ pub fn sepolia() -> BaseConfig { epoch: 56832, fork_version: hex_str_to_bytes("0x90000072").unwrap(), }, + deneb: Fork { + epoch: u64::MAX, + fork_version: hex_str_to_bytes("0x90000073").unwrap(), + }, }, max_checkpoint_age: 1_209_600, // 14 days #[cfg(not(target_arch = "wasm32"))] diff --git a/config/src/types.rs b/config/src/types.rs index aca1d28e..a300dbf1 100644 --- a/config/src/types.rs +++ b/config/src/types.rs @@ -19,6 +19,7 @@ pub struct Forks { pub altair: Fork, pub bellatrix: Fork, pub capella: Fork, + pub deneb: Fork, } #[derive(Serialize, Deserialize, Debug, Default, Clone)] diff --git a/consensus/src/types/mod.rs b/consensus/src/types/mod.rs index 909a199a..be2a3f5d 100644 --- a/consensus/src/types/mod.rs +++ b/consensus/src/types/mod.rs @@ -26,7 +26,7 @@ pub struct BeaconBlock { } #[superstruct( - variants(Bellatrix, Capella), + variants(Bellatrix, Capella, Deneb), variant_attributes( derive(serde::Deserialize, Clone, Debug, SimpleSerialize, Default), serde(deny_unknown_fields) @@ -47,6 +47,8 @@ pub struct BeaconBlockBody { pub execution_payload: ExecutionPayload, #[superstruct(only(Capella))] bls_to_execution_changes: List, + #[superstruct(only(Deneb))] + blob_kzg_commitments: List, 4096>, } impl Default for BeaconBlockBody { @@ -71,7 +73,7 @@ pub struct BlsToExecutionChange { } #[superstruct( - variants(Bellatrix, Capella), + variants(Bellatrix, Capella, Deneb), variant_attributes( derive(serde::Deserialize, Debug, Default, SimpleSerialize, Clone), serde(deny_unknown_fields) @@ -97,6 +99,10 @@ pub struct ExecutionPayload { pub transactions: List, #[superstruct(only(Capella))] withdrawals: List, + #[superstruct(only(Deneb))] + blob_gas_used: U64, + #[superstruct(only(Deneb))] + excess_blob_gas: U64, } impl Default for ExecutionPayload { diff --git a/consensus/src/types/utils.rs b/consensus/src/types/utils.rs index 56d7d126..586e81f8 100644 --- a/consensus/src/types/utils.rs +++ b/consensus/src/types/utils.rs @@ -52,6 +52,7 @@ macro_rules! superstruct_ssz { match self { $type::Bellatrix(inner) => inner.hash_tree_root(), $type::Capella(inner) => inner.hash_tree_root(), + $type::Deneb(inner) => inner.hash_tree_root(), } } } @@ -71,6 +72,7 @@ macro_rules! superstruct_ssz { match self { $type::Bellatrix(inner) => inner.serialize(buffer), $type::Capella(inner) => inner.serialize(buffer), + $type::Deneb(inner) => inner.serialize(buffer), } } } diff --git a/execution/src/evm.rs b/execution/src/evm.rs index 09fb7a9f..6b3894b1 100644 --- a/execution/src/evm.rs +++ b/execution/src/evm.rs @@ -1,13 +1,13 @@ use std::{collections::HashMap, str::FromStr, sync::Arc}; -use bytes::Bytes; use common::types::BlockTag; use ethers::types::transaction::eip2930::AccessListItem; use eyre::{Report, Result}; use futures::future::join_all; use revm::{ primitives::{ - AccountInfo, Bytecode, Env, ExecutionResult, ResultAndState, TransactTo, B160, B256, U256, + AccountInfo, Address, Bytecode, Bytes, Env, ExecutionResult, ResultAndState, TransactTo, + B256, U256, }, Database, EVM, }; @@ -39,7 +39,9 @@ impl Evm { match tx.result { ExecutionResult::Success { output, .. } => Ok(output.into_data().to_vec()), - ExecutionResult::Revert { output, .. } => Err(EvmError::Revert(Some(output))), + ExecutionResult::Revert { output, .. } => { + Err(EvmError::Revert(Some(output.to_vec().into()))) + } ExecutionResult::Halt { .. } => Err(EvmError::Revert(None)), } } @@ -84,19 +86,21 @@ impl Evm { async fn get_env(&self, opts: &CallOpts, tag: BlockTag) -> Env { let mut env = Env::default(); + let to = convert_address(&opts.to.unwrap_or_default()); + let from = convert_address(&opts.from.unwrap_or_default()); - env.tx.transact_to = TransactTo::Call(opts.to.unwrap_or_default().into()); - env.tx.caller = opts.from.map(B160::from).unwrap_or_default(); + env.tx.transact_to = TransactTo::Call(to); + env.tx.caller = from; env.tx.value = opts .value - .map(|value| B256::from(value).into()) + .map(|value| convert_u256(&value)) .unwrap_or_default(); env.tx.data = Bytes::from(opts.data.clone().unwrap_or_default().to_vec()); env.tx.gas_limit = opts.gas.map(|v| v.as_u64()).unwrap_or(u64::MAX); env.tx.gas_price = opts .gas_price - .map(|g| B256::from(g).into()) + .map(|gas_price| convert_u256(&gas_price)) .unwrap_or_default(); let block = self @@ -110,11 +114,10 @@ impl Evm { .unwrap(); env.block.number = U256::from(block.number.as_u64()); - env.block.coinbase = block.miner.into(); + env.block.coinbase = convert_address(&block.miner); env.block.timestamp = U256::from(block.timestamp.as_u64()); - env.block.difficulty = block.difficulty.into(); - - env.cfg.chain_id = U256::from(self.chain_id); + env.block.difficulty = convert_u256(&block.difficulty); + env.cfg.chain_id = self.chain_id; env } @@ -133,15 +136,15 @@ impl ProofDB { } enum StateAccess { - Basic(B160), + Basic(Address), BlockHash(u64), - Storage(B160, U256), + Storage(Address, U256), } struct EvmState { - basic: HashMap, + basic: HashMap, block_hash: HashMap, - storage: HashMap>, + storage: HashMap>, block: BlockTag, access: Option, execution: Arc>, @@ -163,32 +166,45 @@ impl EvmState { if let Some(access) = &self.access.take() { match access { StateAccess::Basic(address) => { + let address_ethers = ethers::types::Address::from_slice(address.as_slice()); let account = self .execution - .get_account(&(*address).into(), None, self.block) + .get_account(&address_ethers, None, self.block) .await?; + let bytecode = Bytecode::new_raw(account.code.into()); - let account = AccountInfo::new(account.balance.into(), account.nonce, bytecode); + let code_hash = B256::from_slice(account.code_hash.as_bytes()); + let balance = convert_u256(&account.balance); + + let account = AccountInfo::new(balance, account.nonce, code_hash, bytecode); self.basic.insert(*address, account); } StateAccess::Storage(address, slot) => { + let address_ethers = ethers::types::Address::from_slice(address.as_slice()); let slot_ethers = ethers::types::H256::from_slice(&slot.to_be_bytes::<32>()); let slots = [slot_ethers]; let account = self .execution - .get_account(&(*address).into(), Some(&slots), self.block) + .get_account(&address_ethers, Some(&slots), self.block) .await?; let storage = self.storage.entry(*address).or_default(); let value = *account.slots.get(&slot_ethers).unwrap(); - storage.insert(*slot, value.into()); + + let mut value_slice = [0u8; 32]; + value.to_big_endian(value_slice.as_mut_slice()); + let value = U256::from_be_slice(&value_slice); + + storage.insert(*slot, value); } StateAccess::BlockHash(number) => { let block = self .execution .get_block(BlockTag::Number(*number), false) .await?; - self.block_hash.insert(*number, block.hash.into()); + + let hash = B256::from_slice(block.hash.as_bytes()); + self.block_hash.insert(*number, hash); } } } @@ -200,7 +216,7 @@ impl EvmState { self.access.is_some() } - pub fn get_basic(&mut self, address: B160) -> Result { + pub fn get_basic(&mut self, address: Address) -> Result { if let Some(account) = self.basic.get(&address) { Ok(account.clone()) } else { @@ -209,7 +225,7 @@ impl EvmState { } } - pub fn get_storage(&mut self, address: B160, slot: U256) -> Result { + pub fn get_storage(&mut self, address: Address, slot: U256) -> Result { let storage = self.storage.entry(address).or_default(); if let Some(slot) = storage.get(&slot) { Ok(*slot) @@ -289,19 +305,23 @@ impl EvmState { } for (address, account) in account_map { - let info = AccountInfo::new( - account.balance.into(), - account.nonce, - Bytecode::new_raw(account.code.into()), - ); + let bytecode = Bytecode::new_raw(account.code.into()); + let code_hash = B256::from_slice(account.code_hash.as_bytes()); + let balance = convert_u256(&account.balance); - self.basic.insert(address.into(), info); + let info = AccountInfo::new(balance, account.nonce, code_hash, bytecode); + + let address = convert_address(&address); + self.basic.insert(address, info); for (slot, value) in account.slots { + let slot = B256::from_slice(slot.as_bytes()); + let value = convert_u256(&value); + self.storage - .entry(address.into()) + .entry(address) .or_default() - .insert(B256::from(slot).into(), value.into()); + .insert(B256::from(slot).into(), value); } } @@ -312,7 +332,7 @@ impl EvmState { impl Database for ProofDB { type Error = Report; - fn basic(&mut self, address: B160) -> Result, Report> { + fn basic(&mut self, address: Address) -> Result, Report> { if is_precompile(&address) { return Ok(Some(AccountInfo::default())); } @@ -320,7 +340,7 @@ impl Database for ProofDB { trace!( target: "helios::evm", "fetch basic evm state for address=0x{}", - hex::encode(address.as_bytes()) + hex::encode(address.as_slice()) ); Ok(Some(self.state.get_basic(address)?)) @@ -328,11 +348,13 @@ impl Database for ProofDB { fn block_hash(&mut self, number: U256) -> Result { trace!(target: "helios::evm", "fetch block hash for block={:?}", number); - let number_ethers: ethers::types::U256 = number.into(); - self.state.get_block_hash(number_ethers.as_u64()) + let number = number + .try_into() + .map_err(|_| eyre::eyre!("invalid block number"))?; + self.state.get_block_hash(number) } - fn storage(&mut self, address: B160, slot: U256) -> Result { + fn storage(&mut self, address: Address, slot: U256) -> Result { trace!(target: "helios::evm", "fetch evm state for address={:?}, slot={}", address, slot); self.state.get_storage(address, slot) } @@ -342,13 +364,24 @@ impl Database for ProofDB { } } -fn is_precompile(address: &B160) -> bool { - address.le(&B160::from_str("0x0000000000000000000000000000000000000009").unwrap()) - && address.gt(&B160::zero()) +fn is_precompile(address: &Address) -> bool { + address.le(&Address::from_str("0x0000000000000000000000000000000000000009").unwrap()) + && address.gt(&Address::ZERO) +} + +fn convert_u256(value: ðers::types::U256) -> U256 { + let mut value_slice = [0u8; 32]; + value.to_big_endian(value_slice.as_mut_slice()); + U256::from_be_slice(&value_slice) +} + +fn convert_address(value: ðers::types::Address) -> Address { + Address::from_slice(value.as_bytes()) } #[cfg(test)] mod tests { + use revm::primitives::KECCAK_EMPTY; use tokio::sync::{mpsc::channel, watch}; use crate::{rpc::mock_rpc::MockRpc, state::State}; @@ -371,8 +404,13 @@ mod tests { // Construct the proof database with the given client let mut proof_db = ProofDB::new(tag, Arc::new(execution)); - let address = B160::from_str("0x388C818CA8B9251b393131C08a736A67ccB19297").unwrap(); - let info = AccountInfo::new(U256::from(500), 10, Bytecode::new_raw(Bytes::default())); + let address = Address::from_str("0x388C818CA8B9251b393131C08a736A67ccB19297").unwrap(); + let info = AccountInfo::new( + U256::from(500), + 10, + KECCAK_EMPTY, + Bytecode::new_raw(Bytes::default()), + ); proof_db.state.basic.insert(address, info.clone()); // Get the account from the proof database diff --git a/execution/src/execution.rs b/execution/src/execution.rs index ffcc124e..c1d37e00 100644 --- a/execution/src/execution.rs +++ b/execution/src/execution.rs @@ -102,7 +102,7 @@ impl ExecutionClient { slot_map.insert(storage_proof.key, storage_proof.value); } - let code = if proof.code_hash == KECCAK_EMPTY.into() { + let code = if proof.code_hash == H256::from_slice(KECCAK_EMPTY.as_slice()) { Vec::new() } else { let code = self.rpc.get_code(address, block.number.as_u64()).await?;