From 68df53b1de4b214b91470362e5c8d30132c2d0f2 Mon Sep 17 00:00:00 2001 From: thedevbirb Date: Wed, 17 Jul 2024 16:18:40 +0200 Subject: [PATCH 1/6] chore(sidecar): bump reth/alloy types, remove trace call manager --- bolt-sidecar/Cargo.lock | 849 +++++++++--------- bolt-sidecar/Cargo.toml | 42 +- .../src/builder/call_trace_manager.rs | 308 ------- bolt-sidecar/src/builder/mod.rs | 7 - bolt-sidecar/src/builder/payload_builder.rs | 2 + bolt-sidecar/src/builder/state_root.rs | 120 --- bolt-sidecar/src/primitives/mod.rs | 19 +- 7 files changed, 478 insertions(+), 869 deletions(-) delete mode 100644 bolt-sidecar/src/builder/call_trace_manager.rs delete mode 100644 bolt-sidecar/src/builder/state_root.rs diff --git a/bolt-sidecar/Cargo.lock b/bolt-sidecar/Cargo.lock index b07443794..e51cf22bf 100644 --- a/bolt-sidecar/Cargo.lock +++ b/bolt-sidecar/Cargo.lock @@ -50,35 +50,20 @@ version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04e9a1892803b02f53e25bea3e414ddd0501f12d97456c9d5ade4edf88f9516f" dependencies = [ - "alloy-rlp", "num_enum", "serde", "strum", ] -[[package]] -name = "alloy-consensus" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=17633df#17633df04920e07cd7afbd6ee825fcde677fa1d1" -dependencies = [ - "alloy-eips 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=17633df)", - "alloy-primitives", - "alloy-rlp", - "alloy-serde 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=17633df)", - "c-kzg", - "serde", - "sha2 0.10.8", -] - [[package]] name = "alloy-consensus" version = "0.1.0" source = "git+https://github.com/alloy-rs/alloy?rev=64feb9bc51c8021ea08535694c44de84222f474e#64feb9bc51c8021ea08535694c44de84222f474e" dependencies = [ - "alloy-eips 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=64feb9bc51c8021ea08535694c44de84222f474e)", + "alloy-eips 0.1.0", "alloy-primitives", "alloy-rlp", - "alloy-serde 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=64feb9bc51c8021ea08535694c44de84222f474e)", + "alloy-serde 0.1.0", "c-kzg", "serde", ] @@ -98,15 +83,16 @@ dependencies = [ ] [[package]] -name = "alloy-eips" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=17633df#17633df04920e07cd7afbd6ee825fcde677fa1d1" +name = "alloy-consensus" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f58047cc851e58c26224521d1ecda466e3d746ebca0274cd5427aa660a88c353" dependencies = [ + "alloy-eips 0.2.0", "alloy-primitives", "alloy-rlp", - "alloy-serde 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=17633df)", + "alloy-serde 0.2.0", "c-kzg", - "once_cell", "serde", ] @@ -117,7 +103,7 @@ source = "git+https://github.com/alloy-rs/alloy?rev=64feb9bc51c8021ea08535694c44 dependencies = [ "alloy-primitives", "alloy-rlp", - "alloy-serde 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=64feb9bc51c8021ea08535694c44de84222f474e)", + "alloy-serde 0.1.0", "c-kzg", "once_cell", "serde", @@ -140,13 +126,20 @@ dependencies = [ ] [[package]] -name = "alloy-genesis" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=17633df#17633df04920e07cd7afbd6ee825fcde677fa1d1" +name = "alloy-eips" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d32a3e14fa0d152d00bd8daf605eb74ad397efb0f54bd7155585823dddb4401e" dependencies = [ "alloy-primitives", - "alloy-serde 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=17633df)", + "alloy-rlp", + "alloy-serde 0.2.0", + "c-kzg", + "derive_more", + "k256 0.13.3", + "once_cell", "serde", + "sha2 0.10.8", ] [[package]] @@ -155,19 +148,19 @@ version = "0.1.0" source = "git+https://github.com/alloy-rs/alloy?rev=64feb9bc51c8021ea08535694c44de84222f474e#64feb9bc51c8021ea08535694c44de84222f474e" dependencies = [ "alloy-primitives", - "alloy-serde 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=64feb9bc51c8021ea08535694c44de84222f474e)", + "alloy-serde 0.1.0", "serde", "serde_json", ] [[package]] name = "alloy-genesis" -version = "0.1.2" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "894f33a7822abb018db56b10ab90398e63273ce1b5a33282afd186c132d764a6" +checksum = "20cb76c8a3913f2466c5488f3a915e3a15d15596bdc935558c1a9be75e9ec508" dependencies = [ "alloy-primitives", - "alloy-serde 0.1.2", + "alloy-serde 0.2.0", "serde", ] @@ -184,6 +177,19 @@ dependencies = [ "tracing", ] +[[package]] +name = "alloy-json-rpc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e76a9feec2352c78545d1a37415699817bae8dc41654bd1bfe57d6cdd5433bd" +dependencies = [ + "alloy-primitives", + "serde", + "serde_json", + "thiserror", + "tracing", +] + [[package]] name = "alloy-network" version = "0.1.2" @@ -192,11 +198,31 @@ checksum = "dc122cbee2b8523854cc11d87bcd5773741602c553d2d2d106d82eeb9c16924a" dependencies = [ "alloy-consensus 0.1.2", "alloy-eips 0.1.2", - "alloy-json-rpc", + "alloy-json-rpc 0.1.2", "alloy-primitives", - "alloy-rpc-types-eth", + "alloy-rpc-types-eth 0.1.2", "alloy-serde 0.1.2", - "alloy-signer", + "alloy-signer 0.1.2", + "alloy-sol-types", + "async-trait", + "auto_impl", + "futures-utils-wasm", + "thiserror", +] + +[[package]] +name = "alloy-network" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3223d71dc78f464b2743418d0be8b5c894313e272105a6206ad5e867d67b3ce2" +dependencies = [ + "alloy-consensus 0.2.0", + "alloy-eips 0.2.0", + "alloy-json-rpc 0.2.0", + "alloy-primitives", + "alloy-rpc-types-eth 0.2.0", + "alloy-serde 0.2.0", + "alloy-signer 0.2.0", "alloy-sol-types", "async-trait", "auto_impl", @@ -206,11 +232,11 @@ dependencies = [ [[package]] name = "alloy-node-bindings" -version = "0.1.2" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df0e005ecc1b41f0b3bf90f68df5a446971e7eb34e1ea051da401e7e8eeef8fd" +checksum = "77a2864b3470d3c74bf50a70f4a5f3e87a7359870878a268be829d7caff42f13" dependencies = [ - "alloy-genesis 0.1.2", + "alloy-genesis 0.2.0", "alloy-primitives", "k256 0.13.3", "serde_json", @@ -222,9 +248,9 @@ dependencies = [ [[package]] name = "alloy-primitives" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f783611babedbbe90db3478c120fb5f5daacceffc210b39adc0af4fe0da70bad" +checksum = "ccb3ead547f4532bc8af961649942f0b9c16ee9226e26caa3f38420651cc0bf4" dependencies = [ "alloy-rlp", "bytes", @@ -253,14 +279,46 @@ dependencies = [ "alloy-chains", "alloy-consensus 0.1.2", "alloy-eips 0.1.2", - "alloy-json-rpc", - "alloy-network", + "alloy-json-rpc 0.1.2", + "alloy-network 0.1.2", + "alloy-primitives", + "alloy-rpc-client 0.1.2", + "alloy-rpc-types-eth 0.1.2", + "alloy-transport 0.1.2", + "alloy-transport-http 0.1.2", + "async-stream", + "async-trait", + "auto_impl", + "dashmap", + "futures", + "futures-utils-wasm", + "lru", + "pin-project", + "reqwest 0.12.5", + "serde", + "serde_json", + "tokio", + "tracing", + "url", +] + +[[package]] +name = "alloy-provider" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29da7457d853cb8199ec04b227d5d2ef598be3e59fc2bbad70c8be213292f32" +dependencies = [ + "alloy-chains", + "alloy-consensus 0.2.0", + "alloy-eips 0.2.0", + "alloy-json-rpc 0.2.0", + "alloy-network 0.2.0", "alloy-primitives", "alloy-pubsub", - "alloy-rpc-client", - "alloy-rpc-types-eth", - "alloy-transport", - "alloy-transport-http", + "alloy-rpc-client 0.2.0", + "alloy-rpc-types-eth 0.2.0", + "alloy-transport 0.2.0", + "alloy-transport-http 0.2.0", "alloy-transport-ws", "async-stream", "async-trait", @@ -280,13 +338,13 @@ dependencies = [ [[package]] name = "alloy-pubsub" -version = "0.1.2" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702f330b7da123a71465ab9d39616292f8344a2811c28f2cc8d8438a69d79e35" +checksum = "f64acfec654ade392cecfa9bba0408eb2a337d55f1b857925da79970cb70f3d6" dependencies = [ - "alloy-json-rpc", + "alloy-json-rpc 0.2.0", "alloy-primitives", - "alloy-transport", + "alloy-transport 0.2.0", "bimap", "futures", "serde", @@ -299,9 +357,9 @@ dependencies = [ [[package]] name = "alloy-rlp" -version = "0.3.5" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b155716bab55763c95ba212806cf43d05bcc70e5f35b02bad20cf5ec7fe11fed" +checksum = "a43b18702501396fa9bcdeecd533bc85fac75150d308fc0f6800a01e6234a003" dependencies = [ "alloy-rlp-derive", "arrayvec", @@ -310,9 +368,9 @@ dependencies = [ [[package]] name = "alloy-rlp-derive" -version = "0.3.5" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8037e03c7f462a063f28daec9fda285a9a89da003c552f8637a80b9c8fd96241" +checksum = "d83524c1f6162fcb5b0decf775498a125066c86dda6066ed609531b0e912f85a" dependencies = [ "proc-macro2", "quote", @@ -325,12 +383,9 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b40fcb53b2a9d0a78a4968b2eca8805a4b7011b9ee3fdfa2acaf137c5128f36b" dependencies = [ - "alloy-json-rpc", - "alloy-primitives", - "alloy-pubsub", - "alloy-transport", - "alloy-transport-http", - "alloy-transport-ws", + "alloy-json-rpc 0.1.2", + "alloy-transport 0.1.2", + "alloy-transport-http 0.1.2", "futures", "pin-project", "reqwest 0.12.5", @@ -344,22 +399,27 @@ dependencies = [ ] [[package]] -name = "alloy-rpc-types" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=17633df#17633df04920e07cd7afbd6ee825fcde677fa1d1" +name = "alloy-rpc-client" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8a9e609524fa31c2c70eb24c0da60796809193ad4787a6dfe6d0db0d3ac112d" dependencies = [ - "alloy-consensus 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=17633df)", - "alloy-eips 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=17633df)", - "alloy-genesis 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=17633df)", + "alloy-json-rpc 0.2.0", "alloy-primitives", - "alloy-rlp", - "alloy-serde 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=17633df)", - "alloy-sol-types", - "itertools 0.12.1", - "jsonrpsee-types 0.22.5", + "alloy-pubsub", + "alloy-transport 0.2.0", + "alloy-transport-http 0.2.0", + "alloy-transport-ws", + "futures", + "pin-project", + "reqwest 0.12.5", "serde", "serde_json", - "thiserror", + "tokio", + "tokio-stream", + "tower", + "tracing", + "url", ] [[package]] @@ -367,12 +427,12 @@ name = "alloy-rpc-types" version = "0.1.0" source = "git+https://github.com/alloy-rs/alloy?rev=64feb9bc51c8021ea08535694c44de84222f474e#64feb9bc51c8021ea08535694c44de84222f474e" dependencies = [ - "alloy-consensus 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=64feb9bc51c8021ea08535694c44de84222f474e)", - "alloy-eips 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=64feb9bc51c8021ea08535694c44de84222f474e)", - "alloy-genesis 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=64feb9bc51c8021ea08535694c44de84222f474e)", + "alloy-consensus 0.1.0", + "alloy-eips 0.1.0", + "alloy-genesis 0.1.0", "alloy-primitives", "alloy-rlp", - "alloy-serde 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=64feb9bc51c8021ea08535694c44de84222f474e)", + "alloy-serde 0.1.0", "alloy-sol-types", "itertools 0.12.1", "serde", @@ -386,49 +446,45 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "50f2fbe956a3e0f0975c798f488dc6be96b669544df3737e18f4a325b42f4c86" dependencies = [ - "alloy-rpc-types-eth", + "alloy-rpc-types-eth 0.1.2", "alloy-serde 0.1.2", ] [[package]] -name = "alloy-rpc-types-beacon" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=64feb9bc51c8021ea08535694c44de84222f474e#64feb9bc51c8021ea08535694c44de84222f474e" +name = "alloy-rpc-types" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e5d76f1e8b22f48b7b8f985782b68e7eb3938780e50e8b646a53e41a598cdf5" dependencies = [ - "alloy-eips 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=64feb9bc51c8021ea08535694c44de84222f474e)", - "alloy-primitives", - "alloy-rpc-types-engine 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=64feb9bc51c8021ea08535694c44de84222f474e)", + "alloy-rpc-types-eth 0.2.0", + "alloy-serde 0.2.0", "serde", - "serde_with", - "thiserror", ] [[package]] name = "alloy-rpc-types-beacon" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb383cd3981cee0031aeacbd394c4e726e907f3a0180fe36d5fc76d37c41cd82" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy?rev=64feb9bc51c8021ea08535694c44de84222f474e#64feb9bc51c8021ea08535694c44de84222f474e" dependencies = [ - "alloy-eips 0.1.2", + "alloy-eips 0.1.0", "alloy-primitives", - "alloy-rpc-types-engine 0.1.2", + "alloy-rpc-types-engine 0.1.0", "serde", "serde_with", "thiserror", ] [[package]] -name = "alloy-rpc-types-engine" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=17633df#17633df04920e07cd7afbd6ee825fcde677fa1d1" +name = "alloy-rpc-types-beacon" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b47dcc8e3bebea57b1c9495a7e6f3313e99d355c0f5b80473cfbdfcbdd6ebea" dependencies = [ - "alloy-consensus 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=17633df)", + "alloy-eips 0.2.0", "alloy-primitives", - "alloy-rlp", - "alloy-rpc-types 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=17633df)", - "alloy-serde 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=17633df)", - "jsonrpsee-types 0.22.5", + "alloy-rpc-types-engine 0.2.0", "serde", + "serde_with", "thiserror", ] @@ -437,12 +493,12 @@ name = "alloy-rpc-types-engine" version = "0.1.0" source = "git+https://github.com/alloy-rs/alloy?rev=64feb9bc51c8021ea08535694c44de84222f474e#64feb9bc51c8021ea08535694c44de84222f474e" dependencies = [ - "alloy-consensus 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=64feb9bc51c8021ea08535694c44de84222f474e)", - "alloy-eips 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=64feb9bc51c8021ea08535694c44de84222f474e)", + "alloy-consensus 0.1.0", + "alloy-eips 0.1.0", "alloy-primitives", "alloy-rlp", - "alloy-rpc-types 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=64feb9bc51c8021ea08535694c44de84222f474e)", - "alloy-serde 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=64feb9bc51c8021ea08535694c44de84222f474e)", + "alloy-rpc-types 0.1.0", + "alloy-serde 0.1.0", "jsonwebtoken", "rand 0.8.5", "serde", @@ -451,16 +507,16 @@ dependencies = [ [[package]] name = "alloy-rpc-types-engine" -version = "0.1.2" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd473d98ec552f8229cd6d566bd2b0bbfc5bb4efcefbb5288c834aa8fd832020" +checksum = "73445fbc5c02258e3d0d977835c92366a4d91545fd456c3fc8601c61810bc9f6" dependencies = [ - "alloy-consensus 0.1.2", - "alloy-eips 0.1.2", + "alloy-consensus 0.2.0", + "alloy-eips 0.2.0", "alloy-primitives", "alloy-rlp", - "alloy-rpc-types-eth", - "alloy-serde 0.1.2", + "alloy-rpc-types-eth 0.2.0", + "alloy-serde 0.2.0", "jsonwebtoken", "rand 0.8.5", "serde", @@ -486,26 +542,32 @@ dependencies = [ ] [[package]] -name = "alloy-rpc-types-trace" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=17633df#17633df04920e07cd7afbd6ee825fcde677fa1d1" +name = "alloy-rpc-types-eth" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "605fa8462732bb8fd0645a9941e12961e079d45ae6a44634c826f8229c187bdf" dependencies = [ + "alloy-consensus 0.2.0", + "alloy-eips 0.2.0", "alloy-primitives", - "alloy-rpc-types 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=17633df)", - "alloy-serde 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=17633df)", + "alloy-rlp", + "alloy-serde 0.2.0", + "alloy-sol-types", + "itertools 0.13.0", "serde", "serde_json", + "thiserror", ] [[package]] name = "alloy-rpc-types-trace" -version = "0.1.2" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c7a838f9a34aae7022c6cb53ecf21bc0a5a30c82f8d9eb0afed701ab5fd88de" +checksum = "5f561a8cdd377b6ac3beab805b9df5ec2c7d99bb6139aab23c317f26df6fb346" dependencies = [ "alloy-primitives", - "alloy-rpc-types-eth", - "alloy-serde 0.1.2", + "alloy-rpc-types-eth 0.2.0", + "alloy-serde 0.2.0", "serde", "serde_json", "thiserror", @@ -514,7 +576,7 @@ dependencies = [ [[package]] name = "alloy-serde" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=17633df#17633df04920e07cd7afbd6ee825fcde677fa1d1" +source = "git+https://github.com/alloy-rs/alloy?rev=64feb9bc51c8021ea08535694c44de84222f474e#64feb9bc51c8021ea08535694c44de84222f474e" dependencies = [ "alloy-primitives", "serde", @@ -523,8 +585,9 @@ dependencies = [ [[package]] name = "alloy-serde" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=64feb9bc51c8021ea08535694c44de84222f474e#64feb9bc51c8021ea08535694c44de84222f474e" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d94da1c0c4e27cc344b05626fe22a89dc6b8b531b9475f3b7691dbf6913e4109" dependencies = [ "alloy-primitives", "serde", @@ -533,9 +596,9 @@ dependencies = [ [[package]] name = "alloy-serde" -version = "0.1.2" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d94da1c0c4e27cc344b05626fe22a89dc6b8b531b9475f3b7691dbf6913e4109" +checksum = "15c5b9057acc02aee1b8aac2b5a0729cb0f73d080082c111313e5d1f92a96630" dependencies = [ "alloy-primitives", "serde", @@ -556,16 +619,30 @@ dependencies = [ "thiserror", ] +[[package]] +name = "alloy-signer" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37f10592696f4ab8b687d5a8ab55e998a14ea0ca5f8eb20ad74a96ad671bb54a" +dependencies = [ + "alloy-primitives", + "async-trait", + "auto_impl", + "elliptic-curve 0.13.8", + "k256 0.13.3", + "thiserror", +] + [[package]] name = "alloy-signer-local" -version = "0.1.2" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d40a37dc216c269b8a7244047cb1c18a9c69f7a0332ab2c4c2aa4cbb1a31468b" +checksum = "0b537f3e55f30753578f4623d5f66ddad8fa582af3fa6b15bad23dd1b9775228" dependencies = [ - "alloy-consensus 0.1.2", - "alloy-network", + "alloy-consensus 0.2.0", + "alloy-network 0.2.0", "alloy-primitives", - "alloy-signer", + "alloy-signer 0.2.0", "async-trait", "k256 0.13.3", "rand 0.8.5", @@ -574,9 +651,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bad41a7c19498e3f6079f7744656328699f8ea3e783bdd10d85788cd439f572" +checksum = "2b40397ddcdcc266f59f959770f601ce1280e699a91fc1862f29cef91707cd09" dependencies = [ "alloy-sol-macro-expander", "alloy-sol-macro-input", @@ -588,9 +665,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro-expander" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd9899da7d011b4fe4c406a524ed3e3f963797dbc93b45479d60341d3a27b252" +checksum = "867a5469d61480fea08c7333ffeca52d5b621f5ca2e44f271b117ec1fc9a0525" dependencies = [ "alloy-sol-macro-input", "const-hex", @@ -606,9 +683,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro-input" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32d595768fdc61331a132b6f65db41afae41b9b97d36c21eb1b955c422a7e60" +checksum = "2e482dc33a32b6fadbc0f599adea520bd3aaa585c141a80b404d0a3e3fa72528" dependencies = [ "const-hex", "dunce", @@ -621,9 +698,9 @@ dependencies = [ [[package]] name = "alloy-sol-types" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a49042c6d3b66a9fe6b2b5a8bf0d39fc2ae1ee0310a2a26ffedd79fb097878dd" +checksum = "a91ca40fa20793ae9c3841b83e74569d1cc9af29a2f5237314fd3452d51e38c7" dependencies = [ "alloy-primitives", "alloy-sol-macro", @@ -636,7 +713,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "245af9541f0a0dbd5258669c80dfe3af118164cacec978a520041fc130550deb" dependencies = [ - "alloy-json-rpc", + "alloy-json-rpc 0.1.2", "base64 0.22.1", "futures-util", "futures-utils-wasm", @@ -648,14 +725,48 @@ dependencies = [ "url", ] +[[package]] +name = "alloy-transport" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b44b0f6f4a2593b258fa7b6cae8968e6a4c404d9ef4f5bc74401f2d04fa23fa" +dependencies = [ + "alloy-json-rpc 0.2.0", + "base64 0.22.1", + "futures-util", + "futures-utils-wasm", + "serde", + "serde_json", + "thiserror", + "tokio", + "tower", + "tracing", + "url", +] + [[package]] name = "alloy-transport-http" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5619c017e1fdaa1db87f9182f4f0ed97c53d674957f4902fba655e972d359c6c" dependencies = [ - "alloy-json-rpc", - "alloy-transport", + "alloy-json-rpc 0.1.2", + "alloy-transport 0.1.2", + "reqwest 0.12.5", + "serde_json", + "tower", + "tracing", + "url", +] + +[[package]] +name = "alloy-transport-http" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d8f1eefa8cb9e7550740ee330feba4fed303a77ad3085707546f9152a88c380" +dependencies = [ + "alloy-json-rpc 0.2.0", + "alloy-transport 0.2.0", "reqwest 0.12.5", "serde_json", "tower", @@ -665,12 +776,12 @@ dependencies = [ [[package]] name = "alloy-transport-ws" -version = "0.1.2" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c0aff8af5be5e58856c5cdd1e46db2c67c7ecd3a652d9100b4822c96c899947" +checksum = "15ccc1c8f8ae415e93ec0e7851bd4cdf4afdd48793d13a91b860317da1f36104" dependencies = [ "alloy-pubsub", - "alloy-transport", + "alloy-transport 0.2.0", "futures", "http 1.1.0", "rustls", @@ -683,9 +794,9 @@ dependencies = [ [[package]] name = "alloy-trie" -version = "0.3.1" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "beb28aa4ecd32fdfa1b1bdd111ff7357dd562c6b2372694cf9e613434fcba659" +checksum = "03704f265cbbb943b117ecb5055fd46e8f41e7dc8a58b1aed20bcd40ace38c15" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -978,16 +1089,6 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" -[[package]] -name = "aurora-engine-modexp" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0aef7712851e524f35fbbb74fa6599c5cd8692056a1c36f9ca0d2001b670e7e5" -dependencies = [ - "hex", - "num", -] - [[package]] name = "auto_impl" version = "1.2.0" @@ -1181,9 +1282,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" dependencies = [ "serde", ] @@ -1219,6 +1320,19 @@ dependencies = [ "generic-array", ] +[[package]] +name = "bls12_381" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7bc6d6292be3a19e6379786dac800f551e5865a5bb51ebbe3064ab80433f403" +dependencies = [ + "ff 0.13.0", + "group 0.13.0", + "pairing", + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "blst" version = "0.3.12" @@ -1235,24 +1349,24 @@ dependencies = [ name = "bolt-sidecar" version = "0.1.0" dependencies = [ - "alloy-consensus 0.1.2", - "alloy-eips 0.1.2", - "alloy-json-rpc", - "alloy-network", + "alloy-consensus 0.2.0", + "alloy-eips 0.2.0", + "alloy-json-rpc 0.2.0", + "alloy-network 0.2.0", "alloy-node-bindings", "alloy-primitives", - "alloy-provider", + "alloy-provider 0.2.0", "alloy-pubsub", "alloy-rlp", - "alloy-rpc-client", - "alloy-rpc-types 0.1.2", - "alloy-rpc-types-beacon 0.1.2", - "alloy-rpc-types-engine 0.1.2", - "alloy-rpc-types-trace 0.1.2", - "alloy-signer", + "alloy-rpc-client 0.2.0", + "alloy-rpc-types 0.2.0", + "alloy-rpc-types-beacon 0.2.0", + "alloy-rpc-types-engine 0.2.0", + "alloy-rpc-types-trace", + "alloy-signer 0.2.0", "alloy-signer-local", - "alloy-transport", - "alloy-transport-http", + "alloy-transport 0.2.0", + "alloy-transport-http 0.2.0", "alloy-transport-ws", "async-trait", "axum", @@ -1275,7 +1389,7 @@ dependencies = [ "reqwest 0.12.5", "reth-primitives", "reth-rpc-layer", - "secp256k1 0.29.0", + "secp256k1", "serde", "serde_json", "thiserror", @@ -1914,25 +2028,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "enr" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a3d8dc56e02f954cac8eb489772c552c473346fc34f67412bb6244fd647f7e4" -dependencies = [ - "base64 0.21.7", - "bytes", - "hex", - "k256 0.13.3", - "log", - "rand 0.8.5", - "rlp", - "secp256k1 0.27.0", - "serde", - "sha3", - "zeroize", -] - [[package]] name = "enumn" version = "0.1.13" @@ -2000,7 +2095,7 @@ dependencies = [ "blst", "bs58", "c-kzg", - "enr 0.6.2", + "enr", "hex", "integer-sqrt", "multiaddr", @@ -2008,7 +2103,7 @@ dependencies = [ "rand 0.8.5", "serde", "serde_json", - "serde_yaml", + "serde_yaml 0.8.26", "sha2 0.10.8", "ssz_rs", "thiserror", @@ -2152,6 +2247,7 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" dependencies = [ + "bitvec", "rand_core 0.6.4", "subtle", ] @@ -2930,7 +3026,7 @@ dependencies = [ "http 1.1.0", "http-body 1.0.0", "http-body-util", - "jsonrpsee-types 0.23.1", + "jsonrpsee-types", "serde", "serde_json", "thiserror", @@ -2951,7 +3047,7 @@ dependencies = [ "hyper-rustls", "hyper-util", "jsonrpsee-core", - "jsonrpsee-types 0.23.1", + "jsonrpsee-types", "rustls", "rustls-platform-verifier", "serde", @@ -2963,19 +3059,6 @@ dependencies = [ "url", ] -[[package]] -name = "jsonrpsee-types" -version = "0.22.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "150d6168405890a7a3231a3c74843f58b8959471f6df76078db2619ddee1d07d" -dependencies = [ - "anyhow", - "beef", - "serde", - "serde_json", - "thiserror", -] - [[package]] name = "jsonrpsee-types" version = "0.23.1" @@ -3027,7 +3110,6 @@ dependencies = [ "elliptic-curve 0.13.8", "once_cell", "sha2 0.10.8", - "signature 2.2.0", ] [[package]] @@ -3049,14 +3131,26 @@ dependencies = [ "sha3-asm", ] +[[package]] +name = "kzg-rs" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd9920cd4460ce3cbca19c62f3bb9a9611562478a4dc9d2c556f4a7d049c5b6b" +dependencies = [ + "bls12_381", + "glob", + "hex", + "once_cell", + "serde", + "serde_derive", + "serde_yaml 0.9.34+deprecated", +] + [[package]] name = "lazy_static" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" -dependencies = [ - "spin 0.9.8", -] [[package]] name = "libc" @@ -3285,20 +3379,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "num" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" -dependencies = [ - "num-bigint", - "num-complex", - "num-integer", - "num-iter", - "num-rational", - "num-traits", -] - [[package]] name = "num-bigint" version = "0.4.5" @@ -3309,15 +3389,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "num-complex" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" -dependencies = [ - "num-traits", -] - [[package]] name = "num-conv" version = "0.1.0" @@ -3333,28 +3404,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "num-iter" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" -dependencies = [ - "num-bigint", - "num-integer", - "num-traits", -] - [[package]] name = "num-traits" version = "0.2.19" @@ -3461,7 +3510,7 @@ version = "0.10.64" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "cfg-if", "foreign-types", "libc", @@ -3505,6 +3554,15 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" +[[package]] +name = "pairing" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81fec4625e73cf41ef4bb6846cafa6d44736525f442ba45e407c4a000a13996f" +dependencies = [ + "group 0.13.0", +] + [[package]] name = "parity-scale-codec" version = "3.6.12" @@ -3567,10 +3625,10 @@ source = "git+https://github.com/chainbound/partial-mpt?branch=feat/alloy#f80699 dependencies = [ "alloy-eips 0.1.2", "alloy-primitives", - "alloy-provider", + "alloy-provider 0.1.2", "alloy-rlp", "alloy-rpc-types 0.1.2", - "alloy-transport-http", + "alloy-transport-http 0.1.2", "dotenvy", "rlp", "tokio", @@ -3763,7 +3821,7 @@ checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf" dependencies = [ "bit-set", "bit-vec", - "bitflags 2.5.0", + "bitflags 2.6.0", "lazy_static", "num-traits", "rand 0.8.5", @@ -3902,7 +3960,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c82cf8cff14456045f55ec4241383baeff27af886adb72ffb2162f99911de0fd" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", ] [[package]] @@ -4021,18 +4079,24 @@ dependencies = [ [[package]] name = "reth-codecs" -version = "0.2.0-beta.5" -source = "git+https://github.com/paradigmxyz/reth?rev=71c404d#71c404d9cb7a678d4c0f6442a9c2b8449529fe2a" +version = "1.0.2" +source = "git+https://github.com/paradigmxyz/reth#f55d43c25a61654d839ea0183fa63c40f0a0b7ec" dependencies = [ + "alloy-consensus 0.2.0", + "alloy-eips 0.2.0", + "alloy-genesis 0.2.0", "alloy-primitives", + "alloy-trie", "bytes", + "modular-bitfield", "reth-codecs-derive", + "serde", ] [[package]] name = "reth-codecs-derive" -version = "0.2.0-beta.5" -source = "git+https://github.com/paradigmxyz/reth?rev=71c404d#71c404d9cb7a678d4c0f6442a9c2b8449529fe2a" +version = "1.0.2" +source = "git+https://github.com/paradigmxyz/reth#f55d43c25a61654d839ea0183fa63c40f0a0b7ec" dependencies = [ "convert_case 0.6.0", "proc-macro2", @@ -4042,62 +4106,78 @@ dependencies = [ [[package]] name = "reth-ethereum-forks" -version = "0.2.0-beta.5" -source = "git+https://github.com/paradigmxyz/reth?rev=71c404d#71c404d9cb7a678d4c0f6442a9c2b8449529fe2a" +version = "1.0.2" +source = "git+https://github.com/paradigmxyz/reth#f55d43c25a61654d839ea0183fa63c40f0a0b7ec" dependencies = [ "alloy-chains", "alloy-primitives", "alloy-rlp", + "auto_impl", "crc", + "dyn-clone", + "once_cell", + "rustc-hash", "serde", - "thiserror", + "thiserror-no-std", ] [[package]] name = "reth-primitives" -version = "0.2.0-beta.5" -source = "git+https://github.com/paradigmxyz/reth?rev=71c404d#71c404d9cb7a678d4c0f6442a9c2b8449529fe2a" +version = "1.0.2" +source = "git+https://github.com/paradigmxyz/reth#f55d43c25a61654d839ea0183fa63c40f0a0b7ec" dependencies = [ - "alloy-chains", - "alloy-eips 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=17633df)", - "alloy-genesis 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=17633df)", + "alloy-eips 0.2.0", + "alloy-genesis 0.2.0", "alloy-primitives", "alloy-rlp", - "alloy-trie", - "byteorder", + "alloy-rpc-types 0.2.0", "bytes", "c-kzg", - "cfg-if", "derive_more", - "enr 0.10.0", - "itertools 0.12.1", "modular-bitfield", - "nybbles", "once_cell", "rayon", "reth-codecs", "reth-ethereum-forks", - "reth-rpc-types", - "revm", + "reth-primitives-traits", + "reth-static-file-types", + "reth-trie-common", "revm-primitives", - "roaring", - "secp256k1 0.27.0", + "secp256k1", "serde", - "serde_json", - "serde_with", - "sha2 0.10.8", - "strum", "tempfile", - "thiserror", + "thiserror-no-std", "zstd", ] +[[package]] +name = "reth-primitives-traits" +version = "1.0.2" +source = "git+https://github.com/paradigmxyz/reth#f55d43c25a61654d839ea0183fa63c40f0a0b7ec" +dependencies = [ + "alloy-consensus 0.2.0", + "alloy-eips 0.2.0", + "alloy-genesis 0.2.0", + "alloy-primitives", + "alloy-rlp", + "alloy-rpc-types-eth 0.2.0", + "byteorder", + "bytes", + "derive_more", + "modular-bitfield", + "reth-codecs", + "revm-primitives", + "roaring", + "serde", + "thiserror-no-std", +] + [[package]] name = "reth-rpc-layer" -version = "1.0.0" -source = "git+https://github.com/paradigmxyz/reth?rev=6e146e1#6e146e1140e874b88c304fdc3c5ac0e046e66263" +version = "1.0.2" +source = "git+https://github.com/paradigmxyz/reth#f55d43c25a61654d839ea0183fa63c40f0a0b7ec" dependencies = [ - "alloy-rpc-types-engine 0.1.2", + "alloy-rpc-types-engine 0.2.0", "http 1.1.0", "jsonrpsee-http-client", "pin-project", @@ -4106,77 +4186,46 @@ dependencies = [ ] [[package]] -name = "reth-rpc-types" -version = "0.2.0-beta.5" -source = "git+https://github.com/paradigmxyz/reth?rev=71c404d#71c404d9cb7a678d4c0f6442a9c2b8449529fe2a" +name = "reth-static-file-types" +version = "1.0.2" +source = "git+https://github.com/paradigmxyz/reth#f55d43c25a61654d839ea0183fa63c40f0a0b7ec" dependencies = [ - "alloy-genesis 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=17633df)", "alloy-primitives", - "alloy-rlp", - "alloy-rpc-types 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=17633df)", - "alloy-rpc-types-engine 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=17633df)", - "alloy-rpc-types-trace 0.1.0", - "enr 0.10.0", - "jsonrpsee-types 0.22.5", - "secp256k1 0.27.0", - "serde", - "serde_json", - "serde_with", - "thiserror", - "url", -] - -[[package]] -name = "revm" -version = "8.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72a454c1c650b2b2e23f0c461af09e6c31e1d15e1cbebe905a701c46b8a50afc" -dependencies = [ - "auto_impl", - "cfg-if", - "dyn-clone", - "revm-interpreter", - "revm-precompile", + "derive_more", "serde", - "serde_json", + "strum", ] [[package]] -name = "revm-interpreter" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d322f2730cd300e99d271a1704a2dfb8973d832428f5aa282aaa40e2473b5eec" +name = "reth-trie-common" +version = "1.0.2" +source = "git+https://github.com/paradigmxyz/reth#f55d43c25a61654d839ea0183fa63c40f0a0b7ec" dependencies = [ + "alloy-consensus 0.2.0", + "alloy-genesis 0.2.0", + "alloy-primitives", + "alloy-rlp", + "alloy-trie", + "bytes", + "derive_more", + "itertools 0.13.0", + "nybbles", + "reth-codecs", + "reth-primitives-traits", "revm-primitives", "serde", ] -[[package]] -name = "revm-precompile" -version = "6.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "931f692f3f4fc72ec39d5d270f8e9d208c4a6008de7590ee96cf948e3b6d3f8d" -dependencies = [ - "aurora-engine-modexp", - "c-kzg", - "k256 0.13.3", - "once_cell", - "revm-primitives", - "ripemd", - "secp256k1 0.28.2", - "sha2 0.10.8", - "substrate-bn", -] - [[package]] name = "revm-primitives" -version = "3.1.1" +version = "7.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbbc9640790cebcb731289afb7a7d96d16ad94afeb64b5d0b66443bd151e79d6" +checksum = "2fc4311037ee093ec50ec734e1424fcb3e12d535c6cef683b75d1c064639630c" dependencies = [ + "alloy-eips 0.2.0", "alloy-primitives", "auto_impl", - "bitflags 2.5.0", + "bitflags 2.6.0", "bitvec", "c-kzg", "cfg-if", @@ -4185,6 +4234,7 @@ dependencies = [ "enumn", "hashbrown 0.14.5", "hex", + "kzg-rs", "once_cell", "serde", ] @@ -4240,15 +4290,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "ripemd" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" -dependencies = [ - "digest 0.10.7", -] - [[package]] name = "rlp" version = "0.5.2" @@ -4318,6 +4359,12 @@ version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" +[[package]] +name = "rustc-hash" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" + [[package]] name = "rustc-hex" version = "2.1.0" @@ -4348,7 +4395,7 @@ version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "errno", "libc", "linux-raw-sys", @@ -4552,25 +4599,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "secp256k1" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25996b82292a7a57ed3508f052cfff8640d38d32018784acd714758b43da9c8f" -dependencies = [ - "secp256k1-sys 0.8.1", -] - -[[package]] -name = "secp256k1" -version = "0.28.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d24b59d129cdadea20aea4fb2352fa053712e5d713eee47d700cd4b2bc002f10" -dependencies = [ - "rand 0.8.5", - "secp256k1-sys 0.9.2", -] - [[package]] name = "secp256k1" version = "0.29.0" @@ -4578,25 +4606,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e0cc0f1cf93f4969faf3ea1c7d8a9faed25918d96affa959720823dfe86d4f3" dependencies = [ "rand 0.8.5", - "secp256k1-sys 0.10.0", -] - -[[package]] -name = "secp256k1-sys" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70a129b9e9efbfb223753b9163c4ab3b13cff7fd9c7f010fbac25ab4099fa07e" -dependencies = [ - "cc", -] - -[[package]] -name = "secp256k1-sys" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d1746aae42c19d583c3c1a8c646bfad910498e2051c551a7f2e3c0c9fbb7eb" -dependencies = [ - "cc", + "secp256k1-sys", ] [[package]] @@ -4614,7 +4624,7 @@ version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "core-foundation", "core-foundation-sys", "libc", @@ -4688,7 +4698,6 @@ version = "1.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" dependencies = [ - "indexmap 2.2.6", "itoa", "ryu", "serde", @@ -4778,6 +4787,19 @@ dependencies = [ "yaml-rust", ] +[[package]] +name = "serde_yaml" +version = "0.9.34+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" +dependencies = [ + "indexmap 2.2.6", + "itoa", + "ryu", + "serde", + "unsafe-libyaml", +] + [[package]] name = "sha1" version = "0.10.6" @@ -5005,19 +5027,6 @@ dependencies = [ "syn 2.0.67", ] -[[package]] -name = "substrate-bn" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b5bbfa79abbae15dd642ea8176a21a635ff3c00059961d1ea27ad04e5b441c" -dependencies = [ - "byteorder", - "crunchy", - "lazy_static", - "rand 0.8.5", - "rustc-hex", -] - [[package]] name = "subtle" version = "2.6.0" @@ -5048,9 +5057,9 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d71e19bca02c807c9faa67b5a47673ff231b6e7449b251695188522f1dc44b2" +checksum = "c837dc8852cb7074e46b444afb81783140dab12c58867b49fb3898fbafedf7ea" dependencies = [ "paste", "proc-macro2", @@ -5141,6 +5150,26 @@ dependencies = [ "syn 2.0.67", ] +[[package]] +name = "thiserror-impl-no-std" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58e6318948b519ba6dc2b442a6d0b904ebfb8d411a3ad3e07843615a72249758" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "thiserror-no-std" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3ad459d94dd517257cc96add8a43190ee620011bb6e6cdc82dafd97dfafafea" +dependencies = [ + "thiserror-impl-no-std", +] + [[package]] name = "thread_local" version = "1.1.8" @@ -5598,6 +5627,12 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" +[[package]] +name = "unsafe-libyaml" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" + [[package]] name = "unsigned-varint" version = "0.7.2" diff --git a/bolt-sidecar/Cargo.toml b/bolt-sidecar/Cargo.toml index c59fd0086..0d307d6a8 100644 --- a/bolt-sidecar/Cargo.toml +++ b/bolt-sidecar/Cargo.toml @@ -19,32 +19,32 @@ tree_hash_derive = "0.5" secp256k1 = { version = "0.29.0", features = ["rand"] } # alloy -alloy-rpc-client = { version = "0.1.2", features = ["reqwest", "ws", "pubsub"] } -alloy-consensus = { version = "0.1.2", features = ["k256"] } -alloy-provider = { version = "0.1.2", features = ["ws"] } -alloy-signer = { version = "0.1.2" } -alloy-signer-local = { version = "0.1.2" } -alloy-transport = { version = "0.1.2" } -alloy-eips = { version = "0.1.2" } -alloy-transport-http = { version = "0.1.2" } -alloy-transport-ws = { version = "0.1.2" } -alloy-pubsub = { version = "0.1.2" } -alloy-rpc-types = { version = "0.1.2" } -alloy-rpc-types-engine = { version = "0.1.2" } -alloy-rpc-types-beacon = { version = "0.1.2" } -alloy-rpc-types-trace = { version = "0.1.2" } -alloy-json-rpc = { version = "0.1.2" } -alloy-network = { version = "0.1.2" } -alloy-primitives = { version = "0.7.1" } -alloy-rlp = { version = "0.3" } +alloy-rpc-client = { version = "0.2.0", features = ["reqwest", "ws", "pubsub"] } +alloy-consensus = { version = "0.2.0", features = ["k256"] } +alloy-provider = { version = "0.2.0", features = ["ws"] } +alloy-signer = { version = "0.2.0" } +alloy-signer-local = { version = "0.2.0" } +alloy-transport = { version = "0.2.0" } +alloy-eips = { version = "0.2.0" } +alloy-transport-http = { version = "0.2.0" } +alloy-transport-ws = { version = "0.2.0" } +alloy-pubsub = { version = "0.2.0" } +alloy-rpc-types = { version = "0.2.0" } +alloy-rpc-types-engine = { version = "0.2.0" } +alloy-rpc-types-beacon = { version = "0.2.0" } +alloy-rpc-types-trace = { version = "0.2.0" } +alloy-json-rpc = { version = "0.2.0" } +alloy-network = { version = "0.2.0" } +alloy-primitives = { version = "0.7.7" } +alloy-rlp = { version = "0.3.7" } # alloy-rpc-types = { git = "https://github.com/chainbound/alloy", branch = "fix/account-override-serialize" } # reth -reth-primitives = { git = "https://github.com/paradigmxyz/reth", rev = "71c404d" } -reth-rpc-layer = { git = "https://github.com/paradigmxyz/reth", rev = "6e146e1" } +reth-primitives = { git = "https://github.com/paradigmxyz/reth", version = "1.0.2" } +reth-rpc-layer = { git = "https://github.com/paradigmxyz/reth", version = "1.0.2" } # reth-provider = { git = "https://github.com/paradigmxyz/reth", rev = "71c404d" } reqwest = "0.12" @@ -77,7 +77,7 @@ cb-crypto = { git = "https://github.com/Commit-Boost/commit-boost-client" } cb-common = { git = "https://github.com/Commit-Boost/commit-boost-client" } [dev-dependencies] -alloy-node-bindings = "0.1.1" +alloy-node-bindings = "0.2.0" [[bin]] diff --git a/bolt-sidecar/src/builder/call_trace_manager.rs b/bolt-sidecar/src/builder/call_trace_manager.rs deleted file mode 100644 index 5a8ba3125..000000000 --- a/bolt-sidecar/src/builder/call_trace_manager.rs +++ /dev/null @@ -1,308 +0,0 @@ -//! Module that defines the [CallTraceManager] actor, which is responsible for -//! handling trace requests for transactions and accumulating the state diffs -//! for each block that is traced. - -use std::{ - collections::{HashMap, VecDeque}, - pin::Pin, - task::{Context, Poll}, -}; - -use alloy_primitives::{BlockNumber, U64}; -use alloy_rpc_types::{ - state::{AccountOverride, StateOverride}, - TransactionRequest, -}; -use alloy_rpc_types_trace::geth::{ - AccountState, GethDebugBuiltInTracerType, GethDebugTracerType, GethDebugTracingCallOptions, - GethDebugTracingOptions, GethDefaultTracingOptions, GethTrace, PreStateFrame, -}; -use alloy_transport::TransportResult; -use futures::{stream::FuturesOrdered, Future, StreamExt}; -use reqwest::Url; -use tokio::{ - sync::{mpsc, oneshot}, - task::JoinHandle, -}; - -use crate::RpcClient; - -/// Commands to interact with the [CallTraceManager] actor -#[derive(Debug)] -pub enum TraceCommand { - /// Request to trace a transaction's execution on a remote RPC, - /// considering the given block as starting point and accumulating - /// the results on a state diff map. - AddTrace { - /// The transaction to trace - transaction: TransactionRequest, - /// The block in which the transaction should be simulated on - block: BlockNumber, - }, - /// Request to get the accumulated state diffs for a bundle of transactions - /// that were previously simulated on the given block. - /// - /// The result is sent back through a response channel as soon as the last - /// pending trace request for that block has been processed. - FetchAccumulatedDiffs { - /// The block of the accumulated diffs to fetch - block: BlockNumber, - /// The oneshot channel to receive the accumulated diffs - res: oneshot::Sender>, - }, -} - -/// The handle to control the [CallTraceManager] actor in a -/// thread-safe, non-blocking way. -#[derive(Debug, Clone)] -pub struct CallTraceHandle { - cmd_tx: mpsc::Sender, -} - -impl CallTraceHandle { - /// Request the trace for the given transaction on the provided block - pub async fn add_trace(&self, transaction: TransactionRequest, block: BlockNumber) { - let _ = self - .cmd_tx - .send(TraceCommand::AddTrace { transaction, block }) - .await; - } - - /// Request the accumulated state diffs for a given block from previously - /// traced transactions. - /// - /// If the diffs are not available yet, this function - /// will hang until the last transaction has been processed and the diffs are ready. - pub async fn fetch_accumulated_diffs(&self, block: BlockNumber) -> Option { - let (res_tx, res_rx) = oneshot::channel(); - let _ = self - .cmd_tx - .send(TraceCommand::FetchAccumulatedDiffs { block, res: res_tx }) - .await; - - res_rx.await.unwrap() - } -} - -/// The [CallTraceManager] actor is responsible for handling trace requests for transactions -/// and accumulating the state diffs for each block that is traced. It listens for incoming -/// trace requests and processes them in the background using the given RPC client. -/// -/// The actor is implemented as a future that can be polled in the background. -#[derive(Debug)] -#[must_use = "CallTraceManager does nothing unless polled"] -pub struct CallTraceManager { - rpc: RpcClient, - cmd_rx: mpsc::Receiver, - pending_traces: FuturesOrdered, - trace_request_queue: HashMap>, - response_queue: HashMap>>, - accumulated_state_diffs: HashMap, -} - -type TraceFuture = JoinHandle<(BlockNumber, TransportResult)>; - -impl Future for CallTraceManager { - type Output = (); - - fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { - let this = self.get_mut(); - - loop { - match this.cmd_rx.poll_recv(cx) { - Poll::Ready(Some(cmd)) => this.handle_new_trace_command(cmd), - Poll::Ready(None) => return Poll::Ready(()), - Poll::Pending => return Poll::Pending, - } - - match this.pending_traces.poll_next_unpin(cx) { - Poll::Ready(Some(Ok((block, trace_result)))) => { - this.handle_trace_result(block, trace_result) - } - Poll::Ready(Some(Err(e))) => { - tracing::error!(err = ?e, "Error while tracing transaction"); - } - Poll::Ready(None) => return Poll::Ready(()), - Poll::Pending => return Poll::Pending, - } - } - } -} - -impl CallTraceManager { - /// Creates a new [CallTraceManager] instance, which will listen for incoming - /// trace requests and process them in the background using the given RPC client. - pub fn new>(url: U) -> (Self, CallTraceHandle) { - let rpc = RpcClient::new(url); - let (cmd_tx, cmd_rx) = mpsc::channel(512); - - ( - Self { - rpc, - cmd_rx, - trace_request_queue: Default::default(), - pending_traces: Default::default(), - response_queue: Default::default(), - accumulated_state_diffs: Default::default(), - }, - CallTraceHandle { cmd_tx }, - ) - } - - fn handle_new_trace_command(&mut self, cmd: TraceCommand) { - match cmd { - TraceCommand::AddTrace { transaction, block } => { - tracing::debug!(block = block, "Received new transaction trace request"); - - // TODO: handle the case where the block is in the future. - // Requires a execution block interval ticker. - - // Try to start the trace call in the background if - // there is no pending task - if self.pending_traces.is_empty() { - self.start_new_trace_call_with_overrides(transaction, block); - } else { - // Otherwise, add the transaction to the queue to be processed - // in order for the given block - self.trace_request_queue - .entry(block) - .or_default() - .push_back(transaction); - } - } - TraceCommand::FetchAccumulatedDiffs { block, res } => { - tracing::debug!(block = block, "Fetching accumulated state diffs"); - - if self.pending_traces.is_empty() { - // If there are no pending traces for the given block, and the - // accumulated state diffs are already available, send the result - if let Some(diffs) = self.accumulated_state_diffs.remove(&block) { - let _ = res.send(Some(diffs)); - } else { - let _ = res.send(None); - } - } else { - // Otherwise, store the response channel to be used later once the last - // pending trace request for that block has been processed and the diffs - // are available. - self.response_queue.insert(block, res); - } - } - } - } - - fn handle_trace_result(&mut self, block: BlockNumber, result: TransportResult) { - match result { - Ok(trace) => { - tracing::debug!(block = block, "RPC trace call completed"); - - let Ok(PreStateFrame::Default(trace_state)) = trace.try_into_pre_state_frame() - else { - tracing::error!("Failed to extract pre-state frame from trace result"); - return; - }; - - // Store the updated accumulated state diffs for the given block - let acc_state_diffs = self.accumulated_state_diffs.entry(block).or_default(); - for (address, account_state) in trace_state.0 { - let account_override = acc_state_diffs.entry(address).or_default(); - merge_account_state_in_overrides(account_override, account_state); - } - - // If there are more pending trace requests for the same block, process the next one - if let Some(transactions) = self.trace_request_queue.get_mut(&block) { - if let Some(transaction) = transactions.pop_front() { - self.start_new_trace_call_with_overrides(transaction, block); - return; - } - } - - // If there are no more transactions to process for this block, - // send the accumulated state diffs to the response channel if there is - // one waiting for it - if let Some(res) = self.response_queue.remove(&block) { - let _ = res.send(Some(acc_state_diffs.clone())); - self.accumulated_state_diffs.remove(&block); - } - } - Err(err) => { - tracing::error!(err = ?err, "RPC error while tracing transaction"); - - // For now, just log the error and continue processing the next trace request - // for the same block, if there is one. - if let Some(transactions) = self.trace_request_queue.get_mut(&block) { - if let Some(transaction) = transactions.pop_front() { - self.start_new_trace_call_with_overrides(transaction, block); - } - } - - if let Some(res) = self.response_queue.remove(&block) { - let _ = res.send(None); - self.accumulated_state_diffs.remove(&block); - } - } - } - } - - fn start_new_trace_call_with_overrides( - &mut self, - transaction: TransactionRequest, - block: BlockNumber, - ) { - let rpc = self.rpc.clone(); - let state_override = self - .accumulated_state_diffs - .get(&block) - .cloned() - .unwrap_or_default(); - - let mut tracing_options = get_trace_options_with_override(state_override); - tracing_options.tracing_options.tracer = Some(GethDebugTracerType::JsTracer(format!( - r#"{{ - data: [], - result: function(ctx, db) {{ - var root = db.GetStorageRoot("{:x}"); - return root; - }}, - }}"#, - transaction.from.unwrap_or_default() - ))); - - self.pending_traces.push_back(tokio::spawn(async move { - ( - block, - rpc.debug_trace_call(transaction, Some(block), Some(tracing_options)) - .await, - ) - })); - } -} - -fn get_trace_options_with_override(state_override: StateOverride) -> GethDebugTracingCallOptions { - let mut opts = GethDebugTracingOptions::default().with_tracer( - GethDebugTracerType::BuiltInTracer(GethDebugBuiltInTracerType::PreStateTracer), - ); - - opts.config = GethDefaultTracingOptions::default() - .with_disable_storage(false) - .with_disable_memory(true) - .with_disable_return_data(true) - .with_disable_stack(true); - - GethDebugTracingCallOptions::default() - .with_tracing_options(opts) - .with_state_overrides(state_override) -} - -fn merge_account_state_in_overrides(account_override: &mut AccountOverride, value: AccountState) { - account_override.balance = value.balance; - account_override.nonce = value.nonce.map(U64::from); - account_override.code = value.code; - for (key, value) in value.storage { - if let Some(ref mut state) = account_override.state_diff { - state.insert(key, value); - } else { - account_override.state_diff = Some(HashMap::from_iter(vec![(key, value)])); - } - } -} diff --git a/bolt-sidecar/src/builder/mod.rs b/bolt-sidecar/src/builder/mod.rs index c49a69dfb..53a08d5a2 100644 --- a/bolt-sidecar/src/builder/mod.rs +++ b/bolt-sidecar/src/builder/mod.rs @@ -32,13 +32,6 @@ mod compat; /// `engine_newPayloadV3` response error to produce a valid payload. pub mod payload_builder; -/// Deprecated. TODO: remove -pub mod state_root; - -/// Deprecated simulation manager. TODO: remove -pub mod call_trace_manager; -pub use call_trace_manager::{CallTraceHandle, CallTraceManager}; - #[derive(Debug, thiserror::Error)] #[non_exhaustive] #[allow(missing_docs)] diff --git a/bolt-sidecar/src/builder/payload_builder.rs b/bolt-sidecar/src/builder/payload_builder.rs index c5f9e4279..1178ecab0 100644 --- a/bolt-sidecar/src/builder/payload_builder.rs +++ b/bolt-sidecar/src/builder/payload_builder.rs @@ -189,6 +189,7 @@ impl FallbackPayloadBuilder { ommers: Vec::new(), transactions: transactions.to_vec(), withdrawals: Some(Withdrawals::new(withdrawals)), + requests: None, }; let mut hints = Hints::default(); @@ -382,6 +383,7 @@ pub(crate) fn build_header_with_hints_and_context( blob_gas_used: Some(blob_gas_used), excess_blob_gas: Some(context.excess_blob_gas), parent_beacon_block_root: Some(context.parent_beacon_block_root), + requests_root: None, extra_data: context.extra_data.clone(), } } diff --git a/bolt-sidecar/src/builder/state_root.rs b/bolt-sidecar/src/builder/state_root.rs deleted file mode 100644 index d2d1b23e5..000000000 --- a/bolt-sidecar/src/builder/state_root.rs +++ /dev/null @@ -1,120 +0,0 @@ -//! State root builder, responsible for constructing a new block's state_root -//! from a series of transaction traces and storage proofs. - -#[cfg(test)] -mod tests { - - use std::collections::HashSet; - - use alloy_primitives::{keccak256, B256, U256}; - use partial_mpt::StateTrie; - use reqwest::Url; - - use crate::{ - builder::CallTraceManager, client::rpc::RpcClient, test_util::try_get_execution_api_url, - }; - - #[ignore] - #[tokio::test] - async fn test_trace_call() -> eyre::Result<()> { - dotenvy::dotenv().ok(); - let _ = tracing_subscriber::fmt::try_init(); - - let Some(rpc_url) = try_get_execution_api_url().await else { - tracing::warn!("EL_RPC not reachable, skipping test"); - return Ok(()); - }; - - tracing::info!("Starting test_trace_call"); - - let rpc_url = Url::parse(rpc_url).unwrap(); - let client = RpcClient::new(rpc_url.clone()); - - let (call_trace_manager, call_trace_handler) = CallTraceManager::new(rpc_url); - tokio::spawn(call_trace_manager); - - // https://etherscan.io/block/20125606 - let block_number = 20125606; - - let latest_block = client.get_block(Some(block_number), true).await?; - let latest_state_root = B256::from(latest_block.header.state_root.0); - - let mut state_trie = StateTrie::from_root(latest_state_root); - - let tx_requests = latest_block - .transactions - .as_transactions() - .unwrap() - .iter() - .map(|tx| tx.clone().into_request()) - .collect::>(); - - for tx in tx_requests.iter() { - call_trace_handler.add_trace(tx.clone(), block_number).await; - } - - let diffs = call_trace_handler - .fetch_accumulated_diffs(block_number) - .await - .unwrap(); - - println!("Touched accounts: {:?}", diffs.keys().len()); - - // load the touched account proofs in the trie - let start = std::time::Instant::now(); - for account in diffs.keys().collect::>().clone() { - let proof = client - .get_proof(*account, vec![], Some(block_number)) - .await?; - state_trie.load_proof(proof).unwrap(); - } - - println!( - "Loaded proofs for {} accounts in {:?}", - diffs.keys().collect::>().len(), - start.elapsed() - ); - - // now apply state diffs to the trie - for (address, diff) in diffs.iter() { - if let Some(balance) = diff.balance { - state_trie - .account_trie - .set_balance(*address, balance) - .unwrap(); - } - if let Some(nonce) = diff.nonce { - state_trie - .account_trie - .set_nonce(*address, U256::from(nonce)) - .unwrap(); - } - if let Some(code) = diff.code.clone() { - state_trie - .account_trie - .set_code_hash(*address, keccak256(code)) - .unwrap(); - } - if let Some(ref state_diff) = diff.state_diff { - for (key, value) in state_diff.iter() { - state_trie - .set_storage_value( - *address, - U256::from_be_bytes(key.0), - U256::from_be_bytes(value.0), - ) - .unwrap(); - } - } - } - - // now we can get the new state root - let new_state_root = state_trie.root().unwrap(); - println!("New state root: {:x}", new_state_root); - - let next_block = client.get_block(Some(block_number + 1), false).await?; - assert_eq!(next_block.header.state_root, new_state_root); - - Ok(()) - } -} diff --git a/bolt-sidecar/src/primitives/mod.rs b/bolt-sidecar/src/primitives/mod.rs index 920856011..3da7be625 100644 --- a/bolt-sidecar/src/primitives/mod.rs +++ b/bolt-sidecar/src/primitives/mod.rs @@ -17,9 +17,7 @@ use ethereum_consensus::{ types::mainnet::ExecutionPayload, Fork, }; -use reth_primitives::{ - BlobTransactionSidecar, Bytes, PooledTransactionsElement, TransactionKind, TxType, -}; +use reth_primitives::{BlobTransactionSidecar, Bytes, PooledTransactionsElement, TxKind, TxType}; use tokio::sync::{mpsc, oneshot}; /// Commitment types, received by users wishing to receive preconfirmations. @@ -232,7 +230,7 @@ pub trait TransactionExt { fn gas_limit(&self) -> u64; fn value(&self) -> U256; fn tx_type(&self) -> TxType; - fn tx_kind(&self) -> TransactionKind; + fn tx_kind(&self) -> TxKind; fn input(&self) -> &Bytes; fn chain_id(&self) -> Option; fn blob_sidecar(&self) -> Option<&BlobTransactionSidecar>; @@ -246,6 +244,7 @@ impl TransactionExt for PooledTransactionsElement { PooledTransactionsElement::Eip2930 { transaction, .. } => transaction.gas_limit, PooledTransactionsElement::Eip1559 { transaction, .. } => transaction.gas_limit, PooledTransactionsElement::BlobTransaction(blob_tx) => blob_tx.transaction.gas_limit, + _ => unimplemented!(), } } @@ -255,6 +254,7 @@ impl TransactionExt for PooledTransactionsElement { PooledTransactionsElement::Eip2930 { transaction, .. } => transaction.value, PooledTransactionsElement::Eip1559 { transaction, .. } => transaction.value, PooledTransactionsElement::BlobTransaction(blob_tx) => blob_tx.transaction.value, + _ => unimplemented!(), } } @@ -264,15 +264,19 @@ impl TransactionExt for PooledTransactionsElement { PooledTransactionsElement::Eip2930 { .. } => TxType::Eip2930, PooledTransactionsElement::Eip1559 { .. } => TxType::Eip1559, PooledTransactionsElement::BlobTransaction(_) => TxType::Eip4844, + _ => unimplemented!(), } } - fn tx_kind(&self) -> TransactionKind { + fn tx_kind(&self) -> TxKind { match self { PooledTransactionsElement::Legacy { transaction, .. } => transaction.to, PooledTransactionsElement::Eip2930 { transaction, .. } => transaction.to, PooledTransactionsElement::Eip1559 { transaction, .. } => transaction.to, - PooledTransactionsElement::BlobTransaction(blob_tx) => blob_tx.transaction.to, + PooledTransactionsElement::BlobTransaction(blob_tx) => { + TxKind::Call(blob_tx.transaction.to) + } + _ => unimplemented!(), } } @@ -282,6 +286,7 @@ impl TransactionExt for PooledTransactionsElement { PooledTransactionsElement::Eip2930 { transaction, .. } => &transaction.input, PooledTransactionsElement::Eip1559 { transaction, .. } => &transaction.input, PooledTransactionsElement::BlobTransaction(blob_tx) => &blob_tx.transaction.input, + _ => unimplemented!(), } } @@ -293,6 +298,7 @@ impl TransactionExt for PooledTransactionsElement { PooledTransactionsElement::BlobTransaction(blob_tx) => { Some(blob_tx.transaction.chain_id) } + _ => unimplemented!(), } } @@ -309,6 +315,7 @@ impl TransactionExt for PooledTransactionsElement { PooledTransactionsElement::Eip2930 { transaction, .. } => transaction.size(), PooledTransactionsElement::Eip1559 { transaction, .. } => transaction.size(), PooledTransactionsElement::BlobTransaction(blob_tx) => blob_tx.transaction.size(), + _ => unimplemented!(), } } } From eb569bbd9ac270edde53df4c08844f71ff1c5d91 Mon Sep 17 00:00:00 2001 From: Naman Garg <0708ng@gmail.com> Date: Thu, 18 Jul 2024 19:38:11 +0530 Subject: [PATCH 2/6] feat(sidecar): use alloy as single dependency --- bolt-sidecar/Cargo.lock | 179 ++++++++++++++++++-- bolt-sidecar/Cargo.toml | 20 +-- bolt-sidecar/bin/sidecar.rs | 2 +- bolt-sidecar/src/builder/compat.rs | 12 +- bolt-sidecar/src/builder/mod.rs | 4 +- bolt-sidecar/src/builder/payload_builder.rs | 21 ++- bolt-sidecar/src/builder/signature.rs | 2 +- bolt-sidecar/src/builder/template.rs | 2 +- bolt-sidecar/src/client/commit_boost.rs | 2 +- bolt-sidecar/src/client/pubsub.rs | 16 +- bolt-sidecar/src/client/rpc.rs | 37 ++-- bolt-sidecar/src/common.rs | 2 +- bolt-sidecar/src/config/chain.rs | 2 +- bolt-sidecar/src/config/mod.rs | 2 +- bolt-sidecar/src/crypto/bls.rs | 2 +- bolt-sidecar/src/json_rpc/api.rs | 4 +- bolt-sidecar/src/primitives/commitment.rs | 2 +- bolt-sidecar/src/primitives/constraint.rs | 2 +- bolt-sidecar/src/primitives/mod.rs | 2 +- bolt-sidecar/src/state/execution.rs | 22 ++- bolt-sidecar/src/state/fetcher.rs | 8 +- bolt-sidecar/src/state/head_tracker.rs | 2 +- bolt-sidecar/src/test_util.rs | 20 ++- 23 files changed, 258 insertions(+), 109 deletions(-) diff --git a/bolt-sidecar/Cargo.lock b/bolt-sidecar/Cargo.lock index e51cf22bf..e63b6f79b 100644 --- a/bolt-sidecar/Cargo.lock +++ b/bolt-sidecar/Cargo.lock @@ -44,6 +44,31 @@ version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" +[[package]] +name = "alloy" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45855eb65e9cc70294ebea1279f6d8ee0636bf2ed3897683ebbae2739975ae8c" +dependencies = [ + "alloy-consensus 0.2.0", + "alloy-contract", + "alloy-core", + "alloy-eips 0.2.0", + "alloy-genesis 0.2.0", + "alloy-network 0.2.0", + "alloy-provider 0.2.0", + "alloy-pubsub", + "alloy-rpc-client 0.2.0", + "alloy-rpc-types 0.2.0", + "alloy-serde 0.2.0", + "alloy-signer 0.2.0", + "alloy-signer-local", + "alloy-transport 0.2.0", + "alloy-transport-http 0.2.0", + "alloy-transport-ipc", + "alloy-transport-ws", +] + [[package]] name = "alloy-chains" version = "0.1.22" @@ -96,6 +121,55 @@ dependencies = [ "serde", ] +[[package]] +name = "alloy-contract" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa5d42d9f87896536234b0fac1a84ad9d9dc7a4b27839cac35d0899e64ddf083" +dependencies = [ + "alloy-dyn-abi", + "alloy-json-abi", + "alloy-network 0.2.0", + "alloy-primitives", + "alloy-provider 0.2.0", + "alloy-pubsub", + "alloy-rpc-types-eth 0.2.0", + "alloy-sol-types", + "alloy-transport 0.2.0", + "futures", + "futures-util", + "thiserror", +] + +[[package]] +name = "alloy-core" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "529fc6310dc1126c8de51c376cbc59c79c7f662bd742be7dc67055d5421a81b4" +dependencies = [ + "alloy-dyn-abi", + "alloy-json-abi", + "alloy-primitives", + "alloy-sol-types", +] + +[[package]] +name = "alloy-dyn-abi" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413902aa18a97569e60f679c23f46a18db1656d87ab4d4e49d0e1e52042f66df" +dependencies = [ + "alloy-json-abi", + "alloy-primitives", + "alloy-sol-type-parser", + "alloy-sol-types", + "const-hex", + "itoa", + "serde", + "serde_json", + "winnow 0.6.13", +] + [[package]] name = "alloy-eips" version = "0.1.0" @@ -164,6 +238,18 @@ dependencies = [ "serde", ] +[[package]] +name = "alloy-json-abi" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc05b04ac331a9f07e3a4036ef7926e49a8bf84a99a1ccfc7e2ab55a5fcbb372" +dependencies = [ + "alloy-primitives", + "alloy-sol-type-parser", + "serde", + "serde_json", +] + [[package]] name = "alloy-json-rpc" version = "0.1.2" @@ -316,9 +402,12 @@ dependencies = [ "alloy-primitives", "alloy-pubsub", "alloy-rpc-client 0.2.0", + "alloy-rpc-types-engine 0.2.0", "alloy-rpc-types-eth 0.2.0", + "alloy-rpc-types-trace", "alloy-transport 0.2.0", "alloy-transport-http 0.2.0", + "alloy-transport-ipc", "alloy-transport-ws", "async-stream", "async-trait", @@ -409,6 +498,7 @@ dependencies = [ "alloy-pubsub", "alloy-transport 0.2.0", "alloy-transport-http 0.2.0", + "alloy-transport-ipc", "alloy-transport-ws", "futures", "pin-project", @@ -456,7 +546,10 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7e5d76f1e8b22f48b7b8f985782b68e7eb3938780e50e8b646a53e41a598cdf5" dependencies = [ + "alloy-rpc-types-beacon 0.2.0", + "alloy-rpc-types-engine 0.2.0", "alloy-rpc-types-eth 0.2.0", + "alloy-rpc-types-trace", "alloy-serde 0.2.0", "serde", ] @@ -669,6 +762,7 @@ version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "867a5469d61480fea08c7333ffeca52d5b621f5ca2e44f271b117ec1fc9a0525" dependencies = [ + "alloy-json-abi", "alloy-sol-macro-input", "const-hex", "heck 0.5.0", @@ -687,24 +781,38 @@ version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e482dc33a32b6fadbc0f599adea520bd3aaa585c141a80b404d0a3e3fa72528" dependencies = [ + "alloy-json-abi", "const-hex", "dunce", "heck 0.5.0", "proc-macro2", "quote", + "serde_json", "syn 2.0.67", "syn-solidity", ] +[[package]] +name = "alloy-sol-type-parser" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbcba3ca07cf7975f15d871b721fb18031eec8bce51103907f6dcce00b255d98" +dependencies = [ + "serde", + "winnow 0.6.13", +] + [[package]] name = "alloy-sol-types" version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a91ca40fa20793ae9c3841b83e74569d1cc9af29a2f5237314fd3452d51e38c7" dependencies = [ + "alloy-json-abi", "alloy-primitives", "alloy-sol-macro", "const-hex", + "serde", ] [[package]] @@ -774,6 +882,25 @@ dependencies = [ "url", ] +[[package]] +name = "alloy-transport-ipc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31007c56dc65bd81392112dda4a14c20ac7e30bb4cb2e9176192e8d9fab1983f" +dependencies = [ + "alloy-json-rpc 0.2.0", + "alloy-pubsub", + "alloy-transport 0.2.0", + "bytes", + "futures", + "interprocess", + "pin-project", + "serde_json", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "alloy-transport-ws" version = "0.2.0" @@ -1349,25 +1476,8 @@ dependencies = [ name = "bolt-sidecar" version = "0.1.0" dependencies = [ - "alloy-consensus 0.2.0", - "alloy-eips 0.2.0", - "alloy-json-rpc 0.2.0", - "alloy-network 0.2.0", + "alloy", "alloy-node-bindings", - "alloy-primitives", - "alloy-provider 0.2.0", - "alloy-pubsub", - "alloy-rlp", - "alloy-rpc-client 0.2.0", - "alloy-rpc-types 0.2.0", - "alloy-rpc-types-beacon 0.2.0", - "alloy-rpc-types-engine 0.2.0", - "alloy-rpc-types-trace", - "alloy-signer 0.2.0", - "alloy-signer-local", - "alloy-transport 0.2.0", - "alloy-transport-http 0.2.0", - "alloy-transport-ws", "async-trait", "axum", "beacon-api-client", @@ -1911,6 +2021,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "doctest-file" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aac81fa3e28d21450aa4d2ac065992ba96a1d7303efbce51a95f4fd175b67562" + [[package]] name = "dotenvy" version = "0.15.7" @@ -2929,6 +3045,21 @@ dependencies = [ "num-traits", ] +[[package]] +name = "interprocess" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67bafc2f5dbdad79a6d925649758d5472647b416028099f0b829d1b67fdd47d3" +dependencies = [ + "doctest-file", + "futures-core", + "libc", + "recvmsg", + "tokio", + "widestring", + "windows-sys 0.52.0", +] + [[package]] name = "ipnet" version = "2.9.0" @@ -3954,6 +4085,12 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "recvmsg" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3edd4d5d42c92f0a659926464d4cce56b562761267ecf0f469d85b7de384175" + [[package]] name = "redox_syscall" version = "0.5.2" @@ -5877,6 +6014,12 @@ dependencies = [ "rustls-pki-types", ] +[[package]] +name = "widestring" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7219d36b6eac893fa81e84ebe06485e7dcbb616177469b142df14f1f4deb1311" + [[package]] name = "winapi" version = "0.3.9" diff --git a/bolt-sidecar/Cargo.toml b/bolt-sidecar/Cargo.toml index 0d307d6a8..81ccf6635 100644 --- a/bolt-sidecar/Cargo.toml +++ b/bolt-sidecar/Cargo.toml @@ -19,25 +19,7 @@ tree_hash_derive = "0.5" secp256k1 = { version = "0.29.0", features = ["rand"] } # alloy -alloy-rpc-client = { version = "0.2.0", features = ["reqwest", "ws", "pubsub"] } -alloy-consensus = { version = "0.2.0", features = ["k256"] } -alloy-provider = { version = "0.2.0", features = ["ws"] } -alloy-signer = { version = "0.2.0" } -alloy-signer-local = { version = "0.2.0" } -alloy-transport = { version = "0.2.0" } -alloy-eips = { version = "0.2.0" } -alloy-transport-http = { version = "0.2.0" } -alloy-transport-ws = { version = "0.2.0" } -alloy-pubsub = { version = "0.2.0" } -alloy-rpc-types = { version = "0.2.0" } -alloy-rpc-types-engine = { version = "0.2.0" } -alloy-rpc-types-beacon = { version = "0.2.0" } -alloy-rpc-types-trace = { version = "0.2.0" } -alloy-json-rpc = { version = "0.2.0" } -alloy-network = { version = "0.2.0" } -alloy-primitives = { version = "0.7.7" } -alloy-rlp = { version = "0.3.7" } - +alloy = { version = "0.2.0", features = ["full", "provider-trace-api", "rpc-types-beacon", "rpc-types-engine"] } # alloy-rpc-types = { git = "https://github.com/chainbound/alloy", branch = "fix/account-override-serialize" } diff --git a/bolt-sidecar/bin/sidecar.rs b/bolt-sidecar/bin/sidecar.rs index 04cde0908..78d486b5b 100644 --- a/bolt-sidecar/bin/sidecar.rs +++ b/bolt-sidecar/bin/sidecar.rs @@ -1,6 +1,6 @@ use std::time::Duration; -use alloy_rpc_types_beacon::events::HeadEvent; +use alloy::rpc::types::beacon::events::HeadEvent; use tokio::sync::mpsc; use bolt_sidecar::{ diff --git a/bolt-sidecar/src/builder/compat.rs b/bolt-sidecar/src/builder/compat.rs index 126bcaf82..f79d7f56b 100644 --- a/bolt-sidecar/src/builder/compat.rs +++ b/bolt-sidecar/src/builder/compat.rs @@ -1,8 +1,10 @@ -use alloy_eips::eip4895::Withdrawal; -use alloy_primitives::{Address, Bloom, B256, U256}; -use alloy_rpc_types_engine::{ - ExecutionPayload as AlloyExecutionPayload, ExecutionPayloadV1, ExecutionPayloadV2, - ExecutionPayloadV3, +use alloy::{ + eips::eip4895::Withdrawal, + primitives::{Address, Bloom, B256, U256}, + rpc::types::engine::{ + ExecutionPayload as AlloyExecutionPayload, ExecutionPayloadV1, ExecutionPayloadV2, + ExecutionPayloadV3, + }, }; use ethereum_consensus::{ bellatrix::mainnet::Transaction, diff --git a/bolt-sidecar/src/builder/mod.rs b/bolt-sidecar/src/builder/mod.rs index 53a08d5a2..d52d49236 100644 --- a/bolt-sidecar/src/builder/mod.rs +++ b/bolt-sidecar/src/builder/mod.rs @@ -1,4 +1,4 @@ -use alloy_primitives::U256; +use alloy::primitives::U256; use blst::min_pk::SecretKey; use ethereum_consensus::{ crypto::PublicKey, @@ -47,7 +47,7 @@ pub enum BuilderError { #[error("Failed HTTP request: {0}")] Reqwest(#[from] reqwest::Error), #[error("Failed while fetching from RPC: {0}")] - Transport(#[from] alloy_transport::TransportError), + Transport(#[from] alloy::transports::TransportError), #[error("Failed in SSZ merkleization: {0}")] Merkleization(#[from] MerkleizationError), #[error("Failed while interacting with beacon client: {0}")] diff --git a/bolt-sidecar/src/builder/payload_builder.rs b/bolt-sidecar/src/builder/payload_builder.rs index 1178ecab0..8226ad5ce 100644 --- a/bolt-sidecar/src/builder/payload_builder.rs +++ b/bolt-sidecar/src/builder/payload_builder.rs @@ -1,7 +1,8 @@ -use alloy_eips::{calc_excess_blob_gas, calc_next_block_base_fee, eip1559::BaseFeeParams}; -use alloy_primitives::{Address, Bytes, B256, U256}; -use alloy_rpc_types::Block; -use alloy_rpc_types_engine::ExecutionPayload as AlloyExecutionPayload; +use alloy::{ + eips::{calc_excess_blob_gas, calc_next_block_base_fee, eip1559::BaseFeeParams}, + primitives::{Address, Bytes, B256, U256}, + rpc::types::{engine::ExecutionPayload as AlloyExecutionPayload, Block}, +}; use beacon_api_client::{BlockId, StateId}; use hex::FromHex; use regex::Regex; @@ -390,11 +391,13 @@ pub(crate) fn build_header_with_hints_and_context( #[cfg(test)] mod tests { - use alloy_eips::eip2718::Encodable2718; - use alloy_network::{EthereumWallet, TransactionBuilder}; - use alloy_primitives::{hex, Address}; - use alloy_signer::k256::ecdsa::SigningKey; - use alloy_signer_local::PrivateKeySigner; + use alloy::{ + eips::eip2718::Encodable2718, + network::{EthereumWallet, TransactionBuilder}, + primitives::{hex, Address}, + signers::k256::ecdsa::SigningKey, + signers::local::PrivateKeySigner, + }; use reth_primitives::TransactionSigned; use crate::{ diff --git a/bolt-sidecar/src/builder/signature.rs b/bolt-sidecar/src/builder/signature.rs index 1c7a77eb8..04ebcb6d2 100644 --- a/bolt-sidecar/src/builder/signature.rs +++ b/bolt-sidecar/src/builder/signature.rs @@ -1,4 +1,4 @@ -use alloy_rpc_types_beacon::{constants::BLS_DST_SIG, BlsSignature}; +use alloy::rpc::types::beacon::{constants::BLS_DST_SIG, BlsSignature}; use blst::min_pk::{PublicKey, SecretKey}; use blst::BLST_ERROR; use ethereum_consensus::crypto::Signature; diff --git a/bolt-sidecar/src/builder/template.rs b/bolt-sidecar/src/builder/template.rs index f424c431d..91fb3d371 100644 --- a/bolt-sidecar/src/builder/template.rs +++ b/bolt-sidecar/src/builder/template.rs @@ -6,7 +6,7 @@ use std::collections::HashMap; -use alloy_primitives::{Address, U256}; +use alloy::primitives::{Address, U256}; use ethereum_consensus::{ crypto::{KzgCommitment, KzgProof}, deneb::mainnet::{Blob, BlobsBundle}, diff --git a/bolt-sidecar/src/client/commit_boost.rs b/bolt-sidecar/src/client/commit_boost.rs index b4c689ace..f41066768 100644 --- a/bolt-sidecar/src/client/commit_boost.rs +++ b/bolt-sidecar/src/client/commit_boost.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use alloy_rpc_types_beacon::{BlsPublicKey, BlsSignature}; +use alloy::rpc::types::beacon::{BlsPublicKey, BlsSignature}; use cb_common::pbs::{COMMIT_BOOST_API, PUBKEYS_PATH, SIGN_REQUEST_PATH}; use cb_crypto::types::SignRequest; use ethereum_consensus::ssz::prelude::ssz_rs; diff --git a/bolt-sidecar/src/client/pubsub.rs b/bolt-sidecar/src/client/pubsub.rs index 6e9feac2c..6db1f0b4c 100644 --- a/bolt-sidecar/src/client/pubsub.rs +++ b/bolt-sidecar/src/client/pubsub.rs @@ -3,16 +3,18 @@ use std::{ str::FromStr, }; -use alloy::{ClientBuilder, WsConnect}; -use alloy_json_rpc::RpcError; -use alloy_pubsub::PubSubFrontend; -use alloy_rpc_client as alloy; -use alloy_transport::TransportError; +use alloy::{ + pubsub::PubSubFrontend, + rpc::client::{self as alloyClient, ClientBuilder, WsConnect}, + transports::RpcError, + transports::TransportError, +}; + use reqwest::Url; /// Wrapper around an [`alloy::RpcClient`] that uses WS as the transport. Supports batching /// JSON-RPC requests. -pub struct PubsubClient(alloy::RpcClient); +pub struct PubsubClient(alloyClient::RpcClient); #[allow(unused)] impl PubsubClient { @@ -27,7 +29,7 @@ impl PubsubClient { } impl Deref for PubsubClient { - type Target = alloy::RpcClient; + type Target = alloyClient::RpcClient; fn deref(&self) -> &Self::Target { &self.0 diff --git a/bolt-sidecar/src/client/rpc.rs b/bolt-sidecar/src/client/rpc.rs index 7218d06a1..513c19c70 100644 --- a/bolt-sidecar/src/client/rpc.rs +++ b/bolt-sidecar/src/client/rpc.rs @@ -1,21 +1,28 @@ //! This module contains the `RpcClient` struct, which is a wrapper around the `alloy_rpc_client`. //! It provides a simple interface to interact with the Execution layer JSON-RPC API. -use alloy_rpc_types_trace::geth::{GethDebugTracingCallOptions, GethTrace}; use futures::future::join_all; use std::{ collections::HashSet, ops::{Deref, DerefMut}, }; -use alloy::ClientBuilder; -use alloy_eips::BlockNumberOrTag; -use alloy_primitives::{Address, Bytes, B256, U256, U64}; -use alloy_rpc_client::{self as alloy, Waiter}; -use alloy_rpc_types::{Block, EIP1186AccountProofResponse, FeeHistory, TransactionRequest}; -use alloy_rpc_types_trace::parity::{TraceResults, TraceType}; -use alloy_transport::{TransportErrorKind, TransportResult}; -use alloy_transport_http::Http; +use alloy::{ + eips::BlockNumberOrTag, + primitives::{Address, Bytes, B256, U256, U64}, + rpc::{ + client::{self as alloyClient, ClientBuilder, Waiter}, + types::{ + trace::{ + geth::{GethDebugTracingCallOptions, GethTrace}, + parity::{TraceResults, TraceType}, + }, + {Block, EIP1186AccountProofResponse, FeeHistory, TransactionRequest}, + }, + }, + transports::{http::Http, TransportErrorKind, TransportResult}, +}; + use reqwest::{Client, Url}; use crate::primitives::AccountState; @@ -23,7 +30,7 @@ use crate::primitives::AccountState; /// An HTTP-based JSON-RPC client that supports batching. /// Implements all methods that are relevant to Bolt state. #[derive(Clone, Debug)] -pub struct RpcClient(alloy::RpcClient>); +pub struct RpcClient(alloyClient::RpcClient>); impl RpcClient { /// Create a new `RpcClient` with the given URL. @@ -201,7 +208,7 @@ impl RpcClient { } impl Deref for RpcClient { - type Target = alloy::RpcClient>; + type Target = alloyClient::RpcClient>; fn deref(&self) -> &Self::Target { &self.0 @@ -218,9 +225,11 @@ impl DerefMut for RpcClient { mod tests { use std::str::FromStr; - use alloy_consensus::constants::ETH_TO_WEI; - use alloy_primitives::{uint, Uint}; - use alloy_rpc_types::EIP1186AccountProofResponse; + use alloy::{ + consensus::constants::ETH_TO_WEI, + primitives::{uint, Uint}, + rpc::types::EIP1186AccountProofResponse, + }; use reth_primitives::B256; use crate::test_util::launch_anvil; diff --git a/bolt-sidecar/src/common.rs b/bolt-sidecar/src/common.rs index e73c8dbd4..c23e43c64 100644 --- a/bolt-sidecar/src/common.rs +++ b/bolt-sidecar/src/common.rs @@ -1,4 +1,4 @@ -use alloy_primitives::U256; +use alloy::primitives::U256; use reth_primitives::PooledTransactionsElement; use crate::{ diff --git a/bolt-sidecar/src/config/chain.rs b/bolt-sidecar/src/config/chain.rs index eda5c9d61..7ce0aa5a5 100644 --- a/bolt-sidecar/src/config/chain.rs +++ b/bolt-sidecar/src/config/chain.rs @@ -1,6 +1,6 @@ use std::time::Duration; -use alloy_primitives::b256; +use alloy::primitives::b256; use clap::{Args, ValueEnum}; /// Default commitment deadline duration. diff --git a/bolt-sidecar/src/config/mod.rs b/bolt-sidecar/src/config/mod.rs index d0f60d595..a7818388c 100644 --- a/bolt-sidecar/src/config/mod.rs +++ b/bolt-sidecar/src/config/mod.rs @@ -1,6 +1,6 @@ use std::{fs::read_to_string, path::Path, str::FromStr}; -use alloy_primitives::Address; +use alloy::primitives::Address; use blst::min_pk::SecretKey; use clap::Parser; use reqwest::Url; diff --git a/bolt-sidecar/src/crypto/bls.rs b/bolt-sidecar/src/crypto/bls.rs index e06257135..9467f326c 100644 --- a/bolt-sidecar/src/crypto/bls.rs +++ b/bolt-sidecar/src/crypto/bls.rs @@ -1,4 +1,4 @@ -use alloy_primitives::FixedBytes; +use alloy::primitives::FixedBytes; use blst::{min_pk::Signature, BLST_ERROR}; use rand::RngCore; diff --git a/bolt-sidecar/src/json_rpc/api.rs b/bolt-sidecar/src/json_rpc/api.rs index 2b4f88aa6..3d23eac80 100644 --- a/bolt-sidecar/src/json_rpc/api.rs +++ b/bolt-sidecar/src/json_rpc/api.rs @@ -24,11 +24,11 @@ pub enum ApiError { #[error("duplicate: the same request already exists")] DuplicateRequest, #[error("signature error: {0}")] - Signature(#[from] alloy_primitives::SignatureError), + Signature(#[from] alloy::primitives::SignatureError), #[error("signature pubkey mismatch. expected: {expected}, got: {got}")] SignaturePubkeyMismatch { expected: String, got: String }, #[error("failed to decode RLP: {0}")] - Rlp(#[from] alloy_rlp::Error), + Rlp(#[from] alloy::transports::HttpError), #[error("failed during HTTP call: {0}")] Http(#[from] reqwest::Error), #[error("downstream error: {0}")] diff --git a/bolt-sidecar/src/primitives/commitment.rs b/bolt-sidecar/src/primitives/commitment.rs index 9db058198..5f421cc3e 100644 --- a/bolt-sidecar/src/primitives/commitment.rs +++ b/bolt-sidecar/src/primitives/commitment.rs @@ -1,7 +1,7 @@ use serde::{de, Deserialize, Deserializer, Serialize}; use std::str::FromStr; -use alloy_primitives::{keccak256, Address, Signature, B256}; +use alloy::primitives::{keccak256, Address, Signature, B256}; use reth_primitives::PooledTransactionsElement; use super::TransactionExt; diff --git a/bolt-sidecar/src/primitives/constraint.rs b/bolt-sidecar/src/primitives/constraint.rs index f1073ce53..db1abf7ba 100644 --- a/bolt-sidecar/src/primitives/constraint.rs +++ b/bolt-sidecar/src/primitives/constraint.rs @@ -1,4 +1,4 @@ -use alloy_primitives::{keccak256, Address}; +use alloy::primitives::{keccak256, Address}; use reth_primitives::PooledTransactionsElement; use secp256k1::Message; use serde::Serialize; diff --git a/bolt-sidecar/src/primitives/mod.rs b/bolt-sidecar/src/primitives/mod.rs index 3da7be625..b6eec1852 100644 --- a/bolt-sidecar/src/primitives/mod.rs +++ b/bolt-sidecar/src/primitives/mod.rs @@ -3,7 +3,7 @@ use std::sync::{atomic::AtomicU64, Arc}; -use alloy_primitives::U256; +use alloy::primitives::U256; use ethereum_consensus::{ crypto::{KzgCommitment, PublicKey as BlsPublicKey, Signature as BlsSignature}, deneb::{ diff --git a/bolt-sidecar/src/state/execution.rs b/bolt-sidecar/src/state/execution.rs index bec286b5c..13f8b4d24 100644 --- a/bolt-sidecar/src/state/execution.rs +++ b/bolt-sidecar/src/state/execution.rs @@ -1,6 +1,8 @@ -use alloy_eips::eip4844::MAX_BLOBS_PER_BLOCK; -use alloy_primitives::{Address, SignatureError, U256}; -use alloy_transport::TransportError; +use alloy::{ + eips::eip4844::MAX_BLOBS_PER_BLOCK, + primitives::{Address, SignatureError, U256}, + transports::TransportError, +}; use reth_primitives::{ revm_primitives::EnvKzgSettings, BlobTransactionValidationError, PooledTransactionsElement, }; @@ -432,12 +434,14 @@ mod tests { use std::str::FromStr; use std::{num::NonZero, time::Duration}; - use alloy_consensus::constants::ETH_TO_WEI; - use alloy_eips::eip2718::Encodable2718; - use alloy_network::EthereumWallet; - use alloy_primitives::{uint, Uint}; - use alloy_provider::{network::TransactionBuilder, Provider, ProviderBuilder}; - use alloy_signer_local::PrivateKeySigner; + use alloy::{ + consensus::constants::ETH_TO_WEI, + eips::eip2718::Encodable2718, + network::EthereumWallet, + primitives::{uint, Uint}, + providers::{network::TransactionBuilder, Provider, ProviderBuilder}, + signers::local::PrivateKeySigner, + }; use fetcher::{StateClient, StateFetcher}; use crate::{ diff --git a/bolt-sidecar/src/state/fetcher.rs b/bolt-sidecar/src/state/fetcher.rs index 2513c383c..9ef088b2b 100644 --- a/bolt-sidecar/src/state/fetcher.rs +++ b/bolt-sidecar/src/state/fetcher.rs @@ -4,9 +4,11 @@ use std::{collections::HashMap, time::Duration}; -use alloy_eips::BlockNumberOrTag; -use alloy_primitives::{Address, Bytes, U256, U64}; -use alloy_transport::TransportError; +use alloy::{ + eips::BlockNumberOrTag, + primitives::{Address, Bytes, U256, U64}, + transports::TransportError, +}; use futures::{stream::FuturesOrdered, StreamExt}; use reqwest::Url; diff --git a/bolt-sidecar/src/state/head_tracker.rs b/bolt-sidecar/src/state/head_tracker.rs index 6acfc6ced..8330c769d 100644 --- a/bolt-sidecar/src/state/head_tracker.rs +++ b/bolt-sidecar/src/state/head_tracker.rs @@ -1,6 +1,6 @@ use std::time::Duration; -use alloy_rpc_types_beacon::events::HeadEvent; +use alloy::rpc::types::beacon::events::HeadEvent; use beacon_api_client::Topic; use futures::StreamExt; use tokio::{sync::broadcast, task::AbortHandle}; diff --git a/bolt-sidecar/src/test_util.rs b/bolt-sidecar/src/test_util.rs index 86b01d747..ece145d1c 100644 --- a/bolt-sidecar/src/test_util.rs +++ b/bolt-sidecar/src/test_util.rs @@ -1,13 +1,15 @@ -use alloy_eips::eip2718::Encodable2718; -use alloy_network::{EthereumWallet, TransactionBuilder}; -use alloy_node_bindings::{Anvil, AnvilInstance}; -use alloy_primitives::{keccak256, Address, B256, U256}; -use alloy_rpc_types::TransactionRequest; -use alloy_signer::{ - k256::{ecdsa::SigningKey as K256SigningKey, SecretKey as K256SecretKey}, - Signer, +use alloy::{ + eips::eip2718::Encodable2718, + network::{EthereumWallet, TransactionBuilder}, + primitives::{keccak256, Address, B256, U256}, + rpc::types::TransactionRequest, + signers::{ + k256::{ecdsa::SigningKey as K256SigningKey, SecretKey as K256SecretKey}, + local::PrivateKeySigner, + Signer, + }, }; -use alloy_signer_local::PrivateKeySigner; +use alloy_node_bindings::{Anvil, AnvilInstance}; use blst::min_pk::SecretKey; use reth_primitives::PooledTransactionsElement; use secp256k1::Message; From 1c78d618700c300c9c898f2c8b69c020c224c49f Mon Sep 17 00:00:00 2001 From: Naman Garg <0708ng@gmail.com> Date: Thu, 18 Jul 2024 23:42:25 +0530 Subject: [PATCH 3/6] chore(sidecar): reorder imports --- bolt-sidecar/src/state/execution.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bolt-sidecar/src/state/execution.rs b/bolt-sidecar/src/state/execution.rs index 13f8b4d24..4c9b584d2 100644 --- a/bolt-sidecar/src/state/execution.rs +++ b/bolt-sidecar/src/state/execution.rs @@ -1,3 +1,5 @@ +use std::{collections::HashMap, num::NonZero}; + use alloy::{ eips::eip4844::MAX_BLOBS_PER_BLOCK, primitives::{Address, SignatureError, U256}, @@ -6,17 +8,15 @@ use alloy::{ use reth_primitives::{ revm_primitives::EnvKzgSettings, BlobTransactionValidationError, PooledTransactionsElement, }; -use std::{collections::HashMap, num::NonZero}; use thiserror::Error; +use super::fetcher::StateFetcher; use crate::{ builder::BlockTemplate, common::{calculate_max_basefee, validate_transaction}, primitives::{AccountState, CommitmentRequest, SignedConstraints, Slot, TransactionExt}, }; -use super::fetcher::StateFetcher; - /// Possible commitment validation errors. #[derive(Debug, Error)] pub enum ValidationError { From ac9641e822cb659fa95e18589dd0183322564a32 Mon Sep 17 00:00:00 2001 From: Naman Garg <0708ng@gmail.com> Date: Fri, 19 Jul 2024 12:17:30 +0530 Subject: [PATCH 4/6] feat(sidecar): max committed gas wip --- bolt-sidecar/src/builder/template.rs | 12 ++++++++++++ bolt-sidecar/src/state/execution.rs | 15 +++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/bolt-sidecar/src/builder/template.rs b/bolt-sidecar/src/builder/template.rs index 91fb3d371..772bab7b6 100644 --- a/bolt-sidecar/src/builder/template.rs +++ b/bolt-sidecar/src/builder/template.rs @@ -111,6 +111,18 @@ impl BlockTemplate { .fold(0, |acc, sc| acc + sc.message.constraints.len()) } + /// Returns the committed gas in the block template. + #[inline] + pub fn committed_gas(&self) -> U256 { + self.signed_constraints_list + .iter() + .fold(U256::ZERO, |acc, sc| { + acc + sc.message.constraints.iter().fold(U256::ZERO, |acc, c| { + acc + max_transaction_cost(&c.transaction) + }) + }) + } + /// Returns the blob count of the block template. #[inline] pub fn blob_count(&self) -> usize { diff --git a/bolt-sidecar/src/state/execution.rs b/bolt-sidecar/src/state/execution.rs index 4c9b584d2..1723c8dd4 100644 --- a/bolt-sidecar/src/state/execution.rs +++ b/bolt-sidecar/src/state/execution.rs @@ -62,6 +62,9 @@ pub enum ValidationError { /// The maximum commitments have been reached for the slot. #[error("Max commitments reached for slot {0}: {1}")] MaxCommitmentsReachedForSlot(u64, usize), + /// The maximum committed gas has been reached for the slot. + #[error("Max committed gas reached for slot {0}: {1}")] + MaxCommittedGasReachedForSlot(u64, u64), /// The signature is invalid. #[error("Signature error: {0:?}")] Signature(#[from] SignatureError), @@ -115,6 +118,8 @@ pub struct ExecutionState { chain_id: u64, /// The maximum number of commitments per slot. max_commitments_per_slot: NonZero, + /// The maximum committed gas per slot. + max_committed_gas_per_slot: NonZero, /// The KZG settings for validating blobs. kzg_settings: EnvKzgSettings, /// The state fetcher client. @@ -147,6 +152,7 @@ impl ExecutionState { pub async fn new( client: C, max_commitments_per_slot: NonZero, + max_committed_gas_per_slot: NonZero, ) -> Result { let (basefee, blob_basefee, block_number, chain_id) = tokio::try_join!( client.get_basefee(None), @@ -161,6 +167,7 @@ impl ExecutionState { block_number, chain_id, max_commitments_per_slot, + max_committed_gas_per_slot, client, slot: 0, account_states: HashMap::new(), @@ -210,6 +217,14 @@ impl ExecutionState { self.max_commitments_per_slot.get(), )); } + + // Check if the committed gas exceeds the maximum + if template.committed_gas().to::() >= self.max_committed_gas_per_slot.get() { + return Err(ValidationError::MaxCommittedGasReachedForSlot( + self.slot, + self.max_committed_gas_per_slot.get(), + )); + } } // Check if the transaction size exceeds the maximum From f269cc30ddb565c55db46b6a342f655277836ecf Mon Sep 17 00:00:00 2001 From: Naman Garg <0708ng@gmail.com> Date: Fri, 19 Jul 2024 12:38:38 +0530 Subject: [PATCH 5/6] chore(sidecar): fix mutable borrow conflict --- bolt-sidecar/src/state/execution.rs | 37 +++++++++++++++++++---------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/bolt-sidecar/src/state/execution.rs b/bolt-sidecar/src/state/execution.rs index 1723c8dd4..e60c9a4a6 100644 --- a/bolt-sidecar/src/state/execution.rs +++ b/bolt-sidecar/src/state/execution.rs @@ -209,20 +209,23 @@ impl ExecutionState { return Err(ValidationError::ChainIdMismatch); } - // Check if there is room for more commitments + let max_commitments_per_slot = self.max_commitments_per_slot.get(); + let max_committed_gas_per_slot = self.max_committed_gas_per_slot.get(); + + // Check if there is room for more commitments and gas in the block template if let Some(template) = self.get_block_template(target_slot) { - if template.transactions_len() >= self.max_commitments_per_slot.get() { + if template.transactions_len() >= max_commitments_per_slot { return Err(ValidationError::MaxCommitmentsReachedForSlot( self.slot, - self.max_commitments_per_slot.get(), + max_commitments_per_slot, )); } // Check if the committed gas exceeds the maximum - if template.committed_gas().to::() >= self.max_committed_gas_per_slot.get() { + if template.committed_gas().to::() >= max_committed_gas_per_slot { return Err(ValidationError::MaxCommittedGasReachedForSlot( self.slot, - self.max_committed_gas_per_slot.get(), + max_committed_gas_per_slot, )); } } @@ -476,7 +479,8 @@ mod tests { let client = StateClient::new(anvil.endpoint_url()); let max_comms = NonZero::new(10).unwrap(); - let mut state = ExecutionState::new(client.clone(), max_comms).await?; + let max_gas = NonZero::new(10_000_000).unwrap(); + let mut state = ExecutionState::new(client.clone(), max_comms, max_gas).await?; let sender = anvil.addresses().first().unwrap(); let sender_pk = anvil.keys().first().unwrap(); @@ -502,7 +506,8 @@ mod tests { let client = StateClient::new(anvil.endpoint_url()); let max_comms = NonZero::new(10).unwrap(); - let mut state = ExecutionState::new(client.clone(), max_comms).await?; + let max_gas = NonZero::new(10_000_000).unwrap(); + let mut state = ExecutionState::new(client.clone(), max_comms, max_gas).await?; let sender = anvil.addresses().first().unwrap(); let sender_pk = anvil.keys().first().unwrap(); @@ -543,7 +548,8 @@ mod tests { let client = StateClient::new(anvil.endpoint_url()); let max_comms = NonZero::new(10).unwrap(); - let mut state = ExecutionState::new(client.clone(), max_comms).await?; + let max_gas = NonZero::new(10_000_000).unwrap(); + let mut state = ExecutionState::new(client.clone(), max_comms, max_gas).await?; let sender = anvil.addresses().first().unwrap(); let sender_pk = anvil.keys().first().unwrap(); @@ -596,7 +602,8 @@ mod tests { let client = StateClient::new(anvil.endpoint_url()); let max_comms = NonZero::new(10).unwrap(); - let mut state = ExecutionState::new(client.clone(), max_comms).await?; + let max_gas = NonZero::new(10_000_000).unwrap(); + let mut state = ExecutionState::new(client.clone(), max_comms, max_gas).await?; let sender = anvil.addresses().first().unwrap(); let sender_pk = anvil.keys().first().unwrap(); @@ -627,7 +634,8 @@ mod tests { let client = StateClient::new(anvil.endpoint_url()); let max_comms = NonZero::new(10).unwrap(); - let mut state = ExecutionState::new(client.clone(), max_comms).await?; + let max_gas = NonZero::new(10_000_000).unwrap(); + let mut state = ExecutionState::new(client.clone(), max_comms, max_gas).await?; let sender = anvil.addresses().first().unwrap(); let sender_pk = anvil.keys().first().unwrap(); @@ -690,7 +698,8 @@ mod tests { let client = StateClient::new(anvil.endpoint_url()); let max_comms = NonZero::new(10).unwrap(); - let mut state = ExecutionState::new(client.clone(), max_comms).await?; + let max_gas = NonZero::new(10_000_000).unwrap(); + let mut state = ExecutionState::new(client.clone(), max_comms, max_gas).await?; let basefee = state.basefee(); @@ -725,7 +734,8 @@ mod tests { let provider = ProviderBuilder::new().on_http(anvil.endpoint_url()); let max_comms = NonZero::new(10).unwrap(); - let mut state = ExecutionState::new(client.clone(), max_comms).await?; + let max_gas = NonZero::new(10_000_000).unwrap(); + let mut state = ExecutionState::new(client.clone(), max_comms, max_gas).await?; let sender = anvil.addresses().first().unwrap(); let sender_pk = anvil.keys().first().unwrap(); @@ -792,7 +802,8 @@ mod tests { let client = StateClient::new(anvil.endpoint_url()); let max_comms = NonZero::new(10).unwrap(); - let mut state = ExecutionState::new(client.clone(), max_comms).await?; + let max_gas = NonZero::new(10_000_000).unwrap(); + let mut state = ExecutionState::new(client.clone(), max_comms, max_gas).await?; let sender = anvil.addresses().first().unwrap(); let sender_pk = anvil.keys().first().unwrap(); From b3f29c1a583b8b96bda649a0533c48ea152c69d9 Mon Sep 17 00:00:00 2001 From: Naman Garg <0708ng@gmail.com> Date: Fri, 19 Jul 2024 12:39:04 +0530 Subject: [PATCH 6/6] chore(sidecar): add max gas to cli --- bolt-sidecar/bin/sidecar.rs | 8 ++++++-- bolt-sidecar/src/config/mod.rs | 9 +++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/bolt-sidecar/bin/sidecar.rs b/bolt-sidecar/bin/sidecar.rs index 78d486b5b..96eed3261 100644 --- a/bolt-sidecar/bin/sidecar.rs +++ b/bolt-sidecar/bin/sidecar.rs @@ -28,8 +28,12 @@ async fn main() -> eyre::Result<()> { let signer = Signer::new(config.private_key.clone().unwrap()); let state_client = StateClient::new(config.execution_api_url.clone()); - let mut execution_state = - ExecutionState::new(state_client, config.limits.max_commitments_per_slot).await?; + let mut execution_state = ExecutionState::new( + state_client, + config.limits.max_commitments_per_slot, + config.limits.max_committed_gas_per_slot, + ) + .await?; let mevboost_client = MevBoostClient::new(config.mevboost_url.clone()); let beacon_client = BeaconClient::new(config.beacon_api_url.clone()); diff --git a/bolt-sidecar/src/config/mod.rs b/bolt-sidecar/src/config/mod.rs index a7818388c..fc6a599a6 100644 --- a/bolt-sidecar/src/config/mod.rs +++ b/bolt-sidecar/src/config/mod.rs @@ -47,6 +47,9 @@ pub struct Opts { /// Max number of commitments to accept per block #[clap(short = 'm', long)] pub(super) max_commitments: Option>, + /// Max committed gas per slot + #[clap(short = 'g', long)] + pub(super) max_committed_gas: Option>, /// Validator indexes of connected validators that the sidecar /// should accept commitments on behalf of. Accepted values: /// - a comma-separated list of indexes (e.g. "1,2,3,4") @@ -137,12 +140,14 @@ impl Default for Config { pub struct Limits { /// Maximum number of commitments to accept per block pub max_commitments_per_slot: NonZero, + pub max_committed_gas_per_slot: NonZero, } impl Default for Limits { fn default() -> Self { Self { max_commitments_per_slot: NonZero::new(6).expect("Valid non-zero"), + max_committed_gas_per_slot: NonZero::new(10_000_000).expect("Valid non-zero"), } } } @@ -169,6 +174,10 @@ impl TryFrom for Config { config.limits.max_commitments_per_slot = max_commitments; } + if let Some(max_committed_gas) = opts.max_committed_gas { + config.limits.max_committed_gas_per_slot = max_committed_gas; + } + config.commit_boost_url = opts .signing .commit_boost_url