eth2.0-specs/tests/core/pyspec/eth2spec/config
Jacek Sieka 46bc206740
Add `CONFIG_NAME` to configs
Runtime configurations apply to a certain network and the name of that
network is useful for humans such that they can talk about it.

Some of the existing configs already include a `CONFIG_NAME` toggle -
might as well add it here as well and avoid some confusion - this name
above all becomes useful in the beacon API.

By extension, the `CONFIG_NAME` config will appear in the beacon api as
a result of being defined here.
2021-12-29 13:02:36 +01:00
..
README.md rename eth1 and eth2 throughout specs and readme where reasonable 2021-08-18 17:13:24 -06:00
__init__.py merge in dev (v0.10) and fix reorg/lint issues 2020-01-13 18:55:21 +01:00
config_util.py Add `CONFIG_NAME` to configs 2021-12-29 13:02:36 +01:00

README.md

Consensus specs config util

For run-time configuration, see Configs documentation.

For compile-time presets, see Presets documentation and the build-targets flag for the pyspec distutils command.

Config usage:

from eth2spec.config import config_util
from eth2spec.phase0 import mainnet as spec
from pathlib import Path

# To load the default configurations
config_util.load_defaults(Path("consensus-specs/configs"))  # change path to point to equivalent of specs `configs` dir.
# After loading the defaults, a config can be chosen: 'mainnet', 'minimal', or custom network config (by file path)
spec.config = spec.Configuration(**config_util.load_config_file(Path('mytestnet.yaml')))

Note: previously the testnet config files included both preset and runtime-configuration data. The new config loader is compatible with this: all config vars are loaded from the file, but those that have become presets can be ignored.