-
Notifications
You must be signed in to change notification settings - Fork 92
feat: Support for chunkingInfo in TopicSubmitMessageTransaction #884
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: Support for chunkingInfo in TopicSubmitMessageTransaction #884
Conversation
d4c8eb9 to
817dc59
Compare
|
Hi, this is WorkflowBot.
|
|
Hi @nadineloepfe @exploreriii, I was debugging the issue that’s causing the above integration tests to fail. The tests run successfully on To address this, I updated the client’s mirror node initialization to use a secure channel only for mainnet/testnet/previewnet and fall back to an insecure channel for solo on my fork: def _init_mirror_stub(self) -> None:
"""
Connect to a mirror node for topic message subscriptions.
We now use self.network.get_mirror_address() for a configurable mirror address.
"""
mirror_address = self.network.get_mirror_address()
if self.network.network in ('mainnet', 'testnet', 'previewnet'):
self.mirror_channel = grpc.secure_channel(mirror_address, grpc.ssl_channel_credentials())
else:
self.mirror_channel = grpc.insecure_channel(mirror_address)
self.mirror_stub = mirror_consensus_grpc.ConsensusServiceStub(self.mirror_channel)I tested this on both testnet and solo, and also ran a solo GitHub Action on my fork. Can you confirm if this is correct, and whether this is the right approach? I’d appreciate your thoughts or suggestions. |
|
Added copilot as reviewer to show it to @exploreriii |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for message chunking in the TopicMessageSubmitTransaction class, enabling the submission of large messages that exceed the single-transaction size limit by automatically splitting them into multiple chunks.
Key Changes:
- Added
chunk_size(default: 1024 bytes) andmax_chunks(default: 20) configuration parameters toTopicMessageSubmitTransaction - Implemented custom
freeze_with()andexecute()methods to handle multi-chunk transaction creation and submission - Updated
TopicMessageandTopicMessageQueryto useTransactionIdobjects instead of string representations for better type safety
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 27 comments.
Show a summary per file
| File | Description |
|---|---|
| src/hiero_sdk_python/consensus/topic_message_submit_transaction.py | Core implementation of message chunking functionality with chunk size/max chunks configuration, transaction ID generation per chunk, and multi-chunk execution logic |
| src/hiero_sdk_python/consensus/topic_message.py | Updated to use TransactionId objects instead of string-based transaction IDs for better type consistency |
| src/hiero_sdk_python/query/topic_message_query.py | Modified chunk tracking to use TransactionId objects as dictionary keys instead of strings for improved type safety |
| tests/unit/test_topic_message_submit_transaction.py | Added unit tests for new chunk_size and max_chunks setters, constructor parameters, and method chaining |
| tests/integration/topic_message_submit_transaction_e2e_test.py | Added comprehensive integration tests including large message submission, submit key validation, chunking limit validation, and refactored existing tests with helper functions |
| tests/integration/topic_message_qurey_e2e_test.py | New integration tests for topic message query functionality with chunking support (note: filename contains typo) |
| examples/consensus/topic_message_submit_chunked.py | New example demonstrating chunked message submission with a large Lorem Ipsum text |
| examples/consensus/topic_message.py | Updated mock classes to align with new TransactionId usage |
| CHANGELOG.md | Added entry documenting the chunking support feature |
Comments suppressed due to low confidence (1)
src/hiero_sdk_python/consensus/topic_message_submit_transaction.py:38
- The docstring for
__init__is incomplete - it doesn't document the newchunk_sizeandmax_chunksparameters that were added to the constructor.
"""
Initializes a new TopicMessageSubmitTransaction instance.
Args:
topic_id (Optional[TopicId]): The ID of the topic.
message (Optional[str]): The message to submit.
"""
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ) | ||
| topic_id = topic_receipt.topic_id | ||
|
|
||
| print(f"Topic created: {topic_id}: {topic_id}") |
Copilot
AI
Nov 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant output in print statement. The line prints {topic_id}: {topic_id} which displays the topic_id twice. It should be print(f"Topic created: {topic_id}") instead.
| print(f"Topic created: {topic_id}: {topic_id}") | |
| print(f"Topic created: {topic_id}") |
| ) | ||
|
|
||
| info = TopicInfoQuery(topic_id=topic_id).execute(env.client) | ||
| # Check that no message is submited |
Copilot
AI
Nov 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in comment: "submited" should be "submitted".
| Set maximum allowed chunks. | ||
| Args: | ||
| mac_chunks (int): The maximum number of chunks allowed. |
Copilot
AI
Nov 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in docstring: "mac_chunks" should be "max_chunks" in the Args documentation.
| mac_chunks (int): The maximum number of chunks allowed. | |
| max_chunks (int): The maximum number of chunks allowed. |
|
|
||
| print(f"Message submitted (status={ResponseCode(message_receipt.status)}, txId={message_receipt.transaction_id})") | ||
| print(f"Message size:", len(BIG_CONTENT), "bytes") | ||
| print(f"Message Content: {(BIG_CONTENT[:140] + "...") if len(BIG_CONTENT) > 40 else BIG_CONTENT}") |
Copilot
AI
Nov 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent condition in message content display. Line 113 displays the first 140 characters if the message length is greater than 40, but the condition len(BIG_CONTENT) > 40 doesn't align with the slice BIG_CONTENT[:140]. This should be len(BIG_CONTENT) > 140 to match the slice length.
| print(f"Message Content: {(BIG_CONTENT[:140] + "...") if len(BIG_CONTENT) > 40 else BIG_CONTENT}") | |
| print(f"Message Content: {(BIG_CONTENT[:140] + "...") if len(BIG_CONTENT) > 140 else BIG_CONTENT}") |
src/hiero_sdk_python/consensus/topic_message_submit_transaction.py
Outdated
Show resolved
Hide resolved
sooo your workaround works, great idea! But I've looked into the JS SDK, and they do it slightly different - see here in NodeMirrorChannel.js: so the TLS Decision Logic is basically port based.
The network type determines which addresses/ports are used (in ClientConstants.js). so if we want to do the same in the Python SDK, we'd have to do smth like: That said, the network name approach is also valid and will work |
|
@nadineloepfe, Thanks for confirming, I’ll update the Python SDK implementation to follow the same pattern:
That should match the behavior in the JS SDK |
845a937 to
f3c664a
Compare
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
…tx receipt Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
87adced to
19aeee3
Compare
Description:
This PR introduce the support for chunking in TopicSubmitMessageTransaction class.
Changes Added:
chunk_sizeandmax_chunksfields to TopicSubmitMessage.freeze_with()andexecute()method to perform chuncked transaction.Related issue(s):
Fixes #861
Notes for reviewer:
Checklist