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

Detect changes to the AppStorage structure #9

Open
hiddentao opened this issue Aug 30, 2023 · 0 comments
Open

Detect changes to the AppStorage structure #9

hiddentao opened this issue Aug 30, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@hiddentao
Copy link
Contributor

Detecting changes to the AppStorage structure would be great as a way of guarding against diamond corruption.

See https://eip2535diamonds.substack.com/p/example-of-a-diamond-upgrade for more info.

Specifically:

  • All new storage members must be appended to the existing App storage struct.

Gemforge can optionally support checking for adherence to these rules. The proposal:

  • New diamond.storage config key which points to:
{ 
   type: "AppStorage",  
   config: {
      file: "PathToFileContainingAppStorageStruct.sol" 
      struct: "NameOfAppStorageStruct" 
   }
}
  • Gemforge will complain if existing items are changed (even by name)
  • Gemforge will complain if the struct/file cannot be found.
  • All checks will be done during the build, when GemForge parses the code.
@hiddentao hiddentao added the enhancement New feature or request label Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant