,
/// Transaction pool instance.
pub pool: Arc,
/// Graph pool instance.
- pub graph: Arc
,
+ pub graph: Arc>,
/// Network service
pub network: Arc,
/// Chain syncing service
@@ -127,8 +114,8 @@ pub struct FullDeps {
}
/// Instantiate all RPC extensions.
-pub fn create_full(
- deps: FullDeps,
+pub fn create_full(
+ deps: FullDeps,
subscription_task_executor: SubscriptionTaskExecutor,
pubsub_notification_sinks: Arc<
fc_mapping_sync::EthereumBlockNotificationSinks<
@@ -136,7 +123,6 @@ pub fn create_full(
>,
>,
pending_consenus_data_provider: Box>,
- tracing_config: EvmTracingConfig,
) -> Result>
where
C: ProvideRuntimeApi
@@ -156,10 +142,9 @@ where
+ fp_rpc::ConvertTransactionRuntimeApi
+ fp_rpc::EthereumRuntimeRPCApi
+ BlockBuilder
- + AuraApi
- + moonbeam_rpc_primitives_debug::DebugRuntimeApi
- + moonbeam_rpc_primitives_txpool::TxPoolRuntimeApi,
+ + AuraApi,
P: TransactionPool> + Sync + Send + 'static,
+ A: ChainApi + 'static,
BE: Backend + 'static,
BE::State: StateBackend,
BE::Blockchain: BlockchainBackend,
@@ -206,30 +191,11 @@ where
*timestamp,
slot_duration,
);
- // Create a dummy parachain inherent data provider which is required to pass
- // the checks by the para chain system. We use dummy values because in the 'pending
- // context' neither do we have access to the real values nor do we need them.
- let (relay_parent_storage_root, relay_chain_state) =
- RelayStateSproofBuilder::default().into_state_root_and_proof();
- let vfp = PersistedValidationData {
- // This is a hack to make
- // `cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases` happy. Relay
- // parent number can't be bigger than u32::MAX.
- relay_parent_number: u32::MAX,
- relay_parent_storage_root,
- ..Default::default()
- };
- let parachain_inherent_data = ParachainInherentData {
- validation_data: vfp,
- relay_chain_state,
- downward_messages: Default::default(),
- horizontal_messages: Default::default(),
- };
- Ok((slot, timestamp, parachain_inherent_data))
+ Ok((slot, timestamp))
};
module.merge(
- Eth::<_, _, _, _, _, _, ()>::new(
+ Eth::<_, _, _, _, _, A, _, LitentryEthConfig>::new(
client.clone(),
pool.clone(),
graph.clone(),
@@ -248,7 +214,6 @@ where
pending_create_inherent_data_providers,
Some(pending_consenus_data_provider),
)
- .replace_config::>()
.into_rpc(),
)?;
@@ -283,20 +248,7 @@ where
.into_rpc(),
)?;
- if tracing_config.enable_txpool {
- module.merge(TxPool::new(Arc::clone(&client), graph.clone()).into_rpc())?;
- }
-
- if let Some(trace_filter_requester) = tracing_config.tracing_requesters.trace {
- module.merge(
- Trace::new(client, trace_filter_requester, tracing_config.trace_filter_max_count)
- .into_rpc(),
- )?;
- }
-
- if let Some(debug_requester) = tracing_config.tracing_requesters.debug {
- module.merge(Debug::new(debug_requester).into_rpc())?;
- }
+ module.merge(TxPool::new(Arc::clone(&client), graph.clone()).into_rpc())?;
}
Ok(module)
diff --git a/parachain/node/src/service.rs b/parachain/node/src/service.rs
index 8cb0f7ef27..432de98d87 100644
--- a/parachain/node/src/service.rs
+++ b/parachain/node/src/service.rs
@@ -21,10 +21,7 @@
#![allow(clippy::too_many_arguments)]
use crate::{
- evm_tracing_types::{EthApi as EthApiCmd, EvmTracingConfig},
- fake_runtime_api::RuntimeApi as FakeRuntimeApi,
- standalone_block_import::StandaloneBlockImport,
- tracing::{self, RpcRequesters},
+ fake_runtime_api::RuntimeApi as FakeRuntimeApi, standalone_block_import::StandaloneBlockImport,
};
use cumulus_client_cli::CollatorOptions;
use cumulus_client_collator::service::CollatorService;
@@ -75,16 +72,12 @@ use sp_std::{collections::btree_map::BTreeMap, sync::Arc, time::Duration};
use substrate_prometheus_endpoint::Registry;
#[cfg(not(feature = "runtime-benchmarks"))]
-pub type HostFunctions = (
- cumulus_client_service::ParachainHostFunctions,
- moonbeam_primitives_ext::moonbeam_ext::HostFunctions,
-);
+pub type HostFunctions = cumulus_client_service::ParachainHostFunctions;
#[cfg(feature = "runtime-benchmarks")]
pub type HostFunctions = (
cumulus_client_service::ParachainHostFunctions,
frame_benchmarking::benchmarking::HostFunctions,
- moonbeam_primitives_ext::moonbeam_ext::HostFunctions,
);
type ParachainClient = TFullClient>;
@@ -120,6 +113,11 @@ pub fn new_partial(
Option,
Option,
Arc>,
+ Arc<
+ sc_transaction_pool::Pool<
+ sc_transaction_pool::FullChainApi,
+ >,
+ >,
),
>,
sc_service::Error,
@@ -185,6 +183,18 @@ where
.with_prometheus(config.prometheus_registry())
.build();
+ // Create a separate pool for Frontier RPC that has access to the inner Pool type
+ let chain_api = Arc::new(sc_transaction_pool::FullChainApi::new(
+ client.clone(),
+ None,
+ &task_manager.spawn_essential_handle(),
+ ));
+ let transaction_pool_inner = Arc::new(sc_transaction_pool::Pool::new(
+ sc_transaction_pool::Options::default(),
+ config.role.is_authority().into(),
+ chain_api,
+ ));
+
let select_chain = if is_standalone { Some(LongestChain::new(backend.clone())) } else { None };
let frontier_backend = crate::rpc::open_frontier_backend(client.clone(), config)?;
let frontier_block_import = FrontierBlockImport::new(client.clone(), client.clone());
@@ -224,16 +234,19 @@ where
task_manager,
transaction_pool: transaction_pool.into(),
select_chain,
- other: (block_import, telemetry, telemetry_worker_handle, frontier_backend),
+ other: (
+ block_import,
+ telemetry,
+ telemetry_worker_handle,
+ frontier_backend,
+ transaction_pool_inner,
+ ),
})
}
/// To add additional config to start_xyz_node functions
#[derive(Clone)]
pub struct AdditionalConfig {
- /// EVM tracing configuration
- pub evm_tracing_config: EvmTracingConfig,
-
/// Whether EVM RPC be enabled
pub enable_evm_rpc: bool,
}
@@ -293,7 +306,13 @@ where
let params =
new_partial::(¶chain_config, build_import_queue, false, delayed_best_block)?;
- let (block_import, mut telemetry, telemetry_worker_handle, frontier_backend) = params.other;
+ let (
+ block_import,
+ mut telemetry,
+ telemetry_worker_handle,
+ frontier_backend,
+ transaction_pool_graph,
+ ) = params.other;
let client = params.client.clone();
let backend = params.backend.clone();
@@ -371,35 +390,22 @@ where
> = Default::default();
let pubsub_notification_sinks = Arc::new(pubsub_notification_sinks);
- let (
- filter_pool,
- fee_history_limit,
- fee_history_cache,
- block_data_cache,
- storage_override,
- tracing_requesters,
- ethapi_cmd,
- ) = start_node_evm_impl(
- client.clone(),
- backend.clone(),
- frontier_backend.clone(),
- &mut task_manager,
- ¶chain_config,
- additional_config.evm_tracing_config.clone(),
- sync_service.clone(),
- pubsub_notification_sinks.clone(),
- );
+ let (filter_pool, fee_history_limit, fee_history_cache, block_data_cache, storage_override) =
+ start_node_evm_impl(
+ client.clone(),
+ backend.clone(),
+ frontier_backend.clone(),
+ &mut task_manager,
+ ¶chain_config,
+ sync_service.clone(),
+ pubsub_notification_sinks.clone(),
+ );
let rpc_builder = {
let client = client.clone();
let transaction_pool = transaction_pool.clone();
let network = network.clone();
- let rpc_config = crate::rpc::EvmTracingConfig {
- tracing_requesters,
- trace_filter_max_count: additional_config.evm_tracing_config.ethapi_trace_max_count,
- enable_txpool: ethapi_cmd.contains(&EthApiCmd::TxPool),
- };
let sync = sync_service.clone();
let pubsub_notification_sinks = pubsub_notification_sinks.clone();
@@ -407,7 +413,7 @@ where
let deps = crate::rpc::FullDeps {
client: client.clone(),
pool: transaction_pool.clone(),
- graph: transaction_pool.clone(),
+ graph: transaction_pool_graph.clone(),
network: network.clone(),
sync: sync.clone(),
is_authority: validator,
@@ -428,7 +434,6 @@ where
subscription,
pubsub_notification_sinks.clone(),
pending_consensus_data_provider,
- rpc_config.clone(),
)
.map_err(Into::into)
};
@@ -650,7 +655,6 @@ pub fn build_import_queue(
// start a standalone node which doesn't need to connect to relaychain
pub async fn start_standalone_node(
config: Configuration,
- evm_tracing_config: crate::evm_tracing_types::EvmTracingConfig,
) -> Result {
let sc_service::PartialComponents {
client,
@@ -660,7 +664,7 @@ pub async fn start_standalone_node(
keystore_container,
select_chain: maybe_select_chain,
transaction_pool,
- other: (_, _, _, frontier_backend),
+ other: (_, _, _, frontier_backend, transaction_pool_graph),
} = new_partial::<_>(&config, build_import_queue, true, true)?;
// Sinks for pubsub notifications.
@@ -697,24 +701,16 @@ pub async fn start_standalone_node(
let force_authoring = config.force_authoring;
let backoff_authoring_blocks: Option<()> = None;
- let (
- filter_pool,
- fee_history_limit,
- fee_history_cache,
- block_data_cache,
- storage_override,
- tracing_requesters,
- ethapi_cmd,
- ) = start_node_evm_impl(
- client.clone(),
- backend.clone(),
- frontier_backend.clone(),
- &mut task_manager,
- &config,
- evm_tracing_config.clone(),
- sync_service.clone(),
- pubsub_notification_sinks.clone(),
- );
+ let (filter_pool, fee_history_limit, fee_history_cache, block_data_cache, storage_override) =
+ start_node_evm_impl(
+ client.clone(),
+ backend.clone(),
+ frontier_backend.clone(),
+ &mut task_manager,
+ &config,
+ sync_service.clone(),
+ pubsub_notification_sinks.clone(),
+ );
let select_chain = maybe_select_chain
.expect("In `standalone` mode, `new_partial` will return some `select_chain`; qed");
@@ -813,11 +809,6 @@ pub async fn start_standalone_node(
let client = client.clone();
let network = network.clone();
let transaction_pool = transaction_pool.clone();
- let rpc_config = crate::rpc::EvmTracingConfig {
- tracing_requesters,
- trace_filter_max_count: evm_tracing_config.ethapi_trace_max_count,
- enable_txpool: ethapi_cmd.contains(&EthApiCmd::TxPool),
- };
let sync = sync_service.clone();
let pubsub_notification_sinks = pubsub_notification_sinks;
@@ -825,7 +816,7 @@ pub async fn start_standalone_node(
let deps = crate::rpc::FullDeps {
client: client.clone(),
pool: transaction_pool.clone(),
- graph: transaction_pool.clone(),
+ graph: transaction_pool_graph.clone(),
network: network.clone(),
sync: sync.clone(),
is_authority: role.is_authority(),
@@ -847,7 +838,6 @@ pub async fn start_standalone_node(
subscription,
pubsub_notification_sinks.clone(),
pending_consensus_data_provider,
- rpc_config.clone(),
)
.map_err(Into::into)
})
@@ -878,7 +868,6 @@ pub fn start_node_evm_impl(
frontier_backend: Arc>,
task_manager: &mut TaskManager,
config: &Configuration,
- evm_tracing_config: crate::evm_tracing_types::EvmTracingConfig,
sync_service: Arc>,
pubsub_notification_sinks: Arc<
fc_mapping_sync::EthereumBlockNotificationSinks<
@@ -891,33 +880,12 @@ pub fn start_node_evm_impl(
FeeHistoryCache,
Arc>,
Arc>,
- RpcRequesters,
- Vec,
) {
let prometheus_registry = config.prometheus_registry().cloned();
let filter_pool: FilterPool = Arc::new(std::sync::Mutex::new(BTreeMap::new()));
let fee_history_cache: FeeHistoryCache = Arc::new(std::sync::Mutex::new(BTreeMap::new()));
let storage_override = Arc::new(StorageOverrideHandler::new(client.clone()));
- let ethapi_cmd = evm_tracing_config.ethapi.clone();
- let tracing_requesters =
- if ethapi_cmd.contains(&EthApiCmd::Debug) || ethapi_cmd.contains(&EthApiCmd::Trace) {
- tracing::spawn_tracing_tasks(
- &evm_tracing_config,
- prometheus_registry.clone(),
- tracing::SpawnTasksParams {
- task_manager,
- client: client.clone(),
- substrate_backend: backend.clone(),
- frontier_backend: frontier_backend.clone(),
- filter_pool: Some(filter_pool.clone()),
- storage_override: storage_override.clone(),
- },
- )
- } else {
- tracing::RpcRequesters { debug: None, trace: None }
- };
-
// Frontier offchain DB task. Essential.
// Maps emulated ethereum data to substrate native data.
task_manager.spawn_essential_handle().spawn(
@@ -972,15 +940,7 @@ pub fn start_node_evm_impl(
prometheus_registry,
));
- (
- filter_pool,
- FEE_HISTORY_LIMIT,
- fee_history_cache,
- block_data_cache,
- storage_override,
- tracing_requesters,
- ethapi_cmd,
- )
+ (filter_pool, FEE_HISTORY_LIMIT, fee_history_cache, block_data_cache, storage_override)
}
/// Start consensus using the lookahead aura collator.
diff --git a/parachain/node/src/tracing.rs b/parachain/node/src/tracing.rs
deleted file mode 100644
index 1ce593e78f..0000000000
--- a/parachain/node/src/tracing.rs
+++ /dev/null
@@ -1,123 +0,0 @@
-// Copyright 2020-2024 Trust Computing GmbH.
-// This file is part of Litentry.
-//
-// Litentry is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Litentry is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Litentry. If not, see .
-
-use crate::evm_tracing_types::{EthApi as EthApiCmd, EvmTracingConfig};
-
-use fc_rpc_core::types::FilterPool;
-use fc_storage::StorageOverride;
-use fp_rpc::EthereumRuntimeRPCApi;
-use moonbeam_rpc_debug::{DebugHandler, DebugRequester};
-use moonbeam_rpc_trace::{CacheRequester as TraceFilterCacheRequester, CacheTask};
-use sc_client_api::{
- Backend, BlockOf, BlockchainEvents, HeaderBackend, StateBackend, StorageProvider,
-};
-use sc_service::TaskManager;
-use sp_api::ProvideRuntimeApi;
-use sp_block_builder::BlockBuilder;
-use sp_blockchain::{Error as BlockChainError, HeaderMetadata};
-use sp_core::H256;
-use sp_runtime::traits::{BlakeTwo256, Block as BlockT, Header as HeaderT};
-use std::sync::Arc;
-use substrate_prometheus_endpoint::Registry as PrometheusRegistry;
-use tokio::sync::Semaphore;
-
-#[derive(Clone)]
-pub struct RpcRequesters {
- pub debug: Option,
- pub trace: Option,
-}
-
-#[allow(dead_code)]
-pub struct SpawnTasksParams<'a, B: BlockT, C, BE> {
- pub task_manager: &'a TaskManager,
- pub client: Arc,
- pub substrate_backend: Arc,
- pub frontier_backend: Arc + Send + Sync>,
- pub filter_pool: Option,
- pub storage_override: Arc>,
-}
-
-pub fn spawn_tracing_tasks(
- rpc_config: &EvmTracingConfig,
- prometheus: Option,
- params: SpawnTasksParams,
-) -> RpcRequesters
-where
- C: ProvideRuntimeApi + BlockOf,
- C: StorageProvider,
- C: HeaderBackend + HeaderMetadata + 'static,
- C: BlockchainEvents,
- C: Send + Sync + 'static,
- C::Api: EthereumRuntimeRPCApi + moonbeam_rpc_primitives_debug::DebugRuntimeApi,
- C::Api: BlockBuilder,
- B: BlockT + Send + Sync + 'static,
- B::Header: HeaderT,
- BE: Backend + 'static,
- BE::State: StateBackend,
-{
- let permit_pool = Arc::new(Semaphore::new(rpc_config.ethapi_max_permits as usize));
-
- let (trace_filter_task, trace_filter_requester) =
- if rpc_config.ethapi.contains(&EthApiCmd::Trace) {
- let (trace_filter_task, trace_filter_requester) = CacheTask::create(
- Arc::clone(¶ms.client),
- Arc::clone(¶ms.substrate_backend),
- core::time::Duration::from_secs(rpc_config.ethapi_trace_cache_duration),
- Arc::clone(&permit_pool),
- Arc::clone(¶ms.storage_override),
- prometheus,
- );
- (Some(trace_filter_task), Some(trace_filter_requester))
- } else {
- (None, None)
- };
-
- let (debug_task, debug_requester) = if rpc_config.ethapi.contains(&EthApiCmd::Debug) {
- let (debug_task, debug_requester) = DebugHandler::task(
- Arc::clone(¶ms.client),
- Arc::clone(¶ms.substrate_backend),
- Arc::clone(¶ms.frontier_backend),
- Arc::clone(&permit_pool),
- Arc::clone(¶ms.storage_override),
- rpc_config.tracing_raw_max_memory_usage,
- );
- (Some(debug_task), Some(debug_requester))
- } else {
- (None, None)
- };
-
- // `trace_filter` cache task. Essential.
- // Proxies rpc requests to it's handler.
- if let Some(trace_filter_task) = trace_filter_task {
- params.task_manager.spawn_essential_handle().spawn(
- "trace-filter-cache",
- Some("eth-tracing"),
- trace_filter_task,
- );
- }
-
- // `debug` task if enabled. Essential.
- // Proxies rpc requests to it's handler.
- if let Some(debug_task) = debug_task {
- params.task_manager.spawn_essential_handle().spawn(
- "ethapi-debug",
- Some("eth-tracing"),
- debug_task,
- );
- }
-
- RpcRequesters { debug: debug_requester, trace: trace_filter_requester }
-}
diff --git a/parachain/pallets/omni-account/src/mock.rs b/parachain/pallets/omni-account/src/mock.rs
index 48a673c893..c078579ee6 100644
--- a/parachain/pallets/omni-account/src/mock.rs
+++ b/parachain/pallets/omni-account/src/mock.rs
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Litentry. If not, see .
-use crate::{self as pallet_omni_account, Decode, Encode, EnsureOmniAccount};
+use crate::{self as pallet_omni_account, Encode, EnsureOmniAccount};
use frame_support::{
assert_ok, derive_impl,
pallet_prelude::EnsureOrigin,
@@ -25,7 +25,6 @@ use frame_system::EnsureRoot;
use heima_primitives::{DefaultOmniAccountConverter, Identity, MemberAccount};
pub use pallet_teebag::test_util::get_signer;
use pallet_teebag::test_util::{TEST8_CERT, TEST8_SIGNER_PUB, TEST8_TIMESTAMP, URL};
-use sp_core::RuntimeDebug;
use sp_keyring::AccountKeyring;
use sp_runtime::{
traits::{IdentifyAccount, IdentityLookup, Verify},
@@ -96,18 +95,22 @@ pub fn bob() -> Accounts {
create_accounts(AccountKeyring::Bob)
}
+#[allow(dead_code)]
pub fn charlie() -> Accounts {
create_accounts(AccountKeyring::Charlie)
}
+#[allow(dead_code)]
pub fn dave() -> Accounts {
create_accounts(AccountKeyring::Dave)
}
+#[allow(dead_code)]
pub fn public_member_account(accounts: Accounts) -> MemberAccount {
MemberAccount::Public(accounts.identity)
}
+#[allow(dead_code)]
pub fn private_member_account(accounts: Accounts) -> MemberAccount {
MemberAccount::Private(accounts.identity.encode(), accounts.identity.hash())
}
diff --git a/parachain/pallets/omni-account/src/tests.rs b/parachain/pallets/omni-account/src/tests.rs
index e8d331ceba..55e8f3b721 100644
--- a/parachain/pallets/omni-account/src/tests.rs
+++ b/parachain/pallets/omni-account/src/tests.rs
@@ -18,6 +18,7 @@ use crate::{mock::*, *};
use frame_support::{assert_noop, assert_ok};
use sp_std::vec;
+#[allow(dead_code)]
fn request_intent_call(intent: Intent) -> Box {
RuntimeCall::OmniAccount(crate::Call::request_intent { intent }).into()
}
diff --git a/parachain/precompiles/assets-erc20/src/lib.rs b/parachain/precompiles/assets-erc20/src/lib.rs
index 72b56b2e9c..55d1313542 100644
--- a/parachain/precompiles/assets-erc20/src/lib.rs
+++ b/parachain/precompiles/assets-erc20/src/lib.rs
@@ -117,18 +117,17 @@ impl Erc20AssetsPrecompileSet
where
Instance: 'static,
Runtime: pallet_assets::Config + pallet_evm::Config + frame_system::Config,
- Runtime::RuntimeOrigin: From<
- Option<<::AccountProvider as AccountProvider>::AccountId>,
- >,
Runtime::RuntimeCall: Dispatchable + GetDispatchInfo,
Runtime::RuntimeCall: From>,
- ::RuntimeOrigin: From