Skip to content

fix: ignore already-deployed oz-renamed-from in storage layout check - #725

Merged
GitGuru7 merged 1 commit into
developfrom
fix/storage-layout-deployed-renames
Oct 28, 2026
Merged

GitGuru7 merged 1 commit into
developfrom
fix/storage-layout-deployed-renames

Conversation

@GitGuru7

Copy link
Copy Markdown
Contributor

Summary

Stop the storage layout check from failing on renames that are already deployed

Once a contract with @custom:oz-renamed-from is deployed, check:storage-layout would 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 renamedFrom onto 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 x to x". OZ's own .openzeppelin manifest 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 __gap repeat across inherited contracts. unsafeAllowRenames was ruled out because it would also hide one variable being swapped for another of the same type.

@GitGuru7
GitGuru7 marked this pull request as ready for review October 28, 2026 08:13
@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[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

  1. P2 Rename exception lacks tests ▶

Summary

Copies renamedFrom into deployed storage entries when their slot, offset, and label match the current layout.

  • The storage check keeps already-shipped rename annotations from triggering repeat failures.

Reviews (1) · Last reviewed commit: "fix: ignore already-deployed oz-renamed-..." · Reviewed by Greptile

Comment thread scripts/checkStorageLayout.ts
@github-actions

Copy link
Copy Markdown

Code Coverage

Package Line Rate Branch Rate Health
contracts 100% 100% ✔
contracts.Admin 88% 41% ✔
contracts.BStock 100% 97% ✔
contracts.Comptroller 100% 90% ✔
contracts.Comptroller.Diamond 95% 66% ✔
contracts.Comptroller.Diamond.facets 88% 74% ✔
contracts.Comptroller.Diamond.interfaces 100% 100% ✔
contracts.Comptroller.Types 100% 100% ✔
contracts.Comptroller.legacy 100% 100% ✔
contracts.Comptroller.legacy.Diamond 0% 0% ❌
contracts.Comptroller.legacy.Diamond.facets 0% 0% ❌
contracts.Comptroller.legacy.Diamond.interfaces 100% 100% ✔
contracts.DelegateBorrowers 100% 89% ✔
contracts.FlashLoan.interfaces 100% 100% ✔
contracts.Governance 68% 45% ➖
contracts.InterestRateModels 74% 59% ➖
contracts.Lens 44% 47% ❌
contracts.Liquidator 83% 60% ✔
contracts.Oracle 100% 100% ✔
contracts.PegStability 88% 84% ✔
contracts.Swap 90% 58% ✔
contracts.Swap.interfaces 100% 100% ✔
contracts.Swap.lib 81% 53% ✔
contracts.Tokens 100% 100% ✔
contracts.Tokens.Prime 97% 82% ✔
contracts.Tokens.Prime.Interfaces 100% 100% ✔
contracts.Tokens.Prime.libs 90% 77% ✔
contracts.Tokens.VAI 82% 52% ✔
contracts.Tokens.VRT 20% 9% ❌
contracts.Tokens.VTokens 71% 53% ➖
contracts.Tokens.VTokens.legacy 0% 0% ❌
contracts.Tokens.VTokens.legacy.Utils 0% 0% ❌
contracts.Tokens.XVS 19% 8% ❌
contracts.Tokens.test 100% 100% ✔
contracts.Utils 52% 31% ➖
contracts.VAIVault 50% 45% ➖
contracts.VRTVault 49% 36% ❌
contracts.XVSVault 63% 50% ➖
contracts.external 100% 100% ✔
contracts.lib 89% 71% ✔
Summary 62% (4559 / 7351) 49% (1784 / 3676) ➖

@GitGuru7
GitGuru7 merged commit 9f125e1 into develop Oct 28, 2026
7 checks passed
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

Successfully merging this pull request may close these issues.

2 participants