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,160 @@
// 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.
//! Utilities for remote-testing pezpallet-bags-list.
use pezframe_election_provider_support::ScoreProvider;
use pezpallet_bags_list::Instance1;
/// A common log target to use.
pub const LOG_TARGET: &str = "runtime::bags-list::remote-tests";
pub mod migration;
pub mod snapshot;
pub mod try_state;
/// A wrapper for a runtime that the functions of this crate expect.
///
/// For example, this can be the `Runtime` type of the Pezkuwi runtime.
pub trait RuntimeT<I: 'static>:
pezpallet_staking::Config + pezpallet_bags_list::Config<I> + pezframe_system::Config
{
}
impl<
I: 'static,
T: pezpallet_staking::Config + pezpallet_bags_list::Config<I> + pezframe_system::Config,
> RuntimeT<I> for T
{
}
fn percent(portion: u32, total: u32) -> f64 {
(portion as f64 / total as f64) * 100f64
}
/// Display the number of nodes in each bag, while identifying those that need a rebag.
pub fn display_and_check_bags<Runtime: RuntimeT<Instance1>>(
currency_unit: u64,
currency_name: &'static str,
) {
use pezframe_election_provider_support::SortedListProvider;
use pezframe_support::traits::Get;
let min_nominator_bond = <pezpallet_staking::MinNominatorBond<Runtime>>::get();
log::info!(target: LOG_TARGET, "min nominator bond is {:?}", min_nominator_bond);
let voter_list_count = <Runtime as pezpallet_staking::Config>::VoterList::count();
// go through every bag to track the total number of voters within bags and log some info about
// how voters are distributed within the bags.
let mut seen_in_bags = 0;
let mut rebaggable = 0;
let mut active_bags = 0;
for vote_weight_thresh in <Runtime as pezpallet_bags_list::Config<Instance1>>::BagThresholds::get()
{
let vote_weight_thresh_u64: u64 = (*vote_weight_thresh)
.try_into()
.map_err(|_| "runtime must configure score to at most u64 to use this test")
.unwrap();
// threshold in terms of UNITS (e.g. KSM, HEZ etc)
let vote_weight_thresh_as_unit = vote_weight_thresh_u64 as f64 / currency_unit as f64;
let pretty_thresh = format!("Threshold: {}. {}", vote_weight_thresh_as_unit, currency_name);
let bag = match pezpallet_bags_list::Pallet::<Runtime, Instance1>::list_bags_get(
*vote_weight_thresh,
) {
Some(bag) => bag,
None => {
log::info!(target: LOG_TARGET, "{} NO VOTERS.", pretty_thresh);
continue;
},
};
active_bags += 1;
for id in bag.std_iter().map(|node| node.std_id().clone()) {
let vote_weight =
<Runtime as pezpallet_bags_list::Config<Instance1>>::ScoreProvider::score(&id)
.unwrap();
let vote_weight_thresh_u64: u64 = (*vote_weight_thresh)
.try_into()
.map_err(|_| "runtime must configure score to at most u64 to use this test")
.unwrap();
let vote_weight_as_balance: pezpallet_staking::BalanceOf<Runtime> =
vote_weight_thresh_u64.try_into().map_err(|_| "can't convert").unwrap();
if vote_weight_as_balance < min_nominator_bond {
log::trace!(
target: LOG_TARGET,
"⚠️ {} Account found below min bond: {:?}.",
pretty_thresh,
id
);
}
let node = pezpallet_bags_list::Node::<Runtime, Instance1>::get(&id)
.expect("node in bag must exist.");
if node.is_misplaced(vote_weight) {
rebaggable += 1;
let notional_bag = pezpallet_bags_list::notional_bag_for::<Runtime, _>(vote_weight);
let notional_bag_as_u64: u64 = notional_bag
.try_into()
.map_err(|_| "runtime must configure score to at most u64 to use this test")
.unwrap();
log::trace!(
target: LOG_TARGET,
"Account {:?} can be rebagged from {:?} to {:?}",
id,
vote_weight_thresh_as_unit,
notional_bag_as_u64 as f64 / currency_unit as f64
);
}
}
// update our overall counter
let voters_in_bag = bag.std_iter().count() as u32;
seen_in_bags += voters_in_bag;
// percentage of all nominators
let percent_of_voters = percent(voters_in_bag, voter_list_count);
log::info!(
target: LOG_TARGET,
"{} Nominators: {} [%{:.3}]",
pretty_thresh,
voters_in_bag,
percent_of_voters,
);
}
if seen_in_bags != voter_list_count {
log::error!(
target: LOG_TARGET,
"bags list population ({}) not on par whoever is voter_list ({})",
seen_in_bags,
voter_list_count,
)
}
log::info!(
target: LOG_TARGET,
"a total of {} nodes are in {} active bags [{} total bags], {} of which can be rebagged.",
voter_list_count,
active_bags,
<Runtime as pezpallet_bags_list::Config<Instance1>>::BagThresholds::get().len(),
rebaggable,
);
}
@@ -0,0 +1,67 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Bizinikiwi.
// 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.
//! Test to check the migration of the voter bag.
use crate::{RuntimeT, LOG_TARGET};
use pezframe_support::traits::PalletInfoAccess;
use pezpallet_staking::Nominators;
use remote_externalities::{Builder, Mode, OnlineConfig};
use pezsp_runtime::{traits::Block as BlockT, DeserializeOwned};
/// Test voter bags migration. `currency_unit` is the number of planks per the the runtimes `UNITS`
/// (i.e. number of decimal places per HEZ, KSM etc)
pub async fn execute<Runtime, Block>(
currency_unit: u64,
currency_name: &'static str,
ws_url: String,
) where
Runtime: RuntimeT<pezpallet_bags_list::Instance1>,
Block: BlockT + DeserializeOwned,
Block::Header: DeserializeOwned,
{
let mut ext = Builder::<Block>::new()
.mode(Mode::Online(OnlineConfig {
transport: ws_url.to_string().into(),
pallets: vec![pezpallet_staking::Pallet::<Runtime>::name().to_string()],
..Default::default()
}))
.build()
.await
.unwrap();
ext.execute_with(|| {
// get the nominator & validator count prior to migrating; these should be invariant.
let pre_migrate_nominator_count = <Nominators<Runtime>>::iter().count() as u32;
log::info!(target: LOG_TARGET, "Nominator count: {}", pre_migrate_nominator_count);
use pezframe_election_provider_support::SortedListProvider;
// run the actual migration
let moved = <Runtime as pezpallet_staking::Config>::VoterList::unsafe_regenerate(
pezpallet_staking::Nominators::<Runtime>::iter().map(|(n, _)| n),
Box::new(|x| Some(pezpallet_staking::Pallet::<Runtime>::weight_of(x))),
);
log::info!(target: LOG_TARGET, "Moved {} nominators", moved);
let voter_list_len = <Runtime as pezpallet_staking::Config>::VoterList::iter().count() as u32;
let voter_list_count = <Runtime as pezpallet_staking::Config>::VoterList::count();
// and confirm it is equal to the length of the `VoterList`.
assert_eq!(pre_migrate_nominator_count, voter_list_len);
assert_eq!(pre_migrate_nominator_count, voter_list_count);
crate::display_and_check_bags::<Runtime>(currency_unit, currency_name);
});
}
@@ -0,0 +1,104 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Bizinikiwi.
// 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.
//! Test to execute the snapshot using the voter bag.
use pezframe_election_provider_support::{
bounds::{CountBound, DataProviderBounds},
SortedListProvider,
};
use pezframe_support::traits::PalletInfoAccess;
use remote_externalities::{Builder, Mode, OnlineConfig};
use pezsp_runtime::{
traits::{Block as BlockT, Zero},
DeserializeOwned,
};
/// Execute create a snapshot from pezpallet-staking.
pub async fn execute<Runtime, Block>(voter_limit: Option<usize>, currency_unit: u64, ws_url: String)
where
Runtime: crate::RuntimeT<pezpallet_bags_list::Instance1>,
Block: BlockT + DeserializeOwned,
Block::Header: DeserializeOwned,
{
use pezframe_support::storage::generator::StorageMap;
let mut ext = Builder::<Block>::new()
.mode(Mode::Online(OnlineConfig {
transport: ws_url.to_string().into(),
// NOTE: we don't scrape pezpallet-staking, this kinda ensures that the source of the data
// is bags-list.
pallets: vec![pezpallet_bags_list::Pallet::<Runtime, pezpallet_bags_list::Instance1>::name()
.to_string()],
at: None,
hashed_prefixes: vec![
<pezpallet_staking::Bonded<Runtime>>::prefix_hash().to_vec(),
<pezpallet_staking::Ledger<Runtime>>::prefix_hash().to_vec(),
<pezpallet_staking::Validators<Runtime>>::map_storage_final_prefix(),
<pezpallet_staking::Nominators<Runtime>>::map_storage_final_prefix(),
],
hashed_keys: vec![
<pezpallet_staking::Validators<Runtime>>::counter_storage_final_key().to_vec(),
<pezpallet_staking::Nominators<Runtime>>::counter_storage_final_key().to_vec(),
],
..Default::default()
}))
.build()
.await
.unwrap();
ext.execute_with(|| {
use pezframe_election_provider_support::ElectionDataProvider;
log::info!(
target: crate::LOG_TARGET,
"{} nodes in bags list.",
<Runtime as pezpallet_staking::Config>::VoterList::count(),
);
let bounds = match voter_limit {
None => DataProviderBounds::default(),
Some(v) => DataProviderBounds { count: Some(CountBound(v as u32)), size: None },
};
// single page voter snapshot, thus page index == 0.
let voters =
<pezpallet_staking::Pallet<Runtime> as ElectionDataProvider>::electing_voters(bounds, Zero::zero())
.unwrap();
let mut voters_nominator_only = voters
.iter()
.filter(|(v, _, _)| pezpallet_staking::Nominators::<Runtime>::contains_key(v))
.cloned()
.collect::<Vec<_>>();
voters_nominator_only.sort_by_key(|(_, w, _)| *w);
let currency_unit = currency_unit as f64;
let min_voter = voters_nominator_only
.first()
.map(|(x, y, _)| (x.clone(), *y as f64 / currency_unit));
let max_voter = voters_nominator_only
.last()
.map(|(x, y, _)| (x.clone(), *y as f64 / currency_unit));
log::info!(
target: crate::LOG_TARGET,
"a snapshot with limit {:?} has been created, {} voters are taken. min nominator: {:?}, max: {:?}",
voter_limit,
voters.len(),
min_voter,
max_voter
);
});
}
@@ -0,0 +1,60 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Bizinikiwi.
// 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.
//! Test to execute the sanity-check of the voter bag.
use pezframe_support::{
storage::generator::StorageMap,
traits::{Get, PalletInfoAccess},
};
use remote_externalities::{Builder, Mode, OnlineConfig};
use pezsp_runtime::{traits::Block as BlockT, DeserializeOwned};
/// Execute the sanity check of the bags-list.
pub async fn execute<Runtime, Block>(
currency_unit: u64,
currency_name: &'static str,
ws_url: String,
) where
Runtime: crate::RuntimeT<pezpallet_bags_list::Instance1>,
Block: BlockT + DeserializeOwned,
Block::Header: DeserializeOwned,
{
let mut ext = Builder::<Block>::new()
.mode(Mode::Online(OnlineConfig {
transport: ws_url.to_string().into(),
pallets: vec![pezpallet_bags_list::Pallet::<Runtime, pezpallet_bags_list::Instance1>::name()
.to_string()],
hashed_prefixes: vec![
<pezpallet_staking::Bonded<Runtime>>::prefix_hash().to_vec(),
<pezpallet_staking::Ledger<Runtime>>::prefix_hash().to_vec(),
],
..Default::default()
}))
.build()
.await
.unwrap();
ext.execute_with(|| {
pezsp_core::crypto::set_default_ss58_version(Runtime::SS58Prefix::get().try_into().unwrap());
pezpallet_bags_list::Pallet::<Runtime, pezpallet_bags_list::Instance1>::do_try_state().unwrap();
log::info!(target: crate::LOG_TARGET, "executed bags-list sanity check with no errors.");
crate::display_and_check_bags::<Runtime>(currency_unit, currency_name);
});
}