Closed fasmat closed 1 year ago
if a nonce was found in a batch during the initialization procedure use the value of the found nonce for the next batch to look for "better" nonces
If easier to implement, can also return all nonces below threshold and use CPU to find the lowest one among those found. Should have negligible impact on performance, if at all.
With the recent move of the initialization to OpenCL the code was updated to look for and store the absolute lowest nonce instead of the first below threshold
Summary:
The work oracle is implemented to return the index of the first hash that is below the given difficulty threshold for Pow when calculating labels.
Instead it should return the index of the hash with the lowest value between
StartPosition
andEndPosition
. Additionally when calculating leaves in batches theInitializer
should continue to look for indices where the resulting hash is lower than the one already found.The reason for this is that instead of finding the first Nonce that satisfies the given difficulty, this finds the "best" (lowest) nonce. If a smesher decides to increase their PoST storage in the future this gives them a higher chance of being able to re-use the nonce instead of being required to search for a new one. Additionally if the lowest found nonce doesn't satisfy the difficulty for the larger PoST they can be sure no index in the PoST already calculated does.
Acceptance criteria:
gpu-post
can also just return all nonces that satisfy the difficulty threshold andpost
can use the CPU to find the lowest one among those found, since we are only expecting ~ 8 nonces during initialization the impact of this should be negligible.Implementation hints:
gpu-post
the comparison from the calculated hash toD
(the difficulty threshold) is here. This needs to be changed such thatD
is updated to the value found and the loop isn't aborted.gpu-post
additionally to the index of the found nonce it's value should be returned as well so it can be used as new difficulty thresholdpost
a found nonce should not stop the oracle from looking for one, but instead here the difficulty should be updated with the found value and theInitializer
should look for better Nonces in successive batches