Return-Path: Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id CFEE1C0029 for ; Wed, 21 Jun 2023 20:58:02 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id B018D41E69 for ; Wed, 21 Jun 2023 20:58:02 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org B018D41E69 Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=sibjyt1Q X-Virus-Scanned: amavisd-new at osuosl.org X-Spam-Flag: NO X-Spam-Score: -1.848 X-Spam-Level: X-Spam-Status: No, score=-1.848 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MTfbnX800Pvt for ; Wed, 21 Jun 2023 20:58:00 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 9F3A641C62 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by smtp4.osuosl.org (Postfix) with ESMTPS id 9F3A641C62 for ; Wed, 21 Jun 2023 20:57:59 +0000 (UTC) Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-988a5383fd4so712401166b.0 for ; Wed, 21 Jun 2023 13:57:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687381077; x=1689973077; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=9QYkmhNF5lX7EgP4DA0bT3miXayTUb13kIh130VkdVM=; b=sibjyt1QA7k7co6FYm/OHvH3aIv8J+fumKsh1kPiddDC0g401R7JMsOeIyV/KlA/Ku I1V4Z5ai4viB3i3GW+KepzZdov0b14A2XWAEKYfFOpSJOJpFugiP66uNjKBLZ2G07GRe hmmI0sGOXSWNo2dBDJIwSfRvSkwm8CiW+VM+c9hggA4pNhfsfM1h2zTx0AhG4JbmOxNn BLHHTY68vK/4rgNuKnQRKZ9fkoMu3HK5UNnH6BAAhqW7uIxYXWgKDSA9ga5cdj2YhkKu KyZzrKyinew78K/ufXXvuWXqQRulfvSiEYPzOuYC1gwM/Nl0WTGSJrwLyi4SLlsnlPfq nrzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687381077; x=1689973077; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=9QYkmhNF5lX7EgP4DA0bT3miXayTUb13kIh130VkdVM=; b=ef+pMxYt1IuS3YBWr9miQo9SMpxXRhLH4KoxBimS7KNV4FhrCFes6zUlPwQwqy3uZU UJkenHUpioplELPlI2txzVItMFP1Zag8p6cJURzNlNd1n1ehjTMaUGNQQApTivQiPq51 jlnlBHmb/0dOyEDRBegKmDe/vH1iuEKOaunDF7GwBpGN4iL5/QahlrxubDEa8ADhUsSN 6iqoTgehq2sqSFQD8+bmXDK0AsZTbU5U1MaJjZyGlVur3dBVd7eLRGSHJ79uWr2DfnvJ n89s5fEhJKFL1Xzwio+A5Uol67ZVKFvOVBwcYxq4ILQhUM2MqfmDoPyXprssIwXHlnHf T7DQ== X-Gm-Message-State: AC+VfDyJnwb2nLew7USsSlj3SmIkT5NM1I7dH3jv0XDIGIKEPUBfRaN3 2PyQOhG5iNYg2bFm380ZCiEFfzcM5+2Fw1I/TANRuUPA9pldLQ== X-Google-Smtp-Source: ACHHUZ6omP/aFQ7h79oB7EYkKwb6ZP14LibG/GvdVyuFA/bzlBQKYOfcQWYEicFpWHv2edAIRt7kLjAKQMsvw5D0RzE= X-Received: by 2002:a17:907:8a13:b0:982:89c3:c957 with SMTP id sc19-20020a1709078a1300b0098289c3c957mr19035022ejc.0.1687381077006; Wed, 21 Jun 2023 13:57:57 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Greg Sanders Date: Wed, 21 Jun 2023 16:57:45 -0400 Message-ID: To: Gloria Zhao , Bitcoin Protocol Discussion Content-Type: multipart/alternative; boundary="000000000000b21ec705feaa0517" Subject: Re: [bitcoin-dev] New transaction policies (nVersion=3) for contracting protocols X-BeenThere: bitcoin-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Bitcoin Protocol Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Jun 2023 20:58:03 -0000 --000000000000b21ec705feaa0517 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable >> "Can a V2 transaction replace a V3 transaction and vice versa?" > Circling back to my ACP point, this regime still allows pinning anytime you are sharing a transaction with someone else where you don't have control over *all* the inputs. So anytime you are doing a coinjoin-like transaction, someone else's inputs can be self-double-spent, requiring you to satisfy rule#3 when replacing theirs, if they're bip125-signaling. If they're not bip125 signaling, you'll have to somehow detect this and/or double-spend your input back to yourself. Talking with someone offline I realized we can un-pin coinjoins with V3 which I previously thought untenable. You "just" have to stage all utxos that are going to be mixed in separately into a timelocked utxo that is immediately spendable by all joining parties(or the person and the coinjoin coordinator who is trusted to not pin, they're taking fees usually anyways). Then once all utxos for a mix are staged, continue the coinjoin as before with V3. You only need a timelock long enough to stop pinning; not very long. If you do 2-of-2 with a coordinator, you can start the join whenever you think you have enough utxos staged. If using coordinator model, you can then do this in a chained fashion, doing mix after mix, with only one utxo setup step. Seems really obvious in retrospect, with the downside of one additional tx per mixing participant and less composability with other protocols. Just thought it important to point out in public, in lieu of a "real" fix like replace by feerate which hasn't been designed yet. Cheers, Greg On Fri, Sep 23, 2022 at 2:48=E2=80=AFPM Greg Sanders = wrote: > Hello Gloria, > > Great work on synthesizing so much feedback into a proposal like this! > > Death to carve-out rule. > > I'd like to elaborate on some caveats and give a few incomplete thoughts. > > There are basically two types of pinning in my estimation today: > > 1) rule#3 pinning: Make it uneconomical to replace whatever is in mempool > via large in size but low feerate junk that won't get mined anytime soon. > Replacing this with feerate-based policy seems apt, but fraught with DoS > risks. > > 2) package limit pinning: disallowing transaction propagation by package > limits being hit: size, ancestor count, descendant count. Today it is > mitigated by having all outputs be 1 csv timelocked, and having up to 2 > anchor outputs(1 without carve-out rule). > > Would kind of be nice if package RBF would detect a "sibling output spend= " > conflict, and knock it out of the mempool via the other replacement rules= ? > Getting rid of the requirement to 1 block csv lock every output would be > quite nice from a smart contracting composability point of view. > > > "Does this fix Rule 3 Pinning?" > > As you likely know from previous discussions the biggest scenario this > does not fix in my estimation is ANYONECANPAY situations. If the parent > transaction can be "inflated" by tacking on additional inputs, this means > the total weight of the parent tx lowers the effective feerate of the > package. Due to this pinning attack there aren't many(?) deployed schemes > that use the signature type. > > To mitigate this we would likely have to opt into a more complex policy > scheme, committing in the annex to "total mempool package weight", which > would allow mempool package limits to be picked at signing time. > > Maybe ANYONECANPAY isn't a very useful paradigm in general, I cannot spea= k > to that, but it came up in eltoo-related designs using BIP118, which adop= ts > ACP-like signing behavior. This can be mitigated via straight forward > policy updates as well for BIP118 deployment, but off topic so will leave > it there. > > The other scenario it doesn't really fix is where HTLC/commitment-like > transactions are being resolved in a batch, but due to relative time > constraints, you may want to accelerate some and not others. Now you must > pay higher rates to replace all of the transaction bumps. This is a > "self-pin" and "get good at utxos noob" type problem, but it's something > that axing rule#3 in favor of a Replace-by-ancestor-feerate system would > get us. > > > "Can a V2 transaction replace a V3 transaction and vice versa?" > > Circling back to my ACP point, this regime still allows pinning anytime > you are sharing a transaction with someone else where you don't have > control over *all* the inputs. So anytime you are doing a coinjoin-like > transaction, someone else's inputs can be self-double-spent, requiring yo= u > to satisfy rule#3 when replacing theirs, if they're bip125-signaling. If > they're not bip125 signaling, you'll have to somehow detect this and/or > double-spend your input back to yourself. > > > Finally, a couple suggestions I've already made elsewhere: > > 1) I do think that we should seriously consider allowing OP_TRUE to becom= e > a standard script type as part of this policy update. If pinning is solve= d, > then there's no reason to require all those extra bytes for "binding" an > anchor to a specific wallet/user. We can save quite a few bytes by having > the input be empty of witness data. > > 2) If we allow for a single dust-value(0 on up) output which is > immediately spent by the package, anchors become even easier to to design= . > No value has to be "sapped" from contract participants to make an anchor > output. There's more complications for this, such as making sure the pare= nt > transaction is dropped if the child spend is dropped, but maybe it's wort= h > the squeeze. I do think that any L2 uptake of these new rules will take > significant time... maybe we should be a bit more ambitious? > > Cheers, > Greg > > On Fri, Sep 23, 2022 at 11:27 AM Gloria Zhao via bitcoin-dev < > bitcoin-dev@lists.linuxfoundation.org> wrote: > >> Hi everyone, >> >> I'm writing to propose a very simple set of mempool/transaction relay >> policies intended to aid L2/contract protocols. I realized that >> the previously proposed Package Mempool Accept package RBF [1] >> had a few remaining problems after digging into the RBF logic more [2]. >> This additional set of policies solves them without requiring a huge RBF >> overhaul. >> >> I've written an implementation (and docs) for Bitcoin Core: >> https://github.com/bitcoin/bitcoin/pull/25038 >> >> (You may notice that this proposal incorporates feedback on the PR - >> thanks Suhas Daftuar, Gregory Sanders, Bastien Teinturier, Anthony Towns= , >> and others.) >> >> If you are interested in using package RBF/relay to bump presigned >> transactions, I think you may be interested in reviewing this proposal. >> This should solve Rule 3 pinning and perhaps allow us >> to get rid of CPFP carve-out (yay!). I'm keen to hear if people find >> the 1-anchor-output, 1000vB child limit too restrictive. Also, if you >> find a >> pinning attack or something that makes it unusable for you, I would >> really really like to know. >> >> Note that transactions with nVersion=3D3 ("V3 transactions") are >> currently non-standard in Bitcoin Core. That means **anything that was >> standard before this policy change would still be standard >> afterwards.** If you don't want your transactions to be subject to >> these rules, just continue whatever you're doing and don't use >> nVersion=3D3. AFAICT this shouldn't break anything, but let me know if >> this would be disruptive for you? >> >> **New Policies:** >> >> This includes: >> - a set of additional policy rules applying to V3 transactions >> - modifications to package RBF rules >> >> **V3 transactions:** >> >> Existing standardness rules apply to V3 (e.g. min/max tx weight, >> standard output types, cleanstack, etc.). The following additional >> rules apply to V3: >> >> 1. A V3 transaction can be replaced, even if it does not signal BIP125 >> replaceability. (It must also meet the other RBF rules around fees, >> etc. for replacement to happen). >> >> 2. Any descendant of an unconfirmed V3 transaction must also be V3. >> >> *Rationale*: Combined with Rule 1, this gives us the property of >> "inherited" replaceability signaling when descendants of unconfirmed >> transactions are created. Additionally, checking whether a transaction >> signals replaceability this way does not require mempool traversal, >> and does not change based on what transactions are mined. It also >> makes subsequent rules about descendant limits much easier to check. >> >> *Note*: The descendant of a *confirmed* V3 transaction does not need to >> be V3. >> >> 3. An unconfirmed V3 transaction cannot have more than 1 descendant. >> >> *Rationale*: (Upper bound) the larger the descendant limit, the more >> transactions may need to be replaced. This is a problematic pinning >> attack, i.e., a malicious counterparty prevents the transaction from >> being replaced by adding many descendant transactions that aren't >> fee-bumping. >> >> (Lower bound) at least 1 descendant is required to allow CPFP of the >> presigned transaction. The contract protocol can create presigned >> transactions paying 0 fees and 1 output for attaching a CPFP at >> broadcast time ("anchor output"). Without package RBF, multiple anchor >> outputs would be required to allow each counterparty to fee-bump any >> presigned transaction. With package RBF, since the presigned >> transactions can replace each other, 1 anchor output is sufficient. >> >> 4. A V3 transaction that has an unconfirmed V3 ancestor cannot be >> larger than 1000 virtual bytes. >> >> *Rationale*: (Upper bound) the larger the descendant size limit, the >> more vbytes may need to be replaced. With default limits, if the child >> is e.g. 100,000vB, that might be an additional 100,000sats (at >> 1sat/vbyte) or more, depending on the feerate. >> >> (Lower bound) the smaller this limit, the fewer UTXOs a child may use >> to fund this fee-bump. For example, only allowing the V3 child to have >> 2 inputs would require L2 protocols to manage a wallet with high-value >> UTXOs and make batched fee-bumping impossible. However, as the >> fee-bumping child only needs to fund fees (as opposed to payments), >> just a few UTXOs should suffice. >> >> With a limit of 1000 virtual bytes, depending on the output types, the >> child can have 6-15 UTXOs, which should be enough to fund a fee-bump >> without requiring a carefully-managed UTXO pool. With 1000 virtual >> bytes as the descendant limit, the cost to replace a V3 transaction >> has much lower variance. >> >> *Rationale*: This makes the rule very easily "tacked on" to existing >> logic for policy and wallets. A transaction may be up to 100KvB on its >> own (`MAX_STANDARD_TX_WEIGHT`) and 101KvB with descendants >> (`DEFAULT_DESCENDANT_SIZE_LIMIT_KVB`). If an existing V3 transaction >> in the mempool is 100KvB, its descendant can only be 1000vB, even if >> the policy is 10KvB. >> >> **Package RBF modifications:** >> >> 1. The rule around unconfirmed inputs was >> originally "A package may include new unconfirmed inputs, but the >> ancestor feerate of the child must be at least as high as the ancestor >> feerates of every transaction being replaced." >> >> The package may still include new unconfirmed inputs. However, >> the new rule is modified to be "The minimum between package feerate >> and ancestor feerate of the child is not lower than the individual >> feerates of all directly conflicting transactions and the ancestor >> feerates of all original transactions." >> >> *Rationale*: We are attempting to ensure that the replacement >> transactions are not less incentive-compatible to mine. However, a >> package/transaction's ancestor feerate is not perfectly representative >> of its incentive compatibility; it may overestimate (some subset of >> the ancestors could be included by itself if it has other high-feerate >> descendants or are themselves higher feerate than this >> package/transaction). Instead, we use the minimum between the package >> feerate and ancestor feerate of the child as a more conservative value >> than what was proposed originally. >> >> 2. A new rule is added, requiring that all package transactions with >> mempool conflicts to be V3. This also means the "sponsoring" >> child transaction must be V3. >> >> *Note*: Combined with the V3 rules, this means the package must be >> a child-with-parents package. Since package validation is only >> attempted if the transactions do not pay sufficient fees to be >> accepted on their own, this effectively means that only V3 >> transactions can pay to replace their ancestors' conflicts, and only >> V3 transactions' replacements may be paid for by a descendant. >> >> *Rationale*: The fee-related rules are economically rational for >> ancestor packages, but not necessarily other types of packages. >> A child-with-parents package is a type of ancestor package. It >> may be fine to allow any ancestor package, but it's more difficult >> to account for all of the possibilities. For example, it gets much >> harder to see that we're applying the descendant limits correctly if >> the package has a gnarly, many-generation, non-tree shape. I'm also >> not sure if this policy is 100% incentive-compatible if the sponsor >> is not a direct descendant of the sponsee. >> >> Please see doc/policy/version3_transactions.md and >> doc/policy/packages.md in the PR for the full set of rules. >> >> **Intended usage for LN:** >> >> Commitment transactions should be V3 and have 1 anchor output. They >> can be signed with 0 fees (or 1sat/vbyte) once package relay is deployed >> on a significant portion of the network. If the commitment tx must >> be broadcast, determine the desired feerate at broadcast time and >> spend the anchor output in a high feerate transaction. I'm going to >> call the broadcasted commitment tx "the parent" and the attached >> fee-bumping tx "the child." >> >> - This child must be V3. >> - This child must be at most 1000vB. Note this restricts the >> number of inputs you can use to fund the fee bump. Depending >> on the output types, this is around 6-15. >> - One child may fund fees for multiple commitment tx ("batched >> fee-bumping"). >> - To do a second fee-bump to add more fees, replace the >> *child* with a higher-feerate tx. Do not try to attach a grandchild. >> >> Otherwise, never try to spend from an unconfirmed V3 transaction. The >> descendant limits for V3 transactions are very restrictive. >> >> **Expected Questions:** >> >> "Does this fix Rule 3 Pinning?" >> Yes. The V3 descendant limit restricts both you and your counterparty. >> Assuming nodes adopted this policy, you may reasonably assume that you >> only need to replace the commitment transaction + up to 1000vB. >> >> "Only 1 anchor output? What if I need to bump counterparty's commitment >> tx in mempool?" >> You won't need to fee-bump a counterparty's commitment tx using CPFP. >> You would just package RBF it by attaching a high-feerate child to >> your commitment tx. >> >> "Is this a privacy issue, i.e. doesn't it allow fingerprinting LN >> transactions based on nVersion?" >> Indeed it may be unrealistic to assume V3 transactions will be in >> widespread use outside of L2. IIUC, unilateral closes are already >> obvious LN transactions because of the HTLC inputs. For e.g. >> cooperative closes and opens, I think it makes sense to continue using >> V2. So, unless I'm missing something, this shouldn't make it worse. >> >> "So a V3 transaction that doesn't signal BIP125 replaceability is >> replaceable? Is that a backward compatibility issue?" >> Yes it's replaceable. It's not an issue AFAICT because, >> under previous policy, the V3 transaction wouldn't have been >> in the mempool in the first place. >> >> "Can a V2 transaction replace a V3 transaction and vice versa?" >> Yes, otherwise someone can use V3 transactions to censor V2 >> transactions spending shared inputs. Note if the >> original V3 transaction has an unconfirmed V3 parent, this would >> violate the "inherited V3" rule and would be rejected. >> >> Thanks for reading! Feedback and review would be much appreciated. >> >> [1]: >> https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-September/0= 19464.html >> [2]: >> https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2022-January/019= 817.html >> >> Best, >> Gloria >> _______________________________________________ >> bitcoin-dev mailing list >> bitcoin-dev@lists.linuxfoundation.org >> https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev >> > --000000000000b21ec705feaa0517 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
>> "Can a= V2 transaction replace a V3 transaction and vice versa?"

> Circling b= ack to my ACP point, this regime still allows pinning anytime you are shari= ng a transaction with someone else where yo= u don't have control over *all* the inputs. So anytime you are doing a = coinjoin-like transaction, someone else'= ;s inputs can be self-double-spent, requiring you to satisfy rule#3 when replacing theirs, if they're bip125-signa= ling. If they're not bip125 signaling, you'll have to somehow detec= t this and/or double-spend your input back to yourself.

Talking with someone offline I = realized we can=C2=A0un-pin coinjoins with V3 which I previously thought un= tenable. You "just" have to stage all utxos that are going to be = mixed in separately into a timelocked utxo that is immediately spendable by= all joining parties(or the person and the coinjoin coordinator who is trus= ted to not pin, they're taking fees usually anyways). Then once all utx= os for a mix are staged, continue the coinjoin as before with V3. You only = need a timelock long enough to stop pinning; not very long. If you do 2-of-= 2 with a coordinator, you can start the join whenever you think you have en= ough utxos staged. If using coordinator model, you can then do this in a ch= ained fashion, doing mix after mix, with only one utxo setup step.

S= eems really obvious in retrospect, with the downside of one additional tx p= er mixing participant and less composability with other protocols.

Just thought it important to point out in public, in l= ieu of a "real" fix like replace by feerate which hasn't been= designed yet.

Cheers,
Greg
<= br>
On Fri,= Sep 23, 2022 at 2:48=E2=80=AFPM Greg Sanders <gsanders87@gmail.com> wrote:
Hello Gloria,

<= /div>
Great work on synthesizing so much feedback into a proposal like = this!

Death to carve-out=C2=A0rule.

=
I'd like to elaborate on some caveats and give a few incompl= ete thoughts.

There are basically two types of pin= ning in my estimation today:

1) rule#3 pinning: Ma= ke it uneconomical to replace whatever is in mempool via large in size but = low feerate junk that won't get mined anytime soon. Replacing this with= feerate-based policy seems apt, but fraught with DoS risks.

=
2) package limit pinning: disallowing transaction propagation by= package limits being hit: size, ancestor count, descendant count. Today it= is mitigated by having all outputs be 1 csv timelocked, and having up to 2= anchor outputs(1 without carve-out rule).

Would k= ind of be nice if package RBF would detect a "sibling output spend&quo= t; conflict, and knock it out of the mempool via the other replacement rule= s? Getting rid of the requirement to 1 block csv lock every output would be= quite nice from a smart contracting composability point of view.

>=C2=A0"Does this fix Rule 3 Pinning?"

As you likely know from = previous discussions the biggest scenario this does not fix in my estimatio= n is ANYONECANPAY situations. If the parent transaction can be "inflat= ed" by tacking on additional inputs, this means the total weight of th= e parent tx lowers the effective feerate of the package. Due to this pinnin= g attack there aren't many(?) deployed schemes that use the signature t= ype.

To mitigate this we would likely have to opt = into a more complex policy scheme, committing in the annex to "total = mempool package weight", which would allow mempool package limits to b= e picked at signing time.
<= span style=3D"white-space:pre-wrap">
Maybe ANYONECANPAY isn&#= 39;t a very useful paradigm in general, I cannot speak to that, but it came= up in eltoo-related designs using BIP118, which adopts ACP-like signing be= havior. This can be mitigated via straight forward policy updates as well f= or BIP118 deployment, but off topic so will leave it there.

<= /span>
The other scenario it doesn't really fix is where HTLC/commit= ment-like transactions are being resolved in a batch, but due to relative t= ime constraints, you may want to accelerate some and not others. Now you mu= st pay higher rates to replace all of the transaction bumps. This is a &quo= t;self-pin" and "get good at utxos noob" type problem, but i= t's something that axing rule#3 in favor of a Replace-by-ancestor-feera= te system would get us.

> "Can a V2 transaction = replace a V3 transaction and vice versa?"

Circling back to my ACP point, = this regime still allows pinning anytime you are sharing a transaction with= someone else where you don't have control over *all* the inputs. So an= ytime you are doing a coinjoin-like transaction, someone else's inputs = can be self-double-spent, requiring you to satisfy rule#3 when replacing th= eirs, if they're bip125-signaling. If they're not bip125 signaling,= you'll have to somehow detect this and/or double-spend your input back= to yourself.


Finally, a couple suggestions I've already made else= where:

1) I do think that we should seriously cons= ider allowing OP_TRUE to become a standard script type as part of this poli= cy update. If pinning is solved, then there's no reason to require all = those extra bytes for "binding" an anchor to a specific wallet/us= er. We can save quite a few bytes by having the input be empty of witness d= ata.

2) If we allow for a single dus= t-value(0 on up) output which is immediately spent by the package, anchors = become even easier to to design. No value has to be "sapped" from= contract participants to make an anchor output. There's more complicat= ions for this, such as making sure the parent transaction is dropped if the= child spend is dropped, but maybe it's worth the squeeze. I do think t= hat any L2 uptake of these new rules will take significant time... maybe we= should be a bit more ambitious?

Cheers,
Greg
<= /div>
O= n Fri, Sep 23, 2022 at 11:27 AM Gloria Zhao via bitcoin-dev <bitcoin-dev= @lists.linuxfoundation.org> wrote:
Hi everyone,

I'm writ= ing to propose a very simple set of mempool/transaction relay
policies i= ntended to aid L2/contract protocols. I realized that
the previously pro= posed Package Mempool Accept package RBF [1]
had a few remaining pr= oblems after digging into the RBF logic more [2].
This additional= set of policies solves them without requiring a huge RBF overhaul.

I've written an implementation (and docs) for Bitcoin Core:
h= ttps://github.com/bitcoin/bitcoin/pull/25038

(You may notice tha= t this proposal incorporates feedback on the PR - thanks Suhas Daftuar, Gre= gory Sanders, Bastien Teinturier, Anthony Towns, and others.)

If you= are interested in using package RBF/relay to bump presigned
transaction= s, I think you may be interested in reviewing this proposal.
This should= solve Rule 3 pinning and perhaps allow us
to get rid of CPFP carve-out = (yay!). I'm keen to hear if people find
the 1-anchor-output, 1000vB = child limit too restrictive. Also, if you find a
pinning attack or somet= hing that makes it unusable for you, I would
really really like to know.=

Note that transactions with nVersion=3D3 ("V3 transactions&quo= t;) are
currently non-standard in Bitcoin Core. That means **anything th= at was
standard before this policy change would still be standard
aft= erwards.** If you don't want your transactions to be subject to
thes= e rules, just continue whatever you're doing and don't use
nVers= ion=3D3. AFAICT this shouldn't break anything, but let me know if
th= is would be disruptive for you?

**New Policies:**

This includ= es:
- a set of additional policy rules applying to V3 transactions
- = modifications to package RBF rules

**V3 transactions:**

Exist= ing standardness rules apply to V3 (e.g. min/max tx weight,
standard out= put types, cleanstack, etc.). The following additional
rules apply to V3= :

1. A V3 transaction can be replaced, even if it does not signal BI= P125
=C2=A0 =C2=A0replaceability. (It must also meet the other RBF rules= around fees,
etc. for replacement to happen).

2. Any descendant = of an unconfirmed V3 transaction must also be V3.

*Rationale*: Combi= ned with Rule 1, this gives us the property of
"inherited" rep= laceability signaling when descendants of unconfirmed
transactions are c= reated. Additionally, checking whether a transaction
signals replaceabil= ity this way does not require mempool traversal,
and does not change bas= ed on what transactions are mined. It also
makes subsequent rules about = descendant limits much easier to check.

*Note*: The descendant of a = *confirmed* V3 transaction does not need to be V3.

3. An unconfirmed= V3 transaction cannot have more than 1 descendant.

*Rationale*: (Up= per bound) the larger the descendant limit, the more
transactions may ne= ed to be replaced. This is a problematic pinning
attack, i.e., a malicio= us counterparty prevents the transaction from
being replaced by adding m= any descendant transactions that aren't
fee-bumping.

(Lower b= ound) at least 1 descendant is required to allow CPFP of the
presigned t= ransaction. The contract protocol can create presigned
transactions payi= ng 0 fees and 1 output for attaching a CPFP at
broadcast time ("anc= hor output"). Without package RBF, multiple anchor
outputs would be= required to allow each counterparty to fee-bump any
presigned transacti= on. With package RBF, since the presigned
transactions can replace each = other, 1 anchor output is sufficient.

4. A V3 transaction that has a= n unconfirmed V3 ancestor cannot be
=C2=A0 =C2=A0larger than 1000 virtua= l bytes.

*Rationale*: (Upper bound) the larger the descendant size l= imit, the
more vbytes may need to be replaced. With default limits, if t= he child
is e.g. 100,000vB, that might be an additional 100,000sats (at<= br>1sat/vbyte) or more, depending on the feerate.

(Lower bound) the = smaller this limit, the fewer UTXOs a child may use
to fund this fee-bum= p. For example, only allowing the V3 child to have
2 inputs would requir= e L2 protocols to manage a wallet with high-value
UTXOs and make batched= fee-bumping impossible. However, as the
fee-bumping child only needs to= fund fees (as opposed to payments),
just a few UTXOs should suffice.
With a limit of 1000 virtual bytes, depending on the output types, the=
child can have 6-15 UTXOs, which should be enough to fund a fee-bumpwithout requiring a carefully-managed UTXO pool. With 1000 virtual
byte= s as the descendant limit, the cost to replace a V3 transaction
has much= lower variance.

*Rationale*: This makes the rule very easily "= tacked on" to existing
logic for policy and wallets. A transaction = may be up to 100KvB on its
own (`MAX_STANDARD_TX_WEIGHT`) and 101KvB wit= h descendants
(`DEFAULT_DESCENDANT_SIZE_LIMIT_KVB`). If an existing V3 t= ransaction
in the mempool is 100KvB, its descendant can only be 1000vB, = even if
the policy is 10KvB.

**Package RBF modifications:**
1. The rule around unconfirmed inputs was
originally "A package m= ay include new unconfirmed inputs, but the
ancestor feerate of the child= must be at least as high as the ancestor
feerates of every transaction = being replaced."

The package may still include new unconfirmed = inputs. However,
the new rule is modified to be "The minimum betwee= n package feerate
and ancestor feerate of the child is not lower than th= e individual
feerates of all directly conflicting transactions and the a= ncestor
feerates of all original transactions."

*Rationale*:= We are attempting to ensure that the replacement
transactions are not l= ess incentive-compatible to mine. However, a
package/transaction's a= ncestor feerate is not perfectly representative
of its incentive compati= bility; it may overestimate (some subset of
the ancestors could be inclu= ded by itself if it has other high-feerate
descendants or are themselves= higher feerate than this
package/transaction). Instead, we use the mini= mum between the package
feerate and ancestor feerate of the child as a m= ore conservative value
than what was proposed originally.

2. A ne= w rule is added, requiring that all package transactions with
mempool co= nflicts to be V3. This also means the "sponsoring"
child trans= action must be V3.

*Note*: Combined with the V3 rules, this means th= e package must be
a child-with-parents package. Since package validation= is only
attempted if the transactions do not pay sufficient fees to be<= br>accepted on their own, this effectively means that only V3
transactio= ns can pay to replace their ancestors' conflicts, and only
V3 transa= ctions' replacements may be paid for by a descendant.

*Rationale= *: The fee-related rules are economically rational for
ancestor packages= , but not necessarily other types of packages.
A child-with-parents pack= age is a type of ancestor package. It
may be fine to allow any ancestor = package, but it's more difficult
to account for all of the possibili= ties. For example, it gets much
harder to see that we're applying th= e descendant limits correctly if
the package has a gnarly, many-generati= on, non-tree shape. I'm also
not sure if this policy is 100% incenti= ve-compatible if the sponsor
is not a direct descendant of the sponsee.<= br>
Please see doc/policy/version3_transactions.md and
doc/policy/pac= kages.md in the PR for the full set of rules.

**Intended usage for L= N:**

Commitment transactions should be V3 and have 1 anchor output. = They
can be signed with 0 fees (or 1sat/vbyte) once package relay is dep= loyed
on a significant portion of the network. If the commitment tx must=
be broadcast, determine the desired feerate at broadcast time and
sp= end the anchor output in a high feerate transaction. I'm going to
ca= ll the broadcasted commitment tx "the parent" and the attachedfee-bumping tx "the child."

- This child must be V3.
-= This child must be at most 1000vB. Note this restricts the
=C2=A0 numbe= r of inputs you can use to fund the fee bump. Depending
on the output ty= pes, this is around 6-15.
- One child may fund fees for multiple commitm= ent tx ("batched
=C2=A0 fee-bumping").
- To do a second fee= -bump to add more fees, replace the
=C2=A0 *child* with a higher-feerate= tx. Do not try to attach a grandchild.

Otherwise, never try to spen= d from an unconfirmed V3 transaction. The
descendant limits for V3 trans= actions are very restrictive.

**Expected Questions:**

"D= oes this fix Rule 3 Pinning?"
Yes. The V3 descendant limit restrict= s both you and your counterparty.
Assuming nodes adopted this policy, yo= u may reasonably assume that you
only need to replace the commitment tra= nsaction + up to 1000vB.

"Only 1 anchor output? What if I need = to bump counterparty's commitment tx in mempool?"
You won&= #39;t need to fee-bump a counterparty's commitment tx using CPFP.
=
You would just package RBF it by attaching a high-feerate child toyour commitment tx.

"Is this a privacy issue, i.e. doesn'= t it allow fingerprinting LN
transactions based on nVersion?"
In= deed it may be unrealistic to assume V3 transactions will be in
widespre= ad use outside of L2. IIUC, unilateral closes are already
obvious LN tra= nsactions because of the HTLC inputs. For e.g.
cooperative closes and op= ens, I think it makes sense to continue using
V2. So, unless I'm mis= sing something, this shouldn't make it worse.

"So a V3 tran= saction that doesn't signal BIP125 replaceability is
replaceable? Is= that a backward compatibility issue?"
Yes it's replaceable. It= 's not an issue AFAICT because,
under previous policy, the V3 transa= ction wouldn't have been
in the mempool in the first place.

&= quot;Can a V2 transaction replace a V3 transaction and vice versa?"Yes, otherwise someone can use V3 transactions to censor V2
transaction= s spending shared inputs. Note if the
original V3 transaction has an unc= onfirmed V3 parent, this would
violate the "inherited V3" rule= and would be rejected.

Thanks for reading! Feedback and review woul= d be much appreciated.

[1]: ht= tps://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-September/019464= .html
<= div>
Best,
Gloria
_______________________________________________
bitcoin-dev mailing list
= bitcoin-dev@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mail= man/listinfo/bitcoin-dev
--000000000000b21ec705feaa0517--