noir
noir copied to clipboard
Compilation flag to add runtime checks for opcode assumptions
Problem
Some ACIR opcodes have built-in assumptions about their inputs/outputs, e.g.
- Whether a point is on the curve and/or at infinity
- An input/output being within a range (if integral) or of a specific size (if array-like)
- Public key(s) are valid(?)
These assumptions are expected to be checked at some point throughout compilation, but
- They're exclusively runtime checks
- They're checked at different locations and/or passes
- They could be checked earlier in compilation and then invalidated later, e.g. by an SSA pass
Happy Case
Add a compilation flag to generate runtime code to check such assumptions, perhaps --pedantic
or --pedantic-gen
- This flag would only be used for testing, since it would be expected to have a negative impact on performance (and should be redundant)
- This would be especially useful for fuzzing, where otherwise assumptions can be broken silently
Workaround
Yes
Workaround Description
A partial workaround is to manually trace the dependencies of a piece of user code to their ACVM opcodes and add such runtime checks, however:
- This only works for individual and specific pieces of user code
- It would be challenging to keep up to date, especially without feature flags
Additional Context
No response
Project Impact
Nice-to-have
Blocker Context
No response
Would you like to submit a PR for this Issue?
None
Support Needs
No response