mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-02-03 22:34:58 +00:00
Merge pull request #2514 from ethereum/sync-agg-target
target sync committee aggregators to 16
This commit is contained in:
commit
2275780216
@ -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
|
||||
|
@ -13,6 +13,7 @@ from eth2spec.test.context import (
|
||||
with_presets,
|
||||
)
|
||||
from eth2spec.test.helpers.constants import (
|
||||
MAINNET,
|
||||
MINIMAL,
|
||||
)
|
||||
|
||||
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user