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