feat: wire trust score system with cross-chain staking data and component triggers

- Add CachedStakingDetails storage and receive_staking_details extrinsic
  to staking-score pallet for Asset Hub XCM data reception
- Add TrustScoreUpdater triggers to referral, tiki, and perwerde pallets
  so component score changes propagate to trust pallet
- Wire runtime hooks (OnKycApproved, OnCitizenshipRevoked) to Referral
  and CitizenNftProvider to Tiki in people.rs
- Fix PerwerdeScoreSource and ReferralScoreSource to read actual pallet data
- Fix EnsureOrigin trait feature unification issue by removing cfg gate
  from try_successful_origin and adding default Err(()) implementation
- Fix workspace Cargo.toml default-features for pezkuwi-subxt dependencies
This commit is contained in:
2026-02-13 20:13:50 +03:00
parent 7cc2f831b4
commit bd454cf395
11 changed files with 170 additions and 43 deletions
@@ -86,6 +86,17 @@
pub use pezpallet::*;
/// Trait for notifying trust score system when perwerde score changes.
/// Defined locally to avoid cyclic dependency with pezpallet-trust.
pub trait TrustScoreUpdater<AccountId> {
fn on_score_component_changed(who: &AccountId);
}
/// Noop implementation for mock environments.
impl<AccountId> TrustScoreUpdater<AccountId> for () {
fn on_score_component_changed(_who: &AccountId) {}
}
#[cfg(feature = "runtime-benchmarks")]
mod benchmarking;
pub mod weights;
@@ -130,6 +141,9 @@ pub mod pezpallet {
/// Used for StudentCourses storage bound
#[pezpallet::constant]
type MaxCoursesPerStudent: Get<u32>;
/// Trust score updater - notifies trust pallet when perwerde score changes
type TrustScoreUpdater: TrustScoreUpdater<Self::AccountId>;
}
#[derive(Encode, Decode, Clone, Eq, PartialEq, RuntimeDebug, TypeInfo, MaxEncodedLen)]
@@ -292,7 +306,15 @@ pub mod pezpallet {
Enrollments::<T>::insert((&student, course_id), enrollment);
Self::deposit_event(Event::CourseCompleted { student, course_id, points });
Self::deposit_event(Event::CourseCompleted {
student: student.clone(),
course_id,
points,
});
// Notify trust pallet that student's perwerde score component changed
T::TrustScoreUpdater::on_score_component_changed(&student);
Ok(())
}
@@ -111,6 +111,7 @@ impl pezpallet_perwerde::Config for Test {
type MaxCourseLinkLength = MaxCourseLinkLength;
type MaxStudentsPerCourse = MaxStudentsPerCourse;
type MaxCoursesPerStudent = MaxCoursesPerStudent;
type TrustScoreUpdater = ();
}
// Council Paletinin Mock Kurulumu (construct_runtime'da gerekli olduğu için kalıyor)