Page MenuHomePhabricator

Make tests independent of whether CHECKDATASIG is included in mandatory or standard flags
ClosedPublic

Authored by Mengerian on May 17 2019, 16:49.

Details

Summary

Currently, in addition to testing the functioning of CHECKDATASIG,
sigopcount_tests.cpp and checkdatasig_tests.cpp implicitly test that
CHECKDATASIG is not included in standard or mandatory flags.

Change this to make the CHECKDATASIG tests independent of whether CHECKDATASIG
is included in standard or mandatory flags. To maintain test coverage, also
add a test to explicitly test whether CHECKDATASIG is included in standard or
mandatory flags.

Test Plan

make check - passes
Try adding CHECKDATASIG to standard flags - make check - test fails.
Try adding CHECKDATASIG to mandatory flags - make check - test fails.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Mengerian created this revision.May 17 2019, 16:49
Herald added a reviewer: Restricted Project. · View Herald TranscriptMay 17 2019, 16:49
Mengerian abandoned this revision.May 17 2019, 17:16

I realized it makes more sense to combine the code and test changes together in one Diff.

Mengerian updated this revision to Diff 8752.May 20 2019, 20:59

Add test for CHECKDATASIG inclusion in standard or mandatory flags.

Mengerian retitled this revision from Make tests independent of whether CHECKDATASIG is included in flag set to Make tests independent of whether CHECKDATASIG is included in mandatory or standard flags.May 20 2019, 21:02
Mengerian edited the summary of this revision. (Show Details)
Mengerian edited the test plan for this revision. (Show Details)
Mengerian added a reviewer: markblundeberg.

I'm happy with this general direction. Given the severity of consequences of not including it in standardness, the checkdatasig_inclusion_in_standard_and_mandatory_flags is nice to have as a fool-proof check. :)

src/test/checkdatasig_tests.cpp
260 ↗(On Diff #8752)

nit: I would have done
BOOST_CHECK(!(STANDARD_SCRIPT_VERIFY_FLAGS & SCRIPT_ENABLE_CHECKDATASIG))

Mengerian updated this revision to Diff 8762.May 20 2019, 23:21

Simplify boolean logic per Mark's suggestion.

Mengerian planned changes to this revision.May 21 2019, 00:01

need to fix build

Mengerian updated this revision to Diff 8769.May 21 2019, 01:48

Fix stupid mistake.

deadalnix accepted this revision.May 21 2019, 21:19
This revision is now accepted and ready to land.May 21 2019, 21:19