-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
778 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import os | ||
from enum import Enum | ||
from pathlib import Path | ||
|
||
from spec.base import Spec, parse_spec | ||
|
||
|
||
class Network(Enum): | ||
MAINNET = "mainnet" | ||
GNOSIS = "gnosis" | ||
HOLESKY = "holesky" | ||
|
||
# Special case where Vero uses the network specs returned by the beacon node(s) | ||
FETCH = "fetch" | ||
|
||
|
||
def parse_yaml_file(fp: Path) -> dict[str, str]: | ||
return_dict: dict[str, str] = {} | ||
with Path.open(fp) as f: | ||
for line in f: | ||
line = line.strip().split("#", maxsplit=1)[0] | ||
if line == "": | ||
continue | ||
|
||
name, value = line.split(": ", maxsplit=1) | ||
if name in return_dict: | ||
raise ValueError(f"{name} already defined as {return_dict[name]}") | ||
return_dict[name] = value.strip() | ||
return return_dict | ||
|
||
|
||
def get_network_spec(network: Network) -> Spec: | ||
spec_dict = {} | ||
|
||
spec_dict.update(parse_yaml_file(Path(__file__).parent / f"{network.value}.yaml")) | ||
|
||
preset_files_dir = ( | ||
Path(__file__).parent / "presets" / f"{spec_dict['PRESET_BASE'].strip("'")}" | ||
) | ||
for fname in os.listdir(preset_files_dir): | ||
spec_dict.update( | ||
parse_yaml_file( | ||
Path(preset_files_dir) / fname, | ||
) | ||
) | ||
|
||
return parse_spec(data=spec_dict) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
PRESET_BASE: 'gnosis' | ||
|
||
# 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: 'gnosis' | ||
|
||
# Genesis | ||
# --------------------------------------------------------------- | ||
# Dec 08, 2021, 13:00 UTC | ||
MIN_GENESIS_TIME: 1638968400 | ||
GENESIS_FORK_VERSION: 0x00000064 | ||
|
||
|
||
# Forking | ||
# --------------------------------------------------------------- | ||
# Some forks are disabled for now: | ||
# - These may be re-assigned to another fork-version later | ||
# - Temporarily set to max uint64 value: 2**64 - 1 | ||
|
||
# Altair | ||
ALTAIR_FORK_VERSION: 0x01000064 | ||
ALTAIR_FORK_EPOCH: 512 | ||
# Bellatrix | ||
BELLATRIX_FORK_VERSION: 0x02000064 | ||
BELLATRIX_FORK_EPOCH: 385536 # 2022-11-30T19:23:40.000Z | ||
# Capella | ||
CAPELLA_FORK_VERSION: 0x03000064 | ||
CAPELLA_FORK_EPOCH: 648704 # 2023-08-01T11:34:20.000Z | ||
# Deneb | ||
DENEB_FORK_VERSION: 0x04000064 | ||
DENEB_FORK_EPOCH: 889856 # 2024-03-11T18:30:20.000Z | ||
|
||
# Time parameters | ||
# --------------------------------------------------------------- | ||
# 5 seconds | ||
SECONDS_PER_SLOT: 5 | ||
|
||
# phase0 | ||
INTERVALS_PER_SLOT: 3 | ||
TARGET_AGGREGATORS_PER_COMMITTEE: 16 | ||
# altair | ||
TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE: 16 | ||
SYNC_COMMITTEE_SUBNET_COUNT: 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Extends the mainnet preset | ||
PRESET_BASE: 'mainnet' | ||
CONFIG_NAME: holesky | ||
|
||
# Genesis | ||
# --------------------------------------------------------------- | ||
# Sep-28-2023 11:55:00 +UTC | ||
MIN_GENESIS_TIME: 1695902100 | ||
GENESIS_FORK_VERSION: 0x01017000 | ||
|
||
|
||
# Forking | ||
# --------------------------------------------------------------- | ||
# Some forks are disabled for now: | ||
# - These may be re-assigned to another fork-version later | ||
# - Temporarily set to max uint64 value: 2**64 - 1 | ||
|
||
# Altair | ||
ALTAIR_FORK_VERSION: 0x02017000 | ||
ALTAIR_FORK_EPOCH: 0 | ||
# Bellatrix | ||
BELLATRIX_FORK_VERSION: 0x03017000 | ||
BELLATRIX_FORK_EPOCH: 0 | ||
# Capella | ||
CAPELLA_FORK_VERSION: 0x04017000 | ||
CAPELLA_FORK_EPOCH: 256 | ||
# Deneb | ||
DENEB_FORK_VERSION: 0x05017000 | ||
DENEB_FORK_EPOCH: 29696 | ||
|
||
# Time parameters | ||
# --------------------------------------------------------------- | ||
# 12 seconds | ||
SECONDS_PER_SLOT: 12 | ||
|
||
# phase0 | ||
INTERVALS_PER_SLOT: 3 | ||
TARGET_AGGREGATORS_PER_COMMITTEE: 16 | ||
# altair | ||
TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE: 16 | ||
SYNC_COMMITTEE_SUBNET_COUNT: 4 |
Oops, something went wrong.