Skip to main content

miden_protocol/transaction/kernel/
memory.rs

1// TYPE ALIASES
2// ================================================================================================
3
4pub type MemoryAddress = u32;
5pub type MemoryOffset = u32;
6pub type DataIndex = usize;
7pub type MemSize = usize;
8pub type StorageSlot = u8;
9
10// PUBLIC CONSTANTS
11// ================================================================================================
12
13// General layout
14//
15// | Section            | Start address | Size in elements | Comment                                    |
16// | ------------------ | ------------- | ---------------- | ------------------------------------------ |
17// | Bookkeeping        | 0             | 89               |                                            |
18// | Global inputs      | 400           | 40               |                                            |
19// | Block header       | 800           | 44               |                                            |
20// | Partial blockchain | 1_200         | 132              |                                            |
21// | Kernel data        | 1_600         | 140              | 34 procedures in total, 4 elements each    |
22// | Accounts data      | 8_192         | 524_288          | 64 accounts max, 8192 elements each        |
23// | Account delta      | 532_480       | 263              |                                            |
24// | Input notes        | 4_194_304     | 2_162_688        | nullifiers data segment + 1024 input notes |
25// |                    |               |                  | max, 2048 elements each                    |
26// | Output notes       | 16_777_216    | 2_097_152        | 1024 output notes max, 2048 elements each  |
27// | Link Map Memory    | 33_554_432    | 33_554_432       | Enough for 2_097_151 key-value pairs       |
28
29// Relative layout of one account
30//
31// | Section            | Start address | Size in elements | Comment                                |
32// | ------------------ | ------------- | ---------------- | -------------------------------------- |
33// | ID and nonce       | 0             | 4                |                                        |
34// | Vault root         | 4             | 4                |                                        |
35// | Storage commitment | 8             | 4                |                                        |
36// | Code commitment    | 12            | 4                |                                        |
37// | Padding            | 16            | 12               |                                        |
38// | Num procedures     | 28            | 4                |                                        |
39// | Procedures roots   | 32            | 1_024            | 256 procedures max, 4 elements each    |
40// | Padding            | 1_056         | 4                |                                        |
41// | Proc tracking      | 1_060         | 256              | 256 procedures max, 1 element each     |
42// | Num storage slots  | 1_316         | 4                |                                        |
43// | Initial slot info  | 1_320         | 1_020            | Only initialized on the native account |
44// | Active slot info   | 2_340         | 1_020            | 255 slots max, 8 elements each         |
45// | Padding            | 3_360         | 4_832            |                                        |
46//
47// Storage slots are laid out as [[0, slot_type, slot_id_suffix, slot_id_prefix], SLOT_VALUE].
48
49// Relative layout of the native account's delta.
50//
51// For now each Storage Map pointer (a link map ptr) occupies a single element.
52//
53// | Section                      | Start address | Size in elements | Comment                             |
54// | ---------------------------- | ------------- | ---------------- | ----------------------------------- |
55// | Fungible Asset Delta Ptr     | 0             | 4                |                                     |
56// | Non-Fungible Asset Delta Ptr | 4             | 4                |                                     |
57// | Storage Map Delta Ptrs       | 8             | 256              | Max 255 storage map deltas          |
58
59// BOOKKEEPING
60// ------------------------------------------------------------------------------------------------
61
62/// The memory address at which a pointer to the currently active input note is stored.
63pub const ACTIVE_INPUT_NOTE_PTR: MemoryAddress = 0;
64
65/// The memory address at which the number of output notes is stored.
66pub const NUM_OUTPUT_NOTES_PTR: MemoryAddress = 4;
67
68/// The memory address at which the input vault root is stored.
69pub const INPUT_VAULT_ROOT_PTR: MemoryAddress = 8;
70
71/// The memory address at which the output vault root is stored.
72pub const OUTPUT_VAULT_ROOT_PTR: MemoryAddress = 12;
73
74/// The memory address at which the dirty flag of the storage commitment of the native account is
75/// stored.
76///
77/// This binary flag specifies whether the commitment is outdated: it holds 1 if some changes were
78/// made to the account storage since the last re-computation, and 0 otherwise.
79pub const NATIVE_ACCT_STORAGE_COMMITMENT_DIRTY_FLAG_PTR: MemoryAddress = 16;
80
81/// The memory address at which the transaction expiration block number is stored.
82pub const TX_EXPIRATION_BLOCK_NUM_PTR: MemoryAddress = 20;
83
84/// The memory address at which the pointer to the stack element containing the pointer to the
85/// active account data is stored.
86///
87/// The stack starts at the address `29`. Stack has a length of `64` elements meaning that the
88/// maximum depth of FPI calls is `63` — the first slot is always occupied by the native account
89/// data pointer.
90///
91/// ```text
92/// ┌───────────────┬────────────────┬───────────────────┬─────┬────────────────────┐
93/// │ STACK TOP PTR │ NATIVE ACCOUNT │ FOREIGN ACCOUNT 1 │ ... │ FOREIGN ACCOUNT 63 │
94/// ├───────────────┼────────────────┼───────────────────┼─────┼────────────────────┤
95///        24               25                30                         88
96/// ```
97pub const ACCOUNT_STACK_TOP_PTR: MemoryAddress = 24;
98
99// GLOBAL INPUTS
100// ------------------------------------------------------------------------------------------------
101
102/// The memory address at which the global inputs section begins.
103pub const GLOBAL_INPUTS_SECTION_OFFSET: MemoryOffset = 400;
104
105/// The memory address at which the commitment of the transaction's reference block is stored.
106pub const BLOCK_COMMITMENT_PTR: MemoryAddress = 400;
107
108/// The memory address at which the native account ID is stored.
109pub const NATIVE_ACCT_ID_PTR: MemoryAddress = 404;
110
111/// The memory address at which the initial account commitment is stored.
112pub const INIT_ACCT_COMMITMENT_PTR: MemoryAddress = 408;
113
114/// The memory address at which the initial nonce is stored.
115pub const INIT_NONCE_PTR: MemoryAddress = 412;
116
117/// The memory address at which the initial vault root of the native account is stored.
118pub const INIT_NATIVE_ACCT_VAULT_ROOT_PTR: MemoryAddress = 416;
119
120/// The memory address at which the initial storage commitment of the native account is stored.
121pub const INIT_NATIVE_ACCT_STORAGE_COMMITMENT_PTR: MemoryAddress = 420;
122
123/// The memory address at which the input notes commitment is stored.
124pub const INPUT_NOTES_COMMITMENT_PTR: MemoryAddress = 424;
125
126/// The memory address at which the transaction script mast root is store
127pub const TX_SCRIPT_ROOT_PTR: MemoryAddress = 428;
128
129/// The memory address at which the transaction script arguments are stored.
130pub const TX_SCRIPT_ARGS: MemoryAddress = 432;
131
132/// The memory address at which the key of the auth procedure arguments is stored.
133pub const AUTH_ARGS_PTR: MemoryAddress = 436;
134
135// BLOCK DATA
136// ------------------------------------------------------------------------------------------------
137
138/// The memory address at which the block data section begins.
139pub const BLOCK_DATA_SECTION_OFFSET: MemoryOffset = 800;
140
141/// The memory address at which the previous block commitment is stored.
142pub const PREV_BLOCK_COMMITMENT_PTR: MemoryAddress = 800;
143
144/// The memory address at which the chain commitment is stored.
145pub const CHAIN_COMMITMENT_PTR: MemoryAddress = 804;
146
147/// The memory address at which the state root is stored.
148pub const ACCT_DB_ROOT_PTR: MemoryAddress = 808;
149
150/// The memory address at which the nullifier db root is store.
151pub const NULLIFIER_DB_ROOT_PTR: MemoryAddress = 812;
152
153/// The memory address at which the TX commitment is stored.
154pub const TX_COMMITMENT_PTR: MemoryAddress = 816;
155
156/// The memory address at which the transaction kernel commitment is stored.
157pub const TX_KERNEL_COMMITMENT_PTR: MemoryAddress = 820;
158
159/// The memory address at which the public key is stored.
160pub const VALIDATOR_KEY_COMMITMENT_PTR: MemoryAddress = 824;
161
162/// The memory address at which the block number is stored.
163pub const BLOCK_METADATA_PTR: MemoryAddress = 828;
164
165/// The index of the block number within the block metadata.
166pub const BLOCK_NUMBER_IDX: DataIndex = 0;
167
168/// The index of the protocol version within the block metadata.
169pub const PROTOCOL_VERSION_IDX: DataIndex = 1;
170
171/// The index of the timestamp within the block metadata.
172pub const TIMESTAMP_IDX: DataIndex = 2;
173
174/// The memory address at which the fee parameters are stored. These occupy a double word.
175pub const FEE_PARAMETERS_PTR: MemoryAddress = 832;
176
177/// The index of the native asset ID suffix within the block fee parameters.
178pub const NATIVE_ASSET_ID_SUFFIX_IDX: DataIndex = 0;
179
180/// The index of the native asset ID prefix within the block fee parameters.
181pub const NATIVE_ASSET_ID_PREFIX_IDX: DataIndex = 1;
182
183/// The index of the verification base fee within the block fee parameters.
184pub const VERIFICATION_BASE_FEE_IDX: DataIndex = 2;
185
186/// The memory address at which the note root is stored.
187pub const NOTE_ROOT_PTR: MemoryAddress = 840;
188
189// CHAIN DATA
190// ------------------------------------------------------------------------------------------------
191
192/// The memory address at which the chain data section begins.
193pub const PARTIAL_BLOCKCHAIN_PTR: MemoryAddress = 1200;
194
195/// The memory address at which the total number of leaves in the partial blockchain is stored.
196pub const PARTIAL_BLOCKCHAIN_NUM_LEAVES_PTR: MemoryAddress = 1200;
197
198/// The memory address at which the partial blockchain peaks are stored.
199pub const PARTIAL_BLOCKCHAIN_PEAKS_PTR: MemoryAddress = 1204;
200
201// KERNEL DATA
202// ------------------------------------------------------------------------------------------------
203
204/// The memory address at which the number of the kernel procedures is stored.
205pub const NUM_KERNEL_PROCEDURES_PTR: MemoryAddress = 1600;
206
207/// The memory address at which the section, where the hashes of the kernel procedures are stored,
208/// begins.
209pub const KERNEL_PROCEDURES_PTR: MemoryAddress = 1604;
210
211// ACCOUNT DATA
212// ------------------------------------------------------------------------------------------------
213
214/// The size of the memory segment allocated to core account data (excluding new code commitment).
215pub const ACCT_DATA_MEM_SIZE: MemSize = 16;
216
217/// The memory address at which the native account is stored.
218pub const NATIVE_ACCOUNT_DATA_PTR: MemoryAddress = 8192;
219
220/// The length of the memory interval that the account data occupies.
221pub const ACCOUNT_DATA_LENGTH: MemSize = 8192;
222
223/// The offset at which the account ID and nonce are stored relative to the start of
224/// the account data segment.
225pub const ACCT_ID_AND_NONCE_OFFSET: MemoryOffset = 0;
226
227/// The memory address at which the account ID and nonce are stored in the native account.
228pub const NATIVE_ACCT_ID_AND_NONCE_PTR: MemoryAddress =
229    NATIVE_ACCOUNT_DATA_PTR + ACCT_ID_AND_NONCE_OFFSET;
230
231/// The index of the account ID within the account ID and nonce data.
232pub const ACCT_ID_SUFFIX_IDX: DataIndex = 0;
233pub const ACCT_ID_PREFIX_IDX: DataIndex = 1;
234
235/// The index of the account nonce within the account ID and nonce data.
236pub const ACCT_NONCE_IDX: DataIndex = 3;
237
238/// The offset at which the account vault root is stored relative to the start of the account
239/// data segment.
240pub const ACCT_VAULT_ROOT_OFFSET: MemoryOffset = 4;
241
242/// The memory address at which the account vault root is stored in the native account.
243pub const NATIVE_ACCT_VAULT_ROOT_PTR: MemoryAddress =
244    NATIVE_ACCOUNT_DATA_PTR + ACCT_VAULT_ROOT_OFFSET;
245
246/// The offset at which the account storage commitment is stored relative to the start of the
247/// account data segment.
248pub const ACCT_STORAGE_COMMITMENT_OFFSET: MemoryOffset = 8;
249
250/// The memory address at which the account storage commitment is stored in the native account.
251pub const NATIVE_ACCT_STORAGE_COMMITMENT_PTR: MemoryAddress =
252    NATIVE_ACCOUNT_DATA_PTR + ACCT_STORAGE_COMMITMENT_OFFSET;
253
254/// The offset at which the account code commitment is stored relative to the start of the account
255/// data segment.
256pub const ACCT_CODE_COMMITMENT_OFFSET: MemoryOffset = 12;
257
258/// The memory address at which the account code commitment is stored in the native account.
259pub const NATIVE_ACCT_CODE_COMMITMENT_PTR: MemoryAddress =
260    NATIVE_ACCOUNT_DATA_PTR + ACCT_CODE_COMMITMENT_OFFSET;
261
262/// The offset at which the number of procedures contained in the account code is stored relative to
263/// the start of the account data segment.
264pub const ACCT_NUM_PROCEDURES_OFFSET: MemoryAddress = 28;
265
266/// The memory address at which the number of procedures contained in the account code is stored in
267/// the native account.
268pub const NATIVE_NUM_ACCT_PROCEDURES_PTR: MemoryAddress =
269    NATIVE_ACCOUNT_DATA_PTR + ACCT_NUM_PROCEDURES_OFFSET;
270
271/// The offset at which the account procedures section begins relative to the start of the account
272/// data segment.
273pub const ACCT_PROCEDURES_SECTION_OFFSET: MemoryAddress = 32;
274
275/// The memory address at which the account procedures section begins in the native account.
276pub const NATIVE_ACCT_PROCEDURES_SECTION_PTR: MemoryAddress =
277    NATIVE_ACCOUNT_DATA_PTR + ACCT_PROCEDURES_SECTION_OFFSET;
278
279/// The offset at which the account procedures call tracking section begins relative to the start of
280/// the account data segment.
281pub const ACCT_PROCEDURES_CALL_TRACKING_OFFSET: MemoryAddress = 1060;
282
283/// The memory address at which the account procedures call tracking section begins in the native
284/// account.
285pub const NATIVE_ACCT_PROCEDURES_CALL_TRACKING_PTR: MemoryAddress =
286    NATIVE_ACCOUNT_DATA_PTR + ACCT_PROCEDURES_CALL_TRACKING_OFFSET;
287
288/// The offset at which the number of storage slots contained in the account storage is stored
289/// relative to the start of the account data segment.
290pub const ACCT_NUM_STORAGE_SLOTS_OFFSET: MemoryAddress = 1316;
291
292/// The memory address at which number of storage slots contained in the account storage is stored
293/// in the native account.
294pub const NATIVE_NUM_ACCT_STORAGE_SLOTS_PTR: MemoryAddress =
295    NATIVE_ACCOUNT_DATA_PTR + ACCT_NUM_STORAGE_SLOTS_OFFSET;
296
297/// The number of elements that each storage slot takes up in memory.
298pub const ACCT_STORAGE_SLOT_NUM_ELEMENTS: u8 = 8;
299
300/// The offset of the slot type in the storage slot.
301pub const ACCT_STORAGE_SLOT_TYPE_OFFSET: u8 = 1;
302
303/// The offset of the slot's ID suffix in the storage slot.
304pub const ACCT_STORAGE_SLOT_ID_SUFFIX_OFFSET: u8 = 2;
305
306/// The offset of the slot's ID prefix in the storage slot.
307pub const ACCT_STORAGE_SLOT_ID_PREFIX_OFFSET: u8 = 3;
308
309/// The offset of the slot value in the storage slot.
310pub const ACCT_STORAGE_SLOT_VALUE_OFFSET: u8 = 4;
311
312/// The offset at which the account's active storage slots section begins relative to the start of
313/// the account data segment.
314///
315/// This section contains the current values of the account storage slots.
316pub const ACCT_ACTIVE_STORAGE_SLOTS_SECTION_OFFSET: MemoryAddress = 2340;
317
318/// The memory address at which the account's active storage slots section begins in the native
319/// account.
320pub const NATIVE_ACCT_STORAGE_SLOTS_SECTION_PTR: MemoryAddress =
321    NATIVE_ACCOUNT_DATA_PTR + ACCT_ACTIVE_STORAGE_SLOTS_SECTION_OFFSET;
322
323// NOTES DATA
324// ================================================================================================
325
326/// The size of the memory segment allocated to each note.
327pub const NOTE_MEM_SIZE: MemoryAddress = 2048;
328
329#[allow(clippy::empty_line_after_outer_attr)]
330#[rustfmt::skip]
331// INPUT NOTES DATA
332// ------------------------------------------------------------------------------------------------
333// Inputs note section contains data of all notes consumed by a transaction. The section starts at
334// memory offset 4_194_304 with a word containing the total number of input notes and is followed
335// by note nullifiers and note data like so:
336//
337// ┌─────────┬───────────┬───────────┬─────┬───────────┬─────────┬────────┬────────┬───────┬────────┐
338// │   NUM   │  NOTE 0   │  NOTE 1   │ ... │  NOTE n   │ PADDING │ NOTE 0 │ NOTE 1 │  ...  │ NOTE n │
339// │  NOTES  │ NULLIFIER │ NULLIFIER │     │ NULLIFIER │         │  DATA  │  DATA  │       │  DATA  │
340// └─────────┴───────────┴───────────┴─────┴───────────┴─────────┴────────┴────────┴───────┴────────┘
341//  4_194_304 4_194_308   4_194_312         4_194_304+4(n+1)  4_259_840   +2048    +4096   +2048n
342//
343// Here `n` represents number of input notes.
344//
345// Each nullifier occupies a single word. A data section for each note consists of exactly 2048
346// elements and is laid out like so:
347//
348// ┌──────┬────────┬────────┬────────┬────────────┬───────────┬──────────┬────────────┬───────┬────────┬────────┬───────┬─────┬───────┬─────────┬
349// │ NOTE │ SERIAL │ SCRIPT │ INPUTS │   ASSETS   | RECIPIENT │ METADATA │ ATTACHMENT │ NOTE  │  NUM   │  NUM   │ ASSET │ ... │ ASSET │ PADDING │
350// │  ID  │  NUM   │  ROOT  │  HASH  │ COMMITMENT |           │  HEADER  │            │ ARGS  │ INPUTS │ ASSETS │   0   │     │   n   │         │
351// ├──────┼────────┼────────┼────────┼────────────┼───────────┼──────────┼────────────┼───────┼────────┼────────┼───────┼─────┼───────┼─────────┤
352// 0      4        8        12       16           20          24         28           32       36      40       44 + 4n
353//
354// - NUM_INPUTS is encoded as [num_inputs, 0, 0, 0].
355// - NUM_ASSETS is encoded as [num_assets, 0, 0, 0].
356// - INPUTS_COMMITMENT is the key to look up note inputs in the advice map.
357// - ASSETS_COMMITMENT is the key to look up note assets in the advice map.
358//
359// Notice that note input values are not loaded to the memory, only their length. In order to obtain
360// the input values the advice map should be used: they are stored there as
361// `INPUTS_COMMITMENT -> INPUTS`.
362//
363// As opposed to the asset values, input values are never used in kernel memory, so their presence
364// there is unnecessary.
365
366/// The memory address at which the input note section begins.
367pub const INPUT_NOTE_SECTION_PTR: MemoryAddress = 4_194_304;
368
369/// The memory address at which the nullifier section of the input notes begins.
370pub const INPUT_NOTE_NULLIFIER_SECTION_PTR: MemoryAddress = 4_194_308;
371
372/// The memory address at which the input note data section begins.
373pub const INPUT_NOTE_DATA_SECTION_OFFSET: MemoryAddress = 4_259_840;
374
375/// The memory address at which the number of input notes is stored.
376pub const NUM_INPUT_NOTES_PTR: MemoryAddress = INPUT_NOTE_SECTION_PTR;
377
378/// The offsets at which data of an input note is stored relative to the start of its data segment.
379pub const INPUT_NOTE_ID_OFFSET: MemoryOffset = 0;
380pub const INPUT_NOTE_SERIAL_NUM_OFFSET: MemoryOffset = 4;
381pub const INPUT_NOTE_SCRIPT_ROOT_OFFSET: MemoryOffset = 8;
382pub const INPUT_NOTE_INPUTS_COMMITMENT_OFFSET: MemoryOffset = 12;
383pub const INPUT_NOTE_ASSETS_COMMITMENT_OFFSET: MemoryOffset = 16;
384pub const INPUT_NOTE_RECIPIENT_OFFSET: MemoryOffset = 20;
385pub const INPUT_NOTE_METADATA_HEADER_OFFSET: MemoryOffset = 24;
386pub const INPUT_NOTE_ATTACHMENT_OFFSET: MemoryOffset = 28;
387pub const INPUT_NOTE_ARGS_OFFSET: MemoryOffset = 32;
388pub const INPUT_NOTE_NUM_INPUTS_OFFSET: MemoryOffset = 36;
389pub const INPUT_NOTE_NUM_ASSETS_OFFSET: MemoryOffset = 40;
390pub const INPUT_NOTE_ASSETS_OFFSET: MemoryOffset = 44;
391
392#[allow(clippy::empty_line_after_outer_attr)]
393#[rustfmt::skip]
394// OUTPUT NOTES DATA
395// ------------------------------------------------------------------------------------------------
396// Output notes section contains data of all notes produced by a transaction. The section starts at
397// memory offset 16_777_216 with each note data laid out one after another in 512 word increments.
398//
399//     ┌─────────────┬─────────────┬───────────────┬─────────────┐
400//     │ NOTE 0 DATA │ NOTE 1 DATA │      ...      │ NOTE n DATA │
401//     └─────────────┴─────────────┴───────────────┴─────────────┘
402// 16_777_216      +2048         +4096           +2048n
403//
404// The total number of output notes for a transaction is stored in the bookkeeping section of the
405// memory. Data section of each note is laid out like so:
406//
407// ┌──────┬──────────┬────────────┬───────────┬────────────┬────────────────┬─────────┬─────┬─────────┬─────────┐
408// │ NOTE │ METADATA │  METADATA  │ RECIPIENT │   ASSETS   │   NUM ASSETS   │ ASSET 0 │ ... │ ASSET n │ PADDING │
409// |  ID  |  HEADER  | ATTACHMENT |           | COMMITMENT | AND DIRTY FLAG |         |     |         |         |
410// ├──────┼──────────┼────────────┼───────────┼────────────┼────────────────┼─────────┼─────┼─────────┼─────────┤
411//    0        1           2           3           4              5             6             6 + n
412//
413// The NUM_ASSETS_AND_DIRTY_FLAG word has the following layout:
414// `[num_assets, assets_commitment_dirty_flag, 0, 0]`, where:
415// - `num_assets` is the number of assets in this output note.
416// - `assets_commitment_dirty_flag` is the binary flag which specifies whether the assets commitment
417//   stored in this note is outdated. It holds 1 if some changes were made to the note assets since
418//   the last re-computation, and 0 otherwise.
419//
420// Dirty flag is set to 0 after every recomputation of the assets commitment in the
421// `kernel::note::compute_output_note_assets_commitment` procedure. It is set to 1 in the
422// `kernel::output_note::add_asset` procedure after any change was made to the assets data.
423
424/// The memory address at which the output notes section begins.
425pub const OUTPUT_NOTE_SECTION_OFFSET: MemoryOffset = 16_777_216;
426
427/// The offsets at which data of an output note is stored relative to the start of its data segment.
428pub const OUTPUT_NOTE_ID_OFFSET: MemoryOffset = 0;
429pub const OUTPUT_NOTE_METADATA_HEADER_OFFSET: MemoryOffset = 4;
430pub const OUTPUT_NOTE_ATTACHMENT_OFFSET: MemoryOffset = 8;
431pub const OUTPUT_NOTE_RECIPIENT_OFFSET: MemoryOffset = 12;
432pub const OUTPUT_NOTE_ASSET_COMMITMENT_OFFSET: MemoryOffset = 16;
433pub const OUTPUT_NOTE_NUM_ASSETS_OFFSET: MemoryOffset = 20;
434pub const OUTPUT_NOTE_DIRTY_FLAG_OFFSET: MemoryOffset = 21;
435pub const OUTPUT_NOTE_ASSETS_OFFSET: MemoryOffset = 24;
436
437// LINK MAP
438// ------------------------------------------------------------------------------------------------
439
440/// The inclusive start of the link map dynamic memory region.
441pub const LINK_MAP_REGION_START_PTR: MemoryAddress = 33_554_448;
442
443/// The non-inclusive end of the link map dynamic memory region.
444pub const LINK_MAP_REGION_END_PTR: MemoryAddress = 67_108_864;
445
446/// [`LINK_MAP_REGION_START_PTR`] + the currently used size stored at this pointer defines the next
447/// entry pointer that will be allocated.
448pub const LINK_MAP_USED_MEMORY_SIZE: MemoryAddress = 33_554_432;
449
450/// The size of each map entry, i.e. four words.
451pub const LINK_MAP_ENTRY_SIZE: MemoryOffset = 16;
452
453const _: () = assert!(
454    LINK_MAP_REGION_START_PTR.is_multiple_of(LINK_MAP_ENTRY_SIZE),
455    "link map region start ptr should be aligned to entry size"
456);
457
458const _: () = assert!(
459    (LINK_MAP_REGION_END_PTR - LINK_MAP_REGION_START_PTR).is_multiple_of(LINK_MAP_ENTRY_SIZE),
460    "the link map memory range should cleanly contain a multiple of the entry size"
461);