From 48e1ef193a3c640ddd3df264f25470989908f1c7 Mon Sep 17 00:00:00 2001 From: protolambda Date: Tue, 18 May 2021 21:31:27 +0200 Subject: [PATCH] update docs with config usage --- tests/core/pyspec/eth2spec/config/README.md | 4 ++-- tests/formats/README.md | 19 ++++++------------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/tests/core/pyspec/eth2spec/config/README.md b/tests/core/pyspec/eth2spec/config/README.md index 1d7891037..ce24c9c5a 100644 --- a/tests/core/pyspec/eth2spec/config/README.md +++ b/tests/core/pyspec/eth2spec/config/README.md @@ -6,13 +6,13 @@ For configuration, see [Configs documentation](../../../../../configs/README.md) ```python from eth2spec.config import config_util -from eth2spec.phase0.mainnet import as spec +from eth2spec.phase0 import mainnet as spec from pathlib import Path # To load the default configurations config_util.load_defaults(Path("eth2.0-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('mytestnet.yaml')) +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. diff --git a/tests/formats/README.md b/tests/formats/README.md index 16f756fc1..39968832f 100644 --- a/tests/formats/README.md +++ b/tests/formats/README.md @@ -176,21 +176,14 @@ reveal_deadlines_setting: -- optional, can have 2 different values: 1: `process_reveal_deadlines` is OFF. ``` +##### `config.yaml` -## Config +The runtime-configurables may be different for specific tests. +When present, this replaces the default runtime-config that comes with the otherwise compile-time preset settings. -A configuration is a separate YAML file. -Separation of configuration and tests aims to: -- Prevent duplication of configuration -- Make all tests easy to upgrade (e.g. when a new config constant is introduced) -- Clearly define which constants to use -- Be easily shareable between clients, for cross-client short- or long-lived testnets -- Minimize the amount of different constants permutations to compile as a client. - *Note*: Some clients prefer compile-time constants and optimizations. - They should compile for each configuration once, and run the corresponding tests per build target. -- Include constants to coordinate forking with - -The format is described in [`/configs`](../../configs/README.md#format). +The format matches that of the `mainnet_config.yaml` and `minimal_config.yaml`, +see the [`/configs`](../../configs/README.md#format) documentation. +Config values that are introduced at a later fork may be omitted from tests of previous forks. ## Config sourcing