Skip to content

v3.4.0

Latest

Choose a tag to compare

@d0cd d0cd released this 02 Dec 21:30

Release Notes

Empty arrays and empty loop

Arrays of size 0 and loops over empty ranges are now supported in Leo. While these constructs do not produce any instructions in the compiled Aleo bytecode, they enable more generic or pattern-based programming styles in Leo, especially when writing code that abstracts over sizes, iterates conditionally, or uses compile-time parameters. For example:

inline build_default::[N: u32]() -> [u8; N] {
    let xs: [u8; N] = [0u8; N];
    // When N = 0 this loop is simply skipped
    for i:u32 in 0..N {
        xs[i] = 1u8;
    }
    return xs;
}

let xs = build_default::[0](); // yields []

Stability improvements

  • Improved identifier validation in Leo, resulting in clearer and more precise error messages, especially when Leo identifiers conflict with reserved Aleo identifiers.
  • Fixed an issue where local const values failed to compile correctly when used in loop ranges.
  • Resolved a crash in the common subexpression elimination optimization pass that occurred for certain patterns of function calls.

Breaking Changes

  • The *hash_native* core functions have been renamed to *hash_to_bits*.