Skip to content

refactor(tck): centralize transaction receipt validation in execute_validated helper - #2649

Merged
exploreriii merged 3 commits into
hiero-ledger:mainfrom
Abhijeet2409:refactor/tck-execute-validated
Sep 11, 2026
Merged

exploreriii merged 3 commits into
hiero-ledger:mainfrom
Abhijeet2409:refactor/tck-execute-validated

Conversation

@Abhijeet2409

@Abhijeet2409 Abhijeet2409 commented Sep 9, 2026 •

Copy link
Copy Markdown
Member

Summary

This PR adds the execute_validated helper, along with unit tests, to clarify and centralize the use of validated transaction receipts. This is a pure structural refactor with no intended changes.

Changes

  • All transaction handlers using the transaction execution → receipt validation pattern have been converted to use the helper, and the redundant SUCCESS guards have been removed.
  • In tck/handlers/account.py, create_account now reads receipt.transaction_id instead of response.transaction_id, since execute_validated only returns the receipt. Verified these are equivalent — the receipt's query is seeded with response.transaction_id, so the value is the same.

Testing

1.transaction_utils_test.py — tests for execute_validated, including successful and failed receipt handling.
WhatsApp Image 2026-09-09 at 18 21 27

  1. Full TCK test suite
WhatsApp Image 2026-09-09 at 23 15 20
  1. TCK server with mocked responses — verified that failed receipts are still surfaced as JSON-RPC errors as expected.
WhatsApp Image 2026-09-09 at 23 17 25

Also , Re-checked the codebase before opening the PR to ensure no transaction handlers using the validated receipt pattern were missed.

Fixes #2626

@github-actions github-actions Bot added approved Issue has been approved by team member lang: python Uses Python programming language scope: TCK involves engineering for the implementation of TCK method and module skill: intermediate requires some knowledge of the codebase with some defined steps to implement or examples labels Sep 9, 2026
@Abhijeet2409
Abhijeet2409 marked this pull request as ready for review September 9, 2026 17:40
@Abhijeet2409
Abhijeet2409 requested review from a team as code owners September 9, 2026 17:41
@coderabbitai

coderabbitai Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 897579cc-e7e4-42fa-b5fe-b9a9bd47fd3a

📥 Commits

Reviewing files that changed from the base of the PR and between 043dbb7 and 3565fb1.

📒 Files selected for processing (10)
  • tck/handlers/account.py
  • tck/handlers/allowance.py
  • tck/handlers/contract.py
  • tck/handlers/file.py
  • tck/handlers/schedule.py
  • tck/handlers/token.py
  • tck/handlers/topic.py
  • tck/handlers/transfer.py
  • tck/util/transaction_utils.py
  • tests/tck/transaction_utils_test.py

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


Walkthrough

The TCK adds a shared execute_validated helper and migrates transaction handlers to use it. The helper validates receipt status and propagates failures. Tests cover successful receipt retrieval and ReceiptStatusError propagation.

Changes

Transaction receipt validation

Layer / File(s) Summary
Validated receipt helper and tests
tck/util/transaction_utils.py, tests/tck/transaction_utils_test.py
Adds execute_validated and tests its successful return path and failure propagation.
Core handler migration
tck/handlers/account.py, tck/handlers/allowance.py, tck/handlers/contract.py, tck/handlers/file.py, tck/handlers/schedule.py, tck/handlers/topic.py, tck/handlers/transfer.py
Replaces inline transaction execution and receipt retrieval with execute_validated. Removes redundant success-status guards where receipt fields are present.
Token handler migration
tck/handlers/token.py
Migrates token transaction handlers to execute_validated and removes the unused TransactionReceipt import.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 3565f

Transaction handlers now share validated receipt execution while preserving failed-receipt error behavior and successful response construction. No concrete current-head merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR implements the shared helper, refactors the listed handlers, and adds helper tests. However, the summary indicates that create_account and schedule handlers populate identifiers without preserv… Preserve all required identifier presence checks while removing only redundant SUCCESS checks. Confirm removal of the obsolete contract invariant comment. Run and report at least one driver transaction suite, including validateStatus:false …
Docstring Coverage ⚠️ Warning Docstring coverage is 79.07% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 43 functions across 10 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Out of Scope Changes check ✅ Passed The changes are limited to transaction receipt validation, affected TCK handlers, and focused unit tests. No unrelated changes are identified.
Title check ✅ Passed The title clearly and concisely describes the main change: centralizing transaction receipt validation in the execute_validated helper.
Description check ✅ Passed The description accurately explains the helper, handler refactors, intended behavior preservation, tests, and linked issue. It is directly related to the changeset.
Full details: Linked Issues check

Explanation

The PR implements the shared helper, refactors the listed handlers, and adds helper tests. However, the summary indicates that create_account and schedule handlers populate identifiers without preserving all presence checks, and it provides no evidence of the required driver transaction suite or validateStatus:false receipt-query tests. Removal of the obsolete contract invariant comment is also not confirmed.

Resolution

Preserve all required identifier presence checks while removing only redundant SUCCESS checks. Confirm removal of the obsolete contract invariant comment. Run and report at least one driver transaction suite, including validateStatus:false receipt-query tests, and verify status-name responses and JSON-RPC error mapping remain unchanged.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added open to community review PR is open for community review and feedback queue:junior-committer PR awaiting initial quality review labels Sep 9, 2026

@aceppaluni aceppaluni left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Abhijeet2409 Thank you for this!

When you have a moment, could you take a look at your commits. Commit 1bd415e seems to be missing verification. Attaching a Signing Guide in case you need assistance. Please feel free to reach out if you need further assistance or have any questions.

Thank you!

@aceppaluni
aceppaluni marked this pull request as draft September 9, 2026 21:15
@github-actions github-actions Bot removed queue:junior-committer PR awaiting initial quality review open to community review PR is open for community review and feedback labels Sep 9, 2026
…alidated helper

Signed-off-by: Abhijeet Saharan <abhijeetsaharan2236@gmail.com>
… after hiero-ledger#2611 merge

Signed-off-by: Abhijeet Saharan <abhijeetsaharan2236@gmail.com>
@Abhijeet2409
Abhijeet2409 force-pushed the refactor/tck-execute-validated branch from 3565fb1 to edfe80e Compare September 10, 2026 05:59
@Abhijeet2409
Abhijeet2409 marked this pull request as ready for review September 10, 2026 06:03
@github-actions github-actions Bot added open to community review PR is open for community review and feedback queue:junior-committer PR awaiting initial quality review labels Sep 10, 2026
@github-actions github-actions Bot added queue:committers PR awaiting committer technical review and removed queue:junior-committer PR awaiting initial quality review labels Sep 10, 2026
@aceppaluni aceppaluni added status: update branch developer needs to click update branch status: ready-to-merge PR has 1+ maintainer and 2+ total approvals, ready to merge and removed approved Issue has been approved by team member queue:committers PR awaiting committer technical review open to community review PR is open for community review and feedback labels Sep 10, 2026
@github-actions github-actions Bot added the open to community review PR is open for community review and feedback label Sep 10, 2026
@github-actions github-actions Bot added the approved Issue has been approved by team member label Sep 11, 2026
@exploreriii
exploreriii merged commit 1dd5533 into hiero-ledger:main Sep 11, 2026
26 checks passed
@github-actions

Copy link
Copy Markdown

👋 Hi @Abhijeet2409! Great work completing a Intermediate issue! 🎉

Thanks for your contribution! 🚀

Here are some issues you might want to explore next:

🌟 Stay connected:

Happy coding! 🚀
— Hiero Python SDK Team

@manishdait manishdait added this to the v0.3.0 milestone Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Issue has been approved by team member lang: python Uses Python programming language open to community review PR is open for community review and feedback scope: TCK involves engineering for the implementation of TCK method and module skill: intermediate requires some knowledge of the codebase with some defined steps to implement or examples status: ready-to-merge PR has 1+ maintainer and 2+ total approvals, ready to merge status: update branch developer needs to click update branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(tck): centralize transaction receipt validation in an execute_validated helper

5 participants