Skip to content

Querying non-existent ATA accounts is very slow #127

@mocco-hub

Description

@mocco-hub

Your issue will be reviewed by a maintainer and labeled for further action.
To complete your request, follow the bot-actions to report this on the support E-mail box and follow the outlined steps. Alternatively, you can report this issue on the official web page to an agent for assistance.
@IAliceBobI


                     Issue Description 

Issue Description

When querying the balance of an ATA (Associated Token Account) that does not exist, the response is very slow.

Reproduction Steps

  1. Use a new wallet address that has never held USDC
  2. Query the USDC ATA balance for this address
  3. Observe significant delay before response

Example Scenario

// Example code (pseudo-code)
const usdcMint = new PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"); // USDC mint
const wallet = new Wallet("new-wallet-address-without-usdc-ata");

// This query is slow when ATA doesn't exist
const balance = await connection.getTokenAccountBalance(
getAssociatedTokenAddressSync(usdcMint, wallet.publicKey)
);

Expected Behavior

  • Should return quickly with a "account not found" error or null balance
  • Similar to how mainnet-beta handles non-existent accounts

Actual Behavior

  • Significant delay (can take several seconds)
  • Makes balance checking for new wallets very slow

Environment

  • Surfpool version: [Please fill in]
  • OS: [Please fill in]

Additional Context

This affects:

  • Balance checking for new users
  • Batch balance queries where some accounts don't exist
  • Token portfolio displays for new wallets

The issue is particularly noticeable when:

  • Querying multiple token balances for a new wallet
  • Building portfolio displays where most ATAs don't exist yet

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingduplicateThis issue or pull request already existsgood first issueGood for newcomersquestionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions