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:
Vivek Pandya
2023-03-14 03:00:20 +05:30
committed by GitHub
parent 654f98df12
commit 9f09109eaf
13 changed files with 11 additions and 25 deletions
+2 -3
View File
@@ -79,7 +79,6 @@ pub mod pallet {
use frame_system::pallet_prelude::*;
#[pallet::pallet]
#[pallet::generate_store(pub(super) trait Store)]
#[pallet::storage_version(migration::STORAGE_VERSION)]
#[pallet::without_storage_info]
pub struct Pallet<T>(_);
@@ -763,13 +762,13 @@ impl<T: Config> Pallet<T> {
sent_at: RelayBlockNumber,
xcm: Vec<u8>,
) -> OverweightIndex {
let index = <Self as Store>::OverweightCount::mutate(|count| {
let index = OverweightCount::<T>::mutate(|count| {
let index = *count;
*count += 1;
index
});
<Self as Store>::Overweight::insert(index, (sender, sent_at, xcm));
Overweight::<T>::insert(index, (sender, sent_at, xcm));
index
}
+3 -3
View File
@@ -16,7 +16,7 @@
//! 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::{
pallet_prelude::*,
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!(
target: super::LOG_TARGET,
"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 {
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)
}