Skip to content

feat: auto-chunk oversized FileUpdate contents via ExecuteAll - #1787

Closed
Dosik13 wants to merge 3 commits into
mainfrom
feat/file-update-autochunk
Closed

feat: auto-chunk oversized FileUpdate contents via ExecuteAll#1787
Dosik13 wants to merge 3 commits into
mainfrom
feat/file-update-autochunk

Conversation

@Dosik13

@Dosik13 Dosik13 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Description:

Add opt-in auto-chunking to FileUpdateTransaction, mirroring FileAppendTransaction, so files larger than a single transaction can be updated without hand-writing the FileUpdate + FileAppend two-step. SetContents previously sent one transaction, so contents over the ~6 KiB single-transaction limit were rejected with TRANSACTION_OVERSIZE.

  • Add FileUpdateTransaction.ExecuteAll, which overwrites the file with the first chunk and appends the remainder, so contents over the single-transaction limit can be updated in one call; it returns the FileUpdate response followed by one response per append chunk
  • Add SetMaxChunks/GetMaxChunks and SetMaxChunkSize/GetMaxChunkSize (defaults 20 / 2048, matching FileAppendTransaction)
  • Guard Schedule() so chunked contents (more than one chunk) return ErrMaxChunksExceeded, mirroring FileAppendTransaction.Schedule
  • Add errFileUpdateChunkingRequiresFileID / errFileUpdateChunkingRequiresUnfrozen sentinels for the chunking preconditions
  • Keep Execute single-transaction semantics unchanged (still returns TRANSACTION_OVERSIZE for oversized contents)
  • Extend the existing file_update_transaction_unit_test.go / _e2e_test.go with chunking tests (chunk-count math, boundary, guards, scheduling; >6 KiB round-trip verified via FileContentsQuery and FileInfoQuery, plus a single-chunk case), and add an examples/file_update_chunked example

Related issue(s):

Fixes #

Notes for reviewer:

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

Dosik13 added 3 commits July 21, 2026 13:38
Signed-off-by: dosi <dosi.kolev@limechain.tech>
Signed-off-by: dosi <dosi.kolev@limechain.tech>
Signed-off-by: dosi <dosi.kolev@limechain.tech>
@lfdt-bot

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.53846% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
sdk/file_update_transaction.go 81.53% 6 Missing and 6 partials ⚠️
Files with missing lines Coverage Δ
sdk/errors.go 65.51% <ø> (ø)
sdk/file_update_transaction.go 89.75% <81.53%> (-5.34%) ⬇️

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Dosik13 Dosik13 closed this Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants