-
Notifications
You must be signed in to change notification settings - Fork 105
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
Improve VerifyBlockError::Commit typing, so we don't accidentally break syncer error handling #2908
Comments
Hey team! Please add your planning poker estimate with ZenHub @conradoplg @dconnolly @jvff @oxarbitrage @teor2345 @upbqdn |
We're de-prioritizing network changes, and network-related changes. |
This is needed to do #5487 |
I added this as a TODO in the source code, so we can do it if we are rewriting that code for other reasons. |
@arya2 just checking that this isn't an audit issue? @mpguerra we've tried to do this a few times and it's been tricky due to Rust language limitations. Some of those might have been fixed recently, but I still think we should time-box this task to 1 day in total. (And maybe one or two reviews.) This code is also hard to test, it's only really tested by our integration tests. (And not all our errors are covered by those tests.) So it will need careful review or extra unit tests to avoid introducing new panics. |
We haven't scheduled this work yet and I think it can probably wait for discussion until our next gardening sync. I'll add it to the agenda. |
Nothing in this issue has been brought up in the audit so far. |
@daira may want to take this one on. |
Motivation
VerifyBlockError::Commit
is a wrapper over aBoxError
. However, in #2890 a check was added in theshould_restart_sync
function to ignoreCommit
errors corresponding to"block is already committed to the state"
when deciding whether to reset the sync procedure. That check is fragile since it will break if the string changes.Change
Commit
to wrap a specific error type enumeration, and create a specific item for that particular error to be used for matching and filtering it inshould_restart_sync
.Currently, this check is implemented by the
is_duplicate_request()
method, which can't useCommit
because it is aBoxError
.There's also a
BlockDownloadVerifyError::Invalid
error that comes from the chain verifier and aBlockDownloadVerifyError::DownloadFailed
from the network service.We should downcast all
BoxError
s in the syncer'sBlockDownloadVerifyError
to concrete types and add them to the match statement inshould_restart_sync()
:zebra/zebrad/src/components/sync.rs
Line 1088 in 0152c86
zebra/zebrad/src/components/sync.rs
Lines 1155 to 1163 in 0152c86
Specifications
Designs
Related Work
Follow up to #2890
The text was updated successfully, but these errors were encountered: