-
Notifications
You must be signed in to change notification settings - Fork 75
[Intermediate]: Implement deleteContract in the TCK contract serviceย #1376
Copy link
Copy link
Open
Labels
kind: testingAdding or improving unit tests, integration tests, or test infrastructureAdding or improving unit tests, integration tests, or test infrastructurepriority: mediumNormal priority; to be addressed in the standard development cycleNormal priority; to be addressed in the standard development cycleskill: intermediateRequires familiarity with the codebase structure and SDK conceptsRequires familiarity with the codebase structure and SDK conceptsstatus: ready for devThe issue is fully defined and ready for a contributorThe issue is fully defined and ready for a contributor
Metadata
Metadata
Assignees
Labels
kind: testingAdding or improving unit tests, integration tests, or test infrastructureAdding or improving unit tests, integration tests, or test infrastructurepriority: mediumNormal priority; to be addressed in the standard development cycleNormal priority; to be addressed in the standard development cycleskill: intermediateRequires familiarity with the codebase structure and SDK conceptsRequires familiarity with the codebase structure and SDK conceptsstatus: ready for devThe issue is fully defined and ready for a contributorThe issue is fully defined and ready for a contributor
Type
Fields
Give feedbackNo fields configured for Task.
๐ ๏ธ Intermediate Issue
This issue is a great fit for contributors who are ready to own a solution end-to-end.
Intermediate Issues involve exploring existing patterns, reasoning about trade-offs, and choosing an implementation approach with confidence. You'll navigate multiple related files and explain your decisions in review โ the implementation details are yours to work out.
Important
Prerequisite: You must have completed at least 3 Beginner Issues in this repository before being assigned. The
/assignbot enforces this automatically.๐พ Description of the Task
The Hiero C++ SDK TCK server does not yet implement the
deleteContractJSON-RPC method. This method is required by the TCK test suite to verify that the SDK can correctly delete smart contracts on the Hedera network.The TCK server exposes a JSON-RPC interface that maps incoming method calls to SDK transactions and queries. The contract service scaffolding (
ContractService.h,ContractService.cc) either already exists (from thecreateContractissue) or needs to be created following the same pattern asAccountService.Relevant files to create:
Relevant files to modify:
Reference SDK class:
๐ก Proposed Approach
Follow the existing service pattern established by
AccountServiceandTokenService:DeleteContractParams.hwith anadl_serializerspecialization to deserialize the JSON requestdeleteContractfunction declaration toContractService.hdeleteContractinContractService.ccusingContractDeleteTransactionTckServer.ccand add the explicit template instantiationIf
ContractService.handContractService.ccdo not yet exist, create them first following the pattern ofAccountService.handAccountService.cc, and ensureContractService.ccis listed insrc/tck/CMakeLists.txt.The response should return the transaction
statusstring only (nocontractIdโ the contract being deleted already exists).๐ฉโ๐ป Implementation Steps
src/tck/include/contract/ContractService.handsrc/tck/src/contract/ContractService.ccalready existAccountService.handAccountService.cc, and addsrc/contract/ContractService.cctosrc/tck/CMakeLists.txtsrc/tck/include/contract/params/DeleteContractParams.hwith the following optional fields:mContractId(std::optional<std::string>) โ JSON key"contractId"mTransferAccountId(std::optional<std::string>) โ JSON key"transferAccountId"(account to receive remaining balance)mTransferContractId(std::optional<std::string>) โ JSON key"transferContractId"(contract to receive remaining balance)mCommonTxParams(std::optional<CommonTransactionParams>) โ JSON key"commonTransactionParams"deleteContractdeclaration tosrc/tck/include/contract/ContractService.hdeleteContractinsrc/tck/src/contract/ContractService.cc:ContractDeleteTransactionsetGrpcDeadline(SdkClient::DEFAULT_TCK_REQUEST_TIMEOUT)mContractIdviaContractId::fromStringif presentmTransferAccountIdviaAccountId::fromStringif presentmTransferContractIdviaContractId::fromStringif presentmCommonTxParamsif present viafillOutTransaction{ "status": ... }addMethodcall, and explicit template instantiation forDeleteContractParamstosrc/tck/src/TckServer.cccmake --preset linux-x64-debug && cmake --build --preset linux-x64-debugโ๏ธ Acceptance Criteria
DeleteContractParams.his created following the established params patterndeleteContractis declared inContractService.hand implemented inContractService.ccdeleteContractis registered inTckServer.ccwith its explicit template instantiation๐ Step-by-Step Contribution Guide
/assignto request the issueREADME.md-s -SRead Workflow Guide for step-by-step workflow guidance. Read README.md for setup instructions.
โ Pull requests cannot be merged without
Sandssigned commits. See the Signing Guide.๐ค Additional Information
src/tck/include/account/AccountService.h,src/tck/src/account/AccountService.ccsrc/tck/include/account/params/DeleteAccountParams.hsrc/tests/contract-service/test-contract-delete-transaction.tssrc/sdk/main/include/ContractDeleteTransaction.hIf you have questions while working on this issue, feel free to ask! Hiero-SDK-C++ Discord