HomePhabricator

Make more script validation flags backward compatible

Description

Make more script validation flags backward compatible

Summary:
This is a backport of PR10699 ( https://github.com/bitcoin/bitcoin/pull/10699/files ),
but has to be adapted slightly since we don't just do softforking flags.

Pull request description:

This change makes `SCRIPT_VERIFY_UPGRADABLE_NOPS` not apply to `OP_CHECKLOCKTIMEVERIFY` and `OP_CHECKSEQUENCEVERIFY`. This is a no-op as `UPGRADABLE_NOPS` is only set for mempool transactions, and those always have `SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY` and `SCRIPT_VERIFY_CHECKSEQUENCEVERIFY` set as well. The advantage is that setting more flags now always results in a reduction in acceptable scripts (=softfork).

This results in a nice and testable property for validation, for which a new test is added.

This also means that the introduction of a new definition for a NOP or witness version will likely need the following procedure (example OP_NOP8 here)
* Remove OP_NOP8 from being affected by `SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS`.
* Add a `SCRIPT_VERIFY_DISCOURAGE_NOP8`, which only applies to `OP_NOP8`.
* Add a `SCRIPT_VERIFY_NOP8` which implements the new consensus logic.
* Before activation, add `SCRIPT_VERIFY_DISCOURAGE_NOP8` to the mempool flags.
* After activation, add `SCRIPT_VERIFY_NOP8` to both the mempool and consensus flags.

Test Plan:

make check
test_runner.py

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D4703

Details

Provenance
Mark Lundeberg <markblundeberg@users.noreply.github.com>Authored on Dec 11 2019, 22:11
FabienPushed on Dec 17 2019, 07:42
Reviewer
Restricted Project
Differential Revision
D4703: Make more script validation flags backward compatible
Parents
rSTAGING8e630eb8f3c5: fix fee estimation bug in functional tests
Branches
Unknown
Tags
Unknown