Преглед на файлове

fix: handle remaining data in read_and_store_large_data when size > input

- Add logic to push any remaining data in current_builder after main loop
- Fixes edge case where partial cell data would be lost when requested size exceeds available input
- All existing tests pass, maintaining backward compatibility

Co-Authored-By: ayush.suresh@dourolabs.xyz <byteSlayer31037@gmail.com>
Devin AI преди 3 месеца
родител
ревизия
5e14d51ad3
променени са 1 файла, в които са добавени 6 реда и са изтрити 0 реда
  1. 6 0
      target_chains/ton/contracts/contracts/common/utils.fc

+ 6 - 0
target_chains/ton/contracts/contracts/common/utils.fc

@@ -74,6 +74,12 @@ Note:
         }
     }
     
+    ;; Push any remaining data in current_builder after the loop
+    if (current_builder.builder_bits() > 0) {
+        cell current_chunk = current_builder.end_cell();
+        chunk_list~tpush(current_chunk);
+    }
+    
     ;; Build forward chain: first chunk → second chunk → third chunk etc
     cell result = null();
     int chunk_count = chunk_list.tlen();