Skip to content

refactor(config): improve startup errors and remove inactive assertions - #45

Draft
bladehan1 wants to merge 1 commit into
developfrom
feature/opt_config_error
Draft

refactor(config): improve startup errors and remove inactive assertions#45
bladehan1 wants to merge 1 commit into
developfrom
feature/opt_config_error

Conversation

@bladehan1

@bladehan1 bladehan1 commented Aug 5, 2026

Copy link
Copy Markdown
Owner

What does this PR do?

  • Replace selected startup IllegalArgumentException failures with TronError(PARAMETER_INIT).
  • Remove historical Java assertions that are inactive under the default production JVM configuration.
  • Add focused unit and integration tests for the affected configuration error paths.

Why are these changes required?

The selected failures are parameter initialization errors. Classifying them with PARAMETER_INIT makes startup failures consistent while preserving their messages and exit behavior. Removing inactive assertions avoids implying that production runtime validation is present. The added tests prevent these error paths from regressing and ensure they are included in the CI coverage data.

This PR has been tested by:

  • Unit tests:
    • ./gradlew :common:test --tests org.tron.core.config.args.CommitteeConfigTest
    • ./gradlew :framework:test --tests org.tron.core.config.args.ArgsTest
  • Coverage reports:
    • ./gradlew :common:jacocoTestReport :framework:jacocoTestReport
    • Verified zero missed instructions for CommitteeConfig.java:166 and Args.java:1048,1092.
  • Checkstyle:
    • ./gradlew :framework:checkstyleTest
  • Whitespace validation:
    • git diff --check

Follow up

Other startup failures should be evaluated separately according to their semantics.

Extra details

  • Valid configuration behavior is unchanged.
  • No protocol, database, network, or performance impact is expected.
  • The branch is based on develop and contains one consolidated commit.

Summary by cubic

Standardizes startup configuration errors using TronError(PARAMETER_INIT) and removes inactive assert statements. Adds tests to cover these error paths; valid config behavior is unchanged.

  • Refactors
    • Replaced startup IllegalArgumentException with TronError(PARAMETER_INIT) in CommitteeConfig and DNS publish config (Args.loadDnsPublishParameters, logEmptyError).
    • Removed production-inactive assert statements from RepositoryImpl, ResourceProcessor, EnergyProcessor, MerklePath, and multiple methods in TrieImpl.
    • Expanded tests in CommitteeConfigTest and ArgsTest to assert PARAMETER_INIT codes and messages for invalid committee.allowOldRewardOpt and DNS publish inputs.

Written for commit c95607d. Summary will update on new commits.

Review in cubic

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 25001972-a1cb-4f4b-b09b-3415e77ac340

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Use TronError with PARAMETER_INIT for invalid startup configuration, remove assertions that are inactive at runtime, and cover the new error paths with unit tests.
@bladehan1
bladehan1 force-pushed the feature/opt_config_error branch from 79e165c to c95607d Compare August 6, 2026 09:51
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.

1 participant