Skip to content

refactor(config): remove unused storage index and json parsing config#6794

Open
317787106 wants to merge 4 commits into
tronprotocol:release_v4.8.2from
317787106:feature/reduce_482_config
Open

refactor(config): remove unused storage index and json parsing config#6794
317787106 wants to merge 4 commits into
tronprotocol:release_v4.8.2from
317787106:feature/reduce_482_config

Conversation

@317787106
Copy link
Copy Markdown
Collaborator

@317787106 317787106 commented May 21, 2026

What does this PR do?

Removes two groups of unused or over-engineered config items:

  1. node.http.maxNestingDepth / node.http.maxTokenCount — these are JSON-parsing DoS-protection caps that were exposed as user-configurable fields in reference.conf, NodeConfig.HttpConfig, and CommonParameter. Because the values were baked into the JSON / JsonRpcServlet class-level ObjectMapper at first class-load, exposing them as runtime config created a silent initialization-order trap: if any code touched JSON before Args.setParam() completed, the user's overrides would be silently ignored. The values (100 / 100 000) are security constants, not operator-tunable settings. This PR promotes them to Constant.MAX_NESTING_DEPTH / Constant.MAX_TOKEN_COUNT, removes the config binding, and deletes the fragile init-order comment that described the footgun.

  2. storage.index.directory / storage.index.switch — legacy config keys that have no consumers in runtime code. Storage.indexDirectory and Storage.indexSwitch were populated from config but never read. The StorageConfig.IndexConfig inner class and all config/field bindings are removed. The corresponding CLI flags (--storage-index-directory, --storage-index-switch) retain their @Parameter declarations so JCommander still recognises them — preventing a misleading startup crash for operators whose launch scripts still pass these flags — but the values are no longer applied anywhere.

Why are these changes required?

  • Removing dead config items reduces cognitive overhead for operators reading reference.conf and for developers maintaining the config-binding pipeline.
  • Eliminating the CommonParameter-backed maxNestingDepth/maxTokenCount fields removes a class-initialization ordering constraint that was documented only in a comment, making startup order more robust and the JSON utility class simpler.
  • Keeping the CLI flag declarations (without bindings) avoids a hard startup break: without them, JCommander treats unknown flags as positional seed-node arguments, causing a misleading Invalid inetSocketAddress crash with no indication that the flag was removed.
  • Aligns with the ongoing effort to trim CommonParameter and reference.conf of accumulated legacy fields (part of the feature/reduce_482_config series).

This PR has been tested by:

  • Unit Tests (StorageConfigTest, ArgsTest, JsonTest, JsonRpcServletTest updated/passing)
  • Verified that nodes started with --storage-index-directory / --storage-index-switch still start normally and emit a deprecation warning instead of crashing

Follow up

Continue auditing CommonParameter and reference.conf for additional unused or redundant config entries.

Extra details

No behaviour change for any running node: the JSON depth/token limits remain exactly 100 / 100 000; index storage was already a no-op. Operators passing the removed index CLI flags get a deprecation warning on startup; the flags are silently consumed and ignored.

@github-actions github-actions Bot requested a review from halibobo1205 May 21, 2026 06:21
@317787106 317787106 changed the title refactor(config): reduce unused config items refactor(config): remove unused storage index and json parsing config May 21, 2026
@halibobo1205 halibobo1205 added this to the GreatVoyage-v4.8.2 milestone May 21, 2026
Comment thread framework/src/main/java/org/tron/core/config/args/CLIParameter.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants