Skip to content

Commit

Permalink
chore: update Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
Bisht13 committed Sep 25, 2024
1 parent 1ed3203 commit 8f42044
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 9 deletions.
39 changes: 33 additions & 6 deletions packages/prover/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,41 @@
FROM python:3.10
FROM nvidia/cuda:12.4.0-devel-ubuntu22.04

RUN apt-get update && apt-get upgrade -y
# Update the package list and install necessary dependencies
RUN apt-get update && \
apt install -y cmake build-essential pkg-config libssl-dev libgmp-dev libsodium-dev nasm git awscli gcc nodejs npm curl m4
DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends \
cmake \
build-essential \
pkg-config \
libssl-dev \
libgmp-dev \
libffi-dev \
libsodium-dev \
nasm \
git \
awscli \
gcc \
nodejs \
npm \
curl \
m4 \
python3 \
python3-pip \
python3-dev \
wget \
software-properties-common \
unzip \
&& rm -rf /var/lib/apt/lists/*

# Set Python 3 as the default python version
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1 \
&& update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1

# Node install
RUN npm install -g n
RUN n 22
RUN npm install -g yarn snarkjs
RUN git clone -b feat/body-parsing-with-audit-fix https://github.com/zkemail/ether-email-auth.git
RUN git clone -b feat/gpu https://github.com/zkemail/ether-email-auth.git
WORKDIR /ether-email-auth/packages/prover
RUN pip install -r requirements.txt
RUN cp ./circom_proofgen.sh /root
Expand All @@ -32,8 +58,9 @@ RUN yarn
RUN git submodule init
RUN git submodule update
RUN ./build_gmp.sh host
RUN mkdir build_prover && cd build_prover
RUN cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package
RUN mkdir build_prover
WORKDIR /root/rapidsnark/build_prover
RUN cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package -DNVML_LIBRARY=/usr/local/cuda-12.4/targets/x86_64-linux/lib/stubs/libnvidia-ml.so
RUN make -j$(nproc) && make install
RUN chmod +x package/bin/prover_cuda
RUN chmod +x ../package/bin/prover_cuda
WORKDIR /root
3 changes: 2 additions & 1 deletion packages/prover/circom_proofgen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ public_path="${buildDir}/rapidsnark_public_${circuitName}_${nonce}.json"

cd "${SCRIPT_DIR}"
echo "entered zk email path: ${SCRIPT_DIR}"
echo "Testing"

./email_auth_with_body_parsing_with_qp_encoding "${input_path}" "${witness_path}" | tee /dev/stderr
${SCRIPT_DIR}/email_auth_with_body_parsing_with_qp_encoding "${input_path}" "${witness_path}" 2>&1 | tee /dev/stderr
status_jswitgen=$?
echo "✓ Finished witness generation with cpp! ${status_jswitgen}"

Expand Down
12 changes: 10 additions & 2 deletions packages/prover/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import json
import logging

logger = logging.getLogger(__name__)
# logger = logging.getLogger(__name__)


def gen_email_auth_proof(nonce: str, is_local: bool, input: dict) -> dict:
Expand All @@ -19,18 +19,26 @@ def gen_email_auth_proof(nonce: str, is_local: bool, input: dict) -> dict:


def store_input(circuit_name: str, nonce: str, json_data: dict):
print("Storing input")
cur_dir = get_cur_dir()
print(f"Current dir: {cur_dir}")
build_dir = os.path.join(cur_dir, "build")
if not os.path.exists(build_dir):
os.makedirs(build_dir)
# check if build_dir exists
if not os.path.exists(build_dir):
os.makedirs(build_dir)

print(f"Build dir: {build_dir}")
json_file_path = os.path.join(
build_dir, "input_" + circuit_name + "_" + nonce + ".json"
)
print(f"Json file path: {json_file_path}")
print(f"Json data: {json_data}")
logger.info(f"Store user input to {json_file_path}")
with open(json_file_path, "w") as json_file:
json_file.write(json_data)
json_file.write(json.dumps(json_data))
print("Stored input")


def load_proof(circuit_name: str, nonce: str) -> dict:
Expand Down

0 comments on commit 8f42044

Please sign in to comment.