Skip to content

Commit e16e5c9

Browse files
committed
Create aliases to Cairo itself for the prove and verify functions
They can be used with Cairo0 and Cairo1 run and prove functions, so we should update the name to reflect that
1 parent 37f2df6 commit e16e5c9

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

lib/cairo.ex

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,10 @@ defmodule Cairo do
1515
def hello do
1616
:world
1717
end
18+
19+
@spec prove(list(byte()), list(byte())) :: {list(byte()), list(byte())}
20+
defdelegate prove(trace, memory), to: Cairo.Cairo0, as: :cairo_prove
21+
22+
@spec verify(list(byte()), list(byte())) :: boolean()
23+
defdelegate verify(proof, pub_input), to: Cairo.Cairo0, as: :cairo_verify
1824
end

test/cairo_test.exs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ defmodule NifTest do
1010
test "cairo0_api_test" do
1111
{:ok, program} = File.read("./native/cairo/fibonacci_5.json")
1212
{proof, public_input} = Cairo0.cairo0_run_and_prove(program)
13-
assert true = Cairo0.cairo_verify(proof, public_input)
13+
assert true = Cairo.verify(proof, public_input)
1414
end
1515

1616
test "cairo1_api_test" do
@@ -21,7 +21,7 @@ defmodule NifTest do
2121
)
2222

2323
# Prove and verify
24-
{proof, public_input} = Cairo0.cairo_prove(trace, memory)
25-
assert true = Cairo0.cairo_verify(proof, public_input)
24+
{proof, public_input} = Cairo.prove(trace, memory)
25+
assert true = Cairo.verify(proof, public_input)
2626
end
2727
end

0 commit comments

Comments
 (0)