difftreelog
feat preimage + execute preimage in maintenance pallet
in: master
13 files changed
Cargo.lockdiffbeforeafterboth5541 "pallet-inflation",5541 "pallet-inflation",5542 "pallet-maintenance",5542 "pallet-maintenance",5543 "pallet-nonfungible",5543 "pallet-nonfungible",5544 "pallet-preimage",5544 "pallet-randomness-collective-flip",5545 "pallet-randomness-collective-flip",5545 "pallet-refungible",5546 "pallet-refungible",5546 "pallet-session",5547 "pallet-session",6480 "frame-system",6481 "frame-system",6481 "parity-scale-codec",6482 "parity-scale-codec",6482 "scale-info",6483 "scale-info",6484 "sp-core",6483 "sp-std",6485 "sp-std",6484]6486]648564878968 "pallet-inflation",8970 "pallet-inflation",8969 "pallet-maintenance",8971 "pallet-maintenance",8970 "pallet-nonfungible",8972 "pallet-nonfungible",8973 "pallet-preimage",8971 "pallet-randomness-collective-flip",8974 "pallet-randomness-collective-flip",8972 "pallet-refungible",8975 "pallet-refungible",8973 "pallet-session",8976 "pallet-session",13198 "pallet-inflation",13201 "pallet-inflation",13199 "pallet-maintenance",13202 "pallet-maintenance",13200 "pallet-nonfungible",13203 "pallet-nonfungible",13204 "pallet-preimage",13201 "pallet-randomness-collective-flip",13205 "pallet-randomness-collective-flip",13202 "pallet-refungible",13206 "pallet-refungible",13203 "pallet-session",13207 "pallet-session",Cargo.tomldiffbeforeafterboth98pallet-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }98pallet-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }99pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }99pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }100pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }100pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }101pallet-preimage = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }101pallet-randomness-collective-flip = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }102pallet-randomness-collective-flip = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }102pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }103pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }103pallet-sudo = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }104pallet-sudo = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }pallets/maintenance/Cargo.tomldiffbeforeafterboth18frame-benchmarking = { workspace = true, optional = true }18frame-benchmarking = { workspace = true, optional = true }19frame-support = { workspace = true }19frame-support = { workspace = true }20frame-system = { workspace = true }20frame-system = { workspace = true }21sp-core = { workspace = true }21sp-std = { workspace = true }22sp-std = { workspace = true }222323[features]24[features]24default = ["std"]25default = ["std"]25runtime-benchmarks = ["frame-benchmarking", "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks"]26runtime-benchmarks = ["frame-benchmarking", "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks"]26std = ["codec/std", "frame-benchmarking/std", "frame-support/std", "frame-system/std", "scale-info/std", "sp-std/std"]27std = ["codec/std", "frame-benchmarking/std", "frame-support/std", "frame-system/std", "scale-info/std", "sp-core/std", "sp-std/std"]27try-runtime = ["frame-support/try-runtime"]28try-runtime = ["frame-support/try-runtime"]2829pallets/maintenance/src/lib.rsdiffbeforeafterboth252526#[frame_support::pallet]26#[frame_support::pallet]27pub mod pallet {27pub mod pallet {28 use frame_support::pallet_prelude::*;28 use frame_support::{29 dispatch::*,30 pallet_prelude::*,31 traits::{QueryPreimage, StorePreimage},32 };29 use frame_system::pallet_prelude::*;33 use frame_system::pallet_prelude::*;34 use sp_core::H256;3530 use crate::weights::WeightInfo;36 use crate::weights::WeightInfo;313732 #[pallet::config]38 #[pallet::config]33 pub trait Config: frame_system::Config {39 pub trait Config: frame_system::Config {40 /// The overarching event type.34 type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;41 type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;4243 /// The runtime origin type.44 type RuntimeOrigin: From<RawOrigin<Self::AccountId>>45 + IsType<<Self as frame_system::Config>::RuntimeOrigin>;4647 /// The aggregated call type.48 type RuntimeCall: Parameter49 + Dispatchable<50 RuntimeOrigin = <Self as Config>::RuntimeOrigin,51 PostInfo = PostDispatchInfo,52 > + GetDispatchInfo53 + From<frame_system::Call<Self>>;5455 /// The preimage provider with which we look up call hashes to get the call.56 type Preimages: QueryPreimage + StorePreimage;5758 /// Weight information for extrinsics in this pallet.35 type WeightInfo: WeightInfo;59 type WeightInfo: WeightInfo;36 }60 }376179 Ok(())103 Ok(())80 }104 }105106 #[pallet::call_index(2)]107 #[pallet::weight(<T as Config>::WeightInfo::execute_preimage())]108 pub fn execute_preimage(origin: OriginFor<T>, hash: H256) -> DispatchResult {109 ensure_root(origin)?;110111 let len = T::Preimages::len(&hash).ok_or(DispatchError::Unavailable)?;112 let bounded = T::Preimages::pick::<<T as Config>::RuntimeCall>(hash, len);113 let (call, _) =114 T::Preimages::realize(&bounded).map_err(|_| DispatchError::Unavailable)?;115116 let result = match call.dispatch(frame_system::RawOrigin::Root.into()) {117 Ok(_) => Ok(()),118 Err(error_and_info) => Err(error_and_info.error),119 };120121 result122 }81 }123 }82}124}83125pallets/scheduler-v2/Cargo.tomldiffbeforeafterboth24sp-std = { workspace = true }24sp-std = { workspace = true }252526[dev-dependencies]26[dev-dependencies]27pallet-preimage = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }27pallet-preimage = { workspace = true }28substrate-test-utils = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }28substrate-test-utils = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }292930[features]30[features]runtime/common/config/pallets/governance.rsdiffbeforeafterbothno changes
runtime/common/config/pallets/mod.rsdiffbeforeafterboth23 weights::CommonWeights,23 weights::CommonWeights,24 RelayChainBlockNumberProvider,24 RelayChainBlockNumberProvider,25 },25 },26 Runtime, RuntimeEvent, RuntimeCall, Balances,26 Runtime, RuntimeEvent, RuntimeCall, RuntimeOrigin, Balances, Preimage,27};27};28use frame_support::traits::{ConstU32, ConstU64};28use frame_support::traits::{ConstU32, ConstU64};29use up_common::{29use up_common::{47#[cfg(feature = "collator-selection")]47#[cfg(feature = "collator-selection")]48pub mod collator_selection;48pub mod collator_selection;4950// todo:governance replace the feature with governance51#[cfg(feature = "collator-selection")]52pub mod governance;495350parameter_types! {54parameter_types! {51 pub TreasuryAccountId: AccountId = TreasuryModuleId::get().into_account_truncating();55 pub TreasuryAccountId: AccountId = TreasuryModuleId::get().into_account_truncating();123127124impl pallet_maintenance::Config for Runtime {128impl pallet_maintenance::Config for Runtime {125 type RuntimeEvent = RuntimeEvent;129 type RuntimeEvent = RuntimeEvent;130 type RuntimeOrigin = RuntimeOrigin;131 type RuntimeCall = RuntimeCall;132 type Preimages = Preimage;126 type WeightInfo = pallet_maintenance::weights::SubstrateWeight<Self>;133 type WeightInfo = pallet_maintenance::weights::SubstrateWeight<Self>;127}134}128135runtime/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,5859 // todo:governance switch feature to governance60 #[cfg(feature = "collator-selection")]61 Preimage: pallet_preimage::{Pallet, Call, Storage, Event<T>} = 41,586259 // XCM helpers.63 // XCM helpers.60 XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 50,64 XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 50,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)),8889 // todo:governance switch the feature to governance90 #[cfg(feature = "collator-selection")]91 RuntimeCall::Preimage(_) => Err(TransactionValidityError::Invalid(InvalidTransaction::Call)),889289 #[cfg(feature = "pallet-test-utils")]93 #[cfg(feature = "pallet-test-utils")]90 RuntimeCall::TestUtils(_) => Err(TransactionValidityError::Invalid(InvalidTransaction::Call)),94 RuntimeCall::TestUtils(_) => Err(TransactionValidityError::Invalid(InvalidTransaction::Call)),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);567568 // todo:governance switch feature to governance569 #[cfg(feature = "collator-selection")]570 list_benchmark!(list, extra, pallet_preimage, Preimage);567571568 #[cfg(feature = "foreign-assets")]572 #[cfg(feature = "foreign-assets")]569 list_benchmark!(list, extra, pallet_foreign_assets, ForeignAssets);573 list_benchmark!(list, extra, pallet_foreign_assets, ForeignAssets);629 #[cfg(feature = "collator-selection")]633 #[cfg(feature = "collator-selection")]630 add_benchmark!(params, batches, pallet_identity, Identity);634 add_benchmark!(params, batches, pallet_identity, Identity);635636 // todo:governance switch feature to governance637 #[cfg(feature = "collator-selection")]638 add_benchmark!(params, batches, pallet_preimage, Preimage);631639632 #[cfg(feature = "foreign-assets")]640 #[cfg(feature = "foreign-assets")]633 add_benchmark!(params, batches, pallet_foreign_assets, ForeignAssets);641 add_benchmark!(params, batches, pallet_foreign_assets, ForeignAssets);runtime/opal/Cargo.tomldiffbeforeafterboth41 'pallet-inflation/runtime-benchmarks',41 'pallet-inflation/runtime-benchmarks',42 'pallet-maintenance/runtime-benchmarks',42 'pallet-maintenance/runtime-benchmarks',43 'pallet-nonfungible/runtime-benchmarks',43 'pallet-nonfungible/runtime-benchmarks',44 "pallet-preimage/runtime-benchmarks",44 'pallet-refungible/runtime-benchmarks',45 'pallet-refungible/runtime-benchmarks',45 'pallet-structure/runtime-benchmarks',46 'pallet-structure/runtime-benchmarks',46 'pallet-timestamp/runtime-benchmarks',47 'pallet-timestamp/runtime-benchmarks',69 # 'pallet-contracts-primitives/std',70 # 'pallet-contracts-primitives/std',70 # 'pallet-contracts-rpc-runtime-api/std',71 # 'pallet-contracts-rpc-runtime-api/std',71 # 'pallet-contract-helpers/std',72 # 'pallet-contract-helpers/std',73 "pallet-preimage/std",72 "pallet-authorship/std",74 "pallet-authorship/std",73 "pallet-session/std",75 "pallet-session/std",74 "sp-consensus-aura/std",76 "sp-consensus-aura/std",139 "pallet-collator-selection/try-runtime",141 "pallet-collator-selection/try-runtime",140 "pallet-identity/try-runtime",142 "pallet-identity/try-runtime",141 "pallet-session/try-runtime",143 "pallet-session/try-runtime",144 "pallet-preimage/try-runtime",142 'cumulus-pallet-aura-ext/try-runtime',145 'cumulus-pallet-aura-ext/try-runtime',143 'cumulus-pallet-dmp-queue/try-runtime',146 'cumulus-pallet-dmp-queue/try-runtime',144 'cumulus-pallet-parachain-system/try-runtime',147 'cumulus-pallet-parachain-system/try-runtime',218pallet-aura = { workspace = true }221pallet-aura = { workspace = true }219pallet-authorship = { workspace = true }222pallet-authorship = { workspace = true }220pallet-balances = { workspace = true }223pallet-balances = { workspace = true }224pallet-preimage = { workspace = true }221pallet-randomness-collective-flip = { workspace = true }225pallet-randomness-collective-flip = { workspace = true }222pallet-session = { workspace = true }226pallet-session = { workspace = true }223pallet-sudo = { workspace = true }227pallet-sudo = { workspace = true }runtime/quartz/Cargo.tomldiffbeforeafterboth42 'pallet-inflation/runtime-benchmarks',42 'pallet-inflation/runtime-benchmarks',43 'pallet-maintenance/runtime-benchmarks',43 'pallet-maintenance/runtime-benchmarks',44 'pallet-nonfungible/runtime-benchmarks',44 'pallet-nonfungible/runtime-benchmarks',45 "pallet-preimage/runtime-benchmarks",45 'pallet-refungible/runtime-benchmarks',46 'pallet-refungible/runtime-benchmarks',46 'pallet-structure/runtime-benchmarks',47 'pallet-structure/runtime-benchmarks',47 'pallet-timestamp/runtime-benchmarks',48 'pallet-timestamp/runtime-benchmarks',69 # 'pallet-contracts-primitives/std',70 # 'pallet-contracts-primitives/std',70 # 'pallet-contracts-rpc-runtime-api/std',71 # 'pallet-contracts-rpc-runtime-api/std',71 # 'pallet-contract-helpers/std',72 # 'pallet-contract-helpers/std',73 "pallet-preimage/std",72 "pallet-authorship/std",74 "pallet-authorship/std",73 "pallet-identity/std",75 "pallet-identity/std",74 "pallet-session/std",76 "pallet-session/std",136 "pallet-collator-selection/try-runtime",138 "pallet-collator-selection/try-runtime",137 "pallet-identity/try-runtime",139 "pallet-identity/try-runtime",138 "pallet-session/try-runtime",140 "pallet-session/try-runtime",141 "pallet-preimage/try-runtime",139 'cumulus-pallet-aura-ext/try-runtime',142 'cumulus-pallet-aura-ext/try-runtime',140 'cumulus-pallet-dmp-queue/try-runtime',143 'cumulus-pallet-dmp-queue/try-runtime',141 'cumulus-pallet-parachain-system/try-runtime',144 'cumulus-pallet-parachain-system/try-runtime',210pallet-aura = { workspace = true }213pallet-aura = { workspace = true }211pallet-authorship = { workspace = true }214pallet-authorship = { workspace = true }212pallet-balances = { workspace = true }215pallet-balances = { workspace = true }216pallet-preimage = { workspace = true }213pallet-randomness-collective-flip = { workspace = true }217pallet-randomness-collective-flip = { workspace = true }214pallet-session = { workspace = true }218pallet-session = { workspace = true }215pallet-sudo = { workspace = true }219pallet-sudo = { workspace = true }runtime/unique/Cargo.tomldiffbeforeafterboth39 'pallet-inflation/runtime-benchmarks',39 'pallet-inflation/runtime-benchmarks',40 'pallet-maintenance/runtime-benchmarks',40 'pallet-maintenance/runtime-benchmarks',41 'pallet-nonfungible/runtime-benchmarks',41 'pallet-nonfungible/runtime-benchmarks',42 "pallet-preimage/runtime-benchmarks",42 'pallet-refungible/runtime-benchmarks',43 'pallet-refungible/runtime-benchmarks',43 'pallet-structure/runtime-benchmarks',44 'pallet-structure/runtime-benchmarks',44 'pallet-timestamp/runtime-benchmarks',45 'pallet-timestamp/runtime-benchmarks',67 # 'pallet-contracts-primitives/std',68 # 'pallet-contracts-primitives/std',68 # 'pallet-contracts-rpc-runtime-api/std',69 # 'pallet-contracts-rpc-runtime-api/std',69 # 'pallet-contract-helpers/std',70 # 'pallet-contract-helpers/std',71 "pallet-preimage/std",70 "pallet-authorship/std",72 "pallet-authorship/std",71 "pallet-identity/std",73 "pallet-identity/std",72 "pallet-session/std",74 "pallet-session/std",134 "pallet-collator-selection/try-runtime",136 "pallet-collator-selection/try-runtime",135 "pallet-identity/try-runtime",137 "pallet-identity/try-runtime",136 "pallet-session/try-runtime",138 "pallet-session/try-runtime",139 "pallet-preimage/try-runtime",137 'cumulus-pallet-aura-ext/try-runtime',140 'cumulus-pallet-aura-ext/try-runtime',138 'cumulus-pallet-dmp-queue/try-runtime',141 'cumulus-pallet-dmp-queue/try-runtime',139 'cumulus-pallet-parachain-system/try-runtime',142 'cumulus-pallet-parachain-system/try-runtime',209pallet-aura = { workspace = true }212pallet-aura = { workspace = true }210pallet-authorship = { workspace = true }213pallet-authorship = { workspace = true }211pallet-balances = { workspace = true }214pallet-balances = { workspace = true }215pallet-preimage = { workspace = true }212pallet-randomness-collective-flip = { workspace = true }216pallet-randomness-collective-flip = { workspace = true }213pallet-session = { workspace = true }217pallet-session = { workspace = true }214pallet-sudo = { workspace = true }218pallet-sudo = { workspace = true }