Skip to content

Commit

Permalink
Fix dockerfile and scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
SoraSuegami committed Oct 30, 2024
1 parent 37b9710 commit f422f4f
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 38 deletions.
18 changes: 9 additions & 9 deletions packages/contracts/script/DeployRecoveryController.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ contract Deploy is Script {
// }

// Deploy Verifier
verifier = Verifier(vm.envOr("VERIFIER", address(0)));
verifier = Verifier(vm.envOr("_VERIFIER", address(0)));
if (address(verifier) == address(0)) {
Verifier verifierImpl = new Verifier();
console.log(
Expand All @@ -102,18 +102,18 @@ contract Deploy is Script {
);
verifier = Verifier(address(verifierProxy));
console.log("Verifier deployed at: %s", address(verifier));
vm.setEnv("VERIFIER", vm.toString(address(verifier)));
// vm.setEnv("VERIFIER", vm.toString(address(verifier)));
}

// Deploy EmailAuth Implementation
emailAuthImpl = EmailAuth(vm.envOr("EMAIL_AUTH_IMPL", address(0)));
emailAuthImpl = EmailAuth(vm.envOr("_EMAIL_AUTH_IMPL", address(0)));
if (address(emailAuthImpl) == address(0)) {
emailAuthImpl = new EmailAuth();
console.log(
"EmailAuth implementation deployed at: %s",
address(emailAuthImpl)
);
vm.setEnv("EMAIL_AUTH_IMPL", vm.toString(address(emailAuthImpl)));
// vm.setEnv("EMAIL_AUTH_IMPL", vm.toString(address(emailAuthImpl)));
}

// Create RecoveryController as EmailAccountRecovery implementation
Expand All @@ -138,10 +138,10 @@ contract Deploy is Script {
"RecoveryController deployed at: %s",
address(recoveryController)
);
vm.setEnv(
"RECOVERY_CONTROLLER",
vm.toString(address(recoveryController))
);
// vm.setEnv(
// "RECOVERY_CONTROLLER",
// vm.toString(address(recoveryController))
// );
}

// Deploy SimpleWallet Implementation
Expand All @@ -164,7 +164,7 @@ contract Deploy is Script {
);
simpleWallet = SimpleWallet(payable(address(simpleWalletProxy)));
console.log("SimpleWallet deployed at: %s", address(simpleWallet));
vm.setEnv("SIMPLE_WALLET", vm.toString(address(simpleWallet)));
// vm.setEnv("SIMPLE_WALLET", vm.toString(address(simpleWallet)));
}
vm.stopBroadcast();
}
Expand Down
2 changes: 1 addition & 1 deletion packages/prover/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ WORKDIR /root/params
RUN curl https://storage.googleapis.com/circom-ether-email-auth/v2.0.1-preview/email_auth.zkey --output ./email_auth.zkey
RUN mkdir ./email_auth_cpp
WORKDIR /root/params/email_auth_cpp
RUN curl https://storage.googleapis.com/circom-ether-email-auth/v2.0.1-preview/email_auth --output ./email_auth
RUN curl https://storage.googleapis.com/circom-ether-email-auth/v2.0.1-preview/email_auth_cpp/email_auth --output ./email_auth
RUN curl https://storage.googleapis.com/circom-ether-email-auth/v2.0.1-preview/email_auth_cpp/Makefile --output ./Makefile
RUN curl https://storage.googleapis.com/circom-ether-email-auth/v2.0.1-preview/email_auth_cpp/calcwit.cpp --output ./calcwit.cpp
RUN curl https://storage.googleapis.com/circom-ether-email-auth/v2.0.1-preview/email_auth_cpp/calcwit.hpp --output ./calcwit.hpp
Expand Down
20 changes: 10 additions & 10 deletions packages/prover/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import os
import json

# import logging
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 @@ -29,7 +29,7 @@ def store_input(circuit_name: str, nonce: str, json_data: dict):
json_file_path = os.path.join(
build_dir, "input_" + circuit_name + "_" + nonce + ".json"
)
# logger.info(f"Store user input to {json_file_path}")
logger.info(f"Store user input to {json_file_path}")
with open(json_file_path, "w") as json_file:
json_file.write(json_data)
# Read the file back
Expand All @@ -44,7 +44,7 @@ def load_proof(circuit_name: str, nonce: str) -> dict:
json_file_path = os.path.join(
build_dir, "rapidsnark_proof_" + circuit_name + "_" + nonce + ".json"
)
# logger.info(f"Loading proof from {json_file_path}")
logger.info(f"Loading proof from {json_file_path}")
with open(json_file_path, "r") as json_file:
return json.loads(json_file.read())

Expand All @@ -55,7 +55,7 @@ def load_pub_signals(circuit_name: str, nonce: str) -> dict:
json_file_path = os.path.join(
build_dir, "rapidsnark_public_" + circuit_name + "_" + nonce + ".json"
)
# logger.info(f"Loading public signals from {json_file_path}")
logger.info(f"Loading public signals from {json_file_path}")
with open(json_file_path, "r") as json_file:
return json.loads(json_file.read())

Expand All @@ -64,9 +64,9 @@ def gen_proof(circuit_name: str, nonce: str, is_local: bool):
is_local_int: int = 1 if is_local else 0
cur_dir = get_cur_dir()
params_dir = os.path.join(cur_dir, "params")
# logger.info(f"Params dir: {params_dir}")
logger.info(f"Params dir: {params_dir}")
build_dir = os.path.join(cur_dir, "build")
# logger.info(f"Build dir: {build_dir}")
logger.info(f"Build dir: {build_dir}")
result = subprocess.run(
[
os.path.join(cur_dir, "circom_proofgen.sh"),
Expand All @@ -77,9 +77,9 @@ def gen_proof(circuit_name: str, nonce: str, is_local: bool):
str(is_local_int),
]
)
# logger.info(f"Proof generation result: {result.returncode}")
# if result.stderr is not None:
# logger.error(result.stderr)
logger.info(f"Proof generation result: {result.returncode}")
if result.stderr is not None:
logger.error(result.stderr)
print(result.stdout)
print(result.stderr)

Expand Down
36 changes: 18 additions & 18 deletions packages/prover/modal_server.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import modal

# import logging
# from google.cloud.logging import Client
# from google.cloud.logging.handlers import CloudLoggingHandler
# from google.cloud.logging_v2.handlers import setup_logging
# from google.oauth2 import service_account
import logging
from google.cloud.logging import Client
from google.cloud.logging.handlers import CloudLoggingHandler
from google.cloud.logging_v2.handlers import setup_logging
from google.oauth2 import service_account

app = modal.App("email-auth-prover-v1.5.2")

Expand Down Expand Up @@ -33,32 +33,32 @@ def flask_app():
)

app = Flask(__name__)
# service_account_info = json.loads(os.environ["SERVICE_ACCOUNT_JSON"])
# credentials = service_account.Credentials.from_service_account_info(
# service_account_info
# )
# logging_client = Client(project="zkairdrop", credentials=credentials)
# print(logging_client)
# handler = CloudLoggingHandler(logging_client, name="ether-email-auth-prover")
# print(handler)
# setup_logging(handler)
service_account_info = json.loads(os.environ["SERVICE_ACCOUNT_JSON"])
credentials = service_account.Credentials.from_service_account_info(
service_account_info
)
logging_client = Client(project="zkairdrop", credentials=credentials)
print(logging_client)
handler = CloudLoggingHandler(logging_client, name="ether-email-auth-prover")
print(handler)
setup_logging(handler)

@app.post("/prove/email_auth")
def prove_email_auth():
print("prove_email_auth")
req = request.get_json()
input = req["input"]
# logger = logging.getLogger(__name__)
# logger.info(req)
logger = logging.getLogger(__name__)
logger.info(req)
print(req)
nonce = random.randint(
0,
sys.maxsize,
)
# logger.info(nonce)
logger.info(nonce)
print(nonce)
proof = gen_email_auth_proof(str(nonce), False, input)
# logger.info(proof)
logger.info(proof)
print(proof)
return jsonify(proof)

Expand Down

0 comments on commit f422f4f

Please sign in to comment.