-
Notifications
You must be signed in to change notification settings - Fork 323
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
Relay pending packets in the relayer loop #709
Conversation
Codecov Report
@@ Coverage Diff @@
## master #709 +/- ##
=========================================
+ Coverage 13.6% 43.8% +30.2%
=========================================
Files 69 150 +81
Lines 3752 9821 +6069
Branches 1374 0 -1374
=========================================
+ Hits 513 4309 +3796
- Misses 2618 5512 +2894
+ Partials 621 0 -621
Continue to review full report at Codecov.
|
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.
Wow, that's much less code than I thought it would take :)
Left a suggestion inline, but feel free to ignore.
fn relay_from_events(&mut self) -> Result<(), LinkError> { | ||
fn relay_pending_packets(&mut self) -> Result<(), LinkError> { | ||
println!("clearing old packets on {:#?}", self.channel); | ||
for _i in 0..MAX_ITER { |
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.
More general question, which does not be addressed in this PR: would it be sensible to introduce a delay or even implement some kind of exponential backoff strategy when retrying an operation which has failed (in this case, relaying the pending packets)?
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.
Yeh, we've been avoiding the whole error handling for some time. We have this pattern everywhere! We blindly retry in a loop for all errors. We need to sit down and see how to deal with each error. We have RPC, light client, on-chain and internal errors. The most complex ones are the on-chain errors that are a bit more subtle (leaving aside errors in the relayer code) and also they are not typed (we just get an error message and the reason is embedded in a string). The retry with exponential backoff may apply for some cases, in some cases we should not retry (e.g. a transaction has already been submitted by another relayer), in other cases we should rebuild stuff, etc. I think we should start a little doc and try to cover all errors and what actions we should take.
Because the problem is so broad I would leave this handling here for later.
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.
Opened #712 for error handling.
Co-authored-by: Romain Ruetschi <romain@informal.systems>
* Added relaying of pending packets in the relayer loop * Apply Romain's suggestion * Cargo.lock Co-authored-by: Romain Ruetschi <romain@informal.systems>
Closes: #561
Description
relay_pending_packets()
that queries the chains for the unreceived packets and acks, builds and sends transactions. This function uses the exact methods used by the corresponding CLIs. It adds a retry around these.relay_from_events()
to perform relaying of pending packets after events subscription but before the first event is processed. The height for queries and client updates must be the height of the first event minus one.For contributor use:
docs/
) and code comments.Files changed
in the Github PR explorer.