Description
In frontend/src/app/publisher/page.tsx (lines 299-319), the reputation tier boundaries have ambiguous edge cases:
const tiers = [
{ tier: 'Bronze', min: 0, max: 399, color: 'amber' },
{ tier: 'Silver', min: 400, max: 599, color: 'gray' },
{ tier: 'Gold', min: 600, max: 799, color: 'yellow' },
{ tier: 'Platinum', min: 800, max: 1000, color: 'blue' },
];
With the check: reputationScore >= min && reputationScore <= max
Problem
While the boundaries themselves are technically correct (no gaps or overlaps), there are issues:
- Scores above 1000 aren't handled — if the contract returns a score > 1000, no tier matches
- Negative scores aren't handled — if the contract returns a negative value, no tier matches
- The
max: 1000 implies a hard cap, but the smart contract may not enforce this limit
- When no tier matches, the UI shows nothing — no fallback or error state
Impact
- Publishers with scores outside 0-1000 see no tier information
- Edge case: score of exactly 1000 is Platinum, but 1001 is nothing
- No visual indication that something went wrong
Suggested Fix
const tiers = [
{ tier: 'Bronze', min: 0, max: 399, color: 'amber' },
{ tier: 'Silver', min: 400, max: 599, color: 'gray' },
{ tier: 'Gold', min: 600, max: 799, color: 'yellow' },
{ tier: 'Platinum', min: 800, max: Infinity, color: 'blue' }, // No upper cap
];
const currentTier = tiers.find(t => score >= t.min && score <= t.max)
?? tiers[0]; // Fallback to Bronze
File
frontend/src/app/publisher/page.tsx — Lines 299-319
Description
In
frontend/src/app/publisher/page.tsx(lines 299-319), the reputation tier boundaries have ambiguous edge cases:With the check:
reputationScore >= min && reputationScore <= maxProblem
While the boundaries themselves are technically correct (no gaps or overlaps), there are issues:
max: 1000implies a hard cap, but the smart contract may not enforce this limitImpact
Suggested Fix
File
frontend/src/app/publisher/page.tsx— Lines 299-319