Storage layout verification on complex projects

Hello there,

This is probably more of a feature request.

I'm working on a fairly complex repo, and it's time to check storage layout compatibility to upgrade some contracts. We are using the cli version of the upgrades library.

We are using git tags to keep track of the versions, but for the layout check to happen I would have to maintain an old folder with past contract versions, and make old and new contracts build together so the script can compare.

This ends up being a lot of work. Is there a way to do something like comparing storage layouts between contracts from 2 projects? As in, I have a folder built with the old version tag, and from the current build I point to the old contract path to compare. Or a way we can just store old build-info folders for the script to compare?

Is there another way to do this that I'm missing?

Thanks a lot!

1 Like

Hi @ethicraul, thanks for bringing this up.

Aside from checking for storage layout compatibility, do you have a need to test actual upgradeability of your contracts and to test/simulate their functionality post-upgrade? If so, is there a particular reason why you would not keep old versions available to perform such testing?

Regarding your request, isn't supported at the moment -- the storage layout validations, particularly with the reference parameter in the CLI and/or @custom:oz-upgrades-from annotations, make use of fully qualified contract names, but these names could be the same between the old and new version tags in your scenario.

We could possibly consider supporting multiple build-info dirs where different dirs represent different versions of the repo (e.g. so you would pass in both the old and new build-info dirs), and allow the reference parameter or annotation to specify the specific build-info dir as a further qualifier. Does this sound like it would do what you need?

1 Like

Got it.

This would be extremely helpful. How can I track the state of this feature?
Thanks!

1 Like

I've opened https://github.com/OpenZeppelin/openzeppelin-upgrades/issues/1034, feel free to subscribe and/or continue the discussion in that issue.