Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 5 additions & 8 deletions .github/actions/setup-and-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ runs:
shell: bash
run: bash scripts/devenv/install-photon.sh

- name: Install just
uses: extractions/setup-just@v2

- name: Set Light Protocol environment variables
shell: bash
run: |
Expand Down Expand Up @@ -208,20 +211,14 @@ runs:
shell: bash
run: |
echo "Building Rust programs..."
if ! npx nx build @lightprotocol/programs; then
echo "Failed to build programs, retrying with verbose output..."
npx nx build @lightprotocol/programs --verbose
fi
just programs build

- name: Build Rust program-tests
if: steps.cache-program-tests.outputs.cache-hit != 'true'
shell: bash
run: |
echo "Building Rust program-tests..."
if ! npx nx build @lightprotocol/program-tests; then
echo "Failed to build program-tests, retrying with verbose output..."
npx nx build @lightprotocol/program-tests --verbose
fi
just program-tests build

- name: Check for git changes
shell: bash
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cli-v1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ jobs:

- name: Build CLI
run: |
npx nx build @lightprotocol/zk-compression-cli
just cli build

- name: Run CLI tests with V1
run: |
npx nx test @lightprotocol/zk-compression-cli
just cli test

- name: Display prover logs on failure
if: failure()
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cli-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ jobs:

- name: Build CLI with V2
run: |
npx nx build @lightprotocol/zk-compression-cli
just cli build

- name: Run CLI tests with V2
run: |
npx nx test @lightprotocol/zk-compression-cli
just cli test

- name: Display prover logs on failure
if: failure()
Expand Down
16 changes: 6 additions & 10 deletions .github/workflows/forester-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ jobs:
du -sh /home/runner/work/* | sort -hr | head -n 10

- name: Build CLI
run: npx nx build @lightprotocol/zk-compression-cli
run: just cli build

- name: Test
run: cargo test --package forester e2e_test -- --nocapture
run: just forester test

compressible-tests:
name: Forester compressible tests
Expand Down Expand Up @@ -112,17 +112,13 @@ jobs:
cache-key: "rust"

- name: Build CLI
run: npx nx build @lightprotocol/zk-compression-cli

- name: Build test programs
run: |
cargo build-sbf --manifest-path sdk-tests/csdk-anchor-full-derived-test/Cargo.toml
run: just cli build

- name: Test compressible PDA
run: cargo test --package forester --test test_compressible_pda -- --nocapture
run: just forester test-compressible-pda

- name: Test compressible Mint
run: cargo test --package forester --test test_compressible_mint -- --nocapture
run: just forester test-compressible-mint

- name: Test compressible ctoken
run: cargo test --package forester --test test_compressible_ctoken -- --nocapture
run: just forester test-compressible-ctoken
11 changes: 5 additions & 6 deletions .github/workflows/js-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ jobs:

- name: Build CLI
run: |
npx nx build @lightprotocol/zk-compression-cli
just cli build

- name: Run stateless.js tests with V2
run: |
echo "Running stateless.js tests with retry logic (max 2 attempts)..."
attempt=1
max_attempts=2
until npx nx test @lightprotocol/stateless.js; do
until just js test-stateless; do
attempt=$((attempt + 1))
if [ $attempt -gt $max_attempts ]; then
echo "Tests failed after $max_attempts attempts"
Expand All @@ -84,7 +84,7 @@ jobs:
echo "Running compressed-token unit tests with retry logic (max 2 attempts)..."
attempt=1
max_attempts=2
until npx nx run @lightprotocol/compressed-token:test:unit:all:v2; do
until just js test-compressed-token-unit-v2; do
attempt=$((attempt + 1))
if [ $attempt -gt $max_attempts ]; then
echo "Tests failed after $max_attempts attempts"
Expand Down Expand Up @@ -114,9 +114,8 @@ jobs:

- name: Run sdk-anchor-test TypeScript tests with V2
run: |
npx nx build @lightprotocol/sdk-anchor-test
cd sdk-tests/sdk-anchor-test
npm run test-ts
just sdk-tests build-anchor-test
cd sdk-tests/sdk-anchor-test && npm run test-ts

- name: Display prover logs on failure
if: failure()
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ jobs:

- name: Build CLI
run: |
npx nx build @lightprotocol/zk-compression-cli
just cli build

- name: Run stateless.js tests with V1
run: |
echo "Running stateless.js tests with retry logic (max 2 attempts)..."
attempt=1
max_attempts=2
until npx nx test @lightprotocol/stateless.js; do
until just js test-stateless; do
attempt=$((attempt + 1))
if [ $attempt -gt $max_attempts ]; then
echo "Tests failed after $max_attempts attempts"
Expand All @@ -84,7 +84,7 @@ jobs:
echo "Running compressed-token tests with retry logic (max 2 attempts)..."
attempt=1
max_attempts=2
until npx nx test @lightprotocol/compressed-token; do
until just js test-compressed-token; do
attempt=$((attempt + 1))
if [ $attempt -gt $max_attempts ]; then
echo "Tests failed after $max_attempts attempts"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/programs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:

- name: Build CLI
run: |
npx nx build @lightprotocol/zk-compression-cli
just cli build

- name: ${{ matrix.program }}
run: |
Expand Down Expand Up @@ -113,7 +113,7 @@ jobs:
else
RUSTFLAGS="-D warnings" eval "$subtest"
if [ "$subtest" == "cargo-test-sbf -p e2e-test" ]; then
pnpm --filter @lightprotocol/programs run build-compressed-token-small
just programs build-compressed-token-small
RUSTFLAGS="-D warnings" eval "$subtest -- --test test_10_all"
fi
fi
Expand Down
35 changes: 4 additions & 31 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,38 +35,11 @@ jobs:
matrix:
group:
- name: batched-merkle-tree-simulate
packages: light-batched-merkle-tree batched-merkle-tree-test
test_cmd: |
cargo test -p light-batched-merkle-tree --features test-only
RUST_LOG=light_prover_client=debug cargo test -p batched-merkle-tree-test -- --test test_simulate_transactions
test_cmd: just program-libs test-simulate
- name: program-libs-fast
packages:
aligned-sized light-hasher light-compressed-account light-account-checks \
light-verifier light-merkle-tree-metadata light-zero-copy light-hash-set light-concurrent-merkle-tree \
light-array-map
test_cmd: |
cargo test -p light-macros
cargo test -p aligned-sized
cargo test -p light-array-map --all-features
cargo test -p light-hasher --all-features
cargo test -p light-compressed-account --all-features
cargo test -p light-account-checks --all-features
cargo test -p light-verifier --all-features
cargo test -p light-merkle-tree-metadata --all-features
cargo test -p light-zero-copy --features "std, mut, derive"
cargo test -p light-zero-copy-derive --all-features
cargo test -p zero-copy-derive-test
cargo test -p light-hash-set --all-features
cargo test -p batched-merkle-tree-test -- --skip test_simulate_transactions --skip test_e2e
cargo test -p light-concurrent-merkle-tree
cargo test -p light-token-interface --features poseidon,test-only
cargo test -p light-compressible --all-features
test_cmd: just program-libs test-fast
- name: program-libs-slow
packages: light-bloom-filter light-indexed-merkle-tree batched-merkle-tree-test
test_cmd: |
cargo test -p light-bloom-filter --all-features
cargo test -p light-indexed-merkle-tree --all-features
cargo test -p batched-merkle-tree-test -- --test test_e2e
test_cmd: just program-libs test-slow

name: Test ${{ matrix.group.name }}

Expand Down Expand Up @@ -95,7 +68,7 @@ jobs:

- name: Build CLI
run: |
npx nx build @lightprotocol/zk-compression-cli
just cli build

- name: Run tests for ${{ matrix.group.name }}
run: |
Expand Down
14 changes: 2 additions & 12 deletions .github/workflows/sdk-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,7 @@ jobs:
- program: token test
sub-tests: '["cargo-test-sbf -p sdk-token-test"]'
- program: sdk-libs
packages: light-sdk-macros light-sdk light-program-test light-client light-token-types light-token
test_cmd: |
cargo test -p light-sdk-macros
cargo test -p light-sdk-macros --all-features
cargo test -p light-sdk
cargo test -p light-sdk --all-features
cargo test -p light-program-test
cargo test -p light-client
cargo test -p light-sparse-merkle-tree
cargo test -p light-token-types
cargo test -p light-token --all-features
test_cmd: just sdk-libs test
steps:
- name: Checkout sources
uses: actions/checkout@v6
Expand All @@ -77,7 +67,7 @@ jobs:

- name: Build CLI
run: |
npx nx build @lightprotocol/zk-compression-cli
just cli build

- name: Install bun
if: matrix.program == 'sdk-libs'
Expand Down
14 changes: 9 additions & 5 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,15 @@ cargo test-sbf -p sdk-token-test
Version-specific tests (V1 and V2) for JS/TS packages.

```bash
# Build and test with Nx
npx nx build @lightprotocol/zk-compression-cli
npx nx test @lightprotocol/stateless.js
npx nx test @lightprotocol/compressed-token
npx nx test @lightprotocol/zk-compression-cli
# Build and test with just
just cli::build
just js::test-stateless
just js::test-compressed-token
just cli::test

# Or use root-level aggregates that include cli and js targets
just build
just test
```

**Environment variables:**
Expand Down
15 changes: 15 additions & 0 deletions cli/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Light Protocol - CLI

default:
@just --list

# Build JS dependencies first, then CLI
build: build-js-deps
pnpm build

build-js-deps:
cd ../js/stateless.js && pnpm build
cd ../js/compressed-token && pnpm build

test:
pnpm test
39 changes: 1 addition & 38 deletions cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,42 +129,5 @@
"keywords": [
"oclif"
],
"types": "dist/index.d.ts",
"nx": {
"targets": {
"build": {
"inputs": [
"{workspaceRoot}/js",
"{workspaceRoot}/programs",
"{workspaceRoot}/gnark-prover"
],
"outputs": [
"{workspaceRoot}/bin",
"{workspaceRoot}/dist",
"{workspaceRoot}/lib",
"{workspaceRoot}/test_bin"
]
},
"build-ci": {
"dependsOn": [
"@lightprotocol/stateless.js:build-ci",
"@lightprotocol/compressed-token:build-ci"
],
"inputs": [
"{workspaceRoot}/js",
"{workspaceRoot}/gnark-prover",
"{projectRoot}/scripts/**"
],
"outputs": [
"{workspaceRoot}/bin",
"{workspaceRoot}/dist",
"{workspaceRoot}/lib",
"{workspaceRoot}/test_bin"
]
},
"test-ci": {
"dependsOn": []
}
}
}
"types": "dist/index.d.ts"
}
37 changes: 37 additions & 0 deletions forester/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Light Protocol - Forester Service

export TEST_MODE := env_var_or_default("TEST_MODE", "local")
export TEST_V1_STATE := env_var_or_default("TEST_V1_STATE", "true")
export TEST_V2_STATE := env_var_or_default("TEST_V2_STATE", "true")
export TEST_V1_ADDRESS := env_var_or_default("TEST_V1_ADDRESS", "true")
export TEST_V2_ADDRESS := env_var_or_default("TEST_V2_ADDRESS", "true")
export RUST_BACKTRACE := env_var_or_default("RUST_BACKTRACE", "1")

Comment thread
coderabbitai[bot] marked this conversation as resolved.
default:
@just --list

build:
cargo build -p forester --release

# Builds test program dependency
build-test-deps:
cd ../program-tests/create-address-test-program && cargo build-sbf

test: build-test-deps
cargo test --package forester e2e_test -- --nocapture

# Builds csdk-anchor-full-derived-test program for compressible tests
build-compressible-test-deps:
cargo build-sbf --manifest-path ../sdk-tests/csdk-anchor-full-derived-test/Cargo.toml

test-compressible-pda: build-compressible-test-deps
RUST_LOG=forester=debug,light_client=debug \
cargo test --package forester --test test_compressible_pda -- --nocapture

test-compressible-mint: build-compressible-test-deps
RUST_LOG=forester=debug,light_client=debug \
cargo test --package forester --test test_compressible_mint -- --nocapture

test-compressible-ctoken: build-compressible-test-deps
RUST_LOG=forester=debug,light_client=debug \
cargo test --package forester --test test_compressible_ctoken -- --nocapture
23 changes: 0 additions & 23 deletions forester/package.json

This file was deleted.

Loading
Loading