Make non-minimal OP_IF/NOTIF argument non-standard for P2WSH#8526
Make non-minimal OP_IF/NOTIF argument non-standard for P2WSH#8526laanwj merged 1 commit intobitcoin:masterfrom
Conversation
src/script/interpreter.h
Outdated
There was a problem hiding this comment.
Mention that it only applies to witness scripts.
There was a problem hiding this comment.
will fix in a squash commit later
src/test/data/script_tests.json
Outdated
There was a problem hiding this comment.
I don't think we need to include any cases whose behaviour is not changed by minimalif.
There was a problem hiding this comment.
I'm not sure what should(not) be tested. I want to show that the new rules are not applied to non segwit scripts by accident
|
concept ACK |
|
Prefer to just have an OP_CASTTOBOOL added. This breaks conditionals on OP_DEPTH and OP_SIZE for example. |
|
OP_CASTTOBOOL can't solve the problem. CastToBool in OP_IF is exactly the source of malleability. We needs to turn a OP_NOP into OP_ISBOOLVERIFY. In any case, that requires a softfork which can't be done any time soon. What we need now is a quick policy patch. An alternative is to make |
|
we did segwit so that we don't have to care about malleability in inputs, but now we care about malleability inside witness inputs? o_O I would prefer to not touch that as DEPTH IF and SIZE IF are still useful. I'm not fan making special case either. |
|
Relevant discussion https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2016-August/013014.html |
|
ok read the conversation, I like the proposition of @jl2012 of making it a relay rule for now and deciding whether to make it a SF later. Concept ACK. |
|
No objection to a policy rule, just wanted to point that out here so it didn't get lost. :) (OP_ISBOOLVERIFY could be policy-enforced just as well though...?) |
|
concept ACK as relay rule only |
|
@luke-jr , a "policy opcode" means we could never use that NOP for other purpose again, even if we abandon the softfork plan. |
|
@jl2012 Not really. It simply means we'd need to wait a few releases from when it's policy-redefined to a straight-disallowed NOP, before it is safe to reuse. Along those lines, I wonder if it would make sense to redefine other unallocated opcodes as NOPs inside segwit now (although I doubt it will be useful in the long run). |
|
@luke-jr you can't redefine policy opcode because people are likely to have utxos with that. and it won't make sense to create more NOPs. The use of NOPs is really limited as they can't manipulate the stack at all. For example, my most wanted code, OP_CAT, could not be done with and NOP |
|
Concept ACK. OK with either policy rule or consensus rule, finalized LN bitcoin scripts will be compatible. To echo jl2012 's comment about having UTXOs, policy rules to an eventual SF is complicated because doing something as simple as |
instagibbs
left a comment
There was a problem hiding this comment.
utACK e0b94de0dfbec9b305964a594f2e4785de51655d
src/script/interpreter.cpp
Outdated
There was a problem hiding this comment.
nit: put some () around the flag check for ease of reading
|
utACK c72c5b1 |
|
Code-review ACK c72c5b1 |
…2WSH c72c5b1 Make non-minimal OP_IF/NOTIF argument non-standard for P2WSH (Johnson Lau)
Github-Pull: bitcoin#8526 Rebased-From: c72c5b1
The argument for OP_IF/NOTIF should be exactly 0x01 or empty vector in P2WSH. Otherwise, a relay node may replace the argument with arbitrary data. This is now applied as a policy but eventually should become a softfork.
This is not applied to non-segwit scripts because people may have P2SH UTXOs that are not complying with the new rules.