[frame] #[pallet::composite_enum] improved variant count handling + removed pallet_balances's MaxHolds config (#2657)

I started this investigation/issue based on @liamaharon question
[here](https://github.com/paritytech/polkadot-sdk/pull/1801#discussion_r1410452499).

## Problem

The `pallet_balances` integrity test should correctly detect that the
runtime has correct distinct `HoldReasons` variant count. I assume the
same situation exists for RuntimeFreezeReason.

It is not a critical problem, if we set `MaxHolds` with a sufficiently
large value, everything should be ok. However, in this case, the
integrity_test check becomes less useful.

**Situation for "any" runtime:**
- `HoldReason` enums from different pallets:
```rust
        /// from pallet_nis
        #[pallet::composite_enum]
	pub enum HoldReason {
		NftReceipt,
	}

        /// from pallet_preimage
        #[pallet::composite_enum]
	pub enum HoldReason {
		Preimage,
	}

        // from pallet_state-trie-migration
        #[pallet::composite_enum]
	pub enum HoldReason {
		SlashForContinueMigrate,
		SlashForMigrateCustomTop,
		SlashForMigrateCustomChild,
	}
```

- generated `RuntimeHoldReason` enum looks like:
```rust
pub enum RuntimeHoldReason {

    #[codec(index = 32u8)]
    Preimage(pallet_preimage::HoldReason),

    #[codec(index = 38u8)]
    Nis(pallet_nis::HoldReason),

    #[codec(index = 42u8)]
    StateTrieMigration(pallet_state_trie_migration::HoldReason),
}
```

- composite enum `RuntimeHoldReason` variant count is detected as `3`
- we set `type MaxHolds = ConstU32<3>`
- `pallet_balances::integrity_test` is ok with `3`(at least 3)

However, the real problem can occur in a live runtime where some
functionality might stop working. This is due to a total of 5 distinct
hold reasons (for pallets with multi-instance support, it is even more),
and not all of them can be used because of an incorrect `MaxHolds`,
which is deemed acceptable according to the `integrity_test`:
  ```
  // pseudo-code - if we try to call all of these:

T::Currency::hold(&pallet_nis::HoldReason::NftReceipt.into(),
&nft_owner, deposit)?;
T::Currency::hold(&pallet_preimage::HoldReason::Preimage.into(),
&nft_owner, deposit)?;

T::Currency::hold(&pallet_state_trie_migration::HoldReason::SlashForContinueMigrate.into(),
&nft_owner, deposit)?;

  // With `type MaxHolds = ConstU32<3>` these two will fail

T::Currency::hold(&pallet_state_trie_migration::HoldReason::SlashForMigrateCustomTop.into(),
&nft_owner, deposit)?;

T::Currency::hold(&pallet_state_trie_migration::HoldReason::SlashForMigrateCustomChild.into(),
&nft_owner, deposit)?;
  ```  


## Solutions

A macro `#[pallet::*]` expansion is extended of `VariantCount`
implementation for the `#[pallet::composite_enum]` enum type. This
expansion generates the `VariantCount` implementation for pallets'
`HoldReason`, `FreezeReason`, `LockId`, and `SlashReason`. Enum variants
must be plain enum values without fields to ensure a deterministic
count.

The composite runtime enum, `RuntimeHoldReason` and
`RuntimeFreezeReason`, now sets `VariantCount::VARIANT_COUNT` as the sum
of pallets' enum `VariantCount::VARIANT_COUNT`:
```rust
#[frame_support::pallet(dev_mode)]
mod module_single_instance {

	#[pallet::composite_enum]
	pub enum HoldReason {
		ModuleSingleInstanceReason1,
		ModuleSingleInstanceReason2,
	}
...
}

#[frame_support::pallet(dev_mode)]
mod module_multi_instance {

	#[pallet::composite_enum]
	pub enum HoldReason<I: 'static = ()> {
		ModuleMultiInstanceReason1,
		ModuleMultiInstanceReason2,
		ModuleMultiInstanceReason3,
	}
...
}


impl self::sp_api_hidden_includes_construct_runtime::hidden_include::traits::VariantCount
    for RuntimeHoldReason
{
    const VARIANT_COUNT: u32 = 0
        + module_single_instance::HoldReason::VARIANT_COUNT
        + module_multi_instance::HoldReason::<module_multi_instance::Instance1>::VARIANT_COUNT
        + module_multi_instance::HoldReason::<module_multi_instance::Instance2>::VARIANT_COUNT
        + module_multi_instance::HoldReason::<module_multi_instance::Instance3>::VARIANT_COUNT;
}
```

In addition, `MaxHolds` is removed (as suggested
[here](https://github.com/paritytech/polkadot-sdk/pull/2657#discussion_r1443324573))
from `pallet_balances`, and its `Holds` are now bounded to
`RuntimeHoldReason::VARIANT_COUNT`. Therefore, there is no need to let
the runtime specify `MaxHolds`.


## For reviewers

Relevant changes can be found here:
- `substrate/frame/support/procedural/src/lib.rs` 
-  `substrate/frame/support/procedural/src/pallet/parse/composite.rs`
-  `substrate/frame/support/procedural/src/pallet/expand/composite.rs`
-
`substrate/frame/support/procedural/src/construct_runtime/expand/composite_helper.rs`
-
`substrate/frame/support/procedural/src/construct_runtime/expand/hold_reason.rs`
-
`substrate/frame/support/procedural/src/construct_runtime/expand/freeze_reason.rs`
- `substrate/frame/support/src/traits/misc.rs`

And the rest of the files is just about removed `MaxHolds` from
`pallet_balances`

## Next steps

Do the same for `MaxFreezes`
https://github.com/paritytech/polkadot-sdk/issues/2997.

---------

Co-authored-by: command-bot <>
Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: Dónal Murray <donal.murray@parity.io>
Co-authored-by: gupnik <nikhilgupta.iitk@gmail.com>
This commit is contained in:
Branislav Kontur
2024-01-31 07:19:16 +01:00
committed by GitHub
parent cc4805b51e
commit bb8ddc46c1
118 changed files with 610 additions and 315 deletions
@@ -88,7 +88,6 @@ impl pallet_balances::Config for Test {
type MaxFreezes = ();
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ();
}
parameter_types! {
@@ -136,7 +136,6 @@ impl pallet_balances::Config for Test {
type MaxFreezes = ();
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ();
}
impl pallet_xcm_origin::Config for Test {
@@ -95,7 +95,6 @@ impl pallet_balances::Config for Test {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}
-1
View File
@@ -106,7 +106,6 @@ impl pallet_balances::Config for Test {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}
@@ -337,7 +337,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}
-1
View File
@@ -257,7 +257,6 @@ mod tests {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>;
}
@@ -241,10 +241,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
// We allow each account to have holds on it from:
// - `NftFractionalization`: 1
// - `StateTrieMigration`: 1
type MaxHolds = ConstU32<2>;
type MaxFreezes = ConstU32<0>;
}
@@ -16,10 +16,10 @@
//! Autogenerated weights for `pallet_balances`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2024-01-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2024-01-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-j8vvqcjr-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! HOSTNAME: `runner-8idpd4bs-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-rococo-dev")`, DB CACHE: 1024
// Executed Command:
@@ -54,8 +54,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 45_402_000 picoseconds.
Weight::from_parts(46_086_000, 0)
// Minimum execution time: 42_706_000 picoseconds.
Weight::from_parts(43_378_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -66,8 +66,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 35_707_000 picoseconds.
Weight::from_parts(36_107_000, 0)
// Minimum execution time: 33_090_000 picoseconds.
Weight::from_parts(33_703_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -78,8 +78,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `103`
// Estimated: `3593`
// Minimum execution time: 13_538_000 picoseconds.
Weight::from_parts(13_771_000, 0)
// Minimum execution time: 12_678_000 picoseconds.
Weight::from_parts(13_068_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -90,8 +90,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `103`
// Estimated: `3593`
// Minimum execution time: 18_488_000 picoseconds.
Weight::from_parts(19_136_000, 0)
// Minimum execution time: 17_336_000 picoseconds.
Weight::from_parts(17_824_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -102,8 +102,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `103`
// Estimated: `6196`
// Minimum execution time: 48_168_000 picoseconds.
Weight::from_parts(48_874_000, 0)
// Minimum execution time: 44_817_000 picoseconds.
Weight::from_parts(45_453_000, 0)
.saturating_add(Weight::from_parts(0, 6196))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
@@ -114,8 +114,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 44_463_000 picoseconds.
Weight::from_parts(45_320_000, 0)
// Minimum execution time: 41_468_000 picoseconds.
Weight::from_parts(42_093_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -126,8 +126,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `103`
// Estimated: `3593`
// Minimum execution time: 16_227_000 picoseconds.
Weight::from_parts(16_549_000, 0)
// Minimum execution time: 15_344_000 picoseconds.
Weight::from_parts(15_878_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -139,11 +139,11 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0 + u * (136 ±0)`
// Estimated: `990 + u * (2603 ±0)`
// Minimum execution time: 15_992_000 picoseconds.
Weight::from_parts(16_243_000, 0)
// Minimum execution time: 15_067_000 picoseconds.
Weight::from_parts(15_281_000, 0)
.saturating_add(Weight::from_parts(0, 990))
// Standard Error: 12_426
.saturating_add(Weight::from_parts(13_617_673, 0).saturating_mul(u.into()))
// Standard Error: 11_009
.saturating_add(Weight::from_parts(13_050_024, 0).saturating_mul(u.into()))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(u.into())))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(u.into())))
.saturating_add(Weight::from_parts(0, 2603).saturating_mul(u.into()))
@@ -154,8 +154,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `1501`
// Minimum execution time: 5_713_000 picoseconds.
Weight::from_parts(6_054_000, 0)
// Minimum execution time: 5_139_000 picoseconds.
Weight::from_parts(5_511_000, 0)
.saturating_add(Weight::from_parts(0, 1501))
.saturating_add(T::DbWeight::get().reads(1))
}
@@ -199,9 +199,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
// We allow each account to have holds on it from:
// - `NftFractionalization`: 1
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<0>;
}
@@ -16,10 +16,10 @@
//! Autogenerated weights for `pallet_balances`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2024-01-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2024-01-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-j8vvqcjr-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! HOSTNAME: `runner-8idpd4bs-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-westend-dev")`, DB CACHE: 1024
// Executed Command:
@@ -54,8 +54,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 42_658_000 picoseconds.
Weight::from_parts(43_649_000, 0)
// Minimum execution time: 43_122_000 picoseconds.
Weight::from_parts(43_640_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -66,8 +66,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 33_810_000 picoseconds.
Weight::from_parts(34_322_000, 0)
// Minimum execution time: 33_636_000 picoseconds.
Weight::from_parts(34_571_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -78,8 +78,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `103`
// Estimated: `3593`
// Minimum execution time: 11_825_000 picoseconds.
Weight::from_parts(12_258_000, 0)
// Minimum execution time: 12_101_000 picoseconds.
Weight::from_parts(12_511_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -90,8 +90,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `103`
// Estimated: `3593`
// Minimum execution time: 16_540_000 picoseconds.
Weight::from_parts(17_058_000, 0)
// Minimum execution time: 17_077_000 picoseconds.
Weight::from_parts(17_362_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -102,8 +102,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `103`
// Estimated: `6196`
// Minimum execution time: 45_138_000 picoseconds.
Weight::from_parts(45_481_000, 0)
// Minimum execution time: 44_352_000 picoseconds.
Weight::from_parts(45_045_000, 0)
.saturating_add(Weight::from_parts(0, 6196))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
@@ -114,8 +114,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 42_147_000 picoseconds.
Weight::from_parts(43_120_000, 0)
// Minimum execution time: 41_836_000 picoseconds.
Weight::from_parts(43_201_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -126,8 +126,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `103`
// Estimated: `3593`
// Minimum execution time: 14_730_000 picoseconds.
Weight::from_parts(14_867_000, 0)
// Minimum execution time: 14_413_000 picoseconds.
Weight::from_parts(14_743_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -139,11 +139,11 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0 + u * (136 ±0)`
// Estimated: `990 + u * (2603 ±0)`
// Minimum execution time: 14_425_000 picoseconds.
Weight::from_parts(14_590_000, 0)
// Minimum execution time: 14_542_000 picoseconds.
Weight::from_parts(14_731_000, 0)
.saturating_add(Weight::from_parts(0, 990))
// Standard Error: 12_643
.saturating_add(Weight::from_parts(13_203_227, 0).saturating_mul(u.into()))
// Standard Error: 11_213
.saturating_add(Weight::from_parts(13_160_721, 0).saturating_mul(u.into()))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(u.into())))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(u.into())))
.saturating_add(Weight::from_parts(0, 2603).saturating_mul(u.into()))
@@ -154,8 +154,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `1501`
// Minimum execution time: 5_397_000 picoseconds.
Weight::from_parts(5_689_000, 0)
// Minimum execution time: 5_208_000 picoseconds.
Weight::from_parts(5_619_000, 0)
.saturating_add(Weight::from_parts(0, 1501))
.saturating_add(T::DbWeight::get().reads(1))
}
@@ -307,7 +307,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}
@@ -16,10 +16,10 @@
//! Autogenerated weights for `pallet_balances`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2024-01-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2024-01-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-j8vvqcjr-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! HOSTNAME: `runner-8idpd4bs-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("bridge-hub-rococo-dev")`, DB CACHE: 1024
// Executed Command:
@@ -54,8 +54,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 43_019_000 picoseconds.
Weight::from_parts(43_897_000, 0)
// Minimum execution time: 41_696_000 picoseconds.
Weight::from_parts(42_201_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -66,8 +66,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 33_615_000 picoseconds.
Weight::from_parts(34_331_000, 0)
// Minimum execution time: 32_855_000 picoseconds.
Weight::from_parts(33_554_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -78,8 +78,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `174`
// Estimated: `3593`
// Minimum execution time: 12_917_000 picoseconds.
Weight::from_parts(13_310_000, 0)
// Minimum execution time: 12_977_000 picoseconds.
Weight::from_parts(13_473_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -91,7 +91,7 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Measured: `174`
// Estimated: `3593`
// Minimum execution time: 17_617_000 picoseconds.
Weight::from_parts(18_057_000, 0)
Weight::from_parts(18_234_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -102,8 +102,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `103`
// Estimated: `6196`
// Minimum execution time: 44_458_000 picoseconds.
Weight::from_parts(45_097_000, 0)
// Minimum execution time: 43_174_000 picoseconds.
Weight::from_parts(43_685_000, 0)
.saturating_add(Weight::from_parts(0, 6196))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
@@ -114,8 +114,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 42_431_000 picoseconds.
Weight::from_parts(42_910_000, 0)
// Minimum execution time: 41_125_000 picoseconds.
Weight::from_parts(41_636_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -126,8 +126,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `174`
// Estimated: `3593`
// Minimum execution time: 15_726_000 picoseconds.
Weight::from_parts(16_245_000, 0)
// Minimum execution time: 15_749_000 picoseconds.
Weight::from_parts(16_163_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -139,11 +139,11 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0 + u * (136 ±0)`
// Estimated: `990 + u * (2603 ±0)`
// Minimum execution time: 13_929_000 picoseconds.
Weight::from_parts(14_306_000, 0)
// Minimum execution time: 14_238_000 picoseconds.
Weight::from_parts(14_469_000, 0)
.saturating_add(Weight::from_parts(0, 990))
// Standard Error: 10_984
.saturating_add(Weight::from_parts(12_919_627, 0).saturating_mul(u.into()))
// Standard Error: 11_818
.saturating_add(Weight::from_parts(12_621_051, 0).saturating_mul(u.into()))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(u.into())))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(u.into())))
.saturating_add(Weight::from_parts(0, 2603).saturating_mul(u.into()))
@@ -154,8 +154,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `1501`
// Minimum execution time: 5_132_000 picoseconds.
Weight::from_parts(5_467_000, 0)
// Minimum execution time: 4_904_000 picoseconds.
Weight::from_parts(5_459_000, 0)
.saturating_add(Weight::from_parts(0, 1501))
.saturating_add(T::DbWeight::get().reads(1))
}
@@ -279,7 +279,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}
@@ -16,10 +16,10 @@
//! Autogenerated weights for `pallet_balances`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2024-01-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2024-01-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-j8vvqcjr-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! HOSTNAME: `runner-8idpd4bs-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("bridge-hub-westend-dev")`, DB CACHE: 1024
// Executed Command:
@@ -54,8 +54,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 43_103_000 picoseconds.
Weight::from_parts(43_576_000, 0)
// Minimum execution time: 42_912_000 picoseconds.
Weight::from_parts(43_690_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -66,8 +66,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 33_412_000 picoseconds.
Weight::from_parts(33_984_000, 0)
// Minimum execution time: 33_823_000 picoseconds.
Weight::from_parts(34_415_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -78,8 +78,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `174`
// Estimated: `3593`
// Minimum execution time: 13_412_000 picoseconds.
Weight::from_parts(13_907_000, 0)
// Minimum execution time: 13_226_000 picoseconds.
Weight::from_parts(13_557_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -90,8 +90,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `174`
// Estimated: `3593`
// Minimum execution time: 18_143_000 picoseconds.
Weight::from_parts(18_756_000, 0)
// Minimum execution time: 18_055_000 picoseconds.
Weight::from_parts(18_407_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -102,8 +102,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `103`
// Estimated: `6196`
// Minimum execution time: 43_676_000 picoseconds.
Weight::from_parts(44_575_000, 0)
// Minimum execution time: 44_442_000 picoseconds.
Weight::from_parts(45_101_000, 0)
.saturating_add(Weight::from_parts(0, 6196))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
@@ -114,8 +114,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 41_403_000 picoseconds.
Weight::from_parts(42_162_000, 0)
// Minimum execution time: 42_485_000 picoseconds.
Weight::from_parts(43_157_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -126,8 +126,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `174`
// Estimated: `3593`
// Minimum execution time: 15_791_000 picoseconds.
Weight::from_parts(16_298_000, 0)
// Minimum execution time: 16_002_000 picoseconds.
Weight::from_parts(16_425_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -139,11 +139,11 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0 + u * (136 ±0)`
// Estimated: `990 + u * (2603 ±0)`
// Minimum execution time: 14_390_000 picoseconds.
Weight::from_parts(14_611_000, 0)
// Minimum execution time: 14_526_000 picoseconds.
Weight::from_parts(14_825_000, 0)
.saturating_add(Weight::from_parts(0, 990))
// Standard Error: 11_611
.saturating_add(Weight::from_parts(12_871_155, 0).saturating_mul(u.into()))
// Standard Error: 10_967
.saturating_add(Weight::from_parts(13_376_293, 0).saturating_mul(u.into()))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(u.into())))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(u.into())))
.saturating_add(Weight::from_parts(0, 2603).saturating_mul(u.into()))
@@ -154,8 +154,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `1501`
// Minimum execution time: 5_314_000 picoseconds.
Weight::from_parts(5_638_000, 0)
// Minimum execution time: 5_151_000 picoseconds.
Weight::from_parts(5_419_000, 0)
.saturating_add(Weight::from_parts(0, 1501))
.saturating_add(T::DbWeight::get().reads(1))
}
@@ -213,7 +213,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<0>;
}
@@ -16,10 +16,10 @@
//! Autogenerated weights for `pallet_balances`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2024-01-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2024-01-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-j8vvqcjr-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! HOSTNAME: `runner-8idpd4bs-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("collectives-westend-dev")`, DB CACHE: 1024
// Executed Command:
@@ -54,8 +54,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 44_910_000 picoseconds.
Weight::from_parts(45_866_000, 0)
// Minimum execution time: 45_085_000 picoseconds.
Weight::from_parts(45_772_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -66,8 +66,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 35_331_000 picoseconds.
Weight::from_parts(36_168_000, 0)
// Minimum execution time: 35_447_000 picoseconds.
Weight::from_parts(36_143_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -78,8 +78,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `103`
// Estimated: `3593`
// Minimum execution time: 12_540_000 picoseconds.
Weight::from_parts(12_942_000, 0)
// Minimum execution time: 12_314_000 picoseconds.
Weight::from_parts(12_679_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -90,8 +90,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `103`
// Estimated: `3593`
// Minimum execution time: 17_385_000 picoseconds.
Weight::from_parts(17_926_000, 0)
// Minimum execution time: 17_455_000 picoseconds.
Weight::from_parts(17_902_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -102,8 +102,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `103`
// Estimated: `6196`
// Minimum execution time: 47_232_000 picoseconds.
Weight::from_parts(47_740_000, 0)
// Minimum execution time: 46_785_000 picoseconds.
Weight::from_parts(47_436_000, 0)
.saturating_add(Weight::from_parts(0, 6196))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
@@ -114,8 +114,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 44_311_000 picoseconds.
Weight::from_parts(45_264_000, 0)
// Minimum execution time: 43_948_000 picoseconds.
Weight::from_parts(44_680_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -126,8 +126,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `103`
// Estimated: `3593`
// Minimum execution time: 15_430_000 picoseconds.
Weight::from_parts(15_654_000, 0)
// Minimum execution time: 15_267_000 picoseconds.
Weight::from_parts(15_499_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -139,11 +139,11 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0 + u * (136 ±0)`
// Estimated: `990 + u * (2603 ±0)`
// Minimum execution time: 14_919_000 picoseconds.
Weight::from_parts(15_212_000, 0)
// Minimum execution time: 14_817_000 picoseconds.
Weight::from_parts(15_287_000, 0)
.saturating_add(Weight::from_parts(0, 990))
// Standard Error: 17_333
.saturating_add(Weight::from_parts(13_966_554, 0).saturating_mul(u.into()))
// Standard Error: 11_738
.saturating_add(Weight::from_parts(13_511_800, 0).saturating_mul(u.into()))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(u.into())))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(u.into())))
.saturating_add(Weight::from_parts(0, 2603).saturating_mul(u.into()))
@@ -154,8 +154,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `1501`
// Minimum execution time: 5_438_000 picoseconds.
Weight::from_parts(5_736_000, 0)
// Minimum execution time: 5_382_000 picoseconds.
Weight::from_parts(5_768_000, 0)
.saturating_add(Weight::from_parts(0, 1501))
.saturating_add(T::DbWeight::get().reads(1))
}
@@ -216,7 +216,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<0>;
}
@@ -228,7 +228,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}
@@ -16,10 +16,10 @@
//! Autogenerated weights for `pallet_balances`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2024-01-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2024-01-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-j8vvqcjr-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! HOSTNAME: `runner-8idpd4bs-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("coretime-rococo-dev")`, DB CACHE: 1024
// Executed Command:
@@ -54,8 +54,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 42_729_000 picoseconds.
Weight::from_parts(43_214_000, 0)
// Minimum execution time: 41_557_000 picoseconds.
Weight::from_parts(42_618_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -66,8 +66,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 33_717_000 picoseconds.
Weight::from_parts(34_160_000, 0)
// Minimum execution time: 33_046_000 picoseconds.
Weight::from_parts(33_550_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -78,8 +78,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `103`
// Estimated: `3593`
// Minimum execution time: 11_581_000 picoseconds.
Weight::from_parts(11_822_000, 0)
// Minimum execution time: 11_804_000 picoseconds.
Weight::from_parts(12_007_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -90,8 +90,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `103`
// Estimated: `3593`
// Minimum execution time: 16_235_000 picoseconds.
Weight::from_parts(16_797_000, 0)
// Minimum execution time: 16_261_000 picoseconds.
Weight::from_parts(16_655_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -102,8 +102,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `103`
// Estimated: `6196`
// Minimum execution time: 43_581_000 picoseconds.
Weight::from_parts(44_465_000, 0)
// Minimum execution time: 42_967_000 picoseconds.
Weight::from_parts(43_870_000, 0)
.saturating_add(Weight::from_parts(0, 6196))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
@@ -114,8 +114,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 42_289_000 picoseconds.
Weight::from_parts(42_861_000, 0)
// Minimum execution time: 41_022_000 picoseconds.
Weight::from_parts(41_475_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -126,8 +126,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `103`
// Estimated: `3593`
// Minimum execution time: 14_583_000 picoseconds.
Weight::from_parts(15_088_000, 0)
// Minimum execution time: 14_339_000 picoseconds.
Weight::from_parts(14_641_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -139,11 +139,11 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0 + u * (136 ±0)`
// Estimated: `990 + u * (2603 ±0)`
// Minimum execution time: 14_263_000 picoseconds.
Weight::from_parts(14_431_000, 0)
// Minimum execution time: 14_241_000 picoseconds.
Weight::from_parts(14_463_000, 0)
.saturating_add(Weight::from_parts(0, 990))
// Standard Error: 11_589
.saturating_add(Weight::from_parts(13_005_092, 0).saturating_mul(u.into()))
// Standard Error: 12_290
.saturating_add(Weight::from_parts(12_903_900, 0).saturating_mul(u.into()))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(u.into())))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(u.into())))
.saturating_add(Weight::from_parts(0, 2603).saturating_mul(u.into()))
@@ -154,8 +154,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `1501`
// Minimum execution time: 5_091_000 picoseconds.
Weight::from_parts(5_272_000, 0)
// Minimum execution time: 5_116_000 picoseconds.
Weight::from_parts(5_345_000, 0)
.saturating_add(Weight::from_parts(0, 1501))
.saturating_add(T::DbWeight::get().reads(1))
}
@@ -219,7 +219,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}
@@ -16,10 +16,10 @@
//! Autogenerated weights for `pallet_balances`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2024-01-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2024-01-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-j8vvqcjr-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! HOSTNAME: `runner-8idpd4bs-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("coretime-westend-dev")`, DB CACHE: 1024
// Executed Command:
@@ -54,8 +54,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 42_533_000 picoseconds.
Weight::from_parts(43_470_000, 0)
// Minimum execution time: 41_147_000 picoseconds.
Weight::from_parts(41_829_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -66,8 +66,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 33_442_000 picoseconds.
Weight::from_parts(34_851_000, 0)
// Minimum execution time: 32_566_000 picoseconds.
Weight::from_parts(33_012_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -78,8 +78,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `103`
// Estimated: `3593`
// Minimum execution time: 11_890_000 picoseconds.
Weight::from_parts(12_324_000, 0)
// Minimum execution time: 11_435_000 picoseconds.
Weight::from_parts(11_717_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -90,8 +90,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `103`
// Estimated: `3593`
// Minimum execution time: 16_583_000 picoseconds.
Weight::from_parts(17_116_000, 0)
// Minimum execution time: 15_941_000 picoseconds.
Weight::from_parts(16_341_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -102,8 +102,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `103`
// Estimated: `6196`
// Minimum execution time: 43_979_000 picoseconds.
Weight::from_parts(44_662_000, 0)
// Minimum execution time: 42_592_000 picoseconds.
Weight::from_parts(43_111_000, 0)
.saturating_add(Weight::from_parts(0, 6196))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
@@ -114,8 +114,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 43_140_000 picoseconds.
Weight::from_parts(43_575_000, 0)
// Minimum execution time: 40_925_000 picoseconds.
Weight::from_parts(41_743_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -126,8 +126,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `103`
// Estimated: `3593`
// Minimum execution time: 14_748_000 picoseconds.
Weight::from_parts(15_097_000, 0)
// Minimum execution time: 14_117_000 picoseconds.
Weight::from_parts(14_418_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -139,11 +139,11 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0 + u * (136 ±0)`
// Estimated: `990 + u * (2603 ±0)`
// Minimum execution time: 14_502_000 picoseconds.
Weight::from_parts(14_803_000, 0)
// Minimum execution time: 13_855_000 picoseconds.
Weight::from_parts(14_108_000, 0)
.saturating_add(Weight::from_parts(0, 990))
// Standard Error: 11_903
.saturating_add(Weight::from_parts(13_484_935, 0).saturating_mul(u.into()))
// Standard Error: 11_673
.saturating_add(Weight::from_parts(12_675_264, 0).saturating_mul(u.into()))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(u.into())))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(u.into())))
.saturating_add(Weight::from_parts(0, 2603).saturating_mul(u.into()))
@@ -154,8 +154,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `1501`
// Minimum execution time: 5_035_000 picoseconds.
Weight::from_parts(5_255_000, 0)
// Minimum execution time: 4_820_000 picoseconds.
Weight::from_parts(5_152_000, 0)
.saturating_add(Weight::from_parts(0, 1501))
.saturating_add(T::DbWeight::get().reads(1))
}
@@ -210,7 +210,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeFreezeReason = RuntimeFreezeReason;
type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}
@@ -210,7 +210,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeFreezeReason = RuntimeFreezeReason;
type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}
@@ -404,7 +404,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}
@@ -259,7 +259,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}
-1
View File
@@ -236,7 +236,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}
@@ -724,7 +724,6 @@ mod tests {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>;
}
-1
View File
@@ -752,7 +752,6 @@ mod tests {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>;
}
-1
View File
@@ -782,7 +782,6 @@ mod tests {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>;
}
@@ -944,7 +944,6 @@ mod tests {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>;
}
-1
View File
@@ -304,7 +304,6 @@ mod tests {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>;
}
@@ -189,7 +189,6 @@ impl pallet_balances::Config for Test {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}
@@ -801,7 +801,6 @@ mod tests {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>;
}
-1
View File
@@ -556,7 +556,6 @@ mod tests {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>;
}
-1
View File
@@ -574,7 +574,6 @@ mod tests {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>;
}
-1
View File
@@ -147,7 +147,6 @@ impl pallet_balances::Config for Test {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}
+1 -3
View File
@@ -311,10 +311,9 @@ impl pallet_balances::Config for Runtime {
type ReserveIdentifier = [u8; 8];
type WeightInfo = weights::pallet_balances_balances::WeightInfo<Runtime>;
type FreezeIdentifier = ();
type MaxFreezes = ConstU32<1>;
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type MaxHolds = ConstU32<3>;
type MaxFreezes = ConstU32<1>;
}
parameter_types! {
@@ -1167,7 +1166,6 @@ impl pallet_balances::Config<NisCounterpartInstance> for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<3>;
type MaxFreezes = ConstU32<1>;
}
-1
View File
@@ -221,7 +221,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}
-1
View File
@@ -304,7 +304,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = RuntimeFreezeReason;
type MaxFreezes = ConstU32<1>;
type MaxHolds = ConstU32<1>;
}
parameter_types! {
-1
View File
@@ -289,7 +289,6 @@ impl pallet_balances::Config for Test {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}
@@ -77,7 +77,6 @@ impl pallet_balances::Config for Test {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}
@@ -124,7 +124,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}
@@ -109,7 +109,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}
@@ -95,7 +95,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}
@@ -100,7 +100,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}
@@ -96,7 +96,6 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}
+21
View File
@@ -0,0 +1,21 @@
# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0
# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json
title: "[frame] `#[pallet::composite_enum]` improved variant count handling + removed `pallet_balances`'s `MaxHolds` config"
doc:
- audience: Runtime Dev
description: |
The implementation of the `VariantCount` trait for aggregate composite enums,
such as `RuntimeHoldReason` and `RuntimeFreezeReason`, has been fixed.
It is now calculated as the sum of `VariantCount::VARIANT_COUNT` for all corresponding `#[pallet::composite_enum]`.
The `Balances` pallet's `Config` item `type MaxHolds` has been removed,
and `type Holds` is now bound to the variant count of the composite enum `RuntimeHoldReason`.
Consequently, the runtime does not need to consider setting the correct value for `MaxHolds`.
notes:
- Remove `type MaxHolds` from the `impl pallet_balances::Config for Runtime` in the runtime.
- When holds are expected to be used, ensure that `type RuntimeHoldReason = RuntimeHoldReason` is set for `impl pallet_balances::Config for Runtime`.
crates:
- name: pallet-balances
@@ -228,7 +228,6 @@ impl pallet_balances::Config for Runtime {
type MaxFreezes = ();
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ();
}
parameter_types! {
-1
View File
@@ -533,7 +533,6 @@ impl pallet_balances::Config for Runtime {
type WeightInfo = pallet_balances::weights::SubstrateWeight<Runtime>;
type FreezeIdentifier = RuntimeFreezeReason;
type MaxFreezes = ConstU32<1>;
type MaxHolds = ConstU32<7>;
}
parameter_types! {
-1
View File
@@ -72,7 +72,6 @@ impl pallet_balances::Config for Test {
type MaxFreezes = ();
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ();
}
const MOTION_DURATION_IN_BLOCKS: BlockNumber = 3;
@@ -95,7 +95,6 @@ impl pallet_balances::Config for Test {
type MaxFreezes = ();
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ();
}
impl pallet_assets::Config<Instance1> for Test {
-1
View File
@@ -79,7 +79,6 @@ impl pallet_balances::Config for Test {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ();
type MaxFreezes = ();
}
-1
View File
@@ -86,7 +86,6 @@ impl pallet_balances::Config for Test {
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type FreezeIdentifier = ();
type MaxHolds = ();
type MaxFreezes = ();
}
-1
View File
@@ -82,7 +82,6 @@ impl pallet_balances::Config for Test {
type MaxFreezes = ();
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ();
}
impl Config for Test {
-1
View File
@@ -126,7 +126,6 @@ impl pallet_balances::Config for Test {
type MaxFreezes = ();
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ();
}
pallet_staking_reward_curve::build! {
+6 -15
View File
@@ -206,7 +206,7 @@ pub mod pallet {
use super::*;
use frame_support::{
pallet_prelude::*,
traits::{fungible::Credit, tokens::Precision, VariantCount},
traits::{fungible::Credit, tokens::Precision, VariantCount, VariantCountOf},
};
use frame_system::pallet_prelude::*;
@@ -242,7 +242,6 @@ pub mod pallet {
type MaxLocks = ConstU32<100>;
type MaxReserves = ConstU32<100>;
type MaxFreezes = ConstU32<100>;
type MaxHolds = ConstU32<100>;
type WeightInfo = ();
}
@@ -316,10 +315,6 @@ pub mod pallet {
#[pallet::constant]
type MaxReserves: Get<u32>;
/// The maximum number of holds that can exist on an account at any time.
#[pallet::constant]
type MaxHolds: Get<u32>;
/// The maximum number of individual freeze locks that can exist on an account at any time.
#[pallet::constant]
type MaxFreezes: Get<u32>;
@@ -407,7 +402,7 @@ pub mod pallet {
DeadAccount,
/// Number of named reserves exceed `MaxReserves`.
TooManyReserves,
/// Number of holds exceed `MaxHolds`.
/// Number of holds exceed `VariantCountOf<T::RuntimeHoldReason>`.
TooManyHolds,
/// Number of freezes exceed `MaxFreezes`.
TooManyFreezes,
@@ -487,7 +482,10 @@ pub mod pallet {
_,
Blake2_128Concat,
T::AccountId,
BoundedVec<IdAmount<T::RuntimeHoldReason, T::Balance>, T::MaxHolds>,
BoundedVec<
IdAmount<T::RuntimeHoldReason, T::Balance>,
VariantCountOf<T::RuntimeHoldReason>,
>,
ValueQuery,
>;
@@ -556,13 +554,6 @@ pub mod pallet {
"The existential deposit must be greater than zero!"
);
assert!(
T::MaxHolds::get() >= <T::RuntimeHoldReason as VariantCount>::VARIANT_COUNT,
"MaxHolds should be greater than or equal to the number of hold reasons: {} < {}",
T::MaxHolds::get(),
<T::RuntimeHoldReason as VariantCount>::VARIANT_COUNT
);
assert!(
T::MaxFreezes::get() >= <T::RuntimeFreezeReason as VariantCount>::VARIANT_COUNT,
"MaxFreezes should be greater than or equal to the number of freeze reasons: {} < {}",
@@ -142,7 +142,6 @@ impl Config for Test {
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = TestId;
type MaxFreezes = ConstU32<2>;
type MaxHolds = ConstU32<3>;
}
#[derive(Clone)]
-1
View File
@@ -133,7 +133,6 @@ impl pallet_balances::Config for Test {
type WeightInfo = ();
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ();
type FreezeIdentifier = ();
type MaxFreezes = ();
}
-1
View File
@@ -100,7 +100,6 @@ impl pallet_balances::Config for Test {
type MaxFreezes = ();
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ();
}
parameter_types! {
pub const ProposalBond: Permill = Permill::from_percent(5);
@@ -103,7 +103,6 @@ impl pallet_balances::Config for Test {
type MaxFreezes = ();
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ();
}
parameter_types! {
pub const ProposalBond: Permill = Permill::from_percent(5);
@@ -95,7 +95,6 @@ impl pallet_balances::Config for Runtime {
type ExistentialDeposit = ExistentialDeposit;
type FreezeIdentifier = ();
type MaxFreezes = ConstU32<0>;
type MaxHolds = ConstU32<1>;
type MaxLocks = MaxLocks;
type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8];
@@ -93,7 +93,6 @@ impl pallet_balances::Config for Runtime {
type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8];
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
-1
View File
@@ -373,7 +373,6 @@ impl pallet_balances::Config for Test {
type MaxFreezes = ();
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type MaxHolds = ConstU32<1>;
}
impl pallet_timestamp::Config for Test {
@@ -92,7 +92,6 @@ impl pallet_balances::Config for Test {
type MaxFreezes = ();
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ();
}
#[derive(Clone, PartialEq, Eq, Debug)]
-1
View File
@@ -143,7 +143,6 @@ impl pallet_balances::Config for Test {
type MaxFreezes = ();
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ();
}
parameter_types! {
pub static PreimageByteDeposit: u64 = 0;
@@ -259,7 +259,6 @@ impl pallet_balances::Config for Runtime {
type MaxFreezes = ();
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ();
}
#[derive(Default, Eq, PartialEq, Debug, Clone, Copy)]
@@ -111,7 +111,6 @@ impl pallet_balances::Config for Runtime {
type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System;
type MaxHolds = ConstU32<1>;
type MaxFreezes = traits::ConstU32<1>;
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
@@ -1362,7 +1362,6 @@ mod tests {
type MaxFreezes = ();
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ();
}
frame_support::parameter_types! {
@@ -86,7 +86,6 @@ impl pallet_balances::Config for Test {
type MaxFreezes = ();
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ();
}
impl Config for Test {
@@ -80,7 +80,6 @@ impl pallet_balances::Config for Test {
type MaxFreezes = ();
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type MaxHolds = ();
}
impl Config for Test {
@@ -57,7 +57,6 @@ impl pallet_balances::Config for Test {
type MaxFreezes = ();
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ();
}
parameter_types! {
-1
View File
@@ -959,7 +959,6 @@ mod tests {
type MaxFreezes = ConstU32<1>;
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ConstU32<1>;
}
parameter_types! {
-1
View File
@@ -77,7 +77,6 @@ impl pallet_balances::Config for Runtime {
type MaxFreezes = ();
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ();
}
pallet_staking_reward_curve::build! {
-1
View File
@@ -143,7 +143,6 @@ impl pallet_balances::Config for Test {
type MaxFreezes = ();
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ();
}
impl pallet_timestamp::Config for Test {
-1
View File
@@ -94,7 +94,6 @@ impl pallet_balances::Config for Test {
type MaxFreezes = ();
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ();
}
parameter_types! {
-1
View File
@@ -79,7 +79,6 @@ impl pallet_balances::Config for Test {
type MaxFreezes = ();
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ();
}
impl Config for Test {
-1
View File
@@ -88,7 +88,6 @@ impl pallet_balances::Config for Test {
type MaxFreezes = ();
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ();
}
parameter_types! {
@@ -89,7 +89,6 @@ impl pallet_balances::Config for Test {
type ReserveIdentifier = [u8; 8];
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type MaxHolds = ConstU32<1>;
type FreezeIdentifier = ();
type MaxFreezes = ();
}
-1
View File
@@ -87,7 +87,6 @@ impl pallet_balances::Config for Test {
type MaxFreezes = ();
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ();
}
parameter_types! {
-2
View File
@@ -91,7 +91,6 @@ impl pallet_balances::Config<Instance1> for Test {
type MaxFreezes = ();
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type MaxHolds = ConstU32<1>;
}
impl pallet_balances::Config<Instance2> for Test {
@@ -112,7 +111,6 @@ impl pallet_balances::Config<Instance2> for Test {
type MaxFreezes = ();
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ();
}
parameter_types! {
@@ -79,7 +79,6 @@ impl pallet_balances::Config for Runtime {
type MaxFreezes = ConstU32<1>;
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ();
}
pallet_staking_reward_curve::build! {
@@ -254,7 +254,6 @@ impl pallet_balances::Config for Runtime {
type MaxFreezes = ConstU32<1>;
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ();
}
pub struct BalanceToU256;
@@ -90,7 +90,6 @@ impl pallet_balances::Config for Runtime {
type MaxFreezes = ConstU32<1>;
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ();
}
pallet_staking_reward_curve::build! {
@@ -81,7 +81,6 @@ impl pallet_balances::Config for Test {
type MaxFreezes = ();
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ();
}
impl pallet_timestamp::Config for Test {
+7 -4
View File
@@ -21,7 +21,7 @@ use super::*;
use crate as pallet_preimage;
use frame_support::{
derive_impl, ord_parameter_types,
derive_impl, ord_parameter_types, parameter_types,
traits::{fungible::HoldConsideration, ConstU32, ConstU64, Everything},
weights::constants::RocksDbWeight,
};
@@ -82,15 +82,18 @@ impl pallet_balances::Config for Test {
type ReserveIdentifier = [u8; 8];
type FreezeIdentifier = ();
type MaxFreezes = ConstU32<1>;
type RuntimeHoldReason = ();
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = ();
type MaxHolds = ConstU32<2>;
}
ord_parameter_types! {
pub const One: u64 = 1;
}
parameter_types! {
pub const PreimageHoldReason: RuntimeHoldReason = RuntimeHoldReason::Preimage(pallet_preimage::HoldReason::Preimage);
}
pub struct ConvertDeposit;
impl Convert<Footprint, u64> for ConvertDeposit {
fn convert(a: Footprint) -> u64 {
@@ -103,7 +106,7 @@ impl Config for Test {
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type ManagerOrigin = EnsureSignedBy<One, u64>;
type Consideration = HoldConsideration<u64, Balances, (), ConvertDeposit>;
type Consideration = HoldConsideration<u64, Balances, PreimageHoldReason, ConvertDeposit>;
}
pub fn new_test_ext() -> sp_io::TestExternalities {
+4 -4
View File
@@ -58,7 +58,7 @@ pub fn make_bounded_values() -> (
fn user_note_preimage_works() {
new_test_ext().execute_with(|| {
assert_ok!(Preimage::note_preimage(RuntimeOrigin::signed(2), vec![1]));
assert_eq!(Balances::balance_on_hold(&(), &2), 3);
assert_eq!(Balances::balance_on_hold(&PreimageHoldReason::get(), &2), 3);
assert_eq!(Balances::free_balance(2), 97);
let h = hashed([1]);
@@ -255,14 +255,14 @@ fn unrequest_preimage_works() {
fn user_noted_then_requested_preimage_is_refunded_once_only() {
new_test_ext().execute_with(|| {
assert_ok!(Preimage::note_preimage(RuntimeOrigin::signed(2), vec![1; 3]));
assert_eq!(Balances::balance_on_hold(&(), &2), 5);
assert_eq!(Balances::balance_on_hold(&PreimageHoldReason::get(), &2), 5);
assert_ok!(Preimage::note_preimage(RuntimeOrigin::signed(2), vec![1]));
assert_eq!(Balances::balance_on_hold(&(), &2), 8);
assert_eq!(Balances::balance_on_hold(&PreimageHoldReason::get(), &2), 8);
assert_ok!(Preimage::request_preimage(RuntimeOrigin::signed(1), hashed([1])));
assert_ok!(Preimage::unrequest_preimage(RuntimeOrigin::signed(1), hashed([1])));
assert_ok!(Preimage::unnote_preimage(RuntimeOrigin::signed(2), hashed([1])));
// Still have hold from `vec[1; 3]`.
assert_eq!(Balances::balance_on_hold(&(), &2), 5);
assert_eq!(Balances::balance_on_hold(&PreimageHoldReason::get(), &2), 5);
});
}
-1
View File
@@ -86,7 +86,6 @@ impl pallet_balances::Config for Test {
type MaxFreezes = ();
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ();
}
parameter_types! {
-1
View File
@@ -118,7 +118,6 @@ impl pallet_balances::Config for Test {
type MaxFreezes = ();
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ();
}
parameter_types! {
pub static AlarmInterval: u64 = 1;
@@ -125,7 +125,6 @@ impl pallet_balances::Config for Test {
type MaxFreezes = ();
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ();
}
pallet_staking_reward_curve::build! {
-1
View File
@@ -82,7 +82,6 @@ impl pallet_balances::Config for Test {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<10>;
type MaxFreezes = ConstU32<0>;
}
-1
View File
@@ -92,7 +92,6 @@ impl pallet_balances::Config for Test {
type MaxFreezes = ();
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ();
}
parameter_types! {
@@ -86,7 +86,6 @@ impl pallet_balances::Config for Test {
type MaxFreezes = ();
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ();
}
impl pallet_timestamp::Config for Test {
-1
View File
@@ -165,7 +165,6 @@ impl pallet_balances::Config for Test {
type MaxFreezes = ();
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type MaxHolds = ();
}
sp_runtime::impl_opaque_keys! {
-1
View File
@@ -88,7 +88,6 @@ impl pallet_balances::Config for Test {
type MaxFreezes = ();
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type MaxHolds = ();
}
ord_parameter_types! {
@@ -68,3 +68,34 @@ pub(crate) fn expand_variant(
}
}
}
pub(crate) fn expand_variant_count(
composite_name: &str,
path: &PalletPath,
instance: Option<&Ident>,
) -> TokenStream {
let composite_name = quote::format_ident!("{}", composite_name);
if let Some(inst) = instance {
quote! {
#path::#composite_name::<#path::#inst>::VARIANT_COUNT
}
} else {
// Wrapped `<`..`>` means: use default type parameter for enum.
//
// This is used for pallets without instance support or pallets with instance support when
// we don't specify instance:
//
// ```nocompile
// pub struct Pallet<T, I = ()>{..}
//
// #[pallet::composite_enum]
// pub enum HoldReason<I: 'static = ()> {..}
//
// Pallet1: pallet_x, // <- default type parameter
// ```
quote! {
<#path::#composite_name>::VARIANT_COUNT
}
}
}
@@ -23,6 +23,7 @@ use quote::quote;
pub fn expand_outer_freeze_reason(pallet_decls: &[Pallet], scrate: &TokenStream) -> TokenStream {
let mut conversion_fns = Vec::new();
let mut freeze_reason_variants = Vec::new();
let mut freeze_reason_variants_count = Vec::new();
for decl in pallet_decls {
if let Some(_) = decl.find_part("FreezeReason") {
let variant_name = &decl.name;
@@ -44,9 +45,14 @@ pub fn expand_outer_freeze_reason(pallet_decls: &[Pallet], scrate: &TokenStream)
instance,
variant_name,
));
freeze_reason_variants_count.push(composite_helper::expand_variant_count(
"FreezeReason",
path,
instance,
));
}
}
let freeze_reason_variants_count = freeze_reason_variants.len() as u32;
quote! {
/// A reason for placing a freeze on funds.
@@ -61,7 +67,7 @@ pub fn expand_outer_freeze_reason(pallet_decls: &[Pallet], scrate: &TokenStream)
}
impl #scrate::traits::VariantCount for RuntimeFreezeReason {
const VARIANT_COUNT: u32 = #freeze_reason_variants_count;
const VARIANT_COUNT: u32 = 0 #( + #freeze_reason_variants_count )*;
}
#( #conversion_fns )*
@@ -23,6 +23,7 @@ use quote::quote;
pub fn expand_outer_hold_reason(pallet_decls: &[Pallet], scrate: &TokenStream) -> TokenStream {
let mut conversion_fns = Vec::new();
let mut hold_reason_variants = Vec::new();
let mut hold_reason_variants_count = Vec::new();
for decl in pallet_decls {
if let Some(_) = decl.find_part("HoldReason") {
let variant_name = &decl.name;
@@ -44,9 +45,14 @@ pub fn expand_outer_hold_reason(pallet_decls: &[Pallet], scrate: &TokenStream) -
instance,
variant_name,
));
hold_reason_variants_count.push(composite_helper::expand_variant_count(
"HoldReason",
path,
instance,
));
}
}
let hold_reason_variants_count = hold_reason_variants.len() as u32;
quote! {
/// A reason for placing a hold on funds.
@@ -61,7 +67,7 @@ pub fn expand_outer_hold_reason(pallet_decls: &[Pallet], scrate: &TokenStream) -
}
impl #scrate::traits::VariantCount for RuntimeHoldReason {
const VARIANT_COUNT: u32 = #hold_reason_variants_count;
const VARIANT_COUNT: u32 = 0 #( + #hold_reason_variants_count )*;
}
#( #conversion_fns )*
+5 -10
View File
@@ -432,10 +432,7 @@ pub fn derive_runtime_debug_no_bound(input: TokenStream) -> TokenStream {
if cfg!(any(feature = "std", feature = "try-runtime")) {
no_bound::debug::derive_debug_no_bound(input)
} else {
let input: syn::DeriveInput = match syn::parse(input) {
Ok(input) => input,
Err(e) => return e.to_compile_error().into(),
};
let input = syn::parse_macro_input!(input as syn::DeriveInput);
let name = &input.ident;
let (impl_generics, ty_generics, where_clause) = input.generics.split_for_impl();
@@ -463,10 +460,7 @@ pub fn derive_partial_eq_no_bound(input: TokenStream) -> TokenStream {
/// Derive [`Eq`] but do no bound any generic. Docs are at `frame_support::EqNoBound`.
#[proc_macro_derive(EqNoBound)]
pub fn derive_eq_no_bound(input: TokenStream) -> TokenStream {
let input: syn::DeriveInput = match syn::parse(input) {
Ok(input) => input,
Err(e) => return e.to_compile_error().into(),
};
let input = syn::parse_macro_input!(input as syn::DeriveInput);
let name = &input.ident;
let (impl_generics, ty_generics, where_clause) = input.generics.split_for_impl();
@@ -1519,13 +1513,14 @@ pub fn origin(_: TokenStream, _: TokenStream) -> TokenStream {
///
/// ```ignore
/// Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, MaxEncodedLen, TypeInfo,
/// RuntimeDebug
/// RuntimeDebug,
/// ```
///
/// For ease of usage, when no `#[derive]` attributes are found for the enum under
/// `#[pallet::composite_enum]`, the aforementioned traits are automatically derived for it. The
/// inverse is also true: if there are any `#[derive]` attributes found for the enum, then no traits
/// will automatically be derived for it.
/// will automatically be derived for it (this implies that you need to provide the
/// `frame_support::traits::VariantCount` implementation).
#[proc_macro_attribute]
pub fn composite_enum(_: TokenStream, _: TokenStream) -> TokenStream {
pallet_macro_stub()
@@ -19,10 +19,7 @@ use syn::spanned::Spanned;
/// Derive Clone but do not bound any generic.
pub fn derive_clone_no_bound(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
let input: syn::DeriveInput = match syn::parse(input) {
Ok(input) => input,
Err(e) => return e.to_compile_error().into(),
};
let input = syn::parse_macro_input!(input as syn::DeriveInput);
let name = &input.ident;
let (impl_generics, ty_generics, where_clause) = input.generics.split_for_impl();
@@ -19,10 +19,7 @@ use syn::spanned::Spanned;
/// Derive Debug but do not bound any generics.
pub fn derive_debug_no_bound(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
let input: syn::DeriveInput = match syn::parse(input) {
Ok(input) => input,
Err(e) => return e.to_compile_error().into(),
};
let input = syn::parse_macro_input!(input as syn::DeriveInput);
let input_ident = &input.ident;
let (impl_generics, ty_generics, where_clause) = input.generics.split_for_impl();

Some files were not shown because too many files have changed in this diff Show More