Skip to content

Commit

Permalink
fix some checkpoint sync
Browse files Browse the repository at this point in the history
  • Loading branch information
barnabasbusa committed Jan 16, 2024
1 parent 7035304 commit ebc14e4
Show file tree
Hide file tree
Showing 8 changed files with 128 additions and 74 deletions.
65 changes: 37 additions & 28 deletions src/cl/lighthouse/lighthouse_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -358,42 +358,51 @@ def get_beacon_config(

if network not in constants.PUBLIC_NETWORKS:
cmd.append("--testnet-dir=" + constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER)
else:
cmd.append("--network=" + network)
cmd.append("--checkpoint-sync-url=" + constants.CHECKPOINT_SYNC_URL[network])

if network == "kurtosis":
if boot_cl_client_ctxs != None:
if network == "kurtosis": # 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 == "ephemery": # Ephemery
cmd.append(
"--checkpoint-sync-url=" + constants.CHECKPOINT_SYNC_URL[network]
)
cmd.append(
"--boot-nodes="
+ ",".join(
[
ctx.enr
for ctx in boot_cl_client_ctxs[: constants.MAX_ENR_ENTRIES]
]
+ shared_utils.get_devnet_enrs_list(
plan, el_cl_genesis_data.files_artifact_uuid
)
)
else: # Devnets
cmd.append(
"--trusted-peers="
+ ",".join(
[
ctx.peer_id
for ctx in boot_cl_client_ctxs[: constants.MAX_ENR_ENTRIES]
]
"--checkpoint-sync-url=https://checkpoint-sync.{0}.ethpandaops.io".format(
network
)
)
elif network not in constants.PUBLIC_NETWORKS:
cmd.append(
"--checkpoint-sync-url=https://checkpoint-sync.{0}.ethpandaops.io".format(
network
)
)
cmd.append(
"--boot-nodes="
+ shared_utils.get_devnet_enrs_list(
plan, el_cl_genesis_data.files_artifact_uuid
cmd.append(
"--boot-nodes="
+ shared_utils.get_devnet_enrs_list(
plan, el_cl_genesis_data.files_artifact_uuid
)
)
)
else: # Public networks
cmd.append("--network=" + network)
cmd.append("--checkpoint-sync-url=" + constants.CHECKPOINT_SYNC_URL[network])

if len(extra_params) > 0:
# this is a repeated<proto type>, we convert it into Starlark
Expand Down
14 changes: 11 additions & 3 deletions src/cl/lodestar/lodestar_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ def get_beacon_config(
+ constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER
+ "/genesis.ssz"
)
if network == "kurtosis": # kurtosis
if network == "kurtosis": # Kurtosis
if bootnode_contexts != None:
cmd.append(
"--bootnodes="
Expand All @@ -338,7 +338,15 @@ def get_beacon_config(
]
)
)
else: # devnet
elif network == "ephemery": # Ephemery
cmd.append("--checkpointSyncUrl=" + constants.CHECKPOINT_SYNC_URL[network])
cmd.append(
"--bootnodes="
+ shared_utils.get_devnet_enrs_list(
plan, el_cl_genesis_data.files_artifact_uuid
)
)
else: # Devnets
cmd.append(
"--checkpointSyncUrl=https://checkpoint-sync.{0}.ethpandaops.io".format(
network
Expand All @@ -350,7 +358,7 @@ def get_beacon_config(
plan, el_cl_genesis_data.files_artifact_uuid
)
)
else: # public testnet
else: # Public testnet
cmd.append("--network=" + network)
cmd.append("--checkpointSyncUrl=" + constants.CHECKPOINT_SYNC_URL[network])

Expand Down
25 changes: 15 additions & 10 deletions src/cl/nimbus/nimbus_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -374,21 +374,26 @@ def get_beacon_config(
if node_keystore_files != None and not split_mode_enabled:
cmd.extend(validator_flags)

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:
if network not in constants.PUBLIC_NETWORKS:
cmd.append(
"--bootstrap-file="
+ constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER
+ "/bootstrap_nodes.txt"
)
if network == "kurtosis": # Kurtosis
if bootnode_contexts == None:
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 == "ephemery": # Ephemery
# # Placeholder for future checkpoint sync
# else: # Devnets
# # Placeholder for future checkpoint sync
# else: # Public networks
# # Placeholder for future checkpoint sync

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

Expand Down
20 changes: 19 additions & 1 deletion src/cl/prysm/prysm_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ def get_beacon_config(
"--monitoring-port={0}".format(BEACON_MONITORING_PORT_NUM)
# ^^^^^^^^^^^^^^^^^^^ METRICS CONFIG ^^^^^^^^^^^^^^^^^^^^^
]

if network not in constants.PUBLIC_NETWORKS:
cmd.append("--p2p-static-id=true")
cmd.append(
Expand All @@ -341,7 +342,24 @@ def get_beacon_config(
for ctx in bootnode_contexts[: constants.MAX_ENR_ENTRIES]:
cmd.append("--peer=" + ctx.multiaddr)
cmd.append("--bootstrap-node=" + ctx.enr)
else: # Devnet
elif network == "ephemery": # Ephemery
cmd.append(
"--genesis-beacon-api-url=" + constants.CHECKPOINT_SYNC_URL[network]
)
cmd.append(
"--checkpoint-sync-url=" + constants.CHECKPOINT_SYNC_URL[network]
)
cmd.append(
"--bootstrap-node="
+ constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER
+ "/boot_enr.yaml"
)
else: # Devnets
cmd.append(
"--genesis-beacon-api-url=https://checkpoint-sync.{0}.ethpandaops.io".format(
network
)
)
cmd.append(
"--checkpoint-sync-url=https://checkpoint-sync.{0}.ethpandaops.io".format(
network
Expand Down
65 changes: 39 additions & 26 deletions src/cl/teku/teku_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -370,46 +370,59 @@ def get_beacon_config(
+ el_client_context.client_name,
]

if node_keystore_files != None and not split_mode_enabled:
cmd.extend(validator_flags)

if network not in constants.PUBLIC_NETWORKS:
cmd.append(
"--initial-state="
+ constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER
+ "/genesis.ssz"
)
else:
cmd.append("--checkpoint-sync-url=" + constants.CHECKPOINT_SYNC_URL[network])

if node_keystore_files != None and not split_mode_enabled:
cmd.extend(validator_flags)
if network == "kurtosis":
if bootnode_contexts != None:
if network == "kurtosis": # Kurtosis
if bootnode_contexts != None:
cmd.append(
"--p2p-discovery-bootnodes="
+ ",".join(
[
ctx.enr
for ctx in bootnode_contexts[: constants.MAX_ENR_ENTRIES]
]
)
)
cmd.append(
"--p2p-static-peers="
+ ",".join(
[
ctx.multiaddr
for ctx in bootnode_contexts[: constants.MAX_ENR_ENTRIES]
]
)
)
elif network == "ephemery": # Ephemery
cmd.append(
"--checkpoint-sync-url=" + constants.CHECKPOINT_SYNC_URL[network]
)
cmd.append(
"--p2p-discovery-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
)
)
else: # Devnets
cmd.append(
"--p2p-static-peers="
+ ",".join(
[
ctx.multiaddr
for ctx in bootnode_contexts[: constants.MAX_ENR_ENTRIES]
]
"--checkpoint-sync-url=https://checkpoint-sync.{0}.ethpandaops.io".format(
network
)
)
elif network not in constants.PUBLIC_NETWORKS:
cmd.append(
"--checkpoint-sync-url=https://checkpoint-sync.{0}.ethpandaops.io".format(
network
)
)
cmd.append(
"--p2p-discovery-bootnodes="
+ shared_utils.get_devnet_enrs_list(
plan, el_cl_genesis_data.files_artifact_uuid
cmd.append(
"--p2p-discovery-bootnodes="
+ shared_utils.get_devnet_enrs_list(
plan, el_cl_genesis_data.files_artifact_uuid
)
)
)
else: # Public networks
cmd.append("--checkpoint-sync-url=" + constants.CHECKPOINT_SYNC_URL[network])

if len(extra_params) > 0:
# we do the list comprehension as the default extra_params is a proto repeated string
Expand Down
1 change: 1 addition & 0 deletions src/package_io/constants.star
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ CHECKPOINT_SYNC_URL = {
"goerli": "https://checkpoint-sync.goerli.ethpandaops.io",
"sepolia": "https://checkpoint-sync.sepolia.ethpandaops.io",
"holesky": "https://checkpoint-sync.holesky.ethpandaops.io",
"ephemery": "https://checkpointz.bordel.wtf/",
}

GENESIS_VALIDATORS_ROOT = {
Expand Down
8 changes: 4 additions & 4 deletions src/participant_network.star
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ def launch_participant_network(
validator_data = None
elif network_params.network == "ephemery":
el_cl_genesis_data_uuid = plan.run_sh(
run="mkdir -p /network-configs && curl -o latest.tar.gz https://ephemery.dev/latest.tar.gz && tar xvzf latest.tar.gz -C /network-configs && cat /network-configs/genesis_validators_root.txt",
run="mkdir -p /network-configs/ && curl -o latest.tar.gz https://ephemery.dev/test-genesis2.tar.gz && tar xvzf latest.tar.gz -C /network-configs && cat /network-configs/genesis_validators_root.txt",
image="badouralix/curl-jq",
store=[StoreSpec(src="/network-configs/", name="el_cl_genesis")],
store=[StoreSpec(src="/network-configs/", name="el_cl_genesis_data")],
)
genesis_validators_root = el_cl_genesis_data_uuid.output
el_cl_data = el_cl_genesis_data.new_el_cl_genesis_data(
Expand Down Expand Up @@ -202,10 +202,10 @@ def launch_participant_network(
genesis_validators_root,
)
final_genesis_timestamp = shared_utils.read_genesis_timestamp_from_config(
plan, el_cl_genesis_uuid
plan, el_cl_genesis_data_uuid.files_artifacts[0]
)
network_id = shared_utils.read_genesis_network_id_from_config(
plan, el_cl_genesis_uuid
plan, el_cl_genesis_data_uuid.files_artifacts[0]
)
validator_data = None

Expand Down
4 changes: 2 additions & 2 deletions src/shared_utils/shared_utils.star
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def read_genesis_timestamp_from_config(plan, filename):
packages=["PyYAML"],
run="""
import yaml
with open("/network-configs/config.yaml", "r") as f:
with open("/network-configs/network-configs/config.yaml", "r") as f:
yaml_data = yaml.safe_load(f)
min_genesis_time = int(yaml_data.get("MIN_GENESIS_TIME", 0))
Expand All @@ -132,7 +132,7 @@ def read_genesis_network_id_from_config(plan, filename):
packages=["PyYAML"],
run="""
import yaml
with open("/network-configs/config.yaml", "r") as f:
with open("/network-configs/network-configs/config.yaml", "r") as f:
yaml_data = yaml.safe_load(f)
network_id = int(yaml_data.get("DEPOSIT_NETWORK_ID", 0))
print(network_id, end="")
Expand Down

0 comments on commit ebc14e4

Please sign in to comment.