Commit 0b1fa04
authored
fix: Predict withdraw beforeSign handling (#29968)
## Summary
- Guards Predict withdraw `beforeSign` so it only signs the active
withdraw transaction.
- Skips signing when the withdraw calldata is already Safe execution
calldata produced by the MetaMask Pay follow-up flow.
- Reuses the active withdraw state consistently when updating
transaction params.
- Adds unit coverage for stale transaction IDs and already-signed Safe
calldata.
## Changelog
CHANGELOG entry: Fixed Predict withdraw signing when withdraw
transaction calldata is already prepared.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Touches transaction pre-signing for Predict withdrawals, which can
affect what data gets signed and where it is sent. Changes are
well-scoped with added unit coverage, but mistakes could block
withdrawals or sign incorrect transactions.
>
> **Overview**
> Predict withdraw `beforeSign` now only runs `signWithdraw` for the
**currently active** withdraw transaction (by `transactionId`) and
reuses that active state when setting `to`/updating tx params.
>
> It also **skips signing** when the nested withdraw calldata is not an
ERC-20 `transfer` selector (e.g., already-prepared Safe execution
calldata from MetaMask Pay), and adds unit tests covering stale
transaction IDs, pre-signed calldata pass-through, and updated call-data
expectations.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
5681381. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 4997055 commit 0b1fa04
2 files changed
Lines changed: 89 additions & 7 deletions
Lines changed: 62 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6361 | 6361 | | |
6362 | 6362 | | |
6363 | 6363 | | |
| 6364 | + | |
| 6365 | + | |
| 6366 | + | |
6364 | 6367 | | |
6365 | 6368 | | |
6366 | 6369 | | |
| |||
6373 | 6376 | | |
6374 | 6377 | | |
6375 | 6378 | | |
6376 | | - | |
| 6379 | + | |
6377 | 6380 | | |
6378 | 6381 | | |
6379 | 6382 | | |
| |||
6424 | 6427 | | |
6425 | 6428 | | |
6426 | 6429 | | |
| 6430 | + | |
| 6431 | + | |
| 6432 | + | |
| 6433 | + | |
| 6434 | + | |
| 6435 | + | |
| 6436 | + | |
| 6437 | + | |
| 6438 | + | |
| 6439 | + | |
| 6440 | + | |
| 6441 | + | |
| 6442 | + | |
| 6443 | + | |
| 6444 | + | |
| 6445 | + | |
| 6446 | + | |
| 6447 | + | |
| 6448 | + | |
| 6449 | + | |
| 6450 | + | |
| 6451 | + | |
| 6452 | + | |
| 6453 | + | |
| 6454 | + | |
| 6455 | + | |
| 6456 | + | |
| 6457 | + | |
| 6458 | + | |
| 6459 | + | |
| 6460 | + | |
| 6461 | + | |
| 6462 | + | |
| 6463 | + | |
| 6464 | + | |
| 6465 | + | |
| 6466 | + | |
| 6467 | + | |
| 6468 | + | |
| 6469 | + | |
| 6470 | + | |
| 6471 | + | |
| 6472 | + | |
| 6473 | + | |
| 6474 | + | |
| 6475 | + | |
| 6476 | + | |
| 6477 | + | |
| 6478 | + | |
| 6479 | + | |
| 6480 | + | |
| 6481 | + | |
| 6482 | + | |
| 6483 | + | |
| 6484 | + | |
| 6485 | + | |
| 6486 | + | |
6427 | 6487 | | |
6428 | 6488 | | |
6429 | 6489 | | |
| |||
6470 | 6530 | | |
6471 | 6531 | | |
6472 | 6532 | | |
6473 | | - | |
| 6533 | + | |
6474 | 6534 | | |
6475 | 6535 | | |
6476 | 6536 | | |
| |||
Lines changed: 27 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
389 | 389 | | |
390 | 390 | | |
391 | 391 | | |
| 392 | + | |
| 393 | + | |
392 | 394 | | |
393 | 395 | | |
394 | 396 | | |
| |||
2753 | 2755 | | |
2754 | 2756 | | |
2755 | 2757 | | |
2756 | | - | |
| 2758 | + | |
| 2759 | + | |
| 2760 | + | |
| 2761 | + | |
| 2762 | + | |
| 2763 | + | |
| 2764 | + | |
| 2765 | + | |
| 2766 | + | |
| 2767 | + | |
| 2768 | + | |
| 2769 | + | |
2757 | 2770 | | |
2758 | 2771 | | |
2759 | 2772 | | |
| |||
2774 | 2787 | | |
2775 | 2788 | | |
2776 | 2789 | | |
2777 | | - | |
| 2790 | + | |
2778 | 2791 | | |
2779 | 2792 | | |
2780 | 2793 | | |
2781 | 2794 | | |
2782 | 2795 | | |
| 2796 | + | |
| 2797 | + | |
| 2798 | + | |
| 2799 | + | |
| 2800 | + | |
| 2801 | + | |
| 2802 | + | |
| 2803 | + | |
| 2804 | + | |
2783 | 2805 | | |
2784 | 2806 | | |
2785 | 2807 | | |
| |||
2793 | 2815 | | |
2794 | 2816 | | |
2795 | 2817 | | |
2796 | | - | |
| 2818 | + | |
2797 | 2819 | | |
2798 | 2820 | | |
2799 | 2821 | | |
| |||
2833 | 2855 | | |
2834 | 2856 | | |
2835 | 2857 | | |
2836 | | - | |
2837 | | - | |
| 2858 | + | |
| 2859 | + | |
2838 | 2860 | | |
2839 | 2861 | | |
2840 | 2862 | | |
| |||
0 commit comments