File tree 1 file changed +13
-1
lines changed
miden-tx/src/tests/kernel_tests
1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -656,6 +656,7 @@ fn test_check_get_item_index() {
656
656
assert_eq ! ( expected_root, result_root) ;
657
657
}
658
658
659
+ /// Check the memory layout after different invocations of the foreign procedure
659
660
#[ test]
660
661
fn test_fpi_memory ( ) {
661
662
// Prepare the test data
@@ -813,15 +814,26 @@ fn test_fpi_memory() {
813
814
814
815
let process = tx_context. execute_code ( & code) . unwrap ( ) ;
815
816
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
816
823
assert_eq ! (
817
824
try_read_root_mem_value( & process, NATIVE_ACCOUNT_DATA_PTR + ACCOUNT_DATA_LENGTH as u32 * 2 ) ,
818
825
None ,
819
826
"Memory starting from 6144 should stay uninitialized"
820
827
) ;
821
828
}
822
829
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.
823
835
#[ test]
824
- fn test_fpi_basic ( ) {
836
+ fn test_fpi_execute_foreign_procedure ( ) {
825
837
let foreign_account_code_source = "
826
838
use.miden::account
827
839
You can’t perform that action at this time.
0 commit comments