Skip to content

v3.2.0

Choose a tag to compare

@github-actions github-actions released this 09 Sep 18:55

🦁 Leo 3.2.0 Release Notes

📦 Modules

Leo 3.2.0 introduces a module system.

Example: Defining a Module

Given a file other_module.leo containing struct, const, and inline definitions:

const X: u32 = 2u32;

struct S {
    a: field
}

inline increment(x: field) -> field {
    return 1field;
}

You may refer to contents of the module as:

  • other_module::X
  • other_module::S
  • other_module::increment

📁 Example Directory Structure

src
├── common.leo
├── main.leo
├── outer.leo
└── outer
    └── inner.leo

📦 Module Access Paths

Given the structure above, the following modules are defined:

  1. common.leo → defines module common
    Accessible from main.leo via:

    common::<item>
  2. outer.leo → defines module outer
    Accessible from main.leo via:

    outer::<item>
  3. outer/inner.leo → defines submodule outer::inner
    Accessible from:

    • main.leo:

      outer::inner::<item>
    • outer.leo:

      inner::<item>

📏 Module Layout Rules

New rules enforce consistency and prevent ambiguity:

  1. Leaf modules (modules without submodules) must be defined in a single file:

    foo.leo
    
  2. Modules with submodules must be defined by an optional top-level file and a subdirectory:

    foo.leo        # defines module `foo` (optional)
    foo/
      └── bar.leo  # defines submodule `foo::bar`
    

⚠️ Currently, only relative paths are supported.
For example, items in outer.leo cannot be accessed from items in inner.leo. This limitation will be removed once absolute paths are implemented.


🔄 Leo Update Command

The leo update command now supports selecting a specific version:

leo update --name v3.0.0

🔐 Other Updates

  • Decrypt records via CLI: You can now decrypt records directly from the command line.
  • Pass ciphertexts to leo execute: Record ciphertexts may be passed as inputs to execution.

🐞 Bug Fixes & Improvements

  • Fixed outputting code regarding parenthesizing operands of the ternary conditional.
  • Removed redundant type errors in async function calls.
  • Correctly handle shorthand struct initializers that are consts.
  • leo clean no longer errors when outputs/ or build/ directory is missing.
  • Correctly type-check return statements inside constructors.
  • Added a check for the snarkOS installation location.
  • Ensure const arguments are evaluated before monomorphization.
  • Improved error messages for unresolved generics.