Merge pull request #2784 from status-im/config-name

Add `CONFIG_NAME` to configs
This commit is contained in:
Danny Ryan 2022-01-11 07:24:15 -07:00 committed by GitHub
commit a1719f9afc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 2 deletions

View File

@ -3,6 +3,13 @@
# Extends the mainnet preset # Extends the mainnet preset
PRESET_BASE: 'mainnet' PRESET_BASE: 'mainnet'
# Free-form short name of the network that this configuration applies to - known
# canonical network names include:
# * 'mainnet' - there can be only one
# * 'prater' - testnet
# Must match the regex: [a-z0-9\-]
CONFIG_NAME: 'mainnet'
# Transition # Transition
# --------------------------------------------------------------- # ---------------------------------------------------------------
# TBD, 2**256-2**10 is a placeholder # TBD, 2**256-2**10 is a placeholder

View File

@ -3,6 +3,13 @@
# Extends the minimal preset # Extends the minimal preset
PRESET_BASE: 'minimal' PRESET_BASE: 'minimal'
# Free-form short name of the network that this configuration applies to - known
# canonical network names include:
# * 'mainnet' - there can be only one
# * 'prater' - testnet
# Must match the regex: [a-z0-9\-]
CONFIG_NAME: 'minimal'
# Transition # Transition
# --------------------------------------------------------------- # ---------------------------------------------------------------
# TBD, 2**256-2**10 is a placeholder # TBD, 2**256-2**10 is a placeholder

View File

@ -752,7 +752,7 @@ def parse_config_vars(conf: Dict[str, str]) -> Dict[str, str]:
""" """
out: Dict[str, str] = dict() out: Dict[str, str] = dict()
for k, v in conf.items(): for k, v in conf.items():
if isinstance(v, str) and (v.startswith("0x") or k == 'PRESET_BASE'): if isinstance(v, str) and (v.startswith("0x") or k == 'PRESET_BASE' or k == 'CONFIG_NAME'):
# Represent byte data with string, to avoid misinterpretation as big-endian int. # Represent byte data with string, to avoid misinterpretation as big-endian int.
# Everything is either byte data or an integer, with PRESET_BASE as one exception. # Everything is either byte data or an integer, with PRESET_BASE as one exception.
out[k] = f"'{v}'" out[k] = f"'{v}'"

View File

@ -14,7 +14,7 @@ def parse_config_vars(conf: Dict[str, Any]) -> Dict[str, Any]:
out[k] = [int(item) if item.isdigit() else item for item in v] out[k] = [int(item) if item.isdigit() else item for item in v]
elif isinstance(v, str) and v.startswith("0x"): elif isinstance(v, str) and v.startswith("0x"):
out[k] = bytes.fromhex(v[2:]) out[k] = bytes.fromhex(v[2:])
elif k != 'PRESET_BASE': elif k != 'PRESET_BASE' and k != 'CONFIG_NAME':
out[k] = int(v) out[k] = int(v)
else: else:
out[k] = v out[k] = v