-
Notifications
You must be signed in to change notification settings - Fork 5.4k
fix: dapp swap comparison: use middleware for transaction decoding #38406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dapp_swap_fixes
Are you sure you want to change the base?
Conversation
|
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. |
✨ Files requiring CODEOWNER review ✨✅ @MetaMask/confirmations (5 files, +87 -143)
|
| srcTokenAmount: quotesInput?.srcTokenAmount as Hex, | ||
| destTokenAmountMin: amountMin as Hex, | ||
| }, | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Missing commands in successful swap comparison data storage
The commands variable is parsed from transaction data at line 106 but is never stored in setDappSwapComparisonData during the success path. The initial call (lines 117-124) stores only swapInfo, and the successful quote fetch callback (lines 135-138) stores only quotes and latency. Only error handlers include commands. The UI code expects commands from dappSwapComparisonData to populate metrics like swap_dapp_commands. Since commands isn't stored on success, metrics will incorrectly receive empty strings for this field.
Builds ready [2c7106e]
UI Startup Metrics (1208 ± 113 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
|
Description
Dapp swap comparison related code cleanup.
Changelog
CHANGELOG entry:
Related issues
Fixes: https://github.com/MetaMask/MetaMask-planning/issues/6346
Manual testing steps
Screenshots/Recordings
NA
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Moves swap tx decoding to middleware, introduces
swapInfostorage with incremental updates, simplifies UI hooks/metrics, and removes deprecatedtokenAddresses.swapInfotoDappSwapComparisonData(src/dest token addresses and amounts); removetokenAddresses.setDappSwapComparisonDatanow merges per-transaction updates instead of overwriting.app/scripts/lib/dapp-swap/dapp-swap-util.ts):amountMin; persistswapInfovia controller before fetching quotes.commandson errors; droptokenAddresses.getDataFromSwapreturns command values directly; associated tests updated (notokenAddresses).useDappSwapComparisonInfo: remove in-UI decoding and batch validation; consume middleware-providedswapInfo/commands; compute metrics usingswapInfo.destTokenAmountMin; remove request detection latency property.useDappSwapComparisonLatencyMetrics: remove request detection latency tracking; keep total latency.swapInfo.swapInfoshape, metrics, and removed fields.Written by Cursor Bugbot for commit 39caf8c. This will update automatically on new commits. Configure here.