-
Notifications
You must be signed in to change notification settings - Fork 984
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
Switch the rest of the spec to MAX_EFFECTIVE_BALANCE_ELECTRA #3783
Conversation
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 catch @mkalinin ! 🙏
if not is_post_electra(spec): | ||
return misc_balances(spec) |
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.
is it possible that, instead of adding new misc_balances_electra
, we modify misc_balances
by adding new if is_post_electra(spec)
logic?
if not is_post_electra(spec): | ||
return default_balances(spec) |
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.
ditto. Is it possible that instead of adding new default_balances_electra,
we modify default_balances
by adding new if is_post_electra(spec)
logic?
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 was thinking about this approach but then decided to keep default balances as is because it makes a test run with 32 ETH balance validators which is also important for Electra. Ideally, we should run tests with MIN_ACTIVATION_BALANCE
, MAX_EFFECTIVE_BALANCE_ELECTRA
and something in between. It is probably better to handle this modification separately.
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.
It's probably more just the naming problem; when I read default_balances_electra
, I thought it is just "the default balances post-electra," but it is actually compatible with pre-electra. But I understand what you wanted to present.
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.
what about calling it max_balances
instead? To me it explains pretty clearly what it does
Co-authored-by: Hsiao-Wei Wang <[email protected]>
if not is_post_electra(spec): | ||
return default_balances(spec) |
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.
It's probably more just the naming problem; when I read default_balances_electra
, I thought it is just "the default balances post-electra," but it is actually compatible with pre-electra. But I understand what you wanted to present.
Co-authored-by: Hsiao-Wei Wang <[email protected]>
ba90964
to
718aadf
Compare
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.
Generally lgtm
validator = spec.Validator( | ||
pubkey=active_pubkey, | ||
withdrawal_credentials=withdrawal_credentials, | ||
activation_eligibility_epoch=spec.FAR_FUTURE_EPOCH, | ||
activation_epoch=spec.FAR_FUTURE_EPOCH, | ||
exit_epoch=spec.FAR_FUTURE_EPOCH, | ||
withdrawable_epoch=spec.FAR_FUTURE_EPOCH, | ||
effective_balance=min(balance - balance % spec.EFFECTIVE_BALANCE_INCREMENT, spec.MAX_EFFECTIVE_BALANCE) | ||
effective_balance=min(balance - balance % spec.EFFECTIVE_BALANCE_INCREMENT, max_effective_balace) |
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.
effective_balance=min(balance - balance % spec.EFFECTIVE_BALANCE_INCREMENT, max_effective_balace) | |
effective_balance=min(balance - balance % spec.EFFECTIVE_BALANCE_INCREMENT, max_effective_balance) |
else: | ||
# insecurely use pubkey as withdrawal key as well | ||
withdrawal_credentials = spec.BLS_WITHDRAWAL_PREFIX + spec.hash(withdrawal_pubkey)[1:] | ||
max_effective_balace = spec.MAX_EFFECTIVE_BALANCE |
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.
max_effective_balace = spec.MAX_EFFECTIVE_BALANCE | |
max_effective_balance = spec.MAX_EFFECTIVE_BALANCE |
else: | ||
# insecurely use pubkey as withdrawal key as well | ||
withdrawal_credentials = spec.BLS_WITHDRAWAL_PREFIX + spec.hash(withdrawal_pubkey)[1:] | ||
max_effective_balace = spec.MAX_EFFECTIVE_BALANCE_ELECTRA |
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.
max_effective_balace = spec.MAX_EFFECTIVE_BALANCE_ELECTRA | |
max_effective_balance = spec.MAX_EFFECTIVE_BALANCE_ELECTRA |
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.
ooops. will fix it after the release.
Thanks for the review!
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! +1 to hww's comments, but it looks like something was sorted
This PR makes the rest of the places of the spec to use the new
MAX_EFFECTIVE_BALANCE_ELECTRA
preset instead of the old one, namely:initialize_beacon_state_from_eth1
get_next_sync_committee_indices
One exception is
compute_weak_subjectivity_period
function which implements the strategy outlined in the WS research paper thus doesn’t need to be updated.This change entails the following updates into the spec tests:
MAX_EFFECTIVE_BALANCE_ELECTRA
in thebuild_mock_validator
for post-Electra forksMAX_EFFECTIVE_BALANCE_ELECTRA
intest_initialize_beacon_state_some_small_balances
when post-ElectraMAX_EFFECTIVE_BALANCE_ELECTRA
balance for sync committee tests post-Electra affected by the change toget_next_sync_committee_indices