@@ -178,6 +178,14 @@ public static void setParam(final String[] args, final String confFileName) {
178178
179179 // 5. Init witness (depends on CLI witness flag)
180180 initLocalWitnesses (config , cmd );
181+
182+ // 6. Build event-subscribe derivatives (EventPluginConfig + FilterQuery)
183+ // after CLI/platform overrides have settled the final eventSubscribe flag.
184+ // Doing it here — instead of inside applyConfigParams — lets deprecated
185+ // --es still produce a valid EventPluginConfig when the config file has
186+ // event.subscribe.enable = false.
187+ buildEventDerivatives (eventConfig );
188+ logConfig ();
181189 }
182190
183191 /**
@@ -217,7 +225,7 @@ private static void applyStorageConfig(StorageConfig sc) {
217225 PARAMETER .storage .setIndexSwitch (
218226 org .apache .commons .lang3 .StringUtils .isNotEmpty (indexSwitch ) ? indexSwitch : "on" );
219227 PARAMETER .storage .setTransactionHistorySwitch (sc .getTransHistory ().getSwitch ());
220- // contractParse is set in applyEventConfig — it belongs to event.subscribe domain
228+ // contractParse is set in applyConfigParams from event.subscribe.contractParse
221229 PARAMETER .storage .setCheckpointVersion (sc .getCheckpoint ().getVersion ());
222230 PARAMETER .storage .setCheckpointSync (sc .getCheckpoint ().isSync ());
223231
@@ -344,20 +352,24 @@ private static void applyRateLimiterConfig(RateLimiterConfig rl) {
344352 }
345353
346354 /**
347- * Bridge EventConfig bean values to CommonParameter fields.
348- * Converts EventConfig (raw bean) into EventPluginConfig and FilterQuery (business objects).
355+ * Build event-subscribe derivative objects (EventPluginConfig + FilterQuery)
356+ * from the raw EventConfig bean. Gated by the final PARAMETER.eventSubscribe
357+ * value, which has already absorbed any CLI/platform overrides by the time
358+ * this is called.
359+ *
360+ * <p>Atomic values (PARAMETER.eventSubscribe, contractParseSwitch) are bound
361+ * earlier in applyConfigParams; they are not re-applied here so that any
362+ * CLI overrides such as --contract-parse-enable survive.</p>
349363 */
350- 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-
364+ @ VisibleForTesting
365+ static void buildEventDerivatives (EventConfig ec ) {
355366 // 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 ()) {
367+ // Manager.startEventSubscribing(), which itself is gated by isEventSubscribe().
368+ // When subscribe is disabled, these objects have no observable effect — null
369+ // them out so PARAMETER stays consistent with runtime intent.
370+ if (!PARAMETER .isEventSubscribe ()) {
371+ PARAMETER .eventPluginConfig = null ;
372+ PARAMETER .eventFilter = null ;
361373 return ;
362374 }
363375
@@ -706,6 +718,13 @@ private static void applyPlatformConstraints() {
706718
707719 /**
708720 * Apply parameters from config file.
721+ *
722+ * <p>Binds atomic values only. Event-subscribe derivative objects
723+ * (EventPluginConfig + FilterQuery) are NOT built here — {@link #setParam}
724+ * builds them via {@link #buildEventDerivatives} after CLI overrides have
725+ * settled. Tests that call this method directly and need EPC/FilterQuery
726+ * populated must call {@code buildEventDerivatives(getEventConfig())}
727+ * themselves.</p>
709728 */
710729 public static void applyConfigParams (
711730 final Config config ) {
@@ -770,11 +789,13 @@ public static void applyConfigParams(
770789
771790 // node.shutdown — handled in applyNodeConfig
772791
773- // Event config: bind from config.conf "event.subscribe" section
792+ // Event config: bind atomic values from config.conf "event.subscribe".
793+ // Derivative business objects (EventPluginConfig + FilterQuery) are built
794+ // later in setParam, after CLI overrides have run.
774795 eventConfig = EventConfig .fromConfig (config );
775- applyEventConfig ( eventConfig );
776-
777- logConfig ( );
796+ PARAMETER . eventSubscribe = eventConfig . isEnable ( );
797+ // contractParse belongs to event.subscribe but Storage object holds it.
798+ PARAMETER . storage . setContractParseSwitch ( eventConfig . isContractParse () );
778799 }
779800
780801 /**
@@ -1001,7 +1022,7 @@ public static List<InetSocketAddress> filterInetSocketAddress(
10011022
10021023 // getInetAddress removed — use filterInetSocketAddress
10031024
1004- // getEventPluginConfig removed — logic moved to applyEventConfig ()
1025+ // getEventPluginConfig removed — logic moved to buildEventDerivatives ()
10051026
10061027
10071028 public static PublishConfig loadDnsPublishConfig (NodeConfig nodeConfig ) {
@@ -1109,8 +1130,8 @@ private static void logEmptyError(String arg) {
11091130 throw new IllegalArgumentException (String .format ("Check %s, must not be null or empty" , arg ));
11101131 }
11111132
1112- // createTriggerConfig removed — logic moved to applyEventConfig ()
1113- // getEventFilter removed — logic moved to applyEventConfig ()
1133+ // createTriggerConfig removed — logic moved to buildEventDerivatives ()
1134+ // getEventFilter removed — logic moved to buildEventDerivatives ()
11141135
11151136 private static void externalIp (NodeConfig nodeConfig ) {
11161137 String externalIp = nodeConfig .getDiscoveryExternalIp ();
@@ -1333,4 +1354,3 @@ private static Map<String, String[]> getOptionGroup() {
13331354 return optionGroupMap ;
13341355 }
13351356}
1336-
0 commit comments