Skip to content

Commit 77da0d2

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 582f665 commit 77da0d2

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
@@ -292,10 +292,10 @@ impl<T: Config> UnixTime for Module<T> {
292292
mod tests {
293293
use super::*;
294294

295-
use frame_support::{impl_outer_origin, assert_ok, parameter_types, weights::Weight};
295+
use frame_support::{impl_outer_origin, assert_ok, parameter_types};
296296
use sp_io::TestExternalities;
297297
use sp_core::H256;
298-
use sp_runtime::{Perbill, traits::{BlakeTwo256, IdentityLookup}, testing::Header};
298+
use sp_runtime::{traits::{BlakeTwo256, IdentityLookup}, testing::Header};
299299

300300
pub fn new_test_ext() -> TestExternalities {
301301
let t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
@@ -310,12 +310,14 @@ mod tests {
310310
pub struct Test;
311311
parameter_types! {
312312
pub const BlockHashCount: u64 = 250;
313-
pub const MaximumBlockWeight: Weight = 1024;
314-
pub const MaximumBlockLength: u32 = 2 * 1024;
315-
pub const AvailableBlockRatio: Perbill = Perbill::one();
313+
pub BlockWeights: frame_system::limits::BlockWeights =
314+
frame_system::limits::BlockWeights::simple_max(1024);
316315
}
317316
impl frame_system::Config for Test {
318317
type BaseCallFilter = ();
318+
type BlockWeights = ();
319+
type BlockLength = ();
320+
type DbWeight = ();
319321
type Origin = Origin;
320322
type Index = u64;
321323
type BlockNumber = u64;
@@ -327,13 +329,6 @@ mod tests {
327329
type Header = Header;
328330
type Event = ();
329331
type BlockHashCount = BlockHashCount;
330-
type MaximumBlockWeight = MaximumBlockWeight;
331-
type DbWeight = ();
332-
type BlockExecutionWeight = ();
333-
type ExtrinsicBaseWeight = ();
334-
type MaximumExtrinsicWeight = MaximumBlockWeight;
335-
type AvailableBlockRatio = AvailableBlockRatio;
336-
type MaximumBlockLength = MaximumBlockLength;
337332
type Version = ();
338333
type PalletInfo = ();
339334
type AccountData = ();

0 commit comments

Comments
 (0)