<oembed><type>rich</type><version>1.0</version><author_name>npub1jdl3plz00rvxwc6g2ckemzrgg0amx5wen4kfvs3laxtssxvk9cvsf3gh0m</author_name><author_url>https://nostr.ae/npub1jdl3plz00rvxwc6g2ckemzrgg0amx5wen4kfvs3laxtssxvk9cvsf3gh0m</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2022-09-23&#xA;📝 Original message:Hello Gloria,&#xA;&#xA;Great work on synthesizing so much feedback into a proposal like this!&#xA;&#xA;Death to carve-out rule.&#xA;&#xA;I&#39;d like to elaborate on some caveats and give a few incomplete thoughts.&#xA;&#xA;There are basically two types of pinning in my estimation today:&#xA;&#xA;1) rule#3 pinning: Make it uneconomical to replace whatever is in mempool&#xA;via large in size but low feerate junk that won&#39;t get mined anytime soon.&#xA;Replacing this with feerate-based policy seems apt, but fraught with DoS&#xA;risks.&#xA;&#xA;2) package limit pinning: disallowing transaction propagation by package&#xA;limits being hit: size, ancestor count, descendant count. Today it is&#xA;mitigated by having all outputs be 1 csv timelocked, and having up to 2&#xA;anchor outputs(1 without carve-out rule).&#xA;&#xA;Would kind of be nice if package RBF would detect a &#34;sibling output spend&#34;&#xA;conflict, and knock it out of the mempool via the other replacement rules?&#xA;Getting rid of the requirement to 1 block csv lock every output would be&#xA;quite nice from a smart contracting composability point of view.&#xA;&#xA;&gt; &#34;Does this fix Rule 3 Pinning?&#34;&#xA;&#xA;As you likely know from previous discussions the biggest scenario this does&#xA;not fix in my estimation is ANYONECANPAY situations. If the parent&#xA;transaction can be &#34;inflated&#34; by tacking on additional inputs, this means&#xA;the total weight of the parent tx lowers the effective feerate of the&#xA;package. Due to this pinning attack there aren&#39;t many(?) deployed schemes&#xA;that use the signature type.&#xA;&#xA;To mitigate this we would likely have to opt into a more complex policy&#xA;scheme, committing in the annex to &#34;total mempool package weight&#34;, which&#xA;would allow mempool package limits to be picked at signing time.&#xA;&#xA;Maybe ANYONECANPAY isn&#39;t a very useful paradigm in general, I cannot speak&#xA;to that, but it came up in eltoo-related designs using BIP118, which adopts&#xA;ACP-like signing behavior. This can be mitigated via straight forward&#xA;policy updates as well for BIP118 deployment, but off topic so will leave&#xA;it there.&#xA;&#xA;The other scenario it doesn&#39;t really fix is where HTLC/commitment-like&#xA;transactions are being resolved in a batch, but due to relative time&#xA;constraints, you may want to accelerate some and not others. Now you must&#xA;pay higher rates to replace all of the transaction bumps. This is a&#xA;&#34;self-pin&#34; and &#34;get good at utxos noob&#34; type problem, but it&#39;s something&#xA;that axing rule#3 in favor of a Replace-by-ancestor-feerate system would&#xA;get us.&#xA;&#xA;&gt; &#34;Can a V2 transaction replace a V3 transaction and vice versa?&#34;&#xA;&#xA;Circling back to my ACP point, this regime still allows pinning anytime you&#xA;are sharing a transaction with someone else where you don&#39;t have control&#xA;over *all* the inputs. So anytime you are doing a coinjoin-like&#xA;transaction, someone else&#39;s inputs can be self-double-spent, requiring you&#xA;to satisfy rule#3 when replacing theirs, if they&#39;re bip125-signaling. If&#xA;they&#39;re not bip125 signaling, you&#39;ll have to somehow detect this and/or&#xA;double-spend your input back to yourself.&#xA;&#xA;&#xA;Finally, a couple suggestions I&#39;ve already made elsewhere:&#xA;&#xA;1) I do think that we should seriously consider allowing OP_TRUE to become&#xA;a standard script type as part of this policy update. If pinning is solved,&#xA;then there&#39;s no reason to require all those extra bytes for &#34;binding&#34; an&#xA;anchor to a specific wallet/user. We can save quite a few bytes by having&#xA;the input be empty of witness data.&#xA;&#xA;2) If we allow for a single dust-value(0 on up) output which is immediately&#xA;spent by the package, anchors become even easier to to design. No value has&#xA;to be &#34;sapped&#34; from contract participants to make an anchor output. There&#39;s&#xA;more complications for this, such as making sure the parent transaction is&#xA;dropped if the child spend is dropped, but maybe it&#39;s worth the squeeze. I&#xA;do think that any L2 uptake of these new rules will take significant&#xA;time... maybe we should be a bit more ambitious?&#xA;&#xA;Cheers,&#xA;Greg&#xA;&#xA;On Fri, Sep 23, 2022 at 11:27 AM Gloria Zhao via bitcoin-dev &lt;&#xA;bitcoin-dev at lists.linuxfoundation.org&gt; wrote:&#xA;&#xA;&gt; Hi everyone,&#xA;&gt;&#xA;&gt; I&#39;m writing to propose a very simple set of mempool/transaction relay&#xA;&gt; policies intended to aid L2/contract protocols. I realized that&#xA;&gt; the previously proposed Package Mempool Accept package RBF [1]&#xA;&gt; had a few remaining problems after digging into the RBF logic more [2].&#xA;&gt; This additional set of policies solves them without requiring a huge RBF&#xA;&gt; overhaul.&#xA;&gt;&#xA;&gt; I&#39;ve written an implementation (and docs) for Bitcoin Core:&#xA;&gt; https://github.com/bitcoin/bitcoin/pull/25038&#xA;&gt;&#xA;&gt; (You may notice that this proposal incorporates feedback on the PR -&#xA;&gt; thanks Suhas Daftuar, Gregory Sanders, Bastien Teinturier, Anthony Towns,&#xA;&gt; and others.)&#xA;&gt;&#xA;&gt; If you are interested in using package RBF/relay to bump presigned&#xA;&gt; transactions, I think you may be interested in reviewing this proposal.&#xA;&gt; This should solve Rule 3 pinning and perhaps allow us&#xA;&gt; to get rid of CPFP carve-out (yay!). I&#39;m keen to hear if people find&#xA;&gt; the 1-anchor-output, 1000vB child limit too restrictive. Also, if you find&#xA;&gt; a&#xA;&gt; pinning attack or something that makes it unusable for you, I would&#xA;&gt; really really like to know.&#xA;&gt;&#xA;&gt; Note that transactions with nVersion=3 (&#34;V3 transactions&#34;) are&#xA;&gt; currently non-standard in Bitcoin Core. That means **anything that was&#xA;&gt; standard before this policy change would still be standard&#xA;&gt; afterwards.** If you don&#39;t want your transactions to be subject to&#xA;&gt; these rules, just continue whatever you&#39;re doing and don&#39;t use&#xA;&gt; nVersion=3. AFAICT this shouldn&#39;t break anything, but let me know if&#xA;&gt; this would be disruptive for you?&#xA;&gt;&#xA;&gt; **New Policies:**&#xA;&gt;&#xA;&gt; This includes:&#xA;&gt; - a set of additional policy rules applying to V3 transactions&#xA;&gt; - modifications to package RBF rules&#xA;&gt;&#xA;&gt; **V3 transactions:**&#xA;&gt;&#xA;&gt; Existing standardness rules apply to V3 (e.g. min/max tx weight,&#xA;&gt; standard output types, cleanstack, etc.). The following additional&#xA;&gt; rules apply to V3:&#xA;&gt;&#xA;&gt; 1. A V3 transaction can be replaced, even if it does not signal BIP125&#xA;&gt;    replaceability. (It must also meet the other RBF rules around fees,&#xA;&gt; etc. for replacement to happen).&#xA;&gt;&#xA;&gt; 2. Any descendant of an unconfirmed V3 transaction must also be V3.&#xA;&gt;&#xA;&gt; *Rationale*: Combined with Rule 1, this gives us the property of&#xA;&gt; &#34;inherited&#34; replaceability signaling when descendants of unconfirmed&#xA;&gt; transactions are created. Additionally, checking whether a transaction&#xA;&gt; signals replaceability this way does not require mempool traversal,&#xA;&gt; and does not change based on what transactions are mined. It also&#xA;&gt; makes subsequent rules about descendant limits much easier to check.&#xA;&gt;&#xA;&gt; *Note*: The descendant of a *confirmed* V3 transaction does not need to be&#xA;&gt; V3.&#xA;&gt;&#xA;&gt; 3. An unconfirmed V3 transaction cannot have more than 1 descendant.&#xA;&gt;&#xA;&gt; *Rationale*: (Upper bound) the larger the descendant limit, the more&#xA;&gt; transactions may need to be replaced. This is a problematic pinning&#xA;&gt; attack, i.e., a malicious counterparty prevents the transaction from&#xA;&gt; being replaced by adding many descendant transactions that aren&#39;t&#xA;&gt; fee-bumping.&#xA;&gt;&#xA;&gt; (Lower bound) at least 1 descendant is required to allow CPFP of the&#xA;&gt; presigned transaction. The contract protocol can create presigned&#xA;&gt; transactions paying 0 fees and 1 output for attaching a CPFP at&#xA;&gt; broadcast time (&#34;anchor output&#34;). Without package RBF, multiple anchor&#xA;&gt; outputs would be required to allow each counterparty to fee-bump any&#xA;&gt; presigned transaction. With package RBF, since the presigned&#xA;&gt; transactions can replace each other, 1 anchor output is sufficient.&#xA;&gt;&#xA;&gt; 4. A V3 transaction that has an unconfirmed V3 ancestor cannot be&#xA;&gt;    larger than 1000 virtual bytes.&#xA;&gt;&#xA;&gt; *Rationale*: (Upper bound) the larger the descendant size limit, the&#xA;&gt; more vbytes may need to be replaced. With default limits, if the child&#xA;&gt; is e.g. 100,000vB, that might be an additional 100,000sats (at&#xA;&gt; 1sat/vbyte) or more, depending on the feerate.&#xA;&gt;&#xA;&gt; (Lower bound) the smaller this limit, the fewer UTXOs a child may use&#xA;&gt; to fund this fee-bump. For example, only allowing the V3 child to have&#xA;&gt; 2 inputs would require L2 protocols to manage a wallet with high-value&#xA;&gt; UTXOs and make batched fee-bumping impossible. However, as the&#xA;&gt; fee-bumping child only needs to fund fees (as opposed to payments),&#xA;&gt; just a few UTXOs should suffice.&#xA;&gt;&#xA;&gt; With a limit of 1000 virtual bytes, depending on the output types, the&#xA;&gt; child can have 6-15 UTXOs, which should be enough to fund a fee-bump&#xA;&gt; without requiring a carefully-managed UTXO pool. With 1000 virtual&#xA;&gt; bytes as the descendant limit, the cost to replace a V3 transaction&#xA;&gt; has much lower variance.&#xA;&gt;&#xA;&gt; *Rationale*: This makes the rule very easily &#34;tacked on&#34; to existing&#xA;&gt; logic for policy and wallets. A transaction may be up to 100KvB on its&#xA;&gt; own (`MAX_STANDARD_TX_WEIGHT`) and 101KvB with descendants&#xA;&gt; (`DEFAULT_DESCENDANT_SIZE_LIMIT_KVB`). If an existing V3 transaction&#xA;&gt; in the mempool is 100KvB, its descendant can only be 1000vB, even if&#xA;&gt; the policy is 10KvB.&#xA;&gt;&#xA;&gt; **Package RBF modifications:**&#xA;&gt;&#xA;&gt; 1. The rule around unconfirmed inputs was&#xA;&gt; originally &#34;A package may include new unconfirmed inputs, but the&#xA;&gt; ancestor feerate of the child must be at least as high as the ancestor&#xA;&gt; feerates of every transaction being replaced.&#34;&#xA;&gt;&#xA;&gt; The package may still include new unconfirmed inputs. However,&#xA;&gt; the new rule is modified to be &#34;The minimum between package feerate&#xA;&gt; and ancestor feerate of the child is not lower than the individual&#xA;&gt; feerates of all directly conflicting transactions and the ancestor&#xA;&gt; feerates of all original transactions.&#34;&#xA;&gt;&#xA;&gt; *Rationale*: We are attempting to ensure that the replacement&#xA;&gt; transactions are not less incentive-compatible to mine. However, a&#xA;&gt; package/transaction&#39;s ancestor feerate is not perfectly representative&#xA;&gt; of its incentive compatibility; it may overestimate (some subset of&#xA;&gt; the ancestors could be included by itself if it has other high-feerate&#xA;&gt; descendants or are themselves higher feerate than this&#xA;&gt; package/transaction). Instead, we use the minimum between the package&#xA;&gt; feerate and ancestor feerate of the child as a more conservative value&#xA;&gt; than what was proposed originally.&#xA;&gt;&#xA;&gt; 2. A new rule is added, requiring that all package transactions with&#xA;&gt; mempool conflicts to be V3. This also means the &#34;sponsoring&#34;&#xA;&gt; child transaction must be V3.&#xA;&gt;&#xA;&gt; *Note*: Combined with the V3 rules, this means the package must be&#xA;&gt; a child-with-parents package. Since package validation is only&#xA;&gt; attempted if the transactions do not pay sufficient fees to be&#xA;&gt; accepted on their own, this effectively means that only V3&#xA;&gt; transactions can pay to replace their ancestors&#39; conflicts, and only&#xA;&gt; V3 transactions&#39; replacements may be paid for by a descendant.&#xA;&gt;&#xA;&gt; *Rationale*: The fee-related rules are economically rational for&#xA;&gt; ancestor packages, but not necessarily other types of packages.&#xA;&gt; A child-with-parents package is a type of ancestor package. It&#xA;&gt; may be fine to allow any ancestor package, but it&#39;s more difficult&#xA;&gt; to account for all of the possibilities. For example, it gets much&#xA;&gt; harder to see that we&#39;re applying the descendant limits correctly if&#xA;&gt; the package has a gnarly, many-generation, non-tree shape. I&#39;m also&#xA;&gt; not sure if this policy is 100% incentive-compatible if the sponsor&#xA;&gt; is not a direct descendant of the sponsee.&#xA;&gt;&#xA;&gt; Please see doc/policy/version3_transactions.md and&#xA;&gt; doc/policy/packages.md in the PR for the full set of rules.&#xA;&gt;&#xA;&gt; **Intended usage for LN:**&#xA;&gt;&#xA;&gt; Commitment transactions should be V3 and have 1 anchor output. They&#xA;&gt; can be signed with 0 fees (or 1sat/vbyte) once package relay is deployed&#xA;&gt; on a significant portion of the network. If the commitment tx must&#xA;&gt; be broadcast, determine the desired feerate at broadcast time and&#xA;&gt; spend the anchor output in a high feerate transaction. I&#39;m going to&#xA;&gt; call the broadcasted commitment tx &#34;the parent&#34; and the attached&#xA;&gt; fee-bumping tx &#34;the child.&#34;&#xA;&gt;&#xA;&gt; - This child must be V3.&#xA;&gt; - This child must be at most 1000vB. Note this restricts the&#xA;&gt;   number of inputs you can use to fund the fee bump. Depending&#xA;&gt; on the output types, this is around 6-15.&#xA;&gt; - One child may fund fees for multiple commitment tx (&#34;batched&#xA;&gt;   fee-bumping&#34;).&#xA;&gt; - To do a second fee-bump to add more fees, replace the&#xA;&gt;   *child* with a higher-feerate tx. Do not try to attach a grandchild.&#xA;&gt;&#xA;&gt; Otherwise, never try to spend from an unconfirmed V3 transaction. The&#xA;&gt; descendant limits for V3 transactions are very restrictive.&#xA;&gt;&#xA;&gt; **Expected Questions:**&#xA;&gt;&#xA;&gt; &#34;Does this fix Rule 3 Pinning?&#34;&#xA;&gt; Yes. The V3 descendant limit restricts both you and your counterparty.&#xA;&gt; Assuming nodes adopted this policy, you may reasonably assume that you&#xA;&gt; only need to replace the commitment transaction + up to 1000vB.&#xA;&gt;&#xA;&gt; &#34;Only 1 anchor output? What if I need to bump counterparty&#39;s commitment tx&#xA;&gt; in mempool?&#34;&#xA;&gt; You won&#39;t need to fee-bump a counterparty&#39;s commitment tx using CPFP.&#xA;&gt; You would just package RBF it by attaching a high-feerate child to&#xA;&gt; your commitment tx.&#xA;&gt;&#xA;&gt; &#34;Is this a privacy issue, i.e. doesn&#39;t it allow fingerprinting LN&#xA;&gt; transactions based on nVersion?&#34;&#xA;&gt; Indeed it may be unrealistic to assume V3 transactions will be in&#xA;&gt; widespread use outside of L2. IIUC, unilateral closes are already&#xA;&gt; obvious LN transactions because of the HTLC inputs. For e.g.&#xA;&gt; cooperative closes and opens, I think it makes sense to continue using&#xA;&gt; V2. So, unless I&#39;m missing something, this shouldn&#39;t make it worse.&#xA;&gt;&#xA;&gt; &#34;So a V3 transaction that doesn&#39;t signal BIP125 replaceability is&#xA;&gt; replaceable? Is that a backward compatibility issue?&#34;&#xA;&gt; Yes it&#39;s replaceable. It&#39;s not an issue AFAICT because,&#xA;&gt; under previous policy, the V3 transaction wouldn&#39;t have been&#xA;&gt; in the mempool in the first place.&#xA;&gt;&#xA;&gt; &#34;Can a V2 transaction replace a V3 transaction and vice versa?&#34;&#xA;&gt; Yes, otherwise someone can use V3 transactions to censor V2&#xA;&gt; transactions spending shared inputs. Note if the&#xA;&gt; original V3 transaction has an unconfirmed V3 parent, this would&#xA;&gt; violate the &#34;inherited V3&#34; rule and would be rejected.&#xA;&gt;&#xA;&gt; Thanks for reading! Feedback and review would be much appreciated.&#xA;&gt;&#xA;&gt; [1]:&#xA;&gt; https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-September/019464.html&#xA;&gt; [2]:&#xA;&gt; https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2022-January/019817.html&#xA;&gt;&#xA;&gt; Best,&#xA;&gt; Gloria&#xA;&gt; _______________________________________________&#xA;&gt; bitcoin-dev mailing list&#xA;&gt; bitcoin-dev at lists.linuxfoundation.org&#xA;&gt; https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&#xA;&gt;&#xA;-------------- next part --------------&#xA;An HTML attachment was scrubbed...&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20220923/43403b3a/attachment-0001.html&gt;</html></oembed>