From c433788e8f4b60533d01a8ae5df46e09893414f7 Mon Sep 17 00:00:00 2001 From: Seun Lanlege Date: Thu, 19 Dec 2024 13:32:17 +0000 Subject: [PATCH] migrate to umbrella crate --- Cargo.toml | 146 +------------- examples/aura/node/Cargo.toml | 95 ++++----- examples/aura/node/build.rs | 2 +- examples/aura/node/src/benchmarking.rs | 2 + examples/aura/node/src/chain_spec.rs | 2 + examples/aura/node/src/cli.rs | 2 + examples/aura/node/src/command.rs | 2 + examples/aura/node/src/main.rs | 2 + examples/aura/node/src/rpc.rs | 1 + examples/aura/node/src/service.rs | 2 + examples/aura/runtime/Cargo.toml | 116 ++++------- examples/aura/runtime/src/lib.rs | 14 +- examples/babe/node/Cargo.toml | 115 +++++------ examples/babe/node/build.rs | 2 +- examples/babe/node/src/benchmarking.rs | 2 + examples/babe/node/src/chain_spec.rs | 2 + examples/babe/node/src/cli.rs | 2 + examples/babe/node/src/command.rs | 2 + examples/babe/node/src/lib.rs | 2 - examples/babe/node/src/main.rs | 2 +- examples/babe/node/src/service.rs | 2 + examples/babe/rpc/Cargo.toml | 50 ++--- examples/babe/rpc/src/lib.rs | 2 + examples/babe/runtime/Cargo.toml | 152 +++++---------- examples/babe/runtime/src/assets_api.rs | 2 + examples/babe/runtime/src/impls.rs | 4 + examples/babe/runtime/src/lib.rs | 25 +-- examples/parachain/node/Cargo.toml | 107 +++++----- examples/parachain/node/build.rs | 2 +- examples/parachain/node/src/chain_spec.rs | 2 + examples/parachain/node/src/cli.rs | 2 + examples/parachain/node/src/command.rs | 2 + examples/parachain/node/src/main.rs | 2 + examples/parachain/node/src/rpc.rs | 2 + examples/parachain/node/src/service.rs | 2 + examples/parachain/runtime/Cargo.toml | 182 ++++++------------ examples/parachain/runtime/src/lib.rs | 11 +- .../runtime/src/weights/block_weights.rs | 4 + .../runtime/src/weights/extrinsic_weights.rs | 4 + .../runtime/src/weights/paritydb_weights.rs | 4 + .../runtime/src/weights/rocksdb_weights.rs | 4 + examples/parachain/runtime/src/xcm_config.rs | 7 +- runtime-api/Cargo.toml | 9 +- runtime-api/src/lib.rs | 2 + simnode/Cargo.toml | 119 ++++++------ simnode/src/cli.rs | 2 + simnode/src/client.rs | 2 + simnode/src/client/aura.rs | 12 +- simnode/src/client/babe.rs | 12 +- simnode/src/client/parachain.rs | 24 ++- simnode/src/client/timestamp.rs | 4 +- simnode/src/lib.rs | 3 + simnode/src/overrides.rs | 2 + simnode/src/rpc.rs | 2 + simnode/src/sproof.rs | 10 +- tests/Cargo.toml | 2 +- tests/src/aura.rs | 2 + tests/src/babe.rs | 2 + tests/src/parachain.rs | 1 + 59 files changed, 537 insertions(+), 762 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 17be2f0..214b6ca 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,150 +22,14 @@ members = [ [workspace.dependencies] codec = { version = "3.1.3", package = "parity-scale-codec", default-features = false } scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +jsonrpsee = "0.24" +try-runtime-cli = "0.41.0" +polkadot-sdk = { version = "0.7.0", default-features = false } -# wasm -frame-benchmarking = { version = "38.0.0", default-features = false } -frame-executive = { version = "38.0.0", default-features = false } -frame-election-provider-support = { version = "38.0.0", default-features = false } -frame-support = { version = "38.0.0", default-features = false } -frame-system = { version = "38.0.0", default-features = false } -frame-system-benchmarking = { version = "38.0.0", default-features = false } -frame-system-rpc-runtime-api = { version = "34.0.0", default-features = false } -frame-try-runtime = { version = "0.44.0", default-features = false } -pallet-aura = { version = "37.0.0", default-features = false } -pallet-grandpa = { version = "38.0.0", default-features = false } -pallet-babe = { version = "38.0.0", default-features = false } -pallet-offences = { version = "37.0.0", default-features = false } -pallet-authorship = { version = "38.0.0", default-features = false } -pallet-balances = { version = "39.0.0", default-features = false } -pallet-session = { version = "38.0.0", default-features = false } -pallet-staking = { version = "38.0.0", default-features = false } -pallet-session-benchmarking = { version = "38.0.0", default-features = false } -pallet-sudo = { version = "38.0.0", default-features = false } -pallet-timestamp = { version = "37.0.0", default-features = false } -pallet-transaction-payment = { version = "38.0.0", default-features = false } -pallet-transaction-payment-rpc-runtime-api = { version = "38.0.0", default-features = false } -pallet-message-queue = { version = "41.0.2", default-features = false } -pallet-beefy-mmr = { version = "39.0.0", default-features = false } -pallet-assets = { version = "40.0.0", default-features = false } -pallet-staking-reward-curve = { version = "12.0.0" } - -sp-api = { version = "34.0.0", default-features = false } -sp-blockchain = { version = "37.0.1", default-features = false } -sp-io = { version = "38.0.0", default-features = false } -sp-trie = { version = "37.0.0", default-features = false } -sp-block-builder = { version = "34.0.0", default-features = false } -sp-consensus-aura = { version = "0.40.0", default-features = false } -sp-consensus-babe = { version = "0.40.0", default-features = false } -sp-consensus-grandpa = { version = "21.0.0", default-features = false } -sp-consensus-slots = { version = "0.40.1", default-features = false } -sp-consensus = { version = "0.40.0", default-features = false } -sp-consensus-beefy = { version = "22.1.0", default-features = false } +# crates which cannot be used from polkadot-sdk sp-core = { version = "34.0.0", default-features = false } -sp-inherents = { version = "34.0.0", default-features = false } -sp-externalities = { version = "0.29.0", default-features = false } -sp-offchain = { version = "34.0.0", default-features = false } -sp-keyring = { version = "39.0.0", default-features = false } -sp-runtime = { version = "39.0.1", default-features = false } sp-runtime-interface = { version = "28.0.0", default-features = false } -sp-timestamp = { version = "34.0.0", default-features = false } -sp-keystore = { version = "0.40.0", default-features = false } -sp-mmr-primitives = { version = "34.1.0", default-features = false } -sp-state-machine = { version = "0.43.0", default-features = false } -sp-storage = { version = "21.0.0", default-features = false } -sp-staking = { version = "36.0.0", default-features = false } -sp-session = { version = "36.0.0", default-features = false } -sp-std = { version = "14.0.0", default-features = false } -sp-transaction-pool = { version = "34.0.0", default-features = false } -sp-version = { version = "37.0.0", default-features = false } -sp-genesis-builder = { version = "0.15.1", default-features = false } -sp-wasm-interface = { version = "21.0.1", default-features = false } -sp-transaction-storage-proof = { version = "34.0.0", default-features = false } - -pallet-xcm = { version = "17.0.1", default-features = false } -polkadot-parachain-primitives = { version = "14.0.0", default-features = false } -polkadot-runtime-common = { version = "17.0.0", default-features = false } -staging-xcm = { version = "14.2.0", default-features = false } -staging-xcm-builder = { version = "17.0.1", default-features = false } -staging-xcm-executor = { version = "17.0.0", default-features = false } - -cumulus-primitives-aura = { version = "0.15.0", default-features = false } -cumulus-pallet-session-benchmarking = { version = "19.0.0", default-features = false } -cumulus-pallet-aura-ext = { version = "0.17.0", default-features = false } -cumulus-pallet-dmp-queue = { version = "0.17.0", default-features = false } cumulus-pallet-parachain-system = { version = "0.17.1", default-features = false } -cumulus-pallet-xcm = { version = "0.17.0", default-features = false } -cumulus-pallet-xcmp-queue = { version = "0.17.0", default-features = false } -cumulus-primitives-core = { version = "0.16.0", default-features = false } - -cumulus-primitives-timestamp = { version = "0.16.0", default-features = false } -cumulus-primitives-utility = { version = "0.17.0", default-features = false } -pallet-collator-selection = { version = "19.0.0", default-features = false } -parachain-info = { version = "0.17.0", package = "staging-parachain-info", default-features = false } -parachains-common = { version = "18.0.0", default-features = false } - - -# client -parachain-inherent = { version = "0.16.0", package = "cumulus-primitives-parachain-inherent" } -sproof-builder = { version = "0.16.0", package = "cumulus-test-relay-sproof-builder" } -frame-benchmarking-cli = "43.0.0" - -pallet-transaction-payment-rpc = "41.0.0" -sc-basic-authorship = "0.45.0" - -sc-chain-spec = "38.0.0" -sc-cli = "0.47.0" -sc-keystore = "33.0.0" -sc-informant = "0.44.0" -sc-block-builder = "0.42.0" -sc-client-api = "37.0.0" -sc-client-db = "0.44.1" -sc-consensus = "0.44.0" -sc-consensus-aura = "0.45.0" -sc-consensus-grandpa = "0.30.0" -sc-consensus-babe = "0.45.0" -sc-consensus-epochs = "0.44.0" -sc-consensus-slots = "0.44.0" -sc-executor = "0.40.1" -sc-network = "0.45.1" -sc-network-sync = "0.44.1" -sc-network-common = "0.44.0" -sc-rpc = "40.0.0" -sc-rpc-api = "0.44.0" -sc-rpc-server = "17.1.0" -sc-rpc-spec-v2 = "0.45.0" -substrate-state-trie-migration-rpc = "38.0.0" -sc-consensus-babe-rpc = "0.45.0" -sc-consensus-grandpa-rpc = "0.30.0" -sc-sync-state-rpc = "0.45.0" +substrate-wasm-builder = "24.0.1" sc-service = "0.46.0" -sc-sysinfo = "38.0.0" -sc-storage-monitor = "0.22.0" -sc-telemetry = "25.0.0" sc-tracing = "37.0.1" -sc-transaction-pool = "37.0.0" -sc-transaction-pool-api = "37.0.0" -sc-offchain = "40.0.0" -manual-seal = { version = "0.46.0", package = "sc-consensus-manual-seal" } -substrate-frame-rpc-system = "39.0.0" -substrate-prometheus-endpoint = "0.17.0" -try-runtime-cli = "0.41.0" -polkadot-cli = "19.0.0" -polkadot-primitives = "16.0.0" -polkadot-service = "19.0.0" -cumulus-client-cli = "0.18.0" -cumulus-client-consensus-aura = "0.18.0" -cumulus-client-consensus-common = "0.18.0" -cumulus-client-network = "0.18.0" -cumulus-client-service = "0.19.0" -cumulus-primitives-parachain-inherent = "0.16.0" -cumulus-relay-chain-interface = "0.18.0" -cumulus-client-consensus-proposer = "0.16.0" -cumulus-client-collator = "0.18.0" -substrate-wasm-builder = { version = "24.0.1" } -mmr-rpc = { version = "38.0.0" } -xcm-simulator-example = "17.0.0" -xcm-simulator = "17.0.0" -polkadot-runtime-parachains = "17.0.1" -substrate-build-script-utils = "11.0.0" -jsonrpsee = "0.24" diff --git a/examples/aura/node/Cargo.toml b/examples/aura/node/Cargo.toml index bd0ed3b..fb54649 100644 --- a/examples/aura/node/Cargo.toml +++ b/examples/aura/node/Cargo.toml @@ -19,66 +19,67 @@ name = "aura-node" [dependencies] clap = { version = "4.0.9", features = ["derive"] } futures = { version = "0.3.21", features = ["thread-pool"] } - -sc-cli = { workspace = true } -sp-core = { workspace = true } -sc-executor = { workspace = true } -sc-service = { workspace = true } -sc-network = { workspace = true } -sc-offchain = { workspace = true } -sc-telemetry = { workspace = true } -sc-keystore = { workspace = true } -sc-transaction-pool = { workspace = true } -sc-transaction-pool-api = { workspace = true } -sc-consensus-aura = { workspace = true } -sp-consensus-aura = { workspace = true } -sp-consensus = { workspace = true } -sc-consensus = { workspace = true } -sc-consensus-grandpa = { workspace = true } -sp-consensus-grandpa = { workspace = true } -sc-client-api = { workspace = true } -sp-runtime = { workspace = true } -sp-io = { workspace = true, default-features = true } -sp-timestamp = { workspace = true } -sp-inherents = { workspace = true } -sp-keyring = { workspace = true } -frame-system = { workspace = true } -pallet-transaction-payment = { default-features = false, workspace = true } - -# These dependencies are used for the node template's RPCs jsonrpsee = { workspace = true, features = ["server"] } -sc-rpc = { workspace = true } -sp-api = { workspace = true } -sc-rpc-api = { workspace = true } -sp-blockchain = { workspace = true } -sp-block-builder = { workspace = true } -sc-basic-authorship = { workspace = true } -substrate-frame-rpc-system = { workspace = true } -pallet-transaction-payment-rpc = { workspace = true } - -# These dependencies are used for runtime benchmarking -frame-benchmarking = { workspace = true } -frame-benchmarking-cli = { workspace = true } +try-runtime-cli = { optional = true, workspace = true } +serde_json = "1.0" -# Local Dependencies aura-runtime = { path = "../runtime" } sc-simnode = { path = "../../../simnode", features = ["aura"] } -# CLI-specific dependencies -try-runtime-cli = { optional = true, workspace = true } -serde_json = "1.0" +[dependencies.polkadot-sdk] +workspace = true +default-features = false +features = [ + "sp-io", + "sc-cli", + "sp-core", + "sc-executor", + "sc-service", + "sc-network", + "sc-offchain", + "sc-telemetry", + "sc-keystore", + "sc-transaction-pool", + "sc-transaction-pool-api", + "sc-consensus-aura", + "sp-consensus-aura", + "sp-consensus", + "sc-consensus", + "sc-consensus-grandpa", + "sp-consensus-grandpa", + "sc-client-api", + "sp-runtime", + "sp-timestamp", + "sp-inherents", + "sp-keyring", + "frame-system", + "sc-rpc", + "sp-api", + "sc-rpc-api", + "sp-blockchain", + "sp-block-builder", + "sc-basic-authorship", + "substrate-frame-rpc-system", + "pallet-transaction-payment", + "pallet-transaction-payment-rpc", + "frame-benchmarking", + "frame-benchmarking-cli", +] [build-dependencies] -substrate-build-script-utils = { workspace = true } +polkadot-sdk = { workspace = true, default-features = true, features = ["substrate-build-script-utils"] } [features] default = [] # Dependencies that are only required if runtime benchmarking should be build. runtime-benchmarks = [ "aura-runtime/runtime-benchmarks", - "frame-benchmarking/runtime-benchmarks", - "frame-benchmarking-cli/runtime-benchmarks", + "polkadot-sdk/runtime-benchmarks", ] # Enable features that allow the runtime to be tried and debugged. Name might be subject to change # in the near future. -try-runtime = ["aura-runtime/try-runtime", "try-runtime-cli/try-runtime"] +try-runtime = [ + "aura-runtime/try-runtime", + "polkadot-sdk/try-runtime", + "try-runtime-cli/try-runtime" +] diff --git a/examples/aura/node/build.rs b/examples/aura/node/build.rs index e3bfe31..8ee8f23 100644 --- a/examples/aura/node/build.rs +++ b/examples/aura/node/build.rs @@ -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(); diff --git a/examples/aura/node/src/benchmarking.rs b/examples/aura/node/src/benchmarking.rs index 1e13b7d..a8bd53b 100644 --- a/examples/aura/node/src/benchmarking.rs +++ b/examples/aura/node/src/benchmarking.rs @@ -2,6 +2,8 @@ //! //! Should only be used for benchmarking as it may break in other contexts. +use polkadot_sdk::*; + use crate::service::FullClient; use aura_runtime as runtime; diff --git a/examples/aura/node/src/chain_spec.rs b/examples/aura/node/src/chain_spec.rs index 0ca6841..a474e09 100644 --- a/examples/aura/node/src/chain_spec.rs +++ b/examples/aura/node/src/chain_spec.rs @@ -1,3 +1,5 @@ +use polkadot_sdk::*; + use aura_runtime::{AccountId, Signature, WASM_BINARY}; use sc_service::ChainType; use sp_consensus_aura::sr25519::AuthorityId as AuraId; diff --git a/examples/aura/node/src/cli.rs b/examples/aura/node/src/cli.rs index 7a2dc6a..0997df3 100644 --- a/examples/aura/node/src/cli.rs +++ b/examples/aura/node/src/cli.rs @@ -1,3 +1,5 @@ +use polkadot_sdk::*; + use sc_cli::RunCmd; #[derive(Debug, clap::Parser)] diff --git a/examples/aura/node/src/command.rs b/examples/aura/node/src/command.rs index 954634f..0450f1f 100644 --- a/examples/aura/node/src/command.rs +++ b/examples/aura/node/src/command.rs @@ -1,3 +1,5 @@ +use polkadot_sdk::*; + use crate::{ benchmarking::{inherent_benchmark_data, RemarkBuilder, TransferKeepAliveBuilder}, chain_spec, diff --git a/examples/aura/node/src/main.rs b/examples/aura/node/src/main.rs index 426cbab..f3a51cb 100644 --- a/examples/aura/node/src/main.rs +++ b/examples/aura/node/src/main.rs @@ -1,6 +1,8 @@ //! Substrate Node Template CLI library. #![warn(missing_docs)] +use polkadot_sdk::*; + mod chain_spec; #[macro_use] mod service; diff --git a/examples/aura/node/src/rpc.rs b/examples/aura/node/src/rpc.rs index c492831..5351a7c 100644 --- a/examples/aura/node/src/rpc.rs +++ b/examples/aura/node/src/rpc.rs @@ -4,6 +4,7 @@ //! capabilities that are specific to this project's runtime configuration. #![warn(missing_docs)] +use polkadot_sdk::*; use std::sync::Arc; diff --git a/examples/aura/node/src/service.rs b/examples/aura/node/src/service.rs index c9705fd..70eb07a 100644 --- a/examples/aura/node/src/service.rs +++ b/examples/aura/node/src/service.rs @@ -1,5 +1,7 @@ //! Service and ServiceFactory implementation. Specialized wrapper over substrate service. +use polkadot_sdk::*; + use aura_runtime::{self, opaque::Block, RuntimeApi}; use futures::FutureExt; use sc_client_api::{Backend, BlockBackend}; diff --git a/examples/aura/runtime/Cargo.toml b/examples/aura/runtime/Cargo.toml index da811a0..f4b684c 100644 --- a/examples/aura/runtime/Cargo.toml +++ b/examples/aura/runtime/Cargo.toml @@ -16,98 +16,56 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { workspace = true, features = ["derive"] } scale-info = { workspace = true, features = ["derive"] } -pallet-aura = { workspace = true } -pallet-balances = { workspace = true } -frame-support = { workspace = true } -pallet-grandpa = { workspace = true } -pallet-sudo = { workspace = true } -frame-system = { workspace = true } -frame-try-runtime = {optional = true, workspace = true } -pallet-timestamp = { workspace = true } -pallet-transaction-payment = { workspace = true } -frame-executive = { workspace = true } -sp-api = { workspace = true } -sp-block-builder = { workspace = true } -sp-consensus-aura = { workspace = true } -sp-consensus-grandpa = { workspace = true } -sp-core = { workspace = true } -sp-inherents = { workspace = true } -sp-offchain = { workspace = true } -sp-runtime = { workspace = true } -sp-session = { workspace = true } -sp-std = { workspace = true } -sp-transaction-pool = { workspace = true } -sp-version = { workspace = true } -sp-genesis-builder = { workspace = true } - -# Used for the node template's RPCs -frame-system-rpc-runtime-api = { workspace = true } -pallet-transaction-payment-rpc-runtime-api = { workspace = true } - -# Used for runtime benchmarking -frame-benchmarking = { optional = true, workspace = true } -frame-system-benchmarking = { optional = true, workspace = true } - # Local Dependencies simnode-runtime-api = { path = "../../../runtime-api", default-features = false } +[dependencies.polkadot-sdk] +workspace = true +features = [ + "pallet-aura", + "pallet-balances", + "frame-support", + "pallet-grandpa", + "pallet-sudo", + "frame-system", + "pallet-timestamp", + "pallet-transaction-payment", + "frame-executive", + "sp-api", + "sp-block-builder", + "sp-consensus-aura", + "sp-consensus-grandpa", + "sp-core", + "sp-inherents", + "sp-offchain", + "sp-runtime", + "sp-session", + "sp-std", + "sp-transaction-pool", + "sp-version", + "sp-genesis-builder", + "frame-system-rpc-runtime-api", + "pallet-transaction-payment-rpc-runtime-api", +] + [build-dependencies] substrate-wasm-builder = { optional = true, workspace = true } [features] default = ["std"] std = [ - "frame-try-runtime?/std", - "frame-system-benchmarking?/std", - "frame-benchmarking?/std", - "codec/std", - "scale-info/std", - "frame-executive/std", - "frame-support/std", - "frame-system-rpc-runtime-api/std", - "frame-system/std", - "frame-try-runtime/std", - "pallet-aura/std", - "pallet-balances/std", - "pallet-grandpa/std", - "pallet-sudo/std", - "pallet-timestamp/std", - "pallet-transaction-payment-rpc-runtime-api/std", - "pallet-transaction-payment/std", - "sp-api/std", - "sp-block-builder/std", - "sp-consensus-aura/std", - "sp-consensus-grandpa/std", - "sp-core/std", - "sp-inherents/std", - "sp-offchain/std", - "sp-runtime/std", - "sp-session/std", - "sp-std/std", - "sp-transaction-pool/std", - "sp-version/std", + "polkadot-sdk/std", + "codec/std", + "scale-info/std", "simnode-runtime-api/std", "substrate-wasm-builder", ] runtime-benchmarks = [ - "frame-benchmarking/runtime-benchmarks", - "frame-support/runtime-benchmarks", - "frame-system-benchmarking/runtime-benchmarks", - "frame-system/runtime-benchmarks", - "pallet-balances/runtime-benchmarks", - "pallet-grandpa/runtime-benchmarks", - "pallet-timestamp/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", + "polkadot-sdk/frame-system-benchmarking", + "polkadot-sdk/frame-try-runtime", + "polkadot-sdk/frame-benchmarking", + "polkadot-sdk/runtime-benchmarks", ] try-runtime = [ - "frame-try-runtime/try-runtime", - "frame-executive/try-runtime", - "frame-system/try-runtime", - "frame-support/try-runtime", - "pallet-aura/try-runtime", - "pallet-balances/try-runtime", - "pallet-grandpa/try-runtime", - "pallet-sudo/try-runtime", - "pallet-timestamp/try-runtime", - "pallet-transaction-payment/try-runtime", + "polkadot-sdk/try-runtime", ] diff --git a/examples/aura/runtime/src/lib.rs b/examples/aura/runtime/src/lib.rs index 61f74ed..6f85ccb 100644 --- a/examples/aura/runtime/src/lib.rs +++ b/examples/aura/runtime/src/lib.rs @@ -1,3 +1,4 @@ +#![allow(non_local_definitions)] #![cfg_attr(not(feature = "std"), no_std)] // `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256. #![recursion_limit = "256"] @@ -6,6 +7,8 @@ #[cfg(feature = "std")] include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); +use polkadot_sdk::*; + use pallet_grandpa::AuthorityId as GrandpaId; use sp_api::impl_runtime_apis; use sp_consensus_aura::sr25519::AuthorityId as AuraId; @@ -312,13 +315,11 @@ pub type Executive = frame_executive::Executive< AllPalletsWithSystem, >; -#[cfg(feature = "runtime-benchmarks")] -#[macro_use] -extern crate frame_benchmarking; - #[cfg(feature = "runtime-benchmarks")] mod benches { - define_benchmarks!( + use polkadot_sdk::*; + + frame_benchmarking::define_benchmarks!( [frame_benchmarking, BaselineBench::] [frame_system, SystemBench::] [pallet_balances, Balances] @@ -566,7 +567,8 @@ impl_runtime_apis! { fn dispatch_benchmark( config: frame_benchmarking::BenchmarkConfig ) -> Result, sp_runtime::RuntimeString> { - use frame_benchmarking::{baseline, Benchmarking, BenchmarkBatch, TrackedStorageKey}; + use frame_benchmarking::{baseline, Benchmarking, BenchmarkBatch}; + use frame_support::traits::TrackedStorageKey; use frame_system_benchmarking::Pallet as SystemBench; use baseline::Pallet as BaselineBench; diff --git a/examples/babe/node/Cargo.toml b/examples/babe/node/Cargo.toml index bcc44c3..69b53ac 100644 --- a/examples/babe/node/Cargo.toml +++ b/examples/babe/node/Cargo.toml @@ -44,84 +44,87 @@ futures = "0.3.21" log = "0.4.17" rand = "0.8" -# primitives -sp-consensus-babe = { workspace = true } -sp-consensus-grandpa = { workspace = true } -sp-api = { workspace = true } -sp-core = { workspace = true } -sp-runtime = { workspace = true } -sp-timestamp = { workspace = true } -sp-inherents = { workspace = true } -sp-keyring = { workspace = true} -sp-keystore = { workspace = true } -sp-consensus = { workspace = true } -sp-transaction-pool = { workspace = true } -sp-transaction-storage-proof = { workspace = true, default-features = true } -sp-io = { workspace = true, default-features = true } - -# client dependencies -sc-client-api = { workspace = true } -sc-chain-spec = { workspace = true } -sc-consensus = { workspace = true } -sc-transaction-pool = { workspace = true } -sc-transaction-pool-api = { workspace = true } -sc-network = { workspace = true} -sc-network-common = { workspace = true } -sc-network-sync = { workspace = true} -sc-consensus-slots = { workspace = true } -sc-consensus-babe = { workspace = true } -sc-consensus-grandpa = { workspace = true } -sc-rpc = { workspace = true } -sc-basic-authorship = { workspace = true } -sc-service = { workspace = true } -sc-telemetry = { workspace = true } -sc-executor = { workspace = true } -sc-sync-state-rpc = { workspace = true } -sc-sysinfo = { workspace = true } -sc-storage-monitor = { workspace = true } -sc-offchain = { workspace = true } - -# frame dependencies -frame-system = { workspace = true } -frame-benchmarking = { workspace = true } -frame-system-rpc-runtime-api = { workspace = true } -pallet-transaction-payment = { workspace = true } - # node-specific dependencies babe-runtime = { path = "../runtime" } node-rpc = { package = "babe-node-rpc", path = "../rpc" } sc-simnode = { path = "../../../simnode", features = ["babe"] } # CLI-specific dependencies -sc-cli = { optional = true, workspace = true } -frame-benchmarking-cli = { optional = true, workspace = true } +sc-service = { workspace = true } try-runtime-cli = { optional = true, workspace = true } serde_json = "1.0" +[dependencies.polkadot-sdk] +workspace = true +default-features = true +features = [ + "sp-consensus-babe", + "sp-consensus-grandpa", + "sp-api", + "sp-core", + "sp-runtime", + "sp-timestamp", + "sp-inherents", + "sp-keystore", + "sp-consensus", + "sp-transaction-pool", + "sc-client-api", + "sc-chain-spec", + "sc-consensus", + "sc-transaction-pool", + "sc-transaction-pool-api", + "sc-network-common", + "sc-consensus-slots", + "sc-consensus-babe", + "sc-consensus-grandpa", + "sc-rpc", + "sc-cli", + "sc-basic-authorship", + "sc-telemetry", + "sc-executor", + "sc-sync-state-rpc", + "sc-sysinfo", + "sc-storage-monitor", + "sc-offchain", + "frame-system", + "frame-benchmarking", + "frame-system-rpc-runtime-api", + "pallet-transaction-payment", + "sp-keyring", + "sp-transaction-storage-proof", + "sp-io", + "sc-network", + "sc-network-sync", + "frame-benchmarking-cli", +] + [dev-dependencies] tempfile = "3.1.0" -#sp-tracing = { workspace = true } -sc-keystore = { workspace = true } -#sc-service-test = { workspace = true } -sc-consensus-epochs = { workspace = true } + +[dev-dependencies.polkadot-sdk] +workspace = true +default-features = true +features = [ + "sc-keystore", + "sc-consensus-epochs" +] [build-dependencies] -substrate-build-script-utils = { optional = true, workspace = true } +polkadot-sdk = { workspace = true, default-features = true, features = ["substrate-build-script-utils"] } [features] default = ["cli"] cli = [ - "sc-cli", - "frame-benchmarking-cli", + "polkadot-sdk/sc-cli", + "polkadot-sdk/frame-benchmarking-cli", "sc-service/rocksdb", "clap", - "substrate-build-script-utils", "try-runtime-cli", ] runtime-benchmarks = [ + "polkadot-sdk/runtime-benchmarks", "babe-runtime/runtime-benchmarks", - "frame-benchmarking-cli/runtime-benchmarks" ] -# Enable features that allow the runtime to be tried and debugged. Name might be subject to change -# in the near future. +# Enable features that allow the runtime to be tried and debugged. +# Name might be subject to change in the near future. try-runtime = ["babe-runtime/try-runtime", "try-runtime-cli/try-runtime"] diff --git a/examples/babe/node/build.rs b/examples/babe/node/build.rs index e3bfe31..8ee8f23 100644 --- a/examples/babe/node/build.rs +++ b/examples/babe/node/build.rs @@ -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(); diff --git a/examples/babe/node/src/benchmarking.rs b/examples/babe/node/src/benchmarking.rs index 92676d4..c766039 100644 --- a/examples/babe/node/src/benchmarking.rs +++ b/examples/babe/node/src/benchmarking.rs @@ -20,6 +20,8 @@ //! //! Should only be used for benchmarking as it may break in other contexts. +use polkadot_sdk::*; + use crate::service::{create_extrinsic, FullClient}; use babe_runtime::{AccountId, Balance, BalancesCall, SystemCall}; diff --git a/examples/babe/node/src/chain_spec.rs b/examples/babe/node/src/chain_spec.rs index 0e0c025..17f6053 100644 --- a/examples/babe/node/src/chain_spec.rs +++ b/examples/babe/node/src/chain_spec.rs @@ -18,6 +18,8 @@ //! Substrate chain configurations. +use polkadot_sdk::*; + use babe_runtime::{constants::currency::*, wasm_binary_unwrap, Block, SessionKeys, StakerStatus}; use sc_chain_spec::ChainSpecExtension; use sc_service::ChainType; diff --git a/examples/babe/node/src/cli.rs b/examples/babe/node/src/cli.rs index e2aa9a8..0523f90 100644 --- a/examples/babe/node/src/cli.rs +++ b/examples/babe/node/src/cli.rs @@ -16,6 +16,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . /// An overarching CLI command definition. +use polkadot_sdk::*; + #[derive(Debug, clap::Parser)] pub struct Cli { /// Possible subcommand with parameters. diff --git a/examples/babe/node/src/command.rs b/examples/babe/node/src/command.rs index 2025933..ad102c6 100644 --- a/examples/babe/node/src/command.rs +++ b/examples/babe/node/src/command.rs @@ -16,6 +16,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +use polkadot_sdk::*; + use super::benchmarking::{inherent_benchmark_data, RemarkBuilder, TransferKeepAliveBuilder}; use crate::{ chain_spec, service, diff --git a/examples/babe/node/src/lib.rs b/examples/babe/node/src/lib.rs index cc34871..a37130d 100644 --- a/examples/babe/node/src/lib.rs +++ b/examples/babe/node/src/lib.rs @@ -28,8 +28,6 @@ //! Despite its name the produced WASM can theoretically also be used from NodeJS, although this //! hasn't been tested. -#![warn(missing_docs)] - #[cfg(feature = "cli")] mod benchmarking; pub mod chain_spec; diff --git a/examples/babe/node/src/main.rs b/examples/babe/node/src/main.rs index 5fe7b7a..8087d62 100644 --- a/examples/babe/node/src/main.rs +++ b/examples/babe/node/src/main.rs @@ -18,7 +18,7 @@ //! Substrate Node CLI -#![warn(missing_docs)] +use polkadot_sdk::*; fn main() -> sc_cli::Result<()> { babe_node::run() diff --git a/examples/babe/node/src/service.rs b/examples/babe/node/src/service.rs index dd7669b..636b8bb 100644 --- a/examples/babe/node/src/service.rs +++ b/examples/babe/node/src/service.rs @@ -20,6 +20,8 @@ //! Service implementation. Specialized wrapper over substrate service. +use polkadot_sdk::*; + use crate::Cli; use babe_runtime::{opaque::Block, RuntimeApi}; use codec::Encode; diff --git a/examples/babe/rpc/Cargo.toml b/examples/babe/rpc/Cargo.toml index 32b9f4c..1b8af30 100644 --- a/examples/babe/rpc/Cargo.toml +++ b/examples/babe/rpc/Cargo.toml @@ -14,25 +14,31 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] jsonrpsee = { workspace = true, features = ["server"] } -pallet-transaction-payment-rpc = { workspace = true } -sc-chain-spec = { workspace = true } -sc-client-api = { workspace = true } -sc-consensus-babe = { workspace = true } -sc-consensus-grandpa = { workspace = true } -sc-rpc = { workspace = true } -sc-rpc-api = { workspace = true } -sc-rpc-spec-v2 = { workspace = true } -sc-transaction-pool-api = { workspace = true } -sp-api = { workspace = true } -sp-block-builder = { workspace = true } -sp-blockchain = { workspace = true } -sp-consensus = { workspace = true } -sp-consensus-babe = { workspace = true } -sp-keystore = { workspace = true } -sp-runtime = { workspace = true } -sp-core = { workspace = true } -substrate-frame-rpc-system = { workspace = true } -substrate-state-trie-migration-rpc = { workspace = true } -sc-consensus-babe-rpc = { workspace = true } -sc-consensus-grandpa-rpc = { workspace = true } -sc-sync-state-rpc = { workspace = true } + +[dependencies.polkadot-sdk] +workspace = true +default-features = true +features = [ + "pallet-transaction-payment-rpc", + "sc-chain-spec", + "sc-client-api", + "sc-consensus-babe", + "sc-consensus-grandpa", + "sc-rpc", + "sc-rpc-api", + "sc-rpc-spec-v2", + "sc-transaction-pool-api", + "sp-api", + "sp-block-builder", + "sp-blockchain", + "sp-consensus", + "sp-consensus-babe", + "sp-keystore", + "sp-runtime", + "sp-core", + "substrate-frame-rpc-system", + "substrate-state-trie-migration-rpc", + "sc-consensus-babe-rpc", + "sc-consensus-grandpa-rpc", + "sc-sync-state-rpc", +] diff --git a/examples/babe/rpc/src/lib.rs b/examples/babe/rpc/src/lib.rs index 5f147ec..f657079 100644 --- a/examples/babe/rpc/src/lib.rs +++ b/examples/babe/rpc/src/lib.rs @@ -31,6 +31,8 @@ #![warn(missing_docs)] #![warn(unused_crate_dependencies)] +use polkadot_sdk::*; + use std::sync::Arc; use jsonrpsee::RpcModule; diff --git a/examples/babe/runtime/Cargo.toml b/examples/babe/runtime/Cargo.toml index d8c9a73..66f761a 100644 --- a/examples/babe/runtime/Cargo.toml +++ b/examples/babe/runtime/Cargo.toml @@ -14,129 +14,75 @@ version = "0.1.0" targets = ["x86_64-unknown-linux-gnu"] [dependencies] - -# third-party dependencies codec = { workspace = true, features = ["derive", "max-encoded-len",] } scale-info = { workspace = true, features = ["derive"] } - static_assertions = "1.1.0" log = { version = "0.4.17", default-features = false } -# primitives -sp-consensus-babe = { workspace = true} -sp-consensus-grandpa = { workspace = true } -sp-block-builder = { workspace = true } -sp-inherents = { workspace = true } -sp-offchain = { workspace = true } -sp-core = { workspace = true} -sp-std = { workspace = true } -sp-api = { workspace = true } -sp-runtime = { workspace = true } -sp-staking = { workspace = true} -sp-session = { workspace = true } -sp-transaction-pool = { workspace = true } -sp-version = { workspace = true } -sp-io = { workspace = true } -sp-genesis-builder = { workspace = true } - -# frame dependencies -frame-executive = { workspace = true } -frame-election-provider-support = { workspace = true } -frame-benchmarking = { workspace = true } -frame-support = { workspace = true } -frame-system = { workspace = true } -frame-system-benchmarking = { workspace = true , optional = true } -frame-system-rpc-runtime-api = { workspace = true } -frame-try-runtime = { workspace = true, optional = true } - -pallet-authorship = { workspace = true } -pallet-babe = { workspace = true } -pallet-offences = { workspace = true } -pallet-balances = { workspace = true} -pallet-grandpa = { workspace = true } -pallet-session = { features = [ "historical" ], workspace = true } -pallet-session-benchmarking = { workspace = true, optional = true } -pallet-staking = { workspace = true } -pallet-sudo = { workspace = true } -pallet-timestamp = { workspace = true } -pallet-transaction-payment = { workspace = true } -pallet-transaction-payment-rpc-runtime-api = { workspace = true } -pallet-staking-reward-curve = { workspace = true } - simnode-runtime-api = { path = "../../../runtime-api", default-features = false } +[dependencies.polkadot-sdk] +workspace = true +features = [ + "sp-consensus-babe", + "sp-consensus-grandpa", + "sp-block-builder", + "sp-inherents", + "sp-offchain", + "sp-core", + "sp-std", + "sp-api", + "sp-runtime", + "sp-staking", + "sp-session", + "sp-transaction-pool", + "sp-version", + "sp-io", + "sp-genesis-builder", + "frame-executive", + "frame-election-provider-support", + "frame-benchmarking", + "frame-support", + "frame-system", + "frame-system-rpc-runtime-api", + "pallet-authorship", + "pallet-babe", + "pallet-offences", + "pallet-balances", + "pallet-grandpa", + "pallet-staking", + "pallet-sudo", + "pallet-session", + "pallet-timestamp", + "pallet-transaction-payment", + "pallet-transaction-payment-rpc-runtime-api", + "pallet-staking-reward-curve", +] + [build-dependencies] substrate-wasm-builder = { workspace = true, optional = true } [features] default = ["std"] -with-tracing = ["frame-executive/with-tracing"] +with-tracing = ["polkadot-sdk/with-tracing"] std = [ - "frame-system-benchmarking?/std", - "sp-consensus-babe/std", - "sp-consensus-grandpa/std", - "pallet-babe/std", - "pallet-balances/std", - "sp-block-builder/std", + "polkadot-sdk/std", "codec/std", "scale-info/std", - "frame-executive/std", - "pallet-grandpa/std", - "sp-inherents/std", - "sp-offchain/std", - "sp-core/std", - "sp-std/std", - "pallet-session/std", - "pallet-session-benchmarking?/std", - "sp-api/std", - "sp-runtime/std", - "sp-staking/std", - "pallet-staking/std", - "sp-session/std", - "pallet-sudo/std", - "pallet-authorship/std", - "frame-support/std", - "frame-benchmarking/std", - "frame-system-rpc-runtime-api/std", - "frame-election-provider-support/std", - "frame-system/std", - "pallet-timestamp/std", - "pallet-offences/std", - "pallet-transaction-payment-rpc-runtime-api/std", - "pallet-transaction-payment/std", - "sp-transaction-pool/std", - "sp-version/std", "log/std", - "frame-try-runtime?/std", - "sp-io/std", "simnode-runtime-api/std", "substrate-wasm-builder", ] runtime-benchmarks = [ - "frame-benchmarking/runtime-benchmarks", - "frame-support/runtime-benchmarks", - "frame-system/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", - "pallet-babe/runtime-benchmarks", - "pallet-balances/runtime-benchmarks", - "pallet-offences/runtime-benchmarks", - "pallet-grandpa/runtime-benchmarks", - "pallet-session-benchmarking/runtime-benchmarks", - "pallet-staking/runtime-benchmarks", - "frame-system-benchmarking/runtime-benchmarks", + "polkadot-sdk/runtime-benchmarks", + "polkadot-sdk/pallet-offences-benchmarking", + "polkadot-sdk/pallet-election-provider-support-benchmarking", + "polkadot-sdk/pallet-nomination-pools-benchmarking", + "polkadot-sdk/frame-system-benchmarking", + "polkadot-sdk/frame-try-runtime", + "polkadot-sdk/frame-benchmarking", + "polkadot-sdk/pallet-session-benchmarking", ] try-runtime = [ - "frame-try-runtime/try-runtime", - "frame-executive/try-runtime", - "frame-system/try-runtime", - "frame-support/try-runtime", - "pallet-authorship/try-runtime", - "pallet-offences/try-runtime", - "pallet-babe/try-runtime", - "pallet-grandpa/try-runtime", - "pallet-session/try-runtime", - "pallet-staking/try-runtime", - "pallet-sudo/try-runtime", - "pallet-timestamp/try-runtime", - "pallet-transaction-payment/try-runtime", + "polkadot-sdk/try-runtime", ] diff --git a/examples/babe/runtime/src/assets_api.rs b/examples/babe/runtime/src/assets_api.rs index cf1a663..e97454a 100644 --- a/examples/babe/runtime/src/assets_api.rs +++ b/examples/babe/runtime/src/assets_api.rs @@ -18,6 +18,8 @@ //! Runtime API definition for assets. +use polkadot_sdk::*; + use codec::Codec; use sp_std::vec::Vec; diff --git a/examples/babe/runtime/src/impls.rs b/examples/babe/runtime/src/impls.rs index 9da4a37..eb2942e 100644 --- a/examples/babe/runtime/src/impls.rs +++ b/examples/babe/runtime/src/impls.rs @@ -17,6 +17,8 @@ //! Some configurable implementations as associated type for the substrate runtime. +use polkadot_sdk::*; + use frame_support::traits::{Currency, OnUnbalanced}; use crate::{Authorship, Balances, NegativeImbalance}; @@ -32,6 +34,8 @@ impl OnUnbalanced for Author { #[cfg(test)] mod multiplier_tests { + use polkadot_sdk::*; + use frame_support::{ dispatch::DispatchClass, weights::{Weight, WeightToFee}, diff --git a/examples/babe/runtime/src/lib.rs b/examples/babe/runtime/src/lib.rs index f8e7855..4114b58 100644 --- a/examples/babe/runtime/src/lib.rs +++ b/examples/babe/runtime/src/lib.rs @@ -18,10 +18,13 @@ //! The Substrate runtime. This can be compiled with `#[no_std]`, ready for Wasm. +#![allow(non_local_definitions)] #![cfg_attr(not(feature = "std"), no_std)] // `construct_runtime!` does a lot of recursion and requires us to increase the limit to 512. #![recursion_limit = "512"] +use polkadot_sdk::*; + use codec::{Decode, Encode, MaxEncodedLen}; use frame_election_provider_support::{ bounds::{ElectionBounds, ElectionBoundsBuilder}, @@ -687,15 +690,13 @@ construct_runtime!( #[cfg(feature = "runtime-benchmarks")] mod benches { + use polkadot_sdk::*; + frame_benchmarking::define_benchmarks!( [frame_benchmarking, BaselineBench::] - [frame_benchmarking_pallet_pov, Pov] [pallet_babe, Babe] [pallet_balances, Balances] - [pallet_election_provider_multi_phase, ElectionProviderMultiPhase] - [pallet_election_provider_support_benchmarking, EPSBench::] [pallet_grandpa, Grandpa] - [pallet_im_online, ImOnline] [pallet_offences, OffencesBench::] [pallet_session, SessionBench::] [pallet_staking, Staking] @@ -1000,10 +1001,8 @@ impl_runtime_apis! { // which is why we need these two lines below. use pallet_session_benchmarking::Pallet as SessionBench; use pallet_offences_benchmarking::Pallet as OffencesBench; - use pallet_election_provider_support_benchmarking::Pallet as EPSBench; use frame_system_benchmarking::Pallet as SystemBench; use baseline::Pallet as BaselineBench; - use pallet_nomination_pools_benchmarking::Pallet as NominationPoolsBench; let mut list = Vec::::new(); list_benchmarks!(list, extra); @@ -1016,33 +1015,25 @@ impl_runtime_apis! { fn dispatch_benchmark( config: frame_benchmarking::BenchmarkConfig ) -> Result, sp_runtime::RuntimeString> { - use frame_benchmarking::{baseline, Benchmarking, BenchmarkBatch, TrackedStorageKey}; + use frame_benchmarking::{baseline, Benchmarking, BenchmarkBatch}; + use frame_support::traits::TrackedStorageKey; // Trying to add benchmarks directly to the Session Pallet caused cyclic dependency // issues. To get around that, we separated the Session benchmarks into its own crate, // which is why we need these two lines below. use pallet_session_benchmarking::Pallet as SessionBench; use pallet_offences_benchmarking::Pallet as OffencesBench; - use pallet_election_provider_support_benchmarking::Pallet as EPSBench; use frame_system_benchmarking::Pallet as SystemBench; use baseline::Pallet as BaselineBench; - use pallet_nomination_pools_benchmarking::Pallet as NominationPoolsBench; impl pallet_session_benchmarking::Config for Runtime {} impl pallet_offences_benchmarking::Config for Runtime {} impl pallet_election_provider_support_benchmarking::Config for Runtime {} impl frame_system_benchmarking::Config for Runtime {} impl baseline::Config for Runtime {} - impl pallet_nomination_pools_benchmarking::Config for Runtime {} use frame_support::traits::WhitelistedStorageKeys; - let mut whitelist: Vec = AllPalletsWithSystem::whitelisted_storage_keys(); - - // Treasury Account - // TODO: this is manual for now, someday we might be able to use a - // macro for this particular key - let treasury_key = frame_system::Account::::hashed_key_for(Treasury::account_id()); - whitelist.push(treasury_key.to_vec().into()); + let whitelist: Vec = AllPalletsWithSystem::whitelisted_storage_keys(); let mut batches = Vec::::new(); let params = (&config, &whitelist); diff --git a/examples/parachain/node/Cargo.toml b/examples/parachain/node/Cargo.toml index 1f82726..4dae756 100644 --- a/examples/parachain/node/Cargo.toml +++ b/examples/parachain/node/Cargo.toml @@ -18,71 +18,70 @@ serde = { version = "1.0.152", features = ["derive"] } jsonrpsee = { workspace = true, features = ["server"] } serde_json = "1.0" -# Local +sc-tracing = { workspace = true } parachain-runtime = { path = "../runtime" } sc-simnode = { path = "../../../simnode", features = ["parachain"] } +try-runtime-cli = { workspace = true, optional = true } -# Substrate -frame-system = { workspace = true } -pallet-transaction-payment = { 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-consensus = { workspace = true } -sc-executor = { workspace = true } -sc-network = { workspace = true } -sc-offchain = { 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 } -sp-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, default-features = true } -sp-runtime = { workspace = true } -sp-timestamp = { workspace = true } -substrate-frame-rpc-system = { workspace = true } -substrate-prometheus-endpoint = { workspace = true } -try-runtime-cli = { workspace = true, optional = true } - -# Polkadot -polkadot-cli = { workspace = true } -polkadot-primitives = { workspace = true } -staging-xcm = { workspace = true } - -# Cumulus -cumulus-client-cli = { 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-client-collator = { workspace = true } -cumulus-primitives-core = { workspace = true } -cumulus-primitives-parachain-inherent = { workspace = true } -cumulus-relay-chain-interface = { workspace = true } +[dependencies.polkadot-sdk] +workspace = true +default-features = true +features = [ + "frame-system", + "pallet-transaction-payment", + "frame-benchmarking", + "frame-benchmarking-cli", + "pallet-transaction-payment-rpc", + "sc-basic-authorship", + "sc-chain-spec", + "sc-cli", + "sc-client-api", + "sc-consensus", + "sc-executor", + "sc-network", + "sc-offchain", + "sc-network-sync", + "sc-rpc", + "sc-service", + "sc-sysinfo", + "sc-telemetry", + "sc-transaction-pool", + "sp-transaction-pool", + "sc-transaction-pool-api", + "sp-api", + "sp-block-builder", + "sp-blockchain", + "sp-consensus-aura", + "sp-core", + "sp-io", + "sp-keystore", + "sp-runtime", + "sp-timestamp", + "substrate-frame-rpc-system", + "substrate-prometheus-endpoint", + "polkadot-cli", + "polkadot-primitives", + "staging-xcm", + "cumulus-client-cli", + "cumulus-client-consensus-aura", + "cumulus-client-consensus-common", + "cumulus-client-consensus-proposer", + "cumulus-client-service", + "cumulus-client-collator", + "cumulus-primitives-core", + "cumulus-primitives-parachain-inherent", + "cumulus-relay-chain-interface", +] [build-dependencies] -substrate-build-script-utils = { workspace = true } +polkadot-sdk = { workspace = true, default-features = true, features = ["substrate-build-script-utils"] } [features] default = [] runtime-benchmarks = [ "try-runtime-cli/try-runtime", "parachain-runtime/runtime-benchmarks", - "polkadot-cli/runtime-benchmarks", + "polkadot-sdk/runtime-benchmarks", ] try-runtime = [ "try-runtime-cli/try-runtime", diff --git a/examples/parachain/node/build.rs b/examples/parachain/node/build.rs index e3bfe31..8ee8f23 100644 --- a/examples/parachain/node/build.rs +++ b/examples/parachain/node/build.rs @@ -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(); diff --git a/examples/parachain/node/src/chain_spec.rs b/examples/parachain/node/src/chain_spec.rs index b224271..414d1a1 100644 --- a/examples/parachain/node/src/chain_spec.rs +++ b/examples/parachain/node/src/chain_spec.rs @@ -1,3 +1,5 @@ +use polkadot_sdk::*; + use cumulus_primitives_core::ParaId; use parachain_runtime::{wasm_binary_unwrap, AccountId, AuraId, Signature, EXISTENTIAL_DEPOSIT}; use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup}; diff --git a/examples/parachain/node/src/cli.rs b/examples/parachain/node/src/cli.rs index 7d7fda7..6d3d7f2 100644 --- a/examples/parachain/node/src/cli.rs +++ b/examples/parachain/node/src/cli.rs @@ -1,3 +1,5 @@ +use polkadot_sdk::*; + use std::path::PathBuf; /// Sub-commands supported by the collator. diff --git a/examples/parachain/node/src/command.rs b/examples/parachain/node/src/command.rs index beb8fc1..2c5d126 100644 --- a/examples/parachain/node/src/command.rs +++ b/examples/parachain/node/src/command.rs @@ -1,3 +1,5 @@ +use polkadot_sdk::*; + use cumulus_primitives_core::ParaId; use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE}; use log::info; diff --git a/examples/parachain/node/src/main.rs b/examples/parachain/node/src/main.rs index ba9f28b..952f223 100644 --- a/examples/parachain/node/src/main.rs +++ b/examples/parachain/node/src/main.rs @@ -2,6 +2,8 @@ #![warn(missing_docs)] +use polkadot_sdk::*; + mod chain_spec; #[macro_use] mod service; diff --git a/examples/parachain/node/src/rpc.rs b/examples/parachain/node/src/rpc.rs index c51754f..754ee85 100644 --- a/examples/parachain/node/src/rpc.rs +++ b/examples/parachain/node/src/rpc.rs @@ -5,6 +5,8 @@ #![warn(missing_docs)] +use polkadot_sdk::*; + use std::sync::Arc; use parachain_runtime::{opaque::Block, AccountId, Balance, Nonce}; diff --git a/examples/parachain/node/src/service.rs b/examples/parachain/node/src/service.rs index 5b64251..d931701 100644 --- a/examples/parachain/node/src/service.rs +++ b/examples/parachain/node/src/service.rs @@ -1,5 +1,7 @@ //! Service and ServiceFactory implementation. Specialized wrapper over substrate service. +use polkadot_sdk::*; + // std use std::{sync::Arc, time::Duration}; diff --git a/examples/parachain/runtime/Cargo.toml b/examples/parachain/runtime/Cargo.toml index c2949b9..9df8a07 100644 --- a/examples/parachain/runtime/Cargo.toml +++ b/examples/parachain/runtime/Cargo.toml @@ -20,62 +20,59 @@ scale-info = { workspace = true, features = ["derive"] } hex-literal = { version = "0.3.4", optional = true } log = { version = "0.4.17", default-features = false } smallvec = "1.10.0" +cumulus-pallet-parachain-system = { workspace = true } # Local simnode-runtime-api = { path = "../../../runtime-api", default-features = false } -# Substrate -frame-benchmarking = { workspace = true, optional = true } -frame-executive = { workspace = true } -frame-support = { workspace = true } -frame-system = { workspace = true } -frame-system-benchmarking = { workspace = true, optional = true } -frame-system-rpc-runtime-api = { workspace = true } -frame-try-runtime = { workspace = true, optional = true } -pallet-aura = { workspace = true } -pallet-authorship = { workspace = true } -pallet-balances = { workspace = true } -pallet-session = { workspace = true } -pallet-sudo = { workspace = true } -pallet-timestamp = { workspace = true } -pallet-message-queue = { workspace = true } -pallet-transaction-payment = { workspace = true } -pallet-transaction-payment-rpc-runtime-api = { workspace = true } -sp-api = { workspace = true } -sp-block-builder = { workspace = true } -sp-consensus-aura = { workspace = true } -sp-core = { workspace = true } -sp-inherents = { workspace = true } -sp-offchain = { workspace = true } -sp-runtime = { workspace = true } -sp-session = { workspace = true } -sp-std = { workspace = true } -sp-transaction-pool = { workspace = true } -sp-version = { workspace = true } -sp-genesis-builder = { workspace = true } - -# Polkadot -pallet-xcm = { workspace = true } -polkadot-parachain-primitives = { workspace = true } -parachains-common = { workspace = true } -polkadot-runtime-common = { workspace = true } -staging-xcm = { workspace = true } -staging-xcm-builder = { workspace = true } -staging-xcm-executor = { workspace = true } - -# Cumulus -cumulus-pallet-aura-ext = { workspace = true } -cumulus-pallet-dmp-queue = { workspace = true } -cumulus-pallet-parachain-system = { workspace = true } -cumulus-pallet-session-benchmarking = { workspace = true } -cumulus-pallet-xcm = { workspace = true } -cumulus-pallet-xcmp-queue = { workspace = true } -cumulus-primitives-core = { workspace = true } -cumulus-primitives-aura = { workspace = true } -cumulus-primitives-timestamp = { workspace = true } -cumulus-primitives-utility = { workspace = true } -pallet-collator-selection = { workspace = true } -parachain-info = { workspace = true } +[dependencies.polkadot-sdk] +workspace = true +features = [ + "frame-executive", + "frame-support", + "frame-system", + "frame-system-rpc-runtime-api", + "pallet-aura", + "pallet-authorship", + "pallet-balances", + "pallet-session", + "pallet-sudo", + "pallet-timestamp", + "pallet-message-queue", + "pallet-transaction-payment", + "pallet-transaction-payment-rpc-runtime-api", + "sp-api", + "sp-block-builder", + "sp-consensus-aura", + "sp-core", + "sp-inherents", + "sp-offchain", + "sp-runtime", + "sp-session", + "sp-std", + "sp-transaction-pool", + "sp-version", + "sp-genesis-builder", + "pallet-xcm", + "polkadot-parachain-primitives", + "parachains-common", + "polkadot-runtime-common", + "staging-xcm", + "staging-xcm-builder", + "staging-xcm-executor", + "cumulus-pallet-aura-ext", + "cumulus-pallet-dmp-queue", + "cumulus-pallet-parachain-system", + "cumulus-pallet-session-benchmarking", + "cumulus-pallet-xcm", + "cumulus-pallet-xcmp-queue", + "cumulus-primitives-core", + "cumulus-primitives-aura", + "cumulus-primitives-timestamp", + "cumulus-primitives-utility", + "pallet-collator-selection", + "staging-parachain-info", +] [features] default = [ @@ -85,85 +82,18 @@ std = [ "codec/std", "log/std", "scale-info/std", - "cumulus-pallet-aura-ext/std", - "cumulus-pallet-dmp-queue/std", "cumulus-pallet-parachain-system/std", - "cumulus-pallet-xcm/std", - "cumulus-pallet-xcmp-queue/std", - "cumulus-primitives-core/std", - "cumulus-primitives-aura/std", - "cumulus-primitives-timestamp/std", - "cumulus-primitives-utility/std", - "cumulus-pallet-session-benchmarking/std", - "frame-executive/std", - "frame-support/std", - "frame-system-rpc-runtime-api/std", - "frame-system/std", - "pallet-aura/std", - "pallet-authorship/std", - "pallet-balances/std", - "pallet-collator-selection/std", - "pallet-session/std", - "pallet-sudo/std", - "pallet-timestamp/std", - "pallet-transaction-payment-rpc-runtime-api/std", - "pallet-transaction-payment/std", - "pallet-xcm/std", - "parachain-info/std", - "polkadot-runtime-common/std", - "sp-api/std", - "sp-block-builder/std", - "sp-consensus-aura/std", - "sp-core/std", - "sp-inherents/std", - "sp-offchain/std", - "sp-runtime/std", - "sp-session/std", - "sp-std/std", - "sp-transaction-pool/std", - "sp-version/std", - "staging-xcm-builder/std", - "staging-xcm-executor/std", - "staging-xcm/std", - "parachains-common/std", - "pallet-message-queue/std", + "polkadot-sdk/std", "simnode-runtime-api/std", "substrate-wasm-builder", ] - runtime-benchmarks = [ - "hex-literal", - "frame-benchmarking/runtime-benchmarks", - "frame-support/runtime-benchmarks", - "frame-system-benchmarking/runtime-benchmarks", - "frame-system/runtime-benchmarks", - "pallet-balances/runtime-benchmarks", - "pallet-collator-selection/runtime-benchmarks", - "pallet-timestamp/runtime-benchmarks", - "pallet-xcm/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", - "staging-xcm-builder/runtime-benchmarks", - "cumulus-pallet-session-benchmarking/runtime-benchmarks", - "cumulus-pallet-xcmp-queue/runtime-benchmarks", + "hex-literal", + "polkadot-sdk/frame-system-benchmarking", + "polkadot-sdk/frame-try-runtime", + "polkadot-sdk/frame-benchmarking", + "polkadot-sdk/runtime-benchmarks", ] - try-runtime = [ - "cumulus-pallet-aura-ext/try-runtime", - "cumulus-pallet-dmp-queue/try-runtime", - "cumulus-pallet-parachain-system/try-runtime", - "cumulus-pallet-xcm/try-runtime", - "cumulus-pallet-xcmp-queue/try-runtime", - "frame-executive/try-runtime", - "frame-system/try-runtime", - "frame-try-runtime/try-runtime", - "pallet-aura/try-runtime", - "pallet-authorship/try-runtime", - "pallet-balances/try-runtime", - "pallet-collator-selection/try-runtime", - "pallet-session/try-runtime", - "pallet-sudo/try-runtime", - "pallet-timestamp/try-runtime", - "pallet-transaction-payment/try-runtime", - "pallet-xcm/try-runtime", - "parachain-info/try-runtime", + "polkadot-sdk/try-runtime", ] diff --git a/examples/parachain/runtime/src/lib.rs b/examples/parachain/runtime/src/lib.rs index d163919..4b6be12 100644 --- a/examples/parachain/runtime/src/lib.rs +++ b/examples/parachain/runtime/src/lib.rs @@ -1,6 +1,8 @@ +#![allow(non_local_definitions)] #![cfg_attr(not(feature = "std"), no_std)] // `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256. #![recursion_limit = "256"] +use polkadot_sdk::*; // Make the WASM binary available. #[cfg(feature = "std")] @@ -284,7 +286,7 @@ parameter_types! { /// The default types are being injected by [`derive_impl`](`frame_support::derive_impl`) from /// [`ParaChainDefaultConfig`](`struct@frame_system::config_preludes::ParaChainDefaultConfig`), /// but overridden as needed. -#[derive_impl(frame_system::config_preludes::ParaChainDefaultConfig as frame_system::DefaultConfig)] +#[derive_impl(frame_system::config_preludes::ParaChainDefaultConfig)] impl frame_system::Config for Runtime { /// The identifier used to distinguish between accounts. type AccountId = AccountId; @@ -378,7 +380,7 @@ impl cumulus_pallet_parachain_system::Config for Runtime { type WeightInfo = (); type RuntimeEvent = RuntimeEvent; type OnSystemEvent = (); - type SelfParaId = parachain_info::Pallet; + type SelfParaId = staging_parachain_info::Pallet; type OutboundXcmpMessageSource = XcmpQueue; type DmpQueue = frame_support::traits::EnqueueWithOrigin; type ReservedDmpWeight = ReservedDmpWeight; @@ -395,7 +397,7 @@ type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook< UNINCLUDED_SEGMENT_CAPACITY, >; -impl parachain_info::Config for Runtime {} +impl staging_parachain_info::Config for Runtime {} parameter_types! { pub MessageQueueServiceWeight: Weight = Perbill::from_percent(35) * RuntimeBlockWeights::get().max_block; @@ -504,7 +506,7 @@ construct_runtime!( System: frame_system = 0, ParachainSystem: cumulus_pallet_parachain_system = 1, Timestamp: pallet_timestamp = 2, - ParachainInfo: parachain_info = 3, + ParachainInfo: staging_parachain_info = 3, // Monetary stuff. Balances: pallet_balances = 10, @@ -530,6 +532,7 @@ construct_runtime!( #[cfg(feature = "runtime-benchmarks")] mod benches { + use polkadot_sdk::*; frame_benchmarking::define_benchmarks!( [frame_system, SystemBench::] [pallet_balances, Balances] diff --git a/examples/parachain/runtime/src/weights/block_weights.rs b/examples/parachain/runtime/src/weights/block_weights.rs index b2092d8..2eb63c7 100644 --- a/examples/parachain/runtime/src/weights/block_weights.rs +++ b/examples/parachain/runtime/src/weights/block_weights.rs @@ -16,6 +16,8 @@ // limitations under the License. pub mod constants { + use polkadot_sdk::*; + use frame_support::{ parameter_types, weights::{constants, Weight}, @@ -29,6 +31,8 @@ pub mod constants { #[cfg(test)] mod test_weights { + use polkadot_sdk::*; + use frame_support::weights::constants; /// Checks that the weight exists and is sane. diff --git a/examples/parachain/runtime/src/weights/extrinsic_weights.rs b/examples/parachain/runtime/src/weights/extrinsic_weights.rs index 332c3b3..59a8845 100644 --- a/examples/parachain/runtime/src/weights/extrinsic_weights.rs +++ b/examples/parachain/runtime/src/weights/extrinsic_weights.rs @@ -16,6 +16,8 @@ // limitations under the License. pub mod constants { + use polkadot_sdk::*; + use frame_support::{ parameter_types, weights::{constants, Weight}, @@ -29,6 +31,8 @@ pub mod constants { #[cfg(test)] mod test_weights { + use polkadot_sdk::*; + use frame_support::weights::constants; /// Checks that the weight exists and is sane. diff --git a/examples/parachain/runtime/src/weights/paritydb_weights.rs b/examples/parachain/runtime/src/weights/paritydb_weights.rs index 4338d92..b649b3a 100644 --- a/examples/parachain/runtime/src/weights/paritydb_weights.rs +++ b/examples/parachain/runtime/src/weights/paritydb_weights.rs @@ -16,6 +16,8 @@ // limitations under the License. pub mod constants { + use polkadot_sdk::*; + use frame_support::{ parameter_types, weights::{constants, RuntimeDbWeight}, @@ -32,6 +34,8 @@ pub mod constants { #[cfg(test)] mod test_db_weights { + use polkadot_sdk::*; + use super::constants::ParityDbWeight as W; use frame_support::weights::constants; diff --git a/examples/parachain/runtime/src/weights/rocksdb_weights.rs b/examples/parachain/runtime/src/weights/rocksdb_weights.rs index 1d115d9..6b19fde 100644 --- a/examples/parachain/runtime/src/weights/rocksdb_weights.rs +++ b/examples/parachain/runtime/src/weights/rocksdb_weights.rs @@ -16,6 +16,8 @@ // limitations under the License. pub mod constants { + use polkadot_sdk::*; + use frame_support::{ parameter_types, weights::{constants, RuntimeDbWeight}, @@ -32,6 +34,8 @@ pub mod constants { #[cfg(test)] mod test_db_weights { + use polkadot_sdk::*; + use super::constants::RocksDbWeight as W; use frame_support::weights::constants; diff --git a/examples/parachain/runtime/src/xcm_config.rs b/examples/parachain/runtime/src/xcm_config.rs index 0413303..d45c9d6 100644 --- a/examples/parachain/runtime/src/xcm_config.rs +++ b/examples/parachain/runtime/src/xcm_config.rs @@ -13,6 +13,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +use polkadot_sdk::*; + use core::marker::PhantomData; use super::{ @@ -230,11 +232,6 @@ pub type XcmRouter = ( XcmpQueue, ); -#[cfg(feature = "runtime-benchmarks")] -parameter_types! { - pub ReachableDest: Option = Some(Parent.into()); -} - impl pallet_xcm::Config for Runtime { type RuntimeEvent = RuntimeEvent; type Currency = Balances; diff --git a/runtime-api/Cargo.toml b/runtime-api/Cargo.toml index 642c20f..e4d2ce0 100644 --- a/runtime-api/Cargo.toml +++ b/runtime-api/Cargo.toml @@ -13,16 +13,11 @@ readme = "../README.md" [dependencies] codec = { workspace = true } - -# primitive deps -sp-api = { workspace = true } -sp-std = { workspace = true } - +polkadot-sdk = { workspace = true, features = ["sp-api", "sp-std"] } [features] default = ["std"] std = [ "codec/std", - "sp-api/std", - "sp-std/std", + "polkadot-sdk/std", ] diff --git a/runtime-api/src/lib.rs b/runtime-api/src/lib.rs index 9c62e6f..5ebe73a 100644 --- a/runtime-api/src/lib.rs +++ b/runtime-api/src/lib.rs @@ -20,6 +20,8 @@ //! Exports a substrate runtime API that allows simnode create extrinsics that are always valid for //! the runtime +use polkadot_sdk::*; + use codec::Codec; use sp_std::vec::Vec; diff --git a/simnode/Cargo.toml b/simnode/Cargo.toml index fd0c5a2..48f4c82 100644 --- a/simnode/Cargo.toml +++ b/simnode/Cargo.toml @@ -12,81 +12,74 @@ keywords = ["substrate", "polkadot-sdk", "integration-testing", "e2e-tests"] readme = "../README.md" [dependencies] -# client deps -sc-executor = { workspace = true } +# not using polkadot-sdk because i need this feature sc-service = { workspace = true, features = ["test-helpers"] } -sc-telemetry = { workspace = true } -sc-informant = { workspace = true } -sc-network = { workspace = true } -sc-cli = { workspace = true } -sc-basic-authorship = { workspace = true } -sc-rpc = { workspace = true } -sc-offchain = { workspace = true } -sc-tracing = { workspace = true } -sc-transaction-pool = { workspace = true } -sc-client-db = { workspace = true } -sc-transaction-pool-api = { workspace = true } -sc-client-api = { workspace = true } -sc-rpc-server = { workspace = true } - -# consensus -sc-consensus-babe = { workspace = true } -manual-seal = { workspace = true } -sc-consensus = { workspace = true } -sc-consensus-slots = { workspace = true } -sc-consensus-aura = { workspace = true, default-features = true } - -# primitive deps -sp-consensus-aura = { workspace = true, default-features = true } -sp-consensus-slots = { workspace = true, default-features = true } -sp-consensus-babe = { workspace = true, default-features = true } -sp-core = { workspace = true, default-features = true } -sp-blockchain = { workspace = true, default-features = true } -sp-block-builder = { workspace = true, default-features = true } -sp-api = { workspace = true, default-features = true } -sp-io = { workspace = true, default-features = true } -sp-transaction-pool = { workspace = true, default-features = true } -sp-consensus = { workspace = true, default-features = true } -sp-runtime = { workspace = true, default-features = true } -sp-session = { workspace = true, default-features = true } -sp-offchain = { workspace = true, default-features = true } -sp-inherents = { workspace = true, default-features = true } -sp-keyring = { workspace = true, default-features = true } -sp-externalities = { workspace = true, default-features = true } -sp-state-machine = { workspace = true, default-features = true } -sp-trie = { workspace = true, default-features = true } -sp-timestamp = { workspace = true, default-features = true } -sp-wasm-interface = { workspace = true, default-features = true } sp-runtime-interface = { workspace = true, default-features = true } -# pallets -frame-system = { workspace = true, default-features = true } - -# parachain stuff -cumulus-client-cli = { workspace = true } -cumulus-client-collator = { workspace = true } -cumulus-client-service = { workspace = true } -parachain-inherent = { workspace = true } -sproof-builder = { workspace = true } -parachain-info = { workspace = true } - -# polkadot -polkadot-primitives = { workspace = true } - -# others codec = { workspace = true } +num-traits = "0.2.14" +async-trait = "0.1.57" log = "0.4.8" rand = "0.8.5" futures = "0.3.16" tokio = { version = "1.13", features = ["signal"] } clap = { version = "4.0.9", features = ["derive"] } -# Calling RPC jsonrpsee = { workspace = true, features = ["server", "client-core", "macros"] } -num-traits = "0.2.14" -async-trait = "0.1.57" -# local deps + simnode-runtime-api = { version = "1.9.0", path = "../runtime-api" } +[dependencies.polkadot-sdk] +workspace = true +default-features = true +features = [ + "sc-executor", + "sc-telemetry", + "sc-informant", + "sc-network", + "sc-cli", + "sc-basic-authorship", + "sc-rpc", + "sc-offchain", + "sc-tracing", + "sc-transaction-pool", + "sc-client-db", + "sc-transaction-pool-api", + "sc-client-api", + "sc-rpc-server", + "sc-consensus-babe", + "sc-consensus-manual-seal", + "sc-consensus", + "sc-consensus-slots", + "cumulus-client-cli", + "cumulus-client-collator", + "cumulus-client-service", + "cumulus-primitives-parachain-inherent", + "cumulus-test-relay-sproof-builder", + "staging-parachain-info", + "sc-consensus-aura", + "sp-consensus-aura", + "sp-consensus-slots", + "sp-consensus-babe", + "sp-core", + "sp-blockchain", + "sp-block-builder", + "sp-api", + "sp-io", + "sp-transaction-pool", + "sp-consensus", + "sp-runtime", + "sp-session", + "sp-offchain", + "sp-inherents", + "sp-keyring", + "sp-externalities", + "sp-state-machine", + "sp-trie", + "sp-timestamp", + "sp-wasm-interface", + "frame-system", + "polkadot-primitives", +] [features] default = ["std"] diff --git a/simnode/src/cli.rs b/simnode/src/cli.rs index c73884e..b0aca9b 100644 --- a/simnode/src/cli.rs +++ b/simnode/src/cli.rs @@ -16,6 +16,8 @@ //! Simnode Cli Utilities +use polkadot_sdk::*; + /// The `simnode` sub-command. /// /// See [`Command`] for more info. diff --git a/simnode/src/client.rs b/simnode/src/client.rs index 70d06b8..c16132f 100644 --- a/simnode/src/client.rs +++ b/simnode/src/client.rs @@ -16,6 +16,8 @@ //! Utilities for creating the neccessary client subsystems. +use polkadot_sdk::*; + #[cfg(feature = "aura")] pub mod aura; diff --git a/simnode/src/client/aura.rs b/simnode/src/client/aura.rs index 57b859a..94819d5 100644 --- a/simnode/src/client/aura.rs +++ b/simnode/src/client/aura.rs @@ -16,16 +16,18 @@ //! Simnode for Standalone runtimes with Aura Consensus +use polkadot_sdk::*; + use super::*; use crate::{timestamp::SlotTimestampProvider, ChainInfo, SimnodeApiServer, SimnodeRpcHandler}; use futures::{channel::mpsc, future::Either, FutureExt, StreamExt}; -use manual_seal::{ - rpc::{ManualSeal, ManualSealApiServer}, - run_manual_seal, EngineCommand, ManualSealParams, -}; use num_traits::AsPrimitive; use sc_client_api::Backend; use sc_consensus::{BlockImport, ImportQueue}; +use sc_consensus_manual_seal::{ + rpc::{ManualSeal, ManualSealApiServer}, + run_manual_seal, EngineCommand, ManualSealParams, +}; use sc_network::NetworkBackend; use sc_service::{ build_network, spawn_tasks, BuildNetworkParams, PartialComponents, SpawnTasksParams, @@ -79,7 +81,7 @@ where ::RuntimeCall: Send + Sync, ::AccountId: Send + Sync + From, { - use manual_seal::consensus::aura::AuraConsensusDataProvider; + use sc_consensus_manual_seal::consensus::aura::AuraConsensusDataProvider; let SimnodeParams { components, config, instant, rpc_builder } = params; let PartialComponents { diff --git a/simnode/src/client/babe.rs b/simnode/src/client/babe.rs index 70bfcdb..ad8f17b 100644 --- a/simnode/src/client/babe.rs +++ b/simnode/src/client/babe.rs @@ -16,16 +16,18 @@ //! Simnode for Standalone runtimes with Babe Consensus +use polkadot_sdk::*; + use futures::{channel::mpsc, future::Either, FutureExt, StreamExt}; -use manual_seal::{ - consensus::babe::BabeConsensusDataProvider, - rpc::{ManualSeal, ManualSealApiServer}, - run_manual_seal, EngineCommand, ManualSealParams, -}; use num_traits::AsPrimitive; use sc_client_api::Backend; use sc_consensus::{BlockImport, ImportQueue}; use sc_consensus_babe::BabeLink; +use sc_consensus_manual_seal::{ + consensus::babe::BabeConsensusDataProvider, + rpc::{ManualSeal, ManualSealApiServer}, + run_manual_seal, EngineCommand, ManualSealParams, +}; use sc_network::NetworkBackend; use sc_service::{ build_network, spawn_tasks, BuildNetworkParams, PartialComponents, SpawnTasksParams, diff --git a/simnode/src/client/parachain.rs b/simnode/src/client/parachain.rs index 648cef5..f4722fc 100644 --- a/simnode/src/client/parachain.rs +++ b/simnode/src/client/parachain.rs @@ -16,6 +16,8 @@ //! Simnode for Standalone runtimes with Parachain Consensus +use polkadot_sdk::*; + use super::*; use crate::{ timestamp::SlotTimestampProvider, ChainInfo, ParachainSproofInherentProvider, SimnodeApiServer, @@ -24,12 +26,12 @@ use crate::{ use async_trait::async_trait; use futures::{channel::mpsc, future::Either, lock::Mutex, FutureExt, StreamExt}; use jsonrpsee::{core::RpcResult, types::ErrorObjectOwned}; -use manual_seal::{ +use num_traits::AsPrimitive; +use sc_client_api::Backend; +use sc_consensus_manual_seal::{ rpc::{ManualSeal, ManualSealApiServer}, run_manual_seal, EngineCommand, ManualSealParams, }; -use num_traits::AsPrimitive; -use sc_client_api::Backend; use sc_consensus::{BlockImport, ImportQueue}; use sc_network::NetworkBackend; @@ -55,7 +57,9 @@ pub struct ParachainRPCHandler { /// Holds the inner rpc handler for delegating requests inner: SimnodeRpcHandler, /// Sink for sending commands to the manual seal authorship task. - sink: futures::channel::mpsc::Sender::Hash>>, + sink: futures::channel::mpsc::Sender< + sc_consensus_manual_seal::EngineCommand<::Hash>, + >, /// parachain inherent provider for sproofing the parachain inherent. parachain: crate::sproof::SharedParachainSproofInherentProvider, } @@ -72,7 +76,7 @@ where >, ::AccountId: From, <::Header as Header>::Number: num_traits::cast::AsPrimitive, - T::Runtime: parachain_info::Config, + T::Runtime: staging_parachain_info::Config, { fn author_extrinsic(&self, call: Bytes, account: String) -> RpcResult { Ok(self.inner.author_extrinsic(call, account)?.into()) @@ -93,8 +97,8 @@ where // insert the upgrade signal into the sproof provider, it'll be included in the next block. let para_id = self .inner - .with_state(None, || parachain_info::Pallet::::parachain_id()); - let builder = sproof_builder::RelayStateSproofBuilder { + .with_state(None, || staging_parachain_info::Pallet::::parachain_id()); + let builder = cumulus_test_relay_sproof_builder::RelayStateSproofBuilder { para_id, upgrade_go_ahead: Some(signal), ..Default::default() @@ -104,7 +108,7 @@ where let mut sink = self.sink.clone(); let (sender, receiver) = oneshot::channel(); // NOTE: this sends a Result over the channel. - let command = manual_seal::EngineCommand::SealNewBlock { + let command = sc_consensus_manual_seal::EngineCommand::SealNewBlock { create_empty: true, finalize: true, parent_hash: None, @@ -197,11 +201,11 @@ where <::Header as Header>::Number: AsPrimitive, ::Hash: Unpin, ::Header: Unpin, - C::Runtime: parachain_info::Config, + C::Runtime: staging_parachain_info::Config, ::RuntimeCall: Send + Sync, ::AccountId: Send + Sync + From, { - use manual_seal::consensus::aura::AuraConsensusDataProvider; + use sc_consensus_manual_seal::consensus::aura::AuraConsensusDataProvider; let SimnodeParams { components, config, instant, rpc_builder } = params; let PartialComponents { diff --git a/simnode/src/client/timestamp.rs b/simnode/src/client/timestamp.rs index dc167e3..7f89d3e 100644 --- a/simnode/src/client/timestamp.rs +++ b/simnode/src/client/timestamp.rs @@ -19,8 +19,10 @@ //! Mocked timestamp inherent, allows for manual seal to create blocks for runtimes //! that expect this inherent. -use manual_seal::Error; +use polkadot_sdk::*; + use sc_client_api::{AuxStore, UsageProvider}; +use sc_consensus_manual_seal::Error; use sp_api::ProvideRuntimeApi; use sp_blockchain::HeaderBackend; use sp_consensus_aura::{ diff --git a/simnode/src/lib.rs b/simnode/src/lib.rs index bdd1e04..9132663 100644 --- a/simnode/src/lib.rs +++ b/simnode/src/lib.rs @@ -16,6 +16,9 @@ #![deny(missing_docs, unused_extern_crates)] //! ### sc-simnode + +use polkadot_sdk::*; + use sc_client_api::ExecutorProvider; use sp_api::ConstructRuntimeApi; use sp_blockchain::HeaderBackend; diff --git a/simnode/src/overrides.rs b/simnode/src/overrides.rs index 05e2323..84dd4d1 100644 --- a/simnode/src/overrides.rs +++ b/simnode/src/overrides.rs @@ -16,6 +16,8 @@ //! Host function overrides for signature verification. +use polkadot_sdk::*; + use sp_core::{ecdsa, ed25519, sr25519}; use sp_runtime_interface::runtime_interface; diff --git a/simnode/src/rpc.rs b/simnode/src/rpc.rs index fcdb0cc..ad99927 100644 --- a/simnode/src/rpc.rs +++ b/simnode/src/rpc.rs @@ -16,6 +16,8 @@ //! Simnode RPC Subsystem +use polkadot_sdk::*; + use crate::{ client::{FullClientFor, UncheckedExtrinsicFor}, with_state, ChainInfo, diff --git a/simnode/src/sproof.rs b/simnode/src/sproof.rs index 72ab6a3..80aef8e 100644 --- a/simnode/src/sproof.rs +++ b/simnode/src/sproof.rs @@ -17,17 +17,19 @@ //! Parachain inherent data provider, useful for signalling relay chain authorizations to //! parachain simnodes. +use polkadot_sdk::*; + use crate::{client::FullClientFor, with_state, ChainInfo}; use codec::Encode; +use cumulus_primitives_parachain_inherent::ParachainInherentData; use futures::lock::Mutex; use num_traits::AsPrimitive; -use parachain_inherent::ParachainInherentData; use polkadot_primitives::PersistedValidationData; +use cumulus_test_relay_sproof_builder::RelayStateSproofBuilder; use sp_blockchain::HeaderBackend; use sp_runtime::traits::{Block, Header}; use sp_wasm_interface::{anyhow, anyhow::anyhow}; -use sproof_builder::RelayStateSproofBuilder; use std::{marker::PhantomData, sync::Arc}; /// Provides the inherent for parachain runtimes. Can also be manipulated to send relay chain @@ -49,7 +51,7 @@ pub type SharedParachainSproofInherentProvider = Arc ParachainSproofInherentProvider where T: ChainInfo, - T::Runtime: parachain_info::Config, + T::Runtime: staging_parachain_info::Config, <::Header as Header>::Number: AsPrimitive, { /// Construct a new sproof-er @@ -76,7 +78,7 @@ where ) -> Result { let mut sproof = self.sproof_builder.take().unwrap_or_default(); sproof.para_id = with_state::(self.client.clone(), None, || { - parachain_info::Pallet::::parachain_id() + staging_parachain_info::Pallet::::parachain_id() }); sproof.current_slot = if self.slot_duration == 12_000 { // relay chain is twice as fast the parachain diff --git a/tests/Cargo.toml b/tests/Cargo.toml index b6d03d6..d63a97e 100644 --- a/tests/Cargo.toml +++ b/tests/Cargo.toml @@ -12,4 +12,4 @@ tokio = { version = "1.27.0", features = ["macros"] } codec = { workspace = true, default-features = true, features = ["derive"] } sp-core = { workspace = true, default-features = true, features = ["full_crypto"] } -sp-keyring = { default-features = true, workspace = true } +polkadot-sdk = { workspace = true, default-features = true, features = ["sp-keyring"] } diff --git a/tests/src/aura.rs b/tests/src/aura.rs index ef559ab..cc6d8c5 100644 --- a/tests/src/aura.rs +++ b/tests/src/aura.rs @@ -1,5 +1,7 @@ #![cfg(test)] +use polkadot_sdk::*; + use crate::codegen::aura::{ api, api::{ diff --git a/tests/src/babe.rs b/tests/src/babe.rs index 881fd71..2bae575 100644 --- a/tests/src/babe.rs +++ b/tests/src/babe.rs @@ -1,5 +1,7 @@ #![cfg(test)] +use polkadot_sdk::*; + use crate::codegen::babe::{ api, api::{ diff --git a/tests/src/parachain.rs b/tests/src/parachain.rs index b768035..e49ed36 100644 --- a/tests/src/parachain.rs +++ b/tests/src/parachain.rs @@ -1,4 +1,5 @@ #![cfg(test)] +use polkadot_sdk::*; use crate::codegen::parachain::{ api,