Page MenuHomePhabricator

Increase test coverage on CScript.IsPushOnly()
AbandonedPublic

Authored by markblundeberg on Jun 9 2019, 02:26.

Details

Reviewers
jasonbcox
Mengerian
deadalnix
Group Reviewers
Restricted Project
Maniphest Tasks
T667: add rule for **minimal** push only in scriptSig
Summary

Part of effort to get a scriptsig push restriction consensuse rule that is actually effective in reducing third party malleability, see T667.

In preparation for adding IsMinimalPushOnly, this creates a broader set
of tests.

Test Plan

make check

Diff Detail

Event Timeline

jasonbcox requested changes to this revision.Jun 10 2019, 22:49
jasonbcox added inline comments.
src/test/script_pushonly_tests.cpp
64

Nearly all of the above cases can be rolled into a loop. This provides the following benefits:

  • Covers more cases (especially with some modest randomization mixed in)
  • Less code to read
  • Easier to maintain (given that behavior won't change for different OP_PUSHDATA<N>, which is a reasonable assumption)
78

Why exclude OP_0? It seems that this would be more robust if you devised a set of all opcodes and then removed the ones you don't want to test.

This revision now requires changes to proceed.Jun 10 2019, 22:49