Skip to content

Commit 101a5bd

Browse files
committed
chore: add comments, rename test
1 parent 8dcbb7f commit 101a5bd

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

miden-tx/src/tests/kernel_tests/test_tx.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,7 @@ fn test_check_get_item_index() {
656656
assert_eq!(expected_root, result_root);
657657
}
658658

659+
/// Check the memory layout after different invocations of the foreign procedure
659660
#[test]
660661
fn test_fpi_memory() {
661662
// Prepare the test data
@@ -813,15 +814,26 @@ fn test_fpi_memory() {
813814

814815
let process = tx_context.execute_code(&code).unwrap();
815816

817+
// Check that the second invocation of the foreign procedure from the same account does not load
818+
// the account data again: already loaded data should be reused.
819+
//
820+
// Native account: [2048; 4095] <- initialized during prologue
821+
// Foreign account: [4096; 6143] <- initialized during first FPI
822+
// Next account slot: [6144; 8191] <- should not be initialized
816823
assert_eq!(
817824
try_read_root_mem_value(&process, NATIVE_ACCOUNT_DATA_PTR + ACCOUNT_DATA_LENGTH as u32 * 2),
818825
None,
819826
"Memory starting from 6144 should stay uninitialized"
820827
);
821828
}
822829

830+
/// Test the correctness of the foreign procedure execution.
831+
///
832+
/// It checks the foreign account code loading, providing the mast forest to the executor,
833+
/// construction of the account procedure maps and execution the foreign procedure in order to
834+
/// obtain the data from the foreign account's storage slot.
823835
#[test]
824-
fn test_fpi_basic() {
836+
fn test_fpi_execute_foreign_procedure() {
825837
let foreign_account_code_source = "
826838
use.miden::account
827839

0 commit comments

Comments
 (0)