Skip to content

Commit 8aec56b

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 2e4d0be commit 8aec56b

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

src/lib.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -812,12 +812,14 @@ mod tests {
812812
pub struct Test;
813813
parameter_types! {
814814
pub const BlockHashCount: u64 = 250;
815-
pub const MaximumBlockWeight: Weight = 2_000_000_000_000;
816-
pub const MaximumBlockLength: u32 = 2 * 1024;
817-
pub const AvailableBlockRatio: Perbill = Perbill::one();
815+
pub BlockWeights: frame_system::limits::BlockWeights =
816+
frame_system::limits::BlockWeights::simple_max(2_000_000_000_000);
818817
}
819818
impl system::Config for Test {
820819
type BaseCallFilter = BaseFilter;
820+
type BlockWeights = ();
821+
type BlockLength = ();
822+
type DbWeight = RocksDbWeight;
821823
type Origin = Origin;
822824
type Call = Call;
823825
type Index = u64;
@@ -829,13 +831,6 @@ mod tests {
829831
type Header = Header;
830832
type Event = ();
831833
type BlockHashCount = BlockHashCount;
832-
type MaximumBlockWeight = MaximumBlockWeight;
833-
type DbWeight = RocksDbWeight;
834-
type BlockExecutionWeight = ();
835-
type ExtrinsicBaseWeight = ();
836-
type MaximumExtrinsicWeight = MaximumBlockWeight;
837-
type MaximumBlockLength = MaximumBlockLength;
838-
type AvailableBlockRatio = AvailableBlockRatio;
839834
type Version = ();
840835
type PalletInfo = ();
841836
type AccountData = ();
@@ -847,7 +842,7 @@ mod tests {
847842
type Event = ();
848843
}
849844
parameter_types! {
850-
pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * MaximumBlockWeight::get();
845+
pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * BlockWeights::get().max_block;
851846
pub const MaxScheduledPerBlock: u32 = 10;
852847
}
853848
ord_parameter_types! {

0 commit comments

Comments
 (0)