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

fix(rpc): Return detailed errors to the RPC client when a block proposal fails #5993

Merged
merged 2 commits into from
Jan 19, 2023

Conversation

teor2345
Copy link
Contributor

Motivation

We are currently testing Zebra's block templates in ticket #5803. But I can't work out if Zebra's errors are expected or the same as zcashd, because it doesn't return any error information at all.

This PR changes the error handling from bug #5981, it probably gets us closer to a fix.
(But to match zcashd we'd need to stop pretty printing, and change the format of the error string.)

Specifications

We can do whatever we like here, because bug #5981 will fix up any mining pool compatibility issues.

Solution

  • Send the RPC client the kind of error, and the detailed error debug information

Review

This seems like a high priority because testing is difficult without it.

Reviewer Checklist

  • Will the PR name make sense to users?
    • Does it need extra CHANGELOG info? (new features, breaking changes, large changes)
  • Are the PR labels correct?
  • Does the code do what the ticket and PR says?
    • Does it change concurrent code, unsafe code, or consensus rules?
  • How do you know it works? Does it have tests?

@teor2345 teor2345 added P-High 🔥 A-diagnostics Area: Diagnosing issues or monitoring performance C-testing Category: These are tests A-rpc Area: Remote Procedure Call interfaces labels Jan 18, 2023
@teor2345 teor2345 requested a review from a team as a code owner January 18, 2023 03:41
@teor2345 teor2345 self-assigned this Jan 18, 2023
@teor2345 teor2345 requested review from arya2 and removed request for a team January 18, 2023 03:41
@github-actions github-actions bot added the C-bug Category: This is a bug label Jan 18, 2023
@teor2345
Copy link
Contributor Author

I tested this PR with zcash-rpc-block-template-to-proposal.

I now see detailed errors like:

invalid proposal: Block {
    source: ValidateProposal(
        "proposal is not based on the current best chain tip: previous block hash must be the best chain tip",
    ),
}

Rather than the same error every time:

{
  "reject_reason": "rejected",
  "capabilities": [
    "proposal"
  ]
}

@codecov
Copy link

codecov bot commented Jan 18, 2023

Codecov Report

Merging #5993 (fde6d52) into main (256b1c0) will increase coverage by 0.04%.
The diff coverage is 0.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5993      +/-   ##
==========================================
+ Coverage   77.94%   77.98%   +0.04%     
==========================================
  Files         312      312              
  Lines       38987    38995       +8     
==========================================
+ Hits        30387    30410      +23     
+ Misses       8600     8585      -15     

Copy link
Contributor

@arya2 arya2 left a comment

Choose a reason for hiding this comment

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

This looks great!

Only change needed is an updated reference in the acceptance test for the renamed ErrorResponse.

@teor2345 teor2345 requested a review from arya2 January 19, 2023 02:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Diagnosing issues or monitoring performance A-rpc Area: Remote Procedure Call interfaces C-bug Category: This is a bug C-testing Category: These are tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants