ic_memory/constants.rs
1/// Maximum byte length for printable diagnostic metadata fields.
2pub const DIAGNOSTIC_STRING_MAX_BYTES: usize = 256;
3
4/// WebAssembly page size used by `ic-stable-structures` memory implementations.
5pub const WASM_PAGE_SIZE_BYTES: u64 = 65_536;
6
7/// Maximum encoded logical ledger size (16 MiB).
8pub const MAX_LEDGER_BYTES: usize = 16 * 1024 * 1024;
9/// Family magic, format marker, version and encoded logical length.
10pub const LEDGER_PAYLOAD_HEADER_LEN: usize = 8 + 4 + 4 + 8;
11/// Maximum opaque generation payload, including its logical envelope header.
12pub const MAX_COMMITTED_PAYLOAD_BYTES: usize = MAX_LEDGER_BYTES + LEDGER_PAYLOAD_HEADER_LEN;
13/// Two bounded CBOR byte strings plus record metadata (32 MiB + 4 KiB).
14pub const MAX_LEDGER_RECORD_BYTES: usize = 2 * MAX_LEDGER_BYTES + 4096;
15/// Maximum retained generations; daily upgrades have over 179 years of headroom.
16pub const MAX_LEDGER_GENERATIONS: usize = 65_536;
17/// Maximum CBOR container nesting on maintained decode paths.
18pub const MAX_LEDGER_NESTING: usize = 32;