<oembed><type>rich</type><version>1.0</version><author_name>npub1tfk373zg9dnmtvxnpnq7s2dkdgj37rwfj3yrwld7830qltmv8qps8rfq0n</author_name><author_url>https://nostr.ae/npub1tfk373zg9dnmtvxnpnq7s2dkdgj37rwfj3yrwld7830qltmv8qps8rfq0n</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2017-09-30&#xA;📝 Original message:Should it perhaps commit to the length of the serialised witness data instead &#xA;or additionally? Now that signatures are no longer variable-length, that&#39;d be &#xA;possible...&#xA;&#xA;As far as tail-call needs are concerned, CLEANSTACK wouldn&#39;t have been checked &#xA;until AFTER the tail-call in the first draft. But I suppose eliminating it for &#xA;other possible future purposes is still useful.&#xA;&#xA;Luke&#xA;&#xA;&#xA;On Sunday 01 October 2017 2:23:47 AM Mark Friedenbach wrote:&#xA;&gt; The CLEANSTACK rule should be eliminated, and instead the number of items&#xA;&gt; on the stack should be incorporated into the signature hash. That way any&#xA;&gt; script with a CHECKSIG is protected from witness extension malleability,&#xA;&gt; and those rare ones that do not use signature operations can have a “DEPTH&#xA;&gt; 1 EQUALVERIFY” at the end. This allows for much simpler tail-call&#xA;&gt; evaluation as you don’t need to pass arguments on the alt-stack.&#xA;&gt; &#xA;&gt; &gt; On Sep 30, 2017, at 6:13 PM, Luke Dashjr via bitcoin-dev&#xA;&gt; &gt; &lt;bitcoin-dev at lists.linuxfoundation.org&gt; wrote:&#xA;&gt; &gt; &#xA;&gt; &gt; I&#39;ve put together a first draft for what I hope to be a good next step&#xA;&gt; &gt; for&#xA;&gt; &gt; &#xA;&gt; &gt; Segwit and Bitcoin scripting:&#xA;&gt; &gt;    https://github.com/luke-jr/bips/blob/witnessv1/bip-witnessv1.mediawiki&#xA;&gt; &gt; &#xA;&gt; &gt; This introduces 5 key changes:&#xA;&gt; &gt; &#xA;&gt; &gt; 1. Minor versions for witnesses, inside the witness itself. Essentially&#xA;&gt; &gt; the witness [major] version 1 simply indicates the witness commitment is&#xA;&gt; &gt; SHA256d, and nothing more.&#xA;&gt; &gt; &#xA;&gt; &gt; The remaining two are witness version 1.0 (major 1, minor 0):&#xA;&gt; &gt; &#xA;&gt; &gt; 2. As previously discussed, undefined opcodes immediately cause the&#xA;&gt; &gt; script to exit with success, making future opcode softforks a lot more&#xA;&gt; &gt; flexible.&#xA;&gt; &gt; &#xA;&gt; &gt; 3. If the final stack element is not exactly true or false, it is&#xA;&gt; &gt; interpreted as a tail-call Script and executed. (Credit to Mark&#xA;&gt; &gt; Friedenbach)&#xA;&gt; &gt; &#xA;&gt; &gt; 4. A new shorter fixed-length signature format, eliminating the need to&#xA;&gt; &gt; guess the signature size in advance. All signatures are 65 bytes, unless&#xA;&gt; &gt; a condition script is included (see #5).&#xA;&gt; &gt; &#xA;&gt; &gt; 5. The ability for signatures to commit to additional conditions,&#xA;&gt; &gt; expressed in the form of a serialized Script in the signature itself.&#xA;&gt; &gt; This would be useful in combination with OP_CHECKBLOCKATHEIGHT (BIP&#xA;&gt; &gt; 115), hopefully ending the whole replay protection argument by&#xA;&gt; &gt; introducing it early to Bitcoin before any further splits.&#xA;&gt; &gt; &#xA;&gt; &gt; This last part is a big ugly right now: the signature must commit to the&#xA;&gt; &gt; script interpreter flags and internal &#34;sigversion&#34;, which basically serve&#xA;&gt; &gt; the same purpose. The reason for this, is that otherwise someone could&#xA;&gt; &gt; move the signature to a different context in an attempt to exploit&#xA;&gt; &gt; differences in the various Script interpretation modes. I don&#39;t consider&#xA;&gt; &gt; the BIP deployable without this getting resolved, but I&#39;m not sure what&#xA;&gt; &gt; the best approach would be. Maybe it should be replaced with a witness&#xA;&gt; &gt; [major] version and witness stack?&#xA;&gt; &gt; &#xA;&gt; &gt; There is also draft code implementing [the consensus side of] this:&#xA;&gt; &gt;    https://github.com/bitcoin/bitcoin/compare/master...luke-jr:witnessv1&#xA;&gt; &gt; &#xA;&gt; &gt; Thoughts? Anything I&#39;ve overlooked / left missing that would be&#xA;&gt; &gt; uncontroversial and desirable? (Is any of this unexpectedly controversial&#xA;&gt; &gt; for some reason?)&#xA;&gt; &gt; &#xA;&gt; &gt; Luke&#xA;&gt; &gt; _______________________________________________&#xA;&gt; &gt; bitcoin-dev mailing list&#xA;&gt; &gt; bitcoin-dev at lists.linuxfoundation.org&#xA;&gt; &gt; https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev</html></oembed>