Skip to content

Commit

Permalink
Merge branch 'regolith-labs:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
KlementXV authored Aug 22, 2024
2 parents a491752 + 59afe6e commit 40f383c
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 13 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

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

16 changes: 14 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ore-cli"
version = "2.3.0"
version = "2.3.1"
edition = "2021"
license = "Apache-2.0"
description = "A command line interface for ORE cryptocurrency mining."
Expand All @@ -27,7 +27,7 @@ chrono = "0.4.38"
clap = { version = "4.4.12", features = ["derive"] }
colored = "2.0"
core_affinity = "0.8.1"
drillx = "2.0.0"
drillx = "2.1.0"
futures = "0.3.30"
indicatif = "0.17.8"
num_cpus = "1.16.0"
Expand Down Expand Up @@ -56,3 +56,15 @@ serde = { version = "1.0", features = ["derive"] }
# ore-api = { path = "../ore/api" }
# ore-utils = { path = "../ore/utils" }

[profile.release]
opt-level = 3 # Optimize for binary size. You can use "3" for full optimizations if binary size isn't an issue.
codegen-units = 1 # Better optimization with fewer codegen units
lto = true # Enable Link Time Optimization (LTO)
debug = false # Disable debug info to reduce binary size
panic = 'abort' # Reduces the binary size further by not including unwinding information
rpath = false
incremental = false
overflow-checks = false

[build]
rustflags = ["-C", "target-cpu=native"]
11 changes: 6 additions & 5 deletions src/mine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,23 +124,24 @@ impl Miner {
let mut best_difficulty = 0;
let mut best_hash = Hash::default();
loop {
// Create hash
if let Ok(hx) = drillx::hash_with_memory(
// Get hashes
let hxs = drillx::hashes_with_memory(
&mut memory,
&proof.challenge,
&nonce.to_le_bytes(),
) {
);

// Look for best difficulty score in all hashes
for hx in hxs {
let difficulty = hx.difficulty();
if difficulty.gt(&best_difficulty) {
best_nonce = nonce;
best_difficulty = difficulty;
best_hash = hx;
// {{ edit_1 }}
if best_difficulty.gt(&*global_best_difficulty.read().unwrap())
{
*global_best_difficulty.write().unwrap() = best_difficulty;
}
// {{ edit_1 }}
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/send_and_confirm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ impl Miner {

// Confirm transaction
'confirm: for _ in 0..CONFIRM_RETRIES {
std::thread::sleep(Duration::from_millis(CONFIRM_DELAY));
tokio::time::sleep(Duration::from_millis(CONFIRM_DELAY)).await;
match client.get_signature_statuses(&[sig]).await {
Ok(signature_statuses) => {
for status in signature_statuses.value {
Expand Down Expand Up @@ -264,7 +264,7 @@ impl Miner {
}

// Retry
std::thread::sleep(Duration::from_millis(GATEWAY_DELAY));
tokio::time::sleep(Duration::from_millis(GATEWAY_DELAY)).await;
if attempts > GATEWAY_RETRIES {
log_error(&progress_bar, "Max retries", true);
return Err(ClientError {
Expand Down
2 changes: 1 addition & 1 deletion src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub async fn get_updated_proof_with_authority(
if proof.last_hash_at.gt(&lash_hash_at) {
return proof;
}
std::thread::sleep(Duration::from_millis(1000));
tokio::time::sleep(Duration::from_millis(1_000)).await;
}
}

Expand Down

0 comments on commit 40f383c

Please sign in to comment.