v3.2.0
🦁 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::Xother_module::Sother_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:
-
common.leo→ defines modulecommon
Accessible frommain.leovia:common::<item>
-
outer.leo→ defines moduleouter
Accessible frommain.leovia:outer::<item>
-
outer/inner.leo→ defines submoduleouter::inner
Accessible from:-
main.leo:outer::inner::<item>
-
outer.leo:inner::<item>
-
📏 Module Layout Rules
New rules enforce consistency and prevent ambiguity:
-
Leaf modules (modules without submodules) must be defined in a single file:
foo.leo -
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`
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 cleanno longer errors whenoutputs/orbuild/directory is missing.- Correctly type-check
returnstatements inside constructors. - Added a check for the snarkOS installation location.
- Ensure const arguments are evaluated before monomorphization.
- Improved error messages for unresolved generics.