Skip to content

fix(rewards): crown logic in perps leaderboard#29887

Merged
VGR-GIT merged 1 commit into
mainfrom
Fix-perps-leaderboard-crown-logic
May 8, 2026
Merged

fix(rewards): crown logic in perps leaderboard#29887
VGR-GIT merged 1 commit into
mainfrom
Fix-perps-leaderboard-crown-logic

Conversation

@sophieqgu

@sophieqgu sophieqgu commented May 7, 2026

Copy link
Copy Markdown
Contributor

Description

Fix wrong number of crowns shown in Perps leaderboard

Changelog

CHANGELOG entry: null

Related issues

Fixes:

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

After

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Low Risk
Low risk UI logic change that only affects when the crown icon renders; covered by updated/added unit tests for winner thresholds and preview mode.

Overview
Fixes crown rendering so leaderboards only show crowns for actual winner ranks.

CampaignLeaderboardEntryRow now renders a crown strictly based on the showCrown prop (no internal rank check), and OndoLeaderboard/PerpsTradingCampaignLeaderboard now compute showCrown using new constants (ONDO_GM_TIER_MAX_WINNERS = 5, PERPS_TRADING_MAX_WINNERS = 20) while still disabling crowns in preview mode.

Adds/updates tests to assert correct crown behavior for winner thresholds and preview vs full views across the shared row, Ondo, and Perps leaderboards.

Reviewed by Cursor Bugbot for commit 900c4bd. Bugbot is set up for automated code reviews on this repo. Configure here.

@sophieqgu sophieqgu requested a review from a team as a code owner May 7, 2026 20:57
@github-actions

github-actions Bot commented May 7, 2026

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbotv2 metamaskbotv2 Bot added the team-rewards Rewards team label May 7, 2026
@github-actions github-actions Bot added the size-M label May 7, 2026
@github-actions

github-actions Bot commented May 7, 2026

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokePerps, SmokeWalletPlatform
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 72%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changed files are all within the Rewards/Campaigns UI subsystem, specifically:

  1. CampaignLeaderboard.tsx - New shared base component providing generic leaderboard row rendering (CampaignLeaderboardEntryRow, CampaignLeaderboardSkeleton, CampaignLeaderboardNeighborSeparator) used by both Ondo and Perps leaderboards.

  2. OndoLeaderboard.tsx - Ondo campaign-specific leaderboard that imports from the new shared CampaignLeaderboard component and uses ONDO_GM_TIER_MAX_WINNERS constant.

  3. PerpsTradingCampaignLeaderboard.tsx - Perps trading campaign leaderboard that uses the shared CampaignLeaderboard components and PERPS_TRADING_MAX_WINNERS/HYPERTRACKER_ATTRIBUTION_URL constants. Also navigates to Routes.BROWSER.HOME for HyperTracker attribution.

  4. ondoCampaignConstants.ts - Constants and eligibility logic for Ondo GM campaigns.

  5. perpsCampaignConstants.ts - Constants for Perps trading campaigns including qualification threshold and HyperTracker URL.

  6. Test files - Unit tests for the above components.

Tag Selection Rationale:

  • SmokePerps: Directly relevant - PerpsTradingCampaignLeaderboard is a core component of the Perps trading campaign flow. The leaderboard is embedded in PerpsTradingCampaignDetailsView, PerpsTradingCampaignStatsView, and PerpsTradingCampaignLeaderboardView. Changes to constants (PERPS_TRADING_MAX_WINNERS, PERPS_QUALIFICATION_NOTIONAL_USD) could affect display logic.
  • SmokeWalletPlatform: Required per SmokePerps tag description - "Perps is also a section inside the Trending tab (SmokeWalletPlatform); changes to Perps views affect Trending. When selecting SmokePerps, also select SmokeWalletPlatform."

Not Selected:

  • SmokeConfirmations: Not selected because these are leaderboard display components, not transaction confirmation flows. The Add Funds flow (which triggers confirmations) is not modified here.
  • No E2E tests directly cover the Rewards leaderboard components (confirmed by grep), so the risk of breaking existing E2E tests is low.
  • The changes are self-contained within the Rewards feature and don't touch shared navigation, Engine, controllers, or other critical paths.

Performance Test Selection:
The changes are UI component additions/refactors for campaign leaderboard displays within the Rewards feature. These are standard list rendering components with no significant performance implications - they render a fixed number of rows (max 20) with simple text and skeleton states. No performance-sensitive paths like account lists, app startup, login flows, or heavy data loading are affected.

View GitHub Actions results

@sonarqubecloud

sonarqubecloud Bot commented May 7, 2026

Copy link
Copy Markdown

@VGR-GIT VGR-GIT enabled auto-merge May 8, 2026 07:27
@VGR-GIT VGR-GIT added this pull request to the merge queue May 8, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 8, 2026
@VGR-GIT VGR-GIT added this pull request to the merge queue May 8, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 8, 2026
@VGR-GIT VGR-GIT added this pull request to the merge queue May 8, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 8, 2026
@VGR-GIT VGR-GIT added this pull request to the merge queue May 8, 2026
Merged via the queue into main with commit 1c7df7f May 8, 2026
222 of 224 checks passed
@VGR-GIT VGR-GIT deleted the Fix-perps-leaderboard-crown-logic branch May 8, 2026 13:06
@github-actions github-actions Bot locked and limited conversation to collaborators May 8, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.78.0 Issue or pull request that will be included in release 7.78.0 label May 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.78.0 Issue or pull request that will be included in release 7.78.0 size-M team-rewards Rewards team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants