| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- constant "DaoExec" {
- EcFixedPointShort VALUE_COMMIT_VALUE,
- EcFixedPoint VALUE_COMMIT_RANDOM,
- }
- contract "DaoExec" {
- # proposal params
- Base proposal_dest_x,
- Base proposal_dest_y,
- Base proposal_amount,
- Base proposal_serial,
- Base proposal_token_id,
- Base proposal_blind,
- # DAO params
- Base dao_proposer_limit,
- Base dao_quorum,
- Base dao_approval_ratio,
- Base gov_token_id,
- Base dao_public_x,
- Base dao_public_y,
- Base dao_bulla_blind,
- # votes
- Base win_votes,
- Base total_votes,
- Scalar win_votes_blind,
- Scalar total_votes_blind,
-
- # outputs + inputs
- Base user_serial,
- Base user_coin_blind,
- Base dao_serial,
- Base dao_coin_blind,
- Base input_value,
- Scalar input_value_blind,
- }
- circuit "DaoExec" {
- dao_bulla = poseidon_hash(
- dao_proposer_limit,
- dao_quorum,
- dao_approval_ratio,
- gov_token_id,
- dao_public_x,
- dao_public_y,
- dao_bulla_blind,
- # @tmp-workaround
- dao_bulla_blind,
- );
- # Proposal bulla is valid means DAO bulla is also valid
- # because of dao-propose-main.zk, already checks that when
- # we first create the proposal. So it is redundant here.
- proposal_bulla = poseidon_hash(
- proposal_dest_x,
- proposal_dest_y,
- proposal_amount,
- proposal_serial,
- proposal_token_id,
- dao_bulla,
- proposal_blind,
- # @tmp-workaround
- proposal_blind,
- );
- constrain_instance(proposal_bulla);
- # Create coin0 = hash(...) and make public
- # Create coin1 = hash(...) and make public
- # Create pedersen commits for win_votes, and total_votes
- # and make public
- # Create pedersen commit for input_value and make public
-
- ####
- # Create coin 0
- # Create coin 1
- # Check values of coin 0 + coin 1 == input value
- # Check value of coin 0 == proposal_amount
- # Check public key matches too
- # Create the input value commit
- # Create the value commits
- # Check total_votes >= dao_quorum
- # Check win_votes / total_votes >= approval_ratio
- # NOTE: there is a vulnerability here where someone can create the exec
- # transaction with a bad note so it cannot be decrypted by the receiver
- # TODO: research verifiable encryption inside ZK
- }
|