Skip to content

Querying non-existent ATA accounts is very slow #522

@IAliceBobI

Description

@IAliceBobI

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions