|
|
@@ -0,0 +1,153 @@
|
|
|
+# Contract
|
|
|
+
|
|
|
+<!-- toc -->
|
|
|
+
|
|
|
+Let $\t{PoseidonHash}$ be defined as in the section [PoseidonHash Function](../../crypto-schemes.md#poseidonhash-function).
|
|
|
+
|
|
|
+Let $โโ$ be defined as in the section [Pallas and Vesta](../../crypto-schemes.md#pallas-and-vesta).
|
|
|
+
|
|
|
+Let $\t{Params}_\t{DAO}, \t{Bulla}_\t{DAO}, \t{Params}_\t{Proposal}, \t{Bulla}_\t{Proposal}$ be defined as in [DAO Model](model.md).
|
|
|
+
|
|
|
+TODO: add derivepubkey fn
|
|
|
+
|
|
|
+TODO: add merkle section to crypto-schemes with merklepos, merklepath,
|
|
|
+MerkleRoot
|
|
|
+
|
|
|
+TODO: add pedersencommit
|
|
|
+
|
|
|
+TODO: need params coin
|
|
|
+
|
|
|
+TODO: document current day = $๐ฝโ$ CurrentDay
|
|
|
+
|
|
|
+## Mint
|
|
|
+
|
|
|
+### Function Params
|
|
|
+
|
|
|
+Define the DAO mint function params
|
|
|
+$$ \begin{aligned}
|
|
|
+ โฌ &โ \t{im}(\t{Bulla}_\t{DAO}) \\
|
|
|
+ \t{PK} &โ โโ
|
|
|
+\end{aligned} $$
|
|
|
+
|
|
|
+```rust
|
|
|
+{{#include ../../../../../src/contract/dao/src/model.rs:dao-mint-params}}
|
|
|
+```
|
|
|
+
|
|
|
+### Contract Statement
|
|
|
+
|
|
|
+**DAO bulla uniqueness**   whether $โฌ $ already exists. If yes then fail.
|
|
|
+
|
|
|
+Let there be a prover auxiliary witness inputs:
|
|
|
+$$ \begin{aligned}
|
|
|
+ \t{Params}_\t{DAO}.L &โ โโโ \\
|
|
|
+ \t{Params}_\t{DAO}.Q &โ โโโ \\
|
|
|
+ \t{Params}_\t{DAO}.A^\% &โ โโโ ร โโโ \\
|
|
|
+ \t{Params}_\t{DAO}.T &โ ๐ฝโ \\
|
|
|
+ x &โ ๐ฝโ \\
|
|
|
+ b_\t{DAO} &โ ๐ฝโ
|
|
|
+\end{aligned} $$
|
|
|
+
|
|
|
+Attach a proof $ฯ = \{ ๐ฏ, ๐ฑ : R(๐ฏ, ๐ฑ) = 1 \}$ such that the
|
|
|
+following relations hold:
|
|
|
+
|
|
|
+**Proof of public key ownership**   $\t{PK} = \t{DerivePubKey}(x)$.
|
|
|
+
|
|
|
+**DAO bulla integrity**   $โฌ = \t{Bulla}_\t{DAO}(\t{Params}_\t{DAO}, b_\t{DAO})$
|
|
|
+
|
|
|
+### Signatures
|
|
|
+
|
|
|
+There should be a single signature attached, which uses
|
|
|
+$\t{PK}$ as the signature public key.
|
|
|
+
|
|
|
+## Propose
|
|
|
+
|
|
|
+### Function Params
|
|
|
+
|
|
|
+Define the DAO propose function params
|
|
|
+$$ \begin{aligned}
|
|
|
+ R_\t{DAO} &โ ๐ฝโ \\
|
|
|
+ T &โ ๐ฝโ \\
|
|
|
+ ๐ซ &โ \t{im}(\t{Bulla}_\t{Proposal}) \\
|
|
|
+ \t{EncNote} &โ โ \\
|
|
|
+ ๐ข &โ \t{ProposeInput}^*
|
|
|
+\end{aligned} $$
|
|
|
+
|
|
|
+Define the DAO propose input function params
|
|
|
+$$ \begin{aligned}
|
|
|
+ \t{ProposeInput}.V &โ โโ \\
|
|
|
+ \t{ProposeInput}.R_\t{coin} &โ ๐ฝโ \\
|
|
|
+ \t{ProposeInput}.\t{PK}_ฯ &โ โโ
|
|
|
+\end{aligned} $$
|
|
|
+
|
|
|
+```rust
|
|
|
+{{#include ../../../../../src/contract/dao/src/model.rs:dao-propose-params}}
|
|
|
+```
|
|
|
+
|
|
|
+```rust
|
|
|
+{{#include ../../../../../src/contract/dao/src/model.rs:dao-propose-input-params}}
|
|
|
+```
|
|
|
+
|
|
|
+### Contract Statement
|
|
|
+
|
|
|
+Let $tโ = \t{CurrentDay} โ ๐ฝโ$ be the current day.
|
|
|
+
|
|
|
+**Valid DAO bulla merkle root**   check that $R_\t{DAO}$ is a previously
|
|
|
+seen merkle root in the DAO contract merkle roots DB.
|
|
|
+
|
|
|
+**Proposal bulla uniqueness**   whether $๐ซ $ already exists. If yes then fail.
|
|
|
+
|
|
|
+Let there be a prover auxiliary witness inputs:
|
|
|
+$$ \begin{aligned}
|
|
|
+ v &โ ๐ฝโ \\
|
|
|
+ bแตฅ &โ ๐ฝแตฅ \\
|
|
|
+ b_ฯ &โ ๐ฝโ \\
|
|
|
+ p &โ \t{Params}_\t{Proposal} \\
|
|
|
+ p_d &โ ๐ฝโ \\
|
|
|
+ d &โ \t{Params}_\t{DAO} \\
|
|
|
+ b_d &โ ๐ฝโ \\
|
|
|
+ (ฯ, ฮ ) &โ \t{MerklePos} ร \t{MerklePath} \\
|
|
|
+\end{aligned} $$
|
|
|
+Attach a proof $ฯ_\t{๐ซ }$ such that the following relations hold:
|
|
|
+
|
|
|
+**Governance token commit**   export the DAO token ID as an encrypted pedersen
|
|
|
+commit $T = \t{PedersenCommit}(d.ฯ, d.b_ฯ)$ where $T = โ_{i โ ๐ข} Tแตข$.
|
|
|
+
|
|
|
+**DAO bulla integrity**   $โฌ = \t{Bulla}_\t{DAO}(d, b_d)$
|
|
|
+
|
|
|
+**DAO existence**   $R_\t{DAO} = \t{MerkleRoot}(ฯ, ฮ , โฌ )$
|
|
|
+
|
|
|
+**Proposal bulla integrity**   $๐ซ = \t{Bulla}_\t{Proposal}(p, p_d)$
|
|
|
+where $p.tโ = tโ$.
|
|
|
+
|
|
|
+**Proposer limit threshold met**   check the proposer has supplied enough
|
|
|
+inputs that the required funds for the proposer limit set in the DAO is met.
|
|
|
+Let the total funds $v = โ_{i โ ๐ข} i.v$, then check $d.L โค v$.
|
|
|
+
|
|
|
+**Total funds value commit**   $V = \t{PedersenCommit}(v, bแตฅ)$ where
|
|
|
+$V = โ_{i โ ๐ข} i.V$. We use this to check that $v = โ_{i โ ๐ข} i.v$ as
|
|
|
+claimed in the *proposer limit threshold met* check.
|
|
|
+
|
|
|
+For each input $i โ ๐ข$,
|
|
|
+
|
|
|
+  **Valid input coins merkle root**   check that $i.R_\t{coin}$ is a
|
|
|
+previously seen merkle root in the money contract merkle roots DB.
|
|
|
+
|
|
|
+  Let there be a prover auxiliary witness inputs:
|
|
|
+$$ \begin{aligned}
|
|
|
+ x_ฯ &โ ๐ฝโ \\
|
|
|
+ c &โ \t{Params}_\t{Coin} \\
|
|
|
+ bแตฅ &โ ๐ฝแตฅ \\
|
|
|
+ b_ฯ &โ ๐ฝโ \\
|
|
|
+ (ฯแตข, ฮ แตข) &โ \t{MerklePos} ร \t{MerklePath} \\
|
|
|
+\end{aligned} $$
|
|
|
+  Attach a proof $ฯ_i$ such that the following relations hold:
|
|
|
+
|
|
|
+  **Coin value commit**   $i.V = \t{PedersenCommit}(c.v, bแตฅ)$.
|
|
|
+
|
|
|
+  **Token commit**   $T = \t{PoseidonHash}(c.ฯ, b_ฯ)$.
|
|
|
+
|
|
|
+  **Valid coin**   let $C = \t{Commit}(c)$. Check
|
|
|
+$i.R_\t{coin} = \t{MerkleRoot}(ฯแตข, ฮ แตข, C)$.
|
|
|
+
|
|
|
+  **Proof of signature public key ownership**   $i.\t{PK}_ฯ = \t{DerivePubKey}(x_ฯ)$.
|
|
|
+
|