Repository navigation
fix: ignore already-deployed oz-renamed-from in storage layout check - #725
Merged
Merged
Conversation
GitGuru7
marked this pull request as ready for review
October 28, 2026 08:13
[Medium impact] The change affects the upgrade-safety pull-request workflow for deployed implementations. The PR appears safe to merge, with a non-blocking request for regression tests. Findings
SummaryCopies
Reviews (1) · Last reviewed commit: "fix: ignore already-deployed oz-renamed-..." · Reviewed by Greptile |
|
fred-venus
approved these changes
Oct 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stop the storage layout check from failing on renames that are already deployed
Once a contract with
@custom:oz-renamed-fromis deployed,check:storage-layoutwould fail every later PR, and the only workaround would be deleting the annotation by hand after each deployment. Nothing in this repo uses the annotation yet, so CI isn't failing today. This fixes it before the first annotated rename is deployed.Scripts
checkStorageLayout.ts — before comparing, copies each current variable's
renamedFromonto the deployed variable with the same slot, offset and label.Why
The deployed layout comes from hardhat-deploy artifacts, which don't record OZ annotations. OZ reports a rename whenever the current and deployed annotations differ, even when the name is unchanged. So after a rename ships, the check sees the annotation again and fails, for example with "Renamed
xtox". OZ's own.openzeppelinmanifest keeps the annotation, so this restores what that manifest would hold.A genuine rename is still caught. The annotation is only copied where the name is unchanged, and a real rename changes the name. Slot and offset are matched too, because names like
__gaprepeat across inherited contracts.unsafeAllowRenameswas ruled out because it would also hide one variable being swapped for another of the same type.