fix(config): optimize config binding#77
Conversation
📝 WalkthroughWalkthroughThis PR removes deprecated networking configuration parameters across the codebase. CommonParameter loses timeout and thread-count fields; NodeConfig refactors external IP binding and shielded-API binding; defaults are removed; Args stops propagating the values; and tests and test configs are updated. ChangesNetwork Configuration Deprecation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
1 issue found across 13 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="common/src/main/java/org/tron/core/config/args/NodeConfig.java">
<violation number="1" location="common/src/main/java/org/tron/core/config/args/NodeConfig.java:386">
P1: Legacy `fullNodeAllowShieldedTransaction` is never applied because `allowShieldedTransactionApi` is always present via defaults, making the `else if` fallback unreachable.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
…parameter binding Remove maxBlockFilterNum, maxAddressSize, and maxRequestTimeout from NodeConfig/CommonParameter since they were superseded by the jsonRpcMaxBatchSize/jsonRpcMaxResponseSize parameters. Consolidate the config binding path so all JSON-RPC size limits flow through a single reference.conf entry, and clean up stale test-config fixtures. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
84265a1 to
30aa2c6
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
common/src/test/java/org/tron/core/config/args/NodeConfigTest.java (1)
304-316: ⚡ Quick winMisleading test name and duplicated test coverage.
The test
testShieldedApiLegacyKeyRespected()suggests it should verify legacy key behavior, but lines 307-312 test the modern key (allowShieldedTransactionApi) and lines 313-315 test the empty config default. These scenarios are already covered bytestShieldedApiModernKeyRespected()(lines 290-294) andtestShieldedApiDefaultsToFalseWhenNeitherKeySet()(lines 284-287).Consider limiting this test to only legacy key scenarios or renaming it to reflect the broader coverage (e.g.,
testShieldedApiAcrossVariousConfigurations()).🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@common/src/test/java/org/tron/core/config/args/NodeConfigTest.java` around lines 304 - 316, The test method testShieldedApiLegacyKeyRespected() currently duplicates coverage of modern-key and default cases; either restrict it to only verify the legacy configuration key behavior (call NodeConfig.fromConfig with withRef("node.fullNodeAllowShieldedTransaction = true") and withRef("node.fullNodeAllowShieldedTransaction = false") and assert via nc.isAllowShieldedTransactionApi()) or rename the test to something like testShieldedApiAcrossVariousConfigurations() to reflect that it intentionally covers legacy, modern (withRef("node.allowShieldedTransactionApi = true"/"false")), and default (withRef("")) cases; update assertions and method name accordingly so coverage is not redundant with testShieldedApiModernKeyRespected() and testShieldedApiDefaultsToFalseWhenNeitherKeySet().
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@common/src/test/java/org/tron/core/config/args/NodeConfigTest.java`:
- Line 320: The inline comment is incorrect: update the comment above
testShieldedApiModernKeyTakesPriorityOverLegacy to reflect that the modern key
(allowShieldedTransactionApi) takes priority over the legacy key (not the other
way around); locate the comment near the test method name
NodeConfigTest::testShieldedApiModernKeyTakesPriorityOverLegacy and replace the
text "legacy key presence wins over modern" with a phrase like "modern key
presence wins over legacy (allowShieldedTransactionApi takes priority)" so it
matches the assertions in the test.
---
Nitpick comments:
In `@common/src/test/java/org/tron/core/config/args/NodeConfigTest.java`:
- Around line 304-316: The test method testShieldedApiLegacyKeyRespected()
currently duplicates coverage of modern-key and default cases; either restrict
it to only verify the legacy configuration key behavior (call
NodeConfig.fromConfig with withRef("node.fullNodeAllowShieldedTransaction =
true") and withRef("node.fullNodeAllowShieldedTransaction = false") and assert
via nc.isAllowShieldedTransactionApi()) or rename the test to something like
testShieldedApiAcrossVariousConfigurations() to reflect that it intentionally
covers legacy, modern (withRef("node.allowShieldedTransactionApi =
true"/"false")), and default (withRef("")) cases; update assertions and method
name accordingly so coverage is not redundant with
testShieldedApiModernKeyRespected() and
testShieldedApiDefaultsToFalseWhenNeitherKeySet().
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 47c8a6a0-c6f4-4689-9e69-ae8cdd5f504b
📒 Files selected for processing (14)
common/src/main/java/org/tron/common/parameter/CommonParameter.javacommon/src/main/java/org/tron/core/config/args/NodeConfig.javacommon/src/main/resources/reference.confcommon/src/test/java/org/tron/core/config/args/NodeConfigTest.javaframework/src/main/java/org/tron/core/config/args/Args.javaframework/src/main/resources/config.confframework/src/test/java/org/tron/common/ParameterTest.javaframework/src/test/java/org/tron/core/config/args/ArgsTest.javaframework/src/test/resources/args-test.confframework/src/test/resources/config-localtest.confframework/src/test/resources/config-test-index.confframework/src/test/resources/config-test-mainnet.confframework/src/test/resources/config-test-storagetest.confframework/src/test/resources/config-test.conf
💤 Files with no reviewable changes (10)
- framework/src/test/resources/config-test-storagetest.conf
- framework/src/test/resources/config-localtest.conf
- framework/src/test/resources/config-test-index.conf
- framework/src/test/resources/config-test-mainnet.conf
- framework/src/test/java/org/tron/core/config/args/ArgsTest.java
- framework/src/test/resources/args-test.conf
- framework/src/test/resources/config-test.conf
- framework/src/main/resources/config.conf
- framework/src/test/java/org/tron/common/ParameterTest.java
- common/src/main/java/org/tron/common/parameter/CommonParameter.java
🚧 Files skipped from review as they are similar to previous changes (3)
- framework/src/main/java/org/tron/core/config/args/Args.java
- common/src/main/resources/reference.conf
- common/src/main/java/org/tron/core/config/args/NodeConfig.java
What does this PR do?
Why are these changes required?
This PR has been tested by:
Follow up
Extra details
Summary by cubic
Optimizes node config binding by removing deprecated keys, fixing discovery external IP parsing, and consolidating JSON‑RPC limits. Clarifies shielded API precedence and removes its default from reference.conf.
Bug Fixes
Migration
Written for commit 8fea4e7. Summary will update on new commits.
Summary by CodeRabbit