Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: choose p2pool squad based on hashrate #997

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src-tauri/Cargo.lock

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

47 changes: 24 additions & 23 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,64 +9,65 @@ version = "0.5.63"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[build-dependencies]
tauri-build = { version = "1.5.5", features = ["isolation"] }
tauri-build = {version = "1.5.5", features = ["isolation"] }

[dependencies]
anyhow = "1"
async-trait = "0.1.81"
async_zip = { version = "0.0.17", features = ["full"] }
async_zip = {version = "0.0.17", features = ["full"] }
auto-launch = "0.5.0"
blake2 = "0.10"
chrono = "0.4.38"
device_query = "2.1.0"
dunce = "1.0.5"
dyn-clone = "1.0.17"
opencl3 = "0.9.5"
flate2 = "1.0.30"
futures-lite = "2.3.0"
futures-util = "0.3.30"
human_format = "1.1.0"
jsonwebtoken = "9.3.0"
keyring = { version = "3.0.5", features = [
keyring = {version = "3.0.5", features = [
"windows-native",
"apple-native",
"linux-native",
] }
libsqlite3-sys = { version = "0.25.1", features = [
libsqlite3-sys = {version = "0.25.1", features = [
"bundled",
] } # Required for tari_wallet
] }# Required for tari_wallet
log = "0.4.22"
log4rs = "1.3.0"
minotari_node_grpc_client = { git = "https://github.com/tari-project/tari.git", branch = "development" }
minotari_wallet_grpc_client = { git = "https://github.com/tari-project/tari.git", branch = "development" }
nix = { version = "0.29.0", features = ["signal"] }
minotari_node_grpc_client = {git = "https://github.com/tari-project/tari.git", branch = "development"}
minotari_wallet_grpc_client = {git = "https://github.com/tari-project/tari.git", branch = "development"}
nix = {version = "0.29.0", features = ["signal"] }
nvml-wrapper = "0.10.0"
open = "5"
opencl3 = "0.9.5"
phraze = "0.3.15"
rand = "0.8.5"
regex = "1.10.5"
reqwest = { version = "0.12.5", features = ["stream", "json", "multipart"] }
reqwest = {version = "0.12.5", features = ["stream", "json", "multipart"] }
sanitize-filename = "0.5"
semver = "1.0.23"
sentry = { version = "0.34.0", features = ["anyhow"] }
sentry = {version = "0.34.0", features = ["anyhow"] }
sentry-tauri = "0.3.0"
serde = { version = "1", features = ["derive"] }
serde = {version = "1", features = ["derive"] }
serde_json = "1"
serde_yaml = "0.9.10"
sha2 = "0.10.8"
simple_moving_average = "1.0.2"
sys-locale = "0.3.1"
sysinfo = "0.31.2"
tar = "0.4.26"
tari_common = { git = "https://github.com/tari-project/tari.git", branch = "development" }
tari_common_types = { git = "https://github.com/tari-project/tari.git", branch = "development" }
tari_core = { git = "https://github.com/tari-project/tari.git", branch = "development", features = [
tari_common = {git = "https://github.com/tari-project/tari.git", branch = "development"}
tari_common_types = {git = "https://github.com/tari-project/tari.git", branch = "development"}
tari_core = {git = "https://github.com/tari-project/tari.git", branch = "development", features = [
"transactions",
] }
tari_crypto = "0.21.0"
tari_key_manager = { git = "https://github.com/tari-project/tari.git", branch = "development" }
tari_shutdown = { git = "https://github.com/tari-project/tari.git", branch = "development" }
tari_key_manager = {git = "https://github.com/tari-project/tari.git", branch = "development"}
tari_shutdown = {git = "https://github.com/tari-project/tari.git", branch = "development"}
tari_utilities = "0.8.0"
tauri = { version = "1.8.0", features = [ "window-unmaximize", "window-unminimize",
tauri = {version = "1.8.0", features = [ "window-unminimize", "window-unmaximize",
"os-all",
"system-tray",
"updater",
Expand All @@ -85,11 +86,11 @@ tauri = { version = "1.8.0", features = [ "window-unmaximize", "window-unminimiz
"icon-png",
"process-command-api",
] }
tauri-plugin-single-instance = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" }
tauri-plugin-single-instance = {git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1"}
thiserror = "1.0.26"
tokio = { version = "1", features = ["full"] }
tokio-util = { version = "0.7.11", features = ["compat"] }
xz2 = { version = "0.1.7", features = ["static"] } # static bind lzma
tokio = {version = "1", features = ["full"] }
tokio-util = {version = "0.7.11", features = ["compat"] }
xz2 = {version = "0.1.7", features = ["static"] }# static bind lzma
zip = "2.2.0"

[target.'cfg(windows)'.dependencies]
Expand All @@ -98,7 +99,7 @@ winreg = "0.52.0"
# needed for keymanager. TODO: Find a way of creating a keymanager without bundling sqlite
chrono = "0.4.38"
device_query = "2.1.0"
libsqlite3-sys = { version = "0.25.1", features = ["bundled"] }
libsqlite3-sys = {version = "0.25.1", features = ["bundled"] }
log = "0.4.22"
nvml-wrapper = "0.10.0"
rand = "0.8.5"
Expand Down
22 changes: 22 additions & 0 deletions src-tauri/log4rs/universe_sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,22 @@ appenders:
encoder:
pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} {l:5} {m}{n} // {f}:{L} "

cpu_hashrate:
kind: rolling_file
path: "{{log_dir}}/universe/cpu_hashrate.log"
policy:
kind: compound
trigger:
kind: size
limit: 10mb
roller:
kind: fixed_window
base: 1
count: 5
pattern: "{{log_dir}}/universe/cpu_hashrate.{}.log"
encoder:
pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} {m}{n}"

# Set the default logging level to "info"
root:
level: info
Expand All @@ -92,3 +108,9 @@ loggers:
appenders:
- web
additive: false

cpu_hashrate:
level: debug
appenders:
- cpu_hashrate
additive: false
22 changes: 22 additions & 0 deletions src-tauri/src/app_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ pub struct AppConfigFromFile {
custom_max_gpu_usage: Option<isize>,
#[serde(default = "default_true")]
auto_update: bool,
#[serde(default = "default_true")]
p2pool_auto_select_squad: bool,
#[serde(default)]
p2pool_squad: Option<String>,
#[serde(default = "default_false")]
custom_power_levels_enabled: bool,
#[serde(default = "default_false")]
Expand Down Expand Up @@ -108,6 +112,8 @@ impl Default for AppConfigFromFile {
mmproxy_use_monero_fail: false,
auto_update: true,
reset_earnings: false,
p2pool_auto_select_squad: true,
p2pool_squad: None,
custom_power_levels_enabled: false,
sharing_enabled: false,
}
Expand Down Expand Up @@ -200,6 +206,8 @@ pub(crate) struct AppConfig {
custom_max_cpu_usage: Option<isize>,
custom_max_gpu_usage: Option<isize>,
auto_update: bool,
p2pool_auto_select_squad: bool,
p2pool_squad: Option<String>,
custom_power_levels_enabled: bool,
sharing_enabled: bool,
}
Expand Down Expand Up @@ -239,6 +247,8 @@ impl AppConfig {
mmproxy_monero_nodes: vec!["https://xmr-01.tari.com".to_string()],
custom_power_levels_enabled: false,
auto_update: true,
p2pool_auto_select_squad: true,
p2pool_squad: None,
sharing_enabled: false,
}
}
Expand Down Expand Up @@ -303,6 +313,8 @@ impl AppConfig {
} else {
self.reset_earnings = false;
}
self.p2pool_auto_select_squad = config.p2pool_auto_select_squad;
self.p2pool_squad = config.p2pool_squad;
self.sharing_enabled = config.sharing_enabled;
}
Err(e) => {
Expand Down Expand Up @@ -359,6 +371,14 @@ impl AppConfig {
self.ludicrous_mode_cpu_threads
}

pub fn p2pool_auto_select_squad(&self) -> bool {
self.p2pool_auto_select_squad
}

pub fn p2pool_squad(&self) -> Option<&String> {
self.p2pool_squad.as_ref()
}

pub fn anon_id(&self) -> &str {
&self.anon_id
}
Expand Down Expand Up @@ -626,6 +646,8 @@ impl AppConfig {
mmproxy_monero_nodes: self.mmproxy_monero_nodes.clone(),
mmproxy_use_monero_fail: self.mmproxy_use_monero_fail,
auto_update: self.auto_update,
p2pool_auto_select_squad: self.p2pool_auto_select_squad,
p2pool_squad: self.p2pool_squad.clone(),
custom_power_levels_enabled: self.custom_power_levels_enabled,
sharing_enabled: self.sharing_enabled,
};
Expand Down
Loading