fix: preserve migration UI when no active unbonding locks#715
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR updates the migrate delegator flow to avoid a contract read that now reverts when called with an empty unbonding-locks array, and introduces route-based “expected chain” handling to improve UX when connected to the wrong network.
Changes:
- Skip
getMigrateUnbondingLocksParamsread when there are no active locks. - Remove route-based re-mounting of providers; configure Web3/Wagmi with both default + L1 chains.
- Add route-derived expected chain helpers and disable staking actions / show “wrong network” UI when connected to the incorrect chain.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pages/migrate/delegator/index.tsx | Skips migrator read on empty locks (but currently blocks initialization flow; see comment). |
| pages/_app.tsx | Removes migrate-route-specific provider keying and passes only locale to Web3Providers. |
| hooks/wallet.tsx | Adds useExpectedChainId and useIsWrongRouteChain based on route + connected chain. |
| components/Web3Providers/index.tsx | Configures Wagmi/RainbowKit with both chains (DEFAULT + L1) and removes route dependency. |
| components/DelegatingWidget/index.tsx | Disables tab switching when connected to the wrong chain and passes flag to footer. |
| components/DelegatingWidget/Footer.tsx | Shows a “switch to expected chain” disabled state for delegate/undelegate actions. |
| components/ConnectButton/index.tsx | Shows a “Wrong Network” button that opens the chain modal when on the wrong chain. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d52b9e0 to
324cda5
Compare
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughIn the delegator migrate page's ChangesEmpty-locks guard in delegator migrate page
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5 minutes ✨ 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 |
324cda5 to
63ae79b
Compare
63ae79b to
48ac1f3
Compare
L1Migrator now reverts getMigrateUnbondingLocksParams with EMPTY_LOCK_IDS on an empty lock array (livepeer/arbitrum-lpt-bridge#98), which crashed the delegator migration page on init. For an empty array, short-circuit to the initialize stage with the same zero-total result the contract previously returned, so the signing flow (migrate another account's stake) still renders instead of reverting. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
48ac1f3 to
3cac7f8
Compare
Problem
The protocol team patched a vurnability in the migration flow on 24-05-26 (see https://forum.livepeer.org/t/security-vulnerability-disclosure-fixed-l1-l2-migrator-address-validation/3259). In this patch the
arbitrum-lpt-bridgeL1Migrator upgrade (livepeer/arbitrum-lpt-bridge#98) addedrequire(unbondingLockIdsLen > 0, "EMPTY_LOCK_IDS")togetMigrateUnbondingLocksParams. Previously an empty lock array was tolerated (returned a zero-total result); it now reverts.The Migrate Undelegated Stake page (
pages/migrate/delegator) calls this read withl1SignerOrAddress.activeLocks. In the signing flow the connected account has no locks, so before a signer address with locks is entered the array is empty and the read reverts:Fix
Skip the read when
locks.length === 0. The empty call was always a no-op, and the effect re-runs once a signer with real locks is set.Scope
Only the delegator page is affected. The orchestrator (
getMigrateDelegatorParams) and broadcaster (getMigrateSenderParams) pages don't pass lock arrays, and all three already pass identical L1/L2 addresses so the newL2_ADDR_MISMATCHcheck never trips.Related
Upstream protocol change: livepeer/arbitrum-lpt-bridge#98
Summary by CodeRabbit