fix: Complete snowbridge pezpallet rebrand and critical bug fixes
- snowbridge-pezpallet-* → pezsnowbridge-pezpallet-* (201 refs) - pallet/ directories → pezpallet/ (4 locations) - Fixed pezpallet.rs self-include recursion bug - Fixed sc-chain-spec hardcoded crate name in derive macro - Reverted .pezpallet_by_name() to .pallet_by_name() (subxt API) - Added BizinikiwiConfig type alias for zombienet tests - Deleted obsolete session state files Verified: pezsnowbridge-pezpallet-*, pezpallet-staking, pezpallet-staking-async, pezframe-benchmarking-cli all pass cargo check
This commit is contained in:
@@ -28,14 +28,14 @@ use pezsp_metadata_ir::{
|
||||
use pezsp_runtime::BuildStorage;
|
||||
use pezsp_runtime::{generic, traits::BlakeTwo256};
|
||||
|
||||
pub use self::pezframe_system::{pezpallet_prelude::*, Config, Pallet};
|
||||
pub use self::pezframe_system::{pezpallet_prelude::*, Config, Pezpallet};
|
||||
|
||||
mod inject_runtime_type;
|
||||
mod runtime;
|
||||
mod tasks;
|
||||
|
||||
#[import_section(tasks::tasks_example)]
|
||||
#[pallet]
|
||||
#[pezpallet]
|
||||
pub mod pezframe_system {
|
||||
#[allow(unused)]
|
||||
use super::{pezframe_system, pezframe_system::pezpallet_prelude::*};
|
||||
@@ -62,29 +62,29 @@ pub mod pezframe_system {
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T>(_);
|
||||
#[pezpallet::pezpallet]
|
||||
pub struct Pezpallet<T>(_);
|
||||
|
||||
#[pallet::config(with_default, pezframe_system_config)]
|
||||
#[pallet::disable_pezframe_system_supertrait_check]
|
||||
#[pezpallet::config(with_default, pezframe_system_config)]
|
||||
#[pezpallet::disable_pezframe_system_supertrait_check]
|
||||
pub trait Config: 'static {
|
||||
#[pallet::no_default]
|
||||
#[pezpallet::no_default]
|
||||
type Block: Parameter + pezsp_runtime::traits::Block;
|
||||
type AccountId;
|
||||
#[pallet::no_default_bounds]
|
||||
#[pezpallet::no_default_bounds]
|
||||
type BaseCallFilter: crate::traits::Contains<Self::RuntimeCall>;
|
||||
#[pallet::no_default_bounds]
|
||||
#[pezpallet::no_default_bounds]
|
||||
type RuntimeOrigin;
|
||||
#[pallet::no_default_bounds]
|
||||
#[pezpallet::no_default_bounds]
|
||||
type RuntimeCall;
|
||||
#[pallet::no_default_bounds]
|
||||
#[pezpallet::no_default_bounds]
|
||||
type RuntimeTask: crate::traits::tasks::Task;
|
||||
#[pallet::no_default_bounds]
|
||||
#[pezpallet::no_default_bounds]
|
||||
type PalletInfo: crate::traits::PalletInfo;
|
||||
type DbWeight: Get<crate::weights::RuntimeDbWeight>;
|
||||
}
|
||||
|
||||
#[pallet::error]
|
||||
#[pezpallet::error]
|
||||
pub enum Error<T> {
|
||||
/// Required by construct_runtime
|
||||
CallFiltered,
|
||||
@@ -96,13 +96,13 @@ pub mod pezframe_system {
|
||||
FailedTask,
|
||||
}
|
||||
|
||||
#[pallet::origin]
|
||||
#[pezpallet::origin]
|
||||
pub type Origin<T> = RawOrigin<<T as Config>::AccountId>;
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {
|
||||
#[pallet::call_index(0)]
|
||||
#[pallet::weight(task.weight())]
|
||||
#[pezpallet::call]
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
#[pezpallet::call_index(0)]
|
||||
#[pezpallet::weight(task.weight())]
|
||||
pub fn do_task(_origin: OriginFor<T>, task: T::RuntimeTask) -> DispatchResultWithPostInfo {
|
||||
if !task.is_valid() {
|
||||
return Err(Error::<T>::InvalidTask.into());
|
||||
@@ -116,25 +116,25 @@ pub mod pezframe_system {
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type Data<T> = StorageMap<_, Twox64Concat, u32, u64, ValueQuery>;
|
||||
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type OptionLinkedMap<T> = StorageMap<_, Blake2_128Concat, u32, u32, OptionQuery>;
|
||||
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type GenericData<T: Config> =
|
||||
StorageMap<_, Identity, BlockNumberFor<T>, BlockNumberFor<T>, ValueQuery>;
|
||||
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type GenericData2<T: Config> =
|
||||
StorageMap<_, Blake2_128Concat, BlockNumberFor<T>, BlockNumberFor<T>, OptionQuery>;
|
||||
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type DataDM<T> =
|
||||
StorageDoubleMap<_, Twox64Concat, u32, Blake2_128Concat, u32, u64, ValueQuery>;
|
||||
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type GenericDataDM<T: Config> = StorageDoubleMap<
|
||||
_,
|
||||
Blake2_128Concat,
|
||||
@@ -145,7 +145,7 @@ pub mod pezframe_system {
|
||||
ValueQuery,
|
||||
>;
|
||||
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type GenericData2DM<T: Config> = StorageDoubleMap<
|
||||
_,
|
||||
Blake2_128Concat,
|
||||
@@ -156,8 +156,8 @@ pub mod pezframe_system {
|
||||
OptionQuery,
|
||||
>;
|
||||
|
||||
#[pallet::storage]
|
||||
#[pallet::unbounded]
|
||||
#[pezpallet::storage]
|
||||
#[pezpallet::unbounded]
|
||||
pub type AppendableDM<T: Config> = StorageDoubleMap<
|
||||
_,
|
||||
Blake2_128Concat,
|
||||
@@ -168,7 +168,7 @@ pub mod pezframe_system {
|
||||
ValueQuery,
|
||||
>;
|
||||
|
||||
#[pallet::genesis_config]
|
||||
#[pezpallet::genesis_config]
|
||||
pub struct GenesisConfig<T: Config> {
|
||||
pub data: Vec<(u32, u64)>,
|
||||
pub test_config: Vec<(u32, u32, u64)>,
|
||||
@@ -186,7 +186,7 @@ pub mod pezframe_system {
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
#[pezpallet::genesis_build]
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
|
||||
fn build(&self) {
|
||||
for (k, v) in &self.data {
|
||||
@@ -199,11 +199,11 @@ pub mod pezframe_system {
|
||||
}
|
||||
|
||||
/// Some running total.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type Total<T: Config> = StorageValue<_, (u32, u32), ValueQuery>;
|
||||
|
||||
/// Numbers to be added into the total.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type Numbers<T: Config> = StorageMap<_, Twox64Concat, u32, u32, OptionQuery>;
|
||||
|
||||
pub mod pezpallet_prelude {
|
||||
@@ -701,7 +701,7 @@ fn expected_metadata() -> PalletStorageMetadataIR {
|
||||
|
||||
#[test]
|
||||
fn store_metadata() {
|
||||
let metadata = Pallet::<Runtime>::storage_metadata();
|
||||
let metadata = Pezpallet::<Runtime>::storage_metadata();
|
||||
pretty_assertions::assert_eq!(expected_metadata(), metadata);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,63 +19,63 @@
|
||||
use super::{pezframe_system, Block};
|
||||
use crate::derive_impl;
|
||||
|
||||
#[crate::pallet(dev_mode)]
|
||||
#[crate::pezpallet(dev_mode)]
|
||||
mod pezpallet_basic {
|
||||
use super::pezframe_system;
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T>(_);
|
||||
#[pezpallet::pezpallet]
|
||||
pub struct Pezpallet<T>(_);
|
||||
|
||||
#[pallet::config]
|
||||
#[pezpallet::config]
|
||||
pub trait Config: pezframe_system::Config {}
|
||||
}
|
||||
|
||||
impl pezpallet_basic::Config for Runtime {}
|
||||
|
||||
#[crate::pallet(dev_mode)]
|
||||
#[crate::pezpallet(dev_mode)]
|
||||
mod pezpallet_with_disabled_call {
|
||||
use super::pezframe_system;
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T>(_);
|
||||
#[pezpallet::pezpallet]
|
||||
pub struct Pezpallet<T>(_);
|
||||
|
||||
#[pallet::config]
|
||||
#[pezpallet::config]
|
||||
pub trait Config: pezframe_system::Config {}
|
||||
}
|
||||
|
||||
impl pezpallet_with_disabled_call::Config for Runtime {}
|
||||
|
||||
#[crate::pallet(dev_mode)]
|
||||
#[crate::pezpallet(dev_mode)]
|
||||
mod pezpallet_with_disabled_unsigned {
|
||||
use super::pezframe_system;
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T>(_);
|
||||
#[pezpallet::pezpallet]
|
||||
pub struct Pezpallet<T>(_);
|
||||
|
||||
#[pallet::config]
|
||||
#[pezpallet::config]
|
||||
pub trait Config: pezframe_system::Config {}
|
||||
}
|
||||
|
||||
impl pezpallet_with_disabled_unsigned::Config for Runtime {}
|
||||
|
||||
#[crate::pallet]
|
||||
#[crate::pezpallet]
|
||||
mod pezpallet_with_instance {
|
||||
use super::pezframe_system;
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T, I = ()>(_);
|
||||
#[pezpallet::pezpallet]
|
||||
pub struct Pezpallet<T, I = ()>(_);
|
||||
|
||||
#[pallet::config]
|
||||
#[pezpallet::config]
|
||||
pub trait Config<I: 'static = ()>: pezframe_system::Config {}
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
type Instance1 = pezpallet_with_instance::Pallet<pezpallet_with_instance::Instance1>;
|
||||
type Instance1 = pezpallet_with_instance::Pezpallet<pezpallet_with_instance::Instance1>;
|
||||
|
||||
impl pezpallet_with_instance::Config<pezpallet_with_instance::Instance1> for Runtime {}
|
||||
|
||||
#[allow(unused)]
|
||||
type Instance2 = pezpallet_with_instance::Pallet<pezpallet_with_instance::Instance2>;
|
||||
type Instance2 = pezpallet_with_instance::Pezpallet<pezpallet_with_instance::Instance2>;
|
||||
|
||||
impl pezpallet_with_instance::Config<pezpallet_with_instance::Instance2> for Runtime {}
|
||||
|
||||
@@ -104,30 +104,30 @@ mod runtime {
|
||||
)]
|
||||
pub struct Runtime;
|
||||
|
||||
// Use the concrete pallet type
|
||||
// Use the concrete pezpallet type
|
||||
#[runtime::pezpallet_index(0)]
|
||||
pub type System = pezframe_system::Pallet<Runtime>;
|
||||
pub type System = pezframe_system::Pezpallet<Runtime>;
|
||||
|
||||
// Use path to the pallet
|
||||
// Use path to the pezpallet
|
||||
#[runtime::pezpallet_index(1)]
|
||||
pub type Basic = pezpallet_basic;
|
||||
|
||||
// Use the concrete pallet type with instance
|
||||
// Use the concrete pezpallet type with instance
|
||||
#[runtime::pezpallet_index(2)]
|
||||
pub type PalletWithInstance1 = pezpallet_with_instance::Pallet<Runtime, Instance1>;
|
||||
pub type PalletWithInstance1 = pezpallet_with_instance::Pezpallet<Runtime, Instance1>;
|
||||
|
||||
// Use path to the pallet with instance
|
||||
// Use path to the pezpallet with instance
|
||||
#[runtime::pezpallet_index(3)]
|
||||
pub type PalletWithInstance2 = pezpallet_with_instance<Instance2>;
|
||||
|
||||
// Ensure that the runtime does not export the calls from the pallet
|
||||
// Ensure that the runtime does not export the calls from the pezpallet
|
||||
#[runtime::pezpallet_index(4)]
|
||||
#[runtime::disable_call]
|
||||
#[deprecated = "example"]
|
||||
pub type PalletWithDisabledCall = pezpallet_with_disabled_call::Pallet<Runtime>;
|
||||
pub type PalletWithDisabledCall = pezpallet_with_disabled_call::Pezpallet<Runtime>;
|
||||
|
||||
// Ensure that the runtime does not export the unsigned calls from the pallet
|
||||
// Ensure that the runtime does not export the unsigned calls from the pezpallet
|
||||
#[runtime::pezpallet_index(5)]
|
||||
#[runtime::disable_unsigned]
|
||||
pub type PalletWithDisabledUnsigned = pezpallet_with_disabled_unsigned::Pallet<Runtime>;
|
||||
pub type PalletWithDisabledUnsigned = pezpallet_with_disabled_unsigned::Pezpallet<Runtime>;
|
||||
}
|
||||
|
||||
@@ -26,13 +26,13 @@ use pezframe_support_procedural::pezpallet_section;
|
||||
#[pezpallet_section]
|
||||
mod tasks_example {
|
||||
#[docify::export(tasks_example)]
|
||||
#[pallet::tasks_experimental]
|
||||
impl<T: Config> Pallet<T> {
|
||||
#[pezpallet::tasks_experimental]
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Add a pair of numbers into the totals and remove them.
|
||||
#[pallet::task_list(Numbers::<T>::iter_keys())]
|
||||
#[pallet::task_condition(|i| Numbers::<T>::contains_key(i))]
|
||||
#[pallet::task_weight(0.into())]
|
||||
#[pallet::task_index(0)]
|
||||
#[pezpallet::task_list(Numbers::<T>::iter_keys())]
|
||||
#[pezpallet::task_condition(|i| Numbers::<T>::contains_key(i))]
|
||||
#[pezpallet::task_weight(0.into())]
|
||||
#[pezpallet::task_index(0)]
|
||||
pub fn add_number_into_total(i: u32) -> DispatchResult {
|
||||
let v = Numbers::<T>::take(i).ok_or(Error::<T>::NotFound)?;
|
||||
Total::<T>::mutate(|(total_keys, total_values)| {
|
||||
|
||||
Reference in New Issue
Block a user