Benchmarks for elections-phragmen pallet (#5845)

* Fist benchmark barely working

* Debug checkpoint

* add rest of benchmarks

* Add to runtime

* Fix build

* Update frame/elections-phragmen/src/benchmarking.rs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* Update frame/elections-phragmen/src/benchmarking.rs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* major imp

* Make them run on release

* Help finish phragmen benchmarks (#5886)

* update caller, account, and member/runner-up creation

* remove stuff

* ocd

* make it work with real run

* relax the numbers a bit

* New and improved version

* Make elections-phragmen weighable and secure. (#5949)

* Make elections-phragmen weighable.

* Update frame/elections-phragmen/src/lib.rs

Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>

* Update frame/elections-phragmen/src/lib.rs

Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>

* Fix all tests

* Fix everything

* Add note

Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>

* Doc update

* Fix some complexity params

* Once more ready to benchmark

* ready for bench

* final tunes

* Update frame/elections-phragmen/src/lib.rs

* Fix fix

* Update frame/elections-phragmen/src/lib.rs

* Update frame/elections-phragmen/src/benchmarking.rs

Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>

* Update frame/elections-phragmen/src/benchmarking.rs

Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>

* Update to latest weights

* Some fixes

* Fix dual voter read from @thiolliere

* Remove todos

* review from @shawntabrizi

* Fix bench tests.

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
This commit is contained in:
Kian Paimani
2020-05-15 14:07:12 +02:00
committed by GitHub
parent 5f3e376c2e
commit 7a8d59199e
9 changed files with 1490 additions and 480 deletions
+11 -11
View File
@@ -374,16 +374,16 @@ impl From<DispatchError> for DispatchOutcome {
}
}
/// This is the legacy return type of `Dispatchable`. It is still exposed for compatibilty
/// reasons. The new return type is `DispatchResultWithInfo`.
/// FRAME runtimes should use frame_support::dispatch::DispatchResult
/// This is the legacy return type of `Dispatchable`. It is still exposed for compatibility reasons.
/// The new return type is `DispatchResultWithInfo`. FRAME runtimes should use
/// `frame_support::dispatch::DispatchResult`.
pub type DispatchResult = sp_std::result::Result<(), DispatchError>;
/// Return type of a `Dispatchable` which contains the `DispatchResult` and additional information
/// about the `Dispatchable` that is only known post dispatch.
pub type DispatchResultWithInfo<T> = sp_std::result::Result<T, DispatchErrorWithPostInfo<T>>;
/// Reason why a dispatch call failed
/// Reason why a dispatch call failed.
#[derive(Eq, PartialEq, Clone, Copy, Encode, Decode, RuntimeDebug)]
#[cfg_attr(feature = "std", derive(Serialize))]
pub enum DispatchError {
@@ -393,11 +393,11 @@ pub enum DispatchError {
CannotLookup,
/// A bad origin.
BadOrigin,
/// A custom error in a module
/// A custom error in a module.
Module {
/// Module index, matching the metadata module index
/// Module index, matching the metadata module index.
index: u8,
/// Module specific error value
/// Module specific error value.
error: u8,
/// Optional error message.
#[codec(skip)]
@@ -405,15 +405,15 @@ pub enum DispatchError {
},
}
/// Result of a `Dispatchable` which contains the `DispatchResult` and additional information
/// about the `Dispatchable` that is only known post dispatch.
/// Result of a `Dispatchable` which contains the `DispatchResult` and additional information about
/// the `Dispatchable` that is only known post dispatch.
#[derive(Eq, PartialEq, Clone, Copy, Encode, Decode, RuntimeDebug)]
pub struct DispatchErrorWithPostInfo<Info> where
Info: Eq + PartialEq + Clone + Copy + Encode + Decode + traits::Printable
{
/// Addditional information about the `Dispatchable` which is only known post dispatch.
/// Additional information about the `Dispatchable` which is only known post dispatch.
pub post_info: Info,
/// The actual `DispatchResult` indicating whether the dispatch was succesfull.
/// The actual `DispatchResult` indicating whether the dispatch was successful.
pub error: DispatchError,
}