Skip to content

feat(staking): authorize a wallet to transfer stake in - #885

Open
adamsoffer wants to merge 5 commits into
nextfrom
claude/third-party-griefing-ui-207c7b
Open

adamsoffer wants to merge 5 commits into
nextfrom
claude/third-party-griefing-ui-207c7b

Conversation

@adamsoffer

@adamsoffer adamsoffer commented Nov 28, 2026 •

Copy link
Copy Markdown
Collaborator

As of 30 November, the BondingManager will only accepts transferBond() (and bondForWithHint()) into another account once that account has authorized the caller (forum post). This makes Transfer stake work under that rule, and fixes the pool claim warning.

What changes

1. A clear warning when a transfer isn't authorized. The Transfer stake dialog already simulates the transfer before signing. When the simulation reverts with UNAUTHORIZED_BONDER, the dialog now says: "<receiver> hasn't authorized this wallet to transfer stake into it. Connect <receiver>, authorize this wallet, then try again." It is driven by the simulation, so it shows for fresh and unbonded receivers too, and shows nothing until enforcement is live. It shows as soon as the receiver is picked, before an amount is typed. The "orchestrator hasn't called reward yet" transfer warning is untouched.

2. Authorizing from the warning. The warning has an "Authorize from <receiver>" action. It opens a new step that the receiving wallet signs, setThirdPartyBonderAuthorization(<sender>, true), using the existing connect/switch-account gate. Once it confirms, "Continue transfer" goes back to the sending wallet with the receiver (its ENS name and label included) and amount still filled in, and Done closes it instead. If the chain already shows the authorization, nothing is signed and the dialog goes straight to "Continue transfer". The same step revokes with false.

3. Listing and revoking authorized wallets. A wallet's actions menu (account page and portfolio table), the connected wallet's menu and the portfolio switcher get "Manage authorized wallets": the wallets that can transfer stake into it, each with Remove. The last two make it reachable for a wallet with nothing delegated. It reads thirdPartyBonderAuthorizations(where: { delegator }), in full. The item only appears when the list isn't empty. A subgraph without the entity (before livepeer/subgraph#280 is released) reads as an empty list, so this can merge ahead of it.

4. Pool claim warning (existing bug). Only affects delegators claiming stake from the 2022 move to Arbitrum through their old orchestrator's pool. The protocol holds that claim on the claiming wallet's own orchestrator, not the pool's, so the warning now checks that one and names it (claimHeld() in lib/staking/claim-hold.ts). It's in this PR because pool claims use transferBond, the call the upgrade changes.

The ABI gains setThirdPartyBonderAuthorization, isThirdPartyBonderAuthorized and the ThirdPartyBonderAuthorization event.

Screenshots

Taken from the app running against the repo's mock subgraph, with a mocked wallet and chain that revert like the enforced BondingManager. The wallets and orchestrators shown are mock data.

Transfer stake: refused, authorized, then allowed (items 1 and 2)

1. Main wallet → Cold wallet, refused before signing 2. "Authorize from Cold wallet" asks to connect it
Transfer refused: Cold wallet hasn't authorized this wallet Connect Cold wallet to authorize
3. Cold wallet connected: authorize Main wallet 4. Signed: continue the transfer
Authorize wallet step, signed by Cold wallet Wallet authorized, with Done and Continue transfer
5. Back on Main wallet: same receiver and amount, no warning
Transfer resumed and allowed

Authorized wallets (item 3)

Wallet menu The list Removing one
Manage authorized wallets in the wallet menu Authorized wallets list Remove authorization step

Pool claim warning (item 4)

The wallet's own orchestrator (0xb291…) hasn't called reward this round; the pool's (0xba15…) has. Before this change, no warning showed here.

Pool claim held on the wallet's own orchestrator

Testing

  • Typecheck, lint and the full jest suite pass. New unit tests cover the UNAUTHORIZED_BONDER detection and message, claimHeld(), and listing authorizations.
  • isThirdPartyBonderAuthorized was called against the BondingManager proxy on Arbitrum to confirm the ABI.
  • Before the review changes, authorized wallets was checked in a browser against the subgraph#280 preview deployment, with real authorizations: the menu item, the list, and Remove opening the signing step. On the subgraph current then, the menu item was absent and the page loaded normally. The new query was run against the same preview and returns the same kind of rows; its UI was checked with mock data.
  • The flows in the screenshots were run end to end in a browser with a mocked wallet and chain: the UNAUTHORIZED_BONDER warning, connecting the receiver, signing the authorization, continuing the transfer with the receiver and amount kept, listing and removing authorizations, and the pool claim warning.
  • Not exercised against the real BondingManager with a real wallet: UNAUTHORIZED_BONDER can't be produced on mainnet before enforcement. Worth a check on a fork or right after the upgrade.

Note on the subgraph

The #280 preview deployment doesn't have Delegator.shares, which next queries, so the subgraph released for next needs both.

🤖 Generated with Claude Code

From 30 November the BondingManager only accepts transferBond into another
account once that account has authorized the caller. The transfer dialog now
explains an UNAUTHORIZED_BONDER refusal before signing and offers the fix:
the receiving wallet signs setThirdPartyBonderAuthorization, then the
transfer is picked back up from the sending wallet with its receiver and
amount kept.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
explorer-arbitrum-one Ready Ready Preview Nov 30, 2026 3:07pm UTC

Request Review

Authorized wallets: a wallet's menu lists the wallets that can transfer
stake into it, each with a way to remove it. It reads
Delegator.thirdPartyBonders, and isn't offered while the subgraph doesn't
have the field or the list is empty.

Pool claim warning: the protocol holds a claim on the claiming wallet and
its own orchestrator, not the pool's. The warning now follows that: none
for an unbonded wallet, and otherwise only when the wallet's orchestrator
is active, hasn't called reward this round and the wallet hasn't claimed
this round. The warning and the error name that orchestrator.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…menu

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@rickstaa rickstaa left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inline comments.

Comment on lines +1716 to +1718
description = action.authorized
? `Lets ${bonderName} transfer stake into this wallet. That's all it allows: it can't move stake out of this wallet or act for it.`
: `Stops ${bonderName} from transferring stake into this wallet. Stake already here isn't affected.`;

@rickstaa rickstaa Nov 30, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe drop "That's all it allows", since it reads as a guarantee. Something like:

Lets X transfer stake into this wallet. It can't move stake out or act for it. Only authorize a wallet you control.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 9475c85, with your wording.

destOrch.lastRewardRound !== protocol.currentRound ? (
// The pool's stake can't move until its orchestrator has
// called reward this round (ILLEGAL_CLAIM_EARNINGS).
{claimIsHeld ? (

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This notice only renders in the pooled branch. A non-pooled claimStake goes through the L2Migrator into bondForWithHint, which is held on the wallet's own orchestrator too, so in the !pooled branch the user only finds out from a failed signature. Rendering the notice whenever claimIsHeld is true would cover both.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not in this PR. I'll take it in a follow-up.

const account = position.account;
const saved = list.some((w) => w.address === account.address);
// Offered only once some wallet has been authorized.
const { data: bonders } = useThirdPartyBonders(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Manage authorized wallets" is only reachable here (needs a position) and from DelegationActions (needs a delegate). A wallet with no stake that authorizes a sender and then abandons the transfer has no way to see or revoke the authorization. Could it go in the wallet settings or switcher menu too?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 9475c85. "Manage authorized wallets" is also in the connected wallet's menu and the portfolio switcher, so a wallet with nothing delegated can revoke.

Comment thread lib/subgraph/authorizations.ts Outdated

const BONDERS = /* GraphQL */ `
query ThirdPartyBonders($id: ID!) {
delegator(id: $id) {

@rickstaa rickstaa Nov 30, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This depends on how we settle livepeer/subgraph#280, see my comment there. With the current Delegator link it works for unstaked wallets, since the grant creates a Delegator. If we switch to delegator: String!, Delegator.thirdPartyBonders goes away and the catch at L48 silently turns that into an empty list. The query would then need to be thirdPartyBonderAuthorizations(where: { delegator: $addr }).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switched in 9475c85 to thirdPartyBonderAuthorizations(where: { delegator: $delegator }). It works on the current #280 preview and should work with delegator: String! too. The catch now only covers a subgraph without thirdPartyBonderAuthorizations; any other error shows as an error rather than an empty list.

Comment thread components/staking/staking.tsx Outdated
const [picked, setPicked] = useState<Recipient | null>(null);
const [picked, setPicked] = useState<Recipient | null>(
action.kind === "transfer" && action.to
? { address: action.to.toLowerCase() }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: the resumed transfer starts from { address } only, so the recipient's ENS name and label are dropped. The ENS re-resolution in run() (if (picked?.ens)) is then skipped, and the vouch text shows the address. Carrying the original Recipient in then would keep it.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 9475c85. then carries the whole Recipient, so the ENS name is re-resolved before signing and the label is kept.

Comment on lines +49 to +55
{bonders && bonders.length === 0 ? (
<p className="text-ui-body text-muted-foreground">
No wallets are authorized now.
</p>
) : (
<ul className="flex flex-col divide-y divide-hairline rounded-lg border border-hairline">
{(bonders ?? []).map((b) => (

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: while loading, or after the query fails, bonders is undefined, so this renders an empty bordered list with no text. A skeleton on isLoading and a message on isError would help.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 9475c85: a skeleton while loading, and a message with "Try again" on error.

</DialogBody>
<DialogFooter>
{finished || proposed ? (
{next && !proposed && (finished || alreadyDone) ? (

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: when an authorization started from a transfer finishes, this replaces the Done button, so the only way out without switching wallets is the close icon. Maybe show Done next to Continue transfer.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 9475c85. Done sits next to Continue transfer.

Comment thread lib/subgraph/authorizations.ts Outdated
query ThirdPartyBonders($id: ID!) {
delegator(id: $id) {
thirdPartyBonders(
first: 100

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: no paging, so past 100 authorizations the oldest silently drop out and can't be revoked here. Unlikely in practice, but paging or a "showing 100" note would make it explicit.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 9475c85. It now pages through all of them.

Comment on lines +1539 to +1542
const unauthorized =
Boolean(receiver) &&
!pendingDelegator &&
isUnauthorizedBonder(simulation.error);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: the simulation only runs once amountWei > 0n, so the unauthorized notice only shows after an amount is typed. A direct isThirdPartyBonderAuthorized(receiver, signer) read would show it as soon as the receiver is picked.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 9475c85, with the simulation instead of a direct read: before an amount is typed it simulates the smallest transfer. A direct read would also warn before enforcement, while transfers still work.

rickstaa
rickstaa previously approved these changes Nov 30, 2026

@rickstaa rickstaa left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. None of this blocks merging, so we can handle it in follow-ups. Details inline.

One general point: a wallet still gives up that round's rewards if it withdraws fees, delegates more, unbonds or moves stake before its orchestrator calls reward. The protocol allows this, but the explorer could warn about it. claimHeld already has the check.

- Reach Manage authorized wallets from the wallet menu and switcher, so a
  wallet with nothing delegated can revoke too
- List authorizations by the granting wallet's address, in full
- Show an unauthorized receiver as soon as it's picked
- Keep the recipient's ENS name and label when a transfer is resumed
- Offer Done beside Continue transfer, and loading and error states in
  the list
- Don't describe an authorization as a guarantee

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@adamsoffer

Copy link
Copy Markdown
Collaborator Author

Thanks for the review. The inline comments are addressed in 9475c85, except the non-pooled claim notice. That one and your general point about warning before reward is called will come in a follow-up.

@adamsoffer
adamsoffer marked this pull request as ready for review November 30, 2026 14:57
Copilot AI balanced review requested due to automatic review settings November 30, 2026 14:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

An already-revoked authorization leaves the removal dialog with a permanently disabled Remove button instead of a Done action, preventing normal dismissal.

1 open issue
What changed in this PR

Updates staking flows for BondingManager’s third-party authorization requirement, allowing receiving wallets to authorize incoming stake transfers and manage existing permissions.

Changes:

  • Adds authorization warnings, receiver-signed authorization, and transfer continuation with preserved inputs.
  • Adds authorized-wallet listing and removal across account, portfolio, and wallet menus.
  • Corrects pool-claim warnings to check the claiming wallet’s own orchestrator.
File Description
lib/​subgraph/​authorizations.ts Fetches all authorized wallets with older-subgraph fallback.
lib/​subgraph/​authorizations.test.ts Tests listing, ordering, and error handling.
lib/​staking/​claim-hold.ts Defines claim-hold checks and warning messages.
lib/​staking/​claim-hold.test.ts Tests claim-hold conditions and messages.
lib/​staking/​authorization.ts Detects unauthorized transfers and formats warnings.
lib/​staking/​authorization.test.ts Tests authorization error detection and messaging.
lib/​hooks/​queries.ts Adds the authorized-wallet query hook.
lib/​abis/​BondingManager.ts Adds authorization methods and event definitions.
components/​staking/​staking.tsx Adds authorization flows and corrects pool-claim warnings.
components/​staking/​authorized-wallets.tsx Adds the authorized-wallet list and removal action.
components/​shell/​wallet-button.tsx Exposes authorization management in the portfolio switcher.
components/​shell/​connected-pill.tsx Exposes authorization management for the connected wallet.
components/​portfolio/​positions.tsx Adds authorization management to position menus.
components/​portfolio/​position-header.tsx Adds authorization management to account actions.

Review effort: Balanced

Comment thread components/staking/staking.tsx Resolved
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Mock-only coverage leaves the asset-moving authorization and transfer flow insufficiently verified; authorization enforcement, revocation, transfer resumption, and pool claims need validation on an upgraded BondingManager fork.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

This branch was successfully deployed

1 active deployment
Preview — 48121c8d Deployed Nov 30, 2026 by vercel[bot]
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.

3 participants