-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[Optimization] Inefficient fetching of credits.aleo
PKs
#2416
Labels
does not block mainnet
For when we make decisions that this will not block mainnet.
Comments
Would the following tweak suffice?
|
damons
added
the
does not block mainnet
For when we make decisions that this will not block mainnet.
label
Jun 11, 2024
@ljedrz That should be sufficient. Could you open up a PR with this change so we can test it? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It looks like our VM does not fetch the
credits.aleo
proving keys from theresources
folder and simply resynthesizes them from scratch at time of use. This is completely safe, however will incur a one-time synthesis cost.When we fetch the proving keys functions via
Stack::get_proving_key
, we check if the function is acredits.aleo
function and read the proving key directly from the bytes in.resources
if it is. This is done inStack::execute
- https://github.com/AleoHQ/snarkVM/blob/2cbf34a1010bf781277cdc6ff1ae966230cf97c1/synthesizer/process/src/stack/execute.rs#L462However a few lines above, we are always re-synthesizing the key at first time of use: https://github.com/AleoHQ/snarkVM/blob/2cbf34a1010bf781277cdc6ff1ae966230cf97c1/synthesizer/process/src/stack/execute.rs#L425-L429 This ignores the optimization we have for the PKs where we can simply read from bytes instead of resynthesizing.
Note: The current behavior does NOT impact security, but can be optimized.
The text was updated successfully, but these errors were encountered: