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