-
Notifications
You must be signed in to change notification settings - Fork 296
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
txscript: Correct nulldata standardness check. #935
txscript: Correct nulldata standardness check. #935
Conversation
This corrects the isNullData standard transaction type test to work properly with canonically-encoded data pushes. In particular, single byte data pushes that are small integers (0-16) are converted to the equivalent numeric opcodes when canonically encoded and the code failed to detect them properly. It also adds several tests to ensure that both canonical and non-canonical nulldata scripts are recognized properly and modifies the test failure print to include the script that failed. This does not affect consensus since it is just a standardness check.
That standardness rules for nulldata are not exactly the same in Decred. You'll need to examine them and update this accordingly as a part of the merge commit. In particular the |
4fc2c5b
to
69735b7
Compare
txscript/standard_test.go
Outdated
@@ -882,7 +913,7 @@ var scriptClassTests = []scriptClassTest{ | |||
{ | |||
// Nulldata with more than max allowed data (so therefore |
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.
Seems to have lost the updates from the upstream commit to this 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.
maintained the script for that test because the one from upstream was categorized as nulldata
. I suspect it's because the script doesn't exceed MaxDataCarrierSize
.
--- FAIL: TestScriptClass (0.00s) standard_test.go:996: nulldata exceed max standard push: expected nonstandard got nulldata (script 6a4c51046708afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef3046708afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef308)
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.
Right, but the comment update itself still applies.
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.
oh right, updating.
I updated the description to include the upstream PR description as well since it makes it much easier for reviewers. |
thanks, will remember to do that next time. |
69735b7
to
2d0d424
Compare
Updated. |
This PR contains the following upstream commits:
This corrects the
isNullData
standard transaction type test to work properly with canonically-encoded data pushes. In particular, single byte data pushes that are small integers (0-16) are converted to theequivalent numeric opcodes when canonically encoded and the code failed to detect them properly.
It also adds several tests to ensure that both canonical and non-canonical nulldata scripts are recognized properly and modifies the test failure print to include the script that failed.
This does not affect consensus since it is just a standardness check.