-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Fix misleading error message: Clean stack rule #20006
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
Conversation
darosior
left a comment
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 c2f00b7e2f6c17083b7c72555f5a366c9ff8c673
Agree that this is misleading.
glozow
left a comment
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 c2f00b7
An empty stack is a SCRIPT_ERR_EVAL_FALSE, yes?
No, it's That's actually the point of this change :) bitcoin/src/script/interpreter.cpp Lines 1519 to 1522 in 1b313ca
|
|
@darosior |
instagibbs
left a comment
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 c2f00b7
src/script/script_error.cpp
Outdated
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.
since this is trivial change anyways, maybe "must be exactly one", somehow reads better to me
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.
Agreed. This sounds better.
|
ACK c2f00b7
That was also my initial thought. After digging deeper into the bitcoin/src/script/interpreter.cpp Lines 1516 to 1522 in 1b313ca
Don't know though if that is intended or it was just forgotten to implicitely check for empty and return |
Error messages in cleanstack is misleading as it lets the user believe that there are extra elements on stack which is incorrect if the stack is empty.
c2f00b7 to
af57766
Compare
|
For context, I believe the current behavior is:
I'm ok with this PR as is, but perhaps it's more insightful to split up the two cases entirely, and give them separate error codes? |
|
@sipa if we do that might as well do minimalif too and any others similar |
|
@instagibbs I don't think there are any others like that currently. Splitting out the consensus-defined MINIMALIF behavior in #19953 into a separate error code does make sense. |
|
filed an issue in case someone wants to do it later(or sanket now if he wants) |
theStack
left a comment
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.
re-ACK af57766
|
re-ACK af57766 |
darosior
left a comment
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.
re ACK af57766
|
reACK af57766 |
af57766 Fix misleading error message: Clean stack rule (sanket1729) Pull request description: Error messages in clean stack is misleading as it lets the user believe that there are extra elements on the stack which is incorrect if the stack is empty. Let me know if this requires additional test. ACKs for top commit: instagibbs: re-ACK bitcoin@af57766 gzhao408: reACK bitcoin@af57766 theStack: re-ACK af57766 darosior: re ACK af57766 Tree-SHA512: 88e77416e220b080246fec368f5552a891d102d072b7bee62ac560d5e31c4a8c2ee9cbe569740b253e9df177d21dc788d10d856b2a542ab47761bb81698e4082
CleanStack rule is consensus enforced in Segwitv0. See discussion in bitcoin#20006 for motivation
Summary: Error messages in cleanstack is misleading as it lets the user believe that there are extra elements on stack which is incorrect if the stack is empty. This is a backport of [[bitcoin/bitcoin#20006 | core#20006]] Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, majcosta Reviewed By: #bitcoin_abc, majcosta Differential Revision: https://reviews.bitcoinabc.org/D10411
Error messages in clean stack is misleading as it lets the user believe that there are extra
elements on the stack which is incorrect if the stack is empty.
Let me know if this requires additional test.