In my previous post on Manifest, I looked at two places where a client's description of a trade could disagree with execution: the accounts collected for a transaction and the quantities returned by a quote. Both bugs also affected ordinary SPL Token integrations.
My work on LiteSVM, Surfpool, and Jupiter AMM Interface gave me more direct examples involving Token-2022. A helper could allocate too little account space. A locally generated account could show a balance while missing the state needed for a transfer. A swap test could check one mode while leaving another untested.
These were separate contributions, but they changed how I review token support. I now follow the mint's requirements through account creation, initialization, and the balance changes produced by a transaction.
The mint determines what an account needs
Token-2022 is Solana's token program with optional extensions. The mint account describes the token and its enabled features. A token account holds an owner's balance of that mint. Some mint extensions require additional state on each token account. For example, TransferFeeConfig on the mint requires TransferFeeAmount on its token accounts to record withheld fees. Solana transfer fee documentation
That creates two distinct jobs when making an account: allocate enough space, then initialize the required state. A tool that writes account bytes directly also has to preserve the behavior those bytes represent.
A conceptual review sequence illustrated by separate contributions to LiteSVM, Surfpool, and Jupiter AMM Interface.
LiteSVM needed to derive account size from the mint
LiteSVM runs Solana programs locally. Its litesvm-token crate provides helpers for setting up tokens in tests.
The CreateAccount helper calculated the Token-2022 account length from a private extension list that was always empty. That produced the base account size even when the mint required more space. Initialization could then fail for an extended mint.
My fix reads the mint data and uses the SPL interface helper before calculating rent:
let account_len =
try_calculate_account_len_from_mint_data(&mint.data, &[])?;
The mint now supplies the required account extensions. The explicit classic Token Program path keeps its base account size.
The regressions cover mints with TransferFeeConfig, TransferHook, and NonTransferable, plus an explicit classic-token control. They also exercise minting and a checked fee transfer. The extended-mint regression fails on the base revision and passes with the fix. LiteSVM PR #442
The important change was where the helper got its requirements. A local empty list could not describe the account a particular mint needed.
Surfpool needed to initialize the account state
Surfpool's surfnet_setTokenAccount cheatcode can prepare local token balances. When the requested associated token account, or ATA, was missing, its Token-2022 path wrote only the base account data.
That made a balance read a weak test. The generated account could contain the requested amount while lacking the extension state that Token-2022 checks during a real transfer instruction.
My proposed fix initializes the mint's required account extensions and ImmutableOwner, applies the mint's default account state, and calculates rent from the resulting data length. Existing amount updates preserve extension bytes. Surfpool PR #868
The regression uses a zero-decimal mint configured with a 1% transfer fee. It creates both ATAs through the cheatcode, then submits a signed transfer of 100 atoms to the local runtime. The resulting state is:
| Check | Result after the transfer |
|---|---|
| Source spendable balance | 500 → 400 atoms |
| Destination spendable balance | 0 → 99 atoms |
| Destination withheld fee | 0 → 1 atom |
This turns the payment example from the previous article into an execution check: the account must hold the extension state needed to record that withheld atom.
Two other rules matter here. Normal Token-2022 ATAs initialize ImmutableOwner, which prevents later changes to their owner authority. A mint's DefaultAccountState can also require new accounts to start frozen. Immutable Owner, Default Account State
The proposed regression checks assert the exact ImmutableOwner error when changing the owner and verify the frozen default. They test account behavior as well as balances. Surfpool changes and tests
Jupiter needed to test the requested swap mode
Valid accounts make execution possible. The next question is whether that execution agrees with the quote.
Jupiter AMM Interface's test-kit checked native swaps using ExactIn: fix the input and check the output. It hardcoded that mode through quoting, account discovery, and execution. ExactOut fixes the desired output instead and asks how much input is needed.
My PR adds native ExactOut checks and passes the same mode and amounts through those steps. It checks both sides of the trade:
requested output = quote.out_amount = destination balance increase
quote.in_amount = source balance decrease
The source account receives exactly the quoted input budget. An underquote cannot rely on a padded balance, while the input-debit comparison detects an overquote. Jupiter AMM Interface PR #44
The Raydium CPMM fixtures include Token-2022 transfer fees on the input and output sides, below and at the fee cap. Tests deliberately ignoring those fees must fail. The snapshots come from mainnet; swaps execute locally in LiteSVM. Transfer hooks and fee epoch transitions remain outside this fixture suite. Fee and ExactOut regression tests
This contribution expands the test-kit's checks for AMM adapters. It gives a fee-aware quote a concrete comparison: the amounts actually spent and received.
What has merged
As of October 24, 2026, the three contributions are at different stages:
| Contribution | Status |
|---|---|
| LiteSVM #442, account sizing from mint data | Merged October 20, 2026, UTC |
| Surfpool #868, generated ATA initialization | Open |
| Jupiter AMM Interface #44, native ExactOut verification | Open |
The Surfpool change covers the standard generated ATA path. Its separate confidential account-rebuilding path remains outside the fix. Surfpool scope
How this changes my tests
These contributions gave me more specific questions to ask when reviewing a token integration:
- Does account creation derive its space from the actual mint data?
- Does the initialized account preserve the mint's required extensions and default state?
- Can the prepared account execute the transfer being tested?
- Does the requested swap mode reach the instruction, and do its balance changes match the quote?
Manifest exposed a mismatch between client assumptions and execution. Working on account helpers and swap tests made that boundary easier for me to inspect. A useful regression now follows the assumption far enough to observe the behavior it is supposed to guarantee.
Thanks for reading. Keep following your curiosity.