From 251226ae5cb6bd4c3a1d051dc64ca7ea0ebe6eba Mon Sep 17 00:00:00 2001 From: Sergey Timoshin Date: Thu, 6 Nov 2025 15:57:14 +0000 Subject: [PATCH] feat: `--grpc-port` cli flag - add `--grpc-port` flag for test-validator CLI command. - Enabled configurable logging via `RUST_LOG` for spawned processes. --- cli/src/commands/test-validator/index.ts | 6 ++++++ cli/src/utils/initTestEnv.ts | 2 +- cli/src/utils/process.ts | 4 ++++ cli/src/utils/processPhotonIndexer.ts | 3 +++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/cli/src/commands/test-validator/index.ts b/cli/src/commands/test-validator/index.ts index f201ee2e6e..10558b1c26 100644 --- a/cli/src/commands/test-validator/index.ts +++ b/cli/src/commands/test-validator/index.ts @@ -69,6 +69,12 @@ class SetupCommand extends Command { default: 8784, exclusive: ["skip-indexer"], }), + "grpc-port": Flags.integer({ + description: "Enable Photon indexer gRPC on this port.", + required: false, + default: 50051, + exclusive: ["skip-indexer"], + }), "prover-port": Flags.integer({ description: "Enable Light Prover server on this port.", required: false, diff --git a/cli/src/utils/initTestEnv.ts b/cli/src/utils/initTestEnv.ts index e28994b107..b361f52591 100644 --- a/cli/src/utils/initTestEnv.ts +++ b/cli/src/utils/initTestEnv.ts @@ -1,4 +1,3 @@ -import { airdropSol } from "@lightprotocol/stateless.js"; import { getConfig, getPayer, setAnchorProvider, setConfig } from "./utils"; import { BASE_PATH, @@ -131,6 +130,7 @@ export async function initTestEnv({ await startIndexer( `http://127.0.0.1:${rpcPort}`, indexerPort, + grpcPort, checkPhotonVersion, photonDatabaseUrl, grpcPort, diff --git a/cli/src/utils/process.ts b/cli/src/utils/process.ts index 9956b15058..ffdc4003e5 100644 --- a/cli/src/utils/process.ts +++ b/cli/src/utils/process.ts @@ -212,6 +212,10 @@ export function spawnBinary(command: string, args: string[] = []) { stdio: ["ignore", out, err], shell: false, detached: true, + env: { + ...process.env, + RUST_LOG: process.env.RUST_LOG || "debug", + }, }); spawnedProcess.on("close", async (code) => { diff --git a/cli/src/utils/processPhotonIndexer.ts b/cli/src/utils/processPhotonIndexer.ts index aa75bb37ba..7a03ebcc40 100644 --- a/cli/src/utils/processPhotonIndexer.ts +++ b/cli/src/utils/processPhotonIndexer.ts @@ -39,6 +39,7 @@ function getPhotonInstallMessage(): string { export async function startIndexer( rpcUrl: string, indexerPort: number, + grpcPort: number = 50051, checkPhotonVersion: boolean = true, photonDatabaseUrl?: string, grpcPort: number = 50051, @@ -56,6 +57,8 @@ export async function startIndexer( const args: string[] = [ "--port", indexerPort.toString(), + "--grpc-port", + grpcPort.toString(), "--rpc-url", rpcUrl, "--grpc-port",