Skip to content

Commit f89027c

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 a28ff01 commit f89027c

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
@@ -21,12 +21,11 @@ use super::*;
2121

2222
use frame_support::{
2323
impl_outer_origin, impl_outer_dispatch, impl_outer_event, parameter_types,
24-
weights::Weight,
2524
traits::{OnInitialize, OnFinalize},
2625
};
2726
use sp_core::H256;
2827
use sp_runtime::{
29-
Perbill, traits::{BlakeTwo256, IdentityLookup}, testing::Header,
28+
traits::{BlakeTwo256, IdentityLookup}, testing::Header,
3029
};
3130
use crate as recovery;
3231

@@ -53,13 +52,15 @@ pub struct Test;
5352

5453
parameter_types! {
5554
pub const BlockHashCount: u64 = 250;
56-
pub const MaximumBlockWeight: Weight = 1024;
57-
pub const MaximumBlockLength: u32 = 2 * 1024;
58-
pub const AvailableBlockRatio: Perbill = Perbill::one();
55+
pub BlockWeights: frame_system::limits::BlockWeights =
56+
frame_system::limits::BlockWeights::simple_max(1024);
5957
}
6058

6159
impl frame_system::Config for Test {
6260
type BaseCallFilter = ();
61+
type BlockWeights = ();
62+
type BlockLength = ();
63+
type DbWeight = ();
6364
type Origin = Origin;
6465
type Call = Call;
6566
type Index = u64;
@@ -71,13 +72,6 @@ impl frame_system::Config for Test {
7172
type Header = Header;
7273
type Event = TestEvent;
7374
type BlockHashCount = BlockHashCount;
74-
type MaximumBlockWeight = MaximumBlockWeight;
75-
type DbWeight = ();
76-
type BlockExecutionWeight = ();
77-
type ExtrinsicBaseWeight = ();
78-
type MaximumExtrinsicWeight = MaximumBlockWeight;
79-
type MaximumBlockLength = MaximumBlockLength;
80-
type AvailableBlockRatio = AvailableBlockRatio;
8175
type Version = ();
8276
type PalletInfo = ();
8377
type AccountData = pallet_balances::AccountData<u128>;

0 commit comments

Comments
 (0)