Skip to content

fix: cp-8.0.0 musd fiat deposit amount data error prefixes#32314

Merged
matthewwalsh0 merged 2 commits into
mainfrom
fix/musd-amount-data-prefixes
Jun 24, 2026
Merged

fix: cp-8.0.0 musd fiat deposit amount data error prefixes#32314
matthewwalsh0 merged 2 commits into
mainfrom
fix/musd-amount-data-prefixes

Conversation

@matthewwalsh0

@matthewwalsh0 matthewwalsh0 commented Jun 24, 2026

Copy link
Copy Markdown
Member

Summary

Applies the two-level error prefix pattern to getAmountData in amount-data-callback.ts:

  • Outer (entire getAmountData function): Update Amount Data:
  • Inner (around buildMoneyAccountDepositBatch): Money Account Deposit:

A failure during deposit calldata building now surfaces as:

Update Amount Data: Money Account Deposit: <original error>

This matches the naming convention on the core side (MetaMask/core#9250) and in the useUpdateTransactionPayAmount hook, making it immediately clear from the error message that the failure occurred in the amount data callback and specifically in the money account deposit build step.

Also included

  • disableUpgrade: true added to useMoneyAccount deposit and withdrawal addTransactionBatch calls (the Money Account is always already upgraded on Monad)
  • error-prefix.ts: reason in CALL_EXCEPTION handling made optional to handle ethers errors where reason may be null

Note

Low Risk
Targeted error-handling and transaction-batch flags for money account flows; no auth or broad architectural changes.

Overview
Improves mUSD / money account deposit failures during MM Pay amount updates by wrapping getAmountData in a two-level prefixError pattern (Update Amount Data:Money Account Deposit:), so users and support can tell the failure is in the amount-data callback and specifically in deposit calldata building.

prefixError now treats ethers CALL_EXCEPTION reason as optional: when reason is missing or non-string, messages use eth_call failed - <method> instead of falling back to the full verbose ethers string.

Money account deposit and withdrawal addTransactionBatch calls set disableUpgrade: true because the money account is already upgraded on Monad, avoiding unnecessary upgrade logic in the batch pipeline.

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

@mm-token-exchange-service mm-token-exchange-service Bot added team-confirmations Push issues to confirmations team INVALID-PR-TEMPLATE PR's body doesn't match template labels Jun 24, 2026
@mm-token-exchange-service

Copy link
Copy Markdown

PR template — items to address before "Ready for review"

Warnings — informational, address before merging:

See docs/readme/ready-for-review.md for the full Definition of Ready for Review.

@matthewwalsh0 matthewwalsh0 changed the title fix: use Update Amount Data and Money Account Deposit error prefixes for amount-data-callback fix: musd fiat deposit amount data error prefixes Jun 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

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

E2E Test Selection:

The PR makes three focused changes:

  1. useMoneyAccount.ts: Adds disableUpgrade: true to both addTransactionBatch calls in the deposit and withdrawal flows. This directly affects the MetaMask Card (Money) deposit and withdrawal transaction batch behavior. SmokeMoney covers these flows.

  2. amount-data-callback.ts (transaction-pay-controller): Wraps buildMoneyAccountDepositBatch in try/catch blocks with prefixError for better error attribution. This is part of the Money Account deposit pipeline. SmokeMoney covers this.

  3. error-prefix.ts: Fixes getCallErrorMessage to handle cases where reason is absent or not a string in CALL_EXCEPTION errors (previously required reason to be a string). This utility is used across Money, Confirmations, Swap, and delegation flows. The change is backward-compatible (handles previously-unhandled edge cases gracefully), so it's unlikely to break existing flows, but it does affect error handling in confirmation flows.

Since Money Account deposit/withdrawal flows involve on-chain transactions that go through the confirmation UI, SmokeConfirmations is also selected per the SmokeMoney tag description ("When selecting SmokeMoney for Card Add Funds or similar flows that execute swaps, also select SmokeSwap and SmokeConfirmations").

The test files are unit tests only and don't affect E2E test selection. No navigation, browser, snaps, network, or account management changes are present.

Performance Test Selection:
The changes are focused on error handling improvements (prefixError utility, try/catch wrapping) and adding a disableUpgrade flag to transaction batch calls. None of these changes affect rendering performance, app launch, asset loading, onboarding, login, swap execution times, or any other performance-sensitive flows measured by the available performance test tags. No performance tests are warranted.

View GitHub Actions results

@matthewwalsh0 matthewwalsh0 marked this pull request as ready for review June 24, 2026 12:18
@matthewwalsh0 matthewwalsh0 requested review from a team as code owners June 24, 2026 12:18
@github-actions github-actions Bot added the risk:medium AI analysis: medium risk label Jun 24, 2026
@matthewwalsh0 matthewwalsh0 requested a review from OGPoyraz June 24, 2026 12:23
provider,
});
} catch (error) {
throw prefixError(error, MONEY_ACCOUNT_DEPOSIT_ERROR_PREFIX);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very neat debugging mechanism 😄

@sonarqubecloud

Copy link
Copy Markdown

@matthewwalsh0 matthewwalsh0 enabled auto-merge June 24, 2026 12:56
@matthewwalsh0 matthewwalsh0 added this pull request to the merge queue Jun 24, 2026
@matthewwalsh0 matthewwalsh0 removed this pull request from the merge queue due to a manual request Jun 24, 2026
@matthewwalsh0 matthewwalsh0 changed the title fix: musd fiat deposit amount data error prefixes fix: cp-8.0.0 musd fiat deposit amount data error prefixes Jun 24, 2026
@matthewwalsh0 matthewwalsh0 added this pull request to the merge queue Jun 24, 2026
Merged via the queue into main with commit 6bd3605 Jun 24, 2026
195 of 201 checks passed
@matthewwalsh0 matthewwalsh0 deleted the fix/musd-amount-data-prefixes branch June 24, 2026 13:25
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 24, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-8.1.0 Issue or pull request that will be included in release 8.1.0 label Jun 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

INVALID-PR-TEMPLATE PR's body doesn't match template release-8.1.0 Issue or pull request that will be included in release 8.1.0 risk:medium AI analysis: medium risk size-M team-confirmations Push issues to confirmations team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants