EIP-7594: add custody settings config (#3766)

* EIP-7594: add custody settings config

* Add `TARGET_NUMBER_OF_PEERS` to config

* add TARGET_NUMBER_OF_PEERS

Co-authored-by: Hsiao-Wei Wang <hsiaowei.eth@gmail.com>

* fix double TARGET_NUMBER_OF_PEERS

* fix tests

---------

Co-authored-by: Hsiao-Wei Wang <hsiaowei.eth@gmail.com>
This commit is contained in:
Andrew Davis 2024-05-15 15:34:41 +03:00 committed by GitHub
parent fdeff744ff
commit d295813155
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 13 additions and 7 deletions

View File

@ -159,6 +159,9 @@ NUMBER_OF_COLUMNS: 128
MAX_CELLS_IN_EXTENDED_MATRIX: 768
DATA_COLUMN_SIDECAR_SUBNET_COUNT: 32
MAX_REQUEST_DATA_COLUMN_SIDECARS: 16384
SAMPLES_PER_SLOT: 8
CUSTODY_REQUIREMENT: 1
TARGET_NUMBER_OF_PEERS: 70
# [New in Electra:EIP7251]
MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA: 128000000000 # 2**7 * 10**9 (= 128,000,000,000)

View File

@ -158,6 +158,9 @@ NUMBER_OF_COLUMNS: 128
MAX_CELLS_IN_EXTENDED_MATRIX: 768
DATA_COLUMN_SIDECAR_SUBNET_COUNT: 32
MAX_REQUEST_DATA_COLUMN_SIDECARS: 16384
SAMPLES_PER_SLOT: 8
CUSTODY_REQUIREMENT: 1
TARGET_NUMBER_OF_PEERS: 70
# [New in Electra:EIP7251]
MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA: 64000000000 # 2**6 * 10**9 (= 64,000,000,000)

View File

@ -11,8 +11,8 @@ from eth2spec.test.context import (
def test_invariants(spec):
assert spec.FIELD_ELEMENTS_PER_BLOB % spec.FIELD_ELEMENTS_PER_CELL == 0
assert spec.FIELD_ELEMENTS_PER_EXT_BLOB % spec.config.NUMBER_OF_COLUMNS == 0
assert spec.SAMPLES_PER_SLOT <= spec.config.NUMBER_OF_COLUMNS
assert spec.CUSTODY_REQUIREMENT <= spec.config.DATA_COLUMN_SIDECAR_SUBNET_COUNT
assert spec.config.SAMPLES_PER_SLOT <= spec.config.NUMBER_OF_COLUMNS
assert spec.config.CUSTODY_REQUIREMENT <= spec.config.DATA_COLUMN_SIDECAR_SUBNET_COUNT
assert spec.config.DATA_COLUMN_SIDECAR_SUBNET_COUNT <= spec.config.NUMBER_OF_COLUMNS
assert spec.config.NUMBER_OF_COLUMNS % spec.config.DATA_COLUMN_SIDECAR_SUBNET_COUNT == 0
assert spec.config.MAX_REQUEST_DATA_COLUMN_SIDECARS == (

View File

@ -9,7 +9,7 @@ from eth2spec.test.context import (
def run_get_custody_columns(spec, peer_count, custody_subnet_count):
assignments = [spec.get_custody_columns(node_id, custody_subnet_count) for node_id in range(peer_count)]
columns_per_subnet = spec.NUMBER_OF_COLUMNS // spec.config.DATA_COLUMN_SIDECAR_SUBNET_COUNT
columns_per_subnet = spec.config.NUMBER_OF_COLUMNS // spec.config.DATA_COLUMN_SIDECAR_SUBNET_COUNT
for assignment in assignments:
assert len(assignment) == custody_subnet_count * columns_per_subnet
assert len(assignment) == len(set(assignment))
@ -20,8 +20,8 @@ def run_get_custody_columns(spec, peer_count, custody_subnet_count):
@single_phase
def test_get_custody_columns_peers_within_number_of_columns(spec):
peer_count = 10
custody_subnet_count = spec.CUSTODY_REQUIREMENT
assert spec.NUMBER_OF_COLUMNS > peer_count
custody_subnet_count = spec.config.CUSTODY_REQUIREMENT
assert spec.config.NUMBER_OF_COLUMNS > peer_count
run_get_custody_columns(spec, peer_count, custody_subnet_count)
@ -30,8 +30,8 @@ def test_get_custody_columns_peers_within_number_of_columns(spec):
@single_phase
def test_get_custody_columns_peers_more_than_number_of_columns(spec):
peer_count = 200
custody_subnet_count = spec.CUSTODY_REQUIREMENT
assert spec.NUMBER_OF_COLUMNS < peer_count
custody_subnet_count = spec.config.CUSTODY_REQUIREMENT
assert spec.config.NUMBER_OF_COLUMNS < peer_count
run_get_custody_columns(spec, peer_count, custody_subnet_count)