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
Share difficulty incorrect in share result log #251
Comments
I found this about floating point comparisons https://stackoverflow.com/questions/22279619/floating-point-number-comparison-trick-inline-assembly The float test isn't the problem, but there is the overhead to convert the 256 bit hash to a It seems pretty clear that the 256 bit raw hash is the preferred default fomat in the hash loop. |
A hybrid solution is being considered. Use the 256 bit hash in the hash loop to do the first test The interface will need some work. The initial test can be either 32 bits or 64 bits. 64 bits (hash_q3) is preferred but 32 bits (hash_d7) Other than ensuring the initial blockheader data is updated with the correct nonce value all This creates the opportunity to create a single function to test the hash and submit a |
I'm currently testing a fix as described above. It needs to be propagated to all algos individually. The next full release will have all currently active algos converted. |
My curiosity is now turning to suspicion regarding the conversion from bitstream to double precsion This doesn't seem to be related to the enhancements so they may be deployed in a test build |
The incorrect data seems to be the sharediff. Some blocks sloved were falsely reported This doesn't affect the hash test or the effective hash rate, only a stats error. This may result in calculating the sharediff differently, using the raw 256 bit hash and target, |
I changed the sharediff calculation to use the 256 bit hash and target, the same hash as computed The targetdiff is typicallly around 5e-8 but there are no shares below 1e-7. I would expect more |
The main issue seems to be fixed in v3.12.4.5 but there'sstill some follow up I want to do to |
Solo shares are being reported as "Accepted" instead of "BLOCK SOLVED" as they should be. Also the share ratio is missing the % for getwork. It gets displayed for stratum using the same |
Solved the % problem by changing the definition to be a fraction instead of a percentage. |
Found a bug in share diff calculation, simple fix. Explaims a lot of things. |
cpuminer-opt-3.12.5 s released with a fix for share difficulty. |
Closing. |
Since at least v3.11.0 the share dificulty and share ratio have been incorrect.
This was dscovered while researching the relationship and handling of 256 bit hash and target
values and their corresponding difficulties. It is quite convoluted with redundant conversions.
To start stratum provides a stratum diff which is used to calculate a share's target diff. The target
diff is converted to a 256 bit hash target.
Getwork provides a 256 bit hash target which is converted to a target diff.
The hash value and diff are redundant, essentially reciprocals of each other. This also applies
to the target.
Eliminating the redundancy would be ideal but not practical. However a default can be established
that minimizes the convversions.
There are some performance considerations when choosing the default including:
Testing the hash with integer arithmetic requires 8 64 bit compares in the worst case.
But in the most likely and also best case it requires only 1. A best case optimization is
very efficient.
Testing the diff with double precision floating point requires 1 comparison in all cases, but an
expensive one.
The hash test is in the innner hash loop, executed for every hash iteration, so it benefits
from an efficient first test. This alone may more than compensate for any redundancy in
less travelled code.
Needs more research.
The text was updated successfully, but these errors were encountered: