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.
The ERC-7201 root slot constants emitted by the transpiler (e.g.
ERC20StorageLocation) are declaredprivate. 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.tsto produceinternal constantso 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.