-
Notifications
You must be signed in to change notification settings - Fork 246
feat: add stratum server for solo mining or testing #7419
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
base: development
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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 | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto fmt
| async fn authorize( | ||
| &self, | ||
| id: String, | ||
| main_algo: String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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.