Use Vote Ancestries Directly in Weight Calculations (#862)

* Use more accurate weight calculation in declared weight

* Remove session length and validator set size config constants

* Remove config params from mock

* Allow specifying total number of votes-ancestries per justification

* Change limits used during benchmarking

* Regenerate weights

* Use simplified weight annotation

* Remove comment

* Address leftover TODO

* Prevent possible divide by zero errors

* Use correct argument order in weight declaration
This commit is contained in:
Hernando Castano
2021-04-05 12:36:29 -04:00
committed by Bastian Köcher
parent 0d7291d729
commit 1928e2b870
8 changed files with 90 additions and 112 deletions
-9
View File
@@ -311,11 +311,6 @@ parameter_types! {
// Note that once this is hit the pallet will essentially throttle incoming requests down to one
// call per block.
pub const MaxRequests: u32 = 50;
pub const WestendSessionLength: bp_westend::BlockNumber = bp_westend::SESSION_LENGTH;
pub const RialtoSessionLength: bp_rialto::BlockNumber = bp_rialto::SESSION_LENGTH;
// TODO [#846]: Right now this will break benchmarking if it is greater than `u8::MAX`
pub const RialtoValidatorCount: u32 = 255;
pub const WestendValidatorCount: u32 = 255;
}
@@ -323,8 +318,6 @@ pub type RialtoGrandpaInstance = ();
impl pallet_bridge_grandpa::Config for Runtime {
type BridgedChain = bp_rialto::Rialto;
type MaxRequests = MaxRequests;
type MaxBridgedSessionLength = RialtoSessionLength;
type MaxBridgedValidatorCount = RialtoValidatorCount;
// TODO [#391]: Use weights generated for the Millau runtime instead of Rialto ones.
type WeightInfo = pallet_bridge_grandpa::weights::RialtoWeight<Runtime>;
@@ -334,8 +327,6 @@ pub type WestendGrandpaInstance = pallet_bridge_grandpa::Instance1;
impl pallet_bridge_grandpa::Config<WestendGrandpaInstance> for Runtime {
type BridgedChain = bp_westend::Westend;
type MaxRequests = MaxRequests;
type MaxBridgedSessionLength = WestendSessionLength;
type MaxBridgedValidatorCount = WestendValidatorCount;
// TODO [#391]: Use weights generated for the Millau runtime instead of Rialto ones.
type WeightInfo = pallet_bridge_grandpa::weights::RialtoWeight<Runtime>;