remove explicitly handling empty attestation

This commit is contained in:
Danny Ryan 2019-10-05 06:56:54 +09:00
parent 2af39ad469
commit dc4869349c
No known key found for this signature in database
GPG Key ID: 2765A792E42CE07A
2 changed files with 10 additions and 12 deletions

View File

@ -384,11 +384,6 @@ def process_shard_attestations(beacon_state: BeaconState, shard_state: ShardStat
pubkeys.append(beacon_state.validators[validator_index].pubkey)
process_delta(beacon_state, shard_state, validator_index, get_base_reward(beacon_state, validator_index))
attestation_count += 1
# Exit early if no participants
if not any(pubkeys):
assert block.attestations == BLSSignature()
return
# Verify there are no extraneous bits set beyond the shard committee
for i in range(len(shard_committee), 2 * MAX_PERIOD_COMMITTEE_SIZE):
assert block.aggregation_bits[i] == 0b0

View File

@ -66,13 +66,16 @@ def build_empty_shard_block(spec,
(True,) * len(shard_committee) +
(False,) * (spec.MAX_PERIOD_COMMITTEE_SIZE * 2 - len(shard_committee))
)
block.attestations = sign_shard_attestation(
spec,
beacon_state,
shard_state,
block,
participants=shard_committee,
)
else:
shard_committee = []
block.attestations = sign_shard_attestation(
spec,
beacon_state,
shard_state,
block,
participants=shard_committee,
)
if signed:
sign_shard_block(spec, beacon_state, shard_state, block)