From 423f8fa140c06cae20ec1858a619b3980aebaa3c Mon Sep 17 00:00:00 2001 From: Sergey Timoshin Date: Mon, 16 Sep 2024 17:18:32 +0700 Subject: [PATCH] Remove Forester support from CLI scripts and test environment (#1229) This commit deletes all references and code related to Forester, including scripts, constants, and functions. This simplifies the CLI by removing support for the Forester process. Future updates will no longer include Forester-related commands or configurations. --- cli/package.json | 5 ++--- cli/scripts/copyForester.sh | 15 --------------- cli/src/commands/test-validator/index.ts | 7 ------- cli/src/utils/constants.ts | 1 - cli/src/utils/initTestEnv.ts | 16 ---------------- cli/src/utils/processForester.ts | 22 ---------------------- 6 files changed, 2 insertions(+), 64 deletions(-) delete mode 100755 cli/scripts/copyForester.sh delete mode 100644 cli/src/utils/processForester.ts diff --git a/cli/package.json b/cli/package.json index 997da49e4e..bd12e30d41 100644 --- a/cli/package.json +++ b/cli/package.json @@ -88,7 +88,7 @@ "topicSeparator": "" }, "scripts": { - "add-bins": "./scripts/copyLocalProgramBinaries.sh && ./scripts/copyForester.sh && scripts/buildProver.sh", + "add-bins": "./scripts/copyLocalProgramBinaries.sh && scripts/buildProver.sh", "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", "format": "pnpm prettier --write \"src/**/*.{ts,js}\" \"test/**/*.{ts,js}\" -w", @@ -128,8 +128,7 @@ "inputs": [ "{workspaceRoot}/js", "{workspaceRoot}/programs", - "{workspaceRoot}/gnark-prover", - "{workspaceRoot}/forester" + "{workspaceRoot}/gnark-prover" ], "outputs": [ "{workspaceRoot}/bin", diff --git a/cli/scripts/copyForester.sh b/cli/scripts/copyForester.sh deleted file mode 100755 index c0ff2daefc..0000000000 --- a/cli/scripts/copyForester.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env sh - -set -eux - -root_dir=$(git rev-parse --show-toplevel) -out_dir="$root_dir/cli/bin" -if [ ! -e "$out_dir" ]; then - mkdir -p "$out_dir" -fi - -lsof "$out_dir"/forester | awk 'NR>1 {print $2}' | xargs -r kill -9 - -cargo build --release --bin forester -cp "$root_dir/target/release/forester" "$out_dir" -cp "$root_dir/forester/forester.toml" "$out_dir" diff --git a/cli/src/commands/test-validator/index.ts b/cli/src/commands/test-validator/index.ts index eb4a5b6f2f..fa94305636 100644 --- a/cli/src/commands/test-validator/index.ts +++ b/cli/src/commands/test-validator/index.ts @@ -19,11 +19,6 @@ class SetupCommand extends Command { "Runs a test validator without starting a new prover service.", default: false, }), - "skip-forester": Flags.boolean({ - description: - "Runs a test validator without starting a new forester service.", - default: false, - }), "skip-system-accounts": Flags.boolean({ description: "Runs a test validator without initialized light system accounts.", @@ -95,7 +90,6 @@ class SetupCommand extends Command { if (flags["stop"] === true) { await stopTestEnv({ - forester: !flags["skip-forester"], indexer: !flags["skip-indexer"], prover: !flags["skip-prover"], }); @@ -103,7 +97,6 @@ class SetupCommand extends Command { } else { await initTestEnv({ checkPhotonVersion: !flags["relax-indexer-version-constraint"], - forester: !flags["skip-forester"], indexer: !flags["skip-indexer"], limitLedgerSize: flags["limit-ledger-size"], photonDatabaseUrl: flags["indexer-db-url"], diff --git a/cli/src/utils/constants.ts b/cli/src/utils/constants.ts index 25534c36fa..f5ca69c711 100644 --- a/cli/src/utils/constants.ts +++ b/cli/src/utils/constants.ts @@ -19,7 +19,6 @@ export const CARGO_GENERATE_TAG = "v0.18.4"; export const SOLANA_VALIDATOR_PROCESS_NAME = "solana-test-validator"; export const LIGHT_PROVER_PROCESS_NAME = "light-prover"; export const INDEXER_PROCESS_NAME = "photon"; -export const FORESTER_PROCESS_NAME = "forester"; export const PHOTON_VERSION = "0.45.0"; diff --git a/cli/src/utils/initTestEnv.ts b/cli/src/utils/initTestEnv.ts index 8708b6b830..1bc322b7b0 100644 --- a/cli/src/utils/initTestEnv.ts +++ b/cli/src/utils/initTestEnv.ts @@ -19,21 +19,14 @@ import { } from "./process"; import { killProver, startProver } from "./processProverServer"; import { killIndexer, startIndexer } from "./processPhotonIndexer"; -import { killForester, startForester } from "./processForester"; export async function stopTestEnv(options: { - forester: boolean; indexer: boolean; prover: boolean; }) { const processesToKill = [ { name: "photon", condition: options.indexer, killFunction: killIndexer }, { name: "prover", condition: options.prover, killFunction: killProver }, - { - name: "forester", - condition: options.forester, - killFunction: killForester, - }, { name: "test-validator", condition: true, @@ -63,7 +56,6 @@ export async function initTestEnv({ skipSystemAccounts, indexer = true, prover = true, - forester = true, rpcPort = 8899, indexerPort = 8784, proverPort = 3001, @@ -78,7 +70,6 @@ export async function initTestEnv({ skipSystemAccounts?: boolean; indexer: boolean; prover: boolean; - forester: boolean; rpcPort?: number; indexerPort?: number; proverPort?: number; @@ -128,10 +119,6 @@ export async function initTestEnv({ setConfig(config); await startProver(proverPort, proveCompressedAccounts, proveNewAddresses); } - - if (forester) { - await startForester(); - } } export async function initTestEnvIfNeeded({ @@ -139,13 +126,11 @@ export async function initTestEnvIfNeeded({ skipSystemAccounts, indexer = false, prover = false, - forester = false, }: { additionalPrograms?: { address: string; path: string }[]; skipSystemAccounts?: boolean; indexer?: boolean; prover?: boolean; - forester?: boolean; } = {}) { try { const anchorProvider = await setAnchorProvider(); @@ -159,7 +144,6 @@ export async function initTestEnvIfNeeded({ skipSystemAccounts, indexer, prover, - forester, }); } } diff --git a/cli/src/utils/processForester.ts b/cli/src/utils/processForester.ts deleted file mode 100644 index 0407cfd9ec..0000000000 --- a/cli/src/utils/processForester.ts +++ /dev/null @@ -1,22 +0,0 @@ -import path from "path"; -import { killProcess, spawnBinary } from "./process"; -import { FORESTER_PROCESS_NAME } from "./constants"; - -export async function killForester() { - await killProcess(FORESTER_PROCESS_NAME); -} - -export async function startForester() { - console.log("Killing existing forester process..."); - await killForester(); - - console.log("Starting forester..."); - spawnBinary(getForesterBinaryName(), ["subscribe"]); - console.log("Forester started successfully!"); -} - -export function getForesterBinaryName(): string { - const binDir = path.join(__dirname, "../..", "bin"); - const binaryName = path.join(binDir, "forester"); - return binaryName; -}