Problem
The TCK server does not implement updateFile, so the TCK driver's FileUpdateTransaction suite cannot run against the Python SDK. The SDK transaction (src/hiero_sdk_python/file/file_update_transaction.py) already exists with all needed setters: set_file_id, set_keys, set_expiration_time, set_contents, set_file_memo.
Blocked by hiero-ledger#2488 (createFile) — this handler goes in the file-service TCK modules hiero-ledger#2488 creates, and the driver needs a created file to update. Use hiero-ledger#2489 (getFileContents) / hiero-ledger#2490 (getFileInfo) to verify update results end-to-end.
Solution
Add an updateFile handler wrapping FileUpdateTransaction. Structurally identical to the createFile handler from hiero-ledger#2488, plus fileId, returning status only.
Method contract (from the spec): all inputs optional.
| Input |
Type |
Notes |
fileId |
string |
File to update |
keys |
string[] |
DER-encoded hex; threshold keys not allowed for update (unlike create) |
contents |
string |
New contents; empty string means "leave unchanged" |
expirationTime |
string |
Seconds since epoch; must be strictly later than current |
memo |
string |
UTF-8, max 100 bytes |
commonTransactionParams |
object |
|
Output: status — reuse StatusOnlyResponse from tck/response/base.py; no new response class needed.
Implementation steps:
- Add
UpdateFileParams(BaseTransactionParams) to tck/param/file.py — mirror CreateFileParams plus fileId.
- Add the handler to
tck/handlers/file.py: parse fileId via FileId.from_string(), map the rest as in createFile, execute, return StatusOnlyResponse(ResponseCode(receipt.status).name).
- Add a unit test under
tests/tck/.
Details that matter:
contents="" must NOT clear the file. Per the spec, empty string means content unchanged — so parse with non_empty_string_or_none() (tck/util/param_utils.py) so "" becomes None and set_contents is never called with it. Add a comment explaining this, since it looks like a bug otherwise.
expirationTime validation is server-side — the network rejects non-increasing values; don't validate client-side, let the error propagate.
- Threshold keys are disallowed by the spec for update but
get_key_from_string() won't reject them — the network will. Acceptable; note it in the PR.
- Only call setters for non-
None params: the spec distinguishes omitted fields (unchanged) from set fields.
Acceptance criteria
Spec: https://github.com/hiero-ledger/hiero-sdk-tck/blob/main/docs/test-specifications/file-service/FileUpdateTransaction.md
JS reference: https://github.com/hiero-ledger/hiero-sdk-js/blob/main/tck/methods/file.ts (updateFile)
Problem
The TCK server does not implement
updateFile, so the TCK driver'sFileUpdateTransactionsuite cannot run against the Python SDK. The SDK transaction (src/hiero_sdk_python/file/file_update_transaction.py) already exists with all needed setters:set_file_id,set_keys,set_expiration_time,set_contents,set_file_memo.Blocked by hiero-ledger#2488 (
createFile) — this handler goes in the file-service TCK modules hiero-ledger#2488 creates, and the driver needs a created file to update. Use hiero-ledger#2489 (getFileContents) / hiero-ledger#2490 (getFileInfo) to verify update results end-to-end.Solution
Add an
updateFilehandler wrappingFileUpdateTransaction. Structurally identical to thecreateFilehandler from hiero-ledger#2488, plusfileId, returning status only.Method contract (from the spec): all inputs optional.
fileIdkeyscontentsexpirationTimememocommonTransactionParamsOutput:
status— reuseStatusOnlyResponsefromtck/response/base.py; no new response class needed.Implementation steps:
UpdateFileParams(BaseTransactionParams)totck/param/file.py— mirrorCreateFileParamsplusfileId.tck/handlers/file.py: parsefileIdviaFileId.from_string(), map the rest as increateFile, execute, returnStatusOnlyResponse(ResponseCode(receipt.status).name).tests/tck/.Details that matter:
contents=""must NOT clear the file. Per the spec, empty string means content unchanged — so parse withnon_empty_string_or_none()(tck/util/param_utils.py) so""becomesNoneandset_contentsis never called with it. Add a comment explaining this, since it looks like a bug otherwise.expirationTimevalidation is server-side — the network rejects non-increasing values; don't validate client-side, let the error propagate.get_key_from_string()won't reject them — the network will. Acceptable; note it in the PR.Noneparams: the spec distinguishes omitted fields (unchanged) from set fields.Acceptance criteria
updateFileregistered and dispatchablecontents=""leaves file content unchanged (verified viagetFileContents)fileIdformat → SDK internal error; non-existent ID → networkINVALID_FILE_IDuv run pytest tests/tck -qpassesSpec: https://github.com/hiero-ledger/hiero-sdk-tck/blob/main/docs/test-specifications/file-service/FileUpdateTransaction.md
JS reference: https://github.com/hiero-ledger/hiero-sdk-js/blob/main/tck/methods/file.ts (
updateFile)