Skip to content

Commit

Permalink
feat: enable preset to be set, mainnet/minimal (#524)
Browse files Browse the repository at this point in the history
  • Loading branch information
barnabasbusa authored Mar 28, 2024
1 parent 969012c commit f6e1b13
Show file tree
Hide file tree
Showing 9 changed files with 121 additions and 10 deletions.
24 changes: 24 additions & 0 deletions .github/tests/minimal.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
participants:
- el_type: geth
cl_type: teku
- el_type: geth
cl_type: prysm
cl_extra_params: [--minimal-config=true]
cl_image: ethpandaops/prysm-beacon-chain:develop-minimal
- el_type: erigon
cl_type: nimbus
cl_image: ethpandaops/nimbus-eth2:unstable-minimal
- el_type: besu
cl_type: lighthouse
cl_image: ethpandaops/lighthouse:unstable-minimal
- el_type: reth
cl_type: lodestar
cl_extra_env_vars: { LODESTAR_PRESET: minimal }
vc_extra_env_vars: { LODESTAR_PRESET: minimal }
- el_type: geth
cl_type: grandine
cl_image: ethpandaops/grandine:develop-minimal
network_params:
preset: minimal
seconds_per_slot: 6
additional_services: []
37 changes: 37 additions & 0 deletions .github/tests/mix-with-tools-minimal.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
participants:
- el_type: geth
cl_type: teku
- el_type: geth
cl_type: prysm
cl_extra_params: [--minimal-config=true]
cl_image: ethpandaops/prysm-beacon-chain:develop-minimal
- el_type: erigon
cl_type: nimbus
cl_image: ethpandaops/nimbus-eth2:unstable-minimal
- el_type: besu
cl_type: lighthouse
cl_image: ethpandaops/lighthouse:unstable-minimal
- el_type: reth
cl_type: lodestar
cl_extra_env_vars: { LODESTAR_PRESET: minimal }
vc_extra_env_vars: { LODESTAR_PRESET: minimal }
- el_type: geth
cl_type: grandine
cl_image: ethpandaops/grandine:develop-minimal
network_params:
preset: minimal
seconds_per_slot: 6
additional_services:
- tx_spammer
- blob_spammer
- el_forkmon
- beacon_metrics_gazer
- dora
- prometheus_grafana
- goomy_blob
- custom_flood
- blobscan
- blockscout
ethereum_metrics_exporter_enabled: true
snooper_enabled: true
keymanager_enabled: true
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,16 @@ network_params:
# The snapshots are taken with https://github.com/ethpandaops/snapshotter
network_sync_base_url: https://ethpandaops-ethereum-node-snapshots.ams3.digitaloceanspaces.com/
# Preset for the network
# Default: "mainnet"
# Options: "mainnet", "minimal"
# "minimal" preset will spin up a network with minimal preset. This is useful for rapid testing and development.
# 192 seconds to get to finalized epoch vs 1536 seconds with mainnet defaults
# Please note that minimal preset requires alternative client images.
# For an example of minimal preset, please refer to [minimal.yaml](.github/tests/minimal.yaml)
preset: "mainnet"
# Global parameters for the network
# By default includes
Expand Down
4 changes: 2 additions & 2 deletions src/package_io/constants.star
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ DENEB_FORK_VERSION = "0x50000038"
ELECTRA_FORK_VERSION = "0x60000038"

ETHEREUM_GENESIS_GENERATOR = struct(
capella_genesis="ethpandaops/ethereum-genesis-generator:2.0.12", # Deprecated
deneb_genesis="ethpandaops/ethereum-genesis-generator:3.0.0", # Default
capella_genesis="ethpandaops/ethereum-genesis-generator:2.0.12", # Deprecated (no support for minimal config)
deneb_genesis="ethpandaops/ethereum-genesis-generator:3.0.2", # Default
verkle_support_genesis="ethpandaops/ethereum-genesis-generator:3.0.0-rc.19", # soon to be deneb genesis, waiting for rebase
verkle_genesis="ethpandaops/ethereum-genesis-generator:verkle-gen-v1.0.0",
)
Expand Down
39 changes: 33 additions & 6 deletions src/package_io/input_parser.star
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ MEV_BOOST_RELAY_DEFAULT_IMAGE = "flashbots/mev-boost-relay:0.27"

MEV_BOOST_RELAY_IMAGE_NON_ZERO_CAPELLA = "flashbots/mev-boost-relay:0.26"

NETHERMIND_NODE_NAME = "nethermind"
NIMBUS_NODE_NAME = "nimbus"

# Placeholder value for the deneb fork epoch if electra is being run
# TODO: This is a hack, and should be removed once we electra is rebased on deneb
HIGH_DENEB_VALUE_FORK_VERKLE = 2000000000
Expand Down Expand Up @@ -236,6 +233,7 @@ def input_parser(plan, input_args):
],
shard_committee_period=result["network_params"]["shard_committee_period"],
network_sync_base_url=result["network_params"]["network_sync_base_url"],
preset=result["network_params"]["preset"],
),
mev_params=struct(
mev_relay_image=result["mev_params"]["mev_relay_image"],
Expand Down Expand Up @@ -339,10 +337,27 @@ def parse_network_params(input_args):
cl_type = participant["cl_type"]
vc_type = participant["vc_type"]

if cl_type in (NIMBUS_NODE_NAME) and (
result["network_params"]["seconds_per_slot"] < 12
if (
cl_type in (constants.CL_TYPE.nimbus)
and (result["network_params"]["seconds_per_slot"] < 12)
and result["network_params"]["preset"] == "mainnet"
):
fail("nimbus can't be run with slot times below 12 seconds")
fail(
"nimbus can't be run with slot times below 12 seconds with "
+ result["network_params"]["preset"]
+ " preset"
)

if (
cl_type in (constants.CL_TYPE.nimbus)
and (result["network_params"]["seconds_per_slot"] != 6)
and result["network_params"]["preset"] == "minimal"
):
fail(
"nimbus can't be run with slot times different than 6 seconds with "
+ result["network_params"]["preset"]
+ " preset"
)

el_image = participant["el_image"]
if el_image == "":
Expand Down Expand Up @@ -508,6 +523,17 @@ def parse_network_params(input_args):
for participant in result["participants"]:
participant["validator_count"] = 0

if result["network_params"]["preset"] not in ["mainnet", "minimal"]:
fail(
"preset "
+ result["network_params"]["preset"]
+ " is not supported, it can only be mainnet or minimal"
)

if result["network_params"]["preset"] == "minimal":
if result["network_params"]["deneb_fork_epoch"] > 0:
fail("minimal preset only supports deneb genesis fork epoch")

return result


Expand Down Expand Up @@ -613,6 +639,7 @@ def default_network_params():
"deneb_fork_epoch": 0,
"electra_fork_epoch": 500,
"network_sync_base_url": "https://ethpandaops-ethereum-node-snapshots.ams3.digitaloceanspaces.com/",
"preset": "mainnet",
}


Expand Down
1 change: 1 addition & 0 deletions src/participant_network.star
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def launch_participant_network(
latest_block.files_artifacts[0] if latest_block != "" else "",
network_params.min_validator_withdrawability_delay,
network_params.shard_committee_period,
network_params.preset,
)
elif network_params.network in constants.PUBLIC_NETWORKS:
# We are running a public network
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def generate_el_cl_genesis_data(
latest_block,
min_validator_withdrawability_delay,
shard_committee_period,
preset,
):
files = {}
shadowfork_file = ""
Expand All @@ -51,6 +52,7 @@ def generate_el_cl_genesis_data(
shadowfork_file,
min_validator_withdrawability_delay,
shard_committee_period,
preset,
)
genesis_generation_template = shared_utils.new_template_and_data(
genesis_generation_config_yml_template, template_data
Expand Down Expand Up @@ -126,6 +128,7 @@ def new_env_file_for_el_cl_genesis_data(
shadowfork_file,
min_validator_withdrawability_delay,
shard_committee_period,
preset,
):
return {
"UnixTimestamp": genesis_unix_timestamp,
Expand All @@ -148,4 +151,5 @@ def new_env_file_for_el_cl_genesis_data(
"ShadowForkFile": shadowfork_file,
"MinValidatorWithdrawabilityDelay": min_validator_withdrawability_delay,
"ShardCommitteePeriod": shard_committee_period,
"Preset": preset,
}
10 changes: 9 additions & 1 deletion src/vc/prysm.star
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ def get_config(
"--monitoring-port={0}".format(vc_shared.VALIDATOR_CLIENT_METRICS_PORT_NUM),
# ^^^^^^^^^^^^^^^^^^^ METRICS CONFIG ^^^^^^^^^^^^^^^^^^^^^
"--graffiti=" + full_name,
"--enable-beacon-rest-api",
]

keymanager_api_cmd = [
Expand All @@ -65,6 +64,15 @@ def get_config(
"--rpc-host=0.0.0.0",
]

keymanager_api_cmd = [
"--rpc",
"--rpc-port={0}".format(vc_shared.VALIDATOR_HTTP_PORT_NUM),
"--rpc-host=0.0.0.0",
]

if cl_context.client_name != constants.CL_TYPE.prysm:
cmd.append("--enable-beacon-rest-api")

if len(extra_params) > 0:
# this is a repeated<proto type>, we convert it into Starlark
cmd.extend([param for param in extra_params])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export PRESET_BASE="{{ .Preset }}"
export CHAIN_ID="{{ .NetworkId }}"
export DEPOSIT_CONTRACT_ADDRESS="{{ .DepositContractAddress }}"
export EL_AND_CL_MNEMONIC="{{ .PreregisteredValidatorKeysMnemonic }}"
Expand All @@ -9,7 +10,6 @@ export GENESIS_FORK_VERSION="{{ .GenesisForkVersion }}"
export ALTAIR_FORK_VERSION="0x20000038"
export BELLATRIX_FORK_VERSION="{{ .BellatrixForkVersion }}"
export CAPELLA_FORK_VERSION="{{ .CapellaForkVersion }}"
export CAPELLA_FORK_EPOCH="{{ .CapellaForkEpoch }}"
export DENEB_FORK_VERSION="{{ .DenebForkVersion }}"
export DENEB_FORK_EPOCH="{{ .DenebForkEpoch }}"
export ELECTRA_FORK_VERSION="{{ .ElectraForkVersion }}"
Expand Down

0 comments on commit f6e1b13

Please sign in to comment.