hysteresis to -0.25/+1.25

This commit is contained in:
Danny Ryan 2020-03-02 15:55:01 -07:00
parent a02aac43c2
commit 0122081d05
No known key found for this signature in database
GPG Key ID: 2765A792E42CE07A
2 changed files with 3 additions and 3 deletions

View File

@ -1405,7 +1405,7 @@ def process_final_updates(state: BeaconState) -> None:
QUARTER_INCREMENT = EFFECTIVE_BALANCE_INCREMENT // 4
if (
balance + QUARTER_INCREMENT < validator.effective_balance
or validator.effective_balance + 7 * QUARTER_INCREMENT < balance
or validator.effective_balance + 5 * QUARTER_INCREMENT < balance
):
validator.effective_balance = min(balance - balance % EFFECTIVE_BALANCE_INCREMENT, MAX_EFFECTIVE_BALANCE)
# Reset slashings

View File

@ -62,8 +62,8 @@ def test_effective_balance_hysteresis(spec, state):
(max, max - inc, max - inc, "exactly 1 step lower"),
(max, max - inc - 1, max - (2 * inc), "past 1 step lower, double step"),
(max, max - inc + 1, max - inc, "close to 1 step lower"),
(min, min + (quar_inc * 7), min, "bigger balance, but not high enough"),
(min, min + (quar_inc * 7) + 1, min + inc, "bigger balance, high enough, but small step"),
(min, min + (quar_inc * 5), min, "bigger balance, but not high enough"),
(min, min + (quar_inc * 5) + 1, min + inc, "bigger balance, high enough, but small step"),
(min, min + (quar_inc * 8) - 1, min + inc, "bigger balance, high enough, close to double step"),
(min, min + (quar_inc * 8), min + (2 * inc), "exact two step balance increment"),
(min, min + (quar_inc * 8) + 1, min + (2 * inc), "over two steps, round down"),