Use Rust and LiteSVM for tests per new Anchor defaults, migrate from 1.0rc5 to Anchor 1.0 final#555
Conversation
de8bb1e to
4f89e09
Compare
35dd788 to
0ed4f4c
Compare
Replaces all TypeScript Anchor tests with Rust LiteSVM tests powered by solana-kite (https://crates.io/crates/solana-kite). Kite consolidates repeated test boilerplate — account creation, token minting, PDA derivation, balance assertions — into reusable functions. The result: 46 Rust test files averaging just 148 lines each, replacing ~13,700 lines of TypeScript tests and 109 per-project config files (package.json, tsconfig, pnpm-lock.yaml). No more per-project npm dependencies for Anchor tests. ### Anchor 1.0.0 (stable) - Migrate all 49 Anchor programs from 0.32.1 → 1.0.0 (stable, released 2026-04-02) - @coral-xyz/anchor → @anchor-lang/core in TypeScript - CpiContext::new() .to_account_info() → .key() in Rust - Transfer-hook: .map_err() wrappers for SPL 2.x→3.x ProgramError bridge - transfer-cost: upgraded SPL crates to Solana 3.x, Box<InterfaceAccount> for stack overflow - Compression: replaced mpl-bubblegum CPI with raw invoke() (no Solana 3.x release) ### Rust LiteSVM tests with solana-kite 0.3.0 - 46 Anchor programs now have Rust integration tests (~6,800 lines total) - solana-kite replaces hundreds of lines of duplicated setup code per test: create_funded_keypair, create_token_mint, mint_tokens_to_token_account, get_pda, get_token_balance — all one-liners instead of 20+ line helpers - Eliminates 109 per-project boilerplate files (package.json, tsconfig, pnpm-lock) - Net deletion: ~6,900 lines of TypeScript test code removed ### Repo cleanup - Configure biome, fix all lint errors - Remove yarn.lock (project uses pnpm) - Add pnpm/action-setup to CI workflows - Upgrade litesvm from 0.8.1 to 0.11.0 - Use 🤥 emoji for Pinocchio (lying face / growing nose) 691 files changed, +21,837 / -17,091
0ed4f4c to
8fe00ed
Compare
|
@Perelyn-sama this is a follow-up to my previous RC5 now the final version of Anchor has been released, more significantly though it also uses LiteSVM by default as Anchor 1.0 does - could you please check it out? |
Program IDs should match what's on main. These were changed unnecessarily during the LiteSVM migration.
Projects with Rust LiteSVM tests no longer need their old TypeScript test files, package.json, tsconfig.json, or pnpm-lock.yaml.
6041842 to
432c3cc
Compare
Hey @mikemaccana, thanks for another PR. This looks great, I like that we’re adding more Rust tests but I don’t think we need to remove the TypeScript tests yet. It would also be nice to reduce the size of PRs and focus on one task at a time so reviews can move more smoothly. |
The hand test loads lever.so (a different program) via include_bytes!(), which fails during anchor build's IDL generation step because the .so files don't exist yet at compile time. Using std::fs::read() defers the load to test runtime, after anchor build has created the artifacts.
|
@Perelyn-sama No probs, I'll rebase and split this up into smaller PRs for easier review - will close this and open the smaller ones now 👍 |
|
Closing in favour of smaller, focused PRs (repo cleanup, Anchor 1.0 migration, and LiteSVM tests as separate branches). |
Summary
Replaces all TypeScript Anchor tests with Rust LiteSVM tests. No more per-project npm dependencies for Anchor tests.
All CI passing on fork: GitHub Actions (anchor-1.0-final)
Anchor 1.0.0 (stable)
Rust LiteSVM tests
Repo cleanup