Skip to content

Commit 62a3236

Browse files
committed
fix(config): align reference.conf defaults with develop code fallbacks
Fix 8 default value regressions where reference.conf diverged from the actual code-level fallback in develop's Args.java: - fetchBlock.timeout: 200 → 500 - minParticipationRate: 15 → 0 - walletExtensionApi: true → false - node.discovery.enable: true → false - node.discovery.persist: true → false - needSyncCheck: true → false - validateSignThreadNum: 16 → 0 (auto = availableProcessors) - solidity.threads: 8 → 0 (auto = availableProcessors) Principle: reference.conf must match the code-level default (the value the runtime produces when the key is absent from config), not the shipped config.conf sample. Reported by kuny0707 and 317787106.
1 parent c38f388 commit 62a3236

3 files changed

Lines changed: 34 additions & 22 deletions

File tree

common/src/main/java/org/tron/core/config/args/NodeConfig.java

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ public class NodeConfig {
2323

2424
// ---- Flat scalar fields (auto-bound by ConfigBeanFactory) ----
2525
private String trustNode = "";
26-
private boolean walletExtensionApi = true;
26+
private boolean walletExtensionApi = false;
2727
private int syncFetchBatchNum = 2000;
28-
private int validateSignThreadNum = Runtime.getRuntime().availableProcessors();
28+
private int validateSignThreadNum = 0; // 0 = auto (availableProcessors)
2929
private int maxConnections = 30;
3030
private int minConnections = 8;
3131
private int minActiveConnections = 3;
3232
private int maxConnectionsWithSameIp = 2;
3333
private int maxHttpConnectNumber = 50;
34-
private int minParticipationRate = 15;
34+
private int minParticipationRate = 0;
3535
private boolean openPrintLog = true;
3636
private boolean openTransactionSort = false;
3737
private int maxTps = 1000;
@@ -65,7 +65,7 @@ public class NodeConfig {
6565
public long getShutdownBlockCount() { return shutdownBlockCount; }
6666
private int inactiveThreshold = 600;
6767
private boolean metricsEnable = false;
68-
private int blockProducedTimeOut = 75;
68+
private int blockProducedTimeOut = 50;
6969
private int netMaxTrxPerSecond = 700;
7070
private boolean nodeDetectEnable = false;
7171
private boolean enableIpv6 = false;
@@ -130,8 +130,8 @@ public class NodeConfig {
130130
@Getter
131131
@Setter
132132
public static class DiscoveryConfig {
133-
private boolean enable = true;
134-
private boolean persist = true;
133+
private boolean enable = false;
134+
private boolean persist = false;
135135
private ExternalConfig external = new ExternalConfig();
136136

137137
@Getter
@@ -156,13 +156,13 @@ public static class ConnectionConfig {
156156
@Getter
157157
@Setter
158158
public static class FetchBlockConfig {
159-
private int timeout = 200;
159+
private int timeout = 500;
160160
}
161161

162162
@Getter
163163
@Setter
164164
public static class SolidityConfig {
165-
private int threads = 8;
165+
private int threads = 0; // 0 = auto (availableProcessors)
166166
}
167167

168168
@Getter
@@ -418,6 +418,16 @@ private void postProcess() {
418418
rpc.thread = (Runtime.getRuntime().availableProcessors() + 1) / 2;
419419
}
420420

421+
// validateSignThreadNum: 0 = auto-detect
422+
if (validateSignThreadNum == 0) {
423+
validateSignThreadNum = Runtime.getRuntime().availableProcessors();
424+
}
425+
426+
// solidityThreads: 0 = auto-detect
427+
if (solidity.threads == 0) {
428+
solidity.threads = Runtime.getRuntime().availableProcessors();
429+
}
430+
421431
// syncFetchBatchNum: clamp to [100, 2000]
422432
if (syncFetchBatchNum > 2000) {
423433
syncFetchBatchNum = 2000;

common/src/main/resources/reference.conf

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ storage {
115115
# Total cached transactions = 65536 * txCache.estimatedTransactions
116116
txCache.estimatedTransactions = 1000
117117
# If true, transaction cache initialization will be faster.
118-
txCache.initOptimization = true
118+
txCache.initOptimization = false
119119

120120
# Number of blocks flushed to db in each batch during node syncing.
121121
snapshot.maxFlushCount = 1
@@ -136,8 +136,8 @@ storage {
136136
}
137137

138138
node.discovery = {
139-
enable = true
140-
persist = true
139+
enable = false
140+
persist = false
141141
external.ip = ""
142142
}
143143

@@ -193,24 +193,25 @@ node {
193193
trustNode = "127.0.0.1:50051"
194194

195195
# Expose extension api to public or not
196-
walletExtensionApi = true
196+
walletExtensionApi = false
197197

198198
listen.port = 18888
199199
connection.timeout = 2
200-
fetchBlock.timeout = 200
200+
fetchBlock.timeout = 500
201201

202202
# Number of blocks to fetch in one batch during sync. Range: [100, 2000].
203203
syncFetchBatchNum = 2000
204204

205205
# Number of validate sign threads, default availableProcessors
206-
validateSignThreadNum = 16
206+
# Number of validate sign threads, 0 = auto (availableProcessors)
207+
validateSignThreadNum = 0
207208

208209
maxConnections = 30
209210
minConnections = 8
210211
minActiveConnections = 3
211212
maxConnectionsWithSameIp = 2
212213
maxHttpConnectNumber = 50
213-
minParticipationRate = 15
214+
minParticipationRate = 0
214215

215216
# Whether to enable shielded transaction API
216217
allowShieldedTransactionApi = true
@@ -315,10 +316,11 @@ node {
315316
# Number of solidity threads in FullNode.
316317
# Increase if solidity rpc/http interface timeouts occur.
317318
# Default: number of cpu cores.
318-
solidity.threads = 8
319+
# Number of solidity threads, 0 = auto (availableProcessors)
320+
solidity.threads = 0
319321

320322
# Maximum percentage of producing block interval (provides time for broadcast etc.)
321-
blockProducedTimeOut = 75
323+
blockProducedTimeOut = 50
322324

323325
# Maximum transactions from network layer per second
324326
netMaxTrxPerSecond = 700
@@ -670,7 +672,7 @@ localwitness = [
670672
# ]
671673

672674
block = {
673-
needSyncCheck = true
675+
needSyncCheck = false
674676
maintenanceTimeInterval = 21600000 // 6 hours (ms)
675677
proposalExpireTime = 259200000 // 3 days (ms), controlled by committee proposal
676678
checkFrozenTime = 1 // maintenance periods to check frozen balance (test only)

common/src/test/java/org/tron/core/config/args/NodeConfigTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ public void testDefaults() {
2424
NodeConfig nc = NodeConfig.fromConfig(empty);
2525
assertEquals(18888, nc.getListenPort());
2626
assertEquals(2, nc.getConnectionTimeout());
27-
assertEquals(200, nc.getFetchBlockTimeout());
27+
assertEquals(500, nc.getFetchBlockTimeout());
2828
assertEquals(30, nc.getMaxConnections());
2929
assertEquals(8, nc.getMinConnections());
3030
assertEquals(4, nc.getMaxFastForwardNum());
3131
assertFalse(nc.isOpenFullTcpDisconnect());
32-
// reference.conf has node.discovery.enable=true, persist=true
33-
assertTrue(nc.isDiscoveryEnable());
34-
assertTrue(nc.isDiscoveryPersist());
32+
// reference.conf matches code default: discovery disabled when not configured
33+
assertFalse(nc.isDiscoveryEnable());
34+
assertFalse(nc.isDiscoveryPersist());
3535
assertEquals(0, nc.getChannelReadTimeout());
3636
}
3737

0 commit comments

Comments
 (0)