From 2cfda98aca009373fe882da8e898477dbdb042aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= <bkchr@users.noreply.github.com> Date: Mon, 2 Aug 2021 12:54:54 +0200 Subject: [PATCH] Change pallet naming in test-runtime (#3551) * Change pallet naming in test-runtime This is required to make the `well_know_keys::ACTIVE_CONFIG` match the `ActiveConfig` key. * Use correct name * :facepalm: --- polkadot/node/test/service/src/chain_spec.rs | 2 +- polkadot/runtime/parachains/src/configuration.rs | 12 ++++++++++++ polkadot/runtime/test-runtime/src/lib.rs | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/polkadot/node/test/service/src/chain_spec.rs b/polkadot/node/test/service/src/chain_spec.rs index 855c9455075..06029c63f76 100644 --- a/polkadot/node/test/service/src/chain_spec.rs +++ b/polkadot/node/test/service/src/chain_spec.rs @@ -158,7 +158,7 @@ fn polkadot_testnet_genesis( claims: runtime::ClaimsConfig { claims: vec![], vesting: vec![] }, vesting: runtime::VestingConfig { vesting: vec![] }, sudo: runtime::SudoConfig { key: root_key }, - parachains_configuration: runtime::ParachainsConfigurationConfig { + configuration: runtime::ConfigurationConfig { config: polkadot_runtime_parachains::configuration::HostConfiguration { validation_upgrade_frequency: 10u32, validation_upgrade_delay: 5, diff --git a/polkadot/runtime/parachains/src/configuration.rs b/polkadot/runtime/parachains/src/configuration.rs index 4521fd590d2..b675bf9034c 100644 --- a/polkadot/runtime/parachains/src/configuration.rs +++ b/polkadot/runtime/parachains/src/configuration.rs @@ -765,6 +765,18 @@ pub mod pallet { Ok(()) } } + + #[pallet::hooks] + impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> { + fn integrity_test() { + assert_eq!( + &ActiveConfig::<T>::hashed_key(), + primitives::v1::well_known_keys::ACTIVE_CONFIG, + "`well_known_keys::ACTIVE_CONFIG` doesn't match key of `ActiveConfig`! Make sure that the name of the\ + configuration pallet is `Configuration` in the runtime!", + ); + } + } } impl<T: Config> Pallet<T> { diff --git a/polkadot/runtime/test-runtime/src/lib.rs b/polkadot/runtime/test-runtime/src/lib.rs index de61fe47409..704cdc20b6a 100644 --- a/polkadot/runtime/test-runtime/src/lib.rs +++ b/polkadot/runtime/test-runtime/src/lib.rs @@ -529,7 +529,7 @@ construct_runtime! { Vesting: pallet_vesting::{Pallet, Call, Storage, Event<T>, Config<T>}, // Parachains runtime modules - ParachainsConfiguration: parachains_configuration::{Pallet, Call, Storage, Config<T>}, + Configuration: parachains_configuration::{Pallet, Call, Storage, Config<T>}, ParaInclusion: parachains_inclusion::{Pallet, Call, Storage, Event<T>}, ParasInherent: parachains_paras_inherent::{Pallet, Call, Storage, Inherent}, Initializer: parachains_initializer::{Pallet, Call, Storage}, -- GitLab