-
Notifications
You must be signed in to change notification settings - Fork 961
Validator manager import to allow overriding fields with CLI flag #7684
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
base: unstable
Are you sure you want to change the base?
Conversation
|
Some required checks have failed. Could you please take a look @chong-he? 🙏 |
|
Some required checks have failed. Could you please take a look @chong-he? 🙏 |
|
@macladson would you mind reviewing this? 🙏 |
| // Override the fields in validators.json file if the flag is supplied | ||
| for validator in &mut validators { | ||
| if let Some(override_fee_recipient) = fee_recipient { | ||
| validator.fee_recipient = Some(override_fee_recipient); |
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.
We could move the logging inside the for loop? I doubt we need to log anything in the case that validators.len() == 0 and it would consolidate the if lets
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.
Thanks for the review. I got what you mean.
Previously, before consolidating the if let, the message would be logged whenever the flags (e.g., -suggested-fee-recipient) are used together with lighthouse vm import, even though there are no validators
Now, after moving in the if loop, when there is no validators, the if loop will not be executed, so no message is logged. Makes complete sense
Revise in 6237ab3
macladson
left a comment
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.
This looks pretty good! Just needs some fixes for the logging behaviour
| eprintln!( | ||
| "Please note! --suggested-fee-recipient is provided. This will override existing fee recipient defined in validators.json with: {:?}", | ||
| override_fee_recipient |
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.
Ah so as a consequence of moving the logs inside the for loop, this will log a separate instance of each Please note! log for every validator in your validator.json file. So we should either:
- Add the validator public key to the log line. This makes it clear that each validator will have the field overridden.
- Move the logging outside back outside the for loop but add a conditional that it doesn't run when
validators.len() == 0.
I think I'm fine with either, it's just a matter of which we feel is more ergonomic (1 log per validator vs 1 log total for all validators). For 100s of validators, 1 log per validator would likely be too much. But if you had 2 validators, having a reminder that the override will apply to both might be nice
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.
I am leaning towards no. 2, I will revise
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.
I added the check if !validators.is_empty() (for validators.len() == 0), but I am thinking that this may not be exactly accurate?
For example, when we import new validators and the VC has no validators, then the logs Please note! ... wouldn't be shown, which is not really the intention. i.e., it's not only about modifying existing validators, it can also be used to modify the fields for newly added validators (including the scenario when the VC has no validators)
Co-authored-by: Mac L <mjladson@pm.me>
This reverts commit 6237ab3.
Issue Addressed
--suggested-fee-recipientfor all keystore files #7651