Replace require functions with custom errors

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

Nobody has claimed this yet.

Assessment

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

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.

Description

enhancement

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.

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

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.

More from livepeer/protocol

All issues in livepeer/protocol

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.