-
Notifications
You must be signed in to change notification settings - Fork 311
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
RandomX commitments with double-hashing #265
Conversation
Looks fine to me. What's the status of this PR? Is it the final version? |
I'm not planning any modifications to this PR unless something comes up during the review. The changes are fairly small, so it's mostly about the concept. One thing to note is that batched hashing using the |
That wouldn't be an issue for mining software because it only needs to remember the previous nonce value (4 bytes). But yes, |
src/randomx.cpp
Outdated
void randomx_calculate_hash_v2(const void* input, size_t inputSize, const void* v1_in, void* v2_out) { | ||
assert(inputSize == 0 || input != nullptr); | ||
assert(v1_in != nullptr); | ||
assert(v2_out != nullptr); |
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.
Hi, this can help prevent user error when calling the library.
assert(v1_in != v2_out);
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.
It will work perfectly fine with v1_in == v2_out
.
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.
Thanks, good to know.
I renamed the new function to |
Related to this proposal: monero-project/monero#8827
The commitment is calculated from the hash and its input (i.e. the block header). The idea is that the output of
randomx_calculate_hash
will be appended to the block header and the difficulty will be calculated based on the output ofrandomx_calculate_commitment
, which is very fast.