mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 20:31:13 +00:00
Introduce BlockExecutionWeight and ExtrinsicBaseWeight (#5722)
* Introduce `BlockExectionWeight` and `ExtrinsicBaseWeight` * Add new traits everywhere * Missed one update * fix tests * Update `check_weight` logic * introduce `max_extrinsic_weight` function * fix + add tests * format nits * remove println * make test a bit more clear * Remove minimum weight * newlines left over from find/replace * Fix test, improve clarity * Fix executor tests * Extrinsic base weight same as old `MINIMUM_WEIGHT` * fix example test * Expose constants * Add test for full block with operational and normal * Initiate test environment with `BlockExecutionWeight` weight * format nit * Update frame/system/src/lib.rs Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Replace `TransactionBaseFee` with `ExtrinsicBaseWeight` (#5761) * Replace `TransactionBaseFee` with `ExtrinsicBaseFee` * Fix stuff * Fix and make tests better * Forgot to update this test * Fix priority number in test * Remove minimum weight from merge * Fix weight in contracts * remove `TransactionBaseFee` from contract tests * Let `register_extra_weight_unchecked` go past `MaximumBlockWeight` * address feedback Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
@@ -150,7 +150,6 @@
|
||||
//!
|
||||
//! ```
|
||||
//! use frame_support::{decl_module, dispatch};
|
||||
//! use frame_support::weights::MINIMUM_WEIGHT;
|
||||
//! use frame_system::{self as system, ensure_signed};
|
||||
//! use pallet_staking::{self as staking};
|
||||
//!
|
||||
@@ -159,7 +158,7 @@
|
||||
//! decl_module! {
|
||||
//! pub struct Module<T: Trait> for enum Call where origin: T::Origin {
|
||||
//! /// Reward a validator.
|
||||
//! #[weight = MINIMUM_WEIGHT]
|
||||
//! #[weight = 0]
|
||||
//! pub fn reward_myself(origin) -> dispatch::DispatchResult {
|
||||
//! let reported = ensure_signed(origin)?;
|
||||
//! <staking::Module<T>>::reward_by_ids(vec![(reported, 10)]);
|
||||
@@ -291,7 +290,7 @@ use sp_std::{
|
||||
use codec::{HasCompact, Encode, Decode};
|
||||
use frame_support::{
|
||||
decl_module, decl_event, decl_storage, ensure, decl_error, debug,
|
||||
weights::{MINIMUM_WEIGHT, Weight, DispatchClass},
|
||||
weights::{Weight, DispatchClass},
|
||||
storage::IterableStorageMap,
|
||||
dispatch::{IsSubType, DispatchResult},
|
||||
traits::{
|
||||
@@ -1623,7 +1622,7 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Force a current staker to become completely unstaked, immediately.
|
||||
#[weight = MINIMUM_WEIGHT]
|
||||
#[weight = 0]
|
||||
fn force_unstake(origin, stash: T::AccountId) {
|
||||
ensure_root(origin)?;
|
||||
|
||||
@@ -1803,7 +1802,7 @@ decl_module! {
|
||||
/// This can be called from any origin.
|
||||
///
|
||||
/// - `stash`: The stash account to reap. Its balance must be zero.
|
||||
#[weight = MINIMUM_WEIGHT]
|
||||
#[weight = 0]
|
||||
fn reap_stash(_origin, stash: T::AccountId) {
|
||||
ensure!(T::Currency::total_balance(&stash).is_zero(), Error::<T>::FundedTarget);
|
||||
Self::kill_stash(&stash)?;
|
||||
|
||||
@@ -204,6 +204,8 @@ impl frame_system::Trait for Test {
|
||||
type BlockHashCount = BlockHashCount;
|
||||
type MaximumBlockWeight = MaximumBlockWeight;
|
||||
type DbWeight = ();
|
||||
type BlockExecutionWeight = ();
|
||||
type ExtrinsicBaseWeight = ();
|
||||
type AvailableBlockRatio = AvailableBlockRatio;
|
||||
type MaximumBlockLength = MaximumBlockLength;
|
||||
type Version = ();
|
||||
|
||||
Reference in New Issue
Block a user