Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: clear the stack on set_map_item #785

Merged
merged 1 commit into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
3 changes: 2 additions & 1 deletion objects/src/testing/account_code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ const MASTS: [&str; 11] = [
"0x549d264f00f1a6e90d47284e99eab6d0f93a3d41bb5324743607b6902978a809",
"0x704ed1af80a3dae74cd4aabeb4c217924813c42334c2695a74e2702af80a4a35",
"0xc25558f483c13aa5be77de4b0987de6a3fab303146fe2fd8ab68b6be8fdcfe76",
"0x7325139fc33f73a547434540abb7579bafeff2224e103678384bf4a81c686697",
"0x5dc65ccf6d32880a8eb47fab75b65d926b701ed80220fe5e88152efffcd656ad",
"0x73c14f65d2bab6f52eafc4397e104b3ab22a470f6b5cbc86d4aa4d3978c8b7d4",
"0x55036198d82d2af653935226c644427162f12e2a2c6b3baf007c9c6f47462872",
"0xf484a84dad7f82e8eb1d5190b43243d02d9508437ff97522e14ebf9899758faa",
"0xf17acfc7d1eff3ecadd7a17b6d91ff01af638aa9439d6c8603c55648328702ae",
"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];
Expand Down
Loading