Skip to content

Commit

Permalink
update gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
byteZorvin committed Sep 9, 2024
1 parent 39a1802 commit bf5766a
Show file tree
Hide file tree
Showing 9 changed files with 2,462 additions and 6,077 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/target
dependencies
dependencies/
examples/*/output/
.vscode/
22 changes: 19 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Makefile for Cairo compilation and proof generation

LAYOUT ?= small
CAIRO_PROGRAM ?= examples/dummy_snos/dummy_snos.cairo

CPU_AIR_PROVER := ./dependencies/stone-prover/cpu_air_prover
CAIRO_ENV := ./dependencies/cairo-vm/cairo-vm-env/bin/activate
Expand Down Expand Up @@ -38,7 +39,7 @@ define activate_env
endef


# Check if CAIRO_PROGRAM is provided, if not, use a default value
# Check if CAIRO_PROGRAM is provided
check_program_set:
ifndef CAIRO_PROGRAM
$(error CAIRO_PROGRAM is not set. Usage: make CAIRO_PROGRAM=your_program.cairo)
Expand All @@ -47,13 +48,15 @@ endif
# Compile the program
compile: check_program_set
mkdir -p $(OUTPUT_DIR)
@echo "Compiling the program..."
$(activate_env) cairo-compile $(CAIRO_PROGRAM) \
--output $(COMPILED_OUTPUT) \
--proof_mode

@echo "Compilation Successfull !!"

# Generate the pie output
generate_pie: compile
@echo "Genrating the PIE..."
$(activate_env) cairo-run \
--program=$(COMPILED_OUTPUT) \
--layout=$(LAYOUT) \
Expand All @@ -62,19 +65,24 @@ generate_pie: compile
--trace_file=$(TRACE_FILE) \
--memory_file=$(MEMORY_FILE) \
--print_output
@echo "PIE generation Successfull !!"


# Run the program
run_pie: generate_pie
@echo "Running the prorgram with PIE..."
$(activate_env) cairo-run \
--layout=$(LAYOUT) \
--run_from_cairo_pie=$(CAIRO_PIE_OUTPUT) \
--trace_file=$(TRACE_FILE) \
--memory_file=$(MEMORY_FILE) \
--print_output \
@echo "Running with PIE Successfull !!"


# Run the program
run: compile
@echo "Running the program..."
$(activate_env) cairo-run \
--program=$(COMPILED_OUTPUT) \
--layout=$(LAYOUT) \
Expand All @@ -85,31 +93,39 @@ run: compile
--memory_file=$(MEMORY_FILE) \
--print_output \
--proof_mode

@echo "Running Successfull !!"

run_bootloader: compile
@echo "Running with bootloader..."
cargo run -- $(COMPILED_OUTPUT) $(PUBLIC_INPUT) $(PRIVATE_INPUT) $(MEMORY_FILE) $(TRACE_FILE)
node format.js $(PUBLIC_INPUT)
@echo "Running with bootloader Successfull !!"

# Generate the proof
proove_with_bootloader: run_bootloader
@echo "Running the stone-prover..."
$(CPU_AIR_PROVER) \
--generate-annotations \
--out_file=$(PROOF_FILE) \
--private_input_file=$(PRIVATE_INPUT) \
--public_input_file=$(PUBLIC_INPUT) \
--prover_config_file=$(PROVER_CONFIG) \
--parameter_file=$(PARAM_FILE)
@echo "Prooving with bootloader Successfull !!"

# Generate the proof
proove_with_program: run
@echo "Running the stone-prover..."
$(CPU_AIR_PROVER) \
--generate-annotations \
--out_file=$(PROOF_FILE) \
--private_input_file=$(PRIVATE_INPUT) \
--public_input_file=$(PUBLIC_INPUT) \
--prover_config_file=$(PROVER_CONFIG) \
--parameter_file=$(PARAM_FILE)
@echo "Prooving without bootloader Successfull !!"



# Clean up generated files
clean: check_program_set
Expand Down
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# Proof Generator

A proof generator for cairo programs. This repository uses [stone-prover](https://github.com/starkware-libs/stone-prover) under the hood to generate proofs and uses [cairo-vm](https://github.com/lambdaclass/cairo-vm) to run, compile and bootload the programs.
A proof generator for cairo programs.

### Credits

This repository uses [stone-prover](https://github.com/starkware-libs/stone-prover) under the hood to generate proofs and uses [cairo-vm](https://github.com/lambdaclass/cairo-vm) to run, compile. The bootloader is taken from [bootloader](https://github.com/Moonsong-Labs/cairo-bootloader.git) repository.

## Overview

You can genrate proofs for cairo programs here. The commands available are documented here.
You can generate proofs for cairo programs here. The commands available are documented here.
There are 2 ways to genrate proofs:

1. First bootloading the program and then proving the execution of the bootloader. This is the recommended way and generates smaller proofs. Check out a simple bootloader [here](https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/cairo/bootloaders/simple_bootloader/simple_bootloader.cairo_)
Expand All @@ -28,7 +32,7 @@ cargo build
`trace.bin`: Execution trace of the Cairo program.
`memory.bin`: Memory dump of the Cairo program execution.
`proof.json`: The generated STARK proof.
`pie.zip`: Cairo PIE (Program Indepedent Executable) that can be generated by running the program and can be used re run the file in standardised way without inputs.
`pie.zip`: Cairo PIE (Program Independent Executable) that can be generated by running the program and can be used re run the file in standardised way without inputs.
`cpu_air_prover_config.json`: Configuration file for the CPU AIR prover(stone-prover).
`cpu_air_params.json`: Parameters file for the CPU AIR prover(stone-prover).

Expand Down
Loading

0 comments on commit bf5766a

Please sign in to comment.