Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for SyncAggregate with no participants and all zero signature #2523

Merged
merged 3 commits into from
Jul 17, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,47 @@ def test_invalid_signature_missing_participant(spec, state):
yield from run_sync_committee_processing(spec, state, block, expect_exception=True)


@with_altair_and_later
@spec_state_test
@always_bls
def test_invalid_signature_no_participants(spec, state):
block = build_empty_block_for_next_slot(spec, state)
# No participants is an allowed case, but needs a specific signature, not the full-zeroed signature.
block.body.sync_aggregate = spec.SyncAggregate(
sync_committee_bits=[False] * len(block.body.sync_aggregate.sync_committee_bits),
sync_committee_signature=b'\x00' * 96
)
yield from run_sync_committee_processing(spec, state, block, expect_exception=True)

# No-participants, with valid signature, is tested in test_sync_committee_rewards_empty_participants already.


@with_altair_and_later
@spec_state_test
@always_bls
def test_invalid_signature_infinite_signature_with_all_participants(spec, state):
block = build_empty_block_for_next_slot(spec, state)
# Include all participants, try the special-case signature for no-participants
block.body.sync_aggregate = spec.SyncAggregate(
sync_committee_bits=[True] * len(block.body.sync_aggregate.sync_committee_bits),
sync_committee_signature=spec.G2_POINT_AT_INFINITY
)
yield from run_sync_committee_processing(spec, state, block, expect_exception=True)


@with_altair_and_later
@spec_state_test
@always_bls
def test_invalid_signature_infinite_signature_with_single_participant(spec, state):
block = build_empty_block_for_next_slot(spec, state)
# Try include a single participant with the special-case signature for no-participants.
block.body.sync_aggregate = spec.SyncAggregate(
sync_committee_bits=[True] + ([False] * (len(block.body.sync_aggregate.sync_committee_bits) - 1)),
sync_committee_signature=spec.G2_POINT_AT_INFINITY
)
yield from run_sync_committee_processing(spec, state, block, expect_exception=True)


@with_altair_and_later
@spec_state_test
@always_bls
Expand Down