hedera-sdk-js
hedera-sdk-js copied to clipboard
TokenCreateTransaction fails with INVALID_RENEWAL_PERIOD unless setAutoRenewPeriod is explicitly defined
Description
After upgrading to [email protected] (from 2.49.2), I encountered an issue when creating a token using TokenCreateTransaction without explicitly setting .setAutoRenewPeriod(). The transaction fails with a StatusError: INVALID_RENEWAL_PERIOD. According to the documentation, if .setAutoRenewPeriod() is omitted, a default value (~90 days or 7,890,000 seconds) should be used, which is within the valid range (30 to ~92 days). However, this default seems to no longer be applied as expected.
The issue appears to correlate with changes between Consensus Node versions: the transaction succeeds on CN 0.61 and fails on CN 0.62.
Steps to reproduce
- Use
[email protected]&CN@^0.62.0 - Use the following code:
const expiration = new Date();
expiration.setDate(expiration.getDate() + 30);
const htsClient = this.getClient();
htsClient.setOperator(AccountId.fromString(args.treasuryAccountId), args.adminPrivateKey);
const transaction = new TokenCreateTransaction()
.setTokenName(args.tokenName)
.setTokenSymbol(args.symbol)
.setExpirationTime(expiration)
.setDecimals(18)
.setTreasuryAccountId(AccountId.fromString(args.treasuryAccountId))
.setInitialSupply(args.initialSupply)
.setTransactionId(TransactionId.generate(AccountId.fromString(args.treasuryAccountId)))
.setNodeAccountIds([htsClient._network.getNodeAccountIdsForExecute()[0]])
.setMaxTransactionFee(50);
await transaction.execute(htsClient);
- Observe the error:
StatusError: transaction transaction_id failed precheck with status INVALID_RENEWAL_PERIOD against node account id 0.0.3
Expected Behavior:
If .setAutoRenewPeriod() is not explicitly set, the SDK should apply the default value (~7,890,000 seconds), and the transaction should succeed as long as the default remains within the permitted range.
Actual Behavior:
The transaction fails unless .setAutoRenewPeriod(7890000) is explicitly set.
Additional context
- SDK Version:
[email protected] - Consensus Node: Passes on
[email protected], fails on[email protected]
Hedera network
No response
Version
2.66.0
Operating system
None
The latest version of the SDK works well with consensus node version 0.61. When the same example is used against 0.62 we get the failures. Working with consensus node team to see if this was an intended change in behavior.
In addition, the SDK will set a default auto renew period. Suggesting the max value as the default.
The consensus node team will be reverting the change that caused the transaction to fail in 0.62. This means your example should work without any changes or SDK upgrades when the fix is deployed.
Awesome! Thanks much @SimiHunjan! Will be looking for that update.
@quiet-node can we close this issue?
@ivaylonikolov7 Would it be possible for the SDK team to keep me posted with the result of the fix on this ticket, and we can proceed with closing it afterward? It's just for tracking purposes we have on the Relay.
Hello @quiet-node,
Here's a quick update like you wanted 🙌 . The Consensus node tagged above v62.7, and the node should continue to behave as expected and shouldn't throw an error anymore. I’ve tested with both >0.62.7 and 0.63.0 to confirm this. You could use solo to check it yourself too.
Will close this due to inactivity, you can reopen it if you want @quiet-node.