Skip to content

Commit

Permalink
feat: separate runtimes (#46)
Browse files Browse the repository at this point in the history
* feat(pop-network): ready for testnet

* fix(pop-network): address feedback

* chore(pop-network): fmt

* chore(pop-network): update cargo lock

* chore(pop-network): runtime descriptions and FilteredCalls

* chroe(pop-network): complete relay naming

* chore(pop-network): feature-gate async backing

* typo(pop-network): wrong feature name

* chore(pop-network): relay_chain_slot_time is always 6000

* chrose(pop-network): paseo feature works properly

* chore(pop-network): fmt

* fix(pop-network): rococo genesis doesn't depend on pop-runtime

* fix(pop-network): Make CI happy

* fix(pop-network): missing contruct_benchmark_partials

* chrone(pop-network): fix fmt

* chore(pop-network): typo

* refactor(integration-tests): simplify runtime imports

* refactor(node): fix clippy warnings

Enum variants should be sentence-cased rather than capitalised.

* fix(chain-spec): remove endowments

Regression from main as result of runtime split

* refactor: remove unnecessary default runtime

Devnet always used when resolved to default, so just uses devnet and removes the additional default variant.

* refactor: simplify manifests

* docs(runtime): remove old link

---------

Co-authored-by: Frank Bell <frank@r0gue.io>
  • Loading branch information
al3mart and evilrobot-01 authored Mar 27, 2024
1 parent 74943ec commit acd5892
Show file tree
Hide file tree
Showing 43 changed files with 3,904 additions and 572 deletions.
519 changes: 306 additions & 213 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ edition = "2021"
homepage = "https://r0gue.io"
license = "Unlicense"
repository = "https://github.com/r0gue-io/pop-node/"
description = "Pop Network makes it easy for smart contract developers to use the Power of Polkadot."

[workspace]
members = [
"node",
"runtime",
"runtime/devnet",
"runtime/testnet",
"integration-tests",
"primitives",
]
Expand Down Expand Up @@ -39,7 +41,9 @@ substrate-wasm-builder = { git = "https://github.com/paritytech/polkadot-sdk", b
substrate-build-script-utils = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.1" }

# Local
pop-runtime = { path = "./runtime", default-features = true } # default-features=true required for `-p pop-node` builds
pop-runtime-devnet = { path = "runtime/devnet", default-features = true } # default-features=true required for `-p pop-node` builds
pop-runtime-testnet = { path = "runtime/testnet", default-features = true } # default-features=true required for `-p pop-node` builds
pop-runtime-common = { path = "runtime/common", default-features = false }
pop-primitives = { path = "./primitives", default-features = false }

# Substrate
Expand Down Expand Up @@ -143,4 +147,4 @@ cumulus-client-collator = { git = "https://github.com/paritytech/polkadot-sdk",
cumulus-client-consensus-aura = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.1" }
cumulus-client-consensus-common = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.1" }
cumulus-client-consensus-proposer = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.1" }
cumulus-client-service = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.1" }
cumulus-client-service = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.1" }
11 changes: 6 additions & 5 deletions integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ cumulus-primitives-core.workspace = true
emulated-integration-tests-common.workspace = true

# Local
pop-runtime.workspace = true
pop-runtime-devnet.workspace = true
pop-runtime-common.workspace = true

[features]
default = ["std"]
Expand All @@ -52,7 +53,7 @@ std = [
"pallet-xcm/std",
"polkadot-primitives/std",
"polkadot-runtime-parachains/std",
"pop-runtime/std",
"pop-runtime-devnet/std",
"rococo-runtime-constants/std",
"rococo-runtime/std",
"sp-authority-discovery/std",
Expand All @@ -73,7 +74,7 @@ runtime-benchmarks = [
"pallet-balances/runtime-benchmarks",
"pallet-message-queue/runtime-benchmarks",
"polkadot-primitives/runtime-benchmarks",
"pop-runtime/runtime-benchmarks",
"pop-runtime-devnet/runtime-benchmarks",
"rococo-runtime/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
Expand All @@ -85,7 +86,7 @@ try-runtime = [
"pallet-assets/try-runtime",
"pallet-balances/std",
"pallet-message-queue/try-runtime",
"pop-runtime/try-runtime",
"pop-runtime-devnet/try-runtime",
"rococo-runtime/try-runtime",
"sp-runtime/try-runtime",
]
]
2 changes: 1 addition & 1 deletion integration-tests/src/chains/asset_hub_rococo/genesis.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use emulated_integration_tests_common::{
accounts, build_genesis_storage, collators, SAFE_XCM_VERSION,
};
use pop_runtime::Balance;
use pop_runtime_common::Balance;
use sp_core::storage::Storage;

pub(crate) const PARA_ID: u32 = 1000;
Expand Down
27 changes: 14 additions & 13 deletions integration-tests/src/chains/pop_network/genesis.rs
Original file line number Diff line number Diff line change
@@ -1,37 +1,38 @@
use emulated_integration_tests_common::{build_genesis_storage, collators};
use pop_runtime::Balance;
use pop_runtime_common::Balance;
use pop_runtime_devnet as runtime;
use sp_core::storage::Storage;

pub(crate) const ED: Balance = pop_runtime::EXISTENTIAL_DEPOSIT;
pub(crate) const ED: Balance = runtime::EXISTENTIAL_DEPOSIT;
const PARA_ID: u32 = 9090;
const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION;

pub(crate) fn genesis() -> Storage {
let genesis_config = pop_runtime::RuntimeGenesisConfig {
system: pop_runtime::SystemConfig::default(),
balances: pop_runtime::BalancesConfig { ..Default::default() },
parachain_info: pop_runtime::ParachainInfoConfig {
let genesis_config = runtime::RuntimeGenesisConfig {
system: runtime::SystemConfig::default(),
balances: runtime::BalancesConfig { ..Default::default() },
parachain_info: runtime::ParachainInfoConfig {
parachain_id: PARA_ID.into(),
..Default::default()
},
collator_selection: pop_runtime::CollatorSelectionConfig {
collator_selection: runtime::CollatorSelectionConfig {
invulnerables: collators::invulnerables().iter().cloned().map(|(acc, _)| acc).collect(),
candidacy_bond: ED * 16,
..Default::default()
},
session: pop_runtime::SessionConfig {
session: runtime::SessionConfig {
keys: collators::invulnerables()
.into_iter()
.map(|(acc, aura)| {
(
acc.clone(), // account id
acc, // validator id
pop_runtime::SessionKeys { aura }, // session keys
acc.clone(), // account id
acc, // validator id
runtime::SessionKeys { aura }, // session keys
)
})
.collect(),
},
polkadot_xcm: pop_runtime::PolkadotXcmConfig {
polkadot_xcm: runtime::PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
..Default::default()
},
Expand All @@ -40,6 +41,6 @@ pub(crate) fn genesis() -> Storage {

build_genesis_storage(
&genesis_config,
pop_runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"),
runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"),
)
}
16 changes: 8 additions & 8 deletions integration-tests/src/chains/pop_network/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ decl_test_parachains! {
pub struct PopNetwork {
genesis = genesis::genesis(),
on_init = {
pop_runtime::AuraExt::on_initialize(1);
pop_runtime_devnet::AuraExt::on_initialize(1);
},
runtime = pop_runtime,
runtime = pop_runtime_devnet,
core = {
XcmpMessageHandler: pop_runtime::XcmpQueue,
LocationToAccountId: pop_runtime::xcm_config::LocationToAccountId,
ParachainInfo: pop_runtime::ParachainInfo,
XcmpMessageHandler: pop_runtime_devnet::XcmpQueue,
LocationToAccountId: pop_runtime_devnet::xcm_config::LocationToAccountId,
ParachainInfo: pop_runtime_devnet::ParachainInfo,
MessageOrigin: cumulus_primitives_core::AggregateMessageOrigin,
},
pallets = {
PolkadotXcm: pop_runtime::PolkadotXcm,
Assets: pop_runtime::Assets,
Balances: pop_runtime::Balances,
PolkadotXcm: pop_runtime_devnet::PolkadotXcm,
Assets: pop_runtime_devnet::Assets,
Balances: pop_runtime_devnet::Balances,
}
},
}
Expand Down
3 changes: 1 addition & 2 deletions integration-tests/src/chains/rococo/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ use emulated_integration_tests_common::{
accounts, build_genesis_storage, get_account_id_from_seed, get_from_seed, get_host_config,
validators,
};
use polkadot_primitives::{AssignmentId, ValidatorId};
use pop_runtime::Balance;
use polkadot_primitives::{AssignmentId, Balance, ValidatorId};
use rococo_runtime_constants::currency::UNITS as ROC;
use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId;
use sp_consensus_babe::AuthorityId as BabeId;
Expand Down
4 changes: 3 additions & 1 deletion integration-tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ use frame_support::{
sp_runtime::DispatchResult,
};
use polkadot_runtime_parachains::assigner_on_demand;
use pop_runtime::{xcm_config::XcmConfig as PopNetworkXcmConfig, Balance};
use pop_runtime_common::Balance;
use pop_runtime_devnet as pop_runtime;
use pop_runtime_devnet::xcm_config::XcmConfig as PopNetworkXcmConfig;
use rococo_runtime::xcm_config::XcmConfig as RococoXcmConfig;
use sp_core::Encode;
use xcm::prelude::*;
Expand Down
140 changes: 74 additions & 66 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,93 +1,101 @@
[package]
name = "pop-node"
version = "0.1.0"
authors = { workspace = true }
description = "A new Cumulus FRAME-based Substrate Node, ready for hacking together a parachain."
authors.workspace = true
description.workspace = true
license = "Unlicense"
homepage = { workspace = true }
homepage.workspace = true
repository.workspace = true
edition.workspace = true
build = "build.rs"
publish = false

[dependencies]
clap = { workspace = true }
log = { workspace = true }
codec = { workspace = true }
serde = { workspace = true }
jsonrpsee = { workspace = true }
futures = { workspace = true }
serde_json = { workspace = true }
clap.workspace = true
log.workspace = true
codec.workspace = true
serde.workspace = true
jsonrpsee.workspace = true
futures.workspace = true
serde_json.workspace = true

# Local
pop-runtime = { workspace = true }
pop-runtime-devnet.workspace = true
pop-runtime-testnet.workspace = true
pop-runtime-common.workspace = true

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

# Polkadot
polkadot-cli = { workspace = true }
polkadot-primitives = { workspace = true }
xcm = { workspace = true }
polkadot-cli.workspace = true
polkadot-primitives.workspace = true
xcm.workspace = true

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

[build-dependencies]
substrate-build-script-utils = { workspace = true }
substrate-build-script-utils.workspace = true

[features]
default = []
runtime-benchmarks = [
"cumulus-primitives-core/runtime-benchmarks",
"frame-benchmarking-cli/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
"pop-runtime/runtime-benchmarks",
"polkadot-cli/runtime-benchmarks",
"polkadot-primitives/runtime-benchmarks",
"sc-service/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"cumulus-primitives-core/runtime-benchmarks",
"frame-benchmarking-cli/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
"pop-runtime-devnet/runtime-benchmarks",
"pop-runtime-testnet/runtime-benchmarks",
"polkadot-cli/runtime-benchmarks",
"polkadot-primitives/runtime-benchmarks",
"sc-service/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
]
try-runtime = [
"pop-runtime/try-runtime",
"polkadot-cli/try-runtime",
"sp-runtime/try-runtime",
"pop-runtime-devnet/try-runtime",
"pop-runtime-testnet/try-runtime",
"polkadot-cli/try-runtime",
"sp-runtime/try-runtime",
]
73 changes: 73 additions & 0 deletions node/chain_specs/pop-paseo.plain.json

Large diffs are not rendered by default.

73 changes: 73 additions & 0 deletions node/chain_specs/pop-paseo.raw.json

Large diffs are not rendered by default.

73 changes: 73 additions & 0 deletions node/chain_specs/pop-rococo.plain.json

Large diffs are not rendered by default.

74 changes: 74 additions & 0 deletions node/chain_specs/pop-rococo.raw.json

Large diffs are not rendered by default.

Loading

0 comments on commit acd5892

Please sign in to comment.