Skip to content

Commit f77ad02

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 417c426 commit f77ad02

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
@@ -23,10 +23,11 @@ use frame_support::{
2323
weights::Weight,
2424
};
2525
use sp_core::H256;
26-
use sp_runtime::{Perbill, traits::{BlakeTwo256, IdentityLookup}, testing::Header};
26+
use sp_runtime::{traits::{BlakeTwo256, IdentityLookup}, testing::Header};
2727
use sp_io;
2828
use crate as sudo;
2929
use frame_support::traits::Filter;
30+
use frame_system::limits;
3031

3132
// Logger module to track execution.
3233
pub mod logger {
@@ -106,9 +107,7 @@ pub struct Test;
106107

107108
parameter_types! {
108109
pub const BlockHashCount: u64 = 250;
109-
pub const MaximumBlockWeight: Weight = 1024;
110-
pub const MaximumBlockLength: u32 = 2 * 1024;
111-
pub const AvailableBlockRatio: Perbill = Perbill::one();
110+
pub BlockWeights: limits::BlockWeights = limits::BlockWeights::simple_max(1024);
112111
}
113112

114113
pub struct BlockEverything;
@@ -120,6 +119,9 @@ impl Filter<Call> for BlockEverything {
120119

121120
impl frame_system::Config for Test {
122121
type BaseCallFilter = BlockEverything;
122+
type BlockWeights = ();
123+
type BlockLength = ();
124+
type DbWeight = ();
123125
type Origin = Origin;
124126
type Call = Call;
125127
type Index = u64;
@@ -131,13 +133,6 @@ impl frame_system::Config for Test {
131133
type Header = Header;
132134
type Event = TestEvent;
133135
type BlockHashCount = BlockHashCount;
134-
type MaximumBlockWeight = MaximumBlockWeight;
135-
type DbWeight = ();
136-
type BlockExecutionWeight = ();
137-
type ExtrinsicBaseWeight = ();
138-
type MaximumExtrinsicWeight = MaximumBlockWeight;
139-
type MaximumBlockLength = MaximumBlockLength;
140-
type AvailableBlockRatio = AvailableBlockRatio;
141136
type Version = ();
142137
type PalletInfo = ();
143138
type AccountData = ();

0 commit comments

Comments
 (0)