x 3 лет назад
Родитель
Сommit
4631a3a006
2 измененных файлов с 28 добавлено и 50 удалено
  1. 2 7
      bin/drk/src/rpc_dao.rs
  2. 26 43
      bin/drk/src/wallet_dao.rs

+ 2 - 7
bin/drk/src/rpc_dao.rs

@@ -204,7 +204,6 @@ impl Drk {
         let proposal = dao_client::DaoProposalInfo {
             dest: recipient,
             amount,
-            serial: pallas::Base::random(&mut OsRng),
             token_id,
             blind: proposal_blind,
         };
@@ -312,7 +311,6 @@ impl Drk {
         let proposal_info = DaoProposalInfo {
             dest: proposal.recipient,
             amount: proposal.amount,
-            serial: proposal.serial,
             token_id: proposal.token_id,
             blind: proposal.bulla_blind,
         };
@@ -448,15 +446,14 @@ impl Drk {
 
         let input_sum = input_coins.iter().map(|x| x.note.value).sum::<u64>();
 
-        // I'm tired
         let xfer_outputs = vec![
             // Proposal send
             money_client::TransferOutput {
                 value: proposal.amount,
                 token_id: proposal.token_id,
                 public: proposal.recipient,
-                serial: proposal.serial,
-                coin_blind: proposal.bulla_blind,
+                serial: user_serial,
+                coin_blind: user_coin_blind,
                 spend_hook: pallas::Base::zero(),
                 user_data: pallas::Base::zero(),
             },
@@ -539,12 +536,10 @@ impl Drk {
         let prop_t = DaoProposalInfo {
             dest: proposal.recipient,
             amount: proposal.amount,
-            serial: proposal.serial,
             token_id: proposal.token_id,
             blind: proposal.bulla_blind, // <-- FIXME: wtf
         };
 
-        // TODO: user blind weirdness in proposal
         // TODO: allvote/yesvote is 11 weirdly
 
         let dao_t = DaoInfo {

+ 26 - 43
bin/drk/src/wallet_dao.rs

@@ -196,8 +196,6 @@ pub struct DaoProposal {
     pub recipient: PublicKey,
     /// Amount of this proposal
     pub amount: u64,
-    /// Serial of this proposal
-    pub serial: pallas::Base,
     /// Token ID to be sent
     pub token_id: TokenId,
     /// Proposal's bulla blind
@@ -220,11 +218,9 @@ impl DaoProposal {
             dest_x,
             dest_y,
             pallas::Base::from(self.amount),
-            self.serial,
             self.token_id.inner(),
             self.dao_bulla.inner(),
             self.bulla_blind,
-            self.bulla_blind,
         ])
     }
 }
@@ -232,29 +228,28 @@ impl DaoProposal {
 impl fmt::Display for DaoProposal {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         let s = format!(
-            "{}\n{}\n{}: {}\n{}: {}\n{}: {} ({})\n{}: {:?}\n{}: {}\n{}: {:?}\n{}: {:?}\n{}: {:?}\n{}: {:?}\n{}: {:?}",
-            "Proposal parameters",
-            "===================",
-            "DAO Bulla",
+            concat!(
+                "Proposal parameters\n",
+                "===================\n",
+                "DAO Bulla: {}\n",
+                "Recipient: {}\n",
+                "Proposal amount: {} ({})\n",
+                "Proposal Token ID: {:?}\n",
+                "Proposal bulla blind: {:?}\n",
+                "Proposal leaf position: {:?}\n",
+                "Proposal tx hash: {:?}\n",
+                "Proposal call index: {:?}\n",
+                "Proposal vote ID: {:?}",
+            ),
             self.dao_bulla,
-            "Recipient",
             self.recipient,
-            "Proposal amount",
             encode_base10(self.amount, 8),
             self.amount,
-            "Proposal serial",
-            self.serial,
-            "Proposal Token ID",
             self.token_id,
-            "Proposal bulla blind",
             self.bulla_blind,
-            "Proposal leaf position",
             self.leaf_position,
-            "Proposal tx hash",
             self.tx_hash,
-            "Proposal call index",
             self.call_index,
-            "Proposal vote ID",
             self.vote_id,
         );
 
@@ -710,21 +705,18 @@ impl Drk {
             let amount_bytes: Vec<u8> = serde_json::from_value(row[3].clone())?;
             let amount = deserialize(&amount_bytes)?;
 
-            let serial_bytes: Vec<u8> = serde_json::from_value(row[4].clone())?;
-            let serial = deserialize(&serial_bytes)?;
-
-            let token_id_bytes: Vec<u8> = serde_json::from_value(row[5].clone())?;
+            let token_id_bytes: Vec<u8> = serde_json::from_value(row[4].clone())?;
             let token_id = deserialize(&token_id_bytes)?;
 
-            let bulla_blind_bytes: Vec<u8> = serde_json::from_value(row[6].clone())?;
+            let bulla_blind_bytes: Vec<u8> = serde_json::from_value(row[5].clone())?;
             let bulla_blind = deserialize(&bulla_blind_bytes)?;
 
-            let leaf_position_bytes: Vec<u8> = serde_json::from_value(row[7].clone())?;
-            let tx_hash_bytes: Vec<u8> = serde_json::from_value(row[8].clone())?;
+            let leaf_position_bytes: Vec<u8> = serde_json::from_value(row[6].clone())?;
+            let tx_hash_bytes: Vec<u8> = serde_json::from_value(row[7].clone())?;
 
-            let call_index = serde_json::from_value(row[9].clone())?;
+            let call_index = serde_json::from_value(row[8].clone())?;
 
-            let vote_id_bytes: Vec<u8> = serde_json::from_value(row[10].clone())?;
+            let vote_id_bytes: Vec<u8> = serde_json::from_value(row[9].clone())?;
 
             let leaf_position = if leaf_position_bytes.is_empty() {
                 None
@@ -743,7 +735,6 @@ impl Drk {
                 dao_bulla,
                 recipient,
                 amount,
-                serial,
                 token_id,
                 bulla_blind,
                 leaf_position,
@@ -810,21 +801,18 @@ impl Drk {
         let amount_bytes: Vec<u8> = serde_json::from_value(row[3].clone())?;
         let amount = deserialize(&amount_bytes)?;
 
-        let serial_bytes: Vec<u8> = serde_json::from_value(row[4].clone())?;
-        let serial = deserialize(&serial_bytes)?;
-
-        let token_id_bytes: Vec<u8> = serde_json::from_value(row[5].clone())?;
+        let token_id_bytes: Vec<u8> = serde_json::from_value(row[4].clone())?;
         let token_id = deserialize(&token_id_bytes)?;
 
-        let bulla_blind_bytes: Vec<u8> = serde_json::from_value(row[6].clone())?;
+        let bulla_blind_bytes: Vec<u8> = serde_json::from_value(row[5].clone())?;
         let bulla_blind = deserialize(&bulla_blind_bytes)?;
 
-        let leaf_position_bytes: Vec<u8> = serde_json::from_value(row[7].clone())?;
-        let tx_hash_bytes: Vec<u8> = serde_json::from_value(row[8].clone())?;
+        let leaf_position_bytes: Vec<u8> = serde_json::from_value(row[6].clone())?;
+        let tx_hash_bytes: Vec<u8> = serde_json::from_value(row[7].clone())?;
 
-        let call_index = serde_json::from_value(row[9].clone())?;
+        let call_index = serde_json::from_value(row[8].clone())?;
 
-        let vote_id_bytes: Vec<u8> = serde_json::from_value(row[10].clone())?;
+        let vote_id_bytes: Vec<u8> = serde_json::from_value(row[9].clone())?;
 
         let leaf_position = if leaf_position_bytes.is_empty() {
             None
@@ -845,7 +833,6 @@ impl Drk {
             dao_bulla: dao.bulla(),
             recipient,
             amount,
-            serial,
             token_id,
             bulla_blind,
             leaf_position,
@@ -1032,7 +1019,6 @@ impl Drk {
                             dao_bulla: dao.bulla(),
                             recipient: note.proposal.dest,
                             amount: note.proposal.amount,
-                            serial: note.proposal.serial,
                             token_id: note.proposal.token_id,
                             bulla_blind: note.proposal.blind,
                             leaf_position: proposals_tree.witness(),
@@ -1170,12 +1156,11 @@ impl Drk {
             };
 
             let query = format!(
-                "INSERT INTO {} ({}, {}, {}, {}, {}, {}, {}, {}, {}) VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9);",
+                "INSERT INTO {} ({}, {}, {}, {}, {}, {}, {}, {}) VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8);",
                 DAO_PROPOSALS_TABLE,
                 DAO_PROPOSALS_COL_DAO_ID,
                 DAO_PROPOSALS_COL_RECV_PUBLIC,
                 DAO_PROPOSALS_COL_AMOUNT,
-                DAO_PROPOSALS_COL_SERIAL,
                 DAO_PROPOSALS_COL_SENDCOIN_TOKEN_ID,
                 DAO_PROPOSALS_COL_BULLA_BLIND,
                 DAO_PROPOSALS_COL_LEAF_POSITION,
@@ -1192,8 +1177,6 @@ impl Drk {
                 QueryType::Blob as u8,
                 serialize(&proposal.amount),
                 QueryType::Blob as u8,
-                serialize(&proposal.serial),
-                QueryType::Blob as u8,
                 serialize(&proposal.token_id),
                 QueryType::Blob as u8,
                 serialize(&proposal.bulla_blind),