fix: cp-7.80.0 prevent send flow from submitting to zero address after clearing pasted recipient #30771
Conversation
… pasted recipient Clear pastedRecipient state when the Clear button is pressed in RecipientInput to prevent the auto-review useEffect from re-triggering with stale state. Add a defense-in-depth guard in proceedWithSubmit to reject empty recipient addresses.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Both fixes are in the confirmations/send flow components. SmokeConfirmations covers transaction sending for native tokens (ETH), ERC-20 tokens, and Solana SPL tokens, which directly exercises these recipient input and submission flows. No other tags are needed as these changes are isolated to the send recipient UI logic and don't affect swaps, staking, network management, accounts, or other areas. No performance impact expected from these small logic fixes. Performance Test Selection: |
| if (!recipientAddress) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
This is safety net guard for preventing submission to zero address
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 636fbc9. Configure here.
| const recipientAddress = resolvedAddress || to; | ||
| if (!recipientAddress) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
Computed recipientAddress not reused in handleSubmitPress call
Low Severity
The new recipientAddress variable at line 89 computes resolvedAddress || to, but line 98 recomputes the same expression resolvedAddress || to instead of reusing recipientAddress. In this critical transaction-submission function, the guard and the actual submission call rely on the same address derivation formula — if the formula ever changes, updating one without the other would silently create a mismatch between what's validated and what's submitted.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 636fbc9. Configure here.


Description
When a user pastes an address in the send flow, an auto-review
useEffectis triggered to streamline the UX. If the "New address" alert modal appears and the user cancels it, then presses the "Clear" button, thepastedRecipientstate was not being cleared. This caused a race condition:handleClearInputwould settoto empty, which causedhasUnacknowledgedAlertsto becomefalse(no alerts for empty addresses), whilepastedRecipientandtoAddressValidatedstill held the old address. The auto-reviewuseEffectwould then see all conditions pass and firehandleSubmitPresswith an emptytovalue, which got cast to0x0000...0000.Fix:
pastedRecipientinhandleClearInputso the auto-review effect cannot re-trigger with stale state after clearing.proceedWithSubmitto reject empty recipient addresses.Changelog
CHANGELOG entry: Fixed a bug where clearing a pasted recipient address in the send flow could trigger a transaction to the zero address
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
Pressing Clear after cancelling the "New address" alert triggers a transaction submission to
0x0000...0000.After
Pressing Clear correctly resets the input without triggering any transaction submission.
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Note
Medium Risk
Changes send submission guards and recipient state on a user-facing money path; scope is small and covered by tests, but incorrect gating could block valid sends or miss edge cases.
Overview
Fixes a send-flow bug where Clear after canceling the "New address" alert could still auto-advance review because
pastedRecipientstayed set whiletowas emptied.RecipientInputnow resetspastedRecipientinhandleClearInput(along withupdateTo('')) so the paste auto-reviewuseEffectcannot re-fire on stale paste state.RecipientproceedWithSubmitalso bails out when there is noresolvedAddressorto, blocking submission with an empty recipient (e.g. zero address). Tests cover clear + empty-recipient paths.Reviewed by Cursor Bugbot for commit 636fbc9. Bugbot is set up for automated code reviews on this repo. Configure here.