Skip to content

Commit 2090dda

Browse files
authored
Merge pull request #3225 from Pana/feat/removeLegacyERpc
remove legacy eSpace RPC impl
2 parents 8614366 + fbc1baa commit 2090dda

File tree

47 files changed

+171
-2327
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+171
-2327
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/client/src/common/mod.rs

Lines changed: 8 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,12 @@ use crate::{
6969
extractor::RpcExtractor,
7070
impls::{
7171
cfx::RpcImpl, common::RpcImpl as CommonRpcImpl,
72-
eth_pubsub::PubSubClient as EthPubSubClient, pubsub::PubSubClient,
72+
pubsub::PubSubClient,
7373
},
74-
launch_async_rpc_servers, setup_debug_rpc_apis,
75-
setup_public_eth_rpc_apis, setup_public_rpc_apis,
74+
launch_async_rpc_servers, setup_debug_rpc_apis, setup_public_rpc_apis,
7675
},
7776
};
7877
use cfxcore::consensus::pos_handler::read_initial_nodes_from_file;
79-
use std::net::SocketAddr;
8078

8179
pub mod delegate_convert;
8280
pub mod shutdown_handler;
@@ -155,7 +153,6 @@ pub fn initialize_common_modules(
155153
Arc<AccountProvider>,
156154
Arc<Notifications>,
157155
PubSubClient,
158-
EthPubSubClient,
159156
Arc<TokioRuntime>,
160157
),
161158
String,
@@ -468,12 +465,6 @@ pub fn initialize_common_modules(
468465
*network.get_network_type(),
469466
);
470467

471-
let eth_pubsub = EthPubSubClient::new(
472-
tokio_runtime.clone(),
473-
consensus.clone(),
474-
notifications.clone(),
475-
);
476-
477468
Ok((
478469
machine,
479470
secret_store,
@@ -489,7 +480,6 @@ pub fn initialize_common_modules(
489480
accounts,
490481
notifications,
491482
pubsub,
492-
eth_pubsub,
493483
tokio_runtime,
494484
))
495485
}
@@ -512,8 +502,6 @@ pub fn initialize_not_light_node_modules(
512502
Option<WSServer>,
513503
Option<WSServer>,
514504
Arc<PosVerifier>,
515-
Option<HttpServer>,
516-
Option<WSServer>,
517505
Arc<TokioRuntime>,
518506
Option<RpcServerHandle>,
519507
TaskManager,
@@ -533,9 +521,8 @@ pub fn initialize_not_light_node_modules(
533521
network,
534522
common_impl,
535523
accounts,
536-
_notifications,
524+
notifications,
537525
pubsub,
538-
eth_pubsub,
539526
tokio_runtime,
540527
) = initialize_common_modules(conf, exit.clone(), node_type)?;
541528

@@ -677,7 +664,6 @@ pub fn initialize_not_light_node_modules(
677664
common_impl.clone(),
678665
rpc_impl.clone(),
679666
pubsub.clone(),
680-
eth_pubsub.clone(),
681667
&conf,
682668
),
683669
)?;
@@ -688,7 +674,6 @@ pub fn initialize_not_light_node_modules(
688674
common_impl.clone(),
689675
rpc_impl.clone(),
690676
pubsub.clone(),
691-
eth_pubsub.clone(),
692677
&conf,
693678
),
694679
RpcExtractor,
@@ -700,7 +685,6 @@ pub fn initialize_not_light_node_modules(
700685
common_impl.clone(),
701686
rpc_impl.clone(),
702687
pubsub.clone(),
703-
eth_pubsub.clone(),
704688
&conf,
705689
),
706690
RpcExtractor,
@@ -712,7 +696,6 @@ pub fn initialize_not_light_node_modules(
712696
common_impl.clone(),
713697
rpc_impl.clone(),
714698
pubsub.clone(),
715-
eth_pubsub.clone(),
716699
&conf,
717700
),
718701
RpcExtractor,
@@ -724,62 +707,26 @@ pub fn initialize_not_light_node_modules(
724707
common_impl.clone(),
725708
rpc_impl.clone(),
726709
pubsub.clone(),
727-
eth_pubsub.clone(),
728710
&conf,
729711
),
730712
RpcExtractor,
731713
)?;
732714

733-
let eth_rpc_http_server = super::rpc::start_http(
734-
conf.eth_http_config(),
735-
setup_public_eth_rpc_apis(
736-
rpc_impl.clone(),
737-
eth_pubsub.clone(),
738-
&conf,
739-
task_executor.clone(),
740-
),
741-
)?;
742-
743-
let eth_rpc_ws_server = super::rpc::start_ws(
744-
conf.eth_ws_config(),
745-
setup_public_eth_rpc_apis(
746-
rpc_impl.clone(),
747-
eth_pubsub.clone(),
748-
&conf,
749-
task_executor.clone(),
750-
),
751-
RpcExtractor,
752-
)?;
753-
754715
let rpc_http_server = super::rpc::start_http(
755716
conf.http_config(),
756-
setup_public_rpc_apis(
757-
common_impl,
758-
rpc_impl,
759-
pubsub,
760-
eth_pubsub.clone(),
761-
&conf,
762-
),
717+
setup_public_rpc_apis(common_impl, rpc_impl, pubsub, &conf),
763718
)?;
764719

765720
network.start();
766721

767-
let eth_rpc_http_server_addr =
768-
conf.raw_conf.jsonrpc_http_eth_port_v2.map(|port| {
769-
format!("0.0.0.0:{}", port)
770-
.parse::<SocketAddr>()
771-
.expect("Invalid socket port")
772-
});
773-
let async_eth_rpc_http_server =
722+
let eth_rpc_server_handle =
774723
tokio_runtime.block_on(launch_async_rpc_servers(
775-
conf.rpc_impl_config(),
776-
conf.raw_conf.throttling_conf.clone(),
777-
conf.raw_conf.public_evm_rpc_async_apis.clone(),
778724
consensus.clone(),
779725
sync.clone(),
780726
txpool.clone(),
781-
eth_rpc_http_server_addr,
727+
notifications.clone(),
782728
task_executor.clone(),
729+
conf,
783730
))?;
784731

785732
metrics::initialize(conf.metrics_config(), task_executor.clone());
@@ -798,10 +745,8 @@ pub fn initialize_not_light_node_modules(
798745
debug_rpc_ws_server,
799746
rpc_ws_server,
800747
pos_verifier,
801-
eth_rpc_http_server,
802-
eth_rpc_ws_server,
803748
tokio_runtime,
804-
async_eth_rpc_http_server,
749+
eth_rpc_server_handle,
805750
task_manager,
806751
))
807752
}

crates/client/src/node_types/archive.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ pub struct ArchiveClientExtraComponents {
3333
pub sync: Arc<SynchronizationService>,
3434
pub txpool: Arc<TransactionPool>,
3535
pub pow: Arc<PowComputer>,
36-
pub eth_rpc_http_server: Option<HttpServer>,
37-
pub eth_rpc_ws_server: Option<WsServer>,
3836
/// Handle to the started ETH RPC server. This is version 2 of the ETH RPC.
3937
/// Which use Rust async I/O
4038
pub eth_rpc_server_handle: Option<RpcServerHandle>,
@@ -77,8 +75,6 @@ impl ArchiveClient {
7775
debug_rpc_ws_server,
7876
rpc_ws_server,
7977
pos_handler,
80-
eth_rpc_http_server,
81-
eth_rpc_ws_server,
8278
tokio_runtime,
8379
eth_rpc_server_handle,
8480
task_manager,
@@ -102,8 +98,6 @@ impl ArchiveClient {
10298
sync,
10399
txpool,
104100
pow,
105-
eth_rpc_http_server,
106-
eth_rpc_ws_server,
107101
eth_rpc_server_handle,
108102
tokio_runtime,
109103
task_manager,

crates/client/src/node_types/full.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ pub struct FullClientExtraComponents {
3333
pub sync: Arc<SynchronizationService>,
3434
pub txpool: Arc<TransactionPool>,
3535
pub pow: Arc<PowComputer>,
36-
pub eth_rpc_http_server: Option<HttpServer>,
37-
pub eth_rpc_ws_server: Option<WsServer>,
3836
/// Handle to the started ETH RPC server. This is version 2 of the ETH RPC.
3937
/// Which use Rust async I/O
4038
pub eth_rpc_server_handle: Option<RpcServerHandle>,
@@ -70,8 +68,6 @@ impl FullClient {
7068
debug_rpc_ws_server,
7169
rpc_ws_server,
7270
pos_handler,
73-
eth_rpc_http_server,
74-
eth_rpc_ws_server,
7571
tokio_runtime,
7672
eth_rpc_server_handle,
7773
task_manager,
@@ -91,8 +87,6 @@ impl FullClient {
9187
sync,
9288
txpool,
9389
pow,
94-
eth_rpc_http_server,
95-
eth_rpc_ws_server,
9690
eth_rpc_server_handle,
9791
tokio_runtime,
9892
task_manager,

crates/client/src/node_types/light.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ impl LightClient {
6969
accounts,
7070
notifications,
7171
pubsub,
72-
_eth_pubsub,
7372
_tokio_runtime,
7473
) = initialize_common_modules(
7574
&mut conf,

crates/client/src/rpc/apis.rs

Lines changed: 0 additions & 1 deletion
This file was deleted.

crates/client/src/rpc/impls/cfx/cfx_handler.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ use cfx_executor::{
2323
executive::{ExecutionError, ExecutionOutcome, TxDropError},
2424
internal_contract::storage_point_prop,
2525
};
26+
use cfx_rpc_eth_types::Transaction as EthTransaction;
2627
use cfx_statedb::{
2728
global_params::{
2829
AccumulateInterestRate, BaseFeeProp, DistributablePoSInterest,
@@ -83,8 +84,7 @@ use crate::{
8384
},
8485
traits::{cfx::Cfx, debug::LocalRpc, test::TestRpc},
8586
types::{
86-
eth::Transaction as EthTransaction, pos::Block as PosBlock,
87-
Account as RpcAccount, AccountPendingInfo,
87+
pos::Block as PosBlock, Account as RpcAccount, AccountPendingInfo,
8888
AccountPendingTransactions, BlameInfo, Block as RpcBlock,
8989
BlockHashOrEpochNumber, Bytes, CfxRpcLogFilter,
9090
CheckBalanceAgainstTransactionResponse, ConsensusGraphStates,

crates/client/src/rpc/impls/cfx/pubsub.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ use cfx_parameters::{
1818
consensus_internal::REWARD_EPOCH_COUNT,
1919
};
2020
use cfx_types::{Space, H256};
21-
use cfxcore::{BlockDataManager, Notifications, SharedConsensusGraph};
21+
use cfxcore::{
22+
channel::Channel, BlockDataManager, Notifications, SharedConsensusGraph,
23+
};
2224
use futures::future::join_all;
2325
use itertools::zip;
2426
use jsonrpc_core::Result as RpcResult;
@@ -78,6 +80,10 @@ impl PubSubClient {
7880
}
7981
}
8082

83+
pub fn epochs_ordered(&self) -> Arc<Channel<(u64, Vec<H256>)>> {
84+
self.notifications.epochs_ordered.clone()
85+
}
86+
8187
/// Returns a chain notification handler.
8288
pub fn handler(&self) -> Weak<ChainNotificationHandler> {
8389
Arc::downgrade(&self.handler)

crates/client/src/rpc/impls/cfx/trace.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,14 @@ use crate::{
1010
EpochNumber as RpcEpochNumber, LocalizedBlockTrace, LocalizedTrace,
1111
TraceFilter as RpcTraceFilter,
1212
},
13-
CoreResult,
1413
},
1514
};
1615
use cfx_addr::Network;
17-
use cfx_execute_helper::exec_tracer::TraceFilter as PrimitiveTraceFilter;
18-
use cfx_parity_trace_types::LocalizedTrace as PrimitiveLocalizedTrace;
1916
use cfx_rpc_cfx_impl::TraceHandler as CfxTraceHandler;
2017
use cfx_rpc_cfx_types::trace::EpochTrace;
2118
use cfx_types::H256;
2219

23-
use cfxcore::{ConsensusGraph, SharedConsensusGraph};
20+
use cfxcore::SharedConsensusGraph;
2421
use jsonrpc_core::Result as JsonRpcResult;
2522

2623
#[derive(Clone)]
@@ -34,16 +31,6 @@ impl TraceHandler {
3431
inner: CfxTraceHandler::new(network, consensus),
3532
}
3633
}
37-
38-
pub(crate) fn consensus_graph(&self) -> &ConsensusGraph {
39-
self.inner.consensus_graph()
40-
}
41-
42-
pub(crate) fn filter_primitives_traces_impl(
43-
&self, filter: PrimitiveTraceFilter,
44-
) -> CoreResult<Option<Vec<PrimitiveLocalizedTrace>>> {
45-
self.inner.filter_primitives_traces_impl(filter)
46-
}
4734
}
4835

4936
impl Trace for TraceHandler {

0 commit comments

Comments
 (0)