Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the umbrella crate for the parachain template #5991

Merged
merged 14 commits into from
Oct 14, 2024
96 changes: 3 additions & 93 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 7 additions & 61 deletions templates/parachain/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ edition.workspace = true
publish = false
build = "build.rs"

# [[bin]]
# name = "parachain-template-node"

[dependencies]
clap = { features = ["derive"], workspace = true }
log = { workspace = true, default-features = true }
Expand All @@ -22,82 +19,31 @@ jsonrpsee = { features = ["server"], workspace = true }
futures = { workspace = true }
serde_json = { workspace = true, default-features = true }
docify = { workspace = true }
color-print = { workspace = true }

polkadot-sdk = { workspace = true, features = ["experimental", "node"] }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we enabling a experimental feature in our templates? There is something fishy again..

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would soon remove this flag from the frame umbrella crate, rest assured.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it wasn't needed. Removed it.


# Local
parachain-template-runtime = { workspace = true }

# Substrate
frame-benchmarking = { workspace = true, default-features = true }
frame-benchmarking-cli = { workspace = true, default-features = true }
pallet-transaction-payment-rpc = { workspace = true, default-features = true }
sc-basic-authorship = { workspace = true, default-features = true }
sc-chain-spec = { workspace = true, default-features = true }
sc-cli = { workspace = true, default-features = true }
sc-client-api = { workspace = true, default-features = true }
sc-offchain = { workspace = true, default-features = true }
sc-consensus = { workspace = true, default-features = true }
sc-executor = { workspace = true, default-features = true }
sc-network = { workspace = true, default-features = true }
sc-network-sync = { workspace = true, default-features = true }
sc-rpc = { workspace = true, default-features = true }
sc-service = { workspace = true, default-features = true }
sc-sysinfo = { workspace = true, default-features = true }
sc-telemetry = { workspace = true, default-features = true }
sc-tracing = { workspace = true, default-features = true }
sc-transaction-pool = { workspace = true, default-features = true }
sc-transaction-pool-api = { workspace = true, default-features = true }
sp-api = { workspace = true, default-features = true }
sp-block-builder = { workspace = true, default-features = true }
sp-blockchain = { workspace = true, default-features = true }
sp-consensus-aura = { workspace = true, default-features = true }
sp-core = { workspace = true, default-features = true }
sp-genesis-builder = { workspace = true, default-features = true }
sp-keystore = { workspace = true, default-features = true }
sp-io = { workspace = true, default-features = true }
sp-runtime = { workspace = true, default-features = true }
sp-timestamp = { workspace = true, default-features = true }
substrate-frame-rpc-system = { workspace = true, default-features = true }
prometheus-endpoint = { workspace = true, default-features = true }

# Polkadot
polkadot-cli = { features = ["rococo-native"], workspace = true, default-features = true }
polkadot-primitives = { workspace = true, default-features = true }
xcm = { workspace = true }

# Cumulus
cumulus-client-cli = { workspace = true, default-features = true }
cumulus-client-collator = { workspace = true, default-features = true }
cumulus-client-consensus-aura = { workspace = true, default-features = true }
cumulus-client-consensus-common = { workspace = true, default-features = true }
cumulus-client-consensus-proposer = { workspace = true, default-features = true }
cumulus-client-service = { workspace = true, default-features = true }
cumulus-primitives-core = { workspace = true, default-features = true }
cumulus-primitives-parachain-inherent = { workspace = true, default-features = true }
cumulus-relay-chain-interface = { workspace = true, default-features = true }
color-print = { workspace = true }

[build-dependencies]
substrate-build-script-utils = { workspace = true, default-features = true }
polkadot-sdk = { workspace = true, features = ["substrate-build-script-utils"] }

[features]
default = ["std"]
std = [
"log/std",
"parachain-template-runtime/std",
"xcm/std",
"polkadot-sdk/std",
]
runtime-benchmarks = [
"cumulus-primitives-core/runtime-benchmarks",
"frame-benchmarking-cli/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
"parachain-template-runtime/runtime-benchmarks",
"polkadot-cli/runtime-benchmarks",
"polkadot-primitives/runtime-benchmarks",
"sc-service/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"polkadot-sdk/runtime-benchmarks",
]
try-runtime = [
"parachain-template-runtime/try-runtime",
"polkadot-cli/try-runtime",
"sp-runtime/try-runtime",
"polkadot-sdk/try-runtime",
]
2 changes: 1 addition & 1 deletion templates/parachain/node/build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use substrate_build_script_utils::{generate_cargo_keys, rerun_if_git_head_changed};
use polkadot_sdk::substrate_build_script_utils::{generate_cargo_keys, rerun_if_git_head_changed};

fn main() {
generate_cargo_keys();
Expand Down
7 changes: 5 additions & 2 deletions templates/parachain/node/src/chain_spec.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use parachain_template_runtime as runtime;
use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
use sc_service::ChainType;
use polkadot_sdk::{
ggwpez marked this conversation as resolved.
Show resolved Hide resolved
sc_chain_spec::{self, ChainSpecExtension, ChainSpecGroup},
sc_service::{self, ChainType},
sp_genesis_builder,
};
use serde::{Deserialize, Serialize};

/// Specialized `ChainSpec` for the normal parachain runtime.
Expand Down
1 change: 1 addition & 0 deletions templates/parachain/node/src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use polkadot_sdk::{cumulus_client_cli, frame_benchmarking_cli, polkadot_cli, sc_cli, sc_service};
use std::path::PathBuf;

/// Sub-commands supported by the collator.
Expand Down
21 changes: 14 additions & 7 deletions templates/parachain/node/src/command.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
use cumulus_client_service::storage_proof_size::HostFunctions as ReclaimHostFunctions;
use cumulus_primitives_core::ParaId;
use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE};
use log::info;
use parachain_template_runtime::Block;
use sc_cli::{
ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams,
NetworkParams, Result, RpcEndpoint, SharedParams, SubstrateCli,
use polkadot_sdk::{
cumulus_client_service::storage_proof_size::HostFunctions as ReclaimHostFunctions,
cumulus_primitives_core::ParaId,
frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE},
polkadot_cli,
sc_cli::{
self, ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams,
KeystoreParams, NetworkParams, Result, RpcEndpoint, SharedParams, SubstrateCli,
},
sc_service::{
self,
config::{BasePath, PrometheusConfig},
},
sc_sysinfo, sc_telemetry, sp_runtime,
};
use sc_service::config::{BasePath, PrometheusConfig};

use crate::{
chain_spec,
Expand Down
2 changes: 2 additions & 0 deletions templates/parachain/node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#![warn(missing_docs)]

use polkadot_sdk::sc_cli;

mod chain_spec;
mod cli;
mod command;
Expand Down
12 changes: 8 additions & 4 deletions templates/parachain/node/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ use std::sync::Arc;

use parachain_template_runtime::{opaque::Block, AccountId, Balance, Nonce};

use sc_transaction_pool_api::TransactionPool;
use sp_api::ProvideRuntimeApi;
use sp_block_builder::BlockBuilder;
use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};
use polkadot_sdk::{
pallet_transaction_payment_rpc,
sc_transaction_pool_api::TransactionPool,
sp_api::ProvideRuntimeApi,
sp_block_builder::BlockBuilder,
sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata},
substrate_frame_rpc_system,
};

/// A type representing all RPC extensions.
pub type RpcExtension = jsonrpsee::RpcModule<()>;
Expand Down
54 changes: 31 additions & 23 deletions templates/parachain/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,50 @@
// std
use std::{sync::Arc, time::Duration};

use cumulus_client_cli::CollatorOptions;
// Local Runtime Types
use parachain_template_runtime::{
apis::RuntimeApi,
opaque::{Block, Hash},
};

// Cumulus Imports
use cumulus_client_collator::service::CollatorService;
#[docify::export(lookahead_collator)]
use cumulus_client_consensus_aura::collators::lookahead::{self as aura, Params as AuraParams};
use cumulus_client_consensus_common::ParachainBlockImport as TParachainBlockImport;
use cumulus_client_consensus_proposer::Proposer;
use cumulus_client_service::{
build_network, build_relay_chain_interface, prepare_node_config, start_relay_chain_tasks,
BuildNetworkParams, CollatorSybilResistance, DARecoveryProfile, ParachainHostFunctions,
StartRelayChainTasksParams,
use polkadot_sdk::cumulus_client_consensus_aura::collators::lookahead::{
self as aura, Params as AuraParams,
};
#[docify::export(cumulus_primitives)]
use cumulus_primitives_core::{
use polkadot_sdk::cumulus_primitives_core::{
relay_chain::{CollatorPair, ValidationCode},
ParaId,
};
use cumulus_relay_chain_interface::{OverseerHandle, RelayChainInterface};

// Substrate Imports
use frame_benchmarking_cli::SUBSTRATE_REFERENCE_HARDWARE;
use polkadot_sdk::{
cumulus_client_cli::CollatorOptions,
cumulus_client_collator::service::CollatorService,
cumulus_client_consensus_aura,
cumulus_client_consensus_common::ParachainBlockImport as TParachainBlockImport,
cumulus_client_consensus_proposer::Proposer,
cumulus_client_service::{
build_network, build_relay_chain_interface, prepare_node_config, start_relay_chain_tasks,
BuildNetworkParams, CollatorSybilResistance, DARecoveryProfile, ParachainHostFunctions,
StartRelayChainTasksParams,
},
cumulus_relay_chain_interface::{OverseerHandle, RelayChainInterface},
frame_benchmarking_cli::SUBSTRATE_REFERENCE_HARDWARE,
sc_basic_authorship,
sc_client_api::Backend,
sc_consensus::{self, ImportQueue},
sc_executor::{HeapAllocStrategy, WasmExecutor, DEFAULT_HEAP_ALLOC_STRATEGY},
sc_network::{self, NetworkBlock},
sc_offchain,
sc_service::{self, Configuration, PartialComponents, TFullBackend, TFullClient, TaskManager},
sc_sysinfo,
sc_telemetry::{self, Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle},
sc_transaction_pool,
sc_transaction_pool_api::OffchainTransactionPoolFactory,
sp_consensus_aura,
sp_keystore::KeystorePtr,
sp_timestamp,
};
use prometheus_endpoint::Registry;
use sc_client_api::Backend;
use sc_consensus::ImportQueue;
use sc_executor::{HeapAllocStrategy, WasmExecutor, DEFAULT_HEAP_ALLOC_STRATEGY};
use sc_network::NetworkBlock;
use sc_service::{Configuration, PartialComponents, TFullBackend, TFullClient, TaskManager};
use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle};
use sc_transaction_pool_api::OffchainTransactionPoolFactory;
use sp_keystore::KeystorePtr;

#[docify::export(wasm_executor)]
type ParachainExecutor = WasmExecutor<ParachainHostFunctions>;
Expand Down
Loading
Loading