[Splicing] Tx negotiation during splicing
Implementation of transaction negotiation during splicing. Builds on 3407 and 3443.
- No new phase,
Funded(FundedChannel)is used throughout splicing - Both
FundedChannelandPendingV2Channelcan act as a transaction constructor PendingV2Channellogic is put behind a trait --FundingTxConstructorV2- A
RenegotiatingScopeis used to store extra state during splicing FundingChannelcan act as aFundingTxConstructorV2, using the state fromRenegotiatingScope(if present)- Since both
FundedChannelandFundingTxConstructorhas context(), context accessors are extracted into a common base trait,ChannelContextProvider(it is also shared byInitialRemoteCommitmentReceiver).
(Also relevant: #3444)
π I see @wpaulino was un-assigned. If you'd like another reviewer assignment, please click here.
π 1st Reminder
Hey @jkczyz @wpaulino! This PR has been waiting for your review. Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.
π 1st Reminder
Hey @jkczyz @wpaulino! This PR has been waiting for your review. Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.
π 2nd Reminder
Hey @jkczyz @wpaulino! This PR has been waiting for your review. Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.
π 2nd Reminder
Hey @jkczyz @wpaulino! This PR has been waiting for your review. Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.
π 3rd Reminder
Hey @jkczyz @wpaulino! This PR has been waiting for your review. Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.
π 3rd Reminder
Hey @jkczyz @wpaulino! This PR has been waiting for your review. Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.
π 4th Reminder
Hey @jkczyz @wpaulino! This PR has been waiting for your review. Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.
π 4th Reminder
Hey @jkczyz @wpaulino! This PR has been waiting for your review. Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.
π 5th Reminder
Hey @jkczyz @wpaulino! This PR has been waiting for your review. Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.
π 5th Reminder
Hey @jkczyz @wpaulino! This PR has been waiting for your review. Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.
π 6th Reminder
Hey @jkczyz @wpaulino! This PR has been waiting for your review. Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.
π 6th Reminder
Hey @jkczyz @wpaulino! This PR has been waiting for your review. Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.
Codecov Report
:x: Patch coverage is 67.36111% with 94 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 88.95%. Comparing base (7ec13dc) to head (41cbc1f).
:warning: Report is 49 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #3736 +/- ##
==========================================
+ Coverage 88.92% 88.95% +0.02%
==========================================
Files 174 174
Lines 123869 124200 +331
Branches 123869 124200 +331
==========================================
+ Hits 110152 110476 +324
+ Misses 11256 11247 -9
- Partials 2461 2477 +16
| Flag | Coverage Ξ | |
|---|---|---|
| fuzzing | 22.63% <0.00%> (+0.45%) |
:arrow_up: |
| tests | 88.77% <67.36%> (+0.02%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
Ready for a new round of review. I have addressed the comments, applied most of them. There is still one to-do (update channel reserve values), that I will do, but the rest is ready for review. I did the changes in separate 'fix' commits.
Ready for a new round of review. All pending and newly raised comments addressed.
I've done some of the bigger changes, but there are still several outstanding.
Rebased to current main (there were some conflicts)
Comments addressed, I will clean/reorg up the commits.
I have rearranged the commits in this PR (there were some reverted changes, many fixes, etc.), into these 4:
- preparation: Rename DualFundingContext
- partial: Extend begin_interactive_...() with splicing-specific parameters
- partial: Introduce NegotiatingV2ChannelView to bridge Funded and PendingV2
- main logic: Implement transaction negotiation during splicing
Otherwise, no change applied this time. I'd appreciate a new round of review.
(Note: the old commits are available on branch splice-dual-tx4-save)
For reference, summary of NOT-included changes:
- Always pass previous funding TX to
begin_interactive_funding_tx_construction(), not only in the splice initiator case, but in the splice acceptor case as well. The initiator should add it as an input to the interactive contructor. The acceptor should also add it as a Shared Input (this is TODO in IATX), to be able to verify, that initiator has added it. Reason for being deferred: on the acceptor side (v1 channel) the fieldfunding.funding_transactionis currently never set. Set to be addressed in PR #3741. - Method
internal_splice_channeltakes owned input (not a reference). The drawback is thatsplice_channelneeds to clone, due tooptionally_notify. Could be solved by changing theFnMutinoptionally_notifytoFnOnce.
- Always pass previous funding TX to
begin_interactive_funding_tx_construction(), not only in the splice initiator case, but in the splice acceptor case as well. The initiator should add it as an input to the interactive contructor. The acceptor should also add it as a Shared Input (this is TODO in IATX), to be able to verify, that initiator has added it. Reason for being deferred: on the acceptor side (v1 channel) the fieldfunding.funding_transactionis currently never set. Set to be addressed in PR Exchangesplice_lockedmessagesΒ #3741.
We had some discussion on https://github.com/lightningdevkit/rust-lightning/pull/3741#discussion_r2127512308 and on the spec PR (https://github.com/lightning/bolts/pull/1160#issuecomment-2942997584) about this. Turns out we need to make TxAddInput::prevtx optional or possible an enum with TxAddInput::shared_input_txid. We'll avoid storing the funding transaction.
π 1st Reminder
Hey @wpaulino! This PR has been waiting for your review. Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.
We had some discussion on #3741 (comment) and on the spec PR (lightning/bolts#1160 (comment)) about this. Turns out we need to make
TxAddInput::prevtxoptional or possible an enum withTxAddInput::shared_input_txid. We'll avoid storing the funding transaction.
Getting closer :) As I see the changes needed:
- make TxAddInput::prevtx Optional
- Enhance
InteractiveConstructorto differentiate non-shared and shared inputs. For shared inputs setshared_input_txid(only the initiator). The acceptor should check if shared input was added. - To
begin_interactive_...we should supply the prev_funding_txo, in both inititator&acceptor case. Both would add it toInteractiveConstructoras shared input.
In this PR or another one? Probably best would be to include these into this PR (causing some further processing time).
In this PR or another one? Probably best would be to include these into this PR (causing some further processing time).
Yeah, I think we need to do it in this PR.
I'm working on shared input support, can be seen in draft PR #3842 . WIP.
Comments addressed, summary of pending changes:
- Extra
clone()added inchannelmanager.rswhen invokinginternal_splice_channel: root cause addressed in #3835 . - Shared input support: Pending, see #3842. If 3842 is merged first, I will add the changes here; if this PR is merged first, I will update 3842.
- Quiescence checks: the plan is to include them after this PR (wpaulino)
Let us know when this is ready for another round, no need to wait on #3842 to get more review on this.
Let us know when this is ready for another round, no need to wait on #3842 to get more review on this.
I was busy with #3842, but I agree that this PR should be treated independently of 3842. I will squash the fixups, and this should be ready for a new round of review.
Commits squashed, rebased (post #3741), fmt. Ready for a new round of review.