feat: add staking score pallet to relay chain and fix referral default

Relay Chain:
- Add pezpallet-staking-score to runtime
- Implement RelayStakingInfoProvider to read from pallet_staking
- StakingScore pallet index = 92

People Chain:
- Add DefaultReferrer type to identity-kyc pallet Config
- Change DefaultReferrer from Alice to founder address
- Make referrer parameter optional in apply_for_citizenship
- Fallback to DefaultReferrer when no valid referrer provided
This commit is contained in:
2026-02-07 00:43:28 +03:00
parent 6a02481f00
commit 1d64a1317a
4 changed files with 79 additions and 15 deletions
+4
View File
@@ -112,6 +112,7 @@ pezkuwi-teyrchain-primitives = { workspace = true }
# Custom Pezkuwi Pallets
pezpallet-validator-pool = { workspace = true }
pezpallet-staking-score = { workspace = true }
xcm = { workspace = true }
xcm-builder = { workspace = true }
@@ -192,6 +193,7 @@ std = [
"pezpallet-treasury/std",
"pezpallet-utility/std",
"pezpallet-validator-pool/std",
"pezpallet-staking-score/std",
"pezpallet-vesting/std",
"pezpallet-whitelist/std",
"pezpallet-xcm-benchmarks?/std",
@@ -284,6 +286,7 @@ runtime-benchmarks = [
"pezpallet-treasury/runtime-benchmarks",
"pezpallet-utility/runtime-benchmarks",
"pezpallet-validator-pool/runtime-benchmarks",
"pezpallet-staking-score/runtime-benchmarks",
"pezpallet-vesting/runtime-benchmarks",
"pezpallet-whitelist/runtime-benchmarks",
"pezpallet-xcm-benchmarks/runtime-benchmarks",
@@ -366,6 +369,7 @@ try-runtime = [
"pezpallet-treasury/try-runtime",
"pezpallet-utility/try-runtime",
"pezpallet-validator-pool/try-runtime",
"pezpallet-staking-score/try-runtime",
"pezpallet-vesting/try-runtime",
"pezpallet-whitelist/try-runtime",
"pezpallet-xcm-benchmarks?/try-runtime",
+40
View File
@@ -565,6 +565,42 @@ impl pezpallet_staking::Config for Runtime {
type BenchmarkingConfig = PezkuwiStakingBenchmarkingConfig;
}
// =====================================================
// STAKING SCORE CONFIGURATION
// =====================================================
/// Relay Chain StakingInfoProvider - reads directly from pezpallet_staking
/// This is the REAL implementation that accesses actual staking data
pub struct RelayStakingInfoProvider;
impl pezpallet_staking_score::StakingInfoProvider<AccountId, Balance>
for RelayStakingInfoProvider
{
fn get_staking_details(
who: &AccountId,
) -> Option<pezpallet_staking_score::StakingDetails<Balance>> {
// Get staking ledger from pezpallet_staking
let ledger = pezpallet_staking::Ledger::<Runtime>::get(who)?;
// Get nominations if any
let nominations_count = pezpallet_staking::Nominators::<Runtime>::get(who)
.map(|n| n.targets.len() as u32)
.unwrap_or(0);
Some(pezpallet_staking_score::StakingDetails {
staked_amount: ledger.active,
nominations_count,
unlocking_chunks_count: ledger.unlocking.len() as u32,
})
}
}
impl pezpallet_staking_score::Config for Runtime {
type Balance = Balance;
type StakingInfo = RelayStakingInfoProvider;
type WeightInfo = pezpallet_staking_score::weights::BizinikiwiWeight<Runtime>;
}
// =====================================================
// FAST UNSTAKE CONFIGURATION
// =====================================================
@@ -1570,6 +1606,9 @@ construct_runtime! {
// TNPoS Validator Pool - Shadow Mode (runs parallel to NPoS)
ValidatorPool: pezpallet_validator_pool = 91,
// Staking Score - Time-weighted staking reputation score
StakingScore: pezpallet_staking_score = 92,
// Root testing pezpallet.
RootTesting: pezpallet_root_testing = 249,
@@ -1821,6 +1860,7 @@ mod benches {
[pezpallet_whitelist, Whitelist]
// Pezkuwichain Custom Pallets
[pezpallet_validator_pool, ValidatorPool]
[pezpallet_staking_score, StakingScore]
// XCM
[pezpallet_xcm, PalletXcmExtrinsicsBenchmark::<Runtime>]
[pezpallet_xcm_benchmarks::fungible, pezpallet_xcm_benchmarks::fungible::Pezpallet::<Runtime>]