mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-07 06:08:03 +00:00
3aae882437
* Fixes * Undiener * Undiener * Undiener * Lockfile * Changes for send returning hash * Include message ID as params to execute_xcm * Fixes * Fixes * Fixes * Fixes * Fixes * Fixes * Companion fixes * Formatting * Fixes * Formatting * Bump * Bump * Fixes * Formatting * Make the price of UMP/XCMP message sending configurable * cargo fmt * Remove InvertLocation * Formatting * Use ConstantPrice from polkadot-runtime-common * Fix naming * cargo fmt * Fixes * Fixes * Fixes * Add CallDispatcher * Fixes * Fixes * Fixes * Fixes * Fixes * Fixes * Fixes * Fixes * Fixes * Fixes * Fixes * Fixes * Fixes * Fixes * Fixes * Fixes * Fixes * Fixes * Fixes * Remove unused import * Remove unused import * XCMv3 fixes (#1710) * Fixes XCMv3 related Fixes XCMv3 (removed query_holding) Fixes XCMv3 - should use _depositable_count? Fixes XCMv3 - removed TrustedReserve Fixes - missing weights for statemine/statemint/westmint [DO-NOT-CHERRY-PICK] tmp return query_holding to aviod conficts to master Fixes - missing functions for pallet_xcm_benchmarks::generic::Config Fixes for XCMv3 benchmarking Fix xcm - removed query_holding * ".git/.scripts/bench-bot.sh" xcm statemine assets pallet_xcm_benchmarks::generic * ".git/.scripts/bench-bot.sh" xcm statemint assets pallet_xcm_benchmarks::generic * ".git/.scripts/bench-bot.sh" xcm westmint assets pallet_xcm_benchmarks::generic * Fix imports * Avoid consuming XCM message for NotApplicable scenario (#1787) * Avoid consuming message for NotApplicable scenario * Avoid consuming message for NotApplicable scenario tests * Add 10 message processing limit to DMP queue * Add 10 message limit to XCMP queue * Always increment the message_processed count whenever a message is processed * Fix formatting * Set an upper limit to the overweight message DMP queue * Add upper limit to XCMP overweight message queue * Fix for missing weight for `fn unpaid_execution()` * Fix - usage of `messages_processed` * Fixes * Fixes * Fixes * cargo fmt * Fixes * Fixes * Fixes * Fixes * Remove unused import * Fixes for gav-xcm-v3 (#1835) * Fix for FungiblesAdapter - trait changes: Contains -> AssetChecking * Fix for missing weight for `fn unpaid_execution()` * Used NonLocalMint for all NonZeroIssuance * Fix * Fixes * Fixes * Fixes * Fixes * Fixes * Fix tests * Fixes * Add SafeCallFilter * Add missing config items * Add TODO * Use () as the PriceForParentDelivery * Fixes * Fixes * Fixes * Fixes * Update transact_origin to transact_origin_and_runtime_call * Add ReachableDest config item to XCM pallet * Update SafeCallFilter to allow remark_with_event in runtime benchmarks * cargo fmt * Update substrate * Fix worst_case_holding * Fix DMQ queue unit tests * Remove unused label * cargo fmt * Actually process incoming XCMs * Fixes * Fixes * Fixes * Fixes - return back Weightless * Added measured benchmarks for `pallet_xcm` (#1968) * Fix Fix Fix * Fix * Fixes for transact benchmark * Fixes add pallet_xcm to benchmarks * Revert remark_with_event * ".git/.scripts/bench-bot.sh" xcm statemine assets pallet_xcm_benchmarks::generic * Fixes * TMP * Fix for reserve_asset_deposited * ".git/.scripts/bench-bot.sh" pallet statemine assets pallet_xcm * Fix * ".git/.scripts/bench-bot.sh" pallet statemint assets pallet_xcm * Fix * ".git/.scripts/bench-bot.sh" pallet westmint assets pallet_xcm * Fix westmint * ".git/.scripts/bench-bot.sh" xcm statemine assets pallet_xcm_benchmarks::generic * Fix * ".git/.scripts/bench-bot.sh" xcm westmint assets pallet_xcm_benchmarks::generic * ".git/.scripts/bench-bot.sh" xcm statemint assets pallet_xcm_benchmarks::generic * ".git/.scripts/bench-bot.sh" pallet collectives-polkadot collectives pallet_xcm * Fix for collectives * ".git/.scripts/bench-bot.sh" pallet bridge-hub-kusama bridge-hubs pallet_xcm * ".git/.scripts/bench-bot.sh" pallet bridge-hub-rococo bridge-hubs pallet_xcm * Fixes for bridge-hubs * Fixes - return back Weightless * Fix - removed MigrateToTrackInactive for contracts-rococo Co-authored-by: command-bot <> * cargo fmt * Fix benchmarks * Bko gav xcm v3 (#1993) * Fix * ".git/.scripts/bench-bot.sh" xcm statemint assets pallet_xcm_benchmarks::fungible * ".git/.scripts/bench-bot.sh" xcm statemine assets pallet_xcm_benchmarks::fungible * ".git/.scripts/bench-bot.sh" xcm westmint assets pallet_xcm_benchmarks::fungible * ".git/.scripts/bench-bot.sh" xcm statemine assets pallet_xcm_benchmarks::generic * ".git/.scripts/bench-bot.sh" xcm statemint assets pallet_xcm_benchmarks::generic * ".git/.scripts/bench-bot.sh" xcm westmint assets pallet_xcm_benchmarks::generic * ".git/.scripts/bench-bot.sh" pallet statemine assets pallet_xcm * ".git/.scripts/bench-bot.sh" pallet westmint assets pallet_xcm * ".git/.scripts/bench-bot.sh" pallet statemint assets pallet_xcm * ".git/.scripts/bench-bot.sh" pallet collectives-polkadot collectives pallet_xcm * ".git/.scripts/bench-bot.sh" pallet bridge-hub-kusama bridge-hubs pallet_xcm * ".git/.scripts/bench-bot.sh" pallet bridge-hub-rococo bridge-hubs pallet_xcm Co-authored-by: command-bot <> * Change AllowUnpaidExecutionFrom to be explicit * xcm-v3 benchmarks, weights, fixes for bridge-hubs (#2035) * Dumy weights to get compile * Change UniversalLocation according to https://github.com/paritytech/polkadot/pull/4097 (Location Inversion Removed) * Fix bridge-hubs weights * ".git/.scripts/bench-bot.sh" pallet statemine assets pallet_xcm * ".git/.scripts/bench-bot.sh" pallet statemint assets pallet_xcm * ".git/.scripts/bench-bot.sh" pallet collectives-polkadot collectives pallet_xcm * ".git/.scripts/bench-bot.sh" pallet westmint assets pallet_xcm * ".git/.scripts/bench-bot.sh" xcm bridge-hub-kusama bridge-hubs pallet_xcm_benchmarks::generic * ".git/.scripts/bench-bot.sh" xcm bridge-hub-kusama bridge-hubs pallet_xcm_benchmarks::fungible * ".git/.scripts/bench-bot.sh" pallet bridge-hub-kusama bridge-hubs pallet_xcm * ".git/.scripts/bench-bot.sh" pallet bridge-hub-rococo bridge-hubs pallet_xcm * ".git/.scripts/bench-bot.sh" xcm bridge-hub-rococo bridge-hubs pallet_xcm_benchmarks::fungible * ".git/.scripts/bench-bot.sh" xcm bridge-hub-rococo bridge-hubs pallet_xcm_benchmarks::generic * Change NetworkId to Option<NetworkId> Co-authored-by: command-bot <> Co-authored-by: Keith Yeung <kungfukeith11@gmail.com> * Add event for showing the hash of an UMP sent message (#1228) * Add UpwardMessageSent event in parachain-system * additional fixes * Message Id * Fix errors from merge * fmt * more fmt * Remove todo * more formatting * Fixes * Fixes * Fixes * Fixes * Allow explicit unpaid executions from the relay chains for system parachains (#2060) * Allow explicit unpaid executions from the relay chains for system parachains * Put origin-filtering barriers into WithComputedOrigin * Use ConstU32<8> * Small nits * formatting * cargo fmt * Allow receiving XCMs from any relay chain plurality * Fixes * update lockfile for {"polkadot", "substrate"} * Update polkadot * Add runtime-benchmarks feature Co-authored-by: Keith Yeung <kungfukeith11@gmail.com> Co-authored-by: Branislav Kontur <bkontur@gmail.com> Co-authored-by: girazoki <gorka.irazoki@gmail.com> Co-authored-by: parity-processbot <>
148 lines
4.4 KiB
Rust
148 lines
4.4 KiB
Rust
// Copyright 2021 Parity Technologies (UK) Ltd.
|
|
// 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 <http://www.gnu.org/licenses/>.
|
|
|
|
//! A module that is responsible for migration of storage.
|
|
|
|
use crate::{Config, Pallet, Store, DEFAULT_POV_SIZE};
|
|
use frame_support::{
|
|
pallet_prelude::*,
|
|
traits::StorageVersion,
|
|
weights::{constants::WEIGHT_REF_TIME_PER_MILLIS, Weight},
|
|
};
|
|
|
|
/// The current storage version.
|
|
pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(2);
|
|
|
|
/// Migrates the pallet storage to the most recent version, checking and setting the
|
|
/// `StorageVersion`.
|
|
pub fn migrate_to_latest<T: Config>() -> Weight {
|
|
let mut weight = T::DbWeight::get().reads(1);
|
|
|
|
if StorageVersion::get::<Pallet<T>>() == 1 {
|
|
weight.saturating_accrue(migrate_to_v2::<T>());
|
|
StorageVersion::new(2).put::<Pallet<T>>();
|
|
weight.saturating_accrue(T::DbWeight::get().writes(1));
|
|
}
|
|
|
|
if StorageVersion::get::<Pallet<T>>() == 2 {
|
|
weight.saturating_accrue(migrate_to_v3::<T>());
|
|
StorageVersion::new(3).put::<Pallet<T>>();
|
|
weight.saturating_accrue(T::DbWeight::get().writes(1));
|
|
}
|
|
|
|
weight
|
|
}
|
|
|
|
mod v1 {
|
|
use super::*;
|
|
use codec::{Decode, Encode};
|
|
|
|
#[derive(Encode, Decode, Debug)]
|
|
pub struct QueueConfigData {
|
|
pub suspend_threshold: u32,
|
|
pub drop_threshold: u32,
|
|
pub resume_threshold: u32,
|
|
pub threshold_weight: u64,
|
|
pub weight_restrict_decay: u64,
|
|
pub xcmp_max_individual_weight: u64,
|
|
}
|
|
|
|
impl Default for QueueConfigData {
|
|
fn default() -> Self {
|
|
QueueConfigData {
|
|
suspend_threshold: 2,
|
|
drop_threshold: 5,
|
|
resume_threshold: 1,
|
|
threshold_weight: 100_000,
|
|
weight_restrict_decay: 2,
|
|
xcmp_max_individual_weight: 20u64 * WEIGHT_REF_TIME_PER_MILLIS,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/// Migrates `QueueConfigData` from v1 (using only reference time weights) to v2 (with
|
|
/// 2D weights).
|
|
///
|
|
/// NOTE: Only use this function if you know what you're doing. Default to using
|
|
/// `migrate_to_latest`.
|
|
pub fn migrate_to_v2<T: Config>() -> Weight {
|
|
let translate = |pre: v1::QueueConfigData| -> super::QueueConfigData {
|
|
super::QueueConfigData {
|
|
suspend_threshold: pre.suspend_threshold,
|
|
drop_threshold: pre.drop_threshold,
|
|
resume_threshold: pre.resume_threshold,
|
|
threshold_weight: Weight::from_ref_time(pre.threshold_weight),
|
|
weight_restrict_decay: Weight::from_ref_time(pre.weight_restrict_decay),
|
|
xcmp_max_individual_weight: Weight::from_parts(
|
|
pre.xcmp_max_individual_weight,
|
|
DEFAULT_POV_SIZE,
|
|
),
|
|
}
|
|
};
|
|
|
|
if let Err(_) = <Pallet<T> as Store>::QueueConfig::translate(|pre| pre.map(translate)) {
|
|
log::error!(
|
|
target: super::LOG_TARGET,
|
|
"unexpected error when performing translation of the QueueConfig type during storage upgrade to v2"
|
|
);
|
|
}
|
|
|
|
T::DbWeight::get().reads_writes(1, 1)
|
|
}
|
|
|
|
pub fn migrate_to_v3<T: Config>() -> Weight {
|
|
let overweight_messages = <Pallet<T> as Store>::Overweight::initialize_counter() as u64;
|
|
|
|
T::DbWeight::get().reads_writes(overweight_messages, 1)
|
|
}
|
|
|
|
#[cfg(test)]
|
|
mod tests {
|
|
use super::*;
|
|
use crate::mock::{new_test_ext, Test};
|
|
|
|
#[test]
|
|
fn test_migration_to_v2() {
|
|
let v1 = v1::QueueConfigData {
|
|
suspend_threshold: 5,
|
|
drop_threshold: 12,
|
|
resume_threshold: 3,
|
|
threshold_weight: 333_333,
|
|
weight_restrict_decay: 1,
|
|
xcmp_max_individual_weight: 10_000_000_000,
|
|
};
|
|
|
|
new_test_ext().execute_with(|| {
|
|
frame_support::storage::unhashed::put_raw(
|
|
&crate::QueueConfig::<Test>::hashed_key(),
|
|
&v1.encode(),
|
|
);
|
|
|
|
migrate_to_v2::<Test>();
|
|
|
|
let v2 = crate::QueueConfig::<Test>::get();
|
|
|
|
assert_eq!(v1.suspend_threshold, v2.suspend_threshold);
|
|
assert_eq!(v1.drop_threshold, v2.drop_threshold);
|
|
assert_eq!(v1.resume_threshold, v2.resume_threshold);
|
|
assert_eq!(v1.threshold_weight, v2.threshold_weight.ref_time());
|
|
assert_eq!(v1.weight_restrict_decay, v2.weight_restrict_decay.ref_time());
|
|
assert_eq!(v1.xcmp_max_individual_weight, v2.xcmp_max_individual_weight.ref_time());
|
|
});
|
|
}
|
|
}
|