From adc796cf8a4b847a4f8e29966c530dcf34b78f99 Mon Sep 17 00:00:00 2001 From: Richard Bertok Date: Wed, 25 Sep 2024 12:03:58 +0200 Subject: [PATCH] fix: cargo format and fix after merge (#17) --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/config_file.rs | 2 +- src/cuda_engine.rs | 7 ++++--- src/main.rs | 21 +++++++-------------- src/node_client.rs | 12 ++---------- src/p2pool_client.rs | 10 ++-------- src/tari_coinbase.rs | 15 ++++----------- 8 files changed, 22 insertions(+), 49 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9870164..9d2d1ea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4440,7 +4440,7 @@ dependencies = [ [[package]] name = "xtrgpuminer" -version = "0.1.9" +version = "0.1.10" dependencies = [ "anyhow", "axum 0.7.6", diff --git a/Cargo.toml b/Cargo.toml index 9df8978..9d2c906 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xtrgpuminer" -version = "0.1.9" +version = "0.1.10" edition = "2021" diff --git a/src/config_file.rs b/src/config_file.rs index 08fca2d..4a0c0b1 100644 --- a/src/config_file.rs +++ b/src/config_file.rs @@ -31,7 +31,7 @@ impl Default for ConfigFile { http_server_port: 18000, // In range 1-1000 gpu_percentage: 1000, - grid_size: 32 + grid_size: 32, } } } diff --git a/src/cuda_engine.rs b/src/cuda_engine.rs index 76b0789..380fe0b 100644 --- a/src/cuda_engine.rs +++ b/src/cuda_engine.rs @@ -45,9 +45,10 @@ impl EngineImpl for CudaEngine { fn create_main_function(&self, context: &Self::Context) -> Result { info!(target: LOG_TARGET, "Create CUDA main function"); - let module = Module::from_ptx(include_str!("../cuda/keccak.ptx"), &[ - ModuleJitOption::GenerateLineInfo(true), - ])?; + let module = Module::from_ptx( + include_str!("../cuda/keccak.ptx"), + &[ModuleJitOption::GenerateLineInfo(true)], + )?; // let func = context.module.get_function("keccakKernel")?; Ok(CudaFunction { module }) } diff --git a/src/main.rs b/src/main.rs index a66d677..fa8d21f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,10 +9,7 @@ use cust::{ }; use log::{error, info, warn}; use minotari_app_grpc::tari_rpc::{ - Block, - BlockHeader as grpc_header, - NewBlockTemplate, - TransactionOutput as GrpcTransactionOutput, + Block, BlockHeader as grpc_header, NewBlockTemplate, TransactionOutput as GrpcTransactionOutput, }; use num_format::{Locale, ToFormattedString}; use sha3::Digest; @@ -22,9 +19,7 @@ use tari_core::{ blocks::BlockHeader, consensus::ConsensusManager, transactions::{ - key_manager::create_memory_db_key_manager, - tari_amount::MicroMinotari, - transaction_components::RangeProofType, + key_manager::create_memory_db_key_manager, tari_amount::MicroMinotari, transaction_components::RangeProofType, }, }; use tari_shutdown::Shutdown; @@ -62,12 +57,9 @@ mod p2pool_client; mod stats_store; mod tari_coinbase; -#[tokio::main] -async fn main() { - match main_inner().await { - Ok(()) => {}, const LOG_TARGET: &str = "tari::gpuminer"; +#[tokio::main] async fn main() { match main_inner().await { Ok(()) => { @@ -75,7 +67,7 @@ async fn main() { std::process::exit(0); }, Err(err) => { - eprintln!("Error: {:#?}", err); + error!(target: LOG_TARGET, "Gpu_miner error: {}", err); std::process::exit(1); }, } @@ -192,8 +184,9 @@ async fn main_inner() -> Result<(), anyhow::Error> { if let Some(percentage) = cli.gpu_percentage { config.gpu_percentage = percentage; } - if let Some(gridSize) = cli.grid_size { - config.grid_size = gridSize; + if let Some(grid_size) = cli.grid_size { + config.grid_size = grid_size; + } if let Some(coinbase_extra) = cli.coinbase_extra { config.coinbase_extra = coinbase_extra; } diff --git a/src/node_client.rs b/src/node_client.rs index 991fbe5..a92d35e 100644 --- a/src/node_client.rs +++ b/src/node_client.rs @@ -3,16 +3,8 @@ use std::time::{Duration, Instant}; use anyhow::anyhow; use log::{error, info, warn}; use minotari_app_grpc::tari_rpc::{ - base_node_client::BaseNodeClient, - pow_algo::PowAlgos, - sha_p2_pool_client::ShaP2PoolClient, - Block, - Empty, - GetNewBlockResult, - NewBlockTemplate, - NewBlockTemplateRequest, - NewBlockTemplateResponse, - PowAlgo, + base_node_client::BaseNodeClient, pow_algo::PowAlgos, sha_p2_pool_client::ShaP2PoolClient, Block, Empty, + GetNewBlockResult, NewBlockTemplate, NewBlockTemplateRequest, NewBlockTemplateResponse, PowAlgo, }; use tari_common_types::tari_address::TariAddress; use tonic::{async_trait, transport::Channel}; diff --git a/src/p2pool_client.rs b/src/p2pool_client.rs index 538e9b8..d0ad350 100644 --- a/src/p2pool_client.rs +++ b/src/p2pool_client.rs @@ -3,14 +3,8 @@ use std::time::Duration; use anyhow::{anyhow, Error}; use log::{error, info, warn}; use minotari_app_grpc::tari_rpc::{ - pow_algo::PowAlgos, - sha_p2_pool_client::ShaP2PoolClient, - Block, - GetNewBlockRequest, - NewBlockTemplate, - NewBlockTemplateResponse, - PowAlgo, - SubmitBlockRequest, + pow_algo::PowAlgos, sha_p2_pool_client::ShaP2PoolClient, Block, GetNewBlockRequest, NewBlockTemplate, + NewBlockTemplateResponse, PowAlgo, SubmitBlockRequest, }; use tari_common_types::tari_address::TariAddress; use tonic::{async_trait, transport::Channel}; diff --git a/src/tari_coinbase.rs b/src/tari_coinbase.rs index aa9afe5..1d0d48c 100644 --- a/src/tari_coinbase.rs +++ b/src/tari_coinbase.rs @@ -3,24 +3,17 @@ use tari_common_types::{tari_address::TariAddress, types::PublicKey}; use tari_core::{ consensus::ConsensusConstants, one_sided::{ - diffie_hellman_stealth_domain_hasher, - shared_secret_to_output_encryption_key, + diffie_hellman_stealth_domain_hasher, shared_secret_to_output_encryption_key, shared_secret_to_output_spending_key, }, transactions::{ key_manager::{MemoryDbKeyManager, TariKeyId, TransactionKeyManagerBranch, TransactionKeyManagerInterface}, tari_amount::MicroMinotari, transaction_components::{ - encrypted_data::PaymentId, - CoinBaseExtra, - RangeProofType, - Transaction, - TransactionKernel, - TransactionOutput, - WalletOutput, + encrypted_data::PaymentId, CoinBaseExtra, RangeProofType, Transaction, TransactionKernel, + TransactionOutput, WalletOutput, }, - CoinbaseBuildError, - CoinbaseBuilder, + CoinbaseBuildError, CoinbaseBuilder, }, }; use tari_crypto::keys::PublicKey as PK;