difftreelog
refactor(preimage) switch governance feature to preimage
in: master
12 files changed
pallets/maintenance/src/benchmarking.rsdiffbeforeafterboth23use codec::Encode;23use codec::Encode;24use sp_std::vec;24use sp_std::vec;252526#[cfg(not(feature = "governance"))]27benchmarks! {26benchmarks! {28 enable {27 enable {29 }: _(RawOrigin::Root)28 }: _(RawOrigin::Root)46 }45 }47}46}4849#[cfg(feature = "governance")]50benchmarks! {51 enable {52 }: _(RawOrigin::Root)53 verify {54 ensure!(<Enabled<T>>::get(), "didn't enable the MM");55 }5657 disable {58 Maintenance::<T>::enable(RawOrigin::Root.into())?;59 }: _(RawOrigin::Root)60 verify {61 ensure!(!<Enabled<T>>::get(), "didn't disable the MM");62 }6364 execute_preimage {65 let call_hash = RuntimeCall::<T>::set_storage { items: vec![] }.encode();66 let hash = T::Preimages::note(call_hash.into())?;67 }: _(RawOrigin::Root, hash)68 verify {69 }70}7147pallets/maintenance/src/lib.rsdiffbeforeafterboth27pub mod pallet {27pub mod pallet {28 use frame_support::{28 use frame_support::{dispatch::*, pallet_prelude::*};29 dispatch::*,30 pallet_prelude::*,31 };32 use frame_support::{29 use frame_support::{33 traits::{QueryPreimage, StorePreimage},30 traits::{QueryPreimage, StorePreimage},108 #[pallet::call_index(2)]105 #[pallet::call_index(2)]109 #[pallet::weight(<T as Config>::WeightInfo::execute_preimage())]106 #[pallet::weight(<T as Config>::WeightInfo::execute_preimage())]110 pub fn execute_preimage(_origin: OriginFor<T>, _hash: H256) -> DispatchResult {107 pub fn execute_preimage(_origin: OriginFor<T>, _hash: H256) -> DispatchResult {111 #[cfg(feature = "governance")]108 #[cfg(feature = "preimage")]112 {109 {113 let origin = _origin;110 let origin = _origin;114 let hash = _hash;111 let hash = _hash;128 result125 result129 }126 }130127131 #[cfg(not(feature = "governance"))]128 #[cfg(not(feature = "preimage"))]132 {129 {133 Err(DispatchError::Unavailable)130 Err(DispatchError::Unavailable)134 }131 }runtime/common/config/pallets/governance.rsdiffbeforeafterbothno changes
runtime/common/config/pallets/mod.rsdiffbeforeafterboth47#[cfg(feature = "collator-selection")]47#[cfg(feature = "collator-selection")]48pub mod collator_selection;48pub mod collator_selection;494950#[cfg(feature = "governance")]50#[cfg(feature = "preimage")]51pub mod governance;51pub mod preimage;525253parameter_types! {53parameter_types! {54 pub TreasuryAccountId: AccountId = TreasuryModuleId::get().into_account_truncating();54 pub TreasuryAccountId: AccountId = TreasuryModuleId::get().into_account_truncating();128 type RuntimeEvent = RuntimeEvent;128 type RuntimeEvent = RuntimeEvent;129 type RuntimeOrigin = RuntimeOrigin;129 type RuntimeOrigin = RuntimeOrigin;130 type RuntimeCall = RuntimeCall;130 type RuntimeCall = RuntimeCall;131 #[cfg(feature = "governance")]131 #[cfg(feature = "preimage")]132 type Preimages = crate::Preimage;132 type Preimages = crate::Preimage;133 #[cfg(not(feature = "governance"))]133 #[cfg(not(feature = "preimage"))]134 type Preimages = ();134 type Preimages = ();135 type WeightInfo = pallet_maintenance::weights::SubstrateWeight<Self>;135 type WeightInfo = pallet_maintenance::weights::SubstrateWeight<Self>;136}136}runtime/common/config/pallets/preimage.rsdiffbeforeafterbothno changes
runtime/common/construct_runtime.rsdiffbeforeafterboth56 #[cfg(feature = "collator-selection")]56 #[cfg(feature = "collator-selection")]57 Identity: pallet_identity::{Pallet, Call, Storage, Event<T>} = 40,57 Identity: pallet_identity::{Pallet, Call, Storage, Event<T>} = 40,585859 #[cfg(feature = "governance")]59 #[cfg(feature = "preimage")]60 Preimage: pallet_preimage::{Pallet, Call, Storage, Event<T>} = 41,60 Preimage: pallet_preimage::{Pallet, Call, Storage, Event<T>} = 41,616162 // XCM helpers.62 // XCM helpers.runtime/common/maintenance.rsdiffbeforeafterboth86 | RuntimeCall::Session(_)86 | RuntimeCall::Session(_)87 | RuntimeCall::Identity(_) => Err(TransactionValidityError::Invalid(InvalidTransaction::Call)),87 | RuntimeCall::Identity(_) => Err(TransactionValidityError::Invalid(InvalidTransaction::Call)),888889 #[cfg(feature = "governance")]89 #[cfg(feature = "preimage")]90 RuntimeCall::Preimage(_) => Err(TransactionValidityError::Invalid(InvalidTransaction::Call)),90 RuntimeCall::Preimage(_) => Err(TransactionValidityError::Invalid(InvalidTransaction::Call)),919192 #[cfg(feature = "pallet-test-utils")]92 #[cfg(feature = "pallet-test-utils")]runtime/common/runtime_apis.rsdiffbeforeafterboth565 #[cfg(feature = "collator-selection")]565 #[cfg(feature = "collator-selection")]566 list_benchmark!(list, extra, pallet_identity, Identity);566 list_benchmark!(list, extra, pallet_identity, Identity);567567568 #[cfg(feature = "governance")]568 #[cfg(feature = "preimage")]569 list_benchmark!(list, extra, pallet_preimage, Preimage);569 list_benchmark!(list, extra, pallet_preimage, Preimage);570570571 #[cfg(feature = "foreign-assets")]571 #[cfg(feature = "foreign-assets")]632 #[cfg(feature = "collator-selection")]632 #[cfg(feature = "collator-selection")]633 add_benchmark!(params, batches, pallet_identity, Identity);633 add_benchmark!(params, batches, pallet_identity, Identity);634634635 #[cfg(feature = "governance")]635 #[cfg(feature = "preimage")]636 add_benchmark!(params, batches, pallet_preimage, Preimage);636 add_benchmark!(params, batches, pallet_preimage, Preimage);637637638 #[cfg(feature = "foreign-assets")]638 #[cfg(feature = "foreign-assets")]runtime/opal/Cargo.tomldiffbeforeafterboth18[features]18[features]19default = ['opal-runtime', 'std']19default = ['opal-runtime', 'std']20limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']20limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']21opal-runtime = ['app-promotion', 'collator-selection', 'foreign-assets', 'governance', 'pallet-test-utils', 'refungible']21opal-runtime = ['app-promotion', 'collator-selection', 'foreign-assets', 'preimage', 'pallet-test-utils', 'refungible']22pov-estimate = []22pov-estimate = []23runtime-benchmarks = [23runtime-benchmarks = [24 'cumulus-pallet-parachain-system/runtime-benchmarks',24 'cumulus-pallet-parachain-system/runtime-benchmarks',191app-promotion = []191app-promotion = []192collator-selection = []192collator-selection = []193foreign-assets = []193foreign-assets = []194governance = []194preimage = []195pallet-test-utils = []195pallet-test-utils = []196refungible = []196refungible = []197scheduler = []197scheduler = []runtime/quartz/Cargo.tomldiffbeforeafterboth20default = ['quartz-runtime', 'std']20default = ['quartz-runtime', 'std']21limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']21limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']22pov-estimate = []22pov-estimate = []23quartz-runtime = ['app-promotion', 'collator-selection', 'foreign-assets', 'governance', 'refungible']23quartz-runtime = ['app-promotion', 'collator-selection', 'foreign-assets', 'preimage', 'refungible']24runtime-benchmarks = [24runtime-benchmarks = [25 'cumulus-pallet-parachain-system/runtime-benchmarks',25 'cumulus-pallet-parachain-system/runtime-benchmarks',26 'frame-benchmarking',26 'frame-benchmarking',184app-promotion = []184app-promotion = []185collator-selection = []185collator-selection = []186foreign-assets = []186foreign-assets = []187governance = []187preimage = []188refungible = []188refungible = []189scheduler = []189scheduler = []190190runtime/unique/Cargo.tomldiffbeforeafterboth183app-promotion = []183app-promotion = []184collator-selection = []184collator-selection = []185foreign-assets = []185foreign-assets = []186governance = []186preimage = []187refungible = []187refungible = []188scheduler = []188scheduler = []189189tests/src/pallet-presence.test.tsdiffbeforeafterboth66 const foreignAssets = 'foreignassets';66 const foreignAssets = 'foreignassets';67 const appPromotion = 'apppromotion';67 const appPromotion = 'apppromotion';68 const collatorSelection = ['authorship', 'session', 'collatorselection', 'identity'];68 const collatorSelection = ['authorship', 'session', 'collatorselection', 'identity'];69 const governance = ['preimage'];69 const preimage = ['preimage'];70 const testUtils = 'testutils';70 const testUtils = 'testutils';717172 if (chain.eq('OPAL by UNIQUE')) {72 if (chain.eq('OPAL by UNIQUE')) {76 appPromotion,76 appPromotion,77 testUtils,77 testUtils,78 ...collatorSelection,78 ...collatorSelection,79 ...governance,79 ...preimage,80 );80 );81 } else if (chain.eq('QUARTZ by UNIQUE') || chain.eq('SAPPHIRE by UNIQUE')) {81 } else if (chain.eq('QUARTZ by UNIQUE') || chain.eq('SAPPHIRE by UNIQUE')) {82 requiredPallets.push(82 requiredPallets.push(83 refungible,83 refungible,84 appPromotion,84 appPromotion,85 foreignAssets,85 foreignAssets,86 ...collatorSelection,86 ...collatorSelection,87 ...governance,87 ...preimage,88 );88 );89 } else if (chain.eq('UNIQUE')) {89 } else if (chain.eq('UNIQUE')) {90 // Insert Unique additional pallets here90 // Insert Unique additional pallets here