-
Notifications
You must be signed in to change notification settings - Fork 415
Hold times for successful payments #3801
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
base: main
Are you sure you want to change the base?
Conversation
👋 Thanks for assigning @valentinewallace as a reviewer! |
badc803
to
e913312
Compare
e913312
to
69a99b4
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3801 +/- ##
==========================================
- Coverage 88.82% 88.82% -0.01%
==========================================
Files 165 165
Lines 119075 119955 +880
Branches 119075 119955 +880
==========================================
+ Hits 105769 106550 +781
- Misses 10986 11101 +115
+ Partials 2320 2304 -16 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
69a99b4
to
1f56e04
Compare
bace463
to
1c64a50
Compare
233cbfc
to
f5668f5
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.
Still going through a first pass, made it to fcc1a8c
👋 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. |
df8ed65
to
5b219eb
Compare
First batch of comments addressed diff. Push below is just a rebase. |
5b219eb
to
d6985fd
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.
Finished a pass, will take another look tomorrow! Lot to take in here having not reviewed the previous PRs
|
||
// Create new attribution data as the final hop. Always report a zero hold time, because reporting a | ||
// non-zero value will not make a difference in the penalty that may be applied by the sender. | ||
let attribution_data = process_fulfill_attribution_data( |
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.
nit: to me a clearer name would be add_hold_time_from_fulfill
?
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.
I tried to keep the name somewhat in line with process_failure_packet
. In your suggestion, what does "from fulfill" mean exactly?
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.
Ah okay. Currently sounds to me like something the recipient would call when they receive the final update_fulfill_htlc
to extract the hold times. It's a pretty similar name to process_onion_success
atm.
what does "from fulfill" mean exactly?
Basically meant from_update_fulfill_htlc
. ISTM we're not really processing the attribution data, more like adding to it? I get wanting to be consistent with the other pre-existing method though.
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.
Of course "process" is the vaguest possible word. Now renamed process_onion_success
to decode_fulfill_attribution_data
. Not consistent with the existing failure case naming, but I think more descriptive within the scope of this PR.
let mut holding_cell_failures = | ||
holding_cell_htlc_updates.iter_mut().filter_map(|upd| { | ||
if let HTLCUpdateAwaitingACK::FailHTLC { | ||
holding_cell_htlc_updates.iter_mut().filter_map(|upd| match upd { |
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.
Honestly this ser code makes me nervous. Is it possible to test a round-trip ser with some failures and some claims, or extend an existing test around holding cell htlcs?
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.
The test do_channel_holding_cell_serialize
is hitting these two match arms. I don't see a simple round-trip test for FundedChannel
. Looked into it, but that would require a lot of instantiation of all the fields inside FundedChannel
. Let's discuss what the best move is here.
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.
Extended blinding_point_skimmed_fee_malformed_ser
with None and Some attribution_data.
d6985fd
to
5519b4c
Compare
lightning/src/ln/onion_utils.rs
Outdated
// Shift attribution data to prepare for processing the next hop. | ||
attribution_data.shift_left(); | ||
} else { | ||
log_debug!( |
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.
We hit this in a bunch of places in tests, should that be the case / why is that?
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.
I've looked at the tests that hit this and it looks to be a mix of onchain resolution (where there is no attribution data), and restart / data loss (where we also may not recover attribution data because it is not critical).
lightning/src/ln/onion_utils.rs
Outdated
route_hop_idx | ||
); | ||
|
||
break; |
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.
It seems like we'll return a subset of the hold times in this case? Would it be better to continue
and get the hold times that we can? I'm wondering if one node on the path can cause us to miss parsing some hold times here.
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.
It would only work in the specific case where an upstream node correctly shifted and encrypted and also didn't corrupt any of the received data, but added invalid hmacs. I think that would need to be a software bug? I thought it is not worth doing Option just for that. But open to different views.
let (_, path_events) = | ||
claim_payment_along_route(ClaimAlongRouteArgs::new(&nodes[0], route, preimage.unwrap())); | ||
|
||
// If we've delayed, check that this is reflected in the hold times. |
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.
Can we also check that the hold times are decreasing along the path?
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.
Added.
|
||
// Create new attribution data as the final hop. Always report a zero hold time, because reporting a | ||
// non-zero value will not make a difference in the penalty that may be applied by the sender. | ||
let attribution_data = process_fulfill_attribution_data( |
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.
Ah okay. Currently sounds to me like something the recipient would call when they receive the final update_fulfill_htlc
to extract the hold times. It's a pretty similar name to process_onion_success
atm.
what does "from fulfill" mean exactly?
Basically meant from_update_fulfill_htlc
. ISTM we're not really processing the attribution data, more like adding to it? I get wanting to be consistent with the other pre-existing method though.
Preparation for reuse of the logic.
Need to store AttributionData as part of the inbound HTLC removal reason so that it can be used in the upstream UpdateFulfillHTLC message.
Necessary to preserve attribution data when the HTLC is in the holding cell.
Adds hold time reporting for the final and intermediate nodes.
AttributionData is needed as part of the outbound HTLC outcome when revoke_and_ack has happened and the AttributionData is decoded to get the hold times for inclusion in the PaymentPathSuccessful event.
Prepare for inspecting hold times in PaymentPathSuccessful.
5519b4c
to
3aed96e
Compare
Comments addressed diff |
Hold times are surfaced via the PaymentPathSuccessful event.
3aed96e
to
b05cc65
Compare
🔔 1st Reminder Hey @valentinewallace @carlaKC! This PR has been waiting for your review. |
1 similar comment
🔔 1st Reminder Hey @valentinewallace @carlaKC! This PR has been waiting for your review. |
Apply the hold time reporting mechanism as implemented in #2256 to the success case. Spec in lightning/bolts#1044