Skip to content

Commit

Permalink
feat: add devnets support (ethpandaops#384)
Browse files Browse the repository at this point in the history
  • Loading branch information
barnabasbusa authored Jan 5, 2024
1 parent 8d40056 commit 2bae099
Show file tree
Hide file tree
Showing 24 changed files with 621 additions and 266 deletions.
5 changes: 0 additions & 5 deletions .github/tests/besu-persistence.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
participants:
- el_client_type: besu
cl_client_type: teku
- el_client_type: erigon
cl_client_type: lighthouse
cl_client_type: teku
additional_services: []
persistent: true
28 changes: 28 additions & 0 deletions .github/tests/devnet-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
participants:
- el_client_type: geth
el_client_image: ethpandaops/geth:master
cl_client_type: teku
cl_client_image: ethpandaops/teku:master
- el_client_type: nethermind
el_client_image: ethpandaops/nethermind:master
cl_client_type: prysm
cl_client_image: ethpandaops/prysm:develop,ethpandaops/prysm-validator:develop
- el_client_type: erigon
el_client_image: ethpandaops/erigon:devel
cl_client_type: nimbus
cl_client_image: ethpandaops/nimbus:unstable
- el_client_type: besu
el_client_image: ethpandaops/besu:main
cl_client_type: lighthouse
cl_client_image: ethpandaops/lighthouse:unstable
- el_client_type: reth
el_client_image: ethpandaops/reth:main
cl_client_type: lodestar
cl_client_image: ethpandaops/lodestar:unstable
- el_client_type: ethereumjs
el_client_image: ethpandaops/ethereumjs:master
cl_client_type: teku
cl_client_image: ethpandaops/teku:master
network_params:
network: "dencun-devnet-12"
additional_services: []
5 changes: 0 additions & 5 deletions .github/tests/teku-persistence.yaml

This file was deleted.

37 changes: 19 additions & 18 deletions main.star
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ def run(plan, args={}):
)
prometheus_additional_metrics_jobs = []

raw_jwt_secret = read_file(static_files.JWT_PATH_FILEPATH)
jwt_file = plan.upload_files(
src=static_files.JWT_PATH_FILEPATH,
name="jwt_file",
)
plan.print("Read the prometheus, grafana templates")

plan.print(
Expand All @@ -86,6 +91,7 @@ def run(plan, args={}):
args_with_right_defaults.participants,
network_params,
args_with_right_defaults.global_client_log_level,
jwt_file,
persistent,
parallel_keystore_generation,
)
Expand Down Expand Up @@ -117,17 +123,18 @@ def run(plan, args={}):
all_cl_client_contexts,
args_with_right_defaults.participants,
)

if network_params.deneb_fork_epoch != 0:
plan.print("Launching 4788 contract deployer")
el_uri = "http://{0}:{1}".format(
all_el_client_contexts[0].ip_addr, all_el_client_contexts[0].rpc_port_num
)
eip4788_deployment.deploy_eip4788_contract_in_background(
plan,
genesis_constants.PRE_FUNDED_ACCOUNTS[5].private_key,
el_uri,
)
if network_params.network == "kurtosis":
if network_params.deneb_fork_epoch != 0:
plan.print("Launching 4788 contract deployer")
el_uri = "http://{0}:{1}".format(
all_el_client_contexts[0].ip_addr,
all_el_client_contexts[0].rpc_port_num,
)
eip4788_deployment.deploy_eip4788_contract_in_background(
plan,
genesis_constants.PRE_FUNDED_ACCOUNTS[5].private_key,
el_uri,
)

fuzz_target = "http://{0}:{1}".format(
all_el_client_contexts[0].ip_addr,
Expand Down Expand Up @@ -165,17 +172,11 @@ def run(plan, args={}):
beacon_uri = "{0}:{1}".format(
all_cl_client_contexts[0].ip_addr, all_cl_client_contexts[0].http_port_num
)
jwt_secret = plan.run_sh(
run="cat " + constants.JWT_AUTH_PATH + " | tr -d '\n'",
image="busybox",
files={"/data": el_cl_data_files_artifact_uuid},
wait=None,
)
endpoint = mock_mev.launch_mock_mev(
plan,
el_uri,
beacon_uri,
jwt_secret.output,
raw_jwt_secret,
args_with_right_defaults.global_client_log_level,
)
mev_endpoints.append(endpoint)
Expand Down
51 changes: 35 additions & 16 deletions src/cl/lighthouse/lighthouse_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ input_parser = import_module("../../package_io/input_parser.star")
cl_client_context = import_module("../../cl/cl_client_context.star")
node_metrics = import_module("../../node_metrics_info.star")
cl_node_ready_conditions = import_module("../../cl/cl_node_ready_conditions.star")

constants = import_module("../../package_io/constants.star")

blobber_launcher = import_module("../../blobber/blobber_launcher.star")
Expand Down Expand Up @@ -139,7 +138,10 @@ def launch(

# Launch Beacon node
beacon_config = get_beacon_config(
plan,
launcher.el_cl_genesis_data,
launcher.jwt_file,
launcher.network,
image,
beacon_service_name,
bootnode_contexts,
Expand Down Expand Up @@ -263,7 +265,10 @@ def launch(


def get_beacon_config(
plan,
el_cl_genesis_data,
jwt_file,
network,
image,
service_name,
boot_cl_client_ctxs,
Expand Down Expand Up @@ -325,7 +330,7 @@ def get_beacon_config(
# and the option says it's "useful for testing in smaller networks" (unclear what happens in larger networks)
"--disable-packet-filter",
"--execution-endpoints=" + EXECUTION_ENGINE_ENDPOINT,
"--jwt-secrets=" + constants.JWT_AUTH_PATH,
"--jwt-secrets=" + constants.JWT_MOUNT_PATH_ON_CONTAINER,
"--suggested-fee-recipient=" + constants.VALIDATING_REWARDS_ACCOUNT,
# Set per Paris' recommendation to reduce noise in the logs
"--subscribe-all-subnets",
Expand All @@ -337,20 +342,31 @@ def get_beacon_config(
# ^^^^^^^^^^^^^^^^^^^ METRICS CONFIG ^^^^^^^^^^^^^^^^^^^^^
]

if boot_cl_client_ctxs != None:
cmd.append(
"--boot-nodes="
+ ",".join(
[ctx.enr for ctx in boot_cl_client_ctxs[: constants.MAX_ENR_ENTRIES]]
if network == "kurtosis":
if boot_cl_client_ctxs != None:
cmd.append(
"--boot-nodes="
+ ",".join(
[
ctx.enr
for ctx in boot_cl_client_ctxs[: constants.MAX_ENR_ENTRIES]
]
)
)
)
cmd.append(
"--trusted-peers="
+ ",".join(
[
ctx.peer_id
for ctx in boot_cl_client_ctxs[: constants.MAX_ENR_ENTRIES]
]
)
)
elif network not in constants.PUBLIC_NETWORKS:
cmd.append(
"--trusted-peers="
+ ",".join(
[
ctx.peer_id
for ctx in boot_cl_client_ctxs[: constants.MAX_ENR_ENTRIES]
]
"--boot-nodes="
+ shared_utils.get_devnet_enrs_list(
plan, el_cl_genesis_data.files_artifact_uuid
)
)

Expand All @@ -362,7 +378,8 @@ def get_beacon_config(
endpoint="/eth/v1/node/identity", port_id=BEACON_HTTP_PORT_ID
)
files = {
constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data.files_artifact_uuid
constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data.files_artifact_uuid,
constants.JWT_MOUNTPOINT_ON_CLIENTS: jwt_file,
}

if persistent:
Expand Down Expand Up @@ -476,7 +493,9 @@ def get_validator_config(
)


def new_lighthouse_launcher(el_cl_genesis_data):
def new_lighthouse_launcher(el_cl_genesis_data, jwt_file, network):
return struct(
el_cl_genesis_data=el_cl_genesis_data,
jwt_file=jwt_file,
network=network,
)
30 changes: 23 additions & 7 deletions src/cl/lodestar/lodestar_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ def launch(

# Launch Beacon node
beacon_config = get_beacon_config(
plan,
launcher.el_cl_genesis_data,
launcher.jwt_file,
launcher.network,
image,
beacon_service_name,
bootnode_contexts,
Expand Down Expand Up @@ -232,7 +235,10 @@ def launch(


def get_beacon_config(
plan,
el_cl_genesis_data,
jwt_file,
network,
image,
service_name,
bootnode_contexts,
Expand Down Expand Up @@ -293,27 +299,35 @@ def get_beacon_config(
"--enr.udp={0}".format(DISCOVERY_PORT_NUM),
# Set per Pari's recommendation to reduce noise in the logs
"--subscribeAllSubnets=true",
"--jwt-secret=" + constants.JWT_AUTH_PATH,
"--jwt-secret=" + constants.JWT_MOUNT_PATH_ON_CONTAINER,
# vvvvvvvvvvvvvvvvvvv METRICS CONFIG vvvvvvvvvvvvvvvvvvvvv
"--metrics",
"--metrics.address=0.0.0.0",
"--metrics.port={0}".format(METRICS_PORT_NUM),
# ^^^^^^^^^^^^^^^^^^^ METRICS CONFIG ^^^^^^^^^^^^^^^^^^^^^
]

if bootnode_contexts != None:
if network == "kurtosis":
if bootnode_contexts != None:
cmd.append(
"--bootnodes="
+ ",".join(
[ctx.enr for ctx in bootnode_contexts[: constants.MAX_ENR_ENTRIES]]
)
)
elif network not in constants.PUBLIC_NETWORKS:
cmd.append(
"--bootnodes="
+ ",".join(
[ctx.enr for ctx in bootnode_contexts[: constants.MAX_ENR_ENTRIES]]
+ shared_utils.get_devnet_enrs_list(
plan, el_cl_genesis_data.files_artifact_uuid
)
)

if len(extra_params) > 0:
# this is a repeated<proto type>, we convert it into Starlark
cmd.extend([param for param in extra_params])
files = {
constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data.files_artifact_uuid
constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data.files_artifact_uuid,
constants.JWT_MOUNTPOINT_ON_CLIENTS: jwt_file,
}

if persistent:
Expand Down Expand Up @@ -424,7 +438,9 @@ def get_validator_config(
)


def new_lodestar_launcher(el_cl_genesis_data):
def new_lodestar_launcher(el_cl_genesis_data, jwt_file, network):
return struct(
el_cl_genesis_data=el_cl_genesis_data,
jwt_file=jwt_file,
network=network,
)
35 changes: 25 additions & 10 deletions src/cl/nimbus/nimbus_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,10 @@ def launch(
bn_max_mem = int(bn_max_mem) if int(bn_max_mem) > 0 else BEACON_MAX_MEMORY

beacon_config = get_beacon_config(
plan,
launcher.el_cl_genesis_data,
launcher.jwt_file,
launcher.network,
image,
beacon_service_name,
bootnode_contexts,
Expand Down Expand Up @@ -261,7 +264,10 @@ def launch(


def get_beacon_config(
plan,
el_cl_genesis_data,
jwt_file,
network,
image,
service_name,
bootnode_contexts,
Expand Down Expand Up @@ -325,7 +331,7 @@ def get_beacon_config(
"--subscribe-all-subnets=true",
# Nimbus can handle a max of 256 threads, if the host has more then nimbus crashes. Setting it to 4 so it doesn't crash on build servers
"--num-threads=4",
"--jwt-secret=" + constants.JWT_AUTH_PATH,
"--jwt-secret=" + constants.JWT_MOUNT_PATH_ON_CONTAINER,
# vvvvvvvvvvvvvvvvvvv METRICS CONFIG vvvvvvvvvvvvvvvvvvvvv
"--metrics",
"--metrics-address=0.0.0.0",
Expand All @@ -346,20 +352,27 @@ def get_beacon_config(
if node_keystore_files != None and not split_mode_enabled:
cmd.extend(validator_flags)

if bootnode_contexts == None:
# Copied from https://github.com/status-im/nimbus-eth2/blob/67ab477a27e358d605e99bffeb67f98d18218eca/scripts/launch_local_testnet.sh#L417
# See explanation there
cmd.append("--subscribe-all-subnets")
else:
for ctx in bootnode_contexts[: constants.MAX_ENR_ENTRIES]:
cmd.append("--bootstrap-node=" + ctx.enr)
cmd.append("--direct-peer=" + ctx.multiaddr)
if network == "kurtosis":
if bootnode_contexts == None:
# Copied from https://github.com/status-im/nimbus-eth2/blob/67ab477a27e358d605e99bffeb67f98d18218eca/scripts/launch_local_testnet.sh#L417
# See explanation there
cmd.append("--subscribe-all-subnets")
else:
for ctx in bootnode_contexts[: constants.MAX_ENR_ENTRIES]:
cmd.append("--bootstrap-node=" + ctx.enr)
cmd.append("--direct-peer=" + ctx.multiaddr)
elif network not in constants.PUBLIC_NETWORKS:
cmd.append(
"--bootstrap-node="
+ shared_utils.get_devnet_enr(plan, el_cl_genesis_data.files_artifact_uuid)
)

if len(extra_params) > 0:
cmd.extend([param for param in extra_params])

files = {
constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data.files_artifact_uuid,
constants.JWT_MOUNTPOINT_ON_CLIENTS: jwt_file,
}
if node_keystore_files != None and not split_mode_enabled:
files[
Expand Down Expand Up @@ -465,7 +478,9 @@ def get_validator_config(
)


def new_nimbus_launcher(el_cl_genesis_data):
def new_nimbus_launcher(el_cl_genesis_data, jwt_file, network):
return struct(
el_cl_genesis_data=el_cl_genesis_data,
jwt_file=jwt_file,
network=network,
)
Loading

0 comments on commit 2bae099

Please sign in to comment.