Skip to content

refactor(config): extract CLIParameter and restructure Args init flow#7

Open
vividctrlalt wants to merge 6 commits intodevelopfrom
refactor/parameter-init
Open

refactor(config): extract CLIParameter and restructure Args init flow#7
vividctrlalt wants to merge 6 commits intodevelopfrom
refactor/parameter-init

Conversation

@vividctrlalt
Copy link
Owner

Summary

  • Extract CLI @Parameter annotations from CommonParameter into a new CLIParameter class, separating CLI parsing from runtime config state
  • Restructure Args.setParam() into a clear 4-step flow: parse CLI → applyConfigParamsapplyCLIParamsinitLocalWitnesses
  • Refactor WitnessInitializer into three static methods (initFromCLIPrivateKey, initFromCFGPrivateKey, initFromKeystore), with routing logic moved to Args.initLocalWitnesses
  • Remove password, privateKey, witnessAddress from CommonParameter — sensitive credentials are now passed directly as method parameters and never stored in global state

Test plan

  • ./gradlew :framework:test --tests "org.tron.core.config.args.*" — all parameter tests pass
  • ./gradlew :framework:test — full framework tests pass

halibobo1205 and others added 6 commits March 3, 2026 16:00
Removed 4 config files from framework/src/main/resources that were
not referenced anywhere in the codebase:
- config-backup.conf: no references
- config-beta.conf: no references
- config-test-net.conf: no references
- config-localtest.conf: only used in tests, shadowed by
  src/test/resources/config-localtest.conf on the test classpath
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants