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

CLI: Disallow self-references for storage layout validations #1064

Closed
ericglau opened this issue Aug 21, 2024 · 3 comments · Fixed by #1067
Closed

CLI: Disallow self-references for storage layout validations #1064

ericglau opened this issue Aug 21, 2024 · 3 comments · Fixed by #1067

Comments

@ericglau
Copy link
Member

ericglau commented Aug 21, 2024

If the CLI is used with --contract MyContract --reference MyContract, or a contract MyContract has annotation @custom:oz-upgrades-from MyContract, this is a self-reference and doing so effectively makes upgrade safety validations pointless.

We should consider this incorrect usage and throw an error in this case.

Note that referencing the same contract name in a different build info file as introduced in #1062 is allowed.

If users do not have a reference contract available in the current project or any previous build info directory, they should use the --unsafeSkipStorageCheck option to skip storage checks.

@ericglau ericglau changed the title CLI: Add flag to disallow self-references for storage layout validations CLI: Disallow self-references for storage layout validations Aug 23, 2024
@frangio
Copy link
Contributor

frangio commented Aug 23, 2024

If users do not have a reference contract available in the current project or any previous build info directory, they should use the --unsafeSkipStorageCheck option to skip storage checks.

Is this also required for the first version one deploys? Asking because that doesn't seem like something that should be labeled unsafe.

@ericglau
Copy link
Member Author

ericglau commented Aug 23, 2024

This does not apply to the first version, it only applies to subsequent versions (and when being called through Foundry Upgrades, it would only apply when preparing or performing an upgrade). The first version should not have and does not require a reference.

@ericglau
Copy link
Member Author

Clarified the above in the error message in this commit.

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 a pull request may close this issue.

2 participants