GuildOfWeavers / distaff

Zero-knowledge virtual machine written in Rust
MIT License
244 stars 44 forks source link

Add ALT stack #19

Closed bobbinth closed 4 years ago

bobbinth commented 4 years ago

Currently, all programs execute against a single stack. Adding an alt stack would enable:

  1. More expressive programs where a program could cache values on the alt stack
  2. A relatively simple way of implementing full random access memory (this would also require operation mirroring).

Adding of ALT stack (without mirroring) would require 2 new instructions:

Impact on performance should be relatively small - maybe up to 5% increase in proof generation time. Proof size should remain un-affected for programs which don't make use of the alt stack.

bobbinth commented 4 years ago

Found a better way to implement RAM. Alt stack is no longer needed.