Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/zxc-build-library.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ jobs:
solo node keys -i node1 --gossip-keys --tls-keys
solo cluster setup
solo network deploy -i node1 -n solo-e2e
solo node setup -i node1 -n solo-e2e -t v0.59.0
solo node setup -i node1 -n solo-e2e -t v0.60.0-alpha.0
solo node start -i node1 -n solo-e2e
kubectl port-forward svc/haproxy-node1-svc -n "${SOLO_NAMESPACE}" 50211:50211 &
solo mirror-node deploy -n "${SOLO_NAMESPACE}" --pinger true
Expand Down
4 changes: 2 additions & 2 deletions HieroApi.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
set(HAPI_VERSION_TAG "v0.59.0" CACHE STRING "Use the configured version tag for the Hiero API protobufs")
set(HAPI_VERSION_TAG "v0.60.0-alpha.0" CACHE STRING "Use the configured version tag for the Hiero API protobufs")

if (HAPI_VERSION_TAG STREQUAL "")
set(HAPI_VERSION_TAG "v0.59.0")
set(HAPI_VERSION_TAG "v0.60.0-alpha.0")
endif ()

# Fetch the protobuf definitions
Expand Down
5 changes: 5 additions & 0 deletions proto/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ set(PROTO_FILES
util_prng.proto
util_service.proto

auxiliary/hints/crs_publication.proto
auxiliary/hints/hints_key_publication.proto
auxiliary/hints/hints_partial_signature.proto
auxiliary/hints/hints_preprocessing_vote.proto
auxiliary/history/history_proof_signature.proto
auxiliary/history/history_proof_key_publication.proto
auxiliary/history/history_proof_vote.proto
Expand All @@ -118,6 +122,7 @@ set(PROTO_FILES

event/state_signature_transaction.proto

state/hints/hints_types.proto
state/history/history_types.proto

mirror/consensus_service.proto
Expand Down
9 changes: 9 additions & 0 deletions src/sdk/main/include/TokenCreateTransaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,12 @@ class TokenCreateTransaction : public Transaction<TokenCreateTransaction>
/**
* Set the desired expiration time for the new token.
*
* If autoRenewPeriod is set - this value will be ignored and the expiration
* time will be calculated based on: autoRenewPeriod + currentTime
*
* Setting this value will clear the autoRenewPeriod as the autoRenewPeriod period has
* a default value of 7890000 seconds and leaving it set will override the expiration time.
*
* @param expiration The desired expiration time for the new token.
* @return A reference to this TokenCreateTransaction with the newly-set default expiration time.
*/
Expand All @@ -170,6 +176,9 @@ class TokenCreateTransaction : public Transaction<TokenCreateTransaction>
/**
* Set the desired auto-renew period for the new token.
*
* If expirationTime is set - autoRenewPeriod will be effectively ignored and
* it's effect will be replaced by expirationTime
*
* @param period The desired auto-renew period for the new token.
* @return A reference to this TokenCreateTransaction with the newly-set auto-renew period.
*/
Expand Down
6 changes: 6 additions & 0 deletions src/sdk/main/src/TokenCreateTransaction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,12 @@ void TokenCreateTransaction::validateChecksums(const Client& client) const
void TokenCreateTransaction::addToBody(proto::TransactionBody& body) const
{
body.set_allocated_tokencreation(build());

if (body.has_transactionid() && !body.tokencreation().has_autorenewaccount())
{
std::unique_ptr<proto::AccountID> accountId = std::make_unique<proto::AccountID>(body.transactionid().accountid());
body.mutable_tokencreation()->set_allocated_autorenewaccount(accountId.release());
}
}

//-----
Expand Down
6 changes: 6 additions & 0 deletions src/sdk/main/src/TopicCreateTransaction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ void TopicCreateTransaction::validateChecksums(const Client& client) const
void TopicCreateTransaction::addToBody(proto::TransactionBody& body) const
{
body.set_allocated_consensuscreatetopic(build());

if (body.has_transactionid() && !body.consensuscreatetopic().has_autorenewaccount())
{
std::unique_ptr<proto::AccountID> accountId = std::make_unique<proto::AccountID>(body.transactionid().accountid());
body.mutable_consensuscreatetopic()->set_allocated_autorenewaccount(accountId.release());
}
}

//-----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#include "PrivateKey.h"
#include "TokenCreateTransaction.h"
#include "TokenDeleteTransaction.h"
#include "TokenInfo.h"
#include "TokenInfoQuery.h"
#include "TransactionReceipt.h"
#include "TransactionResponse.h"
#include "exceptions/PrecheckStatusException.h"
Expand Down Expand Up @@ -448,4 +450,67 @@ TEST_F(TokenCreateTransactionIntegrationTests, CanCreateNftWithRoyaltyFee)
// Clean up
ASSERT_NO_THROW(txReceipt =
TokenDeleteTransaction().setTokenId(tokenId).execute(getTestClient()).getReceipt(getTestClient()));
}
}

//-----
TEST_F(TokenCreateTransactionIntegrationTests, AutoSetAutoRenewAccount)
{
// Given / When
TokenId tokenId;
EXPECT_NO_THROW(tokenId = TokenCreateTransaction()
.setTokenName("ffff")
.setTokenSymbol("F")
.setTreasuryAccountId(AccountId(2ULL))
.execute(getTestClient())
.getReceipt(getTestClient())
.mTokenId.value());

// Then
TokenInfo tokenInfo;
EXPECT_NO_THROW(tokenInfo = TokenInfoQuery().setTokenId(tokenId).execute(getTestClient()));

ASSERT_EQ(tokenInfo.mAutoRenewAccountId, AccountId(2ULL));
}

//-----
TEST_F(TokenCreateTransactionIntegrationTests, DoesNotAutoSetAutoRenewAccount)
{
// Given
std::shared_ptr<PrivateKey> operatorKey;
ASSERT_NO_THROW(
operatorKey = std::shared_ptr<PrivateKey>(
ED25519PrivateKey::fromString(
"302e020100300506032b65700422042091132178e72057a1d7528025956fe39b0b847f200ab59b2fdd367017f3087137")
.release()));

std::shared_ptr<PrivateKey> accountKey;
ASSERT_NO_THROW(accountKey = ED25519PrivateKey::generatePrivateKey());

AccountId accountId;
ASSERT_NO_THROW(accountId = AccountCreateTransaction()
.setKeyWithoutAlias(accountKey)
.setInitialBalance(Hbar(5LL))
.execute(getTestClient())
.getReceipt(getTestClient())
.mAccountId.value());

// When
TokenId tokenId;
EXPECT_NO_THROW(tokenId = TokenCreateTransaction()
.setTokenName("ffff")
.setTokenSymbol("F")
.setAutoRenewAccountId(accountId)
.setTreasuryAccountId(AccountId(2ULL))
.freezeWith(&getTestClient())
.sign(accountKey)
.sign(operatorKey)
.execute(getTestClient())
.getReceipt(getTestClient())
.mTokenId.value());

// Then
TokenInfo tokenInfo;
EXPECT_NO_THROW(tokenInfo = TokenInfoQuery().setTokenId(tokenId).execute(getTestClient()));

ASSERT_EQ(tokenInfo.mAutoRenewAccountId, accountId);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
#include "AccountCreateTransaction.h"
#include "AccountDeleteTransaction.h"
#include "BaseIntegrationTest.h"
#include "CustomFixedFee.h"
Expand Down Expand Up @@ -158,3 +159,78 @@ TEST_F(TopicCreateTransactionIntegrationTests, RevenueGeneratingTopicCannotCreat
.getReceipt(getTestClient()),
ReceiptStatusException); // MAX_ENTRIES_FOR_FEE_EXEMPT_KEY_LIST_EXCEEDED
}

//-----
TEST_F(TopicCreateTransactionIntegrationTests, AutoSetAutoRenewAccount)
{
// Given
const std::string memo = "topic create test memo";
const std::chrono::system_clock::duration autoRenewPeriod = DEFAULT_AUTO_RENEW_PERIOD + std::chrono::hours(10);

std::shared_ptr<PrivateKey> operatorKey;
ASSERT_NO_THROW(
operatorKey = ED25519PrivateKey::fromString(
"302e020100300506032b65700422042091132178e72057a1d7528025956fe39b0b847f200ab59b2fdd367017f3087137"));

// When
TransactionReceipt txReceipt;
EXPECT_NO_THROW(txReceipt = TopicCreateTransaction()
.setMemo(memo)
.setAdminKey(operatorKey)
.setSubmitKey(operatorKey)
.setAutoRenewPeriod(autoRenewPeriod)
.execute(getTestClient())
.getReceipt(getTestClient()));

// Then
TopicInfo topicInfo;
ASSERT_NO_THROW(topicInfo = TopicInfoQuery().setTopicId(txReceipt.mTopicId.value()).execute(getTestClient()));

ASSERT_TRUE(topicInfo.mAutoRenewAccountId.has_value());
EXPECT_EQ(topicInfo.mAutoRenewAccountId.value(), AccountId(2ULL));
}

//-----
TEST_F(TopicCreateTransactionIntegrationTests, DoesNotAutoSetAutoRenewAccount)
{
// Given
const std::string memo = "topic create test memo";
const std::chrono::system_clock::duration autoRenewPeriod = DEFAULT_AUTO_RENEW_PERIOD + std::chrono::hours(10);

std::shared_ptr<PrivateKey> operatorKey;
ASSERT_NO_THROW(
operatorKey = ED25519PrivateKey::fromString(
"302e020100300506032b65700422042091132178e72057a1d7528025956fe39b0b847f200ab59b2fdd367017f3087137"));

std::shared_ptr<PrivateKey> accountKey;
ASSERT_NO_THROW(accountKey = ED25519PrivateKey::generatePrivateKey());

AccountId accountId;
ASSERT_NO_THROW(accountId = AccountCreateTransaction()
.setKeyWithoutAlias(accountKey)
.setInitialBalance(Hbar(5LL))
.execute(getTestClient())
.getReceipt(getTestClient())
.mAccountId.value());

// When
TransactionReceipt txReceipt;
EXPECT_NO_THROW(txReceipt = TopicCreateTransaction()
.setMemo(memo)
.setAdminKey(operatorKey)
.setSubmitKey(operatorKey)
.setAutoRenewPeriod(autoRenewPeriod)
.setAutoRenewAccountId(accountId)
.freezeWith(&getTestClient())
.sign(operatorKey)
.sign(accountKey)
.execute(getTestClient())
.getReceipt(getTestClient()));

// Then
TopicInfo topicInfo;
ASSERT_NO_THROW(topicInfo = TopicInfoQuery().setTopicId(txReceipt.mTopicId.value()).execute(getTestClient()));

ASSERT_TRUE(topicInfo.mAutoRenewAccountId.has_value());
EXPECT_EQ(topicInfo.mAutoRenewAccountId.value(), accountId);
}
Loading