Skip to content

Commit

Permalink
feat: add beacon snooper (#520)
Browse files Browse the repository at this point in the history
  • Loading branch information
barnabasbusa authored Mar 20, 2024
1 parent 177beeb commit 7e36191
Show file tree
Hide file tree
Showing 27 changed files with 236 additions and 56 deletions.
4 changes: 2 additions & 2 deletions .github/tests/mix-persistence.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ participants:
use_separate_vc: true
- el_type: nethermind
cl_type: prysm
- el_type: besu
cl_type: lighthouse
- el_type: erigon
cl_type: nimbus
use_separate_vc: true
- el_type: besu
cl_type: lighthouse
- el_type: reth
cl_type: lodestar
- el_type: ethereumjs
Expand Down
4 changes: 3 additions & 1 deletion .github/tests/mix-with-tools.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ participants:
- el_type: reth
cl_type: lodestar
- el_type: ethereumjs
cl_type: teku
cl_type: grandine
- el_type: geth
cl_type: grandine
additional_services:
- tx_spammer
- blob_spammer
Expand Down
5 changes: 3 additions & 2 deletions main.star
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def run(plan, args={}):
ranges = validator_ranges.generate_validator_ranges(
plan,
validator_ranges_config_template,
all_cl_contexts,
all_participants,
args_with_right_defaults.participants,
)

Expand Down Expand Up @@ -370,7 +370,8 @@ def run(plan, args={}):
dora.launch_dora(
plan,
dora_config_template,
all_cl_contexts,
all_participants,
args_with_right_defaults.participants,
el_cl_data_files_artifact_uuid,
network_params.electra_fork_epoch,
network_params.network,
Expand Down
18 changes: 11 additions & 7 deletions src/assertoor/assertoor_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,21 @@ def launch_assertoor(
vc_info = []

for index, participant in enumerate(participant_contexts):
participant_config = participant_configs[index]
cl_client = participant.cl_context
el_client = participant.el_context

(
full_name,
cl_client,
el_client,
participant_config,
) = shared_utils.get_client_names(
participant, index, participant_contexts, participant_configs
)
all_client_info.append(
new_client_info(
cl_client.ip_addr,
cl_client.http_port_num,
el_client.ip_addr,
el_client.rpc_port_num,
cl_client.beacon_service_name,
full_name,
)
)

Expand Down Expand Up @@ -162,11 +166,11 @@ def new_config_template_data(listen_port_num, client_info, vc_info, assertoor_pa
}


def new_client_info(cl_ip_addr, cl_port_num, el_ip_addr, el_port_num, service_name):
def new_client_info(cl_ip_addr, cl_port_num, el_ip_addr, el_port_num, full_name):
return {
"CLIPAddr": cl_ip_addr,
"CLPortNum": cl_port_num,
"ELIPAddr": el_ip_addr,
"ELPortNum": el_port_num,
"Name": service_name,
"Name": full_name,
}
10 changes: 6 additions & 4 deletions src/cl/cl_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ constants = import_module("../package_io/constants.star")
input_parser = import_module("../package_io/input_parser.star")
shared_utils = import_module("../shared_utils/shared_utils.star")

snooper = import_module("../snooper/snooper_engine_launcher.star")
engine_snooper = import_module("../snooper/snooper_engine_launcher.star")

cl_context_BOOTNODE = None

Expand Down Expand Up @@ -130,10 +130,10 @@ def launch(
cl_context = None
snooper_engine_context = None
if participant.snooper_enabled:
snooper_service_name = "snooper-{0}-{1}-{2}".format(
snooper_service_name = "snooper-engine-{0}-{1}-{2}".format(
index_str, cl_type, el_type
)
snooper_engine_context = snooper.launch(
snooper_engine_context = engine_snooper.launch(
plan,
snooper_service_name,
el_context,
Expand All @@ -145,7 +145,7 @@ def launch(
)
)
all_snooper_engine_contexts.append(snooper_engine_context)

full_name = "{0}-{1}-{2}".format(index_str, el_type, cl_type)
if index == 0:
cl_context = launch_method(
plan,
Expand All @@ -156,6 +156,7 @@ def launch(
global_log_level,
cl_context_BOOTNODE,
el_context,
full_name,
new_cl_node_validator_keystores,
participant.cl_min_cpu,
participant.cl_max_cpu,
Expand Down Expand Up @@ -187,6 +188,7 @@ def launch(
global_log_level,
boot_cl_client_ctx,
el_context,
full_name,
new_cl_node_validator_keystores,
participant.cl_min_cpu,
participant.cl_max_cpu,
Expand Down
5 changes: 4 additions & 1 deletion src/cl/grandine/grandine_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def launch(
global_log_level,
bootnode_context,
el_context,
full_name,
node_keystore_files,
cl_min_cpu,
cl_max_cpu,
Expand Down Expand Up @@ -130,6 +131,7 @@ def launch(
beacon_service_name,
bootnode_context,
el_context,
full_name,
log_level,
node_keystore_files,
cl_min_cpu,
Expand Down Expand Up @@ -207,6 +209,7 @@ def get_beacon_config(
service_name,
bootnode_contexts,
el_context,
full_name,
log_level,
node_keystore_files,
cl_min_cpu,
Expand Down Expand Up @@ -274,7 +277,7 @@ def get_beacon_config(
"--keystore-dir=" + validator_keys_dirpath,
"--keystore-password-file=" + validator_secrets_dirpath,
"--suggested-fee-recipient=" + constants.VALIDATING_REWARDS_ACCOUNT,
"--graffiti=" + constants.CL_TYPE.grandine + "-" + el_context.client_name,
"--graffiti=" + full_name,
]

if network not in constants.PUBLIC_NETWORKS:
Expand Down
1 change: 1 addition & 0 deletions src/cl/lighthouse/lighthouse_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def launch(
global_log_level,
bootnode_contexts,
el_context,
full_name,
node_keystore_files,
cl_min_cpu,
cl_max_cpu,
Expand Down
1 change: 1 addition & 0 deletions src/cl/lodestar/lodestar_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def launch(
global_log_level,
bootnode_contexts,
el_context,
full_name,
node_keystore_files,
cl_min_cpu,
cl_max_cpu,
Expand Down
5 changes: 4 additions & 1 deletion src/cl/nimbus/nimbus_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def launch(
global_log_level,
bootnode_contexts,
el_context,
full_name,
node_keystore_files,
cl_min_cpu,
cl_max_cpu,
Expand Down Expand Up @@ -143,6 +144,7 @@ def launch(
beacon_service_name,
bootnode_contexts,
el_context,
full_name,
log_level,
node_keystore_files,
cl_min_cpu,
Expand Down Expand Up @@ -219,6 +221,7 @@ def get_beacon_config(
service_name,
bootnode_contexts,
el_context,
full_name,
log_level,
node_keystore_files,
cl_min_cpu,
Expand Down Expand Up @@ -298,7 +301,7 @@ def get_beacon_config(
"--validators-dir=" + validator_keys_dirpath,
"--secrets-dir=" + validator_secrets_dirpath,
"--suggested-fee-recipient=" + constants.VALIDATING_REWARDS_ACCOUNT,
"--graffiti=" + constants.CL_TYPE.nimbus + "-" + el_context.client_name,
"--graffiti=" + full_name,
"--keymanager",
"--keymanager-port={0}".format(vc_shared.VALIDATOR_HTTP_PORT_NUM),
"--keymanager-address=0.0.0.0",
Expand Down
1 change: 1 addition & 0 deletions src/cl/prysm/prysm_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def launch(
global_log_level,
bootnode_contexts,
el_context,
full_name,
node_keystore_files,
cl_min_cpu,
cl_max_cpu,
Expand Down
8 changes: 4 additions & 4 deletions src/cl/teku/teku_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def launch(
global_log_level,
bootnode_context,
el_context,
full_name,
node_keystore_files,
cl_min_cpu,
cl_max_cpu,
Expand Down Expand Up @@ -134,6 +135,7 @@ def launch(
beacon_service_name,
bootnode_context,
el_context,
full_name,
log_level,
node_keystore_files,
cl_min_cpu,
Expand Down Expand Up @@ -213,6 +215,7 @@ def get_beacon_config(
service_name,
bootnode_contexts,
el_context,
full_name,
log_level,
node_keystore_files,
cl_min_cpu,
Expand Down Expand Up @@ -295,10 +298,7 @@ def get_beacon_config(
),
"--validators-proposer-default-fee-recipient="
+ constants.VALIDATING_REWARDS_ACCOUNT,
"--validators-graffiti="
+ constants.CL_TYPE.teku
+ "-"
+ el_context.client_name,
"--validators-graffiti=" + full_name,
"--validator-api-enabled=true",
"--validator-api-host-allowlist=*",
"--validator-api-port={0}".format(vc_shared.VALIDATOR_HTTP_PORT_NUM),
Expand Down
20 changes: 15 additions & 5 deletions src/dora/dora_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,23 @@ USED_PORTS = {
def launch_dora(
plan,
config_template,
cl_contexts,
participant_contexts,
participant_configs,
el_cl_data_files_artifact_uuid,
electra_fork_epoch,
network,
global_node_selectors,
):
all_cl_client_info = []
for index, client in enumerate(cl_contexts):
for index, participant in enumerate(participant_contexts):
full_name, cl_client, _, _ = shared_utils.get_client_names(
participant, index, participant_contexts, participant_configs
)
all_cl_client_info.append(
new_cl_client_info(
client.ip_addr, client.http_port_num, client.beacon_service_name
cl_client.ip_addr,
cl_client.http_port_num,
full_name,
)
)

Expand Down Expand Up @@ -113,5 +119,9 @@ def new_config_template_data(network, listen_port_num, cl_client_info):
}


def new_cl_client_info(ip_addr, port_num, service_name):
return {"IPAddr": ip_addr, "PortNum": port_num, "Name": service_name}
def new_cl_client_info(ip_addr, port_num, full_name):
return {
"IPAddr": ip_addr,
"PortNum": port_num,
"FullName": full_name,
}
2 changes: 2 additions & 0 deletions src/package_io/constants.star
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ KEYMANAGER_P12_MOUNT_PATH_ON_CONTAINER = (
KEYMANAGER_P12_MOUNT_PATH_ON_CLIENTS + "/validator_keystore.p12"
)

DEFAULT_SNOOPER_IMAGE = "ethpandaops/json-rpc-snoop:1.1.0"

GENESIS_FORK_VERSION = "0x10000038"
BELLATRIX_FORK_VERSION = "0x30000038"
CAPELLA_FORK_VERSION = "0x40000038"
Expand Down
Loading

0 comments on commit 7e36191

Please sign in to comment.