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

  • userOp

    • Constraints: The signature will be validated by the _verifySignature function.

    • Impact: The signature field contains the signature data (keyHash, sigx, sigy, authenticatorData, clientDataJSONPre, clientDataJSONPost) that will be validated.

  • userOpHash

    • Constraints: N/A.

    • Impact: The hash of the user operation to be validated.

Branches and code coverage (including function calls)

Negative behavior

  • The sigx is zero.

  • The sigy is zero.

  • The passKey is not set.

Function call analysis

  • _validateSignature(userOp, userOpHash) -> _verifySignature(userOpHash, userOp.signature) -> Secp256r1.Verify(passKey, sigx, sigy, uint256(sigHash));

    • What is controllable? Both userOp and userOpHash are controllable by the caller of this view function, but in the main smart account use case this data comes from the EntryPoint.sol:handleOps() function, which calculates the userOpHash hash 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 passKey is not set for this smart account or in case of a calculation error.

Zellic © 2024Back to top ↑