rust-lightning icon indicating copy to clipboard operation
rust-lightning copied to clipboard

Enforce Trampoline Constraints (replacement)

Open carlaKC opened this issue 3 weeks ago • 4 comments

This PR replaces #3983, adding validation of trampoline onions (as compared to the outer onion). It makes some quite significant changes to the tests in the original PR to consolidate blinded and unblinded tests for success/failure scenarios into a single helper (apologies to reviewers who've already looked at the tests, but I think this DRYs it up quite nicely).

While we're here, it also moves rustfmt::skip to a per-function level on blinded_payment_tests.rs and formats the existing test helper that we're modifying in a pre-factor so that the new code can be formatted.

carlaKC avatar Nov 17 '25 18:11 carlaKC

👋 Thanks for assigning @tankyleo 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.

ldk-reviews-bot avatar Nov 17 '25 18:11 ldk-reviews-bot

Assigning reviewers who looked at the original PR - please free yourself if not appropriate!

carlaKC avatar Nov 17 '25 18:11 carlaKC

Codecov Report

:x: Patch coverage is 92.33129% with 25 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 89.32%. Comparing base (6d9c676) to head (785c781). :warning: Report is 17 commits behind head on main.

Files with missing lines Patch % Lines
lightning/src/ln/onion_payment.rs 70.00% 15 Missing :warning:
lightning/src/ln/onion_utils.rs 0.00% 6 Missing :warning:
lightning/src/ln/blinded_payment_tests.rs 98.47% 3 Missing and 1 partial :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4226      +/-   ##
==========================================
- Coverage   89.32%   89.32%   -0.01%     
==========================================
  Files         180      180              
  Lines      138641   138916     +275     
  Branches   138641   138916     +275     
==========================================
+ Hits       123844   124088     +244     
- Misses      12174    12205      +31     
  Partials     2623     2623              
Flag Coverage Δ
fuzzing 34.97% <0.00%> (-1.01%) :arrow_down:
tests 88.69% <92.33%> (+<0.01%) :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.

codecov[bot] avatar Nov 17 '25 19:11 codecov[bot]

One thing to note about the tests here: we've currently only got coverage for blinded receives checking the constraints (this is what the original PR had). We could also add coverage for blinded forwards in the failure case (can't do for success because we just fail the forwards rn), which would make codecov a bit happier.

I think this is worth doing, but it would mean adding a bit more code to the mega test helper - interested on hearing thoughts on how readable others find it before adding another layer to an already quite dense test! Can also easily be a small follow. up.

carlaKC avatar Nov 17 '25 21:11 carlaKC

Needs rebase :(

I did find the new testing not ideal from a readability PoV at first glance, going to take a closer look in a bit but let me know if you see any obvious ways to improve things. It may be that the nature of what we're testing makes it hard to improve things though.

valentinewallace avatar Nov 18 '25 19:11 valentinewallace

🔔 1st Reminder

Hey @tankyleo! 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 avatar Nov 19 '25 18:11 ldk-reviews-bot

Rebased + addressed review in fixups, removing validation of trampoline forwards because we'll need a different check/error there anyway.

carlaKC avatar Nov 20 '25 13:11 carlaKC

🔔 2nd Reminder

Hey @tankyleo! 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 avatar Nov 22 '25 00:11 ldk-reviews-bot

🔔 3rd Reminder

Hey @tankyleo! 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 avatar Nov 24 '25 00:11 ldk-reviews-bot

Addressed last two nits directly on commit, diff here.

carlaKC avatar Nov 25 '25 13:11 carlaKC

🔔 1st Reminder

Hey @valentinewallace! 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 avatar Nov 27 '25 03:11 ldk-reviews-bot

🔔 2nd Reminder

Hey @valentinewallace! 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 avatar Nov 29 '25 03:11 ldk-reviews-bot

🔔 3rd Reminder

Hey @valentinewallace! 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 avatar Dec 01 '25 03:12 ldk-reviews-bot