feat(tck): add token grant/revoke KYC handlers#2433
Conversation
|
While working on this issue, I noticed both handlers were missing from the TCK. Since the implementations are analogous and the SDK support already exists, I included both to keep the TCK handlers consistent. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (7)
WalkthroughAdds ChangesToken KYC Operations
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant JSONRPC
participant TokenHandlers
participant HederaSDK
participant Receipt
JSONRPC->>TokenHandlers: grantTokenKyc or revokeTokenKyc parameters
TokenHandlers->>HederaSDK: build transaction with optional tokenId and accountId
TokenHandlers->>HederaSDK: execute transaction
HederaSDK->>Receipt: obtain receipt
Receipt-->>TokenHandlers: transaction status
TokenHandlers-->>JSONRPC: status-only response
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
📋 Issue PlannerBuilt with CodeRabbit's Coding Plans for faster development and fewer bugs. View plan used: ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: f211aad9-41fc-47b3-9c96-27e75b43d186
📒 Files selected for processing (1)
tests/tck/token_kyc_handlers_test.py
|
While testing, I noticed two pre-existing issues unrelated to this PR: (1) get_client() silently returns None for an unknown sessionId, leading to a misleading downstream error, and (2) the clear_handlers test fixture can affect other tests depending on collection order. I kept this PR focused on the KYC handlers, but I'm happy to open follow-up issues for these if that would be helpful |
|
Thanks for wiring these up, the param/response models and builder pattern look correct and match the existing freezeToken/pauseToken handlers. Before moving ahead, could you confirm whether you ran the hiero-sdk-tck conformance suite locally against this server for grantTokenKyc/revokeTokenKyc? Per the test spec, each method has 17 test cases....13 covering tokenId (invalid, empty, missing, deleted token, unsigned/wrong-key signatures, no KYC key, not associated, paused token, frozen account) and 4 covering accountId (nonexistent, empty, missing, deleted account). Matching the existing pattern and passing type checks doesn't guarantee those pass. |
|
thanks for the thorough review and for pointing out the distinction. I only ran the repository's local pytest suite , which covers parameter parsing, transaction building, mocked end-to-end dispatch, and error handling. I haven't yet run the full hiero-sdk-tck conformance suite against a local node or testnet, so I can't yet confirm all 17 TCK scenarios pass. I'll set up hiero-local-node, run the TCK client for grantTokenKyc and revokeTokenKyc, and update this thread with the results. If any scenarios fail, I'll address them in this PR. One possible issue is that the JSON-RPC layer currently wraps some exceptions into a generic internal error, which could affect TCK expectations even if the underlying transaction is correct. I'll note whether that's the cause in my follow-up. |
Thanks for contributing this, @iron-prog And appreciate the honest update on testing that's exactly the right way to handle it. Thanks for being upfront about where things stand instead of just checking the box, and for taking the extra step to spin up hiero-local-node and run the actual TCK client rather than stopping at the unit tests. Your hunch about the generic internal-error wrapping is worth chasing, if the TCK driver expects a specific response code back and the JSON-RPC layer is flattening it to a generic internal error, that would explain a failure even when the underlying transaction logic is correct. Good instinct to check that first. No rush take the time you need to run it properly, and just ping the thread when you've got results. |
|
Quick update: I managed to get the
With the ECDSA workaround applied locally, I was able to verify that |
|
@iron-prog Thank you for the update! Going to convert this to draft while the work is still going. |
manishdait
left a comment
There was a problem hiding this comment.
@iron-prog, Thanks for the PR. added some requested changes :)
8578522 to
bf5d07d
Compare
|
@manishdait I managed to run the full |
|
@iron-prog, that happen when we use the testnet for the tck test. I can verify the changes against solo. once you address the changes. |
bf5d07d to
5d01e66
Compare
Signed-off-by: iron-prog <dt915725@gmail.com>
…on-building helpers, full end-to-end dispatch against a mocked network, and robustness checks for unknown sessionId / wrong-type params (confirmed against freezeToken as a control - pre-existing TCK-layer behavior) Signed-off-by: iron-prog <dt915725@gmail.com>
Signed-off-by: iron-prog <dt915725@gmail.com>
Signed-off-by: iron-prog <dt915725@gmail.com>
5d01e66 to
205a8e8
Compare
|
Hello, this is the OfficeHourBot. This is a reminder that the Hiero Python SDK Office Hours will begin in approximately 3 hours and 28 minutes (14:00 UTC). This session provides an opportunity to ask questions regarding this Pull Request. Details:
Disclaimer: This is an automated reminder. Please verify the schedule here for any changes. From, |
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #2433 +/- ##
=======================================
Coverage 94.99% 94.99%
=======================================
Files 164 164
Lines 10447 10449 +2
=======================================
+ Hits 9924 9926 +2
Misses 523 523 🚀 New features to boost your workflow:
|
|
👋 Hi @iron-prog! Great work completing a Good First Issue issue! 🎉 Thanks for your contribution! 🚀 Here are some issues you might want to explore next:
🌟 Stay connected: Happy coding! 🚀 |
Description:
Add TCK JSON-RPC support for
grantTokenKycandrevokeTokenKyc.grantTokenKycTCK handlerrevokeTokenKycTCK handlerRelated issue(s):
Fixes #2422
Notes for reviewer:
Both
TokenGrantKycTransactionandTokenRevokeKycTransactionare already implemented in the Python SDK. This PR wires them into the TCK by adding the corresponding JSON-RPC handlers, request parameter models, and response models, following the existing implementation used by other token operations.Checklist