Skip to content
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
dc4c1bc
supplement comments in reference.conf; reduce comments and items in c…
317787106 May 20, 2026
31948e7
change default value of dns.maxMergeSize and changeThreshold
317787106 May 20, 2026
20494bc
add comment
317787106 May 20, 2026
609353e
change default value to 0 of maxConcurrentCallsPerConnection, maxConn…
317787106 May 20, 2026
f7da4eb
add configuration.md to tell use how to use config.conf
317787106 May 20, 2026
90e15a6
add document of how to add config item
317787106 May 20, 2026
33a0f87
simply fetchBlockTimeout and openHistoryQueryWhenLiteFN
317787106 May 20, 2026
67c223e
add some warning message for deprecated item in NodeConfig
317787106 May 20, 2026
3b788e2
delete unused config item receiveTcpMinDataLength
317787106 May 21, 2026
9ff5cd2
add instruction when it should add config item or not
317787106 May 21, 2026
ebb32e0
don't support human readable size
317787106 May 21, 2026
0cac2a5
fix maxMessageSize in config.conf
317787106 May 21, 2026
40a68b7
update comment and configuration-conventions.md
317787106 May 21, 2026
fb88159
fix the description of config.conf's purpose
317787106 May 21, 2026
970b47a
fix(config): address review findings in docs and reference.conf
317787106 May 22, 2026
a93ec15
check if maxMessageSize is negative
317787106 May 22, 2026
171a528
update configuration documents
317787106 May 25, 2026
0947226
Merge branch 'release_v4.8.2' of https://github.com/tronprotocol/java…
317787106 May 26, 2026
4c91d50
merge v4.8.2
317787106 May 26, 2026
16c86c3
change topics.solidity to default false
317787106 May 26, 2026
0019bb7
change topics.solidity to default false
317787106 May 26, 2026
5a94004
Merge branch 'release_v4.8.2' into feature/config_comment
317787106 May 26, 2026
926ffdb
update config file
317787106 May 26, 2026
0af146b
restore external.ip in config-test.conf
317787106 May 26, 2026
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
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,6 @@ public class CommonParameter {
public List<String> backupMembers;
@Getter
@Setter
public long receiveTcpMinDataLength; // clearParam: 2048
@Getter
@Setter
public boolean isOpenFullTcpDisconnect;
@Getter
@Setter
Expand Down
79 changes: 36 additions & 43 deletions common/src/main/java/org/tron/core/config/args/NodeConfig.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.tron.core.config.args;

import static org.tron.core.config.Parameter.ChainConstant.MAX_ACTIVE_WITNESS_NUM;
import static org.tron.core.exception.TronError.ErrCode.PARAMETER_INIT;

import com.typesafe.config.Config;
import com.typesafe.config.ConfigBeanFactory;
Expand All @@ -11,7 +10,6 @@
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.tron.core.exception.TronError;

// Node configuration bean for the "node" section of config.conf.
// ConfigBeanFactory auto-binds all fields including sub-beans, dot-notation keys,
Expand Down Expand Up @@ -77,7 +75,6 @@ public String getDiscoveryExternalIp() {
private ValidContractProtoConfig validContractProto = new ValidContractProtoConfig();
private int shieldedTransInPendingMaxCounts = 10;
private long blockCacheTimeout = 60;
private long receiveTcpMinDataLength = 2048;
private int maxTransactionPendingSize = 2000;
private long pendingTransactionTimeout = 60000;
private int maxTrxCacheSize = 50_000;
Expand Down Expand Up @@ -217,10 +214,10 @@ public static class RpcConfig {
private int pBFTPort = 50071;

private int thread = 0;
private int maxConcurrentCallsPerConnection = 2147483647;
private int maxConcurrentCallsPerConnection = 0;
private int flowControlWindow = 1048576;
private long maxConnectionIdleInMillis = Long.MAX_VALUE;
private long maxConnectionAgeInMillis = Long.MAX_VALUE;
private long maxConnectionIdleInMillis = 0;
private long maxConnectionAgeInMillis = 0;
private int maxMessageSize = 4194304;
private int maxHeaderListSize = 8192;
private int maxRstStream = 0;
Expand Down Expand Up @@ -269,6 +266,9 @@ public static class DynamicConfigSection {
private long checkInterval = 600;
}

/**
* All default parameters come from PublishConfig
*/
@Getter
@Setter
public static class DnsConfig {
Expand All @@ -279,8 +279,8 @@ public static class DnsConfig {
private String dnsPrivate = "";
private List<String> knownUrls = new ArrayList<>();
private List<String> staticNodes = new ArrayList<>();
private int maxMergeSize = 0;
private double changeThreshold = 0.0;
private int maxMergeSize = 5;
private double changeThreshold = 0.1;
private String serverType = "";
private String accessKeyId = "";
private String accessKeySecret = "";
Expand All @@ -296,8 +296,7 @@ public static class DnsConfig {
* since ConfigBeanFactory expects typed bean lists, not string lists.
*/
public static NodeConfig fromConfig(Config config) {
Config section = normalizeNonStandardKeys(
normalizeMaxMessageSizes(config).getConfig("node"));
Config section = normalizeNonStandardKeys(config.getConfig("node"));

// Auto-bind all fields and sub-beans. ConfigBeanFactory fails fast with a
// descriptive path on any `= null` value
Expand All @@ -306,20 +305,28 @@ public static NodeConfig fromConfig(Config config) {
// --- Legacy key fallbacks (backward compatibility) ---
// node.maxActiveNodes (old) -> maxConnections (new)
if (section.hasPath("maxActiveNodes")) {
logger.warn("Configuring [node.maxActiveNodes] is deprecated and will be removed in a future "
+ "release. Please use [node.maxConnections] instead.");
nc.maxConnections = section.getInt("maxActiveNodes");
if (section.hasPath("connectFactor")) {
logger.warn("Configuring [node.connectFactor] is deprecated and will be removed in a future "
+ "release.");
nc.minConnections = (int) (nc.maxConnections * section.getDouble("connectFactor"));
}
if (section.hasPath("activeConnectFactor")) {
logger.warn("Configuring [node.activeConnectFactor] is deprecated and will be removed in a "
+ "future release.");
nc.minActiveConnections = (int) (nc.maxConnections
* section.getDouble("activeConnectFactor"));
}
}
if (section.hasPath("maxActiveNodesWithSameIp")) {
logger.warn("Configuring [node.maxActiveNodesWithSameIp] is deprecated and will be removed "
+ "in a future release. Please use [node.maxConnectionsWithSameIp] instead.");
nc.maxConnectionsWithSameIp = section.getInt("maxActiveNodesWithSameIp");
}

// Legacy key fallback: node.fullNodeAllowShieldedTransaction -> allowShieldedTransactionApi.
// Legacy key fallback: node.allowShieldedTransactionApi wins fullNodeAllowShieldedTransaction
if (section.hasPath("allowShieldedTransactionApi")) {
nc.allowShieldedTransactionApi =
section.getBoolean("allowShieldedTransactionApi");
Expand Down Expand Up @@ -353,6 +360,16 @@ private void postProcess() {
rpc.thread = (Runtime.getRuntime().availableProcessors() + 1) / 2;
}

if (rpc.maxConcurrentCallsPerConnection == 0) {
rpc.maxConcurrentCallsPerConnection = Integer.MAX_VALUE;
}
if (rpc.maxConnectionIdleInMillis == 0) {
rpc.maxConnectionIdleInMillis = Long.MAX_VALUE;
}
if (rpc.maxConnectionAgeInMillis == 0) {
rpc.maxConnectionAgeInMillis = Long.MAX_VALUE;
}

// validateSignThreadNum: 0 = auto-detect
if (validateSignThreadNum == 0) {
validateSignThreadNum = Runtime.getRuntime().availableProcessors();
Expand All @@ -376,6 +393,14 @@ private void postProcess() {
syncFetchBatchNum = 100;
}

// fetchBlock.timeout : clamp to [100, 1000]
Comment thread
317787106 marked this conversation as resolved.
if (fetchBlock.timeout > 1000) {
fetchBlock.timeout = 1000;
}
if (fetchBlock.timeout < 100) {
fetchBlock.timeout = 100;
}

// maxPendingBlockSize: clamp to [50, 2000]
if (maxPendingBlockSize > 2000) {
maxPendingBlockSize = 2000;
Expand Down Expand Up @@ -467,36 +492,4 @@ private static Config normalizeNonStandardKeys(Config section) {
return section;
}

/**
* Pre-normalize size paths so ConfigBeanFactory's primitive int/long binding succeeds
* for human-readable values like "4m" / "128MB". For each maxMessageSize key, parse
* via getMemorySize, validate non-negative and <= Integer.MAX_VALUE, and write the
* numeric byte value back into the Config tree. Validation errors propagate before
* bean creation so the failure points at the user-facing config path.
*/
private static Config normalizeMaxMessageSizes(Config config) {
String[] paths = {
"node.rpc.maxMessageSize",
"node.http.maxMessageSize",
"node.jsonrpc.maxMessageSize"
};
Config result = config;
for (String path : paths) {
if (config.hasPath(path)) {
long bytes = parseMaxMessageSize(config, path);
result = result.withValue(path, ConfigValueFactory.fromAnyRef(bytes));
}
}
return result;
}

private static long parseMaxMessageSize(Config config, String key) {
long value = config.getMemorySize(key).toBytes();
if (value < 0 || value > Integer.MAX_VALUE) {
throw new TronError(key + " must be non-negative and <= "
+ Integer.MAX_VALUE + ", got: " + value, PARAMETER_INIT);
}
return value;
}

}
Loading
Loading