Skip to content

Commit 9ac9884

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 04eda41 commit 9ac9884

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

src/mock.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use sp_staking::{SessionIndex, offence::{ReportOffence, OffenceError}};
2727
use sp_runtime::testing::{Header, UintAuthorityId, TestXt};
2828
use sp_runtime::traits::{IdentityLookup, BlakeTwo256, ConvertInto};
2929
use sp_core::H256;
30-
use frame_support::{impl_outer_origin, impl_outer_dispatch, parameter_types, weights::Weight};
30+
use frame_support::{impl_outer_origin, impl_outer_dispatch, parameter_types};
3131

3232
impl_outer_origin!{
3333
pub enum Origin for Runtime {}
@@ -104,13 +104,15 @@ pub struct Runtime;
104104

105105
parameter_types! {
106106
pub const BlockHashCount: u64 = 250;
107-
pub const MaximumBlockWeight: Weight = 1024;
108-
pub const MaximumBlockLength: u32 = 2 * 1024;
109-
pub const AvailableBlockRatio: Perbill = Perbill::one();
107+
pub BlockWeights: frame_system::limits::BlockWeights =
108+
frame_system::limits::BlockWeights::simple_max(1024);
110109
}
111110

112111
impl frame_system::Config for Runtime {
113112
type BaseCallFilter = ();
113+
type BlockWeights = ();
114+
type BlockLength = ();
115+
type DbWeight = ();
114116
type Origin = Origin;
115117
type Index = u64;
116118
type BlockNumber = u64;
@@ -122,13 +124,6 @@ impl frame_system::Config for Runtime {
122124
type Header = Header;
123125
type Event = ();
124126
type BlockHashCount = BlockHashCount;
125-
type MaximumBlockWeight = MaximumBlockWeight;
126-
type DbWeight = ();
127-
type BlockExecutionWeight = ();
128-
type ExtrinsicBaseWeight = ();
129-
type MaximumExtrinsicWeight = MaximumBlockWeight;
130-
type MaximumBlockLength = MaximumBlockLength;
131-
type AvailableBlockRatio = AvailableBlockRatio;
132127
type Version = ();
133128
type PalletInfo = ();
134129
type AccountData = ();

0 commit comments

Comments
 (0)