Skip to content

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

Closed
bladehan1 wants to merge 2 commits into
developfrom
feature/opt_config_error_develop
Closed

refactor(config): improve startup errors and remove inactive assertions#44
bladehan1 wants to merge 2 commits into
developfrom
feature/opt_config_error_develop

Conversation

@bladehan1

@bladehan1 bladehan1 commented Aug 4, 2026

Copy link
Copy Markdown
Owner

What does this PR do?

  • Replace IllegalArgumentException with TronError(PARAMETER_INIT) for three explicitly validated startup configuration errors.
  • Remove historical Java assertions that are inactive under the default production JVM configuration.
  • Preserve the assertion in the Besu-derived Blake2bfMessageDigest implementation.

Why are these changes required?

The selected configuration failures are already known parameter initialization errors, so assigning PARAMETER_INIT improves error classification without changing their messages, exit code, or startup result. The removed assertions are inactive by default and can incorrectly suggest that runtime validation is present.

Both changes are intentionally small maintenance improvements. This PR does not introduce a general startup exception framework or change dynamic configuration reload behavior.

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
  • Checkstyle:
    • ./gradlew :framework:checkstyleMain
  • Compilation:
    • ./gradlew :actuator:compileJava :chainbase:compileJava
  • git diff --check upstream/develop...HEAD

Follow up

No broad exception conversion is planned as part of this PR. Other startup failures should be evaluated separately according to their specific semantics.

Extra details

  • Valid configuration behavior is unchanged.
  • The selected invalid configurations still fail startup with exit code 1.
  • No protocol, database, network, or performance impact is expected.
  • The branch is based on the current upstream/develop.

Closes #43


Summary by cubic

Reclassifies selected startup configuration errors to TronError with PARAMETER_INIT and removes inactive assert statements to make failures clearer without changing startup behavior or exit codes.

  • Refactors
    • Use TronError(PARAMETER_INIT) for explicit config validation in Args (DNS serverType and empty fields) and CommitteeConfig (reward/vote prerequisite check); updated test to expect TronError.
    • Remove production-inactive assert statements in RepositoryImpl, ResourceProcessor, EnergyProcessor, MerklePath, and TrieImpl; no logic changes.

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

Review in cubic

@coderabbitai

coderabbitai Bot commented Aug 4, 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: 7c380cd2-5cbe-4f38-90bd-bd237c1048f4

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.

@bladehan1

Copy link
Copy Markdown
Owner Author

Superseded by #45, rebuilt from the normalized feature/opt_config_error branch with a consolidated commit and focused coverage tests.

@bladehan1 bladehan1 closed this Aug 5, 2026
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.

[Feature] Improve startup error classification and remove inactive assertions

1 participant