Commit b450a0b
authored
fix: support fallback to sequential batch (MetaMask#17449)
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->
## **Description**
This PR aims to apply fixes implemented in Transaction controller to
v59.0.0.
- add support for the scenario when STX is disable for batch transaction
it now returns undefined and this is handle in the transaction
controller (MetaMask/core#6063) using the
fallback to sequential batch.
- updates the `getMethodName` utility to normalise the transaction data
to lowercase before comparing it against known ABI method selectors.
[PR](MetaMask/core#6102)
<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->
## **Changelog**
<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`
If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`
(This helps the Release Engineer do their job more quickly and
accurately)
-->
CHANGELOG entry: Added normalization to the `getMethodName` utility to
normalise the transaction data to lowercase before comparing it against
known ABI method selectors.
## **Related issues**
Fixes: MetaMask/MetaMask-planning#5301 and
MetaMask/MetaMask-planning#5338
## **Manual testing steps**
1. Open the MetaMask mobile wallet (Android or iOS).
2. Navigate to the dApp:
[https://pocs.neplox.security/metamask-mobile-hack13378158bfadd32/](https://pocs.neplox.security/metamask-mobile-hack13378158bfadd32/)
3. Connect your wallet to the dApp.
4. Trigger the malicious transaction by invoking the `sendTransaction()`
function from the page.
5. Observe the transaction preview in MetaMask:
- No spending cap warning
- Missing token name
- Unresolved "to" address (even if it's a well-known address like USDC)
- Generic "Approve" label shown without context.
## **Screenshots/Recordings**
[spend_cap_2.webm](https://github.com/user-attachments/assets/6ffef452-13ce-4f22-9e71-41dd9f03f781)
[sequential_fallback.webm](https://github.com/user-attachments/assets/f6e9c3a3-03ea-4ada-b2a2-9364aaef6544)
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<!-- [screenshots/recordings] -->
### **After**
<!-- [screenshots/recordings] -->
## **Pre-merge author checklist**
- [x] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
## **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.1 parent 3f9a203 commit b450a0b
3 files changed
Lines changed: 36 additions & 11 deletions
File tree
- app
- core/Engine/controllers/transaction-controller
- util/transactions
Lines changed: 1 addition & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
224 | | - | |
225 | | - | |
226 | | - | |
| 224 | + | |
227 | 225 | | |
228 | 226 | | |
229 | 227 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
278 | | - | |
| 278 | + | |
279 | 279 | | |
280 | 280 | | |
281 | 281 | | |
| |||
376 | 376 | | |
377 | 377 | | |
378 | 378 | | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
379 | 388 | | |
380 | 389 | | |
381 | 390 | | |
| |||
389 | 398 | | |
390 | 399 | | |
391 | 400 | | |
392 | | - | |
393 | | - | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
394 | 405 | | |
395 | | - | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
396 | 409 | | |
397 | | - | |
| 410 | + | |
398 | 411 | | |
399 | | - | |
| 412 | + | |
400 | 413 | | |
401 | | - | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
402 | 417 | | |
403 | | - | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
404 | 422 | | |
405 | 423 | | |
| 424 | + | |
406 | 425 | | |
407 | 426 | | |
408 | 427 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
526 | 526 | | |
527 | 527 | | |
528 | 528 | | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
529 | 537 | | |
530 | 538 | | |
531 | 539 | | |
| |||
0 commit comments