diff --git a/crates/node-interaction/src/lib.rs b/crates/node-interaction/src/lib.rs index dbd2bf9..29907a0 100644 --- a/crates/node-interaction/src/lib.rs +++ b/crates/node-interaction/src/lib.rs @@ -3,7 +3,9 @@ use std::pin::Pin; use std::sync::Arc; +use alloy::network::Ethereum; use alloy::primitives::{Address, BlockNumber, BlockTimestamp, StorageKey, TxHash, U256}; +use alloy::providers::DynProvider; use alloy::rpc::types::trace::geth::{DiffMode, GethDebugTracingOptions, GethTrace}; use alloy::rpc::types::{EIP1186AccountProofResponse, TransactionReceipt, TransactionRequest}; use anyhow::Result; @@ -74,6 +76,9 @@ pub trait EthereumNode { + '_, >, >; + + fn provider(&self) + -> Pin>> + '_>>; } #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] diff --git a/crates/node/src/node_implementations/geth.rs b/crates/node/src/node_implementations/geth.rs index fc31d86..5997fd7 100644 --- a/crates/node/src/node_implementations/geth.rs +++ b/crates/node/src/node_implementations/geth.rs @@ -32,7 +32,7 @@ use alloy::{ }, }; use anyhow::Context as _; -use futures::{Stream, StreamExt}; +use futures::{FutureExt, Stream, StreamExt}; use revive_common::EVMVersion; use tokio::sync::OnceCell; use tracing::{Instrument, error, instrument}; @@ -542,6 +542,16 @@ impl EthereumNode for GethNode { as Pin>>) }) } + + fn provider( + &self, + ) -> Pin>> + '_>> + { + Box::pin( + self.provider() + .map(|provider| provider.map(|provider| provider.erased())), + ) + } } pub struct GethNodeResolver { diff --git a/crates/node/src/node_implementations/lighthouse_geth.rs b/crates/node/src/node_implementations/lighthouse_geth.rs index f119107..5b00145 100644 --- a/crates/node/src/node_implementations/lighthouse_geth.rs +++ b/crates/node/src/node_implementations/lighthouse_geth.rs @@ -43,7 +43,7 @@ use alloy::{ }, }; use anyhow::Context as _; -use futures::{Stream, StreamExt}; +use futures::{FutureExt, Stream, StreamExt}; use revive_common::EVMVersion; use serde::{Deserialize, Deserializer, Serialize, Serializer}; use serde_with::serde_as; @@ -761,6 +761,16 @@ impl EthereumNode for LighthouseGethNode { as Pin>>) }) } + + fn provider( + &self, + ) -> Pin>> + '_>> + { + Box::pin( + self.http_provider() + .map(|provider| provider.map(|provider| provider.erased())), + ) + } } pub struct LighthouseGethNodeResolver, P: Provider> { diff --git a/crates/node/src/node_implementations/substrate.rs b/crates/node/src/node_implementations/substrate.rs index b5d9072..548730d 100644 --- a/crates/node/src/node_implementations/substrate.rs +++ b/crates/node/src/node_implementations/substrate.rs @@ -29,7 +29,7 @@ use alloy::{ }; use anyhow::Context as _; use async_stream::stream; -use futures::Stream; +use futures::{FutureExt, Stream}; use revive_common::EVMVersion; use revive_dt_common::fs::clear_directory; use revive_dt_format::traits::ResolverApi; @@ -550,6 +550,16 @@ impl EthereumNode for SubstrateNode { Ok(stream) }) } + + fn provider( + &self, + ) -> Pin>> + '_>> + { + Box::pin( + self.provider() + .map(|provider| provider.map(|provider| provider.erased())), + ) + } } pub struct SubstrateNodeResolver { diff --git a/crates/node/src/node_implementations/zombienet.rs b/crates/node/src/node_implementations/zombienet.rs index 5fba56e..64fcbd1 100644 --- a/crates/node/src/node_implementations/zombienet.rs +++ b/crates/node/src/node_implementations/zombienet.rs @@ -56,7 +56,7 @@ use alloy::{ use anyhow::Context as _; use async_stream::stream; -use futures::Stream; +use futures::{FutureExt, Stream}; use revive_common::EVMVersion; use revive_dt_common::fs::clear_directory; use revive_dt_config::*; @@ -606,6 +606,16 @@ impl EthereumNode for ZombienetNode { Ok(stream) }) } + + fn provider( + &self, + ) -> Pin>> + '_>> + { + Box::pin( + self.provider() + .map(|provider| provider.map(|provider| provider.erased())), + ) + } } pub struct ZombieNodeResolver, P: Provider> {