Skip to content
This repository was archived by the owner on May 4, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions documentation/cli/03_build.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ The build also generates an **ABI file** at `build/abi.json` describing your pro
The network to deploy to. Overrides the `NETWORK` environment variable.
--endpoint <ENDPOINT>
The endpoint to deploy to. Overrides the `ENDPOINT` environment variable.
--network-retries <N>
Number of times to retry a network request on transient transport failure, with
exponential backoff (1 s, 2 s, 4 s, … capped at 64 s). Overrides the
NETWORK_RETRIES environment variable. Defaults to 2. HTTP errors and broadcast
calls are not retried.
--devnet
Whether the network is a devnet. If not set, defaults to the `DEVNET` environment variable.
--consensus-heights <CONSENSUS_HEIGHTS>
Expand Down
4 changes: 4 additions & 0 deletions documentation/cli/06_deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ The endpoint to deploy to. Overrides any `ENDPOINT` environment variable set man

<!-- markdown-link-check-enable -->

#### `--network-retries <N>`

Number of times to retry a network request on transient transport failure, with exponential backoff (1 s, 2 s, 4 s, … capped at 64 s). Overrides the `NETWORK_RETRIES` environment variable. Defaults to `2`. HTTP errors (4xx/5xx) and broadcast calls are not retried.

#### `--devnet`

Specifies whether the network being deployed to is a devnet. If not set, defaults to the `DEVNET` environment variable.
Expand Down
4 changes: 4 additions & 0 deletions documentation/cli/08_execute.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ The endpoint to deploy to. Overrides any `ENDPOINT` environment variable set man

<!-- markdown-link-check-enable -->

#### `--network-retries <N>`

Number of times to retry a network request on transient transport failure, with exponential backoff (1 s, 2 s, 4 s, … capped at 64 s). Overrides the `NETWORK_RETRIES` environment variable. Defaults to `2`. HTTP errors (4xx/5xx) and broadcast calls are not retried.

#### `--devnet`

Specifies whether the network being deployed to is a devnet. If not set, defaults to the `DEVNET` environment variable.
Expand Down
28 changes: 28 additions & 0 deletions documentation/cli/10_query.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ Specifies the network to deploy to. Overrides any `NETWORK` environment variable

The endpoint to deploy to. Overrides any `ENDPOINT` environment variable set manually or in a `.env` file.

#### `--network-retries <N>`

Number of times to retry a network request on transient transport failure, with exponential backoff (1 s, 2 s, 4 s, … capped at 64 s). Overrides the `NETWORK_RETRIES` environment variable. Defaults to `2`. HTTP errors (4xx/5xx) and broadcast calls are not retried.

#### `--latest`

#### `-l`
Expand Down Expand Up @@ -132,6 +136,10 @@ Specifies the network to deploy to. Overrides any `NETWORK` environment variable

The endpoint to deploy to. Overrides any `ENDPOINT` environment variable set manually or in a `.env` file.

#### `--network-retries <N>`

Number of times to retry a network request on transient transport failure, with exponential backoff (1 s, 2 s, 4 s, … capped at 64 s). Overrides the `NETWORK_RETRIES` environment variable. Defaults to `2`. HTTP errors (4xx/5xx) and broadcast calls are not retried.

#### `--confirmed`

#### `-c`
Expand Down Expand Up @@ -194,6 +202,10 @@ Specifies the network to deploy to. Overrides any `NETWORK` environment variable

The endpoint to deploy to. Overrides any `ENDPOINT` environment variable set manually or in a `.env` file.

#### `--network-retries <N>`

Number of times to retry a network request on transient transport failure, with exponential backoff (1 s, 2 s, 4 s, … capped at 64 s). Overrides the `NETWORK_RETRIES` environment variable. Defaults to `2`. HTTP errors (4xx/5xx) and broadcast calls are not retried.

#### `--mappings`

Lists all mappings defined in the latest deployed edition of the program.
Expand Down Expand Up @@ -224,6 +236,10 @@ Specifies the network to deploy to. Overrides any `NETWORK` environment variable

The endpoint to deploy to. Overrides any `ENDPOINT` environment variable set manually or in a `.env` file.

#### `--network-retries <N>`

Number of times to retry a network request on transient transport failure, with exponential backoff (1 s, 2 s, 4 s, … capped at 64 s). Overrides the `NETWORK_RETRIES` environment variable. Defaults to `2`. HTTP errors (4xx/5xx) and broadcast calls are not retried.

---

## `leo query committee`
Expand All @@ -240,6 +256,10 @@ Specifies the network to deploy to. Overrides any `NETWORK` environment variable

The endpoint to deploy to. Overrides any `ENDPOINT` environment variable set manually or in a `.env` file.

#### `--network-retries <N>`

Number of times to retry a network request on transient transport failure, with exponential backoff (1 s, 2 s, 4 s, … capped at 64 s). Overrides the `NETWORK_RETRIES` environment variable. Defaults to `2`. HTTP errors (4xx/5xx) and broadcast calls are not retried.

---

## `leo query mempool`
Expand Down Expand Up @@ -280,6 +300,10 @@ Specifies the network to deploy to. Overrides any `NETWORK` environment variable

The endpoint to deploy to. Overrides any `ENDPOINT` environment variable set manually or in a `.env` file.

#### `--network-retries <N>`

Number of times to retry a network request on transient transport failure, with exponential backoff (1 s, 2 s, 4 s, … capped at 64 s). Overrides the `NETWORK_RETRIES` environment variable. Defaults to `2`. HTTP errors (4xx/5xx) and broadcast calls are not retried.

---

## `leo query peers`
Expand Down Expand Up @@ -311,3 +335,7 @@ Specifies the network to deploy to. Overrides any `NETWORK` environment variable
#### `--endpoint <ENDPOINT>`

The endpoint to deploy to. Overrides any `ENDPOINT` environment variable set manually or in a `.env` file.

#### `--network-retries <N>`

Number of times to retry a network request on transient transport failure, with exponential backoff (1 s, 2 s, 4 s, … capped at 64 s). Overrides the `NETWORK_RETRIES` environment variable. Defaults to `2`. HTTP errors (4xx/5xx) and broadcast calls are not retried.
5 changes: 5 additions & 0 deletions documentation/cli/12_run.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ leo run <FUNCTION_NAME> -- <INPUT_0> -- <INPUT_1> ...
The network to deploy to. Overrides the `NETWORK` environment variable.
--endpoint <ENDPOINT>
The endpoint to deploy to. Overrides the `ENDPOINT` environment variable.
--network-retries <N>
Number of times to retry a network request on transient transport failure, with
exponential backoff (1 s, 2 s, 4 s, … capped at 64 s). Overrides the
NETWORK_RETRIES environment variable. Defaults to 2. HTTP errors and broadcast
calls are not retried.
--devnet
Whether the network is a devnet. If not set, defaults to the `DEVNET` environment variable.
--consensus-heights <CONSENSUS_HEIGHTS>
Expand Down
4 changes: 4 additions & 0 deletions documentation/cli/15_upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ The endpoint to deploy to. Overrides any `ENDPOINT` environment variable set man

<!-- markdown-link-check-enable -->

#### `--network-retries <N>`

Number of times to retry a network request on transient transport failure, with exponential backoff (1 s, 2 s, 4 s, … capped at 64 s). Overrides the `NETWORK_RETRIES` environment variable. Defaults to `2`. HTTP errors (4xx/5xx) and broadcast calls are not retried.

#### `--devnet`

Specifies whether the network being deployed to is a devnet. If not set, defaults to the `DEVNET` environment variable.
Expand Down
4 changes: 4 additions & 0 deletions documentation/cli/16_synthesize.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ Specifies the network to deploy to. Overrides any `NETWORK` environment variable

The endpoint to deploy to. Overrides any `ENDPOINT` environment variable set manually or in a `.env` file.

#### `--network-retries <N>`

Number of times to retry a network request on transient transport failure, with exponential backoff (1 s, 2 s, 4 s, … capped at 64 s). Overrides the `NETWORK_RETRIES` environment variable. Defaults to `2`. HTTP errors (4xx/5xx) and broadcast calls are not retried.

#### `--local`

#### `-l`
Expand Down
79 changes: 79 additions & 0 deletions documentation/language/01_layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,85 @@ fn increment(x: field) -> field {
}
```

### Accessing Submodules of Imported Programs

When an imported program organizes its source across submodules, you can reach any `struct`, `const`, or helper `fn` from those submodules using an extended locator path:

```
program.aleo::submodule::item
```

For example, suppose `provider.aleo` has a submodule `colors` that defines a `Color` struct, a `MAX_CH` constant, and a `blend` helper:

```leo title="provider/src/colors.leo"
const MAX_CH: u32 = 255u32;

struct Color {
r: u32,
g: u32,
b: u32,
}

fn blend(a: Color, b: Color) -> Color {
return Color {
r: (a.r + b.r) / 2u32,
g: (a.g + b.g) / 2u32,
b: (a.b + b.b) / 2u32,
};
}
```

```leo title="provider/src/main.leo"
program provider.aleo {
fn sum_channels(c: colors::Color) -> u32 {
return c.r + c.g + c.b;
}

fn mix_colors(a: colors::Color, b: colors::Color) -> colors::Color {
return colors::blend(a, b);
}

@noupgrade
constructor() {}
}
```

A program that imports `provider.aleo` can reach the submodule struct, constant, and helper through the extended path, and can also call `provider.aleo`'s top-level entry functions:

```leo title="consumer/src/main.leo"
import provider.aleo;

program consumer.aleo {
// Struct and const from the submodule.
fn make_white() -> provider.aleo::colors::Color {
return provider.aleo::colors::Color {
r: provider.aleo::colors::MAX_CH,
g: provider.aleo::colors::MAX_CH,
b: provider.aleo::colors::MAX_CH,
};
}

// Top-level entry function from the provider.
fn mix(a: provider.aleo::colors::Color, b: provider.aleo::colors::Color) -> provider.aleo::colors::Color {
return provider.aleo::mix_colors(a, b);
}

// Submodule helper called directly — inlined into consumer's bytecode.
fn average(a: provider.aleo::colors::Color, b: provider.aleo::colors::Color) -> provider.aleo::colors::Color {
return provider.aleo::colors::blend(a, b);
}

@noupgrade
constructor() {}
}
```

Helper `fn`s reached through `program.aleo::submodule::name(...)` are inlined directly into the caller's bytecode; they are not separate on-chain calls and do not appear in the provider's ABI. Only top-level entry functions declared inside `program provider.aleo { ... }` remain part of its on-chain interface.

Submodule paths can be arbitrarily deep — `program.aleo::a::b::item` is valid if `program.aleo` has a nested submodule `a/b.leo`. The same extended path syntax applies to library submodules (see [Leo Libraries](./06_libraries.md#submodules)).

`interface` definitions may also be referenced through the same path syntax — both library submodules (`program my_app.aleo: my_lib::interfaces::Adder { ... }`) and imported program submodules (`program my_app.aleo: other_prog.aleo::interfaces::Adder { ... }`) work in a program header.

<!--

## The Tests
Expand Down
20 changes: 20 additions & 0 deletions documentation/language/06_libraries.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,26 @@ When a library dependency and a local submodule share the same name, paths begin
Explicit disambiguation using absolute paths (similar to Rust's `crate::foo::…` for local modules) is planned for a future release.
:::

## Building a Library

Running `leo build` inside a library package parses the library sources and runs semantic validation on the library itself. Type errors, unknown identifiers, interface-cycle errors, and the like are reported at the library package, instead of surfacing only when a downstream program consumes it.

```bash
cd math_utils
leo build
```

```
Leo 🔨 Building library 'math_utils'
Leo ✅ Validated 'math_utils'.
```

No bytecode is produced — libraries are inlined at the point of use and have no on-chain footprint — but any frontend errors are reported with spans pointing into the library's own source files.

:::note
When a program that depends on a library is built, library sources are compiled holistically with the program — any errors in the library still surface, but as part of the consuming program's build. Running `leo build` inside the library package itself validates it in isolation, so problems are caught at the source before any consumer tries to use it.
:::

## Testing

`leo test` works on library packages directly — no wrapper program is required. Place test files in the `tests/` directory and call library functions using the `library_name::item` path syntax.
Expand Down
4 changes: 4 additions & 0 deletions documentation/language/programs_in_practice/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ program main.aleo {

Acceptable types for const generic parameters include integer types, `bool`, `scalar`, `group`, `field`, and `address`.

:::note
Const generic parameters are only valid on inlinable helper `fn` functions. They are not permitted on entry point functions inside a `program {}` block, `final fn` functions, functions annotated with `@no_inline`, or function signatures declared inside an `interface`.
:::

### The `@no_inline` Annotation

By default the compiler inlines helper functions that are called only once, which reduces call overhead. To prevent this, annotate the function with `@no_inline`:
Expand Down
Loading
Loading