diff --git a/Node/Cargo.lock b/Node/Cargo.lock index 2f1e58d..6a56106 100644 --- a/Node/Cargo.lock +++ b/Node/Cargo.lock @@ -29,6 +29,15 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + [[package]] name = "allocator-api2" version = "0.2.18" @@ -59,7 +68,7 @@ dependencies = [ "alloy-transport-http", "alloy-transport-ipc", "alloy-transport-ws", - "reqwest", + "reqwest 0.12.5", ] [[package]] @@ -148,7 +157,7 @@ dependencies = [ "derive_more", "once_cell", "serde", - "sha2", + "sha2 0.10.8", ] [[package]] @@ -215,7 +224,7 @@ checksum = "22e07c66b8b0ba8c87461a15fe3247c5b46fb500e103111b0ad4798738e45b1e" dependencies = [ "alloy-genesis", "alloy-primitives", - "k256", + "k256 0.13.3", "serde_json", "tempfile", "thiserror", @@ -236,10 +245,10 @@ dependencies = [ "derive_more", "hex-literal", "itoa", - "k256", + "k256 0.13.3", "keccak-asm", "proptest", - "rand", + "rand 0.8.5", "ruint", "serde", "tiny-keccak", @@ -275,7 +284,7 @@ dependencies = [ "futures-utils-wasm", "lru", "pin-project", - "reqwest", + "reqwest 0.12.5", "serde", "serde_json", "tokio", @@ -339,7 +348,7 @@ dependencies = [ "alloy-transport-ws", "futures", "pin-project", - "reqwest", + "reqwest 0.12.5", "serde", "serde_json", "tokio", @@ -384,7 +393,7 @@ dependencies = [ "alloy-rpc-types-eth", "alloy-serde", "jsonwebtoken", - "rand", + "rand 0.8.5", "serde", "thiserror", ] @@ -427,8 +436,8 @@ dependencies = [ "alloy-primitives", "async-trait", "auto_impl", - "elliptic-curve", - "k256", + "elliptic-curve 0.13.8", + "k256 0.13.3", "thiserror", ] @@ -443,8 +452,8 @@ dependencies = [ "alloy-primitives", "alloy-signer", "async-trait", - "k256", - "rand", + "k256 0.13.3", + "rand 0.8.5", "thiserror", ] @@ -472,7 +481,7 @@ dependencies = [ "alloy-sol-macro-input", "const-hex", "heck", - "indexmap", + "indexmap 2.2.6", "proc-macro-error", "proc-macro2", "quote", @@ -546,7 +555,7 @@ checksum = "ff8ef947b901c0d4e97370f9fa25844cf8b63b1a58fd4011ee82342dc8a9fc6b" dependencies = [ "alloy-json-rpc", "alloy-transport", - "reqwest", + "reqwest 0.12.5", "serde_json", "tower", "tracing", @@ -581,7 +590,7 @@ dependencies = [ "alloy-pubsub", "alloy-transport", "futures", - "http", + "http 1.1.0", "rustls", "serde_json", "tokio", @@ -590,6 +599,55 @@ dependencies = [ "ws_stream_wasm", ] +[[package]] +name = "anstream" +version = "0.6.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" + +[[package]] +name = "anstyle-parse" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" +dependencies = [ + "anstyle", + "windows-sys 0.52.0", +] + [[package]] name = "anyhow" version = "1.0.86" @@ -707,7 +765,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1df2c09229cbc5a028b1d70e00fdb2acee28b1055dfb5ca73eea49c5a25c4e7c" dependencies = [ "num-traits", - "rand", + "rand 0.8.5", ] [[package]] @@ -717,15 +775,56 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" dependencies = [ "num-traits", - "rand", + "rand 0.8.5", ] +[[package]] +name = "arrayref" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" + [[package]] name = "arrayvec" version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +[[package]] +name = "assert-json-diff" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47e4f2b81832e72834d7518d8487a0396a28cc408186a2e8854c0f98011faf12" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "async-channel" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" +dependencies = [ + "concurrent-queue", + "event-listener", + "futures-core", +] + +[[package]] +name = "async-sse" +version = "5.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e6fa871e4334a622afd6bb2f611635e8083a6f5e2936c0f90f37c7ef9856298" +dependencies = [ + "async-channel", + "futures-lite", + "http-types", + "log", + "memchr", + "pin-project-lite", +] + [[package]] name = "async-stream" version = "0.3.5" @@ -808,12 +907,24 @@ dependencies = [ "rustc-demangle", ] +[[package]] +name = "base16ct" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" + [[package]] name = "base16ct" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + [[package]] name = "base64" version = "0.21.7" @@ -832,6 +943,25 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" +[[package]] +name = "beacon-api-client" +version = "0.1.0" +source = "git+https://github.com/ralexstokes/ethereum-consensus#cf3c404043230559660810bc0c9d6d5a8498d819" +dependencies = [ + "clap", + "ethereum-consensus", + "http 0.2.12", + "itertools 0.10.5", + "mev-share-sse", + "reqwest 0.11.27", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", + "url", +] + [[package]] name = "bimap" version = "0.6.3" @@ -877,6 +1007,15 @@ dependencies = [ "wyz", ] +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array", +] + [[package]] name = "block-buffer" version = "0.10.4" @@ -898,6 +1037,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "bs58" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" + [[package]] name = "bumpalo" version = "3.16.0" @@ -957,6 +1102,71 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "chrono" +version = "0.4.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +dependencies = [ + "num-traits", +] + +[[package]] +name = "clap" +version = "4.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64acc1846d54c1fe936a78dc189c34e28d3f5afc348403f28ecf53660b9b8462" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fb8393d67ba2e7bfaf28a23458e4e2b543cc73a99595511eb207fdb8aede942" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bac35c6dafb060fd4d275d9a4ffae97917c13a6327903a8be2153cd964f7085" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "clap_lex" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70" + +[[package]] +name = "colorchoice" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" + +[[package]] +name = "colored" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" +dependencies = [ + "lazy_static", + "windows-sys 0.48.0", +] + [[package]] name = "combine" version = "4.6.7" @@ -967,6 +1177,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "concurrent-queue" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "const-hex" version = "1.12.0" @@ -1008,6 +1227,15 @@ version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +[[package]] +name = "core2" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b49ba7ef1ad6107f8824dbe97de947cbaac53c44e7f9756a1fba0d37c1eec505" +dependencies = [ + "memchr", +] + [[package]] name = "cpufeatures" version = "0.2.12" @@ -1017,12 +1245,30 @@ dependencies = [ "libc", ] +[[package]] +name = "crossbeam-utils" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" + [[package]] name = "crunchy" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" +[[package]] +name = "crypto-bigint" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + [[package]] name = "crypto-bigint" version = "0.5.5" @@ -1030,7 +1276,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", ] @@ -1052,7 +1298,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" dependencies = [ "cfg-if", - "hashbrown", + "hashbrown 0.14.5", "lock_api", "once_cell", "parking_lot_core", @@ -1064,6 +1310,16 @@ version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" +[[package]] +name = "der" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de" +dependencies = [ + "const-oid", + "zeroize", +] + [[package]] name = "der" version = "0.7.9" @@ -1122,7 +1378,7 @@ version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "block-buffer", + "block-buffer 0.10.4", "const-oid", "crypto-common", "subtle", @@ -1140,18 +1396,30 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" +[[package]] +name = "ecdsa" +version = "0.14.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c" +dependencies = [ + "der 0.6.1", + "elliptic-curve 0.12.3", + "rfc6979 0.3.1", + "signature 1.6.4", +] + [[package]] name = "ecdsa" version = "0.16.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" dependencies = [ - "der", + "der 0.7.9", "digest 0.10.7", - "elliptic-curve", - "rfc6979", - "signature", - "spki", + "elliptic-curve 0.13.8", + "rfc6979 0.4.0", + "signature 2.2.0", + "spki 0.7.3", ] [[package]] @@ -1160,21 +1428,41 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +[[package]] +name = "elliptic-curve" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" +dependencies = [ + "base16ct 0.1.1", + "crypto-bigint 0.4.9", + "der 0.6.1", + "digest 0.10.7", + "ff 0.12.1", + "generic-array", + "group 0.12.1", + "pkcs8 0.9.0", + "rand_core 0.6.4", + "sec1 0.3.0", + "subtle", + "zeroize", +] + [[package]] name = "elliptic-curve" version = "0.13.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" dependencies = [ - "base16ct", - "crypto-bigint", + "base16ct 0.2.0", + "crypto-bigint 0.5.5", "digest 0.10.7", - "ff", + "ff 0.13.0", "generic-array", - "group", - "pkcs8", - "rand_core", - "sec1", + "group 0.13.0", + "pkcs8 0.10.2", + "rand_core 0.6.4", + "sec1 0.7.3", "subtle", "zeroize", ] @@ -1188,6 +1476,25 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "enr" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26fa0a0be8915790626d5759eb51fe47435a8eac92c2f212bd2da9aa7f30ea56" +dependencies = [ + "base64 0.13.1", + "bs58", + "bytes", + "hex", + "k256 0.11.6", + "log", + "rand 0.8.5", + "rlp", + "serde", + "sha3", + "zeroize", +] + [[package]] name = "equivalent" version = "1.0.1" @@ -1205,67 +1512,191 @@ dependencies = [ ] [[package]] -name = "fastrand" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" - -[[package]] -name = "fastrlp" -version = "0.3.1" +name = "ethabi" +version = "18.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "139834ddba373bbdd213dffe02c8d110508dcf1726c2be27e8d1f7d7e1856418" +checksum = "7413c5f74cc903ea37386a8965a936cbeb334bd270862fdece542c1b2dcbc898" dependencies = [ - "arrayvec", - "auto_impl", - "bytes", + "ethereum-types", + "hex", + "once_cell", + "regex", + "serde", + "serde_json", + "sha3", + "thiserror", + "uint", ] [[package]] -name = "ff" +name = "ethbloom" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60" dependencies = [ - "rand_core", - "subtle", + "crunchy", + "fixed-hash", + "impl-codec", + "impl-rlp", + "impl-serde", + "scale-info", + "tiny-keccak", ] [[package]] -name = "fixed-hash" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" +name = "ethereum-consensus" +version = "0.1.1" +source = "git+https://github.com/ralexstokes/ethereum-consensus#cf3c404043230559660810bc0c9d6d5a8498d819" dependencies = [ - "byteorder", - "rand", - "rustc-hex", - "static_assertions", + "blst", + "bs58", + "c-kzg", + "enr", + "hex", + "integer-sqrt", + "multiaddr", + "multihash", + "rand 0.8.5", + "serde", + "serde_json", + "serde_yaml", + "sha2 0.10.8", + "ssz_rs", + "thiserror", + "tokio", + "tokio-stream", ] [[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "foreign-types" -version = "0.3.2" +name = "ethereum-types" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" dependencies = [ - "foreign-types-shared", + "ethbloom", + "fixed-hash", + "impl-codec", + "impl-rlp", + "impl-serde", + "primitive-types", + "scale-info", + "uint", ] [[package]] -name = "foreign-types-shared" -version = "0.1.1" +name = "ethers-core" +version = "2.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - -[[package]] -name = "form_urlencoded" +checksum = "82d80cc6ad30b14a48ab786523af33b37f28a8623fc06afd55324816ef18fb1f" +dependencies = [ + "arrayvec", + "bytes", + "chrono", + "const-hex", + "elliptic-curve 0.13.8", + "ethabi", + "generic-array", + "k256 0.13.3", + "num_enum", + "open-fastrlp", + "rand 0.8.5", + "rlp", + "serde", + "serde_json", + "strum", + "tempfile", + "thiserror", + "tiny-keccak", + "unicode-xid", +] + +[[package]] +name = "event-listener" +version = "2.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" + +[[package]] +name = "fastrand" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" +dependencies = [ + "instant", +] + +[[package]] +name = "fastrand" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" + +[[package]] +name = "fastrlp" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139834ddba373bbdd213dffe02c8d110508dcf1726c2be27e8d1f7d7e1856418" +dependencies = [ + "arrayvec", + "auto_impl", + "bytes", +] + +[[package]] +name = "ff" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d013fc25338cc558c5c2cfbad646908fb23591e2404481826742b651c9af7160" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "ff" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "fixed-hash" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" +dependencies = [ + "byteorder", + "rand 0.8.5", + "rustc-hex", + "static_assertions", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" @@ -1327,6 +1758,21 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +[[package]] +name = "futures-lite" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" +dependencies = [ + "fastrand 1.9.0", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite", + "waker-fn", +] + [[package]] name = "futures-macro" version = "0.3.30" @@ -1385,6 +1831,17 @@ dependencies = [ "zeroize", ] +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + [[package]] name = "getrandom" version = "0.2.15" @@ -1394,7 +1851,7 @@ dependencies = [ "cfg-if", "js-sys", "libc", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", "wasm-bindgen", ] @@ -1410,17 +1867,47 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +[[package]] +name = "group" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7" +dependencies = [ + "ff 0.12.1", + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "group" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" dependencies = [ - "ff", - "rand_core", + "ff 0.13.0", + "rand_core 0.6.4", "subtle", ] +[[package]] +name = "h2" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http 0.2.12", + "indexmap 2.2.6", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "h2" version = "0.4.5" @@ -1432,14 +1919,20 @@ dependencies = [ "fnv", "futures-core", "futures-sink", - "http", - "indexmap", + "http 1.1.0", + "indexmap 2.2.6", "slab", "tokio", "tokio-util", "tracing", ] +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + [[package]] name = "hashbrown" version = "0.14.5" @@ -1486,6 +1979,17 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "http" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + [[package]] name = "http" version = "1.1.0" @@ -1497,6 +2001,17 @@ dependencies = [ "itoa", ] +[[package]] +name = "http-body" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +dependencies = [ + "bytes", + "http 0.2.12", + "pin-project-lite", +] + [[package]] name = "http-body" version = "1.0.0" @@ -1504,7 +2019,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" dependencies = [ "bytes", - "http", + "http 1.1.0", ] [[package]] @@ -1515,11 +2030,31 @@ checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" dependencies = [ "bytes", "futures-util", - "http", - "http-body", + "http 1.1.0", + "http-body 1.0.0", "pin-project-lite", ] +[[package]] +name = "http-types" +version = "2.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e9b187a72d63adbfba487f48095306ac823049cb504ee195541e91c7775f5ad" +dependencies = [ + "anyhow", + "async-channel", + "base64 0.13.1", + "futures-lite", + "infer", + "pin-project-lite", + "rand 0.7.3", + "serde", + "serde_json", + "serde_qs", + "serde_urlencoded", + "url", +] + [[package]] name = "httparse" version = "1.9.4" @@ -1532,6 +2067,30 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" +[[package]] +name = "hyper" +version = "0.14.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a152ddd61dfaec7273fe8419ab357f33aee0d914c5f4efbf0d96fa749eea5ec9" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2 0.3.26", + "http 0.2.12", + "http-body 0.4.6", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + [[package]] name = "hyper" version = "1.3.1" @@ -1541,9 +2100,9 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "h2", - "http", - "http-body", + "h2 0.4.5", + "http 1.1.0", + "http-body 1.0.0", "httparse", "httpdate", "itoa", @@ -1560,8 +2119,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155" dependencies = [ "futures-util", - "http", - "hyper", + "http 1.1.0", + "hyper 1.3.1", "hyper-util", "log", "rustls", @@ -1571,6 +2130,19 @@ dependencies = [ "tower-service", ] +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper 0.14.30", + "native-tls", + "tokio", + "tokio-native-tls", +] + [[package]] name = "hyper-tls" version = "0.6.0" @@ -1579,7 +2151,7 @@ checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", "http-body-util", - "hyper", + "hyper 1.3.1", "hyper-util", "native-tls", "tokio", @@ -1596,9 +2168,9 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "http", - "http-body", - "hyper", + "http 1.1.0", + "http-body 1.0.0", + "hyper 1.3.1", "pin-project-lite", "socket2", "tokio", @@ -1626,6 +2198,24 @@ dependencies = [ "parity-scale-codec", ] +[[package]] +name = "impl-rlp" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" +dependencies = [ + "rlp", +] + +[[package]] +name = "impl-serde" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" +dependencies = [ + "serde", +] + [[package]] name = "impl-trait-for-tuples" version = "0.2.2" @@ -1637,6 +2227,16 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", +] + [[package]] name = "indexmap" version = "2.2.6" @@ -1644,7 +2244,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.14.5", +] + +[[package]] +name = "infer" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64e9829a50b42bb782c1df523f78d332fe371b10c661e78b7a3c34b0198e9fac" + +[[package]] +name = "instant" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "integer-sqrt" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "276ec31bcb4a9ee45f58bec6f9ec700ae4cf4f4f8f2fa7e06cb406bd5ffdd770" +dependencies = [ + "num-traits", ] [[package]] @@ -1668,6 +2292,12 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" +[[package]] +name = "is_terminal_polyfill" +version = "1.70.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" + [[package]] name = "itertools" version = "0.10.5" @@ -1743,12 +2373,12 @@ dependencies = [ "async-trait", "bytes", "futures-util", - "http", - "http-body", + "http 1.1.0", + "http-body 1.0.0", "http-body-util", "jsonrpsee-types", "parking_lot", - "rand", + "rand 0.8.5", "rustc-hash", "serde", "serde_json", @@ -1765,8 +2395,8 @@ checksum = "52dc99c70619e252e6adc5e95144323505a69a1742771de5b3f2071e1595b363" dependencies = [ "async-trait", "base64 0.22.1", - "http-body", - "hyper", + "http-body 1.0.0", + "hyper 1.3.1", "hyper-rustls", "hyper-util", "jsonrpsee-core", @@ -1789,10 +2419,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c358788aa585f51a78b11bec5d4b16fbe26dda1cc149f21d95dc24836a0be83" dependencies = [ "futures-util", - "http", - "http-body", + "http 1.1.0", + "http-body 1.0.0", "http-body-util", - "hyper", + "hyper 1.3.1", "hyper-util", "jsonrpsee-core", "jsonrpsee-types", @@ -1815,7 +2445,7 @@ version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0feba38a9878d70ccccd2f54b534b15e861d6caa7911d59abfd3e0d8b4de091f" dependencies = [ - "http", + "http 1.1.0", "serde", "serde_json", "thiserror", @@ -1836,6 +2466,18 @@ dependencies = [ "simple_asn1", ] +[[package]] +name = "k256" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72c1e0b51e7ec0a97369623508396067a486bd0cbed95a2659a4b863d28cfc8b" +dependencies = [ + "cfg-if", + "ecdsa 0.14.8", + "elliptic-curve 0.12.3", + "sha2 0.10.8", +] + [[package]] name = "k256" version = "0.13.3" @@ -1843,11 +2485,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b" dependencies = [ "cfg-if", - "ecdsa", - "elliptic-curve", + "ecdsa 0.16.9", + "elliptic-curve 0.13.8", "once_cell", - "sha2", - "signature", + "sha2 0.10.8", + "signature 2.2.0", +] + +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", ] [[package]] @@ -1878,6 +2529,12 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + [[package]] name = "linux-raw-sys" version = "0.4.14" @@ -1906,7 +2563,7 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3262e75e648fce39813cb56ac41f3c3e3f65217ebf3844d818d1f9398cfb0dc" dependencies = [ - "hashbrown", + "hashbrown 0.14.5", ] [[package]] @@ -1915,6 +2572,25 @@ version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" +[[package]] +name = "mev-share-sse" +version = "0.1.6" +source = "git+https://github.com/paradigmxyz/mev-share-rs?rev=9eb2b0138ab3202b9eb3af4b19c7b3bf40b0faa8#9eb2b0138ab3202b9eb3af4b19c7b3bf40b0faa8" +dependencies = [ + "async-sse", + "bytes", + "ethers-core", + "futures-util", + "http-types", + "pin-project-lite", + "reqwest 0.11.27", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", +] + [[package]] name = "mime" version = "0.3.17" @@ -1937,10 +2613,74 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ "libc", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", "windows-sys 0.48.0", ] +[[package]] +name = "mockito" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2f6e023aa5bdf392aa06c78e4a4e6d498baab5138d0c993503350ebbc37bf1e" +dependencies = [ + "assert-json-diff", + "colored", + "futures-core", + "hyper 0.14.30", + "log", + "rand 0.8.5", + "regex", + "serde_json", + "serde_urlencoded", + "similar", + "tokio", +] + +[[package]] +name = "multiaddr" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c580bfdd8803cce319b047d239559a22f809094aaea4ac13902a1fdcfcd4261" +dependencies = [ + "arrayref", + "bs58", + "byteorder", + "data-encoding", + "multihash", + "percent-encoding", + "serde", + "static_assertions", + "unsigned-varint", + "url", +] + +[[package]] +name = "multihash" +version = "0.16.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c346cf9999c631f002d8f977c4eaeaa0e6386f16007202308d0b3757522c2cc" +dependencies = [ + "core2", + "digest 0.10.7", + "multihash-derive", + "sha2 0.10.8", + "unsigned-varint", +] + +[[package]] +name = "multihash-derive" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6d4752e6230d8ef7adf7bd5d8c4b1f6561c1014c5ba9a37445ccefe18aa1db" +dependencies = [ + "proc-macro-crate 1.1.3", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", + "synstructure", +] + [[package]] name = "native-tls" version = "0.2.12" @@ -2028,6 +2768,7 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" dependencies = [ + "proc-macro-crate 3.1.0", "proc-macro2", "quote", "syn 2.0.66", @@ -2048,6 +2789,37 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + +[[package]] +name = "open-fastrlp" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "786393f80485445794f6043fd3138854dd109cc6c4bd1a6383db304c9ce9b9ce" +dependencies = [ + "arrayvec", + "auto_impl", + "bytes", + "ethereum-types", + "open-fastrlp-derive", +] + +[[package]] +name = "open-fastrlp-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "003b2be5c6c53c1cfeb0a238b8a1c3915cd410feb684457a36c10038f764bb1c" +dependencies = [ + "bytes", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "openssl" version = "0.10.64" @@ -2118,12 +2890,18 @@ version = "3.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d830939c76d294956402033aee57a6da7b438f2294eb94864c37b0569053a42c" dependencies = [ - "proc-macro-crate", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", "syn 1.0.109", ] +[[package]] +name = "parking" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" + [[package]] name = "parking_lot" version = "0.12.3" @@ -2222,14 +3000,24 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs8" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" +dependencies = [ + "der 0.6.1", + "spki 0.6.0", +] + [[package]] name = "pkcs8" version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" dependencies = [ - "der", - "spki", + "der 0.7.9", + "spki 0.7.3", ] [[package]] @@ -2258,9 +3046,22 @@ checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" dependencies = [ "fixed-hash", "impl-codec", + "impl-rlp", + "impl-serde", + "scale-info", "uint", ] +[[package]] +name = "proc-macro-crate" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e17d47ce914bf4de440332250b0edd23ce48c005f59fab39d3335866b114f11a" +dependencies = [ + "thiserror", + "toml", +] + [[package]] name = "proc-macro-crate" version = "3.1.0" @@ -2314,8 +3115,8 @@ dependencies = [ "bitflags 2.5.0", "lazy_static", "num-traits", - "rand", - "rand_chacha", + "rand 0.8.5", + "rand_chacha 0.3.1", "rand_xorshift", "regex-syntax", "rusty-fork", @@ -2342,7 +3143,20 @@ dependencies = [ name = "radium" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc", +] [[package]] name = "rand" @@ -2351,8 +3165,18 @@ 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_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core 0.5.1", ] [[package]] @@ -2362,7 +3186,16 @@ 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_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", ] [[package]] @@ -2371,7 +3204,16 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom", + "getrandom 0.2.15", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core 0.5.1", ] [[package]] @@ -2380,7 +3222,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" dependencies = [ - "rand_core", + "rand_core 0.6.4", ] [[package]] @@ -2398,12 +3240,77 @@ dependencies = [ "bitflags 2.5.0", ] +[[package]] +name = "regex" +version = "1.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + [[package]] name = "regex-syntax" version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" +[[package]] +name = "reqwest" +version = "0.11.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" +dependencies = [ + "base64 0.21.7", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2 0.3.26", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.30", + "hyper-tls 0.5.0", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls-pemfile 1.0.4", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper 0.1.2", + "system-configuration", + "tokio", + "tokio-native-tls", + "tokio-util", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-streams", + "web-sys", + "winreg 0.50.0", +] + [[package]] name = "reqwest" version = "0.12.5" @@ -2415,13 +3322,13 @@ dependencies = [ "encoding_rs", "futures-core", "futures-util", - "h2", - "http", - "http-body", + "h2 0.4.5", + "http 1.1.0", + "http-body 1.0.0", "http-body-util", - "hyper", + "hyper 1.3.1", "hyper-rustls", - "hyper-tls", + "hyper-tls 0.6.0", "hyper-util", "ipnet", "js-sys", @@ -2431,11 +3338,11 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "rustls-pemfile", + "rustls-pemfile 2.1.2", "serde", "serde_json", "serde_urlencoded", - "sync_wrapper", + "sync_wrapper 1.0.1", "system-configuration", "tokio", "tokio-native-tls", @@ -2444,7 +3351,18 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "winreg", + "winreg 0.52.0", +] + +[[package]] +name = "rfc6979" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" +dependencies = [ + "crypto-bigint 0.4.9", + "hmac", + "zeroize", ] [[package]] @@ -2465,7 +3383,7 @@ checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" dependencies = [ "cc", "cfg-if", - "getrandom", + "getrandom 0.2.15", "libc", "spin", "untrusted", @@ -2479,9 +3397,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" dependencies = [ "bytes", + "rlp-derive", "rustc-hex", ] +[[package]] +name = "rlp-derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e33d7b2abe0c340d8797fe2907d3f20d3b5ea5908683618bfe80df7f621f672a" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "route-recognizer" version = "0.3.1" @@ -2504,7 +3434,7 @@ dependencies = [ "parity-scale-codec", "primitive-types", "proptest", - "rand", + "rand 0.8.5", "rlp", "ruint-macro", "serde", @@ -2589,12 +3519,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f1fb85efa936c42c6d5fc28d2629bb51e4b2f4b8a5211e297d599cc5a093792" dependencies = [ "openssl-probe", - "rustls-pemfile", + "rustls-pemfile 2.1.2", "rustls-pki-types", "schannel", "security-framework", ] +[[package]] +name = "rustls-pemfile" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +dependencies = [ + "base64 0.21.7", +] + [[package]] name = "rustls-pemfile" version = "2.1.2" @@ -2682,6 +3621,30 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "scale-info" +version = "2.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eca070c12893629e2cc820a9761bedf6ce1dcddc9852984d1dc734b8bd9bd024" +dependencies = [ + "cfg-if", + "derive_more", + "parity-scale-codec", + "scale-info-derive", +] + +[[package]] +name = "scale-info-derive" +version = "2.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d35494501194174bda522a32605929eefc9ecf7e0a326c26db1fdd85881eb62" +dependencies = [ + "proc-macro-crate 3.1.0", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "schannel" version = "0.1.23" @@ -2697,16 +3660,30 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" +dependencies = [ + "base16ct 0.1.1", + "der 0.6.1", + "generic-array", + "pkcs8 0.9.0", + "subtle", + "zeroize", +] + [[package]] name = "sec1" version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" dependencies = [ - "base16ct", - "der", + "base16ct 0.2.0", + "der 0.7.9", "generic-array", - "pkcs8", + "pkcs8 0.10.2", "subtle", "zeroize", ] @@ -2814,6 +3791,17 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_qs" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7715380eec75f029a4ef7de39a9200e0a63823176b759d055b613f5a87df6a6" +dependencies = [ + "percent-encoding", + "serde", + "thiserror", +] + [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -2826,6 +3814,18 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_yaml" +version = "0.8.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "578a7433b776b56a35785ed5ce9a7e777ac0598aac5a6dd1b4b18a307c7fc71b" +dependencies = [ + "indexmap 1.9.3", + "ryu", + "serde", + "yaml-rust", +] + [[package]] name = "sha1" version = "0.10.6" @@ -2837,6 +3837,19 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "sha2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug", +] + [[package]] name = "sha2" version = "0.10.8" @@ -2848,6 +3861,16 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest 0.10.7", + "keccak", +] + [[package]] name = "sha3-asm" version = "0.1.1" @@ -2876,6 +3899,16 @@ dependencies = [ "libc", ] +[[package]] +name = "signature" +version = "1.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" +dependencies = [ + "digest 0.10.7", + "rand_core 0.6.4", +] + [[package]] name = "signature" version = "2.2.0" @@ -2883,9 +3916,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ "digest 0.10.7", - "rand_core", + "rand_core 0.6.4", ] +[[package]] +name = "similar" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa42c91313f1d05da9b26f267f931cf178d4aba455b4c4622dd7355eb80c6640" + [[package]] name = "simple_asn1" version = "0.6.2" @@ -2932,10 +3971,10 @@ dependencies = [ "base64 0.22.1", "bytes", "futures", - "http", + "http 1.1.0", "httparse", "log", - "rand", + "rand 0.8.5", "sha1", ] @@ -2945,6 +3984,16 @@ version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +[[package]] +name = "spki" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" +dependencies = [ + "base64ct", + "der 0.6.1", +] + [[package]] name = "spki" version = "0.7.3" @@ -2952,7 +4001,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" dependencies = [ "base64ct", - "der", + "der 0.7.9", +] + +[[package]] +name = "ssz_rs" +version = "0.9.0" +source = "git+https://github.com/ralexstokes/ssz-rs?rev=84ef2b71aa004f6767420badb42c902ad56b8b72#84ef2b71aa004f6767420badb42c902ad56b8b72" +dependencies = [ + "alloy-primitives", + "bitvec", + "serde", + "sha2 0.9.9", + "ssz_rs_derive", +] + +[[package]] +name = "ssz_rs_derive" +version = "0.9.0" +source = "git+https://github.com/ralexstokes/ssz-rs?rev=84ef2b71aa004f6767420badb42c902ad56b8b72#84ef2b71aa004f6767420badb42c902ad56b8b72" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", ] [[package]] @@ -2961,6 +4032,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + [[package]] name = "strum" version = "0.26.3" @@ -3023,12 +4100,30 @@ dependencies = [ "syn 2.0.66", ] +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + [[package]] name = "sync_wrapper" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +[[package]] +name = "synstructure" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", + "unicode-xid", +] + [[package]] name = "system-configuration" version = "0.5.1" @@ -3056,12 +4151,14 @@ version = "0.1.0" dependencies = [ "alloy", "anyhow", - "elliptic-curve", + "beacon-api-client", + "elliptic-curve 0.13.8", "hex", "jsonrpsee", - "k256", + "k256 0.13.3", "lazy_static", - "reqwest", + "mockito", + "reqwest 0.12.5", "secp256k1", "serde", "serde_json", @@ -3084,7 +4181,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ "cfg-if", - "fastrand", + "fastrand 2.1.0", "rustix", "windows-sys 0.52.0", ] @@ -3276,6 +4373,15 @@ dependencies = [ "tokio", ] +[[package]] +name = "toml" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +dependencies = [ + "serde", +] + [[package]] name = "toml_datetime" version = "0.6.6" @@ -3288,7 +4394,7 @@ version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" dependencies = [ - "indexmap", + "indexmap 2.2.6", "toml_datetime", "winnow 0.5.40", ] @@ -3394,10 +4500,10 @@ dependencies = [ "byteorder", "bytes", "data-encoding", - "http", + "http 1.1.0", "httparse", "log", - "rand", + "rand 0.8.5", "rustls", "rustls-pki-types", "sha1", @@ -3456,6 +4562,18 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + +[[package]] +name = "unsigned-varint" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6889a77d49f1f013504cec6bf97a2c730394adedaeb1deb5ea08949a50541105" + [[package]] name = "untrusted" version = "0.9.0" @@ -3471,6 +4589,7 @@ dependencies = [ "form_urlencoded", "idna", "percent-encoding", + "serde", ] [[package]] @@ -3479,6 +4598,12 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + [[package]] name = "valuable" version = "0.1.0" @@ -3506,6 +4631,12 @@ dependencies = [ "libc", ] +[[package]] +name = "waker-fn" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "317211a0dc0ceedd78fb2ca9a44aed3d7b9b26f81870d485c07122b4350673b7" + [[package]] name = "walkdir" version = "2.5.0" @@ -3525,6 +4656,12 @@ dependencies = [ "try-lock", ] +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -3597,6 +4734,19 @@ version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +[[package]] +name = "wasm-streams" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b65dc4c90b63b118468cf747d8bf3566c1913ef60be765b5730ead9e0a3ba129" +dependencies = [ + "futures-util", + "js-sys", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + [[package]] name = "web-sys" version = "0.3.69" @@ -3810,6 +4960,16 @@ dependencies = [ "memchr", ] +[[package]] +name = "winreg" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + [[package]] name = "winreg" version = "0.52.0" @@ -3848,6 +5008,15 @@ dependencies = [ "tap", ] +[[package]] +name = "yaml-rust" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" +dependencies = [ + "linked-hash-map", +] + [[package]] name = "zerocopy" version = "0.7.34" diff --git a/Node/Cargo.toml b/Node/Cargo.toml index 57b03b5..8de61b0 100644 --- a/Node/Cargo.toml +++ b/Node/Cargo.toml @@ -21,3 +21,7 @@ reqwest = "0.12" hex = "0.4" tiny-keccak = "2.0" secp256k1 = "0.29" +beacon-api-client = { git = "https://github.com/ralexstokes/ethereum-consensus", package = "beacon-api-client" } + +[dev-dependencies] +mockito = "1.4" diff --git a/Node/src/ethereum_l1/consensus_layer.rs b/Node/src/ethereum_l1/consensus_layer.rs new file mode 100644 index 0000000..58eaa0e --- /dev/null +++ b/Node/src/ethereum_l1/consensus_layer.rs @@ -0,0 +1,79 @@ +#![allow(dead_code)] // TODO: remove +use anyhow::Error; +use beacon_api_client::{mainnet::MainnetClientTypes, Client, GenesisDetails, ProposerDuty}; +use reqwest; + +pub struct ConsensusLayer { + client: Client, +} + +impl ConsensusLayer { + pub fn new(rpc_url: &str) -> Result { + let client = Client::new(reqwest::Url::parse(rpc_url)?); + Ok(Self { client }) + } + + pub async fn get_current_epoch(&self) -> Result { + let header = self.client.get_beacon_header_at_head().await?; + let slot = header.header.message.slot; + Ok(slot / 32) + } + + pub async fn get_lookahead(&self, epoch: u64) -> Result, Error> { + let (_, duties) = self.client.get_proposer_duties(epoch).await?; + Ok(duties) + } + + pub async fn get_genesis_data(&self) -> Result { + self.client.get_genesis_details().await.map_err(Error::new) + } +} + +#[cfg(test)] +pub mod tests { + use super::*; + use tokio; + + #[tokio::test] + async fn test_get_lookahead() { + let server = setup_server().await; + let cl = ConsensusLayer::new(server.url().as_str()).unwrap(); + let duties = cl.get_lookahead(1).await.unwrap(); + + assert_eq!(duties.len(), 32); + assert_eq!(duties[0].slot, 32); + } + + #[tokio::test] + async fn test_get_genesis_data() { + let server = setup_server().await; + let cl = ConsensusLayer::new(server.url().as_str()).unwrap(); + let genesis_data = cl.get_genesis_data().await.unwrap(); + + assert_eq!(genesis_data.genesis_time, 1590832934); + assert_eq!( + genesis_data.genesis_validators_root.to_string(), + "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2" + ); + assert_eq!(genesis_data.genesis_fork_version, [0; 4]); + } + + pub async fn setup_server() -> mockito::ServerGuard { + let mut server = mockito::Server::new_async().await; + server + .mock("GET", "/eth/v1/beacon/genesis") + .with_body(r#"{ + "data": { + "genesis_time": "1590832934", + "genesis_validators_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2", + "genesis_fork_version": "0x00000000" + } + }"#) + .create(); + server + .mock("GET", "/eth/v1/validator/duties/proposer/1") + .with_body(include_str!("lookahead_test_response.json")) + .create(); + server + } +} diff --git a/Node/src/ethereum_l1/execution_layer.rs b/Node/src/ethereum_l1/execution_layer.rs new file mode 100644 index 0000000..8fa27ae --- /dev/null +++ b/Node/src/ethereum_l1/execution_layer.rs @@ -0,0 +1,208 @@ +use alloy::{ + network::{Ethereum, EthereumWallet, NetworkWallet}, + primitives::{Address, Bytes, FixedBytes, U256}, + providers::ProviderBuilder, + signers::local::PrivateKeySigner, + sol, + sol_types::SolValue, +}; +use anyhow::Error; +use beacon_api_client::ProposerDuty; +use std::str::FromStr; + +pub struct ExecutionLayer { + rpc_url: reqwest::Url, + wallet: EthereumWallet, + taiko_preconfirming_address: Address, + genesis_timestamp_sec: u64, + slot_duration_sec: u64, +} + +sol!( + #[allow(missing_docs)] + #[sol(rpc)] + PreconfTaskManager, + "src/ethereum_l1/abi/PreconfTaskManager.json" +); + +sol! { + /// @dev Hook and it's data (currently used only during proposeBlock) + struct HookCall { + address hook; + bytes data; + } + + /// @dev Represents proposeBlock's _data input parameter + struct BlockParams { + address assignedProver; // DEPRECATED, value ignored. + address coinbase; + bytes32 extraData; + bytes32 parentMetaHash; + HookCall[] hookCalls; // DEPRECATED, value ignored. + bytes signature; + uint32 l1StateBlockNumber; + uint64 timestamp; + } +} + +impl ExecutionLayer { + pub fn new( + rpc_url: &str, + private_key: &str, + taiko_preconfirming_address: &str, + genesis_timestamp_sec: u64, + slot_duration_sec: u64, + ) -> Result { + let signer = PrivateKeySigner::from_str(private_key)?; + let wallet = EthereumWallet::from(signer); + + Ok(Self { + rpc_url: rpc_url.parse()?, + wallet, + taiko_preconfirming_address: taiko_preconfirming_address.parse()?, + genesis_timestamp_sec, + slot_duration_sec, + }) + } + + pub async fn propose_new_block( + &self, + tx_list: Vec, + parent_meta_hash: [u8; 32], + lookahead_set: Vec, + ) -> Result<(), Error> { + let provider = ProviderBuilder::new() + .with_recommended_fillers() + .wallet(self.wallet.clone()) + .on_http(self.rpc_url.clone()); + + let contract = PreconfTaskManager::new(self.taiko_preconfirming_address, provider); + + let block_params = BlockParams { + assignedProver: Address::ZERO, + coinbase: >::default_signer_address( + &self.wallet, + ), + extraData: FixedBytes::from(&[0u8; 32]), + parentMetaHash: FixedBytes::from(&parent_meta_hash), + hookCalls: vec![], + signature: Bytes::from(vec![0; 32]), + l1StateBlockNumber: 0, + timestamp: 0, + }; + + let encoded_block_params = Bytes::from(BlockParams::abi_encode_sequence(&block_params)); + + let tx_list = Bytes::from(tx_list); + let lookahead_set_param: Vec = lookahead_set + .iter() + .map(|duty| PreconfTaskManager::LookaheadSetParam { + timestamp: U256::from(self.calculate_slot_timestamp(duty.slot)), + preconfer: Address::ZERO, //TODO: Replace it with a BLS key when the contract is ready. + }) + .collect(); + + let builder = contract.newBlockProposal( + encoded_block_params, + tx_list, + U256::from(0), //TODO: Replace it with the proper lookaheadPointer when the contract is ready. + lookahead_set_param, + ); + + let tx_hash = builder.send().await?.watch().await?; + tracing::debug!("Proposed new block: {tx_hash}"); + + Ok(()) + } + + fn calculate_slot_timestamp(&self, slot: u64) -> u64 { + self.genesis_timestamp_sec + slot * self.slot_duration_sec + } + + #[cfg(test)] + pub fn new_from_pk( + rpc_url: reqwest::Url, + private_key: elliptic_curve::SecretKey, + ) -> Result { + let signer = PrivateKeySigner::from_signing_key(private_key.into()); + let wallet = EthereumWallet::from(signer); + + Ok(Self { + rpc_url, + wallet, + taiko_preconfirming_address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" // some random address for test + .parse()?, + genesis_timestamp_sec: 0, + slot_duration_sec: 12, + }) + } + + #[cfg(test)] + async fn call_test_contract(&self) -> Result<(), Error> { + sol! { + #[allow(missing_docs)] + #[sol(rpc, bytecode="6080806040523460135760df908160198239f35b600080fdfe6080806040526004361015601257600080fd5b60003560e01c9081633fb5c1cb1460925781638381f58a146079575063d09de08a14603c57600080fd5b3460745760003660031901126074576000546000198114605e57600101600055005b634e487b7160e01b600052601160045260246000fd5b600080fd5b3460745760003660031901126074576020906000548152f35b34607457602036600319011260745760043560005500fea2646970667358221220e978270883b7baed10810c4079c941512e93a7ba1cd1108c781d4bc738d9090564736f6c634300081a0033")] + contract Counter { + uint256 public number; + + function setNumber(uint256 newNumber) public { + number = newNumber; + } + + function increment() public { + number++; + } + } + } + + let provider = ProviderBuilder::new() + .with_recommended_fillers() + .wallet(self.wallet.clone()) + .on_http(self.rpc_url.clone()); + + let contract = Counter::deploy(&provider).await?; + + let builder = contract.setNumber(U256::from(42)); + let tx_hash = builder.send().await?.watch().await?; + println!("Set number to 42: {tx_hash}"); + + let builder = contract.increment(); + let tx_hash = builder.send().await?.watch().await?; + println!("Incremented number: {tx_hash}"); + + let builder = contract.number(); + let number = builder.call().await?.number.to_string(); + + assert_eq!(number, "43"); + + Ok(()) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use alloy::node_bindings::Anvil; + + #[tokio::test] + async fn test_call_contract() { + // Ensure `anvil` is available in $PATH. + let anvil = Anvil::new().try_spawn().unwrap(); + let rpc_url: reqwest::Url = anvil.endpoint().parse().unwrap(); + let private_key = anvil.keys()[0].clone(); + let el = ExecutionLayer::new_from_pk(rpc_url, private_key).unwrap(); + el.call_test_contract().await.unwrap(); + } + + #[tokio::test] + async fn test_propose_new_block() { + let anvil = Anvil::new().try_spawn().unwrap(); + let rpc_url: reqwest::Url = anvil.endpoint().parse().unwrap(); + let private_key = anvil.keys()[0].clone(); + let el = ExecutionLayer::new_from_pk(rpc_url, private_key).unwrap(); + + el.propose_new_block(vec![0; 32], [0; 32], vec![]) + .await + .unwrap(); + } +} diff --git a/Node/src/ethereum_l1/lookahead_test_response.json b/Node/src/ethereum_l1/lookahead_test_response.json new file mode 100644 index 0000000..d6f5c35 --- /dev/null +++ b/Node/src/ethereum_l1/lookahead_test_response.json @@ -0,0 +1,166 @@ +{ + "dependent_root": "0x03dfea04ec332d814a75c768d53196ad3f2b938a6b3927062b35c7a15810c1a1", + "execution_optimistic": false, + "data": [ + { + "pubkey": "0x93ba30092bacceb2de0a5819446e20c8245aa8f141de32d396327975521a467730401d324b47e643838de2bc15d2a2ba", + "validator_index": "17407", + "slot": "32" + }, + { + "pubkey": "0x847d0fc122f727ebdf23ed9bf1f6d33b7eead31538e80af2e28920c0a37d0e6e7b468017bc4071da0256390567859846", + "validator_index": "855", + "slot": "33" + }, + { + "pubkey": "0x89202390599bb7e0a272a292ad775d1a9376851ad01f26be35e80ab948c5adb57264401b2fceea1f4986d68b1e2175c6", + "validator_index": "10973", + "slot": "34" + }, + { + "pubkey": "0x8920617e61f4083e929b792304693a53753c57d063fa5db9ad9ef735b377f27e42c5d018076a441fa36f94cb94b62d1f", + "validator_index": "6771", + "slot": "35" + }, + { + "pubkey": "0xa5c5a111b8c6571b7adfde6d653f28f58ce1ad95f926c2df151023fd8e22430617516278ba8b5e3fd02f310dca4994d5", + "validator_index": "8100", + "slot": "36" + }, + { + "pubkey": "0x80eaffa380142944391883660c765e2a7bdcf2de6648975380dfff43bd1a64fbc7c58e62585d8ad1d6cca15fabec10fe", + "validator_index": "19212", + "slot": "37" + }, + { + "pubkey": "0x826f7fecab730eb529e64e819953d7525111c5c802f9d4fca6e65b9d2af6901c757ab6755cdf47cbd94cb94504626409", + "validator_index": "13050", + "slot": "38" + }, + { + "pubkey": "0xa89282a6e373980d12ec857a8c046c51e8f9989e4654c6d960542eacae4d72a31ec5f93dfca48a4b3462bf2aa5994a78", + "validator_index": "16653", + "slot": "39" + }, + { + "pubkey": "0xb0916ce46f8ab22d275f4a6e304ae4d872e82e039a00a26ab0fa7b6818875bbc7c7154cc2d8b9efee1bfcc6fe90ea2ec", + "validator_index": "7821", + "slot": "40" + }, + { + "pubkey": "0xb6a5165de66a85880cd638c13578e84d12efdca738e07590fa4aeff337da1f9a25555b039b60387409150807f3c09a22", + "validator_index": "4481", + "slot": "41" + }, + { + "pubkey": "0x920e6b5c891386d5d3aea22f91b55016bc6eca352e1615dba068a814a79ca5f78e734ea1adadbe3734ba7898ea523349", + "validator_index": "4879", + "slot": "42" + }, + { + "pubkey": "0x9190db7863993a8422d0f2b52169a1cc913e778662ddd69317a9c06149d007a0b67caac52d82d818df63f27eb7b3cd1a", + "validator_index": "11622", + "slot": "43" + }, + { + "pubkey": "0x8419b84d1e177b8fcd8030ddd64866f0e533c360fcc5266452ff67c173e5d43325fdbf38688e188080a0755a238f44a6", + "validator_index": "5002", + "slot": "44" + }, + { + "pubkey": "0xaf54dab243ea37c8a9f6eba19414406c5568e02cae5f56a77beba5082a8c27a593d9891a09faa7bb78b7d46bfc1957d9", + "validator_index": "5915", + "slot": "45" + }, + { + "pubkey": "0x8de6f865bda1646284e4b1b902d133169db3f38a5d9516c465e5a1132ccaf7c633dba4f0fc3634c36ec5137032c2f246", + "validator_index": "18446", + "slot": "46" + }, + { + "pubkey": "0xafa653d9c70e3be9f258f7befaa7db082d611a5ca24984c359947697dddcfa891cac809f99dcad0b9eb064844d713cdc", + "validator_index": "13827", + "slot": "47" + }, + { + "pubkey": "0x8e1f6b859f789be5a8ef4ba4034ee3c7d0e6f58612ae45cbef0b9d8ff783b85bea1355fdb9252005c9e4b2b06edc097d", + "validator_index": "14654", + "slot": "48" + }, + { + "pubkey": "0x93da90e0e2013b11af17dbf4f1c65637dce05c0e439fbea5499a2bb29307777b8a2515edfc122e62e5333e4527c1581c", + "validator_index": "1873", + "slot": "49" + }, + { + "pubkey": "0xb7d3c2a5b0b87f91630dddc268dfe3a92d4250af35c0951d43f7bceda0b3bdc2dcbb7fa3d652891091765033a4d9e41f", + "validator_index": "16698", + "slot": "50" + }, + { + "pubkey": "0x976021996108cdbdb0cf41334fb04287656f4d0cac9c521b048d2b3fd2a2f45c9c43ef60578838be28f9cec4e9bae2df", + "validator_index": "20261", + "slot": "51" + }, + { + "pubkey": "0x8b84c07a241ec823605bcdeb3060ed01c2216c11b8a0364d8b9af324852d1cae290e973e54798fe3ee8f42a508c44622", + "validator_index": "7031", + "slot": "52" + }, + { + "pubkey": "0xa153a488a56e0261a089ebf0759f691718d7018581b467730849384e14c2e9744ca5ac117e6a9283bcee53bb547151eb", + "validator_index": "1394", + "slot": "53" + }, + { + "pubkey": "0x8f7dafb78c30ef38317c70b58044a4e566d2a71f254401aa41597a223874eaa7c7eb98d46a9b5f99f94737d42ff69b5a", + "validator_index": "13639", + "slot": "54" + }, + { + "pubkey": "0x80187db60977d3af2432539f2efc00624d0fe83294c2fb36b3c622f0d92b00501bdb1a401358d5ed673c48447dd5c6cd", + "validator_index": "10831", + "slot": "55" + }, + { + "pubkey": "0x9768c3339e6201c34458a89471174971d0c0252dccac297ac78d83585fcf66bf8d176fb5ce27860c4fbfb823d9585c1b", + "validator_index": "14276", + "slot": "56" + }, + { + "pubkey": "0xaf4ea5518d71122ae9c45311c54f80fa6d208b042c0558d6456086385f14098803c7d5f6dccde90ef2e205d34c359723", + "validator_index": "1792", + "slot": "57" + }, + { + "pubkey": "0xb8b0b67fdf968d80f373d772c487cd44bc346294eca60ac8f942dd5c2e039f6511fccf113a9b312cbfb8695a9d689456", + "validator_index": "10145", + "slot": "58" + }, + { + "pubkey": "0xb142ea9f3634efdf9ac7f42d17443c32f89bfcd507dc348c5b2291100d89845ca688d8dc1eb1274d72efc4e891bb02b3", + "validator_index": "11576", + "slot": "59" + }, + { + "pubkey": "0xac734e3914cfbaf838168b9c079c00c4e1de2f60c5de2003dc8500219f0c3733de612b30220f1503e9b9a62ab5cabc3c", + "validator_index": "14011", + "slot": "60" + }, + { + "pubkey": "0x93d784d492aef1e4f083a20645a1b86a0b990cae1fb91d9edce956db97169404949913ab17be7fc329cbb01dc5506306", + "validator_index": "13215", + "slot": "61" + }, + { + "pubkey": "0x81226993c7478809fb6a83da32d9bb1244dff95b9688d10b7c8a8872a20377d34681f94b1200f2b1aa7279868b3434e8", + "validator_index": "14718", + "slot": "62" + }, + { + "pubkey": "0xa0cc4cb756ff663561cf9223165a890041d941a88945adde0b65777830d4204b2514152f2645984bcd049e491cfa8a51", + "validator_index": "12242", + "slot": "63" + } + ] +} \ No newline at end of file diff --git a/Node/src/ethereum_l1/mod.rs b/Node/src/ethereum_l1/mod.rs index 445924a..222e0f0 100644 --- a/Node/src/ethereum_l1/mod.rs +++ b/Node/src/ethereum_l1/mod.rs @@ -1,187 +1,56 @@ -use alloy::{ - network::{Ethereum, EthereumWallet, NetworkWallet}, - primitives::{Address, Bytes, FixedBytes, U256}, - providers::ProviderBuilder, - signers::local::PrivateKeySigner, - sol, - sol_types::SolValue, -}; -use anyhow::Error; -use std::str::FromStr; +pub mod consensus_layer; +pub mod execution_layer; -pub struct EthereumL1 { - rpc_url: reqwest::Url, - wallet: EthereumWallet, - taiko_preconfirming_address: Address, -} - -sol!( - #[allow(missing_docs)] - #[sol(rpc)] - PreconfTaskManager, - "src/ethereum_l1/abi/PreconfTaskManager.json" -); - -sol! { - /// @dev Hook and it's data (currently used only during proposeBlock) - struct HookCall { - address hook; - bytes data; - } +use consensus_layer::ConsensusLayer; +use execution_layer::ExecutionLayer; - /// @dev Represents proposeBlock's _data input parameter - struct BlockParams { - address assignedProver; // DEPRECATED, value ignored. - address coinbase; - bytes32 extraData; - bytes32 parentMetaHash; - HookCall[] hookCalls; // DEPRECATED, value ignored. - bytes signature; - uint32 l1StateBlockNumber; - uint64 timestamp; - } +pub struct EthereumL1 { + pub consensus_layer: ConsensusLayer, + pub execution_layer: ExecutionLayer, } impl EthereumL1 { - pub fn new( - rpc_url: &str, + pub async fn new( + execution_rpc_url: &str, private_key: &str, taiko_preconfirming_address: &str, - ) -> Result { - let signer = PrivateKeySigner::from_str(private_key)?; - let wallet = EthereumWallet::from(signer); - + consensus_rpc_url: &str, + slot_duration_sec: u64, + ) -> Result { + let consensus_layer = ConsensusLayer::new(consensus_rpc_url)?; + let genesis_data = consensus_layer.get_genesis_data().await?; + let execution_layer = ExecutionLayer::new( + execution_rpc_url, + private_key, + taiko_preconfirming_address, + genesis_data.genesis_time, + slot_duration_sec, + )?; Ok(Self { - rpc_url: rpc_url.parse()?, - wallet, - taiko_preconfirming_address: taiko_preconfirming_address.parse()?, + consensus_layer, + execution_layer, }) } - - pub async fn propose_new_block( - &self, - tx_list: Vec, - parent_meta_hash: [u8; 32], - ) -> Result<(), Error> { - let provider = ProviderBuilder::new() - .with_recommended_fillers() - .wallet(self.wallet.clone()) - .on_http(self.rpc_url.clone()); - - let contract = PreconfTaskManager::new(self.taiko_preconfirming_address, provider); - - let block_params = BlockParams { - assignedProver: Address::ZERO, - coinbase: >::default_signer_address( - &self.wallet, - ), - extraData: FixedBytes::from(&[0u8; 32]), - parentMetaHash: FixedBytes::from(&parent_meta_hash), - hookCalls: vec![], - signature: Bytes::from(vec![0; 32]), - l1StateBlockNumber: 0, - timestamp: 0, - }; - - let encoded_block_params = Bytes::from(BlockParams::abi_encode_sequence(&block_params)); - - let tx_list = Bytes::from(tx_list); - let lookahead_set_param: Vec = Vec::new(); - let builder = contract.newBlockProposal( - encoded_block_params, - tx_list, - U256::from(0), - lookahead_set_param, - ); - - let tx_hash = builder.send().await?.watch().await?; - tracing::debug!("Proposed new block: {tx_hash}"); - - Ok(()) - } - - #[cfg(test)] - fn new_from_pk( - rpc_url: reqwest::Url, - private_key: elliptic_curve::SecretKey, - ) -> Result { - let signer = PrivateKeySigner::from_signing_key(private_key.into()); - let wallet = EthereumWallet::from(signer); - - Ok(Self { - rpc_url, - wallet, - taiko_preconfirming_address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" // some random address for test - .parse()?, - }) - } - - #[cfg(test)] - async fn call_test_contract(&self) -> Result<(), Error> { - sol! { - #[allow(missing_docs)] - #[sol(rpc, bytecode="6080806040523460135760df908160198239f35b600080fdfe6080806040526004361015601257600080fd5b60003560e01c9081633fb5c1cb1460925781638381f58a146079575063d09de08a14603c57600080fd5b3460745760003660031901126074576000546000198114605e57600101600055005b634e487b7160e01b600052601160045260246000fd5b600080fd5b3460745760003660031901126074576020906000548152f35b34607457602036600319011260745760043560005500fea2646970667358221220e978270883b7baed10810c4079c941512e93a7ba1cd1108c781d4bc738d9090564736f6c634300081a0033")] - contract Counter { - uint256 public number; - - function setNumber(uint256 newNumber) public { - number = newNumber; - } - - function increment() public { - number++; - } - } - } - - let provider = ProviderBuilder::new() - .with_recommended_fillers() - .wallet(self.wallet.clone()) - .on_http(self.rpc_url.clone()); - - let contract = Counter::deploy(&provider).await?; - - let builder = contract.setNumber(U256::from(42)); - let tx_hash = builder.send().await?.watch().await?; - println!("Set number to 42: {tx_hash}"); - - let builder = contract.increment(); - let tx_hash = builder.send().await?.watch().await?; - println!("Incremented number: {tx_hash}"); - - let builder = contract.number(); - let number = builder.call().await?.number.to_string(); - - assert_eq!(number, "43"); - - Ok(()) - } } #[cfg(test)] mod tests { use super::*; use alloy::node_bindings::Anvil; + use consensus_layer::tests::setup_server; #[tokio::test] - async fn test_call_contract() { - // Ensure `anvil` is available in $PATH. - let anvil = Anvil::new().try_spawn().unwrap(); - let rpc_url: reqwest::Url = anvil.endpoint().parse().unwrap(); - let private_key = anvil.keys()[0].clone(); - let ethereum_l1 = EthereumL1::new_from_pk(rpc_url, private_key).unwrap(); - ethereum_l1.call_test_contract().await.unwrap(); - } + async fn test_propose_new_block_with_lookahead() { + let server = setup_server().await; + let cl = ConsensusLayer::new(server.url().as_str()).unwrap(); + let duties = cl.get_lookahead(1).await.unwrap(); - #[tokio::test] - async fn test_propose_new_block() { let anvil = Anvil::new().try_spawn().unwrap(); let rpc_url: reqwest::Url = anvil.endpoint().parse().unwrap(); let private_key = anvil.keys()[0].clone(); - let ethereum_l1 = EthereumL1::new_from_pk(rpc_url, private_key).unwrap(); + let el = ExecutionLayer::new_from_pk(rpc_url, private_key).unwrap(); - ethereum_l1 - .propose_new_block(vec![0; 32], [0; 32]) + el.propose_new_block(vec![0; 32], [0; 32], duties) .await .unwrap(); } diff --git a/Node/src/main.rs b/Node/src/main.rs index 0c705b8..8cbf4cd 100644 --- a/Node/src/main.rs +++ b/Node/src/main.rs @@ -24,9 +24,12 @@ async fn main() -> Result<(), Error> { &config.mev_boost_url, &config.ethereum_private_key, &config.taiko_preconfirming_address, - )?; + &config.l1_beacon_url, + config.l1_slot_duration_sec, + ) + .await?; let mev_boost = mev_boost::MevBoost::new(&config.mev_boost_url); - let node = node::Node::new(node_rx, avs_p2p_tx, taiko, ethereum_l1, mev_boost); + let node = node::Node::new(node_rx, avs_p2p_tx, taiko, ethereum_l1, mev_boost).await?; node.entrypoint().await?; Ok(()) } diff --git a/Node/src/node/mod.rs b/Node/src/node/mod.rs index ad1d3c8..4fea0dd 100644 --- a/Node/src/node/mod.rs +++ b/Node/src/node/mod.rs @@ -9,24 +9,27 @@ pub struct Node { gas_used: u64, ethereum_l1: EthereumL1, _mev_boost: MevBoost, // temporary unused + epoch: u64, } impl Node { - pub fn new( + pub async fn new( node_rx: Receiver, avs_p2p_tx: Sender, taiko: Taiko, ethereum_l1: EthereumL1, mev_boost: MevBoost, - ) -> Self { - Self { + ) -> Result { + let epoch = ethereum_l1.consensus_layer.get_current_epoch().await?; + Ok(Self { taiko, node_rx: Some(node_rx), avs_p2p_tx, gas_used: 0, ethereum_l1, _mev_boost: mev_boost, - } + epoch, + }) } /// Consumes the Node and starts two loops: @@ -58,7 +61,7 @@ impl Node { } } - async fn preconfirmation_loop(&self) { + async fn preconfirmation_loop(&mut self) { loop { let start_time = tokio::time::Instant::now(); if let Err(err) = self.main_block_preconfirmation_step().await { @@ -70,7 +73,7 @@ impl Node { } } - async fn main_block_preconfirmation_step(&self) -> Result<(), Error> { + async fn main_block_preconfirmation_step(&mut self) -> Result<(), Error> { let pending_tx_lists = self .taiko .get_pending_l2_tx_lists() @@ -85,10 +88,23 @@ impl Node { self.taiko .advance_head_to_new_l2_block(pending_tx_lists.tx_lists, self.gas_used) .await?; + + let current_epoch = self.ethereum_l1.consensus_layer.get_current_epoch().await?; + let lookahead = if current_epoch != self.epoch { + self.epoch = current_epoch; + self.ethereum_l1 + .consensus_layer + .get_lookahead(self.epoch + 1) + .await? + } else { + vec![] + }; self.ethereum_l1 + .execution_layer .propose_new_block( pending_tx_lists.tx_list_bytes[0].clone(), //TODO: handle rest tx lists pending_tx_lists.parent_meta_hash, + lookahead, ) .await?; Ok(()) diff --git a/Node/src/taiko/l2_tx_lists.rs b/Node/src/taiko/l2_tx_lists.rs index d842710..670a040 100644 --- a/Node/src/taiko/l2_tx_lists.rs +++ b/Node/src/taiko/l2_tx_lists.rs @@ -53,52 +53,8 @@ mod tests { #[test] fn test_decompose_pending_lists_json() { - let json_data = serde_json::json!( - { - "TxLists": [ - [ - { - "type": "0x0", - "chainId": "0x28c61", - "nonce": "0x8836", - "to": "0x8b14d287b4150ff22ac73df8be720e933f659abc", - "gas": "0x35f30", - "gasPrice": "0xf4b87001", - "maxPriorityFeePerGas": null, - "maxFeePerGas": null, - "value": "0x0", - "input": "0x3161b7f60000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000027e9000000000000000000000000000000000000000000000005751b6fc9babade290000000000000000000000000000000000000000000000000000000008f811330000000000000000000000000000000000000000000000000000000000000010", - "v": "0x518e5", - "r": "0xb7b4b5540e08775ebb3c077ca7d572378cdb6ed55e3387173f8248578cc073e9", - "s": "0x1f8860f90b61202d4070d1eba494d38c2cb02c749ea1ec542c8d02e5ceeb6439", - "hash": "0xc653e446eafe51eea1f46e6e351adbd1cc8a3271e6935f1441f613a58d441f6a" - }, - { - "type": "0x2", - "chainId": "0x28c61", - "nonce": "0x26d0", - "to": "0x2f6ef5baae08ae9df23528c217a77f03f93b690e", - "gas": "0x1a09b", - "gasPrice": null, - "maxPriorityFeePerGas": "0xcbef0801", - "maxFeePerGas": "0xcbef0801", - "value": "0x0", - "input": "0xbb2cd728000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000ae2c46ddb314b9ba743c6dee4878f151881333d90000000000000000000000007d16e966c879ed6ad9972ddd5376c41a427d2c2a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000004cd712049c0000000000000000000000000000000000000000000000000000057b3ac2af84", - "accessList": [], - "v": "0x0", - "r": "0xbfc407896ee6ed36962d1a591b41aa9a17fe19e176e61cb54a1cd69e3a337508", - "s": "0x621b2448dda4d797447935c051e3908f65dfb3729415280a04cb02c4474baefe", - "yParity": "0x0", - "hash": "0xffbcd2fab90f1bf314ca2da1bf83eeab3d17fd58a0393d29a697b2ff05d0e65c" - } - ] - ], - "TxListBytes": [ - "eJz6ybTuJ6NeU4dZy5cdBYzNzPEGU7pFLrVvEeX/pHXc9se+Ir7J9qmz9jTsOGKYuP0bA36gQECeEb+0+kscEqyl0vknd+26p4lPN8cPQWMC9gs0s0o8XbB9y9YQPo7yuN027DXLrxaZ99zOuxpn3C5u3+QR3nOg+OUC+Y6En9yJCroOBRdfL5lyuUdng07JvIVvQnR6mZ6ee51iuZOxiuknY1kzU09ik9qFltPvORjBRDPjgtlT9PO+7lrHsW7uJ1ONQ+LL65l/WmfyNexkZNmtc12DgPMcCMgvICDPhMxZp+N2d7PIzl0lNrnvPCo+BnYIG99Elq8Ve5l2ovJt1s3puneDy45IOdXqaJFiPhrwuS7EMge3NGu11aH1LQcaFuw/wt6Z9+yt2TRdqUhpx1WzxP9JPix7JrPVS+baPCvjUo4FSdIqHneXXJ/uUml6IPDxhP7U+5uLpohqcLGcZjri7r3uHyAAAP//huiQHQ==" - ], - "ParentMetaHash": "0x2bcf3b1bb0c4066aa46ba6e99b79d7602f124d5ae8fcffd2977b1c2138aa61bc" - } - ); + let json_data = + serde_json::from_str(include_str!("../utils/tx_lists_test_response.json")).unwrap(); let result = decompose_pending_lists_json(json_data).unwrap(); diff --git a/Node/src/utils/commit.rs b/Node/src/utils/commit.rs index a68715d..da24e71 100644 --- a/Node/src/utils/commit.rs +++ b/Node/src/utils/commit.rs @@ -1,3 +1,4 @@ +#![allow(dead_code)] // TODO: remove use crate::taiko::l2_tx_lists::RPCReplyL2TxLists; use anyhow::Error; use secp256k1::{ecdsa::Signature, Message, Secp256k1, SecretKey}; diff --git a/Node/src/utils/config.rs b/Node/src/utils/config.rs index 6bddc74..857db25 100644 --- a/Node/src/utils/config.rs +++ b/Node/src/utils/config.rs @@ -6,6 +6,8 @@ pub struct Config { pub ethereum_private_key: String, pub mev_boost_url: String, pub taiko_preconfirming_address: String, + pub l1_beacon_url: String, + pub l1_slot_duration_sec: u64, } impl Config { @@ -13,6 +15,17 @@ impl Config { const ETHEREUM_PRIVATE_KEY: &str = "ETHEREUM_PRIVATE_KEY"; const TAIKO_PRECONFIRMING_ADDRESS: &str = "TAIKO_PRECONFIRMING_ADDRESS"; + let l1_slot_duration_sec = std::env::var("L1_SLOT_DURATION_SEC") + .unwrap_or_else(|_| "12".to_string()) + .parse::() + .map(|val| { + if val == 0 { + panic!("L1_SLOT_DURATION_SEC must be a positive number"); + } + val + }) + .expect("L1_SLOT_DURATION_SEC must be a number"); + let config = Self { taiko_proposer_url: std::env::var("TAIKO_PROPOSER_URL") .unwrap_or_else(|_| "http://127.0.0.1:1234".to_string()), @@ -36,14 +49,27 @@ impl Config { }), mev_boost_url: std::env::var("MEV_BOOST_URL") .unwrap_or_else(|_| "http://127.0.0.1:8080".to_string()), + l1_beacon_url: std::env::var("L1_BEACON_URL") + .unwrap_or_else(|_| "http://127.0.0.1:4000".to_string()), + l1_slot_duration_sec, }; info!( - "\nConfiguration: \nTaiko proposer URL: {}, \nTaiko driver URL: {}, \nMEV Boost URL: {}, \nNew block proposal contract address: {}", + r#" +Configuration: +Taiko proposer URL: {}, +Taiko driver URL: {}, +MEV Boost URL: {}, +New block proposal contract address: {} +Consensus layer URL: {} +L1 slot duration: {} +"#, config.taiko_proposer_url, config.taiko_driver_url, config.mev_boost_url, - config.taiko_preconfirming_address + config.taiko_preconfirming_address, + config.l1_beacon_url, + config.l1_slot_duration_sec ); config diff --git a/Node/src/utils/rpc_server.rs b/Node/src/utils/rpc_server.rs index 1311da6..301be4d 100644 --- a/Node/src/utils/rpc_server.rs +++ b/Node/src/utils/rpc_server.rs @@ -2,7 +2,6 @@ pub mod test { use jsonrpsee::server::{ServerBuilder, ServerHandle}; use jsonrpsee::RpcModule; - use lazy_static::lazy_static; use serde_json::json; use std::net::SocketAddr; use tracing::info; @@ -27,7 +26,9 @@ pub mod test { let mut module = RpcModule::new(()); module.register_async_method("RPC.GetL2TxLists", |_, _, _| async { - TX_LISTS_RESPONSE.clone() + let tx_lists_response: serde_json::Value = + serde_json::from_str(include_str!("tx_lists_test_response.json")).unwrap(); + tx_lists_response })?; module.register_async_method( "RPC.AdvanceL2ChainHeadWithNewBlocks", @@ -53,51 +54,4 @@ pub mod test { info!("Server stopped"); } } - - lazy_static! { - pub static ref TX_LISTS_RESPONSE: serde_json::Value = json!({ - "TxLists": [ - [ - { - "type": "0x0", - "chainId": "0x28c61", - "nonce": "0x8836", - "to": "0x8b14d287b4150ff22ac73df8be720e933f659abc", - "gas": "0x35f30", - "gasPrice": "0xf4b87001", - "maxPriorityFeePerGas": null, - "maxFeePerGas": null, - "value": "0x0", - "input": "0x3161b7f60000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000027e9000000000000000000000000000000000000000000000005751b6fc9babade290000000000000000000000000000000000000000000000000000000008f811330000000000000000000000000000000000000000000000000000000000000010", - "v": "0x518e5", - "r": "0xb7b4b5540e08775ebb3c077ca7d572378cdb6ed55e3387173f8248578cc073e9", - "s": "0x1f8860f90b61202d4070d1eba494d38c2cb02c749ea1ec542c8d02e5ceeb6439", - "hash": "0xc653e446eafe51eea1f46e6e351adbd1cc8a3271e6935f1441f613a58d441f6a" - }, - { - "type": "0x2", - "chainId": "0x28c61", - "nonce": "0x26d0", - "to": "0x2f6ef5baae08ae9df23528c217a77f03f93b690e", - "gas": "0x1a09b", - "gasPrice": null, - "maxPriorityFeePerGas": "0xcbef0801", - "maxFeePerGas": "0xcbef0801", - "value": "0x0", - "input": "0xbb2cd728000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000ae2c46ddb314b9ba743c6dee4878f151881333d90000000000000000000000007d16e966c879ed6ad9972ddd5376c41a427d2c2a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000004cd712049c0000000000000000000000000000000000000000000000000000057b3ac2af84", - "accessList": [], - "v": "0x0", - "r": "0xbfc407896ee6ed36962d1a591b41aa9a17fe19e176e61cb54a1cd69e3a337508", - "s": "0x621b2448dda4d797447935c051e3908f65dfb3729415280a04cb02c4474baefe", - "yParity": "0x0", - "hash": "0xffbcd2fab90f1bf314ca2da1bf83eeab3d17fd58a0393d29a697b2ff05d0e65c" - } - ] - ], - "TxListBytes": [ - "eJz6ybTuJ6NeU4dZy5cdBYzNzPEGU7pFLrVvEeX/pHXc9se+Ir7J9qmz9jTsOGKYuP0bA36gQECeEb+0+kscEqyl0vknd+26p4lPN8cPQWMC9gs0s0o8XbB9y9YQPo7yuN027DXLrxaZ99zOuxpn3C5u3+QR3nOg+OUC+Y6En9yJCroOBRdfL5lyuUdng07JvIVvQnR6mZ6ee51iuZOxiuknY1kzU09ik9qFltPvORjBRDPjgtlT9PO+7lrHsW7uJ1ONQ+LL65l/WmfyNexkZNmtc12DgPMcCMgvICDPhMxZp+N2d7PIzl0lNrnvPCo+BnYIG99Elq8Ve5l2ovJt1s3puneDy45IOdXqaJFiPhrwuS7EMge3NGu11aH1LQcaFuw/wt6Z9+yt2TRdqUhpx1WzxP9JPix7JrPVS+baPCvjUo4FSdIqHneXXJ/uUml6IPDxhP7U+5uLpohqcLGcZjri7r3uHyAAAP//huiQHQ==" - ], - "ParentMetaHash": "0x2bcf3b1bb0c4066aa46ba6e99b79d7602f124d5ae8fcffd2977b1c2138aa61bc" - }); - } } diff --git a/Node/src/utils/tx_lists_test_response.json b/Node/src/utils/tx_lists_test_response.json new file mode 100644 index 0000000..90b061f --- /dev/null +++ b/Node/src/utils/tx_lists_test_response.json @@ -0,0 +1,44 @@ +{ + "TxLists": [ + [ + { + "type": "0x0", + "chainId": "0x28c61", + "nonce": "0x8836", + "to": "0x8b14d287b4150ff22ac73df8be720e933f659abc", + "gas": "0x35f30", + "gasPrice": "0xf4b87001", + "maxPriorityFeePerGas": null, + "maxFeePerGas": null, + "value": "0x0", + "input": "0x3161b7f60000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000027e9000000000000000000000000000000000000000000000005751b6fc9babade290000000000000000000000000000000000000000000000000000000008f811330000000000000000000000000000000000000000000000000000000000000010", + "v": "0x518e5", + "r": "0xb7b4b5540e08775ebb3c077ca7d572378cdb6ed55e3387173f8248578cc073e9", + "s": "0x1f8860f90b61202d4070d1eba494d38c2cb02c749ea1ec542c8d02e5ceeb6439", + "hash": "0xc653e446eafe51eea1f46e6e351adbd1cc8a3271e6935f1441f613a58d441f6a" + }, + { + "type": "0x2", + "chainId": "0x28c61", + "nonce": "0x26d0", + "to": "0x2f6ef5baae08ae9df23528c217a77f03f93b690e", + "gas": "0x1a09b", + "gasPrice": null, + "maxPriorityFeePerGas": "0xcbef0801", + "maxFeePerGas": "0xcbef0801", + "value": "0x0", + "input": "0xbb2cd728000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000ae2c46ddb314b9ba743c6dee4878f151881333d90000000000000000000000007d16e966c879ed6ad9972ddd5376c41a427d2c2a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000004cd712049c0000000000000000000000000000000000000000000000000000057b3ac2af84", + "accessList": [], + "v": "0x0", + "r": "0xbfc407896ee6ed36962d1a591b41aa9a17fe19e176e61cb54a1cd69e3a337508", + "s": "0x621b2448dda4d797447935c051e3908f65dfb3729415280a04cb02c4474baefe", + "yParity": "0x0", + "hash": "0xffbcd2fab90f1bf314ca2da1bf83eeab3d17fd58a0393d29a697b2ff05d0e65c" + } + ] + ], + "TxListBytes": [ + "eJz6ybTuJ6NeU4dZy5cdBYzNzPEGU7pFLrVvEeX/pHXc9se+Ir7J9qmz9jTsOGKYuP0bA36gQECeEb+0+kscEqyl0vknd+26p4lPN8cPQWMC9gs0s0o8XbB9y9YQPo7yuN027DXLrxaZ99zOuxpn3C5u3+QR3nOg+OUC+Y6En9yJCroOBRdfL5lyuUdng07JvIVvQnR6mZ6ee51iuZOxiuknY1kzU09ik9qFltPvORjBRDPjgtlT9PO+7lrHsW7uJ1ONQ+LL65l/WmfyNexkZNmtc12DgPMcCMgvICDPhMxZp+N2d7PIzl0lNrnvPCo+BnYIG99Elq8Ve5l2ovJt1s3puneDy45IOdXqaJFiPhrwuS7EMge3NGu11aH1LQcaFuw/wt6Z9+yt2TRdqUhpx1WzxP9JPix7JrPVS+baPCvjUo4FSdIqHneXXJ/uUml6IPDxhP7U+5uLpohqcLGcZjri7r3uHyAAAP//huiQHQ==" + ], + "ParentMetaHash": "0x2bcf3b1bb0c4066aa46ba6e99b79d7602f124d5ae8fcffd2977b1c2138aa61bc" +} \ No newline at end of file