Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
f815af5
feat: add ts program test
ananas-block Oct 8, 2025
e1bec75
chore: prot test-rpc.test
ananas-block Oct 9, 2025
029d18b
refactor: anchor-sdk ts tests
ananas-block Oct 10, 2025
efb48c9
refactor: anchor-sdk ts tests
ananas-block Oct 10, 2025
b5813e5
migrated compress ctoken ts tests to program tests
ananas-block Oct 10, 2025
ff791da
chore: migrate compressed token tests to program test
ananas-block Oct 10, 2025
9a0ec06
add to ci
ananas-block Oct 10, 2025
f821477
format
ananas-block Oct 10, 2025
e5d0bcc
fix lint
ananas-block Oct 10, 2025
dd71385
fix: program test versioned compilation
ananas-block Oct 10, 2025
2fda7bf
fix feedback
ananas-block Oct 10, 2025
8bcdbf0
fix
ananas-block Oct 10, 2025
60d42de
remove programs from dev deps
ananas-block Oct 10, 2025
11ae11a
try fix bad alloc
ananas-block Oct 10, 2025
e62c39b
disable parallelism
ananas-block Oct 10, 2025
6382283
single fork
ananas-block Oct 10, 2025
1973c23
define programtest inputs
ananas-block Oct 10, 2025
0b7c2bf
debug logs
ananas-block Oct 10, 2025
fab4350
next try
ananas-block Oct 10, 2025
c8f038e
add logs
ananas-block Oct 10, 2025
09bb0b6
more logs
ananas-block Oct 10, 2025
4f7f8dd
threads
ananas-block Oct 10, 2025
7073497
add more logs
ananas-block Oct 10, 2025
f2e46fb
more logs
ananas-block Oct 10, 2025
9839bbe
more logs
ananas-block Oct 10, 2025
435832b
log bn conversion
ananas-block Oct 10, 2025
945a861
remove logs
ananas-block Oct 10, 2025
9d4edf1
remove logs
ananas-block Oct 10, 2025
796e5a1
change js workflow runners
ananas-block Oct 10, 2025
b6d1b28
add comparison test with noble hasher rs
ananas-block Oct 10, 2025
4fc953e
replace hasher rs with noble hasher
ananas-block Oct 10, 2025
3b7c4c6
fix test
ananas-block Oct 10, 2025
82f0ed4
remove proving keys from setup and build
ananas-block Oct 10, 2025
0384fbe
fix: compilation
ananas-block Oct 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions .github/actions/setup-and-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,19 +112,6 @@ runs:
shell: bash
run: bash scripts/devenv/install-photon.sh

- name: Cache proving keys
if: "!contains(inputs.skip-components, 'proving-keys')"
id: cache-keys
uses: actions/cache@v4
with:
path: prover/server/proving-keys
key: ${{ runner.os }}-proving-keys-${{ inputs.cache-suffix }}${{ inputs.cache-suffix && '-' || '' }}${{ hashFiles('prover/server/prover/common/key_downloader.go', 'prover/server/prover/common/proving_keys_utils.go') }}

- name: Download proving keys
if: "!contains(inputs.skip-components, 'proving-keys') && steps.cache-keys.outputs.cache-hit != 'true'"
shell: bash
run: bash scripts/devenv/download-gnark-keys.sh

- name: Set Light Protocol environment variables
shell: bash
run: |
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/js-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
stateless-js-v2:
name: stateless-js-v2
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
runs-on: warp-ubuntu-latest-x64-4x

services:
redis:
Expand Down Expand Up @@ -63,6 +63,11 @@ jobs:
run: |
npx nx build @lightprotocol/zk-compression-cli

- name: Build program-test
run: |
cd js/program-test
pnpm build:v2

- name: Run stateless.js tests with V2
run: |
echo "Running stateless.js tests with retry logic (max 2 attempts)..."
Expand Down Expand Up @@ -95,6 +100,11 @@ jobs:
done
echo "Tests passed on attempt $attempt"

- name: Run program-test tests with V2
run: |
source ./scripts/devenv.sh
npx nx test @lightprotocol/program-test

- name: Run sdk-anchor-test TypeScript tests with V2
run: |
npx nx build @lightprotocol/sdk-anchor-test
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
stateless-js-v1:
name: stateless-js-v1
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
runs-on: warp-ubuntu-latest-x64-4x

services:
redis:
Expand Down Expand Up @@ -63,6 +63,11 @@ jobs:
run: |
npx nx build @lightprotocol/zk-compression-cli

- name: Build program-test
run: |
cd js/program-test
pnpm build:v1

- name: Run stateless.js tests with V1
run: |
echo "Running stateless.js tests with retry logic (max 2 attempts)..."
Expand Down Expand Up @@ -94,3 +99,8 @@ jobs:
sleep 5
done
echo "Tests passed on attempt $attempt"

- name: Run program-test tests with V1
run: |
source ./scripts/devenv.sh
npx nx test @lightprotocol/program-test
5 changes: 3 additions & 2 deletions cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
},
"devDependencies": {
"@eslint/js": "9.36.0",
"@lightprotocol/programs": "workspace:*",
"@lightprotocol/program-test": "workspace:*",
"@oclif/test": "^4.1.14",
"@solana/spl-token": "^0.3.11",
"@types/bn.js": "^5.1.5",
Expand Down Expand Up @@ -148,7 +148,8 @@
"build-ci": {
"dependsOn": [
"@lightprotocol/stateless.js:build-ci",
"@lightprotocol/compressed-token:build-ci"
"@lightprotocol/compressed-token:build-ci",
"@lightprotocol/program-test:build"
],
"inputs": [
"{workspaceRoot}/js",
Expand Down
2 changes: 1 addition & 1 deletion cli/test/commands/approve-and-mint-to/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { initTestEnvIfNeeded } from "../../../src/utils/initTestEnv";
import { defaultSolanaWalletKeypair } from "../../../src";
import { Keypair } from "@solana/web3.js";
import { createTestSplMint, requestAirdrop } from "../../helpers/helpers";
import { getTestRpc } from "@lightprotocol/stateless.js";
import { getTestRpc } from "@lightprotocol/program-test";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

🧩 Analysis chain

Verify the migration is complete and tests pass.

The import change from @lightprotocol/stateless.js to @lightprotocol/program-test aligns with the PR objective. The usage at line 24 remains unchanged, suggesting API compatibility.

Please confirm:

  1. @lightprotocol/program-test is properly added to the package dependencies
  2. The getTestRpc function signature is identical or compatible
  3. All tests pass with the new import

🏁 Script executed:

#!/bin/bash
# Verify package dependency and getTestRpc usage

# Check if @lightprotocol/program-test is in package.json
echo "=== Checking package.json for @lightprotocol/program-test dependency ==="
fd -t f "package.json" cli | xargs cat | jq '.dependencies, .devDependencies' 2>/dev/null | grep -i "program-test" || echo "Note: Check if dependency is added"

# Search for all getTestRpc usages to verify migration consistency
echo -e "\n=== Finding all getTestRpc usages ==="
rg -n --type=ts 'getTestRpc' cli/test

# Check if there are remaining imports from stateless.js test helpers
echo -e "\n=== Checking for remaining stateless.js test-helper imports ==="
rg -n --type=ts "from ['\"]@lightprotocol/stateless.js['\"]" cli/test | grep -v "node_modules" || echo "No remaining imports found"

Length of output: 1024


Remove remaining stateless.js import in test helpers

cli/test/helpers/helpers.ts:15 – replace or remove the import from @lightprotocol/stateless.js and switch to @lightprotocol/program-test equivalents to complete the migration.

🤖 Prompt for AI Agents
In cli/test/commands/approve-and-mint-to/index.test.ts around line 8 and
specifically in cli/test/helpers/helpers.ts at line 15, remove the remaining
import from `@lightprotocol/stateless.js` and replace it with the corresponding
exports from `@lightprotocol/program-test`; update the helpers file to import
the `program-test` equivalents (e.g., getTestRpc and any other helper functions
used) and refactor any usages in helpers.ts to call those `program-test`
functions instead so the test helpers no longer depend on `stateless.js`.

import { WasmFactory } from "@lightprotocol/hasher.rs";

describe("mint-to", () => {
Expand Down
2 changes: 1 addition & 1 deletion cli/test/commands/create-token-pool/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { initTestEnvIfNeeded } from "../../../src/utils/initTestEnv";
import { defaultSolanaWalletKeypair } from "../../../src";
import { createTestSplMint, requestAirdrop } from "../../helpers/helpers";
import { Keypair } from "@solana/web3.js";
import { getTestRpc } from "@lightprotocol/stateless.js";
import { getTestRpc } from "@lightprotocol/program-test";
import { WasmFactory } from "@lightprotocol/hasher.rs";

describe("create-mint", () => {
Expand Down
2 changes: 1 addition & 1 deletion cli/test/helpers/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import {
buildAndSignTx,
confirmTx,
dedupeSigner,
getTestRpc,
sendAndConfirmTx,
} from "@lightprotocol/stateless.js";
import { getTestRpc } from "@lightprotocol/program-test";
import { createMint, mintTo } from "@lightprotocol/compressed-token";
import {
MINT_SIZE,
Expand Down
49 changes: 29 additions & 20 deletions js/compressed-token/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@
"@coral-xyz/anchor": "^0.29.0",
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
"@eslint/js": "9.36.0",
"@lightprotocol/hasher.rs": "0.2.1",
"@lightprotocol/programs": "workspace:*",
"@lightprotocol/program-test": "workspace:*",
"@rollup/plugin-alias": "^5.1.0",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^26.0.1",
Expand Down Expand Up @@ -78,34 +77,39 @@
"vitest": "^2.1.1"
},
"scripts": {
"test": "pnpm test:e2e:all",
"test:v1": "LIGHT_PROTOCOL_VERSION=V1 pnpm test",
"test:v2": "LIGHT_PROTOCOL_VERSION=V2 pnpm test",
"test": "pnpm test:program-test && pnpm test:e2e:all",
"test:v1": "LIGHT_PROTOCOL_VERSION=V1 pnpm test:program-test && LIGHT_PROTOCOL_VERSION=V1 pnpm test:e2e:all",
"test:v2": "LIGHT_PROTOCOL_VERSION=V2 pnpm test:program-test && LIGHT_PROTOCOL_VERSION=V2 pnpm test:e2e:all",
"test:program-test": "vitest run tests/program-test --reporter=verbose",
"test:program-test:v1": "LIGHT_PROTOCOL_VERSION=V1 pnpm test:program-test",
"test:program-test:v2": "LIGHT_PROTOCOL_VERSION=V2 pnpm test:program-test",
"test:program-test:approve-and-mint-to": "vitest run tests/program-test/approve-and-mint-to.test.ts --reporter=verbose --bail=1",
"test:program-test:compress-spl-token-account": "vitest run tests/program-test/compress-spl-token-account.test.ts --reporter=verbose",
"test:program-test:compress": "vitest run tests/program-test/compress.test.ts --reporter=verbose",
"test:program-test:create-mint": "vitest run tests/program-test/create-mint.test.ts --reporter=verbose",
"test:program-test:create-token-pool": "vitest run tests/program-test/create-token-pool.test.ts --reporter=verbose",
"test:program-test:decompress-delegated": "vitest run tests/program-test/decompress-delegated.test.ts --reporter=verbose",
"test:program-test:decompress": "vitest run tests/program-test/decompress.test.ts --reporter=verbose",
"test:program-test:delegate": "vitest run tests/program-test/delegate.test.ts --reporter=verbose --bail=1",
"test:program-test:mint-to": "vitest run tests/program-test/mint-to.test.ts --reporter=verbose --bail=1",
"test:program-test:multi-pool": "vitest run tests/program-test/multi-pool.test.ts --reporter=verbose",
"test:program-test:transfer-delegated": "vitest run tests/program-test/transfer-delegated.test.ts --reporter=verbose --bail=1",
"test:program-test:transfer": "vitest run tests/program-test/transfer.test.ts --reporter=verbose --bail=1",
"test-all": "vitest run",
"test:unit:all": "EXCLUDE_E2E=true vitest run",
"test:unit:all:v1": "LIGHT_PROTOCOL_VERSION=V1 vitest run tests/unit --reporter=verbose",
"test:unit:all:v2": "LIGHT_PROTOCOL_VERSION=V2 vitest run tests/unit --reporter=verbose",
"test-all:verbose": "vitest run --reporter=verbose",
"test-validator": "./../../cli/test_bin/run test-validator",
"test-validator-skip-prover": "./../../cli/test_bin/run test-validator --skip-prover",
"test:e2e:create-mint": "pnpm test-validator && NODE_OPTIONS='--trace-deprecation' vitest run tests/e2e/create-mint.test.ts --reporter=verbose",
"test:e2e:layout": "vitest run tests/e2e/layout.test.ts --reporter=verbose --bail=1",
"test:e2e:select-accounts": "vitest run tests/e2e/select-accounts.test.ts --reporter=verbose",
"test:e2e:create-token-pool": "pnpm test-validator && vitest run tests/e2e/create-token-pool.test.ts",
"test:e2e:mint-to": "pnpm test-validator && vitest run tests/e2e/mint-to.test.ts --reporter=verbose --bail=1",
"test:e2e:approve-and-mint-to": "pnpm test-validator && vitest run tests/e2e/approve-and-mint-to.test.ts --reporter=verbose --bail=1",
"test:e2e:merge-token-accounts": "pnpm test-validator && vitest run tests/e2e/merge-token-accounts.test.ts --reporter=verbose",
"test:e2e:transfer": "pnpm test-validator && vitest run tests/e2e/transfer.test.ts --reporter=verbose --bail=1",
"test:e2e:delegate": "pnpm test-validator && vitest run tests/e2e/delegate.test.ts --reporter=verbose --bail=1",
"test:e2e:transfer-delegated": "pnpm test-validator && vitest run tests/e2e/transfer-delegated.test.ts --reporter=verbose --bail=1",
"test:e2e:compress": "pnpm test-validator && vitest run tests/e2e/compress.test.ts --reporter=verbose",
"test:e2e:compress-spl-token-account": "pnpm test-validator && vitest run tests/e2e/compress-spl-token-account.test.ts --reporter=verbose",
"test:e2e:decompress": "pnpm test-validator && vitest run tests/e2e/decompress.test.ts --reporter=verbose",
"test:e2e:decompress-delegated": "pnpm test-validator && vitest run tests/e2e/decompress-delegated.test.ts --reporter=verbose",
"test:e2e:merge-token-accounts": "pnpm test-validator && vitest run tests/e2e/merge-token-accounts.test.ts --reporter=verbose",
"test:e2e:mint-to": "pnpm test-validator && vitest run tests/e2e/mint-to.test.ts --reporter=verbose --bail=1",
"test:e2e:rpc-token-interop": "pnpm test-validator && vitest run tests/e2e/rpc-token-interop.test.ts --reporter=verbose",
"test:e2e:rpc-multi-trees": "pnpm test-validator && vitest run tests/e2e/rpc-multi-trees.test.ts --reporter=verbose",
"test:e2e:multi-pool": "pnpm test-validator && vitest run tests/e2e/multi-pool.test.ts --reporter=verbose",
"test:e2e:all": "pnpm test-validator && vitest run tests/e2e/create-mint.test.ts && vitest run tests/e2e/mint-to.test.ts && vitest run tests/e2e/transfer.test.ts && vitest run tests/e2e/delegate.test.ts && vitest run tests/e2e/transfer-delegated.test.ts && vitest run tests/e2e/multi-pool.test.ts && vitest run tests/e2e/decompress-delegated.test.ts && pnpm test-validator-skip-prover && vitest run tests/e2e/compress.test.ts && vitest run tests/e2e/compress-spl-token-account.test.ts && vitest run tests/e2e/decompress.test.ts && vitest run tests/e2e/create-token-pool.test.ts && vitest run tests/e2e/approve-and-mint-to.test.ts && vitest run tests/e2e/rpc-token-interop.test.ts && vitest run tests/e2e/rpc-multi-trees.test.ts && vitest run tests/e2e/layout.test.ts && vitest run tests/e2e/select-accounts.test.ts",
"test:e2e:all": "pnpm test-validator && vitest run tests/e2e/compress.test.ts && vitest run tests/e2e/mint-to.test.ts && vitest run tests/e2e/rpc-token-interop.test.ts && vitest run tests/e2e/rpc-multi-trees.test.ts && vitest run tests/e2e/layout.test.ts && vitest run tests/e2e/select-accounts.test.ts",
"pull-idl": "../../scripts/push-compressed-token-idl.sh",
"build": "if [ \"$LIGHT_PROTOCOL_VERSION\" = \"V2\" ]; then LIGHT_PROTOCOL_VERSION=V2 pnpm build:bundle; else LIGHT_PROTOCOL_VERSION=V1 pnpm build:bundle; fi",
"build:bundle": "rimraf dist && rollup -c",
Expand Down Expand Up @@ -135,10 +139,15 @@
]
},
"build-ci": {
"dependsOn": ["@lightprotocol/stateless.js:build-ci"]
"dependsOn": [
"@lightprotocol/stateless.js:build-ci"
]
},
"test-ci": {
"dependsOn": ["@lightprotocol/stateless.js:test-ci"]
"dependsOn": [
"@lightprotocol/stateless.js:test-ci",
"@lightprotocol/program-test:build"
]
}
}
}
Expand Down
Loading
Loading