You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
miniscript: adapt resources checks depending on context
Under Tapscript, there is:
- No limit on the number of OPs
- No limit on the script size, it's implicitly limited by the maximum
(standard) transaction size.
- No standardness limit on the number of stack items, it's limited by
the consensus MAX_STACK_SIZE. This requires tracking the maximum stack
size at all times during script execution, which will be tackled in
its own commit.
In order to avoid any Miniscript that would not be spendable by a
standard transaction because of the size of the witness, we limit the
script size under Tapscript to the maximum standard transaction size
minus the maximum possible witness and Taproot control block sizes. Note
this is a conservative limit but it still allows for scripts more than a
hundred times larger than under P2WSH.
Type ComputeType(Fragment fragment, Type x, Type y, Type z, const std::vector<Type>& sub_types, uint32_t k, size_t data_size, size_t n_subs, size_t n_keys, MiniscriptContext ms_ctx);
253
281
@@ -1277,6 +1305,7 @@ struct Node {
1277
1305
1278
1306
//! Check the ops limit of this script against the consensus limit.
1279
1307
boolCheckOpsLimit() const {
1308
+
if (IsTapscript(m_script_ctx)) returntrue;
1280
1309
if (constauto ops = GetOps()) return *ops <= MAX_OPS_PER_SCRIPT;
1281
1310
returntrue;
1282
1311
}
@@ -1290,6 +1319,8 @@ struct Node {
1290
1319
1291
1320
//! Check the maximum stack size for this script against the policy limit.
1292
1321
boolCheckStackSize() const {
1322
+
// TODO: MAX_STACK_SIZE during script execution under Tapscript.
1323
+
if (IsTapscript(m_script_ctx)) returntrue;
1293
1324
if (constauto ss = GetStackSize()) return *ss <= MAX_STANDARD_P2WSH_STACK_ITEMS;
0 commit comments