livepeer / livepeer/protocol

Replace require functions with custom errors

Open
#565 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
JavaScript
Stars
155
Forks
50
PR merge metrics
No merged PRs in 30d

Description

Context
The protocol code-base is currently using require paired with fairly lengthy error strings, which end up being quite expensive from a gas perspective.

Proposal
Solidity has introduced custom errors since v0.8.4, which provide a cheaper alternative to throw exceptions. We can consider using them as a replacement to the current require checks.

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 the require check and error string shown in contracts/Manager.sol, then inspect the surrounding protocol contracts for similar checks. Review Solidity custom errors introduced in v0.8.4 and identify applicable replacements; done means preserving the existing failure behavior while reducing the gas cost of error handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
solidity
Domain
blockchain
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.