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

[zk-sdk] Add errors, macros, and encryption modules #1019

Merged
merged 4 commits into from
Apr 26, 2024

Conversation

samkim-crypto
Copy link

@samkim-crypto samkim-crypto commented Apr 24, 2024

Summary of Changes

This is a follow-up to #988, which migrates the errors, macros, and encryption modules from zk-token-sdk into zk-sdk. The only additional change to these modules is that the deprecated functions are now removed.

Since the encryption module is largely the same in zk-token-sdk and zk-sdk, we can consider removing and re-exporting the functions/types in zk-token-sdk to the ones in zk-sdk. Since zk-token-sdk will not get any updates and then eventually be removed, I thought I would just leave it as is. We can consider re-exporting in a follow-up.

Fixes #

@samkim-crypto samkim-crypto marked this pull request as ready for review April 24, 2024 08:26
@samkim-crypto samkim-crypto requested review from a team as code owners April 24, 2024 08:26
@codecov-commenter
Copy link

codecov-commenter commented Apr 24, 2024

Codecov Report

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

Project coverage is 82.1%. Comparing base (4672efa) to head (78ae72f).
Report is 21 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##           master    #1019     +/-   ##
=========================================
+ Coverage    81.9%    82.1%   +0.1%     
=========================================
  Files         857      864      +7     
  Lines      232441   233160    +719     
=========================================
+ Hits       190583   191432    +849     
+ Misses      41858    41728    -130     

@samkim-crypto samkim-crypto requested a review from joncinque April 24, 2024 20:15
joncinque
joncinque previously approved these changes Apr 25, 2024
Copy link

@joncinque joncinque 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! Just the one question

zk-sdk/src/macros.rs Outdated Show resolved Hide resolved
@samkim-crypto
Copy link
Author

I also realized that everything in the macros module is only required by the elgamal and pedersen, so I moved it inside encryption as well. I think this makes the crate organization a lot cleaner!

Copy link

@joncinque joncinque left a comment

Choose a reason for hiding this comment

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

One last little thing, which you can do separately, looks good otherwise!

@@ -10,6 +10,9 @@
//! - Basic type-wrapper around the AES-GCM-SIV symmetric authenticated encryption scheme
//! implemented by [aes-gcm-siv](https://docs.rs/aes-gcm-siv/latest/aes_gcm_siv/) crate.

#[cfg(not(target_os = "solana"))]
#[macro_use]

Choose a reason for hiding this comment

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

Sorry, looking through this again, I don't think you need #[macro_use] either

Copy link
Author

Choose a reason for hiding this comment

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

Oh oops, yeah I guess this is only required by old rust. Thanks! I will removed on a follow-up.

Copy link
Author

Choose a reason for hiding this comment

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

Hm, actually it seems like if I removed this macro_use then the macros seem to be not accessible to other crates. Reading a bit on the macro_use attribute, it seems like this is required here?

Choose a reason for hiding this comment

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

Ah ok, I thought the macros were only used internally. no worries then!

@samkim-crypto samkim-crypto merged commit 18dc436 into anza-xyz:master Apr 26, 2024
49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants