mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-01-14 20:54:27 +00:00
Only slash active validators
This is to prevent a spam/DoS attack where validators with zero balance get "slashed" but no validator loses any balance.
This commit is contained in:
parent
91a0c1ba5f
commit
dc4b652f72
@ -2315,8 +2315,8 @@ def process_proposer_slashing(state: BeaconState,
|
|||||||
assert slot_to_epoch(proposer_slashing.header_1.slot) == slot_to_epoch(proposer_slashing.header_2.slot)
|
assert slot_to_epoch(proposer_slashing.header_1.slot) == slot_to_epoch(proposer_slashing.header_2.slot)
|
||||||
# But the headers are different
|
# But the headers are different
|
||||||
assert proposer_slashing.header_1 != proposer_slashing.header_2
|
assert proposer_slashing.header_1 != proposer_slashing.header_2
|
||||||
# Proposer is not yet slashed
|
# Proposer is active and not already slashed
|
||||||
assert proposer.slashed is False
|
assert is_active_validator(proposer) and proposer.slashed is False
|
||||||
# Signatures are valid
|
# Signatures are valid
|
||||||
for header in (proposer_slashing.header_1, proposer_slashing.header_2):
|
for header in (proposer_slashing.header_1, proposer_slashing.header_2):
|
||||||
assert bls_verify(
|
assert bls_verify(
|
||||||
@ -2355,6 +2355,7 @@ def process_attester_slashing(state: BeaconState,
|
|||||||
index for index in attestation1.validator_indices
|
index for index in attestation1.validator_indices
|
||||||
if (
|
if (
|
||||||
index in attestation2.validator_indices and
|
index in attestation2.validator_indices and
|
||||||
|
is_active_validator(state.validator_registry[index]) and
|
||||||
state.validator_registry[index].slashed is False
|
state.validator_registry[index].slashed is False
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user