From aa75fb0b693f3402c539ad0ad0f53be6c2de7869 Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Fri, 12 Jun 2020 00:47:26 +0800 Subject: [PATCH] Fix `MAX_SHARDS` and move config files to `configs/{network}/{fork}` --- .../{mainnet_phase0.yaml => mainnet/phase0.yaml} | 0 .../{mainnet_phase1.yaml => mainnet/phase1.yaml} | 7 +++---- .../{minimal_phase0.yaml => minimal/phase0.yaml} | 0 .../{minimal_phase1.yaml => minimal/phase1.yaml} | 0 tests/core/pyspec/eth2spec/config/config_util.py | 13 ++++++------- 5 files changed, 9 insertions(+), 11 deletions(-) rename configs/{mainnet_phase0.yaml => mainnet/phase0.yaml} (100%) rename configs/{mainnet_phase1.yaml => mainnet/phase1.yaml} (97%) rename configs/{minimal_phase0.yaml => minimal/phase0.yaml} (100%) rename configs/{minimal_phase1.yaml => minimal/phase1.yaml} (100%) diff --git a/configs/mainnet_phase0.yaml b/configs/mainnet/phase0.yaml similarity index 100% rename from configs/mainnet_phase0.yaml rename to configs/mainnet/phase0.yaml diff --git a/configs/mainnet_phase1.yaml b/configs/mainnet/phase1.yaml similarity index 97% rename from configs/mainnet_phase1.yaml rename to configs/mainnet/phase1.yaml index f9bd744b0..cddbb8dfe 100644 --- a/configs/mainnet_phase1.yaml +++ b/configs/mainnet/phase1.yaml @@ -1,7 +1,7 @@ # Mainnet preset - phase 1 -# # phase1-fork +# phase1-fork # --------------------------------------------------------------- PHASE_1_FORK_VERSION: 0x01000000 # [STUB] @@ -13,7 +13,7 @@ INITIAL_ACTIVE_SHARDS: 64 # --------------------------------------------------------------- # Misc # 2**10 (= 1,024) -MAX_SHARDS: 8 +MAX_SHARDS: 1024 # 2**7 (= 128) LIGHT_CLIENT_COMMITTEE_SIZE: 128 # 2**3 (= 8) @@ -48,9 +48,8 @@ DOMAIN_LIGHT_CLIENT: 0x82000000 DOMAIN_CUSTODY_BIT_SLASHING: 0x83000000 -# Phase 1: Custody Game +# custody-game # --------------------------------------------------------------- - # Time parameters # 2**1 (= 2) epochs, 12.8 minutes RANDAO_PENALTY_EPOCHS: 2 diff --git a/configs/minimal_phase0.yaml b/configs/minimal/phase0.yaml similarity index 100% rename from configs/minimal_phase0.yaml rename to configs/minimal/phase0.yaml diff --git a/configs/minimal_phase1.yaml b/configs/minimal/phase1.yaml similarity index 100% rename from configs/minimal_phase1.yaml rename to configs/minimal/phase1.yaml diff --git a/tests/core/pyspec/eth2spec/config/config_util.py b/tests/core/pyspec/eth2spec/config/config_util.py index 9a6f3c648..1977e5b05 100644 --- a/tests/core/pyspec/eth2spec/config/config_util.py +++ b/tests/core/pyspec/eth2spec/config/config_util.py @@ -1,5 +1,4 @@ import os -from os.path import join from pathlib import Path from typing import Dict, Any @@ -37,15 +36,15 @@ def load_config_file(configs_dir: str, presets_name: str) -> Dict[str, Any]: :param presets_name: The name of the presets. (lowercase snake_case) :return: Dictionary, mapping of constant-name -> constant-value """ - _, _, config_files = next(os.walk(configs_dir)) + present_dir = Path(configs_dir) / presets_name + _, _, config_files = next(os.walk(present_dir)) config_files.sort() loaded_config = {} for config_file_name in config_files: - if config_file_name.startswith(presets_name): - yaml = YAML(typ='base') - path = Path(join(configs_dir, config_file_name)) - loaded = yaml.load(path) - loaded_config.update(loaded) + yaml = YAML(typ='base') + path = present_dir / config_file_name + loaded = yaml.load(path) + loaded_config.update(loaded) assert loaded_config != {} out: Dict[str, Any] = dict()