Skip to content

Commit

Permalink
Fix hash step in sonobe
Browse files Browse the repository at this point in the history
  • Loading branch information
pmikolajczyk41 committed Dec 5, 2024
1 parent 1aee719 commit cb93093
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 16 deletions.
33 changes: 23 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,33 @@ clean-circuits:
########################### BENCHMARKING ###############################################################################
########################################################################################################################

RUN_ARTIFACTS := $(foreach trans,$(TRANSFORMATIONS), runs/nova_snark/$(trans).out)
RUN_NS_ARTIFACTS := $(foreach trans,$(TRANSFORMATIONS), runs/nova_snark/$(trans).out)
RUN_SN_ARTIFACTS := $(foreach trans,$(TRANSFORMATIONS), runs/sonobe/$(trans).out)
NS_REPORT_FILE = runs/nova_snark_report.txt
SN_REPORT_FILE = runs/sonobe_report.txt

.PHONY: run-nova-snark-benchmarks
run-nova-snark-benchmarks: generate-input-data build-circuits $(RUN_ARTIFACTS)
@echo "Nova Snark Folding Times Report" > $(NS_REPORT_FILE)
@echo "-------------------------------" >> $(NS_REPORT_FILE)
@for log in $(RUN_ARTIFACTS); do \
func=$$(grep -m1 "Selected function:" $$log | sed -E 's/.*Selected function: (.*)/\1/'); \
fold_time=$$(grep "Fold input" $$log | awk '{print $$NF}'); \
echo "$$func: $$fold_time" >> $(NS_REPORT_FILE); \
done
@echo "Report saved to $(NS_REPORT_FILE)"
run-nova-snark-benchmarks: generate-input-data build-circuits $(RUN_NS_ARTIFACTS)
@$(call generate-report,$(RUN_NS_ARTIFACTS),$(NS_REPORT_FILE))

runs/nova_snark/%.out:
@mkdir -p runs/nova_snark
@cd vimz/ && $(MAKE) $* BACKEND=nova-snark DEMO=yes > ../$@

.PHONY: run-sonobe-benchmarks
run-sonobe-benchmarks: generate-input-data build-circuits $(RUN_SN_ARTIFACTS)
@$(call generate-report,$(RUN_SN_ARTIFACTS),$(SN_REPORT_FILE))

runs/sonobe/%.out:
@mkdir -p runs/sonobe
@cd vimz/ && $(MAKE) $* BACKEND=sonobe DEMO=yes LIGHT_TEST=yes > ../$@

define generate-report
> $2
for log in $1; do \
func=$$(grep -m1 "Selected function:" $$log | sed -E 's/.*Selected function: (.*)/\1/'); \
fold_time=$$(grep "Fold input" $$log | grep -v "completed" | awk '{print $$NF}' | tail -n1); \
echo "$$func: $$fold_time" >> $2; \
done
echo "Report saved to $2"
endef
2 changes: 1 addition & 1 deletion circuits/sonobe/hash_step.circom
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ template SonobeHash(width){
ivc_output <== HeadTailHasher(width)(ivc_input, external_inputs);
}

component main { public [ivc_input] } = SonobeHash(768);
component main { public [ivc_input] } = SonobeHash(128);
10 changes: 5 additions & 5 deletions circuits/sonobe/hash_step.compile_log
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
template instances: 228
non-linear constraints: 44595
template instances: 154
non-linear constraints: 7716
linear constraints: 0
public inputs: 1
private inputs: 768
private inputs: 128
public outputs: 1
wires: 45365
labels: 220186
wires: 7846
labels: 37463
Written successfully: ./hash_step.r1cs
Written successfully: ./hash_step_js/hash_step.wasm
Everything went okay

0 comments on commit cb93093

Please sign in to comment.