refactor(config): overhaul config docs, fix defaults, remove dead params#6790
refactor(config): overhaul config docs, fix defaults, remove dead params#6790317787106 wants to merge 16 commits into
Conversation
…ectionIdleInMillis, maxConnectionAgeInMillis
|
Minor PR description correction: In point 3, the dns "before" values are listed as - private int maxMergeSize = 0;
- private double changeThreshold = 0.0;
+ private int maxMergeSize = 5;
+ private double changeThreshold = 0.1;I also want to clarify the "why" — the framing "align with actual recommended values" reads as if 5/0.1 are new recommendations, but they're actually the library defaults already in use today. Tracing int maxMergeSize = dns.getMaxMergeSize();
if (maxMergeSize >= 1 && maxMergeSize <= 5) {
publishConfig.setMaxMergeSize(maxMergeSize);
} else if (maxMergeSize != 0) { // ← 0 is a sentinel, skipped silently
logger.error("Check node.dns.maxMergeSize, should be [1~5], default 5");
}A private double changeThreshold = 0.1;
private int maxMergeSize = 5;So the effective runtime value for an operator enabling Suggested rewording for point 3, last bullet:
This makes the change less alarming for reviewers — it's not a default-value behavior shift, just clearer documentation in |
|
Doc accuracy review — checked both new docs against current code and against real startup logs. The dev-facing 1.
|
| key | bundled config.conf |
reference.conf |
|---|---|---|
node.discovery.enable |
true |
false |
node.discovery.persist |
true |
false |
node.backup.priority |
8 |
0 |
Empirically verified by running the built jar with no -c flag:
$ java -jar FullNode.jar
$ grep "Discover enable" logs/tron.log
INFO [main] [app](Args.java:1158) Discover enable: true
If the doc were correct, this would be false. It's true because bundled config.conf wins. Suggested rewording:
If
-cis omitted, the node loads theconfig.confbundled inside the jar (the same file shipped with the distribution) merged withreference.confas fallback. The bundled file already enables discovery/persist for mainnet operation. For production, copy it out, edit, and pass the edited copy via-cto make your configuration visible to operators.
3. The openPrintLog claim is wrong on two counts
At startup, the node logs the resolved configuration (merged result of
config.conf + reference.conf) when node.openPrintLog = true (the default).
Gate is fictitious. openPrintLog is checked in 5 production sites only — all runtime verbosity for tx/inventory/peer logs (PendingManager, P2pEventHandlerImpl, InventoryMsgHandler). It does not gate startup config logging.
Scope is misrepresented. The actual startup dump is Args.logConfig() (called unconditionally from applyConfigParams at line 781). It prints ~30 specific fields under five section headers — never the full merged config. Verified empirically against tron.log:
INFO [main] [app] ************************ System info ************************
INFO [main] [app] ************************ Net config ************************ (~24 fields)
INFO [main] [app] ************************ Backup config ************************ (~4 fields)
INFO [main] [app] ************************ Code version ************************* (~2 fields)
INFO [main] [app] ************************ DB config ************************* (~2 fields)
INFO [main] [app] ************************ shutDown config ************************* (~3 fields)
Suggested rewording:
At startup, the node unconditionally logs a summary of key parameters under
Net config,Backup config,Code version,DB config, andshutDown configheaders (seeArgs.logConfig()for the exact fields). For parameters not in this summary, you must inspect runtime behavior or consultreference.confdirectly — the full merged configuration is never dumped.Note:
node.openPrintLogis a separate flag that controls runtime verbosity of P2P/inventory/pending-tx logs, not startup config logging.
Otherwise
configuration-conventions.md (the developer-facing doc) is uniformly accurate — ConfigBeanFactory binding rules, @Setter(NONE) pattern, is-prefix and PBFT exceptions, normalizeMaxMessageSizes, List<String> manual read, the 4-step recipe, deprecation pattern — all check out against current source. The "Configuration Parameter vs. Constant" decision table is particularly strong and should help prevent future dead-parameter accumulation.
|
@barbatos2011 The default of Good catch for the document issuse:
|
|
Process question, not blocking: this PR targets Same observation applies to #6788. Is there a 4.8.2-specific reason to land config tooling/docs work directly on the release branch, or would these be better as |
- Remove incorrect DnsConfig Javadoc referencing nonexistent PublishConfig - Move deprecated activeConnectFactor/connectFactor to end of node block in reference.conf with clearer deprecation comment - Fix double backtick typo in configuration.md (Args.logConfig()) - Fix capitalisation inconsistency in configuration.md table - Add missing trailing newline to configuration.md - Clarify nesting depth in configuration-conventions.md: CI gate hard ceiling is 5 (historical max); new keys must stay within 3 levels Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
What does this PR do?
Rewrites
reference.confcomments — every parameter now has an inline comment describing its purpose, valid range, and unit. The file is the authoritative default-value reference for all node operators and contributors.Slims down
config.conf— removes the large duplicated comment blocks that belonged inreference.conf, leaving only the parameters whose shipped defaults intentionally differ fromreference.confand the minimal comments users need to act on.Fixes default values for three under-specified parameters:
node.rpc.maxConcurrentCallsPerConnection:Integer.MAX_VALUE→0(0 = no limit)node.rpc.maxConnectionIdleInMillis/maxConnectionAgeInMillis: changed to0(0 = no limit)node.dns.maxMergeSize:1→5;changeThreshold:0.8→0.1(original value in release_v4.8.1. No effective runtime change.)Removes
node.receiveTcpMinDataLength— the parameter was never read by any business logic after being assigned. Removing it eliminates dead configuration surface.Adds two documentation files under
docs/:configuration.md— user-facing guide: explains thereference.conf/config.conftwo-layer system, how to start a node with a config file, and the most common configuration sections with examples.configuration-conventions.md— developer-facing guide: coversConfigBeanFactoryauto-binding rules, the camelCase naming requirement, nesting depth limits, the four-step checklist for adding a new parameter, special type handling (List<String>, human-readable sizes), and backward-compatibility patterns.Removes human-readable size support from
maxMessageSizeparameters —node.http.maxMessageSize,node.rpc.maxMessageSize, andnode.jsonrpc.maxMessageSizenow accept plain integers (bytes) only.Why are these changes required?
config.confpreviously duplicated most ofreference.conf's comment content, making it hard to maintain and causing users to question which file to trust. Meanwhilereference.conflacked inline documentation for many parameters. There was also no written guide explaining the two-layer config system or the conventions developers must follow when extending it, leading to inconsistencies (non-camelCase keys, missingreference.confentries, etc.).The three
maxMessageSizeparameters do not benefit from unit-suffix parsing — plain byte values are unambiguous and consistent with every other numeric parameter in the file. Removing the special-case parsing simplifiesNodeConfigand removes a hidden dependency onConfig.getMemorySize.This PR has been tested by