Fix MAX_SHARDS and move config files to configs/{network}/{fork}

This commit is contained in:
Hsiao-Wei Wang 2020-06-12 00:47:26 +08:00
parent 85ec791935
commit aa75fb0b69
No known key found for this signature in database
GPG Key ID: 95B070122902DEA4
5 changed files with 9 additions and 11 deletions

View File

@ -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

View File

@ -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()