Ver código fonte

daod: cleaned up unused imports

lunar-mining 3 anos atrás
pai
commit
2f2f1d959a

+ 1 - 4
bin/daod/src/dao_contract/exec/validate.rs

@@ -23,9 +23,6 @@ type Result<T> = std::result::Result<T, Error>;
 
 #[derive(Debug, Clone, thiserror::Error)]
 pub enum Error {
-    #[error("ValueExists")]
-    ValueExists,
-
     #[error("DarkFi error: {0}")]
     DarkFiError(String),
 
@@ -197,7 +194,7 @@ pub struct Update {
 
 impl UpdateBase for Update {
     fn apply(self: Box<Self>, states: &mut StateRegistry) {
-        let mut state = states
+        let state = states
             .lookup_mut::<dao_contract::State>(&"DAO".to_string())
             .expect("Return type is not of type State");
         state.proposal_votes.remove(&HashableBase(self.proposal)).unwrap();

+ 1 - 1
bin/daod/src/dao_contract/exec/wallet.rs

@@ -6,7 +6,7 @@ use pasta_curves::{arithmetic::CurveAffine, group::Curve, pallas};
 
 use darkfi::{
     crypto::{
-        keypair::{PublicKey, SecretKey},
+        keypair::SecretKey,
         util::{pedersen_commitment_u64, poseidon_hash},
         Proof,
     },

+ 3 - 3
bin/daod/src/dao_contract/mint/wallet.rs

@@ -24,7 +24,7 @@ pub struct Builder {
     gov_token_id: pallas::Base,
     dao_pubkey: PublicKey,
     dao_bulla_blind: pallas::Base,
-    signature_secret: SecretKey,
+    _signature_secret: SecretKey,
 }
 
 impl Builder {
@@ -35,7 +35,7 @@ impl Builder {
         gov_token_id: pallas::Base,
         dao_pubkey: PublicKey,
         dao_bulla_blind: pallas::Base,
-        signature_secret: SecretKey,
+        _signature_secret: SecretKey,
     ) -> Self {
         Self {
             dao_proposer_limit,
@@ -44,7 +44,7 @@ impl Builder {
             gov_token_id,
             dao_pubkey,
             dao_bulla_blind,
-            signature_secret,
+            _signature_secret,
         }
     }
 

+ 1 - 7
bin/daod/src/dao_contract/propose/validate.rs

@@ -1,8 +1,5 @@
 use darkfi::{
-    crypto::{
-        keypair::PublicKey, merkle_node::MerkleNode, schnorr, schnorr::SchnorrPublic,
-        types::DrkCircuitField,
-    },
+    crypto::{keypair::PublicKey, merkle_node::MerkleNode, types::DrkCircuitField},
     util::serial::{Encodable, SerialDecodable, SerialEncodable},
     Error as DarkFiError,
 };
@@ -32,9 +29,6 @@ pub enum Error {
     #[error("Invalid DAO merkle root")]
     InvalidDaoMerkleRoot,
 
-    #[error("Signature verification failed")]
-    SignatureVerifyFailed,
-
     #[error("DarkFi error: {0}")]
     DarkFiError(String),
 }

+ 1 - 8
bin/daod/src/dao_contract/propose/wallet.rs

@@ -11,11 +11,10 @@ use darkfi::{
     crypto::{
         keypair::{PublicKey, SecretKey},
         merkle_node::MerkleNode,
-        schnorr::SchnorrSecret,
         util::{pedersen_commitment_u64, poseidon_hash},
         Proof,
     },
-    util::serial::{Encodable, SerialDecodable, SerialEncodable},
+    util::serial::{SerialDecodable, SerialEncodable},
     zk::vm::{Witness, ZkCircuit},
 };
 
@@ -25,8 +24,6 @@ use crate::{
     money_contract, note,
 };
 
-use log::debug;
-
 #[derive(SerialEncodable, SerialDecodable)]
 pub struct Note {
     pub proposal: Proposal,
@@ -146,12 +143,8 @@ impl Builder {
 
             let value_commit = pedersen_commitment_u64(note.value, funds_blind);
             let value_coords = value_commit.to_affine().coordinates().unwrap();
-            let value_commit_x = *value_coords.x();
-            let value_commit_y = *value_coords.y();
 
             let sigpub_coords = signature_public.0.to_affine().coordinates().unwrap();
-            let sigpub_x = *sigpub_coords.x();
-            let sigpub_y = *sigpub_coords.y();
 
             let public_inputs = vec![
                 *value_coords.x(),

+ 1 - 1
bin/daod/src/dao_contract/state.rs

@@ -7,7 +7,7 @@ use std::{any::Any, collections::HashMap, hash::Hasher};
 
 use darkfi::{
     crypto::{constants::MERKLE_DEPTH, merkle_node::MerkleNode, nullifier::Nullifier},
-    util::serial::{Encodable, SerialDecodable, SerialEncodable},
+    util::serial::{SerialDecodable, SerialEncodable},
 };
 
 #[derive(Clone, SerialEncodable, SerialDecodable)]

+ 1 - 5
bin/daod/src/dao_contract/vote/validate.rs

@@ -1,7 +1,6 @@
 use darkfi::{
     crypto::{
-        keypair::PublicKey, merkle_node::MerkleNode, nullifier::Nullifier, schnorr,
-        schnorr::SchnorrPublic, types::DrkCircuitField,
+        keypair::PublicKey, merkle_node::MerkleNode, nullifier::Nullifier, types::DrkCircuitField,
     },
     util::serial::{Encodable, SerialDecodable, SerialEncodable},
     Error as DarkFiError,
@@ -35,9 +34,6 @@ pub enum Error {
     #[error("Invalid input merkle root")]
     InvalidInputMerkleRoot,
 
-    #[error("Signature verification failed")]
-    SignatureVerifyFailed,
-
     #[error("DarkFi error: {0}")]
     DarkFiError(String),
 }

+ 1 - 2
bin/daod/src/dao_contract/vote/wallet.rs

@@ -3,11 +3,10 @@ use darkfi::{
         keypair::{Keypair, PublicKey, SecretKey},
         merkle_node::MerkleNode,
         nullifier::Nullifier,
-        schnorr::SchnorrSecret,
         util::{pedersen_commitment_u64, poseidon_hash},
         Proof,
     },
-    util::serial::{Encodable, SerialDecodable, SerialEncodable},
+    util::serial::{SerialDecodable, SerialEncodable},
     zk::vm::{Witness, ZkCircuit},
 };
 use halo2_proofs::circuit::Value;

+ 2 - 3
bin/daod/src/demo.rs

@@ -21,8 +21,7 @@ use darkfi::{
         util::{pedersen_commitment_u64, poseidon_hash},
         Proof,
     },
-    error as DarkFiError,
-    util::serial::{Encodable, SerialDecodable, SerialEncodable},
+    util::serial::Encodable,
     zk::{
         circuit::{BurnContract, MintContract},
         vm::ZkCircuit,
@@ -154,7 +153,7 @@ impl Transaction {
 fn sign(signature_secrets: Vec<SecretKey>, func_calls: &Vec<FuncCall>) -> Vec<Signature> {
     let mut signatures = vec![];
     let mut unsigned_tx_data = vec![];
-    for (i, (signature_secret, func_call)) in
+    for (_i, (signature_secret, func_call)) in
         signature_secrets.iter().zip(func_calls.iter()).enumerate()
     {
         func_call.encode(&mut unsigned_tx_data).expect("failed to encode data");

+ 0 - 8
bin/daod/src/money_contract/transfer/validate.rs

@@ -11,8 +11,6 @@ use darkfi::{
         keypair::PublicKey,
         merkle_node::MerkleNode,
         nullifier::Nullifier,
-        schnorr,
-        schnorr::SchnorrPublic,
         types::{DrkCircuitField, DrkTokenId, DrkValueBlind, DrkValueCommit},
         util::{pedersen_commitment_base, pedersen_commitment_u64},
         BurnRevealedValues, MintRevealedValues,
@@ -337,12 +335,6 @@ pub enum VerifyFailed {
     #[error("Nullifier already exists for input {0}")]
     NullifierExists(usize),
 
-    #[error("Invalid signature for input {0}")]
-    InputSignature(usize),
-
-    #[error("Invalid signature for clear input {0}")]
-    ClearInputSignature(usize),
-
     #[error("Token commitments in inputs or outputs to not match")]
     TokenMismatch,
 

+ 1 - 4
bin/daod/src/money_contract/transfer/wallet.rs

@@ -7,13 +7,12 @@ use darkfi::{
         keypair::{PublicKey, SecretKey},
         merkle_node::MerkleNode,
         mint_proof::create_mint_proof,
-        schnorr::SchnorrSecret,
         types::{
             DrkCoinBlind, DrkSerial, DrkSpendHook, DrkTokenId, DrkUserData, DrkUserDataBlind,
             DrkValueBlind,
         },
     },
-    util::serial::{Encodable, SerialDecodable, SerialEncodable},
+    util::serial::{SerialDecodable, SerialEncodable},
     Result,
 };
 
@@ -117,8 +116,6 @@ impl Builder {
             let value_blind = input.value_blind;
             input_blinds.push(value_blind);
 
-            let signature_public = PublicKey::from_secret(input.signature_secret);
-
             let zk_info = zk_bins.lookup(&"money-transfer-burn".to_string()).unwrap();
             let zk_info = if let ZkContractInfo::Native(info) = zk_info {
                 info