fix(tcy): surface halt state on TCY claim/stake/unstake and keep fees during halts#12398
Conversation
… during halts Users couldn't confirm TCY claim/stake/unstake transactions during a THORChain halt: the inbound_addresses query filters out halted chains, so useSendThorTx got no inbound address, fee estimation never ran, and the confirm button was silently disabled with no reason shown. The chain-halt check also used the wrong chain (thorchainChainId instead of the claim asset's L1 chain) and didn't account for the TCY-specific mimir halt flags. - ClaimConfirm: check the claim asset's own L1 chain halt + TCYCLAIMINGHALT, and surface a distinct reason on the button (chain vs claiming halted) + error state. - StakeInput/UnstakeInput: gate on TCYSTAKINGHALT/TCYUNSTAKINGHALT in addition to the chain halt, with distinct copy + error state. - useSendThorTx: fetch halted inbound addresses (opt-in includeHalted) so fees still estimate during a halt (read-only). Broadcasting and the exposed inbound address are guarded against halted vaults as defense-in-depth, so execution is impossible while halted regardless of the consuming UI. - thornode: add opt-in includeHalted to inboundAddresses with a distinct query key; default still filters halted so trade/swapper and all other consumers are unaffected. - Add TCY.claimingHalted/stakingHalted/unstakingHalted translation strings. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR adds TCY claiming, staking, and unstaking halt handling: inbound address query gains an option to include halted vaults; the transaction hook guards against broadcasting to halted vaults; translation keys and Claim/Stake/Unstake UIs integrate Thorchain Mimir halt flags for messaging, disabling, and loading states. ChangesTCY Halted State Support
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
TS1355: `as const` cannot be applied to a parenthesized ternary, only to literals directly. Move the assertion onto each array branch. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Description
Users were unable to confirm TCY claim and stake transactions during a THORChain halt. The confirm button was silently disabled with no reason, because:
inbound_addressesfilters out halted chains, souseSendThorTxreceived no inbound address →estimateFeesArgsshort-circuited → fees never estimated → the button was disabled via!estimatedFeesDatawith no explanation.thorchainChainIdinstead of the claim asset's own L1 chain, e.g. BTC), so a chain-specific halt (HALTBTCCHAIN) went undetected.TCYCLAIMINGHALT/TCYSTAKINGHALT/TCYUNSTAKINGHALT) weren't checked at all — these can be active while the chain itself is not halted (the exact state that triggered this bug).Changes
fromAssetId(claim.assetId).chainId) +TCYCLAIMINGHALT; distinct button copy (chain vs claiming halted) and error state when halted.TCYSTAKINGHALT/TCYUNSTAKINGHALTin addition to the chain halt, with distinct copy + error state.includeHaltedinbound addresses so fees still estimate during a halt (read-only). Defense-in-depth so a halted vault can never be acted on:inboundAddress(the value consumers use as an approval spender) returnsundefinedwhen halted.executeTransactionbails before broadcasting when the inbound is halted.includeHaltedflag toinboundAddresseswith a distinct query key. The default still filters halted, so trade/swapper (swapperApiHelpers),useIsTradingActive,usePools, etc. are unaffected.TCY.claimingHalted/TCY.stakingHalted/TCY.unstakingHaltedstrings (English only; other locales fall back until/translate).Issue (if applicable)
Fixes SS-5689 — Unable to confirm TCY claim and stake transaction
Risk
Higher risk — touches the THORChain transaction execution path shared by all THORChain DeFi flows (TCY claim/stake/unstake, Savers, LP, Lending repay) via
useSendThorTx.Note: this does not introduce or change transaction construction — it only adds halt gating and lets fees estimate during a halt. Key invariants verified:
inboundAddresses()still filters halted (distinct cache key for the include-halted variant), so swapper/trade routing is unchanged.executeTransaction.inboundAddressisundefinedwhen halted.Suggest the High-Risk label + 2 reviewers given the breadth of
useSendThorTxconsumers.THORChain (MsgDeposit, EvmCustomTx, UTXO Send) across TCY claim/stake/unstake, Thorchain Savers, Thorchain LP, and Lending repay.
Testing
Engineering
executeTransaction).inboundAddresses()unchanged).Operations
Functional QA: during a THORChain/TCY halt, verify TCY claim/stake/unstake show the fee + a halt reason on a disabled button; verify normal flows are unaffected when not halted.
Screenshots (if applicable)
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes