Skip to content
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

Remove duplicate check in switch_to_compounding_validator #3916

Closed
wants to merge 1 commit into from

Conversation

ralexstokes
Copy link
Member

As written, this is a duplicate check and I'd like to simplify the electra spec as much as possible

One counter argument would be that this function as-is is safer, e.g. in the event it is called somewhere else (even in the future) where this invariant may not be maintained

Curious to hear feedback/input

@@ -683,9 +683,8 @@ def initiate_validator_exit(state: BeaconState, index: ValidatorIndex) -> None:
```python
def switch_to_compounding_validator(state: BeaconState, index: ValidatorIndex) -> None:
validator = state.validators[index]
if has_eth1_withdrawal_credential(validator):
Copy link
Contributor

@rolfyone rolfyone Sep 11, 2024

Choose a reason for hiding this comment

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

We actually do need this check. Arguably just on queue_excess_active_balance, but if we're already a compounding validator and get consolidation into us, then we'd be re-queueing balance we've already waited for if we don't do this check...

The scenario would be pretty normal, for example if Im rolling a bunch of validators together. the first one would happen normally, but the second would queue 32 eth as excess balance. the third would queue 64 eth as excess balance... etc...

@rolfyone
Copy link
Contributor

rolfyone commented Sep 11, 2024

@ralexstokes Can you point at where the check is duplicated to make this clearer? I looked around but could have definitely missed it... my thought was you're talking about checking every time the fn is called, and that was the basis of my comment but now im second guessing it...

@ralexstokes
Copy link
Member Author

everywhere switch_to_compounding_validator is currently called already ensures up the call stack that the validator has eth1 credentials

so we don't really need it here

also I think this may change under #3918 anyway so this will likely be closed

@ralexstokes
Copy link
Member Author

will go ahead and close in lieu of #3918

@ralexstokes ralexstokes deleted the ralexstokes-patch-2 branch September 18, 2024 21:40
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.

2 participants