The great refactor (#325)

* Move pallets to pallets folder and rename them

* Move genesis file to service

* Rename primitives to primitives-core

* Delete cumulus-runtime

* Move stuff to client folder and rename
This commit is contained in:
Bastian Köcher
2021-02-10 13:07:21 +01:00
committed by GitHub
parent a4998998a9
commit 119e0859b9
48 changed files with 436 additions and 547 deletions
+5 -5
View File
@@ -56,11 +56,11 @@ sp-offchain = { git = "https://github.com/paritytech/substrate", branch = "maste
jsonrpc-core = "15.1.0"
# Cumulus dependencies
cumulus-consensus = { path = "../consensus" }
cumulus-collator = { path = "../collator" }
cumulus-network = { path = "../network" }
cumulus-primitives = { path = "../primitives" }
cumulus-service = { path = "../service" }
cumulus-client-consensus = { path = "../client/consensus" }
cumulus-client-collator = { path = "../client/collator" }
cumulus-client-service = { path = "../client/service" }
cumulus-client-network = { path = "../client/network" }
cumulus-primitives-core = { path = "../primitives/core" }
# Polkadot dependencies
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master" }
@@ -409,4 +409,4 @@ impl_runtime_apis! {
}
}
cumulus_runtime::register_validate_block!(Block, Executive);
cumulus_pallet_parachain_system::register_validate_block!(Block, Executive);
@@ -11,14 +11,14 @@ serde = { version = "1.0.101", optional = true, features = ["derive"] }
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
cumulus-primitives = { path = "../../../primitives", default-features = false }
cumulus-primitives-core = { path = "../../../primitives/core", default-features = false }
[features]
default = ["std"]
std = [
"codec/std",
"serde",
"cumulus-primitives/std",
"frame-support/std",
"frame-system/std",
"codec/std",
"serde",
"cumulus-primitives-core/std",
"frame-support/std",
"frame-system/std",
]
@@ -20,7 +20,7 @@
use frame_support::{decl_module, decl_storage, traits::Get};
use cumulus_primitives::ParaId;
use cumulus_primitives_core::ParaId;
/// Configuration trait of this pallet.
pub trait Config: frame_system::Config {}
+6 -8
View File
@@ -34,10 +34,9 @@ pallet-sudo = { git = "https://github.com/paritytech/substrate", default-feature
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
# Cumulus dependencies
cumulus-runtime = { path = "../../runtime", default-features = false }
cumulus-parachain-system = { path = "../../parachain-system", default-features = false }
cumulus-primitives = { path = "../../primitives", default-features = false }
xcm-handler = { path = "../../xcm-handler", default-features = false }
cumulus-pallet-parachain-system = { path = "../../pallets/parachain-system", default-features = false }
cumulus-primitives-core = { path = "../../primitives/core", default-features = false }
cumulus-pallet-xcm-handler = { path = "../../pallets/xcm-handler", default-features = false }
# Polkadot dependencies
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
@@ -74,11 +73,10 @@ std = [
"pallet-transaction-payment/std",
"parachain-info/std",
"rococo-parachain-primitives/std",
"cumulus-runtime/std",
"cumulus-parachain-system/std",
"cumulus-primitives/std",
"cumulus-pallet-parachain-system/std",
"cumulus-pallet-xcm-handler/std",
"cumulus-primitives-core/std",
"xcm/std",
"xcm-builder/std",
"xcm-executor/std",
"xcm-handler/std",
]
+7 -7
View File
@@ -229,7 +229,7 @@ impl pallet_sudo::Config for Runtime {
type Event = Event;
}
impl cumulus_parachain_system::Config for Runtime {
impl cumulus_pallet_parachain_system::Config for Runtime {
type Event = Event;
type OnValidationData = ();
type SelfParaId = parachain_info::Module<Runtime>;
@@ -242,7 +242,7 @@ impl parachain_info::Config for Runtime {}
parameter_types! {
pub const RococoLocation: MultiLocation = MultiLocation::X1(Junction::Parent);
pub const RococoNetwork: NetworkId = NetworkId::Polkadot;
pub RelayChainOrigin: Origin = xcm_handler::Origin::Relay.into();
pub RelayChainOrigin: Origin = cumulus_pallet_xcm_handler::Origin::Relay.into();
pub Ancestry: MultiLocation = Junction::Parachain {
id: ParachainInfo::parachain_id().into()
}.into();
@@ -268,7 +268,7 @@ type LocalAssetTransactor = CurrencyAdapter<
type LocalOriginConverter = (
SovereignSignedViaLocation<LocationConverter, Origin>,
RelayChainAsNative<RelayChainOrigin, Origin>,
SiblingParachainAsNative<xcm_handler::Origin, Origin>,
SiblingParachainAsNative<cumulus_pallet_xcm_handler::Origin, Origin>,
SignedAccountId32AsNative<RococoNetwork, Origin>,
);
@@ -284,7 +284,7 @@ impl Config for XcmConfig {
type LocationInverter = LocationInverter<Ancestry>;
}
impl xcm_handler::Config for Runtime {
impl cumulus_pallet_xcm_handler::Config for Runtime {
type Event = Event;
type XcmExecutor = XcmExecutor<XcmConfig>;
type UpwardMessageSender = ParachainSystem;
@@ -302,10 +302,10 @@ construct_runtime! {
Balances: pallet_balances::{Module, Call, Storage, Config<T>, Event<T>},
Sudo: pallet_sudo::{Module, Call, Storage, Config<T>, Event<T>},
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Call, Storage},
ParachainSystem: cumulus_parachain_system::{Module, Call, Storage, Inherent, Event},
ParachainSystem: cumulus_pallet_parachain_system::{Module, Call, Storage, Inherent, Event},
TransactionPayment: pallet_transaction_payment::{Module, Storage},
ParachainInfo: parachain_info::{Module, Storage, Config},
XcmHandler: xcm_handler::{Module, Call, Event<T>, Origin},
XcmHandler: cumulus_pallet_xcm_handler::{Module, Call, Event<T>, Origin},
}
}
@@ -414,4 +414,4 @@ impl_runtime_apis! {
}
}
cumulus_runtime::register_validate_block!(Block, Executive);
cumulus_pallet_parachain_system::register_validate_block!(Block, Executive);
+1 -1
View File
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
use cumulus_primitives::ParaId;
use cumulus_primitives_core::ParaId;
use hex_literal::hex;
use rococo_parachain_primitives::{AccountId, Signature};
use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
+10 -8
View File
@@ -19,13 +19,14 @@ use crate::{
cli::{Cli, RelayChainCli, Subcommand},
};
use codec::Encode;
use cumulus_primitives::{genesis::generate_genesis_block, ParaId};
use cumulus_primitives_core::ParaId;
use cumulus_client_service::genesis::generate_genesis_block;
use log::info;
use parachain_runtime::Block;
use polkadot_parachain::primitives::AccountIdConversion;
use sc_cli::{
ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams,
KeystoreParams, NetworkParams, Result, RuntimeVersion, SharedParams, SubstrateCli,
ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams,
NetworkParams, Result, RuntimeVersion, SharedParams, SubstrateCli,
};
use sc_service::{
config::{BasePath, PrometheusConfig},
@@ -291,11 +292,12 @@ pub fn run() -> Result<()> {
let task_executor = config.task_executor.clone();
let polkadot_config = SubstrateCli::create_configuration(
&polkadot_cli,
&polkadot_cli,
task_executor,
config.telemetry_handle.clone(),
).map_err(|err| format!("Relay chain argument error: {}", err))?;
&polkadot_cli,
&polkadot_cli,
task_executor,
config.telemetry_handle.clone(),
)
.map_err(|err| format!("Relay chain argument error: {}", err))?;
let collator = cli.run.base.validator || cli.collator;
info!("Parachain id: {:?}", id);
+7 -6
View File
@@ -14,8 +14,9 @@
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
use cumulus_network::build_block_announce_validator;
use cumulus_service::{
use cumulus_client_network::build_block_announce_validator;
use cumulus_primitives_core::ParaId;
use cumulus_client_service::{
prepare_node_config, start_collator, start_full_node, StartCollatorParams, StartFullNodeParams,
};
use parachain_runtime::RuntimeApi;
@@ -69,7 +70,7 @@ pub fn new_partial(
client.clone(),
);
let import_queue = cumulus_consensus::import_queue::import_queue(
let import_queue = cumulus_client_consensus::import_queue::import_queue(
client.clone(),
client.clone(),
inherent_data_providers.clone(),
@@ -100,7 +101,7 @@ async fn start_node_impl<RB>(
parachain_config: Configuration,
collator_key: CollatorPair,
polkadot_config: Configuration,
id: polkadot_primitives::v0::Id,
id: ParaId,
validator: bool,
rpc_ext_builder: RB,
) -> sc_service::error::Result<(TaskManager, Arc<TFullClient<Block, RuntimeApi, Executor>>)>
@@ -118,7 +119,7 @@ where
let parachain_config = prepare_node_config(parachain_config);
let polkadot_full_node =
cumulus_service::build_polkadot_full_node(polkadot_config, collator_key.public()).map_err(
cumulus_client_service::build_polkadot_full_node(polkadot_config, collator_key.public()).map_err(
|e| match e {
polkadot_service::Error::Sub(x) => x,
s => format!("{}", s).into(),
@@ -228,7 +229,7 @@ pub async fn start_node(
parachain_config: Configuration,
collator_key: CollatorPair,
polkadot_config: Configuration,
id: polkadot_primitives::v0::Id,
id: ParaId,
validator: bool,
) -> sc_service::error::Result<(TaskManager, Arc<TFullClient<Block, RuntimeApi, Executor>>)> {
start_node_impl(