light client bitfield is vector now, small size anyway, better separation of committee complexity from data init

This commit is contained in:
protolambda 2020-01-06 00:17:48 +01:00
parent 0cf866e799
commit 6b872da3ec
No known key found for this signature in database
GPG Key ID: EC89FDBB2B4C7623
1 changed files with 6 additions and 6 deletions

View File

@ -219,7 +219,7 @@ class BeaconBlockBody(Container):
# Shards # Shards
shard_transitions: Vector[ShardTransition, MAX_SHARDS] shard_transitions: Vector[ShardTransition, MAX_SHARDS]
# Light clients # Light clients
light_client_signature_bitfield: Bitlist[LIGHT_CLIENT_COMMITTEE_SIZE] light_client_signature_bitfield: Bitvector[LIGHT_CLIENT_COMMITTEE_SIZE]
light_client_signature: BLSSignature light_client_signature: BLSSignature
``` ```
@ -862,11 +862,11 @@ def process_light_client_signatures(state: BeaconState, block_body: BeaconBlockB
assert len(block_body.light_client_signature_bitfield) == len(committee) assert len(block_body.light_client_signature_bitfield) == len(committee)
total_reward = Gwei(0) total_reward = Gwei(0)
signer_keys = [] signer_keys = []
for i, participant_bit in enumerate(block_body.light_client_signature_bitfield): for bit_index, participant_index in enumerate(committee):
if participant_bit: if block_body.light_client_signature_bitfield[bit_index]:
signer_keys.append(state.validators[committee[i]].pubkey) signer_keys.append(state.validators[participant_index].pubkey)
increase_balance(state, committee[i], get_base_reward(state, committee[i])) increase_balance(state, participant_index, get_base_reward(state, participant_index))
total_reward += get_base_reward(state, committee[i]) total_reward += get_base_reward(state, participant_index)
increase_balance(state, get_beacon_proposer_index(state), Gwei(total_reward // PROPOSER_REWARD_QUOTIENT)) increase_balance(state, get_beacon_proposer_index(state), Gwei(total_reward // PROPOSER_REWARD_QUOTIENT))