OpenZeppelin / OpenZeppelin/openzeppelin-upgrades
Support rename/retype of variables within struct
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 658
- Forks
- 286
- PR merge metrics
- No merged PRs in 30d
Description
@custom:oz-retyped-from and @custom:oz-renamed-from inside a struct are not recognized because Solidity does not expose the NatSpec of struct members.
A workaround is to specify @custom:oz-retyped-from <V1 contract name>.<V1 struct name> on the variable that uses the struct in the V2 contract. See this forum post for an example.
However, retype of a struct causes storage layout comparison to be skipped inside the struct itself, so users should manually ensure that they are compatible.
When Solidity exposes NatSpec of struct members, or if we can check the NatSpec in a different way, then:
- Include the inner type of the struct for layout comparison
- Support rename/retype annotations for variables within the struct
Note: Also consider structs used in mappings e.g. mapping(uint256 => S) store_mapping;
Related: https://github.com/OpenZeppelin/openzeppelin-upgrades/issues/459
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
No source files or tests are named. Start by investigating the existing struct storage-layout comparison and custom annotation handling, then determine whether Solidity exposes member NatSpec or whether another inspection path is possible. Cover structs used directly and in mappings, and verify inner-type comparison plus rename/retype annotations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- solidity, typescript
- Domain
- blockchain, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100