mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: integrate OpPrimitives (#13556)
This commit is contained in:
@ -6,7 +6,7 @@ use jsonrpsee::{
|
||||
http_client::{transport::HttpBackend, HttpClient},
|
||||
};
|
||||
use reth_chainspec::EthereumHardforks;
|
||||
use reth_node_api::EngineTypes;
|
||||
use reth_node_api::{EngineTypes, NodePrimitives};
|
||||
use reth_node_builder::BuiltPayload;
|
||||
use reth_payload_builder::PayloadId;
|
||||
use reth_payload_primitives::PayloadBuilderAttributes;
|
||||
@ -17,14 +17,16 @@ use std::{marker::PhantomData, sync::Arc};
|
||||
|
||||
/// Helper for engine api operations
|
||||
#[derive(Debug)]
|
||||
pub struct EngineApiTestContext<E, ChainSpec> {
|
||||
pub struct EngineApiTestContext<E, ChainSpec, N: NodePrimitives> {
|
||||
pub chain_spec: Arc<ChainSpec>,
|
||||
pub canonical_stream: CanonStateNotificationStream,
|
||||
pub canonical_stream: CanonStateNotificationStream<N>,
|
||||
pub engine_api_client: HttpClient<AuthClientService<HttpBackend>>,
|
||||
pub _marker: PhantomData<E>,
|
||||
}
|
||||
|
||||
impl<E: EngineTypes, ChainSpec: EthereumHardforks> EngineApiTestContext<E, ChainSpec> {
|
||||
impl<E: EngineTypes, ChainSpec: EthereumHardforks, N: NodePrimitives>
|
||||
EngineApiTestContext<E, ChainSpec, N>
|
||||
{
|
||||
/// Retrieves a v3 payload from the engine api
|
||||
pub async fn get_payload_v3(
|
||||
&self,
|
||||
|
||||
@ -5,7 +5,6 @@ use reth_chainspec::EthChainSpec;
|
||||
use reth_db::{test_utils::TempDatabase, DatabaseEnv};
|
||||
use reth_engine_local::LocalPayloadAttributesBuilder;
|
||||
use reth_network_api::test_utils::PeersHandleProvider;
|
||||
use reth_node_api::EngineValidator;
|
||||
use reth_node_builder::{
|
||||
components::NodeComponentsBuilder,
|
||||
rpc::{EngineValidatorAddOn, RethRpcAddOns},
|
||||
@ -14,7 +13,6 @@ use reth_node_builder::{
|
||||
PayloadTypes,
|
||||
};
|
||||
use reth_node_core::args::{DiscoveryArgs, NetworkArgs, RpcServerArgs};
|
||||
use reth_primitives::EthPrimitives;
|
||||
use reth_provider::providers::{
|
||||
BlockchainProvider, BlockchainProvider2, NodeTypesForProvider, NodeTypesForTree,
|
||||
};
|
||||
@ -122,7 +120,7 @@ pub async fn setup_engine<N>(
|
||||
where
|
||||
N: Default
|
||||
+ Node<TmpNodeAdapter<N, BlockchainProvider2<NodeTypesWithDBAdapter<N, TmpDB>>>>
|
||||
+ NodeTypesWithEngine<Primitives = EthPrimitives>
|
||||
+ NodeTypesWithEngine
|
||||
+ NodeTypesForProvider,
|
||||
N::ComponentsBuilder: NodeComponentsBuilder<
|
||||
TmpNodeAdapter<N, BlockchainProvider2<NodeTypesWithDBAdapter<N, TmpDB>>>,
|
||||
@ -132,10 +130,7 @@ where
|
||||
>,
|
||||
>,
|
||||
N::AddOns: RethRpcAddOns<Adapter<N, BlockchainProvider2<NodeTypesWithDBAdapter<N, TmpDB>>>>
|
||||
+ EngineValidatorAddOn<
|
||||
Adapter<N, BlockchainProvider2<NodeTypesWithDBAdapter<N, TmpDB>>>,
|
||||
Validator: EngineValidator<N::Engine, Block = reth_primitives::Block>,
|
||||
>,
|
||||
+ EngineValidatorAddOn<Adapter<N, BlockchainProvider2<NodeTypesWithDBAdapter<N, TmpDB>>>>,
|
||||
LocalPayloadAttributesBuilder<N::ChainSpec>: PayloadAttributesBuilder<
|
||||
<<N as NodeTypesWithEngine>::Engine as PayloadTypes>::PayloadAttributes,
|
||||
>,
|
||||
|
||||
@ -4,17 +4,17 @@ use crate::{
|
||||
};
|
||||
use alloy_consensus::BlockHeader;
|
||||
use alloy_eips::BlockId;
|
||||
use alloy_primitives::{BlockHash, BlockNumber, Bytes, B256};
|
||||
use alloy_primitives::{BlockHash, BlockNumber, Bytes, Sealable, B256};
|
||||
use alloy_rpc_types_engine::PayloadStatusEnum;
|
||||
use alloy_rpc_types_eth::BlockNumberOrTag;
|
||||
use eyre::Ok;
|
||||
use futures_util::Future;
|
||||
use reth_chainspec::EthereumHardforks;
|
||||
use reth_network_api::test_utils::PeersHandleProvider;
|
||||
use reth_node_api::{Block, EngineTypes, FullNodeComponents};
|
||||
use reth_node_api::{Block, BlockTy, EngineTypes, FullNodeComponents};
|
||||
use reth_node_builder::{rpc::RethRpcAddOns, FullNode, NodeTypes, NodeTypesWithEngine};
|
||||
use reth_node_core::primitives::SignedTransaction;
|
||||
use reth_payload_primitives::{BuiltPayload, PayloadBuilderAttributes};
|
||||
use reth_primitives::EthPrimitives;
|
||||
use reth_provider::{
|
||||
BlockReader, BlockReaderIdExt, CanonStateSubscriptions, StageCheckpointReader,
|
||||
};
|
||||
@ -25,7 +25,7 @@ use tokio_stream::StreamExt;
|
||||
use url::Url;
|
||||
|
||||
/// An helper struct to handle node actions
|
||||
#[allow(missing_debug_implementations)]
|
||||
#[expect(missing_debug_implementations, clippy::complexity)]
|
||||
pub struct NodeTestContext<Node, AddOns>
|
||||
where
|
||||
Node: FullNodeComponents,
|
||||
@ -41,6 +41,7 @@ where
|
||||
pub engine_api: EngineApiTestContext<
|
||||
<Node::Types as NodeTypesWithEngine>::Engine,
|
||||
<Node::Types as NodeTypes>::ChainSpec,
|
||||
<Node::Types as NodeTypes>::Primitives,
|
||||
>,
|
||||
/// Context for testing RPC features.
|
||||
pub rpc: RpcTestContext<Node, AddOns::EthApi>,
|
||||
@ -50,11 +51,7 @@ impl<Node, Engine, AddOns> NodeTestContext<Node, AddOns>
|
||||
where
|
||||
Engine: EngineTypes,
|
||||
Node: FullNodeComponents,
|
||||
Node::Types: NodeTypesWithEngine<
|
||||
ChainSpec: EthereumHardforks,
|
||||
Engine = Engine,
|
||||
Primitives = EthPrimitives,
|
||||
>,
|
||||
Node::Types: NodeTypesWithEngine<ChainSpec: EthereumHardforks, Engine = Engine>,
|
||||
Node::Network: PeersHandleProvider,
|
||||
AddOns: RethRpcAddOns<Node>,
|
||||
{
|
||||
@ -97,7 +94,7 @@ where
|
||||
where
|
||||
Engine::ExecutionPayloadEnvelopeV3: From<Engine::BuiltPayload> + PayloadEnvelopeExt,
|
||||
Engine::ExecutionPayloadEnvelopeV4: From<Engine::BuiltPayload> + PayloadEnvelopeExt,
|
||||
AddOns::EthApi: EthApiSpec<Provider: BlockReader<Block = reth_primitives::Block>>
|
||||
AddOns::EthApi: EthApiSpec<Provider: BlockReader<Block = BlockTy<Node::Types>>>
|
||||
+ EthTransactions
|
||||
+ TraceExt,
|
||||
{
|
||||
@ -236,7 +233,7 @@ where
|
||||
// pool is actually present in the canonical block
|
||||
let head = self.engine_api.canonical_stream.next().await.unwrap();
|
||||
let tx = head.tip().transactions().first();
|
||||
assert_eq!(tx.unwrap().hash().as_slice(), tip_tx_hash.as_slice());
|
||||
assert_eq!(tx.unwrap().tx_hash().as_slice(), tip_tx_hash.as_slice());
|
||||
|
||||
loop {
|
||||
// wait for the block to commit
|
||||
|
||||
@ -2,7 +2,7 @@ use alloy_consensus::TxEnvelope;
|
||||
use alloy_network::eip2718::Decodable2718;
|
||||
use alloy_primitives::{Bytes, B256};
|
||||
use reth_chainspec::EthereumHardforks;
|
||||
use reth_node_api::{FullNodeComponents, NodePrimitives};
|
||||
use reth_node_api::{BlockTy, FullNodeComponents};
|
||||
use reth_node_builder::{rpc::RpcRegistry, NodeTypes};
|
||||
use reth_provider::BlockReader;
|
||||
use reth_rpc_api::DebugApiServer;
|
||||
@ -18,16 +18,8 @@ pub struct RpcTestContext<Node: FullNodeComponents, EthApi: EthApiTypes> {
|
||||
|
||||
impl<Node, EthApi> RpcTestContext<Node, EthApi>
|
||||
where
|
||||
Node: FullNodeComponents<
|
||||
Types: NodeTypes<
|
||||
ChainSpec: EthereumHardforks,
|
||||
Primitives: NodePrimitives<
|
||||
Block = reth_primitives::Block,
|
||||
Receipt = reth_primitives::Receipt,
|
||||
>,
|
||||
>,
|
||||
>,
|
||||
EthApi: EthApiSpec<Provider: BlockReader<Block = reth_primitives::Block>>
|
||||
Node: FullNodeComponents<Types: NodeTypes<ChainSpec: EthereumHardforks>>,
|
||||
EthApi: EthApiSpec<Provider: BlockReader<Block = BlockTy<Node::Types>>>
|
||||
+ EthTransactions
|
||||
+ TraceExt,
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user