77import static org .tron .core .Constant .DEFAULT_PROPOSAL_EXPIRE_TIME ;
88import static org .tron .core .Constant .DYNAMIC_ENERGY_INCREASE_FACTOR_RANGE ;
99import static org .tron .core .Constant .DYNAMIC_ENERGY_MAX_FACTOR_RANGE ;
10+ import static org .tron .core .Constant .ENERGY_LIMIT_IN_CONSTANT_TX ;
1011import static org .tron .core .Constant .MAX_PROPOSAL_EXPIRE_TIME ;
1112import static org .tron .core .Constant .MIN_PROPOSAL_EXPIRE_TIME ;
1213import static org .tron .core .config .Parameter .ChainConstant .BLOCK_PRODUCE_TIMEOUT_PERCENT ;
8384@ Component
8485public class Args extends CommonParameter {
8586
87+ /**
88+ * Maps deprecated CLI option names to their config-file equivalents.
89+ * Options not in this map have no config equivalent and are being removed entirely.
90+ */
91+ private static final Map <String , String > DEPRECATED_CLI_TO_CONFIG ;
92+
93+ static {
94+ Map <String , String > m = new HashMap <>();
95+ m .put ("--storage-db-directory" , "storage.db.directory" );
96+ m .put ("--storage-db-engine" , "storage.db.engine" );
97+ m .put ("--storage-db-synchronous" , "storage.db.sync" );
98+ m .put ("--storage-index-directory" , "storage.index.directory" );
99+ m .put ("--storage-index-switch" , "storage.index.switch" );
100+ m .put ("--storage-transactionHistory-switch" , "storage.transHistory.switch" );
101+ m .put ("--contract-parse-enable" , "event.subscribe.contractParse" );
102+ m .put ("--support-constant" , "vm.supportConstant" );
103+ m .put ("--max-energy-limit-for-constant" , "vm.maxEnergyLimitForConstant" );
104+ m .put ("--lru-cache-size" , "vm.lruCacheSize" );
105+ m .put ("--min-time-ratio" , "vm.minTimeRatio" );
106+ m .put ("--max-time-ratio" , "vm.maxTimeRatio" );
107+ m .put ("--save-internaltx" , "vm.saveInternalTx" );
108+ m .put ("--save-featured-internaltx" , "vm.saveFeaturedInternalTx" );
109+ m .put ("--save-cancel-all-unfreeze-v2-details" , "vm.saveCancelAllUnfreezeV2Details" );
110+ m .put ("--long-running-time" , "vm.longRunningTime" );
111+ m .put ("--max-connect-number" , "node.maxHttpConnectNumber" );
112+ m .put ("--rpc-thread" , "node.rpc.thread" );
113+ m .put ("--solidity-thread" , "node.solidity.threads" );
114+ m .put ("--validate-sign-thread" , "node.validateSignThreadNum" );
115+ m .put ("--trust-node" , "node.trustNode" );
116+ m .put ("--history-balance-lookup" , "storage.balance.history.lookup" );
117+ m .put ("--es" , "event.subscribe.enable" );
118+ DEPRECATED_CLI_TO_CONFIG = Collections .unmodifiableMap (m );
119+ }
120+
86121 @ Getter
87122 private static String configFilePath = "" ;
88123
@@ -169,7 +204,7 @@ public static void applyConfigParams(
169204
170205 if (config .hasPath (ConfigKey .VM_MAX_ENERGY_LIMIT_FOR_CONSTANT )) {
171206 long configLimit = config .getLong (ConfigKey .VM_MAX_ENERGY_LIMIT_FOR_CONSTANT );
172- PARAMETER .maxEnergyLimitForConstant = max (3_000_000L , configLimit , true );
207+ PARAMETER .maxEnergyLimitForConstant = max (ENERGY_LIMIT_IN_CONSTANT_TX , configLimit , true );
173208 }
174209
175210 if (config .hasPath (ConfigKey .VM_LRU_CACHE_SIZE )) {
@@ -678,6 +713,9 @@ public static void applyConfigParams(
678713 PARAMETER .eventFilter =
679714 config .hasPath (ConfigKey .EVENT_SUBSCRIBE_FILTER ) ? getEventFilter (config ) : null ;
680715
716+ PARAMETER .eventSubscribe = config .hasPath (ConfigKey .EVENT_SUBSCRIBE_ENABLE )
717+ && config .getBoolean (ConfigKey .EVENT_SUBSCRIBE_ENABLE );
718+
681719 if (config .hasPath (ConfigKey .ALLOW_SHIELDED_TRANSACTION_API )) {
682720 PARAMETER .allowShieldedTransactionApi =
683721 config .getBoolean (ConfigKey .ALLOW_SHIELDED_TRANSACTION_API );
@@ -1012,6 +1050,28 @@ private static void applyCLIParams(CLIParameter cmd, JCommander jc) {
10121050 .map (ParameterDescription ::getLongestName )
10131051 .collect (Collectors .toSet ());
10141052
1053+ jc .getParameters ().stream ()
1054+ .filter (ParameterDescription ::isAssigned )
1055+ .filter (pd -> {
1056+ try {
1057+ return CLIParameter .class .getDeclaredField (pd .getParameterized ().getName ())
1058+ .isAnnotationPresent (Deprecated .class );
1059+ } catch (NoSuchFieldException e ) {
1060+ return false ;
1061+ }
1062+ })
1063+ .forEach (pd -> {
1064+ String cliOption = pd .getLongestName ();
1065+ String configKey = DEPRECATED_CLI_TO_CONFIG .get (cliOption );
1066+ if (configKey != null ) {
1067+ logger .warn ("CLI option '{}' is deprecated and will be removed in a future release."
1068+ + " Please use config key '{}' instead." , cliOption , configKey );
1069+ } else {
1070+ logger .warn ("CLI option '{}' is deprecated and will be removed in a future release." ,
1071+ cliOption );
1072+ }
1073+ });
1074+
10151075 if (assigned .contains ("--output-directory" )) {
10161076 PARAMETER .outputDirectory = cmd .outputDirectory ;
10171077 }
@@ -1022,7 +1082,8 @@ private static void applyCLIParams(CLIParameter cmd, JCommander jc) {
10221082 PARAMETER .supportConstant = cmd .supportConstant ;
10231083 }
10241084 if (assigned .contains ("--max-energy-limit-for-constant" )) {
1025- PARAMETER .maxEnergyLimitForConstant = cmd .maxEnergyLimitForConstant ;
1085+ PARAMETER .maxEnergyLimitForConstant = max (ENERGY_LIMIT_IN_CONSTANT_TX ,
1086+ cmd .maxEnergyLimitForConstant , true );
10261087 }
10271088 if (assigned .contains ("--lru-cache-size" )) {
10281089 PARAMETER .lruCacheSize = cmd .lruCacheSize ;
@@ -1105,7 +1166,12 @@ private static void applyCLIParams(CLIParameter cmd, JCommander jc) {
11051166 if (assigned .contains ("--log-config" )) {
11061167 PARAMETER .logbackPath = cmd .logbackPath ;
11071168 }
1169+ // seedNodes is a JCommander positional (main) parameter, which does not support
1170+ // isAssigned(). An empty-check is used instead — this is safe because the default
1171+ // is an empty list, so non-empty means the user explicitly passed values on CLI.
11081172 if (!cmd .seedNodes .isEmpty ()) {
1173+ logger .warn ("Positional seed-node arguments are deprecated. "
1174+ + "Please use seed.node.ip.list in the config file instead." );
11091175 List <InetSocketAddress > seeds = new ArrayList <>();
11101176 for (String s : cmd .seedNodes ) {
11111177 seeds .add (NetUtil .parseInetSocketAddress (s ));
@@ -1691,6 +1757,9 @@ public static void printHelp(JCommander jCommander) {
16911757 jCommander .getProgramName ();
16921758 helpStr .append (String .format ("%nUsage: java -jar %s [options] [seedNode <seedNode> ...]%n" ,
16931759 programName ));
1760+ helpStr .append (String .format (
1761+ "%nNote: Positional seedNode arguments are deprecated."
1762+ + " Use seed.node.ip.list in the config file instead.%n" ));
16941763 helpStr .append (String .format ("%nVERSION: %n%s-%s%n" , Version .getVersion (),
16951764 getCommitIdAbbrev ()));
16961765
@@ -1712,9 +1781,21 @@ public static void printHelp(JCommander jCommander) {
17121781 logger .warn ("Miss option:{}" , option );
17131782 continue ;
17141783 }
1784+ boolean isDeprecated ;
1785+ try {
1786+ isDeprecated = CLIParameter .class .getDeclaredField (
1787+ parameterDescription .getParameterized ().getName ())
1788+ .isAnnotationPresent (Deprecated .class );
1789+ } catch (NoSuchFieldException e ) {
1790+ isDeprecated = false ;
1791+ }
1792+ String desc = upperFirst (parameterDescription .getDescription ());
1793+ if (isDeprecated ) {
1794+ desc += " (deprecated)" ;
1795+ }
17151796 String tmpOptionDesc = String .format ("%s\t \t \t %s%n" ,
17161797 Strings .padEnd (parameterDescription .getNames (), optionMaxLength , ' ' ),
1717- upperFirst ( parameterDescription . getDescription ()) );
1798+ desc );
17181799 helpStr .append (tmpOptionDesc );
17191800 }
17201801 }
0 commit comments