Companion: Handle construct_runtime breaking change. (#1692)

* use construct_runtime index

* fix

* "Update Substrate"

Co-authored-by: parity-processbot <>
This commit is contained in:
Guillaume Thiolliere
2020-09-22 17:20:13 +02:00
committed by GitHub
parent 1934a74cc7
commit 944e192532
6 changed files with 279 additions and 317 deletions
+59 -50
View File
@@ -29,7 +29,7 @@ use primitives::v1::{
CommittedCandidateReceipt, PersistedValidationData, GroupRotationInfo, ValidationCode,
};
use runtime_common::{
dummy, claims, SlowAdjustingFeeUpdate,
claims, SlowAdjustingFeeUpdate,
impls::{CurrencyToVoteHandler, ToAuthor},
NegativeImbalance, BlockHashCount, MaximumBlockWeight, AvailableBlockRatio,
MaximumBlockLength, BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight,
@@ -786,10 +786,6 @@ parameter_types! {
pub const MaxPending: u16 = 32;
}
impl<I: frame_support::traits::Instance> dummy::Trait<I> for Runtime {
type Event = Event;
}
/// The type used to represent the kinds of proxying allowed.
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, RuntimeDebug)]
pub enum ProxyType {
@@ -828,10 +824,6 @@ impl InstanceFilter<Call> for ProxyType {
Call::TechnicalMembership(..) |
Call::Treasury(..) |
Call::Claims(..) |
Call::DummyParachains(..) |
Call::DummyAttestations(..) |
Call::DummySlots(..) |
Call::DummyRegistrar(..) |
Call::Utility(..) |
Call::Identity(..) |
Call::Society(..) |
@@ -891,11 +883,34 @@ impl pallet_proxy::Trait for Runtime {
pub struct CustomOnRuntimeUpgrade;
impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade {
fn on_runtime_upgrade() -> frame_support::weights::Weight {
if pallet_scheduler::Module::<Runtime>::migrate_v1_to_t2() {
<Runtime as frame_system::Trait>::MaximumBlockWeight::get()
} else {
<Runtime as frame_system::Trait>::DbWeight::get().reads(1) + 500_000_000
// Update scheduler origin usage
#[derive(Encode, Decode)]
#[allow(non_camel_case_types)]
pub enum OldOriginCaller {
system(frame_system::Origin<Runtime>),
pallet_collective_Instance1(
pallet_collective::Origin<Runtime, pallet_collective::Instance1>
),
pallet_collective_Instance2(
pallet_collective::Origin<Runtime, pallet_collective::Instance2>
),
}
impl Into<OriginCaller> for OldOriginCaller {
fn into(self) -> OriginCaller {
match self {
OldOriginCaller::system(o) => OriginCaller::system(o),
OldOriginCaller::pallet_collective_Instance1(o) =>
OriginCaller::pallet_collective_Instance1(o),
OldOriginCaller::pallet_collective_Instance2(o) =>
OriginCaller::pallet_collective_Instance2(o),
}
}
}
pallet_scheduler::Module::<Runtime>::migrate_origin::<OldOriginCaller>();
<Runtime as frame_system::Trait>::MaximumBlockWeight::get()
}
}
@@ -906,68 +921,62 @@ construct_runtime! {
UncheckedExtrinsic = UncheckedExtrinsic
{
// Basic stuff; balances is uncallable initially.
System: frame_system::{Module, Call, Storage, Config, Event<T>},
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Storage},
System: frame_system::{Module, Call, Storage, Config, Event<T>} = 0,
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Storage} = 32,
// Must be before session.
Babe: pallet_babe::{Module, Call, Storage, Config, Inherent, ValidateUnsigned},
Babe: pallet_babe::{Module, Call, Storage, Config, Inherent, ValidateUnsigned} = 1,
Timestamp: pallet_timestamp::{Module, Call, Storage, Inherent},
Indices: pallet_indices::{Module, Call, Storage, Config<T>, Event<T>},
Balances: pallet_balances::{Module, Call, Storage, Config<T>, Event<T>},
TransactionPayment: pallet_transaction_payment::{Module, Storage},
Timestamp: pallet_timestamp::{Module, Call, Storage, Inherent} = 2,
Indices: pallet_indices::{Module, Call, Storage, Config<T>, Event<T>} = 3,
Balances: pallet_balances::{Module, Call, Storage, Config<T>, Event<T>} = 4,
TransactionPayment: pallet_transaction_payment::{Module, Storage} = 33,
// Consensus support.
Authorship: pallet_authorship::{Module, Call, Storage},
Staking: pallet_staking::{Module, Call, Storage, Config<T>, Event<T>, ValidateUnsigned},
Offences: pallet_offences::{Module, Call, Storage, Event},
Historical: session_historical::{Module},
Session: pallet_session::{Module, Call, Storage, Event, Config<T>},
FinalityTracker: pallet_finality_tracker::{Module, Call, Storage, Inherent},
Grandpa: pallet_grandpa::{Module, Call, Storage, Config, Event, ValidateUnsigned},
ImOnline: pallet_im_online::{Module, Call, Storage, Event<T>, ValidateUnsigned, Config<T>},
AuthorityDiscovery: pallet_authority_discovery::{Module, Call, Config},
Authorship: pallet_authorship::{Module, Call, Storage} = 5,
Staking: pallet_staking::{Module, Call, Storage, Config<T>, Event<T>, ValidateUnsigned} = 6,
Offences: pallet_offences::{Module, Call, Storage, Event} = 7,
Historical: session_historical::{Module} = 34,
Session: pallet_session::{Module, Call, Storage, Event, Config<T>} = 8,
FinalityTracker: pallet_finality_tracker::{Module, Call, Storage, Inherent} = 9,
Grandpa: pallet_grandpa::{Module, Call, Storage, Config, Event, ValidateUnsigned} = 10,
ImOnline: pallet_im_online::{Module, Call, Storage, Event<T>, ValidateUnsigned, Config<T>} = 11,
AuthorityDiscovery: pallet_authority_discovery::{Module, Call, Config} = 12,
// Governance stuff; uncallable initially.
Democracy: pallet_democracy::{Module, Call, Storage, Config, Event<T>},
Council: pallet_collective::<Instance1>::{Module, Call, Storage, Origin<T>, Event<T>, Config<T>},
TechnicalCommittee: pallet_collective::<Instance2>::{Module, Call, Storage, Origin<T>, Event<T>, Config<T>},
ElectionsPhragmen: pallet_elections_phragmen::{Module, Call, Storage, Event<T>, Config<T>},
TechnicalMembership: pallet_membership::<Instance1>::{Module, Call, Storage, Event<T>, Config<T>},
Treasury: pallet_treasury::{Module, Call, Storage, Event<T>},
Democracy: pallet_democracy::{Module, Call, Storage, Config, Event<T>} = 13,
Council: pallet_collective::<Instance1>::{Module, Call, Storage, Origin<T>, Event<T>, Config<T>} = 14,
TechnicalCommittee: pallet_collective::<Instance2>::{Module, Call, Storage, Origin<T>, Event<T>, Config<T>} = 15,
ElectionsPhragmen: pallet_elections_phragmen::{Module, Call, Storage, Event<T>, Config<T>} = 16,
TechnicalMembership: pallet_membership::<Instance1>::{Module, Call, Storage, Event<T>, Config<T>} = 17,
Treasury: pallet_treasury::{Module, Call, Storage, Event<T>} = 18,
// Claims. Usable initially.
Claims: claims::{Module, Call, Storage, Event<T>, Config<T>, ValidateUnsigned},
// Old parachains stuff. All dummies to avoid messing up the transaction indices.
DummyParachains: dummy::<Instance0>::{Module, Call},
DummyAttestations: dummy::<Instance1>::{Module, Call},
DummySlots: dummy::<Instance2>::{Module, Call, Event<T>},
DummyRegistrar: dummy::<Instance3>::{Module, Call, Event<T>},
Claims: claims::{Module, Call, Storage, Event<T>, Config<T>, ValidateUnsigned} = 19,
// Utility module.
Utility: pallet_utility::{Module, Call, Event},
Utility: pallet_utility::{Module, Call, Event} = 24,
// Less simple identity module.
Identity: pallet_identity::{Module, Call, Storage, Event<T>},
Identity: pallet_identity::{Module, Call, Storage, Event<T>} = 25,
// Society module.
Society: pallet_society::{Module, Call, Storage, Event<T>},
Society: pallet_society::{Module, Call, Storage, Event<T>} = 26,
// Social recovery module.
Recovery: pallet_recovery::{Module, Call, Storage, Event<T>},
Recovery: pallet_recovery::{Module, Call, Storage, Event<T>} = 27,
// Vesting. Usable initially, but removed once all vesting is finished.
Vesting: pallet_vesting::{Module, Call, Storage, Event<T>, Config<T>},
Vesting: pallet_vesting::{Module, Call, Storage, Event<T>, Config<T>} = 28,
// System scheduler.
Scheduler: pallet_scheduler::{Module, Call, Storage, Event<T>},
Scheduler: pallet_scheduler::{Module, Call, Storage, Event<T>} = 29,
// Proxy module. Late addition.
Proxy: pallet_proxy::{Module, Call, Storage, Event<T>},
Proxy: pallet_proxy::{Module, Call, Storage, Event<T>} = 30,
// Multisig module. Late addition.
Multisig: pallet_multisig::{Module, Call, Storage, Event<T>},
Multisig: pallet_multisig::{Module, Call, Storage, Event<T>} = 31,
}
}