Skip to content
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

Optimize zkVM code for faster proof generation #5

Open
mohamedalichelbi opened this issue Jan 3, 2024 · 0 comments
Open

Optimize zkVM code for faster proof generation #5

mohamedalichelbi opened this issue Jan 3, 2024 · 0 comments

Comments

@mohamedalichelbi
Copy link
Contributor

mohamedalichelbi commented Jan 3, 2024

  • Some things to try: RISC0 Quick wins
  • Extract only used attributes from credential objects, and pass that to the zkVM (or the scripting engine, depending on the bottle-neck). The most easy/naive way for this is to extract all first-level credential object keys, and check which ones appear in the script using one regex containing all those keys. From there remove all keys that have no matches. A more sophisticated solution would be to run the script outside of the zkVM and check what attributes exactly were accesses by the script, this would allow extracting exactly the needed value and nothing more, even for multiple levels of nesting.
  • Profile guest code: It is important to know exactly what operations are most costly in terms of number of cycles. There are multiple profilers to try, like this or this
  • RISC0 has RISC0_DEV_MODE=1 which allows for faster iterations by just running the guest code without proving it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant