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

Use error code to provide more information about verification failure #187

Merged
merged 2 commits into from
Oct 4, 2021

Conversation

chfast
Copy link
Owner

@chfast chfast commented Sep 30, 2021

Closes #177

@@ -128,13 +140,13 @@ inline result hash(

result hash(const epoch_context_full& context, const hash256& header_hash, uint64_t nonce) noexcept;

inline bool verify_final_hash(const hash256& header_hash, const hash256& mix_hash, uint64_t nonce,
const hash256& boundary) noexcept
inline std::error_code verify_final_hash(const hash256& header_hash, const hash256& mix_hash,

Choose a reason for hiding this comment

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

Did you mean to use ethash_errc here ?
std::error_code is generally used for OS errors.
I believe overall returning an int from enum is enough instead of using the complexity of std::error_category

Just thinking out loud

Copy link
Owner Author

Choose a reason for hiding this comment

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

No, I wanted this to standardize error handling in C++. There is a separate commit which adds support for it. This additionally adds you ability to print the error message (see https://github.com/torquem-ch/silkworm/pull/444/files#diff-b2566784e825a40094310b333efb70a061749da92037515ebfec3398052f0461R143).

Verified

This commit was signed with the committer’s verified signature. The key has expired.
chfast Paweł Bylica

Verified

This commit was signed with the committer’s verified signature. The key has expired.
chfast Paweł Bylica
@chfast chfast merged commit d39e474 into master Oct 4, 2021
@chfast chfast deleted the error_code branch October 4, 2021 11:37
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.

Return codes on ethash::verify method
2 participants