Function: validateUserOp(UserOperation userOp, byte[32] userOpHash)
The function is invoked to verify the signature each time a new transaction arrives for the smart account. In the case of a valid signature, the function yields a return value of 0. If the signature is invalid, it produces a return value of SIG_VALIDATION_FAILED.
Inputs
userOpConstraints: The signature will be validated by the
_verifySignaturefunction.Impact: The signature field contains the signature data (
keyHash,sigx,sigy,authenticatorData,clientDataJSONPre,clientDataJSONPost) that will be validated.
userOpHashConstraints: N/A.
Impact: The hash of the user operation to be validated.
Branches and code coverage (including function calls)
Negative behavior
The
sigxis zero.The
sigyis zero.The
passKeyis not set.
Function call analysis
_validateSignature(userOp, userOpHash) -> _verifySignature(userOpHash, userOp.signature) -> Secp256r1.Verify(passKey, sigx, sigy, uint256(sigHash));What is controllable? Both
userOpanduserOpHashare controllable by the caller of this view function, but in the main smart account use case this data comes from theEntryPoint.sol:handleOps()function, which calculates theuserOpHashhash using the user operation data provided by the caller.If return value controllable, how is it used and how can it go wrong? The return value is used by the
EntryPoint.sol:handleOps()function to determine whether this operation is allowed to be executed.What happens if it reverts, reenters, or does other unusual control flow? The function can be reverted in case
passKeyis not set for this smart account or in case of a calculation error.