-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Update correlation penalty for EIP-7251 #14456
Conversation
c059a20
to
5f54320
Compare
6d89f55
to
9fb665c
Compare
// Modified in Electra:EIP7251 | ||
var penaltyPerEffectiveBalanceIncrement uint64 | ||
if st.Version() == version.Electra { | ||
penaltyPerEffectiveBalanceIncrement = minSlashing / (totalBalance / increment) |
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.
can (totalBalance / increment) ever be 0?
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.
no, I dont think it can
9fb665c
to
2ecf5cb
Compare
penaltyNumerator := val.EffectiveBalance() / increment * minSlashing | ||
penalty := penaltyNumerator / totalBalance * increment | ||
var penalty uint64 | ||
if st.Version() == version.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.
should we do st.Version() >= version.Electra? might not change next hard fork
|
||
// Modified in Electra:EIP7251 | ||
var penaltyPerEffectiveBalanceIncrement uint64 | ||
if st.Version() == version.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.
The future me wants this :)
if st.Version() == version.Electra { | |
if st.Version() >= version.Electra { |
dccb780
to
e541901
Compare
e541901
to
b196f21
Compare
This PR fixes an issue in the correlation penalty computation that caused a zero penalty for 32 ETH validators and a non-zero penalty for 2048 ETH validators under certain slashed balances, leading to an imbalance. The fix ensures penalties are computed per effective balance increment, preventing overflow and balancing penalties for different validator sizes.
Reference: ethereum/consensus-specs#3882