NilFoundation / zkLLVM

Zero-Knowledge Proof Systems Circuit Compiler
https://docs.nil.foundation/zkllvm
292 stars 48 forks source link

[Feature request]: generate constaraints for FALSE branch of runtime condition statement #433

Closed akokoshn closed 8 months ago

akokoshn commented 10 months ago

Problem Circuit file produced by assigner must be independent on input. Now it's not true if we have in code runtime condition dependent on input: generated constraints only for TRUE branch.

Solution Generate circuits for both branches

Related issues https://github.com/NilFoundation/zkLLVM/issues/419

akokoshn commented 9 months ago

Implementation steps

akokoshn commented 9 months ago

generate circuit for FALSE branch

image

complexity

image

akokoshn commented 9 months ago

Implementation: https://github.com/NilFoundation/zkLLVM/pull/514

WARNING: follow CPP features becomes unsupported after apply change:

Instructions unsupported without generate assignment:

Skip CPP examples/tests due to unsupported dynamic loop:

Modify examples/tests due to unsupported dynamic parameters:

reduce size of inputs for zkbridge

Enable unroll constant loops in RUST examples by using macros #[unroll_for_loop] - https://github.com/akokoshn/zkllvm-unroll, with follow limitations:

nil-foundation-cicd-bot[bot] commented 9 months ago

PRs, synced with the current issue:

Note: Please do not edit this comment; it's generated automatically.