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

fix share difficulty validation - compare stratum server minimum_share_difficulty as unscaled difficulty #3624

Merged

Conversation

bladedoyle
Copy link
Contributor

Fix for compare of scaled and unscaled difficulty.

@phyro
Copy link
Member

phyro commented Mar 29, 2021

@quentinlesceller I suspect you might be appropriate for the stratum changes, but I can't assign you 👀

fix mix use of scaled and unscaled, add additional comments to clarify which values are which

improved consistency - scaled and unscaled difficulty
@bladedoyle bladedoyle force-pushed the fix_stratum_difficulty_compare branch from 144a830 to cf394c2 Compare March 31, 2021 18:46
Copy link
Contributor

@tromp tromp left a comment

Choose a reason for hiding this comment

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

Instead of all those changes, isn't it simpler to scale up minimum_share_difficulty by the minimum graph weight (of C32) ?
That has the same behaviour, and doesn't require computing scaled_share_difficulty and unscaled_share_difficulty side by side.

@bladedoyle
Copy link
Contributor Author

I think we probably want matching scaled and unscaled methods since the rust project can be used by upstream devs as a library. From personal experience (rust stratum server links to grin library for POW methods) I am certain that people look for it and are confused when no method exists. If you already know the technical details about what scaling is and how to calculate it it seems like a trivial point. But if you dont know the details and the method does not exist that makes things much harder. I would like to leave the method if you dont object too strongly?

@tromp
Copy link
Contributor

tromp commented Mar 31, 2021

Ok, if you think it's useful. But I don't like the separate from_proof_unscaled. Can you just inline it into to_unscaled_difficulty ?

@bladedoyle
Copy link
Contributor Author

Sure, let me take a look at your suggestion and adjust the PR. I hope to find time in the next few days.

@bladedoyle
Copy link
Contributor Author

@tromp Can you take another look to make sure I understood your request correctly.

core/src/pow/types.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@tromp tromp left a comment

Choose a reason for hiding this comment

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

Looks ok, with the suggested change in u64 literal notation.
The release this is going into should make clear that this affects miners who have set a minimum share difficulty greater than the default 1.

@bladedoyle
Copy link
Contributor Author

@tromp Ok. This config item was always intended to be unscaled value, so this is a bug fix. But I do agree that it should be mentioned in the release notes in case people were using the scaled value there.

@quentinlesceller Can you please give a second review and merge if you agree with the changes?

@phyro
Copy link
Member

phyro commented Apr 15, 2021

We seem to show PR titles in https://github.com/mimblewimble/grin/releases. Should we introduce at some point some form of a changelog? e.g. https://github.com/mitsuhiko/redis-rs/blob/master/CHANGELOG.md

@bladedoyle bladedoyle changed the title fix for comparing scaled vs unscaled difficulty fix share difficulty validation - compare stratum server minimum_share_difficulty as unscaled difficulty Apr 16, 2021
@bladedoyle
Copy link
Contributor Author

I updated the PR title to be a more descriptive changes log entry

Copy link
Member

@quentinlesceller quentinlesceller left a comment

Choose a reason for hiding this comment

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

Looking good to me 👍

@phyro
Copy link
Member

phyro commented Apr 22, 2021

@tromp you still have "requested changes" on this one. I'm not sure whether this blocks the merge or not, but I'm assuming it's a 👍 from you as well now?

@quentinlesceller quentinlesceller merged commit 9ed0cd6 into mimblewimble:master Apr 23, 2021
@antiochp antiochp mentioned this pull request May 6, 2021
bayk added a commit to mwcproject/mwc-node that referenced this pull request Jun 17, 2024
…rver minimum_share_difficulty as unscaled difficulty (mimblewimble#3624)
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.

4 participants