Skip to content

Commit

Permalink
bugfix: clear the stack on set_map_item
Browse files Browse the repository at this point in the history
  • Loading branch information
hackaugusto committed Jul 3, 2024
1 parent 89437d1 commit 8ec7758
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions miden-lib/asm/miden/account.masm
Original file line number Diff line number Diff line change
Expand Up @@ -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
#!
Expand All @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit 8ec7758

Please sign in to comment.