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

Verify against difficulty #195

Merged
merged 1 commit into from
Oct 29, 2021
Merged

Verify against difficulty #195

merged 1 commit into from
Oct 29, 2021

Conversation

chfast
Copy link
Owner

@chfast chfast commented Oct 27, 2021

Add new Ethash verification function verify_against_difficulty() which takes difficulty number
directly. Previously only verify_against_boundary() was available which required converting difficulty to boundary (division) by users. The new verify_against_difficulty() performs check hash * difficulty <= 2^256 and division is not needed.

Closes #185.

@codecov-commenter
Copy link

codecov-commenter commented Oct 27, 2021

Codecov Report

Merging #195 (abbb147) into master (3ba7f6c) will increase coverage by 0.06%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #195      +/-   ##
==========================================
+ Coverage   98.58%   98.65%   +0.06%     
==========================================
  Files          24       24              
  Lines        1840     1929      +89     
==========================================
+ Hits         1814     1903      +89     
  Misses         26       26              
Flag Coverage Δ
be 53.32% <47.31%> (-0.36%) ⬇️
default 99.78% <100.00%> (+0.01%) ⬆️
x86_64 90.42% <100.00%> (+0.47%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
lib/ethash/ethash-internal.hpp 100.00% <ø> (ø)
include/ethash/ethash.hpp 100.00% <100.00%> (ø)
lib/ethash/ethash.cpp 100.00% <100.00%> (ø)
test/unittests/test_difficulty.cpp 100.00% <100.00%> (ø)
test/unittests/test_ethash.cpp 94.71% <100.00%> (+0.22%) ⬆️

Add new Ethash verification function which takes difficulty number
directly. Previously only verify_against_boundary() was available which
required converting difficulty to boundary (division).
The new verify_against_difficulty() performs check
hash * difficulty <= 2^256 and division is not needed.
@chfast chfast requested a review from gumb0 October 27, 2021 15:01
@chfast chfast marked this pull request as ready for review October 27, 2021 15:01
@chfast chfast requested a review from axic October 27, 2021 15:01
Copy link

@AndreaLanfranchi AndreaLanfranchi left a comment

Choose a reason for hiding this comment

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

Looks good to me

@chfast chfast merged commit 11bf679 into master Oct 29, 2021
@chfast chfast deleted the difficulty branch October 29, 2021 18:11
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.

Verify against difficulty
3 participants