Skip to content

Commit 7686c0b

Browse files
tomusdrwkianenigmashawntabrizignunicorngui1117
authored
Streamline frame_system weight parametrization (#6629)
* Basic weights builder. * Fixing WiP * Make the tests work. * Fix weights in node/runtime. * WiP. * Update pallets with new weights parameters. * Validate returns a Result now. * Count mandatory weight separately. * DRY * BREAKING: Updating state root, because of the left-over weight-tracking stuff * Update tests affected by Mandatory tracking. * Fixing tests. * Fix defaults for simple_max * Update frame/system/src/weights.rs Co-authored-by: Kian Paimani <[email protected]> * Rework the API a bit. * Fix compilation & tests. * Apply suggestions from code review Co-authored-by: Kian Paimani <[email protected]> * Add extra docs & rename few things. * Fix whitespace in ASCII art. * Update frame/system/src/limits.rs Co-authored-by: Kian Paimani <[email protected]> * Fix max_extrinsic calculations. * Fix conflicts. * Fix compilation. * Fix new code. * re-remove generic asset * Fix usage. * Update state root. * Update proxy. * Fix tests. * Move weights validity to integrity_test * Remove redundant BlockWeights. * Add all/non_mandatory comment * Add test. * Remove fn block_weights * Make the macro prettier. * Fix some docs. * Make max_total behave more predictabily. * Add BlockWeights to metadata. * fix balances test * Fix utility test. Co-authored-by: Kian Paimani <[email protected]> Co-authored-by: Shawn Tabrizi <[email protected]> Co-authored-by: Benjamin Kampmann <[email protected]> Co-authored-by: thiolliere <[email protected]>
1 parent ee0d51d commit 7686c0b

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

src/lib.rs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -241,13 +241,13 @@ mod tests {
241241
use super::*;
242242

243243
use frame_support::{
244-
assert_ok, assert_noop, impl_outer_origin, parameter_types, weights::Weight,
244+
assert_ok, assert_noop, impl_outer_origin, parameter_types,
245245
ord_parameter_types
246246
};
247247
use sp_core::H256;
248248
use frame_system::EnsureSignedBy;
249249
use sp_runtime::{
250-
Perbill, testing::Header, traits::{BlakeTwo256, IdentityLookup, BadOrigin},
250+
testing::Header, traits::{BlakeTwo256, IdentityLookup, BadOrigin},
251251
};
252252

253253
impl_outer_origin! {
@@ -258,12 +258,14 @@ mod tests {
258258
pub struct Test;
259259
parameter_types! {
260260
pub const BlockHashCount: u64 = 250;
261-
pub const MaximumBlockWeight: Weight = 1024;
262-
pub const MaximumBlockLength: u32 = 2 * 1024;
263-
pub const AvailableBlockRatio: Perbill = Perbill::one();
261+
pub BlockWeights: frame_system::limits::BlockWeights =
262+
frame_system::limits::BlockWeights::simple_max(1024);
264263
}
265264
impl frame_system::Config for Test {
266265
type BaseCallFilter = ();
266+
type BlockWeights = ();
267+
type BlockLength = ();
268+
type DbWeight = ();
267269
type Origin = Origin;
268270
type Index = u64;
269271
type BlockNumber = u64;
@@ -275,13 +277,6 @@ mod tests {
275277
type Header = Header;
276278
type Event = ();
277279
type BlockHashCount = BlockHashCount;
278-
type MaximumBlockWeight = MaximumBlockWeight;
279-
type DbWeight = ();
280-
type BlockExecutionWeight = ();
281-
type ExtrinsicBaseWeight = ();
282-
type MaximumExtrinsicWeight = MaximumBlockWeight;
283-
type MaximumBlockLength = MaximumBlockLength;
284-
type AvailableBlockRatio = AvailableBlockRatio;
285280
type Version = ();
286281
type PalletInfo = ();
287282
type AccountData = pallet_balances::AccountData<u64>;

0 commit comments

Comments
 (0)