Skip to content

Commit 5e14d51

Browse files
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: [email protected] <[email protected]>
1 parent f58a4e0 commit 5e14d51

File tree

1 file changed

+6
-0
lines changed
  • target_chains/ton/contracts/contracts/common

1 file changed

+6
-0
lines changed

target_chains/ton/contracts/contracts/common/utils.fc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ Note:
7474
}
7575
}
7676

77+
;; Push any remaining data in current_builder after the loop
78+
if (current_builder.builder_bits() > 0) {
79+
cell current_chunk = current_builder.end_cell();
80+
chunk_list~tpush(current_chunk);
81+
}
82+
7783
;; Build forward chain: first chunk → second chunk → third chunk etc
7884
cell result = null();
7985
int chunk_count = chunk_list.tlen();

0 commit comments

Comments
 (0)