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
  • Loading branch information
aurexav committed Dec 27, 2024
commit 447b5688f893f5b3aaf71c1e3e50d1e03057e2bb
9 changes: 4 additions & 5 deletions node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,14 @@ impl RelayChainCli {
para_config: &sc_service::Configuration,
relay_chain_args: impl Iterator<Item = &'a String>,
) -> Self {
let polkadot_cmd = Self::polkadot_cmd();
let matches = polkadot_cmd.get_matches_from(relay_chain_args);
let base = clap::FromArgMatches::from_arg_matches(&matches).unwrap_or_else(|e| e.exit());
let extension = crate::chain_spec::Extensions::try_get(&*para_config.chain_spec);
let chain_id = extension.map(|e| e.relay_chain.clone());
let base_path = para_config.base_path.path().join("polkadot");

Self {
base_path: Some(base_path),
chain_id,
base: clap::Parser::parse_from(relay_chain_args),
}
Self { base, chain_id, base_path: Some(base_path) }
}
}

Expand Down
182 changes: 104 additions & 78 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,25 @@ use std::{env, fs, io::ErrorKind, net::SocketAddr, path::PathBuf, result::Result
// darwinia
use crate::{
chain_spec::*,
cli::{Cli, FrontierBackendType, RelayChainCli, Subcommand},
cli::{Cli, EthRpcConfig, FrontierBackendType, RelayChainCli, Subcommand},
service::{self, *},
};
use dc_primitives::{Block, Hash};
// polkadot-sdk
use cumulus_client_cli::CollatorOptions;
use cumulus_primitives_core::ParaId;
use sc_cli::{
CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams, NetworkParams,
Result, SharedParams, SubstrateCli,
};
use sc_network::{
config::NetworkBackendType, Litep2pNetworkBackend, NetworkBackend, NetworkWorker,
};
use sc_service::{
config::{BasePath, PrometheusConfig},
ChainSpec as ChainSpecT, DatabaseSource,
ChainSpec as ChainSpecT, Configuration, DatabaseSource, TaskManager,
};
use sc_storage_monitor::StorageMonitorParams;
use sp_core::crypto::{self, Ss58AddressFormatRegistry};
use sp_runtime::traits::AccountIdConversion;

Expand Down Expand Up @@ -469,11 +475,12 @@ pub fn run() -> Result<()> {
let polkadot_cli = RelayChainCli::new(runner.config(), cli.relay_chain_args.iter());

runner.run_node_until_exit(|config| async move {
let chain_spec = &config.chain_spec;

set_default_ss58_version(chain_spec);
set_default_ss58_version(&config.chain_spec);

let tokio_handle = config.tokio_handle.clone();
let polkadot_config =
SubstrateCli::create_configuration(&polkadot_cli, &polkadot_cli, tokio_handle)
.map_err(|err| format!("Relay chain argument error: {err}"))?;
let para_id = Extensions::try_get(&*config.chain_spec)
.map(|e| e.para_id)
.ok_or("Could not find parachain ID in chain-spec.")?;
Expand All @@ -488,96 +495,115 @@ pub fn run() -> Result<()> {
log::info!("🧾 Parachain Account: {}", parachain_account);
log::info!("✍️ Is collating: {}", if config.role.is_authority() { "yes" } else { "no" });

if chain_spec.is_dev() {
#[cfg(feature = "crab-runtime")]
if chain_spec.is_crab() {
return service::start_dev_node::<CrabRuntimeApi>(
config,
id,
&eth_rpc_config,
)
.map_err(Into::into);
}

#[cfg(feature = "darwinia-runtime")]
if chain_spec.is_darwinia() {
return service::start_dev_node::<DarwiniaRuntimeApi>(
config,
id,
&eth_rpc_config,
)
.map_err(Into::into)
}

#[cfg(feature = "koi-runtime")]
if chain_spec.is_koi() {
return service::start_dev_node::<KoiRuntimeApi>(
config,
id,
&eth_rpc_config,
)
.map_err(Into::into)
}
}

let polkadot_config =
SubstrateCli::create_configuration(&polkadot_cli, &polkadot_cli, tokio_handle)
.map_err(|err| format!("Relay chain argument error: {}", err))?;

#[cfg(feature = "crab-runtime")]
if chain_spec.is_crab() {
return service::start_parachain_node::<CrabRuntimeApi>(
config,
polkadot_config,
match polkadot_config.network.network_backend {
NetworkBackendType::Libp2p => start_node::<NetworkWorker<_, _>>(
collator_options,
id,
no_hardware_benchmarks,
storage_monitor,
&eth_rpc_config,
)
.await
.map(|r| r.0)
.map_err(Into::into);
}

#[cfg(feature = "darwinia-runtime")]
if chain_spec.is_darwinia() {
return service::start_parachain_node::<DarwiniaRuntimeApi>(
config,
polkadot_config,
collator_options,
id,
no_hardware_benchmarks,
storage_monitor,
&eth_rpc_config,
)
.await
.map(|r| r.0)
.map_err(Into::into);
}

#[cfg(feature = "koi-runtime")]
if chain_spec.is_koi() {
return service::start_parachain_node::<KoiRuntimeApi>(
eth_rpc_config
).await,
NetworkBackendType::Litep2p => start_node::<Litep2pNetworkBackend>(
collator_options,
config,
polkadot_config,
collator_options,
id,
no_hardware_benchmarks,
storage_monitor,
&eth_rpc_config,
)
.await
.map(|r| r.0)
.map_err(Into::into);
eth_rpc_config,
).await
}

panic!("No feature(crab-runtime, darwinia-runtime, koi-runtime) is enabled!");
})
},
}
}

async fn start_node<Net>(
collator_options: CollatorOptions,
config: Configuration,
polkadot_config: Configuration,
id: ParaId,
no_hardware_benchmarks: bool,
storage_monitor: StorageMonitorParams,
eth_rpc_config: EthRpcConfig,
) -> Result<TaskManager>
where
Net: NetworkBackend<Block, Hash>,
{
let chain_spec = &config.chain_spec;

if chain_spec.is_dev() {
#[cfg(feature = "crab-runtime")]
if chain_spec.is_crab() {
return service::start_dev_node::<Net, CrabRuntimeApi>(config, id, &eth_rpc_config)
.map_err(Into::into);
}

#[cfg(feature = "darwinia-runtime")]
if chain_spec.is_darwinia() {
return service::start_dev_node::<Net, DarwiniaRuntimeApi>(config, id, &eth_rpc_config)
.map_err(Into::into);
}

#[cfg(feature = "koi-runtime")]
if chain_spec.is_koi() {
return service::start_dev_node::<Net, KoiRuntimeApi>(config, id, &eth_rpc_config)
.map_err(Into::into);
}
}
#[cfg(feature = "crab-runtime")]
if chain_spec.is_crab() {
return service::start_parachain_node::<Net, CrabRuntimeApi>(
config,
polkadot_config,
collator_options,
id,
no_hardware_benchmarks,
storage_monitor,
&eth_rpc_config,
)
.await
.map(|r| r.0)
.map_err(Into::into);
}

#[cfg(feature = "darwinia-runtime")]
if chain_spec.is_darwinia() {
return service::start_parachain_node::<Net, DarwiniaRuntimeApi>(
config,
polkadot_config,
collator_options,
id,
no_hardware_benchmarks,
storage_monitor,
&eth_rpc_config,
)
.await
.map(|r| r.0)
.map_err(Into::into);
}

#[cfg(feature = "koi-runtime")]
if chain_spec.is_koi() {
return service::start_parachain_node::<Net, KoiRuntimeApi>(
config,
polkadot_config,
collator_options,
id,
no_hardware_benchmarks,
storage_monitor,
&eth_rpc_config,
)
.await
.map(|r| r.0)
.map_err(Into::into);
}

panic!("No feature(crab-runtime, darwinia-runtime, koi-runtime) is enabled!");
}

fn load_spec(id: &str) -> StdResult<Box<dyn ChainSpecT>, String> {
let id = if id.is_empty() {
let n = get_exec_name().unwrap_or_default();
Expand Down
2 changes: 1 addition & 1 deletion node/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub struct FullDeps<C, P, A: sc_transaction_pool::ChainApi, CIDP> {
/// The Node authority flag
pub is_authority: bool,
/// Network service
pub network: Arc<sc_network::NetworkService<Block, Hash>>,
pub network: Arc<dyn sc_network::service::traits::NetworkService>,
/// Chain syncing service
pub sync: Arc<sc_network_sync::SyncingService<Block>>,
/// EthFilterApi pool.
Expand Down
1 change: 1 addition & 0 deletions node/src/service/frontier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ pub(crate) fn db_config_dir(config: &Configuration) -> PathBuf {
}

/// Create a Frontier backend.
#[allow(clippy::type_complexity)]
pub(crate) fn backend<B, Be, C>(
client: Arc<C>,
config: &sc_service::Configuration,
Expand Down
23 changes: 15 additions & 8 deletions node/src/service/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ where
/// This is the actual implementation that is abstract over the executor and the runtime api.
#[allow(clippy::too_many_arguments)]
#[sc_tracing::logging::prefix_logs_with("Parachain")]
async fn start_node_impl<RuntimeApi, SC>(
async fn start_node_impl<Net, RuntimeApi, SC>(
parachain_config: sc_service::Configuration,
polkadot_config: sc_service::Configuration,
collator_options: cumulus_client_cli::CollatorOptions,
Expand All @@ -258,6 +258,7 @@ async fn start_node_impl<RuntimeApi, SC>(
eth_rpc_config: &crate::cli::EthRpcConfig,
) -> sc_service::error::Result<(sc_service::TaskManager, Arc<FullClient<RuntimeApi>>)>
where
Net: sc_network::NetworkBackend<Block, Hash>,
RuntimeApi: 'static + Send + Sync + sp_api::ConstructRuntimeApi<Block, FullClient<RuntimeApi>>,
RuntimeApi::RuntimeApi: RuntimeApiCollection,
SC: FnOnce(
Expand Down Expand Up @@ -321,7 +322,8 @@ where
let validator = parachain_config.role.is_authority();
let prometheus_registry = parachain_config.prometheus_registry().cloned();
let import_queue_service = import_queue.service();
let net_config = sc_network::config::FullNetworkConfiguration::new(&parachain_config.network);
let net_config =
<sc_network::config::FullNetworkConfiguration<_, _, Net>>::new(&parachain_config.network);
let (network, system_rpc_tx, tx_handler_controller, start_network, sync_service) =
cumulus_client_service::build_network(cumulus_client_service::BuildNetworkParams {
parachain_config: &parachain_config,
Expand Down Expand Up @@ -577,7 +579,7 @@ where
}

/// Build the import queue for the parachain runtime.
pub fn build_import_queue<RuntimeApi>(
fn build_import_queue<RuntimeApi>(
client: Arc<FullClient<RuntimeApi>>,
block_import: ParachainBlockImport<RuntimeApi>,
config: &sc_service::Configuration,
Expand Down Expand Up @@ -609,7 +611,7 @@ where
}

/// Start a parachain node.
pub async fn start_parachain_node<RuntimeApi>(
pub async fn start_parachain_node<Net, RuntimeApi>(
parachain_config: sc_service::Configuration,
polkadot_config: sc_service::Configuration,
collator_options: cumulus_client_cli::CollatorOptions,
Expand All @@ -619,12 +621,13 @@ pub async fn start_parachain_node<RuntimeApi>(
eth_rpc_config: &crate::cli::EthRpcConfig,
) -> sc_service::error::Result<(sc_service::TaskManager, Arc<FullClient<RuntimeApi>>)>
where
Net: sc_network::NetworkBackend<Block, Hash>,
RuntimeApi: sp_api::ConstructRuntimeApi<Block, FullClient<RuntimeApi>> + Send + Sync + 'static,
RuntimeApi::RuntimeApi: RuntimeApiCollection,
RuntimeApi::RuntimeApi:
sp_consensus_aura::AuraApi<Block, sp_consensus_aura::sr25519::AuthorityId>,
{
start_node_impl::<RuntimeApi, _>(
start_node_impl::<Net, RuntimeApi, _>(
parachain_config,
polkadot_config,
collator_options,
Expand Down Expand Up @@ -706,12 +709,13 @@ where

/// Start a dev node which can seal instantly.
/// !!! WARNING: DO NOT USE ELSEWHERE
pub fn start_dev_node<RuntimeApi>(
pub fn start_dev_node<Net, RuntimeApi>(
mut config: sc_service::Configuration,
para_id: cumulus_primitives_core::ParaId,
eth_rpc_config: &crate::cli::EthRpcConfig,
) -> Result<sc_service::TaskManager, sc_service::error::Error>
where
Net: sc_network::NetworkBackend<Block, Hash>,
RuntimeApi: 'static + Send + Sync + sp_api::ConstructRuntimeApi<Block, FullClient<RuntimeApi>>,
RuntimeApi::RuntimeApi: RuntimeApiCollection,
RuntimeApi::RuntimeApi:
Expand All @@ -737,7 +741,9 @@ where
_telemetry_worker_handle,
),
} = new_partial::<RuntimeApi>(&config, eth_rpc_config)?;
let net_config = sc_network::config::FullNetworkConfiguration::new(&config.network);
let net_config =
<sc_network::config::FullNetworkConfiguration<_, _, Net>>::new(&config.network);
let metrics = Net::register_notification_metrics(None);
let (network, system_rpc_tx, tx_handler_controller, start_network, sync_service) =
sc_service::build_network(sc_service::BuildNetworkParams {
config: &config,
Expand All @@ -749,6 +755,7 @@ where
block_announce_validator_builder: None,
warp_sync_params: None,
block_relay: None,
metrics,
})?;

if config.offchain_worker.enabled {
Expand All @@ -764,7 +771,7 @@ where
transaction_pool.clone(),
),
),
network_provider: network.clone(),
network_provider: Arc::new(network.clone()),
is_validator: config.role.is_authority(),
enable_http_requests: false,
custom_extensions: move |_| Vec::new(),
Expand Down
Loading