Skip to content

Commit 37b424a

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 <5588131+kianenigma@users.noreply.github.com> * Rework the API a bit. * Fix compilation & tests. * Apply suggestions from code review Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Add extra docs & rename few things. * Fix whitespace in ASCII art. * Update frame/system/src/limits.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * 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 <5588131+kianenigma@users.noreply.github.com> Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> Co-authored-by: Benjamin Kampmann <ben@gnunicorn.org> Co-authored-by: thiolliere <gui.thiolliere@gmail.com>
1 parent 2b7b19c commit 37b424a

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

src/tests.rs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ use super::*;
2323

2424
use frame_support::{
2525
assert_ok, assert_noop, impl_outer_origin, parameter_types, impl_outer_dispatch,
26-
weights::Weight, impl_outer_event, traits::Filter,
26+
impl_outer_event, traits::Filter,
2727
};
2828
use sp_core::H256;
29-
use sp_runtime::{Perbill, traits::{BlakeTwo256, IdentityLookup}, testing::Header};
29+
use sp_runtime::{traits::{BlakeTwo256, IdentityLookup}, testing::Header};
3030
use crate as multisig;
3131

3232
impl_outer_origin! {
@@ -55,12 +55,14 @@ impl_outer_dispatch! {
5555
pub struct Test;
5656
parameter_types! {
5757
pub const BlockHashCount: u64 = 250;
58-
pub const MaximumBlockWeight: Weight = 1024;
59-
pub const MaximumBlockLength: u32 = 2 * 1024;
60-
pub const AvailableBlockRatio: Perbill = Perbill::one();
58+
pub BlockWeights: frame_system::limits::BlockWeights =
59+
frame_system::limits::BlockWeights::simple_max(1024);
6160
}
6261
impl frame_system::Config for Test {
6362
type BaseCallFilter = TestBaseCallFilter;
63+
type BlockWeights = ();
64+
type BlockLength = ();
65+
type DbWeight = ();
6466
type Origin = Origin;
6567
type Index = u64;
6668
type BlockNumber = u64;
@@ -72,13 +74,6 @@ impl frame_system::Config for Test {
7274
type Header = Header;
7375
type Event = TestEvent;
7476
type BlockHashCount = BlockHashCount;
75-
type MaximumBlockWeight = MaximumBlockWeight;
76-
type DbWeight = ();
77-
type BlockExecutionWeight = ();
78-
type ExtrinsicBaseWeight = ();
79-
type MaximumExtrinsicWeight = MaximumBlockWeight;
80-
type MaximumBlockLength = MaximumBlockLength;
81-
type AvailableBlockRatio = AvailableBlockRatio;
8277
type Version = ();
8378
type PalletInfo = ();
8479
type AccountData = pallet_balances::AccountData<u64>;

0 commit comments

Comments
 (0)