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:
@@ -6,7 +6,7 @@ edition.workspace = true
|
||||
license = "Apache-2.0"
|
||||
homepage.workspace = true
|
||||
repository.workspace = true
|
||||
description = "FRAME offences pallet"
|
||||
description = "FRAME offences pezpallet"
|
||||
readme = "README.md"
|
||||
documentation = "https://docs.rs/pezpallet-offences"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ edition.workspace = true
|
||||
license = "Apache-2.0"
|
||||
homepage.workspace = true
|
||||
repository.workspace = true
|
||||
description = "FRAME offences pallet benchmarking"
|
||||
description = "FRAME offences pezpallet benchmarking"
|
||||
readme = "README.md"
|
||||
documentation = "https://docs.rs/pezpallet-offences-benchmarking"
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
Offences pallet benchmarking.
|
||||
Offences pezpallet benchmarking.
|
||||
|
||||
License: Apache-2.0
|
||||
|
||||
@@ -15,25 +15,25 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! Offences pallet benchmarking.
|
||||
//! Offences pezpallet benchmarking.
|
||||
|
||||
use alloc::{vec, vec::Vec};
|
||||
use codec::Decode;
|
||||
use pezframe_benchmarking::v2::*;
|
||||
use pezframe_support::traits::Get;
|
||||
use pezframe_system::{Config as SystemConfig, Pallet as System, RawOrigin};
|
||||
use pezframe_system::{Config as SystemConfig, Pezpallet as System, RawOrigin};
|
||||
use pezpallet_babe::EquivocationOffence as BabeEquivocationOffence;
|
||||
use pezpallet_balances::Config as BalancesConfig;
|
||||
use pezpallet_grandpa::{
|
||||
EquivocationOffence as GrandpaEquivocationOffence, TimeSlot as GrandpaTimeSlot,
|
||||
};
|
||||
use pezpallet_offences::{Config as OffencesConfig, Pallet as Offences};
|
||||
use pezpallet_offences::{Config as OffencesConfig, Pezpallet as Offences};
|
||||
use pezpallet_session::{
|
||||
historical::{Config as HistoricalConfig, IdentificationTuple},
|
||||
Config as SessionConfig, Pallet as Session,
|
||||
Config as SessionConfig, Pezpallet as Session,
|
||||
};
|
||||
use pezpallet_staking::{
|
||||
Config as StakingConfig, Exposure, IndividualExposure, MaxNominationsOf, Pallet as Staking,
|
||||
Config as StakingConfig, Exposure, IndividualExposure, MaxNominationsOf, Pezpallet as Staking,
|
||||
RewardDestination, ValidatorPrefs,
|
||||
};
|
||||
use pezsp_runtime::{
|
||||
@@ -46,7 +46,7 @@ const SEED: u32 = 0;
|
||||
|
||||
const MAX_NOMINATORS: u32 = 100;
|
||||
|
||||
pub struct Pallet<T: Config>(Offences<T>);
|
||||
pub struct Pezpallet<T: Config>(Offences<T>);
|
||||
|
||||
pub trait Config:
|
||||
SessionConfig<ValidatorId = <Self as pezframe_system::Config>::AccountId>
|
||||
@@ -285,5 +285,5 @@ mod benchmarks {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(Pallet, crate::mock::new_test_ext(), crate::mock::Test);
|
||||
impl_benchmark_test_suite!(Pezpallet, crate::mock::new_test_ext(), crate::mock::Test);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! Offences pallet benchmarking.
|
||||
//! Offences pezpallet benchmarking.
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ impl pezpallet_staking::Config for Test {
|
||||
type OldCurrency = Balances;
|
||||
type Currency = Balances;
|
||||
type CurrencyBalance = <Self as pezpallet_balances::Config>::Balance;
|
||||
type UnixTime = pezpallet_timestamp::Pallet<Self>;
|
||||
type UnixTime = pezpallet_timestamp::Pezpallet<Self>;
|
||||
type AdminOrigin = pezframe_system::EnsureRoot<Self::AccountId>;
|
||||
type SessionInterface = Self;
|
||||
type EraPayout = pezpallet_staking::ConvertCurve<RewardCurve>;
|
||||
@@ -188,13 +188,13 @@ pub type UncheckedExtrinsic = pezsp_runtime::generic::UncheckedExtrinsic<u32, Ru
|
||||
pezframe_support::construct_runtime!(
|
||||
pub enum Test
|
||||
{
|
||||
System: system::{Pallet, Call, Event<T>},
|
||||
System: system::{Pezpallet, Call, Event<T>},
|
||||
Balances: pezpallet_balances,
|
||||
Staking: pezpallet_staking,
|
||||
Session: pezpallet_session,
|
||||
ImOnline: pezpallet_im_online::{Pallet, Call, Storage, Event<T>, ValidateUnsigned, Config<T>},
|
||||
Offences: pezpallet_offences::{Pallet, Storage, Event},
|
||||
Historical: pezpallet_session_historical::{Pallet, Event<T>},
|
||||
ImOnline: pezpallet_im_online::{Pezpallet, Call, Storage, Event<T>, ValidateUnsigned, Config<T>},
|
||||
Offences: pezpallet_offences::{Pezpallet, Storage, Event},
|
||||
Historical: pezpallet_session_historical::{Pezpallet, Event<T>},
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! # Offences Pallet
|
||||
//! # Offences Pezpallet
|
||||
//!
|
||||
//! Tracks reported offences
|
||||
|
||||
@@ -38,7 +38,7 @@ use pezsp_staking::{
|
||||
SessionIndex,
|
||||
};
|
||||
|
||||
pub use pallet::*;
|
||||
pub use pezpallet::*;
|
||||
|
||||
/// A binary blob which represents a SCALE codec-encoded `O::TimeSlot`.
|
||||
type OpaqueTimeSlot = Vec<u8>;
|
||||
@@ -48,20 +48,20 @@ type ReportIdOf<T> = <T as pezframe_system::Config>::Hash;
|
||||
|
||||
const LOG_TARGET: &str = "runtime::offences";
|
||||
|
||||
#[pezframe_support::pallet]
|
||||
pub mod pallet {
|
||||
#[pezframe_support::pezpallet]
|
||||
pub mod pezpallet {
|
||||
use super::*;
|
||||
use pezframe_support::pezpallet_prelude::*;
|
||||
|
||||
const STORAGE_VERSION: StorageVersion = StorageVersion::new(1);
|
||||
|
||||
#[pallet::pallet]
|
||||
#[pallet::storage_version(STORAGE_VERSION)]
|
||||
#[pallet::without_storage_info]
|
||||
pub struct Pallet<T>(_);
|
||||
#[pezpallet::pezpallet]
|
||||
#[pezpallet::storage_version(STORAGE_VERSION)]
|
||||
#[pezpallet::without_storage_info]
|
||||
pub struct Pezpallet<T>(_);
|
||||
|
||||
/// The pallet's config trait.
|
||||
#[pallet::config]
|
||||
/// The pezpallet's config trait.
|
||||
#[pezpallet::config]
|
||||
pub trait Config: pezframe_system::Config {
|
||||
/// The overarching event type.
|
||||
#[allow(deprecated)]
|
||||
@@ -73,7 +73,7 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// The primary structure that holds all offence records keyed by report identifiers.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type Reports<T: Config> = StorageMap<
|
||||
_,
|
||||
Twox64Concat,
|
||||
@@ -82,7 +82,7 @@ pub mod pallet {
|
||||
>;
|
||||
|
||||
/// A vector of reports of the same kind that happened at the same time slot.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type ConcurrentReportsIndex<T: Config> = StorageDoubleMap<
|
||||
_,
|
||||
Twox64Concat,
|
||||
@@ -94,8 +94,8 @@ pub mod pallet {
|
||||
>;
|
||||
|
||||
/// Events type.
|
||||
#[pallet::event]
|
||||
#[pallet::generate_deposit(pub(super) fn deposit_event)]
|
||||
#[pezpallet::event]
|
||||
#[pezpallet::generate_deposit(pub(super) fn deposit_event)]
|
||||
pub enum Event {
|
||||
/// There is an offence reported of the given `kind` happened at the `session_index` and
|
||||
/// (kind-specific) time slot. This event is not deposited for duplicate slashes.
|
||||
@@ -104,7 +104,7 @@ pub mod pallet {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T, O> ReportOffence<T::AccountId, T::IdentificationTuple, O> for Pallet<T>
|
||||
impl<T, O> ReportOffence<T::AccountId, T::IdentificationTuple, O> for Pezpallet<T>
|
||||
where
|
||||
T: Config,
|
||||
O: Offence<T::IdentificationTuple>,
|
||||
@@ -151,7 +151,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> Pallet<T> {
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Get the offence details from reports of given ID.
|
||||
pub fn reports(
|
||||
report_id: ReportIdOf<T>,
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use super::{Config, Kind, OffenceDetails, Pallet, Perbill, SessionIndex, LOG_TARGET};
|
||||
use super::{Config, Kind, OffenceDetails, Pezpallet, Perbill, SessionIndex, LOG_TARGET};
|
||||
use alloc::vec::Vec;
|
||||
use pezframe_support::{
|
||||
pezpallet_prelude::ValueQuery,
|
||||
@@ -36,7 +36,7 @@ mod v0 {
|
||||
|
||||
#[storage_alias]
|
||||
pub type ReportsByKindIndex<T: Config> = StorageMap<
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
Twox64Concat,
|
||||
Kind,
|
||||
Vec<u8>, // (O::TimeSlot, ReportIdOf<T>)
|
||||
@@ -63,13 +63,13 @@ pub mod v1 {
|
||||
}
|
||||
|
||||
fn on_runtime_upgrade() -> Weight {
|
||||
if Pallet::<T>::on_chain_storage_version() > 0 {
|
||||
if Pezpallet::<T>::on_chain_storage_version() > 0 {
|
||||
log::info!(target: LOG_TARGET, "pezpallet_offences::MigrateToV1 should be removed");
|
||||
return T::DbWeight::get().reads(1);
|
||||
}
|
||||
|
||||
let keys_removed = v0::ReportsByKindIndex::<T>::clear(u32::MAX, None).unique as u64;
|
||||
StorageVersion::new(1).put::<Pallet<T>>();
|
||||
StorageVersion::new(1).put::<Pezpallet<T>>();
|
||||
|
||||
// + 1 for reading/writing the new storage version
|
||||
T::DbWeight::get().reads_writes(keys_removed + 1, keys_removed + 1)
|
||||
@@ -77,7 +77,7 @@ pub mod v1 {
|
||||
|
||||
#[cfg(feature = "try-runtime")]
|
||||
fn post_upgrade(_state: Vec<u8>) -> Result<(), TryRuntimeError> {
|
||||
let onchain = Pallet::<T>::on_chain_storage_version();
|
||||
let onchain = Pezpallet::<T>::on_chain_storage_version();
|
||||
ensure!(onchain == 1, "pezpallet_offences::MigrateToV1 needs to be run");
|
||||
ensure!(
|
||||
v0::ReportsByKindIndex::<T>::iter_keys().count() == 0,
|
||||
@@ -99,7 +99,7 @@ type DeferredOffenceOf<T> = (
|
||||
// at a later time.
|
||||
#[storage_alias]
|
||||
type DeferredOffences<T: Config> =
|
||||
StorageValue<crate::Pallet<T>, Vec<DeferredOffenceOf<T>>, ValueQuery>;
|
||||
StorageValue<crate::Pezpallet<T>, Vec<DeferredOffenceOf<T>>, ValueQuery>;
|
||||
|
||||
pub fn remove_deferred_storage<T: Config>() -> Weight {
|
||||
let mut weight = T::DbWeight::get().reads_writes(1, 1);
|
||||
|
||||
@@ -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_offences
|
||||
// --pezpallet=pezpallet_offences
|
||||
// --header=/__w/pezkuwi-sdk/pezkuwi-sdk/bizinikiwi/HEADER-APACHE2
|
||||
// --output=/__w/pezkuwi-sdk/pezkuwi-sdk/bizinikiwi/pezframe/offences/src/weights.rs
|
||||
// --wasm-execution=compiled
|
||||
|
||||
Reference in New Issue
Block a user