Skip to content

Commit

Permalink
[pallet-balances] burn_allow_death extrinsic (paritytech#3964)
Browse files Browse the repository at this point in the history
Adds an additional extrinsic call to the `pallet-balances` to _burn_
tokens.
Depending on the `keep_alive` flag, the call might or might not reap the
account.

Required modification of the _fungible's_ `Mutate` trait, `burn_from`
function to allow the `Preservation` argument.

**TODO**
- [x] run benchmarks & update weights
- [x] make sure prdoc is required & properly formatted

Related issue: paritytech#3943

---------

Co-authored-by: Oliver Tale-Yazdi <[email protected]>
Co-authored-by: command-bot <>
  • Loading branch information
2 people authored and TarekkMA committed Aug 2, 2024
1 parent 5bb025e commit be32209
Show file tree
Hide file tree
Showing 32 changed files with 876 additions and 452 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
//! Autogenerated weights for `pallet_balances`
//!
//! 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: `[]`
//! DATE: 2024-05-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-8idpd4bs-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! HOSTNAME: `runner-unxyhko3-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:
Expand Down Expand Up @@ -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_706_000 picoseconds.
Weight::from_parts(43_378_000, 0)
// Minimum execution time: 43_472_000 picoseconds.
Weight::from_parts(44_389_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
Expand All @@ -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_090_000 picoseconds.
Weight::from_parts(33_703_000, 0)
// Minimum execution time: 34_211_000 picoseconds.
Weight::from_parts(35_075_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
Expand All @@ -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_678_000 picoseconds.
Weight::from_parts(13_068_000, 0)
// Minimum execution time: 12_751_000 picoseconds.
Weight::from_parts(13_221_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
Expand All @@ -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_336_000 picoseconds.
Weight::from_parts(17_824_000, 0)
// Minimum execution time: 17_530_000 picoseconds.
Weight::from_parts(17_979_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
Expand All @@ -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_817_000 picoseconds.
Weight::from_parts(45_453_000, 0)
// Minimum execution time: 45_913_000 picoseconds.
Weight::from_parts(47_447_000, 0)
.saturating_add(Weight::from_parts(0, 6196))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
Expand All @@ -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_468_000 picoseconds.
Weight::from_parts(42_093_000, 0)
// Minimum execution time: 42_435_000 picoseconds.
Weight::from_parts(44_712_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
Expand All @@ -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_344_000 picoseconds.
Weight::from_parts(15_878_000, 0)
// Minimum execution time: 15_407_000 picoseconds.
Weight::from_parts(16_104_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
Expand All @@ -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_067_000 picoseconds.
Weight::from_parts(15_281_000, 0)
// Minimum execution time: 15_494_000 picoseconds.
Weight::from_parts(15_793_000, 0)
.saturating_add(Weight::from_parts(0, 990))
// Standard Error: 11_009
.saturating_add(Weight::from_parts(13_050_024, 0).saturating_mul(u.into()))
// Standard Error: 11_778
.saturating_add(Weight::from_parts(13_198_951, 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()))
Expand All @@ -154,9 +154,25 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `1501`
// Minimum execution time: 5_139_000 picoseconds.
Weight::from_parts(5_511_000, 0)
// Minimum execution time: 5_368_000 picoseconds.
Weight::from_parts(5_674_000, 0)
.saturating_add(Weight::from_parts(0, 1501))
.saturating_add(T::DbWeight::get().reads(1))
}
fn burn_allow_death() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 27_491_000 picoseconds.
Weight::from_parts(28_444_000, 0)
.saturating_add(Weight::from_parts(0, 0))
}
fn burn_keep_alive() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 18_290_000 picoseconds.
Weight::from_parts(19_227_000, 0)
.saturating_add(Weight::from_parts(0, 0))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
//! Autogenerated weights for `pallet_balances`
//!
//! 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: `[]`
//! DATE: 2024-05-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-8idpd4bs-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! HOSTNAME: `runner-unxyhko3-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:
Expand Down Expand Up @@ -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_122_000 picoseconds.
Weight::from_parts(43_640_000, 0)
// Minimum execution time: 45_289_000 picoseconds.
Weight::from_parts(46_764_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
Expand All @@ -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_636_000 picoseconds.
Weight::from_parts(34_571_000, 0)
// Minimum execution time: 35_052_000 picoseconds.
Weight::from_parts(36_494_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
Expand All @@ -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_101_000 picoseconds.
Weight::from_parts(12_511_000, 0)
// Minimum execution time: 12_361_000 picoseconds.
Weight::from_parts(12_668_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
Expand All @@ -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_077_000 picoseconds.
Weight::from_parts(17_362_000, 0)
// Minimum execution time: 17_253_000 picoseconds.
Weight::from_parts(17_733_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
Expand All @@ -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_352_000 picoseconds.
Weight::from_parts(45_045_000, 0)
// Minimum execution time: 45_674_000 picoseconds.
Weight::from_parts(47_981_000, 0)
.saturating_add(Weight::from_parts(0, 6196))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
Expand All @@ -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_836_000 picoseconds.
Weight::from_parts(43_201_000, 0)
// Minimum execution time: 45_021_000 picoseconds.
Weight::from_parts(46_292_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
Expand All @@ -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_413_000 picoseconds.
Weight::from_parts(14_743_000, 0)
// Minimum execution time: 15_071_000 picoseconds.
Weight::from_parts(15_406_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
Expand All @@ -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_542_000 picoseconds.
Weight::from_parts(14_731_000, 0)
// Minimum execution time: 14_779_000 picoseconds.
Weight::from_parts(15_129_000, 0)
.saturating_add(Weight::from_parts(0, 990))
// Standard Error: 11_213
.saturating_add(Weight::from_parts(13_160_721, 0).saturating_mul(u.into()))
// Standard Error: 10_629
.saturating_add(Weight::from_parts(13_558_995, 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()))
Expand All @@ -154,9 +154,25 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `1501`
// Minimum execution time: 5_208_000 picoseconds.
Weight::from_parts(5_619_000, 0)
// Minimum execution time: 5_274_000 picoseconds.
Weight::from_parts(5_727_000, 0)
.saturating_add(Weight::from_parts(0, 1501))
.saturating_add(T::DbWeight::get().reads(1))
}
fn burn_allow_death() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 28_088_000 picoseconds.
Weight::from_parts(28_980_000, 0)
.saturating_add(Weight::from_parts(0, 0))
}
fn burn_keep_alive() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 19_002_000 picoseconds.
Weight::from_parts(19_480_000, 0)
.saturating_add(Weight::from_parts(0, 0))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
//! Autogenerated weights for `pallet_balances`
//!
//! 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: `[]`
//! DATE: 2024-05-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-8idpd4bs-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! HOSTNAME: `runner-unxyhko3-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:
Expand Down Expand Up @@ -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: 41_696_000 picoseconds.
Weight::from_parts(42_201_000, 0)
// Minimum execution time: 41_898_000 picoseconds.
Weight::from_parts(42_690_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
Expand All @@ -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: 32_855_000 picoseconds.
Weight::from_parts(33_554_000, 0)
// Minimum execution time: 32_745_000 picoseconds.
Weight::from_parts(33_686_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
Expand All @@ -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_977_000 picoseconds.
Weight::from_parts(13_473_000, 0)
// Minimum execution time: 13_352_000 picoseconds.
Weight::from_parts(13_808_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
Expand All @@ -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: 17_617_000 picoseconds.
Weight::from_parts(18_234_000, 0)
// Minimum execution time: 18_248_000 picoseconds.
Weight::from_parts(18_763_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
Expand All @@ -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_174_000 picoseconds.
Weight::from_parts(43_685_000, 0)
// Minimum execution time: 43_626_000 picoseconds.
Weight::from_parts(45_333_000, 0)
.saturating_add(Weight::from_parts(0, 6196))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
Expand All @@ -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_125_000 picoseconds.
Weight::from_parts(41_636_000, 0)
// Minimum execution time: 41_702_000 picoseconds.
Weight::from_parts(43_366_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
Expand All @@ -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_749_000 picoseconds.
Weight::from_parts(16_163_000, 0)
// Minimum execution time: 15_944_000 picoseconds.
Weight::from_parts(16_512_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
Expand All @@ -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_238_000 picoseconds.
Weight::from_parts(14_469_000, 0)
// Minimum execution time: 14_351_000 picoseconds.
Weight::from_parts(14_568_000, 0)
.saturating_add(Weight::from_parts(0, 990))
// Standard Error: 11_818
.saturating_add(Weight::from_parts(12_621_051, 0).saturating_mul(u.into()))
// Standard Error: 11_289
.saturating_add(Weight::from_parts(13_163_759, 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()))
Expand All @@ -154,9 +154,25 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `1501`
// Minimum execution time: 4_904_000 picoseconds.
Weight::from_parts(5_459_000, 0)
// Minimum execution time: 5_174_000 picoseconds.
Weight::from_parts(5_490_000, 0)
.saturating_add(Weight::from_parts(0, 1501))
.saturating_add(T::DbWeight::get().reads(1))
}
fn burn_allow_death() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 26_681_000 picoseconds.
Weight::from_parts(27_705_000, 0)
.saturating_add(Weight::from_parts(0, 0))
}
fn burn_keep_alive() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 18_105_000 picoseconds.
Weight::from_parts(19_246_000, 0)
.saturating_add(Weight::from_parts(0, 0))
}
}
Loading

0 comments on commit be32209

Please sign in to comment.