From 0b15fbef27db4986ffca747b05bbdcc13e36ac00 Mon Sep 17 00:00:00 2001 From: stubbsta Date: Tue, 10 Jun 2025 20:14:31 +0200 Subject: [PATCH] Verify paths --- tests/waku_rln_relay/utils_onchain.nim | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/waku_rln_relay/utils_onchain.nim b/tests/waku_rln_relay/utils_onchain.nim index 3c10fe1a4..e0b907a86 100644 --- a/tests/waku_rln_relay/utils_onchain.nim +++ b/tests/waku_rln_relay/utils_onchain.nim @@ -172,9 +172,23 @@ proc deployTestToken*( # All RLN related tests should be run from the root directory of the project let submodulePath = absolutePath("./vendor/waku-rlnv2-contract") + # Verify submodule path exists + if not dirExists(submodulePath): + error "Submodule path does not exist", submodulePath = submodulePath + return err("Submodule path does not exist: " & submodulePath) + + debug "Submodule path verified", submodulePath = submodulePath + let forgePath = getForgePath() debug "Forge path", forgePath + # Verify forge executable exists + if not fileExists(forgePath): + error "Forge executable not found", forgePath = forgePath + return err("Forge executable not found: " & forgePath) + + debug "Forge executable verified", forgePath = forgePath + let forgeCleanCmd = fmt"""cd {submodulePath} && {forgePath} clean""" debug "Forge clean command", forgeCleanCmd # get current directory @@ -315,9 +329,23 @@ proc executeForgeContractDeployScripts*( # All RLN related tests should be run from the root directory of the project let submodulePath = "./vendor/waku-rlnv2-contract" + # Verify submodule path exists + if not dirExists(submodulePath): + error "Submodule path does not exist", submodulePath = submodulePath + return err("Submodule path does not exist: " & submodulePath) + + debug "Submodule path verified", submodulePath = submodulePath + let privateKey = $pk let forgePath = getForgePath() debug "Forge path", forgePath + + # Verify forge executable exists + if not fileExists(forgePath): + error "Forge executable not found", forgePath = forgePath + return err("Forge executable not found: " & forgePath) + + debug "Forge executable verified", forgePath = forgePath debug "contract deployer account details", account = acc, privateKey = privateKey # Build the Foundry project