-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Make non-minimal OP_IF/NOTIF argument non-standard for P2WSH #8526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/script/interpreter.h
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mention that it only applies to witness scripts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will fix in a squash commit later
src/test/data/script_tests.json
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to include any cases whose behaviour is not changed by minimalif.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
|
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 |
afk11
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review / tested ACK
instagibbs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK e0b94de0dfbec9b305964a594f2e4785de51655d
src/script/interpreter.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: put some () around the flag check for ease of reading
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed with c72c5b1
|
utACK c72c5b1 |
|
Code-review ACK c72c5b1 |
…2WSH c72c5b1 Make non-minimal OP_IF/NOTIF argument non-standard for P2WSH (Johnson Lau)
sipa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK c72c5b1
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.