-
Notifications
You must be signed in to change notification settings - Fork 38.8k
script: return proper error for CScriptNum errors
#34381
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
base: master
Are you sure you want to change the base?
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/34381. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please copy-paste ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
|
Neat. Unit tests and functional tests pass on my end. tACK 6b307a2 You can remove |
6b307a2 to
3e7c250
Compare
Just removed it since it's now unused. |
|
tACK 3e7c250 |
It will be used for errors related to CScriptNum (e.g. overflow or encoding errors). Currently, we simply return unknown error for these errors.
3e7c250 to
5777cb8
Compare
|
Force-pushed addressing #34381 (comment) |
5777cb8 to
6f7b432
Compare
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.
ACK 6f7b432
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.
ACK 6f7b432
|
|
||
| static ScriptErrorDesc script_errors[]={ | ||
| {SCRIPT_ERR_OK, "OK"}, | ||
| {SCRIPT_ERR_UNKNOWN_ERROR, "UNKNOWN_ERROR"}, |
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.
Interesting, is this now unreachable?
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.
I think so. I don't see a explicit scenario for this unknown error.
When evaluating a script, the current code is bad for analyzing some errors because it returns
SCRIPT_ERR_UNKNOWN_ERRORfor errors that are clearly known.CScriptNumhas two well defined errors: number overflow and non-minimally encoded number. However, for both errors we return as unknown. This PR changes it by adding a new ScriptError that is used for anyCScriptNumerror.