Skip to content

Modular Account V2 isAccountDeployed function returns false positives #1940

@alecananian

Description

@alecananian

[REQUIRED] Environment

  • Browser version: N/A
  • AA SDK version: v4.58.0
  • Package: @account-kit/smart-contracts

[REQUIRED] Describe the problem

The isAccountDeployed function here just checks for the existence of any bytecode on an address to confirm that Modular Account V2 has been deployed. Instead, it should compare the result of getCode to the known bytecode of a Modular Account V2. Otherwise, if an address has been delegated to any contract, this will return true.

How to reproduce:

I am not using the SDK directly, but calling the API, which I assume is using this SDK code because the error I receive is consistent with the SDK's logic.

Expected:

  • Accounts not already delegated to Modular Account V2 receive an authorization to sign

Actual:

  • Error code -32000 received

Example request

https://api.g.alchemy.com/v2/<apiKey>

{
  "jsonrpc": "2.0",
  "method": "wallet_prepareCalls",
  "params": [
      {
        "calls": [
          {
            "to": "0x036cbd53842c5426634e7929541ec2318f3dcf7e",
            "data": "0x"
          }
        ],
        "from": "0x4233422fdaEEF2B4BdCA2080bCBBf39470039406",
        "chainId": "0x14a34",
        "capabilities": {
            "eip7702Auth": true
        }
      }
  ],
  "id": 1
}

Example response

{
    "jsonrpc": "2.0",
    "id": 1,
    "error": {
        "code": -32000,
        "message": "The contract function \"getValidationData\" reverted."
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions