-
Notifications
You must be signed in to change notification settings - Fork 101
chore(l1): improve log message when trying to run incompatible configs #4022
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…tible configurations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR improves error handling by replacing a panic with a proper error return when the Store is initialized with a genesis configuration that differs from what's already stored in the database. The change provides a clearer, more actionable error message for users encountering configuration mismatches.
- Replaces panic behavior with proper error handling using
StoreError::Custom
- Updates the error message to be more user-friendly and informative
- Adjusts corresponding test to verify error handling instead of panic catching
Lines of code reportTotal lines added: Detailed view
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Left some comments about style and further simplifications
crates/storage/store.rs
Outdated
Some(_) => panic!("{GENESIS_DIFF_PANIC_MESSAGE}"), | ||
Some(_) => { | ||
error!( | ||
"The chain configuration stored in the database is incompatible with the provided configuration. If you intended to switch networks, clear the database (e.g., run `ethrex removedb`) and try again." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The user could also specify another datadir without needing to remove the db, right? Do you think we should specify this here so that they know they have another alternative if they don't want to remove the current database?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good idea!
lambdaclass#4022) **Motivation** Current error message was confusing.
Motivation
Current error message was confusing.