Offences Weight for OnInitialize (#5961)

* Weight accounting for on_offence.

* Try to compute weight.

* Guesstimate upper bounds on db read/writes for slashing

* greater than or equal to

* add new trait

* Update mock.rs

* Add basic weight test

* one more test

* Update frame/staking/src/lib.rs

Co-authored-by: thiolliere <gui.thiolliere@gmail.com>

* Update frame/staking/src/lib.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Add test for offences queue

Co-authored-by: Tomasz Drwięga <tomasz@parity.io>
Co-authored-by: thiolliere <gui.thiolliere@gmail.com>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
Shawn Tabrizi
2020-05-21 14:00:24 +02:00
committed by GitHub
parent 0ddd5cc278
commit ac049a97be
9 changed files with 219 additions and 38 deletions
+5
View File
@@ -584,10 +584,15 @@ impl pallet_im_online::Trait for Runtime {
type UnsignedPriority = ImOnlineUnsignedPriority;
}
parameter_types! {
pub const OffencesWeightSoftLimit: Weight = Perbill::from_percent(60) * MaximumBlockWeight::get();
}
impl pallet_offences::Trait for Runtime {
type Event = Event;
type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>;
type OnOffenceHandler = Staking;
type WeightSoftLimit = OffencesWeightSoftLimit;
}
impl pallet_authority_discovery::Trait for Runtime {}