From 6b1e07dadfc864a835c27059d1637015392dcaa0 Mon Sep 17 00:00:00 2001 From: Kurdistan Tech Ministry Date: Sat, 7 Feb 2026 01:25:05 +0300 Subject: [PATCH] fix: use frontend fallback for trust score calculation On-chain trust pallet exists but StakingInfoProvider returns None, causing trust score to be 0 even when user has stake. Use frontend calculation until runtime upgrade is deployed. --- shared/lib/scores.ts | 38 +++++--------------------------------- 1 file changed, 5 insertions(+), 33 deletions(-) diff --git a/shared/lib/scores.ts b/shared/lib/scores.ts index 9e57faf7..45b194ea 100644 --- a/shared/lib/scores.ts +++ b/shared/lib/scores.ts @@ -817,45 +817,17 @@ export async function getFrontendTrustScore( /** * Get trust score with frontend fallback - * First tries on-chain, falls back to frontend calculation + * NOTE: Until runtime upgrade, always use frontend fallback + * On-chain trust pallet exists but doesn't calculate correctly yet */ export async function getTrustScoreWithFallback( peopleApi: ApiPromise | null, relayApi: ApiPromise, address: string ): Promise { - // First try on-chain trust score - if (peopleApi) { - try { - const onChainScore = await getTrustScore(peopleApi, address); - if (onChainScore > 0) { - // Get component scores for display - const [stakingResult, referralScore, perwerdeScore, tikiScore] = await Promise.all([ - getFrontendStakingScore(relayApi, address), - getReferralScore(peopleApi, address), - getPerwerdeScore(peopleApi, address), - getTikiScore(peopleApi, address) - ]); - - const isCitizen = await checkCitizenshipStatus(peopleApi, address); - - return { - trustScore: onChainScore, - stakingScore: stakingResult.score, - referralScore, - perwerdeScore, - tikiScore, - weightedSum: 0, // Not calculated for on-chain - isFromFrontend: false, - isCitizen - }; - } - } catch (err) { - console.log('On-chain trust score not available, using frontend fallback'); - } - } - - // Fall back to frontend calculation + // Always use frontend calculation until runtime upgrade + // The on-chain trust pallet exists but StakingInfoProvider returns None + // which causes trust score to be 0 even when user has stake return getFrontendTrustScore(peopleApi, relayApi, address); }