From 6d0deddbe5933f628fa53d5cb71ac6136429f13f Mon Sep 17 00:00:00 2001 From: Danny Ryan Date: Mon, 12 Jul 2021 09:03:43 -0600 Subject: [PATCH 1/2] modify target sync committee aggregators to more sound 16 --- specs/altair/validator.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/altair/validator.md b/specs/altair/validator.md index 49146da00b..8742900bc7 100644 --- a/specs/altair/validator.md +++ b/specs/altair/validator.md @@ -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 From 93a31f9011e3dcec167cdbca4d2171142931b149 Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Tue, 13 Jul 2021 00:16:31 +0800 Subject: [PATCH 2/2] Fix test: use mainnet preset and accept deviation --- .../altair/unittests/validator/test_validator.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/core/pyspec/eth2spec/test/altair/unittests/validator/test_validator.py b/tests/core/pyspec/eth2spec/test/altair/unittests/validator/test_validator.py index e46b6dc5f5..dd9214040e 100644 --- a/tests/core/pyspec/eth2spec/test/altair/unittests/validator/test_validator.py +++ b/tests/core/pyspec/eth2spec/test/altair/unittests/validator/test_validator.py @@ -13,6 +13,7 @@ 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