-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Description
Abstract
Implement evaluation of keccak256() in comptime context.
While this is technically implementable without prerequisites, it won't be usable in practice without implementing at least stage 1 of #16420.
contract C layout at uint(keccak256("my.contract.id")) {}Motivation
The goal is to allow the use of keccak256() builtin in layout at specifiers.
There are two layout base expressions in common use: erc7201 and plain hashing of a string using keccak256(). We're adding a builtin for the former in #15968, but for completeness we should also support the latter.
The main hurdle here is the return type. keccak256() returns bytes32 while the layout base expressions must be integers. We also do not support type conversions in compile-time context so constant expressions of that type cannot be simply converted.
Backwards Compatibility
Fully backwards-compatible.