From 1623d40b6df8d9c03c691ad79413ec4eb8050084 Mon Sep 17 00:00:00 2001 From: protolambda Date: Wed, 20 Nov 2019 04:48:00 +0100 Subject: [PATCH] fix: check malefactor custody key --- specs/core/1_custody-game.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/specs/core/1_custody-game.md b/specs/core/1_custody-game.md index ebba75a7f..ed91bf8a0 100644 --- a/specs/core/1_custody-game.md +++ b/specs/core/1_custody-game.md @@ -378,13 +378,21 @@ def process_custody_slashing(state: BeaconState, custody_slashing: CustodySlashi attesters = get_attesting_indices(state, attestation.data, attestation.aggregation_bits) 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 custody_bits = attestation.custody_bits[custody_slashing.data_index] committee = get_beacon_committee(state, attestation.data.slot, attestation.data.index) claimed_custody_bit = custody_bits[committee.index(custody_slashing.malefactor_index)] # 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 if claimed_custody_bit != computed_custody_bit: