mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: Integrate new EvmEnvProvider in RPC (#1550)
This commit is contained in:
committed by
GitHub
parent
305e992eed
commit
41748e818f
@ -12,7 +12,7 @@ use jsonrpsee::{
|
||||
use reth_ipc::server::IpcServer;
|
||||
pub use reth_ipc::server::{Builder as IpcServerBuilder, Endpoint};
|
||||
use reth_network_api::{NetworkInfo, Peers};
|
||||
use reth_provider::{BlockProvider, HeaderProvider, StateProviderFactory};
|
||||
use reth_provider::{BlockProvider, EvmEnvProvider, HeaderProvider, StateProviderFactory};
|
||||
use reth_rpc::{
|
||||
AdminApi, AuthLayer, DebugApi, EngineApi, EthApi, JwtAuthValidator, JwtSecret, NetApi,
|
||||
TraceApi, Web3Api,
|
||||
@ -41,7 +41,8 @@ pub async fn launch<Client, Pool, Network>(
|
||||
secret: JwtSecret,
|
||||
) -> Result<ServerHandle, RpcError>
|
||||
where
|
||||
Client: BlockProvider + HeaderProvider + StateProviderFactory + Clone + 'static,
|
||||
Client:
|
||||
BlockProvider + HeaderProvider + StateProviderFactory + EvmEnvProvider + Clone + 'static,
|
||||
Pool: TransactionPool + Clone + 'static,
|
||||
Network: NetworkInfo + Peers + Clone + 'static,
|
||||
{
|
||||
@ -56,7 +57,8 @@ pub async fn launch_with_eth_api<Client, Pool, Network>(
|
||||
secret: JwtSecret,
|
||||
) -> Result<ServerHandle, RpcError>
|
||||
where
|
||||
Client: BlockProvider + HeaderProvider + StateProviderFactory + Clone + 'static,
|
||||
Client:
|
||||
BlockProvider + HeaderProvider + StateProviderFactory + EvmEnvProvider + Clone + 'static,
|
||||
Pool: TransactionPool + Clone + 'static,
|
||||
Network: NetworkInfo + Peers + Clone + 'static,
|
||||
{
|
||||
|
||||
@ -26,12 +26,12 @@
|
||||
//!
|
||||
//! ```
|
||||
//! use reth_network_api::{NetworkInfo, Peers};
|
||||
//! use reth_provider::{BlockProvider, HeaderProvider, StateProviderFactory};
|
||||
//! use reth_provider::{BlockProvider, HeaderProvider, StateProviderFactory, EvmEnvProvider};
|
||||
//! use reth_rpc_builder::{RethRpcModule, RpcModuleBuilder, RpcServerConfig, ServerBuilder, TransportRpcModuleConfig};
|
||||
//! use reth_transaction_pool::TransactionPool;
|
||||
//! pub async fn launch<Client, Pool, Network>(client: Client, pool: Pool, network: Network)
|
||||
//! where
|
||||
//! Client: BlockProvider + HeaderProvider + StateProviderFactory + Clone + 'static,
|
||||
//! Client: BlockProvider + HeaderProvider + StateProviderFactory + EvmEnvProvider + Clone + 'static,
|
||||
//! Pool: TransactionPool + Clone + 'static,
|
||||
//! Network: NetworkInfo + Peers + Clone + 'static,
|
||||
//! {
|
||||
@ -62,7 +62,7 @@ use jsonrpsee::{
|
||||
};
|
||||
use reth_ipc::server::IpcServer;
|
||||
use reth_network_api::{NetworkInfo, Peers};
|
||||
use reth_provider::{BlockProvider, HeaderProvider, StateProviderFactory};
|
||||
use reth_provider::{BlockProvider, EvmEnvProvider, HeaderProvider, StateProviderFactory};
|
||||
use reth_rpc::{AdminApi, DebugApi, EthApi, NetApi, TraceApi, Web3Api};
|
||||
use reth_rpc_api::servers::*;
|
||||
use reth_transaction_pool::TransactionPool;
|
||||
@ -99,7 +99,8 @@ pub async fn launch<Client, Pool, Network>(
|
||||
server_config: impl Into<RpcServerConfig>,
|
||||
) -> Result<RpcServerHandle, RpcError>
|
||||
where
|
||||
Client: BlockProvider + HeaderProvider + StateProviderFactory + Clone + 'static,
|
||||
Client:
|
||||
BlockProvider + HeaderProvider + StateProviderFactory + EvmEnvProvider + Clone + 'static,
|
||||
Pool: TransactionPool + Clone + 'static,
|
||||
Network: NetworkInfo + Peers + Clone + 'static,
|
||||
{
|
||||
@ -135,7 +136,7 @@ impl<Client, Pool, Network> RpcModuleBuilder<Client, Pool, Network> {
|
||||
/// Configure the client instance.
|
||||
pub fn with_client<C>(self, client: C) -> RpcModuleBuilder<C, Pool, Network>
|
||||
where
|
||||
C: BlockProvider + StateProviderFactory + 'static,
|
||||
C: BlockProvider + StateProviderFactory + EvmEnvProvider + 'static,
|
||||
{
|
||||
let Self { pool, network, .. } = self;
|
||||
RpcModuleBuilder { client, network, pool }
|
||||
@ -162,7 +163,8 @@ impl<Client, Pool, Network> RpcModuleBuilder<Client, Pool, Network> {
|
||||
|
||||
impl<Client, Pool, Network> RpcModuleBuilder<Client, Pool, Network>
|
||||
where
|
||||
Client: BlockProvider + HeaderProvider + StateProviderFactory + Clone + 'static,
|
||||
Client:
|
||||
BlockProvider + HeaderProvider + StateProviderFactory + EvmEnvProvider + Clone + 'static,
|
||||
Pool: TransactionPool + Clone + 'static,
|
||||
Network: NetworkInfo + Peers + Clone + 'static,
|
||||
{
|
||||
@ -263,7 +265,12 @@ impl RpcModuleSelection {
|
||||
network: Network,
|
||||
) -> RpcModule<()>
|
||||
where
|
||||
Client: BlockProvider + HeaderProvider + StateProviderFactory + Clone + 'static,
|
||||
Client: BlockProvider
|
||||
+ HeaderProvider
|
||||
+ StateProviderFactory
|
||||
+ EvmEnvProvider
|
||||
+ Clone
|
||||
+ 'static,
|
||||
Pool: TransactionPool + Clone + 'static,
|
||||
Network: NetworkInfo + Peers + Clone + 'static,
|
||||
{
|
||||
@ -402,7 +409,8 @@ where
|
||||
|
||||
impl<Client, Pool, Network> RethModuleRegistry<Client, Pool, Network>
|
||||
where
|
||||
Client: BlockProvider + HeaderProvider + StateProviderFactory + Clone + 'static,
|
||||
Client:
|
||||
BlockProvider + HeaderProvider + StateProviderFactory + EvmEnvProvider + Clone + 'static,
|
||||
Pool: TransactionPool + Clone + 'static,
|
||||
Network: NetworkInfo + Peers + Clone + 'static,
|
||||
{
|
||||
|
||||
@ -7,7 +7,7 @@ use reth_primitives::{
|
||||
BlockHash, BlockId, BlockNumber, ChainSpec, Hardfork, Header, SealedBlock, TransactionSigned,
|
||||
H64, U256,
|
||||
};
|
||||
use reth_provider::{BlockProvider, HeaderProvider, StateProviderFactory};
|
||||
use reth_provider::{BlockProvider, EvmEnvProvider, HeaderProvider, StateProviderFactory};
|
||||
use reth_revm::database::{State, SubState};
|
||||
use reth_rlp::Decodable;
|
||||
use reth_rpc_types::engine::{
|
||||
@ -45,7 +45,9 @@ pub struct EngineApi<Client> {
|
||||
// remote_store: HashMap<H64, ExecutionPayload>,
|
||||
}
|
||||
|
||||
impl<Client: HeaderProvider + BlockProvider + StateProviderFactory> EngineApi<Client> {
|
||||
impl<Client: HeaderProvider + BlockProvider + StateProviderFactory + EvmEnvProvider>
|
||||
EngineApi<Client>
|
||||
{
|
||||
/// Create new instance of [EngineApi].
|
||||
pub fn new(
|
||||
client: Client,
|
||||
@ -409,7 +411,7 @@ impl<Client: HeaderProvider + BlockProvider + StateProviderFactory> EngineApi<Cl
|
||||
|
||||
impl<Client> Future for EngineApi<Client>
|
||||
where
|
||||
Client: HeaderProvider + BlockProvider + StateProviderFactory + Unpin,
|
||||
Client: HeaderProvider + BlockProvider + StateProviderFactory + EvmEnvProvider + Unpin,
|
||||
{
|
||||
type Output = ();
|
||||
|
||||
|
||||
@ -5,12 +5,12 @@ use crate::{
|
||||
EthApi,
|
||||
};
|
||||
use reth_primitives::BlockId;
|
||||
use reth_provider::{BlockProvider, StateProviderFactory};
|
||||
use reth_provider::{BlockProvider, EvmEnvProvider, StateProviderFactory};
|
||||
use reth_rpc_types::{Block, RichBlock};
|
||||
|
||||
impl<Client, Pool, Network> EthApi<Client, Pool, Network>
|
||||
where
|
||||
Client: BlockProvider + StateProviderFactory + 'static,
|
||||
Client: BlockProvider + StateProviderFactory + EvmEnvProvider + 'static,
|
||||
{
|
||||
/// Returns the uncle headers of the given block
|
||||
///
|
||||
|
||||
@ -7,7 +7,7 @@ use crate::{
|
||||
EthApi,
|
||||
};
|
||||
use reth_primitives::{AccessList, Address, BlockId, Bytes, TransactionKind, U128, U256};
|
||||
use reth_provider::{BlockProvider, StateProvider, StateProviderFactory};
|
||||
use reth_provider::{BlockProvider, EvmEnvProvider, StateProvider, StateProviderFactory};
|
||||
use reth_revm::database::{State, SubState};
|
||||
use reth_rpc_types::CallRequest;
|
||||
use revm::{
|
||||
@ -20,7 +20,7 @@ pub(crate) const MIN_TRANSACTION_GAS: U256 = Uint::from_limbs([21_000, 0, 0, 0])
|
||||
|
||||
impl<Client, Pool, Network> EthApi<Client, Pool, Network>
|
||||
where
|
||||
Client: BlockProvider + StateProviderFactory + 'static,
|
||||
Client: BlockProvider + StateProviderFactory + EvmEnvProvider + 'static,
|
||||
{
|
||||
/// Executes the call request at the given [BlockId]
|
||||
pub(crate) fn call_at(
|
||||
|
||||
@ -10,7 +10,7 @@ use reth_network_api::NetworkInfo;
|
||||
use reth_primitives::{
|
||||
Address, BlockId, BlockNumberOrTag, ChainInfo, TransactionSigned, H256, U64,
|
||||
};
|
||||
use reth_provider::{BlockProvider, StateProviderFactory};
|
||||
use reth_provider::{BlockProvider, EvmEnvProvider, StateProviderFactory};
|
||||
use std::num::NonZeroUsize;
|
||||
|
||||
use crate::eth::error::EthResult;
|
||||
@ -97,7 +97,7 @@ impl<Client, Pool, Network> EthApi<Client, Pool, Network> {
|
||||
|
||||
impl<Client, Pool, Network> EthApi<Client, Pool, Network>
|
||||
where
|
||||
Client: BlockProvider + StateProviderFactory + 'static,
|
||||
Client: BlockProvider + StateProviderFactory + EvmEnvProvider + 'static,
|
||||
{
|
||||
fn convert_block_number(&self, num: BlockNumberOrTag) -> Result<Option<u64>> {
|
||||
self.client().convert_block_number(num)
|
||||
@ -176,7 +176,7 @@ where
|
||||
impl<Client, Pool, Network> EthApiSpec for EthApi<Client, Pool, Network>
|
||||
where
|
||||
Pool: TransactionPool + Clone + 'static,
|
||||
Client: BlockProvider + StateProviderFactory + 'static,
|
||||
Client: BlockProvider + StateProviderFactory + EvmEnvProvider + 'static,
|
||||
Network: NetworkInfo + 'static,
|
||||
{
|
||||
/// Returns the current ethereum protocol version.
|
||||
|
||||
@ -11,7 +11,7 @@ use reth_primitives::{
|
||||
rpc::transaction::eip2930::AccessListWithGasUsed, Address, BlockId, BlockNumberOrTag, Bytes,
|
||||
Header, H256, H64, U256, U64,
|
||||
};
|
||||
use reth_provider::{BlockProvider, HeaderProvider, StateProviderFactory};
|
||||
use reth_provider::{BlockProvider, EvmEnvProvider, HeaderProvider, StateProviderFactory};
|
||||
use reth_rpc_api::EthApiServer;
|
||||
use reth_rpc_types::{
|
||||
CallRequest, EIP1186AccountProofResponse, FeeHistory, FeeHistoryCacheItem, Index, RichBlock,
|
||||
@ -26,7 +26,7 @@ impl<Client, Pool, Network> EthApiServer for EthApi<Client, Pool, Network>
|
||||
where
|
||||
Self: EthApiSpec,
|
||||
Pool: TransactionPool + 'static,
|
||||
Client: BlockProvider + HeaderProvider + StateProviderFactory + 'static,
|
||||
Client: BlockProvider + HeaderProvider + StateProviderFactory + EvmEnvProvider + 'static,
|
||||
Network: 'static,
|
||||
{
|
||||
/// Handler for: `eth_protocolVersion`
|
||||
|
||||
@ -5,11 +5,11 @@ use crate::{
|
||||
EthApi,
|
||||
};
|
||||
use reth_primitives::{Address, BlockId, Bytes, H256, U256};
|
||||
use reth_provider::{BlockProvider, StateProvider, StateProviderFactory};
|
||||
use reth_provider::{BlockProvider, EvmEnvProvider, StateProvider, StateProviderFactory};
|
||||
|
||||
impl<Client, Pool, Network> EthApi<Client, Pool, Network>
|
||||
where
|
||||
Client: BlockProvider + StateProviderFactory + 'static,
|
||||
Client: BlockProvider + StateProviderFactory + EvmEnvProvider + 'static,
|
||||
{
|
||||
pub(crate) fn get_code(&self, address: Address, block_id: Option<BlockId>) -> EthResult<Bytes> {
|
||||
let state =
|
||||
|
||||
@ -5,7 +5,7 @@ use crate::{
|
||||
EthApi,
|
||||
};
|
||||
use reth_primitives::{Bytes, FromRecoveredTransaction, TransactionSigned, H256};
|
||||
use reth_provider::{BlockProvider, StateProviderFactory};
|
||||
use reth_provider::{BlockProvider, EvmEnvProvider, StateProviderFactory};
|
||||
use reth_rlp::Decodable;
|
||||
use reth_rpc_types::TransactionRequest;
|
||||
use reth_transaction_pool::{TransactionOrigin, TransactionPool};
|
||||
@ -13,7 +13,7 @@ use reth_transaction_pool::{TransactionOrigin, TransactionPool};
|
||||
impl<Client, Pool, Network> EthApi<Client, Pool, Network>
|
||||
where
|
||||
Pool: TransactionPool + 'static,
|
||||
Client: BlockProvider + StateProviderFactory + 'static,
|
||||
Client: BlockProvider + StateProviderFactory + EvmEnvProvider + 'static,
|
||||
Network: 'static,
|
||||
{
|
||||
pub(crate) async fn send_transaction(&self, _request: TransactionRequest) -> EthResult<H256> {
|
||||
|
||||
@ -11,7 +11,7 @@ use reth_primitives::{
|
||||
filter::{Filter, FilterBlockOption, FilteredParams},
|
||||
Block, U256,
|
||||
};
|
||||
use reth_provider::BlockProvider;
|
||||
use reth_provider::{BlockProvider, EvmEnvProvider};
|
||||
use reth_rpc_api::EthFilterApiServer;
|
||||
use reth_rpc_types::{FilterChanges, FilterId, Log};
|
||||
use reth_transaction_pool::TransactionPool;
|
||||
@ -51,7 +51,7 @@ impl<Client, Pool> EthFilter<Client, Pool> {
|
||||
#[async_trait]
|
||||
impl<Client, Pool> EthFilterApiServer for EthFilter<Client, Pool>
|
||||
where
|
||||
Client: BlockProvider + 'static,
|
||||
Client: BlockProvider + EvmEnvProvider + 'static,
|
||||
Pool: TransactionPool + 'static,
|
||||
{
|
||||
async fn new_filter(&self, filter: Filter) -> RpcResult<FilterId> {
|
||||
@ -172,7 +172,7 @@ struct EthFilterInner<Client, Pool> {
|
||||
|
||||
impl<Client, Pool> EthFilterInner<Client, Pool>
|
||||
where
|
||||
Client: BlockProvider + 'static,
|
||||
Client: BlockProvider + EvmEnvProvider + 'static,
|
||||
Pool: TransactionPool + 'static,
|
||||
{
|
||||
/// Installs a new filter and returns the new identifier.
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
use jsonrpsee::{types::SubscriptionResult, SubscriptionSink};
|
||||
use reth_interfaces::events::ChainEventSubscriptions;
|
||||
use reth_primitives::{rpc::FilteredParams, TxHash};
|
||||
use reth_provider::BlockProvider;
|
||||
use reth_provider::{BlockProvider, EvmEnvProvider};
|
||||
use reth_rpc_api::EthPubSubApiServer;
|
||||
use reth_rpc_types::{
|
||||
pubsub::{Params, SubscriptionKind, SubscriptionResult as EthSubscriptionResult},
|
||||
@ -50,7 +50,7 @@ impl<Client, Pool, Events> EthPubSub<Client, Pool, Events> {
|
||||
|
||||
impl<Client, Pool, Events> EthPubSubApiServer for EthPubSub<Client, Pool, Events>
|
||||
where
|
||||
Client: BlockProvider + Clone + 'static,
|
||||
Client: BlockProvider + EvmEnvProvider + Clone + 'static,
|
||||
Pool: TransactionPool + 'static,
|
||||
Events: ChainEventSubscriptions + Clone + 'static,
|
||||
{
|
||||
@ -78,7 +78,7 @@ async fn handle_accepted<Client, Pool, Events>(
|
||||
kind: SubscriptionKind,
|
||||
params: Option<Params>,
|
||||
) where
|
||||
Client: BlockProvider + 'static,
|
||||
Client: BlockProvider + EvmEnvProvider + 'static,
|
||||
Pool: TransactionPool + 'static,
|
||||
Events: ChainEventSubscriptions + 'static,
|
||||
{
|
||||
@ -141,7 +141,7 @@ where
|
||||
|
||||
impl<Client, Pool, Events> EthPubSubInner<Client, Pool, Events>
|
||||
where
|
||||
Client: BlockProvider + 'static,
|
||||
Client: BlockProvider + EvmEnvProvider + 'static,
|
||||
Events: ChainEventSubscriptions + 'static,
|
||||
{
|
||||
/// Returns a stream that yields all new RPC blocks.
|
||||
|
||||
Reference in New Issue
Block a user