mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 06:21:11 +00:00
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>
This commit is contained in:
@@ -1086,7 +1086,7 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Enact a proposal from a referendum. For now we just make the weight be the maximum.
|
||||
#[weight = T::MaximumBlockWeight::get()]
|
||||
#[weight = T::BlockWeights::get().max_block]
|
||||
fn enact_proposal(origin, proposal_hash: T::Hash, index: ReferendumIndex) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Self::do_enact_proposal(proposal_hash, index)
|
||||
@@ -1609,6 +1609,7 @@ impl<T: Config> Module<T> {
|
||||
/// - Db reads per R: `DepositOf`, `ReferendumInfoOf`
|
||||
/// # </weight>
|
||||
fn begin_block(now: T::BlockNumber) -> Result<Weight, DispatchError> {
|
||||
let max_block_weight = T::BlockWeights::get().max_block;
|
||||
let mut weight = 0;
|
||||
|
||||
// pick out another public referendum if it's time.
|
||||
@@ -1616,7 +1617,7 @@ impl<T: Config> Module<T> {
|
||||
// Errors come from the queue being empty. we don't really care about that, and even if
|
||||
// we did, there is nothing we can do here.
|
||||
let _ = Self::launch_next(now);
|
||||
weight = T::MaximumBlockWeight::get();
|
||||
weight = max_block_weight;
|
||||
}
|
||||
|
||||
let next = Self::lowest_unbaked();
|
||||
@@ -1627,7 +1628,7 @@ impl<T: Config> Module<T> {
|
||||
for (index, info) in Self::maturing_referenda_at_inner(now, next..last).into_iter() {
|
||||
let approved = Self::bake_referendum(now, index, info)?;
|
||||
ReferendumInfoOf::<T>::insert(index, ReferendumInfo::Finished { end: now, approved });
|
||||
weight = T::MaximumBlockWeight::get();
|
||||
weight = max_block_weight;
|
||||
}
|
||||
|
||||
Ok(weight)
|
||||
|
||||
Reference in New Issue
Block a user