Runtime dependent weights (#5064)

* Copy Substrate weights into each runtime

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Define weights per runtime

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Do the same for test-runtime

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fix CI

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Generate multiplier tests via macro

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fix tests

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fix CI

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fix imports

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fix test

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fix imports

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Change rococo tests to use ExtrinsicBaseWeight

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fix imports

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Spellcheck on

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Spellcheck on

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Spellcheck

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Re-Export weight constants in the runtime

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Prepare for cumulus companion

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fmt

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
Oliver Tale-Yazdi
2022-03-11 17:36:08 +01:00
committed by GitHub
parent 078bf68037
commit 2b8f6e9d0a
41 changed files with 1490 additions and 218 deletions
+4 -4
View File
@@ -29,9 +29,8 @@ use primitives::v2::{
SessionInfo, Signature, ValidationCode, ValidationCodeHash, ValidatorId, ValidatorIndex,
};
use runtime_common::{
assigned_slots, auctions, crowdloan, impls::ToAuthor, paras_registrar, paras_sudo_wrapper,
slots, BlockHashCount, BlockLength, BlockWeights, CurrencyToVote, OffchainSolutionLengthLimit,
OffchainSolutionWeightLimit, RocksDbWeight, SlowAdjustingFeeUpdate,
assigned_slots, auctions, crowdloan, impl_runtime_weights, impls::ToAuthor, paras_registrar,
paras_sudo_wrapper, slots, CurrencyToVote,
};
use sp_std::{collections::btree_map::BTreeMap, prelude::*};
@@ -49,7 +48,6 @@ use beefy_primitives::crypto::AuthorityId as BeefyId;
use frame_support::{
construct_runtime, parameter_types,
traits::{Contains, InstanceFilter, KeyOwnerProofSystem, OnRuntimeUpgrade},
weights::Weight,
PalletId, RuntimeDebug,
};
use frame_system::EnsureRoot;
@@ -98,6 +96,8 @@ pub mod xcm_config;
#[cfg(test)]
mod tests;
impl_runtime_weights!(westend_runtime_constants);
// Make the WASM binary available.
#[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));