Update Staking Weights (#5964)

This commit is contained in:
Shawn Tabrizi
2020-05-15 11:07:19 +02:00
committed by GitHub
parent 27250681bf
commit 71d3abe7d4
8 changed files with 654 additions and 130 deletions
+15
View File
@@ -29,6 +29,7 @@ use sp_runtime::{
};
use crate::dispatch::Parameter;
use crate::storage::StorageMap;
use crate::weights::Weight;
use impl_trait_for_tuples::impl_for_tuples;
/// An abstraction of a value stored within storage, but possibly as part of a larger composite
@@ -147,12 +148,19 @@ pub trait EstimateNextSessionRotation<BlockNumber> {
///
/// None should be returned if the estimation fails to come to an answer
fn estimate_next_session_rotation(now: BlockNumber) -> Option<BlockNumber>;
/// Return the weight of calling `estimate_next_session_rotation`
fn weight(now: BlockNumber) -> Weight;
}
impl<BlockNumber: Bounded> EstimateNextSessionRotation<BlockNumber> for () {
fn estimate_next_session_rotation(_: BlockNumber) -> Option<BlockNumber> {
Default::default()
}
fn weight(_: BlockNumber) -> Weight {
0
}
}
/// Something that can estimate at which block the next `new_session` will be triggered. This must
@@ -160,12 +168,19 @@ impl<BlockNumber: Bounded> EstimateNextSessionRotation<BlockNumber> for () {
pub trait EstimateNextNewSession<BlockNumber> {
/// Return the block number at which the next new session is estimated to happen.
fn estimate_next_new_session(now: BlockNumber) -> Option<BlockNumber>;
/// Return the weight of calling `estimate_next_new_session`
fn weight(now: BlockNumber) -> Weight;
}
impl<BlockNumber: Bounded> EstimateNextNewSession<BlockNumber> for () {
fn estimate_next_new_session(_: BlockNumber) -> Option<BlockNumber> {
Default::default()
}
fn weight(_: BlockNumber) -> Weight {
0
}
}
/// Anything that can have a `::len()` method.