Skip to content

Commit

Permalink
Fix try-runtime build and add missing migrations (#296)
Browse files Browse the repository at this point in the history
* Fix deps

* Update moonkit dep

* Missing migrations

* Cleanup

* Removed use to try-runtime block
  • Loading branch information
fgamundi authored Oct 19, 2023
1 parent 850faaf commit fc80184
Show file tree
Hide file tree
Showing 8 changed files with 230 additions and 34 deletions.
12 changes: 6 additions & 6 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions container-chains/templates/frontier/node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
92 changes: 81 additions & 11 deletions container-chains/templates/frontier/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }

Expand All @@ -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 }
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions container-chains/templates/simple/node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ use {
std::net::SocketAddr,
};

#[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")]
Expand Down
99 changes: 88 additions & 11 deletions container-chains/templates/simple/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }

Expand Down Expand Up @@ -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",
]
3 changes: 3 additions & 0 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Box<dyn ChainSpec>, String> {
Ok(match id {
"dev" => Box::new(chain_spec::development_config(
Expand Down
8 changes: 8 additions & 0 deletions runtime/dancebox/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{RelayChainStateProof, RelayNumberStrictlyIncreases},
cumulus_primitives_core::{
Expand Down Expand Up @@ -958,6 +961,11 @@ impl OnRuntimeUpgrade for MaintenanceHooks {
fn post_upgrade(state: Vec<u8>) -> Result<(), sp_runtime::DispatchError> {
AllPalletsWithSystem::post_upgrade(state)
}

#[cfg(feature = "try-runtime")]
fn try_on_runtime_upgrade(checks: bool) -> Result<Weight, TryRuntimeError> {
AllPalletsWithSystem::try_on_runtime_upgrade(checks)
}
}

impl OnFinalize<BlockNumber> for MaintenanceHooks {
Expand Down
Loading

0 comments on commit fc80184

Please sign in to comment.