Skip to content

Commit

Permalink
EIP-7594: add custody settings config (#3766)
Browse files Browse the repository at this point in the history
* EIP-7594: add custody settings config

* Add `TARGET_NUMBER_OF_PEERS` to config

* add TARGET_NUMBER_OF_PEERS

Co-authored-by: Hsiao-Wei Wang <[email protected]>

* fix double TARGET_NUMBER_OF_PEERS

* fix tests

---------

Co-authored-by: Hsiao-Wei Wang <[email protected]>
  • Loading branch information
Savid and hwwhww authored May 15, 2024
1 parent fdeff74 commit d295813
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
3 changes: 3 additions & 0 deletions configs/mainnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions configs/minimal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
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 == (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
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))
Expand All @@ -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)


Expand All @@ -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)


Expand Down

0 comments on commit d295813

Please sign in to comment.