Skip to content
4 changes: 3 additions & 1 deletion .github/workflows/zxc-build-library.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ jobs:
uses: hiero-ledger/hiero-solo-action@10ec96a107b8d2f5cd26b3e7ab47e65407b5c462 # v0.11.0
with:
installMirrorNode: true
hieroVersion: v0.61.4
hieroVersion: v0.65.0
mirrorNodeVersion: v0.136.1


- name: Start CTest suite (Debug)
run: ${{ steps.cgroup.outputs.exec }} ctest -j 6 -C Debug --test-dir build/${{ matrix.preset }}-debug --output-on-failure
Expand Down
2 changes: 1 addition & 1 deletion src/sdk/main/include/TopicMessageSubmitTransaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class TopicMessageSubmitTransaction : public ChunkedTransaction<TopicMessageSubm
*
* @return A vector containing the current custom fee limits.
*/
[[nodiscard]] std::vector<CustomFeeLimit> getCustomFeeLimits() const;
[[nodiscard]] inline std::vector<CustomFeeLimit> getCustomFeeLimits() const { return mCustomFeeLimits; }

private:
friend class WrappedTransaction;
Expand Down
26 changes: 13 additions & 13 deletions src/sdk/main/src/TopicMessageSubmitTransaction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ void TopicMessageSubmitTransaction::validateChecksums(const Client& client) cons
void TopicMessageSubmitTransaction::addToBody(proto::TransactionBody& body) const
{
body.set_allocated_consensussubmitmessage(build());

// Add custom fee limits to the transaction body
for (const auto& fee : mCustomFeeLimits)
{
body.mutable_max_custom_fees()->AddAllocated(fee.toProtobuf().release());
}
}

//-----
Expand All @@ -104,10 +110,6 @@ void TopicMessageSubmitTransaction::addToChunk(uint32_t chunk, uint32_t total, p
body.set_allocated_consensussubmitmessage(build(static_cast<int>(chunk)));
body.mutable_consensussubmitmessage()->mutable_chunkinfo()->set_allocated_initialtransactionid(
getTransactionId().toProtobuf().release());
for (const auto& fee : mCustomFeeLimits)
{
body.mutable_max_custom_fees()->AddAllocated(fee.toProtobuf().release());
}
body.mutable_consensussubmitmessage()->mutable_chunkinfo()->set_number(static_cast<int32_t>(chunk + 1));
body.mutable_consensussubmitmessage()->mutable_chunkinfo()->set_total(static_cast<int32_t>(total));
}
Expand All @@ -128,6 +130,13 @@ void TopicMessageSubmitTransaction::initFromSourceTransactionBody()
mTopicId = TopicId::fromProtobuf(body.topicid());
}

// Read custom fee limits from the transaction body
mCustomFeeLimits.clear();
for (const auto& protoFeeLimit : transactionBody.max_custom_fees())
{
mCustomFeeLimits.push_back(CustomFeeLimit::fromProtobuf(protoFeeLimit));
}

// Construct the data from the various Transaction protobuf objects.
std::string data;
bool dataStillExists = true;
Expand All @@ -151,15 +160,6 @@ void TopicMessageSubmitTransaction::initFromSourceTransactionBody()
proto::TransactionBody txBody;
txBody.ParseFromArray(signedTx.bodybytes().data(), static_cast<int>(signedTx.bodybytes().size()));

// Should also set the custom fee limits but only once as every chunk would contain the limits.
if (mCustomFeeLimits.empty())
{
for (const auto& feeLimit : txBody.max_custom_fees())
{
mCustomFeeLimits.push_back(CustomFeeLimit::fromProtobuf(feeLimit));
}
}

data += txBody.consensussubmitmessage().message();
}

Expand Down
32 changes: 31 additions & 1 deletion src/sdk/main/src/WrappedTransaction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,12 @@ WrappedTransaction WrappedTransaction::fromProtobuf(const proto::SchedulableTran
txBody.set_memo(proto.memo());
txBody.set_transactionfee(proto.transactionfee());

// Copy custom fee limits from the schedulable transaction body
if (proto.max_custom_fees_size() > 0)
{
*txBody.mutable_max_custom_fees() = proto.max_custom_fees();
}

if (proto.has_cryptoapproveallowance())
{
*txBody.mutable_cryptoapproveallowance() = proto.cryptoapproveallowance();
Expand Down Expand Up @@ -1022,12 +1028,36 @@ std::unique_ptr<proto::Transaction> WrappedTransaction::toProtobufTransaction()
//-----
std::unique_ptr<proto::SchedulableTransactionBody> WrappedTransaction::toSchedulableProtobuf() const
{
proto::TransactionBody txBody = *toProtobuf();
// Use source transaction body directly to avoid rebuilding and duplicating custom fee limits
// Get the existing source transaction body without calling updateSourceTransactionBody() which
// would duplicate custom fee limits.
proto::TransactionBody txBody;
switch (getTransactionType())
{
case TOPIC_MESSAGE_SUBMIT_TRANSACTION:
{
const auto transaction = getTransaction<TopicMessageSubmitTransaction>();
txBody = transaction->getSourceTransactionBody();
break;
}
default:
{
// For other transaction types, fall back to the original behavior
txBody = *toProtobuf();
break;
}
}

auto schedulableTxBody = std::make_unique<proto::SchedulableTransactionBody>();
schedulableTxBody->set_transactionfee(txBody.transactionfee());
schedulableTxBody->set_memo(txBody.memo());

// Copy custom fee limits from the transaction body
if (txBody.max_custom_fees_size() > 0)
{
*schedulableTxBody->mutable_max_custom_fees() = txBody.max_custom_fees();
}

if (txBody.has_cryptoapproveallowance())
{
schedulableTxBody->set_allocated_cryptoapproveallowance(txBody.release_cryptoapproveallowance());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ TEST_F(ContractNonceInfoIntegrationTests, ContractADeploysContractBInConstructor
TransactionResponse response;
ASSERT_NO_THROW(response = ContractCreateTransaction()
.setAdminKey(operatorKey->getPublicKey())
.setGas(100000ULL)
.setGas(1000000ULL)
.setBytecodeFileId(fileId)
.setMemo(memo)
.execute(getTestClient()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ TEST_F(SystemDeleteTransactionIntegrationTests, DeleteContract)
ASSERT_NO_THROW(contractId =
ContractCreateTransaction()
.setAdminKey(operatorKey)
.setGas(100000ULL)
.setGas(1000000ULL)
.setConstructorParameters(ContractFunctionParameters().addString("Hello from Hiero.").toBytes())
.setBytecodeFileId(fileId)
.execute(getTestClient())
Expand Down
Loading
Loading