be specific about which slot we want a sync committee root for

This commit is contained in:
Alex Stokes 2021-08-25 10:38:01 -07:00
parent 02bc6541d9
commit 4d4f4e89f4
No known key found for this signature in database
GPG Key ID: 99B3D88FD6C55A69
2 changed files with 8 additions and 3 deletions

View File

@ -213,7 +213,7 @@ def run_test_full_random_operations(spec, state, rng=Random(2080)):
yield 'post', state
def get_random_sync_aggregate(spec, state, fraction_participated=1.0, rng=Random(2099)):
def get_random_sync_aggregate(spec, state, slot, fraction_participated=1.0, rng=Random(2099)):
committee_indices = compute_committee_indices(spec, state, state.current_sync_committee)
participant_count = int(len(committee_indices) * fraction_participated)
participant_indices = rng.sample(range(len(committee_indices)), participant_count)
@ -224,7 +224,7 @@ def get_random_sync_aggregate(spec, state, fraction_participated=1.0, rng=Random
signature = compute_aggregate_sync_committee_signature(
spec,
state,
state.slot - 1,
slot,
participants,
)
return spec.SyncAggregate(

View File

@ -123,7 +123,12 @@ def random_block_altair(spec, state, signed_blocks):
block = random_block(spec, state, signed_blocks)
fraction_missed = len(signed_blocks) / SYNC_AGGREGATE_PARTICIPATION_BUCKETS
fraction_participated = 1.0 - fraction_missed
block.body.sync_aggregate = get_random_sync_aggregate(spec, state, fraction_participated=fraction_participated)
block.body.sync_aggregate = get_random_sync_aggregate(
spec,
state,
block.slot - 1,
fraction_participated=fraction_participated,
)
return block