2️⃣Account Interface

The core interface of the Account contract is as follows:

interface IAccount {
  function validateUserOp
      (UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)
      external returns (uint256 validationData);
}

Understanding the UserOpHash and Account Actions

UserOpHash

  • This is a unique code or identifier.

  • It's created by combining and hashing (turning into a fixed-size code) the details of the user operation (excluding its signature), the EntryPoint's address, and the specific ChainID

The Account's Responsibilities

Validation:

  • The account must first ensure that the incoming request is from a trusted EntryPoint.

  • If the account doesn't use signature aggregation (a method to combine multiple signatures), it must verify that the provided signature matches the UserOpHash. If it doesn't match, it should give a response, "SIG_VALIDATION_FAILED", without causing the operation to crash. Any other errors should cause the operation to stop entirely (revert).

Payments:

  • The account has to pay the EntryPoint a certain amount, known as "missingAccountFunds". This could be zero if the account has enough deposit already.

  • Optionally, the account can choose to pay more than what's required. This can act as a buffer for future transactions. If needed, the account can later retrieve this excess amount using the withdrawTo action.

Response Format:

  • When responding, the account must provide details in a specific format:

    • authorizer: A value indicating the status of the signature. '0' means the signature is good, '1' indicates a failed signature. If any other value, it's the address of a specialized contract called the "authorizer". For this system, the "signature aggregator" is considered the authorizer.

    • validUntil: This is a timestamp (in 6-byte format) specifying when the UserOp will expire. If it's '0', it means the UserOp doesn't expire.

    • validAfter: Another timestamp (in 6-byte format) indicating when the UserOp becomes valid. It's like a start time.

  • Special Note on Aggregated Signatures:

    • If an account uses aggregated signatures (combining multiple signatures), it should provide the address of its signature aggregator when responding to a validateUserOp request.

    • It can choose to ignore the signature field.

In simpler terms, when an account receives a user operation, it performs various checks and actions to ensure everything is in order. It validates the operation, makes necessary payments, and provides a specific response format to indicate the status of the operation. The system also has provisions for accounts that work with aggregated signatures, giving them a bit of flexibility in how they handle such operations.

Last updated