Skip to content

Optimize zkVM code for faster proof generation #5

@mohamedalichelbi

Description

@mohamedalichelbi
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions