-
Notifications
You must be signed in to change notification settings - Fork 384
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
Log cases where an onion failure cannot be attributed or interpreted #3629
base: main
Are you sure you want to change the base?
Log cases where an onion failure cannot be attributed or interpreted #3629
Conversation
Ok(p) => p, | ||
Err(_) => return, | ||
}; | ||
let decrypt_result = decrypt_onion_error_packet(&mut encrypted_packet, shared_secret); |
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.
Check hmac first to distinguish between unreadable failures and hmac mismatches.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3629 +/- ##
========================================
Coverage 89.16% 89.17%
========================================
Files 152 152
Lines 118791 118947 +156
Branches 118791 118947 +156
========================================
+ Hits 105921 106068 +147
- Misses 10312 10316 +4
- Partials 2558 2563 +5 ☔ View full report in Codecov by Sentry. |
Coverage reports suggests more test coverage needed... |
56b0aa7
to
70c8e56
Compare
is_permanent: true, | ||
}); | ||
let short_channel_id = Some(route_hop.short_channel_id); | ||
res = Some(FailureLearnings { |
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.
This is a bug fix. Previously unreadable failures weren't attributable even though the hmac checked out.
70c8e56
to
47caa1e
Compare
fn build_test_path() -> Path { | ||
Path { | ||
hops: vec![ | ||
RouteHop { |
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.
rustfmt wanted this
.unwrap(), | ||
channel_features: ChannelFeatures::empty(), | ||
node_features: NodeFeatures::empty(), | ||
short_channel_id: 1, |
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 is a move, but just these short_channel_id's made unique to make it easier to test things for attr errors
Tests added |
1d40811
to
cdda315
Compare
Create more visibility into these edge cases. The non-attributable failure in particular can be used to disrupt sender operation and it is therefore good to at least log these cases clearly.
This commit fixes a bug where a node penalty was not applied where it should.
cdda315
to
fc11fe4
Compare
} | ||
|
||
fn test_failure_attribution(packet: &[u8]) -> DecodedOnionFailure { | ||
let logger: Arc<TestLogger> = Arc::new(TestLogger::new()); |
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 dunno if you wanna bother, but note that the TestLogger
does allow you to inspect the things which were logged so you could check if the new logs were hit (though in general we try to avoid test-by-log-inspection where possible because they're just annoying to update when logs change and they tend to be more brittle...but for a unit test its more fine than a functional one).
|
||
let network_update = Some(NetworkUpdate::NodeFailure { | ||
node_id: route_hop.pubkey, | ||
is_permanent: true, |
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.
IIRC is_permanent
NodeFailure
s result in removing the node from the graph entirely, which seems a bit harsh, I think?
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 same was already done for a missing failure code, so it seemed reasonable to apply the same penalty for the more severe case where the message cannot even be decoded?
Create more visibility into these edge cases. The non-attributable failure in particular can be used to disrupt sender operation and it is therefore good to at least log these cases clearly.
Additionally a bug is fixed where an unreadable failure with valid hmac wasn't properly attributed to a node.