cl/noir: mv noir_constraint wrapper into cl/constraints/...
This commit is contained in:
parent
5cae33a95a
commit
71ede291d2
|
@ -1,2 +1,3 @@
|
|||
from .constraint import Constraint
|
||||
from .constraint import Constraint, Proof
|
||||
|
||||
from .vacuous import Vacuous
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from dataclasses import dataclass
|
||||
|
||||
from noir_constraint import NoirConstraint, NoirProof
|
||||
from .noir_constraint import NoirConstraint, NoirProof
|
||||
|
||||
|
||||
@dataclass
|
||||
|
|
|
@ -7,7 +7,9 @@ The logic of a constraint is implemented in a ZK Circuit, and then wrapped in a
|
|||
for interacting with the rest of the the system.
|
||||
"""
|
||||
|
||||
from dataclasses import dataclass
|
||||
|
||||
class Proof:
|
||||
pass
|
||||
|
||||
|
||||
class Constraint:
|
||||
|
|
|
@ -17,7 +17,10 @@ import portalocker
|
|||
import tempfile
|
||||
import toml
|
||||
|
||||
NOIR_DIR = Path(__file__).resolve().parent / "noir"
|
||||
|
||||
from constraints import Proof
|
||||
|
||||
NOIR_DIR = Path(__file__).resolve().parent.parent / "noir"
|
||||
LOCK_FILE = NOIR_DIR / ".CL.lock"
|
||||
CONSTRAINTS_DIR = NOIR_DIR / "crates"
|
||||
|
||||
|
@ -25,7 +28,7 @@ NARGO = sh.Command("nargo")
|
|||
|
||||
|
||||
@dataclass
|
||||
class NoirProof:
|
||||
class NoirProof(Proof):
|
||||
proof: str
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
from unittest import TestCase
|
||||
|
||||
from noir_constraint import NoirConstraint
|
||||
from .noir_constraint import NoirConstraint
|
||||
|
||||
|
||||
class TestNoirCoinstraint(TestCase):
|
|
@ -1,6 +1,4 @@
|
|||
from noir_constraint import NoirProof
|
||||
|
||||
from constraints import Constraint
|
||||
from constraints import Constraint, Proof
|
||||
from crypto import Field
|
||||
|
||||
|
||||
|
@ -13,8 +11,8 @@ class Vacuous(Constraint):
|
|||
# chosen by a fair 2**64 sided die.
|
||||
return Field(14500592324922987342)
|
||||
|
||||
def prove(self) -> NoirProof:
|
||||
return NoirProof("vacuous")
|
||||
def prove(self) -> Proof:
|
||||
return Proof()
|
||||
|
||||
def verify(self, _proof: NoirProof):
|
||||
def verify(self, _proof: Proof):
|
||||
return True
|
||||
|
|
|
@ -13,6 +13,7 @@ from crypto import (
|
|||
from constraints import Constraint
|
||||
|
||||
|
||||
# TODO: is this used?
|
||||
@dataclass
|
||||
class NoteCommitment:
|
||||
cm: Field
|
||||
|
@ -20,6 +21,7 @@ class NoteCommitment:
|
|||
zero: Field
|
||||
|
||||
|
||||
# TODO: is this used?
|
||||
@dataclass
|
||||
class Nullifier:
|
||||
nf: bytes
|
||||
|
|
Loading…
Reference in New Issue