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:
@@ -38,5 +38,5 @@ mod benchmarks {
|
||||
assert_eq!(Numbers::<T>::get(0), None);
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(Pallet, crate::tests::new_test_ext(), crate::mock::Runtime);
|
||||
impl_benchmark_test_suite!(Pezpallet, crate::tests::new_test_ext(), crate::mock::Runtime);
|
||||
}
|
||||
|
||||
@@ -15,15 +15,15 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! This pallet demonstrates the use of the `pallet::task` api for service work.
|
||||
//! This pezpallet demonstrates the use of the `pezpallet::task` api for service work.
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
use pezframe_support::dispatch::DispatchResult;
|
||||
use pezframe_system::offchain::CreateBare;
|
||||
#[cfg(feature = "experimental")]
|
||||
use pezframe_system::offchain::SubmitTransaction;
|
||||
// Re-export pallet items so that they can be accessed from the crate namespace.
|
||||
pub use pallet::*;
|
||||
// Re-export pezpallet items so that they can be accessed from the crate namespace.
|
||||
pub use pezpallet::*;
|
||||
|
||||
pub mod mock;
|
||||
pub mod tests;
|
||||
@@ -37,25 +37,25 @@ pub use weights::*;
|
||||
#[cfg(feature = "experimental")]
|
||||
const LOG_TARGET: &str = "pezpallet-example-tasks";
|
||||
|
||||
#[pezframe_support::pallet(dev_mode)]
|
||||
pub mod pallet {
|
||||
#[pezframe_support::pezpallet(dev_mode)]
|
||||
pub mod pezpallet {
|
||||
use super::*;
|
||||
use pezframe_support::pezpallet_prelude::*;
|
||||
use pezframe_system::pezpallet_prelude::*;
|
||||
|
||||
#[pallet::error]
|
||||
#[pezpallet::error]
|
||||
pub enum Error<T> {
|
||||
/// The referenced task was not found.
|
||||
NotFound,
|
||||
}
|
||||
|
||||
#[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(T::WeightInfo::add_number_into_total())]
|
||||
#[pallet::task_index(0)]
|
||||
#[pezpallet::task_list(Numbers::<T>::iter_keys())]
|
||||
#[pezpallet::task_condition(|i| Numbers::<T>::contains_key(i))]
|
||||
#[pezpallet::task_weight(T::WeightInfo::add_number_into_total())]
|
||||
#[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)| {
|
||||
@@ -66,8 +66,8 @@ pub mod pallet {
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::hooks]
|
||||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
|
||||
#[pezpallet::hooks]
|
||||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pezpallet<T> {
|
||||
#[cfg(feature = "experimental")]
|
||||
fn offchain_worker(_block_number: BlockNumberFor<T>) {
|
||||
if let Some(key) = Numbers::<T>::iter_keys().next() {
|
||||
@@ -90,7 +90,7 @@ pub mod pallet {
|
||||
fn offchain_worker(_block_number: BlockNumberFor<T>) {}
|
||||
}
|
||||
|
||||
#[pallet::config]
|
||||
#[pezpallet::config]
|
||||
pub trait Config: CreateBare<pezframe_system::Call<Self>> + pezframe_system::Config {
|
||||
type RuntimeTask: pezframe_support::traits::Task
|
||||
+ IsType<<Self as pezframe_system::Config>::RuntimeTask>
|
||||
@@ -98,14 +98,14 @@ pub mod pallet {
|
||||
type WeightInfo: WeightInfo;
|
||||
}
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T>(_);
|
||||
#[pezpallet::pezpallet]
|
||||
pub struct Pezpallet<T>(_);
|
||||
|
||||
/// 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>;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ pub fn new_test_ext() -> pezsp_io::TestExternalities {
|
||||
fn task_enumerate_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
Numbers::<Runtime>::insert(0, 1);
|
||||
assert_eq!(crate::pallet::Task::<Runtime>::iter().collect::<Vec<_>>().len(), 1);
|
||||
assert_eq!(crate::pezpallet::Task::<Runtime>::iter().collect::<Vec<_>>().len(), 1);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ fn runtime_task_enumerate_works_via_pallet_config() {
|
||||
new_test_ext().execute_with(|| {
|
||||
Numbers::<Runtime>::insert(1, 4);
|
||||
assert_eq!(
|
||||
<Runtime as crate::pallet::Config>::RuntimeTask::iter()
|
||||
<Runtime as crate::pezpallet::Config>::RuntimeTask::iter()
|
||||
.collect::<Vec<_>>()
|
||||
.len(),
|
||||
1
|
||||
@@ -77,7 +77,7 @@ fn runtime_task_enumerate_works_via_pallet_config() {
|
||||
#[test]
|
||||
fn task_index_works_at_pallet_level() {
|
||||
new_test_ext().execute_with(|| {
|
||||
assert_eq!(crate::pallet::Task::<Runtime>::AddNumberIntoTotal { i: 2u32 }.task_index(), 0);
|
||||
assert_eq!(crate::pezpallet::Task::<Runtime>::AddNumberIntoTotal { i: 2u32 }.task_index(), 0);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ fn task_index_works_at_pallet_level() {
|
||||
fn task_index_works_at_runtime_level() {
|
||||
new_test_ext().execute_with(|| {
|
||||
assert_eq!(
|
||||
<Runtime as pezframe_system::Config>::RuntimeTask::TasksExample(crate::pallet::Task::<
|
||||
<Runtime as pezframe_system::Config>::RuntimeTask::TasksExample(crate::pezpallet::Task::<
|
||||
Runtime,
|
||||
>::AddNumberIntoTotal {
|
||||
i: 1u32
|
||||
@@ -105,7 +105,7 @@ fn task_execution_works() {
|
||||
Numbers::<Runtime>::insert(1, 4);
|
||||
|
||||
let task =
|
||||
<Runtime as pezframe_system::Config>::RuntimeTask::TasksExample(crate::pallet::Task::<
|
||||
<Runtime as pezframe_system::Config>::RuntimeTask::TasksExample(crate::pezpallet::Task::<
|
||||
Runtime,
|
||||
>::AddNumberIntoTotal {
|
||||
i: 1u32,
|
||||
@@ -127,7 +127,7 @@ fn task_execution_fails_for_invalid_task() {
|
||||
System::do_task(
|
||||
RuntimeOrigin::signed(1),
|
||||
<Runtime as pezframe_system::Config>::RuntimeTask::TasksExample(
|
||||
crate::pallet::Task::<Runtime>::AddNumberIntoTotal { i: 0u32 }
|
||||
crate::pezpallet::Task::<Runtime>::AddNumberIntoTotal { i: 0u32 }
|
||||
),
|
||||
),
|
||||
pezframe_system::Error::<Runtime>::InvalidTask
|
||||
|
||||
@@ -44,10 +44,10 @@
|
||||
// frame-omni-bencher
|
||||
// v1
|
||||
// benchmark
|
||||
// pallet
|
||||
// pezpallet
|
||||
// --extrinsic=*
|
||||
// --runtime=target/production/wbuild/pez-kitchensink-runtime/pez_kitchensink_runtime.wasm
|
||||
// --pallet=pezpallet_example_tasks
|
||||
// --pezpallet=pezpallet_example_tasks
|
||||
// --header=/__w/pezkuwi-sdk/pezkuwi-sdk/bizinikiwi/HEADER-APACHE2
|
||||
// --output=/__w/pezkuwi-sdk/pezkuwi-sdk/bizinikiwi/pezframe/examples/tasks/src/weights.rs
|
||||
// --wasm-execution=compiled
|
||||
|
||||
Reference in New Issue
Block a user