mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-01-12 11:44:41 +00:00
Fix test: use mainnet preset and accept deviation
This commit is contained in:
parent
6d0deddbe5
commit
93a31f9011
@ -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