mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-19 13:31:04 +00:00
Remove use of trait Store (#2286)
* Remove use of Store trait from xcmp-queue pallet * Remove Store trait usage from dmp-queue pallet * Remove Store trait usage from parachain-system pallet * Remove use of Store trait from cumulus * Run cargo fmt
This commit is contained in:
@@ -165,7 +165,6 @@ pub mod pallet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[pallet::pallet]
|
#[pallet::pallet]
|
||||||
#[pallet::generate_store(pub(super) trait Store)]
|
|
||||||
pub struct Pallet<T>(_);
|
pub struct Pallet<T>(_);
|
||||||
|
|
||||||
/// The invulnerable, fixed collators.
|
/// The invulnerable, fixed collators.
|
||||||
|
|||||||
@@ -90,7 +90,6 @@ pub mod pallet {
|
|||||||
use frame_system::pallet_prelude::*;
|
use frame_system::pallet_prelude::*;
|
||||||
|
|
||||||
#[pallet::pallet]
|
#[pallet::pallet]
|
||||||
#[pallet::generate_store(pub(super) trait Store)]
|
|
||||||
#[pallet::storage_version(migration::STORAGE_VERSION)]
|
#[pallet::storage_version(migration::STORAGE_VERSION)]
|
||||||
#[pallet::without_storage_info]
|
#[pallet::without_storage_info]
|
||||||
pub struct Pallet<T>(_);
|
pub struct Pallet<T>(_);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
//! A module that is responsible for migration of storage.
|
//! A module that is responsible for migration of storage.
|
||||||
|
|
||||||
use crate::{Config, Pallet, Store, DEFAULT_POV_SIZE};
|
use crate::{Config, Configuration, Overweight, Pallet, DEFAULT_POV_SIZE};
|
||||||
use frame_support::{
|
use frame_support::{
|
||||||
pallet_prelude::*,
|
pallet_prelude::*,
|
||||||
traits::StorageVersion,
|
traits::StorageVersion,
|
||||||
@@ -74,7 +74,7 @@ pub fn migrate_to_v1<T: Config>() -> Weight {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Err(_) = <Pallet<T> as Store>::Configuration::translate(|pre| pre.map(translate)) {
|
if let Err(_) = Configuration::<T>::translate(|pre| pre.map(translate)) {
|
||||||
log::error!(
|
log::error!(
|
||||||
target: "dmp_queue",
|
target: "dmp_queue",
|
||||||
"unexpected error when performing translation of the QueueConfig type during storage upgrade to v2"
|
"unexpected error when performing translation of the QueueConfig type during storage upgrade to v2"
|
||||||
@@ -89,7 +89,7 @@ pub fn migrate_to_v1<T: Config>() -> Weight {
|
|||||||
/// NOTE: Only use this function if you know what you're doing. Default to using
|
/// NOTE: Only use this function if you know what you're doing. Default to using
|
||||||
/// `migrate_to_latest`.
|
/// `migrate_to_latest`.
|
||||||
pub fn migrate_to_v2<T: Config>() -> Weight {
|
pub fn migrate_to_v2<T: Config>() -> Weight {
|
||||||
let overweight_messages = <Pallet<T> as Store>::Overweight::initialize_counter() as u64;
|
let overweight_messages = Overweight::<T>::initialize_counter() as u64;
|
||||||
|
|
||||||
T::DbWeight::get().reads_writes(overweight_messages, 1)
|
T::DbWeight::get().reads_writes(overweight_messages, 1)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -158,7 +158,6 @@ pub mod pallet {
|
|||||||
|
|
||||||
#[pallet::pallet]
|
#[pallet::pallet]
|
||||||
#[pallet::storage_version(migration::STORAGE_VERSION)]
|
#[pallet::storage_version(migration::STORAGE_VERSION)]
|
||||||
#[pallet::generate_store(pub(super) trait Store)]
|
|
||||||
#[pallet::without_storage_info]
|
#[pallet::without_storage_info]
|
||||||
pub struct Pallet<T>(_);
|
pub struct Pallet<T>(_);
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use crate::{Config, Pallet, Store};
|
use crate::{Config, Pallet, ReservedDmpWeightOverride, ReservedXcmpWeightOverride};
|
||||||
use frame_support::{
|
use frame_support::{
|
||||||
traits::{Get, StorageVersion},
|
traits::{Get, StorageVersion},
|
||||||
weights::Weight,
|
weights::Weight,
|
||||||
@@ -52,18 +52,14 @@ mod v2 {
|
|||||||
pub fn migrate<T: Config>() -> Weight {
|
pub fn migrate<T: Config>() -> Weight {
|
||||||
let translate = |pre: u64| -> Weight { Weight::from_parts(pre, DEFAULT_POV_SIZE) };
|
let translate = |pre: u64| -> Weight { Weight::from_parts(pre, DEFAULT_POV_SIZE) };
|
||||||
|
|
||||||
if <Pallet<T> as Store>::ReservedXcmpWeightOverride::translate(|pre| pre.map(translate))
|
if ReservedXcmpWeightOverride::<T>::translate(|pre| pre.map(translate)).is_err() {
|
||||||
.is_err()
|
|
||||||
{
|
|
||||||
log::error!(
|
log::error!(
|
||||||
target: "parachain_system",
|
target: "parachain_system",
|
||||||
"unexpected error when performing translation of the ReservedXcmpWeightOverride type during storage upgrade to v2"
|
"unexpected error when performing translation of the ReservedXcmpWeightOverride type during storage upgrade to v2"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if <Pallet<T> as Store>::ReservedDmpWeightOverride::translate(|pre| pre.map(translate))
|
if ReservedDmpWeightOverride::<T>::translate(|pre| pre.map(translate)).is_err() {
|
||||||
.is_err()
|
|
||||||
{
|
|
||||||
log::error!(
|
log::error!(
|
||||||
target: "parachain_system",
|
target: "parachain_system",
|
||||||
"unexpected error when performing translation of the ReservedDmpWeightOverride type during storage upgrade to v2"
|
"unexpected error when performing translation of the ReservedDmpWeightOverride type during storage upgrade to v2"
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ pub mod pallet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[pallet::pallet]
|
#[pallet::pallet]
|
||||||
#[pallet::generate_store(pub(super) trait Store)]
|
|
||||||
#[pallet::without_storage_info]
|
#[pallet::without_storage_info]
|
||||||
pub struct Pallet<T>(_);
|
pub struct Pallet<T>(_);
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ pub mod pallet {
|
|||||||
use frame_system::pallet_prelude::*;
|
use frame_system::pallet_prelude::*;
|
||||||
|
|
||||||
#[pallet::pallet]
|
#[pallet::pallet]
|
||||||
#[pallet::generate_store(pub(super) trait Store)]
|
|
||||||
pub struct Pallet<T>(_);
|
pub struct Pallet<T>(_);
|
||||||
|
|
||||||
/// The module configuration trait.
|
/// The module configuration trait.
|
||||||
|
|||||||
@@ -79,7 +79,6 @@ pub mod pallet {
|
|||||||
use frame_system::pallet_prelude::*;
|
use frame_system::pallet_prelude::*;
|
||||||
|
|
||||||
#[pallet::pallet]
|
#[pallet::pallet]
|
||||||
#[pallet::generate_store(pub(super) trait Store)]
|
|
||||||
#[pallet::storage_version(migration::STORAGE_VERSION)]
|
#[pallet::storage_version(migration::STORAGE_VERSION)]
|
||||||
#[pallet::without_storage_info]
|
#[pallet::without_storage_info]
|
||||||
pub struct Pallet<T>(_);
|
pub struct Pallet<T>(_);
|
||||||
@@ -763,13 +762,13 @@ impl<T: Config> Pallet<T> {
|
|||||||
sent_at: RelayBlockNumber,
|
sent_at: RelayBlockNumber,
|
||||||
xcm: Vec<u8>,
|
xcm: Vec<u8>,
|
||||||
) -> OverweightIndex {
|
) -> OverweightIndex {
|
||||||
let index = <Self as Store>::OverweightCount::mutate(|count| {
|
let index = OverweightCount::<T>::mutate(|count| {
|
||||||
let index = *count;
|
let index = *count;
|
||||||
*count += 1;
|
*count += 1;
|
||||||
index
|
index
|
||||||
});
|
});
|
||||||
|
|
||||||
<Self as Store>::Overweight::insert(index, (sender, sent_at, xcm));
|
Overweight::<T>::insert(index, (sender, sent_at, xcm));
|
||||||
index
|
index
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
//! A module that is responsible for migration of storage.
|
//! A module that is responsible for migration of storage.
|
||||||
|
|
||||||
use crate::{Config, Pallet, Store, DEFAULT_POV_SIZE};
|
use crate::{Config, Overweight, Pallet, QueueConfig, DEFAULT_POV_SIZE};
|
||||||
use frame_support::{
|
use frame_support::{
|
||||||
pallet_prelude::*,
|
pallet_prelude::*,
|
||||||
traits::StorageVersion,
|
traits::StorageVersion,
|
||||||
@@ -94,7 +94,7 @@ pub fn migrate_to_v2<T: Config>() -> Weight {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Err(_) = <Pallet<T> as Store>::QueueConfig::translate(|pre| pre.map(translate)) {
|
if let Err(_) = QueueConfig::<T>::translate(|pre| pre.map(translate)) {
|
||||||
log::error!(
|
log::error!(
|
||||||
target: super::LOG_TARGET,
|
target: super::LOG_TARGET,
|
||||||
"unexpected error when performing translation of the QueueConfig type during storage upgrade to v2"
|
"unexpected error when performing translation of the QueueConfig type during storage upgrade to v2"
|
||||||
@@ -105,7 +105,7 @@ pub fn migrate_to_v2<T: Config>() -> Weight {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn migrate_to_v3<T: Config>() -> Weight {
|
pub fn migrate_to_v3<T: Config>() -> Weight {
|
||||||
let overweight_messages = <Pallet<T> as Store>::Overweight::initialize_counter() as u64;
|
let overweight_messages = Overweight::<T>::initialize_counter() as u64;
|
||||||
|
|
||||||
T::DbWeight::get().reads_writes(overweight_messages, 1)
|
T::DbWeight::get().reads_writes(overweight_messages, 1)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ pub mod pallet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[pallet::pallet]
|
#[pallet::pallet]
|
||||||
#[pallet::generate_store(pub(super) trait Store)]
|
|
||||||
pub struct Pallet<T>(_);
|
pub struct Pallet<T>(_);
|
||||||
|
|
||||||
// The pallet's runtime storage items.
|
// The pallet's runtime storage items.
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ pub mod pallet {
|
|||||||
use frame_system::pallet_prelude::*;
|
use frame_system::pallet_prelude::*;
|
||||||
|
|
||||||
#[pallet::pallet]
|
#[pallet::pallet]
|
||||||
#[pallet::generate_store(pub(super) trait Store)]
|
|
||||||
pub struct Pallet<T>(_);
|
pub struct Pallet<T>(_);
|
||||||
|
|
||||||
#[pallet::config]
|
#[pallet::config]
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ pub mod pallet {
|
|||||||
use frame_system::pallet_prelude::*;
|
use frame_system::pallet_prelude::*;
|
||||||
|
|
||||||
#[pallet::pallet]
|
#[pallet::pallet]
|
||||||
#[pallet::generate_store(pub(super) trait Store)]
|
|
||||||
pub struct Pallet<T>(_);
|
pub struct Pallet<T>(_);
|
||||||
|
|
||||||
/// The module configuration trait.
|
/// The module configuration trait.
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ pub mod pallet {
|
|||||||
use frame_system::pallet_prelude::*;
|
use frame_system::pallet_prelude::*;
|
||||||
|
|
||||||
#[pallet::pallet]
|
#[pallet::pallet]
|
||||||
#[pallet::generate_store(pub(super) trait Store)]
|
|
||||||
pub struct Pallet<T>(_);
|
pub struct Pallet<T>(_);
|
||||||
|
|
||||||
#[pallet::config]
|
#[pallet::config]
|
||||||
|
|||||||
Reference in New Issue
Block a user