Unverified Commit 745b571e authored by Shawn Tabrizi's avatar Shawn Tabrizi Committed by GitHub
Browse files

Companion PR for #7136 (WeightInfo for Session / Offences) (#1735)

* Update `pallet_offences` trait

* remove session weight tests

* "Update Substrate"

* Update Cargo.lock

* Update Cargo.lock

* remove unused code

Co-authored-by: parity-processbot <>
parent 01778f2d
Pipeline #107853 passed with stages
in 24 minutes and 16 seconds
This diff is collapsed.
......@@ -549,7 +549,6 @@ impl pallet_offences::Trait for Runtime {
type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>;
type OnOffenceHandler = Staking;
type WeightSoftLimit = OffencesWeightSoftLimit;
type WeightInfo = ();
}
impl pallet_authority_discovery::Trait for Runtime {}
......
......@@ -605,7 +605,6 @@ impl pallet_offences::Trait for Runtime {
type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>;
type OnOffenceHandler = Staking;
type WeightSoftLimit = OffencesWeightSoftLimit;
type WeightInfo = ();
}
impl pallet_authority_discovery::Trait for Runtime {}
......
......@@ -33,7 +33,6 @@ use polkadot_runtime::{self, Runtime};
use runtime_common::MaximumBlockWeight;
use pallet_elections_phragmen::Call as PhragmenCall;
use pallet_session::Call as SessionCall;
use frame_system::Call as SystemCall;
type DbWeight = <Runtime as frame_system::Trait>::DbWeight;
......@@ -57,31 +56,6 @@ fn weight_of_system_set_code_is_correct() {
assert_eq!(weight, expected_weight);
}
#[test]
fn weight_of_session_set_keys_is_correct() {
// #[weight = 200_000_000
// + T::DbWeight::get().reads(2 + T::Keys::key_ids().len() as Weight)
// + T::DbWeight::get().writes(1 + T::Keys::key_ids().len() as Weight)]
//
// Polkadot has five possible session keys, so we default to key_ids.len() = 5
let expected_weight = 200_000_000 + (DbWeight::get().read * (2 + 5)) + (DbWeight::get().write * (1 + 5));
let weight = SessionCall::set_keys::<Runtime>(Default::default(), Default::default()).get_dispatch_info().weight;
assert_eq!(weight, expected_weight);
}
#[test]
fn weight_of_session_purge_keys_is_correct() {
// #[weight = 120_000_000
// + T::DbWeight::get().reads_writes(2, 1 + T::Keys::key_ids().len() as Weight)]
//
// Polkadot has five possible session keys, so we default to key_ids.len() = 5
let expected_weight = 120_000_000 + (DbWeight::get().read * 2) + (DbWeight::get().write * (1 + 5));
let weight = SessionCall::purge_keys::<Runtime>().get_dispatch_info().weight;
assert_eq!(weight, expected_weight);
}
#[test]
fn weight_of_phragmen_vote_is_correct() {
// #[weight = 100_000_000]
......
......@@ -598,7 +598,6 @@ impl pallet_offences::Trait for Runtime {
type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>;
type OnOffenceHandler = Staking;
type WeightSoftLimit = OffencesWeightSoftLimit;
type WeightInfo = ();
}
impl pallet_authority_discovery::Trait for Runtime {}
......
......@@ -378,7 +378,6 @@ impl pallet_offences::Trait for Runtime {
type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>;
type OnOffenceHandler = Staking;
type WeightSoftLimit = OffencesWeightSoftLimit;
type WeightInfo = ();
}
impl pallet_authority_discovery::Trait for Runtime {}
......
......@@ -356,7 +356,6 @@ impl pallet_offences::Trait for Runtime {
type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>;
type OnOffenceHandler = Staking;
type WeightSoftLimit = OffencesWeightSoftLimit;
type WeightInfo = ();
}
impl pallet_authority_discovery::Trait for Runtime {}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment