Forráskód Böngészése

Make Repo Great Again

aggstam 3 éve
szülő
commit
6fa4049a1b

+ 2 - 2
bin/darkfid/src/error.rs

@@ -23,9 +23,9 @@ use darkfi::rpc::jsonrpc::{ErrorCode::ServerError, JsonError, JsonResult};
 /// Custom RPC errors available for darkfid.
 /// Please sort them sensefully.
 pub enum RpcError {
+    /*
     // Wallet/Key-related errors
     NoRowsFoundInWallet = -32101,
-    /*
     Keygen = -32101,
     KeypairFetch = -32102,
     KeypairNotFound = -32103,
@@ -50,9 +50,9 @@ pub enum RpcError {
 
 fn to_tuple(e: RpcError) -> (i64, String) {
     let msg = match e {
+        /*
         // Wallet/Key-related errors
         RpcError::NoRowsFoundInWallet => "No queried rows found in wallet",
-        /*
         RpcError::Keygen => "Failed generating keypair",
         RpcError::KeypairFetch => "Failed fetching keypairs from wallet",
         RpcError::KeypairNotFound => "Keypair not found",

+ 3 - 3
bin/darkfid/src/main.rs

@@ -180,7 +180,7 @@ pub struct Darkfid {
     synced: Mutex<bool>, // AtomicBool is weird in Arc
     consensus_p2p: Option<P2pPtr>,
     sync_p2p: Option<P2pPtr>,
-    wallet: WalletPtr,
+    _wallet: WalletPtr,
     validator_state: ValidatorStatePtr,
 }
 
@@ -259,9 +259,9 @@ impl Darkfid {
         validator_state: ValidatorStatePtr,
         consensus_p2p: Option<P2pPtr>,
         sync_p2p: Option<P2pPtr>,
-        wallet: WalletPtr,
+        _wallet: WalletPtr,
     ) -> Self {
-        Self { synced: Mutex::new(false), consensus_p2p, sync_p2p, wallet, validator_state }
+        Self { synced: Mutex::new(false), consensus_p2p, sync_p2p, _wallet, validator_state }
     }
 }
 

+ 8 - 3
bin/darkfid/src/rpc_wallet.rs

@@ -16,6 +16,7 @@
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
 
+/*
 use log::{debug, error};
 use serde_json::{json, Value};
 
@@ -28,6 +29,10 @@ use darkfi::{
 };
 
 use super::{error::RpcError, server_error, Darkfid};
+*/
+use super::Darkfid;
+use darkfi::rpc::jsonrpc::JsonResult;
+use serde_json::Value;
 
 impl Darkfid {
     // RPCAPI:
@@ -49,7 +54,7 @@ impl Darkfid {
     //
     // --> {"jsonrpc": "2.0", "method": "wallet.query_row_single", "params": [...], "id": 1}
     // <-- {"jsonrpc": "2.0", "result": ["va", "lu", "es", ...], "id": 1}
-    pub async fn wallet_query_row_single(&self, id: Value, params: &[Value]) -> JsonResult {
+    pub async fn wallet_query_row_single(&self, _id: Value, _params: &[Value]) -> JsonResult {
         todo!();
         /* TODO: This will be abstracted away
         // We need at least 3 params for something we want to fetch, and we want them in pairs.
@@ -202,7 +207,7 @@ impl Darkfid {
     //
     // --> {"jsonrpc": "2.0", "method": "wallet.query_row_multi", "params": [...], "id": 1}
     // <-- {"jsonrpc": "2.0", "result": [["va", "lu"], ["es", "es"], ...], "id": 1}
-    pub async fn wallet_query_row_multi(&self, id: Value, params: &[Value]) -> JsonResult {
+    pub async fn wallet_query_row_multi(&self, _id: Value, _params: &[Value]) -> JsonResult {
         todo!();
         /* TODO: This will be abstracted away
         // We need at least 3 params for something we want to fetch, and we want them in pairs.
@@ -326,7 +331,7 @@ impl Darkfid {
     //
     // --> {"jsonrpc": "2.0", "method": "wallet.exec_sql", "params": ["CREATE TABLE ..."], "id": 1}
     // <-- {"jsonrpc": "2.0", "result": true, "id": 1}
-    pub async fn wallet_exec_sql(&self, id: Value, params: &[Value]) -> JsonResult {
+    pub async fn wallet_exec_sql(&self, _id: Value, _params: &[Value]) -> JsonResult {
         todo!();
         /* TODO: This will be abstracted away
         if params.is_empty() || !params[0].is_string() {

+ 1 - 1
bin/dhtd/dhtd/src/proto.rs

@@ -140,7 +140,7 @@ impl ProtocolDht {
             }
 
             let hashset = state.routing_table.get_mut(&msg.k).unwrap();
-            hashset.remove(&self.channel.address());
+            hashset.remove(self.channel.address());
         }
     }
 

+ 2 - 2
bin/fud/fu/src/main.rs

@@ -133,8 +133,8 @@ impl Fu {
 async fn main() -> Result<()> {
     let args = Args::parse();
 
-    let log_level = get_log_level(args.verbose.into());
-    let log_config = get_log_config(args.verbose.into());
+    let log_level = get_log_level(args.verbose);
+    let log_config = get_log_config(args.verbose);
     TermLogger::init(log_level, log_config, TerminalMode::Mixed, ColorChoice::Auto)?;
 
     let rpc_client = RpcClient::new(args.endpoint).await?;

+ 2 - 2
bin/genev/genev-cli/src/main.rs

@@ -66,8 +66,8 @@ enum SubCmd {
 async fn main() -> Result<()> {
     let args = Args::parse();
 
-    let log_level = get_log_level(args.verbose.into());
-    let log_config = get_log_config(args.verbose.into());
+    let log_level = get_log_level(args.verbose);
+    let log_config = get_log_config(args.verbose);
     TermLogger::init(log_level, log_config, TerminalMode::Mixed, ColorChoice::Auto)?;
 
     let rpc_client = RpcClient::new(args.endpoint).await?;

+ 2 - 2
bin/tau/tau-cli/src/main.rs

@@ -164,8 +164,8 @@ pub struct Tau {
 async fn main() -> Result<()> {
     let args = Args::parse();
 
-    let log_level = get_log_level(args.verbose.into());
-    let log_config = get_log_config(args.verbose.into());
+    let log_level = get_log_level(args.verbose);
+    let log_config = get_log_config(args.verbose);
     TermLogger::init(log_level, log_config, TerminalMode::Mixed, ColorChoice::Auto)?;
 
     let rpc_client = RpcClient::new(args.endpoint).await?;

+ 2 - 2
src/contract/money/tests/mint_pay_swap.rs

@@ -185,9 +185,9 @@ async fn mint_pay_swap() -> Result<()> {
     th.execute_transfer_tx(Holder::Alice, &transfer_tx, &transfer_params, current_slot, false)
         .await?;
 
-    info!(target: "money", "[Bob] ==================+===========");
+    info!(target: "money", "[Bob] ==============================");
     info!(target: "money", "[Bob] Executing Bob2Alice payment tx");
-    info!(target: "money", "[Bob] ==================+===========");
+    info!(target: "money", "[Bob] ==============================");
     th.execute_transfer_tx(Holder::Bob, &transfer_tx, &transfer_params, current_slot, false)
         .await?;
 

+ 2 - 2
src/net/transport.rs

@@ -187,12 +187,12 @@ impl Dialer {
             }
 
             #[cfg(feature = "p2p-transport-nym")]
-            DialerVariant::Nym(dialer) => {
+            DialerVariant::Nym(_dialer) => {
                 todo!();
             }
 
             #[cfg(feature = "p2p-transport-nym")]
-            DialerVariant::NymTls(dialer) => {
+            DialerVariant::NymTls(_dialer) => {
                 todo!();
             }
         }

+ 6 - 6
src/net/transport/nym.rs

@@ -29,13 +29,13 @@ use crate::{util::encoding::base32, Result};
 struct ConnectionId([u8; 32]);
 
 impl ConnectionId {
-    fn generate() -> Self {
+    fn _generate() -> Self {
         let mut bytes = [0u8; 32];
         OsRng.fill_bytes(&mut bytes);
         Self(bytes)
     }
 
-    fn from_bytes(bytes: &[u8]) -> Self {
+    fn _from_bytes(bytes: &[u8]) -> Self {
         let mut id = [0u8; 32];
         id[..].copy_from_slice(&bytes[0..32]);
         ConnectionId(id)
@@ -58,12 +58,12 @@ impl NymDialer {
         Ok(Self {})
     }
 
-    pub(crate) async fn do_dial(
+    pub(crate) async fn _do_dial(
         &self,
-        endpoint: Url, // Recipient
-        timeout: Option<Duration>,
+        _endpoint: Url, // Recipient
+        _timeout: Option<Duration>,
     ) -> Result<()> {
-        let id = ConnectionId::generate();
+        let _id = ConnectionId::_generate();
 
         Ok(())
     }

+ 3 - 3
src/runtime/vm_runtime.rs

@@ -292,7 +292,7 @@ impl Runtime {
         debug!(target: "runtime::vm_runtime", "Instantiating module");
         let instance = Instance::new(&mut store, &module, &imports)?;
 
-        let mut env_mut = ctx.as_mut(&mut store);
+        let env_mut = ctx.as_mut(&mut store);
         env_mut.memory = Some(instance.exports.get_with_generics(MEMORY)?);
 
         Ok(Self { instance, store, ctx })
@@ -314,7 +314,7 @@ impl Runtime {
     fn call(&mut self, section: ContractSection, payload: &[u8]) -> Result<Vec<u8>> {
         debug!(target: "runtime::vm_runtime", "Calling {} method", section.name());
 
-        let mut env_mut = self.ctx.as_mut(&mut self.store);
+        let env_mut = self.ctx.as_mut(&mut self.store);
         env_mut.contract_section = section;
         assert!(env_mut.contract_return_data.take().is_none());
         env_mut.contract_return_data.set(None);
@@ -351,7 +351,7 @@ impl Runtime {
         debug!(target: "runtime::vm_runtime", "wasm executed successfully");
         debug!(target: "runtime::vm_runtime", "Contract returned: {:?}", ret[0]);
 
-        let mut env_mut = self.ctx.as_mut(&mut self.store);
+        let env_mut = self.ctx.as_mut(&mut self.store);
         env_mut.contract_section = ContractSection::Null;
         let retdata = match env_mut.contract_return_data.take() {
             Some(retdata) => retdata,

+ 2 - 2
src/sdk/src/crypto/smt.rs

@@ -69,7 +69,7 @@ pub struct Poseidon<F: WithSmallOrderMulGroup<3> + Ord, const L: usize>(PhantomD
 
 impl<F: WithSmallOrderMulGroup<3> + Ord, const L: usize> Poseidon<F, L> {
     pub fn new() -> Self {
-        Poseidon(PhantomData::default())
+        Poseidon(PhantomData)
     }
 }
 
@@ -88,7 +88,7 @@ where
     }
 
     fn hasher() -> Self {
-        Poseidon(PhantomData::default())
+        Poseidon(PhantomData)
     }
 }