Skip to content

Commit

Permalink
Implement protocol support (#942)
Browse files Browse the repository at this point in the history
* Add `dump-data` and `def-load-data` meta commands

* Add `defprotocol`, `prove-protocol` and `verify-protocol` meta commands
  • Loading branch information
arthurpaulino authored Dec 12, 2023
1 parent a58f6c3 commit ede4098
Show file tree
Hide file tree
Showing 6 changed files with 734 additions and 96 deletions.
26 changes: 26 additions & 0 deletions demo/protocol.lurk
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
;; A protocol that requires knowledge of a hash that opens to a pair such that
;; its components add up to 30. If the proof is accepted, further require that
;; the first component of the pair be greater than 10.
!(defprotocol my-protocol (hash pair)
(let ((list6 (lambda (a b c d e f) (cons a (cons b (cons c (cons d (cons e (cons f nil))))))))
(mk-open-expr (lambda (hash) (cons 'open (cons hash nil)))))
(cons
(if (= (+ (car pair) (cdr pair)) 30)
(list6 (mk-open-expr hash) nil :outermost pair nil :terminal)
nil)
(lambda () (> (car pair) 10))))
:rc 10
:descr "demo protocol")

;; This is the prover's pair, whose hash is
;; 0x09910d31a7568d66855bcc83fccc4826063dfdf93fe5e1f736c83ec892ed139e
(commit '(13 . 17))

;; Let's prove it and write the proof to the file protocol-proof
!(prove-protocol my-protocol
"protocol-proof"
0x09910d31a7568d66855bcc83fccc4826063dfdf93fe5e1f736c83ec892ed139e
'(13 . 17))

;; Now it can be verified
!(verify-protocol my-protocol "protocol-proof")
Loading

1 comment on commit ede4098

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmarks

Table of Contents

Overview

This benchmark report shows the Fibonacci GPU benchmark.
NVIDIA L4
Intel(R) Xeon(R) CPU @ 2.20GHz
125.78 GB RAM
Workflow run: https://github.com/lurk-lab/lurk-rs/actions/runs/7188163065

Benchmark Results

LEM Fibonacci Prove - rc = 100

fib-ref=a58f6c3bef1e5b9525e4d75aa4cb188f9072b237 fib-ref=ede4098c1392fc79ace065bc436728d64727cabf
num-100 2.96 s (✅ 1.00x) 3.88 s (❌ 1.31x slower)
num-200 5.95 s (✅ 1.00x) 7.73 s (❌ 1.30x slower)

LEM Fibonacci Prove - rc = 600

fib-ref=a58f6c3bef1e5b9525e4d75aa4cb188f9072b237 fib-ref=ede4098c1392fc79ace065bc436728d64727cabf
num-100 2.66 s (✅ 1.00x) 3.32 s (❌ 1.25x slower)
num-200 5.70 s (✅ 1.00x) 7.28 s (❌ 1.28x slower)

Made with criterion-table

Please sign in to comment.