One cartridge fits into a chartreuse test gauge bearing the Solana mark while another sits askew above its slot.
Image by CryptoSlate

Solana’s new memory checks could make some older app transactions fail

A replay of mainnet traffic exposed one way older Anchor code can fail. The checks still await mainnet activation, and a separate change would cut the work validators do to copy data.

Quick Take

  1. Anza’s November 20 tracker lists the memory checks and account data direct mapping as pending on Solana mainnet.
  2. Mainnet replay exposed an Anchor account handoff that could fail, and affected programs need the framework fix deployed on-chain.
  3. Validators get the copy savings when direct mapping goes live, but the effect on users’ transaction times remains unclear.

Solana’s planned memory checks could make some app transactions fail even when the rest of the app keeps working. Developers have already seen one example in replayed mainnet transactions. Older code built with the Anchor framework could try to save an account’s data after handing control of that account to another program.

Anza, which develops Solana’s Agave validator software, resumed general mainnet feature activations on November 19. Its November 20 feature tracker lists the memory checks and a separate change called account data direct mapping as pending, with no mainnet activation epoch or slot for either. Direct mapping is designed to spare validators the work of repeatedly copying program data.

How Solana changes account access

Anza’s November 20 tracker listed both switches as pending on Solana mainnet, with no activation slot for either.

The checks can reject a write to an account the program no longer owns, even while validators still use copied data.

The paths show conditional runtime behavior. Their lengths carry no timing or performance measurement.

Where an Anchor instruction can fail

The memory checks can reject a read that runs past the end of an account or a write to an account the program cannot modify. They also change the stack layout older programs use to hold temporary data. Code that relied on that layout can behave differently after the change. One documented failure involves how Solana programs hand accounts to one another within a transaction.

In the case described in an Anchor patch, one program calls another and transfers ownership of an account during the call. When the first program finishes, older Anchor code tries to write the account data back even when the bytes have stayed the same. The old runtime let that attempt pass. Under Solana’s new rules, the attempt fails because the first program has already given up the right to write to that account.

The patch author says programs that delegated accounts this way hit the error in production replay. A transaction that takes the affected path can fail while an app’s other transactions continue to go through.

The Anchor 1.2.2 changelog includes the fix. It compares the data after ownership changes and skips the write if the bytes match. Teams maintaining affected programs can rebuild and test with the updated framework. For a program deployed through Solana’s upgradeable Loader V3, the party authorized to update the on-chain code must deploy that build. An app team that relies on someone else’s program needs that program’s operator to make the update.

Anza engineer Alexander Meißner wrote in the original runtime proposal that the team replayed mainnet traffic. The proposal says most developers whose apps would have failed in that exercise were contacted and had made fixes. Replay checks the instruction paths that appeared in the sample. A rarely used path can escape that check if the transactions Anza replayed never took it.

Meißner’s January 30 memory rules proposal says developers of the Agave and Firedancer validator clients split the original plan so earlier work could ship even if a later part needed more time. In Agave’s implementation discussion, Meißner described a separate testing problem. Combining the new rules and the copy change made it hard to tell intended changes in execution from mistakes. Giving the two changes separate switches let developers test the new rules with the old copying path still in place.

Related Reading

Solana developers propose major overhaul to address hidden risk that could disrupt its network

When validators stop copying

In the old execution path, the validator copies account data into a program’s virtual machine and takes it back when the program finishes. A call to another program adds another round trip. Meißner’s proposal describes up to four copies for an instruction with a single cross-program call. With direct mapping enabled, the virtual machine can access those account bytes where they already reside.

Anza’s tracker lists the memory checks and the mapping switch one epoch apart on both testnet and devnet. On mainnet, the date to watch for affected apps is the activation of the memory checks. Validators get the copy savings when the mapping switch goes live.

Related Reading

Solana doubles block production speed to 200ms as network prepares for Alpenglow upgrade

Article context

Mentioned in this article

Related Asset Solana #7 SOL $70.54 24-hour change: up 1.81% Loading price history… 24H Up 1.81% 7D Down 2.21% 30D Down 31.38%