Context & versions
Compact: 0.27.110 (ledger 7) — broken
Compact: 0.27.0 (ledger 6) — worked
Steps to reproduce
Compile the following contract:
export ledger result_a: Boolean;
export circuit test(): [] {
const a = ((255 as Uint<8>) + (1 as Uint<8>)) as Uint<8>;
assert(a <= 255, "Not");
result_a = a <= 255;
}
Actual behavior
Compilation crashes with a Rust panic in midnight-circuits 6.0.0:
thread 'main' panicked at .../midnight-circuits-6.0.0/src/field/native/native_gadget.rs:174:13:
Trying to convert Fq(0x0000000000000000000000000000000000000000000000000000000000000100) to an AssignedBounded less than 2^8!
Exception: zkir returned a non-zero exit status 101
The value 256 (result of 255 + 1 wrapping in Uint<8>) is 0x100, which exceeds the 8-bit bound expected by the circuit backend.
Expected behavior
Wrapping arithmetic on Uint<N> types that was valid under ledger 6 should continue to work under ledger 7, or the compiler should emit a clear error explaining the semantic change. The zkir binary should not panic.
Migrated from PM-21087
Context & versions
Compact: 0.27.110 (ledger 7) — broken
Compact: 0.27.0 (ledger 6) — worked
Steps to reproduce
Compile the following contract:
Actual behavior
Compilation crashes with a Rust panic in
midnight-circuits 6.0.0:The value
256(result of255 + 1wrapping inUint<8>) is0x100, which exceeds the 8-bit bound expected by the circuit backend.Expected behavior
Wrapping arithmetic on
Uint<N>types that was valid under ledger 6 should continue to work under ledger 7, or the compiler should emit a clear error explaining the semantic change. Thezkirbinary should not panic.Migrated from PM-21087