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:
2025-12-16 09:57:23 +03:00
parent eea003e14d
commit 3139ffa25e
3022 changed files with 42157 additions and 23579 deletions
@@ -16,7 +16,7 @@
//! The definition of a [`FixedVelocityConsensusHook`] for consensus logic to manage
//! block velocity.
use super::{pallet, Aura};
use super::{pezpallet, Aura};
use core::{marker::PhantomData, num::NonZeroU32};
use pezcumulus_pezpallet_teyrchain_system::{
self as teyrchain_system,
@@ -53,7 +53,7 @@ pub struct FixedVelocityConsensusHook<
>(PhantomData<T>);
impl<
T: pallet::Config,
T: pezpallet::Config,
const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32,
const V: u32,
const C: u32,
@@ -75,7 +75,7 @@ where
let velocity = V.max(1);
let relay_chain_slot = state_proof.read_slot().expect("failed to read relay chain slot");
let (relay_chain_slot, authored_in_relay) = match pallet::RelaySlotInfo::<T>::get() {
let (relay_chain_slot, authored_in_relay) = match pezpallet::RelaySlotInfo::<T>::get() {
Some((slot, authored)) if slot == relay_chain_slot => (slot, authored),
Some((slot, _)) if slot < relay_chain_slot => (relay_chain_slot, 0),
Some((slot, _)) => {
@@ -89,7 +89,7 @@ where
panic!("authored blocks limit is reached for the slot: relay_chain_slot={relay_chain_slot:?}, authored={authored_in_relay:?}, velocity={velocity:?}");
}
pallet::RelaySlotInfo::<T>::put((relay_chain_slot, authored_in_relay + 1));
pezpallet::RelaySlotInfo::<T>::put((relay_chain_slot, authored_in_relay + 1));
let para_slot = pezpallet_aura::CurrentSlot::<T>::get();
@@ -123,7 +123,7 @@ where
}
impl<
T: pallet::Config + teyrchain_system::Config,
T: pezpallet::Config + teyrchain_system::Config,
const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32,
const V: u32,
const C: u32,
@@ -141,13 +141,13 @@ impl<
/// is more recent than the included block itself.
pub fn can_build_upon(included_hash: T::Hash, new_slot: Slot) -> bool {
let velocity = V.max(1);
let (last_slot, authored_so_far) = match pallet::RelaySlotInfo::<T>::get() {
let (last_slot, authored_so_far) = match pezpallet::RelaySlotInfo::<T>::get() {
None => return true,
Some(x) => x,
};
let size_after_included =
teyrchain_system::Pallet::<T>::unincluded_segment_size_after(included_hash);
teyrchain_system::Pezpallet::<T>::unincluded_segment_size_after(included_hash);
// can never author when the unincluded segment is full.
if size_after_included >= C {
+17 -17
View File
@@ -14,10 +14,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//! Pezcumulus extension pallet for AuRa
//! Pezcumulus extension pezpallet for AuRa
//!
//! This pallet extends the Bizinikiwi AuRa pallet to make it compatible with teyrchains. It
//! provides the [`Pallet`], the [`Config`] and the [`GenesisConfig`].
//! This pezpallet extends the Bizinikiwi AuRa pezpallet to make it compatible with teyrchains. It
//! provides the [`Pezpallet`], the [`Config`] and the [`GenesisConfig`].
//!
//! It is also required that the teyrchain runtime uses the provided [`BlockExecutor`] to properly
//! check the constructed block on the relay chain.
@@ -45,26 +45,26 @@ mod test;
pub use consensus_hook::FixedVelocityConsensusHook;
type Aura<T> = pezpallet_aura::Pallet<T>;
type Aura<T> = pezpallet_aura::Pezpallet<T>;
pub use pallet::*;
pub use pezpallet::*;
#[pezframe_support::pallet]
pub mod pallet {
#[pezframe_support::pezpallet]
pub mod pezpallet {
use super::*;
use pezframe_support::pezpallet_prelude::*;
use pezframe_system::pezpallet_prelude::*;
/// The configuration trait.
#[pallet::config]
#[pezpallet::config]
pub trait Config: pezpallet_aura::Config + pezframe_system::Config {}
#[pallet::pallet]
#[pallet::storage_version(migration::STORAGE_VERSION)]
pub struct Pallet<T>(_);
#[pezpallet::pezpallet]
#[pezpallet::storage_version(migration::STORAGE_VERSION)]
pub struct Pezpallet<T>(_);
#[pallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
#[pezpallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pezpallet<T> {
fn on_finalize(_: BlockNumberFor<T>) {
// Update to the latest AuRa authorities.
Authorities::<T>::put(pezpallet_aura::Authorities::<T>::get());
@@ -83,7 +83,7 @@ pub mod pallet {
/// The authorities in AuRa are overwritten in `on_initialize` when we switch to a new session,
/// but we require the old authorities to verify the seal when validating a PoV. This will
/// always be updated to the latest AuRa authorities in `on_finalize`.
#[pallet::storage]
#[pezpallet::storage]
pub(crate) type Authorities<T: Config> = StorageValue<
_,
BoundedVec<T::AuthorityId, <T as pezpallet_aura::Config>::MaxAuthorities>,
@@ -94,17 +94,17 @@ pub mod pallet {
///
/// This is updated in [`FixedVelocityConsensusHook::on_state_proof`] with the current relay
/// chain slot as provided by the relay chain state proof.
#[pallet::storage]
#[pezpallet::storage]
pub(crate) type RelaySlotInfo<T: Config> = StorageValue<_, (Slot, u32), OptionQuery>;
#[pallet::genesis_config]
#[pezpallet::genesis_config]
#[derive(pezframe_support::DefaultNoBound)]
pub struct GenesisConfig<T: Config> {
#[serde(skip)]
pub _config: core::marker::PhantomData<T>,
}
#[pallet::genesis_build]
#[pezpallet::genesis_build]
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
fn build(&self) {
let authorities = pezpallet_aura::Authorities::<T>::get();
@@ -15,7 +15,7 @@
// limitations under the License.
extern crate alloc;
use crate::{Config, Pallet};
use crate::{Config, Pezpallet};
#[cfg(feature = "try-runtime")]
use alloc::vec::Vec;
use pezframe_support::{migrations::VersionedMigration, pezpallet_prelude::StorageVersion};
@@ -32,7 +32,7 @@ mod v0 {
///
/// Updated on each block initialization.
#[storage_alias]
pub(super) type SlotInfo<T: Config> = StorageValue<Pallet<T>, (Slot, u32), OptionQuery>;
pub(super) type SlotInfo<T: Config> = StorageValue<Pezpallet<T>, (Slot, u32), OptionQuery>;
}
mod v1 {
use super::*;
@@ -69,6 +69,6 @@ pub type MigrateV0ToV1<T> = VersionedMigration<
0,
1,
v1::UncheckedMigrationToV1<T>,
Pallet<T>,
Pezpallet<T>,
<T as pezframe_system::Config>::DbWeight,
>;
+17 -17
View File
@@ -38,23 +38,23 @@ use pezsp_trie::{proof_size_extension::ProofSizeExt, recorder::Recorder};
use pezsp_version::RuntimeVersion;
use std::cell::RefCell;
// Test pallet that reads storage and calls storage_proof_size
#[pezframe_support::pallet]
// Test pezpallet that reads storage and calls storage_proof_size
#[pezframe_support::pezpallet]
pub mod test_pallet {
use pezframe_support::pezpallet_prelude::*;
use pezframe_system::pezpallet_prelude::*;
#[pallet::config]
#[pezpallet::config]
pub trait Config: pezframe_system::Config {}
#[pallet::pallet]
pub struct Pallet<T>(_);
#[pezpallet::pezpallet]
pub struct Pezpallet<T>(_);
#[pallet::storage]
#[pezpallet::storage]
pub type TestStorage<T: Config> = StorageValue<_, u64, ValueQuery>;
#[pallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
#[pezpallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pezpallet<T> {
fn on_initialize(_n: BlockNumberFor<T>) -> Weight {
let proof_size =
pezcumulus_primitives_proof_size_hostfunction::storage_proof_size::storage_proof_size(
@@ -188,7 +188,7 @@ fn relay_chain_state_proof(relay_slot: u64) -> RelayChainStateProof {
}
fn assert_slot_info(expected_slot: u64, expected_authored: u32) {
let (slot, authored) = pallet::RelaySlotInfo::<Test>::get().unwrap();
let (slot, authored) = pezpallet::RelaySlotInfo::<Test>::get().unwrap();
assert_eq!(slot, Slot::from(expected_slot), "Slot stored in RelaySlotInfo is incorrect.");
assert_eq!(
authored, expected_authored,
@@ -436,23 +436,23 @@ fn test_can_build_upon_unincluded_segment_size() {
fn block_executor_does_not_influence_proof_size_recordings() {
fn build_block(header: <Block as BlockT>::Header) -> <Block as BlockT>::Header {
// Initialize the block
pezframe_system::Pallet::<Test>::initialize(
pezframe_system::Pezpallet::<Test>::initialize(
&header.number,
&header.parent_hash,
&header.digest(),
);
// We omit `teyrchain-system` as it is not important here.
<pezframe_system::Pallet<Test> as Hooks<_>>::on_initialize(header.number);
<crate::Pallet<Test> as Hooks<_>>::on_initialize(header.number);
<test_pallet::Pallet<Test> as Hooks<_>>::on_initialize(header.number);
<pezframe_system::Pezpallet<Test> as Hooks<_>>::on_initialize(header.number);
<crate::Pezpallet<Test> as Hooks<_>>::on_initialize(header.number);
<test_pallet::Pezpallet<Test> as Hooks<_>>::on_initialize(header.number);
<test_pallet::Pallet<Test> as Hooks<_>>::on_finalize(header.number);
<crate::Pallet<Test> as Hooks<_>>::on_finalize(header.number);
<pezframe_system::Pallet<Test> as Hooks<_>>::on_finalize(header.number);
<test_pallet::Pezpallet<Test> as Hooks<_>>::on_finalize(header.number);
<crate::Pezpallet<Test> as Hooks<_>>::on_finalize(header.number);
<pezframe_system::Pezpallet<Test> as Hooks<_>>::on_finalize(header.number);
// Finalize the block
pezframe_system::Pallet::<Test>::finalize()
pezframe_system::Pezpallet::<Test>::finalize()
}
// Create a simple executive that calls on_initialize and on_finalize