Implementing a Key Data Consumer
CODEHASH
, which the KV will enforce matches the specified CODEHASH
in the data
from the keystore (see the KV’s expected data format here).
keyData
is the verified key dataauthData
is the authentication data to be validateduserOpHash
is the hash of the user operationkeyData
would encode the threshold m
and a list of n
valid signersauthData
would be a list of m
signatures authenticating a transactionuserOpHash
would be the digest signed by the signaturesCODEHASH
to identify a piece of EVM execution allows for a (data, vkey)
pair to signal its desired on-chain validation logic. This allows deployments of the same key data consumer across different rollups to be identifiable without reference to a permissioned registry.
There are some considerations to keep in mind when using CODEHASH
to identify a piece of EVM execution. For example, consider a contract whose execution reads from a storage slot which can later be updated. In this case, the EVM bytecode committed to by CODEHASH
can behave differently depending on the storage value, which is not committed to by CODEHASH
.
The developer of the key data consumer must therefore ensure that the CODEHASH
upholds its intended semantic value. We strongly encourage developers to follow the guidelines below.
consumeKeyData()
function should not read from storage slots which can later be updated (ideally, from no storage at all).codesize != 0
.returndata
, check that returndatasize() != 0
.CODEHASH
.
While it cannot be enforced in EVM, the consumeKeyData()
function should be a pure function. If new functionality is required, it can be achieved by deploying a new key data consumer and initiating a corresponding update on the keystore. This approach ensures that each EVM validation of a keystore authentication is bound to a unique CODEHASH
and thus committed to in the keystore data.