Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
3cdde97
Part.1
aurexav Dec 17, 2024
ad06f78
Companion of paritytech/polkadot-sdk#3052
aurexav Dec 17, 2024
ca15b06
Companion of paritytech/polkadot-sdk#3221
aurexav Dec 17, 2024
b6e7cd4
Companion of paritytech/polkadot-sdk#3002
aurexav Dec 17, 2024
0702a44
Companion of paritytech/polkadot-sdk#1781
aurexav Dec 17, 2024
bc4d286
Companion of paritytech/polkadot-sdk#3505
aurexav Dec 17, 2024
3ef19e6
Companion of paritytech/polkadot-sdk#3696
aurexav Dec 17, 2024
66184fc
Companion of paritytech/polkadot-sdk#3607
aurexav Dec 17, 2024
df28cf1
Companion of paritytech/polkadot-sdk#3844
aurexav Dec 17, 2024
66f3256
Companion of paritytech/polkadot-sdk#3854
aurexav Dec 17, 2024
ab6fdaa
Companion of paritytech/polkadot-sdk#3858
aurexav Dec 17, 2024
84d1f43
Companion of paritytech/polkadot-sdk#2714
aurexav Dec 18, 2024
153dcff
Fix nostd compile
aurexav Dec 18, 2024
735f466
Companion of paritytech/polkadot-sdk#3660
aurexav Dec 18, 2024
b17ee23
Companion of paritytech/polkadot-sdk#4238
aurexav Dec 18, 2024
5ab0f08
Companion of paritytech/polkadot-sdk#4177
aurexav Dec 18, 2024
855735b
Companion of paritytech/polkadot-sdk#4156
aurexav Dec 18, 2024
be7fbda
Companion of paritytech/polkadot-sdk#4346
aurexav Dec 18, 2024
658fdc5
Companion of paritytech/polkadot-sdk#4355
aurexav Dec 18, 2024
3f2b3a6
Companion of paritytech/polkadot-sdk#3952
aurexav Dec 25, 2024
b0b9249
Companion of paritytech/polkadot-sdk#4410
aurexav Dec 25, 2024
3b94aad
Companion of paritytech/polkadot-sdk#4634
aurexav Dec 25, 2024
b4ac1a3
Companion of paritytech/polkadot-sdk#4666
aurexav Dec 25, 2024
33b3fee
Companion of paritytech/polkadot-sdk#3820
aurexav Dec 25, 2024
22ed2e6
Companion of paritytech/polkadot-sdk#4831
aurexav Dec 25, 2024
e6e1e38
Companion of paritytech/polkadot-sdk#4730
aurexav Dec 25, 2024
6cac042
Companion of paritytech/polkadot-sdk#4857
aurexav Dec 25, 2024
cf85cbc
Companion of paritytech/polkadot-sdk#4805
aurexav Dec 25, 2024
5b3dcf3
Companion of paritytech/polkadot-sdk#3350
aurexav Dec 25, 2024
9bccc9b
Add missing updates
aurexav Dec 25, 2024
fe387bf
Fix XCM related
jiguantong Dec 25, 2024
54606af
Compile all runtime
aurexav Dec 25, 2024
91a0ec4
Fixes
aurexav Dec 27, 2024
64fa8f4
Fixes
aurexav Dec 27, 2024
447b568
Companion of paritytech/polkadot-sdk#2944
aurexav Dec 27, 2024
50e9d5c
Fix tests
aurexav Dec 27, 2024
7726226
Format
aurexav Dec 27, 2024
8e088c6
Fix unit test cases
boundless-forest Dec 27, 2024
57f64f2
Format
aurexav Dec 29, 2024
cbb0388
Format
aurexav Dec 29, 2024
04d2b1b
Add missing features
aurexav Dec 29, 2024
47d8cb5
Fixes
aurexav Dec 30, 2024
a36af4a
Update Cargo.toml to include EVM patches and fix tracing test assertions
boundless-forest Dec 30, 2024
a3443f0
Remove unnecessary console.log from EVM tracing test
boundless-forest Dec 30, 2024
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
Prev Previous commit
Next Next commit
Fixes
  • Loading branch information
aurexav committed Dec 27, 2024
commit 64fa8f458fdb55e984a2aef3c9d32e961c5aced8
2 changes: 1 addition & 1 deletion node/src/chain_spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ where
)
}

fn load_config<E>(name: &'static str, mut retries: u8) -> GenericChainSpec<(), E>
fn load_config<E>(name: &'static str, mut retries: u8) -> GenericChainSpec<E>
where
E: DeserializeOwned,
{
Expand Down
30 changes: 15 additions & 15 deletions node/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ pub struct FullDeps<C, P, A: sc_transaction_pool::ChainApi, CIDP> {
pub fee_history_cache: fc_rpc_core::types::FeeHistoryCache,
/// Maximum fee history cache size.
pub fee_history_cache_limit: fc_rpc_core::types::FeeHistoryCacheLimit,
/// Ethereum data access overrides.
pub overrides: Arc<fc_rpc::OverrideHandle<Block>>,
/// Ethereum data access storage_override.
pub storage_override: Arc<dyn fc_rpc::StorageOverride<Block>>,
/// Cache for Ethereum block data.
pub block_data_cache: Arc<fc_rpc::EthBlockDataCacheTask<Block>>,
/// Mandated parent hashes for a given block hash.
Expand All @@ -75,19 +75,19 @@ pub struct TracingConfig {
}

/// Default Ethereum RPC config
pub struct DefaultEthConfig<C, BE>(std::marker::PhantomData<(C, BE)>);
impl<C, BE> fc_rpc::EthConfig<Block, C> for DefaultEthConfig<C, BE>
pub struct DefaultEthConfig<C, Be>(std::marker::PhantomData<(C, Be)>);
impl<C, Be> fc_rpc::EthConfig<Block, C> for DefaultEthConfig<C, Be>
where
C: 'static + Sync + Send + sc_client_api::StorageProvider<Block, BE>,
BE: 'static + sc_client_api::Backend<Block>,
C: 'static + Sync + Send + sc_client_api::StorageProvider<Block, Be>,
Be: 'static + sc_client_api::Backend<Block>,
{
type EstimateGasAdapter = ();
type RuntimeStorageOverride =
fc_rpc::frontier_backend_client::SystemAccountId20StorageOverride<Block, C, BE>;
fc_rpc::frontier_backend_client::SystemAccountId20StorageOverride<Block, C, Be>;
}

/// Instantiate all RPC extensions.
pub fn create_full<C, P, BE, A, EC, CIDP>(
pub fn create_full<C, P, Be, A, EC, CIDP>(
deps: FullDeps<C, P, A, CIDP>,
subscription_task_executor: sc_rpc::SubscriptionTaskExecutor,
pubsub_notification_sinks: Arc<
Expand All @@ -98,13 +98,13 @@ pub fn create_full<C, P, BE, A, EC, CIDP>(
maybe_tracing_config: Option<TracingConfig>,
) -> Result<RpcExtension, Box<dyn std::error::Error + Send + Sync>>
where
BE: 'static + sc_client_api::backend::Backend<Block>,
BE::State: sc_client_api::backend::StateBackend<Hashing>,
Be: 'static + sc_client_api::backend::Backend<Block>,
Be::State: sc_client_api::backend::StateBackend<Hashing>,
C: 'static
+ Send
+ Sync
+ sc_client_api::AuxStore
+ sc_client_api::backend::StorageProvider<Block, BE>
+ sc_client_api::backend::StorageProvider<Block, Be>
+ sc_client_api::BlockchainEvents<Block>
+ sc_client_api::UsageProvider<Block>
+ sp_api::CallApiAt<Block>
Expand Down Expand Up @@ -146,7 +146,7 @@ where
max_past_logs,
fee_history_cache,
fee_history_cache_limit,
overrides,
storage_override,
block_data_cache,
forced_parent_hashes,
pending_create_inherent_data_providers,
Expand All @@ -155,14 +155,14 @@ where
module.merge(System::new(client.clone(), pool.clone(), deny_unsafe).into_rpc())?;
module.merge(TransactionPayment::new(client.clone()).into_rpc())?;
module.merge(
Eth::<Block, C, P, _, BE, A, CIDP, EC>::new(
Eth::<Block, C, P, _, Be, A, CIDP, EC>::new(
client.clone(),
pool.clone(),
graph.clone(),
<Option<NoTransactionConverter>>::None,
sync.clone(),
Vec::new(),
overrides.clone(),
storage_override.clone(),
frontier_backend.clone(),
is_authority,
block_data_cache.clone(),
Expand Down Expand Up @@ -199,7 +199,7 @@ where
client.clone(),
sync,
subscription_task_executor,
overrides,
storage_override,
pubsub_notification_sinks,
)
.into_rpc(),
Expand Down
68 changes: 40 additions & 28 deletions node/src/service/frontier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,27 @@

// std
use std::{
fs,
num::NonZeroU32,
path::{Path, PathBuf},
sync::Arc,
time::Duration,
};
// crates.io
use futures::{future, StreamExt};
use futures::{executor, future, StreamExt};
use tokio::sync::Semaphore;
// darwinia
use crate::cli::{EthRpcConfig, FrontierBackendType, TracingApi};
use dc_primitives::{BlockNumber, Hash, Hashing};
// frontier
use fc_db::{
kv::Backend as KvBackend,
sql::{Backend as SqlBackend, BackendConfig as SqlBackConfig, SqliteBackendConfig},
};
use fc_mapping_sync::{EthereumBlockNotification, EthereumBlockNotificationSinks};
use fc_rpc::{EthTask, OverrideHandle};
use fc_rpc::EthTask;
use fc_rpc_core::types::{FeeHistoryCache, FeeHistoryCacheLimit, FilterPool};
use fc_storage::{StorageOverride, StorageOverrideHandler};
// moonbeam
use moonbeam_rpc_debug::{DebugHandler, DebugRequester};
use moonbeam_rpc_trace::{CacheRequester as TraceFilterCacheRequester, CacheTask};
Expand All @@ -49,13 +56,13 @@ pub struct RpcRequesters {
}

#[allow(clippy::too_many_arguments)]
pub fn spawn_tasks<B, BE, C>(
pub fn spawn_tasks<B, Be, C>(
task_manager: &TaskManager,
client: Arc<C>,
backend: Arc<BE>,
backend: Arc<Be>,
frontier_backend: Arc<fc_db::Backend<B, C>>,
filter_pool: Option<FilterPool>,
overrides: Arc<OverrideHandle<B>>,
storage_override: Arc<dyn StorageOverride<B>>,
fee_history_cache: FeeHistoryCache,
fee_history_cache_limit: FeeHistoryCacheLimit,
sync: Arc<SyncingService<B>>,
Expand All @@ -70,14 +77,14 @@ where
+ sp_blockchain::HeaderMetadata<B, Error = sp_blockchain::Error>
+ sc_client_api::BlockOf
+ sc_client_api::BlockchainEvents<B>
+ sc_client_api::backend::StorageProvider<B, BE>,
+ sc_client_api::backend::StorageProvider<B, Be>,
C::Api: sp_block_builder::BlockBuilder<B>
+ fp_rpc::EthereumRuntimeRPCApi<B>
+ moonbeam_rpc_primitives_debug::DebugRuntimeApi<B>,
B: 'static + Send + Sync + sp_runtime::traits::Block<Hash = Hash>,
B::Header: sp_runtime::traits::Header<Number = BlockNumber>,
BE: 'static + sc_client_api::backend::Backend<B>,
BE::State: sc_client_api::backend::StateBackend<Hashing>,
Be: 'static + sc_client_api::backend::Backend<B>,
Be::State: sc_client_api::backend::StateBackend<Hashing>,
{
match &*frontier_backend {
fc_db::Backend::KeyValue(bd) => {
Expand All @@ -89,7 +96,7 @@ where
Duration::new(6, 0),
client.clone(),
backend.clone(),
overrides.clone(),
storage_override.clone(),
bd.clone(),
3,
0,
Expand Down Expand Up @@ -138,7 +145,7 @@ where
Some("frontier"),
EthTask::fee_history_task(
client.clone(),
overrides.clone(),
storage_override.clone(),
fee_history_cache,
fee_history_cache_limit,
),
Expand All @@ -155,7 +162,7 @@ where
Arc::clone(&backend),
Duration::from_secs(eth_rpc_config.tracing_cache_duration),
Arc::clone(&permit_pool),
Arc::clone(&overrides),
Arc::clone(&storage_override),
prometheus,
);
(Some(trace_filter_task), Some(trace_filter_requester))
Expand All @@ -173,7 +180,7 @@ where
fc_db::Backend::Sql(bd) => bd.clone(),
},
Arc::clone(&permit_pool),
Arc::clone(&overrides),
Arc::clone(&storage_override),
eth_rpc_config.tracing_raw_max_memory_usage,
);
(Some(debug_task), Some(debug_requester))
Expand Down Expand Up @@ -212,31 +219,33 @@ pub(crate) fn db_config_dir(config: &Configuration) -> PathBuf {
}

/// Create a Frontier backend.
pub(crate) fn backend<B, BE, C>(
pub(crate) fn backend<B, Be, C>(
client: Arc<C>,
config: &sc_service::Configuration,
eth_rpc_config: EthRpcConfig,
) -> Result<fc_db::Backend<B, C>, String>
) -> Result<(Arc<dyn fc_storage::StorageOverride<B>>, fc_db::Backend<B, C>), String>
where
B: 'static + sp_runtime::traits::Block<Hash = Hash>,
BE: 'static + sc_client_api::backend::Backend<B>,
Be: 'static + sc_client_api::backend::Backend<B>,
C: 'static
+ sp_api::ProvideRuntimeApi<B>
+ sp_blockchain::HeaderBackend<B>
+ sc_client_api::backend::StorageProvider<B, BE>,
+ sc_client_api::backend::StorageProvider<B, Be>,
C::Api: fp_rpc::EthereumRuntimeRPCApi<B>,
{
let storage_override = Arc::new(StorageOverrideHandler::new(client.clone()));
let db_config_dir = db_config_dir(config);
let overrides = fc_storage::overrides_handle(client.clone());
match eth_rpc_config.frontier_backend_type {
FrontierBackendType::KeyValue => Ok(fc_db::Backend::<B, C>::KeyValue(Arc::new(
fc_db::kv::Backend::open(Arc::clone(&client), &config.database, &db_config_dir)?,
))),
let backend = match eth_rpc_config.frontier_backend_type {
FrontierBackendType::KeyValue => fc_db::Backend::<B, C>::KeyValue(Arc::new(
KvBackend::open(Arc::clone(&client), &config.database, &db_config_dir)?,
)),
FrontierBackendType::Sql => {
let db_path = db_config_dir.join("sql");
std::fs::create_dir_all(&db_path).expect("failed creating sql db directory");
let backend = futures::executor::block_on(fc_db::sql::Backend::new(
fc_db::sql::BackendConfig::Sqlite(fc_db::sql::SqliteBackendConfig {

fs::create_dir_all(&db_path).expect("failed creating sql db directory");

let backend = executor::block_on(SqlBackend::new(
SqlBackConfig::Sqlite(SqliteBackendConfig {
path: Path::new("sqlite:///")
.join(db_path)
.join("frontier.db3")
Expand All @@ -247,11 +256,14 @@ where
cache_size: eth_rpc_config.frontier_sql_backend_cache_size,
}),
eth_rpc_config.frontier_sql_backend_pool_size,
std::num::NonZeroU32::new(eth_rpc_config.frontier_sql_backend_num_ops_timeout),
overrides,
NonZeroU32::new(eth_rpc_config.frontier_sql_backend_num_ops_timeout),
storage_override.clone(),
))
.unwrap_or_else(|err| panic!("failed creating sql backend: {:?}", err));
Ok(fc_db::Backend::<B, C>::Sql(Arc::new(backend)))

fc_db::Backend::<B, C>::Sql(Arc::new(backend))
},
}
};

Ok((storage_override, backend))
}
4 changes: 2 additions & 2 deletions node/src/service/instant_finalize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ impl<I> InstantFinalizeBlockImport<I> {
impl<Block, I> BlockImport<Block> for InstantFinalizeBlockImport<I>
where
Block: BlockT,
I: BlockImport<Block> + Send,
I: Send + Sync + BlockImport<Block>,
{
type Error = I::Error;

async fn check_block(
&mut self,
&self,
block: sc_consensus::BlockCheckParams<Block>,
) -> Result<sc_consensus::ImportResult, Self::Error> {
self.0.check_block(block).await
Expand Down
Loading