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:
always check when using functions like constraint_system and generate_witness that is_running is set to false at the start (otherwise we're in the middle of a computation?)
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)
We also make sure that
is_running
is set tofalse
in the global at ALL time except when we're running a circuit (e.g. in user-facing functions likeconstraint_system
andgenerate_witness
). This means we have to set it tofalse
at the end of running these functions.Perhaps we should additionally:
constraint_system
andgenerate_witness
thatis_running
is set tofalse
at the start (otherwise we're in the middle of a computation?)