NilFoundation / zkllvm-rslang

Other
15 stars 2 forks source link

Field literal bounds #31

Closed aleasims closed 1 year ago

aleasims commented 1 year ago

We agreed on the following bounds on field types literals:

If p is the order of corresponding field, then literal values from

aleasims commented 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.