Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to configure slots per second #2

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 22 additions & 18 deletions src/cl/prysm/prysm_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ VALIDATOR_MAX_CPU = 300
VALIDATOR_MIN_MEMORY = 64
VALIDATOR_MAX_MEMORY = 256


MIN_PEERS = 1
MIN_PEERS = 0

PRIVATE_IP_ADDRESS_PLACEHOLDER = "KURTOSIS_IP_ADDR_PLACEHOLDER"

Expand Down Expand Up @@ -184,22 +183,27 @@ def launch(
validator_node_service_name, validator_config
)

# TODO(old) add validator availability using the validator API: https://ethereum.github.io/beacon-APIs/?urls.primaryName=v1#/ValidatorRequiredApi | from eth2-merge-kurtosis-module
beacon_node_identity_recipe = GetHttpRequestRecipe(
endpoint="/eth/v1/node/identity",
port_id=HTTP_PORT_ID,
extract={
"enr": ".data.enr",
"multiaddr": ".data.discovery_addresses[0]",
"peer_id": ".data.peer_id",
},
)
response = plan.request(
recipe=beacon_node_identity_recipe, service_name=beacon_node_service_name
)
beacon_node_enr = response["extract.enr"]
beacon_multiaddr = response["extract.multiaddr"]
beacon_peer_id = response["extract.peer_id"]
beacon_node_enr = ""
beacon_multiaddr = ""
beacon_peer_id = ""

if MIN_PEERS > 0:
# TODO(old) add validator availability using the validator API: https://ethereum.github.io/beacon-APIs/?urls.primaryName=v1#/ValidatorRequiredApi | from eth2-merge-kurtosis-module
beacon_node_identity_recipe = GetHttpRequestRecipe(
endpoint="/eth/v1/node/identity",
port_id=HTTP_PORT_ID,
extract={
"enr": ".data.enr",
"multiaddr": ".data.discovery_addresses[0]",
"peer_id": ".data.peer_id",
},
)
response = plan.request(
recipe=beacon_node_identity_recipe, service_name=beacon_node_service_name
)
beacon_node_enr = response["extract.enr"]
beacon_multiaddr = response["extract.multiaddr"]
beacon_peer_id = response["extract.peer_id"]

beacon_metrics_port = beacon_service.ports[BEACON_MONITORING_PORT_ID]
beacon_metrics_url = "{0}:{1}".format(
Expand Down
2 changes: 1 addition & 1 deletion src/cl/teku/teku_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ BEACON_MAX_MEMORY = 1024
DEST_VALIDATOR_KEYS_DIRPATH_IN_SERVICE_CONTAINER = "$HOME/validator-keys"
DEST_VALIDATOR_SECRETS_DIRPATH_IN_SERVICE_CONTAINER = "$HOME/validator-secrets"

MIN_PEERS = 1
MIN_PEERS = 0

METRICS_PATH = "/metrics"

Expand Down
5 changes: 5 additions & 0 deletions src/package_io/input_parser.star
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ def input_parser(plan, input_args):
"deposit_contract_address"
],
seconds_per_slot=result["network_params"]["seconds_per_slot"],
slots_per_epoch=result["network_params"]["slots_per_epoch"],
genesis_delay=result["network_params"]["genesis_delay"],
max_churn=result["network_params"]["max_churn"],
ejection_balance=result["network_params"]["ejection_balance"],
Expand Down Expand Up @@ -320,6 +321,9 @@ def parse_network_params(input_args):
if result["network_params"]["seconds_per_slot"] == 0:
fail("seconds_per_slot is 0 needs to be > 0 ")

if result["network_params"]["slots_per_epoch"] == 0:
fail("slots_per_epoch is 0 needs to be > 0 ")

if result["network_params"]["genesis_delay"] == 0:
fail("genesis_delay is 0 needs to be > 0 ")

Expand Down Expand Up @@ -391,6 +395,7 @@ def default_network_params():
"network_id": "3151908",
"deposit_contract_address": "0x4242424242424242424242424242424242424242",
"seconds_per_slot": 12,
"slots_per_epoch": 6,
"genesis_delay": 120,
"max_churn": 8,
"ejection_balance": 16000000000,
Expand Down
3 changes: 2 additions & 1 deletion src/participant_network.star
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def launch_participant_network(
and network_params.electra_fork_epoch == None
):
ethereum_genesis_generator_image = (
"ethpandaops/ethereum-genesis-generator:2.0.4"
"tofelb/ethereum-genesis-generator:2.0.4-slots-per-epoch"
)
# we are running electra - experimental
elif network_params.electra_fork_epoch != None:
Expand All @@ -121,6 +121,7 @@ def launch_participant_network(
network_params.network_id,
network_params.deposit_contract_address,
network_params.seconds_per_slot,
network_params.slots_per_epoch,
network_params.preregistered_validator_keys_mnemonic,
total_number_of_validator_keys,
network_params.genesis_delay,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def generate_el_cl_genesis_data(
network_id,
deposit_contract_address,
seconds_per_slot,
slots_per_epoch,
preregistered_validator_keys_mnemonic,
total_num_validator_keys_to_preregister,
genesis_delay,
Expand All @@ -30,6 +31,7 @@ def generate_el_cl_genesis_data(
network_id,
deposit_contract_address,
seconds_per_slot,
slots_per_epoch,
preregistered_validator_keys_mnemonic,
total_num_validator_keys_to_preregister,
genesis_delay,
Expand Down Expand Up @@ -83,6 +85,7 @@ def new_env_file_for_el_cl_genesis_data(
network_id,
deposit_contract_address,
seconds_per_slot,
slots_per_epoch,
preregistered_validator_keys_mnemonic,
total_num_validator_keys_to_preregister,
genesis_delay,
Expand All @@ -97,9 +100,10 @@ def new_env_file_for_el_cl_genesis_data(
"NetworkId": network_id,
"DepositContractAddress": deposit_contract_address,
"SecondsPerSlot": seconds_per_slot,
"SlotsPerEpoch": slots_per_epoch,
"PreregisteredValidatorKeysMnemonic": preregistered_validator_keys_mnemonic,
"NumValidatorKeysToPreregister": total_num_validator_keys_to_preregister,
"GenesisDelay": genesis_delay,
"GenesisDelay": genesis_delay,
"MaxChurn": max_churn,
"EjectionBalance": ejection_balance,
"CapellaForkEpoch": capella_fork_epoch,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ export GENESIS_TIMESTAMP={{ .UnixTimestamp }}
export GENESIS_DELAY={{ .GenesisDelay }}
export MAX_CHURN={{ .MaxChurn }}
export EJECTION_BALANCE=16000000000
export SLOTS_PER_EPOCH={{ .SlotsPerEpoch }}