diff --git a/Cargo.lock b/Cargo.lock index 46114ec..767fbe0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7639,6 +7639,7 @@ dependencies = [ "alloy-evm", "alloy-primitives", "alloy-provider", + "alloy-rpc-client", "alloy-rpc-types", "alloy-sol-macro", "alloy-sol-types", diff --git a/Cargo.toml b/Cargo.toml index 26a324e..529611a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -112,6 +112,7 @@ alloy-node-bindings = { version = "1.0.37", default-features = false } alloy-provider = { version = "1.0.37", default-features = false, features = [ "reqwest", ] } +alloy-rpc-client = { version = "1.0.37", default-features = false } alloy-rpc-types = { version = "1.0.37", default-features = false, features = [ "eth", ] } diff --git a/crates/host-executor/Cargo.toml b/crates/host-executor/Cargo.toml index c739e06..4c0c724 100644 --- a/crates/host-executor/Cargo.toml +++ b/crates/host-executor/Cargo.toml @@ -42,9 +42,10 @@ alloy-consensus.workspace = true alloy-eips.workspace = true alloy-primitives.workspace = true alloy-provider.workspace = true -alloy-transport.workspace = true +alloy-rpc-client.workspace = true alloy-sol-macro.workspace = true alloy-sol-types.workspace = true +alloy-transport.workspace = true alloy-rpc-types.workspace = true alloy-evm.workspace = true @@ -59,4 +60,4 @@ bincode = "1.3.3" [features] optimism = [ "dep:reth-optimism-primitives", -] \ No newline at end of file +] diff --git a/crates/host-executor/src/sketch_builder.rs b/crates/host-executor/src/sketch_builder.rs index 2b3f8cc..99f9300 100644 --- a/crates/host-executor/src/sketch_builder.rs +++ b/crates/host-executor/src/sketch_builder.rs @@ -2,6 +2,7 @@ use std::marker::PhantomData; use alloy_eips::BlockId; use alloy_provider::{network::AnyNetwork, Provider, RootProvider}; +use alloy_rpc_client::RpcClient; use reth_primitives::EthPrimitives; use rsp_primitives::genesis::Genesis; use rsp_rpc_db::BasicRpcDb; @@ -54,6 +55,21 @@ impl EvmSketchBuilder<(), PT, ()> { phantom: PhantomData, } } + + pub fn el_rpc_client( + self, + rpc_client: RpcClient, + ) -> EvmSketchBuilder, PT, HeaderAnchorBuilder>> + { + let provider = RootProvider::new(rpc_client); + EvmSketchBuilder { + block: self.block, + genesis: self.genesis, + provider: provider.clone(), + anchor_builder: HeaderAnchorBuilder::new(provider), + phantom: PhantomData, + } + } } #[cfg(feature = "optimism")]