Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Merge branch 'master' into ao-validator-discovery-api
Browse files Browse the repository at this point in the history
* master:
  Update to substrate 2.0 (#1744)
  Companion: Handle construct_runtime breaking change. (#1692)
  Companion for `ModuleToIndex` to `PalletInfo` rename (#1743)
  Companion for substrate/pull/7161 (#1739)
  • Loading branch information
ordian committed Sep 23, 2020
2 parents c1da4c6 + a5d776a commit c6aa649
Show file tree
Hide file tree
Showing 18 changed files with 605 additions and 546 deletions.
536 changes: 268 additions & 268 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion runtime/common/src/claims.rs
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ mod tests {
type MaximumBlockLength = MaximumBlockLength;
type AvailableBlockRatio = AvailableBlockRatio;
type Version = ();
type ModuleToIndex = ();
type PalletInfo = ();
type AccountData = pallet_balances::AccountData<u64>;
type OnNewAccount = ();
type OnKilledAccount = Balances;
Expand Down
2 changes: 1 addition & 1 deletion runtime/common/src/crowdfund.rs
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ mod tests {
type MaximumBlockLength = MaximumBlockLength;
type AvailableBlockRatio = AvailableBlockRatio;
type Version = ();
type ModuleToIndex = ();
type PalletInfo = ();
type AccountData = pallet_balances::AccountData<u64>;
type OnNewAccount = ();
type OnKilledAccount = Balances;
Expand Down
40 changes: 0 additions & 40 deletions runtime/common/src/dummy.rs

This file was deleted.

4 changes: 1 addition & 3 deletions runtime/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ pub mod purchase;
pub mod impls;
pub mod paras_sudo_wrapper;

pub mod dummy;

use primitives::v1::{BlockNumber, ValidatorId};
use sp_runtime::{Perquintill, Perbill, FixedPointNumber, traits::Saturating};
use frame_support::{
Expand Down Expand Up @@ -165,7 +163,7 @@ mod multiplier_tests {
type MaximumBlockLength = MaximumBlockLength;
type AvailableBlockRatio = AvailableBlockRatio;
type Version = ();
type ModuleToIndex = ();
type PalletInfo = ();
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
Expand Down
2 changes: 1 addition & 1 deletion runtime/common/src/purchase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ mod tests {
type MaximumBlockLength = MaximumBlockLength;
type AvailableBlockRatio = AvailableBlockRatio;
type Version = ();
type ModuleToIndex = ();
type PalletInfo = ();
type AccountData = pallet_balances::AccountData<u64>;
type OnNewAccount = ();
type OnKilledAccount = Balances;
Expand Down
2 changes: 1 addition & 1 deletion runtime/common/src/slots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,7 @@ mod tests {
type MaximumBlockLength = MaximumBlockLength;
type AvailableBlockRatio = AvailableBlockRatio;
type Version = ();
type ModuleToIndex = ();
type PalletInfo = ();
type AccountData = pallet_balances::AccountData<u64>;
type OnNewAccount = ();
type OnKilledAccount = Balances;
Expand Down
113 changes: 61 additions & 52 deletions runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -145,7 +145,7 @@ impl frame_system::Trait for Runtime {
type MaximumBlockLength = MaximumBlockLength;
type AvailableBlockRatio = AvailableBlockRatio;
type Version = Version;
type ModuleToIndex = ModuleToIndex;
type PalletInfo = PalletInfo;
type AccountData = pallet_balances::AccountData<Balance>;
type OnNewAccount = ();
type OnKilledAccount = ();
Expand Down Expand Up @@ -459,7 +459,7 @@ impl pallet_elections_phragmen::Trait for Runtime {
type DesiredRunnersUp = DesiredRunnersUp;
type TermDuration = TermDuration;
type ModuleId = ElectionsPhragmenModuleId;
type WeightInfo = ();
type WeightInfo = weights::pallet_elections_phragmen::WeightInfo;
}

parameter_types! {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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(..) |
Expand Down Expand Up @@ -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()
}
}

Expand All @@ -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,
}
}

Expand Down
1 change: 1 addition & 0 deletions runtime/kusama/src/weights/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ pub mod pallet_timestamp;
pub mod pallet_treasury;
pub mod pallet_utility;
pub mod pallet_vesting;
pub mod pallet_elections_phragmen;
89 changes: 89 additions & 0 deletions runtime/kusama/src/weights/pallet_elections_phragmen.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
// This file is part of Substrate.

// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc6

#![allow(unused_parens)]
#![allow(unused_imports)]

use frame_support::weights::{Weight, constants::RocksDbWeight as DbWeight};

pub struct WeightInfo;
impl pallet_elections_phragmen::WeightInfo for WeightInfo {
fn vote(v: u32, ) -> Weight {
(91_489_000 as Weight)
.saturating_add((199_000 as Weight).saturating_mul(v as Weight))
.saturating_add(DbWeight::get().reads(5 as Weight))
.saturating_add(DbWeight::get().writes(2 as Weight))
}
fn vote_update(v: u32, ) -> Weight {
(56_511_000 as Weight)
.saturating_add((245_000 as Weight).saturating_mul(v as Weight))
.saturating_add(DbWeight::get().reads(5 as Weight))
.saturating_add(DbWeight::get().writes(2 as Weight))
}
fn remove_voter() -> Weight {
(76_714_000 as Weight)
.saturating_add(DbWeight::get().reads(2 as Weight))
.saturating_add(DbWeight::get().writes(2 as Weight))
}
fn report_defunct_voter_correct(c: u32, v: u32, ) -> Weight {
(0 as Weight)
.saturating_add((1_743_000 as Weight).saturating_mul(c as Weight))
.saturating_add((31_750_000 as Weight).saturating_mul(v as Weight))
.saturating_add(DbWeight::get().reads(7 as Weight))
.saturating_add(DbWeight::get().writes(3 as Weight))
}
fn report_defunct_voter_incorrect(c: u32, v: u32, ) -> Weight {
(0 as Weight)
.saturating_add((1_733_000 as Weight).saturating_mul(c as Weight))
.saturating_add((31_861_000 as Weight).saturating_mul(v as Weight))
.saturating_add(DbWeight::get().reads(6 as Weight))
.saturating_add(DbWeight::get().writes(2 as Weight))
}
fn submit_candidacy(c: u32, ) -> Weight {
(74_714_000 as Weight)
.saturating_add((315_000 as Weight).saturating_mul(c as Weight))
.saturating_add(DbWeight::get().reads(3 as Weight))
.saturating_add(DbWeight::get().writes(1 as Weight))
}
fn renounce_candidacy_candidate(c: u32, ) -> Weight {
(50_408_000 as Weight)
.saturating_add((159_000 as Weight).saturating_mul(c as Weight))
.saturating_add(DbWeight::get().reads(1 as Weight))
.saturating_add(DbWeight::get().writes(1 as Weight))
}
fn renounce_candidacy_members() -> Weight {
(79_626_000 as Weight)
.saturating_add(DbWeight::get().reads(3 as Weight))
.saturating_add(DbWeight::get().writes(4 as Weight))
}
fn renounce_candidacy_runners_up() -> Weight {
(49_715_000 as Weight)
.saturating_add(DbWeight::get().reads(1 as Weight))
.saturating_add(DbWeight::get().writes(1 as Weight))
}
fn remove_member_with_replacement() -> Weight {
(76_572_000 as Weight)
.saturating_add(DbWeight::get().reads(4 as Weight))
.saturating_add(DbWeight::get().writes(5 as Weight))
}
fn remove_member_wrong_refund() -> Weight {
(8_777_000 as Weight)
.saturating_add(DbWeight::get().reads(1 as Weight))
}
}
2 changes: 1 addition & 1 deletion runtime/parachains/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl frame_system::Trait for Test {
type MaximumBlockLength = MaximumBlockLength;
type AvailableBlockRatio = AvailableBlockRatio;
type Version = ();
type ModuleToIndex = ();
type PalletInfo = ();
type AccountData = pallet_balances::AccountData<u128>;
type OnNewAccount = ();
type OnKilledAccount = ();
Expand Down
Loading

0 comments on commit c6aa649

Please sign in to comment.