livepeer / livepeer/explorer

fix: warn the user when undelegating is blocked by a pending delegator

Open
#740 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
11
Forks
26
Avg merge
11h 58m
Merged PRs (30d)
16

Description

Switching delegate sets `startRound` to `currentRound + 1`, making the delegator **Pending** for the rest of the round. `BondingManager` rejects `unbond` in that state, so the simulation reverts and `Undelegate.tsx:86` disables the button — correctly, but with no explanation.

`renderUnstakeWarnings` in `Footer.tsx` already has the right message:

> Your account is in a pending state. You can undelegate during the next round.

It never renders because `getDelegatorStatus` (`lib/utils.tsx:30-57`) compares **subgraph** values. After a switch the new `startRound` is not yet indexed, so it returns `Bonded` while the chain says `Pending`.

Observed: on-chain `startRound` 4276 against `currentRound` 4275 — genuinely pending, no notice shown.

## Reproduction

1. Delegate to orchestrator A.
2. Move Delegated Stake to orchestrator B.
3. Same round, Undelegate tab, enter an amount below your stake.
4. Button is disabled with no reason. Clears when the next round starts.

## Fix

Read `BondingManager.delegatorStatus(address)` on-chain so the pending warning shows. Sourcing only `currentRound` on-chain is not enough — the stale value is `startRound`, so both operands must come from the chain.

Related: livepeer/explorer#739.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with `lib/utils.tsx:30-57`, `Footer.tsx` and `Undelegate.tsx:86`, then trace how `BondingManager.delegatorStatus(address)` is read. Reproduce the same-round undelegation scenario and verify that the pending warning renders when the on-chain status differs from stale subgraph values.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
blockchain, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.