-
Notifications
You must be signed in to change notification settings - Fork 0
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
Shamir Secret Sharing refactor #8
Conversation
WalkthroughThe project has undergone significant enhancements, incorporating a new verifiable secret sharing scheme, optimizing dependency management across the workspace, and refining cryptographic functionalities. These changes streamline the development process, enhance security features, and improve the mathematical foundations of the project, particularly in secret sharing and polynomial operations. Changes
Recent Review StatusConfiguration used: CodeRabbit UI Files selected for processing (1)
Additional comments not posted (3)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Actionable comments posted: 0
Review Status
Configuration used: CodeRabbit UI
Files selected for processing (7)
- Cargo.toml (1 hunks)
- [Fel87]feldman-verifiable-secret-sharing/Cargo.toml (1 hunks)
- [Fel87]feldman-verifiable-secret-sharing/src/lib.rs (1 hunks)
- [Sha97]shamir-secret-sharing/Cargo.toml (1 hunks)
- halo2-trials/Cargo.toml (1 hunks)
- polynomial/Cargo.toml (1 hunks)
- univariate-polynomial-iop-zerotest/Cargo.toml (1 hunks)
Files skipped from review due to trivial changes (2)
- halo2-trials/Cargo.toml
- univariate-polynomial-iop-zerotest/Cargo.toml
Additional comments not posted (4)
polynomial/Cargo.toml (1)
7-8
: Ensurenum-traits
andnalgebra
are declared in the workspace'sCargo.toml
to avoid build issues.[Fel87]feldman-verifiable-secret-sharing/Cargo.toml (1)
1-9
: Ensurerand
andrand_chacha
are declared in the workspace'sCargo.toml
to avoid build issues.Cargo.toml (1)
6-27
: Ensure that the versions of the newly added workspace dependencies are compatible with the project's requirements.[Fel87]feldman-verifiable-secret-sharing/src/lib.rs (1)
1-53
: Consider using integer arithmetic or a library designed for cryptographic operations instead off64
to avoid precision issues and enhance security.
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.
Actionable comments posted: 0
Review Status
Configuration used: CodeRabbit UI
Files selected for processing (6)
- Cargo.toml (1 hunks)
- [Fel87]feldman-verifiable-secret-sharing/Cargo.toml (1 hunks)
- [Sha97]shamir-secret-sharing/Cargo.toml (1 hunks)
- halo2-trials/Cargo.toml (1 hunks)
- polynomial/Cargo.toml (1 hunks)
- univariate-polynomial-iop-zerotest/Cargo.toml (1 hunks)
Files skipped from review as they are similar to previous changes (5)
- Cargo.toml
- [Fel87]feldman-verifiable-secret-sharing/Cargo.toml
- halo2-trials/Cargo.toml
- polynomial/Cargo.toml
- univariate-polynomial-iop-zerotest/Cargo.toml
Additional comments not posted (1)
[Sha97]shamir-secret-sharing/Cargo.toml (1)
7-9
: The changes to use workspace dependencies forrand
andrand_chacha
align well with the PR's objectives to streamline dependency management and ensure consistency across the project. This is a good practice in Rust workspaces, especially for projects focusing on cryptographic protocols. The use of a path dependency forpolynomial
indicates it's a closely related package within the same workspace, which is appropriate.
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.
Actionable comments posted: 1
Review Status
Configuration used: CodeRabbit UI
Files selected for processing (4)
- [Fel87]feldman-verifiable-secret-sharing/Cargo.toml (1 hunks)
- [Fel87]feldman-verifiable-secret-sharing/src/lib.rs (1 hunks)
- [Sha97]shamir-secret-sharing/src/lib.rs (1 hunks)
- polynomial/src/lib.rs (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- [Fel87]feldman-verifiable-secret-sharing/src/lib.rs
Additional comments not posted (2)
[Fel87]feldman-verifiable-secret-sharing/Cargo.toml (1)
1-13
: LGTM! The package metadata is correctly specified, and dependencies are appropriately managed, with workspace-level versions for most dependencies and a relative path for the localpolynomial
package. This setup promotes consistency and ease of dependency management across the project.[Sha97]shamir-secret-sharing/src/lib.rs (1)
43-43
: LGTM! Usingabs()
for floating-point comparisons is appropriate. Consider adding a comment to explain the choice of the comparison threshold (0.0000001
) to help future maintainers understand the rationale.
polynomial/src/lib.rs
Outdated
impl <T> Polynomial<T> | ||
where | ||
T: Clone { | ||
/// Get raw coefficients | ||
pub fn get_raw_coefficients(&self) -> Vec<T> { | ||
match &self.repr { | ||
PolynomialRepr::Points(_points) => unimplemented!(), | ||
PolynomialRepr::Roots(_root) => unimplemented!(), | ||
PolynomialRepr::Coeff(coeffs) => coeffs.to_vec(), | ||
} | ||
} |
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.
Consider refactoring get_raw_coefficients
to return a Result
or an Option
instead of using unimplemented!()
, which causes a panic. This change would improve error handling and make the API more robust and user-friendly.
- pub fn get_raw_coefficients(&self) -> Vec<T> {
+ pub fn get_raw_coefficients(&self) -> Result<Vec<T>, &'static str> {
match &self.repr {
PolynomialRepr::Points(_points) => Err("Raw coefficients are not available for Points representation."),
PolynomialRepr::Roots(_root) => Err("Raw coefficients are not available for Roots representation."),
- PolynomialRepr::Coeff(coeffs) => coeffs.to_vec(),
+ PolynomialRepr::Coeff(coeffs) => Ok(coeffs.to_vec()),
}
}
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
impl <T> Polynomial<T> | |
where | |
T: Clone { | |
/// Get raw coefficients | |
pub fn get_raw_coefficients(&self) -> Vec<T> { | |
match &self.repr { | |
PolynomialRepr::Points(_points) => unimplemented!(), | |
PolynomialRepr::Roots(_root) => unimplemented!(), | |
PolynomialRepr::Coeff(coeffs) => coeffs.to_vec(), | |
} | |
} | |
impl <T> Polynomial<T> | |
where | |
T: Clone { | |
/// Get raw coefficients | |
pub fn get_raw_coefficients(&self) -> Result<Vec<T>, &'static str> { | |
match &self.repr { | |
PolynomialRepr::Points(_points) => Err("Raw coefficients are not available for Points representation."), | |
PolynomialRepr::Roots(_root) => Err("Raw coefficients are not available for Roots representation."), | |
PolynomialRepr::Coeff(coeffs) => Ok(coeffs.to_vec()), | |
} | |
} |
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.
Actionable comments posted: 0
Review Status
Configuration used: CodeRabbit UI
Files selected for processing (2)
- [Fel87]feldman-verifiable-secret-sharing/src/lib.rs (1 hunks)
- [Sha97]shamir-secret-sharing/src/lib.rs (1 hunks)
Files skipped from review as they are similar to previous changes (2)
- [Fel87]feldman-verifiable-secret-sharing/src/lib.rs
- [Sha97]shamir-secret-sharing/src/lib.rs
No description provided.