<oembed><type>rich</type><version>1.0</version><author_name>npub19helcfnqgk2jrwzjex2aflq6jwfc8zd9uzzkwlgwhve7lykv23mq5zkvn4</author_name><author_url>https://nostr.ae/npub19helcfnqgk2jrwzjex2aflq6jwfc8zd9uzzkwlgwhve7lykv23mq5zkvn4</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2020-04-22&#xA;📝 Original message:&#xA;&gt; This seems like a somewhat unnecessary drive-by insult of a project you&#xA;&gt; don&#39;t contribute to, but feel free to start with a concrete suggestion&#xA;&gt; here :).&#xA;&#xA;This wasn&#39;t intended as an insult at all. I&#39;m simply saying if there&#39;s&#xA;concern about worst case eviction/replacement, optimizations likely exist.&#xA;Other developers that are interested in more complex multi-transaction&#xA;contracts have realized this as well, and there&#39;re various open PRs that&#xA;attempt to propose such optimizations [1].&#xA;&#xA;&gt; Hmm, maybe the proposal wasn&#39;t clear. The idea isn&#39;t to add signatures to&#xA;&gt; braodcasted transactions, but instead to CPFP a maybe-broadcasted&#xA;&gt; transaction by sending a transaction which spends it and seeing if it is&#xA;&gt; accepted&#xA;&#xA;Sorry I still don&#39;t follow. By &#34;we clearly need to go the other direction -&#xA;all HTLC output spends need to be pre-signed.&#34;, you don&#39;t mean that the HTLC&#xA;spends of the non-broadcaster also need to be an off-chain 2-of-2 multi-sig&#xA;covenant? If the other party isn&#39;t restricted w.r.t _how_ they can spend the&#xA;output (non-rbf&#39;d, ect), then I don&#39;t see how that addresses anything.&#xA;&#xA;Also see my mail elsewhere in the thread that the other party is actually&#xA;forced to spend their HTLC output using an RBF-replaceable transaction. With&#xA;that, I think we&#39;re all good here? In the end both sides have the ability to&#xA;raise the fee rate of their spending transactions with the highest winning.&#xA;As long as one of them confirms within the CLTV-delta, then everyone is&#xA;made whole.&#xA;&#xA;&#xA;[1]: https://github.com/bitcoin/bitcoin/pull/18191&#xA;&#xA;&#xA;On Wed, Apr 22, 2020 at 9:50 AM Matt Corallo &lt;lf-lists at mattcorallo.com&gt;&#xA;wrote:&#xA;&#xA;&gt; A few replies inline.&#xA;&gt;&#xA;&gt; On 4/22/20 12:13 AM, Olaoluwa Osuntokun wrote:&#xA;&gt; &gt; Hi Matt,&#xA;&gt; &gt;&#xA;&gt; &gt;&#xA;&gt; &gt;&gt; While this is somewhat unintuitive, there are any number of good&#xA;&gt; anti-DoS&#xA;&gt; &gt;&gt; reasons for this, eg:&#xA;&gt; &gt;&#xA;&gt; &gt; None of these really strikes me as &#34;good&#34; reasons for this limitation,&#xA;&gt; which&#xA;&gt; &gt; is at the root of this issue, and will also plague any more complex&#xA;&gt; Bitcoin&#xA;&gt; &gt; contracts which rely on nested trees of transaction to confirm (CTV,&#xA;&gt; Duplex,&#xA;&gt; &gt; channel factories, etc). Regarding the various (seemingly arbitrary)&#xA;&gt; package&#xA;&gt; &gt; limits it&#39;s likely the case that any issues w.r.t computational&#xA;&gt; complexity&#xA;&gt; &gt; that may arise when trying to calculate evictions can be ameliorated with&#xA;&gt; &gt; better choice of internal data structures.&#xA;&gt; &gt;&#xA;&gt; &gt; In the end, the simplest heuristic (accept the higher fee rate package)&#xA;&gt; side&#xA;&gt; &gt; steps all these issues and is also the most economically rationale from a&#xA;&gt; &gt; miner&#39;s perspective. Why would one prefer a higher absolute fee package&#xA;&gt; &gt; (which could be very large) over another package with a higher total _fee&#xA;&gt; &gt; rate_?&#xA;&gt;&#xA;&gt; This seems like a somewhat unnecessary drive-by insult of a project you&#xA;&gt; don&#39;t contribute to, but feel free to start with&#xA;&gt; a concrete suggestion here :).&#xA;&gt;&#xA;&gt; &gt;&gt; You&#39;ll note that B would be just fine if they had a way to safely&#xA;&gt; monitor the&#xA;&gt; &gt;&gt; global mempool, and while this seems like a prudent mitigation for&#xA;&gt; &gt;&gt; lightning implementations to deploy today, it is itself a quagmire of&#xA;&gt; &gt;&gt; complexity&#xA;&gt; &gt;&#xA;&gt; &gt; Is it really all that complex? Assuming we&#39;re talking about just watching&#xA;&gt; &gt; for a certain script template (the HTLC scipt) in the mempool to be able&#xA;&gt; to&#xA;&gt; &gt; pull a pre-image as soon as possible. Early versions of lnd used the&#xA;&gt; mempool&#xA;&gt; &gt; for commitment broadcast detection (which turned out to be a bad idea so&#xA;&gt; we&#xA;&gt; &gt; removed it), but at a glance I don&#39;t see why watching the mempool is so&#xA;&gt; &gt; complex.&#xA;&gt;&#xA;&gt; Because watching your own mempool is not guaranteed to work, and during&#xA;&gt; upgrade cycles that include changes to the&#xA;&gt; policy rules an attacker could exploit your upgraded/non-upgraded status&#xA;&gt; to perform the same attack.&#xA;&gt;&#xA;&gt; &gt;&gt; Further, this is a really obnoxious assumption to hoist onto lightning&#xA;&gt; &gt;&gt; nodes - having an active full node with an in-sync mempool is a lot more&#xA;&gt; &gt;&gt; CPU, bandwidth, and complexity than most lightning users were expecting&#xA;&gt; to&#xA;&gt; &gt;&gt; face.&#xA;&gt; &gt;&#xA;&gt; &gt; This would only be a requirement for Lightning nodes that seek to be a&#xA;&gt; part&#xA;&gt; &gt; of the public routing network with a desire to _forward_ HTLCs. This&#xA;&gt; isn&#39;t&#xA;&gt; &gt; doesn&#39;t affect laptops or mobile phones which likely mostly have private&#xA;&gt; &gt; channels and don&#39;t participate in HTLC forwarding. I think it&#39;s pretty&#xA;&gt; &gt; reasonable to expect a &#34;proper&#34; routing node on the network to be backed&#xA;&gt; by&#xA;&gt; &gt; a full-node. The bandwidth concern is valid, but we&#39;d need concrete&#xA;&gt; numbers&#xA;&gt; &gt; that compare the bandwidth over head of mempool awareness (assuming the&#xA;&gt; &gt; latest and greatest mempool syncing) compared with the overhead of the&#xA;&gt; &gt; channel update gossip and gossip queries over head which LN nodes face&#xA;&gt; today&#xA;&gt; &gt; as is to see how much worse off they really would be.&#xA;&gt;&#xA;&gt; If mempool-watching were practical, maybe, though there are a number of&#xA;&gt; folks who are talking about designing&#xA;&gt; partially-offline local lightning hubs which would be rendered impractical.&#xA;&gt;&#xA;&gt; &gt; As detailed a bit below, if nodes watch the mempool, then this class of&#xA;&gt; &gt; attack assuming the anchor output format as described in the open&#xA;&gt; &gt; lightning-rfc PR is mitigated. At a glance, watching the mempool seems&#xA;&gt; like&#xA;&gt; &gt; a far less involved process compared to modifying the state machine as&#xA;&gt; its&#xA;&gt; &gt; defined today. By watching the mempool and implementing the changes in&#xA;&gt; &gt; #lightning-rfc/688, then this issue can be mitigated _today_. lnd 0.10&#xA;&gt; &gt; doesn&#39;t yet watch the mempool (but does include anchors [1]), but unless&#xA;&gt; I&#39;m&#xA;&gt; &gt; missing something it should be pretty straight forward to add which mor&#xA;&gt; or less&#xA;&gt; &gt; resolves this issue all together.&#xA;&gt; &gt;&#xA;&gt; &gt;&gt; not fixing this issue seems to render the whole exercise somewhat&#xA;&gt; useless&#xA;&gt; &gt;&#xA;&gt; &gt; Depends on if one considers watching the mempool a fix. But even with&#xA;&gt; that a&#xA;&gt; &gt; base version of anchors still resolves a number of issues including:&#xA;&gt; &gt; eliminating the commitment fee guessing game, allowing users to pay less&#xA;&gt; on&#xA;&gt; &gt; force close, being able to coalesce 2nd level HTLC transactions with the&#xA;&gt; &gt; same CLTV expiry, and actually being able to reliably enforce multi-hop&#xA;&gt; HTLC&#xA;&gt; &gt; resolution.&#xA;&gt; &gt;&#xA;&gt; &gt;&gt; Instead of making the HTLC output spending more free-form with&#xA;&gt; &gt;&gt; SIGHASH_ANYONECAN_PAY|SIGHASH_SINGLE, we clearly need to go the other&#xA;&gt; &gt;&gt; direction - all HTLC output spends need to be pre-signed.&#xA;&gt; &gt;&#xA;&gt; &gt; I&#39;m not sure this is actually immediately workable (need to think about&#xA;&gt; it&#xA;&gt; &gt; more). To see why, remember that the commit_sig message includes HTLC&#xA;&gt; &gt; signatures for the _remote_ party&#39;s commitment transaction, so they can&#xA;&gt; &gt; spend the HTLCs if they broadcast their version of the commitment (force&#xA;&gt; &gt; close). If we don&#39;t somehow also _gain_ signatures (our new HTLC&#xA;&gt; signatures)&#xA;&gt; &gt; allowing us to spend HTLCs on _their_ version of the commitment, then if&#xA;&gt; &gt; they broadcast that commitment (without revoking), then we&#39;re unable to&#xA;&gt; &gt; redeem any of those HTLCs at all, possibly losing money.&#xA;&gt;&#xA;&gt; Hmm, maybe the proposal wasn&#39;t clear. The idea isn&#39;t to add signatures to&#xA;&gt; braodcasted transactions, but instead to CPFP&#xA;&gt; a maybe-broadcasted transaction by sending a transaction which spends it&#xA;&gt; and seeing if it is accepted. You only need to&#xA;&gt; know the transaction&#39;s exact format (ie txid, which we do, since we sent a&#xA;&gt; signature for it long ago) to do this, you&#xA;&gt; don&#39;t have to actually *have* the fully-signed transaction (and you don&#39;t).&#xA;&gt;&#xA;&gt; &gt; In an attempt to counteract this, we might say ok, the revoke message&#xA;&gt; also&#xA;&gt; &gt; now includes HTLC signatures for their new commitment allowing us to&#xA;&gt; spend&#xA;&gt; &gt; our HTLCs. This resolves things in a weaker security model, but doesn&#39;t&#xA;&gt; &gt; address the issue generally, as after they receive the commit_sig, they&#xA;&gt; can&#xA;&gt; &gt; broadcast immediately, again leaving us without a way to redeem our&#xA;&gt; HTLCs.&#xA;&gt; &gt;&#xA;&gt; &gt; I&#39;d need to think about it more, but it seems that following this path&#xA;&gt; would&#xA;&gt; &gt; require an overhaul in the channel state machine to make presenting a new&#xA;&gt; &gt; commitment actually take at least _two phases_ (at least a full round&#xA;&gt; trip).&#xA;&gt; &gt; The first phase would tender the commitment, but render them unable to&#xA;&gt; &gt; broadcast it. The second phase would then &lt;insert something something&#xA;&gt; &gt; scriptless scripts here&gt; enter a new sub-protocol which upon conclusion,&#xA;&gt; &gt; gives the commitment proposer valid HTLC signatures, and gives the&#xA;&gt; responder&#xA;&gt; &gt; what they need to be able to broadcast their commitment and claim their&#xA;&gt; &gt; HTCLs in an atomic manner.&#xA;&gt; &gt;&#xA;&gt; &gt; -- Laolu&#xA;&gt; &gt;&#xA;&gt; &gt; [1]: https://github.com/lightningnetwork/lnd/pull/3821&#xA;&gt;&#xA;-------------- next part --------------&#xA;An HTML attachment was scrubbed...&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/lightning-dev/attachments/20200422/2392c438/attachment-0001.html&gt;</html></oembed>