livepeer / livepeer/protocol

Store the hash of the contract names as a constant

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

Nobody has claimed this yet.

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

Description

[The contract getters use the hash of a contract name to fetch the corresponding address from the registry](https://github.com/livepeer/protocol/blob/confluence/contracts/bonding/BondingManager.sol#L1497-L1519). Currently, they calculate the hash of the contract on the spot every time they are called, hence I suggest that we could save a bit of gas by storing the hash of the protocol contracts' names as a constant in a shared contract/embedded library.

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 contract getters in contracts/bonding/BondingManager.sol at lines 1497-1519 and inspect how they hash protocol contract names before registry lookups. Trace the related shared-contract or embedded-library structure before deciding where constants belong. Done means the getters use stored name hashes while continuing to fetch the same corresponding registry addresses, with gas savings verified.

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.