Skip to content

test: align polymarket utils tests with clob cleanup#29617

Open
ghgoodreau wants to merge 24 commits intomainfrom
predict/clob-v2-cleanup-core-hunter
Open

test: align polymarket utils tests with clob cleanup#29617
ghgoodreau wants to merge 24 commits intomainfrom
predict/clob-v2-cleanup-core-hunter

Conversation

@ghgoodreau
Copy link
Copy Markdown
Contributor

@ghgoodreau ghgoodreau commented May 1, 2026

Description

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

Medium Risk
Updates token addresses/metadata used for Predict gas fee payments and rewards estimation, so an incorrect constant could affect on-chain transactions or points calculations. Changes are localized but touch transaction submission parameters and token display.

Overview
Predict now uses the new Polygon collateral contract (MATIC_CONTRACTS_V2.collateral / POLYGON_PUSD) when setting gasFeeToken for claim/withdraw transaction batches and when estimating Rewards points (switches fee asset from USDC to pUSD).

The Predict balance token list row is updated to use the pUSD token image, show the formatted balance as the description, and add fiat_description: 'pUSD'; tests are adjusted accordingly. Account state hook/tests are also aligned to no longer expect/cover hasAllowances.

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

matallui and others added 18 commits April 29, 2026 14:02
* main: (21 commits)
  feat(predict): Add A/B Test Analytics Instrumentation: Bet Slip + Pay with Any Token (#29464)
  feat: Accounts Metrics (#29015)
  feat: Enable mUSD conversion flow for hardware wallet accounts (#29418)
  chore: QA and bug fixes from dry run apr 29 (#29519)
  test: remove toMatchSnapshot and removed snapshot files in unassigned code owners pt 3/3 (#29441)
  fix(card): initialize spending limit from saved allowance (#29517)
  perf(accessibility): fix iOS accessibility in Ramp components (#29126)
  test: e2e labels rename and shards update (#29431)
  test: fix missing mock (#29549)
  feat(rewards): add targeted Sentry capture for rewards auth errors (#29545)
  feat: track token_security_type_destination in metrics (#29381)
  fix(bridge): hide sponsored label on cross-chain bridge with insufficient balance (#29490)
  ci: fix scheduled e2e runs (#29539)
  chore: Bump `snaps-controllers` (#29486)
  chore: add buy/sell trade markers to trader position chart (#29478)
  fix(rewards): leaderboard split view (#29500)
  perf(accessibility): fix iOS accessibility in shared components for p… (#29119)
  ci: switch OTA hotfix release branch to `-ota` suffix convention (#29353)
  ci: fix `get-requirements.yml` checks for `pull_request` events (#29528)
  feat: added developer options button to clear dismissed mUSD conversion asset details CTAs (#29510)
  ...
* main:
  feat: add Tempo chain as additionnal network (#29515)
  feat: add token list security badges (#29509)
  fix: percentage buttons for money account withdraw (#29339)
  feat(predict): Add Funds / Change Payment Method CTA (#29461)
  chore: enable swaps asset picker security tags (#29570)
  test: mock accounts v4 transactions endpoint (#29569)
  feat: money account transaction - add default value for accountOverride (#29332)
  fix: Refine Perps section and empty state patterns to match Home and Money (#29009)
Co-authored-by: Cursor <cursoragent@cursor.com>
@ghgoodreau ghgoodreau requested review from a team as code owners May 1, 2026 16:49
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 1, 2026

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-swaps-and-bridge Swaps and Bridge team label May 1, 2026
Co-authored-by: Cursor <cursoragent@cursor.com>
@ghgoodreau ghgoodreau changed the title Predict/clob v2 cleanup core hunter test: align polymarket utils tests with clob cleanup May 1, 2026
ghgoodreau and others added 2 commits May 1, 2026 12:09
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 1, 2026

Codecov Report

❌ Patch coverage is 88.37209% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.52%. Comparing base (51b6bbd) to head (a30e7c7).
⚠️ Report is 34 commits behind head on main.

Files with missing lines Patch % Lines
...Predict/providers/polymarket/PolymarketProvider.ts 85.71% 3 Missing and 1 partial ⚠️
...redict/providers/polymarket/protocol/orderCodec.ts 50.00% 1 Missing and 1 partial ⚠️
.../UI/Predict/providers/polymarket/preflight/core.ts 83.33% 0 Missing and 1 partial ⚠️
.../Predict/providers/polymarket/preflight/deposit.ts 75.00% 1 Missing ⚠️
...UI/Predict/providers/polymarket/preflight/trade.ts 66.66% 0 Missing and 1 partial ⚠️
...ents/UI/Predict/providers/polymarket/safe/utils.ts 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #29617      +/-   ##
==========================================
- Coverage   82.15%   81.52%   -0.64%     
==========================================
  Files        5178     5226      +48     
  Lines      137450   138358     +908     
  Branches    31079    31395     +316     
==========================================
- Hits       112924   112790     -134     
- Misses      16875    17826     +951     
- Partials     7651     7742      +91     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

ghgoodreau and others added 2 commits May 1, 2026 13:26
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 1, 2026

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokePredictions, SmokeConfirmations, SmokeWalletPlatform
  • Selected Performance tags: @PerformancePredict
  • Risk Level: high
  • AI Confidence: 92%
click to see 🤖 AI reasoning details

E2E Test Selection:
This PR migrates the Polymarket/Predict integration from USDC.e (legacy V1 collateral) to pUSD (Polymarket USD, V2 collateral). This is a significant protocol-level change affecting:

  1. SmokePredictions (primary): All four predict smoke tests are directly modified (predict-open-position, predict-cash-out, predict-claim-positions, predict-withdraw). The core PredictController and PolymarketProvider are updated to use pUSD as the collateral token. The V1 protocol is removed entirely, leaving only V2. Mock infrastructure (polymarket-constants, polymarket-mocks) is updated to reflect pUSD contract addresses and balance tracking. These tests must run to verify the pUSD migration works end-to-end.

  2. SmokeConfirmations: The transaction-pay.spec.ts file is directly modified - it's tagged under SmokeConfirmations and tests the deposit confirmation flow. The token address changed from USDC.e (0x2791...) to pUSD (0xC011...), and expected fee amounts were updated. This test must run to verify the confirmation UI correctly displays pUSD deposit transactions.

  3. SmokeWalletPlatform: Per the tag description, Predictions is a section inside the Trending tab. Changes to Predictions views (including PredictPayWithRow which now uses POLYGON_PUSD instead of POLYGON_USDCE) affect the Trending integration. The tag description explicitly states 'changes to Perps, Predictions, or Tokens views... that are embedded in Trending affect this tag.'

The risk is high because:

  • Core protocol logic changed (V1 removed, V2 only)
  • Contract addresses changed (different token contract)
  • Balance calculation logic changed (pUSD + legacy USDC.e sweep)
  • Multiple transaction flows affected (deposit, withdraw, claim, cash-out, open position)
  • The backward-compat aliases (POLYMARKET_USDC_BALANCE_MOCKS, POST_CLAIM_USDC_BALANCE_WEI etc.) ensure existing callers still work but the underlying behavior changed

Performance Test Selection:
The PredictController and PolymarketProvider have significant changes to balance fetching logic - now fetching both pUSD and legacy USDC.e balances in parallel (Promise.all), adding a new cache (#safeAddressesWithZeroLegacyUsdceBalance) for legacy balance optimization. The balance calculation path changed from summing multiple tokens to a combined pUSD + legacy sweep approach. These changes could affect the performance of the Predict balance loading and display flows, warranting a @PerformancePredict test run.

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 1, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants