Skip to content

Commit c8886cf

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 6865729 commit c8886cf

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,3 +1134,4 @@ impl<T: Config> Module<T> {
11341134
.collect()
11351135
}
11361136
}
1137+

src/tests.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ use super::*;
2121

2222
use sp_runtime::traits::BadOrigin;
2323
use frame_support::{
24-
assert_ok, assert_noop, impl_outer_origin, parameter_types, weights::Weight,
24+
assert_ok, assert_noop, impl_outer_origin, parameter_types,
2525
ord_parameter_types,
2626
};
2727
use sp_core::H256;
2828
use frame_system::{EnsureSignedBy, EnsureOneOf, EnsureRoot};
2929
use sp_runtime::{
30-
Perbill, testing::Header, traits::{BlakeTwo256, IdentityLookup},
30+
testing::Header, traits::{BlakeTwo256, IdentityLookup},
3131
};
3232

3333
impl_outer_origin! {
@@ -38,12 +38,13 @@ impl_outer_origin! {
3838
pub struct Test;
3939
parameter_types! {
4040
pub const BlockHashCount: u64 = 250;
41-
pub const MaximumBlockWeight: Weight = 1024;
42-
pub const MaximumBlockLength: u32 = 2 * 1024;
43-
pub const AvailableBlockRatio: Perbill = Perbill::one();
41+
pub BlockWeights: frame_system::limits::BlockWeights =
42+
frame_system::limits::BlockWeights::simple_max(1024);
4443
}
4544
impl frame_system::Config for Test {
4645
type BaseCallFilter = ();
46+
type BlockWeights = ();
47+
type BlockLength = ();
4748
type Origin = Origin;
4849
type Index = u64;
4950
type BlockNumber = u64;
@@ -55,13 +56,7 @@ impl frame_system::Config for Test {
5556
type Header = Header;
5657
type Event = ();
5758
type BlockHashCount = BlockHashCount;
58-
type MaximumBlockWeight = MaximumBlockWeight;
5959
type DbWeight = ();
60-
type BlockExecutionWeight = ();
61-
type ExtrinsicBaseWeight = ();
62-
type MaximumExtrinsicWeight = MaximumBlockWeight;
63-
type MaximumBlockLength = MaximumBlockLength;
64-
type AvailableBlockRatio = AvailableBlockRatio;
6560
type Version = ();
6661
type PalletInfo = ();
6762
type AccountData = pallet_balances::AccountData<u64>;

0 commit comments

Comments
 (0)