diff --git a/frame/assets/src/benchmarking.rs b/frame/assets/src/benchmarking.rs index 4fe951f56edf3..0538e955b2c09 100644 --- a/frame/assets/src/benchmarking.rs +++ b/frame/assets/src/benchmarking.rs @@ -471,5 +471,12 @@ benchmarks_instance_pallet! { assert_last_event::(Event::ApprovalCancelled { asset_id: asset_id.into(), owner: caller, delegate }.into()); } + set_min_balance { + let (asset_id, caller, caller_lookup) = create_default_asset::(true); + }: _(SystemOrigin::Signed(caller.clone()), asset_id, 50u32.into()) + verify { + assert_last_event::(Event::AssetMinBalanceChanged { asset_id: asset_id.into(), new_min_balance: 50u32.into() }.into()); + } + impl_benchmark_test_suite!(Assets, crate::mock::new_test_ext(), crate::mock::Test) } diff --git a/frame/assets/src/lib.rs b/frame/assets/src/lib.rs index 894f8f3a4ab93..96da078065839 100644 --- a/frame/assets/src/lib.rs +++ b/frame/assets/src/lib.rs @@ -514,6 +514,8 @@ pub mod pallet { }, /// An asset has had its attributes changed by the `Force` origin. AssetStatusChanged { asset_id: T::AssetId }, + /// The min_balance of an asset has been updated by the asset owner. + AssetMinBalanceChanged { asset_id: T::AssetId, new_min_balance: T::Balance }, } #[pallet::error] @@ -1511,6 +1513,49 @@ pub mod pallet { let id: T::AssetId = id.into(); Self::do_refund(id, ensure_signed(origin)?, allow_burn) } + + /// Sets the minimum balance of an asset. + /// + /// Only works if there aren't any accounts that are holding the asset or if + /// the new value of `min_balance` is less than the old one. + /// + /// Origin must be Signed and the sender has to be the Owner of the + /// asset `id`. + /// + /// - `id`: The identifier of the asset. + /// - `min_balance`: The new value of `min_balance`. + /// + /// Emits `AssetMinBalanceChanged` event when successful. + #[pallet::call_index(28)] + #[pallet::weight(T::WeightInfo::set_min_balance())] + pub fn set_min_balance( + origin: OriginFor, + id: T::AssetIdParameter, + min_balance: T::Balance, + ) -> DispatchResult { + let origin = ensure_signed(origin)?; + let id: T::AssetId = id.into(); + + let mut details = Asset::::get(id).ok_or(Error::::Unknown)?; + ensure!(origin == details.owner, Error::::NoPermission); + + let old_min_balance = details.min_balance; + // Ensure that either the new min_balance is less than old min_balance or there aren't + // any accounts holding the asset. + ensure!( + min_balance < old_min_balance || details.accounts == 0, + Error::::NoPermission + ); + + details.min_balance = min_balance; + Asset::::insert(&id, details); + + Self::deposit_event(Event::AssetMinBalanceChanged { + asset_id: id, + new_min_balance: min_balance, + }); + Ok(()) + } } } diff --git a/frame/assets/src/tests.rs b/frame/assets/src/tests.rs index 6a3fd672a759c..e76e989ef8932 100644 --- a/frame/assets/src/tests.rs +++ b/frame/assets/src/tests.rs @@ -1091,6 +1091,35 @@ fn force_asset_status_should_work() { }); } +#[test] +fn set_min_balance_should_work() { + new_test_ext().execute_with(|| { + let id = 42; + Balances::make_free_balance_be(&1, 10); + assert_ok!(Assets::create(RuntimeOrigin::signed(1), id, 1, 30)); + + assert_ok!(Assets::mint(RuntimeOrigin::signed(1), id, 1, 50)); + // won't execute because there is an asset holder. + assert_noop!( + Assets::set_min_balance(RuntimeOrigin::signed(1), id, 50), + Error::::NoPermission + ); + + // will execute because the new value of min_balance is less than the + // old value. 10 < 30 + assert_ok!(Assets::mint(RuntimeOrigin::signed(1), id, 1, 10)); + + assert_ok!(Assets::burn(RuntimeOrigin::signed(1), id, 1, 50)); + assert_noop!( + Assets::set_min_balance(RuntimeOrigin::signed(2), id, 50), + Error::::NoPermission + ); + + assert_ok!(Assets::set_min_balance(RuntimeOrigin::signed(1), id, 50)); + assert_eq!(Asset::::get(id).unwrap().min_balance, 50); + }); +} + #[test] fn balance_conversion_should_work() { new_test_ext().execute_with(|| { diff --git a/frame/assets/src/weights.rs b/frame/assets/src/weights.rs index 9ebba62237091..27de4fa333687 100644 --- a/frame/assets/src/weights.rs +++ b/frame/assets/src/weights.rs @@ -18,25 +18,26 @@ //! Autogenerated weights for pallet_assets //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-01-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-02-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: -// ./target/production/substrate +// target/production/substrate // benchmark // pallet -// --chain=dev // --steps=50 // --repeat=20 -// --pallet=pallet_assets // --extrinsic=* // --execution=wasm // --wasm-execution=compiled // --heap-pages=4096 -// --output=./frame/assets/src/weights.rs +// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/substrate/.git/.artifacts/bench.json +// --pallet=pallet_assets +// --chain=dev // --header=./HEADER-APACHE2 +// --output=./frame/assets/src/weights.rs // --template=./.maintain/frame-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] @@ -74,6 +75,7 @@ pub trait WeightInfo { fn transfer_approved() -> Weight; fn cancel_approval() -> Weight; fn force_cancel_approval() -> Weight; + fn set_min_balance() -> Weight; } /// Weights for pallet_assets using the Substrate node and recommended hardware. @@ -86,9 +88,10 @@ impl WeightInfo for SubstrateWeight { fn create() -> Weight { // Proof Size summary in bytes: // Measured: `325` - // Estimated: `5288` - // Minimum execution time: 23_623 nanoseconds. - Weight::from_parts(24_072_000, 5288) + // Estimated: `7268` + // Minimum execution time: 27_887 nanoseconds. + Weight::from_ref_time(28_190_000) + .saturating_add(Weight::from_proof_size(7268)) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -97,9 +100,10 @@ impl WeightInfo for SubstrateWeight { fn force_create() -> Weight { // Proof Size summary in bytes: // Measured: `153` - // Estimated: `2685` - // Minimum execution time: 13_145 nanoseconds. - Weight::from_parts(13_572_000, 2685) + // Estimated: `3675` + // Minimum execution time: 15_059 nanoseconds. + Weight::from_ref_time(15_600_000) + .saturating_add(Weight::from_proof_size(3675)) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -108,9 +112,10 @@ impl WeightInfo for SubstrateWeight { fn start_destroy() -> Weight { // Proof Size summary in bytes: // Measured: `417` - // Estimated: `2685` - // Minimum execution time: 13_420 nanoseconds. - Weight::from_parts(13_649_000, 2685) + // Estimated: `3675` + // Minimum execution time: 15_581 nanoseconds. + Weight::from_ref_time(15_868_000) + .saturating_add(Weight::from_proof_size(3675)) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -124,11 +129,12 @@ impl WeightInfo for SubstrateWeight { fn destroy_accounts(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `25 + c * (240 ±0)` - // Estimated: `5262 + c * (5180 ±0)` - // Minimum execution time: 17_565 nanoseconds. - Weight::from_parts(17_757_000, 5262) - // Standard Error: 15_192 - .saturating_add(Weight::from_ref_time(13_799_167).saturating_mul(c.into())) + // Estimated: `8232 + c * (5180 ±0)` + // Minimum execution time: 20_167 nanoseconds. + Weight::from_ref_time(20_436_000) + .saturating_add(Weight::from_proof_size(8232)) + // Standard Error: 12_761 + .saturating_add(Weight::from_ref_time(15_535_268).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().writes(1_u64)) @@ -143,11 +149,12 @@ impl WeightInfo for SubstrateWeight { fn destroy_approvals(a: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `554 + a * (86 ±0)` - // Estimated: `5308 + a * (2623 ±0)` - // Minimum execution time: 18_251 nanoseconds. - Weight::from_parts(18_359_000, 5308) - // Standard Error: 10_051 - .saturating_add(Weight::from_ref_time(13_613_342).saturating_mul(a.into())) + // Estimated: `7288 + a * (2623 ±0)` + // Minimum execution time: 20_349 nanoseconds. + Weight::from_ref_time(20_482_000) + .saturating_add(Weight::from_proof_size(7288)) + // Standard Error: 9_831 + .saturating_add(Weight::from_ref_time(15_771_918).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into()))) .saturating_add(T::DbWeight::get().writes(1_u64)) @@ -161,9 +168,10 @@ impl WeightInfo for SubstrateWeight { fn finish_destroy() -> Weight { // Proof Size summary in bytes: // Measured: `383` - // Estimated: `5300` - // Minimum execution time: 14_344 nanoseconds. - Weight::from_parts(14_619_000, 5300) + // Estimated: `7280` + // Minimum execution time: 15_647 nanoseconds. + Weight::from_ref_time(15_975_000) + .saturating_add(Weight::from_proof_size(7280)) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -174,9 +182,10 @@ impl WeightInfo for SubstrateWeight { fn mint() -> Weight { // Proof Size summary in bytes: // Measured: `383` - // Estimated: `5262` - // Minimum execution time: 24_992 nanoseconds. - Weight::from_parts(25_784_000, 5262) + // Estimated: `7242` + // Minimum execution time: 28_383 nanoseconds. + Weight::from_ref_time(29_055_000) + .saturating_add(Weight::from_proof_size(7242)) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -187,9 +196,10 @@ impl WeightInfo for SubstrateWeight { fn burn() -> Weight { // Proof Size summary in bytes: // Measured: `491` - // Estimated: `5262` - // Minimum execution time: 31_233 nanoseconds. - Weight::from_parts(31_511_000, 5262) + // Estimated: `7242` + // Minimum execution time: 34_950 nanoseconds. + Weight::from_ref_time(35_296_000) + .saturating_add(Weight::from_proof_size(7242)) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -202,9 +212,10 @@ impl WeightInfo for SubstrateWeight { fn transfer() -> Weight { // Proof Size summary in bytes: // Measured: `530` - // Estimated: `10442` - // Minimum execution time: 43_002 nanoseconds. - Weight::from_parts(43_533_000, 10442) + // Estimated: `13412` + // Minimum execution time: 50_129 nanoseconds. + Weight::from_ref_time(50_820_000) + .saturating_add(Weight::from_proof_size(13412)) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -217,9 +228,10 @@ impl WeightInfo for SubstrateWeight { fn transfer_keep_alive() -> Weight { // Proof Size summary in bytes: // Measured: `530` - // Estimated: `10442` - // Minimum execution time: 38_220 nanoseconds. - Weight::from_parts(38_639_000, 10442) + // Estimated: `13412` + // Minimum execution time: 43_424 nanoseconds. + Weight::from_ref_time(44_080_000) + .saturating_add(Weight::from_proof_size(13412)) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -232,9 +244,10 @@ impl WeightInfo for SubstrateWeight { fn force_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `530` - // Estimated: `10442` - // Minimum execution time: 43_171 nanoseconds. - Weight::from_parts(43_543_000, 10442) + // Estimated: `13412` + // Minimum execution time: 48_919 nanoseconds. + Weight::from_ref_time(50_720_000) + .saturating_add(Weight::from_proof_size(13412)) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -245,9 +258,10 @@ impl WeightInfo for SubstrateWeight { fn freeze() -> Weight { // Proof Size summary in bytes: // Measured: `491` - // Estimated: `5262` - // Minimum execution time: 16_972 nanoseconds. - Weight::from_parts(17_498_000, 5262) + // Estimated: `7242` + // Minimum execution time: 19_750 nanoseconds. + Weight::from_ref_time(20_053_000) + .saturating_add(Weight::from_proof_size(7242)) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -258,9 +272,10 @@ impl WeightInfo for SubstrateWeight { fn thaw() -> Weight { // Proof Size summary in bytes: // Measured: `491` - // Estimated: `5262` - // Minimum execution time: 17_471 nanoseconds. - Weight::from_parts(17_842_000, 5262) + // Estimated: `7242` + // Minimum execution time: 19_672 nanoseconds. + Weight::from_ref_time(19_928_000) + .saturating_add(Weight::from_proof_size(7242)) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -269,9 +284,10 @@ impl WeightInfo for SubstrateWeight { fn freeze_asset() -> Weight { // Proof Size summary in bytes: // Measured: `417` - // Estimated: `2685` - // Minimum execution time: 13_497 nanoseconds. - Weight::from_parts(13_719_000, 2685) + // Estimated: `3675` + // Minimum execution time: 15_367 nanoseconds. + Weight::from_ref_time(15_726_000) + .saturating_add(Weight::from_proof_size(3675)) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -280,9 +296,10 @@ impl WeightInfo for SubstrateWeight { fn thaw_asset() -> Weight { // Proof Size summary in bytes: // Measured: `417` - // Estimated: `2685` - // Minimum execution time: 13_424 nanoseconds. - Weight::from_parts(13_764_000, 2685) + // Estimated: `3675` + // Minimum execution time: 14_814 nanoseconds. + Weight::from_ref_time(15_301_000) + .saturating_add(Weight::from_proof_size(3675)) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -293,9 +310,10 @@ impl WeightInfo for SubstrateWeight { fn transfer_ownership() -> Weight { // Proof Size summary in bytes: // Measured: `383` - // Estimated: `5300` - // Minimum execution time: 15_028 nanoseconds. - Weight::from_parts(15_366_000, 5300) + // Estimated: `7280` + // Minimum execution time: 17_426 nanoseconds. + Weight::from_ref_time(17_804_000) + .saturating_add(Weight::from_proof_size(7280)) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -304,9 +322,10 @@ impl WeightInfo for SubstrateWeight { fn set_team() -> Weight { // Proof Size summary in bytes: // Measured: `383` - // Estimated: `2685` - // Minimum execution time: 14_197 nanoseconds. - Weight::from_parts(14_437_000, 2685) + // Estimated: `3675` + // Minimum execution time: 15_935 nanoseconds. + Weight::from_ref_time(16_165_000) + .saturating_add(Weight::from_proof_size(3675)) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -316,16 +335,15 @@ impl WeightInfo for SubstrateWeight { /// Proof: Assets Metadata (max_values: None, max_size: Some(140), added: 2615, mode: MaxEncodedLen) /// The range of component `n` is `[0, 50]`. /// The range of component `s` is `[0, 50]`. - fn set_metadata(n: u32, s: u32, ) -> Weight { + fn set_metadata(n: u32, _s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `383` - // Estimated: `5300` - // Minimum execution time: 23_707 nanoseconds. - Weight::from_parts(24_466_834, 5300) - // Standard Error: 635 - .saturating_add(Weight::from_ref_time(730).saturating_mul(n.into())) - // Standard Error: 635 - .saturating_add(Weight::from_ref_time(3_975).saturating_mul(s.into())) + // Estimated: `7280` + // Minimum execution time: 26_890 nanoseconds. + Weight::from_ref_time(28_766_510) + .saturating_add(Weight::from_proof_size(7280)) + // Standard Error: 7_444 + .saturating_add(Weight::from_ref_time(3_619).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -336,9 +354,10 @@ impl WeightInfo for SubstrateWeight { fn clear_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `579` - // Estimated: `5300` - // Minimum execution time: 23_997 nanoseconds. - Weight::from_parts(24_812_000, 5300) + // Estimated: `7280` + // Minimum execution time: 27_146 nanoseconds. + Weight::from_ref_time(27_692_000) + .saturating_add(Weight::from_proof_size(7280)) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -348,14 +367,13 @@ impl WeightInfo for SubstrateWeight { /// Proof: Assets Metadata (max_values: None, max_size: Some(140), added: 2615, mode: MaxEncodedLen) /// The range of component `n` is `[0, 50]`. /// The range of component `s` is `[0, 50]`. - fn force_set_metadata(_n: u32, s: u32, ) -> Weight { + fn force_set_metadata(_n: u32, _s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `190` - // Estimated: `5300` - // Minimum execution time: 14_028 nanoseconds. - Weight::from_parts(15_217_669, 5300) - // Standard Error: 2_266 - .saturating_add(Weight::from_ref_time(2_045).saturating_mul(s.into())) + // Estimated: `7280` + // Minimum execution time: 16_181 nanoseconds. + Weight::from_ref_time(18_317_178) + .saturating_add(Weight::from_proof_size(7280)) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -366,9 +384,10 @@ impl WeightInfo for SubstrateWeight { fn force_clear_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `579` - // Estimated: `5300` - // Minimum execution time: 23_754 nanoseconds. - Weight::from_parts(24_154_000, 5300) + // Estimated: `7280` + // Minimum execution time: 26_962 nanoseconds. + Weight::from_ref_time(27_896_000) + .saturating_add(Weight::from_proof_size(7280)) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -377,9 +396,10 @@ impl WeightInfo for SubstrateWeight { fn force_asset_status() -> Weight { // Proof Size summary in bytes: // Measured: `383` - // Estimated: `2685` - // Minimum execution time: 13_128 nanoseconds. - Weight::from_parts(13_428_000, 2685) + // Estimated: `3675` + // Minimum execution time: 14_394 nanoseconds. + Weight::from_ref_time(14_917_000) + .saturating_add(Weight::from_proof_size(3675)) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -390,9 +410,10 @@ impl WeightInfo for SubstrateWeight { fn approve_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `417` - // Estimated: `5308` - // Minimum execution time: 27_224 nanoseconds. - Weight::from_parts(27_665_000, 5308) + // Estimated: `7288` + // Minimum execution time: 30_861 nanoseconds. + Weight::from_ref_time(31_356_000) + .saturating_add(Weight::from_proof_size(7288)) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -407,9 +428,10 @@ impl WeightInfo for SubstrateWeight { fn transfer_approved() -> Weight { // Proof Size summary in bytes: // Measured: `700` - // Estimated: `13065` - // Minimum execution time: 55_837 nanoseconds. - Weight::from_parts(56_636_000, 13065) + // Estimated: `17025` + // Minimum execution time: 64_510 nanoseconds. + Weight::from_ref_time(65_676_000) + .saturating_add(Weight::from_proof_size(17025)) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -420,9 +442,10 @@ impl WeightInfo for SubstrateWeight { fn cancel_approval() -> Weight { // Proof Size summary in bytes: // Measured: `587` - // Estimated: `5308` - // Minimum execution time: 28_915 nanoseconds. - Weight::from_parts(29_325_000, 5308) + // Estimated: `7288` + // Minimum execution time: 32_620 nanoseconds. + Weight::from_ref_time(33_183_000) + .saturating_add(Weight::from_proof_size(7288)) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -433,12 +456,25 @@ impl WeightInfo for SubstrateWeight { fn force_cancel_approval() -> Weight { // Proof Size summary in bytes: // Measured: `587` - // Estimated: `5308` - // Minimum execution time: 29_103 nanoseconds. - Weight::from_parts(29_599_000, 5308) + // Estimated: `7288` + // Minimum execution time: 33_277 nanoseconds. + Weight::from_ref_time(34_438_000) + .saturating_add(Weight::from_proof_size(7288)) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + fn set_min_balance() -> Weight { + // Proof Size summary in bytes: + // Measured: `383` + // Estimated: `3675` + // Minimum execution time: 16_213 nanoseconds. + Weight::from_ref_time(16_575_000) + .saturating_add(Weight::from_proof_size(3675)) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } } // For backwards compatibility and tests @@ -450,9 +486,10 @@ impl WeightInfo for () { fn create() -> Weight { // Proof Size summary in bytes: // Measured: `325` - // Estimated: `5288` - // Minimum execution time: 23_623 nanoseconds. - Weight::from_parts(24_072_000, 5288) + // Estimated: `7268` + // Minimum execution time: 27_887 nanoseconds. + Weight::from_ref_time(28_190_000) + .saturating_add(Weight::from_proof_size(7268)) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -461,9 +498,10 @@ impl WeightInfo for () { fn force_create() -> Weight { // Proof Size summary in bytes: // Measured: `153` - // Estimated: `2685` - // Minimum execution time: 13_145 nanoseconds. - Weight::from_parts(13_572_000, 2685) + // Estimated: `3675` + // Minimum execution time: 15_059 nanoseconds. + Weight::from_ref_time(15_600_000) + .saturating_add(Weight::from_proof_size(3675)) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -472,9 +510,10 @@ impl WeightInfo for () { fn start_destroy() -> Weight { // Proof Size summary in bytes: // Measured: `417` - // Estimated: `2685` - // Minimum execution time: 13_420 nanoseconds. - Weight::from_parts(13_649_000, 2685) + // Estimated: `3675` + // Minimum execution time: 15_581 nanoseconds. + Weight::from_ref_time(15_868_000) + .saturating_add(Weight::from_proof_size(3675)) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -488,11 +527,12 @@ impl WeightInfo for () { fn destroy_accounts(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `25 + c * (240 ±0)` - // Estimated: `5262 + c * (5180 ±0)` - // Minimum execution time: 17_565 nanoseconds. - Weight::from_parts(17_757_000, 5262) - // Standard Error: 15_192 - .saturating_add(Weight::from_ref_time(13_799_167).saturating_mul(c.into())) + // Estimated: `8232 + c * (5180 ±0)` + // Minimum execution time: 20_167 nanoseconds. + Weight::from_ref_time(20_436_000) + .saturating_add(Weight::from_proof_size(8232)) + // Standard Error: 12_761 + .saturating_add(Weight::from_ref_time(15_535_268).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().reads((2_u64).saturating_mul(c.into()))) .saturating_add(RocksDbWeight::get().writes(1_u64)) @@ -507,11 +547,12 @@ impl WeightInfo for () { fn destroy_approvals(a: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `554 + a * (86 ±0)` - // Estimated: `5308 + a * (2623 ±0)` - // Minimum execution time: 18_251 nanoseconds. - Weight::from_parts(18_359_000, 5308) - // Standard Error: 10_051 - .saturating_add(Weight::from_ref_time(13_613_342).saturating_mul(a.into())) + // Estimated: `7288 + a * (2623 ±0)` + // Minimum execution time: 20_349 nanoseconds. + Weight::from_ref_time(20_482_000) + .saturating_add(Weight::from_proof_size(7288)) + // Standard Error: 9_831 + .saturating_add(Weight::from_ref_time(15_771_918).saturating_mul(a.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(a.into()))) .saturating_add(RocksDbWeight::get().writes(1_u64)) @@ -525,9 +566,10 @@ impl WeightInfo for () { fn finish_destroy() -> Weight { // Proof Size summary in bytes: // Measured: `383` - // Estimated: `5300` - // Minimum execution time: 14_344 nanoseconds. - Weight::from_parts(14_619_000, 5300) + // Estimated: `7280` + // Minimum execution time: 15_647 nanoseconds. + Weight::from_ref_time(15_975_000) + .saturating_add(Weight::from_proof_size(7280)) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -538,9 +580,10 @@ impl WeightInfo for () { fn mint() -> Weight { // Proof Size summary in bytes: // Measured: `383` - // Estimated: `5262` - // Minimum execution time: 24_992 nanoseconds. - Weight::from_parts(25_784_000, 5262) + // Estimated: `7242` + // Minimum execution time: 28_383 nanoseconds. + Weight::from_ref_time(29_055_000) + .saturating_add(Weight::from_proof_size(7242)) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -551,9 +594,10 @@ impl WeightInfo for () { fn burn() -> Weight { // Proof Size summary in bytes: // Measured: `491` - // Estimated: `5262` - // Minimum execution time: 31_233 nanoseconds. - Weight::from_parts(31_511_000, 5262) + // Estimated: `7242` + // Minimum execution time: 34_950 nanoseconds. + Weight::from_ref_time(35_296_000) + .saturating_add(Weight::from_proof_size(7242)) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -566,9 +610,10 @@ impl WeightInfo for () { fn transfer() -> Weight { // Proof Size summary in bytes: // Measured: `530` - // Estimated: `10442` - // Minimum execution time: 43_002 nanoseconds. - Weight::from_parts(43_533_000, 10442) + // Estimated: `13412` + // Minimum execution time: 50_129 nanoseconds. + Weight::from_ref_time(50_820_000) + .saturating_add(Weight::from_proof_size(13412)) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -581,9 +626,10 @@ impl WeightInfo for () { fn transfer_keep_alive() -> Weight { // Proof Size summary in bytes: // Measured: `530` - // Estimated: `10442` - // Minimum execution time: 38_220 nanoseconds. - Weight::from_parts(38_639_000, 10442) + // Estimated: `13412` + // Minimum execution time: 43_424 nanoseconds. + Weight::from_ref_time(44_080_000) + .saturating_add(Weight::from_proof_size(13412)) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -596,9 +642,10 @@ impl WeightInfo for () { fn force_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `530` - // Estimated: `10442` - // Minimum execution time: 43_171 nanoseconds. - Weight::from_parts(43_543_000, 10442) + // Estimated: `13412` + // Minimum execution time: 48_919 nanoseconds. + Weight::from_ref_time(50_720_000) + .saturating_add(Weight::from_proof_size(13412)) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -609,9 +656,10 @@ impl WeightInfo for () { fn freeze() -> Weight { // Proof Size summary in bytes: // Measured: `491` - // Estimated: `5262` - // Minimum execution time: 16_972 nanoseconds. - Weight::from_parts(17_498_000, 5262) + // Estimated: `7242` + // Minimum execution time: 19_750 nanoseconds. + Weight::from_ref_time(20_053_000) + .saturating_add(Weight::from_proof_size(7242)) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -622,9 +670,10 @@ impl WeightInfo for () { fn thaw() -> Weight { // Proof Size summary in bytes: // Measured: `491` - // Estimated: `5262` - // Minimum execution time: 17_471 nanoseconds. - Weight::from_parts(17_842_000, 5262) + // Estimated: `7242` + // Minimum execution time: 19_672 nanoseconds. + Weight::from_ref_time(19_928_000) + .saturating_add(Weight::from_proof_size(7242)) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -633,9 +682,10 @@ impl WeightInfo for () { fn freeze_asset() -> Weight { // Proof Size summary in bytes: // Measured: `417` - // Estimated: `2685` - // Minimum execution time: 13_497 nanoseconds. - Weight::from_parts(13_719_000, 2685) + // Estimated: `3675` + // Minimum execution time: 15_367 nanoseconds. + Weight::from_ref_time(15_726_000) + .saturating_add(Weight::from_proof_size(3675)) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -644,9 +694,10 @@ impl WeightInfo for () { fn thaw_asset() -> Weight { // Proof Size summary in bytes: // Measured: `417` - // Estimated: `2685` - // Minimum execution time: 13_424 nanoseconds. - Weight::from_parts(13_764_000, 2685) + // Estimated: `3675` + // Minimum execution time: 14_814 nanoseconds. + Weight::from_ref_time(15_301_000) + .saturating_add(Weight::from_proof_size(3675)) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -657,9 +708,10 @@ impl WeightInfo for () { fn transfer_ownership() -> Weight { // Proof Size summary in bytes: // Measured: `383` - // Estimated: `5300` - // Minimum execution time: 15_028 nanoseconds. - Weight::from_parts(15_366_000, 5300) + // Estimated: `7280` + // Minimum execution time: 17_426 nanoseconds. + Weight::from_ref_time(17_804_000) + .saturating_add(Weight::from_proof_size(7280)) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -668,9 +720,10 @@ impl WeightInfo for () { fn set_team() -> Weight { // Proof Size summary in bytes: // Measured: `383` - // Estimated: `2685` - // Minimum execution time: 14_197 nanoseconds. - Weight::from_parts(14_437_000, 2685) + // Estimated: `3675` + // Minimum execution time: 15_935 nanoseconds. + Weight::from_ref_time(16_165_000) + .saturating_add(Weight::from_proof_size(3675)) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -680,16 +733,15 @@ impl WeightInfo for () { /// Proof: Assets Metadata (max_values: None, max_size: Some(140), added: 2615, mode: MaxEncodedLen) /// The range of component `n` is `[0, 50]`. /// The range of component `s` is `[0, 50]`. - fn set_metadata(n: u32, s: u32, ) -> Weight { + fn set_metadata(n: u32, _s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `383` - // Estimated: `5300` - // Minimum execution time: 23_707 nanoseconds. - Weight::from_parts(24_466_834, 5300) - // Standard Error: 635 - .saturating_add(Weight::from_ref_time(730).saturating_mul(n.into())) - // Standard Error: 635 - .saturating_add(Weight::from_ref_time(3_975).saturating_mul(s.into())) + // Estimated: `7280` + // Minimum execution time: 26_890 nanoseconds. + Weight::from_ref_time(28_766_510) + .saturating_add(Weight::from_proof_size(7280)) + // Standard Error: 7_444 + .saturating_add(Weight::from_ref_time(3_619).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -700,9 +752,10 @@ impl WeightInfo for () { fn clear_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `579` - // Estimated: `5300` - // Minimum execution time: 23_997 nanoseconds. - Weight::from_parts(24_812_000, 5300) + // Estimated: `7280` + // Minimum execution time: 27_146 nanoseconds. + Weight::from_ref_time(27_692_000) + .saturating_add(Weight::from_proof_size(7280)) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -712,14 +765,13 @@ impl WeightInfo for () { /// Proof: Assets Metadata (max_values: None, max_size: Some(140), added: 2615, mode: MaxEncodedLen) /// The range of component `n` is `[0, 50]`. /// The range of component `s` is `[0, 50]`. - fn force_set_metadata(_n: u32, s: u32, ) -> Weight { + fn force_set_metadata(_n: u32, _s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `190` - // Estimated: `5300` - // Minimum execution time: 14_028 nanoseconds. - Weight::from_parts(15_217_669, 5300) - // Standard Error: 2_266 - .saturating_add(Weight::from_ref_time(2_045).saturating_mul(s.into())) + // Estimated: `7280` + // Minimum execution time: 16_181 nanoseconds. + Weight::from_ref_time(18_317_178) + .saturating_add(Weight::from_proof_size(7280)) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -730,9 +782,10 @@ impl WeightInfo for () { fn force_clear_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `579` - // Estimated: `5300` - // Minimum execution time: 23_754 nanoseconds. - Weight::from_parts(24_154_000, 5300) + // Estimated: `7280` + // Minimum execution time: 26_962 nanoseconds. + Weight::from_ref_time(27_896_000) + .saturating_add(Weight::from_proof_size(7280)) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -741,9 +794,10 @@ impl WeightInfo for () { fn force_asset_status() -> Weight { // Proof Size summary in bytes: // Measured: `383` - // Estimated: `2685` - // Minimum execution time: 13_128 nanoseconds. - Weight::from_parts(13_428_000, 2685) + // Estimated: `3675` + // Minimum execution time: 14_394 nanoseconds. + Weight::from_ref_time(14_917_000) + .saturating_add(Weight::from_proof_size(3675)) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -754,9 +808,10 @@ impl WeightInfo for () { fn approve_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `417` - // Estimated: `5308` - // Minimum execution time: 27_224 nanoseconds. - Weight::from_parts(27_665_000, 5308) + // Estimated: `7288` + // Minimum execution time: 30_861 nanoseconds. + Weight::from_ref_time(31_356_000) + .saturating_add(Weight::from_proof_size(7288)) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -771,9 +826,10 @@ impl WeightInfo for () { fn transfer_approved() -> Weight { // Proof Size summary in bytes: // Measured: `700` - // Estimated: `13065` - // Minimum execution time: 55_837 nanoseconds. - Weight::from_parts(56_636_000, 13065) + // Estimated: `17025` + // Minimum execution time: 64_510 nanoseconds. + Weight::from_ref_time(65_676_000) + .saturating_add(Weight::from_proof_size(17025)) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -784,9 +840,10 @@ impl WeightInfo for () { fn cancel_approval() -> Weight { // Proof Size summary in bytes: // Measured: `587` - // Estimated: `5308` - // Minimum execution time: 28_915 nanoseconds. - Weight::from_parts(29_325_000, 5308) + // Estimated: `7288` + // Minimum execution time: 32_620 nanoseconds. + Weight::from_ref_time(33_183_000) + .saturating_add(Weight::from_proof_size(7288)) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -797,10 +854,23 @@ impl WeightInfo for () { fn force_cancel_approval() -> Weight { // Proof Size summary in bytes: // Measured: `587` - // Estimated: `5308` - // Minimum execution time: 29_103 nanoseconds. - Weight::from_parts(29_599_000, 5308) + // Estimated: `7288` + // Minimum execution time: 33_277 nanoseconds. + Weight::from_ref_time(34_438_000) + .saturating_add(Weight::from_proof_size(7288)) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + fn set_min_balance() -> Weight { + // Proof Size summary in bytes: + // Measured: `383` + // Estimated: `3675` + // Minimum execution time: 16_213 nanoseconds. + Weight::from_ref_time(16_575_000) + .saturating_add(Weight::from_proof_size(3675)) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) + } }