Skip to content

fix(speed-up): derive live action for RBF speed up modal#12400

Merged
kaladinlight merged 2 commits into
developfrom
fix/btc-rbf-speedup-stale-action-snapshot
May 29, 2026
Merged

fix(speed-up): derive live action for RBF speed up modal#12400
kaladinlight merged 2 commits into
developfrom
fix/btc-rbf-speedup-stale-action-snapshot

Conversation

@kaladinlight
Copy link
Copy Markdown
Member

@kaladinlight kaladinlight commented May 29, 2026

Description

ActionCenter stored the speed-up target as a frozen snapshot of the action object captured when the "Speed Up" button was clicked, while SpeedUpModal separately reads the live store via actionsById[txHash] (for marking the replaced action). When those two sources diverge, the replacement transaction is created from the stale snapshot and can inherit stale/undefined metadata — e.g. amountCryptoPrecision (surfacing as an un-interpolated Sending %{amount} BTC notification) and btcUtxoRbfTxMetadata (the BTC RBF input address paths).

This changes ActionCenter to store only the action id and derive the action live from the store, so every field passed to SpeedUpModal (amountCryptoPrecision, btcUtxoRbfTxMetadata, accountIdsToRefetch, txHash, accountId) reflects current state at confirm time. A null guard is kept so a cleared action while the modal id is set can't throw.

Follow-up from #12381.

Note: this is best understood as defensive hardening for the stale-snapshot class — the originally reported Ledger second-speed-up repro could not be reproduced on retest, but the snapshot/live divergence is a real latent issue and this removes the frozen reference entirely.

Issue (if applicable)

closes #

Risk

Low. UI/state-management change scoped to the Action Center speed-up entry point. No new or modified on-chain transaction construction — the data passed to SpeedUpModal is sourced live from existing redux state instead of a captured object reference. No protocol/signing logic changed.

What protocols, transaction types, wallets or contract interactions might be affected by this PR?

BTC RBF "Speed Up" flow only (native/Ledger). No signing path changes.

Testing

Engineering

  • Send a BTC transaction, open the Action Center, and "Speed Up" the pending send. Confirm the new pending entry shows the correct send amount (not %{amount}).
  • Speed up the resulting replacement again and confirm amount + RBF metadata remain correct on the new replacement.
  • Verify the replaced entry still shows "You sped up your send of BTC".

Operations

  • 🏁 My feature is behind a flag and doesn't require operations testing (yet)

Not flagged, but user-facing impact is limited to the BTC Speed Up notification/card showing the correct amount. To functionally check: perform a BTC send + Speed Up and confirm the new transaction notification renders the send amount.

Screenshots (if applicable)

N/A

Summary by CodeRabbit

  • Refactor
    • Improved internal state management for the Speed Up modal to enhance code maintainability and efficiency.

Review Change Stack

ActionCenter stored the speed-up target as a frozen snapshot of the
action object captured at click time, then SpeedUpModal mixed it with a
live actionsById lookup. If those diverge, the replacement transaction
can inherit stale/undefined metadata (e.g. amountCryptoPrecision,
btcUtxoRbfTxMetadata). Store only the action id and derive the action
live from the store so every field passed to the modal is current.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@kaladinlight kaladinlight requested a review from a team as a code owner May 29, 2026 19:16
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 29, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 398433e1-52c0-4acd-bb49-65aa9f62d8ef

📥 Commits

Reviewing files that changed from the base of the PR and between 2c9d95a and 5b35a75.

📒 Files selected for processing (1)
  • src/components/Layout/Header/ActionCenter/ActionCenter.tsx

📝 Walkthrough

Walkthrough

ActionCenter refactors its Speed Up modal to store only a speedUpActionId instead of the full GenericTransactionAction object, deriving the action via Redux selectors. Imports are updated, state management is restructured, and the modal's close handler is adjusted accordingly.

Changes

Speed Up Modal State Refactor

Layer / File(s) Summary
Speed Up modal state refactor
src/components/Layout/Header/ActionCenter/ActionCenter.tsx
Imports updated to include Redux action selectors; speedUpAction component state replaced with speedUpActionId; action lookup added via actionsById selector with memoized validation; handleOpenSpeedUp stores ID instead of full action; SpeedUpModal's onClose handler clears speedUpActionId instead of previous state variable.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • shapeshift/web#12357: Both PRs modify the Speed Up modal wiring; main PR changes ActionCenter state/onClose handling while the related PR updates SpeedUpModal to use useModalRegistration({ isOpen, onClose }).

Poem

🐰 A modal state, once fat and whole,
Now slim and neat—just stores the goal!
An ID lives, the selector shows,
Redux whispers where action flows. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: deriving the live action for the Speed Up modal instead of storing a stale snapshot, which directly addresses the PR's core objective.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/btc-rbf-speedup-stale-action-snapshot

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kaladinlight kaladinlight enabled auto-merge (squash) May 29, 2026 19:34
@kaladinlight kaladinlight merged commit 021b7ec into develop May 29, 2026
4 checks passed
@kaladinlight kaladinlight deleted the fix/btc-rbf-speedup-stale-action-snapshot branch May 29, 2026 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant