cl: add type checking to InnerNote

This commit is contained in:
David Rusu 2024-05-28 23:32:32 +04:00
parent 7074a3b0a2
commit e25051b582
2 changed files with 28 additions and 1 deletions

View File

@ -43,6 +43,24 @@ class InnerNote:
nonce: Field
rand: Field # source of randomness for note commitment
def __post_init__(self):
if isinstance(self.value, int):
self.value = Field(self.value)
assert isinstance(self.value, Field), f"value is {type(self.value)}"
assert isinstance(self.unit, str), f"unit is {type(self.unit)}"
assert isinstance(
self.birth_constraint, Constraint
), f"birth_constraint is {type(self.birth_constraint)}"
assert isinstance(
self.death_constraints, list
), f"death_constraints is {type(self.death_constraints)}"
assert all(
isinstance(d, Constraint) for d in self.death_constraints
), f"{[type(d) for d in self.death_constraints]}"
assert isinstance(self.state, Field), f"state is {type(self.state)}"
assert isinstance(self.nonce, Field), f"nonce is {type(self.nonce)}"
assert isinstance(self.rand, Field), f"rand is {type(self.rand)}"
def r(self, index: int):
prf("CL_NOTE_COMM_RAND", self.rand, index)

View File

@ -1,5 +1,13 @@
* Open Issues
** provided commitment to zero may removing the blinding of the pederson commitment
Since you can subtract the randomness from the commitment to get just the binding part.
** Rename transaction randonmness to tx_rand and commitment randomness to cm_rand
Currently they are both called "rand" and it's confusing.
** Why does PartialTransaction have a "blinding"?
I believe it should only have a derived balance field.
@ -10,6 +18,7 @@ Generating the poseidon constants for the Grumpkin curve is very slow, like take
I need to pre-generate these to make the curve work.
- I tried the other large curve where the params are already generated and it is still slow. Need to dig into this.
** Solvers need the value of a note in order to solve it
@ -19,7 +28,7 @@ I need to pre-generate these to make the curve work.
- if we are to reveal partial information to solvers
we will need to blind the other leaf nodes of the tree:
Note = VALUE || UNIT || ....
Note = VALUE || UNIT || ...
com = ..root..
/ \