Skip to content

Emit namespace storage root constant as internal instead of private #192

@thedavidmeister

Description

@thedavidmeister

The ERC-7201 root slot constants emitted by the transpiler (e.g. ERC20StorageLocation) are declared private. External libraries that read/write the namespaced storage directly can't reference them and have to redeclare the keccak256 derivation locally.

Change the emit template in src/transformations/add-namespace-struct.ts to produce internal constant so consumers can import the constant directly from the transpiled module.

This does not commit to struct layout stability — only the root slot. Consumers who care about the struct layout already take on that coupling themselves. The root constant, being derived from a public namespace string, isn't private information anyway.

PR: #191. Original filing on the upgradeable repo: OpenZeppelin/openzeppelin-contracts-upgradeable#231.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions