Yup, we can leave this debt repayment to some future transaction format upgrade, which P2SH32 using the familiar template will not preclude.
Other than cryptographic security hardening (20 to 32, bringing all our cryptographic primitives to the same level of security), we have here identified 3 buckets of technical debt that we have a chance of repaying:
- Unnecessary overheads in P2SH transaction encoding;
- Tangling a “hypervisor” (consensus) instruction with Script VM bytecode. (stack item size limit)
- The
OP_IF
andOP_NOTIF
malleability vector. This one is not really inherited from P2SH feature but from transaction format, i.e. absence of a consensus version field, whichCHIP 2021-01 Restrict Transaction Version
aims to solve.
We can easily repay 2. and partially 3., and note that we can repay 3. as a side-effect of the hard-forking P2SH32 upgrade because it will be a pattern distinct from the legacy 20-byte one so we can use it to modulate opcode behavior for the upgraded feature without breaking the old feature. Kind of similar to how we can modulate how locktime is interpreted (BIP-0068).
The CHIP should also be informative, in hope that non-node software developers will learn of possibility of upgrading the format later, and not assume a particular wrapping of the constraint hash.