Skip to content

Commit

Permalink
Merge pull request #2514 from ethereum/sync-agg-target
Browse files Browse the repository at this point in the history
target sync committee aggregators to 16
  • Loading branch information
djrtwo authored Jul 13, 2021
2 parents 0c01b9e + 93a31f9 commit 2275780
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion specs/altair/validator.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ This document is currently illustrative for early Altair testnets and some parts

| Name | Value | Unit |
| - | - | :-: |
| `TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE` | `2**2` (= 4) | validators |
| `TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE` | `2**4` (= 16) | validators |
| `SYNC_COMMITTEE_SUBNET_COUNT` | `4` | The number of sync committee subnets used in the gossipsub aggregation protocol. |

## Containers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
with_presets,
)
from eth2spec.test.helpers.constants import (
MAINNET,
MINIMAL,
)

Expand Down Expand Up @@ -260,16 +261,21 @@ def test_get_sync_committee_selection_proof(spec, state):

@with_altair_and_later
@spec_state_test
@always_bls
@with_presets([MAINNET], reason="to test against the mainnet SYNC_COMMITTEE_SIZE")
def test_is_sync_committee_aggregator(spec, state):
sample_count = int(spec.SYNC_COMMITTEE_SIZE // spec.SYNC_COMMITTEE_SUBNET_COUNT)
sample_count = int(spec.SYNC_COMMITTEE_SIZE // spec.SYNC_COMMITTEE_SUBNET_COUNT) * 100
is_aggregator_count = 0
for i in range(sample_count):
signature = spec.hash(i.to_bytes(32, byteorder="little"))
if spec.is_sync_committee_aggregator(signature):
is_aggregator_count += 1

assert is_aggregator_count == spec.TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE
# Accept ~10% deviation
assert (
spec.TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE * 100 * 0.9
<= is_aggregator_count
<= spec.TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE * 100 * 1.1
)


@with_altair_and_later
Expand Down

0 comments on commit 2275780

Please sign in to comment.