feat: Rebrand Polkadot/Substrate references to PezkuwiChain

This commit systematically rebrands various references from Parity Technologies'
Polkadot/Substrate ecosystem to PezkuwiChain within the kurdistan-sdk.

Key changes include:
- Updated external repository URLs (zombienet-sdk, parity-db, parity-scale-codec, wasm-instrument) to point to pezkuwichain forks.
- Modified internal documentation and code comments to reflect PezkuwiChain naming and structure.
- Replaced direct references to  with  or specific paths within the  for XCM, Pezkuwi, and other modules.
- Cleaned up deprecated  issue and PR references in various  and  files, particularly in  and  modules.
- Adjusted image and logo URLs in documentation to point to PezkuwiChain assets.
- Removed or rephrased comments related to external Polkadot/Substrate PRs and issues.

This is a significant step towards fully customizing the SDK for the PezkuwiChain ecosystem.
This commit is contained in:
2025-12-14 00:04:10 +03:00
parent 286de54384
commit 1c0e57d984
9084 changed files with 997839 additions and 997557 deletions
@@ -0,0 +1,196 @@
// This file is part of Bizinikiwi.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use core::str;
use pezsp_io::hashing::twox_128;
use pezframe_support::{
storage::{generator::StorageValue, StoragePrefixedMap},
traits::{
Get, GetStorageVersion, PalletInfoAccess, StorageVersion,
STORAGE_VERSION_STORAGE_KEY_POSTFIX,
},
weights::Weight,
};
use crate::historical as pezpallet_session_historical;
const LOG_TARGET: &str = "runtime::session_historical";
const OLD_PREFIX: &str = "Session";
/// Migrate the entire storage of this pallet to a new prefix.
///
/// This new prefix must be the same as the one set in construct_runtime.
///
/// The migration will look into the storage version in order not to trigger a migration on an up
/// to date storage. Thus the on chain storage version must be less than 1 in order to trigger the
/// migration.
pub fn migrate<T: pezpallet_session_historical::Config, P: GetStorageVersion + PalletInfoAccess>(
) -> Weight {
let new_pallet_name = <P as PalletInfoAccess>::name();
if new_pallet_name == OLD_PREFIX {
log::info!(
target: LOG_TARGET,
"New pallet name is equal to the old prefix. No migration needs to be done.",
);
return Weight::zero();
}
let on_chain_storage_version = <P as GetStorageVersion>::on_chain_storage_version();
log::info!(
target: LOG_TARGET,
"Running migration to v1 for session_historical with storage version {:?}",
on_chain_storage_version,
);
if on_chain_storage_version < 1 {
let storage_prefix = pezpallet_session_historical::HistoricalSessions::<T>::storage_prefix();
pezframe_support::storage::migration::move_storage_from_pallet(
storage_prefix,
OLD_PREFIX.as_bytes(),
new_pallet_name.as_bytes(),
);
log_migration("migration", storage_prefix, OLD_PREFIX, new_pallet_name);
let storage_prefix = pezpallet_session_historical::StoredRange::<T>::storage_prefix();
pezframe_support::storage::migration::move_storage_from_pallet(
storage_prefix,
OLD_PREFIX.as_bytes(),
new_pallet_name.as_bytes(),
);
log_migration("migration", storage_prefix, OLD_PREFIX, new_pallet_name);
StorageVersion::new(1).put::<P>();
<T as pezframe_system::Config>::BlockWeights::get().max_block
} else {
log::warn!(
target: LOG_TARGET,
"Attempted to apply migration to v1 but failed because storage version is {:?}",
on_chain_storage_version,
);
Weight::zero()
}
}
/// Some checks prior to migration. This can be linked to
/// `pezframe_support::traits::OnRuntimeUpgrade::pre_upgrade` for further testing.
///
/// Panics if anything goes wrong.
pub fn pre_migrate<
T: pezpallet_session_historical::Config,
P: GetStorageVersion + PalletInfoAccess,
>() {
let new_pallet_name = <P as PalletInfoAccess>::name();
let storage_prefix_historical_sessions =
pezpallet_session_historical::HistoricalSessions::<T>::storage_prefix();
let storage_prefix_stored_range = pezpallet_session_historical::StoredRange::<T>::storage_prefix();
log_migration("pre-migration", storage_prefix_historical_sessions, OLD_PREFIX, new_pallet_name);
log_migration("pre-migration", storage_prefix_stored_range, OLD_PREFIX, new_pallet_name);
if new_pallet_name == OLD_PREFIX {
return;
}
let new_pallet_prefix = twox_128(new_pallet_name.as_bytes());
let storage_version_key = twox_128(STORAGE_VERSION_STORAGE_KEY_POSTFIX);
let mut new_pallet_prefix_iter = pezframe_support::storage::KeyPrefixIterator::new(
new_pallet_prefix.to_vec(),
new_pallet_prefix.to_vec(),
|key| Ok(key.to_vec()),
);
// Ensure nothing except the storage_version_key is stored in the new prefix.
assert!(new_pallet_prefix_iter.all(|key| key == storage_version_key));
assert!(<P as GetStorageVersion>::on_chain_storage_version() < 1);
}
/// Some checks for after migration. This can be linked to
/// `pezframe_support::traits::OnRuntimeUpgrade::post_upgrade` for further testing.
///
/// Panics if anything goes wrong.
pub fn post_migrate<
T: pezpallet_session_historical::Config,
P: GetStorageVersion + PalletInfoAccess,
>() {
let new_pallet_name = <P as PalletInfoAccess>::name();
let storage_prefix_historical_sessions =
pezpallet_session_historical::HistoricalSessions::<T>::storage_prefix();
let storage_prefix_stored_range = pezpallet_session_historical::StoredRange::<T>::storage_prefix();
log_migration(
"post-migration",
storage_prefix_historical_sessions,
OLD_PREFIX,
new_pallet_name,
);
log_migration("post-migration", storage_prefix_stored_range, OLD_PREFIX, new_pallet_name);
if new_pallet_name == OLD_PREFIX {
return;
}
// Assert that no `HistoricalSessions` and `StoredRange` storages remains at the old prefix.
let old_pallet_prefix = twox_128(OLD_PREFIX.as_bytes());
let old_historical_sessions_key =
[&old_pallet_prefix, &twox_128(storage_prefix_historical_sessions)[..]].concat();
let old_historical_sessions_key_iter = pezframe_support::storage::KeyPrefixIterator::new(
old_historical_sessions_key.to_vec(),
old_historical_sessions_key.to_vec(),
|_| Ok(()),
);
assert_eq!(old_historical_sessions_key_iter.count(), 0);
let old_stored_range_key =
[&old_pallet_prefix, &twox_128(storage_prefix_stored_range)[..]].concat();
let old_stored_range_key_iter = pezframe_support::storage::KeyPrefixIterator::new(
old_stored_range_key.to_vec(),
old_stored_range_key.to_vec(),
|_| Ok(()),
);
assert_eq!(old_stored_range_key_iter.count(), 0);
// Assert that the `HistoricalSessions` and `StoredRange` storages (if they exist) have been
// moved to the new prefix.
// NOTE: storage_version_key is already in the new prefix.
let new_pallet_prefix = twox_128(new_pallet_name.as_bytes());
let new_pallet_prefix_iter = pezframe_support::storage::KeyPrefixIterator::new(
new_pallet_prefix.to_vec(),
new_pallet_prefix.to_vec(),
|_| Ok(()),
);
assert!(new_pallet_prefix_iter.count() >= 1);
assert_eq!(<P as GetStorageVersion>::on_chain_storage_version(), 1);
}
fn log_migration(stage: &str, storage_prefix: &[u8], old_pallet_name: &str, new_pallet_name: &str) {
log::info!(
target: LOG_TARGET,
"{} prefix of storage '{}': '{}' ==> '{}'",
stage,
str::from_utf8(storage_prefix).unwrap_or("<Invalid UTF8>"),
old_pallet_name,
new_pallet_name,
);
}
@@ -0,0 +1,25 @@
// This file is part of Bizinikiwi.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/// Version 1.
///
/// In version 0 session historical pallet uses `Session` for storage module prefix.
/// In version 1 it uses its name as configured in `construct_runtime`.
/// This migration moves session historical pallet storages from old prefix to new prefix.
#[cfg(feature = "historical")]
pub mod historical;
pub mod v1;
@@ -0,0 +1,103 @@
// This file is part of Bizinikiwi.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::{Config, DisabledValidators as NewDisabledValidators, Pallet, Vec};
use pezframe_support::{
pezpallet_prelude::{Get, ValueQuery, Weight},
traits::UncheckedOnRuntimeUpgrade,
};
use pezsp_staking::offence::OffenceSeverity;
#[cfg(feature = "try-runtime")]
use pezsp_runtime::TryRuntimeError;
#[cfg(feature = "try-runtime")]
use pezframe_support::ensure;
use pezframe_support::migrations::VersionedMigration;
/// This is the storage getting migrated.
#[pezframe_support::storage_alias]
type DisabledValidators<T: Config> = StorageValue<Pallet<T>, Vec<u32>, ValueQuery>;
pub trait MigrateDisabledValidators {
/// Peek the list of disabled validators and their offence severity.
#[cfg(feature = "try-runtime")]
fn peek_disabled() -> Vec<(u32, OffenceSeverity)>;
/// Return the list of disabled validators and their offence severity, removing them from the
/// underlying storage.
fn take_disabled() -> Vec<(u32, OffenceSeverity)>;
}
pub struct InitOffenceSeverity<T>(core::marker::PhantomData<T>);
impl<T: Config> MigrateDisabledValidators for InitOffenceSeverity<T> {
#[cfg(feature = "try-runtime")]
fn peek_disabled() -> Vec<(u32, OffenceSeverity)> {
DisabledValidators::<T>::get()
.iter()
.map(|v| (*v, OffenceSeverity::max_severity()))
.collect::<Vec<_>>()
}
fn take_disabled() -> Vec<(u32, OffenceSeverity)> {
DisabledValidators::<T>::take()
.iter()
.map(|v| (*v, OffenceSeverity::max_severity()))
.collect::<Vec<_>>()
}
}
pub struct VersionUncheckedMigrateV0ToV1<T, S: MigrateDisabledValidators>(
core::marker::PhantomData<(T, S)>,
);
impl<T: Config, S: MigrateDisabledValidators> UncheckedOnRuntimeUpgrade
for VersionUncheckedMigrateV0ToV1<T, S>
{
fn on_runtime_upgrade() -> Weight {
let disabled = S::take_disabled();
NewDisabledValidators::<T>::put(disabled);
T::DbWeight::get().reads_writes(1, 1)
}
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<Vec<u8>, TryRuntimeError> {
let source_disabled = S::peek_disabled().iter().map(|(v, _s)| *v).collect::<Vec<_>>();
let existing_disabled = DisabledValidators::<T>::get();
ensure!(source_disabled == existing_disabled, "Disabled validators mismatch");
Ok(Vec::new())
}
#[cfg(feature = "try-runtime")]
fn post_upgrade(_state: Vec<u8>) -> Result<(), TryRuntimeError> {
let validators_max_index = crate::Validators::<T>::get().len() as u32 - 1;
for (v, _s) in NewDisabledValidators::<T>::get() {
ensure!(v <= validators_max_index, "Disabled validator index out of bounds");
}
Ok(())
}
}
pub type MigrateV0ToV1<T, S> = VersionedMigration<
0,
1,
VersionUncheckedMigrateV0ToV1<T, S>,
Pallet<T>,
<T as pezframe_system::Config>::DbWeight,
>;