0xPolygonMiden / miden-vm

STARK-based virtual machine
MIT License
632 stars 161 forks source link

Properly constrain `u32` values #1484

Open plafer opened 2 months ago

plafer commented 2 months ago

As discussed in https://github.com/0xPolygonMiden/miden-vm/pull/1480#pullrequestreview-2287458755, AIR constraints currently don't verify that u32 values are $< 2^{32}$. We should enforce that in the constraints.

bobbinth commented 2 months ago

I wouldn't probably call this a bug - more like a sub-optimal design choice :)

Btw, to make sure that all inputs are u32 values, we'd need perform additional range checks (2 range checks per operand). This shouldn't be too bad once we have LogUp-GKR integrated. But we'll also need to add more helper registers - and I'm not yet sure how to do this efficiently.