Skip to content

Detect changes to the AppStorage structure #9

@hiddentao

Description

@hiddentao

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions