refactor(config): extract CLIParameter and restructure Args init flow#6569
Open
vividctrlalt wants to merge 5 commits intotronprotocol:developfrom
Open
refactor(config): extract CLIParameter and restructure Args init flow#6569vividctrlalt wants to merge 5 commits intotronprotocol:developfrom
vividctrlalt wants to merge 5 commits intotronprotocol:developfrom
Conversation
added 3 commits
March 3, 2026 18:07
Extract all @parameter annotations from CommonParameter into a new CLIParameter class, removing JCommander dependency from common module. Refactor Args.setParam() into a four-step flow: parse CLI, apply config, apply CLI overrides via isAssigned(), init witness. Simplify clearParam() from ~160 lines to CommonParameter.reset().
- Restructure Args.setParam into 4-step flow: parse CLI, apply config, apply CLI overrides, init witnesses - Rename setParam(Config) to applyConfigParams, setCLIParameter to applyCLIParams for clarity - Extract WitnessInitializer into 3 static methods (initFromCLIPrivateKey, initFromCFGPrivateKey, initFromKeystore) with routing in Args - Remove password/privateKey/witnessAddress/help/version/configFilePath from CommonParameter — pass as method params instead of global state - Move JDK version check from Args to FullNode entry point - Extract Configuration.getByFileName for single-param config loading
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@Parameterannotations fromCommonParameterinto a newCLIParameterclass, separating CLI parsing from runtime config stateArgs.setParam()into a clear 4-step flow: parse CLI →applyConfigParams→applyCLIParams→initLocalWitnessesWitnessInitializerinto three static methods (initFromCLIPrivateKey,initFromCFGPrivateKey,initFromKeystore), with routing logic moved toArgs.initLocalWitnessespassword,privateKey,witnessAddressfromCommonParameter— sensitive credentials are now passed directly as method parameters and never stored in global stateTest plan
./gradlew :framework:test --tests "org.tron.core.config.args.*"— all parameter tests pass./gradlew :framework:test— full framework tests pass