Apply refactoring suggestions from Danny
This commit is contained in:
parent
e7f070d525
commit
a8370f7448
|
@ -516,12 +516,8 @@ def process_custody_slashing(state: BeaconState, signed_custody_slashing: Signed
|
|||
shard_transition = custody_slashing.shard_transition
|
||||
assert hash_tree_root(shard_transition) == attestation.data.shard_transition_root
|
||||
# Verify that the provided data matches the shard-transition
|
||||
assert (
|
||||
hash_tree_root(custody_slashing.data)
|
||||
== shard_transition.shard_data_roots[custody_slashing.data_index]
|
||||
)
|
||||
assert len(custody_slashing.data) == shard_transition.shard_block_lengths[custody_slashing.data_index]
|
||||
|
||||
assert hash_tree_root(custody_slashing.data) == shard_transition.shard_data_roots[custody_slashing.data_index]
|
||||
# Verify existence and participation of claimed malefactor
|
||||
attesters = get_attesting_indices(state, attestation.data, attestation.aggregation_bits)
|
||||
assert custody_slashing.malefactor_index in attesters
|
||||
|
|
|
@ -150,7 +150,7 @@ def get_valid_custody_chunk_response(spec, state, chunk_challenge, challenge_ind
|
|||
chunk_index = chunk_challenge.chunk_index
|
||||
|
||||
leaf_index = chunk_index + 2**spec.CUSTODY_RESPONSE_DEPTH
|
||||
serialized_length = (len(custody_data_block)).to_bytes(32, 'little')
|
||||
serialized_length = len(custody_data_block).to_bytes(32, 'little')
|
||||
data_branch = build_proof(custody_data_block.get_backing().get_left(), leaf_index) + [serialized_length]
|
||||
|
||||
return spec.CustodyChunkResponse(
|
||||
|
|
Loading…
Reference in New Issue