diff --git a/bin/drk/src/main.rs b/bin/drk/src/main.rs index 8650a68ed..a12e17d83 100644 --- a/bin/drk/src/main.rs +++ b/bin/drk/src/main.rs @@ -712,8 +712,8 @@ async fn main() -> Result<()> { exit(1); } - let approval_ratio_quot = 100_u64; - let approval_ratio_base = (approval_ratio * approval_ratio_quot as f64) as u64; + let approval_ratio_base = 100_u64; + let approval_ratio_quot = (approval_ratio * approval_ratio_base as f64) as u64; let gov_token_id = TokenId::try_from(gov_token_id.as_str()).with_context(|| "Invalid Token ID")?; diff --git a/bin/drk/src/rpc_dao.rs b/bin/drk/src/rpc_dao.rs index dc71098df..0f6c886e0 100644 --- a/bin/drk/src/rpc_dao.rs +++ b/bin/drk/src/rpc_dao.rs @@ -406,7 +406,6 @@ impl Drk { let user_coin_blind = pallas::Base::random(&mut OsRng); let dao_serial = pallas::Base::random(&mut OsRng); let dao_coin_blind = pallas::Base::random(&mut OsRng); - let input_value_blind = pallas::Scalar::random(&mut OsRng); // TODO: FIXME: Clean this up and create an API let exec_signature_secret = SecretKey::random(&mut OsRng); @@ -414,7 +413,6 @@ impl Drk { let mut xfer_inputs = vec![]; let mut input_coins = vec![]; - let mut input_value_blinds = vec![]; let mut input_amount = 0; for coin in coins { input_amount += coin.note.value; @@ -427,6 +425,7 @@ impl Drk { let money_merkle_tree = self.get_money_tree().await?; let money_merkle_root = money_merkle_tree.root(0).unwrap(); + let mut input_value_blind = pallas::Scalar::from(0); for coin in &input_coins { let value_blind = pallas::Scalar::random(&mut OsRng); let sig_secret = SecretKey::random(&mut OsRng); @@ -444,7 +443,7 @@ impl Drk { signature_secret: sig_secret, }); - input_value_blinds.push(value_blind); + input_value_blind += value_blind; } let input_sum = input_coins.iter().map(|x| x.note.value).sum::(); @@ -456,8 +455,8 @@ impl Drk { value: proposal.amount, token_id: proposal.token_id, public: proposal.recipient, - serial: user_serial, - coin_blind: user_coin_blind, + serial: proposal.serial, + coin_blind: proposal.bulla_blind, spend_hook: pallas::Base::zero(), user_data: pallas::Base::zero(), }, @@ -524,6 +523,7 @@ impl Drk { total_all_vote_blind += vote.all_vote_blind; let yes_vote_value = vote.vote_option as u64 * vote.all_vote_value; + eprintln!("yes_vote = {}", yes_vote_value); total_yes_vote_value += yes_vote_value; total_all_vote_value += vote.all_vote_value; @@ -534,6 +534,8 @@ impl Drk { blind_total_vote.aggregate(blind_vote); } + eprintln!("yes = {}, all = {}", total_yes_vote_value, total_all_vote_value); + let prop_t = DaoProposalInfo { dest: proposal.recipient, amount: proposal.amount, @@ -542,6 +544,9 @@ impl Drk { blind: proposal.bulla_blind, // <-- FIXME: wtf }; + // TODO: user blind weirdness in proposal + // TODO: allvote/yesvote is 11 weirdly + let dao_t = DaoInfo { proposer_limit: dao.proposer_limit, quorum: dao.quorum, diff --git a/bin/drk/src/wallet_dao.rs b/bin/drk/src/wallet_dao.rs index 89ba9e13f..6a6ef4766 100644 --- a/bin/drk/src/wallet_dao.rs +++ b/bin/drk/src/wallet_dao.rs @@ -87,7 +87,7 @@ impl fmt::Display for DaoParams { encode_base10(self.quorum, 8), self.quorum, "Approval ratio", - self.approval_ratio_base as f64 / self.approval_ratio_quot as f64, + self.approval_ratio_quot as f64 / self.approval_ratio_base as f64, "Governance Token ID", self.gov_token_id, "Public key", @@ -164,7 +164,7 @@ impl fmt::Display for Dao { encode_base10(self.quorum, 8), self.quorum, "Approval ratio", - self.approval_ratio_base as f64 / self.approval_ratio_quot as f64, + self.approval_ratio_quot as f64 / self.approval_ratio_base as f64, "Governance Token ID", self.gov_token_id, "Public key", diff --git a/contrib/localnet/darkfid-single-node/faucetd/wallet.db b/contrib/localnet/darkfid-single-node/faucetd/wallet.db index 75149d118..828a4d099 100644 Binary files a/contrib/localnet/darkfid-single-node/faucetd/wallet.db and b/contrib/localnet/darkfid-single-node/faucetd/wallet.db differ