Add the Bigger wrapper
This commit is contained in:
parent
65e40caea0
commit
8b2cf83bed
|
@ -0,0 +1,13 @@
|
|||
from noir_constraint import NoirConstraint, NoirProof
|
||||
|
||||
|
||||
class Bigger:
|
||||
def __init__(self, y: int):
|
||||
self.y = y
|
||||
self.noir = NoirConstraint("bigger")
|
||||
|
||||
def prove(self, x: int) -> NoirProof:
|
||||
return self.noir.prove({"x": str(x), "y": str(self.y)})
|
||||
|
||||
def verify(self, proof):
|
||||
return self.noir.verify({"y": str(self.y)}, proof)
|
|
@ -0,0 +1,14 @@
|
|||
from unittest import TestCase
|
||||
|
||||
from .bigger import Bigger
|
||||
|
||||
|
||||
class TestBigger(TestCase):
|
||||
def test_bigger(self):
|
||||
bigger = Bigger(3)
|
||||
proof = bigger.prove(5)
|
||||
bigger.verify(proof)
|
||||
|
||||
# If we try to reuse the proof for a different Bigger instance, it fails
|
||||
bigger_4 = Bigger(4)
|
||||
assert not bigger_4.verify(proof)
|
Loading…
Reference in New Issue