Add cirdl support to the docker entrypoint

Signed-off-by: Slava <20563034+veaceslavdoina@users.noreply.github.com>
This commit is contained in:
Slava 2024-09-10 22:49:52 +03:00 committed by GitHub
parent 68daaea106
commit 5e3244c0d9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 18 additions and 0 deletions

View File

@ -50,6 +50,24 @@ if [ -n "${PRIV_KEY}" ]; then
echo "Private key set"
fi
# Circuit downloader
# cirdl [circuitPath] [rpcEndpoint] [marketplaceAddress]
if [[ "$@" == *"prover"* ]]; then
echo "Run Circuit downloader"
# Set circuits dir from CODEX_CIRCOM_* variables if set
CIRCUIT_DIR=$(dirname "${CODEX_CIRCOM_R1CS}")
if [[ "${CIRCUIT_DIR}" == "." ]]; then
CIRCUIT_DIR="${CODEX_DATA_DIR}/circuits"
export CODEX_CIRCOM_R1CS="${CIRCUIT_DIR}/proof_main.r1cs"
export CODEX_CIRCOM_WASM="${CIRCUIT_DIR}/proof_main.wasm"
export CODEX_CIRCOM_ZKEY="${CIRCUIT_DIR}/proof_main.zkey"
fi
# Download circuits
mkdir -p "${CIRCUIT_DIR}"
cirdl "${CIRCUIT_DIR}" "${CODEX_ETH_PROVIDER}" "${CODEX_MARKETPLACE_ADDRESS}"
[[ $? -ne 0 ]] && { echo "Failed to download circuit files"; exit 1; }
fi
# Run
echo "Run Codex node"
exec "$@"