Closed aleasims closed 1 year ago
However #[allow(overflowing_literals)]
ignores these rules and allows to create field literals up to 48 bytes.
E.g. this:
#[allow(overflowing_literals)]
let x: __zkllvm_field_pallas_base = 0x40000000000000000000000000000000224698FC094CF91B992D30ED00000002g;
is equivalent to this:
let x: __zkllvm_field_pallas_base = 0x1g;
If you are trying to create a field literal larger than 48 bytes, you will get a compilation error anyway.
We agreed on the following bounds on field types literals:
If
p
is the order of corresponding field, then literal values from[0; p)
- use as it is,(-p; 0)
- transform into equivalent field element from(0; p)
(essentiallyx
->x + p
),(-∞; -p] ∪ [p; +∞)
- compilation error.