Skip to content

Commit

Permalink
Merge pull request #24 from Arindam2407/revert-23-reorged_logs
Browse files Browse the repository at this point in the history
"Reorged logs support initial changes"
  • Loading branch information
Arindam2407 authored Dec 22, 2023
2 parents a3655fb + 5b0a398 commit 63a3020
Show file tree
Hide file tree
Showing 9 changed files with 82 additions and 235 deletions.
94 changes: 47 additions & 47 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions bin/reth/src/args/rpc_server_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,16 +283,14 @@ impl RpcServerArgs {
}

/// Create Engine API server.
#[allow(clippy::too_many_arguments)]
pub async fn start_auth_server<Provider, Pool, Network, Tasks, Events>(
pub async fn start_auth_server<Provider, Pool, Network, Tasks>(
&self,
provider: Provider,
pool: Pool,
network: Network,
executor: Tasks,
engine_api: EngineApi<Provider>,
jwt_secret: JwtSecret,
events: Events,
) -> Result<AuthServerHandle, RpcError>
where
Provider: BlockReaderIdExt
Expand All @@ -306,7 +304,6 @@ impl RpcServerArgs {
Pool: TransactionPool + Clone + 'static,
Network: NetworkInfo + Peers + Clone + 'static,
Tasks: TaskSpawner + Clone + 'static,
Events: CanonStateSubscriptions + Clone + 'static,
{
let socket_address = SocketAddr::new(self.auth_addr, self.auth_port);

Expand All @@ -318,7 +315,6 @@ impl RpcServerArgs {
engine_api,
socket_address,
jwt_secret,
events,
)
.await
}
Expand Down
34 changes: 9 additions & 25 deletions crates/rpc/rpc-builder/src/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ use jsonrpsee::{
};
use reth_network_api::{NetworkInfo, Peers};
use reth_provider::{
BlockReaderIdExt, CanonStateSubscriptions, ChainSpecProvider, EvmEnvProvider, HeaderProvider,
ReceiptProviderIdExt, StateProviderFactory,
BlockReaderIdExt, ChainSpecProvider, EvmEnvProvider, HeaderProvider, ReceiptProviderIdExt,
StateProviderFactory,
};
use reth_rpc::{
eth::{
cache::EthStateCache, gas_oracle::GasPriceOracle, EthFilterConfig, FeeHistoryCache,
FeeHistoryCacheConfig,
},
AuthLayer, BlockingTaskPool, Claims, EngineEthApi, EthApi, EthFilter, EthPubSub,
AuthLayer, BlockingTaskPool, Claims, EngineEthApi, EthApi, EthFilter,
EthSubscriptionIdProvider, JwtAuthValidator, JwtSecret,
};
use reth_rpc_api::{servers::*, EngineApiServer};
Expand All @@ -33,15 +33,14 @@ use std::{

/// Configure and launch a _standalone_ auth server with `engine` and a _new_ `eth` namespace.
#[allow(clippy::too_many_arguments)]
pub async fn launch<Provider, Pool, Network, Tasks, EngineApi, Events>(
pub async fn launch<Provider, Pool, Network, Tasks, EngineApi>(
provider: Provider,
pool: Pool,
network: Network,
executor: Tasks,
engine_api: EngineApi,
socket_addr: SocketAddr,
secret: JwtSecret,
events: Events,
) -> Result<AuthServerHandle, RpcError>
where
Provider: BlockReaderIdExt
Expand All @@ -57,7 +56,6 @@ where
Network: NetworkInfo + Peers + Clone + 'static,
Tasks: TaskSpawner + Clone + 'static,
EngineApi: EngineApiServer,
Events: CanonStateSubscriptions + Clone + 'static,
{
// spawn a new cache task
let eth_cache =
Expand All @@ -70,7 +68,7 @@ where
let eth_api = EthApi::with_spawner(
provider.clone(),
pool.clone(),
network.clone(),
network,
eth_cache.clone(),
gas_oracle,
EthConfig::default().rpc_gas_cap,
Expand All @@ -81,28 +79,15 @@ where
let config = EthFilterConfig::default()
.max_logs_per_response(DEFAULT_MAX_LOGS_PER_RESPONSE)
.max_blocks_per_filter(DEFAULT_MAX_BLOCKS_PER_FILTER);
let eth_pubsub = EthPubSub::with_spawner(
provider.clone(),
pool.clone(),
events.clone(),
network.clone(),
Box::new(executor.clone()),
);
let eth_filter = EthFilter::new(
provider.clone(),
pool.clone(),
eth_cache.clone(),
config,
Box::new(executor.clone()),
eth_pubsub.clone(),
);
let eth_filter =
EthFilter::new(provider, pool, eth_cache.clone(), config, Box::new(executor.clone()));
launch_with_eth_api(eth_api, eth_filter, engine_api, socket_addr, secret).await
}

/// Configure and launch a _standalone_ auth server with existing EthApi implementation.
pub async fn launch_with_eth_api<Provider, Pool, Network, EngineApi, Events>(
pub async fn launch_with_eth_api<Provider, Pool, Network, EngineApi>(
eth_api: EthApi<Provider, Pool, Network>,
eth_filter: EthFilter<Provider, Pool, Events, Network>,
eth_filter: EthFilter<Provider, Pool>,
engine_api: EngineApi,
socket_addr: SocketAddr,
secret: JwtSecret,
Expand All @@ -119,7 +104,6 @@ where
Pool: TransactionPool + Clone + 'static,
Network: NetworkInfo + Peers + Clone + 'static,
EngineApi: EngineApiServer,
Events: CanonStateSubscriptions + Clone + 'static,
{
// Configure the module and start the server.
let mut module = RpcModule::new(());
Expand Down
Loading

0 comments on commit 63a3020

Please sign in to comment.