-
Notifications
You must be signed in to change notification settings - Fork 136
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
Add explicit drop of toxic_waste
once SRS is generated
#913
base: main
Are you sure you want to change the base?
Conversation
IIUC, the goal of this PR is to remove secrets from memory as soon as they stop being needed, right? Can you confirm this? If it is, I'm afraid |
OK, that makes sense. If this is meant to be an example of usage, then it should follow the correct usage.
I would say a fix or doc change (in the sense of intent), but I'm not sure the checklist covers those cases. I would just leave it untagged. |
WTF did I touch? I meant to quote you, not edit your comment. Sorry! |
Don't worry, I'm going to try to recreate the original message.
Yes, this is the purpose of this PR.
I didn't know about this. I'll take the opportunity to submit a modification taking this into account.
I know that this only affects the test routine and that it should not store any meaningful secret. However, I found this code very self-explanatory and very suitable to have a hands-on experience with KZG commitments. For this reason, I find it important to explicitly and manually remove the toxic waste once it's used, to exemplify good behaviour when implementing a production-ready KZG commitment.
Regarding the extra tests, that's great. On the other hand, I know that this is not a critical affair right now, I'm sorry if it sounded too alarmist.
I apologize for that, I did not find any other label in which this would be better fitted. What do you propose? |
Optimization changes to
kzg.rs
Description
The aim of this PR is to improve the
kzg.rs
file.In particular, I have added two optimizations:
MAX_POLYNOMIAL_DEGREE
as a constant to determine the maximum degree of polynomial that is allowed to commit.drop
of memory of the randomly generatedtoxic_waste
once the SRS is generated. Although Rust manages the memory (and in particular, the drops of unused variables) I find particularly important to handle the deletion of this variable explicitly and manually. Since, it is CRUCIAL for the soundness of the protocol for this variable to be DELETED right after its job is done.Type of change
Checklist
Linked to Github IssueThis change requires new documentation.Documentation has been added/updated.Benchmarks added/run