Skip to content
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

Clarify CheckpointVerifier errors #1260

Merged
merged 1 commit into from
Nov 6, 2020

Conversation

teor2345
Copy link
Contributor

@teor2345 teor2345 commented Nov 6, 2020

Motivation

I can't diagnose the repeated Duplicate errors from the CheckpointVerifier (#1259), because the error names and messages are ambiguous, the same error is used in multiple unrelated places, and the errors don't contain enough context.

Solution

Improve the CheckpointVerifier errors:

  • rename some errors to be more specific
  • reword some error messages
  • add context to some errors
  • turn an unreachable error into unreachable!

The code in this pull request has:

  • Documentation Comments - minor modifications to existing error handling code
  • Unit Tests and Property Tests - minor modifications to existing error handling code

Review

I'd like @yaahc to review this change, because she knows a lot about error handling.
This change is urgent, because it's blocking the tests for the difficulty PR #1256.

I'd like @hdevalence to be aware of these changes, because he is fixing the Duplicate errors in #1259.

Related Issues

This PR contains diagnostics for the Duplicate errors bug #1259.
Bug #1259 blocks the tests for the difficulty fix PR #1256.

Follow Up Work

Once #1259 is fixed, we'll probably want to reduce the AlreadyVerified info log to a trace. I'll make a note on the sync tracking issue.

And make an unreachable error into a panic.
@teor2345 teor2345 added A-rust Area: Updates to Rust code C-cleanup Category: This is a cleanup labels Nov 6, 2020
@teor2345 teor2345 added this to the First Alpha Release milestone Nov 6, 2020
@teor2345 teor2345 requested a review from yaahc November 6, 2020 03:49
@teor2345 teor2345 self-assigned this Nov 6, 2020
Copy link
Contributor

@yaahc yaahc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks perfect.

In the future I hope to deduplicate some of this information. A lot of these errors are grabbing the height and hash which I think might be better associated with a tracing::span that all of these errors are captured in the context of. For now though we cannot easily work with TracedErrors here because the fn to map the inner error type hasn't been released yet. Once the newer version of tracing comes out though I think it might be good to introduce TracedError alongside most of our error types and do our best to leverage spans for contextual runtime data.

@yaahc yaahc merged commit f90a749 into ZcashFoundation:main Nov 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rust Area: Updates to Rust code C-cleanup Category: This is a cleanup
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants