From aee3dd9776810edac66c2df131586c1d5c92302c Mon Sep 17 00:00:00 2001 From: "Augusto F. Hack" Date: Wed, 3 Jul 2024 16:04:38 +0200 Subject: [PATCH] bugfix: clear the stack on set_map_item --- miden-lib/asm/miden/account.masm | 13 ++++++------- objects/src/testing/account_code.rs | 3 ++- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/miden-lib/asm/miden/account.masm b/miden-lib/asm/miden/account.masm index 30602d1a1..5020ef9a1 100644 --- a/miden-lib/asm/miden/account.masm +++ b/miden-lib/asm/miden/account.masm @@ -101,7 +101,7 @@ export.set_item # => [R', V] end -#! Gets a map item from the account storage. Panics if +#! Gets a map item from the account storage. Panics if #! - the index for the map is out of bounds, means >255 #! - the slot item at index is not a map #! @@ -120,12 +120,12 @@ export.get_map_item # => [VALUE, 0] end -#! Sets a map item in the account storage. Panics if +#! Sets a map item in the account storage. Panics if #! - the index for the map is out of bounds, means >255 #! - the slot item at index is not a map #! #! Stack: [index, KEY, VALUE] -#! Output: [OLD_MAP_ROOT, OLD_MAP_VALUE, 0] +#! Output: [OLD_MAP_ROOT, OLD_MAP_VALUE] #! #! - index is the index of the map where the KEY VALUE should be set. #! - KEY is the key to set at VALUE. @@ -134,11 +134,10 @@ end #! - OLD_MAP_VALUE is the old value at KEY. export.set_map_item syscall.set_account_map_item - # => [OLD_MAP_ROOT, OLD_MAP_VALUE] - - # prepare stack for return - push.0 movdn.9 # => [OLD_MAP_ROOT, OLD_MAP_VALUE, 0] + + movup.8 drop + # => [OLD_MAP_ROOT, OLD_MAP_VALUE] end #! Sets the code of the account the transaction is being executed against. This procedure can only diff --git a/objects/src/testing/account_code.rs b/objects/src/testing/account_code.rs index ed3081299..b0d50bb2f 100644 --- a/objects/src/testing/account_code.rs +++ b/objects/src/testing/account_code.rs @@ -9,7 +9,7 @@ const MASTS: [&str; 11] = [ "0x549d264f00f1a6e90d47284e99eab6d0f93a3d41bb5324743607b6902978a809", "0x704ed1af80a3dae74cd4aabeb4c217924813c42334c2695a74e2702af80a4a35", "0xc25558f483c13aa5be77de4b0987de6a3fab303146fe2fd8ab68b6be8fdcfe76", - "0x7325139fc33f73a547434540abb7579bafeff2224e103678384bf4a81c686697", + "0x5dc65ccf6d32880a8eb47fab75b65d926b701ed80220fe5e88152efffcd656ad", "0x73c14f65d2bab6f52eafc4397e104b3ab22a470f6b5cbc86d4aa4d3978c8b7d4", "0x55036198d82d2af653935226c644427162f12e2a2c6b3baf007c9c6f47462872", "0xf484a84dad7f82e8eb1d5190b43243d02d9508437ff97522e14ebf9899758faa", @@ -17,6 +17,7 @@ const MASTS: [&str; 11] = [ "0xff06b90f849c4b262cbfbea67042c4ea017ea0e9c558848a951d44b23370bec5", "0x8ef0092134469a1330e3c468f57c7f085ce611645d09cc7516c786fefc71d794", ]; + pub const ACCOUNT_SEND_ASSET_MAST_ROOT: &str = MASTS[1]; pub const ACCOUNT_INCR_NONCE_MAST_ROOT: &str = MASTS[2]; pub const ACCOUNT_SET_ITEM_MAST_ROOT: &str = MASTS[3];