Skip to content

fix: query correct rollup for legacy delegation withdrawals#63

Open
robertbrada wants to merge 4 commits intomainfrom
rb/legacy-rollup-unstake-fix
Open

fix: query correct rollup for legacy delegation withdrawals#63
robertbrada wants to merge 4 commits intomainfrom
rb/legacy-rollup-unstake-fix

Conversation

@robertbrada
Copy link
Copy Markdown
Collaborator

@robertbrada robertbrada commented Apr 24, 2026

Problem

Users with delegations on the legacy v0 Rollup see their unstake stuck as IN QUEUE with no Finalize Withdraw button. The dashboard hard-codes the current rollup everywhere, so getAttesterView returns status=NONE and finalizeWithdraw would target the wrong contract.

Fix

Thread each stake's own rollupAddress (already stored in the indexer's staked / stakedWithProvider / erc20StakedWithProvider / deposit tables) through the API into useAttesterView, useSequencerStatus, and useFinalizeWithdraw. Covers both the ATP Details modal and the Wallet Stakes modal, delegations and direct stakes.

Hooks fall back to the current rollup when no address is passed, so nothing else needs to change.

Deploy

  • Indexer: restart only. No schema change, no reindex.
  • Frontend: standard deploy.

Test plan

  • After deploy, /api/atp/:atp/details and /api/staking/:beneficiary responses include rollupAddress on every stake/delegation entry
  • Open ATP Details modal for an affected wallet (0xc1c4…, 0x5E11…): badge flips IN QUEUE → Exiting/Unstaking, Finalize Withdraw enables
  • Clicking Finalize Withdraw sends the tx to v0 Rollup 0x603bb2c0…, not the current rollup
  • Current-rollup delegations / stakes still behave normally

Delegations on a prior rollup version were stuck showing "IN QUEUE"
with no Finalize Withdraw button: useAttesterView hard-coded the
current rollup, so getAttesterView returned status=NONE for attesters
that live on v0. The button, when it did enable, also targeted the
wrong rollup.

Thread the delegation's own rollupAddress (already stored on
stakedWithProvider) through the API response and into useAttesterView,
useSequencerStatus, and useFinalizeWithdraw. Hooks fall back to the
current rollup when no address is passed, so non-delegation callers
are unaffected.
@robertbrada robertbrada requested a review from a team as a code owner April 24, 2026 14:51
robertbrada and others added 3 commits April 24, 2026 17:18
Same underlying bug as the delegation flow, remaining in four spots:
- ATPDetailsDirectStakeItem
- WalletDelegationItem
- WalletDirectStakeItem
- WalletWithdrawalActions

Each used useSequencerStatus / finalizeWithdraw with no rollup address,
so a legacy-rollup stake surfaced here would still stick in "IN QUEUE"
and target the wrong contract on finalize.

Surface per-row rollupAddress from the indexer (staked +
erc20StakedWithProvider + deposit tables all already store it) via
/api/atp/:atp/details (direct stakes) and /api/staking/:beneficiary
(all four breakdowns). Thread it through the frontend types and into
the four components.

Pending localStorage stakes default to the current rollup since they
were, by definition, just submitted against it.
Same legacy-rollup issue on the initiate-unstake path: an ERC20 direct
staker on v0 clicking "Initiate Unstake" would send the tx to the env
rollup (v1) where their attester doesn't exist, and it'd revert.
…l action props

Removes the silent `?? contracts.rollup.address` fallback on the rollup write hooks
(`useFinalizeWithdraw`, `useWalletInitiateWithdraw`) and the read hooks
(`useAttesterView`, `useSequencerStatus`, `useStakeHealth`). Callers must now pass
rollupAddress explicitly — a missing value is a compile error instead of silently
routing a legacy-rollup action to the canonical rollup (the exact bug this branch
set out to fix).

Threads rollupAddress through `useStakeHealth`, the one remaining consumer of
`useAttesterView` that wasn't updated in the earlier commits.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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