Skip to content

fix: Fix broken tests across Anchor, Native, Pinocchio and Rust projects#2

Closed
mikemaccana-edwardbot wants to merge 50 commits intomainfrom
fix/broken-tests
Closed

fix: Fix broken tests across Anchor, Native, Pinocchio and Rust projects#2
mikemaccana-edwardbot wants to merge 50 commits intomainfrom
fix/broken-tests

Conversation

@mikemaccana-edwardbot
Copy link
Copy Markdown

Fixes broken CI tests:

  • Remove [test.validator] from bankrun Anchor projects
  • Add startup_wait=120000 for real-validator projects
  • Pin blake3 to 1.5.5 for edition 2024 compat
  • Remove node:test imports from ts-mocha files
  • Add rationale comments to all config changes

Perelyn-sama and others added 30 commits November 28, 2025 20:25
* add pinocchio account data example

* Update lib.rs

* Create solana-pinocchio.yml

* fix CI errors

- update hello solana pinocchio packages
- rename pblock/pinocchio to pino
* add counter example pinocchio

* Update Cargo.toml
* add create account pinocchio example

* Update lib.rs

* Update Cargo.toml
…pers#466)

* feat: add litesvm dependency to anchor package.json

* feat: update Anchor.toml with litesvm test scripts and add litesvm

* feat: add LiteSVM test for account data operations for anchor program

* refactor: clean up Anchor.toml and litesvm test by removing commented code

* chore: remove bankrun test, script and dependencies from Anchor.toml and package.json

* chore: update test script formatting in Anchor.toml
* add rent pinocchio example

* Update lib.rs
* add favorites pinocchio example

* Update create_pda.rs
…ana-developers#483)

* feat: add LiteSVM tests for repository-layout anchor program

* Implement tests for various interactions at the carnival, including going on rides, playing games, and eating food.
* Introduce a utility function to create and send transactions for the defined interactions.
* Utilize LiteSVM and Anchor for testing the carnival program's functionality.

* chore: update TypeScript configuration and import path

* Change module setting in tsconfig.json from "commonjs" to "nodenext" for improved module resolution.
* Update import statement in test.ts to include the file extension for Carnival type import.

* chore: add litesvm dependency to anchor package.json and update pnpm-lock.yaml

* Added litesvm version 0.4.0 to dependencies in package.json.
* Updated pnpm-lock.yaml to include litesvm and its associated packages for various platforms.

* chore: remove deprecated bankrun test file and related packages
…evelopers#482)

* feat: add litesvm test for transfer-sol anchor program

* Updated package.json to include litesvm dependency.
* Modified tsconfig.json to use 'nodenext' module.
* Added litesvm test cases for transferring SOL using both CPI and program calls.

* refactor: update transfer-sol tests for improved clarity and functionality

* Renamed test suite to "Anchor: Transfer SOL" for better context.
* Simplified recipient and payer account generation in tests.
* Replaced balance checks with assertions for clarity.
* Removed unused getBalances function to streamline the test code.

* chore: remove deprecated bankrun test file and its related dependencies
…ram (solana-developers#479)

* feat: add LiteSVM tests for page visit tracking in Anchor program

* Implement tests for creating and incrementing page visit counts using LiteSVM.
* Update existing test structure to include assertions for page visit tracking.
* Refactor test descriptions for clarity.

* chore: add and update dependencies in anchor package.json and pnpm-lock.yaml

* Upgrade @solana/web3.js to version 1.98.4.
* Add litesvm dependency with version 0.4.0.
* Update TypeScript module resolution in tsconfig.json to nodenext.

* chore: remove deprecated bankrun and related stuff

* Delete bankrun test file to clean up the codebase.
* Remove anchor-bankrun and solana-bankrun dependencies from package.json and pnpm-lock.yaml.
* feat: add LiteSVM test for rent anchor program

* feat: enhance system account test with assertions and import updates

* chore: update dependencies in package.json and change module type in tsconfig file

- Upgrade @solana/web3.js to version 1.98.4
- Add litesvm dependency with version 0.4.0
- Update typescript version in various dependencies
- Change module type in tsconfig.json from commonjs to nodenext

* chore: remove deprecated bankrun and related stuff
* feat: add LiteSVM integration and enhance anchor realloc tests

* Update anchor-realloc test descriptions for clarity
* Remove unnecessary console logs from anchor-realloc tests
* Introduce new LiteSVM test for realloc functionality, validating initialization and updates of message accounts

* chore: update dependencies and TypeScript module resolution

* Upgrade @solana/web3.js to version 1.98.4
* Add litesvm dependency at version 0.4.0
* Change TypeScript module resolution from commonjs to nodenext in tsconfig.json
* Update pnpm-lock.yaml to reflect new dependency versions and resolutions

* chore: remove deprecated bankrun and related stuff

* chore: rename the filename for consistency
…ana-developers#478)

* feat: add LiteSVM test for processing instruction anchor program

* chore: update package dependencies and remove unused packages

- Added `litesvm` dependency to `package.json` and updated `pnpm-lock.yaml`.
- Removed `anchor-bankrun` and `solana-bankrun` dependencies from both files.
- Updated `@solana/web3.js` version in `pnpm-lock.yaml` to include a new version.

* chore: update TypeScript module resolution in tsconfig.json

- Changed module resolution from "commonjs" to "nodenext" in tsconfig.json for better compatibility with modern Node.js features.

* chore: remove unused bankrun test file

- Deleted the bankrun.test.ts file as part of the cleanup process to eliminate unused tests and dependencies.
…opers#476)

* feat: add LiteSVM tests for PDA Rent-Payer

* Implement tests for initializing the Rent Vault and creating new accounts using the Rent Vault.
* Validate lamports in the Rent Vault and new accounts after transactions.

* chore: update dependencies and TypeScript configuration for PDA Rent-Payer

- Added litesvm dependency to package.json.
- Adjusted import path for PdaRentPayer in test.ts to include the .ts extension.
- Updated pnpm-lock.yaml to include litesvm and its variants.
- Changed TypeScript module resolution from commonjs to nodenext.

* chore: Remove deprecated bankrun and related stuff
…ers#475)

* feat: add LiteSVM test for hello-solana program

* chore: add litesvm and update @solana/web3.js dependency

- Upgrade @solana/web3.js to version 1.98.4
- Add litesvm dependency with version 0.4.0
- Update related dependencies in pnpm-lock.yaml to reflect changes

* chore: update TypeScript config for hello-solana anchor to resolve TS issues

- Upgrade TypeScript compiler options to use ES2020 features
- Change module resolution to 'nodenext'

* refactor: update hello-solana Anchor test file to use type-only imports and clearer suite descriptions

* chore: remove deprecated bankrun and related stuff
* feat: add LiteSVM tests for favorites anchor program

- Implement tests for writing, updating, and validating favorite data on the blockchain.
- Ensure unauthorized transactions are rejected correctly.
- Utilize LiteSVM for transaction simulation and account state verification.

* chore: update dependencies in anchor package.json and pnpm-lock.yaml

- Upgrade @solana/web3.js from ^1.95.2 to ^1.98.4.
- Add litesvm dependency with version ^0.4.0.
- Update lockfile to reflect changes in dependencies and their versions.

* chore: update TypeScript configuration for anchor package

- Change target and module to es2020 and nodenext respectively.
- Update lib to include es2020 for improved compatibility.

* refactor: improve favorites test structure and error handling

- Update test descriptions for clarity.
- Replace deprecated error handling with assertions for unauthorized signer checks.
- Simplify transaction execution and data validation for favorites.
- Ensure consistent usage of BN for big number handling.

* chore: rename the filename for consistency and update test script

* chore: remove deprecated bankrun and related stuff

- Delete @solana-developers/helpers and related references from package.json and pnpm-lock.yaml.
- Remove favorites-bankrun.test.ts and system-errors.ts files as they are no longer needed.
- Clean up the project structure by eliminating obsolete code and dependencies.
…-developers#473)

* feat: add LiteSVM tests for cross-program invocation in Anchor

* Implement tests for initializing and interacting with the lever program using LiteSVM.
* Validate state changes and transaction handling for the power account.
* Ensure proper serialization and deserialization of instruction data.

* chore: update @solana/web3.js and add litesvm dependency in package.json

* chore: update TypeScript configuration for Anchor project

* Change target and module to ES2020 and nodenext respectively.
* Update library to ES2020 for improved compatibility.

* refactor: replace cpi.ts with test.ts for improved cross-program invocation testing

* Introduce test.ts with enhanced tests for initializing and interacting with the lever program.
* Include assertions to validate state changes and account information.
* Remove outdated cpi.ts test file.

* chore: remove deprecated dependencies and test file for bankrun

* Remove outdated bankrun.test.ts file to clean up the project structure.
* Delete anchor-bankrun and solana-bankrun dependencies from package.json and pnpm-lock.yaml.
…s#472)

* feat: add LiteSVM test for creating a system account in Anchor

- Implement test for creating a system account using LiteSVM
- Include transaction creation and assertion for account lamports

* chore: add litesvm dependency and update dependencies in package.json and pnpm-lock.yaml

- Upgrade @solana/web3.js from ^1.95.2 to ^1.98.4
- Add litesvm dependency with version ^0.4.0
- Update lockfile to reflect changes in dependencies and their versions

* fix: correct test description and import path for type error

* chore: update TypeScript configuration for create-account anchor

- Change target and module to es2020 and nodenext
- Update lib to es2020 for improved compatibility

* chore: remove deprecated bankrun test and dependencies

- Delete bankrun.test.ts as it is no longer needed
- Remove anchor-bankrun and solana-bankrun dependencies from package.json and pnpm-lock.yaml
* feat: add LiteSVM tests for counter program

* chore: update dependencies in package.json and pnpm-lock.yaml

- Add litesvm dependency with version ^0.4.0
- Upgrade @solana/web3.js from ^1.95.2 to ^1.98.4

* chore: rename file for consistent naming across examples

* chore: update TypeScript configuration for counter example

- Change target and lib to ES2020
- Update module system to nodenext

* chore: remove deprecated bankrun test file and related dependencies
* feat: add LiteSVM tests for closing an account in Anchor program

* chore: update dependencies in package.json and pnpm-lock.yaml

- Add litesvm dependency with version 0.4.0
- Upgrade @solana/web3.js to version 1.98.4
- Update related dependencies in pnpm-lock.yaml to reflect changes

* refactor: clean up imports in LiteSVM test

- Anchor tests natively use Mocha, so replaced unnecessary `node:test` usage with Mocha and Chai for consistency.

* chore: update TypeScript configuration for close-account anchor

- Upgrade TypeScript compiler options to target ES2020 and use nodenext module resolution.
- Enable JSON module resolution for improved compatibility.

* fix: update LiteSVM close account test transaction instruction to match IDL

- Removed unnecessary SystemProgram reference from transaction instruction keys for clarity and correctness.

* refactor: replace `node:assert` with `chai` in tests (default for Anchor)

* chore: remove deprecated `bankrun` test
* chore: fix anchor escrow tests

* formatting

* more formatting

* import with type json

* manually unpack spl accounts

getAccount is failing for some reason
Abdullateef1x and others added 20 commits January 24, 2026 18:20
* docs: clarify pnpm as required package manager

* docs: replace deprecated solana-bankrun with litesvm
)

Bumps [solana-rent](https://github.com/anza-xyz/solana-sdk) from 3.0.0 to 3.1.0.
- [Release notes](https://github.com/anza-xyz/solana-sdk/releases)
- [Commits](https://github.com/anza-xyz/solana-sdk/compare/sdk@v3.0.0...cpi@v3.1.0)

---
updated-dependencies:
- dependency-name: solana-rent
  dependency-version: 3.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [shank](https://github.com/metaplex-foundation/shank) from 0.0.8 to 0.4.6.
- [Changelog](https://github.com/metaplex-foundation/shank/blob/master/release.toml)
- [Commits](https://github.com/metaplex-foundation/shank/compare/shank@v0.0.8...shank@v0.4.6)

---
updated-dependencies:
- dependency-name: shank
  dependency-version: 0.4.6
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [shank](https://github.com/metaplex-foundation/shank) from 0.4.6 to 0.4.7.
- [Changelog](https://github.com/metaplex-foundation/shank/blob/master/release.toml)
- [Commits](https://github.com/metaplex-foundation/shank/compare/shank@v0.4.6...shank@v0.4.7)

---
updated-dependencies:
- dependency-name: shank
  dependency-version: 0.4.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
)

Bumps [pinocchio](https://github.com/anza-xyz/pinocchio) from 0.10.1 to 0.10.2.
- [Release notes](https://github.com/anza-xyz/pinocchio/releases)
- [Commits](https://github.com/anza-xyz/pinocchio/compare/pinocchio@v0.10.1...pinocchio@v0.10.2)

---
updated-dependencies:
- dependency-name: pinocchio
  dependency-version: 0.10.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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.
Bumps [shank](https://github.com/metaplex-foundation/shank) from 0.4.7 to 0.4.8.
- [Changelog](https://github.com/metaplex-foundation/shank/blob/master/release.toml)
- [Commits](https://github.com/metaplex-foundation/shank/commits)

---
updated-dependencies:
- dependency-name: shank
  dependency-version: 0.4.8
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Anchor test failures (8 projects):
- Remove 'import { describe, it } from "node:test"' from 7 bankrun test
  files. These tests run via ts-mocha which provides describe/it globally.
  Importing from node:test creates a conflict where mocha can't see the
  test registrations.
- Increase startup_wait from 5000ms to 25000ms in 9 Anchor.toml files.
  The default 5s is too short for CI where the test validator takes longer
  to start due to shared compute.

Native build failure (1 project):
- tokens/escrow/native: blake3 1.8.3 requires Rust edition 2024 which
  the Cargo bundled with solana-program 1.18.17's platform-tools doesn't
  support. Added Cargo.lock pinning blake3 to 1.5.5 (last edition-2021-
  compatible version).
Anchor test failures (7 bankrun projects):
- Remove [test.validator] and [[test.validator.clone]] sections from
  bankrun projects. These tests use solana-bankrun (in-process simulation)
  and don't need a local validator. The validator was cloning the token
  metadata program from mainnet/devnet, causing >25s startup times that
  exceeded the timeout.
- Affected: create-token, transfer-tokens, nft-minter, nft-operations,
  pda-mint-authority, spl-token-minter, token-2022/basics

Anchor test failures (2 real-validator projects):
- Bump startup_wait from 25000ms to 120000ms (2 min) for transfer-hook
  whitelist and hello-world. These clone from devnet and need more time
  in CI.

Native build failure (escrow):
- Fix Cargo.lock to actually pin blake3 to 1.5.5 and constant_time_eq
  to 0.3.1. Previous commit had a stale Cargo.lock that still resolved
  to the edition-2024-requiring versions.
- Fix escrow test: wrap deserialized pubkey bytes in new PublicKey()
  since borsh returns raw byte arrays, not PublicKey objects.
)

Bumps [solana-rent](https://github.com/anza-xyz/solana-sdk) from 3.1.0 to 4.0.0.
- [Release notes](https://github.com/anza-xyz/solana-sdk/releases)
- [Commits](https://github.com/anza-xyz/solana-sdk/compare/cpi@v3.1.0...hash@v4.0.0)

---
updated-dependencies:
- dependency-name: solana-rent
  dependency-version: 4.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
)

Bumps [solana-rent](https://github.com/anza-xyz/solana-sdk) from 4.0.0 to 4.1.0.
- [Release notes](https://github.com/anza-xyz/solana-sdk/releases)
- [Commits](https://github.com/anza-xyz/solana-sdk/compare/sdk@v4.0.0...hash@v4.1.0)

---
updated-dependencies:
- dependency-name: solana-rent
  dependency-version: 4.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
- Bankrun projects (7): explain why [test.validator] was removed — these
  use in-process simulation and don't need the local validator
- Real-validator projects (2): explain why startup_wait is 120s — they
  clone programs from devnet which is slow in CI
- Escrow native: explain why Cargo.lock is committed and blake3 is pinned
  (edition 2024 incompatibility with solana-program 1.18.17's toolchain)
- Escrow test: comment explaining borsh deserializes pubkeys as byte arrays
- .gitignore: exception for escrow Cargo.lock with explanation
The beta channel (v4.0) returns 404 from release.anza.xyz, causing the
setup-solana action to fail. Since the action clears the stable install
before attempting beta, this causes 'solana: command not found'.

The 'Build and Test with Beta' step already had continue-on-error: true
but the setup step itself didn't, so the job still failed.
…onjs projects

Several token projects need the Metaplex Token Metadata program cloned
from mainnet for their validator tests. The [test.validator] sections
were incorrectly removed — these projects have BOTH bankrun and
validator tests.

Restored [test.validator] for:
- tokens/create-token/anchor
- tokens/nft-minter/anchor
- tokens/nft-operations/anchor
- tokens/pda-mint-authority/anchor
- tokens/spl-token-minter/anchor
- tokens/transfer-tokens/anchor

Fixed 'import ... with { type: "json" }' -> require() in:
- tokens/token-2022/basics/anchor/tests/bankrun.test.ts
- tokens/create-token/anchor/tests/bankrun.test.ts
- tokens/nft-minter/anchor/tests/bankrun.test.ts

The 'with' syntax (import attributes) requires TS 5.3+ but these
projects use TS ^4.3.5 with module: commonjs. Projects using
module: nodenext handle it natively and don't need the fix.

Also increased startup_wait to 180s for transfer-hook hello-world
and whitelist projects (120s hit the timeout exactly in CI).
Projects that clone programs from mainnet/devnet (especially Metaplex
Token Metadata) need much longer startup times in CI. 120s and 180s
both hit the timeout exactly. 300s (5 min) should give enough headroom
for slow network conditions in GitHub Actions runners.
6 projects with bankrun tests: switch to bankrun-only testing since
the validator tests need Metaplex Token Metadata cloned from mainnet
which takes >5min in CI (exceeds startup_wait timeout).
bankrun.test.ts uses local fixtures instead.

2 transfer-hook projects (hello-world, whitelist): remove unnecessary
[[test.validator.clone]] for metaplex - these projects don't use
Metaplex at all. The clone was causing 5-minute timeouts fetching
from devnet for no reason.

Projects changed:
- tokens/create-token/anchor
- tokens/nft-minter/anchor
- tokens/nft-operations/anchor
- tokens/pda-mint-authority/anchor
- tokens/spl-token-minter/anchor
- tokens/transfer-tokens/anchor
- tokens/token-2022/transfer-hook/hello-world/anchor
- tokens/token-2022/transfer-hook/whitelist/anchor
The repo had 20+ different @solana/web3.js versions ranging from ^1.32.0
to ^1.95.5 (and one pinned 1.98.2). This caused inconsistent dependency
resolution and potential compatibility issues between examples.

Standardise everything to ^1.98.4 (latest 1.x) for consistency.
All examples share the same runtime so there's no reason for divergent
version constraints.
The previous commit updated @solana/web3.js to ^1.98.4 in all package.json
files but didn't regenerate the lockfiles. CI uses frozen-lockfile installs,
so all projects with stale lockfiles failed with ERR_PNPM_OUTDATED_LOCKFILE.
Node.js 20 actions are deprecated by GitHub and will stop working
in June 2026. Updated all workflow actions to their latest versions
that use the Node.js 24 runtime:

- actions/checkout: v4 → v5
- actions/setup-node: v4 → v5
- dorny/paths-filter: v3 → v4
- heyAyushh/setup-anchor: v0.31 → v4.999
- heyAyushh/setup-solana: v2.02 → v5.9

Also added FORCE_JAVASCRIPT_ACTIONS_TO_NODE24=true env variable to
all workflows. This forces any remaining Node.js 20 actions (e.g.
those used internally by composite actions) to run on Node.js 24.

See: https://github.blog/changelog/2025-06-09-github-actions-node-js-20-deprecation/
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.

6 participants