Skip to content

Move the Anchor v2 examples to Anchor 2.0.0-rc.2 and v1 transactions - #204

Merged
mikemaccana merged 3 commits into
mainfrom
claude/compassionate-archimedes-tx2eug
Oct 30, 2026
Merged

mikemaccana merged 3 commits into
mainfrom
claude/compassionate-archimedes-tx2eug

Conversation

@mikemaccana

Copy link
Copy Markdown
Collaborator

Summary

Moves the Anchor v2 examples to Anchor 2.0.0-rc.2 and solana-kite 0.7.0, so their tests send v1 transactions as the Anchor v1 tests already do. Adds an Anchor v2 copy of the transaction v1 example.

Why it is bigger than a version bump

  • The whole root workspace moves to LiteSVM 0.18. rc.2 needs solana-instruction 3.5, and LiteSVM 0.13.1 pins =3.2.0, so the root workspace can't hold both. Every root workspace crate (native, Pinocchio, ASM and Anchor v2) moves to LiteSVM 0.18.1, as does the standalone cross-program-invocation/native workspace. The test-side solana-transaction, solana-message, solana-account and solana-pubkey crates move to their 4.x lines. escrow/native keeps its own lockfile and was updated within it.
  • Agave 4.4.0 (released 2026-10-28) breaks LiteSVM 0.18.1 on a fresh resolve. LiteSVM 0.18.1 declares its Agave dependencies as ^4.3, which allows 4.4.0, but its code doesn't compile against 4.4.0. The Anchor v2 projects commit no lockfile, so every CI build resolves fresh. Every crate that pulls in LiteSVM 0.18.1 without a lockfile now constrains solana-program-runtime and solana-fee to ~4.3. Agave pins its own crates to each other exactly, so the rest follow. Each pin carries a comment saying to remove it once a LiteSVM release builds against Agave 4.4.

Changes

  • anchor-lang and anchor-spl 2.0.0-rc.1 → 2.0.0-rc.2, wincode 0.5 → 0.6, and anchor-v2-testing rev 3e38a121 → a2066021, the commit the v2.0.0-rc.2 tag points at.
  • solana-kite 0.4.0 → 0.7.0. Kite's senders and helpers take a new last argument, compute_unit_limit. All 574 calls pass None, which tells kite to set the limit from a simulation.
  • anchor-v2-testing no longer exports LiteSVM from its root, so the tests import anchor_v2_testing::litesvm::LiteSVM.
  • hello-solana, options and order-book build their own transactions with kite's build_transaction_from_instructions, as their Anchor v1 copies do, so they send v1 too.
  • New basics/transaction-v1/anchor: the Anchor v2 port of the transaction v1 example.
  • Removed version pins that were no longer needed:
    • solana-address = ">=2.6, <2.7" in the Anchor v2 crates. rc.2 and solana-address 2.7 are both on wincode 0.6. The three compression crates keep solana-address for its borsh feature.
    • mpl-token-metadata = "=5.1.2-alpha.2" → "5.1.2-alpha.2". A range starting at the pre-release still matches anchor-spl's exact pin.
    • quasar-svm = "=0.1.0" → "0.1.0", since quasar-test already pins it exactly.
  • Pins still in place, and why:
    • zeropod = "=0.3.3" and solana-address = ">=2.2, <2.6" in the Quasar crates: both are tied to Quasar rev be60fca, which this PR doesn't change.
    • block-list/pinocchio and shank-and-codama/native stay on LiteSVM 0.13.1. Each is its own workspace, and its comments pin the test stack to the generation of its generated client.
  • finance/managed-fund/anchor/app/src/idl/managed_fund.json is regenerated with rc.2. rc.2 drops the pda entry for accounts with an explicit bump or an associated token, and the address of swap_router_program; the latter looks like the bug that anchor-next later fixed in Fix/v2 idl address aliases otter-sec/anchor#5075. The app passes every account explicitly with accountsStrict, and pnpm verify and pnpm typecheck pass. lever.json regenerates unchanged.
  • The Anchor v2 workflow installs anchor-cli 2.0.0-rc.2 and drops the fix(lang-v2): emit enum variants in IDL otter-sec/anchor#4947 IDL workaround, which rc.2 fixes.
  • The READMEs, CONTRIBUTING.md, docs/anchor-v2-migration.md and CHANGELOG.md are updated to match.

Testing

  • Root workspace: cargo check --workspace --tests, cargo fmt --check, and cargo clippy -- -D warnings -A clippy::diverging_sub_expression (the rust.yml command) all pass.
  • Every Anchor v2 project and cross-program-invocation/native, each as its own workspace with a fresh resolve (the way anchor build resolves in CI): cargo check --tests passes for all 58, each resolving solana-program-runtime 4.3.2.
  • Not run: the SBF builds and the test suites themselves. This session's network policy blocks release.anza.xyz, so cargo-build-sbf couldn't be installed, and the type checks above ran against empty placeholder .so files. The Anchor v2, Native, Pinocchio and ASM workflows on this PR are the first real build-and-test run.

Generated by Claude Code

Anchor 2.0.0-rc.2's test harness runs on LiteSVM 0.18, which executes v1
transactions, and solana-kite 0.7.0 is built on the same LiteSVM line, so the
Anchor v2 tests now send v1 transactions as the Anchor v1 tests already do.

rc.2 needs solana-instruction 3.5, and LiteSVM 0.13.1 pins it to =3.2.0, so
the root workspace cannot hold both. Every root workspace crate, and the
standalone cross-program-invocation/native and escrow/native workspaces, move
to LiteSVM 0.18.1 and the 4.x solana-transaction, solana-message,
solana-account and solana-pubkey lines it uses.

- anchor-lang and anchor-spl 2.0.0-rc.1 -> 2.0.0-rc.2, wincode 0.5 -> 0.6,
  anchor-v2-testing rev 3e38a121 -> a2066021 (the v2.0.0-rc.2 tag).
- solana-kite 0.4.0 -> 0.7.0. Every kite sender and helper call passes the new
  compute_unit_limit argument as None.
- anchor-v2-testing no longer re-exports LiteSVM at its root; tests import
  anchor_v2_testing::litesvm::LiteSVM.
- hello-solana, options and order-book build their own transactions with
  kite's build_transaction_from_instructions, as their Anchor v1 copies do.
- The solana-address ">=2.6, <2.7" pin goes: rc.2 and solana-address 2.7 are
  both on wincode 0.6.
- The Anchor v2 workflow installs anchor-cli 2.0.0-rc.2 and drops the
  anchor#4947 IDL workaround, which rc.2 fixes.
- New basics/transaction-v1/anchor: the Anchor v2 copy of the transaction v1
  example.

block-list/pinocchio and shank-and-codama/native stay on LiteSVM 0.13.1: each
is its own workspace and pins its test stack to its generated client.

Claude-Session: https://claude.ai/code/session_01GZHin47JCVXoDrWgh9MnhM
Agave 4.4.0 (2026-10-28) is inside LiteSVM 0.18.1's `^4.3` ranges but
LiteSVM 0.18.1 does not compile against it, and the Anchor v2 projects
commit no lockfile, so every fresh resolve broke. Every crate that pulls
in LiteSVM 0.18.1 without a lockfile now asks for solana-program-runtime
and solana-fee `~4.3`; Agave's exact inter-crate pins hold the rest.

managed_fund.json is regenerated with anchor-cli 2.0.0-rc.2. rc.2 omits
`pda` for explicit-bump and associated-token accounts and the address of
swap_router_program; the app passes every account with accountsStrict,
and `pnpm verify` and `pnpm typecheck` pass. lever.json regenerates
unchanged.

mpl-token-metadata `=5.1.2-alpha.2` becomes `5.1.2-alpha.2`, which
still matches anchor-spl's exact pin, and quasar-svm `=0.1.0` becomes
`0.1.0`, which quasar-test already pins exactly. Cargo.lock resolves the
same versions.

Claude-Session: https://claude.ai/code/session_01GZHin47JCVXoDrWgh9MnhM
CI on the previous push found six failures, all from the upgrade:

- transfer-sol/asm read its instruction data at a fixed offset past the
  system program account. Agave 4.3 renamed that builtin from
  system_program to solana_system_program, and LiteSVM stores the name as
  the account's data, so the instruction data moved 8 bytes. The program
  now finds it from the account's data length, as checking-accounts/asm
  already does, and the test prints the transaction error on failure.
- LiteSVM 0.18 starts at a recent mainnet slot, not slot 0, so warping to
  slot 200 or 10,000 moved the clock backwards. The prop-amm and
  perpetual-futures stale-price tests warp relative to the current slot.
- create-account/anchor compared against Rent::default(); it now asks
  LiteSVM, whose Rent sysvar is what the program reads.
- pyth and order-book build an IDL again now that the anchor#4947
  workaround is gone: pyth's vendored types derive IdlType, and
  order-book's slab types implement IdlAccountType, rc.2's replacement
  for the removed IdlBuild trait.

Claude-Session: https://claude.ai/code/session_01GZHin47JCVXoDrWgh9MnhM
@mikemaccana
mikemaccana merged commit 0a5705f into main Oct 30, 2026
82 of 84 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant