Aller au contenu
login
arrow_backRetour aux issues
Consensys/gnark #650

fix: test engine does not differentiate between constants and variables

ecoDébutant type: bug good first issue type: consolidate

descriptionDescription

In addition to being able to solve the witness for the circuit and run the prover, gnark has a feature where we represent all witness values as `*big.Int` and just run the computations. This feature (called the test engine) is very useful for writing and debugging complex circuits as we can compare the intermediate results to natively computed results. Right now however, as the variables in test engines are vanilla `*big.Int`, we lose a bit of context - is the input a variable or a constant. In the frontend and gadgets we frequently take different paths depending on this bit. In order to ensure that the different computation paths are compatible, we have the [`SetAllVariablesAsConstants`](https://github.com/ConsenSys/gnark/blob/master/test/engine.go#L74) option. But this doesn't capture the situation where some of the inputs are variables and some constants. It would be good to embed the variables in test engine which allows to capture the constantness bit.
codeOuvre sur GitHub