Proposer slashing is 0.8.3 (#425)
* minimal refactor of proposer slashings to 0.8.3; no semantic difference * actually mark spec
This commit is contained in:
parent
42d785816d
commit
f72de67f63
|
@ -139,16 +139,10 @@ func is_slashable_validator(validator: Validator, epoch: Epoch): bool =
|
|||
(validator.activation_epoch <= epoch) and
|
||||
(epoch < validator.withdrawable_epoch)
|
||||
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.6.3/specs/core/0_beacon-chain.md#proposer-slashings
|
||||
proc processProposerSlashings(
|
||||
state: var BeaconState, blck: BeaconBlock, flags: UpdateFlags,
|
||||
stateCache: var StateCache): bool =
|
||||
if len(blck.body.proposer_slashings) > MAX_PROPOSER_SLASHINGS:
|
||||
notice "PropSlash: too many!",
|
||||
proposer_slashings = len(blck.body.proposer_slashings)
|
||||
return false
|
||||
|
||||
for proposer_slashing in blck.body.proposer_slashings:
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.8.3/specs/core/0_beacon-chain.md#proposer-slashings
|
||||
proc process_proposer_slashing(
|
||||
state: var BeaconState, proposer_slashing: ProposerSlashing,
|
||||
flags: UpdateFlags, stateCache: var StateCache): bool =
|
||||
let proposer = state.validators[proposer_slashing.proposer_index.int]
|
||||
|
||||
# Verify that the epoch is the same
|
||||
|
@ -185,6 +179,21 @@ proc processProposerSlashings(
|
|||
|
||||
true
|
||||
|
||||
proc processProposerSlashings(
|
||||
state: var BeaconState, blck: BeaconBlock, flags: UpdateFlags,
|
||||
stateCache: var StateCache): bool =
|
||||
if len(blck.body.proposer_slashings) > MAX_PROPOSER_SLASHINGS:
|
||||
notice "PropSlash: too many!",
|
||||
proposer_slashings = len(blck.body.proposer_slashings)
|
||||
return false
|
||||
|
||||
for proposer_slashing in blck.body.proposer_slashings:
|
||||
if not process_proposer_slashing(
|
||||
state, proposer_slashing, flags, stateCache):
|
||||
return false
|
||||
|
||||
true
|
||||
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.8.3/specs/core/0_beacon-chain.md#is_slashable_attestation_data
|
||||
func is_slashable_attestation_data(
|
||||
data_1: AttestationData, data_2: AttestationData): bool =
|
||||
|
|
Loading…
Reference in New Issue