Skip to content

Implement start_batch message batching #3793

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jkczyz
Copy link
Contributor

@jkczyz jkczyz commented May 22, 2025

Instead of batching commitment_signed messages using a batch TLV, the splicing spec has been updated to introduce a start_batch messages. It used to indicate that the next batch_size messages for the channel_id should be treated as one logical message. Update commitment_signed message to contain the funding_txid instead of both that and a batch_size. Also, update PeerManager to batch accordingly instead of the previous custom approach.

@ldk-reviews-bot
Copy link

ldk-reviews-bot commented May 22, 2025

👋 Thanks for assigning @TheBlueMatt as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@jkczyz jkczyz requested a review from TheBlueMatt May 22, 2025 17:11
@wpaulino wpaulino requested review from wpaulino and removed request for TheBlueMatt May 22, 2025 17:40
@ldk-reviews-bot
Copy link

👋 The first review has been submitted!

Do you think this PR is ready for a second reviewer? If so, click here to assign a second reviewer.

@jkczyz jkczyz force-pushed the 2025-05-start-batch branch from b2d073f to 5110534 Compare May 23, 2025 21:39
@jkczyz
Copy link
Contributor Author

jkczyz commented May 23, 2025

Fixed some places where we disconnected but didn't send a warning (or disconnected when we should ignore and send a warning) according too the spec. Feels a little verbose, so let me know if there is some utility for this that I'm missing.

@jkczyz jkczyz requested a review from wpaulino May 23, 2025 21:41
@ldk-reviews-bot
Copy link

🔔 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.

@ldk-reviews-bot
Copy link

🔔 2nd 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.

Copy link
Contributor

@wpaulino wpaulino left a comment

Choose a reason for hiding this comment

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

Feel free to squash, CI is failing though. LGTM so far, we just have to wait for the message_type TLV to be amended to the spec.

jkczyz added 2 commits May 29, 2025 13:11
Instead of batching commitment_signed messages using a batch TLV, the
splicing spec has been updated to introduce a start_batch messages. It
used to indicate that the next batch_size messages for the channel_id
should be treated as one logical message. This commit simply adds the
message while the following commits will implement the handling logic.
Update commitment_signed message to contain the funding_txid instead of
both that and a batch_size. The spec was updated to batch messages using
start_batch, which contains the batch_size. This commit also updates
PeerManager to batch commitment_signed messages in this manner instead
of the previous custom approach.
@jkczyz jkczyz force-pushed the 2025-05-start-batch branch from 5110534 to c6d62c9 Compare May 29, 2025 18:17
@jkczyz
Copy link
Contributor Author

jkczyz commented May 29, 2025

Feel free to squash, CI is failing though. LGTM so far, we just have to wait for the message_type TLV to be amended to the spec.

Squashed. Fixed CI by running rustfmt on one file.

@wpaulino
Copy link
Contributor

Up to you, but we can probably drop b1abb5d once the optional message_type TLV is added.

@jkczyz jkczyz force-pushed the 2025-05-start-batch branch from c6d62c9 to f373238 Compare May 30, 2025 19:40
@jkczyz
Copy link
Contributor Author

jkczyz commented May 30, 2025

Up to you, but we can probably drop b1abb5d once the optional message_type TLV is added.

Added a fixup that uses the message_type TLV and drops MessageBatchImpl::Unknown -- along with the unreachables -- but otherwise kept the commit intact.

@wpaulino
Copy link
Contributor

wpaulino commented Jun 2, 2025

Good to squash

jkczyz added 2 commits June 2, 2025 14:57
While the spec only includes commitment_signed messages in batches,
there may be other types of batches in the future. Generalize the
message batching code to allow for other types in the future.
If a message in a commitment_signed batch does not contain a
funding_txid or has duplicates, the channel should be failed. Move this
check from PeerManager to FundedChannel such that this can be done.
@jkczyz jkczyz force-pushed the 2025-05-start-batch branch from f373238 to ebf0d4e Compare June 2, 2025 20:00
@jkczyz
Copy link
Contributor Author

jkczyz commented Jun 2, 2025

Squashed and fixed linter failures.

@jkczyz jkczyz requested a review from wpaulino June 2, 2025 20:47
@ldk-reviews-bot
Copy link

🔔 3rd 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.

@wpaulino wpaulino removed their request for review June 2, 2025 20:59
@wpaulino wpaulino requested a review from TheBlueMatt June 2, 2025 20:59
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.

3 participants