Просмотр исходного кода

[doc/spec/dao] complete dao spec

ertosns 2 лет назад
Родитель
Сommit
a26850e252

+ 5 - 2
doc/src/spec/dao/dao_propose.md

@@ -1,6 +1,9 @@
 # dao propose
 # dao propose
+
 $$ X = (cm^{token}, root^{bulla}, proposal, value^{total}_x, value^{total}_y) $$
 $$ X = (cm^{token}, root^{bulla}, proposal, value^{total}_x, value^{total}_y) $$
+
 $$ W = (value^{total}, blind^{value^{total}}, blind^{token}, proposal^{destination}_x, proposal^{destination}_y, proposal^{amount}, proposal^{tokenId}, blind^{proposal}, proposerLimit, quorum, approvalRatio_{quot}, approvalRatio_{base}, tokenId, pub_x, pub_y, blind^{bulla}, pos, path) $$
 $$ W = (value^{total}, blind^{value^{total}}, blind^{token}, proposal^{destination}_x, proposal^{destination}_y, proposal^{amount}, proposal^{tokenId}, blind^{proposal}, proposerLimit, quorum, approvalRatio_{quot}, approvalRatio_{base}, tokenId, pub_x, pub_y, blind^{bulla}, pos, path) $$
+
 $$ \mathcal{L}= \{X:W\in \mathcal{R}\} $$
 $$ \mathcal{L}= \{X:W\in \mathcal{R}\} $$
 
 
 | public input               |                                               |
 | public input               |                                               |
@@ -35,5 +38,5 @@ $$ \mathcal{L}= \{X:W\in \mathcal{R}\} $$
 
 
 # circuit checks
 # circuit checks
 
 
-- $proposal^{amount} > 0 $
-- ${proposerLimit <= value^{total} $
+- $ proposal^{amount} > 0 $
+- $ proposerLimit <= value^{total} $

+ 17 - 3
doc/src/spec/dao/dao_propose_burn.md

@@ -1,10 +1,8 @@
 # dao propose burn
 # dao propose burn
 
 
-- TODO why spend hook, and data aren't constrained here?
-
 $$ X = (nullifier, cm^{value}_x, cm^{value}_y, cm^{token}, root,  signature^{public}_x, signature^{public}_y)$$
 $$ X = (nullifier, cm^{value}_x, cm^{value}_y, cm^{token}, root,  signature^{public}_x, signature^{public}_y)$$
 
 
-$$ W = (sk, sn, spendHook, data, value, tokenId, blind^{value}, blind^{token}, pos, path, signature^{secret}) $$
+$$ W = (sk, sn, spendHook[^1], data, value, tokenId, blind^{value}, blind^{token}, pos, path, signature^{secret}) $$
 
 
 $$ \mathcal{L}= \{X:W\in \mathcal{R}\} $$
 $$ \mathcal{L}= \{X:W\in \mathcal{R}\} $$
 
 
@@ -19,3 +17,19 @@ $$ \mathcal{L}= \{X:W\in \mathcal{R}\} $$
 | spendHook            | burn related contract                                   |
 | spendHook            | burn related contract                                   |
 |$signature^{public}_x$| signature public x coordinate                           |
 |$signature^{public}_x$| signature public x coordinate                           |
 |$signature^{public}_y$| signature public y coordinate                           |
 |$signature^{public}_y$| signature public y coordinate                           |
+
+| witnesses            | Description                                          |
+|----------------------|------------------------------------------------------|
+| sk                   | proposal coin secret key                             |
+| sn                   | proposal coin serial number                          |
+| spendHook            | burnt coin spendHook                                 |
+| data                 | spendHook contract input data                        |
+| value                | proposal coin value                                  |
+| tokenId              | proposal token id                                    |
+| $blind^{value}$      | proposal value commitment blinding term              |
+| $blind^{token}$      | token commitment blinding term                       |
+| pos                  | proposal coin leaf position in merkle tree           |
+| path                 | proposal coin path in merkle tree                    |
+| $signature^{secret}$ | proposal signature secret                            |
+
+[^1]: why spend hook, and data aren't constrained here?

+ 9 - 5
doc/src/spec/dao/vote.md

@@ -1,8 +1,8 @@
 # vote
 # vote
 
 
-$$ X = (cm^{token}, proposal, cm^{vote^{yes}}_x, cm^{vote^{yes}}_y, cm^{vote^{all}}_x, cm^{vote^{all}}_y )$$
+$$ X = (cm^{token}, proposal, cm^{vote^{yes}}_x, cm^{vote^{yes}}_y, cm^{vote^{all}}_x, cm^{vote^{all}}_y) $$
 
 
-$$ W = (proposal^{destination}_x, proposal^{destination}_y, proposal^{amount}, tokenId, blind^{proposal}, proposerLimit, quorum, approvalRatio_{quot}, approvalRatio_{base}, tokenId, pub_x, pub_y, blind^{bulla}, vote^{yes}, blind^{vote^{yes}}, vote^{value}, vote^{all}_{value}, blind^{vote^{all}_{value}}, blind^{token} )$$
+$$ W = (proposal^{destination}_x, proposal^{destination}_y, proposal^{amount}, tokenId, blind^{proposal}, proposerLimit, quorum, approvalRatio_{quot}, approvalRatio_{base}, tokenId, pub_x, pub_y, blind^{bulla}, vote^{yes}, blind^{vote^{yes}}, vote^{value}, vote^{all}_{value}, blind^{vote^{all}_{value}}, blind^{token}) $$
 
 
 $$ \mathcal{L}= \{X:W\in \mathcal{R}\} $$
 $$ \mathcal{L}= \{X:W\in \mathcal{R}\} $$
 
 
@@ -30,8 +30,12 @@ $$ \mathcal{L}= \{X:W\in \mathcal{R}\} $$
 | $pub_x$                    | dao public key x coordinate                            |
 | $pub_x$                    | dao public key x coordinate                            |
 | $pub_y$                    | dao public key y coordinate                            |
 | $pub_y$                    | dao public key y coordinate                            |
 | $blind^{bulla}$            | bulla commitment blinding factor                       |
 | $blind^{bulla}$            | bulla commitment blinding factor                       |
-| $vote^{yes}$               | yes vote                                               |
-| $blind^{vote^{yes}}$        | yes vote commitment blinding factor                    |
+| $vote^{yes}$               | yes vote a boolean as either 0, or 1                   |
+| $blind^{vote^{yes}}$        | yes vote commitment blinding factor                   |
 | $vote^{all}_{value}$        | all votes value                                       |
 | $vote^{all}_{value}$        | all votes value                                       |
-| $blind^{vote^{all}_{value}}$| blinding term for all votes commitments                |
+| $blind^{vote^{all}_{value}}$| blinding term for all votes commitments               |
 | $blind^{token}$             | governance token blinding term                        |
 | $blind^{token}$             | governance token blinding term                        |
+
+# circuit checks
+
+- validate that $vote^{yes}$ is either 0, or 1.

+ 19 - 5
doc/src/spec/dao/vote_burn.md

@@ -1,10 +1,8 @@
 # vote burn
 # vote burn
 
 
-- TODO why spend hook, and data aren't constrained here?
+$$ X = (nullifier, cm^{value}_x, cm^{value}_y, cm^{token}, root,  signature^{public}_x, signature^{public}_y) $$
 
 
-$$ X = (nullifier, cm^{value}_x, cm^{value}_y, cm^{token}, root,  signature^{public}_x, signature^{public}_y)$$
-
-$$ W = (sk, sn, spendHook, data, value, tokenId, blind^{value}, blind^{token}, pos, path, signature^{secret})$$
+$$ W = (sk, sn, spendHook[^1], data, value, tokenId, blind^{value}, blind^{token}, pos, path, signature^{secret}) $$
 
 
 $$ \mathcal{L}= \{X:W\in \mathcal{R}\} $$
 $$ \mathcal{L}= \{X:W\in \mathcal{R}\} $$
 
 
@@ -13,9 +11,25 @@ $$ \mathcal{L}= \{X:W\in \mathcal{R}\} $$
 | nullifier            | hash of (sk||sn)                                        |
 | nullifier            | hash of (sk||sn)                                        |
 | $cm^{value}_x$       | x coordinate of value point commitment                  |
 | $cm^{value}_x$       | x coordinate of value point commitment                  |
 | $cm^{value}_y$       | y coordinate of value point commitment                  |
 | $cm^{value}_y$       | y coordinate of value point commitment                  |
-| $cm^{token}$         | commitment of tokenId as field element                  |
+| $cm^{token}$         | commitment of governancetokenId as field element        |
 | root                 | root of commitments tree of coin commitments            |
 | root                 | root of commitments tree of coin commitments            |
 | data                 | data read during execution of burn spendHook contract   |
 | data                 | data read during execution of burn spendHook contract   |
 | spendHook            | burn related contract                                   |
 | spendHook            | burn related contract                                   |
 |$signature^{public}_x$| signature public x coordinate                           |
 |$signature^{public}_x$| signature public x coordinate                           |
 |$signature^{public}_y$| signature public y coordinate                           |
 |$signature^{public}_y$| signature public y coordinate                           |
+
+| witnesses            | Description                                          |
+|----------------------|------------------------------------------------------|
+| sk                   | proposal coin secret key                             |
+| sn                   | proposal coin serial number                          |
+| spendHook            | burnt coin spendHook                                 |
+| data                 | spendHook contract input data                        |
+| value                | proposal coin value                                  |
+| tokenId              | proposal token id                                    |
+| $blind^{value}$      | proposal value commitment blinding term              |
+| $blind^{token}$      | governance token commitment blinding term            |
+| pos                  | proposal coin leaf position in merkle tree           |
+| path                 | proposal coin path in merkle tree                    |
+| $signature^{secret}$ | proposal signature secret                            |
+
+[^1]: why spend hook, and data aren't constrained here?