Validator manager import to allow overriding fields with CLI flag#7684
Validator manager import to allow overriding fields with CLI flag#7684mergify[bot] merged 17 commits intosigp:unstablefrom
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.
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.
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.
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.
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.
I am leaning towards no. 2, I will revise
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
I removed the if !validators.is_empty() condition with reason stated above: 2239b55
Let me know if this is no good and I am happy to revert the change
Co-authored-by: Mac L <mjladson@pm.me>
This reverts commit 6237ab3.
dapplion
left a comment
There was a problem hiding this comment.
Minor bug: prefer_builder_proposals is logged as an override (line 283) but is missing from the actual override loop (lines 298-314). The other five fields (fee_recipient, gas_limit, builder_proposals, builder_boost_factor, enabled) are all applied, but prefer_builder_proposals is skipped.
// 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);
}
if let Some(override_gas_limit) = gas_limit {
validator.gas_limit = Some(override_gas_limit);
}
if let Some(override_builder_proposals) = builder_proposals {
validator.builder_proposals = Some(override_builder_proposals);
}
if let Some(override_builder_boost_factor) = builder_boost_factor {
validator.builder_boost_factor = Some(override_builder_boost_factor);
}
if let Some(override_enabled) = enabled {
validator.enabled = Some(override_enabled);
}
// missing: prefer_builder_proposals
}
Thank you for the comment, addressed in here |
macladson
left a comment
There was a problem hiding this comment.
Nice work! This is very clean
Merge Queue StatusRule:
This pull request spent 30 minutes 51 seconds in the queue, including 29 minutes 55 seconds running CI. Required conditions to merge
|
Issue Addressed
--suggested-fee-recipientfor all keystore files #7651