feat: add stratum server for solo mining or testing#7419
feat: add stratum server for solo mining or testing#7419stringhandler wants to merge 24 commits intotari-project:developmentfrom
Conversation
|
Caution Review failedAn error occurred during the review process. Please try again later. Warning Tools execution failed with the following error: Failed to run tools: 8 RESOURCE_EXHAUSTED: Received message larger than max (35831275 vs 4194304) ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
applications/minotari_node/src/stratum/block_template_repository.rs
Outdated
Show resolved
Hide resolved
| // Handle successful submission | ||
| Ok(SubmitResponse { | ||
| id, | ||
| result: true, // Placeholder for actual result |
There was a problem hiding this comment.
replace with something?
applications/minotari_node/src/stratum/tari_sha3x_stratum_handler.rs
Outdated
Show resolved
Hide resolved
base_layer/core/src/base_node/comms_interface/inbound_handlers.rs
Outdated
Show resolved
Hide resolved
remove uncommented code
hansieodendaal
left a comment
There was a problem hiding this comment.
As of yet I have not run this code, but intent to. I have some comments:
- The majority deals with consistency, error handling, some uncompleted logic paths, missing copyright notices and missing doc comments.
- I also think we can benefit to have a basic
README.mdinsideapplications\minotari_node\src\stratum.
| pub struct StratumServerConfig { | ||
| pub enabled: bool, | ||
| pub port: u16, | ||
| } |
There was a problem hiding this comment.
We need to add these to the sample config.toml file
| loop { | ||
| select! { | ||
| _ = shutdown_signal.wait() => { | ||
| info!( "Shutting down Stratum server"); | ||
| break; |
There was a problem hiding this comment.
Something funny with the formatting here
| 2 => { | ||
| if login_parts[1].ends_with("M") { | ||
| let difficulty = login_parts[1].replace("M", ""); | ||
| let difficulty = difficulty.parse::<f64>().unwrap_or(self.min_difficulty as f64); |
There was a problem hiding this comment.
Maybe guard against negative input and check limits?
| (difficulty * 1_000_000.0).floor() as u64 | ||
| } else if login_parts[1].ends_with("G") { | ||
| let difficulty = login_parts[1].replace("G", ""); | ||
| let difficulty = difficulty.parse::<f64>().unwrap_or(self.min_difficulty as f64); |
There was a problem hiding this comment.
ditto _ negative input and limits_
| ).await; | ||
|
|
||
| // Send mining notify | ||
| let difficulty = "1f02dc3c".to_string(); // Example difficulty, replace with actual logic |
There was a problem hiding this comment.
This still missing?
| return Err(anyhow::anyhow!("No blob available for the latest block")); | ||
| } | ||
| let original_mining_hash = blob.clone(); | ||
| let blob = if main_algo == "RandomXT" { |
There was a problem hiding this comment.
| let blob = if main_algo == "RandomXT" { | |
| let blob = if main_algo == PowAlgorithm::RandomXT.to_string() { |
| id: id.to_string(), | ||
| job: StratumJob { | ||
| job_id: job_id.to_string(), | ||
| algo: if main_algo == "RandomXT" { |
There was a problem hiding this comment.
| algo: if main_algo == "RandomXT" { | |
| algo: if main_algo == PowAlgorithm::RandomXT.to_string() { |
| // The format is: | ||
| // | 1 byte | 1 byte | 1 bytes | 32 bytes | 8 bytes | 1 byte | 32 bytes| | ||
| // | major version | minor version | timestamp | mining_hash | nonce (big endian) | pow_algo | pow_data, excluding algo, padded to 32 bytes | |
| async fn authorize( | ||
| &self, | ||
| id: String, | ||
| main_algo: String, |
There was a problem hiding this comment.
| main_algo: String, | |
| main_algo: PowAlgorithm, |
| } | ||
|
|
||
|
|
||
| let response = handler.authorize(id.clone(), "Cuckaroo".to_string(), login , worker_name, pass, nonce).await; |
There was a problem hiding this comment.
| let response = handler.authorize(id.clone(), "Cuckaroo".to_string(), login , worker_name, pass, nonce).await; | |
| let response = handler.authorize(id.clone(), PowAlgorithm::Cuckaroo, login , worker_name, pass, nonce).await; |
No description provided.