Skip to content

Comments

Validator manager import to allow overriding fields with CLI flag#7684

Merged
mergify[bot] merged 17 commits intosigp:unstablefrom
chong-he:vm-import
Feb 18, 2026
Merged

Validator manager import to allow overriding fields with CLI flag#7684
mergify[bot] merged 17 commits intosigp:unstablefrom
chong-he:vm-import

Conversation

@chong-he
Copy link
Member

@chong-he chong-he commented Jul 1, 2025

@chong-he chong-he added val-client Relates to the validator client binary ready-for-review The code is ready for review UX-and-logs labels Jul 1, 2025
@mergify
Copy link

mergify bot commented Jul 1, 2025

Some required checks have failed. Could you please take a look @chong-he? 🙏

@mergify mergify bot added waiting-on-author The reviewer has suggested changes and awaits thier implementation. and removed ready-for-review The code is ready for review labels Jul 1, 2025
@chong-he chong-he added ready-for-review The code is ready for review and removed waiting-on-author The reviewer has suggested changes and awaits thier implementation. labels Jul 2, 2025
@mergify
Copy link

mergify bot commented Jul 2, 2025

Some required checks have failed. Could you please take a look @chong-he? 🙏

@mergify mergify bot added waiting-on-author The reviewer has suggested changes and awaits thier implementation. and removed ready-for-review The code is ready for review labels Jul 2, 2025
@chong-he chong-he added ready-for-review The code is ready for review and removed waiting-on-author The reviewer has suggested changes and awaits thier implementation. labels Jul 2, 2025
@michaelsproul michaelsproul requested a review from macladson July 10, 2025 05:14
@michaelsproul
Copy link
Member

@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);
Copy link
Member

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

Copy link
Member Author

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

@jimmygchen jimmygchen requested a review from macladson January 6, 2026 02:52
Copy link
Member

@macladson macladson left a 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

Comment on lines 261 to 263
eprintln!(
"Please note! --suggested-fee-recipient is provided. This will override existing fee recipient defined in validators.json with: {:?}",
override_fee_recipient
Copy link
Member

@macladson macladson Jan 7, 2026

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:

  1. Add the validator public key to the log line. This makes it clear that each validator will have the field overridden.
  2. 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

Copy link
Member Author

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

Copy link
Member Author

@chong-he chong-he Jan 7, 2026

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)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@chong-he chong-he requested a review from macladson January 20, 2026 01:25
Copy link
Collaborator

@dapplion dapplion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
}

@chong-he
Copy link
Member Author

chong-he commented Feb 10, 2026

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.

Thank you for the comment, addressed in here

Copy link
Collaborator

@dapplion dapplion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Member

@macladson macladson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! This is very clean

@michaelsproul michaelsproul added ready-for-merge This PR is ready to merge. and removed ready-for-review The code is ready for review labels Feb 18, 2026
@mergify mergify bot added the queued label Feb 18, 2026
@mergify
Copy link

mergify bot commented Feb 18, 2026

Merge Queue Status

Rule: default


This pull request spent 30 minutes 51 seconds in the queue, including 29 minutes 55 seconds running CI.

Required conditions to merge
  • check-success=local-testnet-success
  • check-success=test-suite-success

mergify bot added a commit that referenced this pull request Feb 18, 2026
@mergify mergify bot merged commit 5e2d296 into sigp:unstable Feb 18, 2026
37 checks passed
@mergify mergify bot removed the queued label Feb 18, 2026
@chong-he chong-he deleted the vm-import branch February 23, 2026 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-merge This PR is ready to merge. UX-and-logs val-client Relates to the validator client binary

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants