diff --git a/CHANGELOG.md b/CHANGELOG.md index 93e3581494..88f7d784c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,9 +10,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Add `pallet-assets` on Polkadot People to support HOLLAR (and more assets in the future) ([polkadot-fellows/runtimes/pull/962](https://github.com/polkadot-fellows/runtimes/pull/962)) - Encointer: add pallets `offline-payment` and `reputation-rings` and fixes ([polkadot-fellows/runtimes/pull/1082](https://github.com/polkadot-fellows/runtimes/pull/1082)) +- Add `pallet_multi_asset_bounties` pallet to Asset Hub Kusama and Asset Hub Polkadot for multi-asset bounty support ([#1070](https://github.com/polkadot-fellows/runtimes/pull/1070)) ### Changed +- Remove local pay module in favor of upstream implementation ([#1070](https://github.com/polkadot-fellows/runtimes/pull/1070)) - Update Kusama submission deposit to 3.333KSM as per [ref 588](https://kusama.subsquare.io/referenda/558) - Re-add StakingOperator proxy type and allow Staking proxy to add/remove a StakingOperator [#1033](https://github.com/polkadot-fellows/runtimes/pull/1033) - Fix check-migration(asset-hub-polkadot) CI job [#1057](https://github.com/polkadot-fellows/runtimes/pull/1057) diff --git a/Cargo.lock b/Cargo.lock index 6dbca76f49..567e206bd6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1197,6 +1197,7 @@ dependencies = [ "pallet-indices", "pallet-message-queue", "pallet-migrations", + "pallet-multi-asset-bounties", "pallet-multisig", "pallet-nft-fractionalization", "pallet-nfts", @@ -1383,6 +1384,7 @@ dependencies = [ "pallet-election-provider-multi-block", "pallet-indices", "pallet-message-queue", + "pallet-multi-asset-bounties", "pallet-multisig", "pallet-nfts", "pallet-nfts-runtime-api", @@ -18081,18 +18083,13 @@ dependencies = [ "cumulus-primitives-core", "frame-support", "log", - "pallet-treasury", - "parachains-common", + "pallet-multi-asset-bounties", "parity-scale-codec", "polkadot-primitives", - "polkadot-runtime-common", "scale-info", "sp-api 40.0.0", - "sp-core 39.0.0", "sp-runtime 45.0.0", "sp-state-machine 0.49.0", - "staging-xcm", - "staging-xcm-executor", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 814d0e1808..c12483c995 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -145,6 +145,7 @@ pallet-insecure-randomness-collective-flip = { version = "33.0.0", default-featu pallet-membership = { version = "45.0.0", default-features = false } pallet-message-queue = { version = "48.0.0", default-features = false } pallet-mmr = { version = "45.0.0", default-features = false } +pallet-multi-asset-bounties = { version = "0.2.1", default-features = false } pallet-multisig = { version = "45.0.0", default-features = false } pallet-nft-fractionalization = { version = "29.0.0", default-features = false } pallet-nfts = { version = "39.0.0", default-features = false } diff --git a/system-parachains/asset-hubs/asset-hub-kusama/Cargo.toml b/system-parachains/asset-hubs/asset-hub-kusama/Cargo.toml index 68752dfebf..376137f781 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/Cargo.toml +++ b/system-parachains/asset-hubs/asset-hub-kusama/Cargo.toml @@ -26,7 +26,7 @@ bp-bridge-hub-kusama = { workspace = true } bp-bridge-hub-polkadot = { workspace = true } kusama-runtime-constants = { workspace = true } system-parachains-constants = { workspace = true } -system-parachains-common = { workspace = true } +system-parachains-common = { workspace = true, features = ["multi-asset-bounties"] } pallet-remote-proxy = { workspace = true } # Substrate @@ -56,6 +56,7 @@ pallet-indices = { workspace = true } pallet-message-queue = { workspace = true } pallet-migrations = { workspace = true } pallet-multisig = { workspace = true } +pallet-multi-asset-bounties = { workspace = true } pallet-nomination-pools = { workspace = true } pallet-nft-fractionalization = { workspace = true } pallet-nfts = { workspace = true } @@ -198,6 +199,7 @@ runtime-benchmarks = [ "pallet-indices/runtime-benchmarks", "pallet-message-queue/runtime-benchmarks", "pallet-migrations/runtime-benchmarks", + "pallet-multi-asset-bounties/runtime-benchmarks", "pallet-multisig/runtime-benchmarks", "pallet-nft-fractionalization/runtime-benchmarks", "pallet-nfts/runtime-benchmarks", @@ -277,6 +279,7 @@ try-runtime = [ "pallet-indices/try-runtime", "pallet-message-queue/try-runtime", "pallet-migrations/try-runtime", + "pallet-multi-asset-bounties/try-runtime", "pallet-multisig/try-runtime", "pallet-nft-fractionalization/try-runtime", "pallet-nfts/try-runtime", @@ -365,6 +368,7 @@ std = [ "pallet-indices/std", "pallet-message-queue/std", "pallet-migrations/std", + "pallet-multi-asset-bounties/std", "pallet-multisig/std", "pallet-nft-fractionalization/std", "pallet-nfts-runtime-api/std", @@ -441,4 +445,8 @@ metadata-hash = ["substrate-wasm-builder?/metadata-hash"] # A feature that should be enabled when the runtime should be built for on-chain # deployment. This will disable stuff that shouldn't be part of the on-chain wasm # to make it smaller, like logging for example. -on-chain-release-build = ["kusama-ahm", "metadata-hash", "sp-api/disable-logging"] +on-chain-release-build = [ + "kusama-ahm", + "metadata-hash", + "sp-api/disable-logging", +] diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/ah_migration/call_filter.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/ah_migration/call_filter.rs index 35ba2fab5b..ee7049f28e 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/src/ah_migration/call_filter.rs +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/ah_migration/call_filter.rs @@ -97,6 +97,7 @@ pub fn call_allowed_status( Bounties(..) => OFF, ChildBounties(..) => OFF, Claims(..) => OFF, + MultiAssetBounties(..) => OFF, CollatorSelection(..) => ON, // Why? ConvictionVoting(..) => OFF, CumulusXcm(..) => OFF, /* Empty call enum, see https://github.com/paritytech/polkadot-sdk/issues/8222 */ @@ -172,6 +173,7 @@ pub fn call_allowed_before_migration( // Governance disabled before migration starts. Bounties(..) => OFF, ChildBounties(..) => OFF, + MultiAssetBounties(..) => OFF, ConvictionVoting(..) => OFF, Referenda(..) => OFF, Treasury(..) => OFF, diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs index f618a823e7..612777086f 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs @@ -654,6 +654,7 @@ impl InstanceFilter for ProxyType { RuntimeCall::Treasury(..) | RuntimeCall::Bounties(..) | RuntimeCall::ChildBounties(..) | + RuntimeCall::MultiAssetBounties(..) | RuntimeCall::ConvictionVoting(..) | RuntimeCall::Referenda(..) | // Not on AH RuntimeCall::FellowshipCollective(..) | @@ -690,6 +691,7 @@ impl InstanceFilter for ProxyType { RuntimeCall::Bounties(..) | RuntimeCall::Utility(..) | RuntimeCall::ChildBounties(..) | + RuntimeCall::MultiAssetBounties(..) | // OpenGov calls RuntimeCall::ConvictionVoting(..) | RuntimeCall::Referenda(..) | @@ -1693,6 +1695,7 @@ construct_runtime!( Bounties: pallet_bounties = 95, ChildBounties: pallet_child_bounties = 96, AssetRate: pallet_asset_rate = 97, + MultiAssetBounties: pallet_multi_asset_bounties = 98, // Asset Hub Migration in the 250s AhOps: pallet_ah_ops = 254, @@ -1902,6 +1905,7 @@ mod benches { [pallet_whitelist, Whitelist] [pallet_bounties, Bounties] [pallet_child_bounties, ChildBounties] + [pallet_multi_asset_bounties, MultiAssetBounties] [pallet_asset_rate, AssetRate] [pallet_ah_migrator, AhMigrator] [pallet_indices, Indices] diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/treasury.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/treasury.rs index 17d94c69e7..fdcefb7e7f 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/src/treasury.rs +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/treasury.rs @@ -20,9 +20,10 @@ use super::*; use crate::governance::{Treasurer, TreasurySpender}; use frame_support::traits::{ - tokens::UnityOrOuterConversion, Currency, FromContains, Get, OnUnbalanced, + fungible::HoldConsideration, tokens::UnityOrOuterConversion, Currency, FromContains, Get, + OnUnbalanced, }; -use parachains_common::pay::VersionedLocatableAccount; +use parachains_common::pay::{AccountIdToLocalLocation, LocalPay, VersionedLocatableAccount}; use polkadot_runtime_common::impls::{ContainsParts, VersionedLocatableAsset}; use scale_info::TypeInfo; use sp_runtime::traits::IdentityLookup; @@ -38,7 +39,7 @@ parameter_types! { pub TreasuryAccount: AccountId = Treasury::account_id(); } -pub type TreasuryPaymaster = system_parachains_common::pay::LocalPay< +pub type TreasuryPaymaster = parachains_common::pay::LocalPay< NativeAndAssets, TreasuryAccount, xcm_config::LocationToAccountId, @@ -113,7 +114,7 @@ impl pallet_treasury::Config for Runtime { type BalanceConverter = AssetRateWithNative; type PayoutPeriod = PayoutSpendPeriod; #[cfg(feature = "runtime-benchmarks")] - type BenchmarkHelper = system_parachains_common::pay::benchmarks::LocalPayArguments< + type BenchmarkHelper = parachains_common::pay::benchmarks::LocalPayArguments< xcm_config::TrustBackedAssetsPalletIndex, >; type BlockNumberProvider = RelaychainDataProvider; @@ -162,6 +163,60 @@ impl pallet_child_bounties::Config for Runtime { type WeightInfo = weights::pallet_child_bounties::WeightInfo; } +parameter_types! { + pub const MultiAssetCuratorHoldReason: RuntimeHoldReason = + RuntimeHoldReason::MultiAssetBounties(pallet_multi_asset_bounties::HoldReason::CuratorDeposit); +} + +impl pallet_multi_asset_bounties::Config for Runtime { + type Balance = Balance; + type RejectOrigin = EitherOfDiverse, Treasurer>; + type SpendOrigin = TreasurySpender; + type AssetKind = VersionedLocatableAsset; + type Beneficiary = VersionedLocatableAccount; + type BeneficiaryLookup = IdentityLookup; + type BountyValueMinimum = BountyValueMinimum; + type ChildBountyValueMinimum = ChildBountyValueMinimum; + type MaxActiveChildBountyCount = MaxActiveChildBountyCount; + type WeightInfo = weights::pallet_multi_asset_bounties::WeightInfo; + type FundingSource = pallet_multi_asset_bounties::PalletIdAsFundingSource< + TreasuryPalletId, + Runtime, + AccountIdToLocalLocation, + >; + type BountySource = + system_parachains_common::multi_asset_bounty_sources::MultiAssetBountySourceFromPalletId< + TreasuryPalletId, + Runtime, + AccountIdToLocalLocation, + >; + type ChildBountySource = + system_parachains_common::multi_asset_bounty_sources::MultiAssetChildBountySourceFromPalletId< + TreasuryPalletId, + Runtime, + AccountIdToLocalLocation, + >; + type Paymaster = LocalPay; + type BalanceConverter = AssetRateWithNative; + type Preimages = Preimage; + type Consideration = HoldConsideration< + AccountId, + Balances, + MultiAssetCuratorHoldReason, + pallet_multi_asset_bounties::CuratorDepositAmount< + CuratorDepositMultiplier, + CuratorDepositMin, + CuratorDepositMax, + Balance, + >, + Balance, + >; + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkHelper = parachains_common::pay::benchmarks::LocalPayWithSourceArguments< + xcm_config::TrustBackedAssetsPalletIndex, + >; +} + /// The [frame_support::traits::tokens::ConversionFromAssetBalance] implementation provided by the /// `AssetRate` pallet instance. /// diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/weights/mod.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/mod.rs index a082cf3bc8..805b96dc62 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/src/weights/mod.rs +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/mod.rs @@ -34,6 +34,7 @@ pub mod pallet_collator_selection; pub mod pallet_conviction_voting; pub mod pallet_message_queue; pub mod pallet_migrations; +pub mod pallet_multi_asset_bounties; pub mod pallet_multisig; pub mod pallet_nft_fractionalization; pub mod pallet_nfts; diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_multi_asset_bounties.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_multi_asset_bounties.rs new file mode 100644 index 0000000000..702a7cb6cc --- /dev/null +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_multi_asset_bounties.rs @@ -0,0 +1,367 @@ +// Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md +// for a list of specific contributors. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Autogenerated weights for `pallet_multi_asset_bounties` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 53.0.0 +//! DATE: 2026-02-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `bm1-3`, CPU: `Intel(R) Xeon(R) E-2388G CPU @ 3.20GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --extrinsic=* +// --runtime=target/production/wbuild/asset-hub-kusama-runtime/asset_hub_kusama_runtime.wasm +// --pallet=pallet_multi_asset_bounties +// --header=/opt/actions-runner/_work/runtimes/runtimes/.github/scripts/cmd/file_header.txt +// --output=./system-parachains/asset-hubs/asset-hub-kusama/src/weights +// --wasm-execution=compiled +// --steps=50 +// --repeat=20 +// --heap-pages=4096 + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_multi_asset_bounties`. +pub struct WeightInfo(PhantomData); +impl pallet_multi_asset_bounties::WeightInfo for WeightInfo { + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `AssetRate::ConversionRateToNative` (r:1 w:0) + /// Proof: `AssetRate::ConversionRateToNative` (`max_values`: None, `max_size`: Some(1238), added: 3713, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::BountyCount` (r:1 w:1) + /// Proof: `MultiAssetBounties::BountyCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Assets::Asset` (r:1 w:1) + /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `Assets::Account` (r:2 w:2) + /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::Bounties` (r:0 w:1) + /// Proof: `MultiAssetBounties::Bounties` (`max_values`: None, `max_size`: Some(2513), added: 4988, mode: `MaxEncodedLen`) + fn fund_bounty() -> Weight { + // Proof Size summary in bytes: + // Measured: `2359` + // Estimated: `6208` + // Minimum execution time: 81_569_000 picoseconds. + Weight::from_parts(83_164_000, 0) + .saturating_add(Weight::from_parts(0, 6208)) + .saturating_add(T::DbWeight::get().reads(9)) + .saturating_add(T::DbWeight::get().writes(8)) + } + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::Bounties` (r:1 w:0) + /// Proof: `MultiAssetBounties::Bounties` (`max_values`: None, `max_size`: Some(2513), added: 4988, mode: `MaxEncodedLen`) + /// Storage: `AssetRate::ConversionRateToNative` (r:1 w:0) + /// Proof: `AssetRate::ConversionRateToNative` (`max_values`: None, `max_size`: Some(1238), added: 3713, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::ChildBountiesPerParent` (r:1 w:1) + /// Proof: `MultiAssetBounties::ChildBountiesPerParent` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::ChildBountiesValuePerParent` (r:1 w:1) + /// Proof: `MultiAssetBounties::ChildBountiesValuePerParent` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::TotalChildBountiesPerParent` (r:1 w:1) + /// Proof: `MultiAssetBounties::TotalChildBountiesPerParent` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`) + /// Storage: `Assets::Asset` (r:1 w:1) + /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `Assets::Account` (r:2 w:2) + /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::ChildBounties` (r:0 w:1) + /// Proof: `MultiAssetBounties::ChildBounties` (`max_values`: None, `max_size`: Some(1323), added: 3798, mode: `MaxEncodedLen`) + fn fund_child_bounty() -> Weight { + // Proof Size summary in bytes: + // Measured: `1469` + // Estimated: `6208` + // Minimum execution time: 88_553_000 picoseconds. + Weight::from_parts(89_951_000, 0) + .saturating_add(Weight::from_parts(0, 6208)) + .saturating_add(T::DbWeight::get().reads(11)) + .saturating_add(T::DbWeight::get().writes(9)) + } + /// Storage: `MultiAssetBounties::Bounties` (r:1 w:1) + /// Proof: `MultiAssetBounties::Bounties` (`max_values`: None, `max_size`: Some(2513), added: 4988, mode: `MaxEncodedLen`) + /// Storage: `AssetRate::ConversionRateToNative` (r:1 w:0) + /// Proof: `AssetRate::ConversionRateToNative` (`max_values`: None, `max_size`: Some(1238), added: 3713, mode: `MaxEncodedLen`) + fn propose_curator_parent_bounty() -> Weight { + // Proof Size summary in bytes: + // Measured: `307` + // Estimated: `5978` + // Minimum execution time: 25_283_000 picoseconds. + Weight::from_parts(25_614_000, 0) + .saturating_add(Weight::from_parts(0, 5978)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `MultiAssetBounties::Bounties` (r:1 w:0) + /// Proof: `MultiAssetBounties::Bounties` (`max_values`: None, `max_size`: Some(2513), added: 4988, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::ChildBounties` (r:1 w:1) + /// Proof: `MultiAssetBounties::ChildBounties` (`max_values`: None, `max_size`: Some(1323), added: 3798, mode: `MaxEncodedLen`) + fn propose_curator_child_bounty() -> Weight { + // Proof Size summary in bytes: + // Measured: `468` + // Estimated: `5978` + // Minimum execution time: 24_034_000 picoseconds. + Weight::from_parts(24_766_000, 0) + .saturating_add(Weight::from_parts(0, 5978)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `MultiAssetBounties::Bounties` (r:1 w:0) + /// Proof: `MultiAssetBounties::Bounties` (`max_values`: None, `max_size`: Some(2513), added: 4988, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::ChildBounties` (r:1 w:1) + /// Proof: `MultiAssetBounties::ChildBounties` (`max_values`: None, `max_size`: Some(1323), added: 3798, mode: `MaxEncodedLen`) + /// Storage: `AssetRate::ConversionRateToNative` (r:1 w:0) + /// Proof: `AssetRate::ConversionRateToNative` (`max_values`: None, `max_size`: Some(1238), added: 3713, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(283), added: 2758, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::CuratorDeposit` (r:0 w:1) + /// Proof: `MultiAssetBounties::CuratorDeposit` (`max_values`: None, `max_size`: Some(41), added: 2516, mode: `MaxEncodedLen`) + fn accept_curator() -> Weight { + // Proof Size summary in bytes: + // Measured: `3341` + // Estimated: `5978` + // Minimum execution time: 76_683_000 picoseconds. + Weight::from_parts(77_894_000, 0) + .saturating_add(Weight::from_parts(0, 5978)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `MultiAssetBounties::Bounties` (r:1 w:0) + /// Proof: `MultiAssetBounties::Bounties` (`max_values`: None, `max_size`: Some(2513), added: 4988, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::ChildBounties` (r:1 w:1) + /// Proof: `MultiAssetBounties::ChildBounties` (`max_values`: None, `max_size`: Some(1323), added: 3798, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::CuratorDeposit` (r:1 w:1) + /// Proof: `MultiAssetBounties::CuratorDeposit` (`max_values`: None, `max_size`: Some(41), added: 2516, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(283), added: 2758, mode: `MaxEncodedLen`) + fn unassign_curator() -> Weight { + // Proof Size summary in bytes: + // Measured: `3365` + // Estimated: `5978` + // Minimum execution time: 59_654_000 picoseconds. + Weight::from_parts(61_392_000, 0) + .saturating_add(Weight::from_parts(0, 5978)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `MultiAssetBounties::Bounties` (r:1 w:0) + /// Proof: `MultiAssetBounties::Bounties` (`max_values`: None, `max_size`: Some(2513), added: 4988, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::ChildBounties` (r:1 w:1) + /// Proof: `MultiAssetBounties::ChildBounties` (`max_values`: None, `max_size`: Some(1323), added: 3798, mode: `MaxEncodedLen`) + /// Storage: `Assets::Asset` (r:1 w:1) + /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `Assets::Account` (r:2 w:2) + /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn award_bounty() -> Weight { + // Proof Size summary in bytes: + // Measured: `2854` + // Estimated: `6208` + // Minimum execution time: 79_695_000 picoseconds. + Weight::from_parts(81_369_000, 0) + .saturating_add(Weight::from_parts(0, 6208)) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(6)) + } + /// Storage: `MultiAssetBounties::Bounties` (r:1 w:1) + /// Proof: `MultiAssetBounties::Bounties` (`max_values`: None, `max_size`: Some(2513), added: 4988, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::ChildBountiesPerParent` (r:1 w:0) + /// Proof: `MultiAssetBounties::ChildBountiesPerParent` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`) + /// Storage: `Assets::Asset` (r:1 w:1) + /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `Assets::Account` (r:2 w:2) + /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn close_parent_bounty() -> Weight { + // Proof Size summary in bytes: + // Measured: `2465` + // Estimated: `6208` + // Minimum execution time: 73_503_000 picoseconds. + Weight::from_parts(74_619_000, 0) + .saturating_add(Weight::from_parts(0, 6208)) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(6)) + } + /// Storage: `MultiAssetBounties::Bounties` (r:1 w:0) + /// Proof: `MultiAssetBounties::Bounties` (`max_values`: None, `max_size`: Some(2513), added: 4988, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::ChildBounties` (r:1 w:1) + /// Proof: `MultiAssetBounties::ChildBounties` (`max_values`: None, `max_size`: Some(1323), added: 3798, mode: `MaxEncodedLen`) + /// Storage: `Assets::Asset` (r:1 w:1) + /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `Assets::Account` (r:2 w:2) + /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn close_child_bounty() -> Weight { + // Proof Size summary in bytes: + // Measured: `1702` + // Estimated: `6208` + // Minimum execution time: 70_807_000 picoseconds. + Weight::from_parts(72_093_000, 0) + .saturating_add(Weight::from_parts(0, 6208)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(5)) + } + /// Storage: `MultiAssetBounties::Bounties` (r:1 w:0) + /// Proof: `MultiAssetBounties::Bounties` (`max_values`: None, `max_size`: Some(2513), added: 4988, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::ChildBounties` (r:1 w:1) + /// Proof: `MultiAssetBounties::ChildBounties` (`max_values`: None, `max_size`: Some(1323), added: 3798, mode: `MaxEncodedLen`) + fn check_status_funding() -> Weight { + // Proof Size summary in bytes: + // Measured: `510` + // Estimated: `5978` + // Minimum execution time: 24_269_000 picoseconds. + Weight::from_parts(24_994_000, 0) + .saturating_add(Weight::from_parts(0, 5978)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `MultiAssetBounties::Bounties` (r:1 w:0) + /// Proof: `MultiAssetBounties::Bounties` (`max_values`: None, `max_size`: Some(2513), added: 4988, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::ChildBounties` (r:1 w:1) + /// Proof: `MultiAssetBounties::ChildBounties` (`max_values`: None, `max_size`: Some(1323), added: 3798, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::CuratorDeposit` (r:1 w:1) + /// Proof: `MultiAssetBounties::CuratorDeposit` (`max_values`: None, `max_size`: Some(41), added: 2516, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(283), added: 2758, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::ChildBountiesValuePerParent` (r:1 w:1) + /// Proof: `MultiAssetBounties::ChildBountiesValuePerParent` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::ChildBountiesPerParent` (r:1 w:1) + /// Proof: `MultiAssetBounties::ChildBountiesPerParent` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`) + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + fn check_status_refund() -> Weight { + // Proof Size summary in bytes: + // Measured: `3499` + // Estimated: `5978` + // Minimum execution time: 81_121_000 picoseconds. + Weight::from_parts(82_501_000, 0) + .saturating_add(Weight::from_parts(0, 5978)) + .saturating_add(T::DbWeight::get().reads(9)) + .saturating_add(T::DbWeight::get().writes(7)) + } + /// Storage: `MultiAssetBounties::Bounties` (r:1 w:0) + /// Proof: `MultiAssetBounties::Bounties` (`max_values`: None, `max_size`: Some(2513), added: 4988, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::ChildBounties` (r:1 w:1) + /// Proof: `MultiAssetBounties::ChildBounties` (`max_values`: None, `max_size`: Some(1323), added: 3798, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::CuratorDeposit` (r:1 w:1) + /// Proof: `MultiAssetBounties::CuratorDeposit` (`max_values`: None, `max_size`: Some(41), added: 2516, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(283), added: 2758, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::ChildBountiesPerParent` (r:1 w:1) + /// Proof: `MultiAssetBounties::ChildBountiesPerParent` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`) + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + fn check_status_payout() -> Weight { + // Proof Size summary in bytes: + // Measured: `3522` + // Estimated: `5978` + // Minimum execution time: 78_941_000 picoseconds. + Weight::from_parts(80_032_000, 0) + .saturating_add(Weight::from_parts(0, 5978)) + .saturating_add(T::DbWeight::get().reads(8)) + .saturating_add(T::DbWeight::get().writes(6)) + } + /// Storage: `MultiAssetBounties::Bounties` (r:1 w:0) + /// Proof: `MultiAssetBounties::Bounties` (`max_values`: None, `max_size`: Some(2513), added: 4988, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::ChildBounties` (r:1 w:1) + /// Proof: `MultiAssetBounties::ChildBounties` (`max_values`: None, `max_size`: Some(1323), added: 3798, mode: `MaxEncodedLen`) + /// Storage: `Assets::Asset` (r:1 w:1) + /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `Assets::Account` (r:2 w:2) + /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn retry_payment_funding() -> Weight { + // Proof Size summary in bytes: + // Measured: `2105` + // Estimated: `6208` + // Minimum execution time: 69_819_000 picoseconds. + Weight::from_parts(71_204_000, 0) + .saturating_add(Weight::from_parts(0, 6208)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(5)) + } + /// Storage: `MultiAssetBounties::Bounties` (r:1 w:0) + /// Proof: `MultiAssetBounties::Bounties` (`max_values`: None, `max_size`: Some(2513), added: 4988, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::ChildBounties` (r:1 w:1) + /// Proof: `MultiAssetBounties::ChildBounties` (`max_values`: None, `max_size`: Some(1323), added: 3798, mode: `MaxEncodedLen`) + /// Storage: `Assets::Asset` (r:1 w:1) + /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `Assets::Account` (r:2 w:2) + /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn retry_payment_refund() -> Weight { + // Proof Size summary in bytes: + // Measured: `1704` + // Estimated: `6208` + // Minimum execution time: 69_697_000 picoseconds. + Weight::from_parts(71_447_000, 0) + .saturating_add(Weight::from_parts(0, 6208)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(5)) + } + /// Storage: `MultiAssetBounties::Bounties` (r:1 w:0) + /// Proof: `MultiAssetBounties::Bounties` (`max_values`: None, `max_size`: Some(2513), added: 4988, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::ChildBounties` (r:1 w:1) + /// Proof: `MultiAssetBounties::ChildBounties` (`max_values`: None, `max_size`: Some(1323), added: 3798, mode: `MaxEncodedLen`) + /// Storage: `Assets::Asset` (r:1 w:1) + /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `Assets::Account` (r:2 w:2) + /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn retry_payment_payout() -> Weight { + // Proof Size summary in bytes: + // Measured: `2894` + // Estimated: `6208` + // Minimum execution time: 77_802_000 picoseconds. + Weight::from_parts(79_803_000, 0) + .saturating_add(Weight::from_parts(0, 6208)) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(6)) + } +} diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml b/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml index 4ff3d7355f..0684767f3a 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml +++ b/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml @@ -27,7 +27,7 @@ collectives-polkadot-runtime-constants = { workspace = true } kusama-runtime-constants = { workspace = true } polkadot-runtime-constants = { workspace = true } system-parachains-constants = { workspace = true } -system-parachains-common = { workspace = true } +system-parachains-common = { workspace = true, features = ["multi-asset-bounties"] } # Substrate frame-benchmarking = { optional = true, workspace = true } @@ -56,6 +56,7 @@ pallet-conviction-voting = { workspace = true } pallet-indices = { workspace = true } pallet-message-queue = { workspace = true } pallet-multisig = { workspace = true } +pallet-multi-asset-bounties = { workspace = true } pallet-nfts = { workspace = true } pallet-nfts-runtime-api = { workspace = true } pallet-parameters = { workspace = true } @@ -204,6 +205,7 @@ runtime-benchmarks = [ "pallet-election-provider-multi-block/runtime-benchmarks", "pallet-indices/runtime-benchmarks", "pallet-message-queue/runtime-benchmarks", + "pallet-multi-asset-bounties/runtime-benchmarks", "pallet-multisig/runtime-benchmarks", "pallet-nfts/runtime-benchmarks", "pallet-nomination-pools-benchmarking/runtime-benchmarks", @@ -282,6 +284,7 @@ try-runtime = [ "pallet-election-provider-multi-block/try-runtime", "pallet-indices/try-runtime", "pallet-message-queue/try-runtime", + "pallet-multi-asset-bounties/try-runtime", "pallet-multisig/try-runtime", "pallet-nfts/try-runtime", "pallet-nomination-pools/try-runtime", @@ -371,6 +374,7 @@ std = [ "pallet-election-provider-multi-block/std", "pallet-indices/std", "pallet-message-queue/std", + "pallet-multi-asset-bounties/std", "pallet-multisig/std", "pallet-nfts-runtime-api/std", "pallet-nfts/std", diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/src/ah_migration/call_filter.rs b/system-parachains/asset-hubs/asset-hub-polkadot/src/ah_migration/call_filter.rs index 68bc41a520..41f3774875 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/src/ah_migration/call_filter.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/src/ah_migration/call_filter.rs @@ -96,6 +96,7 @@ pub fn call_allowed_status( Balances(..) => ON, // no reason to disable it, just convenience Bounties(..) => OFF, ChildBounties(..) => OFF, + MultiAssetBounties(..) => OFF, Claims(..) => OFF, CollatorSelection(..) => ON, // Why? ConvictionVoting(..) => OFF, @@ -171,6 +172,7 @@ pub fn call_allowed_before_migration( // Governance disabled before migration starts. Bounties(..) => OFF, ChildBounties(..) => OFF, + MultiAssetBounties(..) => OFF, ConvictionVoting(..) => OFF, Referenda(..) => OFF, Treasury(..) => OFF, diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs b/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs index 8b2cf0d780..435c61ca1d 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs @@ -1549,6 +1549,7 @@ construct_runtime!( Bounties: pallet_bounties = 65, ChildBounties: pallet_child_bounties = 66, AssetRate: pallet_asset_rate = 67, + MultiAssetBounties: pallet_multi_asset_bounties = 68, // State trie migration pallet, only temporary. StateTrieMigration: pallet_state_trie_migration = 70, @@ -1769,6 +1770,7 @@ mod benches { [pallet_bounties, Bounties] [pallet_child_bounties, ChildBounties] [pallet_asset_rate, AssetRate] + [pallet_multi_asset_bounties, MultiAssetBounties] [pallet_ah_migrator, AhMigrator] [pallet_indices, Indices] [polkadot_runtime_common::claims, Claims] diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/src/treasury.rs b/system-parachains/asset-hubs/asset-hub-polkadot/src/treasury.rs index f8813592db..cb3068cc13 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/src/treasury.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/src/treasury.rs @@ -13,9 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -use crate::*; -use frame_support::traits::{tokens::UnityOrOuterConversion, FromContains}; -use parachains_common::pay::VersionedLocatableAccount; +use crate::{governance::Treasurer, *}; +use frame_support::traits::{ + fungible::HoldConsideration, tokens::UnityOrOuterConversion, FromContains, +}; +use parachains_common::pay::{AccountIdToLocalLocation, LocalPay, VersionedLocatableAccount}; use polkadot_runtime_common::impls::{ContainsParts, VersionedLocatableAsset}; parameter_types! { @@ -28,7 +30,7 @@ parameter_types! { pub TreasuryAccount: AccountId = Treasury::account_id(); } -pub type TreasuryPaymaster = system_parachains_common::pay::LocalPay< +pub type TreasuryPaymaster = parachains_common::pay::LocalPay< NativeAndAssets, TreasuryAccount, xcm_config::LocationToAccountId, @@ -53,7 +55,7 @@ impl pallet_treasury::Config for Runtime { type BalanceConverter = AssetRateWithNative; type PayoutPeriod = PayoutSpendPeriod; #[cfg(feature = "runtime-benchmarks")] - type BenchmarkHelper = system_parachains_common::pay::benchmarks::LocalPayArguments< + type BenchmarkHelper = parachains_common::pay::benchmarks::LocalPayArguments< xcm_config::TrustBackedAssetsPalletIndex, >; type BlockNumberProvider = RelaychainDataProvider; @@ -102,6 +104,60 @@ impl pallet_child_bounties::Config for Runtime { type WeightInfo = weights::pallet_child_bounties::WeightInfo; } +parameter_types! { + pub const MultiAssetCuratorHoldReason: RuntimeHoldReason = + RuntimeHoldReason::MultiAssetBounties(pallet_multi_asset_bounties::HoldReason::CuratorDeposit); +} + +impl pallet_multi_asset_bounties::Config for Runtime { + type Balance = Balance; + type RejectOrigin = EitherOfDiverse, Treasurer>; + type SpendOrigin = TreasurySpender; + type AssetKind = VersionedLocatableAsset; + type Beneficiary = VersionedLocatableAccount; + type BeneficiaryLookup = IdentityLookup; + type BountyValueMinimum = BountyValueMinimum; + type ChildBountyValueMinimum = ChildBountyValueMinimum; + type MaxActiveChildBountyCount = MaxActiveChildBountyCount; + type WeightInfo = weights::pallet_multi_asset_bounties::WeightInfo; + type FundingSource = pallet_multi_asset_bounties::PalletIdAsFundingSource< + TreasuryPalletId, + Runtime, + AccountIdToLocalLocation, + >; + type BountySource = + system_parachains_common::multi_asset_bounty_sources::MultiAssetBountySourceFromPalletId< + TreasuryPalletId, + Runtime, + AccountIdToLocalLocation, + >; + type ChildBountySource = + system_parachains_common::multi_asset_bounty_sources::MultiAssetChildBountySourceFromPalletId< + TreasuryPalletId, + Runtime, + AccountIdToLocalLocation, + >; + type Paymaster = LocalPay; + type BalanceConverter = AssetRateWithNative; + type Preimages = Preimage; + type Consideration = HoldConsideration< + AccountId, + Balances, + MultiAssetCuratorHoldReason, + pallet_multi_asset_bounties::CuratorDepositAmount< + CuratorDepositMultiplier, + CuratorDepositMin, + CuratorDepositMax, + Balance, + >, + Balance, + >; + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkHelper = parachains_common::pay::benchmarks::LocalPayWithSourceArguments< + xcm_config::TrustBackedAssetsPalletIndex, + >; +} + /// The [frame_support::traits::tokens::ConversionFromAssetBalance] implementation provided by the /// `AssetRate` pallet instance. /// diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/src/weights/mod.rs b/system-parachains/asset-hubs/asset-hub-polkadot/src/weights/mod.rs index bdf9d9969c..2b53982594 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/src/weights/mod.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/src/weights/mod.rs @@ -42,6 +42,7 @@ pub mod pallet_election_provider_multi_block_unsigned; pub mod pallet_election_provider_multi_block_verifier; pub mod pallet_indices; pub mod pallet_message_queue; +pub mod pallet_multi_asset_bounties; pub mod pallet_multisig; pub mod pallet_nfts; pub mod pallet_parameters; diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/src/weights/pallet_multi_asset_bounties.rs b/system-parachains/asset-hubs/asset-hub-polkadot/src/weights/pallet_multi_asset_bounties.rs new file mode 100644 index 0000000000..9fe6ed365a --- /dev/null +++ b/system-parachains/asset-hubs/asset-hub-polkadot/src/weights/pallet_multi_asset_bounties.rs @@ -0,0 +1,367 @@ +// Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md +// for a list of specific contributors. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Autogenerated weights for `pallet_multi_asset_bounties` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 53.0.0 +//! DATE: 2026-02-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `df580984f9e7`, CPU: `QEMU Virtual CPU version 2.5+` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --extrinsic=* +// --runtime=target/production/wbuild/asset-hub-polkadot-runtime/asset_hub_polkadot_runtime.wasm +// --pallet=pallet_multi_asset_bounties +// --header=/_work/ibp-ch/runtimes/runtimes/.github/scripts/cmd/file_header.txt +// --output=./system-parachains/asset-hubs/asset-hub-polkadot/src/weights +// --wasm-execution=compiled +// --steps=50 +// --repeat=20 +// --heap-pages=4096 + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_multi_asset_bounties`. +pub struct WeightInfo(PhantomData); +impl pallet_multi_asset_bounties::WeightInfo for WeightInfo { + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `AssetRate::ConversionRateToNative` (r:1 w:0) + /// Proof: `AssetRate::ConversionRateToNative` (`max_values`: None, `max_size`: Some(1238), added: 3713, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::BountyCount` (r:1 w:1) + /// Proof: `MultiAssetBounties::BountyCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Assets::Asset` (r:1 w:1) + /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `Assets::Account` (r:2 w:2) + /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::Bounties` (r:0 w:1) + /// Proof: `MultiAssetBounties::Bounties` (`max_values`: None, `max_size`: Some(2513), added: 4988, mode: `MaxEncodedLen`) + fn fund_bounty() -> Weight { + // Proof Size summary in bytes: + // Measured: `2541` + // Estimated: `6208` + // Minimum execution time: 97_570_000 picoseconds. + Weight::from_parts(100_450_000, 0) + .saturating_add(Weight::from_parts(0, 6208)) + .saturating_add(T::DbWeight::get().reads(9)) + .saturating_add(T::DbWeight::get().writes(8)) + } + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::Bounties` (r:1 w:0) + /// Proof: `MultiAssetBounties::Bounties` (`max_values`: None, `max_size`: Some(2513), added: 4988, mode: `MaxEncodedLen`) + /// Storage: `AssetRate::ConversionRateToNative` (r:1 w:0) + /// Proof: `AssetRate::ConversionRateToNative` (`max_values`: None, `max_size`: Some(1238), added: 3713, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::ChildBountiesPerParent` (r:1 w:1) + /// Proof: `MultiAssetBounties::ChildBountiesPerParent` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::ChildBountiesValuePerParent` (r:1 w:1) + /// Proof: `MultiAssetBounties::ChildBountiesValuePerParent` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::TotalChildBountiesPerParent` (r:1 w:1) + /// Proof: `MultiAssetBounties::TotalChildBountiesPerParent` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`) + /// Storage: `Assets::Asset` (r:1 w:1) + /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `Assets::Account` (r:2 w:2) + /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::ChildBounties` (r:0 w:1) + /// Proof: `MultiAssetBounties::ChildBounties` (`max_values`: None, `max_size`: Some(1323), added: 3798, mode: `MaxEncodedLen`) + fn fund_child_bounty() -> Weight { + // Proof Size summary in bytes: + // Measured: `1568` + // Estimated: `6208` + // Minimum execution time: 106_929_000 picoseconds. + Weight::from_parts(108_949_000, 0) + .saturating_add(Weight::from_parts(0, 6208)) + .saturating_add(T::DbWeight::get().reads(11)) + .saturating_add(T::DbWeight::get().writes(9)) + } + /// Storage: `MultiAssetBounties::Bounties` (r:1 w:1) + /// Proof: `MultiAssetBounties::Bounties` (`max_values`: None, `max_size`: Some(2513), added: 4988, mode: `MaxEncodedLen`) + /// Storage: `AssetRate::ConversionRateToNative` (r:1 w:0) + /// Proof: `AssetRate::ConversionRateToNative` (`max_values`: None, `max_size`: Some(1238), added: 3713, mode: `MaxEncodedLen`) + fn propose_curator_parent_bounty() -> Weight { + // Proof Size summary in bytes: + // Measured: `307` + // Estimated: `5978` + // Minimum execution time: 27_140_000 picoseconds. + Weight::from_parts(28_280_000, 0) + .saturating_add(Weight::from_parts(0, 5978)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `MultiAssetBounties::Bounties` (r:1 w:0) + /// Proof: `MultiAssetBounties::Bounties` (`max_values`: None, `max_size`: Some(2513), added: 4988, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::ChildBounties` (r:1 w:1) + /// Proof: `MultiAssetBounties::ChildBounties` (`max_values`: None, `max_size`: Some(1323), added: 3798, mode: `MaxEncodedLen`) + fn propose_curator_child_bounty() -> Weight { + // Proof Size summary in bytes: + // Measured: `468` + // Estimated: `5978` + // Minimum execution time: 27_131_000 picoseconds. + Weight::from_parts(28_109_000, 0) + .saturating_add(Weight::from_parts(0, 5978)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `MultiAssetBounties::Bounties` (r:1 w:0) + /// Proof: `MultiAssetBounties::Bounties` (`max_values`: None, `max_size`: Some(2513), added: 4988, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::ChildBounties` (r:1 w:1) + /// Proof: `MultiAssetBounties::ChildBounties` (`max_values`: None, `max_size`: Some(1323), added: 3798, mode: `MaxEncodedLen`) + /// Storage: `AssetRate::ConversionRateToNative` (r:1 w:0) + /// Proof: `AssetRate::ConversionRateToNative` (`max_values`: None, `max_size`: Some(1238), added: 3713, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(265), added: 2740, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::CuratorDeposit` (r:0 w:1) + /// Proof: `MultiAssetBounties::CuratorDeposit` (`max_values`: None, `max_size`: Some(41), added: 2516, mode: `MaxEncodedLen`) + fn accept_curator() -> Weight { + // Proof Size summary in bytes: + // Measured: `3473` + // Estimated: `5978` + // Minimum execution time: 95_098_000 picoseconds. + Weight::from_parts(96_369_000, 0) + .saturating_add(Weight::from_parts(0, 5978)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `MultiAssetBounties::Bounties` (r:1 w:0) + /// Proof: `MultiAssetBounties::Bounties` (`max_values`: None, `max_size`: Some(2513), added: 4988, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::ChildBounties` (r:1 w:1) + /// Proof: `MultiAssetBounties::ChildBounties` (`max_values`: None, `max_size`: Some(1323), added: 3798, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::CuratorDeposit` (r:1 w:1) + /// Proof: `MultiAssetBounties::CuratorDeposit` (`max_values`: None, `max_size`: Some(41), added: 2516, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(265), added: 2740, mode: `MaxEncodedLen`) + fn unassign_curator() -> Weight { + // Proof Size summary in bytes: + // Measured: `3497` + // Estimated: `5978` + // Minimum execution time: 72_769_000 picoseconds. + Weight::from_parts(76_090_000, 0) + .saturating_add(Weight::from_parts(0, 5978)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `MultiAssetBounties::Bounties` (r:1 w:0) + /// Proof: `MultiAssetBounties::Bounties` (`max_values`: None, `max_size`: Some(2513), added: 4988, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::ChildBounties` (r:1 w:1) + /// Proof: `MultiAssetBounties::ChildBounties` (`max_values`: None, `max_size`: Some(1323), added: 3798, mode: `MaxEncodedLen`) + /// Storage: `Assets::Asset` (r:1 w:1) + /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `Assets::Account` (r:2 w:2) + /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn award_bounty() -> Weight { + // Proof Size summary in bytes: + // Measured: `2903` + // Estimated: `6208` + // Minimum execution time: 96_230_000 picoseconds. + Weight::from_parts(97_620_000, 0) + .saturating_add(Weight::from_parts(0, 6208)) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(6)) + } + /// Storage: `MultiAssetBounties::Bounties` (r:1 w:1) + /// Proof: `MultiAssetBounties::Bounties` (`max_values`: None, `max_size`: Some(2513), added: 4988, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::ChildBountiesPerParent` (r:1 w:0) + /// Proof: `MultiAssetBounties::ChildBountiesPerParent` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`) + /// Storage: `Assets::Asset` (r:1 w:1) + /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `Assets::Account` (r:2 w:2) + /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn close_parent_bounty() -> Weight { + // Proof Size summary in bytes: + // Measured: `2602` + // Estimated: `6208` + // Minimum execution time: 89_599_000 picoseconds. + Weight::from_parts(97_529_000, 0) + .saturating_add(Weight::from_parts(0, 6208)) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(6)) + } + /// Storage: `MultiAssetBounties::Bounties` (r:1 w:0) + /// Proof: `MultiAssetBounties::Bounties` (`max_values`: None, `max_size`: Some(2513), added: 4988, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::ChildBounties` (r:1 w:1) + /// Proof: `MultiAssetBounties::ChildBounties` (`max_values`: None, `max_size`: Some(1323), added: 3798, mode: `MaxEncodedLen`) + /// Storage: `Assets::Asset` (r:1 w:1) + /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `Assets::Account` (r:2 w:2) + /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn close_child_bounty() -> Weight { + // Proof Size summary in bytes: + // Measured: `1801` + // Estimated: `6208` + // Minimum execution time: 87_189_000 picoseconds. + Weight::from_parts(89_649_000, 0) + .saturating_add(Weight::from_parts(0, 6208)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(5)) + } + /// Storage: `MultiAssetBounties::Bounties` (r:1 w:0) + /// Proof: `MultiAssetBounties::Bounties` (`max_values`: None, `max_size`: Some(2513), added: 4988, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::ChildBounties` (r:1 w:1) + /// Proof: `MultiAssetBounties::ChildBounties` (`max_values`: None, `max_size`: Some(1323), added: 3798, mode: `MaxEncodedLen`) + fn check_status_funding() -> Weight { + // Proof Size summary in bytes: + // Measured: `510` + // Estimated: `5978` + // Minimum execution time: 27_750_000 picoseconds. + Weight::from_parts(28_949_000, 0) + .saturating_add(Weight::from_parts(0, 5978)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `MultiAssetBounties::Bounties` (r:1 w:0) + /// Proof: `MultiAssetBounties::Bounties` (`max_values`: None, `max_size`: Some(2513), added: 4988, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::ChildBounties` (r:1 w:1) + /// Proof: `MultiAssetBounties::ChildBounties` (`max_values`: None, `max_size`: Some(1323), added: 3798, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::CuratorDeposit` (r:1 w:1) + /// Proof: `MultiAssetBounties::CuratorDeposit` (`max_values`: None, `max_size`: Some(41), added: 2516, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(265), added: 2740, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::ChildBountiesValuePerParent` (r:1 w:1) + /// Proof: `MultiAssetBounties::ChildBountiesValuePerParent` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::ChildBountiesPerParent` (r:1 w:1) + /// Proof: `MultiAssetBounties::ChildBountiesPerParent` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`) + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + fn check_status_refund() -> Weight { + // Proof Size summary in bytes: + // Measured: `3631` + // Estimated: `5978` + // Minimum execution time: 98_080_000 picoseconds. + Weight::from_parts(100_650_000, 0) + .saturating_add(Weight::from_parts(0, 5978)) + .saturating_add(T::DbWeight::get().reads(9)) + .saturating_add(T::DbWeight::get().writes(7)) + } + /// Storage: `MultiAssetBounties::Bounties` (r:1 w:0) + /// Proof: `MultiAssetBounties::Bounties` (`max_values`: None, `max_size`: Some(2513), added: 4988, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::ChildBounties` (r:1 w:1) + /// Proof: `MultiAssetBounties::ChildBounties` (`max_values`: None, `max_size`: Some(1323), added: 3798, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::CuratorDeposit` (r:1 w:1) + /// Proof: `MultiAssetBounties::CuratorDeposit` (`max_values`: None, `max_size`: Some(41), added: 2516, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(265), added: 2740, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::ChildBountiesPerParent` (r:1 w:1) + /// Proof: `MultiAssetBounties::ChildBountiesPerParent` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`) + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + fn check_status_payout() -> Weight { + // Proof Size summary in bytes: + // Measured: `3654` + // Estimated: `5978` + // Minimum execution time: 95_468_000 picoseconds. + Weight::from_parts(98_090_000, 0) + .saturating_add(Weight::from_parts(0, 5978)) + .saturating_add(T::DbWeight::get().reads(8)) + .saturating_add(T::DbWeight::get().writes(6)) + } + /// Storage: `MultiAssetBounties::Bounties` (r:1 w:0) + /// Proof: `MultiAssetBounties::Bounties` (`max_values`: None, `max_size`: Some(2513), added: 4988, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::ChildBounties` (r:1 w:1) + /// Proof: `MultiAssetBounties::ChildBounties` (`max_values`: None, `max_size`: Some(1323), added: 3798, mode: `MaxEncodedLen`) + /// Storage: `Assets::Asset` (r:1 w:1) + /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `Assets::Account` (r:2 w:2) + /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn retry_payment_funding() -> Weight { + // Proof Size summary in bytes: + // Measured: `2143` + // Estimated: `6208` + // Minimum execution time: 85_141_000 picoseconds. + Weight::from_parts(88_729_000, 0) + .saturating_add(Weight::from_parts(0, 6208)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(5)) + } + /// Storage: `MultiAssetBounties::Bounties` (r:1 w:0) + /// Proof: `MultiAssetBounties::Bounties` (`max_values`: None, `max_size`: Some(2513), added: 4988, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::ChildBounties` (r:1 w:1) + /// Proof: `MultiAssetBounties::ChildBounties` (`max_values`: None, `max_size`: Some(1323), added: 3798, mode: `MaxEncodedLen`) + /// Storage: `Assets::Asset` (r:1 w:1) + /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `Assets::Account` (r:2 w:2) + /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn retry_payment_refund() -> Weight { + // Proof Size summary in bytes: + // Measured: `1803` + // Estimated: `6208` + // Minimum execution time: 84_570_000 picoseconds. + Weight::from_parts(85_859_000, 0) + .saturating_add(Weight::from_parts(0, 6208)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(5)) + } + /// Storage: `MultiAssetBounties::Bounties` (r:1 w:0) + /// Proof: `MultiAssetBounties::Bounties` (`max_values`: None, `max_size`: Some(2513), added: 4988, mode: `MaxEncodedLen`) + /// Storage: `MultiAssetBounties::ChildBounties` (r:1 w:1) + /// Proof: `MultiAssetBounties::ChildBounties` (`max_values`: None, `max_size`: Some(1323), added: 3798, mode: `MaxEncodedLen`) + /// Storage: `Assets::Asset` (r:1 w:1) + /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `Assets::Account` (r:2 w:2) + /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn retry_payment_payout() -> Weight { + // Proof Size summary in bytes: + // Measured: `2943` + // Estimated: `6208` + // Minimum execution time: 93_880_000 picoseconds. + Weight::from_parts(96_569_000, 0) + .saturating_add(Weight::from_parts(0, 6208)) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(6)) + } +} diff --git a/system-parachains/common/Cargo.toml b/system-parachains/common/Cargo.toml index 0856d81617..f31e901a35 100644 --- a/system-parachains/common/Cargo.toml +++ b/system-parachains/common/Cargo.toml @@ -15,59 +15,42 @@ scale-info = { features = ["derive"], workspace = true } sp-runtime = { workspace = true } sp-state-machine = { workspace = true } sp-api = { workspace = true } -sp-core = { workspace = true } frame-support = { workspace = true } cumulus-pallet-parachain-system = { workspace = true } cumulus-primitives-core = { workspace = true } polkadot-primitives = { workspace = true } - -parachains-common = { workspace = true } -polkadot-runtime-common = { workspace = true } -xcm = { workspace = true } -xcm-executor = { workspace = true } -pallet-treasury = { workspace = true, optional = true } +pallet-multi-asset-bounties = { workspace = true, optional = true } [features] default = ["std"] +multi-asset-bounties = ["pallet-multi-asset-bounties"] std = [ "codec/std", "cumulus-pallet-parachain-system/std", "cumulus-primitives-core/std", "frame-support/std", "log/std", - "pallet-treasury/std", - "parachains-common/std", + "pallet-multi-asset-bounties?/std", "polkadot-primitives/std", - "polkadot-runtime-common/std", "scale-info/std", "sp-api/std", - "sp-core/std", "sp-runtime/std", "sp-state-machine/std", - "xcm-executor/std", - "xcm/std", ] runtime-benchmarks = [ "cumulus-pallet-parachain-system/runtime-benchmarks", "cumulus-primitives-core/runtime-benchmarks", "frame-support/runtime-benchmarks", - "pallet-treasury", - "pallet-treasury/runtime-benchmarks", - "parachains-common/runtime-benchmarks", + "pallet-multi-asset-bounties?/runtime-benchmarks", "polkadot-primitives/runtime-benchmarks", - "polkadot-runtime-common/runtime-benchmarks", "sp-runtime/runtime-benchmarks", - "xcm-executor/runtime-benchmarks", - "xcm/runtime-benchmarks", ] try-runtime = [ "cumulus-pallet-parachain-system/try-runtime", "frame-support/try-runtime", - "pallet-treasury/try-runtime", - "parachains-common/try-runtime", - "polkadot-runtime-common/try-runtime", + "pallet-multi-asset-bounties?/try-runtime", "sp-runtime/try-runtime", ] diff --git a/system-parachains/common/src/lib.rs b/system-parachains/common/src/lib.rs index 0e9ba72580..c35bbc066c 100644 --- a/system-parachains/common/src/lib.rs +++ b/system-parachains/common/src/lib.rs @@ -17,9 +17,11 @@ //! Shared types between system-parachains runtimes. #![cfg_attr(not(feature = "std"), no_std)] -pub mod pay; pub mod randomness; +#[cfg(feature = "multi-asset-bounties")] +pub mod multi_asset_bounty_sources; + /// Extra runtime APIs. pub mod apis { /// Information about the current issuance rate of the system. diff --git a/system-parachains/common/src/multi_asset_bounty_sources.rs b/system-parachains/common/src/multi_asset_bounty_sources.rs new file mode 100644 index 0000000000..5e2529b1c0 --- /dev/null +++ b/system-parachains/common/src/multi_asset_bounty_sources.rs @@ -0,0 +1,90 @@ +// Copyright (C) Polkadot Fellows. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . + +//! Multi-asset bounty and child-bounty source types that derive account IDs using distinct +//! sub-account prefixes (`"mbt"` and `"mcb"`) so they do not collide with the legacy +//! single-asset bounties pallet (which uses `"bt"` and `"cb"`). + +use frame_support::{traits::Get, PalletId}; +use pallet_multi_asset_bounties::BountyIndex; +use sp_runtime::traits::{AccountIdConversion, Convert, TryConvert}; + +// TODO (issue #1071) @dhirajs0: remove this module and use the try_convert methods from +// multi-asset-bounties pallet directly in config. + +/// Derives a **multi-asset** bounty account ID from the `PalletId` and the `BountyIndex`, +/// then converts it into the corresponding bounty `Beneficiary`. +/// +/// Uses the prefix `"mbt"` (multi-asset bounty) so account IDs do not collide with the +/// legacy bounties pallet, which uses `"bt"`. +/// +/// # Type Parameters +/// - `Id`: The pallet ID getter +/// - `T`: The pallet configuration +/// - `C`: Converter from `T::AccountId` to `T::Beneficiary`. Use `Identity` when types are the +/// same. +/// - `I`: Instance parameter (default: `()`) +pub struct MultiAssetBountySourceFromPalletId( + core::marker::PhantomData<(Id, T, C, I)>, +); + +impl TryConvert<(BountyIndex, T::AssetKind), T::Beneficiary> + for MultiAssetBountySourceFromPalletId +where + Id: Get, + T: pallet_multi_asset_bounties::Config, + C: Convert, +{ + fn try_convert( + (parent_bounty_id, _asset_kind): (BountyIndex, T::AssetKind), + ) -> Result { + let account: T::AccountId = + Id::get().into_sub_account_truncating(("mbt", parent_bounty_id)); + Ok(C::convert(account)) + } +} + +/// Derives a **multi-asset** child-bounty account ID from the `PalletId`, the parent index, +/// and the child index, then converts it into the child-bounty `Beneficiary`. +/// +/// Uses the prefix `"mcb"` (multi-asset child bounty) so account IDs do not collide with the +/// legacy child-bounties pallet, which uses `"cb"`. +/// +/// # Type Parameters +/// - `Id`: The pallet ID getter +/// - `T`: The pallet configuration +/// - `C`: Converter from `T::AccountId` to `T::Beneficiary`. Use `Identity` when types are the +/// same. +/// - `I`: Instance parameter (default: `()`) +pub struct MultiAssetChildBountySourceFromPalletId( + core::marker::PhantomData<(Id, T, C, I)>, +); + +impl TryConvert<(BountyIndex, BountyIndex, T::AssetKind), T::Beneficiary> + for MultiAssetChildBountySourceFromPalletId +where + Id: Get, + T: pallet_multi_asset_bounties::Config, + C: Convert, +{ + fn try_convert( + (parent_bounty_id, child_bounty_id, _asset_kind): (BountyIndex, BountyIndex, T::AssetKind), + ) -> Result { + let account: T::AccountId = + Id::get().into_sub_account_truncating(("mcb", parent_bounty_id, child_bounty_id)); + Ok(C::convert(account)) + } +} diff --git a/system-parachains/common/src/pay.rs b/system-parachains/common/src/pay.rs deleted file mode 100644 index 4fe6cdc832..0000000000 --- a/system-parachains/common/src/pay.rs +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright (C) Parity Technologies (UK) Ltd. -// This file is part of Cumulus. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! Local implementation of the pay module with V3 to V5 conversion support. -//! This is a temporary fix until the changes are merged into polkadot-sdk. - -// TODO (issue #1027): remove this module and import it from polkadot-sdk instead - -use frame_support::traits::{ - fungibles, - tokens::{PaymentStatus, Preservation}, -}; -use parachains_common::pay::VersionedLocatableAccount; -use polkadot_runtime_common::impls::VersionedLocatableAsset; -use sp_runtime::{traits::TypedGet, DispatchError}; -use xcm::latest::prelude::*; -use xcm_executor::traits::ConvertLocation; - -/// Pay on the local chain with `fungibles` implementation if the beneficiary and the asset are both -/// local. -pub struct LocalPay(core::marker::PhantomData<(F, A, C)>); -impl frame_support::traits::tokens::Pay for LocalPay -where - A: TypedGet, - F: fungibles::Mutate + fungibles::Create, - C: ConvertLocation, - A::Type: Eq + Clone, -{ - type Balance = F::Balance; - type Beneficiary = VersionedLocatableAccount; - type AssetKind = VersionedLocatableAsset; - type Id = QueryId; - type Error = DispatchError; - fn pay( - who: &Self::Beneficiary, - asset: Self::AssetKind, - amount: Self::Balance, - ) -> Result { - let who = Self::match_location(who).map_err(|_| DispatchError::Unavailable)?; - let asset = Self::match_asset(&asset).map_err(|_| DispatchError::Unavailable)?; - >::transfer( - asset, - &A::get(), - &who, - amount, - Preservation::Expendable, - )?; - // We use `QueryId::MAX` as a constant identifier for these payments since they are always - // processed immediately and successfully on the local chain. The `QueryId` type is used to - // maintain compatibility with XCM payment implementations. - Ok(Self::Id::MAX) // Should return a unique identifier for the payment. - } - fn check_payment(_: Self::Id) -> PaymentStatus { - PaymentStatus::Success - } - #[cfg(feature = "runtime-benchmarks")] - fn ensure_successful(_: &Self::Beneficiary, asset: Self::AssetKind, amount: Self::Balance) { - let asset = Self::match_asset(&asset).expect("invalid asset"); - >::create(asset.clone(), A::get(), true, amount).unwrap(); - >::mint_into(asset, &A::get(), amount).unwrap(); - } - #[cfg(feature = "runtime-benchmarks")] - fn ensure_concluded(_: Self::Id) {} -} - -impl LocalPay -where - A: TypedGet, - F: fungibles::Mutate + fungibles::Create, - C: ConvertLocation, - A::Type: Eq + Clone, -{ - fn match_location(who: &VersionedLocatableAccount) -> Result { - // only applicable for the local accounts - let account_id = match who { - VersionedLocatableAccount::V4 { location, account_id } if location.is_here() => - &account_id.clone().try_into().map_err(|_| ())?, - VersionedLocatableAccount::V5 { location, account_id } if location.is_here() => - account_id, - _ => return Err(()), - }; - C::convert_location(account_id).ok_or(()) - } - fn match_asset(asset: &VersionedLocatableAsset) -> Result { - match asset { - VersionedLocatableAsset::V3 { location, asset_id } if location.is_here() => { - // Convert V3 asset_id to V5 Location (must go through V4) - let v4_asset_id: xcm::v4::AssetId = (*asset_id).try_into().map_err(|_| ())?; - let v5_asset_id: xcm::v5::AssetId = v4_asset_id.try_into().map_err(|_| ())?; - Ok(v5_asset_id.0) - }, - VersionedLocatableAsset::V4 { location, asset_id } if location.is_here() => - asset_id.clone().try_into().map(|a: xcm::v5::AssetId| a.0).map_err(|_| ()), - VersionedLocatableAsset::V5 { location, asset_id } if location.is_here() => - Ok(asset_id.clone().0), - _ => Err(()), - } - } -} - -#[cfg(feature = "runtime-benchmarks")] -pub mod benchmarks { - use super::*; - use core::marker::PhantomData; - use frame_support::traits::Get; - use pallet_treasury::ArgumentsFactory as TreasuryArgumentsFactory; - use sp_core::ConstU8; - - /// Provides factory methods for the `AssetKind` and the `Beneficiary` that are applicable for - /// the payout made by [`LocalPay`]. - /// - /// ### Parameters: - /// - `PalletId`: The ID of the assets registry pallet. - /// - `AssetId`: The ID of the asset that will be created for the benchmark within `PalletId`. - pub struct LocalPayArguments>(PhantomData); - impl> - TreasuryArgumentsFactory - for LocalPayArguments - { - fn create_asset_kind(seed: u32) -> VersionedLocatableAsset { - VersionedLocatableAsset::V5 { - location: Location::new(0, []), - asset_id: Location::new( - 0, - [PalletInstance(PalletId::get()), GeneralIndex(seed.into())], - ) - .into(), - } - } - fn create_beneficiary(seed: [u8; 32]) -> VersionedLocatableAccount { - VersionedLocatableAccount::V5 { - location: Location::new(0, []), - account_id: Location::new(0, [AccountId32 { network: None, id: seed }]), - } - } - } -}