Skip to content

Commit

Permalink
refactor: rename update_expiration_block_num to `update_expiration_…
Browse files Browse the repository at this point in the history
…delta`
  • Loading branch information
tomyrd committed Oct 21, 2024
1 parent cde0f6c commit 293f9d4
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 61 deletions.
22 changes: 11 additions & 11 deletions miden-lib/asm/kernels/transaction/api.masm
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ proc.authenticate_account_origin
end

#! Verifies that the procedure to be invoked against the foreign account is part of its code.
#! TODO: it is a temporary solution. This and other `*_foreign` procedures should be removed after
#! the refactoring of the `DYN` operation (see miden-vm/#1091) and the fix of the CALLER operation.
#! TODO: it is a temporary solution. This and other `*_foreign` procedures should be removed after
#! the refactoring of the `DYN` operation (see miden-vm/#1091) and the fix of the CALLER operation.
#!
#! Stack: [FOREIGN_PROC_ROOT]
#! Output: [storage_offset, storage_size, ...]
Expand Down Expand Up @@ -230,7 +230,7 @@ end
#!
#! Where:
#! - KERNEL_PROCEDURE_HASH is the hash of this procedure.
#! - FOREIGN_PROC_ROOT is the hash of the foreign procedure which called this procedure.
#! - FOREIGN_PROC_ROOT is the hash of the foreign procedure which called this procedure.
#! - index is the index of the item to get.
#! - VALUE is the value of the item.
#!
Expand Down Expand Up @@ -356,7 +356,7 @@ end
#! Panics if:
#! - the index is out of bounds (>255).
#! - the requested storage slot type is not map
export.get_account_map_item_foreign
export.get_account_map_item_foreign
# drop the procedure's hash
dropw
# => [FOREIGN_PROC_ROOT, index, KEY, pad(6)]
Expand Down Expand Up @@ -976,10 +976,10 @@ end
#! - account_nonce is the nonce of the foreign account.
#! - VAULT_ROOT is the commitment of the foreign account's vault.
#! - STORAGE_ROOT is the commitment of the foreign account's storage.
#! - STORAGE_SLOT_DATA is the data contained in the storage slot which is constructed as follows:
#! - STORAGE_SLOT_DATA is the data contained in the storage slot which is constructed as follows:
#! [SLOT_VALUE, slot_type, 0, 0, 0]
#! - CODE_ROOT is the commitment of the foreign account's code.
#! - ACCOUNT_PROCEDURE_DATA is the information about account procedure which is constructed as
#! - ACCOUNT_PROCEDURE_DATA is the information about account procedure which is constructed as
#! follows: [PROCEDURE_MAST_ROOT, storage_offset, 0, 0, 0]
#!
#! Panics if:
Expand Down Expand Up @@ -1014,7 +1014,7 @@ export.start_foreign_context
# AS => [[foreign_account_id, 0, 0, account_nonce], VAULT_ROOT, STORAGE_ROOT, CODE_ROOT]

# store the id and nonce of the foreign account to the memory
dropw adv_loadw
dropw adv_loadw
exec.memory::set_acct_id_and_nonce dropw
# OS => []
# AS => [VAULT_ROOT, STORAGE_ROOT, CODE_ROOT]
Expand All @@ -1024,7 +1024,7 @@ export.start_foreign_context
# OS => []
# AS => [STORAGE_ROOT, CODE_ROOT]

# move the storage root and the code root to the operand stack
# move the storage root and the code root to the operand stack
adv_loadw padw adv_loadw
# OS => [CODE_ROOT, STORAGE_ROOT]
# AS => []
Expand All @@ -1050,7 +1050,7 @@ export.start_foreign_context
# AS => []
end

# make sure that the state of the loaded foreign account corresponds to this commitment in the
# make sure that the state of the loaded foreign account corresponds to this commitment in the
# account database
exec.account::validate_current_foreign_account
# => []
Expand Down Expand Up @@ -1081,8 +1081,8 @@ end
#!
#! Where:
#! - block_height_delta is the desired expiration time delta (1 to 0xFFFF).
export.update_expiration_block_num
exec.tx::update_expiration_block_num
export.update_expiration_delta
exec.tx::update_expiration_delta
end

#! Gets the transaction expiration delta.
Expand Down
12 changes: 6 additions & 6 deletions miden-lib/asm/kernels/transaction/lib/tx.masm
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const.NOTE_AFTER_CREATED_EVENT=131084
const.NOTE_BEFORE_ADD_ASSET_EVENT=131085
# Event emitted after an ASSET is added to a note
const.NOTE_AFTER_ADD_ASSET_EVENT=131086

#! Returns the block hash of the reference block to memory.
#!
#! Stack: []
Expand Down Expand Up @@ -189,14 +189,14 @@ end
#!
#! The input block_height_delta is added to the block reference number in order to output an upper
#! limit at which the transaction will be considered valid (not expired).
#! This value can be later decreased, but not increased.
#! This value can be later decreased, but not increased.
#!
#! Inputs: [block_height_delta, ...]
#! Output: [...]
#!
#! Where:
#! - block_height_delta is the desired expiration time delta (1 to 0xFFFF).
export.update_expiration_block_num
export.update_expiration_delta
# Ensure block_height_delta is between 1 and 0xFFFF (inclusive)
dup neq.0 assert.err=ERR_TX_INVALID_EXPIRATION_DELTA
dup push.EXPIRY_UPPER_LIMIT lt assert.err=ERR_TX_INVALID_EXPIRATION_DELTA
Expand All @@ -206,16 +206,16 @@ export.update_expiration_block_num
# => [absolute_expiration_num]

# Load the current stored delta from memory
dup exec.memory::get_expiration_block_num
dup exec.memory::get_expiration_block_num
# => [stored_expiration_block_num, absolute_expiration_num, absolute_expiration_num]

# Check if block_height_delta is greater
u32lt
if.true
# Set new expiration delta
exec.memory::set_expiration_block_num
exec.memory::set_expiration_block_num
else
drop
drop
end
end

Expand Down
Loading

0 comments on commit 293f9d4

Please sign in to comment.