Skip to main content

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 allocation identities in the usable ID domain, including governance.
8pub const MAX_ALLOCATIONS: usize = crate::slot::MEMORY_MANAGER_INVALID_ID as usize;
9
10// One allocation identity is reserved for the internal ledger declaration.
11pub const MAX_EXTERNAL_DECLARATIONS: usize = MAX_ALLOCATIONS - 1;
12
13/// Maximum encoded ownership ledger size (64 KiB for at most 255 records).
14pub const MAX_LEDGER_BYTES: usize = 64 * 1024;
15/// Maximum opaque generation payload containing direct logical CBOR.
16pub const MAX_COMMITTED_PAYLOAD_BYTES: usize = MAX_LEDGER_BYTES;
17/// One bounded CBOR byte string plus record metadata (64 KiB + 4 KiB).
18pub const MAX_LEDGER_RECORD_BYTES: usize = MAX_LEDGER_BYTES + 4096;
19/// Maximum CBOR container nesting on maintained decode paths.
20pub const MAX_LEDGER_NESTING: usize = 32;