Skip to content

Conversation

t-bast
Copy link
Member

@t-bast t-bast commented Jun 23, 2025

We introduce a new channel codec version where:

  • we extract per-commitment parameters (commitment format and params such as dust_limit which we may want to dynamically update in the future)
  • we clean-up the splice iterations on the Commitments structure
  • we remove the funding transaction from the confirmed local funding status (once confirmed, we don't need it anymore: it is wasting DB space for no good reason, we can get it from the blockchain)
  • we add a maxClosingFeerate_opt to the closing state, to allow limiting the feerate used in RBF attempts for safe transactions

@t-bast
Copy link
Member Author

t-bast commented Jun 26, 2025

@sstone this PR is now ready for the taproot work to be rebased on top of it to validate the v5 codecs!

@t-bast t-bast force-pushed the channel-codecs-v5 branch from d9b8b5e to 3ac5b01 Compare July 1, 2025 10:11
@t-bast
Copy link
Member Author

t-bast commented Jul 1, 2025

Rebased to include the bitcoin-lib update.

@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 97.11934% with 21 lines in your changes missing coverage. Please review.

Project coverage is 86.16%. Comparing base (f14b92d) to head (3ac5b01).
Report is 29 commits behind head on master.

Files with missing lines Patch % Lines
...ire/internal/channel/version4/ChannelCodecs4.scala 87.87% 8 Missing ⚠️
...wire/internal/channel/version4/ChannelTypes4.scala 92.10% 6 Missing ⚠️
...cala/fr/acinq/eclair/SpendFromChannelAddress.scala 0.00% 1 Missing ⚠️
...in/scala/fr/acinq/eclair/channel/Commitments.scala 98.88% 1 Missing ⚠️
...inq/eclair/channel/fund/InteractiveTxBuilder.scala 96.00% 1 Missing ⚠️
...la/fr/acinq/eclair/transactions/Transactions.scala 94.44% 1 Missing ⚠️
...ire/internal/channel/version0/ChannelCodecs0.scala 75.00% 1 Missing ⚠️
...ire/internal/channel/version3/ChannelCodecs3.scala 80.00% 1 Missing ⚠️
...wire/internal/channel/version3/ChannelTypes3.scala 95.45% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3118      +/-   ##
==========================================
+ Coverage   85.80%   86.16%   +0.35%     
==========================================
  Files         236      239       +3     
  Lines       21299    22031     +732     
  Branches      859      822      -37     
==========================================
+ Hits        18275    18982     +707     
- Misses       3024     3049      +25     
Files with missing lines Coverage Δ
...in/scala/fr/acinq/eclair/channel/ChannelData.scala 100.00% <100.00%> (ø)
...c/main/scala/fr/acinq/eclair/channel/Helpers.scala 93.24% <100.00%> (+2.08%) ⬆️
...in/scala/fr/acinq/eclair/channel/fsm/Channel.scala 83.76% <100.00%> (+0.66%) ⬆️
...inq/eclair/channel/fsm/ChannelOpenDualFunded.scala 86.38% <100.00%> (-0.10%) ⬇️
...q/eclair/channel/fsm/ChannelOpenSingleFunded.scala 92.77% <100.00%> (-0.62%) ⬇️
...inq/eclair/channel/fsm/CommonFundingHandlers.scala 92.30% <100.00%> (ø)
...la/fr/acinq/eclair/channel/fsm/ErrorHandlers.scala 82.72% <100.00%> (+2.36%) ⬆️
...cinq/eclair/crypto/keymanager/CommitmentKeys.scala 100.00% <100.00%> (ø)
...la/fr/acinq/eclair/io/OpenChannelInterceptor.scala 90.24% <100.00%> (-0.54%) ⬇️
...n/scala/fr/acinq/eclair/json/JsonSerializers.scala 96.00% <ø> (ø)
... and 16 more

... and 8 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@t-bast t-bast force-pushed the channel-codecs-v5 branch 3 times, most recently from 4c81ec2 to 33cd067 Compare July 15, 2025 14:40
@t-bast t-bast mentioned this pull request Jul 29, 2025
t-bast added a commit to ACINQ/lightning-kmp that referenced this pull request Jul 29, 2025
We refactor our transactions handling and our closing data to match the
changes made in `eclair` to support taproot channels and commitment
upgrades during splices.

The architecture matches the change made in eclair, up to changes from
ACINQ/eclair#3118
@t-bast t-bast marked this pull request as ready for review August 8, 2025 09:01
@t-bast t-bast requested a review from pm47 August 8, 2025 09:01
t-bast added 4 commits August 8, 2025 11:02
Before introducing channel codecs v5, we add more test data encoded with
the v4 codecs, especially for the fields we intend to change.
We introduce a new channel codec version where:

- we extract per-commitment parameters (commitment format and params
  such as `dust_limit` which we may want to dynamically update in the
  future)
- we clean-up the splice iterations on the `Commitments` structure
- we remove the funding transaction from the confirmed local funding
  status (once confirmed, we don't need it anymore: it is wasting DB
  space for no good reason, we can get it from the blockchain)
- we add a `maxClosingFeerate_opt` to the closing state, to allow
  limiting the feerate used in RBF attempts for safe transactions
And remove the unused sealed trait, the commitment format contains the
information we need so we don't need multiple child classes. We still
use a `discriminated` at the codec level though to allow changing the
format in the future if needed.
We want to be able to update channel types during splices, which means
that channel type features will not be permanent anymore. We decouple
permanent channel features (that apply to the lifetime of the channel)
from channel type features to allow this.
pm47
pm47 previously approved these changes Aug 19, 2025
Copy link
Member

@pm47 pm47 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (I feel like I have already reviewed this?)

I suggest adding some temporary code in Setup.scala that prevents app startup. It would give us time to rebase feature branches and maybe refine codecs, without worrying about backward compat for users that run master.

t-bast added 2 commits August 19, 2025 12:14
We add a mechanism to prevent the node from starting-up, unless an
override is provided. This provides an opportunity to iterate on codecs
while knowing that node operators won't be affected if we make changes
that are backwards-incompatible.
@t-bast
Copy link
Member Author

t-bast commented Aug 19, 2025

I suggest adding some temporary code in Setup.scala that prevents app startup. It would give us time to rebase feature branches and maybe refine codecs, without worrying about backward compat for users that run master.

Good idea, done in a8bed6f and tested locally. I did this in Boot.scala so that integration tests are not affected, and provided an override to allow starting the node anyway for our testnet tests.

@t-bast t-bast requested review from sstone and pm47 August 19, 2025 10:36
@t-bast t-bast merged commit 49bee72 into master Aug 19, 2025
1 check passed
@t-bast t-bast deleted the channel-codecs-v5 branch August 19, 2025 12:53
t-bast added a commit to ACINQ/lightning-kmp that referenced this pull request Aug 25, 2025
We refactor our transactions handling and our closing data to match the
changes made in `eclair` to support taproot channels and commitment
upgrades during splices.

The architecture matches the change made in eclair, up to changes from
ACINQ/eclair#3118
t-bast added a commit to ACINQ/lightning-kmp that referenced this pull request Aug 27, 2025
We refactor our transactions handling and our closing data to match the
changes made in `eclair` to support taproot channels and commitment
upgrades during splices.

The architecture matches the change made in eclair, up to changes from
ACINQ/eclair#3118
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants