-
Notifications
You must be signed in to change notification settings - Fork 266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement "Simple Taproot Channels" BOLT proposal #2868
base: store-partial-signatures
Are you sure you want to change the base?
Conversation
0082aea
to
51ec562
Compare
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #2868 +/- ##
==========================================
+ Coverage 85.92% 86.38% +0.46%
==========================================
Files 219 220 +1
Lines 18488 19477 +989
Branches 794 814 +20
==========================================
+ Hits 15886 16826 +940
- Misses 2602 2651 +49
|
51ec562
to
cdefa9a
Compare
786cfa1
to
f9fe228
Compare
f9fe228
to
7480cee
Compare
37553dc
to
1966835
Compare
46ef2b7
to
155b8dc
Compare
1966835
to
2015ced
Compare
452c0e0
to
16e75b0
Compare
2015ced
to
c259402
Compare
57310de
to
0ac5a45
Compare
c259402
to
537d134
Compare
0ac5a45
to
af1d5c7
Compare
537d134
to
22e6a8e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good so far. I focused this preliminary review on splicing to identifiy any potential nonce reuse issues early.
I found one potential issue if we allow tx_abort
after we send commit_sig
.
I also think RBF of splices will need to be done carefully to avoid nonce resuse. I think we will need to include the RBF attempt count when generating nonces. I'll review again once you've rebased on the latest splice branch that includes splice RBF.
eclair-core/src/main/scala/fr/acinq/eclair/channel/fund/InteractiveTxBuilder.scala
Show resolved
Hide resolved
af1d5c7
to
5e9706a
Compare
cb1a0ff
to
dc59336
Compare
5e9706a
to
1926d8a
Compare
dc59336
to
799c1da
Compare
This can be helpful when troubleshooting cross-compatibility issues. Replaces #2911.
1926d8a
to
f9fa5ba
Compare
1d85d22
to
258a479
Compare
This is clearer that way and yields the same result: we only look at `txOut` amounts when computing each node's contributions.
If a payer is buggy and tries to pay the same invoice multiple times, it can lead to an edge case where the recipient accepted the first one and purchased liquidity for it, but didn't purchase additional liquidity and thus cannot receive the duplicate payments. Also, when replaying parts that were waiting for an on-the-fly funding, we set `commit = false` to all parts, instead of just the last one. This optimization caused the payment to be stuck if the last part was unexpectedly rejected (which would for example happen in the buggy payer case described above, before we rejected those extra payments). --------- Co-authored-by: t-bast <[email protected]>
The codec that we were using to serialize `LightningMessage`s in the eclair cluster didn't support `UnknownMessage`. This resulted in those messages being dropped by the front and never reaching the backend node.
258a479
to
4e6a55e
Compare
This feature adds two new messages: - `closing_complete` sent after exchanging `shutdown` - `closing_sig` sent in response to `closing_complete`
The spec allows the closer to use an OP_RETURN output if their amount is too low when using `option_simple_close`.
We introduce a new `NEGOTIATING_SIMPLE` state where we exchange the `closing_complete` and `closing_sig` messages, and allow RBF-ing previous transactions and updating our closing script. We stay in that state until one of the transactions confirms, or a force close is detected. This is important to ensure we're able to correctly reconnect and negotiate RBF candidates. We keep this separate from the previous NEGOTIATING state to make it easier to remove support for the older mutual close protocols once we're confident the network has been upgraded.
Whenever one side sends `shutdown`, we restart a signing round from scratch. To be compatible with future taproot channels, we require the receiver to also send `shutdown` before moving on to exchanging `closing_complete` and `closing_sig`. This will give nodes a message to exchange fresh musig2 nonces before producing signatures. On reconnection, we also restart a signing session from scratch and discard pending partial signatures.
Our InputInfo class contains a tx output and the matching redeem script, which is enough to spend segwit v0 transactions. For taproot transactions, instead of a redeem script, we need a script tree instead, and the appropriate internal pubkey.
Co-authored-by: Pierre-Marie Padiou <[email protected]>
We currently store our peer's signature for our remote commit tx, so we can publish it if needed. If we upgrade funding tx to use musig2 instead of multisig 2-of-2 we will need to store a partial signature instead.
This commit implements: - feature bits for simple taproot channels - TLV extensions for funding/closing wire messages - modifications to how we handle channel funding, splicing and mutual closing - changes to the commitment structures Since the current "simple taproot channels" proposal is not compatible with splices, we extend it to include a list of musig2 nonces (one for each active commitment transaction). Similar to how commitment points are handled, `firstRemoteNonce` and `secondRemoteNonce` fields have been added to `SpliceInit` and `SpliceAck`, encoded as a list of nonces (instead of 2 expicit nonces) We also need a nonce for the new commit tx that is being built, here it has been added to `SpliceInit` and `SpliceAck`.
`partial_signature_with_nonce` TLVs are added to `closing_complete` and `closing_sig` with the same format as in `commitment_signed` The closing workflow is similar to the standard "simple close" workflow: - Alice and Bob exchange `shutdown`, which includes a "closing nonce" (no changes here compared to the "simple taproot channels" spec). - Alice selects possible closing transaction (closer_output_only, closee_output_only, closer_and_closee_output) and for each of them creates a partial_signature_with_nonce using a new random local nonce and Bob's closing nonce (which she received in Bob's `shutdown` message). - Alice send a `closing_complete` message to Bob that include these partial_signature_with_nonce. - Bob receive Alice's `closing_complete` message, selects one of Alice's partial_signature_with_nonce, creates partial_signature_with_nonce using. his closing nonce and the nonce attached to the partial_signature_with_nonce and sends it to Alice in a `closing_sig` message. - Alice receives Bob's `closing_sig` and creates a partial signature for her closing tx using her closing nonce and the nonce attached Bob's partial_signature_with_nonce. - Alice combines this signature with Bob's and can broadcat her closing tx.
Upon re-connection, when a splice has not been fully completed, nodes will re-send signatures for the previous remote commit tx. This signature will be ignored by the receiving nodes if it has already received it before it was disconnected, simply by comparing them (signatures are deterministic). With taproot channels, we also need to attach musig2 nonces for splices in progress to channel_reestablish, which are needed to re-generate the signature for the old commit tx.
4e6a55e
to
827bcd9
Compare
This PR implements lightning/bolts#995 which introduces a new channel format where funding transactions send to an aggregated musig2 public key instead of a 2-of-2 multisig address:
Basic interop testing (opening/closing channels, sending/receiving payments) pass with lnd v0.18
The trickiest part of this PR is the update to the splicing protocol: splicing means that there can be multiple commitment transactions that are active at the same time, and signatures must be exchanged for all of them. With the new musig2-based funding transaction scheme, this means generating and exchanging musig2 nonces in advance, which requires modifications to the interactive tx and splicing protocols that are not (yet) covered by the BOLT proposal.
This is still a WIP, we also need to add support for simple taproot channels to https://github.com/ACINQ/lightning-kmp.
Based on #2896