Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/solana-foundation/anchor/llms.txt

Use this file to discover all available pages before exploring further.

This guide helps you migrate between major Anchor versions.

Migrating to 0.32.0

IDL upload by default

anchor deploy now uploads IDL automatically:
# To skip IDL upload
anchor deploy --no-idl

solana-verify integration

anchor verify has been replaced:
# Old
anchor verify <PROGRAM_ID>

# New (uses solana-verify)
anchor verify <PROGRAM_ID>  # Works the same, but uses solana-verify under the hood

Program type changes

Generic Program<'info> now validates executable-only:
// Before: required specific program type
pub system_program: Program<'info, System>

// After: can use generic for any program
pub any_program: Program<'info>

Migrating to 0.31.0

Dynamic discriminators

Discriminators are no longer always 8 bytes:
// Use discriminator methods instead of hardcoding
let discriminator = MyAccount::discriminator();

LazyAccount

For large accounts, use LazyAccount to defer deserialization:
// Before
#[account(mut)]
pub large_account: Account<'info, LargeData>

// After (for better performance)
#[account(mut)]
pub large_account: LazyAccount<'info, LargeData>

Migrating to 0.30.0

Token-2022 support

Use interface types for Token-2022 compatibility:
// Before
use anchor_spl::token::{TokenAccount, Token};

#[account(mut)]
pub token_account: Account<'info, TokenAccount>
pub token_program: Program<'info, Token>

// After
use anchor_spl::token_interface::{TokenAccount, TokenInterface};

#[account(mut)]
pub token_account: InterfaceAccount<'info, TokenAccount>
pub token_program: Interface<'info, TokenInterface>

Migrating from 0.29.0

Solana 1.18+ compatibility

Update your Anchor.toml:
[toolchain]
solana_version = "1.18.0"

Account resolution

Use IDL-based account resolution:
// Automatic account resolution from IDL
await program.methods
  .myInstruction()
  .accounts({
    // Only required accounts need to be specified
    user: user.publicKey,
  })
  .rpc();

General upgrade process

  1. Update Anchor CLI:
    avm install latest
    avm use latest
    
  2. Update dependencies in Cargo.toml:
    [dependencies]
    anchor-lang = "0.32.0"
    anchor-spl = "0.32.0"
    
  3. Update Anchor.toml if needed
  4. Run tests:
    anchor test
    
  5. Fix any breaking changes based on compiler errors

Version compatibility

AnchorSolanaRust
0.32.x2.0+1.75+
0.31.x1.18+1.75+
0.30.x1.17+1.70+
0.29.x1.16+1.70+

Need help?

Changelog

Review detailed changes

Discord

Ask the community