8000
Skip to content

Conversation

@stringhandler
Copy link
Collaborator

No description provided.

@coderabbitai
Copy link
Contributor
coderabbitai bot commented Aug 15, 2025

Caution

Review failed

An 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
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

// Handle successful submission
Ok(SubmitResponse {
id,
result: true, // Placeholder for actual result
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace with something?

remove uncommented code
@SWvheerden SWvheerden marked this pull request as ready for review September 8, 2025 10:03
@SWvheerden SWvheerden requested a review from a team as a code owner September 8, 2025 10:03
Copy link
Contributor
@hansieodendaal hansieodendaal left a 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.md inside applications\minotari_node\src\stratum.

Comment on lines +188 to +191
pub struct StratumServerConfig {
pub enabled: bool,
pub port: u16,
}
Copy link
Contributor

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

Comment on lines +127 to +131
loop {
select! {
_ = shutdown_signal.wait() => {
info!( "Shutting down Stratum server");
break;
Copy link
Contributor

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);
Copy link
Contributor

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);
Copy link
Contributor

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
Copy link
Contributor

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" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
algo: if main_algo == "RandomXT" {
algo: if main_algo == PowAlgorithm::RandomXT.to_string() {

Comment on lines +322 to +324
// 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 |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto fmt

1E79

async fn authorize(
&self,
id: String,
main_algo: String,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
main_algo: String,
main_algo: PowAlgorithm,

}


let response = handler.authorize(id.clone(), "Cuckaroo".to_string(), login , worker_name, pass, nonce).await;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

0