diff --git a/polkadot/runtime/common/src/parachains.rs b/polkadot/runtime/common/src/parachains.rs index 0753f74e63..031ffaf3d0 100644 --- a/polkadot/runtime/common/src/parachains.rs +++ b/polkadot/runtime/common/src/parachains.rs @@ -333,7 +333,7 @@ pub trait Trait: CreateSignedTransaction> + attestations::Trait + ses } /// Origin for the parachains module. -#[derive(PartialEq, Eq, Clone)] +#[derive(PartialEq, Eq, Clone, Encode, Decode)] #[cfg_attr(feature = "std", derive(Debug))] pub enum Origin { /// It comes from a parachain. diff --git a/polkadot/runtime/kusama/src/lib.rs b/polkadot/runtime/kusama/src/lib.rs index 8e91f8f829..74b5785b3a 100644 --- a/polkadot/runtime/kusama/src/lib.rs +++ b/polkadot/runtime/kusama/src/lib.rs @@ -152,8 +152,10 @@ impl system::Trait for Runtime { impl scheduler::Trait for Runtime { type Event = Event; type Origin = Origin; + type PalletsOrigin = OriginCaller; type Call = Call; type MaximumWeight = MaximumBlockWeight; + type ScheduleOrigin = EnsureRoot; } parameter_types! { @@ -373,6 +375,7 @@ impl democracy::Trait for Runtime { type PreimageByteDeposit = PreimageByteDeposit; type Slash = Treasury; type Scheduler = Scheduler; + type PalletsOrigin = OriginCaller; type MaxVotes = MaxVotes; type OperationalPreimageOrigin = collective::EnsureMember; } @@ -889,10 +892,14 @@ impl proxy::Trait for Runtime { } pub struct CustomOnRuntimeUpgrade; -impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade { + impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade { fn on_runtime_upgrade() -> frame_support::weights::Weight { treasury::Module::::migrate_retract_tip_for_tip_new(); - 500_000_000 + if scheduler::Module::::migrate_v1_to_t2() { + ::MaximumBlockWeight::get() + } else { + ::DbWeight::get().reads(1) + 500_000_000 + } } } diff --git a/polkadot/runtime/polkadot/src/lib.rs b/polkadot/runtime/polkadot/src/lib.rs index dd9a365545..e2eb26fced 100644 --- a/polkadot/runtime/polkadot/src/lib.rs +++ b/polkadot/runtime/polkadot/src/lib.rs @@ -183,8 +183,10 @@ impl system::Trait for Runtime { impl scheduler::Trait for Runtime { type Event = Event; type Origin = Origin; + type PalletsOrigin = OriginCaller; type Call = Call; type MaximumWeight = MaximumBlockWeight; + type ScheduleOrigin = EnsureRoot; } parameter_types! { @@ -442,6 +444,7 @@ impl democracy::Trait for Runtime { type OperationalPreimageOrigin = collective::EnsureMember; type Slash = Treasury; type Scheduler = Scheduler; + type PalletsOrigin = OriginCaller; type MaxVotes = MaxVotes; } @@ -893,6 +896,17 @@ impl proxy::Trait for Runtime { type MaxProxies = MaxProxies; } +pub struct CustomOnRuntimeUpgrade; + impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade { + fn on_runtime_upgrade() -> frame_support::weights::Weight { + if scheduler::Module::::migrate_v1_to_t2() { + ::MaximumBlockWeight::get() + } else { + ::DbWeight::get().reads(1) + } + } +} + construct_runtime! { pub enum Runtime where Block = Block, @@ -990,7 +1004,14 @@ pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; /// Executive: handles dispatch to the various modules. -pub type Executive = executive::Executive, Runtime, AllModules>; +pub type Executive = executive::Executive< + Runtime, + Block, + system::ChainContext, + Runtime, + AllModules, + CustomOnRuntimeUpgrade +>; /// The payload being signed in transactions. pub type SignedPayload = generic::SignedPayload; diff --git a/polkadot/runtime/westend/src/lib.rs b/polkadot/runtime/westend/src/lib.rs index 7aaa05eaaf..34bbd55597 100644 --- a/polkadot/runtime/westend/src/lib.rs +++ b/polkadot/runtime/westend/src/lib.rs @@ -58,6 +58,7 @@ use im_online::sr25519::AuthorityId as ImOnlineId; use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId; use transaction_payment_rpc_runtime_api::RuntimeDispatchInfo; use session::historical as session_historical; +use system::EnsureRoot; #[cfg(feature = "std")] pub use staking::StakerStatus; @@ -141,8 +142,10 @@ impl system::Trait for Runtime { impl scheduler::Trait for Runtime { type Event = Event; type Origin = Origin; + type PalletsOrigin = OriginCaller; type Call = Call; type MaximumWeight = MaximumBlockWeight; + type ScheduleOrigin = EnsureRoot; } parameter_types! {