Update whistleblower reward for eip7251

This commit is contained in:
Mikhail Kalinin 2024-03-20 16:10:30 +06:00
parent 17d65ca6b4
commit d48b5e0665
5 changed files with 15 additions and 6 deletions

View File

@ -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
# ---------------------------------------------------------------

View File

@ -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
# ---------------------------------------------------------------

View File

@ -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))

View File

@ -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)

View File

@ -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