Return-Path: Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 354311BB for ; Sun, 1 Oct 2017 19:06:01 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-ua0-f179.google.com (mail-ua0-f179.google.com [209.85.217.179]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 24E951AE for ; Sun, 1 Oct 2017 19:06:00 +0000 (UTC) Received: by mail-ua0-f179.google.com with SMTP id b34so2212260uab.0 for ; Sun, 01 Oct 2017 12:06:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blockstream-io.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=udfWgMikJ3sebgGUNJycpjYlrVxydQTQ38Kfpy9WNeM=; b=1SfxneSdvzPyd9lAS9o+OE3GZjA3ZAzSjU3eQVpaVoqAzP69kgaYfsxOHFdt3LU8Wg 0QGEI6MO5/j5rPvVzmnt8h6CxPG9ST/KXJwnLxuRw3bbx7ujLIC1sM+M+kS834tOQYxd 5H//59gR1HpovyPQMx0UPlo7BU11GWf0JPNf0trWS0Z1VaYuDdam7s65Nb8appaSAt81 jl85nXkUdudtfaZvpACsZWLn9f6t/PZMjLS/jaSvwWq7/SksmFQZPvNv0pHf+9Cw1nw4 vp9va3s84Ao6yDdp27IRKFBpv61UESMclcSZs6HqaVVhpi16hiksAswCx6kuyQDOniSA E7NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=udfWgMikJ3sebgGUNJycpjYlrVxydQTQ38Kfpy9WNeM=; b=d2mtyBe1m62CKVS5yx2hhV+65VzoM64nDptmmxAp1JR5MAjG4z6oVFugaRtQYiwPag 4p/E68WahNYXZDRiyrNJAeBEUo89BezjBR1t/1CH6D5kYrmF5pLlLOQeJjYjpuAxXHS4 2AdNCiZ67xdJnlHpGEfJ3RkxgfhcQTSr4EaojhdYPiWosg1oYBebCLg7IMsZCME22I2e ILiuwqUnbNdTkNlYnushjwvjKgE4odrh+XSDIYLMQ3M4NQA71o0wijIHRQe2KkdeECWt gfPCP/hKZGXsQKQ/iebEeHJvwPviAy1PfRkmmH9p6gfFsliTipT/7NCQS2oiaGKt/nXN PNnQ== X-Gm-Message-State: AHPjjUhswdSd/XSURR1BqSF9azQmeG3Us5egZeEdZjecLhn/6xHHdOdE 6Wc+AMcb+lxAmaBJiFdJSExGkAeDYMU1MW38RlQdlg== X-Google-Smtp-Source: AOwi7QCa5JreJDsVUCbiBIo+KzLBShAL1WsV0nAJOzbtkEDS5tBT/ZyIvxDIcPp+p+INhdcVXIDzIUbPeBj5ePJvtMI= X-Received: by 10.159.37.201 with SMTP id 67mr7742333uaf.59.1506884759128; Sun, 01 Oct 2017 12:05:59 -0700 (PDT) MIME-Version: 1.0 Received: by 10.159.41.161 with HTTP; Sun, 1 Oct 2017 12:05:38 -0700 (PDT) In-Reply-To: References: <201710010113.30518.luke@dashjr.org> <5A220A8D-3A85-49D0-8DB2-6BDEC362EAEB@friedenbach.org> <201710010247.42180.luke@dashjr.org> From: "Russell O'Connor" Date: Sun, 1 Oct 2017 15:05:38 -0400 Message-ID: To: Mark Friedenbach , Bitcoin Protocol Discussion Content-Type: multipart/alternative; boundary="001a113c4f3cc92a39055a80f209" X-Spam-Status: No, score=0.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HTML_MESSAGE,RCVD_IN_DNSWL_NONE autolearn=disabled version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: Re: [bitcoin-dev] Version 1 witness programs (first draft) X-BeenThere: bitcoin-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Bitcoin Protocol Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Oct 2017 19:06:01 -0000 --001a113c4f3cc92a39055a80f209 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Given the proposed fixed signature size, It seems better to me that we create a SIGHASH_WITNESS_WEIGHT flag as opposed to SIGHASH_WITNESS_DEPTH. Mark, you seem to be arguing that in general we still want weight malleability even with witness depth fixed, but I don't understand in what scenario we would want that. It strikes me that is most scenarios all parties signing an input would do so after an execution path through the script has been agreed upon by all parties, in which case the witness weight can be fixed. In rare cases where the smart contract requires that some parties sign in advance of the decision about the execution path (for example, I'm thinking about delegation here, but I want to keep my remarks general), we wouldn't want to fix the witness depth either. A SIGHASH_WITNESS_WEIGHT would prevent all possible malleability that would modify the transaction's fee/weight priority (at least for that one input), and greatly reduce the overall attack surface of witness malleability issues. On Sun, Oct 1, 2017 at 1:04 AM, Mark Friedenbach via bitcoin-dev < bitcoin-dev@lists.linuxfoundation.org> wrote: > Clean stack should be eliminated for other possible future uses, the most > obvious of which is recursive tail-call for general computation capabilit= y. > I=E2=80=99m not arguing for that at this time, just arguing that we shoul= dn=E2=80=99t > prematurely cut off an easy implementation of such should we want to. Cle= an > stack must still exist as policy for future soft-fork safety, but being a > consensus requirement was only to avoid witness malleability, which > committing to the size of the witness also accomplishes. > > Committing to the number of witness elements is fully sufficient, and > using the number of elements avoids problems of not knowing the actual si= ze > in bytes at the time of signing, e.g. because the witness contains a merk= le > proof generated by another party from an unbalanced tree, and unbalanced > trees are expected to be common (so that elements can be placed higher in > the tree in accordance with their higher expected probability of usage). > Other future extensions might also have variable-length proofs. > > > On Sep 30, 2017, at 7:47 PM, Luke Dashjr wrote: > > > > Should it perhaps commit to the length of the serialised witness data > instead > > or additionally? Now that signatures are no longer variable-length, > that'd be > > possible... > > > > As far as tail-call needs are concerned, CLEANSTACK wouldn't have been > checked > > until AFTER the tail-call in the first draft. But I suppose eliminating > it for > > other possible future purposes is still useful. > > > > Luke > > _______________________________________________ > bitcoin-dev mailing list > bitcoin-dev@lists.linuxfoundation.org > https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev > --001a113c4f3cc92a39055a80f209 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Given the proposed fixed signature size, It seems bet= ter to me that we create a SIGHASH_WITNESS_WEIGHT flag as opposed to SIGHAS= H_WITNESS_DEPTH.

Mark, you seem to be arguing = that in general we still want weight malleability even with witness depth f= ixed, but I don't understand in what scenario we would want that.
=

It strikes me that is most scenarios all parties signin= g an input would do so after an execution path through the script has been = agreed upon by all parties, in which case the witness weight can be fixed.<= /div>
In rare cases where the smart contract requires that some parties= sign in advance of the decision about the execution path (for example, I&#= 39;m thinking about delegation here, but I want to keep my remarks general)= , we wouldn't want to fix the witness depth either.

A SIGHASH_WITNESS_WEIGHT would prevent all possible malleability that= would modify the transaction's fee/weight priority (at least for that = one input), and greatly reduce the overall attack surface of witness mallea= bility issues.

On Sun, Oct 1, 2017 at 1:04 AM, Mark Friedenbach via bitco= in-dev <bitcoin-dev@lists.linuxfoundation.org><= /span> wrote:
Clean st= ack should be eliminated for other possible future uses, the most obvious o= f which is recursive tail-call for general computation capability. I=E2=80= =99m not arguing for that at this time, just arguing that we shouldn=E2=80= =99t prematurely cut off an easy implementation of such should we want to. = Clean stack must still exist as policy for future soft-fork safety, but bei= ng a consensus requirement was only to avoid witness malleability, which co= mmitting to the size of the witness also accomplishes.

Committing to the number of witness elements is fully sufficient, and using= the number of elements avoids problems of not knowing the actual size in b= ytes at the time of signing, e.g. because the witness contains a merkle pro= of generated by another party from an unbalanced tree, and unbalanced trees= are expected to be common (so that elements can be placed higher in the tr= ee in accordance with their higher expected probability of usage). Other fu= ture extensions might also have variable-length proofs.

> On Sep 30, 2017, at 7:47 PM, Luke Dashjr <luke@dashjr.org> wrote:
>
> Should it perhaps commit to the length of the serialised witness data = instead
> or additionally? Now that signatures are no longer variable-length, th= at'd be
> possible...
>
> As far as tail-call needs are concerned, CLEANSTACK wouldn't have = been checked
> until AFTER the tail-call in the first draft. But I suppose eliminatin= g it for
> other possible future purposes is still useful.
>
> Luke

________________= _______________________________
bitcoin-dev mailing list
bitcoin-dev@lists.= linuxfoundation.org
https://lists.linuxfoundation.org= /mailman/listinfo/bitcoin-dev

--001a113c4f3cc92a39055a80f209--