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