mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-02-03 14:24:24 +00:00
fix: check malefactor custody key
This commit is contained in:
parent
41be2ed3ce
commit
1623d40b6d
@ -378,13 +378,21 @@ def process_custody_slashing(state: BeaconState, custody_slashing: CustodySlashi
|
|||||||
attesters = get_attesting_indices(state, attestation.data, attestation.aggregation_bits)
|
attesters = get_attesting_indices(state, attestation.data, attestation.aggregation_bits)
|
||||||
assert custody_slashing.malefactor_index in attesters
|
assert custody_slashing.malefactor_index in attesters
|
||||||
|
|
||||||
|
# Verify the malefactor custody key
|
||||||
|
epoch_to_sign = get_randao_epoch_for_custody_period(
|
||||||
|
get_custody_period_for_validator(state, custody_slashing.malefactor_index, attestation.data.target.epoch),
|
||||||
|
custody_slashing.malefactor_index,
|
||||||
|
)
|
||||||
|
domain = get_domain(state, DOMAIN_RANDAO, epoch_to_sign)
|
||||||
|
assert bls_verify(malefactor.pubkey, hash_tree_root(epoch_to_sign), custody_slashing.malefactor_key, domain)
|
||||||
|
|
||||||
# Get the custody bit
|
# Get the custody bit
|
||||||
custody_bits = attestation.custody_bits[custody_slashing.data_index]
|
custody_bits = attestation.custody_bits[custody_slashing.data_index]
|
||||||
committee = get_beacon_committee(state, attestation.data.slot, attestation.data.index)
|
committee = get_beacon_committee(state, attestation.data.slot, attestation.data.index)
|
||||||
claimed_custody_bit = custody_bits[committee.index(custody_slashing.malefactor_index)]
|
claimed_custody_bit = custody_bits[committee.index(custody_slashing.malefactor_index)]
|
||||||
|
|
||||||
# Compute the custody bit
|
# Compute the custody bit
|
||||||
computed_custody_bit = compute_custody_bit(custody_slashing.data)
|
computed_custody_bit = compute_custody_bit(custody_slashing.malefactor_key, custody_slashing.data)
|
||||||
|
|
||||||
# Verify the claim
|
# Verify the claim
|
||||||
if claimed_custody_bit != computed_custody_bit:
|
if claimed_custody_bit != computed_custody_bit:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user