@@ -167,16 +167,19 @@ public static void setParam(final String[] args, final String confFileName) {
167167 ? cmd .shellConfFileName : confFileName ;
168168 Config config = Configuration .getByFileName (configFilePath );
169169
170- // 2. Config overrides defaults
170+ // 2. Config overrides defaults (event config bean is read here but not yet applied)
171171 applyConfigParams (config );
172172
173- // 3. CLI overrides Config (highest priority)
173+ // 3. CLI overrides Config (highest priority, including --es → eventSubscribe )
174174 applyCLIParams (cmd , jc );
175175
176- // 4. Apply platform constraints (e.g. ARM64 forces RocksDB)
176+ // 4. Apply event config after CLI
177+ applyEventConfig (eventConfig );
178+
179+ // 5. Apply platform constraints (e.g. ARM64 forces RocksDB)
177180 applyPlatformConstraints ();
178181
179- // 5 . Init witness (depends on CLI witness flag)
182+ // 6 . Init witness (depends on CLI witness flag)
180183 initLocalWitnesses (config , cmd );
181184 }
182185
@@ -217,7 +220,7 @@ private static void applyStorageConfig(StorageConfig sc) {
217220 PARAMETER .storage .setIndexSwitch (
218221 org .apache .commons .lang3 .StringUtils .isNotEmpty (indexSwitch ) ? indexSwitch : "on" );
219222 PARAMETER .storage .setTransactionHistorySwitch (sc .getTransHistory ().getSwitch ());
220- // contractParse is set in applyEventConfig — it belongs to event.subscribe domain
223+ // contractParse is set in applyConfigParams alongside event config, not here
221224 PARAMETER .storage .setCheckpointVersion (sc .getCheckpoint ().getVersion ());
222225 PARAMETER .storage .setCheckpointSync (sc .getCheckpoint ().isSync ());
223226
@@ -343,21 +346,21 @@ private static void applyRateLimiterConfig(RateLimiterConfig rl) {
343346 PARAMETER .rateLimiterInitialization = initialization ;
344347 }
345348
349+ /**
350+ * Package-private entry point only for tests
351+ */
352+ static void applyEventConfig () {
353+ applyEventConfig (eventConfig );
354+ }
355+
346356 /**
347357 * Bridge EventConfig bean values to CommonParameter fields.
348358 * Converts EventConfig (raw bean) into EventPluginConfig and FilterQuery (business objects).
349359 */
350360 private static void applyEventConfig (EventConfig ec ) {
351- PARAMETER .eventSubscribe = ec .isEnable ();
352- // contractParse belongs to event.subscribe but Storage object holds it
353- PARAMETER .storage .setContractParseSwitch (ec .isContractParse ());
354-
355- // PARAMETER.eventPluginConfig and PARAMETER.eventFilter are only consumed by
356- // Manager.startEventSubscribing(), which itself is gated by isEventSubscribe()
357- // (= ec.isEnable()) at Manager.java:564. When subscribe is disabled, building
358- // these objects has no observable effect — skip both early so PARAMETER stays
359- // consistent with the runtime intent.
360- if (!ec .isEnable ()) {
361+ // cmd parameter has higher priority
362+ PARAMETER .eventSubscribe = PARAMETER .eventSubscribe || ec .isEnable ();
363+ if (!PARAMETER .eventSubscribe ) {
361364 return ;
362365 }
363366
@@ -770,9 +773,12 @@ public static void applyConfigParams(
770773
771774 // node.shutdown — handled in applyNodeConfig
772775
773- // Event config: bind from config.conf "event.subscribe" section
776+ // Event config: read bean here; applyEventConfig() is called once in setParam()
777+ // after applyCLIParams() so that --es is already reflected in eventSubscribe.
774778 eventConfig = EventConfig .fromConfig (config );
775- applyEventConfig (eventConfig );
779+ // contractParse is event-domain but must be set from config before CLI can
780+ // override it with --contract-parse-enable (which runs in applyCLIParams).
781+ PARAMETER .storage .setContractParseSwitch (eventConfig .isContractParse ());
776782
777783 logConfig ();
778784 }
0 commit comments