Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4,844 changes: 2,706 additions & 2,138 deletions parachain/Cargo.lock

Large diffs are not rendered by default.

279 changes: 135 additions & 144 deletions parachain/Cargo.toml

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions parachain/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,6 @@ fc-rpc-core = { workspace = true }
fc-storage = { workspace = true }
fp-rpc = { workspace = true }

moonbeam-primitives-ext = { workspace = true, features = ["std"] }
moonbeam-rpc-debug = { workspace = true }
moonbeam-rpc-primitives-debug = { workspace = true, features = ["std"] }
moonbeam-rpc-primitives-txpool = { workspace = true, features = ["std"] }
moonbeam-rpc-trace = { workspace = true }

cumulus-client-cli = { workspace = true }
cumulus-client-collator = { workspace = true }
cumulus-client-consensus-aura = { workspace = true }
Expand Down
5 changes: 1 addition & 4 deletions parachain/node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Litentry. If not, see <https://www.gnu.org/licenses/>.

use crate::{chain_specs, evm_tracing_types::EthApiOptions};
use crate::chain_specs;
use clap::Parser;
use std::path::PathBuf;

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

#[clap(flatten)]
pub eth_api_options: EthApiOptions,

/// Enable Ethereum compatible JSON-RPC servers (disabled by default).
#[clap(name = "enable-evm-rpc", long)]
pub enable_evm_rpc: bool,
Expand Down
18 changes: 2 additions & 16 deletions parachain/node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,22 +305,9 @@ pub fn run() -> Result<()> {
let collator_options = cli.run.collator_options();
let is_standalone = runner.config().chain_spec.is_standalone();

let evm_tracing_config = crate::evm_tracing_types::EvmTracingConfig {
ethapi: cli.eth_api_options.ethapi,
ethapi_max_permits: cli.eth_api_options.ethapi_max_permits,
ethapi_trace_max_count: cli.eth_api_options.ethapi_trace_max_count,
ethapi_trace_cache_duration: cli.eth_api_options.ethapi_trace_cache_duration,
eth_log_block_cache: cli.eth_api_options.eth_log_block_cache,
eth_statuses_cache: cli.eth_api_options.eth_statuses_cache,
max_past_logs: cli.eth_api_options.max_past_logs,
tracing_raw_max_memory_usage: cli.eth_api_options.tracing_raw_max_memory_usage,
};

runner.run_node_until_exit(|config| async move {
if is_standalone {
return start_standalone_node(config, evm_tracing_config)
.await
.map_err(Into::into);
return start_standalone_node(config).await.map_err(Into::into);
}

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

let additional_config =
AdditionalConfig { evm_tracing_config, enable_evm_rpc: cli.enable_evm_rpc };
let additional_config = AdditionalConfig { enable_evm_rpc: cli.enable_evm_rpc };

if config.chain_spec.is_standalone() {
Err(UNSUPPORTED_CHAIN_MESSAGE.into())
Expand Down
107 changes: 0 additions & 107 deletions parachain/node/src/evm_tracing_types.rs

This file was deleted.

31 changes: 0 additions & 31 deletions parachain/node/src/fake_runtime_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,35 +299,4 @@ sp_api::impl_runtime_apis! {
unimplemented!()
}
}

impl moonbeam_rpc_primitives_debug::DebugRuntimeApi<Block> for Runtime {
fn trace_transaction(_extrinsics: Vec<<Block as BlockT>::Extrinsic>, _traced_transaction: &pallet_ethereum::Transaction, _header: &<Block as BlockT>::Header) -> Result<(), sp_runtime::DispatchError> {
unimplemented!()
}

fn trace_block(_extrinsics: Vec<<Block as BlockT>::Extrinsic>, _known_transactions: Vec<H256>, _header: &<Block as BlockT>::Header) -> Result<(), sp_runtime::DispatchError> {
unimplemented!()
}

fn trace_call(
_header: &<Block as BlockT>::Header,
_from: H160,
_to: H160,
_data: Vec<u8>,
_value: U256,
_gas_limit: U256,
_max_fee_per_gas: Option<U256>,
_max_priority_fee_per_gas: Option<U256>,
_nonce: Option<U256>,
_access_list: Option<Vec<(H160, Vec<H256>)>>,
) -> Result<(), sp_runtime::DispatchError> {
unimplemented!()
}
}

impl moonbeam_rpc_primitives_txpool::TxPoolRuntimeApi<Block> for Runtime {
fn extrinsic_filter(_xts_ready: Vec<<Block as BlockT>::Extrinsic>, _xts_future: Vec<<Block as BlockT>::Extrinsic>) -> moonbeam_rpc_primitives_txpool::TxPoolResponse {
unimplemented!()
}
}
}
2 changes: 0 additions & 2 deletions parachain/node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@
mod chain_specs;
mod cli;
mod command;
mod evm_tracing_types;
mod fake_runtime_api;
mod rpc;
mod service;
mod standalone_block_import;
mod tracing;

fn main() -> sc_cli::Result<()> {
command::run()
Expand Down
68 changes: 10 additions & 58 deletions parachain/node/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
// This File should be safe to delete once All parachain matrix are EVM impl.
#![warn(missing_docs)]

use cumulus_primitives_parachain_inherent::ParachainInherentData;
use cumulus_test_relay_sproof_builder::RelayStateSproofBuilder;
use fc_rpc::{
pending::ConsensusDataProvider, Eth, EthApiServer, EthBlockDataCacheTask, EthFilter,
EthFilterApiServer, EthPubSub, EthPubSubApiServer, Net, NetApiServer, TxPool, TxPoolApiServer,
Expand All @@ -28,15 +26,13 @@ use fc_rpc::{
use fc_rpc_core::types::{FeeHistoryCache, FilterPool};
use fc_storage::StorageOverride;
use heima_primitives::{AccountId, Balance, Block, Nonce};
use moonbeam_rpc_debug::{Debug, DebugServer};
use moonbeam_rpc_trace::{Trace, TraceServer};
use polkadot_primitives::PersistedValidationData;
use sc_client_api::{
AuxStore, Backend, BlockchainEvents, StateBackend, StorageProvider, UsageProvider,
};
use sc_network::service::traits::NetworkService;
use sc_network_sync::SyncingService;
pub use sc_rpc::SubscriptionTaskExecutor;
use sc_transaction_pool::{ChainApi, Pool};
use sc_transaction_pool_api::TransactionPool;
use sp_api::{CallApiAt, ProvideRuntimeApi};
use sp_block_builder::BlockBuilder;
Expand All @@ -47,20 +43,11 @@ use sp_consensus_aura::{sr25519::AuthorityId as AuraId, AuraApi};
use sp_runtime::traits::{BlakeTwo256, Block as BlockT};
use std::sync::Arc;

use crate::tracing;

type HashFor<Block> = <Block as BlockT>::Hash;

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

#[derive(Clone)]
pub struct EvmTracingConfig {
pub tracing_requesters: tracing::RpcRequesters,
pub trace_filter_max_count: u32,
pub enable_txpool: bool,
}

// TODO This is copied from frontier. It should be imported instead after
// https://github.com/paritytech/frontier/issues/333 is solved
pub fn open_frontier_backend<C>(
Expand Down Expand Up @@ -97,13 +84,13 @@ where
}

/// Full client dependencies
pub struct FullDeps<C, P> {
pub struct FullDeps<C, P, A: ChainApi> {
/// The client instance to use.
pub client: Arc<C>,
/// Transaction pool instance.
pub pool: Arc<P>,
/// Graph pool instance.
pub graph: Arc<P>,
pub graph: Arc<Pool<A>>,
/// Network service
pub network: Arc<dyn NetworkService>,
/// Chain syncing service
Expand All @@ -127,16 +114,15 @@ pub struct FullDeps<C, P> {
}

/// Instantiate all RPC extensions.
pub fn create_full<C, P, BE>(
deps: FullDeps<C, P>,
pub fn create_full<C, P, BE, A>(
deps: FullDeps<C, P, A>,
subscription_task_executor: SubscriptionTaskExecutor,
pubsub_notification_sinks: Arc<
fc_mapping_sync::EthereumBlockNotificationSinks<
fc_mapping_sync::EthereumBlockNotification<Block>,
>,
>,
pending_consenus_data_provider: Box<dyn ConsensusDataProvider<Block>>,
tracing_config: EvmTracingConfig,
) -> Result<RpcExtension, Box<dyn std::error::Error + Send + Sync>>
where
C: ProvideRuntimeApi<Block>
Expand All @@ -156,10 +142,9 @@ where
+ fp_rpc::ConvertTransactionRuntimeApi<Block>
+ fp_rpc::EthereumRuntimeRPCApi<Block>
+ BlockBuilder<Block>
+ AuraApi<Block, AuraId>
+ moonbeam_rpc_primitives_debug::DebugRuntimeApi<Block>
+ moonbeam_rpc_primitives_txpool::TxPoolRuntimeApi<Block>,
+ AuraApi<Block, AuraId>,
P: TransactionPool<Block = Block, Hash = HashFor<Block>> + Sync + Send + 'static,
A: ChainApi<Block = Block> + 'static,
BE: Backend<Block> + 'static,
BE::State: StateBackend<BlakeTwo256>,
BE::Blockchain: BlockchainBackend<Block>,
Expand Down Expand Up @@ -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<C, BE>>::new(
client.clone(),
pool.clone(),
graph.clone(),
Expand All @@ -248,7 +214,6 @@ where
pending_create_inherent_data_providers,
Some(pending_consenus_data_provider),
)
.replace_config::<LitentryEthConfig<C, BE>>()
.into_rpc(),
)?;

Expand Down Expand Up @@ -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)
Expand Down
Loading