diff --git a/presets/mainnet/eip7251.yaml b/presets/mainnet/eip7251.yaml index c303d8c20..f80e60e09 100644 --- a/presets/mainnet/eip7251.yaml +++ b/presets/mainnet/eip7251.yaml @@ -15,7 +15,8 @@ PENDING_CONSOLIDATIONS_LIMIT: 262144 # Reward and penalty quotients # --------------------------------------------------------------- -MIN_SLASHING_PENALTY_QUOTIENT_EIP7251: 65536 +MIN_SLASHING_PENALTY_QUOTIENT_EIP7251: 65536 +WHISTLEBLOWER_REWARD_QUOTIENT_EIP7251: 65536 # Max operations per block # --------------------------------------------------------------- diff --git a/presets/minimal/eip7251.yaml b/presets/minimal/eip7251.yaml index 1e8bc58d5..5d5cd911d 100644 --- a/presets/minimal/eip7251.yaml +++ b/presets/minimal/eip7251.yaml @@ -17,7 +17,8 @@ PENDING_CONSOLIDATIONS_LIMIT: 64 # Reward and penalty quotients # --------------------------------------------------------------- -MIN_SLASHING_PENALTY_QUOTIENT_EIP7251: 65536 +MIN_SLASHING_PENALTY_QUOTIENT_EIP7251: 65536 +WHISTLEBLOWER_REWARD_QUOTIENT_EIP7251: 65536 # Max operations per block # --------------------------------------------------------------- diff --git a/specs/_features/eip7251/beacon-chain.md b/specs/_features/eip7251/beacon-chain.md index 1ca8f4d40..51d11d2cd 100644 --- a/specs/_features/eip7251/beacon-chain.md +++ b/specs/_features/eip7251/beacon-chain.md @@ -109,7 +109,8 @@ The following values are (non-configurable) constants used throughout the specif | Name | Value | | - | - | -| `MIN_SLASHING_PENALTY_QUOTIENT_EIP7251` | `Gwei(2**16)` (= 65,536) | +| `MIN_SLASHING_PENALTY_QUOTIENT_EIP7251` | `uint64(2**16)` (= 65,536) | +| `WHISTLEBLOWER_REWARD_QUOTIENT_EIP7251` | `uint64(2**16)` (= 65,536) | ### Max operations per block @@ -489,7 +490,7 @@ def slash_validator(state: BeaconState, proposer_index = get_beacon_proposer_index(state) if whistleblower_index is None: whistleblower_index = proposer_index - whistleblower_reward = Gwei(validator.effective_balance // WHISTLEBLOWER_REWARD_QUOTIENT) + whistleblower_reward = Gwei(validator.effective_balance // WHISTLEBLOWER_REWARD_QUOTIENT_EIP7251) # [Modified in EIP7251] proposer_reward = Gwei(whistleblower_reward * PROPOSER_WEIGHT // WEIGHT_DENOMINATOR) increase_balance(state, proposer_index, proposer_reward) increase_balance(state, whistleblower_index, Gwei(whistleblower_reward - proposer_reward)) diff --git a/tests/core/pyspec/eth2spec/test/helpers/forks.py b/tests/core/pyspec/eth2spec/test/helpers/forks.py index d58743a7d..114d13b90 100644 --- a/tests/core/pyspec/eth2spec/test/helpers/forks.py +++ b/tests/core/pyspec/eth2spec/test/helpers/forks.py @@ -1,6 +1,6 @@ from .constants import ( PHASE0, ALTAIR, BELLATRIX, CAPELLA, DENEB, - EIP6110, EIP7002, WHISK, + EIP6110, EIP7002, WHISK, EIP7251, PREVIOUS_FORK_OF, ) @@ -45,6 +45,10 @@ def is_post_eip7002(spec): return is_post_fork(spec.fork, EIP7002) +def is_post_eip7251(spec): + return is_post_fork(spec.fork, EIP7251) + + def is_post_whisk(spec): return is_post_fork(spec.fork, WHISK) diff --git a/tests/core/pyspec/eth2spec/test/phase0/unittests/test_config_invariants.py b/tests/core/pyspec/eth2spec/test/phase0/unittests/test_config_invariants.py index c58f817f7..d7e60f160 100644 --- a/tests/core/pyspec/eth2spec/test/phase0/unittests/test_config_invariants.py +++ b/tests/core/pyspec/eth2spec/test/phase0/unittests/test_config_invariants.py @@ -4,7 +4,7 @@ from eth2spec.test.context import ( ) from eth2spec.test.helpers.constants import UINT64_MAX from eth2spec.test.helpers.forks import ( - is_post_altair, is_post_bellatrix, + is_post_altair, is_post_bellatrix, is_post_eip7251, ) @@ -58,6 +58,8 @@ def test_incentives(spec, state): assert spec.MIN_SLASHING_PENALTY_QUOTIENT_BELLATRIX <= spec.WHISTLEBLOWER_REWARD_QUOTIENT elif is_post_altair(spec): assert spec.MIN_SLASHING_PENALTY_QUOTIENT_ALTAIR <= spec.WHISTLEBLOWER_REWARD_QUOTIENT + elif is_post_eip7251(spec): + assert spec.MIN_SLASHING_PENALTY_QUOTIENT_EIP7251 <= spec.WHISTLEBLOWER_REWARD_QUOTIENT_EIP7251 else: assert spec.MIN_SLASHING_PENALTY_QUOTIENT <= spec.WHISTLEBLOWER_REWARD_QUOTIENT