diff --git a/bip-tapscript.mediawiki b/bip-tapscript.mediawiki
index f0f0ebfd..9044c712 100644
--- a/bip-tapscript.mediawiki
+++ b/bip-tapscript.mediawiki
@@ -52,13 +52,13 @@ The rules below only apply when validating a transaction input for which all of
Validation of such inputs must be equivalent to performing the following steps in the specified order.
# If the input is invalid due to BIP16, BIP141, or bip-taproot, fail.
# The script as defined in bip-taproot (i.e., the penultimate witness stack element after removing the optional annex) is called the '''tapscript''' and is decoded into opcodes, one by one:
-## If any opcode numbered ''80, 98, 126-129, 131-134, 137-138, 141-142, 149-153, 187-254'' is encountered, validation succeeds (none of the rules below apply). This is true even if later bytes in the tapscript would fail to decode otherwise. These opcodes are renamed to OP_SUCCESS80
, ..., OP_SUCCESS254
, and collectively known as OP_SUCCESSx
[''']OP_SUCCESSx
''' OP_SUCCESSx
is a mechanism to upgrade the Script system. Using an OP_SUCCESSx
before its meaning is defined by a softfork is insecure and leads to fund loss. The inclusion of OP_SUCCESSx
in a script will pass it unconditionally. It precedes any script execution rules to avoid the difficulties in specifying various edge cases, for example: OP_SUCCESSx
being the 202nd opcode, OP_SUCCESSx
after too many signature opcodes, or even scripts with conditionals lacking OP_ENDIF
. The mere existence of an OP_SUCCESSx
anywhere in the script will guarantee a pass for all such cases. OP_SUCCESSx
are similar to the OP_RETURN
in very early bitcoin versions (v0.1 up to and including v0.3.5). The original OP_RETURN
terminates script execution immediately, and return pass or fail based on the top stack element at the moment of termination. This was one of a major design flaws in the original bitcoin protocol as it permitted unconditional third party theft by placing an OP_RETURN
in scriptSig
. This is not a concern in the present proposal since it is not possible for a third party to inject an OP_SUCCESSx
to the validation process, as the OP_SUCCESSx
is part of the script (and thus committed to be the taproot output), implying the consent of the coin owner. OP_SUCCESSx
can be used for a variety of upgrade possibilities:
+## If any opcode numbered ''80, 98, 126-129, 131-134, 137-138, 141-142, 149-153, 187-254'' is encountered, validation succeeds (none of the rules below apply). This is true even if later bytes in the tapscript would fail to decode otherwise. These opcodes are renamed to OP_SUCCESS80
, ..., OP_SUCCESS254
, and collectively known as OP_SUCCESSx
[''']OP_SUCCESSx
''' OP_SUCCESSx
is a mechanism to upgrade the Script system. Using an OP_SUCCESSx
before its meaning is defined by a softfork is insecure and leads to fund loss. The inclusion of OP_SUCCESSx
in a script will pass it unconditionally. It precedes any script execution rules to avoid the difficulties in specifying various edge cases, for example: OP_SUCCESSx
in a script with an input stack larger than 1000 elements, OP_SUCCESSx
after too many signature opcodes, or even scripts with conditionals lacking OP_ENDIF
. The mere existence of an OP_SUCCESSx
anywhere in the script will guarantee a pass for all such cases. OP_SUCCESSx
are similar to the OP_RETURN
in very early bitcoin versions (v0.1 up to and including v0.3.5). The original OP_RETURN
terminates script execution immediately, and return pass or fail based on the top stack element at the moment of termination. This was one of a major design flaws in the original bitcoin protocol as it permitted unconditional third party theft by placing an OP_RETURN
in scriptSig
. This is not a concern in the present proposal since it is not possible for a third party to inject an OP_SUCCESSx
to the validation process, as the OP_SUCCESSx
is part of the script (and thus committed to be the taproot output), implying the consent of the coin owner. OP_SUCCESSx
can be used for a variety of upgrade possibilities:
* An OP_SUCCESSx
could be turned into a functional opcode through a softfork. Unlike OP_NOPx
-derived opcodes which only have read-only access to the stack, OP_SUCCESSx
may also write to the stack. Any rule changes to an OP_SUCCESSx
-containing script may only turn a valid script into an invalid one, and this is always achievable with softforks.
* Since OP_SUCCESSx
precedes size check of initial stack and push opcodes, an OP_SUCCESSx
-derived opcode requiring stack elements bigger than 520 bytes may uplift the limit in a softfork.
* OP_SUCCESSx
may also redefine the behavior of existing opcodes so they could work together with the new opcode. For example, if an OP_SUCCESSx
-derived opcode works with 64-bit integers, it may also allow the existing arithmetic opcodes in the ''same script'' to do the same.
* Given that OP_SUCCESSx
even causes potentially unparseable scripts to pass, it can be used to introduce multi-byte opcodes, or even a completely new scripting language when prefixed with a specific OP_SUCCESSx
opcode..
## If any push opcode fails to decode because it would extend past the end of the tapscript, fail.
-# If the size of any element in the '''initial stack''' as defined in bip-taproot (i.e., the witness stack after removing both the optional annex and the two last stack elements after that) is bigger than 520 bytes, fail.
+# If the '''initial stack''' as defined in bip-taproot (i.e., the witness stack after removing both the optional annex and the two last stack elements after that) violates any resource limits (stack size, and size of the elements in the stack; see "Resource Limits" below), fail. Note that this check can be bypassed using OP_SUCCESSx
.
# The tapscript is executed according to the rules in the following section, with the initial stack as input.
## If execution fails for any reason, fail.
## If the execution results in anything but exactly one element on the stack which evaluates to true with CastToBool()
, fail.