diff --git a/configs/mainnet/altair.yaml b/configs/mainnet/altair.yaml index ee3785f14..f30e9fcdc 100644 --- a/configs/mainnet/altair.yaml +++ b/configs/mainnet/altair.yaml @@ -5,11 +5,11 @@ CONFIG_NAME: "mainnet" # Updated penalty values # --------------------------------------------------------------- # 3 * 2**24 (= 50,331,648) -ALTAIR_INACTIVITY_PENALTY_QUOTIENT: 50331648 +INACTIVITY_PENALTY_QUOTIENT_ALTAIR: 50331648 # 2**6 (= 64) -ALTAIR_MIN_SLASHING_PENALTY_QUOTIENT: 64 +MIN_SLASHING_PENALTY_QUOTIENT_ALTAIR: 64 # 2 -ALTAIR_PROPORTIONAL_SLASHING_MULTIPLIER: 2 +PROPORTIONAL_SLASHING_MULTIPLIER_ALTAIR: 2 # Misc diff --git a/configs/minimal/altair.yaml b/configs/minimal/altair.yaml index a70c0404b..afdaf9eb5 100644 --- a/configs/minimal/altair.yaml +++ b/configs/minimal/altair.yaml @@ -5,11 +5,11 @@ CONFIG_NAME: "minimal" # Updated penalty values # --------------------------------------------------------------- # 3 * 2**24 (= 50,331,648) -ALTAIR_INACTIVITY_PENALTY_QUOTIENT: 50331648 +INACTIVITY_PENALTY_QUOTIENT_ALTAIR: 50331648 # 2**6 (= 64) -ALTAIR_MIN_SLASHING_PENALTY_QUOTIENT: 64 +MIN_SLASHING_PENALTY_QUOTIENT_ALTAIR: 64 # 2 -ALTAIR_PROPORTIONAL_SLASHING_MULTIPLIER: 2 +PROPORTIONAL_SLASHING_MULTIPLIER_ALTAIR: 2 # Misc diff --git a/specs/altair/beacon-chain.md b/specs/altair/beacon-chain.md index 5c266a81c..9b6428148 100644 --- a/specs/altair/beacon-chain.md +++ b/specs/altair/beacon-chain.md @@ -105,9 +105,9 @@ This patch updates a few configuration values to move penalty parameters toward | Name | Value | | - | - | -| `ALTAIR_INACTIVITY_PENALTY_QUOTIENT` | `uint64(3 * 2**24)` (= 50,331,648) | -| `ALTAIR_MIN_SLASHING_PENALTY_QUOTIENT` | `uint64(2**6)` (= 64) | -| `ALTAIR_PROPORTIONAL_SLASHING_MULTIPLIER` | `uint64(2)` | +| `INACTIVITY_PENALTY_QUOTIENT_ALTAIR` | `uint64(3 * 2**24)` (= 50,331,648) | +| `MIN_SLASHING_PENALTY_QUOTIENT_ALTAIR` | `uint64(2**6)` (= 64) | +| `PROPORTIONAL_SLASHING_MULTIPLIER_ALTAIR` | `uint64(2)` | ### Misc @@ -365,7 +365,7 @@ def get_inactivity_penalty_deltas(state: BeaconState) -> Tuple[Sequence[Gwei], S penalties[index] += Gwei(get_base_reward(state, index) * numerator // FLAG_DENOMINATOR) if index not in matching_target_indices: penalty_numerator = state.validators[index].effective_balance * state.inactivity_scores[index] - penalty_denominator = INACTIVITY_SCORE_BIAS * ALTAIR_INACTIVITY_PENALTY_QUOTIENT + penalty_denominator = INACTIVITY_SCORE_BIAS * INACTIVITY_PENALTY_QUOTIENT_ALTAIR penalties[index] += Gwei(penalty_numerator // penalty_denominator) return rewards, penalties ``` @@ -374,7 +374,7 @@ def get_inactivity_penalty_deltas(state: BeaconState) -> Tuple[Sequence[Gwei], S #### Modified `slash_validator` -*Note*: The function `slash_validator` is modified to use `ALTAIR_MIN_SLASHING_PENALTY_QUOTIENT`. +*Note*: The function `slash_validator` is modified to use `MIN_SLASHING_PENALTY_QUOTIENT_ALTAIR`. ```python def slash_validator(state: BeaconState, @@ -389,7 +389,7 @@ def slash_validator(state: BeaconState, validator.slashed = True validator.withdrawable_epoch = max(validator.withdrawable_epoch, Epoch(epoch + EPOCHS_PER_SLASHINGS_VECTOR)) state.slashings[epoch % EPOCHS_PER_SLASHINGS_VECTOR] += validator.effective_balance - decrease_balance(state, slashed_index, validator.effective_balance // ALTAIR_MIN_SLASHING_PENALTY_QUOTIENT) + decrease_balance(state, slashed_index, validator.effective_balance // MIN_SLASHING_PENALTY_QUOTIENT_ALTAIR) # Apply proposer and whistleblower rewards proposer_index = get_beacon_proposer_index(state) @@ -636,13 +636,13 @@ def process_rewards_and_penalties(state: BeaconState) -> None: #### Slashings -*Note*: The function `process_slashings` is modified to use `ALTAIR_PROPORTIONAL_SLASHING_MULTIPLIER`. +*Note*: The function `process_slashings` is modified to use `PROPORTIONAL_SLASHING_MULTIPLIER_ALTAIR`. ```python def process_slashings(state: BeaconState) -> None: epoch = get_current_epoch(state) total_balance = get_total_active_balance(state) - adjusted_total_slashing_balance = min(sum(state.slashings) * ALTAIR_PROPORTIONAL_SLASHING_MULTIPLIER, total_balance) + adjusted_total_slashing_balance = min(sum(state.slashings) * PROPORTIONAL_SLASHING_MULTIPLIER_ALTAIR, total_balance) for index, validator in enumerate(state.validators): if validator.slashed and epoch + EPOCHS_PER_SLASHINGS_VECTOR // 2 == validator.withdrawable_epoch: increment = EFFECTIVE_BALANCE_INCREMENT # Factored out from penalty numerator to avoid uint64 overflow diff --git a/tests/core/pyspec/eth2spec/test/helpers/proposer_slashings.py b/tests/core/pyspec/eth2spec/test/helpers/proposer_slashings.py index 97d09b141..d3520e580 100644 --- a/tests/core/pyspec/eth2spec/test/helpers/proposer_slashings.py +++ b/tests/core/pyspec/eth2spec/test/helpers/proposer_slashings.py @@ -6,7 +6,7 @@ from eth2spec.test.helpers.state import get_balance def get_min_slashing_penalty_quotient(spec): if is_post_altair(spec): - return spec.ALTAIR_MIN_SLASHING_PENALTY_QUOTIENT + return spec.MIN_SLASHING_PENALTY_QUOTIENT_ALTAIR else: return spec.MIN_SLASHING_PENALTY_QUOTIENT diff --git a/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_slashings.py b/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_slashings.py index b31f6fb81..b7ae3cf4e 100644 --- a/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_slashings.py +++ b/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_slashings.py @@ -25,7 +25,7 @@ def slash_validators(spec, state, indices, out_epochs): def get_slashing_multiplier(spec): if is_post_altair(spec): - return spec.ALTAIR_PROPORTIONAL_SLASHING_MULTIPLIER + return spec.PROPORTIONAL_SLASHING_MULTIPLIER_ALTAIR else: return spec.PROPORTIONAL_SLASHING_MULTIPLIER