Skip to content

Commit 17b2fe6

Browse files
committed
fix(abl-token): revive orphaned litesvm test
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.
1 parent e2b17c4 commit 17b2fe6

3 files changed

Lines changed: 11 additions & 34 deletions

File tree

tokens/token-2022/transfer-hook/allow-block-list-token/anchor/programs/abl-token/Cargo.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ spl-transfer-hook-interface = { version = "2.1.0" }
3333
spl-discriminator = "0.5.1"
3434

3535
[dev-dependencies]
36+
litesvm = "0.11.0"
37+
solana-instruction = "3.0.0"
38+
solana-keypair = "3.0.1"
39+
solana-message = "3.1.0"
40+
solana-native-token = "3.0.0"
41+
solana-pubkey = "3.0.0"
42+
solana-sdk-ids = "3.0.0"
43+
solana-signer = "3.0.0"
44+
solana-transaction = "3.0.1"
3645

3746
[lints.rust]
3847
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(target_os, values("solana"))'] }

tokens/token-2022/transfer-hook/allow-block-list-token/anchor/tests-rs/test.rs renamed to tokens/token-2022/transfer-hook/allow-block-list-token/anchor/programs/abl-token/tests/test.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,17 @@
1-
// TODO: Move this test back to programs/abl-token/tests/test.rs once the litesvm
2-
// version gap is resolved. Currently litesvm <=0.6 pins solana-account-info to
3-
// =2.2.1, but anchor-lang 0.32.1 needs >=2.3.0 (for AccountInfo::resize).
4-
// litesvm 0.9+ uses solana 3.x which has type mismatches with anchor-lang's v2 types.
5-
// This will resolve when anchor-lang upgrades to solana 3.x (likely anchor 0.33+).
6-
71
use {
82
abl_token::{accounts::InitConfig, accounts::InitMint, instructions::InitMintArgs, Mode},
93
anchor_lang::InstructionData,
104
anchor_lang::ToAccountMetas,
5+
anchor_spl::token_2022::ID as TOKEN_22_PROGRAM_ID,
116
litesvm::LiteSVM,
127
solana_instruction::Instruction,
138
solana_keypair::Keypair,
149
solana_message::Message,
1510
solana_native_token::LAMPORTS_PER_SOL,
16-
solana_pubkey::{pubkey, Pubkey},
11+
solana_pubkey::Pubkey,
1712
solana_sdk_ids::system_program::ID as SYSTEM_PROGRAM_ID,
1813
solana_signer::Signer,
1914
solana_transaction::Transaction,
20-
spl_token_2022::ID as TOKEN_22_PROGRAM_ID,
2115
std::path::PathBuf,
2216
};
2317

tokens/token-2022/transfer-hook/allow-block-list-token/anchor/tests-rs/README.md

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)