-
Notifications
You must be signed in to change notification settings - Fork 404
Ignore Duplicate Gossip Error while updating networkGraph from RGS #1764
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
Conversation
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.
should we try to add a test?
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.
LGTM, mod the possibly pending test case.
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.
Yes, please add test.
Yes, |
@arik-so generated the bytes from his server, IIUC. https://github.com/lightningdevkit/rapid-gossip-sync-server Not positive if anything can be reused from there. Ideally, we'd have an interface for building this data for testing instead of using byte arrays. Would make the tests more readable and modifiable, at very least. |
c48760c
to
ef6b23d
Compare
Codecov ReportBase: 90.80% // Head: 90.78% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #1764 +/- ##
==========================================
- Coverage 90.80% 90.78% -0.02%
==========================================
Files 87 87
Lines 46969 46987 +18
Branches 46969 46987 +18
==========================================
+ Hits 42648 42655 +7
- Misses 4321 4332 +11
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
ef6b23d
to
082d043
Compare
4c5bd9b
to
96d04ae
Compare
@@ -435,6 +439,50 @@ mod tests { | |||
assert!(after.contains("783241506229452801")); | |||
} | |||
|
|||
#[test] | |||
fn update_succeeds_when_duplicate_gossip_update_from_server() { |
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.
with duplicate gossip
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.
given-when-then-should is general unit-test naming convention, we don't follow it as such.
but it was derived from that. happy to change if you 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.
if the grammar worked with when/then, sure, but in its current configuration it doesn't, and making it so would be very verbose
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.
alternatively, update_succeeds_when_duplicate_gossip_is_applied
96d04ae
to
7c30a18
Compare
Hmm, I think we also need to make sure gossip doesn't fail if we hit the neighboring case: |
I will change that to IgnoreDuplicateGossip, |
7c30a18
to
dadb1d3
Compare
dadb1d3
to
51ee152
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.
FYI, I'd avoid linking to PR or issues's in commit messages. Otherwise, it will get an update every time you force push.
Also, please expand the commit message with rationale as it should be understandable independent of github. |
While applying gossip info from RGS-server, number of harmless errors might arise which should be ignored. E.g. client should not fail if there is a duplicate gossip for same channel or duplicate update.
51ee152
to
7f089df
Compare
match network_graph.update_channel_unsigned(&synthetic_update) { | ||
Ok(_) => {}, | ||
Err(LightningError { action: ErrorAction::IgnoreDuplicateGossip, .. }) => {}, | ||
Err(LightningError { action: ErrorAction::IgnoreAndLog(_), .. }) => {}, |
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 starts ignoring errors like channel_update is older than two weeks old
which we probably don't want to ignore - that indicates the RGS data is bunk.
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.
Hm, but couldn't a similar argument be made for the whole PR: that the dataset is probably bunk when we receive a duplicate update in the first place? So why ignore one but not the other error indicating "something is wrong with this 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.
No, you can get updates from payment failures (or p2p gossip sync, if you're doing both), so its totally reasonable to have an update out-of-band from some source other than RGS.
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 still think on client side we should ignore those errors.
"There is something wrong with this server update" => "we should ignore and not fail client side"
Server-side should be responsible for its own correctness and should have its own checks in place.
IIUC, ignoring the update leaves the network graph still functional instead of erroring out and stopping on some mistake from server. (potentially out-of-date is better than errors until server fixes the potential bug)
And the way rgs currently works with latest_seen_timestamp and backdate_timestamp, it makes sense to ignore the noisy updates ?
#1785 => As of now, RGS-client doesn't accept stale-update, it ignores the stale-update.
#1784 => As of now, RGS-client ignores the update for channel which doesn't exist and does not fail.
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.
Because all of the RGS updates get applied with the same timestamps there's nothing to apply, they'll all fail. I'd much rather fail and get that feedback than just silently continue. For example if someone hosts their own server and it starts failing best to give them errors rather than hope they have monitoring in place.
As for 1784, what an I reading wrong? The code snippet I copied into the issue seems to be to be returning an error if a channel is missing. I don't see any other code to ignore such cases.
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.
"get that feedback than just silently continue" -> does debug logging with outdated network graph as feedback work? or we want to surface errors to users?
1784 -> Clarifying, i meant after this PR, we are catching and ignoring "IgnoreError" as well right? and it won't fail.
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.
"get that feedback than just silently continue" -> does debug logging with outdated network graph as feedback work? or we want to surface errors to users?
Hmm, I'd imagine we'd want to surface an error, but if we want to avoid punishing users for the server being poorly monitored I'd be okay with debug logging too.
1784 -> Clarifying, i meant after this PR, we are catching and ignoring "IgnoreError" as well right? and it won't fail.
Ah, sorry for the confusion, no that error is in lightning-rapid-gossip-sync/src/processing.rs
, ie it is not ignored, because we generate it locally.
Fixes #1746