Store the hash of the contract names as a constant
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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