livepeer / livepeer/explorer

fix: unbonding countdown labels rounds as days

Open Beginner friendly
#751 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

`components/StakeTransactions/index.tsx:115` counts rounds and labels them days:

```jsx
Tokens will be available for withdrawal in approximately{" "}
{+lock.withdrawRound - roundId} days.
```

A round is not a day. `RoundsManager.roundLength()` currently returns **6377 L1 blocks ≈ 21.3 hours**, so each round shown as a day is about 11% short, and the error compounds across the ~7 rounds of an unbonding period — roughly 7 days displayed against a real ~6.2. Round length is also governance-configurable, so the gap is not fixed.

## Fix

`useCurrentRoundData()` already returns `roundLength`, so the real duration is available client-side without another request:

```
hours = (withdrawRound - currentRound) * roundLength * AVERAGE_L1_BLOCK_TIME / 3600
```

`AVERAGE_L1_BLOCK_TIME` is already used for this kind of conversion in `lib/api/polls.ts` and `lib/api/treasury.ts`.

Simpler alternative if the conversion is not wanted: say **rounds** rather than days, with pluralisation. Accurate, and it matches what the protocol actually measures.

## Note

Raised by Copilot on #748 against a component that has since been removed from that PR, but the same wording is on `main` and predates it.

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 in components/StakeTransactions/index.tsx around line 115 and inspect the useCurrentRoundData() values, especially roundLength. Compare the existing conversion usage in lib/api/polls.ts and lib/api/treasury.ts. Done means the unbonding countdown no longer presents rounds as fixed days, either by reflecting configured round duration or by labeling the remaining rounds accurately with pluralization.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.