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(diagnostics): Hex-encode debug format of commitments, nonces, and nullifiers #5960

Merged
merged 5 commits into from
Jan 17, 2023

Conversation

teor2345
Copy link
Contributor

@teor2345 teor2345 commented Jan 16, 2023

Motivation

Zebra's debug output shows block header commitments and nonces as an array of integers, rather than hexadecimal. This makes them very hard to debug.

This diagnostics bug is impacting RPC testing.

Most of the changes in this PR are in test code, or they are tiny changes to existing code.

Solution

  • Create a HexDebug type wrapper, which automatically makes the wrapped type encode as hex during derive(Debug)
  • Apply the wrapper to the block header commitments and nonce
  • Apply the wrapper to Sprout nullifiers and commitments
  • Apply the wrapper to Sapling nullifiers
  • Apply the wrapper to Orchard redpallas keys

I also opened ticket ZcashFoundation/redjubjub#155 to make similar changes in redjubjub.

Review

This is blocking RPC testing, it is important to review soon.

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 C-bug Category: This is a bug A-rust Area: Updates to Rust code P-High 🔥 A-diagnostics Area: Diagnosing issues or monitoring performance labels Jan 16, 2023
@teor2345 teor2345 requested a review from a team as a code owner January 16, 2023 00:18
@teor2345 teor2345 self-assigned this Jan 16, 2023
@teor2345 teor2345 requested review from oxarbitrage and removed request for a team January 16, 2023 00:18
@teor2345 teor2345 requested a review from a team as a code owner January 16, 2023 01:23
@teor2345 teor2345 requested review from dconnolly and removed request for a team January 16, 2023 01:23
@teor2345 teor2345 changed the title fix(diagnostics): Format commitments and nonces as hex fix(diagnostics): Format commitments, nonces, and nullifiers as hex Jan 16, 2023
@teor2345 teor2345 force-pushed the hex-debug branch 2 times, most recently from 76c8377 to 432b680 Compare January 16, 2023 02:35
@teor2345
Copy link
Contributor Author

Looks like crates.io is having some network or capacity issues, I'll retry those parts of CI later. (Or anyone can do it if I'm not around.)

@codecov
Copy link

codecov bot commented Jan 16, 2023

Codecov Report

Merging #5960 (c6bbe69) into main (1bb8a9c) will decrease coverage by 0.08%.
The diff coverage is 46.60%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5960      +/-   ##
==========================================
- Coverage   78.11%   78.03%   -0.09%     
==========================================
  Files         312      312              
  Lines       38936    38988      +52     
==========================================
+ Hits        30414    30423       +9     
- Misses       8522     8565      +43     

@arya2 arya2 changed the title fix(diagnostics): Format commitments, nonces, and nullifiers as hex fix(diagnostics): Hex-encode debug format of commitments, nonces, and nullifiers Jan 16, 2023
arya2
arya2 previously approved these changes Jan 16, 2023
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.

Looks good!

@teor2345
Copy link
Contributor Author

@Mergifyio refresh

@teor2345
Copy link
Contributor Author

@mergify
Copy link
Contributor

mergify bot commented Jan 17, 2023

refresh

✅ Pull request refreshed

mergify bot added a commit that referenced this pull request Jan 17, 2023
@teor2345
Copy link
Contributor Author

It looks like this has a build conflict with some code in other PRs, I'll see what I can do to fix it.

@teor2345
Copy link
Contributor Author

This needs a quick re-approval.

I added commit 0912da3 to make it build with the latest main branch, which gets reverted straight away in PR #5944 and replaced with a different fix.

@mergify mergify bot merged commit 8c45196 into main Jan 17, 2023
@mergify mergify bot deleted the hex-debug branch January 17, 2023 13:57
@oxarbitrage oxarbitrage mentioned this pull request Jan 30, 2023
36 tasks
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-rust Area: Updates to Rust code C-bug Category: This is a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants