Skip to content

Commit 305767d

Browse files
authored
Try to use standard frontier (#3841)
* init * update * remove tracing completely * fix * revert * update
1 parent 4ab93b4 commit 305767d

File tree

32 files changed

+3436
-3625
lines changed

32 files changed

+3436
-3625
lines changed

parachain/Cargo.lock

Lines changed: 2706 additions & 2138 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

parachain/Cargo.toml

Lines changed: 135 additions & 144 deletions
Large diffs are not rendered by default.

parachain/node/Cargo.toml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,6 @@ fc-rpc-core = { workspace = true }
7676
fc-storage = { workspace = true }
7777
fp-rpc = { workspace = true }
7878

79-
moonbeam-primitives-ext = { workspace = true, features = ["std"] }
80-
moonbeam-rpc-debug = { workspace = true }
81-
moonbeam-rpc-primitives-debug = { workspace = true, features = ["std"] }
82-
moonbeam-rpc-primitives-txpool = { workspace = true, features = ["std"] }
83-
moonbeam-rpc-trace = { workspace = true }
84-
8579
cumulus-client-cli = { workspace = true }
8680
cumulus-client-collator = { workspace = true }
8781
cumulus-client-consensus-aura = { workspace = true }

parachain/node/src/cli.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with Litentry. If not, see <https://www.gnu.org/licenses/>.
1616

17-
use crate::{chain_specs, evm_tracing_types::EthApiOptions};
17+
use crate::chain_specs;
1818
use clap::Parser;
1919
use std::path::PathBuf;
2020

@@ -87,9 +87,6 @@ pub struct Cli {
8787
#[arg(raw = true)]
8888
pub relaychain_args: Vec<String>,
8989

90-
#[clap(flatten)]
91-
pub eth_api_options: EthApiOptions,
92-
9390
/// Enable Ethereum compatible JSON-RPC servers (disabled by default).
9491
#[clap(name = "enable-evm-rpc", long)]
9592
pub enable_evm_rpc: bool,

parachain/node/src/command.rs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -305,22 +305,9 @@ pub fn run() -> Result<()> {
305305
let collator_options = cli.run.collator_options();
306306
let is_standalone = runner.config().chain_spec.is_standalone();
307307

308-
let evm_tracing_config = crate::evm_tracing_types::EvmTracingConfig {
309-
ethapi: cli.eth_api_options.ethapi,
310-
ethapi_max_permits: cli.eth_api_options.ethapi_max_permits,
311-
ethapi_trace_max_count: cli.eth_api_options.ethapi_trace_max_count,
312-
ethapi_trace_cache_duration: cli.eth_api_options.ethapi_trace_cache_duration,
313-
eth_log_block_cache: cli.eth_api_options.eth_log_block_cache,
314-
eth_statuses_cache: cli.eth_api_options.eth_statuses_cache,
315-
max_past_logs: cli.eth_api_options.max_past_logs,
316-
tracing_raw_max_memory_usage: cli.eth_api_options.tracing_raw_max_memory_usage,
317-
};
318-
319308
runner.run_node_until_exit(|config| async move {
320309
if is_standalone {
321-
return start_standalone_node(config, evm_tracing_config)
322-
.await
323-
.map_err(Into::into);
310+
return start_standalone_node(config).await.map_err(Into::into);
324311
}
325312

326313
let hwbench = if !cli.no_hardware_benchmarks {
@@ -360,8 +347,7 @@ pub fn run() -> Result<()> {
360347
info!("Parachain Account: {}", parachain_account);
361348
info!("Is collating: {}", if config.role.is_authority() { "yes" } else { "no" });
362349

363-
let additional_config =
364-
AdditionalConfig { evm_tracing_config, enable_evm_rpc: cli.enable_evm_rpc };
350+
let additional_config = AdditionalConfig { enable_evm_rpc: cli.enable_evm_rpc };
365351

366352
if config.chain_spec.is_standalone() {
367353
Err(UNSUPPORTED_CHAIN_MESSAGE.into())

parachain/node/src/evm_tracing_types.rs

Lines changed: 0 additions & 107 deletions
This file was deleted.

parachain/node/src/fake_runtime_api.rs

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -299,35 +299,4 @@ sp_api::impl_runtime_apis! {
299299
unimplemented!()
300300
}
301301
}
302-
303-
impl moonbeam_rpc_primitives_debug::DebugRuntimeApi<Block> for Runtime {
304-
fn trace_transaction(_extrinsics: Vec<<Block as BlockT>::Extrinsic>, _traced_transaction: &pallet_ethereum::Transaction, _header: &<Block as BlockT>::Header) -> Result<(), sp_runtime::DispatchError> {
305-
unimplemented!()
306-
}
307-
308-
fn trace_block(_extrinsics: Vec<<Block as BlockT>::Extrinsic>, _known_transactions: Vec<H256>, _header: &<Block as BlockT>::Header) -> Result<(), sp_runtime::DispatchError> {
309-
unimplemented!()
310-
}
311-
312-
fn trace_call(
313-
_header: &<Block as BlockT>::Header,
314-
_from: H160,
315-
_to: H160,
316-
_data: Vec<u8>,
317-
_value: U256,
318-
_gas_limit: U256,
319-
_max_fee_per_gas: Option<U256>,
320-
_max_priority_fee_per_gas: Option<U256>,
321-
_nonce: Option<U256>,
322-
_access_list: Option<Vec<(H160, Vec<H256>)>>,
323-
) -> Result<(), sp_runtime::DispatchError> {
324-
unimplemented!()
325-
}
326-
}
327-
328-
impl moonbeam_rpc_primitives_txpool::TxPoolRuntimeApi<Block> for Runtime {
329-
fn extrinsic_filter(_xts_ready: Vec<<Block as BlockT>::Extrinsic>, _xts_future: Vec<<Block as BlockT>::Extrinsic>) -> moonbeam_rpc_primitives_txpool::TxPoolResponse {
330-
unimplemented!()
331-
}
332-
}
333302
}

parachain/node/src/main.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,10 @@
2020
mod chain_specs;
2121
mod cli;
2222
mod command;
23-
mod evm_tracing_types;
2423
mod fake_runtime_api;
2524
mod rpc;
2625
mod service;
2726
mod standalone_block_import;
28-
mod tracing;
2927

3028
fn main() -> sc_cli::Result<()> {
3129
command::run()

parachain/node/src/rpc.rs

Lines changed: 10 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
// This File should be safe to delete once All parachain matrix are EVM impl.
1919
#![warn(missing_docs)]
2020

21-
use cumulus_primitives_parachain_inherent::ParachainInherentData;
22-
use cumulus_test_relay_sproof_builder::RelayStateSproofBuilder;
2321
use fc_rpc::{
2422
pending::ConsensusDataProvider, Eth, EthApiServer, EthBlockDataCacheTask, EthFilter,
2523
EthFilterApiServer, EthPubSub, EthPubSubApiServer, Net, NetApiServer, TxPool, TxPoolApiServer,
@@ -28,15 +26,13 @@ use fc_rpc::{
2826
use fc_rpc_core::types::{FeeHistoryCache, FilterPool};
2927
use fc_storage::StorageOverride;
3028
use heima_primitives::{AccountId, Balance, Block, Nonce};
31-
use moonbeam_rpc_debug::{Debug, DebugServer};
32-
use moonbeam_rpc_trace::{Trace, TraceServer};
33-
use polkadot_primitives::PersistedValidationData;
3429
use sc_client_api::{
3530
AuxStore, Backend, BlockchainEvents, StateBackend, StorageProvider, UsageProvider,
3631
};
3732
use sc_network::service::traits::NetworkService;
3833
use sc_network_sync::SyncingService;
3934
pub use sc_rpc::SubscriptionTaskExecutor;
35+
use sc_transaction_pool::{ChainApi, Pool};
4036
use sc_transaction_pool_api::TransactionPool;
4137
use sp_api::{CallApiAt, ProvideRuntimeApi};
4238
use sp_block_builder::BlockBuilder;
@@ -47,20 +43,11 @@ use sp_consensus_aura::{sr25519::AuthorityId as AuraId, AuraApi};
4743
use sp_runtime::traits::{BlakeTwo256, Block as BlockT};
4844
use std::sync::Arc;
4945

50-
use crate::tracing;
51-
5246
type HashFor<Block> = <Block as BlockT>::Hash;
5347

5448
/// A type representing all RPC extensions.
5549
pub type RpcExtension = jsonrpsee::RpcModule<()>;
5650

57-
#[derive(Clone)]
58-
pub struct EvmTracingConfig {
59-
pub tracing_requesters: tracing::RpcRequesters,
60-
pub trace_filter_max_count: u32,
61-
pub enable_txpool: bool,
62-
}
63-
6451
// TODO This is copied from frontier. It should be imported instead after
6552
// https://github.com/paritytech/frontier/issues/333 is solved
6653
pub fn open_frontier_backend<C>(
@@ -97,13 +84,13 @@ where
9784
}
9885

9986
/// Full client dependencies
100-
pub struct FullDeps<C, P> {
87+
pub struct FullDeps<C, P, A: ChainApi> {
10188
/// The client instance to use.
10289
pub client: Arc<C>,
10390
/// Transaction pool instance.
10491
pub pool: Arc<P>,
10592
/// Graph pool instance.
106-
pub graph: Arc<P>,
93+
pub graph: Arc<Pool<A>>,
10794
/// Network service
10895
pub network: Arc<dyn NetworkService>,
10996
/// Chain syncing service
@@ -127,16 +114,15 @@ pub struct FullDeps<C, P> {
127114
}
128115

129116
/// Instantiate all RPC extensions.
130-
pub fn create_full<C, P, BE>(
131-
deps: FullDeps<C, P>,
117+
pub fn create_full<C, P, BE, A>(
118+
deps: FullDeps<C, P, A>,
132119
subscription_task_executor: SubscriptionTaskExecutor,
133120
pubsub_notification_sinks: Arc<
134121
fc_mapping_sync::EthereumBlockNotificationSinks<
135122
fc_mapping_sync::EthereumBlockNotification<Block>,
136123
>,
137124
>,
138125
pending_consenus_data_provider: Box<dyn ConsensusDataProvider<Block>>,
139-
tracing_config: EvmTracingConfig,
140126
) -> Result<RpcExtension, Box<dyn std::error::Error + Send + Sync>>
141127
where
142128
C: ProvideRuntimeApi<Block>
@@ -156,10 +142,9 @@ where
156142
+ fp_rpc::ConvertTransactionRuntimeApi<Block>
157143
+ fp_rpc::EthereumRuntimeRPCApi<Block>
158144
+ BlockBuilder<Block>
159-
+ AuraApi<Block, AuraId>
160-
+ moonbeam_rpc_primitives_debug::DebugRuntimeApi<Block>
161-
+ moonbeam_rpc_primitives_txpool::TxPoolRuntimeApi<Block>,
145+
+ AuraApi<Block, AuraId>,
162146
P: TransactionPool<Block = Block, Hash = HashFor<Block>> + Sync + Send + 'static,
147+
A: ChainApi<Block = Block> + 'static,
163148
BE: Backend<Block> + 'static,
164149
BE::State: StateBackend<BlakeTwo256>,
165150
BE::Blockchain: BlockchainBackend<Block>,
@@ -206,30 +191,11 @@ where
206191
*timestamp,
207192
slot_duration,
208193
);
209-
// Create a dummy parachain inherent data provider which is required to pass
210-
// the checks by the para chain system. We use dummy values because in the 'pending
211-
// context' neither do we have access to the real values nor do we need them.
212-
let (relay_parent_storage_root, relay_chain_state) =
213-
RelayStateSproofBuilder::default().into_state_root_and_proof();
214-
let vfp = PersistedValidationData {
215-
// This is a hack to make
216-
// `cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases` happy. Relay
217-
// parent number can't be bigger than u32::MAX.
218-
relay_parent_number: u32::MAX,
219-
relay_parent_storage_root,
220-
..Default::default()
221-
};
222-
let parachain_inherent_data = ParachainInherentData {
223-
validation_data: vfp,
224-
relay_chain_state,
225-
downward_messages: Default::default(),
226-
horizontal_messages: Default::default(),
227-
};
228-
Ok((slot, timestamp, parachain_inherent_data))
194+
Ok((slot, timestamp))
229195
};
230196

231197
module.merge(
232-
Eth::<_, _, _, _, _, _, ()>::new(
198+
Eth::<_, _, _, _, _, A, _, LitentryEthConfig<C, BE>>::new(
233199
client.clone(),
234200
pool.clone(),
235201
graph.clone(),
@@ -248,7 +214,6 @@ where
248214
pending_create_inherent_data_providers,
249215
Some(pending_consenus_data_provider),
250216
)
251-
.replace_config::<LitentryEthConfig<C, BE>>()
252217
.into_rpc(),
253218
)?;
254219

@@ -283,20 +248,7 @@ where
283248
.into_rpc(),
284249
)?;
285250

286-
if tracing_config.enable_txpool {
287-
module.merge(TxPool::new(Arc::clone(&client), graph.clone()).into_rpc())?;
288-
}
289-
290-
if let Some(trace_filter_requester) = tracing_config.tracing_requesters.trace {
291-
module.merge(
292-
Trace::new(client, trace_filter_requester, tracing_config.trace_filter_max_count)
293-
.into_rpc(),
294-
)?;
295-
}
296-
297-
if let Some(debug_requester) = tracing_config.tracing_requesters.debug {
298-
module.merge(Debug::new(debug_requester).into_rpc())?;
299-
}
251+
module.merge(TxPool::new(Arc::clone(&client), graph.clone()).into_rpc())?;
300252
}
301253

302254
Ok(module)

0 commit comments

Comments
 (0)