mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-21 13:15:41 +00:00
generate_storage_alias: Rewrite as proc macro attribute (#11387)
* generate_storage_alias: Rewrite as proc macro attribute
This rewrites the `generate_storage_alias!` declarative macro as proc-macro attribute. While doing
this the name is changed to `storage_alias`. The prefix can now also be the name of a pallet. This
makes storage aliases work in migrations for all kind of chains and not just for the ones that use
predefined prefixes.
* Fix compilation and FMT
* Moare fixes
* 🤦
* ......
* Rework the syntax and support instancing
* FMT
* Prefix variants with `Storage`
* Make it compile
* Fix where clause on rust stable
This commit is contained in:
@@ -30,11 +30,12 @@ impl<T: crate::Config> OnRuntimeUpgrade for CheckCounterPrefix<T> {
|
||||
fn pre_upgrade() -> Result<(), &'static str> {
|
||||
use frame_support::ensure;
|
||||
// The old explicit storage item.
|
||||
frame_support::generate_storage_alias!(BagsList, CounterForListNodes => Value<u32>);
|
||||
#[frame_support::storage_alias]
|
||||
type CounterForListNodes<T: crate::Config> = StorageValue<crate::Pallet<T>, u32>;
|
||||
|
||||
// ensure that a value exists in the counter struct.
|
||||
ensure!(
|
||||
crate::ListNodes::<T>::count() == CounterForListNodes::get().unwrap(),
|
||||
crate::ListNodes::<T>::count() == CounterForListNodes::<T>::get().unwrap(),
|
||||
"wrong list node counter"
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user