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

Factor out protocol constants and value types into a zcash_protocol crate. #1142

Merged
merged 18 commits into from
Mar 6, 2024

Conversation

nuttycom
Copy link
Contributor

@nuttycom nuttycom commented Jan 27, 2024

This is best reviewed commit-by-commit.

Closes #1157.

Copy link

codecov bot commented Jan 27, 2024

Codecov Report

Attention: Patch coverage is 64.82558% with 121 lines in your changes are missing coverage. Please review.

Project coverage is 63.97%. Comparing base (0c12f31) to head (376db46).

Files Patch % Lines
components/zcash_protocol/src/value.rs 65.21% 48 Missing ⚠️
zcash_keys/src/keys.rs 24.24% 25 Missing ⚠️
components/zcash_protocol/src/consensus.rs 75.40% 15 Missing ⚠️
zcash_client_sqlite/src/wallet/init.rs 0.00% 7 Missing ⚠️
...src/wallet/init/migrations/receiving_key_scopes.rs 45.45% 6 Missing ⚠️
components/zcash_protocol/src/lib.rs 0.00% 4 Missing ⚠️
zcash_client_sqlite/src/error.rs 0.00% 4 Missing ⚠️
zcash_keys/src/address.rs 66.66% 4 Missing ⚠️
components/zcash_address/src/encoding.rs 90.90% 2 Missing ⚠️
zcash_client_backend/src/fees/sapling.rs 0.00% 2 Missing ⚠️
... and 3 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1142      +/-   ##
==========================================
- Coverage   64.33%   63.97%   -0.36%     
==========================================
  Files         115      115              
  Lines       11872    11895      +23     
==========================================
- Hits         7638     7610      -28     
- Misses       4234     4285      +51     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nuttycom nuttycom force-pushed the crate_zcash_protocol branch 2 times, most recently from ccfd94a to f9a900e Compare February 2, 2024 18:12
@nuttycom nuttycom force-pushed the crate_zcash_protocol branch 3 times, most recently from 3abc70e to 1264182 Compare February 2, 2024 21:42
@nuttycom nuttycom marked this pull request as draft February 3, 2024 00:28
@nuttycom nuttycom force-pushed the crate_zcash_protocol branch 5 times, most recently from bd33550 to 234522f Compare February 5, 2024 20:00
@nuttycom nuttycom marked this pull request as ready for review February 5, 2024 20:05
@nuttycom nuttycom force-pushed the crate_zcash_protocol branch 5 times, most recently from e387ae2 to 01fd657 Compare February 7, 2024 19:05
@nuttycom nuttycom added this to the Librustzcash Zashi 1.0 milestone Feb 22, 2024
@nuttycom nuttycom added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. S-in-progress Status: Work is currently in progress on this item. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 27, 2024
Co-authored-by: Daira-Emma Hopwood <[email protected]>
Copy link
Contributor

@daira daira left a comment

Choose a reason for hiding this comment

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

Flushing comments.

zcash_client_backend/src/zip321.rs Outdated Show resolved Hide resolved
zcash_client_backend/src/zip321.rs Show resolved Hide resolved
"Unable to parse raw transaction: {:?}",
e
))
})?;
let output = tx
.sapling_bundle()
.and_then(|b| b.shielded_outputs().get(output_index))
Copy link
Contributor

Choose a reason for hiding this comment

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

Should the panic just below also be a WalletMigrationError::CorruptedData return?

Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: we sometimes use "string literal".to_owned(), and sometimes "string literal".to_string(). They do the same thing, but let's be consistent and use to_owned().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are so totally inconsistent about this that fixing it should be done outside of this PR; I find 70 different occurrences of .to_string all across the codebase.

@@ -111,7 +109,7 @@ impl<P: consensus::Parameters> RusqliteMigration for Migration<P> {
"Address field value decoded to a transparent address; should have been Sapling or unified.".to_string()));
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"Address field value decoded to a transparent address; should have been Sapling or unified.".to_string()));
"Address field value decoded to a transparent address; should have been Sapling or unified.".to_owned()));

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These two are semantically identical.

self.to_unified_full_viewing_key().default_address(request)
self.to_unified_full_viewing_key()
.default_address(request)
.unwrap()
Copy link
Contributor

Choose a reason for hiding this comment

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

This should probably be .expect(...).

daira
daira previously approved these changes Mar 6, 2024
Copy link
Contributor

@daira daira left a comment

Choose a reason for hiding this comment

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

utACK modulo comments.

Copy link
Contributor

@str4d str4d left a comment

Choose a reason for hiding this comment

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

Re-utACK 376db46

@str4d str4d merged commit 16e3d1b into zcash:main Mar 6, 2024
23 of 24 checks passed
@nuttycom nuttycom deleted the crate_zcash_protocol branch March 6, 2024 14:48
Copy link
Contributor

@daira daira left a comment

Choose a reason for hiding this comment

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

Post-hoc re-ACK 376db46

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
3 participants