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