Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support rename/retype of variables within struct #802

Open
2 tasks
ericglau opened this issue May 19, 2023 · 1 comment
Open
2 tasks

Support rename/retype of variables within struct #802

ericglau opened this issue May 19, 2023 · 1 comment

Comments

@ericglau
Copy link
Member

ericglau commented May 19, 2023

@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: #459

@0xmichalis
Copy link
Contributor

Related Solidity issue: ethereum/solidity#12295

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants