From bfad4ce58bcf6169e213b19c6052082942f7d2ab Mon Sep 17 00:00:00 2001 From: Francisco Gamundi Date: Tue, 17 Oct 2023 18:46:16 +0200 Subject: [PATCH 1/5] Fix deps --- Cargo.lock | 12 +-- Cargo.toml | 15 +-- .../templates/frontier/node/src/command.rs | 2 + .../templates/frontier/runtime/Cargo.toml | 92 ++++++++++++++--- .../templates/simple/node/src/command.rs | 2 + .../templates/simple/runtime/Cargo.toml | 99 ++++++++++++++++--- node/src/command.rs | 3 + 7 files changed, 191 insertions(+), 34 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c935c8424..c172f37ea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6772,7 +6772,7 @@ dependencies = [ [[package]] name = "nimbus-consensus" version = "0.9.0" -source = "git+https://github.com/moondance-labs/moonkit?branch=tanssi-polkadot-v1.1.0#41c18807d249bef5cfa542521149175c18b30437" +source = "git+https://github.com/fgamundi/moonkit?branch=fg-tanssi#7a1ff639750a6b2dd0b948bf7a888b0498e4eafa" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -6802,7 +6802,7 @@ dependencies = [ [[package]] name = "nimbus-primitives" version = "0.9.0" -source = "git+https://github.com/moondance-labs/moonkit?branch=tanssi-polkadot-v1.1.0#41c18807d249bef5cfa542521149175c18b30437" +source = "git+https://github.com/fgamundi/moonkit?branch=fg-tanssi#7a1ff639750a6b2dd0b948bf7a888b0498e4eafa" dependencies = [ "async-trait", "frame-support", @@ -7177,7 +7177,7 @@ dependencies = [ [[package]] name = "pallet-author-inherent" version = "0.9.0" -source = "git+https://github.com/moondance-labs/moonkit?branch=tanssi-polkadot-v1.1.0#41c18807d249bef5cfa542521149175c18b30437" +source = "git+https://github.com/fgamundi/moonkit?branch=fg-tanssi#7a1ff639750a6b2dd0b948bf7a888b0498e4eafa" dependencies = [ "frame-benchmarking", "frame-support", @@ -7918,7 +7918,7 @@ dependencies = [ [[package]] name = "pallet-maintenance-mode" version = "0.1.0" -source = "git+https://github.com/moondance-labs/moonkit?branch=tanssi-polkadot-v1.1.0#41c18807d249bef5cfa542521149175c18b30437" +source = "git+https://github.com/fgamundi/moonkit?branch=fg-tanssi#7a1ff639750a6b2dd0b948bf7a888b0498e4eafa" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -7970,7 +7970,7 @@ dependencies = [ [[package]] name = "pallet-migrations" version = "0.1.0" -source = "git+https://github.com/moondance-labs/moonkit?branch=tanssi-polkadot-v1.1.0#41c18807d249bef5cfa542521149175c18b30437" +source = "git+https://github.com/fgamundi/moonkit?branch=fg-tanssi#7a1ff639750a6b2dd0b948bf7a888b0498e4eafa" dependencies = [ "frame-support", "frame-system", @@ -16778,7 +16778,7 @@ dependencies = [ [[package]] name = "xcm-primitives" version = "0.1.0" -source = "git+https://github.com/moondance-labs/moonkit?branch=tanssi-polkadot-v1.1.0#41c18807d249bef5cfa542521149175c18b30437" +source = "git+https://github.com/fgamundi/moonkit?branch=fg-tanssi#7a1ff639750a6b2dd0b948bf7a888b0498e4eafa" dependencies = [ "sp-runtime", ] diff --git a/Cargo.toml b/Cargo.toml index a8082e567..f582b95c4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -55,12 +55,12 @@ tp-core = { path = "primitives/core", default-features = false } tp-traits = { path = "primitives/traits", default-features = false } # Moonkit (wasm) -nimbus-consensus = { git = "https://github.com/moondance-labs/moonkit", branch = "tanssi-polkadot-v1.1.0" } -nimbus-primitives = { git = "https://github.com/moondance-labs/moonkit", branch = "tanssi-polkadot-v1.1.0", default-features = false } -pallet-author-inherent = { git = "https://github.com/moondance-labs/moonkit", branch = "tanssi-polkadot-v1.1.0", default-features = false } -pallet-maintenance-mode = { git = "https://github.com/moondance-labs/moonkit", branch = "tanssi-polkadot-v1.1.0", default-features = false } -pallet-migrations = { git = "https://github.com/moondance-labs/moonkit", branch = "tanssi-polkadot-v1.1.0", default-features = false } -xcm-primitives = { git = "https://github.com/moondance-labs/moonkit", branch = "tanssi-polkadot-v1.1.0", default-features = false } +nimbus-consensus = { git = "https://github.com/fgamundi/moonkit", branch = "fg-tanssi" } +nimbus-primitives = { git = "https://github.com/fgamundi/moonkit", branch = "fg-tanssi", default-features = false } +pallet-author-inherent = { git = "https://github.com/fgamundi/moonkit", branch = "fg-tanssi", default-features = false } +pallet-maintenance-mode = { git = "https://github.com/fgamundi/moonkit", branch = "fg-tanssi", default-features = false } +pallet-migrations = { git = "https://github.com/fgamundi/moonkit", branch = "fg-tanssi", default-features = false } +xcm-primitives = { git = "https://github.com/fgamundi/moonkit", branch = "fg-tanssi", default-features = false } # Substrate (wasm) sp-consensus-beefy = { git = "https://github.com/moondance-labs/polkadot-sdk", branch = "tanssi-polkadot-v1.1.0", default-features = false } @@ -261,3 +261,6 @@ jsonrpsee-http-client = { git = "https://github.com/moondance-labs/jsonrpsee", b jsonrpsee-proc-macros = { git = "https://github.com/moondance-labs/jsonrpsee", branch = "tanssi-polkadot-v1.1.0" } jsonrpsee-server = { git = "https://github.com/moondance-labs/jsonrpsee", branch = "tanssi-polkadot-v1.1.0" } jsonrpsee-ws-client = { git = "https://github.com/moondance-labs/jsonrpsee", branch = "tanssi-polkadot-v1.1.0" } + +# [patch."https://github.com/fgamundi/moonkit"] +# pallet-maintenance-mode = { path = "../moonkit/pallets/maintenance-mode" } diff --git a/container-chains/templates/frontier/node/src/command.rs b/container-chains/templates/frontier/node/src/command.rs index 5b3510987..3fef78d05 100644 --- a/container-chains/templates/frontier/node/src/command.rs +++ b/container-chains/templates/frontier/node/src/command.rs @@ -40,6 +40,8 @@ use { std::net::SocketAddr, }; +#[cfg(feature = "try-runtime")] +use crate::client::TemplateRuntimeExecutor; #[cfg(feature = "try-runtime")] use try_runtime_cli::block_building_info::substrate_info; #[cfg(feature = "try-runtime")] diff --git a/container-chains/templates/frontier/runtime/Cargo.toml b/container-chains/templates/frontier/runtime/Cargo.toml index 05d1b6503..d87cb0325 100644 --- a/container-chains/templates/frontier/runtime/Cargo.toml +++ b/container-chains/templates/frontier/runtime/Cargo.toml @@ -7,14 +7,14 @@ license = "GPL-3.0-only" version = "0.1.0" [package.metadata.docs.rs] -targets = [ "x86_64-unknown-linux-gnu" ] +targets = ["x86_64-unknown-linux-gnu"] [dependencies] hex-literal = { workspace = true, optional = true } log = { workspace = true } -parity-scale-codec = { workspace = true, features = [ "derive" ] } -scale-info = { workspace = true, features = [ "derive" ] } -serde = { workspace = true, optional = true, features = [ "derive" ] } +parity-scale-codec = { workspace = true, features = ["derive"] } +scale-info = { workspace = true, features = ["derive"] } +serde = { workspace = true, optional = true, features = ["derive"] } smallvec = { workspace = true } # Local @@ -25,7 +25,7 @@ tp-consensus = { workspace = true } # Moonkit nimbus-primitives = { workspace = true } pallet-author-inherent = { workspace = true } -pallet-maintenance-mode = { workspace = true, features = [ "xcm-support" ] } +pallet-maintenance-mode = { workspace = true, features = ["xcm-support"] } pallet-migrations = { workspace = true } xcm-primitives = { workspace = true } @@ -35,7 +35,7 @@ frame-support = { workspace = true } frame-system = { workspace = true } frame-system-rpc-runtime-api = { workspace = true } frame-try-runtime = { workspace = true, optional = true } -pallet-balances = { workspace = true, features = [ "insecure_zero_ed" ] } +pallet-balances = { workspace = true, features = ["insecure_zero_ed"] } pallet-root-testing = { workspace = true } pallet-sudo = { workspace = true } pallet-timestamp = { workspace = true } @@ -95,15 +95,84 @@ pallet-hotfix-sufficients = { workspace = true } substrate-wasm-builder = { workspace = true } [features] -default = [ - "std", +default = ["std"] +std = [ + "ccp-xcm/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-timestamp/std", + "cumulus-primitives-utility/std", + "fp-account/std", + "fp-evm/std", + "fp-rpc/std", + "fp-self-contained/std", + "frame-executive/std", + "frame-support/std", + "frame-system-rpc-runtime-api/std", + "frame-system/std", + "frame-try-runtime/std", + "log/std", + "pallet-balances/std", + "pallet-base-fee/std", + "pallet-cc-authorities-noting/std", + "pallet-dynamic-fee/std", + "pallet-ethereum/std", + "pallet-ethereum/std", + "pallet-evm-chain-id/std", + "pallet-evm-precompile-modexp/std", + "pallet-evm-precompile-sha3fips/std", + "pallet-evm-precompile-simple/std", + "pallet-evm/std", + "pallet-hotfix-sufficients/std", + "pallet-maintenance-mode/std", + "pallet-migrations/std", + "pallet-proxy/std", + "pallet-sudo/std", + "pallet-timestamp/std", + "pallet-transaction-payment-rpc-runtime-api/std", + "pallet-utility/std", + "pallet-xcm/std", + "parachain-info/std", + "parity-scale-codec/std", + "polkadot-parachain-primitives/std", + "polkadot-runtime-common/std", + "scale-info/std", + "serde", + "sp-api/std", + "sp-block-builder/std", + "sp-consensus-aura/std", + "sp-core/std", + "sp-inherents/std", + "sp-offchain/std", + "sp-runtime/std", + "sp-std/std", + "sp-transaction-pool/std", + "sp-version/std", + "tp-consensus/std", + "staging-xcm-builder/std", + "staging-xcm-executor/std", + "staging-xcm/std", + "xcm-primitives/std", ] -std = [ "ccp-xcm/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-timestamp/std", "cumulus-primitives-utility/std", "fp-account/std", "fp-evm/std", "fp-rpc/std", "fp-self-contained/std", "frame-executive/std", "frame-support/std", "frame-system-rpc-runtime-api/std", "frame-system/std", "frame-try-runtime/std", "log/std", "pallet-balances/std", "pallet-base-fee/std", "pallet-cc-authorities-noting/std", "pallet-dynamic-fee/std", "pallet-ethereum/std", "pallet-ethereum/std", "pallet-evm-chain-id/std", "pallet-evm-precompile-modexp/std", "pallet-evm-precompile-sha3fips/std", "pallet-evm-precompile-simple/std", "pallet-evm/std", "pallet-hotfix-sufficients/std", "pallet-maintenance-mode/std", "pallet-migrations/std", "pallet-proxy/std", "pallet-sudo/std", "pallet-timestamp/std", "pallet-transaction-payment-rpc-runtime-api/std", "pallet-utility/std", "pallet-xcm/std", "parachain-info/std", "parity-scale-codec/std", "polkadot-parachain-primitives/std", "polkadot-runtime-common/std", "scale-info/std", "serde", "sp-api/std", "sp-block-builder/std", "sp-consensus-aura/std", "sp-core/std", "sp-inherents/std", "sp-offchain/std", "sp-runtime/std", "sp-std/std", "sp-transaction-pool/std", "sp-version/std", "tp-consensus/std", "staging-xcm-builder/std", "staging-xcm-executor/std", "staging-xcm/std", "xcm-primitives/std" ] # Allow to print logs details (no wasm:stripped) -force-debug = [ "sp-debug-derive/force-debug" ] +force-debug = ["sp-debug-derive/force-debug"] -runtime-benchmarks = [ "cumulus-pallet-session-benchmarking/runtime-benchmarks", "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", "hex-literal", "pallet-balances/runtime-benchmarks", "pallet-ethereum/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks", "pallet-xcm/runtime-benchmarks", "sp-runtime/runtime-benchmarks", "staging-xcm-builder/runtime-benchmarks" ] +runtime-benchmarks = [ + "cumulus-pallet-session-benchmarking/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "hex-literal", + "pallet-balances/runtime-benchmarks", + "pallet-ethereum/runtime-benchmarks", + "pallet-timestamp/runtime-benchmarks", + "pallet-xcm/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", + "staging-xcm-builder/runtime-benchmarks", +] try-runtime = [ "cumulus-pallet-parachain-system/try-runtime", @@ -121,6 +190,7 @@ try-runtime = [ "pallet-evm-chain-id/try-runtime", "pallet-evm/try-runtime", "pallet-hotfix-sufficients/try-runtime", + "pallet-maintenance-mode/try-runtime", "pallet-sudo/try-runtime", "pallet-timestamp/try-runtime", "pallet-transaction-payment/try-runtime", diff --git a/container-chains/templates/simple/node/src/command.rs b/container-chains/templates/simple/node/src/command.rs index fe472b01a..cadebbe82 100644 --- a/container-chains/templates/simple/node/src/command.rs +++ b/container-chains/templates/simple/node/src/command.rs @@ -39,6 +39,8 @@ use { #[cfg(feature = "try-runtime")] use try_runtime_cli::block_building_info::substrate_info; #[cfg(feature = "try-runtime")] +use crate::service::ParachainNativeExecutor; +#[cfg(feature = "try-runtime")] const SLOT_DURATION: u64 = 12; fn load_spec(id: &str, para_id: ParaId) -> std::result::Result, String> { diff --git a/container-chains/templates/simple/runtime/Cargo.toml b/container-chains/templates/simple/runtime/Cargo.toml index 52dd681a0..91dcd0d69 100644 --- a/container-chains/templates/simple/runtime/Cargo.toml +++ b/container-chains/templates/simple/runtime/Cargo.toml @@ -7,14 +7,14 @@ license = "GPL-3.0-only" version = "0.1.0" [package.metadata.docs.rs] -targets = [ "x86_64-unknown-linux-gnu" ] +targets = ["x86_64-unknown-linux-gnu"] [dependencies] hex-literal = { workspace = true, optional = true } log = { workspace = true } -parity-scale-codec = { workspace = true, features = [ "derive" ] } -scale-info = { workspace = true, features = [ "derive" ] } -serde = { workspace = true, optional = true, features = [ "derive" ] } +parity-scale-codec = { workspace = true, features = ["derive"] } +scale-info = { workspace = true, features = ["derive"] } +serde = { workspace = true, optional = true, features = ["derive"] } smallvec = { workspace = true } # Local @@ -24,7 +24,7 @@ tp-consensus = { workspace = true } # Moonkit nimbus-primitives = { workspace = true } pallet-author-inherent = { workspace = true } -pallet-maintenance-mode = { workspace = true, features = [ "xcm-support" ] } +pallet-maintenance-mode = { workspace = true, features = ["xcm-support"] } pallet-migrations = { workspace = true } xcm-primitives = { workspace = true } @@ -83,14 +83,91 @@ frame-try-runtime = { workspace = true, optional = true } substrate-wasm-builder = { workspace = true } [features] -default = [ - "std", +default = ["std"] +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-timestamp/std", + "cumulus-primitives-utility/std", + "frame-executive/std", + "frame-support/std", + "frame-system-rpc-runtime-api/std", + "frame-system/std", + "frame-try-runtime/std", + "log/std", + "nimbus-primitives/std", + "pallet-author-inherent/std", + "pallet-balances/std", + "pallet-cc-authorities-noting/std", + "pallet-maintenance-mode/std", + "pallet-migrations/std", + "pallet-proxy/std", + "pallet-session/std", + "pallet-sudo/std", + "pallet-timestamp/std", + "pallet-transaction-payment-rpc-runtime-api/std", + "pallet-utility/std", + "pallet-xcm/std", + "parachain-info/std", + "parity-scale-codec/std", + "polkadot-parachain-primitives/std", + "polkadot-runtime-common/std", + "scale-info/std", + "serde", + "sp-api/std", + "sp-block-builder/std", + "sp-consensus-aura/std", + "sp-core/std", + "sp-inherents/std", + "sp-offchain/std", + "sp-runtime/std", + "sp-std/std", + "sp-transaction-pool/std", + "sp-version/std", + "tp-consensus/std", + "staging-xcm-builder/std", + "staging-xcm-executor/std", + "staging-xcm/std", + "xcm-primitives/std", ] -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-timestamp/std", "cumulus-primitives-utility/std", "frame-executive/std", "frame-support/std", "frame-system-rpc-runtime-api/std", "frame-system/std", "frame-try-runtime/std", "log/std", "nimbus-primitives/std", "pallet-author-inherent/std", "pallet-balances/std", "pallet-cc-authorities-noting/std", "pallet-maintenance-mode/std", "pallet-migrations/std", "pallet-proxy/std", "pallet-session/std", "pallet-sudo/std", "pallet-timestamp/std", "pallet-transaction-payment-rpc-runtime-api/std", "pallet-utility/std", "pallet-xcm/std", "parachain-info/std", "parity-scale-codec/std", "polkadot-parachain-primitives/std", "polkadot-runtime-common/std", "scale-info/std", "serde", "sp-api/std", "sp-block-builder/std", "sp-consensus-aura/std", "sp-core/std", "sp-inherents/std", "sp-offchain/std", "sp-runtime/std", "sp-std/std", "sp-transaction-pool/std", "sp-version/std", "tp-consensus/std", "staging-xcm-builder/std", "staging-xcm-executor/std", "staging-xcm/std", "xcm-primitives/std" ] # Allow to print logs details (no wasm:stripped) -force-debug = [ "sp-debug-derive/force-debug" ] +force-debug = ["sp-debug-derive/force-debug"] -runtime-benchmarks = [ "cumulus-pallet-session-benchmarking/runtime-benchmarks", "frame-benchmarking", "frame-support/runtime-benchmarks", "frame-system-benchmarking/runtime-benchmarks", "frame-system/runtime-benchmarks", "hex-literal", "pallet-balances/runtime-benchmarks", "pallet-cc-authorities-noting/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks", "pallet-xcm/runtime-benchmarks", "sp-runtime/runtime-benchmarks", "staging-xcm-builder/runtime-benchmarks" ] +runtime-benchmarks = [ + "cumulus-pallet-session-benchmarking/runtime-benchmarks", + "frame-benchmarking", + "frame-support/runtime-benchmarks", + "frame-system-benchmarking/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "hex-literal", + "pallet-balances/runtime-benchmarks", + "pallet-cc-authorities-noting/runtime-benchmarks", + "pallet-timestamp/runtime-benchmarks", + "pallet-xcm/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", + "staging-xcm-builder/runtime-benchmarks", +] -try-runtime = [ "cumulus-pallet-parachain-system/try-runtime", "frame-executive/try-runtime", "frame-support/try-runtime", "frame-system/try-runtime", "frame-try-runtime", "nimbus-primitives/try-runtime", "pallet-balances/try-runtime", "pallet-cc-authorities-noting/try-runtime", "pallet-session/try-runtime", "pallet-sudo/try-runtime", "pallet-timestamp/try-runtime", "pallet-utility/try-runtime", "pallet-proxy/try-runtime", "parachain-info/try-runtime", "polkadot-runtime-common/try-runtime", "sp-runtime/try-runtime" ] +try-runtime = [ + "cumulus-pallet-parachain-system/try-runtime", + "frame-executive/try-runtime", + "frame-support/try-runtime", + "frame-system/try-runtime", + "frame-try-runtime", + "nimbus-primitives/try-runtime", + "pallet-balances/try-runtime", + "pallet-cc-authorities-noting/try-runtime", + "pallet-maintenance-mode/try-runtime", + "pallet-session/try-runtime", + "pallet-sudo/try-runtime", + "pallet-timestamp/try-runtime", + "pallet-utility/try-runtime", + "pallet-proxy/try-runtime", + "parachain-info/try-runtime", + "polkadot-runtime-common/try-runtime", + "sp-runtime/try-runtime", +] diff --git a/node/src/command.rs b/node/src/command.rs index 04da3ac74..14abd72e3 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -36,6 +36,9 @@ use { std::{io::Write, net::SocketAddr}, }; +#[cfg(feature = "try-runtime")] +use crate::service::ParachainNativeExecutor; + fn load_spec(id: &str, para_id: ParaId) -> std::result::Result, String> { Ok(match id { "dev" => Box::new(chain_spec::development_config( From 59b97806df8155848c79e4c0666daf6e1ba86e2a Mon Sep 17 00:00:00 2001 From: Francisco Gamundi Date: Wed, 18 Oct 2023 13:45:32 +0200 Subject: [PATCH 2/5] Update moonkit dep --- Cargo.lock | 12 ++++++------ Cargo.toml | 15 ++++++--------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c172f37ea..4f9cb2eff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6772,7 +6772,7 @@ dependencies = [ [[package]] name = "nimbus-consensus" version = "0.9.0" -source = "git+https://github.com/fgamundi/moonkit?branch=fg-tanssi#7a1ff639750a6b2dd0b948bf7a888b0498e4eafa" +source = "git+https://github.com/moondance-labs/moonkit?branch=tanssi-polkadot-v1.1.0#cb1c4fd10debd2d09d11292ff3ff7a4c053f622d" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -6802,7 +6802,7 @@ dependencies = [ [[package]] name = "nimbus-primitives" version = "0.9.0" -source = "git+https://github.com/fgamundi/moonkit?branch=fg-tanssi#7a1ff639750a6b2dd0b948bf7a888b0498e4eafa" +source = "git+https://github.com/moondance-labs/moonkit?branch=tanssi-polkadot-v1.1.0#cb1c4fd10debd2d09d11292ff3ff7a4c053f622d" dependencies = [ "async-trait", "frame-support", @@ -7177,7 +7177,7 @@ dependencies = [ [[package]] name = "pallet-author-inherent" version = "0.9.0" -source = "git+https://github.com/fgamundi/moonkit?branch=fg-tanssi#7a1ff639750a6b2dd0b948bf7a888b0498e4eafa" +source = "git+https://github.com/moondance-labs/moonkit?branch=tanssi-polkadot-v1.1.0#cb1c4fd10debd2d09d11292ff3ff7a4c053f622d" dependencies = [ "frame-benchmarking", "frame-support", @@ -7918,7 +7918,7 @@ dependencies = [ [[package]] name = "pallet-maintenance-mode" version = "0.1.0" -source = "git+https://github.com/fgamundi/moonkit?branch=fg-tanssi#7a1ff639750a6b2dd0b948bf7a888b0498e4eafa" +source = "git+https://github.com/moondance-labs/moonkit?branch=tanssi-polkadot-v1.1.0#cb1c4fd10debd2d09d11292ff3ff7a4c053f622d" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -7970,7 +7970,7 @@ dependencies = [ [[package]] name = "pallet-migrations" version = "0.1.0" -source = "git+https://github.com/fgamundi/moonkit?branch=fg-tanssi#7a1ff639750a6b2dd0b948bf7a888b0498e4eafa" +source = "git+https://github.com/moondance-labs/moonkit?branch=tanssi-polkadot-v1.1.0#cb1c4fd10debd2d09d11292ff3ff7a4c053f622d" dependencies = [ "frame-support", "frame-system", @@ -16778,7 +16778,7 @@ dependencies = [ [[package]] name = "xcm-primitives" version = "0.1.0" -source = "git+https://github.com/fgamundi/moonkit?branch=fg-tanssi#7a1ff639750a6b2dd0b948bf7a888b0498e4eafa" +source = "git+https://github.com/moondance-labs/moonkit?branch=tanssi-polkadot-v1.1.0#cb1c4fd10debd2d09d11292ff3ff7a4c053f622d" dependencies = [ "sp-runtime", ] diff --git a/Cargo.toml b/Cargo.toml index f582b95c4..a8082e567 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -55,12 +55,12 @@ tp-core = { path = "primitives/core", default-features = false } tp-traits = { path = "primitives/traits", default-features = false } # Moonkit (wasm) -nimbus-consensus = { git = "https://github.com/fgamundi/moonkit", branch = "fg-tanssi" } -nimbus-primitives = { git = "https://github.com/fgamundi/moonkit", branch = "fg-tanssi", default-features = false } -pallet-author-inherent = { git = "https://github.com/fgamundi/moonkit", branch = "fg-tanssi", default-features = false } -pallet-maintenance-mode = { git = "https://github.com/fgamundi/moonkit", branch = "fg-tanssi", default-features = false } -pallet-migrations = { git = "https://github.com/fgamundi/moonkit", branch = "fg-tanssi", default-features = false } -xcm-primitives = { git = "https://github.com/fgamundi/moonkit", branch = "fg-tanssi", default-features = false } +nimbus-consensus = { git = "https://github.com/moondance-labs/moonkit", branch = "tanssi-polkadot-v1.1.0" } +nimbus-primitives = { git = "https://github.com/moondance-labs/moonkit", branch = "tanssi-polkadot-v1.1.0", default-features = false } +pallet-author-inherent = { git = "https://github.com/moondance-labs/moonkit", branch = "tanssi-polkadot-v1.1.0", default-features = false } +pallet-maintenance-mode = { git = "https://github.com/moondance-labs/moonkit", branch = "tanssi-polkadot-v1.1.0", default-features = false } +pallet-migrations = { git = "https://github.com/moondance-labs/moonkit", branch = "tanssi-polkadot-v1.1.0", default-features = false } +xcm-primitives = { git = "https://github.com/moondance-labs/moonkit", branch = "tanssi-polkadot-v1.1.0", default-features = false } # Substrate (wasm) sp-consensus-beefy = { git = "https://github.com/moondance-labs/polkadot-sdk", branch = "tanssi-polkadot-v1.1.0", default-features = false } @@ -261,6 +261,3 @@ jsonrpsee-http-client = { git = "https://github.com/moondance-labs/jsonrpsee", b jsonrpsee-proc-macros = { git = "https://github.com/moondance-labs/jsonrpsee", branch = "tanssi-polkadot-v1.1.0" } jsonrpsee-server = { git = "https://github.com/moondance-labs/jsonrpsee", branch = "tanssi-polkadot-v1.1.0" } jsonrpsee-ws-client = { git = "https://github.com/moondance-labs/jsonrpsee", branch = "tanssi-polkadot-v1.1.0" } - -# [patch."https://github.com/fgamundi/moonkit"] -# pallet-maintenance-mode = { path = "../moonkit/pallets/maintenance-mode" } From 2fe4e727a93ae428d4d9528b9eeb4ed6660270ad Mon Sep 17 00:00:00 2001 From: Francisco Gamundi Date: Wed, 18 Oct 2023 13:45:42 +0200 Subject: [PATCH 3/5] Missing migrations --- .../templates/simple/node/src/command.rs | 4 +- runtime/dancebox/src/lib.rs | 8 +++ runtime/dancebox/src/migrations.rs | 50 ++++++++++++++++--- 3 files changed, 54 insertions(+), 8 deletions(-) diff --git a/container-chains/templates/simple/node/src/command.rs b/container-chains/templates/simple/node/src/command.rs index cadebbe82..2fce9c243 100644 --- a/container-chains/templates/simple/node/src/command.rs +++ b/container-chains/templates/simple/node/src/command.rs @@ -36,11 +36,11 @@ use { std::net::SocketAddr, }; -#[cfg(feature = "try-runtime")] -use try_runtime_cli::block_building_info::substrate_info; #[cfg(feature = "try-runtime")] use crate::service::ParachainNativeExecutor; #[cfg(feature = "try-runtime")] +use try_runtime_cli::block_building_info::substrate_info; +#[cfg(feature = "try-runtime")] const SLOT_DURATION: u64 = 12; fn load_spec(id: &str, para_id: ParaId) -> std::result::Result, String> { diff --git a/runtime/dancebox/src/lib.rs b/runtime/dancebox/src/lib.rs index 8c329610a..ab8bd77bf 100644 --- a/runtime/dancebox/src/lib.rs +++ b/runtime/dancebox/src/lib.rs @@ -33,6 +33,9 @@ pub use sp_runtime::BuildStorage; pub mod migrations; pub mod weights; +#[cfg(feature = "try-runtime")] +use sp_runtime::TryRuntimeError; + use { cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases, cumulus_primitives_core::{ @@ -848,6 +851,11 @@ impl OnRuntimeUpgrade for MaintenanceHooks { fn post_upgrade(state: Vec) -> Result<(), sp_runtime::DispatchError> { AllPalletsWithSystem::post_upgrade(state) } + + #[cfg(feature = "try-runtime")] + fn try_on_runtime_upgrade(checks: bool) -> Result { + AllPalletsWithSystem::try_on_runtime_upgrade(checks) + } } impl OnFinalize for MaintenanceHooks { diff --git a/runtime/dancebox/src/migrations.rs b/runtime/dancebox/src/migrations.rs index bd6bb4a36..8b6dcae41 100644 --- a/runtime/dancebox/src/migrations.rs +++ b/runtime/dancebox/src/migrations.rs @@ -20,7 +20,8 @@ //! the "Migration" trait declared in the pallet-migrations crate. use frame_support::{ - migration::storage_key_iter, storage::types::StorageValue, weights::Weight, Blake2_128Concat, + migration::storage_key_iter, storage::types::StorageValue, traits::OnRuntimeUpgrade, + weights::Weight, Blake2_128Concat, }; use { @@ -209,19 +210,56 @@ where } } +pub struct PolkadotXcmMigration(pub PhantomData); +impl Migration for PolkadotXcmMigration +where + T: pallet_xcm::Config, +{ + fn friendly_name(&self) -> &str { + "MM_PolkadotXcmMigration" + } + + fn migrate(&self, _available_weight: Weight) -> Weight { + pallet_xcm::migration::v1::VersionUncheckedMigrateToV1::::on_runtime_upgrade() + } +} + +pub struct XcmpQueueMigration(pub PhantomData); +impl Migration for XcmpQueueMigration +where + T: cumulus_pallet_xcmp_queue::Config, +{ + fn friendly_name(&self) -> &str { + "MM_XcmpQueueMigration" + } + + fn migrate(&self, _available_weight: Weight) -> Weight { + cumulus_pallet_xcmp_queue::migration::Migration::::on_runtime_upgrade() + } +} + pub struct DanceboxMigrations(PhantomData); impl GetMigrations for DanceboxMigrations where - Runtime: pallet_invulnerables::Config, - Runtime: pallet_pooled_staking::Config, - Runtime: pallet_balances::Config, + Runtime: pallet_pooled_staking::Config + + pallet_xcm::Config + + pallet_balances::Config + + cumulus_pallet_xcmp_queue::Config + + pallet_invulnerables::Config, Runtime::RuntimeHoldReason: From, { fn get_migrations() -> Vec> { let migrate_invulnerables = MigrateInvulnerables::(Default::default()); let migrate_holds = MigrateHoldReason::(Default::default()); - - vec![Box::new(migrate_invulnerables), Box::new(migrate_holds)] + let migrate_xcm = PolkadotXcmMigration::(Default::default()); + let migrate_xcmp_queue = XcmpQueueMigration::(Default::default()); + + vec![ + Box::new(migrate_invulnerables), + Box::new(migrate_holds), + Box::new(migrate_xcm), + Box::new(migrate_xcmp_queue), + ] } } From 1ffc919862f5e0e6b9d3112cd0e1e5398f34d1a8 Mon Sep 17 00:00:00 2001 From: Francisco Gamundi Date: Wed, 18 Oct 2023 16:55:09 +0200 Subject: [PATCH 4/5] Cleanup --- runtime/dancebox/src/migrations.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/runtime/dancebox/src/migrations.rs b/runtime/dancebox/src/migrations.rs index 6a277cf71..ed60d6360 100644 --- a/runtime/dancebox/src/migrations.rs +++ b/runtime/dancebox/src/migrations.rs @@ -20,10 +20,10 @@ //! the "Migration" trait declared in the pallet-migrations crate. use { - crate::{Invulnerables, Runtime, RuntimeOrigin, LOG_TARGET}, + crate::{Configuration, Invulnerables, Runtime, RuntimeOrigin, LOG_TARGET}, frame_support::{ - migration::storage_key_iter, storage::types::StorageValue, weights::Weight, - Blake2_128Concat, + migration::storage_key_iter, storage::types::StorageValue, traits::OnRuntimeUpgrade, + weights::Weight, Blake2_128Concat, }, pallet_balances::IdAmount, pallet_configuration::{weights::WeightInfo as _, HostConfiguration}, @@ -287,14 +287,13 @@ where fn pre_upgrade(&self) -> Result, sp_runtime::DispatchError> { const CONFIGURATION_ACTIVE_CONFIG_KEY: &[u8] = &hex_literal::hex!("06de3d8a54d27e44a9d5ce189618f22db4b49d95320d9021994c850f25b8e385"); - const CONFIGURATION_PENDING_CONFIGS_KEY: &[u8] = - &hex_literal::hex!("06de3d8a54d27e44a9d5ce189618f22d53b4123b2e186e07fb7bad5dda5f55c0"); let old_config_bytes = frame_support::storage::unhashed::get_raw(CONFIGURATION_ACTIVE_CONFIG_KEY) .expect("configuration.activeConfig should have value"); assert_eq!(old_config_bytes.len(), 16); + use parity_scale_codec::Encode; Ok((old_config_bytes).encode()) } @@ -302,7 +301,7 @@ where #[cfg(feature = "try-runtime")] fn post_upgrade( &self, - number_of_invulnerables: Vec, + _number_of_invulnerables: Vec, ) -> Result<(), sp_runtime::DispatchError> { let new_period = Configuration::config().full_rotation_period; assert_eq!(new_period, 24); From 73880cdc192d86e6a614c7828885a8e1762b59ad Mon Sep 17 00:00:00 2001 From: Francisco Gamundi Date: Thu, 19 Oct 2023 17:02:12 +0200 Subject: [PATCH 5/5] Removed use to try-runtime block --- runtime/dancebox/src/migrations.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/dancebox/src/migrations.rs b/runtime/dancebox/src/migrations.rs index ed60d6360..30af942bb 100644 --- a/runtime/dancebox/src/migrations.rs +++ b/runtime/dancebox/src/migrations.rs @@ -20,7 +20,7 @@ //! the "Migration" trait declared in the pallet-migrations crate. use { - crate::{Configuration, Invulnerables, Runtime, RuntimeOrigin, LOG_TARGET}, + crate::{Invulnerables, Runtime, RuntimeOrigin, LOG_TARGET}, frame_support::{ migration::storage_key_iter, storage::types::StorageValue, traits::OnRuntimeUpgrade, weights::Weight, Blake2_128Concat, @@ -303,7 +303,7 @@ where &self, _number_of_invulnerables: Vec, ) -> Result<(), sp_runtime::DispatchError> { - let new_period = Configuration::config().full_rotation_period; + let new_period = crate::Configuration::config().full_rotation_period; assert_eq!(new_period, 24); Ok(())