Skip to content

Commit 0ac46bf

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 fa0f7bf commit 0ac46bf

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
@@ -279,11 +279,11 @@ mod tests {
279279
use super::*;
280280

281281
use frame_support::{
282-
assert_ok, assert_noop, impl_outer_origin, parameter_types, weights::Weight,
282+
assert_ok, assert_noop, impl_outer_origin, parameter_types,
283283
ord_parameter_types
284284
};
285285
use sp_core::H256;
286-
use sp_runtime::{Perbill, traits::{BlakeTwo256, IdentityLookup, BadOrigin}, testing::Header};
286+
use sp_runtime::{traits::{BlakeTwo256, IdentityLookup, BadOrigin}, testing::Header};
287287
use frame_system::EnsureSignedBy;
288288

289289
impl_outer_origin! {
@@ -294,14 +294,16 @@ mod tests {
294294
pub struct Test;
295295
parameter_types! {
296296
pub const BlockHashCount: u64 = 250;
297-
pub const MaximumBlockWeight: Weight = 1024;
298-
pub const MaximumBlockLength: u32 = 2 * 1024;
299-
pub const AvailableBlockRatio: Perbill = Perbill::one();
297+
pub BlockWeights: frame_system::limits::BlockWeights =
298+
frame_system::limits::BlockWeights::simple_max(1024);
300299
pub static Members: Vec<u64> = vec![];
301300
pub static Prime: Option<u64> = None;
302301
}
303302
impl frame_system::Config for Test {
304303
type BaseCallFilter = ();
304+
type BlockWeights = ();
305+
type BlockLength = ();
306+
type DbWeight = ();
305307
type Origin = Origin;
306308
type Index = u64;
307309
type BlockNumber = u64;
@@ -313,13 +315,6 @@ mod tests {
313315
type Header = Header;
314316
type Event = ();
315317
type BlockHashCount = BlockHashCount;
316-
type MaximumBlockWeight = MaximumBlockWeight;
317-
type DbWeight = ();
318-
type BlockExecutionWeight = ();
319-
type ExtrinsicBaseWeight = ();
320-
type MaximumExtrinsicWeight = MaximumBlockWeight;
321-
type MaximumBlockLength = MaximumBlockLength;
322-
type AvailableBlockRatio = AvailableBlockRatio;
323318
type Version = ();
324319
type PalletInfo = ();
325320
type AccountData = ();

0 commit comments

Comments
 (0)