Support rename / retype inside structs#722
Conversation
|
Don't we need retyping in addition to renaming? To convert the Timer struct into an integer type. |
|
@Amxx I changed one of the test cases you had written. There is already a built-in way to make that work, by using "retyped" on the state variable. I also added another test case which we need for the Governor changes if we want to replace the timer structs with integers. This change also can be accepted by the plugin with the same annotation as the other case. However, that got me thinking that I'm not sure it's an actually acceptable change because I'm not sure about the alignment of the |
|
Ok I see what's happening. If there is a retype annotation we explicitly skip the type comparison where the inside of the struct would get compared. We definitely make sure that there are no "outer layout changes", so e.g. subsequent variables can't move from where they are with a retype, but the inside of the struct may have its layout changed. @ericglau Should we also consider checking for "inner layout changes" when the retype refers to a struct? openzeppelin-upgrades/packages/core/src/storage/compare.ts Lines 171 to 173 in 1bca9c3 |
This PR includes an example of rename that we need to support (possibly with a different natspec comment)