diff --git a/CHANGELOG.md b/CHANGELOG.md index 97b1f65bf7..1780928ae3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Changes +- [BREAKING] Removed redundant outputs from kernel procedures: `note::write_assets_to_memory`, `active_note::get_assets`, `input_note::get_assets`, `output_note::get_assets`, `active_note::get_storage`, and `faucet::mint` no longer return values identical to their inputs ([#2523](https://github.com/0xMiden/protocol/issues/2523)). - [BREAKING] Renamed `ProvenBatch::new` to `new_unchecked` ([#2687](https://github.com/0xMiden/miden-base/issues/2687)). - Added shared `ProcedurePolicy` for AuthMultisig ([#2670](https://github.com/0xMiden/protocol/pull/2670)). - [BREAKING] Changed `NoteType` encoding from 2 bits to 1 and makes `NoteType::Private` the default ([#2691](https://github.com/0xMiden/miden-base/issues/2691)). diff --git a/crates/miden-agglayer/asm/note_scripts/B2AGG.masm b/crates/miden-agglayer/asm/note_scripts/B2AGG.masm index 0ae42e52e8..87eeac1778 100644 --- a/crates/miden-agglayer/asm/note_scripts/B2AGG.masm +++ b/crates/miden-agglayer/asm/note_scripts/B2AGG.masm @@ -76,26 +76,26 @@ begin # Store note storage -> mem[8..14] push.B2AGG_NOTE_STORAGE_PTR exec.active_note::get_storage - # => [num_storage_items, storage_ptr, pad(16)] + # => [num_storage_items, pad(16)] # Validate the number of storage items push.B2AGG_NOTE_NUM_STORAGE_ITEMS assert_eq.err=ERR_B2AGG_UNEXPECTED_NUMBER_OF_STORAGE_ITEMS - # => [storage_ptr, pad(16)] + # => [pad(16)] # load the 6 B2AGG felts from B2AGG_NOTE_STORAGE_PTR as two words - add.4 mem_loadw_le swapw mem_loadw_le.B2AGG_NOTE_STORAGE_PTR + push.B2AGG_NOTE_STORAGE_PTR add.4 mem_loadw_le swapw mem_loadw_le.B2AGG_NOTE_STORAGE_PTR # => [dest_network, dest_address(5), pad(10)] # Store note assets -> mem[0..8] push.B2AGG_NOTE_ASSETS_PTR exec.active_note::get_assets - # => [num_assets, assets_ptr, dest_network, dest_address(5), pad(10)] + # => [num_assets, dest_network, dest_address(5), pad(10)] # Must be exactly 1 asset push.B2AGG_NOTE_NUM_ASSETS assert_eq.err=ERR_B2AGG_WRONG_NUMBER_OF_ASSETS - # => [assets_ptr, dest_network, dest_address(5), pad(10)] + # => [dest_network, dest_address(5), pad(10)] # Load asset onto the stack from B2AGG_NOTE_ASSETS_PTR - exec.asset::load + push.B2AGG_NOTE_ASSETS_PTR exec.asset::load # => [ASSET_KEY, ASSET_VALUE, dest_network, dest_address(5), pad(10)] call.bridge_out::bridge_out diff --git a/crates/miden-agglayer/asm/note_scripts/CLAIM.masm b/crates/miden-agglayer/asm/note_scripts/CLAIM.masm index 715ab6d7f9..0d595946f0 100644 --- a/crates/miden-agglayer/asm/note_scripts/CLAIM.masm +++ b/crates/miden-agglayer/asm/note_scripts/CLAIM.masm @@ -85,7 +85,7 @@ begin # => [pad(16)] # Load CLAIM note storage into memory, starting at address 0 - push.CLAIM_NOTE_STORAGE_PTR exec.active_note::get_storage drop drop + push.CLAIM_NOTE_STORAGE_PTR exec.active_note::get_storage drop # => [pad(16)] exec.write_claim_data_into_advice_map_by_key diff --git a/crates/miden-agglayer/asm/note_scripts/CONFIG_AGG_BRIDGE.masm b/crates/miden-agglayer/asm/note_scripts/CONFIG_AGG_BRIDGE.masm index 98df2690fd..0c93547b24 100644 --- a/crates/miden-agglayer/asm/note_scripts/CONFIG_AGG_BRIDGE.masm +++ b/crates/miden-agglayer/asm/note_scripts/CONFIG_AGG_BRIDGE.masm @@ -58,10 +58,10 @@ begin # Load note storage to memory push.STORAGE_START_PTR exec.active_note::get_storage - # => [num_storage_items, dest_ptr, pad(16)] + # => [num_storage_items, pad(16)] # Validate the number of storage items - push.CONFIG_AGG_BRIDGE_NUM_STORAGE_ITEMS assert_eq.err=ERR_CONFIG_AGG_BRIDGE_UNEXPECTED_STORAGE_ITEMS drop + push.CONFIG_AGG_BRIDGE_NUM_STORAGE_ITEMS assert_eq.err=ERR_CONFIG_AGG_BRIDGE_UNEXPECTED_STORAGE_ITEMS # => [pad(16)] # Load origin_token_addr(5) and faucet_id from memory diff --git a/crates/miden-agglayer/asm/note_scripts/UPDATE_GER.masm b/crates/miden-agglayer/asm/note_scripts/UPDATE_GER.masm index 070d181ef1..662ca90581 100644 --- a/crates/miden-agglayer/asm/note_scripts/UPDATE_GER.masm +++ b/crates/miden-agglayer/asm/note_scripts/UPDATE_GER.masm @@ -50,10 +50,10 @@ begin # Load note storage to memory push.STORAGE_PTR_GER_LOWER exec.active_note::get_storage - # => [num_storage_items, dest_ptr, pad(16)] + # => [num_storage_items, pad(16)] # Validate the number of storage items - push.UPDATE_GER_NOTE_NUM_STORAGE_ITEMS assert_eq.err=ERR_UPDATE_GER_UNEXPECTED_NUMBER_OF_STORAGE_ITEMS drop + push.UPDATE_GER_NOTE_NUM_STORAGE_ITEMS assert_eq.err=ERR_UPDATE_GER_UNEXPECTED_NUMBER_OF_STORAGE_ITEMS # => [pad(16)] # Load GER_LOWER and GER_UPPER from note storage diff --git a/crates/miden-protocol/asm/kernels/transaction/api.masm b/crates/miden-protocol/asm/kernels/transaction/api.masm index 703e3cdab3..b83a064860 100644 --- a/crates/miden-protocol/asm/kernels/transaction/api.masm +++ b/crates/miden-protocol/asm/kernels/transaction/api.masm @@ -741,14 +741,11 @@ end #! Mint an asset from the faucet the transaction is being executed against. #! #! Inputs: [ASSET_KEY, ASSET_VALUE, pad(8)] -#! Outputs: [NEW_ASSET_VALUE, pad(12)] +#! Outputs: [pad(16)] #! #! Where: #! - ASSET_KEY is the vault key of the asset to mint. -#! - ASSET_VALUE is the value of the asset that was minted. -#! - NEW_ASSET_VALUE is: -#! - For fungible assets: the ASSET_VALUE merged with the existing vault asset value, if any. -#! - For non-fungible assets: identical to ASSET_VALUE. +#! - ASSET_VALUE is the value of the asset to mint. #! #! Panics if: #! - the transaction is not being executed against a faucet. @@ -773,7 +770,7 @@ pub proc faucet_mint_asset # mint the asset exec.faucet::mint - # => [NEW_ASSET_VALUE, pad(12)] + # => [pad(16)] end #! Burn an asset from the faucet the transaction is being executed against. diff --git a/crates/miden-protocol/asm/protocol/active_note.masm b/crates/miden-protocol/asm/protocol/active_note.masm index cf47a36aa1..4e5bbce2ef 100644 --- a/crates/miden-protocol/asm/protocol/active_note.masm +++ b/crates/miden-protocol/asm/protocol/active_note.masm @@ -25,7 +25,7 @@ const ERR_NOTE_INVALID_NUMBER_OF_STORAGE_ITEMS="the specified number of note sto #! Writes the assets of the active note into memory starting at the specified address. #! #! Inputs: [dest_ptr] -#! Outputs: [num_assets, dest_ptr] +#! Outputs: [num_assets] #! #! Where: #! - dest_ptr is the memory address to write the assets. @@ -54,9 +54,13 @@ pub proc get_assets swapdw dropw dropw movup.7 movup.7 movup.7 drop drop drop # => [ASSETS_COMMITMENT, num_assets, dest_ptr] + # save num_assets for the return value + dup.4 movdn.6 + # => [ASSETS_COMMITMENT, num_assets, dest_ptr, num_assets] + # write the assets from the advice map into memory exec.note::write_assets_to_memory - # => [num_assets, dest_ptr] + # => [num_assets] end #! Returns the recipient of the active note. @@ -97,7 +101,7 @@ end #! Stack: [dest_ptr] #! Advice Map: { NOTE_STORAGE_COMMITMENT: [STORAGE] } #! Outputs: -#! Stack: [num_storage_items, dest_ptr] +#! Stack: [num_storage_items] #! #! Where: #! - dest_ptr is the memory address to write the note storage. @@ -131,6 +135,10 @@ pub proc get_storage # write the inputs to the memory using the provided destination pointer exec.write_storage_to_memory # => [num_storage_items, dest_ptr] + + # drop dest_ptr as it is identical to the input + swap drop + # => [num_storage_items] end #! Returns the metadata of the active note. diff --git a/crates/miden-protocol/asm/protocol/faucet.masm b/crates/miden-protocol/asm/protocol/faucet.masm index b05a305c22..f630b6a134 100644 --- a/crates/miden-protocol/asm/protocol/faucet.masm +++ b/crates/miden-protocol/asm/protocol/faucet.masm @@ -63,14 +63,11 @@ end #! Mint an asset from the faucet the transaction is being executed against. #! #! Inputs: [ASSET_KEY, ASSET_VALUE] -#! Outputs: [NEW_ASSET_VALUE] +#! Outputs: [] #! #! Where: #! - ASSET_KEY is the vault key of the asset to mint. #! - ASSET_VALUE is the value of the asset that was minted. -#! - NEW_ASSET_VALUE is: -#! - For fungible assets: the ASSET_VALUE merged with the existing vault asset value, if any. -#! - For non-fungible assets: identical to ASSET_VALUE. #! #! Panics if: #! - the transaction is not being executed against a faucet. @@ -94,8 +91,8 @@ pub proc mint # => [ASSET_VALUE, pad(12)] # clean the stack - swapdw dropw dropw swapw dropw - # => [ASSET_VALUE] + dropw dropw dropw dropw + # => [] end #! Burn an asset from the faucet the transaction is being executed against. diff --git a/crates/miden-protocol/asm/protocol/input_note.masm b/crates/miden-protocol/asm/protocol/input_note.masm index be9ae33d03..fc5484a495 100644 --- a/crates/miden-protocol/asm/protocol/input_note.masm +++ b/crates/miden-protocol/asm/protocol/input_note.masm @@ -65,7 +65,7 @@ end #! information about the layout of each asset see the description of the `Asset` Rust type. #! #! Inputs: [dest_ptr, note_index] -#! Outputs: [num_assets, dest_ptr, note_index] +#! Outputs: [num_assets] #! #! Where: #! - dest_ptr is the memory address to write the assets. @@ -81,9 +81,16 @@ pub proc get_assets dup.1 exec.get_assets_info # => [ASSETS_COMMITMENT, num_assets, dest_ptr, note_index] + # save num_assets for the return value and drop note_index + dup.4 movdn.7 + # => [ASSETS_COMMITMENT, num_assets, dest_ptr, note_index, num_assets] + + movup.6 drop + # => [ASSETS_COMMITMENT, num_assets, dest_ptr, num_assets] + # write the assets stored in the advice map to the specified memory pointer exec.note::write_assets_to_memory - # => [num_assets, dest_ptr, note_index] + # => [num_assets] end #! Returns the recipient of the input note with the specified index. diff --git a/crates/miden-protocol/asm/protocol/note.masm b/crates/miden-protocol/asm/protocol/note.masm index 298762ca50..0f9dd377d6 100644 --- a/crates/miden-protocol/asm/protocol/note.masm +++ b/crates/miden-protocol/asm/protocol/note.masm @@ -54,7 +54,7 @@ end #! ASSETS_COMMITMENT: [[ASSETS_DATA]] #! } #! Outputs: -#! Operand stack: [num_assets, dest_ptr] +#! Operand stack: [] pub proc write_assets_to_memory # load the asset data from the advice map to the advice stack adv.push_mapval @@ -75,6 +75,10 @@ pub proc write_assets_to_memory exec.mem::pipe_double_words_preimage_to_memory drop # OS => [num_assets, dest_ptr] # AS => [] + + # drop num_assets and dest_ptr as these are identical to the inputs + drop drop + # OS => [] end #! Builds the recipient hash from note storage, script root, and serial number. diff --git a/crates/miden-protocol/asm/protocol/output_note.masm b/crates/miden-protocol/asm/protocol/output_note.masm index d9ce865024..49dd64551c 100644 --- a/crates/miden-protocol/asm/protocol/output_note.masm +++ b/crates/miden-protocol/asm/protocol/output_note.masm @@ -105,7 +105,7 @@ end #! information about the layout of each asset see the description of the `Asset` Rust type. #! #! Inputs: [dest_ptr, note_index] -#! Outputs: [num_assets, dest_ptr, note_index] +#! Outputs: [num_assets] #! #! Where: #! - dest_ptr is the memory address to write the assets. @@ -121,9 +121,16 @@ pub proc get_assets dup.1 exec.get_assets_info # => [ASSETS_COMMITMENT, num_assets, dest_ptr, note_index] + # save num_assets for the return value and drop note_index + dup.4 movdn.7 + # => [ASSETS_COMMITMENT, num_assets, dest_ptr, note_index, num_assets] + + movup.6 drop + # => [ASSETS_COMMITMENT, num_assets, dest_ptr, num_assets] + # write the assets stored in the advice map to the specified memory pointer exec.note::write_assets_to_memory - # => [num_assets, dest_ptr, note_index] + # => [num_assets] end #! Adds the asset to the note specified by the index. diff --git a/crates/miden-standards/asm/standards/faucets/mod.masm b/crates/miden-standards/asm/standards/faucets/mod.masm index ab2ed1c2e5..0b3014cd37 100644 --- a/crates/miden-standards/asm/standards/faucets/mod.masm +++ b/crates/miden-standards/asm/standards/faucets/mod.masm @@ -145,7 +145,6 @@ pub proc mint_and_send # this ensures that the asset's faucet ID matches the native account's ID. # this is ensured because create_fungible_asset creates the asset with the native account's ID exec.faucet::mint - dropw # => [ASSET_KEY, ASSET_VALUE, note_idx, note_idx] # Add the asset to the note. @@ -179,13 +178,13 @@ pub proc burn # this will fail if not called from a note context. push.ASSET_PTR exec.active_note::get_assets - # => [num_assets, dest_ptr, pad(16)] + # => [num_assets, pad(16)] # Verify we have exactly one asset assert.err=ERR_BASIC_FUNGIBLE_BURN_WRONG_NUMBER_OF_ASSETS - # => [dest_ptr, pad(16)] + # => [pad(16)] - exec.asset::load + push.ASSET_PTR exec.asset::load # => [ASSET_KEY, ASSET_VALUE, pad(16)] # Burn the asset from the transaction vault diff --git a/crates/miden-standards/asm/standards/notes/mint.masm b/crates/miden-standards/asm/standards/notes/mint.masm index 7780a67052..e2b692a55e 100644 --- a/crates/miden-standards/asm/standards/notes/mint.masm +++ b/crates/miden-standards/asm/standards/notes/mint.masm @@ -65,20 +65,20 @@ pub proc main # => [pad(16)] # Load note storage into memory starting at address 0 push.0 exec.active_note::get_storage - # => [num_storage_items, storage_ptr, pad(16)] + # => [num_storage_items, pad(16)] dup - # => [num_storage_items, num_storage_items, storage_ptr, pad(16)] + # => [num_storage_items, num_storage_items, pad(16)] u32assert2.err=ERR_MINT_UNEXPECTED_NUMBER_OF_STORAGE_ITEMS u32gte.MINT_NOTE_MIN_NUM_STORAGE_ITEMS_PUBLIC - # => [is_public_output_note, num_storage_items, storage_ptr, pad(16)] + # => [is_public_output_note, num_storage_items, pad(16)] if.true # public output note creation - # => [num_storage_items, storage_ptr, pad(16)] + # => [num_storage_items, pad(16)] - movdn.9 drop + movdn.8 # => [EMPTY_WORD, EMPTY_WORD, num_storage_items, pad(8)] mem_loadw_le.8 @@ -104,10 +104,7 @@ pub proc main else # private output note creation - eq.MINT_NOTE_NUM_STORAGE_ITEMS_PRIVATE assert.err=ERR_MINT_UNEXPECTED_NUMBER_OF_STORAGE_ITEMS drop - # => [storage_ptr, pad(16)] - - drop + eq.MINT_NOTE_NUM_STORAGE_ITEMS_PRIVATE assert.err=ERR_MINT_UNEXPECTED_NUMBER_OF_STORAGE_ITEMS # => [pad(16)] mem_loadw_le.8 diff --git a/crates/miden-standards/asm/standards/notes/p2id.masm b/crates/miden-standards/asm/standards/notes/p2id.masm index 99abab6204..5df234ee01 100644 --- a/crates/miden-standards/asm/standards/notes/p2id.masm +++ b/crates/miden-standards/asm/standards/notes/p2id.masm @@ -44,14 +44,13 @@ const TARGET_ACCOUNT_ID_PREFIX_PTR = STORAGE_PTR + 1 pub proc main # store the note storage to memory starting at address 0 push.STORAGE_PTR exec.active_note::get_storage - # => [num_storage_items, storage_ptr] + # => [num_storage_items] # make sure the number of storage items is 2 eq.2 assert.err=ERR_P2ID_UNEXPECTED_NUMBER_OF_STORAGE_ITEMS - # => [storage_ptr] + # => [] # read the target account ID from the note storage - drop mem_load.TARGET_ACCOUNT_ID_PREFIX_PTR mem_load.TARGET_ACCOUNT_ID_SUFFIX_PTR # => [target_account_id_suffix, target_account_id_prefix] diff --git a/crates/miden-standards/asm/standards/notes/p2ide.masm b/crates/miden-standards/asm/standards/notes/p2ide.masm index f476232e06..f9404571ce 100644 --- a/crates/miden-standards/asm/standards/notes/p2ide.masm +++ b/crates/miden-standards/asm/standards/notes/p2ide.masm @@ -104,14 +104,14 @@ end pub proc main # store the note storage to memory starting at address 0 push.0 exec.active_note::get_storage - # => [num_storage_items, storage_ptr] + # => [num_storage_items] # make sure the number of storage items is 4 eq.4 assert.err=ERR_P2IDE_UNEXPECTED_NUMBER_OF_STORAGE_ITEMS - # => [storage_ptr] + # => [] # read the target account ID, reclaim block height, and timelock_block_height from the note storage - mem_loadw_le + push.0 mem_loadw_le # => [target_account_id_suffix, target_account_id_prefix, reclaim_block_height, timelock_block_height] movup.3 diff --git a/crates/miden-standards/asm/standards/notes/swap.masm b/crates/miden-standards/asm/standards/notes/swap.masm index cedb7a6236..8ba077e4fc 100644 --- a/crates/miden-standards/asm/standards/notes/swap.masm +++ b/crates/miden-standards/asm/standards/notes/swap.masm @@ -62,11 +62,10 @@ pub proc main # store note storage into memory starting at address 0 push.0 exec.active_note::get_storage - # => [num_storage_items, storage_ptr] + # => [num_storage_items] # check number of storage items eq.SWAP_NOTE_NUM_STORAGE_ITEMS assert.err=ERR_SWAP_UNEXPECTED_NUMBER_OF_STORAGE_ITEMS - drop # => [] padw mem_loadw_le.PAYBACK_RECIPIENT_PTR @@ -107,14 +106,14 @@ pub proc main # store the number of note assets to memory starting at address ASSET_PTR push.ASSET_PTR exec.active_note::get_assets - # => [num_assets, asset_ptr, pad(8)] + # => [num_assets, pad(8)] # make sure the number of assets is 1 assert.err=ERR_SWAP_WRONG_NUMBER_OF_ASSETS - # => [asset_ptr, pad(8)] + # => [pad(8)] # load asset - exec.asset::load + push.ASSET_PTR exec.asset::load # => [ASSET_KEY, ASSET_VALUE, pad(8)] # add the asset to the account diff --git a/crates/miden-standards/asm/standards/wallets/basic.masm b/crates/miden-standards/asm/standards/wallets/basic.masm index 9656713977..8b0d840b5a 100644 --- a/crates/miden-standards/asm/standards/wallets/basic.masm +++ b/crates/miden-standards/asm/standards/wallets/basic.masm @@ -75,10 +75,10 @@ pub proc add_assets_to_account # we have allocated ASSET_SIZE * MAX_ASSETS_PER_NOTE number of locals so all assets should fit # since the asset memory will be overwritten, we don't have to initialize the locals to zero locaddr.0 exec.active_note::get_assets - # => [num_of_assets, ptr = 0] + # => [num_of_assets] # compute the pointer at which we should stop iterating - mul.ASSET_SIZE dup.1 add + mul.ASSET_SIZE locaddr.0 dup movdn.2 add # => [end_ptr, ptr] # pad the stack and move the pointer to the top diff --git a/crates/miden-standards/src/testing/mock_account_code.rs b/crates/miden-standards/src/testing/mock_account_code.rs index 48de0e4d32..83a65dc149 100644 --- a/crates/miden-standards/src/testing/mock_account_code.rs +++ b/crates/miden-standards/src/testing/mock_account_code.rs @@ -8,10 +8,10 @@ const MOCK_FAUCET_CODE: &str = " use miden::protocol::faucet #! Inputs: [ASSET_KEY, ASSET_VALUE, pad(8)] - #! Outputs: [NEW_ASSET_VALUE, pad(12)] + #! Outputs: [pad(16)] pub proc mint exec.faucet::mint - # => [NEW_ASSET_VALUE, pad(12)] + # => [pad(16)] end #! Inputs: [ASSET_KEY, ASSET_VALUE, pad(8)] diff --git a/crates/miden-testing/src/kernel_tests/tx/test_active_note.rs b/crates/miden-testing/src/kernel_tests/tx/test_active_note.rs index de5171d810..3129443677 100644 --- a/crates/miden-testing/src/kernel_tests/tx/test_active_note.rs +++ b/crates/miden-testing/src/kernel_tests/tx/test_active_note.rs @@ -247,8 +247,8 @@ async fn test_active_note_get_assets() -> anyhow::Result<()> { # assert the number of assets is correct eq.{note_0_num_assets} assert.err="unexpected num assets for note 0" - # assert the pointer is returned - dup eq.{DEST_POINTER_NOTE_0} assert.err="unexpected dest ptr for note 0" + # push the dest pointer for asset assertions + push.{DEST_POINTER_NOTE_0} # asset memory assertions {NOTE_0_ASSET_ASSERTIONS} @@ -270,8 +270,8 @@ async fn test_active_note_get_assets() -> anyhow::Result<()> { # assert the number of assets is correct eq.{note_1_num_assets} assert.err="unexpected num assets for note 1" - # assert the pointer is returned - dup eq.{DEST_POINTER_NOTE_1} assert.err="unexpected dest ptr for note 1" + # push the dest pointer for asset assertions + push.{DEST_POINTER_NOTE_1} # asset memory assertions {NOTE_1_ASSET_ASSERTIONS} @@ -377,12 +377,13 @@ async fn test_active_note_get_storage() -> anyhow::Result<()> { # => [] push.{NOTE_0_PTR} exec.active_note::get_storage - # => [num_storage_items, dest_ptr] + # => [num_storage_items] eq.{num_storage_items} assert.err="unexpected num_storage_items" - # => [dest_ptr] + # => [] - dup eq.{NOTE_0_PTR} assert.err="unexpected dest ptr" + # push the dest pointer for storage assertions + push.{NOTE_0_PTR} # => [dest_ptr] # apply note 1 storage assertions diff --git a/crates/miden-testing/src/kernel_tests/tx/test_faucet.rs b/crates/miden-testing/src/kernel_tests/tx/test_faucet.rs index 59796ae2ec..ed5fcad390 100644 --- a/crates/miden-testing/src/kernel_tests/tx/test_faucet.rs +++ b/crates/miden-testing/src/kernel_tests/tx/test_faucet.rs @@ -60,10 +60,7 @@ async fn test_mint_fungible_asset_succeeds() -> anyhow::Result<()> { push.{FUNGIBLE_ASSET_VALUE} push.{FUNGIBLE_ASSET_KEY} call.mock_faucet::mint - - # assert the correct asset is returned - push.{FUNGIBLE_ASSET_VALUE} - assert_eqw.err="minted asset does not match expected asset" + dropw # assert the input vault has been updated exec.memory::get_input_vault_root_ptr @@ -252,10 +249,7 @@ async fn test_mint_non_fungible_asset_succeeds() -> anyhow::Result<()> { push.{NON_FUNGIBLE_ASSET_VALUE} push.{NON_FUNGIBLE_ASSET_KEY} call.mock_faucet::mint - - # assert the correct asset is returned - push.{NON_FUNGIBLE_ASSET_VALUE} - assert_eqw.err="minted asset does not match expected asset" + dropw # assert the input vault has been updated. exec.memory::get_input_vault_root_ptr diff --git a/crates/miden-testing/src/kernel_tests/tx/test_input_note.rs b/crates/miden-testing/src/kernel_tests/tx/test_input_note.rs index 51d746748c..af4f93da6c 100644 --- a/crates/miden-testing/src/kernel_tests/tx/test_input_note.rs +++ b/crates/miden-testing/src/kernel_tests/tx/test_input_note.rs @@ -219,12 +219,16 @@ async fn test_get_assets() -> anyhow::Result<()> { # write the assets to the memory exec.input_note::get_assets - # => [num_assets, dest_ptr, note_index] + # => [num_assets] # assert the number of note assets push.{assets_number} assert_eq.err="note {note_index} has incorrect assets number" - # => [dest_ptr, note_index] + # => [] + + # push the dest pointer for asset assertions + push.{dest_ptr} + # => [dest_ptr] "#, note_idx = note_index, dest_ptr = dest_ptr, @@ -237,27 +241,27 @@ async fn test_get_assets() -> anyhow::Result<()> { r#" # load the asset key stored in memory padw dup.4 mem_loadw_le - # => [STORED_ASSET_KEY, dest_ptr, note_index] + # => [STORED_ASSET_KEY, dest_ptr] # assert the asset key matches push.{NOTE_ASSET_KEY} assert_eqw.err="expected asset key at asset index {asset_index} of the note\ {note_index} to be {NOTE_ASSET_KEY}" - # => [dest_ptr, note_index] + # => [dest_ptr] # load the asset value stored in memory padw dup.4 add.{ASSET_VALUE_OFFSET} mem_loadw_le - # => [STORED_ASSET_VALUE, dest_ptr, note_index] + # => [STORED_ASSET_VALUE, dest_ptr] # assert the asset value matches push.{NOTE_ASSET_VALUE} assert_eqw.err="expected asset value at asset index {asset_index} of the note\ {note_index} to be {NOTE_ASSET_VALUE}" - # => [dest_ptr, note_index] + # => [dest_ptr] # move the pointer add.{ASSET_SIZE} - # => [dest_ptr+ASSET_SIZE, note_index] + # => [dest_ptr+ASSET_SIZE] "#, NOTE_ASSET_KEY = asset.to_key_word(), NOTE_ASSET_VALUE = asset.to_value_word(), @@ -266,8 +270,8 @@ async fn test_get_assets() -> anyhow::Result<()> { )); } - // drop the final `dest_ptr` and `note_index` from the stack - check_assets_code.push_str("\ndrop drop"); + // drop the final `dest_ptr` from the stack + check_assets_code.push_str("\ndrop"); check_assets_code } diff --git a/crates/miden-testing/src/kernel_tests/tx/test_output_note.rs b/crates/miden-testing/src/kernel_tests/tx/test_output_note.rs index a2ff0c722d..b1b413763a 100644 --- a/crates/miden-testing/src/kernel_tests/tx/test_output_note.rs +++ b/crates/miden-testing/src/kernel_tests/tx/test_output_note.rs @@ -962,12 +962,16 @@ async fn test_get_assets() -> anyhow::Result<()> { # write the assets to memory exec.output_note::get_assets - # => [num_assets, dest_ptr, note_index] + # => [num_assets] # assert the number of note assets push.{assets_number} assert_eq.err="expected note {note_index} to have {assets_number} assets" - # => [dest_ptr, note_index] + # => [] + + # push the dest pointer for asset assertions + push.{dest_ptr} + # => [dest_ptr] "#, note_idx = note_index, dest_ptr = dest_ptr, @@ -980,27 +984,27 @@ async fn test_get_assets() -> anyhow::Result<()> { r#" # load the asset stored in memory padw dup.4 mem_loadw_le - # => [STORED_ASSET_KEY, dest_ptr, note_index] + # => [STORED_ASSET_KEY, dest_ptr] # assert the asset key matches push.{NOTE_ASSET_KEY} assert_eqw.err="expected asset key at asset index {asset_index} of the note\ {note_index} to be {NOTE_ASSET_KEY}" - # => [dest_ptr, note_index] + # => [dest_ptr] # load the asset stored in memory padw dup.4 add.{ASSET_VALUE_OFFSET} mem_loadw_le - # => [STORED_ASSET_VALUE, dest_ptr, note_index] + # => [STORED_ASSET_VALUE, dest_ptr] # assert the asset value matches push.{NOTE_ASSET_VALUE} assert_eqw.err="expected asset value at asset index {asset_index} of the note\ {note_index} to be {NOTE_ASSET_VALUE}" - # => [dest_ptr, note_index] + # => [dest_ptr] # move the pointer add.{ASSET_SIZE} - # => [dest_ptr+ASSET_SIZE, note_index] + # => [dest_ptr+ASSET_SIZE] "#, NOTE_ASSET_KEY = asset.to_key_word(), NOTE_ASSET_VALUE = asset.to_value_word(), @@ -1009,8 +1013,8 @@ async fn test_get_assets() -> anyhow::Result<()> { )); } - // drop the final `dest_ptr` and `note_index` from the stack - check_assets_code.push_str("\ndrop drop"); + // drop the final `dest_ptr` from the stack + check_assets_code.push_str("\ndrop"); check_assets_code }