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
@@ -30,7 +30,7 @@ use crate::{
initializer, HeadData, ValidationCode,
};
fn create_candidate_commitments<T: crate::hrmp::pallet::Config>(
fn create_candidate_commitments<T: crate::hrmp::pezpallet::Config>(
para_id: ParaId,
head_data: HeadData,
max_msg_len: usize,
@@ -103,7 +103,7 @@ mod benchmarks {
let validators = generate_validator_pairs::<T>(n_validators);
let session = SessionIndex::from(0_u32);
initializer::Pallet::<T>::test_trigger_on_new_session(
initializer::Pezpallet::<T>::test_trigger_on_new_session(
false,
session,
validators.iter().map(|(a, v)| (a, v.clone())),
@@ -133,11 +133,11 @@ mod benchmarks {
let receipt = CommittedCandidateReceipt::<T::Hash> { descriptor, commitments };
Pallet::<T>::receive_upward_messages(para, &vec![vec![0; max_len]; 1]);
Pezpallet::<T>::receive_upward_messages(para, &vec![vec![0; max_len]; 1]);
#[block]
{
Pallet::<T>::enact_candidate(
Pezpallet::<T>::enact_candidate(
relay_parent_number,
receipt,
backers,
@@ -149,7 +149,7 @@ mod benchmarks {
}
impl_benchmark_test_suite! {
Pallet,
Pezpallet,
crate::mock::new_test_ext(Default::default()),
crate::mock::Test
}
@@ -14,7 +14,7 @@
pub use v1::MigrateToV1;
pub mod v0 {
use crate::inclusion::{Config, Pallet};
use crate::inclusion::{Config, Pezpallet};
use bitvec::{order::Lsb0 as BitOrderLsb0, vec::BitVec};
use codec::{Decode, Encode};
use pezframe_support::{storage_alias, Twox64Concat};
@@ -45,7 +45,7 @@ pub mod v0 {
#[storage_alias]
pub type PendingAvailability<T: Config> = StorageMap<
Pallet<T>,
Pezpallet<T>,
Twox64Concat,
ParaId,
CandidatePendingAvailability<<T as pezframe_system::Config>::Hash, BlockNumberFor<T>>,
@@ -53,11 +53,11 @@ pub mod v0 {
#[storage_alias]
pub type PendingAvailabilityCommitments<T: Config> =
StorageMap<Pallet<T>, Twox64Concat, ParaId, CandidateCommitments>;
StorageMap<Pezpallet<T>, Twox64Concat, ParaId, CandidateCommitments>;
#[storage_alias]
pub type AvailabilityBitfields<T: Config> = StorageMap<
Pallet<T>,
Pezpallet<T>,
Twox64Concat,
ValidatorIndex,
AvailabilityBitfieldRecord<BlockNumberFor<T>>,
@@ -70,7 +70,7 @@ mod v1 {
PendingAvailabilityCommitments as V0PendingAvailabilityCommitments,
};
use crate::inclusion::{
CandidatePendingAvailability as V1CandidatePendingAvailability, Config, Pallet,
CandidatePendingAvailability as V1CandidatePendingAvailability, Config, Pezpallet,
PendingAvailability as V1PendingAvailability,
};
use alloc::{collections::vec_deque::VecDeque, vec::Vec};
@@ -158,7 +158,7 @@ mod v1 {
fn post_upgrade(state: Vec<u8>) -> Result<(), pezsp_runtime::TryRuntimeError> {
log::trace!(target: crate::inclusion::LOG_TARGET, "Running post_upgrade() for inclusion MigrateToV1");
ensure!(
Pallet::<T>::on_chain_storage_version() >= StorageVersion::new(1),
Pezpallet::<T>::on_chain_storage_version() >= StorageVersion::new(1),
"Storage version should be >= 1 after the migration"
);
@@ -201,7 +201,7 @@ mod v1 {
0,
1,
VersionUncheckedMigrateToV1<T>,
Pallet<T>,
Pezpallet<T>,
<T as pezframe_system::Config>::DbWeight,
>;
}
+39 -39
View File
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Pezkuwi. If not, see <http://www.gnu.org/licenses/>.
//! The inclusion pallet is responsible for inclusion and availability of scheduled teyrchains.
//! The inclusion pezpallet is responsible for inclusion and availability of scheduled teyrchains.
//!
//! It is responsible for carrying candidates from being backable to being backed, and then from
//! backed to included.
@@ -54,7 +54,7 @@ use pezkuwi_primitives::{
use scale_info::TypeInfo;
use pezsp_runtime::{traits::One, DispatchError, SaturatedConversion, Saturating};
pub use pallet::*;
pub use pezpallet::*;
#[cfg(test)]
pub(crate) mod tests;
@@ -89,7 +89,7 @@ impl WeightInfo for () {
/// Maximum value that `config.max_upward_message_size` can be set to.
///
/// This is used for benchmarking sanely bounding relevant storage items. It is expected from the
/// `configuration` pallet to check these values before setting.
/// `configuration` pezpallet to check these values before setting.
pub const MAX_UPWARD_MESSAGE_SIZE_BOUND: u32 = 128 * 1024;
/// A backed candidate pending availability.
@@ -214,7 +214,7 @@ impl QueueFootprinter for () {
}
}
/// Aggregate message origin for the `MessageQueue` pallet.
/// Aggregate message origin for the `MessageQueue` pezpallet.
///
/// Can be extended to serve further use-cases besides just UMP. Is stored in storage, so any change
/// to existing values will require a migration.
@@ -235,7 +235,7 @@ pub enum AggregateMessageOrigin {
Ump(UmpQueueId),
}
/// Identifies a UMP queue inside the `MessageQueue` pallet.
/// Identifies a UMP queue inside the `MessageQueue` pezpallet.
///
/// It is written in verbose form since future variants like `Here` and `Bridged` are already
/// foreseeable.
@@ -268,17 +268,17 @@ impl From<u32> for AggregateMessageOrigin {
pub type MaxUmpMessageLenOf<T> =
<<T as Config>::MessageQueue as EnqueueMessage<AggregateMessageOrigin>>::MaxMessageLen;
#[pezframe_support::pallet]
pub mod pallet {
#[pezframe_support::pezpallet]
pub mod pezpallet {
use super::*;
const STORAGE_VERSION: StorageVersion = StorageVersion::new(1);
#[pallet::pallet]
#[pallet::without_storage_info]
#[pallet::storage_version(STORAGE_VERSION)]
pub struct Pallet<T>(_);
#[pezpallet::pezpallet]
#[pezpallet::without_storage_info]
#[pezpallet::storage_version(STORAGE_VERSION)]
pub struct Pezpallet<T>(_);
#[pallet::config]
#[pezpallet::config]
pub trait Config:
pezframe_system::Config
+ shared::Config
@@ -301,12 +301,12 @@ pub mod pallet {
type MessageQueue: EnqueueMessage<AggregateMessageOrigin>
+ QueueFootprintQuery<AggregateMessageOrigin, MaxMessageLen = MaxUmpMessageLenOf<Self>>;
/// Weight info for the calls of this pallet.
/// Weight info for the calls of this pezpallet.
type WeightInfo: WeightInfo;
}
#[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)]
#[pezpallet::event]
#[pezpallet::generate_deposit(pub(super) fn deposit_event)]
pub enum Event<T: Config> {
/// A candidate was backed. `[candidate, head_data]`
CandidateBacked(CandidateReceipt<T::Hash>, HeadData, CoreIndex, GroupIndex),
@@ -318,7 +318,7 @@ pub mod pallet {
UpwardMessagesReceived { from: ParaId, count: u32 },
}
#[pallet::error]
#[pezpallet::error]
pub enum Error<T> {
/// Validator index out of bounds.
ValidatorIndexOutOfBounds,
@@ -364,8 +364,8 @@ pub mod pallet {
/// Use a different prefix post-migration to v1, since the v0 `PendingAvailability` storage
/// would otherwise have the exact same prefix which could cause undefined behaviour when doing
/// the migration.
#[pallet::storage]
#[pallet::storage_prefix = "V1"]
#[pezpallet::storage]
#[pezpallet::storage_prefix = "V1"]
pub(crate) type PendingAvailability<T: Config> = StorageMap<
_,
Twox64Concat,
@@ -373,8 +373,8 @@ pub mod pallet {
VecDeque<CandidatePendingAvailability<T::Hash, BlockNumberFor<T>>>,
>;
#[pallet::call]
impl<T: Config> Pallet<T> {}
#[pezpallet::call]
impl<T: Config> Pezpallet<T> {}
}
const LOG_TARGET: &str = "runtime::inclusion";
@@ -421,7 +421,7 @@ impl From<hrmp::OutboundHrmpAcceptanceErr> for AcceptanceCheckErr {
}
}
/// An error returned by [`Pallet::check_upward_messages`] that indicates a violation of one of
/// An error returned by [`Pezpallet::check_upward_messages`] that indicates a violation of one of
/// acceptance criteria rules.
#[cfg_attr(test, derive(PartialEq))]
#[allow(dead_code)]
@@ -468,7 +468,7 @@ impl fmt::Debug for UmpAcceptanceCheckErr {
}
}
impl<T: Config> Pallet<T> {
impl<T: Config> Pezpallet<T> {
/// Block initialization logic, called by initializer.
pub(crate) fn initializer_initialize(_now: BlockNumberFor<T>) -> Weight {
Weight::zero()
@@ -647,7 +647,7 @@ impl<T: Config> Pallet<T> {
return Ok(Default::default());
}
let now = pezframe_system::Pallet::<T>::block_number();
let now = pezframe_system::Pezpallet::<T>::block_number();
let validators = shared::ActiveValidatorKeys::<T>::get();
// Collect candidate receipts with backers.
@@ -679,7 +679,7 @@ impl<T: Config> Pallet<T> {
// group assigned to core at block `N + 1`. Thus,
// `relay_parent_number + 1` will always land in the current
// session.
let group_idx = scheduler::Pallet::<T>::group_assigned_to_core(
let group_idx = scheduler::Pezpallet::<T>::group_assigned_to_core(
*core,
relay_parent_number + One::one(),
)
@@ -880,9 +880,9 @@ impl<T: Config> Pallet<T> {
if let Some(new_code) = commitments.new_validation_code {
// Block number of candidate's inclusion.
let now = pezframe_system::Pallet::<T>::block_number();
let now = pezframe_system::Pezpallet::<T>::block_number();
paras::Pallet::<T>::schedule_code_upgrade(
paras::Pezpallet::<T>::schedule_code_upgrade(
receipt.descriptor.para_id(),
new_code,
now,
@@ -892,7 +892,7 @@ impl<T: Config> Pallet<T> {
}
// enact the messaging facet of the candidate.
dmp::Pallet::<T>::prune_dmq(
dmp::Pezpallet::<T>::prune_dmq(
receipt.descriptor.para_id(),
commitments.processed_downward_messages,
);
@@ -900,11 +900,11 @@ impl<T: Config> Pallet<T> {
receipt.descriptor.para_id(),
commitments.upward_messages.as_slice(),
);
hrmp::Pallet::<T>::prune_hrmp(
hrmp::Pezpallet::<T>::prune_hrmp(
receipt.descriptor.para_id(),
BlockNumberFor::<T>::from(commitments.hrmp_watermark),
);
hrmp::Pallet::<T>::queue_outbound_hrmp(
hrmp::Pezpallet::<T>::queue_outbound_hrmp(
receipt.descriptor.para_id(),
commitments.horizontal_messages,
);
@@ -916,7 +916,7 @@ impl<T: Config> Pallet<T> {
backing_group,
));
paras::Pallet::<T>::note_new_head(
paras::Pezpallet::<T>::note_new_head(
receipt.descriptor.para_id(),
commitments.head_data,
relay_parent_number,
@@ -938,7 +938,7 @@ impl<T: Config> Pallet<T> {
let upward_messages = skip_ump_signals(upward_messages.iter()).collect::<Vec<_>>();
// Cannot send UMP messages while off-boarding.
if paras::Pallet::<T>::is_offboarding(para) {
if paras::Pezpallet::<T>::is_offboarding(para) {
ensure!(upward_messages.is_empty(), UmpAcceptanceCheckErr::IsOffboarding);
}
@@ -1022,7 +1022,7 @@ impl<T: Config> Pallet<T> {
///
/// Returns a vector of cleaned-up core IDs.
pub(crate) fn free_timedout() -> Vec<CoreIndex> {
let timeout_pred = scheduler::Pallet::<T>::availability_timeout_predicate();
let timeout_pred = scheduler::Pezpallet::<T>::availability_timeout_predicate();
let timed_out: Vec<_> = Self::free_failed_cores(
|candidate| timeout_pred(candidate.backed_in_number).timed_out,
@@ -1193,7 +1193,7 @@ impl AcceptanceCheckErr {
}
}
impl<T: Config> OnQueueChanged<AggregateMessageOrigin> for Pallet<T> {
impl<T: Config> OnQueueChanged<AggregateMessageOrigin> for Pezpallet<T> {
// Write back the remaining queue capacity into `relay_dispatch_queue_remaining_capacity`.
fn on_queue_changed(origin: AggregateMessageOrigin, fp: QueueFootprint) {
let para = match origin {
@@ -1339,7 +1339,7 @@ impl<T: Config> CandidateCheckContext<T> {
.map_err(|_| AcceptanceCheckErr::NewCodeTooLarge)?;
ensure!(
paras::Pallet::<T>::can_upgrade_validation_code(para_id),
paras::Pezpallet::<T>::can_upgrade_validation_code(para_id),
AcceptanceCheckErr::PrematureCodeUpgrade,
);
ensure!(
@@ -1349,7 +1349,7 @@ impl<T: Config> CandidateCheckContext<T> {
}
// check if the candidate passes the messaging acceptance criteria
dmp::Pallet::<T>::check_processed_downward_messages(
dmp::Pezpallet::<T>::check_processed_downward_messages(
para_id,
relay_parent_number,
processed_downward_messages,
@@ -1364,7 +1364,7 @@ impl<T: Config> CandidateCheckContext<T> {
);
e
})?;
Pallet::<T>::check_upward_messages(&self.config, para_id, upward_messages).map_err(
Pezpallet::<T>::check_upward_messages(&self.config, para_id, upward_messages).map_err(
|e| {
log::debug!(
target: LOG_TARGET,
@@ -1375,7 +1375,7 @@ impl<T: Config> CandidateCheckContext<T> {
e
},
)?;
hrmp::Pallet::<T>::check_hrmp_watermark(para_id, relay_parent_number, hrmp_watermark)
hrmp::Pezpallet::<T>::check_hrmp_watermark(para_id, relay_parent_number, hrmp_watermark)
.map_err(|e| {
log::debug!(
target: LOG_TARGET,
@@ -1386,7 +1386,7 @@ impl<T: Config> CandidateCheckContext<T> {
);
e
})?;
hrmp::Pallet::<T>::check_outbound_hrmp(&self.config, para_id, horizontal_messages)
hrmp::Pezpallet::<T>::check_outbound_hrmp(&self.config, para_id, horizontal_messages)
.map_err(|e| {
log::debug!(
target: LOG_TARGET,
@@ -1401,7 +1401,7 @@ impl<T: Config> CandidateCheckContext<T> {
}
}
impl<T: Config> QueueFootprinter for Pallet<T> {
impl<T: Config> QueueFootprinter for Pezpallet<T> {
type Origin = UmpQueueId;
fn message_count(origin: Self::Origin) -> u64 {
@@ -349,7 +349,7 @@ impl TestCandidateBuilder {
}
pub(crate) fn make_vdata_hash(para_id: ParaId) -> Option<Hash> {
let relay_parent_number = pezframe_system::Pallet::<Test>::block_number() - 1;
let relay_parent_number = pezframe_system::Pezpallet::<Test>::block_number() - 1;
make_vdata_hash_with_block_number(para_id, relay_parent_number)
}
@@ -371,7 +371,7 @@ fn simple_sanitize_bitfields(
disputed_bitfield: DisputedBitfield,
expected_bits: usize,
) -> SignedAvailabilityBitfields {
let parent_hash = pezframe_system::Pallet::<Test>::parent_hash();
let parent_hash = pezframe_system::Pezpallet::<Test>::parent_hash();
let session_index = shared::CurrentSessionIndex::<Test>::get();
let validators = shared::ActiveValidatorKeys::<Test>::get();
@@ -702,8 +702,8 @@ fn bitfield_checks() {
let validator_public = validator_pubkeys(&validators);
new_test_ext(genesis_config(paras.clone())).execute_with(|| {
shared::Pallet::<Test>::set_active_validators_ascending(validator_public.clone());
shared::Pallet::<Test>::set_session_index(5);
shared::Pezpallet::<Test>::set_active_validators_ascending(validator_public.clone());
shared::Pezpallet::<Test>::set_session_index(5);
let signing_context =
SigningContext { parent_hash: System::parent_hash(), session_index: 5 };
@@ -890,8 +890,8 @@ fn supermajority_bitfields_trigger_availability() {
let validator_public = validator_pubkeys(&validators);
new_test_ext(genesis_config(paras)).execute_with(|| {
shared::Pallet::<Test>::set_active_validators_ascending(validator_public.clone());
shared::Pallet::<Test>::set_session_index(5);
shared::Pezpallet::<Test>::set_active_validators_ascending(validator_public.clone());
shared::Pezpallet::<Test>::set_session_index(5);
let signing_context =
SigningContext { parent_hash: System::parent_hash(), session_index: 5 };
@@ -1220,8 +1220,8 @@ fn candidate_checks() {
let validator_public = validator_pubkeys(&validators);
new_test_ext(genesis_config(paras)).execute_with(|| {
shared::Pallet::<Test>::set_active_validators_ascending(validator_public.clone());
shared::Pallet::<Test>::set_session_index(5);
shared::Pezpallet::<Test>::set_active_validators_ascending(validator_public.clone());
shared::Pezpallet::<Test>::set_session_index(5);
run_to_block(5, |_| None);
@@ -1785,8 +1785,8 @@ fn backing_works() {
let validator_public = validator_pubkeys(&validators);
new_test_ext(genesis_config(paras)).execute_with(|| {
shared::Pallet::<Test>::set_active_validators_ascending(validator_public.clone());
shared::Pallet::<Test>::set_session_index(5);
shared::Pezpallet::<Test>::set_active_validators_ascending(validator_public.clone());
shared::Pezpallet::<Test>::set_session_index(5);
run_to_block(5, |_| None);
@@ -2068,8 +2068,8 @@ fn backing_works_with_elastic_scaling_mvp() {
let validator_public = validator_pubkeys(&validators);
new_test_ext(genesis_config(paras)).execute_with(|| {
shared::Pallet::<Test>::set_active_validators_ascending(validator_public.clone());
shared::Pallet::<Test>::set_session_index(5);
shared::Pezpallet::<Test>::set_active_validators_ascending(validator_public.clone());
shared::Pezpallet::<Test>::set_session_index(5);
run_to_block(5, |_| None);
@@ -2329,8 +2329,8 @@ fn can_include_candidate_with_ok_code_upgrade() {
let validator_public = validator_pubkeys(&validators);
new_test_ext(genesis_config(paras)).execute_with(|| {
shared::Pallet::<Test>::set_active_validators_ascending(validator_public.clone());
shared::Pallet::<Test>::set_session_index(5);
shared::Pezpallet::<Test>::set_active_validators_ascending(validator_public.clone());
shared::Pezpallet::<Test>::set_session_index(5);
run_to_block(5, |_| None);
@@ -2447,8 +2447,8 @@ fn check_allowed_relay_parents() {
config.configuration.config.scheduler_params.group_rotation_frequency = 1;
new_test_ext(config).execute_with(|| {
shared::Pallet::<Test>::set_active_validators_ascending(validator_public.clone());
shared::Pallet::<Test>::set_session_index(5);
shared::Pezpallet::<Test>::set_active_validators_ascending(validator_public.clone());
shared::Pezpallet::<Test>::set_session_index(5);
run_to_block(5, |_| None);
@@ -2637,8 +2637,8 @@ fn session_change_wipes() {
let validator_public = validator_pubkeys(&validators);
new_test_ext(genesis_config(paras)).execute_with(|| {
shared::Pallet::<Test>::set_active_validators_ascending(validator_public.clone());
shared::Pallet::<Test>::set_session_index(5);
shared::Pezpallet::<Test>::set_active_validators_ascending(validator_public.clone());
shared::Pezpallet::<Test>::set_session_index(5);
let validators_new =
vec![Sr25519Keyring::Alice, Sr25519Keyring::Bob, Sr25519Keyring::Charlie];
@@ -2743,8 +2743,8 @@ fn para_upgrade_delay_scheduled_from_inclusion() {
let validator_public = validator_pubkeys(&validators);
new_test_ext(genesis_config(paras)).execute_with(|| {
shared::Pallet::<Test>::set_active_validators_ascending(validator_public.clone());
shared::Pallet::<Test>::set_session_index(5);
shared::Pezpallet::<Test>::set_active_validators_ascending(validator_public.clone());
shared::Pezpallet::<Test>::set_session_index(5);
let new_validation_code: ValidationCode = vec![9, 8, 7, 6, 5, 4, 3, 2, 1].into();
let new_validation_code_hash = new_validation_code.hash();
@@ -2841,7 +2841,7 @@ fn para_upgrade_delay_scheduled_from_inclusion() {
assert!(PendingAvailability::<Test>::get(&chain_a).unwrap().is_empty());
let active_vote_state = paras::Pallet::<Test>::active_vote_state(&new_validation_code_hash)
let active_vote_state = paras::Pezpallet::<Test>::active_vote_state(&new_validation_code_hash)
.expect("prechecking must be initiated");
let cause = &active_vote_state.causes()[0];