EspressoSystems / jellyfish

A Rust Implementation of the PLONK ZKP System and Extensions
https://jellyfish.docs.espressosys.com
MIT License
408 stars 106 forks source link

Simplify code in `assemble_shares` #661

Closed ggutoski closed 3 months ago

ggutoski commented 3 months ago

In file vid/src/advz.rs in function assemble_shares we have the following code snippet:

https://github.com/EspressoSystems/jellyfish/blob/92714a4cc509fac07b8e8fc321fc0271c5dbe6b6/vid/src/advz.rs#L915-L932

Here evals, proofs are mutable Vecs and we use mem::take to initialize a Share struct. This seems unnecessarily complex and obfuscated to me.

We should be able to eliminate evals, proofs and simply move the relevant data directly into Share::evals, Share::evals_proof something like

evals: all_storage_node_evals[i],
evals_proof: aggregate_proofs[i],

Probably need to loop over a more idiomatic iterator instead of using i to index into these Vecs.