diff --git a/.github/actions/setup-and-build-nocheck/action.yml b/.github/actions/setup-and-build-nocheck/action.yml deleted file mode 100644 index 66aa83fe11..0000000000 --- a/.github/actions/setup-and-build-nocheck/action.yml +++ /dev/null @@ -1,139 +0,0 @@ -name: Setup and build nocheck -description: Checkout sources, install dependencies, build and prepare for tests -inputs: - branch: - description: "Branch to checkout" - required: true - -runs: - using: "composite" - steps: - - name: Checkout sources - uses: actions/checkout@v4 - with: - ref: ${{ inputs.branch }} - - - name: Restore .local directory cache - id: restore-local-cache - uses: actions/cache@v4 - with: - path: | - .local - prover/server/proving-keys - key: ${{ runner.os }}-local-v3-${{ hashFiles('scripts/install.sh', 'prover/server/scripts/download_keys.sh') }} - restore-keys: | - ${{ runner.os }}-local-v3- - ${{ runner.os }}-local-v2- - - - name: Install dependencies - if: steps.restore-local-cache.outputs.cache-hit != 'true' - shell: bash - run: | - ./scripts/install.sh - - - name: Verify and repair installation - shell: bash - run: | - # Even if cache was restored, run install script to check and install missing components - # The install script now checks for actual file existence, so it will only install what's missing - echo "=== Verifying installation integrity ===" - ./scripts/install.sh --no-reset - - - name: Validate environment setup - shell: bash - run: | - echo "=== Validating environment setup ===" - source ./scripts/devenv.sh - - # Quick validation of critical components - [ -f "$GOROOT/bin/go" ] || { echo "✗ Go not found"; exit 1; } - [ -f "$CARGO_HOME/bin/cargo" ] || { echo "✗ Cargo not found"; exit 1; } - [ -d "prover/server/proving-keys" ] || { echo "✗ Proving keys not found"; exit 1; } - - echo "✓ All critical components found" - - - name: Set local environment - shell: bash - run: | - source ./scripts/devenv.sh - # Export critical environment variables for subsequent steps - echo "GOROOT=$GOROOT" >> $GITHUB_ENV - echo "CARGO_HOME=$CARGO_HOME" >> $GITHUB_ENV - echo "RUSTUP_HOME=$RUSTUP_HOME" >> $GITHUB_ENV - echo "PATH=$PATH" >> $GITHUB_ENV - echo "CARGO_FEATURES=$CARGO_FEATURES" >> $GITHUB_ENV - echo "REDIS_URL=$REDIS_URL" >> $GITHUB_ENV - - - name: Rust cache - uses: swatinem/rust-cache@v2 - with: - cache-all-crates: true - cache-on-failure: true - # Add workspace target directory - workspaces: | - . -> target - cli -> cli/target - examples -> examples/target - - - name: Setup pnpm - uses: pnpm/action-setup@v4 - with: - run_install: false - - - name: Get pnpm store directory - id: pnpm-store - shell: bash - run: | - # Get the store path before any pnpm operations - STORE_PATH=$(pnpm store path --silent) - echo "STORE_PATH=${STORE_PATH}" >> $GITHUB_ENV - echo "path=${STORE_PATH}" >> $GITHUB_OUTPUT - - - name: Setup pnpm cache - id: pnpm-cache - uses: actions/cache@v4 - with: - path: ${{ steps.pnpm-store.outputs.path }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- - - - name: Install dependencies - shell: bash - run: | - # Install dependencies - pnpm install --frozen-lockfile - - # Validate node_modules was created - if [ ! -d "node_modules" ] || [ -z "$(ls -A node_modules 2>/dev/null)" ]; then - echo "Error: node_modules not created after pnpm install" - exit 1 - fi - - - name: Save pnpm cache - # Save cache even on failure to speed up retries - if: steps.pnpm-cache.outputs.cache-hit != 'true' - uses: actions/cache/save@v4 - with: - path: ${{ steps.pnpm-store.outputs.path }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }} - - - name: Build and prepare for tests - shell: bash - run: | - source ./scripts/devenv.sh - mkdir -p /home/runner/.config/solana/ - if [ ! -f /home/runner/.config/solana/id.json ]; then - solana-keygen new --no-bip39-passphrase -o /home/runner/.config/solana/id.json - fi - npx nx build @lightprotocol/programs - npx nx build @lightprotocol/zk-compression-cli - - - name: Save .local directory cache - if: steps.restore-local-cache.outputs.cache-hit != 'true' - uses: actions/cache/save@v4 - with: - path: | - .local - prover/server/proving-keys - key: ${{ runner.os }}-local-v3-${{ hashFiles('scripts/install.sh', 'prover/server/scripts/download_keys.sh') }} diff --git a/.github/actions/setup-and-build/action.yml b/.github/actions/setup-and-build/action.yml index fb5e7469da..5e45e45e0c 100644 --- a/.github/actions/setup-and-build/action.yml +++ b/.github/actions/setup-and-build/action.yml @@ -6,11 +6,16 @@ inputs: description: 'Comma-separated list of components to skip (e.g., "redis,go"). If not specified, all components are installed.' required: false default: "" + cache-suffix: + description: 'Optional suffix for cache keys to enable separate caches per workflow (e.g., "system-programs", "sdk-tests", "rust")' + required: false + default: "" runs: using: "composite" steps: - name: Free Disk Space (Ubuntu) + if: "!contains(inputs.skip-components, 'disk-cleanup')" uses: jlumbroso/free-disk-space@main with: tool-cache: false @@ -18,123 +23,120 @@ runs: large-packages: false docker-images: false - - name: Checkout sources - uses: actions/checkout@v4 - - - name: Restore .local directory cache - id: restore-local-cache - uses: actions/cache@v4 - with: - path: | - .local - prover/server/proving-keys - key: ${{ runner.os }}-local-v3-${{ hashFiles('scripts/install.sh', 'prover/server/scripts/download_keys.sh') }} - restore-keys: | - ${{ runner.os }}-local-v3- - ${{ runner.os }}-local-v2- - - name: Install system dependencies shell: bash run: | sudo apt-get update sudo apt-get install -y libudev-dev pkg-config build-essential - - name: Install dependencies - if: steps.restore-local-cache.outputs.cache-hit != 'true' + - name: Load versions + id: versions shell: bash run: | - if [ -n "${{ inputs.skip-components }}" ]; then - ./scripts/install.sh --skip-components "${{ inputs.skip-components }}" - else - ./scripts/install.sh - fi + source scripts/devenv/versions.sh + echo "rust=${RUST_VERSION}" >> $GITHUB_OUTPUT + echo "go=${GO_VERSION}" >> $GITHUB_OUTPUT + echo "node=${NODE_VERSION}" >> $GITHUB_OUTPUT + echo "pnpm=${PNPM_VERSION}" >> $GITHUB_OUTPUT + echo "solana=${SOLANA_VERSION}" >> $GITHUB_OUTPUT + echo "anchor=${ANCHOR_VERSION}" >> $GITHUB_OUTPUT + echo "photon=${PHOTON_VERSION}" >> $GITHUB_OUTPUT + echo "photon_commit=${PHOTON_COMMIT}" >> $GITHUB_OUTPUT + echo "redis=${REDIS_VERSION}" >> $GITHUB_OUTPUT + + - name: Setup Rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: ${{ steps.versions.outputs.rust }} + components: rustfmt, clippy + cache-workspaces: | + . -> target + cli -> cli/target - - name: Verify and repair installation - shell: bash - run: | - # Even if cache was restored, run install script to check and install missing components - # The install script now checks for actual file existence, so it will only install what's missing - echo "=== Verifying installation integrity ===" - if [ -n "${{ inputs.skip-components }}" ]; then - ./scripts/install.sh --no-reset --skip-components "${{ inputs.skip-components }}" - else - ./scripts/install.sh --no-reset - fi + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: ${{ steps.versions.outputs.go }} + cache-dependency-path: prover/server/go.sum - - name: Validate environment setup - shell: bash - run: | - echo "=== Validating environment setup ===" - source ./scripts/devenv.sh - - # Check critical binaries exist - echo "Checking Go installation..." - if [ -f "$GOROOT/bin/go" ]; then - echo "✓ Go found at: $GOROOT/bin/go" - $GOROOT/bin/go version || echo "⚠ Go binary exists but failed to run" - else - echo "✗ Go not found at expected location: $GOROOT/bin/go" - exit 1 - fi + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ steps.versions.outputs.node }} - echo "Checking Rust installation..." - if [ -f "$CARGO_HOME/bin/cargo" ]; then - echo "✓ Cargo found at: $CARGO_HOME/bin/cargo" - $CARGO_HOME/bin/cargo --version || echo "⚠ Cargo binary exists but failed to run" - else - echo "✗ Cargo not found at expected location: $CARGO_HOME/bin/cargo" - exit 1 - fi + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: ${{ steps.versions.outputs.pnpm }} + run_install: false + + - name: Cache Solana CLI + id: cache-solana + uses: actions/cache@v4 + with: + path: | + .local/bin/solana* + .local/bin/agave* + .local/bin/cargo-* + .local/bin/platform-tools-sdk + key: ${{ runner.os }}-solana-${{ steps.versions.outputs.solana }} + + - name: Install Solana CLI + if: steps.cache-solana.outputs.cache-hit != 'true' + shell: bash + run: bash scripts/devenv/install-solana.sh - echo "Checking Node installation..." - which node && node --version || echo "⚠ Node not in PATH" + - name: Cache Anchor CLI + id: cache-anchor + uses: actions/cache@v4 + with: + path: | + .local/cargo/bin/avm + .local/cargo/bin/anchor + key: ${{ runner.os }}-anchor-${{ steps.versions.outputs.anchor }} - echo "Checking pnpm installation..." - which pnpm && pnpm --version || echo "⚠ pnpm not in PATH" + - name: Install Anchor CLI + if: steps.cache-anchor.outputs.cache-hit != 'true' + shell: bash + run: bash scripts/devenv/install-anchor.sh - echo "Checking Solana installation..." - which solana && solana --version || echo "⚠ Solana not in PATH" + - name: Cache Photon indexer + id: cache-photon + uses: actions/cache@v4 + with: + path: .local/cargo/bin/photon + key: ${{ runner.os }}-photon-${{ steps.versions.outputs.photon }}-${{ steps.versions.outputs.photon_commit }} - echo "Checking Anchor installation..." - which anchor && anchor --version || echo "⚠ Anchor not in PATH" + - name: Install Photon indexer + if: steps.cache-photon.outputs.cache-hit != 'true' + shell: bash + run: bash scripts/devenv/install-photon.sh - # Check proving keys - if [ -d "prover/server/proving-keys" ] && [ -n "$(ls -A prover/server/proving-keys 2>/dev/null)" ]; then - echo "✓ Proving keys found: $(ls prover/server/proving-keys | wc -l) files" - else - echo "✗ Proving keys directory missing or empty" - exit 1 - fi + - 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/scripts/download_keys.sh') }} - echo "=== Environment validation complete ===" + - 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 local environment + - name: Set Light Protocol environment variables shell: bash run: | - source ./scripts/devenv.sh - # Export critical environment variables for subsequent steps - echo "GOROOT=$GOROOT" >> $GITHUB_ENV - echo "CARGO_HOME=$CARGO_HOME" >> $GITHUB_ENV - echo "RUSTUP_HOME=$RUSTUP_HOME" >> $GITHUB_ENV - echo "PATH=$PATH" >> $GITHUB_ENV - echo "CARGO_FEATURES=$CARGO_FEATURES" >> $GITHUB_ENV - echo "REDIS_URL=$REDIS_URL" >> $GITHUB_ENV - - - name: Rust cache - uses: swatinem/rust-cache@v2 - with: - cache-all-crates: true - cache-on-failure: true - # Add workspace target directory - workspaces: | - . -> target - cli -> cli/target - examples -> examples/target + # Add .local/bin to PATH for Solana, Anchor, Photon, Redis + echo "${PWD}/.local/bin" >> $GITHUB_PATH + echo "${PWD}/.local/cargo/bin" >> $GITHUB_PATH - - name: Setup pnpm - uses: pnpm/action-setup@v4 - with: - run_install: false + # Light Protocol-specific environment variables + # (Official actions handle Rust, Go, Node.js environment setup) + echo "CARGO_FEATURES=v2_ix" >> $GITHUB_ENV + echo "REDIS_URL=redis://localhost:6379" >> $GITHUB_ENV + echo "SBF_OUT_DIR=target/deploy" >> $GITHUB_ENV - name: Get pnpm store directory id: pnpm-store @@ -177,7 +179,6 @@ runs: - name: Generate Solana keypair shell: bash run: | - source ./scripts/devenv.sh mkdir -p /home/runner/.config/solana/ if [ ! -f /home/runner/.config/solana/id.json ]; then solana-keygen new --no-bip39-passphrase -o /home/runner/.config/solana/id.json @@ -189,25 +190,48 @@ runs: mkdir -p ./target/deploy cp ./third-party/solana-program-library/spl_noop.so ./target/deploy/spl_noop.so + - name: Cache Solana programs + id: cache-programs + uses: actions/cache@v4 + with: + path: | + target/deploy/*.so + target/idl + target/types + key: ${{ runner.os }}-programs-${{ hashFiles('programs/**/Cargo.toml', 'programs/**/Cargo.lock', 'programs/**/*.rs', 'program-libs/**/*.rs') }} + restore-keys: | + ${{ runner.os }}-programs- + + - name: Cache Solana program-tests + id: cache-program-tests + uses: actions/cache@v4 + with: + path: | + target/deploy/create_address_test_program.so + target/deploy/sdk_anchor_test.so + key: ${{ runner.os }}-program-tests-${{ hashFiles('program-tests/**/Cargo.toml', 'program-tests/**/Cargo.lock', 'program-tests/**/*.rs', 'test-programs/**/Cargo.toml', 'test-programs/**/*.rs') }} + restore-keys: | + ${{ runner.os }}-program-tests- + - name: Build Rust programs + if: steps.cache-programs.outputs.cache-hit != 'true' shell: bash run: | - source ./scripts/devenv.sh echo "Building Rust programs..." - npx nx build @lightprotocol/programs || { + if ! npx nx build @lightprotocol/programs; then echo "Failed to build programs, retrying with verbose output..." npx nx build @lightprotocol/programs --verbose - exit 1 - } + fi - - name: Save .local directory cache - if: steps.restore-local-cache.outputs.cache-hit != 'true' - uses: actions/cache/save@v4 - with: - path: | - .local - prover/server/proving-keys - key: ${{ runner.os }}-local-v3-${{ hashFiles('scripts/install.sh', 'prover/server/scripts/download_keys.sh') }} + - 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 - name: Check for git changes shell: bash diff --git a/.github/workflows/cli-v1.yml b/.github/workflows/cli-v1.yml index 018ac91842..354a1f1d04 100644 --- a/.github/workflows/cli-v1.yml +++ b/.github/workflows/cli-v1.yml @@ -43,42 +43,19 @@ jobs: - name: Checkout sources uses: actions/checkout@v4 - - name: Cache nx - uses: actions/cache@v4 - with: - path: | - .nx/cache - node_modules/.cache/nx - key: nx-cli-v1-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml', 'nx.json') }} - restore-keys: | - nx-cli-v1-${{ runner.os }}- - - name: Setup and build uses: ./.github/actions/setup-and-build with: - skip-components: "redis" - - - name: Build stateless.js with V1 - run: | - source ./scripts/devenv.sh - cd js/stateless.js - pnpm build:v1 - - - name: Build compressed-token with V1 - run: | - source ./scripts/devenv.sh - cd js/compressed-token - pnpm build:v1 + skip-components: "redis,disk-cleanup" + cache-suffix: "js" - - name: Build CLI with V1 + - name: Build CLI with V1 (CI mode - Linux x64 only) run: | - source ./scripts/devenv.sh - npx nx build @lightprotocol/zk-compression-cli + npx nx build-ci @lightprotocol/zk-compression-cli - name: Run CLI tests with V1 run: | - source ./scripts/devenv.sh - npx nx test @lightprotocol/zk-compression-cli + npx nx test-ci @lightprotocol/zk-compression-cli - name: Display prover logs on failure if: failure() diff --git a/.github/workflows/cli-v2.yml b/.github/workflows/cli-v2.yml index 2f7fd728ef..cd5baa5211 100644 --- a/.github/workflows/cli-v2.yml +++ b/.github/workflows/cli-v2.yml @@ -43,42 +43,29 @@ jobs: - name: Checkout sources uses: actions/checkout@v4 - - name: Cache nx - uses: actions/cache@v4 - with: - path: | - .nx/cache - node_modules/.cache/nx - key: nx-cli-v2-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml', 'nx.json') }} - restore-keys: | - nx-cli-v2-${{ runner.os }}- - - name: Setup and build uses: ./.github/actions/setup-and-build with: - skip-components: "redis" + skip-components: "redis,disk-cleanup" + cache-suffix: "js" - name: Build stateless.js with V2 run: | - source ./scripts/devenv.sh cd js/stateless.js pnpm build:v2 - name: Build compressed-token with V2 run: | - source ./scripts/devenv.sh cd js/compressed-token pnpm build:v2 - - name: Build CLI with V2 + - name: Build CLI with V2 (CI mode - Linux x64 only) run: | - source ./scripts/devenv.sh - npx nx build @lightprotocol/zk-compression-cli + npx nx build-ci @lightprotocol/zk-compression-cli - name: Run CLI tests with V2 run: | - source ./scripts/devenv.sh - npx nx test @lightprotocol/zk-compression-cli + npx nx test-ci @lightprotocol/zk-compression-cli - name: Display prover logs on failure if: failure() diff --git a/.github/workflows/forester-tests.yml b/.github/workflows/forester-tests.yml index ddaf015326..d06f72c76b 100644 --- a/.github/workflows/forester-tests.yml +++ b/.github/workflows/forester-tests.yml @@ -43,7 +43,7 @@ jobs: test: name: Forester e2e test runs-on: warp-ubuntu-latest-x64-4x - timeout-minutes: 45 + timeout-minutes: 60 services: redis: @@ -66,12 +66,7 @@ jobs: uses: ./.github/actions/setup-and-build with: skip-components: "redis" - - - name: Clean build artifacts before tests - shell: bash - run: | - cargo clean - rm -rf target/debug/deps/* + cache-suffix: "rust" - name: Check available disk space shell: bash @@ -79,17 +74,8 @@ jobs: df -h / du -sh /home/runner/work/* | sort -hr | head -n 10 - - name: Build CLI - run: | - source ./scripts/devenv.sh - npx nx build @lightprotocol/zk-compression-cli - - - name: Build test program - run: | - source ./scripts/devenv.sh - cargo test-sbf -p create-address-test-program + - name: Build CLI (CI mode - Linux x64 only) + run: npx nx build-ci @lightprotocol/zk-compression-cli - name: Test - run: | - source ./scripts/devenv.sh - cargo test --package forester e2e_test -- --nocapture + run: cargo test --package forester e2e_test -- --nocapture diff --git a/.github/workflows/js-v2.yml b/.github/workflows/js-v2.yml index a89621b6d4..5208ca36f1 100644 --- a/.github/workflows/js-v2.yml +++ b/.github/workflows/js-v2.yml @@ -43,51 +43,60 @@ jobs: - name: Checkout sources uses: actions/checkout@v4 - - name: Cache nx - uses: actions/cache@v4 - with: - path: | - .nx/cache - node_modules/.cache/nx - key: nx-js-v2-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml', 'nx.json') }} - restore-keys: | - nx-js-v2-${{ runner.os }}- - - name: Setup and build uses: ./.github/actions/setup-and-build with: - skip-components: "redis" + skip-components: "redis,disk-cleanup" + cache-suffix: "js" - name: Build stateless.js with V2 run: | - source ./scripts/devenv.sh cd js/stateless.js pnpm build:v2 - name: Build compressed-token with V2 run: | - source ./scripts/devenv.sh cd js/compressed-token pnpm build:v2 - - name: Build CLI + - name: Build CLI (CI mode - Linux x64 only) run: | - source ./scripts/devenv.sh - npx nx build @lightprotocol/zk-compression-cli + npx nx build-ci @lightprotocol/zk-compression-cli - name: Run stateless.js tests with V2 run: | - source ./scripts/devenv.sh - npx nx test @lightprotocol/stateless.js + echo "Running stateless.js tests with retry logic (max 2 attempts)..." + attempt=1 + max_attempts=2 + until npx nx test-ci @lightprotocol/stateless.js; do + attempt=$((attempt + 1)) + if [ $attempt -gt $max_attempts ]; then + echo "Tests failed after $max_attempts attempts" + exit 1 + fi + echo "Attempt $attempt/$max_attempts failed, retrying..." + sleep 5 + done + echo "Tests passed on attempt $attempt" - name: Run compressed-token tests with V2 run: | - source ./scripts/devenv.sh - npx nx test @lightprotocol/compressed-token + echo "Running compressed-token tests with retry logic (max 2 attempts)..." + attempt=1 + max_attempts=2 + until npx nx test-ci @lightprotocol/compressed-token; do + attempt=$((attempt + 1)) + if [ $attempt -gt $max_attempts ]; then + echo "Tests failed after $max_attempts attempts" + exit 1 + fi + echo "Attempt $attempt/$max_attempts failed, retrying..." + sleep 5 + done + echo "Tests passed on attempt $attempt" - name: Run sdk-anchor-test TypeScript tests with V2 run: | - source ./scripts/devenv.sh npx nx build @lightprotocol/sdk-anchor-test cd sdk-tests/sdk-anchor-test npm run test-ts diff --git a/.github/workflows/js.yml b/.github/workflows/js.yml index 077ddfa0d0..7fffa4ad6d 100644 --- a/.github/workflows/js.yml +++ b/.github/workflows/js.yml @@ -43,44 +43,54 @@ jobs: - name: Checkout sources uses: actions/checkout@v4 - - name: Cache nx - uses: actions/cache@v4 - with: - path: | - .nx/cache - node_modules/.cache/nx - key: nx-js-v1-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml', 'nx.json') }} - restore-keys: | - nx-js-v1-${{ runner.os }}- - - name: Setup and build uses: ./.github/actions/setup-and-build with: - skip-components: "redis" + skip-components: "redis,disk-cleanup" + cache-suffix: "js" - name: Build stateless.js with V1 run: | - source ./scripts/devenv.sh cd js/stateless.js pnpm build:v1 - name: Build compressed-token with V1 run: | - source ./scripts/devenv.sh cd js/compressed-token pnpm build:v1 - - name: Build CLI + - name: Build CLI (CI mode - Linux x64 only) run: | - source ./scripts/devenv.sh - npx nx build @lightprotocol/zk-compression-cli + npx nx build-ci @lightprotocol/zk-compression-cli - name: Run stateless.js tests with V1 run: | - source ./scripts/devenv.sh - npx nx test @lightprotocol/stateless.js + echo "Running stateless.js tests with retry logic (max 2 attempts)..." + attempt=1 + max_attempts=2 + until npx nx test-ci @lightprotocol/stateless.js; do + attempt=$((attempt + 1)) + if [ $attempt -gt $max_attempts ]; then + echo "Tests failed after $max_attempts attempts" + exit 1 + fi + echo "Attempt $attempt/$max_attempts failed, retrying..." + sleep 5 + done + echo "Tests passed on attempt $attempt" - name: Run compressed-token tests with V1 run: | - source ./scripts/devenv.sh - npx nx test @lightprotocol/compressed-token + echo "Running compressed-token tests with retry logic (max 2 attempts)..." + attempt=1 + max_attempts=2 + until npx nx test-ci @lightprotocol/compressed-token; do + attempt=$((attempt + 1)) + if [ $attempt -gt $max_attempts ]; then + echo "Tests failed after $max_attempts attempts" + exit 1 + fi + echo "Attempt $attempt/$max_attempts failed, retrying..." + sleep 5 + done + echo "Tests passed on attempt $attempt" diff --git a/.github/workflows/light-system-programs-tests.yml b/.github/workflows/light-system-programs-tests.yml index 8a9d9909e4..cd4c0f73e0 100644 --- a/.github/workflows/light-system-programs-tests.yml +++ b/.github/workflows/light-system-programs-tests.yml @@ -55,24 +55,25 @@ jobs: strategy: matrix: include: - - program: account-compression - sub-tests: '["cargo-test-sbf -p account-compression-test"]' - - program: light-system-program - sub-tests: '["cargo-test-sbf -p system-test"]' - - program: light-registry - sub-tests: '["cargo-test-sbf -p registry-test"]' - - program: light-compressed-token - sub-tests: '["cargo-test-sbf -p compressed-token-test"]' + - program: account-compression-and-registry + sub-tests: '["cargo-test-sbf -p account-compression-test", "cargo-test-sbf -p registry-test"]' + - program: light-system-program-address + sub-tests: '["cargo-test-sbf -p system-test -- test_with_address"]' + - program: light-system-program-compression + sub-tests: '["cargo-test-sbf -p system-test -- test_with_compression", "cargo-test-sbf -p system-test --test test_re_init_cpi_account"]' + - program: compressed-token-and-e2e + sub-tests: '["cargo-test-sbf -p compressed-token-test -- --skip test_transfer_with_photon_and_batched_tree", "cargo-test-sbf -p e2e-test"]' + - program: compressed-token-batched-tree + sub-tests: '["cargo-test-sbf -p compressed-token-test -- test_transfer_with_photon_and_batched_tree"]' - program: system-cpi-test - sub-tests: '["cargo-test-sbf -p system-cpi-test", "cargo test -p light-system-program-pinocchio"]' - - program: system-cpi-test-v2-event - sub-tests: '["cargo-test-sbf -p system-cpi-v2-test -- event::parse"]' - - program: system-cpi-test-v2-functional - sub-tests: '["cargo-test-sbf -p system-cpi-v2-test -- functional_"]' - - program: system-cpi-test-v2-other - sub-tests: '["cargo-test-sbf -p system-cpi-v2-test -- --skip functional_ --skip event::parse"]' - - program: random-e2e-test - sub-tests: '["cargo-test-sbf -p e2e-test"]' + sub-tests: + '["cargo-test-sbf -p system-cpi-test", "cargo test -p light-system-program-pinocchio", + "cargo-test-sbf -p system-cpi-v2-test -- --skip functional_ --skip event::parse", "cargo-test-sbf -p system-cpi-v2-test -- event::parse" + ]' + - program: system-cpi-test-v2-functional-read-only + sub-tests: '["cargo-test-sbf -p system-cpi-v2-test -- functional_read_only"]' + - program: system-cpi-test-v2-functional-account-infos + sub-tests: '["cargo-test-sbf -p system-cpi-v2-test -- functional_account_infos"]' steps: - name: Checkout sources uses: actions/checkout@v4 @@ -80,31 +81,41 @@ jobs: - name: Setup and build uses: ./.github/actions/setup-and-build with: - skip-components: "redis" + skip-components: "redis,disk-cleanup" + cache-suffix: "system-programs" - - name: Build CLI + - name: Build CLI (CI mode - Linux x64 only) run: | - source ./scripts/devenv.sh - npx nx build @lightprotocol/zk-compression-cli - - - name: build-programs - run: | - source ./scripts/devenv.sh - npx nx build @lightprotocol/programs - npx nx build @lightprotocol/program-tests + npx nx build-ci @lightprotocol/zk-compression-cli - name: ${{ matrix.program }} run: | - source ./scripts/devenv.sh IFS=',' read -r -a sub_tests <<< "${{ join(fromJSON(matrix['sub-tests']), ', ') }}" for subtest in "${sub_tests[@]}" do echo "$subtest" - RUSTFLAGS="-D warnings" eval "$subtest" - if [ "$subtest" == "cargo-test-sbf -p e2e-test" ]; then - pnpm --filter @lightprotocol/programs run build-compressed-token-small - RUSTFLAGS="-D warnings" eval "$subtest -- --test test_10_all" + # Retry logic for flaky batched-tree test + if [[ "$subtest" == *"test_transfer_with_photon_and_batched_tree"* ]]; then + echo "Running flaky test with retry logic (max 3 attempts)..." + attempt=1 + max_attempts=3 + until RUSTFLAGS="-D warnings" eval "$subtest"; do + attempt=$((attempt + 1)) + if [ $attempt -gt $max_attempts ]; then + echo "Test failed after $max_attempts attempts" + exit 1 + fi + echo "Attempt $attempt/$max_attempts failed, retrying..." + sleep 5 + done + echo "Test passed on attempt $attempt" + else + RUSTFLAGS="-D warnings" eval "$subtest" + if [ "$subtest" == "cargo-test-sbf -p e2e-test" ]; then + pnpm --filter @lightprotocol/programs run build-compressed-token-small + RUSTFLAGS="-D warnings" eval "$subtest -- --test test_10_all" + fi fi done diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 5657f8c9f1..88f3d325b1 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -28,11 +28,12 @@ jobs: - name: Setup and build uses: ./.github/actions/setup-and-build + with: + skip-components: "proving-keys,redis,disk-cleanup" - name: Run linters run: | set -euxo pipefail - source ./scripts/devenv.sh rustup install nightly rustup target add x86_64-unknown-linux-gnu --toolchain nightly rustup component add --toolchain nightly rustfmt diff --git a/.github/workflows/release-pr-validation.yml b/.github/workflows/release-pr-validation.yml index 92290ffa26..127d94a137 100644 --- a/.github/workflows/release-pr-validation.yml +++ b/.github/workflows/release-pr-validation.yml @@ -27,4 +27,4 @@ jobs: toolchain: stable - name: Validate packages for publishing - run: ./scripts/validate-packages.sh + run: ./scripts/release/validate-packages.sh diff --git a/.github/workflows/release-rust.yml b/.github/workflows/release-rust.yml index 15e1387b92..56862ac5ae 100644 --- a/.github/workflows/release-rust.yml +++ b/.github/workflows/release-rust.yml @@ -44,7 +44,7 @@ jobs: echo "=========================================" echo "Phase 1: Validation (dry-run)" echo "=========================================" - ./scripts/validate-packages.sh "$BASE_SHA" "$HEAD_SHA" + ./scripts/release/validate-packages.sh "$BASE_SHA" "$HEAD_SHA" - name: Publish packages to crates.io env: @@ -56,7 +56,7 @@ jobs: echo "=========================================" echo "Phase 2: Publishing (atomic)" echo "=========================================" - ./scripts/validate-packages.sh --execute "$BASE_SHA" "$HEAD_SHA" + ./scripts/release/validate-packages.sh --execute "$BASE_SHA" "$HEAD_SHA" - name: Create GitHub releases env: @@ -70,7 +70,7 @@ jobs: echo "=========================================" # Detect packages that were published - PACKAGES_STRING=$(./scripts/detect-version-changes.sh "$BASE_SHA" "$HEAD_SHA") + PACKAGES_STRING=$(./scripts/release/detect-version-changes.sh "$BASE_SHA" "$HEAD_SHA") read -ra PACKAGES <<< "$PACKAGES_STRING" for pkg in "${PACKAGES[@]}"; do diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index e6c2b8ccc1..c2097d3e6e 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -34,10 +34,6 @@ jobs: strategy: matrix: group: - - name: concurrent-merkle-tree - packages: light-concurrent-merkle-tree - test_cmd: | - cargo test -p light-concurrent-merkle-tree - name: batched-merkle-tree-simulate packages: light-batched-merkle-tree batched-merkle-tree-test test_cmd: | @@ -46,7 +42,7 @@ jobs: - 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-verifier light-merkle-tree-metadata light-zero-copy light-hash-set light-concurrent-merkle-tree test_cmd: | cargo test -p light-macros cargo test -p aligned-sized @@ -63,6 +59,7 @@ jobs: 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 - name: program-libs-slow packages: light-bloom-filter light-indexed-merkle-tree batched-merkle-tree-test test_cmd: | @@ -92,14 +89,13 @@ jobs: - name: Setup and build uses: ./.github/actions/setup-and-build with: - skip-components: "redis" + skip-components: "redis,disk-cleanup" + cache-suffix: "rust" - - name: Build CLI + - name: Build CLI (CI mode - Linux x64 only) run: | - source ./scripts/devenv.sh - npx nx build @lightprotocol/zk-compression-cli + npx nx build-ci @lightprotocol/zk-compression-cli - name: Run tests for ${{ matrix.group.name }} run: | - source ./scripts/devenv.sh ${{ matrix.group.test_cmd }} diff --git a/.github/workflows/sdk-tests.yml b/.github/workflows/sdk-tests.yml index b8eacc3129..07961016ba 100644 --- a/.github/workflows/sdk-tests.yml +++ b/.github/workflows/sdk-tests.yml @@ -52,7 +52,7 @@ jobs: - program: sdk-anchor-test-program sub-tests: '["cargo-test-sbf -p sdk-anchor-test", "cargo-test-sbf -p sdk-pinocchio-v1-test", "cargo-test-sbf -p sdk-pinocchio-v2-test"]' - program: sdk-libs - packages: light-sdk-macros light-sdk light-program-test light-client batched-merkle-tree-test + packages: light-sdk-macros light-sdk light-program-test light-client test_cmd: | cargo test -p light-sdk-macros cargo test -p light-sdk-macros --all-features @@ -68,18 +68,16 @@ jobs: - name: Setup and build uses: ./.github/actions/setup-and-build with: - skip-components: "redis" + skip-components: "redis,disk-cleanup" + cache-suffix: "sdk-tests" - - name: build-programs + - name: Build CLI (CI mode - Linux x64 only) run: | - source ./scripts/devenv.sh - npx nx build @lightprotocol/programs + npx nx build-ci @lightprotocol/zk-compression-cli - name: Run sub-tests for ${{ matrix.program }} if: matrix.sub-tests != null run: | - source ./scripts/devenv.sh - npx nx build @lightprotocol/zk-compression-cli IFS=',' read -r -a sub_tests <<< "${{ join(fromJSON(matrix.sub-tests), ', ') }}" for subtest in "${sub_tests[@]}" @@ -91,6 +89,4 @@ jobs: - name: Run tests for ${{ matrix.program }} if: matrix.test_cmd != null run: | - source ./scripts/devenv.sh - npx nx build @lightprotocol/zk-compression-cli ${{ matrix.test_cmd }} diff --git a/cli/package.json b/cli/package.json index d53ab27813..e16a60c05c 100644 --- a/cli/package.json +++ b/cli/package.json @@ -110,9 +110,11 @@ }, "scripts": { "add-bins": "./scripts/copyLocalProgramBinaries.sh && scripts/buildProver.sh", + "add-bins-ci": "./scripts/copyLocalProgramBinaries.sh && scripts/buildProver.sh --ci", "add-bins-release": "./scripts/copyLocalProgramBinaries.sh && scripts/buildProver.sh --release-only", "postinstall": "[ -d ./bin ] && find ./bin -type f -exec chmod +x {} + || echo 'No bin directory found, skipping chmod'", "build": "shx rm -rf dist && pnpm tsc -p tsconfig.json && pnpm tsc -p tsconfig.test.json && pnpm add-bins", + "build-ci": "shx rm -rf dist && pnpm tsc -p tsconfig.json && pnpm tsc -p tsconfig.test.json && pnpm add-bins-ci", "build-release": "shx rm -rf dist && pnpm tsc -p tsconfig.json && pnpm tsc -p tsconfig.test.json && pnpm add-bins-release", "format": "pnpm prettier --write \"src/**/*.{ts,js}\" \"test/**/*.{ts,js}\" -w", "format:check": "pnpm prettier \"src/**/*{ts,js}\" \"test/**/*.{ts,js}\" --check", @@ -138,6 +140,7 @@ "kill": "killall solana-test-validator || true && killall solana-test-val || true && sleep 1", "test-cli": "pnpm test-config && pnpm kill", "test": "pnpm kill && pnpm test-cli && pnpm test-utils && pnpm test-create-mint && pnpm test-mint-to && pnpm test-transfer && pnpm test-merge-token-accounts && pnpm test-create-token-pool && pnpm test-compress-spl && pnpm test-decompress-spl && pnpm test-token-balance && pnpm test-compress-sol && pnpm test-balance && pnpm test-decompress-sol && pnpm test-approve-and-mint-to && pnpm test-test-validator", + "test-ci": "pnpm kill && pnpm test-cli && pnpm test-utils && pnpm test-create-mint && pnpm test-mint-to && pnpm test-transfer && pnpm test-merge-token-accounts && pnpm test-create-token-pool && pnpm test-compress-spl && pnpm test-decompress-spl && pnpm test-token-balance && pnpm test-compress-sol && pnpm test-balance && pnpm test-decompress-sol && pnpm test-approve-and-mint-to && pnpm test-test-validator", "install-local": "pnpm build && pnpm global remove @lightprotocol/zk-compression-cli || true && pnpm global add $PWD", "version": "oclif readme && git add README.md" }, @@ -162,6 +165,26 @@ "{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": [] } } } diff --git a/cli/scripts/buildProver.sh b/cli/scripts/buildProver.sh index 17f0513626..4bffd6c0ea 100755 --- a/cli/scripts/buildProver.sh +++ b/cli/scripts/buildProver.sh @@ -8,15 +8,20 @@ build_prover() { # Parse command line arguments RELEASE_ONLY=false -while [[ $# -gt 0 ]]; do +CI_MODE=false +while [ $# -gt 0 ]; do case $1 in --release-only) RELEASE_ONLY=true shift ;; + --ci) + CI_MODE=true + shift + ;; *) echo "Unknown option: $1" - echo "Usage: $0 [--release-only]" + echo "Usage: $0 [--release-only] [--ci]" exit 1 ;; esac @@ -76,14 +81,21 @@ fi cd "$gnark_dir" -# Windows -build_prover windows amd64 "$out_dir"/prover-windows-x64.exe -build_prover windows arm64 "$out_dir"/prover-windows-arm64.exe +if [ "$CI_MODE" = true ]; then + echo "CI mode: Building only Linux x64 prover" + # Linux x64 only (for CI) + build_prover linux amd64 "$out_dir"/prover-linux-x64 +else + echo "Building all prover binaries for release" + # Windows + build_prover windows amd64 "$out_dir"/prover-windows-x64.exe + build_prover windows arm64 "$out_dir"/prover-windows-arm64.exe -# MacOS -build_prover darwin amd64 "$out_dir"/prover-darwin-x64 -build_prover darwin arm64 "$out_dir"/prover-darwin-arm64 + # MacOS + build_prover darwin amd64 "$out_dir"/prover-darwin-x64 + build_prover darwin arm64 "$out_dir"/prover-darwin-arm64 -# Linux -build_prover linux amd64 "$out_dir"/prover-linux-x64 -build_prover linux arm64 "$out_dir"/prover-linux-arm64 + # Linux + build_prover linux amd64 "$out_dir"/prover-linux-x64 + build_prover linux arm64 "$out_dir"/prover-linux-arm64 +fi diff --git a/js/compressed-token/package.json b/js/compressed-token/package.json index 664f916e91..cc39208a27 100644 --- a/js/compressed-token/package.json +++ b/js/compressed-token/package.json @@ -113,6 +113,8 @@ "build:v2": "LIGHT_PROTOCOL_VERSION=V2 pnpm build:stateless:v2 && LIGHT_PROTOCOL_VERSION=V2 pnpm build:bundle", "build:stateless:v1": "cd ../stateless.js && pnpm build:v1", "build:stateless:v2": "cd ../stateless.js && pnpm build:v2", + "build-ci": "if [ \"$LIGHT_PROTOCOL_VERSION\" = \"V2\" ]; then LIGHT_PROTOCOL_VERSION=V2 pnpm build:bundle; else LIGHT_PROTOCOL_VERSION=V1 pnpm build:bundle; fi", + "test-ci": "pnpm test", "format": "prettier --write .", "lint": "eslint ." }, @@ -131,6 +133,12 @@ "{workspaceRoot}/target/idl", "{workspaceRoot}/target/types" ] + }, + "build-ci": { + "dependsOn": ["@lightprotocol/stateless.js:build-ci"] + }, + "test-ci": { + "dependsOn": ["@lightprotocol/stateless.js:test-ci"] } } } diff --git a/js/stateless.js/package.json b/js/stateless.js/package.json index 1776502509..1e25bec9ce 100644 --- a/js/stateless.js/package.json +++ b/js/stateless.js/package.json @@ -114,6 +114,8 @@ "build:bundle": "rimraf dist && rollup -c", "build:v1": "LIGHT_PROTOCOL_VERSION=V1 pnpm build:bundle", "build:v2": "LIGHT_PROTOCOL_VERSION=V2 pnpm build:bundle", + "build-ci": "if [ \"$LIGHT_PROTOCOL_VERSION\" = \"V2\" ]; then LIGHT_PROTOCOL_VERSION=V2 pnpm build:bundle; else LIGHT_PROTOCOL_VERSION=V1 pnpm build:bundle; fi", + "test-ci": "pnpm test", "format": "prettier --write .", "lint": "eslint ." }, @@ -125,6 +127,12 @@ "{workspaceRoot}/target/idl", "{workspaceRoot}/target/types" ] + }, + "build-ci": { + "dependsOn": [] + }, + "test-ci": { + "dependsOn": [] } } } diff --git a/package.json b/package.json index 8fb8053a03..6428d48bec 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,6 @@ "nx": "^20.8.1", "playwright": "^1.55.1", "prettier": "^3.6.2", - "snarkjs": "^0.7.5", "syncpack": "^13.0.4", "typescript": "^5.9.3" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a291499d2c..0c21d46fab 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,9 +20,6 @@ importers: prettier: specifier: ^3.6.2 version: 3.6.2 - snarkjs: - specifier: ^0.7.5 - version: 0.7.5 syncpack: specifier: ^13.0.4 version: 13.0.4(typescript@5.9.3) @@ -1160,12 +1157,6 @@ packages: resolution: {integrity: sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==} engines: {node: '>=18.18'} - '@iden3/bigarray@0.0.2': - resolution: {integrity: sha512-Xzdyxqm1bOFF6pdIsiHLLl3HkSLjbhqJHVyqaTxXt3RqXBEnmsUmEW47H7VOi/ak7TdkRpNkxjyK5Zbkm+y52g==} - - '@iden3/binfileutils@0.0.12': - resolution: {integrity: sha512-naAmzuDufRIcoNfQ1d99d7hGHufLA3wZSibtr4dMe6ZeiOPV1KwOZWTJ1YVz4HbaWlpDuzVU72dS4ATQS4PXBQ==} - '@inquirer/ansi@1.0.0': resolution: {integrity: sha512-JWaTfCxI1eTmJ1BIv86vUfjVatOdxwD0DAVKYevY8SazeUUZtW+tNbsdejVO1GYE0GXJW1N1ahmiC3TFd+7wZA==} engines: {node: '>=18'} @@ -2525,9 +2516,6 @@ packages: axios@1.9.0: resolution: {integrity: sha512-re4CqKTJaURpzbLHtIi6XpDv20/CnpXOtjRY5/CU32L8gU8ek9UIivcfvSWvmKEngmVbrUtPpdDwWDWL7DNHvg==} - b4a@1.6.7: - resolution: {integrity: sha512-OnAYlL5b7LEkALw87fUVafQw5rVR9RjwGd4KUwNQ6DrrNmaVaUCgLipfVlzrPQ4tWOR9P0IXGNOx50jYCCdSJg==} - balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} @@ -2548,10 +2536,6 @@ packages: resolution: {integrity: sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==} engines: {node: '>= 0.8'} - bfj@7.1.0: - resolution: {integrity: sha512-I6MMLkn+anzNdCUp9hMRyui1HaNEUCco50lxbvNS4+EyXg8lN3nJ48PjPWtbH8UVS9CuMoaKE9U2V3l29DaRQw==} - engines: {node: '>= 8.0.0'} - bigint-buffer@1.1.5: resolution: {integrity: sha512-trfYco6AoZ+rKhKnxA0hgX0HAbVP/s808/EuDSe2JDzUnCp/xAsli35Orvk67UrTEcwuxZqYZDmfA2RXJgxVvA==} engines: {node: '>= 10.0.0'} @@ -2569,12 +2553,6 @@ packages: bl@4.1.0: resolution: {integrity: sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==} - blake2b-wasm@2.4.0: - resolution: {integrity: sha512-S1kwmW2ZhZFFFOghcx73+ZajEfKBqhP82JMssxtLVMxlaPea1p9uoLiUZ5WYyHn0KddwbLc+0vh4wR0KBNoT5w==} - - bluebird@3.7.2: - resolution: {integrity: sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==} - bn.js@4.12.0: resolution: {integrity: sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==} @@ -2761,9 +2739,6 @@ packages: resolution: {integrity: sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==} engines: {node: '>= 16'} - check-types@11.2.3: - resolution: {integrity: sha512-+67P1GkJRaxQD6PKK0Et9DhwQB+vGg3PM5+aavopCpZT1lj9jeqfvpgTLAWErNj8qApkkmXlu/Ug74kmhagkXg==} - chokidar@3.5.3: resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==} engines: {node: '>= 8.10.0'} @@ -2779,10 +2754,6 @@ packages: cipher-base@1.0.4: resolution: {integrity: sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==} - circom_runtime@0.1.28: - resolution: {integrity: sha512-ACagpQ7zBRLKDl5xRZ4KpmYIcZDUjOiNRuxvXLqhnnlLSVY1Dbvh73TI853nqoR0oEbihtWmMSjgc5f+pXf/jQ==} - hasBin: true - clean-stack@3.0.1: resolution: {integrity: sha512-lR9wNiMRcVQjSB3a7xXGLuz4cr4wJuuXlaAEbRutGowQTmlp7R72/DOgN21e8jdwblMWl9UOJMJXarX94pzKdg==} engines: {node: '>=10'} @@ -3273,11 +3244,6 @@ packages: resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} engines: {node: '>=10'} - escodegen@1.14.3: - resolution: {integrity: sha512-qFcX0XJkdg+PB3xjZZG/wKSuT1PnQWx57+TVSjIMmILd2yC/6ByYElPwJnslDsuWuSAp4AwJGumarAAmJch5Kw==} - engines: {node: '>=4.0'} - hasBin: true - eslint-compat-utils@0.5.1: resolution: {integrity: sha512-3z3vFexKIEnjHE3zCMRo6fn/e44U7T1khUjg+Hp0ZQMCigh28rALD0nPFBcGZuiLC5rLZa2ubQHDRln09JfU2Q==} engines: {node: '>=12'} @@ -3381,11 +3347,6 @@ packages: resolution: {integrity: sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - esprima@1.2.2: - resolution: {integrity: sha512-+JpPZam9w5DuJ3Q67SqsMGtiHKENSMRVoxvArfJZK01/BfLEObtZ6orJa/MtoGNR/rfMgp5837T41PAmTwAv/A==} - engines: {node: '>=0.4.0'} - hasBin: true - esprima@4.0.1: resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} engines: {node: '>=4'} @@ -3399,10 +3360,6 @@ packages: resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==} engines: {node: '>=4.0'} - estraverse@4.3.0: - resolution: {integrity: sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==} - engines: {node: '>=4.0'} - estraverse@5.3.0: resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==} engines: {node: '>=4.0'} @@ -3468,9 +3425,6 @@ packages: fastestsmallesttextencoderdecoder@1.0.22: resolution: {integrity: sha512-Pb8d48e+oIuY4MaM64Cd7OW1gt4nxCHs7/ddPPZ/Ic3sg8yVGM7O9wDvZ7us6ScaUupzM+pfBolwtYhN1IxBIw==} - fastfile@0.0.20: - resolution: {integrity: sha512-r5ZDbgImvVWCP0lA/cGNgQcZqR+aYdFx3u+CtJqUE510pBUVGMn4ulL/iRTI4tACTYsNJ736uzFxEBXesPAktA==} - fastq@1.15.0: resolution: {integrity: sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==} @@ -3487,9 +3441,6 @@ packages: resolution: {integrity: sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==} engines: {node: ^12.20 || >= 14.13} - ffjavascript@0.3.0: - resolution: {integrity: sha512-l7sR5kmU3gRwDy8g0Z2tYBXy5ttmafRPFOqY7S6af5cq51JqJWt5eQ/lSR/rs2wQNbDYaYlQr5O+OSUf/oMLoQ==} - ffjavascript@0.3.1: resolution: {integrity: sha512-4PbK1WYodQtuF47D4pRI5KUg3Q392vuP5WjE1THSnceHdXwU3ijaoS0OqxTzLknCtz4Z2TtABzkBdBdMn3B/Aw==} @@ -3847,10 +3798,6 @@ packages: hmac-drbg@1.0.1: resolution: {integrity: sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==} - hoopy@0.1.4: - resolution: {integrity: sha512-HRcs+2mr52W0K+x8RzcLzuPPmVIKMSv97RGHy0Ea9y/mpcaK+xTrjICA04KAHi4GRzxliNqNJEFYWHghy3rSfQ==} - engines: {node: '>= 6.0.0'} - hosted-git-info@7.0.1: resolution: {integrity: sha512-+K84LB1DYwMHoHSgaOY/Jfhw3ucPmSET5v98Ke/HdNSw4a0UktWzyW1mjhjpuxxTqOOsfWT/7iVshHmVZ4IpOA==} engines: {node: ^16.14.0 || >=18.0.0} @@ -4265,9 +4212,6 @@ packages: joi@17.11.0: resolution: {integrity: sha512-NgB+lZLNoqISVy1rZocE9PZI36bL/77ie924Ri43yEvi9GUUMPeyVIr8KdFTMUlby1p0PBYMk9spIxEUQYqrJQ==} - js-sha3@0.8.0: - resolution: {integrity: sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==} - js-tokens@4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} @@ -4324,9 +4268,6 @@ packages: resolution: {integrity: sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==} engines: {'0': node >= 0.2.0} - jsonpath@1.1.1: - resolution: {integrity: sha512-l6Cg7jRpixfbgoWgkrl77dgEj8RPvND0wMH6TwQmi9Qs4TFfS9u5cUFnbeKTwj5ga5Y3BTGGNI28k117LJ009w==} - keyv@4.5.4: resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==} @@ -4334,10 +4275,6 @@ packages: resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==} engines: {node: '>=6'} - levn@0.3.0: - resolution: {integrity: sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA==} - engines: {node: '>= 0.8.0'} - levn@0.4.1: resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==} engines: {node: '>= 0.8.0'} @@ -4371,9 +4308,6 @@ packages: resolution: {integrity: sha512-i24m8rpwhmPIS4zscNzK6MSEhk0DUWa/8iYQWxhffV8jkI4Phvs3F+quL5xvS0gdQR0FyTCMMH33Y78dDTzzIw==} engines: {node: '>=18'} - logplease@1.2.15: - resolution: {integrity: sha512-jLlHnlsPSJjpwUfcNyUxXCl33AYg2cHhIf9QhGL2T4iPT0XPB+xP1LRKFPgIg1M/sg9kAJvy94w9CzBNrfnstA==} - loose-envify@1.4.0: resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==} hasBin: true @@ -4544,9 +4478,6 @@ packages: resolution: {integrity: sha512-WWdIxpyjEn+FhQJQQv9aQAYlHoNVdzIzUySNV1gHUPDSdZJ3yZn7pAAbQcV7B56Mvu881q9FZV+0Vx2xC44VWA==} engines: {node: ^18.17.0 || >=20.5.0} - nanoassert@2.0.0: - resolution: {integrity: sha512-7vO7n28+aYO4J+8w96AzhmU8G+Y/xpPDJz/se19ICsqj/momRbb9mh9ZUtkoJ5X3nTnPdhEJyc0qnM6yAsHBaA==} - nanoid@3.3.1: resolution: {integrity: sha512-n6Vs/3KGyxPQd6uO0eH4Bv0ojGSUvuLlIHtC3Y0kEO23YRge8H9x1GCzLn28YX0H66pMkxuaeESFq4tKISKwdw==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} @@ -4780,10 +4711,6 @@ packages: resolution: {integrity: sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==} hasBin: true - optionator@0.8.3: - resolution: {integrity: sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==} - engines: {node: '>= 0.8.0'} - optionator@0.9.4: resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==} engines: {node: '>= 0.8.0'} @@ -4946,10 +4873,6 @@ packages: resolution: {integrity: sha512-6oz2beyjc5VMn/KV1pPw8fliQkhBXrVn1Z3TVyqZxU8kZpzEKhBdmCFqI6ZbmGtamQvQGuU1sgPTk8ZrXDD7jQ==} engines: {node: ^10 || ^12 || >=14} - prelude-ls@1.1.2: - resolution: {integrity: sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==} - engines: {node: '>= 0.8.0'} - prelude-ls@1.2.1: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} @@ -5014,9 +4937,6 @@ packages: resolution: {integrity: sha512-AAFUA5O1d83pIHEhJwWCq/RQcRukCkn/NSm2QsTEMle5f2hP0ChI2+3Xb051PZCkLryI/Ir1MVKviT2FIloaTQ==} engines: {node: '>=12'} - r1csfile@0.0.48: - resolution: {integrity: sha512-kHRkKUJNaor31l05f2+RFzvcH5XSa7OfEfd/l4hzjte6NL6fjRkSMfZ4BjySW9wmfdwPOtq3mXurzPvPGEf5Tw==} - randombytes@2.1.0: resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==} @@ -5343,10 +5263,6 @@ packages: snake-case@3.0.4: resolution: {integrity: sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg==} - snarkjs@0.7.5: - resolution: {integrity: sha512-h+3c4rXZKLhLuHk4LHydZCk/h5GcNvk5GjVKRRkHmfb6Ntf8gHOA9zea3g656iclRuhqQ3iKDWFgiD9ypLrKiA==} - hasBin: true - sort-object-keys@1.1.3: resolution: {integrity: sha512-855pvK+VkU7PaKYPc+Jjnmt4EzejQHyhhF33q31qG8x7maDzkeFhAAThdCYay11CISO+qAMwjOBP+fPZe0IPyg==} @@ -5391,9 +5307,6 @@ packages: stackback@0.0.2: resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} - static-eval@2.0.2: - resolution: {integrity: sha512-N/D219Hcr2bPjLxPiV+TQE++Tsmrady7TqAJugLy7Xk1EumfDWS/f5dtBbkRCGE7wKKXuYockQoj8Rm2/pVKyg==} - std-env@3.7.0: resolution: {integrity: sha512-JPbdCEQLj1w5GilpiHAx3qJvFndqybBysA3qUOnznweH4QbNYUsW/ea8QzSrnh0vNsezMMw5bcVool8lM0gwzg==} @@ -5572,9 +5485,6 @@ packages: tr46@0.0.3: resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} - tryer@1.0.1: - resolution: {integrity: sha512-c3zayb8/kWWpycWYg87P71E1S1ZL6b6IJxfb5fvsUgsf0S2MVGaDhDXXjDMpdCpfWXqptc+4mXwmiy1ypXqRAA==} - ts-api-utils@1.3.0: resolution: {integrity: sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==} engines: {node: '>=16'} @@ -5640,10 +5550,6 @@ packages: tweetnacl@1.0.3: resolution: {integrity: sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==} - type-check@0.3.2: - resolution: {integrity: sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==} - engines: {node: '>= 0.8.0'} - type-check@0.4.0: resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} engines: {node: '>= 0.8.0'} @@ -5729,9 +5635,6 @@ packages: resolution: {integrity: sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw==} engines: {node: '>= 0.4'} - underscore@1.12.1: - resolution: {integrity: sha512-hEQt0+ZLDVUMhebKxL4x1BTtDY7bavVofhZ9KZ4aI26X9SRaE+Y3m83XUL1UP2jn8ynjndwCCpEHdUG+9pP1Tw==} - undici-types@6.21.0: resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==} @@ -7011,13 +6914,6 @@ snapshots: '@humanwhocodes/retry@0.4.3': {} - '@iden3/bigarray@0.0.2': {} - - '@iden3/binfileutils@0.0.12': - dependencies: - fastfile: 0.0.20 - ffjavascript: 0.3.1 - '@inquirer/ansi@1.0.0': {} '@inquirer/checkbox@4.2.4(@types/node@22.16.5)': @@ -8695,8 +8591,6 @@ snapshots: transitivePeerDependencies: - debug - b4a@1.6.7: {} - balanced-match@1.0.2: {} base-x@3.0.9: @@ -8713,14 +8607,6 @@ snapshots: dependencies: safe-buffer: 5.1.2 - bfj@7.1.0: - dependencies: - bluebird: 3.7.2 - check-types: 11.2.3 - hoopy: 0.1.4 - jsonpath: 1.1.1 - tryer: 1.0.1 - bigint-buffer@1.1.5: dependencies: bindings: 1.5.0 @@ -8739,13 +8625,6 @@ snapshots: inherits: 2.0.4 readable-stream: 3.6.2 - blake2b-wasm@2.4.0: - dependencies: - b4a: 1.6.7 - nanoassert: 2.0.0 - - bluebird@3.7.2: {} - bn.js@4.12.0: {} bn.js@5.2.1: {} @@ -8993,8 +8872,6 @@ snapshots: check-error@2.1.1: {} - check-types@11.2.3: {} - chokidar@3.5.3: dependencies: anymatch: 3.1.3 @@ -9018,10 +8895,6 @@ snapshots: inherits: 2.0.4 safe-buffer: 5.2.1 - circom_runtime@0.1.28: - dependencies: - ffjavascript: 0.3.1 - clean-stack@3.0.1: dependencies: escape-string-regexp: 4.0.0 @@ -9682,15 +9555,6 @@ snapshots: escape-string-regexp@4.0.0: {} - escodegen@1.14.3: - dependencies: - esprima: 4.0.1 - estraverse: 4.3.0 - esutils: 2.0.3 - optionator: 0.8.3 - optionalDependencies: - source-map: 0.6.1 - eslint-compat-utils@0.5.1(eslint@9.36.0): dependencies: eslint: 9.36.0 @@ -9835,8 +9699,6 @@ snapshots: acorn-jsx: 5.3.2(acorn@8.15.0) eslint-visitor-keys: 4.2.1 - esprima@1.2.2: {} - esprima@4.0.1: {} esquery@1.6.0: @@ -9847,8 +9709,6 @@ snapshots: dependencies: estraverse: 5.3.0 - estraverse@4.3.0: {} - estraverse@5.3.0: {} estree-walker@2.0.2: {} @@ -9910,8 +9770,6 @@ snapshots: fastestsmallesttextencoderdecoder@1.0.22: {} - fastfile@0.0.20: {} - fastq@1.15.0: dependencies: reusify: 1.0.4 @@ -9925,12 +9783,6 @@ snapshots: node-domexception: 1.0.0 web-streams-polyfill: 3.2.1 - ffjavascript@0.3.0: - dependencies: - wasmbuilder: 0.0.16 - wasmcurves: 0.2.2 - web-worker: 1.2.0 - ffjavascript@0.3.1: dependencies: wasmbuilder: 0.0.16 @@ -10332,8 +10184,6 @@ snapshots: minimalistic-assert: 1.0.1 minimalistic-crypto-utils: 1.0.1 - hoopy@0.1.4: {} - hosted-git-info@7.0.1: dependencies: lru-cache: 10.4.3 @@ -10786,8 +10636,6 @@ snapshots: '@sideway/formula': 3.0.1 '@sideway/pinpoint': 2.0.0 - js-sha3@0.8.0: {} - js-tokens@4.0.0: {} js-yaml@3.14.1: @@ -10829,23 +10677,12 @@ snapshots: jsonparse@1.3.1: {} - jsonpath@1.1.1: - dependencies: - esprima: 1.2.2 - static-eval: 2.0.2 - underscore: 1.12.1 - keyv@4.5.4: dependencies: json-buffer: 3.0.1 kleur@3.0.3: {} - levn@0.3.0: - dependencies: - prelude-ls: 1.1.2 - type-check: 0.3.2 - levn@0.4.1: dependencies: prelude-ls: 1.2.1 @@ -10875,8 +10712,6 @@ snapshots: chalk: 5.4.1 is-unicode-supported: 1.3.0 - logplease@1.2.15: {} - loose-envify@1.4.0: dependencies: js-tokens: 4.0.0 @@ -11056,8 +10891,6 @@ snapshots: mute-stream@2.0.0: {} - nanoassert@2.0.0: {} - nanoid@3.3.1: {} nanoid@3.3.8: {} @@ -11279,15 +11112,6 @@ snapshots: opener@1.5.2: {} - optionator@0.8.3: - dependencies: - deep-is: 0.1.4 - fast-levenshtein: 2.0.6 - levn: 0.3.0 - prelude-ls: 1.1.2 - type-check: 0.3.2 - word-wrap: 1.2.5 - optionator@0.9.4: dependencies: deep-is: 0.1.4 @@ -11462,8 +11286,6 @@ snapshots: picocolors: 1.1.1 source-map-js: 1.2.1 - prelude-ls@1.1.2: {} - prelude-ls@1.2.1: {} prettier@2.8.8: {} @@ -11514,13 +11336,6 @@ snapshots: quick-lru@6.1.2: {} - r1csfile@0.0.48: - dependencies: - '@iden3/bigarray': 0.0.2 - '@iden3/binfileutils': 0.0.12 - fastfile: 0.0.20 - ffjavascript: 0.3.0 - randombytes@2.1.0: dependencies: safe-buffer: 5.2.1 @@ -11924,19 +11739,6 @@ snapshots: dot-case: 3.0.4 tslib: 2.8.1 - snarkjs@0.7.5: - dependencies: - '@iden3/binfileutils': 0.0.12 - bfj: 7.1.0 - blake2b-wasm: 2.4.0 - circom_runtime: 0.1.28 - ejs: 3.1.10 - fastfile: 0.0.20 - ffjavascript: 0.3.1 - js-sha3: 0.8.0 - logplease: 1.2.15 - r1csfile: 0.0.48 - sort-object-keys@1.1.3: {} sort-package-json@2.15.1: @@ -11983,10 +11785,6 @@ snapshots: stackback@0.0.2: {} - static-eval@2.0.2: - dependencies: - escodegen: 1.14.3 - std-env@3.7.0: {} stdin-discarder@0.2.2: {} @@ -12189,8 +11987,6 @@ snapshots: tr46@0.0.3: {} - tryer@1.0.1: {} - ts-api-utils@1.3.0(typescript@5.9.2): dependencies: typescript: 5.9.2 @@ -12274,10 +12070,6 @@ snapshots: tweetnacl@1.0.3: {} - type-check@0.3.2: - dependencies: - prelude-ls: 1.1.2 - type-check@0.4.0: dependencies: prelude-ls: 1.2.1 @@ -12400,8 +12192,6 @@ snapshots: has-symbols: 1.1.0 which-boxed-primitive: 1.1.1 - underscore@1.12.1: {} - undici-types@6.21.0: {} unicorn-magic@0.3.0: {} diff --git a/scripts/build-verifiable.sh b/scripts/deploy/build-verifiable.sh similarity index 100% rename from scripts/build-verifiable.sh rename to scripts/deploy/build-verifiable.sh diff --git a/scripts/deploy-devnet.sh b/scripts/deploy/deploy-devnet.sh similarity index 100% rename from scripts/deploy-devnet.sh rename to scripts/deploy/deploy-devnet.sh diff --git a/scripts/deploy.sh b/scripts/deploy/deploy.sh similarity index 100% rename from scripts/deploy.sh rename to scripts/deploy/deploy.sh diff --git a/scripts/devenv/download-gnark-keys.sh b/scripts/devenv/download-gnark-keys.sh new file mode 100755 index 0000000000..52373e183c --- /dev/null +++ b/scripts/devenv/download-gnark-keys.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "${SCRIPT_DIR}/shared.sh" + +download_gnark_keys() { + local key_type=${1:-light} + ROOT_DIR="$(git rev-parse --show-toplevel)" + + if [ ! -d "${ROOT_DIR}/prover/server/proving-keys" ] || [ -z "$(ls -A "${ROOT_DIR}/prover/server/proving-keys" 2>/dev/null)" ]; then + echo "Downloading gnark keys..." + "${ROOT_DIR}/prover/server/scripts/download_keys.sh" "$key_type" + log "gnark_keys" + else + echo "Gnark keys already exist, skipping download..." + fi +} + +download_gnark_keys "$@" diff --git a/scripts/devenv/install-anchor.sh b/scripts/devenv/install-anchor.sh new file mode 100755 index 0000000000..131aed979c --- /dev/null +++ b/scripts/devenv/install-anchor.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "${SCRIPT_DIR}/shared.sh" + +install_anchor() { + local version=$(get_version "anchor") + local avm_installed=false + local anchor_correct_version=false + + export CARGO_HOME="${PREFIX}/cargo" + export PATH="${PREFIX}/cargo/bin:${PATH}" + + # Check if avm is installed + if [ -f "${PREFIX}/cargo/bin/avm" ]; then + avm_installed=true + fi + + # Check if correct Anchor version is installed + if [ -f "${PREFIX}/cargo/bin/anchor" ]; then + if anchor_version=$(${PREFIX}/cargo/bin/anchor --version 2>/dev/null); then + if echo "$anchor_version" | grep -q "$version"; then + anchor_correct_version=true + fi + fi + fi + + if [ "$avm_installed" = false ]; then + echo "Installing avm (Anchor Version Manager)..." + cargo install --git https://github.com/coral-xyz/anchor avm --locked --force + fi + + if [ "$anchor_correct_version" = false ]; then + echo "Installing Anchor ${version}..." + avm install ${version} + avm use ${version} + log "anchor" + else + echo "Anchor ${version} already installed, skipping..." + fi +} + +install_anchor diff --git a/scripts/devenv/install-dependencies.sh b/scripts/devenv/install-dependencies.sh new file mode 100755 index 0000000000..c7fa56fdb7 --- /dev/null +++ b/scripts/devenv/install-dependencies.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "${SCRIPT_DIR}/shared.sh" + +install_dependencies() { + if [ ! -d "node_modules" ] || [ -z "$(ls -A node_modules 2>/dev/null)" ]; then + echo "Installing dependencies..." + export PATH="${PREFIX}/bin:${PATH}" + pnpm install + log "dependencies" + else + echo "Dependencies already installed, skipping..." + fi +} + +install_dependencies diff --git a/scripts/devenv/install-go.sh b/scripts/devenv/install-go.sh new file mode 100755 index 0000000000..f3d889f58f --- /dev/null +++ b/scripts/devenv/install-go.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "${SCRIPT_DIR}/shared.sh" + +install_go() { + if [ ! -d "${PREFIX}/go" ] || [ ! -f "${PREFIX}/go/bin/go" ]; then + echo "Installing Go..." + local version=$(get_version "go") + local suffix=$(get_suffix "go") + local url="https://go.dev/dl/go${version}.${suffix}.tar.gz" + download "$url" "${PREFIX}/go.tar.gz" + tar -xzf "${PREFIX}/go.tar.gz" -C "${PREFIX}" + rm "${PREFIX}/go.tar.gz" + log "go" + else + echo "Go already installed, skipping..." + fi +} + +install_go diff --git a/scripts/devenv/install-jq.sh b/scripts/devenv/install-jq.sh new file mode 100755 index 0000000000..80c21fe654 --- /dev/null +++ b/scripts/devenv/install-jq.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "${SCRIPT_DIR}/shared.sh" + +install_jq() { + if [ ! -f "${PREFIX}/bin/jq" ]; then + echo "Installing jq..." + local version=$(get_version "jq") + local suffix=$(get_suffix "jq") + local url="https://github.com/jqlang/jq/releases/download/${version}/${suffix}" + download "$url" "${PREFIX}/bin/jq" + log "jq" + else + echo "jq already installed, skipping..." + fi +} + +install_jq diff --git a/scripts/devenv/install-node.sh b/scripts/devenv/install-node.sh new file mode 100755 index 0000000000..1d90c19eb5 --- /dev/null +++ b/scripts/devenv/install-node.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "${SCRIPT_DIR}/shared.sh" + +install_node() { + if [ ! -f "${PREFIX}/bin/node" ] || [ ! -f "${PREFIX}/bin/npm" ]; then + echo "Installing Node.js..." + local version=$(get_version "node") + local suffix=$(get_suffix "node") + local url="https://nodejs.org/dist/v${version}/node-v${version}-${suffix}.tar.gz" + download "$url" "${PREFIX}/node.tar.gz" + tar -xzf "${PREFIX}/node.tar.gz" -C "${PREFIX}" --strip-components 1 + rm "${PREFIX}/node.tar.gz" + log "node" + else + echo "Node.js already installed, skipping..." + fi +} + +install_node diff --git a/scripts/devenv/install-photon.sh b/scripts/devenv/install-photon.sh new file mode 100755 index 0000000000..47b01645b7 --- /dev/null +++ b/scripts/devenv/install-photon.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "${SCRIPT_DIR}/shared.sh" + +install_photon() { + local expected_version=$(get_version "photon") + local photon_installed=false + local photon_correct_version=false + + export CARGO_HOME="${PREFIX}/cargo" + export PATH="${PREFIX}/cargo/bin:${PATH}" + + if [ -f "${PREFIX}/cargo/bin/photon" ]; then + photon_installed=true + if photon_version=$(${PREFIX}/cargo/bin/photon --version 2>/dev/null); then + if echo "$photon_version" | grep -q "$expected_version"; then + photon_correct_version=true + fi + fi + fi + + if [ "$photon_installed" = false ] || [ "$photon_correct_version" = false ]; then + echo "Installing Photon indexer (version $expected_version)..." + RUSTFLAGS="-A dead-code" cargo install --git https://github.com/helius-labs/photon.git --rev ${PHOTON_COMMIT} --locked --force + log "photon" + else + echo "Photon already installed with correct version, skipping..." + fi +} + +install_photon diff --git a/scripts/devenv/install-pnpm.sh b/scripts/devenv/install-pnpm.sh new file mode 100755 index 0000000000..d85dd8c6a2 --- /dev/null +++ b/scripts/devenv/install-pnpm.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "${SCRIPT_DIR}/shared.sh" + +install_pnpm() { + if [ ! -f "${PREFIX}/bin/pnpm" ]; then + echo "Installing pnpm..." + local version=$(get_version "pnpm") + local suffix=$(get_suffix "pnpm") + local url="https://github.com/pnpm/pnpm/releases/download/v${version}/pnpm-${suffix}" + download "$url" "${PREFIX}/bin/pnpm" + chmod +x "${PREFIX}/bin/pnpm" + log "pnpm" + else + echo "pnpm already installed, skipping..." + fi +} + +install_pnpm diff --git a/scripts/devenv/install-redis.sh b/scripts/devenv/install-redis.sh new file mode 100755 index 0000000000..bce6c4caa2 --- /dev/null +++ b/scripts/devenv/install-redis.sh @@ -0,0 +1,147 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "${SCRIPT_DIR}/shared.sh" + +install_redis() { + if [ ! -f "${PREFIX}/bin/redis-server" ] || [ ! -f "${PREFIX}/bin/redis-cli" ]; then + echo "Installing Redis..." + local version=$(get_version "redis") + local url="http://download.redis.io/releases/redis-${version}.tar.gz" + + if ! command -v make >/dev/null 2>&1; then + echo "Warning: 'make' not found. Redis installation requires build tools." + if [ "$OS" = "Darwin" ]; then + echo "Please install Xcode command line tools: xcode-select --install" + elif [ "$OS" = "Linux" ]; then + echo "Please install build essentials (Ubuntu: apt-get install build-essential)" + fi + echo "Skipping Redis installation..." + return + fi + + curl -sSL --retry 5 --retry-delay 10 "$url" | tar -xz -C "${PREFIX}" + cd "${PREFIX}/redis-${version}" + + make PREFIX="${PREFIX}" install >/dev/null 2>&1 + + cd "${PREFIX}" + rm -rf "redis-${version}" + + REDIS_PERSISTENT_DIR="${PREFIX}/var/redis" + mkdir -p "${REDIS_PERSISTENT_DIR}" + mkdir -p "${PREFIX}/etc" + + cat > "${PREFIX}/etc/redis.conf" << EOF +port 6379 +bind 127.0.0.1 +save 900 1 +save 300 10 +save 60 10000 +stop-writes-on-bgsave-error no +rdbcompression yes +rdbchecksum yes +dbfilename dump.rdb +dir ${REDIS_PERSISTENT_DIR} +maxmemory 256mb +maxmemory-policy allkeys-lru +EOF + + mkdir -p "${PREFIX}/bin" + cat > "${PREFIX}/bin/redis-start" << 'EOF' +#!/bin/bash +REDIS_DIR="$(cd "$(dirname "$(dirname "$0")")" && pwd)" +REDIS_CONF="${REDIS_DIR}/etc/redis.conf" +REDIS_PID="${REDIS_DIR}/var/redis.pid" +REDIS_LOG="${REDIS_DIR}/var/redis.log" + +mkdir -p "${REDIS_DIR}/var" + +if [ -f "$REDIS_PID" ] && kill -0 "$(cat "$REDIS_PID")" 2>/dev/null; then + echo "Redis is already running (PID: $(cat "$REDIS_PID"))" + exit 0 +fi + +echo "Starting Redis server..." +"${REDIS_DIR}/bin/redis-server" "$REDIS_CONF" \ + --daemonize yes \ + --pidfile "$REDIS_PID" \ + --logfile "$REDIS_LOG" + +if [ $? -eq 0 ]; then + echo "Redis started successfully" + echo " - PID: $(cat "$REDIS_PID")" + echo " - Config: $REDIS_CONF" + echo " - Log: $REDIS_LOG" + echo " - Connection: redis://localhost:6379" +else + echo "Failed to start Redis" + exit 1 +fi +EOF + + cat > "${PREFIX}/bin/redis-stop" << 'EOF' +#!/bin/bash +REDIS_DIR="$(cd "$(dirname "$(dirname "$0")")" && pwd)" +REDIS_PID="${REDIS_DIR}/var/redis.pid" + +if [ ! -f "$REDIS_PID" ]; then + echo "Redis PID file not found. Redis may not be running." + exit 1 +fi + +PID=$(cat "$REDIS_PID") +if kill -0 "$PID" 2>/dev/null; then + echo "Stopping Redis (PID: $PID)..." + kill "$PID" + + for i in {1..10}; do + if ! kill -0 "$PID" 2>/dev/null; then + rm -f "$REDIS_PID" + echo "Redis stopped successfully" + exit 0 + fi + sleep 1 + done + + echo "Forcing Redis shutdown..." + kill -9 "$PID" 2>/dev/null + rm -f "$REDIS_PID" + echo "Redis stopped" +else + echo "Redis process not found" + rm -f "$REDIS_PID" +fi +EOF + + cat > "${PREFIX}/bin/redis-status" << 'EOF' +#!/bin/bash +REDIS_DIR="$(cd "$(dirname "$(dirname "$0")")" && pwd)" +REDIS_PID="${REDIS_DIR}/var/redis.pid" + +if [ -f "$REDIS_PID" ] && kill -0 "$(cat "$REDIS_PID")" 2>/dev/null; then + PID=$(cat "$REDIS_PID") + echo "Redis is running (PID: $PID)" + echo "Connection: redis://localhost:6379" + + if command -v "${REDIS_DIR}/bin/redis-cli" >/dev/null 2>&1; then + if "${REDIS_DIR}/bin/redis-cli" ping >/dev/null 2>&1; then + echo "Status: HEALTHY" + else + echo "Status: UNHEALTHY (process running but not responding)" + fi + fi +else + echo "Redis is not running" +fi +EOF + + chmod +x "${PREFIX}/bin/redis-start" "${PREFIX}/bin/redis-stop" "${PREFIX}/bin/redis-status" + mkdir -p "${PREFIX}/etc" "${PREFIX}/var" + log "redis" + else + echo "Redis already installed, skipping..." + fi +} + +install_redis diff --git a/scripts/devenv/install-rust.sh b/scripts/devenv/install-rust.sh new file mode 100755 index 0000000000..53bb8b0cf6 --- /dev/null +++ b/scripts/devenv/install-rust.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "${SCRIPT_DIR}/shared.sh" + +install_rust() { + if [ ! -d "${PREFIX}/rustup" ] || [ ! -d "${PREFIX}/cargo" ] || [ ! -f "${PREFIX}/cargo/bin/cargo" ]; then + echo "Installing Rust..." + export RUSTUP_HOME="${PREFIX}/rustup" + export CARGO_HOME="${PREFIX}/cargo" + curl --retry 5 --retry-delay 10 --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path + export PATH="${PREFIX}/cargo/bin:${PATH}" + rustup install ${RUST_VERSION} nightly + rustup component add --toolchain ${RUST_VERSION} clippy + log "rust" + else + echo "Rust already installed, skipping..." + fi +} + +install_rust diff --git a/scripts/devenv/install-solana.sh b/scripts/devenv/install-solana.sh new file mode 100755 index 0000000000..24bb75dd22 --- /dev/null +++ b/scripts/devenv/install-solana.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "${SCRIPT_DIR}/shared.sh" + +install_solana() { + if [ ! -f "${PREFIX}/bin/solana" ] || [ ! -f "${PREFIX}/bin/solana-keygen" ]; then + echo "Installing Solana..." + local version=$(get_version "solana") + local suffix=$(get_suffix "solana") + local url="https://github.com/anza-xyz/agave/releases/download/v${version}/solana-release-${suffix}.tar.bz2" + download "$url" "${PREFIX}/solana-release.tar.bz2" + tar -xjf "${PREFIX}/solana-release.tar.bz2" -C "${PREFIX}/bin" --strip-components 2 + rm "${PREFIX}/solana-release.tar.bz2" + log "solana" + else + echo "Solana already installed, skipping..." + fi +} + +install_solana diff --git a/scripts/devenv/install.sh b/scripts/devenv/install.sh new file mode 100755 index 0000000000..5532b7eb16 --- /dev/null +++ b/scripts/devenv/install.sh @@ -0,0 +1,74 @@ +#!/usr/bin/env bash + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "${SCRIPT_DIR}/shared.sh" + +main() { + mkdir -p "${PREFIX}/bin" + + local key_type="light" + local reset_log=true + local skip_components="" + local force_reinstall=false + + while [[ $# -gt 0 ]]; do + case $1 in + --full-keys) + key_type="full" + shift + ;; + --no-reset) + reset_log=false + shift + ;; + --skip-components) + if [ -z "$2" ] || [[ "$2" == --* ]]; then + echo "Error: --skip-components requires a value" + exit 1 + fi + skip_components="$2" + shift 2 + ;; + --force-reinstall) + force_reinstall=true + shift + ;; + *) + echo "Unknown option: $1" + echo "Usage: $0 [--full-keys] [--no-reset] [--skip-components ] [--force-reinstall]" + echo "Components that can be skipped: go,rust,node,pnpm,solana,anchor,jq,photon,keys,dependencies,redis" + exit 1 + ;; + esac + done + + if $reset_log || $force_reinstall; then + rm -f "$INSTALL_LOG" + fi + + should_skip() { + local component=$1 + [[ ",$skip_components," == *",$component,"* ]] + } + + should_skip "go" || bash "${SCRIPT_DIR}/install-go.sh" + should_skip "rust" || bash "${SCRIPT_DIR}/install-rust.sh" + should_skip "photon" || bash "${SCRIPT_DIR}/install-photon.sh" + should_skip "node" || bash "${SCRIPT_DIR}/install-node.sh" + should_skip "pnpm" || bash "${SCRIPT_DIR}/install-pnpm.sh" + should_skip "solana" || bash "${SCRIPT_DIR}/install-solana.sh" + should_skip "anchor" || bash "${SCRIPT_DIR}/install-anchor.sh" + should_skip "jq" || bash "${SCRIPT_DIR}/install-jq.sh" + should_skip "keys" || bash "${SCRIPT_DIR}/download-gnark-keys.sh" "$key_type" + should_skip "dependencies" || bash "${SCRIPT_DIR}/install-dependencies.sh" + should_skip "redis" || bash "${SCRIPT_DIR}/install-redis.sh" + + echo "✨ Light Protocol development dependencies installed" + if [ -n "$skip_components" ]; then + echo " Skipped components: $skip_components" + fi +} + +main "$@" diff --git a/scripts/devenv/shared.sh b/scripts/devenv/shared.sh new file mode 100755 index 0000000000..203d751d0e --- /dev/null +++ b/scripts/devenv/shared.sh @@ -0,0 +1,81 @@ +#!/usr/bin/env bash + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "${SCRIPT_DIR}/versions.sh" + +export PREFIX="${PWD}/.local" +export INSTALL_LOG="${PREFIX}/.install_log" + +# Ensure PREFIX directory exists +mkdir -p "${PREFIX}/bin" + +VERSIONS=( + "go:${GO_VERSION}" + "node:${NODE_VERSION}" + "pnpm:${PNPM_VERSION}" + "solana:${SOLANA_VERSION}" + "anchor:${ANCHOR_VERSION}" + "jq:${JQ_TAG}" + "photon:${PHOTON_VERSION}" + "redis:${REDIS_VERSION}" +) + +SUFFIXES=( + "go_Darwin_x86_64:darwin-amd64" + "go_Darwin_arm64:darwin-arm64" + "go_Linux_x86_64:linux-amd64" + "go_Linux_aarch64:linux-arm64" + "node_Darwin_x86_64:darwin-x64" + "node_Darwin_arm64:darwin-arm64" + "node_Linux_x86_64:linux-x64" + "node_Linux_aarch64:linux-arm64" + "pnpm_Darwin_x86_64:macos-x64" + "pnpm_Darwin_arm64:macos-arm64" + "pnpm_Linux_x86_64:linuxstatic-x64" + "pnpm_Linux_aarch64:linuxstatic-arm64" + "solana_Darwin_x86_64:x86_64-apple-darwin" + "solana_Darwin_arm64:aarch64-apple-darwin" + "solana_Linux_x86_64:x86_64-unknown-linux-gnu" + "solana_Linux_aarch64:aarch64-unknown-linux-gnu" + "jq_Darwin_x86_64:jq-osx-amd64" + "jq_Darwin_arm64:jq-macos-arm64" + "jq_Linux_x86_64:jq-linux-amd64" + "jq_Linux_aarch64:jq-linux-arm64" +) + +export OS=$(uname) +export ARCH=$(uname -m) + +log() { echo "$1" >> "$INSTALL_LOG"; } +is_installed() { grep -q "^$1$" "$INSTALL_LOG" 2>/dev/null; } + +get_version() { + local key=$1 + for item in "${VERSIONS[@]}"; do + IFS=':' read -r k v <<< "$item" + if [ "$k" = "$key" ]; then + echo "$v" + return + fi + done + echo "unknown" +} + +get_suffix() { + local key="${1}_${OS}_${ARCH}" + for item in "${SUFFIXES[@]}"; do + IFS=':' read -r k v <<< "$item" + if [ "$k" = "$key" ]; then + echo "$v" + return + fi + done + echo "unknown" +} + +download() { + curl -sSL --retry 5 --retry-delay 10 -o "$2" "$1" + chmod +x "$2" +} diff --git a/scripts/devenv/versions.sh b/scripts/devenv/versions.sh new file mode 100755 index 0000000000..a9204c1667 --- /dev/null +++ b/scripts/devenv/versions.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +REPO_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || echo "${PWD}")" + +# Versions extracted from source files (automatic) +export RUST_VERSION=$(grep 'channel' "${REPO_ROOT}/rust-toolchain.toml" | sed 's/.*"\(.*\)".*/\1/' | cut -d'.' -f1,2) +export GO_VERSION=$(grep '^go ' "${REPO_ROOT}/prover/server/go.mod" | awk '{print $2}') +export PNPM_VERSION=$(grep 'packageManager' "${REPO_ROOT}/package.json" | sed 's/.*pnpm@\([^"]*\).*/\1/') + +# Versions to bump manually (edit below) +export NODE_VERSION="22.16.0" +export SOLANA_VERSION="2.2.15" +export ANCHOR_VERSION="0.31.1" +export JQ_VERSION="1.8.0" +export PHOTON_VERSION="0.51.0" +export PHOTON_COMMIT="ad49094e59195c664a683b7c7814e26563640d57" +export REDIS_VERSION="8.0.1" + +export ANCHOR_TAG="anchor-v${ANCHOR_VERSION}" +export JQ_TAG="jq-${JQ_VERSION}" diff --git a/scripts/install.sh b/scripts/install.sh index 33550ca51f..7a02e3702c 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -2,461 +2,6 @@ set -euo pipefail -PREFIX="${PWD}/.local" -INSTALL_LOG="${PREFIX}/.install_log" +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -# Versions -VERSIONS=( - "go:1.24.4" - "node:22.16.0" - "pnpm:10.12.1" - "solana:2.2.15" - "anchor:anchor-v0.31.1" - "jq:jq-1.8.0" - "photon:0.51.0" - "redis:8.0.1" -) - -# Architecture-specific suffixes -SUFFIXES=( - "go_Darwin_x86_64:darwin-amd64" - "go_Darwin_arm64:darwin-arm64" - "go_Linux_x86_64:linux-amd64" - "go_Linux_aarch64:linux-arm64" - "node_Darwin_x86_64:darwin-x64" - "node_Darwin_arm64:darwin-arm64" - "node_Linux_x86_64:linux-x64" - "node_Linux_aarch64:linux-arm64" - "pnpm_Darwin_x86_64:macos-x64" - "pnpm_Darwin_arm64:macos-arm64" - "pnpm_Linux_x86_64:linuxstatic-x64" - "pnpm_Linux_aarch64:linuxstatic-arm64" - "solana_Darwin_x86_64:x86_64-apple-darwin" - "solana_Darwin_arm64:aarch64-apple-darwin" - "solana_Linux_x86_64:x86_64-unknown-linux-gnu" - "solana_Linux_aarch64:aarch64-unknown-linux-gnu" - "anchor_Darwin_x86_64:macos-amd64" - "anchor_Darwin_arm64:macos-arm64" - "anchor_Linux_x86_64:linux-amd64" - "anchor_Linux_aarch64:linux-arm64" - "jq_Darwin_x86_64:jq-osx-amd64" - "jq_Darwin_arm64:jq-macos-arm64" - "jq_Linux_x86_64:jq-linux-amd64" - "jq_Linux_aarch64:jq-linux-arm64" -) - -OS=$(uname) -ARCH=$(uname -m) - -log() { echo "$1" >> "$INSTALL_LOG"; } -is_installed() { grep -q "^$1$" "$INSTALL_LOG" 2>/dev/null; } - -get_version() { - local key=$1 - for item in "${VERSIONS[@]}"; do - IFS=':' read -r k v <<< "$item" - if [ "$k" = "$key" ]; then - echo "$v" - return - fi - done - echo "unknown" -} - -get_suffix() { - local key="${1}_${OS}_${ARCH}" - for item in "${SUFFIXES[@]}"; do - IFS=':' read -r k v <<< "$item" - if [ "$k" = "$key" ]; then - echo "$v" - return - fi - done - echo "unknown" -} - -download() { - curl -sSL --retry 5 --retry-delay 10 -o "$2" "$1" - chmod +x "$2" -} - -install_go() { - # Check if Go is actually installed, not just logged - if [ ! -d "${PREFIX}/go" ] || [ ! -f "${PREFIX}/go/bin/go" ]; then - echo "Installing Go..." - local version=$(get_version "go") - local suffix=$(get_suffix "go") - local url="https://go.dev/dl/go${version}.${suffix}.tar.gz" - download "$url" "${PREFIX}/go.tar.gz" - tar -xzf "${PREFIX}/go.tar.gz" -C "${PREFIX}" - rm "${PREFIX}/go.tar.gz" - log "go" - else - echo "Go already installed, skipping..." - fi -} - -install_rust() { - # Check if Rust is actually installed - if [ ! -d "${PREFIX}/rustup" ] || [ ! -d "${PREFIX}/cargo" ] || [ ! -f "${PREFIX}/cargo/bin/cargo" ]; then - echo "Installing Rust..." - export RUSTUP_HOME="${PREFIX}/rustup" - export CARGO_HOME="${PREFIX}/cargo" - curl --retry 5 --retry-delay 10 --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path - rustup install 1.90 nightly - export PATH="${PREFIX}/cargo/bin:${PATH}" - rustup component add --toolchain 1.90-x86_64-unknown-linux-gnu clippy - cargo install cargo-expand --locked - log "rust" - else - echo "Rust already installed, skipping..." - fi -} - -install_node() { - # Check if Node is actually installed - if [ ! -f "${PREFIX}/bin/node" ] || [ ! -f "${PREFIX}/bin/npm" ]; then - echo "Installing Node.js..." - local version=$(get_version "node") - local suffix=$(get_suffix "node") - local url="https://nodejs.org/dist/v${version}/node-v${version}-${suffix}.tar.gz" - download "$url" "${PREFIX}/node.tar.gz" - tar -xzf "${PREFIX}/node.tar.gz" -C "${PREFIX}" --strip-components 1 - rm "${PREFIX}/node.tar.gz" - log "node" - else - echo "Node.js already installed, skipping..." - fi -} - -install_pnpm() { - # Check if pnpm is actually installed - if [ ! -f "${PREFIX}/bin/pnpm" ]; then - echo "Installing pnpm..." - local version=$(get_version "pnpm") - local suffix=$(get_suffix "pnpm") - local url="https://github.com/pnpm/pnpm/releases/download/v${version}/pnpm-${suffix}" - download "$url" "${PREFIX}/bin/pnpm" - chmod +x "${PREFIX}/bin/pnpm" - log "pnpm" - else - echo "pnpm already installed, skipping..." - fi -} - -install_solana() { - # Check if Solana is actually installed - if [ ! -f "${PREFIX}/bin/solana" ] || [ ! -f "${PREFIX}/bin/solana-keygen" ]; then - echo "Installing Solana..." - local version=$(get_version "solana") - local suffix=$(get_suffix "solana") - local url="https://github.com/anza-xyz/agave/releases/download/v${version}/solana-release-${suffix}.tar.bz2" - download "$url" "${PREFIX}/solana-release.tar.bz2" - tar -xjf "${PREFIX}/solana-release.tar.bz2" -C "${PREFIX}/bin" --strip-components 2 - rm "${PREFIX}/solana-release.tar.bz2" - log "solana" - else - echo "Solana already installed, skipping..." - fi -} - -install_anchor() { - # Check if Anchor is actually installed - if [ ! -f "${PREFIX}/bin/anchor" ]; then - echo "Installing Anchor..." - local version=$(get_version "anchor") - local suffix=$(get_suffix "anchor") - local url="https://github.com/Lightprotocol/binaries/releases/download/${version}/anchor-${suffix}" - download "$url" "${PREFIX}/bin/anchor" - log "anchor" - else - echo "Anchor already installed, skipping..." - fi -} - -install_jq() { - # Check if jq is actually installed - if [ ! -f "${PREFIX}/bin/jq" ]; then - echo "Installing jq..." - local version=$(get_version "jq") - local suffix=$(get_suffix "jq") - local url="https://github.com/jqlang/jq/releases/download/${version}/${suffix}" - download "$url" "${PREFIX}/bin/jq" - log "jq" - else - echo "jq already installed, skipping..." - fi -} - -install_photon() { - # Check if photon is properly installed and correct version - local expected_version=$(get_version "photon") - local photon_installed=false - local photon_correct_version=false - - export CARGO_HOME="${PREFIX}/cargo" - export PATH="${PREFIX}/cargo/bin:${PATH}" - - if [ -f "${PREFIX}/cargo/bin/photon" ]; then - photon_installed=true - # Check version - if photon_version=$(${PREFIX}/cargo/bin/photon --version 2>/dev/null); then - if echo "$photon_version" | grep -q "$expected_version"; then - photon_correct_version=true - fi - fi - fi - - if [ "$photon_installed" = false ] || [ "$photon_correct_version" = false ]; then - echo "Installing Photon indexer (version $expected_version)..." - # Use git commit for now as specified in constants.ts - # Allow dead code warnings for external dependency compilation - RUSTFLAGS="-A dead-code" cargo install --git https://github.com/helius-labs/photon.git --rev ad49094e59195c664a683b7c7814e26563640d57 --locked --force - log "photon" - else - echo "Photon already installed with correct version, skipping..." - fi -} - -download_gnark_keys() { - ROOT_DIR="$(git rev-parse --show-toplevel)" - # Always check if keys actually exist, not just the install log - if [ ! -d "${ROOT_DIR}/prover/server/proving-keys" ] || [ -z "$(ls -A "${ROOT_DIR}/prover/server/proving-keys" 2>/dev/null)" ]; then - echo "Downloading gnark keys..." - "${ROOT_DIR}/prover/server/scripts/download_keys.sh" "$1" - log "gnark_keys" - else - echo "Gnark keys already exist, skipping download..." - fi -} - -install_dependencies() { - # Check if node_modules exists and has content - if [ ! -d "node_modules" ] || [ -z "$(ls -A node_modules 2>/dev/null)" ]; then - echo "Installing dependencies..." - export PATH="${PREFIX}/bin:${PATH}" - pnpm install - log "dependencies" - else - echo "Dependencies already installed, skipping..." - fi -} - - -install_redis() { - # Check if Redis is actually installed - if [ ! -f "${PREFIX}/bin/redis-server" ] || [ ! -f "${PREFIX}/bin/redis-cli" ]; then - echo "Installing Redis..." - local version=$(get_version "redis") - local url="http://download.redis.io/releases/redis-${version}.tar.gz" - - if ! command -v make >/dev/null 2>&1; then - echo "Warning: 'make' not found. Redis installation requires build tools." - if [ "$OS" = "Darwin" ]; then - echo "Please install Xcode command line tools: xcode-select --install" - elif [ "$OS" = "Linux" ]; then - echo "Please install build essentials (Ubuntu: apt-get install build-essential)" - fi - echo "Skipping Redis installation..." - return - fi - - curl -sSL --retry 5 --retry-delay 10 "$url" | tar -xz -C "${PREFIX}" - cd "${PREFIX}/redis-${version}" - - make PREFIX="${PREFIX}" install >/dev/null 2>&1 - - cd "${PREFIX}" - rm -rf "redis-${version}" - - REDIS_PERSISTENT_DIR="${PREFIX}/var/redis" - mkdir -p "${REDIS_PERSISTENT_DIR}" - mkdir -p "${PREFIX}/etc" - - cat > "${PREFIX}/etc/redis.conf" << EOF -port 6379 -bind 127.0.0.1 -save 900 1 -save 300 10 -save 60 10000 -stop-writes-on-bgsave-error no -rdbcompression yes -rdbchecksum yes -dbfilename dump.rdb -dir ${REDIS_PERSISTENT_DIR} -maxmemory 256mb -maxmemory-policy allkeys-lru -EOF - - mkdir -p "${PREFIX}/bin" - cat > "${PREFIX}/bin/redis-start" << 'EOF' -#!/bin/bash -REDIS_DIR="$(dirname "$(dirname "$(readlink -f "$0")")")" -REDIS_CONF="${REDIS_DIR}/etc/redis.conf" -REDIS_PID="${REDIS_DIR}/var/redis.pid" -REDIS_LOG="${REDIS_DIR}/var/redis.log" - -mkdir -p "${REDIS_DIR}/var" - -if [ -f "$REDIS_PID" ] && kill -0 "$(cat "$REDIS_PID")" 2>/dev/null; then - echo "Redis is already running (PID: $(cat "$REDIS_PID"))" - exit 0 -fi - -echo "Starting Redis server..." -"${REDIS_DIR}/bin/redis-server" "$REDIS_CONF" \ - --daemonize yes \ - --pidfile "$REDIS_PID" \ - --logfile "$REDIS_LOG" - -if [ $? -eq 0 ]; then - echo "Redis started successfully" - echo " - PID: $(cat "$REDIS_PID")" - echo " - Config: $REDIS_CONF" - echo " - Log: $REDIS_LOG" - echo " - Connection: redis://localhost:6379" -else - echo "Failed to start Redis" - exit 1 -fi -EOF - - cat > "${PREFIX}/bin/redis-stop" << 'EOF' -#!/bin/bash -REDIS_DIR="$(dirname "$(dirname "$(readlink -f "$0")")")" -REDIS_PID="${REDIS_DIR}/var/redis.pid" - -if [ ! -f "$REDIS_PID" ]; then - echo "Redis PID file not found. Redis may not be running." - exit 1 -fi - -PID=$(cat "$REDIS_PID") -if kill -0 "$PID" 2>/dev/null; then - echo "Stopping Redis (PID: $PID)..." - kill "$PID" - - # Wait for graceful shutdown - for i in {1..10}; do - if ! kill -0 "$PID" 2>/dev/null; then - rm -f "$REDIS_PID" - echo "Redis stopped successfully" - exit 0 - fi - sleep 1 - done - - # Force kill if necessary - echo "Forcing Redis shutdown..." - kill -9 "$PID" 2>/dev/null - rm -f "$REDIS_PID" - echo "Redis stopped" -else - echo "Redis process not found" - rm -f "$REDIS_PID" -fi -EOF - - cat > "${PREFIX}/bin/redis-status" << 'EOF' -#!/bin/bash -REDIS_DIR="$(dirname "$(dirname "$(readlink -f "$0")")")" -REDIS_PID="${REDIS_DIR}/var/redis.pid" - -if [ -f "$REDIS_PID" ] && kill -0 "$(cat "$REDIS_PID")" 2>/dev/null; then - PID=$(cat "$REDIS_PID") - echo "Redis is running (PID: $PID)" - echo "Connection: redis://localhost:6379" - - # Test connection - if command -v "${REDIS_DIR}/bin/redis-cli" >/dev/null 2>&1; then - if "${REDIS_DIR}/bin/redis-cli" ping >/dev/null 2>&1; then - echo "Status: HEALTHY" - else - echo "Status: UNHEALTHY (process running but not responding)" - fi - fi -else - echo "Redis is not running" -fi -EOF - - chmod +x "${PREFIX}/bin/redis-start" "${PREFIX}/bin/redis-stop" "${PREFIX}/bin/redis-status" - mkdir -p "${PREFIX}/etc" "${PREFIX}/var" - log "redis" - else - echo "Redis already installed, skipping..." - fi -} - - - -main() { - mkdir -p "${PREFIX}/bin" - - # Parse command line arguments - local key_type="light" - local reset_log=true - local skip_components="" - local force_reinstall=false - - while [[ $# -gt 0 ]]; do - case $1 in - --full-keys) - key_type="full" - shift - ;; - --no-reset) - reset_log=false - shift - ;; - --skip-components) - if [ -z "$2" ] || [[ "$2" == --* ]]; then - echo "Error: --skip-components requires a value" - exit 1 - fi - skip_components="$2" - shift 2 - ;; - --force-reinstall) - force_reinstall=true - shift - ;; - *) - echo "Unknown option: $1" - echo "Usage: $0 [--full-keys] [--no-reset] [--skip-components ] [--force-reinstall]" - echo "Components that can be skipped: go,rust,node,pnpm,solana,anchor,jq,photon,keys,dependencies,redis" - exit 1 - ;; - esac - done - - if $reset_log || $force_reinstall; then - rm -f "$INSTALL_LOG" - fi - - # Helper function to check if component should be skipped - should_skip() { - local component=$1 - [[ ",$skip_components," == *",$component,"* ]] - } - - # Install components unless explicitly skipped - should_skip "go" || install_go - should_skip "rust" || install_rust - should_skip "photon" || install_photon - should_skip "node" || install_node - should_skip "pnpm" || install_pnpm - should_skip "solana" || install_solana - should_skip "anchor" || install_anchor - should_skip "jq" || install_jq - should_skip "keys" || download_gnark_keys "$key_type" - should_skip "dependencies" || install_dependencies - should_skip "redis" || install_redis - - echo "✨ Light Protocol development dependencies installed" - if [ -n "$skip_components" ]; then - echo " Skipped components: $skip_components" - fi -} - -main "$@" \ No newline at end of file +exec "${SCRIPT_DIR}/devenv/install.sh" "$@" diff --git a/scripts/bump-versions-and-publish-npm.sh b/scripts/release/bump-versions-and-publish-npm.sh similarity index 100% rename from scripts/bump-versions-and-publish-npm.sh rename to scripts/release/bump-versions-and-publish-npm.sh diff --git a/scripts/create-release-pr.sh b/scripts/release/create-release-pr.sh similarity index 100% rename from scripts/create-release-pr.sh rename to scripts/release/create-release-pr.sh diff --git a/scripts/detect-version-changes.sh b/scripts/release/detect-version-changes.sh similarity index 100% rename from scripts/detect-version-changes.sh rename to scripts/release/detect-version-changes.sh diff --git a/scripts/push-compressed-token-idl.sh b/scripts/release/push-compressed-token-idl.sh similarity index 100% rename from scripts/push-compressed-token-idl.sh rename to scripts/release/push-compressed-token-idl.sh diff --git a/scripts/push-stateless-js-idls.sh b/scripts/release/push-stateless-js-idls.sh similarity index 100% rename from scripts/push-stateless-js-idls.sh rename to scripts/release/push-stateless-js-idls.sh diff --git a/scripts/validate-packages.sh b/scripts/release/validate-packages.sh similarity index 100% rename from scripts/validate-packages.sh rename to scripts/release/validate-packages.sh