o1-labs / snarky

OCaml DSL for verifiable computation
MIT License
494 stars 74 forks source link

fix the runner for pure computations #730

Closed mimoo closed 1 year ago

mimoo commented 1 year ago

We change the state monad to take into account pure computations (computations that do not need to be ran in a circuit because it only involves constants)

- type ('a, 'f) t = 'f Run_state.t -> 'f Run_state.t * 'a
+ type ('a, 'f) t = Pure of 'a | Function of ('f Run_state.t -> 'f Run_state.t * 'a)

We also make sure that is_running is set to false in the global at ALL time except when we're running a circuit (e.g. in user-facing functions like constraint_system and generate_witness). This means we have to set it to false at the end of running these functions.

Perhaps we should additionally: