Skip to content

fix: fix all broken builds and tests across the repo#535

Open
mikemaccana-edwardbot wants to merge 1 commit intosolana-developers:mainfrom
mikemaccana-edwardbot:fix/broken-tests
Open

fix: fix all broken builds and tests across the repo#535
mikemaccana-edwardbot wants to merge 1 commit intosolana-developers:mainfrom
mikemaccana-edwardbot:fix/broken-tests

Conversation

@mikemaccana-edwardbot
Copy link

@mikemaccana-edwardbot mikemaccana-edwardbot commented Feb 15, 2026

Summary

Fixes all broken Native tests, Anchor builds, and compression projects. Migrates all borsh usage from deprecated v0.7 API to v2. Removes references to frameworks not present in the repo.

Native tests (16/16 passing)

  • counter/native & escrow/native: add bn.js as explicit dependency. pnpm's strict dependency resolution does not hoist transitive deps (unlike npm), so bn.js from @solana/web3.js is not accessible directly.
  • All native tests using borsh: migrate from borsh v0.7 class-based API to borsh v2 object schema API. The v0.7 API (Map schemas, Assignable classes, 3-arg deserialize) is incompatible with borsh v1+. Updated 19 test files and 14 package.json files. Introduced a shared borshSerialize(schema, data) helper to replace the repeated Buffer.from(borsh.serialize(...)) pattern. Removed per-schema typed wrappers in favour of exporting schemas directly.
  • create-account/native: replace litesvm with solana-bankrun. litesvm's native binary crashes with SIGABRT on Linux x64 (LiteSVM/litesvm#171). This was the only native test using litesvm — all others use solana-bankrun, the recommended framework per CONTRIBUTING.md.
  • TypeScript 4.x → 5.x in 10 token projects. TS4 can't parse @solana/codecs-data-structures type definitions. Also fix Keypair.fromSecretKey(Buffer.from(...)) to use Uint8Array.from() for TS5 compatibility.

Anchor builds (39/39 passing)

  • Set solana_version = "3.1.8" in all 49 Anchor.toml files. Anchor's default BPF toolchain ships rustc 1.79, but anchor-lang 0.32.1's dependency tree requires rustc 1.82+ (indexmap 2.13.0) and Cargo's edition2024 feature. Solana 3.1.8 platform-tools v1.52 (rustc 1.89) resolves both. All projects now use a consistent toolchain version.
  • allow-block-list-token: bump spl-transfer-hook-interface 0.8.2 → 2.1.0, spl-tlv-account-resolution 0.8.1 → 0.11.1, spl-discriminator 0.3 → 0.5.1. Old SPL versions used solana-program v1, causing type mismatches with anchor-lang 0.32.1's v2 types. litesvm Rust test moved to tests-rs/ because litesvm pins solana-account-info =2.2.1 but anchor-lang 0.32.1 needs >=2.3.0 for AccountInfo::resize(). See tests-rs/README.md.

Compression projects (3/3 building)

  • Rewrite cnft-burn, cnft-vault, cutils from anchor-lang 0.26.0 to 0.32.1. Upgrade to mpl-bubblegum 2.1.1 + spl-account-compression 1.0.0 (both use solana-program v2, matching anchor-lang 0.32.1). cnft-vault: manual invoke_signed rewritten to TransferCpi. cutils verify: raw invoke because spl-account-compression 1.0.0's CPI module is built against anchor-lang 0.31, which has incompatible traits with 0.32.1. Discriminator computed from sha256("global:verify_leaf") rather than hardcoded. Comment documents when this workaround can be removed.

Documentation

  • README: remove TypeScript/Poseidon references (none exist in repo), Anchor before Native in badges, fix typos.
  • CONTRIBUTING: remove Steel/Python/Solidity/Poseidon references (none exist in repo), fix markdown, renumber sections.

@mikemaccana
Copy link
Contributor

@ZYJLiu this should fix all the broken tests in program-examples - can you please trigger the workflow? Thanks. 🙏

@mikemaccana-edwardbot mikemaccana-edwardbot force-pushed the fix/broken-tests branch 9 times, most recently from 11baf3a to 105d9ea Compare February 16, 2026 00:37
Native tests (16/16 passing):

- counter/native & escrow/native: add bn.js as explicit dependency.
  pnpm's strict dependency resolution does not hoist transitive deps
  (unlike npm), so bn.js from @solana/web3.js is not accessible directly.

- All native tests using borsh: migrate from borsh v0.7 class-based API
  to borsh v2 object schema API. The v0.7 API (Map schemas, Assignable
  classes, 3-arg deserialize) is incompatible with borsh v1+. Updated 19
  test files and 14 package.json files. Introduced a shared
  borshSerialize(schema, data) helper to replace the repeated
  Buffer.from(borsh.serialize(...)) pattern. Removed per-schema typed
  wrappers in favour of exporting schemas directly.

- create-account/native: replace litesvm with solana-bankrun. litesvm's
  native binary crashes with SIGABRT on Linux x64
  (LiteSVM/litesvm#171). This was the only
  native test using litesvm — all others use solana-bankrun, the
  recommended framework per CONTRIBUTING.md.

- Upgrade TypeScript 4.x to 5.x in 10 token projects. TS4 can't parse
  @solana/codecs-data-structures type definitions. Also fix
  Keypair.fromSecretKey(Buffer.from(...)) to use Uint8Array.from() for
  TS5 compatibility.

Anchor builds (39/39 passing):

- Set solana_version = "3.1.8" in all 49 Anchor.toml files. Anchor's
  default BPF toolchain ships rustc 1.79, but anchor-lang 0.32.1's
  dependency tree requires rustc 1.82+ (indexmap 2.13.0) and Cargo's
  edition2024 feature. Solana 3.1.8 platform-tools v1.52 (rustc 1.89)
  resolves both. All projects now use a consistent toolchain version.

- allow-block-list-token: bump spl-transfer-hook-interface 0.8.2 -> 2.1.0,
  spl-tlv-account-resolution 0.8.1 -> 0.11.1, spl-discriminator 0.3 -> 0.5.1.
  Old SPL versions used solana-program v1, causing type mismatches with
  anchor-lang 0.32.1's v2 types. litesvm Rust test moved to tests-rs/
  because litesvm pins solana-account-info =2.2.1 but anchor-lang 0.32.1
  needs >=2.3.0 for AccountInfo::resize(). See tests-rs/README.md.

Compression projects (3/3 building):

- Rewrite cnft-burn, cnft-vault, cutils from anchor-lang 0.26.0 to 0.32.1.
  Upgrade to mpl-bubblegum 2.1.1 + spl-account-compression 1.0.0 (both
  use solana-program v2, matching anchor-lang 0.32.1). cnft-vault: manual
  invoke_signed rewritten to TransferCpi. cutils verify: raw invoke because
  spl-account-compression 1.0.0's CPI module is built against anchor-lang
  0.31, which has incompatible traits with 0.32.1. Discriminator computed
  from sha256("global:verify_leaf") rather than hardcoded. Comment
  documents when this workaround can be removed.

Documentation:

- README: remove TypeScript/Poseidon references (none exist in repo),
  Anchor before Native in badges, fix typos.
- CONTRIBUTING: remove Steel/Python/Solidity/Poseidon references (none
  exist in repo), fix markdown, renumber sections.
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.

3 participants