::parse_from(["reth"]).args;
- assert_eq!(args, default_args);
- }
-}
diff --git a/bin/reth/src/ress.rs b/bin/reth/src/ress.rs
new file mode 100644
index 00000000000..0eb8480fd4b
--- /dev/null
+++ b/bin/reth/src/ress.rs
@@ -0,0 +1,67 @@
+use reth_ethereum_primitives::EthPrimitives;
+use reth_evm::execute::BlockExecutorProvider;
+use reth_network::{protocol::IntoRlpxSubProtocol, NetworkProtocols};
+use reth_network_api::FullNetwork;
+use reth_node_api::BeaconConsensusEngineEvent;
+use reth_node_core::args::RessArgs;
+use reth_provider::providers::{BlockchainProvider, ProviderNodeTypes};
+use reth_ress_protocol::{NodeType, ProtocolState, RessProtocolHandler};
+use reth_ress_provider::{maintain_pending_state, PendingState, RethRessProtocolProvider};
+use reth_tasks::TaskExecutor;
+use reth_tokio_util::EventStream;
+use tokio::sync::mpsc;
+use tracing::*;
+
+/// Install `ress` subprotocol if it's enabled.
+pub fn install_ress_subprotocol(
+ args: RessArgs,
+ provider: BlockchainProvider
,
+ block_executor: E,
+ network: N,
+ task_executor: TaskExecutor,
+ engine_events: EventStream>,
+) -> eyre::Result<()>
+where
+ P: ProviderNodeTypes,
+ E: BlockExecutorProvider + Clone,
+ N: FullNetwork + NetworkProtocols,
+{
+ info!(target: "reth::cli", "Installing ress subprotocol");
+ let pending_state = PendingState::default();
+
+ // Spawn maintenance task for pending state.
+ task_executor.spawn(maintain_pending_state(
+ engine_events,
+ provider.clone(),
+ pending_state.clone(),
+ ));
+
+ let (tx, mut rx) = mpsc::unbounded_channel();
+ let provider = RethRessProtocolProvider::new(
+ provider,
+ block_executor,
+ Box::new(task_executor.clone()),
+ args.max_witness_window,
+ args.witness_max_parallel,
+ args.witness_cache_size,
+ pending_state,
+ )?;
+ network.add_rlpx_sub_protocol(
+ RessProtocolHandler {
+ provider,
+ node_type: NodeType::Stateful,
+ peers_handle: network.peers_handle().clone(),
+ max_active_connections: args.max_active_connections,
+ state: ProtocolState::new(tx),
+ }
+ .into_rlpx_sub_protocol(),
+ );
+ info!(target: "reth::cli", "Ress subprotocol support enabled");
+
+ task_executor.spawn(async move {
+ while let Some(event) = rx.recv().await {
+ trace!(target: "reth::ress", ?event, "Received ress event");
+ }
+ });
+ Ok(())
+}
diff --git a/bin/reth/tests/commands/bitfinity_import_it.rs b/bin/reth/tests/commands/bitfinity_import_it.rs
index 0892934d5a4..2405f3e0d18 100644
--- a/bin/reth/tests/commands/bitfinity_import_it.rs
+++ b/bin/reth/tests/commands/bitfinity_import_it.rs
@@ -503,7 +503,6 @@ fn compute_state_root(genesis_balances: &[(Address, U256)]) -> H256 {
..Default::default()
},
hardforks: Default::default(),
- genesis_hash: Default::default(),
paris_block_and_final_difficulty: None,
deposit_contract: None,
..Default::default()
diff --git a/bin/reth/tests/commands/bitfinity_node_it.rs b/bin/reth/tests/commands/bitfinity_node_it.rs
index f4271db2615..839614b5161 100644
--- a/bin/reth/tests/commands/bitfinity_node_it.rs
+++ b/bin/reth/tests/commands/bitfinity_node_it.rs
@@ -2,7 +2,7 @@
//! Integration tests for the bitfinity node command.
use super::utils::*;
-use did::keccak;
+use did::{keccak, rpc::{id::Id, params::Params}};
use eth_server::{EthImpl, EthServer};
use ethereum_json_rpc_client::{reqwest::ReqwestClient, CertifiedResult, EthJsonRpcClient};
use jsonrpsee::{
@@ -19,23 +19,20 @@ use reth_db::test_utils::TempDatabase;
use reth_db::DatabaseEnv;
use reth_db::{init_db, test_utils::tempdir_path};
use reth_discv5::discv5::enr::secp256k1::{Keypair, Secp256k1};
-use reth_network::NetworkHandle;
-use reth_node_api::{FullNodeTypesAdapter, NodeTypesWithDBAdapter};
-use reth_node_builder::components::Components;
-use reth_node_builder::engine_tree_config::TreeConfig;
-use reth_node_builder::rpc::RpcAddOns;
+use reth_errors::ConsensusError;
+use reth_network::EthNetworkPrimitives;
+use reth_node_api::{FullNodeTypesAdapter, NodeTypesWithDBAdapter, TreeConfig};
use reth_node_builder::{EngineNodeLauncher, NodeAdapter, NodeBuilder, NodeConfig, NodeHandle};
-use reth_node_ethereum::node::{EthereumAddOns, EthereumEngineValidatorBuilder};
+use reth_node_ethereum::node::EthereumAddOns;
use reth_node_ethereum::{
- BasicBlockExecutorProvider, EthEvmConfig, EthExecutionStrategyFactory, EthereumNode,
+ BasicBlockExecutorProvider, EthEvmConfig, EthereumNode,
};
-use reth_primitives::{Transaction, TransactionSigned};
-use reth_provider::providers::BlockchainProvider2;
-use reth_rpc::EthApi;
+use reth_primitives::{EthPrimitives, Transaction, TransactionSigned};
+use reth_provider::providers::BlockchainProvider;
use reth_tasks::TaskManager;
use reth_transaction_pool::{
blobstore::DiskFileBlobStore, CoinbaseTipOrdering, EthPooledTransaction,
- EthTransactionValidator, Pool, TransactionValidationTaskExecutor,
+ EthTransactionValidator, TransactionValidationTaskExecutor,
};
use revm_primitives::{hex, Address, B256, U256};
use std::{net::SocketAddr, str::FromStr, sync::Arc};
@@ -65,8 +62,8 @@ async fn bitfinity_test_lb_lag_check() {
let result: String = reth_client
.single_request(
"eth_lbLagCheck".to_owned(),
- ethereum_json_rpc_client::Params::Array(vec![10.into()]),
- ethereum_json_rpc_client::Id::Num(1),
+ Params::Array(vec![10.into()]),
+ Id::Number(1),
)
.await
.unwrap();
@@ -83,8 +80,8 @@ async fn bitfinity_test_lb_lag_check() {
let result = reth_client
.single_request::(
"eth_lbLagCheck".to_owned(),
- ethereum_json_rpc_client::Params::Array(vec![5.into()]),
- ethereum_json_rpc_client::Id::Num(1),
+ Params::Array(vec![5.into()]),
+ Id::Number(1),
)
.await;
if let Ok(message) = result {
@@ -101,8 +98,8 @@ async fn bitfinity_test_lb_lag_check() {
let result: String = reth_client
.single_request(
"eth_lbLagCheck".to_owned(),
- ethereum_json_rpc_client::Params::Array(vec![1000.into()]),
- ethereum_json_rpc_client::Id::Num(1),
+ Params::Array(vec![1000.into()]),
+ Id::Number(1),
)
.await
.unwrap();
@@ -118,8 +115,8 @@ async fn bitfinity_test_lb_lag_check_fail_safe() {
let message: String = reth_client
.single_request(
"eth_lbLagCheck".to_owned(),
- ethereum_json_rpc_client::Params::Array(vec![1000.into()]),
- ethereum_json_rpc_client::Id::Num(1),
+ Params::Array(vec![1000.into()]),
+ Id::Number(1),
)
.await
.unwrap();
@@ -150,8 +147,8 @@ async fn bitfinity_test_node_forward_ic_or_eth_get_last_certified_block() {
let result: CertifiedResult> = reth_client
.single_request(
"eth_getLastCertifiedBlock".to_owned(),
- ethereum_json_rpc_client::Params::None,
- ethereum_json_rpc_client::Id::Num(1),
+ Params::None,
+ Id::Number(1),
)
.await
.unwrap();
@@ -216,8 +213,8 @@ async fn bitfinity_test_node_forward_eth_get_genesis_balances() {
let result: Vec<(did::H160, did::U256)> = reth_client
.single_request(
"eth_getGenesisBalances".to_owned(),
- ethereum_json_rpc_client::Params::None,
- ethereum_json_rpc_client::Id::Num(1),
+ Params::None,
+ Id::Number(1),
)
.await
.unwrap();
@@ -319,6 +316,7 @@ fn sign_tx_with_random_key_pair(tx: Transaction) -> TransactionSigned {
}
fn sign_tx_with_key_pair(key_pair: Keypair, tx: Transaction) -> TransactionSigned {
+ use alloy_consensus::SignableTransaction;
let signature = reth_primitives::sign_message(
B256::from_slice(&key_pair.secret_bytes()[..]),
tx.signature_hash(),
@@ -331,111 +329,8 @@ fn sign_tx_with_key_pair(key_pair: Keypair, tx: Transaction) -> TransactionSigne
pub async fn start_reth_node(
bitfinity_evm_url: Option,
import_data: Option,
-) -> (
- EthJsonRpcClient,
- NodeHandle<
- NodeAdapter<
- FullNodeTypesAdapter<
- EthereumNode,
- Arc>,
- BlockchainProvider2<
- NodeTypesWithDBAdapter>>,
- >,
- >,
- Components<
- FullNodeTypesAdapter<
- EthereumNode,
- Arc>,
- BlockchainProvider2<
- NodeTypesWithDBAdapter>>,
- >,
- >,
- reth_network::EthNetworkPrimitives,
- Pool<
- TransactionValidationTaskExecutor<
- EthTransactionValidator<
- BlockchainProvider2<
- NodeTypesWithDBAdapter<
- EthereumNode,
- Arc>,
- >,
- >,
- EthPooledTransaction,
- >,
- >,
- CoinbaseTipOrdering,
- DiskFileBlobStore,
- >,
- EthEvmConfig,
- BasicBlockExecutorProvider,
- Arc,
- >,
- >,
- RpcAddOns<
- NodeAdapter<
- FullNodeTypesAdapter<
- EthereumNode,
- Arc