[Optimization] Inefficient fetching of credits.aleo
PKs
#2416
Labels
does not block mainnet
For when we make decisions that this will not block mainnet.
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: