Skip to content

Commit c92c6c1

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 bb176bd commit c92c6c1

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

src/mock.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@
2020
#![cfg(test)]
2121

2222
use sp_runtime::testing::Header;
23-
use sp_runtime::Perbill;
2423
use sp_core::H256;
25-
use frame_support::{impl_outer_origin, impl_outer_event, parameter_types, weights::Weight};
24+
use frame_support::{impl_outer_origin, impl_outer_event, parameter_types};
2625
use crate::{self as indices, Module, Config};
2726
use frame_system as system;
2827
use pallet_balances as balances;
@@ -44,13 +43,15 @@ pub struct Test;
4443

4544
parameter_types! {
4645
pub const BlockHashCount: u64 = 250;
47-
pub const MaximumBlockWeight: Weight = 1024;
48-
pub const MaximumBlockLength: u32 = 2 * 1024;
49-
pub const AvailableBlockRatio: Perbill = Perbill::one();
46+
pub BlockWeights: frame_system::limits::BlockWeights =
47+
frame_system::limits::BlockWeights::simple_max(1024);
5048
}
5149

5250
impl frame_system::Config for Test {
5351
type BaseCallFilter = ();
52+
type BlockWeights = ();
53+
type BlockLength = ();
54+
type DbWeight = ();
5455
type Origin = Origin;
5556
type Call = ();
5657
type Index = u64;
@@ -62,13 +63,6 @@ impl frame_system::Config for Test {
6263
type Header = Header;
6364
type Event = MetaEvent;
6465
type BlockHashCount = BlockHashCount;
65-
type MaximumBlockWeight = MaximumBlockWeight;
66-
type DbWeight = ();
67-
type BlockExecutionWeight = ();
68-
type ExtrinsicBaseWeight = ();
69-
type MaximumExtrinsicWeight = MaximumBlockWeight;
70-
type MaximumBlockLength = MaximumBlockLength;
71-
type AvailableBlockRatio = AvailableBlockRatio;
7266
type Version = ();
7367
type PalletInfo = ();
7468
type AccountData = pallet_balances::AccountData<u64>;

0 commit comments

Comments
 (0)