fix: query correct rollup for legacy delegation withdrawals#63
Open
robertbrada wants to merge 4 commits intomainfrom
Open
fix: query correct rollup for legacy delegation withdrawals#63robertbrada wants to merge 4 commits intomainfrom
robertbrada wants to merge 4 commits intomainfrom
Conversation
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.
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
getAttesterViewreturnsstatus=NONEandfinalizeWithdrawwould target the wrong contract.Fix
Thread each stake's own
rollupAddress(already stored in the indexer'sstaked/stakedWithProvider/erc20StakedWithProvider/deposittables) through the API intouseAttesterView,useSequencerStatus, anduseFinalizeWithdraw. 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
Test plan
/api/atp/:atp/detailsand/api/staking/:beneficiaryresponses includerollupAddresson every stake/delegation entry0xc1c4…,0x5E11…): badge flips IN QUEUE → Exiting/Unstaking, Finalize Withdraw enables0x603bb2c0…, not the current rollup