forked from Okm165/stone-prover-cairo0-verifier
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathverify.py
30 lines (26 loc) · 1.26 KB
/
verify.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import subprocess
from colorama import Fore, Style
def log_and_run(commands, description, cwd=None):
full_command = " && ".join(commands)
try:
print(f"{Fore.YELLOW}Starting: {description}...{Style.RESET_ALL}")
print(f"{Fore.CYAN}Command: {full_command}{Style.RESET_ALL}")
result = subprocess.run(full_command, shell=True, check=True, cwd=cwd, text=True)
print(f"{Fore.GREEN}Success: {description} completed!\n{Style.RESET_ALL}")
except subprocess.CalledProcessError as e:
print(f"{Fore.RED}Error running command '{full_command}': {e}\n{Style.RESET_ALL}")
log_and_run([
"jq '{ proof: . }' ../stone-prover/e2e_test/fibonacci_proof.json > cairo_verifier_input.json",
], "Preparing input", cwd="cairo-lang")
log_and_run([
"cairo-compile --cairo_path=./src src/starkware/cairo/cairo_verifier/layouts/all_cairo/cairo_verifier.cairo --output cairo_verifier.json --no_debug_info",
], "Compiling verifier program", cwd="cairo-lang")
log_and_run([
"cairo-run \
--program=cairo_verifier.json \
--layout=recursive \
--program_input=cairo_verifier_input.json \
--trace_file=cairo_verifier_trace.json \
--memory_file=cairo_verifier_memory.json \
--print_output",
], "Running verifier program", cwd="cairo-lang")