-
Notifications
You must be signed in to change notification settings - Fork 113
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
cleanup(cryptography): Remove unused shielded key and address code #5476
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #5476 +/- ##
==========================================
- Coverage 79.32% 79.25% -0.07%
==========================================
Files 309 305 -4
Lines 39348 37873 -1475
==========================================
- Hits 31211 30016 -1195
+ Misses 8137 7857 -280 |
I found this extra bug: |
8d73fb5
to
7058bb3
Compare
a92a3e9
to
d42d443
Compare
Actually, I think I might be able to remove some of the broken Orchard code here. |
I worked out why it's tricky with Orchard - we need most of the key types to generate valid random Orchard addresses for tests. So I'm going to move the keys that aren't used in production into a test module, and add a note about what needs to be done to the code to make it production-quality. (We're not getting test code audited, so that achieves the goals of the ticket.) I might not get to finish it all today. |
d702880
to
37601b4
Compare
Ok, I think I'm done here. See the PR description for a summary of these changes, it's almost all removed code. |
This seems to be done. @conradoplg or @dconnolly , can you please approve if that is the case ? Thank you. |
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.
lgtm
If we do wallet work / scanning work in the future we can dig the sapling/orchard stuff out of the history and fix it up, if needed
…5476) * Remove unused and buggy Sprout key and address code * Remove unused, buggy Sapling address, key, and commitment code * Delete unused Orchard key code * Move almost all the buggy Orchard key code into a test-only module * Remove Orchard keys and addresses that aren't used in production code * Remove unused prf_expand() function and unimplemented poseidon_hash() function * Remove unused Orchard key types * Remove unused sinsemilla commit code * Update zebra-chain/src/sprout/keys.rs * Update zebra-chain/src/sprout/keys.rs Co-authored-by: Deirdre Connolly <[email protected]>
Motivation
We want to remove unused shielded key and address code before the audit, because it contains known bugs that break consensus rules.
We also want to remove all the code that is impacted by these known bugs:
unwrap_used
lint #4732Close #5446
Close #4691
Close #2496
Close #2041
Solution
This PR removes 3000 lines of unused cryptographic code:
As a consequence, it removes:
It also makes Zebra's code easier to review and audit, because some of the removed types had the same name as the types from the ECC crates.
Review
Anyone can review this PR, it's a high priority because it's needed for the audit.
Reviewer Checklist