From 17b2fe614594cdfc49bca220fc175345d7aebc37 Mon Sep 17 00:00:00 2001 From: Aung Nanda Oo Date: Tue, 4 Aug 2026 01:31:45 -0700 Subject: [PATCH] fix(abl-token): revive orphaned litesvm test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tests-rs/test.rs was moved out of programs/abl-token/tests/ with a comment saying it would move back once anchor-lang reached "0.33+ on solana 3.x" to resolve a litesvm/solana-account-info version conflict. anchor-lang is already at 1.0.2 (resolves to 1.1.2), but nobody moved the test back — tests-rs/ isn't referenced by any Cargo.toml, CI workflow, or script, so this test has been silently dead (not compiling, not running anywhere) since the anchor upgrade. Moving it back surfaces the real, current, unrelated blocker: the test imports spl_token_2022::ID directly, which resolves through spl-token-2022 9.0.0 -> solana-pubkey 2.4.0, a different Pubkey type than every other dependency here (anchor-lang, litesvm, solana-keypair) resolves to (the solana-address 2.7.0 family, via solana-pubkey 3.x/4.x's `pub use ... as Pubkey` re-export). Anchor's generated ToAccountMetas struct reports this as "expected Address, found solana_pubkey::Pubkey" - not a real Address/Pubkey type split, just two incompatible majors of the same crate colliding. anchor-spl (already a normal dependency) already made this exact migration, so swapping to anchor_spl::token_2022::ID fixes it with no new crate needed. Verified: cargo check --tests is clean, anchor build produces the .so, and cargo test passes both tests. Also removes the now-unused `pubkey` macro import and the stale tests-rs/README.md, which described the already-resolved 0.32.1 conflict. This restores the test to its historical CI status: it was never enforced by the Anchor CI workflow even before it broke (that workflow only runs `anchor test`'s TypeScript suite, not `cargo test`), so this is a restoration, not new CI coverage. --- .../anchor/programs/abl-token/Cargo.toml | 9 +++++++ .../abl-token/tests}/test.rs | 10 ++----- .../anchor/tests-rs/README.md | 26 ------------------- 3 files changed, 11 insertions(+), 34 deletions(-) rename tokens/token-2022/transfer-hook/allow-block-list-token/anchor/{tests-rs => programs/abl-token/tests}/test.rs (86%) delete mode 100644 tokens/token-2022/transfer-hook/allow-block-list-token/anchor/tests-rs/README.md diff --git a/tokens/token-2022/transfer-hook/allow-block-list-token/anchor/programs/abl-token/Cargo.toml b/tokens/token-2022/transfer-hook/allow-block-list-token/anchor/programs/abl-token/Cargo.toml index 1046b6e1c..9099c0718 100644 --- a/tokens/token-2022/transfer-hook/allow-block-list-token/anchor/programs/abl-token/Cargo.toml +++ b/tokens/token-2022/transfer-hook/allow-block-list-token/anchor/programs/abl-token/Cargo.toml @@ -33,6 +33,15 @@ spl-transfer-hook-interface = { version = "2.1.0" } spl-discriminator = "0.5.1" [dev-dependencies] +litesvm = "0.11.0" +solana-instruction = "3.0.0" +solana-keypair = "3.0.1" +solana-message = "3.1.0" +solana-native-token = "3.0.0" +solana-pubkey = "3.0.0" +solana-sdk-ids = "3.0.0" +solana-signer = "3.0.0" +solana-transaction = "3.0.1" [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(target_os, values("solana"))'] } diff --git a/tokens/token-2022/transfer-hook/allow-block-list-token/anchor/tests-rs/test.rs b/tokens/token-2022/transfer-hook/allow-block-list-token/anchor/programs/abl-token/tests/test.rs similarity index 86% rename from tokens/token-2022/transfer-hook/allow-block-list-token/anchor/tests-rs/test.rs rename to tokens/token-2022/transfer-hook/allow-block-list-token/anchor/programs/abl-token/tests/test.rs index 17194a6f5..67d68661e 100644 --- a/tokens/token-2022/transfer-hook/allow-block-list-token/anchor/tests-rs/test.rs +++ b/tokens/token-2022/transfer-hook/allow-block-list-token/anchor/programs/abl-token/tests/test.rs @@ -1,23 +1,17 @@ -// TODO: Move this test back to programs/abl-token/tests/test.rs once the litesvm -// version gap is resolved. Currently litesvm <=0.6 pins solana-account-info to -// =2.2.1, but anchor-lang 0.32.1 needs >=2.3.0 (for AccountInfo::resize). -// litesvm 0.9+ uses solana 3.x which has type mismatches with anchor-lang's v2 types. -// This will resolve when anchor-lang upgrades to solana 3.x (likely anchor 0.33+). - use { abl_token::{accounts::InitConfig, accounts::InitMint, instructions::InitMintArgs, Mode}, anchor_lang::InstructionData, anchor_lang::ToAccountMetas, + anchor_spl::token_2022::ID as TOKEN_22_PROGRAM_ID, litesvm::LiteSVM, solana_instruction::Instruction, solana_keypair::Keypair, solana_message::Message, solana_native_token::LAMPORTS_PER_SOL, - solana_pubkey::{pubkey, Pubkey}, + solana_pubkey::Pubkey, solana_sdk_ids::system_program::ID as SYSTEM_PROGRAM_ID, solana_signer::Signer, solana_transaction::Transaction, - spl_token_2022::ID as TOKEN_22_PROGRAM_ID, std::path::PathBuf, }; diff --git a/tokens/token-2022/transfer-hook/allow-block-list-token/anchor/tests-rs/README.md b/tokens/token-2022/transfer-hook/allow-block-list-token/anchor/tests-rs/README.md deleted file mode 100644 index 4305f3c1b..000000000 --- a/tokens/token-2022/transfer-hook/allow-block-list-token/anchor/tests-rs/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# Temporarily relocated Rust tests - -`test.rs` was moved here from `programs/abl-token/tests/test.rs` because it -cannot currently compile alongside anchor-lang 0.32.1. - -## Why - -The test uses **litesvm**, which pins `solana-account-info` to an exact 2.2.x -version. However, anchor-lang 0.32.1 requires `solana-account-info >=2.3.0` -for the `AccountInfo::resize()` method (renamed from `realloc` in 2.3.0). - -This creates an unresolvable dependency conflict: - -- **litesvm <=0.6** → pins `solana-account-info =2.2.1` (too old, no `resize()`) -- **litesvm 0.9+** → uses `solana-account-info 3.x` (type mismatch with anchor-lang's 2.x types) - -No litesvm release currently targets the `solana-account-info 2.3+` range -that anchor-lang 0.32.1 needs. - -## When to move it back - -Move `test.rs` back to `programs/abl-token/tests/test.rs` and restore the -`[dev-dependencies]` in `Cargo.toml` when **either**: - -1. **anchor-lang upgrades to solana 3.x** (likely 0.33+), so litesvm 0.9+ types match, or -2. **litesvm releases a version** targeting `solana-account-info >=2.3, <3`