Skip to content

feat: implemented topic transaction TCK endpots.#1282

Open
Adityarya11 wants to merge 2 commits intohiero-ledger:mainfrom
Adityarya11:feat/topic-tck-endpt
Open

feat: implemented topic transaction TCK endpots.#1282
Adityarya11 wants to merge 2 commits intohiero-ledger:mainfrom
Adityarya11:feat/topic-tck-endpt

Conversation

@Adityarya11
Copy link
Copy Markdown
Contributor

@Adityarya11 Adityarya11 commented Mar 26, 2026

Description:
Added Topic transaction TCK endpoint.

Related issue(s):

Fixes #1268
Fixes #1269
Fixes #1270
Fixes #1271

Notes for reviewer:
TopicService.cc needs some revision.

Checklist

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

@Adityarya11 Adityarya11 requested review from a team as code owners March 26, 2026 14:01
@Adityarya11 Adityarya11 marked this pull request as draft March 26, 2026 14:01
@Adityarya11 Adityarya11 requested a review from rwalworth March 26, 2026 14:01
@github-actions
Copy link
Copy Markdown

Hey @Adityarya11 👋 thanks for the PR!
I'm your friendly PR Helper Bot 🤖 and I'll be riding shotgun on this one, keeping track of your PR's status to help you get it approved and merged.

This comment updates automatically as you push changes -- think of it as your PR's live scoreboard!
Here's the latest:


PR Checks

DCO Sign-off -- All commits have valid sign-offs. Nice work!


GPG Signature -- All commits have verified GPG signatures. Locked and loaded!


Merge Conflicts -- No merge conflicts detected. Smooth sailing!


Issue Link -- Linked to #1268, #1269, #1270, #1271 (assigned to you).


🎉 All checks passed! Your PR is ready for review. Great job!

@github-actions github-actions bot added the status: needs review The pull request is ready for maintainer review label Mar 26, 2026
@rwalworth rwalworth marked this pull request as ready for review March 28, 2026 14:49
Copy link
Copy Markdown
Contributor

@rwalworth rwalworth left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution @Adityarya11! You're right that TopicService.cc needs some attention - I've left detailed comments below. There's also one cross-cutting blocker I want to call out upfront:

src/tck/CMakeLists.txt is not updated. topic/TopicService.cc must be added as a source file there, otherwise the TCK server won't build. All four issues list this in their acceptance criteria.

Let me know if you have any questions!

Comment on lines +19 to +27
/**
* The ID of the topic to submit the message to.
*/
std::string mTopicId;

/**
* The message content to submit. UTF-8 encoding. Will be automatically chunked if the message exceeds the chunk size.
*/
std::string mMessage;
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.

issue (blocking): Per the TCK spec, both topicId and message should be std::optional<std::string> (using getOptionalJsonParameter in from_json), consistent with how other endpoints handle logically-required fields - the network returns the appropriate error when they're omitted, rather than the JSON-RPC layer rejecting the call upfront.

You'll need to add guards in TopicService.cc when applying these to the transaction.

@rwalworth rwalworth added status: needs revision A pull request that requires changes before merge and removed status: needs review The pull request is ready for maintainer review labels Mar 28, 2026
Signed-off-by: Aditya Arya <arya050411@gmail.com>
Signed-off-by: Aditya Arya <arya050411@gmail.com>
@Adityarya11 Adityarya11 force-pushed the feat/topic-tck-endpt branch from 2b61743 to 4277239 Compare March 28, 2026 18:56
@github-actions github-actions bot added status: needs review The pull request is ready for maintainer review and removed status: needs revision A pull request that requires changes before merge labels Mar 28, 2026
Copy link
Copy Markdown
Contributor

@rwalworth rwalworth left a comment

Choose a reason for hiding this comment

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

Thanks for the updates @Adityarya11 - the second push resolved most of the blocking issues from the first round. One more thing to address before this can merge.

Comment on lines +196 to +210
response["customFees"] = nlohmann::json::array();
for (const auto& fee : info.mCustomFixedFees)
{
nlohmann::json customFeeItem;
customFeeItem["amount"] = std::to_string(fee.getAmount());
if (fee.getDenominatingTokenId().has_value())
{
customFeeItem["denominatingTokenId"] = fee.getDenominatingTokenId().value().toString();
}
if (!(fee.getFeeCollectorAccountId() == AccountId()))
{
customFeeItem["feeCollectorAccountId"] = fee.getFeeCollectorAccountId().toString();
}
response["customFees"].push_back(customFeeItem);
}
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.

issue (blocking): The customFees objects in the getTopicInfo response are serialized manually with a flat structure (amount, denominatingTokenId, feeCollectorAccountId), but the TCK spec for custom fee responses follows the nested format used by CustomFeeSerializer.h - e.g., { "fixedFee": { "amount": "...", "denominatingTokenId": "..." }, "feeCollectorAccountId": "...", "feeCollectorsExempt": ... }. The feeCollectorsExempt field is also missing entirely.

Please align with the serializer format, or at minimum verify against the TCK test expectations at test-topic-info-query.ts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: needs review The pull request is ready for maintainer review

Projects

None yet

2 participants