<oembed><type>rich</type><version>1.0</version><author_name>npub17fjkngg0s0mfx4uhhz6n4puhflwvrhn2h5c78vdr5xda4mvqx89swntr0s</author_name><author_url>https://nostr.ae/npub17fjkngg0s0mfx4uhhz6n4puhflwvrhn2h5c78vdr5xda4mvqx89swntr0s</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2021-12-08&#xA;📝 Original message:&#xA;Hi again AJ and list,&#xA;&#xA;I have slightly re-worked your proposal, and came up with the following&#xA;(I also added the musig2 nonces for completeness):&#xA;&#xA;Alice -&gt; Bob: commitment_proposed&#xA;    channel id&#xA;    adaptor sigs for PTLCs to Bob in Alice&#39;s next commitment&#xA;    musig nonces for Alice to spend funding tx&#xA;    musig nonces for Bob to spend funding tx&#xA;&#xA;Bob -&gt; Alice: commitment_proposed&#xA;    channel id&#xA;    adaptor sigs for PTLCs to Alice in Bob&#39;s next commitment&#xA;    musig nonces for Alice to spend funding tx&#xA;    musig nonces for Bob to spend funding tx&#xA;&#xA;Bob -&gt; Alice: commitment_signed&#xA;    channel id&#xA;    signature for Alice to spend funding tx&#xA;    sigs for Alice to spend HTLCs and PTLCs from her next commitment&#xA;&#xA;Alice -&gt; Bob: revoke_and_ack&#xA;    channel id&#xA;    reveal previous commitment secret&#xA;    next commitment point&#xA;&#xA;Alice -&gt; Bob: commitment_signed&#xA;    channel id&#xA;    signature for Bob to spend funding tx&#xA;    sigs for Bob to spend HTLCs and PTLCs from his next commitment&#xA;&#xA;Bob -&gt; Alice: revoke_and_ack&#xA;    channel id&#xA;    reveal previous commitment secret&#xA;    next commitment point&#xA;&#xA;I believe it&#39;s exactly the same flow of data between peers as your&#xA;proposal, but I simply split the data into several messages. Let me&#xA;know if that&#39;s incorrect or if I missed a subtlety in your proposal.&#xA;&#xA;This has some small advantages:&#xA;&#xA;* commitment_signed and revoke_and_ack are mostly unchanged, we just&#xA;add a new message before the commit / revoke dance. The only change&#xA;happens in commitment_signed, where the signatures for PTLC-success&#xA;transactions will actually become adaptor signatures.&#xA;* the new adaptor signatures are in commitment_proposed instead of being&#xA;in commitment_signed, which ensures that we can still have 2*483&#xA;pending (H|P)TLCs: since the message size is limited to 65kB, we would&#xA;otherwise decrease our maximum to ~2*335 with your proposal (very rough&#xA;calculation)&#xA;* the messages are now symmetrical, which may be easier to reason about&#xA;&#xA;One thing to note is that we reversed the order in which participants&#xA;sign new commitments. We previously had Alice sign first, whereas now&#xA;if Alice initiates, Bob will sign the updated commitment first. This is&#xA;why we add only 0.5 RTT instead of 1 RTT compared to the current protocol.&#xA;I don&#39;t think this is an issue, but if someone sees a way to maliciously&#xA;exploit this, please share it!&#xA;&#xA;I updated my article [0], people jumping on the thread now may find it&#xA;helpful to better understand this discussion.&#xA;&#xA;Thanks,&#xA;Bastien&#xA;&#xA;[0] https://github.com/t-bast/lightning-docs/pull/16&#xA;&#xA;Le mer. 8 déc. 2021 à 11:00, Bastien TEINTURIER &lt;bastien at acinq.fr&gt; a écrit :&#xA;&#xA;&gt; Hi AJ,&#xA;&gt;&#xA;&gt; I think the problem t-bast describes comes up here as well when you&#xA;&gt;&gt; collapse the fast-forwards (or, anytime you update the commitment&#xA;&gt;&gt; transaction even if you don&#39;t collapse them).&#xA;&gt;&#xA;&gt;&#xA;&gt; Yes, exactly.&#xA;&gt;&#xA;&gt; I think doing a synchronous update of commitments to the channel state,&#xA;&gt;&gt; something like:&#xA;&gt;&#xA;&gt;&#xA;&gt;&#xA;&gt; Alice -&gt; Bob: propose_new_commitment&#xA;&gt;&gt; channel id&#xA;&gt;&gt; adaptor sigs for PTLCs to Bob&#xA;&gt;&#xA;&gt;&#xA;&gt;&gt; Bob -&gt; Alice: agree_new_commitment&#xA;&gt;&gt; channel id&#xA;&gt;&gt; adaptor sigs for PTLCs to Alice&#xA;&gt;&gt; sigs for Alice to spend HTLCs and PTLCs to Bob from her own&#xA;&gt;&gt; commitment tx&#xA;&gt;&gt; signature for Alice to spend funding tx&#xA;&gt;&gt;&#xA;&gt;&gt; Alice -&gt; Bob: finish_new_commitment_1&#xA;&gt;&gt; channel id&#xA;&gt;&gt; sigs for Bob to spend HTLCs and PTLCs to Alice from his own&#xA;&gt;&gt; commitment tx&#xA;&gt;&gt; signature for Bob to spend funding tx&#xA;&gt;&gt; reveal old prior commitment secret&#xA;&gt;&gt; new commitment nonce&#xA;&gt;&gt;&#xA;&gt;&gt; Bob -&gt; Alice: finish_new_commitment_2&#xA;&gt;&gt; reveal old prior commitment secret&#xA;&gt;&gt; new commitment nonce&#xA;&gt;&gt;&#xA;&gt;&gt; would work pretty well.&#xA;&gt;&#xA;&gt;&#xA;&gt; I agree, this is better than my naive addition of a `remote_ptlcs_signed`&#xA;&gt; message in both directions, and even though it changes the protocol&#xA;&gt; messages&#xA;&gt; it stays very close to the mechanisms we currently have.&#xA;&gt;&#xA;&gt; I&#39;ll spend some time specifying this in more details, to verify that we&#39;re&#xA;&gt; not missing anything. What I really like about this proposal is that we&#xA;&gt; can probably bundle that protocol change with `option_simplified_update`&#xA;&gt; [0]&#xA;&gt; without the adaptor sigs, and simply add the adaptor sigs as tlvs when we&#xA;&gt; do PTLCs. That lets us deploy this new update protocol separately from&#xA;&gt; PTLCs&#xA;&gt; and ensure it also simplifies the state machine and makes other features&#xA;&gt; such as splicing [1] and dynamic channel upgrades [2] easier.&#xA;&gt;&#xA;&gt; Thanks,&#xA;&gt; Bastien&#xA;&gt;&#xA;&gt; [0] https://github.com/lightning/bolts/pull/867&#xA;&gt; [1] https://github.com/lightning/bolts/pull/863&#xA;&gt; [2] https://github.com/lightning/bolts/pull/868&#xA;&gt;&#xA;&gt; Le mer. 8 déc. 2021 à 10:29, Anthony Towns &lt;aj at erisian.com.au&gt; a écrit :&#xA;&gt;&#xA;&gt;&gt; On Tue, Dec 07, 2021 at 11:52:04PM +0000, ZmnSCPxj via Lightning-dev&#xA;&gt;&gt; wrote:&#xA;&gt;&gt; &gt; Alternately, fast-forwards, which avoid this because it does not change&#xA;&gt;&gt; commitment transactions on the payment-forwarding path.&#xA;&gt;&gt; &gt; You only change commitment transactions once you have enough changes to&#xA;&gt;&gt; justify collapsing them.&#xA;&gt;&gt;&#xA;&gt;&gt; I think the problem t-bast describes comes up here as well when you&#xA;&gt;&gt; collapse the fast-forwards (or, anytime you update the commitment&#xA;&gt;&gt; transaction even if you don&#39;t collapse them).&#xA;&gt;&gt;&#xA;&gt;&gt; That is, if you have two PTLCs, one from A-&gt;B conditional on X, one&#xA;&gt;&gt; from B-&gt;A conditional on Y. Then if A wants to update the commitment tx,&#xA;&gt;&gt; she needs to&#xA;&gt;&gt;&#xA;&gt;&gt;   1) produce a signature to give to B to spend the funding tx&#xA;&gt;&gt;   2) produce an adaptor signature to authorise B to spend via X from his&#xA;&gt;&gt;      commitment tx&#xA;&gt;&gt;   3) produce a signature to allow B to recover Y after timeout from his&#xA;&gt;&gt;      commitment tx spending to an output she can claim if he cheats&#xA;&gt;&gt;   4) *receive* an adaptor signature from B to be able to spend the Y&#xA;&gt;&gt; output&#xA;&gt;&gt;      if B posts his commitment tx using A&#39;s signature in (1)&#xA;&gt;&gt;&#xA;&gt;&gt; The problem is, she can&#39;t give B the result of (1) until she&#39;s received&#xA;&gt;&gt; (4) from B.&#xA;&gt;&gt;&#xA;&gt;&gt; It doesn&#39;t matter if the B-&gt;A PTLC conditional on Y is in the commitment&#xA;&gt;&gt; tx itself or within a fast-forward child-transaction -- any previous&#xA;&gt;&gt; adaptor sig will be invalidated because there&#39;s a new commitment&#xA;&gt;&gt; transaction, and if you allowed any way of spending without an adaptor&#xA;&gt;&gt; sig, B wouldn&#39;t be able to recover the secret and would lose funds.&#xA;&gt;&gt;&#xA;&gt;&gt; It also doesn&#39;t matter if the commitment transaction that A and B will&#xA;&gt;&gt; publish is the same or different, only that it&#39;s different from the&#xA;&gt;&gt; commitment tx that previous adaptor sigs committed to. (So ANYPREVOUT&#xA;&gt;&gt; would fix this if it were available)&#xA;&gt;&gt;&#xA;&gt;&gt; So I think this is still a relevant question, even if fast-forwards&#xA;&gt;&gt; make it a rare problem, that perhaps is only applicable to very heavily&#xA;&gt;&gt; used channels.&#xA;&gt;&gt;&#xA;&gt;&gt; (I said the following in email to t-bast already)&#xA;&gt;&gt;&#xA;&gt;&gt; I think doing a synchronous update of commitments to the channel state,&#xA;&gt;&gt; something like:&#xA;&gt;&gt;&#xA;&gt;&gt;    Alice -&gt; Bob: propose_new_commitment&#xA;&gt;&gt;        channel id&#xA;&gt;&gt;        adaptor sigs for PTLCs to Bob&#xA;&gt;&gt;&#xA;&gt;&gt;    Bob -&gt; Alice: agree_new_commitment&#xA;&gt;&gt;        channel id&#xA;&gt;&gt;        adaptor sigs for PTLCs to Alice&#xA;&gt;&gt;        sigs for Alice to spend HTLCs and PTLCs to Bob from her own&#xA;&gt;&gt;          commitment tx&#xA;&gt;&gt;        signature for Alice to spend funding tx&#xA;&gt;&gt;&#xA;&gt;&gt;    Alice -&gt; Bob: finish_new_commitment_1&#xA;&gt;&gt;        channel id&#xA;&gt;&gt;        sigs for Bob to spend HTLCs and PTLCs to Alice from his own&#xA;&gt;&gt;          commitment tx&#xA;&gt;&gt;        signature for Bob to spend funding tx&#xA;&gt;&gt;        reveal old prior commitment secret&#xA;&gt;&gt;        new commitment nonce&#xA;&gt;&gt;&#xA;&gt;&gt;    Bob -&gt; Alice: finish_new_commitment_2&#xA;&gt;&gt;        reveal old prior commitment secret&#xA;&gt;&gt;        new commitment nonce&#xA;&gt;&gt;&#xA;&gt;&gt; would work pretty well.&#xA;&gt;&gt;&#xA;&gt;&gt; This adds half a round-trip compared to now:&#xA;&gt;&gt;&#xA;&gt;&gt;    Alice -&gt; Bob: commitment_signed&#xA;&gt;&gt;    Bob -&gt; Alice: revoke_and_ack, commitment_signed&#xA;&gt;&gt;    Alice -&gt; Bob: revoke_and_ack&#xA;&gt;&gt;&#xA;&gt;&gt; The timings change like so:&#xA;&gt;&gt;&#xA;&gt;&gt;   Bob can use the new commitment after 1.5 round-trips (previously 0.5)&#xA;&gt;&gt;&#xA;&gt;&gt;   Alice can be sure Bob won&#39;t use the old commitment after 2 round-trips&#xA;&gt;&gt;   (previously 1)&#xA;&gt;&gt;&#xA;&gt;&gt;   Alice can use the new commitment after 1 round-trip (unchanged)&#xA;&gt;&gt;&#xA;&gt;&gt;   Bob can be sure Alice won&#39;t use the old commitment after 1.5 round-trips&#xA;&gt;&gt;   (unchanged -- note: this is what&#39;s relevant for forwarding)&#xA;&gt;&gt;&#xA;&gt;&gt; Making the funding tx a musig setup would mean also supplying 64B&#xA;&gt;&gt; of musig2 nonces along with the &#34;adaptor sigs&#34; in one direction,&#xA;&gt;&gt; and providing the other side&#39;s 64B of musig2 nonces back along with the&#xA;&gt;&gt; (now partial) signature for spending the funding tx (a total of 256B of&#xA;&gt;&gt; nonce data, not 128B).&#xA;&gt;&gt;&#xA;&gt;&gt; Because it keeps both peers&#39; commitments synchronised to a single channel&#xA;&gt;&gt; state, I think the same protocol should work fine with the revocable&#xA;&gt;&gt; signatures on a single tx approach too, though I haven&#39;t tried working&#xA;&gt;&gt; through the details.&#xA;&gt;&gt;&#xA;&gt;&gt; Fast forwards would then be reducing the 2 round-trip protocol to&#xA;&gt;&gt; update the state commitment to a 0.5 round-trip update, to reduce&#xA;&gt;&gt; latency when forwarding by the same amount as before (1.5 round-trips&#xA;&gt;&gt; to 0.5 round-trips).&#xA;&gt;&gt;&#xA;&gt;&gt; Cheers,&#xA;&gt;&gt; aj&#xA;&gt;&gt;&#xA;&gt;&gt;&#xA;-------------- next part --------------&#xA;An HTML attachment was scrubbed...&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/lightning-dev/attachments/20211208/3072a12d/attachment.html&gt;</html></oembed>