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
There was a problem hiding this comment.
Seems to have lost the updates from the upstream commit to this comment.
There was a problem hiding this comment.
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.
Right, but the comment update itself still applies.
|
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
isNullDatastandard 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.