livepeer / livepeer/explorer

Report descriptive error message when migrations fail

Open
#472 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

### Describe the bug

During a migration, when a user claims their stake, the pool calls the bonding manager to execute a transferBond. Due to [protocol safeguards](https://github.com/livepeer/protocol/blob/d03671e2e159bbc856feace83371876cf25124e3/contracts/bonding/BondingManager.sol#L695), this call will fail if the orchestrator the user originally staked to on L1 (now represented on L2) has not yet called `reward`. At present, this failure surfaces to users as a generic error, providing no indication of the underlying cause.

### To Reproduce

Currently hard to reproduce without us [launching a testnet](https://forum.livepeer.org/t/pre-proposal-protocol-r-d-special-purpose-entity/3160/6) unless you have an old wallet with unmigrated stake.

### Expected behavior

We should catch the [](https://github.com/livepeer/protocol/blob/d03671e2e159bbc856feace83371876cf25124e3/contracts/bonding/BondingManager.sol#L1729) error and explain this behavoir. "The migration currently failed since your orchestrator has not yet called rewards and doing the claim would cause the pool to lose out of inflation rewards. If the orchestrator stays inactive for to long you could use the [claimEarnings](https://github.com/livepeer/protocol/blob/d03671e2e159bbc856feace83371876cf25124e3/contracts/bonding/BondingManager.sol#L455) yourself on L2 to override this`.

### Screenshots

We should catch the [ILLEGAL_CLAIM_EARNINGS](https://github.com/livepeer/protocol/blob/d03671e2e159bbc856feace83371876cf25124e3/contracts/bonding/BondingManager.sol#L1729) error and surface a clear explanation to the user.

“The migration failed because your orchestrator has not yet called `reward`. Proceeding with the claim now would cause the pool to forgo inflationary rewards. If the orchestrator remains inactive for too long, you may manually call [`[claimEarnings](https://github.com/livepeer/protocol/blob/d03671e2e159bbc856feace83371876cf25124e3/contracts/bonding/BondingManager.sol#L455)`](https://github.com/livepeer/protocol/blob/d03671e2e159bbc856feace83371876cf25124e3/contracts/bonding/BondingManager.sol#L455) on L2 to override this.”

### Desktop OS

_No response_

### Desktop Browser

_No response_

### Desktop Wallet

_No response_

### Desktop App/Extension Version

_No response_

### Smartphone Device

_No response_

### Smartphone OS

_No response_

### Smartphone Browser

_No response_

### Smartphone Wallet

_No response_

### Smartphone App/Extension Version

_No response_

### Additional context

_No response_

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

Trace the migration claim flow and its handling of the BondingManager.sol ILLEGAL_CLAIM_EARNINGS error at the linked contract location. Surface the supplied explanation, including the reward prerequisite and the L2 claimEarnings override, and verify that this message appears when the migration claim fails.

Written by the indexing model from the issue text.

Assessment

Tech stack
solidity, typescript
Domain
blockchain, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.