Jelajahi Sumber

daod: fix syntax error on proof + load ZkBinary in demo.rs

lunar-mining 4 tahun lalu
induk
melakukan
ac783a105c

+ 4 - 4
bin/daod/proof/dao-vote-main.zk

@@ -12,8 +12,8 @@ contract "DaoVoteMain" {
     Scalar total_value_blind,
 
     # Is the vote yes or no
-    Base vote_option
-    Scalar vote_option_blind
+    Base vote_option,
+    Scalar vote_option_blind,
 
     # Check the inputs and this proof are for the same token
     Base gov_token_blind,
@@ -36,8 +36,8 @@ circuit "DaoVoteMain" {
 	constrain_instance(total_vote_commit_y);
 
 	# Pedersen commitment for vote value
-	vcv = ec_mul_short(total_funds, VALUE_COMMIT_VALUE);
-	vcr = ec_mul(total_funds_blind, VALUE_COMMIT_RANDOM);
+	vcv = ec_mul_short(total_value, VALUE_COMMIT_VALUE);
+	vcr = ec_mul(total_value_blind, VALUE_COMMIT_RANDOM);
 	total_value_commit = ec_add(vcv, vcr);
 	# Since total_funds_commit is a curve point, we fetch its coordinates
 	# and constrain them:

+ 2 - 0
bin/daod/src/dao_contract/mod.rs

@@ -4,6 +4,8 @@
 pub mod mint;
 // propose()
 pub mod propose;
+// vote{}
+pub mod vote;
 
 pub mod state;
 

+ 2 - 0
bin/daod/src/dao_contract/vote/mod.rs

@@ -0,0 +1,2 @@
+//pub mod validate;
+//pub mod wallet;

+ 7 - 0
bin/daod/src/demo.rs

@@ -256,6 +256,13 @@ pub async fn demo() -> Result<()> {
     let zk_dao_propose_burn_bin = ZkBinary::decode(zk_dao_propose_burn_bincode)?;
     zk_bins.add_contract("dao-propose-burn".to_string(), zk_dao_propose_burn_bin, 13);
 
+    debug!(target: "demo", "Loading dao-vote-main.zk");
+    let zk_dao_vote_main_bincode = include_bytes!("../proof/dao-vote-main.zk.bin");
+    let zk_dao_vote_main_bin = ZkBinary::decode(zk_dao_vote_main_bincode)?;
+    debug!(target: "demo", "Loading dao-vote-burn.zk");
+    let zk_dao_vote_burn_bincode = include_bytes!("../proof/dao-vote-burn.zk.bin");
+    let zk_dao_vote_burn_bin = ZkBinary::decode(zk_dao_vote_burn_bincode)?;
+
     // State for money contracts
     let cashier_signature_secret = SecretKey::random(&mut OsRng);
     let cashier_signature_public = PublicKey::from_secret(cashier_signature_secret);