OpenZeppelin / OpenZeppelin/openzeppelin-contracts
Better modularization of StorageSlot.sol::getAddressFromSlot()
Nobody has claimed this yet.
- Dominant language
- Solidity
- Stars
- 27.2k
- Forks
- 12.4k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 33
Description
getAddressFromSlot() is both used to set addresses into precalculated storage slots (returning a reference of the AddressSlot struct), and to get addresses stored into that slot. I guess it would be better to separate the setter from the getter, which I've already done in the code below. There's no need to reassign the storage slot of the struct everytime we need to read the value.
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 in StorageSlot.sol at getAddressFromSlot() and inspect its two current call patterns: setting and reading precalculated slots. Compare the separation proposed in the issue's attached example, then run the relevant existing contract tests to confirm both behaviors remain intact and address reads no longer reassign the storage slot.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- solidity
- Domain
- blockchain
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100