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

Codebase: Upgradeable Contracts: Unify/Fix Storage Location #423

Open
matthiaszimmermann opened this issue Jun 24, 2024 · 2 comments
Open
Assignees

Comments

@matthiaszimmermann
Copy link
Contributor

matthiaszimmermann commented Jun 24, 2024

in upgradeable contracts storage is mostly handled by structs per upgradeable contract.
storage location of these is fixed using a hash stored in a constant *_STORAGE_LOCATION.
currently, the calculation of these storage location is inconsistent as the underlying naming pattern has not yet been properly defined.

step 1: define naming pattern
step 2: calculated resulting storage locations for all contracts
step 3: fix contracts to use above storage locations in a way that storage locations can be pulled throug a simple grep from all contracts (to support simple checks that there are not collisions)

example:
keccak256(abi.encode(uint256(keccak256("gif-next.contracts.component.Component.sol")) - 1)) & ~bytes32(uint256(0xff));

what is needed: how to create simple and unique name strings (simpler and more generic than "gif-next.contracts.component.Component.sol", eg "etherisc.gif.Component")

@matthiaszimmermann matthiaszimmermann added this to the GIF v3 Audit Ready milestone Jun 24, 2024
@matthiaszimmermann matthiaszimmermann changed the title Upgradeable Contracts: Unify/Fix Storage Location Codebase: Upgradeable Contracts: Unify/Fix Storage Location Jun 25, 2024
@rapidddenis
Copy link
Collaborator

rapidddenis commented Aug 29, 2024

Name string must contain version (major, minor, patch) of a contract. Major version is release version
"[email protected]" or "[email protected]"
etherisc.gif.@<release.major.minor>

@rapidddenis
Copy link
Collaborator

rapidddenis commented Aug 29, 2024

storage address variable format is: <contract-name-uppercase>_STORAGE_LOCATION_V<release>_<storage-version>

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

No branches or pull requests

3 participants