forked from Okm165/stone-prover-cairo0-verifier
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprove.py
39 lines (35 loc) · 1.54 KB
/
prove.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
31
32
33
34
35
36
37
38
39
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([
"cairo-compile fibonacci.cairo --output fibonacci_compiled.json --proof_mode",
], "Compiling fibonacci program", cwd="stone-prover/e2e_test")
log_and_run([
"cairo-run \
--program=fibonacci_compiled.json \
--layout=recursive \
--program_input=fibonacci_input.json \
--air_public_input=fibonacci_public_input.json \
--air_private_input=fibonacci_private_input.json \
--trace_file=fibonacci_trace.json \
--memory_file=fibonacci_memory.json \
--print_output \
--proof_mode",
], "Running fibonacci program", cwd="stone-prover/e2e_test")
log_and_run([
"./cpu_air_prover \
--out_file=fibonacci_proof.json \
--private_input_file=fibonacci_private_input.json \
--public_input_file=fibonacci_public_input.json \
--prover_config_file=cpu_air_prover_config.json \
--parameter_file=cpu_air_params.json \
-generate_annotations",
], "Proving fibonacci program", cwd="stone-prover/e2e_test")