Skip to content

Commit

Permalink
chore(release): version 0.9.2 (#1461)
Browse files Browse the repository at this point in the history
Description
---
Onwards and upwards
  • Loading branch information
brianp authored Jan 31, 2025
2 parents e2ecbf0 + 29e6b40 commit 7f1e9c6
Show file tree
Hide file tree
Showing 12 changed files with 145 additions and 23 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tari-universe",
"private": true,
"version": "0.9.1",
"version": "0.9.2",
"type": "module",
"scripts": {
"dev": "vite dev --mode development",
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description = "Tari Universe"
edition = "2021"
name = "tari-universe"
repository = "https://github.com/tari-project/universe"
version = "0.9.1"
version = "0.9.2"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
8 changes: 4 additions & 4 deletions src-tauri/binaries_versions_esmeralda.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"binaries": {
"xmrig": "=6.22.0",
"mmproxy": "=1.11.0-pre.0",
"minotari_node": "=1.11.0-pre.0",
"wallet": "=1.11.0-pre.0",
"sha-p2pool": "=0.21.0",
"mmproxy": "=1.11.1-pre.1",
"minotari_node": "=1.11.1-pre.1",
"wallet": "=1.11.1-pre.1",
"sha-p2pool": "=0.21.1",
"xtrgpuminer": "=0.2.12",
"tor": "=13.5.7"
}
Expand Down
8 changes: 4 additions & 4 deletions src-tauri/binaries_versions_nextnet.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"binaries": {
"xmrig": "=6.22.0",
"mmproxy": "=1.11.0-rc.0",
"minotari_node": "=1.11.0-rc.0",
"wallet": "=1.11.0-rc.0",
"sha-p2pool": "=0.21.0",
"mmproxy": "=1.11.1-rc.1",
"minotari_node": "=1.11.1-rc.1",
"wallet": "=1.11.1-rc.1",
"sha-p2pool": "=0.21.1",
"xtrgpuminer": "=0.2.12",
"tor": "=13.5.7"
}
Expand Down
78 changes: 78 additions & 0 deletions src-tauri/src/cpu_miner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ use log::{debug, error, warn};
use std::path::PathBuf;
use std::sync::Arc;
use std::thread;
use std::time::{Duration, Instant};
use tari_core::transactions::tari_amount::MicroMinotari;
use tari_shutdown::ShutdownSignal;
use tokio::sync::RwLock;
use tokio::time::{sleep, timeout};

const LOG_TARGET: &str = "tari::universe::cpu_miner";
const ECO_MODE_CPU_USAGE: u32 = 30;
Expand Down Expand Up @@ -125,6 +127,82 @@ impl CpuMiner {
Ok(())
}

pub async fn start_benchmarking(
&mut self,
app_shutdown: ShutdownSignal,
duration: Duration,
base_path: PathBuf,
config_path: PathBuf,
log_dir: PathBuf,
) -> Result<u64, anyhow::Error> {
let mut lock = self.watcher.write().await;

let xmrig_node_connection = XmrigNodeConnection::Benchmark;
let max_cpu_available = thread::available_parallelism();
let max_cpu_available = match max_cpu_available {
Ok(available_cpus) => u32::try_from(available_cpus.get()).unwrap_or(1),
Err(_) => 1,
};

lock.adapter.node_connection = Some(xmrig_node_connection);
// We're going to use benchmarking, so the address isn't used
lock.adapter.monero_address = Some("44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A".to_string());
lock.adapter.cpu_threads = Some(Some(1)); // Use one thread so that the machine doesn't lock up
lock.adapter.extra_options = vec![];

let timeout_duration = duration + Duration::from_secs(10);
let res = match timeout(timeout_duration, async move {
lock.start(
app_shutdown.clone(),
base_path.clone(),
config_path.clone(),
log_dir.clone(),
Binaries::Xmrig,
)
.await?;
let mut status = None;
for _ in 0..10 {
if let Some(s) = lock.status_monitor.as_ref() {
status = Some(s.clone());
break;
}
sleep(Duration::from_secs(1)).await;
}
if status.is_none() {
error!(target: LOG_TARGET, "Failed to get status for xmrig for benchmarking");
return Ok(0);
}
let status = status.expect("Can't fail");
let start_time = Instant::now();
let mut max_hashrate = 0f64;
loop {
if app_shutdown.is_triggered() {
break;
}
sleep(Duration::from_secs(1)).await;
if let Ok(stats) = status.summary().await {
let hash_rate = stats.hashrate.total[0].unwrap_or_default();
if hash_rate > max_hashrate {
max_hashrate = hash_rate;
}
if start_time.elapsed() > duration {
break;
}
}
} // wait until we have stats from xmrig, so its started
#[allow(clippy::cast_possible_truncation)]
Ok::<u64, anyhow::Error>(max_hashrate.floor() as u64)
})
.await
{
Ok(res) => Ok(res? * u64::from(max_cpu_available)),
Err(_) => Ok(0),
};
let mut lock2 = self.watcher.write().await;
lock2.stop().await?;
res
}

pub async fn stop(&mut self) -> Result<(), anyhow::Error> {
let mut lock = self.watcher.write().await;
lock.stop().await?;
Expand Down
29 changes: 28 additions & 1 deletion src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -593,13 +593,39 @@ async fn setup_inner(
telemetry_id = "unknown_miner_tari_universe".to_string();
}

// Benchmark if needed.
progress.set_max(77).await;
// let mut cpu_miner_config = state.cpu_miner_config.read().await.clone();
// Clear out so we use default.
let _unused = telemetry_service
.send(
"starting-benchmarking".to_string(),
json!({
"service": "starting_benchmarking",
"percentage":75,
}),
)
.await;

let mut cpu_miner = state.cpu_miner.write().await;
let benchmarked_hashrate = cpu_miner
.start_benchmarking(
state.shutdown.to_signal(),
Duration::from_secs(30),
data_dir.clone(),
config_dir.clone(),
log_dir.clone(),
)
.await?;
drop(cpu_miner);

if p2pool_enabled {
let _unused = telemetry_service
.send(
"starting-p2pool".to_string(),
json!({
"service": "starting_p2pool",
"percentage":75,
"percentage":77,
}),
)
.await;
Expand All @@ -612,6 +638,7 @@ async fn setup_inner(
let p2pool_config = P2poolConfig::builder()
.with_base_node(base_node_grpc)
.with_stats_server_port(state.config.read().await.p2pool_stats_server_port())
.with_cpu_benchmark_hashrate(Some(benchmarked_hashrate))
.build()?;

state
Expand Down
10 changes: 8 additions & 2 deletions src-tauri/src/p2pool_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,15 @@ impl ProcessAdapter for P2poolAdapter {
let pid_file_name = self.pid_file_name().to_string();

args.push("--squad-prefix".to_string());
args.push("default".to_string());
let mut squad_prefix = "default";
if let Some(benchmark) = config.cpu_benchmark_hashrate {
if benchmark < 1000 {
squad_prefix = "mini";
}
}
args.push(squad_prefix.to_string());
args.push("--num-squads".to_string());
args.push("3".to_string());
args.push("2".to_string());
let mut envs = HashMap::new();
match Network::get_current_or_user_setting_or_default() {
Network::Esmeralda => {
Expand Down
11 changes: 11 additions & 0 deletions src-tauri/src/p2pool_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ pub struct P2poolConfig {
pub grpc_port: u16,
pub stats_server_port: u16,
pub base_node_address: String,
pub cpu_benchmark_hashrate: Option<u64>,
}

pub struct P2poolConfigBuilder {
Expand All @@ -70,13 +71,22 @@ impl P2poolConfigBuilder {
self
}

pub fn with_cpu_benchmark_hashrate(
&mut self,
cpu_benchmark_hashrate: Option<u64>,
) -> &mut Self {
self.config.cpu_benchmark_hashrate = cpu_benchmark_hashrate;
self
}

pub fn build(&self) -> Result<P2poolConfig, anyhow::Error> {
let grpc_port = PortAllocator::new().assign_port_with_fallback();

Ok(P2poolConfig {
grpc_port,
stats_server_port: self.config.stats_server_port,
base_node_address: self.config.base_node_address.clone(),
cpu_benchmark_hashrate: self.config.cpu_benchmark_hashrate,
})
}
}
Expand All @@ -93,6 +103,7 @@ impl Default for P2poolConfig {
grpc_port: 18145,
stats_server_port: 19000,
base_node_address: String::from("http://127.0.0.1:18142"),
cpu_benchmark_hashrate: None,
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions src-tauri/src/xmrig_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const LOG_TARGET: &str = "tari::universe::xmrig_adapter";

pub enum XmrigNodeConnection {
LocalMmproxy { host_name: String, port: u16 },
Benchmark,
}

impl XmrigNodeConnection {
Expand All @@ -50,6 +51,9 @@ impl XmrigNodeConnection {
"--coin=monero".to_string(),
]
}
XmrigNodeConnection::Benchmark => {
vec!["--benchmark=1m".to_string()]
}
}
}
}
Expand Down Expand Up @@ -128,13 +132,9 @@ impl ProcessAdapter for XmrigAdapter {
.as_ref()
.ok_or(anyhow::anyhow!("Monero address not set"))?
));
#[allow(clippy::collapsible_match)]
// don't specify threads for ludicrous mode
#[allow(clippy::collapsible_match)]
if let Some(cpu_threads) = self.cpu_threads {
if let Some(cpu_threads) = cpu_threads {
args.push(format!("--threads={}", cpu_threads));
}
if let Some(Some(cpu_threads)) = self.cpu_threads {
args.push(format!("--threads={}", cpu_threads));
}
args.push("--verbose".to_string());
for extra_option in &self.extra_options {
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.9.1",
"version": "0.9.2",
"productName": "Tari Universe (Alpha)",
"mainBinaryName": "Tari Universe (Alpha)",
"identifier": "com.tari.universe.alpha",
Expand Down

0 comments on commit 7f1e9c6

Please sign in to comment.